From b07d87d25886848410767844d9a2c37ff6112a39 Mon Sep 17 00:00:00 2001 From: chengwenxi <22697326+chengwenxi@users.noreply.github.com> Date: Mon, 18 May 2026 16:22:48 +0800 Subject: [PATCH] docs(shadow-prove): clarify version is read for logging only in calc_batch_pi `calc_batch_pi` extracts `version` from the batch header but never branches on it, which looks inconsistent with the V2/non-V2 split in `lib.rs` and could be mistaken for a missing dispatch. The public-input formula is in fact uniform across versions: offset 57 holds the blob input field (versioned hash for V0/V1, aggregated hash for V2) and the on-chain verifier uses the same layout, while version-dependent routing happens earlier via the `batch_version` request parameter. Add a comment so maintainers don't need to reverse-engineer this from the header layout. --- prover/bin/shadow-prove/src/shadow_rollup.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/prover/bin/shadow-prove/src/shadow_rollup.rs b/prover/bin/shadow-prove/src/shadow_rollup.rs index 742eed522..df1f7292c 100644 --- a/prover/bin/shadow-prove/src/shadow_rollup.rs +++ b/prover/bin/shadow-prove/src/shadow_rollup.rs @@ -447,6 +447,12 @@ where chain_id: u64, batch_header: &Bytes, ) -> Result { + // `version` is read only for logging here. Unlike the V2/non-V2 split in `lib.rs` + // (where the prover dispatches different blob-decoding paths), the public-input + // formula is uniform across versions: offset 57 holds the blob input field + // (versioned hash for V0/V1, aggregated hash for V2), and the on-chain verifier + // uses the same layout. Versioned routing happens earlier via the `batch_version` + // request parameter; nothing in this function needs to branch on it. let version = batch_header.first().copied().unwrap_or(0); let prev_state_root: &[u8] = batch_header.get(89..121).unwrap_or_default();