Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions rust/op-reth/crates/node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ reth-trie-db.workspace = true
alloy-network.workspace = true
alloy-op-evm.workspace = true
alloy-op-hardforks.workspace = true
alloy-rpc-types-admin.workspace = true
futures.workspace = true
op-alloy-network.workspace = true

Expand Down
2 changes: 2 additions & 0 deletions rust/op-reth/crates/node/tests/it/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ mod rpc;

mod custom_genesis;

mod p2p_version;

const fn main() {}
41 changes: 41 additions & 0 deletions rust/op-reth/crates/node/tests/it/p2p_version.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
//! Verifies that two op-reth nodes negotiate the expected eth wire protocol version.
//!
//! The test is intentionally written to fail when upstream reth bumps the negotiated
//! version. That failure is the signal: it forces a conscious review of the new
//! version's behavior before we ship it, rather than silently inheriting a protocol
//! change on the next reth bump.

use alloy_rpc_types_admin::EthPeerInfo;
use reth_optimism_node::utils::setup;
use reth_rpc_api::servers::AdminApiServer;
use std::time::Duration;
use tokio::time::{sleep, timeout};

const EXPECTED_ETH_VERSION: u64 = 69;

#[tokio::test]
async fn peers_negotiate_eth_69() -> eyre::Result<()> {
reth_tracing::init_test_tracing();

let (nodes, _wallet) = setup(2).await?;
let admin_a = nodes[0].inner.add_ons_handle.admin_api();

let negotiated = timeout(Duration::from_secs(30), async {
loop {
let peers = admin_a.peers().await.expect("admin_peers rpc call");
for p in peers {
if let Some(EthPeerInfo::Info(info)) = p.protocols.eth {
return info.version;
}
}
sleep(Duration::from_millis(200)).await;
}
})
.await?;

assert_eq!(
negotiated, EXPECTED_ETH_VERSION,
"expected eth/{EXPECTED_ETH_VERSION}, got eth/{negotiated}"
);
Ok(())
}
Loading