Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

evm: de-duplicate bailout flag #2653

Merged
merged 1 commit into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions silkworm/core/execution/processor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,13 +258,13 @@ void ExecutionProcessor::execute_transaction(const Transaction& txn, Receipt& re
check_evm1_execution_result(evm1_receipt.state_diff, state_);
}

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

SILKWORM_ASSERT(protocol::validate_call_precheck(txn, evm_) == ValidationResult::kOk);

if (!bailout) {
if (!evm().bailout) {
SILKWORM_ASSERT(protocol::validate_call_funds(txn, evm_, state_.get_balance(*txn.sender())) == ValidationResult::kOk);
}

Expand All @@ -284,7 +284,7 @@ CallResult ExecutionProcessor::call(const Transaction& txn, const std::vector<st
state_.set_nonce(*sender, state_.get_nonce(*txn.sender()) + 1);
}

if (!bailout) {
if (!evm().bailout) {
const intx::uint256 required_funds = protocol::compute_call_cost(txn, effective_gas_price, evm_);
state_.subtract_from_balance(*txn.sender(), required_funds);
}
Expand All @@ -294,7 +294,7 @@ CallResult ExecutionProcessor::call(const Transaction& txn, const std::vector<st
uint64_t gas_left{result.gas_left};
uint64_t gas_used{txn.gas_limit - result.gas_left};

if (refund && !bailout) {
if (refund && !evm().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;
}
Expand Down
2 changes: 1 addition & 1 deletion silkworm/core/execution/processor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class ExecutionProcessor {
*/
void execute_transaction(const Transaction& txn, Receipt& receipt) noexcept;

CallResult call(const Transaction& txn, const std::vector<std::shared_ptr<EvmTracer>>& tracers, bool bailout, bool refund) noexcept;
CallResult call(const Transaction& txn, const std::vector<std::shared_ptr<EvmTracer>>& tracers, bool refund) noexcept;

//! \brief Execute the block.
//! \remarks Warning: This method does not verify state root; pre-Byzantium receipt root isn't validated either.
Expand Down
2 changes: 1 addition & 1 deletion silkworm/rpc/core/evm_executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ ExecutionResult EVMExecutor::call(
return convert_validated_funds(block, txn, evm, owned_funds);
}

const auto result = execution_processor_.call(txn, tracers, bailout, refund);
const auto result = execution_processor_.call(txn, tracers, refund);

ExecutionResult exec_result{result.status, result.gas_left, result.data};

Expand Down
Loading