Skip to content

Commit

Permalink
chore: remove unneeded code (#17741)
Browse files Browse the repository at this point in the history
  • Loading branch information
tac0turtle authored Sep 14, 2023
1 parent 36a9330 commit 98895f4
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 74 deletions.
6 changes: 0 additions & 6 deletions runtime/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -71,7 +70,6 @@ func init() {
ProvideMemoryStoreService,
ProvideTransientStoreService,
ProvideEventService,
ProvideHeaderInfoService,
ProvideBasicManager,
ProvideAppVersionModifier,
ProvideAddressCodec,
Expand Down Expand Up @@ -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
}
Expand Down
12 changes: 0 additions & 12 deletions runtime/services.go
Original file line number Diff line number Diff line change
@@ -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"
)

Expand All @@ -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()
}
2 changes: 1 addition & 1 deletion x/circuit/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ Ref: https://keepachangelog.com/en/1.0.0/

# Changelog

## [Unreleased]
## [Unreleased]
16 changes: 13 additions & 3 deletions x/circuit/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
},
Expand All @@ -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)
},
Expand All @@ -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)
},
Expand Down
7 changes: 2 additions & 5 deletions x/circuit/keeper/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (

"cosmossdk.io/x/circuit/types"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/query"
)

Expand All @@ -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
}
Expand Down
1 change: 0 additions & 1 deletion x/circuit/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 0 additions & 10 deletions x/circuit/types/codec.go
Original file line number Diff line number Diff line change
@@ -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),
Expand Down
36 changes: 0 additions & 36 deletions x/circuit/types/msgs.go

This file was deleted.

0 comments on commit 98895f4

Please sign in to comment.