Documentation
¶
Index ¶
- Constants
- func EnsureDefaultConfig(homeDir string) error
- func MarkReadyHandler() engine.TaskHandler
- type AssembleGenesisRequest
- type AssembleNodeEntry
- type AwaitConditionRequest
- type ConditionWaiter
- type ConfigApplier
- type ConfigPatchRequest
- type ConfigPatcher
- type ConfigReloadRequest
- type ConfigReloader
- type ConfigValidator
- type ConfigureGenesisRequest
- type DiscoverPeersRequest
- type EC2ClientFactory
- type EC2DescribeAPI
- type EC2TagsSource
- type GenerateGentxRequest
- type GenerateIdentityRequest
- type GenesisArtifactUploader
- type GenesisAssembler
- type GenesisFetcher
- type GenesisPeersSetter
- type GenesisS3Config
- type GentxGenerator
- type HTTPDoer
- type IdentityGenerator
- type NodeIDQuerier
- type PeerDiscoverer
- type PeerSource
- type PeerSourceEntry
- type ResultExportRequest
- type ResultExporter
- type S3ClientFactory
- type S3GetObjectAPI
- type SetGenesisPeersRequest
- type SnapshotRestoreRequest
- type SnapshotRestorer
- type SnapshotUploadRequest
- type SnapshotUploader
- type StateSyncConfig
- type StateSyncConfigurer
- type StateSyncRequest
- type StaticSource
- type UploadArtifactsRequest
Constants ¶
const SnapshotHeightFile = ".sei-sidecar-snapshot-height"
SnapshotHeightFile records the snapshot height the node was restored from. The result-export task uses this to know where to start exporting.
Variables ¶
This section is empty.
Functions ¶
func EnsureDefaultConfig ¶
EnsureDefaultConfig creates the seid home directory structure and writes a minimal default config.toml if one does not already exist. The default is embedded from defaults/config.toml.
func MarkReadyHandler ¶
func MarkReadyHandler() engine.TaskHandler
MarkReadyHandler returns a no-op TaskHandler. When it succeeds, the engine marks itself as ready.
Types ¶
type AssembleGenesisRequest ¶ added in v0.0.26
type AssembleGenesisRequest struct {
AccountBalance string `json:"accountBalance"`
Namespace string `json:"namespace"`
Nodes []AssembleNodeEntry `json:"nodes"`
}
AssembleGenesisRequest holds the typed parameters for the assemble-and-upload-genesis task. S3 bucket, region, and prefix are derived from the sidecar's environment.
type AssembleNodeEntry ¶ added in v0.0.26
type AssembleNodeEntry struct {
Name string `json:"name"`
}
AssembleNodeEntry represents a single node in the "nodes" list param.
type AwaitConditionRequest ¶ added in v0.0.26
type AwaitConditionRequest struct {
Condition string `json:"condition"`
Action string `json:"action"`
TargetHeight int64 `json:"targetHeight"`
}
AwaitConditionRequest holds the typed parameters for the await-condition task.
type ConditionWaiter ¶ added in v0.0.19
type ConditionWaiter struct {
// contains filtered or unexported fields
}
ConditionWaiter polls a local node until a condition is met, then optionally executes a post-condition action.
func NewConditionWaiter ¶ added in v0.0.19
func NewConditionWaiter(rpcClient *rpc.StatusClient) *ConditionWaiter
NewConditionWaiter creates a ConditionWaiter. Pass nil for the default RPC client.
func (*ConditionWaiter) Handler ¶ added in v0.0.19
func (w *ConditionWaiter) Handler() engine.TaskHandler
Handler returns an engine.TaskHandler for the await-condition task type.
type ConfigApplier ¶ added in v0.0.9
type ConfigApplier struct {
// contains filtered or unexported fields
}
ConfigApplier generates or patches node config using sei-config's intent resolution pipeline. The handler deserializes a ConfigIntent from task params, calls the appropriate resolver, and writes the result to disk.
func NewConfigApplier ¶ added in v0.0.9
func NewConfigApplier(homeDir string) *ConfigApplier
NewConfigApplier creates an applier targeting the given home directory.
func (*ConfigApplier) Handler ¶ added in v0.0.9
func (a *ConfigApplier) Handler() engine.TaskHandler
Handler returns an engine.TaskHandler for the config-apply task type.
type ConfigPatchRequest ¶ added in v0.0.26
ConfigPatchRequest holds the typed parameters for the config-patch task. Files is intentionally map[string]map[string]any because TOML patches are inherently untyped.
type ConfigPatcher ¶
type ConfigPatcher struct {
// contains filtered or unexported fields
}
ConfigPatcher applies generic TOML merge-patches to seid configuration files.
func NewConfigPatcher ¶
func NewConfigPatcher(homeDir string) *ConfigPatcher
NewConfigPatcher creates a patcher targeting the given home directory.
func (*ConfigPatcher) Handler ¶
func (p *ConfigPatcher) Handler() engine.TaskHandler
Handler returns an engine.TaskHandler that reads a "files" map from params and merge-patches each named file under homeDir/config/.
Expected params format:
{
"files": {
"config.toml": {"p2p": {"persistent-peers": "..."}},
"app.toml": {"pruning": "nothing"}
}
}
func (*ConfigPatcher) PatchFiles ¶ added in v0.0.7
PatchFiles merge-patches each named TOML file under homeDir/config/.
type ConfigReloadRequest ¶ added in v0.0.26
ConfigReloadRequest holds the typed parameters for the config-reload task.
type ConfigReloader ¶ added in v0.0.9
type ConfigReloader struct {
// contains filtered or unexported fields
}
ConfigReloader patches hot-reloadable fields on disk and signals seid to re-read its configuration. The signal mechanism is deferred to a future release; for now only the on-disk write is performed.
func NewConfigReloader ¶ added in v0.0.9
func NewConfigReloader(homeDir string) *ConfigReloader
NewConfigReloader creates a reloader targeting the given home directory.
func (*ConfigReloader) Handler ¶ added in v0.0.9
func (r *ConfigReloader) Handler() engine.TaskHandler
Handler returns an engine.TaskHandler for the config-reload task type.
type ConfigValidator ¶ added in v0.0.9
type ConfigValidator struct {
// contains filtered or unexported fields
}
ConfigValidator reads on-disk config and returns validation diagnostics.
func NewConfigValidator ¶ added in v0.0.9
func NewConfigValidator(homeDir string) *ConfigValidator
NewConfigValidator creates a validator targeting the given home directory.
func (*ConfigValidator) Handler ¶ added in v0.0.9
func (v *ConfigValidator) Handler() engine.TaskHandler
Handler returns an engine.TaskHandler for the config-validate task type.
type ConfigureGenesisRequest ¶ added in v0.0.26
type ConfigureGenesisRequest struct{}
ConfigureGenesisRequest holds the typed parameters for the configure-genesis task. All fields are optional — the fetcher resolves genesis from the chain ID using embedded config or S3 fallback.
type DiscoverPeersRequest ¶ added in v0.0.26
type DiscoverPeersRequest struct {
Sources []PeerSourceEntry `json:"sources"`
}
DiscoverPeersRequest holds the typed parameters for the discover-peers task.
type EC2ClientFactory ¶
type EC2ClientFactory func(ctx context.Context, region string) (EC2DescribeAPI, error)
EC2ClientFactory builds an EC2 client for a given region.
type EC2DescribeAPI ¶
type EC2DescribeAPI interface {
DescribeInstances(ctx context.Context, params *ec2.DescribeInstancesInput, optFns ...func(*ec2.Options)) (*ec2.DescribeInstancesOutput, error)
}
EC2DescribeAPI abstracts the EC2 DescribeInstances call for testing.
func DefaultEC2ClientFactory ¶
func DefaultEC2ClientFactory(ctx context.Context, region string) (EC2DescribeAPI, error)
DefaultEC2ClientFactory creates a real EC2 client using Pod Identity credentials.
type EC2TagsSource ¶
type EC2TagsSource struct {
Region string
Tags map[string]string
EC2Factory EC2ClientFactory
QueryNodeID NodeIDQuerier
}
EC2TagsSource discovers peers by querying EC2 for running instances matching the configured tags.
type GenerateGentxRequest ¶ added in v0.0.26
type GenerateGentxRequest struct {
ChainID string `json:"chainId"`
StakingAmount string `json:"stakingAmount"`
AccountBalance string `json:"accountBalance"`
GenesisParams string `json:"genesisParams"`
}
GenerateGentxRequest holds the typed parameters for the generate-gentx task.
type GenerateIdentityRequest ¶ added in v0.0.26
type GenerateIdentityRequest struct {
ChainID string `json:"chainId"`
Moniker string `json:"moniker"`
}
GenerateIdentityRequest holds the typed parameters for the generate-identity task.
type GenesisArtifactUploader ¶ added in v0.0.22
type GenesisArtifactUploader struct {
// contains filtered or unexported fields
}
GenesisArtifactUploader uploads the gentx file and a node identity manifest to S3 so the assembler can collect them.
func NewGenesisArtifactUploader ¶ added in v0.0.22
func NewGenesisArtifactUploader(homeDir, bucket, region, chainID string, factory seis3.UploaderFactory) *GenesisArtifactUploader
NewGenesisArtifactUploader creates an uploader targeting the given home directory. Bucket, region, and chainID are read from environment at construction time.
func (*GenesisArtifactUploader) Handler ¶ added in v0.0.22
func (u *GenesisArtifactUploader) Handler() engine.TaskHandler
Handler returns an engine.TaskHandler for the upload-genesis-artifacts task type.
type GenesisAssembler ¶ added in v0.0.22
type GenesisAssembler struct {
// contains filtered or unexported fields
}
GenesisAssembler downloads per-node gentx files from S3, calls genutil.GenAppStateFromConfig (the same function as seid collect-gentxs) to produce the final genesis.json, and uploads it back to S3 for all validators to download.
func NewGenesisAssembler ¶ added in v0.0.22
func NewGenesisAssembler(homeDir, bucket, region, chainID string, s3Factory S3ClientFactory, uploaderFactory seis3.UploaderFactory) *GenesisAssembler
NewGenesisAssembler creates an assembler targeting the given home directory.
func (*GenesisAssembler) Handler ¶ added in v0.0.22
func (a *GenesisAssembler) Handler() engine.TaskHandler
Handler returns an engine.TaskHandler for the assemble-and-upload-genesis task type. S3 coordinates are derived from the sidecar's environment.
type GenesisFetcher ¶
type GenesisFetcher struct {
// contains filtered or unexported fields
}
GenesisFetcher writes genesis.json to the config directory. It first checks for an embedded genesis in sei-config for the chain ID. If not found, it falls back to downloading from S3 at {bucket}/{chainID}/genesis.json.
func NewGenesisFetcher ¶
func NewGenesisFetcher(homeDir, chainID, genesisBucket, genesisRegion string, factory S3ClientFactory) *GenesisFetcher
NewGenesisFetcher creates a fetcher targeting the given home directory. chainID is the chain this sidecar is running for (typically from SEI_CHAIN_ID). genesisBucket and genesisRegion configure the S3 fallback location when the chain is not embedded in sei-config.
func (*GenesisFetcher) Fetch ¶
func (g *GenesisFetcher) Fetch(ctx context.Context, cfg GenesisS3Config) error
Fetch downloads genesis.json from S3, skipping if the marker file exists. Retained for backward compatibility with callers that build GenesisS3Config directly.
func (*GenesisFetcher) Handler ¶
func (g *GenesisFetcher) Handler() engine.TaskHandler
Handler returns an engine.TaskHandler that resolves genesis from embedded config or S3 fallback. No task parameters are required.
type GenesisPeersSetter ¶ added in v0.0.23
type GenesisPeersSetter struct {
// contains filtered or unexported fields
}
GenesisPeersSetter downloads a peers.json file produced by the genesis assembler and writes the entries into config.toml as persistent_peers, filtering out the current node's own entry.
func NewGenesisPeersSetter ¶ added in v0.0.23
func NewGenesisPeersSetter(homeDir, bucket, region, chainID string, s3Factory S3ClientFactory) *GenesisPeersSetter
NewGenesisPeersSetter creates a setter targeting the given home directory.
func (*GenesisPeersSetter) Handler ¶ added in v0.0.23
func (g *GenesisPeersSetter) Handler() engine.TaskHandler
Handler returns an engine.TaskHandler for the set-genesis-peers task. The peers.json key is derived from the chain ID: {chainID}/peers.json.
type GenesisS3Config ¶
GenesisS3Config holds S3 coordinates for genesis.json download.
type GentxGenerator ¶ added in v0.0.22
type GentxGenerator struct {
// contains filtered or unexported fields
}
GentxGenerator produces a genesis transaction by calling the same SDK functions as seid keys add -> seid add-genesis-account -> seid gentx.
func NewGentxGenerator ¶ added in v0.0.22
func NewGentxGenerator(homeDir string) *GentxGenerator
NewGentxGenerator creates a generator targeting the given home directory.
func (*GentxGenerator) Handler ¶ added in v0.0.22
func (g *GentxGenerator) Handler() engine.TaskHandler
Handler returns an engine.TaskHandler for the generate-gentx task type.
Expected params:
{
"chainId": "my-chain",
"stakingAmount": "1000000usei",
"accountBalance": "10000000usei",
"genesisParams": "" (optional, reserved for future genesis customization)
}
type IdentityGenerator ¶ added in v0.0.22
type IdentityGenerator struct {
// contains filtered or unexported fields
}
IdentityGenerator creates the validator identity by calling the same SDK functions as seid init: genutil.InitializeNodeValidatorFilesFromMnemonic for keys, tmcfg.WriteConfigFile for config.toml, and genutil.ExportGenesisFile for genesis.json.
func NewIdentityGenerator ¶ added in v0.0.22
func NewIdentityGenerator(homeDir string) *IdentityGenerator
NewIdentityGenerator creates a generator targeting the given home directory.
func (*IdentityGenerator) Handler ¶ added in v0.0.22
func (g *IdentityGenerator) Handler() engine.TaskHandler
Handler returns an engine.TaskHandler for the generate-identity task type.
Expected params: {"chainId": "...", "moniker": "..."}
type NodeIDQuerier ¶
NodeIDQuerier fetches a Tendermint node ID from an IP address.
type PeerDiscoverer ¶
type PeerDiscoverer struct {
// contains filtered or unexported fields
}
PeerDiscoverer resolves peers from multiple sources and writes them to a file.
func NewPeerDiscoverer ¶
func NewPeerDiscoverer(homeDir string, ec2Factory EC2ClientFactory, nodeIDQuerier NodeIDQuerier) *PeerDiscoverer
NewPeerDiscoverer creates a discoverer targeting the given home directory.
func (*PeerDiscoverer) Handler ¶
func (d *PeerDiscoverer) Handler() engine.TaskHandler
Handler returns an engine.TaskHandler that parses peer source params and dispatches to the appropriate PeerSource implementations.
Expected params format:
{"sources": [{"type": "ec2Tags", "region": "...", "tags": {...}}, ...]}
type PeerSource ¶
PeerSource discovers peers from a specific source type.
type PeerSourceEntry ¶ added in v0.0.26
type PeerSourceEntry struct {
Type string `json:"type"`
Region string `json:"region,omitempty"`
Tags map[string]string `json:"tags,omitempty"`
Addresses []string `json:"addresses,omitempty"`
}
PeerSourceEntry represents a single peer source in the params JSON.
type ResultExportRequest ¶ added in v0.0.26
type ResultExportRequest struct {
Bucket string `json:"bucket"`
Prefix string `json:"prefix"`
Region string `json:"region"`
RPCEndpoint string `json:"rpcEndpoint"`
// CanonicalRPC enables comparison mode. When set, the exporter compares
// local block execution against this canonical RPC endpoint and completes
// when app-hash divergence is detected.
CanonicalRPC string `json:"canonicalRpc"`
}
ResultExportRequest holds the parameters for the result-export task.
type ResultExporter ¶ added in v0.0.16
type ResultExporter struct {
// contains filtered or unexported fields
}
ResultExporter queries the local seid RPC for block results and uploads them in compressed NDJSON pages to S3.
func NewResultExporter ¶ added in v0.0.16
func NewResultExporter(homeDir string, factory seis3.UploaderFactory) *ResultExporter
func (*ResultExporter) Export ¶ added in v0.0.16
func (e *ResultExporter) Export(ctx context.Context, cfg ResultExportRequest) error
Export queries the local node for block results and uploads pages to S3. Each invocation exports as many complete pages as are available since the last export height. The state file tracks progress across invocations.
func (*ResultExporter) ExportAndCompare ¶ added in v0.0.24
func (e *ResultExporter) ExportAndCompare(ctx context.Context, cfg ResultExportRequest) error
ExportAndCompare runs a continuous comparison between the local shadow node and a canonical chain. It completes successfully when app-hash divergence is detected, uploading a DivergenceReport alongside the comparison pages.
func (*ResultExporter) Handler ¶ added in v0.0.16
func (e *ResultExporter) Handler() engine.TaskHandler
type S3ClientFactory ¶
type S3ClientFactory func(ctx context.Context, region string) (S3GetObjectAPI, error)
S3ClientFactory builds an S3GetObjectAPI for a given region.
type S3GetObjectAPI ¶
type S3GetObjectAPI interface {
GetObject(ctx context.Context, params *s3.GetObjectInput, optFns ...func(*s3.Options)) (*s3.GetObjectOutput, error)
}
S3GetObjectAPI abstracts a single-object S3 download for small files.
func DefaultS3ClientFactory ¶
func DefaultS3ClientFactory(ctx context.Context, region string) (S3GetObjectAPI, error)
DefaultS3ClientFactory creates a real S3 client using default credentials.
type SetGenesisPeersRequest ¶ added in v0.0.26
type SetGenesisPeersRequest struct{}
SetGenesisPeersRequest holds the typed parameters for the set-genesis-peers task. S3 coordinates are derived from the sidecar's environment.
type SnapshotRestoreRequest ¶ added in v0.0.26
type SnapshotRestoreRequest struct {
TargetHeight int64 `json:"targetHeight,omitempty"`
}
SnapshotRestoreRequest holds the typed parameters for the snapshot-restore task. S3 bucket, region, and chain prefix are derived from the sidecar's environment. TargetHeight, when set, selects the highest available snapshot <= that height. When zero, the latest snapshot (from latest.txt) is used.
type SnapshotRestorer ¶
type SnapshotRestorer struct {
// contains filtered or unexported fields
}
SnapshotRestorer downloads and extracts a snapshot archive from S3.
func NewSnapshotRestorer ¶
func NewSnapshotRestorer(homeDir, bucket, region, chainID string, clientFactory seis3.TransferClientFactory, listerFactory seis3.ObjectListerFactory) (*SnapshotRestorer, error)
NewSnapshotRestorer creates a restorer targeting the given home directory. Bucket, region, and chainID are read from environment at construction time.
func (*SnapshotRestorer) Handler ¶
func (r *SnapshotRestorer) Handler() engine.TaskHandler
Handler returns an engine.TaskHandler for the snapshot-restore task.
func (*SnapshotRestorer) Restore ¶
func (r *SnapshotRestorer) Restore(ctx context.Context, targetHeight int64) error
Restore downloads and extracts the snapshot, skipping if the marker file exists. When targetHeight > 0, it lists objects and picks the highest snapshot <= targetHeight. When targetHeight == 0, it reads latest.txt for the newest snapshot.
type SnapshotUploadRequest ¶ added in v0.0.26
type SnapshotUploadRequest struct{}
SnapshotUploadRequest holds the parameters for the snapshot upload task. S3 bucket, region, and prefix are derived from the sidecar's environment.
type SnapshotUploader ¶
type SnapshotUploader struct {
// contains filtered or unexported fields
}
SnapshotUploader scans for locally produced Tendermint state-sync snapshots and uploads new ones to S3. When submitted as a task, it runs in a loop at the configured interval until the context is cancelled.
func NewSnapshotUploader ¶
func NewSnapshotUploader(homeDir, bucket, region, chainID string, uploadInterval time.Duration, factory seis3.UploaderFactory) *SnapshotUploader
NewSnapshotUploader creates an uploader targeting the given home directory. Bucket, region, and chainID are read from environment at construction time.
func (*SnapshotUploader) Handler ¶
func (u *SnapshotUploader) Handler() engine.TaskHandler
Handler returns an engine.TaskHandler for the snapshot-upload task. The handler runs in a loop, attempting an upload on each tick and sleeping for the configured interval between attempts. It stays running until the context is cancelled.
func (*SnapshotUploader) Upload ¶
func (u *SnapshotUploader) Upload(ctx context.Context) error
Upload finds the latest complete snapshot, archives it, and streams it to S3. It picks the second-to-latest snapshot height to avoid uploading an in-progress snapshot. If the snapshot has already been uploaded (tracked via a local state file), it no-ops.
The archive is streamed through an io.Pipe so it never needs to be buffered entirely in memory; the transfermanager handles multipart upload automatically.
type StateSyncConfig ¶
type StateSyncConfig struct {
TrustHeight int64
TrustHash string
TrustPeriod string
RpcServers string
UseLocalSnapshot bool
BackfillBlocks int64
}
StateSyncConfig holds the trust point and RPC servers for Tendermint state sync.
type StateSyncConfigurer ¶
type StateSyncConfigurer struct {
// contains filtered or unexported fields
}
StateSyncConfigurer discovers a trust point from peers and writes the config file.
func NewStateSyncConfigurer ¶
func NewStateSyncConfigurer(homeDir string, client HTTPDoer) *StateSyncConfigurer
NewStateSyncConfigurer creates a configurer targeting the given home directory.
func (*StateSyncConfigurer) Configure ¶
func (s *StateSyncConfigurer) Configure(ctx context.Context, p StateSyncRequest) error
Configure reads persistent-peers from config.toml, queries a peer for a trust point, and writes the state sync settings back to config.toml. When UseLocalSnapshot is true, the trust height is derived from the locally-restored snapshot and use-local-snapshot is set in config.toml.
func (*StateSyncConfigurer) Handler ¶
func (s *StateSyncConfigurer) Handler() engine.TaskHandler
Handler returns an engine.TaskHandler.
type StateSyncRequest ¶ added in v0.0.26
type StateSyncRequest struct {
UseLocalSnapshot bool `json:"useLocalSnapshot"`
TrustPeriod string `json:"trustPeriod"`
BackfillBlocks int64 `json:"backfillBlocks"`
}
StateSyncRequest groups the caller-provided parameters for state-sync configuration.
type StaticSource ¶
type StaticSource struct {
Addresses []string
}
StaticSource returns a fixed list of peer addresses.
type UploadArtifactsRequest ¶ added in v0.0.26
type UploadArtifactsRequest struct {
NodeName string `json:"nodeName"`
}
UploadArtifactsRequest holds the typed parameters for the upload-genesis-artifacts task.