@@ -54,12 +54,12 @@ pub enum ReconstructionError {
5454/// in depth-first (forward consumption) order for each range peak.
5555///
5656/// Multi-proofs use a different layout: `digests` contains the sorted set of node digests required
57- /// by the selected root spec , including individual prefix peak digests rather than a folded prefix
58- /// accumulator. This layout is intentionally position-keyed: every multi-proof digest corresponds
59- /// to a concrete Merkle node position. For `BackwardFold`, this may include active suffix peaks that
60- /// a single range proof could collapse into a smaller synthetic suffix accumulator. We keep the
61- /// extra active peaks so multi-proofs and proof stores can stay simple and derive witnesses from
62- /// positions alone.
57+ /// by the requested `inactive_peaks` and bagging policy , including individual prefix peak digests
58+ /// rather than a folded prefix accumulator. This layout is intentionally position-keyed: every
59+ /// multi-proof digest corresponds to a concrete Merkle node position. For `BackwardFold`, this may
60+ /// include active suffix peaks that a single range proof could collapse into a smaller synthetic
61+ /// suffix accumulator. We keep the extra active peaks so multi-proofs and proof stores can stay
62+ /// simple and derive witnesses from positions alone.
6363#[ derive( Clone , Debug , Eq ) ]
6464pub struct Proof < F : Family , D : Digest > {
6565 /// The total number of leaves in the data structure. For MMR proofs, this is the number of
@@ -175,7 +175,11 @@ impl<F: Family, D: Digest> Proof<F, D> {
175175
176176 /// Returns true if this proof's `inactive_peaks` field matches the canonical value derived
177177 /// from `size` and `inactivity_floor`.
178- pub fn matches_canonical_spec ( & self , size : Position < F > , inactivity_floor : Location < F > ) -> bool {
178+ pub fn matches_canonical_inactive_peaks (
179+ & self ,
180+ size : Position < F > ,
181+ inactivity_floor : Location < F > ,
182+ ) -> bool {
179183 self . inactive_peaks == F :: inactive_peaks ( size, inactivity_floor)
180184 }
181185
@@ -343,7 +347,10 @@ impl<F: Family, D: Digest> Proof<F, D> {
343347 Ok ( collected_digests)
344348 }
345349
346- /// Verify this proof and the pinned nodes against `root` using `spec`.
350+ /// Verify this proof and the pinned nodes against `root`.
351+ ///
352+ /// The proof's `inactive_peaks` field commits to the split boundary; peak bagging is selected
353+ /// by `hasher`.
347354 ///
348355 /// The `pinned_nodes` are the peak digests of the sub-structure at `start_loc`, in the order
349356 /// returned by `Family::nodes_to_pin`. The proof authenticates the prefix `[0, start_loc)` via:
@@ -1171,24 +1178,24 @@ mod tests {
11711178 Standard :: with_bagging ( bagging)
11721179 }
11731180
1174- fn push_unique_spec ( specs : & mut Vec < ( Bagging , usize ) > , spec : ( Bagging , usize ) ) {
1175- if !specs . contains ( & spec ) {
1176- specs . push ( spec ) ;
1181+ fn push_unique_shape ( shapes : & mut Vec < ( Bagging , usize ) > , shape : ( Bagging , usize ) ) {
1182+ if !shapes . contains ( & shape ) {
1183+ shapes . push ( shape ) ;
11771184 }
11781185 }
11791186
1180- fn supported_root_specs < F : Family > ( leaves : Location < F > ) -> Vec < ( Bagging , usize ) > {
1187+ fn supported_root_shapes < F : Family > ( leaves : Location < F > ) -> Vec < ( Bagging , usize ) > {
11811188 let peak_count = F :: peaks ( F :: location_to_position ( leaves) ) . count ( ) ;
1182- let mut specs = Vec :: new ( ) ;
1189+ let mut shapes = Vec :: new ( ) ;
11831190
1184- push_unique_spec ( & mut specs , ( Bagging :: ForwardFold , 0 ) ) ;
1185- push_unique_spec ( & mut specs , ( Bagging :: BackwardFold , 0 ) ) ;
1191+ push_unique_shape ( & mut shapes , ( Bagging :: ForwardFold , 0 ) ) ;
1192+ push_unique_shape ( & mut shapes , ( Bagging :: BackwardFold , 0 ) ) ;
11861193 for inactive_peaks in 0 ..=peak_count {
1187- push_unique_spec ( & mut specs , ( Bagging :: ForwardFold , inactive_peaks) ) ;
1188- push_unique_spec ( & mut specs , ( Bagging :: BackwardFold , inactive_peaks) ) ;
1194+ push_unique_shape ( & mut shapes , ( Bagging :: ForwardFold , inactive_peaks) ) ;
1195+ push_unique_shape ( & mut shapes , ( Bagging :: BackwardFold , inactive_peaks) ) ;
11891196 }
11901197
1191- specs
1198+ shapes
11921199 }
11931200
11941201 fn inactive_leaf_floor < F : Family > ( leaves : Location < F > , inactive_peaks : usize ) -> u64 {
@@ -1198,7 +1205,7 @@ mod tests {
11981205 . sum ( )
11991206 }
12001207
1201- fn active_start_for_spec < F : Family > (
1208+ fn active_start_for_shape < F : Family > (
12021209 leaves : Location < F > ,
12031210 inactive_peaks : usize ,
12041211 width : u64 ,
@@ -1210,13 +1217,13 @@ mod tests {
12101217 Location :: new ( * leaves - width)
12111218 }
12121219
1213- fn range_proofs_verify_for_supported_root_specs < F : Family > ( ) {
1220+ fn range_proofs_verify_for_supported_root_shapes < F : Family > ( ) {
12141221 let mem = build_raw :: < F > ( & H :: new ( ) , 123 ) ;
12151222 let leaves = mem. leaves ( ) ;
12161223
1217- for ( bagging, inactive_peaks) in supported_root_specs :: < F > ( leaves) {
1224+ for ( bagging, inactive_peaks) in supported_root_shapes :: < F > ( leaves) {
12181225 let hasher = hasher_for_bagging ( bagging) ;
1219- let range_start = active_start_for_spec :: < F > ( leaves, inactive_peaks, 3 ) ;
1226+ let range_start = active_start_for_shape :: < F > ( leaves, inactive_peaks, 3 ) ;
12201227 let range = range_start..range_start + 3 ;
12211228 let root = mem. root ( & hasher, inactive_peaks) . unwrap ( ) ;
12221229 let elements: Vec < _ > = ( * range. start ..* range. end )
@@ -1257,13 +1264,13 @@ mod tests {
12571264 }
12581265 }
12591266
1260- fn multi_proofs_verify_for_supported_root_specs < F : Family > ( ) {
1267+ fn multi_proofs_verify_for_supported_root_shapes < F : Family > ( ) {
12611268 let mem = build_raw :: < F > ( & H :: new ( ) , 123 ) ;
12621269 let leaves = mem. leaves ( ) ;
12631270
1264- for ( bagging, inactive_peaks) in supported_root_specs :: < F > ( leaves) {
1271+ for ( bagging, inactive_peaks) in supported_root_shapes :: < F > ( leaves) {
12651272 let hasher = hasher_for_bagging ( bagging) ;
1266- let first = active_start_for_spec :: < F > ( leaves, inactive_peaks, 12 ) ;
1273+ let first = active_start_for_shape :: < F > ( leaves, inactive_peaks, 12 ) ;
12671274 let locations = [ first, first + 5 , first + 11 ] ;
12681275 let nodes = nodes_required_for_multi_proof ( leaves, inactive_peaks, bagging, & locations)
12691276 . expect ( "test locations valid" ) ;
@@ -1358,7 +1365,7 @@ mod tests {
13581365 }
13591366
13601367 #[ test]
1361- fn full_backward_root_spec_proves_like_split_zero ( ) {
1368+ fn full_backward_root_proves_like_split_zero ( ) {
13621369 let hasher: H = Standard :: backward ( ) ;
13631370 let mem = build_raw :: < mmb:: Family > ( & hasher, 123 ) ;
13641371 let range = Location :: new ( 2 ) ..Location :: new ( 3 ) ;
@@ -1403,7 +1410,7 @@ mod tests {
14031410 & full_backward_root,
14041411 ) ) ;
14051412
1406- // Split { inactive_peaks: 0 } is byte-identical to Full when inactive_peaks == 0 .
1413+ // A zero inactive boundary is byte-identical to the corresponding full root .
14071414 let split_root_value = mem. root ( & hasher, 0 ) . unwrap ( ) ;
14081415 assert_eq ! ( full_backward_root, split_root_value) ;
14091416 let split_proof: Result < Proof < mmb:: Family , D > , Error < mmb:: Family > > = build_range_proof (
@@ -2549,12 +2556,12 @@ mod tests {
25492556 range_proof_reconstruction :: < mmr:: Family > ( ) ;
25502557 }
25512558 #[ test]
2552- fn mmr_range_proofs_verify_for_supported_root_specs ( ) {
2553- range_proofs_verify_for_supported_root_specs :: < mmr:: Family > ( ) ;
2559+ fn mmr_range_proofs_verify_for_supported_root_shapes ( ) {
2560+ range_proofs_verify_for_supported_root_shapes :: < mmr:: Family > ( ) ;
25542561 }
25552562 #[ test]
2556- fn mmr_multi_proofs_verify_for_supported_root_specs ( ) {
2557- multi_proofs_verify_for_supported_root_specs :: < mmr:: Family > ( ) ;
2563+ fn mmr_multi_proofs_verify_for_supported_root_shapes ( ) {
2564+ multi_proofs_verify_for_supported_root_shapes :: < mmr:: Family > ( ) ;
25582565 }
25592566 #[ test]
25602567 fn mmr_verify_element_inclusion ( ) {
@@ -2642,12 +2649,12 @@ mod tests {
26422649 range_proof_reconstruction :: < mmb:: Family > ( ) ;
26432650 }
26442651 #[ test]
2645- fn mmb_range_proofs_verify_for_supported_root_specs ( ) {
2646- range_proofs_verify_for_supported_root_specs :: < mmb:: Family > ( ) ;
2652+ fn mmb_range_proofs_verify_for_supported_root_shapes ( ) {
2653+ range_proofs_verify_for_supported_root_shapes :: < mmb:: Family > ( ) ;
26472654 }
26482655 #[ test]
2649- fn mmb_multi_proofs_verify_for_supported_root_specs ( ) {
2650- multi_proofs_verify_for_supported_root_specs :: < mmb:: Family > ( ) ;
2656+ fn mmb_multi_proofs_verify_for_supported_root_shapes ( ) {
2657+ multi_proofs_verify_for_supported_root_shapes :: < mmb:: Family > ( ) ;
26512658 }
26522659 #[ test]
26532660 fn mmb_verify_element_inclusion ( ) {
0 commit comments