feat(durable): expose mode-generic foldable impl for Registry#1069
Conversation
c1ddbdd to
9d7b333
Compare
|
Benchmark results for revision ae7f174:
Full results
Compare the results above with those for the default branch. |
Codecov Report❌ Patch coverage is
❌ Your patch check has failed because the patch coverage (53.84%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #1069 +/- ##
==========================================
- Coverage 90.17% 90.08% -0.10%
==========================================
Files 130 130
Lines 28110 28199 +89
Branches 28110 28199 +89
==========================================
+ Hits 25348 25402 +54
- Misses 2013 2047 +34
- Partials 749 750 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
9d7b333 to
8d2c26e
Compare
victor-dumitrescu
left a comment
There was a problem hiding this comment.
This is something that came up in an AI review, but there's an issue with theRegistry mode-independent hash fold implementation, which is that in Prove mode it will record the access to the registry size, which then changes the proof:
kv_test!(test_hashing_prove_registry_does_not_record_reads, KV: BackgroundKeyValueStore, {
let (_keepalive, repo) = KV::setup_repo();
let key_a = Key::new(&[1]).expect("Size less than KEY_MAX_SIZE");
let key_b = Key::new(&[2]).expect("Size less than KEY_MAX_SIZE");
let mut registry = setup_size_2_registry::<KV>(repo);
registry
.database_mut(0)
.expect("database at index 0 exists")
.set(key_a, Bytes::copy_from_slice(b"foo"))
.expect("Setting in Normal mode should succeed");
registry
.database_mut(1)
.expect("database at index 1 exists")
.set(key_b, Bytes::copy_from_slice(b"bar"))
.expect("Setting in Normal mode should succeed");
let prove_registry = registry
.try_start_proof()
.expect("Converting to prove mode should succeed");
let proof_before_hash =
octez_riscv_data::merkle_proof::proof_tree::MerkleProof::from_foldable(
&prove_registry.databases,
);
let proof_before_hash_bytes =
serialise(&proof_before_hash).expect("Serialising proof should succeed");
let normal_root = Hash::from_foldable(®istry);
let prove_root = Hash::from_foldable(&prove_registry);
assert_eq!(prove_root, normal_root);
let proof_after_hash =
octez_riscv_data::merkle_proof::proof_tree::MerkleProof::from_foldable(
&prove_registry.databases,
);
let proof_after_hash_bytes =
serialise(&proof_after_hash).expect("Serialising proof should succeed");
assert_eq!(
proof_after_hash_bytes, proof_before_hash_bytes,
"Proof should be unchanged by hashing"
);
});Pull request was converted to draft
8d2c26e to
e25bdc3
Compare
e25bdc3 to
b74a5e1
Compare
|
@victor-dumitrescu - thank you so much for the spot! That's a really good point. I've traced the issue ultimately to the fold as you mentioned - for now, I think the easiest thing is to have the This does mean that the arity for the registry goes from I've included your test, too - which now passes |
00cb6c5 to
f679c8e
Compare
f679c8e to
9906132
Compare
What
Expose mode-generic
FoldableforRegistry, withProvemode support forHashFoldandMerkleProofFoldforDatabase.Why
Required for
Foldable<HashFold>andFoldable<MerkleProofFold>forProvemode registry - needed to integrateProvemode into octez.Fix a bug in
test_verify_replays_prove_readsthat was taking the hash from the normal mode, instead of the intended prove mode, registry.The wiring up of a
Prooftype, withFromProoffor registry, will follow.Manually Testing
Tasks for the Author