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

rpcdaemon: fix state access in eth_estimateGas #1967

Merged
merged 1 commit into from
Apr 15, 2024
Merged
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
3 changes: 2 additions & 1 deletion silkworm/rpc/core/estimate_gas_oracle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ Task<intx::uint256> EstimateGasOracle::estimate_gas(const Call& call, const silk
auto this_executor = co_await boost::asio::this_coro::executor;
auto exec_result = co_await async_task(workers_.executor(), [&]() -> ExecutionResult {
auto state = transaction_.create_state(this_executor, tx_database_, storage_, block_number);
EVMExecutor executor{config_, workers_, state};

ExecutionResult result{evmc_status_code::EVMC_SUCCESS};
silkworm::Transaction transaction{call.to_transaction()};
while (lo + 1 < hi) {
EVMExecutor executor{config_, workers_, state};
auto mid = (hi + lo) / 2;
transaction.gas_limit = mid;

Expand All @@ -102,6 +102,7 @@ Task<intx::uint256> EstimateGasOracle::estimate_gas(const Call& call, const silk
}

if (hi == cap) {
EVMExecutor executor{config_, workers_, state};
transaction.gas_limit = hi;
result = try_execution(executor, block, transaction);
SILK_DEBUG << "HI == cap tested again with " << (result.error_code == evmc_status_code::EVMC_SUCCESS ? "succeed" : "failed");
Expand Down
Loading