Skip to content

Commit 299613c

Browse files
authored
Remove IBC leftovers and delete retired IBC stores at v6.8 (#4337)
After the IBC modules were unwired, the chain still carried their leftovers: the `capability`, `ibc` and `transfer` stores stayed mounted, `app/retiredibc` intercepted `/store/ibc/*` raw queries and kept decode-only codecs for the historical `/ibc.core.client.v1.*` governance proposals, the transfer module account kept minter/burner permissions, and seidb tooling and docs still listed the IBC stores. IBC is never coming back, so none of this compatibility layer should survive. This PR removes that layer and cleans the persisted state at the v6.8 boundary. The `capability`, `ibc` and `transfer` stores are unmounted from both `app.App` and the wasmd test app and are deleted alongside `oracle` through the v6.8 `UpgradeStoreLoader`, with their module-version entries dropped by the handler. Mainnet holds four passed IBC governance proposals whose `Any` content can no longer be decoded once the codecs go, which would break `IterateProposals` and genesis export, so `rewriteRetiredIBCProposals` rewrites any proposal with a `/ibc.` type URL in place as a `TextProposal`, reading title and description from the raw protobuf bytes with `protowire` and leaving IDs, status, deposits, votes and queue entries untouched. `pruneUpgradedIBCState` removes the `upgradedIBCState/*` keys from the upgrade store. Bank balances and supply are deliberately not touched: the 96 `ibc/*` voucher denominations on mainnet remain ordinary bank coins. Two things are kept on purpose. The IBC precompile at `0x1009` stays registered, in both the regular and Giga fail-fast engines, as a tombstone that reverts every call, because deleting it would turn the address into an empty account where low-level calls succeed and value gets stranded. The deterministic `transfer` module address stays in the bank blocked-address set through `retiredModuleAccounts`, without any module or permissions behind it, so nothing can be sent to an account no key or module can spend from. This is a consensus-affecting state migration and reviewers should focus on the v6.8 handler and the store loader. Coverage is in `app/upgrade_v68_test.go` (module versions, proposal rewrite, upgrade-state pruning, second application is a no-op) and the offline v6.8 source/target fixtures, which seed the four deleted stores, an IBC proposal, an upgraded-IBC-state key and an `ibc/*` voucher, then assert physical tree deletion after reopen, crash/replay hash equality, the rewritten proposal, the pruned keys, a successful post-upgrade bank send of the voucher, and that every other key of the retained `bank`, `gov` and `upgrade` stores is unchanged apart from the entries the upgrade block is specified to touch. `make upgrade-test`, `make upgrade-test-vet`, `make upgrade-test-offline FROM_REF=release/v6.7` and `make lint` pass. The proposal rewrite runs before `RunMigrations` so no module migration can walk the gov store while the four `/ibc.core.client.v1.ClientUpdateProposal` records are still undecodable. It keeps title and description and drops the client fields, recorded here so the loss is explicit rather than silent: proposal 52 `subject_client_id=07-tendermint-44` `substitute_client_id=07-tendermint-112`; 81 `07-tendermint-120` / `07-tendermint-131`; 100 `07-tendermint-135` / `07-tendermint-146`; 119 `07-tendermint-12` / `07-tendermint-168`. After this upgrade v6.8 nodes cannot answer gov state queries at pre-v6.8 heights for those four proposals, nor any other pre-retirement IBC history; that is served by v6.6 freeze nodes, and the README states so.
1 parent 7f94d23 commit 299613c

31 files changed

Lines changed: 619 additions & 1589 deletions

‎README.md‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ For the most up to date documentation please visit https://www.docs.sei.io/
1212

1313
Developer reference in this repo: [EVM JSON-RPC explicitly unsupported methods](docs/evm_jsonrpc_unsupported.md) (methods that return `-32000` with a clear message).
1414

15-
Starting with v6.7, IBC module source and wiring are removed. IBC queries, historical transfer transaction decoding, and pre-v6.7 IBC precompile tracing are not served by v6.7 nodes. Run a v6.6 freeze node to serve pre-v6.7 IBC history.
16-
See [IBC retirement](docs/ibc_retirement.md) for the retained CosmWasm and state behavior.
15+
Starting with v6.7, IBC module source and wiring are removed. IBC queries, historical transfer transaction decoding, and pre-v6.7 IBC precompile tracing are not served by v6.7 nodes. Run a v6.6 freeze node to serve pre-v6.7 IBC history. The IBC precompile at `0x1009` remains registered only as a tombstone that reverts every call. Starting with v6.8, the `ibc`, `transfer` and `capability` stores are deleted from state, and the four passed `ClientUpdateProposal` records (proposals 52, 81, 100 and 119) are rewritten as `TextProposal`s keeping their title and description; v6.8 nodes cannot answer gov state queries at pre-v6.8 heights for those records, use a v6.6 freeze node. CosmWasm IBC entry points, messages and queries are still compiled into `sei-wasmd` but have no IBC module behind them; they go away with the CosmWasm teardown.
1716

1817
# Sei Optimizations
1918
Sei introduces four major innovations:

‎app/abci_test.go‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import (
77
"testing"
88
"time"
99

10+
sdkerrors "github.com/sei-protocol/sei-chain/sei-cosmos/types/errors"
11+
1012
"github.com/sei-protocol/sei-chain/app/migration"
1113
abci "github.com/sei-protocol/sei-chain/sei-tendermint/abci/types"
1214
tmproto "github.com/sei-protocol/sei-chain/sei-tendermint/proto/tendermint/types"
@@ -170,9 +172,9 @@ func TestIBCStoreQueriesAreUnavailable(t *testing.T) {
170172
t.Run(path, func(t *testing.T) {
171173
response, err := testApp.Query(context.Background(), &abci.RequestQuery{Path: path})
172174
require.NoError(t, err)
173-
require.Equal(t, "ibc", response.Codespace)
174-
require.Equal(t, uint32(103), response.Code)
175-
require.Equal(t, "ibc module is deprecated", response.Log)
175+
require.True(t, response.IsErr())
176+
require.Equal(t, sdkerrors.ErrUnknownRequest.Codespace(), response.Codespace)
177+
require.Equal(t, sdkerrors.ErrUnknownRequest.ABCICode(), response.Code)
176178
})
177179
}
178180

‎app/app.go‎

Lines changed: 15 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ import (
8989
upgradeclient "github.com/sei-protocol/sei-chain/sei-cosmos/x/upgrade/client"
9090
upgradekeeper "github.com/sei-protocol/sei-chain/sei-cosmos/x/upgrade/keeper"
9191
upgradetypes "github.com/sei-protocol/sei-chain/sei-cosmos/x/upgrade/types"
92-
storekeys "github.com/sei-protocol/sei-chain/sei-db/common/keys"
9392
seidb "github.com/sei-protocol/sei-chain/sei-db/db_engine/types"
9493
"github.com/sei-protocol/seilog"
9594
"golang.org/x/sync/errgroup"
@@ -101,8 +100,6 @@ import (
101100
"github.com/sei-protocol/sei-chain/app/legacyabci"
102101
"github.com/sei-protocol/sei-chain/app/migration"
103102
appparams "github.com/sei-protocol/sei-chain/app/params"
104-
"github.com/sei-protocol/sei-chain/app/retiredibc"
105-
retiredibcgov "github.com/sei-protocol/sei-chain/app/retiredibc/gov"
106103
"github.com/sei-protocol/sei-chain/app/retiredoracle"
107104
"github.com/sei-protocol/sei-chain/app/upgrades"
108105
v0upgrade "github.com/sei-protocol/sei-chain/app/upgrades/v0"
@@ -221,7 +218,6 @@ var (
221218
stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking},
222219
stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking},
223220
govtypes.ModuleName: {authtypes.Burner},
224-
transferModuleName: {authtypes.Minter, authtypes.Burner},
225221
wasm.ModuleName: {authtypes.Burner},
226222
evmtypes.ModuleName: {authtypes.Minter, authtypes.Burner},
227223
tokenfactorytypes.ModuleName: {authtypes.Minter, authtypes.Burner},
@@ -230,6 +226,11 @@ var (
230226

231227
allowedReceivingModAcc = map[string]bool{}
232228

229+
// retiredModuleAccounts are module accounts whose modules no longer exist
230+
// but whose deterministic addresses stay blocked so funds cannot be sent
231+
// to an account nothing can sign for.
232+
retiredModuleAccounts = []string{"transfer"}
233+
233234
// kvStoreKeyNames is the canonical, in-order list of module KV store
234235
// names mounted on the SeiDB / memiavl backend. It is the single source
235236
// of truth consumed by sdk.NewKVStoreKeys in app.New, and is cross-
@@ -239,8 +240,8 @@ var (
239240
kvStoreKeyNames = []string{
240241
authtypes.StoreKey, authzkeeper.StoreKey, banktypes.StoreKey, stakingtypes.StoreKey,
241242
minttypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey,
242-
govtypes.StoreKey, paramstypes.StoreKey, storekeys.IBCStoreKey, upgradetypes.StoreKey, feegrantModuleName,
243-
evidencetypes.StoreKey, transferModuleName, capabilityModuleName,
243+
govtypes.StoreKey, paramstypes.StoreKey, upgradetypes.StoreKey, feegrantModuleName,
244+
evidencetypes.StoreKey,
244245
evmtypes.StoreKey, wasm.StoreKey,
245246
epochmoduletypes.StoreKey,
246247
tokenfactorytypes.StoreKey,
@@ -275,11 +276,9 @@ var (
275276
)
276277

277278
const (
278-
MinGasEVMTx = 21000
279-
capabilityModuleName = "capability"
280-
feegrantModuleName = "feegrant"
281-
transferModuleName = "transfer"
282-
vestingModuleName = "vesting"
279+
MinGasEVMTx = 21000
280+
feegrantModuleName = "feegrant"
281+
vestingModuleName = "vesting"
283282

284283
// NewHeadsNotifierCapacity bounds the in-process eth_newHeads
285284
// notifier buffer. Capacity 1 pairs with the notifier's
@@ -457,14 +456,6 @@ type App struct {
457456
GigaOCCEnabled bool
458457
}
459458

460-
// Query handles ABCI queries without exposing retired IBC stores.
461-
func (app *App) Query(ctx context.Context, req *abci.RequestQuery) (*abci.ResponseQuery, error) {
462-
if response := retiredibc.QueryResponse(req.Path); response != nil {
463-
return response, nil
464-
}
465-
return app.BaseApp.Query(ctx, req)
466-
}
467-
468459
type AppOption func(*App)
469460

470461
// New returns a reference to an initialized blockchain app
@@ -781,7 +772,6 @@ func New(
781772
// register the proposal types
782773
govRouter := govtypes.NewRouter()
783774
govRouter.AddRoute(govtypes.RouterKey, govtypes.ProposalHandler).
784-
AddRoute(retiredibcgov.RouterKey, retiredibcgov.ProposalHandler).
785775
AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.ParamsKeeper)).
786776
AddRoute(distrtypes.RouterKey, distr.NewCommunityPoolSpendProposalHandler(app.DistrKeeper)).
787777
AddRoute(upgradetypes.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(app.UpgradeKeeper)).
@@ -1140,7 +1130,7 @@ func (app *App) SetStoreUpgradeHandlers() {
11401130

11411131
if upgradeInfo.Name == "v6.8" && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) {
11421132
storeUpgrades := storetypes.StoreUpgrades{
1143-
Deleted: []string{retiredoracle.ModuleName},
1133+
Deleted: v68DeletedStores,
11441134
}
11451135
app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades))
11461136
}
@@ -1169,14 +1159,7 @@ func (app *App) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci.Res
11691159
}
11701160
}
11711161
app.UpgradeKeeper.SetModuleVersionMap(ctx, app.mm.GetVersionMap())
1172-
response := app.mm.InitGenesis(ctx, app.appCodec, genesisState, app.genesisImportConfig)
1173-
app.initializeRetiredTransferModuleAccount(ctx)
1174-
return response
1175-
}
1176-
1177-
// initializeRetiredTransferModuleAccount materializes the retained transfer module account during genesis.
1178-
func (app *App) initializeRetiredTransferModuleAccount(ctx sdk.Context) {
1179-
app.AccountKeeper.GetModuleAccount(ctx, transferModuleName)
1162+
return app.mm.InitGenesis(ctx, app.appCodec, genesisState, app.genesisImportConfig)
11801163
}
11811164

11821165
func (app *App) GetOptimisticProcessingInfo() OptimisticProcessingInfo {
@@ -2433,6 +2416,9 @@ func (app *App) ModuleAccountAddrs() map[string]bool {
24332416
for acc := range maccPerms {
24342417
modAccAddrs[authtypes.NewModuleAddress(acc).String()] = true
24352418
}
2419+
for _, acc := range retiredModuleAccounts {
2420+
modAccAddrs[authtypes.NewModuleAddress(acc).String()] = true
2421+
}
24362422

24372423
return modAccAddrs
24382424
}

‎app/encoding.go‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package app
22

33
import (
44
"github.com/sei-protocol/sei-chain/app/params"
5-
retiredibcgov "github.com/sei-protocol/sei-chain/app/retiredibc/gov"
65
"github.com/sei-protocol/sei-chain/app/retiredoracle"
76
"github.com/sei-protocol/sei-chain/app/retiredvesting"
87
"github.com/sei-protocol/sei-chain/sei-cosmos/std"
@@ -15,7 +14,6 @@ func MakeEncodingConfig() params.EncodingConfig {
1514
std.RegisterInterfaces(encodingConfig.InterfaceRegistry)
1615
ModuleBasics.RegisterLegacyAminoCodec(encodingConfig.Amino)
1716
ModuleBasics.RegisterInterfaces(encodingConfig.InterfaceRegistry)
18-
retiredibcgov.RegisterInterfaces(encodingConfig.InterfaceRegistry)
1917
retiredoracle.RegisterInterfaces(encodingConfig.InterfaceRegistry)
2018
retiredoracle.RegisterLegacyAminoCodec(encodingConfig.Amino)
2119
retiredvesting.RegisterInterfaces(encodingConfig.InterfaceRegistry)
@@ -29,7 +27,6 @@ func MakeLegacyEncodingConfig() params.EncodingConfig {
2927
std.RegisterInterfaces(encodingConfig.InterfaceRegistry)
3028
ModuleBasics.RegisterLegacyAminoCodec(encodingConfig.Amino)
3129
ModuleBasics.RegisterInterfaces(encodingConfig.InterfaceRegistry)
32-
retiredibcgov.RegisterInterfaces(encodingConfig.InterfaceRegistry)
3330
retiredoracle.RegisterInterfaces(encodingConfig.InterfaceRegistry)
3431
retiredoracle.RegisterLegacyAminoCodec(encodingConfig.Amino)
3532
retiredvesting.RegisterInterfaces(encodingConfig.InterfaceRegistry)

‎app/retiredibc/gov/codec.go‎

Lines changed: 0 additions & 22 deletions
This file was deleted.

‎app/retiredibc/gov/proposal.go‎

Lines changed: 0 additions & 114 deletions
This file was deleted.

0 commit comments

Comments
 (0)