Note
Terra Classic uses the Cosmos SDK capability keeper to isolate IBC, wasm, and tax sub-modules. The Classic application seals the keeper during boot to prevent capability leakage and preserve deterministic middleware ordering.
Role in Terra Classic
x/capabilityCopy x/capability provides scoped capability sub-keepers to modules that interact with external systems:
- x/ibcCopy x/ibc and x/transferCopy x/transfer claim channel and port capabilities.
- ibc-hooksCopy ibc-hooks registers wasm callback scopes for contract-triggered IBC packets.
- x/wasmCopy x/wasm inherits a scoped keeper to bind contract callbacks safely.
Once the Terra app creates all scoped keepers in app/keepers/keepers.goCopy app/keepers/keepers.go, it seals the main keeper (InitializeAndSealCopy InitializeAndSeal) to prevent additional scopes from being created at runtime. This protects against modules trying to access foreign capabilities.
State
- KV store: retains the global capability index and owners mapping.
- Memory store: caches active capability pointers for fast lookup.
State keys mirror Cosmos SDK defaults (capability/typesCopy capability/types). Classic does not modify the data structure.
Initialization flow
- Instantiate capability.KeeperCopy capability.Keeper with persistent and in-memory store keys.
- Create scoped keepers for IBC core, transfer, wasm, dyncomm, and other modules.
- Call InitializeAndSealCopy InitializeAndSeal after loading state to populate the in-memory cache and lock the keeper.
Notes for integrators
- Creating a new module that needs capability access requires wiring through app/keepers/keepers.goCopy app/keepers/keepers.go before sealing.
- Governance proposals cannot add new scopes without a software upgrade, ensuring deterministic capability ownership.