Golden vectors: prove the JS crypto agrees with the chain byte for byte #2
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Companion to #1. Without this, every downstream repo is testing that it agrees with itself.
The vectors already exist
qp-rusty-crystals-hdwalletships golden HD-derivation vectors, regenerated by its ownregenerate_variant_golden_vectors:src/test_vectors_65.rs— ML-DSA-65 (the scheme new accounts use)src/test_vectors_87.rs/src/test_vectors.rs— ML-DSA-87 (legacy accounts)src/test_vectors_44.rs— unused by Quantus, ignoreEach entry is
(seed_bytes, path, expected). Extract them to a JSON fixture rather than retyping — a transcription error here produces a test that passes against the wrong answer.What to pin
poseidonHashBytes→ SS58 at prefix 189. Take known pairs fromquantus-apps:quantus_sdktests, or generate them withquantus-cliand record where they came from.hedge: None, and anything non-deterministic here means we have accidentally introduced randomness the reference implementation does not have."QUANTUS_EXTRINSIC"must fail verification under the empty context, and vice versa. This is the cheapest possible guard against the spec-148 boundary being got wrong somewhere downstream.Parity CI
A test that only checks our JS against our JSON will keep passing while both drift. Add a CI job that builds the Rust crates and asserts the same vectors through both paths, so that bumping a
qp-*dependency version fails loudly if it changes behaviour.Downstream
Publish the fixture in a form quantus/common can consume directly — its keyring tests need exactly these vectors and should not be maintaining a second copy.
Checked against
main(dc295dc3). Staying open.Done:
quantus-cli, and the node'sTEST_WORMHOLE_ADDRESS(src/rs/tests.rs).signing_is_deterministic(ML-DSA-65 only).QUANTUS_EXTRINSICfails under the empty context.qp-wormhole-circuitin a known-answer test.Remaining:
test_vectors_65.rsand_87.rs, extracted rather than retyped. The only HD pins today are two CLI-derived hashes.tests.rsandtest/consumer.mjs.QUANTUS_EXTRINSIC.yarn testruns Rust only, and the.githubworkflows are upstream's.