Skip to content

BM-3084: fix(market): restore risc0 Digest wire format for deployed-guest inputs - #2060

Merged
jonastheis merged 2 commits into
mainfrom
jonas/fix-digest-wire-format
Jul 14, 2026
Merged

BM-3084: fix(market): restore risc0 Digest wire format for deployed-guest inputs#2060
jonastheis merged 2 commits into
mainfrom
jonas/fix-digest-wire-format

Conversation

@jonastheis

Copy link
Copy Markdown
Contributor

The SDK decoupling (#2039) replaced risc0_zkvm::sha::Digest with a boundless-native Digest, which silently changed the postcard wire format of every digest embedded in guest inputs: risc0's Digest is [u32; 8] (postcard: eight varint-encoded words), the new type was [u8; 32] (postcard: 32 raw bytes). Any host proving the deployed assessor guest (image 0x6c5a03c0…) now feeds it undecodable AssessorInput — the guest panics with PostcardDeserializeError(DeserializeUnexpectedEnd).

CI cannot see this class of drift: the in-repo assessor guest rebuilds with the same type, so host and guest move together and every test stays green. Only the boundary to already-deployed guests breaks. That boundary is load-bearing for the router migration: R0BoundlessAssessorAdapter deliberately pins the deployed guest image ("today's R0 STARK assessor proofs remain bit-identically verifiable through the router — no guest changes required"), so both the CLI fulfiller and the broker's STARK-assessor fallback depend on it. Surfaced during router-native market validation on Taiko, where the open-path fulfillment flow (#2052) proved the deployed assessor guest for the first time from this tree.

                        AssessorInput (postcard)
host ─────────────────────────────────────▶ deployed assessor guest (0x6c5a03c0…)
      before: Digest as 32 raw bytes    ✗    expects eight varint u32 words
      after:  Digest as 8 LE u32 words  ✓    decodes, proof verifies via the
                                             router assessor adapter

Changes

  • boundless-market/src/digest.rs — replace the derived serde with custom Serialize/Deserialize encoding eight little-endian u32 words, wire-identical to risc0_zkvm::sha::Digest. The encoding is a compatibility contract with deployed guests, not an implementation detail; a comment on the impl says so. Verified byte-identical to the v2.0.2 encoder's output, and the deployed assessor guest ELF executes past input decode with an input encoded by this tree.
  • boundless-market/src/digest.rs (test) — byte-exact regression test pinning the postcard encoding (0x42424242 word → c2 84 89 92 04, ×8) plus roundtrip, so any future serde change on this type fails loudly instead of drifting.
  • boundless-cli/src/lib.rsASSESSOR_IMAGE_URL env override for the fulfiller's assessor guest source (any downloader scheme, including file://), so a locally built guest can be proven against a router adapter that pins its image id in test deployments.

Related: #2039 (regression source), #2052 (open-path fulfillment flow that first exercised the deployed-guest boundary).

The SDK decoupling (#2039) replaced risc0_zkvm::sha::Digest ([u32; 8],
postcard varint words) with a byte-backed Digest ([u8; 32], raw bytes),
silently changing the postcard encoding of every digest embedded in
guest inputs. Hosts feeding the deployed assessor guest (image
0x6c5a03c0...) then produce undecodable AssessorInput bytes: the guest
panics with DeserializeUnexpectedEnd. CI cannot catch this drift because
the in-repo guest rebuilds with the same type, so both sides move
together; only the boundary to already-deployed guests breaks.

Pin Digest's serde to risc0's word-wise layout (eight little-endian u32
words) and add a byte-exact regression test. Verified against the
deployed assessor guest: the encoding is byte-identical to v2.0.2's and
the live guest ELF executes past input decode.
ASSESSOR_IMAGE_URL overrides the fulfiller's default assessor guest
source (any downloader scheme, e.g. file://). Useful for proving a
locally built assessor guest against a router adapter that pins its
image id, e.g. in test deployments.
@cursor

cursor Bot commented Jul 7, 2026

Copy link
Copy Markdown

Bugbot is not enabled for this team, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@github-actions github-actions Bot changed the title fix(market): restore risc0 Digest wire format for deployed-guest inputs BM-3084: fix(market): restore risc0 Digest wire format for deployed-guest inputs Jul 7, 2026
@linear

linear Bot commented Jul 7, 2026

Copy link
Copy Markdown

BM-3084

@bobbobbio bobbobbio left a comment

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.

thanks for fixing this

@jonastheis
jonastheis merged commit 1c334eb into main Jul 14, 2026
24 of 26 checks passed
@jonastheis
jonastheis deleted the jonas/fix-digest-wire-format branch July 14, 2026 02:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants