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: return null from getBlockTransactionCount methods for unsynced block #441

Merged
merged 3 commits into from
Nov 22, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
keep behavior unchanged in evm
  • Loading branch information
eshaan7 committed Nov 22, 2024
commit 10a24e1f58ed366deadbb6fb6db680bf7b5744ee
20 changes: 15 additions & 5 deletions core/src/execution/evm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ use revm::{
use tracing::trace;

use crate::execution::{
constants::PARALLEL_QUERY_BATCH_SIZE, errors::EvmError, rpc::ExecutionRpc, ExecutionClient,
constants::PARALLEL_QUERY_BATCH_SIZE,
errors::{EvmError, ExecutionError},
rpc::ExecutionRpc,
ExecutionClient,
};
use crate::network_spec::NetworkSpec;
use crate::types::BlockTag;
Expand Down Expand Up @@ -88,7 +91,12 @@ impl<N: NetworkSpec, R: ExecutionRpc<N>> Evm<N, R> {
let mut env = Env::default();
env.tx = N::tx_env(tx);

let block = self.execution.get_block(tag, false).await.unwrap();
let block = self
.execution
.get_block(tag, false)
.await
.ok_or(ExecutionError::BlockNotFound(tag))
.unwrap();
env.block = N::block_env(&block);

env.cfg.chain_id = self.chain_id;
Expand Down Expand Up @@ -169,10 +177,12 @@ impl<N: NetworkSpec, R: ExecutionRpc<N>> EvmState<N, R> {
storage.insert(*slot, value);
}
StateAccess::BlockHash(number) => {
let tag = BlockTag::Number(*number);
let block = self
.execution
.get_block(BlockTag::Number(*number), false)
.await?;
.get_block(tag, false)
.await
.ok_or(ExecutionError::BlockNotFound(tag))?;

self.block_hash.insert(*number, block.hash);
}
Expand Down Expand Up @@ -237,7 +247,7 @@ impl<N: NetworkSpec, R: ExecutionRpc<N>> EvmState<N, R> {
.execution
.get_block(self.block, false)
.await
.unwrap()
.ok_or(ExecutionError::BlockNotFound(self.block))?
.miner;
let producer_access_entry = AccessListItem {
address: coinbase,
Expand Down