Skip to content

feat: add onchain proofs to events#1484

Merged
cedoor merged 1 commit into
mainfrom
feat/onchain-proof-events
Mar 25, 2026
Merged

feat: add onchain proofs to events#1484
cedoor merged 1 commit into
mainfrom
feat/onchain-proof-events

Conversation

@cedoor

@cedoor cedoor commented Mar 25, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

Release Notes

  • New Features

    • CommitteePublished and PlaintextOutputPublished events now include zero-knowledge proof data as additional parameters for on-chain verification and validation processes.
  • Documentation

    • Updated event signatures, computation flows, and developer guides to reflect the addition of proof parameters in blockchain event emissions.
  • Tests

    • Updated test fixtures and event assertions to validate new proof parameters included in event logs.
  • Chores

    • Updated contract artifacts and deployment metadata.

@cedoor cedoor requested review from 0xjei, ctrlc03 and hmzakhalid March 25, 2026 16:06
@vercel

vercel Bot commented Mar 25, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
crisp Ready Ready Preview, Comment Mar 25, 2026 4:27pm
enclave-docs Ready Ready Preview, Comment Mar 25, 2026 4:27pm

Request Review

@cedoor cedoor linked an issue Mar 25, 2026 that may be closed by this pull request
@cedoor cedoor enabled auto-merge (squash) March 25, 2026 16:09
@cedoor cedoor linked an issue Mar 25, 2026 that may be closed by this pull request
@coderabbitai

coderabbitai Bot commented Mar 25, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

This PR extends two core event signatures across the Enclave system by adding ZK proof parameters: CommitteePublished now emits (e3Id, nodes, publicKey, proof) and PlaintextOutputPublished now emits (e3Id, plaintextOutput, proof). Updates span Solidity interfaces, Rust event types, test fixtures, documentation, SDK types, and contract deployments.

Changes

Cohort / File(s) Summary
Documentation Updates
agent/flow-trace/00_INDEX.md, agent/flow-trace/04_DKG_AND_COMPUTATION.md, agent/flow-trace/06_DEACTIVATION_AND_COMPLETION.md, docs/pages/building-with-enclave.mdx, docs/pages/computation-flow.mdx
Updated flow documentation to reflect new proof parameters in CommitteePublished and PlaintextOutputPublished event signatures, documenting C5 and C7 proof inclusion.
Rust Event Structures
crates/events/src/enclave_event/committee_published.rs, crates/events/src/enclave_event/plaintext_output_published.rs
Added proof: Vec<u8> field to both event structs; updated Display implementations to log proof_len alongside existing fields.
Solidity Event Interfaces
packages/enclave-contracts/contracts/interfaces/ICiphernodeRegistry.sol, packages/enclave-contracts/contracts/interfaces/IEnclave.sol
Extended event declarations with trailing bytes proof parameter; added NatSpec documentation for proof field.
Solidity Event Emissions
packages/enclave-contracts/contracts/Enclave.sol, packages/enclave-contracts/contracts/registry/CiphernodeRegistryOwnable.sol
Updated emit statements to pass proof argument when firing CommitteePublished and PlaintextOutputPublished events.
EVM Helpers & Test Contracts
crates/evm-helpers/src/events.rs, crates/evm-helpers/tests/fixtures/fake_enclave.sol, crates/indexer/tests/fixtures/fake_enclave.sol
Updated event ABI definitions and FakeEnclave contract signatures to include bytes proof; updated emit functions to accept and forward proof parameter.
Indexer Integration
crates/indexer/src/indexer.rs, crates/indexer/tests/integration.rs
Enhanced event logging to include proof_len in info messages; updated integration test to pass proof argument in contract calls.
Event Type Definitions
packages/enclave-sdk/src/events/types.ts
Added required proof: string field to PlaintextOutputPublishedData and CommitteePublishedData interfaces.
ABI Artifact Files
packages/enclave-contracts/artifacts/contracts/interfaces/ICiphernodeRegistry.sol/ICiphernodeRegistry.json, packages/enclave-contracts/artifacts/contracts/interfaces/IEnclave.sol/IEnclave.json, packages/enclave-contracts/artifacts/contracts/interfaces/IBondingRegistry.sol/IBondingRegistry.json, packages/enclave-contracts/artifacts/contracts/interfaces/ISlashingManager.sol/ISlashingManager.json, packages/enclave-contracts/artifacts/contracts/token/EnclaveTicketToken.sol/EnclaveTicketToken.json
Regenerated artifact metadata with updated buildInfoId; updated event ABI definitions to include bytes proof parameter for CommitteePublished and PlaintextOutputPublished.
Test Assertions
packages/enclave-contracts/test/Enclave.spec.ts, packages/enclave-contracts/test/Registry/CiphernodeRegistryOwnable.spec.ts
Updated event expectation matchers to include proof argument in .withArgs(...) assertions.
Deployment Registry
packages/enclave-contracts/deployed_contracts.json
Updated localhost network contract block numbers and registry entries; added MockDecryptionVerifier and MockPkVerifier, reorganized verifier contract mappings.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related issues

  • #1464: Adds on-chain verified proof bytes to CommitteePublished and PlaintextOutputPublished event signatures—directly overlaps with changes in this PR.

