Skip to content

Commit 229996a

Browse files
committed
rpc: investigate refund option
1 parent 006cd7b commit 229996a

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

silkworm/core/execution/processor.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,8 @@ void ExecutionProcessor::execute_transaction(const Transaction& txn, Receipt& re
261261
}
262262

263263
CallResult ExecutionProcessor::call(const Transaction& txn, const std::vector<std::shared_ptr<EvmTracer>>& tracers, bool refund) noexcept {
264+
SILKWORM_ASSERT(refund);
265+
(void)refund;
264266
const std::optional<evmc::address> sender{txn.sender()};
265267
SILKWORM_ASSERT(sender);
266268

@@ -306,6 +308,8 @@ CallResult ExecutionProcessor::call(const Transaction& txn, const std::vector<st
306308
if (refund && !evm().bailout) {
307309
gas_used = txn.gas_limit - refund_gas(txn, effective_gas_price, result.gas_left, result.gas_refund);
308310
gas_left = txn.gas_limit - gas_used;
311+
} else {
312+
SILKWORM_ASSERT(bailout);
309313
}
310314

311315
// Reward the fee recipient

silkworm/rpc/core/evm_executor_test.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ TEST_CASE_METHOD(EVMExecutorTest, "EVMExecutor") {
150150
txn.set_sender(0xa872626373628737383927236382161739290870_address);
151151

152152
EVMExecutor executor{block, *chain_config_ptr, workers, state};
153-
const auto result = executor.call(txn, {}, false, /* gasBailout */ true);
153+
const auto result = executor.call(txn, {}, true, /* gasBailout */ true);
154154
executor.reset();
155155
CHECK(result.status_code == evmc_status_code::EVMC_SUCCESS);
156156
}

0 commit comments

Comments
 (0)