Skip to content

[storage/qmdb/current] extend current sync protocol to fetch ops root witnesses#3844

Draft
roberto-bayardo wants to merge 2 commits into
mainfrom
current-sync-protocol
Draft

[storage/qmdb/current] extend current sync protocol to fetch ops root witnesses#3844
roberto-bayardo wants to merge 2 commits into
mainfrom
current-sync-protocol

Conversation

@roberto-bayardo
Copy link
Copy Markdown
Collaborator

No description provided.

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented May 20, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
commonware-mcp 8c383ca May 21 2026, 03:03 PM

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented May 20, 2026

Deploying monorepo with  Cloudflare Pages  Cloudflare Pages

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

View logs

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 20, 2026

Benchmark results

Tip

PASSED: No benchmark exceeded the regression threshold.

Benchmark comparison table
Benchmark Baseline (main) Current Delta Threshold Status
qmdb::merkleize/variant=any::unordered::fixed::mmr keys=10000 ch=false sync=false 1.623 ms 1.713 ms +5.54% 10.00% ✅ PASS
qmdb::merkleize/variant=current::ordered::fixed::mmb chunk=256 keys=10000 ch=true sync=false 3.075 ms 3.205 ms +4.22% 10.00% ✅ PASS

Baseline commit(s): edc5cced171c

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 CurrentResolver to fetch an atomic, fully authenticated current Target (root, ops_root, witness, range) from common resolver/db wrapper types.
  • Introduced TargetMatcher for 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.

Comment on lines +216 to +225
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 {
Comment on lines +184 to +186
/// 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.
@roberto-bayardo roberto-bayardo force-pushed the current-sync-protocol branch from d1dc053 to 8c383ca Compare May 21, 2026 15:02
@codecov
Copy link
Copy Markdown

codecov Bot commented May 21, 2026

Codecov Report

❌ Patch coverage is 83.47826% with 19 lines in your changes missing coverage. Please review.
✅ Project coverage is 95.76%. Comparing base (edc5cce) to head (8c383ca).

Files with missing lines Patch % Lines
storage/src/qmdb/current/sync/mod.rs 83.47% 11 Missing and 8 partials ⚠️
@@            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     
Files with missing lines Coverage Δ
storage/src/qmdb/current/sync/mod.rs 81.00% <83.47%> (+0.74%) ⬆️

... and 5 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update edc5cce...8c383ca. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

2 participants