Skip to content
Open
Show file tree
Hide file tree
Changes from 7 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
16 changes: 9 additions & 7 deletions .github/workflows/update-reth.yml
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,12 @@ jobs:
# Gate checks that every CI run reports; until all of them appear, CI hasn't fully
# started and an empty pending list doesn't mean it passed.
EXPECTED_CHECKS='["lint success","specs success","test success"]'
# External reviews run after this loop posts their commands, so they must not block the
# pre-audit CI gate. Failed reviews are still handled below. Tempo Network E2E and Tempo
# Zone Prover Compat run on Argo and can take longer than CI_TIMEOUT_MINUTES, so they are
# not waited on: only a failure reported before the other checks finish is handled, and a
# later failure is left to reviewers.
UNAWAITED_CHECKS='["Review","Cyclops audit run","Tempo Network E2E","Tempo Zone Prover Compat"]'
while true; do

STATUS=$(gh pr checks "$PR_BRANCH" --json bucket,name,state 2>&1) || true
Expand All @@ -612,12 +618,8 @@ jobs:
break
fi

# External reviews run after this loop posts their commands, so they must not
# block the pre-audit CI gate. Failed reviews are still handled above.
# Tempo Network E2E runs on Argo and can take longer than CI_TIMEOUT_MINUTES,
# so it is not waited on: only a failure reported before the other checks
# finish is handled above, and a later E2E failure is left to reviewers.
PENDING=$(echo "$STATUS" | jq -r '[.[] | select((.state == "PENDING" or .state == "QUEUED" or .state == "IN_PROGRESS") and .name != "Review" and .name != "Cyclops audit run" and .name != "Tempo Network E2E")] | length')
PENDING_NAMES=$(echo "$STATUS" | jq -c --argjson unawaited "$UNAWAITED_CHECKS" '[.[] | select((.state == "PENDING" or .state == "QUEUED" or .state == "IN_PROGRESS") and (.name | IN($unawaited[]) | not)) | .name]')
PENDING=$(echo "$PENDING_NAMES" | jq length)
MISSING=$(echo "$STATUS" | jq -r --argjson expected "$EXPECTED_CHECKS" '$expected - map(.name) | join(", ")')
if [ "$PENDING" = "0" ] 2>/dev/null && [ -n "$MISSING" ]; then
if [ $(( (SECONDS - WAIT_START) / 60 )) -ge "$CI_TIMEOUT_MINUTES" ]; then
Expand Down Expand Up @@ -654,7 +656,7 @@ jobs:
ELAPSED=$(( (SECONDS - WAIT_START) / 60 ))
if [ "$ELAPSED" -ge "$CI_TIMEOUT_MINUTES" ]; then
echo "CI checks stuck for ${ELAPSED}m — investigating with Amp..."
STUCK_NAMES=$(echo "$STATUS" | jq -r '[.[] | select((.state == "PENDING" or .state == "QUEUED" or .state == "IN_PROGRESS") and .name != "Review" and .name != "Cyclops audit run" and .name != "Tempo Network E2E")] | map(.name) | join(", ")')
STUCK_NAMES=$(echo "$PENDING_NAMES" | jq -r 'join(", ")')

# Fetch logs from in-progress runs for the current HEAD commit
HEAD_SHA=$(gh pr view "$PR_BRANCH" --json headRefOid --jq '.headRefOid')
Expand Down
22 changes: 15 additions & 7 deletions .github/workflows/zones-prover-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ name: Prover E2E

# workflow_run runs trusted default-branch code only, for scheduled upstream runs of
# this repository; the publisher never checks out or executes candidate code.
# The compat suite runs the candidate L1 and Zone nodes against the provers pinned in
# crates/precompiles/src/zone_verifier/pcrs.json for active and scheduled forks, and reports
# "Tempo Zone Prover Compat", which a node release can require. Dispatch it for a release commit.
"on": # zizmor: ignore[dangerous-triggers]
workflow_dispatch:
inputs:
Expand All @@ -10,10 +13,12 @@ name: Prover E2E
type: string
required: true
suite:
description: Fast suite or full suite including ancestry
description: Fast suite, full suite including ancestry, or compat against the pinned provers
type: choice
options: [fast, full]
options: [fast, full, compat]
default: fast
push:
branches: [reth-auto-bump]
merge_group:
# The full suite follows each successful scheduled (nightly) Zones image build on main.
workflow_run:
Expand Down Expand Up @@ -52,22 +57,25 @@ jobs:
with:
script: |
const event = context.eventName;
if (!['workflow_dispatch', 'merge_group', 'workflow_run'].includes(event)) throw new Error('Unsupported trigger');
if (!['workflow_dispatch', 'merge_group', 'workflow_run', 'push'].includes(event)) throw new Error('Unsupported trigger');
const run = context.payload.workflow_run;
if (event === 'workflow_run' && (run.event !== 'schedule' || run.conclusion !== 'success' || run.head_branch !== 'main')) {
throw new Error('Full suite requires a successful nightly Zones image build on main');
}
const sha = event === 'workflow_dispatch' ? process.env.INPUT_SHA
: event === 'merge_group' ? context.payload.merge_group.head_sha : run.head_sha;
: event === 'merge_group' ? context.payload.merge_group.head_sha
: event === 'push' ? context.sha : run.head_sha;
const base = event === 'merge_group' ? context.payload.merge_group.base_sha : '';
if (!/^[0-9a-f]{40}$/.test(sha) || (event === 'merge_group' && !/^[0-9a-f]{40}$/.test(base))) {
throw new Error('Exact lowercase commit SHAs are required');
}
const suite = event === 'workflow_run' ? 'full' : event === 'merge_group' ? 'fast' : (process.env.INPUT_SUITE || 'fast');
if (!['fast', 'full'].includes(suite)) throw new Error('Unknown suite');
const suite = event === 'workflow_run' ? 'full' : event === 'merge_group' ? 'fast'
: event === 'push' ? 'compat' : (process.env.INPUT_SUITE || 'fast');
const contexts = {fast: 'Tempo Zone Prover E2E', full: 'Tempo Zone Prover E2E (full)', compat: 'Tempo Zone Prover Compat'};
if (!Object.hasOwn(contexts, suite)) throw new Error('Unknown suite');
const {data: commit} = await github.rest.repos.getCommit({...context.repo, ref: sha});
if (commit.sha !== sha) throw new Error('Candidate SHA mismatch');
const statusContext = suite === 'full' ? 'Tempo Zone Prover E2E (full)' : 'Tempo Zone Prover E2E';
const statusContext = contexts[suite];
core.setOutput('sha', sha);
core.setOutput('base', base);
core.setOutput('suite', suite);
Expand Down
1 change: 1 addition & 0 deletions 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 xtask/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ zone-p2p.workspace = true
zone-rpc.workspace = true
zone-sequencer.workspace = true
alloy-rlp.workspace = true
alloy-trie.workspace = true
alloy-rpc-types-eth.workspace = true
futures.workspace = true
serde_yaml.workspace = true
Expand Down
7 changes: 7 additions & 0 deletions xtask/src/zones/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ use crate::{
spam_deposits::SpamDeposits,
verify_closed_loop::VerifyClosedLoop,
verify_portal_backing::VerifyPortalBacking,
witness_shapes::WitnessShapes,
zone_info::ZoneInfoCmd,
};
use clap::Parser as _;
Expand Down Expand Up @@ -53,6 +54,7 @@ mod set_encryption_key;
mod spam_deposits;
mod verify_closed_loop;
mod verify_portal_backing;
mod witness_shapes;
mod zone_info;
mod zone_utils;

Expand Down Expand Up @@ -111,6 +113,10 @@ async fn main() -> eyre::Result<()> {
.run()
.await
.wrap_err("Portal backing verification failed"),
Action::WitnessShapes(args) => args
.run()
.await
.wrap_err("failed to find registry witness shapes"),
Action::ZoneInfo(args) => args.run().await.wrap_err("failed to fetch zone info"),
Action::GenerateStateBloat(args) => args
.run()
Expand Down Expand Up @@ -155,6 +161,7 @@ enum Action {
SpamDeposits(SpamDeposits),
VerifyClosedLoop(VerifyClosedLoop),
VerifyPortalBacking(VerifyPortalBacking),
WitnessShapes(WitnessShapes),
ZoneInfo(ZoneInfoCmd),
GenerateStateBloat(GenerateStateBloat),
}
68 changes: 68 additions & 0 deletions xtask/src/zones/witness_shapes.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
//! 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?;
Comment on lines +28 to +30

Copy link
Copy Markdown
Contributor

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 👍 / 👎.

let block = provider.get_block_number().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)
.number(block)
Comment thread
claude[bot] marked this conversation as resolved.
Resolved
.await
.wrap_err("failed to read registry proofs")?;
Comment thread
claude[bot] marked this conversation as resolved.
Resolved
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], "block": block })
);
return Ok(());
}
}
bail!(
"no extension and empty-child proofs among {} slots",
BATCH * MAX_BATCHES
)
}
}
Loading