Skip to content

Commit 30c38fe

Browse files
committed
feat: add StateSync field to ArchiveSpec for bootstrap
Archive nodes cannot replay pacific-1 genesis with v6.3.0, so they need Tendermint state sync to bootstrap initial state from peers. Adds an explicit stateSync field to ArchiveSpec and wires it through the archive planner so configure-state-sync is included in the init plan when set. Updates the pacific-1-snapshotter manifest.
1 parent 1bb120b commit 30c38fe

6 files changed

Lines changed: 22 additions & 10 deletions

File tree

api/v1alpha1/archive_types.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
package v1alpha1
22

33
// ArchiveSpec configures an archive node (no pruning, full history).
4-
// Archive nodes always block sync from genesis to retain all historical data.
4+
// Archive nodes bootstrap via Tendermint state sync then block sync to
5+
// retain all historical data from that point forward.
56
// If SnapshotGeneration is set, the node also acts as a snapshotter.
67
type ArchiveSpec struct {
78
// Peers configures how the archive node discovers peers for block sync.
89
// +optional
910
Peers []PeerSource `json:"peers,omitempty"`
1011

11-
// Snapshot configures how the archive node bootstraps its initial state.
12-
// When set with a BootstrapImage and S3 target, a PreInit Job restores
13-
// the snapshot before the main container starts.
12+
// StateSync enables Tendermint state sync for initial bootstrap.
13+
// When set, the sidecar configures state sync so the node fetches
14+
// a snapshot from peers before switching to block sync.
1415
// +optional
15-
Snapshot *SnapshotSource `json:"snapshot,omitempty"`
16+
StateSync *StateSyncSource `json:"stateSync,omitempty"`
1617

1718
// SnapshotGeneration configures periodic snapshot creation and optional upload.
1819
// +optional

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/controller/node/planner.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,6 @@ func snapshotSourceFor(node *seiv1alpha1.SeiNode) *seiv1alpha1.SnapshotSource {
5454
return node.Spec.Validator.Snapshot
5555
case node.Spec.Replayer != nil:
5656
return &node.Spec.Replayer.Snapshot
57-
case node.Spec.Archive != nil:
58-
return node.Spec.Archive.Snapshot
5957
default:
6058
return nil
6159
}

internal/controller/node/planner_archive.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,21 @@ func (p *archiveNodePlanner) Validate(node *seiv1alpha1.SeiNode) error {
2424
}
2525

2626
func (p *archiveNodePlanner) BuildPlan(node *seiv1alpha1.SeiNode) *seiv1alpha1.TaskPlan {
27-
return buildPlan(node.Spec.Archive.Peers, nil)
27+
return buildPlan(node.Spec.Archive.Peers, p.snapshotSource(node))
2828
}
2929

3030
func (p *archiveNodePlanner) BuildTask(node *seiv1alpha1.SeiNode, taskType string) (sidecar.TaskBuilder, error) {
3131
if taskType == taskConfigApply {
3232
return p.buildConfigApply(node), nil
3333
}
34-
return buildSharedTask(node, node.Spec.Archive.Peers, nil, taskType, p.snapshotRegion)
34+
return buildSharedTask(node, node.Spec.Archive.Peers, p.snapshotSource(node), taskType, p.snapshotRegion)
35+
}
36+
37+
func (p *archiveNodePlanner) snapshotSource(node *seiv1alpha1.SeiNode) *seiv1alpha1.SnapshotSource {
38+
if node.Spec.Archive.StateSync == nil {
39+
return nil
40+
}
41+
return &seiv1alpha1.SnapshotSource{StateSync: node.Spec.Archive.StateSync}
3542
}
3643

3744
func (p *archiveNodePlanner) buildConfigApply(node *seiv1alpha1.SeiNode) sidecar.TaskBuilder {

manifests/samples/pacific-1-shadow-replayer.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ metadata:
1111
namespace: default
1212
spec:
1313
chainId: pacific-1
14-
image: ghcr.io/bdchatham/sei-shadow@sha256:0d04d7ff4327d298bd584083835aaaa68ef0d6918581858b4e377853b476f0f0
14+
image: ghcr.io/bdchatham/sei-shadow@sha256:ae74c6588272f0f733ec82ca28f5f2465bd2c807cbecdd5201846ff66059d08b
1515

1616
sidecar:
1717
image: ghcr.io/sei-protocol/seictl@sha256:8bfef078409c160f03c62fcd969702b3edc9d957369fb56dca9e34e09ac6c99a

manifests/samples/pacific-1-snapshotter.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ spec:
2727
retainOnDelete: true
2828

2929
archive:
30+
stateSync: {}
3031
peers:
3132
- ec2Tags:
3233
region: eu-central-1

0 commit comments

Comments
 (0)