Possibly related PRs

  • #1443: Adds ZK proof payloads (C5/C7) to the same event signatures and modifies event-handling code across contracts and indexer.
  • #815: Modifies the publish plaintext output path to include a proof parameter in interface and call site signatures.
  • #1374: Adds C5 public-key-aggregation proof support with new proof field definitions and plumbing.

Suggested reviewers

  • hmzakhalid
  • ctrlc03

Poem

🐰 Events now carry proofs so bright,
C5 and C7 in the night,
Committees publish, outputs sing,
Verified bytes for everything! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: add onchain proofs to events' accurately summarizes the main change: adding proof parameters to CommitteePublished and PlaintextOutputPublished events across documentation, Rust structs, Solidity contracts, and TypeScript types.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/onchain-proof-events

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
agent/flow-trace/04_DKG_AND_COMPUTATION.md (2)

482-509: ⚠️ Potential issue | 🟡 Minor

Fix the documented publishCommittee call shape.

Line 483 and Line 487 still describe publishCommittee(..., pkHash), but the ABI checked in with this PR now expects (e3Id, nodes, publicKey, proof, foldProof). The event line was updated to carry the C5 proof, so the surrounding flow should show where both proof blobs are supplied too.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@agent/flow-trace/04_DKG_AND_COMPUTATION.md` around lines 482 - 509, Update
the flow text to reflect the corrected publishCommittee signature and where
proofs are supplied: change references to publishCommittee(e3Id, nodes, pkHash)
to publishCommittee(e3Id, nodes, publicKey, proof, foldProof) (as invoked by
CiphernodeRegistrySolWriter) and ensure the CommitteePublished emission and
surrounding steps note that the C5 proof and foldProof are passed into the
contract call and included in the emitted event alongside the full publicKey;
also adjust the Enclave.onCommitteePublished / stored fields description to
remain accurate (public key stored as pkHash) while documenting that the proofs
are supplied to the on-chain publish call and event.

677-709: ⚠️ Potential issue | 🟡 Minor

This plaintext publication flow still omits foldProof.

Line 678 and Line 682 document a 3-arg publishPlaintextOutput call, while packages/enclave-contracts/artifacts/contracts/interfaces/IEnclave.sol/IEnclave.json now defines (e3Id, plaintextOutput, proof, foldProof). Please sync this section so the flow doc matches the contract ABI and the earlier C7a/C7b discussion.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@agent/flow-trace/04_DKG_AND_COMPUTATION.md` around lines 677 - 709, The flow
doc's plaintext publication sequence references publishPlaintextOutput as a
3-arg call but the contract ABI (IEnclave.json) and earlier C7a/C7b discussion
require a 4th foldProof parameter; update the diagram and text around
EnclaveSolWriter / publishPlaintextOutput(e3Id, output, proof) to include
foldProof (e.g., publishPlaintextOutput(e3Id, plaintextOutput, proof,
foldProof)), ensure steps that mention decryptionVerifier.verify or the emitted
PlaintextOutputPublished event reflect the additional foldProof argument, and
align the narrative with the C7a/C7b fold proof usage so the doc matches the
current contract interface.
🧹 Nitpick comments (1)
crates/evm-helpers/src/events.rs (1)

61-64: Consider single-sourcing these event ABIs.

