Skip to content

fix: configure state-sync to use locally-restored snapshots#26

Merged
bdchatham merged 1 commit into
mainfrom
fix/local-snapshot-statesync
Mar 15, 2026
Merged

fix: configure state-sync to use locally-restored snapshots#26
bdchatham merged 1 commit into
mainfrom
fix/local-snapshot-statesync

Conversation

@bdchatham
Copy link
Copy Markdown
Contributor

@bdchatham bdchatham commented Mar 14, 2026

Summary

  • Local snapshot-aware state-sync: When a node has a locally-restored S3 snapshot, the configure-state-sync task now sets use-local-snapshot = true and derives trust-height from the snapshot height (by scanning data/snapshots/) instead of the chain tip minus 2000. This prevents Tendermint from ignoring the pre-staged snapshot and redundantly fetching all chunks over P2P.
  • Parameterized ConfigureStateSyncTask: The controller passes UseLocalSnapshot: true when the SeiNode spec includes a snapshot config (hasLocalSnapshot(node)). The task remains zero-config for nodes without a local snapshot.
  • Lint cleanup: Fixes all 24 golangci-lint errcheck violations across the codebase.

Root Cause

The configure-state-sync task was writing use-local-snapshot = false (the default) and deriving trust-height from the chain tip, causing nodes with locally-restored S3 snapshots to perform full P2P state-sync (~4800 chunks over hours) instead of applying the already-present local snapshot.

Changes

File Change
sidecar/client/tasks.go Add UseLocalSnapshot field to ConfigureStateSyncTask, wire into params
sidecar/tasks/statesync.go Branch on useLocalSnapshot param: discover snapshot height from data/snapshots/, set use-local-snapshot in config.toml
sidecar/tasks/statesync_test.go Add 4 new tests for local snapshot path and height discovery
9 other files Fix errcheck lint violations (_ = for intentionally-discarded errors)

Test plan

  • All existing tests pass (go test ./...)
  • golangci-lint run ./... reports 0 issues
  • New tests cover: local snapshot config written correctly, missing snapshot dir errors, height discovery picks max, empty dir errors
  • Controller change in sei-k8s-controller task_builders.go passes UseLocalSnapshot: hasLocalSnapshot(node) (separate PR)
  • Deploy to brandon cluster and verify nodes use local snapshotn

When a node has a local S3 snapshot, configure-state-sync now sets
use-local-snapshot=true and derives trust-height from the snapshot
height instead of the chain tip. This prevents Tendermint from
ignoring the pre-staged snapshot and fetching all chunks over P2P.

The controller passes UseLocalSnapshot to ConfigureStateSyncTask
based on whether the SeiNode spec includes a snapshot config. The
task scans the Tendermint snapshots directory to discover the height.

Also fixes all golangci-lint errcheck violations across the codebase.
@bdchatham bdchatham marked this pull request as ready for review March 15, 2026 00:21
@bdchatham bdchatham merged commit b2c3ef0 into main Mar 15, 2026
2 checks passed
@bdchatham bdchatham deleted the fix/local-snapshot-statesync branch March 15, 2026 00:21
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.

1 participant