-
Notifications
You must be signed in to change notification settings - Fork 3.9k
test(op-reth): guard negotiated eth wire protocol version #20156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+45
−0
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,4 +8,6 @@ mod rpc; | |
|
|
||
| mod custom_genesis; | ||
|
|
||
| mod p2p_version; | ||
|
|
||
| const fn main() {} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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(()) | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.