Skip to content

Commit c408d44

Browse files
committed
chore: add docs for merkle tree backend for Hash32 in root programs
1 parent af3b1c7 commit c408d44

File tree

2 files changed

+20
-0
lines changed
  • aggregation_mode/aggregation_programs

2 files changed

+20
-0
lines changed

aggregation_mode/aggregation_programs/risc0/src/lib.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,16 @@ impl IsMerkleTreeBackend for Risc0ImageIdAndPubInputs {
6969
#[derive(Serialize, Deserialize)]
7070
pub struct Hash32(pub [u8; 32]);
7171

72+
// Note: this MerkleTreeBackend is defined in three locations
73+
// - aggregation_mode/src/aggregators/mod.rs
74+
// - aggregation_mode/src/aggregators/risc0_aggregator.rs and
75+
// - aggregation_mode/src/aggregators/sp1_aggregator.rs
76+
// All 3 implementations should match
77+
// The definition on aggregator/mod.rs supports taking proofs from both Risc0 and SP1,
78+
// Additionally, a version that takes the leaves as already hashed data is defined on:
79+
// - batcher/aligned-sdk/src/sdk/aggregation.rs
80+
// This one is used in the SDK since
81+
// the user may not have access to the proofs that they didn't submit
7282
impl IsMerkleTreeBackend for Hash32 {
7383
type Data = Hash32;
7484
type Node = [u8; 32];

aggregation_mode/aggregation_programs/sp1/src/lib.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,16 @@ impl IsMerkleTreeBackend for SP1VkAndPubInputs {
6464
#[derive(Serialize, Deserialize)]
6565
pub struct Hash32(pub [u8; 32]);
6666

67+
// Note: this MerkleTreeBackend is defined in three locations
68+
// - aggregation_mode/src/aggregators/mod.rs
69+
// - aggregation_mode/src/aggregators/risc0_aggregator.rs and
70+
// - aggregation_mode/src/aggregators/sp1_aggregator.rs
71+
// All 3 implementations should match
72+
// The definition on aggregator/mod.rs supports taking proofs from both Risc0 and SP1,
73+
// Additionally, a version that takes the leaves as already hashed data is defined on:
74+
// - batcher/aligned-sdk/src/sdk/aggregation.rs
75+
// This one is used in the SDK since
76+
// the user may not have access to the proofs that they didn't submit
6777
impl IsMerkleTreeBackend for Hash32 {
6878
type Data = Hash32;
6979
type Node = [u8; 32];

0 commit comments

Comments
 (0)