tasks

package
v0.0.66 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 13, 2026 License: Apache-2.0 Imports: 71 Imported by: 0

Documentation

Overview

Package tasks — gov completion contract. Gov sign-tx handlers surface a structured GovTxResult (committed_ok / committed_failed / pending) so the controller isn't left inferring success from a bare "task Complete".

Index

Constants

View Source
const (
	OutcomeUploaded = wire.OutcomeUploaded
	OutcomeNoop     = wire.OutcomeNoop
	OutcomeError    = wire.OutcomeError

	NoopFewerThanTwoSnapshots = wire.NoopFewerThanTwoSnapshots
	NoopAlreadyUploaded       = wire.NoopAlreadyUploaded
)
View Source
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

func EnsureDefaultConfig(homeDir string) error

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 IsTerminal added in v0.0.50

func IsTerminal(err error) bool

IsTerminal reports whether err (or any wrapped error) is a TerminalError.

func MarkReadyHandler

func MarkReadyHandler() engine.TaskHandler

MarkReadyHandler returns a no-op TaskHandler. When it succeeds, the engine marks itself as ready.

func Terminal added in v0.0.50

func Terminal(err error) error

Terminal wraps err as TerminalError, or returns nil when err is nil.

Types

type AssembleGenesisRequest added in v0.0.26

type AssembleGenesisRequest struct {
	AccountBalance string                     `json:"accountBalance"`
	Namespace      string                     `json:"namespace"`
	Nodes          []AssembleNodeEntry        `json:"nodes"`
	Accounts       []GenesisAccountEntry      `json:"accounts,omitempty"`
	Overrides      map[string]json.RawMessage `json:"overrides,omitempty"`
}

AssembleGenesisRequest holds the typed parameters for the assemble-and-upload-genesis task. S3 bucket, region, and prefix are derived from the sidecar's environment.

Overrides is a flat map of dotted-path keys into genesis.app_state to raw JSON values. The first dotted token is the cosmos module name (a key in app_state); subsequent tokens walk into that module's JSON tree. The leaf value is replaced verbatim with the supplied json.RawMessage. The controller enforces immutability of these keys post-bootstrap via CEL; the sidecar applies them once during the genesis ceremony.

type AssembleGenesisResult added in v0.0.59

type AssembleGenesisResult struct {
	GenesisHash string `json:"genesisHash"`
}

AssembleGenesisResult is the task's structured result, emitted in-band over the trusted controller↔sidecar task-result channel. GenesisHash is the bare SHA-256 hex digest (no "sha256:" prefix) of the exact uploaded genesis.json bytes; the controller stamps status.genesisHash from it and plumbs it into followers' ConfigureGenesisTask.ExpectedGenesisHash.

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

type ConfigPatchRequest struct {
	Files map[string]map[string]any `json:"files"`
}

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

func (p *ConfigPatcher) PatchFiles(_ context.Context, files map[string]any) error

PatchFiles merge-patches each named TOML file under homeDir/config/.

type ConfigReloadRequest added in v0.0.26

type ConfigReloadRequest struct {
	Fields map[string]string `json:"fields"`
}

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 {
	ExpectedGenesisHash string `json:"expectedGenesisHash,omitempty"`
}

ConfigureGenesisRequest holds the typed parameters for the configure-genesis task. The fetcher resolves genesis from the chain ID using embedded config or S3 fallback.

ExpectedGenesisHash is the bare SHA-256 hex digest (no "sha256:" prefix) the downloaded genesis.json must match. When non-empty it gates the S3 download: a mismatch fails closed. When empty (what the current controller sends) the download is unverified, preserving today's behavior.

type EndpointDigestRecord added in v0.0.60

type EndpointDigestRecord struct {
	Height        int64             `json:"height"`
	Normalization string            `json:"normalization"`
	FlatKVDigest  string            `json:"flatkv_digest"`
	MemIAVLDigest string            `json:"memiavl_digest"`
	PerBucket     map[string]bucket `json:"per_bucket"`
	Match         bool              `json:"match"`
	AxesProved    []string          `json:"axes_proved"`
	GeneratedAt   string            `json:"generated_at"`
}

