From 40e97294c7eb2bb8129fe9864daf56a45121a4ae Mon Sep 17 00:00:00 2001 From: jhernandezb Date: Tue, 20 Feb 2024 19:19:12 -0600 Subject: [PATCH] fix imports --- cmd/noisd/init.go | 10 +++++----- cmd/noisd/main.go | 2 +- testing/app.go | 14 +++++++------- x/allocation/abci.go | 2 +- x/allocation/keeper/keeper.go | 9 +++++---- x/allocation/keeper/keeper_test.go | 4 ++-- x/allocation/module.go | 15 +-------------- x/allocation/types/errors.go | 4 ++-- x/allocation/types/msg_claim_rewards.go | 3 ++- 9 files changed, 26 insertions(+), 37 deletions(-) diff --git a/cmd/noisd/init.go b/cmd/noisd/init.go index 562cae2..9e9195a 100644 --- a/cmd/noisd/init.go +++ b/cmd/noisd/init.go @@ -8,14 +8,14 @@ import ( "path/filepath" "time" + cfg "github.com/cometbft/cometbft/config" + "github.com/cometbft/cometbft/libs/cli" + tmos "github.com/cometbft/cometbft/libs/os" + tmrand "github.com/cometbft/cometbft/libs/rand" + "github.com/cometbft/cometbft/types" "github.com/cosmos/go-bip39" "github.com/pkg/errors" "github.com/spf13/cobra" - cfg "github.com/tendermint/tendermint/config" - "github.com/tendermint/tendermint/libs/cli" - tmos "github.com/tendermint/tendermint/libs/os" - tmrand "github.com/tendermint/tendermint/libs/rand" - "github.com/tendermint/tendermint/types" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" diff --git a/cmd/noisd/main.go b/cmd/noisd/main.go index e90ab41..a478de4 100644 --- a/cmd/noisd/main.go +++ b/cmd/noisd/main.go @@ -10,7 +10,7 @@ import ( func main() { rootCmd, _ := NewRootCmd() - if err := svrcmd.Execute(rootCmd, app.DefaultNodeHome); err != nil { + if err := svrcmd.Execute(rootCmd, "NOISD", app.DefaultNodeHome); err != nil { switch e := err.(type) { case server.ErrorCode: os.Exit(e.Code) diff --git a/testing/app.go b/testing/app.go index 5db4dd3..5e71755 100644 --- a/testing/app.go +++ b/testing/app.go @@ -4,15 +4,15 @@ import ( "encoding/json" "time" + dbm "github.com/cometbft/cometbft-db" + abci "github.com/cometbft/cometbft/abci/types" "github.com/cosmos/cosmos-sdk/std" - abci "github.com/tendermint/tendermint/abci/types" - dbm "github.com/tendermint/tm-db" + "github.com/cometbft/cometbft/libs/log" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + tmtypes "github.com/cometbft/cometbft/types" app "github.com/noislabs/noisd/app" appparams "github.com/noislabs/noisd/app/params" - "github.com/tendermint/tendermint/libs/log" - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - tmtypes "github.com/tendermint/tendermint/types" ) type EmptyOptions struct{} @@ -45,8 +45,8 @@ func NewApp(home string) *app.NoisApp { return noisApp } -var defaultConsensusParams = &abci.ConsensusParams{ - Block: &abci.BlockParams{ +var defaultConsensusParams = &tmproto.ConsensusParams{ + Block: &tmproto.BlockParams{ MaxBytes: 200000, MaxGas: 2000000, }, diff --git a/x/allocation/abci.go b/x/allocation/abci.go index 7d15b4f..c3ee91a 100644 --- a/x/allocation/abci.go +++ b/x/allocation/abci.go @@ -4,11 +4,11 @@ import ( "fmt" "time" + abci "github.com/cometbft/cometbft/abci/types" "github.com/cosmos/cosmos-sdk/telemetry" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/noislabs/noisd/x/allocation/keeper" "github.com/noislabs/noisd/x/allocation/types" - abci "github.com/tendermint/tendermint/abci/types" ) func BeginBlocker(ctx sdk.Context, keeper keeper.Keeper, _ abci.RequestBeginBlock) { diff --git a/x/allocation/keeper/keeper.go b/x/allocation/keeper/keeper.go index 750d399..42ffc04 100644 --- a/x/allocation/keeper/keeper.go +++ b/x/allocation/keeper/keeper.go @@ -3,9 +3,10 @@ package keeper import ( "fmt" - "github.com/tendermint/tendermint/libs/log" + "github.com/cometbft/cometbft/libs/log" "github.com/cosmos/cosmos-sdk/codec" + storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" @@ -14,7 +15,7 @@ import ( type Keeper struct { cdc codec.BinaryCodec - storeKey sdk.StoreKey + storeKey storetypes.StoreKey accountKeeper types.AccountKeeper bankKeeper types.BankKeeper @@ -27,7 +28,7 @@ type Keeper struct { // NewKeeper creates a new allocation Keeper instance. func NewKeeper( cdc codec.BinaryCodec, - storeKey sdk.StoreKey, + storeKey storetypes.StoreKey, accountKeeper types.AccountKeeper, bankKeeper types.BankKeeper, stakingKeeper types.StakingKeeper, distrKeeper types.DistrKeeper, ps paramtypes.Subspace, ) Keeper { @@ -144,7 +145,7 @@ func (k Keeper) DistributeValidatorRewards(ctx sdk.Context, rewards sdk.Coin) er // GetProportions gets the balance of the `MintedDenom` from minted coins // and returns coins according to the `AllocationRatio` func (k Keeper) GetProportions(ctx sdk.Context, mintedCoin sdk.Coin, ratio sdk.Dec) sdk.Coin { - return sdk.NewCoin(mintedCoin.Denom, mintedCoin.Amount.ToDec().Mul(ratio).TruncateInt()) + return sdk.NewCoin(mintedCoin.Denom, sdk.NewDecFromInt(mintedCoin.Amount).Mul(ratio).TruncateInt()) } // Logger returns a module-specific logger. diff --git a/x/allocation/keeper/keeper_test.go b/x/allocation/keeper/keeper_test.go index ae88d57..24d4f2a 100644 --- a/x/allocation/keeper/keeper_test.go +++ b/x/allocation/keeper/keeper_test.go @@ -4,14 +4,14 @@ import ( "testing" "time" + "github.com/cometbft/cometbft/crypto/secp256k1" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/noislabs/noisd/app" noistesting "github.com/noislabs/noisd/testing" "github.com/noislabs/noisd/x/allocation/types" "github.com/stretchr/testify/suite" - "github.com/tendermint/tendermint/crypto/secp256k1" - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" diff --git a/x/allocation/module.go b/x/allocation/module.go index 4fd80c0..61d4a8d 100644 --- a/x/allocation/module.go +++ b/x/allocation/module.go @@ -9,7 +9,7 @@ import ( "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" - abci "github.com/tendermint/tendermint/abci/types" + abci "github.com/cometbft/cometbft/abci/types" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" @@ -123,19 +123,6 @@ func (am AppModule) Name() string { return am.AppModuleBasic.Name() } -// Route returns the allocation module's message routing key. -func (am AppModule) Route() sdk.Route { - return sdk.Route{} -} - -// QuerierRoute returns the allocation module's query routing key. -func (AppModule) QuerierRoute() string { return types.QuerierRoute } - -// LegacyQuerierHandler returns the allocation module's Querier. -func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sdk.Querier { - return nil -} - // RegisterServices registers a GRPC query service to respond to the // module-specific GRPC queries. func (am AppModule) RegisterServices(cfg module.Configurator) { diff --git a/x/allocation/types/errors.go b/x/allocation/types/errors.go index 45a4206..a226e45 100644 --- a/x/allocation/types/errors.go +++ b/x/allocation/types/errors.go @@ -1,11 +1,11 @@ package types import ( - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + errorsmod "cosmossdk.io/errors" ) // x/allocation module sentinel errors // errors must start at 2 to avoid conflict with the default errors by the sdk var ( - ErrNoRewards = sdkerrors.Register(ModuleName, 2, "no rewards available for claiming") + ErrNoRewards = errorsmod.Register(ModuleName, 2, "no rewards available for claiming") ) diff --git a/x/allocation/types/msg_claim_rewards.go b/x/allocation/types/msg_claim_rewards.go index 05098c9..e846a9c 100644 --- a/x/allocation/types/msg_claim_rewards.go +++ b/x/allocation/types/msg_claim_rewards.go @@ -1,6 +1,7 @@ package types import ( + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) @@ -42,7 +43,7 @@ func (msg MsgClaimRewards) GetSignBytes() []byte { func (msg MsgClaimRewards) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Sender) if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid sender address (%s)", err) + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid sender address (%s)", err) } return nil }