Adding proof here required matching edits in the contract artifacts and both fake Solidity fixtures. Since this file is still a hand-maintained ABI copy, the drift risk behind the TODO is already showing up.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@crates/evm-helpers/src/events.rs` around lines 61 - 64, The manually
maintained event ABI in events.rs (the PlaintextOutputPublished and
CommitteePublished event definitions) is drifting from the actual contract
artifacts; replace the hand-written ABI with a single-sourced generation
approach: remove the manual event declarations and instead derive/load the event
ABIs from the canonical contract artifact (e.g., via abigen!/ethers-abi codegen
or include_str! on the compiled contract JSON and parse it in a build script) so
changes to events like the added proof field on
PlaintextOutputPublished/CommitteePublished come from one source of truth and
propagate to both runtime code and test fixtures automatically.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@agent/flow-trace/04_DKG_AND_COMPUTATION.md`:
- Around line 482-509: Update the flow text to reflect the corrected
publishCommittee signature and where proofs are supplied: change references to
publishCommittee(e3Id, nodes, pkHash) to publishCommittee(e3Id, nodes,
publicKey, proof, foldProof) (as invoked by CiphernodeRegistrySolWriter) and
ensure the CommitteePublished emission and surrounding steps note that the C5
proof and foldProof are passed into the contract call and included in the
emitted event alongside the full publicKey; also adjust the
Enclave.onCommitteePublished / stored fields description to remain accurate
(public key stored as pkHash) while documenting that the proofs are supplied to
the on-chain publish call and event.
- Around line 677-709: The flow doc's plaintext publication sequence references
publishPlaintextOutput as a 3-arg call but the contract ABI (IEnclave.json) and
earlier C7a/C7b discussion require a 4th foldProof parameter; update the diagram
and text around EnclaveSolWriter / publishPlaintextOutput(e3Id, output, proof)
to include foldProof (e.g., publishPlaintextOutput(e3Id, plaintextOutput, proof,
foldProof)), ensure steps that mention decryptionVerifier.verify or the emitted
PlaintextOutputPublished event reflect the additional foldProof argument, and
align the narrative with the C7a/C7b fold proof usage so the doc matches the
current contract interface.

---

Nitpick comments:
In `@crates/evm-helpers/src/events.rs`:
- Around line 61-64: The manually maintained event ABI in events.rs (the
PlaintextOutputPublished and CommitteePublished event definitions) is drifting
from the actual contract artifacts; replace the hand-written ABI with a
single-sourced generation approach: remove the manual event declarations and
instead derive/load the event ABIs from the canonical contract artifact (e.g.,
via abigen!/ethers-abi codegen or include_str! on the compiled contract JSON and
parse it in a build script) so changes to events like the added proof field on
PlaintextOutputPublished/CommitteePublished come from one source of truth and
propagate to both runtime code and test fixtures automatically.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ebd90a6f-c5cb-497e-bd71-2a8e14a0e0ca

📥 Commits

Reviewing files that changed from the base of the PR and between 8ed2fa9 and 1e6275b.

📒 Files selected for processing (27)
  • agent/flow-trace/00_INDEX.md
  • agent/flow-trace/04_DKG_AND_COMPUTATION.md
  • agent/flow-trace/06_DEACTIVATION_AND_COMPLETION.md
  • crates/events/src/enclave_event/committee_published.rs
  • crates/events/src/enclave_event/plaintext_output_published.rs
  • crates/evm-helpers/src/events.rs
  • crates/evm-helpers/tests/fixtures/fake_enclave.sol
  • crates/indexer/src/indexer.rs
  • crates/indexer/tests/fixtures/fake_enclave.sol
  • crates/indexer/tests/integration.rs
  • docs/pages/building-with-enclave.mdx
  • docs/pages/computation-flow.mdx
  • packages/enclave-contracts/artifacts/contracts/Enclave.sol/Enclave.json
  • packages/enclave-contracts/artifacts/contracts/interfaces/IBondingRegistry.sol/IBondingRegistry.json
  • packages/enclave-contracts/artifacts/contracts/interfaces/ICiphernodeRegistry.sol/ICiphernodeRegistry.json
  • packages/enclave-contracts/artifacts/contracts/interfaces/IEnclave.sol/IEnclave.json
  • packages/enclave-contracts/artifacts/contracts/interfaces/ISlashingManager.sol/ISlashingManager.json
  • packages/enclave-contracts/artifacts/contracts/registry/CiphernodeRegistryOwnable.sol/CiphernodeRegistryOwnable.json
  • packages/enclave-contracts/artifacts/contracts/token/EnclaveTicketToken.sol/EnclaveTicketToken.json
  • packages/enclave-contracts/contracts/Enclave.sol
  • packages/enclave-contracts/contracts/interfaces/ICiphernodeRegistry.sol
  • packages/enclave-contracts/contracts/interfaces/IEnclave.sol
  • packages/enclave-contracts/contracts/registry/CiphernodeRegistryOwnable.sol
  • packages/enclave-contracts/deployed_contracts.json
  • packages/enclave-contracts/test/Enclave.spec.ts
  • packages/enclave-contracts/test/Registry/CiphernodeRegistryOwnable.spec.ts
  • packages/enclave-sdk/src/events/types.ts

@ctrlc03 ctrlc03 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK

@cedoor cedoor merged commit 1f5b4ab into main Mar 25, 2026
31 checks passed
@ctrlc03 ctrlc03 deleted the feat/onchain-proof-events branch March 25, 2026 17:19
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.

Add proofs verified onchain to existing events Post and verify all PV-TRBFV proofs on-chain

2 participants