EndpointDigestRecord is the published verdict for one (height, normalization) comparison — the durable artifact a reader trusts. Its own SHA-256 seal lives out-of-band (the s3 helper's EmitResult, logged + in the TaskResult): a record cannot carry the hash of its own published bytes.

type EvmLogicalDigestRequest added in v0.0.60

type EvmLogicalDigestRequest struct {
	FlatKVDir  string `json:"flatkvDir"`
	MemIAVLDir string `json:"memiavlDir"`
	Height     int64  `json:"height"`
	Bucket     string `json:"bucket"`
	Prefix     string `json:"prefix"`
	Region     string `json:"region"`

	// Normalizations is the set of memiavl normalization modes to prove.
	// Defaults to ["semantic","translator"] when empty.
	Normalizations []string `json:"normalizations"`

	// SeidbPath is the seidb binary to exec. Defaults to "seidb" (PATH lookup).
	SeidbPath string `json:"seidbPath"`
}

EvmLogicalDigestRequest parameters the evm-logical-digest task. It shells out to seidb's evm-logical-digest for a flatkv clone and a memiavl snapshot at the same height, compares the backend-independent logical digests, and publishes the verdict to S3.

type EvmLogicalDigester added in v0.0.60

type EvmLogicalDigester struct {
	// contains filtered or unexported fields
}

EvmLogicalDigester runs the comparison. It holds no per-request state.

func NewEvmLogicalDigester added in v0.0.60

func NewEvmLogicalDigester(factory seis3.UploaderFactory) *EvmLogicalDigester

NewEvmLogicalDigester builds the task handler dependency. A nil factory uses the default real-S3 uploader.

func (*EvmLogicalDigester) Handler added in v0.0.60

func (d *EvmLogicalDigester) Handler() engine.TaskHandler

type GenerateGentxRequest added in v0.0.26

type GenerateGentxRequest struct {
	ChainID        string `json:"chainId"`
	StakingAmount  string `json:"stakingAmount"`
	AccountBalance string `json:"accountBalance"`
}

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 GenesisAccountEntry added in v0.0.36

type GenesisAccountEntry struct {
	Address string `json:"address"`
	Balance string `json:"balance"`
}

GenesisAccountEntry represents one externally-supplied genesis account. Mirrors SeiNodeDeployment.spec.genesis.accounts[] on the controller side.

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

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; such callers do not verify a hash (empty expected hash).

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

type GenesisS3Config struct {
	Bucket string
	Key    string
	Region string
}

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"
}

type GovParamChangeRequest added in v0.0.58

type GovParamChangeRequest struct {
	ChainID string `json:"chainId"`
	KeyName string `json:"keyName"`

	Title       string `json:"title"`
	Description string `json:"description"`

	Changes []paramChange `json:"changes"`

	InitialDeposit string `json:"initialDeposit"`

	Memo string `json:"memo,omitempty"`
	Fees string `json:"fees"`
	Gas  uint64 `json:"gas"`
}

GovParamChangeRequest holds gov-param-change params. Idempotency is NOT handled — see the REHYDRATION WARNING at the top of this file.

type GovParamChanger added in v0.0.58

type GovParamChanger struct {
	// contains filtered or unexported fields
}

GovParamChanger captures cfg by value at construction; engine.Config is documented read-only after startup, so the copy is safe.

func NewGovParamChanger added in v0.0.58

func NewGovParamChanger(cfg engine.ExecutionConfig) *GovParamChanger

func (*GovParamChanger) Handler added in v0.0.58

func (g *GovParamChanger) Handler() engine.TaskHandler

Handler delegates to SignAndBroadcast (which owns the crash-idempotency marker — see the REHYDRATION note at the top of this file) and classifies the outcome via classifyGovResult.

type GovSoftwareUpgradeRequest added in v0.0.50

type GovSoftwareUpgradeRequest struct {
	ChainID string `json:"chainId"`
	KeyName string `json:"keyName"`

	Title       string `json:"title"`
	Description string `json:"description"`

	UpgradeName   string `json:"upgradeName"`
	UpgradeHeight int64  `json:"upgradeHeight"`
	UpgradeInfo   string `json:"upgradeInfo,omitempty"`

	InitialDeposit string `json:"initialDeposit"`

	Memo string `json:"memo,omitempty"`
	Fees string `json:"fees"`
	Gas  uint64 `json:"gas"`
}

