Repository navigation
refactor(ciphernode): optimize v2 storage, p2p, proving, and runtime - #2547
Closed
hmzakhalid wants to merge 6 commits into
Closed
hmzakhalid wants to merge 6 commits into
hmzakhalid wants to merge 6 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
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. |
Contributor
|
thanks @hmzakhalid <3 |
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
Architectural and performance optimizations for Ciphernode V2 across proving, storage, protocol state transitions, P2P transport, chain I/O, runtime event handling, and HTTP hardening, without changing
ENCODING_VERSION = 1durable layouts or protocol/circuit semantics:e3-zk-prover): File-stamp cachedParsedCircuitandVkArtifacts/vk_tree_hash, exponential1ms → 50msbbexit polling, and exported per-step recursive fold helpers (generate_c3_fold_step,generate_c6_fold_step,prove_c2ab_fold,prove_c3ab_fold,prove_c4ab_fold,prove_node_fold_final,prove_decryption_aggregator_with_c6_fold).e3-blobs,e3-engine,e3-journal): Bounded 64 MiB zero-copyPublicCache(Arc<[u8]>),put_verified_batch(singlesync_dirper batch), boundedClosing::closed, atomic group-commitEngine::apply_batch/Journal::commit_batch(up to 128 ops perredbtransaction), and non-durableEffect::Noteskipping journal writes.e3-protocol): Zero-allocation[u8; 116]ticket scoring,u128bitmask +(H-1)-core clique selection forN ≤ 128, extracted O(1)-indexedHold/Endedpreserving exact bincode layout,admits_statefast path avoiding redundant ECDSA re-verification after blob fetch,Registry::prune_before,admission_epoch, andNode::might_fold.e3-jobs): PriorityProveGate(ForegroundvsBackground) with dynamicHARDWARE_CONCURRENCYthread budgeting, single-flight per-step fold checkpointing, cached BFV profiles/CRPs, separatedcheck_poolpreventing proving jobs from starving checks/BFV math, parallel verification & decryption, and multi-slot (max_concurrent >= 2) speculative DKG pre-folding cancelled immediately onPhase::Observing.e3-p2p): Compact binary length-prefixedblobs/2batching (up to 16 blobs, zero-copyArc<[u8]>, no CBOR), pairwisedirect/1delivery forShareswith gossipsub fallback, connection-cached(PeerId ↔ Address)PeerProofverification, merged deduplicated sources, andNetworkStats.e3-chain,e3-node,e3-daemon-server): Single-scanAccount::key_chunks, bounded concurrent key-chunk publishing (8), 1-RPCWallet::estimatewhenconfirmations == 0, concurrentReader::read& bounded block-timestamp cache, offloadedspawn_blockingjournal group-commit/cleanup/checkpointing, PrometheusGET /metrics, and bounded HTTP body/headers/timeout on daemon server.Moonstone Benchmarks (Baseline
31cd408eavs. Optimized)5-node multi-process E2E on Moonstone (Ryzen 5 7535U, 6C/12T, 28 GiB RAM, Minimum committee
N=3, H=2):CommitteeFinalized → KeyPublished)CiphertextReady → PlaintextMade)C0 + C1–C3 + Roster/C4 + Publish)bb,proofs=1)CiphertextReady → PlaintextMade)--releaseFileBlobs serve (20× 4 MiB, zero-copyPublicCache)--releaseBFVCheckEncryptionKey(20×)--release19-node TuránT(19,13)roster clique (50×)--releaseP2PShares(20× 16×16 KiBproof blobs, loopback QUIC)--releaseJournal catch-up (500chain events, 128-op group-commit)--releaseACIR circuit load (20× pk.json)--releaseSelection ticket scoring (100kscores)--releaseHold queue burst (512held messages)--releaseP2P bulk4 MiBbatch loopback (5× 16×256 KiB)--releaseFileBlobs batch write +PublicCachefill (16×256 KiB)Verification
cargo test -p ...):e3-blobs(10/10),e3-engine(7/7),e3-journal(4/4),e3-protocol(192/192, incl.the_persisted_encoding_is_the_one_its_version_namesandmight_foldobserver regression),e3-jobs(12/12),e3-sim(10/10),e3-chain(69/69),e3-node(44/44),e3-p2p(70/70, incl. direct routing + batch fetch test),e3-daemon-server(compiled/0 tests).cargo test -p e3-zk-prover --lib: 72 passed, 0 failed, 1 ignored.cargo clippy --no-deps --all-targets -- -D warningsacross all modified crates +e3-zk-prover --lib: 0 warnings.cargo fmt --all -- --checkandbash scripts/checks/repository.sh: passed.tests/integration/v2.sh):proofs: PASSED (0 errors,Decrypted: 4,0).proofs-restart: PASSED (0 errors,Decrypted: 4,0, aggregator killed and recovered from journal + blobs).mock: PASSED (0 errors,Decrypted: 4,0).cli-restart: PASSED (run prior to the final 5-linemight_foldpre-fold guard).memory.rs(PROVER_BYTES = 13 GiB) capscapacity.proofs = 1. Multi-slot prover concurrency (c2ab || c3a || c3b || c4ab,C7 || C6Fold, dynamicbb_threadsscaling, and background pre-folding) is covered by unit tests ine3-jobs(proofs.rs,tests.rs) rather than end-to-end on a ≥32 GiB host.~0.05 msRTT); WAN round-trip and gossipsub fanout savings were verified structurally viaNetworkStats(direct_sent=25, gossip_sent=1, batches_fetched=26).Compatibility
docs/architecture/persistence-and-replay.md,docs/architecture/network-delivery.md,docs/architecture/dkg.md,docs/architecture/threshold-decryption.md,docs/architecture/proof-statements.md.ENCODING_VERSION = 1snapshot/journal encoding is preserved (HoldandEndedserialize with the exact prior wire representation;admission_epochis#[serde(skip)];the_persisted_encoding_is_the_one_its_version_namespasses).Effect::Noteis non-durable by design; existing journal/outbox recovery passesproofs-restart.e3-p2pupgrades the blob request/response stream protocol from/interfold/blobs/1to binary batched/interfold/blobs/2and adds/interfold/direct/1(which falls back to gossipsub if unavailable). Becauseblobs/1was replaced rather than dual-registered, peers on this branch require matchingblobs/2support (targeted at the unreleasedrefactor/ciphernode-v2branch; if mixed-version rolling upgrades againstblobs/1are needed later,blobs/1compatibility can be dual-registered).refactor/ciphernode-v2target branch; no release cut).