Skip to content

Commit

Permalink
Fix incorrect gas consumption with verbosity > 3, increase log limit
Browse files Browse the repository at this point in the history
  • Loading branch information
dungeon-master-666 committed Jul 25, 2024
1 parent 1b93728 commit acdb089
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion crypto/block/transaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1661,7 +1661,7 @@ bool Transaction::prepare_compute_phase(const ComputePhaseConfig& cfg) {
std::unique_ptr<StringLoggerTail> logger;
auto vm_log = vm::VmLog();
if (cfg.with_vm_log) {
size_t log_max_size = cfg.vm_log_verbosity > 0 ? 1024 * 1024 : 256;
size_t log_max_size = cfg.vm_log_verbosity > 0 ? 32 * 1024 * 1024 : 256;
logger = std::make_unique<StringLoggerTail>(log_max_size);
vm_log.log_interface = logger.get();
vm_log.log_options = td::LogOptions(VERBOSITY_NAME(DEBUG), true, false);
Expand Down
6 changes: 6 additions & 0 deletions crypto/vm/vm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -441,10 +441,16 @@ int VmState::step() {
if (log.log_mask & vm::VmLog::DumpStackVerbose) {
mode += 4;
}
std::unique_ptr<VmStateInterface> 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<VmStateInterface> 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;
Expand Down

0 comments on commit acdb089

Please sign in to comment.