GovSoftwareUpgradeRequest holds gov-software-upgrade params. Idempotency is NOT handled — see the REHYDRATION WARNING at the top of this file.

type GovSoftwareUpgrader added in v0.0.50

type GovSoftwareUpgrader struct {
	// contains filtered or unexported fields
}

GovSoftwareUpgrader captures cfg by value at construction; engine.Config is documented read-only after startup, so the copy is safe.

func NewGovSoftwareUpgrader added in v0.0.50

func NewGovSoftwareUpgrader(cfg engine.ExecutionConfig) *GovSoftwareUpgrader

func (*GovSoftwareUpgrader) Handler added in v0.0.50

func (g *GovSoftwareUpgrader) Handler() engine.TaskHandler

Handler delegates to SignAndBroadcast (which owns the crash-idempotency marker — see the REHYDRATION note at the top of this file) and classifies the outcome via classifyGovResult.

type GovVoteRequest added in v0.0.50

type GovVoteRequest struct {
	ChainID    string `json:"chainId"`
	KeyName    string `json:"keyName"`
	ProposalID uint64 `json:"proposalId"`
	Option     string `json:"option"` // yes | no | abstain | no_with_veto
	Memo       string `json:"memo,omitempty"`
	Fees       string `json:"fees"`
	Gas        uint64 `json:"gas"`
}

GovVoteRequest holds gov-vote params. Idempotency is handled by the chain — last-write-wins on (proposalID, voter); no pre-broadcast chain query.

type GovVoter added in v0.0.50

type GovVoter struct {
	// contains filtered or unexported fields
}

GovVoter captures cfg by value at construction; engine.Config is documented read-only after startup, so the copy is safe.

func NewGovVoter added in v0.0.50

func NewGovVoter(cfg engine.ExecutionConfig) *GovVoter

func (*GovVoter) Handler added in v0.0.50

func (g *GovVoter) Handler() engine.TaskHandler

Handler delegates to SignAndBroadcast after MsgVote construction.

Rehydration: a crash after BroadcastSync but before result persist re-runs this handler. The rehydrated run signs at sequence+1 and broadcasts a second tx; chain last-write-wins on (proposalID, voter) keeps governance state correct and the operator pays fees twice. Safe ONLY because MsgVote is chain-idempotent — non-idempotent Msg types (MsgSend, MsgWithdraw…) would double-spend. Future sign-tx handlers must evaluate per-Msg idempotency before reusing this shape.

Stale proposals are rejected by CheckTx and surface as Terminal. We do not pre-check via chain query — that opens a TOCTOU window.

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 MarkNotReadier added in v0.0.64

type MarkNotReadier struct {
	// contains filtered or unexported fields
}

MarkNotReadier re-arms the seid start gate for a node hold. Its handler purges recorded mark-ready results from the task store; the engine then flips the readiness flag false on success (the sole false-writer, see engine.execute). The purge is what closes the rehydration release path: a mark-ready left running by an ungraceful shutdown would otherwise re-run on restart and mark the engine ready again, releasing seid onto a wiped data directory.

func NewMarkNotReadier added in v0.0.64

func NewMarkNotReadier(purger markReadyPurger) *MarkNotReadier

NewMarkNotReadier builds a MarkNotReadier over the given store.

func (*MarkNotReadier) Handler added in v0.0.64

func (m *MarkNotReadier) Handler() engine.TaskHandler

Handler returns an engine.TaskHandler for the mark-not-ready task type. Params are empty. The handler purges mark-ready records and returns; the engine's completion hook performs the readiness flip. On purge failure it returns an error so the engine skips the flip (fail-safe: readiness is left untouched rather than flipped over a store that still holds a releasable mark-ready).

type NoopReason added in v0.0.66

type NoopReason = wire.NoopReason

UploadOutcome and NoopReason are the snapshot-upload result-wire contract. They live in sidecar/wire (the dependency-free contract home) and are aliased here so handler call sites and the CLI poller reference one definition.

