152 test vector - #345
Merged
Merged
Conversation
Signed-off-by: kautilyaa <arunbh.y@gmail.com>
Signed-off-by: kautilyaa <arunbh.y@gmail.com>
Collaborator
Author
|
@rampyg Sorry for the delay here is the piece pelase check this |
The committed vector stored intentDriftScore as 0.15, but the generator produces the exact IEEE-754 value 0.15000000000000002 (0.05 + 0.1), so the self-check in tests/test_runtime_vectors.py failed on a byte-for-byte comparison. Regenerate the file so the committed vector matches a fresh generation. Signed-off-by: Ramprasad G <rampyg@users.noreply.github.com>
The intentDriftScore and scorer outputs were computed from drift samples 0.1/0.2/0.0/0.3, whose mean is not exactly representable in IEEE-754. CPython 3.12 switched sum() to compensated (Neumaier) summation, so the mean is 0.15 on 3.12 and later but 0.15000000000000002 on 3.11 and earlier, and no single committed float passed the whole 3.9 to 3.12 CI matrix byte for byte. Use power-of-two drift samples (0.5/0.25/0.0/0.25) so the mean is exactly 0.25 on every runtime, and regenerate the vector. Signed-off-by: Ramprasad G <rampyg@users.noreply.github.com>
Collaborator
Author
|
Let me take a look in this |
Contributor
Vouch Verified Contributor ✨Thank you @kautilyaa. This merged pull request earns a signed Your certificate (download and share it): https://vouch-protocol.com/c/kautilyaa/345 Add the badge to your profile or site (optional): [](https://vouch-protocol.com/c/kautilyaa/345)Your Verifiable Credential (eddsa-jcs-2022){
"@context": [
"https://www.w3.org/ns/credentials/v2",
"https://vouch-protocol.com/contexts/v1"
],
"id": "urn:uuid:cd4870e8-aad7-42e1-b750-e1f5baa6f532",
"type": [
"VerifiableCredential",
"VouchCredential"
],
"issuer": "did:web:vouch-protocol.com:contributors",
"validFrom": "2026-07-24T23:05:52Z",
"validUntil": "2126-06-30T23:05:52Z",
"credentialSubject": {
"id": "did:web:vouch-protocol.com:contributors",
"vouchVersion": "1.0",
"intent": {
"action": "attest",
"target": "github:kautilyaa",
"resource": "https://github.com/vouch-protocol/vouch/pull/345",
"role": "verified-contributor",
"repository": "vouch-protocol/vouch",
"pullRequest": 345
},
"delegationChain": [
{
"issuer": "did:web:vouch-protocol.com",
"subject": "did:web:vouch-protocol.com:contributors",
"intent": {
"action": "attest",
"target": "github:kautilyaa",
"resource": "https://github.com/vouch-protocol/vouch/pull/345",
"role": "verified-contributor",
"repository": "vouch-protocol/vouch",
"pullRequest": 345
},
"validFrom": "2026-06-19T04:45:43Z",
"validUntil": "2036-06-16T04:45:43Z",
"parentProofValue": "z5g1N4udQdy5asdxnV3qFhApB5cAh28DkMqHjEUSNG6cc8hrDDsxWyVbgn1XXUFR"
}
]
},
"proof": {
"type": "DataIntegrityProof",
"cryptosuite": "eddsa-jcs-2022",
"created": "2026-07-24T23:05:52Z",
"verificationMethod": "did:web:vouch-protocol.com:contributors#key-1",
"proofPurpose": "assertionMethod",
"proofValue": "z3iANyQgx9L3SAmr2Ztzeu6kttyhLkDgosDxXWj75s3RnUokp8NH8McxDhRrYJn3EWqvYbhCQq3UVSkEoAmpJraft"
}
} |
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.
Summary
Adds the missing upstream contract for the six Vouch runtime module ports (#94 through #105). One Python harness emits canonical
test-vectors/<module>/vector.jsonfiles from the reference implementation, plus a pytest self check so CI catches drift before Go and TypeScript porters diverge.Problem
Each runtime module port issue asks contributors to reproduce
test-vectors/<module>/vector.jsonbyte for byte from the Python module. Before this PR:trust_entropy,quorum,merkle,canary,behavioral_attestation, orheartbeat.trust_entropyuses wall clock time, so ad hoc vectors would be unstable.Without a single source of truth, the twelve port PRs (#94 through #105) would drift apart.
Solution
scripts/gen_runtime_vectors.pytest-vectors/<module>/vector.json(six files)tests/test_runtime_vectors.pytest-vectors/README.mdThis mirrors the existing
test-vectors/pattern used byjcs/,data-integrity-eddsa-jcs-2022/andhybrid-eddsa-mldsa44/.Files changed
Module coverage
trust_entropy/vouch.trust_entropycompute_trust_at,evaluate_trust,half_life_seconds,time_until_thresholdat pinned timesquorum/vouch.quorummerkle/vouch.merklehash_leaf,hash_node, tree root, inclusion proof verify and fail,compute_action_merkle_rootcanary/vouch.canarycompute_commitment,verify_reveal, 3 interval chain, verifier intact then brokenbehavioral_attestation/vouch.behavioral_attestationBehavioralCollector.digest, drift scorers, valid and invalid digest validationheartbeat/vouch.heartbeatbuild_request, accept first heartbeat, reject broken canaryTotal: 39 cases across six modules.
Vector format
Each
vector.jsonfollows one shape, modelled onjcs/vectors.json:{ "description": "...", "module": "vouch.<module>", "spec_reference": "Specification 11.x", "version": "1.0", "pinned": { "now": "...", "uuid": "...", "os_urandom": "..." }, "cases": [ { "name": "...", "function": "...", "input": { ... }, "expected": { ... } } ] }casesis ordered. Each case names the function, carries self containedinput, and theexpectedoutput a porter must match.pinneddocuments clock, UUID and RNG only where needed (trust_entropy,canary,heartbeat,quorum).uprefix, lowercase hex hashes, standard base64 secrets, ISO 8601 UTC with trailingZ.Determinism contract
The
pinned()context manager pins every non deterministic source:2026-01-01T00:00:00Zvia explicitat_time/nowparams andvouch.vc.datetimemockurn:uuid:00000000-0000-4000-8000-000000000001os.urandom(canary secrets)(n+1)repeated to length; counter resets per vector buildbehavioral_attestation._now_nsdigest(), but keeps captured values stable)Serialization:
json.dumps(indent=2, ensure_ascii=False)plus a single trailing newline.Notes for porters
merkle,canary,heartbeat,quorum,behavioral_attestation) must match exactly.trust_entropyfloats: vectors carry exact Pythonfloatresults for the Python self check. Go and TypeScript should compareexp()andlog()within a small tolerance (for example1e-12absolute), as documented intest-vectors/README.md.Acceptance criteria
python scripts/gen_runtime_vectors.pyproduces no diff on re runpytest tests/test_runtime_vectors.pypasses (regenerates in memory, asserts byte for byte match for all six modules)test-vectors/<module>/vector.jsonas the fixture to reproduceTest plan
test_builders_cover_exactly_the_six_runtime_modulesplus 6 parametrized vector checks)Related issues