Skip to content

Commit

Permalink
make fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
web-flow authored Jul 10, 2024
1 parent 7d3e7c6 commit 747c043
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
30 changes: 15 additions & 15 deletions silkworm/rpc/core/evm_debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,10 @@ void DebugTracer::on_execution_start(evmc_revision rev, const evmc_message& msg,
const evmc::address sender(msg.sender);

SILK_LOG << "on_execution_start:"
<< " rev: " << rev
<< " gas: " << std::dec << msg.gas
<< " depth: " << msg.depth
<< " recipient: " << recipient;
<< " rev: " << rev
<< " gas: " << std::dec << msg.gas
<< " depth: " << msg.depth
<< " recipient: " << recipient;

SILK_DEBUG << "on_execution_start:"
<< " rev: " << rev
Expand Down Expand Up @@ -168,12 +168,12 @@ void DebugTracer::on_instruction_start(uint32_t pc, const intx::uint256* stack_t
}
if (!logs_.empty()) {
auto& log = logs_[logs_.size() - 1];
if (call_fixes_) { // previuos opcodw was a CALL*
if (execution_state.msg->depth == call_fixes_->depth) { // precompiled
if (call_fixes_) { // previuos opcodw was a CALL*
if (execution_state.msg->depth == call_fixes_->depth) { // precompiled
if (call_fixes_->gas_cost) {
log.gas_cost = call_fixes_->gas_cost + call_fixes_->code_cost;
} else {
// log.gas_cost = log.gas_cost - call_fixes_->stipend;
// log.gas_cost = log.gas_cost - call_fixes_->stipend;
log.gas_cost = log.gas - gas + call_fixes_->stipend;
}
} else {
Expand Down Expand Up @@ -240,9 +240,9 @@ void DebugTracer::on_execution_end(const evmc_result& result, const silkworm::In
if (!logs_.empty()) {
auto& log = logs_[logs_.size() - 1];

// if (call_fixes_) {
// log.gas_cost += call_fixes_->stipend + call_fixes_->gas_cost;
// }
// if (call_fixes_) {
// log.gas_cost += call_fixes_->stipend + call_fixes_->gas_cost;
// }

insert_error(log, result.status_code);

Expand Down Expand Up @@ -293,19 +293,19 @@ void DebugTracer::flush_logs() {
}
}

void DebugTracer::evaluate_call_fixes(unsigned char opcode, const evmone::ExecutionState& execution_state, const intx::uint256* stack_top, const int stack_height, const silkworm::IntraBlockState& intra_block_state) {
void DebugTracer::evaluate_call_fixes(unsigned char opcode, const evmone::ExecutionState& execution_state, const intx::uint256* stack_top, const int stack_height, const silkworm::IntraBlockState& intra_block_state) {
if (opcode == OP_CALL || opcode == OP_CALLCODE || opcode == OP_STATICCALL || opcode == OP_DELEGATECALL || opcode == OP_CREATE || opcode == OP_CREATE2) {
call_fixes_ = std::make_unique<CallFixes>(CallFixes{execution_state.msg->depth, 0, metrics_[opcode].gas_cost});
const auto value = stack_top[-2]; // value
const auto value = stack_top[-2]; // value
if (value != 0) {
call_fixes_->gas_cost += 9000;
}
if (opcode == OP_CALL) {
if (opcode == OP_CALL && stack_height >= 7 && value != 0) {
call_fixes_->stipend = 2300; // for CALLs with value, include stipend
}
const auto call_gas = stack_top[0]; // gas
const auto dst = intx::be::trunc<evmc::address>(stack_top[-1]); // dst
const auto call_gas = stack_top[0]; // gas
const auto dst = intx::be::trunc<evmc::address>(stack_top[-1]); // dst
SILK_LOG << "DebugTracer::evaluate_call_fixes:"
<< " call_gas: " << call_gas
<< " dst: " << dst
Expand All @@ -315,7 +315,7 @@ void DebugTracer::evaluate_call_fixes(unsigned char opcode, const evmone::Execu
call_fixes_->gas_cost += 25000;
}
}
// call_fixes_->code_cost = metrics_[opcode].gas_cost;
// call_fixes_->code_cost = metrics_[opcode].gas_cost;
}
}

Expand Down
2 changes: 1 addition & 1 deletion silkworm/rpc/core/evm_debug.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class DebugTracer : public EvmTracer {

private:
void write_log(const DebugLog& log);
void evaluate_call_fixes(unsigned char opcode, const evmone::ExecutionState& execution_state, const intx::uint256* stack_top, const int stack_height, const silkworm::IntraBlockState& intra_block_state);
void evaluate_call_fixes(unsigned char opcode, const evmone::ExecutionState& execution_state, const intx::uint256* stack_top, const int stack_height, const silkworm::IntraBlockState& intra_block_state);

json::Stream& stream_;
const DebugConfig& config_;
Expand Down

0 comments on commit 747c043

Please sign in to comment.