Skip to content

Conversation

@dharjeezy
Copy link
Contributor

@dharjeezy dharjeezy commented Dec 17, 2025

Introducing the Beacon Kit Verifier crate for verifying consensus/light client updates from the beacon kit consensus engine.

closes #610

@dharjeezy dharjeezy requested a review from Wizdave97 December 17, 2025 15:44
@Wizdave97
Copy link
Member

PR should include the beacon kit prover, that can fetch these updates, and also define all the types required by the prover e.g BeaconState, BeaconBlock, BeaconBlockHeader etc.

@dharjeezy dharjeezy marked this pull request as draft December 17, 2025 20:45
/// - Empty hash = sha256("")
///
/// The proof consists of sibling hashes (aunts) from leaf to root.
pub fn verify_tx_proof(
Copy link
Member

Choose a reason for hiding this comment

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

Can't we just use a regular merkle proof library to verify this like rs_merkle? have you tried that?

/// - Inner hash = sha256(0x01 || left || right)
///
/// Returns the aunt hashes (sibling hashes) from leaf to root.
pub fn generate_tx_merkle_proof(
Copy link
Member

@Wizdave97 Wizdave97 Jan 6, 2026

Choose a reason for hiding this comment

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

I think we can also just use rs_merkle for this, also this function should be defined in the relayer

use tendermint_primitives::{CodecConsensusProof, CodecTrustedState, TrustedState};
use tendermint_verifier::verify_header_update;

pub const BEACON_KIT_CONSENSUS_CLIENT_ID: ConsensusClientId = *b"BKIT";
Copy link
Member

@Wizdave97 Wizdave97 Jan 6, 2026

Choose a reason for hiding this comment

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

Move these constants and types to a primitives.rs file

trusted_validators,
trusted_next_validators,
trusted_header.header.next_validators_hash.as_bytes().try_into().unwrap(),
self.host.trusting_period_secs.unwrap_or(82 * 3600),
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
self.host.trusting_period_secs.unwrap_or(82 * 3600),
self.host.trusting_period_secs.unwrap_or(300),

pub tendermint_update: CodecConsensusProof,
/// All transactions in the CometBFT block.
/// The first transaction (txs[0]) is the SSZ-encoded SignedBeaconBlock.
pub txs: Vec<Vec<u8>>,
Copy link
Member

Choose a reason for hiding this comment

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

Let's use a boundedVec here, since we know the transactions should be maximum of 2


fn get_beaconkit_rpc() -> String {
let base_url =
std::env::var("BEACONKIT_COMETBFT_RPC").expect("BEACONKIT_COMETBFT_RPC must be set");
Copy link
Member

Choose a reason for hiding this comment

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

Not necessary, the RPC endpoint should come with the api key.

let mut height = latest_height - 1;
let mut matched_header = None;
while height > trusted_state.height {
log::trace!(target: "tesseract", "BeaconKit: Checking for validator set match at {height}");
Copy link
Member

Choose a reason for hiding this comment

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

Let's use tesseract-beaconkit as the target for these trace logs

Suggested change
log::trace!(target: "tesseract", "BeaconKit: Checking for validator set match at {height}");
log::trace!(target: "tesseract-beaconkit", "BeaconKit: Checking for validator set match at {height}");

@dharjeezy dharjeezy marked this pull request as ready for review January 9, 2026 04:55
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.

BeaconKit Light client

4 participants