Documentation

How Rivet works

What is tested, how the on-chain registry authorises reports, and what Rivet assumes. Everything here describes behaviour that has been observed on Diana, not only what the docs say.

What Rivet tests

QoreChain exposes ML-DSA-87 (FIPS 204, security category 5) to Solidity through the pqcVerify precompile at 0x…0a01. Any dApp that signs off-chain and verifies on-chain depends on two different implementations agreeing byte for byte. Rivet checks that they do.

  • Interop. @noble/post-quantum and OpenSSL 3.5 each derive keys from the same seeds and sign five vectors, hedged and deterministic. Every signature is checked by both libraries and by the live precompile.
  • Determinism. Both libraries must derive identical keys from a seed and identical deterministic signatures; hedged signatures must differ.
  • Attacks. 16 tampering and malformed-input attacks plus a valid control, checked by every verifier. An accepted attack is critical.
  • Replay. Signatures bound to the wrong chain, contract, action, nonce or deadline are submitted to the deployed registry and must revert.

The precompile signature is pqcVerify(bytes pubkey, bytes signature, bytes message) returns (bool). It verifies pure ML-DSA-87 with an empty context over the raw message, and returns false rather than reverting on bad input.

ECDSA sends, ML-DSA admits

On QoreChain an EVM transaction is still signed with classical ECDSA (secp256k1). The chain will only admit it when the sending account has (1) a registered ML-DSA-87 key and (2) an open EVM authorisation window. Both are native-lane messages:

1 · Register the key

MsgRegisterPQCKeyV2 carries the ML-DSA-87 public key and a proof of possession. It must be the account’s first transaction and is the only one that may be signed with ECDSA alone.

2 · Open a window

MsgOpenEVMWindow is hybrid-signed (ECDSA + ML-DSA-87). It sets a block range, a transaction count and a spend cap, and can be scoped to specific contracts.

3 · Send EVM txs

Ordinary ECDSA-signed EVM transactions are admitted while the window lasts. A scoped window refuses contract creation and any other target.

Rivet's operator deployed the registry inside an unscoped window, because creation requires one, and publishes every report inside a window scoped to the registry alone. The report attestation itself is a separate ML-DSA-87 signature, verified by the contract through pqcVerify. Even a stolen ECDSA key cannot publish without it.

The on-chain registry

RivetRegistry stores reportHash, the four result counts, and the attester. Every state change is authorised by an ML-DSA-87 signature over:

"RIVET/ATTEST/v1" ‖ abi.encode(
  uint8   action,        // 1 publish · 2 revoke · 3 deactivate
  uint256 block.chainid, // 9800 on Diana
  address registry,      // this contract
  address attester,
  uint64  nonce,         // must equal the attester's next nonce
  uint64  deadline,      // block.timestamp <= deadline
  bytes32 payload)       // publish: keccak(reportHash, summary, keccak(uri))
  • Attester key = chain key. registerAttester accepts only the exact key that pqcKeyStatus reports for the caller, with possession proven. A deactivated key can never be revived.
  • Relayable. Anyone can submit a signed request; the ECDSA sender is irrelevant to authorisation.
  • Domain separation. The ASCII tag can't be mistaken for a QoreChain transaction frame: read as a big-endian length, "RIVE" is 0x52495645 bytes. The tag also differs from the v2 hybrid and proof-of-possession prefixes.
  • Independent verification. ReportPublished emits the public key and the signature, and verifyAttestation() re-runs the check. The Registry page does all of this from your browser.

Reports & reproducibility

A report (rivet.report/v1) records the engine and Node versions, each implementation's version and capabilities, the exact seeds and messages, the network and the block every on-chain call was pinned to, and per test: expected, actual, status, evidence (RPC, block, keccak256(calldata)). Its identity is keccak256(JCS(report)) under RFC 8785 canonical JSON.

Run it yourself

npm install
node engine/src/cli.ts run                 # all suites, live on Diana → reports/<id>.json
node engine/src/cli.ts run --offline       # local implementations only
node engine/src/cli.ts verify 1 --file reports/<id>.json
cd contracts && forge test                 # 36 tests; pqcVerify served by real ML-DSA via FFI

Security assumptions

  • The ML-DSA-87 attester key (seed) and the ECDSA operator key are held only in server environment variables. Neither is ever returned by an API or shown in the UI.
  • The web app publishes only when RIVET_WEB_OPERATOR=1 and the keys are configured. Hosted deployments are read-only.
  • The registry trusts QoreChain's pqcVerify and pqcKeyStatus precompiles. If a precompile is unavailable, the contract reverts with PrecompileUnavailable instead of assuming success.
  • A report hash proves integrity and authorship, not correctness: anyone can re-run the suites and compare results.
  • The Foundry tests replace the precompile with an FFI bridge to a real ML-DSA verifier, not a stub, so contract tests exercise real signatures.

Findings

F-1 · pqcVerify rejected valid signatures over the empty message · fixed

Up to block 10,654,799 on Diana (chain v3.2.8), the precompile returned false for valid ML-DSA-87 signatures over a 0-byte message, hedged or deterministic, from either library. @noble/post-quantum and OpenSSL both accept them, and FIPS 204 allows empty messages. Messages of one byte or more always verified. It was a false rejection with no security impact.

From block 10,654,800 (2026-11-24) the precompile accepts them. Reports #1 and #2 on registry v1 record the failure and the fix, both attested on chain. A live regression test checks both sides of that block. Rivet's own signed messages are always 239 bytes, so it was never affected.

Limitations

  • CIRCL (Go), liboqs (C) and Bouncy Castle (Java) are listed but reported as unsupported: no toolchain or binding is installed on this server.
  • OpenSSL deterministic signing uses the openssl CLI, because Node exposes no deterministic mode. The CLI cannot sign a 0-byte input, and that cell is reported as unsupported.
  • pqcVerify is active on the Diana testnet only. Publishing a report costs about 508k gas, most of it the on-chain ML-DSA-87 verification of a 4,627-byte signature.