feat(api): plumb spec.genesis.overrides to sidecar assemble-genesis task#270
Merged
Conversation
Reshape SeiNodeDeployment.spec.genesis.overrides to map[string]JSON so it can carry typed values (strings, numbers, objects) for the sidecar's genesis-defaults merge, and route it through the assemble-and-upload-genesis task at SND level. Required for SIP-3 testing, where the test cluster needs non-default cosmos params (e.g. staking.params.unbonding_time = 600s). API changes: - GenesisCeremonyConfig.Overrides: map[string]string -> map[string]apiextensionsv1.JSON - spec.genesis is now immutable after creation (CEL: self == oldSelf) - Drop dead GenesisCeremonyNodeConfig.GenesisParams (per-node JSON string that nothing consumed) Plumbing: - Planner ForGroup now copies group.Spec.Genesis.Overrides into the assemble-genesis task params; on the wire those flatten into the TaskRequest under the "overrides" key the sidecar reads. - Introduce task.AssembleAndUploadGenesisTask, a thin wrapper that embeds the upstream sidecar struct and adds the Overrides field. Mirrors the existing configApplyTask pattern. Folds back into the upstream type once the companion seictl PR releases. The value-type reshape is a CRD field rewrite; safe because no controller or sidecar today actually consumes the existing map[string]string (sidecar drops it on the floor, controller stamped it into a per-node JSON string that nothing read). Companion seictl PR: TBD (parallel) Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
You have used all Bugbot PR reviews included in your free trial for your GitHub account on this workspace. To continue using Bugbot reviews, enable Bugbot for your team in the Cursor dashboard. |
7 tasks
bdchatham
added a commit
to sei-protocol/seictl
that referenced
this pull request
May 18, 2026
…bled genesis.json (#181) ## Summary SIP-3 testing needs a fresh test cluster whose `staking.params.unbonding_time` is `600s`, not the cosmos default of 21 days. The controller already accepts `SeiNodeDeployment.spec.genesis.overrides` and propagates them through, but the sidecar was dropping them on the floor at the assemble-genesis step. This PR closes that gap. ## Wire contract `AssembleGenesisRequest` gains: ```go Overrides map[string]json.RawMessage `json:"overrides,omitempty"` ``` Keys are dotted snake_case paths into `genesis.app_state`. The first segment is the cosmos module name (a top-level key in `app_state`); subsequent segments walk into that module's JSON tree and replace the leaf verbatim. Values are raw JSON, so callers can override scalars, numbers, or whole objects: | key | value | | --- | --- | | `staking.params.unbonding_time` | `"600s"` | | `gov.params.max_deposit_period` | `"60s"` | | `staking.params.max_validators` | `50` | | `gov.params.voting_params` | `{"voting_period":"60s","quorum":"0.4"}` | ## Validator-side flow change `GenesisAssembler.Handler()` order is now: ``` downloadGentxFiles -> addMissingGenesisAccounts -> addExternalGenesisAccounts -> collectGentxs -> applyOverrides <-- new -> uploadGenesis -> uploadPeers ``` Overrides are applied **after** collect-gentxs so any validator-derived state and persistent peers baked in by `genutil.GenAppStateFromConfig` are already in place — the override step is an in-place JSON patch on the final assembled `genesis.json`. ## Design anchors (from the coral round) - Single SND-level dispatch; no per-node fan-out for overrides. - Bootstrap-only — the sidecar doesn't enforce immutability; the controller does that via CEL. - Fails loudly on bad keys (empty, single-token, trailing/double dot, empty value, unknown module, non-object intermediates) so misconfiguration surfaces as a `FailedTaskDetail` on the owning `SeiNodeDeployment` rather than as a silently-ignored field. - No cosmos-sdk module allowlist — the chain will fail loud on garbage at `InitGenesis`. ## Other changes - Drops the dead `GenesisParams` field from `GenerateGentxRequest` and its client-side mirror. The "reserved for future genesis customization" comment is now the dedicated `Overrides` path on the SND-level assemble task. - New helper `applyGenesisOverrides` lives in `sidecar/tasks/genesis_overrides.go`; `GenesisAssembler.applyOverrides` is the disk-I/O glue that re-reads `config/genesis.json`, calls the helper, and writes back via `genutil.ExportGenesisFile`. ## Companion change The controller-side wiring (populating `assembleParams.Overrides` from `SeiNodeDeployment.spec.genesis.overrides` in `internal/planner/group.go`) is being implemented in parallel in `sei-protocol/sei-k8s-controller`. See sei-protocol/sei-k8s-controller#270. ## Test plan - [x] `go test ./sidecar/tasks/... -count=1` passes - [x] `make test` passes - [x] `make lint` clean - [x] Unit coverage in `genesis_overrides_test.go`: string/number/object leaves, deep nesting, cross-module, missing intermediate, idempotency, all error surfaces - [x] Disk-level coverage in `assemble_genesis_test.go`: `applyOverrides` mutates `genesis.json` and bubbles bad-key errors - [x] Wire round-trip test for `AssembleGenesisRequest.Overrides` - [ ] Integration: SIP-3 test cluster boots with `unbonding_time=600s` and observes the resulting validator un-bonding behavior end-to-end
…0.50 Now that seictl v0.0.50 ships AssembleAndUploadGenesisTask with the Overrides map[string]json.RawMessage field natively, the temporary wrapper at internal/task/assemble_genesis.go is no longer needed. - Bump go.mod: seictl v0.0.47 -> v0.0.50 - Delete the wrapper; register sidecar.AssembleAndUploadGenesisTask directly in the deserializer registry - Planner builds the upstream task directly; new toRawMessages helper converts spec.genesis.overrides values (apiextensionsv1.JSON) to the wire type (encoding/json.RawMessage). Same raw bytes, different Go type. - Tests now unmarshal into the upstream type. Override leaf assertions read sidecar's RawMessage instead of the apiextensionsv1.JSON.Raw shape.
|
You have used all Bugbot PR reviews included in your free trial for your GitHub account on this workspace. To continue using Bugbot reviews, enable Bugbot for your team in the Cursor dashboard. |
Collaborator
Author
|
Cleanup commit pushed:
The Full test suite green; |
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
Wires user-supplied genesis parameter overrides from
SeiNodeDeployment.spec.genesis.overridesinto the sidecar'sassemble-and-upload-genesistask payload, so a fresh test cluster can boot with custom cosmos params (e.g.staking.params.unbonding_time = 600s) instead of the cosmos defaults.Motivation
SIP-3 testing requires a chain configured for fast-iteration unbonding (10 minutes vs 21 days). The CRD field
spec.genesis.overridesexisted today but was dead-end:map[string]string, which can't carry numbers, durations-as-strings, or nested cosmos param objects without forcing operators to handcraft escaped JSON.GenesisCeremonyNodeConfig.GenesisParamsJSON string that no consumer reads — the sidecar'sgenerate-gentxhandler ignores the field, and the assemble-genesis task wasn't given the overrides at all.The companion seictl PR (see "Linked work" below) extends the sidecar's
AssembleGenesisRequestwithOverrides map[string]json.RawMessage; this PR sends the matching field from the controller side.API changes
SeiNodeDeployment.spec.genesis.overridesvalue type reshaped frommap[string]stringtomap[string]apiextensionsv1.JSON. Keys remain dotted snake_case paths (cosmos-encoded), values are now arbitrary JSON.spec.genesisis now CRD-immutable after creation (CELself == oldSelf). Genesis-ceremony semantics make in-place edits meaningless; better to fail fast at the API server.GenesisCeremonyNodeConfig.GenesisParams(per-node JSON string) dropped along with the controller-sidemarshalOverrideshelper and the planner'sGenesisParams: gc.GenesisParamspropagation — all three were the dead path.Compatibility note
This is a CRD field-type reshape (map value
string-> JSON), normally a breaking change. Safe in this case because no live consumer reads the field today — the sidecar drops it, the controller stamped it onto a per-node field nothing reads. Behavior of existingSeiNodeDeploymentobjects that omitoverridesis unchanged.Wire path
task.AssembleAndUploadGenesisTaskis a thin wrapper that embeds the upstreamsidecar.AssembleAndUploadGenesisTaskand addsOverrides. Mirrors the existingconfigApplyTaskpattern. Folds back into the upstream type once seictl releases — there's no schema obligation to keep the wrapper after that.Test plan
make testpasses (added planner-level overrides-propagation + omits-when-unset assertions ininternal/planner/group_test.go)make manifests generateregeneratesmanifests/crds/sei.io_seinodedeployments.yamlwith the new CEL immutability rule andx-kubernetes-preserve-unknown-fields: trueon the overrides map valuesTestBuildGroupAssemblyPlan,TestBuildGroupAssemblyPlan_DefaultS3,TestBuildPlan_PropagatesAccounts, etc.)Linked work
Overrides map[string]json.RawMessagetoAssembleGenesisRequest: feat(sidecar/assemble-genesis): apply spec.genesis.overrides to assembled genesis.json seictl#181Co-Authored-By: Claude Opus 4.7 noreply@anthropic.com
Companion seictl PR: sei-protocol/seictl#181