Skip to content

[tesseract]: Introduce pallet-outbound-proofs for on-chain consensus proof storage and verification#732

Draft
dharjeezy wants to merge 15 commits intorelayer-v2from
dami/zk-proof-indexer-db
Draft

[tesseract]: Introduce pallet-outbound-proofs for on-chain consensus proof storage and verification#732
dharjeezy wants to merge 15 commits intorelayer-v2from
dami/zk-proof-indexer-db

Conversation

@dharjeezy
Copy link
Copy Markdown
Contributor

@dharjeezy dharjeezy commented Mar 24, 2026

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 poll
and submit to EVM chains via HandlerV2.batchCall().

@dharjeezy dharjeezy changed the title Index ZK consensus proofs in the indexer PostgreSQL database [tesseract]: Index ZK consensus proofs in the indexer PostgreSQL database Mar 24, 2026
@dharjeezy dharjeezy requested a review from seunlanlege March 25, 2026 10:22
@dharjeezy dharjeezy requested a review from seunlanlege March 25, 2026 13:12
@dharjeezy dharjeezy requested a review from seunlanlege March 25, 2026 16:09
@dharjeezy dharjeezy marked this pull request as draft March 25, 2026 16:32
@dharjeezy dharjeezy requested a review from seunlanlege March 25, 2026 16:32
@seunlanlege seunlanlege marked this pull request as ready for review March 26, 2026 08:51
Base automatically changed from dami/introduce-handler-v2 to relayer-v2 March 26, 2026 09:39
…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!
Copy link
Copy Markdown
Member

@Wizdave97 Wizdave97 Mar 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unique constraint needed here or else the ON CONFLICT check in insertion will fail

@dharjeezy dharjeezy changed the title [tesseract]: Index ZK consensus proofs in the indexer PostgreSQL database [tesseract]: Introduce pallet-outbound-proofs for on-chain consensus proof storage and verification Mar 31, 2026
@dharjeezy dharjeezy marked this pull request as draft March 31, 2026 14:00
);
Responded::<T>::insert(req_commitment, true);

T::OnDispatch::on_dispatch();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also this

pub fn submit_proof(
origin: OriginFor<T>,
consensus_proof: BoundedVec<u8, T::MaxProofSize>,
relay_chain_height: u64,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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> =
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't think we need this

}

#[pallet::storage]
pub type UnprovenEpochs<T: Config> =
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably not needed


#[pallet::storage]
pub type ProvenHeights<T: Config> = StorageMap<
_,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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")]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is it feature flagged?

Copy link
Copy Markdown
Contributor Author

@dharjeezy dharjeezy Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants