test(ceremony): pin the Chain ID to the EVM Chain Profile vectors - #25
Merged
Merged
Conversation
`chainId()` was consistent with itself and with nothing else. Two tests in CeremonyProofVerifier.t.sol already say the digest follows the chain and not the caller, and that the value the Proof Verifier exposes is the one it commits -- but both would hold just as well under a preimage no Canonical Runtime could guess, which is what a composition has to reproduce to build a digest this chain rebuilds. TEST-EVM-01, transcribed from the profile rather than derived here: the Chain ID of chains 1, 8453 and 11155111, the reading a composition takes from the Proof Verifier, and the two shorter big-endian forms of the same identifier that the published width rules out. Assisted-by: Claude Opus 5 Signed-off-by: xgreenx <xgreenx9999@gmail.com>
The profile carries one REQ-CHAIN- prefix across every chain family rather than a per-family one, so the citations here move with it: TEST-EVM-01 is TEST-CHAIN-02, and the vector, reading and width requirements are REQ-CHAIN-04, -04B and -04. The distinctness test cited the cross-profile separation rule, which is about two profiles sharing a preimage shape; what it actually shows is EIP-155 uniqueness inside this one. Assisted-by: Claude Opus 5 Signed-off-by: xgreenx <xgreenx9999@gmail.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Companion to libid#30, which
writes the Chain Profile REQ-COMMON-01C requires and no document supplied.
This pins TEST-CHAIN-02 here.
CeremonyAuthorization.chainId()iskeccak256(abi.encode(block.chainid)),and until #30 nothing said so outside this repository.
chainIdis the oneAuthorization Digest input the two sides derive independently — the Platform
Verifier from its own environment, the Canonical Runtime from a value the
composition hands it — so a composition that guesses the preimage wrong
produces a digest this chain rebuilds differently. That surfaces as
CodeVerifierMismatchon X and GitHub, the same failure#24 fixes one field
over.
What was already covered, and what was not
CeremonyProofVerifier.t.solhastest_theVerifierBuildsTheDigestFromThisChainand
test_theDigestFollowsTheChainAndNotTheCaller— between them TEST-CHAIN-03,that the recomputation reads the chain itself and takes no identifier from the
caller. Both hold under any preimage, including one no runtime could
reproduce. Nothing pinned the bytes.
ChainProfile.t.soladds four:test_chainIdMatchesTheProfileVectors— chains1,8453and11155111against the values published in
specs/chain-profiles.md§3.1, transcribedand not recomputed here (REQ-CHAIN-04).
test_theProofVerifierExposesThePublishedChainId— REQ-CHAIN-04B, thisprofile's answer to REQ-CHAIN-03: what a composition reads from the
destination is the published value, so trusting that reading is safe.
test_theWidthIsTwoHundredAndFiftySixBits— the one-byte and eight-bytebig-endian forms of the same identifier hash elsewhere. That is the actual
ambiguity a runtime author faces; the vectors settle it, this names what
they rule out.
test_everyChainGetsItsOwnChainId— the EIP-155 uniqueness REQ-CHAIN-04rests on.
408 tests pass;
forge fmt --checkclean. Test-only, no contract change.