Skip to content

test: add 4 new cross-language test vectors (18 total, up from 14)#52

Merged
rmhrisk merged 1 commit intomainfrom
test/vector-coverage
Mar 17, 2026
Merged

test: add 4 new cross-language test vectors (18 total, up from 14)#52
rmhrisk merged 1 commit intomainfrom
test/vector-coverage

Conversation

@rmhrisk
Copy link
Copy Markdown
Contributor

@rmhrisk rmhrisk commented Mar 17, 2026

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 the revoc: extension line encoding
  • mode2-payload-encode — locks the Mode 2 proof_count=0 payload bytes
  • revoc-checkpoint-commitment — proves plain and 4-line bodies produce different sigs (critical for Mode 0 correctness)
  • reject-revoc-hash-mismatch — defines tampered-artifact detection

Test counts after this PR:
Go: 5/5 packages · TS SDK: 34 tests · Rust: 35 tests · Java: 44 tests · Interop: 19/19

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.
@rmhrisk rmhrisk merged commit 1bb1d37 into main Mar 17, 2026
7 checks passed
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.

1 participant