-
Notifications
You must be signed in to change notification settings - Fork 89
Beacon Kit Verifier #612
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Beacon Kit Verifier #612
Conversation
|
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. |
| /// - Empty hash = sha256("") | ||
| /// | ||
| /// The proof consists of sibling hashes (aunts) from leaf to root. | ||
| pub fn verify_tx_proof( |
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
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"; |
There was a problem hiding this comment.
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), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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>>, |
There was a problem hiding this comment.
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"); |
There was a problem hiding this comment.
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}"); |
There was a problem hiding this comment.
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
| 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}"); |
…/beacon-kit-verifier # Conflicts: # .github/workflows/ci.yml
Introducing the Beacon Kit Verifier crate for verifying consensus/light client updates from the beacon kit consensus engine.
closes #610