Skip to content

feat: genesis ceremony client types and /v0/node-id endpoint#40

Merged
bdchatham merged 3 commits intomainfrom
feat/genesis-ceremony-client-types
Mar 25, 2026
Merged

feat: genesis ceremony client types and /v0/node-id endpoint#40
bdchatham merged 3 commits intomainfrom
feat/genesis-ceremony-client-types

Conversation

@bdchatham
Copy link
Copy Markdown
Contributor

@bdchatham bdchatham commented Mar 25, 2026

Summary

  • Add four genesis ceremony task builder types (GenerateIdentityTask, GenerateGentxTask, UploadGenesisArtifactsTask, AssembleAndUploadGenesisTask) implementing the TaskBuilder interface for controller-side plan construction
  • Add GET /v0/node-id server endpoint that derives the Tendermint node ID from node_key.json using CometBFT-compatible SHA256(ed25519_pubkey)[:20]
  • Add GetNodeID() client method for the controller to collect node IDs during peer assembly
  • Refactor SidecarClient to store baseURL and doer for direct HTTP calls outside the OpenAPI-generated client

These are the seictl-side prerequisites for the network deployment genesis ceremony feature in sei-k8s-controller. Task handlers (the actual generate-identity, generate-gentx, etc. implementations) will follow in a subsequent PR.

Design decisions

  • AccountBalance is a single string (e.g. "1000000usei,1000000uusdc"), not a list of address+amount pairs. Each node discovers its own address during identity generation -- no cross-node coordination needed between the identity and gentx steps.
  • /v0/node-id is outside the OpenAPI spec since it is a simple read from disk, not a task. The client uses a direct HTTP call rather than the generated client.
  • Node ID derivation matches CometBFT exactly: hex(SHA256(ed25519_pubkey)[:20]), reading the 32-byte public key from the last half of the 64-byte Ed25519 private key in node_key.json.

Test plan

  • All existing server tests pass (updated NewServer calls to include homeDir)
  • All existing client tests pass
  • go build ./... clean
  • Validate task builder ToTaskRequest() output matches expected wire format

Add client-side task builder types and server endpoint needed by the
sei-k8s-controller genesis ceremony flow.

Client types (sidecar/client/tasks.go):
- GenerateIdentityTask: creates validator keys and node ID
- GenerateGentxTask: creates gentx with self-funded account balance
- UploadGenesisArtifactsTask: uploads identity + gentx to S3
- AssembleAndUploadGenesisTask: assembles final genesis from per-node artifacts

Server endpoint (sidecar/server/server.go):
- GET /v0/node-id: derives Tendermint node ID from node_key.json using
  CometBFT-compatible SHA256(ed25519_pubkey)[:20] derivation

Client method (sidecar/client/client.go):
- GetNodeID(): queries /v0/node-id for controller peer collection
- Store baseURL and doer on SidecarClient for direct HTTP calls
  outside the OpenAPI-generated client
- Add exported TaskType constants for genesis ceremony task types
  (TaskTypeGenerateIdentity, TaskTypeGenerateGentx,
  TaskTypeUploadGenesisArtifacts, TaskTypeAssembleGenesis)
- Use constants from TaskType() methods instead of raw strings
- Remove section divider comment (CLAUDE.md: no decoration comments)
- Name Ed25519 key size magic numbers in handleNodeID
@bdchatham bdchatham force-pushed the feat/genesis-ceremony-client-types branch from 7b8ef28 to 234f602 Compare March 25, 2026 15:45
@bdchatham bdchatham marked this pull request as ready for review March 25, 2026 15:50
Cover handleNodeID server handler (real Ed25519 key via writeTestNodeKey
helper) and GetNodeID client method (OK, server error, empty response).
bdchatham added a commit to sei-protocol/sei-k8s-controller that referenced this pull request Mar 25, 2026
Add group-level genesis ceremony support to SeiNodeGroup and per-node
genesis configuration to SeiNode/ValidatorSpec. The node controller
builds the full Init plan upfront (no deferred steps) and the group
controller coordinates assembly, peer collection, and static peer
injection.

