Verifier Tests
Overview
The Aqua verifier MUST validate revisions per the schema defined at https://aqua-protocol.org/docs/v3/schema_2. This document specifies required tests for implementations to ensure compliance with the Aqua protocol, as introduced at /docs/v3/intro. Tests are divided into Revision Verification and Relational Verification domains. Implementations MUST pass all tests to be considered conformant.Prerequisites
Schema Compliance
Implementations MUST conform to https://aqua-protocol.org/docs/v3/schema_2.Tools
Implementations MAY use any framework supporting:- SHA256 hashing
- Ethereum EIP-191 (using the secp256k1 curve) signature validation
Implementations MAY support additional hashing algorithms (e.g., SHA3-512) or signature schemes (e.g., secp256r1) only if specified in an updated schema and supported by new, defined signature_type or witness_network values.
Revision Verification Tests
These tests ensure each revision object in revisions is independently valid. Types MUST adhere to the schema at https://aqua-protocol.org/docs/v3/schema_2.RV-01: Version Compliance
Theversion field MUST be one of the following exact strings:
"https://aqua-protocol.org/docs/schema/v1.3.2 | SHA256 | Method: scalar""https://aqua-protocol.org/docs/schema/v1.3.2 | SHA256 | Method: tree"
RV-02: Required Fields
Every revision MUST include:previous_verification_hashlocal_timestamprevision_typeversion
local_timestampMUST be inYYYYMMDDHHMMSSformat- MUST represent a valid UTC time after
2020-01-01 00:00:00
RV-03: File Revision Integrity
Arevision_type of "file" MUST include:
file_hashfile_nonce
file_hash MUST equal the SHA256 hash of either:
- The referenced file content concatenated with
file_nonce, OR - The OPTIONAL
contentfield (serialized file data) concatenated withfile_nonce, if present
RV-04: Signature Verification | Signature Type: ethereum:eip-191
Arevision_type of "signature" MUST include:
signaturesignature_public_keysignature_wallet_address
- The
signatureMUST validate againstprevious_verification_hashusingsignature_public_keypersignature_type"ethereum:eip-191"(secp256k1 curve)
RV-05: Witness Verification | Witness (Ethereum)
Arevision_type of "witness" MUST include:
witness_networkwitness_addresswitness_smart_contract_address
Network Validation
witness_network MUST be one of:
"mainnet""sepolia""nostr""TSA_RFC3161"
Merkle Root Validation
witness_merkle_root, if present, MUST be the valid Merkle root hash derived fromwitness_merkle_proof
Address Validation
witness_smart_contract_addressMUST be a valid Ethereum contract address for the specifiedwitness_network, capable of storing and retrieving verification hashes
Transaction Validation
witness_transaction_hash, if present, MUST be a valid transaction hash for the specifiedwitness_networkwitness_sender_account_address, if present, MUST be a valid account address for the specifiedwitness_network
Merkle Proof Validation
witness_merkle_proof, if present, MUST be a valid Merkle proof includingprevious_verification_hashas a leaf
RV-06: Signature Type Restriction
signature_type MUST be one of:
"ethereum:eip-191""did_key"
RV-07: Witness Type Restriction
witness_network MUST be one of:
"mainnet""sepolia""nostr""TSA_RFC3161"
RV-08: Indexed Content Verification
Each key infile_index MUST be a valid file_hash from a revision with revision_type "file".
Relational Verification Tests
These tests ensure consistency across revisions, file_index, tree, and treeMapping. Types MUST be strict per https://aqua-protocol.org/docs/v3/schema_2.RL-01: Previous Hash Linking
previous_verification_hash MUST match a valid revision key in the pool of all verified revisions or be empty for the first (genesis) revision.
RL-02: Type: Link Revision
A revision referenced byrevision_type link MUST exist and be valid in the pool of all verified revisions.
RL-03: Loop Detection
Implementations MUST have a loop detection mechanism.
RL-04: Fork Detection
Implementations MUST have a fork detection mechanism to output deterministic results.
RL-05: Timestamp Order
Implementations MUST have a timestamp plausibility check across revisions for local timestamps.
Implementations MUST have a timestamp plausibility check for cryptographic timestamps (Witness events).
Test Implementation Guidelines
Required Test Coverage
Revision Verification
Tests RV-01 through RV-08 must be implemented to validate individual revision objects.
Relational Verification
Tests RL-01 through RL-05 must be implemented to validate relationships between revisions.
Compliance Requirements
Test Framework Recommendations
While implementations may use any testing framework, consider:- Unit tests for individual revision validation (RV-01 through RV-08)
- Integration tests for relational verification (RL-01 through RL-05)
- Edge case testing for error conditions and boundary values
- Performance testing for large revision sets
Error Handling
Implementations should provide clear error messages for test failures:- Field validation errors should specify which field failed and why
- Signature validation errors should indicate the specific signature verification failure
- Witness validation errors should specify which witness component failed validation
- Relational errors should clearly indicate the relationship that failed validation