type ResetDataResult added in v0.0.64

type ResetDataResult struct {
	WipedBytes int64 `json:"wipedBytes"`
}

ResetDataResult is the reset-data task's structured result. WipedBytes is the pre-wipe on-disk size of data/ (regular files only), surfaced so the workflow's hold event can report how much was cleared. It is -1 when the measurement failed: the count is observability, never a gate, so a failed measurement does not block the reset. Symlinked entries are counted by their own (link) size rather than their target, so a data dir that uses symlinks may undercount — acceptable for an observability figure.

type ResetDataer added in v0.0.64

type ResetDataer struct {
	// contains filtered or unexported fields
}

ResetDataer clears the chain data directory for a state-sync re-bootstrap. The wipe is scoped to <homeDir>/data/ and nothing else: the home root holds config/ (node identity), the sidecar's task ledger (sidecar.db — the database that resumes this very wipe after a crash), and the hold sentinel/markers. Wiping the home root would destroy the machinery mid-flight; this is the design's most important correctness rule.

The reset needs no atomicity of its own. A partially deleted data directory is only dangerous if seid starts on it, and the node hold guarantees it does not. As defense-in-depth the handler refuses to run while seid's local RPC is serving (i.e. the node is not actually held). It is content-idempotent: an already-wiped directory is success.

func NewResetDataer added in v0.0.64

func NewResetDataer(homeDir string) *ResetDataer

NewResetDataer builds a ResetDataer rooted at homeDir with the real local-RPC serving probe.

func (*ResetDataer) Handler added in v0.0.64

func (d *ResetDataer) Handler() engine.TaskHandler

Handler returns an engine.TaskHandler for the reset-data task type. Params are empty; the result carries the pre-wipe byte count.

type RestartSeider added in v0.0.56

type RestartSeider struct {
	// contains filtered or unexported fields
}

RestartSeider restarts the co-located seid process in place: it SIGTERMs seid and waits for it to exit gracefully (the kubelet restarts the container), then waits for seid's local RPC to serve again. seid re-reads config.toml on this restart without bouncing the sidecar. The handler never starts seid and never flips the engine ready flag — it is not a readiness operation.

Shutdown is graceful-only and fail-loud: if seid does not exit within the grace window it is left running and the task fails (never SIGKILLed). A force-kill opt-in is intentionally omitted until a non-validator forced restart needs it.

Completion means "seid's RPC is serving /status again," NOT "caught up / voting." Callers that need in-service-and-voting must gate height / caught-up separately (downstream AwaitNodesAtHeight).

The three OS interactions are injectable for testing:

  • signaler: process discovery + SIGTERM (defaults to a /proc + syscall implementation that corroborates `seid start`).
  • probeUp: returns true once seid's local RPC answers /status (defaults to a local CometBFT /status probe).

func NewRestartSeider added in v0.0.56

func NewRestartSeider() *RestartSeider

NewRestartSeider builds a RestartSeider with the real /proc + syscall + local-RPC implementations.

func (*RestartSeider) Handler added in v0.0.56

func (r *RestartSeider) Handler() engine.TaskHandler

Handler returns an engine.TaskHandler for the restart-seid task type. Params are empty: restart-seid is a fire-and-confirm operation.

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"`

	// MigrationMode tunes comparison for an AppHash-breaking migration shadow
	// (e.g. memiavl->flatkv): AppHash divergence from canonical is expected
	// every block, so it is treated as informational and the verdict keys on
	// execution-results equivalence (LastResultsHash + gas + per-tx receipts).
	MigrationMode bool `json:"migrationMode,omitempty"`

	// ContinueOnDivergence selects survey mode: the comparison records each
	// divergent block to the compare page and keeps going instead of halting on
	// the first divergence. Default false preserves the production tripwire. The
	// comparator's verdict is unchanged — every field is compared authentically;
	// this only decides whether a divergence stops the run. Classifying benign vs
	// real divergences is the downstream `seictl report` step's job. Has no
	// effect outside comparison mode (it requires CanonicalRPC).
	ContinueOnDivergence bool `json:"continueOnDivergence,omitempty"`

	// ShadowEVMRPC and CanonicalEVMRPC are the EVM JSON-RPC endpoints for the
	// shadow and canonical chains. When both are set, Layer 2 (logical state
	// diff) is enabled, comparing storage/code/nonce for the keys each block
	// touched. These are EVM JSON-RPC (eth_*), distinct from the CometBFT RPC
	// used for Layers 0/1.
	ShadowEVMRPC    string `json:"shadowEvmRpc,omitempty"`
	CanonicalEVMRPC string `json:"canonicalEvmRpc,omitempty"`

	// TraceRPC is the EVM JSON-RPC endpoint used for prestate traces
	// (debug_traceBlockByNumber) to derive each block's touched keys. Defaults
	// to CanonicalEVMRPC. Requires the debug_ namespace enabled on that node.
	TraceRPC string `json:"traceRpc,omitempty"`
}

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, chainID, podName string, factory seis3.UploaderFactory) *ResultExporter

