mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-01-09 15:28:01 -05:00
chore(deps): 2024 edition syntax fixes (#14731)
This commit is contained in:
@@ -1991,9 +1991,24 @@ Post-merge hard forks (timestamp based):
|
||||
|
||||
// alloc key -> expected rlp mapping
|
||||
let key_rlp = vec![
|
||||
(hex!("0x658bdf435d810c91414ec09147daa6db62406379"), &hex!("0xf84d8089487a9a304539440000a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470")[..]),
|
||||
(hex!("0xaa00000000000000000000000000000000000000"), &hex!("0xf8440101a08afc95b7d18a226944b9c2070b6bda1c3a36afcc3730429d47579c94b9fe5850a0ce92c756baff35fa740c3557c1a971fd24d2d35b7c8e067880d50cd86bb0bc99")[..]),
|
||||
(hex!("0xbb00000000000000000000000000000000000000"), &hex!("0xf8440102a08afc95b7d18a226944b9c2070b6bda1c3a36afcc3730429d47579c94b9fe5850a0e25a53cbb501cec2976b393719c63d832423dd70a458731a0b64e4847bbca7d2")[..]),
|
||||
(
|
||||
hex!("0x658bdf435d810c91414ec09147daa6db62406379"),
|
||||
&hex!(
|
||||
"0xf84d8089487a9a304539440000a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470"
|
||||
)[..],
|
||||
),
|
||||
(
|
||||
hex!("0xaa00000000000000000000000000000000000000"),
|
||||
&hex!(
|
||||
"0xf8440101a08afc95b7d18a226944b9c2070b6bda1c3a36afcc3730429d47579c94b9fe5850a0ce92c756baff35fa740c3557c1a971fd24d2d35b7c8e067880d50cd86bb0bc99"
|
||||
)[..],
|
||||
),
|
||||
(
|
||||
hex!("0xbb00000000000000000000000000000000000000"),
|
||||
&hex!(
|
||||
"0xf8440102a08afc95b7d18a226944b9c2070b6bda1c3a36afcc3730429d47579c94b9fe5850a0e25a53cbb501cec2976b393719c63d832423dd70a458731a0b64e4847bbca7d2"
|
||||
)[..],
|
||||
),
|
||||
];
|
||||
|
||||
for (key, expected_rlp) in key_rlp {
|
||||
|
||||
@@ -58,7 +58,10 @@ pub trait ChainSpecParser: Clone + Send + Sync + 'static {
|
||||
|
||||
/// Produces a help message for the chain spec argument.
|
||||
fn help_message() -> String {
|
||||
format!("The chain this node is running.\nPossible values are either a built-in chain or the path to a chain specification file.\n\nBuilt-in chains:\n {}", Self::SUPPORTED_CHAINS.join(", "))
|
||||
format!(
|
||||
"The chain this node is running.\nPossible values are either a built-in chain or the path to a chain specification file.\n\nBuilt-in chains:\n {}",
|
||||
Self::SUPPORTED_CHAINS.join(", ")
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -140,7 +140,11 @@ impl<C: ChainSpecParser> EnvironmentArgs<C> {
|
||||
|
||||
// Highly unlikely to happen, and given its destructive nature, it's better to panic
|
||||
// instead.
|
||||
assert_ne!(unwind_target, PipelineTarget::Unwind(0), "A static file <> database inconsistency was found that would trigger an unwind to block 0");
|
||||
assert_ne!(
|
||||
unwind_target,
|
||||
PipelineTarget::Unwind(0),
|
||||
"A static file <> database inconsistency was found that would trigger an unwind to block 0"
|
||||
);
|
||||
|
||||
info!(target: "reth::cli", unwind_target = %unwind_target, "Executing an unwind after a failed storage consistency check.");
|
||||
|
||||
|
||||
@@ -112,7 +112,9 @@ impl<C: ChainSpecParser<ChainSpec: EthChainSpec + EthereumHardforks>> Command<C>
|
||||
Subcommands::Drop { force } => {
|
||||
if !force {
|
||||
// Ask for confirmation
|
||||
print!("Are you sure you want to drop the database at {data_dir}? This cannot be undone. (y/N): ");
|
||||
print!(
|
||||
"Are you sure you want to drop the database at {data_dir}? This cannot be undone. (y/N): "
|
||||
);
|
||||
// Flush the buffer to ensure the message is printed immediately
|
||||
io::stdout().flush().unwrap();
|
||||
|
||||
|
||||
@@ -86,7 +86,9 @@ impl<C: ChainSpecParser<ChainSpec: EthChainSpec + Hardforks + EthereumHardforks>
|
||||
config.peers.trusted_nodes.extend(self.network.trusted_peers.clone());
|
||||
|
||||
if config.peers.trusted_nodes.is_empty() && self.network.trusted_only {
|
||||
eyre::bail!("No trusted nodes. Set trusted peer with `--trusted-peer <enode record>` or set `--trusted-only` to `false`")
|
||||
eyre::bail!(
|
||||
"No trusted nodes. Set trusted peer with `--trusted-peer <enode record>` or set `--trusted-only` to `false`"
|
||||
)
|
||||
}
|
||||
|
||||
config.peers.trusted_nodes_only = self.network.trusted_only;
|
||||
|
||||
@@ -145,7 +145,7 @@ pub fn read_vectors() -> Result<()> {
|
||||
}
|
||||
|
||||
/// Generates a vector of type `T` to a file.
|
||||
pub fn generate_vectors_with(gen: &[fn(&mut TestRunner) -> eyre::Result<()>]) -> Result<()> {
|
||||
pub fn generate_vectors_with(generator: &[fn(&mut TestRunner) -> eyre::Result<()>]) -> Result<()> {
|
||||
// Prepare random seed for test (same method as used by proptest)
|
||||
let seed = B256::random();
|
||||
println!("Seed for compact test vectors: {:?}", hex::encode_prefixed(seed));
|
||||
@@ -157,7 +157,7 @@ pub fn generate_vectors_with(gen: &[fn(&mut TestRunner) -> eyre::Result<()>]) ->
|
||||
|
||||
fs::create_dir_all(VECTORS_FOLDER)?;
|
||||
|
||||
for generate_fn in gen {
|
||||
for generate_fn in generator {
|
||||
generate_fn(&mut runner)?;
|
||||
}
|
||||
|
||||
|
||||
@@ -1027,9 +1027,9 @@ connect_trusted_nodes_only = true
|
||||
assert_eq!(conf.peers.trusted_nodes.len(), 2);
|
||||
|
||||
let expected_enodes = vec![
|
||||
"enode://0401e494dbd0c84c5c0f72adac5985d2f2525e08b68d448958aae218f5ac8198a80d1498e0ebec2ce38b1b18d6750f6e61a56b4614c5a6c6cf0981c39aed47dc@34.159.32.127:30303",
|
||||
"enode://e9675164b5e17b9d9edf0cc2bd79e6b6f487200c74d1331c220abb5b8ee80c2eefbf18213989585e9d0960683e819542e11d4eefb5f2b4019e1e49f9fd8fff18@berav2-bootnode.staketab.org:30303",
|
||||
];
|
||||
"enode://0401e494dbd0c84c5c0f72adac5985d2f2525e08b68d448958aae218f5ac8198a80d1498e0ebec2ce38b1b18d6750f6e61a56b4614c5a6c6cf0981c39aed47dc@34.159.32.127:30303",
|
||||
"enode://e9675164b5e17b9d9edf0cc2bd79e6b6f487200c74d1331c220abb5b8ee80c2eefbf18213989585e9d0960683e819542e11d4eefb5f2b4019e1e49f9fd8fff18@berav2-bootnode.staketab.org:30303",
|
||||
];
|
||||
|
||||
for enode in expected_enodes {
|
||||
let node = TrustedPeer::from_str(enode).unwrap();
|
||||
|
||||
@@ -115,7 +115,9 @@ impl TransactionTestContext {
|
||||
wallet: PrivateKeySigner,
|
||||
nonce: u64,
|
||||
) -> Bytes {
|
||||
let l1_block_info = Bytes::from_static(&hex!("7ef9015aa044bae9d41b8380d781187b426c6fe43df5fb2fb57bd4466ef6a701e1f01e015694deaddeaddeaddeaddeaddeaddeaddeaddead000194420000000000000000000000000000000000001580808408f0d18001b90104015d8eb900000000000000000000000000000000000000000000000000000000008057650000000000000000000000000000000000000000000000000000000063d96d10000000000000000000000000000000000000000000000000000000000009f35273d89754a1e0387b89520d989d3be9c37c1f32495a88faf1ea05c61121ab0d1900000000000000000000000000000000000000000000000000000000000000010000000000000000000000002d679b567db6187c0c8323fa982cfb88b74dbcc7000000000000000000000000000000000000000000000000000000000000083400000000000000000000000000000000000000000000000000000000000f4240"));
|
||||
let l1_block_info = Bytes::from_static(&hex!(
|
||||
"7ef9015aa044bae9d41b8380d781187b426c6fe43df5fb2fb57bd4466ef6a701e1f01e015694deaddeaddeaddeaddeaddeaddeaddeaddead000194420000000000000000000000000000000000001580808408f0d18001b90104015d8eb900000000000000000000000000000000000000000000000000000000008057650000000000000000000000000000000000000000000000000000000063d96d10000000000000000000000000000000000000000000000000000000000009f35273d89754a1e0387b89520d989d3be9c37c1f32495a88faf1ea05c61121ab0d1900000000000000000000000000000000000000000000000000000000000000010000000000000000000000002d679b567db6187c0c8323fa982cfb88b74dbcc7000000000000000000000000000000000000000000000000000000000000083400000000000000000000000000000000000000000000000000000000000f4240"
|
||||
));
|
||||
let tx = tx(chain_id, 210000, Some(l1_block_info), None, nonce);
|
||||
let signer = EthereumWallet::from(wallet);
|
||||
<TransactionRequest as TransactionBuilder<Ethereum>>::build(tx, &signer)
|
||||
|
||||
@@ -32,7 +32,7 @@ impl Wallet {
|
||||
}
|
||||
|
||||
/// Generates a list of wallets
|
||||
pub fn gen(&self) -> Vec<PrivateKeySigner> {
|
||||
pub fn wallet_gen(&self) -> Vec<PrivateKeySigner> {
|
||||
let builder = MnemonicBuilder::<English>::default().phrase(TEST_MNEMONIC);
|
||||
|
||||
// use the derivation path
|
||||
|
||||
@@ -24,7 +24,7 @@ fn create_bench_state(num_accounts: usize) -> EvmState {
|
||||
info: AccountInfo {
|
||||
balance: U256::from(100),
|
||||
nonce: 10,
|
||||
code_hash: B256::from_slice(&rng.gen::<[u8; 32]>()),
|
||||
code_hash: B256::from_slice(&rng.r#gen::<[u8; 32]>()),
|
||||
code: Default::default(),
|
||||
},
|
||||
storage,
|
||||
|
||||
@@ -69,18 +69,18 @@ fn create_bench_state_updates(params: &BenchParams) -> Vec<EvmState> {
|
||||
} else {
|
||||
RevmAccount {
|
||||
info: AccountInfo {
|
||||
balance: U256::from(rng.gen::<u64>()),
|
||||
nonce: rng.gen::<u64>(),
|
||||
balance: U256::from(rng.r#gen::<u64>()),
|
||||
nonce: rng.r#gen::<u64>(),
|
||||
code_hash: KECCAK_EMPTY,
|
||||
code: Some(Default::default()),
|
||||
},
|
||||
storage: (0..rng.gen_range(0..=params.storage_slots_per_account))
|
||||
.map(|_| {
|
||||
(
|
||||
U256::from(rng.gen::<u64>()),
|
||||
U256::from(rng.r#gen::<u64>()),
|
||||
EvmStorageSlot::new_changed(
|
||||
U256::ZERO,
|
||||
U256::from(rng.gen::<u64>()),
|
||||
U256::from(rng.r#gen::<u64>()),
|
||||
),
|
||||
)
|
||||
})
|
||||
|
||||
@@ -93,7 +93,7 @@ impl<N: ProviderNodeTypes> PipelineSync<N> {
|
||||
pub fn new(pipeline: Pipeline<N>, pipeline_task_spawner: Box<dyn TaskSpawner>) -> Self {
|
||||
Self {
|
||||
pipeline_task_spawner,
|
||||
pipeline_state: PipelineState::Idle(Some(pipeline)),
|
||||
pipeline_state: PipelineState::Idle(Some(Box::new(pipeline))),
|
||||
pending_pipeline_target: None,
|
||||
}
|
||||
}
|
||||
@@ -165,7 +165,7 @@ impl<N: ProviderNodeTypes> PipelineSync<N> {
|
||||
};
|
||||
let ev = match res {
|
||||
Ok((pipeline, result)) => {
|
||||
self.pipeline_state = PipelineState::Idle(Some(pipeline));
|
||||
self.pipeline_state = PipelineState::Idle(Some(Box::new(pipeline)));
|
||||
BackfillEvent::Finished(result)
|
||||
}
|
||||
Err(why) => {
|
||||
@@ -212,10 +212,9 @@ impl<N: ProviderNodeTypes> BackfillSync for PipelineSync<N> {
|
||||
/// blockchain tree any messages that would result in database writes, since it would result in a
|
||||
/// deadlock.
|
||||
#[derive(Debug)]
|
||||
#[expect(clippy::large_enum_variant)]
|
||||
enum PipelineState<N: ProviderNodeTypes> {
|
||||
/// Pipeline is idle.
|
||||
Idle(Option<Pipeline<N>>),
|
||||
Idle(Option<Box<Pipeline<N>>>),
|
||||
/// Pipeline is running and waiting for a response
|
||||
Running(oneshot::Receiver<PipelineWithResult<N>>),
|
||||
}
|
||||
|
||||
@@ -414,10 +414,9 @@ mod tests {
|
||||
// we load the account first, because revm expects it to be
|
||||
// loaded
|
||||
executor.with_state_mut(|state| state.basic(HISTORY_STORAGE_ADDRESS).unwrap());
|
||||
assert!(executor.with_state_mut(|state| state
|
||||
.storage(HISTORY_STORAGE_ADDRESS, U256::ZERO)
|
||||
.unwrap()
|
||||
.is_zero()));
|
||||
assert!(executor.with_state_mut(|state| {
|
||||
state.storage(HISTORY_STORAGE_ADDRESS, U256::ZERO).unwrap().is_zero()
|
||||
}));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -452,10 +451,9 @@ mod tests {
|
||||
// we load the account first, because revm expects it to be
|
||||
// loaded
|
||||
executor.with_state_mut(|state| state.basic(HISTORY_STORAGE_ADDRESS).unwrap());
|
||||
assert!(executor.with_state_mut(|state| state
|
||||
.storage(HISTORY_STORAGE_ADDRESS, U256::ZERO)
|
||||
.unwrap()
|
||||
.is_zero()));
|
||||
assert!(executor.with_state_mut(|state| {
|
||||
state.storage(HISTORY_STORAGE_ADDRESS, U256::ZERO).unwrap().is_zero()
|
||||
}));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -504,10 +502,12 @@ mod tests {
|
||||
);
|
||||
|
||||
// the hash of the block itself should not be in storage
|
||||
assert!(executor.with_state_mut(|state| state
|
||||
.storage(HISTORY_STORAGE_ADDRESS, U256::from(fork_activation_block))
|
||||
.unwrap()
|
||||
.is_zero()));
|
||||
assert!(executor.with_state_mut(|state| {
|
||||
state
|
||||
.storage(HISTORY_STORAGE_ADDRESS, U256::from(fork_activation_block))
|
||||
.unwrap()
|
||||
.is_zero()
|
||||
}));
|
||||
}
|
||||
|
||||
// <https://github.com/ethereum/EIPs/pull/9144>
|
||||
@@ -585,10 +585,9 @@ mod tests {
|
||||
// we load the account first, because revm expects it to be
|
||||
// loaded
|
||||
executor.with_state_mut(|state| state.basic(HISTORY_STORAGE_ADDRESS).unwrap());
|
||||
assert!(executor.with_state_mut(|state| state
|
||||
.storage(HISTORY_STORAGE_ADDRESS, U256::ZERO)
|
||||
.unwrap()
|
||||
.is_zero()));
|
||||
assert!(executor.with_state_mut(|state| {
|
||||
state.storage(HISTORY_STORAGE_ADDRESS, U256::ZERO).unwrap().is_zero()
|
||||
}));
|
||||
|
||||
// attempt to execute block 1, this should not fail
|
||||
let header = Header {
|
||||
@@ -620,10 +619,9 @@ mod tests {
|
||||
.unwrap()),
|
||||
U256::ZERO
|
||||
);
|
||||
assert!(executor.with_state_mut(|state| state
|
||||
.storage(HISTORY_STORAGE_ADDRESS, U256::from(1))
|
||||
.unwrap()
|
||||
.is_zero()));
|
||||
assert!(executor.with_state_mut(|state| {
|
||||
state.storage(HISTORY_STORAGE_ADDRESS, U256::from(1)).unwrap().is_zero()
|
||||
}));
|
||||
|
||||
// attempt to execute block 2, this should not fail
|
||||
let header = Header {
|
||||
@@ -660,10 +658,9 @@ mod tests {
|
||||
.unwrap()),
|
||||
U256::ZERO
|
||||
);
|
||||
assert!(executor.with_state_mut(|state| state
|
||||
.storage(HISTORY_STORAGE_ADDRESS, U256::from(2))
|
||||
.unwrap()
|
||||
.is_zero()));
|
||||
assert!(executor.with_state_mut(|state| {
|
||||
state.storage(HISTORY_STORAGE_ADDRESS, U256::from(2)).unwrap().is_zero()
|
||||
}));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -687,7 +684,9 @@ mod tests {
|
||||
);
|
||||
|
||||
// https://github.com/lightclient/sys-asm/blob/9282bdb9fd64e024e27f60f507486ffb2183cba2/test/Withdrawal.t.sol.in#L36
|
||||
let validator_public_key = fixed_bytes!("111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111");
|
||||
let validator_public_key = fixed_bytes!(
|
||||
"111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"
|
||||
);
|
||||
let withdrawal_amount = fixed_bytes!("0203040506070809");
|
||||
let input: Bytes = [&validator_public_key[..], &withdrawal_amount[..]].concat().into();
|
||||
assert_eq!(input.len(), 56);
|
||||
@@ -758,7 +757,9 @@ mod tests {
|
||||
);
|
||||
|
||||
// Define the validator public key and withdrawal amount as fixed bytes
|
||||
let validator_public_key = fixed_bytes!("111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111");
|
||||
let validator_public_key = fixed_bytes!(
|
||||
"111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"
|
||||
);
|
||||
let withdrawal_amount = fixed_bytes!("2222222222222222");
|
||||
// Concatenate the validator public key and withdrawal amount into a single byte array
|
||||
let input: Bytes = [&validator_public_key[..], &withdrawal_amount[..]].concat().into();
|
||||
|
||||
@@ -38,7 +38,7 @@ async fn can_handle_blobs() -> eyre::Result<()> {
|
||||
|
||||
let mut node = NodeTestContext::new(node, eth_payload_attributes).await?;
|
||||
|
||||
let wallets = Wallet::new(2).gen();
|
||||
let wallets = Wallet::new(2).wallet_gen();
|
||||
let blob_wallet = wallets.first().unwrap();
|
||||
let second_wallet = wallets.last().unwrap();
|
||||
|
||||
|
||||
@@ -52,7 +52,9 @@ where
|
||||
let mut notifications = node.provider.canonical_state_stream();
|
||||
|
||||
// submit tx through rpc
|
||||
let raw_tx = hex!("02f876820a28808477359400847735940082520894ab0840c0e43688012c1adb0f5e3fc665188f83d28a029d394a5d630544000080c080a0a044076b7e67b5deecc63f61a8d7913fab86ca365b344b5759d1fe3563b4c39ea019eab979dd000da04dfc72bb0377c092d30fd9e1cab5ae487de49586cc8b0090");
|
||||
let raw_tx = hex!(
|
||||
"02f876820a28808477359400847735940082520894ab0840c0e43688012c1adb0f5e3fc665188f83d28a029d394a5d630544000080c080a0a044076b7e67b5deecc63f61a8d7913fab86ca365b344b5759d1fe3563b4c39ea019eab979dd000da04dfc72bb0377c092d30fd9e1cab5ae487de49586cc8b0090"
|
||||
);
|
||||
|
||||
let eth_api = node.rpc_registry.eth_api();
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ async fn test_fee_history() -> eyre::Result<()> {
|
||||
setup_engine::<EthereumNode>(1, chain_spec.clone(), false, eth_payload_attributes).await?;
|
||||
let mut node = nodes.pop().unwrap();
|
||||
let provider = ProviderBuilder::new()
|
||||
.wallet(EthereumWallet::new(wallet.gen().swap_remove(0)))
|
||||
.wallet(EthereumWallet::new(wallet.wallet_gen().swap_remove(0)))
|
||||
.connect_http(node.rpc_url());
|
||||
|
||||
let fee_history = provider.get_fee_history(10, 0_u64.into(), &[]).await?;
|
||||
@@ -131,7 +131,7 @@ async fn test_flashbots_validate_v3() -> eyre::Result<()> {
|
||||
setup_engine::<EthereumNode>(1, chain_spec.clone(), false, eth_payload_attributes).await?;
|
||||
let mut node = nodes.pop().unwrap();
|
||||
let provider = ProviderBuilder::new()
|
||||
.wallet(EthereumWallet::new(wallet.gen().swap_remove(0)))
|
||||
.wallet(EthereumWallet::new(wallet.wallet_gen().swap_remove(0)))
|
||||
.connect_http(node.rpc_url());
|
||||
|
||||
node.advance(100, |_| {
|
||||
@@ -207,7 +207,7 @@ async fn test_flashbots_validate_v4() -> eyre::Result<()> {
|
||||
setup_engine::<EthereumNode>(1, chain_spec.clone(), false, eth_payload_attributes).await?;
|
||||
let mut node = nodes.pop().unwrap();
|
||||
let provider = ProviderBuilder::new()
|
||||
.wallet(EthereumWallet::new(wallet.gen().swap_remove(0)))
|
||||
.wallet(EthereumWallet::new(wallet.wallet_gen().swap_remove(0)))
|
||||
.connect_http(node.rpc_url());
|
||||
|
||||
node.advance(100, |_| {
|
||||
|
||||
@@ -40,10 +40,12 @@ where
|
||||
Provider: FullProvider<NodeTypesWithDBAdapter<EthereumNode, TmpDB>>,
|
||||
{
|
||||
let provider = ProviderBuilder::new().connect_http(node.rpc_url());
|
||||
let signers = Wallet::new(1).with_chain_id(provider.get_chain_id().await?).gen();
|
||||
let signers = Wallet::new(1).with_chain_id(provider.get_chain_id().await?).wallet_gen();
|
||||
|
||||
// simple contract which writes to storage on any call
|
||||
let dummy_bytecode = bytes!("6080604052348015600f57600080fd5b50602880601d6000396000f3fe4360a09081523360c0526040608081905260e08152902080805500fea164736f6c6343000810000a");
|
||||
let dummy_bytecode = bytes!(
|
||||
"6080604052348015600f57600080fd5b50602880601d6000396000f3fe4360a09081523360c0526040608081905260e08152902080805500fea164736f6c6343000810000a"
|
||||
);
|
||||
let mut call_destinations = signers.iter().map(|s| s.address()).collect::<Vec<_>>();
|
||||
|
||||
for _ in 0..num_blocks {
|
||||
|
||||
@@ -436,7 +436,9 @@ mod tests {
|
||||
// Test vector from: https://eips.ethereum.org/EIPS/eip-2481
|
||||
#[test]
|
||||
fn encode_legacy_receipt() {
|
||||
let expected = hex!("f901668001b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f85ff85d940000000000000000000000000000000000000011f842a0000000000000000000000000000000000000000000000000000000000000deada0000000000000000000000000000000000000000000000000000000000000beef830100ff");
|
||||
let expected = hex!(
|
||||
"f901668001b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f85ff85d940000000000000000000000000000000000000011f842a0000000000000000000000000000000000000000000000000000000000000deada0000000000000000000000000000000000000000000000000000000000000beef830100ff"
|
||||
);
|
||||
|
||||
let mut data = Vec::with_capacity(expected.length());
|
||||
let receipt = ReceiptWithBloom {
|
||||
@@ -466,7 +468,9 @@ mod tests {
|
||||
// Test vector from: https://eips.ethereum.org/EIPS/eip-2481
|
||||
#[test]
|
||||
fn decode_legacy_receipt() {
|
||||
let data = hex!("f901668001b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f85ff85d940000000000000000000000000000000000000011f842a0000000000000000000000000000000000000000000000000000000000000deada0000000000000000000000000000000000000000000000000000000000000beef830100ff");
|
||||
let data = hex!(
|
||||
"f901668001b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f85ff85d940000000000000000000000000000000000000011f842a0000000000000000000000000000000000000000000000000000000000000deada0000000000000000000000000000000000000000000000000000000000000beef830100ff"
|
||||
);
|
||||
|
||||
// EIP658Receipt
|
||||
let expected = ReceiptWithBloom {
|
||||
@@ -560,7 +564,9 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn check_transaction_root() {
|
||||
let data = &hex!("f90262f901f9a092230ce5476ae868e98c7979cfc165a93f8b6ad1922acf2df62e340916efd49da01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347942adc25665018aa1fe0e6bc666dac8fc2697ff9baa02307107a867056ca33b5087e77c4174f47625e48fb49f1c70ced34890ddd88f3a08151d548273f6683169524b66ca9fe338b9ce42bc3540046c828fd939ae23bcba0c598f69a5674cae9337261b669970e24abc0b46e6d284372a239ec8ccbf20b0ab901000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000083020000018502540be40082a8618203e800a00000000000000000000000000000000000000000000000000000000000000000880000000000000000f863f861800a8405f5e10094100000000000000000000000000000000000000080801ba07e09e26678ed4fac08a249ebe8ed680bf9051a5e14ad223e4b2b9d26e0208f37a05f6e3f188e3e6eab7d7d3b6568f5eac7d687b08d307d3154ccd8c87b4630509bc0");
|
||||
let data = &hex!(
|
||||
"f90262f901f9a092230ce5476ae868e98c7979cfc165a93f8b6ad1922acf2df62e340916efd49da01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347942adc25665018aa1fe0e6bc666dac8fc2697ff9baa02307107a867056ca33b5087e77c4174f47625e48fb49f1c70ced34890ddd88f3a08151d548273f6683169524b66ca9fe338b9ce42bc3540046c828fd939ae23bcba0c598f69a5674cae9337261b669970e24abc0b46e6d284372a239ec8ccbf20b0ab901000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000083020000018502540be40082a8618203e800a00000000000000000000000000000000000000000000000000000000000000000880000000000000000f863f861800a8405f5e10094100000000000000000000000000000000000000080801ba07e09e26678ed4fac08a249ebe8ed680bf9051a5e14ad223e4b2b9d26e0208f37a05f6e3f188e3e6eab7d7d3b6568f5eac7d687b08d307d3154ccd8c87b4630509bc0"
|
||||
);
|
||||
let block_rlp = &mut data.as_slice();
|
||||
let block: Block = Block::decode(block_rlp).unwrap();
|
||||
|
||||
@@ -572,7 +578,9 @@ mod tests {
|
||||
fn check_withdrawals_root() {
|
||||
// Single withdrawal, amount 0
|
||||
// https://github.com/ethereum/tests/blob/9760400e667eba241265016b02644ef62ab55de2/BlockchainTests/EIPTests/bc4895-withdrawals/amountIs0.json
|
||||
let data = &hex!("f90238f90219a0151934ad9b654c50197f37018ee5ee9bb922dec0a1b5e24a6d679cb111cdb107a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347942adc25665018aa1fe0e6bc666dac8fc2697ff9baa0046119afb1ab36aaa8f66088677ed96cd62762f6d3e65642898e189fbe702d51a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008001887fffffffffffffff8082079e42a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b42188000000000000000009a048a703da164234812273ea083e4ec3d09d028300cd325b46a6a75402e5a7ab95c0c0d9d8808094c94f5374fce5edbc8e2a8697c15331677e6ebf0b80");
|
||||
let data = &hex!(
|
||||
"f90238f90219a0151934ad9b654c50197f37018ee5ee9bb922dec0a1b5e24a6d679cb111cdb107a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347942adc25665018aa1fe0e6bc666dac8fc2697ff9baa0046119afb1ab36aaa8f66088677ed96cd62762f6d3e65642898e189fbe702d51a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008001887fffffffffffffff8082079e42a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b42188000000000000000009a048a703da164234812273ea083e4ec3d09d028300cd325b46a6a75402e5a7ab95c0c0d9d8808094c94f5374fce5edbc8e2a8697c15331677e6ebf0b80"
|
||||
);
|
||||
let block: Block = Block::decode(&mut data.as_slice()).unwrap();
|
||||
assert!(block.body.withdrawals.is_some());
|
||||
let withdrawals = block.body.withdrawals.as_ref().unwrap();
|
||||
@@ -582,7 +590,9 @@ mod tests {
|
||||
|
||||
// 4 withdrawals, identical indices
|
||||
// https://github.com/ethereum/tests/blob/9760400e667eba241265016b02644ef62ab55de2/BlockchainTests/EIPTests/bc4895-withdrawals/twoIdenticalIndex.json
|
||||
let data = &hex!("f9028cf90219a0151934ad9b654c50197f37018ee5ee9bb922dec0a1b5e24a6d679cb111cdb107a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347942adc25665018aa1fe0e6bc666dac8fc2697ff9baa0ccf7b62d616c2ad7af862d67b9dcd2119a90cebbff8c3cd1e5d7fc99f8755774a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008001887fffffffffffffff8082079e42a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b42188000000000000000009a0a95b9a7b58a6b3cb4001eb0be67951c5517141cb0183a255b5cae027a7b10b36c0c0f86cda808094c94f5374fce5edbc8e2a8697c15331677e6ebf0b822710da028094c94f5374fce5edbc8e2a8697c15331677e6ebf0b822710da018094c94f5374fce5edbc8e2a8697c15331677e6ebf0b822710da028094c94f5374fce5edbc8e2a8697c15331677e6ebf0b822710");
|
||||
let data = &hex!(
|
||||
"f9028cf90219a0151934ad9b654c50197f37018ee5ee9bb922dec0a1b5e24a6d679cb111cdb107a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347942adc25665018aa1fe0e6bc666dac8fc2697ff9baa0ccf7b62d616c2ad7af862d67b9dcd2119a90cebbff8c3cd1e5d7fc99f8755774a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008001887fffffffffffffff8082079e42a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b42188000000000000000009a0a95b9a7b58a6b3cb4001eb0be67951c5517141cb0183a255b5cae027a7b10b36c0c0f86cda808094c94f5374fce5edbc8e2a8697c15331677e6ebf0b822710da028094c94f5374fce5edbc8e2a8697c15331677e6ebf0b822710da018094c94f5374fce5edbc8e2a8697c15331677e6ebf0b822710da028094c94f5374fce5edbc8e2a8697c15331677e6ebf0b822710"
|
||||
);
|
||||
let block: Block = Block::decode(&mut data.as_slice()).unwrap();
|
||||
assert!(block.body.withdrawals.is_some());
|
||||
let withdrawals = block.body.withdrawals.as_ref().unwrap();
|
||||
@@ -598,7 +608,9 @@ mod tests {
|
||||
address: Address::ZERO,
|
||||
data: LogData::new_unchecked(vec![], Default::default()),
|
||||
}];
|
||||
let bloom = bloom!("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001");
|
||||
let bloom = bloom!(
|
||||
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001"
|
||||
);
|
||||
let receipt = ReceiptWithBloom {
|
||||
receipt: Receipt {
|
||||
tx_type: TxType::Eip2930,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! Contains [Chain], a chain of blocks and their final state.
|
||||
|
||||
use crate::ExecutionOutcome;
|
||||
use alloc::{borrow::Cow, collections::BTreeMap, vec::Vec};
|
||||
use alloc::{borrow::Cow, boxed::Box, collections::BTreeMap, vec::Vec};
|
||||
use alloy_consensus::{transaction::Recovered, BlockHeader};
|
||||
use alloy_eips::{eip1898::ForkBlock, eip2718::Encodable2718, BlockNumHash};
|
||||
use alloy_primitives::{Address, BlockHash, BlockNumber, TxHash};
|
||||
@@ -347,11 +347,11 @@ impl<N: NodePrimitives> Chain<N> {
|
||||
// TODO: Currently, trie updates are reset on chain split.
|
||||
// Add tests ensuring that it is valid to leave updates in the pending chain.
|
||||
ChainSplit::Split {
|
||||
canonical: Self {
|
||||
canonical: Box::new(Self {
|
||||
execution_outcome: canonical_block_exec_outcome.expect("split in range"),
|
||||
blocks: self.blocks,
|
||||
trie_updates: None,
|
||||
},
|
||||
}),
|
||||
pending: Self {
|
||||
execution_outcome: pending_block_exec_outcome,
|
||||
blocks: higher_number_blocks,
|
||||
@@ -497,7 +497,6 @@ impl From<BlockHash> for ChainSplitTarget {
|
||||
|
||||
/// Result of a split chain.
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
#[expect(clippy::large_enum_variant)]
|
||||
pub enum ChainSplit<N: NodePrimitives = reth_ethereum_primitives::EthPrimitives> {
|
||||
/// Chain is not split. Pending chain is returned.
|
||||
/// Given block split is higher than last block.
|
||||
@@ -512,7 +511,7 @@ pub enum ChainSplit<N: NodePrimitives = reth_ethereum_primitives::EthPrimitives>
|
||||
/// Contains lower block numbers that are considered canonicalized. It ends with
|
||||
/// the [`ChainSplitTarget`] block. The state of this chain is now empty and no longer
|
||||
/// usable.
|
||||
canonical: Chain<N>,
|
||||
canonical: Box<Chain<N>>,
|
||||
/// Right contains all subsequent blocks __after__ the [`ChainSplitTarget`] that are still
|
||||
/// pending.
|
||||
///
|
||||
@@ -819,7 +818,7 @@ mod tests {
|
||||
// split in two
|
||||
assert_eq!(
|
||||
chain.clone().split(block1_hash.into()),
|
||||
ChainSplit::Split { canonical: chain_split1, pending: chain_split2 }
|
||||
ChainSplit::Split { canonical: Box::new(chain_split1), pending: chain_split2 }
|
||||
);
|
||||
|
||||
// split at unknown block hash
|
||||
|
||||
@@ -64,7 +64,6 @@ pub trait ExExNotificationsStream<N: NodePrimitives = EthPrimitives>:
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
#[expect(clippy::large_enum_variant)]
|
||||
enum ExExNotificationsInner<P, E>
|
||||
where
|
||||
E: BlockExecutorProvider,
|
||||
@@ -73,7 +72,7 @@ where
|
||||
WithoutHead(ExExNotificationsWithoutHead<P, E>),
|
||||
/// A stream of [`ExExNotification`]s. The stream will only emit notifications for blocks that
|
||||
/// are committed or reverted after the given head.
|
||||
WithHead(ExExNotificationsWithHead<P, E>),
|
||||
WithHead(Box<ExExNotificationsWithHead<P, E>>),
|
||||
/// Internal state used when transitioning between [`ExExNotificationsInner::WithoutHead`] and
|
||||
/// [`ExExNotificationsInner::WithHead`].
|
||||
Invalid,
|
||||
@@ -130,16 +129,18 @@ where
|
||||
let current = std::mem::replace(&mut self.inner, ExExNotificationsInner::Invalid);
|
||||
self.inner = ExExNotificationsInner::WithHead(match current {
|
||||
ExExNotificationsInner::WithoutHead(notifications) => {
|
||||
notifications.with_head(exex_head)
|
||||
Box::new(notifications.with_head(exex_head))
|
||||
}
|
||||
ExExNotificationsInner::WithHead(notifications) => {
|
||||
Box::new(ExExNotificationsWithHead::new(
|
||||
notifications.initial_local_head,
|
||||
notifications.provider,
|
||||
notifications.executor,
|
||||
notifications.notifications,
|
||||
notifications.wal_handle,
|
||||
exex_head,
|
||||
))
|
||||
}
|
||||
ExExNotificationsInner::WithHead(notifications) => ExExNotificationsWithHead::new(
|
||||
notifications.initial_local_head,
|
||||
notifications.provider,
|
||||
notifications.executor,
|
||||
notifications.notifications,
|
||||
notifications.wal_handle,
|
||||
exex_head,
|
||||
),
|
||||
ExExNotificationsInner::Invalid => unreachable!(),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2544,7 +2544,7 @@ mod tests {
|
||||
from: rng_endpoint(&mut rng),
|
||||
to: rng_endpoint(&mut rng),
|
||||
expire: service.ping_expiration(),
|
||||
enr_sq: Some(rng.gen()),
|
||||
enr_sq: Some(rng.r#gen()),
|
||||
};
|
||||
|
||||
let id = PeerId::random();
|
||||
@@ -2576,7 +2576,7 @@ mod tests {
|
||||
from: rng_endpoint(&mut rng),
|
||||
to: rng_endpoint(&mut rng),
|
||||
expire: SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_secs() - 1,
|
||||
enr_sq: Some(rng.gen()),
|
||||
enr_sq: Some(rng.r#gen()),
|
||||
};
|
||||
|
||||
let id = PeerId::random();
|
||||
|
||||
@@ -605,8 +605,8 @@ mod tests {
|
||||
rng.fill_bytes(&mut ip);
|
||||
let msg = NodeEndpoint {
|
||||
address: IpAddr::V4(ip.into()),
|
||||
tcp_port: rng.gen(),
|
||||
udp_port: rng.gen(),
|
||||
tcp_port: rng.r#gen(),
|
||||
udp_port: rng.r#gen(),
|
||||
};
|
||||
|
||||
let decoded = NodeEndpoint::decode(&mut alloy_rlp::encode(msg).as_slice()).unwrap();
|
||||
@@ -622,8 +622,8 @@ mod tests {
|
||||
rng.fill_bytes(&mut ip);
|
||||
let msg = NodeEndpoint {
|
||||
address: IpAddr::V6(ip.into()),
|
||||
tcp_port: rng.gen(),
|
||||
udp_port: rng.gen(),
|
||||
tcp_port: rng.r#gen(),
|
||||
udp_port: rng.r#gen(),
|
||||
};
|
||||
|
||||
let decoded = NodeEndpoint::decode(&mut alloy_rlp::encode(msg).as_slice()).unwrap();
|
||||
@@ -659,7 +659,7 @@ mod tests {
|
||||
from: rng_endpoint(&mut rng),
|
||||
to: rng_endpoint(&mut rng),
|
||||
expire: 0,
|
||||
enr_sq: Some(rng.gen()),
|
||||
enr_sq: Some(rng.r#gen()),
|
||||
};
|
||||
|
||||
let decoded = Ping::decode(&mut alloy_rlp::encode(&msg).as_slice()).unwrap();
|
||||
@@ -676,7 +676,7 @@ mod tests {
|
||||
let msg = Pong {
|
||||
to: rng_endpoint(&mut rng),
|
||||
echo: B256::random(),
|
||||
expire: rng.gen(),
|
||||
expire: rng.r#gen(),
|
||||
enr_sq: None,
|
||||
};
|
||||
|
||||
@@ -694,8 +694,8 @@ mod tests {
|
||||
let msg = Pong {
|
||||
to: rng_endpoint(&mut rng),
|
||||
echo: B256::random(),
|
||||
expire: rng.gen(),
|
||||
enr_sq: Some(rng.gen()),
|
||||
expire: rng.r#gen(),
|
||||
enr_sq: Some(rng.r#gen()),
|
||||
};
|
||||
|
||||
let decoded = Pong::decode(&mut alloy_rlp::encode(&msg).as_slice()).unwrap();
|
||||
@@ -725,7 +725,7 @@ mod tests {
|
||||
let mut rng = rng();
|
||||
let msg = Message::Neighbours(Neighbours {
|
||||
nodes: std::iter::repeat_with(|| rng_ipv4_record(&mut rng)).take(16).collect(),
|
||||
expire: rng.gen(),
|
||||
expire: rng.r#gen(),
|
||||
});
|
||||
let (secret_key, _) = SECP256K1.generate_keypair(&mut rng);
|
||||
|
||||
@@ -742,7 +742,7 @@ mod tests {
|
||||
nodes: std::iter::repeat_with(|| rng_ipv6_record(&mut rng))
|
||||
.take(SAFE_MAX_DATAGRAM_NEIGHBOUR_RECORDS)
|
||||
.collect(),
|
||||
expire: rng.gen(),
|
||||
expire: rng.r#gen(),
|
||||
});
|
||||
let (secret_key, _) = SECP256K1.generate_keypair(&mut rng);
|
||||
|
||||
@@ -753,7 +753,7 @@ mod tests {
|
||||
nodes: std::iter::repeat_with(|| rng_ipv6_record(&mut rng))
|
||||
.take(SAFE_MAX_DATAGRAM_NEIGHBOUR_RECORDS - 1)
|
||||
.collect(),
|
||||
expire: rng.gen(),
|
||||
expire: rng.r#gen(),
|
||||
};
|
||||
neighbours.nodes.push(rng_ipv4_record(&mut rng));
|
||||
let msg = Message::Neighbours(neighbours);
|
||||
@@ -836,8 +836,12 @@ mod tests {
|
||||
use enr::{secp256k1::SecretKey, EnrPublicKey};
|
||||
use std::net::Ipv4Addr;
|
||||
|
||||
let valid_record = hex!("f884b8407098ad865b00a582051940cb9cf36836572411a47278783077011599ed5cd16b76f2635f4e234738f30813a89eb9137e3e3df5266e3a1f11df72ecf1145ccb9c01826964827634826970847f00000189736563703235366b31a103ca634cae0d49acb401d8a4c6b6fe8c55b70d115bf400769cc1400f3258cd31388375647082765f");
|
||||
let signature = hex!("7098ad865b00a582051940cb9cf36836572411a47278783077011599ed5cd16b76f2635f4e234738f30813a89eb9137e3e3df5266e3a1f11df72ecf1145ccb9c");
|
||||
let valid_record = hex!(
|
||||
"f884b8407098ad865b00a582051940cb9cf36836572411a47278783077011599ed5cd16b76f2635f4e234738f30813a89eb9137e3e3df5266e3a1f11df72ecf1145ccb9c01826964827634826970847f00000189736563703235366b31a103ca634cae0d49acb401d8a4c6b6fe8c55b70d115bf400769cc1400f3258cd31388375647082765f"
|
||||
);
|
||||
let signature = hex!(
|
||||
"7098ad865b00a582051940cb9cf36836572411a47278783077011599ed5cd16b76f2635f4e234738f30813a89eb9137e3e3df5266e3a1f11df72ecf1145ccb9c"
|
||||
);
|
||||
let expected_pubkey =
|
||||
hex!("03ca634cae0d49acb401d8a4c6b6fe8c55b70d115bf400769cc1400f3258cd3138");
|
||||
|
||||
@@ -865,8 +869,12 @@ mod tests {
|
||||
use enr::secp256k1::SecretKey;
|
||||
use std::net::Ipv4Addr;
|
||||
|
||||
let valid_record = hex!("f884b8407098ad865b00a582051940cb9cf36836572411a47278783077011599ed5cd16b76f2635f4e234738f30813a89eb9137e3e3df5266e3a1f11df72ecf1145ccb9c01826964827634826970847f00000189736563703235366b31a103ca634cae0d49acb401d8a4c6b6fe8c55b70d115bf400769cc1400f3258cd31388375647082765f");
|
||||
let signature = hex!("7098ad865b00a582051940cb9cf36836572411a47278783077011599ed5cd16b76f2635f4e234738f30813a89eb9137e3e3df5266e3a1f11df72ecf1145ccb9c");
|
||||
let valid_record = hex!(
|
||||
"f884b8407098ad865b00a582051940cb9cf36836572411a47278783077011599ed5cd16b76f2635f4e234738f30813a89eb9137e3e3df5266e3a1f11df72ecf1145ccb9c01826964827634826970847f00000189736563703235366b31a103ca634cae0d49acb401d8a4c6b6fe8c55b70d115bf400769cc1400f3258cd31388375647082765f"
|
||||
);
|
||||
let signature = hex!(
|
||||
"7098ad865b00a582051940cb9cf36836572411a47278783077011599ed5cd16b76f2635f4e234738f30813a89eb9137e3e3df5266e3a1f11df72ecf1145ccb9c"
|
||||
);
|
||||
let expected_pubkey =
|
||||
hex!("03ca634cae0d49acb401d8a4c6b6fe8c55b70d115bf400769cc1400f3258cd3138");
|
||||
|
||||
@@ -889,7 +897,9 @@ mod tests {
|
||||
// test for failing message decode
|
||||
#[test]
|
||||
fn decode_failing_packet() {
|
||||
let packet = hex!("2467ab56952aedf4cfb8bb7830ddc8922d0f992185229919dad9de3841fe95d9b3a7b52459398235f6d3805644666d908b45edb3670414ed97f357afba51f71f7d35c1f45878ba732c3868b04ca42ff0ed347c99efcf3a5768afed68eb21ef960001db04c3808080c9840a480e8f82765f808466a9a06386019106833efe");
|
||||
let packet = hex!(
|
||||
"2467ab56952aedf4cfb8bb7830ddc8922d0f992185229919dad9de3841fe95d9b3a7b52459398235f6d3805644666d908b45edb3670414ed97f357afba51f71f7d35c1f45878ba732c3868b04ca42ff0ed347c99efcf3a5768afed68eb21ef960001db04c3808080c9840a480e8f82765f808466a9a06386019106833efe"
|
||||
);
|
||||
|
||||
let _message = Message::decode(&packet[..]).unwrap();
|
||||
}
|
||||
@@ -973,12 +983,16 @@ mod tests {
|
||||
// test vector from eip-8: https://eips.ethereum.org/EIPS/eip-8
|
||||
#[test]
|
||||
fn eip8_decode_findnode() {
|
||||
let findnode_with_junk = hex!("c7c44041b9f7c7e41934417ebac9a8e1a4c6298f74553f2fcfdcae6ed6fe53163eb3d2b52e39fe91831b8a927bf4fc222c3902202027e5e9eb812195f95d20061ef5cd31d502e47ecb61183f74a504fe04c51e73df81f25c4d506b26db4517490103f84eb840ca634cae0d49acb401d8a4c6b6fe8c55b70d115bf400769cc1400f3258cd31387574077f301b421bc84df7266c44e9e6d569fc56be00812904767bf5ccd1fc7f8443b9a35582999983999999280dc62cc8255c73471e0a61da0c89acdc0e035e260add7fc0c04ad9ebf3919644c91cb247affc82b69bd2ca235c71eab8e49737c937a2c396");
|
||||
let findnode_with_junk = hex!(
|
||||
"c7c44041b9f7c7e41934417ebac9a8e1a4c6298f74553f2fcfdcae6ed6fe53163eb3d2b52e39fe91831b8a927bf4fc222c3902202027e5e9eb812195f95d20061ef5cd31d502e47ecb61183f74a504fe04c51e73df81f25c4d506b26db4517490103f84eb840ca634cae0d49acb401d8a4c6b6fe8c55b70d115bf400769cc1400f3258cd31387574077f301b421bc84df7266c44e9e6d569fc56be00812904767bf5ccd1fc7f8443b9a35582999983999999280dc62cc8255c73471e0a61da0c89acdc0e035e260add7fc0c04ad9ebf3919644c91cb247affc82b69bd2ca235c71eab8e49737c937a2c396"
|
||||
);
|
||||
|
||||
let buf = findnode_with_junk.as_slice();
|
||||
let decoded = Message::decode(buf).unwrap();
|
||||
|
||||
let expected_id = hex!("ca634cae0d49acb401d8a4c6b6fe8c55b70d115bf400769cc1400f3258cd31387574077f301b421bc84df7266c44e9e6d569fc56be00812904767bf5ccd1fc7f");
|
||||
let expected_id = hex!(
|
||||
"ca634cae0d49acb401d8a4c6b6fe8c55b70d115bf400769cc1400f3258cd31387574077f301b421bc84df7266c44e9e6d569fc56be00812904767bf5ccd1fc7f"
|
||||
);
|
||||
assert_matches!(decoded.msg, Message::FindNode(FindNode { id, expire: 1136239445 }) if id == expected_id);
|
||||
}
|
||||
|
||||
@@ -987,7 +1001,9 @@ mod tests {
|
||||
// test vector from eip-8: https://eips.ethereum.org/EIPS/eip-8
|
||||
#[test]
|
||||
fn eip8_decode_neighbours() {
|
||||
let neighbours_with_junk = hex!("c679fc8fe0b8b12f06577f2e802d34f6fa257e6137a995f6f4cbfc9ee50ed3710faf6e66f932c4c8d81d64343f429651328758b47d3dbc02c4042f0fff6946a50f4a49037a72bb550f3a7872363a83e1b9ee6469856c24eb4ef80b7535bcf99c0004f9015bf90150f84d846321163782115c82115db8403155e1427f85f10a5c9a7755877748041af1bcd8d474ec065eb33df57a97babf54bfd2103575fa829115d224c523596b401065a97f74010610fce76382c0bf32f84984010203040101b840312c55512422cf9b8a4097e9a6ad79402e87a15ae909a4bfefa22398f03d20951933beea1e4dfa6f968212385e829f04c2d314fc2d4e255e0d3bc08792b069dbf8599020010db83c4d001500000000abcdef12820d05820d05b84038643200b172dcfef857492156971f0e6aa2c538d8b74010f8e140811d53b98c765dd2d96126051913f44582e8c199ad7c6d6819e9a56483f637feaac9448aacf8599020010db885a308d313198a2e037073488203e78203e8b8408dcab8618c3253b558d459da53bd8fa68935a719aff8b811197101a4b2b47dd2d47295286fc00cc081bb542d760717d1bdd6bec2c37cd72eca367d6dd3b9df738443b9a355010203b525a138aa34383fec3d2719a0");
|
||||
let neighbours_with_junk = hex!(
|
||||
"c679fc8fe0b8b12f06577f2e802d34f6fa257e6137a995f6f4cbfc9ee50ed3710faf6e66f932c4c8d81d64343f429651328758b47d3dbc02c4042f0fff6946a50f4a49037a72bb550f3a7872363a83e1b9ee6469856c24eb4ef80b7535bcf99c0004f9015bf90150f84d846321163782115c82115db8403155e1427f85f10a5c9a7755877748041af1bcd8d474ec065eb33df57a97babf54bfd2103575fa829115d224c523596b401065a97f74010610fce76382c0bf32f84984010203040101b840312c55512422cf9b8a4097e9a6ad79402e87a15ae909a4bfefa22398f03d20951933beea1e4dfa6f968212385e829f04c2d314fc2d4e255e0d3bc08792b069dbf8599020010db83c4d001500000000abcdef12820d05820d05b84038643200b172dcfef857492156971f0e6aa2c538d8b74010f8e140811d53b98c765dd2d96126051913f44582e8c199ad7c6d6819e9a56483f637feaac9448aacf8599020010db885a308d313198a2e037073488203e78203e8b8408dcab8618c3253b558d459da53bd8fa68935a719aff8b811197101a4b2b47dd2d47295286fc00cc081bb542d760717d1bdd6bec2c37cd72eca367d6dd3b9df738443b9a355010203b525a138aa34383fec3d2719a0"
|
||||
);
|
||||
|
||||
let buf = neighbours_with_junk.as_slice();
|
||||
let decoded = Message::decode(buf).unwrap();
|
||||
|
||||
@@ -252,7 +252,7 @@ pub async fn create_discv4_with_config(config: Discv4Config) -> (Discv4, Discv4S
|
||||
|
||||
/// Generates a random [`NodeEndpoint`] using the provided random number generator.
|
||||
pub fn rng_endpoint(rng: &mut impl Rng) -> NodeEndpoint {
|
||||
let address = if rng.gen() {
|
||||
let address = if rng.r#gen() {
|
||||
let mut ip = [0u8; 4];
|
||||
rng.fill_bytes(&mut ip);
|
||||
IpAddr::V4(ip.into())
|
||||
@@ -261,7 +261,7 @@ pub fn rng_endpoint(rng: &mut impl Rng) -> NodeEndpoint {
|
||||
rng.fill_bytes(&mut ip);
|
||||
IpAddr::V6(ip.into())
|
||||
};
|
||||
NodeEndpoint { address, tcp_port: rng.gen(), udp_port: rng.gen() }
|
||||
NodeEndpoint { address, tcp_port: rng.r#gen(), udp_port: rng.r#gen() }
|
||||
}
|
||||
|
||||
/// Generates a random [`NodeRecord`] using the provided random number generator.
|
||||
@@ -277,7 +277,7 @@ pub fn rng_ipv6_record(rng: &mut impl RngCore) -> NodeRecord {
|
||||
rng.fill_bytes(&mut ip);
|
||||
let address = IpAddr::V6(ip.into());
|
||||
// TODO(rand)
|
||||
NodeRecord { address, tcp_port: rng.gen(), udp_port: rng.gen(), id: B512::random() }
|
||||
NodeRecord { address, tcp_port: rng.r#gen(), udp_port: rng.r#gen(), id: B512::random() }
|
||||
}
|
||||
|
||||
/// Generates a random IPv4 [`NodeRecord`] using the provided random number generator.
|
||||
@@ -286,7 +286,7 @@ pub fn rng_ipv4_record(rng: &mut impl RngCore) -> NodeRecord {
|
||||
rng.fill_bytes(&mut ip);
|
||||
let address = IpAddr::V4(ip.into());
|
||||
// TODO(rand)
|
||||
NodeRecord { address, tcp_port: rng.gen(), udp_port: rng.gen(), id: B512::random() }
|
||||
NodeRecord { address, tcp_port: rng.r#gen(), udp_port: rng.r#gen(), id: B512::random() }
|
||||
}
|
||||
|
||||
/// Generates a random [`Message`] using the provided random number generator.
|
||||
@@ -295,21 +295,21 @@ pub fn rng_message(rng: &mut impl RngCore) -> Message {
|
||||
1 => Message::Ping(Ping {
|
||||
from: rng_endpoint(rng),
|
||||
to: rng_endpoint(rng),
|
||||
expire: rng.gen(),
|
||||
expire: rng.r#gen(),
|
||||
enr_sq: None,
|
||||
}),
|
||||
2 => Message::Pong(Pong {
|
||||
to: rng_endpoint(rng),
|
||||
echo: B256::random(),
|
||||
expire: rng.gen(),
|
||||
expire: rng.r#gen(),
|
||||
enr_sq: None,
|
||||
}),
|
||||
3 => Message::FindNode(FindNode { id: B512::random(), expire: rng.gen() }),
|
||||
3 => Message::FindNode(FindNode { id: B512::random(), expire: rng.r#gen() }),
|
||||
4 => {
|
||||
let num: usize = rng.gen_range(1..=SAFE_MAX_DATAGRAM_NEIGHBOUR_RECORDS);
|
||||
Message::Neighbours(Neighbours {
|
||||
nodes: std::iter::repeat_with(|| rng_record(rng)).take(num).collect(),
|
||||
expire: rng.gen(),
|
||||
expire: rng.r#gen(),
|
||||
})
|
||||
}
|
||||
_ => unreachable!(),
|
||||
|
||||
@@ -494,12 +494,12 @@ mod test {
|
||||
"enode://ca21ea8f176adb2e229ce2d700830c844af0ea941a1d8152a9513b966fe525e809c3a6c73a2c18a12b74ed6ec4380edf91662778fe0b79f6a591236e49e176f9@184.72.129.189:30301",
|
||||
"enode://acf4507a211ba7c1e52cdf4eef62cdc3c32e7c9c47998954f7ba024026f9a6b2150cd3f0b734d9c78e507ab70d59ba61dfe5c45e1078c7ad0775fb251d7735a2@3.220.145.177:30301",
|
||||
"enode://8a5a5006159bf079d06a04e5eceab2a1ce6e0f721875b2a9c96905336219dbe14203d38f70f3754686a6324f786c2f9852d8c0dd3adac2d080f4db35efc678c5@3.231.11.52:30301",
|
||||
"enode://cdadbe835308ad3557f9a1de8db411da1a260a98f8421d62da90e71da66e55e98aaa8e90aa7ce01b408a54e4bd2253d701218081ded3dbe5efbbc7b41d7cef79@54.198.153.150:30301"
|
||||
"enode://cdadbe835308ad3557f9a1de8db411da1a260a98f8421d62da90e71da66e55e98aaa8e90aa7ce01b408a54e4bd2253d701218081ded3dbe5efbbc7b41d7cef79@54.198.153.150:30301",
|
||||
];
|
||||
|
||||
#[test]
|
||||
fn parse_boot_nodes() {
|
||||
const OP_SEPOLIA_CL_BOOTNODES: &str ="enr:-J64QBwRIWAco7lv6jImSOjPU_W266lHXzpAS5YOh7WmgTyBZkgLgOwo_mxKJq3wz2XRbsoBItbv1dCyjIoNq67mFguGAYrTxM42gmlkgnY0gmlwhBLSsHKHb3BzdGFja4S0lAUAiXNlY3AyNTZrMaEDmoWSi8hcsRpQf2eJsNUx-sqv6fH4btmo2HsAzZFAKnKDdGNwgiQGg3VkcIIkBg,enr:-J64QFa3qMsONLGphfjEkeYyF6Jkil_jCuJmm7_a42ckZeUQGLVzrzstZNb1dgBp1GGx9bzImq5VxJLP-BaptZThGiWGAYrTytOvgmlkgnY0gmlwhGsV-zeHb3BzdGFja4S0lAUAiXNlY3AyNTZrMaEDahfSECTIS_cXyZ8IyNf4leANlZnrsMEWTkEYxf4GMCmDdGNwgiQGg3VkcIIkBg";
|
||||
const OP_SEPOLIA_CL_BOOTNODES: &str = "enr:-J64QBwRIWAco7lv6jImSOjPU_W266lHXzpAS5YOh7WmgTyBZkgLgOwo_mxKJq3wz2XRbsoBItbv1dCyjIoNq67mFguGAYrTxM42gmlkgnY0gmlwhBLSsHKHb3BzdGFja4S0lAUAiXNlY3AyNTZrMaEDmoWSi8hcsRpQf2eJsNUx-sqv6fH4btmo2HsAzZFAKnKDdGNwgiQGg3VkcIIkBg,enr:-J64QFa3qMsONLGphfjEkeYyF6Jkil_jCuJmm7_a42ckZeUQGLVzrzstZNb1dgBp1GGx9bzImq5VxJLP-BaptZThGiWGAYrTytOvgmlkgnY0gmlwhGsV-zeHb3BzdGFja4S0lAUAiXNlY3AyNTZrMaEDahfSECTIS_cXyZ8IyNf4leANlZnrsMEWTkEYxf4GMCmDdGNwgiQGg3VkcIIkBg";
|
||||
|
||||
let config = Config::builder((Ipv4Addr::UNSPECIFIED, 30303).into())
|
||||
.add_cl_serialized_signed_boot_nodes(OP_SEPOLIA_CL_BOOTNODES)
|
||||
|
||||
@@ -83,6 +83,7 @@ impl Discv5 {
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/// Adds the node to the table, if it is not already present.
|
||||
#[expect(clippy::result_large_err)]
|
||||
pub fn add_node(&self, node_record: Enr<SecretKey>) -> Result<(), Error> {
|
||||
let EnrCombinedKeyWrapper(enr) = node_record.into();
|
||||
self.discv5.add_enr(enr).map_err(Error::AddNodeFailed)
|
||||
@@ -378,6 +379,7 @@ impl Discv5 {
|
||||
|
||||
/// Returns the [`ForkId`] of the given [`Enr`](discv5::Enr) w.r.t. the local node's network
|
||||
/// stack, if field is set.
|
||||
#[expect(clippy::result_large_err)]
|
||||
pub fn get_fork_id<K: discv5::enr::EnrKey>(
|
||||
&self,
|
||||
enr: &discv5::enr::Enr<K>,
|
||||
|
||||
@@ -135,11 +135,11 @@ impl<K: EnrKeyUnambiguous> Query<K> {
|
||||
/// Advances the query
|
||||
fn poll(&mut self, cx: &mut Context<'_>) -> Poll<QueryOutcome<K>> {
|
||||
match self {
|
||||
Self::Root(ref mut query) => {
|
||||
Self::Root(query) => {
|
||||
let outcome = ready!(query.as_mut().poll(cx));
|
||||
Poll::Ready(QueryOutcome::Root(outcome))
|
||||
}
|
||||
Self::Entry(ref mut query) => {
|
||||
Self::Entry(query) => {
|
||||
let outcome = ready!(query.as_mut().poll(cx));
|
||||
Poll::Ready(QueryOutcome::Entry(outcome))
|
||||
}
|
||||
|
||||
@@ -282,11 +282,17 @@ mod test {
|
||||
/// No receipts for genesis block
|
||||
const MOCK_RECEIPT_BLOCK_NO_TRANSACTIONS: &[u8] = &hex!("c0");
|
||||
|
||||
const MOCK_RECEIPT_ENCODED_BLOCK_1: &[u8] = &hex!("f901a4f901a1800183031843f90197f89b948ce8c13d816fe6daf12d6fd9e4952e1fc88850aef863a00109fc6f55cf40689f02fbaad7af7fe7bbac8a3d2186600afc7d3e10cac6027ba00000000000000000000000000000000000000000000000000000000000014218a000000000000000000000000070b17c0fe982ab4a7ac17a4c25485643151a1f2da000000000000000000000000000000000000000000000000000000000618d8837f89c948ce8c13d816fe6daf12d6fd9e4952e1fc88850aef884a092e98423f8adac6e64d0608e519fd1cefb861498385c6dee70d58fc926ddc68ba000000000000000000000000000000000000000000000000000000000d0e3ebf0a00000000000000000000000000000000000000000000000000000000000014218a000000000000000000000000070b17c0fe982ab4a7ac17a4c25485643151a1f2d80f85a948ce8c13d816fe6daf12d6fd9e4952e1fc88850aef842a0fe25c73e3b9089fac37d55c4c7efcba6f04af04cebd2fc4d6d7dbb07e1e5234fa000000000000000000000000000000000000000000000007edc6ca0bb683480008001");
|
||||
const MOCK_RECEIPT_ENCODED_BLOCK_1: &[u8] = &hex!(
|
||||
"f901a4f901a1800183031843f90197f89b948ce8c13d816fe6daf12d6fd9e4952e1fc88850aef863a00109fc6f55cf40689f02fbaad7af7fe7bbac8a3d2186600afc7d3e10cac6027ba00000000000000000000000000000000000000000000000000000000000014218a000000000000000000000000070b17c0fe982ab4a7ac17a4c25485643151a1f2da000000000000000000000000000000000000000000000000000000000618d8837f89c948ce8c13d816fe6daf12d6fd9e4952e1fc88850aef884a092e98423f8adac6e64d0608e519fd1cefb861498385c6dee70d58fc926ddc68ba000000000000000000000000000000000000000000000000000000000d0e3ebf0a00000000000000000000000000000000000000000000000000000000000014218a000000000000000000000000070b17c0fe982ab4a7ac17a4c25485643151a1f2d80f85a948ce8c13d816fe6daf12d6fd9e4952e1fc88850aef842a0fe25c73e3b9089fac37d55c4c7efcba6f04af04cebd2fc4d6d7dbb07e1e5234fa000000000000000000000000000000000000000000000007edc6ca0bb683480008001"
|
||||
);
|
||||
|
||||
const MOCK_RECEIPT_ENCODED_BLOCK_2: &[u8] = &hex!("f90106f9010380018301c60df8faf89c948ce8c13d816fe6daf12d6fd9e4952e1fc88850aef884a092e98423f8adac6e64d0608e519fd1cefb861498385c6dee70d58fc926ddc68da000000000000000000000000000000000000000000000000000000000d0ea0e40a00000000000000000000000000000000000000000000000000000000000014218a0000000000000000000000000e5e7492282fd1e3bfac337a0beccd29b15b7b24080f85a948ce8c13d816fe6daf12d6fd9e4952e1fc88850aef842a0fe25c73e3b9089fac37d55c4c7efcba6f04af04cebd2fc4d6d7dbb07e1e5234ea000000000000000000000000000000000000000000000007eda7867e0c7d480008002");
|
||||
const MOCK_RECEIPT_ENCODED_BLOCK_2: &[u8] = &hex!(
|
||||
"f90106f9010380018301c60df8faf89c948ce8c13d816fe6daf12d6fd9e4952e1fc88850aef884a092e98423f8adac6e64d0608e519fd1cefb861498385c6dee70d58fc926ddc68da000000000000000000000000000000000000000000000000000000000d0ea0e40a00000000000000000000000000000000000000000000000000000000000014218a0000000000000000000000000e5e7492282fd1e3bfac337a0beccd29b15b7b24080f85a948ce8c13d816fe6daf12d6fd9e4952e1fc88850aef842a0fe25c73e3b9089fac37d55c4c7efcba6f04af04cebd2fc4d6d7dbb07e1e5234ea000000000000000000000000000000000000000000000007eda7867e0c7d480008002"
|
||||
);
|
||||
|
||||
const MOCK_RECEIPT_ENCODED_BLOCK_3: &[u8] = &hex!("f90106f9010380018301c60df8faf89c948ce8c13d816fe6daf12d6fd9e4952e1fc88850aef884a092e98423f8adac6e64d0608e519fd1cefb861498385c6dee70d58fc926ddc68da000000000000000000000000000000000000000000000000000000000d101e54ba00000000000000000000000000000000000000000000000000000000000014218a0000000000000000000000000fa011d8d6c26f13abe2cefed38226e401b2b8a9980f85a948ce8c13d816fe6daf12d6fd9e4952e1fc88850aef842a0fe25c73e3b9089fac37d55c4c7efcba6f04af04cebd2fc4d6d7dbb07e1e5234ea000000000000000000000000000000000000000000000007ed8842f06277480008003");
|
||||
const MOCK_RECEIPT_ENCODED_BLOCK_3: &[u8] = &hex!(
|
||||
"f90106f9010380018301c60df8faf89c948ce8c13d816fe6daf12d6fd9e4952e1fc88850aef884a092e98423f8adac6e64d0608e519fd1cefb861498385c6dee70d58fc926ddc68da000000000000000000000000000000000000000000000000000000000d101e54ba00000000000000000000000000000000000000000000000000000000000014218a0000000000000000000000000fa011d8d6c26f13abe2cefed38226e401b2b8a9980f85a948ce8c13d816fe6daf12d6fd9e4952e1fc88850aef842a0fe25c73e3b9089fac37d55c4c7efcba6f04af04cebd2fc4d6d7dbb07e1e5234ea000000000000000000000000000000000000000000000007ed8842f06277480008003"
|
||||
);
|
||||
|
||||
fn mock_receipt_1() -> MockReceipt {
|
||||
let receipt = receipt_block_1();
|
||||
|
||||
@@ -532,8 +532,6 @@ impl ECIES {
|
||||
|
||||
/// Write an `ack` message to the given buffer.
|
||||
pub fn write_ack(&mut self, out: &mut BytesMut) {
|
||||
let unencrypted = self.create_ack_unencrypted();
|
||||
|
||||
let mut buf = out.split_off(out.len());
|
||||
|
||||
// reserve space for length
|
||||
@@ -541,7 +539,7 @@ impl ECIES {
|
||||
|
||||
// encrypt and append
|
||||
let mut encrypted = buf.split_off(buf.len());
|
||||
self.encrypt_message(unencrypted.as_ref(), &mut encrypted);
|
||||
self.encrypt_message(self.create_ack_unencrypted().as_ref(), &mut encrypted);
|
||||
let len_bytes = u16::try_from(encrypted.len()).unwrap().to_be_bytes();
|
||||
buf.unsplit(encrypted);
|
||||
|
||||
|
||||
@@ -148,7 +148,10 @@ mod tests {
|
||||
// 0x89 = 0x80 (start of string) + 0x09 (9, length of string)
|
||||
let long_number = hex!("89ffffffffffffffffff");
|
||||
let decode_result = BlockHashOrNumber::decode(&mut &long_number[..]);
|
||||
assert!(decode_result.is_err(), "Decoding a number longer than 64 bits (but not exactly 32 bytes) should not decode successfully");
|
||||
assert!(
|
||||
decode_result.is_err(),
|
||||
"Decoding a number longer than 64 bits (but not exactly 32 bytes) should not decode successfully"
|
||||
);
|
||||
}
|
||||
|
||||
// Test vector from: https://eips.ethereum.org/EIPS/eip-2481
|
||||
@@ -233,7 +236,9 @@ mod tests {
|
||||
#[test]
|
||||
fn encode_block_header() {
|
||||
// [ (f90202) 0x0457 = 1111, [ (f901fc) [ (f901f9) header ] ] ]
|
||||
let expected = hex!("f90202820457f901fcf901f9a00000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000940000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008208ae820d0582115c8215b3821a0a827788a00000000000000000000000000000000000000000000000000000000000000000880000000000000000");
|
||||
let expected = hex!(
|
||||
"f90202820457f901fcf901f9a00000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000940000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008208ae820d0582115c8215b3821a0a827788a00000000000000000000000000000000000000000000000000000000000000000880000000000000000"
|
||||
);
|
||||
let mut data = vec![];
|
||||
RequestPair {
|
||||
request_id: 1111,
|
||||
@@ -269,7 +274,9 @@ mod tests {
|
||||
// Test vector from: https://eips.ethereum.org/EIPS/eip-2481
|
||||
#[test]
|
||||
fn decode_block_header() {
|
||||
let data = hex!("f90202820457f901fcf901f9a00000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000940000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008208ae820d0582115c8215b3821a0a827788a00000000000000000000000000000000000000000000000000000000000000000880000000000000000");
|
||||
let data = hex!(
|
||||
"f90202820457f901fcf901f9a00000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000940000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008208ae820d0582115c8215b3821a0a827788a00000000000000000000000000000000000000000000000000000000000000000880000000000000000"
|
||||
);
|
||||
let expected = RequestPair {
|
||||
request_id: 1111,
|
||||
message: BlockHeaders(vec![
|
||||
@@ -305,7 +312,9 @@ mod tests {
|
||||
// Test vector from: https://eips.ethereum.org/EIPS/eip-2481
|
||||
#[test]
|
||||
fn encode_get_block_bodies() {
|
||||
let expected = hex!("f847820457f842a000000000000000000000000000000000000000000000000000000000deadc0dea000000000000000000000000000000000000000000000000000000000feedbeef");
|
||||
let expected = hex!(
|
||||
"f847820457f842a000000000000000000000000000000000000000000000000000000000deadc0dea000000000000000000000000000000000000000000000000000000000feedbeef"
|
||||
);
|
||||
let mut data = vec![];
|
||||
RequestPair {
|
||||
request_id: 1111,
|
||||
@@ -321,7 +330,9 @@ mod tests {
|
||||
// Test vector from: https://eips.ethereum.org/EIPS/eip-2481
|
||||
#[test]
|
||||
fn decode_get_block_bodies() {
|
||||
let data = hex!("f847820457f842a000000000000000000000000000000000000000000000000000000000deadc0dea000000000000000000000000000000000000000000000000000000000feedbeef");
|
||||
let data = hex!(
|
||||
"f847820457f842a000000000000000000000000000000000000000000000000000000000deadc0dea000000000000000000000000000000000000000000000000000000000feedbeef"
|
||||
);
|
||||
let expected = RequestPair {
|
||||
request_id: 1111,
|
||||
message: GetBlockBodies(vec![
|
||||
@@ -336,7 +347,9 @@ mod tests {
|
||||
// Test vector from: https://eips.ethereum.org/EIPS/eip-2481
|
||||
#[test]
|
||||
fn encode_block_bodies() {
|
||||
let expected = hex!("f902dc820457f902d6f902d3f8d2f867088504a817c8088302e2489435353535353535353535353535353535353535358202008025a064b1702d9298fee62dfeccc57d322a463ad55ca201256d01f62b45b2e1c21c12a064b1702d9298fee62dfeccc57d322a463ad55ca201256d01f62b45b2e1c21c10f867098504a817c809830334509435353535353535353535353535353535353535358202d98025a052f8f61201b2b11a78d6e866abc9c3db2ae8631fa656bfe5cb53668255367afba052f8f61201b2b11a78d6e866abc9c3db2ae8631fa656bfe5cb53668255367afbf901fcf901f9a00000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000940000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008208ae820d0582115c8215b3821a0a827788a00000000000000000000000000000000000000000000000000000000000000000880000000000000000");
|
||||
let expected = hex!(
|
||||
"f902dc820457f902d6f902d3f8d2f867088504a817c8088302e2489435353535353535353535353535353535353535358202008025a064b1702d9298fee62dfeccc57d322a463ad55ca201256d01f62b45b2e1c21c12a064b1702d9298fee62dfeccc57d322a463ad55ca201256d01f62b45b2e1c21c10f867098504a817c809830334509435353535353535353535353535353535353535358202d98025a052f8f61201b2b11a78d6e866abc9c3db2ae8631fa656bfe5cb53668255367afba052f8f61201b2b11a78d6e866abc9c3db2ae8631fa656bfe5cb53668255367afbf901fcf901f9a00000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000940000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008208ae820d0582115c8215b3821a0a827788a00000000000000000000000000000000000000000000000000000000000000000880000000000000000"
|
||||
);
|
||||
let mut data = vec![];
|
||||
let request = RequestPair {
|
||||
request_id: 1111,
|
||||
@@ -408,7 +421,9 @@ mod tests {
|
||||
// Test vector from: https://eips.ethereum.org/EIPS/eip-2481
|
||||
#[test]
|
||||
fn decode_block_bodies() {
|
||||
let data = hex!("f902dc820457f902d6f902d3f8d2f867088504a817c8088302e2489435353535353535353535353535353535353535358202008025a064b1702d9298fee62dfeccc57d322a463ad55ca201256d01f62b45b2e1c21c12a064b1702d9298fee62dfeccc57d322a463ad55ca201256d01f62b45b2e1c21c10f867098504a817c809830334509435353535353535353535353535353535353535358202d98025a052f8f61201b2b11a78d6e866abc9c3db2ae8631fa656bfe5cb53668255367afba052f8f61201b2b11a78d6e866abc9c3db2ae8631fa656bfe5cb53668255367afbf901fcf901f9a00000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000940000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008208ae820d0582115c8215b3821a0a827788a00000000000000000000000000000000000000000000000000000000000000000880000000000000000");
|
||||
let data = hex!(
|
||||
"f902dc820457f902d6f902d3f8d2f867088504a817c8088302e2489435353535353535353535353535353535353535358202008025a064b1702d9298fee62dfeccc57d322a463ad55ca201256d01f62b45b2e1c21c12a064b1702d9298fee62dfeccc57d322a463ad55ca201256d01f62b45b2e1c21c10f867098504a817c809830334509435353535353535353535353535353535353535358202d98025a052f8f61201b2b11a78d6e866abc9c3db2ae8631fa656bfe5cb53668255367afba052f8f61201b2b11a78d6e866abc9c3db2ae8631fa656bfe5cb53668255367afbf901fcf901f9a00000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000940000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008208ae820d0582115c8215b3821a0a827788a00000000000000000000000000000000000000000000000000000000000000000880000000000000000"
|
||||
);
|
||||
let expected = RequestPair {
|
||||
request_id: 1111,
|
||||
message: BlockBodies(vec![
|
||||
|
||||
@@ -805,115 +805,133 @@ mod tests {
|
||||
fn eth_68_tx_hash_roundtrip() {
|
||||
let vectors = vec![
|
||||
(
|
||||
NewPooledTransactionHashes68 { types: vec![], sizes: vec![], hashes: vec![] },
|
||||
&hex!("c380c0c0")[..],
|
||||
NewPooledTransactionHashes68 { types: vec![], sizes: vec![], hashes: vec![] },
|
||||
&hex!("c380c0c0")[..],
|
||||
),
|
||||
(
|
||||
NewPooledTransactionHashes68 {
|
||||
types: vec![0x00],
|
||||
sizes: vec![0x00],
|
||||
hashes: vec![B256::from_str(
|
||||
"0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
)
|
||||
.unwrap()],
|
||||
},
|
||||
&hex!("e500c180e1a00000000000000000000000000000000000000000000000000000000000000000")[..],
|
||||
NewPooledTransactionHashes68 {
|
||||
types: vec![0x00],
|
||||
sizes: vec![0x00],
|
||||
hashes: vec![
|
||||
B256::from_str(
|
||||
"0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
)
|
||||
.unwrap(),
|
||||
],
|
||||
},
|
||||
&hex!(
|
||||
"e500c180e1a00000000000000000000000000000000000000000000000000000000000000000"
|
||||
)[..],
|
||||
),
|
||||
(
|
||||
NewPooledTransactionHashes68 {
|
||||
types: vec![0x00, 0x00],
|
||||
sizes: vec![0x00, 0x00],
|
||||
hashes: vec![
|
||||
B256::from_str(
|
||||
"0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
)
|
||||
.unwrap(),
|
||||
B256::from_str(
|
||||
"0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
)
|
||||
.unwrap(),
|
||||
],
|
||||
},
|
||||
&hex!("f84a820000c28080f842a00000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000")[..],
|
||||
NewPooledTransactionHashes68 {
|
||||
types: vec![0x00, 0x00],
|
||||
sizes: vec![0x00, 0x00],
|
||||
hashes: vec![
|
||||
B256::from_str(
|
||||
"0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
)
|
||||
.unwrap(),
|
||||
B256::from_str(
|
||||
"0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
)
|
||||
.unwrap(),
|
||||
],
|
||||
},
|
||||
&hex!(
|
||||
"f84a820000c28080f842a00000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000"
|
||||
)[..],
|
||||
),
|
||||
(
|
||||
NewPooledTransactionHashes68 {
|
||||
types: vec![0x02],
|
||||
sizes: vec![0xb6],
|
||||
hashes: vec![B256::from_str(
|
||||
"0xfecbed04c7b88d8e7221a0a3f5dc33f220212347fc167459ea5cc9c3eb4c1124",
|
||||
)
|
||||
.unwrap()],
|
||||
},
|
||||
&hex!("e602c281b6e1a0fecbed04c7b88d8e7221a0a3f5dc33f220212347fc167459ea5cc9c3eb4c1124")[..],
|
||||
NewPooledTransactionHashes68 {
|
||||
types: vec![0x02],
|
||||
sizes: vec![0xb6],
|
||||
hashes: vec![
|
||||
B256::from_str(
|
||||
"0xfecbed04c7b88d8e7221a0a3f5dc33f220212347fc167459ea5cc9c3eb4c1124",
|
||||
)
|
||||
.unwrap(),
|
||||
],
|
||||
},
|
||||
&hex!(
|
||||
"e602c281b6e1a0fecbed04c7b88d8e7221a0a3f5dc33f220212347fc167459ea5cc9c3eb4c1124"
|
||||
)[..],
|
||||
),
|
||||
(
|
||||
NewPooledTransactionHashes68 {
|
||||
types: vec![0xff, 0xff],
|
||||
sizes: vec![0xffffffff, 0xffffffff],
|
||||
hashes: vec![
|
||||
B256::from_str(
|
||||
"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
||||
)
|
||||
.unwrap(),
|
||||
B256::from_str(
|
||||
"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
||||
)
|
||||
.unwrap(),
|
||||
],
|
||||
},
|
||||
&hex!("f85282ffffca84ffffffff84fffffffff842a0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")[..],
|
||||
NewPooledTransactionHashes68 {
|
||||
types: vec![0xff, 0xff],
|
||||
sizes: vec![0xffffffff, 0xffffffff],
|
||||
hashes: vec![
|
||||
B256::from_str(
|
||||
"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
||||
)
|
||||
.unwrap(),
|
||||
B256::from_str(
|
||||
"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
||||
)
|
||||
.unwrap(),
|
||||
],
|
||||
},
|
||||
&hex!(
|
||||
"f85282ffffca84ffffffff84fffffffff842a0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
||||
)[..],
|
||||
),
|
||||
(
|
||||
NewPooledTransactionHashes68 {
|
||||
types: vec![0xff, 0xff],
|
||||
sizes: vec![0xffffffff, 0xffffffff],
|
||||
hashes: vec![
|
||||
B256::from_str(
|
||||
"0xbeefcafebeefcafebeefcafebeefcafebeefcafebeefcafebeefcafebeefcafe",
|
||||
)
|
||||
.unwrap(),
|
||||
B256::from_str(
|
||||
"0xbeefcafebeefcafebeefcafebeefcafebeefcafebeefcafebeefcafebeefcafe",
|
||||
)
|
||||
.unwrap(),
|
||||
],
|
||||
},
|
||||
&hex!("f85282ffffca84ffffffff84fffffffff842a0beefcafebeefcafebeefcafebeefcafebeefcafebeefcafebeefcafebeefcafea0beefcafebeefcafebeefcafebeefcafebeefcafebeefcafebeefcafebeefcafe")[..],
|
||||
NewPooledTransactionHashes68 {
|
||||
types: vec![0xff, 0xff],
|
||||
sizes: vec![0xffffffff, 0xffffffff],
|
||||
hashes: vec![
|
||||
B256::from_str(
|
||||
"0xbeefcafebeefcafebeefcafebeefcafebeefcafebeefcafebeefcafebeefcafe",
|
||||
)
|
||||
.unwrap(),
|
||||
B256::from_str(
|
||||
"0xbeefcafebeefcafebeefcafebeefcafebeefcafebeefcafebeefcafebeefcafe",
|
||||
)
|
||||
.unwrap(),
|
||||
],
|
||||
},
|
||||
&hex!(
|
||||
"f85282ffffca84ffffffff84fffffffff842a0beefcafebeefcafebeefcafebeefcafebeefcafebeefcafebeefcafebeefcafea0beefcafebeefcafebeefcafebeefcafebeefcafebeefcafebeefcafebeefcafe"
|
||||
)[..],
|
||||
),
|
||||
(
|
||||
NewPooledTransactionHashes68 {
|
||||
types: vec![0x10, 0x10],
|
||||
sizes: vec![0xdeadc0de, 0xdeadc0de],
|
||||
hashes: vec![
|
||||
B256::from_str(
|
||||
"0x3b9aca00f0671c9a2a1b817a0a78d3fe0c0f776cccb2a8c3c1b412a4f4e4d4e2",
|
||||
)
|
||||
.unwrap(),
|
||||
B256::from_str(
|
||||
"0x3b9aca00f0671c9a2a1b817a0a78d3fe0c0f776cccb2a8c3c1b412a4f4e4d4e2",
|
||||
)
|
||||
.unwrap(),
|
||||
],
|
||||
},
|
||||
&hex!("f852821010ca84deadc0de84deadc0def842a03b9aca00f0671c9a2a1b817a0a78d3fe0c0f776cccb2a8c3c1b412a4f4e4d4e2a03b9aca00f0671c9a2a1b817a0a78d3fe0c0f776cccb2a8c3c1b412a4f4e4d4e2")[..],
|
||||
NewPooledTransactionHashes68 {
|
||||
types: vec![0x10, 0x10],
|
||||
sizes: vec![0xdeadc0de, 0xdeadc0de],
|
||||
hashes: vec![
|
||||
B256::from_str(
|
||||
"0x3b9aca00f0671c9a2a1b817a0a78d3fe0c0f776cccb2a8c3c1b412a4f4e4d4e2",
|
||||
)
|
||||
.unwrap(),
|
||||
B256::from_str(
|
||||
"0x3b9aca00f0671c9a2a1b817a0a78d3fe0c0f776cccb2a8c3c1b412a4f4e4d4e2",
|
||||
)
|
||||
.unwrap(),
|
||||
],
|
||||
},
|
||||
&hex!(
|
||||
"f852821010ca84deadc0de84deadc0def842a03b9aca00f0671c9a2a1b817a0a78d3fe0c0f776cccb2a8c3c1b412a4f4e4d4e2a03b9aca00f0671c9a2a1b817a0a78d3fe0c0f776cccb2a8c3c1b412a4f4e4d4e2"
|
||||
)[..],
|
||||
),
|
||||
(
|
||||
NewPooledTransactionHashes68 {
|
||||
types: vec![0x6f, 0x6f],
|
||||
sizes: vec![0x7fffffff, 0x7fffffff],
|
||||
hashes: vec![
|
||||
B256::from_str(
|
||||
"0x0000000000000000000000000000000000000000000000000000000000000002",
|
||||
)
|
||||
.unwrap(),
|
||||
B256::from_str(
|
||||
"0x0000000000000000000000000000000000000000000000000000000000000002",
|
||||
)
|
||||
.unwrap(),
|
||||
],
|
||||
},
|
||||
&hex!("f852826f6fca847fffffff847ffffffff842a00000000000000000000000000000000000000000000000000000000000000002a00000000000000000000000000000000000000000000000000000000000000002")[..],
|
||||
NewPooledTransactionHashes68 {
|
||||
types: vec![0x6f, 0x6f],
|
||||
sizes: vec![0x7fffffff, 0x7fffffff],
|
||||
hashes: vec![
|
||||
B256::from_str(
|
||||
"0x0000000000000000000000000000000000000000000000000000000000000002",
|
||||
)
|
||||
.unwrap(),
|
||||
B256::from_str(
|
||||
"0x0000000000000000000000000000000000000000000000000000000000000002",
|
||||
)
|
||||
.unwrap(),
|
||||
],
|
||||
},
|
||||
&hex!(
|
||||
"f852826f6fca847fffffff847ffffffff842a00000000000000000000000000000000000000000000000000000000000000002a00000000000000000000000000000000000000000000000000000000000000002"
|
||||
)[..],
|
||||
),
|
||||
];
|
||||
|
||||
|
||||
@@ -95,7 +95,9 @@ mod tests {
|
||||
// Test vector from: https://eips.ethereum.org/EIPS/eip-2481
|
||||
#[test]
|
||||
fn test_encode_block_header() {
|
||||
let expected = hex!("f901f9a00000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000940000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008208ae820d0582115c8215b3821a0a827788a00000000000000000000000000000000000000000000000000000000000000000880000000000000000");
|
||||
let expected = hex!(
|
||||
"f901f9a00000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000940000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008208ae820d0582115c8215b3821a0a827788a00000000000000000000000000000000000000000000000000000000000000000880000000000000000"
|
||||
);
|
||||
let header = Header {
|
||||
difficulty: U256::from(0x8ae_u64),
|
||||
number: 0xd05_u64,
|
||||
@@ -125,10 +127,18 @@ mod tests {
|
||||
parent_hash: b256!("0xe0a94a7a3c9617401586b1a27025d2d9671332d22d540e0af72b069170380f2a"),
|
||||
ommers_hash: EMPTY_OMMER_ROOT_HASH,
|
||||
beneficiary: address!("0xba5e000000000000000000000000000000000000"),
|
||||
state_root: b256!("0xec3c94b18b8a1cff7d60f8d258ec723312932928626b4c9355eb4ab3568ec7f7"),
|
||||
transactions_root: b256!("0x50f738580ed699f0469702c7ccc63ed2e51bc034be9479b7bff4e68dee84accf"),
|
||||
receipts_root: b256!("0x29b0562f7140574dd0d50dee8a271b22e1a0a7b78fca58f7c60370d8317ba2a9"),
|
||||
logs_bloom: bloom!("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"),
|
||||
state_root: b256!(
|
||||
"0xec3c94b18b8a1cff7d60f8d258ec723312932928626b4c9355eb4ab3568ec7f7"
|
||||
),
|
||||
transactions_root: b256!(
|
||||
"0x50f738580ed699f0469702c7ccc63ed2e51bc034be9479b7bff4e68dee84accf"
|
||||
),
|
||||
receipts_root: b256!(
|
||||
"0x29b0562f7140574dd0d50dee8a271b22e1a0a7b78fca58f7c60370d8317ba2a9"
|
||||
),
|
||||
logs_bloom: bloom!(
|
||||
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
||||
),
|
||||
difficulty: U256::from(0x020000),
|
||||
number: 0x01_u64,
|
||||
gas_limit: 0x016345785d8a0000,
|
||||
@@ -150,7 +160,9 @@ mod tests {
|
||||
// Test vector from: https://eips.ethereum.org/EIPS/eip-2481
|
||||
#[test]
|
||||
fn test_decode_block_header() {
|
||||
let data = hex!("f901f9a00000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000940000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008208ae820d0582115c8215b3821a0a827788a00000000000000000000000000000000000000000000000000000000000000000880000000000000000");
|
||||
let data = hex!(
|
||||
"f901f9a00000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000940000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008208ae820d0582115c8215b3821a0a827788a00000000000000000000000000000000000000000000000000000000000000000880000000000000000"
|
||||
);
|
||||
let expected = Header {
|
||||
difficulty: U256::from(0x8aeu64),
|
||||
number: 0xd05u64,
|
||||
@@ -177,7 +189,9 @@ mod tests {
|
||||
// Test vector from: https://github.com/ethereum/tests/blob/970503935aeb76f59adfa3b3224aabf25e77b83d/BlockchainTests/ValidBlocks/bcExample/shanghaiExample.json#L15-L34
|
||||
#[test]
|
||||
fn test_decode_block_header_with_withdrawals() {
|
||||
let data = hex!("f9021ca018db39e19931515b30b16b3a92c292398039e31d6c267111529c3f2ba0a26c17a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347942adc25665018aa1fe0e6bc666dac8fc2697ff9baa095efce3d6972874ca8b531b233b7a1d1ff0a56f08b20c8f1b89bef1b001194a5a071e515dd89e8a7973402c2e11646081b4e2209b2d3a1550df5095289dabcb3fba0ed9c51ea52c968e552e370a77a41dac98606e98b915092fb5f949d6452fce1c4b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008001887fffffffffffffff830125b882079e42a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b42188000000000000000009a027f166f1d7c789251299535cb176ba34116e44894476a7886fe5d73d9be5c973");
|
||||
let data = hex!(
|
||||
"f9021ca018db39e19931515b30b16b3a92c292398039e31d6c267111529c3f2ba0a26c17a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347942adc25665018aa1fe0e6bc666dac8fc2697ff9baa095efce3d6972874ca8b531b233b7a1d1ff0a56f08b20c8f1b89bef1b001194a5a071e515dd89e8a7973402c2e11646081b4e2209b2d3a1550df5095289dabcb3fba0ed9c51ea52c968e552e370a77a41dac98606e98b915092fb5f949d6452fce1c4b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008001887fffffffffffffff830125b882079e42a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b42188000000000000000009a027f166f1d7c789251299535cb176ba34116e44894476a7886fe5d73d9be5c973"
|
||||
);
|
||||
let expected = Header {
|
||||
parent_hash: B256::from_str(
|
||||
"18db39e19931515b30b16b3a92c292398039e31d6c267111529c3f2ba0a26c17",
|
||||
@@ -221,7 +235,9 @@ mod tests {
|
||||
// Test vector from: https://github.com/ethereum/tests/blob/7e9e0940c0fcdbead8af3078ede70f969109bd85/BlockchainTests/ValidBlocks/bcExample/cancunExample.json
|
||||
#[test]
|
||||
fn test_decode_block_header_with_blob_fields_ef_tests() {
|
||||
let data = hex!("f90221a03a9b485972e7353edd9152712492f0c58d89ef80623686b6bf947a4a6dce6cb6a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347942adc25665018aa1fe0e6bc666dac8fc2697ff9baa03c837fc158e3e93eafcaf2e658a02f5d8f99abc9f1c4c66cdea96c0ca26406aea04409cc4b699384ba5f8248d92b784713610c5ff9c1de51e9239da0dac76de9cea046cab26abf1047b5b119ecc2dda1296b071766c8b1307e1381fcecc90d513d86b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008001887fffffffffffffff8302a86582079e42a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b42188000000000000000009a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b4218302000080");
|
||||
let data = hex!(
|
||||
"f90221a03a9b485972e7353edd9152712492f0c58d89ef80623686b6bf947a4a6dce6cb6a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347942adc25665018aa1fe0e6bc666dac8fc2697ff9baa03c837fc158e3e93eafcaf2e658a02f5d8f99abc9f1c4c66cdea96c0ca26406aea04409cc4b699384ba5f8248d92b784713610c5ff9c1de51e9239da0dac76de9cea046cab26abf1047b5b119ecc2dda1296b071766c8b1307e1381fcecc90d513d86b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008001887fffffffffffffff8302a86582079e42a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b42188000000000000000009a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b4218302000080"
|
||||
);
|
||||
let expected = Header {
|
||||
parent_hash: B256::from_str(
|
||||
"3a9b485972e7353edd9152712492f0c58d89ef80623686b6bf947a4a6dce6cb6",
|
||||
@@ -270,7 +286,9 @@ mod tests {
|
||||
#[test]
|
||||
fn test_decode_block_header_with_blob_fields() {
|
||||
// Block from devnet-7
|
||||
let data = hex!("f90239a013a7ec98912f917b3e804654e37c9866092043c13eb8eab94eb64818e886cff5a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d4934794f97e180c050e5ab072211ad2c213eb5aee4df134a0ec229dbe85b0d3643ad0f471e6ec1a36bbc87deffbbd970762d22a53b35d068aa056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b901000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080830305988401c9c380808464c40d5499d883010c01846765746888676f312e32302e35856c696e7578a070ccadc40b16e2094954b1064749cc6fbac783c1712f1b271a8aac3eda2f232588000000000000000007a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421808401600000");
|
||||
let data = hex!(
|
||||
"f90239a013a7ec98912f917b3e804654e37c9866092043c13eb8eab94eb64818e886cff5a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d4934794f97e180c050e5ab072211ad2c213eb5aee4df134a0ec229dbe85b0d3643ad0f471e6ec1a36bbc87deffbbd970762d22a53b35d068aa056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b901000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080830305988401c9c380808464c40d5499d883010c01846765746888676f312e32302e35856c696e7578a070ccadc40b16e2094954b1064749cc6fbac783c1712f1b271a8aac3eda2f232588000000000000000007a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421808401600000"
|
||||
);
|
||||
let expected = Header {
|
||||
parent_hash: B256::from_str(
|
||||
"13a7ec98912f917b3e804654e37c9866092043c13eb8eab94eb64818e886cff5",
|
||||
|
||||
@@ -73,7 +73,9 @@ mod tests {
|
||||
#[test]
|
||||
// Test vector from: https://eips.ethereum.org/EIPS/eip-2481
|
||||
fn encode_get_receipts() {
|
||||
let expected = hex!("f847820457f842a000000000000000000000000000000000000000000000000000000000deadc0dea000000000000000000000000000000000000000000000000000000000feedbeef");
|
||||
let expected = hex!(
|
||||
"f847820457f842a000000000000000000000000000000000000000000000000000000000deadc0dea000000000000000000000000000000000000000000000000000000000feedbeef"
|
||||
);
|
||||
let mut data = vec![];
|
||||
let request = RequestPair {
|
||||
request_id: 1111,
|
||||
@@ -89,7 +91,9 @@ mod tests {
|
||||
#[test]
|
||||
// Test vector from: https://eips.ethereum.org/EIPS/eip-2481
|
||||
fn decode_get_receipts() {
|
||||
let data = hex!("f847820457f842a000000000000000000000000000000000000000000000000000000000deadc0dea000000000000000000000000000000000000000000000000000000000feedbeef");
|
||||
let data = hex!(
|
||||
"f847820457f842a000000000000000000000000000000000000000000000000000000000deadc0dea000000000000000000000000000000000000000000000000000000000feedbeef"
|
||||
);
|
||||
let request = RequestPair::<GetReceipts>::decode(&mut &data[..]).unwrap();
|
||||
assert_eq!(
|
||||
request,
|
||||
@@ -106,7 +110,9 @@ mod tests {
|
||||
// Test vector from: https://eips.ethereum.org/EIPS/eip-2481
|
||||
#[test]
|
||||
fn encode_receipts() {
|
||||
let expected = hex!("f90172820457f9016cf90169f901668001b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f85ff85d940000000000000000000000000000000000000011f842a0000000000000000000000000000000000000000000000000000000000000deada0000000000000000000000000000000000000000000000000000000000000beef830100ff");
|
||||
let expected = hex!(
|
||||
"f90172820457f9016cf90169f901668001b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f85ff85d940000000000000000000000000000000000000011f842a0000000000000000000000000000000000000000000000000000000000000deada0000000000000000000000000000000000000000000000000000000000000beef830100ff"
|
||||
);
|
||||
let mut data = vec![];
|
||||
let request = RequestPair {
|
||||
request_id: 1111,
|
||||
@@ -138,7 +144,9 @@ mod tests {
|
||||
// Test vector from: https://eips.ethereum.org/EIPS/eip-2481
|
||||
#[test]
|
||||
fn decode_receipts() {
|
||||
let data = hex!("f90172820457f9016cf90169f901668001b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f85ff85d940000000000000000000000000000000000000011f842a0000000000000000000000000000000000000000000000000000000000000deada0000000000000000000000000000000000000000000000000000000000000beef830100ff");
|
||||
let data = hex!(
|
||||
"f90172820457f9016cf90169f901668001b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f85ff85d940000000000000000000000000000000000000011f842a0000000000000000000000000000000000000000000000000000000000000deada0000000000000000000000000000000000000000000000000000000000000beef830100ff"
|
||||
);
|
||||
let request = RequestPair::<Receipts>::decode(&mut &data[..]).unwrap();
|
||||
assert_eq!(
|
||||
request,
|
||||
|
||||
@@ -35,7 +35,9 @@ mod tests {
|
||||
#[test]
|
||||
// Test vector from: https://eips.ethereum.org/EIPS/eip-2481
|
||||
fn encode_get_node_data() {
|
||||
let expected = hex!("f847820457f842a000000000000000000000000000000000000000000000000000000000deadc0dea000000000000000000000000000000000000000000000000000000000feedbeef");
|
||||
let expected = hex!(
|
||||
"f847820457f842a000000000000000000000000000000000000000000000000000000000deadc0dea000000000000000000000000000000000000000000000000000000000feedbeef"
|
||||
);
|
||||
let mut data = vec![];
|
||||
let request = RequestPair {
|
||||
request_id: 1111,
|
||||
@@ -51,7 +53,9 @@ mod tests {
|
||||
#[test]
|
||||
// Test vector from: https://eips.ethereum.org/EIPS/eip-2481
|
||||
fn decode_get_node_data() {
|
||||
let data = hex!("f847820457f842a000000000000000000000000000000000000000000000000000000000deadc0dea000000000000000000000000000000000000000000000000000000000feedbeef");
|
||||
let data = hex!(
|
||||
"f847820457f842a000000000000000000000000000000000000000000000000000000000deadc0dea000000000000000000000000000000000000000000000000000000000feedbeef"
|
||||
);
|
||||
let request = RequestPair::<GetNodeData>::decode(&mut &data[..]).unwrap();
|
||||
assert_eq!(
|
||||
request,
|
||||
|
||||
@@ -273,21 +273,13 @@ impl Debug for StatusEth69 {
|
||||
write!(
|
||||
f,
|
||||
"Status {{\n\tversion: {:?},\n\tchain: {:?},\n\tblockhash: {},\n\tgenesis: {},\n\tforkid: {:X?}\n}}",
|
||||
self.version,
|
||||
self.chain,
|
||||
hexed_blockhash,
|
||||
hexed_genesis,
|
||||
self.forkid
|
||||
self.version, self.chain, hexed_blockhash, hexed_genesis, self.forkid
|
||||
)
|
||||
} else {
|
||||
write!(
|
||||
f,
|
||||
"Status {{ version: {:?}, chain: {:?}, blockhash: {}, genesis: {}, forkid: {:X?} }}",
|
||||
self.version,
|
||||
self.chain,
|
||||
hexed_blockhash,
|
||||
hexed_genesis,
|
||||
self.forkid
|
||||
self.version, self.chain, hexed_blockhash, hexed_genesis, self.forkid
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -399,7 +391,9 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn encode_eth_status_message() {
|
||||
let expected = hex!("f85643018a07aac59dabcdd74bc567a0feb27336ca7923f8fab3bd617fcb6e75841538f71c1bcfc267d7838489d9e13da0d4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3c684b715077d80");
|
||||
let expected = hex!(
|
||||
"f85643018a07aac59dabcdd74bc567a0feb27336ca7923f8fab3bd617fcb6e75841538f71c1bcfc267d7838489d9e13da0d4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3c684b715077d80"
|
||||
);
|
||||
let status = Status {
|
||||
version: EthVersion::Eth67,
|
||||
chain: Chain::from_named(NamedChain::Mainnet),
|
||||
@@ -419,7 +413,9 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn decode_eth_status_message() {
|
||||
let data = hex!("f85643018a07aac59dabcdd74bc567a0feb27336ca7923f8fab3bd617fcb6e75841538f71c1bcfc267d7838489d9e13da0d4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3c684b715077d80");
|
||||
let data = hex!(
|
||||
"f85643018a07aac59dabcdd74bc567a0feb27336ca7923f8fab3bd617fcb6e75841538f71c1bcfc267d7838489d9e13da0d4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3c684b715077d80"
|
||||
);
|
||||
let expected = Status {
|
||||
version: EthVersion::Eth67,
|
||||
chain: Chain::from_named(NamedChain::Mainnet),
|
||||
@@ -464,7 +460,9 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn encode_eth69_status_message() {
|
||||
let expected = hex!("f84b4501a0feb27336ca7923f8fab3bd617fcb6e75841538f71c1bcfc267d7838489d9e13da0d4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3c684b715077d80");
|
||||
let expected = hex!(
|
||||
"f84b4501a0feb27336ca7923f8fab3bd617fcb6e75841538f71c1bcfc267d7838489d9e13da0d4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3c684b715077d80"
|
||||
);
|
||||
let status = StatusEth69 {
|
||||
version: EthVersion::Eth69,
|
||||
chain: Chain::from_named(NamedChain::Mainnet),
|
||||
@@ -497,7 +495,9 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn decode_eth69_status_message() {
|
||||
let data = hex!("0xf84b4501a0feb27336ca7923f8fab3bd617fcb6e75841538f71c1bcfc267d7838489d9e13da0d4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3c684b715077d80");
|
||||
let data = hex!(
|
||||
"0xf84b4501a0feb27336ca7923f8fab3bd617fcb6e75841538f71c1bcfc267d7838489d9e13da0d4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3c684b715077d80"
|
||||
);
|
||||
let expected = StatusEth69 {
|
||||
version: EthVersion::Eth69,
|
||||
chain: Chain::from_named(NamedChain::Mainnet),
|
||||
@@ -514,7 +514,9 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn encode_network_status_message() {
|
||||
let expected = hex!("f850423884024190faa0f8514c4680ef27700751b08f37645309ce65a449616a3ea966bf39dd935bb27ba00d21840abff46b96c84b2ac9e10e4f5cdaeb5693cb665db62a2f3b02d2d57b5bc6845d43d2fd80");
|
||||
let expected = hex!(
|
||||
"f850423884024190faa0f8514c4680ef27700751b08f37645309ce65a449616a3ea966bf39dd935bb27ba00d21840abff46b96c84b2ac9e10e4f5cdaeb5693cb665db62a2f3b02d2d57b5bc6845d43d2fd80"
|
||||
);
|
||||
let status = Status {
|
||||
version: EthVersion::Eth66,
|
||||
chain: Chain::from_named(NamedChain::BinanceSmartChain),
|
||||
@@ -537,7 +539,9 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn decode_network_status_message() {
|
||||
let data = hex!("f850423884024190faa0f8514c4680ef27700751b08f37645309ce65a449616a3ea966bf39dd935bb27ba00d21840abff46b96c84b2ac9e10e4f5cdaeb5693cb665db62a2f3b02d2d57b5bc6845d43d2fd80");
|
||||
let data = hex!(
|
||||
"f850423884024190faa0f8514c4680ef27700751b08f37645309ce65a449616a3ea966bf39dd935bb27ba00d21840abff46b96c84b2ac9e10e4f5cdaeb5693cb665db62a2f3b02d2d57b5bc6845d43d2fd80"
|
||||
);
|
||||
let expected = Status {
|
||||
version: EthVersion::Eth66,
|
||||
chain: Chain::from_named(NamedChain::BinanceSmartChain),
|
||||
@@ -558,7 +562,9 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn decode_another_network_status_message() {
|
||||
let data = hex!("f86142820834936d68fcffffffffffffffffffffffffdeab81b8a0523e8163a6d620a4cc152c547a05f28a03fec91a2a615194cb86df9731372c0ca06499dccdc7c7def3ebb1ce4c6ee27ec6bd02aee570625ca391919faf77ef27bdc6841a67ccd880");
|
||||
let data = hex!(
|
||||
"f86142820834936d68fcffffffffffffffffffffffffdeab81b8a0523e8163a6d620a4cc152c547a05f28a03fec91a2a615194cb86df9731372c0ca06499dccdc7c7def3ebb1ce4c6ee27ec6bd02aee570625ca391919faf77ef27bdc6841a67ccd880"
|
||||
);
|
||||
let expected = Status {
|
||||
version: EthVersion::Eth66,
|
||||
chain: Chain::from_id(2100),
|
||||
|
||||
@@ -95,7 +95,9 @@ mod tests {
|
||||
#[test]
|
||||
// Test vector from: https://eips.ethereum.org/EIPS/eip-2481
|
||||
fn encode_get_pooled_transactions() {
|
||||
let expected = hex!("f847820457f842a000000000000000000000000000000000000000000000000000000000deadc0dea000000000000000000000000000000000000000000000000000000000feedbeef");
|
||||
let expected = hex!(
|
||||
"f847820457f842a000000000000000000000000000000000000000000000000000000000deadc0dea000000000000000000000000000000000000000000000000000000000feedbeef"
|
||||
);
|
||||
let mut data = vec![];
|
||||
let request = RequestPair {
|
||||
request_id: 1111,
|
||||
@@ -111,7 +113,9 @@ mod tests {
|
||||
#[test]
|
||||
// Test vector from: https://eips.ethereum.org/EIPS/eip-2481
|
||||
fn decode_get_pooled_transactions() {
|
||||
let data = hex!("f847820457f842a000000000000000000000000000000000000000000000000000000000deadc0dea000000000000000000000000000000000000000000000000000000000feedbeef");
|
||||
let data = hex!(
|
||||
"f847820457f842a000000000000000000000000000000000000000000000000000000000deadc0dea000000000000000000000000000000000000000000000000000000000feedbeef"
|
||||
);
|
||||
let request = RequestPair::<GetPooledTransactions>::decode(&mut &data[..]).unwrap();
|
||||
assert_eq!(
|
||||
request,
|
||||
@@ -128,7 +132,9 @@ mod tests {
|
||||
#[test]
|
||||
// Test vector from: https://eips.ethereum.org/EIPS/eip-2481
|
||||
fn encode_pooled_transactions() {
|
||||
let expected = hex!("f8d7820457f8d2f867088504a817c8088302e2489435353535353535353535353535353535353535358202008025a064b1702d9298fee62dfeccc57d322a463ad55ca201256d01f62b45b2e1c21c12a064b1702d9298fee62dfeccc57d322a463ad55ca201256d01f62b45b2e1c21c10f867098504a817c809830334509435353535353535353535353535353535353535358202d98025a052f8f61201b2b11a78d6e866abc9c3db2ae8631fa656bfe5cb53668255367afba052f8f61201b2b11a78d6e866abc9c3db2ae8631fa656bfe5cb53668255367afb");
|
||||
let expected = hex!(
|
||||
"f8d7820457f8d2f867088504a817c8088302e2489435353535353535353535353535353535353535358202008025a064b1702d9298fee62dfeccc57d322a463ad55ca201256d01f62b45b2e1c21c12a064b1702d9298fee62dfeccc57d322a463ad55ca201256d01f62b45b2e1c21c10f867098504a817c809830334509435353535353535353535353535353535353535358202d98025a052f8f61201b2b11a78d6e866abc9c3db2ae8631fa656bfe5cb53668255367afba052f8f61201b2b11a78d6e866abc9c3db2ae8631fa656bfe5cb53668255367afb"
|
||||
);
|
||||
let mut data = vec![];
|
||||
let txs = vec![
|
||||
TransactionSigned::new_unhashed(
|
||||
@@ -195,7 +201,9 @@ mod tests {
|
||||
#[test]
|
||||
// Test vector from: https://eips.ethereum.org/EIPS/eip-2481
|
||||
fn decode_pooled_transactions() {
|
||||
let data = hex!("f8d7820457f8d2f867088504a817c8088302e2489435353535353535353535353535353535353535358202008025a064b1702d9298fee62dfeccc57d322a463ad55ca201256d01f62b45b2e1c21c12a064b1702d9298fee62dfeccc57d322a463ad55ca201256d01f62b45b2e1c21c10f867098504a817c809830334509435353535353535353535353535353535353535358202d98025a052f8f61201b2b11a78d6e866abc9c3db2ae8631fa656bfe5cb53668255367afba052f8f61201b2b11a78d6e866abc9c3db2ae8631fa656bfe5cb53668255367afb");
|
||||
let data = hex!(
|
||||
"f8d7820457f8d2f867088504a817c8088302e2489435353535353535353535353535353535353535358202008025a064b1702d9298fee62dfeccc57d322a463ad55ca201256d01f62b45b2e1c21c12a064b1702d9298fee62dfeccc57d322a463ad55ca201256d01f62b45b2e1c21c10f867098504a817c809830334509435353535353535353535353535353535353535358202d98025a052f8f61201b2b11a78d6e866abc9c3db2ae8631fa656bfe5cb53668255367afba052f8f61201b2b11a78d6e866abc9c3db2ae8631fa656bfe5cb53668255367afb"
|
||||
);
|
||||
let txs = vec![
|
||||
TransactionSigned::new_unhashed(
|
||||
Transaction::Legacy(TxLegacy {
|
||||
@@ -257,7 +265,9 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn decode_pooled_transactions_network() {
|
||||
let data = hex!("f9022980f90225f8650f84832156008287fb94cf7f9e66af820a19257a2108375b180b0ec491678204d2802ca035b7bfeb9ad9ece2cbafaaf8e202e706b4cfaeb233f46198f00b44d4a566a981a0612638fb29427ca33b9a3be2a0a561beecfe0269655be160d35e72d366a6a860b87502f872041a8459682f008459682f0d8252089461815774383099e24810ab832a5b2a5425c154d58829a2241af62c000080c001a059e6b67f48fb32e7e570dfb11e042b5ad2e55e3ce3ce9cd989c7e06e07feeafda0016b83f4f980694ed2eee4d10667242b1f40dc406901b34125b008d334d47469f86b0384773594008398968094d3e8763675e4c425df46cc3b5c0f6cbdac39604687038d7ea4c68000802ba0ce6834447c0a4193c40382e6c57ae33b241379c5418caac9cdc18d786fd12071a03ca3ae86580e94550d7c071e3a02eadb5a77830947c9225165cf9100901bee88f86b01843b9aca00830186a094d3e8763675e4c425df46cc3b5c0f6cbdac3960468702769bb01b2a00802ba0e24d8bd32ad906d6f8b8d7741e08d1959df021698b19ee232feba15361587d0aa05406ad177223213df262cb66ccbb2f46bfdccfdfbbb5ffdda9e2c02d977631daf86b02843b9aca00830186a094d3e8763675e4c425df46cc3b5c0f6cbdac39604687038d7ea4c68000802ba00eb96ca19e8a77102767a41fc85a36afd5c61ccb09911cec5d3e86e193d9c5aea03a456401896b1b6055311536bf00a718568c744d8c1f9df59879e8350220ca18");
|
||||
let data = hex!(
|
||||
"f9022980f90225f8650f84832156008287fb94cf7f9e66af820a19257a2108375b180b0ec491678204d2802ca035b7bfeb9ad9ece2cbafaaf8e202e706b4cfaeb233f46198f00b44d4a566a981a0612638fb29427ca33b9a3be2a0a561beecfe0269655be160d35e72d366a6a860b87502f872041a8459682f008459682f0d8252089461815774383099e24810ab832a5b2a5425c154d58829a2241af62c000080c001a059e6b67f48fb32e7e570dfb11e042b5ad2e55e3ce3ce9cd989c7e06e07feeafda0016b83f4f980694ed2eee4d10667242b1f40dc406901b34125b008d334d47469f86b0384773594008398968094d3e8763675e4c425df46cc3b5c0f6cbdac39604687038d7ea4c68000802ba0ce6834447c0a4193c40382e6c57ae33b241379c5418caac9cdc18d786fd12071a03ca3ae86580e94550d7c071e3a02eadb5a77830947c9225165cf9100901bee88f86b01843b9aca00830186a094d3e8763675e4c425df46cc3b5c0f6cbdac3960468702769bb01b2a00802ba0e24d8bd32ad906d6f8b8d7741e08d1959df021698b19ee232feba15361587d0aa05406ad177223213df262cb66ccbb2f46bfdccfdfbbb5ffdda9e2c02d977631daf86b02843b9aca00830186a094d3e8763675e4c425df46cc3b5c0f6cbdac39604687038d7ea4c68000802ba00eb96ca19e8a77102767a41fc85a36afd5c61ccb09911cec5d3e86e193d9c5aea03a456401896b1b6055311536bf00a718568c744d8c1f9df59879e8350220ca18"
|
||||
);
|
||||
let decoded_transactions =
|
||||
RequestPair::<PooledTransactions>::decode(&mut &data[..]).unwrap();
|
||||
let txs = vec![
|
||||
@@ -396,7 +406,9 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn encode_pooled_transactions_network() {
|
||||
let expected = hex!("f9022980f90225f8650f84832156008287fb94cf7f9e66af820a19257a2108375b180b0ec491678204d2802ca035b7bfeb9ad9ece2cbafaaf8e202e706b4cfaeb233f46198f00b44d4a566a981a0612638fb29427ca33b9a3be2a0a561beecfe0269655be160d35e72d366a6a860b87502f872041a8459682f008459682f0d8252089461815774383099e24810ab832a5b2a5425c154d58829a2241af62c000080c001a059e6b67f48fb32e7e570dfb11e042b5ad2e55e3ce3ce9cd989c7e06e07feeafda0016b83f4f980694ed2eee4d10667242b1f40dc406901b34125b008d334d47469f86b0384773594008398968094d3e8763675e4c425df46cc3b5c0f6cbdac39604687038d7ea4c68000802ba0ce6834447c0a4193c40382e6c57ae33b241379c5418caac9cdc18d786fd12071a03ca3ae86580e94550d7c071e3a02eadb5a77830947c9225165cf9100901bee88f86b01843b9aca00830186a094d3e8763675e4c425df46cc3b5c0f6cbdac3960468702769bb01b2a00802ba0e24d8bd32ad906d6f8b8d7741e08d1959df021698b19ee232feba15361587d0aa05406ad177223213df262cb66ccbb2f46bfdccfdfbbb5ffdda9e2c02d977631daf86b02843b9aca00830186a094d3e8763675e4c425df46cc3b5c0f6cbdac39604687038d7ea4c68000802ba00eb96ca19e8a77102767a41fc85a36afd5c61ccb09911cec5d3e86e193d9c5aea03a456401896b1b6055311536bf00a718568c744d8c1f9df59879e8350220ca18");
|
||||
let expected = hex!(
|
||||
"f9022980f90225f8650f84832156008287fb94cf7f9e66af820a19257a2108375b180b0ec491678204d2802ca035b7bfeb9ad9ece2cbafaaf8e202e706b4cfaeb233f46198f00b44d4a566a981a0612638fb29427ca33b9a3be2a0a561beecfe0269655be160d35e72d366a6a860b87502f872041a8459682f008459682f0d8252089461815774383099e24810ab832a5b2a5425c154d58829a2241af62c000080c001a059e6b67f48fb32e7e570dfb11e042b5ad2e55e3ce3ce9cd989c7e06e07feeafda0016b83f4f980694ed2eee4d10667242b1f40dc406901b34125b008d334d47469f86b0384773594008398968094d3e8763675e4c425df46cc3b5c0f6cbdac39604687038d7ea4c68000802ba0ce6834447c0a4193c40382e6c57ae33b241379c5418caac9cdc18d786fd12071a03ca3ae86580e94550d7c071e3a02eadb5a77830947c9225165cf9100901bee88f86b01843b9aca00830186a094d3e8763675e4c425df46cc3b5c0f6cbdac3960468702769bb01b2a00802ba0e24d8bd32ad906d6f8b8d7741e08d1959df021698b19ee232feba15361587d0aa05406ad177223213df262cb66ccbb2f46bfdccfdfbbb5ffdda9e2c02d977631daf86b02843b9aca00830186a094d3e8763675e4c425df46cc3b5c0f6cbdac39604687038d7ea4c68000802ba00eb96ca19e8a77102767a41fc85a36afd5c61ccb09911cec5d3e86e193d9c5aea03a456401896b1b6055311536bf00a718568c744d8c1f9df59879e8350220ca18"
|
||||
);
|
||||
let txs = vec![
|
||||
TransactionSigned::new_unhashed(
|
||||
Transaction::Legacy(TxLegacy {
|
||||
|
||||
@@ -28,7 +28,9 @@ pub enum EthStreamError {
|
||||
#[error("message size ({0}) exceeds max length (10MB)")]
|
||||
/// Received a message whose size exceeds the standard limit.
|
||||
MessageTooBig(usize),
|
||||
#[error("TransactionHashes invalid len of fields: hashes_len={hashes_len} types_len={types_len} sizes_len={sizes_len}")]
|
||||
#[error(
|
||||
"TransactionHashes invalid len of fields: hashes_len={hashes_len} types_len={types_len} sizes_len={sizes_len}"
|
||||
)]
|
||||
/// Received malformed transaction hashes message with discrepancies in field lengths.
|
||||
TransactionHashesInvalidLenOfFields {
|
||||
/// The number of transaction hashes.
|
||||
|
||||
@@ -48,13 +48,13 @@ pub fn broadcast_ingress_bench(c: &mut Criterion) {
|
||||
}
|
||||
|
||||
// prepare some transactions
|
||||
let mut gen =
|
||||
let mut tx_gen =
|
||||
TransactionGenerator::new(rand::rngs::StdRng::seed_from_u64(0));
|
||||
let num_broadcasts = 10;
|
||||
for _ in 0..num_broadcasts {
|
||||
for _ in 0..2 {
|
||||
let mut txs = Vec::new();
|
||||
let tx = gen.gen_eip1559_pooled();
|
||||
let tx = tx_gen.gen_eip1559_pooled();
|
||||
// ensure the sender has balance
|
||||
provider.add_account(
|
||||
tx.sender(),
|
||||
|
||||
@@ -104,10 +104,10 @@ pub fn tx_fetch_bench(c: &mut Criterion) {
|
||||
let peer_pool = peer.pool().unwrap();
|
||||
|
||||
for _ in 0..num_tx_per_peer {
|
||||
let mut gen =
|
||||
let mut tx_gen =
|
||||
TransactionGenerator::new(rand::rngs::StdRng::seed_from_u64(0));
|
||||
|
||||
let tx = gen.gen_eip1559_pooled();
|
||||
let tx = tx_gen.gen_eip1559_pooled();
|
||||
let sender = tx.sender();
|
||||
provider.add_account(
|
||||
sender,
|
||||
|
||||
@@ -265,7 +265,10 @@ mod test {
|
||||
let value_2 = Value(22);
|
||||
cache.insert(key_2, value_2);
|
||||
|
||||
assert_eq!("LruMap { limiter: ByLength { max_length: 2 }, ret %iter: Iter: { 2: Value(22), 1: Value(11) } }", format!("{cache:?}"))
|
||||
assert_eq!(
|
||||
"LruMap { limiter: ByLength { max_length: 2 }, ret %iter: Iter: { 2: Value(22), 1: Value(11) } }",
|
||||
format!("{cache:?}")
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -200,6 +200,7 @@ impl Discovery {
|
||||
}
|
||||
|
||||
/// Add a node to the discv4 table.
|
||||
#[expect(clippy::result_large_err)]
|
||||
pub(crate) fn add_discv5_node(&self, enr: Enr<SecretKey>) -> Result<(), NetworkError> {
|
||||
if let Some(discv5) = &self.discv5 {
|
||||
discv5.add_node(enr).map_err(NetworkError::Discv5Error)?;
|
||||
|
||||
@@ -521,7 +521,7 @@ impl<N: NetworkPrimitives> TransactionFetcher<N> {
|
||||
new_announced_hashes.retain(|hash, metadata| {
|
||||
|
||||
// occupied entry
|
||||
if let Some(TxFetchMetadata{ tx_encoded_length: ref mut previously_seen_size, ..}) = self.hashes_fetch_inflight_and_pending_fetch.peek_mut(hash) {
|
||||
if let Some(TxFetchMetadata{ tx_encoded_length: previously_seen_size, ..}) = self.hashes_fetch_inflight_and_pending_fetch.peek_mut(hash) {
|
||||
// update size metadata if available
|
||||
if let Some((_ty, size)) = metadata {
|
||||
if let Some(prev_size) = previously_seen_size {
|
||||
@@ -1469,10 +1469,14 @@ mod test {
|
||||
|
||||
#[test]
|
||||
fn verify_response_hashes() {
|
||||
let input = hex!("02f871018302a90f808504890aef60826b6c94ddf4c5025d1a5742cf12f74eec246d4432c295e487e09c3bbcc12b2b80c080a0f21a4eacd0bf8fea9c5105c543be5a1d8c796516875710fafafdf16d16d8ee23a001280915021bb446d1973501a67f93d2b38894a514b976e7b46dc2fe54598daa");
|
||||
let input = hex!(
|
||||
"02f871018302a90f808504890aef60826b6c94ddf4c5025d1a5742cf12f74eec246d4432c295e487e09c3bbcc12b2b80c080a0f21a4eacd0bf8fea9c5105c543be5a1d8c796516875710fafafdf16d16d8ee23a001280915021bb446d1973501a67f93d2b38894a514b976e7b46dc2fe54598daa"
|
||||
);
|
||||
let signed_tx_1: PooledTransaction =
|
||||
TransactionSigned::decode(&mut &input[..]).unwrap().try_into().unwrap();
|
||||
let input = hex!("02f871018302a90f808504890aef60826b6c94ddf4c5025d1a5742cf12f74eec246d4432c295e487e09c3bbcc12b2b80c080a0f21a4eacd0bf8fea9c5105c543be5a1d8c796516875710fafafdf16d16d8ee23a001280915021bb446d1973501a67f93d2b38894a514b976e7b46dc2fe54598d76");
|
||||
let input = hex!(
|
||||
"02f871018302a90f808504890aef60826b6c94ddf4c5025d1a5742cf12f74eec246d4432c295e487e09c3bbcc12b2b80c080a0f21a4eacd0bf8fea9c5105c543be5a1d8c796516875710fafafdf16d16d8ee23a001280915021bb446d1973501a67f93d2b38894a514b976e7b46dc2fe54598d76"
|
||||
);
|
||||
let signed_tx_2: PooledTransaction =
|
||||
TransactionSigned::decode(&mut &input[..]).unwrap().try_into().unwrap();
|
||||
|
||||
|
||||
@@ -2071,7 +2071,9 @@ mod tests {
|
||||
}
|
||||
}
|
||||
// random tx: <https://etherscan.io/getRawTx?tx=0x9448608d36e721ef403c53b00546068a6474d6cbab6816c3926de449898e7bce>
|
||||
let input = hex!("02f871018302a90f808504890aef60826b6c94ddf4c5025d1a5742cf12f74eec246d4432c295e487e09c3bbcc12b2b80c080a0f21a4eacd0bf8fea9c5105c543be5a1d8c796516875710fafafdf16d16d8ee23a001280915021bb446d1973501a67f93d2b38894a514b976e7b46dc2fe54598d76");
|
||||
let input = hex!(
|
||||
"02f871018302a90f808504890aef60826b6c94ddf4c5025d1a5742cf12f74eec246d4432c295e487e09c3bbcc12b2b80c080a0f21a4eacd0bf8fea9c5105c543be5a1d8c796516875710fafafdf16d16d8ee23a001280915021bb446d1973501a67f93d2b38894a514b976e7b46dc2fe54598d76"
|
||||
);
|
||||
let signed_tx = TransactionSigned::decode(&mut &input[..]).unwrap();
|
||||
transactions.on_network_tx_event(NetworkTransactionEvent::IncomingTransactions {
|
||||
peer_id: *handle1.peer_id(),
|
||||
@@ -2142,7 +2144,9 @@ mod tests {
|
||||
}
|
||||
}
|
||||
// random tx: <https://etherscan.io/getRawTx?tx=0x9448608d36e721ef403c53b00546068a6474d6cbab6816c3926de449898e7bce>
|
||||
let input = hex!("02f871018302a90f808504890aef60826b6c94ddf4c5025d1a5742cf12f74eec246d4432c295e487e09c3bbcc12b2b80c080a0f21a4eacd0bf8fea9c5105c543be5a1d8c796516875710fafafdf16d16d8ee23a001280915021bb446d1973501a67f93d2b38894a514b976e7b46dc2fe54598d76");
|
||||
let input = hex!(
|
||||
"02f871018302a90f808504890aef60826b6c94ddf4c5025d1a5742cf12f74eec246d4432c295e487e09c3bbcc12b2b80c080a0f21a4eacd0bf8fea9c5105c543be5a1d8c796516875710fafafdf16d16d8ee23a001280915021bb446d1973501a67f93d2b38894a514b976e7b46dc2fe54598d76"
|
||||
);
|
||||
let signed_tx = TransactionSigned::decode(&mut &input[..]).unwrap();
|
||||
transactions.on_network_tx_event(NetworkTransactionEvent::IncomingTransactions {
|
||||
peer_id: *handle1.peer_id(),
|
||||
@@ -2309,7 +2313,9 @@ mod tests {
|
||||
}
|
||||
}
|
||||
// random tx: <https://etherscan.io/getRawTx?tx=0x9448608d36e721ef403c53b00546068a6474d6cbab6816c3926de449898e7bce>
|
||||
let input = hex!("02f871018302a90f808504890aef60826b6c94ddf4c5025d1a5742cf12f74eec246d4432c295e487e09c3bbcc12b2b80c080a0f21a4eacd0bf8fea9c5105c543be5a1d8c796516875710fafafdf16d16d8ee23a001280915021bb446d1973501a67f93d2b38894a514b976e7b46dc2fe54598d76");
|
||||
let input = hex!(
|
||||
"02f871018302a90f808504890aef60826b6c94ddf4c5025d1a5742cf12f74eec246d4432c295e487e09c3bbcc12b2b80c080a0f21a4eacd0bf8fea9c5105c543be5a1d8c796516875710fafafdf16d16d8ee23a001280915021bb446d1973501a67f93d2b38894a514b976e7b46dc2fe54598d76"
|
||||
);
|
||||
let signed_tx = TransactionSigned::decode(&mut &input[..]).unwrap();
|
||||
transactions.on_network_tx_event(NetworkTransactionEvent::IncomingTransactions {
|
||||
peer_id: *handle1.peer_id(),
|
||||
|
||||
@@ -39,8 +39,8 @@ async fn transaction_hash_fetching() {
|
||||
let peer_pool = peer.pool().unwrap();
|
||||
|
||||
for _ in 0..num_tx_per_peer {
|
||||
let mut gen = TransactionGenerator::new(rand::rng());
|
||||
let tx = gen.gen_eip1559_pooled();
|
||||
let mut tx_gen = TransactionGenerator::new(rand::rng());
|
||||
let tx = tx_gen.gen_eip1559_pooled();
|
||||
let sender = tx.sender();
|
||||
provider.add_account(sender, ExtendedAccount::new(0, U256::from(100_000_000)));
|
||||
peer_pool.add_external_transaction(tx).await.unwrap();
|
||||
|
||||
@@ -34,8 +34,8 @@ async fn test_tx_gossip() {
|
||||
let mut peer0_tx_listener = peer0.pool().unwrap().pending_transactions_listener();
|
||||
let mut peer1_tx_listener = peer1.pool().unwrap().pending_transactions_listener();
|
||||
|
||||
let mut gen = TransactionGenerator::new(rand::rng());
|
||||
let tx = gen.gen_eip1559_pooled();
|
||||
let mut tx_gen = TransactionGenerator::new(rand::rng());
|
||||
let tx = tx_gen.gen_eip1559_pooled();
|
||||
|
||||
// ensure the sender has balance
|
||||
let sender = tx.sender();
|
||||
@@ -73,8 +73,8 @@ async fn test_tx_propagation_policy_trusted_only() {
|
||||
let mut peer0_tx_listener = peer_0_handle.pool().unwrap().pending_transactions_listener();
|
||||
let mut peer1_tx_listener = peer_1_handle.pool().unwrap().pending_transactions_listener();
|
||||
|
||||
let mut gen = TransactionGenerator::new(rand::rng());
|
||||
let tx = gen.gen_eip1559_pooled();
|
||||
let mut tx_gen = TransactionGenerator::new(rand::rng());
|
||||
let tx = tx_gen.gen_eip1559_pooled();
|
||||
|
||||
// ensure the sender has balance
|
||||
let sender = tx.sender();
|
||||
@@ -100,8 +100,8 @@ async fn test_tx_propagation_policy_trusted_only() {
|
||||
peer_0_handle.network().add_trusted_peer(*peer_1_handle.peer_id(), peer_1_handle.local_addr());
|
||||
join!(event_stream_0.next_session_established(), event_stream_1.next_session_established());
|
||||
|
||||
let mut gen = TransactionGenerator::new(rand::rng());
|
||||
let tx = gen.gen_eip1559_pooled();
|
||||
let mut tx_gen = TransactionGenerator::new(rand::rng());
|
||||
let tx = tx_gen.gen_eip1559_pooled();
|
||||
|
||||
// ensure the sender has balance
|
||||
let sender = tx.sender();
|
||||
@@ -139,10 +139,10 @@ async fn test_4844_tx_gossip_penalization() {
|
||||
|
||||
let mut peer1_tx_listener = peer1.pool().unwrap().pending_transactions_listener();
|
||||
|
||||
let mut gen = TransactionGenerator::new(rand::rng());
|
||||
let mut tx_gen = TransactionGenerator::new(rand::rng());
|
||||
|
||||
// peer 0 will be penalized for sending txs[0] over gossip
|
||||
let txs = vec![gen.gen_eip4844_pooled(), gen.gen_eip1559_pooled()];
|
||||
let txs = vec![tx_gen.gen_eip4844_pooled(), tx_gen.gen_eip1559_pooled()];
|
||||
|
||||
for tx in &txs {
|
||||
let sender = tx.sender();
|
||||
|
||||
@@ -404,7 +404,11 @@ where
|
||||
{
|
||||
// Highly unlikely to happen, and given its destructive nature, it's better to panic
|
||||
// instead.
|
||||
assert_ne!(unwind_target, PipelineTarget::Unwind(0), "A static file <> database inconsistency was found that would trigger an unwind to block 0");
|
||||
assert_ne!(
|
||||
unwind_target,
|
||||
PipelineTarget::Unwind(0),
|
||||
"A static file <> database inconsistency was found that would trigger an unwind to block 0"
|
||||
);
|
||||
|
||||
info!(target: "reth::cli", unwind_target = %unwind_target, "Executing an unwind after a failed storage consistency check.");
|
||||
|
||||
@@ -799,7 +803,9 @@ where
|
||||
let latest = self.blockchain_db().last_block_number()?;
|
||||
// bedrock height
|
||||
if latest < 105235063 {
|
||||
error!("Op-mainnet has been launched without importing the pre-Bedrock state. The chain can't progress without this. See also https://reth.rs/run/sync-op-mainnet.html?minimal-bootstrap-recommended");
|
||||
error!(
|
||||
"Op-mainnet has been launched without importing the pre-Bedrock state. The chain can't progress without this. See also https://reth.rs/run/sync-op-mainnet.html?minimal-bootstrap-recommended"
|
||||
);
|
||||
return Err(ProviderError::BestBlockNotFound)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -289,16 +289,26 @@ impl NodeState {
|
||||
if self.current_stage.is_none() {
|
||||
match event {
|
||||
ConsensusLayerHealthEvent::NeverSeen => {
|
||||
warn!("Post-merge network, but never seen beacon client. Please launch one to follow the chain!")
|
||||
warn!(
|
||||
"Post-merge network, but never seen beacon client. Please launch one to follow the chain!"
|
||||
)
|
||||
}
|
||||
ConsensusLayerHealthEvent::HasNotBeenSeenForAWhile(period) => {
|
||||
warn!(?period, "Post-merge network, but no beacon client seen for a while. Please launch one to follow the chain!")
|
||||
warn!(
|
||||
?period,
|
||||
"Post-merge network, but no beacon client seen for a while. Please launch one to follow the chain!"
|
||||
)
|
||||
}
|
||||
ConsensusLayerHealthEvent::NeverReceivedUpdates => {
|
||||
warn!("Beacon client online, but never received consensus updates. Please ensure your beacon client is operational to follow the chain!")
|
||||
warn!(
|
||||
"Beacon client online, but never received consensus updates. Please ensure your beacon client is operational to follow the chain!"
|
||||
)
|
||||
}
|
||||
ConsensusLayerHealthEvent::HaveNotReceivedUpdatesForAWhile(period) => {
|
||||
warn!(?period, "Beacon client online, but no consensus updates received for a while. This may be because of a reth error, or an error in the beacon client! Please investigate reth and beacon client logs!")
|
||||
warn!(
|
||||
?period,
|
||||
"Beacon client online, but no consensus updates received for a while. This may be because of a reth error, or an error in the beacon client! Please investigate reth and beacon client logs!"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,4 +18,6 @@ pub const BASE_SEPOLIA_MAX_GAS_LIMIT: u64 = 45_000_000;
|
||||
/// OP Mainnet transaction at index 0 in block 124665056.
|
||||
///
|
||||
/// <https://optimistic.etherscan.io/tx/0x312e290cf36df704a2217b015d6455396830b0ce678b860ebfcc30f41403d7b1>
|
||||
pub const TX_SET_L1_BLOCK_OP_MAINNET_BLOCK_124665056: [u8; 251] = hex!("7ef8f8a0683079df94aa5b9cf86687d739a60a9b4f0835e520ec4d664e2e415dca17a6df94deaddeaddeaddeaddeaddeaddeaddeaddead00019442000000000000000000000000000000000000158080830f424080b8a4440a5e200000146b000f79c500000000000000040000000066d052e700000000013ad8a3000000000000000000000000000000000000000000000000000000003ef1278700000000000000000000000000000000000000000000000000000000000000012fdf87b89884a61e74b322bbcf60386f543bfae7827725efaaf0ab1de2294a590000000000000000000000006887246668a3b87f54deb3b94ba47a6f63f32985");
|
||||
pub const TX_SET_L1_BLOCK_OP_MAINNET_BLOCK_124665056: [u8; 251] = hex!(
|
||||
"7ef8f8a0683079df94aa5b9cf86687d739a60a9b4f0835e520ec4d664e2e415dca17a6df94deaddeaddeaddeaddeaddeaddeaddeaddead00019442000000000000000000000000000000000000158080830f424080b8a4440a5e200000146b000f79c500000000000000040000000066d052e700000000013ad8a3000000000000000000000000000000000000000000000000000000003ef1278700000000000000000000000000000000000000000000000000000000000000012fdf87b89884a61e74b322bbcf60386f543bfae7827725efaaf0ab1de2294a590000000000000000000000006887246668a3b87f54deb3b94ba47a6f63f32985"
|
||||
);
|
||||
|
||||
@@ -154,7 +154,9 @@ where
|
||||
}
|
||||
}
|
||||
None => {
|
||||
eyre::bail!("Receipts was not initialized. Please import blocks and transactions before calling this command.");
|
||||
eyre::bail!(
|
||||
"Receipts was not initialized. Please import blocks and transactions before calling this command."
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -243,12 +245,16 @@ where
|
||||
.expect("transaction static files must exist before importing receipts");
|
||||
|
||||
if total_receipts != total_imported_txns {
|
||||
eyre::bail!("Number of receipts ({total_receipts}) inconsistent with transactions {total_imported_txns}")
|
||||
eyre::bail!(
|
||||
"Number of receipts ({total_receipts}) inconsistent with transactions {total_imported_txns}"
|
||||
)
|
||||
}
|
||||
|
||||
// Only commit if the receipt block height matches the one from transactions.
|
||||
if highest_block_receipts != highest_block_transactions {
|
||||
eyre::bail!("Receipt block height ({highest_block_receipts}) inconsistent with transactions' {highest_block_transactions}")
|
||||
eyre::bail!(
|
||||
"Receipt block height ({highest_block_receipts}) inconsistent with transactions' {highest_block_transactions}"
|
||||
)
|
||||
}
|
||||
|
||||
// Required or any access-write provider factory will attempt to unwind to 0.
|
||||
|
||||
@@ -302,7 +302,9 @@ mod tests {
|
||||
fn test_decode_legacy_transactions() {
|
||||
// Test Case 1: contract deposit - regular L2 transaction calling deposit() function
|
||||
// tx: https://optimistic.etherscan.io/getRawTx?tx=0x7860252963a2df21113344f323035ef59648638a571eef742e33d789602c7a1c
|
||||
let deposit_tx_bytes = hex!("f88881f0830f481c830c6e4594a75127121d28a9bf848f3b70e7eea26570aa770080a4b6b55f2500000000000000000000000000000000000000000000000000000000000710b238a0d5c622d92ddf37f9c18a3465a572f74d8b1aeaf50c1cfb10b3833242781fd45fa02c4f1d5819bf8b70bf651e7a063b7db63c55bd336799c6ae3e5bc72ad6ef3def");
|
||||
let deposit_tx_bytes = hex!(
|
||||
"f88881f0830f481c830c6e4594a75127121d28a9bf848f3b70e7eea26570aa770080a4b6b55f2500000000000000000000000000000000000000000000000000000000000710b238a0d5c622d92ddf37f9c18a3465a572f74d8b1aeaf50c1cfb10b3833242781fd45fa02c4f1d5819bf8b70bf651e7a063b7db63c55bd336799c6ae3e5bc72ad6ef3def"
|
||||
);
|
||||
let deposit_decoded = OvmTransactionSigned::decode(&mut &deposit_tx_bytes[..]).unwrap();
|
||||
|
||||
// Verify deposit transaction
|
||||
@@ -340,7 +342,9 @@ mod tests {
|
||||
|
||||
// Test Case 2: pre-bedrock system transaction from block 105235052
|
||||
// tx: https://optimistic.etherscan.io/getRawTx?tx=0xe20b11349681dd049f8df32f5cdbb4c68d46b537685defcd86c7fa42cfe75b9e
|
||||
let system_tx_bytes = hex!("f9026c830d899383124f808302a77e94a0cc33dd6f4819d473226257792afe230ec3c67f80b902046c459a280000000000000000000000004d73adb72bc3dd368966edd0f0b2148401a178e2000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000647fac7f00000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000084704316e5000000000000000000000000000000000000000000000000000000000000006e10975631049de3c008989b0d8c19fc720dc556ca01abfbd794c6eb5075dd000d000000000000000000000000000000000000000000000000000000000000001410975631049de3c008989b0d8c19fc720dc556ca01abfbd794c6eb5075dd000d000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000082a39325251d44e11f3b6d92f9382438eb6c8b5068d4a488d4f177b26f2ca20db34ae53467322852afcc779f25eafd124c5586f54b9026497ba934403d4c578e3c1b5aa754c918ee2ecd25402df656c2419717e4017a7aecb84af3914fd3c7bf6930369c4e6ff76950246b98e354821775f02d33cdbee5ef6aed06c15b75691692d31c00000000000000000000000000000000000000000000000000000000000038a0e8991e95e66d809f4b6fb0af27c31368ca0f30e657165c428aa681ec5ea25bbea013ed325bd97365087ec713e9817d252b59113ea18430b71a5890c4eeb6b9efc4");
|
||||
let system_tx_bytes = hex!(
|
||||
"f9026c830d899383124f808302a77e94a0cc33dd6f4819d473226257792afe230ec3c67f80b902046c459a280000000000000000000000004d73adb72bc3dd368966edd0f0b2148401a178e2000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000647fac7f00000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000084704316e5000000000000000000000000000000000000000000000000000000000000006e10975631049de3c008989b0d8c19fc720dc556ca01abfbd794c6eb5075dd000d000000000000000000000000000000000000000000000000000000000000001410975631049de3c008989b0d8c19fc720dc556ca01abfbd794c6eb5075dd000d000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000082a39325251d44e11f3b6d92f9382438eb6c8b5068d4a488d4f177b26f2ca20db34ae53467322852afcc779f25eafd124c5586f54b9026497ba934403d4c578e3c1b5aa754c918ee2ecd25402df656c2419717e4017a7aecb84af3914fd3c7bf6930369c4e6ff76950246b98e354821775f02d33cdbee5ef6aed06c15b75691692d31c00000000000000000000000000000000000000000000000000000000000038a0e8991e95e66d809f4b6fb0af27c31368ca0f30e657165c428aa681ec5ea25bbea013ed325bd97365087ec713e9817d252b59113ea18430b71a5890c4eeb6b9efc4"
|
||||
);
|
||||
let system_decoded = OvmTransactionSigned::decode(&mut &system_tx_bytes[..]).unwrap();
|
||||
|
||||
// Verify system transaction
|
||||
|
||||
@@ -125,11 +125,17 @@ pub(crate) mod test {
|
||||
|
||||
use super::*;
|
||||
|
||||
pub(crate) const HACK_RECEIPT_ENCODED_BLOCK_1: &[u8] = &hex!("f9030ff9030c8080018303183db9010000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000400000000000100000000000000200000000002000000000000001000000000000000000004000000000000000000000000000040000400000100400000000000000100000000000000000000000000000020000000000000000000000000000000000000000000000001000000000000000000000100000000000000000000000000000000000000000000000000000000000000088000000080000000000010000000000000000000000000000800008000120000000000000000000000000000000002000f90197f89b948ce8c13d816fe6daf12d6fd9e4952e1fc88850aff863a00109fc6f55cf40689f02fbaad7af7fe7bbac8a3d2186600afc7d3e10cac60271a00000000000000000000000000000000000000000000000000000000000014218a000000000000000000000000070b17c0fe982ab4a7ac17a4c25485643151a1f2da000000000000000000000000000000000000000000000000000000000618d8837f89c948ce8c13d816fe6daf12d6fd9e4952e1fc88850aff884a092e98423f8adac6e64d0608e519fd1cefb861498385c6dee70d58fc926ddc68ca000000000000000000000000000000000000000000000000000000000d0e3ebf0a00000000000000000000000000000000000000000000000000000000000014218a000000000000000000000000070b17c0fe982ab4a7ac17a4c25485643151a1f2d80f85a948ce8c13d816fe6daf12d6fd9e4952e1fc88850aff842a0fe25c73e3b9089fac37d55c4c7efcba6f04af04cebd2fc4d6d7dbb07e1e5234fa000000000000000000000000000000000000000000000007edc6ca0bb6834800080a05e77a04531c7c107af1882d76cbff9486d0a9aa53701c30888509d4f5f2b003a9400000000000000000000000000000000000000008303183da0bee7192e575af30420cae0c7776304ac196077ee72b048970549e4f08e8754530180018212c2821c2383312e35");
|
||||
pub(crate) const HACK_RECEIPT_ENCODED_BLOCK_1: &[u8] = &hex!(
|
||||
"f9030ff9030c8080018303183db9010000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000400000000000100000000000000200000000002000000000000001000000000000000000004000000000000000000000000000040000400000100400000000000000100000000000000000000000000000020000000000000000000000000000000000000000000000001000000000000000000000100000000000000000000000000000000000000000000000000000000000000088000000080000000000010000000000000000000000000000800008000120000000000000000000000000000000002000f90197f89b948ce8c13d816fe6daf12d6fd9e4952e1fc88850aff863a00109fc6f55cf40689f02fbaad7af7fe7bbac8a3d2186600afc7d3e10cac60271a00000000000000000000000000000000000000000000000000000000000014218a000000000000000000000000070b17c0fe982ab4a7ac17a4c25485643151a1f2da000000000000000000000000000000000000000000000000000000000618d8837f89c948ce8c13d816fe6daf12d6fd9e4952e1fc88850aff884a092e98423f8adac6e64d0608e519fd1cefb861498385c6dee70d58fc926ddc68ca000000000000000000000000000000000000000000000000000000000d0e3ebf0a00000000000000000000000000000000000000000000000000000000000014218a000000000000000000000000070b17c0fe982ab4a7ac17a4c25485643151a1f2d80f85a948ce8c13d816fe6daf12d6fd9e4952e1fc88850aff842a0fe25c73e3b9089fac37d55c4c7efcba6f04af04cebd2fc4d6d7dbb07e1e5234fa000000000000000000000000000000000000000000000007edc6ca0bb6834800080a05e77a04531c7c107af1882d76cbff9486d0a9aa53701c30888509d4f5f2b003a9400000000000000000000000000000000000000008303183da0bee7192e575af30420cae0c7776304ac196077ee72b048970549e4f08e8754530180018212c2821c2383312e35"
|
||||
);
|
||||
|
||||
pub(crate) const HACK_RECEIPT_ENCODED_BLOCK_2: &[u8] = &hex!("f90271f9026e8080018301c60db9010000080000000200000000000000000008000000000000000000000100008000000000000000000000000000000000000000000000000000000000400000000000100000000000000000000000020000000000000000000000000000000000004000000000000000000000000000000000400000000400000000000000100000000000000000000000000000020000000000000000000000000000000000000000100000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000008400000000000000000010000000000000000020000000020000000000000000000000000000000000000000000002000f8faf89c948ce8c13d816fe6daf12d6fd9e4952e1fc88850aff884a092e98423f8adac6e64d0608e519fd1cefb861498385c6dee70d58fc926ddc68ca000000000000000000000000000000000000000000000000000000000d0ea0e40a00000000000000000000000000000000000000000000000000000000000014218a0000000000000000000000000e5e7492282fd1e3bfac337a0beccd29b15b7b24080f85a948ce8c13d816fe6daf12d6fd9e4952e1fc88850aff842a0fe25c73e3b9089fac37d55c4c7efcba6f04af04cebd2fc4d6d7dbb07e1e5234fa000000000000000000000000000000000000000000000007eda7867e0c7d4800080a0af6ed8a6864d44989adc47c84f6fe0aeb1819817505c42cde6cbbcd5e14dd3179400000000000000000000000000000000000000008301c60da045fd6ce41bb8ebb2bccdaa92dd1619e287704cb07722039901a7eba63dea1d130280018212c2821c2383312e35");
|
||||
pub(crate) const HACK_RECEIPT_ENCODED_BLOCK_2: &[u8] = &hex!(
|
||||
"f90271f9026e8080018301c60db9010000080000000200000000000000000008000000000000000000000100008000000000000000000000000000000000000000000000000000000000400000000000100000000000000000000000020000000000000000000000000000000000004000000000000000000000000000000000400000000400000000000000100000000000000000000000000000020000000000000000000000000000000000000000100000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000008400000000000000000010000000000000000020000000020000000000000000000000000000000000000000000002000f8faf89c948ce8c13d816fe6daf12d6fd9e4952e1fc88850aff884a092e98423f8adac6e64d0608e519fd1cefb861498385c6dee70d58fc926ddc68ca000000000000000000000000000000000000000000000000000000000d0ea0e40a00000000000000000000000000000000000000000000000000000000000014218a0000000000000000000000000e5e7492282fd1e3bfac337a0beccd29b15b7b24080f85a948ce8c13d816fe6daf12d6fd9e4952e1fc88850aff842a0fe25c73e3b9089fac37d55c4c7efcba6f04af04cebd2fc4d6d7dbb07e1e5234fa000000000000000000000000000000000000000000000007eda7867e0c7d4800080a0af6ed8a6864d44989adc47c84f6fe0aeb1819817505c42cde6cbbcd5e14dd3179400000000000000000000000000000000000000008301c60da045fd6ce41bb8ebb2bccdaa92dd1619e287704cb07722039901a7eba63dea1d130280018212c2821c2383312e35"
|
||||
);
|
||||
|
||||
pub(crate) const HACK_RECEIPT_ENCODED_BLOCK_3: &[u8] = &hex!("f90271f9026e8080018301c60db9010000000000000000000000000000000000000000400000000000000000008000000000000000000000000000000000004000000000000000000000400004000000100000000000000000000000000000000000000000000000000000000000004000000000000000000000040000000000400080000400000000000000100000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000008100000000000000000000000000000000000004000000000000000000000000008000000000000000000010000000000000000000000000000400000000000000001000000000000000000000000002000f8faf89c948ce8c13d816fe6daf12d6fd9e4952e1fc88850aff884a092e98423f8adac6e64d0608e519fd1cefb861498385c6dee70d58fc926ddc68ca000000000000000000000000000000000000000000000000000000000d101e54ba00000000000000000000000000000000000000000000000000000000000014218a0000000000000000000000000fa011d8d6c26f13abe2cefed38226e401b2b8a9980f85a948ce8c13d816fe6daf12d6fd9e4952e1fc88850aff842a0fe25c73e3b9089fac37d55c4c7efcba6f04af04cebd2fc4d6d7dbb07e1e5234fa000000000000000000000000000000000000000000000007ed8842f062774800080a08fab01dcec1da547e90a77597999e9153ff788fa6451d1cc942064427bd995019400000000000000000000000000000000000000008301c60da0da4509fe0ca03202ddbe4f68692c132d689ee098433691040ece18c3a45d44c50380018212c2821c2383312e35");
|
||||
pub(crate) const HACK_RECEIPT_ENCODED_BLOCK_3: &[u8] = &hex!(
|
||||
"f90271f9026e8080018301c60db9010000000000000000000000000000000000000000400000000000000000008000000000000000000000000000000000004000000000000000000000400004000000100000000000000000000000000000000000000000000000000000000000004000000000000000000000040000000000400080000400000000000000100000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000008100000000000000000000000000000000000004000000000000000000000000008000000000000000000010000000000000000000000000000400000000000000001000000000000000000000000002000f8faf89c948ce8c13d816fe6daf12d6fd9e4952e1fc88850aff884a092e98423f8adac6e64d0608e519fd1cefb861498385c6dee70d58fc926ddc68ca000000000000000000000000000000000000000000000000000000000d101e54ba00000000000000000000000000000000000000000000000000000000000014218a0000000000000000000000000fa011d8d6c26f13abe2cefed38226e401b2b8a9980f85a948ce8c13d816fe6daf12d6fd9e4952e1fc88850aff842a0fe25c73e3b9089fac37d55c4c7efcba6f04af04cebd2fc4d6d7dbb07e1e5234fa000000000000000000000000000000000000000000000007ed8842f062774800080a08fab01dcec1da547e90a77597999e9153ff788fa6451d1cc942064427bd995019400000000000000000000000000000000000000008301c60da0da4509fe0ca03202ddbe4f68692c132d689ee098433691040ece18c3a45d44c50380018212c2821c2383312e35"
|
||||
);
|
||||
|
||||
fn hack_receipt_1() -> OpGethReceipt {
|
||||
let receipt = receipt_block_1();
|
||||
@@ -139,7 +145,9 @@ pub(crate) mod test {
|
||||
post_state: Bytes::default(),
|
||||
status: receipt.receipt.status() as u64,
|
||||
cumulative_gas_used: receipt.receipt.cumulative_gas_used(),
|
||||
bloom: Bloom::from(hex!("00000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000400000000000100000000000000200000000002000000000000001000000000000000000004000000000000000000000000000040000400000100400000000000000100000000000000000000000000000020000000000000000000000000000000000000000000000001000000000000000000000100000000000000000000000000000000000000000000000000000000000000088000000080000000000010000000000000000000000000000800008000120000000000000000000000000000000002000")),
|
||||
bloom: Bloom::from(hex!(
|
||||
"00000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000400000000000100000000000000200000000002000000000000001000000000000000000004000000000000000000000000000040000400000100400000000000000100000000000000000000000000000020000000000000000000000000000000000000000000000001000000000000000000000100000000000000000000000000000000000000000000000000000000000000088000000080000000000010000000000000000000000000000800008000120000000000000000000000000000000002000"
|
||||
)),
|
||||
logs: receipt.receipt.logs().to_vec(),
|
||||
tx_hash: b256!("0x5e77a04531c7c107af1882d76cbff9486d0a9aa53701c30888509d4f5f2b003a"), contract_address: address!("0x0000000000000000000000000000000000000000"), gas_used: 202813,
|
||||
block_hash: b256!("0xbee7192e575af30420cae0c7776304ac196077ee72b048970549e4f08e875453"),
|
||||
@@ -148,7 +156,7 @@ pub(crate) mod test {
|
||||
l1_gas_price: 1,
|
||||
l1_gas_used: 4802,
|
||||
l1_fee: 7203,
|
||||
fee_scalar: String::from("1.5")
|
||||
fee_scalar: String::from("1.5"),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -333,7 +333,9 @@ mod tests {
|
||||
address: Address::ZERO,
|
||||
data: LogData::new_unchecked(vec![], Default::default()),
|
||||
}];
|
||||
let logs_bloom = bloom!("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001");
|
||||
let logs_bloom = bloom!(
|
||||
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001"
|
||||
);
|
||||
let receipt = ReceiptWithBloom {
|
||||
receipt: OpReceipt::Eip2930(Receipt {
|
||||
status: true.into(),
|
||||
|
||||
@@ -285,7 +285,9 @@ mod tests {
|
||||
use alloy_consensus::Header;
|
||||
use alloy_primitives::{hex_literal::hex, Bytes};
|
||||
|
||||
let bytes = Bytes::from_static(&hex!("7ef9015aa044bae9d41b8380d781187b426c6fe43df5fb2fb57bd4466ef6a701e1f01e015694deaddeaddeaddeaddeaddeaddeaddeaddead000194420000000000000000000000000000000000001580808408f0d18001b90104015d8eb900000000000000000000000000000000000000000000000000000000008057650000000000000000000000000000000000000000000000000000000063d96d10000000000000000000000000000000000000000000000000000000000009f35273d89754a1e0387b89520d989d3be9c37c1f32495a88faf1ea05c61121ab0d1900000000000000000000000000000000000000000000000000000000000000010000000000000000000000002d679b567db6187c0c8323fa982cfb88b74dbcc7000000000000000000000000000000000000000000000000000000000000083400000000000000000000000000000000000000000000000000000000000f4240"));
|
||||
let bytes = Bytes::from_static(&hex!(
|
||||
"7ef9015aa044bae9d41b8380d781187b426c6fe43df5fb2fb57bd4466ef6a701e1f01e015694deaddeaddeaddeaddeaddeaddeaddeaddead000194420000000000000000000000000000000000001580808408f0d18001b90104015d8eb900000000000000000000000000000000000000000000000000000000008057650000000000000000000000000000000000000000000000000000000063d96d10000000000000000000000000000000000000000000000000000000000009f35273d89754a1e0387b89520d989d3be9c37c1f32495a88faf1ea05c61121ab0d1900000000000000000000000000000000000000000000000000000000000000010000000000000000000000002d679b567db6187c0c8323fa982cfb88b74dbcc7000000000000000000000000000000000000000000000000000000000000083400000000000000000000000000000000000000000000000000000000000f4240"
|
||||
));
|
||||
let l1_info_tx = OpTransactionSigned::decode_2718(&mut bytes.as_ref()).unwrap();
|
||||
let mock_block = Block {
|
||||
header: Header::default(),
|
||||
@@ -312,7 +314,9 @@ mod tests {
|
||||
// First transaction in OP mainnet block 118024092
|
||||
//
|
||||
// https://optimistic.etherscan.io/getRawTx?tx=0x88501da5d5ca990347c2193be90a07037af1e3820bb40774c8154871c7669150
|
||||
const TX: [u8; 251] = hex!("7ef8f8a0a539eb753df3b13b7e386e147d45822b67cb908c9ddc5618e3dbaa22ed00850b94deaddeaddeaddeaddeaddeaddeaddeaddead00019442000000000000000000000000000000000000158080830f424080b8a4440a5e2000000558000c5fc50000000000000000000000006605a89f00000000012a10d90000000000000000000000000000000000000000000000000000000af39ac3270000000000000000000000000000000000000000000000000000000d5ea528d24e582fa68786f080069bdbfe06a43f8e67bfd31b8e4d8a8837ba41da9a82a54a0000000000000000000000006887246668a3b87f54deb3b94ba47a6f63f32985");
|
||||
const TX: [u8; 251] = hex!(
|
||||
"7ef8f8a0a539eb753df3b13b7e386e147d45822b67cb908c9ddc5618e3dbaa22ed00850b94deaddeaddeaddeaddeaddeaddeaddeaddead00019442000000000000000000000000000000000000158080830f424080b8a4440a5e2000000558000c5fc50000000000000000000000006605a89f00000000012a10d90000000000000000000000000000000000000000000000000000000af39ac3270000000000000000000000000000000000000000000000000000000d5ea528d24e582fa68786f080069bdbfe06a43f8e67bfd31b8e4d8a8837ba41da9a82a54a0000000000000000000000006887246668a3b87f54deb3b94ba47a6f63f32985"
|
||||
);
|
||||
|
||||
let tx = OpTransactionSigned::decode_2718(&mut TX.as_slice()).unwrap();
|
||||
let block: Block<OpTransactionSigned> = Block {
|
||||
@@ -347,7 +351,9 @@ mod tests {
|
||||
// L1 block info for OP mainnet block 124665056 (stored in input of tx at index 0)
|
||||
//
|
||||
// https://optimistic.etherscan.io/tx/0x312e290cf36df704a2217b015d6455396830b0ce678b860ebfcc30f41403d7b1
|
||||
const DATA: &[u8] = &hex!("440a5e200000146b000f79c500000000000000040000000066d052e700000000013ad8a3000000000000000000000000000000000000000000000000000000003ef1278700000000000000000000000000000000000000000000000000000000000000012fdf87b89884a61e74b322bbcf60386f543bfae7827725efaaf0ab1de2294a590000000000000000000000006887246668a3b87f54deb3b94ba47a6f63f32985");
|
||||
const DATA: &[u8] = &hex!(
|
||||
"440a5e200000146b000f79c500000000000000040000000066d052e700000000013ad8a3000000000000000000000000000000000000000000000000000000003ef1278700000000000000000000000000000000000000000000000000000000000000012fdf87b89884a61e74b322bbcf60386f543bfae7827725efaaf0ab1de2294a590000000000000000000000006887246668a3b87f54deb3b94ba47a6f63f32985"
|
||||
);
|
||||
|
||||
// expected l1 block info verified against expected l1 fee for tx. l1 tx fee listed on OP
|
||||
// mainnet block scanner
|
||||
@@ -373,7 +379,9 @@ mod tests {
|
||||
// rig
|
||||
|
||||
// L1 block info from a devnet with Isthmus activated
|
||||
const DATA: &[u8] = &hex!("098999be00000558000c5fc500000000000000030000000067a9f765000000000000002900000000000000000000000000000000000000000000000000000000006a6d09000000000000000000000000000000000000000000000000000000000000000172fcc8e8886636bdbe96ba0e4baab67ea7e7811633f52b52e8cf7a5123213b6f000000000000000000000000d3f2c5afb2d76f5579f326b0cd7da5f5a4126c3500004e2000000000000001f4");
|
||||
const DATA: &[u8] = &hex!(
|
||||
"098999be00000558000c5fc500000000000000030000000067a9f765000000000000002900000000000000000000000000000000000000000000000000000000006a6d09000000000000000000000000000000000000000000000000000000000000000172fcc8e8886636bdbe96ba0e4baab67ea7e7811633f52b52e8cf7a5123213b6f000000000000000000000000d3f2c5afb2d76f5579f326b0cd7da5f5a4126c3500004e2000000000000001f4"
|
||||
);
|
||||
|
||||
// expected l1 block info verified against expected l1 fee and operator fee for tx.
|
||||
let l1_base_fee = U256::from(6974729);
|
||||
|
||||
@@ -72,7 +72,9 @@ pub const BEDROCK_HEADER: Header = Header {
|
||||
extra_data: bytes!("424544524f434b"),
|
||||
gas_limit: 30000000,
|
||||
gas_used: 0,
|
||||
logs_bloom: bloom!("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"),
|
||||
logs_bloom: bloom!(
|
||||
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
||||
),
|
||||
nonce: B64::ZERO,
|
||||
number: 105235063,
|
||||
parent_hash: b256!("0x21a168dfa5e727926063a28ba16fd5ee84c814e847c81a699c7a0ea551e4ca50"),
|
||||
|
||||
@@ -609,7 +609,9 @@ mod tests {
|
||||
// Test vector from: https://eips.ethereum.org/EIPS/eip-2481
|
||||
#[test]
|
||||
fn encode_legacy_receipt() {
|
||||
let expected = hex!("f901668001b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f85ff85d940000000000000000000000000000000000000011f842a0000000000000000000000000000000000000000000000000000000000000deada0000000000000000000000000000000000000000000000000000000000000beef830100ff");
|
||||
let expected = hex!(
|
||||
"f901668001b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f85ff85d940000000000000000000000000000000000000011f842a0000000000000000000000000000000000000000000000000000000000000deada0000000000000000000000000000000000000000000000000000000000000beef830100ff"
|
||||
);
|
||||
|
||||
let mut data = Vec::with_capacity(expected.length());
|
||||
let receipt = ReceiptWithBloom {
|
||||
@@ -638,7 +640,9 @@ mod tests {
|
||||
// Test vector from: https://eips.ethereum.org/EIPS/eip-2481
|
||||
#[test]
|
||||
fn decode_legacy_receipt() {
|
||||
let data = hex!("f901668001b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f85ff85d940000000000000000000000000000000000000011f842a0000000000000000000000000000000000000000000000000000000000000deada0000000000000000000000000000000000000000000000000000000000000beef830100ff");
|
||||
let data = hex!(
|
||||
"f901668001b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f85ff85d940000000000000000000000000000000000000011f842a0000000000000000000000000000000000000000000000000000000000000deada0000000000000000000000000000000000000000000000000000000000000beef830100ff"
|
||||
);
|
||||
|
||||
// EIP658Receipt
|
||||
let expected = ReceiptWithBloom {
|
||||
@@ -663,7 +667,9 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn decode_deposit_receipt_regolith_roundtrip() {
|
||||
let data = hex!("b901107ef9010c0182b741b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0833d3bbf");
|
||||
let data = hex!(
|
||||
"b901107ef9010c0182b741b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0833d3bbf"
|
||||
);
|
||||
|
||||
// Deposit Receipt (post-regolith)
|
||||
let expected = ReceiptWithBloom {
|
||||
@@ -689,7 +695,9 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn decode_deposit_receipt_canyon_roundtrip() {
|
||||
let data = hex!("b901117ef9010d0182b741b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0833d3bbf01");
|
||||
let data = hex!(
|
||||
"b901117ef9010d0182b741b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0833d3bbf01"
|
||||
);
|
||||
|
||||
// Deposit Receipt (post-regolith)
|
||||
let expected = ReceiptWithBloom {
|
||||
|
||||
@@ -281,12 +281,16 @@ mod test {
|
||||
/// OP Mainnet transaction at index 0 in block 124665056.
|
||||
///
|
||||
/// <https://optimistic.etherscan.io/tx/0x312e290cf36df704a2217b015d6455396830b0ce678b860ebfcc30f41403d7b1>
|
||||
const TX_SET_L1_BLOCK_OP_MAINNET_BLOCK_124665056: [u8; 251] = hex!("7ef8f8a0683079df94aa5b9cf86687d739a60a9b4f0835e520ec4d664e2e415dca17a6df94deaddeaddeaddeaddeaddeaddeaddeaddead00019442000000000000000000000000000000000000158080830f424080b8a4440a5e200000146b000f79c500000000000000040000000066d052e700000000013ad8a3000000000000000000000000000000000000000000000000000000003ef1278700000000000000000000000000000000000000000000000000000000000000012fdf87b89884a61e74b322bbcf60386f543bfae7827725efaaf0ab1de2294a590000000000000000000000006887246668a3b87f54deb3b94ba47a6f63f32985");
|
||||
const TX_SET_L1_BLOCK_OP_MAINNET_BLOCK_124665056: [u8; 251] = hex!(
|
||||
"7ef8f8a0683079df94aa5b9cf86687d739a60a9b4f0835e520ec4d664e2e415dca17a6df94deaddeaddeaddeaddeaddeaddeaddeaddead00019442000000000000000000000000000000000000158080830f424080b8a4440a5e200000146b000f79c500000000000000040000000066d052e700000000013ad8a3000000000000000000000000000000000000000000000000000000003ef1278700000000000000000000000000000000000000000000000000000000000000012fdf87b89884a61e74b322bbcf60386f543bfae7827725efaaf0ab1de2294a590000000000000000000000006887246668a3b87f54deb3b94ba47a6f63f32985"
|
||||
);
|
||||
|
||||
/// OP Mainnet transaction at index 1 in block 124665056.
|
||||
///
|
||||
/// <https://optimistic.etherscan.io/tx/0x1059e8004daff32caa1f1b1ef97fe3a07a8cf40508f5b835b66d9420d87c4a4a>
|
||||
const TX_1_OP_MAINNET_BLOCK_124665056: [u8; 1176] = hex!("02f904940a8303fba78401d6d2798401db2b6d830493e0943e6f4f7866654c18f536170780344aa8772950b680b904246a761202000000000000000000000000087000a300de7200382b55d40045000000e5d60e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003a0000000000000000000000000000000000000000000000000000000000000022482ad56cb0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000120000000000000000000000000dc6ff44d5d932cbd77b52e5612ba0529dc6226f1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000044095ea7b300000000000000000000000021c4928109acb0659a88ae5329b5374a3024694c0000000000000000000000000000000000000000000000049b9ca9a6943400000000000000000000000000000000000000000000000000000000000000000000000000000000000021c4928109acb0659a88ae5329b5374a3024694c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000024b6b55f250000000000000000000000000000000000000000000000049b9ca9a694340000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000415ec214a3950bea839a7e6fbb0ba1540ac2076acd50820e2d5ef83d0902cdffb24a47aff7de5190290769c4f0a9c6fabf63012986a0d590b1b571547a8c7050ea1b00000000000000000000000000000000000000000000000000000000000000c080a06db770e6e25a617fe9652f0958bd9bd6e49281a53036906386ed39ec48eadf63a07f47cf51a4a40b4494cf26efc686709a9b03939e20ee27e59682f5faa536667e");
|
||||
const TX_1_OP_MAINNET_BLOCK_124665056: [u8; 1176] = hex!(
|
||||
"02f904940a8303fba78401d6d2798401db2b6d830493e0943e6f4f7866654c18f536170780344aa8772950b680b904246a761202000000000000000000000000087000a300de7200382b55d40045000000e5d60e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003a0000000000000000000000000000000000000000000000000000000000000022482ad56cb0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000120000000000000000000000000dc6ff44d5d932cbd77b52e5612ba0529dc6226f1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000044095ea7b300000000000000000000000021c4928109acb0659a88ae5329b5374a3024694c0000000000000000000000000000000000000000000000049b9ca9a6943400000000000000000000000000000000000000000000000000000000000000000000000000000000000021c4928109acb0659a88ae5329b5374a3024694c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000024b6b55f250000000000000000000000000000000000000000000000049b9ca9a694340000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000415ec214a3950bea839a7e6fbb0ba1540ac2076acd50820e2d5ef83d0902cdffb24a47aff7de5190290769c4f0a9c6fabf63012986a0d590b1b571547a8c7050ea1b00000000000000000000000000000000000000000000000000000000000000c080a06db770e6e25a617fe9652f0958bd9bd6e49281a53036906386ed39ec48eadf63a07f47cf51a4a40b4494cf26efc686709a9b03939e20ee27e59682f5faa536667e"
|
||||
);
|
||||
|
||||
/// Timestamp of OP mainnet block 124665056.
|
||||
///
|
||||
@@ -446,7 +450,9 @@ mod test {
|
||||
#[test]
|
||||
fn base_receipt_gas_fields() {
|
||||
// https://basescan.org/tx/0x510fd4c47d78ba9f97c91b0f2ace954d5384c169c9545a77a373cf3ef8254e6e
|
||||
let system = hex!("7ef8f8a0389e292420bcbf9330741f72074e39562a09ff5a00fd22e4e9eee7e34b81bca494deaddeaddeaddeaddeaddeaddeaddeaddead00019442000000000000000000000000000000000000158080830f424080b8a4440a5e20000008dd00101c120000000000000004000000006721035b00000000014189960000000000000000000000000000000000000000000000000000000349b4dcdc000000000000000000000000000000000000000000000000000000004ef9325cc5991ce750960f636ca2ffbb6e209bb3ba91412f21dd78c14ff154d1930f1f9a0000000000000000000000005050f69a9786f081509234f1a7f4684b5e5b76c9");
|
||||
let system = hex!(
|
||||
"7ef8f8a0389e292420bcbf9330741f72074e39562a09ff5a00fd22e4e9eee7e34b81bca494deaddeaddeaddeaddeaddeaddeaddeaddead00019442000000000000000000000000000000000000158080830f424080b8a4440a5e20000008dd00101c120000000000000004000000006721035b00000000014189960000000000000000000000000000000000000000000000000000000349b4dcdc000000000000000000000000000000000000000000000000000000004ef9325cc5991ce750960f636ca2ffbb6e209bb3ba91412f21dd78c14ff154d1930f1f9a0000000000000000000000005050f69a9786f081509234f1a7f4684b5e5b76c9"
|
||||
);
|
||||
let tx_0 = OpTransactionSigned::decode_2718(&mut &system[..]).unwrap();
|
||||
|
||||
let block: alloy_consensus::Block<OpTransactionSigned> = Block {
|
||||
@@ -457,7 +463,9 @@ mod test {
|
||||
reth_optimism_evm::extract_l1_info(&block.body).expect("should extract l1 info");
|
||||
|
||||
// https://basescan.org/tx/0xf9420cbaf66a2dda75a015488d37262cbfd4abd0aad7bb2be8a63e14b1fa7a94
|
||||
let tx = hex!("02f86c8221058034839a4ae283021528942f16386bb37709016023232523ff6d9daf444be380841249c58bc080a001b927eda2af9b00b52a57be0885e0303c39dd2831732e14051c2336470fd468a0681bf120baf562915841a48601c2b54a6742511e535cf8f71c95115af7ff63bd");
|
||||
let tx = hex!(
|
||||
"02f86c8221058034839a4ae283021528942f16386bb37709016023232523ff6d9daf444be380841249c58bc080a001b927eda2af9b00b52a57be0885e0303c39dd2831732e14051c2336470fd468a0681bf120baf562915841a48601c2b54a6742511e535cf8f71c95115af7ff63bd"
|
||||
);
|
||||
let tx_1 = OpTransactionSigned::decode_2718(&mut &tx[..]).unwrap();
|
||||
|
||||
let receipt_meta = OpReceiptFieldsBuilder::new(1730216981, 21713817)
|
||||
|
||||
@@ -160,7 +160,9 @@ where
|
||||
let call_request = TransactionRequest::default();
|
||||
let transaction_request = TransactionRequest::default();
|
||||
let bytes = Bytes::default();
|
||||
let tx = Bytes::from(hex!("02f871018303579880850555633d1b82520894eee27662c2b8eba3cd936a23f039f3189633e4c887ad591c62bdaeb180c080a07ea72c68abfb8fca1bd964f0f99132ed9280261bdca3e549546c0205e800f7d0a05b4ef3039e9c9b9babc179a1878fb825b5aaf5aed2fa8744854150157b08d6f3"));
|
||||
let tx = Bytes::from(hex!(
|
||||
"02f871018303579880850555633d1b82520894eee27662c2b8eba3cd936a23f039f3189633e4c887ad591c62bdaeb180c080a07ea72c68abfb8fca1bd964f0f99132ed9280261bdca3e549546c0205e800f7d0a05b4ef3039e9c9b9babc179a1878fb825b5aaf5aed2fa8744854150157b08d6f3"
|
||||
));
|
||||
let typed_data = serde_json::from_str(
|
||||
r#"{
|
||||
"types": {
|
||||
|
||||
@@ -839,13 +839,19 @@ mod tests {
|
||||
"0x1a15e3c30cf094a99826869517b16d185d45831d3a494f01030b0001a9d3ebb9"
|
||||
)))
|
||||
.into();
|
||||
assert_eq!(err.message(), "block not found: hash 0x1a15e3c30cf094a99826869517b16d185d45831d3a494f01030b0001a9d3ebb9");
|
||||
assert_eq!(
|
||||
err.message(),
|
||||
"block not found: hash 0x1a15e3c30cf094a99826869517b16d185d45831d3a494f01030b0001a9d3ebb9"
|
||||
);
|
||||
let err: jsonrpsee_types::error::ErrorObject<'static> =
|
||||
EthApiError::HeaderNotFound(BlockId::hash_canonical(b256!(
|
||||
"0x1a15e3c30cf094a99826869517b16d185d45831d3a494f01030b0001a9d3ebb9"
|
||||
)))
|
||||
.into();
|
||||
assert_eq!(err.message(), "block not found: canonical hash 0x1a15e3c30cf094a99826869517b16d185d45831d3a494f01030b0001a9d3ebb9");
|
||||
assert_eq!(
|
||||
err.message(),
|
||||
"block not found: canonical hash 0x1a15e3c30cf094a99826869517b16d185d45831d3a494f01030b0001a9d3ebb9"
|
||||
);
|
||||
let err: jsonrpsee_types::error::ErrorObject<'static> =
|
||||
EthApiError::HeaderNotFound(BlockId::number(100000)).into();
|
||||
assert_eq!(err.message(), "block not found: 0x186a0");
|
||||
|
||||
@@ -31,5 +31,6 @@ pub use jwt_validator::JwtAuthValidator;
|
||||
pub trait AuthValidator {
|
||||
/// This function is invoked by the [`AuthLayer`] to perform validation on Http headers.
|
||||
/// The result conveys validation errors in the form of an Http response.
|
||||
#[expect(clippy::result_large_err)]
|
||||
fn validate(&self, headers: &HeaderMap) -> Result<(), HttpResponse>;
|
||||
}
|
||||
|
||||
@@ -98,7 +98,9 @@ mod tests {
|
||||
);
|
||||
|
||||
// https://etherscan.io/tx/0xa694b71e6c128a2ed8e2e0f6770bddbe52e3bb8f10e8472f9a79ab81497a8b5d
|
||||
let tx_1 = Bytes::from(hex!("02f871018303579880850555633d1b82520894eee27662c2b8eba3cd936a23f039f3189633e4c887ad591c62bdaeb180c080a07ea72c68abfb8fca1bd964f0f99132ed9280261bdca3e549546c0205e800f7d0a05b4ef3039e9c9b9babc179a1878fb825b5aaf5aed2fa8744854150157b08d6f3"));
|
||||
let tx_1 = Bytes::from(hex!(
|
||||
"02f871018303579880850555633d1b82520894eee27662c2b8eba3cd936a23f039f3189633e4c887ad591c62bdaeb180c080a07ea72c68abfb8fca1bd964f0f99132ed9280261bdca3e549546c0205e800f7d0a05b4ef3039e9c9b9babc179a1878fb825b5aaf5aed2fa8744854150157b08d6f3"
|
||||
));
|
||||
|
||||
let tx_1_result = eth_api.send_raw_transaction(tx_1).await.unwrap();
|
||||
assert_eq!(
|
||||
@@ -109,7 +111,9 @@ mod tests {
|
||||
);
|
||||
|
||||
// https://etherscan.io/tx/0x48816c2f32c29d152b0d86ff706f39869e6c1f01dc2fe59a3c1f9ecf39384694
|
||||
let tx_2 = Bytes::from(hex!("02f9043c018202b7843b9aca00850c807d37a08304d21d94ef1c6e67703c7bd7107eed8303fbe6ec2554bf6b881bc16d674ec80000b903c43593564c000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000063e2d99f00000000000000000000000000000000000000000000000000000000000000030b000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000001bc16d674ec80000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000065717fe021ea67801d1088cc80099004b05b64600000000000000000000000000000000000000000000000001bc16d674ec80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002bc02aaa39b223fe8d0a0e5c4f27ead9083c756cc20001f4a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000180000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009e95fd5965fd1f1a6f0d4600000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000428dca9537116148616a5a3e44035af17238fe9dc080a0c6ec1e41f5c0b9511c49b171ad4e04c6bb419c74d99fe9891d74126ec6e4e879a032069a753d7a2cfa158df95421724d24c0e9501593c09905abf3699b4a4405ce"));
|
||||
let tx_2 = Bytes::from(hex!(
|
||||
"02f9043c018202b7843b9aca00850c807d37a08304d21d94ef1c6e67703c7bd7107eed8303fbe6ec2554bf6b881bc16d674ec80000b903c43593564c000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000063e2d99f00000000000000000000000000000000000000000000000000000000000000030b000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000001bc16d674ec80000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000065717fe021ea67801d1088cc80099004b05b64600000000000000000000000000000000000000000000000001bc16d674ec80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002bc02aaa39b223fe8d0a0e5c4f27ead9083c756cc20001f4a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000180000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009e95fd5965fd1f1a6f0d4600000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000428dca9537116148616a5a3e44035af17238fe9dc080a0c6ec1e41f5c0b9511c49b171ad4e04c6bb419c74d99fe9891d74126ec6e4e879a032069a753d7a2cfa158df95421724d24c0e9501593c09905abf3699b4a4405ce"
|
||||
));
|
||||
|
||||
let tx_2_result = eth_api.send_raw_transaction(tx_2).await.unwrap();
|
||||
assert_eq!(
|
||||
|
||||
@@ -300,10 +300,10 @@ impl StageUnitCheckpoint {
|
||||
/// range.
|
||||
pub const fn set_block_range(&mut self, from: u64, to: u64) -> Option<CheckpointBlockRange> {
|
||||
match self {
|
||||
Self::Account(AccountHashingCheckpoint { ref mut block_range, .. }) |
|
||||
Self::Storage(StorageHashingCheckpoint { ref mut block_range, .. }) |
|
||||
Self::Execution(ExecutionCheckpoint { ref mut block_range, .. }) |
|
||||
Self::IndexHistory(IndexHistoryCheckpoint { ref mut block_range, .. }) => {
|
||||
Self::Account(AccountHashingCheckpoint { block_range, .. }) |
|
||||
Self::Storage(StorageHashingCheckpoint { block_range, .. }) |
|
||||
Self::Execution(ExecutionCheckpoint { block_range, .. }) |
|
||||
Self::IndexHistory(IndexHistoryCheckpoint { block_range, .. }) => {
|
||||
let old_range = *block_range;
|
||||
*block_range = CheckpointBlockRange { from, to };
|
||||
|
||||
|
||||
@@ -430,9 +430,15 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_segment_config_backwards() {
|
||||
let headers = hex!("010000000000000000000000000000001fa10700000000000100000000000000001fa10700000000000000000000030000000000000020a107000000000001010000004a02000000000000");
|
||||
let transactions = hex!("010000000000000000000000000000001fa10700000000000100000000000000001fa107000000000001000000000000000034a107000000000001000000010000000000000035a1070000000000004010000000000000");
|
||||
let receipts = hex!("010000000000000000000000000000001fa10700000000000100000000000000000000000000000000000200000001000000000000000000000000000000000000000000000000");
|
||||
let headers = hex!(
|
||||
"010000000000000000000000000000001fa10700000000000100000000000000001fa10700000000000000000000030000000000000020a107000000000001010000004a02000000000000"
|
||||
);
|
||||
let transactions = hex!(
|
||||
"010000000000000000000000000000001fa10700000000000100000000000000001fa107000000000001000000000000000034a107000000000001000000010000000000000035a1070000000000004010000000000000"
|
||||
);
|
||||
let receipts = hex!(
|
||||
"010000000000000000000000000000001fa10700000000000100000000000000000000000000000000000200000001000000000000000000000000000000000000000000000000"
|
||||
);
|
||||
|
||||
{
|
||||
let headers = NippyJar::<SegmentHeader>::load_from_reader(&headers[..]).unwrap();
|
||||
|
||||
@@ -54,8 +54,9 @@ pub(crate) fn generate_flag_struct(
|
||||
total_bytes.into()
|
||||
];
|
||||
|
||||
let docs =
|
||||
format!("Fieldset that facilitates compacting the parent type. Used bytes: {total_bytes} | Unused bits: {unused_bits}");
|
||||
let docs = format!(
|
||||
"Fieldset that facilitates compacting the parent type. Used bytes: {total_bytes} | Unused bits: {unused_bits}"
|
||||
);
|
||||
let bitflag_encoded_bytes = format!("Used bytes by [`{flags_ident}`]");
|
||||
let bitflag_unused_bits = format!("Unused bits for new fields by [`{flags_ident}`]");
|
||||
let impl_bitflag_encoded_bytes = if has_lifetime {
|
||||
|
||||
@@ -90,7 +90,9 @@ pub fn get_fields(data: &Data) -> FieldList {
|
||||
|
||||
match &variant.fields {
|
||||
syn::Fields::Named(_) => {
|
||||
panic!("Not allowed to have Enum Variants with multiple named fields. Make it a struct instead.")
|
||||
panic!(
|
||||
"Not allowed to have Enum Variants with multiple named fields. Make it a struct instead."
|
||||
)
|
||||
}
|
||||
syn::Fields::Unnamed(data_fields) => {
|
||||
assert_eq!(
|
||||
@@ -221,7 +223,7 @@ mod tests {
|
||||
use syn::parse2;
|
||||
|
||||
#[test]
|
||||
fn gen() {
|
||||
fn compact_codec() {
|
||||
let f_struct = quote! {
|
||||
#[derive(Debug, PartialEq, Clone)]
|
||||
pub struct TestStruct {
|
||||
|
||||
@@ -45,11 +45,15 @@ const SOFT_LIMIT_COUNT_FLUSHED_UPDATES: usize = 1_000_000;
|
||||
#[derive(Debug, thiserror::Error, Clone)]
|
||||
pub enum InitStorageError {
|
||||
/// Genesis header found on static files but the database is empty.
|
||||
#[error("static files found, but the database is uninitialized. If attempting to re-syncing, delete both.")]
|
||||
#[error(
|
||||
"static files found, but the database is uninitialized. If attempting to re-syncing, delete both."
|
||||
)]
|
||||
UninitializedDatabase,
|
||||
/// An existing genesis block was found in the database, and its hash did not match the hash of
|
||||
/// the chainspec.
|
||||
#[error("genesis hash in the storage does not match the specified chainspec: chainspec is {chainspec_hash}, database is {storage_hash}")]
|
||||
#[error(
|
||||
"genesis hash in the storage does not match the specified chainspec: chainspec is {chainspec_hash}, database is {storage_hash}"
|
||||
)]
|
||||
GenesisHashMismatch {
|
||||
/// Expected genesis hash.
|
||||
chainspec_hash: B256,
|
||||
|
||||
@@ -240,9 +240,9 @@ impl<K: TransactionKind> MetricsHandler<K> {
|
||||
self.backtrace_recorded.store(true, Ordering::Relaxed);
|
||||
#[cfg(debug_assertions)]
|
||||
let message = format!(
|
||||
"The database read transaction has been open for too long. Open backtrace:\n{}\n\nCurrent backtrace:\n{}",
|
||||
self.open_backtrace,
|
||||
Backtrace::force_capture()
|
||||
"The database read transaction has been open for too long. Open backtrace:\n{}\n\nCurrent backtrace:\n{}",
|
||||
self.open_backtrace,
|
||||
Backtrace::force_capture()
|
||||
);
|
||||
#[cfg(not(debug_assertions))]
|
||||
let message = format!(
|
||||
|
||||
@@ -39,7 +39,9 @@ pub enum ProviderError {
|
||||
BlockBodyIndicesNotFound(BlockNumber),
|
||||
/// The transition ID was found for the given address and storage key, but the changeset was
|
||||
/// not found.
|
||||
#[error("storage change set for address {address} and key {storage_key} at block #{block_number} does not exist")]
|
||||
#[error(
|
||||
"storage change set for address {address} and key {storage_key} at block #{block_number} does not exist"
|
||||
)]
|
||||
StorageChangesetNotFound {
|
||||
/// The block number found for the address and storage key.
|
||||
block_number: BlockNumber,
|
||||
|
||||
@@ -88,7 +88,9 @@ pub enum Error {
|
||||
BadSignature,
|
||||
/// Database should be recovered, but cannot be done automatically since it's in read-only
|
||||
/// mode.
|
||||
#[error("database should be recovered, but cannot be done automatically since it's in read-only mode")]
|
||||
#[error(
|
||||
"database should be recovered, but cannot be done automatically since it's in read-only mode"
|
||||
)]
|
||||
WannaRecovery,
|
||||
/// The given key value is mismatched to the current cursor position.
|
||||
#[error("the given key value is mismatched to the current cursor position")]
|
||||
@@ -97,7 +99,9 @@ pub enum Error {
|
||||
#[error("invalid parameter specified")]
|
||||
DecodeError,
|
||||
/// The environment opened in read-only.
|
||||
#[error("the environment opened in read-only, check <https://reth.rs/run/troubleshooting.html> for more")]
|
||||
#[error(
|
||||
"the environment opened in read-only, check <https://reth.rs/run/troubleshooting.html> for more"
|
||||
)]
|
||||
Access,
|
||||
/// Database is too large for the current system.
|
||||
#[error("database is too large for the current system")]
|
||||
|
||||
@@ -371,6 +371,8 @@ impl PartialEq for ZstdDictionary<'_> {
|
||||
if let (Self::Raw(a), Self::Raw(b)) = (self, &other) {
|
||||
return a == b
|
||||
}
|
||||
unimplemented!("`DecoderDictionary` can't be compared. So comparison should be done after decompressing a value.");
|
||||
unimplemented!(
|
||||
"`DecoderDictionary` can't be compared. So comparison should be done after decompressing a value."
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -434,7 +434,7 @@ mod tests {
|
||||
let mut vec: Vec<u8> = vec![0; value_length];
|
||||
let mut rng = seed.map(SmallRng::seed_from_u64).unwrap_or_else(SmallRng::from_os_rng);
|
||||
|
||||
let mut gen = || {
|
||||
let mut entry_gen = || {
|
||||
(0..num_rows)
|
||||
.map(|_| {
|
||||
rng.fill_bytes(&mut vec[..]);
|
||||
@@ -443,7 +443,7 @@ mod tests {
|
||||
.collect()
|
||||
};
|
||||
|
||||
(gen(), gen())
|
||||
(entry_gen(), entry_gen())
|
||||
}
|
||||
|
||||
fn clone_with_result(col: &ColumnValues) -> ColumnResults<Vec<u8>> {
|
||||
|
||||
@@ -88,7 +88,9 @@ fn generate_many_transactions(
|
||||
|
||||
/// Benchmarks all pool types for the truncate function.
|
||||
fn benchmark_pools(group: &mut BenchmarkGroup<'_, WallTime>, senders: usize, max_depth: usize) {
|
||||
println!("Generating transactions for benchmark with {senders} unique senders and a max depth of {max_depth}...");
|
||||
println!(
|
||||
"Generating transactions for benchmark with {senders} unique senders and a max depth of {max_depth}..."
|
||||
);
|
||||
let txs = generate_many_transactions(senders, max_depth, false);
|
||||
|
||||
// benchmark parked pool
|
||||
|
||||
@@ -575,7 +575,6 @@ fn load_accounts<Client, I>(
|
||||
) -> Result<LoadedAccounts, Box<(HashSet<Address>, ProviderError)>>
|
||||
where
|
||||
I: IntoIterator<Item = Address>,
|
||||
|
||||
Client: StateProviderFactory,
|
||||
{
|
||||
let addresses = addresses.into_iter();
|
||||
@@ -739,7 +738,9 @@ mod tests {
|
||||
async fn test_save_local_txs_backup() {
|
||||
let temp_dir = tempfile::tempdir().unwrap();
|
||||
let transactions_path = temp_dir.path().join(FILENAME).with_extension(EXTENSION);
|
||||
let tx_bytes = hex!("02f87201830655c2808505ef61f08482565f94388c818ca8b9251b393131c08a736a67ccb192978801049e39c4b5b1f580c001a01764ace353514e8abdfb92446de356b260e3c1225b73fc4c8876a6258d12a129a04f02294aa61ca7676061cd99f29275491218b4754b46a0248e5e42bc5091f507");
|
||||
let tx_bytes = hex!(
|
||||
"02f87201830655c2808505ef61f08482565f94388c818ca8b9251b393131c08a736a67ccb192978801049e39c4b5b1f580c001a01764ace353514e8abdfb92446de356b260e3c1225b73fc4c8876a6258d12a129a04f02294aa61ca7676061cd99f29275491218b4754b46a0248e5e42bc5091f507"
|
||||
);
|
||||
let tx = PooledTransaction::decode_2718(&mut &tx_bytes[..]).unwrap();
|
||||
let provider = MockEthProvider::default();
|
||||
let transaction = EthPooledTransaction::from_pooled(tx.try_into_recovered().unwrap());
|
||||
|
||||
@@ -1042,7 +1042,11 @@ impl<T: TransactionOrdering> TxPool<T> {
|
||||
pub fn assert_invariants(&self) {
|
||||
let size = self.size();
|
||||
let actual = size.basefee + size.pending + size.queued + size.blob;
|
||||
assert_eq!(size.total, actual, "total size must be equal to the sum of all sub-pools, basefee:{}, pending:{}, queued:{}, blob:{}", size.basefee, size.pending, size.queued, size.blob);
|
||||
assert_eq!(
|
||||
size.total, actual,
|
||||
"total size must be equal to the sum of all sub-pools, basefee:{}, pending:{}, queued:{}, blob:{}",
|
||||
size.basefee, size.pending, size.queued, size.blob
|
||||
);
|
||||
self.all_transactions.assert_invariants();
|
||||
self.pending_pool.assert_invariants();
|
||||
self.basefee_pool.assert_invariants();
|
||||
@@ -1308,7 +1312,7 @@ impl<T: PoolTransaction> AllTransactions<T> {
|
||||
let mut next_nonce_in_line = tx.transaction.nonce().saturating_add(1);
|
||||
|
||||
// Update all consecutive transaction of this sender
|
||||
while let Some((peek, ref mut tx)) = iter.peek_mut() {
|
||||
while let Some((peek, tx)) = iter.peek_mut() {
|
||||
if peek.sender != id.sender {
|
||||
// Found the next sender we need to check
|
||||
continue 'transactions
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
use crate::{blobstore::InMemoryBlobStore, noop::MockTransactionValidator, Pool, PoolConfig};
|
||||
use std::ops::Deref;
|
||||
|
||||
mod gen;
|
||||
pub use gen::*;
|
||||
mod tx_gen;
|
||||
pub use tx_gen::*;
|
||||
|
||||
mod mock;
|
||||
pub use mock::*;
|
||||
|
||||
@@ -365,8 +365,8 @@ mod tests {
|
||||
#[test]
|
||||
fn test_generate_transaction() {
|
||||
let rng = rng();
|
||||
let mut gen = TransactionGenerator::new(rng);
|
||||
let _tx = gen.transaction().into_legacy();
|
||||
let _tx = gen.transaction().into_eip1559();
|
||||
let mut tx_gen = TransactionGenerator::new(rng);
|
||||
let _tx = tx_gen.transaction().into_legacy();
|
||||
let _tx = tx_gen.transaction().into_eip1559();
|
||||
}
|
||||
}
|
||||
@@ -111,7 +111,12 @@ async fn only_blobs_eviction() {
|
||||
|
||||
// ensure that this is only returned when the sender is over the
|
||||
// pool limit per account
|
||||
assert!(i + 1 >= pool_config.max_account_slots, "Spammer exceeded capacity, but it shouldn't have. Max accounts slots: {}, current txs by sender: {}", pool_config.max_account_slots, i + 1);
|
||||
assert!(
|
||||
i + 1 >= pool_config.max_account_slots,
|
||||
"Spammer exceeded capacity, but it shouldn't have. Max accounts slots: {}, current txs by sender: {}",
|
||||
pool_config.max_account_slots,
|
||||
i + 1
|
||||
);
|
||||
// at this point we know that the sender has been limited, so we
|
||||
// keep going
|
||||
}
|
||||
@@ -218,7 +223,12 @@ async fn mixed_eviction() {
|
||||
|
||||
// ensure that this is only returned when the sender is over the
|
||||
// pool limit per account
|
||||
assert!(i + 1 >= pool_config.max_account_slots, "Spammer exceeded capacity, but it shouldn't have. Max accounts slots: {}, current txs by sender: {}", pool_config.max_account_slots, i + 1);
|
||||
assert!(
|
||||
i + 1 >= pool_config.max_account_slots,
|
||||
"Spammer exceeded capacity, but it shouldn't have. Max accounts slots: {}, current txs by sender: {}",
|
||||
pool_config.max_account_slots,
|
||||
i + 1
|
||||
);
|
||||
}
|
||||
_ => panic!("Failed to insert tx into pool with unexpected error: {e}"),
|
||||
}
|
||||
@@ -326,7 +336,12 @@ async fn nonce_gaps_eviction() {
|
||||
|
||||
// ensure that this is only returned when the sender is over the
|
||||
// pool limit per account
|
||||
assert!(i + 1 >= pool_config.max_account_slots, "Spammer exceeded capacity, but it shouldn't have. Max accounts slots: {}, current txs by sender: {}", pool_config.max_account_slots, i + 1);
|
||||
assert!(
|
||||
i + 1 >= pool_config.max_account_slots,
|
||||
"Spammer exceeded capacity, but it shouldn't have. Max accounts slots: {}, current txs by sender: {}",
|
||||
pool_config.max_account_slots,
|
||||
i + 1
|
||||
);
|
||||
}
|
||||
_ => panic!("Failed to insert tx into pool with unexpected error: {e}"),
|
||||
}
|
||||
|
||||
@@ -617,6 +617,7 @@ impl AccountProof {
|
||||
}
|
||||
|
||||
/// Verify the storage proofs and account proof against the provided state root.
|
||||
#[expect(clippy::result_large_err)]
|
||||
pub fn verify(&self, root: B256) -> Result<(), ProofVerificationError> {
|
||||
// Verify storage proofs.
|
||||
for storage_proof in &self.storage_proofs {
|
||||
@@ -710,6 +711,7 @@ impl StorageProof {
|
||||
}
|
||||
|
||||
/// Verify the proof against the provided storage root.
|
||||
#[expect(clippy::result_large_err)]
|
||||
pub fn verify(&self, root: B256) -> Result<(), ProofVerificationError> {
|
||||
let expected =
|
||||
if self.value.is_zero() { None } else { Some(encode_fixed_size(&self.value).to_vec()) };
|
||||
|
||||
@@ -50,8 +50,8 @@ fn testspec_proofs() {
|
||||
convert_to_proof([
|
||||
"0xe48200a7a040f916999be583c572cc4dd369ec53b0a99f7de95f13880cf203d98f935ed1b3",
|
||||
"0xf87180a04fb9bab4bb88c062f32452b7c94c8f64d07b5851d44a39f1e32ba4b1829fdbfb8080808080a0b61eeb2eb82808b73c4ad14140a2836689f4ab8445d69dd40554eaf1fce34bc080808080808080a0dea230ff2026e65de419288183a340125b04b8405cc61627b3b4137e2260a1e880",
|
||||
"0xf8719f31355ec1c8f7e26bb3ccbcb0b75d870d15846c0b98e5cc452db46c37faea40b84ff84d80890270801d946c940000a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470"
|
||||
])
|
||||
"0xf8719f31355ec1c8f7e26bb3ccbcb0b75d870d15846c0b98e5cc452db46c37faea40b84ff84d80890270801d946c940000a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",
|
||||
]),
|
||||
),
|
||||
(
|
||||
"0x33f0fc440b8477fcfbe9d0bf8649e7dea9baedb2",
|
||||
@@ -60,16 +60,16 @@ fn testspec_proofs() {
|
||||
"0xf87180a04fb9bab4bb88c062f32452b7c94c8f64d07b5851d44a39f1e32ba4b1829fdbfb8080808080a0b61eeb2eb82808b73c4ad14140a2836689f4ab8445d69dd40554eaf1fce34bc080808080808080a0dea230ff2026e65de419288183a340125b04b8405cc61627b3b4137e2260a1e880",
|
||||
"0xe48200d3a0ef957210bca5b9b402d614eb8408c88cfbf4913eb6ab83ca233c8b8f0e626b54",
|
||||
"0xf851808080a02743a5addaf4cf9b8c0c073e1eaa555deaaf8c41cb2b41958e88624fa45c2d908080808080a0bfbf6937911dfb88113fecdaa6bde822e4e99dae62489fcf61a91cb2f36793d680808080808080",
|
||||
"0xf8679e207781e762f3577784bab7491fcc43e291ce5a356b9bc517ac52eed3a37ab846f8448001a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470"
|
||||
])
|
||||
"0xf8679e207781e762f3577784bab7491fcc43e291ce5a356b9bc517ac52eed3a37ab846f8448001a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",
|
||||
]),
|
||||
),
|
||||
(
|
||||
"0x62b0dd4aab2b1a0a04e279e2b828791a10755528",
|
||||
convert_to_proof([
|
||||
"0xe48200a7a040f916999be583c572cc4dd369ec53b0a99f7de95f13880cf203d98f935ed1b3",
|
||||
"0xf87180a04fb9bab4bb88c062f32452b7c94c8f64d07b5851d44a39f1e32ba4b1829fdbfb8080808080a0b61eeb2eb82808b73c4ad14140a2836689f4ab8445d69dd40554eaf1fce34bc080808080808080a0dea230ff2026e65de419288183a340125b04b8405cc61627b3b4137e2260a1e880",
|
||||
"0xf8709f3936599f93b769acf90c7178fd2ddcac1b5b4bc9949ee5a04b7e0823c2446eb84ef84c80880f43fc2c04ee0000a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470"
|
||||
])
|
||||
"0xf8709f3936599f93b769acf90c7178fd2ddcac1b5b4bc9949ee5a04b7e0823c2446eb84ef84c80880f43fc2c04ee0000a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",
|
||||
]),
|
||||
),
|
||||
(
|
||||
"0x1ed9b1dd266b607ee278726d324b855a093394a6",
|
||||
@@ -78,8 +78,8 @@ fn testspec_proofs() {
|
||||
"0xf87180a04fb9bab4bb88c062f32452b7c94c8f64d07b5851d44a39f1e32ba4b1829fdbfb8080808080a0b61eeb2eb82808b73c4ad14140a2836689f4ab8445d69dd40554eaf1fce34bc080808080808080a0dea230ff2026e65de419288183a340125b04b8405cc61627b3b4137e2260a1e880",
|
||||
"0xe48200d3a0ef957210bca5b9b402d614eb8408c88cfbf4913eb6ab83ca233c8b8f0e626b54",
|
||||
"0xf851808080a02743a5addaf4cf9b8c0c073e1eaa555deaaf8c41cb2b41958e88624fa45c2d908080808080a0bfbf6937911dfb88113fecdaa6bde822e4e99dae62489fcf61a91cb2f36793d680808080808080",
|
||||
"0xf86f9e207a32b8ab5eb4b043c65b1f00c93f517bc8883c5cd31baf8e8a279475e3b84ef84c808801aa535d3d0c0000a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470"
|
||||
])
|
||||
"0xf86f9e207a32b8ab5eb4b043c65b1f00c93f517bc8883c5cd31baf8e8a279475e3b84ef84c808801aa535d3d0c0000a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",
|
||||
]),
|
||||
),
|
||||
]);
|
||||
|
||||
@@ -137,7 +137,7 @@ fn mainnet_genesis_account_proof() {
|
||||
"0xf90211a0dae48f5b47930c28bb116fbd55e52cd47242c71bf55373b55eb2805ee2e4a929a00f1f37f337ec800e2e5974e2e7355f10f1a4832b39b846d916c3597a460e0676a0da8f627bb8fbeead17b318e0a8e4f528db310f591bb6ab2deda4a9f7ca902ab5a0971c662648d58295d0d0aa4b8055588da0037619951217c22052802549d94a2fa0ccc701efe4b3413fd6a61a6c9f40e955af774649a8d9fd212d046a5a39ddbb67a0d607cdb32e2bd635ee7f2f9e07bc94ddbd09b10ec0901b66628e15667aec570ba05b89203dc940e6fa70ec19ad4e01d01849d3a5baa0a8f9c0525256ed490b159fa0b84227d48df68aecc772939a59afa9e1a4ab578f7b698bdb1289e29b6044668ea0fd1c992070b94ace57e48cbf6511a16aa770c645f9f5efba87bbe59d0a042913a0e16a7ccea6748ae90de92f8aef3b3dc248a557b9ac4e296934313f24f7fced5fa042373cf4a00630d94de90d0a23b8f38ced6b0f7cb818b8925fee8f0c2a28a25aa05f89d2161c1741ff428864f7889866484cef622de5023a46e795dfdec336319fa07597a017664526c8c795ce1da27b8b72455c49657113e0455552dbc068c5ba31a0d5be9089012fda2c585a1b961e988ea5efcd3a06988e150a8682091f694b37c5a0f7b0352e38c315b2d9a14d51baea4ddee1770974c806e209355233c3c89dce6ea049bf6e8df0acafd0eff86defeeb305568e44d52d2235cf340ae15c6034e2b24180",
|
||||
"0xf901f1a0cf67e0f5d5f8d70e53a6278056a14ddca46846f5ef69c7bde6810d058d4a9eda80a06732ada65afd192197fe7ce57792a7f25d26978e64e954b7b84a1f7857ac279da05439f8d011683a6fc07efb90afca198fd7270c795c835c7c85d91402cda992eaa0449b93033b6152d289045fdb0bf3f44926f831566faa0e616b7be1abaad2cb2da031be6c3752bcd7afb99b1bb102baf200f8567c394d464315323a363697646616a0a40e3ed11d906749aa501279392ffde868bd35102db41364d9c601fd651f974aa0044bfa4fe8dd1a58e6c7144da79326e94d1331c0b00373f6ae7f3662f45534b7a098005e3e48db68cb1dc9b9f034ff74d2392028ddf718b0f2084133017da2c2e7a02a62bc40414ee95b02e202a9e89babbabd24bef0abc3fc6dcd3e9144ceb0b725a0239facd895bbf092830390a8676f34b35b29792ae561f196f86614e0448a5792a0a4080f88925daff6b4ce26d188428841bd65655d8e93509f2106020e76d41eefa04918987904be42a6894256ca60203283d1b89139cf21f09f5719c44b8cdbb8f7a06201fc3ef0827e594d953b5e3165520af4fceb719e11cc95fd8d3481519bfd8ca05d0e353d596bd725b09de49c01ede0f29023f0153d7b6d401556aeb525b2959ba0cd367d0679950e9c5f2aa4298fd4b081ade2ea429d71ff390c50f8520e16e30880",
|
||||
"0xf87180808080808080a0dbee8b33c73b86df839f309f7ac92eee19836e08b39302ffa33921b3c6a09f66a06068b283d51aeeee682b8fb5458354315d0b91737441ede5e137c18b4775174a8080808080a0fe7779c7d58c2fda43eba0a6644043c86ebb9ceb4836f89e30831f23eb059ece8080",
|
||||
"0xf8719f20b71c90b0d523dd5004cf206f325748da347685071b34812e21801f5270c4b84ff84d80890ad78ebc5ac6200000a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470"
|
||||
"0xf8719f20b71c90b0d523dd5004cf206f325748da347685071b34812e21801f5270c4b84ff84d80890ad78ebc5ac6200000a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",
|
||||
]);
|
||||
|
||||
let provider = factory.provider().unwrap();
|
||||
@@ -160,7 +160,7 @@ fn mainnet_genesis_account_proof_nonexistent() {
|
||||
let expected_account_proof = convert_to_proof([
|
||||
"0xf90211a090dcaf88c40c7bbc95a912cbdde67c175767b31173df9ee4b0d733bfdd511c43a0babe369f6b12092f49181ae04ca173fb68d1a5456f18d20fa32cba73954052bda0473ecf8a7e36a829e75039a3b055e51b8332cbf03324ab4af2066bbd6fbf0021a0bbda34753d7aa6c38e603f360244e8f59611921d9e1f128372fec0d586d4f9e0a04e44caecff45c9891f74f6a2156735886eedf6f1a733628ebc802ec79d844648a0a5f3f2f7542148c973977c8a1e154c4300fec92f755f7846f1b734d3ab1d90e7a0e823850f50bf72baae9d1733a36a444ab65d0a6faaba404f0583ce0ca4dad92da0f7a00cbe7d4b30b11faea3ae61b7f1f2b315b61d9f6bd68bfe587ad0eeceb721a07117ef9fc932f1a88e908eaead8565c19b5645dc9e5b1b6e841c5edbdfd71681a069eb2de283f32c11f859d7bcf93da23990d3e662935ed4d6b39ce3673ec84472a0203d26456312bbc4da5cd293b75b840fc5045e493d6f904d180823ec22bfed8ea09287b5c21f2254af4e64fca76acc5cd87399c7f1ede818db4326c98ce2dc2208a06fc2d754e304c48ce6a517753c62b1a9c1d5925b89707486d7fc08919e0a94eca07b1c54f15e299bd58bdfef9741538c7828b5d7d11a489f9c20d052b3471df475a051f9dd3739a927c89e357580a4c97b40234aa01ed3d5e0390dc982a7975880a0a089d613f26159af43616fd9455bb461f4869bfede26f2130835ed067a8b967bfb80",
|
||||
"0xf90211a0586b1ddec8db4824154209d355a1989b6c43aa69aba36e9d70c9faa53e7452baa0f86db47d628c73764d74b9ccaed73b8486d97a7731d57008fc9efaf417411860a0d9faed7b9ea107b5d98524246c977e782377f976e34f70717e8b1207f2f9b981a00218f59ccedf797c95e27c56405b9bf16845050fb43e773b66b26bc6992744f5a0dbf396f480c4e024156644adea7c331688d03742369e9d87ab8913bc439ff975a0aced524f39b22c62a5be512ddbca89f0b89b47c311065ccf423dee7013c7ea83a0c06b05f80b237b403adc019c0bc95b5de935021b14a75cbc18509eec60dfd83aa085339d45c4a52b7d523c301701f1ab339964e9c907440cff0a871c98dcf8811ea03ae9f6b8e227ec9be9461f0947b01696f78524c4519a6dee9fba14d209952cf9a0af17f551f9fa1ba4be41d0b342b160e2e8468d7e98a65a2dbf9d5fe5d6928024a0b850ac3bc03e9a309cc59ce5f1ab8db264870a7a22786081753d1db91897b8e6a09e796a4904bd78cb2655b5f346c94350e2d5f0dbf2bc00ac00871cd7ba46b241a0f6f0377427b900529caf32abf32ba1eb93f5f70153aa50b90bf55319a434c252a0725eaf27c8ee07e9b2511a6d6a0d71c649d855e8a9ed26e667903e2e94ae47cba0e4139fb48aa1a524d47f6e0df80314b88b52202d7e853da33c276aa8572283a8a05e9003d54a45935fdebae3513dc7cd16626dc05e1d903ae7f47f1a35aa6e234580",
|
||||
"0xf901d1a0b7c55b381eb205712a2f5d1b7d6309ac725da79ab159cb77dc2783af36e6596da0b3b48aa390e0f3718b486ccc32b01682f92819e652315c1629058cd4d9bb1545a0e3c0cc68af371009f14416c27e17f05f4f696566d2ba45362ce5711d4a01d0e4a0bad1e085e431b510508e2a9e3712633a414b3fe6fd358635ab206021254c1e10a0f8407fe8d5f557b9e012d52e688139bd932fec40d48630d7ff4204d27f8cc68da08c6ca46eff14ad4950e65469c394ca9d6b8690513b1c1a6f91523af00082474c80a0630c034178cb1290d4d906edf28688804d79d5e37a3122c909adab19ac7dc8c5a059f6d047c5d1cc75228c4517a537763cb410c38554f273e5448a53bc3c7166e7a0d842f53ce70c3aad1e616fa6485d3880d15c936fcc306ec14ae35236e5a60549a0218ee2ee673c69b4e1b953194b2568157a69085b86e4f01644fa06ab472c6cf9a016a35a660ea496df7c0da646378bfaa9562f401e42a5c2fe770b7bbe22433585a0dd0fbbe227a4d50868cdbb3107573910fd97131ea8d835bef81d91a2fc30b175a06aafa3d78cf179bf055bd5ec629be0ff8352ce0aec9125a4d75be3ee7eb71f10a01d6817ef9f64fcbb776ff6df0c83138dcd2001bd752727af3e60f4afc123d8d58080"
|
||||
"0xf901d1a0b7c55b381eb205712a2f5d1b7d6309ac725da79ab159cb77dc2783af36e6596da0b3b48aa390e0f3718b486ccc32b01682f92819e652315c1629058cd4d9bb1545a0e3c0cc68af371009f14416c27e17f05f4f696566d2ba45362ce5711d4a01d0e4a0bad1e085e431b510508e2a9e3712633a414b3fe6fd358635ab206021254c1e10a0f8407fe8d5f557b9e012d52e688139bd932fec40d48630d7ff4204d27f8cc68da08c6ca46eff14ad4950e65469c394ca9d6b8690513b1c1a6f91523af00082474c80a0630c034178cb1290d4d906edf28688804d79d5e37a3122c909adab19ac7dc8c5a059f6d047c5d1cc75228c4517a537763cb410c38554f273e5448a53bc3c7166e7a0d842f53ce70c3aad1e616fa6485d3880d15c936fcc306ec14ae35236e5a60549a0218ee2ee673c69b4e1b953194b2568157a69085b86e4f01644fa06ab472c6cf9a016a35a660ea496df7c0da646378bfaa9562f401e42a5c2fe770b7bbe22433585a0dd0fbbe227a4d50868cdbb3107573910fd97131ea8d835bef81d91a2fc30b175a06aafa3d78cf179bf055bd5ec629be0ff8352ce0aec9125a4d75be3ee7eb71f10a01d6817ef9f64fcbb776ff6df0c83138dcd2001bd752727af3e60f4afc123d8d58080",
|
||||
]);
|
||||
|
||||
let provider = factory.provider().unwrap();
|
||||
@@ -195,7 +195,7 @@ fn holesky_deposit_contract_proof() {
|
||||
// `cast proof 0x4242424242424242424242424242424242424242 0x22 0x23 0x24 0x100 --block 0`
|
||||
let expected = AccountProof {
|
||||
address: target,
|
||||
info: Some(Account {
|
||||
info: Some(Account {
|
||||
balance: U256::ZERO,
|
||||
nonce: 0,
|
||||
bytecode_hash: Some(b256!("0x2034f79e0e33b0ae6bef948532021baceb116adf2616478703bec6b17329f1cc"))
|
||||
@@ -204,38 +204,47 @@ fn holesky_deposit_contract_proof() {
|
||||
proof: convert_to_proof([
|
||||
"0xf90211a0ea92fb71507739d5afe328d607b2c5e98322b7aa7cdfeccf817543058b54af70a0bd0c2525b5bee47abf7120c9e01ec3249699d687f80ebb96ed9ad9de913dbab0a0ab4b14b89416eb23c6b64204fa45cfcb39d4220016a9cd0815ebb751fe45eb71a0986ae29c2148b9e61f9a7543f44a1f8d029f1c5095b359652e9ec94e64b5d393a0555d54aa23ed990b0488153418637df7b2c878b604eb761aa2673b609937b0eba0140afb6a3909cc6047b3d44af13fc83f161a7e4c4ddba430a2841862912eb222a031b1185c1f455022d9e42ce04a71f174eb9441b1ada67449510500f4d85b3b22a051ecd01e18113b23cc65e62f67d69b33ee15d20bf81a6b524f7df90ded00ca15a0703769d6a7befad000bc2b4faae3e41b809b1b1241fe2964262554e7e3603488a0e5de7f600e4e6c3c3e5630e0c66f50506a17c9715642fccb63667e81397bbf93a095f783cd1d464a60e3c8adcadc28c6eb9fec7306664df39553be41dccc909606a04225fda3b89f0c59bf40129d1d5e5c3bf67a2129f0c55e53ffdd2cebf185d644a078e0f7fd3ae5a9bc90f66169614211b48fe235eb64818b3935d3e69c53523b9aa0a870e00e53ebaa1e9ec16e5f36606fd7d21d3a3c96894c0a2a23550949d4fdf7a0809226b69cee1f4f22ced1974e7805230da1909036a49a7652428999431afac2a0f11593b2407e86e11997325d8df2d22d937bbe0aef8302ba40c6be0601b04fc380",
|
||||
"0xf901f1a09da7d9755fe0c558b3c3de9fdcdf9f28ae641f38c9787b05b73ab22ae53af3e2a0d9990bf0b810d1145ecb2b011fd68c63cc85564e6724166fd4a9520180706e5fa05f5f09855df46330aa310e8d6be5fb82d1a4b975782d9b29acf06ac8d3e72b1ca0ca976997ddaf06f18992f6207e4f6a05979d07acead96568058789017cc6d06ba04d78166b48044fdc28ed22d2fd39c8df6f8aaa04cb71d3a17286856f6893ff83a004f8c7cc4f1335182a1709fb28fc67d52e59878480210abcba864d5d1fd4a066a0fc3b71c33e2e6b77c5e494c1db7fdbb447473f003daf378c7a63ba9bf3f0049d80a07b8e7a21c1178d28074f157b50fca85ee25c12568ff8e9706dcbcdacb77bf854a0973274526811393ea0bf4811ca9077531db00d06b86237a2ecd683f55ba4bcb0a03a93d726d7487874e51b52d8d534c63aa2a689df18e3b307c0d6cb0a388b00f3a06aa67101d011d1c22fe739ef83b04b5214a3e2f8e1a2625d8bfdb116b447e86fa02dd545b33c62d33a183e127a08a4767fba891d9f3b94fc20a2ca02600d6d1fffa0f3b039a4f32349e85c782d1164c1890e5bf16badc9ee4cf827db6afd2229dde6a0d9240a9d2d5851d05a97ff3305334dfdb0101e1e321fc279d2bb3cad6afa8fc8a01b69c6ab5173de8a8ec53a6ebba965713a4cc7feb86cb3e230def37c230ca2b280",
|
||||
"0xf869a0202a47fc6863b89a6b51890ef3c1550d560886c027141d2058ba1e2d4c66d99ab846f8448080a0556a482068355939c95a3412bdb21213a301483edb1b64402fb66ac9f3583599a02034f79e0e33b0ae6bef948532021baceb116adf2616478703bec6b17329f1cc"
|
||||
"0xf869a0202a47fc6863b89a6b51890ef3c1550d560886c027141d2058ba1e2d4c66d99ab846f8448080a0556a482068355939c95a3412bdb21213a301483edb1b64402fb66ac9f3583599a02034f79e0e33b0ae6bef948532021baceb116adf2616478703bec6b17329f1cc",
|
||||
]),
|
||||
storage_proofs: Vec::from([
|
||||
StorageProof {
|
||||
key: slot_22,
|
||||
nibbles: Nibbles::unpack(keccak256(slot_22)),
|
||||
value: U256::from_str("0xf5a5fd42d16a20302798ef6ed309979b43003d2320d9f0e8ea9831a92759fb4b").unwrap(),
|
||||
value: U256::from_str(
|
||||
"0xf5a5fd42d16a20302798ef6ed309979b43003d2320d9f0e8ea9831a92759fb4b",
|
||||
)
|
||||
.unwrap(),
|
||||
proof: convert_to_proof([
|
||||
"0xf9019180a0aafd5b14a6edacd149e110ba6776a654f2dbffca340902be933d011113f2750380a0a502c93b1918c4c6534d4593ae03a5a23fa10ebc30ffb7080b297bff2446e42da02eb2bf45fd443bd1df8b6f9c09726a4c6252a0f7896a131a081e39a7f644b38980a0a9cf7f673a0bce76fd40332afe8601542910b48dea44e93933a3e5e930da5d19a0ddf79db0a36d0c8134ba143bcb541cd4795a9a2bae8aca0ba24b8d8963c2a77da0b973ec0f48f710bf79f63688485755cbe87f9d4c68326bb83c26af620802a80ea0f0855349af6bf84afc8bca2eda31c8ef8c5139be1929eeb3da4ba6b68a818cb0a0c271e189aeeb1db5d59d7fe87d7d6327bbe7cfa389619016459196497de3ccdea0e7503ba5799e77aa31bbe1310c312ca17b2c5bcc8fa38f266675e8f154c2516ba09278b846696d37213ab9d20a5eb42b03db3173ce490a2ef3b2f3b3600579fc63a0e9041059114f9c910adeca12dbba1fef79b2e2c8899f2d7213cd22dfe4310561a047c59da56bb2bf348c9dd2a2e8f5538a92b904b661cfe54a4298b85868bbe4858080",
|
||||
"0xf85180a0776aa456ba9c5008e03b82b841a9cf2fc1e8578cfacd5c9015804eae315f17fb80808080808080808080808080a072e3e284d47badbb0a5ca1421e1179d3ea90cc10785b26b74fb8a81f0f9e841880",
|
||||
"0xf843a020035b26e3e9eee00e0d72fd1ee8ddca6894550dca6916ea2ac6baa90d11e510a1a0f5a5fd42d16a20302798ef6ed309979b43003d2320d9f0e8ea9831a92759fb4b"
|
||||
])
|
||||
"0xf843a020035b26e3e9eee00e0d72fd1ee8ddca6894550dca6916ea2ac6baa90d11e510a1a0f5a5fd42d16a20302798ef6ed309979b43003d2320d9f0e8ea9831a92759fb4b",
|
||||
]),
|
||||
},
|
||||
StorageProof {
|
||||
key: slot_23,
|
||||
nibbles: Nibbles::unpack(keccak256(slot_23)),
|
||||
value: U256::from_str("0xdb56114e00fdd4c1f85c892bf35ac9a89289aaecb1ebd0a96cde606a748b5d71").unwrap(),
|
||||
value: U256::from_str(
|
||||
"0xdb56114e00fdd4c1f85c892bf35ac9a89289aaecb1ebd0a96cde606a748b5d71",
|
||||
)
|
||||
.unwrap(),
|
||||
proof: convert_to_proof([
|
||||
"0xf9019180a0aafd5b14a6edacd149e110ba6776a654f2dbffca340902be933d011113f2750380a0a502c93b1918c4c6534d4593ae03a5a23fa10ebc30ffb7080b297bff2446e42da02eb2bf45fd443bd1df8b6f9c09726a4c6252a0f7896a131a081e39a7f644b38980a0a9cf7f673a0bce76fd40332afe8601542910b48dea44e93933a3e5e930da5d19a0ddf79db0a36d0c8134ba143bcb541cd4795a9a2bae8aca0ba24b8d8963c2a77da0b973ec0f48f710bf79f63688485755cbe87f9d4c68326bb83c26af620802a80ea0f0855349af6bf84afc8bca2eda31c8ef8c5139be1929eeb3da4ba6b68a818cb0a0c271e189aeeb1db5d59d7fe87d7d6327bbe7cfa389619016459196497de3ccdea0e7503ba5799e77aa31bbe1310c312ca17b2c5bcc8fa38f266675e8f154c2516ba09278b846696d37213ab9d20a5eb42b03db3173ce490a2ef3b2f3b3600579fc63a0e9041059114f9c910adeca12dbba1fef79b2e2c8899f2d7213cd22dfe4310561a047c59da56bb2bf348c9dd2a2e8f5538a92b904b661cfe54a4298b85868bbe4858080",
|
||||
"0xf8518080808080a0d546c4ca227a267d29796643032422374624ed109b3d94848c5dc06baceaee76808080808080a027c48e210ccc6e01686be2d4a199d35f0e1e8df624a8d3a17c163be8861acd6680808080",
|
||||
"0xf843a0207b2b5166478fd4318d2acc6cc2c704584312bdd8781b32d5d06abda57f4230a1a0db56114e00fdd4c1f85c892bf35ac9a89289aaecb1ebd0a96cde606a748b5d71"
|
||||
])
|
||||
"0xf843a0207b2b5166478fd4318d2acc6cc2c704584312bdd8781b32d5d06abda57f4230a1a0db56114e00fdd4c1f85c892bf35ac9a89289aaecb1ebd0a96cde606a748b5d71",
|
||||
]),
|
||||
},
|
||||
StorageProof {
|
||||
key: slot_24,
|
||||
nibbles: Nibbles::unpack(keccak256(slot_24)),
|
||||
value: U256::from_str("0xc78009fdf07fc56a11f122370658a353aaa542ed63e44c4bc15ff4cd105ab33c").unwrap(),
|
||||
value: U256::from_str(
|
||||
"0xc78009fdf07fc56a11f122370658a353aaa542ed63e44c4bc15ff4cd105ab33c",
|
||||
)
|
||||
.unwrap(),
|
||||
proof: convert_to_proof([
|
||||
"0xf9019180a0aafd5b14a6edacd149e110ba6776a654f2dbffca340902be933d011113f2750380a0a502c93b1918c4c6534d4593ae03a5a23fa10ebc30ffb7080b297bff2446e42da02eb2bf45fd443bd1df8b6f9c09726a4c6252a0f7896a131a081e39a7f644b38980a0a9cf7f673a0bce76fd40332afe8601542910b48dea44e93933a3e5e930da5d19a0ddf79db0a36d0c8134ba143bcb541cd4795a9a2bae8aca0ba24b8d8963c2a77da0b973ec0f48f710bf79f63688485755cbe87f9d4c68326bb83c26af620802a80ea0f0855349af6bf84afc8bca2eda31c8ef8c5139be1929eeb3da4ba6b68a818cb0a0c271e189aeeb1db5d59d7fe87d7d6327bbe7cfa389619016459196497de3ccdea0e7503ba5799e77aa31bbe1310c312ca17b2c5bcc8fa38f266675e8f154c2516ba09278b846696d37213ab9d20a5eb42b03db3173ce490a2ef3b2f3b3600579fc63a0e9041059114f9c910adeca12dbba1fef79b2e2c8899f2d7213cd22dfe4310561a047c59da56bb2bf348c9dd2a2e8f5538a92b904b661cfe54a4298b85868bbe4858080",
|
||||
"0xf85180808080a030263404acfee103d0b1019053ff3240fce433c69b709831673285fa5887ce4c80808080808080a0f8f1fbb1f7b482d9860480feebb83ff54a8b6ec1ead61cc7d2f25d7c01659f9c80808080",
|
||||
"0xf843a020d332d19b93bcabe3cce7ca0c18a052f57e5fd03b4758a09f30f5ddc4b22ec4a1a0c78009fdf07fc56a11f122370658a353aaa542ed63e44c4bc15ff4cd105ab33c"
|
||||
])
|
||||
"0xf843a020d332d19b93bcabe3cce7ca0c18a052f57e5fd03b4758a09f30f5ddc4b22ec4a1a0c78009fdf07fc56a11f122370658a353aaa542ed63e44c4bc15ff4cd105ab33c",
|
||||
]),
|
||||
},
|
||||
StorageProof {
|
||||
key: slot_100,
|
||||
@@ -243,10 +252,10 @@ fn holesky_deposit_contract_proof() {
|
||||
value: U256::ZERO,
|
||||
proof: convert_to_proof([
|
||||
"0xf9019180a0aafd5b14a6edacd149e110ba6776a654f2dbffca340902be933d011113f2750380a0a502c93b1918c4c6534d4593ae03a5a23fa10ebc30ffb7080b297bff2446e42da02eb2bf45fd443bd1df8b6f9c09726a4c6252a0f7896a131a081e39a7f644b38980a0a9cf7f673a0bce76fd40332afe8601542910b48dea44e93933a3e5e930da5d19a0ddf79db0a36d0c8134ba143bcb541cd4795a9a2bae8aca0ba24b8d8963c2a77da0b973ec0f48f710bf79f63688485755cbe87f9d4c68326bb83c26af620802a80ea0f0855349af6bf84afc8bca2eda31c8ef8c5139be1929eeb3da4ba6b68a818cb0a0c271e189aeeb1db5d59d7fe87d7d6327bbe7cfa389619016459196497de3ccdea0e7503ba5799e77aa31bbe1310c312ca17b2c5bcc8fa38f266675e8f154c2516ba09278b846696d37213ab9d20a5eb42b03db3173ce490a2ef3b2f3b3600579fc63a0e9041059114f9c910adeca12dbba1fef79b2e2c8899f2d7213cd22dfe4310561a047c59da56bb2bf348c9dd2a2e8f5538a92b904b661cfe54a4298b85868bbe4858080",
|
||||
"0xf891a090bacef44b189ddffdc5f22edc70fe298c58e5e523e6e1dfdf7dbc6d657f7d1b80a026eed68746028bc369eb456b7d3ee475aa16f34e5eaa0c98fdedb9c59ebc53b0808080a09ce86197173e14e0633db84ce8eea32c5454eebe954779255644b45b717e8841808080a0328c7afb2c58ef3f8c4117a8ebd336f1a61d24591067ed9c5aae94796cac987d808080808080"
|
||||
])
|
||||
"0xf891a090bacef44b189ddffdc5f22edc70fe298c58e5e523e6e1dfdf7dbc6d657f7d1b80a026eed68746028bc369eb456b7d3ee475aa16f34e5eaa0c98fdedb9c59ebc53b0808080a09ce86197173e14e0633db84ce8eea32c5454eebe954779255644b45b717e8841808080a0328c7afb2c58ef3f8c4117a8ebd336f1a61d24591067ed9c5aae94796cac987d808080808080",
|
||||
]),
|
||||
},
|
||||
])
|
||||
]),
|
||||
};
|
||||
|
||||
let provider = factory.provider().unwrap();
|
||||
|
||||
@@ -84,7 +84,9 @@ fn calculate_root_from_leaves_repeated(c: &mut Criterion) {
|
||||
// hash builder
|
||||
let benchmark_id = BenchmarkId::new(
|
||||
"hash builder",
|
||||
format!("init size {init_size} | update size {update_size} | num updates {num_updates}"),
|
||||
format!(
|
||||
"init size {init_size} | update size {update_size} | num updates {num_updates}"
|
||||
),
|
||||
);
|
||||
group.bench_function(benchmark_id, |b| {
|
||||
b.iter_with_setup(
|
||||
@@ -177,7 +179,9 @@ fn calculate_root_from_leaves_repeated(c: &mut Criterion) {
|
||||
// sparse trie
|
||||
let benchmark_id = BenchmarkId::new(
|
||||
"sparse trie",
|
||||
format!("init size {init_size} | update size {update_size} | num updates {num_updates}"),
|
||||
format!(
|
||||
"init size {init_size} | update size {update_size} | num updates {num_updates}"
|
||||
),
|
||||
);
|
||||
group.bench_function(benchmark_id, |b| {
|
||||
b.iter_with_setup(
|
||||
|
||||
@@ -1447,7 +1447,7 @@ impl<P: BlindedProvider> RevealedSparseTrie<P> {
|
||||
SparseNode::Branch { .. } => removed_node.node,
|
||||
}
|
||||
}
|
||||
SparseNode::Branch { mut state_mask, hash: _, store_in_db_trie: _ } => {
|
||||
&SparseNode::Branch { mut state_mask, hash: _, store_in_db_trie: _ } => {
|
||||
// If the node is a branch node, we need to check the number of children left
|
||||
// after deleting the child at the given nibble.
|
||||
|
||||
|
||||
@@ -83,7 +83,10 @@ impl BeaconEventsConfig {
|
||||
match client.subscribe(&payloads_url).await {
|
||||
Ok(subscription) => return subscription,
|
||||
Err(err) => {
|
||||
warn!("Failed to subscribe to payload attributes events: {:?}\nRetrying in 5 seconds...", err);
|
||||
warn!(
|
||||
"Failed to subscribe to payload attributes events: {:?}\nRetrying in 5 seconds...",
|
||||
err
|
||||
);
|
||||
tokio::time::sleep(std::time::Duration::from_secs(5)).await;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,9 @@ async fn main() -> eyre::Result<()> {
|
||||
let mut notifications = node.provider.canonical_state_stream();
|
||||
|
||||
// submit tx through rpc
|
||||
let raw_tx = hex!("02f876820a28808477359400847735940082520894ab0840c0e43688012c1adb0f5e3fc665188f83d28a029d394a5d630544000080c080a0a044076b7e67b5deecc63f61a8d7913fab86ca365b344b5759d1fe3563b4c39ea019eab979dd000da04dfc72bb0377c092d30fd9e1cab5ae487de49586cc8b0090");
|
||||
let raw_tx = hex!(
|
||||
"02f876820a28808477359400847735940082520894ab0840c0e43688012c1adb0f5e3fc665188f83d28a029d394a5d630544000080c080a0a044076b7e67b5deecc63f61a8d7913fab86ca365b344b5759d1fe3563b4c39ea019eab979dd000da04dfc72bb0377c092d30fd9e1cab5ae487de49586cc8b0090"
|
||||
);
|
||||
|
||||
let eth_api = node.rpc_registry.eth_api();
|
||||
|
||||
|
||||
@@ -13,11 +13,11 @@ pub(crate) fn polygon_chain_spec() -> Arc<ChainSpec> {
|
||||
}
|
||||
|
||||
/// Polygon mainnet boot nodes <https://github.com/maticnetwork/bor/blob/master/params/bootnodes.go#L79>
|
||||
static BOOTNODES : [&str; 4] = [
|
||||
"enode://b8f1cc9c5d4403703fbf377116469667d2b1823c0daf16b7250aa576bacf399e42c3930ccfcb02c5df6879565a2b8931335565f0e8d3f8e72385ecf4a4bf160a@3.36.224.80:30303",
|
||||
"enode://8729e0c825f3d9cad382555f3e46dcff21af323e89025a0e6312df541f4a9e73abfa562d64906f5e59c51fe6f0501b3e61b07979606c56329c020ed739910759@54.194.245.5:30303",
|
||||
"enode://76316d1cb93c8ed407d3332d595233401250d48f8fbb1d9c65bd18c0495eca1b43ec38ee0ea1c257c0abb7d1f25d649d359cdfe5a805842159cfe36c5f66b7e8@52.78.36.216:30303",
|
||||
"enode://681ebac58d8dd2d8a6eef15329dfbad0ab960561524cf2dfde40ad646736fe5c244020f20b87e7c1520820bc625cfb487dd71d63a3a3bf0baea2dbb8ec7c79f1@34.240.245.39:30303",
|
||||
static BOOTNODES: [&str; 4] = [
|
||||
"enode://b8f1cc9c5d4403703fbf377116469667d2b1823c0daf16b7250aa576bacf399e42c3930ccfcb02c5df6879565a2b8931335565f0e8d3f8e72385ecf4a4bf160a@3.36.224.80:30303",
|
||||
"enode://8729e0c825f3d9cad382555f3e46dcff21af323e89025a0e6312df541f4a9e73abfa562d64906f5e59c51fe6f0501b3e61b07979606c56329c020ed739910759@54.194.245.5:30303",
|
||||
"enode://76316d1cb93c8ed407d3332d595233401250d48f8fbb1d9c65bd18c0495eca1b43ec38ee0ea1c257c0abb7d1f25d649d359cdfe5a805842159cfe36c5f66b7e8@52.78.36.216:30303",
|
||||
"enode://681ebac58d8dd2d8a6eef15329dfbad0ab960561524cf2dfde40ad646736fe5c244020f20b87e7c1520820bc625cfb487dd71d63a3a3bf0baea2dbb8ec7c79f1@34.240.245.39:30303",
|
||||
];
|
||||
|
||||
pub(crate) fn head() -> Head {
|
||||
|
||||
Reference in New Issue
Block a user