Skip to content

Commit

Permalink
update tests with saner values
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse committed Sep 30, 2024
1 parent b13b582 commit 1ec5787
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions crates/rpc/rpc/src/eth/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -448,10 +448,10 @@ mod tests {

for i in (0..block_count).rev() {
let hash = rng.gen();
let gas_limit: u64 = rng.gen();
let gas_used: u64 = rng.gen();
// Note: Generates a u32 to avoid overflows later
// Note: Generates a saner values to avoid invalid overflows later
let gas_limit = rng.gen::<u32>() as u64;
let base_fee_per_gas: Option<u64> = rng.gen::<bool>().then(|| rng.gen::<u32>() as u64);
let gas_used = rng.gen::<u32>() as u64;

let header = Header {
number: newest_block - i,
Expand Down
3 changes: 2 additions & 1 deletion crates/storage/provider/src/test_utils/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use crate::{
StateProviderBox, StateProviderFactory, StateReader, StateRootProvider, TransactionVariant,
TransactionsProvider, WithdrawalsProvider,
};
use alloy_consensus::constants::EMPTY_ROOT_HASH;
use alloy_eips::{BlockHashOrNumber, BlockId, BlockNumberOrTag};
use alloy_primitives::{
keccak256,
Expand Down Expand Up @@ -636,7 +637,7 @@ impl StorageRootProvider for MockEthProvider {
_address: Address,
_hashed_storage: HashedStorage,
) -> ProviderResult<B256> {
Ok(B256::default())
Ok(EMPTY_ROOT_HASH)
}
}

Expand Down

0 comments on commit 1ec5787

Please sign in to comment.