Skip to content

Commit

Permalink
rpc: investigate refund option
Browse files Browse the repository at this point in the history
  • Loading branch information
chfast committed Jan 10, 2025
1 parent b00be69 commit 5bda5aa
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions silkworm/core/execution/processor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,8 @@ void ExecutionProcessor::execute_transaction(const Transaction& txn, Receipt& re
}

CallResult ExecutionProcessor::call(const Transaction& txn, const std::vector<std::shared_ptr<EvmTracer>>& tracers, bool bailout, bool refund) noexcept {
SILKWORM_ASSERT(refund);
(void)refund;
const std::optional<evmc::address> sender{txn.sender()};
SILKWORM_ASSERT(sender);

Expand Down Expand Up @@ -294,6 +296,8 @@ CallResult ExecutionProcessor::call(const Transaction& txn, const std::vector<st
if (refund && !bailout) {
gas_used = txn.gas_limit - refund_gas(txn, effective_gas_price, result.gas_left, result.gas_refund);
gas_left = txn.gas_limit - gas_used;
} else {
SILKWORM_ASSERT(bailout);
}

// Reward the fee recipient
Expand Down
2 changes: 1 addition & 1 deletion silkworm/rpc/core/evm_executor_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ TEST_CASE_METHOD(EVMExecutorTest, "EVMExecutor") {
txn.set_sender(0xa872626373628737383927236382161739290870_address);

EVMExecutor executor{block, *chain_config_ptr, workers, state};
const auto result = executor.call(block, txn, {}, false, /* gasBailout */ true);
const auto result = executor.call(block, txn, {}, true, /* gasBailout */ true);
executor.reset();
CHECK(result.error_code == 0);
}
Expand Down

0 comments on commit 5bda5aa

Please sign in to comment.