Simplify poseidon usage#571
Conversation
Review: Safe to merge ✅This is a clean refactor, and I verified the consensus-critical claim ("shouldn't change any hashes") empirically rather than trusting it — both the block-header hash and the ZK-tree hashing are byte-identical before and after. The real risk, and how it was verifiedThe danger isn't the type signature change — it's that
Also clean: no dangling One suggestion (non-blocking)The new Minor notes
Nice, tidy cleanup that meaningfully reduces the header's type complexity while provably preserving consensus. 🎉 |
shouldn't change any hashes, but simplifies Header definition
depends on the new qp-poseidon PR Quantus-Network/qp-poseidon#74
Note
High Risk
Changes block header typing and Poseidon dependency wiring across runtime and consensus-critical
qp-header; a wrong hash would fork the chain despite the stability test.Overview
This PR drops the
qp-poseidoncrate from the workspace and standardizes onqp-poseidon-core2.0.2 (workspaceCargo.toml/ lockfile), removing that dependency from node, runtime, wormhole, mining-rewards, dilithium-crypto, and related crates.qp_header::Headeris simplified fromHeader<Number, BlockHashHasher, StateHasher>toHeader<Number, Hashing>: header fields and block hash areH256, Poseidon block hashing is implemented viaqp_poseidon_coreinsideqp-header, and the lone type parameter is the state trie / extrinsics root hasher (stillBlakeTwo256at runtime). Runtime and mocks now useHeader<BlockNumber, BlakeTwo256>instead ofPoseidonHasher+ Blake2.pallet-wormholeno longer depends onToFelts/qp_poseidonfor config bounds (native balance, asset id, transfer count, wormhole account id). Tests useBlakeTwo256forTestExternalitiesinstead ofPoseidonHasher.A consensus regression guard replaces the old dual-path hash comparison:
poseidon_header_hash_is_stableasserts a fixed devnet header hash (b7dbfd39…).Reviewed by Cursor Bugbot for commit a3cdcab. Bugbot is set up for automated code reviews on this repo. Configure here.