The Interfold 백서

The Interfold

원문

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

d. C3: share encryption C3a encrypts one secret key share row and C3b one smudging noise share row. Each proof takes two public inputs: expected_pk_commitment from the recipient's C0 and expected_message_commitment from the sender's C2. It proves the BFV encryption relation at a Fiat-Shamir challenge point and outputs ct_commitment . The proof therefore shows that the correct share is encrypted under the correct recipient key. Share publication ProofRequestActor makes all C1, C2, and C3 proofs in parallel. It publishes nothing until the complete proof plan is ready. It then signs each proof and publishes one recipient-scoped ThresholdShareCreated for each recipient with a C0 key. That event carries: The public key share and the recipient's encrypted shares. The signed C2a and C2b proofs. The signed C3a and C3b proofs for that recipient. A dealer signature over the E3, dealer, recipient, share bytes, and complete proof bundle. The signed C1 proof does not travel in ThresholdShareCreated . It travels later in KeyshareCreated . Share verification Before saving or collecting a share, ThresholdKeyshare checks its complete message signature against the dealer's finalized committee address. A rejected message leaves the dealer's slot available for an authenticated share. Signature rejection does not accuse the claimed dealer. ThresholdShareCollector keeps authenticated shares addressed to this node. When all N − 1 N - 1 N − 1 external shares arrive, it closes. At the 75% checkpoint, it starts verification if it has at least H − 1 H - 1 H − 1 external shares, and it keeps collecting. Later shares extend the verified dealer set until all N − 1 N - 1 N − 1 arrive, local key calculation completes, or the DKG deadline passes. Local key calculation completion stops the collector and its timers. Only the DKG deadline can emit ThresholdShareCollectionFailed from an active collector. The parent ignores that failure after it reaches ReadyForDecryption or a later phase. ShareVerificationActor verifies each batch in three phases: Signatures. It recovers the signer of each proof, requires one signer for each party, and checks the circuit names. Commitment consistency. It sends CommitmentConsistencyCheckRequested to the per-E3 checker. Parties with inconsistent commitments skip the ZK step. See commitment consistency . ZK verification. It runs bb verify for the remaining parties and publishes ShareVerificationComplete with the dishonest parties. A batch with no proofs that pass local prechecks still produces and saves a verification outcome. A later authenticated share can extend the batch, including after a restart. The keyshare actor drops failed dealers and C3 proofs that target a different recipient key. It saves each verified dealer as a DkgDealer { party_id, contribution_hash } , where: contribution_hash = keccak256 ⁡ ( abi.encode ⁡ ( keccak256 ⁡ ( p k _ s h a r e ) , σ C 2 a , σ C 2 b ) ) \text{contribution\_hash} = \operatorname{keccak256}\big(\operatorname{abi.encode}(\operatorname{keccak256}(pk\_share),\ \sigma_{C2a},\ \sigma_{C2b})\big) contribution_hash = keccak256 ( abi.encode ( keccak256 ( p k _ s ha r e ) , σ C 2 a ​ , σ C 2 b ​ ) ) The value σ \sigma σ is ProofPayload.statement_digest() . It covers the E3, the proof type, the circuit, and the public signals, but not the randomized proof bytes. A replay of the same statement therefore cannot make a second dealer identity. Readiness and roster selection When at least H dealers, including the node itself, pass verification, the node publishes a signed DkgCoordination message of kind Ready . The message lists the verified dealers in ascending party ID order. The signature covers this digest: keccak256(abi.encode( keccak256("InterfoldDkgCoordination(uint256 chainId,address interfold,uint256 e3Id,uint256 partyId,uint256 kind,bytes32 dealersHash)"), chainId, interfold, e3Id, partyId, kind, dealersHash)) The active aggregator runs select_ready_roster . It returns the first H-party set, in ascending party ID order, that is mutually ready: S ⊆ Ready , ∣ S ∣ = H , ∀ i , j ∈ S : dealer j ∈ Ready i S \subseteq \text{Ready}, \quad |S| = H, \quad \forall\, i, j \in S:\ \text{dealer}_j \in \text{Ready}_i S ⊆ Ready , ∣ S ∣ = H , ∀ i , j ∈ S : dealer j ​ ∈ Ready i ​ Each member's own dealer entry must be in its own list, with the same contribution hash that the other members hold. The aggregator publishes DkgCoordination of kind Roster . A receiver accepts a roster only when all of these conditions are true: The signer is the committee member at the proposer's party ID. The proposer's party ID is at most the active party ID from AggregatorChanged . The roster has exactly H dealers, and neither the proposer nor a dealer is expelled. The proposer's Ready list and the receiver's own Ready list contain the roster. Every Ready list that the receiver holds for a roster dealer contains the roster. Before C4 starts, a roster from a lower party ID replaces a roster from a higher party ID. After C4 starts, the roster is fixed. A node starts C4 only if its own Ready list contains every roster contribution. On acceptance, the node emits CommitmentRosterSelected for the commitment checker. The network actor sends the latest local Ready and Roster messages again every 30 seconds. Each repeat uses a fresh transport delivery ID, so the libp2p duplicate cache does not drop it. This coordination is not Byzantine agreement. A malicious active aggregator can delay progress until failover. It cannot publish two accepted keys, because the H-row proof enforces one roster and publishCommittee accepts one result. C4: share decryption and aggregation Each roster member decrypts the shares that the H roster dealers sent to it, with its individual secret key. The decryption itself is outside the circuit. The node requests CalculateDecryptionKey and gets its secret key share and smudging noise share. C4a and C4b then prove, for the H roster rows: Each decrypted share hashes to the commitment that its dealer published in C2. The aggregate is the coefficient-wise sum: agg [ ℓ ] [ i ] = ∑ s ∈ S share [ s ] [ ℓ ] [ i ] m o d q ℓ \text{agg}[\ell][i] = \sum_{s \in S} \text{share}[s][\ell][i] \bmod q_\ell agg [ ℓ ] [ i ] = ∑ s ∈ S ​ share [ s ] [ ℓ ] [ i ] mod q ℓ ​ . The aggregate is reduced, reversed, and centered to match the representation of C6. The output is commit(agg_sk) for C4a and commit(agg_e_sm) for C4b. The node publishes DecryptionKeyShared with its signed C4 proofs. It collects and verifies the C4 proofs of the other H − 1 H - 1 H − 1 roster members. It then publishes KeyshareCreated with its public key share and its signed C1 proof. A node outside the roster makes C4 only if it holds all H roster shares. Its C4 does not add a row to the key. The C4 message also carries a dealer signature over its E3, party ID, node address, and complete ordered proof bundle. The receiver checks this signature before saving the first message or forwarding it to the C4 collector. A rejected message leaves that party's slot available. P2: Public key aggregation (C5) Every committee member buffers KeyshareCreated from verified members. After all H roster members submit a keyshare, each member persists VerifyingC1 and publishes AggregationInputsReady(PublicKey) . Only the active aggregator then verifies the H C1 proofs. A failed C1 proof ends the DKG with DKGInvalidShares . The active aggregator sums the H roster shares in roster order: p k 0 , agg = ∑ s ∈ S p k 0 , s m o d q ℓ , p k 1 , agg = a pk_{0,\text{agg}} = \sum_{s \in S} pk_{0,s} \bmod q_\ell, \qquad pk_{1,\text{agg}} = a p k 0 , agg ​ = s ∈ S ∑ ​ p k 0 , s ​ mod q ℓ ​ , p k 1 , agg ​ = a C5 checks each share against its C1 pk_commitment and proves the sum. It does not take p k 1 pk_1 p k 1 ​ as a witness. It uses the circuit-constant CRP a a a directly. C5 outputs commit(pk0_agg, crp) . This value is the pkCommitment that the registry stores. P3: User encryption Data providers encrypt inputs to the threshold public key with the user-data encryption circuits, which follow the Greco (opens in a new tab) design. The ct0 and ct1 proofs share a u_commitment . The wrapper user_data_encryption outputs (pk_commitment, ct_commitment, k1_commitment) . An E3 program binds the input proof to the key. For example, CRISP passes the on-chain committeePublicKey commitment as a public input. The compute provider runs the E3 program over the ciphertexts. publishCiphertextOutput then stores the output hash and its SAFE ciphertext commitment on-chain. P4: Threshold decryption (C6, C7) C6: partial decryption After CiphertextOutputPublished , each roster member computes one partial decryption for each ciphertext output. For each modulus q ℓ q_\ell q ℓ ​ , C6 proves: d ℓ = c t 0 , ℓ + c t 1 , ℓ ⋅ s k ℓ + e s m , ℓ + r 2 , ℓ ⋅ ( X d + 1 ) + r 1 , ℓ ⋅ q ℓ d_\ell = ct_{0,\ell} + ct_{1,\ell} \cdot sk_\ell + e_{sm,\ell} + r_{2,\ell} \cdot (X^{d} + 1) + r_{1,\ell} \cdot q_\ell d ℓ ​ = c t 0 , ℓ ​ + c t 1 , ℓ ​ ⋅ s k ℓ ​ + e s m , ℓ ​ + r 2 , ℓ ​ ⋅ ( X d + 1 ) + r 1 , ℓ ​ ⋅ q ℓ ​ The smudging noise e s m e_{sm} e s m ​ hides the secret key share. C6 first checks that s k sk s k and e s m e_{sm} e s m ​ match the C4 commitments. It binds the witness ciphertext to ct_commitment and checks the relation at a Fiat-Shamir challenge point. Its public inputs are expected_sk_commitment , expected_e_sm_commitment , ct_commitment , domain_hi , and domain_lo . Its output is d_commitment , a commitment to the first 50 coefficients of d d d for each modulus. The decryption domain binds each C6 proof to one E3: domain = keccak256 ⁡ ( abi.encode ⁡ ( chainId , Interfold , e 3 I d , committeeHash , ciphertextOutputHash , committeePublicKey ) ) \text{domain} = \operatorname{keccak256}\big(\operatorname{abi.encode}(\text{chainId},\ \text{Interfold},\ e3Id,\ \text{committeeHash},\ \text{ciphertextOutputHash},\ \text{committeePublicKey})\big) domain = keccak256 ( abi.encode ( chainId , Interfold , e 3 I d , committeeHash , ciphertextOutputHash , committeePublicKey ) ) The node publishes DecryptionshareCreated with one signed C6 proof for each ciphertext output. Plaintext aggregation Every committee member stores valid shares. A valid share comes from an accepted roster member. Its signature, E3, proof type, raw share commitment, ciphertext position, and canonical decryption domain must also be correct. These checks run before the share reserves a party slot. When T + 1 distinct roster shares are durable, the member publishes AggregationInputsReady(Plaintext) . For small , that is 10 shares, not all 14. Shares that arrive during C6 verification go to a durable backup queue. If a proof or a raw share check fails, the active aggregator uses backups while T + 1 valid roster shares are still possible. C7: reconstruction C7 takes the T + 1 shares with 1-indexed party IDs x i x_i x i ​ in strictly increasing order. It proves three steps: Lagrange interpolation at zero for each modulus, with coefficients computed in the circuit: u ℓ = ∑ i d i , ℓ ⋅ λ i ( 0 ) m o d q ℓ u_\ell = \sum_i d_{i,\ell} \cdot \lambda_i(0) \bmod q_\ell u ℓ ​ = ∑ i ​ d i , ℓ ​ ⋅ λ i ​ ( 0 ) mod q ℓ ​ , where λ i ( 0 ) = ∏ j ≠ i − x j x i − x j \lambda_i(0) = \prod_{j \ne i} \frac{-x_j}{x_i - x_j} λ i ​ ( 0 ) = ∏ j  = i ​ x i ​ − x j ​ − x j ​ ​ . CRT reconstruction: u ℓ + r ℓ ⋅ q ℓ = u global u_\ell + r_\ell \cdot q_\ell = u_{\text{global}} u ℓ ​ + r ℓ ​ ⋅ q ℓ ​ = u global ​ for every modulus. Decoding with the precomputed − Q − 1 m o d t -Q^{-1} \bmod t − Q − 1 mod t , where Q = ∏ ℓ q ℓ Q = \prod_\ell q_\ell Q = ∏ ℓ ​ q ℓ ​ and t t t is the plaintext modulus. C7 compares every decoded coefficient with the claimed message, including coefficients claimed as zero. Crash tolerance and liveness The DKG is crash tolerant: it can finish when some members are offline. The protocol omits missing members at defined points. It does not accuse or slash them, because a local timeout does not prove that a peer failed to publish. Member stops Protocol behavior Result Before its C0 key arrives Other members continue at the C0 cutoff with at least H keys. They fill its C3 slots with placeholders. It cannot be a dealer or a roster member. Before its threshold shares arrive Other members start roster work with at least H − 1 H - 1 H − 1 external shares and accept later shares. It is not in the roster. A member has fewer than H verified dealers It stays outside C4. It does not fail the E3. The E3 continues if a roster forms. Active aggregator, during roster selection After 10 minutes, the next eligible party becomes active and uses the saved Ready reports. The roster forms if H members are mutually ready. A roster member, after roster acceptance and before key publication No replacement exists. The fixed H-row proof needs every roster member. The E3 fails with DKGTimeout after the DKG deadline. A roster member is expelled or excluded before key publication The public-key aggregator stops the DKG because the fixed H-row proof needs every selected member. The E3 fails. A roster member is expelled or excluded after key publication Public-key aggregators retain canonical publication, including after restart. Decryption still needs T + 1 valid roster shares. Decryption continues if enough valid shares remain and the chain has not failed the E3. Active aggregator, during C5 or publication After 10 minutes, the next eligible party resumes from its persisted phase. Publication continues. Up to H − ( T + 1 ) H - (T + 1) H − ( T + 1 ) roster members, before decryption The aggregator starts at T + 1 valid roster shares. Decryption continues. Active aggregator, during plaintext aggregation After 10 minutes, the next eligible party resumes. Decryption continues. ⚠️ Before key publication, each of the H selected members is necessary for the DKG. A roster member that stops permanently can fail the E3, even if other committee members stay online. Public-key aggregators log raw expulsions and exclusions at INFO. Each record identifies the removal kind, node, E3, and, for an exclusion, the proof type. After canonical key publication, the record states that DKG handling is skipped because the key is already published. Chain failures and decryption failures from insufficient valid roster shares still apply. Restart recovery A member that restarts recovers its work from the durable event log: It restores collectors with the remaining time to each cutoff. Every new threshold-share collector receives saved expulsions, then all retained authenticated contributions, including when a later share starts collection after restart. Public-key aggregators restore canonical key publication from the lifecycle projection. This prevents a later expulsion or exclusion from failing completed DKG work, including on standby nodes. It holds replayed GenPkShareAndSkSss and GenEsiSss responses until their prerequisites return. It does not make new random shares that conflict with its published C1 to C3 proofs. NodeProofAggregator restores saved inner proofs and fold metadata, then issues the fold again or publishes the saved result. A persisted Failed state publishes the same E3Failed payload again after EffectsEnabled . A local prover, verifier, or worker failure retries the same request. It never counts as proof that a peer sent invalid data. The node accepts a collector failure only for the same E3 while that collection remains current: Encryption-key failures apply in Init and CollectingEncryptionKeys . Threshold-share failures apply from Init through AggregatingDecryptionKey . C4 failures apply in ReadyForDecryption until C4 verification completes or keyshare publication is authorized. Canonical key publication supersedes all three collectors. A PublicKeyAggregated intent and its saved public-key context do not suppress a current collector failure. The node records canonical publication for the matching E3 even when PublicKeyAggregated has not arrived. An earlier stage does not reopen collection. On restart, the node restores publication awareness from the saved E3 lifecycle projection. An ignored failure changes no state and publishes no failure event. When a current collector timeout is fatal, the node records a local E3Failed event. On-chain, the E3 stays at CommitteeFinalized until the DKG deadline. After that, markE3Failed records DKGTimeout . Proof aggregation and on-chain anchoring The contracts accept only aggregated proofs. The active aggregator submits one recursive proof for the DKG and one for the decryption. Production nodes always aggregate. The EVM writer publishes a single ciphertext output only. It refuses to publish an E3 result that has more than one decrypted output. ZkRequest Made by Output NodeDkgFold Each roster member A NodeFold proof. The node then signs a fold attestation. DkgAggregation Active aggregator NodesFold , C5, and the DkgAggregator EVM proof DecryptionAggregation Active aggregator C6Fold , C7, and the DecryptionAggregator EVM proof for each output Committee hash Both final proofs bind the ordered committee. The hash covers the raw 20-byte addresses of topNodes in ascending order, without padding: h = keccak256 ⁡ ( a 0 ∥ a 1 ∥ ⋯ ∥ a N − 1 ) , h hi = h ≫ 128 , h lo = h m o d 2 128 h = \operatorname{keccak256}(a_0 \,\|\, a_1 \,\|\, \cdots \,\|\, a_{N-1}), \qquad h_{\text{hi}} = h \gg 128, \quad h_{\text{lo}} = h \bmod 2^{128} h = keccak256 ( a 0 ​ ∥ a 1 ​ ∥ ⋯ ∥ a N − 1 ​ ) , h hi ​ = h ≫ 128 , h lo ​ = h mod 2 128 Solidity computes it in CommitteeHashLib.hash . Rust computes it in e3_committee_hash::hash_committee_addresses ( crates/committee-hash ). Noir computes it in committee_hash_limbs . A shared test vector checks that the three implementations agree. What the DKG proof enforces node_fold verifies the five inner proofs of one node and asserts these same-party links: C1 sk_commitment equals the C2a expected_secret_commitment , and C1 e_sm_commitment equals the C2b one. The C3a and C3b recipient key commitments are equal for every slot. For every slot except the node's own, the C3 message commitment equals the C2 share commitment. dkg_aggregator verifies nodes_fold and C5, then asserts these cross-party links: The committee hash limbs match the N committee addresses. The H party IDs are strictly increasing and less than N. Each folded row carries the matching party ID. For each roster sender s s s and recipient r r r , the C3 key slot of s s s for r r r equals the C0 commitment of r r r . For the same pairs, the C4 rows of r r r for s s s equal the C2 commitments of s s s for r r r . This applies to both branches. Row i i i of C5 equals the C1 pk_commitment of roster member i i i . DKG proof public inputs The DkgAggregator EVM proof has 3 H + 6 3H + 6 3 H + 6 public inputs: Index Value 0 nodes_fold_key_hash 1 c5_key_hash 2 to 1 + H 1 + H 1 + H party_ids (0-indexed committee slots) 2 + H 2 + H 2 + H committee_hash_hi 3 + H 3 + H 3 + H committee_hash_lo 4 + H 4 + H 4 + H Aggregate verification key hash 5 + H 5 + H 5 + H to 4 + 2 H 4 + 2H 4 + 2 H sk_agg_commits 5 + 2 H 5 + 2H 5 + 2 H to 4 + 3 H 4 + 3H 4 + 3 H esm_agg_commits 5 + 3 H 5 + 3H 5 + 3 H Aggregated public key commitment Fold attestations After its NodeFold proof, each roster member signs an EIP-712 attestation and gossips it in DKGRecursiveAggregationComplete . The domain and struct come from DkgFoldAttestationLib : // EIP712Domain(string name,string version,uint256 chainId,address verifyingContract) // name = "InterfoldDkgFoldAttestation", version = "1", // verifyingContract = the DkgFoldAttestationVerifier frozen for this E3 DkgFoldAttestation ( addres
프로젝트로 돌아가기