Skip to content

Commit 06f270b

Browse files
address dan review
1 parent 6e2e066 commit 06f270b

8 files changed

Lines changed: 22 additions & 18 deletions

File tree

.github/benchmark-tracking.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,5 @@ name = "qmdb"
5252
criterion_args = ["--sample-size", "100", "--significance-level", "0.01"]
5353
variants = [
5454
"qmdb::merkleize/variant=any::unordered::fixed::mmr keys=10000 ch=false sync=false",
55-
"qmdb::merkleize/variant=current::ordered::fixed::mmb keys=10000 ch=true sync=false",
55+
"qmdb::merkleize/variant=current::ordered::fixed::mmb keys=10000 chunk=256 ch=true sync=false",
5656
]

storage/src/qmdb/any/mod.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,12 @@ use crate::{
6969
authenticated::Inner,
7070
contiguous::{fixed::Config as FConfig, variable::Config as VConfig},
7171
},
72-
merkle::{full::Config as MerkleConfig, Bagging, Family, Location},
72+
merkle::{full::Config as MerkleConfig, Family, Location},
7373
qmdb::{
7474
any::operation::{Operation, Update},
7575
bitmap::Shared,
7676
operation::Committable,
77+
ROOT_BAGGING,
7778
},
7879
translator::Translator,
7980
Context,
@@ -158,7 +159,7 @@ where
158159
cfg.merkle_config,
159160
cfg.journal_config,
160161
Operation::is_commit,
161-
Bagging::BackwardFold,
162+
ROOT_BAGGING,
162163
)
163164
.await?;
164165

storage/src/qmdb/current/proof.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use crate::{
1111
self,
1212
hasher::{Hasher, Standard as StandardHasher},
1313
storage::Storage,
14-
Bagging, Family, Graftable, Location, Position, Proof,
14+
Family, Graftable, Location, Position, Proof,
1515
},
1616
qmdb::{
1717
self,
@@ -801,7 +801,7 @@ impl<F: Graftable, D: Digest> RangeProof<F, D> {
801801
grafting_height,
802802
start_chunk,
803803
chunk_vec,
804-
Bagging::BackwardFold,
804+
qmdb::ROOT_BAGGING,
805805
);
806806

807807
// For partial chunks, validate the last chunk digest from the proof.

storage/src/qmdb/immutable/fixed.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ use crate::{
88
authenticated,
99
contiguous::fixed::{self, Config as JournalConfig},
1010
},
11-
merkle::{self, Family},
11+
merkle::Family,
1212
qmdb::{
1313
any::{value::FixedEncoding, FixedValue},
14-
Error,
14+
Error, ROOT_BAGGING,
1515
},
1616
translator::Translator,
1717
};
@@ -58,7 +58,7 @@ impl<
5858
cfg.merkle_config,
5959
cfg.log,
6060
Operation::<F, K, V>::is_commit,
61-
merkle::Bagging::BackwardFold,
61+
ROOT_BAGGING,
6262
)
6363
.await?;
6464
Self::init_from_journal(journal, context, cfg.translator).await

storage/src/qmdb/immutable/variable.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ use crate::{
88
authenticated,
99
contiguous::variable::{self, Config as JournalConfig},
1010
},
11-
merkle::{self, Family},
11+
merkle::Family,
1212
qmdb::{
1313
any::{value::VariableEncoding, VariableValue},
1414
operation::Key,
15-
Error,
15+
Error, ROOT_BAGGING,
1616
},
1717
translator::Translator,
1818
};
@@ -62,7 +62,7 @@ impl<
6262
cfg.merkle_config,
6363
cfg.log,
6464
Operation::<F, K, V>::is_commit,
65-
merkle::Bagging::BackwardFold,
65+
ROOT_BAGGING,
6666
)
6767
.await?;
6868
Self::init_from_journal(journal, context, cfg.translator).await

storage/src/qmdb/keyless/fixed.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ use crate::{
77
authenticated,
88
contiguous::fixed::{self, Config as JournalConfig},
99
},
10-
merkle::{self, Family},
10+
merkle::Family,
1111
qmdb::{
1212
any::value::{FixedEncoding, FixedValue},
1313
keyless::operation::Operation as BaseOperation,
1414
operation::Committable,
15-
Error,
15+
Error, ROOT_BAGGING,
1616
},
1717
};
1818
use commonware_cryptography::Hasher;
@@ -49,7 +49,7 @@ impl<F: Family, E: Storage + Clock + Metrics, V: FixedValue, H: Hasher, S: Strat
4949
cfg.merkle,
5050
cfg.log,
5151
Operation::<F, V>::is_commit,
52-
merkle::Bagging::BackwardFold,
52+
ROOT_BAGGING,
5353
)
5454
.await?;
5555
Self::init_from_journal(journal).await

storage/src/qmdb/keyless/variable.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ use crate::{
77
authenticated,
88
contiguous::variable::{self, Config as JournalConfig},
99
},
10-
merkle::{self, Family},
10+
merkle::Family,
1111
qmdb::{
1212
any::value::{VariableEncoding, VariableValue},
1313
keyless::operation::Operation as BaseOperation,
1414
operation::Committable,
15-
Error,
15+
Error, ROOT_BAGGING,
1616
},
1717
};
1818
use commonware_codec::Read;
@@ -54,7 +54,7 @@ impl<F: Family, E: Storage + Clock + Metrics, V: VariableValue, H: Hasher, S: St
5454
cfg.merkle,
5555
cfg.log,
5656
Operation::<F, V>::is_commit,
57-
merkle::Bagging::BackwardFold,
57+
ROOT_BAGGING,
5858
)
5959
.await?;
6060
Self::init_from_journal(journal).await

storage/src/qmdb/mod.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,12 @@ pub use verify::{
7575
verify_proof_and_extract_digests, verify_proof_and_pinned_nodes,
7676
};
7777

78+
/// Merkle peak bagging policy used by QMDB operation roots.
79+
pub(crate) const ROOT_BAGGING: Bagging = Bagging::BackwardFold;
80+
7881
/// Return the Merkle hasher configuration used by QMDB operation roots and proofs.
7982
pub const fn hasher<H: CryptoHasher>() -> StandardHasher<H> {
80-
StandardHasher::with_bagging(Bagging::BackwardFold)
83+
StandardHasher::with_bagging(ROOT_BAGGING)
8184
}
8285

8386
/// Look up the inactivity floor declared at the commit immediately preceding `op_count`.

0 commit comments

Comments
 (0)