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

fix: only skip last tx commit #13528

Merged
merged 1 commit into from
Dec 23, 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
7 changes: 4 additions & 3 deletions crates/rpc/rpc-eth-api/src/helpers/call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,11 @@ pub trait EthCall: EstimateCall + Call + LoadPendingBlock + LoadBlock + FullEthA
let this = self.clone();
self.spawn_with_state_at_block(block, move |state| {
let mut db = CacheDB::new(StateProviderDatabase::new(state));
let mut gas_used = 0;
let mut blocks: Vec<SimulatedBlock<RpcBlock<Self::NetworkTypes>>> =
Vec::with_capacity(block_state_calls.len());
let mut gas_used = 0;
for block in block_state_calls {
let mut block_state_calls = block_state_calls.into_iter().peekable();
while let Some(block) = block_state_calls.next() {
// Increase number and timestamp for every new block
block_env.number += U256::from(1);
block_env.timestamp += U256::from(1);
Expand Down Expand Up @@ -183,7 +184,7 @@ pub trait EthCall: EstimateCall + Call + LoadPendingBlock + LoadBlock + FullEthA
}
};

if calls.peek().is_some() {
if calls.peek().is_some() || block_state_calls.peek().is_some() {
// need to apply the state changes of this call before executing the
// next call
db.commit(res.state);
Expand Down
Loading