New CRD types: GenesisCeremonyConfig, GenesisCeremonyNodeConfig,
GenesisS3Destination, GenesisS3Source. New group status fields:
AssemblyPlan, GenesisHash, GenesisS3URI.

Depends on seictl genesis ceremony client types (sei-protocol/seictl#40).
@bdchatham bdchatham merged commit 8016d84 into main Mar 25, 2026
2 checks passed
@bdchatham bdchatham deleted the feat/genesis-ceremony-client-types branch March 25, 2026 16:16
bdchatham added a commit to sei-protocol/sei-k8s-controller that referenced this pull request Mar 26, 2026
…ner packages (#26)

* feat: genesis ceremony controller orchestration

Add group-level genesis ceremony support to SeiNodeGroup and per-node
genesis configuration to SeiNode/ValidatorSpec. The node controller
builds the full Init plan upfront (no deferred steps) and the group
controller coordinates assembly, peer collection, and static peer
injection.

New CRD types: GenesisCeremonyConfig, GenesisCeremonyNodeConfig,
GenesisS3Destination, GenesisS3Source. New group status fields:
AssemblyPlan, GenesisHash, GenesisS3URI.

Depends on seictl genesis ceremony client types (sei-protocol/seictl#40).

* chore: regenerate deepcopy for genesis ceremony types

* fix: resolve lint issues in genesis ceremony code

- Fix gofmt alignment in SeiNodeGroupPhase and genesis constants
- Fix goimports grouping (seictl is external, not local)
- Replace interface{} with any (modernize)
- Remove deprecated result.Requeue usage
- Suppress unused params in pollAssemblyTask stub (PR-3)

* refactor: simplify group lifecycle and rename AssemblyPlan to InitPlan

- Remove GroupPhaseGenesisCeremony — genesis work runs during the
  existing Initializing phase, keyed off spec.genesis != nil
- Rename AssemblyPlan to InitPlan for consistency with node-level
  naming and to avoid scoping the field to assembly-only workloads
- Move design docs from tide/ to .tide/, remove tide/ and docs/

* refactor: remove genesis PreInit, merge all tasks into InitPlan

Remove the genesis-specific PreInit Job (sleep infinity + copy-seid),
handleGenesisPreInitComplete, and all isGenesisCeremonyNode branches in
pre_init.go and job.go. Genesis nodes now skip PreInit entirely.

The full genesis InitPlan includes: generate-identity, generate-gentx,
upload-genesis-artifacts, await-genesis-assembly (barrier), then the
standard configure-genesis, config-apply, discover-peers, config-validate,
mark-ready sequence.

WIP: executePlan still uses the old submit/poll model. Next step is the
TaskExecutionInterface refactor to support the await barrier natively.

* refactor: extract task execution into internal/task and internal/planner packages

Restructure the task execution architecture to make tasks self-contained
with embedded parameters and deterministic IDs, eliminating the need for
planners at execution time.

Key changes:
- Create internal/task/ package with TaskExecution interface, SidecarClient
  interface, Deserialize factory, and domain-grouped param types (bootstrap,
  config, genesis)
- Create internal/planner/ package with NodePlanner interface, per-mode
  planners (validator, full, archive, replay), bootstrap plan builders,
  and stateless Executor
- PlannedTask CRD gains ID (deterministic UUID v5) and Params
  (apiextensionsv1.JSON), drops TaskID and PlannedTaskSubmitted
- Executor uses task.Deserialize + Status/Execute pattern with
  MergeFromWithOptimisticLock for all status patches
- Remove sync.Map from SeiNodeReconciler, wire planner.Executor
- Delete 7 files from controller/node/, net reduction of ~400 lines

* fix: resolve CI failures — bump seictl to v0.0.21, define await-genesis-assembly locally

- Upgrade seictl dependency from v0.0.20 to v0.0.21 to pick up genesis
  ceremony client types (GenerateIdentity, GenerateGentx, etc.)
- Define TaskTypeAwaitGenesisAssembly as a local constant since it is a
  controller-managed task with no sidecar handler
- Suppress deprecated GetEventRecorderFor warnings surfaced by transitive
  dependency update
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant