Fix staged sync cycle limit wiring - #12
Open
Frozen wants to merge 1 commit into
Open
Conversation
Honor StagedSync.MaxBlocksPerSyncCycle when selecting each staged-sync target instead of using the hard-coded 1024-block limit. Preserve zero as unlimited and cover bounded and unbounded targets.
Greptile SummaryThe PR wires the configured staged-sync block limit through service construction and replaces the fixed 1024-block cycle cap while preserving zero as unlimited.
Confidence Score: 5/5The PR appears safe to merge with no actionable correctness or security issues identified. The configured value is propagated through the staged-sync construction path, positive values cap the cycle target as intended, zero retains the documented unlimited behavior, and the changed constructor has no stale repository callers.
|
| Filename | Overview |
|---|---|
| cmd/harmony/main.go | Wires the Harmony staged-sync cycle limit into the synchronization service configuration. |
| api/service/synchronize/stagedstreamsync/const.go | Adds the configured maximum-block count to the staged-sync service configuration, documenting zero as unlimited. |
| api/service/synchronize/stagedstreamsync/syncing.go | Passes the service-level cycle limit into the heads-stage configuration. |
| api/service/synchronize/stagedstreamsync/stage_heads.go | Replaces the hard-coded 1024-block cap with the configured limit and safely handles targets at or below the current height. |
| api/service/synchronize/stagedstreamsync/stage_heads_test.go | Covers smaller and larger limits, a one-block limit, and zero-as-unlimited behavior. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[Harmony staged-sync config] -->|MaxBlocksPerSyncCycle| B[syncService.Config]
B --> C[CreateStagedSync]
C --> D[StageHeadsCfg]
D --> E[limitCycleTargetHeight]
E -->|positive value| F[Cap cycle target]
E -->|zero| G[Use full target height]
Reviews (1): Last reviewed commit: "Fix staged sync cycle limit wiring" | Re-trigger Greptile
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Sync.StagedSyncCfg.MaxBlocksPerSyncCycleinto staged sync0as unlimited and add target-height regression coverage[Test]
go test -mod=readonly ./api/service/synchronize/stagedstreamsyncgo test -mod=readonly ./cmd/harmonygo vet -mod=readonly ./api/service/synchronize/stagedstreamsync ./cmd/harmonygit diff --check origin/main...HEAD