From c31f02a8e73973547fb1bca708abfc0af677a79e Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Wed, 20 Dec 2023 07:27:10 +0700 Subject: [PATCH] 6.3.1 up --- app/ante/ante.go | 10 +++++----- app/app.go | 2 +- app/ibctesting/endpoint.go | 6 +++++- app/ibctesting/event_utils.go | 2 +- app/ibctesting/simapp/app.go | 5 +++-- x/transfermiddleware/module.go | 6 +++--- x/transfermiddleware/types/events.go | 2 +- x/transfermiddleware/types/msg.go | 12 ++++++------ x/tx-boundary/keeper/keeper.go | 8 ++++---- x/tx-boundary/module.go | 8 ++++---- x/tx-boundary/types/genesis.go | 2 +- 11 files changed, 34 insertions(+), 29 deletions(-) diff --git a/app/ante/ante.go b/app/ante/ante.go index 83c7a37b0..9f8b65350 100644 --- a/app/ante/ante.go +++ b/app/ante/ante.go @@ -1,14 +1,14 @@ package ante import ( - tfmwKeeper "github.com/notional-labs/composable/v6/x/transfermiddleware/keeper" - txBoundaryAnte "github.com/notional-labs/composable/v6/x/tx-boundary/ante" + tfmwkeeper "github.com/notional-labs/composable/v6/x/transfermiddleware/keeper" + txboundaryante "github.com/notional-labs/composable/v6/x/tx-boundary/ante" txBoundaryKeeper "github.com/notional-labs/composable/v6/x/tx-boundary/keeper" "github.com/cosmos/cosmos-sdk/codec" servertypes "github.com/cosmos/cosmos-sdk/server/types" sdk "github.com/cosmos/cosmos-sdk/types" - ante "github.com/cosmos/cosmos-sdk/x/auth/ante" + "github.com/cosmos/cosmos-sdk/x/auth/ante" "github.com/cosmos/cosmos-sdk/x/auth/signing" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" @@ -27,7 +27,7 @@ func NewAnteHandler( sigGasConsumer ante.SignatureVerificationGasConsumer, signModeHandler signing.SignModeHandler, channelKeeper *ibckeeper.Keeper, - tfmwKeeper tfmwKeeper.Keeper, + tfmwKeeper tfmwkeeper.Keeper, txBoundaryKeeper txBoundaryKeeper.Keeper, codec codec.BinaryCodec, ) sdk.AnteHandler { @@ -40,7 +40,7 @@ func NewAnteHandler( ante.NewValidateMemoDecorator(ak), ante.NewConsumeGasForTxSizeDecorator(ak), NewIBCPermissionDecorator(codec, tfmwKeeper), - txBoundaryAnte.NewStakingPermissionDecorator(codec, txBoundaryKeeper), + txboundaryante.NewStakingPermissionDecorator(codec, txBoundaryKeeper), ante.NewSetPubKeyDecorator(ak), // SetPubKeyDecorator must be called before all signature verification decorators ante.NewValidateSigCountDecorator(ak), ante.NewSigGasConsumeDecorator(ak, sigGasConsumer), diff --git a/app/app.go b/app/app.go index 958f13237..6763c5ef1 100644 --- a/app/app.go +++ b/app/app.go @@ -323,7 +323,7 @@ func NewComposableApp( icqModule := icq.NewAppModule(app.ICQKeeper) ibcHooksModule := ibc_hooks.NewAppModule() icaModule := ica.NewAppModule(nil, &app.ICAHostKeeper) // Only ICA Host - /**** Module Options ****/ + // **** Module Options ****/ // NOTE: we may consider parsing `appOpts` inside module constructors. For the moment // we prefer to be more strict in what arguments the modules expect. diff --git a/app/ibctesting/endpoint.go b/app/ibctesting/endpoint.go index 633dc7b2a..313a46e78 100644 --- a/app/ibctesting/endpoint.go +++ b/app/ibctesting/endpoint.go @@ -66,11 +66,15 @@ func (endpoint *Endpoint) CreateClient() (err error) { tmConfig, ok := endpoint.ClientConfig.(*ibctesting.TendermintConfig) require.True(endpoint.Chain.t, ok) - height := endpoint.Counterparty.Chain.LastHeader.GetHeight().(clienttypes.Height) + height, ok := endpoint.Counterparty.Chain.LastHeader.GetHeight().(clienttypes.Height) + if !ok { + return fmt.Errorf("type assertion to clienttypes.Height failed") + } clientState = ibctmtypes.NewClientState( endpoint.Counterparty.Chain.ChainID, tmConfig.TrustLevel, tmConfig.TrustingPeriod, tmConfig.UnbondingPeriod, tmConfig.MaxClockDrift, height, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, ) + consensusState = endpoint.Counterparty.Chain.LastHeader.ConsensusState() case exported.Solomachine: // TODO diff --git a/app/ibctesting/event_utils.go b/app/ibctesting/event_utils.go index 5ef1ee2ba..1f0237eac 100644 --- a/app/ibctesting/event_utils.go +++ b/app/ibctesting/event_utils.go @@ -45,7 +45,7 @@ func getAckPackets(evts []abci.Event) []PacketAck { // for _, attr := range evt.Attributes { // fmt.Printf(" %s = %s\n", string(attr.Key), string(attr.Value)) // } -//} +// } func parsePacketFromEvent(evt abci.Event) channeltypes.Packet { return channeltypes.Packet{ diff --git a/app/ibctesting/simapp/app.go b/app/ibctesting/simapp/app.go index 5180ffad0..0dcb8d255 100644 --- a/app/ibctesting/simapp/app.go +++ b/app/ibctesting/simapp/app.go @@ -13,6 +13,7 @@ import ( simappupgrades "github.com/notional-labs/composable/v6/app/ibctesting/simapp/upgrades" v6 "github.com/notional-labs/composable/v6/app/ibctesting/simapp/upgrades/v6" v7 "github.com/notional-labs/composable/v6/app/ibctesting/simapp/upgrades/v7" + // TODO: mint module not complete yet, "github.com/notional-labs/composable/v6/x/mint" mintkeeper "github.com/notional-labs/composable/v6/x/mint/keeper" @@ -556,7 +557,7 @@ func NewSimApp( // If evidence needs to be handled for the app, set routes in router here and seal app.EvidenceKeeper = *evidenceKeeper - /**** Module Options ****/ + // **** Module Options ****/ // NOTE: we may consider parsing `appOpts` inside module constructors. For the moment // we prefer to be more strict in what arguments the modules expect. @@ -856,7 +857,7 @@ func (app *SimApp) SimulationManager() *module.SimulationManager { // RegisterAPIRoutes registers all application module routes with the provided // API server. -func (app *SimApp) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig) { +func (*SimApp) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig) { clientCtx := apiSvr.ClientCtx // Register new tx routes from grpc-gateway. authtx.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) diff --git a/x/transfermiddleware/module.go b/x/transfermiddleware/module.go index bd8311829..06c32f5b8 100644 --- a/x/transfermiddleware/module.go +++ b/x/transfermiddleware/module.go @@ -130,7 +130,7 @@ func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { } // EndBlock implements the AppModule interface -func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { +func (AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { return []abci.ValidatorUpdate{} } @@ -145,9 +145,9 @@ func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedP } // RegisterStoreDecoder registers a decoder for router module's types -func (am AppModule) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) {} +func (AppModule) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) {} // WeightedOperations returns the all the router module operations with their respective weights. -func (am AppModule) WeightedOperations(_ module.SimulationState) []simtypes.WeightedOperation { +func (AppModule) WeightedOperations(_ module.SimulationState) []simtypes.WeightedOperation { return nil } diff --git a/x/transfermiddleware/types/events.go b/x/transfermiddleware/types/events.go index 61938b986..6d16e4720 100644 --- a/x/transfermiddleware/types/events.go +++ b/x/transfermiddleware/types/events.go @@ -4,7 +4,7 @@ package types const ( EventAddParachainIBCTokenInfo = "add-parachain-token-info" // #nosec G101 EventRemoveParachainIBCTokenInfo = "remove-parachain-token-info" // #nosec G101 - EventAddRlyToAllowList = "add-rly-to-allow-list" //#nosec G101 + EventAddRlyToAllowList = "add-rly-to-allow-list" // #nosec G101 AttributeKeyNativeDenom = "native-denom" AttributeKeyIbcDenom = "ibc-denom" diff --git a/x/transfermiddleware/types/msg.go b/x/transfermiddleware/types/msg.go index ab44ebf61..ab4d283da 100644 --- a/x/transfermiddleware/types/msg.go +++ b/x/transfermiddleware/types/msg.go @@ -34,10 +34,10 @@ func NewMsgAddParachainIBCTokenInfo( } // Route Implements Msg. -func (msg MsgAddParachainIBCTokenInfo) Route() string { return RouterKey } +func (MsgAddParachainIBCTokenInfo) Route() string { return RouterKey } // Type Implements Msg. -func (msg MsgAddParachainIBCTokenInfo) Type() string { return TypeMsgAddParachainIBCTokenInfo } +func (MsgAddParachainIBCTokenInfo) Type() string { return TypeMsgAddParachainIBCTokenInfo } // GetSignBytes implements the LegacyMsg interface. func (msg MsgAddParachainIBCTokenInfo) GetSignBytes() []byte { @@ -84,10 +84,10 @@ func NewMsgRemoveParachainIBCTokenInfo( } // Route Implements Msg. -func (msg MsgRemoveParachainIBCTokenInfo) Route() string { return RouterKey } +func (MsgRemoveParachainIBCTokenInfo) Route() string { return RouterKey } // Type Implements Msg. -func (msg MsgRemoveParachainIBCTokenInfo) Type() string { return TypeMsgRemoveParachainIBCTokenInfo } +func (MsgRemoveParachainIBCTokenInfo) Type() string { return TypeMsgRemoveParachainIBCTokenInfo } // GetSignBytes implements the LegacyMsg interface. func (msg MsgRemoveParachainIBCTokenInfo) GetSignBytes() []byte { @@ -122,10 +122,10 @@ func NewMsgAddRlyAddress( } // Route Implements Msg. -func (msg MsgAddRlyAddress) Route() string { return RouterKey } +func (MsgAddRlyAddress) Route() string { return RouterKey } // Type Implements Msg. -func (msg MsgAddRlyAddress) Type() string { return TypeMsgAddRlyAddress } +func (MsgAddRlyAddress) Type() string { return TypeMsgAddRlyAddress } // GetSignBytes implements the LegacyMsg interface. func (msg MsgAddRlyAddress) GetSignBytes() []byte { diff --git a/x/tx-boundary/keeper/keeper.go b/x/tx-boundary/keeper/keeper.go index dda65c1b3..65d290170 100644 --- a/x/tx-boundary/keeper/keeper.go +++ b/x/tx-boundary/keeper/keeper.go @@ -37,7 +37,7 @@ func (k Keeper) GetAuthority() string { } // Logger returns logger -func (k Keeper) Logger(ctx sdk.Context) log.Logger { +func (Keeper) Logger(ctx sdk.Context) log.Logger { return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) } @@ -61,7 +61,7 @@ func (k Keeper) GetDelegateBoundary(ctx sdk.Context) (boundary types.Boundary) { } k.cdc.MustUnmarshal(bz, &boundary) - return + return boundary } // SetRedelegateBoundary sets the delegate boundary. @@ -84,7 +84,7 @@ func (k Keeper) GetRedelegateBoundary(ctx sdk.Context) (boundary types.Boundary) } k.cdc.MustUnmarshal(bz, &boundary) - return + return boundary } // SetDelegateCount set the number of delegate tx for a given address @@ -140,7 +140,7 @@ func (k Keeper) GetLimitPerAddr(ctx sdk.Context, addr sdk.AccAddress) (limitPerA } bz := store.Get(addr) k.cdc.MustUnmarshal(bz, &limitPerAddr) - return + return limitPerAddr } func (k Keeper) UpdateLimitPerAddr(ctx sdk.Context, addr sdk.AccAddress) { diff --git a/x/tx-boundary/module.go b/x/tx-boundary/module.go index 660b58177..3acc13859 100644 --- a/x/tx-boundary/module.go +++ b/x/tx-boundary/module.go @@ -48,7 +48,7 @@ func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { } // RegisterInterfaces registers the module interface -func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) { +func (AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) { types.RegisterInterfaces(reg) } @@ -107,11 +107,11 @@ func (AppModule) Name() string { } // RegisterInvariants registers the tx-boundary module invariants. -func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} +func (AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} // RegisterServices registers a gRPC query service to respond to the // module-specific gRPC queries. -func (am AppModule) RegisterServices(_ module.Configurator) { +func (AppModule) RegisterServices(_ module.Configurator) { // types.RegisterQueryServer(cfg.QueryServer(), am.keeper) // types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) } @@ -137,7 +137,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw func (AppModule) ConsensusVersion() uint64 { return 1 } // BeginBlock returns the begin blocker for the tx-boundary module. -func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} +func (AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} // ProposalContents doesn't return any content functions for governance proposals. func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalMsg { diff --git a/x/tx-boundary/types/genesis.go b/x/tx-boundary/types/genesis.go index f690a7c9d..b7b822706 100644 --- a/x/tx-boundary/types/genesis.go +++ b/x/tx-boundary/types/genesis.go @@ -1,6 +1,6 @@ package types -import fmt "fmt" +import "fmt" var ( DefaultDelegateBoundary = Boundary{