test: add 4 new cross-language test vectors (18 total, up from 14)#52
Merged
test: add 4 new cross-language test vectors (18 total, up from 14)#52
Conversation
New vectors in test-vectors/vectors.json: checkpoint-body-with-revoc Canonical encoding of the revoc: extension line. Given origin, tree_size, root_hash, and an artifact byte string, locks the exact body bytes, the fourth_line value, and the SHA-256 hash of the artifact. Tests that BodyWithRevoc() produces the specified output across all four SDKs. mode2-payload-encode Canonical Mode 2 payload with proof_count=0. Locks the flags byte (0x80 | sig_alg<<2 | mode) and the full payload_hex. Tests that decoders in all four SDKs accept a Mode 2 payload and report mode=2 with zero proof hashes — confirming the decoder correctly reads the flags byte. revoc-checkpoint-commitment Verifies that signing the plain 3-line body and the 4-line revoc-extended body with the same key produces different signatures. Locks both body hex values and both signature hex values. Confirms the sigs_differ invariant that Mode 0 (plain body) and Mode 1/2 (4-line body) signatures are distinct — any implementation that reuses the wrong sig will fail here. reject-revoc-hash-mismatch Defines the tampered-artifact detection case: two artifacts whose SHA-256 hashes differ, with hashes_match=false. Tests that verifiers implementing revoc integrity checking compute the correct hash and detect the mismatch. Test harness additions (all four SDKs): Go: 4 new test functions in go/shared/vectors_test.go TS: 4 new test() calls in ts/sdk/src/test/vectors.test.ts (17 total) Rust: 4 new #[test] fns in rust/src/lib.rs vector_tests module (17 total) Java: 4 new @test methods in VectorTest.java (17 total) All pre-existing tests continue to pass.
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.
Adds 4 new canonical test vectors covering gaps identified in the grade assessment, with test harness coverage in all four SDKs.
New vectors:
checkpoint-body-with-revoc— locks therevoc:extension line encodingmode2-payload-encode— locks the Mode 2proof_count=0payload bytesrevoc-checkpoint-commitment— proves plain and 4-line bodies produce different sigs (critical for Mode 0 correctness)reject-revoc-hash-mismatch— defines tampered-artifact detectionTest counts after this PR:
Go: 5/5 packages · TS SDK: 34 tests · Rust: 35 tests · Java: 44 tests · Interop: 19/19