fork-genesis assemble: zero bonded/notBonded pool bank balances when stripping validator state

Open
#145 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
76/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
go
Domain
cli

Research direction

Start in assemble_genesis_fork.go at stripValidatorState, then read the bank and staking genesis handling referenced in the issue. Extend the existing coverage in assemble_genesis_fork_test.go:164-260 to inspect the bonded_tokens_pool and not_bonded_tokens_pool balances. Done means fork assembly leaves both pool balances at zero and seid start no longer panics during InitChain.

Written by the indexing model from the issue text.

Description

Problem

assemble_genesis_fork.go::stripValidatorState zeros validator/delegation/last_total_power state on the staking module (lines 223-284) but does NOT touch the bank balances on the bonded_tokens_pool / not_bonded_tokens_pool module accounts that the source chain's exported state carries over.

Cosmos staking InitGenesis (sei-cosmos/x/staking/genesis.go:112-126) panics if bondedTokens != sum(validator.tokens). After our fork-assembly:

  • bondedTokens = 0 (we stripped validators)
  • bonded_tokens_pool bank balance still holds whatever the source chain had

seid start panics on InitChain on the first run of the new fork.

Fix

In stripValidatorState, after zeroing staking state, also rewrite the bank module's balances array to set both pool module-account balances to zero. The module-account addresses are deterministic (auth.NewModuleAddress("bonded_tokens_pool") and auth.NewModuleAddress("not_bonded_tokens_pool")).

Related

Discovered via research dive on seid export round-trip (PR sei-protocol/sei-k8s-controller#179). Test coverage in assemble_genesis_fork_test.go:164-260 only inspects staking/slashing/distribution fields, not bank — explains why this didn't surface in unit tests.

Severity

Blocking for any fork ceremony. Fix before first prod run on pacific-1.

🤖 Generated with Claude Code

Dominant language
Go
Stars
1
Forks
3
Avg merge
2h 56m
Merged PRs (30d)
14

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from sei-protocol/seictl

All issues in sei-protocol/seictl

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.