chore: remove unneeded code (#17741)

This commit is contained in:
Marko 2023-09-14 17:36:13 +02:00 committed by GitHub
parent 36a9330adb
commit 98895f4977
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 16 additions and 74 deletions

View File

@ -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
}

View File

@ -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()
}

View File

@ -29,4 +29,4 @@ Ref: https://keepachangelog.com/en/1.0.0/
# Changelog
## [Unreleased]
## [Unreleased]

View File

@ -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)
},

View File

@ -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
}

View File

@ -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

View File

@ -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),

View File

@ -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,
}
}