Skip to content

Commit f26fc1c

Browse files
committed
chore: add docs to structs and events
1 parent b7414c7 commit f26fc1c

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

batcher/aligned-sdk/src/beacon.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use reqwest::{Client, Url};
55
use serde::{Deserialize, Serialize};
66
use serde_json::Value;
77

8+
// See https://eips.ethereum.org/EIPS/eip-4844#parameters
89
pub const KZG_VERSIONED_HASH: u8 = 0x1;
910

1011
pub struct BeaconClient {
@@ -29,6 +30,7 @@ pub enum BeaconClientError {
2930

3031
#[derive(Deserialize, Debug)]
3132
#[allow(dead_code)]
33+
// https://ethereum.github.io/beacon-APIs/#/Beacon/getBlobSidecars
3234
pub struct BlobData {
3335
pub index: String,
3436
pub blob: String,
@@ -39,13 +41,16 @@ pub struct BlobData {
3941

4042
#[derive(Deserialize, Debug)]
4143
#[allow(dead_code)]
44+
45+
// https://ethereum.github.io/beacon-APIs/#/Beacon/getBlockHeaders
4246
pub struct BeaconBlock {
4347
pub root: String,
4448
pub canonical: bool,
4549
pub header: BeaconBlockHeader,
4650
}
4751

4852
#[derive(Deserialize, Debug)]
53+
4954
pub struct BeaconBlockHeader {
5055
pub message: BeaconBlockMessage,
5156
}

batcher/aligned-sdk/src/sdk/aggregation.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,12 @@ pub async fn is_proof_verified_in_aggregation_mode(
9393

9494
let logs = eth_rpc_provider.get_logs(&filter).await.unwrap();
9595
for log in logs {
96+
// First 32 bytes of the data are the bytes of the blob versioned hash
9697
let blob_versioned_hash: [u8; 32] = log.data[0..32]
9798
.try_into()
9899
.map_err(|_| ProofVerificationAggModeError::EventDecoding)?;
100+
101+
// Event is indexed by merkle root
99102
let merkle_root = log.topics[1].0;
100103

101104
// Block Number shouldn't be empty, in case it is,

0 commit comments

Comments
 (0)