1
0
Fork 0
mirror of https://github.com/ton-blockchain/ton synced 2025-02-12 11:12:16 +00:00

Consume gas in VmState::jump_to

This commit is contained in:
SpyCheese 2024-09-23 12:09:16 +03:00
parent e04965c400
commit 2cca7fddcc
2 changed files with 9 additions and 3 deletions

View file

@ -118,6 +118,7 @@ class VmState final : public VmStateInterface {
stack_entry_gas_price = 1,
runvm_gas_price = 40,
hash_ext_entry_gas_price = 1,
free_nested_cont_jump = 8,
rist255_mul_gas_price = 2000,
rist255_mulbase_gas_price = 750,
@ -366,14 +367,18 @@ class VmState final : public VmStateInterface {
return cond ? c1_envelope(std::move(cont), save) : std::move(cont);
}
void c1_save_set(bool save = true);
void fatal(void) const {
void fatal() const {
throw VmFatal{};
}
int jump_to(Ref<Continuation> cont) {
int res = 0;
int res = 0, cnt = 0;
while (cont.not_null()) {
cnt++;
cont = cont->is_unique() ? cont.unique_write().jump_w(this, res) : cont->jump(this, res);
}
if (global_version >= 9 && cnt > free_nested_cont_jump) {
consume_gas(cnt - free_nested_cont_jump);
}
return res;
}
static Ref<CellSlice> convert_code_cell(Ref<Cell> code_cell);

View file

@ -115,3 +115,4 @@ Operations for working with Merkle proofs, where cells can have non-zero level a
- Fix `RAWRESERVE` action with flag `4` (use original balance of the account) by explicitly setting `original_balance` to `balance - msg_balance_remaining`.
- Previously it did not work if storage fee was greater than the original balance.
- Jumps to nested continuations of depth more than 8 consume 1 gas for eact subsequent continuation (this does not affect most of TVM code).