Repository navigation
test(zones): run the candidate node against every pinned prover #9570
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
Open
0xrusowsky
wants to merge
9
commits into
main
Choose a base branch
from
rus/zones-prover-compat
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 8 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
25fa9c2
test(zones): run the candidate node against every pinned prover
0xrusowsky 2ee3a05
chore: update Cargo.lock
0xrusowsky c6c3d33
refactor: simplify
0xrusowsky 9830c0c
refactor(zones): simplify witness shape grinding and harden the exten…
0xrusowsky b5529b3
refactor(zones): find witness shapes from existing registry proofs
0xrusowsky 2aec1d9
refactor(zones): trim witness-shapes
0xrusowsky 6a1fb8b
chore(zones): drop witness-shapes arg doc
0xrusowsky b34e870
fix(zones): prove witness shapes at the latest block
0xrusowsky 6d2074a
fix(zones): time out stalled witness-shapes proofs
0xrusowsky 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
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
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
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,66 @@ | ||
| //! Finds receive-policy slots in the TIP-403 registry's L1 storage trie whose absence proofs end | ||
| //! inside an extension and at a branch's empty child, and prints their recipients as JSON, for | ||
| //! deposits that make a Zone verify both proof shapes. | ||
|
|
||
| use alloy::{ | ||
| primitives::{Address, B256, keccak256}, | ||
| providers::{Provider, ProviderBuilder}, | ||
| }; | ||
| use alloy_rlp::Decodable as _; | ||
| use alloy_trie::nodes::TrieNode; | ||
| use eyre::{OptionExt as _, WrapErr as _, bail}; | ||
| use tempo_alloy::TempoNetwork; | ||
| use tempo_precompiles::{ | ||
| TIP403_REGISTRY_ADDRESS, storage::StorageKey, tip403_registry::tip403_registry_slots, | ||
| }; | ||
|
|
||
| const BATCH: usize = 256; | ||
| const MAX_BATCHES: usize = 32; | ||
|
|
||
| #[derive(Debug, clap::Parser)] | ||
| pub(crate) struct WitnessShapes { | ||
| #[arg(long, env = "L1_RPC_URL")] | ||
| l1_rpc_url: String, | ||
| } | ||
|
|
||
| impl WitnessShapes { | ||
| pub(crate) async fn run(self) -> eyre::Result<()> { | ||
| let provider = ProviderBuilder::new_with_network::<TempoNetwork>() | ||
| .connect(&self.l1_rpc_url) | ||
| .await?; | ||
| let mut candidates = (0u64..).map(|i| Address::from_word(keccak256(i.to_be_bytes()))); | ||
| let (mut extension, mut empty_child) = (None, None); | ||
| for _ in 0..MAX_BATCHES { | ||
| let recipients: Vec<_> = candidates.by_ref().take(BATCH).collect(); | ||
| let slots = recipients | ||
| .iter() | ||
| .map(|r| B256::from(r.mapping_slot(tip403_registry_slots::RECEIVE_POLICIES))) | ||
| .collect(); | ||
| let proof = provider | ||
| .get_proof(TIP403_REGISTRY_ADDRESS, slots) | ||
| .await | ||
| .wrap_err("failed to read registry proofs")?; | ||
| for (recipient, storage) in recipients.into_iter().zip(proof.storage_proof) { | ||
| // A proof ends where its key diverges. Leaves this deep are never embedded, so a | ||
| // set slot ends at its leaf and an absent one at an extension or a branch. | ||
| let end = storage.proof.last().ok_or_eyre("empty proof")?; | ||
| match TrieNode::decode(&mut end.as_ref()).wrap_err("invalid proof node")? { | ||
| TrieNode::Extension(_) => extension = extension.or(Some(recipient)), | ||
| TrieNode::Branch(_) => empty_child = empty_child.or(Some(recipient)), | ||
| _ => {} | ||
| } | ||
| } | ||
| if let (Some(extension), Some(empty_child)) = (extension, empty_child) { | ||
| println!( | ||
| "{}", | ||
| serde_json::json!({ "recipients": [extension, empty_child] }) | ||
| ); | ||
| return Ok(()); | ||
| } | ||
| } | ||
| bail!( | ||
| "no extension and empty-child proofs among {} slots", | ||
| BATCH * MAX_BATCHES | ||
| ) | ||
| } | ||
| } | ||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Informational · unverified: Proof-request timeout leaves WebSocket connection setup unbounded
The new witness selector is supposed to stop waiting when its configured RPC endpoint stalls. For a WebSocket URL, WitnessShapes::run awaits ProviderBuilder::connect before reaching the 30-second proof timer. The enabled Alloy WebSocket path waits for the initial handshake before returning.
Full finding
The new witness selector is supposed to stop waiting when its configured RPC endpoint stalls. For a WebSocket URL, WitnessShapes::run awaits ProviderBuilder::connect before reaching the 30-second proof timer. The enabled Alloy WebSocket path waits for the initial handshake before returning. A server that accepts one TCP connection and keeps it open without replying to the WebSocket upgrade can therefore hold the CLI indefinitely absent an outer deadline; no eth_getProof request is sent and no timeout error is returned by the command. An isolated Rust test using the exact connection expression and a permanently pending connector confirmed that the command remains pending before the timer can be armed. To reproduce with the full CLI, point it at a loopback socket that accepts the upgrade request and leaves the stream open without replying; assert the command exits on its own deadline. The baseline is the command's 30-second bound for a stalled proof request. Triggering the gap requires control of, or a fault at, the configured WS endpoint and sustaining one open connection; no chain transaction or fee is involved. The deployed scheme, outer job deadline, and resulting job or status impact were not available. Add a connection deadline or an overall command deadline and test a stalled upgrade.
Valid? React with 👍 / 👎.