From a5521a60aa9c40b0544176794ac344756386099d Mon Sep 17 00:00:00 2001 From: Marat <98183742+dungeon-master-666@users.noreply.github.com> Date: Fri, 26 Jul 2024 14:08:52 +0200 Subject: [PATCH] Fix incorrect gas consumption with verbosity > 3 (#1077) --- crypto/vm/vm.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/crypto/vm/vm.cpp b/crypto/vm/vm.cpp index 3f595a00..d21ce974 100644 --- a/crypto/vm/vm.cpp +++ b/crypto/vm/vm.cpp @@ -441,10 +441,16 @@ int VmState::step() { if (log.log_mask & vm::VmLog::DumpStackVerbose) { mode += 4; } + std::unique_ptr tmp_ctx; + // install temporary dummy vm state interface to prevent charging for cell load operations during dump + VmStateInterface::Guard guard(tmp_ctx.get()); stack->dump(ss, mode); VM_LOG(this) << "stack:" << ss.str(); } if (stack_trace) { + std::unique_ptr tmp_ctx; + // install temporary dummy vm state interface to prevent charging for cell load operations during dump + VmStateInterface::Guard guard(tmp_ctx.get()); stack->dump(std::cerr, 3); } ++steps;