NewResultExporter creates an exporter targeting the given home directory. chainID and podName label shadow comparison metrics; pass empty strings if the exporter is only used in non-comparison mode.

func (*ResultExporter) Export added in v0.0.16

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.

By default it completes successfully on the first divergence, uploading a DivergenceReport alongside the comparison pages. In survey mode (cfg.ContinueOnDivergence) a divergence never halts the run: the comparison tails the chain until the context is cancelled, and a clean cancellation completes the task — being stopped is the survey's natural end, not a failure.

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 SignAndBroadcastInput added in v0.0.50

type SignAndBroadcastInput struct {
	ChainID string
	KeyName string
	Msg     sdk.Msg

	// Fees is a coin-string in usei. Non-usei denoms are rejected Terminal.
	Fees string

	Gas  uint64
	Memo string

	// TaskID is appended to the on-chain memo so operators can grep the
	// chain by task. See appendTaskIDToMemo.
	TaskID string
}

SignAndBroadcastInput is the shared input contract for every sign-tx handler. Msg stays as sdk.Msg so the helper never grows a per-msg switch.

type SignAndBroadcastResult added in v0.0.50

type SignAndBroadcastResult struct {
	TxHash        string    `json:"txHash"`
	Height        int64     `json:"height"`
	Code          uint32    `json:"code"`
	Codespace     string    `json:"codespace,omitempty"`
	RawLog        string    `json:"rawLog,omitempty"`
	GasWanted     int64     `json:"gasWanted"`
	GasUsed       int64     `json:"gasUsed"`
	Sequence      uint64    `json:"sequence"`
	AccountNumber uint64    `json:"accountNumber"`
	ChainID       string    `json:"chainId"`
	BroadcastedAt time.Time `json:"broadcastedAt"`
	// ProposalID is parsed from the committed tx's submit_proposal event; 0
	// for votes, non-gov txs, or a not-yet-included tx.
	ProposalID uint64 `json:"proposalId,omitempty"`
	// IncludedAt is nil when inclusion polling timed out after a
	// successful broadcast. nil means UNDETERMINED — the tx may still
	// land later. It does NOT mean "not included". Callers must
	// re-query the chain to determine final state.
	IncludedAt *time.Time `json:"includedAt,omitempty"`
}

SignAndBroadcastResult is the shared output contract. Sign-tx handlers extend it with type-specific fields after this function returns.

func SignAndBroadcast added in v0.0.50

SignAndBroadcast is the entry point each sign-tx handler calls. It resolves the signer from the in-memory keyring, wires the production txClient, and delegates to signAndBroadcast for the full validate + guard + sign + broadcast + poll cycle.

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. It lists objects under the chain's state-sync prefix and picks the highest snapshot height; when targetHeight > 0, the search is capped at that height.

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 SnapshotUploadResult added in v0.0.66

type SnapshotUploadResult struct {
	Outcome    UploadOutcome `json:"outcome"`
	NoopReason NoopReason    `json:"noopReason,omitempty"`
	Height     int64         `json:"height,omitempty"`
	Key        string        `json:"key,omitempty"`
}

