1
0
Fork 0
mirror of https://github.com/ton-blockchain/ton synced 2025-02-12 11:12:16 +00:00
ton/emulator
neodix42 e0605156de
Reworked TON portable artifacts (#1486)
* improve windows builds

* install nasm for openssl compilation on win

* install nasm for openssl compilation on win for github

* add create-state, proxy-liteserver, rldp-http-proxy, http-proxy, adnl-proxy, dht-server, libtonlibjson.so and libemulator.so to docker image

* build new artifacts inside Docker

* add files smartcont/auto/* to docker image

* build arm64 in docker branch build

* improve secp256k1 build

* adding natively portable binaries (all statically linked with libc++, without nixpkgs help) for x86-64 linux

* install missing headers on ubuntu 20.04

* use clang-16 on ubuntu 20.04

* remove gsl for portable artifacts; add -f key to generate-random-id in order to read addr_list from file;

* typo

* decode json

* decode json

* add github workflow for appimages creation

* add missing dependencies

* use libc++ for appimages artifacts

* typo

* appimages wihtout libc++

* appimages with libc++ and some checks

* add appimages to release (for testing)

* add appimages to release (for testing)

* add appimages to release (for testing)

* add appimages to release (for testing) 2

* add appimages to release (for testing) 3

* appimages only on ubuntu 22 with ssl-3 for now

* appimages only on ubuntu 20 with ssl-3 for now

* appimages only on ubuntu 20 with ssl-3 for now

* add export LD_LIBRARY_PATH="${APPDIR}/usr/lib:${LD_LIBRARY_PATH}" to appimage AppRun

* create release

* appimages without jemalloc

* bind specific libraries to appimages

* add libreadline

* add plain portable libs

* add proper /lib/x86_64-linux-gnu/libreadline.so.8

* app images build with libc

* try to ensure ABI compatibility with older glibc

* try to ensure ABI compatibility with older glibc for shared libraries

* shared lib without libc but with D_GLIBCXX_USE_CXX11_ABI and -static-libgcc -static-libstdc++

* add -fPIC -fcommon

* add /lib/x86_64-linux-gnu/libstdc++.so.6 to static binaries

* add -static-libgcc -static-libstdc++ to libtonlibjson and emulator when PORTABLE=1

* add -static-libgcc -static-libstdc++ to libtonlibjson and emulator when PORTABLE=1

* update emulator portable

* Update CMakeLists.txt

* test portable macos binaries

* do not use -static-libgcc -static-libstdc++ on mac for shared libs

* do not use -static-libgcc -static-libstdc++ on mac for shared libs

* adjust create-release.yml

* minor fixes, typos

* minor fixes

* linux apps double check

* avoid infinite loop when place in system bin dir

* avoid infinite loop when place in system bin dir 2

* test compilation on linux arm64

* test appimages on arm64 linux

* test appimages on arm64 linux 2

* add portable linux arm64 to release

* clean up

* update README.md
2025-01-21 11:27:25 +03:00
..
test Fix setting unixtime in test-emulator (#1084) 2024-07-29 15:26:41 +03:00
CMakeLists.txt Reworked TON portable artifacts (#1486) 2025-01-21 11:27:25 +03:00
emulator-emscripten.cpp Add method for fetching emulator version info (#1079) 2024-07-27 19:27:38 +03:00
emulator-extern.cpp emulator: set libraries when libs is NOT empty (#1449) 2025-01-15 13:50:18 +03:00
emulator-extern.h Add method for fetching emulator version info (#1079) 2024-07-27 19:27:38 +03:00
emulator_export_list Add method for fetching emulator version info (#1079) 2024-07-27 19:27:38 +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 emulator fixes, add basic tests (#1042) 2024-07-02 12:40:57 +03:00
transaction-emulator.h emulator fixes, add basic tests (#1042) 2024-07-02 12:40:57 +03:00
tvm-emulator.hpp emulator fixes, add basic tests (#1042) 2024-07-02 12:40:57 +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.