[tesseract]: Introduce pallet-outbound-proofs for on-chain consensus proof storage and verification#732
[tesseract]: Introduce pallet-outbound-proofs for on-chain consensus proof storage and verification#732dharjeezy wants to merge 15 commits intorelayer-v2from
Conversation
…o dami/zk-proof-indexer-db # Conflicts: # evm/src/consensus/BeefyV1.sol # evm/src/consensus/BeefyV1FiatShamir.sol # evm/src/consensus/ConsensusRouter.sol # evm/src/consensus/SP1Beefy.sol # evm/src/core/HandlerV2.sol # evm/test/HandlerV2Test.sol # evm/test/TestConsensusClientV2.sol # sdk/packages/core/contracts/interfaces/IConsensusV2.sol
| and submit them on-chain via HandlerV2.handleConsensus(). | ||
| """ | ||
| type ZkConsensusProof @entity { | ||
| id: ID! |
There was a problem hiding this comment.
Unique constraint needed here or else the ON CONFLICT check in insertion will fail
| ); | ||
| Responded::<T>::insert(req_commitment, true); | ||
|
|
||
| T::OnDispatch::on_dispatch(); |
There was a problem hiding this comment.
we should not call it for every message make be call it if the child_trie root changes in onfinalized_hook
|
|
||
| /// The last proven parachain block height | ||
| #[pallet::storage] | ||
| pub type LatestProvenParachainHeight<T: Config> = StorageValue<_, u64, ValueQuery>; |
There was a problem hiding this comment.
we can get this information from decoding the consensus state
|
|
||
| /// Current BEEFY authority set epoch | ||
| #[pallet::storage] | ||
| pub type CurrentEpoch<T: Config> = StorageValue<_, u64, ValueQuery>; |
| pub fn submit_proof( | ||
| origin: OriginFor<T>, | ||
| consensus_proof: BoundedVec<u8, T::MaxProofSize>, | ||
| relay_chain_height: u64, |
There was a problem hiding this comment.
The consensus proof has all this data, we should verify the proof and extract the data from it
| StorageMap<_, Blake2_128Concat, u64, EpochInfo, OptionQuery>; | ||
|
|
||
| #[pallet::storage] | ||
| pub type UnprovenHeights<T: Config> = |
| } | ||
|
|
||
| #[pallet::storage] | ||
| pub type UnprovenEpochs<T: Config> = |
|
|
||
| #[pallet::storage] | ||
| pub type ProvenHeights<T: Config> = StorageMap< | ||
| _, |
There was a problem hiding this comment.
why so we need proven height and recent proofs storage items, on should be sufficient
|
|
||
| let public_inputs = build_public_inputs(&proof, authority.root, authority.len); | ||
|
|
||
| #[cfg(feature = "sp1")] |
There was a problem hiding this comment.
I also added a dummy verifier for testing, but i am now going to add the sp1 verification to the current beefy consensus client PR we have opened.
This PR Introduces
pallet-outbound-proofs, a pallet that allows provers to submit ZK BEEFY consensus proofs to Hyperbridge, where they are verified, stored in offchain storage, and made available for outbound relayers to polland submit to EVM chains via
HandlerV2.batchCall().