Conversation
* no circuit padding hasher for block header * *use custom hasher for header that encodes the pre-image in a felt aligned manner. * *bespoke header hasher * *patch bug with hash header fall back * *replace custom poseidon header hasher on generic header with a fork of header that has a custom hasher that overrides default on the header trait. * *rmv commented out impl of prior hash method * Update primitives/header/src/lib.rs Co-authored-by: Dastan <88332432+dastansam@users.noreply.github.com> * fixed tests * Use inherent struct method * Update Cargo.toml --------- Co-authored-by: Ethan <tylercemer@gmail.com> Co-authored-by: illuzen <illuzen@users.noreply.github.com>
…333) * Use canonical balances pallet, add assets support to wormhole * Ignore old tests * Remove tests * Override native asset id * Use poseidon hasher * Use poseidon storage hasher * Passing wormhole proof tests * Update binaries * Update binaries * Update zk-circuits crates * Use crates.io dep versions
* Aggregated proofs verification wormhole * clippy
* feat/quantized_wormhole_funding_amount * *fix formatting * *rollback zk enabled circuit artfiact builds at runtime. * fmt --------- Co-authored-by: illuzen <illuzen@users.noreply.github.com>
* feat: qp-header for Planck release (#338) * no circuit padding hasher for block header * *use custom hasher for header that encodes the pre-image in a felt aligned manner. * *bespoke header hasher * *patch bug with hash header fall back * *replace custom poseidon header hasher on generic header with a fork of header that has a custom hasher that overrides default on the header trait. * *rmv commented out impl of prior hash method * Update primitives/header/src/lib.rs Co-authored-by: Dastan <88332432+dastansam@users.noreply.github.com> * fixed tests * Use inherent struct method * Update Cargo.toml --------- Co-authored-by: Ethan <tylercemer@gmail.com> Co-authored-by: illuzen <illuzen@users.noreply.github.com> Co-authored-by: Dastan <88332432+dastansam@users.noreply.github.com> * Exponentially decaying token rewards (#340) * exponentially decaying token rewards * script to simulate emissions * clean up constants and switch python script to rust test * log if we hit max supply somehow * convert rewards_address to rewards_preimage to enforce wormhole address usage * better documentation * change arg name * Exponentially decaying token rewards (#340) * exponentially decaying token rewards * script to simulate emissions * clean up constants and switch python script to rust test * log if we hit max supply somehow * convert rewards_address to rewards_preimage to enforce wormhole address usage * better documentation * change arg name * address style comments --------- Co-authored-by: Cezary Olborski <cezary.olborski@gmail.com> Co-authored-by: Ethan <tylercemer@gmail.com> Co-authored-by: Dastan <88332432+dastansam@users.noreply.github.com>
* bring back wormhole transfer proof generation tests * fmt --------- Co-authored-by: illuzen <illuzen@users.noreply.github.com>
…ersions - Remove no_random feature from qp-wormhole-verifier and qp-zk-circuits-common dependencies - Add patches to use local qp-plonky2 and qp-plonky2-field with fixed rand feature handling - These changes ensure consistent feature resolution across all workspace members
|
Gemini Review Summary of Changes
Code Review1. Security Improvements
2. Logic & Functionality
3. Breaking Changes
4. Observations / Questions
ConclusionThe PR looks solid and improves the codebase's security and maintainability. The transition to aggregated proofs is well-handled with the added safety checks. Status: Approved (assuming asset handling in |
|
Opus 4.6 Max thinking review of PR #367. PR #367: Switch to new plonky2 - Code ReviewOverviewThis PR removes single-proof verification in favor of aggregated-only proofs, migrates from Critical / High1. Breaking call_index renumbering Removing 2. Removal of The minimum transfer check is removed entirely (both from the pallet config and the aggregated proof handler). Without it, a valid proof for dust amounts (e.g., 1 unit) can trigger on-chain minting + event emission + storage writes. Is this intentional? If the circuit enforces a minimum on the prover side, that's fine, but it's worth documenting that the on-chain guard is gone. (Nik here...): Are dust amounts going to be an issue for the chain? If our fees are volume based I assume they are?! Medium3. DRY violation in The This could be collapsed -- e.g., compute 4. -let signature = keypair.sign(message, None, None);
+let signature = keypair.sign(message, None, None).expect("Signing should not fail");This turns a recoverable error into a panic. If this is in the runtime signing path, a panic would halt block production. If signing truly cannot fail, a comment explaining why would be reassuring. Otherwise, propagating the error is safer. 5. Event semantic change in wormhole pallet Previously, -// Emit event for each exit account
-Self::deposit_event(Event::ProofVerified { exit_amount: *exit_balance });Now it's emitted once with the total aggregated amount: +// Emit event for each exit account
+Self::deposit_event(Event::ProofVerified { exit_amount: total_exit_amount });The comment says "for each exit account" but it's actually emitting once for the entire batch. Any indexers or UIs tracking per-account exit events will break. The comment should also be updated to reflect the new behavior. Low / Nits6. Debug log left in production path log::debug!(
"Fee calculation done: miner_fee={:?}, burn_amount={:?}",
miner_fee,
burn_amount
);This is fine for debugging but should ideally have a 7. Block number future check removal is safe but the comment could be tighter The added comment is good: +// If we don't check this a malicious prover can set the block_hash to 0
+// and block_number in the future and this check will passBut it describes the reason the default_hash check is needed, not why the explicit future check was removed. The old 8. The derivation path in let path = format!("m/44'/{QUANTUS_DILITHIUM_CHAIN_ID}/{index}'/0/0", index = wallet_index);But in const DEFAULT_PATH: &str = "m/44'/189189'/0'/0'/0'";These should both use the constant for consistency (and to avoid divergence if the chain ID ever changes). Summary
Overall the direction is solid -- removing the single-proof path simplifies the pallet, the error logging improvements are welcome, and the |
4c36da2 to
ab56c6e
Compare
* feat: qp-header for Planck release (#338) * no circuit padding hasher for block header * *use custom hasher for header that encodes the pre-image in a felt aligned manner. * *bespoke header hasher * *patch bug with hash header fall back * *replace custom poseidon header hasher on generic header with a fork of header that has a custom hasher that overrides default on the header trait. * *rmv commented out impl of prior hash method * Update primitives/header/src/lib.rs Co-authored-by: Dastan <88332432+dastansam@users.noreply.github.com> * fixed tests * Use inherent struct method * Update Cargo.toml --------- Co-authored-by: Ethan <tylercemer@gmail.com> Co-authored-by: illuzen <illuzen@users.noreply.github.com> Co-authored-by: Dastan <88332432+dastansam@users.noreply.github.com> * burn high-security fee instead of sending to treasury (#357) * Continuous Mining (#358) * new block trigger * dedupe logic, remove unnecessary field * simplify again * fmt * clippy * fmt * feat: Vesting and MerkleAirdrop removed (#360) * feat: Merkle Airdrop - removed * feat: Vesting pallet - removed * fix: Clippy for header * Enable wormhole addresses in genesis (#359) * generate transfer proofs for genesis endowment * fmt * fix balances tests * fmt * add recover funds call (#361) * add recover funds call * add unit tests * fix up remaining tests * cargo fmt * fix benchmarks, update weights * fix merge error * feat: Custom Mutisig Pallet (#352) * feat: Merkle Airdrop - removed * feat: Vesting pallet - removed * poc: First multisig version * fix: Taplo * fix: Execution for expired & address simplified fallback * draft: Historical proposals - paginaged endpoint * draft: Historical proposals - from events only * ref: Events renamed + Deposits logic simplified * feat: GracePeriod param removed * fix: Reentrancy * feat: History cleaning redesigned * fix: Expiry - additional validation * feat: Proposal nonce * feat: Dynamic weights * feat: Multisig deposit fee * feat: MaxExpiry param * feat: Fees to Treasury * feat: History removable only by signers * fix: Weights * feat: Fees burned * feat: Filibuster protection * feat: Proposals auto cleaning * feat: Proposal id - nonce instead of hash * feat: Calls - production whitelist * feat: Remove call whitelisting * fix: Test fix after balances pallet update * fix: Review cleaning * fix: Multisig - auto-cleaning expanded (#364) * fix: Multisig - auto-cleaning expanded * fix: Weights related to storage size * QUIC miner (#363) * quic implementation * refactor for readability * simplify * miner initiates, multiple miners supported * simplify loop further * short job counters * simplify new_full * gracefully handle invalid seals * remove unused and log misbehaving miners * emoji * fmt * taplo * improve readability, logs, documentation * feat: High-Security Integration for Multisig Pallet (#368) * feat: Multisig + HS integrated * feat: Weights update * fix: Benchmarks + README * feat: HS trait defined in primitives * fix: Taplo * fix: Sell order tracking * feat: Deterministic address + simplified cleaning * fix: Deposits for multisig * fix: Dynamic weight + benchmarks refactor * feat: Execute - separated * feat: Multisig - benchamarks refactor * fix: Benchmarks - corrected HS multisig cost * feat: Dynamic cleaning methods * feat: Approve dissolve - two variants * feat: Approval with negative weight * Switch to new plonky2 (#367) * No pad hasher header (#327) * no circuit padding hasher for block header * *use custom hasher for header that encodes the pre-image in a felt aligned manner. * *bespoke header hasher * *patch bug with hash header fall back * *replace custom poseidon header hasher on generic header with a fork of header that has a custom hasher that overrides default on the header trait. * *rmv commented out impl of prior hash method * Update primitives/header/src/lib.rs Co-authored-by: Dastan <88332432+dastansam@users.noreply.github.com> * fixed tests * Use inherent struct method * Update Cargo.toml --------- Co-authored-by: Ethan <tylercemer@gmail.com> Co-authored-by: illuzen <illuzen@users.noreply.github.com> * Verify header in the wormhole proof (#295) * Use canonical balances pallet and add support for assets in wormhole (#333) * Use canonical balances pallet, add assets support to wormhole * Ignore old tests * Remove tests * Override native asset id * Use poseidon hasher * Use poseidon storage hasher * Passing wormhole proof tests * Update binaries * Update binaries * Update zk-circuits crates * Use crates.io dep versions * Use `ToFelts` trait in the wormhole pallet (#347) * Apply ToFelts changes to wormhole * Fix checks * Passing tests * Revert unit test line * Rename explicit AccountId * Add ValidateUnsigned impl to wormhole (#353) * feat: aggregated proof verification in wormhole (#351) * Aggregated proofs verification wormhole * clippy * check block hash in agg proof * feat: quantized funding amounts (#354) * feat/quantized_wormhole_funding_amount * *fix formatting * *rollback zk enabled circuit artfiact builds at runtime. * fmt --------- Co-authored-by: illuzen <illuzen@users.noreply.github.com> * Enforce miner wormhole address (#344) * feat: qp-header for Planck release (#338) * no circuit padding hasher for block header * *use custom hasher for header that encodes the pre-image in a felt aligned manner. * *bespoke header hasher * *patch bug with hash header fall back * *replace custom poseidon header hasher on generic header with a fork of header that has a custom hasher that overrides default on the header trait. * *rmv commented out impl of prior hash method * Update primitives/header/src/lib.rs Co-authored-by: Dastan <88332432+dastansam@users.noreply.github.com> * fixed tests * Use inherent struct method * Update Cargo.toml --------- Co-authored-by: Ethan <tylercemer@gmail.com> Co-authored-by: illuzen <illuzen@users.noreply.github.com> Co-authored-by: Dastan <88332432+dastansam@users.noreply.github.com> * Exponentially decaying token rewards (#340) * exponentially decaying token rewards * script to simulate emissions * clean up constants and switch python script to rust test * log if we hit max supply somehow * convert rewards_address to rewards_preimage to enforce wormhole address usage * better documentation * change arg name * Exponentially decaying token rewards (#340) * exponentially decaying token rewards * script to simulate emissions * clean up constants and switch python script to rust test * log if we hit max supply somehow * convert rewards_address to rewards_preimage to enforce wormhole address usage * better documentation * change arg name * address style comments --------- Co-authored-by: Cezary Olborski <cezary.olborski@gmail.com> Co-authored-by: Ethan <tylercemer@gmail.com> Co-authored-by: Dastan <88332432+dastansam@users.noreply.github.com> * update qp-poseidon version * made transfer count per-recipient * feat: enable wormhole verifier tests (#356) * bring back wormhole transfer proof generation tests * fmt --------- Co-authored-by: illuzen <illuzen@users.noreply.github.com> * remove painful test, we sent it to quantus-cli * burn half the volume fee * fmt * use new plonky2-verifier crate * fix: Remove no_random feature and patch plonky2 crates to use local versions - Remove no_random feature from qp-wormhole-verifier and qp-zk-circuits-common dependencies - Add patches to use local qp-plonky2 and qp-plonky2-field with fixed rand feature handling - These changes ensure consistent feature resolution across all workspace members * lock * new agg logic * better logging of agg proof failure modes * refresh bins * only one proof verified event necessary * update to latest rusty crystals * no minimum, no single proof verification * lock * handle new derivation rules * fmt * put wormhole transfer minimum back in, remove unused single-proof files * better lock * remove local plonky2 references * fix build.rs bin validation * remove unused functions * format * no more local deps * missing dev accounts * clippy --------- Co-authored-by: Dastan <88332432+dastansam@users.noreply.github.com> Co-authored-by: Ethan <tylercemer@gmail.com> Co-authored-by: Cezary Olborski <cezary.olborski@gmail.com> * generate TransferProofs on batch transfer * clippy + zk versions * feat: Treasury config pallet (#372) * feat: Treasury config pallet * fix: Taplo --------- Co-authored-by: Ethan <tylercemer@gmail.com> Co-authored-by: illuzen <illuzen@users.noreply.github.com> Co-authored-by: Dastan <88332432+dastansam@users.noreply.github.com> Co-authored-by: Nikolaus Heger <nheger@gmail.com>
Summary
Adds wormhole pallet with aggregated proof verification, dual-output support, and uses the new separated
qp-plonky2-verifiercrate for smaller runtime size.Key Changes
Wormhole Pallet
transfer_native/transfer_asset- Send to unspendable wormhole accountsverify_aggregated_proof- Verify aggregated ZK proofs with multiple exit accountsSeparated Verifier
qp-plonky2-verifierinstead of fullqp-plonky2Runtime Changes
pallet-wormholeandpallet-multisigpallet-vestingandpallet-merkle-airdropqp-rusty-crystals-dilithiumOther
Testing
NativeTransferredevents per account