diff --git a/runtime/module.go b/runtime/module.go index efb71ca3152f..44b019f5809b 100644 --- a/runtime/module.go +++ b/runtime/module.go @@ -16,7 +16,6 @@ import ( "cosmossdk.io/core/appmodule" "cosmossdk.io/core/event" "cosmossdk.io/core/genesis" - "cosmossdk.io/core/header" "cosmossdk.io/core/store" "cosmossdk.io/depinject" "cosmossdk.io/log" @@ -71,7 +70,6 @@ func init() { ProvideMemoryStoreService, ProvideTransientStoreService, ProvideEventService, - ProvideHeaderInfoService, ProvideBasicManager, ProvideAppVersionModifier, ProvideAddressCodec, @@ -245,10 +243,6 @@ func ProvideEventService() event.Service { return EventService{} } -func ProvideHeaderInfoService(app *AppBuilder) header.Service { - return headerInfoService{} -} - func ProvideBasicManager(app *AppBuilder) module.BasicManager { return app.app.basicManager } diff --git a/runtime/services.go b/runtime/services.go index 844a5f7e3aa6..0b9223d92a29 100644 --- a/runtime/services.go +++ b/runtime/services.go @@ -1,15 +1,11 @@ package runtime import ( - "context" - appv1alpha1 "cosmossdk.io/api/cosmos/app/v1alpha1" autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" reflectionv1 "cosmossdk.io/api/cosmos/reflection/v1" - "cosmossdk.io/core/header" "github.com/cosmos/cosmos-sdk/runtime/services" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" ) @@ -25,11 +21,3 @@ func (a *App) registerRuntimeServices(cfg module.Configurator) error { return nil } - -var _ header.Service = headerInfoService{} - -type headerInfoService struct{} - -func (headerInfoService) GetHeaderInfo(ctx context.Context) header.Info { - return sdk.UnwrapSDKContext(ctx).HeaderInfo() -} diff --git a/x/circuit/CHANGELOG.md b/x/circuit/CHANGELOG.md index 63534e456362..16de809f2717 100644 --- a/x/circuit/CHANGELOG.md +++ b/x/circuit/CHANGELOG.md @@ -29,4 +29,4 @@ Ref: https://keepachangelog.com/en/1.0.0/ # Changelog -## [Unreleased] \ No newline at end of file +## [Unreleased] diff --git a/x/circuit/client/cli/tx.go b/x/circuit/client/cli/tx.go index a3c44f8101ef..f74b2e9f1f07 100644 --- a/x/circuit/client/cli/tx.go +++ b/x/circuit/client/cli/tx.go @@ -68,7 +68,11 @@ func AuthorizeCircuitBreakerCmd() *cobra.Command { permission := types.Permissions{Level: types.Permissions_Level(lvl.Uint64()), LimitTypeUrls: typeUrls} - msg := types.NewMsgAuthorizeCircuitBreaker(clientCtx.GetFromAddress().String(), grantee.String(), &permission) + msg := &types.MsgAuthorizeCircuitBreaker{ + Granter: clientCtx.GetFromAddress().String(), + Grantee: grantee.String(), + Permissions: &permission, + } return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) }, @@ -92,7 +96,10 @@ func TripCircuitBreakerCmd() *cobra.Command { return err } - msg := types.NewMsgTripCircuitBreaker(clientCtx.GetFromAddress().String(), strings.Split(args[0], ",")) + msg := &types.MsgTripCircuitBreaker{ + Authority: clientCtx.GetFromAddress().String(), + MsgTypeUrls: strings.Split(args[0], ","), + } return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) }, @@ -118,7 +125,10 @@ func ResetCircuitBreakerCmd() *cobra.Command { msgTypeUrls := strings.Split(args[0], ",") - msg := types.NewMsgResetCircuitBreaker(clientCtx.GetFromAddress().String(), msgTypeUrls) + msg := &types.MsgResetCircuitBreaker{ + Authority: clientCtx.GetFromAddress().String(), + MsgTypeUrls: msgTypeUrls, + } return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) }, diff --git a/x/circuit/keeper/query.go b/x/circuit/keeper/query.go index 8ab7b4214ae0..a8b39e4d4a82 100644 --- a/x/circuit/keeper/query.go +++ b/x/circuit/keeper/query.go @@ -5,7 +5,6 @@ import ( "cosmossdk.io/x/circuit/types" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/query" ) @@ -22,15 +21,13 @@ func NewQueryServer(keeper Keeper) types.QueryServer { } // Account returns account permissions. -func (qs QueryServer) Account(c context.Context, req *types.QueryAccountRequest) (*types.AccountResponse, error) { - sdkCtx := sdk.UnwrapSDKContext(c) - +func (qs QueryServer) Account(ctx context.Context, req *types.QueryAccountRequest) (*types.AccountResponse, error) { add, err := qs.keeper.addressCodec.StringToBytes(req.Address) if err != nil { return nil, err } - perms, err := qs.keeper.Permissions.Get(sdkCtx, add) + perms, err := qs.keeper.Permissions.Get(ctx, add) if err != nil { return nil, err } diff --git a/x/circuit/module.go b/x/circuit/module.go index dd49a874e7ce..ddfc6449c3c3 100644 --- a/x/circuit/module.go +++ b/x/circuit/module.go @@ -50,7 +50,6 @@ func (AppModuleBasic) Name() string { return types.ModuleName } // RegisterLegacyAminoCodec registers the circuit module's types on the LegacyAmino codec. func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - types.RegisterLegacyAminoCodec(cdc) } // DefaultGenesis returns default genesis state as raw bytes for the circuit diff --git a/x/circuit/types/codec.go b/x/circuit/types/codec.go index ceddf6254300..775eb1aee1c5 100644 --- a/x/circuit/types/codec.go +++ b/x/circuit/types/codec.go @@ -1,21 +1,11 @@ package types import ( - "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/codec/legacy" types "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" ) -// RegisterLegacyAminoCodec registers the necessary circuit interfaces and concrete types -// on the provided LegacyAmino codec. These types are used for Amino JSON serialization. -func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - legacy.RegisterAminoMsg(cdc, &MsgAuthorizeCircuitBreaker{}, "cosmos-sdk/MsgAuthorizeCircuitBreaker") - legacy.RegisterAminoMsg(cdc, &MsgResetCircuitBreaker{}, "cosmos-sdk/MsgResetCircuitBreaker") - legacy.RegisterAminoMsg(cdc, &MsgTripCircuitBreaker{}, "cosmos-sdk/MsgTripCircuitBreaker") -} - // RegisterInterfaces registers the interfaces types with the interface registry. func RegisterInterfaces(registry types.InterfaceRegistry) { registry.RegisterImplementations((*sdk.Msg)(nil), diff --git a/x/circuit/types/msgs.go b/x/circuit/types/msgs.go deleted file mode 100644 index 0e39b00c5f6b..000000000000 --- a/x/circuit/types/msgs.go +++ /dev/null @@ -1,36 +0,0 @@ -package types - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" -) - -var ( - _ sdk.Msg = &MsgAuthorizeCircuitBreaker{} - _ sdk.Msg = &MsgTripCircuitBreaker{} - _ sdk.Msg = &MsgResetCircuitBreaker{} -) - -// NewMsgAuthorizeCircuitBreaker creates a new MsgAuthorizeCircuitBreaker instance. -func NewMsgAuthorizeCircuitBreaker(granter, grantee string, permission *Permissions) *MsgAuthorizeCircuitBreaker { - return &MsgAuthorizeCircuitBreaker{ - Granter: granter, - Grantee: grantee, - Permissions: permission, - } -} - -// NewMsgTripCircuitBreaker creates a new MsgTripCircuitBreaker instance. -func NewMsgTripCircuitBreaker(authority string, urls []string) *MsgTripCircuitBreaker { - return &MsgTripCircuitBreaker{ - Authority: authority, - MsgTypeUrls: urls, - } -} - -// NewMsgResetCircuitBreaker creates a new MsgResetCircuitBreaker instance. -func NewMsgResetCircuitBreaker(authority string, urls []string) *MsgResetCircuitBreaker { - return &MsgResetCircuitBreaker{ - Authority: authority, - MsgTypeUrls: urls, - } -}