The Interfold 백서

The Interfold

원문

bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 45쪽 중 34쪽

s registry , uint256 e3Id , uint256 partyId , bytes32 skAggCommit , bytes32 esmAggCommit) The aggregator collects exactly H attestations and builds the bundle (Attestation[], PartySlotBinding[]) . Each binding maps a partyId to an operator address. publishCommittee verification Any caller can call publishCommittee(e3Id, pkCommitment, proof, dkgAttestationBundle) . The registry checks, in this order: The committee is Finalized , activeCount is at least H, no key is published yet, and pkCommitment is not zero. It computes the committee hash from topNodes and stores pkCommitment . The E3 pkVerifier ( BfvPkVerifier ) checks the public input count and the committee hash limbs. It compares the two VK hashes with its immutable expectedNodesFoldKeyHash and expectedC5KeyHash , and the last input with pkCommitment . Then the Honk verifier checks the proof. The E3's frozen DkgFoldAttestationVerifier derives H = ( len − 6 ) / 3 H = (\text{len} - 6) / 3 H = ( len − 6 ) /3 and requires strictly increasing proof party IDs and H bindings. For each binding, it requires: canonicalCommitteeNodeAt(e3Id, partyId) equals the bound node. The node is an active committee member. The EIP-712 signer is the bound node. The signed skAggCommit and esmAggCommit equal the proof values at that party's slot. The registry stores dkgPartyIds , dkgSkAggCommits , and dkgEsmAggCommits for the E3. Interfold.onCommitteePublished moves the E3 to KeyPublished . It reverts after the DKG deadline, and after the input window end with InputWindowClosedBeforeKeyPublication . The registry emits CommitteeProofPublished(e3Id, nodes, pkCommitment, proof) . BfvPkVerifier.verify accepts e3Id , committeeRoot , and sortedNodes but does not use them. The current DKG circuit has no public input for them. The proof binds to the committee through the committee hash. The fold attestations bind the registry, the E3, the chain, and the verifier. The slot binding stops an aggregator from moving a signed attestation to a different party ID. The anchors let later steps map each DKG output to topNodes[partyId] . Public key transport publishCommittee stores only the commitment. Committee members then send the serialized key with publishCommitteePublicKey in 90 KiB chunks, with a maximum of 512 KiB, while the E3 is at KeyPublished . The registry emits CommitteePublicKeyChunkPublished . A consumer assembles a complete chunk set, checks keccak256(publicKey) == candidateHash , and recomputes the commitment before it uses the key. Ciphernodes also check peer key publications against the registry commitment, finalized committee, and DKG anchor party IDs. They recompute the commitment from the key bytes and retain the first matching key. Peer publications cannot replace the decryption domain or either committee roster. Nodes derive these facts from confirmed registry events. After a restart, they rebuild the projection and validated key bytes from retained event and chunk history before proof replay. They repair retained C6 intents before deduplication and reject logged compute requests with noncanonical public inputs. This recovery needs no historical registry storage reads or new key publication. Plaintext hydration recovers deferred ciphertext from retained history, including events before the snapshot cursor. It also recovers authenticated shares received before that cursor. A missing plaintext actor can therefore resume without another ciphertext or share publication. An existing snapshot remains dormant until confirmed key authority arrives. Startup continues, and the node retains the snapshot, a durable-history range, and one effects-enabled signal. It reads deferred payloads in bounded pages when authority arrives. Hydration also checks saved C6 shares and the C6 inputs retained in later aggregation phases. If a domain is invalid, the node clears the affected verification results and derived proofs, including a retained final proof. It rebuilds collection from signed history with effects disabled. A corrected share can then occupy the same party slot. Valid retained C6 work keeps its phase. Retained C7 proofs must also match that batch and its plaintext. A mismatch regenerates C7 and the final proof, including for a saved completed actor. The EVM writer separately checks each final proof against the canonical decryption domain before it retains a publication intent. It waits for missing authority and discards mismatched intents. A corrected local result can then proceed to publication. Confirmed terminal stages retire deferred and pending plaintext publication work, including after a restart. Later intents for a terminal E3 are discarded. A waiting active E3 retains one event-log sequence range, and admission reads that range in bounded pages when canonical authority arrives. Decryption proof publishPlaintextOutput computes the decryption domain on-chain and calls the E3 decryption verifier ( BfvDecryptionVerifier ). The DecryptionAggregator EVM proof has 8 + 3 ( T + 1 ) + 100 8 + 3(T + 1) + 100 8 + 3 ( T + 1 ) + 100 public inputs: Index Value 0, 1 c6_fold and C7 VK hashes 2, 3 committee_hash_hi , committee_hash_lo 4, 5 domain_hi , domain_lo 6 ciphertext_commitment 7 Aggregate verification key hash next 3 ( T + 1 ) 3(T + 1) 3 ( T + 1 ) party_ids , then expected_sk , then expected_esm last 50 Plaintext coefficients decryption_aggregator requires one domain and one ciphertext commitment across all C6 leaves. It requires each C6 d_commitment to equal the matching C7 input. Its party IDs must be 1-indexed, strictly increasing, and at most N. The wrapper then checks: Every public input is a canonical BN254 field element, and each plaintext coefficient fits in 64 bits. The VK hashes, the committee hash limbs, the domain limbs, and the stored ciphertext commitment. keccak256 of the 50 coefficients, each as 8 little-endian bytes, equals the plaintext hash. For each party, party_id - 1 is in the DKG anchors, and the proof commitments equal the stored dkgSkAggCommits and dkgEsmAggCommits . Verifier sync The Honk verifiers DkgAggregatorVerifier.sol and DecryptionAggregatorVerifier.sol are generated from the recursive VKs of dkg_aggregator and decryption_aggregator with bb write_solidity_verifier . The files in packages/interfold-contracts/contracts/verifiers/bfv/honk/ are the insecure-512 and minimum pair. The other pairs are in honk/<preset>/<committee>/ . A deployment must use the pair that matches its preset and committee. pnpm generate:verifiers has two modes. --check regenerates in memory and fails on any difference. tests/integration/lib/prebuild.sh uses it. --write overwrites the committed files. Both modes refuse to run unless dist/circuits/<preset>/<committee>/.build-stamp.json exists and circuits/bin/.active-preset.json names the same pair. The toolchain versions are pinned in crates/zk-prover/versions.json . Verifier rotation Each E3 freezes its registry and its DkgFoldAttestationVerifier at request time and announces both in DkgFoldAttestationContextEstablished . A node restores this context after a restart. A verifier change uses proposeDkgFoldAttestationVerifier , then commitDkgFoldAttestationVerifier after DKG_FOLD_VERIFIER_TIMELOCK (2 days). The owner can cancel a proposal with cancelDkgFoldAttestationVerifierProposal . The one-time setInitialDkgFoldAttestationVerifier works only when no verifier is set. A new verifier applies only to later E3 requests. Test-only aggregation bypass A binary built with the Cargo feature test-only-skip-proof-aggregation accepts the node setting skip_proof_aggregation . The node wraps C5 and C7 proof bytes in payloads for mock verifiers. The DKG placeholder carries the final roster, committee hash, and key commitment fields. The decryption placeholder carries the verified C6 domain. These fields let confirmed ingestion and the plaintext writer keep their admission checks. A production binary rejects this setting at startup, and production verifiers reject the placeholder bytes. The contracts still call their verifiers. Proof lifecycle Generation A *Pending event reaches ProofRequestActor , which dispatches ComputeRequest::zk with a ZkRequest . ZkActor writes the witness and runs bb prove , then returns Proof { data, public_signals } . A failed attempt retries the same request. Attempts after the first use the Barretenberg low-memory mode. C7 requests bind to the exact share batch and plaintext. A replacement request invalidates earlier worker responses. Plaintext aggregation checks C7 commitments, party IDs, and plaintext against the selected C6 batch. Restart recovery regenerates mismatched C7 work before final aggregation. Signing The node signs every proof with its operator key before it sends the proof. The digest is: keccak256(abi.encode( keccak256("ProofPayload(uint256 chainId,uint256 e3Id,uint256 proofType,bytes zkProof,bytes publicSignals)"), chainId, e3Id, proofType, keccak256(proof.data), keccak256(proof.public_signals))) SignedProofPayload::sign signs this digest as an EIP-191 personal message and stores the 65-byte signature. The signature binds the proof to one chain, one E3, and one proof type, and it identifies the prover. Transport Event Proofs Path EncryptionKeyCreated C0 DHT document, announced over gossip ThresholdShareCreated C2a, C2b, and the recipient's C3a, C3b DHT document, announced over gossip DecryptionKeyShared C4a, C4b DHT document, announced over gossip KeyshareCreated C1 Gossip DecryptionshareCreated C6 for each ciphertext output Gossip C5 and C7 do not travel as separate proofs. They enter the recursive proofs of the active aggregator. A node checks each document notification's structure and expiry before gossip forwards it. Valid notifications for other parties still relay. Malformed messages are rejected. A well-formed notification that expires between hops is ignored without a penalty to the relay's score. Admission does not impose message-count or byte-rate throttles on a relay. Each message must still fit the wire size limit. Document fetches use up to eight active reads and 512 waiting documents. A peer can use all idle capacity. When peers compete, the next due peer with the fewest active reads gets the next slot; ties rotate. Each read releases its slot after one attempt, within 90 seconds. Failed reads return to the queue with backoff. At capacity, a peer below its fair share can reclaim space from the largest owner. Notifications repeat to recover queue overflow. Each document retains up to 128 announcing peers through queueing and retries, including announcements that arrive during a read. A new announcer replaces the oldest one after the first when this limit is reached. Any retained announcer can supply its next fair slot. The node still fetches each document once at a time, and duplicates do not advance retry deadlines. The retained announcer with the least queued work supplies queue capacity, including for retries. Before eviction, shared work moves to a less loaded announcer. Queue growth from one peer cannot discard another announcer's only pending document. Capacity planning uses four concurrent N=19, H=14 E3s and a 2x margin. Each E3 can emit 380 document notifications and 173 ordinary publications, including six Ready updates per party. This gives 4,424 publications per round with the margin. Each seen-ID cache reserves four rounds for initial traffic and early retries, plus 15 IDs/s for six hours: 341,696 entries. A node needs 54 remote documents per E3; four E3s with the margin need 432 queue slots, rounded up to 512. Early notifications have 3,040 slots because the recipient is not yet known. These entries distinguish the announcing peer, document, and party filter, so committee selection preserves each peer's attribution. Seen-ID caches admit every new ID. Peers borrow idle space; at capacity, a peer at its fair share replaces its own oldest ID. A peer below its share reclaims space from the largest owner. Early eviction shortens retention and increments the seen_ids_early_evictions_total counter in WARN logs. Cache pressure never discards accepted startup events. Gossip tracks transport delivery IDs; storage tracks stable event IDs, so a retransmission does not add another logical contribution. A restart starts new windows. Message IDs, event IDs, and serialized data remain unchanged. Verification ProofVerificationActor verifies C0. ShareVerificationActor verifies the other node proofs with four kinds of batches: ShareProofs (C2, C3), DecryptionProofs (C4), PkGenerationProofs (C1), and ThresholdDecryptionProofs (C6). A passed proof emits ProofVerificationPassed , which the commitment checker and AccusationManager cache. An invalid proof emits SignedProofFailed , which starts the accusation pipeline. A local verifier process error retries and does not accuse the sender. Commitment chain Each circuit commits to its outputs with SAFE, a sponge API over Poseidon2 that circuits/lib/src/math/safe.nr implements. A later circuit takes the expected commitment as a public input, recomputes it from private inputs, and requires equality. Only compact commitments go on-chain. C0 ──→ C3 (recipient pk_commitment) C1 ──→ C2a (sk_commitment) C1 ──→ C2b (e_sm_commitment) C1 ──→ C5 (pk_commitment) C2a ──→ C3a (share commitment) C2b ──→ C3b (share commitment) C2a ──→ C4a (expected_commitments for all L moduli) C2b ──→ C4b (expected_commitments for all L moduli) C4a ──→ C6 (expected_sk_commitment) C4b ──→ C6 (expected_e_sm_commitment) C6 ──→ C7 (d_commitment) The recursive circuits enforce these links for the published result. The off-chain commitment consistency checker checks the same links to find the party at fault. BFV parameter presets crates/fhe-params/src/constants.rs defines the presets. Version-7 E3 requests use paramSet 0 for insecure-512 and 2 for secure-8192 . Index 1 remains in the registry for older E3s. Parameter insecure-512 secure-8192 Ring degree d d d 512 8192 Threshold CRT moduli L 2 3 DKG CRT moduli 1 2 Threshold plaintext modulus t t t 100 17000000 Statistical security parameter λ \lambda λ 2 45 Use Local development and tests only Production Circuit artifacts are compiled separately for each preset and committee. The prover and the verifier must use the same pair. Next steps Commitment consistency How nodes cross-check commitments between proofs and turn a mismatch into an accusation. Internals Sortition How the committee and its party IDs are selected before the DKG starts. Internals Cryptography The threshold BFV model and the phases P1 to P4 at a higher level. Concepts Noir circuits Install the toolchain and compile the circuit artifacts. Build Sortition Commitment Consistency ## /internals/commitment-consistency Protocol Internals Commitment Consistency Commitment Consistency This page describes the commitment consistency checks in crates/slashing and the accusation flow that follows a mismatch. It is for auditors and core contributors. It lists every registered link with its scope and its public-signal fields. At the end, you can predict which party the checker blames for a mismatch and what the chain requires before it slashes that party. Why the check exists Each ZK proof shows that one circuit ran correctly on its own inputs. A dishonest node can still use one value in C2 and a different value in C4. Each proof then verifies alone, but the link between the proofs breaks. The recursive circuits reject such a result when they fold the proofs. They do not tell the committee which party caused the failure. The commitment consistency checker compares public signals across proofs. When a commitment from one circuit does not match the value that another circuit consumes, the checker blames one party and starts an accusation. Where links are enforced The protocol checks commitment links at several layers. Only the off-chain checker assigns blame. Layer What it checks Result of a mismatch Inner circuits Each circuit recomputes the commitments that it consumes. The proof does not verify. SignedProofFailed . node_fold Same-party links: C1 to C2, C2 to C3, and equal C3a and C3b keys. The node cannot make its fold proof. dkg_aggregator Cross-party links: C0 to C3, C2 to C4, and C1 to C5. The DKG proof fails. publishCommittee cannot succeed. decryption_aggregator , BfvDecryptionVerifier C6 to C7, and C6 commitments against the DKG anchors. The decryption proof is rejected. Off-chain checker ( crates/slashing ) The 12 registered links in this page. CommitmentConsistencyViolation and an accusation. For the circuit-level links, see PVDKG and ZK proofs . Checker architecture Each E3 has one CommitmentConsistencyChecker actor ( crates/slashing/src/commitment_consistency/actor.rs ). The actor is a thin shell. The logic is in the synchronous CommitmentConsistency service ( commitment_consistency/workflow.rs ), which performs no I/O. CommitmentConsistencyCheckerExtension creates the actor with the links from e3_zk_prover::commitment_links::default_links(preset) and the committee roster size H. The service keeps one cache: // (address, proof_type) -> entries. One sender can have many entries, for example N - 1 C3a proofs. verified : HashMap <( Address , ProofType ), Vec < VerifiedProofData >> struct VerifiedProofData { party_id : u64 , address : Address , public_signals : ArcBytes , data_hash : [ u8 ; 32 ], // keccak256(abi.encode(proof.data, public_signals)) proof_data : ArcBytes , // raw proof bytes, kept for slashing evidence } Input event Action CommitmentConsistencyCheckRequested Pre-ZK gating. Cache the batch, check every link, reply with the result. ProofVerificationPassed Post-ZK check. Cache the proof, check the links for its proof type. CommitmentRosterSelected Store the accepted H-party roster, then check the C2 to C4 links. E3RequestComplete Clear the persisted state of the E3. Output event Consumer CommitmentConsistencyCheckComplete ShareVerificationActor CommitmentConsistencyViolation AccusationManager The service persists CommitmentConsistencySnapshot (version 1), which holds the roster and every cache entry. It writes the snapshot with the event that changed the state. Event replay starts after the snapshot cursor, so a restarted checker needs this snapshot to make the same decisions. Pre-ZK gating ShareVerificationActor checks the signatures of a batch first. It then publishes CommitmentConsistencyCheckRequested { e3_id, kind, correlation_id, party_proofs } . Each PartyProofData entry carries (proof_type, public_signals, data_hash, proof_data) tuples. The checker caches every proof in the batch and checks every link. It replies with CommitmentConsistencyCheckComplete { e3_id, kind, correlation_id, inconsistent_parties } . It also emits a violation for each mismatch, so that parties excluded before ZK still start an accusation. Then it removes the cache entries of the inconsistent parties. ShareVerificationActor adds those parties to the dishonest set, and they skip ZK verification. Post-ZK check After ZK verification, ProofVerificationPassed delivers each verified proof. The checker caches it and checks each link whose source or target type equals the new proof type. This path covers proofs from a later phase and cross-party links whose counterparty proof was not yet present. Deduplication One proof can arrive twice: in the pre-ZK batch and in ProofVerificationPassed . insert_verified keeps one entry for each data_hash under a given (address, proof_type) key. A second arrival does not change the cache and does not repeat a check. AccusationManager also creates at most one accusation for each (accused, proof_type) pair. Link model Each link implements the Commitmen
프로젝트로 돌아가기