The Interfold 백서

The Interfold

원문

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

tLink trait in crates/events/src/commitment_link.rs . A FieldValue is a 32-byte field element. pub trait CommitmentLink : Send + Sync { fn name ( & self) -> & ' static str ; fn source_proof_type ( & self) -> ProofType ; // produces the commitment fn target_proof_type ( & self) -> ProofType ; // consumes or agrees with it fn scope ( & self) -> LinkScope ; fn extract_source_values ( & self, public_signals : & [ u8 ]) -> Vec < FieldValue >; fn check_signals ( & self, source_values : & [ FieldValue ], target_public_signals : & [ u8 ]) -> bool ; fn check_consistency ( & self, source_values : & [ FieldValue ], target_public_signals : & [ u8 ], src_party_id : u64 , tgt_party_id : u64 , ) -> bool ; } The LinkScope decides which targets a source is compared with. Blame always goes to the source party. Scope Matching rule in find_mismatches SameParty Compare each source entry with each target entry from the same address. The first failed comparison blames the source. CrossParty A source passes if it matches at least one cached target from any party. With no cached target, the check waits. SourceMustExistInTargets The same rule as CrossParty , with two special cases: C3 to C0 never blames, and C2 to C4 waits for the full roster. Registered links default_links(preset) in crates/zk-prover/src/commitment_links/mod.rs registers 12 links. The C2 to C4 links take l = preset.metadata().num_moduli . The preset is the E3 threshold preset, so l is 2 for insecure-512 and 3 for secure-8192 . DKG links Struct name() Source to target Scope Check C3aToC0PkCommitmentLink C3a->C0 pk_commitment C3a to C0 SourceMustExistInTargets C3 expected_pk_commitment equals a C0 pk_commitment . Never blames (see below). C3bToC0PkCommitmentLink C3b->C0 pk_commitment C3b to C0 SourceMustExistInTargets The same for C3b. Never blames. C1ToC2aSkCommitmentLink C1->C2a sk_commitment C1 to C2a SameParty C1 sk_commitment equals the first C2a signal, expected_secret_commitment . C1ToC2bESmCommitmentLink C1->C2b e_sm_commitment C1 to C2b SameParty C1 e_sm_commitment equals the first C2b signal. C1ToC5PkCommitmentLink C1->C5 pk_commitment C1 to C5 CrossParty C1 pk_commitment is one of the first H C5 signals, the expected key share commitments. C3aToC2aShareEncryptionLink C3a->C2a expected_message_commitment C3a to C2a SameParty C3 expected_message_commitment is one of the C2a share commitments. C3bToC2bShareEncryptionLink C3b->C2b expected_message_commitment C3b to C2b SameParty The same for C3b and C2b. C2aToC4aShareCommitmentLink C2a->C4a share commitments C2a to C4a SourceMustExistInTargets See the C2 to C4 link . C2bToC4bShareCommitmentLink C2b->C4b share commitments C2b to C4b SourceMustExistInTargets The same for the smudging noise branch. Threshold decryption links Struct name() Source to target Scope Check C4aToC6SkCommitmentLink C4a->C6 sk_commitment C4a to C6 SameParty The C4a output commitment equals the C6 input expected_sk_commitment . C4bToC6ESmCommitmentLink C4b->C6 e_sm_commitment C4b to C6 SameParty The C4b output commitment equals the C6 input expected_e_sm_commitment . C6ToC7DCommitmentLink C6->C7 d_commitment C6 to C7 CrossParty The C6 d_commitment is one of the expected d commitments at the start of C7. The public-signal field names come from crates/zk-helpers/src/circuits/output_layout.rs . Inputs sit at the start of public_signals and outputs at the end. C3 inputs are expected_pk_commitment and expected_message_commitment . C6 inputs are expected_sk_commitment , expected_e_sm_commitment , ct_commitment , domain_hi , and domain_lo . For the C6 to C7 link, the checker derives the number of d commitments as ( F − 100 ) / 2 (F - 100) / 2 ( F − 100 ) /2 , where F F F is the number of C7 fields. The disabled C3 to C0 links The two C3 to C0 links are registered, but find_mismatches returns no mismatch for them. The C0 set is not closed when members are absent, because an omitted C0 key can arrive later. A missing key in the local cache therefore cannot prove that a C3 recipient key is wrong. Two other checks cover this relation. Each recipient compares every C3 proof addressed to it with its own C0 pk_commitment . A dealer that encrypted for a different key leaves the readiness set of that recipient, without an accusation. The dkg_aggregator circuit also requires each roster C3 key slot to equal the recipient's C0 commitment. The C2 to C4 link This link crosses two parties: the dealer that made C2 and the recipient that made C4. It is the only link that depends on the accepted roster. Public signal layouts C2 ( sk_share_computation or e_sm_share_computation ) has 1 + N ⋅ L 1 + N \cdot L 1 + N ⋅ L fields in party-major order: [expected_secret_commitment] <- skipped by extract_share_commitments [party_0_mod_0] ... [party_0_mod_{L-1}] [party_1_mod_0] ... [party_{N-1}_mod_{L-1}] C4 ( share_decryption ) has H ⋅ L + 1 H \cdot L + 1 H ⋅ L + 1 fields. The rows follow the accepted roster order, not the full committee order: [expected_commitments[0][0]] ... [expected_commitments[0][L-1]] ... [expected_commitments[H-1][0]] ... [expected_commitments[H-1][L-1]] [commitment] <- aggregate, not compared Check logic Let X X X be a dealer and R R R a C4 producer, both named by full-committee party IDs. Let k X k_X k X ​ be the position of X X X in the accepted roster. check_exact_l_commitments compares L L L values: match ( X , R ) ⟺ C 2 X [ R ⋅ L + ℓ ] = C 4 R [ k X ⋅ L + ℓ ] for all 0 ≤ ℓ < L \text{match}(X, R) \iff C2_X[R \cdot L + \ell] = C4_R[k_X \cdot L + \ell] \quad \text{for all } 0 \le \ell < L match ( X , R ) ⟺ C 2 X ​ [ R ⋅ L + ℓ ] = C 4 R ​ [ k X ​ ⋅ L + ℓ ] for all 0 ≤ ℓ < L The checker evaluates the link only after three conditions are true: CommitmentRosterSelected delivered an accepted roster of exactly H ascending party IDs. The dealer X X X is in the roster. A C2 source outside the roster is skipped. The cache holds C4 targets from all H roster members. The checker then blames X X X only if no cached C4 target matches. Waiting for every roster target keeps a late C4 proof from looking like a mismatch. A dealer passes when at least one C4 target matches. The checker therefore blames a dealer whose commitments match no recipient. The dkg_aggregator circuit is stricter: it requires every roster pair to match before the key can be published. The roster is persisted in the checker snapshot. A conflicting roster, a roster of the wrong size, or a roster that is not in ascending order is ignored. Accusation flow A violation becomes a slash proposal only after enough committee members confirm it with signed votes. Detect The checker emits a violation. Accuse The node signs and broadcasts an accusation. Vote Members with the same local failure vote. Decide H matching votes give AccusedFaulted. Slash A voter submits the evidence on-chain. Violation event pub struct CommitmentConsistencyViolation { pub e3_id : E3id , pub accused_party_id : u64 , pub accused_address : Address , pub proof_type : ProofType , // the source proof type pub data_hash : [ u8 ; 32 ], // keccak256(abi.encode(proof.data, public_signals)) pub evidence : Bytes , // abi.encode(proof.data, public_signals), the preimage of data_hash } Off-chain voting AccusationManager ( crates/slashing/src/accusation_voting/ ) handles the violation: It ignores a local failure against its own address or finalized party ID. For another member, it records the failure for (accused, proof_type) with the data hash and the evidence. It creates a ProofFailureAccusation with an issue time and a deadline, signs it, and broadcasts it. It refuses when the local vote validity is 0. It casts its own AccusationVote and starts a 300-second vote timeout. A local proof-failure accusation requires the proof's signature from the claimed committee member. The signed E3 and proof type must match the failure. An unrecoverable signature does not identify a dealer through the claimed party ID. A peer that receives the accusation checks the deadline window, the committee membership of the accuser and the accused, and the accuser's signature. It rejects an accusation when the accuser and accused have the same signed address. The accusation digest does not include accused_party_id , so the peer does not use that field to identify a received self-accusation. The peer votes only after local verification fails. For C3a and C3b, a peer without a local record can verify a forwarded signed proof. Accusations for other proof types cannot carry a forwarded payload, even if local evidence exists. The peer abstains if verification passes or if it has neither local evidence nor an accepted forwarded proof. The wire has no disagree vote. Every vote is an agreement. An accusation needs H agreeing votes. H is the roster size from CiphernodesCommitteeSize : Votes and data hashes Outcome Slashable At least H votes, one data hash AccusedFaulted Yes At least H votes, more than one data hash Equivocation No Fewer than H votes when the timeout expires Inconclusive No Equivocation means that the accused sent different data to different nodes. The current evidence format carries one preimage, so it cannot prove every payload. A process restart does not rebuild a partial vote tally or its timers. Submission SlashingManagerSolWriter acts only on AccusedFaulted . It first reads the slash policy for reason = keccak256(abi.encodePacked(uint256(proofType))) : If the policy is disabled, the node sends no transaction. It publishes CommitteeMemberExcluded , and the member is excluded from local work for this E3 only. If the policy is enabled, the three lowest-address voters can submit. Rank r r r waits 30 r 30r 30 r seconds. The on-chain DuplicateEvidence check limits execution to one proposal. The writer calls proposeSlashByDkgParty(e3Id, partyId, proof) when the party ID resolves in the DKG anchors. Otherwise it calls proposeSlash(e3Id, operator, proof) . Signed values Solidity and Rust derive the same accusation ID and vote digest: accusationId = keccak256(abi.encodePacked(chainId, e3Id, accused, uint256(proofType))) EIP-712 domain: name "InterfoldSlashing", version "1", chainId, verifyingContract = SlashingManager AccusationVote(uint256 e3Id,bytes32 accusationId,address voter,bytes32 dataHash,uint256 issuedAt,uint256 deadline) The Rust constants are VOTE_DOMAIN_NAME , VOTE_DOMAIN_VERSION , and VOTE_TYPEHASH_STR in crates/events/src/interfold_event/accusation_vote.rs . The Solidity constants are EIP712_DOMAIN_NAME and EIP712_DOMAIN_VERSION in SlashingManager.sol . On-chain evidence checks SlashingManager decodes the proof argument as: abi. encode ( uint256 proofType , address [] voters , bytes32 [] dataHashes , bytes evidence , uint256 issuedAt , uint256 deadline , bytes [] signatures ) _proposeSlash and SlashingEvidenceLib.verifyAttestationEvidence require these conditions: Check Error The policy for keccak256(abi.encodePacked(proofType)) is enabled and requires proof. SlashReasonDisabled , InvalidPolicy The operator is a committee member of the E3. OperatorNotInCommittee This (chainId, e3Id, operator, proofType) was not used before. DuplicateEvidence The E3 snapshot and the live registry accusationVoteValidity are not zero. AccusationSlashingDisabled The time is at or before the E3 slash submission deadline. SlashSubmissionDeadlinePassed issuedAt is at most 30 seconds in the future. AccusationIssuedInFuture deadline - issuedAt is at most the E3 snapshot of the vote validity. InvalidAccusationWindow The time is at or before deadline . SignatureExpired The vote count is at least H. InsufficientAttestations keccak256(evidence) equals the shared data hash. InvalidProof Voters are strictly ascending, and none is the accused. DuplicateVoter , VoterIsAccused Every data hash is equal. EquivocationDetected Every voter is an active committee member. VoterNotInCommittee Every signature recovers to its voter over the EIP-712 AccusationVote digest. InvalidVoteSignature The slash submission deadline is the E3 lifecycle deadline plus ACCUSATION_REPORTING_WINDOW (1 day). When all checks pass, the manager records a proposal with executableAt = block.timestamp + appealWindow . Before that time, the operator or its bond owner can call fileAppeal once. If the policy's appealWindow is 0, the slash executes in the same transaction and cannot be appealed. Vote validity window CiphernodeRegistryOwnable.accusationVoteValidity is the longest signed window for an accusation vote. initialize sets it to DEFAULT_ACCUSATION_VOTE_VALIDITY (30 minutes). Each E3 snapshots the value at request time. setAccusationVoteValidity can keep or increase the value. It also cancels a pending reduction. A reduction uses proposeAccusationVoteValidity , waits ACCUSATION_VOTE_VALIDITY_TIMELOCK (2 days), and then uses commitAccusationVoteValidity within the next 2 days. A value of 0 stops new attestation slashes. Nodes stop creating votes, and the manager rejects proposals, also with signatures from an older window. Each ciphernode reads the value for each enabled chain at startup. A running node uses a changed nonzero value only after a restart. ⚠️ An executed slash takes the ticket and bond penalties of the slash policy. The policy can also ban the operator and expel it from the E3 committee. Next steps PVDKG and ZK proofs The circuits and the recursive proofs whose commitments these links compare. Internals Exits, rewards, and slashing What a slash does to an operator's collateral, and how to avoid it. Operators Sortition How the committee and its party IDs are selected. Internals PVDKG and ZK Proofs CLI ## /reference/cli Reference CLI CLI Reference This page lists every command of the interfold CLI and the interfoldup installer in release 0.18.0. It is for developers who build E3 programs and for operators who run ciphernodes. Each entry gives the purpose, the usage line, and a table of flags with their default values. The source of truth is the clap definitions in crates/cli/src and crates/interfoldup/src/main.rs . Commands at a glance Task Commands Install and update interfoldup install , interfoldup update , interfoldup uninstall Project init , compile , program , print-env Node ciphernode setup , start , nodes , noir , events query , config get Operator on-chain lifecycle ciphernode set-bond-owner , propose-bond-owner , accept-bond-owner , bond , tickets , register , deregister , activate , deactivate , status , faucet Keys and secrets password set , password delete , wallet set , wallet get Network net get-peer-id Maintenance node validate , node reset-data , config check , rev , purge-all Run interfold <command> --help to print the help text of one command. Run interfold --version to print the release version. Global options These options apply to every interfold command. You can put them before or after the command name. Flag Value Default Description -c , --config <CONFIG> Discovery order Path to the configuration file. A relative path starts from the current directory. -v , --verbose Count WARN Increases the log level. -v is INFO , -vv is DEBUG , and -vvv is TRACE . -q , --quiet None Off Shows errors only. You cannot use it together with -v . --name <NAME> _default Selects the node profile nodes.<NAME> . The name _default selects the node key. Logs and telemetry use this name. --otel <OTEL> None OpenTelemetry collector gRPC endpoint, for example http://localhost:4317 . The value must be a valid URL. -h , --help None None Prints help. -V , --version None None Prints the version. This flag is available on interfold only, not on subcommands. The node profile also sets the storage paths. Each profile keeps its keys and data in folders named after the profile. See storage paths . Behavior common to all commands Configuration file Most commands need a configuration file. The CLI looks for the file in the order that Node Configuration describes. When the CLI finds no file, only these commands run: Command Behavior without a configuration file init Makes a project. rev Prints the build revision. ciphernode setup Writes a configuration file and stores the password and wallet key. start Runs ciphernode setup with the sepolia profile and stops. Run interfold start again to start the node. noir status , noir setup Use the folder ~/.interfold/noir . All other commands stop with this error: Configuration file not found. Run `interfold ciphernode setup` to create a configuration. init and ciphernode setup do the opposite. They stop with an error when the CLI finds a configuration file. When the configuration sets autopassword: true or autowallet: true , every command that loads the file first creates a missing password or wallet key. See node keys . Commands that run inside a running node interfold start opens a control port on 127.0.0.1 at ctrl_port (default 50505 ). Before a command runs, the CLI sends a request to that port and waits up to 1 second. When a node answers, these read-only commands run inside that node and print its answer: config get ciphernode status events query net get-peer-id noir status print-env rev (without --features ) wallet get All other commands run in the local process. Exit status A command that fails prints the error in red and exits with status 1 . Install and update Install script The install script at the repository root installs interfoldup in ~/.local/bin . It supports Linux on x86_64 and aarch64 , and macOS. On an Intel Mac, it installs the Apple Silicon build, which runs through Rosetta 2. curl -fsSL https://raw.githubusercontent.com/theinterfold/interfold/main/install | bash Flag Value Default Description --version <TAG> Latest release Release tag of interfoldup to install, for example v0.18.0 . A tag without v gets the prefix. -h , --help None None Prints the usage text. The environment variable INTERFOLDUP_VERSION sets the same value as --version . To pass the flag through the pipe, give it to bash -s -- : curl -fsSL https://raw.githubusercontent.com/theinterfold/interfold/main/install | bash -s -- --version v0.18.0 interfoldup install Downloads the interfold binary for this platform from a GitHub release and installs it. interfoldup install [--system] [--version < TAG > ] Flag Value Default Description --system None Off Installs to /usr/local/bin instead of ~/.local/bin . --version <TAG> Latest release latest , dev , or a release tag. Accepts 0.18.0 and v0.18.0 . The value dev selects the most recently published release, stable or pre-release. The command prints a warning when the install folder is not in PATH . interfoldup update Replaces the installed binary with the requested release. When no binary is installed, the command runs install . When the installed version already matches, the command does nothing. interfoldup update [--system] [--version < TAG > ] Flag Value Default Description --system None Off Updates /usr/local/bin/interfold instead of ~/.local/bin/interfold . --version <TAG> Latest release Release to move to: latest , dev , or a release tag. interfoldup uninstall Removes the installed interfold binary. It does not remove configuration files or node data. interfoldup uninstall [--system] Flag Value Default Description --system None Off Removes from /usr/local/bin instead of ~/.local/bin . Project commands These commands make and run an E3 project from the template. For a walkthrough, see Quick Start . interfold init Makes a new Interfold project from a template. The command clones the template, pins its Interfold crates to th
프로젝트로 돌아가기