1
0
Fork 0
mirror of https://github.com/ton-blockchain/ton synced 2025-03-09 15:40:10 +00:00

Emulator improvements (#687)

* ticktock, unixtime, optional config

* documentation

* fix account.now

* emulate tick/tock for emscripten

* remove excessive check

* limit stack serialization calls
This commit is contained in:
Marat 2023-05-24 10:40:04 +01:00 committed by GitHub
parent 86623b4cea
commit c527bfeceb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 154 additions and 20 deletions

View file

@ -80,8 +80,9 @@ EMULATOR_EXPORT bool transaction_emulator_set_debug_enabled(void *transaction_em
* @return Json object with error:
* {
* "success": false,
* "error": "Error description"
* // and optional fields "vm_exit_code" and "vm_log" in case external message was not accepted.
* "error": "Error description",
* "external_not_accepted": false,
* // and optional fields "vm_exit_code", "vm_log", "elapsed_time" in case external message was not accepted.
* }
* Or success:
* {
@ -89,11 +90,35 @@ EMULATOR_EXPORT bool transaction_emulator_set_debug_enabled(void *transaction_em
* "transaction": "Base64 encoded Transaction boc",
* "shard_account": "Base64 encoded new ShardAccount boc",
* "vm_log": "execute DUP...",
* "actions": "Base64 encoded compute phase actions boc (OutList n)"
* "actions": "Base64 encoded compute phase actions boc (OutList n)",
* "elapsed_time": 0.02
* }
*/
EMULATOR_EXPORT const char *transaction_emulator_emulate_transaction(void *transaction_emulator, const char *shard_account_boc, const char *message_boc);
/**
* @brief Emulate tick tock transaction
* @param transaction_emulator Pointer to TransactionEmulator object
* @param shard_account_boc Base64 encoded BoC serialized ShardAccount of special account
* @param is_tock True for tock transactions, false for tick
* @return Json object with error:
* {
* "success": false,
* "error": "Error description",
* "external_not_accepted": false
* }
* Or success:
* {
* "success": true,
* "transaction": "Base64 encoded Transaction boc",
* "shard_account": "Base64 encoded new ShardAccount boc",
* "vm_log": "execute DUP...",
* "actions": "Base64 encoded compute phase actions boc (OutList n)",
* "elapsed_time": 0.02
* }
*/
EMULATOR_EXPORT const char *transaction_emulator_emulate_tick_tock_transaction(void *transaction_emulator, const char *shard_account_boc, bool is_tock);
/**
* @brief Destroy TransactionEmulator object
* @param transaction_emulator Pointer to TransactionEmulator object
@ -129,7 +154,7 @@ EMULATOR_EXPORT bool tvm_emulator_set_libraries(void *tvm_emulator, const char *
* @param unixtime Unix timestamp
* @param balance Smart contract balance
* @param rand_seed_hex Random seed as hex string of length 64
* @param config Base64 encoded BoC serialized Config dictionary (Hashmap 32 ^Cell)
* @param config Base64 encoded BoC serialized Config dictionary (Hashmap 32 ^Cell). Optional.
* @return true in case of success, false in case of error
*/
EMULATOR_EXPORT bool tvm_emulator_set_c7(void *tvm_emulator, const char *address, uint32_t unixtime, uint64_t balance, const char *rand_seed_hex, const char *config);