Skip to content

Commit

Permalink
fix imports
Browse files Browse the repository at this point in the history
  • Loading branch information
jhernandezb committed Feb 21, 2024
1 parent 9db20d5 commit 40e9729
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 37 deletions.
10 changes: 5 additions & 5 deletions cmd/noisd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion cmd/noisd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
14 changes: 7 additions & 7 deletions testing/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand Down Expand Up @@ -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,
},
Expand Down
2 changes: 1 addition & 1 deletion x/allocation/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
9 changes: 5 additions & 4 deletions x/allocation/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -14,7 +15,7 @@ import (

type Keeper struct {
cdc codec.BinaryCodec
storeKey sdk.StoreKey
storeKey storetypes.StoreKey

accountKeeper types.AccountKeeper
bankKeeper types.BankKeeper
Expand All @@ -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 {
Expand Down Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions x/allocation/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
15 changes: 1 addition & 14 deletions x/allocation/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions x/allocation/types/errors.go
Original file line number Diff line number Diff line change
@@ -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")
)
3 changes: 2 additions & 1 deletion x/allocation/types/msg_claim_rewards.go
Original file line number Diff line number Diff line change
@@ -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"
)
Expand Down Expand Up @@ -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
}

0 comments on commit 40e9729

Please sign in to comment.