SnapshotUploadResult is the structured result both handlers return through the engine so a one-shot poller can distinguish uploaded / noop / error: an error return carries Outcome=OutcomeError alongside the error string. On the loop path it is discarded; the engine persists it on TaskResult.Result for the one-shot path.

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, error)

NewSnapshotUploader creates an uploader targeting the given home directory. Bucket, region, and chainID are read from environment at construction time and rejected here if empty so the caller fails fast rather than entering runLoop and uploading nothing forever.

func (*SnapshotUploader) EmitStartupMetrics added in v0.0.66

func (u *SnapshotUploader) EmitStartupMetrics()

EmitStartupMetrics re-emits the last-uploaded gauges from persisted state so a restarted sidecar does not report a false-stale reading before its first run. The last-run-success gauge is deliberately left unset: it is the "no clean run in N hours" alert signal, and re-emitting a persisted timestamp there would mask a genuinely stalled uploader after a restart.

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) OnceHandler added in v0.0.66

func (u *SnapshotUploader) OnceHandler(timeout time.Duration) engine.TaskHandler

OnceHandler returns an engine.TaskHandler for the one-shot snapshot-upload task. It runs Upload exactly once and returns the structured result so the task reaches a real terminal (completed with an outcome, or failed with the error). The execution is bounded by a handler-internal deadline so a wedged S3 stream fails cleanly rather than stranding the task in 'running'. The deadline lives on a child context: it surfaces as context.DeadlineExceeded, which the engine persists as Failed (its cancellation-suppression guard keys only on context.Canceled).

func (*SnapshotUploader) Upload

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 rpc.HTTPDoer) *StateSyncConfigurer

NewStateSyncConfigurer creates a configurer targeting the given home directory.

func (*StateSyncConfigurer) Configure

Configure determines the state-sync light-client witnesses, queries one for a trust point, and writes the settings to config.toml.

Witnesses come from p.RpcServers when provided, otherwise are derived from persistent-peers. Only witnesses that answer /status are written: a peer that serves P2P but not RPC (e.g. an external P2P NLB hostname) would otherwise make seid exit on "no witnesses connected" and crashloop. With UseLocalSnapshot the trust height comes from the restored snapshot instead of a query.

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"`
	// RpcServers are explicit light-client witness endpoints ("host:port").
	// When non-empty they are used verbatim; otherwise witnesses are derived
	// from persistent-peers.
	RpcServers []string `json:"rpcServers"`
}

StateSyncRequest groups the caller-provided parameters for state-sync configuration.

type StopSeider added in v0.0.64

type StopSeider struct {
	// contains filtered or unexported fields
}

StopSeider SIGTERMs the co-located seid process and confirms it exited, then returns — unlike restart-seid it never waits for seid to come back up. The kubelet restarts the container and the start gate parks it (healthz 503) once the readiness flag is false. This is the hold's stop step: pair it with a prior mark-not-ready so the restarted container blocks at the gate instead of booting onto the data directory reset-data is about to clear.

func NewStopSeider added in v0.0.64

func NewStopSeider() *StopSeider

NewStopSeider builds a StopSeider with the real /proc + syscall + local-RPC implementations, sharing restart-seid's graceful-stop core and grace window.

func (*StopSeider) Handler added in v0.0.64

func (s *StopSeider) Handler() engine.TaskHandler

Handler returns an engine.TaskHandler for the stop-seid task type. Params are empty: stop-seid is a fire-and-confirm operation.

type TerminalError added in v0.0.50

type TerminalError struct {
	Err error
}

TerminalError marks a sign-tx error as non-retryable (malformed input, chain-confusion, CheckTx rejection, missing key). The engine has no retry policy yet, but callers should not implement ad-hoc retry on top.

func (*TerminalError) Error added in v0.0.50

func (e *TerminalError) Error() string

func (*TerminalError) Unwrap added in v0.0.50

func (e *TerminalError) Unwrap() error

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.

type UploadOutcome added in v0.0.66

type UploadOutcome = wire.UploadOutcome

UploadOutcome and NoopReason are the snapshot-upload result-wire contract. They live in sidecar/wire (the dependency-free contract home) and are aliased here so handler call sites and the CLI poller reference one definition.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL