Skip to content

Commit 5920f80

Browse files
authored
Improve gas consumption in VmState::jump_to (#1276)
1 parent 3e806bf commit 5920f80

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

crypto/vm/vm.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -373,11 +373,11 @@ class VmState final : public VmStateInterface {
373373
int jump_to(Ref<Continuation> cont) {
374374
int res = 0, cnt = 0;
375375
while (cont.not_null()) {
376-
cnt++;
377376
cont = cont->is_unique() ? cont.unique_write().jump_w(this, res) : cont->jump(this, res);
378-
}
379-
if (global_version >= 9 && cnt > free_nested_cont_jump) {
380-
consume_gas(cnt - free_nested_cont_jump);
377+
cnt++;
378+
if (cnt > free_nested_cont_jump && global_version >= 9) {
379+
consume_gas(1);
380+
}
381381
}
382382
return res;
383383
}

0 commit comments

Comments
 (0)