feat(wpoa+stark): wPoA consensus + STARK sig-aggregation proof system#18
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- New workspace crate: tools/load-test (shell-load-test binary) - 20 async Tokio workers, each with Dilithium3 keypair + funded account - 4 tx types: Transfer(60%), DataTransfer(20%), Deploy(15%), LargeData(5%) - eth_sendRawTransaction with alloy_rlp encoding (matches CLI) - HDR histogram latency tracking + CSV reports every 30s - Backoff on mempool-full / rate-limit errors - Confirmed 250 TPS at 500 txs/block every 2s Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- gen-report.sh: converts CSV + node log → structured text report - Sections: parameters, submit TPS, latency percentiles, block stats, per-period table - auto-report daemon saves snapshots every 30min + final on completion - reports/ directory with .gitignore (keeps .txt, ignores .csv) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…oint Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Watchdog loop: restarts node + load test if either dies - Tracks total elapsed against TEST_DURATION (default 36000s / 10h) - Generates final text report on exit via gen-report.sh - PID files: /tmp/shell-local-test/supervisor.pid - Logs: /tmp/shell-local-test/supervisor.log Usage: (nohup bash tools/load-test/supervisor.sh >> /tmp/supervisor.log 2>&1) & Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- log() now writes to file + stderr separately (avoids double-write when stdout is redirected to same log) - lsof syntax fix for macOS (no -t flag) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Switch node from --db memory to --db rocksdb --datadir $CHAIN_DATA - Chain data persists at /tmp/shell-local-test/chain-data/ across restarts - Rebuild binary with: cargo build --release -p shell-cli --features rocksdb Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
PUSH1 0x01, PUSH1 0x00, RETURN deploys 1-byte STOP as runtime code. eth_getCode now returns 0x00 (non-empty) so explorer detects Contract. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Block budget controller: - Background task resets budget every 2s (1 block) with random LoadTier - 5 tiers: Zero(0), Few(1-50), Medium(51-200), Many(201-400), Max(401-500) - Workers check budget atomically before each send; skip+sleep on Zero - Creates realistic traffic bursts instead of constant max throughput Transfer value: - Was: U256::from(1) = 1 wei ≈ 0 SHELL - Now: random 1–1000 SHELL based on rng_counter Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add CfCompressionStrategy enum and bulk_compression field to RocksDbConfig. Configure ZstdCold (default) on chain and receipts column families: - Level compaction: L0-L1 = None (hot write path), L2-L6 = Zstd (cold bulk) - Universal/FIFO compaction: uniform Zstd (per-level not meaningful) - state and index CFs unchanged (small random-access values) Expected 40-60% on-disk reduction for PQ signature data (Dilithium3 sig=3309B, pubkey=1952B per tx). Part of 5-tier pq-block-data-reduction plan. Tests: 4 new roundtrip/strategy tests; all 124 pass. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add PubkeyMode enum (Embedded(Vec<u8>) | Reference) to transaction.rs - Replace SignedTransaction.sender_pubkey: Option<Vec<u8>> with pubkey_mode: PubkeyMode - Wire format unchanged: Embedded encodes as raw bytes, Reference as empty RLP - Update aa_validation.rs: 3 callsites migrated, resolve_pubkey takes Option<&[u8]> - Update node.rs: block import two-pass pubkey resolution uses PubkeyMode match - Update load-test/main.rs: first-tx pubkey injection uses with_pubkey() constructor - Add CLI auto-detection: sign_and_build checks shell_getPqPubkey RPC before embedding - Export PubkeyMode from shell_core lib.rs - Add 4 unit tests: embedded/reference RLP roundtrip, accessors, byte savings proof Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…t, tests F-401: rpc_post now uses 5s timeout via ureq::AgentBuilder F-402: SignedTransaction marked #[non_exhaustive] to prevent silent Reference default F-403: removed duplicate sign_and_build doc comment from cli/tx.rs F-404: removed unused PubkeyMode import; doc links use fully-qualified path F-405: two integration tests for two-pass pubkey resolution in node.rs - block_import_pubkey_dedup_embedded_then_reference_same_block - block_import_reference_before_embedded_fails F-406: load-test pubkey allocation moved inside nonce==0 branch F-408: idempotency comment added to second-pass loop in node.rs explaining validate_tx_for_import is read-only and new_pubkeys uses or_insert_with All 85 node tests pass, 130 workspace tests pass. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- bench_compression.rs: criterion benchmarks for A1 Zstd + A2 PubkeyMode - docs/BENCHMARKS.md: measured results and disk reduction analysis - shell_core: export DILITHIUM3_PUBKEY_LEN - shell_storage: export CfCompressionStrategy A1 Zstd: ~16% write overhead, ~2% read speedup, ~8-15% disk savings A2 PubkeyMode: ~1,954B/tx savings at 95% dedup -> ~42% combined reduction Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- StrippedTransaction: tx payload without PQ sig/pubkey, RLP roundtrip - TxWitness: PQ sig + optional pubkey (embedded/reference modes), RLP roundtrip - WitnessBundle: ordered Vec<TxWitness> per block, pairwise Merkle root - 10 unit tests: RLP roundtrips, size comparisons, root determinism, parallel invariant - Exported from shell_core lib StrippedTransaction saves 5000+ bytes/tx vs SignedTransaction (no sig/pubkey). WitnessBundle::compute_root() placeholder for Phase B2 witness_root header field. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add witness_root: Option<ShellHash> to BlockHeader for Phase B witness separation. Commits to the WitnessBundle for a block, enabling light clients to verify witness data without downloading the full bundle. - RLP: None -> empty bytes (0x80); Some(h) -> 32-byte hash - Serde: skip_serializing_if = None (backward-compatible JSON) - Backward compat: old blocks without the field decode safely as None - 6 new tests: roundtrips (RLP + serde), hash sensitivity, JSON format - Updated all BlockHeader construction sites (genesis, node, rpc, e2e) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add CF_WITNESS = 'witness' constant and to ALL_CFS - Add witness: RocksDbStores field and CF descriptor in open_all() - WitnessStore<S: KvStore>: put/get/delete/has bundle keyed by block hash - Export WitnessStore from shell-storage lib.rs + CF_WITNESS - 5 new tests: roundtrip, missing→None, has_bundle, delete, independence from ChainStore (different key spaces, same DB) 129 tests pass (0 failures). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add shell_getBlockWitnesses(block) to ShellApi trait (api.rs)
Accepts block hash (0x hex) or block tag (latest / 0xN)
Returns { blockHash, witnessRoot, witnessCount, witnesses[] }
Each witness: { txIndex, sigType, signature, pubkey? }
- Add witness_store: Option<Arc<WitnessStore<S>>> to RpcHandler
- Add with_witness_store() builder method
- Wire witness_store param into start_rpc_server(); node.rs passes None
- 4 new tests: no_store error, empty_bundle, with_bundle (embedded
pubkey check), null for unknown hash
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add WitnessStore<S> field to Node struct; construct from store in Node::new() - Wire witness_store to start_rpc_server (replaces previous None placeholder) - In import_block: when block.header.witness_root is Some, look up bundle from witness_store and verify bundle.compute_root() == header.witness_root - Missing bundle is soft (debug log, import allowed) — full enforcement requires Phase B network witness propagation - WitnessStore::new uses same Arc<S> store, backed by CF_WITNESS column family - Fix witness_root: None in all test BlockHeader literals across node.rs, checkpoint.rs, and reorg.rs (13 sites) - Add 4 B5 tests: no_witness_root, missing_bundle_ok, root_matches_ok, root_mismatch_rejected Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Selected Winterfell v0.13 as the STARK prover framework for Phase C (Dilithium3 signature aggregation). See projects/shell-chain/plans/ c1-stark-evaluation.md for full evaluation of Winterfell, Plonky3, and Stwo. Decision: Winterfell for C2 prototype; Plonky3/BabyBear as long-term migration target once circuit design is validated. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add WitnessPruner struct (storage/src/witness_pruner.rs) * prune_before(current_head, chain_store, witness_store) method * Archive mode: retention_count=0 skips all pruning * Tracks pruned_below for idempotent incremental passes * 7 unit tests covering archive/incremental/idempotency/retention - Add get_block_hash_by_number() to ChainStore (lightweight vs full get_block) - Export WitnessPruner, WitnessPruneResult, DEFAULT_WITNESS_RETENTION from shell-storage - Add witness_retention: u64 to PruningConfig (default: 128) - Add witness_pruner: RwLock<WitnessPruner> to Node struct - Wire D1 prune call in record_finalized_state_root (every block, cheap) - Add --witness-retention CLI arg to shell-node (default_value=128) - Wire witness_retention through RunArgs -> PruningConfig -> WitnessPruner - Add tracing dependency to shell-storage Cargo.toml - Fix PQSignature import: shell_core -> shell_crypto in witness_pruner tests Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add delete_body() method to ChainStore (removes b/<hash> KV entry; preserves header and canonical mapping permanently) - Add BodyPruner struct (storage/src/body_pruner.rs) * prune_before(current_head, chain_store) idempotent via pruned_below * Archive mode: retention_count=0 skips all pruning (is_archive()) * DEFAULT_BODY_RETENTION=512 (~17min at 2s blocks) * 7 unit tests: archive/boundary/idempotent/incremental/missing canonical - Export BodyPruner, BodyPruneResult, DEFAULT_BODY_RETENTION from shell-storage - Add body_retention: u64 to PruningConfig (default: DEFAULT_BODY_RETENTION) - Add body_pruner: RwLock<BodyPruner> to Node struct - Wire D2 prune call in record_finalized_state_root after D1 witness pruner - Add --body-retention CLI arg to shell-node (default_value=512) - Wire body_retention through RunArgs -> PruningConfig -> BodyPruner - Fix missing witness_root field in run.rs test BlockHeader literal - 142 storage tests, 89 node tests, 22 CLI tests pass Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…accumulator) - Add crates/stark-prover workspace member with Winterfell 0.13.1 dep - Implement SigBatchAir: 2-column trace (accumulator + entry), degree-3 transition acc[t+1] = acc[t]^3 + entry[t], boundary assertions at step 0 and last step - Implement build_trace(): pre-computes all acc/entry values, padding rows keep acc stable via entry = acc - acc^3 identity - Implement SigBatchProverImpl: full Prover trait with VC=MerkleTree<Blake3_256>, DefaultTraceLde + DefaultConstraintCommitment (3-generic-arg API, v0.13.1) - Implement prove_sig_batch() / verify_sig_batch() public API - SigBatchProof: serializable wrapper (JSON) for storage in BlockHeader::sig_aggregate_proof - 6 tests: single, batch-4, batch-10, tamper-detect, JSON roundtrip, empty-error - Fix ProofOptions::new() 8-arg API (BatchingMethod::Linear x2) - Fix StarkField import for as_int() (not FieldElement) - All 6 tests pass Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add shell-stark-prover dep to shell-node - Add enable_stark_aggregation: bool to NodeConfig (default: false) - Add stark_aggregation: bool field to Node struct, initialized from config - produce_block: if stark_aggregation enabled, build SigBatchEntry items from all embedded-pubkey txs (msg_hash=tx.hash, pk_hash=first 32 pk bytes), call prove_sig_batch(), store JSON-encoded SigBatchProof in BlockHeader::sig_aggregate_proof BEFORE signing (covered by proposer seal) Fallback: log warning and continue if prove fails (inline sigs preserved) - import_block: if sig_aggregate_proof present, deserialize + verify_sig_batch() Return NodeError if STARK proof invalid; debug log on success - Add --enable-stark-aggregation CLI flag (default false, warns it is expensive) - Wire through main.rs Run match arm + RunArgs construction - Fix pre-existing witness_root missing field in BlockHeader literals: consensus/poa.rs, consensus/slashing.rs, evm/executor.rs, evm/tests/common/mod.rs, evm/tests/integration.rs, network/channel.rs, network/message.rs, tests/e2e/wpoa_regression.rs - All workspace tests pass (1256 total, 0 failures) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
K1: ProofAvailabilityTracker — counts per-block proof acks, gates sig stripping K2: BlockStateMachine — Sealed→Proving→Proven→Available→Stripped lifecycle K3: ProverHealth — rolling failure-rate monitor with Healthy/Degraded/Overloaded/Failing states K4: STARK metrics — 6 new Prometheus metrics in Metrics struct fix: CLI NodeConfig missing node_role field (defaults to NodeRole::Validator) Tests: stark-prover 82 ✓, node 107 ✓, consensus 165 ✓, network 51 ✓ Reviews: #105 (I4/I5/I6), #106 (K1-K4) filed in agents/review/sessions/ Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
When n_entries == trace_len (power-of-2 exact fit), the final trace row stored acc BEFORE the last entry was applied. The boundary assertion acc[trace_len-1] == batch_root then failed verification with InconsistentOodConstraintEvaluations. Fix: use (n+1).max(8).next_power_of_two() so there is always ≥1 padding row propagating the final batch_root to trace_len-1. Affected batch sizes: 8, 16, 32, 64, 128, 256 (all powers of 2 ≥ 8). Smoke: 19177 proofs across all batch sizes, 0 failures. Also: add tools/stark-bench — 6h STARK block-compression soak benchmark with HDR histogram, CSV output, rolling summary, ProverHealth integration. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add two STARK-specific tests to the node module:
1. stark_block_compression_queues_proof_tasks (sync)
- Creates a node with enable_stark_aggregation=true
- Funds 30 accounts, submits 10 Embedded-pubkey txs per block
- Produces 3 blocks → verifies 3 proof tasks queued in backlog
- Reports compression analysis:
Raw per block: 52.7 KB (10×Dilithium3 sig+pubkey)
STARK proof: ~12.7 KB
Ratio: ~4.0× compression
2. stark_prover_service_processes_backlog (async)
- Submits 5 Embedded-pubkey txs, produces 1 block
- Starts ProverService, waits for proof generation
- Verifies ProofAmendment stored under placeholder hash
- Reports actual proof size from Winterfell STARK prover:
Proof size: 3.6 KB (5-entry batch)
Raw sig+pubkey: 25.7 KB
Actual ratio: 7.1× compression
Both tests pass against the live STARK prover (no mocks).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR introduces major infrastructure for the Shell-chain wPoA + STARK signature-aggregation workflow, including new storage layout (witness + proof-amendment persistence), pruning knobs, network/RPC plumbing, and benchmarking/load-test tooling to support the new proving and data-reduction pipeline.
Changes:
- Adds a dedicated witness storage column family plus body/witness pruning helpers and config surfaces.
- Introduces a
shell-stark-provercrate (proof types, backlog/scheduler/health/state machine) and wires async proof lifecycle concepts into node/network/metrics. - Adds tooling (benchmarks + load-test harness/reporting) and genesis templates/network defaults to support running/benchmarking the new system.
Reviewed changes
Copilot reviewed 80 out of 81 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tools/stark-bench/Cargo.toml | Adds a standalone long-running STARK benchmark tool crate. |
| tools/load-test/supervisor.sh | Adds a watchdog script to keep node + load-test running for long soak tests. |
| tools/load-test/reports/snapshot-20260415_212455.txt | Adds a load-test report snapshot artifact. |
| tools/load-test/reports/run-20260415_205018.txt | Adds a run report artifact. |
| tools/load-test/reports/final-report.txt | Adds a final report artifact. |
| tools/load-test/reports/.gitignore | Ignores CSVs and keeps text reports under version control. |
| tools/load-test/gen-report.sh | Adds CSV→human-readable report generator. |
| tools/load-test/Cargo.toml | Adds a load-test harness tool crate. |
| tests/e2e/wpoa_regression.rs | Updates test header construction for new witness_root field. |
| tests/e2e/common.rs | Updates test block header construction for new witness_root field. |
| genesis-templates/testnet-genesis.json | Adds a testnet genesis template. |
| genesis-templates/mainnet-genesis.json | Adds a mainnet genesis template. |
| genesis-templates/devnet-genesis.json | Adds a devnet genesis template. |
| docs/BENCHMARKS.md | Adds benchmark methodology/results documentation for compression and pubkey dedup. |
| crates/storage/src/rocks_db.rs | Adds witness CF, per-CF compression strategy, and new tests for compression modes. |
| crates/storage/src/lib.rs | Exposes new pruners/stores and compression strategy types. |
| crates/storage/src/chain_store.rs | Adds body deletion + hash-by-number helper; introduces WitnessStore + ProofAmendmentStore and tests. |
| crates/storage/src/body_pruner.rs | Adds EIP-4444-style block-body pruning logic and tests. |
| crates/storage/Cargo.toml | Adds tracing dependency for new pruning/logging code. |
| crates/stark-prover/src/state_machine.rs | Adds block proof lifecycle state machine + tests. |
| crates/stark-prover/src/scheduler.rs | Adds aggregation scheduler + tests. |
| crates/stark-prover/src/prover_health.rs | Adds prover health monitor + tests. |
| crates/stark-prover/src/proof.rs | Adds serializable SigBatchProof wrapper around Winterfell proof bytes. |
| crates/stark-prover/src/metadata.rs | Adds ProofMetadata/ProofLevel + key helpers and tests. |
| crates/stark-prover/src/lib.rs | Introduces shell-stark-prover public API surface. |
| crates/stark-prover/src/backlog.rs | Adds async proof backlog queue + tests. |
| crates/stark-prover/src/availability.rs | Adds proof availability/ack tracking + tests. |
| crates/stark-prover/src/amendment.rs | Adds ProofAmendment type + signing-message/key helpers and tests. |
| crates/stark-prover/src/air.rs | Adds Winterfell AIR for the accumulator-based commitment circuit. |
| crates/stark-prover/Cargo.toml | Adds the new STARK prover crate to the workspace. |
| crates/rpc/src/subscriptions.rs | Updates test header construction for witness_root. |
| crates/rpc/src/server.rs | Wires optional WitnessStore into the RPC server startup. |
| crates/rpc/src/api.rs | Adds shell_getBlockWitnesses RPC method definition. |
| crates/node/src/reorg.rs | Updates test header construction for witness_root. |
| crates/node/src/pruning.rs | Extends pruning config with witness/body retention fields. |
| crates/node/src/prover_service.rs | Adds background async prover service implementation + tests. |
| crates/node/src/metrics.rs | Adds Prometheus metrics for STARK proving/backlog/amendments/equivocations. |
| crates/node/src/lib.rs | Exposes new node role + prover-service types. |
| crates/node/src/config.rs | Adds NetworkType defaults, NodeRole, and STARK enable flags; expands tests. |
| crates/node/src/checkpoint.rs | Updates test header construction for witness_root. |
| crates/node/Cargo.toml | Adds dependencies on shell-genesis and shell-stark-prover. |
| crates/network/src/message.rs | Adds proof/amendment/challenge/equivocation message variants and imports. |
| crates/network/src/config.rs | Adds a gossipsub topic for proof messages. |
| crates/network/src/channel.rs | Updates test header construction for witness_root. |
| crates/genesis/src/lib.rs | Re-exports NetworkType/NetworkParams for node/CLI usage. |
| crates/genesis/src/init.rs | Adds network_type into genesis initialization flow and tests. |
| crates/evm/tests/integration.rs | Updates test header construction for witness_root. |
| crates/evm/tests/common/mod.rs | Updates test header construction for witness_root. |
| crates/evm/src/executor.rs | Updates test header construction for witness_root. |
| crates/evm/src/aa_validation.rs | Switches AA pubkey handling to PubkeyMode accessors. |
| crates/core/src/transaction.rs | Adds PubkeyMode + updates SignedTransaction encoding/decoding and tests. |
| crates/core/src/lib.rs | Re-exports new transaction + witness-related types/constants. |
| crates/core/src/block.rs | Adds witness_root to BlockHeader RLP/serde + tests. |
| crates/consensus/src/slashing.rs | Adds EquivocationProof type + verify logic and tests. |
| crates/consensus/src/rate_limiter.rs | Adds proof submission token-bucket rate limiter + tests. |
| crates/consensus/src/prover_registry.rs | Adds prover registry with reputation/anti-sybil scaffolding + tests. |
| crates/consensus/src/peer_scoring.rs | Adds prover-aware peer scoring + tests. |
| crates/consensus/src/lib.rs | Exposes new consensus modules/types for challenges/registry/scoring/windows. |
| crates/consensus/src/challenge.rs | Adds proof-challenge and response message structures + tests. |
| crates/consensus/Cargo.toml | Adds serde_json dev-dependency for new tests. |
| crates/cli/src/main.rs | Adds --network, optional block-time, retention flags, and STARK enable flag plumbing. |
| crates/cli/src/config.rs | Adds node.network config field. |
| crates/cli/src/commands/tx.rs | Adds registry check to choose Embedded vs Reference pubkey mode; adds HTTP timeout. |
| crates/cli/src/commands/run.rs | Applies network-aware genesis/node config defaults; adds retention and STARK flags. |
| crates/cli/src/commands/init.rs | Adds network parameter to dev genesis generation. |
| crates/bench/benches/bench_compression.rs | Adds Criterion benchmark suite for compression/dedup scenarios. |
| crates/bench/Cargo.toml | Enables RocksDB feature for benches; adds new bench target and deps. |
| Dockerfile | Updates container healthcheck to use JSON-RPC eth_blockNumber. |
| Cargo.toml | Adds new workspace members and dependencies (winterfell, rocksdb zstd feature). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| SHELL_NODE=/Users/luciensong/Shell/shell-dev/shell-chain/target/release/shell-node | ||
| LOAD_TEST=/Users/luciensong/Shell/shell-dev/shell-chain/target/release/shell-load-test | ||
| OUT_DIR=/tmp/shell-load-test |
There was a problem hiding this comment.
SHELL_NODE and LOAD_TEST are hard-coded to an absolute /Users/.../target/release/... path, which makes this script non-portable and likely to fail for anyone else (including CI). Consider resolving these binaries relative to the repo root (e.g., via cargo build --release + target/release/...) or accepting them as env vars/CLI args with a helpful error if missing.
There was a problem hiding this comment.
@copilot apply changes based on this feedback
Use BASH_SOURCE-relative REPO_ROOT so supervisor.sh works on any machine regardless of checkout location. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
🔧 Pushed follow-up commit |
Fix CI Check & Lint failure — calls and struct literals across tools/stark-bench and tools/load-test. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Fixes CI Check & Lint (rustfmt) and Test (compile error E0063): - cargo fmt --all: reformat all crates not covered by previous targeted pass - crates/cli/src/commands/run.rs: add missing network field to RunArgs literal in parallel_evm_args_produce_correct_config test - crates/cli/src/commands/run.rs: add missing network_type to GenesisConfig literal in test_genesis helper Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- transaction.rs: derive Default on PubkeyMode with #[default] on Reference variant, remove manual impl (clippy::derivable_impls) - witness.rs: (n+1)/2 -> n.div_ceil(2) (clippy::manual_div_ceil) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- prover.rs: use bytes.iter_mut().enumerate() instead of range loop (clippy::needless_range_loop) - scheduler.rs: collapse nested ifs and use .is_multiple_of() (clippy::collapsible_if, clippy::manual_is_multiple_of) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Replace plain pub fn from_str() with std::str::FromStr impl (Infallible error, defaults to Dev). Keep from_network_str() as internal helper. Update call sites in run.rs and init.rs to use .parse().unwrap_or_default(). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- tools/load-test: repeat_n, needless_borrows_for_generic_args, is_multiple_of - tools/stark-bench: manual_checked_ops, is_multiple_of - crates/node: implement FromStr for NodeRole (should_implement_trait) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
is_validator() and runs_prover() were accidentally left outside the impl block during the FromStr trait introduction. Move them back in. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- run.rs: move DEFAULT_*_RETENTION imports into #[cfg(test)] module - main.rs: .or_else(|| opt) -> .or(opt) (clippy::unnecessary_lazy_evaluations) - load-test: remaining i % 10 == 0 -> i.is_multiple_of(10) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Overview
This PR implements the full wPoA (weighted Proof-of-Authority) + STARK signature aggregation system for shell-chain, transforming Dilithium3 post-quantum signatures into compressed Winterfell STARK proofs.
What's included (29 commits)
🔒 Core data types (A1–A3, B1–B5)
PubkeyModeenum —Embedded(first tx) vsReference(registered addr)StrippedTransaction,TxWitness,WitnessBundle,witness_rootinBlockHeader, witness store, RPC endpoint, consensus validation⚡ STARK circuit (C1–C3)
sig_aggregate_proofin header🗃️ Pruning (D1–D2)
--witness-retentionCLI flag--body-retentionCLI flag🌐 Network (F1–F4)
NetworkTypeenum (Dev/Testnet/Mainnet) with STARK defaultsNodeConfigdefaults--networkCLI flag + genesis templates🔄 Proof lifecycle (G1–G5)
ProofBacklogstruct with watermarkProverService— async, never blocks block productionProofAmendmentstruct + storageproduce_block— queuesProofTask, seals without waitingProofAmendmentP2P gossip message⚖️ wPoA rotation (H1–H4)
NodeRoleenum with dedicatedProverrole🛡️ Anti-fraud (I1–I6)
📊 Orchestration + metrics (J1–J3, K1–K4)
ProofMetadata+ level trackingSealed → Proven → StrippedProverHealth+ graceful degradationshell_stark_proofs_total, latency, backlog depth, amendments broadcast)🧪 Tests + benchmarks
Compression result
STARK proofs replace per-tx Dilithium3 public keys (1952 B) + signatures (3309 B) with a single aggregated Winterfell proof, enabling significant block size reduction while preserving post-quantum security.
Testing
All existing tests pass. Two new integration tests added to
crates/node/src/node.rs.