feat(sidecar/assemble-genesis): apply spec.genesis.overrides to assembled genesis.json#181
Merged
Merged
Conversation
…bled genesis.json Extends AssembleGenesisRequest with an Overrides map (dotted-path key to json.RawMessage value) and applies it to the final genesis.json after collect-gentxs runs and before the upload step. The first dotted segment selects a top-level key in app_state (the cosmos module); subsequent segments walk into that module's JSON tree and replace the leaf verbatim. The new helper applyGenesisOverrides lives in sidecar/tasks/ genesis_overrides.go alongside unit coverage for happy paths (string / number / object leaves, deep nesting, multi-module, missing intermediate), idempotency, and error surfaces (empty key, single-token key, trailing/double dot, empty value, unknown module, non-object intermediate via scalar or array). assemble_genesis_test.go gains disk-level coverage that the genesis.json on disk actually changes after applyOverrides and that bad keys bubble through to the task error. Also removes the dead GenesisParams field from GenerateGentxRequest and its client-side mirror; the feature it reserved is now the dedicated Overrides path on the SND-level assemble task. Motivation: SIP-3 testing needs a fresh chain with staking.params.unbonding_time = 600s instead of the cosmos default 21 days. Companion controller-side change in sei-k8s-controller wires SeiNodeDeployment.spec.genesis.overrides into this request.
|
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. |
4 tasks
bdchatham
added a commit
that referenced
this pull request
May 18, 2026
Release the genesis-overrides feature (PR #181) plus the other six commits that have accumulated since v0.0.49: trusted-header authn (#179), gov-software-upgrade handler (#177), gov-vote handler (#175), `/tx?hash=` discriminator hardening (#173), sign-tx foundation (#170), production keyring backend (#168). The Releaser workflow (.github/workflows/uci-release-publish.yml) triggers on push to version.json and tags this commit as v0.0.50.
This was referenced May 18, 2026
bdchatham
added a commit
that referenced
this pull request
May 18, 2026
## Summary Closes #183. Adds a dedicated `seictl nd apply --genesis-override <key>=<value>` flag that writes flat dotted-key entries into `spec.genesis.overrides` on the rendered SeiNodeDeployment. Mirrors the existing `--override` flag (which targets `spec.template.spec.overrides`). ## Why `spec.genesis.overrides` (shipped this morning via #181 + sei-k8s-controller#270) requires a flat `map[string]<JSON>` with dotted cosmos-module keys (`"staking.params.unbonding_time": "600s"`). The sidecar's `applyGenesisOverrides` enforces this: keys must be `module.field[.field...]`, first segment must be a cosmos module in `app_state`. `seictl --set spec.genesis.overrides.<path>=<value>` cannot emit that shape — `--set`'s path parser splits unconditionally on `.` and builds a nested map. Today's first attempt at the field (sei-protocol/harbor-engineering-workspace#14) shipped the nested-map shape and the sidecar rejected it on every retry with `key "app_state" must be of the form module.field[.field...]`. Required a manual `yq`-patching workaround (sei-protocol/harbor-engineering-workspace#16). ## What this PR does ```sh seictl nd apply <name> --preset genesis-chain \ --chain-id <id> --image <ref> \ --genesis-override staking.params.unbonding_time=600s \ --genesis-override bank.params.default_send_enabled=true \ --genesis-override gov.params.voting_period_seconds=120 \ --genesis-override mint.params.inflation='{"min":0.05,"max":0.2}' \ -n eng-<alias> ``` Renders: ```yaml spec: genesis: overrides: "staking.params.unbonding_time": "600s" "bank.params.default_send_enabled": true "gov.params.voting_period_seconds": 120 "mint.params.inflation": min: 0.05 max: 0.2 ``` - Keys are stored as literal map-key strings — no path splitting - Values parse as JSON when they parse (numbers, bools, objects, arrays); otherwise as raw strings - Local key-shape validation (`module.field[.field...]`) fails fast at apply time rather than after the SND has stalled - Rejected when `--preset != genesis-chain` (rpc preset has no `spec.genesis`) - Repeatable, distinct from `--override` ## Tests - `TestRender_GenesisOverrideFlag` — string / bool / number / object values all round-trip correctly through the renderer - `TestRender_GenesisOverrideRejectsNonGenesisPreset` - `TestApplyGenesisOverride_Errors` — missing `=`, empty key, single-segment key, empty path segment - `TestApplyGenesisOverride_PreservesExistingKeys` — multiple flag uses accumulate into one map `make test` passes. ## Follow-ups After this releases (v0.0.51?), the harbor-dev skill docs in sei-protocol/Tide get a follow-up PR that replaces the manual-`yq` workaround with the canonical `--genesis-override` invocation. Will land separately. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
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
SIP-3 testing needs a fresh test cluster whose
staking.params.unbonding_timeis600s, not the cosmos default of 21 days. The controller already acceptsSeiNodeDeployment.spec.genesis.overridesand propagates them through, but the sidecar was dropping them on the floor at the assemble-genesis step. This PR closes that gap.Wire contract
AssembleGenesisRequestgains:Keys are dotted snake_case paths into
genesis.app_state. The first segment is the cosmos module name (a top-level key inapp_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:staking.params.unbonding_time"600s"gov.params.max_deposit_period"60s"staking.params.max_validators50gov.params.voting_params{"voting_period":"60s","quorum":"0.4"}Validator-side flow change
GenesisAssembler.Handler()order is now:Overrides are applied after collect-gentxs so any validator-derived state and persistent peers baked in by
genutil.GenAppStateFromConfigare already in place — the override step is an in-place JSON patch on the final assembledgenesis.json.Design anchors (from the coral round)
FailedTaskDetailon the owningSeiNodeDeploymentrather than as a silently-ignored field.InitGenesis.Other changes
GenesisParamsfield fromGenerateGentxRequestand its client-side mirror. The "reserved for future genesis customization" comment is now the dedicatedOverridespath on the SND-level assemble task.applyGenesisOverrideslives insidecar/tasks/genesis_overrides.go;GenesisAssembler.applyOverridesis the disk-I/O glue that re-readsconfig/genesis.json, calls the helper, and writes back viagenutil.ExportGenesisFile.Companion change
The controller-side wiring (populating
assembleParams.OverridesfromSeiNodeDeployment.spec.genesis.overridesininternal/planner/group.go) is being implemented in parallel insei-protocol/sei-k8s-controller. See sei-protocol/sei-k8s-controller#270.Test plan
go test ./sidecar/tasks/... -count=1passesmake testpassesmake lintcleangenesis_overrides_test.go: string/number/object leaves, deep nesting, cross-module, missing intermediate, idempotency, all error surfacesassemble_genesis_test.go:applyOverridesmutatesgenesis.jsonand bubbles bad-key errorsAssembleGenesisRequest.Overridesunbonding_time=600sand observes the resulting validator un-bonding behavior end-to-end