keepers

package
v0.5.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 6, 2026 License: Apache-2.0 Imports: 94 Imported by: 0

Documentation

Index

Constants

View Source
const EventTypeAutoRegistrationSuppressed = "erc20_auto_registration_suppressed"

EventTypeAutoRegistrationSuppressed is the observable counterpart of the gate below: emitted when an inbound ICS-20 transfer is left as a plain bank voucher because Params.PermissionlessRegistration is off, so a suppressed registration can be told apart from a packet that never reached the registration branch.

View Source
const LegacyNFTTransferPortID = "nft-transfer"

LegacyNFTTransferPortID is the ICS-721 port this chain used before v0.4.0.

Upstream nft-transfer v1.3.0 changed types.PortID from this literal to types.ModuleName ("nonfungibletokentransfer"), because ibc-go v10 dropped the capability-based port to module binding: the receiving module is now looked up from the packet's port alone (core/keeper/msg_server.go:438 for RecvPacket, :503/:552/:605 for acknowledgements and timeouts), and the port router refuses any route key that is not alphanumeric (core/05-port/types/router.go:44, sdk.IsAlphaNumeric).

The channels opened under the old name are still in the IBC core channel store, so without a route for them every packet on an existing nft-transfer/* channel fails with ErrInvalidRoute - including the acknowledgement and timeout callbacks that unescrow the sender's NFT, which strands that NFT for good.

Variables

This section is empty.

Functions

func GetWasmCapabilities

func GetWasmCapabilities() []string

Types

type AppKeepers

type AppKeepers struct {

	// keepers
	AccountKeeper       authkeeper.AccountKeeper
	BankKeeper          bankkeeper.Keeper
	StakingKeeper       *stakingkeeper.Keeper
	SlashingKeeper      slashingkeeper.Keeper
	MintKeeper          mintkeeper.Keeper
	DistrKeeper         distrkeeper.Keeper
	GovKeeper           *govkeeper.Keeper
	CrisisKeeper        *crisiskeeper.Keeper
	UpgradeKeeper       *upgradekeeper.Keeper
	ParamsKeeper        paramskeeper.Keeper
	IBCKeeper           *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly
	ICAControllerKeeper icacontrollerkeeper.Keeper
	EvidenceKeeper      *evidencekeeper.Keeper
	IBCTransferKeeper   ibctransferkeeper.Keeper
	FeeGrantKeeper      feegrantkeeper.Keeper

	ICAHostKeeper icahostkeeper.Keeper

	IBCNFTTransferKeeper ibcnfttransferkeeper.Keeper
	// InterNftKeeper is the ICS-721 adapter handed to IBCNFTTransferKeeper. It
	// is held here so the app can reach the late conversion-guard wiring below:
	// nft-transfer stores its ICS721Keeper by value and exposes no accessor.
	InterNftKeeper        internft.InterNftKeeper
	ConsensusParamsKeeper consensusparamkeeper.Keeper
	AuthzKeeper           authzkeeper.Keeper
	// cosmos/evm keepers
	EvmKeeper       *evmkeeper.Keeper
	FeeMarketKeeper feemarketkeeper.Keeper
	// ERC20 keeper (cosmos/evm v0.6.1)
	Erc20Keeper cosmoserc20keeper.Keeper

	Erc721Keeper    erc721keeper.Keeper
	Cw721Keeper     cw721keeper.Keeper
	AppminingKeeper appminingkeeper.Keeper
	EVMIBCKeeper    evmIBCKeepr.Keeper
	NFTKeeper       nftkeeper.Keeper
	// wasm keepers
	//
	// Held by value, like every other keeper in this struct. The ante handler
	// wants a *wasmkeeper.Keeper / *wasmtypes.NodeConfig, so app.go passes
	// &app.WasmKeeper / &app.WasmConfig - which only compiles because Uptick
	// embeds AppKeepers by value, making the promoted field addressable.
	// Changing these to pointers would fix that call site but touch every other
	// one, all of which read them as values.
	WasmKeeper           wasmkeeper.Keeper
	WasmConfig           wasmtypes.NodeConfig
	TransferModule       transfer.AppModule
	ICAModule            ica.AppModule
	IBCNftTransferModule nfttransfer.AppModule
	// contains filtered or unexported fields
}

AppKeepers defines a structure used to consolidate all the keepers needed to run an iris appKeepers.

func New

func New(
	appCodec codec.Codec,
	bApp *baseapp.BaseApp,
	legacyAmino *codec.LegacyAmino,
	maccPerms map[string][]string,
	modAccAddrs map[string]bool,
	blockedAddress map[string]bool,
	skipUpgradeHeights map[int64]bool,
	homePath string,
	invCheckPeriod uint,
	logger log.Logger,
	appOpts servertypes.AppOptions,
	wasmOpts []wasmkeeper.Option,

) AppKeepers

NewUptick returns a reference to a new initialized Uptick application.

func (*AppKeepers) GetKVStoreKey added in v0.4.0

func (ak *AppKeepers) GetKVStoreKey(moduleName string) *storetypes.KVStoreKey

GetKVStoreKey returns the KVStoreKey registered for the given module name. It is used by upgrade handlers to access module stores directly for raw state migrations (e.g. deleting a deprecated store prefix).

func (*AppKeepers) GetKey

func (appKeepers *AppKeepers) GetKey(storeKey string) *storetypes.KVStoreKey

GetKey returns the KVStoreKey for the provided store key.

NOTE: This is solely to be used for testing purposes.

func (*AppKeepers) GetSubspace

func (appKeepers *AppKeepers) GetSubspace(moduleName string) paramstypes.Subspace

GetSubspace returns a param subspace for a given module name.

NOTE: This is solely to be used for testing purposes.

func (*AppKeepers) KvStoreKeys

func (appKeepers *AppKeepers) KvStoreKeys() map[string]*storetypes.KVStoreKey

KvStoreKeys returns the map of string to KVStoreKey.

None. map[string]*storetypes.KVStoreKey.

func (*AppKeepers) MemoryStoreKeys

func (appKeepers *AppKeepers) MemoryStoreKeys() map[string]*storetypes.MemoryStoreKey

MemoryStoreKeys returns the map of type map[string]*storetypes.MemoryStoreKey.

No parameters. Returns a map of type map[string]*storetypes.MemoryStoreKey.

func (*AppKeepers) TransientStoreKeys

func (appKeepers *AppKeepers) TransientStoreKeys() map[string]*storetypes.TransientStoreKey

TransientStoreKeys returns the map of transient store keys.

No parameters. Returns a map[string]*storetypes.TransientStoreKey.

type ERC20IBCGate added in v0.5.0

type ERC20IBCGate struct {
	// contains filtered or unexported fields
}

ERC20IBCGate sits between the ERC20 IBC middleware and the keeper so the inbound ICS-20 callback can be gated by Params.PermissionlessRegistration. It implements cosmoserc20types.Erc20Keeper, so NewIBCMiddleware can be handed it instead of the bare keeper.

Why the gate exists. The callback creates a token pair - and with it a dynamic precompile account - for any previously unseen `ibc/` denom it is handed (cosmos/evm v0.6.2 x/erc20/keeper/ibc_callbacks.go:100):

case !found && strings.HasPrefix(coin.Denom, "ibc/"):
    tokenPair, err := k.RegisterERC20Extension(ctx, coin.Denom)

Neither RegisterERC20Extension nor EnableDynamicPrecompile reads any governance parameter, whereas MsgRegisterERC20 goes through Params.PermissionlessRegistration (keeper/msg_server.go:181-185). Every denom a counterparty chain picks hashes to a distinct `ibc/<hash>` and the callback runs with a zeroed KV gas config (ibc_callbacks.go:53-56), so this branch can create unbounded pairs that are never charged to the relayer: governance can switch permissionless registration off and the IBC path keeps creating them.

Scope. The gate suppresses exactly one branch - the registration above. Everything else is delegated verbatim, so under the default params (PermissionlessRegistration = true, see types.DefaultParams) behavior is unchanged. With the switch off an inbound packet for an unknown denom is still received and credited; it just stays a bank voucher instead of silently becoming an ERC20. Turning the switch back on restores the old behavior, and no state written by the gate needs undoing.

Decimals. The gate also repairs the bank metadata that the registration branch is about to freeze into a dynamic precompile, for the same denom set the suppression guards. The precompile reads decimals() out of that metadata (precompiles/erc20/query.go:115-128), and ibc-go writes the shape whose last-segment match lands on the source denom's exponent-0 unit - so decimals() returns 0 for every voucher the callback registers. That is the same defect the v0.5.0 handler repairs for the vouchers that already existed, and it is repaired through the same implementation (ibc.NormalizeVoucherDecimals) so decimals() stops depending on whether a pair predates the upgrade. It runs only when the callback will in fact register, and it is idempotent, so a re-delivered packet costs reads.

The repair is not a widening of the gate: it writes no token pair, and it is scoped to the one denomination the packet carries. It does add a store write per newly registered voucher - the same one the callback is about to make unbounded.

func NewERC20IBCGate added in v0.5.0

func NewERC20IBCGate(
	keeper *cosmoserc20keeper.Keeper,
	bankKeeper uptickibc.VoucherBankStore,
) ERC20IBCGate

NewERC20IBCGate wraps the ERC20 keeper, which must be non-nil: a nil keeper would make every callback a no-op and silently disable auto registration. The bank keeper is required for the metadata repair and must be non-nil for the same reason - a nil one would leave every newly registered voucher at decimals()==0 while looking like it works.

func (ERC20IBCGate) Logger added in v0.5.0

func (g ERC20IBCGate) Logger(ctx sdk.Context) log.Logger

Logger delegates so log output keeps the keeper's logger.

func (ERC20IBCGate) OnAcknowledgementPacket added in v0.5.0

OnAcknowledgementPacket delegates: the refund path never registers a pair.

func (ERC20IBCGate) OnRecvPacket added in v0.5.0

OnRecvPacket returns the ICS-20 acknowledgement untouched when permissionless registration is off and the callback's only remaining effect would be to create a token pair; otherwise it delegates. The switch is read first on purpose: under the default params it is true, and the common path then costs one extra store read plus the registration predicate the metadata repair needs, and nothing else.

The predicate is what makes the repair safe to run on every inbound packet: only a packet the callback is about to register for has metadata worth rewriting, and the rewrite is idempotent, so an established denom is a pair lookup plus nothing.

func (ERC20IBCGate) OnTimeoutPacket added in v0.5.0

func (g ERC20IBCGate) OnTimeoutPacket(
	ctx sdk.Context,
	packet channeltypes.Packet,
	data transfertypes.FungibleTokenPacketData,
) error

OnTimeoutPacket delegates: the refund path never registers a pair.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址