1
0
Fork 0
mirror of https://github.com/ton-blockchain/ton synced 2025-02-12 19:22:37 +00:00
ton/emulator
aleksej.paschenko aab1fe0751
Use BUILD_SHARED_LIBS to decide whether to build libemulator.so (#671)
* Update ubuntu:20.04 dockerfile (#636)

* Update Dockerfile

* Update Dockerfile

---------

Co-authored-by: neodiX42 <neodiX@ton.org>

* Use BUILD_SHARED_LIBS to decide whether to build libemulator.so

---------

Co-authored-by: EmelyanenkoK <emelyanenko.kirill@gmail.com>
Co-authored-by: neodiX42 <neodiX@ton.org>
2023-04-27 09:33:32 +03:00
..
CMakeLists.txt Use BUILD_SHARED_LIBS to decide whether to build libemulator.so (#671) 2023-04-27 09:33:32 +03:00
emulator-emscripten.cpp Add debug enabled flag to transaction and TVM emulator (#662) 2023-04-02 17:28:18 +03:00
emulator-extern.cpp Add debug enabled flag to transaction and TVM emulator (#662) 2023-04-02 17:28:18 +03:00
emulator-extern.h Add debug enabled flag to transaction and TVM emulator (#662) 2023-04-02 17:28:18 +03:00
emulator_export_list Add debug enabled flag to transaction and TVM emulator (#662) 2023-04-02 17:28:18 +03:00
README.md Add account state by transaction and emulator (extended) (#592) 2023-02-02 10:03:45 +03:00
StringLog.h Add account state by transaction and emulator (extended) (#592) 2023-02-02 10:03:45 +03:00
transaction-emulator.cpp Add debug enabled flag to transaction and TVM emulator (#662) 2023-04-02 17:28:18 +03:00
transaction-emulator.h Add debug enabled flag to transaction and TVM emulator (#662) 2023-04-02 17:28:18 +03:00
tvm-emulator.hpp Add debug enabled flag to transaction and TVM emulator (#662) 2023-04-02 17:28:18 +03:00

Emulator

Emulator is a shared library containing the following functionality:

  • Emulating blockchain transactions
  • Emulating TVM - get methods and sending external and internal messages.

Transaction Emulator

To emulate transaction you need the following data:

  • Account state of type ShardAccount.
  • Global config of type (Hashmap 32 ^Cell).
  • Inbound message of type MessageAny.

Optionally you can set emulation parameters:

  • ignore_chksig - whether CHKSIG instructions are set to always succeed. Default: false
  • lt - logical time of emulation. Default: next block's lt after the account's last transaction block.
  • unixtime - unix time of emulation. Default: current system time
  • rand_seed - random seed. Default: generated randomly
  • libs - shared libraries. If your smart contract uses shared libraries (located in masterchain), you should set this parameter.

Emulator output contains:

  • Transaction object (Transaction)
  • New account state (ShardAccount)
  • Actions cell (OutList n)
  • TVM log

TVM Emulator

TVM emulator is intended to run get methods or emulate sending message on TVM level. It is initialized with smart contract code and data cells.

  • To run get method you pass initial stack and method id (as integer).
  • To emulate sending message you pass message body and in case of internal message amount in nanograms.