This repository was archived by the owner on Nov 25, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 162
feat(vmsync): dynamic state sync with coordinator, pivot cadence, and engine-driven target updates #1379
Draft
powerslider
wants to merge
14
commits into
master
Choose a base branch
from
powerslider/1259-dyn-sync-client-support
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+886
−135
Draft
feat(vmsync): dynamic state sync with coordinator, pivot cadence, and engine-driven target updates #1379
Changes from 1 commit
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
bdbae9d
feat(vmsync): dynamic state sync with coordinator, pivot cadence, and…
powerslider 0d880da
fix: move OnEngineAccept
powerslider 703e483
Merge branch 'master' into powerslider/1259-dyn-sync-client-support
powerslider 808df80
Merge branch 'master' into powerslider/1259-dyn-sync-client-support
powerslider aeafac5
feat(vmsync): remove stale blocks from queue after sync target updates
powerslider 521eadb
refactor(vmsync): propagate context throughout dynamic state sync flow
powerslider 5299f8b
Merge branch 'master' into powerslider/1259-dyn-sync-client-support
powerslider b287823
refactor(vmsync): improve code quality and reduce duplication
powerslider 987fcb1
feat(vmsync): allow block enqueuing during batch execution
powerslider 29972e9
feat(sync): add Finalize method to Syncer interface and integrate int…
powerslider b9844a0
fix(vmsync): prevent double execution and fix race conditions in dyna…
powerslider 34f306f
docs(vmsync): streamline method docs
powerslider c74dc88
Merge branch 'master' into powerslider/1259-dyn-sync-client-support
powerslider 1e68a11
Merge branch 'master' into powerslider/1259-dyn-sync-client-support
powerslider File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| // Copyright (C) 2019-2025, Ava Labs, Inc. All rights reserved. | ||
| // See the file LICENSE for licensing terms. | ||
|
|
||
| package vmsync | ||
|
|
||
| import "sync" | ||
|
|
||
| // blockQueue buffers blocks that arrive while the coordinator is in the Running | ||
| // state. It is cleared (drained) on UpdateSyncTarget to avoid drops and is | ||
| // snapshotted at finalization via DequeueBatch. Enqueue is always allowed; a | ||
| // DequeueBatch only captures the current buffered blocks and clears them, and | ||
| // new enqueues after the snapshot are not part of that batch. | ||
| type blockQueue struct { | ||
| mu sync.Mutex | ||
| // buffered blocks accumulated before finalization | ||
| items []EthBlockWrapper | ||
| } | ||
|
|
||
| // newBlockQueue creates a new empty queue. | ||
| func newBlockQueue() *blockQueue { | ||
| return &blockQueue{} | ||
| } | ||
|
|
||
| // Enqueue appends a block to the buffer. Returns true if the block was queued, | ||
| // false if the block is nil. | ||
| func (q *blockQueue) Enqueue(b EthBlockWrapper) bool { | ||
| if b == nil { | ||
| return false | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this reasonable and/or possible? |
||
| } | ||
| q.mu.Lock() | ||
| defer q.mu.Unlock() | ||
| q.items = append(q.items, b) | ||
| return true | ||
| } | ||
|
|
||
| // DequeueBatch returns the current buffered blocks and clears the buffer. New | ||
| // arrivals after the snapshot are not included and remain buffered for later. | ||
| func (q *blockQueue) DequeueBatch() []EthBlockWrapper { | ||
| q.mu.Lock() | ||
| defer q.mu.Unlock() | ||
| out := q.items | ||
| q.items = nil | ||
| return out | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.