diff --git a/.github/workflows/update-reth.yml b/.github/workflows/update-reth.yml index 064cf32afb..31177cbceb 100644 --- a/.github/workflows/update-reth.yml +++ b/.github/workflows/update-reth.yml @@ -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 @@ -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 @@ -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') diff --git a/.github/workflows/zones-prover-e2e.yml b/.github/workflows/zones-prover-e2e.yml index 65f7c57e62..7b41df661a 100644 --- a/.github/workflows/zones-prover-e2e.yml +++ b/.github/workflows/zones-prover-e2e.yml @@ -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: @@ -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: @@ -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); diff --git a/Cargo.lock b/Cargo.lock index 5bc93527b5..220cc835b2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -15032,6 +15032,7 @@ dependencies = [ "alloy-primitives", "alloy-rlp", "alloy-rpc-types-eth", + "alloy-trie", "antithesis-instrumentation", "base64 0.22.1", "bytes", diff --git a/xtask/Cargo.toml b/xtask/Cargo.toml index 98575d62fe..f85135df78 100644 --- a/xtask/Cargo.toml +++ b/xtask/Cargo.toml @@ -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 diff --git a/xtask/src/zones/mod.rs b/xtask/src/zones/mod.rs index 1f18c06530..28eadda460 100644 --- a/xtask/src/zones/mod.rs +++ b/xtask/src/zones/mod.rs @@ -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 _; @@ -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; @@ -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() @@ -155,6 +161,7 @@ enum Action { SpamDeposits(SpamDeposits), VerifyClosedLoop(VerifyClosedLoop), VerifyPortalBacking(VerifyPortalBacking), + WitnessShapes(WitnessShapes), ZoneInfo(ZoneInfoCmd), GenerateStateBloat(GenerateStateBloat), } diff --git a/xtask/src/zones/witness_shapes.rs b/xtask/src/zones/witness_shapes.rs new file mode 100644 index 0000000000..a99793fd9d --- /dev/null +++ b/xtask/src/zones/witness_shapes.rs @@ -0,0 +1,69 @@ +//! 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::() + .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 = tokio::time::timeout( + std::time::Duration::from_secs(30), + provider.get_proof(TIP403_REGISTRY_ADDRESS, slots), + ) + .await + .wrap_err("timed out reading registry proofs")? + .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 + ) + } +}