mirror of
https://github.com/luxfi/chains.git
synced 2026-09-24 00:26:00 +00:00
proof satisfy RequireZKProofs Two defects. 1. Block.verifyCredential compared cred.ExpirationDate against time.Now() inside block verification. The verdict therefore depended on when a node happened to verify: the same block is valid before the expiry instant and invalid after, so two validators either side of it disagree. Worse, it is unconditional on replay — a node bootstrapping the chain rejects every historical block whose credentials have since expired, which after enough time is all of them. Proven: a block timestamped 48h ago carrying a credential that was live then failed verification. Now compared against b.BlockTimestamp, the one clock every node agrees on, already bounded against the parent and local time earlier in Verify. 2. VerifyCredential gated the ZK requirement on the presence of the thing it requires: `if vm.config.RequireZKProofs && cred.Proof != nil`. A credential carrying no proof object skipped the branch and returned (true, nil) on a chain configured to require proofs. Proven: VerifyCredential returned true for a proofless credential with RequireZKProofs set. The requirement now holds whenever it is configured. Tests: TestCredentialExpiryIsJudgedAtBlockTime, TestRequireZKProofsCannotBeSkippedByOmittingTheProof. Co-authored-by: Hanzo Dev <[email protected]>