diff --git a/.github/workflows/rpc-integration-tests.yml b/.github/workflows/rpc-integration-tests.yml index 6709e9c501..923b94fab3 100644 --- a/.github/workflows/rpc-integration-tests.yml +++ b/.github/workflows/rpc-integration-tests.yml @@ -27,7 +27,7 @@ jobs: - name: Checkout RPC Tests Repository & Install Requirements run: | rm -rf ${{runner.workspace}}/rpc-tests - git -c advice.detachedHead=false clone --depth 1 --branch v0.19.0 https://github.com/erigontech/rpc-tests ${{runner.workspace}}/rpc-tests + git -c advice.detachedHead=false clone --depth 1 --branch v0.21.0 https://github.com/erigontech/rpc-tests ${{runner.workspace}}/rpc-tests cd ${{runner.workspace}}/rpc-tests pip3 install -r requirements.txt diff --git a/silkworm/core/execution/evm.cpp b/silkworm/core/execution/evm.cpp index a0169e5396..05e117065b 100644 --- a/silkworm/core/execution/evm.cpp +++ b/silkworm/core/execution/evm.cpp @@ -59,11 +59,12 @@ class DelegatingTracer : public evmone::Tracer { IntraBlockState& intra_block_state_; }; -EVM::EVM(const Block& block, IntraBlockState& state, const ChainConfig& config) noexcept +EVM::EVM(const Block& block, IntraBlockState& state, const ChainConfig& config, bool gas_bailout) noexcept : beneficiary{block.header.beneficiary}, block_{block}, state_{state}, config_{config}, + gas_bailout_{gas_bailout}, evm1_{static_cast(evmc_create_evmone())} // NOLINT(cppcoreguidelines-pro-type-static-cast-downcast) {} @@ -99,7 +100,7 @@ evmc::Result EVM::create(const evmc_message& message) noexcept { evmc::Result res{EVMC_SUCCESS, message.gas, 0}; auto value{intx::be::load(message.value)}; - if (state_.get_balance(message.sender) < value) { + if (!gas_bailout_ && state_.get_balance(message.sender) < value) { res.status_code = EVMC_INSUFFICIENT_BALANCE; for (auto tracer : tracers_) { @@ -203,7 +204,7 @@ evmc::Result EVM::call(const evmc_message& message) noexcept { evmc::Result res{EVMC_SUCCESS, message.gas}; const auto value{intx::be::load(message.value)}; - if (message.kind != EVMC_DELEGATECALL && state_.get_balance(message.sender) < value) { + if (!gas_bailout_ && message.kind != EVMC_DELEGATECALL && state_.get_balance(message.sender) < value) { res.status_code = EVMC_INSUFFICIENT_BALANCE; return res; } diff --git a/silkworm/core/execution/evm.hpp b/silkworm/core/execution/evm.hpp index a0008fe943..c0830aabf4 100644 --- a/silkworm/core/execution/evm.hpp +++ b/silkworm/core/execution/evm.hpp @@ -78,7 +78,7 @@ class EVM { EVM(const EVM&) = delete; EVM& operator=(const EVM&) = delete; - EVM(const Block& block, IntraBlockState& state, const ChainConfig& config) noexcept; + EVM(const Block& block, IntraBlockState& state, const ChainConfig& config, bool gas_bailout = false) noexcept; ~EVM(); @@ -122,6 +122,7 @@ class EVM { const Block& block_; IntraBlockState& state_; const ChainConfig& config_; + bool gas_bailout_; const Transaction* txn_{nullptr}; std::vector block_hashes_{}; EvmTracers tracers_; diff --git a/silkworm/rpc/core/evm_executor.cpp b/silkworm/rpc/core/evm_executor.cpp index 6455cabdd9..33baf9d0ff 100644 --- a/silkworm/rpc/core/evm_executor.cpp +++ b/silkworm/rpc/core/evm_executor.cpp @@ -228,7 +228,7 @@ ExecutionResult EVMExecutor::call( SILK_DEBUG << "EVMExecutor::call: transaction: " << rpc::Transaction{txn}; auto& svc = use_service(workers_); - EVM evm{block, ibs_state_, config_}; + EVM evm{block, ibs_state_, config_, gas_bailout}; evm.analysis_cache = svc.get_analysis_cache(); evm.state_pool = svc.get_object_pool(); evm.beneficiary = rule_set_->get_beneficiary(block.header);