Skip to content

Commit 1835d84

Browse files
authored
Fixed setting gas limits in RUNVM (#1635)
1 parent d065e51 commit 1835d84

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

crypto/vm/vm.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -729,6 +729,10 @@ void VmState::run_child_vm(VmState&& new_state, bool return_data, bool return_ac
729729
new_state.chksgn_counter = chksgn_counter;
730730
new_state.free_gas_consumed = free_gas_consumed;
731731
new_state.get_extra_balance_counter = get_extra_balance_counter;
732+
if (global_version >= 10) {
733+
new_state.gas = GasLimits{std::min(new_state.gas.gas_limit, gas.gas_remaining),
734+
std::min(new_state.gas.gas_max, gas.gas_remaining)};
735+
}
732736

733737
auto new_parent = std::make_unique<ParentVmState>();
734738
new_parent->return_data = return_data;

doc/GlobalVersions.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ Reserve modes `+1`, `+4` and `+8` ("reserve all except", "add original balance"
188188
- With "isolate gas" mode, in the beginning of `RUNVM` the parent VM spends full gas for all already executed `GETEXTRABALANCE` and resets the counter.
189189
- `LDMSGADDR(Q)`, `PARSEMSGADDR(Q)`, `REWRITESTDADDR(Q)`, `REWRITEVARADDR(Q)` no more support anycast addresses and `addr_var`.
190190
- Fixed bug in `RUNVM` caused by throwing out-of-gas exception with "isolate gas" enabled.
191+
- Fixed setting gas limits in `RUNVM` after consuming "free gas" (e.g. after `CHKSIGN` instructions).
191192

192193
### Other changes
193194
- Exceeding state limits in transaction now reverts `end_lt` back to `start_lt + 1` and collects action fines.

0 commit comments

Comments
 (0)