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

Add account state by transaction and emulator (extended) (#592)

* account_state_by_transaction

* Correct time calculation

* Bug fixes

* Refactor

* namespace block::transaction

* smc.forget

* RunEmulator: remove wallet_id

* Refactor & fixes

* AccountStateByTransaction: use shardchain block instead of masterchain block

* transaction emulator core

* refactor

* tx emulator major functionality

* small format changes

* readme

* clean

* return json, add support for init messages

* tx emulator readme

* refactor getConfigParam and getConfigAll

* add shardchain_libs_boc parameter

* option to change verbosity level of transaction emulator

* fix deserializing ShardAccount with account_none

* add mode needSpecialSmc when unpack config

* emulator: block::Transaction -> block::transaction::Transaction

* Refactor

* emulator: Fix bug

* emulator: Support for emulator-extern

* emulator: Refactor

* Return vm log and vm exit code.

* fix build on macos, emulator_static added

* adjust documentation

* ignore_chksig for external messages

* tvm emulator, run get method

* Added more params for transaction emulator

* Added setters for optional transaction emulator params, moved libs to a new setter

* Added actions cell output to transaction emulator

* fix tonlib build

* refactoring, rand seed as hex size 64, tvm emulator send message

* tvm send message, small refactoring

* fix config decoding, rename

* improve documentation

* macos export symbols

* Added run_get_method to transaction emulator emscipten wrapper

* Fixed empty action list serialization

* Changed actions list cell to serialize as json null instead of empty string in transaction emulator

* stack as boc

* log gas remaining

* Fix prev_block_id

* fix build errors

* Refactor fetch_config_params

* fix failing unwrap of optional rand_seed

* lookup correct shard, choose prev_block based on account shard

* fix tonlib android jni build

---------

Co-authored-by: legaii <jgates.ardux@gmail.com>
Co-authored-by: ms <dungeon666master@protonmail.com>
Co-authored-by: krigga <krigga7@gmail.com>
This commit is contained in:
EmelyanenkoK 2023-02-02 10:03:45 +03:00 committed by GitHub
parent adf67aa869
commit 3b3c25b654
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
32 changed files with 2095 additions and 158 deletions

View file

@ -4359,7 +4359,7 @@ bool ValidateQuery::check_one_transaction(block::Account& account, ton::LogicalT
<< account.total_state->get_hash().to_hex());
}
// some type-specific checks
int trans_type = block::Transaction::tr_none;
int trans_type = block::transaction::Transaction::tr_none;
switch (tag) {
case block::gen::TransactionDescr::trans_ord: {
if (!block_limit_status_->fits(block::ParamLimits::cl_medium)) {
@ -4369,7 +4369,7 @@ bool ValidateQuery::check_one_transaction(block::Account& account, ton::LogicalT
<< "lt_delta=" << block_limit_status_->cur_lt - block_limits_->start_lt
<< "(limit=" << block_limits_->lt_delta.hard() << ")");
}
trans_type = block::Transaction::tr_ord;
trans_type = block::transaction::Transaction::tr_ord;
if (in_msg_root.is_null()) {
return reject_query(PSTRING() << "ordinary transaction " << lt << " of account " << addr.to_hex()
<< " has no inbound message");
@ -4378,7 +4378,7 @@ bool ValidateQuery::check_one_transaction(block::Account& account, ton::LogicalT
break;
}
case block::gen::TransactionDescr::trans_storage: {
trans_type = block::Transaction::tr_storage;
trans_type = block::transaction::Transaction::tr_storage;
if (in_msg_root.not_null()) {
return reject_query(PSTRING() << "storage transaction " << lt << " of account " << addr.to_hex()
<< " has an inbound message");
@ -4394,7 +4394,7 @@ bool ValidateQuery::check_one_transaction(block::Account& account, ton::LogicalT
}
case block::gen::TransactionDescr::trans_tick_tock: {
bool is_tock = (td_cs.prefetch_ulong(4) & 1);
trans_type = is_tock ? block::Transaction::tr_tock : block::Transaction::tr_tick;
trans_type = is_tock ? block::transaction::Transaction::tr_tock : block::transaction::Transaction::tr_tick;
if (in_msg_root.not_null()) {
return reject_query(PSTRING() << (is_tock ? "tock" : "tick") << " transaction " << lt << " of account "
<< addr.to_hex() << " has an inbound message");
@ -4402,7 +4402,7 @@ bool ValidateQuery::check_one_transaction(block::Account& account, ton::LogicalT
break;
}
case block::gen::TransactionDescr::trans_merge_prepare: {
trans_type = block::Transaction::tr_merge_prepare;
trans_type = block::transaction::Transaction::tr_merge_prepare;
if (in_msg_root.not_null()) {
return reject_query(PSTRING() << "merge prepare transaction " << lt << " of account " << addr.to_hex()
<< " has an inbound message");
@ -4417,7 +4417,7 @@ bool ValidateQuery::check_one_transaction(block::Account& account, ton::LogicalT
break;
}
case block::gen::TransactionDescr::trans_merge_install: {
trans_type = block::Transaction::tr_merge_install;
trans_type = block::transaction::Transaction::tr_merge_install;
if (in_msg_root.is_null()) {
return reject_query(PSTRING() << "merge install transaction " << lt << " of account " << addr.to_hex()
<< " has no inbound message");
@ -4429,7 +4429,7 @@ bool ValidateQuery::check_one_transaction(block::Account& account, ton::LogicalT
break;
}
case block::gen::TransactionDescr::trans_split_prepare: {
trans_type = block::Transaction::tr_split_prepare;
trans_type = block::transaction::Transaction::tr_split_prepare;
if (in_msg_root.not_null()) {
return reject_query(PSTRING() << "split prepare transaction " << lt << " of account " << addr.to_hex()
<< " has an inbound message");
@ -4444,7 +4444,7 @@ bool ValidateQuery::check_one_transaction(block::Account& account, ton::LogicalT
break;
}
case block::gen::TransactionDescr::trans_split_install: {
trans_type = block::Transaction::tr_split_install;
trans_type = block::transaction::Transaction::tr_split_install;
if (in_msg_root.is_null()) {
return reject_query(PSTRING() << "split install transaction " << lt << " of account " << addr.to_hex()
<< " has no inbound message");
@ -4459,8 +4459,8 @@ bool ValidateQuery::check_one_transaction(block::Account& account, ton::LogicalT
// check transaction computation by re-doing it
// similar to Collator::create_ordinary_transaction() and Collator::create_ticktock_transaction()
// ....
std::unique_ptr<block::Transaction> trs =
std::make_unique<block::Transaction>(account, trans_type, lt, now_, in_msg_root);
std::unique_ptr<block::transaction::Transaction> trs =
std::make_unique<block::transaction::Transaction>(account, trans_type, lt, now_, in_msg_root);
if (in_msg_root.not_null()) {
if (!trs->unpack_input_msg(ihr_delivered, &action_phase_cfg_)) {
// inbound external message was not accepted