Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync in-memory trees using DB (DB is source of truth now). #842

Merged
merged 8 commits into from
Jan 13, 2025

Conversation

piohei
Copy link
Contributor

@piohei piohei commented Jan 7, 2025

Motivation

For Highly Available sequencer we will use database as source of truth and synchronization point.

Solution

Changes:

  • new task introduced to sync with database
  • for tree now there is an option to move forward and backward in history
  • added e2e tests for offchain mode
  • processing insertions/deletions is now consolidated into single task to give deletions precedence over insertions and also simplify logic with mutexes
  • identity tree refactored
  • for offchain mode transactions are being finalized based on database state instead of internal in-memory queue

PR Checklist

  • Added Tests
  • Added Documentation

@piohei piohei marked this pull request as ready for review January 7, 2025 14:06
@piohei piohei requested a review from a team as a code owner January 7, 2025 14:06
@piohei piohei force-pushed the piohei/sync_over_db branch 2 times, most recently from bb6f06c to d4c3f15 Compare January 8, 2025 13:52
@piohei piohei force-pushed the piohei/sync_over_db branch from d4c3f15 to 236227c Compare January 8, 2025 14:36
};

// And then update trees
update_latest_tree(tx, latest_tree, &latest_pending_tree_update, || {
Copy link
Contributor

Choose a reason for hiding this comment

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

very nice! Clever approach

src/identity/processor.rs Outdated Show resolved Hide resolved
src/task_monitor/mod.rs Outdated Show resolved Hide resolved
@piohei piohei merged commit 41b12c7 into main Jan 13, 2025
5 checks passed
@piohei piohei deleted the piohei/sync_over_db branch January 13, 2025 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants