[storage/qmdb/current] extend current sync protocol to fetch ops root witnesses#3844
[storage/qmdb/current] extend current sync protocol to fetch ops root witnesses#3844roberto-bayardo wants to merge 2 commits into
Conversation
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
commonware-mcp | 8c383ca | May 21 2026, 03:03 PM |
Deploying monorepo with
|
| Latest commit: |
8c383ca
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://24ba0ec0.monorepo-eu0.pages.dev |
| Branch Preview URL: | https://current-sync-protocol.monorepo-eu0.pages.dev |
Benchmark resultsTip ✅ PASSED: No benchmark exceeded the regression threshold. Benchmark comparison table
Baseline commit(s): |
1f1512a to
3f54493
Compare
3f54493 to
d1dc053
Compare
There was a problem hiding this comment.
Pull request overview
This PR extends the qmdb/current sync surface to support consensus-aware synchronization by (1) fetching fully authenticated “current” targets (including ops-root witnesses) from resolvers, and (2) providing a bounded matcher to join candidate targets with externally trusted canonical roots (e.g., from consensus).
Changes:
- Added
CurrentResolverto fetch an atomic, fully authenticated currentTarget(root, ops_root, witness, range) from common resolver/db wrapper types. - Introduced
TargetMatcherfor bounded joining of trusted roots with candidate current targets, plus new unit tests. - Updated the sync example resolver to implement
CurrentResolver.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
storage/src/qmdb/current/sync/mod.rs |
Adds CurrentResolver trait + implementations and introduces TargetMatcher for joining trusted roots with resolver-provided targets. |
storage/src/qmdb/current/sync/tests.rs |
Adds unit tests for TargetMatcher and for CurrentResolver::current_target() behavior across wrapper types. |
examples/sync/src/net/resolver.rs |
Implements CurrentResolver for the network resolver used by the sync example. |
| pub fn insert_trusted_root(&mut self, root: D) -> Option<Target<F, D>> { | ||
| if self.emitted_roots.contains(&root) { | ||
| return None; | ||
| } | ||
| if let Some(target) = self.candidate_targets.remove(&root) { | ||
| self.trusted_roots.remove(&root); | ||
| self.record_emitted(root); | ||
| return Some(target); | ||
| } | ||
| if self.max_trusted_roots == 0 { |
| /// A resolver inserts latest atomic targets with [`Self::insert_candidate_target`]. The first time | ||
| /// a root appears in both caches, the matcher returns the matching target and consumes that root so | ||
| /// it is emitted at most once. |
d1dc053 to
8c383ca
Compare
Codecov Report❌ Patch coverage is
@@ Coverage Diff @@
## main #3844 +/- ##
==========================================
- Coverage 95.77% 95.76% -0.01%
==========================================
Files 486 486
Lines 200338 200453 +115
Branches 4858 4873 +15
==========================================
+ Hits 191872 191964 +92
- Misses 6834 6847 +13
- Partials 1632 1642 +10
... and 5 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
No description provided.