Skip to content

feat: verify native and batch settlements with per-row ZK proofs - #38

Merged
EmperorOrokuSaki merged 25 commits into
masterfrom
feat/zk-native-eth
Nov 16, 2026
Merged

EmperorOrokuSaki merged 25 commits into
masterfrom
feat/zk-native-eth

Conversation

@ozwaldorf

@ozwaldorf ozwaldorf commented Sep 15, 2026 •

Copy link
Copy Markdown
Member

Adds native ETH ZK settlement and progressive mixed-asset batch settlement with one Groth16 proof per row. Statements bind the row, intent commitment, collector, bond attempt, payout, deadline and witness block. Collection uses a 75-block lease and supports partial/final rows, replay rejection and failed-payout claims.

Verifiers and proof fixtures now use the private beta SGX ceremony recorded in circuits commit cc59207bef6d59347d82e2f2266df6051f72fa58. The single-transfer fixtures retain the existing lease and statement context; batch libraries are generated from the same verifiers. Deployment/runtime bytecode is regenerated at 06ed6cf0796dc669b6cb001c847c66b5fc8b8e64.

This changes verification keys: new bytecode must be released together with matching Nomad proving-key pins and the API artifact pin. Existing seeded-key escrows are not compatible with ceremony proofs. There is no recursive aggregation or new settlement nullifier.

Validation on November 4: 173 Foundry tests passed, including real native/ERC20 and mixed batch proofs, partial/final collection, invalid-proof atomicity and lease-boundary checks. No on-chain transaction was submitted for this release.

Related: circuits #3, escrow #38, Nomad #138, API #103, SDK #15, frontend #342.

@ozwaldorf ozwaldorf changed the title feat: native ETH ZK escrow on the Keccacheck base feat: verify native ETH Keccacheck settlement proofs Sep 16, 2026
@ozwaldorf
ozwaldorf changed the base branch from feat/zk-keccachecheck-e2e to master October 8, 2026 04:37
The circuits repo bound the parsed header to the statement's witnessBlockHash
and block number, which changed the verifying key. The vendored proof still
carried the placeholder 0x66... hash and would not verify against a proof from
the current circuit.
The committed bytecode predated the ZK collect, so a deployment from it had no
verifier and could not accept a Groth16 proof. The ERC-20 runtime now carries
the seed-0 verifying key the circuit exports.
forge fmt --check failed on four files, which also broke the bytecode guard:
CI formats before building, so its rebuild did not match the committed hex.

Verifier.sol is generated by the circuits exporter and copied in verbatim.
Formatting it would be undone by the next export and would make the two copies
diff against each other, so it is excluded via [fmt] ignore rather than
reformatted. The three test files are hand-written and are formatted.
Re-exported from circuits f841958. The previous statement's 180-block
lease exceeded BOND_DURATION_BLOCKS, so the proof could only be spent by
writing bond storage directly; the new one is reachable through bond().

Test expectations are unchanged, including the 258,354 gas figure: the
verifying key did not move, only the witness.
From circuits 8274905. The statement now names an address a CREATE
actually produces, so a consumer can deploy the escrow where the proof
expects it instead of relocating it -- which bond() cannot survive,
since the domain separator is fixed at construction.
The native counterpart to EscrowERC20. EscrowNative publishes
expectedRecipient and expectedAmount, so the chain shows who was paid
what; here both live in intentCommitment and the escrow never learns
them.

Embeds NativeVerifier rather than Verifier: the native relation is a
separate circuit, so its verifying key differs and a proof from one path
does not verify against the other. The test collects against a real
native proof, which is what would catch the wrong verifier being wired
in -- every other guard runs before the proof logic.

Native ZK collect measures 287,445 gas against the ERC-20 ZK path's
258,354, for a contract of 8,665 deployed bytes.
The native relation reads transactionsRoot out of the shared header
gadget, which changed the ERC-20 relation's constraint system and so its
key. The vendored verifier was from the old one, and this escrow would
have rejected every proof the current circuit produces.

The proof fixture is regenerated with it, since a proof is bound to the
key it was produced under.
@ozwaldorf ozwaldorf changed the title feat: verify native ETH Keccacheck settlement proofs feat: verify native and batch settlements with per-row ZK proofs Oct 19, 2026
@ozwaldorf
ozwaldorf marked this pull request as ready for review November 16, 2026 17:44
@EmperorOrokuSaki
EmperorOrokuSaki merged commit 347bfd8 into master Nov 16, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants