mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
Fix returning config from LS, add extra c7 elements in getmethods (#713)
Co-authored-by: SpyCheese <mikle98@yandex.ru>
This commit is contained in:
parent
049ed0c737
commit
6b941dcceb
10 changed files with 111 additions and 32 deletions
|
@ -448,6 +448,33 @@ bool tvm_emulator_set_c7(void *tvm_emulator, const char *address, uint32_t unixt
|
|||
return true;
|
||||
}
|
||||
|
||||
bool tvm_emulator_set_prev_blocks_info(void *tvm_emulator, const char* info_boc) {
|
||||
auto emulator = static_cast<emulator::TvmEmulator *>(tvm_emulator);
|
||||
|
||||
if (info_boc != nullptr) {
|
||||
auto info_cell = boc_b64_to_cell(info_boc);
|
||||
if (info_cell.is_error()) {
|
||||
LOG(ERROR) << "Can't deserialize previous blocks boc: " << info_cell.move_as_error();
|
||||
return false;
|
||||
}
|
||||
vm::StackEntry info_value;
|
||||
if (!info_value.deserialize(info_cell.move_as_ok())) {
|
||||
LOG(ERROR) << "Can't deserialize previous blocks tuple";
|
||||
return false;
|
||||
}
|
||||
if (info_value.is_null()) {
|
||||
emulator->set_prev_blocks_info({});
|
||||
} else if (info_value.is_tuple()) {
|
||||
emulator->set_prev_blocks_info(info_value.as_tuple());
|
||||
} else {
|
||||
LOG(ERROR) << "Can't set previous blocks tuple: not a tuple";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool tvm_emulator_set_gas_limit(void *tvm_emulator, int64_t gas_limit) {
|
||||
auto emulator = static_cast<emulator::TvmEmulator *>(tvm_emulator);
|
||||
emulator->set_gas_limit(gas_limit);
|
||||
|
|
|
@ -167,6 +167,14 @@ EMULATOR_EXPORT bool tvm_emulator_set_libraries(void *tvm_emulator, const char *
|
|||
*/
|
||||
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);
|
||||
|
||||
/**
|
||||
* @brief Set tuple of previous blocks (13th element of c7)
|
||||
* @param tvm_emulator Pointer to TVM emulator
|
||||
* @param info_boc Base64 encoded BoC serialized TVM tuple (VmStackValue).
|
||||
* @return true in case of success, false in case of error
|
||||
*/
|
||||
EMULATOR_EXPORT bool tvm_emulator_set_prev_blocks_info(void *tvm_emulator, const char* info_boc);
|
||||
|
||||
/**
|
||||
* @brief Set TVM gas limit
|
||||
* @param tvm_emulator Pointer to TVM emulator
|
||||
|
|
|
@ -14,6 +14,7 @@ _emulator_set_verbosity_level
|
|||
_tvm_emulator_create
|
||||
_tvm_emulator_set_libraries
|
||||
_tvm_emulator_set_c7
|
||||
_tvm_emulator_set_prev_blocks_info
|
||||
_tvm_emulator_set_gas_limit
|
||||
_tvm_emulator_set_debug_enabled
|
||||
_tvm_emulator_run_get_method
|
||||
|
|
|
@ -33,6 +33,10 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
void set_prev_blocks_info(td::Ref<vm::Tuple> tuple) {
|
||||
args_.set_prev_blocks_info(std::move(tuple));
|
||||
}
|
||||
|
||||
void set_debug_enabled(bool debug_enabled) {
|
||||
args_.set_debug_enabled(debug_enabled);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue