diff --git a/Dockerfile b/Dockerfile index 11d30e41e0..c4996c7a10 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,7 @@ FROM golang:1.21-alpine AS build-env # bash, jq, curl for debugging # git, make for installation # libc-dev, gcc, linux-headers, eudev-dev are used for cgo and ledger installation -RUN apk add bash git make libc-dev gcc linux-headers eudev-dev jq curl +RUN apk add bash git make libc-dev gcc linux-headers eudev-dev jq curl binutils-gold # Set working directory for the build WORKDIR /root/kava diff --git a/app/_sim_test.go b/app/_sim_test.go index 0b75637fd1..b413eece98 100644 --- a/app/_sim_test.go +++ b/app/_sim_test.go @@ -11,9 +11,9 @@ import ( "github.com/stretchr/testify/require" - dbm "github.com/cometbft/cometbft-db" + "cosmossdk.io/log" abci "github.com/cometbft/cometbft/abci/types" - "github.com/cometbft/cometbft/libs/log" + dbm "github.com/cosmos/cosmos-db" "cosmossdk.io/simapp" "github.com/cosmos/cosmos-sdk/baseapp" diff --git a/app/ante/ante.go b/app/ante/ante.go index abc1db32b1..45d0b43e75 100644 --- a/app/ante/ante.go +++ b/app/ante/ante.go @@ -5,14 +5,14 @@ import ( "runtime/debug" errorsmod "cosmossdk.io/errors" - tmlog "github.com/cometbft/cometbft/libs/log" + tmlog "cosmossdk.io/log" + txsigning "cosmossdk.io/x/tx/signing" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" authante "github.com/cosmos/cosmos-sdk/x/auth/ante" - authsigning "github.com/cosmos/cosmos-sdk/x/auth/signing" vesting "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" - ibcante "github.com/cosmos/ibc-go/v7/modules/core/ante" - ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper" + ibcante "github.com/cosmos/ibc-go/v8/modules/core/ante" + ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper" evmante "github.com/evmos/ethermint/app/ante" evmtypes "github.com/evmos/ethermint/x/evm/types" ) @@ -25,7 +25,7 @@ type HandlerOptions struct { IBCKeeper *ibckeeper.Keeper EvmKeeper evmante.EVMKeeper FeegrantKeeper authante.FeegrantKeeper - SignModeHandler authsigning.SignModeHandler + SignModeHandler *txsigning.HandlerMap SigGasConsumer authante.SignatureVerificationGasConsumer FeeMarketKeeper evmtypes.FeeMarketKeeper MaxTxGasWanted uint64 diff --git a/app/ante/ante_test.go b/app/ante/ante_test.go index fd4af13f18..744f987fdf 100644 --- a/app/ante/ante_test.go +++ b/app/ante/ante_test.go @@ -6,10 +6,10 @@ import ( "testing" "time" + "cosmossdk.io/log" sdkmath "cosmossdk.io/math" - tmdb "github.com/cometbft/cometbft-db" abci "github.com/cometbft/cometbft/abci/types" - "github.com/cometbft/cometbft/libs/log" + tmdb "github.com/cosmos/cosmos-db" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/codec" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" @@ -129,12 +129,13 @@ func TestAppAnteHandler_AuthorizedMempool(t *testing.T) { txBytes, err := encodingConfig.TxConfig.TxEncoder()(stdTx) require.NoError(t, err) - res := tApp.CheckTx( - abci.RequestCheckTx{ + res, err := tApp.CheckTx( + &abci.RequestCheckTx{ Tx: txBytes, Type: abci.CheckTxType_New, }, ) + require.NoError(t, err) if tc.expectPass { require.Zero(t, res.Code, res.Log) @@ -166,13 +167,13 @@ func newBep3GenStateMulti(cdc codec.JSONCodec, deputyAddress sdk.AccAddress) app SupplyLimit: bep3types.SupplyLimit{ Limit: sdkmath.NewInt(350000000000000), TimeLimited: false, - TimeBasedLimit: sdk.ZeroInt(), + TimeBasedLimit: sdkmath.ZeroInt(), TimePeriod: time.Hour, }, Active: true, DeputyAddress: deputyAddress, FixedFee: sdkmath.NewInt(1000), - MinSwapAmount: sdk.OneInt(), + MinSwapAmount: sdkmath.OneInt(), MaxSwapAmount: sdkmath.NewInt(1000000000000), MinBlockLock: bep3types.DefaultMinBlockLock, MaxBlockLock: bep3types.DefaultMaxBlockLock, @@ -181,10 +182,10 @@ func newBep3GenStateMulti(cdc codec.JSONCodec, deputyAddress sdk.AccAddress) app }, Supplies: bep3types.AssetSupplies{ bep3types.NewAssetSupply( - sdk.NewCoin("bnb", sdk.ZeroInt()), - sdk.NewCoin("bnb", sdk.ZeroInt()), - sdk.NewCoin("bnb", sdk.ZeroInt()), - sdk.NewCoin("bnb", sdk.ZeroInt()), + sdk.NewCoin("bnb", sdkmath.ZeroInt()), + sdk.NewCoin("bnb", sdkmath.ZeroInt()), + sdk.NewCoin("bnb", sdkmath.ZeroInt()), + sdk.NewCoin("bnb", sdkmath.ZeroInt()), time.Duration(0), ), }, @@ -255,20 +256,31 @@ func TestAppAnteHandler_RejectMsgsInAuthz(t *testing.T) { txBytes, err := encodingConfig.TxConfig.TxEncoder()(stdTx) require.NoError(t, err) - resCheckTx := tApp.CheckTx( - abci.RequestCheckTx{ + resCheckTx, err := tApp.CheckTx( + &abci.RequestCheckTx{ Tx: txBytes, Type: abci.CheckTxType_New, }, ) + require.NoError(t, err) require.Equal(t, resCheckTx.Code, tc.expectedCode, resCheckTx.Log) - resDeliverTx := tApp.DeliverTx( - abci.RequestDeliverTx{ - Tx: txBytes, + //resDeliverTx := tApp.DeliverTx( + // abci.RequestDeliverTx{ + // Tx: txBytes, + // }, + //) + // TODO(boodyvo): validate if this is the correct way to test deliver tx + resDeliverTx, err := tApp.FinalizeBlock( + &abci.RequestFinalizeBlock{ + Txs: [][]byte{txBytes}, }, ) - require.Equal(t, resDeliverTx.Code, tc.expectedCode, resDeliverTx.Log) + require.NoError(t, err) + for _, tx := range resDeliverTx.TxResults { + require.Equal(t, tx.Code, tc.expectedCode, tx.Log) + } + //require.Equal(t, resDeliverTx.Code, tc.expectedCode, resDeliverTx.Log) }) } } diff --git a/app/ante/authorized.go b/app/ante/authorized.go index b9dd1403fb..48c85c605b 100644 --- a/app/ante/authorized.go +++ b/app/ante/authorized.go @@ -1,6 +1,7 @@ package ante import ( + "bytes" errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -31,29 +32,38 @@ func (amd AuthenticatedMempoolDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, if !ok { return ctx, errorsmod.Wrap(sdkerrors.ErrTxDecode, "tx must be sig verifiable tx") } - if !commonAddressesExist(sigTx.GetSigners(), amd.fetchAuthorizedAddresses(ctx)) { + signers, err := sigTx.GetSigners() + if err != nil { + return ctx, errorsmod.Wrap(sdkerrors.ErrUnauthorized, "tx contains no signers") + } + if !commonAddressesExist(signers, amd.fetchAuthorizedAddresses(ctx)) { return ctx, errorsmod.Wrap(sdkerrors.ErrUnauthorized, "tx contains no signers authorized for this mempool") } } return next(ctx, tx, simulate) } -func (amd AuthenticatedMempoolDecorator) fetchAuthorizedAddresses(ctx sdk.Context) []sdk.AccAddress { - addrs := []sdk.AccAddress{} +func (amd AuthenticatedMempoolDecorator) fetchAuthorizedAddresses(ctx sdk.Context) [][]byte { + addrs := make([][]byte, 0) for _, fetch := range amd.addressFetchers { - addrs = append(addrs, fetch(ctx)...) + addresses := fetch(ctx) + for _, addr := range addresses { + addrs = append(addrs, addr.Bytes()) + } } + return addrs } // commonAddressesExist checks if there is any intersection between two lists of addresses -func commonAddressesExist(addresses1, addresses2 []sdk.AccAddress) bool { +func commonAddressesExist(addresses1, addresses2 [][]byte) bool { for _, a1 := range addresses1 { for _, a2 := range addresses2 { - if a1.Equals(a2) { + if bytes.Equal(a1, a2) { return true } } } + return false } diff --git a/app/ante/eip712_test.go b/app/ante/eip712_test.go index 08aa0fb66d..5763f4944a 100644 --- a/app/ante/eip712_test.go +++ b/app/ante/eip712_test.go @@ -1,6 +1,7 @@ package ante_test import ( + "fmt" "math/big" "testing" "time" @@ -86,7 +87,7 @@ func (suite *EIP712TestSuite) createTestEIP712CosmosTxBuilder( fee := legacytx.NewStdFee(gas, gasAmount) accNumber := suite.tApp.GetAccountKeeper().GetAccount(suite.ctx, from).GetAccountNumber() - data := eip712.ConstructUntypedEIP712Data(chainId, accNumber, nonce, 0, fee, msgs, "", nil) + data := eip712.ConstructUntypedEIP712Data(chainId, accNumber, nonce, 0, fee, msgs, "") typedData, err := eip712.WrapTxToTypedData(ethChainId, msgs, data, &eip712.FeeDelegationOptions{ FeePayer: from, }, suite.tApp.GetEvmKeeper().GetParams(suite.ctx)) @@ -96,7 +97,7 @@ func (suite *EIP712TestSuite) createTestEIP712CosmosTxBuilder( // Sign typedData keyringSigner := tests.NewSigner(priv) - signature, pubKey, err := keyringSigner.SignByAddress(from, sigHash) + signature, pubKey, err := keyringSigner.SignByAddress(from, sigHash, signing.SignMode_SIGN_MODE_LEGACY_AMINO_JSON) suite.Require().NoError(err) signature[crypto.RecoveryIDOffset] += 27 // Transform V from 0/1 to 27/28 according to the yellow paper @@ -180,13 +181,13 @@ func (suite *EIP712TestSuite) SetupTest() { { Denom: USDCCoinDenom, Type: USDCCDPType, - LiquidationRatio: sdk.MustNewDecFromStr("1.01"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("1.01"), DebtLimit: sdk.NewInt64Coin("usdx", 500000000000), - StabilityFee: sdk.OneDec(), + StabilityFee: sdkmath.LegacyOneDec(), AuctionSize: sdkmath.NewIntFromUint64(10000000000), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), + LiquidationPenalty: sdkmath.LegacyMustNewDecFromStr("0.05"), CheckCollateralizationIndexCount: sdkmath.NewInt(10), - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), + KeeperRewardPercentage: sdkmath.LegacyMustNewDecFromStr("0.01"), SpotMarketID: "usdc:usd", LiquidationMarketID: "usdc:usd:30", ConversionFactor: sdkmath.NewInt(18), @@ -199,19 +200,19 @@ func (suite *EIP712TestSuite) SetupTest() { Denom: "usdx", BorrowLimit: hardtypes.BorrowLimit{ HasMaxLimit: true, - MaximumLimit: sdk.MustNewDecFromStr("100000000000"), - LoanToValue: sdk.MustNewDecFromStr("1"), + MaximumLimit: sdkmath.LegacyMustNewDecFromStr("100000000000"), + LoanToValue: sdkmath.LegacyMustNewDecFromStr("1"), }, SpotMarketID: "usdx:usd", ConversionFactor: sdkmath.NewInt(1_000_000), InterestRateModel: hardtypes.InterestRateModel{ - BaseRateAPY: sdk.MustNewDecFromStr("0.05"), - BaseMultiplier: sdk.MustNewDecFromStr("2"), - Kink: sdk.MustNewDecFromStr("0.8"), - JumpMultiplier: sdk.MustNewDecFromStr("10"), + BaseRateAPY: sdkmath.LegacyMustNewDecFromStr("0.05"), + BaseMultiplier: sdkmath.LegacyMustNewDecFromStr("2"), + Kink: sdkmath.LegacyMustNewDecFromStr("0.8"), + JumpMultiplier: sdkmath.LegacyMustNewDecFromStr("10"), }, - ReserveFactor: sdk.MustNewDecFromStr("0.05"), - KeeperRewardPercentage: sdk.ZeroDec(), + ReserveFactor: sdkmath.LegacyMustNewDecFromStr("0.05"), + KeeperRewardPercentage: sdkmath.LegacyZeroDec(), }, } @@ -243,19 +244,19 @@ func (suite *EIP712TestSuite) SetupTest() { { MarketID: "usdx:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("1.00"), + Price: sdkmath.LegacyMustNewDecFromStr("1.00"), Expiry: time.Now().Add(1 * time.Hour), }, { MarketID: "usdc:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("1.00"), + Price: sdkmath.LegacyMustNewDecFromStr("1.00"), Expiry: time.Now().Add(1 * time.Hour), }, { MarketID: "usdc:usd:30", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("1.00"), + Price: sdkmath.LegacyMustNewDecFromStr("1.00"), Expiry: time.Now().Add(1 * time.Hour), }, } @@ -287,11 +288,14 @@ func (suite *EIP712TestSuite) SetupTest() { suite.Require().NoError(err) consAddress := sdk.ConsAddress(consPriv.PubKey().Address()) - ctx := tApp.NewContext(false, tmproto.Header{ - Height: tApp.LastBlockHeight() + 1, - ChainID: ChainID, - Time: time.Now().UTC(), - ProposerAddress: consAddress.Bytes(), + fmt.Println("going to create new context for test") + + ctx := tApp.NewContextLegacy(false, tmproto.Header{ + Height: tApp.LastBlockHeight() + 1, + ChainID: ChainID, + Time: time.Now().UTC(), + //ProposerAddress: sdk.AccAddress(consAddress.Bytes()), + ProposerAddress: consAddress, Version: tmversion.Consensus{ Block: version.BlockProtocol, }, @@ -316,13 +320,15 @@ func (suite *EIP712TestSuite) SetupTest() { // https://github.com/evmos/ethermint/blob/f21592ebfe74da7590eb42ed926dae970b2a9a3f/x/evm/keeper/state_transition.go#L487 // evmkeeper.EVMConfig() will return error "failed to load evm config" if not set valAcc := ðerminttypes.EthAccount{ - BaseAccount: authtypes.NewBaseAccount(sdk.AccAddress(consAddress.Bytes()), nil, 0, 0), + //BaseAccount: authtypes.NewBaseAccount(sdk.AccAddress(consAddress.Bytes()), nil, 0, 0), + // TODO(boodyvo): how to correctly transform the address from consAddress to sdk.AccAddress? + BaseAccount: authtypes.NewBaseAccount(sdk.AccAddress(consAddress), nil, 0, 0), CodeHash: common.BytesToHash(crypto.Keccak256(nil)).String(), } tApp.GetAccountKeeper().SetAccount(ctx, valAcc) _, testAddresses := app.GeneratePrivKeyAddressPairs(1) valAddr := sdk.ValAddress(testAddresses[0].Bytes()) - validator, err := stakingtypes.NewValidator(valAddr, consPriv.PubKey(), stakingtypes.Description{}) + validator, err := stakingtypes.NewValidator(valAddr.String(), consPriv.PubKey(), stakingtypes.Description{}) suite.Require().NoError(err) err = tApp.GetStakingKeeper().SetValidatorByConsAddr(ctx, validator) suite.Require().NoError(err) @@ -450,15 +456,21 @@ func (suite *EIP712TestSuite) SetupTest() { } func (suite *EIP712TestSuite) Commit() { - _ = suite.tApp.Commit() + _, err := suite.tApp.Commit() + suite.Require().NoError(err) header := suite.ctx.BlockHeader() header.Height += 1 - suite.tApp.BeginBlock(abci.RequestBeginBlock{ - Header: header, + // TODO(boodyvo): validate, as we cannot pass the header in full + suite.tApp.FinalizeBlock(&abci.RequestFinalizeBlock{ + Height: header.Height, + //Header: header, }) + //suite.tApp.BeginBlock(abci.RequestBeginBlock{ + // Header: header, + //}) // update ctx - suite.ctx = suite.tApp.NewContext(false, header) + suite.ctx = suite.tApp.NewContextLegacy(false, header) } func (suite *EIP712TestSuite) deployUSDCERC20(app app.TestApp, ctx sdk.Context) evmutiltypes.InternalEVMAddress { @@ -598,7 +610,9 @@ func (suite *EIP712TestSuite) TestEIP712Tx() { for _, tc := range testcases { suite.Run(tc.name, func() { + fmt.Println("updated testcases: going to set up tests") suite.SetupTest() + fmt.Println("updated testcases: setup tests") // create messages to convert, mint, and deposit to lend usdcAmt := suite.getEVMAmount(tc.usdcDepositAmt) @@ -638,12 +652,13 @@ func (suite *EIP712TestSuite) TestEIP712Tx() { txBytes, err := encodingConfig.TxConfig.TxEncoder()(txBuilder.GetTx()) suite.Require().NoError(err) - resCheckTx := suite.tApp.CheckTx( - abci.RequestCheckTx{ + resCheckTx, err := suite.tApp.CheckTx( + &abci.RequestCheckTx{ Tx: txBytes, Type: abci.CheckTxType_New, }, ) + suite.Require().NoError(err) if !tc.failCheckTx { suite.Require().Equal(resCheckTx.Code, uint32(0), resCheckTx.Log) } else { @@ -651,11 +666,19 @@ func (suite *EIP712TestSuite) TestEIP712Tx() { suite.Require().Contains(resCheckTx.Log, tc.errMsg) } - resDeliverTx := suite.tApp.DeliverTx( - abci.RequestDeliverTx{ - Tx: txBytes, - }, - ) + resDeliverTxs, err := suite.tApp.FinalizeBlock( + &abci.RequestFinalizeBlock{ + Txs: [][]byte{txBytes}, + }) + suite.Require().NoError(err) + //resDeliverTx := suite.tApp.DeliverTx( + // abci.RequestDeliverTx{ + // Tx: txBytes, + // }, + //) + + suite.Require().Len(resDeliverTxs.TxResults, 1) + resDeliverTx := resDeliverTxs.TxResults[0] if tc.errMsg == "" { suite.Require().Equal(resDeliverTx.Code, uint32(0), resDeliverTx.Log) @@ -663,7 +686,7 @@ func (suite *EIP712TestSuite) TestEIP712Tx() { // validate user cosmos erc20/usd balance bk := suite.tApp.GetBankKeeper() amt := bk.GetBalance(suite.ctx, suite.testAddr, USDCCoinDenom) - suite.Require().Equal(sdk.ZeroInt(), amt.Amount) + suite.Require().Equal(sdkmath.ZeroInt(), amt.Amount) // validate cdp cdp, found := suite.tApp.GetCDPKeeper().GetCdpByOwnerAndCollateralType(suite.ctx, suite.testAddr, USDCCDPType) @@ -720,11 +743,18 @@ func (suite *EIP712TestSuite) TestEIP712Tx_DepositAndWithdraw() { ) txBytes, err := encodingConfig.TxConfig.TxEncoder()(txBuilder.GetTx()) suite.Require().NoError(err) - resDeliverTx := suite.tApp.DeliverTx( - abci.RequestDeliverTx{ - Tx: txBytes, - }, - ) + resDeliverTxs, err := suite.tApp.FinalizeBlock( + &abci.RequestFinalizeBlock{ + Txs: [][]byte{txBytes}, + }) + suite.Require().NoError(err) + suite.Require().Len(resDeliverTxs.TxResults, 1) + resDeliverTx := resDeliverTxs.TxResults[0] + //resDeliverTx := suite.tApp.DeliverTx( + // abci.RequestDeliverTx{ + // Tx: txBytes, + // }, + //) suite.Require().Equal(resDeliverTx.Code, uint32(0), resDeliverTx.Log) // validate hard @@ -765,11 +795,18 @@ func (suite *EIP712TestSuite) TestEIP712Tx_DepositAndWithdraw() { ) txBytes, err = encodingConfig.TxConfig.TxEncoder()(txBuilder.GetTx()) suite.Require().NoError(err) - resDeliverTx = suite.tApp.DeliverTx( - abci.RequestDeliverTx{ - Tx: txBytes, - }, - ) + resDeliverTxs, err = suite.tApp.FinalizeBlock( + &abci.RequestFinalizeBlock{ + Txs: [][]byte{txBytes}, + }) + suite.Require().NoError(err) + suite.Require().Len(resDeliverTxs.TxResults, 1) + resDeliverTx = resDeliverTxs.TxResults[0] + //resDeliverTx = suite.tApp.DeliverTx( + // abci.RequestDeliverTx{ + // Tx: txBytes, + // }, + //) suite.Require().Equal(resDeliverTx.Code, uint32(0), resDeliverTx.Log) // validate hard & cdp should be repayed @@ -781,7 +818,7 @@ func (suite *EIP712TestSuite) TestEIP712Tx_DepositAndWithdraw() { // validate user cosmos erc20/usd balance bk := suite.tApp.GetBankKeeper() amt := bk.GetBalance(suite.ctx, suite.testAddr, USDCCoinDenom) - suite.Require().Equal(sdk.ZeroInt(), amt.Amount) + suite.Require().Equal(sdkmath.ZeroInt(), amt.Amount) // validate erc20 balance coinBal, err = suite.evmutilKeeper.QueryERC20BalanceOf(suite.ctx, suite.usdcEVMAddr, suite.testEVMAddr) diff --git a/app/ante/min_gas_filter_test.go b/app/ante/min_gas_filter_test.go index b8f00df3b3..c2e7354537 100644 --- a/app/ante/min_gas_filter_test.go +++ b/app/ante/min_gas_filter_test.go @@ -28,7 +28,7 @@ func TestEvmMinGasFilter(t *testing.T) { tApp := app.NewTestApp() handler := ante.NewEvmMinGasFilter(tApp.GetEvmKeeper()) - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) tApp.GetEvmKeeper().SetParams(ctx, evmtypes.Params{ EvmDenom: "akava", }) @@ -72,7 +72,7 @@ func TestEvmMinGasFilter(t *testing.T) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) ctx = ctx.WithMinGasPrices(tc.minGasPrices) mmd := MockAnteHandler{} diff --git a/app/app.go b/app/app.go index 48b99709fd..786fe6b481 100644 --- a/app/app.go +++ b/app/app.go @@ -1,27 +1,33 @@ package app import ( + "cosmossdk.io/client/v2/autocli" + "cosmossdk.io/core/appmodule" + "cosmossdk.io/log" "fmt" - "io" - stdlog "log" - "net/http" - "os" - "path/filepath" - - dbm "github.com/cometbft/cometbft-db" abci "github.com/cometbft/cometbft/abci/types" tmjson "github.com/cometbft/cometbft/libs/json" - tmlog "github.com/cometbft/cometbft/libs/log" + dbm "github.com/cosmos/cosmos-db" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client" + tmservice "github.com/cosmos/cosmos-sdk/client/grpc/cmtservice" nodeservice "github.com/cosmos/cosmos-sdk/client/grpc/node" - "github.com/cosmos/cosmos-sdk/client/grpc/tmservice" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/runtime" + runtimeservices "github.com/cosmos/cosmos-sdk/runtime/services" "github.com/cosmos/cosmos-sdk/server/api" "github.com/cosmos/cosmos-sdk/server/config" servertypes "github.com/cosmos/cosmos-sdk/server/types" - storetypes "github.com/cosmos/cosmos-sdk/store/types" + authcodec "github.com/cosmos/cosmos-sdk/x/auth/codec" + "github.com/spf13/cobra" + "io" + stdlog "log" + "net/http" + "os" + "path/filepath" + //storetypes "github.com/cosmos/cosmos-sdk/store/types" + storetypes "cosmossdk.io/store/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" "github.com/cosmos/cosmos-sdk/version" @@ -38,9 +44,18 @@ import ( "github.com/cosmos/cosmos-sdk/x/bank" bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - "github.com/cosmos/cosmos-sdk/x/capability" - capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper" - capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" + //"github.com/cosmos/cosmos-sdk/x/capability" + //capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" + //capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper" + "cosmossdk.io/x/evidence" + evidencekeeper "cosmossdk.io/x/evidence/keeper" + evidencetypes "cosmossdk.io/x/evidence/types" + //"github.com/Kava-Labs/cosmos-sdk/x/upgrade" + "github.com/cosmos/cosmos-sdk/x/upgrade" + //"cosmossdk.io/x/upgrade" + upgradecli "cosmossdk.io/x/upgrade/client/cli" + upgradekeeper "cosmossdk.io/x/upgrade/keeper" + upgradetypes "cosmossdk.io/x/upgrade/types" consensus "github.com/cosmos/cosmos-sdk/x/consensus" consensusparamkeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper" consensusparamtypes "github.com/cosmos/cosmos-sdk/x/consensus/types" @@ -50,9 +65,6 @@ import ( distr "github.com/cosmos/cosmos-sdk/x/distribution" distrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper" distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" - "github.com/cosmos/cosmos-sdk/x/evidence" - evidencekeeper "github.com/cosmos/cosmos-sdk/x/evidence/keeper" - evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types" "github.com/cosmos/cosmos-sdk/x/genutil" genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" "github.com/cosmos/cosmos-sdk/x/gov" @@ -75,25 +87,24 @@ import ( "github.com/cosmos/cosmos-sdk/x/staking" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "github.com/cosmos/cosmos-sdk/x/upgrade" - upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client" - upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper" - upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/packetforward" - packetforwardkeeper "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/packetforward/keeper" - packetforwardtypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/packetforward/types" - transfer "github.com/cosmos/ibc-go/v7/modules/apps/transfer" - ibctransferkeeper "github.com/cosmos/ibc-go/v7/modules/apps/transfer/keeper" - ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" - ibc "github.com/cosmos/ibc-go/v7/modules/core" - ibcclient "github.com/cosmos/ibc-go/v7/modules/core/02-client" - ibcclientclient "github.com/cosmos/ibc-go/v7/modules/core/02-client/client" - ibcclienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" - ibcporttypes "github.com/cosmos/ibc-go/v7/modules/core/05-port/types" - ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported" - ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper" - solomachine "github.com/cosmos/ibc-go/v7/modules/light-clients/06-solomachine" - ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" + "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8/packetforward" + packetforwardkeeper "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8/packetforward/keeper" + packetforwardtypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8/packetforward/types" + "github.com/cosmos/ibc-go/modules/capability" + capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" + transfer "github.com/cosmos/ibc-go/v8/modules/apps/transfer" + ibctransferkeeper "github.com/cosmos/ibc-go/v8/modules/apps/transfer/keeper" + ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" + ibc "github.com/cosmos/ibc-go/v8/modules/core" + ibcclient "github.com/cosmos/ibc-go/v8/modules/core/02-client" + ibcclientclient "github.com/cosmos/ibc-go/v8/modules/core/02-client/client/cli" + ibcclienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" + ibcporttypes "github.com/cosmos/ibc-go/v8/modules/core/05-port/types" + ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" + ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper" + solomachine "github.com/cosmos/ibc-go/v8/modules/light-clients/06-solomachine" + ibctm "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" "github.com/ethereum/go-ethereum/core/vm" evmante "github.com/evmos/ethermint/app/ante" ethermintconfig "github.com/evmos/ethermint/server/config" @@ -105,6 +116,7 @@ import ( feemarkettypes "github.com/evmos/ethermint/x/feemarket/types" "github.com/gorilla/mux" + addresscodec "github.com/cosmos/cosmos-sdk/codec/address" "github.com/kava-labs/kava/app/ante" kavaparams "github.com/kava-labs/kava/app/params" _ "github.com/kava-labs/kava/precompile/registry" // Ensure precompiles are registered when using the app module @@ -178,8 +190,11 @@ var ( // DefaultNodeHome default home directories for the application daemon DefaultNodeHome string - // ModuleBasics manages simple versions of full app modules. - // It's used for things such as codec registration and genesis file verification. + ac = addresscodec.NewBech32Codec(Bech32MainPrefix) + + LegacyProposalHandler = govclient.NewProposalHandler(func() *cobra.Command { return upgradecli.NewCmdSubmitUpgradeProposal(ac) }) + LegacyCancelProposalHandler = govclient.NewProposalHandler(func() *cobra.Command { return upgradecli.NewCmdSubmitCancelUpgradeProposal(ac) }) + ModuleBasics = module.NewBasicManager( genutil.NewAppModuleBasic(genutiltypes.DefaultMessageValidator), auth.AppModuleBasic{}, @@ -189,10 +204,12 @@ var ( distr.AppModuleBasic{}, gov.NewAppModuleBasic([]govclient.ProposalHandler{ paramsclient.ProposalHandler, - upgradeclient.LegacyProposalHandler, - upgradeclient.LegacyCancelProposalHandler, - ibcclientclient.UpdateClientProposalHandler, - ibcclientclient.UpgradeProposalHandler, + LegacyProposalHandler, + LegacyCancelProposalHandler, + //upgradeclient.LegacyProposalHandler, + //upgradeclient.LegacyCancelProposalHandler, + govclient.NewProposalHandler(ibcclientclient.NewTxCmd), + //ibcclientclient, kavadistclient.ProposalHandler, committeeclient.ProposalHandler, earnclient.DepositProposalHandler, @@ -348,7 +365,8 @@ type App struct { ScopedTransferKeeper capabilitykeeper.ScopedKeeper // the module manager - mm *module.Manager + mm *module.Manager + BasicModuleManager module.BasicManager // simulation manager sm *module.SimulationManager @@ -368,7 +386,7 @@ func init() { // NewApp returns a reference to an initialized App. func NewApp( - logger tmlog.Logger, + logger log.Logger, db dbm.DB, homePath string, traceStore io.Writer, @@ -379,13 +397,23 @@ func NewApp( appCodec := encodingConfig.Marshaler legacyAmino := encodingConfig.Amino interfaceRegistry := encodingConfig.InterfaceRegistry + txConfig := encodingConfig.TxConfig + + if err := txConfig.SigningContext().Validate(); err != nil { + panic(err) + } + + //appCodec := encodingConfig.Marshaler + //legacyAmino := encodingConfig.Amino + //interfaceRegistry := encodingConfig.InterfaceRegistry bApp := baseapp.NewBaseApp(appName, logger, db, encodingConfig.TxConfig.TxDecoder(), baseAppOptions...) bApp.SetCommitMultiStoreTracer(traceStore) bApp.SetVersion(version.Version) bApp.SetInterfaceRegistry(interfaceRegistry) + bApp.SetTxEncoder(txConfig.TxEncoder()) - keys := sdk.NewKVStoreKeys( + keys := storetypes.NewKVStoreKeys( authtypes.StoreKey, banktypes.StoreKey, stakingtypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey, packetforwardtypes.StoreKey, govtypes.StoreKey, paramstypes.StoreKey, ibcexported.StoreKey, @@ -398,8 +426,8 @@ func NewApp( savingstypes.StoreKey, earntypes.StoreKey, minttypes.StoreKey, consensusparamtypes.StoreKey, crisistypes.StoreKey, precisebanktypes.StoreKey, ) - tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey, evmtypes.TransientKey, feemarkettypes.TransientKey) - memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey) + tkeys := storetypes.NewTransientStoreKeys(paramstypes.TStoreKey, evmtypes.TransientKey, feemarkettypes.TransientKey) + memKeys := storetypes.NewMemoryStoreKeys(capabilitytypes.MemStoreKey) // Authority for gov proposals, using the x/gov module account address govAuthAddr := authtypes.NewModuleAddress(govtypes.ModuleName) @@ -448,9 +476,12 @@ func NewApp( earnSubspace := app.paramsKeeper.Subspace(earntypes.ModuleName) mintSubspace := app.paramsKeeper.Subspace(minttypes.ModuleName) + //authAddr := authtypes.NewModuleAddress(govtypes.ModuleName).String() + //app.ConsensusParamsKeeper = consensusparamkeeper.NewKeeper(appCodec, runtime.NewKVStoreService(keys[consensusparamtypes.StoreKey]), authAddr, runtime.EventService{}) + // set the BaseApp's parameter store - app.consensusParamsKeeper = consensusparamkeeper.NewKeeper(appCodec, keys[consensusparamtypes.StoreKey], govAuthAddrStr) - bApp.SetParamStore(&app.consensusParamsKeeper) + app.consensusParamsKeeper = consensusparamkeeper.NewKeeper(appCodec, runtime.NewKVStoreService(keys[consensusparamtypes.StoreKey]), govAuthAddrStr, runtime.EventService{}) + bApp.SetParamStore(&app.consensusParamsKeeper.ParamsStore) app.capabilityKeeper = capabilitykeeper.NewKeeper(appCodec, keys[capabilitytypes.StoreKey], memKeys[capabilitytypes.MemStoreKey]) scopedIBCKeeper := app.capabilityKeeper.ScopeToModule(ibcexported.ModuleName) @@ -460,35 +491,42 @@ func NewApp( // add keepers app.accountKeeper = authkeeper.NewAccountKeeper( appCodec, - keys[authtypes.StoreKey], + runtime.NewKVStoreService(keys[authtypes.StoreKey]), authtypes.ProtoBaseAccount, mAccPerms, + ac, sdk.GetConfig().GetBech32AccountAddrPrefix(), govAuthAddrStr, ) app.bankKeeper = bankkeeper.NewBaseKeeper( appCodec, - keys[banktypes.StoreKey], + runtime.NewKVStoreService(keys[banktypes.StoreKey]), app.accountKeeper, app.loadBlockedMaccAddrs(), govAuthAddrStr, + logger, ) + + // ac = addresscodec.NewBech32Codec(Bech32MainPrefix) app.stakingKeeper = stakingkeeper.NewKeeper( appCodec, - keys[stakingtypes.StoreKey], + runtime.NewKVStoreService(keys[stakingtypes.StoreKey]), app.accountKeeper, app.bankKeeper, govAuthAddrStr, + // TODO(boodyvo): validate which codecs to use. Looks like for validation before it used another codec, using AccAddress + addresscodec.NewBech32Codec(Bech32PrefixValAddr), + addresscodec.NewBech32Codec(Bech32PrefixConsAddr), ) app.authzKeeper = authzkeeper.NewKeeper( - keys[authzkeeper.StoreKey], + runtime.NewKVStoreService(keys[authzkeeper.StoreKey]), appCodec, app.BaseApp.MsgServiceRouter(), app.accountKeeper, ) app.distrKeeper = distrkeeper.NewKeeper( appCodec, - keys[distrtypes.StoreKey], + runtime.NewKVStoreService(keys[distrtypes.StoreKey]), app.accountKeeper, app.bankKeeper, app.stakingKeeper, @@ -498,21 +536,22 @@ func NewApp( app.slashingKeeper = slashingkeeper.NewKeeper( appCodec, app.legacyAmino, - keys[slashingtypes.StoreKey], + runtime.NewKVStoreService(keys[slashingtypes.StoreKey]), app.stakingKeeper, govAuthAddrStr, ) app.crisisKeeper = *crisiskeeper.NewKeeper( appCodec, - keys[crisistypes.StoreKey], + runtime.NewKVStoreService(keys[crisistypes.StoreKey]), options.InvariantCheckPeriod, app.bankKeeper, authtypes.FeeCollectorName, govAuthAddrStr, + ac, ) app.upgradeKeeper = *upgradekeeper.NewKeeper( options.SkipUpgradeHeights, - keys[upgradetypes.StoreKey], + runtime.NewKVStoreService(keys[upgradetypes.StoreKey]), appCodec, homePath, app.BaseApp, @@ -520,9 +559,11 @@ func NewApp( ) app.evidenceKeeper = *evidencekeeper.NewKeeper( appCodec, - keys[evidencetypes.StoreKey], + runtime.NewKVStoreService(keys[evidencetypes.StoreKey]), app.stakingKeeper, app.slashingKeeper, + ac, + runtime.ProvideCometInfoService(), ) app.ibcKeeper = ibckeeper.NewKeeper( @@ -532,6 +573,7 @@ func NewApp( app.stakingKeeper, app.upgradeKeeper, scopedIBCKeeper, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) // Create Ethermint keepers @@ -559,7 +601,9 @@ func NewApp( ) app.evmKeeper = evmkeeper.NewKeeper( - appCodec, keys[evmtypes.StoreKey], tkeys[evmtypes.TransientKey], + appCodec, + keys[evmtypes.StoreKey], + tkeys[evmtypes.TransientKey], govAuthAddr, app.accountKeeper, app.precisebankKeeper, // x/precisebank in place of x/bank @@ -590,10 +634,11 @@ func NewApp( ibctransferSubspace, app.packetForwardKeeper, app.ibcKeeper.ChannelKeeper, - &app.ibcKeeper.PortKeeper, + app.ibcKeeper.PortKeeper, app.accountKeeper, app.bankKeeper, scopedTransferKeeper, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) app.packetForwardKeeper.SetTransferKeeper(app.transferKeeper) transferModule := transfer.NewAppModule(app.transferKeeper) @@ -709,7 +754,7 @@ func NewApp( app.mintKeeper = mintkeeper.NewKeeper( appCodec, - keys[minttypes.StoreKey], + runtime.NewKVStoreService(keys[minttypes.StoreKey]), app.stakingKeeper, app.accountKeeper, app.bankKeeper, @@ -793,6 +838,7 @@ func NewApp( govRouter. AddRoute(govtypes.RouterKey, govv1beta1.ProposalHandler). AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.paramsKeeper)). + // TODO(boodyvo): check the message updates. Looks like this one if not needed anymore. AddRoute(upgradetypes.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(&app.upgradeKeeper)). AddRoute(ibcclienttypes.RouterKey, ibcclient.NewClientProposalHandler(app.ibcKeeper.ClientKeeper)). AddRoute(kavadisttypes.RouterKey, kavadist.NewCommunityPoolMultiSpendProposalHandler(app.kavadistKeeper)). @@ -803,10 +849,11 @@ func NewApp( govConfig := govtypes.DefaultConfig() govKeeper := govkeeper.NewKeeper( appCodec, - keys[govtypes.StoreKey], + runtime.NewKVStoreService(keys[govtypes.StoreKey]), app.accountKeeper, app.bankKeeper, app.stakingKeeper, + app.distrKeeper, app.MsgServiceRouter(), govConfig, govAuthAddrStr, @@ -818,13 +865,15 @@ func NewApp( tallyHandler := NewTallyHandler( app.govKeeper, *app.stakingKeeper, app.savingsKeeper, app.earnKeeper, app.liquidKeeper, app.bankKeeper, + addresscodec.NewBech32Codec(Bech32PrefixValAddr), ) app.govKeeper.SetTallyHandler(tallyHandler) // create the module manager (Note: Any module instantiated in the module manager that is later modified // must be passed by reference here.) app.mm = module.NewManager( - genutil.NewAppModule(app.accountKeeper, app.stakingKeeper, app.BaseApp.DeliverTx, encodingConfig.TxConfig), + // TODO(boodyvo): deliverTx -> app is in sdk ? + genutil.NewAppModule(app.accountKeeper, app.stakingKeeper, app, encodingConfig.TxConfig), auth.NewAppModule(appCodec, app.accountKeeper, authsims.RandomGenesisAccounts, authSubspace), bank.NewAppModule(appCodec, app.bankKeeper, app.accountKeeper, bankSubspace), capability.NewAppModule(appCodec, *app.capabilityKeeper, false), // todo: confirm if this is okay to not be sealed @@ -833,13 +882,15 @@ func NewApp( gov.NewAppModule(appCodec, &app.govKeeper, app.accountKeeper, app.bankKeeper, govSubspace), params.NewAppModule(app.paramsKeeper), crisis.NewAppModule(&app.crisisKeeper, options.SkipGenesisInvariants, crisisSubspace), - slashing.NewAppModule(appCodec, app.slashingKeeper, app.accountKeeper, app.bankKeeper, app.stakingKeeper, slashingSubspace), + slashing.NewAppModule(appCodec, app.slashingKeeper, app.accountKeeper, app.bankKeeper, app.stakingKeeper, slashingSubspace, app.interfaceRegistry), consensus.NewAppModule(appCodec, app.consensusParamsKeeper), ibc.NewAppModule(app.ibcKeeper), + // TODO(boodyvo): check if this is needed. We want to register /ibc.lightclients.tendermint.v1.ClientState + ibctm.NewAppModule(), packetforward.NewAppModule(app.packetForwardKeeper, packetforwardSubspace), evm.NewAppModule(app.evmKeeper, app.accountKeeper), feemarket.NewAppModule(app.feeMarketKeeper, feemarketSubspace), - upgrade.NewAppModule(&app.upgradeKeeper), + upgrade.NewAppModule(&app.upgradeKeeper, ac), evidence.NewAppModule(app.evidenceKeeper), transferModule, vesting.NewAppModule(app.accountKeeper, app.bankKeeper), @@ -867,11 +918,43 @@ func NewApp( precisebank.NewAppModule(app.precisebankKeeper, app.bankKeeper, app.accountKeeper), ) + // BasicModuleManager defines the module BasicManager is in charge of setting up basic, + // non-dependant module elements, such as codec registration and genesis verification. + // By default, it is composed of all the module from the module manager. + // Additionally, app module basics can be overwritten by passing them as argument. + app.BasicModuleManager = module.NewBasicManagerFromManager( + app.mm, + map[string]module.AppModuleBasic{ + genutiltypes.ModuleName: genutil.NewAppModuleBasic(genutiltypes.DefaultMessageValidator), + govtypes.ModuleName: gov.NewAppModuleBasic([]govclient.ProposalHandler{ + paramsclient.ProposalHandler, + //LegacyProposalHandler, + //LegacyCancelProposalHandler, + ////upgradeclient.LegacyProposalHandler, + ////upgradeclient.LegacyCancelProposalHandler, + //govclient.NewProposalHandler(ibcclientclient.NewTxCmd), + ////ibcclientclient, + //kavadistclient.ProposalHandler, + //committeeclient.ProposalHandler, + //earnclient.DepositProposalHandler, + //earnclient.WithdrawProposalHandler, + //communityclient.LendDepositProposalHandler, + //communityclient.LendWithdrawProposalHandler, + }), + ibctm.ModuleName: ibctm.NewAppModule(), + }) + app.BasicModuleManager.RegisterLegacyAminoCodec(legacyAmino) + app.BasicModuleManager.RegisterInterfaces(interfaceRegistry) + + // NOTE: upgrade module is required to be prioritized + app.mm.SetOrderPreBlockers( + // Upgrade begin blocker runs migrations on the first block after an upgrade. It should run before any other module. + upgradetypes.ModuleName, + ) + // Warning: Some begin blockers must run before others. Ensure the dependencies are understood before modifying this list. app.mm.SetOrderBeginBlockers( metricstypes.ModuleName, - // Upgrade begin blocker runs migrations on the first block after an upgrade. It should run before any other module. - upgradetypes.ModuleName, // Capability begin blocker runs non state changing initialization. capabilitytypes.ModuleName, // Committee begin blocker changes module params by enacting proposals. @@ -923,6 +1006,8 @@ func NewApp( precisebanktypes.ModuleName, ) + app.SetPreBlocker(app.PreBlocker) + // Warning: Some end blockers must run before others. Ensure the dependencies are understood before modifying this list. app.mm.SetOrderEndBlockers( crisistypes.ModuleName, @@ -1097,17 +1182,22 @@ func (app *App) RegisterServices(cfg module.Configurator) { } // BeginBlocker contains app specific logic for the BeginBlock abci call. -func (app *App) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock { - return app.mm.BeginBlock(ctx, req) +func (app *App) BeginBlocker(ctx sdk.Context) (sdk.BeginBlock, error) { + return app.mm.BeginBlock(ctx) } // EndBlocker contains app specific logic for the EndBlock abci call. -func (app *App) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock { - return app.mm.EndBlock(ctx, req) +func (app *App) EndBlocker(ctx sdk.Context) (sdk.EndBlock, error) { + return app.mm.EndBlock(ctx) +} + +// TODO(boodyvo): check what is this and why do we ignore req +func (app *App) PreBlocker(ctx sdk.Context, req *abci.RequestFinalizeBlock) (*sdk.ResponsePreBlock, error) { + return app.mm.PreBlock(ctx) } // InitChainer contains app specific logic for the InitChain abci call. -func (app *App) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain { +func (app *App) InitChainer(ctx sdk.Context, req *abci.RequestInitChain) (*abci.ResponseInitChain, error) { var genesisState GenesisState if err := tmjson.Unmarshal(req.AppStateBytes, &genesisState); err != nil { panic(err) @@ -1158,7 +1248,7 @@ func (app *App) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig // Register GRPC Gateway routes tmservice.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) authtx.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) - ModuleBasics.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) + app.BasicModuleManager.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) nodeservice.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) // Swagger API configuration is ignored @@ -1208,8 +1298,8 @@ func (app *App) RegisterTendermintService(clientCtx client.Context) { ) } -func (app *App) RegisterNodeService(clientCtx client.Context) { - nodeservice.RegisterNodeService(clientCtx, app.BaseApp.GRPCQueryRouter()) +func (app *App) RegisterNodeService(clientCtx client.Context, cfg config.Config) { + nodeservice.RegisterNodeService(clientCtx, app.BaseApp.GRPCQueryRouter(), cfg) } // loadBlockedMaccAddrs returns a map indicating the blocked status of each module account address @@ -1238,6 +1328,27 @@ func (app *App) loadBlockedMaccAddrs() map[string]bool { return modAccAddrs } +// AutoCliOpts returns the autocli options for the app. +func (app *App) AutoCliOpts() autocli.AppOptions { + modules := make(map[string]appmodule.AppModule, 0) + for _, m := range app.mm.Modules { + if moduleWithName, ok := m.(module.HasName); ok { + moduleName := moduleWithName.Name() + if appModule, ok := moduleWithName.(appmodule.AppModule); ok { + modules[moduleName] = appModule + } + } + } + + return autocli.AppOptions{ + Modules: modules, + ModuleOptions: runtimeservices.ExtractAutoCLIOptions(app.mm.Modules), + AddressCodec: authcodec.NewBech32Codec(sdk.GetConfig().GetBech32AccountAddrPrefix()), + ValidatorAddressCodec: authcodec.NewBech32Codec(sdk.GetConfig().GetBech32ValidatorAddrPrefix()), + ConsensusAddressCodec: authcodec.NewBech32Codec(sdk.GetConfig().GetBech32ConsensusAddrPrefix()), + } +} + // GetMaccPerms returns a mapping of the application's module account permissions. func GetMaccPerms() map[string][]string { perms := make(map[string][]string) diff --git a/app/app_test.go b/app/app_test.go index 5d503b75b6..050fd484d9 100644 --- a/app/app_test.go +++ b/app/app_test.go @@ -3,22 +3,21 @@ package app import ( "encoding/json" "fmt" - "os" "sort" "testing" "time" - db "github.com/cometbft/cometbft-db" + "cosmossdk.io/log" abci "github.com/cometbft/cometbft/abci/types" - "github.com/cometbft/cometbft/libs/log" + db "github.com/cosmos/cosmos-db" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" - solomachine "github.com/cosmos/ibc-go/v7/modules/light-clients/06-solomachine" - ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" + solomachine "github.com/cosmos/ibc-go/v8/modules/light-clients/06-solomachine" + ibctm "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" "github.com/ethereum/go-ethereum/precompile/modules" evmtypes "github.com/evmos/ethermint/x/evm/types" "github.com/stretchr/testify/assert" @@ -28,7 +27,8 @@ import ( func TestNewApp(t *testing.T) { SetSDKConfig() NewApp( - log.NewTMLogger(log.NewSyncWriter(os.Stdout)), + log.NewTestLogger(t), + //log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db.NewMemDB(), DefaultNodeHome, nil, @@ -40,14 +40,17 @@ func TestNewApp(t *testing.T) { func TestExport(t *testing.T) { SetSDKConfig() db := db.NewMemDB() - app := NewApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, DefaultNodeHome, nil, MakeEncodingConfig(), DefaultOptions, baseapp.SetChainID(TestChainId)) + app := NewApp( + log.NewTestLogger(t), + //log.NewTMLogger(log.NewSyncWriter(os.Stdout)), + db, DefaultNodeHome, nil, MakeEncodingConfig(), DefaultOptions, baseapp.SetChainID(TestChainId)) - genesisState := GenesisStateWithSingleValidator(&TestApp{App: *app}, NewDefaultGenesisState()) + genesisState, _ := GenesisStateWithSingleValidator(&TestApp{App: *app}, NewDefaultGenesisState()) stateBytes, err := json.Marshal(genesisState) require.NoError(t, err) - initRequest := abci.RequestInitChain{ + initRequest := &abci.RequestInitChain{ Time: time.Date(1998, 1, 1, 0, 0, 0, 0, time.UTC), ChainId: TestChainId, InitialHeight: 1, @@ -58,16 +61,24 @@ func TestExport(t *testing.T) { app.InitChain(initRequest) app.Commit() + fmt.Println("Exporting genesis...") + exportedApp, err := app.ExportAppStateAndValidators(false, []string{}, []string{}) require.NoError(t, err) + fmt.Println("Exported genesis") + // Assume each module is exported correctly, so only check modules in genesis are present in export initialModules, err := unmarshalJSONKeys(initRequest.AppStateBytes) require.NoError(t, err) + + fmt.Println("Initial modules") // note ibctm is only registered in the BasicManager and not module manager so can be ignored initialModules = removeIbcTmModule(initialModules) exportedModules, err := unmarshalJSONKeys(exportedApp.AppState) require.NoError(t, err) + + fmt.Println("Exported modules") assert.ElementsMatch(t, initialModules, exportedModules) assert.Equal(t, initRequest.InitialHeight+1, exportedApp.Height) // app.Commit() increments height diff --git a/app/encoding.go b/app/encoding.go index 17445f1070..e1c2d9f497 100644 --- a/app/encoding.go +++ b/app/encoding.go @@ -1,17 +1,13 @@ package app import ( - enccodec "github.com/evmos/ethermint/encoding/codec" - "github.com/kava-labs/kava/app/params" ) // MakeEncodingConfig creates an EncodingConfig and registers the app's types on it. func MakeEncodingConfig() params.EncodingConfig { encodingConfig := params.MakeEncodingConfig() - enccodec.RegisterLegacyAminoCodec(encodingConfig.Amino) - enccodec.RegisterInterfaces(encodingConfig.InterfaceRegistry) - ModuleBasics.RegisterLegacyAminoCodec(encodingConfig.Amino) - ModuleBasics.RegisterInterfaces(encodingConfig.InterfaceRegistry) + //ModuleBasics.RegisterLegacyAminoCodec(encodingConfig.Amino) + //ModuleBasics.RegisterInterfaces(encodingConfig.InterfaceRegistry) return encodingConfig } diff --git a/app/export.go b/app/export.go index b90f0ce5fe..058b41a5c5 100644 --- a/app/export.go +++ b/app/export.go @@ -1,10 +1,10 @@ package app import ( + storetypes "cosmossdk.io/store/types" "encoding/json" - "log" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + "log" servertypes "github.com/cosmos/cosmos-sdk/server/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -18,7 +18,7 @@ func (app *App) ExportAppStateAndValidators(forZeroHeight bool, jailWhiteList [] ) (servertypes.ExportedApp, error) { // as if they could withdraw from the start of the next block // block time is not available and defaults to Jan 1st, 0001 - ctx := app.NewContext(true, tmproto.Header{Height: app.LastBlockHeight()}) + ctx := app.NewContextLegacy(true, tmproto.Header{Height: app.LastBlockHeight()}) height := app.LastBlockHeight() + 1 if forZeroHeight { @@ -26,7 +26,10 @@ func (app *App) ExportAppStateAndValidators(forZeroHeight bool, jailWhiteList [] app.prepForZeroHeightGenesis(ctx, jailWhiteList) } - genState := app.mm.ExportGenesisForModules(ctx, app.appCodec, modulesToExport) + genState, err := app.mm.ExportGenesisForModules(ctx, app.appCodec, modulesToExport) + if err != nil { + return servertypes.ExportedApp{}, err + } newAppState, err := json.MarshalIndent(genState, "", " ") if err != nil { return servertypes.ExportedApp{}, err @@ -40,6 +43,7 @@ func (app *App) ExportAppStateAndValidators(forZeroHeight bool, jailWhiteList [] }, err } +// TODO(boodyvo): should we return error here? // prepare for fresh start at zero height // NOTE zero height genesis is a temporary feature which will be deprecated // in favour of export at a block height @@ -68,12 +72,20 @@ func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailWhiteList []string // withdraw all validator commission app.stakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) { - _, _ = app.distrKeeper.WithdrawValidatorCommission(ctx, val.GetOperator()) + valAddr, err := app.stakingKeeper.ValidatorAddressCodec().StringToBytes(val.GetOperator()) + if err != nil { + // should we panic? + panic(err) + } + _, _ = app.distrKeeper.WithdrawValidatorCommission(ctx, valAddr) return false }) // withdraw all delegator rewards - dels := app.stakingKeeper.GetAllDelegations(ctx) + dels, err := app.stakingKeeper.GetAllDelegations(ctx) + if err != nil { + log.Fatal(err) + } for _, delegation := range dels { valAddr, err := sdk.ValAddressFromBech32(delegation.ValidatorAddress) if err != nil { @@ -100,12 +112,16 @@ func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailWhiteList []string // reinitialize all validators app.stakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) { // donate any unwithdrawn outstanding reward fraction tokens to the community pool - scraps := app.distrKeeper.GetValidatorOutstandingRewardsCoins(ctx, val.GetOperator()) + scraps, err := app.distrKeeper.GetValidatorOutstandingRewardsCoins(ctx, []byte(val.GetOperator())) + if err != nil { + // TODO(boodyvo): false or panic? + return false + } feePool := app.distrKeeper.GetFeePool(ctx) feePool.CommunityPool = feePool.CommunityPool.Add(scraps...) app.distrKeeper.SetFeePool(ctx, feePool) - app.distrKeeper.Hooks().AfterValidatorCreated(ctx, val.GetOperator()) + app.distrKeeper.Hooks().AfterValidatorCreated(ctx, []byte(val.GetOperator())) return false }) @@ -149,13 +165,13 @@ func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailWhiteList []string // Iterate through validators by power descending, reset bond heights, and // update bond intra-tx counters. store := ctx.KVStore(app.keys[stakingtypes.StoreKey]) - iter := sdk.KVStoreReversePrefixIterator(store, stakingtypes.ValidatorsKey) + iter := storetypes.KVStoreReversePrefixIterator(store, stakingtypes.ValidatorsKey) counter := int16(0) for ; iter.Valid(); iter.Next() { addr := sdk.ValAddress(stakingtypes.AddressFromValidatorsKey(iter.Key())) - validator, found := app.stakingKeeper.GetValidator(ctx, addr) - if !found { + validator, err := app.stakingKeeper.GetValidator(ctx, addr) + if err != nil { panic("expected validator, not found") } @@ -170,7 +186,7 @@ func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailWhiteList []string iter.Close() - _, err := app.stakingKeeper.ApplyAndReturnValidatorSetUpdates(ctx) + _, err = app.stakingKeeper.ApplyAndReturnValidatorSetUpdates(ctx) if err != nil { log.Fatal(err) } diff --git a/app/genesis.go b/app/genesis.go index 87596284ef..e8aa9305e4 100644 --- a/app/genesis.go +++ b/app/genesis.go @@ -1,7 +1,9 @@ package app import ( + "cosmossdk.io/log" "encoding/json" + dbm "github.com/cosmos/cosmos-db" ) // GenesisState represents the genesis state of the blockchain. It is a map from module names to module genesis states. @@ -10,5 +12,7 @@ type GenesisState map[string]json.RawMessage // NewDefaultGenesisState generates the default state for the application. func NewDefaultGenesisState() GenesisState { encCfg := MakeEncodingConfig() - return ModuleBasics.DefaultGenesis(encCfg.Marshaler) + tempApp := NewApp(log.NewNopLogger(), dbm.NewMemDB(), DefaultNodeHome, nil, encCfg, DefaultOptions) + + return tempApp.BasicModuleManager.DefaultGenesis(encCfg.Marshaler) } diff --git a/app/params/encoding.go b/app/params/encoding.go index 2e030a2051..72412e20ce 100644 --- a/app/params/encoding.go +++ b/app/params/encoding.go @@ -1,10 +1,21 @@ package params import ( + "cosmossdk.io/x/tx/signing" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/codec/address" "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" "github.com/cosmos/cosmos-sdk/x/auth/tx" + "github.com/cosmos/gogoproto/proto" + enccodec "github.com/evmos/ethermint/encoding/codec" + evmtypes "github.com/evmos/ethermint/x/evm/types" + cdptypes "github.com/kava-labs/kava/x/cdp/types" + communitytypes "github.com/kava-labs/kava/x/community/types" + evmutiltypes "github.com/kava-labs/kava/x/evmutil/types" + "google.golang.org/protobuf/reflect/protoreflect" ) // EncodingConfig specifies the concrete encoding types to use for a given app. @@ -19,9 +30,46 @@ type EncodingConfig struct { // MakeEncodingConfig creates a new EncodingConfig. func MakeEncodingConfig() EncodingConfig { amino := codec.NewLegacyAmino() - interfaceRegistry := types.NewInterfaceRegistry() + signingOptions := signing.Options{ + AddressCodec: address.Bech32Codec{ + Bech32Prefix: sdk.GetConfig().GetBech32AccountAddrPrefix(), + }, + ValidatorAddressCodec: address.Bech32Codec{ + Bech32Prefix: sdk.GetConfig().GetBech32ValidatorAddrPrefix(), + }, + CustomGetSigners: map[protoreflect.FullName]signing.GetSignersFunc{ + evmtypes.MsgEthereumTxGetSigner.MsgType: evmtypes.MsgEthereumTxGetSigner.Fn, + evmutiltypes.MsgConvertCoinToERC20GetSigners.MsgType: evmutiltypes.MsgConvertCoinToERC20GetSigners.Fn, + evmutiltypes.MsgConvertERC20ToCoinGetSigners.MsgType: evmutiltypes.MsgConvertERC20ToCoinGetSigners.Fn, + evmutiltypes.MsgConvertCosmosCoinToERC20GetSigners.MsgType: evmutiltypes.MsgConvertCosmosCoinToERC20GetSigners.Fn, + evmutiltypes.MsgConvertCosmosCoinFromERC20GetSigners.MsgType: evmutiltypes.MsgConvertCosmosCoinFromERC20GetSigners.Fn, + cdptypes.MsgCreateCDPGetSigners.MsgType: cdptypes.MsgCreateCDPGetSigners.Fn, + cdptypes.MsgDepositGetSigners.MsgType: cdptypes.MsgDepositGetSigners.Fn, + cdptypes.MsgWithdrawGetSigners.MsgType: cdptypes.MsgWithdrawGetSigners.Fn, + cdptypes.MsgDrawDebtGetSigners.MsgType: cdptypes.MsgDrawDebtGetSigners.Fn, + cdptypes.MsgRepayDebtGetSigners.MsgType: cdptypes.MsgRepayDebtGetSigners.Fn, + cdptypes.MsgLiquidateGetSigners.MsgType: cdptypes.MsgLiquidateGetSigners.Fn, + // MsgFundCommunityPoolGetSigners + // MsgUpdateParamsSigners + communitytypes.MsgFundCommunityPoolGetSigners.MsgType: communitytypes.MsgFundCommunityPoolGetSigners.Fn, + communitytypes.MsgUpdateParamsSigners.MsgType: communitytypes.MsgUpdateParamsSigners.Fn, + }, + } + interfaceRegistry, _ := types.NewInterfaceRegistryWithOptions(types.InterfaceRegistryOptions{ + ProtoFiles: proto.HybridResolver, + SigningOptions: signingOptions, + }) + //interfaceRegistry := types.NewInterfaceRegistry() marshaler := codec.NewProtoCodec(interfaceRegistry) txCfg := tx.NewTxConfig(marshaler, tx.DefaultSignModes) + if txCfg.SigningContext().Validate() != nil { + panic("invalid tx signing context") + } + + enccodec.RegisterLegacyAminoCodec(amino) + enccodec.RegisterInterfaces(interfaceRegistry) + + legacytx.RegressionTestingAminoCodec = amino return EncodingConfig{ InterfaceRegistry: interfaceRegistry, diff --git a/app/tally_handler.go b/app/tally_handler.go index 5a341c7e34..d81aa42963 100644 --- a/app/tally_handler.go +++ b/app/tally_handler.go @@ -1,6 +1,8 @@ package app import ( + "context" + addresscodec "cosmossdk.io/core/address" sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" @@ -18,56 +20,84 @@ var _ govv1.TallyHandler = TallyHandler{} // TallyHandler is the tally handler for kava type TallyHandler struct { - gk govkeeper.Keeper - stk stakingkeeper.Keeper - svk savingskeeper.Keeper - ek earnkeeper.Keeper - lk liquidkeeper.Keeper - bk bankkeeper.Keeper + gk govkeeper.Keeper + stk stakingkeeper.Keeper + svk savingskeeper.Keeper + ek earnkeeper.Keeper + lk liquidkeeper.Keeper + bk bankkeeper.Keeper + validatorAddressCodec addresscodec.Codec } // NewTallyHandler creates a new tally handler. func NewTallyHandler( gk govkeeper.Keeper, stk stakingkeeper.Keeper, svk savingskeeper.Keeper, ek earnkeeper.Keeper, lk liquidkeeper.Keeper, bk bankkeeper.Keeper, + validatorAddressCodec addresscodec.Codec, ) TallyHandler { + if validatorAddressCodec == nil { + panic("validator address codec is nil") + } + return TallyHandler{ - gk: gk, - stk: stk, - svk: svk, - ek: ek, - lk: lk, - bk: bk, + gk: gk, + stk: stk, + svk: svk, + ek: ek, + lk: lk, + bk: bk, + validatorAddressCodec: validatorAddressCodec, } } +// need the method: Tally(context.Context, Proposal) (passes bool, burnDeposits bool, tallyResults TallyResult, err error) +// have the method: Tally(ctx context.Context, proposal govv1.Proposal) (passes bool, burnDeposits bool, tallyResults govv1.TallyResult) + func (th TallyHandler) Tally( - ctx sdk.Context, + ctx context.Context, proposal govv1.Proposal, -) (passes bool, burnDeposits bool, tallyResults govv1.TallyResult) { - results := make(map[govv1.VoteOption]sdk.Dec) - results[govv1.OptionYes] = sdk.ZeroDec() - results[govv1.OptionAbstain] = sdk.ZeroDec() - results[govv1.OptionNo] = sdk.ZeroDec() - results[govv1.OptionNoWithVeto] = sdk.ZeroDec() - - totalVotingPower := sdk.ZeroDec() +) (passes bool, burnDeposits bool, tallyResults govv1.TallyResult, err error) { + results := make(map[govv1.VoteOption]sdkmath.LegacyDec) + results[govv1.OptionYes] = sdkmath.LegacyZeroDec() + results[govv1.OptionAbstain] = sdkmath.LegacyZeroDec() + results[govv1.OptionNo] = sdkmath.LegacyZeroDec() + results[govv1.OptionNoWithVeto] = sdkmath.LegacyZeroDec() + + totalVotingPower := sdkmath.LegacyZeroDec() currValidators := make(map[string]govv1.ValidatorGovInfo) // fetch all the bonded validators, insert them into currValidators th.stk.IterateBondedValidatorsByPower(ctx, func(index int64, validator stakingtypes.ValidatorI) (stop bool) { - currValidators[validator.GetOperator().String()] = govv1.NewValidatorGovInfo( - validator.GetOperator(), + validatorAddr, err := th.validatorAddressCodec.StringToBytes(validator.GetOperator()) + if err != nil { + // TODO(boodyvo): What should we do here: skip or stop? + panic(err) + } + currValidators[validator.GetOperator()] = govv1.NewValidatorGovInfo( + validatorAddr, validator.GetBondedTokens(), validator.GetDelegatorShares(), - sdk.ZeroDec(), + sdkmath.LegacyZeroDec(), govv1.WeightedVoteOptions{}, ) return false }) - th.gk.IterateVotes(ctx, proposal.Id, func(vote govv1.Vote) bool { + // Cannot use 'func(key []byte, value []byte) bool { }' (type func(key []byte, value []byte) bool) as the type Order + iterator, err := th.gk.Votes.Iterate(ctx, nil) + if err != nil { + panic(err) + } + + sdkCtx := sdk.UnwrapSDKContext(ctx) + + for ; iterator.Valid(); iterator.Next() { + vote, err := iterator.Value() + if err != nil { + panic(err) + } + // if validator, just record it in the map voter, err := sdk.AccAddressFromBech32(vote.Voter) @@ -83,7 +113,7 @@ func (th TallyHandler) Tally( // iterate over all delegations from voter, deduct from any delegated-to validators th.stk.IterateDelegations(ctx, voter, func(index int64, delegation stakingtypes.DelegationI) (stop bool) { - valAddrStr := delegation.GetValidatorAddr().String() + valAddrStr := delegation.GetValidatorAddr() if val, ok := currValidators[valAddrStr]; ok { // There is no need to handle the special case that validator address equal to voter address. @@ -95,7 +125,7 @@ func (th TallyHandler) Tally( votingPower := delegation.GetShares().MulInt(val.BondedTokens).Quo(val.DelegatorShares) for _, option := range vote.Options { - subPower := votingPower.Mul(sdk.MustNewDecFromStr(option.Weight)) + subPower := votingPower.Mul(sdkmath.LegacyMustNewDecFromStr(option.Weight)) results[option.Option] = results[option.Option].Add(subPower) } totalVotingPower = totalVotingPower.Add(votingPower) @@ -105,7 +135,7 @@ func (th TallyHandler) Tally( }) // get voter bkava and update total voting power and results - addrBkava := th.getAddrBkava(ctx, voter).toCoins() + addrBkava := th.getAddrBkava(sdkCtx, voter).toCoins() for _, coin := range addrBkava { valAddr, err := liquidtypes.ParseLiquidStakingTokenDenom(coin.Denom) if err != nil { @@ -115,28 +145,110 @@ func (th TallyHandler) Tally( // reduce delegator shares by the amount of voter bkava for the validator valAddrStr := valAddr.String() if val, ok := currValidators[valAddrStr]; ok { - val.DelegatorDeductions = val.DelegatorDeductions.Add(sdk.NewDecFromInt(coin.Amount)) + val.DelegatorDeductions = val.DelegatorDeductions.Add(sdkmath.LegacyNewDecFromInt(coin.Amount)) currValidators[valAddrStr] = val } // votingPower = amount of ukava coin - stakedCoins, err := th.lk.GetStakedTokensForDerivatives(ctx, sdk.NewCoins(coin)) + stakedCoins, err := th.lk.GetStakedTokensForDerivatives(sdkCtx, sdk.NewCoins(coin)) if err != nil { // error is returned only if the bkava denom is incorrect, which should never happen here. panic(err) } - votingPower := sdk.NewDecFromInt(stakedCoins.Amount) + votingPower := sdkmath.LegacyNewDecFromInt(stakedCoins.Amount) for _, option := range vote.Options { - subPower := votingPower.Mul(sdk.MustNewDecFromStr(option.Weight)) + subPower := votingPower.Mul(sdkmath.LegacyMustNewDecFromStr(option.Weight)) results[option.Option] = results[option.Option].Add(subPower) } totalVotingPower = totalVotingPower.Add(votingPower) } - th.gk.DeleteVote(ctx, vote.ProposalId, voter) - return false - }) + // TODO(boodyvo): check here. This one deletes all votes from proposal ID, not just particular one + th.gk.DeleteVote(ctx, vote.ProposalId) + } + + iterator, err = th.gk.Votes.Iterate(ctx, nil) + if err != nil { + panic(err) + } + + for ; iterator.Valid(); iterator.Next() { + vote, err := iterator.Value() + if err != nil { + panic(err) + } + // if validator, just record it in the map + voter, err := sdk.AccAddressFromBech32(vote.Voter) + + if err != nil { + panic(err) + } + + valAddrStr := sdk.ValAddress(voter.Bytes()).String() + if val, ok := currValidators[valAddrStr]; ok { + val.Vote = vote.Options + currValidators[valAddrStr] = val + } + + // iterate over all delegations from voter, deduct from any delegated-to validators + th.stk.IterateDelegations(ctx, voter, func(index int64, delegation stakingtypes.DelegationI) (stop bool) { + valAddrStr := delegation.GetValidatorAddr() + + if val, ok := currValidators[valAddrStr]; ok { + // There is no need to handle the special case that validator address equal to voter address. + // Because voter's voting power will tally again even if there will deduct voter's voting power from validator. + val.DelegatorDeductions = val.DelegatorDeductions.Add(delegation.GetShares()) + currValidators[valAddrStr] = val + + // delegation shares * bonded / total shares + votingPower := delegation.GetShares().MulInt(val.BondedTokens).Quo(val.DelegatorShares) + + for _, option := range vote.Options { + subPower := votingPower.Mul(sdkmath.LegacyMustNewDecFromStr(option.Weight)) + results[option.Option] = results[option.Option].Add(subPower) + } + totalVotingPower = totalVotingPower.Add(votingPower) + } + + return false + }) + + // get voter bkava and update total voting power and results + addrBkava := th.getAddrBkava(sdkCtx, voter).toCoins() + for _, coin := range addrBkava { + valAddr, err := liquidtypes.ParseLiquidStakingTokenDenom(coin.Denom) + if err != nil { + break + } + + // reduce delegator shares by the amount of voter bkava for the validator + valAddrStr := valAddr.String() + if val, ok := currValidators[valAddrStr]; ok { + val.DelegatorDeductions = val.DelegatorDeductions.Add(sdkmath.LegacyNewDecFromInt(coin.Amount)) + currValidators[valAddrStr] = val + } + + // votingPower = amount of ukava coin + stakedCoins, err := th.lk.GetStakedTokensForDerivatives(sdkCtx, sdk.NewCoins(coin)) + if err != nil { + // error is returned only if the bkava denom is incorrect, which should never happen here. + panic(err) + } + votingPower := sdkmath.LegacyNewDecFromInt(stakedCoins.Amount) + + for _, option := range vote.Options { + subPower := votingPower.Mul(sdkmath.LegacyMustNewDecFromStr(option.Weight)) + results[option.Option] = results[option.Option].Add(subPower) + } + totalVotingPower = totalVotingPower.Add(votingPower) + } + + // TODO(boodyvo): check this one. This switch to removed all votes, + //th.gk.DeleteVote(ctx, vote.ProposalId, voter) + th.gk.DeleteVote(ctx, vote.ProposalId) + //return false + } // iterate over the validators again to tally their voting power for _, val := range currValidators { @@ -148,44 +260,56 @@ func (th TallyHandler) Tally( votingPower := sharesAfterDeductions.MulInt(val.BondedTokens).Quo(val.DelegatorShares) for _, option := range val.Vote { - subPower := votingPower.Mul(sdk.MustNewDecFromStr(option.Weight)) + subPower := votingPower.Mul(sdkmath.LegacyMustNewDecFromStr(option.Weight)) results[option.Option] = results[option.Option].Add(subPower) } totalVotingPower = totalVotingPower.Add(votingPower) } - tallyParams := th.gk.GetParams(ctx) + tallyParams, err := th.gk.Params.Get(ctx) + if err != nil { + return false, false, govv1.TallyResult{}, err + } tallyResults = govv1.NewTallyResultFromMap(results) + totalBondedTokens, err := th.stk.TotalBondedTokens(ctx) + if err != nil { + return false, false, tallyResults, err + } // TODO: Upgrade the spec to cover all of these cases & remove pseudocode. // If there is no staked coins, the proposal fails - if th.stk.TotalBondedTokens(ctx).IsZero() { - return false, false, tallyResults + if totalBondedTokens.IsZero() { + // TODO(boodyvo): return particular error + return false, false, tallyResults, nil } // If there is not enough quorum of votes, the proposal fails - percentVoting := totalVotingPower.Quo(sdk.NewDecFromInt(th.stk.TotalBondedTokens(ctx))) - if percentVoting.LT(sdk.MustNewDecFromStr(tallyParams.Quorum)) { - return false, tallyParams.BurnVoteQuorum, tallyResults + percentVoting := totalVotingPower.Quo(sdkmath.LegacyNewDecFromInt(totalBondedTokens)) + if percentVoting.LT(sdkmath.LegacyMustNewDecFromStr(tallyParams.Quorum)) { + // TODO(boodyvo): return particular error + return false, tallyParams.BurnVoteQuorum, tallyResults, nil } // If no one votes (everyone abstains), proposal fails - if totalVotingPower.Sub(results[govv1.OptionAbstain]).Equal(sdk.ZeroDec()) { - return false, false, tallyResults + if totalVotingPower.Sub(results[govv1.OptionAbstain]).Equal(sdkmath.LegacyZeroDec()) { + // TODO(boodyvo): return particular error + return false, false, tallyResults, nil } // If more than 1/3 of voters veto, proposal fails - if results[govv1.OptionNoWithVeto].Quo(totalVotingPower).GT(sdk.MustNewDecFromStr(tallyParams.VetoThreshold)) { - return false, tallyParams.BurnVoteVeto, tallyResults + if results[govv1.OptionNoWithVeto].Quo(totalVotingPower).GT(sdkmath.LegacyMustNewDecFromStr(tallyParams.VetoThreshold)) { + // TODO(boodyvo): return particular error + return false, tallyParams.BurnVoteVeto, tallyResults, nil } // If more than 1/2 of non-abstaining voters vote Yes, proposal passes - if results[govv1.OptionYes].Quo(totalVotingPower.Sub(results[govv1.OptionAbstain])).GT(sdk.MustNewDecFromStr(tallyParams.Threshold)) { - return true, false, tallyResults + if results[govv1.OptionYes].Quo(totalVotingPower.Sub(results[govv1.OptionAbstain])).GT(sdkmath.LegacyMustNewDecFromStr(tallyParams.Threshold)) { + // TODO(boodyvo): return particular error + return true, false, tallyResults, nil } // If more than 1/2 of non-abstaining voters vote No, proposal fails - return false, false, tallyResults + return false, false, tallyResults, nil } // bkavaByDenom a map of the bkava denom and the amount of bkava for that denom. @@ -194,7 +318,7 @@ type bkavaByDenom map[string]sdkmath.Int func (bkavaMap bkavaByDenom) add(coin sdk.Coin) { _, found := bkavaMap[coin.Denom] if !found { - bkavaMap[coin.Denom] = sdk.ZeroInt() + bkavaMap[coin.Denom] = sdkmath.ZeroInt() } bkavaMap[coin.Denom] = bkavaMap[coin.Denom].Add(coin.Amount) } diff --git a/app/tally_handler_test.go b/app/tally_handler_test.go index 6f178396bb..970ffebf43 100644 --- a/app/tally_handler_test.go +++ b/app/tally_handler_test.go @@ -1,6 +1,7 @@ package app import ( + addresscodec "github.com/cosmos/cosmos-sdk/codec/address" "testing" "time" @@ -12,7 +13,6 @@ import ( govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" - "github.com/cosmos/cosmos-sdk/x/staking" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/stretchr/testify/suite" @@ -21,8 +21,8 @@ import ( liquidtypes "github.com/kava-labs/kava/x/liquid/types" ) -// d is an alias for sdk.MustNewDecFromStr -var d = sdk.MustNewDecFromStr +// d is an alias for sdkmath.LegacyMustNewDecFromStr +var d = sdkmath.LegacyMustNewDecFromStr type tallyHandlerSuite struct { suite.Suite @@ -42,7 +42,7 @@ func (suite *tallyHandlerSuite) SetupTest() { suite.app = NewTestApp() suite.app.InitializeFromGenesisStates() genesisTime := time.Date(1998, 1, 1, 0, 0, 0, 0, time.UTC) - suite.ctx = suite.app.NewContext(false, tmproto.Header{Height: 1, Time: genesisTime}) + suite.ctx = suite.app.NewContextLegacy(false, tmproto.Header{Height: 1, Time: genesisTime}) stakingKeeper := *suite.app.GetStakingKeeper() suite.staking = stakingHelper{stakingKeeper} @@ -55,6 +55,7 @@ func (suite *tallyHandlerSuite) SetupTest() { suite.app.GetEarnKeeper(), suite.app.GetLiquidKeeper(), suite.app.GetBankKeeper(), + addresscodec.NewBech32Codec(Bech32PrefixValAddr), ) } @@ -63,7 +64,7 @@ func (suite *tallyHandlerSuite) TestVotePower_AllSourcesCounted() { validator := suite.delegateToNewBondedValidator(user.GetAddress(), sdkmath.NewInt(1e9)) - derivatives := suite.mintDerivative(user.GetAddress(), validator.GetOperator(), sdkmath.NewInt(500e6)) + derivatives := suite.mintDerivative(user.GetAddress(), sdk.ValAddress(validator.GetOperator()), sdkmath.NewInt(500e6)) suite.allowBKavaEarnDeposits() suite.earnDeposit( @@ -74,11 +75,12 @@ func (suite *tallyHandlerSuite) TestVotePower_AllSourcesCounted() { proposal := suite.createProposal() suite.voteOnProposal(user.GetAddress(), proposal.Id, govv1beta1.OptionYes) - _, _, results := suite.tallier.Tally(suite.ctx, proposal) + _, _, results, err := suite.tallier.Tally(suite.ctx, proposal) + suite.Require().NoError(err) suite.Equal(sdkmath.NewInt(500e6+250e6+250e6).String(), results.YesCount) - suite.Equal(sdk.ZeroInt().String(), results.NoCount) - suite.Equal(sdk.ZeroInt().String(), results.NoWithVetoCount) - suite.Equal(sdk.ZeroInt().String(), results.AbstainCount) + suite.Equal(sdkmath.ZeroInt().String(), results.NoCount) + suite.Equal(sdkmath.ZeroInt().String(), results.NoWithVetoCount) + suite.Equal(sdkmath.ZeroInt().String(), results.AbstainCount) } func (suite *tallyHandlerSuite) TestVotePower_UserOverridesValidator() { @@ -88,7 +90,7 @@ func (suite *tallyHandlerSuite) TestVotePower_UserOverridesValidator() { validator := suite.delegateToNewBondedValidator(user.GetAddress(), delegated) selfDelegated := validator.GetTokens().Sub(delegated) - derivatives := suite.mintDerivative(user.GetAddress(), validator.GetOperator(), sdkmath.NewInt(500e6)) + derivatives := suite.mintDerivative(user.GetAddress(), sdk.ValAddress(validator.GetOperator()), sdkmath.NewInt(500e6)) suite.allowBKavaEarnDeposits() suite.earnDeposit( @@ -99,28 +101,31 @@ func (suite *tallyHandlerSuite) TestVotePower_UserOverridesValidator() { proposal := suite.createProposal() // Validator votes, inheriting user's stake and bkava. - suite.voteOnProposal(validator.GetOperator().Bytes(), proposal.Id, govv1beta1.OptionYes) + // TODO(boodyvo): should be swi + suite.voteOnProposal([]byte(validator.GetOperator()), proposal.Id, govv1beta1.OptionYes) // use wrapped context to discard the state changes readOnlyCtx, _ := suite.ctx.CacheContext() - _, _, results := suite.tallier.Tally(readOnlyCtx, proposal) + _, _, results, err := suite.tallier.Tally(readOnlyCtx, proposal) + suite.Require().NoError(err) userPower := sdkmath.NewInt(500e6 + 250e6 + 250e6) suite.Equal( selfDelegated.Add(userPower).String(), results.YesCount, ) - suite.Equal(sdk.ZeroInt().String(), results.NoCount) - suite.Equal(sdk.ZeroInt().String(), results.NoWithVetoCount) - suite.Equal(sdk.ZeroInt().String(), results.AbstainCount) + suite.Equal(sdkmath.ZeroInt().String(), results.NoCount) + suite.Equal(sdkmath.ZeroInt().String(), results.NoWithVetoCount) + suite.Equal(sdkmath.ZeroInt().String(), results.AbstainCount) // User votes, taking power away from validator. suite.voteOnProposal(user.GetAddress(), proposal.Id, govv1beta1.OptionNo) - _, _, results = suite.tallier.Tally(suite.ctx, proposal) + _, _, results, err = suite.tallier.Tally(suite.ctx, proposal) + suite.Require().NoError(err) suite.Equal(selfDelegated.String(), results.YesCount) suite.Equal(userPower.String(), results.NoCount) - suite.Equal(sdk.ZeroInt().String(), results.NoWithVetoCount) - suite.Equal(sdk.ZeroInt().String(), results.AbstainCount) + suite.Equal(sdkmath.ZeroInt().String(), results.NoWithVetoCount) + suite.Equal(sdkmath.ZeroInt().String(), results.AbstainCount) } func (suite *tallyHandlerSuite) TestTallyOutcomes() { @@ -131,10 +136,12 @@ func (suite *tallyHandlerSuite) TestTallyOutcomes() { v1 := suite.createNewBondedValidator(sdkmath.NewInt(399_999_999)) suite.createNewBondedValidator(sdkmath.NewInt(600_000_001)) + v1Addr, err := suite.tallier.validatorAddressCodec.StringToBytes(v1.GetOperator()) + suite.Require().NoError(err) - suite.voteOnProposal(v1.GetOperator().Bytes(), proposal.Id, govv1beta1.OptionYes) + suite.voteOnProposal(v1Addr, proposal.Id, govv1beta1.OptionYes) - passes, burns, tally := suite.tallier.Tally(suite.ctx, proposal) + passes, burns, tally, err := suite.tallier.Tally(suite.ctx, proposal) suite.Falsef(passes, "expected proposal to fail, tally: %v", tally) suite.Truef(burns, "expected deposit to be burned, tally: %v", tally) }) @@ -146,10 +153,15 @@ func (suite *tallyHandlerSuite) TestTallyOutcomes() { v1 := suite.createNewBondedValidator(sdkmath.NewInt(334_000_001)) v2 := suite.createNewBondedValidator(sdkmath.NewInt(665_999_999)) - suite.voteOnProposal(v1.GetOperator().Bytes(), proposal.Id, govv1beta1.OptionNoWithVeto) - suite.voteOnProposal(v2.GetOperator().Bytes(), proposal.Id, govv1beta1.OptionYes) + v1Addr, err := suite.tallier.validatorAddressCodec.StringToBytes(v1.GetOperator()) + suite.Require().NoError(err) + v2Addr, err := suite.tallier.validatorAddressCodec.StringToBytes(v2.GetOperator()) + suite.Require().NoError(err) + + suite.voteOnProposal(v1Addr, proposal.Id, govv1beta1.OptionNoWithVeto) + suite.voteOnProposal(v2Addr, proposal.Id, govv1beta1.OptionYes) - passes, burns, tally := suite.tallier.Tally(suite.ctx, proposal) + passes, burns, tally, err := suite.tallier.Tally(suite.ctx, proposal) suite.Falsef(passes, "expected proposal to fail, tally: %v", tally) suite.Truef(burns, "expected deposit to be burned, tally: %v", tally) }) @@ -161,12 +173,18 @@ func (suite *tallyHandlerSuite) TestTallyOutcomes() { v1 := suite.createNewBondedValidator(sdkmath.NewInt(900_000_000)) v2 := suite.createNewBondedValidator(sdkmath.NewInt(50_000_001)) v3 := suite.createNewBondedValidator(sdkmath.NewInt(49_999_999)) - - suite.voteOnProposal(v1.GetOperator().Bytes(), proposal.Id, govv1beta1.OptionAbstain) - suite.voteOnProposal(v2.GetOperator().Bytes(), proposal.Id, govv1beta1.OptionYes) - suite.voteOnProposal(v3.GetOperator().Bytes(), proposal.Id, govv1beta1.OptionNo) - - passes, burns, tally := suite.tallier.Tally(suite.ctx, proposal) + v1Addr, err := suite.tallier.validatorAddressCodec.StringToBytes(v1.GetOperator()) + suite.Require().NoError(err) + v2Addr, err := suite.tallier.validatorAddressCodec.StringToBytes(v2.GetOperator()) + suite.Require().NoError(err) + v3Addr, err := suite.tallier.validatorAddressCodec.StringToBytes(v3.GetOperator()) + suite.Require().NoError(err) + + suite.voteOnProposal(v1Addr, proposal.Id, govv1beta1.OptionAbstain) + suite.voteOnProposal(v2Addr, proposal.Id, govv1beta1.OptionYes) + suite.voteOnProposal(v3Addr, proposal.Id, govv1beta1.OptionNo) + + passes, burns, tally, err := suite.tallier.Tally(suite.ctx, proposal) suite.Truef(passes, "expected proposal to pass, tally: %v", tally) suite.Falsef(burns, "expected deposit to not burn, tally: %v", tally) }) @@ -179,11 +197,18 @@ func (suite *tallyHandlerSuite) TestTallyOutcomes() { v2 := suite.createNewBondedValidator(sdkmath.NewInt(49_999_999)) v3 := suite.createNewBondedValidator(sdkmath.NewInt(50_000_001)) - suite.voteOnProposal(v1.GetOperator().Bytes(), proposal.Id, govv1beta1.OptionAbstain) - suite.voteOnProposal(v2.GetOperator().Bytes(), proposal.Id, govv1beta1.OptionYes) - suite.voteOnProposal(v3.GetOperator().Bytes(), proposal.Id, govv1beta1.OptionNo) + v1Addr, err := suite.tallier.validatorAddressCodec.StringToBytes(v1.GetOperator()) + suite.Require().NoError(err) + v2Addr, err := suite.tallier.validatorAddressCodec.StringToBytes(v2.GetOperator()) + suite.Require().NoError(err) + v3Addr, err := suite.tallier.validatorAddressCodec.StringToBytes(v3.GetOperator()) + suite.Require().NoError(err) + + suite.voteOnProposal(v1Addr, proposal.Id, govv1beta1.OptionAbstain) + suite.voteOnProposal(v2Addr, proposal.Id, govv1beta1.OptionYes) + suite.voteOnProposal(v3Addr, proposal.Id, govv1beta1.OptionNo) - passes, burns, tally := suite.tallier.Tally(suite.ctx, proposal) + passes, burns, tally, err := suite.tallier.Tally(suite.ctx, proposal) suite.Falsef(passes, "expected proposal to pass, tally: %v", tally) suite.Falsef(burns, "expected deposit to not burn, tally: %v", tally) }) @@ -195,7 +220,8 @@ func (suite *tallyHandlerSuite) TestTallyOutcomes() { // no stake suite.app.DeleteGenesisValidator(suite.T(), suite.ctx) - passes, burns, tally := suite.tallier.Tally(suite.ctx, proposal) + passes, burns, tally, err := suite.tallier.Tally(suite.ctx, proposal) + suite.Require().NoError(err) suite.Falsef(passes, "expected proposal to pass, tally: %v", tally) suite.Falsef(burns, "expected deposit to not burn, tally: %v", tally) }) @@ -205,23 +231,28 @@ func (suite *tallyHandlerSuite) TestTallyOutcomes() { proposal := suite.createProposal() v1 := suite.createNewBondedValidator(sdkmath.NewInt(1e9)) + v1Addr, err := suite.tallier.validatorAddressCodec.StringToBytes(v1.GetOperator()) + suite.Require().NoError(err) - suite.voteOnProposal(v1.GetOperator().Bytes(), proposal.Id, govv1beta1.OptionAbstain) + suite.voteOnProposal(v1Addr, proposal.Id, govv1beta1.OptionAbstain) - passes, burns, tally := suite.tallier.Tally(suite.ctx, proposal) + passes, burns, tally, err := suite.tallier.Tally(suite.ctx, proposal) + suite.Require().NoError(err) suite.Falsef(passes, "expected proposal to pass, tally: %v", tally) suite.Falsef(burns, "expected deposit to not burn, tally: %v", tally) }) } -func (suite *tallyHandlerSuite) setTallyParams(quorum, threshold, veto sdk.Dec) { - params := suite.app.GetGovKeeper().GetParams(suite.ctx) +func (suite *tallyHandlerSuite) setTallyParams(quorum, threshold, veto sdkmath.LegacyDec) { + params, err := suite.app.GetGovKeeper().Params.Get(suite.ctx) + suite.Require().NoError(err) params.Quorum = quorum.String() params.Threshold = threshold.String() params.VetoThreshold = veto.String() params.BurnVoteQuorum = true - suite.app.GetGovKeeper().SetParams(suite.ctx, params) + err = suite.app.GetGovKeeper().Params.Set(suite.ctx, params) + suite.Require().NoError(err) } func (suite *tallyHandlerSuite) voteOnProposal( @@ -242,7 +273,9 @@ func (suite *tallyHandlerSuite) voteOnProposal( func (suite *tallyHandlerSuite) createProposal() govv1.Proposal { gk := suite.app.GetGovKeeper() - deposit := gk.GetParams(suite.ctx).MinDeposit + govParams, err := gk.Params.Get(suite.ctx) + suite.Require().NoError(err) + deposit := govParams.MinDeposit proposer := suite.createAccount(deposit...) msg, err := govv1beta1.NewMsgSubmitProposal( @@ -259,8 +292,8 @@ func (suite *tallyHandlerSuite) createProposal() govv1.Proposal { res, err := msgServer.SubmitProposal(sdk.WrapSDKContext(suite.ctx), msg) suite.Require().NoError(err) - proposal, found := gk.GetProposal(suite.ctx, res.ProposalId) - if !found { + proposal, err := gk.Proposals.Get(suite.ctx, res.ProposalId) + if err != nil { panic("proposal not found") } return proposal @@ -311,17 +344,21 @@ func (suite *tallyHandlerSuite) delegateToNewBondedValidator(delegator sdk.AccAd validator, err := suite.staking.createUnbondedValidator(suite.ctx, valAcc.GetAddress().Bytes(), sdkmath.NewInt(1e9)) suite.Require().NoError(err) - _, err = suite.staking.delegate(suite.ctx, delegator, validator.GetOperator(), amount) + validatorAddr, err := suite.tallier.validatorAddressCodec.StringToBytes(validator.GetOperator()) + suite.Require().NoError(err) + + _, err = suite.staking.delegate(suite.ctx, delegator, validatorAddr, amount) suite.Require().NoError(err) // bond the validator sk := suite.app.GetStakingKeeper() - staking.EndBlocker(suite.ctx, sk) + suite.staking.keeper.EndBlocker(suite.ctx) - validator, found := sk.GetValidator(suite.ctx, validator.GetOperator()) - if !found { + validator, err = sk.GetValidator(suite.ctx, validatorAddr) + if err != nil { panic("validator not found") } + return validator } @@ -332,10 +369,12 @@ func (suite *tallyHandlerSuite) createNewBondedValidator(selfDelegation sdkmath. // bond the validator sk := suite.app.GetStakingKeeper() - staking.EndBlocker(suite.ctx, sk) + suite.staking.keeper.EndBlocker(suite.ctx) - validator, found := sk.GetValidator(suite.ctx, validator.GetOperator()) - if !found { + validatorAddr, err := sk.ValidatorAddressCodec().StringToBytes(validator.GetOperator()) + suite.Require().NoError(err) + validator, err = sk.GetValidator(suite.ctx, validatorAddr) + if err != nil { panic("validator not found") } return validator @@ -360,11 +399,11 @@ type stakingHelper struct { func (h stakingHelper) createUnbondedValidator(ctx sdk.Context, address sdk.ValAddress, selfDelegation sdkmath.Int) (stakingtypes.ValidatorI, error) { msg, err := stakingtypes.NewMsgCreateValidator( - address, + address.String(), ed25519.GenPrivKey().PubKey(), h.newBondCoin(ctx, selfDelegation), stakingtypes.Description{}, - stakingtypes.NewCommissionRates(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()), + stakingtypes.NewCommissionRates(sdkmath.LegacyZeroDec(), sdkmath.LegacyZeroDec(), sdkmath.LegacyZeroDec()), sdkmath.NewInt(1e6), ) if err != nil { @@ -377,39 +416,49 @@ func (h stakingHelper) createUnbondedValidator(ctx sdk.Context, address sdk.ValA return nil, err } - validator, found := h.keeper.GetValidator(ctx, address) - if !found { + validator, err := h.keeper.GetValidator(ctx, address) + if err != nil { panic("validator not found") } return validator, nil } -func (h stakingHelper) delegate(ctx sdk.Context, delegator sdk.AccAddress, validator sdk.ValAddress, amount sdkmath.Int) (sdk.Dec, error) { +func (h stakingHelper) delegate(ctx sdk.Context, delegator sdk.AccAddress, validator sdk.ValAddress, amount sdkmath.Int) (sdkmath.LegacyDec, error) { msg := stakingtypes.NewMsgDelegate( - delegator, - validator, + delegator.String(), + validator.String(), h.newBondCoin(ctx, amount), ) msgServer := stakingkeeper.NewMsgServerImpl(&h.keeper) _, err := msgServer.Delegate(sdk.WrapSDKContext(ctx), msg) if err != nil { - return sdk.Dec{}, err + return sdkmath.LegacyDec{}, err } - del, found := h.keeper.GetDelegation(ctx, delegator, validator) - if !found { + del, err := h.keeper.GetDelegation(ctx, delegator, validator) + if err != nil { panic("delegation not found") } return del.Shares, nil } func (h stakingHelper) newBondCoin(ctx sdk.Context, amount sdkmath.Int) sdk.Coin { - return sdk.NewCoin(h.keeper.BondDenom(ctx), amount) + bondDenom, err := h.keeper.BondDenom(ctx) + if err != nil { + panic("bond denom not set") + } + return sdk.NewCoin(bondDenom, amount) } func (h stakingHelper) setBondDenom(ctx sdk.Context, denom string) { - params := h.keeper.GetParams(ctx) + params, err := h.keeper.GetParams(ctx) + if err != nil { + panic("params not found") + } params.BondDenom = denom - h.keeper.SetParams(ctx, params) + err = h.keeper.SetParams(ctx, params) + if err != nil { + panic("params not set") + } } diff --git a/app/test_builder.go b/app/test_builder.go index 60b9d9580b..e31c9ddf98 100644 --- a/app/test_builder.go +++ b/app/test_builder.go @@ -106,6 +106,11 @@ func newPeriodicVestingAccount(address sdk.AccAddress, periods vestingtypes.Peri } endTime := firstPeriodStartTimestamp + totalPeriods - baseVestingAccount := vestingtypes.NewBaseVestingAccount(baseAccount, originalVesting, endTime) + baseVestingAccount, err := vestingtypes.NewBaseVestingAccount(baseAccount, originalVesting, endTime) + if err != nil { + // TODO(boodyvo): should return err? + panic(err) + } + return vestingtypes.NewPeriodicVestingAccountRaw(baseVestingAccount, firstPeriodStartTimestamp, periods) } diff --git a/app/test_common.go b/app/test_common.go index 22d3e14882..9186586da9 100644 --- a/app/test_common.go +++ b/app/test_common.go @@ -1,19 +1,22 @@ package app import ( + "context" "encoding/json" "fmt" "math/rand" "reflect" + "runtime/debug" "testing" "time" + "cosmossdk.io/log" sdkmath "cosmossdk.io/math" - tmdb "github.com/cometbft/cometbft-db" + storetypes "cosmossdk.io/store/types" abci "github.com/cometbft/cometbft/abci/types" - "github.com/cometbft/cometbft/libs/log" tmproto "github.com/cometbft/cometbft/proto/tendermint/types" tmtypes "github.com/cometbft/cometbft/types" + tmdb "github.com/cosmos/cosmos-db" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" @@ -21,7 +24,6 @@ import ( "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" - storetypes "github.com/cosmos/cosmos-sdk/store/types" "github.com/cosmos/cosmos-sdk/testutil/mock" sdk "github.com/cosmos/cosmos-sdk/types" authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" @@ -105,6 +107,7 @@ func NewTestAppFromSealed() TestApp { log.NewNopLogger(), db, DefaultNodeHome, nil, encCfg, DefaultOptions, baseapp.SetChainID(TestChainId), ) + return TestApp{App: *app} } @@ -161,7 +164,7 @@ func (app *App) AppCodec() codec.Codec { func GenesisStateWithSingleValidator( app *TestApp, genesisState GenesisState, -) GenesisState { +) (GenesisState, *tmtypes.ValidatorSet) { privVal := mock.NewPV() pubKey, err := privVal.GetPubKey() if err != nil { @@ -184,7 +187,9 @@ func GenesisStateWithSingleValidator( }, } - return genesisStateWithValSet(app, genesisState, valSet, []authtypes.GenesisAccount{acc}, balances...) + genState := genesisStateWithValSet(app, genesisState, valSet, []authtypes.GenesisAccount{acc}, balances...) + + return genState, valSet } // genesisStateWithValSet applies the provided validator set and genesis accounts @@ -212,7 +217,7 @@ func genesisStateWithValSet( bondAmt := sdk.DefaultPowerReduction for _, val := range valSet.Validators { - pk, err := cryptocodec.FromTmPubKeyInterface(val.PubKey) + pk, err := cryptocodec.FromCmtPubKeyInterface(val.PubKey) if err != nil { panic(fmt.Errorf("error converting validator public key: %w", err)) } @@ -228,19 +233,19 @@ func genesisStateWithValSet( Jailed: false, Status: stakingtypes.Bonded, Tokens: bondAmt, - DelegatorShares: sdk.OneDec(), + DelegatorShares: sdkmath.LegacyOneDec(), Description: stakingtypes.Description{ Moniker: "genesis validator", }, UnbondingHeight: int64(0), UnbondingTime: time.Unix(0, 0).UTC(), - Commission: stakingtypes.NewCommission(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()), - MinSelfDelegation: sdk.ZeroInt(), + Commission: stakingtypes.NewCommission(sdkmath.LegacyZeroDec(), sdkmath.LegacyZeroDec(), sdkmath.LegacyZeroDec()), + MinSelfDelegation: sdkmath.ZeroInt(), } validators = append(validators, validator) - delegations = append(delegations, stakingtypes.NewDelegation(genAccs[0].GetAddress(), val.Address.Bytes(), sdk.OneDec())) - + delegations = append(delegations, stakingtypes.NewDelegation(genAccs[0].GetAddress().String(), sdk.ValAddress(val.Address).String(), sdkmath.LegacyOneDec())) } + // set validators and delegations currentStakingGenesis := stakingtypes.GetGenesisStateFromAppState(app.appCodec, genesisState) currentStakingGenesis.Params.BondDenom = "ukava" @@ -294,6 +299,10 @@ func (tApp TestApp) InitializeFromGenesisStates(genesisStates ...GenesisState) T return tApp.InitializeFromGenesisStatesWithTimeAndChainIDAndHeight(emptyTime, TestChainId, defaultInitialHeight, true, genesisStates...) } +func (tApp TestApp) InitializeFromGenesisStatesCtx(ctx context.Context, genesisStates ...GenesisState) TestApp { + return tApp.InitializeFromGenesisStatesWithTimeAndChainIDAndHeightCtx(ctx, emptyTime, TestChainId, defaultInitialHeight, true, genesisStates...) +} + // InitializeFromGenesisStatesWithTime calls InitChain on the app using the provided genesis states and time. // If any module genesis states are missing, defaults are used. func (tApp TestApp) InitializeFromGenesisStatesWithTime(genTime time.Time, genesisStates ...GenesisState) TestApp { @@ -334,21 +343,29 @@ func (tApp TestApp) InitializeFromGenesisStatesWithTimeAndChainIDAndHeight( } } + var ( + nextValidatorHash []byte + valSet *tmtypes.ValidatorSet + ) + // Add default genesis states for at least 1 validator if addValidator { - genesisState = GenesisStateWithSingleValidator( + genesisState, valSet = GenesisStateWithSingleValidator( &tApp, genesisState, ) + nextValidatorHash = valSet.Hash() } // Initialize the chain - stateBytes, err := json.Marshal(genesisState) + stateBytes, err := json.MarshalIndent(genesisState, "", " ") + //stateBytes, err := json.Marshal(genesisState) if err != nil { panic(err) } - tApp.InitChain( - abci.RequestInitChain{ + + _, err = tApp.InitChain( + &abci.RequestInitChain{ Time: genTime, Validators: []abci.ValidatorUpdate{}, AppStateBytes: stateBytes, @@ -363,12 +380,115 @@ func (tApp TestApp) InitializeFromGenesisStatesWithTimeAndChainIDAndHeight( InitialHeight: initialHeight, }, ) - tApp.Commit() - tApp.BeginBlock(abci.RequestBeginBlock{ - Header: tmproto.Header{ - Height: tApp.LastBlockHeight() + 1, Time: genTime, ChainID: chainID, + if err != nil { + panic(err) + } + + //_, err = tApp.BeginBlocker(tApp.NewContextLegacy(true, tmproto.Header{Height: tApp.LastBlockHeight() + 1, Time: genTime})) + //if err != nil { + // panic(err) + //} + + //_, err = tApp.BeginBlocker(tApp.NewContextLegacy(true, tmproto.Header{Height: tApp.LastBlockHeight() + 1, Time: genTime})) + + // Should we call commit? + //fmt.Println("block finalized: ", err) + _, err = tApp.FinalizeBlock(&abci.RequestFinalizeBlock{ + Time: genTime, + Hash: tApp.LastCommitID().Hash, + Height: tApp.LastBlockHeight() + 1, + NextValidatorsHash: nextValidatorHash, + }) + if err != nil { + panic(err) + } + //_, err = tApp.Commit() + //fmt.Println("chain committed: ", err) + + return tApp +} + +// InitializeFromGenesisStatesWithTimeAndChainIDAndHeight calls InitChain on the app using the provided genesis states and other parameters. +// If any module genesis states are missing, defaults are used. +func (tApp TestApp) InitializeFromGenesisStatesWithTimeAndChainIDAndHeightCtx( + ctx context.Context, + genTime time.Time, + chainID string, + initialHeight int64, + addValidator bool, + genesisStates ...GenesisState, +) TestApp { + // Create a default genesis state and overwrite with provided values + genesisState := NewDefaultGenesisState() + modifiedStates := make(map[string]bool) + + for _, state := range genesisStates { + for k, v := range state { + genesisState[k] = v + + // Ensure that the same module genesis state is not set more than once. + // Multiple GenesisStates can have the same module genesis state, but + // the same module genesis state will be overwritten. + if previouslyModified := modifiedStates[k]; previouslyModified { + panic(fmt.Sprintf("genesis state for module %s was set more than once, this overrides previous state", k)) + } + + modifiedStates[k] = true + } + } + + var ( + nextValidatorHash []byte + valSet *tmtypes.ValidatorSet + ) + + // Add default genesis states for at least 1 validator + if addValidator { + genesisState, valSet = GenesisStateWithSingleValidator( + &tApp, + genesisState, + ) + nextValidatorHash = valSet.Hash() + } + + // Initialize the chain + stateBytes, err := json.MarshalIndent(genesisState, "", " ") + //stateBytes, err := json.Marshal(genesisState) + if err != nil { + panic(err) + } + + _, err = tApp.InitChain( + &abci.RequestInitChain{ + Time: genTime, + Validators: []abci.ValidatorUpdate{}, + AppStateBytes: stateBytes, + ChainId: chainID, + // Set consensus params, which is needed by x/feemarket + ConsensusParams: &tmproto.ConsensusParams{ + Block: &tmproto.BlockParams{ + MaxBytes: 200000, + MaxGas: 20000000, + }, + }, + InitialHeight: initialHeight, }, + ) + + //_, err = tApp.BeginBlocker(tApp.NewContextLegacy(true, tmproto.Header{Height: tApp.LastBlockHeight() + 1, Time: genTime})) + + // Should we call commit? + //fmt.Println("block finalized: ", err) + _, err = tApp.FinalizeBlock(&abci.RequestFinalizeBlock{ + Time: genTime, + //Hash: tApp.LastCommitID().Hash, + Height: tApp.LastBlockHeight() + 1, + NextValidatorsHash: nextValidatorHash, + // Hash: app.LastCommitID().Hash, + // Height: app.LastBlockHeight() + 1, }) + //_, err = tApp.Commit() + //fmt.Println("chain committed: ", err) return tApp } @@ -379,7 +499,11 @@ func (tApp TestApp) InitializeFromGenesisStatesWithTimeAndChainIDAndHeight( // it must be deleted additional validators are created. func (tApp TestApp) DeleteGenesisValidator(t *testing.T, ctx sdk.Context) { sk := tApp.GetStakingKeeper() - vals := sk.GetAllValidators(ctx) + vals, err := sk.GetAllValidators(ctx) + require.NoError(t, err) + + _, err = tApp.Commit() + require.NoError(t, err) var genVal stakingtypes.Validator found := false @@ -393,14 +517,20 @@ func (tApp TestApp) DeleteGenesisValidator(t *testing.T, ctx sdk.Context) { require.True(t, found, "genesis validator not found") - delegations := sk.GetValidatorDelegations(ctx, genVal.GetOperator()) + ctxTest := tApp.NewContextLegacy(true, tmproto.Header{}) + + delegations, err := sk.GetValidatorDelegations(ctxTest, []byte(genVal.GetOperator())) + require.NoError(t, err) for _, delegation := range delegations { - _, err := sk.Undelegate(ctx, delegation.GetDelegatorAddr(), genVal.GetOperator(), delegation.Shares) + valBytes, err := sk.ValidatorAddressCodec().StringToBytes(delegation.GetValidatorAddr()) + require.NoError(t, err) + _, _, err = sk.Undelegate(ctx, []byte(delegation.GetDelegatorAddr()), valBytes, delegation.Shares) require.NoError(t, err) } } func (tApp TestApp) DeleteGenesisValidatorCoins(t *testing.T, ctx sdk.Context) { + debug.PrintStack() ak := tApp.GetAccountKeeper() bk := tApp.GetBankKeeper() @@ -459,12 +589,17 @@ func (tApp TestApp) FundModuleAccount(ctx sdk.Context, recipientMod string, amou // CreateNewUnbondedValidator creates a new validator in the staking module. // New validators are unbonded until the end blocker is run. func (tApp TestApp) CreateNewUnbondedValidator(ctx sdk.Context, valAddress sdk.ValAddress, selfDelegation sdkmath.Int) error { + bondDnom, err := tApp.stakingKeeper.BondDenom(ctx) + if err != nil { + return err + } + msg, err := stakingtypes.NewMsgCreateValidator( - valAddress, + valAddress.String(), ed25519.GenPrivKey().PubKey(), - sdk.NewCoin(tApp.stakingKeeper.BondDenom(ctx), selfDelegation), + sdk.NewCoin(bondDnom, selfDelegation), stakingtypes.Description{}, - stakingtypes.NewCommissionRates(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()), + stakingtypes.NewCommissionRates(sdkmath.LegacyZeroDec(), sdkmath.LegacyZeroDec(), sdkmath.LegacyZeroDec()), sdkmath.NewInt(1e6), ) if err != nil { @@ -476,12 +611,12 @@ func (tApp TestApp) CreateNewUnbondedValidator(ctx sdk.Context, valAddress sdk.V return err } -func (tApp TestApp) SetInflation(ctx sdk.Context, value sdk.Dec) { +func (tApp TestApp) SetInflation(ctx sdk.Context, value sdkmath.LegacyDec) { mk := tApp.GetMintKeeper() mintParams := mk.GetParams(ctx) - mintParams.InflationMax = sdk.ZeroDec() - mintParams.InflationMin = sdk.ZeroDec() + mintParams.InflationMax = sdkmath.LegacyZeroDec() + mintParams.InflationMin = sdkmath.LegacyZeroDec() if err := mintParams.Validate(); err != nil { panic(err) diff --git a/app/upgrades.go b/app/upgrades.go index cef008252a..d5a488b161 100644 --- a/app/upgrades.go +++ b/app/upgrades.go @@ -1,3 +1,129 @@ package app +//const UpgradeName = "v045-to-v050" +// +//func setupLegacyKeyTables(k *paramskeeper.Keeper) { +// for _, subspace := range k.GetSubspaces() { +// subspace := subspace +// +// var keyTable paramstypes.KeyTable +// switch subspace.Name() { +// case authtypes.ModuleName: +// keyTable = authtypes.ParamKeyTable() //nolint:staticcheck +// case banktypes.ModuleName: +// keyTable = banktypes.ParamKeyTable() //nolint:staticcheck +// case stakingtypes.ModuleName: +// keyTable = stakingtypes.ParamKeyTable() //nolint:staticcheck +// case minttypes.ModuleName: +// keyTable = minttypes.ParamKeyTable() //nolint:staticcheck +// case distrtypes.ModuleName: +// keyTable = distrtypes.ParamKeyTable() //nolint:staticcheck +// case slashingtypes.ModuleName: +// keyTable = slashingtypes.ParamKeyTable() //nolint:staticcheck +// case govtypes.ModuleName: +// keyTable = govv1.ParamKeyTable() //nolint:staticcheck +// case crisistypes.ModuleName: +// keyTable = crisistypes.ParamKeyTable() //nolint:staticcheck +// // wasm +// case ibctransfertypes.ModuleName: +// keyTable = ibctransfertypes.ParamKeyTable() //nolint:staticcheck +// default: +// continue +// } +// +// if !subspace.HasKeyTable() { +// subspace.WithKeyTable(keyTable) +// } +// } +// +// // sdk 47 +// k.Subspace(baseapp.Paramspace). +// WithKeyTable(paramstypes.ConsensusParamsKeyTable()) +//} +// +//func (app App) RegisterUpgradeHandlers() { +// setupLegacyKeyTables(&app.paramsKeeper) +// +// app.upgradeKeeper.SetUpgradeHandler( +// UpgradeName, +// func(ctx context.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { +// return app.mm.RunMigrations(ctx, app.configurator, fromVM) +// }, +// ) +// +// upgradeInfo, err := app.upgradeKeeper.ReadUpgradeInfoFromDisk() +// if err != nil { +// panic(err) +// } +// +// if upgradeInfo.Name == UpgradeName && !app.upgradeKeeper.IsSkipHeight(upgradeInfo.Height) { +// storeUpgrades := storetypes.StoreUpgrades{ +// Added: []string{ +// consensustypes.ModuleName, +// crisistypes.ModuleName, +// capabilitytypes.MemStoreKey, +// nft.ModuleName, +// }, +// } +// +// // configure store loader that checks if version == upgradeHeight and applies store upgrades +// app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades)) +// } +//} +// +//func (app App) RegisterUpgradeHandlersOld() { +// baseAppLegacySS := app.ParamsKeeper.Subspace(baseapp.Paramspace).WithKeyTable(paramstypes.ConsensusParamsKeyTable()) +// app.UpgradeKeeper.SetUpgradeHandler( +// UpgradeName, +// func(ctx context.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { +// baseapp.MigrateParams(ctx.(sdk.Context), baseAppLegacySS, app.ConsensusParamsKeeper.ParamsStore) +// consensusParams := baseapp.GetConsensusParams(ctx.(sdk.Context), baseAppLegacySS) +// // make sure the consensus params are set +// if consensusParams.Block == nil || consensusParams.Evidence == nil || consensusParams.Validator == nil { +// defaultParams := tmtypes.DefaultConsensusParams().ToProto() +// app.ConsensusParamsKeeper.ParamsStore.Set(ctx.(sdk.Context), defaultParams) +// } +// +// storesvc := runtime.NewKVStoreService(app.GetKey("upgrade")) +// consensuskeeper := consensuskeeper.NewKeeper( +// app.appCodec, +// storesvc, +// app.AccountKeeper.GetAuthority(), +// runtime.EventService{}, +// ) +// +// params, err := consensuskeeper.ParamsStore.Get(ctx) +// if err != nil { +// return nil, err +// } +// +// err = app.ConsensusParamsKeeper.ParamsStore.Set(ctx, params) +// if err != nil { +// return nil, err +// } +// +// return app.ModuleManager.RunMigrations(ctx, app.Configurator(), fromVM) +// }, +// ) +// +// upgradeInfo, err := app.UpgradeKeeper.ReadUpgradeInfoFromDisk() +// if err != nil { +// panic(err) +// } +// +// if upgradeInfo.Name == UpgradeName && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) { +// storeUpgrades := storetypes.StoreUpgrades{ +// Added: []string{ +// consensustypes.ModuleName, +// crisistypes.ModuleName, +// circuittypes.ModuleName, +// ibcfee.ModuleName, +// }, +// } +// +// // configure store loader that checks if version == upgradeHeight and applies store upgrades +// app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades)) +// } +//} + func (app App) RegisterUpgradeHandlers() {} diff --git a/build/proto-deps.mk b/build/proto-deps.mk index 1856f59bf9..282d05d353 100644 --- a/build/proto-deps.mk +++ b/build/proto-deps.mk @@ -18,7 +18,8 @@ GOGO_PATH := $(shell $(GO_BIN) list -m -f '{{.Dir}}' github.com/cosmos/gogoproto TENDERMINT_PATH := $(shell $(GO_BIN) list -m -f '{{.Dir}}' github.com/cometbft/cometbft) COSMOS_PROTO_PATH := $(shell $(GO_BIN) list -m -f '{{.Dir}}' github.com/cosmos/cosmos-proto) COSMOS_SDK_PATH := $(shell $(GO_BIN) list -m -f '{{.Dir}}' github.com/cosmos/cosmos-sdk) -IBC_GO_PATH := $(shell $(GO_BIN) list -m -f '{{.Dir}}' github.com/cosmos/ibc-go/v7) +#IBC_GO_PATH := $(shell $(GO_BIN) list -m -f '{{.Dir}}' github.com/cosmos/ibc-go/v7) +IBC_GO_PATH := $(shell $(GO_BIN) list -m -f '{{.Dir}}' github.com/cosmos/ibc-go/v8) ETHERMINT_PATH := $(shell $(GO_BIN) list -m -f '{{.Dir}}' github.com/evmos/ethermint) # @@ -55,7 +56,8 @@ proto-update-deps: check-rsync ## Update all third party proto files @mkdir -p client/docs @cp -f $(COSMOS_SDK_PATH)/client/docs/swagger-ui/swagger.yaml client/docs/cosmos-swagger.yml - @cp -f $(IBC_GO_PATH)/docs/client/swagger-ui/swagger.yaml client/docs/ibc-go-swagger.yml + # TODO(boodyvo): do we need this? + @#cp -f $(IBC_GO_PATH)/docs/client/swagger-ui/swagger.yaml client/docs/ibc-go-swagger.yml @cp -f $(ETHERMINT_PATH)/client/docs/swagger-ui/swagger.yaml client/docs/ethermint-swagger.yml @mkdir -p $(COSMOS_PROTO_TYPES) diff --git a/ci/env/kava-internal-testnet/genesis.json b/ci/env/kava-internal-testnet/genesis.json index 75dbb12c87..f80650a7e4 100644 --- a/ci/env/kava-internal-testnet/genesis.json +++ b/ci/env/kava-internal-testnet/genesis.json @@ -2636,6 +2636,11 @@ "send_sequences": [], "recv_sequences": [], "ack_sequences": [], + "params": { + "upgrade_timeout": { + "timestamp":"600000000000" + } + }, "next_channel_sequence": "0" } }, diff --git a/ci/env/kava-protonet/genesis.json b/ci/env/kava-protonet/genesis.json index e42273eacf..04ad54c881 100644 --- a/ci/env/kava-protonet/genesis.json +++ b/ci/env/kava-protonet/genesis.json @@ -2438,6 +2438,11 @@ "send_sequences": [], "recv_sequences": [], "ack_sequences": [], + "params": { + "upgrade_timeout": { + "timestamp":"600000000000" + } + }, "next_channel_sequence": "0" } }, diff --git a/cli_test/cli_test.go b/cli_test/cli_test.go index 8d16f50c29..915df27bc2 100644 --- a/cli_test/cli_test.go +++ b/cli_test/cli_test.go @@ -476,12 +476,12 @@ func TestKvCLIQueryRewards(t *testing.T) { f := InitFixtures(t) genesisState := f.GenesisState() - inflationMin := sdk.MustNewDecFromStr("1.0") + inflationMin := sdkmath.LegacyMustNewDecFromStr("1.0") var mintData mint.GenesisState f.cdc.UnmarshalJSON(genesisState[mint.ModuleName], &mintData) mintData.Minter.Inflation = inflationMin mintData.Params.InflationMin = inflationMin - mintData.Params.InflationMax = sdk.MustNewDecFromStr("1.0") + mintData.Params.InflationMax = sdkmath.LegacyMustNewDecFromStr("1.0") mintDataBz, err := f.cdc.MarshalJSON(mintData) require.NoError(t, err) genesisState[mint.ModuleName] = mintDataBz @@ -735,12 +735,12 @@ func TestKvCLISubmitCommunityPoolSpendProposal(t *testing.T) { // create some inflation genesisState := f.GenesisState() - inflationMin := sdk.MustNewDecFromStr("1.0") + inflationMin := sdkmath.LegacyMustNewDecFromStr("1.0") var mintData mint.GenesisState f.cdc.UnmarshalJSON(genesisState[mint.ModuleName], &mintData) mintData.Minter.Inflation = inflationMin mintData.Params.InflationMin = inflationMin - mintData.Params.InflationMax = sdk.MustNewDecFromStr("1.0") + mintData.Params.InflationMax = sdkmath.LegacyMustNewDecFromStr("1.0") mintDataBz, err := f.cdc.MarshalJSON(mintData) require.NoError(t, err) genesisState[mint.ModuleName] = mintDataBz diff --git a/client/docs/cosmos-swagger.yml b/client/docs/cosmos-swagger.yml index 797069ecdb..c38adbb696 100644 --- a/client/docs/cosmos-swagger.yml +++ b/client/docs/cosmos-swagger.yml @@ -1,7 +1,7 @@ swagger: '2.0' info: title: Cosmos SDK - gRPC Gateway docs - description: A REST interface for state queries + description: A REST interface for state queries. version: 1.0.0 paths: /cosmos/auth/v1beta1/account_info/{address}: @@ -120,6 +120,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -159,7 +163,6 @@ paths: name "y.z". - JSON @@ -321,6 +324,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -360,7 +367,6 @@ paths: name "y.z". - JSON @@ -526,6 +532,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -565,7 +575,6 @@ paths: name "y.z". - JSON @@ -743,6 +752,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -782,7 +795,6 @@ paths: name "y.z". - JSON @@ -988,6 +1000,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -1027,7 +1043,6 @@ paths: name "y.z". - JSON @@ -1179,6 +1194,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -1218,7 +1237,6 @@ paths: name "y.z". - JSON @@ -1395,6 +1413,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -1434,7 +1456,6 @@ paths: name "y.z". - JSON @@ -1628,6 +1649,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -1667,7 +1692,6 @@ paths: name "y.z". - JSON @@ -1840,6 +1864,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -1879,7 +1907,6 @@ paths: name "y.z". - JSON @@ -2059,6 +2086,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -2098,7 +2129,6 @@ paths: name "y.z". - JSON @@ -2256,6 +2286,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -2295,7 +2329,6 @@ paths: name "y.z". - JSON @@ -2453,6 +2486,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -2492,7 +2529,6 @@ paths: name "y.z". - JSON @@ -2641,6 +2677,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -2680,7 +2720,6 @@ paths: name "y.z". - JSON @@ -2832,6 +2871,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -2871,7 +2914,6 @@ paths: name "y.z". - JSON @@ -3062,6 +3104,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -3101,7 +3147,6 @@ paths: name "y.z". - JSON @@ -3283,6 +3328,16 @@ paths: in: query required: false type: boolean + - name: resolve_denom + description: >- + resolve_denom is the flag to resolve the denom into a human-readable + form from the metadata. + + + Since: cosmos-sdk 0.50 + in: query + required: false + type: boolean tags: - Query /cosmos/bank/v1beta1/balances/{address}/by_denom: @@ -3513,6 +3568,170 @@ paths: descending order. + Since: cosmos-sdk 0.43 + in: query + required: false + type: boolean + tags: + - Query + /cosmos/bank/v1beta1/denom_owners_by_query: + get: + summary: >- + DenomOwnersByQuery queries for all account addresses that own a + particular token + + denomination. + description: 'Since: cosmos-sdk 0.50.3' + operationId: DenomOwnersByQuery + responses: + '200': + description: A successful response. + schema: + type: object + properties: + denom_owners: + type: array + items: + type: object + properties: + address: + type: string + description: >- + address defines the address that owns a particular + denomination. + balance: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the + custom method + + signatures required by gogoproto. + description: >- + DenomOwner defines structure representing an account that + owns or holds a + + particular denominated token. It contains the account + address and account + + balance of the denominated token. + + + Since: cosmos-sdk 0.46 + pagination: + description: pagination defines the pagination in the response. + type: object + properties: + next_key: + type: string + format: byte + description: |- + next_key is the key to be passed to PageRequest.key to + query the next page most efficiently. It will be empty if + there are no more results. + total: + type: string + format: uint64 + title: >- + total is total number of results available if + PageRequest.count_total + + was set, its value is undefined otherwise + description: >- + QueryDenomOwnersByQueryResponse defines the RPC response of a + DenomOwnersByQuery RPC query. + + + Since: cosmos-sdk 0.50.3 + default: + description: An unexpected error response. + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + parameters: + - name: denom + description: >- + denom defines the coin denomination to query all account holders + for. + in: query + required: false + type: string + - name: pagination.key + description: |- + key is a value returned in PageResponse.next_key to begin + querying the next page most efficiently. Only one of offset or key + should be set. + in: query + required: false + type: string + format: byte + - name: pagination.offset + description: >- + offset is a numeric offset that can be used when key is unavailable. + + It is less efficient than using key. Only one of offset or key + should + + be set. + in: query + required: false + type: string + format: uint64 + - name: pagination.limit + description: >- + limit is the total number of results to be returned in the result + page. + + If left empty it will default to a value to be set by each app. + in: query + required: false + type: string + format: uint64 + - name: pagination.count_total + description: >- + count_total is set to true to indicate that the result set should + include + + a count of the total number of items available for pagination in + UIs. + + count_total is only respected when offset is used. It is ignored + when key + + is set. + in: query + required: false + type: boolean + - name: pagination.reverse + description: >- + reverse is set to true if results are to be returned in the + descending order. + + Since: cosmos-sdk 0.43 in: query required: false @@ -3732,7 +3951,7 @@ paths: - Query /cosmos/bank/v1beta1/denoms_metadata/{denom}: get: - summary: DenomsMetadata queries the client metadata of a given coin denomination. + summary: DenomMetadata queries the client metadata of a given coin denomination. operationId: DenomMetadata responses: '200': @@ -3864,51 +4083,188 @@ paths: type: string tags: - Query - /cosmos/bank/v1beta1/params: + /cosmos/bank/v1beta1/denoms_metadata_by_query_string: get: - summary: Params queries the parameters of x/bank module. - operationId: BankParams + summary: >- + DenomMetadataByQueryString queries the client metadata of a given coin + denomination. + operationId: DenomMetadataByQueryString responses: '200': description: A successful response. schema: type: object properties: - params: + metadata: type: object properties: - send_enabled: + description: + type: string + denom_units: type: array items: type: object properties: denom: type: string - enabled: - type: boolean - description: >- - SendEnabled maps coin denom to a send_enabled status - (whether a denom is + description: >- + denom represents the string name of the given denom + unit (e.g uatom). + exponent: + type: integer + format: int64 + description: >- + exponent represents power of 10 exponent that one + must - sendable). + raise the base_denom to in order to equal the given + DenomUnit's denom + + 1 denom = 10^exponent base_denom + + (e.g. with a base_denom of uatom, one can create a + DenomUnit of 'atom' with + + exponent = 6, thus: 1 atom = 10^6 uatom). + aliases: + type: array + items: + type: string + title: >- + aliases is a list of string aliases for the given + denom + description: |- + DenomUnit represents a struct that describes a given + denomination unit of the basic token. + title: >- + denom_units represents the list of DenomUnit's for a given + coin + base: + type: string description: >- - Deprecated: Use of SendEnabled in params is deprecated. + base represents the base denom (should be the DenomUnit + with exponent = 0). + display: + type: string + description: |- + display indicates the suggested denom that should be + displayed in clients. + name: + type: string + description: 'Since: cosmos-sdk 0.43' + title: 'name defines the name of the token (eg: Cosmos Atom)' + symbol: + type: string + description: >- + symbol is the token symbol usually shown on exchanges (eg: + ATOM). This can - For genesis, use the newly added send_enabled field in the - genesis object. + be the same as the display. - Storage, lookup, and manipulation of this information is - now in the keeper. + Since: cosmos-sdk 0.43 + uri: + type: string + description: >- + URI to a document (on or off-chain) that contains + additional information. Optional. - As of cosmos-sdk 0.47, this only exists for backwards - compatibility of genesis files. - default_send_enabled: - type: boolean - description: Params defines the parameters for the bank module. + + Since: cosmos-sdk 0.46 + uri_hash: + type: string + description: >- + URIHash is a sha256 hash of a document pointed by URI. + It's used to verify that + + the document didn't change. Optional. + + + Since: cosmos-sdk 0.46 + description: |- + Metadata represents a struct that describes + a basic token. description: >- - QueryParamsResponse defines the response type for querying x/bank - parameters. + QueryDenomMetadataByQueryStringResponse is the response type for + the Query/DenomMetadata RPC + + method. Identical with QueryDenomMetadataResponse but receives + denom as query string in request. + default: + description: An unexpected error response. + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + parameters: + - name: denom + description: denom is the coin denom to query the metadata for. + in: query + required: false + type: string + tags: + - Query + /cosmos/bank/v1beta1/params: + get: + summary: Params queries the parameters of x/bank module. + operationId: BankParams + responses: + '200': + description: A successful response. + schema: + type: object + properties: + params: + description: params provides the parameters of the bank module. + type: object + properties: + send_enabled: + type: array + items: + type: object + properties: + denom: + type: string + enabled: + type: boolean + description: >- + SendEnabled maps coin denom to a send_enabled status + (whether a denom is + + sendable). + description: >- + Deprecated: Use of SendEnabled in params is deprecated. + + For genesis, use the newly added send_enabled field in the + genesis object. + + Storage, lookup, and manipulation of this information is + now in the keeper. + + + As of cosmos-sdk 0.47, this only exists for backwards + compatibility of genesis files. + default_send_enabled: + type: boolean + description: >- + QueryParamsResponse defines the response type for querying x/bank + parameters. default: description: An unexpected error response. schema: @@ -4720,6 +5076,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -4759,7 +5119,6 @@ paths: name "y.z". - JSON @@ -4926,7 +5285,7 @@ paths: proposer_address: type: string format: byte - description: Header defines the structure of a Tendermint block header. + description: Header defines the structure of a block header. data: type: object properties: @@ -5009,9 +5368,32 @@ paths: signature: type: string format: byte + description: >- + Vote signature by the validator if they + participated in consensus for the + + associated block. + extension: + type: string + format: byte + description: >- + Vote extension provided by the + application. Only valid for precommit + + messages. + extension_signature: + type: string + format: byte + description: >- + Vote extension signature by the + validator if they participated in + + consensus for the associated block. + + Only valid for precommit messages. description: >- - Vote represents a prevote, precommit, or - commit vote from validators for + Vote represents a prevote or precommit vote + from validators for consensus. vote_b: @@ -5066,9 +5448,32 @@ paths: signature: type: string format: byte + description: >- + Vote signature by the validator if they + participated in consensus for the + + associated block. + extension: + type: string + format: byte + description: >- + Vote extension provided by the + application. Only valid for precommit + + messages. + extension_signature: + type: string + format: byte + description: >- + Vote extension signature by the + validator if they participated in + + consensus for the associated block. + + Only valid for precommit messages. description: >- - Vote represents a prevote, precommit, or - commit vote from validators for + Vote represents a prevote or precommit vote + from validators for consensus. total_voting_power: @@ -5172,8 +5577,8 @@ paths: type: string format: byte description: >- - Header defines the structure of a - Tendermint block header. + Header defines the structure of a block + header. commit: type: object properties: @@ -5214,7 +5619,7 @@ paths: - BLOCK_ID_FLAG_NIL default: BLOCK_ID_FLAG_UNKNOWN title: >- - BlockIdFlag indicates which BlcokID the + BlockIdFlag indicates which BlockID the signature is for validator_address: type: string @@ -5254,7 +5659,7 @@ paths: format: byte title: >- PublicKey defines the keys available for - use with Tendermint Validators + use with Validators voting_power: type: string format: int64 @@ -5278,7 +5683,7 @@ paths: format: byte title: >- PublicKey defines the keys available for - use with Tendermint Validators + use with Validators voting_power: type: string format: int64 @@ -5310,7 +5715,7 @@ paths: format: byte title: >- PublicKey defines the keys available for - use with Tendermint Validators + use with Validators voting_power: type: string format: int64 @@ -5367,7 +5772,7 @@ paths: - BLOCK_ID_FLAG_NIL default: BLOCK_ID_FLAG_UNKNOWN title: >- - BlockIdFlag indicates which BlcokID the + BlockIdFlag indicates which BlockID the signature is for validator_address: type: string @@ -5554,9 +5959,32 @@ paths: signature: type: string format: byte + description: >- + Vote signature by the validator if they + participated in consensus for the + + associated block. + extension: + type: string + format: byte + description: >- + Vote extension provided by the + application. Only valid for precommit + + messages. + extension_signature: + type: string + format: byte + description: >- + Vote extension signature by the + validator if they participated in + + consensus for the associated block. + + Only valid for precommit messages. description: >- - Vote represents a prevote, precommit, or - commit vote from validators for + Vote represents a prevote or precommit vote + from validators for consensus. vote_b: @@ -5611,9 +6039,32 @@ paths: signature: type: string format: byte + description: >- + Vote signature by the validator if they + participated in consensus for the + + associated block. + extension: + type: string + format: byte + description: >- + Vote extension provided by the + application. Only valid for precommit + + messages. + extension_signature: + type: string + format: byte + description: >- + Vote extension signature by the + validator if they participated in + + consensus for the associated block. + + Only valid for precommit messages. description: >- - Vote represents a prevote, precommit, or - commit vote from validators for + Vote represents a prevote or precommit vote + from validators for consensus. total_voting_power: @@ -5717,8 +6168,8 @@ paths: type: string format: byte description: >- - Header defines the structure of a - Tendermint block header. + Header defines the structure of a block + header. commit: type: object properties: @@ -5759,7 +6210,7 @@ paths: - BLOCK_ID_FLAG_NIL default: BLOCK_ID_FLAG_UNKNOWN title: >- - BlockIdFlag indicates which BlcokID the + BlockIdFlag indicates which BlockID the signature is for validator_address: type: string @@ -5799,7 +6250,7 @@ paths: format: byte title: >- PublicKey defines the keys available for - use with Tendermint Validators + use with Validators voting_power: type: string format: int64 @@ -5823,7 +6274,7 @@ paths: format: byte title: >- PublicKey defines the keys available for - use with Tendermint Validators + use with Validators voting_power: type: string format: int64 @@ -5855,7 +6306,7 @@ paths: format: byte title: >- PublicKey defines the keys available for - use with Tendermint Validators + use with Validators voting_power: type: string format: int64 @@ -5912,7 +6363,7 @@ paths: - BLOCK_ID_FLAG_NIL default: BLOCK_ID_FLAG_UNKNOWN title: >- - BlockIdFlag indicates which BlcokID the + BlockIdFlag indicates which BlockID the signature is for validator_address: type: string @@ -6050,6 +6501,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -6089,7 +6544,6 @@ paths: name "y.z". - JSON @@ -6237,7 +6691,7 @@ paths: proposer_address: type: string format: byte - description: Header defines the structure of a Tendermint block header. + description: Header defines the structure of a block header. data: type: object properties: @@ -6320,9 +6774,32 @@ paths: signature: type: string format: byte + description: >- + Vote signature by the validator if they + participated in consensus for the + + associated block. + extension: + type: string + format: byte + description: >- + Vote extension provided by the + application. Only valid for precommit + + messages. + extension_signature: + type: string + format: byte + description: >- + Vote extension signature by the + validator if they participated in + + consensus for the associated block. + + Only valid for precommit messages. description: >- - Vote represents a prevote, precommit, or - commit vote from validators for + Vote represents a prevote or precommit vote + from validators for consensus. vote_b: @@ -6377,9 +6854,32 @@ paths: signature: type: string format: byte + description: >- + Vote signature by the validator if they + participated in consensus for the + + associated block. + extension: + type: string + format: byte + description: >- + Vote extension provided by the + application. Only valid for precommit + + messages. + extension_signature: + type: string + format: byte + description: >- + Vote extension signature by the + validator if they participated in + + consensus for the associated block. + + Only valid for precommit messages. description: >- - Vote represents a prevote, precommit, or - commit vote from validators for + Vote represents a prevote or precommit vote + from validators for consensus. total_voting_power: @@ -6483,8 +6983,8 @@ paths: type: string format: byte description: >- - Header defines the structure of a - Tendermint block header. + Header defines the structure of a block + header. commit: type: object properties: @@ -6525,7 +7025,7 @@ paths: - BLOCK_ID_FLAG_NIL default: BLOCK_ID_FLAG_UNKNOWN title: >- - BlockIdFlag indicates which BlcokID the + BlockIdFlag indicates which BlockID the signature is for validator_address: type: string @@ -6565,7 +7065,7 @@ paths: format: byte title: >- PublicKey defines the keys available for - use with Tendermint Validators + use with Validators voting_power: type: string format: int64 @@ -6589,7 +7089,7 @@ paths: format: byte title: >- PublicKey defines the keys available for - use with Tendermint Validators + use with Validators voting_power: type: string format: int64 @@ -6621,7 +7121,7 @@ paths: format: byte title: >- PublicKey defines the keys available for - use with Tendermint Validators + use with Validators voting_power: type: string format: int64 @@ -6678,7 +7178,7 @@ paths: - BLOCK_ID_FLAG_NIL default: BLOCK_ID_FLAG_UNKNOWN title: >- - BlockIdFlag indicates which BlcokID the + BlockIdFlag indicates which BlockID the signature is for validator_address: type: string @@ -6865,9 +7365,32 @@ paths: signature: type: string format: byte + description: >- + Vote signature by the validator if they + participated in consensus for the + + associated block. + extension: + type: string + format: byte + description: >- + Vote extension provided by the + application. Only valid for precommit + + messages. + extension_signature: + type: string + format: byte + description: >- + Vote extension signature by the + validator if they participated in + + consensus for the associated block. + + Only valid for precommit messages. description: >- - Vote represents a prevote, precommit, or - commit vote from validators for + Vote represents a prevote or precommit vote + from validators for consensus. vote_b: @@ -6922,9 +7445,32 @@ paths: signature: type: string format: byte + description: >- + Vote signature by the validator if they + participated in consensus for the + + associated block. + extension: + type: string + format: byte + description: >- + Vote extension provided by the + application. Only valid for precommit + + messages. + extension_signature: + type: string + format: byte + description: >- + Vote extension signature by the + validator if they participated in + + consensus for the associated block. + + Only valid for precommit messages. description: >- - Vote represents a prevote, precommit, or - commit vote from validators for + Vote represents a prevote or precommit vote + from validators for consensus. total_voting_power: @@ -7028,8 +7574,8 @@ paths: type: string format: byte description: >- - Header defines the structure of a - Tendermint block header. + Header defines the structure of a block + header. commit: type: object properties: @@ -7070,7 +7616,7 @@ paths: - BLOCK_ID_FLAG_NIL default: BLOCK_ID_FLAG_UNKNOWN title: >- - BlockIdFlag indicates which BlcokID the + BlockIdFlag indicates which BlockID the signature is for validator_address: type: string @@ -7110,7 +7656,7 @@ paths: format: byte title: >- PublicKey defines the keys available for - use with Tendermint Validators + use with Validators voting_power: type: string format: int64 @@ -7134,7 +7680,7 @@ paths: format: byte title: >- PublicKey defines the keys available for - use with Tendermint Validators + use with Validators voting_power: type: string format: int64 @@ -7166,7 +7712,7 @@ paths: format: byte title: >- PublicKey defines the keys available for - use with Tendermint Validators + use with Validators voting_power: type: string format: int64 @@ -7223,7 +7769,7 @@ paths: - BLOCK_ID_FLAG_NIL default: BLOCK_ID_FLAG_UNKNOWN title: >- - BlockIdFlag indicates which BlcokID the + BlockIdFlag indicates which BlockID the signature is for validator_address: type: string @@ -7361,6 +7907,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -7400,7 +7950,6 @@ paths: name "y.z". - JSON @@ -7642,6 +8191,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -7681,7 +8234,6 @@ paths: name "y.z". - JSON @@ -7850,6 +8402,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -7889,7 +8445,6 @@ paths: name "y.z". - JSON @@ -8049,6 +8604,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -8088,7 +8647,6 @@ paths: name "y.z". - JSON @@ -8271,6 +8829,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -8310,7 +8872,6 @@ paths: name "y.z". - JSON @@ -8527,6 +9088,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -8566,7 +9131,6 @@ paths: name "y.z". - JSON @@ -8749,6 +9313,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -8788,7 +9356,6 @@ paths: name "y.z". - JSON @@ -8891,6 +9458,104 @@ paths: type: boolean tags: - Service + /cosmos/base/node/v1beta1/config: + get: + summary: Config queries for the operator configuration. + operationId: Config + responses: + '200': + description: A successful response. + schema: + type: object + properties: + minimum_gas_price: + type: string + pruning_keep_recent: + type: string + pruning_interval: + type: string + halt_height: + type: string + format: uint64 + description: >- + ConfigResponse defines the response structure for the Config gRPC + query. + default: + description: An unexpected error response. + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + tags: + - Service + /cosmos/base/node/v1beta1/status: + get: + summary: Status queries for the node status. + operationId: Status + responses: + '200': + description: A successful response. + schema: + type: object + properties: + earliest_store_height: + type: string + format: uint64 + height: + type: string + format: uint64 + timestamp: + type: string + format: date-time + app_hash: + type: string + format: byte + validator_hash: + type: string + format: byte + description: >- + StateResponse defines the response structure for the status of a + node. + default: + description: An unexpected error response. + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + tags: + - Service /cosmos/distribution/v1beta1/community_pool: get: summary: CommunityPool queries the community pool coins. @@ -8952,7 +9617,7 @@ paths: /cosmos/distribution/v1beta1/delegators/{delegator_address}/rewards: get: summary: |- - DelegationTotalRewards queries the total rewards accrued by a each + DelegationTotalRewards queries the total rewards accrued by each validator. operationId: DelegationTotalRewards responses: @@ -9753,6 +10418,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -9792,7 +10461,6 @@ paths: name "y.z". - JSON @@ -9969,6 +10637,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -10008,7 +10680,6 @@ paths: name "y.z". - JSON @@ -10214,6 +10885,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -10253,7 +10928,6 @@ paths: name "y.z". - JSON @@ -10405,6 +11079,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -10444,7 +11122,6 @@ paths: name "y.z". - JSON @@ -10690,6 +11367,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -10729,7 +11410,6 @@ paths: name "y.z". - JSON @@ -10898,6 +11578,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -10937,7 +11621,6 @@ paths: name "y.z". - JSON @@ -11194,6 +11877,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -11233,7 +11920,6 @@ paths: name "y.z". - JSON @@ -11483,6 +12169,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -11522,7 +12212,6 @@ paths: name "y.z". - JSON @@ -11752,6 +12441,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -11791,7 +12484,6 @@ paths: name "y.z". - JSON @@ -12023,6 +12715,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -12062,7 +12758,6 @@ paths: name "y.z". - JSON @@ -12169,8 +12864,8 @@ paths: /cosmos/gov/v1beta1/proposals/{proposal_id}/deposits/{depositor}: get: summary: >- - Deposit queries single deposit information based proposalID, - depositAddr. + Deposit queries single deposit information based on proposalID, + depositor address. operationId: Deposit responses: '200': @@ -12329,6 +13024,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -12367,242 +13066,244 @@ paths: name "y.z". - - - JSON - - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: proposal_id - description: proposal_id defines the unique id of the proposal. - in: path - required: true - type: string - format: uint64 - - name: depositor - description: depositor defines the deposit addresses from the proposals. - in: path - required: true - type: string - tags: - - Query - /cosmos/gov/v1beta1/proposals/{proposal_id}/tally: - get: - summary: TallyResult queries the tally of a proposal vote. - operationId: TallyResult - responses: - '200': - description: A successful response. - schema: - type: object - properties: - tally: - description: tally defines the requested tally. - type: object - properties: - 'yes': - type: string - description: yes is the number of yes votes on a proposal. - abstain: - type: string - description: abstain is the number of abstain votes on a proposal. - 'no': - type: string - description: no is the number of no votes on a proposal. - no_with_veto: - type: string - description: >- - no_with_veto is the number of no with veto votes on a - proposal. - description: >- - QueryTallyResultResponse is the response type for the Query/Tally - RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - error: - type: string - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - type_url: - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - value: - type: string - format: byte - description: >- - Must be a valid serialized protocol buffer of the above - specified type. - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with + an + + additional field `@type` which contains the type URL. + Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding + a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + parameters: + - name: proposal_id + description: proposal_id defines the unique id of the proposal. + in: path + required: true + type: string + format: uint64 + - name: depositor + description: depositor defines the deposit addresses from the proposals. + in: path + required: true + type: string + tags: + - Query + /cosmos/gov/v1beta1/proposals/{proposal_id}/tally: + get: + summary: TallyResult queries the tally of a proposal vote. + operationId: TallyResult + responses: + '200': + description: A successful response. + schema: + type: object + properties: + tally: + description: tally defines the requested tally. + type: object + properties: + 'yes': + type: string + description: yes is the number of yes votes on a proposal. + abstain: + type: string + description: abstain is the number of abstain votes on a proposal. + 'no': + type: string + description: no is the number of no votes on a proposal. + no_with_veto: + type: string + description: >- + no_with_veto is the number of no with veto votes on a + proposal. + description: >- + QueryTallyResultResponse is the response type for the Query/Tally + RPC method. + default: + description: An unexpected error response. + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + value: + type: string + format: byte + description: >- + Must be a valid serialized protocol buffer of the above + specified type. + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by + default use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the + last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". JSON @@ -12865,6 +13566,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -12904,7 +13609,6 @@ paths: name "y.z". - JSON @@ -13199,6 +13903,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -13238,7 +13946,6 @@ paths: name "y.z". - JSON @@ -13291,141 +13998,21 @@ paths: type: string tags: - Query - /cosmos/gov/v1/params/{params_type}: + /cosmos/gov/v1/constitution: get: - summary: Params queries all parameters of the gov module. - operationId: GovV1Params + summary: Constitution queries the chain's constitution. + operationId: Constitution responses: '200': description: A successful response. schema: type: object properties: - voting_params: - description: |- - Deprecated: Prefer to use `params` instead. - voting_params defines the parameters related to voting. - type: object - properties: - voting_period: - type: string - description: Duration of the voting period. - deposit_params: - description: |- - Deprecated: Prefer to use `params` instead. - deposit_params defines the parameters related to deposit. - type: object - properties: - min_deposit: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the - custom method - - signatures required by gogoproto. - description: Minimum deposit for a proposal to enter voting period. - max_deposit_period: - type: string - description: >- - Maximum period for Atom holders to deposit on a proposal. - Initial value: 2 - - months. - tally_params: - description: |- - Deprecated: Prefer to use `params` instead. - tally_params defines the parameters related to tally. - type: object - properties: - quorum: - type: string - description: >- - Minimum percentage of total stake needed to vote for a - result to be - - considered valid. - threshold: - type: string - description: >- - Minimum proportion of Yes votes for proposal to pass. - Default value: 0.5. - veto_threshold: - type: string - description: >- - Minimum value of Veto votes to Total votes ratio for - proposal to be - - vetoed. Default value: 1/3. - params: - description: |- - params defines all the paramaters of x/gov module. - - Since: cosmos-sdk 0.47 - type: object - properties: - min_deposit: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the - custom method - - signatures required by gogoproto. - description: Minimum deposit for a proposal to enter voting period. - max_deposit_period: - type: string - description: >- - Maximum period for Atom holders to deposit on a proposal. - Initial value: 2 - - months. - voting_period: - type: string - description: Duration of the voting period. - quorum: - type: string - description: >- - Minimum percentage of total stake needed to vote for a - result to be - considered valid. - threshold: - type: string - description: >- - Minimum proportion of Yes votes for proposal to pass. - Default value: 0.5. - veto_threshold: - type: string - description: >- - Minimum value of Veto votes to Total votes ratio for - proposal to be - vetoed. Default value: 1/3. - min_initial_deposit_ratio: - type: string - description: >- - The ratio representing the proportion of the deposit value - that must be paid at proposal submission. - description: >- - QueryParamsResponse is the response type for the Query/Params RPC - method. + constitution: + type: string + title: >- + QueryConstitutionResponse is the response type for the + Query/Constitution RPC method default: description: An unexpected error response. schema: @@ -13539,6 +14126,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -13578,6 +14169,411 @@ paths: name "y.z". + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with + an + + additional field `@type` which contains the type URL. + Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding + a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + tags: + - Query + /cosmos/gov/v1/params/{params_type}: + get: + summary: Params queries all parameters of the gov module. + operationId: GovV1Params + responses: + '200': + description: A successful response. + schema: + type: object + properties: + voting_params: + description: |- + Deprecated: Prefer to use `params` instead. + voting_params defines the parameters related to voting. + type: object + properties: + voting_period: + type: string + description: Duration of the voting period. + deposit_params: + description: |- + Deprecated: Prefer to use `params` instead. + deposit_params defines the parameters related to deposit. + type: object + properties: + min_deposit: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the + custom method + + signatures required by gogoproto. + description: Minimum deposit for a proposal to enter voting period. + max_deposit_period: + type: string + description: >- + Maximum period for Atom holders to deposit on a proposal. + Initial value: 2 + + months. + tally_params: + description: |- + Deprecated: Prefer to use `params` instead. + tally_params defines the parameters related to tally. + type: object + properties: + quorum: + type: string + description: >- + Minimum percentage of total stake needed to vote for a + result to be + + considered valid. + threshold: + type: string + description: >- + Minimum proportion of Yes votes for proposal to pass. + Default value: 0.5. + veto_threshold: + type: string + description: >- + Minimum value of Veto votes to Total votes ratio for + proposal to be + + vetoed. Default value: 1/3. + params: + description: |- + params defines all the paramaters of x/gov module. + + Since: cosmos-sdk 0.47 + type: object + properties: + min_deposit: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the + custom method + + signatures required by gogoproto. + description: Minimum deposit for a proposal to enter voting period. + max_deposit_period: + type: string + description: >- + Maximum period for Atom holders to deposit on a proposal. + Initial value: 2 + + months. + voting_period: + type: string + description: Duration of the voting period. + quorum: + type: string + description: >- + Minimum percentage of total stake needed to vote for a + result to be + considered valid. + threshold: + type: string + description: >- + Minimum proportion of Yes votes for proposal to pass. + Default value: 0.5. + veto_threshold: + type: string + description: >- + Minimum value of Veto votes to Total votes ratio for + proposal to be + vetoed. Default value: 1/3. + min_initial_deposit_ratio: + type: string + description: >- + The ratio representing the proportion of the deposit value + that must be paid at proposal submission. + proposal_cancel_ratio: + type: string + description: >- + The cancel ratio which will not be returned back to the + depositors when a proposal is cancelled. + + + Since: cosmos-sdk 0.50 + proposal_cancel_dest: + type: string + description: >- + The address which will receive (proposal_cancel_ratio * + deposit) proposal deposits. + + If empty, the (proposal_cancel_ratio * deposit) proposal + deposits will be burned. + + + Since: cosmos-sdk 0.50 + expedited_voting_period: + type: string + description: |- + Duration of the voting period of an expedited proposal. + + Since: cosmos-sdk 0.50 + expedited_threshold: + type: string + description: >- + Minimum proportion of Yes votes for proposal to pass. + Default value: 0.67. + + + Since: cosmos-sdk 0.50 + expedited_min_deposit: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the + custom method + + signatures required by gogoproto. + description: >- + Minimum expedited deposit for a proposal to enter voting + period. + burn_vote_quorum: + type: boolean + title: burn deposits if a proposal does not meet quorum + burn_proposal_deposit_prevote: + type: boolean + title: burn deposits if the proposal does not enter voting period + burn_vote_veto: + type: boolean + title: burn deposits if quorum with vote type no_veto is met + min_deposit_ratio: + type: string + description: >- + The ratio representing the proportion of the deposit value + minimum that must be met when making a deposit. + + Default value: 0.01. Meaning that for a chain with a + min_deposit of 100stake, a deposit of 1stake would be + + required. + + + Since: cosmos-sdk 0.50 + description: >- + QueryParamsResponse is the response type for the Query/Params RPC + method. + default: + description: An unexpected error response. + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + value: + type: string + format: byte + description: >- + Must be a valid serialized protocol buffer of the above + specified type. + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by + default use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the + last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + JSON @@ -13749,6 +14745,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -13788,7 +14788,6 @@ paths: name "y.z". - JSON @@ -13909,9 +14908,14 @@ paths: description: voting_end_time is the end time of voting on a proposal. metadata: type: string - description: >- + title: >- metadata is any arbitrary metadata attached to the proposal. + + the recommended format of the metadata is to be found + here: + + https://docs.cosmos.network/v0.47/modules/gov#proposal-3 title: type: string description: 'Since: cosmos-sdk 0.47' @@ -13923,7 +14927,15 @@ paths: proposer: type: string description: 'Since: cosmos-sdk 0.47' - title: Proposer is the address of the proposal sumbitter + title: proposer is the address of the proposal sumbitter + expedited: + type: boolean + description: 'Since: cosmos-sdk 0.50' + title: expedited defines if the proposal is expedited + failed_reason: + type: string + description: 'Since: cosmos-sdk 0.50' + title: failed_reason defines the reason why the proposal failed description: >- Proposal defines the core field members of a governance proposal. @@ -14065,6 +15077,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -14104,7 +15120,6 @@ paths: name "y.z". - JSON @@ -14356,6 +15371,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -14395,7 +15414,6 @@ paths: name "y.z". - JSON @@ -14515,9 +15533,14 @@ paths: description: voting_end_time is the end time of voting on a proposal. metadata: type: string - description: >- + title: >- metadata is any arbitrary metadata attached to the proposal. + + the recommended format of the metadata is to be found + here: + + https://docs.cosmos.network/v0.47/modules/gov#proposal-3 title: type: string description: 'Since: cosmos-sdk 0.47' @@ -14529,7 +15552,15 @@ paths: proposer: type: string description: 'Since: cosmos-sdk 0.47' - title: Proposer is the address of the proposal sumbitter + title: proposer is the address of the proposal sumbitter + expedited: + type: boolean + description: 'Since: cosmos-sdk 0.50' + title: expedited defines if the proposal is expedited + failed_reason: + type: string + description: 'Since: cosmos-sdk 0.50' + title: failed_reason defines the reason why the proposal failed description: >- Proposal defines the core field members of a governance proposal. @@ -14649,6 +15680,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -14688,7 +15723,6 @@ paths: name "y.z". - JSON @@ -14920,6 +15954,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -14959,7 +15997,6 @@ paths: name "y.z". - JSON @@ -15066,7 +16103,7 @@ paths: /cosmos/gov/v1/proposals/{proposal_id}/deposits/{depositor}: get: summary: >- - Deposit queries single deposit information based proposalID, + Deposit queries single deposit information based on proposalID, depositAddr. operationId: GovV1Deposit responses: @@ -15226,6 +16263,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -15265,7 +16306,6 @@ paths: name "y.z". - JSON @@ -15464,6 +16504,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -15503,7 +16547,6 @@ paths: name "y.z". - JSON @@ -15601,9 +16644,12 @@ paths: description: options is the weighted vote options. metadata: type: string - description: >- - metadata is any arbitrary metadata to attached to the - vote. + title: >- + metadata is any arbitrary metadata attached to the vote. + + the recommended format of the metadata is to be found + here: + https://docs.cosmos.network/v0.47/modules/gov#vote-5 description: >- Vote defines a vote on a governance proposal. @@ -15745,6 +16791,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -15784,7 +16834,6 @@ paths: name "y.z". - JSON @@ -15936,9 +16985,11 @@ paths: description: options is the weighted vote options. metadata: type: string - description: >- - metadata is any arbitrary metadata to attached to the - vote. + title: >- + metadata is any arbitrary metadata attached to the vote. + + the recommended format of the metadata is to be found + here: https://docs.cosmos.network/v0.47/modules/gov#vote-5 description: >- Vote defines a vote on a governance proposal. @@ -16060,6 +17111,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -16099,7 +17154,6 @@ paths: name "y.z". - JSON @@ -16501,19 +17555,19 @@ paths: format: int64 title: >- Height at which validator was first a candidate OR was - unjailed + un-jailed index_offset: type: string format: int64 description: >- - Index which is incremented each time the validator was a - bonded + Index which is incremented every time a validator is + bonded in a block and - in a block and may have signed a precommit or not. This - in conjunction with the + _may_ have signed a pre-commit or not. This in + conjunction with the - `SignedBlocksWindow` param determines the index in the - `MissedBlocksBitArray`. + signed_blocks_window param determines the index in the + missed block bitmap. jailed_until: type: string format: date-time @@ -16524,18 +17578,20 @@ paths: type: boolean description: >- Whether or not a validator has been tombstoned (killed - out of validator set). It is set + out of validator + + set). It is set once the validator commits an + equivocation or for any other - once the validator commits an equivocation or for any - other configured misbehiavor. + configured misbehavior. missed_blocks_counter: type: string format: int64 description: >- - A counter kept to avoid unnecessary array reads. + A counter of missed (unsigned) blocks. It is used to + avoid unnecessary - Note that `Sum(MissedBlocksBitArray)` always equals - `MissedBlocksCounter`. + reads in the missed block bitmap. description: >- ValidatorSigningInfo defines a validator's signing info for monitoring their @@ -16676,19 +17732,19 @@ paths: format: int64 title: >- Height at which validator was first a candidate OR was - unjailed + un-jailed index_offset: type: string format: int64 description: >- - Index which is incremented each time the validator was a - bonded + Index which is incremented every time a validator is + bonded in a block and - in a block and may have signed a precommit or not. This in - conjunction with the + _may_ have signed a pre-commit or not. This in conjunction + with the - `SignedBlocksWindow` param determines the index in the - `MissedBlocksBitArray`. + signed_blocks_window param determines the index in the + missed block bitmap. jailed_until: type: string format: date-time @@ -16699,18 +17755,20 @@ paths: type: boolean description: >- Whether or not a validator has been tombstoned (killed out - of validator set). It is set + of validator - once the validator commits an equivocation or for any - other configured misbehiavor. + set). It is set once the validator commits an equivocation + or for any other + + configured misbehavior. missed_blocks_counter: type: string format: int64 description: >- - A counter kept to avoid unnecessary array reads. + A counter of missed (unsigned) blocks. It is used to avoid + unnecessary - Note that `Sum(MissedBlocksBitArray)` always equals - `MissedBlocksCounter`. + reads in the missed block bitmap. description: >- ValidatorSigningInfo defines a validator's signing info for monitoring their @@ -16782,13 +17840,13 @@ paths: delegator_address: type: string description: >- - delegator_address is the bech32-encoded address of - the delegator. + delegator_address is the encoded address of the + delegator. validator_address: type: string description: >- - validator_address is the bech32-encoded address of - the validator. + validator_address is the encoded address of the + validator. shares: type: string description: shares define the delegation shares received. @@ -16959,6 +18017,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -16998,7 +18060,6 @@ paths: name "y.z". - JSON @@ -17390,6 +18451,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -17429,7 +18494,6 @@ paths: name "y.z". - JSON @@ -17569,12 +18633,12 @@ paths: delegator_address: type: string description: >- - delegator_address is the bech32-encoded address of the + delegator_address is the encoded address of the delegator. validator_address: type: string description: >- - validator_address is the bech32-encoded address of the + validator_address is the encoded address of the validator. entries: type: array @@ -17761,6 +18825,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -17800,7 +18868,6 @@ paths: name "y.z". - JSON @@ -18029,6 +19096,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -18068,7 +19139,6 @@ paths: name "y.z". - JSON @@ -18387,6 +19457,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -18426,7 +19500,6 @@ paths: name "y.z". - JSON @@ -18648,6 +19721,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -18687,7 +19764,6 @@ paths: name "y.z". - JSON @@ -18983,6 +20059,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -19022,7 +20102,6 @@ paths: name "y.z". - JSON @@ -19164,7 +20243,7 @@ paths: proposer_address: type: string format: byte - description: Header defines the structure of a Tendermint block header. + description: Header defines the structure of a block header. valset: type: array items: @@ -19275,6 +20354,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -19314,7 +20397,6 @@ paths: name "y.z". - JSON @@ -19616,6 +20698,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -19655,7 +20741,6 @@ paths: name "y.z". - JSON @@ -19860,217 +20945,9 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - tags: - - Query - /cosmos/staking/v1beta1/pool: - get: - summary: Pool queries the pool info. - operationId: Pool - responses: - '200': - description: A successful response. - schema: - type: object - properties: - pool: - description: pool defines the pool info. - type: object - properties: - not_bonded_tokens: - type: string - bonded_tokens: - type: string - description: QueryPoolResponse is response type for the Query/Pool RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - error: - type: string - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - type_url: - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - value: - type: string - format: byte - description: >- - Must be a valid serialized protocol buffer of the above - specified type. - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); } Example 3: Pack and unpack a message in Python. @@ -20111,6 +20988,220 @@ paths: name "y.z". + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with + an + + additional field `@type` which contains the type URL. + Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding + a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + tags: + - Query + /cosmos/staking/v1beta1/pool: + get: + summary: Pool queries the pool info. + operationId: Pool + responses: + '200': + description: A successful response. + schema: + type: object + properties: + pool: + description: pool defines the pool info. + type: object + properties: + not_bonded_tokens: + type: string + bonded_tokens: + type: string + description: QueryPoolResponse is response type for the Query/Pool RPC method. + default: + description: An unexpected error response. + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + value: + type: string + format: byte + description: >- + Must be a valid serialized protocol buffer of the above + specified type. + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by + default use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the + last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + JSON @@ -20276,6 +21367,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -20315,7 +21410,6 @@ paths: name "y.z". - JSON @@ -20634,6 +21728,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -20673,7 +21771,6 @@ paths: name "y.z". - JSON @@ -20893,6 +21990,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -20932,7 +22033,6 @@ paths: name "y.z". - JSON @@ -21228,6 +22328,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -21267,7 +22371,6 @@ paths: name "y.z". - JSON @@ -21340,13 +22443,13 @@ paths: delegator_address: type: string description: >- - delegator_address is the bech32-encoded address of - the delegator. + delegator_address is the encoded address of the + delegator. validator_address: type: string description: >- - validator_address is the bech32-encoded address of - the validator. + validator_address is the encoded address of the + validator. shares: type: string description: shares define the delegation shares received. @@ -21514,6 +22617,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -21553,7 +22660,6 @@ paths: name "y.z". - JSON @@ -21675,12 +22781,12 @@ paths: delegator_address: type: string description: >- - delegator_address is the bech32-encoded address of the + delegator_address is the encoded address of the delegator. validator_address: type: string description: >- - validator_address is the bech32-encoded address of the + validator_address is the encoded address of the validator. shares: type: string @@ -21830,6 +22936,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -21869,7 +22979,6 @@ paths: name "y.z". - JSON @@ -21938,14 +23047,10 @@ paths: properties: delegator_address: type: string - description: >- - delegator_address is the bech32-encoded address of the - delegator. + description: delegator_address is the encoded address of the delegator. validator_address: type: string - description: >- - validator_address is the bech32-encoded address of the - validator. + description: validator_address is the encoded address of the validator. entries: type: array items: @@ -22108,6 +23213,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -22147,7 +23256,6 @@ paths: name "y.z". - JSON @@ -22224,12 +23332,12 @@ paths: delegator_address: type: string description: >- - delegator_address is the bech32-encoded address of the + delegator_address is the encoded address of the delegator. validator_address: type: string description: >- - validator_address is the bech32-encoded address of the + validator_address is the encoded address of the validator. entries: type: array @@ -22416,6 +23524,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -22455,7 +23567,6 @@ paths: name "y.z". - JSON @@ -22681,6 +23792,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -22720,7 +23835,6 @@ paths: name "y.z". - JSON @@ -22911,6 +24025,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -22950,7 +24068,6 @@ paths: name "y.z". - JSON @@ -23142,6 +24259,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -23181,7 +24302,6 @@ paths: name "y.z". - JSON @@ -23363,6 +24483,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -23402,7 +24526,6 @@ paths: name "y.z". - JSON @@ -23532,8 +24655,7 @@ paths: Event allows application developers to attach additional information to - ResponseBeginBlock, ResponseEndBlock, ResponseCheckTx - and ResponseDeliverTx. + ResponseFinalizeBlock and ResponseCheckTx. Later, transactions may be queried using these events. description: >- @@ -23642,6 +24764,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -23681,7 +24807,6 @@ paths: name "y.z". - JSON @@ -23844,6 +24969,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -23883,7 +25012,6 @@ paths: name "y.z". - JSON @@ -24052,6 +25180,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -24091,7 +25223,6 @@ paths: name "y.z". - JSON @@ -24132,7 +25263,13 @@ paths: } parameters: - name: events - description: events is the list of transaction event type. + description: >- + events is the list of transaction event type. + + Deprecated post v0.47.x: use query instead, which should contain a + valid + + events query. in: query required: false type: array @@ -24197,7 +25334,8 @@ paths: type: boolean - name: order_by description: |2- - - ORDER_BY_UNSPECIFIED: ORDER_BY_UNSPECIFIED specifies an unknown sorting order. OrderBy defaults to ASC in this case. + - ORDER_BY_UNSPECIFIED: ORDER_BY_UNSPECIFIED specifies an unknown sorting order. OrderBy defaults + to ASC in this case. - ORDER_BY_ASC: ORDER_BY_ASC defines ascending order - ORDER_BY_DESC: ORDER_BY_DESC defines descending order in: query @@ -24209,7 +25347,7 @@ paths: - ORDER_BY_DESC default: ORDER_BY_UNSPECIFIED - name: page - description: >- + description: |- page is the page number to query, starts at 1. If not provided, will default to first page. in: query @@ -24226,6 +25364,18 @@ paths: required: false type: string format: uint64 + - name: query + description: >- + query defines the transaction event query that is proxied to + Tendermint's + + TxSearch RPC method. The query must be valid. + + + Since cosmos-sdk 0.50 + in: query + required: false + type: string tags: - Service post: @@ -24422,6 +25572,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -24461,7 +25615,6 @@ paths: name "y.z". - JSON @@ -24535,8 +25688,7 @@ paths: Event allows application developers to attach additional information to - ResponseBeginBlock, ResponseEndBlock, ResponseCheckTx - and ResponseDeliverTx. + ResponseFinalizeBlock and ResponseCheckTx. Later, transactions may be queried using these events. description: >- @@ -24675,6 +25827,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -24714,7 +25870,6 @@ paths: name "y.z". - JSON @@ -24774,16 +25929,18 @@ paths: default: BROADCAST_MODE_UNSPECIFIED description: >- BroadcastMode specifies the broadcast mode for the - TxService.Broadcast RPC method. + TxService.Broadcast RPC + + method. - BROADCAST_MODE_UNSPECIFIED: zero-value for mode ordering - BROADCAST_MODE_BLOCK: DEPRECATED: use BROADCAST_MODE_SYNC instead, BROADCAST_MODE_BLOCK is not supported by the SDK from v0.47.x onwards. - - BROADCAST_MODE_SYNC: BROADCAST_MODE_SYNC defines a tx broadcasting mode where the client waits for - a CheckTx execution response only. - - BROADCAST_MODE_ASYNC: BROADCAST_MODE_ASYNC defines a tx broadcasting mode where the client returns - immediately. + - BROADCAST_MODE_SYNC: BROADCAST_MODE_SYNC defines a tx broadcasting mode where the client waits + for a CheckTx execution response only. + - BROADCAST_MODE_ASYNC: BROADCAST_MODE_ASYNC defines a tx broadcasting mode where the client + returns immediately. description: >- BroadcastTxRequest is the request type for the Service.BroadcastTxRequest @@ -24914,270 +26071,277 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: height - description: height is the height of the block to query. - in: path - required: true - type: string - format: int64 - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Service - /cosmos/tx/v1beta1/txs/{hash}: - get: - summary: GetTx fetches a tx by hash. - operationId: GetTx - responses: - '200': - description: A successful response. - schema: - $ref: '#/definitions/cosmos.tx.v1beta1.GetTxResponse' - default: - description: An unexpected error response. - schema: - type: object - properties: - error: - type: string - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - type_url: - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - value: - type: string - format: byte - description: >- - Must be a valid serialized protocol buffer of the above - specified type. - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by + default use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the + last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with + an + + additional field `@type` which contains the type URL. + Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding + a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + parameters: + - name: height + description: height is the height of the block to query. + in: path + required: true + type: string + format: int64 + - name: pagination.key + description: |- + key is a value returned in PageResponse.next_key to begin + querying the next page most efficiently. Only one of offset or key + should be set. + in: query + required: false + type: string + format: byte + - name: pagination.offset + description: >- + offset is a numeric offset that can be used when key is unavailable. + + It is less efficient than using key. Only one of offset or key + should + + be set. + in: query + required: false + type: string + format: uint64 + - name: pagination.limit + description: >- + limit is the total number of results to be returned in the result + page. + + If left empty it will default to a value to be set by each app. + in: query + required: false + type: string + format: uint64 + - name: pagination.count_total + description: >- + count_total is set to true to indicate that the result set should + include + + a count of the total number of items available for pagination in + UIs. + + count_total is only respected when offset is used. It is ignored + when key + + is set. + in: query + required: false + type: boolean + - name: pagination.reverse + description: >- + reverse is set to true if results are to be returned in the + descending order. + + + Since: cosmos-sdk 0.43 + in: query + required: false + type: boolean + tags: + - Service + /cosmos/tx/v1beta1/txs/{hash}: + get: + summary: GetTx fetches a tx by hash. + operationId: GetTx + responses: + '200': + description: A successful response. + schema: + $ref: '#/definitions/cosmos.tx.v1beta1.GetTxResponse' + default: + description: An unexpected error response. + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + value: + type: string + format: byte + description: >- + Must be a valid serialized protocol buffer of the above + specified type. + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); } Example 3: Pack and unpack a message in Python. @@ -25218,7 +26382,6 @@ paths: name "y.z". - JSON @@ -25397,6 +26560,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -25436,7 +26603,6 @@ paths: name "y.z". - JSON @@ -25611,6 +26777,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -25650,7 +26820,6 @@ paths: name "y.z". - JSON @@ -25848,6 +27017,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -25887,7 +27060,6 @@ paths: name "y.z". - JSON @@ -26044,6 +27216,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -26083,7 +27259,6 @@ paths: name "y.z". - JSON @@ -26275,6 +27450,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -26314,7 +27493,6 @@ paths: name "y.z". - JSON @@ -26507,6 +27685,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -26546,7 +27728,6 @@ paths: name "y.z". - JSON @@ -26710,6 +27891,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -26749,7 +27934,6 @@ paths: name "y.z". - JSON @@ -26942,6 +28126,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -26981,7 +28169,6 @@ paths: name "y.z". - JSON @@ -27213,6 +28400,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -27252,7 +28443,6 @@ paths: name "y.z". - JSON @@ -27437,6 +28627,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -27476,7 +28670,6 @@ paths: name "y.z". - JSON @@ -27697,6 +28890,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -27736,7 +28933,6 @@ paths: name "y.z". - JSON @@ -27921,6 +29117,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -27960,7 +29160,6 @@ paths: name "y.z". - JSON @@ -28064,7 +29263,7 @@ paths: - Query /cosmos/feegrant/v1beta1/allowance/{granter}/{grantee}: get: - summary: Allowance returns fee granted to the grantee by the granter. + summary: Allowance returns granted allwance to the grantee by the granter. operationId: Allowance responses: '200': @@ -28275,6 +29474,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -28314,7 +29517,6 @@ paths: name "y.z". - JSON @@ -28372,7 +29574,7 @@ paths: - Query /cosmos/feegrant/v1beta1/allowances/{grantee}: get: - summary: Allowances returns all the grants for address. + summary: Allowances returns all the grants for the given grantee address. operationId: Allowances responses: '200': @@ -28604,6 +29806,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -28643,7 +29849,6 @@ paths: name "y.z". - JSON @@ -28983,6 +30188,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -29022,7 +30231,6 @@ paths: name "y.z". - JSON @@ -29258,6 +30466,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -29297,7 +30509,6 @@ paths: name "y.z". - JSON @@ -29495,6 +30706,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -29534,7 +30749,6 @@ paths: name "y.z". - JSON @@ -29715,6 +30929,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -29754,7 +30972,6 @@ paths: name "y.z". - JSON @@ -29994,6 +31211,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -30033,7 +31254,6 @@ paths: name "y.z". - JSON @@ -30192,6 +31412,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -30231,7 +31455,6 @@ paths: name "y.z". - JSON @@ -30410,6 +31633,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -30449,7 +31676,6 @@ paths: name "y.z". - JSON @@ -30628,6 +31854,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -30667,7 +31897,6 @@ paths: name "y.z". - JSON @@ -30901,6 +32130,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -30940,7 +32173,6 @@ paths: name "y.z". - JSON @@ -31096,227 +32328,9 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: class_id - description: class_id associated with the nft - in: path - required: true - type: string - - name: id - description: id is a unique identifier of the NFT - in: path - required: true - type: string - tags: - - Query - /cosmos/nft/v1beta1/owner/{class_id}/{id}: - get: - summary: >- - Owner queries the owner of the NFT based on its class and id, same as - ownerOf in ERC721 - operationId: Owner - responses: - '200': - description: A successful response. - schema: - type: object - properties: - owner: - type: string - title: owner is the owner address of the nft - title: >- - QueryOwnerResponse is the response type for the Query/Owner RPC - method - default: - description: An unexpected error response. - schema: - type: object - properties: - error: - type: string - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - type_url: - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - value: - type: string - format: byte - description: >- - Must be a valid serialized protocol buffer of the above - specified type. - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); } Example 3: Pack and unpack a message in Python. @@ -31357,6 +32371,230 @@ paths: name "y.z". + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with + an + + additional field `@type` which contains the type URL. + Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding + a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + parameters: + - name: class_id + description: class_id associated with the nft + in: path + required: true + type: string + - name: id + description: id is a unique identifier of the NFT + in: path + required: true + type: string + tags: + - Query + /cosmos/nft/v1beta1/owner/{class_id}/{id}: + get: + summary: >- + Owner queries the owner of the NFT based on its class and id, same as + ownerOf in ERC721 + operationId: Owner + responses: + '200': + description: A successful response. + schema: + type: object + properties: + owner: + type: string + title: owner is the owner address of the nft + title: >- + QueryOwnerResponse is the response type for the Query/Owner RPC + method + default: + description: An unexpected error response. + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + value: + type: string + format: byte + description: >- + Must be a valid serialized protocol buffer of the above + specified type. + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by + default use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the + last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + JSON @@ -31541,6 +32779,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -31580,7 +32822,6 @@ paths: name "y.z". - JSON @@ -31650,9 +32891,13 @@ paths: description: admin is the account address of the group's admin. metadata: type: string - description: >- + title: >- metadata is any arbitrary metadata to attached to the group. + + the recommended format of the metadata is to be found + here: + https://docs.cosmos.network/v0.47/modules/group#group-1 version: type: string format: uint64 @@ -31791,6 +33036,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -31830,7 +33079,6 @@ paths: name "y.z". - JSON @@ -32059,6 +33307,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -32098,7 +33350,6 @@ paths: name "y.z". - JSON @@ -32229,9 +33480,14 @@ paths: description: admin is the account address of the group admin. metadata: type: string - description: >- + title: >- metadata is any arbitrary metadata attached to the group policy. + + the recommended format of the metadata is to be found + here: + + https://docs.cosmos.network/v0.47/modules/group#decision-policy-1 version: type: string format: uint64 @@ -32339,6 +33595,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -32378,7 +33638,6 @@ paths: name "y.z". - JSON @@ -32566,6 +33825,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -32605,7 +33868,6 @@ paths: name "y.z". - JSON @@ -32735,9 +33997,14 @@ paths: description: admin is the account address of the group admin. metadata: type: string - description: >- + title: >- metadata is any arbitrary metadata attached to the group policy. + + the recommended format of the metadata is to be found + here: + + https://docs.cosmos.network/v0.47/modules/group#decision-policy-1 version: type: string format: uint64 @@ -32845,6 +34112,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -32884,7 +34155,6 @@ paths: name "y.z". - JSON @@ -33072,6 +34342,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -33111,7 +34385,6 @@ paths: name "y.z". - JSON @@ -33242,9 +34515,14 @@ paths: description: admin is the account address of the group admin. metadata: type: string - description: >- + title: >- metadata is any arbitrary metadata attached to the group policy. + + the recommended format of the metadata is to be found + here: + + https://docs.cosmos.network/v0.47/modules/group#decision-policy-1 version: type: string format: uint64 @@ -33352,6 +34630,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -33391,7 +34673,6 @@ paths: name "y.z". - JSON @@ -33555,6 +34836,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -33594,7 +34879,6 @@ paths: name "y.z". - JSON @@ -33641,10 +34925,11 @@ paths: type: string tags: - Query - /cosmos/group/v1/groups_by_admin/{admin}: + /cosmos/group/v1/groups: get: - summary: GroupsByAdmin queries groups by admin address. - operationId: GroupsByAdmin + summary: Groups queries all groups in state. + description: 'Since: cosmos-sdk 0.47.1' + operationId: Groups responses: '200': description: A successful response. @@ -33665,9 +34950,348 @@ paths: description: admin is the account address of the group's admin. metadata: type: string - description: >- + title: >- metadata is any arbitrary metadata to attached to the group. + + the recommended format of the metadata is to be found + here: + https://docs.cosmos.network/v0.47/modules/group#group-1 + version: + type: string + format: uint64 + title: >- + version is used to track changes to a group's membership + structure that + + would break existing proposals. Whenever any members + weight is changed, + + or any member is added or removed this version is + incremented and will + + cause proposals based on older versions of this group to + fail + total_weight: + type: string + description: total_weight is the sum of the group members' weights. + created_at: + type: string + format: date-time + description: >- + created_at is a timestamp specifying when a group was + created. + description: >- + GroupInfo represents the high-level on-chain information for + a group. + description: '`groups` is all the groups present in state.' + pagination: + description: pagination defines the pagination in the response. + type: object + properties: + next_key: + type: string + format: byte + description: |- + next_key is the key to be passed to PageRequest.key to + query the next page most efficiently. It will be empty if + there are no more results. + total: + type: string + format: uint64 + title: >- + total is total number of results available if + PageRequest.count_total + + was set, its value is undefined otherwise + description: |- + QueryGroupsResponse is the Query/Groups response type. + + Since: cosmos-sdk 0.47.1 + default: + description: An unexpected error response. + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + value: + type: string + format: byte + description: >- + Must be a valid serialized protocol buffer of the above + specified type. + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by + default use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the + last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with + an + + additional field `@type` which contains the type URL. + Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding + a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + parameters: + - name: pagination.key + description: |- + key is a value returned in PageResponse.next_key to begin + querying the next page most efficiently. Only one of offset or key + should be set. + in: query + required: false + type: string + format: byte + - name: pagination.offset + description: >- + offset is a numeric offset that can be used when key is unavailable. + + It is less efficient than using key. Only one of offset or key + should + + be set. + in: query + required: false + type: string + format: uint64 + - name: pagination.limit + description: >- + limit is the total number of results to be returned in the result + page. + + If left empty it will default to a value to be set by each app. + in: query + required: false + type: string + format: uint64 + - name: pagination.count_total + description: >- + count_total is set to true to indicate that the result set should + include + + a count of the total number of items available for pagination in + UIs. + + count_total is only respected when offset is used. It is ignored + when key + + is set. + in: query + required: false + type: boolean + - name: pagination.reverse + description: >- + reverse is set to true if results are to be returned in the + descending order. + + + Since: cosmos-sdk 0.43 + in: query + required: false + type: boolean + tags: + - Query + /cosmos/group/v1/groups_by_admin/{admin}: + get: + summary: GroupsByAdmin queries groups by admin address. + operationId: GroupsByAdmin + responses: + '200': + description: A successful response. + schema: + type: object + properties: + groups: + type: array + items: + type: object + properties: + id: + type: string + format: uint64 + description: id is the unique ID of the group. + admin: + type: string + description: admin is the account address of the group's admin. + metadata: + type: string + title: >- + metadata is any arbitrary metadata to attached to the + group. + + the recommended format of the metadata is to be found + here: + https://docs.cosmos.network/v0.47/modules/group#group-1 version: type: string format: uint64 @@ -33831,6 +35455,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -33870,7 +35498,6 @@ paths: name "y.z". - JSON @@ -33997,9 +35624,13 @@ paths: description: admin is the account address of the group's admin. metadata: type: string - description: >- + title: >- metadata is any arbitrary metadata to attached to the group. + + the recommended format of the metadata is to be found + here: + https://docs.cosmos.network/v0.47/modules/group#group-1 version: type: string format: uint64 @@ -34163,6 +35794,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -34202,7 +35837,6 @@ paths: name "y.z". - JSON @@ -34330,9 +35964,14 @@ paths: policy. metadata: type: string - description: >- + title: >- metadata is any arbitrary metadata attached to the proposal. + + the recommended format of the metadata is to be found + here: + + https://docs.cosmos.network/v0.47/modules/group#proposal-4 proposers: type: array items: @@ -34533,6 +36172,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -34572,7 +36215,6 @@ paths: name "y.z". - JSON @@ -34738,6 +36380,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -34777,7 +36423,6 @@ paths: name "y.z". - JSON @@ -34975,6 +36620,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -35014,7 +36663,6 @@ paths: name "y.z". - JSON @@ -35090,9 +36738,14 @@ paths: policy. metadata: type: string - description: >- + title: >- metadata is any arbitrary metadata attached to the proposal. + + the recommended format of the metadata is to be found + here: + + https://docs.cosmos.network/v0.47/modules/group#proposal-4 proposers: type: array items: @@ -35293,6 +36946,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -35332,7 +36989,6 @@ paths: name "y.z". - JSON @@ -35531,6 +37187,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -35570,7 +37230,6 @@ paths: name "y.z". - JSON @@ -35708,11 +37367,17 @@ paths: default: VOTE_OPTION_UNSPECIFIED metadata: type: string - description: metadata is any arbitrary metadata attached to the vote. + title: >- + metadata is any arbitrary metadata attached to the vote. + + the recommended format of the metadata is to be found + here: + https://docs.cosmos.network/v0.47/modules/group#vote-2 submit_time: type: string format: date-time description: submit_time is the timestamp when the vote was submitted. + title: Vote represents a vote for a proposal.string metadata description: >- QueryVoteByProposalVoterResponse is the Query/VoteByProposalVoter response type. @@ -35829,275 +37494,9 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - - JSON - - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: proposal_id - description: proposal_id is the unique ID of a proposal. - in: path - required: true - type: string - format: uint64 - - name: voter - description: voter is a proposal voter account address. - in: path - required: true - type: string - tags: - - Query - /cosmos/group/v1/votes_by_proposal/{proposal_id}: - get: - summary: VotesByProposal queries a vote by proposal id. - operationId: VotesByProposal - responses: - '200': - description: A successful response. - schema: - type: object - properties: - votes: - type: array - items: - type: object - properties: - proposal_id: - type: string - format: uint64 - description: proposal is the unique ID of the proposal. - voter: - type: string - description: voter is the account address of the voter. - option: - description: option is the voter's choice on the proposal. - type: string - enum: - - VOTE_OPTION_UNSPECIFIED - - VOTE_OPTION_YES - - VOTE_OPTION_ABSTAIN - - VOTE_OPTION_NO - - VOTE_OPTION_NO_WITH_VETO - default: VOTE_OPTION_UNSPECIFIED - metadata: - type: string - description: metadata is any arbitrary metadata attached to the vote. - submit_time: - type: string - format: date-time - description: >- - submit_time is the timestamp when the vote was - submitted. - description: Vote represents a vote for a proposal. - description: votes are the list of votes for given proposal_id. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryVotesByProposalResponse is the Query/VotesByProposal response - type. - default: - description: An unexpected error response. - schema: - type: object - properties: - error: - type: string - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - type_url: - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - value: - type: string - format: byte - description: >- - Must be a valid serialized protocol buffer of the above - specified type. - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); } Example 3: Pack and unpack a message in Python. @@ -36138,6 +37537,283 @@ paths: name "y.z". + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with + an + + additional field `@type` which contains the type URL. + Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding + a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + parameters: + - name: proposal_id + description: proposal_id is the unique ID of a proposal. + in: path + required: true + type: string + format: uint64 + - name: voter + description: voter is a proposal voter account address. + in: path + required: true + type: string + tags: + - Query + /cosmos/group/v1/votes_by_proposal/{proposal_id}: + get: + summary: VotesByProposal queries a vote by proposal id. + operationId: VotesByProposal + responses: + '200': + description: A successful response. + schema: + type: object + properties: + votes: + type: array + items: + type: object + properties: + proposal_id: + type: string + format: uint64 + description: proposal is the unique ID of the proposal. + voter: + type: string + description: voter is the account address of the voter. + option: + description: option is the voter's choice on the proposal. + type: string + enum: + - VOTE_OPTION_UNSPECIFIED + - VOTE_OPTION_YES + - VOTE_OPTION_ABSTAIN + - VOTE_OPTION_NO + - VOTE_OPTION_NO_WITH_VETO + default: VOTE_OPTION_UNSPECIFIED + metadata: + type: string + title: >- + metadata is any arbitrary metadata attached to the vote. + + the recommended format of the metadata is to be found + here: + https://docs.cosmos.network/v0.47/modules/group#vote-2 + submit_time: + type: string + format: date-time + description: >- + submit_time is the timestamp when the vote was + submitted. + title: Vote represents a vote for a proposal.string metadata + description: votes are the list of votes for given proposal_id. + pagination: + description: pagination defines the pagination in the response. + type: object + properties: + next_key: + type: string + format: byte + description: |- + next_key is the key to be passed to PageRequest.key to + query the next page most efficiently. It will be empty if + there are no more results. + total: + type: string + format: uint64 + title: >- + total is total number of results available if + PageRequest.count_total + + was set, its value is undefined otherwise + description: >- + QueryVotesByProposalResponse is the Query/VotesByProposal response + type. + default: + description: An unexpected error response. + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + value: + type: string + format: byte + description: >- + Must be a valid serialized protocol buffer of the above + specified type. + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by + default use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the + last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + JSON @@ -36276,14 +37952,19 @@ paths: default: VOTE_OPTION_UNSPECIFIED metadata: type: string - description: metadata is any arbitrary metadata attached to the vote. + title: >- + metadata is any arbitrary metadata attached to the vote. + + the recommended format of the metadata is to be found + here: + https://docs.cosmos.network/v0.47/modules/group#vote-2 submit_time: type: string format: date-time description: >- submit_time is the timestamp when the vote was submitted. - description: Vote represents a vote for a proposal. + title: Vote represents a vote for a proposal.string metadata description: votes are the list of votes by given voter. pagination: description: pagination defines the pagination in the response. @@ -36418,6 +38099,10 @@ paths: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -36457,7 +38142,6 @@ paths: name "y.z". - JSON @@ -36560,128 +38244,551 @@ paths: type: boolean tags: - Query -definitions: - cosmos.auth.v1beta1.AddressBytesToStringResponse: - type: object - properties: - address_string: - type: string - description: >- - AddressBytesToStringResponse is the response type for AddressString rpc - method. + /cosmos/circuit/v1/accounts: + get: + summary: Account returns account permissions. + operationId: CircuitAccounts + responses: + '200': + description: A successful response. + schema: + type: object + properties: + accounts: + type: array + items: + type: object + properties: + address: + type: string + permissions: + type: object + properties: + level: + description: >- + level is the level of permissions granted to this + account. + type: string + enum: + - LEVEL_NONE_UNSPECIFIED + - LEVEL_SOME_MSGS + - LEVEL_ALL_MSGS + - LEVEL_SUPER_ADMIN + default: LEVEL_NONE_UNSPECIFIED + limit_type_urls: + type: array + items: + type: string + description: >- + limit_type_urls is used with LEVEL_SOME_MSGS to + limit the lists of Msg type + URLs that the account can trip. It is an error to + use limit_type_urls with - Since: cosmos-sdk 0.46 - cosmos.auth.v1beta1.AddressStringToBytesResponse: - type: object - properties: - address_bytes: - type: string - format: byte - description: >- - AddressStringToBytesResponse is the response type for AddressBytes rpc - method. + a level other than LEVEL_SOME_MSGS. + description: >- + Permissions are the permissions that an account has to + trip + or reset the circuit breaker. + title: >- + GenesisAccountPermissions is the account permissions for the + circuit breaker in genesis + pagination: + description: pagination defines the pagination in the response. + type: object + properties: + next_key: + type: string + format: byte + description: |- + next_key is the key to be passed to PageRequest.key to + query the next page most efficiently. It will be empty if + there are no more results. + total: + type: string + format: uint64 + title: >- + total is total number of results available if + PageRequest.count_total - Since: cosmos-sdk 0.46 - cosmos.auth.v1beta1.BaseAccount: - type: object - properties: - address: - type: string - pub_key: - type: object - properties: - type_url: - type: string + was set, its value is undefined otherwise description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all types - that they - - expect it to use in the context of Any. However, for URLs which - use the - - scheme `http`, `https`, or no scheme, one can optionally set up a - type + AccountsResponse is the response type for the Query/Accounts RPC + method. + default: + description: An unexpected error response. + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + parameters: + - name: pagination.key + description: |- + key is a value returned in PageResponse.next_key to begin + querying the next page most efficiently. Only one of offset or key + should be set. + in: query + required: false + type: string + format: byte + - name: pagination.offset + description: >- + offset is a numeric offset that can be used when key is unavailable. - server that maps type URLs to message definitions as follows: + It is less efficient than using key. Only one of offset or key + should + be set. + in: query + required: false + type: string + format: uint64 + - name: pagination.limit + description: >- + limit is the total number of results to be returned in the result + page. - * If no scheme is provided, `https` is assumed. + If left empty it will default to a value to be set by each app. + in: query + required: false + type: string + format: uint64 + - name: pagination.count_total + description: >- + count_total is set to true to indicate that the result set should + include - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) + a count of the total number of items available for pagination in + UIs. - Note: this functionality is not currently available in the - official + count_total is only respected when offset is used. It is ignored + when key - protobuf release, and it is not used for type URLs beginning with + is set. + in: query + required: false + type: boolean + - name: pagination.reverse + description: >- + reverse is set to true if results are to be returned in the + descending order. - type.googleapis.com. + Since: cosmos-sdk 0.43 + in: query + required: false + type: boolean + tags: + - Query + /cosmos/circuit/v1/accounts/{address}: + get: + summary: Account returns account permissions. + operationId: CircuitAccount + responses: + '200': + description: A successful response. + schema: + type: object + properties: + permission: + type: object + properties: + level: + description: level is the level of permissions granted to this account. + type: string + enum: + - LEVEL_NONE_UNSPECIFIED + - LEVEL_SOME_MSGS + - LEVEL_ALL_MSGS + - LEVEL_SUPER_ADMIN + default: LEVEL_NONE_UNSPECIFIED + limit_type_urls: + type: array + items: + type: string + description: >- + limit_type_urls is used with LEVEL_SOME_MSGS to limit the + lists of Msg type - Schemes other than `http`, `https` (or the empty scheme) might be + URLs that the account can trip. It is an error to use + limit_type_urls with - used with implementation specific semantics. - value: - type: string - format: byte + a level other than LEVEL_SOME_MSGS. + description: |- + Permissions are the permissions that an account has to trip + or reset the circuit breaker. description: >- - Must be a valid serialized protocol buffer of the above specified - type. - description: >- - `Any` contains an arbitrary serialized protocol buffer message along - with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in the - form - - of utility functions or additional generated methods of the Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - + AccountResponse is the response type for the Query/Account RPC + method. + default: + description: An unexpected error response. + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + parameters: + - name: address + in: path + required: true + type: string + tags: + - Query + /cosmos/circuit/v1/disable_list: + get: + summary: DisabledList returns a list of disabled message urls + operationId: DisabledList + responses: + '200': + description: A successful response. + schema: + type: object + properties: + disabled_list: + type: array + items: + type: string + description: >- + DisabledListResponse is the response type for the + Query/DisabledList RPC method. + default: + description: An unexpected error response. + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + tags: + - Query + /cosmos/consensus/v1/params: + get: + summary: Params queries the parameters of x/consensus module. + operationId: ConsensusParams + responses: + '200': + description: A successful response. + schema: + type: object + properties: + params: + description: >- + params are the tendermint consensus params stored in the + consensus module. + + Please note that `params.version` is not populated in this + response, it is + + tracked separately in the x/upgrade module. + type: object + properties: + block: + type: object + properties: + max_bytes: + type: string + format: int64 + title: |- + Max block size, in bytes. + Note: must be greater than 0 + max_gas: + type: string + format: int64 + title: |- + Max gas per block. + Note: must be greater or equal to -1 + description: BlockParams contains limits on the block size. + evidence: + type: object + properties: + max_age_num_blocks: + type: string + format: int64 + description: >- + Max age of evidence, in blocks. + + + The basic formula for calculating this is: + MaxAgeDuration / {average block + + time}. + max_age_duration: + type: string + description: >- + Max age of evidence, in time. + + + It should correspond with an app's "unbonding period" + or other similar + + mechanism for handling [Nothing-At-Stake + + attacks](https://github.com/ethereum/wiki/wiki/Proof-of-Stake-FAQ#what-is-the-nothing-at-stake-problem-and-how-can-it-be-fixed). + max_bytes: + type: string + format: int64 + title: >- + This sets the maximum size of total evidence in bytes + that can be committed in a single block. + + and should fall comfortably under the max block bytes. + + Default is 1048576 or 1MB + description: >- + EvidenceParams determine how we handle evidence of + malfeasance. + validator: + type: object + properties: + pub_key_types: + type: array + items: + type: string + description: >- + ValidatorParams restrict the public key types validators + can use. + + NOTE: uses ABCI pubkey naming, not Amino names. + version: + type: object + properties: + app: + type: string + format: uint64 + description: VersionParams contains the ABCI application version. + abci: + type: object + properties: + vote_extensions_enable_height: + type: string + format: int64 + description: >- + vote_extensions_enable_height configures the first + height during which + + vote extensions will be enabled. During this specified + height, and for all + + subsequent heights, precommit messages that do not + contain valid extension data + + will be considered invalid. Prior to this height, vote + extensions will not + + be used or accepted by validators on the network. + + + Once enabled, vote extensions will be created by the + application in ExtendVote, + + passed to the application for validation in + VerifyVoteExtension and given + + to the application to use when proposing a block + during PrepareProposal. + description: >- + ABCIParams configure functionality specific to the + Application Blockchain Interface. + description: >- + QueryParamsResponse defines the response type for querying + x/consensus parameters. + default: + description: An unexpected error response. + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + tags: + - Query +definitions: + cosmos.auth.v1beta1.AddressBytesToStringResponse: + type: object + properties: + address_string: + type: string + description: >- + AddressBytesToStringResponse is the response type for AddressString rpc + method. + + + Since: cosmos-sdk 0.46 + cosmos.auth.v1beta1.AddressStringToBytesResponse: + type: object + properties: + address_bytes: + type: string + format: byte + description: >- + AddressStringToBytesResponse is the response type for AddressBytes rpc + method. + + + Since: cosmos-sdk 0.46 + cosmos.auth.v1beta1.BaseAccount: + type: object + properties: + address: + type: string + pub_key: + type: object + properties: + type_url: + type: string + description: >- + A URL/resource name that uniquely identifies the type of the + serialized + + protocol buffer message. This string must contain at least + + one "/" character. The last segment of the URL's path must + represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in a + canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary all types + that they + + expect it to use in the context of Any. However, for URLs which + use the + + scheme `http`, `https`, or no scheme, one can optionally set up a + type + + server that maps type URLs to message definitions as follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in the + official + + protobuf release, and it is not used for type URLs beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) might be + + used with implementation specific semantics. + value: + type: string + format: byte + description: >- + Must be a valid serialized protocol buffer of the above specified + type. + description: >- + `Any` contains an arbitrary serialized protocol buffer message along + with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values in the + form + + of utility functions or additional generated methods of the Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + Example 3: Pack and unpack a message in Python. foo = Foo(...) @@ -36716,7 +38823,6 @@ definitions: name "y.z". - JSON @@ -36906,6 +39012,10 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -36942,7 +39052,6 @@ definitions: name "y.z". - JSON @@ -37082,6 +39191,10 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -37117,7 +39230,6 @@ definitions: name "y.z". - JSON @@ -37254,6 +39366,10 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -37289,7 +39405,6 @@ definitions: name "y.z". - JSON @@ -37444,6 +39559,10 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -37479,7 +39598,6 @@ definitions: name "y.z". - JSON @@ -37616,6 +39734,10 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -37651,7 +39773,6 @@ definitions: name "y.z". - JSON @@ -37879,6 +40000,10 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -37914,7 +40039,6 @@ definitions: name "y.z". - JSON @@ -38055,6 +40179,10 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -38090,7 +40218,6 @@ definitions: name "y.z". - JSON @@ -38352,6 +40479,99 @@ definitions: description: >- QueryBalanceResponse is the response type for the Query/Balance RPC method. + cosmos.bank.v1beta1.QueryDenomMetadataByQueryStringResponse: + type: object + properties: + metadata: + type: object + properties: + description: + type: string + denom_units: + type: array + items: + type: object + properties: + denom: + type: string + description: >- + denom represents the string name of the given denom unit + (e.g uatom). + exponent: + type: integer + format: int64 + description: >- + exponent represents power of 10 exponent that one must + + raise the base_denom to in order to equal the given + DenomUnit's denom + + 1 denom = 10^exponent base_denom + + (e.g. with a base_denom of uatom, one can create a DenomUnit + of 'atom' with + + exponent = 6, thus: 1 atom = 10^6 uatom). + aliases: + type: array + items: + type: string + title: aliases is a list of string aliases for the given denom + description: |- + DenomUnit represents a struct that describes a given + denomination unit of the basic token. + title: denom_units represents the list of DenomUnit's for a given coin + base: + type: string + description: >- + base represents the base denom (should be the DenomUnit with + exponent = 0). + display: + type: string + description: |- + display indicates the suggested denom that should be + displayed in clients. + name: + type: string + description: 'Since: cosmos-sdk 0.43' + title: 'name defines the name of the token (eg: Cosmos Atom)' + symbol: + type: string + description: >- + symbol is the token symbol usually shown on exchanges (eg: ATOM). + This can + + be the same as the display. + + + Since: cosmos-sdk 0.43 + uri: + type: string + description: >- + URI to a document (on or off-chain) that contains additional + information. Optional. + + + Since: cosmos-sdk 0.46 + uri_hash: + type: string + description: >- + URIHash is a sha256 hash of a document pointed by URI. It's used + to verify that + + the document didn't change. Optional. + + + Since: cosmos-sdk 0.46 + description: |- + Metadata represents a struct that describes + a basic token. + description: >- + QueryDenomMetadataByQueryStringResponse is the response type for the + Query/DenomMetadata RPC + + method. Identical with QueryDenomMetadataResponse but receives denom as + query string in request. cosmos.bank.v1beta1.QueryDenomMetadataResponse: type: object properties: @@ -38444,6 +40664,68 @@ definitions: Query/DenomMetadata RPC method. + cosmos.bank.v1beta1.QueryDenomOwnersByQueryResponse: + type: object + properties: + denom_owners: + type: array + items: + type: object + properties: + address: + type: string + description: address defines the address that owns a particular denomination. + balance: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + description: >- + DenomOwner defines structure representing an account that owns or + holds a + + particular denominated token. It contains the account address and + account + + balance of the denominated token. + + + Since: cosmos-sdk 0.46 + pagination: + description: pagination defines the pagination in the response. + type: object + properties: + next_key: + type: string + format: byte + description: |- + next_key is the key to be passed to PageRequest.key to + query the next page most efficiently. It will be empty if + there are no more results. + total: + type: string + format: uint64 + title: >- + total is total number of results available if + PageRequest.count_total + + was set, its value is undefined otherwise + description: >- + QueryDenomOwnersByQueryResponse defines the RPC response of a + DenomOwnersByQuery RPC query. + + + Since: cosmos-sdk 0.50.3 cosmos.bank.v1beta1.QueryDenomOwnersResponse: type: object properties: @@ -38626,6 +40908,7 @@ definitions: type: object properties: params: + description: params provides the parameters of the bank module. type: object properties: send_enabled: @@ -38656,7 +40939,6 @@ definitions: compatibility of genesis files. default_send_enabled: type: boolean - description: Params defines the parameters for the bank module. description: >- QueryParamsResponse defines the response type for querying x/bank parameters. @@ -39087,9 +41369,32 @@ definitions: signature: type: string format: byte + description: >- + Vote signature by the validator if they participated + in consensus for the + + associated block. + extension: + type: string + format: byte + description: >- + Vote extension provided by the application. Only + valid for precommit + + messages. + extension_signature: + type: string + format: byte + description: >- + Vote extension signature by the validator if they + participated in + + consensus for the associated block. + + Only valid for precommit messages. description: >- - Vote represents a prevote, precommit, or commit vote - from validators for + Vote represents a prevote or precommit vote from + validators for consensus. vote_b: @@ -39144,9 +41449,32 @@ definitions: signature: type: string format: byte + description: >- + Vote signature by the validator if they participated + in consensus for the + + associated block. + extension: + type: string + format: byte + description: >- + Vote extension provided by the application. Only + valid for precommit + + messages. + extension_signature: + type: string + format: byte + description: >- + Vote extension signature by the validator if they + participated in + + consensus for the associated block. + + Only valid for precommit messages. description: >- - Vote represents a prevote, precommit, or commit vote - from validators for + Vote represents a prevote or precommit vote from + validators for consensus. total_voting_power: @@ -39248,9 +41576,7 @@ definitions: proposer_address: type: string format: byte - description: >- - Header defines the structure of a Tendermint - block header. + description: Header defines the structure of a block header. commit: type: object properties: @@ -39291,7 +41617,7 @@ definitions: - BLOCK_ID_FLAG_NIL default: BLOCK_ID_FLAG_UNKNOWN title: >- - BlockIdFlag indicates which BlcokID the + BlockIdFlag indicates which BlockID the signature is for validator_address: type: string @@ -39330,7 +41656,7 @@ definitions: format: byte title: >- PublicKey defines the keys available for - use with Tendermint Validators + use with Validators voting_power: type: string format: int64 @@ -39354,7 +41680,7 @@ definitions: format: byte title: >- PublicKey defines the keys available for use - with Tendermint Validators + with Validators voting_power: type: string format: int64 @@ -39386,7 +41712,7 @@ definitions: format: byte title: >- PublicKey defines the keys available for use with - Tendermint Validators + Validators voting_power: type: string format: int64 @@ -39441,7 +41767,7 @@ definitions: - BLOCK_ID_FLAG_COMMIT - BLOCK_ID_FLAG_NIL default: BLOCK_ID_FLAG_UNKNOWN - title: BlockIdFlag indicates which BlcokID the signature is for + title: BlockIdFlag indicates which BlockID the signature is for validator_address: type: string format: byte @@ -39558,7 +41884,7 @@ definitions: proposer_address: type: string format: byte - description: Header defines the structure of a Tendermint block header. + description: Header defines the structure of a block header. data: type: object properties: @@ -39638,9 +41964,32 @@ definitions: signature: type: string format: byte + description: >- + Vote signature by the validator if they + participated in consensus for the + + associated block. + extension: + type: string + format: byte + description: >- + Vote extension provided by the application. Only + valid for precommit + + messages. + extension_signature: + type: string + format: byte + description: >- + Vote extension signature by the validator if + they participated in + + consensus for the associated block. + + Only valid for precommit messages. description: >- - Vote represents a prevote, precommit, or commit vote - from validators for + Vote represents a prevote or precommit vote from + validators for consensus. vote_b: @@ -39695,9 +42044,32 @@ definitions: signature: type: string format: byte + description: >- + Vote signature by the validator if they + participated in consensus for the + + associated block. + extension: + type: string + format: byte + description: >- + Vote extension provided by the application. Only + valid for precommit + + messages. + extension_signature: + type: string + format: byte + description: >- + Vote extension signature by the validator if + they participated in + + consensus for the associated block. + + Only valid for precommit messages. description: >- - Vote represents a prevote, precommit, or commit vote - from validators for + Vote represents a prevote or precommit vote from + validators for consensus. total_voting_power: @@ -39801,8 +42173,8 @@ definitions: type: string format: byte description: >- - Header defines the structure of a Tendermint - block header. + Header defines the structure of a block + header. commit: type: object properties: @@ -39843,7 +42215,7 @@ definitions: - BLOCK_ID_FLAG_NIL default: BLOCK_ID_FLAG_UNKNOWN title: >- - BlockIdFlag indicates which BlcokID the + BlockIdFlag indicates which BlockID the signature is for validator_address: type: string @@ -39882,7 +42254,7 @@ definitions: format: byte title: >- PublicKey defines the keys available for - use with Tendermint Validators + use with Validators voting_power: type: string format: int64 @@ -39906,7 +42278,7 @@ definitions: format: byte title: >- PublicKey defines the keys available for - use with Tendermint Validators + use with Validators voting_power: type: string format: int64 @@ -39938,7 +42310,7 @@ definitions: format: byte title: >- PublicKey defines the keys available for use - with Tendermint Validators + with Validators voting_power: type: string format: int64 @@ -39993,7 +42365,7 @@ definitions: - BLOCK_ID_FLAG_COMMIT - BLOCK_ID_FLAG_NIL default: BLOCK_ID_FLAG_UNKNOWN - title: BlockIdFlag indicates which BlcokID the signature is for + title: BlockIdFlag indicates which BlockID the signature is for validator_address: type: string format: byte @@ -40174,9 +42546,32 @@ definitions: signature: type: string format: byte + description: >- + Vote signature by the validator if they + participated in consensus for the + + associated block. + extension: + type: string + format: byte + description: >- + Vote extension provided by the application. Only + valid for precommit + + messages. + extension_signature: + type: string + format: byte + description: >- + Vote extension signature by the validator if + they participated in + + consensus for the associated block. + + Only valid for precommit messages. description: >- - Vote represents a prevote, precommit, or commit vote - from validators for + Vote represents a prevote or precommit vote from + validators for consensus. vote_b: @@ -40231,9 +42626,32 @@ definitions: signature: type: string format: byte + description: >- + Vote signature by the validator if they + participated in consensus for the + + associated block. + extension: + type: string + format: byte + description: >- + Vote extension provided by the application. Only + valid for precommit + + messages. + extension_signature: + type: string + format: byte + description: >- + Vote extension signature by the validator if + they participated in + + consensus for the associated block. + + Only valid for precommit messages. description: >- - Vote represents a prevote, precommit, or commit vote - from validators for + Vote represents a prevote or precommit vote from + validators for consensus. total_voting_power: @@ -40337,8 +42755,8 @@ definitions: type: string format: byte description: >- - Header defines the structure of a Tendermint - block header. + Header defines the structure of a block + header. commit: type: object properties: @@ -40379,7 +42797,7 @@ definitions: - BLOCK_ID_FLAG_NIL default: BLOCK_ID_FLAG_UNKNOWN title: >- - BlockIdFlag indicates which BlcokID the + BlockIdFlag indicates which BlockID the signature is for validator_address: type: string @@ -40418,7 +42836,7 @@ definitions: format: byte title: >- PublicKey defines the keys available for - use with Tendermint Validators + use with Validators voting_power: type: string format: int64 @@ -40442,7 +42860,7 @@ definitions: format: byte title: >- PublicKey defines the keys available for - use with Tendermint Validators + use with Validators voting_power: type: string format: int64 @@ -40474,7 +42892,7 @@ definitions: format: byte title: >- PublicKey defines the keys available for use - with Tendermint Validators + with Validators voting_power: type: string format: int64 @@ -40529,7 +42947,7 @@ definitions: - BLOCK_ID_FLAG_COMMIT - BLOCK_ID_FLAG_NIL default: BLOCK_ID_FLAG_UNKNOWN - title: BlockIdFlag indicates which BlcokID the signature is for + title: BlockIdFlag indicates which BlockID the signature is for validator_address: type: string format: byte @@ -40649,7 +43067,7 @@ definitions: proposer_address: type: string format: byte - description: Header defines the structure of a Tendermint block header. + description: Header defines the structure of a block header. data: type: object properties: @@ -40729,9 +43147,32 @@ definitions: signature: type: string format: byte + description: >- + Vote signature by the validator if they + participated in consensus for the + + associated block. + extension: + type: string + format: byte + description: >- + Vote extension provided by the application. Only + valid for precommit + + messages. + extension_signature: + type: string + format: byte + description: >- + Vote extension signature by the validator if + they participated in + + consensus for the associated block. + + Only valid for precommit messages. description: >- - Vote represents a prevote, precommit, or commit vote - from validators for + Vote represents a prevote or precommit vote from + validators for consensus. vote_b: @@ -40786,9 +43227,32 @@ definitions: signature: type: string format: byte + description: >- + Vote signature by the validator if they + participated in consensus for the + + associated block. + extension: + type: string + format: byte + description: >- + Vote extension provided by the application. Only + valid for precommit + + messages. + extension_signature: + type: string + format: byte + description: >- + Vote extension signature by the validator if + they participated in + + consensus for the associated block. + + Only valid for precommit messages. description: >- - Vote represents a prevote, precommit, or commit vote - from validators for + Vote represents a prevote or precommit vote from + validators for consensus. total_voting_power: @@ -40892,8 +43356,8 @@ definitions: type: string format: byte description: >- - Header defines the structure of a Tendermint - block header. + Header defines the structure of a block + header. commit: type: object properties: @@ -40934,7 +43398,7 @@ definitions: - BLOCK_ID_FLAG_NIL default: BLOCK_ID_FLAG_UNKNOWN title: >- - BlockIdFlag indicates which BlcokID the + BlockIdFlag indicates which BlockID the signature is for validator_address: type: string @@ -40973,7 +43437,7 @@ definitions: format: byte title: >- PublicKey defines the keys available for - use with Tendermint Validators + use with Validators voting_power: type: string format: int64 @@ -40997,7 +43461,7 @@ definitions: format: byte title: >- PublicKey defines the keys available for - use with Tendermint Validators + use with Validators voting_power: type: string format: int64 @@ -41029,7 +43493,7 @@ definitions: format: byte title: >- PublicKey defines the keys available for use - with Tendermint Validators + with Validators voting_power: type: string format: int64 @@ -41084,7 +43548,7 @@ definitions: - BLOCK_ID_FLAG_COMMIT - BLOCK_ID_FLAG_NIL default: BLOCK_ID_FLAG_UNKNOWN - title: BlockIdFlag indicates which BlcokID the signature is for + title: BlockIdFlag indicates which BlockID the signature is for validator_address: type: string format: byte @@ -41265,9 +43729,32 @@ definitions: signature: type: string format: byte + description: >- + Vote signature by the validator if they + participated in consensus for the + + associated block. + extension: + type: string + format: byte + description: >- + Vote extension provided by the application. Only + valid for precommit + + messages. + extension_signature: + type: string + format: byte + description: >- + Vote extension signature by the validator if + they participated in + + consensus for the associated block. + + Only valid for precommit messages. description: >- - Vote represents a prevote, precommit, or commit vote - from validators for + Vote represents a prevote or precommit vote from + validators for consensus. vote_b: @@ -41322,9 +43809,32 @@ definitions: signature: type: string format: byte + description: >- + Vote signature by the validator if they + participated in consensus for the + + associated block. + extension: + type: string + format: byte + description: >- + Vote extension provided by the application. Only + valid for precommit + + messages. + extension_signature: + type: string + format: byte + description: >- + Vote extension signature by the validator if + they participated in + + consensus for the associated block. + + Only valid for precommit messages. description: >- - Vote represents a prevote, precommit, or commit vote - from validators for + Vote represents a prevote or precommit vote from + validators for consensus. total_voting_power: @@ -41428,8 +43938,8 @@ definitions: type: string format: byte description: >- - Header defines the structure of a Tendermint - block header. + Header defines the structure of a block + header. commit: type: object properties: @@ -41470,7 +43980,7 @@ definitions: - BLOCK_ID_FLAG_NIL default: BLOCK_ID_FLAG_UNKNOWN title: >- - BlockIdFlag indicates which BlcokID the + BlockIdFlag indicates which BlockID the signature is for validator_address: type: string @@ -41509,7 +44019,7 @@ definitions: format: byte title: >- PublicKey defines the keys available for - use with Tendermint Validators + use with Validators voting_power: type: string format: int64 @@ -41533,7 +44043,7 @@ definitions: format: byte title: >- PublicKey defines the keys available for - use with Tendermint Validators + use with Validators voting_power: type: string format: int64 @@ -41565,7 +44075,7 @@ definitions: format: byte title: >- PublicKey defines the keys available for use - with Tendermint Validators + with Validators voting_power: type: string format: int64 @@ -41620,7 +44130,7 @@ definitions: - BLOCK_ID_FLAG_COMMIT - BLOCK_ID_FLAG_NIL default: BLOCK_ID_FLAG_UNKNOWN - title: BlockIdFlag indicates which BlcokID the signature is for + title: BlockIdFlag indicates which BlockID the signature is for validator_address: type: string format: byte @@ -41751,6 +44261,10 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -41789,7 +44303,6 @@ definitions: name "y.z". - JSON @@ -42047,6 +44560,10 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -42085,7 +44602,6 @@ definitions: name "y.z". - JSON @@ -42400,6 +44916,10 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -42435,7 +44955,6 @@ definitions: name "y.z". - JSON @@ -42519,7 +45038,7 @@ definitions: secp256k1: type: string format: byte - title: PublicKey defines the keys available for use with Tendermint Validators + title: PublicKey defines the keys available for use with Validators tendermint.p2p.DefaultNodeInfo: type: object properties: @@ -42653,7 +45172,7 @@ definitions: proposer_address: type: string format: byte - description: Header defines the structure of a Tendermint block header. + description: Header defines the structure of a block header. data: type: object properties: @@ -42733,9 +45252,32 @@ definitions: signature: type: string format: byte + description: >- + Vote signature by the validator if they participated + in consensus for the + + associated block. + extension: + type: string + format: byte + description: >- + Vote extension provided by the application. Only + valid for precommit + + messages. + extension_signature: + type: string + format: byte + description: >- + Vote extension signature by the validator if they + participated in + + consensus for the associated block. + + Only valid for precommit messages. description: >- - Vote represents a prevote, precommit, or commit vote - from validators for + Vote represents a prevote or precommit vote from + validators for consensus. vote_b: @@ -42790,9 +45332,32 @@ definitions: signature: type: string format: byte + description: >- + Vote signature by the validator if they participated + in consensus for the + + associated block. + extension: + type: string + format: byte + description: >- + Vote extension provided by the application. Only + valid for precommit + + messages. + extension_signature: + type: string + format: byte + description: >- + Vote extension signature by the validator if they + participated in + + consensus for the associated block. + + Only valid for precommit messages. description: >- - Vote represents a prevote, precommit, or commit vote - from validators for + Vote represents a prevote or precommit vote from + validators for consensus. total_voting_power: @@ -42894,9 +45459,7 @@ definitions: proposer_address: type: string format: byte - description: >- - Header defines the structure of a Tendermint - block header. + description: Header defines the structure of a block header. commit: type: object properties: @@ -42937,7 +45500,7 @@ definitions: - BLOCK_ID_FLAG_NIL default: BLOCK_ID_FLAG_UNKNOWN title: >- - BlockIdFlag indicates which BlcokID the + BlockIdFlag indicates which BlockID the signature is for validator_address: type: string @@ -42976,7 +45539,7 @@ definitions: format: byte title: >- PublicKey defines the keys available for - use with Tendermint Validators + use with Validators voting_power: type: string format: int64 @@ -43000,7 +45563,7 @@ definitions: format: byte title: >- PublicKey defines the keys available for use - with Tendermint Validators + with Validators voting_power: type: string format: int64 @@ -43032,7 +45595,7 @@ definitions: format: byte title: >- PublicKey defines the keys available for use with - Tendermint Validators + Validators voting_power: type: string format: int64 @@ -43087,7 +45650,7 @@ definitions: - BLOCK_ID_FLAG_COMMIT - BLOCK_ID_FLAG_NIL default: BLOCK_ID_FLAG_UNKNOWN - title: BlockIdFlag indicates which BlcokID the signature is for + title: BlockIdFlag indicates which BlockID the signature is for validator_address: type: string format: byte @@ -43126,7 +45689,7 @@ definitions: - BLOCK_ID_FLAG_COMMIT - BLOCK_ID_FLAG_NIL default: BLOCK_ID_FLAG_UNKNOWN - title: BlockIdFlag indicates which BlcokID the signature is for + title: BlockIdFlag indicates which BlockID the signature is for tendermint.types.Commit: type: object properties: @@ -43166,7 +45729,7 @@ definitions: - BLOCK_ID_FLAG_COMMIT - BLOCK_ID_FLAG_NIL default: BLOCK_ID_FLAG_UNKNOWN - title: BlockIdFlag indicates which BlcokID the signature is for + title: BlockIdFlag indicates which BlockID the signature is for validator_address: type: string format: byte @@ -43191,7 +45754,7 @@ definitions: - BLOCK_ID_FLAG_COMMIT - BLOCK_ID_FLAG_NIL default: BLOCK_ID_FLAG_UNKNOWN - title: BlockIdFlag indicates which BlcokID the signature is for + title: BlockIdFlag indicates which BlockID the signature is for validator_address: type: string format: byte @@ -43272,10 +45835,28 @@ definitions: signature: type: string format: byte - description: >- - Vote represents a prevote, precommit, or commit vote from validators - for + description: >- + Vote signature by the validator if they participated in consensus + for the + + associated block. + extension: + type: string + format: byte + description: >- + Vote extension provided by the application. Only valid for + precommit + messages. + extension_signature: + type: string + format: byte + description: |- + Vote extension signature by the validator if they participated in + consensus for the associated block. + Only valid for precommit messages. + description: |- + Vote represents a prevote or precommit vote from validators for consensus. vote_b: type: object @@ -43328,10 +45909,28 @@ definitions: signature: type: string format: byte - description: >- - Vote represents a prevote, precommit, or commit vote from validators - for + description: >- + Vote signature by the validator if they participated in consensus + for the + + associated block. + extension: + type: string + format: byte + description: >- + Vote extension provided by the application. Only valid for + precommit + messages. + extension_signature: + type: string + format: byte + description: |- + Vote extension signature by the validator if they participated in + consensus for the associated block. + Only valid for precommit messages. + description: |- + Vote represents a prevote or precommit vote from validators for consensus. total_voting_power: type: string @@ -43402,10 +46001,31 @@ definitions: signature: type: string format: byte - description: >- - Vote represents a prevote, precommit, or commit vote from - validators for + description: >- + Vote signature by the validator if they participated in + consensus for the + associated block. + extension: + type: string + format: byte + description: >- + Vote extension provided by the application. Only valid for + precommit + + messages. + extension_signature: + type: string + format: byte + description: >- + Vote extension signature by the validator if they participated + in + + consensus for the associated block. + + Only valid for precommit messages. + description: |- + Vote represents a prevote or precommit vote from validators for consensus. vote_b: type: object @@ -43458,10 +46078,31 @@ definitions: signature: type: string format: byte - description: >- - Vote represents a prevote, precommit, or commit vote from - validators for + description: >- + Vote signature by the validator if they participated in + consensus for the + + associated block. + extension: + type: string + format: byte + description: >- + Vote extension provided by the application. Only valid for + precommit + + messages. + extension_signature: + type: string + format: byte + description: >- + Vote extension signature by the validator if they participated + in + consensus for the associated block. + + Only valid for precommit messages. + description: |- + Vote represents a prevote or precommit vote from validators for consensus. total_voting_power: type: string @@ -43560,7 +46201,7 @@ definitions: proposer_address: type: string format: byte - description: Header defines the structure of a Tendermint block header. + description: Header defines the structure of a block header. commit: type: object properties: @@ -43601,7 +46242,7 @@ definitions: - BLOCK_ID_FLAG_NIL default: BLOCK_ID_FLAG_UNKNOWN title: >- - BlockIdFlag indicates which BlcokID the + BlockIdFlag indicates which BlockID the signature is for validator_address: type: string @@ -43640,7 +46281,7 @@ definitions: format: byte title: >- PublicKey defines the keys available for use with - Tendermint Validators + Validators voting_power: type: string format: int64 @@ -43664,7 +46305,7 @@ definitions: format: byte title: >- PublicKey defines the keys available for use with - Tendermint Validators + Validators voting_power: type: string format: int64 @@ -43694,9 +46335,7 @@ definitions: secp256k1: type: string format: byte - title: >- - PublicKey defines the keys available for use with Tendermint - Validators + title: PublicKey defines the keys available for use with Validators voting_power: type: string format: int64 @@ -43775,9 +46414,32 @@ definitions: signature: type: string format: byte + description: >- + Vote signature by the validator if they participated in + consensus for the + + associated block. + extension: + type: string + format: byte + description: >- + Vote extension provided by the application. Only valid + for precommit + + messages. + extension_signature: + type: string + format: byte + description: >- + Vote extension signature by the validator if they + participated in + + consensus for the associated block. + + Only valid for precommit messages. description: >- - Vote represents a prevote, precommit, or commit vote from - validators for + Vote represents a prevote or precommit vote from validators + for consensus. vote_b: @@ -43832,9 +46494,32 @@ definitions: signature: type: string format: byte + description: >- + Vote signature by the validator if they participated in + consensus for the + + associated block. + extension: + type: string + format: byte + description: >- + Vote extension provided by the application. Only valid + for precommit + + messages. + extension_signature: + type: string + format: byte + description: >- + Vote extension signature by the validator if they + participated in + + consensus for the associated block. + + Only valid for precommit messages. description: >- - Vote represents a prevote, precommit, or commit vote from - validators for + Vote represents a prevote or precommit vote from validators + for consensus. total_voting_power: @@ -43934,9 +46619,7 @@ definitions: proposer_address: type: string format: byte - description: >- - Header defines the structure of a Tendermint block - header. + description: Header defines the structure of a block header. commit: type: object properties: @@ -43977,7 +46660,7 @@ definitions: - BLOCK_ID_FLAG_NIL default: BLOCK_ID_FLAG_UNKNOWN title: >- - BlockIdFlag indicates which BlcokID the + BlockIdFlag indicates which BlockID the signature is for validator_address: type: string @@ -44016,7 +46699,7 @@ definitions: format: byte title: >- PublicKey defines the keys available for use - with Tendermint Validators + with Validators voting_power: type: string format: int64 @@ -44040,7 +46723,7 @@ definitions: format: byte title: >- PublicKey defines the keys available for use - with Tendermint Validators + with Validators voting_power: type: string format: int64 @@ -44072,7 +46755,7 @@ definitions: format: byte title: >- PublicKey defines the keys available for use with - Tendermint Validators + Validators voting_power: type: string format: int64 @@ -44164,7 +46847,7 @@ definitions: proposer_address: type: string format: byte - description: Header defines the structure of a Tendermint block header. + description: Header defines the structure of a block header. tendermint.types.LightBlock: type: object properties: @@ -44247,7 +46930,7 @@ definitions: proposer_address: type: string format: byte - description: Header defines the structure of a Tendermint block header. + description: Header defines the structure of a block header. commit: type: object properties: @@ -44287,7 +46970,7 @@ definitions: - BLOCK_ID_FLAG_COMMIT - BLOCK_ID_FLAG_NIL default: BLOCK_ID_FLAG_UNKNOWN - title: BlockIdFlag indicates which BlcokID the signature is for + title: BlockIdFlag indicates which BlockID the signature is for validator_address: type: string format: byte @@ -44321,9 +47004,7 @@ definitions: secp256k1: type: string format: byte - title: >- - PublicKey defines the keys available for use with Tendermint - Validators + title: PublicKey defines the keys available for use with Validators voting_power: type: string format: int64 @@ -44345,9 +47026,7 @@ definitions: secp256k1: type: string format: byte - title: >- - PublicKey defines the keys available for use with Tendermint - Validators + title: PublicKey defines the keys available for use with Validators voting_power: type: string format: int64 @@ -44442,7 +47121,7 @@ definitions: proposer_address: type: string format: byte - description: Header defines the structure of a Tendermint block header. + description: Header defines the structure of a block header. commit: type: object properties: @@ -44483,7 +47162,7 @@ definitions: - BLOCK_ID_FLAG_NIL default: BLOCK_ID_FLAG_UNKNOWN title: >- - BlockIdFlag indicates which BlcokID the signature is + BlockIdFlag indicates which BlockID the signature is for validator_address: type: string @@ -44520,7 +47199,7 @@ definitions: format: byte title: >- PublicKey defines the keys available for use with - Tendermint Validators + Validators voting_power: type: string format: int64 @@ -44544,7 +47223,7 @@ definitions: format: byte title: >- PublicKey defines the keys available for use with - Tendermint Validators + Validators voting_power: type: string format: int64 @@ -44574,9 +47253,7 @@ definitions: secp256k1: type: string format: byte - title: >- - PublicKey defines the keys available for use with Tendermint - Validators + title: PublicKey defines the keys available for use with Validators voting_power: type: string format: int64 @@ -44681,7 +47358,7 @@ definitions: proposer_address: type: string format: byte - description: Header defines the structure of a Tendermint block header. + description: Header defines the structure of a block header. commit: type: object properties: @@ -44721,7 +47398,7 @@ definitions: - BLOCK_ID_FLAG_COMMIT - BLOCK_ID_FLAG_NIL default: BLOCK_ID_FLAG_UNKNOWN - title: BlockIdFlag indicates which BlcokID the signature is for + title: BlockIdFlag indicates which BlockID the signature is for validator_address: type: string format: byte @@ -44763,9 +47440,7 @@ definitions: secp256k1: type: string format: byte - title: >- - PublicKey defines the keys available for use with Tendermint - Validators + title: PublicKey defines the keys available for use with Validators voting_power: type: string format: int64 @@ -44792,9 +47467,7 @@ definitions: secp256k1: type: string format: byte - title: >- - PublicKey defines the keys available for use with Tendermint - Validators + title: PublicKey defines the keys available for use with Validators voting_power: type: string format: int64 @@ -44816,9 +47489,7 @@ definitions: secp256k1: type: string format: byte - title: >- - PublicKey defines the keys available for use with Tendermint - Validators + title: PublicKey defines the keys available for use with Validators voting_power: type: string format: int64 @@ -44879,8 +47550,26 @@ definitions: signature: type: string format: byte + description: >- + Vote signature by the validator if they participated in consensus for + the + + associated block. + extension: + type: string + format: byte + description: |- + Vote extension provided by the application. Only valid for precommit + messages. + extension_signature: + type: string + format: byte + description: |- + Vote extension signature by the validator if they participated in + consensus for the associated block. + Only valid for precommit messages. description: |- - Vote represents a prevote, precommit, or commit vote from validators for + Vote represents a prevote or precommit vote from validators for consensus. tendermint.version.Consensus: type: object @@ -44899,6 +47588,38 @@ definitions: application's state transition machine. + cosmos.base.node.v1beta1.ConfigResponse: + type: object + properties: + minimum_gas_price: + type: string + pruning_keep_recent: + type: string + pruning_interval: + type: string + halt_height: + type: string + format: uint64 + description: ConfigResponse defines the response structure for the Config gRPC query. + cosmos.base.node.v1beta1.StatusResponse: + type: object + properties: + earliest_store_height: + type: string + format: uint64 + height: + type: string + format: uint64 + timestamp: + type: string + format: date-time + app_hash: + type: string + format: byte + validator_hash: + type: string + format: byte + description: StateResponse defines the response structure for the status of a node. cosmos.base.v1beta1.DecCoin: type: object properties: @@ -45388,6 +48109,10 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -45423,7 +48148,6 @@ definitions: name "y.z". - JSON @@ -45577,6 +48301,10 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -45612,7 +48340,6 @@ definitions: name "y.z". - JSON @@ -45802,6 +48529,10 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -45837,7 +48568,6 @@ definitions: name "y.z". - JSON @@ -46227,6 +48957,10 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -46263,7 +48997,6 @@ definitions: name "y.z". - JSON @@ -46481,6 +49214,10 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -46519,7 +49256,6 @@ definitions: name "y.z". - JSON @@ -47061,6 +49797,76 @@ definitions: description: >- The ratio representing the proportion of the deposit value that must be paid at proposal submission. + proposal_cancel_ratio: + type: string + description: >- + The cancel ratio which will not be returned back to the depositors + when a proposal is cancelled. + + + Since: cosmos-sdk 0.50 + proposal_cancel_dest: + type: string + description: >- + The address which will receive (proposal_cancel_ratio * deposit) + proposal deposits. + + If empty, the (proposal_cancel_ratio * deposit) proposal deposits will + be burned. + + + Since: cosmos-sdk 0.50 + expedited_voting_period: + type: string + description: |- + Duration of the voting period of an expedited proposal. + + Since: cosmos-sdk 0.50 + expedited_threshold: + type: string + description: >- + Minimum proportion of Yes votes for proposal to pass. Default value: + 0.67. + + + Since: cosmos-sdk 0.50 + expedited_min_deposit: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + Coin defines a token with a denomination and an amount. + + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + description: Minimum expedited deposit for a proposal to enter voting period. + burn_vote_quorum: + type: boolean + title: burn deposits if a proposal does not meet quorum + burn_proposal_deposit_prevote: + type: boolean + title: burn deposits if the proposal does not enter voting period + burn_vote_veto: + type: boolean + title: burn deposits if quorum with vote type no_veto is met + min_deposit_ratio: + type: string + description: >- + The ratio representing the proportion of the deposit value minimum + that must be met when making a deposit. + + Default value: 0.01. Meaning that for a chain with a min_deposit of + 100stake, a deposit of 1stake would be + + required. + + + Since: cosmos-sdk 0.50 description: |- Params defines the parameters for the x/gov module. @@ -47169,6 +49975,10 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -47204,7 +50014,6 @@ definitions: name "y.z". - JSON @@ -47306,7 +50115,10 @@ definitions: description: voting_end_time is the end time of voting on a proposal. metadata: type: string - description: metadata is any arbitrary metadata attached to the proposal. + title: |- + metadata is any arbitrary metadata attached to the proposal. + the recommended format of the metadata is to be found here: + https://docs.cosmos.network/v0.47/modules/gov#proposal-3 title: type: string description: 'Since: cosmos-sdk 0.47' @@ -47318,7 +50130,15 @@ definitions: proposer: type: string description: 'Since: cosmos-sdk 0.47' - title: Proposer is the address of the proposal sumbitter + title: proposer is the address of the proposal sumbitter + expedited: + type: boolean + description: 'Since: cosmos-sdk 0.50' + title: expedited defines if the proposal is expedited + failed_reason: + type: string + description: 'Since: cosmos-sdk 0.50' + title: failed_reason defines the reason why the proposal failed description: Proposal defines the core field members of a governance proposal. cosmos.gov.v1.ProposalStatus: type: string @@ -47344,6 +50164,14 @@ definitions: been rejected. - PROPOSAL_STATUS_FAILED: PROPOSAL_STATUS_FAILED defines a proposal status of a proposal that has failed. + cosmos.gov.v1.QueryConstitutionResponse: + type: object + properties: + constitution: + type: string + title: >- + QueryConstitutionResponse is the response type for the Query/Constitution + RPC method cosmos.gov.v1.QueryDepositResponse: type: object properties: @@ -47567,6 +50395,79 @@ definitions: description: >- The ratio representing the proportion of the deposit value that must be paid at proposal submission. + proposal_cancel_ratio: + type: string + description: >- + The cancel ratio which will not be returned back to the depositors + when a proposal is cancelled. + + + Since: cosmos-sdk 0.50 + proposal_cancel_dest: + type: string + description: >- + The address which will receive (proposal_cancel_ratio * deposit) + proposal deposits. + + If empty, the (proposal_cancel_ratio * deposit) proposal deposits + will be burned. + + + Since: cosmos-sdk 0.50 + expedited_voting_period: + type: string + description: |- + Duration of the voting period of an expedited proposal. + + Since: cosmos-sdk 0.50 + expedited_threshold: + type: string + description: >- + Minimum proportion of Yes votes for proposal to pass. Default + value: 0.67. + + + Since: cosmos-sdk 0.50 + expedited_min_deposit: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + description: Minimum expedited deposit for a proposal to enter voting period. + burn_vote_quorum: + type: boolean + title: burn deposits if a proposal does not meet quorum + burn_proposal_deposit_prevote: + type: boolean + title: burn deposits if the proposal does not enter voting period + burn_vote_veto: + type: boolean + title: burn deposits if quorum with vote type no_veto is met + min_deposit_ratio: + type: string + description: >- + The ratio representing the proportion of the deposit value minimum + that must be met when making a deposit. + + Default value: 0.01. Meaning that for a chain with a min_deposit + of 100stake, a deposit of 1stake would be + + required. + + + Since: cosmos-sdk 0.50 description: QueryParamsResponse is the response type for the Query/Params RPC method. cosmos.gov.v1.QueryProposalResponse: type: object @@ -47678,6 +50579,10 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -47716,7 +50621,6 @@ definitions: name "y.z". - JSON @@ -47825,7 +50729,10 @@ definitions: description: voting_end_time is the end time of voting on a proposal. metadata: type: string - description: metadata is any arbitrary metadata attached to the proposal. + title: |- + metadata is any arbitrary metadata attached to the proposal. + the recommended format of the metadata is to be found here: + https://docs.cosmos.network/v0.47/modules/gov#proposal-3 title: type: string description: 'Since: cosmos-sdk 0.47' @@ -47837,7 +50744,15 @@ definitions: proposer: type: string description: 'Since: cosmos-sdk 0.47' - title: Proposer is the address of the proposal sumbitter + title: proposer is the address of the proposal sumbitter + expedited: + type: boolean + description: 'Since: cosmos-sdk 0.50' + title: expedited defines if the proposal is expedited + failed_reason: + type: string + description: 'Since: cosmos-sdk 0.50' + title: failed_reason defines the reason why the proposal failed description: Proposal defines the core field members of a governance proposal. description: >- QueryProposalResponse is the response type for the Query/Proposal RPC @@ -47954,6 +50869,10 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -47993,7 +50912,6 @@ definitions: name "y.z". - JSON @@ -48104,7 +51022,10 @@ definitions: description: voting_end_time is the end time of voting on a proposal. metadata: type: string - description: metadata is any arbitrary metadata attached to the proposal. + title: |- + metadata is any arbitrary metadata attached to the proposal. + the recommended format of the metadata is to be found here: + https://docs.cosmos.network/v0.47/modules/gov#proposal-3 title: type: string description: 'Since: cosmos-sdk 0.47' @@ -48116,7 +51037,15 @@ definitions: proposer: type: string description: 'Since: cosmos-sdk 0.47' - title: Proposer is the address of the proposal sumbitter + title: proposer is the address of the proposal sumbitter + expedited: + type: boolean + description: 'Since: cosmos-sdk 0.50' + title: expedited defines if the proposal is expedited + failed_reason: + type: string + description: 'Since: cosmos-sdk 0.50' + title: failed_reason defines the reason why the proposal failed description: Proposal defines the core field members of a governance proposal. description: proposals defines all the requested governance proposals. pagination: @@ -48202,7 +51131,11 @@ definitions: description: options is the weighted vote options. metadata: type: string - description: metadata is any arbitrary metadata to attached to the vote. + title: >- + metadata is any arbitrary metadata attached to the vote. + + the recommended format of the metadata is to be found here: + https://docs.cosmos.network/v0.47/modules/gov#vote-5 description: |- Vote defines a vote on a governance proposal. A Vote consists of a proposal ID, the voter, and the vote option. @@ -48246,7 +51179,11 @@ definitions: description: options is the weighted vote options. metadata: type: string - description: metadata is any arbitrary metadata to attached to the vote. + title: >- + metadata is any arbitrary metadata attached to the vote. + + the recommended format of the metadata is to be found here: + https://docs.cosmos.network/v0.47/modules/gov#vote-5 description: |- Vote defines a vote on a governance proposal. A Vote consists of a proposal ID, the voter, and the vote option. @@ -48340,7 +51277,11 @@ definitions: description: options is the weighted vote options. metadata: type: string - description: metadata is any arbitrary metadata to attached to the vote. + title: >- + metadata is any arbitrary metadata attached to the vote. + + the recommended format of the metadata is to be found here: + https://docs.cosmos.network/v0.47/modules/gov#vote-5 description: |- Vote defines a vote on a governance proposal. A Vote consists of a proposal ID, the voter, and the vote option. @@ -48576,18 +51517,19 @@ definitions: start_height: type: string format: int64 - title: Height at which validator was first a candidate OR was unjailed + title: Height at which validator was first a candidate OR was un-jailed index_offset: type: string format: int64 description: >- - Index which is incremented each time the validator was a bonded + Index which is incremented every time a validator is bonded in a + block and - in a block and may have signed a precommit or not. This in - conjunction with the + _may_ have signed a pre-commit or not. This in conjunction with + the - `SignedBlocksWindow` param determines the index in the - `MissedBlocksBitArray`. + signed_blocks_window param determines the index in the missed + block bitmap. jailed_until: type: string format: date-time @@ -48598,18 +51540,20 @@ definitions: type: boolean description: >- Whether or not a validator has been tombstoned (killed out of - validator set). It is set + validator - once the validator commits an equivocation or for any other - configured misbehiavor. + set). It is set once the validator commits an equivocation or for + any other + + configured misbehavior. missed_blocks_counter: type: string format: int64 description: >- - A counter kept to avoid unnecessary array reads. + A counter of missed (unsigned) blocks. It is used to avoid + unnecessary - Note that `Sum(MissedBlocksBitArray)` always equals - `MissedBlocksCounter`. + reads in the missed block bitmap. description: >- ValidatorSigningInfo defines a validator's signing info for monitoring their @@ -48634,18 +51578,19 @@ definitions: start_height: type: string format: int64 - title: Height at which validator was first a candidate OR was unjailed + title: Height at which validator was first a candidate OR was un-jailed index_offset: type: string format: int64 description: >- - Index which is incremented each time the validator was a bonded + Index which is incremented every time a validator is bonded in a + block and - in a block and may have signed a precommit or not. This in - conjunction with the + _may_ have signed a pre-commit or not. This in conjunction with + the - `SignedBlocksWindow` param determines the index in the - `MissedBlocksBitArray`. + signed_blocks_window param determines the index in the missed + block bitmap. jailed_until: type: string format: date-time @@ -48656,18 +51601,20 @@ definitions: type: boolean description: >- Whether or not a validator has been tombstoned (killed out of - validator set). It is set + validator + + set). It is set once the validator commits an equivocation or + for any other - once the validator commits an equivocation or for any other - configured misbehiavor. + configured misbehavior. missed_blocks_counter: type: string format: int64 description: >- - A counter kept to avoid unnecessary array reads. + A counter of missed (unsigned) blocks. It is used to avoid + unnecessary - Note that `Sum(MissedBlocksBitArray)` always equals - `MissedBlocksCounter`. + reads in the missed block bitmap. description: >- ValidatorSigningInfo defines a validator's signing info for monitoring their @@ -48713,18 +51660,18 @@ definitions: start_height: type: string format: int64 - title: Height at which validator was first a candidate OR was unjailed + title: Height at which validator was first a candidate OR was un-jailed index_offset: type: string format: int64 description: >- - Index which is incremented each time the validator was a bonded + Index which is incremented every time a validator is bonded in a block + and - in a block and may have signed a precommit or not. This in conjunction - with the + _may_ have signed a pre-commit or not. This in conjunction with the - `SignedBlocksWindow` param determines the index in the - `MissedBlocksBitArray`. + signed_blocks_window param determines the index in the missed block + bitmap. jailed_until: type: string format: date-time @@ -48735,18 +51682,18 @@ definitions: type: boolean description: >- Whether or not a validator has been tombstoned (killed out of - validator set). It is set + validator + + set). It is set once the validator commits an equivocation or for any + other - once the validator commits an equivocation or for any other configured - misbehiavor. + configured misbehavior. missed_blocks_counter: type: string format: int64 - description: >- - A counter kept to avoid unnecessary array reads. - - Note that `Sum(MissedBlocksBitArray)` always equals - `MissedBlocksCounter`. + description: |- + A counter of missed (unsigned) blocks. It is used to avoid unnecessary + reads in the missed block bitmap. description: >- ValidatorSigningInfo defines a validator's signing info for monitoring their @@ -48820,10 +51767,10 @@ definitions: properties: delegator_address: type: string - description: delegator_address is the bech32-encoded address of the delegator. + description: delegator_address is the encoded address of the delegator. validator_address: type: string - description: validator_address is the bech32-encoded address of the validator. + description: validator_address is the encoded address of the validator. shares: type: string description: shares define the delegation shares received. @@ -48839,10 +51786,10 @@ definitions: properties: delegator_address: type: string - description: delegator_address is the bech32-encoded address of the delegator. + description: delegator_address is the encoded address of the delegator. validator_address: type: string - description: validator_address is the bech32-encoded address of the validator. + description: validator_address is the encoded address of the validator. shares: type: string description: shares define the delegation shares received. @@ -48965,7 +51912,7 @@ definitions: proposer_address: type: string format: byte - description: Header defines the structure of a Tendermint block header. + description: Header defines the structure of a block header. valset: type: array items: @@ -49074,6 +52021,10 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -49112,7 +52063,6 @@ definitions: name "y.z". - JSON @@ -49338,14 +52288,10 @@ definitions: properties: delegator_address: type: string - description: >- - delegator_address is the bech32-encoded address of the - delegator. + description: delegator_address is the encoded address of the delegator. validator_address: type: string - description: >- - validator_address is the bech32-encoded address of the - validator. + description: validator_address is the encoded address of the validator. shares: type: string description: shares define the delegation shares received. @@ -49394,14 +52340,10 @@ definitions: properties: delegator_address: type: string - description: >- - delegator_address is the bech32-encoded address of the - delegator. + description: delegator_address is the encoded address of the delegator. validator_address: type: string - description: >- - validator_address is the bech32-encoded address of the - validator. + description: validator_address is the encoded address of the validator. shares: type: string description: shares define the delegation shares received. @@ -49467,14 +52409,10 @@ definitions: properties: delegator_address: type: string - description: >- - delegator_address is the bech32-encoded address of the - delegator. + description: delegator_address is the encoded address of the delegator. validator_address: type: string - description: >- - validator_address is the bech32-encoded address of the - validator. + description: validator_address is the encoded address of the validator. entries: type: array items: @@ -49646,6 +52584,10 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -49682,7 +52624,6 @@ definitions: name "y.z". - JSON @@ -49960,6 +52901,10 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -49998,7 +52943,6 @@ definitions: name "y.z". - JSON @@ -50270,7 +53214,7 @@ definitions: proposer_address: type: string format: byte - description: Header defines the structure of a Tendermint block header. + description: Header defines the structure of a block header. valset: type: array items: @@ -50380,6 +53324,10 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -50419,7 +53367,6 @@ definitions: name "y.z". - JSON @@ -50807,10 +53754,10 @@ definitions: properties: delegator_address: type: string - description: delegator_address is the bech32-encoded address of the delegator. + description: delegator_address is the encoded address of the delegator. validator_address: type: string - description: validator_address is the bech32-encoded address of the validator. + description: validator_address is the encoded address of the validator. entries: type: array items: @@ -50867,14 +53814,10 @@ definitions: properties: delegator_address: type: string - description: >- - delegator_address is the bech32-encoded address of the - delegator. + description: delegator_address is the encoded address of the delegator. validator_address: type: string - description: >- - validator_address is the bech32-encoded address of the - validator. + description: validator_address is the encoded address of the validator. shares: type: string description: shares define the delegation shares received. @@ -51036,6 +53979,10 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -51072,7 +54019,6 @@ definitions: name "y.z". - JSON @@ -51247,14 +54193,10 @@ definitions: properties: delegator_address: type: string - description: >- - delegator_address is the bech32-encoded address of the - delegator. + description: delegator_address is the encoded address of the delegator. validator_address: type: string - description: >- - validator_address is the bech32-encoded address of the - validator. + description: validator_address is the encoded address of the validator. entries: type: array items: @@ -51430,6 +54372,10 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -51468,7 +54414,6 @@ definitions: name "y.z". - JSON @@ -51928,10 +54873,10 @@ definitions: properties: delegator_address: type: string - description: delegator_address is the bech32-encoded address of the delegator. + description: delegator_address is the encoded address of the delegator. validator_address: type: string - description: validator_address is the bech32-encoded address of the validator. + description: validator_address is the encoded address of the validator. entries: type: array items: @@ -52102,6 +55047,10 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -52137,7 +55086,6 @@ definitions: name "y.z". - JSON @@ -52402,8 +55350,7 @@ definitions: Event allows application developers to attach additional information to - ResponseBeginBlock, ResponseEndBlock, ResponseCheckTx and - ResponseDeliverTx. + ResponseFinalizeBlock and ResponseCheckTx. Later, transactions may be queried using these events. description: >- @@ -52508,6 +55455,10 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -52543,7 +55494,6 @@ definitions: name "y.z". - JSON @@ -52777,6 +55727,10 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -52812,7 +55766,6 @@ definitions: name "y.z". - JSON @@ -52881,8 +55834,7 @@ definitions: Event allows application developers to attach additional information to - ResponseBeginBlock, ResponseEndBlock, ResponseCheckTx and - ResponseDeliverTx. + ResponseFinalizeBlock and ResponseCheckTx. Later, transactions may be queried using these events. description: >- @@ -52943,11 +55895,12 @@ definitions: verified with raw bytes from Tx. - SIGN_MODE_TEXTUAL: SIGN_MODE_TEXTUAL is a future signing mode that will verify some human-readable textual representation on top of the binary representation - from SIGN_MODE_DIRECT. It is currently not supported. + from SIGN_MODE_DIRECT. + + Since: cosmos-sdk 0.50 - SIGN_MODE_DIRECT_AUX: SIGN_MODE_DIRECT_AUX specifies a signing mode which uses SignDocDirectAux. As opposed to SIGN_MODE_DIRECT, this sign mode does not - require signers signing over other signers' `signer_info`. It also allows - for adding Tips in transactions. + require signers signing over other signers' `signer_info`. Since: cosmos-sdk 0.46 - SIGN_MODE_LEGACY_AMINO_JSON: SIGN_MODE_LEGACY_AMINO_JSON is a backwards compatibility mode which uses @@ -53087,17 +56040,17 @@ definitions: - BROADCAST_MODE_SYNC - BROADCAST_MODE_ASYNC default: BROADCAST_MODE_UNSPECIFIED - description: >- + description: |- BroadcastMode specifies the broadcast mode for the TxService.Broadcast RPC method. - BROADCAST_MODE_UNSPECIFIED: zero-value for mode ordering - BROADCAST_MODE_BLOCK: DEPRECATED: use BROADCAST_MODE_SYNC instead, BROADCAST_MODE_BLOCK is not supported by the SDK from v0.47.x onwards. - - BROADCAST_MODE_SYNC: BROADCAST_MODE_SYNC defines a tx broadcasting mode where the client waits for - a CheckTx execution response only. - - BROADCAST_MODE_ASYNC: BROADCAST_MODE_ASYNC defines a tx broadcasting mode where the client returns - immediately. + - BROADCAST_MODE_SYNC: BROADCAST_MODE_SYNC defines a tx broadcasting mode where the client waits + for a CheckTx execution response only. + - BROADCAST_MODE_ASYNC: BROADCAST_MODE_ASYNC defines a tx broadcasting mode where the client + returns immediately. cosmos.tx.v1beta1.BroadcastTxRequest: type: object properties: @@ -53115,15 +56068,17 @@ definitions: default: BROADCAST_MODE_UNSPECIFIED description: >- BroadcastMode specifies the broadcast mode for the TxService.Broadcast - RPC method. + RPC + + method. - BROADCAST_MODE_UNSPECIFIED: zero-value for mode ordering - BROADCAST_MODE_BLOCK: DEPRECATED: use BROADCAST_MODE_SYNC instead, BROADCAST_MODE_BLOCK is not supported by the SDK from v0.47.x onwards. - - BROADCAST_MODE_SYNC: BROADCAST_MODE_SYNC defines a tx broadcasting mode where the client waits for - a CheckTx execution response only. - - BROADCAST_MODE_ASYNC: BROADCAST_MODE_ASYNC defines a tx broadcasting mode where the client returns - immediately. + - BROADCAST_MODE_SYNC: BROADCAST_MODE_SYNC defines a tx broadcasting mode where the client waits + for a CheckTx execution response only. + - BROADCAST_MODE_ASYNC: BROADCAST_MODE_ASYNC defines a tx broadcasting mode where the client + returns immediately. description: |- BroadcastTxRequest is the request type for the Service.BroadcastTxRequest RPC method. @@ -53310,6 +56265,10 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -53346,7 +56305,6 @@ definitions: name "y.z". - JSON @@ -53416,8 +56374,7 @@ definitions: Event allows application developers to attach additional information to - ResponseBeginBlock, ResponseEndBlock, ResponseCheckTx and - ResponseDeliverTx. + ResponseFinalizeBlock and ResponseCheckTx. Later, transactions may be queried using these events. description: >- @@ -53599,7 +56556,7 @@ definitions: proposer_address: type: string format: byte - description: Header defines the structure of a Tendermint block header. + description: Header defines the structure of a block header. data: type: object properties: @@ -53679,9 +56636,32 @@ definitions: signature: type: string format: byte + description: >- + Vote signature by the validator if they + participated in consensus for the + + associated block. + extension: + type: string + format: byte + description: >- + Vote extension provided by the application. Only + valid for precommit + + messages. + extension_signature: + type: string + format: byte + description: >- + Vote extension signature by the validator if + they participated in + + consensus for the associated block. + + Only valid for precommit messages. description: >- - Vote represents a prevote, precommit, or commit vote - from validators for + Vote represents a prevote or precommit vote from + validators for consensus. vote_b: @@ -53736,9 +56716,32 @@ definitions: signature: type: string format: byte + description: >- + Vote signature by the validator if they + participated in consensus for the + + associated block. + extension: + type: string + format: byte + description: >- + Vote extension provided by the application. Only + valid for precommit + + messages. + extension_signature: + type: string + format: byte + description: >- + Vote extension signature by the validator if + they participated in + + consensus for the associated block. + + Only valid for precommit messages. description: >- - Vote represents a prevote, precommit, or commit vote - from validators for + Vote represents a prevote or precommit vote from + validators for consensus. total_voting_power: @@ -53842,8 +56845,8 @@ definitions: type: string format: byte description: >- - Header defines the structure of a Tendermint - block header. + Header defines the structure of a block + header. commit: type: object properties: @@ -53884,7 +56887,7 @@ definitions: - BLOCK_ID_FLAG_NIL default: BLOCK_ID_FLAG_UNKNOWN title: >- - BlockIdFlag indicates which BlcokID the + BlockIdFlag indicates which BlockID the signature is for validator_address: type: string @@ -53923,7 +56926,7 @@ definitions: format: byte title: >- PublicKey defines the keys available for - use with Tendermint Validators + use with Validators voting_power: type: string format: int64 @@ -53947,7 +56950,7 @@ definitions: format: byte title: >- PublicKey defines the keys available for - use with Tendermint Validators + use with Validators voting_power: type: string format: int64 @@ -53979,7 +56982,7 @@ definitions: format: byte title: >- PublicKey defines the keys available for use - with Tendermint Validators + with Validators voting_power: type: string format: int64 @@ -54034,7 +57037,7 @@ definitions: - BLOCK_ID_FLAG_COMMIT - BLOCK_ID_FLAG_NIL default: BLOCK_ID_FLAG_UNKNOWN - title: BlockIdFlag indicates which BlcokID the signature is for + title: BlockIdFlag indicates which BlockID the signature is for validator_address: type: string format: byte @@ -54069,7 +57072,9 @@ definitions: was set, its value is undefined otherwise description: >- GetBlockWithTxsResponse is the response type for the - Service.GetBlockWithTxs method. + Service.GetBlockWithTxs + + method. Since: cosmos-sdk 0.45.2 @@ -54259,6 +57264,10 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -54295,7 +57304,6 @@ definitions: name "y.z". - JSON @@ -54365,8 +57373,7 @@ definitions: Event allows application developers to attach additional information to - ResponseBeginBlock, ResponseEndBlock, ResponseCheckTx and - ResponseDeliverTx. + ResponseFinalizeBlock and ResponseCheckTx. Later, transactions may be queried using these events. description: >- @@ -54580,6 +57587,10 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -54618,7 +57629,6 @@ definitions: name "y.z". - JSON @@ -54688,8 +57698,7 @@ definitions: Event allows application developers to attach additional information to - ResponseBeginBlock, ResponseEndBlock, ResponseCheckTx and - ResponseDeliverTx. + ResponseFinalizeBlock and ResponseCheckTx. Later, transactions may be queried using these events. description: >- @@ -54783,15 +57792,15 @@ definitions: human-readable textual representation on top of the binary representation - from SIGN_MODE_DIRECT. It is currently not supported. + from SIGN_MODE_DIRECT. + + + Since: cosmos-sdk 0.50 - SIGN_MODE_DIRECT_AUX: SIGN_MODE_DIRECT_AUX specifies a signing mode which uses SignDocDirectAux. As opposed to SIGN_MODE_DIRECT, this sign mode does not - require signers signing over other signers' `signer_info`. It also - allows - - for adding Tips in transactions. + require signers signing over other signers' `signer_info`. Since: cosmos-sdk 0.46 @@ -54887,15 +57896,15 @@ definitions: human-readable textual representation on top of the binary representation - from SIGN_MODE_DIRECT. It is currently not supported. + from SIGN_MODE_DIRECT. + + + Since: cosmos-sdk 0.50 - SIGN_MODE_DIRECT_AUX: SIGN_MODE_DIRECT_AUX specifies a signing mode which uses SignDocDirectAux. As opposed to SIGN_MODE_DIRECT, this sign mode does not - require signers signing over other signers' `signer_info`. It also - allows - - for adding Tips in transactions. + require signers signing over other signers' `signer_info`. Since: cosmos-sdk 0.46 @@ -54931,7 +57940,9 @@ definitions: default: ORDER_BY_UNSPECIFIED description: >- - ORDER_BY_UNSPECIFIED: ORDER_BY_UNSPECIFIED specifies an unknown sorting - order. OrderBy defaults to ASC in this case. + order. OrderBy defaults + + to ASC in this case. - ORDER_BY_ASC: ORDER_BY_ASC defines ascending order - ORDER_BY_DESC: ORDER_BY_DESC defines descending order title: OrderBy defines the sorting order @@ -55030,6 +58041,10 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -55065,7 +58080,6 @@ definitions: name "y.z". - JSON @@ -55200,8 +58214,7 @@ definitions: Event allows application developers to attach additional information to - ResponseBeginBlock, ResponseEndBlock, ResponseCheckTx and - ResponseDeliverTx. + ResponseFinalizeBlock and ResponseCheckTx. Later, transactions may be queried using these events. description: >- @@ -55309,6 +58322,10 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -55347,7 +58364,6 @@ definitions: name "y.z". - JSON @@ -55523,6 +58539,10 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -55561,7 +58581,6 @@ definitions: name "y.z". - JSON @@ -55731,6 +58750,10 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -55769,7 +58792,6 @@ definitions: name "y.z". - JSON @@ -55912,6 +58934,10 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -55950,7 +58976,6 @@ definitions: name "y.z". - JSON @@ -56113,6 +59138,10 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -56148,7 +59177,6 @@ definitions: name "y.z". - JSON @@ -56311,178 +59339,9 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default use - - 'type.googleapis.com/full.type.name' as the type URL and the unpack - - methods only use the fully qualified type name after the last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - - JSON - - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - title: >- - extension_options are arbitrary options that can be added by chains - - when the default options are not sufficient. If any of these are - present - - and can't be handled, the transaction will be rejected - non_critical_extension_options: - type: array - items: - type: object - properties: - type_url: - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all types - that they - - expect it to use in the context of Any. However, for URLs which - use the - - scheme `http`, `https`, or no scheme, one can optionally set up - a type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might - be - - used with implementation specific semantics. - value: - type: string - format: byte - description: >- - Must be a valid serialized protocol buffer of the above - specified type. - description: >- - `Any` contains an arbitrary serialized protocol buffer message along - with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in the - form - - of utility functions or additional generated methods of the Any - type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); } Example 3: Pack and unpack a message in Python. @@ -56519,6 +59378,181 @@ definitions: name "y.z". + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with an + + additional field `@type` which contains the type URL. Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom JSON + + representation, that representation will be embedded adding a field + + `value` which holds the custom JSON in addition to the `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + title: >- + extension_options are arbitrary options that can be added by chains + + when the default options are not sufficient. If any of these are + present + + and can't be handled, the transaction will be rejected + non_critical_extension_options: + type: array + items: + type: object + properties: + type_url: + type: string + description: >- + A URL/resource name that uniquely identifies the type of the + serialized + + protocol buffer message. This string must contain at least + + one "/" character. The last segment of the URL's path must + represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in a + canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary all types + that they + + expect it to use in the context of Any. However, for URLs which + use the + + scheme `http`, `https`, or no scheme, one can optionally set up + a type + + server that maps type URLs to message definitions as follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in the + official + + protobuf release, and it is not used for type URLs beginning + with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) might + be + + used with implementation specific semantics. + value: + type: string + format: byte + description: >- + Must be a valid serialized protocol buffer of the above + specified type. + description: >- + `Any` contains an arbitrary serialized protocol buffer message along + with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values in the + form + + of utility functions or additional generated methods of the Any + type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by default use + + 'type.googleapis.com/full.type.name' as the type URL and the unpack + + methods only use the fully qualified type name after the last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield type + + name "y.z". + JSON @@ -56666,12 +59700,9 @@ definitions: index: type: boolean description: EventAttribute is a single key-value pair, associated with an event. - description: >- + description: |- Event allows application developers to attach additional information to - - ResponseBeginBlock, ResponseEndBlock, ResponseCheckTx and - ResponseDeliverTx. - + ResponseFinalizeBlock and ResponseCheckTx. Later, transactions may be queried using these events. tendermint.abci.EventAttribute: type: object @@ -56831,6 +59862,10 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -56866,7 +59901,6 @@ definitions: name "y.z". - JSON @@ -57068,6 +60102,10 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -57104,7 +60142,6 @@ definitions: name "y.z". - JSON @@ -57281,6 +60318,10 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -57316,7 +60357,6 @@ definitions: name "y.z". - JSON @@ -57462,6 +60502,10 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -57497,7 +60541,6 @@ definitions: name "y.z". - JSON @@ -57649,6 +60692,10 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -57687,7 +60734,6 @@ definitions: name "y.z". - JSON @@ -57863,6 +60909,10 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -57901,7 +60951,6 @@ definitions: name "y.z". - JSON @@ -58073,6 +61122,10 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -58111,7 +61164,6 @@ definitions: name "y.z". - JSON @@ -58685,6 +61737,10 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -58720,7 +61776,6 @@ definitions: name "y.z". - JSON @@ -58865,6 +61920,10 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -58900,7 +61959,6 @@ definitions: name "y.z". - JSON @@ -59070,6 +62128,10 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -59106,7 +62168,6 @@ definitions: name "y.z". - JSON @@ -59276,6 +62337,10 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -59314,7 +62379,6 @@ definitions: name "y.z". - JSON @@ -59488,6 +62552,10 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -59524,7 +62592,6 @@ definitions: name "y.z". - JSON @@ -59683,6 +62750,10 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -59721,7 +62792,6 @@ definitions: name "y.z". - JSON @@ -59806,7 +62876,11 @@ definitions: description: admin is the account address of the group's admin. metadata: type: string - description: metadata is any arbitrary metadata to attached to the group. + title: >- + metadata is any arbitrary metadata to attached to the group. + + the recommended format of the metadata is to be found here: + https://docs.cosmos.network/v0.47/modules/group#group-1 version: type: string format: uint64 @@ -59870,7 +62944,10 @@ definitions: description: admin is the account address of the group admin. metadata: type: string - description: metadata is any arbitrary metadata attached to the group policy. + title: |- + metadata is any arbitrary metadata attached to the group policy. + the recommended format of the metadata is to be found here: + https://docs.cosmos.network/v0.47/modules/group#decision-policy-1 version: type: string format: uint64 @@ -59971,6 +63048,10 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -60006,7 +63087,6 @@ definitions: name "y.z". - JSON @@ -60078,7 +63158,10 @@ definitions: description: group_policy_address is the account address of group policy. metadata: type: string - description: metadata is any arbitrary metadata attached to the proposal. + title: |- + metadata is any arbitrary metadata attached to the proposal. + the recommended format of the metadata is to be found here: + https://docs.cosmos.network/v0.47/modules/group#proposal-4 proposers: type: array items: @@ -60267,6 +63350,10 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -60302,7 +63389,6 @@ definitions: name "y.z". - JSON @@ -60411,7 +63497,11 @@ definitions: description: admin is the account address of the group's admin. metadata: type: string - description: metadata is any arbitrary metadata to attached to the group. + title: >- + metadata is any arbitrary metadata to attached to the group. + + the recommended format of the metadata is to be found here: + https://docs.cosmos.network/v0.47/modules/group#group-1 version: type: string format: uint64 @@ -60509,7 +63599,12 @@ definitions: description: admin is the account address of the group admin. metadata: type: string - description: metadata is any arbitrary metadata attached to the group policy. + title: >- + metadata is any arbitrary metadata attached to the group policy. + + the recommended format of the metadata is to be found here: + + https://docs.cosmos.network/v0.47/modules/group#decision-policy-1 version: type: string format: uint64 @@ -60616,6 +63711,10 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -60654,7 +63753,6 @@ definitions: name "y.z". - JSON @@ -60741,7 +63839,12 @@ definitions: description: admin is the account address of the group admin. metadata: type: string - description: metadata is any arbitrary metadata attached to the group policy. + title: >- + metadata is any arbitrary metadata attached to the group policy. + + the recommended format of the metadata is to be found here: + + https://docs.cosmos.network/v0.47/modules/group#decision-policy-1 version: type: string format: uint64 @@ -60848,6 +63951,10 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -60886,7 +63993,6 @@ definitions: name "y.z". - JSON @@ -60973,7 +64079,10 @@ definitions: description: admin is the account address of the group admin. metadata: type: string - description: metadata is any arbitrary metadata attached to the group policy. + title: |- + metadata is any arbitrary metadata attached to the group policy. + the recommended format of the metadata is to be found here: + https://docs.cosmos.network/v0.47/modules/group#decision-policy-1 version: type: string format: uint64 @@ -61078,6 +64187,10 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -61114,7 +64227,6 @@ definitions: name "y.z". - JSON @@ -61176,72 +64288,80 @@ definitions: description: admin is the account address of the group's admin. metadata: type: string - description: metadata is any arbitrary metadata to attached to the group. - version: - type: string - format: uint64 title: >- - version is used to track changes to a group's membership - structure that - - would break existing proposals. Whenever any members weight is - changed, - - or any member is added or removed this version is incremented - and will + metadata is any arbitrary metadata to attached to the group. - cause proposals based on older versions of this group to fail - total_weight: - type: string - description: total_weight is the sum of the group members' weights. - created_at: - type: string - format: date-time - description: created_at is a timestamp specifying when a group was created. - description: >- - GroupInfo represents the high-level on-chain information for a - group. - description: groups are the groups info with the provided admin. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryGroupsByAdminResponse is the Query/GroupsByAdminResponse response - type. - cosmos.group.v1.QueryGroupsByMemberResponse: - type: object - properties: - groups: - type: array - items: - type: object - properties: - id: - type: string - format: uint64 - description: id is the unique ID of the group. - admin: - type: string - description: admin is the account address of the group's admin. - metadata: - type: string - description: metadata is any arbitrary metadata to attached to the group. + the recommended format of the metadata is to be found here: + https://docs.cosmos.network/v0.47/modules/group#group-1 + version: + type: string + format: uint64 + title: >- + version is used to track changes to a group's membership + structure that + + would break existing proposals. Whenever any members weight is + changed, + + or any member is added or removed this version is incremented + and will + + cause proposals based on older versions of this group to fail + total_weight: + type: string + description: total_weight is the sum of the group members' weights. + created_at: + type: string + format: date-time + description: created_at is a timestamp specifying when a group was created. + description: >- + GroupInfo represents the high-level on-chain information for a + group. + description: groups are the groups info with the provided admin. + pagination: + description: pagination defines the pagination in the response. + type: object + properties: + next_key: + type: string + format: byte + description: |- + next_key is the key to be passed to PageRequest.key to + query the next page most efficiently. It will be empty if + there are no more results. + total: + type: string + format: uint64 + title: >- + total is total number of results available if + PageRequest.count_total + + was set, its value is undefined otherwise + description: >- + QueryGroupsByAdminResponse is the Query/GroupsByAdminResponse response + type. + cosmos.group.v1.QueryGroupsByMemberResponse: + type: object + properties: + groups: + type: array + items: + type: object + properties: + id: + type: string + format: uint64 + description: id is the unique ID of the group. + admin: + type: string + description: admin is the account address of the group's admin. + metadata: + type: string + title: >- + metadata is any arbitrary metadata to attached to the group. + + the recommended format of the metadata is to be found here: + https://docs.cosmos.network/v0.47/modules/group#group-1 version: type: string format: uint64 @@ -61287,6 +64407,76 @@ definitions: was set, its value is undefined otherwise description: QueryGroupsByMemberResponse is the Query/GroupsByMember response type. + cosmos.group.v1.QueryGroupsResponse: + type: object + properties: + groups: + type: array + items: + type: object + properties: + id: + type: string + format: uint64 + description: id is the unique ID of the group. + admin: + type: string + description: admin is the account address of the group's admin. + metadata: + type: string + title: >- + metadata is any arbitrary metadata to attached to the group. + + the recommended format of the metadata is to be found here: + https://docs.cosmos.network/v0.47/modules/group#group-1 + version: + type: string + format: uint64 + title: >- + version is used to track changes to a group's membership + structure that + + would break existing proposals. Whenever any members weight is + changed, + + or any member is added or removed this version is incremented + and will + + cause proposals based on older versions of this group to fail + total_weight: + type: string + description: total_weight is the sum of the group members' weights. + created_at: + type: string + format: date-time + description: created_at is a timestamp specifying when a group was created. + description: >- + GroupInfo represents the high-level on-chain information for a + group. + description: '`groups` is all the groups present in state.' + pagination: + description: pagination defines the pagination in the response. + type: object + properties: + next_key: + type: string + format: byte + description: |- + next_key is the key to be passed to PageRequest.key to + query the next page most efficiently. It will be empty if + there are no more results. + total: + type: string + format: uint64 + title: >- + total is total number of results available if + PageRequest.count_total + + was set, its value is undefined otherwise + description: |- + QueryGroupsResponse is the Query/Groups response type. + + Since: cosmos-sdk 0.47.1 cosmos.group.v1.QueryProposalResponse: type: object properties: @@ -61303,7 +64493,10 @@ definitions: description: group_policy_address is the account address of group policy. metadata: type: string - description: metadata is any arbitrary metadata attached to the proposal. + title: |- + metadata is any arbitrary metadata attached to the proposal. + the recommended format of the metadata is to be found here: + https://docs.cosmos.network/v0.47/modules/group#proposal-4 proposers: type: array items: @@ -61502,6 +64695,10 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -61540,7 +64737,6 @@ definitions: name "y.z". - JSON @@ -61604,7 +64800,10 @@ definitions: description: group_policy_address is the account address of group policy. metadata: type: string - description: metadata is any arbitrary metadata attached to the proposal. + title: |- + metadata is any arbitrary metadata attached to the proposal. + the recommended format of the metadata is to be found here: + https://docs.cosmos.network/v0.47/modules/group#proposal-4 proposers: type: array items: @@ -61804,6 +65003,10 @@ definitions: if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } Example 3: Pack and unpack a message in Python. @@ -61843,7 +65046,6 @@ definitions: name "y.z". - JSON @@ -61970,11 +65172,16 @@ definitions: default: VOTE_OPTION_UNSPECIFIED metadata: type: string - description: metadata is any arbitrary metadata attached to the vote. + title: >- + metadata is any arbitrary metadata attached to the vote. + + the recommended format of the metadata is to be found here: + https://docs.cosmos.network/v0.47/modules/group#vote-2 submit_time: type: string format: date-time description: submit_time is the timestamp when the vote was submitted. + title: Vote represents a vote for a proposal.string metadata description: >- QueryVoteByProposalVoterResponse is the Query/VoteByProposalVoter response type. @@ -62005,12 +65212,16 @@ definitions: default: VOTE_OPTION_UNSPECIFIED metadata: type: string - description: metadata is any arbitrary metadata attached to the vote. + title: >- + metadata is any arbitrary metadata attached to the vote. + + the recommended format of the metadata is to be found here: + https://docs.cosmos.network/v0.47/modules/group#vote-2 submit_time: type: string format: date-time description: submit_time is the timestamp when the vote was submitted. - description: Vote represents a vote for a proposal. + title: Vote represents a vote for a proposal.string metadata description: votes are the list of votes for given proposal_id. pagination: description: pagination defines the pagination in the response. @@ -62059,12 +65270,16 @@ definitions: default: VOTE_OPTION_UNSPECIFIED metadata: type: string - description: metadata is any arbitrary metadata attached to the vote. + title: >- + metadata is any arbitrary metadata attached to the vote. + + the recommended format of the metadata is to be found here: + https://docs.cosmos.network/v0.47/modules/group#vote-2 submit_time: type: string format: date-time description: submit_time is the timestamp when the vote was submitted. - description: Vote represents a vote for a proposal. + title: Vote represents a vote for a proposal.string metadata description: votes are the list of votes by given voter. pagination: description: pagination defines the pagination in the response. @@ -62124,12 +65339,16 @@ definitions: default: VOTE_OPTION_UNSPECIFIED metadata: type: string - description: metadata is any arbitrary metadata attached to the vote. + title: >- + metadata is any arbitrary metadata attached to the vote. + + the recommended format of the metadata is to be found here: + https://docs.cosmos.network/v0.47/modules/group#vote-2 submit_time: type: string format: date-time description: submit_time is the timestamp when the vote was submitted. - description: Vote represents a vote for a proposal. + title: Vote represents a vote for a proposal.string metadata cosmos.group.v1.VoteOption: type: string enum: @@ -62148,3 +65367,1003 @@ definitions: - VOTE_OPTION_ABSTAIN: VOTE_OPTION_ABSTAIN defines an abstain vote option. - VOTE_OPTION_NO: VOTE_OPTION_NO defines a no vote option. - VOTE_OPTION_NO_WITH_VETO: VOTE_OPTION_NO_WITH_VETO defines a no with veto vote option. + cosmos.circuit.v1.AccountResponse: + type: object + properties: + permission: + type: object + properties: + level: + description: level is the level of permissions granted to this account. + type: string + enum: + - LEVEL_NONE_UNSPECIFIED + - LEVEL_SOME_MSGS + - LEVEL_ALL_MSGS + - LEVEL_SUPER_ADMIN + default: LEVEL_NONE_UNSPECIFIED + limit_type_urls: + type: array + items: + type: string + description: >- + limit_type_urls is used with LEVEL_SOME_MSGS to limit the lists of + Msg type + + URLs that the account can trip. It is an error to use + limit_type_urls with + + a level other than LEVEL_SOME_MSGS. + description: |- + Permissions are the permissions that an account has to trip + or reset the circuit breaker. + description: AccountResponse is the response type for the Query/Account RPC method. + cosmos.circuit.v1.AccountsResponse: + type: object + properties: + accounts: + type: array + items: + type: object + properties: + address: + type: string + permissions: + type: object + properties: + level: + description: level is the level of permissions granted to this account. + type: string + enum: + - LEVEL_NONE_UNSPECIFIED + - LEVEL_SOME_MSGS + - LEVEL_ALL_MSGS + - LEVEL_SUPER_ADMIN + default: LEVEL_NONE_UNSPECIFIED + limit_type_urls: + type: array + items: + type: string + description: >- + limit_type_urls is used with LEVEL_SOME_MSGS to limit the + lists of Msg type + + URLs that the account can trip. It is an error to use + limit_type_urls with + + a level other than LEVEL_SOME_MSGS. + description: |- + Permissions are the permissions that an account has to trip + or reset the circuit breaker. + title: >- + GenesisAccountPermissions is the account permissions for the circuit + breaker in genesis + pagination: + description: pagination defines the pagination in the response. + type: object + properties: + next_key: + type: string + format: byte + description: |- + next_key is the key to be passed to PageRequest.key to + query the next page most efficiently. It will be empty if + there are no more results. + total: + type: string + format: uint64 + title: >- + total is total number of results available if + PageRequest.count_total + + was set, its value is undefined otherwise + description: AccountsResponse is the response type for the Query/Accounts RPC method. + cosmos.circuit.v1.DisabledListResponse: + type: object + properties: + disabled_list: + type: array + items: + type: string + description: >- + DisabledListResponse is the response type for the Query/DisabledList RPC + method. + cosmos.circuit.v1.GenesisAccountPermissions: + type: object + properties: + address: + type: string + permissions: + type: object + properties: + level: + description: level is the level of permissions granted to this account. + type: string + enum: + - LEVEL_NONE_UNSPECIFIED + - LEVEL_SOME_MSGS + - LEVEL_ALL_MSGS + - LEVEL_SUPER_ADMIN + default: LEVEL_NONE_UNSPECIFIED + limit_type_urls: + type: array + items: + type: string + description: >- + limit_type_urls is used with LEVEL_SOME_MSGS to limit the lists of + Msg type + + URLs that the account can trip. It is an error to use + limit_type_urls with + + a level other than LEVEL_SOME_MSGS. + description: |- + Permissions are the permissions that an account has to trip + or reset the circuit breaker. + title: >- + GenesisAccountPermissions is the account permissions for the circuit + breaker in genesis + cosmos.circuit.v1.Permissions: + type: object + properties: + level: + description: level is the level of permissions granted to this account. + type: string + enum: + - LEVEL_NONE_UNSPECIFIED + - LEVEL_SOME_MSGS + - LEVEL_ALL_MSGS + - LEVEL_SUPER_ADMIN + default: LEVEL_NONE_UNSPECIFIED + limit_type_urls: + type: array + items: + type: string + description: >- + limit_type_urls is used with LEVEL_SOME_MSGS to limit the lists of Msg + type + + URLs that the account can trip. It is an error to use limit_type_urls + with + + a level other than LEVEL_SOME_MSGS. + description: |- + Permissions are the permissions that an account has to trip + or reset the circuit breaker. + cosmos.circuit.v1.Permissions.Level: + type: string + enum: + - LEVEL_NONE_UNSPECIFIED + - LEVEL_SOME_MSGS + - LEVEL_ALL_MSGS + - LEVEL_SUPER_ADMIN + default: LEVEL_NONE_UNSPECIFIED + description: |- + Level is the permission level. + + - LEVEL_NONE_UNSPECIFIED: LEVEL_NONE_UNSPECIFIED indicates that the account will have no circuit + breaker permissions. + - LEVEL_SOME_MSGS: LEVEL_SOME_MSGS indicates that the account will have permission to + trip or reset the circuit breaker for some Msg type URLs. If this level + is chosen, a non-empty list of Msg type URLs must be provided in + limit_type_urls. + - LEVEL_ALL_MSGS: LEVEL_ALL_MSGS indicates that the account can trip or reset the circuit + breaker for Msg's of all type URLs. + - LEVEL_SUPER_ADMIN: LEVEL_SUPER_ADMIN indicates that the account can take all circuit breaker + actions and can grant permissions to other accounts. + cosmos.consensus.v1.QueryParamsResponse: + type: object + properties: + params: + description: >- + params are the tendermint consensus params stored in the consensus + module. + + Please note that `params.version` is not populated in this response, + it is + + tracked separately in the x/upgrade module. + type: object + properties: + block: + type: object + properties: + max_bytes: + type: string + format: int64 + title: |- + Max block size, in bytes. + Note: must be greater than 0 + max_gas: + type: string + format: int64 + title: |- + Max gas per block. + Note: must be greater or equal to -1 + description: BlockParams contains limits on the block size. + evidence: + type: object + properties: + max_age_num_blocks: + type: string + format: int64 + description: >- + Max age of evidence, in blocks. + + + The basic formula for calculating this is: MaxAgeDuration / + {average block + + time}. + max_age_duration: + type: string + description: >- + Max age of evidence, in time. + + + It should correspond with an app's "unbonding period" or other + similar + + mechanism for handling [Nothing-At-Stake + + attacks](https://github.com/ethereum/wiki/wiki/Proof-of-Stake-FAQ#what-is-the-nothing-at-stake-problem-and-how-can-it-be-fixed). + max_bytes: + type: string + format: int64 + title: >- + This sets the maximum size of total evidence in bytes that can + be committed in a single block. + + and should fall comfortably under the max block bytes. + + Default is 1048576 or 1MB + description: EvidenceParams determine how we handle evidence of malfeasance. + validator: + type: object + properties: + pub_key_types: + type: array + items: + type: string + description: |- + ValidatorParams restrict the public key types validators can use. + NOTE: uses ABCI pubkey naming, not Amino names. + version: + type: object + properties: + app: + type: string + format: uint64 + description: VersionParams contains the ABCI application version. + abci: + type: object + properties: + vote_extensions_enable_height: + type: string + format: int64 + description: >- + vote_extensions_enable_height configures the first height + during which + + vote extensions will be enabled. During this specified height, + and for all + + subsequent heights, precommit messages that do not contain + valid extension data + + will be considered invalid. Prior to this height, vote + extensions will not + + be used or accepted by validators on the network. + + + Once enabled, vote extensions will be created by the + application in ExtendVote, + + passed to the application for validation in + VerifyVoteExtension and given + + to the application to use when proposing a block during + PrepareProposal. + description: >- + ABCIParams configure functionality specific to the Application + Blockchain Interface. + description: >- + QueryParamsResponse defines the response type for querying x/consensus + parameters. + tendermint.types.ABCIParams: + type: object + properties: + vote_extensions_enable_height: + type: string + format: int64 + description: >- + vote_extensions_enable_height configures the first height during which + + vote extensions will be enabled. During this specified height, and for + all + + subsequent heights, precommit messages that do not contain valid + extension data + + will be considered invalid. Prior to this height, vote extensions will + not + + be used or accepted by validators on the network. + + + Once enabled, vote extensions will be created by the application in + ExtendVote, + + passed to the application for validation in VerifyVoteExtension and + given + + to the application to use when proposing a block during + PrepareProposal. + description: >- + ABCIParams configure functionality specific to the Application Blockchain + Interface. + tendermint.types.BlockParams: + type: object + properties: + max_bytes: + type: string + format: int64 + title: |- + Max block size, in bytes. + Note: must be greater than 0 + max_gas: + type: string + format: int64 + title: |- + Max gas per block. + Note: must be greater or equal to -1 + description: BlockParams contains limits on the block size. + tendermint.types.ConsensusParams: + type: object + properties: + block: + type: object + properties: + max_bytes: + type: string + format: int64 + title: |- + Max block size, in bytes. + Note: must be greater than 0 + max_gas: + type: string + format: int64 + title: |- + Max gas per block. + Note: must be greater or equal to -1 + description: BlockParams contains limits on the block size. + evidence: + type: object + properties: + max_age_num_blocks: + type: string + format: int64 + description: >- + Max age of evidence, in blocks. + + + The basic formula for calculating this is: MaxAgeDuration / + {average block + + time}. + max_age_duration: + type: string + description: >- + Max age of evidence, in time. + + + It should correspond with an app's "unbonding period" or other + similar + + mechanism for handling [Nothing-At-Stake + + attacks](https://github.com/ethereum/wiki/wiki/Proof-of-Stake-FAQ#what-is-the-nothing-at-stake-problem-and-how-can-it-be-fixed). + max_bytes: + type: string + format: int64 + title: >- + This sets the maximum size of total evidence in bytes that can be + committed in a single block. + + and should fall comfortably under the max block bytes. + + Default is 1048576 or 1MB + description: EvidenceParams determine how we handle evidence of malfeasance. + validator: + type: object + properties: + pub_key_types: + type: array + items: + type: string + description: |- + ValidatorParams restrict the public key types validators can use. + NOTE: uses ABCI pubkey naming, not Amino names. + version: + type: object + properties: + app: + type: string + format: uint64 + description: VersionParams contains the ABCI application version. + abci: + type: object + properties: + vote_extensions_enable_height: + type: string + format: int64 + description: >- + vote_extensions_enable_height configures the first height during + which + + vote extensions will be enabled. During this specified height, and + for all + + subsequent heights, precommit messages that do not contain valid + extension data + + will be considered invalid. Prior to this height, vote extensions + will not + + be used or accepted by validators on the network. + + + Once enabled, vote extensions will be created by the application + in ExtendVote, + + passed to the application for validation in VerifyVoteExtension + and given + + to the application to use when proposing a block during + PrepareProposal. + description: >- + ABCIParams configure functionality specific to the Application + Blockchain Interface. + description: |- + ConsensusParams contains consensus critical parameters that determine the + validity of blocks. + tendermint.types.EvidenceParams: + type: object + properties: + max_age_num_blocks: + type: string + format: int64 + description: >- + Max age of evidence, in blocks. + + + The basic formula for calculating this is: MaxAgeDuration / {average + block + + time}. + max_age_duration: + type: string + description: >- + Max age of evidence, in time. + + + It should correspond with an app's "unbonding period" or other similar + + mechanism for handling [Nothing-At-Stake + + attacks](https://github.com/ethereum/wiki/wiki/Proof-of-Stake-FAQ#what-is-the-nothing-at-stake-problem-and-how-can-it-be-fixed). + max_bytes: + type: string + format: int64 + title: >- + This sets the maximum size of total evidence in bytes that can be + committed in a single block. + + and should fall comfortably under the max block bytes. + + Default is 1048576 or 1MB + description: EvidenceParams determine how we handle evidence of malfeasance. + tendermint.types.ValidatorParams: + type: object + properties: + pub_key_types: + type: array + items: + type: string + description: |- + ValidatorParams restrict the public key types validators can use. + NOTE: uses ABCI pubkey naming, not Amino names. + tendermint.types.VersionParams: + type: object + properties: + app: + type: string + format: uint64 + description: VersionParams contains the ABCI application version. + cosmos.app.v1alpha1.Config: + type: object + properties: + modules: + type: array + items: + type: object + properties: + name: + type: string + description: >- + name is the unique name of the module within the app. It should + be a name + + that persists between different versions of a module so that + modules + + can be smoothly upgraded to new versions. + + + For example, for the module cosmos.bank.module.v1.Module, we may + chose + + to simply name the module "bank" in the app. When we upgrade to + + cosmos.bank.module.v2.Module, the app-specific name "bank" stays + the same + + and the framework knows that the v2 module should receive all + the same state + + that the v1 module had. Note: modules should provide info on + which versions + + they can migrate from in the ModuleDescriptor.can_migration_from + field. + config: + description: >- + config is the config object for the module. Module config + messages should + + define a ModuleDescriptor using the + cosmos.app.v1alpha1.is_module extension. + type: object + properties: + type_url: + type: string + description: >- + A URL/resource name that uniquely identifies the type of the + serialized + + protocol buffer message. This string must contain at least + + one "/" character. The last segment of the URL's path must + represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in a + canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary all + types that they + + expect it to use in the context of Any. However, for URLs + which use the + + scheme `http`, `https`, or no scheme, one can optionally set + up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based on + the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in the + official + + protobuf release, and it is not used for type URLs beginning + with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + value: + type: string + format: byte + description: >- + Must be a valid serialized protocol buffer of the above + specified type. + golang_bindings: + type: array + items: + type: object + properties: + interface_type: + type: string + title: >- + interface_type is the interface type which will be bound + to a specific implementation type + implementation: + type: string + title: >- + implementation is the implementing type which will be + supplied when an input of type interface is requested + description: >- + GolangBinding is an explicit interface type to implementing + type binding for dependency injection. + description: >- + golang_bindings specifies explicit interface to implementation + type bindings which + + depinject uses to resolve interface inputs to provider + functions. The scope of this + + field's configuration is module specific. + description: ModuleConfig is a module configuration for an app. + description: modules are the module configurations for the app. + golang_bindings: + type: array + items: + type: object + properties: + interface_type: + type: string + title: >- + interface_type is the interface type which will be bound to a + specific implementation type + implementation: + type: string + title: >- + implementation is the implementing type which will be supplied + when an input of type interface is requested + description: >- + GolangBinding is an explicit interface type to implementing type + binding for dependency injection. + description: >- + golang_bindings specifies explicit interface to implementation type + bindings which + + depinject uses to resolve interface inputs to provider functions. The + scope of this + + field's configuration is global (not module specific). + description: >- + Config represents the configuration for a Cosmos SDK ABCI app. + + It is intended that all state machine logic including the version of + + baseapp and tx handlers (and possibly even Tendermint) that an app needs + + can be described in a config object. For compatibility, the framework + should + + allow a mixture of declarative and imperative app wiring, however, apps + + that strive for the maximum ease of maintainability should be able to + describe + + their state machine with a config object alone. + cosmos.app.v1alpha1.GolangBinding: + type: object + properties: + interface_type: + type: string + title: >- + interface_type is the interface type which will be bound to a specific + implementation type + implementation: + type: string + title: >- + implementation is the implementing type which will be supplied when an + input of type interface is requested + description: >- + GolangBinding is an explicit interface type to implementing type binding + for dependency injection. + cosmos.app.v1alpha1.ModuleConfig: + type: object + properties: + name: + type: string + description: >- + name is the unique name of the module within the app. It should be a + name + + that persists between different versions of a module so that modules + + can be smoothly upgraded to new versions. + + + For example, for the module cosmos.bank.module.v1.Module, we may chose + + to simply name the module "bank" in the app. When we upgrade to + + cosmos.bank.module.v2.Module, the app-specific name "bank" stays the + same + + and the framework knows that the v2 module should receive all the same + state + + that the v1 module had. Note: modules should provide info on which + versions + + they can migrate from in the ModuleDescriptor.can_migration_from + field. + config: + description: >- + config is the config object for the module. Module config messages + should + + define a ModuleDescriptor using the cosmos.app.v1alpha1.is_module + extension. + type: object + properties: + type_url: + type: string + description: >- + A URL/resource name that uniquely identifies the type of the + serialized + + protocol buffer message. This string must contain at least + + one "/" character. The last segment of the URL's path must + represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in a + canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary all types + that they + + expect it to use in the context of Any. However, for URLs which + use the + + scheme `http`, `https`, or no scheme, one can optionally set up a + type + + server that maps type URLs to message definitions as follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in the + official + + protobuf release, and it is not used for type URLs beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) might be + + used with implementation specific semantics. + value: + type: string + format: byte + description: >- + Must be a valid serialized protocol buffer of the above specified + type. + golang_bindings: + type: array + items: + type: object + properties: + interface_type: + type: string + title: >- + interface_type is the interface type which will be bound to a + specific implementation type + implementation: + type: string + title: >- + implementation is the implementing type which will be supplied + when an input of type interface is requested + description: >- + GolangBinding is an explicit interface type to implementing type + binding for dependency injection. + description: >- + golang_bindings specifies explicit interface to implementation type + bindings which + + depinject uses to resolve interface inputs to provider functions. The + scope of this + + field's configuration is module specific. + description: ModuleConfig is a module configuration for an app. + cosmos.app.v1alpha1.QueryConfigResponse: + type: object + properties: + config: + description: config is the current app config. + type: object + properties: + modules: + type: array + items: + type: object + properties: + name: + type: string + description: >- + name is the unique name of the module within the app. It + should be a name + + that persists between different versions of a module so that + modules + + can be smoothly upgraded to new versions. + + + For example, for the module cosmos.bank.module.v1.Module, we + may chose + + to simply name the module "bank" in the app. When we upgrade + to + + cosmos.bank.module.v2.Module, the app-specific name "bank" + stays the same + + and the framework knows that the v2 module should receive + all the same state + + that the v1 module had. Note: modules should provide info on + which versions + + they can migrate from in the + ModuleDescriptor.can_migration_from field. + config: + description: >- + config is the config object for the module. Module config + messages should + + define a ModuleDescriptor using the + cosmos.app.v1alpha1.is_module extension. + type: object + properties: + type_url: + type: string + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + value: + type: string + format: byte + description: >- + Must be a valid serialized protocol buffer of the above + specified type. + golang_bindings: + type: array + items: + type: object + properties: + interface_type: + type: string + title: >- + interface_type is the interface type which will be + bound to a specific implementation type + implementation: + type: string + title: >- + implementation is the implementing type which will be + supplied when an input of type interface is requested + description: >- + GolangBinding is an explicit interface type to + implementing type binding for dependency injection. + description: >- + golang_bindings specifies explicit interface to + implementation type bindings which + + depinject uses to resolve interface inputs to provider + functions. The scope of this + + field's configuration is module specific. + description: ModuleConfig is a module configuration for an app. + description: modules are the module configurations for the app. + golang_bindings: + type: array + items: + type: object + properties: + interface_type: + type: string + title: >- + interface_type is the interface type which will be bound to + a specific implementation type + implementation: + type: string + title: >- + implementation is the implementing type which will be + supplied when an input of type interface is requested + description: >- + GolangBinding is an explicit interface type to implementing type + binding for dependency injection. + description: >- + golang_bindings specifies explicit interface to implementation + type bindings which + + depinject uses to resolve interface inputs to provider functions. + The scope of this + + field's configuration is global (not module specific). + description: QueryConfigRequest is the Query/Config response type. diff --git a/client/docs/swagger-ui/swagger.yaml b/client/docs/swagger-ui/swagger.yaml index 8add5e6857..e10885d8de 100644 --- a/client/docs/swagger-ui/swagger.yaml +++ b/client/docs/swagger-ui/swagger.yaml @@ -2807,7 +2807,7 @@ paths: type: string format: uint64 - name: ratio - description: sdk.Dec as a string. + description: sdkmath.LegacyDec as a string. in: query required: false type: string @@ -7962,7 +7962,7 @@ paths: type: string value: type: string - title: sdk.Dec as string + title: sdkmath.LegacyDec as string description: >- BorrowInterestFactorResponse defines an individual borrow interest factor. @@ -8302,7 +8302,7 @@ paths: type: string value: type: string - title: sdk.Dec as string + title: sdkmath.LegacyDec as string description: >- SupplyInterestFactorResponse defines an individual borrow interest factor. @@ -8617,10 +8617,10 @@ paths: type: string borrow_interest_factor: type: string - title: sdk.Dec as String + title: sdkmath.LegacyDec as String supply_interest_factor: type: string - title: sdk.Dec as String + title: sdkmath.LegacyDec as String title: >- InterestFactor is a unique type returned by interest factor queries @@ -8844,10 +8844,10 @@ paths: type: string supply_interest_rate: type: string - title: sdk.Dec as String + title: sdkmath.LegacyDec as String borrow_interest_rate: type: string - title: sdk.Dec as String + title: sdkmath.LegacyDec as String title: >- MoneyMarketInterestRate is a unique type returned by interest rate queries @@ -10032,7 +10032,7 @@ paths: type: string value: type: string - title: sdk.Dec as string + title: sdkmath.LegacyDec as string description: >- BorrowInterestFactorResponse defines an individual borrow interest factor. @@ -10372,7 +10372,7 @@ paths: type: string value: type: string - title: sdk.Dec as string + title: sdkmath.LegacyDec as string description: >- SupplyInterestFactorResponse defines an individual borrow interest factor. @@ -59381,7 +59381,7 @@ definitions: type: string value: type: string - title: sdk.Dec as string + title: sdkmath.LegacyDec as string description: BorrowInterestFactorResponse defines an individual borrow interest factor. kava.hard.v1beta1.BorrowLimit: type: object @@ -59421,7 +59421,7 @@ definitions: type: string value: type: string - title: sdk.Dec as string + title: sdkmath.LegacyDec as string description: >- BorrowInterestFactorResponse defines an individual borrow interest factor. @@ -59456,7 +59456,7 @@ definitions: type: string value: type: string - title: sdk.Dec as string + title: sdkmath.LegacyDec as string description: >- SupplyInterestFactorResponse defines an individual borrow interest factor. @@ -59470,10 +59470,10 @@ definitions: type: string borrow_interest_factor: type: string - title: sdk.Dec as String + title: sdkmath.LegacyDec as String supply_interest_factor: type: string - title: sdk.Dec as String + title: sdkmath.LegacyDec as String title: InterestFactor is a unique type returned by interest factor queries kava.hard.v1beta1.InterestRateModel: type: object @@ -59530,10 +59530,10 @@ definitions: type: string supply_interest_rate: type: string - title: sdk.Dec as String + title: sdkmath.LegacyDec as String borrow_interest_rate: type: string - title: sdk.Dec as String + title: sdkmath.LegacyDec as String title: MoneyMarketInterestRate is a unique type returned by interest rate queries kava.hard.v1beta1.Params: type: object @@ -59833,7 +59833,7 @@ definitions: type: string value: type: string - title: sdk.Dec as string + title: sdkmath.LegacyDec as string description: >- BorrowInterestFactorResponse defines an individual borrow interest factor. @@ -59905,7 +59905,7 @@ definitions: type: string value: type: string - title: sdk.Dec as string + title: sdkmath.LegacyDec as string description: >- SupplyInterestFactorResponse defines an individual borrow interest factor. @@ -59953,10 +59953,10 @@ definitions: type: string borrow_interest_factor: type: string - title: sdk.Dec as String + title: sdkmath.LegacyDec as String supply_interest_factor: type: string - title: sdk.Dec as String + title: sdkmath.LegacyDec as String title: InterestFactor is a unique type returned by interest factor queries description: >- QueryInterestFactorsResponse is the response type for the @@ -59973,10 +59973,10 @@ definitions: type: string supply_interest_rate: type: string - title: sdk.Dec as String + title: sdkmath.LegacyDec as String borrow_interest_rate: type: string - title: sdk.Dec as String + title: sdkmath.LegacyDec as String title: >- MoneyMarketInterestRate is a unique type returned by interest rate queries @@ -60129,7 +60129,7 @@ definitions: type: string value: type: string - title: sdk.Dec as string + title: sdkmath.LegacyDec as string description: >- BorrowInterestFactorResponse defines an individual borrow interest factor. @@ -60201,7 +60201,7 @@ definitions: type: string value: type: string - title: sdk.Dec as string + title: sdkmath.LegacyDec as string description: >- SupplyInterestFactorResponse defines an individual borrow interest factor. @@ -60244,7 +60244,7 @@ definitions: type: string value: type: string - title: sdk.Dec as string + title: sdkmath.LegacyDec as string description: SupplyInterestFactorResponse defines an individual borrow interest factor. kava.incentive.v1beta1.Apy: type: object diff --git a/client/grpc/client.go b/client/grpc/client.go index 5cb309f194..36c5c71128 100644 --- a/client/grpc/client.go +++ b/client/grpc/client.go @@ -33,13 +33,13 @@ func NewClientWithConfig(grpcUrl string, config KavaGrpcClientConfig) (*KavaGrpc if grpcUrl == "" { return nil, errors.New("grpc url cannot be empty") } - query, error := query.NewQueryClient(grpcUrl) - if error != nil { - return nil, error + queryClient, err := query.NewQueryClient(grpcUrl) + if err != nil { + return nil, err } client := &KavaGrpcClient{ - Query: query, - Util: util.NewUtil(query), + Query: queryClient, + Util: util.NewUtil(queryClient), config: config, } return client, nil diff --git a/client/grpc/query/connection.go b/client/grpc/query/connection.go index ee493ba302..11d29acdaa 100644 --- a/client/grpc/query/connection.go +++ b/client/grpc/query/connection.go @@ -2,8 +2,10 @@ package query import ( "context" + "cosmossdk.io/log" "crypto/tls" "fmt" + dbm "github.com/cosmos/cosmos-db" "net/url" "github.com/cosmos/cosmos-sdk/codec" @@ -34,6 +36,14 @@ func newGrpcConnection(ctx context.Context, endpoint string) (*grpc.ClientConn, // otherwise it will produce panics like: // invalid Go type math.Int for field ... encodingConfig := app.MakeEncodingConfig() + _ = app.NewApp( + log.NewNopLogger(), + dbm.NewMemDB(), + app.DefaultNodeHome, + nil, + encodingConfig, + app.DefaultOptions, + ) protoCodec := codec.NewProtoCodec(encodingConfig.InterfaceRegistry) grpcCodec := protoCodec.GRPCCodec() diff --git a/client/grpc/query/query.go b/client/grpc/query/query.go index ffc83e2554..2ac1268899 100644 --- a/client/grpc/query/query.go +++ b/client/grpc/query/query.go @@ -3,24 +3,24 @@ package query import ( "context" - "github.com/cosmos/cosmos-sdk/client/grpc/tmservice" + evidencetypes "cosmossdk.io/x/evidence/types" + upgradetypes "cosmossdk.io/x/upgrade/types" + tmservice "github.com/cosmos/cosmos-sdk/client/grpc/cmtservice" txtypes "github.com/cosmos/cosmos-sdk/types/tx" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" authz "github.com/cosmos/cosmos-sdk/x/authz" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" consensustypes "github.com/cosmos/cosmos-sdk/x/consensus/types" disttypes "github.com/cosmos/cosmos-sdk/x/distribution/types" - evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types" govv1types "github.com/cosmos/cosmos-sdk/x/gov/types/v1" govv1beta1types "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" paramstypes "github.com/cosmos/cosmos-sdk/x/params/types/proposal" slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" - ibcclienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" + ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" + ibcclienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" evmtypes "github.com/evmos/ethermint/x/evm/types" feemarkettypes "github.com/evmos/ethermint/x/feemarket/types" diff --git a/client/grpc/util/account.go b/client/grpc/util/account.go index 51e08e0452..de95b0dafc 100644 --- a/client/grpc/util/account.go +++ b/client/grpc/util/account.go @@ -3,12 +3,14 @@ package util import ( "context" "fmt" + sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) // Account fetches an account via an address and returns the unpacked account -func (u *Util) Account(addr string) (authtypes.AccountI, error) { +func (u *Util) Account(addr string) (sdk.AccountI, error) { + fmt.Println("Util fetching account for address:", addr) res, err := u.query.Auth.Account(context.Background(), &authtypes.QueryAccountRequest{ Address: addr, }) @@ -16,7 +18,10 @@ func (u *Util) Account(addr string) (authtypes.AccountI, error) { return nil, fmt.Errorf("failed to fetch account: %w", err) } - var acc authtypes.AccountI + var acc sdk.AccountI + + fmt.Println("trying to unpack any", res.Account) + err = u.encodingConfig.Marshaler.UnpackAny(res.Account, &acc) if err != nil { return nil, fmt.Errorf("failed to unpack account: %w", err) @@ -27,6 +32,7 @@ func (u *Util) Account(addr string) (authtypes.AccountI, error) { // BaseAccount fetches a base account via an address or returns an error if // the account is not a base account func (u *Util) BaseAccount(addr string) (authtypes.BaseAccount, error) { + fmt.Println("Util fetching base account for address:", addr) acc, err := u.Account(addr) if err != nil { return authtypes.BaseAccount{}, err diff --git a/client/grpc/util/util.go b/client/grpc/util/util.go index 0c9c574461..825ba36f23 100644 --- a/client/grpc/util/util.go +++ b/client/grpc/util/util.go @@ -2,6 +2,8 @@ package util import ( "context" + "cosmossdk.io/log" + dbm "github.com/cosmos/cosmos-db" "strconv" grpctypes "github.com/cosmos/cosmos-sdk/types/grpc" @@ -20,9 +22,19 @@ type Util struct { // NewUtil creates a new Util instance func NewUtil(query *query.QueryClient) *Util { + encodingConfig := app.MakeEncodingConfig() + _ = app.NewApp( + log.NewNopLogger(), + dbm.NewMemDB(), + app.DefaultNodeHome, + nil, + encodingConfig, + app.DefaultOptions, + ) + return &Util{ query: query, - encodingConfig: app.MakeEncodingConfig(), + encodingConfig: encodingConfig, } } diff --git a/cmd/kava/cmd/app.go b/cmd/kava/cmd/app.go index 15d707b9bb..6badc08ce3 100644 --- a/cmd/kava/cmd/app.go +++ b/cmd/kava/cmd/app.go @@ -1,22 +1,23 @@ package cmd import ( + storetypes "cosmossdk.io/store/types" "errors" "fmt" + dbm "github.com/cosmos/cosmos-db" + genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" "io" "path/filepath" "strings" - cometbftdb "github.com/cometbft/cometbft-db" - "github.com/cometbft/cometbft/libs/log" - tmtypes "github.com/cometbft/cometbft/types" + "cosmossdk.io/log" + "cosmossdk.io/store" + "cosmossdk.io/store/snapshots" + snapshottypes "cosmossdk.io/store/snapshots/types" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/server" servertypes "github.com/cosmos/cosmos-sdk/server/types" - "github.com/cosmos/cosmos-sdk/snapshots" - snapshottypes "github.com/cosmos/cosmos-sdk/snapshots/types" - "github.com/cosmos/cosmos-sdk/store" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/crisis" ethermintflags "github.com/evmos/ethermint/server/flags" @@ -44,11 +45,11 @@ type appCreator struct { // newApp loads config from AppOptions and returns a new app. func (ac appCreator) newApp( logger log.Logger, - db cometbftdb.DB, + db dbm.DB, traceStore io.Writer, appOpts servertypes.AppOptions, ) servertypes.Application { - var cache sdk.MultiStorePersistentCache + var cache storetypes.MultiStorePersistentCache if cast.ToBool(appOpts.Get(server.FlagInterBlockCache)) { cache = store.NewCommitKVStoreCacheManager() } @@ -96,7 +97,11 @@ func (ac appCreator) newApp( chainID := cast.ToString(appOpts.Get(flags.FlagChainID)) if len(chainID) == 0 { // fallback to genesis chain-id - appGenesis, err := tmtypes.GenesisDocFromFile(filepath.Join(homeDir, "config", "genesis.json")) + //appGenesis, err := tmtypes.GenesisDocFromFile(filepath.Join(homeDir, "config", "genesis.json")) + //if err != nil { + // panic(err) + //} + appGenesis, err := genutiltypes.AppGenesisFromFile(filepath.Join(homeDir, "config", "genesis.json")) if err != nil { panic(err) } @@ -140,7 +145,7 @@ func (ac appCreator) newApp( // appExport writes out an app's state to json. func (ac appCreator) appExport( logger log.Logger, - db cometbftdb.DB, + db dbm.DB, traceStore io.Writer, height int64, forZeroHeight bool, diff --git a/cmd/kava/cmd/assert-invariants.go b/cmd/kava/cmd/assert-invariants.go index de4ef717cb..ad9d1878e5 100644 --- a/cmd/kava/cmd/assert-invariants.go +++ b/cmd/kava/cmd/assert-invariants.go @@ -1,8 +1,10 @@ package cmd import ( + "cosmossdk.io/log" "encoding/json" "fmt" + dbm "github.com/cosmos/cosmos-db" tmtypes "github.com/cometbft/cometbft/types" "github.com/cosmos/cosmos-sdk/version" @@ -32,7 +34,11 @@ func AssertInvariantsCmd(config params.EncodingConfig) *cobra.Command { if err := json.Unmarshal(genDoc.AppState, &newAppState); err != nil { return fmt.Errorf("failed to marshal app state from genesis doc: %s: %w", importGenesis, err) } - err = app.ModuleBasics.ValidateGenesis(config.Marshaler, config.TxConfig, newAppState) + + encodingConfig := app.MakeEncodingConfig() + tempApp := app.NewApp(log.NewNopLogger(), dbm.NewMemDB(), app.DefaultNodeHome, nil, encodingConfig, app.DefaultOptions) + + err = tempApp.BasicModuleManager.ValidateGenesis(config.Marshaler, config.TxConfig, newAppState) if err != nil { return fmt.Errorf("genesis doc did not pass validate genesis: %s: %w", importGenesis, err) } diff --git a/cmd/kava/cmd/genaccounts.go b/cmd/kava/cmd/genaccounts.go index 5a5d157f4e..70234dd117 100644 --- a/cmd/kava/cmd/genaccounts.go +++ b/cmd/kava/cmd/genaccounts.go @@ -112,7 +112,10 @@ contain valid denominations. Accounts may optionally be supplied with vesting pa baseAccount := authtypes.NewBaseAccount(addr, nil, 0, 0) if !vestingAmt.IsZero() { - baseVestingAccount := authvesting.NewBaseVestingAccount(baseAccount, vestingAmt.Sort(), vestingEnd) + baseVestingAccount, err := authvesting.NewBaseVestingAccount(baseAccount, vestingAmt.Sort(), vestingEnd) + if err != nil { + return errors.New("failed to create base vesting account") + } if (balances.Coins.IsZero() && !baseVestingAccount.OriginalVesting.IsZero()) || baseVestingAccount.OriginalVesting.IsAnyGT(balances.Coins) { diff --git a/cmd/kava/cmd/iavlviewer/root.go b/cmd/kava/cmd/iavlviewer/root.go index ea96e01f24..7297d17f93 100644 --- a/cmd/kava/cmd/iavlviewer/root.go +++ b/cmd/kava/cmd/iavlviewer/root.go @@ -9,7 +9,7 @@ import ( dbm "github.com/cosmos/cosmos-db" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/server" - "github.com/cosmos/cosmos-sdk/store/wrapper" + //"github.com/cosmos/cosmos-sdk/store/wrapper" ethermintserver "github.com/evmos/ethermint/server" "github.com/spf13/cobra" @@ -58,7 +58,8 @@ func openPrefixTree(opts ethermintserver.StartOptions, cmd *cobra.Command, prefi } }() - cosmosdb := wrapper.NewCosmosDB(db) + cosmosdb := NewCosmosDB(db) + //cosmosdb := wrapper.NewDBWrapper(db) tree, err := readTree(cosmosdb, version, []byte(prefix)) if err != nil { diff --git a/cmd/kava/cmd/iavlviewer/wrapper.go b/cmd/kava/cmd/iavlviewer/wrapper.go new file mode 100644 index 0000000000..c7fbc0996f --- /dev/null +++ b/cmd/kava/cmd/iavlviewer/wrapper.go @@ -0,0 +1,102 @@ +package iavlviewer + +import ( + tdbm "github.com/cometbft/cometbft-db" + cdbm "github.com/cosmos/cosmos-db" +) + +type CosmosDBWrapper struct { + db cdbm.DB +} + +func NewCosmosDB(db cdbm.DB) cdbm.DB { + return &CosmosDBWrapper{db: db} +} + +func (db *CosmosDBWrapper) Get(key []byte) ([]byte, error) { + return db.db.Get(key) +} + +func (db *CosmosDBWrapper) Has(key []byte) (bool, error) { + return db.db.Has(key) +} + +func (db *CosmosDBWrapper) Set(key []byte, value []byte) error { + return db.db.Set(key, value) +} + +func (db *CosmosDBWrapper) SetSync(key []byte, value []byte) error { + return db.db.SetSync(key, value) +} + +func (db *CosmosDBWrapper) Delete(key []byte) error { + return db.db.Delete(key) +} + +func (db *CosmosDBWrapper) DeleteSync(key []byte) error { + return db.db.DeleteSync(key) +} + +func (db *CosmosDBWrapper) Iterator(start, end []byte) (cdbm.Iterator, error) { + it, err := db.db.Iterator(start, end) + return it.(cdbm.Iterator), err +} + +func (db *CosmosDBWrapper) ReverseIterator(start, end []byte) (cdbm.Iterator, error) { + it, err := db.db.ReverseIterator(start, end) + return it.(cdbm.Iterator), err +} + +func (db *CosmosDBWrapper) NewBatch() cdbm.Batch { + return NewCosmosBatch(db.db.NewBatch()) +} + +// NewBatchWithSize(int) Batch + +func (db *CosmosDBWrapper) NewBatchWithSize(size int) cdbm.Batch { + return NewCosmosBatch(db.db.NewBatch()) +} + +func (db *CosmosDBWrapper) Print() error { + return db.db.Print() +} + +func (db *CosmosDBWrapper) Stats() map[string]string { + return db.db.Stats() +} + +func (db *CosmosDBWrapper) Close() error { + return db.db.Close() +} + +type BatchWrapper struct { + batch tdbm.Batch +} + +func NewCosmosBatch(batch tdbm.Batch) cdbm.Batch { + return &BatchWrapper{batch: batch} +} + +func (b *BatchWrapper) Set(key, value []byte) error { + return b.batch.Set(key, value) +} + +func (b *BatchWrapper) Delete(key []byte) error { + return b.batch.Delete(key) +} + +func (b *BatchWrapper) Write() error { + return b.batch.Write() +} + +func (b *BatchWrapper) WriteSync() error { + return b.batch.WriteSync() +} + +func (b *BatchWrapper) Close() error { + return b.batch.Close() +} + +func (b *BatchWrapper) GetByteSize() (int, error) { + return 0, nil +} diff --git a/cmd/kava/cmd/query.go b/cmd/kava/cmd/query.go index 8bf5cec970..4d6e9ec744 100644 --- a/cmd/kava/cmd/query.go +++ b/cmd/kava/cmd/query.go @@ -21,14 +21,18 @@ func newQueryCmd() *cobra.Command { RunE: client.ValidateCmd, } + // TODO(boodyvo): Add query commands cmd.AddCommand( - authcmd.GetAccountCmd(), + //authcmd.GetAccountCmd(), rpc.ValidatorCommand(), - rpc.BlockCommand(), + //rpc.BlockCommand(), authcmd.QueryTxsByEventsCmd(), authcmd.QueryTxCmd(), ) + //encodingConfig := app.MakeEncodingConfig() + //tempApp := app.NewApp(log.NewNopLogger(), dbm.NewMemDB(), app.DefaultNodeHome, nil, encodingConfig, app.DefaultOptions) + app.ModuleBasics.AddQueryCommands(cmd) cmd.PersistentFlags().String(flags.FlagChainID, "", "The network chain ID") diff --git a/cmd/kava/cmd/rocksdb/compact.go b/cmd/kava/cmd/rocksdb/compact.go index a784ada765..42f76c237d 100644 --- a/cmd/kava/cmd/rocksdb/compact.go +++ b/cmd/kava/cmd/rocksdb/compact.go @@ -14,7 +14,7 @@ import ( "syscall" "time" - "github.com/cometbft/cometbft/libs/log" + "cosmossdk.io/log" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/server" "github.com/linxGnu/grocksdb" diff --git a/cmd/kava/cmd/root.go b/cmd/kava/cmd/root.go index 97b4d05941..e790404ca9 100644 --- a/cmd/kava/cmd/root.go +++ b/cmd/kava/cmd/root.go @@ -1,13 +1,14 @@ package cmd import ( + "cosmossdk.io/log" "fmt" "os" "path/filepath" - dbm "github.com/cometbft/cometbft-db" tmcfg "github.com/cometbft/cometbft/config" tmcli "github.com/cometbft/cometbft/libs/cli" + dbm "github.com/cosmos/cosmos-db" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/config" "github.com/cosmos/cosmos-sdk/client/debug" @@ -40,6 +41,7 @@ func NewRootCmd() *cobra.Command { app.SetSDKConfig().Seal() encodingConfig := app.MakeEncodingConfig() + tempApp := app.NewApp(log.NewNopLogger(), dbm.NewMemDB(), app.DefaultNodeHome, nil, encodingConfig, app.DefaultOptions) initClientCtx := client.Context{}. WithCodec(encodingConfig.Marshaler). @@ -87,6 +89,14 @@ func NewRootCmd() *cobra.Command { addSubCmds(rootCmd, encodingConfig, app.DefaultNodeHome) + // add keyring to autocli opts + autoCliOpts := tempApp.AutoCliOpts() + autoCliOpts.ClientCtx = initClientCtx + + if err := autoCliOpts.EnhanceRootCommand(rootCmd); err != nil { + panic(err) + } + return rootCmd } @@ -99,6 +109,8 @@ func dbOpener(opts servertypes.AppOptions, rootDir string, backend dbm.BackendTy // addSubCmds registers all the sub commands used by kava. func addSubCmds(rootCmd *cobra.Command, encodingConfig params.EncodingConfig, defaultNodeHome string) { + //tempApp := app.NewApp(log.NewNopLogger(), dbm.NewMemDB(), app.DefaultNodeHome, nil, encodingConfig, app.DefaultOptions) + gentxModule, ok := app.ModuleBasics[genutiltypes.ModuleName].(genutil.AppModuleBasic) if !ok { panic(fmt.Errorf("expected %s module to be an instance of type %T", genutiltypes.ModuleName, genutil.AppModuleBasic{})) @@ -109,19 +121,21 @@ func addSubCmds(rootCmd *cobra.Command, encodingConfig params.EncodingConfig, de ethermintclient.ValidateChainID( genutilcli.InitCmd(app.ModuleBasics, defaultNodeHome), ), - genutilcli.CollectGenTxsCmd(banktypes.GenesisBalancesIterator{}, defaultNodeHome, gentxModule.GenTxValidator), + genutilcli.CollectGenTxsCmd(banktypes.GenesisBalancesIterator{}, defaultNodeHome, gentxModule.GenTxValidator, encodingConfig.TxConfig.SigningContext().ValidatorAddressCodec()), AssertInvariantsCmd(encodingConfig), - genutilcli.GenTxCmd(app.ModuleBasics, encodingConfig.TxConfig, banktypes.GenesisBalancesIterator{}, defaultNodeHome), + genutilcli.GenTxCmd(app.ModuleBasics, encodingConfig.TxConfig, banktypes.GenesisBalancesIterator{}, defaultNodeHome, encodingConfig.TxConfig.SigningContext().ValidatorAddressCodec()), genutilcli.ValidateGenesisCmd(app.ModuleBasics), AddGenesisAccountCmd(defaultNodeHome), tmcli.NewCompletionCmd(rootCmd, true), // TODO add other shells, drop tmcli dependency, unhide? // testnetCmd(app.ModuleBasics, banktypes.GenesisBalancesIterator{}), // TODO add debug.Cmd(), - config.Cmd(), + // TODO(boodyvo): was removed, should be added convix + //config.Cmd(), ) + newConf := params.MakeEncodingConfig() ac := appCreator{ - encodingConfig: encodingConfig, + encodingConfig: newConf, } opts := ethermintserver.StartOptions{ diff --git a/cmd/kava/cmd/shard.go b/cmd/kava/cmd/shard.go index 7a44589b09..0200041644 100644 --- a/cmd/kava/cmd/shard.go +++ b/cmd/kava/cmd/shard.go @@ -1,22 +1,20 @@ package cmd import ( + "cosmossdk.io/store/rootmulti" "fmt" + dbm "github.com/cosmos/cosmos-db" "strings" "github.com/kava-labs/kava/app" "github.com/spf13/cobra" - dbm "github.com/cometbft/cometbft-db" - + pruningtypes "cosmossdk.io/store/pruning/types" + cmtcfg "github.com/cometbft/cometbft/config" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/server" - pruningtypes "github.com/cosmos/cosmos-sdk/store/pruning/types" - "github.com/cosmos/cosmos-sdk/store/rootmulti" - tmconfig "github.com/cometbft/cometbft/config" - "github.com/cometbft/cometbft/node" tmstate "github.com/cometbft/cometbft/state" "github.com/cometbft/cometbft/store" @@ -276,40 +274,41 @@ func shardCometBftDbs(blockStore *store.BlockStore, stateStore tmstate.Store, st // Prune blocks to startBlock ////////////////////////////// // get starting block of block store - baseBlock := blockStore.Base() + // TODO(boodyvo): implement for pruning + //baseBlock := blockStore.Base() // only prune if data exists, otherwise blockStore.PruneBlocks will panic - if baseBlock < startBlock { - // prune block store - fmt.Printf("pruning block store from %d - %d\n", baseBlock, startBlock) - if _, err := blockStore.PruneBlocks(startBlock); err != nil { - return fmt.Errorf("failed to prune block store (retainHeight=%d): %s", startBlock, err) - } - - // prune cometbft state - fmt.Printf("pruning cometbft state from %d - %d\n", baseBlock, startBlock) - if err := stateStore.PruneStates(baseBlock, startBlock); err != nil { - return fmt.Errorf("failed to prune cometbft state store (%d - %d): %s", baseBlock, startBlock, err) - } - } else { - fmt.Printf("blockstore and cometbft state begins at block %d\n", baseBlock) - } + //if baseBlock < startBlock { + // // prune block store + // fmt.Printf("pruning block store from %d - %d\n", baseBlock, startBlock) + // if _, _, err := blockStore.PruneBlocks(startBlock); err != nil { + // return fmt.Errorf("failed to prune block store (retainHeight=%d): %s", startBlock, err) + // } + // + // // prune cometbft state + // fmt.Printf("pruning cometbft state from %d - %d\n", baseBlock, startBlock) + // if err := stateStore.PruneStates(baseBlock, startBlock); err != nil { + // return fmt.Errorf("failed to prune cometbft state store (%d - %d): %s", baseBlock, startBlock, err) + // } + //} else { + // fmt.Printf("blockstore and cometbft state begins at block %d\n", baseBlock) + //} return nil } // inspired by https://github.com/Kava-Labs/cometbft/blob/277b0853db3f67865a55aa1c54f59790b5f591be/node/node.go#L234 -func openCometBftDbs(config *tmconfig.Config) (blockStore *store.BlockStore, stateStore tmstate.Store, err error) { - dbProvider := node.DefaultDBProvider +func openCometBftDbs(config *cmtcfg.Config) (blockStore *store.BlockStore, stateStore tmstate.Store, err error) { + dbProvider := cmtcfg.DefaultDBProvider var blockStoreDB dbm.DB - blockStoreDB, err = dbProvider(&node.DBContext{ID: "blockstore", Config: config}) + blockStoreDB, err = dbProvider(&cmtcfg.DBContext{ID: "blockstore", Config: config}) if err != nil { return } blockStore = store.NewBlockStore(blockStoreDB) - stateDB, err := dbProvider(&node.DBContext{ID: "state", Config: config}) + stateDB, err := dbProvider(&cmtcfg.DBContext{ID: "state", Config: config}) if err != nil { return } diff --git a/cmd/kava/cmd/tx.go b/cmd/kava/cmd/tx.go index 25d1c5ac75..973a82a69d 100644 --- a/cmd/kava/cmd/tx.go +++ b/cmd/kava/cmd/tx.go @@ -1,16 +1,27 @@ package cmd import ( + "cosmossdk.io/log" + dbm "github.com/cosmos/cosmos-db" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli" - "github.com/spf13/cobra" - "github.com/kava-labs/kava/app" + "github.com/spf13/cobra" ) // newTxCmd creates all commands for submitting blockchain transactions. func newTxCmd() *cobra.Command { + //_, testAddresses := app.GeneratePrivKeyAddressPairs(10) + //manual := testAddresses[6:] + //opts := app.DefaultOptions + //opts.MempoolEnableAuth = true + //opts.MempoolAuthAddresses = manual + // + + encodingConfig := app.MakeEncodingConfig() + tempApp := app.NewApp(log.NewNopLogger(), dbm.NewMemDB(), app.DefaultNodeHome, nil, encodingConfig, app.DefaultOptions) + cmd := &cobra.Command{ Use: "tx", Short: "Transactions subcommands", @@ -30,7 +41,9 @@ func newTxCmd() *cobra.Command { authcmd.GetDecodeCommand(), ) - app.ModuleBasics.AddTxCommands(cmd) + tempApp.BasicModuleManager.AddTxCommands(cmd) + + //app.ModuleBasics.AddTxCommands(cmd) cmd.PersistentFlags().String(flags.FlagChainID, "", "The network chain ID") return cmd diff --git a/cmd/kava/main.go b/cmd/kava/main.go index 155b5a4228..503770848f 100644 --- a/cmd/kava/main.go +++ b/cmd/kava/main.go @@ -1,9 +1,9 @@ package main import ( + "fmt" "os" - "github.com/cosmos/cosmos-sdk/server" svrcmd "github.com/cosmos/cosmos-sdk/server/cmd" "github.com/kava-labs/kava/app" @@ -13,13 +13,19 @@ import ( func main() { rootCmd := cmd.NewRootCmd() - if err := svrcmd.Execute(rootCmd, cmd.EnvPrefix, app.DefaultNodeHome); err != nil { - switch e := err.(type) { - case server.ErrorCode: - os.Exit(e.Code) + //if err := autoCliOpts.EnhanceRootCommand(rootCmd); err != nil { + // panic(err) + //} - default: - os.Exit(1) - } + if err := svrcmd.Execute(rootCmd, cmd.EnvPrefix, app.DefaultNodeHome); err != nil { + fmt.Println("error for main: ", err) + os.Exit(1) + //switch e := err.(type) { + ////case server.ErrorCode: + //// os.Exit(e.Code) + // + //default: + // os.Exit(1) + //} } } diff --git a/docs/core/proto-docs.md b/docs/core/proto-docs.md index da9147e5e8..2d930123c8 100644 --- a/docs/core/proto-docs.md +++ b/docs/core/proto-docs.md @@ -1827,7 +1827,7 @@ QueryCdpsRequest is the params for a filtered CDP query, the request type for th | `collateral_type` | [string](#string) | | | | `owner` | [string](#string) | | | | `id` | [uint64](#uint64) | | | -| `ratio` | [string](#string) | | sdk.Dec as a string | +| `ratio` | [string](#string) | | sdkmath.LegacyDec as a string | | `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | | @@ -4480,7 +4480,7 @@ BorrowInterestFactorResponse defines an individual borrow interest factor. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | `denom` | [string](#string) | | | -| `value` | [string](#string) | | sdk.Dec as string | +| `value` | [string](#string) | | sdkmath.LegacyDec as string | @@ -4530,8 +4530,8 @@ InterestFactor is a unique type returned by interest factor queries | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | `denom` | [string](#string) | | | -| `borrow_interest_factor` | [string](#string) | | sdk.Dec as String | -| `supply_interest_factor` | [string](#string) | | sdk.Dec as String | +| `borrow_interest_factor` | [string](#string) | | sdkmath.LegacyDec as String | +| `supply_interest_factor` | [string](#string) | | sdkmath.LegacyDec as String | @@ -4547,8 +4547,8 @@ MoneyMarketInterestRate is a unique type returned by interest rate queries | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | `denom` | [string](#string) | | | -| `supply_interest_rate` | [string](#string) | | sdk.Dec as String | -| `borrow_interest_rate` | [string](#string) | | sdk.Dec as String | +| `supply_interest_rate` | [string](#string) | | sdkmath.LegacyDec as String | +| `borrow_interest_rate` | [string](#string) | | sdkmath.LegacyDec as String | @@ -4896,7 +4896,7 @@ SupplyInterestFactorResponse defines an individual borrow interest factor. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | `denom` | [string](#string) | | | -| `value` | [string](#string) | | sdk.Dec as string | +| `value` | [string](#string) | | sdkmath.LegacyDec as string | diff --git a/go.mod b/go.mod index a5cdd699e8..1e29c83744 100644 --- a/go.mod +++ b/go.mod @@ -1,187 +1,211 @@ module github.com/kava-labs/kava -go 1.21 +go 1.21.0 + +toolchain go1.21.9 require ( + cosmossdk.io/api v0.7.5 // indirect + cosmossdk.io/core v0.11.1 cosmossdk.io/errors v1.0.1 - cosmossdk.io/log v1.3.1 + cosmossdk.io/log v1.4.1 cosmossdk.io/math v1.3.0 cosmossdk.io/simapp v0.0.0-20231127212628-044ff4d8c015 - github.com/Kava-Labs/opendb v0.0.0-20240719173129-a2f11f6d7e51 - github.com/cenkalti/backoff/v4 v4.1.3 - github.com/cometbft/cometbft v0.37.9 - github.com/cometbft/cometbft-db v0.9.1 + cosmossdk.io/store v1.1.1 + cosmossdk.io/x/evidence v0.1.1 + cosmossdk.io/x/tx v0.13.5 + //github.com/Kava-Labs/opendb v0.0.0-20241024062216-dd5bc73e28f2 + github.com/Kava-Labs/opendb v0.0.0-20241024062216-dd5bc73e28f2 + github.com/cenkalti/backoff/v4 v4.3.0 + github.com/cometbft/cometbft v1.0.0-rc1.0.20240908111210-ab0be101882f + github.com/cometbft/cometbft-db v0.11.0 github.com/cosmos/cosmos-db v1.0.2 github.com/cosmos/cosmos-proto v1.0.0-beta.5 - github.com/cosmos/cosmos-sdk v0.47.10 + github.com/cosmos/cosmos-sdk v0.50.10 + github.com/cosmos/cosmos-sdk/x/upgrade v0.1.4 github.com/cosmos/go-bip39 v1.0.0 - github.com/cosmos/gogoproto v1.4.10 + github.com/cosmos/gogoproto v1.7.0 github.com/cosmos/iavl v1.2.0 - github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7 v7.1.3 - github.com/cosmos/ibc-go/v7 v7.4.0 + github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8 v8.0.2 + github.com/cosmos/ibc-go/modules/capability v1.0.1 + github.com/cosmos/ibc-go/v8 v8.5.1 github.com/ethereum/go-ethereum v1.10.26 - github.com/evmos/ethermint v0.21.0 + github.com/evmos/ethermint v0.0.0-00010101000000-000000000000 github.com/go-kit/kit v0.13.0 github.com/gogo/protobuf v1.3.2 github.com/golang/protobuf v1.5.4 - github.com/gorilla/mux v1.8.0 + github.com/gorilla/mux v1.8.1 github.com/grpc-ecosystem/grpc-gateway v1.16.0 - github.com/linxGnu/grocksdb v1.8.13 - github.com/pelletier/go-toml/v2 v2.1.0 - github.com/prometheus/client_golang v1.14.0 - github.com/spf13/cast v1.6.0 - github.com/spf13/cobra v1.8.0 - github.com/spf13/viper v1.18.2 + github.com/linxGnu/grocksdb v1.9.3 + github.com/pelletier/go-toml/v2 v2.2.3 + github.com/prometheus/client_golang v1.20.4 + github.com/spf13/cast v1.7.0 + github.com/spf13/cobra v1.8.1 + github.com/spf13/viper v1.19.0 github.com/stretchr/testify v1.9.0 github.com/subosito/gotenv v1.6.0 - golang.org/x/crypto v0.22.0 - golang.org/x/exp v0.0.0-20230905200255-921286631fa9 - google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de - google.golang.org/grpc v1.63.2 - google.golang.org/protobuf v1.33.0 + golang.org/x/crypto v0.28.0 + golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 + google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 + google.golang.org/grpc v1.67.1 + google.golang.org/protobuf v1.35.1 sigs.k8s.io/yaml v1.4.0 ) require ( - cloud.google.com/go v0.112.0 // indirect - cloud.google.com/go/compute v1.24.0 // indirect - cloud.google.com/go/compute/metadata v0.2.3 // indirect - cloud.google.com/go/iam v1.1.6 // indirect - cloud.google.com/go/storage v1.36.0 // indirect - cosmossdk.io/api v0.3.1 // indirect - cosmossdk.io/core v0.6.1 // indirect - cosmossdk.io/depinject v1.0.0-alpha.4 // indirect - cosmossdk.io/tools/rosetta v0.2.1 // indirect - filippo.io/edwards25519 v1.0.0 // indirect + cosmossdk.io/client/v2 v2.0.0-beta.3 + cosmossdk.io/x/upgrade v0.1.4 +) + +require ( + cloud.google.com/go v0.115.1 // indirect + cloud.google.com/go/auth v0.8.1 // indirect + cloud.google.com/go/auth/oauth2adapt v0.2.3 // indirect + cloud.google.com/go/compute/metadata v0.5.0 // indirect + cloud.google.com/go/iam v1.1.13 // indirect + cloud.google.com/go/storage v1.43.0 // indirect + cosmossdk.io/collections v0.4.0 // indirect + cosmossdk.io/depinject v1.0.0 // indirect + cosmossdk.io/x/feegrant v0.1.1 // indirect + filippo.io/edwards25519 v1.1.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect - github.com/99designs/keyring v1.2.1 // indirect - github.com/ChainSafe/go-schnorrkel v1.0.0 // indirect + github.com/99designs/keyring v1.2.2 // indirect + github.com/DataDog/datadog-go v3.2.0+incompatible // indirect github.com/DataDog/zstd v1.5.5 // indirect + github.com/PuerkitoBio/purell v1.1.1 // indirect + github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect github.com/StackExchange/wmi v1.2.1 // indirect - github.com/VictoriaMetrics/fastcache v1.6.0 // indirect + github.com/VictoriaMetrics/fastcache v1.12.1 // indirect github.com/allegro/bigcache v1.2.1 // indirect - github.com/armon/go-metrics v0.4.1 // indirect - github.com/aws/aws-sdk-go v1.44.203 // indirect + github.com/aws/aws-sdk-go v1.55.5 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect - github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect - github.com/btcsuite/btcd v0.24.0 // indirect - github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect - github.com/btcsuite/btcd/btcutil v1.1.5 // indirect + github.com/bgentry/speakeasy v0.2.0 // indirect + github.com/bits-and-blooms/bitset v1.8.0 // indirect + github.com/btcsuite/btcd v0.24.2 // indirect + github.com/btcsuite/btcd/btcec/v2 v2.3.4 // indirect + github.com/btcsuite/btcd/btcutil v1.1.6 // indirect github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 // indirect github.com/cespare/xxhash v1.1.0 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/chzyer/readline v1.5.1 // indirect github.com/cockroachdb/apd/v2 v2.0.2 // indirect - github.com/cockroachdb/errors v1.11.1 // indirect + github.com/cockroachdb/errors v1.11.3 // indirect + github.com/cockroachdb/fifo v0.0.0-20240606204812-0bbfbd93a7ce // indirect github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect - github.com/cockroachdb/pebble v1.1.0 // indirect + github.com/cockroachdb/pebble v1.1.1 // indirect github.com/cockroachdb/redact v1.1.5 // indirect github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect - github.com/coinbase/rosetta-sdk-go v0.7.9 // indirect - github.com/confio/ics23/go v0.9.0 // indirect + github.com/coinbase/rosetta-sdk-go/types v1.0.0 // indirect github.com/cosmos/btcutil v1.0.5 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect - github.com/cosmos/ics23/go v0.10.0 // indirect + github.com/cosmos/ics23/go v0.11.0 // indirect github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect + github.com/cosmos/rosetta v0.50.6 // indirect github.com/cosmos/rosetta-sdk-go v0.10.0 // indirect - github.com/creachadair/taskgroup v0.4.2 // indirect - github.com/danieljoos/wincred v1.1.2 // indirect + github.com/danieljoos/wincred v1.2.1 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/deckarep/golang-set v1.8.0 // indirect - github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect + github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect github.com/dgraph-io/badger/v2 v2.2007.4 // indirect - github.com/dgraph-io/ristretto v0.1.1 // indirect + github.com/dgraph-io/ristretto v0.1.2-0.20240116140435-c67e07994f91 // indirect github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect - github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91 // indirect - github.com/dop251/goja v0.0.0-20220405120441-9037c2b61cbf // indirect + github.com/dlclark/regexp2 v1.7.0 // indirect + github.com/dop251/goja v0.0.0-20230806174421-c933cf95e127 // indirect github.com/dustin/go-humanize v1.0.1 // indirect github.com/dvsekhvalnov/jose2go v1.6.0 // indirect github.com/edsrzf/mmap-go v1.0.0 // indirect github.com/emicklei/dot v1.6.1 // indirect + github.com/fatih/color v1.16.0 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff // indirect github.com/getsentry/sentry-go v0.27.0 // indirect github.com/go-kit/log v0.2.1 // indirect github.com/go-logfmt/logfmt v0.6.0 // indirect - github.com/go-logr/logr v1.4.1 // indirect + github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-ole/go-ole v1.2.6 // indirect github.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirect github.com/go-stack/stack v1.8.1 // indirect github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect github.com/gogo/googleapis v1.4.1 // indirect - github.com/golang/glog v1.2.0 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/mock v1.6.0 // indirect - github.com/golang/snappy v0.0.4 // indirect - github.com/google/btree v1.1.2 // indirect + github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect + github.com/google/btree v1.1.3 // indirect github.com/google/go-cmp v0.6.0 // indirect github.com/google/orderedcode v0.0.1 // indirect - github.com/google/s2a-go v0.1.7 // indirect + github.com/google/pprof v0.0.0-20230228050547-1710fef4ab10 // indirect + github.com/google/s2a-go v0.1.8 // indirect github.com/google/uuid v1.6.0 // indirect github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect - github.com/googleapis/gax-go/v2 v2.12.0 // indirect - github.com/gorilla/handlers v1.5.1 // indirect - github.com/gorilla/websocket v1.5.0 // indirect - github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect + github.com/googleapis/gax-go/v2 v2.13.0 // indirect + github.com/gorilla/handlers v1.5.2 // indirect + github.com/gorilla/websocket v1.5.3 // indirect + github.com/goware/urlx v0.3.2 // indirect + github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect - github.com/gtank/merlin v0.1.1 // indirect - github.com/gtank/ristretto255 v0.1.2 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect - github.com/hashicorp/go-getter v1.7.5 // indirect + github.com/hashicorp/go-getter v1.7.6 // indirect + github.com/hashicorp/go-hclog v1.5.0 // indirect github.com/hashicorp/go-immutable-radix v1.3.1 // indirect + github.com/hashicorp/go-metrics v0.5.3 // indirect + github.com/hashicorp/go-plugin v1.6.0 // indirect github.com/hashicorp/go-safetemp v1.0.0 // indirect - github.com/hashicorp/go-version v1.6.0 // indirect + github.com/hashicorp/go-version v1.7.0 // indirect github.com/hashicorp/golang-lru v1.0.2 // indirect github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect github.com/hashicorp/hcl v1.0.0 // indirect - github.com/hdevalence/ed25519consensus v0.1.0 // indirect + github.com/hashicorp/yamux v0.1.1 // indirect + github.com/hdevalence/ed25519consensus v0.2.0 // indirect github.com/holiman/bloomfilter/v2 v2.0.3 // indirect - github.com/holiman/uint256 v1.2.1 // indirect - github.com/huandu/skiplist v1.2.0 // indirect - github.com/huin/goupnp v1.0.3 // indirect - github.com/iancoleman/orderedmap v0.2.0 // indirect + github.com/holiman/uint256 v1.2.4 // indirect + github.com/huandu/skiplist v1.2.1 // indirect + github.com/huin/goupnp v1.3.0 // indirect + github.com/iancoleman/orderedmap v0.3.0 // indirect + github.com/iancoleman/strcase v0.3.0 // indirect github.com/improbable-eng/grpc-web v0.15.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/jackpal/go-nat-pmp v1.0.2 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/jmhodges/levigo v1.0.0 // indirect - github.com/klauspost/compress v1.17.7 // indirect + github.com/klauspost/compress v1.17.9 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect - github.com/lib/pq v1.10.7 // indirect + github.com/lib/pq v1.10.9 // indirect github.com/magiconair/properties v1.8.7 // indirect github.com/manifoldco/promptui v0.9.0 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect - github.com/mattn/go-runewidth v0.0.9 // indirect - github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect - github.com/mimoo/StrobeGo v0.0.0-20210601165009-122bf33a46e0 // indirect - github.com/minio/highwayhash v1.0.2 // indirect + github.com/mattn/go-runewidth v0.0.14 // indirect + github.com/minio/highwayhash v1.0.3 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/mitchellh/go-testing-interface v1.14.1 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/mtibben/percent v0.2.1 // indirect + github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect + github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a // indirect + github.com/oklog/run v1.1.0 // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect - github.com/petermattis/goid v0.0.0-20231207134359-e60b3f734c67 // indirect + github.com/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_model v0.6.1 // indirect - github.com/prometheus/common v0.42.0 // indirect - github.com/prometheus/procfs v0.13.0 // indirect + github.com/prometheus/common v0.60.0 // indirect + github.com/prometheus/procfs v0.15.1 // indirect github.com/prometheus/tsdb v0.7.1 // indirect github.com/rakyll/statik v0.1.7 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect + github.com/rivo/uniseg v0.2.0 // indirect github.com/rjeczalik/notify v0.9.1 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect - github.com/rs/cors v1.8.3 // indirect - github.com/rs/zerolog v1.32.0 // indirect + github.com/rs/cors v1.11.1 // indirect + github.com/rs/zerolog v1.33.0 // indirect github.com/sagikazarmark/locafero v0.4.0 // indirect github.com/sagikazarmark/slog-shim v0.1.0 // indirect - github.com/sasha-s/go-deadlock v0.3.1 // indirect + github.com/sasha-s/go-deadlock v0.3.5 // indirect github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect github.com/sourcegraph/conc v0.3.0 // indirect github.com/spf13/afero v1.11.0 // indirect @@ -191,60 +215,79 @@ require ( github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect github.com/tendermint/go-amino v0.16.0 // indirect github.com/tidwall/btree v1.7.0 // indirect - github.com/tklauser/go-sysconf v0.3.10 // indirect - github.com/tklauser/numcpus v0.4.0 // indirect + github.com/tklauser/go-sysconf v0.3.12 // indirect + github.com/tklauser/numcpus v0.6.1 // indirect github.com/tyler-smith/go-bip39 v1.1.0 // indirect - github.com/ulikunitz/xz v0.5.11 // indirect + github.com/ulikunitz/xz v0.5.12 // indirect github.com/zondax/hid v0.9.2 // indirect github.com/zondax/ledger-go v0.14.3 // indirect - go.etcd.io/bbolt v1.3.8 // indirect + go.etcd.io/bbolt v1.3.10 // indirect go.opencensus.io v0.24.0 // indirect - go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.47.0 // indirect - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0 // indirect - go.opentelemetry.io/otel v1.22.0 // indirect - go.opentelemetry.io/otel/metric v1.22.0 // indirect - go.opentelemetry.io/otel/trace v1.22.0 // indirect - go.uber.org/atomic v1.10.0 // indirect - go.uber.org/multierr v1.9.0 // indirect - golang.org/x/net v0.24.0 // indirect - golang.org/x/oauth2 v0.17.0 // indirect - golang.org/x/sync v0.7.0 // indirect - golang.org/x/sys v0.19.0 // indirect - golang.org/x/term v0.19.0 // indirect - golang.org/x/text v0.14.0 // indirect - golang.org/x/time v0.5.0 // indirect - google.golang.org/api v0.162.0 // indirect - google.golang.org/appengine v1.6.8 // indirect - google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240401170217-c3f982113cda // indirect + go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0 // indirect + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 // indirect + go.opentelemetry.io/otel v1.28.0 // indirect + go.opentelemetry.io/otel/metric v1.28.0 // indirect + go.opentelemetry.io/otel/trace v1.28.0 // indirect + go.uber.org/multierr v1.11.0 // indirect + golang.org/x/net v0.29.0 // indirect + golang.org/x/oauth2 v0.23.0 // indirect + golang.org/x/sync v0.8.0 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/term v0.25.0 // indirect + golang.org/x/text v0.19.0 // indirect + golang.org/x/time v0.6.0 // indirect + google.golang.org/api v0.192.0 // indirect + google.golang.org/genproto v0.0.0-20240814211410-ddb44dafa142 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - nhooyr.io/websocket v1.8.6 // indirect + gotest.tools/v3 v3.5.1 // indirect + nhooyr.io/websocket v1.8.10 // indirect pgregory.net/rapid v1.1.0 // indirect ) replace ( + // need to fix the comet.BlockInfo error, new changed to Info + //cosmossdk.io/core/comet => cosmossdk.io/core/comet v0.11.0 // Use the cosmos keyring code github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0 // Use cometbft fork of tendermint - github.com/cometbft/cometbft => github.com/kava-labs/cometbft v0.37.9-kava.1 - github.com/cometbft/cometbft-db => github.com/kava-labs/cometbft-db v0.9.1-kava.2 + //github.com/cometbft/cometbft => github.com/kava-labs/cometbft cometbft-patch-test // 8345af773eb9d2fe95656815662f28b0f3b64b46 + //github.com/cometbft/cometbft => github.com/kava-labs/cometbft v0.0.0-20241007151334-8345af773eb9 + github.com/cometbft/cometbft => github.com/kava-labs/cometbft v0.0.0-20241024200036-527d8df9ff12 + //github.com/cometbft/cometbft-db => github.com/kava-labs/cometbft-db kava-patched-test b2740b2e4bed1112feb4157b154ce969759b52ce + github.com/cometbft/cometbft-db => github.com/kava-labs/cometbft-db v0.0.0-20241007145430-b2740b2e4bed // Use cosmos-sdk fork with backported fix for unsafe-reset-all, staking transfer events, and custom tally handler support - github.com/cosmos/cosmos-sdk => github.com/kava-labs/cosmos-sdk v0.47.10-iavl-v1-kava.1 + //github.com/cosmos/cosmos-sdk => github.com/kava-labs/cosmos-sdk v0.47.10-iavl-v1-kava.1 + //github.com/cosmos/cosmos-sdk => github.com/kava-labs/cosmos-sdk v0.50.10-test-patch 5f9239e3147358ef034bfc4d19aacb34e5ea2064 + github.com/cosmos/cosmos-sdk => github.com/kava-labs/cosmos-sdk v0.0.0-20241113023842-ac2790809d16 + //github.com/cosmos/cosmos-sdk => ../cosmos-sdk + + //github.com/cosmos/cosmos-sdk/store => cosmossdk.io/store v1.1.1 + github.com/cosmos/cosmos-sdk/x/evidence => cosmossdk.io/x/evidence v0.1.1 + github.com/cosmos/cosmos-sdk/x/feegrant => cosmossdk.io/x/feegrant v0.1.1 + github.com/cosmos/cosmos-sdk/x/nft => cosmossdk.io/x/nft v0.1.1 + github.com/cosmos/cosmos-sdk/x/upgrade => github.com/Kava-Labs/cosmos-sdk/x/upgrade v0.0.0-20241024201445-a8e1a4abf85b + //cosmossdk.io/x/upgrade => github.com/Kava-Labs/cosmos-sdk/x/upgrade v0.0.0-20241024201445-a8e1a4abf85b // See https://github.com/cosmos/cosmos-sdk/pull/13093 github.com/dgrijalva/jwt-go => github.com/golang-jwt/jwt/v4 v4.4.2 // Tracking kava-labs/go-ethereum kava/release/v1.10 branch // TODO: Tag before release github.com/ethereum/go-ethereum => github.com/Kava-Labs/go-ethereum v1.10.27-0.20240513233504-6e038346780b + // We can also to use wrap over EVM instead of changing this + //github.com/ethereum/go-ethereum => github.com/Kava-Labs/go-ethereum v0.0.0-20241015215028-50a0b049fdc5 // Use ethermint fork that respects min-gas-price with NoBaseFee true and london enabled, and includes eip712 support // Tracking kava-labs/etheremint master branch // TODO: Tag before release - github.com/evmos/ethermint => github.com/kava-labs/ethermint v0.21.1-0.20240802224012-586960857184 + //github.com/evmos/ethermint => github.com/kava-labs/ethermint v0.21.1-0.20240802224012-586960857184 + github.com/evmos/ethermint => github.com/kava-labs/ethermint v0.0.0-20241112214305-986ef503477d + //github.com/evmos/ethermint => ../ethermint // See https://github.com/cosmos/cosmos-sdk/pull/10401, https://github.com/cosmos/cosmos-sdk/commit/0592ba6158cd0bf49d894be1cef4faeec59e8320 github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.9.0 // Downgraded to avoid bugs in following commits which causes "version does not exist" errors github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 - // Avoid change in slices.SortFunc, see https://github.com/cosmos/cosmos-sdk/issues/20159 - golang.org/x/exp => golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb +// Avoid change in slices.SortFunc, see https://github.com/cosmos/cosmos-sdk/issues/20159 +// Was fixed +//golang.org/x/exp => golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb ) diff --git a/go.sum b/go.sum index 7934ead58c..bb5df0723f 100644 --- a/go.sum +++ b/go.sum @@ -1,13 +1,11 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= -cloud.google.com/go v0.43.0/go.mod h1:BOSR3VbTLkk6FDC/TcffxP4NF/FFBGA5ku+jvKOP7pg= cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= -cloud.google.com/go v0.51.0/go.mod h1:hWtGJ6gnXH+KgDv+V0zFGDvpi07n3z8ZNj3T1RW0Gcw= cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= @@ -32,8 +30,8 @@ cloud.google.com/go v0.100.2/go.mod h1:4Xra9TjzAeYHrl5+oeLlzbM2k3mjVhZh4UqTZ//w9 cloud.google.com/go v0.102.0/go.mod h1:oWcCzKlqJ5zgHQt9YsaeTY9KzIvjyy0ArmiBUgpQ+nc= cloud.google.com/go v0.102.1/go.mod h1:XZ77E9qnTEnrgEOvr4xzfdX5TRo7fB4T2F4O6+34hIU= cloud.google.com/go v0.104.0/go.mod h1:OO6xxXdJyvuJPcEPBLN9BJPD+jep5G1+2U5B5gkRYtA= -cloud.google.com/go v0.112.0 h1:tpFCD7hpHFlQ8yPwT3x+QeXqc2T6+n6T+hmABHfDUSM= -cloud.google.com/go v0.112.0/go.mod h1:3jEEVwZ/MHU4djK5t5RHuKOA/GbLddgTdVubX1qnPD4= +cloud.google.com/go v0.115.1 h1:Jo0SM9cQnSkYfp44+v+NQXHpcHqlnRJk2qxh6yvxxxQ= +cloud.google.com/go v0.115.1/go.mod h1:DuujITeaufu3gL68/lOFIirVNJwQeyf5UXyi+Wbgknc= cloud.google.com/go/aiplatform v1.22.0/go.mod h1:ig5Nct50bZlzV6NvKaTwmplLLddFx0YReh9WfTO5jKw= cloud.google.com/go/aiplatform v1.24.0/go.mod h1:67UUvRBKG6GTayHKV8DBv2RtR1t93YRu5B1P3x99mYY= cloud.google.com/go/analytics v0.11.0/go.mod h1:DjEWCu41bVbYcKyvlws9Er60YE4a//bK6mnhWvQeFNI= @@ -48,6 +46,10 @@ cloud.google.com/go/asset v1.8.0/go.mod h1:mUNGKhiqIdbr8X7KNayoYvyc4HbbFO9URsjby cloud.google.com/go/assuredworkloads v1.5.0/go.mod h1:n8HOZ6pff6re5KYfBXcFvSViQjDwxFkAkmUFffJRbbY= cloud.google.com/go/assuredworkloads v1.6.0/go.mod h1:yo2YOk37Yc89Rsd5QMVECvjaMKymF9OP+QXWlKXUkXw= cloud.google.com/go/assuredworkloads v1.7.0/go.mod h1:z/736/oNmtGAyU47reJgGN+KVoYoxeLBoj4XkKYscNI= +cloud.google.com/go/auth v0.8.1 h1:QZW9FjC5lZzN864p13YxvAtGUlQ+KgRL+8Sg45Z6vxo= +cloud.google.com/go/auth v0.8.1/go.mod h1:qGVp/Y3kDRSDZ5gFD/XPUfYQ9xW1iI7q8RIRoCyBbJc= +cloud.google.com/go/auth/oauth2adapt v0.2.3 h1:MlxF+Pd3OmSudg/b1yZ5lJwoXCEaeedAguodky1PcKI= +cloud.google.com/go/auth/oauth2adapt v0.2.3/go.mod h1:tMQXOfZzFuNuUxOypHlQEXgdfX5cuhwU+ffUuXRJE8I= cloud.google.com/go/automl v1.5.0/go.mod h1:34EjfoFGMZ5sgJ9EoLsRtdPSNZLcfflJR39VbVNS2M0= cloud.google.com/go/automl v1.6.0/go.mod h1:ugf8a6Fx+zP0D59WLhqgTDsQI9w07o64uf/Is3Nh5p8= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= @@ -57,7 +59,6 @@ cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUM cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= cloud.google.com/go/bigquery v1.42.0/go.mod h1:8dRTJxhtG+vwBKzE5OseQn/hiydoQN3EedCaOdYmxRA= -cloud.google.com/go/bigtable v1.2.0/go.mod h1:JcVAOl45lrTmQfLj7T6TxyMzIN/3FGGcFm+2xVAli2o= cloud.google.com/go/billing v1.4.0/go.mod h1:g9IdKBEFlItS8bTtlrZdVLWSSdSyFUZKXNS02zKMOZY= cloud.google.com/go/billing v1.5.0/go.mod h1:mztb1tBc3QekhjSgmpf/CV4LzWXLzCArwpLmP2Gm88s= cloud.google.com/go/binaryauthorization v1.1.0/go.mod h1:xwnoWu3Y84jbuHa0zd526MJYmtnVXn0syOjaJgy4+dM= @@ -71,10 +72,8 @@ cloud.google.com/go/compute v1.6.0/go.mod h1:T29tfhtVbq1wvAPo0E3+7vhgmkOYeXjhFvz cloud.google.com/go/compute v1.6.1/go.mod h1:g85FgpzFvNULZ+S8AYq87axRKuf2Kh7deLqV/jJ3thU= cloud.google.com/go/compute v1.7.0/go.mod h1:435lt8av5oL9P3fv1OEzSbSUe+ybHXGMPQHHZWZxy9U= cloud.google.com/go/compute v1.10.0/go.mod h1:ER5CLbMxl90o2jtNbGSbtfOpQKR0t15FOtRsugnLrlU= -cloud.google.com/go/compute v1.24.0 h1:phWcR2eWzRJaL/kOiJwfFsPs4BaKq1j6vnpZrc1YlVg= -cloud.google.com/go/compute v1.24.0/go.mod h1:kw1/T+h/+tK2LJK0wiPPx1intgdAM3j/g3hFDlscY40= -cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY= -cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= +cloud.google.com/go/compute/metadata v0.5.0 h1:Zr0eK8JbFv6+Wi4ilXAR8FJ3wyNdpxHKJNPos6LTZOY= +cloud.google.com/go/compute/metadata v0.5.0/go.mod h1:aHnloV2TPI38yx4s9+wAZhHykWvVCfu7hQbF+9CWoiY= cloud.google.com/go/containeranalysis v0.5.1/go.mod h1:1D92jd8gRR/c0fGMlymRgxWD3Qw9C1ff6/T7mLgVL8I= cloud.google.com/go/containeranalysis v0.6.0/go.mod h1:HEJoiEIu+lEXM+k7+qLCci0h33lX3ZqoYFdmPcoO7s4= cloud.google.com/go/datacatalog v1.3.0/go.mod h1:g9svFY6tuR+j+hrTw3J2dNcmI0dzmSiyOzm8kpLq0a0= @@ -112,12 +111,14 @@ cloud.google.com/go/gkehub v0.10.0/go.mod h1:UIPwxI0DsrpsVoWpLB0stwKCP+WFVG9+y97 cloud.google.com/go/grafeas v0.2.0/go.mod h1:KhxgtF2hb0P191HlY5besjYm6MqTSTj3LSI+M+ByZHc= cloud.google.com/go/iam v0.3.0/go.mod h1:XzJPvDayI+9zsASAFO68Hk07u3z+f+JrT2xXNdp4bnY= cloud.google.com/go/iam v0.5.0/go.mod h1:wPU9Vt0P4UmCux7mqtRu6jcpPAb74cP1fh50J3QpkUc= -cloud.google.com/go/iam v1.1.6 h1:bEa06k05IO4f4uJonbB5iAgKTPpABy1ayxaIZV/GHVc= -cloud.google.com/go/iam v1.1.6/go.mod h1:O0zxdPeGBoFdWW3HWmBxJsk0pfvNM/p/qa82rWOGTwI= +cloud.google.com/go/iam v1.1.13 h1:7zWBXG9ERbMLrzQBRhFliAV+kjcRToDTgQT3CTwYyv4= +cloud.google.com/go/iam v1.1.13/go.mod h1:K8mY0uSXwEXS30KrnVb+j54LB/ntfZu1dr+4zFMNbus= cloud.google.com/go/language v1.4.0/go.mod h1:F9dRpNFQmJbkaop6g0JhSBXCNlO90e1KWx5iDdxbWic= cloud.google.com/go/language v1.6.0/go.mod h1:6dJ8t3B+lUYfStgls25GusK04NLh3eDLQnWM3mdEbhI= cloud.google.com/go/lifesciences v0.5.0/go.mod h1:3oIKy8ycWGPUyZDR/8RNnTOYevhaMLqh5vLUXs9zvT8= cloud.google.com/go/lifesciences v0.6.0/go.mod h1:ddj6tSX/7BOnhxCSd3ZcETvtNr8NZ6t/iPhY2Tyfu08= +cloud.google.com/go/longrunning v0.5.11 h1:Havn1kGjz3whCfoD8dxMLP73Ph5w+ODyZB9RUsDxtGk= +cloud.google.com/go/longrunning v0.5.11/go.mod h1:rDn7//lmlfWV1Dx6IB4RatCPenTwwmqXuiP0/RgoEO4= cloud.google.com/go/mediatranslation v0.5.0/go.mod h1:jGPUhGTybqsPQn91pNXw0xVHfuJ3leR1wj37oU3y1f4= cloud.google.com/go/mediatranslation v0.6.0/go.mod h1:hHdBCTYNigsBxshbznuIMFNe5QXEowAuNmmC7h8pu5w= cloud.google.com/go/memcache v1.4.0/go.mod h1:rTOfiGZtJX1AaFUrOgsMHX5kAzaTQ8azHiuDoTPzNsE= @@ -174,8 +175,8 @@ cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9 cloud.google.com/go/storage v1.22.1/go.mod h1:S8N1cAStu7BOeFfE8KAQzmyyLkK8p/vmRq6kuBTW58Y= cloud.google.com/go/storage v1.23.0/go.mod h1:vOEEDNFnciUMhBeT6hsJIn3ieU5cFRmzeLgDvXzfIXc= cloud.google.com/go/storage v1.27.0/go.mod h1:x9DOL8TK/ygDUMieqwfhdpQryTeEkhGKMi80i/iqR2s= -cloud.google.com/go/storage v1.36.0 h1:P0mOkAcaJxhCTvAkMhxMfrTKiNcub4YmmPBtlhAyTr8= -cloud.google.com/go/storage v1.36.0/go.mod h1:M6M/3V/D3KpzMTJyPOR/HU6n2Si5QdaXYEsng2xgOs8= +cloud.google.com/go/storage v1.43.0 h1:CcxnSohZwizt4LCzQHWvBf1/kvtHUn7gk9QERXPyXFs= +cloud.google.com/go/storage v1.43.0/go.mod h1:ajvxEa7WmZS1PxvKRq4bq0tFT3vMd502JwstCcYv0Q0= cloud.google.com/go/talent v1.1.0/go.mod h1:Vl4pt9jiHKvOgF9KoZo6Kob9oV4lwd/ZD5Cto54zDRw= cloud.google.com/go/talent v1.2.0/go.mod h1:MoNF9bhFQbiJ6eFD3uSsg0uBALw4n4gaCaEjBw9zo8g= cloud.google.com/go/videointelligence v1.6.0/go.mod h1:w0DIDlVRKtwPCn/C4iwZIJdvC69yInhW0cfi+p546uU= @@ -187,48 +188,55 @@ cloud.google.com/go/webrisk v1.4.0/go.mod h1:Hn8X6Zr+ziE2aNd8SliSDWpEnSS1u4R9+xX cloud.google.com/go/webrisk v1.5.0/go.mod h1:iPG6fr52Tv7sGk0H6qUFzmL3HHZev1htXuWDEEsqMTg= cloud.google.com/go/workflows v1.6.0/go.mod h1:6t9F5h/unJz41YqfBmqSASJSXccBLtD1Vwf+KmJENM0= cloud.google.com/go/workflows v1.7.0/go.mod h1:JhSrZuVZWuiDfKEFxU0/F1PQjmpnpcoISEXH2bcHC3M= -collectd.org v0.3.0/go.mod h1:A/8DzQBkF6abtvrT2j/AU/4tiBgJWYyh0y/oB/4MlWE= -cosmossdk.io/api v0.3.1 h1:NNiOclKRR0AOlO4KIqeaG6PS6kswOMhHD0ir0SscNXE= -cosmossdk.io/api v0.3.1/go.mod h1:DfHfMkiNA2Uhy8fj0JJlOCYOBp4eWUUJ1te5zBGNyIw= -cosmossdk.io/core v0.6.1 h1:OBy7TI2W+/gyn2z40vVvruK3di+cAluinA6cybFbE7s= -cosmossdk.io/core v0.6.1/go.mod h1:g3MMBCBXtxbDWBURDVnJE7XML4BG5qENhs0gzkcpuFA= -cosmossdk.io/depinject v1.0.0-alpha.4 h1:PLNp8ZYAMPTUKyG9IK2hsbciDWqna2z1Wsl98okJopc= -cosmossdk.io/depinject v1.0.0-alpha.4/go.mod h1:HeDk7IkR5ckZ3lMGs/o91AVUc7E596vMaOmslGFM3yU= +cosmossdk.io/api v0.7.5 h1:eMPTReoNmGUm8DeiQL9DyM8sYDjEhWzL1+nLbI9DqtQ= +cosmossdk.io/api v0.7.5/go.mod h1:IcxpYS5fMemZGqyYtErK7OqvdM0C8kdW3dq8Q/XIG38= +cosmossdk.io/client/v2 v2.0.0-beta.3 h1:+TTuH0DwQYsUq2JFAl3fDZzKq5gQG7nt3dAattkjFDU= +cosmossdk.io/client/v2 v2.0.0-beta.3/go.mod h1:CZcL41HpJPOOayTCO28j8weNBQprG+SRiKX39votypo= +cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= +cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= +cosmossdk.io/core v0.11.1 h1:h9WfBey7NAiFfIcUhDVNS503I2P2HdZLebJlUIs8LPA= +cosmossdk.io/core v0.11.1/go.mod h1:OJzxcdC+RPrgGF8NJZR2uoQr56tc7gfBKhiKeDO7hH0= +cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= +cosmossdk.io/depinject v1.0.0/go.mod h1:zxK/h3HgHoA/eJVtiSsoaRaRA2D5U4cJ5thIG4ssbB8= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= -cosmossdk.io/log v1.3.1 h1:UZx8nWIkfbbNEWusZqzAx3ZGvu54TZacWib3EzUYmGI= -cosmossdk.io/log v1.3.1/go.mod h1:2/dIomt8mKdk6vl3OWJcPk2be3pGOS8OQaLUM/3/tCM= +cosmossdk.io/log v1.4.1 h1:wKdjfDRbDyZRuWa8M+9nuvpVYxrEOwbD/CA8hvhU8QM= +cosmossdk.io/log v1.4.1/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= cosmossdk.io/simapp v0.0.0-20231127212628-044ff4d8c015 h1:ARUqouMWNreV8e5wxPberry+tm+Uk+1eeJDt3KXQEn0= cosmossdk.io/simapp v0.0.0-20231127212628-044ff4d8c015/go.mod h1:VNknW36ZIgwkjKtb6eyA4RZ7x9+ZpKMVCsAUA6bFWnk= -cosmossdk.io/tools/rosetta v0.2.1 h1:ddOMatOH+pbxWbrGJKRAawdBkPYLfKXutK9IETnjYxw= -cosmossdk.io/tools/rosetta v0.2.1/go.mod h1:Pqdc1FdvkNV3LcNIkYWt2RQY6IP1ge6YWZk8MhhO9Hw= -filippo.io/edwards25519 v1.0.0-rc.1/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns= -filippo.io/edwards25519 v1.0.0 h1:0wAIcmJUqRdI8IJ/3eGi5/HwXZWPujYXXlkrQogz0Ek= -filippo.io/edwards25519 v1.0.0/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns= -git.sr.ht/~sircmpwn/getopt v0.0.0-20191230200459-23622cc906b3/go.mod h1:wMEGFFFNuPos7vHmWXfszqImLppbc0wEhh6JBfJIUgw= -git.sr.ht/~sircmpwn/go-bare v0.0.0-20210406120253-ab86bc2846d9/go.mod h1:BVJwbDfVjCjoFiKrhkei6NdGcZYpkDkdyCdg1ukytRA= +cosmossdk.io/store v1.1.1 h1:NA3PioJtWDVU7cHHeyvdva5J/ggyLDkyH0hGHl2804Y= +cosmossdk.io/store v1.1.1/go.mod h1:8DwVTz83/2PSI366FERGbWSH7hL6sB7HbYp8bqksNwM= +cosmossdk.io/x/circuit v0.1.1 h1:KPJCnLChWrxD4jLwUiuQaf5mFD/1m7Omyo7oooefBVQ= +cosmossdk.io/x/circuit v0.1.1/go.mod h1:B6f/urRuQH8gjt4eLIXfZJucrbreuYrKh5CSjaOxr+Q= +cosmossdk.io/x/evidence v0.1.1 h1:Ks+BLTa3uftFpElLTDp9L76t2b58htjVbSZ86aoK/E4= +cosmossdk.io/x/evidence v0.1.1/go.mod h1:OoDsWlbtuyqS70LY51aX8FBTvguQqvFrt78qL7UzeNc= +cosmossdk.io/x/feegrant v0.1.1 h1:EKFWOeo/pup0yF0svDisWWKAA9Zags6Zd0P3nRvVvw8= +cosmossdk.io/x/feegrant v0.1.1/go.mod h1:2GjVVxX6G2fta8LWj7pC/ytHjryA6MHAJroBWHFNiEQ= +cosmossdk.io/x/tx v0.13.5 h1:FdnU+MdmFWn1pTsbfU0OCf2u6mJ8cqc1H4OMG418MLw= +cosmossdk.io/x/tx v0.13.5/go.mod h1:V6DImnwJMTq5qFjeGWpXNiT/fjgE4HtmclRmTqRVM3w= +cosmossdk.io/x/upgrade v0.1.4 h1:/BWJim24QHoXde8Bc64/2BSEB6W4eTydq0X/2f8+g38= +cosmossdk.io/x/upgrade v0.1.4/go.mod h1:9v0Aj+fs97O+Ztw+tG3/tp5JSlrmT7IcFhAebQHmOPo= +dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= +filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= +filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 h1:/vQbFIOMbk2FiG/kXiLl8BRyzTWDw7gX/Hz7Dd5eDMs= github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4/go.mod h1:hN7oaIRCjzsZ2dE+yG5k+rsdt3qcwykqK6HVGcKwsw4= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.1/go.mod h1:fBF9PQNqB8scdgpZ3ufzaLntG0AG7C1WjPMsiFOmfHM= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= -github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v0.3.0/go.mod h1:tPaiy8S5bQ+S5sOiDlINkp7+Ef339+Nz5L5XO+cnOHo= -github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 h1:UQHMgLO+TxOElx5B5HZ4hJQsoJ/PvUvKRhJHDQXO8P8= -github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= +github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0= +github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/toml v1.1.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= -github.com/ChainSafe/go-schnorrkel v1.0.0 h1:3aDA67lAykLaG1y3AOjs88dMxC88PgUuHRrLeDnvGIM= -github.com/ChainSafe/go-schnorrkel v1.0.0/go.mod h1:dpzHYVxLZcp8pjlV+O+UR8K0Hp/z7vcchBSbMBEhCw4= -github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/DataDog/datadog-go v3.2.0+incompatible h1:qSG2N4FghB1He/r2mFrWKCaL7dXCilEuNEeAn20fdD4= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= -github.com/DataDog/zstd v1.5.0/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= github.com/DataDog/zstd v1.5.5 h1:oWf5W7GtOLgp6bciQYDmhHHjdhYkALu6S/5Ni9ZgSvQ= github.com/DataDog/zstd v1.5.5/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= +github.com/Kava-Labs/cosmos-sdk/x/upgrade v0.0.0-20241024201445-a8e1a4abf85b h1:mjvc8bdDGZRZdlYsMZzl2kNEBmD3fjjwAqIFqBbKf/Y= +github.com/Kava-Labs/cosmos-sdk/x/upgrade v0.0.0-20241024201445-a8e1a4abf85b/go.mod h1:b130aNxXOgphdgbAjilHQIPqGmYM912mTKs2Qzh2hkY= github.com/Kava-Labs/go-ethereum v1.10.27-0.20240513233504-6e038346780b h1:gTLS1VJL+6TEcttEmQ9rAmm/UZZw23WlQf6n8R/Xjx0= github.com/Kava-Labs/go-ethereum v1.10.27-0.20240513233504-6e038346780b/go.mod h1:tvRm5KYJQ6LT+uss34spIP1oi6JgCfsFYiMKwJLZr6M= -github.com/Kava-Labs/opendb v0.0.0-20240719173129-a2f11f6d7e51 h1:tMTENCeSPIJO8yCpEQbT15XYXt4EFNQUx3s334uxVts= -github.com/Kava-Labs/opendb v0.0.0-20240719173129-a2f11f6d7e51/go.mod h1:LbPsJiWvj90NT3Y9YV8EFPkWfvp8A15Tp88qqKa3LxA= +github.com/Kava-Labs/opendb v0.0.0-20241024062216-dd5bc73e28f2 h1:nbPWQhtnAbLVcRwiboKRdAe9LHCqXTqv53LFWsbMBXI= +github.com/Kava-Labs/opendb v0.0.0-20241024062216-dd5bc73e28f2/go.mod h1:HVK6fke4/iQusTLZ0Us/0Mmj/CTiHmU2VQqmScQHsHg= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= @@ -236,21 +244,22 @@ github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 h1:TngWCqHvy9oXAN6lEV github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5/go.mod h1:lmUJ/7eu/Q8D7ML55dXQrVaamCz2vxCfdQBasLZfHKk= github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= +github.com/PuerkitoBio/purell v1.1.1 h1:WEQqlqaGbrPkxLJWfBwQmfEAE1Z7ONdDLqrN38tNFfI= +github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= +github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M= +github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= -github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= github.com/StackExchange/wmi v1.2.1 h1:VIkavFPXSjcnS+O8yTq7NI32k0R5Aj+v39y29VYDOSA= github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9SBzvHz7e8= -github.com/VictoriaMetrics/fastcache v1.6.0 h1:C/3Oi3EiBCqufydp1neRZkqcwmEiuRT9c3fqvvgKm5o= -github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= +github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= +github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= github.com/VividCortex/gohistogram v1.0.0 h1:6+hBz+qvs0JOrrNhhmR7lFxo5sINxBCGXrdtl/UvroE= github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= -github.com/Zilliqa/gozilliqa-sdk v1.2.1-0.20201201074141-dd0ecada1be6/go.mod h1:eSYp2T6f0apnuW8TzhV3f6Aff2SE8Dwio++U4ha4yEM= github.com/adlio/schema v1.3.3 h1:oBJn8I02PyTB466pZO1UZEn1TV5XLlifBSyMrmHl/1I= github.com/adlio/schema v1.3.3/go.mod h1:1EsRssiv9/Ce2CMzq5DoL7RiMshhuigQxrR4DMV9fHg= github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c= -github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= @@ -259,33 +268,21 @@ github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk5 github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= github.com/allegro/bigcache v1.2.1 h1:hg1sY1raCwic3Vnsvje6TT7/pnZba83LeFck5NrFKSc= github.com/allegro/bigcache v1.2.1/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= -github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/apache/arrow/go/arrow v0.0.0-20191024131854-af6fa24be0db/go.mod h1:VTxUBvSJ3s3eHAg65PNgrsn5BtqCRPdmyXh6rAfdxN0= github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= -github.com/armon/go-metrics v0.4.1 h1:hR91U9KYmb6bLBYLQjyM+3j+rcd/UhE+G78SFnF8gJA= -github.com/armon/go-metrics v0.4.1/go.mod h1:E6amYzXo6aW1tqzoZGT755KkbgrJsSdpwZ+3JqfkOG4= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6lCRdSC2Tm3DSWRPvIPr6xNKyeHdqDQSQT+A= github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU= github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go v1.44.122/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX4oIKwKHZo= -github.com/aws/aws-sdk-go v1.44.203 h1:pcsP805b9acL3wUqa4JR2vg1k2wnItkDYNvfmcy6F+U= -github.com/aws/aws-sdk-go v1.44.203/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= +github.com/aws/aws-sdk-go v1.55.5 h1:KKUZBfBoyqy5d3swXyiC7Q76ic40rYcbqH7qjh59kzU= +github.com/aws/aws-sdk-go v1.55.5/go.mod h1:eRwEWoyTWFMVYVQzKMNHWP5/RV4xIUGMQfXQHfHkpNU= github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= -github.com/aws/aws-sdk-go-v2 v1.2.0/go.mod h1:zEQs02YRBw1DjK0PoJv3ygDYOFTre1ejlJWl8FwAuQo= -github.com/aws/aws-sdk-go-v2/config v1.1.1/go.mod h1:0XsVy9lBI/BCXm+2Tuvt39YmdHwS5unDQmxZOYe8F5Y= -github.com/aws/aws-sdk-go-v2/credentials v1.1.1/go.mod h1:mM2iIjwl7LULWtS6JCACyInboHirisUUdkBPoTHMOUo= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.0.2/go.mod h1:3hGg3PpiEjHnrkrlasTfxFqUsZ2GCk/fMUn4CbKgSkM= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.0.2/go.mod h1:45MfaXZ0cNbeuT0KQ1XJylq8A6+OpVV2E5kvY/Kq+u8= -github.com/aws/aws-sdk-go-v2/service/route53 v1.1.1/go.mod h1:rLiOUrPLW/Er5kRcQ7NkwbjlijluLsrIbu/iyl35RO4= -github.com/aws/aws-sdk-go-v2/service/sso v1.1.1/go.mod h1:SuZJxklHxLAXgLTc1iFXbEWkXs7QRTQpCLGaKIprQW0= -github.com/aws/aws-sdk-go-v2/service/sts v1.1.1/go.mod h1:Wi0EBZwiz/K44YliU0EKxqTCJGUfYTWXrrBwkq736bM= -github.com/aws/smithy-go v1.1.0/go.mod h1:EzMw8dbp/YJL4A5/sbhGddag+NPT7q084agLbB9LgIw= +github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= @@ -293,36 +290,30 @@ github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6r github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d h1:xDfNPAt8lFiC1UJrqV3uuy861HCTo708pDMbjHHdCas= github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d/go.mod h1:6QX/PXZ00z/TKoufEY6K/a0k6AhaJrQKdFe6OfVXsa4= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= -github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 h1:41iFGWnSlI2gVpmOtVTJZNodLdLQLn/KsJqFvXwnd/s= -github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= -github.com/bmizerany/pat v0.0.0-20170815010413-6226ea591a40/go.mod h1:8rLXio+WjiTceGBHIoTvn60HIbs7Hm7bcHjyrSqYB9c= -github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps= -github.com/btcsuite/btcd v0.0.0-20190315201642-aa6e0f35703c/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8= +github.com/bgentry/speakeasy v0.2.0 h1:tgObeVOf8WAvtuAX6DhJ4xks4CFNwPDZiqzGqIHE51E= +github.com/bgentry/speakeasy v0.2.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/bits-and-blooms/bitset v1.8.0 h1:FD+XqgOZDUxxZ8hzoBFuV9+cGWY9CslN6d5MS5JVb4c= +github.com/bits-and-blooms/bitset v1.8.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= -github.com/btcsuite/btcd v0.21.0-beta.0.20201114000516-e9c7a5ac6401/go.mod h1:Sv4JPQ3/M+teHz9Bo5jBpkNcP0x6r7rdihlNL/7tTAs= github.com/btcsuite/btcd v0.22.0-beta.0.20220111032746-97732e52810c/go.mod h1:tjmYdS6MLJ5/s0Fj4DbLgSbDHbEqLJrtnHecBFkdz5M= -github.com/btcsuite/btcd v0.22.1/go.mod h1:wqgTSL29+50LRkmOVknEdmt8ZojIzhuWvgu/iptuN7Y= github.com/btcsuite/btcd v0.23.5-0.20231215221805-96c9fd8078fd/go.mod h1:nm3Bko6zh6bWP60UxwoT5LzdGJsQJaPo6HjduXq9p6A= -github.com/btcsuite/btcd v0.24.0 h1:gL3uHE/IaFj6fcZSu03SvqPMSx7s/dPzfpG/atRwWdo= -github.com/btcsuite/btcd v0.24.0/go.mod h1:K4IDc1593s8jKXIF7yS7yCTSxrknB9z0STzc2j6XgE4= +github.com/btcsuite/btcd v0.24.2 h1:aLmxPguqxza+4ag8R1I2nnJjSu2iFn/kqtHTIImswcY= +github.com/btcsuite/btcd v0.24.2/go.mod h1:5C8ChTkl5ejr3WHj8tkQSCmydiMEPB0ZhQhehpq7Dgg= github.com/btcsuite/btcd/btcec/v2 v2.1.0/go.mod h1:2VzYrv4Gm4apmbVVsSq5bqf1Ec8v56E48Vt0Y/umPgA= github.com/btcsuite/btcd/btcec/v2 v2.1.3/go.mod h1:ctjw4H1kknNJmRN4iP1R7bTQ+v3GJkZBd6mui8ZsAZE= -github.com/btcsuite/btcd/btcec/v2 v2.2.0/go.mod h1:U7MHm051Al6XmscBQ0BoNydpOTsFAn707034b5nY8zU= -github.com/btcsuite/btcd/btcec/v2 v2.3.2 h1:5n0X6hX0Zk+6omWcihdYvdAlGf2DfasC0GMf7DClJ3U= -github.com/btcsuite/btcd/btcec/v2 v2.3.2/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= +github.com/btcsuite/btcd/btcec/v2 v2.3.4 h1:3EJjcN70HCu/mwqlUsGK8GcNVyLVxFDlWurTXGPFfiQ= +github.com/btcsuite/btcd/btcec/v2 v2.3.4/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= github.com/btcsuite/btcd/btcutil v1.0.0/go.mod h1:Uoxwv0pqYWhD//tfTiipkxNfdhG9UrLwaeswfjfdF0A= github.com/btcsuite/btcd/btcutil v1.1.0/go.mod h1:5OapHB7A2hBBWLm48mmw4MOHNJCcUBTwmWH/0Jn8VHE= -github.com/btcsuite/btcd/btcutil v1.1.5 h1:+wER79R5670vs/ZusMTF1yTcRYE5GUsFbdjdisflzM8= github.com/btcsuite/btcd/btcutil v1.1.5/go.mod h1:PSZZ4UitpLBWzxGd5VGOrLnmOjtPP/a6HaFo12zMs00= +github.com/btcsuite/btcd/btcutil v1.1.6 h1:zFL2+c3Lb9gEgqKNzowKUPQNb8jV7v5Oaodi/AYFd6c= +github.com/btcsuite/btcd/btcutil v1.1.6/go.mod h1:9dFymx8HpuLqBnsPELrImQeTQfKBQqzqGbbV3jK55aE= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.0/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 h1:59Kx4K6lzOW5w6nFlA0v5+lk/6sjybR934QNHSJZPTQ= github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= -github.com/btcsuite/btcutil v0.0.0-20190207003914-4c204d697803/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/btcutil v1.0.2/go.mod h1:j9HUFwoQRsZL3V4n+qG+CUnEGHOarIxfC3Le2Yhbcts= -github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce/go.mod h1:0DVlHczLPewLcPGEIeUEzfOJhqGPQ0mJJRDBtD307+o= github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= github.com/btcsuite/goleveldb v1.0.0/go.mod h1:QiK9vBlgftBg6rWQIj6wFzbPfRjiykIEhBH4obrXJ/I= @@ -330,45 +321,44 @@ github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku github.com/btcsuite/snappy-go v1.0.0/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= -github.com/bufbuild/protocompile v0.4.0 h1:LbFKd2XowZvQ/kajzguUp2DC9UEIQhIq77fZZlaQsNA= -github.com/bufbuild/protocompile v0.4.0/go.mod h1:3v93+mbWn/v3xzN+31nwkJfrEpAUwp+BagBSZWx+TP8= -github.com/bwesterb/go-ristretto v1.2.0/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= +github.com/bufbuild/protocompile v0.6.0 h1:Uu7WiSQ6Yj9DbkdnOe7U4mNKp58y9WDMKDn28/ZlunY= +github.com/bufbuild/protocompile v0.6.0/go.mod h1:YNP35qEYoYGme7QMtz5SBCoN4kL4g12jTtjuzRNdjpE= github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM= -github.com/bytedance/sonic v1.8.0 h1:ea0Xadu+sHlu7x5O3gKhRpQ1IKiMrSiHttPF0ybECuA= github.com/bytedance/sonic v1.8.0/go.mod h1:i736AoUSYt75HyZLoJW9ERYxcy6eaN6h4BZXU064P/U= -github.com/c-bata/go-prompt v0.2.2/go.mod h1:VzqtzE2ksDBcdln8G7mk2RX9QyGjH+OVqOCSiVIqS34= github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4= github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= github.com/cenkalti/backoff/v4 v4.1.1/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= -github.com/cenkalti/backoff/v4 v4.1.3 h1:cFAlzYUlVYDysBEH2T5hyJZMh3+5+WCBvSnK6Q8UtC4= -github.com/cenkalti/backoff/v4 v4.1.3/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= +github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8= +github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/cp v0.1.0 h1:SE+dxFebS7Iik5LK0tsi1k9ZCxEaFX4AjQmoyA+1dJk= github.com/cespare/cp v0.1.0/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s= github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cheggaaa/pb v1.0.27/go.mod h1:pQciLPpbU0oxA0h+VJYYLxO+XeDQb5pZijXscXHm81s= github.com/chenzhuoyu/base64x v0.0.0-20211019084208-fb5309c8db06/go.mod h1:DH46F32mSOjUmXrMHnKwZdA8wcEefY7UVqBKYGjpdQY= -github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 h1:qSGYFH7+jGhDF8vLC+iwCD4WpbV1EBDSzWkJODFLams= github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311/go.mod h1:b583jCggY9gE99b6G5LEC39OIiVsWj+R97kbl5odCEk= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= +github.com/chzyer/logex v1.2.0/go.mod h1:9+9sk7u7pGNWYMkh0hdiL++6OeibzJccyQU4p4MedaY= github.com/chzyer/logex v1.2.1 h1:XHDu3E6q+gdHgsdTPH6ImJMIp436vR6MPtH8gP05QzM= github.com/chzyer/logex v1.2.1/go.mod h1:JLbx6lG2kDbNRFnfkgvh4eRJRPX1QCoOIWomwysCBrQ= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/readline v1.5.0/go.mod h1:x22KAscuvRqlLoK9CsoYsmxoXZMMFVyOl86cAH8qUic= github.com/chzyer/readline v1.5.1 h1:upd/6fQk4src78LMRzh5vItIt361/o4uq553V8B5sGI= github.com/chzyer/readline v1.5.1/go.mod h1:Eh+b79XXUwfKfcPLepksvw2tcLE/Ct21YObkaSkeBlk= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= +github.com/chzyer/test v0.0.0-20210722231415-061457976a23/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/chzyer/test v1.0.0 h1:p3BQDXSxOhOG0P9z6/hGnII4LGiEPOYBhs8asl/fC04= github.com/chzyer/test v1.0.0/go.mod h1:2JlltgoNkt4TW/z9V/IzDdFaMTM2JPIi26O1pF38GC8= github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag= github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cloudflare/cloudflare-go v0.14.0/go.mod h1:EnwdgGMaFOruiPZRFSgn+TsQ3hQ7C/YWzIGLeu5c304= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= @@ -378,33 +368,26 @@ github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWH github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20231128003011-0fa0005c9caa h1:jQCWAUqqlij9Pgj2i/PB79y4KOPYVyFYdROxgaCwdTQ= -github.com/cncf/xds/go v0.0.0-20231128003011-0fa0005c9caa/go.mod h1:x/1Gn8zydmfq8dk6e9PdstVsDgu9RuyIIJqAaF//0IM= github.com/cockroachdb/apd/v2 v2.0.2 h1:weh8u7Cneje73dDh+2tEVLUvyBc89iwepWCD8b8034E= github.com/cockroachdb/apd/v2 v2.0.2/go.mod h1:DDxRlzC2lo3/vSlmSoS7JkqbbrARPuFOGr0B9pvN3Gw= github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f h1:otljaYPt5hWxV3MUfO5dFPFiOXg9CyG5/kCfayTqsJ4= github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f/go.mod h1:a9RdTaap04u637JoCzcUoIcDmvwSUtcUFtT/C3kJlTU= -github.com/cockroachdb/errors v1.11.1 h1:xSEW75zKaKCWzR3OfxXUxgrk/NtT4G1MiOv5lWZazG8= -github.com/cockroachdb/errors v1.11.1/go.mod h1:8MUxA3Gi6b25tYlFEBGLf+D8aISL+M4MIpiWMSNRfxw= +github.com/cockroachdb/errors v1.11.3 h1:5bA+k2Y6r+oz/6Z/RFlNeVCesGARKuC6YymtcDrbC/I= +github.com/cockroachdb/errors v1.11.3/go.mod h1:m4UIW4CDjx+R5cybPsNrRbreomiFqt8o1h1wUVazSd8= +github.com/cockroachdb/fifo v0.0.0-20240606204812-0bbfbd93a7ce h1:giXvy4KSc/6g/esnpM7Geqxka4WSqI1SZc7sMJFd3y4= +github.com/cockroachdb/fifo v0.0.0-20240606204812-0bbfbd93a7ce/go.mod h1:9/y3cnZ5GKakj/H4y9r9GTjCvAFta7KLgSHPJJYc52M= github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b h1:r6VH0faHjZeQy818SGhaone5OnYfxFR/+AzdY3sf5aE= github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b/go.mod h1:Vz9DsVWQQhf3vs21MhPMZpMGSht7O/2vFW2xusFUVOs= -github.com/cockroachdb/pebble v1.1.0 h1:pcFh8CdCIt2kmEpK0OIatq67Ln9uGDYY3d5XnE0LJG4= -github.com/cockroachdb/pebble v1.1.0/go.mod h1:sEHm5NOXxyiAoKWhoFxT8xMgd/f3RA6qUqQ1BXKrh2E= +github.com/cockroachdb/pebble v1.1.1 h1:XnKU22oiCLy2Xn8vp1re67cXg4SAasg/WDt1NtcRFaw= +github.com/cockroachdb/pebble v1.1.1/go.mod h1:4exszw1r40423ZsmkG/09AFEG83I0uDgfujJdbL6kYU= github.com/cockroachdb/redact v1.1.5 h1:u1PMllDkdFfPWaNGMyLD1+so+aq3uUItthCFqzwPJ30= github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 h1:zuQyyAKVxetITBuuhv3BI9cMrmStnpT18zmgmTxunpo= github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06/go.mod h1:7nc4anLGjupUW/PeY5qiNYsdNXj7zopG+eqsS7To5IQ= github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= -github.com/coinbase/kryptology v1.8.0/go.mod h1:RYXOAPdzOGUe3qlSFkMGn58i3xUA8hmxYHksuq+8ciI= -github.com/coinbase/rosetta-sdk-go v0.7.9 h1:lqllBjMnazTjIqYrOGv8h8jxjg9+hJazIGZr9ZvoCcA= -github.com/coinbase/rosetta-sdk-go v0.7.9/go.mod h1:0/knutI7XGVqXmmH4OQD8OckFrbQ8yMsUZTG7FXCR2M= -github.com/confio/ics23/go v0.9.0 h1:cWs+wdbS2KRPZezoaaj+qBleXgUk5WOQFMP3CQFGTr4= -github.com/confio/ics23/go v0.9.0/go.mod h1:4LPZ2NYqnYIVRklaozjNR1FScgDJ2s5Xrp+e/mYVRak= -github.com/consensys/bavard v0.1.8-0.20210406032232-f3452dc9b572/go.mod h1:Bpd0/3mZuaj6Sj+PqrmIquiOKy397AKGThQPaGzNXAQ= -github.com/consensys/bavard v0.1.8-0.20210915155054-088da2f7f54a/go.mod h1:9ItSMtA/dXMAiL7BG6bqW2m3NdSEObYWoH223nGHukI= -github.com/consensys/gnark-crypto v0.4.1-0.20210426202927-39ac3d4b3f1f/go.mod h1:815PAHg3wvysy0SyIqanF8gZ0Y1wjk/hrDHD/iT88+Q= -github.com/consensys/gnark-crypto v0.5.3/go.mod h1:hOdPlWQV1gDLp7faZVeg8Y0iEPFaOUnCc4XeCCk96p0= +github.com/coinbase/rosetta-sdk-go/types v1.0.0 h1:jpVIwLcPoOeCR6o1tU+Xv7r5bMONNbHU7MuEHboiFuA= +github.com/coinbase/rosetta-sdk-go/types v1.0.0/go.mod h1:eq7W2TMRH22GTW0N0beDnN931DW0/WOI1R2sdHNHG4c= github.com/containerd/continuity v0.3.0 h1:nisirsYROK15TAMVukJOUyGJjz4BNQJBVsNvAXZJ/eg= github.com/containerd/continuity v0.3.0/go.mod h1:wJEAIwKOm/pBZuBd0JmeTvnLquTB1Ag8espWhkykbPM= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= @@ -419,42 +402,40 @@ github.com/cosmos/cosmos-db v1.0.2 h1:hwMjozuY1OlJs/uh6vddqnk9j7VamLv+0DBlbEXbAK github.com/cosmos/cosmos-db v1.0.2/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA= github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec= -github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiKxTE= github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ4GUkT+tbFI= github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= -github.com/cosmos/gogoproto v1.4.10 h1:QH/yT8X+c0F4ZDacDv3z+xE3WU1P1Z3wQoLMBRJoKuI= -github.com/cosmos/gogoproto v1.4.10/go.mod h1:3aAZzeRWpAwr+SS/LLkICX2/kDFyaYVzckBDzygIxek= +github.com/cosmos/gogoproto v1.7.0 h1:79USr0oyXAbxg3rspGh/m4SWNyoz/GLaAh0QlCe2fro= +github.com/cosmos/gogoproto v1.7.0/go.mod h1:yWChEv5IUEYURQasfyBW5ffkMHR/90hiHgbNgrtp4j0= github.com/cosmos/iavl v1.2.0 h1:kVxTmjTh4k0Dh1VNL046v6BXqKziqMDzxo93oh3kOfM= github.com/cosmos/iavl v1.2.0/go.mod h1:HidWWLVAtODJqFD6Hbne2Y0q3SdxByJepHUOeoH4LiI= -github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7 v7.1.3 h1:MZGDMETv72suFpTAD6VPGqSIm1FJcChtk2HmVh9D+Bo= -github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7 v7.1.3/go.mod h1:UvDmcGIWJPIytq+Q78/ff5NTOsuX/7IrNgEugTW5i0s= -github.com/cosmos/ibc-go/v7 v7.4.0 h1:8FqYMptvksgMvlbN4UW9jFxTXzsPyfAzEZurujXac8M= -github.com/cosmos/ibc-go/v7 v7.4.0/go.mod h1:L/KaEhzV5TGUCTfGysVgMBQtl5Dm7hHitfpk+GIeoAo= -github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= -github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= +github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8 v8.0.2 h1:dyLNlDElY6+5zW/BT/dO/3Ad9FpQblfh+9dQpYQodbA= +github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8 v8.0.2/go.mod h1:82hPO/tRawbuFad2gPwChvpZ0JEIoNi91LwVneAYCeM= +github.com/cosmos/ibc-go/modules/capability v1.0.1 h1:ibwhrpJ3SftEEZRxCRkH0fQZ9svjthrX2+oXdZvzgGI= +github.com/cosmos/ibc-go/modules/capability v1.0.1/go.mod h1:rquyOV262nGJplkumH+/LeYs04P3eV8oB7ZM4Ygqk4E= +github.com/cosmos/ibc-go/v8 v8.5.1 h1:3JleEMKBjRKa3FeTKt4fjg22za/qygLBo7mDkoYTNBs= +github.com/cosmos/ibc-go/v8 v8.5.1/go.mod h1:P5hkAvq0Qbg0h18uLxDVA9q1kOJ0l36htMsskiNwXbo= +github.com/cosmos/ics23/go v0.11.0 h1:jk5skjT0TqX5e5QJbEnwXIS2yI2vnmLOgpQPeM5RtnU= +github.com/cosmos/ics23/go v0.11.0/go.mod h1:A8OjxPE67hHST4Icw94hOxxFEJMBG031xIGF/JHNIY0= github.com/cosmos/keyring v1.2.0 h1:8C1lBP9xhImmIabyXW4c3vFjjLiBdGCmfLUfeZlV1Yo= github.com/cosmos/keyring v1.2.0/go.mod h1:fc+wB5KTk9wQ9sDx0kFXB3A0MaeGHM9AwRStKOQ5vOA= github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= github.com/cosmos/ledger-cosmos-go v0.13.3/go.mod h1:HENcEP+VtahZFw38HZ3+LS3Iv5XV6svsnkk9vdJtLr8= +github.com/cosmos/rosetta v0.50.6 h1:+Hgog7CUHevZuPxZaoqR8klTs1G3ukAcoVTIMporBmw= +github.com/cosmos/rosetta v0.50.6/go.mod h1:KUnwp2i9W0766Dv78HYNV5YKym+imaKmDvXc2W0Y1wA= github.com/cosmos/rosetta-sdk-go v0.10.0 h1:E5RhTruuoA7KTIXUcMicL76cffyeoyvNybzUGSKFTcM= github.com/cosmos/rosetta-sdk-go v0.10.0/go.mod h1:SImAZkb96YbwvoRkzSMQB6noNJXFgWl/ENIznEoYQI4= github.com/cpuguy83/go-md2man v1.0.10 h1:BSKMNlYxDvnunlTymqtgONjNnaRV1sTpcovwwjF22jk= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= -github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= -github.com/cpuguy83/go-md2man/v2 v2.0.3 h1:qMCsGGgs+MAzDFyp9LpAe1Lqy/fY/qCovCm0qnXZOBM= -github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= -github.com/creachadair/taskgroup v0.4.2 h1:jsBLdAJE42asreGss2xZGZ8fJra7WtwnHWeJFxv2Li8= -github.com/creachadair/taskgroup v0.4.2/go.mod h1:qiXUOSrbwAY3u0JPGTzObbE3yf9hcXHDKBZ2ZjpCbgM= +github.com/cpuguy83/go-md2man/v2 v2.0.4 h1:wfIWP927BUkWJb2NmU/kNDYIBTh/ziUX91+lVfRxZq4= +github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4= -github.com/danieljoos/wincred v1.1.2 h1:QLdCxFs1/Yl4zduvBdcHB8goaYk9RARS2SgLLRuAyr0= -github.com/danieljoos/wincred v1.1.2/go.mod h1:GijpziifJoIBfYh+S7BbkdUTU4LfM+QnGqR5Vl2tAx0= -github.com/dave/jennifer v1.2.0/go.mod h1:fIb+770HOpJ2fmN9EPPKOqm1vMGhB+TwXKMZhrIygKg= +github.com/danieljoos/wincred v1.2.1 h1:dl9cBrupW8+r5250DYkYxocLeZ1Y4vB1kxgtjxw8GQs= +github.com/danieljoos/wincred v1.2.1/go.mod h1:uGaFL9fDn3OLTvzCGulzE+SzjEe5NGlh5FdCcyfPwps= github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -466,36 +447,32 @@ github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn github.com/decred/dcrd/crypto/blake256 v1.0.1 h1:7PltbUIQB7u/FfZ39+DGa/ShuMyJ5ilcvdfma9wOH6Y= github.com/decred/dcrd/crypto/blake256 v1.0.1/go.mod h1:2OfgNZ5wDpcsFmHmCK5gZTPcCXqlm2ArzUIkw9czNJo= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs= -github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 h1:8UrgZ3GkP4i/CLijOJx79Yu+etlyjdBU4sfcs2WYQMs= -github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 h1:rpfIENRNNilwHwZeG5+P150SMrnNEcHYvcCuK6dPZSg= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= -github.com/deepmap/oapi-codegen v1.6.0/go.mod h1:ryDa9AgbELGeB+YEXE1dR53yAjHwFvE9iAUlWl9Al3M= -github.com/deepmap/oapi-codegen v1.8.2/go.mod h1:YLgSKSDv/bZQB7N4ws6luhozi3cEdRktEqrX88CvjIw= github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f h1:U5y3Y5UE0w7amNe7Z5G/twsBW0KEalRQXZzf8ufSh9I= github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f/go.mod h1:xH/i4TFMt8koVQZ6WFms69WAsDWr2XsYL3Hkl7jkoLE= github.com/dgraph-io/badger/v2 v2.2007.4 h1:TRWBQg8UrlUhaFdco01nO2uXwzKS7zd+HVdwV/GHc4o= github.com/dgraph-io/badger/v2 v2.2007.4/go.mod h1:vSw/ax2qojzbN6eXHIx6KPKtCSHJN/Uz0X0VPruTIhk= github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= -github.com/dgraph-io/ristretto v0.0.3/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= -github.com/dgraph-io/ristretto v0.1.1 h1:6CWw5tJNgpegArSHpNHJKldNeq03FQCwYvfMVWajOK8= -github.com/dgraph-io/ristretto v0.1.1/go.mod h1:S1GPSBCYCIhmVNfcth17y2zZtQT6wzkzgwUve0VDWWA= -github.com/dgryski/go-bitstream v0.0.0-20180413035011-3522498ce2c8/go.mod h1:VMaSuZ+SZcx/wljOQKvp5srsbCiKDEb6K2wC4+PiBmQ= +github.com/dgraph-io/ristretto v0.1.2-0.20240116140435-c67e07994f91 h1:Pux6+xANi0I7RRo5E1gflI4EZ2yx3BGZ75JkAIvGEOA= +github.com/dgraph-io/ristretto v0.1.2-0.20240116140435-c67e07994f91/go.mod h1:swkazRqnUf1N62d0Nutz7KIj2UKqsm/H8tD0nBJAXqM= github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 h1:fAjc9m62+UWV/WAFKLNi6ZS0675eEUC9y3AlwSbQu1Y= github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= -github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91 h1:Izz0+t1Z5nI16/II7vuEo/nHjodOg0p7+OiDpjX5t1E= github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= -github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= -github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= -github.com/docker/docker v1.6.2/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/dlclark/regexp2 v1.7.0 h1:7lJfhqlPssTb1WQx4yvTHN0uElPEv52sbaECrAQxjAo= +github.com/dlclark/regexp2 v1.7.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= -github.com/dop251/goja v0.0.0-20220405120441-9037c2b61cbf h1:Yt+4K30SdjOkRoRRm3vYNQgR+/ZIy0RmeUDZo7Y8zeQ= -github.com/dop251/goja v0.0.0-20220405120441-9037c2b61cbf/go.mod h1:R9ET47fwRVRPZnOGvHxxhuZcbrMCuiqOz3Rlrh4KSnk= +github.com/dop251/goja v0.0.0-20211022113120-dc8c55024d06/go.mod h1:R9ET47fwRVRPZnOGvHxxhuZcbrMCuiqOz3Rlrh4KSnk= +github.com/dop251/goja v0.0.0-20230806174421-c933cf95e127 h1:qwcF+vdFrvPSEUDSX5RVoRccG8a5DhOdWdQ4zN62zzo= +github.com/dop251/goja v0.0.0-20230806174421-c933cf95e127/go.mod h1:QMWlm50DNe14hD7t24KEqZuUdC9sOTy8W6XbCU1mlw4= github.com/dop251/goja_nodejs v0.0.0-20210225215109-d91c329300e7/go.mod h1:hn7BA7c8pLvoGndExHudxTDKZ84Pyvv+90pbBjbTz0Y= +github.com/dop251/goja_nodejs v0.0.0-20211022123610-8dd9abb0616d/go.mod h1:DngW8aVqWbuLRMHItjPUyqdj+HWPvnQe8V8y1nDpIbM= github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= @@ -505,7 +482,6 @@ github.com/dvsekhvalnov/jose2go v1.6.0/go.mod h1:QsHjhyTlD/lAVqn/NSbVZmSCGeDehTB github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= -github.com/eclipse/paho.mqtt.golang v1.2.0/go.mod h1:H9keYFcgq3Qr5OUJm/JZI/i6U7joQ8SYLhZwfeOo6Ts= github.com/edsrzf/mmap-go v1.0.0 h1:CEBF7HpRnUCSJgGUb5h1Gm7e3VkmVDrR8lvWVLtrOFw= github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= github.com/emicklei/dot v1.6.1 h1:ujpDlBkkwgWUY+qPId5IwapRW/xEoligRSYjioR6DFI= @@ -521,17 +497,14 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.m github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/envoyproxy/protoc-gen-validate v1.0.4 h1:gVPz/FMfvh57HdSJQyvBtF00j8JU4zdyUgIUNhlgg0A= -github.com/envoyproxy/protoc-gen-validate v1.0.4/go.mod h1:qys6tmnRsYrQqIhm2bvKZH4Blx/1gTIZ2UKVY1M+Yew= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= -github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= +github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= +github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= -github.com/fjl/gencodec v0.0.0-20220412091415-8bb9e558978c/go.mod h1:AzA8Lj6YtixmJWL+wkKoBGsLWy9gFrAzi4g+5bCKwpY= github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 h1:FtmdgXiUlNeRsoNMFlKLDt+S+6hbjVMEW6RGQ7aUf7c= github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= -github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4= @@ -542,28 +515,24 @@ github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMo github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= -github.com/garslo/gogen v0.0.0-20170306192744-1d203ffc1f61/go.mod h1:Q0X6pkwTILDlzrGEckF6HKjXe48EgsY/l7K7vhY4MW8= github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff h1:tY80oXqGNY4FhTFhk+o9oFHGINQ/+vhlm8HFzi6znCI= github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= -github.com/getkin/kin-openapi v0.53.0/go.mod h1:7Yn5whZr5kJi6t+kShccXS8ae1APpYTW6yheSwk8Yi4= -github.com/getkin/kin-openapi v0.61.0/go.mod h1:7Yn5whZr5kJi6t+kShccXS8ae1APpYTW6yheSwk8Yi4= github.com/getsentry/sentry-go v0.27.0 h1:Pv98CIbtB3LkMWmXi4Joa5OOcwbmnX88sF5qbK3r3Ps= github.com/getsentry/sentry-go v0.27.0/go.mod h1:lc76E2QywIyW8WuBnwl8Lc4bkmQH4+w1gwTf25trprY= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= -github.com/gin-gonic/gin v1.9.0 h1:OjyFBKICoexlu99ctXNR2gg+c5pKrKMuyjgARg9qeY8= github.com/gin-gonic/gin v1.9.0/go.mod h1:W1Me9+hsUSyj3CePGrd1/QrKJMSJ1Tu/0hFEH89961k= -github.com/glycerine/go-unsnap-stream v0.0.0-20180323001048-9f0cb55181dd/go.mod h1:/20jfyN9Y5QPEAprSgKAUr+glWDY39ZiUEAYOEv5dsE= -github.com/glycerine/goconvey v0.0.0-20190410193231-58a59202ab31/go.mod h1:Ogl1Tioa0aV7gstGFO7KhffUsb9M4ydbEbbxpcEDc24= -github.com/go-chi/chi/v5 v5.0.0/go.mod h1:BBug9lr0cqtdAhsu6R4AAdvufI0/XBzAQSsUqJpoZOs= github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA= github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og= +github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgOZ7o= github.com/go-kit/kit v0.13.0 h1:OoneCcHKHQ03LfBpoQCUfCluwd2Vt3ohz+kvbJneZAU= github.com/go-kit/kit v0.13.0/go.mod h1:phqEHMMUbyrCFCTgH48JueqrM3md2HcAZ8N3XE4FKDg= +github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= github.com/go-kit/log v0.2.1 h1:MRVx0/zhvdseW+Gza6N9rVzU/IVzaeE1SFI4raAhmBU= github.com/go-kit/log v0.2.1/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= @@ -572,44 +541,32 @@ github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG github.com/go-logfmt/logfmt v0.6.0 h1:wGYYu3uicYdqXVgoYbvnkrPVXkuLM1p1ifugDMEdRi4= github.com/go-logfmt/logfmt v0.6.0/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= -github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= +github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8= github.com/go-ole/go-ole v1.2.5/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= -github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= -github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= -github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA= github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= -github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= -github.com/go-playground/validator/v10 v10.11.2 h1:q3SHpufmypg+erIExEKUmsgmhDTyhcJ38oeKGACXohU= github.com/go-playground/validator/v10 v10.11.2/go.mod h1:NieE624vt4SCTJtD87arVLvdmjPAeV8BQlHtMnw9D7s= github.com/go-sourcemap/sourcemap v2.1.3+incompatible h1:W1iEw64niKVGogNgBN3ePyLFfuisuzeidWPMPWmECqU= github.com/go-sourcemap/sourcemap v2.1.3+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg= github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= -github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-stack/stack v1.8.1 h1:ntEHSVwIt7PNXNpgPmVfMrNhLtgjlmnZha2kOpuRiDw= github.com/go-stack/stack v1.8.1/go.mod h1:dcoOX6HbPZSZptuspn9bctJ+N/CnF5gGygcUP3XYfe4= github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 h1:p104kn46Q8WdvHunIJ9dAyjPVtrBPhSr3KT2yUst43I= github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= -github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee h1:s+21KNqlpePfkah2I+gwHF8xmJWRjooY+5248k6m4A0= github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo= -github.com/gobwas/pool v0.2.0 h1:QEmUOlnSjWtnpRGHF3SauEiOsy82Cup83Vf2LcMlnc8= github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw= -github.com/gobwas/ws v1.0.2 h1:CoAavW/wd/kulfZmSIBt6p24n4j7tHgNVCjsfHVNUbo= github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM= -github.com/goccy/go-json v0.10.0 h1:mXKd9Qw4NuzShiRlOXKews24ufknHO7gx30lsDyokKA= github.com/goccy/go-json v0.10.0/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 h1:ZpnhV/YsD2/4cESfV5+Hoeu/iUR3ruzNvZ+yQfO03a0= github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= -github.com/gofrs/uuid v3.3.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= github.com/gogo/googleapis v1.4.1-0.20201022092350-68b0159b7869/go.mod h1:5YRNX2z1oM5gXdAkurHa942MDgEJyk02w4OecKY87+c= github.com/gogo/googleapis v1.4.1 h1:1Yx4Myt7BxzvUr5ldGSbwYiZG6t9wGBZ+8/fX3Wvtq0= @@ -623,11 +580,7 @@ github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69 github.com/golang-jwt/jwt/v4 v4.3.0 h1:kHL1vqdqWNfATmA0FNMdmZNMyZI1U6O31X4rlIPoBog= github.com/golang-jwt/jwt/v4 v4.3.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= github.com/golang-jwt/jwt/v4 v4.4.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= -github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= -github.com/golang/geo v0.0.0-20190916061304-5b978397cfec/go.mod h1:QZ0nwyI2jOfgRAoBvP+ab5aRr7c9x7lhGEJrKvBwjWI= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/glog v1.2.0 h1:uCdmnmatrKCgMBlM4rMuJZWOkPDqdbZPnrMXDY4gI68= -github.com/golang/glog v1.2.0/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w= github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -666,14 +619,13 @@ github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golangci/lint-1 v0.0.0-20181222135242-d2cdd8c08219/go.mod h1:/X8TswGSh1pIozq4ZwCfxS0WA5JGXguxk94ar/4c87Y= +github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb h1:PBC98N2aIaM3XXiurYmW7fx4GZkL8feAMVq7nEjURHk= +github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/btree v1.1.2 h1:xf4v41cLI2Z6FxbKm+8Bu+m8ifhj15JuZ9sa0jZCMUU= -github.com/google/btree v1.1.2/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= -github.com/google/flatbuffers v1.11.0/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= +github.com/google/btree v1.1.3 h1:CVpQJjYgC4VbzxeGVHfvZrv1ctoYCAI8vbl07Fcxlyg= +github.com/google/btree v1.1.3/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= @@ -693,7 +645,6 @@ github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/gofuzz v1.1.1-0.20200604201612-c04b05f3adfa/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible h1:/CP5g8u/VJHijgedC/Legn3BAbAaWPgecwXBIDzw5no= @@ -701,8 +652,8 @@ github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXi github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/martian/v3 v3.2.1/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= -github.com/google/martian/v3 v3.3.2 h1:IqNFLAmvJOgVlpdEBiQbDc2EwKW77amAycfTuWKdfvw= -github.com/google/martian/v3 v3.3.2/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= +github.com/google/martian/v3 v3.3.3 h1:DIhPTQrbPkgs2yJYdXU/eNACCG5DVQjySNRNlflZ9Fc= +github.com/google/martian/v3 v3.3.3/go.mod h1:iEPrYcgCF7jA9OtScMFQyAlZZ4YXTKEtJ1E6RWzmBA0= github.com/google/orderedcode v0.0.1 h1:UzfcAexk9Vhv8+9pNOgRu41f16lHq725vPwnSeiG/Us= github.com/google/orderedcode v0.0.1/go.mod h1:iVyU4/qPKHY5h/wSd6rZZCDcLJNxiWO6dvsYES2Sb20= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= @@ -718,15 +669,15 @@ github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLe github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210609004039-a478d1d731e9/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 h1:K6RDEckDVWvDI9JAJYCmNdQXq6neHJOYx3V6jnqNEec= github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20230207041349-798e818bf904/go.mod h1:uglQLonpP8qtYCYyzA+8c/9qtqgA3qsXGYqCPKARAFg= +github.com/google/pprof v0.0.0-20230228050547-1710fef4ab10 h1:CqYfpuYIjnlNxM3msdyPRKabhXZWbKjf3Q8BWROFBso= +github.com/google/pprof v0.0.0-20230228050547-1710fef4ab10/go.mod h1:79YE0hCXdHag9sBkw2o+N/YnZtTkXi0UT9Nnixa5eYk= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/s2a-go v0.1.7 h1:60BLSyTrOV4/haCDW4zb1guZItoSq8foHCXrAnjBo/o= -github.com/google/s2a-go v0.1.7/go.mod h1:50CgR4k1jNlWBu4UfS4AcfhVe1r6pdZPygJ3R8F0Qdw= +github.com/google/s2a-go v0.1.8 h1:zZDs9gcbt9ZPLV0ndSyQk6Kacx2g/X+SKYovpnz3SMM= +github.com/google/s2a-go v0.1.8/go.mod h1:6iNWHTpQ+nfNRN5E00MSdfDwVesa8hhS32PhPO8deJA= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -744,38 +695,34 @@ github.com/googleapis/gax-go/v2 v2.3.0/go.mod h1:b8LNqSzNabLiUpXKkY7HAR5jr6bIT99 github.com/googleapis/gax-go/v2 v2.4.0/go.mod h1:XOTVJ59hdnfJLIP/dh8n5CGryZR2LxK9wbMD5+iXC6c= github.com/googleapis/gax-go/v2 v2.5.1/go.mod h1:h6B0KMMFNtI2ddbGJn3T3ZbwkeT6yqEF02fYlzkUCyo= github.com/googleapis/gax-go/v2 v2.6.0/go.mod h1:1mjbznJAPHFpesgE5ucqfYEscaz5kMdcIDwU/6+DDoY= -github.com/googleapis/gax-go/v2 v2.12.0 h1:A+gCJKdRfqXkr+BIRGtZLibNXf0m1f9E4HG56etFpas= -github.com/googleapis/gax-go/v2 v2.12.0/go.mod h1:y+aIqrI5eb1YGMVJfuV3185Ts/D7qKpsEkdD5+I6QGU= +github.com/googleapis/gax-go/v2 v2.13.0 h1:yitjD5f7jQHhyDsnhKEBU52NdvvdSeGzlAnDPT0hH1s= +github.com/googleapis/gax-go/v2 v2.13.0/go.mod h1:Z/fvTZXF8/uw7Xu5GuslPw+bplx6SS338j1Is2S+B7A= github.com/googleapis/go-type-adapters v1.0.0/go.mod h1:zHW75FOG2aur7gAO2B+MLby+cLsWGBF62rFAi7WjWO4= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= -github.com/gorilla/handlers v1.5.1 h1:9lRY6j8DEeeBT10CvO9hGW0gmky0BprnvDI5vfhUHH4= -github.com/gorilla/handlers v1.5.1/go.mod h1:t8XrUpc4KVXb7HGyJ4/cEnwQiaxrX/hz1Zv/4g96P1Q= +github.com/gorilla/handlers v1.5.2 h1:cLTUSsNkgcwhgRqvCNmdbRWG0A3N4F+M2nWKdScwyEE= +github.com/gorilla/handlers v1.5.2/go.mod h1:dX+xVpaxdSw+q0Qek8SSsl3dfMk3jNddUkMzo0GtH0w= github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= -github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= -github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= +github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY= +github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ= github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/graph-gophers/graphql-go v1.3.0/go.mod h1:9CQHMSxwO4MprSdzoIEobiHpoLtHm77vfxsvsIN5Vuc= +github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg= +github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/goware/urlx v0.3.2 h1:gdoo4kBHlkqZNaf6XlQ12LGtQOmpKJrR04Rc3RnpJEo= +github.com/goware/urlx v0.3.2/go.mod h1:h8uwbJy68o+tQXCGZNa9D73WN8n0r9OBae5bUnLcgjw= github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-middleware v1.2.2/go.mod h1:EaizFBKfUKtMIF5iaDEhniwNedqGo9FuLFzppDr3uwI= -github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 h1:+9834+KizmvFV7pXQGSXQTsaWhq2GjuNUt0aUU0YBYw= -github.com/grpc-ecosystem/go-grpc-middleware v1.3.0/go.mod h1:z0ButlSOZa5vEBq9m2m2hlwIgKw+rp3sdCBRoJY+30Y= +github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 h1:UH//fgunKIs4JdUbpDl1VZCDaL56wXCB/5+wF6uHfaI= +github.com/grpc-ecosystem/go-grpc-middleware v1.4.0/go.mod h1:g5qyo/la0ALbONm6Vbp88Yd8NsDy6rZz+RcrMPxvld8= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c h1:6rhixN/i8ZofjG1Y75iExal34USq5p+wiN1tpie8IrU= github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c/go.mod h1:NMPJylDgVpX0MLRlPy15sqSwOFv/U1GZ2m21JhFfek0= -github.com/gtank/merlin v0.1.1-0.20191105220539-8318aed1a79f/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= -github.com/gtank/merlin v0.1.1 h1:eQ90iG7K9pOhtereWsmyRJ6RAwcP4tHTDBHXNg+u5is= -github.com/gtank/merlin v0.1.1/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= -github.com/gtank/ristretto255 v0.1.2 h1:JEqUCPA1NvLq5DwYtuzigd7ss8fwbYay9fi4/5uMzcc= -github.com/gtank/ristretto255 v0.1.2/go.mod h1:Ph5OpO6c7xKUGROZfWVLiJf9icMDwUeIvY4OmlYW69o= github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE= github.com/hashicorp/consul/sdk v0.3.0/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= @@ -785,13 +732,19 @@ github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtng github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= -github.com/hashicorp/go-getter v1.7.5 h1:dT58k9hQ/vbxNMwoI5+xFYAJuv6152UNvdHokfI5wE4= -github.com/hashicorp/go-getter v1.7.5/go.mod h1:W7TalhMmbPmsSMdNjD0ZskARur/9GJ17cfHTRtXV744= +github.com/hashicorp/go-getter v1.7.6 h1:5jHuM+aH373XNtXl9TNTUH5Qd69Trve11tHIrB+6yj4= +github.com/hashicorp/go-getter v1.7.6/go.mod h1:W7TalhMmbPmsSMdNjD0ZskARur/9GJ17cfHTRtXV744= +github.com/hashicorp/go-hclog v1.5.0 h1:bI2ocEMgcVlz55Oj1xZNBsVi900c7II+fWDyV9o+13c= +github.com/hashicorp/go-hclog v1.5.0/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= github.com/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJFeZnpfm2KLowc= github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= +github.com/hashicorp/go-metrics v0.5.3 h1:M5uADWMOGCTUNU1YuC4hfknOeHNaX54LDm4oYSucoNE= +github.com/hashicorp/go-metrics v0.5.3/go.mod h1:KEjodfebIOuBYSAe/bHTm+HChmKSxAOXPBieMLYozDE= github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= +github.com/hashicorp/go-plugin v1.6.0 h1:wgd4KxHJTVGGqWBq4QPB1i5BZNEx9BR8+OFmHDmTk8A= +github.com/hashicorp/go-plugin v1.6.0/go.mod h1:lBS5MtSSBZk0SHc66KACcjjlU6WzEVP/8pwz68aMkCI= github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= github.com/hashicorp/go-safetemp v1.0.0 h1:2HR189eFNrjHQyENnQMMpCiBAsRxzbTMIgBhEyExpmo= @@ -799,15 +752,16 @@ github.com/hashicorp/go-safetemp v1.0.0/go.mod h1:oaerMy3BhqiTbVye6QuFhFtIceqFoD github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-uuid v1.0.1 h1:fv1ep09latC32wFoVwnqcnKJGnMSdBanPczbHAYm1BE= github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-uuid v1.0.2 h1:cfejS+Tpcp13yd5nYHWDI6qVCny6wyX2Mt5SGur2IGE= +github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= -github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek= github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= +github.com/hashicorp/go-version v1.7.0 h1:5tqGy27NaOTB8yJKUZELlFAS/LTKJkrmONwQKeRZfjY= +github.com/hashicorp/go-version v1.7.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/hashicorp/golang-lru v1.0.2 h1:dV3g9Z/unq5DpblPpw+Oqcv4dU/1omnb4Ok8iPY6p1c= github.com/hashicorp/golang-lru v1.0.2/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k= @@ -818,50 +772,41 @@ github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= -github.com/hdevalence/ed25519consensus v0.1.0 h1:jtBwzzcHuTmFrQN6xQZn6CQEO/V9f7HsjsjeEZ6auqU= -github.com/hdevalence/ed25519consensus v0.1.0/go.mod h1:w3BHWjwJbFU29IRHL1Iqkw3sus+7FctEyM4RqDxYNzo= +github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE= +github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ= +github.com/hdevalence/ed25519consensus v0.2.0 h1:37ICyZqdyj0lAZ8P4D1d1id3HqbbG1N3iBb1Tb4rdcU= +github.com/hdevalence/ed25519consensus v0.2.0/go.mod h1:w3BHWjwJbFU29IRHL1Iqkw3sus+7FctEyM4RqDxYNzo= github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZKVu0fao= github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iURXE7ZOP9L9hSkA= -github.com/holiman/uint256 v1.2.0/go.mod h1:y4ga/t+u+Xwd7CpDgZESaRcWy0I7XMlTMA25ApIH5Jw= -github.com/holiman/uint256 v1.2.1 h1:XRtyuda/zw2l+Bq/38n5XUoEF72aSOu/77Thd9pPp2o= -github.com/holiman/uint256 v1.2.1/go.mod h1:y4ga/t+u+Xwd7CpDgZESaRcWy0I7XMlTMA25ApIH5Jw= +github.com/holiman/uint256 v1.2.4 h1:jUc4Nk8fm9jZabQuqr2JzednajVmBpC+oiTiXZJEApU= +github.com/holiman/uint256 v1.2.4/go.mod h1:EOMSn4q6Nyt9P6efbI3bueV4e1b3dGlUCXeiRV4ng7E= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/huandu/go-assert v1.1.5 h1:fjemmA7sSfYHJD7CUqs9qTwwfdNAx7/j2/ZlHXzNB3c= github.com/huandu/go-assert v1.1.5/go.mod h1:yOLvuqZwmcHIC5rIzrBhT7D3Q9c3GFnd0JrPVhn/06U= -github.com/huandu/skiplist v1.2.0 h1:gox56QD77HzSC0w+Ws3MH3iie755GBJU1OER3h5VsYw= -github.com/huandu/skiplist v1.2.0/go.mod h1:7v3iFjLcSAzO4fN5B8dvebvo/qsfumiLiDXMrPiHF9w= +github.com/huandu/skiplist v1.2.1 h1:dTi93MgjwErA/8idWTzIw4Y1kZsMWx35fmI2c8Rij7w= +github.com/huandu/skiplist v1.2.1/go.mod h1:7v3iFjLcSAzO4fN5B8dvebvo/qsfumiLiDXMrPiHF9w= github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= -github.com/huin/goupnp v1.0.3 h1:N8No57ls+MnjlB+JPiCVSOyy/ot7MJTqlo7rn+NYSqQ= -github.com/huin/goupnp v1.0.3/go.mod h1:ZxNlw5WqJj6wSsRK5+YfflQGXYfccj5VgQsMNixHM7Y= -github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o= -github.com/iancoleman/orderedmap v0.2.0 h1:sq1N/TFpYH++aViPcaKjys3bDClUEU7s5B+z6jq8pNA= -github.com/iancoleman/orderedmap v0.2.0/go.mod h1:N0Wam8K1arqPXNWjMo21EXnBPOPp36vB07FNRdD2geA= +github.com/huin/goupnp v1.3.0 h1:UvLUlWDNpoUdYzb2TCn+MuTWtcjXKSza2n6CBdQ0xXc= +github.com/huin/goupnp v1.3.0/go.mod h1:gnGPsThkYa7bFi/KWmEysQRf48l2dvR5bxr2OFckNX8= +github.com/iancoleman/orderedmap v0.3.0 h1:5cbR2grmZR/DiVt+VJopEhtVs9YGInGIxAoMJn+Ichc= +github.com/iancoleman/orderedmap v0.3.0/go.mod h1:XuLcCUkdL5owUCQeF2Ue9uuw1EptkJDkXXS7VoV7XGE= +github.com/iancoleman/strcase v0.3.0 h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSASxEI= +github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/ianlancetaylor/demangle v0.0.0-20220319035150-800ac71e25c2/go.mod h1:aYm2/VgdVmcIU8iMfdMvDMsRAQjcfZSKFby6HOFvi/w= github.com/improbable-eng/grpc-web v0.15.0 h1:BN+7z6uNXZ1tQGcNAuaU1YjsLTApzkjt2tzCixLaUPQ= github.com/improbable-eng/grpc-web v0.15.0/go.mod h1:1sy9HKV4Jt9aEs9JSnkWlRJPuPtwNr0l57L4f878wP8= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= -github.com/influxdata/flux v0.65.1/go.mod h1:J754/zds0vvpfwuq7Gc2wRdVwEodfpCFM7mYlOw2LqY= -github.com/influxdata/influxdb v1.8.3/go.mod h1:JugdFhsvvI8gadxOI6noqNeeBHvWNTbfYGtiAn+2jhI= -github.com/influxdata/influxdb-client-go/v2 v2.4.0/go.mod h1:vLNHdxTJkIf2mSLvGrpj8TCcISApPoXkaxP8g9uRlW8= github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= -github.com/influxdata/influxql v1.1.1-0.20200828144457-65d3ef77d385/go.mod h1:gHp9y86a/pxhjJ+zMjNXiQAA197Xk9wLxaz+fGG+kWk= -github.com/influxdata/line-protocol v0.0.0-20180522152040-32c6aa80de5e/go.mod h1:4kt73NQhadE3daL3WhR5EJ/J2ocX0PZzwxQ0gXJ7oFE= -github.com/influxdata/line-protocol v0.0.0-20200327222509-2487e7298839/go.mod h1:xaLFMmpvUxqXtVkUJfg9QmT88cDaCJ3ZKgdZ78oO8Qo= -github.com/influxdata/line-protocol v0.0.0-20210311194329-9aa0e372d097/go.mod h1:xaLFMmpvUxqXtVkUJfg9QmT88cDaCJ3ZKgdZ78oO8Qo= -github.com/influxdata/promql/v2 v2.12.0/go.mod h1:fxOPu+DY0bqCTCECchSRtWfc+0X19ybifQhZoQNF5D8= -github.com/influxdata/roaring v0.4.13-0.20180809181101-fc520f41fab6/go.mod h1:bSgUQ7q5ZLSO+bKBGqJiCBGAl+9DxyW63zLTujjUlOE= -github.com/influxdata/tdigest v0.0.0-20181121200506-bf2b5ad3c0a9/go.mod h1:Js0mqiSBE6Ffsg94weZZ2c+v/ciT8QRHFOap7EKDrR0= -github.com/influxdata/usage-client v0.0.0-20160829180054-6d3895376368/go.mod h1:Wbbw6tYNvwa5dlB6304Sd+82Z3f7PmVZHVKU637d4po= github.com/jackpal/go-nat-pmp v1.0.2 h1:KzKSgb7qkJvOUTqYl9/Hg/me3pWgBmERKrTGD7BdWus= github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= -github.com/jedisct1/go-minisign v0.0.0-20190909160543-45766022959e/go.mod h1:G1CVv03EnqU1wYL2dFwXxW2An0az9JTl/ZsqXQeBlkU= github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jhump/protoreflect v1.15.1 h1:HUMERORf3I3ZdX05WaQ6MIpd/NJ434hTp5YiKgfCL6c= -github.com/jhump/protoreflect v1.15.1/go.mod h1:jD/2GMKKE6OqX8qTjhADU1e6DShO+gavG9e0Q693nKo= +github.com/jhump/protoreflect v1.15.3 h1:6SFRuqU45u9hIZPJAoZ8c28T3nK64BNdp9w6jFonzls= +github.com/jhump/protoreflect v1.15.3/go.mod h1:4ORHmSBmlCW8fh3xHmJMGyul1zNqZK4Elxc8qKP+p1k= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= @@ -877,43 +822,32 @@ github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/u github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= -github.com/jsternberg/zap-logfmt v1.0.0/go.mod h1:uvPs/4X51zdkcm5jXl5SYoN+4RK21K8mysFmDaM/h+o= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= -github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes= -github.com/jwilder/encoding v0.0.0-20170811194829-b4e1701a28ef/go.mod h1:Ct9fl0F6iIOGgxJ5npU/IUOhOhqlVrGjyIZc8/MagT0= -github.com/karalabe/usb v0.0.2/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU= -github.com/kava-labs/cometbft v0.37.9-kava.1 h1:0mMsAhpV8p0peD9sabIZ//M4nP6LiiZ0o34gfuHdANY= -github.com/kava-labs/cometbft v0.37.9-kava.1/go.mod h1:j0Q3RqrCd+cztWCugs3obbzC4NyHGBPZZjtm/fWV00I= -github.com/kava-labs/cometbft-db v0.9.1-kava.2 h1:ZQaio886ifvml9XtJB4IYHhlArgA3+/a5Zwidg7H2J8= -github.com/kava-labs/cometbft-db v0.9.1-kava.2/go.mod h1:PvUZbx7zeR7I4CAvtKBoii/5ia5gXskKjDjIVpt7gDw= -github.com/kava-labs/cosmos-sdk v0.47.10-iavl-v1-kava.1 h1:vQwrm3sdAG1pkwrsi2mmCHSGDje5fzUR6vApEux/nVA= -github.com/kava-labs/cosmos-sdk v0.47.10-iavl-v1-kava.1/go.mod h1:OwLYEBcsnijCLE8gYkwQ7jycZZ/Acd+a83pJU+V+MKw= -github.com/kava-labs/ethermint v0.21.1-0.20240802224012-586960857184 h1:MWwCXFnkagXk93QiiD41I+S9wyrHZUQWLRFKo2tXL6A= -github.com/kava-labs/ethermint v0.21.1-0.20240802224012-586960857184/go.mod h1:kbyr3La2Co3Hy3U3N2EvVk7W1srQ2x88JUpgsu2KrXo= +github.com/kava-labs/cometbft v0.0.0-20241024200036-527d8df9ff12 h1:RqnpnEGEuykjY3XWSLMuMwjUOiJ6cr7gSznAW/tgTQ4= +github.com/kava-labs/cometbft v0.0.0-20241024200036-527d8df9ff12/go.mod h1:5awmm7t/X8LJ+Wd7/TXHcv4hLfFLcexy6fdS9WvOepA= +github.com/kava-labs/cometbft-db v0.0.0-20241007145430-b2740b2e4bed h1:3FNJ3fcD9aA9oOwDphrSEJ8u2kBNj9YoYAwl16UKyv4= +github.com/kava-labs/cometbft-db v0.0.0-20241007145430-b2740b2e4bed/go.mod h1:buPRZKyVp+u5fmwN7tDtOk1zc5xA2z9BJJTy61tNnws= +github.com/kava-labs/cosmos-sdk v0.0.0-20241113023842-ac2790809d16 h1:v/1pHMyrNV7zPPz50Zof7YkB0SRamC4PDFNzqyW93BE= +github.com/kava-labs/cosmos-sdk v0.0.0-20241113023842-ac2790809d16/go.mod h1:Yf8jj8R5+9NWCbdot0IMId92WeAIF22Thc/pRR2hSoI= +github.com/kava-labs/ethermint v0.0.0-20241112214305-986ef503477d h1:AYN0gn9INsHew7bRtnwxmEsKCUjKiq+EPbuhe605/sA= +github.com/kava-labs/ethermint v0.0.0-20241112214305-986ef503477d/go.mod h1:Mr24kGiuG5TBUNS9d/velQrHofo3fdpz54aVL4bWeUM= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= -github.com/klauspost/compress v1.4.0/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= github.com/klauspost/compress v1.10.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.11.7/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.12.3/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= github.com/klauspost/compress v1.15.11/go.mod h1:QPwzmACJjUTFsnSHH934V6woptycfrDDJnH7hvFVbGM= -github.com/klauspost/compress v1.17.7 h1:ehO88t2UGzQK66LMdE8tibEd1ErmzZjNEqWkjLAKQQg= -github.com/klauspost/compress v1.17.7/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= -github.com/klauspost/cpuid v0.0.0-20170728055534-ae7887de9fa5 h1:2U0HzY8BJ8hVwDKIzp7y4voR9CX/nvcfymLmg2UiOio= -github.com/klauspost/cpuid v0.0.0-20170728055534-ae7887de9fa5/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= -github.com/klauspost/cpuid/v2 v2.0.9 h1:lgaqFMSdTdQYdZ04uHyN2d/eKdOMyi2YLSvlQIBFYa4= +github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= +github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= -github.com/klauspost/crc32 v0.0.0-20161016154125-cb6bfca970f6/go.mod h1:+ZoRqAPRLkC4NPOvfYeR5KNOrY6TD+/sAC3HXPZgDYg= -github.com/klauspost/pgzip v1.0.2-0.20170402124221-0bf5dcad4ada/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= @@ -926,41 +860,28 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/kylelemons/godebug v0.0.0-20170224010052-a616ab194758/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/labstack/echo/v4 v4.2.1/go.mod h1:AA49e0DZ8kk5jTOOCKNuPR6oTnBS0dYiM4FW1e6jwpg= -github.com/labstack/gommon v0.3.0/go.mod h1:MULnywXg0yavhxWKc+lOruYdAhDwPK9wf0OL7NoOu+k= -github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8= -github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w= github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= -github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/lib/pq v1.10.7 h1:p7ZhMD+KsSRozJr34udlUrhboJwWAgCg34+/ZZNvZZw= -github.com/lib/pq v1.10.7/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= +github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= +github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM= github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= -github.com/linxGnu/grocksdb v1.8.13 h1:X3Id7Obhf8qLY9WPc4LmmtIyabmdDf810XSFDnLlW7E= -github.com/linxGnu/grocksdb v1.8.13/go.mod h1:QYiYypR2d4v63Wj1adOOfzglnoII0gLj3PNh4fZkcFA= -github.com/lucasjones/reggen v0.0.0-20180717132126-cdb49ff09d77/go.mod h1:5ELEyG+X8f+meRWHuqUOewBOhvHkl7M76pdGEansxW4= +github.com/linxGnu/grocksdb v1.9.3 h1:s1cbPcOd0cU2SKXRG1nEqCOWYAELQjdqg3RVI2MH9ik= +github.com/linxGnu/grocksdb v1.9.3/go.mod h1:QYiYypR2d4v63Wj1adOOfzglnoII0gLj3PNh4fZkcFA= github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= -github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= -github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/manifoldco/promptui v0.9.0 h1:3V4HzJk1TtXW1MTZMP7mdlwbBpIinw3HztaIlYthEiA= github.com/manifoldco/promptui v0.9.0/go.mod h1:ka04sppxSGFAtxX0qhlYQjISsg9mR4GWtQEhdbn6Pgg= -github.com/matryer/moq v0.0.0-20190312154309-6cfb0558e1bd/go.mod h1:9ELz6aaclSIGnZBoaSLZ3NAl1VTufbOrXBPvtcy6WiQ= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= -github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= -github.com/mattn/go-colorable v0.1.7/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= @@ -969,21 +890,14 @@ github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= -github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= -github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= -github.com/mattn/go-sqlite3 v1.11.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= -github.com/mattn/go-tty v0.0.0-20180907095812-13ff1204f104/go.mod h1:XPvLUNfbS4fJH25nqRHfWLMa1ONC8Amw+mIA639KxkE= +github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU= +github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= -github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= -github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643/go.mod h1:43+3pMjjKimDBf5Kr4ZFNGbLql1zKkbImw+fZbw3geM= -github.com/mimoo/StrobeGo v0.0.0-20210601165009-122bf33a46e0 h1:QRUSJEgZn2Snx0EmT/QLXibWjSUDjKWvXIT19NBVp94= -github.com/mimoo/StrobeGo v0.0.0-20210601165009-122bf33a46e0/go.mod h1:43+3pMjjKimDBf5Kr4ZFNGbLql1zKkbImw+fZbw3geM= -github.com/minio/highwayhash v1.0.2 h1:Aak5U0nElisjDCfPSG79Tgzkn2gl66NxOMspRrKnA/g= -github.com/minio/highwayhash v1.0.2/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY= +github.com/minio/highwayhash v1.0.3 h1:kbnuUMoHYyVl7szWjSxJnxw11k2U709jqFPPmIUyD6Q= +github.com/minio/highwayhash v1.0.3/go.mod h1:GGYsuwP/fPD6Y9hMiXuapVvlIUEhFhMTh0rxU3ik1LQ= github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= @@ -995,29 +909,23 @@ github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS4 github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/mitchellh/mapstructure v1.4.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/pointerstructure v1.2.0 h1:O+i9nHnXS3l/9Wu7r4NrEdwA2VFTicjUEN1uBnDo34A= github.com/mitchellh/pointerstructure v1.2.0/go.mod h1:BRAsLI5zgXmw97Lf6s25bs8ohIXc3tViBH44KcwB2g4= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= -github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= -github.com/mschoch/smat v0.0.0-20160514031455-90eadee771ae/go.mod h1:qAyveg+e4CE+eKJXWVjKXM4ck2QobLqTDytGJbLLhJg= github.com/mtibben/percent v0.2.1 h1:5gssi8Nqo8QU/r2pynCm+hBQHpkB/uNK7BJCFogWdzs= github.com/mtibben/percent v0.2.1/go.mod h1:KG9uO+SZkUp+VkRHsCdYQV3XSZrrSpR3O9ibNBTZrns= +github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= +github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f h1:KUppIJq7/+SVif2QVs3tOP0zanoHgBEVAwHxUSIzRqU= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mwitkow/grpc-proxy v0.0.0-20181017164139-0f1106ef9c76/go.mod h1:x5OoJHDHqxHS801UIuhqGl6QdSAEJvtausosHSdazIo= -github.com/naoina/go-stringutil v0.1.0/go.mod h1:XJ2SJL9jCtBh+P9q5btrd/Ylo8XwT/h1USek5+NqSA0= -github.com/naoina/toml v0.1.2-0.20170918210437-9fafd6967416/go.mod h1:NBIhNtsFMo3G2szEBne+bO4gS192HuIYRqfvOWb4i1E= github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg= github.com/nats-io/jwt v0.3.2/go.mod h1:/euKqTS1ZD+zzjYrY7pseZrTtWQSjujC7xjPc8wL6eU= github.com/nats-io/nats-server/v2 v2.1.2/go.mod h1:Afk+wRZqkMQs/p45uXdrVLuab3gwv3Z8C4HTBu8GD/k= @@ -1025,20 +933,22 @@ github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzE github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= -github.com/neilotoole/errgroup v0.1.6/go.mod h1:Q2nLGf+594h0CLBs/Mbg6qOr7GtqDK7C2S41udRnToE= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= +github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a h1:dlRvE5fWabOchtH7znfiFCcOvmIYgOeAS5ifBXBlh9Q= +github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a/go.mod h1:hVoHR2EVESiICEMbg137etN/Lx+lSrHPTD39Z/uE+2s= github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs= github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= +github.com/oklog/run v1.1.0 h1:GEenZ1cK0+q0+wsJew9qUg/DyD8k3JzYsZAi5gYi2mA= +github.com/oklog/run v1.1.0/go.mod h1:sVPdnTZT1zYwAJeCMu2Th4T21pA3FPOQRfWjQlk7DVU= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.10.3/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= github.com/onsi/ginkgo v1.16.4 h1:29JGrr5oVBm5ulCWet69zQkzWipVXIol6ygQUe/EzNc= @@ -1061,7 +971,6 @@ github.com/opencontainers/runc v1.1.3/go.mod h1:1J5XiS+vdZ3wCyZybsuxXZWGrgSr8fFJ github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis= github.com/opentracing/basictracer-go v1.0.0/go.mod h1:QfBfYuafItcjQuMwinw9GhYKwFXS9KnPs5lxoYwgW74= github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/opentracing/opentracing-go v1.0.3-0.20180606204148-bd9c31933947/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/openzipkin-contrib/zipkin-go-opentracing v0.4.5/go.mod h1:/wsWhb9smxSfWAKL3wpBW7V8scJMt8N8gnaMCS9E/cA= github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw= @@ -1073,19 +982,14 @@ github.com/pact-foundation/pact-go v1.0.4/go.mod h1:uExwJY4kCzNPcHRj+hCR/HBbOOIw github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/paulbellamy/ratecounter v0.2.0/go.mod h1:Hfx1hDpSGoqxkVVpBi/IlYD7kChlfo5C6hzIHwPqfFE= github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pelletier/go-toml/v2 v2.0.6/go.mod h1:eumQOmlWiOPt5WriQQqoM5y18pDHwha2N+QD+EUNTek= -github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4= -github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= +github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M= +github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc= github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= -github.com/peterh/liner v1.0.1-0.20180619022028-8c1271fcf47f/go.mod h1:xIteQHvHuaLYG9IFj6mSxM0fCKrs34IrEQUhOYuGPHc= -github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7/go.mod h1:CRroGNssyjTd/qIG2FyxByd2S8JEAZXBl4qUrZf8GS0= -github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= -github.com/petermattis/goid v0.0.0-20231207134359-e60b3f734c67 h1:jik8PHtAIsPlCRJjJzl4udgEf7hawInF9texMeO2jrU= -github.com/petermattis/goid v0.0.0-20231207134359-e60b3f734c67/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= -github.com/philhofer/fwd v1.0.0/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU= +github.com/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7 h1:Dx7Ovyv/SFnMFw3fD4oEoeorXc6saIiQ23LrGLth0Gw= +github.com/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4= @@ -1096,7 +1000,6 @@ github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA= -github.com/pkg/term v0.0.0-20180730021639-bffc007b7fd5/go.mod h1:eCbImbZ95eXtAUIbLAuAVnBnwf83mjf6QIVH8SHYwqQ= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= @@ -1107,8 +1010,8 @@ github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5Fsn github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= -github.com/prometheus/client_golang v1.14.0 h1:nJdhIvne2eSX/XRAFV9PcvFFRbrjbcTUj0VP62TMhnw= -github.com/prometheus/client_golang v1.14.0/go.mod h1:8vpkKitgIVNcqrRBWh1C4TIUQgYNtG/XQE4E/Zae36Y= +github.com/prometheus/client_golang v1.20.4 h1:Tgh3Yr67PaOv/uTqloMsCEdeuFTatm5zIq5+qNN23vI= +github.com/prometheus/client_golang v1.20.4/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= @@ -1120,21 +1023,20 @@ github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQy github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.6.0/go.mod h1:eBmuwkDJBwy6iBfxCBob6t6dR6ENT/y+J+Zk0j9GMYc= github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= -github.com/prometheus/common v0.42.0 h1:EKsfXEYo4JpWMHH5cg+KOUWeuJSov1Id8zGR8eeI1YM= -github.com/prometheus/common v0.42.0/go.mod h1:xBwqVerjNdUDjgODMpudtOMwlOwf2SaTr1yjz4b7Zbc= +github.com/prometheus/common v0.60.0 h1:+V9PAREWNvJMAuJ1x1BaWl9dewMW4YrHZQbx0sJNllA= +github.com/prometheus/common v0.60.0/go.mod h1:h0LYf1R1deLSKtD4Vdg8gy4RuOvENW2J/h19V5NADQw= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/procfs v0.3.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= -github.com/prometheus/procfs v0.13.0 h1:GqzLlQyfsPbaEHaQkO7tbDlriv/4o5Hudv6OXHGKX7o= -github.com/prometheus/procfs v0.13.0/go.mod h1:cd4PFCR54QLnGKPaKGA6l+cfuNXtht43ZKY6tow0Y1g= +github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc= +github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= github.com/prometheus/tsdb v0.7.1 h1:YZcsG11NqnK4czYLrWd9mpEuAJIHVQLwdrleYfszMAA= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/rakyll/statik v0.1.7 h1:OF3QCZUuyPxuGEP7B4ypUa7sB/iHtqOTDYZXGM8KOdQ= @@ -1142,7 +1044,8 @@ github.com/rakyll/statik v0.1.7/go.mod h1:AlZONWzMtEnMs7W4e/1LURLiI49pIMmp6V9Ung github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 h1:N/ElC8H3+5XpJzTSTfLsJV/mx9Q9g7kxmchpfZyxgzM= github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= -github.com/retailnext/hllpp v1.0.1-0.20180308014038-101a6d2f8b52/go.mod h1:RDpi1RftBQPUCDRw6SmxeaREsAaRKnOclghuzp/WRzc= +github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= +github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rjeczalik/notify v0.9.1 h1:CLCKso/QK1snAlnhNR/CNvNiFU2saUtjV0bx3EwNeCE= github.com/rjeczalik/notify v0.9.1/go.mod h1:rKwnCoCGeuQnwBtTSPL9Dad03Vh2n40ePRrjvIXnJho= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= @@ -1154,11 +1057,11 @@ github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/f github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= -github.com/rs/cors v1.8.3 h1:O+qNyWn7Z+F9M0ILBHgMVPuB1xTOucVd5gtaYyXBpRo= -github.com/rs/cors v1.8.3/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= +github.com/rs/cors v1.11.1 h1:eU3gRzXLRK57F5rKMGMZURNdIG4EoAmX8k94r9wXWHA= +github.com/rs/cors v1.11.1/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= -github.com/rs/zerolog v1.32.0 h1:keLypqrlIjaFsbmJOBdB/qvyF8KEtCWHwobLp5l/mQ0= -github.com/rs/zerolog v1.32.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= +github.com/rs/zerolog v1.33.0 h1:1cU2KZkvPxNyfgEmhHAz/1A9Bz+llsdYzklWFzgp0r8= +github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= github.com/russross/blackfriday v1.5.2 h1:HyvC0ARfnZBqnXwABFeSZHpKvJHJJfPz81GNueLj0oo= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= @@ -1170,13 +1073,9 @@ github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgY github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= -github.com/sasha-s/go-deadlock v0.3.1 h1:sqv7fDNShgjcaxkO0JNcOAlr8B9+cV5Ey/OB71efZx0= -github.com/sasha-s/go-deadlock v0.3.1/go.mod h1:F73l+cr82YSh10GxyRI6qZiCgK64VaZjwesgfQ1/iLM= +github.com/sasha-s/go-deadlock v0.3.5 h1:tNCOEEDG6tBqrNDOX35j/7hL5FcFViG6awUGROb2NsU= +github.com/sasha-s/go-deadlock v0.3.5/go.mod h1:bugP6EGbdGYObIlx7pUZtWqlvo8k9H6vCBBsiChJQ5U= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= -github.com/segmentio/fasthash v1.0.3/go.mod h1:waKX8l2N8yckOgmSsXJi7x1ZfdKZ4x7KRMzBtS3oedY= -github.com/segmentio/kafka-go v0.1.0/go.mod h1:X6itGqS9L4jDletMsxZ7Dz+JFWxM6JHfPOCvTvk+EJo= -github.com/segmentio/kafka-go v0.2.0/go.mod h1:X6itGqS9L4jDletMsxZ7Dz+JFWxM6JHfPOCvTvk+EJo= -github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible h1:Bn1aCHHRnjv4Bl16T8rcaFjYSrGrIZvpiGO6P3Q4GpU= github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= @@ -1199,21 +1098,20 @@ github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0= -github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= +github.com/spf13/cast v1.7.0 h1:ntdiHjuueXFgm5nzDRdOS4yfT43P5Fnud6DH50rz/7w= +github.com/spf13/cast v1.7.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= -github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0= -github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho= +github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM= +github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= -github.com/spf13/viper v1.18.2 h1:LUXCnvUvSM6FXAsj6nnfc8Q2tp1dIgUfY9Kc8GsSOiQ= -github.com/spf13/viper v1.18.2/go.mod h1:EKmWIqdnk5lOcmR72yw6hS+8OPYcwD0jteitLMVB+yk= -github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4/go.mod h1:RZLeN1LMWmRsyYjvAu+I6Dm9QmlDaIIt+Y+4Kd7Tp+Q= +github.com/spf13/viper v1.19.0 h1:RWq5SEjt8o25SROyN3z2OrDB9l7RPd3lwTWU8EcEdcI= +github.com/spf13/viper v1.19.0/go.mod h1:GQUN9bilAbhU/jgc1bKs99f/suXKeUMct8Adx5+Ntkg= github.com/status-im/keycard-go v0.2.0 h1:QDLFswOQu1r5jsycloeQh3bVU8n/NatHHaZobtDnDzA= github.com/status-im/keycard-go v0.2.0/go.mod h1:wlp8ZLbsmrF6g6WjugPAx+IzoLrkdf9+mHxBEeo3Hbg= github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= @@ -1225,7 +1123,6 @@ github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSS github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= -github.com/stretchr/testify v1.2.0/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= @@ -1241,71 +1138,48 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= -github.com/supranational/blst v0.3.8-0.20220526154634-513d2456b344/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= github.com/tendermint/go-amino v0.16.0 h1:GyhmgQKvqF82e2oZeuMSp9JTN0N09emoSZlb2lyGa2E= github.com/tendermint/go-amino v0.16.0/go.mod h1:TQU0M1i/ImAo+tYpZi73AU3V/dKeCoMC9Sphe2ZwGME= github.com/tidwall/btree v1.7.0 h1:L1fkJH/AuEh5zBnnBbmTwQ5Lt+bRJ5A8EWecslvo9iI= github.com/tidwall/btree v1.7.0/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EUQ2cKY= -github.com/tidwall/gjson v1.12.1/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= -github.com/tidwall/gjson v1.14.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= -github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= -github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= -github.com/tidwall/sjson v1.2.4/go.mod h1:098SZ494YoMWPmMO6ct4dcFnqxwj9r/gF0Etp19pSNM= -github.com/tinylib/msgp v1.0.2/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDWklFE= -github.com/tklauser/go-sysconf v0.3.5/go.mod h1:MkWzOF4RMCshBAMXuhXJs64Rte09mITnppBXY/rYEFI= -github.com/tklauser/go-sysconf v0.3.10 h1:IJ1AZGZRWbY8T5Vfk04D9WOA5WSejdflXxP03OUqALw= -github.com/tklauser/go-sysconf v0.3.10/go.mod h1:C8XykCvCb+Gn0oNCWPIlcb0RuglQTYaQ2hGm7jmxEFk= -github.com/tklauser/numcpus v0.2.2/go.mod h1:x3qojaO3uyYt0i56EW/VUYs7uBvdl2fkfZFu0T9wgjM= -github.com/tklauser/numcpus v0.4.0 h1:E53Dm1HjH1/R2/aoCtXtPgzmElmn51aOkhCFSuZq//o= -github.com/tklauser/numcpus v0.4.0/go.mod h1:1+UI3pD8NW14VMwdgJNJ1ESk2UnwhAnz5hMwiKKqXCQ= +github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU= +github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI= +github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk= +github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY= github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= -github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= -github.com/tyler-smith/go-bip39 v1.0.1-0.20181017060643-dbb3b84ba2ef/go.mod h1:sJ5fKU0s6JVwZjjcUEX2zFOnvq0ASQ2K9Zr6cf67kNs= -github.com/tyler-smith/go-bip39 v1.0.2/go.mod h1:sJ5fKU0s6JVwZjjcUEX2zFOnvq0ASQ2K9Zr6cf67kNs= github.com/tyler-smith/go-bip39 v1.1.0 h1:5eUemwrMargf3BSLRRCalXT93Ns6pQJIjYQN2nyfOP8= github.com/tyler-smith/go-bip39 v1.1.0/go.mod h1:gUYDtqQw1JS3ZJ8UWVcGTGqqr6YIN3CWg+kkNaLt55U= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= -github.com/ugorji/go/codec v1.2.9 h1:rmenucSohSTiyL09Y+l2OCk+FrMxGMzho2+tjr5ticU= github.com/ugorji/go/codec v1.2.9/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= github.com/ulikunitz/xz v0.5.10/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= -github.com/ulikunitz/xz v0.5.11 h1:kpFauv27b6ynzBNT/Xy+1k+fK4WswhN/6PN5WhFAGw8= -github.com/ulikunitz/xz v0.5.11/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= +github.com/ulikunitz/xz v0.5.12 h1:37Nm15o69RwBkXM0J6A5OlE67RZTfzUxTj8fB3dfcsc= +github.com/ulikunitz/xz v0.5.12/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= github.com/urfave/cli v1.22.1 h1:+mkCCcOFKPnCmVYVcURKps1Xe+3zP90gSYGNfRkjoIY= github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= -github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI= github.com/urfave/cli/v2 v2.10.2 h1:x3p8awjp/2arX+Nl/G2040AZpOCHS/eMJJ1/a+mye4Y= github.com/urfave/cli/v2 v2.10.2/go.mod h1:f8iq5LtQ/bLxafbdBSLPPNsgaW0l/2fYYEHhAyPlwvo= -github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= -github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8= -github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= -github.com/vmihailenco/msgpack/v5 v5.3.5/go.mod h1:7xyJ9e+0+9SaZT0Wt1RGleJXzli6Q/V5KbhBonMG9jc= -github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds= -github.com/willf/bitset v1.1.3/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= -github.com/xlab/treeprint v0.0.0-20180616005107-d6fb6747feb6/go.mod h1:ce1O1j6UtZfjr22oyGxGLbauSBp2YVXpARAosm7dHBg= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU= github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8= -github.com/ybbus/jsonrpc v2.1.2+incompatible/go.mod h1:XJrh1eMSzdIYFbM08flv0wp5G35eRniyeGut1z+LSiE= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/zondax/hid v0.9.2 h1:WCJFnEDMiqGF64nlZz28E9qLVZ0KSJ7xpc5DLEyma2U= github.com/zondax/hid v0.9.2/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM= github.com/zondax/ledger-go v0.14.3 h1:wEpJt2CEcBJ428md/5MgSLsXLBos98sBOyxNmCjfUCw= github.com/zondax/ledger-go v0.14.3/go.mod h1:IKKaoxupuB43g4NxeQmbLXv7T9AlQyie1UpHb342ycI= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= -go.etcd.io/bbolt v1.3.8 h1:xs88BrvEv273UsB79e0hcVrlUWmS0a8upikMFhSyAtA= -go.etcd.io/bbolt v1.3.8/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw= +go.etcd.io/bbolt v1.3.10 h1:+BqfJTcCzTItrop8mq/lbzL8wSGtj94UO/3U31shqG0= +go.etcd.io/bbolt v1.3.10/go.mod h1:bK3UQLPJZly7IlNmV7uVHJDxfe5aK9Ll93e/74Y9oEQ= go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= @@ -1318,65 +1192,66 @@ go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.47.0 h1:UNQQKPfTDe1J81ViolILjTKPr9WetKW6uei2hFgJmFs= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.47.0/go.mod h1:r9vWsPS/3AQItv3OSlEJ/E4mbrhUbbw18meOjArPtKQ= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0 h1:sv9kVfal0MK0wBMCOGr+HeJm9v803BkJxGrk2au7j08= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0/go.mod h1:SK2UL73Zy1quvRPonmOmRDiWk1KBV3LyIeeIxcEApWw= -go.opentelemetry.io/otel v1.22.0 h1:xS7Ku+7yTFvDfDraDIJVpw7XPyuHlB9MCiqqX5mcJ6Y= -go.opentelemetry.io/otel v1.22.0/go.mod h1:eoV4iAi3Ea8LkAEI9+GFT44O6T/D0GWAVFyZVCC6pMI= -go.opentelemetry.io/otel/metric v1.22.0 h1:lypMQnGyJYeuYPhOM/bgjbFM6WE44W1/T45er4d8Hhg= -go.opentelemetry.io/otel/metric v1.22.0/go.mod h1:evJGjVpZv0mQ5QBRJoBF64yMuOf4xCWdXjK8pzFvliY= -go.opentelemetry.io/otel/sdk v1.21.0 h1:FTt8qirL1EysG6sTQRZ5TokkU8d0ugCj8htOgThZXQ8= -go.opentelemetry.io/otel/sdk v1.21.0/go.mod h1:Nna6Yv7PWTdgJHVRD9hIYywQBRx7pbox6nwBnZIxl/E= -go.opentelemetry.io/otel/trace v1.22.0 h1:Hg6pPujv0XG9QaVbGOBVHunyuLcCC3jN7WEhPx83XD0= -go.opentelemetry.io/otel/trace v1.22.0/go.mod h1:RbbHXVqKES9QhzZq/fE5UnOSILqRt40a21sPw2He1xo= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0 h1:4Pp6oUg3+e/6M4C0A/3kJ2VYa++dsWVTtGgLVj5xtHg= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0/go.mod h1:Mjt1i1INqiaoZOMGR1RIUJN+i3ChKoFRqzrRQhlkbs0= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 h1:jq9TW8u3so/bN+JPT166wjOI6/vQPF6Xe7nMNIltagk= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0/go.mod h1:p8pYQP+m5XfbZm9fxtSKAbM6oIllS7s2AfxrChvc7iw= +go.opentelemetry.io/otel v1.28.0 h1:/SqNcYk+idO0CxKEUOtKQClMK/MimZihKYMruSMViUo= +go.opentelemetry.io/otel v1.28.0/go.mod h1:q68ijF8Fc8CnMHKyzqL6akLO46ePnjkgfIMIjUIX9z4= +go.opentelemetry.io/otel/metric v1.28.0 h1:f0HGvSl1KRAU1DLgLGFjrwVyismPlnuU6JD6bOeuA5Q= +go.opentelemetry.io/otel/metric v1.28.0/go.mod h1:Fb1eVBFZmLVTMb6PPohq3TO9IIhUisDsbJoL/+uQW4s= +go.opentelemetry.io/otel/sdk v1.24.0 h1:YMPPDNymmQN3ZgczicBY3B6sf9n62Dlj9pWD3ucgoDw= +go.opentelemetry.io/otel/sdk v1.24.0/go.mod h1:KVrIYw6tEubO9E96HQpcmpTKDVn9gdv35HoYiQWGDFg= +go.opentelemetry.io/otel/trace v1.28.0 h1:GhQ9cUuQGmNDd5BTCP2dAvv75RdMxEfTmYejp+lkx9g= +go.opentelemetry.io/otel/trace v1.28.0/go.mod h1:jPyXzNPg6da9+38HEwElrQiHlVMTnVfM3/yv2OlIHaI= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= -go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ= -go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= -go.uber.org/mock v0.2.0 h1:TaP3xedm7JaAgScZO7tlvlKrqT0p7I6OsdGB5YNSMDU= -go.uber.org/mock v0.2.0/go.mod h1:J0y0rp9L3xiff1+ZBfKxlC1fz2+aO16tw0tsDOixfuM= +go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= +go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= +go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= -go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI= -go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTVQ= +go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= +go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= +go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= -go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= -golang.org/x/arch v0.0.0-20210923205945-b76863e36670 h1:18EFjUmQOcUvxNYSkA6jO9VAiXCnxFY6NyDX0bHDmkU= +go.uber.org/zap v1.18.1/go.mod h1:xg/QME4nWcxGxrpdeYfq7UvYrLh66cuVKdrbD1XF/NI= golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190909091759-094676da4a83/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= -golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= -golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= golang.org/x/crypto v0.5.0/go.mod h1:NK/OQwhpMQP3MwtdjgLlYHnH9ebylxKWv3e0fK+mkQU= -golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30= -golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M= -golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb h1:xIApU0ow1zwMa2uL1VDNeQlNVFTWMQxZUZCMDy0Q4Us= -golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= -golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs= +golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw= +golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= +golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= +golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= +golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= +golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= +golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= +golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 h1:yixxcjnhBmY0nkL253HFVIm0JsFHwrHdT3Yh6szTnfY= +golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8/go.mod h1:jj3sYF3dwk5D+ghuXyeI3r5MFf+NT2An6/9dOA95KSI= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -1389,21 +1264,20 @@ golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPI golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= -golang.org/x/mod v0.6.0-dev.0.20211013180041-c96bc1413d57/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI= -golang.org/x/mod v0.11.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= -golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.18.0 h1:5+9lSbEzPSdWkH32vYPBwEpX8KwDbM52Ud9xBUvNlb0= +golang.org/x/mod v0.18.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1442,20 +1316,16 @@ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210220033124-5f55cee0dc0d/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220325170049-de3da57026de/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= @@ -1470,8 +1340,8 @@ golang.org/x/net v0.0.0-20221014081412-f15817d10f9b/go.mod h1:YDH+HFinaLZZlnHAfS golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w= -golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= +golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= +golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1497,8 +1367,8 @@ golang.org/x/oauth2 v0.0.0-20220822191816-0ebed06d0094/go.mod h1:h4gKUeWbJ4rQPri golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/oauth2 v0.1.0/go.mod h1:G9FE4dLTsbXUu90h/Pf85g4w1D+SSAgR+q46nJZ8M4A= -golang.org/x/oauth2 v0.17.0 h1:6m3ZPmLEFdVxKKWnKq4VqZ60gutO35zm+zrAHVmHyDQ= -golang.org/x/oauth2 v0.17.0/go.mod h1:OzPDGQiuQMguemayvdylqddI7qcD9lnSDb+1FiwQ5HA= +golang.org/x/oauth2 v0.23.0 h1:PbgcYx2W7i4LvjJWEbf0ngHV6qJYr86PkAV3bXdLEbs= +golang.org/x/oauth2 v0.23.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1513,8 +1383,8 @@ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= -golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= +golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1524,9 +1394,7 @@ golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190130150945-aca44879d564/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1536,10 +1404,10 @@ golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1547,7 +1415,6 @@ golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20191220142924-d4481acd189f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200107162124-548cf772de50/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1567,22 +1434,17 @@ golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200826173525-f9321e4c35a6/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210316164454-77fc1eacc6aa/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210420205809-ac73e9fd8988/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -1592,10 +1454,10 @@ golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210819135213-f52c844e1c1c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210908233432-aa78b53d3365/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -1615,22 +1477,23 @@ golang.org/x/sys v0.0.0-20220624220833-87e55d714810/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o= -golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= +golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/term v0.19.0 h1:+ThwsDv+tYfnJFhF4L8jITxu1tdTWRTZpdsWgEgjL6Q= -golang.org/x/term v0.19.0/go.mod h1:2CuTdWZ7KHSQwUzKva0cbMg6q2DMI3Mmxp+gKJbskEk= +golang.org/x/term v0.25.0 h1:WtHI/ltw4NvSUig5KARz9h521QvRC8RmF/cuYqifU24= +golang.org/x/term v0.25.0/go.mod h1:RPyXicDX+6vLxogjjRxjgD2TKtmAO6NZBsBRfrOLu7M= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1644,25 +1507,22 @@ golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= -golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20201208040808-7e3f01d25324/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= -golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/time v0.6.0 h1:eTDhh4ZXt5Qf0augr54TN6suAUudPcawVZeIAPU7D4U= +golang.org/x/time v0.6.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190206041539-40960b6deb8e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= @@ -1671,23 +1531,25 @@ golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBn golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191126055441-b0650ceb63d9/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200108203644-89082a384178/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= @@ -1714,11 +1576,9 @@ golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.8-0.20211029000441-d6a9af8af023/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA= -golang.org/x/tools v0.20.0 h1:hz/CVckiOxybQvFw6h7b/q80NTr9IUQb4s1IIzW7KNY= -golang.org/x/tools v0.20.0/go.mod h1:WvitBU7JJf6A4jOdg4S1tviW9bhUxkgeCui/0JHctQg= +golang.org/x/tools v0.22.0 h1:gqSGLZqv+AI9lIQzniJ0nZDRG5GBPsSi+DRNHWNz6yA= +golang.org/x/tools v0.22.0/go.mod h1:aCwcsjqvq7Yqt6TNyX7QMU2enbQ/Gt0bo6krSeEri+c= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -1726,14 +1586,7 @@ golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= -golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk= golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= -gonum.org/v1/gonum v0.0.0-20180816165407-929014505bf4/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo= -gonum.org/v1/gonum v0.0.0-20181121035319-3f7ecaa7e8ca/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo= -gonum.org/v1/gonum v0.6.0/go.mod h1:9mxDZsDKxgMAuccQkewq682L+0eCu4dCN2yonUJTCLU= -gonum.org/v1/netlib v0.0.0-20181029234149-ec6d1f5cefe6/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw= -gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw= -gonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b/go.mod h1:Wt8AAjI+ypCyYX3nZBvf6cAIx93T+c/OS2HFAYskSZc= google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= @@ -1783,8 +1636,8 @@ google.golang.org/api v0.96.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ google.golang.org/api v0.97.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= google.golang.org/api v0.98.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= google.golang.org/api v0.100.0/go.mod h1:ZE3Z2+ZOr87Rx7dqFsdRQkRBk36kDtp/h+QpHbB7a70= -google.golang.org/api v0.162.0 h1:Vhs54HkaEpkMBdgGdOT2P6F0csGG/vxDS0hWHJzmmps= -google.golang.org/api v0.162.0/go.mod h1:6SulDkfoBIg4NFmCuZ39XeeAgSHCPecfSUuDyYlAHs0= +google.golang.org/api v0.192.0 h1:PljqpNAfZaaSpS+TnANfnNAXKdzHM/B9bKhwRlo7JP0= +google.golang.org/api v0.192.0/go.mod h1:9VcphjvAxPKLmSxVSzPlSRXy/5ARMEw5bf58WoVXafQ= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -1793,8 +1646,6 @@ google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM= -google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= @@ -1802,7 +1653,6 @@ google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRn google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190530194941-fb225487d101/go.mod h1:z3L6/3dTEVtUr6QSP8miRzeRqwQOioJ9I66odjN4I7s= -google.golang.org/genproto v0.0.0-20190716160619-c506a9f90610/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= @@ -1810,7 +1660,6 @@ google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvx google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200108215221-bd8f9a0ef82f/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= @@ -1903,12 +1752,12 @@ google.golang.org/genproto v0.0.0-20221010155953-15ba04fc1c0e/go.mod h1:3526vdqw google.golang.org/genproto v0.0.0-20221014173430-6e2ab493f96b/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM= google.golang.org/genproto v0.0.0-20221014213838-99cd37c6964a/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM= google.golang.org/genproto v0.0.0-20221025140454-527a21cfbd71/go.mod h1:9qHF0xnpdSfF6knlcsnpzUu5y+rpwgbvsyGAZPBMg4s= -google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de h1:F6qOa9AZTYJXOUEr4jDysRDLrm4PHePlge4v4TGAlxY= -google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:VUhTRKeHn9wwcdrk73nvdC9gF178Tzhmt/qyaFcPLSo= -google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de h1:jFNzHPIeuzhdRwVhbZdiym9q0ory/xY3sA+v2wPg8I0= -google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:5iCWqnniDlqZHrd3neWVTOwvh/v6s3232omMecelax8= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240401170217-c3f982113cda h1:LI5DOvAxUPMv/50agcLLoo+AdWc1irS9Rzz4vPuD1V4= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240401170217-c3f982113cda/go.mod h1:WtryC6hu0hhx87FDGxWCDptyssuo68sk10vYjF+T9fY= +google.golang.org/genproto v0.0.0-20240814211410-ddb44dafa142 h1:oLiyxGgE+rt22duwci1+TG7bg2/L1LQsXwfjPlmuJA0= +google.golang.org/genproto v0.0.0-20240814211410-ddb44dafa142/go.mod h1:G11eXq53iI5Q+kyNOmCvnzBaxEA2Q/Ik5Tj7nqBE8j4= +google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 h1:wKguEg1hsxI2/L3hUYrpo1RVi48K+uTyzKqprwLXsb8= +google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142/go.mod h1:d6be+8HhtEtucleCbxpPW9PA9XwISACu8nvpPqF0BVo= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f h1:cUMEy+8oS78BWIH9OWazBkzbr090Od9tWBNtZHkOhf0= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= @@ -1950,8 +1799,8 @@ google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACu google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.63.2 h1:MUeiw1B2maTVZthpU5xvASfTh3LDbxHd6IJ6QQVU+xM= -google.golang.org/grpc v1.63.2/go.mod h1:WAX/8DgncnokcFUldAxq7GeB5DXHDbMF+lLvDomNkRA= +google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E= +google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= @@ -1968,8 +1817,8 @@ google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= -google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= +google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -2004,7 +1853,6 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= gotest.tools/v3 v3.5.1 h1:EENdUnS3pdur5nybKYIh2Vfgc8IUNBjxDPSjtiJcOzU= gotest.tools/v3 v3.5.1/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU= honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= @@ -2015,16 +1863,15 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -honnef.co/go/tools v0.1.3/go.mod h1:NgwopIslSNH47DimFoV78dnkksY2EFtX0ajyb3K/las= -nhooyr.io/websocket v1.8.6 h1:s+C3xAMLwGmlI31Nyn/eAehUlZPwfYZu2JXM621Q5/k= nhooyr.io/websocket v1.8.6/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0= +nhooyr.io/websocket v1.8.10 h1:mv4p+MnGrLDcPlBoWsvPP7XCzTYMXP9F9eIGoKbgx7Q= +nhooyr.io/websocket v1.8.10/go.mod h1:rN9OFWIUwuxg4fR5tELlYC04bXYowCP9GX47ivo2l+c= pgregory.net/rapid v1.1.0 h1:CMa0sjHSru3puNx+J0MIAuiiEV4N0qj8/cMWGBBCsjw= pgregory.net/rapid v1.1.0/go.mod h1:PY5XlDGj0+V1FCq0o192FdRhpKHGTRIWBgqjDBTrq04= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= -rsc.io/tmplfunc v0.0.3/go.mod h1:AG3sTPzElb1Io3Yg4voV9AGZJuleGAwaVRxL9M49PhA= sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E= sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY= diff --git a/migrate/utils/periodic_vesting.go b/migrate/utils/periodic_vesting.go index 5ae6d17e1a..1382ba9470 100644 --- a/migrate/utils/periodic_vesting.go +++ b/migrate/utils/periodic_vesting.go @@ -1,6 +1,7 @@ package utils import ( + sdkmath "cosmossdk.io/math" "time" sdk "github.com/cosmos/cosmos-sdk/types" @@ -38,7 +39,7 @@ func ResetPeriodicVestingAccount(vacc *v040vesting.PeriodicVestingAccount, start // If the new original vesting amount is less than the delegated vesting amount, set delegated vesting // to the new original vesting amount, and add the difference to the delegated free amount for _, delegatedVestingCoin := range vacc.DelegatedVesting { - newDelegatedVestingCoin := sdk.NewCoin(delegatedVestingCoin.Denom, sdk.MinInt(delegatedVestingCoin.Amount, newOriginalVesting.AmountOf(delegatedVestingCoin.Denom))) + newDelegatedVestingCoin := sdk.NewCoin(delegatedVestingCoin.Denom, sdkmath.MinInt(delegatedVestingCoin.Amount, newOriginalVesting.AmountOf(delegatedVestingCoin.Denom))) delegationAdjustment := delegatedVestingCoin.Sub(newDelegatedVestingCoin) if !delegationAdjustment.IsZero() { diff --git a/migrate/utils/periodic_vesting_reset_test.go b/migrate/utils/periodic_vesting_reset_test.go index ad6bbf1b79..9a8d9e6080 100644 --- a/migrate/utils/periodic_vesting_reset_test.go +++ b/migrate/utils/periodic_vesting_reset_test.go @@ -23,7 +23,12 @@ func createVestingAccount(balance sdk.Coins, vestingStart time.Time, vestingPeri originalVesting = originalVesting.Add(vp.Amount...) } - return vestingtypes.NewPeriodicVestingAccount(acc, originalVesting, vestingStart.Unix(), vestingPeriods) + vasting, err := vestingtypes.NewPeriodicVestingAccount(acc, originalVesting, vestingStart.Unix(), vestingPeriods) + if err != nil { + panic(err) + } + + return vasting } func TestResetPeriodVestingAccount_NoVestingPeriods(t *testing.T) { diff --git a/modules checked.md b/modules checked.md new file mode 100644 index 0000000000..a5d2c48ab3 --- /dev/null +++ b/modules checked.md @@ -0,0 +1,46 @@ + +Modules test checked: + +-- write table with 3 columns + +Table: + +| Module | Status | Notes | +|---------------------------------------------|-------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| auction | ✅ | | +| bep3 | ✅ | | +| cdp | | 2 test for some reason keeps the data after init setup (old version didn't contain that data). Because of that it 1) doesn't calculate correctly 2) causes seize | +| committee | ✅ | | +| community | ✅ | | +| earn | ✅ | | +| evmutil | | Problem with seting up environment, as setup account causes index error (looks like wrong context passed) | +| hard | ✅ | | +| incentive | | Many test related to delegator sync, some problematic part with extra total bond | +| issuance | ✅ | | +| kavadist | | 2 test at least failed with calculation, problem with ButnCoins GetAll banances (it is different from expected, not enought) inside func (tApp TestApp) DeleteGenesisValidatorCoins(t *testing.T, ctx sdk.Context) { | +| liquid | ✅ | | +| metrics | ✅ | | +| precisebank | ✅ | | +| pricefeed | ✅ | | +| router | ✅ | | +| savings | ✅ | | +| swap](x%2Fswap) | ✅ | | +| validator-vesting](x%2Fvalidator-vesting) | ✅ | | + + + + +E2E tests: + + +| File | Status | Notes +|----------------------------------------------------------------------------------------|-----|-------------------------------------------------------------------------------------------------| +| e2e_community_update_params_test.go | ✅ | | +| e2e_convert_cosmos_coins_test.go | | TestConvertCosmosCoins_ForbiddenERC20Calls, TestConvertCosmosCoins_ERC20Magic | +| e2e_evm_contracts_test.go | ✅ | | +| e2e_grpc_client_query_test.go | ✅ | | +| e2e_grpc_client_util_test.go | ✅ | | +| e2e_min_fees_test.go | ✅ | | +| e2e_precompile_genesis_test.go | | TestPrecompileGenesis (potentially, just need rebase with some changes that were not in master) | +| e2e_test.go | ✅ | | +| e2e_upgrade_handler_test.go | ✅ | Not sure what and how it should be tested (skipped) | diff --git a/proto/kava/auction/v1beta1/auction.proto b/proto/kava/auction/v1beta1/auction.proto index a5e8c7d886..ff0b767c28 100644 --- a/proto/kava/auction/v1beta1/auction.proto +++ b/proto/kava/auction/v1beta1/auction.proto @@ -92,7 +92,7 @@ message WeightedAddresses { ]; repeated bytes weights = 2 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; } diff --git a/proto/kava/auction/v1beta1/genesis.proto b/proto/kava/auction/v1beta1/genesis.proto index ca6ca79945..c787c35917 100644 --- a/proto/kava/auction/v1beta1/genesis.proto +++ b/proto/kava/auction/v1beta1/genesis.proto @@ -39,17 +39,17 @@ message Params { ]; bytes increment_surplus = 3 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; bytes increment_debt = 4 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; bytes increment_collateral = 5 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; } diff --git a/proto/kava/bep3/v1beta1/bep3.proto b/proto/kava/bep3/v1beta1/bep3.proto index 9b6825c0aa..95a1faf376 100644 --- a/proto/kava/bep3/v1beta1/bep3.proto +++ b/proto/kava/bep3/v1beta1/bep3.proto @@ -35,19 +35,19 @@ message AssetParam { // fixed_fee defines the fee for incoming swaps string fixed_fee = 6 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; // min_swap_amount defines the minimum amount able to be swapped in a single message string min_swap_amount = 7 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; // max_swap_amount defines the maximum amount able to be swapped in a single message string max_swap_amount = 8 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; // min_block_lock defined the minimum blocks to lock @@ -61,7 +61,7 @@ message SupplyLimit { // limit defines the total supply allowed string limit = 1 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; // time_limited enables or disables time based supply limiting @@ -74,7 +74,7 @@ message SupplyLimit { // time_based_limit defines the maximum supply that can be swapped within time_period string time_based_limit = 4 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; } diff --git a/proto/kava/cdp/v1beta1/cdp.proto b/proto/kava/cdp/v1beta1/cdp.proto index 1ee21001ba..b1b9adc5f6 100644 --- a/proto/kava/cdp/v1beta1/cdp.proto +++ b/proto/kava/cdp/v1beta1/cdp.proto @@ -26,7 +26,7 @@ message CDP { ]; string interest_factor = 8 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; } diff --git a/proto/kava/cdp/v1beta1/genesis.proto b/proto/kava/cdp/v1beta1/genesis.proto index a993bbaed2..b4bc588fd5 100644 --- a/proto/kava/cdp/v1beta1/genesis.proto +++ b/proto/kava/cdp/v1beta1/genesis.proto @@ -47,22 +47,22 @@ message Params { cosmos.base.v1beta1.Coin global_debt_limit = 3 [(gogoproto.nullable) = false]; string surplus_auction_threshold = 4 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; string surplus_auction_lot = 5 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; string debt_auction_threshold = 6 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; string debt_auction_lot = 7 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; bool circuit_breaker = 8; @@ -76,12 +76,12 @@ message DebtParam { string reference_asset = 2; string conversion_factor = 3 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; string debt_floor = 4 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; } @@ -92,40 +92,40 @@ message CollateralParam { string type = 2; string liquidation_ratio = 3 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; cosmos.base.v1beta1.Coin debt_limit = 4 [(gogoproto.nullable) = false]; string stability_fee = 5 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; string auction_size = 6 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; string liquidation_penalty = 7 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; string spot_market_id = 8 [(gogoproto.customname) = "SpotMarketID"]; string liquidation_market_id = 9 [(gogoproto.customname) = "LiquidationMarketID"]; string keeper_reward_percentage = 10 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; string check_collateralization_index_count = 11 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; string conversion_factor = 12 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; } @@ -139,7 +139,7 @@ message GenesisAccumulationTime { ]; string interest_factor = 3 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; } @@ -149,7 +149,7 @@ message GenesisTotalPrincipal { string collateral_type = 1; string total_principal = 2 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; } diff --git a/proto/kava/cdp/v1beta1/query.proto b/proto/kava/cdp/v1beta1/query.proto index ec27b84077..e7ffec3c1d 100644 --- a/proto/kava/cdp/v1beta1/query.proto +++ b/proto/kava/cdp/v1beta1/query.proto @@ -86,7 +86,7 @@ message QueryCdpsRequest { string collateral_type = 1; string owner = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; uint64 id = 3 [(gogoproto.customname) = "ID"]; - // sdk.Dec as a string + // sdkmath.LegacyDec as a string string ratio = 4; cosmos.base.query.v1beta1.PageRequest pagination = 5; diff --git a/proto/kava/committee/v1beta1/committee.proto b/proto/kava/committee/v1beta1/committee.proto index b0ab001b82..9ea35c6284 100644 --- a/proto/kava/committee/v1beta1/committee.proto +++ b/proto/kava/committee/v1beta1/committee.proto @@ -24,7 +24,7 @@ message BaseCommittee { // Smallest percentage that must vote for a proposal to pass string vote_threshold = 5 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; @@ -51,7 +51,7 @@ message TokenCommittee { BaseCommittee base_committee = 1 [(gogoproto.embed) = true]; string quorum = 2 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; string tally_denom = 3; diff --git a/proto/kava/committee/v1beta1/query.proto b/proto/kava/committee/v1beta1/query.proto index d99ff7ef2c..2b320da72f 100644 --- a/proto/kava/committee/v1beta1/query.proto +++ b/proto/kava/committee/v1beta1/query.proto @@ -144,27 +144,27 @@ message QueryTallyRequest { message QueryTallyResponse { uint64 proposal_id = 1 [(gogoproto.customname) = "ProposalID"]; string yes_votes = 2 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; string no_votes = 3 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; string current_votes = 4 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; string possible_votes = 5 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; string vote_threshold = 6 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; string quorum = 7 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; } diff --git a/proto/kava/earn/v1beta1/query.proto b/proto/kava/earn/v1beta1/query.proto index 8d788d852b..aba3d9ca22 100644 --- a/proto/kava/earn/v1beta1/query.proto +++ b/proto/kava/earn/v1beta1/query.proto @@ -96,7 +96,7 @@ message VaultResponse { // vault were to be liquidated. string total_value = 6 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; } diff --git a/proto/kava/earn/v1beta1/vault.proto b/proto/kava/earn/v1beta1/vault.proto index 8b3052d8bf..fd9eac147a 100644 --- a/proto/kava/earn/v1beta1/vault.proto +++ b/proto/kava/earn/v1beta1/vault.proto @@ -57,7 +57,7 @@ message VaultShare { string denom = 1; string amount = 2 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; } diff --git a/proto/kava/evmutil/v1beta1/genesis.proto b/proto/kava/evmutil/v1beta1/genesis.proto index fa0f67222a..a17b89f572 100644 --- a/proto/kava/evmutil/v1beta1/genesis.proto +++ b/proto/kava/evmutil/v1beta1/genesis.proto @@ -31,7 +31,7 @@ message Account { // balance indicates the amount of akava owned by the address. string balance = 2 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; } diff --git a/proto/kava/evmutil/v1beta1/tx.proto b/proto/kava/evmutil/v1beta1/tx.proto index 93c43f15be..a941a07122 100644 --- a/proto/kava/evmutil/v1beta1/tx.proto +++ b/proto/kava/evmutil/v1beta1/tx.proto @@ -48,7 +48,7 @@ message MsgConvertERC20ToCoin { // ERC20 token amount to convert. string amount = 4 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; } diff --git a/proto/kava/hard/v1beta1/genesis.proto b/proto/kava/hard/v1beta1/genesis.proto index c2520a4291..86bfb4366d 100644 --- a/proto/kava/hard/v1beta1/genesis.proto +++ b/proto/kava/hard/v1beta1/genesis.proto @@ -47,12 +47,12 @@ message GenesisAccumulationTime { ]; string supply_interest_factor = 3 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; string borrow_interest_factor = 4 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; } diff --git a/proto/kava/hard/v1beta1/hard.proto b/proto/kava/hard/v1beta1/hard.proto index fafcbde7da..83f9656919 100644 --- a/proto/kava/hard/v1beta1/hard.proto +++ b/proto/kava/hard/v1beta1/hard.proto @@ -17,7 +17,7 @@ message Params { string minimum_borrow_usd_value = 2 [ (gogoproto.customname) = "MinimumBorrowUSDValue", (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; } @@ -29,18 +29,18 @@ message MoneyMarket { string spot_market_id = 3 [(gogoproto.customname) = "SpotMarketID"]; string conversion_factor = 4 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; InterestRateModel interest_rate_model = 5 [(gogoproto.nullable) = false]; string reserve_factor = 6 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; string keeper_reward_percentage = 7 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; } @@ -50,12 +50,12 @@ message BorrowLimit { bool has_max_limit = 1 [(gogoproto.jsontag) = "has_max_limit"]; string maximum_limit = 2 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; string loan_to_value = 3 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; } @@ -65,22 +65,22 @@ message InterestRateModel { string base_rate_apy = 1 [ (gogoproto.customname) = "BaseRateAPY", (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; string base_multiplier = 2 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; string kink = 3 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; string jump_multiplier = 4 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; } @@ -122,7 +122,7 @@ message SupplyInterestFactor { string denom = 1; string value = 2 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; } @@ -132,7 +132,7 @@ message BorrowInterestFactor { string denom = 1; string value = 2 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; } diff --git a/proto/kava/hard/v1beta1/query.proto b/proto/kava/hard/v1beta1/query.proto index 92ef724811..39bf52e7d8 100644 --- a/proto/kava/hard/v1beta1/query.proto +++ b/proto/kava/hard/v1beta1/query.proto @@ -238,7 +238,7 @@ message DepositResponse { // SupplyInterestFactorResponse defines an individual borrow interest factor. message SupplyInterestFactorResponse { string denom = 1; - // sdk.Dec as string + // sdkmath.LegacyDec as string string value = 2; } @@ -258,24 +258,24 @@ message BorrowResponse { // BorrowInterestFactorResponse defines an individual borrow interest factor. message BorrowInterestFactorResponse { string denom = 1; - // sdk.Dec as string + // sdkmath.LegacyDec as string string value = 2; } // MoneyMarketInterestRate is a unique type returned by interest rate queries message MoneyMarketInterestRate { string denom = 1; - // sdk.Dec as String + // sdkmath.LegacyDec as String string supply_interest_rate = 2; - // sdk.Dec as String + // sdkmath.LegacyDec as String string borrow_interest_rate = 3; } // InterestFactor is a unique type returned by interest factor queries message InterestFactor { string denom = 1; - // sdk.Dec as String + // sdkmath.LegacyDec as String string borrow_interest_factor = 2; - // sdk.Dec as String + // sdkmath.LegacyDec as String string supply_interest_factor = 3; } diff --git a/proto/kava/incentive/v1beta1/apy.proto b/proto/kava/incentive/v1beta1/apy.proto index 5b6abf9340..506595265f 100644 --- a/proto/kava/incentive/v1beta1/apy.proto +++ b/proto/kava/incentive/v1beta1/apy.proto @@ -12,7 +12,7 @@ message Apy { string collateral_type = 1; string apy = 2 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; } diff --git a/proto/kava/incentive/v1beta1/claims.proto b/proto/kava/incentive/v1beta1/claims.proto index f9e54906a0..2cafc3ddfa 100644 --- a/proto/kava/incentive/v1beta1/claims.proto +++ b/proto/kava/incentive/v1beta1/claims.proto @@ -42,7 +42,7 @@ message RewardIndex { string collateral_type = 1; bytes reward_factor = 2 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; } diff --git a/proto/kava/incentive/v1beta1/params.proto b/proto/kava/incentive/v1beta1/params.proto index 7571f9a33b..469564c916 100644 --- a/proto/kava/incentive/v1beta1/params.proto +++ b/proto/kava/incentive/v1beta1/params.proto @@ -56,7 +56,7 @@ message Multiplier { int64 months_lockup = 2; bytes factor = 3 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; } diff --git a/proto/kava/issuance/v1beta1/genesis.proto b/proto/kava/issuance/v1beta1/genesis.proto index 4f791de269..9a614487e9 100644 --- a/proto/kava/issuance/v1beta1/genesis.proto +++ b/proto/kava/issuance/v1beta1/genesis.proto @@ -39,7 +39,7 @@ message RateLimit { bool active = 1; bytes limit = 2 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false, (gogoproto.jsontag) = "limit,omitempty" ]; diff --git a/proto/kava/kavadist/v1beta1/params.proto b/proto/kava/kavadist/v1beta1/params.proto index 5c90b71887..2ad131af36 100644 --- a/proto/kava/kavadist/v1beta1/params.proto +++ b/proto/kava/kavadist/v1beta1/params.proto @@ -42,7 +42,7 @@ message CoreReward { ]; string weight = 2 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; option (gogoproto.goproto_stringer) = true; @@ -78,6 +78,6 @@ message Period { // example "1.000000003022265980" - 10% inflation bytes inflation = 3 [ (gogoproto.nullable) = false, - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec" + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec" ]; } diff --git a/proto/kava/liquid/v1beta1/tx.proto b/proto/kava/liquid/v1beta1/tx.proto index 077e2b0b21..147de6862d 100644 --- a/proto/kava/liquid/v1beta1/tx.proto +++ b/proto/kava/liquid/v1beta1/tx.proto @@ -47,7 +47,7 @@ message MsgBurnDerivativeResponse { // received is the number of delegation shares sent to the sender string received = 1 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; } diff --git a/proto/kava/pricefeed/v1beta1/query.proto b/proto/kava/pricefeed/v1beta1/query.proto index eecc9bc846..0555c80e77 100644 --- a/proto/kava/pricefeed/v1beta1/query.proto +++ b/proto/kava/pricefeed/v1beta1/query.proto @@ -134,7 +134,7 @@ message PostedPriceResponse { string market_id = 1 [(gogoproto.customname) = "MarketID"]; string oracle_address = 2; string price = 3 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; google.protobuf.Timestamp expiry = 4 [ @@ -148,7 +148,7 @@ message PostedPriceResponse { message CurrentPriceResponse { string market_id = 1 [(gogoproto.customname) = "MarketID"]; string price = 2 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; } diff --git a/proto/kava/pricefeed/v1beta1/store.proto b/proto/kava/pricefeed/v1beta1/store.proto index ebe0433780..04f92e7b9a 100644 --- a/proto/kava/pricefeed/v1beta1/store.proto +++ b/proto/kava/pricefeed/v1beta1/store.proto @@ -37,7 +37,7 @@ message PostedPrice { (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress" ]; string price = 3 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; google.protobuf.Timestamp expiry = 4 [ @@ -51,7 +51,7 @@ message PostedPrice { message CurrentPrice { string market_id = 1 [(gogoproto.customname) = "MarketID"]; string price = 2 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; } diff --git a/proto/kava/pricefeed/v1beta1/tx.proto b/proto/kava/pricefeed/v1beta1/tx.proto index 66da318a8e..de6c151e9e 100644 --- a/proto/kava/pricefeed/v1beta1/tx.proto +++ b/proto/kava/pricefeed/v1beta1/tx.proto @@ -22,7 +22,7 @@ message MsgPostPrice { string from = 1; string market_id = 2 [(gogoproto.customname) = "MarketID"]; string price = 3 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; google.protobuf.Timestamp expiry = 4 [ diff --git a/proto/kava/swap/v1beta1/query.proto b/proto/kava/swap/v1beta1/query.proto index 63a0f8fb8d..8e908c8ff8 100644 --- a/proto/kava/swap/v1beta1/query.proto +++ b/proto/kava/swap/v1beta1/query.proto @@ -69,7 +69,7 @@ message PoolResponse { // total_shares represents the total shares of the pool string total_shares = 3 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; } @@ -107,7 +107,7 @@ message DepositResponse { // shares_owned presents the shares owned by the depositor for the pool string shares_owned = 3 [ (cosmos_proto.scalar) = "cosmos.AddressString", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; // shares_value represents the coin value of the shares_owned diff --git a/proto/kava/swap/v1beta1/swap.proto b/proto/kava/swap/v1beta1/swap.proto index 4e295d8eef..5c9388ca4e 100644 --- a/proto/kava/swap/v1beta1/swap.proto +++ b/proto/kava/swap/v1beta1/swap.proto @@ -19,7 +19,7 @@ message Params { // swap_fee defines the swap fee for all pools string swap_fee = 2 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; } @@ -46,7 +46,7 @@ message PoolRecord { // total_shares is the total distrubuted shares of the pool string total_shares = 4 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; } @@ -63,7 +63,7 @@ message ShareRecord { // shares_owned represents the number of shares owned by depsoitor for the pool_id string shares_owned = 3 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; } diff --git a/proto/kava/swap/v1beta1/tx.proto b/proto/kava/swap/v1beta1/tx.proto index 7980b66c3c..aa71e4e826 100644 --- a/proto/kava/swap/v1beta1/tx.proto +++ b/proto/kava/swap/v1beta1/tx.proto @@ -32,7 +32,7 @@ message MsgDeposit { // slippage represents the max decimal percentage price change string slippage = 4 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; // deadline represents the unix timestamp to complete the deposit by @@ -50,7 +50,7 @@ message MsgWithdraw { string from = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // shares represents the amount of shares to withdraw string shares = 2 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; // min_token_a represents the minimum a token to withdraw @@ -77,7 +77,7 @@ message MsgSwapExactForTokens { // slippage represents the maximum change in token_b allowed string slippage = 4 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; // deadline represents the unix timestamp to complete the swap by @@ -102,7 +102,7 @@ message MsgSwapForExactTokens { // slippage represents the maximum change in token_a allowed string slippage = 4 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; // deadline represents the unix timestamp to complete the swap by diff --git a/proto/kava/validatorvesting/v1beta1/query.proto b/proto/kava/validatorvesting/v1beta1/query.proto index 406c071363..1bf70f73fc 100644 --- a/proto/kava/validatorvesting/v1beta1/query.proto +++ b/proto/kava/validatorvesting/v1beta1/query.proto @@ -53,7 +53,7 @@ message QueryCirculatingSupplyRequest {} message QueryCirculatingSupplyResponse { string amount = 1 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; } @@ -65,7 +65,7 @@ message QueryTotalSupplyRequest {} message QueryTotalSupplyResponse { string amount = 1 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; } @@ -77,7 +77,7 @@ message QueryCirculatingSupplyHARDRequest {} message QueryCirculatingSupplyHARDResponse { string amount = 1 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; } @@ -89,7 +89,7 @@ message QueryCirculatingSupplyUSDXRequest {} message QueryCirculatingSupplyUSDXResponse { string amount = 1 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; } @@ -101,7 +101,7 @@ message QueryCirculatingSupplySWPRequest {} message QueryCirculatingSupplySWPResponse { string amount = 1 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; } @@ -113,7 +113,7 @@ message QueryTotalSupplyHARDRequest {} message QueryTotalSupplyHARDResponse { string amount = 1 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; } @@ -125,7 +125,7 @@ message QueryTotalSupplyUSDXRequest {} message QueryTotalSupplyUSDXResponse { string amount = 1 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; } diff --git a/tests/e2e-ibc/chainconfig.go b/tests/e2e-ibc/chainconfig.go index b8a2a8a9d7..f5a734806c 100644 --- a/tests/e2e-ibc/chainconfig.go +++ b/tests/e2e-ibc/chainconfig.go @@ -1,11 +1,13 @@ package main import ( + "fmt" + "github.com/kava-labs/kava/app" "os" - "github.com/strangelove-ventures/interchaintest/v7/chain/cosmos" - "github.com/strangelove-ventures/interchaintest/v7/ibc" - "github.com/strangelove-ventures/interchaintest/v7/testutil" + "github.com/strangelove-ventures/interchaintest/v8/chain/cosmos" + "github.com/strangelove-ventures/interchaintest/v8/ibc" + "github.com/strangelove-ventures/interchaintest/v8/testutil" ) const ( @@ -16,7 +18,8 @@ const ( func DefaultKavaChainConfig(chainId string) ibc.ChainConfig { kavaImageTag := os.Getenv("KAVA_TAG") if kavaImageTag == "" { - kavaImageTag = "v0.26.0-rocksdb" + //kavaImageTag = "v0.26.0-rocksdb" + kavaImageTag = "local" } // app.toml overrides @@ -25,28 +28,38 @@ func DefaultKavaChainConfig(chainId string) ibc.ChainConfig { appTomlOverrides := make(testutil.Toml) appTomlOverrides["json-rpc"] = jsonRpcOverrides + cosmos.SetSDKConfig(app.Bech32MainPrefix) + // genesis param overrides genesis := []cosmos.GenesisKV{ - cosmos.NewGenesisKV("consensus_params.block.max_gas", "20000000"), + // TODO(boodyvo): investigate why it is "consensus.params" as there is one test for ethermint in interchaintest, that works with "consensus_params" + // Updatae: It was impacted by kava docker, not interchaintest + //cosmos.NewGenesisKV("consensus_params.block.max_gas", "20000000"), + cosmos.NewGenesisKV("consensus.params.block.max_gas", "20000000"), + cosmos.NewGenesisKV("app_state.evm.params.evm_denom", "akava"), // update for fast voting periods cosmos.NewGenesisKV("app_state.gov.params.voting_period", "10s"), cosmos.NewGenesisKV("app_state.gov.params.min_deposit.0.denom", "ukava"), } + fmt.Println("genesis", genesis) + return ibc.ChainConfig{ Type: "cosmos", ChainID: chainId, Images: []ibc.DockerImage{{Repository: "kava/kava", Version: kavaImageTag, UidGid: "0:0"}}, // Images: []ibc.DockerImage{{Repository: "ghcr.io/strangelove-ventures/heighliner/kava", Version: "v0.26.0", UidGid: "1025:1025"}}, - Bin: "kava", - Bech32Prefix: "kava", - Denom: "ukava", - GasPrices: "0ukava", // 0 gas price makes calculating expected balances simpler - GasAdjustment: 1.5, - TrustingPeriod: "168h0m0s", - ModifyGenesis: cosmos.ModifyGenesis(genesis), - ExposeAdditionalPorts: []string{"8545/tcp"}, - ConfigFileOverrides: map[string]any{"config/app.toml": appTomlOverrides}, + Bin: "kava", + Bech32Prefix: "kava", + Denom: "ukava", + //GasPrices: "0ukava", // 0 gas price makes calculating expected balances simpler + GasPrices: "100ukava", // 0 gas price makes calculating expected balances simpler + GasAdjustment: 1.5, + TrustingPeriod: "168h0m0s", + ModifyGenesis: cosmos.ModifyGenesis(genesis), + //HostPortOverride: map[int]int{randomPort: 8545}, + //ExposeAdditionalPorts: []string{"8545/tcp"}, + ConfigFileOverrides: map[string]any{"config/app.toml": appTomlOverrides}, } } diff --git a/tests/e2e-ibc/conformance_test.go b/tests/e2e-ibc/conformance_test.go index a3c6ccd95d..06a8d16d34 100644 --- a/tests/e2e-ibc/conformance_test.go +++ b/tests/e2e-ibc/conformance_test.go @@ -3,15 +3,15 @@ package main_test import ( "context" "fmt" + "github.com/strangelove-ventures/interchaintest/v8" "testing" "time" "go.uber.org/zap/zaptest" - "github.com/strangelove-ventures/interchaintest/v7" - "github.com/strangelove-ventures/interchaintest/v7/conformance" - "github.com/strangelove-ventures/interchaintest/v7/ibc" - "github.com/strangelove-ventures/interchaintest/v7/testreporter" + "github.com/strangelove-ventures/interchaintest/v8/conformance" + "github.com/strangelove-ventures/interchaintest/v8/ibc" + "github.com/strangelove-ventures/interchaintest/v8/testreporter" "github.com/stretchr/testify/require" kavainterchain "github.com/kava-labs/kava/tests/interchain" diff --git a/tests/e2e-ibc/dockerutil/busybox.go b/tests/e2e-ibc/dockerutil/busybox.go new file mode 100644 index 0000000000..2b68b27ede --- /dev/null +++ b/tests/e2e-ibc/dockerutil/busybox.go @@ -0,0 +1,56 @@ +package dockerutil + +import ( + "context" + "fmt" + "io" + "sync" + + "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/filters" + "github.com/docker/docker/client" +) + +// Allow multiple goroutines to check for busybox +// by using a protected package-level variable. +// +// A mutex allows for retries upon error, if we ever need that; +// whereas a sync.Once would not be simple to retry. +var ( + ensureBusyboxMu sync.Mutex + hasBusybox bool +) + +const busyboxRef = "busybox:stable" + +func ensureBusybox(ctx context.Context, cli *client.Client) error { + ensureBusyboxMu.Lock() + defer ensureBusyboxMu.Unlock() + + if hasBusybox { + return nil + } + + images, err := cli.ImageList(ctx, types.ImageListOptions{ + Filters: filters.NewArgs(filters.Arg("reference", busyboxRef)), + }) + if err != nil { + return fmt.Errorf("listing images to check busybox presence: %w", err) + } + + if len(images) > 0 { + hasBusybox = true + return nil + } + + rc, err := cli.ImagePull(ctx, busyboxRef, types.ImagePullOptions{}) + if err != nil { + return err + } + + _, _ = io.Copy(io.Discard, rc) + _ = rc.Close() + + hasBusybox = true + return nil +} diff --git a/tests/e2e-ibc/dockerutil/container_lifecycle.go b/tests/e2e-ibc/dockerutil/container_lifecycle.go new file mode 100644 index 0000000000..3f138b7595 --- /dev/null +++ b/tests/e2e-ibc/dockerutil/container_lifecycle.go @@ -0,0 +1,181 @@ +package dockerutil + +import ( + "context" + "fmt" + "net" + "strings" + + dockertypes "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/container" + "github.com/docker/docker/api/types/mount" + "github.com/docker/docker/api/types/network" + dockerclient "github.com/docker/docker/client" + "github.com/docker/docker/errdefs" + "github.com/docker/go-connections/nat" + "go.uber.org/zap" + + "github.com/strangelove-ventures/interchaintest/v8/ibc" +) + +type ContainerLifecycle struct { + log *zap.Logger + client *dockerclient.Client + containerName string + id string + preStartListeners Listeners +} + +func NewContainerLifecycle(log *zap.Logger, client *dockerclient.Client, containerName string) *ContainerLifecycle { + return &ContainerLifecycle{ + log: log, + client: client, + containerName: containerName, + } +} + +func (c *ContainerLifecycle) CreateContainer( + ctx context.Context, + testName string, + networkID string, + image ibc.DockerImage, + ports nat.PortMap, + volumeBinds []string, + mounts []mount.Mount, + hostName string, + cmd []string, + env []string, +) error { + imageRef := image.Ref() + c.log.Info( + "Will run command", + zap.String("image", imageRef), + zap.String("container", c.containerName), + zap.String("command", strings.Join(cmd, " ")), + ) + + pS := nat.PortSet{} + for k := range ports { + pS[k] = struct{}{} + } + + pb, listeners, err := GeneratePortBindings(ports) + if err != nil { + return fmt.Errorf("failed to generate port bindings: %w", err) + } + + c.preStartListeners = listeners + + cc, err := c.client.ContainerCreate( + ctx, + &container.Config{ + Image: imageRef, + + Entrypoint: []string{}, + Cmd: cmd, + Env: env, + + Hostname: hostName, + + Labels: map[string]string{CleanupLabel: testName}, + + ExposedPorts: pS, + }, + &container.HostConfig{ + Binds: volumeBinds, + PortBindings: pb, + PublishAllPorts: true, + AutoRemove: false, + DNS: []string{}, + Mounts: mounts, + }, + &network.NetworkingConfig{ + EndpointsConfig: map[string]*network.EndpointSettings{ + networkID: {}, + }, + }, + nil, + c.containerName, + ) + if err != nil { + listeners.CloseAll() + c.preStartListeners = []net.Listener{} + return err + } + c.id = cc.ID + return nil +} + +func (c *ContainerLifecycle) StartContainer(ctx context.Context) error { + // lock port allocation for the time between freeing the ports from the + // temporary listeners to the consumption of the ports by the container + mu.RLock() + defer mu.RUnlock() + + c.preStartListeners.CloseAll() + c.preStartListeners = []net.Listener{} + + if err := StartContainer(ctx, c.client, c.id); err != nil { + return err + } + + c.log.Info("Container started", zap.String("container", c.containerName)) + + return nil +} + +func (c *ContainerLifecycle) PauseContainer(ctx context.Context) error { + return c.client.ContainerPause(ctx, c.id) +} + +func (c *ContainerLifecycle) UnpauseContainer(ctx context.Context) error { + return c.client.ContainerUnpause(ctx, c.id) +} + +func (c *ContainerLifecycle) StopContainer(ctx context.Context) error { + var timeout container.StopOptions + timeoutSec := 30 + timeout.Timeout = &timeoutSec + + return c.client.ContainerStop(ctx, c.id, timeout) +} + +func (c *ContainerLifecycle) RemoveContainer(ctx context.Context) error { + err := c.client.ContainerRemove(ctx, c.id, dockertypes.ContainerRemoveOptions{ + Force: true, + RemoveVolumes: true, + }) + if err != nil && !errdefs.IsNotFound(err) { + return fmt.Errorf("remove container %s: %w", c.containerName, err) + } + return nil +} + +func (c *ContainerLifecycle) ContainerID() string { + return c.id +} + +func (c *ContainerLifecycle) GetHostPorts(ctx context.Context, portIDs ...string) ([]string, error) { + cjson, err := c.client.ContainerInspect(ctx, c.id) + if err != nil { + return nil, err + } + ports := make([]string, len(portIDs)) + for i, p := range portIDs { + ports[i] = GetHostPort(cjson, p) + } + return ports, nil +} + +// Running will inspect the container and check its state to determine if it is currently running. +// If the container is running nil will be returned, otherwise an error is returned. +func (c *ContainerLifecycle) Running(ctx context.Context) error { + cjson, err := c.client.ContainerInspect(ctx, c.id) + if err != nil { + return err + } + if cjson.State.Running { + return nil + } + return fmt.Errorf("container with name %s and id %s is not running", c.containerName, c.id) +} diff --git a/tests/e2e-ibc/dockerutil/doc.go b/tests/e2e-ibc/dockerutil/doc.go new file mode 100644 index 0000000000..7a9a80a2fc --- /dev/null +++ b/tests/e2e-ibc/dockerutil/doc.go @@ -0,0 +1,2 @@ +// Package dockerutil contains helpers for interacting with Docker containers. +package dockerutil diff --git a/tests/e2e-ibc/dockerutil/file.go b/tests/e2e-ibc/dockerutil/file.go new file mode 100644 index 0000000000..0780030b79 --- /dev/null +++ b/tests/e2e-ibc/dockerutil/file.go @@ -0,0 +1,32 @@ +package dockerutil + +import ( + "fmt" + "io" + "os" +) + +func CopyFile(src, dst string) (int64, error) { + sourceFileStat, err := os.Stat(src) + if err != nil { + return 0, err + } + + if !sourceFileStat.Mode().IsRegular() { + return 0, fmt.Errorf("%s is not a regular file", src) + } + + source, err := os.Open(src) + if err != nil { + return 0, err + } + defer source.Close() + + destination, err := os.Create(dst) + if err != nil { + return 0, err + } + defer destination.Close() + nBytes, err := io.Copy(destination, source) + return nBytes, err +} diff --git a/tests/e2e-ibc/dockerutil/fileretriever.go b/tests/e2e-ibc/dockerutil/fileretriever.go new file mode 100644 index 0000000000..3e4725fb8e --- /dev/null +++ b/tests/e2e-ibc/dockerutil/fileretriever.go @@ -0,0 +1,100 @@ +package dockerutil + +import ( + "archive/tar" + "context" + "fmt" + "io" + "path" + "time" + + "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/container" + "github.com/docker/docker/client" + "go.uber.org/zap" +) + +// FileRetriever allows retrieving a single file from a Docker volume. +// In the future it may allow retrieving an entire directory. +type FileRetriever struct { + log *zap.Logger + + cli *client.Client + + testName string +} + +// NewFileRetriever returns a new FileRetriever. +func NewFileRetriever(log *zap.Logger, cli *client.Client, testName string) *FileRetriever { + return &FileRetriever{log: log, cli: cli, testName: testName} +} + +// SingleFileContent returns the content of the file named at relPath, +// inside the volume specified by volumeName. +func (r *FileRetriever) SingleFileContent(ctx context.Context, volumeName, relPath string) ([]byte, error) { + const mountPath = "/mnt/dockervolume" + + if err := ensureBusybox(ctx, r.cli); err != nil { + return nil, err + } + + containerName := fmt.Sprintf("interchaintest-getfile-%d-%s", time.Now().UnixNano(), RandLowerCaseLetterString(5)) + + cc, err := r.cli.ContainerCreate( + ctx, + &container.Config{ + Image: busyboxRef, + + // Use root user to avoid permission issues when reading files from the volume. + User: GetRootUserString(), + + Labels: map[string]string{CleanupLabel: r.testName}, + }, + &container.HostConfig{ + Binds: []string{volumeName + ":" + mountPath}, + AutoRemove: true, + }, + nil, // No networking necessary. + nil, + containerName, + ) + if err != nil { + return nil, fmt.Errorf("creating container: %w", err) + } + + defer func() { + if err := r.cli.ContainerRemove(ctx, cc.ID, types.ContainerRemoveOptions{ + Force: true, + }); err != nil { + r.log.Warn("Failed to remove file content container", zap.String("container_id", cc.ID), zap.Error(err)) + } + }() + + rc, _, err := r.cli.CopyFromContainer(ctx, cc.ID, path.Join(mountPath, relPath)) + if err != nil { + return nil, fmt.Errorf("copying from container: %w", err) + } + defer func() { + _ = rc.Close() + }() + + wantPath := path.Base(relPath) + tr := tar.NewReader(rc) + for { + hdr, err := tr.Next() + if err == io.EOF { + break + } + if err != nil { + return nil, fmt.Errorf("reading tar from container: %w", err) + } + if hdr.Name != wantPath { + r.log.Debug("Unexpected path", zap.String("want", relPath), zap.String("got", hdr.Name)) + continue + } + + return io.ReadAll(tr) + } + + return nil, fmt.Errorf("path %q not found in tar from container", relPath) +} diff --git a/tests/e2e-ibc/dockerutil/fileretriever_test.go b/tests/e2e-ibc/dockerutil/fileretriever_test.go new file mode 100644 index 0000000000..e9157faf88 --- /dev/null +++ b/tests/e2e-ibc/dockerutil/fileretriever_test.go @@ -0,0 +1,69 @@ +package dockerutil_test + +import ( + "context" + "testing" + + volumetypes "github.com/docker/docker/api/types/volume" + interchaintest "github.com/strangelove-ventures/interchaintest/v8" + "github.com/strangelove-ventures/interchaintest/v8/internal/dockerutil" + "github.com/stretchr/testify/require" + "go.uber.org/zap/zaptest" +) + +func TestFileRetriever(t *testing.T) { + if testing.Short() { + t.Skip("skipping due to short mode") + } + + t.Parallel() + + cli, network := interchaintest.DockerSetup(t) + + ctx := context.Background() + v, err := cli.VolumeCreate(ctx, volumetypes.CreateOptions{ + Labels: map[string]string{dockerutil.CleanupLabel: t.Name()}, + }) + require.NoError(t, err) + + img := dockerutil.NewImage( + zaptest.NewLogger(t), + cli, + network, + t.Name(), + "busybox", "stable", + ) + + res := img.Run( + ctx, + []string{"sh", "-c", "chmod 0700 /mnt/test && printf 'hello world' > /mnt/test/hello.txt"}, + dockerutil.ContainerOptions{ + Binds: []string{v.Name + ":/mnt/test"}, + User: dockerutil.GetRootUserString(), + }, + ) + require.NoError(t, res.Err) + res = img.Run( + ctx, + []string{"sh", "-c", "mkdir -p /mnt/test/foo/bar/ && printf 'test' > /mnt/test/foo/bar/baz.txt"}, + dockerutil.ContainerOptions{ + Binds: []string{v.Name + ":/mnt/test"}, + User: dockerutil.GetRootUserString(), + }, + ) + require.NoError(t, res.Err) + + fr := dockerutil.NewFileRetriever(zaptest.NewLogger(t), cli, t.Name()) + + t.Run("top-level file", func(t *testing.T) { + b, err := fr.SingleFileContent(ctx, v.Name, "hello.txt") + require.NoError(t, err) + require.Equal(t, string(b), "hello world") + }) + + t.Run("nested file", func(t *testing.T) { + b, err := fr.SingleFileContent(ctx, v.Name, "foo/bar/baz.txt") + require.NoError(t, err) + require.Equal(t, string(b), "test") + }) +} diff --git a/tests/e2e-ibc/dockerutil/filewriter.go b/tests/e2e-ibc/dockerutil/filewriter.go new file mode 100644 index 0000000000..7b66ca2f2e --- /dev/null +++ b/tests/e2e-ibc/dockerutil/filewriter.go @@ -0,0 +1,142 @@ +package dockerutil + +import ( + "archive/tar" + "bytes" + "context" + "fmt" + "time" + + "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/container" + "github.com/docker/docker/client" + "go.uber.org/zap" +) + +// FileWriter allows retrieving a single file from a Docker volume. +// In the future it may allow retrieving an entire directory. +type FileWriter struct { + log *zap.Logger + + cli *client.Client + + testName string +} + +// NewFileWriter returns a new FileWriter. +func NewFileWriter(log *zap.Logger, cli *client.Client, testName string) *FileWriter { + return &FileWriter{log: log, cli: cli, testName: testName} +} + +// WriteFile writes the single file containing content, at relPath within the given volume. +func (w *FileWriter) WriteFile(ctx context.Context, volumeName, relPath string, content []byte) error { + const mountPath = "/mnt/dockervolume" + + if err := ensureBusybox(ctx, w.cli); err != nil { + return err + } + + containerName := fmt.Sprintf("interchaintest-writefile-%d-%s", time.Now().UnixNano(), RandLowerCaseLetterString(5)) + + cc, err := w.cli.ContainerCreate( + ctx, + &container.Config{ + Image: busyboxRef, + + Entrypoint: []string{"sh", "-c"}, + Cmd: []string{ + // Take the uid and gid of the mount path, + // and set that as the owner of the new relative path. + `chown -R "$(stat -c '%u:%g' "$1")" "$2"`, + "_", // Meaningless arg0 for sh -c with positional args. + mountPath, + mountPath, + }, + + // Use root user to avoid permission issues when reading files from the volume. + User: GetRootUserString(), + + Labels: map[string]string{CleanupLabel: w.testName}, + }, + &container.HostConfig{ + Binds: []string{volumeName + ":" + mountPath}, + AutoRemove: true, + }, + nil, // No networking necessary. + nil, + containerName, + ) + if err != nil { + return fmt.Errorf("creating container: %w", err) + } + + autoRemoved := false + defer func() { + if autoRemoved { + // No need to attempt removing the container if we successfully started and waited for it to complete. + return + } + + if err := w.cli.ContainerRemove(ctx, cc.ID, types.ContainerRemoveOptions{ + Force: true, + }); err != nil { + w.log.Warn("Failed to remove file content container", zap.String("container_id", cc.ID), zap.Error(err)) + } + }() + + var buf bytes.Buffer + tw := tar.NewWriter(&buf) + if err := tw.WriteHeader(&tar.Header{ + Name: relPath, + + Size: int64(len(content)), + Mode: 0600, + // Not setting uname because the container will chown it anyway. + + ModTime: time.Now(), + + Format: tar.FormatPAX, + }); err != nil { + return fmt.Errorf("writing tar header: %w", err) + } + if _, err := tw.Write(content); err != nil { + return fmt.Errorf("writing content to tar: %w", err) + } + if err := tw.Close(); err != nil { + return fmt.Errorf("closing tar writer: %w", err) + } + + if err := w.cli.CopyToContainer( + ctx, + cc.ID, + mountPath, + &buf, + types.CopyToContainerOptions{}, + ); err != nil { + return fmt.Errorf("copying tar to container: %w", err) + } + + if err := w.cli.ContainerStart(ctx, cc.ID, types.ContainerStartOptions{}); err != nil { + return fmt.Errorf("starting write-file container: %w", err) + } + + waitCh, errCh := w.cli.ContainerWait(ctx, cc.ID, container.WaitConditionNotRunning) + select { + case <-ctx.Done(): + return ctx.Err() + case err := <-errCh: + return err + case res := <-waitCh: + autoRemoved = true + + if res.Error != nil { + return fmt.Errorf("waiting for write-file container: %s", res.Error.Message) + } + + if res.StatusCode != 0 { + return fmt.Errorf("chown on new file exited %d", res.StatusCode) + } + } + + return nil +} diff --git a/tests/e2e-ibc/dockerutil/filewriter_test.go b/tests/e2e-ibc/dockerutil/filewriter_test.go new file mode 100644 index 0000000000..bf5001540e --- /dev/null +++ b/tests/e2e-ibc/dockerutil/filewriter_test.go @@ -0,0 +1,68 @@ +package dockerutil_test + +import ( + "context" + "testing" + + volumetypes "github.com/docker/docker/api/types/volume" + interchaintest "github.com/strangelove-ventures/interchaintest/v8" + "github.com/strangelove-ventures/interchaintest/v8/internal/dockerutil" + "github.com/stretchr/testify/require" + "go.uber.org/zap/zaptest" +) + +func TestFileWriter(t *testing.T) { + if testing.Short() { + t.Skip("skipping due to short mode") + } + + t.Parallel() + + cli, network := interchaintest.DockerSetup(t) + + ctx := context.Background() + v, err := cli.VolumeCreate(ctx, volumetypes.CreateOptions{ + Labels: map[string]string{dockerutil.CleanupLabel: t.Name()}, + }) + require.NoError(t, err) + + img := dockerutil.NewImage( + zaptest.NewLogger(t), + cli, + network, + t.Name(), + "busybox", "stable", + ) + + fw := dockerutil.NewFileWriter(zaptest.NewLogger(t), cli, t.Name()) + + t.Run("top-level file", func(t *testing.T) { + require.NoError(t, fw.WriteFile(context.Background(), v.Name, "hello.txt", []byte("hello world"))) + res := img.Run( + ctx, + []string{"sh", "-c", "cat /mnt/test/hello.txt"}, + dockerutil.ContainerOptions{ + Binds: []string{v.Name + ":/mnt/test"}, + User: dockerutil.GetRootUserString(), + }, + ) + require.NoError(t, res.Err) + + require.Equal(t, string(res.Stdout), "hello world") + }) + + t.Run("create nested file", func(t *testing.T) { + require.NoError(t, fw.WriteFile(context.Background(), v.Name, "a/b/c/d.txt", []byte(":D"))) + res := img.Run( + ctx, + []string{"sh", "-c", "cat /mnt/test/a/b/c/d.txt"}, + dockerutil.ContainerOptions{ + Binds: []string{v.Name + ":/mnt/test"}, + User: dockerutil.GetRootUserString(), + }, + ) + require.NoError(t, err) + + require.Equal(t, string(res.Stdout), ":D") + }) +} diff --git a/tests/e2e-ibc/dockerutil/image.go b/tests/e2e-ibc/dockerutil/image.go new file mode 100644 index 0000000000..32245acd9f --- /dev/null +++ b/tests/e2e-ibc/dockerutil/image.go @@ -0,0 +1,378 @@ +package dockerutil + +import ( + "bytes" + "context" + "errors" + "fmt" + "io" + "strconv" + "strings" + "time" + + "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/container" + "github.com/docker/docker/api/types/filters" + "github.com/docker/docker/api/types/mount" + "github.com/docker/docker/api/types/network" + "github.com/docker/docker/client" + "github.com/docker/docker/errdefs" + "github.com/docker/docker/pkg/stdcopy" + "go.uber.org/zap" +) + +// Image is a docker image. +type Image struct { + log *zap.Logger + client *client.Client + + // NOTE: it might make sense for Image to have an ibc.DockerImage field, + // but for now it is probably better to not have internal/dockerutil depend on ibc. + repository, tag string + + networkID string + testName string +} + +// NewImage returns a valid Image. +// +// "pool" and "networkID" are likely from DockerSetup. +// "testName" is from a (*testing.T).Name() and should match the t.Name() from DockerSetup to ensure proper cleanup. +// +// Most arguments (except tag) must be non-zero values or this function panics. +// If tag is absent, defaults to "latest". +// Currently, only public docker images are supported. +func NewImage(logger *zap.Logger, cli *client.Client, networkID string, testName string, repository, tag string) *Image { + if logger == nil { + panic(errors.New("nil logger")) + } + if cli == nil { + panic(errors.New("client cannot be nil")) + } + if networkID == "" { + panic(errors.New("networkID cannot be empty")) + } + if testName == "" { + panic("testName cannot be empty") + } + if repository == "" { + panic(errors.New("repository cannot be empty")) + } + if tag == "" { + tag = "latest" + } + + i := &Image{ + client: cli, + networkID: networkID, + repository: repository, + tag: tag, + testName: testName, + } + // Assign log after creating, so the imageRef method can be used. + i.log = logger.With( + zap.String("image", i.imageRef()), + zap.String("test_name", testName), + ) + return i +} + +// ContainerOptions optionally configures starting a Container. +type ContainerOptions struct { + // bind mounts: https://docs.docker.com/storage/bind-mounts/ + Binds []string + + // Environment variables + Env []string + + // If blank, defaults to the container's default user. + User string + + // If non-zero, will limit the amount of log lines returned. + LogTail uint64 + + // mounts directories + Mounts []mount.Mount + + // working directory to launch cmd from + WorkingDir string +} + +// ContainerExecResult is a wrapper type that wraps an exit code and associated output from stderr & stdout, along with +// an error in the case of some error occurring during container execution. +type ContainerExecResult struct { + Err error // Err is nil, unless some error occurs during the container lifecycle. + ExitCode int + Stdout, Stderr []byte +} + +// Run creates and runs a container invoking "cmd". The container resources are removed after exit. +// +// Run blocks until the command completes. Thus, Run is not suitable for daemons or servers. Use Start instead. +// A non-zero status code returns an error. +func (image *Image) Run(ctx context.Context, cmd []string, opts ContainerOptions) ContainerExecResult { + c, err := image.Start(ctx, cmd, opts) + if err != nil { + return ContainerExecResult{ + Err: err, + ExitCode: -1, + Stdout: nil, + Stderr: nil, + } + } + return c.Wait(ctx, opts.LogTail) +} + +func (image *Image) imageRef() string { + return image.repository + ":" + image.tag +} + +// ensurePulled can only pull public images. +func (image *Image) ensurePulled(ctx context.Context) error { + ref := image.imageRef() + _, _, err := image.client.ImageInspectWithRaw(ctx, ref) + if err != nil { + rc, err := image.client.ImagePull(ctx, ref, types.ImagePullOptions{}) + if err != nil { + return fmt.Errorf("pull image %s: %w", ref, err) + } + _, _ = io.Copy(io.Discard, rc) + _ = rc.Close() + } + return nil +} + +func (image *Image) createContainer(ctx context.Context, containerName, hostName string, cmd []string, opts ContainerOptions) (string, error) { + // Although this shouldn't happen because the name includes randomness, in reality there seems to intermittent + // chances of collisions. + + containers, err := image.client.ContainerList(ctx, types.ContainerListOptions{ + All: true, + Filters: filters.NewArgs(filters.Arg("name", containerName)), + }) + if err != nil { + return "", fmt.Errorf("unable to list containers: %w", err) + } + + for _, c := range containers { + if err := image.client.ContainerRemove(ctx, c.ID, types.ContainerRemoveOptions{ + RemoveVolumes: true, + Force: true, + }); err != nil { + return "", fmt.Errorf("unable to remove container %s: %w", containerName, err) + } + } + + cc, err := image.client.ContainerCreate( + ctx, + &container.Config{ + Image: image.imageRef(), + + Entrypoint: []string{}, + WorkingDir: opts.WorkingDir, + Cmd: cmd, + + Env: opts.Env, + + Hostname: hostName, + User: opts.User, + + Labels: map[string]string{CleanupLabel: image.testName}, + }, + &container.HostConfig{ + Binds: opts.Binds, + PublishAllPorts: true, // Because we publish all ports, no need to expose specific ports. + AutoRemove: false, + Mounts: opts.Mounts, + }, + &network.NetworkingConfig{ + EndpointsConfig: map[string]*network.EndpointSettings{ + image.networkID: {}, + }, + }, + nil, + containerName, + ) + if err != nil { + return "", err + } + return cc.ID, nil +} + +// Start pulls the image if not present, creates a container, and runs it. +func (image *Image) Start(ctx context.Context, cmd []string, opts ContainerOptions) (*Container, error) { + if len(cmd) == 0 { + panic(errors.New("cmd cannot be empty")) + } + + if err := image.ensurePulled(ctx); err != nil { + return nil, image.wrapErr(err) + } + + var ( + containerName = SanitizeContainerName(image.testName + "-" + RandLowerCaseLetterString(6)) + hostName = CondenseHostName(containerName) + logger = image.log.With( + zap.String("command", strings.Join(cmd, " ")), + zap.String("hostname", hostName), + zap.String("container", containerName), + ) + ) + + cID, err := image.createContainer(ctx, containerName, hostName, cmd, opts) + if err != nil { + return nil, image.wrapErr(fmt.Errorf("create container %s: %w", containerName, err)) + } + + logger.Info("About to start container") + + err = StartContainer(ctx, image.client, cID) + if err != nil { + return nil, image.wrapErr(fmt.Errorf("start container %s: %w", containerName, err)) + } + + return &Container{ + Name: containerName, + Hostname: hostName, + log: logger, + image: image, + containerID: cID, + }, nil +} + +func (image *Image) wrapErr(err error) error { + return fmt.Errorf("image %s:%s: %w", image.repository, image.tag, err) +} + +// Container is a docker container. Use (*Image).Start to create a new container. +type Container struct { + Name string + Hostname string + + log *zap.Logger + image *Image + containerID string +} + +// Wait blocks until the container exits. Calling wait is not suitable for daemons and servers. +// A non-zero status code returns an error. +// +// Wait implicitly calls Stop. +// If logTail is non-zero, the stdout and stderr logs will be truncated at the end to that number of lines. +func (c *Container) Wait(ctx context.Context, logTail uint64) ContainerExecResult { + waitCh, errCh := c.image.client.ContainerWait(ctx, c.containerID, container.WaitConditionNotRunning) + var exitCode int + select { + case <-ctx.Done(): + return ContainerExecResult{ + Err: ctx.Err(), + ExitCode: 1, + Stdout: nil, + Stderr: nil, + } + case err := <-errCh: + return ContainerExecResult{ + Err: err, + ExitCode: 1, + Stdout: nil, + Stderr: nil, + } + case res := <-waitCh: + exitCode = int(res.StatusCode) + if res.Error != nil { + return ContainerExecResult{ + Err: errors.New(res.Error.Message), + ExitCode: exitCode, + Stdout: nil, + Stderr: nil, + } + } + } + + var ( + stdoutBuf = new(bytes.Buffer) + stderrBuf = new(bytes.Buffer) + ) + + logOpts := types.ContainerLogsOptions{ + ShowStdout: true, + ShowStderr: true, + } + if logTail != 0 { + logOpts.Tail = strconv.FormatUint(logTail, 10) + } + + rc, err := c.image.client.ContainerLogs(ctx, c.containerID, logOpts) + if err != nil { + return ContainerExecResult{ + Err: err, + ExitCode: exitCode, + Stdout: nil, + Stderr: nil, + } + } + defer func() { _ = rc.Close() }() + + // Logs are multiplexed into one stream; see docs for ContainerLogs. + _, err = stdcopy.StdCopy(stdoutBuf, stderrBuf, rc) + if err != nil { + return ContainerExecResult{ + Err: err, + ExitCode: exitCode, + Stdout: nil, + Stderr: nil, + } + } + _ = rc.Close() + + err = c.Stop(10 * time.Second) + if err != nil { + c.log.Error("Failed to stop and remove container", zap.Error(err), zap.String("container_id", c.containerID)) + } + + if exitCode != 0 { + out := strings.Join([]string{stdoutBuf.String(), stderrBuf.String()}, " ") + return ContainerExecResult{ + Err: fmt.Errorf("exit code %d: %s", exitCode, out), + ExitCode: exitCode, + Stdout: nil, + Stderr: nil, + } + } + + return ContainerExecResult{ + Err: nil, + ExitCode: exitCode, + Stdout: stdoutBuf.Bytes(), + Stderr: stderrBuf.Bytes(), + } +} + +// Stop gives the container up to timeout to stop and remove itself from the network. +func (c *Container) Stop(timeout time.Duration) error { + // Use timeout*2 to give both stop and remove container operations a chance to complete. + ctx, cancel := context.WithTimeout(context.Background(), timeout*2) + defer cancel() + + var stopOptions container.StopOptions + timeoutRound := int(timeout.Round(time.Second)) + stopOptions.Timeout = &timeoutRound + err := c.image.client.ContainerStop(ctx, c.containerID, stopOptions) + if err != nil { + // Only return the error if it didn't match an already stopped, or a missing container. + if !(errdefs.IsNotModified(err) || errdefs.IsNotFound(err)) { + return c.image.wrapErr(fmt.Errorf("stop container %s: %w", c.Name, err)) + } + } + + // RemoveContainerOptions duplicates (*dockertest.Resource).Prune. + err = c.image.client.ContainerRemove(ctx, c.containerID, types.ContainerRemoveOptions{ + Force: true, + RemoveVolumes: true, + }) + if err != nil && !errdefs.IsNotFound(err) { + return c.image.wrapErr(fmt.Errorf("remove container %s: %w", c.Name, err)) + } + + return nil +} diff --git a/tests/e2e-ibc/dockerutil/image_test.go b/tests/e2e-ibc/dockerutil/image_test.go new file mode 100644 index 0000000000..de0850d922 --- /dev/null +++ b/tests/e2e-ibc/dockerutil/image_test.go @@ -0,0 +1,191 @@ +package dockerutil + +import ( + "context" + "os" + "path/filepath" + "strings" + "testing" + "time" + + "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/filters" + "github.com/docker/docker/client" + "github.com/stretchr/testify/require" + "go.uber.org/zap" +) + +const ( + testDockerImage = "busybox" + testDockerTag = "latest" +) + +func TestNewImage(t *testing.T) { + if testing.Short() { + t.Skip("skipping in short mode") + } + t.Parallel() + + cl, networkID := DockerSetup(t) + + for _, tt := range []struct { + Client *client.Client + NetworkID string + Repository string + TestName string + }{ + {nil, networkID, "repo", t.Name()}, + {cl, "", "repo", t.Name()}, + {cl, networkID, "", t.Name()}, + {cl, networkID, "repo", ""}, + } { + require.Panics(t, func() { + NewImage(zap.NewNop(), tt.Client, tt.NetworkID, tt.TestName, tt.Repository, "") + }, tt) + } +} + +func TestImage_Run(t *testing.T) { + if testing.Short() { + t.Skip("skipping in short mode") + } + t.Parallel() + + ctx := context.Background() + client, networkID := DockerSetup(t) + image := NewImage(zap.NewNop(), client, networkID, t.Name(), testDockerImage, testDockerTag) + + t.Run("happy path", func(t *testing.T) { + res := image.Run(ctx, []string{"echo", "-n", "hello"}, ContainerOptions{}) + stdout, stderr, err := res.Stdout, res.Stderr, res.Err + + require.NoError(t, err) + require.Equal(t, "hello", string(stdout)) + require.Empty(t, string(stderr)) + }) + + t.Run("binds", func(t *testing.T) { + const scriptBody = `#!/bin/sh +echo -n hi from stderr >> /dev/stderr +` + tmpDir := t.TempDir() + err := os.WriteFile(filepath.Join(tmpDir, "test.sh"), []byte(scriptBody), 0777) + require.NoError(t, err) + + opts := ContainerOptions{ + Binds: []string{tmpDir + ":/test"}, + } + + res := image.Run(ctx, []string{"/test/test.sh"}, opts) + stdout, stderr, err := res.Stdout, res.Stderr, res.Err + + require.NoError(t, err) + require.Empty(t, string(stdout)) + require.Equal(t, "hi from stderr", string(stderr)) + }) + + t.Run("env vars", func(t *testing.T) { + opts := ContainerOptions{Env: []string{"MY_ENV_VAR=foo"}} + res := image.Run(ctx, []string{"printenv", "MY_ENV_VAR"}, opts) + stdout, stderr, err := res.Stdout, res.Stderr, res.Err + + require.NoError(t, err) + require.Equal(t, "foo", strings.TrimSpace(string(stdout))) + require.Empty(t, string(stderr)) + }) + + t.Run("context cancelled", func(t *testing.T) { + cctx, cancel := context.WithCancel(ctx) + cancel() + res := image.Run(cctx, []string{"sleep", "100"}, ContainerOptions{}) + err := res.Err + + require.Error(t, err) + require.ErrorIs(t, err, context.Canceled) + }) + + t.Run("errors", func(t *testing.T) { + for _, tt := range []struct { + Args []string + WantErr string + }{ + {[]string{"program-does-not-exist"}, "executable file not found"}, + {[]string{"sleep", "not-valid-arg"}, "sleep: invalid"}, + } { + res := image.Run(ctx, tt.Args, ContainerOptions{}) + err := res.Err + + require.Error(t, err, tt) + require.Contains(t, err.Error(), tt.WantErr, tt) + } + }) + + t.Run("missing required args", func(t *testing.T) { + require.PanicsWithError(t, "cmd cannot be empty", func() { + _ = image.Run(ctx, nil, ContainerOptions{}) + }) + }) +} + +func TestContainer(t *testing.T) { + if testing.Short() { + t.Skip("skipping in short mode") + } + t.Parallel() + + ctx := context.Background() + cl, networkID := DockerSetup(t) + image := NewImage(zap.NewNop(), cl, networkID, t.Name(), testDockerImage, testDockerTag) + + t.Run("wait", func(t *testing.T) { + c, err := image.Start(ctx, []string{"echo", "-n", "started"}, ContainerOptions{}) + + require.NoError(t, err) + require.NotEmpty(t, c.Name) + require.NotEmpty(t, c.Hostname) + + res := c.Wait(ctx, 0) + stdout, stderr, err := res.Stdout, res.Stderr, res.Err + + require.NoError(t, err) + require.Equal(t, "started", string(stdout)) + require.Empty(t, stderr) + + containers, err := image.client.ContainerList(ctx, types.ContainerListOptions{ + All: true, + Filters: filters.NewArgs(filters.Arg("name", c.Name)), + }) + require.NoError(t, err) + require.Empty(t, containers, "container was not removed") + + require.NoError(t, c.Stop(5*time.Second)) + }) + + t.Run("stop long running container", func(t *testing.T) { + c, err := image.Start(ctx, []string{"sleep", "100"}, ContainerOptions{}) + require.NoError(t, err) + require.NoError(t, c.Stop(10*time.Second)) + require.NoError(t, c.Stop(10*time.Second)) // assert idempotent + + containers, err := image.client.ContainerList(ctx, types.ContainerListOptions{ + All: true, + Filters: filters.NewArgs(filters.Arg("name", c.Name)), + }) + require.NoError(t, err) + require.Empty(t, containers, "container was not removed") + }) + + t.Run("start error", func(t *testing.T) { + c, err := image.Start(ctx, []string{"sleep", "not valid arg"}, ContainerOptions{}) + require.NoError(t, err) + + res := c.Wait(ctx, 0) + require.Error(t, res.Err) + }) + + t.Run("missing command", func(t *testing.T) { + require.Panics(t, func() { + _, _ = image.Start(ctx, nil, ContainerOptions{}) + }) + }) +} diff --git a/tests/e2e-ibc/dockerutil/keyring.go b/tests/e2e-ibc/dockerutil/keyring.go new file mode 100644 index 0000000000..9d54393bf3 --- /dev/null +++ b/tests/e2e-ibc/dockerutil/keyring.go @@ -0,0 +1,63 @@ +package dockerutil + +import ( + "archive/tar" + "bytes" + "context" + "io" + "os" + "path" + "path/filepath" + + "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" + "github.com/cosmos/cosmos-sdk/crypto/keyring" + "github.com/docker/docker/client" +) + +// NewLocalKeyringFromDockerContainer copies the contents of the given container directory into a specified local directory. +// This allows test hosts to sign transactions on behalf of test users. +func NewLocalKeyringFromDockerContainer(ctx context.Context, dc *client.Client, localDirectory, containerKeyringDir, containerId string) (keyring.Keyring, error) { + reader, _, err := dc.CopyFromContainer(ctx, containerId, containerKeyringDir) + if err != nil { + return nil, err + } + + if err := os.Mkdir(filepath.Join(localDirectory, "keyring-test"), os.ModePerm); err != nil { + return nil, err + } + tr := tar.NewReader(reader) + for { + hdr, err := tr.Next() + if err == io.EOF { + break // End of archive + } + if err != nil { + return nil, err + } + + var fileBuff bytes.Buffer + if _, err := io.Copy(&fileBuff, tr); err != nil { + return nil, err + } + + name := hdr.Name + extractedFileName := path.Base(name) + isDirectory := extractedFileName == "" + if isDirectory { + continue + } + + filePath := filepath.Join(localDirectory, "keyring-test", extractedFileName) + if err := os.WriteFile(filePath, fileBuff.Bytes(), os.ModePerm); err != nil { + return nil, err + } + } + + registry := codectypes.NewInterfaceRegistry() + cryptocodec.RegisterInterfaces(registry) + cdc := codec.NewProtoCodec(registry) + + return keyring.New("", keyring.BackendTest, localDirectory, os.Stdin, cdc) +} diff --git a/tests/e2e-ibc/dockerutil/ports.go b/tests/e2e-ibc/dockerutil/ports.go new file mode 100644 index 0000000000..7aedc13b56 --- /dev/null +++ b/tests/e2e-ibc/dockerutil/ports.go @@ -0,0 +1,91 @@ +package dockerutil + +import ( + "fmt" + "net" + "strconv" + "sync" + + "github.com/docker/go-connections/nat" +) + +var mu sync.RWMutex + +type Listeners []net.Listener + +func (l Listeners) CloseAll() { + for _, listener := range l { + listener.Close() + } +} + +// openListener opens a listener on a port. Set to 0 to get a random port. +func openListener(port int) (*net.TCPListener, error) { + addr, err := net.ResolveTCPAddr("tcp", fmt.Sprintf("127.0.0.1:%d", port)) + if err != nil { + return nil, err + } + + mu.Lock() + defer mu.Unlock() + l, err := net.ListenTCP("tcp", addr) + if err != nil { + return nil, err + } + + return l, nil +} + +// getPort generates a docker PortBinding by using the port provided. +// If port is set to 0, the next avaliable port will be used. +// The listener will be closed in the case of an error, otherwise it will be left open. +// This allows multiple getPort calls to find multiple available ports +// before closing them so they are available for the PortBinding. +func getPort(port int) (nat.PortBinding, *net.TCPListener, error) { + l, err := openListener(port) + if err != nil { + l.Close() + return nat.PortBinding{}, nil, err + } + + return nat.PortBinding{ + HostIP: "0.0.0.0", + HostPort: fmt.Sprint(l.Addr().(*net.TCPAddr).Port), + }, l, nil +} + +// GeneratePortBindings will find open ports on the local +// machine and create a PortBinding for every port in the portSet. +// If a port is already bound, it will use that port as an override. +func GeneratePortBindings(pairs nat.PortMap) (nat.PortMap, Listeners, error) { + m := make(nat.PortMap) + listeners := make(Listeners, 0, len(pairs)) + + var pb nat.PortBinding + var l *net.TCPListener + var err error + + for p, bind := range pairs { + if len(bind) == 0 { + // random port + pb, l, err = getPort(0) + } else { + var pNum int + if pNum, err = strconv.Atoi(bind[0].HostPort); err != nil { + return nat.PortMap{}, nil, err + } + + pb, l, err = getPort(pNum) + } + + if err != nil { + listeners.CloseAll() + return nat.PortMap{}, nil, err + } + + listeners = append(listeners, l) + m[p] = []nat.PortBinding{pb} + } + + return m, listeners, nil +} diff --git a/tests/e2e-ibc/dockerutil/setup.go b/tests/e2e-ibc/dockerutil/setup.go new file mode 100644 index 0000000000..517e1503b4 --- /dev/null +++ b/tests/e2e-ibc/dockerutil/setup.go @@ -0,0 +1,251 @@ +package dockerutil + +import ( + "bytes" + "context" + "fmt" + "os" + "strings" + "time" + + "github.com/avast/retry-go/v4" + "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/container" + "github.com/docker/docker/api/types/filters" + "github.com/docker/docker/client" + "github.com/docker/docker/errdefs" +) + +// DockerSetupTestingT is a subset of testing.T required for DockerSetup. +type DockerSetupTestingT interface { + Helper() + + Name() string + + Failed() bool + Cleanup(func()) + + Logf(format string, args ...any) +} + +// CleanupLabel is a docker label key targeted by DockerSetup when it cleans up docker resources. +// +// "interchaintest" is perhaps a better name. However, for backwards compatability we preserve the original name of "ibc-test" +// with the hyphen. Otherwise, we run the risk of causing "container already exists" errors because DockerSetup +// is unable to clean old resources from docker engine. +const CleanupLabel = "ibc-test" + +// CleanupLabel is the "old" format. +// Note that any new labels should follow the reverse DNS format suggested at +// https://docs.docker.com/config/labels-custom-metadata/#key-format-recommendations. + +const ( + // LabelPrefix is the reverse DNS format "namespace" for interchaintest Docker labels. + LabelPrefix = "ventures.strangelove.interchaintest." + + // NodeOwnerLabel indicates the logical node owning a particular object (probably a volume). + NodeOwnerLabel = LabelPrefix + "node-owner" +) + +// KeepVolumesOnFailure determines whether volumes associated with a test +// using DockerSetup are retained or deleted following a test failure. +// +// The value is false by default, but can be initialized to true by setting the +// environment variable IBCTEST_SKIP_FAILURE_CLEANUP to a non-empty value. +// Alternatively, importers of the dockerutil package may set the variable to true. +// Because dockerutil is an internal package, the public API for setting this value +// is interchaintest.KeepDockerVolumesOnFailure(bool). +var KeepVolumesOnFailure = os.Getenv("IBCTEST_SKIP_FAILURE_CLEANUP") != "" + +// DockerSetup returns a new Docker Client and the ID of a configured network, associated with t. +// +// If any part of the setup fails, DockerSetup panics because the test cannot continue. +func DockerSetup(t DockerSetupTestingT) (*client.Client, string) { + t.Helper() + + cli, err := client.NewClientWithOpts(client.FromEnv) + if err != nil { + panic(fmt.Errorf("failed to create docker client: %v", err)) + } + + // Clean up docker resources at end of test. + t.Cleanup(dockerCleanup(t, cli)) + + // Also eagerly clean up any leftover resources from a previous test run, + // e.g. if the test was interrupted. + dockerCleanup(t, cli)() + + name := fmt.Sprintf("interchaintest-%s", RandLowerCaseLetterString(8)) + network, err := cli.NetworkCreate(context.TODO(), name, types.NetworkCreate{ + CheckDuplicate: true, + + Labels: map[string]string{CleanupLabel: t.Name()}, + }) + if err != nil { + panic(fmt.Errorf("failed to create docker network: %v", err)) + } + + return cli, network.ID +} + +// dockerCleanup will clean up Docker containers, networks, and the other various config files generated in testing +func dockerCleanup(t DockerSetupTestingT, cli *client.Client) func() { + return func() { + showContainerLogs := os.Getenv("SHOW_CONTAINER_LOGS") + containerLogTail := os.Getenv("CONTAINER_LOG_TAIL") + keepContainers := os.Getenv("KEEP_CONTAINERS") != "" + + ctx := context.TODO() + cli.NegotiateAPIVersion(ctx) + cs, err := cli.ContainerList(ctx, types.ContainerListOptions{ + All: true, + Filters: filters.NewArgs( + filters.Arg("label", CleanupLabel+"="+t.Name()), + ), + }) + if err != nil { + t.Logf("Failed to list containers during docker cleanup: %v", err) + return + } + + for _, c := range cs { + if (t.Failed() && showContainerLogs == "") || showContainerLogs == "always" { + logTail := "50" + if containerLogTail != "" { + logTail = containerLogTail + } + rc, err := cli.ContainerLogs(ctx, c.ID, types.ContainerLogsOptions{ + ShowStdout: true, + ShowStderr: true, + Tail: logTail, + }) + if err == nil { + b := new(bytes.Buffer) + _, err := b.ReadFrom(rc) + if err == nil { + t.Logf("\n\nContainer logs - {%s}\n%s", strings.Join(c.Names, " "), b.String()) + } + } + } + if !keepContainers { + var stopTimeout container.StopOptions + timeout := 10 + timeoutDur := time.Duration(timeout * int(time.Second)) + deadline := time.Now().Add(timeoutDur) + stopTimeout.Timeout = &timeout + if err := cli.ContainerStop(ctx, c.ID, stopTimeout); isLoggableStopError(err) { + t.Logf("Failed to stop container %s during docker cleanup: %v", c.ID, err) + } + + waitCtx, cancel := context.WithDeadline(ctx, deadline.Add(500*time.Millisecond)) + waitCh, errCh := cli.ContainerWait(waitCtx, c.ID, container.WaitConditionNotRunning) + select { + case <-waitCtx.Done(): + t.Logf("Timed out waiting for container %s", c.ID) + case err := <-errCh: + t.Logf("Failed to wait for container %s during docker cleanup: %v", c.ID, err) + case res := <-waitCh: + if res.Error != nil { + t.Logf("Error while waiting for container %s during docker cleanup: %s", c.ID, res.Error.Message) + } + // Ignoring statuscode for now. + } + cancel() + + if err := cli.ContainerRemove(ctx, c.ID, types.ContainerRemoveOptions{ + // Not removing volumes with the container, because we separately handle them conditionally. + Force: true, + }); err != nil { + t.Logf("Failed to remove container %s during docker cleanup: %v", c.ID, err) + } + } + } + + if !keepContainers { + pruneVolumesWithRetry(ctx, t, cli) + pruneNetworksWithRetry(ctx, t, cli) + } else { + t.Logf("Keeping containers - Docker cleanup skipped") + } + } +} + +func pruneVolumesWithRetry(ctx context.Context, t DockerSetupTestingT, cli *client.Client) { + if KeepVolumesOnFailure && t.Failed() { + return + } + + var msg string + err := retry.Do( + func() error { + res, err := cli.VolumesPrune(ctx, filters.NewArgs(filters.Arg("label", CleanupLabel+"="+t.Name()))) + if err != nil { + if errdefs.IsConflict(err) { + // Prune is already in progress; try again. + return err + } + + // Give up on any other error. + return retry.Unrecoverable(err) + } + + if len(res.VolumesDeleted) > 0 { + msg = fmt.Sprintf("Pruned %d volumes, reclaiming approximately %.1f MB", len(res.VolumesDeleted), float64(res.SpaceReclaimed)/(1024*1024)) + } + + return nil + }, + retry.Context(ctx), + retry.DelayType(retry.FixedDelay), + ) + + if err != nil { + t.Logf("Failed to prune volumes during docker cleanup: %v", err) + return + } + + if msg != "" { + // Odd to Logf %s, but this is a defensive way to keep the DockerSetupTestingT interface + // with only Logf and not need to add Log. + t.Logf("%s", msg) + } +} + +func pruneNetworksWithRetry(ctx context.Context, t DockerSetupTestingT, cli *client.Client) { + var deleted []string + err := retry.Do( + func() error { + res, err := cli.NetworksPrune(ctx, filters.NewArgs(filters.Arg("label", CleanupLabel+"="+t.Name()))) + if err != nil { + if errdefs.IsConflict(err) { + // Prune is already in progress; try again. + return err + } + + // Give up on any other error. + return retry.Unrecoverable(err) + } + + deleted = res.NetworksDeleted + return nil + }, + retry.Context(ctx), + retry.DelayType(retry.FixedDelay), + ) + + if err != nil { + t.Logf("Failed to prune networks during docker cleanup: %v", err) + return + } + + if len(deleted) > 0 { + t.Logf("Pruned unused networks: %v", deleted) + } +} + +func isLoggableStopError(err error) bool { + if err == nil { + return false + } + return !(errdefs.IsNotModified(err) || errdefs.IsNotFound(err)) +} diff --git a/tests/e2e-ibc/dockerutil/setup_test.go b/tests/e2e-ibc/dockerutil/setup_test.go new file mode 100644 index 0000000000..020a450730 --- /dev/null +++ b/tests/e2e-ibc/dockerutil/setup_test.go @@ -0,0 +1,80 @@ +package dockerutil_test + +import ( + "context" + "fmt" + "testing" + + volumetypes "github.com/docker/docker/api/types/volume" + "github.com/docker/docker/errdefs" + "github.com/strangelove-ventures/interchaintest/v8/internal/dockerutil" + "github.com/strangelove-ventures/interchaintest/v8/internal/mocktesting" + "github.com/stretchr/testify/require" +) + +func TestDockerSetup_KeepVolumes(t *testing.T) { + if testing.Short() { + t.Skip("skipping due to short mode") + } + + cli, _ := dockerutil.DockerSetup(t) + + origKeep := dockerutil.KeepVolumesOnFailure + defer func() { + dockerutil.KeepVolumesOnFailure = origKeep + }() + + ctx := context.Background() + + for _, tc := range []struct { + keep bool + passed bool + volumeKept bool + }{ + {keep: false, passed: false, volumeKept: false}, + {keep: true, passed: false, volumeKept: true}, + {keep: false, passed: true, volumeKept: false}, + {keep: true, passed: true, volumeKept: false}, + } { + tc := tc + state := "failed" + if tc.passed { + state = "passed" + } + + testName := fmt.Sprintf("keep=%t, test %s", tc.keep, state) + t.Run(testName, func(t *testing.T) { + dockerutil.KeepVolumesOnFailure = tc.keep + mt := mocktesting.NewT(t.Name()) + + var volumeName string + mt.Simulate(func() { + cli, _ := dockerutil.DockerSetup(mt) + + v, err := cli.VolumeCreate(ctx, volumetypes.CreateOptions{ + Labels: map[string]string{dockerutil.CleanupLabel: mt.Name()}, + }) + require.NoError(t, err) + + volumeName = v.Name + + if !tc.passed { + mt.Fail() + } + }) + + require.Equal(t, !tc.passed, mt.Failed()) + + _, err := cli.VolumeInspect(ctx, volumeName) + if !tc.volumeKept { + require.Truef(t, errdefs.IsNotFound(err), "expected not found error, got %v", err) + return + } + + require.NoError(t, err) + if err := cli.VolumeRemove(ctx, volumeName, true); err != nil { + t.Logf("failed to remove volume %s: %v", volumeName, err) + } + }) + } +} diff --git a/tests/e2e-ibc/dockerutil/startcontainer.go b/tests/e2e-ibc/dockerutil/startcontainer.go new file mode 100644 index 0000000000..a4a3153c59 --- /dev/null +++ b/tests/e2e-ibc/dockerutil/startcontainer.go @@ -0,0 +1,26 @@ +package dockerutil + +import ( + "context" + "time" + + "github.com/docker/docker/api/types" + "github.com/docker/docker/client" +) + +// StartContainer attempts to start the container with the given ID. +func StartContainer(ctx context.Context, cli *client.Client, id string) error { + // add a deadline for the request if the calling context does not provide one + if _, hasDeadline := ctx.Deadline(); !hasDeadline { + var cancel func() + ctx, cancel = context.WithTimeout(ctx, 30*time.Second) + defer cancel() + } + + err := cli.ContainerStart(ctx, id, types.ContainerStartOptions{}) + if err != nil { + return err + } + + return nil +} diff --git a/tests/e2e-ibc/dockerutil/strings.go b/tests/e2e-ibc/dockerutil/strings.go new file mode 100644 index 0000000000..1c0adba993 --- /dev/null +++ b/tests/e2e-ibc/dockerutil/strings.go @@ -0,0 +1,96 @@ +package dockerutil + +import ( + "fmt" + "math/rand" + "net" + "os" + "regexp" + "runtime" + "time" + + "github.com/docker/docker/api/types" + "github.com/docker/go-connections/nat" +) + +// GetHostPort returns a resource's published port with an address. +// cont is the type returned by the Docker client's ContainerInspect method. +func GetHostPort(cont types.ContainerJSON, portID string) string { + if cont.NetworkSettings == nil { + return "" + } + + m, ok := cont.NetworkSettings.Ports[nat.Port(portID)] + if !ok || len(m) == 0 { + return "" + } + + return net.JoinHostPort(m[0].HostIP, m[0].HostPort) +} + +// Ensure that the global RNG is seeded when this package is imported. +// Otherwise, each importer would need to seed explicitly on their own. +// +// Without pre-seeding, it is possible for two independent test binaries +// to attempt to create a Docker network with the same random suffix +// due to unintentionally both using the default seed. +func init() { + rand.Seed(time.Now().UnixNano()) +} + +var chars = []byte("abcdefghijklmnopqrstuvwxyz") + +// RandLowerCaseLetterString returns a lowercase letter string of given length +func RandLowerCaseLetterString(length int) string { + b := make([]byte, length) + for i := range b { + b[i] = chars[rand.Intn(len(chars))] + } + return string(b) +} + +func GetDockerUserString() string { + uid := os.Getuid() + var usr string + if runtime.GOOS == "darwin" { + usr = "" + } else { + usr = fmt.Sprintf("%d:%d", uid, uid) + } + return usr +} + +func GetHeighlinerUserString() string { + return "1025:1025" +} + +func GetRootUserString() string { + return "0:0" +} + +// CondenseHostName truncates the middle of the given name +// if it is 64 characters or longer. +// +// Without this helper, you may see an error like: +// +// API error (500): failed to create shim: OCI runtime create failed: container_linux.go:380: starting container process caused: process_linux.go:545: container init caused: sethostname: invalid argument: unknown +func CondenseHostName(name string) string { + if len(name) < 64 { + return name + } + + // I wanted to use ... as the middle separator, + // but that causes resolution problems for other hosts. + // Instead, use _._ which will be okay if there is a . on either end. + return name[:30] + "_._" + name[len(name)-30:] +} + +var validContainerCharsRE = regexp.MustCompile(`[^a-zA-Z0-9_.-]`) + +// SanitizeContainerName returns name with any +// invalid characters replaced with underscores. +// Subtests will include slashes, and there may be other +// invalid characters too. +func SanitizeContainerName(name string) string { + return validContainerCharsRE.ReplaceAllLiteralString(name, "_") +} diff --git a/tests/e2e-ibc/dockerutil/strings_test.go b/tests/e2e-ibc/dockerutil/strings_test.go new file mode 100644 index 0000000000..ff806ae7c9 --- /dev/null +++ b/tests/e2e-ibc/dockerutil/strings_test.go @@ -0,0 +1,88 @@ +package dockerutil + +import ( + "math/rand" + "testing" + + "github.com/docker/docker/api/types" + "github.com/docker/go-connections/nat" + "github.com/stretchr/testify/require" +) + +func TestGetHostPort(t *testing.T) { + for _, tt := range []struct { + Container types.ContainerJSON + PortID string + Want string + }{ + { + types.ContainerJSON{ + NetworkSettings: &types.NetworkSettings{ + NetworkSettingsBase: types.NetworkSettingsBase{ + Ports: nat.PortMap{ + nat.Port("test"): []nat.PortBinding{ + {HostIP: "1.2.3.4", HostPort: "8080"}, + {HostIP: "0.0.0.0", HostPort: "9999"}, + }, + }, + }, + }, + }, "test", "1.2.3.4:8080", + }, + { + types.ContainerJSON{ + NetworkSettings: &types.NetworkSettings{ + NetworkSettingsBase: types.NetworkSettingsBase{ + Ports: nat.PortMap{ + nat.Port("test"): []nat.PortBinding{ + {HostIP: "0.0.0.0", HostPort: "3000"}, + }, + }, + }, + }, + }, "test", "0.0.0.0:3000", + }, + + {types.ContainerJSON{}, "", ""}, + {types.ContainerJSON{NetworkSettings: &types.NetworkSettings{}}, "does-not-matter", ""}, + } { + require.Equal(t, tt.Want, GetHostPort(tt.Container, tt.PortID), tt) + } +} + +func TestRandLowerCaseLetterString(t *testing.T) { + require.Empty(t, RandLowerCaseLetterString(0)) + + rand.Seed(1) + require.Equal(t, "xvlbzgbaicmr", RandLowerCaseLetterString(12)) + + rand.Seed(1) + require.Equal(t, "xvlbzgbaicmrajwwhthctcuaxhxkqf", RandLowerCaseLetterString(30)) +} + +func TestCondenseHostName(t *testing.T) { + for _, tt := range []struct { + HostName, Want string + }{ + {"", ""}, + {"test", "test"}, + {"some-really-very-incredibly-long-hostname-that-is-greater-than-64-characters", "some-really-very-incredibly-lo_._-is-greater-than-64-characters"}, + } { + require.Equal(t, tt.Want, CondenseHostName(tt.HostName), tt) + } +} + +func TestSanitizeContainerName(t *testing.T) { + for _, tt := range []struct { + Name, Want string + }{ + {"hello-there", "hello-there"}, + {"hello@there", "hello_there"}, + {"hello@/there", "hello__there"}, + // edge cases + {"?", "_"}, + {"", ""}, + } { + require.Equal(t, tt.Want, SanitizeContainerName(tt.Name), tt) + } +} diff --git a/tests/e2e-ibc/dockerutil/volumeowner.go b/tests/e2e-ibc/dockerutil/volumeowner.go new file mode 100644 index 0000000000..6227194ee5 --- /dev/null +++ b/tests/e2e-ibc/dockerutil/volumeowner.go @@ -0,0 +1,109 @@ +package dockerutil + +import ( + "context" + "fmt" + "time" + + "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/container" + "github.com/docker/docker/client" + "go.uber.org/zap" +) + +// VolumeOwnerOptions contain the configuration for the SetVolumeOwner function. +type VolumeOwnerOptions struct { + Log *zap.Logger + + Client *client.Client + + VolumeName string + ImageRef string + TestName string + UidGid string +} + +// SetVolumeOwner configures the owner of a volume to match the default user in the supplied image reference. +func SetVolumeOwner(ctx context.Context, opts VolumeOwnerOptions) error { + owner := opts.UidGid + if owner == "" { + owner = GetRootUserString() + } + + // Start a one-off container to chmod and chown the volume. + + containerName := fmt.Sprintf("interchaintest-volumeowner-%d-%s", time.Now().UnixNano(), RandLowerCaseLetterString(5)) + + if err := ensureBusybox(ctx, opts.Client); err != nil { + return err + } + + const mountPath = "/mnt/dockervolume" + cc, err := opts.Client.ContainerCreate( + ctx, + &container.Config{ + Image: busyboxRef, // Using busybox image which has chown and chmod. + + Entrypoint: []string{"sh", "-c"}, + Cmd: []string{ + `chown "$2" "$1" && chmod 0700 "$1"`, + "_", // Meaningless arg0 for sh -c with positional args. + mountPath, + owner, + }, + + // Root user so we have permissions to set ownership and mode. + User: GetRootUserString(), + + Labels: map[string]string{CleanupLabel: opts.TestName}, + }, + &container.HostConfig{ + Binds: []string{opts.VolumeName + ":" + mountPath}, + AutoRemove: true, + }, + nil, // No networking necessary. + nil, + containerName, + ) + if err != nil { + return fmt.Errorf("creating container: %w", err) + } + + autoRemoved := false + defer func() { + if autoRemoved { + // No need to attempt removing the container if we successfully started and waited for it to complete. + return + } + + if err := opts.Client.ContainerRemove(ctx, cc.ID, types.ContainerRemoveOptions{ + Force: true, + }); err != nil { + opts.Log.Warn("Failed to remove volume-owner container", zap.String("container_id", cc.ID), zap.Error(err)) + } + }() + + if err := opts.Client.ContainerStart(ctx, cc.ID, types.ContainerStartOptions{}); err != nil { + return fmt.Errorf("starting volume-owner container: %w", err) + } + + waitCh, errCh := opts.Client.ContainerWait(ctx, cc.ID, container.WaitConditionNotRunning) + select { + case <-ctx.Done(): + return ctx.Err() + case err := <-errCh: + return err + case res := <-waitCh: + autoRemoved = true + + if res.Error != nil { + return fmt.Errorf("waiting for volume-owner container: %s", res.Error.Message) + } + + if res.StatusCode != 0 { + return fmt.Errorf("configuring volume exited %d", res.StatusCode) + } + } + + return nil +} diff --git a/tests/e2e-ibc/erc20_test.go b/tests/e2e-ibc/erc20_test.go index 642f8829b2..e5a25fcf56 100644 --- a/tests/e2e-ibc/erc20_test.go +++ b/tests/e2e-ibc/erc20_test.go @@ -5,6 +5,7 @@ import ( "crypto/sha256" "encoding/json" "fmt" + "github.com/strangelove-ventures/interchaintest/v8" "math/big" "path/filepath" "testing" @@ -17,14 +18,13 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" gov1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" paramsutils "github.com/cosmos/cosmos-sdk/x/params/client/utils" - transfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" + transfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" "github.com/ethereum/go-ethereum/ethclient" - "github.com/strangelove-ventures/interchaintest/v7" - "github.com/strangelove-ventures/interchaintest/v7/chain/cosmos" - "github.com/strangelove-ventures/interchaintest/v7/ibc" - "github.com/strangelove-ventures/interchaintest/v7/testreporter" + "github.com/strangelove-ventures/interchaintest/v8/chain/cosmos" + "github.com/strangelove-ventures/interchaintest/v8/ibc" + "github.com/strangelove-ventures/interchaintest/v8/testreporter" "github.com/kava-labs/kava/app" "github.com/kava-labs/kava/client/erc20" @@ -44,8 +44,14 @@ func TestInterchainErc20(t *testing.T) { app.SetSDKConfig() ctx := context.Background() + // exportGenesis := os.Getenv("EXPORT_GENESIS_FILE_PATH") + // export EXPORT_GENESIS_FILE_PATH=./e2e_genesis.json + // export EXPORT_GENESIS_CHAIN=kava_8888-1 + // exportGenesisChain := os.Getenv("EXPORT_GENESIS_CHAIN") + // Configure & run chains with interchaintest cf := interchaintest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*interchaintest.ChainSpec{ + //{Name: "kava", Version: "local", ChainConfig: kavainterchain.DefaultKavaChainConfig(kavainterchain.KavaTestChainId)}, {Name: "kava", ChainConfig: kavainterchain.DefaultKavaChainConfig(kavainterchain.KavaTestChainId)}, {Name: "gaia", Version: "v15.2.0", ChainConfig: ibc.ChainConfig{GasPrices: "0.0uatom"}}, }) @@ -61,6 +67,15 @@ func TestInterchainErc20(t *testing.T) { r := interchaintest.NewBuiltinRelayerFactory(ibc.CosmosRly, zaptest.NewLogger(t)). Build(t, client, network) + // // Get a relayer instance + // rf := interchaintest.NewBuiltinRelayerFactory( + // ibc.CosmosRly, + // zaptest.NewLogger(t), + // relayer.StartupFlags("-b", "100"), + // ) + // + // r := rf.Build(t, client, network) + // configure interchain const kavaGaiaIbcPath = "kava-gaia-ibc" ic := interchaintest.NewInterchain().AddChain(ictKava). @@ -76,23 +91,34 @@ func TestInterchainErc20(t *testing.T) { // Log location f, err := interchaintest.CreateLogFile(fmt.Sprintf("%d.json", time.Now().Unix())) require.NoError(t, err) + fmt.Println("f: ", f.Name()) // Reporter/logs rep := testreporter.NewReporter(f) + fmt.Println("rep: ", rep) eRep := rep.RelayerExecReporter(t) + fmt.Println("eRep: ", eRep) // Build interchain err = ic.Build(ctx, eRep, interchaintest.InterchainBuildOptions{ TestName: t.Name(), Client: client, NetworkID: network, - SkipPathCreation: false}, + SkipPathCreation: false, + }, ) require.NoError(t, err) + fmt.Println("built interchain", err) + // Create and Fund User Wallets fundAmount := math.NewInt(1e12) users := interchaintest.GetAndFundTestUsers(t, ctx, t.Name(), fundAmount, ictKava, gaia) + fmt.Println("users: ", users) + for i, u := range users { + fmt.Println("user: ", i, u, u.KeyName()) + } + // kava tx bank send faucet kava1m6477zyykew9ezxl599qc2lurz83elwv5xx332 1000000000000ukava --gas-prices 0ukava --gas-adjustment 1.5 --from faucet --keyring-backend test --output json -y --chain-id kava_8888-1 --home /var/cosmos-chain/kava-1 --node tcp://kava_8888-1-val-0-TestInterchainErc20:26657 kavaUser := users[0] gaiaUser := users[1] @@ -116,12 +142,37 @@ func TestInterchainErc20(t *testing.T) { // default coin type to 60 in the chain config. // we need to fund an account and then all of kava's e2e testutil chain management will work. - rpcUrl, err := ictKava.FullNodes[0].GetHostAddress(ctx, "26657/tcp") - require.NoError(t, err, "failed to find rpc URL") - grpcUrl, err := ictKava.FullNodes[0].GetHostAddress(ctx, "9090/tcp") - require.NoError(t, err, "failed to find grpc URL") - evmUrl, err := ictKava.FullNodes[0].GetHostAddress(ctx, "8545/tcp") + //rpcUrl, err := ictKava.FullNodes[0].GetHostAddress(ctx, "26657/tcp") + //require.NoError(t, err, "failed to find rpc URL") + rpcUrl := ictKava.GetHostRPCAddress() + fmt.Println("rpcUrl: ", rpcUrl) + //grpcUrl, err := ictKava.FullNodes[0].GetHostAddress(ctx, "9090/tcp") + //require.NoError(t, err, "failed to find grpc URL") + grpcUrl := "http://" + ictKava.GetHostGRPCAddress() + fmt.Println("grpcUrl: ", grpcUrl) + //evmUrl, err := ictKava.FullNodes[0].GetHostAddress(ctx, "8545/tcp") + require.NoError(t, err, "failed to find evm URL") + evmUrl := ictKava.GetHostAPIAddress() + fmt.Println("evmUrl 1: ", evmUrl) + + // lifecycle is hidden for package, so we will need fork with an expose method for the particular port. + // at the moment such unsafe workaround + //value := reflect.ValueOf(ictKava).FieldByName("containerLifecycle") + // + //var containerLifecycle *dockerutil.ContainerLifecycle + // + //if value.IsValid() && value.CanInterface() { + // fmt.Println(value.Interface().(*dockerutil.ContainerLifecycle)) + // containerLifecycle = value.Interface().(*dockerutil.ContainerLifecycle) + //} else { + // panic("containerLifecycle is not valid") + //} + hostPorts, err := ictKava.Validators[0].ContainerLifecycle.GetHostPorts(ctx, "8545/tcp") + //hostPorts, err := ictKava.FullNodes[0].ContainerLifecycle.GetHostPorts(ctx, "8545/tcp") + //hostPorts, err := containerLifecycle.GetHostPorts(ctx, "8545/tcp") require.NoError(t, err, "failed to find evm URL") + evmUrl = "http://" + hostPorts[0] + fmt.Println("evmUrl 2:", evmUrl) evmClient, err := ethclient.Dial(evmUrl) require.NoError(t, err, "failed to connect to evm") @@ -134,6 +185,7 @@ func TestInterchainErc20(t *testing.T) { require.NoError(t, err) deployerKavaAddr := util.EvmToSdkAddress(evmDeployer.Address()) + fmt.Println("going to send funds from", kavaUser.KeyName(), "to ", deployerKavaAddr.String()) err = ictKava.SendFunds(ctx, kavaUser.KeyName(), ibc.WalletAmount{ Address: deployerKavaAddr.String(), Denom: "ukava", @@ -189,26 +241,33 @@ func TestInterchainErc20(t *testing.T) { Value: rawCps, }, }, - Deposit: "10000000ukava", + Deposit: "1000000000ukava", } - _, err = legacyParamChangeProposal(ictKava.FullNodes[0], ctx, kavaUser.KeyName(), ¶mChange) + fmt.Println("kavaUser", kavaUser.KeyName()) + fmt.Println("full node 0", ictKava.Validators[0]) + _, err = legacyParamChangeProposal(ictKava.Validators[0], ctx, kavaUser.KeyName(), ¶mChange) require.NoError(t, err, "error submitting param change proposal tx") // TODO: query proposal id. assuming it is 1 here. propId := int64(1) // 2. Vote on Proposal - err = ictKava.VoteOnProposalAllValidators(ctx, propId, cosmos.ProposalVoteYes) + //err = ictKava.VoteOnProposalAllValidators(ctx, propId, cosmos.ProposalVoteYes) + proIDString := fmt.Sprintf("%d", propId) + err = ictKava.VoteOnProposalAllValidators(ctx, proIDString, cosmos.ProposalVoteYes) require.NoError(t, err, "failed to submit votes") height, _ = ictKava.Height(ctx) - _, err = cosmos.PollForProposalStatus(ctx, ictKava, height, height+10, propId, gov1beta1.StatusPassed) + _, err = cosmos.PollForProposalStatus(ctx, ictKava, height, height+10, uint64(propId), gov1beta1.StatusPassed) require.NoError(t, err, "proposal status did not change to passed in expected number of blocks") // fund a user & mint them some usdt - user := kava.NewFundedAccount("tether-user", sdk.NewCoins(sdk.NewCoin("ukava", math.NewInt(1e7)))) + //user := kava.NewFundedAccount("tether-user", sdk.NewCoins(sdk.NewCoin("ukava", math.NewInt(1e7)))) + user := kava.NewFundedAccount("tether-user", sdk.NewCoins(sdk.NewCoin("ukava", math.NewInt(1e9)))) erc20FundAmt := big.NewInt(100e6) + // 10000000 + //erc20FundAmt := big.NewInt(6_000_000_000) mintTx, err := usdt.Mint(deployer.EvmAuth, user.EvmAddress, erc20FundAmt) require.NoError(t, err) @@ -228,13 +287,16 @@ func TestInterchainErc20(t *testing.T) { amountToConvert, ) convertTx := util.KavaMsgRequest{ - Msgs: []sdk.Msg{&msg}, - GasLimit: 4e5, - FeeAmount: sdk.NewCoins(sdk.NewCoin("ukava", sdk.NewInt(400))), - Data: "converting sdk coin to erc20", + Msgs: []sdk.Msg{&msg}, + GasLimit: 4e5, + //FeeAmount: sdk.NewCoins(sdk.NewCoin("ukava", math.NewInt(400))), + FeeAmount: sdk.NewCoins(sdk.NewCoin("ukava", math.NewInt(40000000))), + // 40000000ukava: + Data: "converting sdk coin to erc20", } res := user.SignAndBroadcastKavaTx(convertTx) require.NoError(t, res.Err) + fmt.Println("res: ", res) // check balance of cosmos coin! sdkBalance := kava.QuerySdkForBalances(user.SdkAddress) @@ -270,6 +332,7 @@ func legacyParamChangeProposal(tn *cosmos.ChainNode, ctx context.Context, keyNam if err != nil { return "", err } + fmt.Println("content: ", string(content)) hash := sha256.Sum256(content) proposalFilename := fmt.Sprintf("%x.json", hash) @@ -286,5 +349,8 @@ func legacyParamChangeProposal(tn *cosmos.ChainNode, ctx context.Context, keyNam proposalPath, } + fmt.Println("command: ", command) + fmt.Println("keyName: ", keyName) + return tn.ExecTx(ctx, keyName, command...) } diff --git a/tests/e2e-ibc/go.mod b/tests/e2e-ibc/go.mod index e5e6c1f156..2b5bd8545b 100644 --- a/tests/e2e-ibc/go.mod +++ b/tests/e2e-ibc/go.mod @@ -4,99 +4,104 @@ go 1.21.9 require ( cosmossdk.io/math v1.3.0 - github.com/cosmos/ibc-go/v7 v7.4.0 - github.com/ethereum/go-ethereum v1.10.26 - github.com/stretchr/testify v1.9.0 - go.uber.org/zap v1.26.0 -) - -require ( - github.com/cosmos/cosmos-sdk v0.47.10 + github.com/avast/retry-go/v4 v4.5.1 + github.com/cosmos/cosmos-sdk v0.53.0 + github.com/cosmos/ibc-go/v8 v8.5.1 + github.com/docker/docker v24.0.7+incompatible + github.com/docker/go-connections v0.5.0 + github.com/ethereum/go-ethereum v1.13.14 github.com/kava-labs/kava v0.0.0-00010101000000-000000000000 - github.com/strangelove-ventures/interchaintest/v7 v7.0.1-0.20240506191732-71a15c29f2b7 + github.com/strangelove-ventures/interchaintest/v8 v8.2.0 + github.com/stretchr/testify v1.9.0 + go.uber.org/zap v1.27.0 ) require ( - cloud.google.com/go v0.112.0 // indirect - cloud.google.com/go/compute v1.24.0 // indirect - cloud.google.com/go/compute/metadata v0.2.3 // indirect - cloud.google.com/go/iam v1.1.6 // indirect - cloud.google.com/go/storage v1.36.0 // indirect - cosmossdk.io/api v0.3.1 // indirect - cosmossdk.io/core v0.6.1 // indirect - cosmossdk.io/depinject v1.0.0-alpha.4 // indirect + cloud.google.com/go v0.115.1 // indirect + cloud.google.com/go/auth v0.8.1 // indirect + cloud.google.com/go/auth/oauth2adapt v0.2.3 // indirect + cloud.google.com/go/compute/metadata v0.5.0 // indirect + cloud.google.com/go/iam v1.1.13 // indirect + cloud.google.com/go/storage v1.43.0 // indirect + cosmossdk.io/api v0.7.5 // indirect + cosmossdk.io/client/v2 v2.0.0-beta.3 // indirect + cosmossdk.io/collections v0.4.0 // indirect + cosmossdk.io/core v0.12.0 // indirect + cosmossdk.io/depinject v1.0.0 // indirect cosmossdk.io/errors v1.0.1 // indirect - cosmossdk.io/log v1.3.1 // indirect - cosmossdk.io/tools/rosetta v0.2.1 // indirect - filippo.io/edwards25519 v1.0.0 // indirect + cosmossdk.io/log v1.4.1 // indirect + cosmossdk.io/store v1.1.1 // indirect + cosmossdk.io/x/evidence v0.1.1 // indirect + cosmossdk.io/x/feegrant v0.1.1 // indirect + cosmossdk.io/x/tx v0.13.5 // indirect + cosmossdk.io/x/upgrade v0.1.4 // indirect + filippo.io/edwards25519 v1.1.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.2 // indirect - github.com/BurntSushi/toml v1.3.2 // indirect + github.com/BurntSushi/toml v1.4.0 // indirect github.com/ChainSafe/go-schnorrkel v1.0.0 // indirect + github.com/ChainSafe/go-schnorrkel/1 v0.0.0-00010101000000-000000000000 // indirect + github.com/ComposableFi/go-subkey/v2 v2.0.0-tm03420 // indirect + github.com/DataDog/datadog-go v3.2.0+incompatible // indirect github.com/DataDog/zstd v1.5.5 // indirect github.com/FactomProject/basen v0.0.0-20150613233007-fe3947df716e // indirect github.com/FactomProject/btcutilecc v0.0.0-20130527213604-d3a63a5752ec // indirect github.com/Microsoft/go-winio v0.6.1 // indirect + github.com/PuerkitoBio/purell v1.1.1 // indirect + github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect github.com/StackExchange/wmi v1.2.1 // indirect github.com/StirlingMarketingGroup/go-namecase v1.0.0 // indirect github.com/VictoriaMetrics/fastcache v1.12.1 // indirect - github.com/armon/go-metrics v0.4.1 // indirect - github.com/avast/retry-go/v4 v4.5.0 // indirect - github.com/aws/aws-sdk-go v1.44.203 // indirect + github.com/aws/aws-sdk-go v1.55.5 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect - github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect - github.com/btcsuite/btcd v0.24.0 // indirect - github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect - github.com/btcsuite/btcd/btcutil v1.1.5 // indirect + github.com/bgentry/speakeasy v0.2.0 // indirect + github.com/bits-and-blooms/bitset v1.10.0 // indirect + github.com/btcsuite/btcd v0.24.2 // indirect + github.com/btcsuite/btcd/btcec/v2 v2.3.4 // indirect + github.com/btcsuite/btcd/btcutil v1.1.6 // indirect github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 // indirect - github.com/cenkalti/backoff/v4 v4.1.3 // indirect - github.com/cespare/xxhash v1.1.0 // indirect + github.com/cenkalti/backoff/v4 v4.3.0 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/chzyer/readline v1.5.1 // indirect - github.com/cockroachdb/errors v1.11.1 // indirect + github.com/cockroachdb/errors v1.11.3 // indirect + github.com/cockroachdb/fifo v0.0.0-20240606204812-0bbfbd93a7ce // indirect github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect - github.com/cockroachdb/pebble v1.1.0 // indirect + github.com/cockroachdb/pebble v1.1.1 // indirect github.com/cockroachdb/redact v1.1.5 // indirect github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect github.com/coinbase/rosetta-sdk-go/types v1.0.0 // indirect - github.com/cometbft/cometbft v0.37.9 // indirect - github.com/cometbft/cometbft-db v0.9.1 // indirect - github.com/confio/ics23/go v0.9.0 // indirect + github.com/cometbft/cometbft v1.0.0-rc1.0.20240908111210-ab0be101882f // indirect github.com/cosmos/btcutil v1.0.5 // indirect github.com/cosmos/cosmos-db v1.0.2 // indirect github.com/cosmos/cosmos-proto v1.0.0-beta.5 // indirect + github.com/cosmos/cosmos-sdk/x/upgrade v0.1.4 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect - github.com/cosmos/gogoproto v1.4.10 // indirect + github.com/cosmos/gogoproto v1.7.0 // indirect github.com/cosmos/iavl v1.2.0 // indirect - github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7 v7.1.3 // indirect - github.com/cosmos/ibc-go/modules/capability v1.0.0-rc1 // indirect - github.com/cosmos/ics23/go v0.10.0 // indirect - github.com/cosmos/interchain-security/v3 v3.1.1-0.20231102122221-81650a84f989 // indirect + github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8 v8.0.2 // indirect + github.com/cosmos/ibc-go/modules/capability v1.0.1 // indirect + github.com/cosmos/ics23/go v0.11.0 // indirect github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect + github.com/cosmos/rosetta v0.50.6 // indirect github.com/cosmos/rosetta-sdk-go v0.10.0 // indirect - github.com/creachadair/taskgroup v0.4.2 // indirect - github.com/danieljoos/wincred v1.1.2 // indirect + github.com/danieljoos/wincred v1.2.1 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/deckarep/golang-set v1.8.0 // indirect github.com/decred/base58 v1.0.4 // indirect github.com/decred/dcrd/crypto/blake256 v1.0.1 // indirect github.com/decred/dcrd/dcrec/secp256k1/v2 v2.0.1 // indirect - github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect + github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect - github.com/dgraph-io/badger/v2 v2.2007.4 // indirect - github.com/dgraph-io/ristretto v0.1.1 // indirect - github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect github.com/docker/distribution v2.8.2+incompatible // indirect - github.com/docker/docker v24.0.7+incompatible // indirect - github.com/docker/go-connections v0.4.0 // indirect github.com/docker/go-units v0.5.0 // indirect github.com/dustin/go-humanize v1.0.1 // indirect github.com/dvsekhvalnov/jose2go v1.6.0 // indirect github.com/edsrzf/mmap-go v1.0.0 // indirect github.com/emicklei/dot v1.6.1 // indirect github.com/evmos/ethermint v0.21.0 // indirect + github.com/fatih/color v1.16.0 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff // indirect @@ -104,73 +109,76 @@ require ( github.com/go-kit/kit v0.13.0 // indirect github.com/go-kit/log v0.2.1 // indirect github.com/go-logfmt/logfmt v0.6.0 // indirect - github.com/go-logr/logr v1.4.1 // indirect + github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-ole/go-ole v1.3.0 // indirect github.com/go-stack/stack v1.8.1 // indirect github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect github.com/gogo/googleapis v1.4.1 // indirect github.com/gogo/protobuf v1.3.3 // indirect - github.com/golang/glog v1.2.0 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/mock v1.6.0 // indirect github.com/golang/protobuf v1.5.4 // indirect github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect - github.com/google/btree v1.1.2 // indirect + github.com/google/btree v1.1.3 // indirect github.com/google/go-cmp v0.6.0 // indirect github.com/google/orderedcode v0.0.1 // indirect - github.com/google/s2a-go v0.1.7 // indirect + github.com/google/s2a-go v0.1.8 // indirect github.com/google/uuid v1.6.0 // indirect github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect - github.com/googleapis/gax-go/v2 v2.12.0 // indirect - github.com/gorilla/handlers v1.5.1 // indirect - github.com/gorilla/mux v1.8.0 // indirect - github.com/gorilla/websocket v1.5.0 // indirect + github.com/googleapis/gax-go/v2 v2.13.0 // indirect + github.com/gorilla/handlers v1.5.2 // indirect + github.com/gorilla/mux v1.8.1 // indirect + github.com/gorilla/websocket v1.5.3 // indirect + github.com/goware/urlx v0.3.2 // indirect github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect github.com/gtank/merlin v0.1.1 // indirect github.com/gtank/ristretto255 v0.1.2 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect - github.com/hashicorp/go-getter v1.7.5 // indirect + github.com/hashicorp/go-getter v1.7.6 // indirect + github.com/hashicorp/go-hclog v1.5.0 // indirect github.com/hashicorp/go-immutable-radix v1.3.1 // indirect + github.com/hashicorp/go-metrics v0.5.3 // indirect + github.com/hashicorp/go-plugin v1.6.0 // indirect github.com/hashicorp/go-safetemp v1.0.0 // indirect - github.com/hashicorp/go-version v1.6.0 // indirect + github.com/hashicorp/go-version v1.7.0 // indirect github.com/hashicorp/golang-lru v1.0.2 // indirect github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect github.com/hashicorp/hcl v1.0.0 // indirect - github.com/hdevalence/ed25519consensus v0.1.0 // indirect + github.com/hashicorp/yamux v0.1.1 // indirect + github.com/hdevalence/ed25519consensus v0.2.0 // indirect github.com/holiman/bloomfilter/v2 v2.0.3 // indirect github.com/holiman/uint256 v1.2.4 // indirect - github.com/huandu/skiplist v1.2.0 // indirect + github.com/huandu/skiplist v1.2.1 // indirect github.com/huin/goupnp v1.3.0 // indirect - github.com/iancoleman/orderedmap v0.2.0 // indirect + github.com/iancoleman/orderedmap v0.3.0 // indirect + github.com/iancoleman/strcase v0.3.0 // indirect github.com/icza/dyno v0.0.0-20220812133438-f0b6f8a18845 // indirect github.com/improbable-eng/grpc-web v0.15.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/ipfs/go-cid v0.4.1 // indirect github.com/jackpal/go-nat-pmp v1.0.2 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect - github.com/jmhodges/levigo v1.0.0 // indirect github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect - github.com/klauspost/compress v1.17.7 // indirect - github.com/klauspost/cpuid/v2 v2.2.4 // indirect + github.com/klauspost/compress v1.17.9 // indirect + github.com/klauspost/cpuid/v2 v2.2.5 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect - github.com/lib/pq v1.10.7 // indirect + github.com/lib/pq v1.10.9 // indirect github.com/libp2p/go-buffer-pool v0.1.0 // indirect - github.com/libp2p/go-libp2p v0.27.8 // indirect - github.com/linxGnu/grocksdb v1.8.13 // indirect + github.com/libp2p/go-libp2p v0.31.0 // indirect + github.com/linxGnu/grocksdb v1.9.3 // indirect github.com/magiconair/properties v1.8.7 // indirect github.com/manifoldco/promptui v0.9.0 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect - github.com/mattn/go-runewidth v0.0.14 // indirect - github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect + github.com/mattn/go-runewidth v0.0.15 // indirect github.com/mimoo/StrobeGo v0.0.0-20220103164710-9a04d6ca976b // indirect - github.com/minio/highwayhash v1.0.2 // indirect - github.com/minio/sha256-simd v1.0.0 // indirect - github.com/misko9/go-substrate-rpc-client/v4 v4.0.0 // indirect + github.com/minio/highwayhash v1.0.3 // indirect + github.com/minio/sha256-simd v1.0.1 // indirect + github.com/misko9/go-substrate-rpc-client/v4 v4.0.0-20230913220906-b988ea7da0c2 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/mitchellh/go-testing-interface v1.14.1 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect @@ -178,44 +186,46 @@ require ( github.com/mtibben/percent v0.2.1 // indirect github.com/multiformats/go-base32 v0.1.0 // indirect github.com/multiformats/go-base36 v0.2.0 // indirect - github.com/multiformats/go-multiaddr v0.9.0 // indirect + github.com/multiformats/go-multiaddr v0.11.0 // indirect github.com/multiformats/go-multibase v0.2.0 // indirect - github.com/multiformats/go-multicodec v0.8.1 // indirect - github.com/multiformats/go-multihash v0.2.1 // indirect + github.com/multiformats/go-multicodec v0.9.0 // indirect + github.com/multiformats/go-multihash v0.2.3 // indirect github.com/multiformats/go-varint v0.0.7 // indirect + github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect + github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a // indirect + github.com/oklog/run v1.1.0 // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect github.com/opencontainers/image-spec v1.1.0-rc2 // indirect github.com/pelletier/go-toml v1.9.5 // indirect - github.com/pelletier/go-toml/v2 v2.1.0 // indirect - github.com/petermattis/goid v0.0.0-20231207134359-e60b3f734c67 // indirect + github.com/pelletier/go-toml/v2 v2.2.3 // indirect + github.com/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7 // indirect github.com/pierrec/xxHash v0.1.5 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.17.0 // indirect + github.com/prometheus/client_golang v1.20.4 // indirect github.com/prometheus/client_model v0.6.1 // indirect - github.com/prometheus/common v0.44.0 // indirect - github.com/prometheus/procfs v0.13.0 // indirect + github.com/prometheus/common v0.60.0 // indirect + github.com/prometheus/procfs v0.15.1 // indirect github.com/prometheus/tsdb v0.7.1 // indirect - github.com/rakyll/statik v0.1.7 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect github.com/rivo/uniseg v0.4.3 // indirect github.com/rjeczalik/notify v0.9.1 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect - github.com/rs/cors v1.8.3 // indirect - github.com/rs/zerolog v1.32.0 // indirect + github.com/rs/cors v1.11.1 // indirect + github.com/rs/zerolog v1.33.0 // indirect github.com/sagikazarmark/locafero v0.4.0 // indirect github.com/sagikazarmark/slog-shim v0.1.0 // indirect - github.com/sasha-s/go-deadlock v0.3.1 // indirect + github.com/sasha-s/go-deadlock v0.3.5 // indirect github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect github.com/sourcegraph/conc v0.3.0 // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect github.com/spf13/afero v1.11.0 // indirect - github.com/spf13/cast v1.6.0 // indirect - github.com/spf13/cobra v1.8.0 // indirect + github.com/spf13/cast v1.7.0 // indirect + github.com/spf13/cobra v1.8.1 // indirect github.com/spf13/pflag v1.0.5 // indirect - github.com/spf13/viper v1.18.2 // indirect + github.com/spf13/viper v1.19.0 // indirect github.com/status-im/keycard-go v0.2.0 // indirect github.com/subosito/gotenv v1.6.0 // indirect github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect @@ -225,73 +235,87 @@ require ( github.com/tklauser/numcpus v0.6.1 // indirect github.com/tyler-smith/go-bip32 v1.0.0 // indirect github.com/tyler-smith/go-bip39 v1.1.0 // indirect - github.com/ulikunitz/xz v0.5.11 // indirect - github.com/vedhavyas/go-subkey/v2 v2.0.0 // indirect + github.com/ulikunitz/xz v0.5.12 // indirect github.com/zondax/hid v0.9.2 // indirect github.com/zondax/ledger-go v0.14.3 // indirect - go.etcd.io/bbolt v1.3.8 // indirect go.opencensus.io v0.24.0 // indirect - go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.47.0 // indirect - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0 // indirect - go.opentelemetry.io/otel v1.22.0 // indirect - go.opentelemetry.io/otel/metric v1.22.0 // indirect - go.opentelemetry.io/otel/trace v1.22.0 // indirect + go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0 // indirect + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 // indirect + go.opentelemetry.io/otel v1.28.0 // indirect + go.opentelemetry.io/otel/metric v1.28.0 // indirect + go.opentelemetry.io/otel/trace v1.28.0 // indirect go.uber.org/multierr v1.11.0 // indirect - golang.org/x/crypto v0.22.0 // indirect - golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa // indirect - golang.org/x/mod v0.17.0 // indirect - golang.org/x/net v0.24.0 // indirect - golang.org/x/oauth2 v0.17.0 // indirect - golang.org/x/sync v0.7.0 // indirect - golang.org/x/sys v0.19.0 // indirect - golang.org/x/term v0.19.0 // indirect - golang.org/x/text v0.14.0 // indirect - golang.org/x/time v0.5.0 // indirect - golang.org/x/tools v0.20.0 // indirect - google.golang.org/api v0.162.0 // indirect - google.golang.org/appengine v1.6.8 // indirect - google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240401170217-c3f982113cda // indirect - google.golang.org/grpc v1.63.2 // indirect - google.golang.org/protobuf v1.33.0 // indirect + golang.org/x/crypto v0.28.0 // indirect + golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 // indirect + golang.org/x/mod v0.18.0 // indirect + golang.org/x/net v0.29.0 // indirect + golang.org/x/oauth2 v0.23.0 // indirect + golang.org/x/sync v0.8.0 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/term v0.25.0 // indirect + golang.org/x/text v0.19.0 // indirect + golang.org/x/time v0.6.0 // indirect + golang.org/x/tools v0.22.0 // indirect + google.golang.org/api v0.192.0 // indirect + google.golang.org/genproto v0.0.0-20240814211410-ddb44dafa142 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f // indirect + google.golang.org/grpc v1.67.1 // indirect + google.golang.org/protobuf v1.35.1 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect - gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - lukechampine.com/blake3 v1.1.7 // indirect + gotest.tools/v3 v3.5.1 // indirect + lukechampine.com/blake3 v1.2.1 // indirect lukechampine.com/uint128 v1.2.0 // indirect modernc.org/cc/v3 v3.40.0 // indirect modernc.org/ccgo/v3 v3.16.13 // indirect - modernc.org/libc v1.24.1 // indirect - modernc.org/mathutil v1.5.0 // indirect - modernc.org/memory v1.6.0 // indirect + modernc.org/libc v1.29.0 // indirect + modernc.org/mathutil v1.6.0 // indirect + modernc.org/memory v1.7.2 // indirect modernc.org/opt v0.1.3 // indirect - modernc.org/sqlite v1.25.0 // indirect + modernc.org/sqlite v1.28.0 // indirect modernc.org/strutil v1.1.3 // indirect modernc.org/token v1.0.1 // indirect - nhooyr.io/websocket v1.8.7 // indirect + nhooyr.io/websocket v1.8.10 // indirect pgregory.net/rapid v1.1.0 // indirect sigs.k8s.io/yaml v1.4.0 // indirect ) replace ( + cosmossdk.io/core => cosmossdk.io/core v0.11.0 // use cosmos fork of keyring github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0 + github.com/ChainSafe/go-schnorrkel => github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d + github.com/ChainSafe/go-schnorrkel/1 => github.com/ChainSafe/go-schnorrkel v1.0.0 // Use cometbft fork of tendermint - github.com/cometbft/cometbft => github.com/kava-labs/cometbft v0.37.9-kava.1 - github.com/cometbft/cometbft-db => github.com/kava-labs/cometbft-db v0.9.1-kava.2 + github.com/cometbft/cometbft => github.com/kava-labs/cometbft v0.0.0-20241024200036-527d8df9ff12 + //github.com/cometbft/cometbft-db => github.com/kava-labs/cometbft-db kava-patched-test b2740b2e4bed1112feb4157b154ce969759b52ce + github.com/cometbft/cometbft-db => github.com/kava-labs/cometbft-db v0.0.0-20241007145430-b2740b2e4bed + + //github.com/cosmos/cosmos-sdk => github.com/kava-labs/cosmos-sdk v0.0.0-20241104154228-9f413992bbe2 + github.com/cosmos/cosmos-sdk => github.com/kava-labs/cosmos-sdk v0.0.0-20241108231030-e1beb1437b24 // Use cosmos-sdk fork with backported fix for unsafe-reset-all, staking transfer events, and custom tally handler support - github.com/cosmos/cosmos-sdk => github.com/kava-labs/cosmos-sdk v0.47.10-iavl-v1-kava.1 - github.com/ethereum/go-ethereum => github.com/Kava-Labs/go-ethereum v1.10.27-0.20240308170502-da7973e5eee0 + //github.com/cosmos/cosmos-sdk => github.com/kava-labs/cosmos-sdk v0.47.10-iavl-v1-kava.1 + //github.com/cosmos/cosmos-sdk/store => cosmossdk.io/store v1.1.1 + //github.com/cosmos/cosmos-sdk/x/evidence => cosmossdk.io/x/evidence v0.1.1 + //github.com/cosmos/cosmos-sdk/x/feegrant => cosmossdk.io/x/feegrant v0.1.1 + //github.com/cosmos/cosmos-sdk/x/nft => cosmossdk.io/x/nft v0.1.1 + //github.com/cosmos/cosmos-sdk/x/upgrade => cosmossdk.io/x/upgrade v0.1.4 + github.com/cosmos/cosmos-sdk/x/upgrade => github.com/Kava-Labs/cosmos-sdk/x/upgrade v0.0.0-20241024201445-a8e1a4abf85b + + //github.com/ethereum/go-ethereum => github.com/Kava-Labs/go-ethereum v1.10.27-0.20240308170502-da7973e5eee0 + github.com/ethereum/go-ethereum => github.com/Kava-Labs/go-ethereum v1.10.27-0.20240513233504-6e038346780b // Use ethermint fork that respects min-gas-price with NoBaseFee true and london enabled, and includes eip712 support - github.com/evmos/ethermint => github.com/kava-labs/ethermint v0.21.1-0.20240703152838-badab86e5aba + //github.com/evmos/ethermint => github.com/kava-labs/ethermint v0.21.1-0.20240703152838-badab86e5aba + github.com/evmos/ethermint => github.com/kava-labs/ethermint v0.0.0-20241105193811-2b40405cecd5 github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 // github.com/ComposableFi/go-subkey/v2 => github.com/vedhavyas/go-subkey/v2 v2.0.0 - github.com/misko9/go-substrate-rpc-client/v4 => github.com/faddat/go-substrate-rpc-client/v4 v4.0.1-0.20240402155230-48db8c110afe + //github.com/misko9/go-substrate-rpc-client/v4 => github.com/faddat/go-substrate-rpc-client/v4 v4.0.1-0.20240402155230-48db8c110afe + github.com/misko9/go-substrate-rpc-client/v4 => github.com/misko9/go-substrate-rpc-client/v4 v4.0.0-20230913220906-b988ea7da0c2 + + github.com/strangelove-ventures/interchaintest/v8 => ../../../interchaintest - // stick with compatible version or x/exp in v0.47.x line - golang.org/x/exp => golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb ) replace github.com/kava-labs/kava => ../../ diff --git a/tests/e2e-ibc/go.sum b/tests/e2e-ibc/go.sum index de6ee7957d..ae82e53af7 100644 --- a/tests/e2e-ibc/go.sum +++ b/tests/e2e-ibc/go.sum @@ -30,8 +30,8 @@ cloud.google.com/go v0.100.2/go.mod h1:4Xra9TjzAeYHrl5+oeLlzbM2k3mjVhZh4UqTZ//w9 cloud.google.com/go v0.102.0/go.mod h1:oWcCzKlqJ5zgHQt9YsaeTY9KzIvjyy0ArmiBUgpQ+nc= cloud.google.com/go v0.102.1/go.mod h1:XZ77E9qnTEnrgEOvr4xzfdX5TRo7fB4T2F4O6+34hIU= cloud.google.com/go v0.104.0/go.mod h1:OO6xxXdJyvuJPcEPBLN9BJPD+jep5G1+2U5B5gkRYtA= -cloud.google.com/go v0.112.0 h1:tpFCD7hpHFlQ8yPwT3x+QeXqc2T6+n6T+hmABHfDUSM= -cloud.google.com/go v0.112.0/go.mod h1:3jEEVwZ/MHU4djK5t5RHuKOA/GbLddgTdVubX1qnPD4= +cloud.google.com/go v0.115.1 h1:Jo0SM9cQnSkYfp44+v+NQXHpcHqlnRJk2qxh6yvxxxQ= +cloud.google.com/go v0.115.1/go.mod h1:DuujITeaufu3gL68/lOFIirVNJwQeyf5UXyi+Wbgknc= cloud.google.com/go/aiplatform v1.22.0/go.mod h1:ig5Nct50bZlzV6NvKaTwmplLLddFx0YReh9WfTO5jKw= cloud.google.com/go/aiplatform v1.24.0/go.mod h1:67UUvRBKG6GTayHKV8DBv2RtR1t93YRu5B1P3x99mYY= cloud.google.com/go/analytics v0.11.0/go.mod h1:DjEWCu41bVbYcKyvlws9Er60YE4a//bK6mnhWvQeFNI= @@ -46,6 +46,10 @@ cloud.google.com/go/asset v1.8.0/go.mod h1:mUNGKhiqIdbr8X7KNayoYvyc4HbbFO9URsjby cloud.google.com/go/assuredworkloads v1.5.0/go.mod h1:n8HOZ6pff6re5KYfBXcFvSViQjDwxFkAkmUFffJRbbY= cloud.google.com/go/assuredworkloads v1.6.0/go.mod h1:yo2YOk37Yc89Rsd5QMVECvjaMKymF9OP+QXWlKXUkXw= cloud.google.com/go/assuredworkloads v1.7.0/go.mod h1:z/736/oNmtGAyU47reJgGN+KVoYoxeLBoj4XkKYscNI= +cloud.google.com/go/auth v0.8.1 h1:QZW9FjC5lZzN864p13YxvAtGUlQ+KgRL+8Sg45Z6vxo= +cloud.google.com/go/auth v0.8.1/go.mod h1:qGVp/Y3kDRSDZ5gFD/XPUfYQ9xW1iI7q8RIRoCyBbJc= +cloud.google.com/go/auth/oauth2adapt v0.2.3 h1:MlxF+Pd3OmSudg/b1yZ5lJwoXCEaeedAguodky1PcKI= +cloud.google.com/go/auth/oauth2adapt v0.2.3/go.mod h1:tMQXOfZzFuNuUxOypHlQEXgdfX5cuhwU+ffUuXRJE8I= cloud.google.com/go/automl v1.5.0/go.mod h1:34EjfoFGMZ5sgJ9EoLsRtdPSNZLcfflJR39VbVNS2M0= cloud.google.com/go/automl v1.6.0/go.mod h1:ugf8a6Fx+zP0D59WLhqgTDsQI9w07o64uf/Is3Nh5p8= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= @@ -68,10 +72,8 @@ cloud.google.com/go/compute v1.6.0/go.mod h1:T29tfhtVbq1wvAPo0E3+7vhgmkOYeXjhFvz cloud.google.com/go/compute v1.6.1/go.mod h1:g85FgpzFvNULZ+S8AYq87axRKuf2Kh7deLqV/jJ3thU= cloud.google.com/go/compute v1.7.0/go.mod h1:435lt8av5oL9P3fv1OEzSbSUe+ybHXGMPQHHZWZxy9U= cloud.google.com/go/compute v1.10.0/go.mod h1:ER5CLbMxl90o2jtNbGSbtfOpQKR0t15FOtRsugnLrlU= -cloud.google.com/go/compute v1.24.0 h1:phWcR2eWzRJaL/kOiJwfFsPs4BaKq1j6vnpZrc1YlVg= -cloud.google.com/go/compute v1.24.0/go.mod h1:kw1/T+h/+tK2LJK0wiPPx1intgdAM3j/g3hFDlscY40= -cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY= -cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= +cloud.google.com/go/compute/metadata v0.5.0 h1:Zr0eK8JbFv6+Wi4ilXAR8FJ3wyNdpxHKJNPos6LTZOY= +cloud.google.com/go/compute/metadata v0.5.0/go.mod h1:aHnloV2TPI38yx4s9+wAZhHykWvVCfu7hQbF+9CWoiY= cloud.google.com/go/containeranalysis v0.5.1/go.mod h1:1D92jd8gRR/c0fGMlymRgxWD3Qw9C1ff6/T7mLgVL8I= cloud.google.com/go/containeranalysis v0.6.0/go.mod h1:HEJoiEIu+lEXM+k7+qLCci0h33lX3ZqoYFdmPcoO7s4= cloud.google.com/go/datacatalog v1.3.0/go.mod h1:g9svFY6tuR+j+hrTw3J2dNcmI0dzmSiyOzm8kpLq0a0= @@ -109,12 +111,14 @@ cloud.google.com/go/gkehub v0.10.0/go.mod h1:UIPwxI0DsrpsVoWpLB0stwKCP+WFVG9+y97 cloud.google.com/go/grafeas v0.2.0/go.mod h1:KhxgtF2hb0P191HlY5besjYm6MqTSTj3LSI+M+ByZHc= cloud.google.com/go/iam v0.3.0/go.mod h1:XzJPvDayI+9zsASAFO68Hk07u3z+f+JrT2xXNdp4bnY= cloud.google.com/go/iam v0.5.0/go.mod h1:wPU9Vt0P4UmCux7mqtRu6jcpPAb74cP1fh50J3QpkUc= -cloud.google.com/go/iam v1.1.6 h1:bEa06k05IO4f4uJonbB5iAgKTPpABy1ayxaIZV/GHVc= -cloud.google.com/go/iam v1.1.6/go.mod h1:O0zxdPeGBoFdWW3HWmBxJsk0pfvNM/p/qa82rWOGTwI= +cloud.google.com/go/iam v1.1.13 h1:7zWBXG9ERbMLrzQBRhFliAV+kjcRToDTgQT3CTwYyv4= +cloud.google.com/go/iam v1.1.13/go.mod h1:K8mY0uSXwEXS30KrnVb+j54LB/ntfZu1dr+4zFMNbus= cloud.google.com/go/language v1.4.0/go.mod h1:F9dRpNFQmJbkaop6g0JhSBXCNlO90e1KWx5iDdxbWic= cloud.google.com/go/language v1.6.0/go.mod h1:6dJ8t3B+lUYfStgls25GusK04NLh3eDLQnWM3mdEbhI= cloud.google.com/go/lifesciences v0.5.0/go.mod h1:3oIKy8ycWGPUyZDR/8RNnTOYevhaMLqh5vLUXs9zvT8= cloud.google.com/go/lifesciences v0.6.0/go.mod h1:ddj6tSX/7BOnhxCSd3ZcETvtNr8NZ6t/iPhY2Tyfu08= +cloud.google.com/go/longrunning v0.5.11 h1:Havn1kGjz3whCfoD8dxMLP73Ph5w+ODyZB9RUsDxtGk= +cloud.google.com/go/longrunning v0.5.11/go.mod h1:rDn7//lmlfWV1Dx6IB4RatCPenTwwmqXuiP0/RgoEO4= cloud.google.com/go/mediatranslation v0.5.0/go.mod h1:jGPUhGTybqsPQn91pNXw0xVHfuJ3leR1wj37oU3y1f4= cloud.google.com/go/mediatranslation v0.6.0/go.mod h1:hHdBCTYNigsBxshbznuIMFNe5QXEowAuNmmC7h8pu5w= cloud.google.com/go/memcache v1.4.0/go.mod h1:rTOfiGZtJX1AaFUrOgsMHX5kAzaTQ8azHiuDoTPzNsE= @@ -171,8 +175,8 @@ cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9 cloud.google.com/go/storage v1.22.1/go.mod h1:S8N1cAStu7BOeFfE8KAQzmyyLkK8p/vmRq6kuBTW58Y= cloud.google.com/go/storage v1.23.0/go.mod h1:vOEEDNFnciUMhBeT6hsJIn3ieU5cFRmzeLgDvXzfIXc= cloud.google.com/go/storage v1.27.0/go.mod h1:x9DOL8TK/ygDUMieqwfhdpQryTeEkhGKMi80i/iqR2s= -cloud.google.com/go/storage v1.36.0 h1:P0mOkAcaJxhCTvAkMhxMfrTKiNcub4YmmPBtlhAyTr8= -cloud.google.com/go/storage v1.36.0/go.mod h1:M6M/3V/D3KpzMTJyPOR/HU6n2Si5QdaXYEsng2xgOs8= +cloud.google.com/go/storage v1.43.0 h1:CcxnSohZwizt4LCzQHWvBf1/kvtHUn7gk9QERXPyXFs= +cloud.google.com/go/storage v1.43.0/go.mod h1:ajvxEa7WmZS1PxvKRq4bq0tFT3vMd502JwstCcYv0Q0= cloud.google.com/go/talent v1.1.0/go.mod h1:Vl4pt9jiHKvOgF9KoZo6Kob9oV4lwd/ZD5Cto54zDRw= cloud.google.com/go/talent v1.2.0/go.mod h1:MoNF9bhFQbiJ6eFD3uSsg0uBALw4n4gaCaEjBw9zo8g= cloud.google.com/go/videointelligence v1.6.0/go.mod h1:w0DIDlVRKtwPCn/C4iwZIJdvC69yInhW0cfi+p546uU= @@ -184,33 +188,54 @@ cloud.google.com/go/webrisk v1.4.0/go.mod h1:Hn8X6Zr+ziE2aNd8SliSDWpEnSS1u4R9+xX cloud.google.com/go/webrisk v1.5.0/go.mod h1:iPG6fr52Tv7sGk0H6qUFzmL3HHZev1htXuWDEEsqMTg= cloud.google.com/go/workflows v1.6.0/go.mod h1:6t9F5h/unJz41YqfBmqSASJSXccBLtD1Vwf+KmJENM0= cloud.google.com/go/workflows v1.7.0/go.mod h1:JhSrZuVZWuiDfKEFxU0/F1PQjmpnpcoISEXH2bcHC3M= -cosmossdk.io/api v0.3.1 h1:NNiOclKRR0AOlO4KIqeaG6PS6kswOMhHD0ir0SscNXE= -cosmossdk.io/api v0.3.1/go.mod h1:DfHfMkiNA2Uhy8fj0JJlOCYOBp4eWUUJ1te5zBGNyIw= -cosmossdk.io/core v0.6.1 h1:OBy7TI2W+/gyn2z40vVvruK3di+cAluinA6cybFbE7s= -cosmossdk.io/core v0.6.1/go.mod h1:g3MMBCBXtxbDWBURDVnJE7XML4BG5qENhs0gzkcpuFA= -cosmossdk.io/depinject v1.0.0-alpha.4 h1:PLNp8ZYAMPTUKyG9IK2hsbciDWqna2z1Wsl98okJopc= -cosmossdk.io/depinject v1.0.0-alpha.4/go.mod h1:HeDk7IkR5ckZ3lMGs/o91AVUc7E596vMaOmslGFM3yU= +cosmossdk.io/api v0.7.5 h1:eMPTReoNmGUm8DeiQL9DyM8sYDjEhWzL1+nLbI9DqtQ= +cosmossdk.io/api v0.7.5/go.mod h1:IcxpYS5fMemZGqyYtErK7OqvdM0C8kdW3dq8Q/XIG38= +cosmossdk.io/client/v2 v2.0.0-beta.3 h1:+TTuH0DwQYsUq2JFAl3fDZzKq5gQG7nt3dAattkjFDU= +cosmossdk.io/client/v2 v2.0.0-beta.3/go.mod h1:CZcL41HpJPOOayTCO28j8weNBQprG+SRiKX39votypo= +cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= +cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= +cosmossdk.io/core v0.11.0 h1:vtIafqUi+1ZNAE/oxLOQQ7Oek2n4S48SWLG8h/+wdbo= +cosmossdk.io/core v0.11.0/go.mod h1:LaTtayWBSoacF5xNzoF8tmLhehqlA9z1SWiPuNC6X1w= +cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= +cosmossdk.io/depinject v1.0.0/go.mod h1:zxK/h3HgHoA/eJVtiSsoaRaRA2D5U4cJ5thIG4ssbB8= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= -cosmossdk.io/log v1.3.1 h1:UZx8nWIkfbbNEWusZqzAx3ZGvu54TZacWib3EzUYmGI= -cosmossdk.io/log v1.3.1/go.mod h1:2/dIomt8mKdk6vl3OWJcPk2be3pGOS8OQaLUM/3/tCM= +cosmossdk.io/log v1.4.1 h1:wKdjfDRbDyZRuWa8M+9nuvpVYxrEOwbD/CA8hvhU8QM= +cosmossdk.io/log v1.4.1/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= cosmossdk.io/simapp v0.0.0-20231127212628-044ff4d8c015 h1:ARUqouMWNreV8e5wxPberry+tm+Uk+1eeJDt3KXQEn0= cosmossdk.io/simapp v0.0.0-20231127212628-044ff4d8c015/go.mod h1:VNknW36ZIgwkjKtb6eyA4RZ7x9+ZpKMVCsAUA6bFWnk= -cosmossdk.io/tools/rosetta v0.2.1 h1:ddOMatOH+pbxWbrGJKRAawdBkPYLfKXutK9IETnjYxw= -cosmossdk.io/tools/rosetta v0.2.1/go.mod h1:Pqdc1FdvkNV3LcNIkYWt2RQY6IP1ge6YWZk8MhhO9Hw= -filippo.io/edwards25519 v1.0.0 h1:0wAIcmJUqRdI8IJ/3eGi5/HwXZWPujYXXlkrQogz0Ek= -filippo.io/edwards25519 v1.0.0/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns= +cosmossdk.io/store v1.1.1 h1:NA3PioJtWDVU7cHHeyvdva5J/ggyLDkyH0hGHl2804Y= +cosmossdk.io/store v1.1.1/go.mod h1:8DwVTz83/2PSI366FERGbWSH7hL6sB7HbYp8bqksNwM= +cosmossdk.io/x/circuit v0.1.1 h1:KPJCnLChWrxD4jLwUiuQaf5mFD/1m7Omyo7oooefBVQ= +cosmossdk.io/x/circuit v0.1.1/go.mod h1:B6f/urRuQH8gjt4eLIXfZJucrbreuYrKh5CSjaOxr+Q= +cosmossdk.io/x/evidence v0.1.1 h1:Ks+BLTa3uftFpElLTDp9L76t2b58htjVbSZ86aoK/E4= +cosmossdk.io/x/evidence v0.1.1/go.mod h1:OoDsWlbtuyqS70LY51aX8FBTvguQqvFrt78qL7UzeNc= +cosmossdk.io/x/feegrant v0.1.1 h1:EKFWOeo/pup0yF0svDisWWKAA9Zags6Zd0P3nRvVvw8= +cosmossdk.io/x/feegrant v0.1.1/go.mod h1:2GjVVxX6G2fta8LWj7pC/ytHjryA6MHAJroBWHFNiEQ= +cosmossdk.io/x/tx v0.13.5 h1:FdnU+MdmFWn1pTsbfU0OCf2u6mJ8cqc1H4OMG418MLw= +cosmossdk.io/x/tx v0.13.5/go.mod h1:V6DImnwJMTq5qFjeGWpXNiT/fjgE4HtmclRmTqRVM3w= +cosmossdk.io/x/upgrade v0.1.4 h1:/BWJim24QHoXde8Bc64/2BSEB6W4eTydq0X/2f8+g38= +cosmossdk.io/x/upgrade v0.1.4/go.mod h1:9v0Aj+fs97O+Ztw+tG3/tp5JSlrmT7IcFhAebQHmOPo= +dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= +filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= +filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 h1:/vQbFIOMbk2FiG/kXiLl8BRyzTWDw7gX/Hz7Dd5eDMs= github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4/go.mod h1:hN7oaIRCjzsZ2dE+yG5k+rsdt3qcwykqK6HVGcKwsw4= -github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 h1:UQHMgLO+TxOElx5B5HZ4hJQsoJ/PvUvKRhJHDQXO8P8= -github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= +github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0= +github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/toml v1.3.2 h1:o7IhLm0Msx3BaB+n3Ag7L8EVlByGnpq14C4YWiu/gL8= -github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= +github.com/BurntSushi/toml v1.4.0 h1:kuoIxZQy2WRRk1pttg9asf+WVv6tWQuBNVmK8+nqPr0= +github.com/BurntSushi/toml v1.4.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d h1:nalkkPQcITbvhmL4+C4cKA87NW0tfm3Kl9VXRoPywFg= +github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d/go.mod h1:URdX5+vg25ts3aCh8H5IFZybJYKWhJHYMTnf+ULtoC4= github.com/ChainSafe/go-schnorrkel v1.0.0 h1:3aDA67lAykLaG1y3AOjs88dMxC88PgUuHRrLeDnvGIM= github.com/ChainSafe/go-schnorrkel v1.0.0/go.mod h1:dpzHYVxLZcp8pjlV+O+UR8K0Hp/z7vcchBSbMBEhCw4= +github.com/ComposableFi/go-subkey/v2 v2.0.0-tm03420 h1:oknQF/iIhf5lVjbwjsVDzDByupRhga8nhA3NAmwyHDA= +github.com/ComposableFi/go-subkey/v2 v2.0.0-tm03420/go.mod h1:KYkiMX5AbOlXXYfxkrYPrRPV6EbVUALTQh5ptUOJzu8= +github.com/DataDog/datadog-go v3.2.0+incompatible h1:qSG2N4FghB1He/r2mFrWKCaL7dXCilEuNEeAn20fdD4= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/zstd v1.5.5 h1:oWf5W7GtOLgp6bciQYDmhHHjdhYkALu6S/5Ni9ZgSvQ= github.com/DataDog/zstd v1.5.5/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= @@ -218,15 +243,20 @@ github.com/FactomProject/basen v0.0.0-20150613233007-fe3947df716e h1:ahyvB3q25Yn github.com/FactomProject/basen v0.0.0-20150613233007-fe3947df716e/go.mod h1:kGUqhHd//musdITWjFvNTHn90WG9bMLBEPQZ17Cmlpw= github.com/FactomProject/btcutilecc v0.0.0-20130527213604-d3a63a5752ec h1:1Qb69mGp/UtRPn422BH4/Y4Q3SLUrD9KHuDkm8iodFc= github.com/FactomProject/btcutilecc v0.0.0-20130527213604-d3a63a5752ec/go.mod h1:CD8UlnlLDiqb36L110uqiP2iSflVjx9g/3U9hCI4q2U= -github.com/Kava-Labs/go-ethereum v1.10.27-0.20240308170502-da7973e5eee0 h1:pPFzOjEZmihLk70TQRPUCWs8uar6nfh4vZ/I1r0zeso= -github.com/Kava-Labs/go-ethereum v1.10.27-0.20240308170502-da7973e5eee0/go.mod h1:/6CsT5Ceen2WPLI/oCA3xMcZ5sWMF/D46SjM/ayY0Oo= +github.com/Kava-Labs/cosmos-sdk/x/upgrade v0.0.0-20241024201445-a8e1a4abf85b h1:mjvc8bdDGZRZdlYsMZzl2kNEBmD3fjjwAqIFqBbKf/Y= +github.com/Kava-Labs/cosmos-sdk/x/upgrade v0.0.0-20241024201445-a8e1a4abf85b/go.mod h1:b130aNxXOgphdgbAjilHQIPqGmYM912mTKs2Qzh2hkY= +github.com/Kava-Labs/go-ethereum v1.10.27-0.20240513233504-6e038346780b h1:gTLS1VJL+6TEcttEmQ9rAmm/UZZw23WlQf6n8R/Xjx0= +github.com/Kava-Labs/go-ethereum v1.10.27-0.20240513233504-6e038346780b/go.mod h1:tvRm5KYJQ6LT+uss34spIP1oi6JgCfsFYiMKwJLZr6M= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 h1:TngWCqHvy9oXAN6lEVMRuU21PR1EtLVZJmdB18Gu3Rw= github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5/go.mod h1:lmUJ/7eu/Q8D7ML55dXQrVaamCz2vxCfdQBasLZfHKk= -github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= +github.com/PuerkitoBio/purell v1.1.1 h1:WEQqlqaGbrPkxLJWfBwQmfEAE1Z7ONdDLqrN38tNFfI= +github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= +github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M= +github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= github.com/StackExchange/wmi v1.2.1 h1:VIkavFPXSjcnS+O8yTq7NI32k0R5Aj+v39y29VYDOSA= @@ -253,19 +283,16 @@ github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kd github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= -github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= -github.com/armon/go-metrics v0.4.1 h1:hR91U9KYmb6bLBYLQjyM+3j+rcd/UhE+G78SFnF8gJA= -github.com/armon/go-metrics v0.4.1/go.mod h1:E6amYzXo6aW1tqzoZGT755KkbgrJsSdpwZ+3JqfkOG4= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6lCRdSC2Tm3DSWRPvIPr6xNKyeHdqDQSQT+A= -github.com/avast/retry-go/v4 v4.5.0 h1:QoRAZZ90cj5oni2Lsgl2GW8mNTnUCnmpx/iKpwVisHg= -github.com/avast/retry-go/v4 v4.5.0/go.mod h1:7hLEXp0oku2Nir2xBAsg0PTphp9z71bN5Aq1fboC3+I= +github.com/avast/retry-go/v4 v4.5.1 h1:AxIx0HGi4VZ3I02jr78j5lZ3M6x1E0Ivxa6b0pUUh7o= +github.com/avast/retry-go/v4 v4.5.1/go.mod h1:/sipNsvNB3RRuT5iNcb6h73nw3IBmXJ/H3XrCQYSOpc= github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU= github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go v1.44.122/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX4oIKwKHZo= -github.com/aws/aws-sdk-go v1.44.203 h1:pcsP805b9acL3wUqa4JR2vg1k2wnItkDYNvfmcy6F+U= -github.com/aws/aws-sdk-go v1.44.203/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= +github.com/aws/aws-sdk-go v1.55.5 h1:KKUZBfBoyqy5d3swXyiC7Q76ic40rYcbqH7qjh59kzU= +github.com/aws/aws-sdk-go v1.55.5/go.mod h1:eRwEWoyTWFMVYVQzKMNHWP5/RV4xIUGMQfXQHfHkpNU= github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= @@ -275,21 +302,24 @@ github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6r github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d h1:xDfNPAt8lFiC1UJrqV3uuy861HCTo708pDMbjHHdCas= github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d/go.mod h1:6QX/PXZ00z/TKoufEY6K/a0k6AhaJrQKdFe6OfVXsa4= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= -github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 h1:41iFGWnSlI2gVpmOtVTJZNodLdLQLn/KsJqFvXwnd/s= -github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/bgentry/speakeasy v0.2.0 h1:tgObeVOf8WAvtuAX6DhJ4xks4CFNwPDZiqzGqIHE51E= +github.com/bgentry/speakeasy v0.2.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/bits-and-blooms/bitset v1.10.0 h1:ePXTeiPEazB5+opbv5fr8umg2R/1NlzgDsyepwsSr88= +github.com/bits-and-blooms/bitset v1.10.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= github.com/btcsuite/btcd v0.22.0-beta.0.20220111032746-97732e52810c/go.mod h1:tjmYdS6MLJ5/s0Fj4DbLgSbDHbEqLJrtnHecBFkdz5M= github.com/btcsuite/btcd v0.23.5-0.20231215221805-96c9fd8078fd/go.mod h1:nm3Bko6zh6bWP60UxwoT5LzdGJsQJaPo6HjduXq9p6A= -github.com/btcsuite/btcd v0.24.0 h1:gL3uHE/IaFj6fcZSu03SvqPMSx7s/dPzfpG/atRwWdo= -github.com/btcsuite/btcd v0.24.0/go.mod h1:K4IDc1593s8jKXIF7yS7yCTSxrknB9z0STzc2j6XgE4= +github.com/btcsuite/btcd v0.24.2 h1:aLmxPguqxza+4ag8R1I2nnJjSu2iFn/kqtHTIImswcY= +github.com/btcsuite/btcd v0.24.2/go.mod h1:5C8ChTkl5ejr3WHj8tkQSCmydiMEPB0ZhQhehpq7Dgg= github.com/btcsuite/btcd/btcec/v2 v2.1.0/go.mod h1:2VzYrv4Gm4apmbVVsSq5bqf1Ec8v56E48Vt0Y/umPgA= github.com/btcsuite/btcd/btcec/v2 v2.1.3/go.mod h1:ctjw4H1kknNJmRN4iP1R7bTQ+v3GJkZBd6mui8ZsAZE= -github.com/btcsuite/btcd/btcec/v2 v2.3.2 h1:5n0X6hX0Zk+6omWcihdYvdAlGf2DfasC0GMf7DClJ3U= -github.com/btcsuite/btcd/btcec/v2 v2.3.2/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= +github.com/btcsuite/btcd/btcec/v2 v2.3.4 h1:3EJjcN70HCu/mwqlUsGK8GcNVyLVxFDlWurTXGPFfiQ= +github.com/btcsuite/btcd/btcec/v2 v2.3.4/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= github.com/btcsuite/btcd/btcutil v1.0.0/go.mod h1:Uoxwv0pqYWhD//tfTiipkxNfdhG9UrLwaeswfjfdF0A= github.com/btcsuite/btcd/btcutil v1.1.0/go.mod h1:5OapHB7A2hBBWLm48mmw4MOHNJCcUBTwmWH/0Jn8VHE= -github.com/btcsuite/btcd/btcutil v1.1.5 h1:+wER79R5670vs/ZusMTF1yTcRYE5GUsFbdjdisflzM8= github.com/btcsuite/btcd/btcutil v1.1.5/go.mod h1:PSZZ4UitpLBWzxGd5VGOrLnmOjtPP/a6HaFo12zMs00= +github.com/btcsuite/btcd/btcutil v1.1.6 h1:zFL2+c3Lb9gEgqKNzowKUPQNb8jV7v5Oaodi/AYFd6c= +github.com/btcsuite/btcd/btcutil v1.1.6/go.mod h1:9dFymx8HpuLqBnsPELrImQeTQfKBQqzqGbbV3jK55aE= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.0/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 h1:59Kx4K6lzOW5w6nFlA0v5+lk/6sjybR934QNHSJZPTQ= @@ -305,18 +335,17 @@ github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku github.com/btcsuite/snappy-go v1.0.0/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= -github.com/bufbuild/protocompile v0.4.0 h1:LbFKd2XowZvQ/kajzguUp2DC9UEIQhIq77fZZlaQsNA= -github.com/bufbuild/protocompile v0.4.0/go.mod h1:3v93+mbWn/v3xzN+31nwkJfrEpAUwp+BagBSZWx+TP8= +github.com/bufbuild/protocompile v0.6.0 h1:Uu7WiSQ6Yj9DbkdnOe7U4mNKp58y9WDMKDn28/ZlunY= +github.com/bufbuild/protocompile v0.6.0/go.mod h1:YNP35qEYoYGme7QMtz5SBCoN4kL4g12jTtjuzRNdjpE= github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4= github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= github.com/cenkalti/backoff/v4 v4.1.1/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= -github.com/cenkalti/backoff/v4 v4.1.3 h1:cFAlzYUlVYDysBEH2T5hyJZMh3+5+WCBvSnK6Q8UtC4= -github.com/cenkalti/backoff/v4 v4.1.3/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= +github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8= +github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/cp v0.1.0 h1:SE+dxFebS7Iik5LK0tsi1k9ZCxEaFX4AjQmoyA+1dJk= github.com/cespare/cp v0.1.0/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s= -github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= @@ -347,19 +376,19 @@ github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWH github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20231128003011-0fa0005c9caa h1:jQCWAUqqlij9Pgj2i/PB79y4KOPYVyFYdROxgaCwdTQ= -github.com/cncf/xds/go v0.0.0-20231128003011-0fa0005c9caa/go.mod h1:x/1Gn8zydmfq8dk6e9PdstVsDgu9RuyIIJqAaF//0IM= github.com/cockroachdb/apd/v2 v2.0.2 h1:weh8u7Cneje73dDh+2tEVLUvyBc89iwepWCD8b8034E= github.com/cockroachdb/apd/v2 v2.0.2/go.mod h1:DDxRlzC2lo3/vSlmSoS7JkqbbrARPuFOGr0B9pvN3Gw= github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f h1:otljaYPt5hWxV3MUfO5dFPFiOXg9CyG5/kCfayTqsJ4= github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f/go.mod h1:a9RdTaap04u637JoCzcUoIcDmvwSUtcUFtT/C3kJlTU= -github.com/cockroachdb/errors v1.11.1 h1:xSEW75zKaKCWzR3OfxXUxgrk/NtT4G1MiOv5lWZazG8= -github.com/cockroachdb/errors v1.11.1/go.mod h1:8MUxA3Gi6b25tYlFEBGLf+D8aISL+M4MIpiWMSNRfxw= +github.com/cockroachdb/errors v1.11.3 h1:5bA+k2Y6r+oz/6Z/RFlNeVCesGARKuC6YymtcDrbC/I= +github.com/cockroachdb/errors v1.11.3/go.mod h1:m4UIW4CDjx+R5cybPsNrRbreomiFqt8o1h1wUVazSd8= +github.com/cockroachdb/fifo v0.0.0-20240606204812-0bbfbd93a7ce h1:giXvy4KSc/6g/esnpM7Geqxka4WSqI1SZc7sMJFd3y4= +github.com/cockroachdb/fifo v0.0.0-20240606204812-0bbfbd93a7ce/go.mod h1:9/y3cnZ5GKakj/H4y9r9GTjCvAFta7KLgSHPJJYc52M= github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b h1:r6VH0faHjZeQy818SGhaone5OnYfxFR/+AzdY3sf5aE= github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b/go.mod h1:Vz9DsVWQQhf3vs21MhPMZpMGSht7O/2vFW2xusFUVOs= -github.com/cockroachdb/pebble v1.1.0 h1:pcFh8CdCIt2kmEpK0OIatq67Ln9uGDYY3d5XnE0LJG4= -github.com/cockroachdb/pebble v1.1.0/go.mod h1:sEHm5NOXxyiAoKWhoFxT8xMgd/f3RA6qUqQ1BXKrh2E= +github.com/cockroachdb/pebble v1.1.1 h1:XnKU22oiCLy2Xn8vp1re67cXg4SAasg/WDt1NtcRFaw= +github.com/cockroachdb/pebble v1.1.1/go.mod h1:4exszw1r40423ZsmkG/09AFEG83I0uDgfujJdbL6kYU= github.com/cockroachdb/redact v1.1.5 h1:u1PMllDkdFfPWaNGMyLD1+so+aq3uUItthCFqzwPJ30= github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 h1:zuQyyAKVxetITBuuhv3BI9cMrmStnpT18zmgmTxunpo= @@ -367,12 +396,8 @@ github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06/go.mod h1: github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= github.com/coinbase/rosetta-sdk-go/types v1.0.0 h1:jpVIwLcPoOeCR6o1tU+Xv7r5bMONNbHU7MuEHboiFuA= github.com/coinbase/rosetta-sdk-go/types v1.0.0/go.mod h1:eq7W2TMRH22GTW0N0beDnN931DW0/WOI1R2sdHNHG4c= -github.com/confio/ics23/go v0.9.0 h1:cWs+wdbS2KRPZezoaaj+qBleXgUk5WOQFMP3CQFGTr4= -github.com/confio/ics23/go v0.9.0/go.mod h1:4LPZ2NYqnYIVRklaozjNR1FScgDJ2s5Xrp+e/mYVRak= github.com/containerd/continuity v0.3.0 h1:nisirsYROK15TAMVukJOUyGJjz4BNQJBVsNvAXZJ/eg= github.com/containerd/continuity v0.3.0/go.mod h1:wJEAIwKOm/pBZuBd0JmeTvnLquTB1Ag8espWhkykbPM= -github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= -github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= @@ -389,37 +414,33 @@ github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4x github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiKxTE= github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ4GUkT+tbFI= github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= -github.com/cosmos/gogoproto v1.4.10 h1:QH/yT8X+c0F4ZDacDv3z+xE3WU1P1Z3wQoLMBRJoKuI= -github.com/cosmos/gogoproto v1.4.10/go.mod h1:3aAZzeRWpAwr+SS/LLkICX2/kDFyaYVzckBDzygIxek= +github.com/cosmos/gogoproto v1.7.0 h1:79USr0oyXAbxg3rspGh/m4SWNyoz/GLaAh0QlCe2fro= +github.com/cosmos/gogoproto v1.7.0/go.mod h1:yWChEv5IUEYURQasfyBW5ffkMHR/90hiHgbNgrtp4j0= github.com/cosmos/iavl v1.2.0 h1:kVxTmjTh4k0Dh1VNL046v6BXqKziqMDzxo93oh3kOfM= github.com/cosmos/iavl v1.2.0/go.mod h1:HidWWLVAtODJqFD6Hbne2Y0q3SdxByJepHUOeoH4LiI= -github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7 v7.1.3 h1:MZGDMETv72suFpTAD6VPGqSIm1FJcChtk2HmVh9D+Bo= -github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7 v7.1.3/go.mod h1:UvDmcGIWJPIytq+Q78/ff5NTOsuX/7IrNgEugTW5i0s= -github.com/cosmos/ibc-go/modules/capability v1.0.0-rc1 h1:BvSKnPFKxL+TTSLxGKwJN4x0ndCZj0yfXhSvmsQztSA= -github.com/cosmos/ibc-go/modules/capability v1.0.0-rc1/go.mod h1:A+CxAQdn2j6ihDTbClpEEBdHthWgAUAcHbRAQPY8sl4= -github.com/cosmos/ibc-go/v7 v7.4.0 h1:8FqYMptvksgMvlbN4UW9jFxTXzsPyfAzEZurujXac8M= -github.com/cosmos/ibc-go/v7 v7.4.0/go.mod h1:L/KaEhzV5TGUCTfGysVgMBQtl5Dm7hHitfpk+GIeoAo= -github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= -github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= -github.com/cosmos/interchain-security/v3 v3.1.1-0.20231102122221-81650a84f989 h1:Yk/2X33hHuS0mqjr4rE0ShiwPE/YflXgdyXPIYdwl+Q= -github.com/cosmos/interchain-security/v3 v3.1.1-0.20231102122221-81650a84f989/go.mod h1:5B29fgUbUDTpBTqCnEzA2g3gI5rQG0YE/ir4isb2MEw= +github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8 v8.0.2 h1:dyLNlDElY6+5zW/BT/dO/3Ad9FpQblfh+9dQpYQodbA= +github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8 v8.0.2/go.mod h1:82hPO/tRawbuFad2gPwChvpZ0JEIoNi91LwVneAYCeM= +github.com/cosmos/ibc-go/modules/capability v1.0.1 h1:ibwhrpJ3SftEEZRxCRkH0fQZ9svjthrX2+oXdZvzgGI= +github.com/cosmos/ibc-go/modules/capability v1.0.1/go.mod h1:rquyOV262nGJplkumH+/LeYs04P3eV8oB7ZM4Ygqk4E= +github.com/cosmos/ibc-go/v8 v8.5.1 h1:3JleEMKBjRKa3FeTKt4fjg22za/qygLBo7mDkoYTNBs= +github.com/cosmos/ibc-go/v8 v8.5.1/go.mod h1:P5hkAvq0Qbg0h18uLxDVA9q1kOJ0l36htMsskiNwXbo= +github.com/cosmos/ics23/go v0.11.0 h1:jk5skjT0TqX5e5QJbEnwXIS2yI2vnmLOgpQPeM5RtnU= +github.com/cosmos/ics23/go v0.11.0/go.mod h1:A8OjxPE67hHST4Icw94hOxxFEJMBG031xIGF/JHNIY0= github.com/cosmos/keyring v1.2.0 h1:8C1lBP9xhImmIabyXW4c3vFjjLiBdGCmfLUfeZlV1Yo= github.com/cosmos/keyring v1.2.0/go.mod h1:fc+wB5KTk9wQ9sDx0kFXB3A0MaeGHM9AwRStKOQ5vOA= github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= github.com/cosmos/ledger-cosmos-go v0.13.3/go.mod h1:HENcEP+VtahZFw38HZ3+LS3Iv5XV6svsnkk9vdJtLr8= +github.com/cosmos/rosetta v0.50.6 h1:+Hgog7CUHevZuPxZaoqR8klTs1G3ukAcoVTIMporBmw= +github.com/cosmos/rosetta v0.50.6/go.mod h1:KUnwp2i9W0766Dv78HYNV5YKym+imaKmDvXc2W0Y1wA= github.com/cosmos/rosetta-sdk-go v0.10.0 h1:E5RhTruuoA7KTIXUcMicL76cffyeoyvNybzUGSKFTcM= github.com/cosmos/rosetta-sdk-go v0.10.0/go.mod h1:SImAZkb96YbwvoRkzSMQB6noNJXFgWl/ENIznEoYQI4= -github.com/cpuguy83/go-md2man v1.0.10 h1:BSKMNlYxDvnunlTymqtgONjNnaRV1sTpcovwwjF22jk= -github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= -github.com/cpuguy83/go-md2man/v2 v2.0.3 h1:qMCsGGgs+MAzDFyp9LpAe1Lqy/fY/qCovCm0qnXZOBM= -github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= -github.com/creachadair/taskgroup v0.4.2 h1:jsBLdAJE42asreGss2xZGZ8fJra7WtwnHWeJFxv2Li8= -github.com/creachadair/taskgroup v0.4.2/go.mod h1:qiXUOSrbwAY3u0JPGTzObbE3yf9hcXHDKBZ2ZjpCbgM= +github.com/cpuguy83/go-md2man/v2 v2.0.4 h1:wfIWP927BUkWJb2NmU/kNDYIBTh/ziUX91+lVfRxZq4= +github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/danieljoos/wincred v1.1.2 h1:QLdCxFs1/Yl4zduvBdcHB8goaYk9RARS2SgLLRuAyr0= -github.com/danieljoos/wincred v1.1.2/go.mod h1:GijpziifJoIBfYh+S7BbkdUTU4LfM+QnGqR5Vl2tAx0= +github.com/danieljoos/wincred v1.2.1 h1:dl9cBrupW8+r5250DYkYxocLeZ1Y4vB1kxgtjxw8GQs= +github.com/danieljoos/wincred v1.2.1/go.mod h1:uGaFL9fDn3OLTvzCGulzE+SzjEe5NGlh5FdCcyfPwps= github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -437,35 +458,26 @@ github.com/decred/dcrd/crypto/blake256 v1.0.1/go.mod h1:2OfgNZ5wDpcsFmHmCK5gZTPc github.com/decred/dcrd/dcrec/secp256k1/v2 v2.0.1 h1:18HurQ6DfHeNvwIjvOmrgr44bPdtVaQAe/WWwHg9goM= github.com/decred/dcrd/dcrec/secp256k1/v2 v2.0.1/go.mod h1:XmyzkaXBy7ZvHdrTAlXAjpog8qKSAWa3ze7yqzWmgmc= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs= -github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 h1:8UrgZ3GkP4i/CLijOJx79Yu+etlyjdBU4sfcs2WYQMs= -github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 h1:rpfIENRNNilwHwZeG5+P150SMrnNEcHYvcCuK6dPZSg= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f h1:U5y3Y5UE0w7amNe7Z5G/twsBW0KEalRQXZzf8ufSh9I= github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f/go.mod h1:xH/i4TFMt8koVQZ6WFms69WAsDWr2XsYL3Hkl7jkoLE= -github.com/dgraph-io/badger/v2 v2.2007.4 h1:TRWBQg8UrlUhaFdco01nO2uXwzKS7zd+HVdwV/GHc4o= -github.com/dgraph-io/badger/v2 v2.2007.4/go.mod h1:vSw/ax2qojzbN6eXHIx6KPKtCSHJN/Uz0X0VPruTIhk= -github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= -github.com/dgraph-io/ristretto v0.1.1 h1:6CWw5tJNgpegArSHpNHJKldNeq03FQCwYvfMVWajOK8= -github.com/dgraph-io/ristretto v0.1.1/go.mod h1:S1GPSBCYCIhmVNfcth17y2zZtQT6wzkzgwUve0VDWWA= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= -github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= -github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 h1:fAjc9m62+UWV/WAFKLNi6ZS0675eEUC9y3AlwSbQu1Y= -github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= -github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91 h1:Izz0+t1Z5nI16/II7vuEo/nHjodOg0p7+OiDpjX5t1E= -github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= +github.com/dlclark/regexp2 v1.7.0 h1:7lJfhqlPssTb1WQx4yvTHN0uElPEv52sbaECrAQxjAo= +github.com/dlclark/regexp2 v1.7.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m322EBzniBPB6ZIzuh8= github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/docker v24.0.7+incompatible h1:Wo6l37AuwP3JaMnZa226lzVXGA3F9Ig1seQen0cKYlM= github.com/docker/docker v24.0.7+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= -github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= -github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= +github.com/docker/go-connections v0.5.0 h1:USnMq7hx7gwdVZq1L49hLXaFtUdTADjXGp+uj1Br63c= +github.com/docker/go-connections v0.5.0/go.mod h1:ov60Kzw0kKElRwhNs9UlUHAE/F9Fe6GLaXnqyDdmEXc= github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= -github.com/dop251/goja v0.0.0-20220405120441-9037c2b61cbf h1:Yt+4K30SdjOkRoRRm3vYNQgR+/ZIy0RmeUDZo7Y8zeQ= -github.com/dop251/goja v0.0.0-20220405120441-9037c2b61cbf/go.mod h1:R9ET47fwRVRPZnOGvHxxhuZcbrMCuiqOz3Rlrh4KSnk= +github.com/dop251/goja v0.0.0-20230806174421-c933cf95e127 h1:qwcF+vdFrvPSEUDSX5RVoRccG8a5DhOdWdQ4zN62zzo= +github.com/dop251/goja v0.0.0-20230806174421-c933cf95e127/go.mod h1:QMWlm50DNe14hD7t24KEqZuUdC9sOTy8W6XbCU1mlw4= github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= github.com/dvsekhvalnov/jose2go v1.6.0 h1:Y9gnSnP4qEI0+/uQkHvFXeD2PLPJeXEL+ySMEA2EjTY= @@ -488,12 +500,10 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.m github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/envoyproxy/protoc-gen-validate v1.0.4 h1:gVPz/FMfvh57HdSJQyvBtF00j8JU4zdyUgIUNhlgg0A= -github.com/envoyproxy/protoc-gen-validate v1.0.4/go.mod h1:qys6tmnRsYrQqIhm2bvKZH4Blx/1gTIZ2UKVY1M+Yew= -github.com/faddat/go-substrate-rpc-client/v4 v4.0.1-0.20240402155230-48db8c110afe h1:63rMpjrCwbJVYoz1XFOzRXCZd8frLSuChg5XSo3tKg4= -github.com/faddat/go-substrate-rpc-client/v4 v4.0.1-0.20240402155230-48db8c110afe/go.mod h1:enTNfc1aCsOpHnOqlDEDAGr3SzacyTh/VX/nL+5YBs4= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= +github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= +github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= +github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 h1:FtmdgXiUlNeRsoNMFlKLDt+S+6hbjVMEW6RGQ7aUf7c= @@ -514,13 +524,13 @@ github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x github.com/getsentry/sentry-go v0.27.0 h1:Pv98CIbtB3LkMWmXi4Joa5OOcwbmnX88sF5qbK3r3Ps= github.com/getsentry/sentry-go v0.27.0/go.mod h1:lc76E2QywIyW8WuBnwl8Lc4bkmQH4+w1gwTf25trprY= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= github.com/gin-gonic/gin v1.6.3/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M= -github.com/gin-gonic/gin v1.8.1 h1:4+fr/el88TOO3ewCmQr8cx/CtZ/umlIRIs5M4NTNjf8= -github.com/gin-gonic/gin v1.8.1/go.mod h1:ji8BvRH1azfM+SYow9zQ6SZMvR8qOMZHmsCuWR9tTTk= github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA= github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og= +github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgOZ7o= @@ -535,8 +545,8 @@ github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG github.com/go-logfmt/logfmt v0.6.0 h1:wGYYu3uicYdqXVgoYbvnkrPVXkuLM1p1ifugDMEdRi4= github.com/go-logfmt/logfmt v0.6.0/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= -github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= +github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-ole/go-ole v1.2.5/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= @@ -544,14 +554,8 @@ github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE= github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78= github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= -github.com/go-playground/locales v0.14.0 h1:u50s323jtVGugKlcYeyzC0etD1HifMjqmJqb8WugfUU= -github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs= github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= -github.com/go-playground/universal-translator v0.18.0 h1:82dyy6p4OuJq4/CByFNOn/jYrnRPArHwAcmLoJZxyho= -github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA= github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI= -github.com/go-playground/validator/v10 v10.11.1 h1:prmOlTVv+YjZjmRmNSF3VmspqJIxJWXmqUsHwfTRRkQ= -github.com/go-playground/validator/v10 v10.11.1/go.mod h1:i+3WkQ1FvaUjjxh1kSvIA4dMGDBiPU55YFDl0WbKdWU= github.com/go-sourcemap/sourcemap v2.1.3+incompatible h1:W1iEw64niKVGogNgBN3ePyLFfuisuzeidWPMPWmECqU= github.com/go-sourcemap/sourcemap v2.1.3+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg= github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= @@ -561,15 +565,9 @@ github.com/go-stack/stack v1.8.1/go.mod h1:dcoOX6HbPZSZptuspn9bctJ+N/CnF5gGygcUP github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= -github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee h1:s+21KNqlpePfkah2I+gwHF8xmJWRjooY+5248k6m4A0= github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo= -github.com/gobwas/pool v0.2.0 h1:QEmUOlnSjWtnpRGHF3SauEiOsy82Cup83Vf2LcMlnc8= github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw= github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM= -github.com/gobwas/ws v1.1.0 h1:7RFti/xnNkMJnrK7D1yQ/iCIB5OrrY/54/H930kIbHA= -github.com/gobwas/ws v1.1.0/go.mod h1:nzvNcVha5eUziGrbxFCo6qFIojQHjJV5cLYIbezhfL0= -github.com/goccy/go-json v0.9.11 h1:/pAaQDLHEoCq/5FFmSKBswWmK6H0e8g4159Kc/X/nqk= -github.com/goccy/go-json v0.9.11/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 h1:ZpnhV/YsD2/4cESfV5+Hoeu/iUR3ruzNvZ+yQfO03a0= github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= @@ -580,8 +578,6 @@ github.com/gogo/googleapis v1.4.1/go.mod h1:2lpHqI5OcWCtVElxXnPt+s8oJvMpySlOyM6x github.com/golang-jwt/jwt/v4 v4.3.0 h1:kHL1vqdqWNfATmA0FNMdmZNMyZI1U6O31X4rlIPoBog= github.com/golang-jwt/jwt/v4 v4.3.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/glog v1.2.0 h1:uCdmnmatrKCgMBlM4rMuJZWOkPDqdbZPnrMXDY4gI68= -github.com/golang/glog v1.2.0/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w= github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -625,8 +621,8 @@ github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb h1:PBC98N2aIaM3XXi github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/btree v1.1.2 h1:xf4v41cLI2Z6FxbKm+8Bu+m8ifhj15JuZ9sa0jZCMUU= -github.com/google/btree v1.1.2/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= +github.com/google/btree v1.1.3 h1:CVpQJjYgC4VbzxeGVHfvZrv1ctoYCAI8vbl07Fcxlyg= +github.com/google/btree v1.1.3/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= @@ -653,8 +649,8 @@ github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXi github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/martian/v3 v3.2.1/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= -github.com/google/martian/v3 v3.3.2 h1:IqNFLAmvJOgVlpdEBiQbDc2EwKW77amAycfTuWKdfvw= -github.com/google/martian/v3 v3.3.2/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= +github.com/google/martian/v3 v3.3.3 h1:DIhPTQrbPkgs2yJYdXU/eNACCG5DVQjySNRNlflZ9Fc= +github.com/google/martian/v3 v3.3.3/go.mod h1:iEPrYcgCF7jA9OtScMFQyAlZZ4YXTKEtJ1E6RWzmBA0= github.com/google/orderedcode v0.0.1 h1:UzfcAexk9Vhv8+9pNOgRu41f16lHq725vPwnSeiG/Us= github.com/google/orderedcode v0.0.1/go.mod h1:iVyU4/qPKHY5h/wSd6rZZCDcLJNxiWO6dvsYES2Sb20= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= @@ -672,11 +668,11 @@ github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLe github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210609004039-a478d1d731e9/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20230405160723-4a4c7d95572b h1:Qcx5LM0fSiks9uCyFZwDBUasd3lxd1RM0GYpL+Li5o4= -github.com/google/pprof v0.0.0-20230405160723-4a4c7d95572b/go.mod h1:79YE0hCXdHag9sBkw2o+N/YnZtTkXi0UT9Nnixa5eYk= +github.com/google/pprof v0.0.0-20230817174616-7a8ec2ada47b h1:h9U78+dx9a4BKdQkBBos92HalKpaGKHrp+3Uo6yTodo= +github.com/google/pprof v0.0.0-20230817174616-7a8ec2ada47b/go.mod h1:czg5+yv1E0ZGTi6S6vVK1mke0fV+FaUhNGcd6VRS9Ik= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/s2a-go v0.1.7 h1:60BLSyTrOV4/haCDW4zb1guZItoSq8foHCXrAnjBo/o= -github.com/google/s2a-go v0.1.7/go.mod h1:50CgR4k1jNlWBu4UfS4AcfhVe1r6pdZPygJ3R8F0Qdw= +github.com/google/s2a-go v0.1.8 h1:zZDs9gcbt9ZPLV0ndSyQk6Kacx2g/X+SKYovpnz3SMM= +github.com/google/s2a-go v0.1.8/go.mod h1:6iNWHTpQ+nfNRN5E00MSdfDwVesa8hhS32PhPO8deJA= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -696,21 +692,24 @@ github.com/googleapis/gax-go/v2 v2.3.0/go.mod h1:b8LNqSzNabLiUpXKkY7HAR5jr6bIT99 github.com/googleapis/gax-go/v2 v2.4.0/go.mod h1:XOTVJ59hdnfJLIP/dh8n5CGryZR2LxK9wbMD5+iXC6c= github.com/googleapis/gax-go/v2 v2.5.1/go.mod h1:h6B0KMMFNtI2ddbGJn3T3ZbwkeT6yqEF02fYlzkUCyo= github.com/googleapis/gax-go/v2 v2.6.0/go.mod h1:1mjbznJAPHFpesgE5ucqfYEscaz5kMdcIDwU/6+DDoY= -github.com/googleapis/gax-go/v2 v2.12.0 h1:A+gCJKdRfqXkr+BIRGtZLibNXf0m1f9E4HG56etFpas= -github.com/googleapis/gax-go/v2 v2.12.0/go.mod h1:y+aIqrI5eb1YGMVJfuV3185Ts/D7qKpsEkdD5+I6QGU= +github.com/googleapis/gax-go/v2 v2.13.0 h1:yitjD5f7jQHhyDsnhKEBU52NdvvdSeGzlAnDPT0hH1s= +github.com/googleapis/gax-go/v2 v2.13.0/go.mod h1:Z/fvTZXF8/uw7Xu5GuslPw+bplx6SS338j1Is2S+B7A= github.com/googleapis/go-type-adapters v1.0.0/go.mod h1:zHW75FOG2aur7gAO2B+MLby+cLsWGBF62rFAi7WjWO4= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= -github.com/gorilla/handlers v1.5.1 h1:9lRY6j8DEeeBT10CvO9hGW0gmky0BprnvDI5vfhUHH4= -github.com/gorilla/handlers v1.5.1/go.mod h1:t8XrUpc4KVXb7HGyJ4/cEnwQiaxrX/hz1Zv/4g96P1Q= +github.com/gorilla/handlers v1.5.2 h1:cLTUSsNkgcwhgRqvCNmdbRWG0A3N4F+M2nWKdScwyEE= +github.com/gorilla/handlers v1.5.2/go.mod h1:dX+xVpaxdSw+q0Qek8SSsl3dfMk3jNddUkMzo0GtH0w= github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= -github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= -github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= +github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY= +github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ= github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg= +github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/goware/urlx v0.3.2 h1:gdoo4kBHlkqZNaf6XlQ12LGtQOmpKJrR04Rc3RnpJEo= +github.com/goware/urlx v0.3.2/go.mod h1:h8uwbJy68o+tQXCGZNa9D73WN8n0r9OBae5bUnLcgjw= github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-middleware v1.2.2/go.mod h1:EaizFBKfUKtMIF5iaDEhniwNedqGo9FuLFzppDr3uwI= github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 h1:UH//fgunKIs4JdUbpDl1VZCDaL56wXCB/5+wF6uHfaI= @@ -735,13 +734,19 @@ github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtng github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= -github.com/hashicorp/go-getter v1.7.5 h1:dT58k9hQ/vbxNMwoI5+xFYAJuv6152UNvdHokfI5wE4= -github.com/hashicorp/go-getter v1.7.5/go.mod h1:W7TalhMmbPmsSMdNjD0ZskARur/9GJ17cfHTRtXV744= +github.com/hashicorp/go-getter v1.7.6 h1:5jHuM+aH373XNtXl9TNTUH5Qd69Trve11tHIrB+6yj4= +github.com/hashicorp/go-getter v1.7.6/go.mod h1:W7TalhMmbPmsSMdNjD0ZskARur/9GJ17cfHTRtXV744= +github.com/hashicorp/go-hclog v1.5.0 h1:bI2ocEMgcVlz55Oj1xZNBsVi900c7II+fWDyV9o+13c= +github.com/hashicorp/go-hclog v1.5.0/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= github.com/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJFeZnpfm2KLowc= github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= +github.com/hashicorp/go-metrics v0.5.3 h1:M5uADWMOGCTUNU1YuC4hfknOeHNaX54LDm4oYSucoNE= +github.com/hashicorp/go-metrics v0.5.3/go.mod h1:KEjodfebIOuBYSAe/bHTm+HChmKSxAOXPBieMLYozDE= github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= +github.com/hashicorp/go-plugin v1.6.0 h1:wgd4KxHJTVGGqWBq4QPB1i5BZNEx9BR8+OFmHDmTk8A= +github.com/hashicorp/go-plugin v1.6.0/go.mod h1:lBS5MtSSBZk0SHc66KACcjjlU6WzEVP/8pwz68aMkCI= github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= github.com/hashicorp/go-safetemp v1.0.0 h1:2HR189eFNrjHQyENnQMMpCiBAsRxzbTMIgBhEyExpmo= @@ -750,11 +755,12 @@ github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerX github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8= -github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-uuid v1.0.2 h1:cfejS+Tpcp13yd5nYHWDI6qVCny6wyX2Mt5SGur2IGE= +github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= -github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek= github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= +github.com/hashicorp/go-version v1.7.0 h1:5tqGy27NaOTB8yJKUZELlFAS/LTKJkrmONwQKeRZfjY= +github.com/hashicorp/go-version v1.7.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= @@ -768,8 +774,10 @@ github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= -github.com/hdevalence/ed25519consensus v0.1.0 h1:jtBwzzcHuTmFrQN6xQZn6CQEO/V9f7HsjsjeEZ6auqU= -github.com/hdevalence/ed25519consensus v0.1.0/go.mod h1:w3BHWjwJbFU29IRHL1Iqkw3sus+7FctEyM4RqDxYNzo= +github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE= +github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ= +github.com/hdevalence/ed25519consensus v0.2.0 h1:37ICyZqdyj0lAZ8P4D1d1id3HqbbG1N3iBb1Tb4rdcU= +github.com/hdevalence/ed25519consensus v0.2.0/go.mod h1:w3BHWjwJbFU29IRHL1Iqkw3sus+7FctEyM4RqDxYNzo= github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZKVu0fao= github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iURXE7ZOP9L9hSkA= github.com/holiman/uint256 v1.2.4 h1:jUc4Nk8fm9jZabQuqr2JzednajVmBpC+oiTiXZJEApU= @@ -777,13 +785,15 @@ github.com/holiman/uint256 v1.2.4/go.mod h1:EOMSn4q6Nyt9P6efbI3bueV4e1b3dGlUCXei github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/huandu/go-assert v1.1.5 h1:fjemmA7sSfYHJD7CUqs9qTwwfdNAx7/j2/ZlHXzNB3c= github.com/huandu/go-assert v1.1.5/go.mod h1:yOLvuqZwmcHIC5rIzrBhT7D3Q9c3GFnd0JrPVhn/06U= -github.com/huandu/skiplist v1.2.0 h1:gox56QD77HzSC0w+Ws3MH3iie755GBJU1OER3h5VsYw= -github.com/huandu/skiplist v1.2.0/go.mod h1:7v3iFjLcSAzO4fN5B8dvebvo/qsfumiLiDXMrPiHF9w= +github.com/huandu/skiplist v1.2.1 h1:dTi93MgjwErA/8idWTzIw4Y1kZsMWx35fmI2c8Rij7w= +github.com/huandu/skiplist v1.2.1/go.mod h1:7v3iFjLcSAzO4fN5B8dvebvo/qsfumiLiDXMrPiHF9w= github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= github.com/huin/goupnp v1.3.0 h1:UvLUlWDNpoUdYzb2TCn+MuTWtcjXKSza2n6CBdQ0xXc= github.com/huin/goupnp v1.3.0/go.mod h1:gnGPsThkYa7bFi/KWmEysQRf48l2dvR5bxr2OFckNX8= -github.com/iancoleman/orderedmap v0.2.0 h1:sq1N/TFpYH++aViPcaKjys3bDClUEU7s5B+z6jq8pNA= -github.com/iancoleman/orderedmap v0.2.0/go.mod h1:N0Wam8K1arqPXNWjMo21EXnBPOPp36vB07FNRdD2geA= +github.com/iancoleman/orderedmap v0.3.0 h1:5cbR2grmZR/DiVt+VJopEhtVs9YGInGIxAoMJn+Ichc= +github.com/iancoleman/orderedmap v0.3.0/go.mod h1:XuLcCUkdL5owUCQeF2Ue9uuw1EptkJDkXXS7VoV7XGE= +github.com/iancoleman/strcase v0.3.0 h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSASxEI= +github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/icza/dyno v0.0.0-20220812133438-f0b6f8a18845 h1:H+uM0Bv88eur3ZSsd2NGKg3YIiuXxwxtlN7HjE66UTU= @@ -800,15 +810,13 @@ github.com/jackpal/go-nat-pmp v1.0.2 h1:KzKSgb7qkJvOUTqYl9/Hg/me3pWgBmERKrTGD7Bd github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jhump/protoreflect v1.15.1 h1:HUMERORf3I3ZdX05WaQ6MIpd/NJ434hTp5YiKgfCL6c= -github.com/jhump/protoreflect v1.15.1/go.mod h1:jD/2GMKKE6OqX8qTjhADU1e6DShO+gavG9e0Q693nKo= +github.com/jhump/protoreflect v1.15.3 h1:6SFRuqU45u9hIZPJAoZ8c28T3nK64BNdp9w6jFonzls= +github.com/jhump/protoreflect v1.15.3/go.mod h1:4ORHmSBmlCW8fh3xHmJMGyul1zNqZK4Elxc8qKP+p1k= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8= github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= -github.com/jmhodges/levigo v1.0.0 h1:q5EC36kV79HWeTBWsod3mG11EgStG3qArTKcvlksN1U= -github.com/jmhodges/levigo v1.0.0/go.mod h1:Q6Qx+uH3RAqyK4rFQroq9RL7mdkABMcfhEI+nNuzMJQ= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= @@ -817,21 +825,17 @@ github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/u github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= -github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= -github.com/kava-labs/cometbft v0.37.9-kava.1 h1:0mMsAhpV8p0peD9sabIZ//M4nP6LiiZ0o34gfuHdANY= -github.com/kava-labs/cometbft v0.37.9-kava.1/go.mod h1:j0Q3RqrCd+cztWCugs3obbzC4NyHGBPZZjtm/fWV00I= -github.com/kava-labs/cometbft-db v0.9.1-kava.2 h1:ZQaio886ifvml9XtJB4IYHhlArgA3+/a5Zwidg7H2J8= -github.com/kava-labs/cometbft-db v0.9.1-kava.2/go.mod h1:PvUZbx7zeR7I4CAvtKBoii/5ia5gXskKjDjIVpt7gDw= -github.com/kava-labs/cosmos-sdk v0.47.10-iavl-v1-kava.1 h1:vQwrm3sdAG1pkwrsi2mmCHSGDje5fzUR6vApEux/nVA= -github.com/kava-labs/cosmos-sdk v0.47.10-iavl-v1-kava.1/go.mod h1:OwLYEBcsnijCLE8gYkwQ7jycZZ/Acd+a83pJU+V+MKw= -github.com/kava-labs/ethermint v0.21.1-0.20240703152838-badab86e5aba h1:qrBo1h72L9WxZ7nUdpC7KlkTnscUfwWZAcZI1fWyMwE= -github.com/kava-labs/ethermint v0.21.1-0.20240703152838-badab86e5aba/go.mod h1:/Gxb9qs4shgPP2FQMvm2DkZ/7csmEGUh7F5vl7fKQZw= +github.com/kava-labs/cometbft v0.0.0-20241024200036-527d8df9ff12 h1:RqnpnEGEuykjY3XWSLMuMwjUOiJ6cr7gSznAW/tgTQ4= +github.com/kava-labs/cometbft v0.0.0-20241024200036-527d8df9ff12/go.mod h1:5awmm7t/X8LJ+Wd7/TXHcv4hLfFLcexy6fdS9WvOepA= +github.com/kava-labs/cosmos-sdk v0.0.0-20241108231030-e1beb1437b24 h1:89aBfvV1XKbOaGklejzQnAove63jH6TxNL1hT6BIf6U= +github.com/kava-labs/cosmos-sdk v0.0.0-20241108231030-e1beb1437b24/go.mod h1:Yf8jj8R5+9NWCbdot0IMId92WeAIF22Thc/pRR2hSoI= +github.com/kava-labs/ethermint v0.0.0-20241105193811-2b40405cecd5 h1:bYKOKyjnntnkc+f5gyTmjKCpqKl1HFjcOMzJjo9s2yQ= +github.com/kava-labs/ethermint v0.0.0-20241105193811-2b40405cecd5/go.mod h1:dFh15Ndobz1zWqWcJm9ML+0BnMt5m8gS+MhVUcAGLpg= github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs= github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= @@ -839,14 +843,11 @@ github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+o github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= github.com/klauspost/compress v1.10.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.11.7/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= -github.com/klauspost/compress v1.12.3/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= github.com/klauspost/compress v1.15.11/go.mod h1:QPwzmACJjUTFsnSHH934V6woptycfrDDJnH7hvFVbGM= -github.com/klauspost/compress v1.17.7 h1:ehO88t2UGzQK66LMdE8tibEd1ErmzZjNEqWkjLAKQQg= -github.com/klauspost/compress v1.17.7/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= -github.com/klauspost/cpuid/v2 v2.0.4/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= -github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= -github.com/klauspost/cpuid/v2 v2.2.4 h1:acbojRNwl3o09bUq+yDCtZFc1aiwaAAxtcn8YkZXnvk= -github.com/klauspost/cpuid/v2 v2.2.4/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY= +github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= +github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= +github.com/klauspost/cpuid/v2 v2.2.5 h1:0E5MSMDEoAulmXNFquVs//DdoomxaoTY1kUhbc/qbZg= +github.com/klauspost/cpuid/v2 v2.2.5/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= @@ -857,31 +858,33 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= -github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w= -github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= -github.com/lib/pq v1.10.7 h1:p7ZhMD+KsSRozJr34udlUrhboJwWAgCg34+/ZZNvZZw= -github.com/lib/pq v1.10.7/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= +github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= +github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8= github.com/libp2p/go-buffer-pool v0.1.0/go.mod h1:N+vh8gMqimBzdKkSMVuydVDq+UV5QTWy5HSiZacSbPg= -github.com/libp2p/go-libp2p v0.27.8 h1:IX5x/4yKwyPQeVS2AXHZ3J4YATM9oHBGH1gBc23jBAI= -github.com/libp2p/go-libp2p v0.27.8/go.mod h1:eCFFtd0s5i/EVKR7+5Ki8bM7qwkNW3TPTTSSW9sz8NE= +github.com/libp2p/go-libp2p v0.31.0 h1:LFShhP8F6xthWiBBq3euxbKjZsoRajVEyBS9snfHxYg= +github.com/libp2p/go-libp2p v0.31.0/go.mod h1:W/FEK1c/t04PbRH3fA9i5oucu5YcgrG0JVoBWT1B7Eg= github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM= github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= -github.com/linxGnu/grocksdb v1.8.13 h1:X3Id7Obhf8qLY9WPc4LmmtIyabmdDf810XSFDnLlW7E= -github.com/linxGnu/grocksdb v1.8.13/go.mod h1:QYiYypR2d4v63Wj1adOOfzglnoII0gLj3PNh4fZkcFA= +github.com/linxGnu/grocksdb v1.9.3 h1:s1cbPcOd0cU2SKXRG1nEqCOWYAELQjdqg3RVI2MH9ik= +github.com/linxGnu/grocksdb v1.9.3/go.mod h1:QYiYypR2d4v63Wj1adOOfzglnoII0gLj3PNh4fZkcFA= github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= -github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= github.com/manifoldco/promptui v0.9.0 h1:3V4HzJk1TtXW1MTZMP7mdlwbBpIinw3HztaIlYthEiA= github.com/manifoldco/promptui v0.9.0/go.mod h1:ka04sppxSGFAtxX0qhlYQjISsg9mR4GWtQEhdbn6Pgg= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= +github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= @@ -889,21 +892,21 @@ github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= -github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU= -github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= +github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U= +github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/mattn/go-sqlite3 v1.14.16 h1:yOQRA0RpS5PFz/oikGwBEqvAWhWg5ufRz4ETLjwpU1Y= github.com/mattn/go-sqlite3 v1.14.16/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= -github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643/go.mod h1:43+3pMjjKimDBf5Kr4ZFNGbLql1zKkbImw+fZbw3geM= github.com/mimoo/StrobeGo v0.0.0-20220103164710-9a04d6ca976b h1:QrHweqAtyJ9EwCaGHBu1fghwxIPiopAHV06JlXrMHjk= github.com/mimoo/StrobeGo v0.0.0-20220103164710-9a04d6ca976b/go.mod h1:xxLb2ip6sSUts3g1irPVHyk/DGslwQsNOo9I7smJfNU= -github.com/minio/highwayhash v1.0.2 h1:Aak5U0nElisjDCfPSG79Tgzkn2gl66NxOMspRrKnA/g= -github.com/minio/highwayhash v1.0.2/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY= -github.com/minio/sha256-simd v1.0.0 h1:v1ta+49hkWZyvaKwrQB8elexRqm6Y0aMLjCNsrYxo6g= -github.com/minio/sha256-simd v1.0.0/go.mod h1:OuYzVNI5vcoYIAmbIvHPl3N3jUzVedXbKy5RFepssQM= +github.com/minio/highwayhash v1.0.3 h1:kbnuUMoHYyVl7szWjSxJnxw11k2U709jqFPPmIUyD6Q= +github.com/minio/highwayhash v1.0.3/go.mod h1:GGYsuwP/fPD6Y9hMiXuapVvlIUEhFhMTh0rxU3ik1LQ= +github.com/minio/sha256-simd v1.0.1 h1:6kaan5IFmwTNynnKKpDHe6FWHohJOHhCPchzK49dzMM= +github.com/minio/sha256-simd v1.0.1/go.mod h1:Pz6AKMiUdngCLpeTL/RJY1M9rUuPMYujV5xJjtbRSN8= +github.com/misko9/go-substrate-rpc-client/v4 v4.0.0-20230913220906-b988ea7da0c2 h1:G/cVeTAbB9S/6FSWWqpFV0v49hiuHLbJPu9hTZ0UR2A= +github.com/misko9/go-substrate-rpc-client/v4 v4.0.0-20230913220906-b988ea7da0c2/go.mod h1:Q5BxOd9FxJqYp4vCiLGVdetecPcWTmUQIu0bRigYosU= github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= @@ -919,15 +922,12 @@ github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyua github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/pointerstructure v1.2.0 h1:O+i9nHnXS3l/9Wu7r4NrEdwA2VFTicjUEN1uBnDo34A= github.com/mitchellh/pointerstructure v1.2.0/go.mod h1:BRAsLI5zgXmw97Lf6s25bs8ohIXc3tViBH44KcwB2g4= -github.com/moby/term v0.0.0-20220808134915-39b0c02b01ae h1:O4SWKdcHVCvYqyDV+9CJA1fcDN2L11Bule0iFy3YlAI= -github.com/moby/term v0.0.0-20220808134915-39b0c02b01ae/go.mod h1:E2VnQOmVuvZB6UYnnDB0qG5Nq/1tD9acaOpo6xmt0Kw= +github.com/moby/term v0.0.0-20221205130635-1aeaba878587 h1:HfkjXDfhgVaN5rmueG8cL8KKeFNecRCXFhaJ2qZ5SKA= +github.com/moby/term v0.0.0-20221205130635-1aeaba878587/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= -github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o= @@ -938,16 +938,18 @@ github.com/multiformats/go-base32 v0.1.0 h1:pVx9xoSPqEIQG8o+UbAe7DNi51oej1NtK+aG github.com/multiformats/go-base32 v0.1.0/go.mod h1:Kj3tFY6zNr+ABYMqeUNeGvkIC/UYgtWibDcT0rExnbI= github.com/multiformats/go-base36 v0.2.0 h1:lFsAbNOGeKtuKozrtBsAkSVhv1p9D0/qedU9rQyccr0= github.com/multiformats/go-base36 v0.2.0/go.mod h1:qvnKE++v+2MWCfePClUEjE78Z7P2a1UV0xHgWc0hkp4= -github.com/multiformats/go-multiaddr v0.9.0 h1:3h4V1LHIk5w4hJHekMKWALPXErDfz/sggzwC/NcqbDQ= -github.com/multiformats/go-multiaddr v0.9.0/go.mod h1:mI67Lb1EeTOYb8GQfL/7wpIZwc46ElrvzhYnoJOmTT0= +github.com/multiformats/go-multiaddr v0.11.0 h1:XqGyJ8ufbCE0HmTDwx2kPdsrQ36AGPZNZX6s6xfJH10= +github.com/multiformats/go-multiaddr v0.11.0/go.mod h1:gWUm0QLR4thQ6+ZF6SXUw8YjtwQSPapICM+NmCkxHSM= github.com/multiformats/go-multibase v0.2.0 h1:isdYCVLvksgWlMW9OZRYJEa9pZETFivncJHmHnnd87g= github.com/multiformats/go-multibase v0.2.0/go.mod h1:bFBZX4lKCA/2lyOFSAoKH5SS6oPyjtnzK/XTFDPkNuk= -github.com/multiformats/go-multicodec v0.8.1 h1:ycepHwavHafh3grIbR1jIXnKCsFm0fqsfEOsJ8NtKE8= -github.com/multiformats/go-multicodec v0.8.1/go.mod h1:L3QTQvMIaVBkXOXXtVmYE+LI16i14xuaojr/H7Ai54k= -github.com/multiformats/go-multihash v0.2.1 h1:aem8ZT0VA2nCHHk7bPJ1BjUbHNciqZC/d16Vve9l108= -github.com/multiformats/go-multihash v0.2.1/go.mod h1:WxoMcYG85AZVQUyRyo9s4wULvW5qrI9vb2Lt6evduFc= +github.com/multiformats/go-multicodec v0.9.0 h1:pb/dlPnzee/Sxv/j4PmkDRxCOi3hXTz3IbPKOXWJkmg= +github.com/multiformats/go-multicodec v0.9.0/go.mod h1:L3QTQvMIaVBkXOXXtVmYE+LI16i14xuaojr/H7Ai54k= +github.com/multiformats/go-multihash v0.2.3 h1:7Lyc8XfX/IY2jWb/gI7JP+o7JEq9hOa7BFvVU9RSh+U= +github.com/multiformats/go-multihash v0.2.3/go.mod h1:dXgKXCXjBzdscBLk9JkjINiEsCKRVch90MdaGiKsvSM= github.com/multiformats/go-varint v0.0.7 h1:sWSGR+f/eu5ABZA2ZpYKBILXTTs9JWpdEM/nEGOHFS8= github.com/multiformats/go-varint v0.0.7/go.mod h1:r8PUYw/fD/SjBCiKOoDlGF6QawOELpZAu9eioSos/OU= +github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= +github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f h1:KUppIJq7/+SVif2QVs3tOP0zanoHgBEVAwHxUSIzRqU= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= @@ -963,8 +965,12 @@ github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLA github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= +github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a h1:dlRvE5fWabOchtH7znfiFCcOvmIYgOeAS5ifBXBlh9Q= +github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a/go.mod h1:hVoHR2EVESiICEMbg137etN/Lx+lSrHPTD39Z/uE+2s= github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs= github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= +github.com/oklog/run v1.1.0 h1:GEenZ1cK0+q0+wsJew9qUg/DyD8k3JzYsZAi5gYi2mA= +github.com/oklog/run v1.1.0/go.mod h1:sVPdnTZT1zYwAJeCMu2Th4T21pA3FPOQRfWjQlk7DVU= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= @@ -977,16 +983,16 @@ github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vv github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= github.com/onsi/ginkgo/v2 v2.1.3/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c= -github.com/onsi/ginkgo/v2 v2.9.2 h1:BA2GMJOtfGAfagzYtrAlufIP0lq6QERkFmHLMLPwFSU= -github.com/onsi/ginkgo/v2 v2.9.2/go.mod h1:WHcJJG2dIlcCqVfBAwUCrJxSPFb6v4azBwgxeMeDuts= +github.com/onsi/ginkgo/v2 v2.11.0 h1:WgqUCUt/lT6yXoQ8Wef0fsNn5cAuMK7+KT9UFRz2tcU= +github.com/onsi/ginkgo/v2 v2.11.0/go.mod h1:ZhrRA5XmEE3x3rhlzamx/JJvujdZoJ2uvgI7kR0iZvM= github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= -github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI= -github.com/onsi/gomega v1.27.10/go.mod h1:RsS8tutOdbdgzbPtzzATp12yT7kM5I5aElG3evPbQ0M= +github.com/onsi/gomega v1.27.8 h1:gegWiwZjBsf2DgiSbf5hpokZ98JVDMcWkUiigk6/KXc= +github.com/onsi/gomega v1.27.8/go.mod h1:2J8vzI/s+2shY9XHRApDkdgPo1TKT7P2u6fXeJKFnNQ= github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= @@ -1004,22 +1010,18 @@ github.com/openzipkin/zipkin-go v0.2.1/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnh github.com/openzipkin/zipkin-go v0.2.2/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4= github.com/ory/dockertest v3.3.5+incompatible h1:iLLK6SQwIhcbrG783Dghaaa3WPzGc+4Emza6EbVUUGA= github.com/ory/dockertest v3.3.5+incompatible/go.mod h1:1vX4m9wsvi00u5bseYwXaSnhNrne+V0E6LAcBILJdPs= -github.com/oxyno-zeta/gomock-extra-matcher v1.1.0 h1:Yyk5ov0ZPKBXtVEeIWtc4J2XVrHuNoIK+0F2BUJgtsc= -github.com/oxyno-zeta/gomock-extra-matcher v1.1.0/go.mod h1:UMGTHYEmJ1dRq8LDZ7VTAYO4nqM3GD1UGC3RJEUxEz0= github.com/pact-foundation/pact-go v1.0.4/go.mod h1:uExwJY4kCzNPcHRj+hCR/HBbOOIwwtUjcrb0b5/5kLM= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= -github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= -github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4= -github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= +github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M= +github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc= github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= -github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= -github.com/petermattis/goid v0.0.0-20231207134359-e60b3f734c67 h1:jik8PHtAIsPlCRJjJzl4udgEf7hawInF9texMeO2jrU= -github.com/petermattis/goid v0.0.0-20231207134359-e60b3f734c67/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= +github.com/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7 h1:Dx7Ovyv/SFnMFw3fD4oEoeorXc6saIiQ23LrGLth0Gw= +github.com/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pierrec/xxHash v0.1.5 h1:n/jBpwTHiER4xYvK3/CdPVnLDPchj8eTJFFLUb4QHBo= @@ -1042,8 +1044,8 @@ github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5Fsn github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= -github.com/prometheus/client_golang v1.17.0 h1:rl2sfwZMtSthVU752MqfjQozy7blglC+1SOtjMAMh+Q= -github.com/prometheus/client_golang v1.17.0/go.mod h1:VeL+gMmOAxkS2IqfCq0ZmHSL+LjWfWDUmp1mBz9JgUY= +github.com/prometheus/client_golang v1.20.4 h1:Tgh3Yr67PaOv/uTqloMsCEdeuFTatm5zIq5+qNN23vI= +github.com/prometheus/client_golang v1.20.4/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= @@ -1059,16 +1061,16 @@ github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt2 github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= -github.com/prometheus/common v0.44.0 h1:+5BrQJwiBB9xsMygAB3TNvpQKOwlkc25LbISbrdOOfY= -github.com/prometheus/common v0.44.0/go.mod h1:ofAIvZbQ1e/nugmZGz4/qCb9Ap1VoSTIO7x0VV9VvuY= +github.com/prometheus/common v0.60.0 h1:+V9PAREWNvJMAuJ1x1BaWl9dewMW4YrHZQbx0sJNllA= +github.com/prometheus/common v0.60.0/go.mod h1:h0LYf1R1deLSKtD4Vdg8gy4RuOvENW2J/h19V5NADQw= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/procfs v0.3.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= -github.com/prometheus/procfs v0.13.0 h1:GqzLlQyfsPbaEHaQkO7tbDlriv/4o5Hudv6OXHGKX7o= -github.com/prometheus/procfs v0.13.0/go.mod h1:cd4PFCR54QLnGKPaKGA6l+cfuNXtht43ZKY6tow0Y1g= +github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc= +github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= github.com/prometheus/tsdb v0.7.1 h1:YZcsG11NqnK4czYLrWd9mpEuAJIHVQLwdrleYfszMAA= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/rakyll/statik v0.1.7 h1:OF3QCZUuyPxuGEP7B4ypUa7sB/iHtqOTDYZXGM8KOdQ= @@ -1078,7 +1080,6 @@ github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 h1:N/ElC8H3+5X github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/regen-network/protobuf v1.3.3-alpha.regen.1 h1:OHEc+q5iIAXpqiqFKeLpu5NwTIkVXUs48vFMwzqpqY4= github.com/regen-network/protobuf v1.3.3-alpha.regen.1/go.mod h1:2DjTFR1HhMQhiWC5sZ4OhQ3+NtdbZ6oBDKQwq5Ou+FI= -github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE= github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= @@ -1093,12 +1094,11 @@ github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/f github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= -github.com/rs/cors v1.8.3 h1:O+qNyWn7Z+F9M0ILBHgMVPuB1xTOucVd5gtaYyXBpRo= -github.com/rs/cors v1.8.3/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= +github.com/rs/cors v1.11.1 h1:eU3gRzXLRK57F5rKMGMZURNdIG4EoAmX8k94r9wXWHA= +github.com/rs/cors v1.11.1/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= -github.com/rs/zerolog v1.32.0 h1:keLypqrlIjaFsbmJOBdB/qvyF8KEtCWHwobLp5l/mQ0= -github.com/rs/zerolog v1.32.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= -github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= +github.com/rs/zerolog v1.33.0 h1:1cU2KZkvPxNyfgEmhHAz/1A9Bz+llsdYzklWFzgp0r8= +github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= github.com/russross/blackfriday v1.6.0 h1:KqfZb0pUVN2lYqZUYRddxF4OR8ZMURnJIG5Y3VRLtww= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= @@ -1109,8 +1109,8 @@ github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgY github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= -github.com/sasha-s/go-deadlock v0.3.1 h1:sqv7fDNShgjcaxkO0JNcOAlr8B9+cV5Ey/OB71efZx0= -github.com/sasha-s/go-deadlock v0.3.1/go.mod h1:F73l+cr82YSh10GxyRI6qZiCgK64VaZjwesgfQ1/iLM= +github.com/sasha-s/go-deadlock v0.3.5 h1:tNCOEEDG6tBqrNDOX35j/7hL5FcFViG6awUGROb2NsU= +github.com/sasha-s/go-deadlock v0.3.5/go.mod h1:bugP6EGbdGYObIlx7pUZtWqlvo8k9H6vCBBsiChJQ5U= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible h1:Bn1aCHHRnjv4Bl16T8rcaFjYSrGrIZvpiGO6P3Q4GpU= github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= @@ -1130,28 +1130,20 @@ github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIK github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY= -github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0= -github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= +github.com/spf13/cast v1.7.0 h1:ntdiHjuueXFgm5nzDRdOS4yfT43P5Fnud6DH50rz/7w= +github.com/spf13/cast v1.7.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= -github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= -github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0= -github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho= -github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= +github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM= +github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y= github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= -github.com/spf13/viper v1.18.2 h1:LUXCnvUvSM6FXAsj6nnfc8Q2tp1dIgUfY9Kc8GsSOiQ= -github.com/spf13/viper v1.18.2/go.mod h1:EKmWIqdnk5lOcmR72yw6hS+8OPYcwD0jteitLMVB+yk= +github.com/spf13/viper v1.19.0 h1:RWq5SEjt8o25SROyN3z2OrDB9l7RPd3lwTWU8EcEdcI= +github.com/spf13/viper v1.19.0/go.mod h1:GQUN9bilAbhU/jgc1bKs99f/suXKeUMct8Adx5+Ntkg= github.com/status-im/keycard-go v0.2.0 h1:QDLFswOQu1r5jsycloeQh3bVU8n/NatHHaZobtDnDzA= github.com/status-im/keycard-go v0.2.0/go.mod h1:wlp8ZLbsmrF6g6WjugPAx+IzoLrkdf9+mHxBEeo3Hbg= -github.com/strangelove-ventures/interchaintest/v7 v7.0.1-0.20240506191732-71a15c29f2b7 h1:7Qsz/NHs+FqDHvjHB3qLIMU7+/Z8vPI8ZJ2Q0p7x93U= -github.com/strangelove-ventures/interchaintest/v7 v7.0.1-0.20240506191732-71a15c29f2b7/go.mod h1:J1Pbldeib6FKgQmEZvlaqvVNYDmQxVpR49KMBfMh8Z4= github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= @@ -1194,24 +1186,17 @@ github.com/tyler-smith/go-bip32 v1.0.0 h1:sDR9juArbUgX+bO/iblgZnMPeWY1KZMUC2AFUJ github.com/tyler-smith/go-bip32 v1.0.0/go.mod h1:onot+eHknzV4BVPwrzqY5OoVpyCvnwD7lMawL5aQupE= github.com/tyler-smith/go-bip39 v1.1.0 h1:5eUemwrMargf3BSLRRCalXT93Ns6pQJIjYQN2nyfOP8= github.com/tyler-smith/go-bip39 v1.1.0/go.mod h1:gUYDtqQw1JS3ZJ8UWVcGTGqqr6YIN3CWg+kkNaLt55U= -github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo= github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= -github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= -github.com/ugorji/go/codec v1.2.7 h1:YPXUKf7fYbp/y8xloBqZOw2qaVggbfwMlI8WM3wZUJ0= -github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY= github.com/ulikunitz/xz v0.5.10/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= -github.com/ulikunitz/xz v0.5.11 h1:kpFauv27b6ynzBNT/Xy+1k+fK4WswhN/6PN5WhFAGw8= -github.com/ulikunitz/xz v0.5.11/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= +github.com/ulikunitz/xz v0.5.12 h1:37Nm15o69RwBkXM0J6A5OlE67RZTfzUxTj8fB3dfcsc= +github.com/ulikunitz/xz v0.5.12/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= github.com/urfave/cli v1.22.1 h1:+mkCCcOFKPnCmVYVcURKps1Xe+3zP90gSYGNfRkjoIY= github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/urfave/cli/v2 v2.10.2 h1:x3p8awjp/2arX+Nl/G2040AZpOCHS/eMJJ1/a+mye4Y= github.com/urfave/cli/v2 v2.10.2/go.mod h1:f8iq5LtQ/bLxafbdBSLPPNsgaW0l/2fYYEHhAyPlwvo= -github.com/vedhavyas/go-subkey/v2 v2.0.0 h1:LemDIsrVtRSOkp0FA8HxP6ynfKjeOj3BY2U9UNfeDMA= -github.com/vedhavyas/go-subkey/v2 v2.0.0/go.mod h1:95aZ+XDCWAUUynjlmi7BtPExjXgXxByE0WfBwbmIRH4= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= -github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU= github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -1225,8 +1210,6 @@ github.com/zondax/hid v0.9.2/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWp github.com/zondax/ledger-go v0.14.3 h1:wEpJt2CEcBJ428md/5MgSLsXLBos98sBOyxNmCjfUCw= github.com/zondax/ledger-go v0.14.3/go.mod h1:IKKaoxupuB43g4NxeQmbLXv7T9AlQyie1UpHb342ycI= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= -go.etcd.io/bbolt v1.3.8 h1:xs88BrvEv273UsB79e0hcVrlUWmS0a8upikMFhSyAtA= -go.etcd.io/bbolt v1.3.8/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw= go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= @@ -1239,28 +1222,28 @@ go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.47.0 h1:UNQQKPfTDe1J81ViolILjTKPr9WetKW6uei2hFgJmFs= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.47.0/go.mod h1:r9vWsPS/3AQItv3OSlEJ/E4mbrhUbbw18meOjArPtKQ= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0 h1:sv9kVfal0MK0wBMCOGr+HeJm9v803BkJxGrk2au7j08= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0/go.mod h1:SK2UL73Zy1quvRPonmOmRDiWk1KBV3LyIeeIxcEApWw= -go.opentelemetry.io/otel v1.22.0 h1:xS7Ku+7yTFvDfDraDIJVpw7XPyuHlB9MCiqqX5mcJ6Y= -go.opentelemetry.io/otel v1.22.0/go.mod h1:eoV4iAi3Ea8LkAEI9+GFT44O6T/D0GWAVFyZVCC6pMI= -go.opentelemetry.io/otel/metric v1.22.0 h1:lypMQnGyJYeuYPhOM/bgjbFM6WE44W1/T45er4d8Hhg= -go.opentelemetry.io/otel/metric v1.22.0/go.mod h1:evJGjVpZv0mQ5QBRJoBF64yMuOf4xCWdXjK8pzFvliY= -go.opentelemetry.io/otel/sdk v1.21.0 h1:FTt8qirL1EysG6sTQRZ5TokkU8d0ugCj8htOgThZXQ8= -go.opentelemetry.io/otel/sdk v1.21.0/go.mod h1:Nna6Yv7PWTdgJHVRD9hIYywQBRx7pbox6nwBnZIxl/E= -go.opentelemetry.io/otel/trace v1.22.0 h1:Hg6pPujv0XG9QaVbGOBVHunyuLcCC3jN7WEhPx83XD0= -go.opentelemetry.io/otel/trace v1.22.0/go.mod h1:RbbHXVqKES9QhzZq/fE5UnOSILqRt40a21sPw2He1xo= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0 h1:4Pp6oUg3+e/6M4C0A/3kJ2VYa++dsWVTtGgLVj5xtHg= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0/go.mod h1:Mjt1i1INqiaoZOMGR1RIUJN+i3ChKoFRqzrRQhlkbs0= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 h1:jq9TW8u3so/bN+JPT166wjOI6/vQPF6Xe7nMNIltagk= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0/go.mod h1:p8pYQP+m5XfbZm9fxtSKAbM6oIllS7s2AfxrChvc7iw= +go.opentelemetry.io/otel v1.28.0 h1:/SqNcYk+idO0CxKEUOtKQClMK/MimZihKYMruSMViUo= +go.opentelemetry.io/otel v1.28.0/go.mod h1:q68ijF8Fc8CnMHKyzqL6akLO46ePnjkgfIMIjUIX9z4= +go.opentelemetry.io/otel/metric v1.28.0 h1:f0HGvSl1KRAU1DLgLGFjrwVyismPlnuU6JD6bOeuA5Q= +go.opentelemetry.io/otel/metric v1.28.0/go.mod h1:Fb1eVBFZmLVTMb6PPohq3TO9IIhUisDsbJoL/+uQW4s= +go.opentelemetry.io/otel/sdk v1.24.0 h1:YMPPDNymmQN3ZgczicBY3B6sf9n62Dlj9pWD3ucgoDw= +go.opentelemetry.io/otel/sdk v1.24.0/go.mod h1:KVrIYw6tEubO9E96HQpcmpTKDVn9gdv35HoYiQWGDFg= +go.opentelemetry.io/otel/trace v1.28.0 h1:GhQ9cUuQGmNDd5BTCP2dAvv75RdMxEfTmYejp+lkx9g= +go.opentelemetry.io/otel/trace v1.28.0/go.mod h1:jPyXzNPg6da9+38HEwElrQiHlVMTnVfM3/yv2OlIHaI= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= -go.uber.org/goleak v1.2.0 h1:xqgm/S+aQvhWFTtR0XK3Jvg7z8kGV8P4X14IzwN3Eqk= -go.uber.org/goleak v1.2.0/go.mod h1:XJYK+MuIchqpmGmUSAzotztawfKvYLUIgg7guXrwVUo= -go.uber.org/mock v0.2.0 h1:TaP3xedm7JaAgScZO7tlvlKrqT0p7I6OsdGB5YNSMDU= -go.uber.org/mock v0.2.0/go.mod h1:J0y0rp9L3xiff1+ZBfKxlC1fz2+aO16tw0tsDOixfuM= +go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= +go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= +go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= +go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= @@ -1270,13 +1253,12 @@ go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9E go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= go.uber.org/zap v1.18.1/go.mod h1:xg/QME4nWcxGxrpdeYfq7UvYrLh66cuVKdrbD1XF/NI= -go.uber.org/zap v1.26.0 h1:sI7k6L95XOKS281NhVKOFCUNIvv9e0w4BF8N3u+tCRo= -go.uber.org/zap v1.26.0/go.mod h1:dtElttAiwGvoJ/vj4IwHBS/gXsEu/pZ50mUIRWuG0so= +go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= +go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= golang.org/x/crypto v0.0.0-20170613210332-850760c427c5/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= @@ -1286,11 +1268,23 @@ golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= -golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30= -golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M= -golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb h1:xIApU0ow1zwMa2uL1VDNeQlNVFTWMQxZUZCMDy0Q4Us= -golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= +golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw= +golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= +golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= +golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= +golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= +golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= +golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= +golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 h1:yixxcjnhBmY0nkL253HFVIm0JsFHwrHdT3Yh6szTnfY= +golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8/go.mod h1:jj3sYF3dwk5D+ghuXyeI3r5MFf+NT2An6/9dOA95KSI= +golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -1303,18 +1297,20 @@ golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPI golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= +golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI= -golang.org/x/mod v0.11.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= -golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.18.0 h1:5+9lSbEzPSdWkH32vYPBwEpX8KwDbM52Ud9xBUvNlb0= +golang.org/x/mod v0.18.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1376,8 +1372,8 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug golang.org/x/net v0.0.0-20220909164309-bea034e7d591/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.0.0-20221014081412-f15817d10f9b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= -golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w= -golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= +golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= +golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1403,8 +1399,8 @@ golang.org/x/oauth2 v0.0.0-20220822191816-0ebed06d0094/go.mod h1:h4gKUeWbJ4rQPri golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/oauth2 v0.1.0/go.mod h1:G9FE4dLTsbXUu90h/Pf85g4w1D+SSAgR+q46nJZ8M4A= -golang.org/x/oauth2 v0.17.0 h1:6m3ZPmLEFdVxKKWnKq4VqZ60gutO35zm+zrAHVmHyDQ= -golang.org/x/oauth2 v0.17.0/go.mod h1:OzPDGQiuQMguemayvdylqddI7qcD9lnSDb+1FiwQ5HA= +golang.org/x/oauth2 v0.23.0 h1:PbgcYx2W7i4LvjJWEbf0ngHV6qJYr86PkAV3bXdLEbs= +golang.org/x/oauth2 v0.23.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1419,8 +1415,8 @@ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= -golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= +golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1429,20 +1425,19 @@ golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190130150945-aca44879d564/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1490,9 +1485,9 @@ golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210819135213-f52c844e1c1c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210908233432-aa78b53d3365/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -1510,24 +1505,23 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220610221304-9f5ed59c137d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220615213510-4f61da869c0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220624220833-87e55d714810/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o= -golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.19.0 h1:+ThwsDv+tYfnJFhF4L8jITxu1tdTWRTZpdsWgEgjL6Q= -golang.org/x/term v0.19.0/go.mod h1:2CuTdWZ7KHSQwUzKva0cbMg6q2DMI3Mmxp+gKJbskEk= +golang.org/x/term v0.25.0 h1:WtHI/ltw4NvSUig5KARz9h521QvRC8RmF/cuYqifU24= +golang.org/x/term v0.25.0/go.mod h1:RPyXicDX+6vLxogjjRxjgD2TKtmAO6NZBsBRfrOLu7M= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1537,21 +1531,21 @@ golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= -golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= -golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/time v0.6.0 h1:eTDhh4ZXt5Qf0augr54TN6suAUudPcawVZeIAPU7D4U= +golang.org/x/time v0.6.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= @@ -1560,7 +1554,9 @@ golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBn golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= @@ -1576,6 +1572,7 @@ golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapK golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= @@ -1604,9 +1601,8 @@ golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA= -golang.org/x/tools v0.20.0 h1:hz/CVckiOxybQvFw6h7b/q80NTr9IUQb4s1IIzW7KNY= -golang.org/x/tools v0.20.0/go.mod h1:WvitBU7JJf6A4jOdg4S1tviW9bhUxkgeCui/0JHctQg= +golang.org/x/tools v0.22.0 h1:gqSGLZqv+AI9lIQzniJ0nZDRG5GBPsSi+DRNHWNz6yA= +golang.org/x/tools v0.22.0/go.mod h1:aCwcsjqvq7Yqt6TNyX7QMU2enbQ/Gt0bo6krSeEri+c= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -1614,7 +1610,6 @@ golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= -golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk= golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= @@ -1665,8 +1660,8 @@ google.golang.org/api v0.96.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ google.golang.org/api v0.97.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= google.golang.org/api v0.98.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= google.golang.org/api v0.100.0/go.mod h1:ZE3Z2+ZOr87Rx7dqFsdRQkRBk36kDtp/h+QpHbB7a70= -google.golang.org/api v0.162.0 h1:Vhs54HkaEpkMBdgGdOT2P6F0csGG/vxDS0hWHJzmmps= -google.golang.org/api v0.162.0/go.mod h1:6SulDkfoBIg4NFmCuZ39XeeAgSHCPecfSUuDyYlAHs0= +google.golang.org/api v0.192.0 h1:PljqpNAfZaaSpS+TnANfnNAXKdzHM/B9bKhwRlo7JP0= +google.golang.org/api v0.192.0/go.mod h1:9VcphjvAxPKLmSxVSzPlSRXy/5ARMEw5bf58WoVXafQ= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -1675,8 +1670,6 @@ google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM= -google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= @@ -1784,12 +1777,12 @@ google.golang.org/genproto v0.0.0-20221010155953-15ba04fc1c0e/go.mod h1:3526vdqw google.golang.org/genproto v0.0.0-20221014173430-6e2ab493f96b/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM= google.golang.org/genproto v0.0.0-20221014213838-99cd37c6964a/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM= google.golang.org/genproto v0.0.0-20221025140454-527a21cfbd71/go.mod h1:9qHF0xnpdSfF6knlcsnpzUu5y+rpwgbvsyGAZPBMg4s= -google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de h1:F6qOa9AZTYJXOUEr4jDysRDLrm4PHePlge4v4TGAlxY= -google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:VUhTRKeHn9wwcdrk73nvdC9gF178Tzhmt/qyaFcPLSo= -google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de h1:jFNzHPIeuzhdRwVhbZdiym9q0ory/xY3sA+v2wPg8I0= -google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:5iCWqnniDlqZHrd3neWVTOwvh/v6s3232omMecelax8= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240401170217-c3f982113cda h1:LI5DOvAxUPMv/50agcLLoo+AdWc1irS9Rzz4vPuD1V4= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240401170217-c3f982113cda/go.mod h1:WtryC6hu0hhx87FDGxWCDptyssuo68sk10vYjF+T9fY= +google.golang.org/genproto v0.0.0-20240814211410-ddb44dafa142 h1:oLiyxGgE+rt22duwci1+TG7bg2/L1LQsXwfjPlmuJA0= +google.golang.org/genproto v0.0.0-20240814211410-ddb44dafa142/go.mod h1:G11eXq53iI5Q+kyNOmCvnzBaxEA2Q/Ik5Tj7nqBE8j4= +google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 h1:wKguEg1hsxI2/L3hUYrpo1RVi48K+uTyzKqprwLXsb8= +google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142/go.mod h1:d6be+8HhtEtucleCbxpPW9PA9XwISACu8nvpPqF0BVo= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f h1:cUMEy+8oS78BWIH9OWazBkzbr090Od9tWBNtZHkOhf0= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= @@ -1831,8 +1824,8 @@ google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACu google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.63.2 h1:MUeiw1B2maTVZthpU5xvASfTh3LDbxHd6IJ6QQVU+xM= -google.golang.org/grpc v1.63.2/go.mod h1:WAX/8DgncnokcFUldAxq7GeB5DXHDbMF+lLvDomNkRA= +google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E= +google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= @@ -1849,8 +1842,8 @@ google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= -google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= +google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -1885,7 +1878,6 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= gotest.tools/v3 v3.5.1 h1:EENdUnS3pdur5nybKYIh2Vfgc8IUNBjxDPSjtiJcOzU= gotest.tools/v3 v3.5.1/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU= honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= @@ -1898,8 +1890,8 @@ honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9 honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= launchpad.net/gocheck v0.0.0-20140225173054-000000000087 h1:Izowp2XBH6Ya6rv+hqbceQyw/gSGoXfH/UPoTGduL54= launchpad.net/gocheck v0.0.0-20140225173054-000000000087/go.mod h1:hj7XX3B/0A+80Vse0e+BUHsHMTEhd0O4cpUHr/e/BUM= -lukechampine.com/blake3 v1.1.7 h1:GgRMhmdsuK8+ii6UZFDL8Nb+VyMwadAgcJyfYHxG6n0= -lukechampine.com/blake3 v1.1.7/go.mod h1:tkKEOtDkNtklkXtLNEOGNq5tcV90tJiA1vAA12R78LA= +lukechampine.com/blake3 v1.2.1 h1:YuqqRuaqsGV71BV/nm9xlI0MKUv4QC54jQnBChWbGnI= +lukechampine.com/blake3 v1.2.1/go.mod h1:0OFRp7fBtAylGVCO40o87sbupkyIGgbpv1+M1k1LM6k= lukechampine.com/uint128 v1.2.0 h1:mBi/5l91vocEN8otkC5bDLhi2KdCticRiwbdB0O+rjI= lukechampine.com/uint128 v1.2.0/go.mod h1:c4eWIwlEGaxC/+H1VguhU4PHXNWDCDMUlWdIWl2j1gk= modernc.org/cc/v3 v3.40.0 h1:P3g79IUS/93SYhtoeaHW+kRCIrYaxJ27MFPv+7kaTOw= @@ -1910,16 +1902,16 @@ modernc.org/ccorpus v1.11.6 h1:J16RXiiqiCgua6+ZvQot4yUuUy8zxgqbqEEUuGPlISk= modernc.org/ccorpus v1.11.6/go.mod h1:2gEUTrWqdpH2pXsmTM1ZkjeSrUWDpjMu2T6m29L/ErQ= modernc.org/httpfs v1.0.6 h1:AAgIpFZRXuYnkjftxTAZwMIiwEqAfk8aVB2/oA6nAeM= modernc.org/httpfs v1.0.6/go.mod h1:7dosgurJGp0sPaRanU53W4xZYKh14wfzX420oZADeHM= -modernc.org/libc v1.24.1 h1:uvJSeCKL/AgzBo2yYIPPTy82v21KgGnizcGYfBHaNuM= -modernc.org/libc v1.24.1/go.mod h1:FmfO1RLrU3MHJfyi9eYYmZBfi/R+tqZ6+hQ3yQQUkak= -modernc.org/mathutil v1.5.0 h1:rV0Ko/6SfM+8G+yKiyI830l3Wuz1zRutdslNoQ0kfiQ= -modernc.org/mathutil v1.5.0/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E= -modernc.org/memory v1.6.0 h1:i6mzavxrE9a30whzMfwf7XWVODx2r5OYXvU46cirX7o= -modernc.org/memory v1.6.0/go.mod h1:PkUhL0Mugw21sHPeskwZW4D6VscE/GQJOnIpCnW6pSU= +modernc.org/libc v1.29.0 h1:tTFRFq69YKCF2QyGNuRUQxKBm1uZZLubf6Cjh/pVHXs= +modernc.org/libc v1.29.0/go.mod h1:DaG/4Q3LRRdqpiLyP0C2m1B8ZMGkQ+cCgOIjEtQlYhQ= +modernc.org/mathutil v1.6.0 h1:fRe9+AmYlaej+64JsEEhoWuAYBkOtQiMEU7n/XgfYi4= +modernc.org/mathutil v1.6.0/go.mod h1:Ui5Q9q1TR2gFm0AQRqQUaBWFLAhQpCwNcuhBOSedWPo= +modernc.org/memory v1.7.2 h1:Klh90S215mmH8c9gO98QxQFsY+W451E8AnzjoE2ee1E= +modernc.org/memory v1.7.2/go.mod h1:NO4NVCQy0N7ln+T9ngWqOQfi7ley4vpwvARR+Hjw95E= modernc.org/opt v0.1.3 h1:3XOZf2yznlhC+ibLltsDGzABUGVx8J6pnFMS3E4dcq4= modernc.org/opt v0.1.3/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0= -modernc.org/sqlite v1.25.0 h1:AFweiwPNd/b3BoKnBOfFm+Y260guGMF+0UFk0savqeA= -modernc.org/sqlite v1.25.0/go.mod h1:FL3pVXie73rg3Rii6V/u5BoHlSoyeZeIgKZEgHARyCU= +modernc.org/sqlite v1.28.0 h1:Zx+LyDDmXczNnEQdvPuEfcFVA2ZPyaD7UCZDjef3BHQ= +modernc.org/sqlite v1.28.0/go.mod h1:Qxpazz0zH8Z1xCFyi5GSL3FzbtZ3fvbjmywNogldEW0= modernc.org/strutil v1.1.3 h1:fNMm+oJklMGYfU9Ylcywl0CO5O6nTfaowNsh2wpPjzY= modernc.org/strutil v1.1.3/go.mod h1:MEHNA7PdEnEwLvspRMtWTNnp2nnyvMfkimT1NKNAGbw= modernc.org/tcl v1.15.2 h1:C4ybAYCGJw968e+Me18oW55kD/FexcHbqH2xak1ROSY= @@ -1929,8 +1921,8 @@ modernc.org/token v1.0.1/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM= modernc.org/z v1.7.3 h1:zDJf6iHjrnB+WRD88stbXokugjyc0/pB91ri1gO6LZY= modernc.org/z v1.7.3/go.mod h1:Ipv4tsdxZRbQyLq9Q1M6gdbkxYzdlrciF2Hi/lS7nWE= nhooyr.io/websocket v1.8.6/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0= -nhooyr.io/websocket v1.8.7 h1:usjR2uOr/zjjkVMy0lW+PPohFok7PCow5sDjLgX4P4g= -nhooyr.io/websocket v1.8.7/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0= +nhooyr.io/websocket v1.8.10 h1:mv4p+MnGrLDcPlBoWsvPP7XCzTYMXP9F9eIGoKbgx7Q= +nhooyr.io/websocket v1.8.10/go.mod h1:rN9OFWIUwuxg4fR5tELlYC04bXYowCP9GX47ivo2l+c= pgregory.net/rapid v1.1.0 h1:CMa0sjHSru3puNx+J0MIAuiiEV4N0qj8/cMWGBBCsjw= pgregory.net/rapid v1.1.0/go.mod h1:PY5XlDGj0+V1FCq0o192FdRhpKHGTRIWBgqjDBTrq04= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= diff --git a/tests/e2e-ibc/main_test.go b/tests/e2e-ibc/main_test.go index 8d24769a36..92b702ac52 100644 --- a/tests/e2e-ibc/main_test.go +++ b/tests/e2e-ibc/main_test.go @@ -3,18 +3,18 @@ package main_test import ( "context" "fmt" + "github.com/strangelove-ventures/interchaintest/v8" "testing" "time" "cosmossdk.io/math" - transfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" + transfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/ethclient" - "github.com/strangelove-ventures/interchaintest/v7" - "github.com/strangelove-ventures/interchaintest/v7/chain/cosmos" - "github.com/strangelove-ventures/interchaintest/v7/ibc" - "github.com/strangelove-ventures/interchaintest/v7/testreporter" + "github.com/strangelove-ventures/interchaintest/v8/chain/cosmos" + "github.com/strangelove-ventures/interchaintest/v8/ibc" + "github.com/strangelove-ventures/interchaintest/v8/testreporter" "github.com/stretchr/testify/require" "go.uber.org/zap/zaptest" @@ -190,7 +190,8 @@ func TestInterchainIBC(t *testing.T) { }) t.Run("query evm data", func(t *testing.T) { - evmUrl, err := kava.FullNodes[0].GetHostAddress(ctx, "8545/tcp") + //evmUrl, err := kava.FullNodes[0].GetHostAddress(ctx, "8545/tcp") + evmUrl := kava.FullNodes[0].HostName() + ":8545" require.NoError(t, err) evmClient, err := ethclient.Dial(evmUrl) diff --git a/tests/e2e/e2e_community_update_params_test.go b/tests/e2e/e2e_community_update_params_test.go index 59fe0ccb0f..c02a0c388c 100644 --- a/tests/e2e/e2e_community_update_params_test.go +++ b/tests/e2e/e2e_community_update_params_test.go @@ -66,11 +66,14 @@ func (suite *IntegrationTestSuite) TestCommunityUpdateParams_Authority() { // setup kava account // .1 KAVA + min deposit amount for proposal - funds := sdk.NewCoins(ukava(1e5)).Add(govParamsRes.DepositParams.MinDeposit...) + //funds := sdk.NewCoins(ukava(1e5)).Add(govParamsRes.DepositParams.MinDeposit...) + funds := sdk.NewCoins(ukava(1e6)).Add(govParamsRes.DepositParams.MinDeposit...) kavaAcc := suite.Kava.NewFundedAccount("community-update-params", funds) - gasLimit := int64(2e5) - fee := ukava(200) + //gasLimit := int64(2e5) + gasLimit := int64(3e5) + //fee := ukava(200) + fee := ukava(300) // Wait until switchover actually happens - When testing without the upgrade // handler that sets a relative switchover time, the switchover time in @@ -121,6 +124,8 @@ func (suite *IntegrationTestSuite) TestCommunityUpdateParams_Authority() { "community-update-params", "title", "summary", + // TODO(boodyvo): add expidited test when turned on + false, ) suite.NoError(err) @@ -130,6 +135,7 @@ func (suite *IntegrationTestSuite) TestCommunityUpdateParams_Authority() { FeeAmount: sdk.NewCoins(fee), Memo: "this is a proposal please accept me", } + res := kavaAcc.SignAndBroadcastKavaTx(req) suite.Require().NoError(res.Err) diff --git a/tests/e2e/e2e_convert_cosmos_coins_test.go b/tests/e2e/e2e_convert_cosmos_coins_test.go index aca921407a..3b6c29e177 100644 --- a/tests/e2e/e2e_convert_cosmos_coins_test.go +++ b/tests/e2e/e2e_convert_cosmos_coins_test.go @@ -2,6 +2,7 @@ package e2e_test import ( "context" + sdkmath "cosmossdk.io/math" "fmt" "math/big" "time" @@ -64,9 +65,10 @@ func (suite *IntegrationTestSuite) setupAccountWithCosmosCoinERC20Balance( convertAmount, ) tx := util.KavaMsgRequest{ - Msgs: []sdk.Msg{&msg}, - GasLimit: 4e5, - FeeAmount: sdk.NewCoins(ukava(400)), + Msgs: []sdk.Msg{&msg}, + GasLimit: 10e6, + //FeeAmount: sdk.NewCoins(ukava(400)), + FeeAmount: sdk.NewCoins(ukava(10000)), Data: "converting sdk coin to erc20", } res := user.SignAndBroadcastKavaTx(tx) @@ -426,7 +428,7 @@ func (suite *IntegrationTestSuite) TestConvertCosmosCoins_ERC20Magic() { suite.BigIntsEqual(big.NewInt(0), erc20Balance, "expected no erc20 balance for bob") // bob should have sdk balance balance := suite.Kava.QuerySdkForBalances(bob.SdkAddress).AmountOf(denom) - suite.Equal(sdk.NewIntFromBigInt(amount), balance) + suite.Equal(sdkmath.NewIntFromBigInt(amount), balance) // alice should have the remaining balance erc20Balance = suite.Kava.GetErc20Balance(contractAddress.Address, alice.EvmAddress) diff --git a/tests/e2e/e2e_evm_contracts_test.go b/tests/e2e/e2e_evm_contracts_test.go index 404891a1c3..f2143134af 100644 --- a/tests/e2e/e2e_evm_contracts_test.go +++ b/tests/e2e/e2e_evm_contracts_test.go @@ -2,6 +2,8 @@ package e2e_test import ( "context" + sdkmath "cosmossdk.io/math" + "fmt" "math/big" "time" @@ -94,7 +96,8 @@ func (suite *IntegrationTestSuite) TestEip712BasicMessageAuthorization() { suite.NoError(err) suite.Equal(sdkerrors.SuccessABCICode, res.TxResponse.Code) - _, err = util.WaitForSdkTxCommit(suite.Kava.Grpc.Query.Tx, res.TxResponse.TxHash, 6*time.Second) + //_, err = util.WaitForSdkTxCommit(suite.Kava.Grpc.Query.Tx, res.TxResponse.TxHash, 6*time.Second) + _, err = util.WaitForSdkTxCommit(suite.Kava.Grpc.Query.Tx, res.TxResponse.TxHash, 20*time.Second) suite.NoError(err) // check that the message was processed & the kava is transferred. @@ -103,15 +106,15 @@ func (suite *IntegrationTestSuite) TestEip712BasicMessageAuthorization() { Denom: "ukava", }) suite.NoError(err) - suite.Equal(sdk.NewInt(1e3), balRes.Balance.Amount) + suite.Equal(sdkmath.NewInt(1e3), balRes.Balance.Amount) } // Note that this test works because the deployed erc20 is configured in evmutil & cdp params. // This test matches the webapp's "USDT Earn" workflow func (suite *IntegrationTestSuite) TestEip712ConvertToCoinAndDepositToLend() { // cdp requires minimum of $11 collateral - amount := sdk.NewInt(11e6) // 11 USDT - principal := sdk.NewCoin("usdx", sdk.NewInt(10e6)) + amount := sdkmath.NewInt(11e6) // 11 USDT + principal := sdk.NewCoin("usdx", sdkmath.NewInt(10e6)) sdkDenom := suite.DeployedErc20.CosmosDenom // create new funded account @@ -150,15 +153,20 @@ func (suite *IntegrationTestSuite) TestEip712ConvertToCoinAndDepositToLend() { "doing the USDT Earn workflow! erc20 -> sdk.Coin -> USDX hard deposit", ).GetTx() + fmt.Println("tx", tx) + txBytes, err := suite.Kava.EncodingConfig.TxConfig.TxEncoder()(tx) suite.NoError(err) + fmt.Println("txBytes", string(txBytes)) + // broadcast tx res, err := suite.Kava.Grpc.Query.Tx.BroadcastTx(context.Background(), &txtypes.BroadcastTxRequest{ TxBytes: txBytes, Mode: txtypes.BroadcastMode_BROADCAST_MODE_SYNC, }) suite.NoError(err) + fmt.Println("res", res) suite.Equal(sdkerrors.SuccessABCICode, res.TxResponse.Code) _, err = util.WaitForSdkTxCommit(suite.Kava.Grpc.Query.Tx, res.TxResponse.TxHash, 6*time.Second) diff --git a/tests/e2e/e2e_min_fees_test.go b/tests/e2e/e2e_min_fees_test.go index 0ff51ce8a2..de198baf2a 100644 --- a/tests/e2e/e2e_min_fees_test.go +++ b/tests/e2e/e2e_min_fees_test.go @@ -2,6 +2,7 @@ package e2e_test import ( "context" + sdkmath "cosmossdk.io/math" "math/big" "os" "path/filepath" @@ -46,7 +47,7 @@ func (suite *IntegrationTestSuite) TestEvmRespectsMinFee() { minGasPrice := minFees.AmountOf("akava").TruncateInt() // attempt tx with less than min gas price (min fee - 1) - tooLowGasPrice := minGasPrice.Sub(sdk.OneInt()).BigInt() + tooLowGasPrice := minGasPrice.Sub(sdkmath.OneInt()).BigInt() req := util.EvmTxRequest{ Tx: ethtypes.NewTransaction(0, randoReceiver, big.NewInt(5e2), 1e5, tooLowGasPrice, nil), Data: "this tx should fail because it's gas price is too low", diff --git a/tests/e2e/e2e_precompile_genesis_test.go b/tests/e2e/e2e_precompile_genesis_test.go index 6f3f595459..8d03dd7df0 100644 --- a/tests/e2e/e2e_precompile_genesis_test.go +++ b/tests/e2e/e2e_precompile_genesis_test.go @@ -2,6 +2,7 @@ package e2e_test import ( "context" + "fmt" "math/big" sdk "github.com/cosmos/cosmos-sdk/types" @@ -77,6 +78,8 @@ func (suite *IntegrationTestSuite) TestPrecompileGenesis() { suite.Run(tc.name, func() { tf := tc.genFixture() + fmt.Println("tf", tf) + // // Addresses // @@ -97,6 +100,8 @@ func (suite *IntegrationTestSuite) TestPrecompileGenesis() { evmParamsResp, err := suite.Kava.Grpc.Query.Evm.Params(grpcGenesisContext, &evmtypes.QueryParamsRequest{}) suite.Require().NoError(err) + fmt.Println("evmParamsResp", evmParamsResp.Params) + // accountErr is checked during in the assertions below if tf.expectIsEthAccount is true // This is due to the service returning a not found error for address that are not enabled, // which can be ignored when we do not expect an eth account to exist. @@ -119,6 +124,10 @@ func (suite *IntegrationTestSuite) TestPrecompileGenesis() { nonce, err := suite.Kava.EvmClient.NonceAt(context.Background(), evmAddress, genesisHeight) suite.Require().NoError(err) + fmt.Println("nonce", nonce) + + // evmParamsResp params: eip712_allowed_msgs: value_types: value_types: value_types: > eip712_allowed_msgs: value_types: value_types: > eip712_allowed_msgs: value_types: value_types: > eip712_allowed_msgs: value_types: value_types: > eip712_allowed_msgs: value_types: value_types: > eip712_allowed_msgs: value_types: value_types: > eip712_allowed_msgs: value_types: value_types: value_types: > eip712_allowed_msgs: value_types: > eip712_allowed_msgs: value_types: nested_types: attrs: > > eip712_allowed_msgs: value_types: nested_types: attrs: > > eip712_allowed_msgs: value_types: nested_types: attrs: > > eip712_allowed_msgs: value_types: nested_types: attrs: > > eip712_allowed_msgs: value_types: nested_types: attrs: > > eip712_allowed_msgs: value_types: value_types: > eip712_allowed_msgs: value_types: value_types: > eip712_allowed_msgs: value_types: value_types: > eip712_allowed_msgs: value_types: value_types: > eip712_allowed_msgs: value_types: value_types: > eip712_allowed_msgs: value_types: value_types: > eip712_allowed_msgs: value_types: value_types: > eip712_allowed_msgs: value_types: value_types: > eip712_allowed_msgs: value_types: > eip712_allowed_msgs: value_types: > eip712_allowed_msgs: value_types: value_types: > eip712_allowed_msgs: value_types: value_types: > eip712_allowed_msgs: value_types: > eip712_allowed_msgs: value_types: value_types: value_types: value_types: value_types: value_types: value_types: nested_types: attrs: > > eip712_allowed_msgs: value_types: value_types: value_types: > eip712_allowed_msgs: value_types: value_types: value_types: > eip712_allowed_msgs: value_types: value_types: value_types: > eip712_allowed_msgs: value_types: value_types: > eip712_allowed_msgs: value_types: value_types: > > + // // Assertions // @@ -157,6 +166,9 @@ func (suite *IntegrationTestSuite) TestPrecompileGenesis() { suite.Equal(tf.expectNonce, ethAccount.GetSequence()) } + fmt.Println("tf.expectCode", tf.expectCode) + fmt.Println("rpcCode", rpcCode) + fmt.Println("tf.address", tf.address) // We assert both methods of code retrieval report the same value suite.Equalf(tf.expectCode, rpcCode, "expected code for address %s to match expected", tf.address) // The GRPC endpoint returns []byte(nil) when the code is not in state, which is different from diff --git a/tests/e2e/e2e_test.go b/tests/e2e/e2e_test.go index 63e63c467b..495ee8c3d5 100644 --- a/tests/e2e/e2e_test.go +++ b/tests/e2e/e2e_test.go @@ -2,6 +2,7 @@ package e2e_test import ( "context" + "fmt" "math/big" "strings" "testing" @@ -10,11 +11,11 @@ import ( "github.com/stretchr/testify/suite" sdkmath "cosmossdk.io/math" - "github.com/cosmos/cosmos-sdk/client/grpc/tmservice" + tmservice "github.com/cosmos/cosmos-sdk/client/grpc/cmtservice" sdk "github.com/cosmos/cosmos-sdk/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - ibctypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" - ibcclienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" + ibctypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" + ibcclienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" ethtypes "github.com/ethereum/go-ethereum/core/types" emtypes "github.com/evmos/ethermint/types" @@ -120,6 +121,7 @@ func (suite *IntegrationTestSuite) TestIbcTransfer() { // ARRANGE // setup kava account funds := ukava(1e5) // .1 KAVA + fmt.Println("funds", funds) kavaAcc := suite.Kava.NewFundedAccount("ibc-transfer-kava-side", sdk.NewCoins(funds)) // setup ibc account ibcAcc := suite.Ibc.NewFundedAccount("ibc-transfer-ibc-side", sdk.NewCoins()) @@ -139,7 +141,14 @@ func (suite *IntegrationTestSuite) TestIbcTransfer() { "", ) // initial - sent - fee + fmt.Println("fundsToSend", fundsToSend) expectedSrcBalance := funds.Sub(fundsToSend).Sub(fee) + fmt.Println("expectedSrcBalance", expectedSrcBalance) + + fmt.Println("transferMsg", transferMsg) + fmt.Println("validate basic", transferMsg.ValidateBasic()) + fmt.Println("gasLimit", gasLimit) + fmt.Println("fee", fee) // ACT // IBC transfer from kava -> ibc @@ -149,7 +158,9 @@ func (suite *IntegrationTestSuite) TestIbcTransfer() { FeeAmount: sdk.NewCoins(fee), Memo: "sent from Kava!", } + fmt.Println("transferTo", transferTo) res := kavaAcc.SignAndBroadcastKavaTx(transferTo) + fmt.Println(res) // ASSERT suite.NoError(res.Err) @@ -157,12 +168,14 @@ func (suite *IntegrationTestSuite) TestIbcTransfer() { // the balance should be deducted from kava account suite.Eventually(func() bool { balance := suite.Kava.QuerySdkForBalances(kavaAcc.SdkAddress) + fmt.Println("checking balance: ", balance) return balance.AmountOf("ukava").Equal(expectedSrcBalance.Amount) }, 10*time.Second, 1*time.Second) // expect the balance to be transferred to the ibc chain! suite.Eventually(func() bool { balance := suite.Ibc.QuerySdkForBalances(ibcAcc.SdkAddress) + fmt.Println("checking balance 2: ", balance) found := false for _, c := range balance { // find the ibc denom coin diff --git a/tests/e2e/runner/kvtool.go b/tests/e2e/runner/kvtool.go index 087e752789..596752e622 100644 --- a/tests/e2e/runner/kvtool.go +++ b/tests/e2e/runner/kvtool.go @@ -68,12 +68,18 @@ func (k *KvtoolRunner) StartChains() Chains { // start the chain startKavaCmd := exec.Command("kvtool", kvtoolArgs...) startKavaCmd.Env = os.Environ() - startKavaCmd.Env = append(startKavaCmd.Env, fmt.Sprintf("KAVA_TAG=%s", k.config.ImageTag)) + //startKavaCmd.Env = append(startKavaCmd.Env, fmt.Sprintf("KAVA_TAG=%s", k.config.ImageTag)) + startKavaCmd.Env = append(startKavaCmd.Env, fmt.Sprintf("KAVA_TAG=local")) + fmt.Println("going to run cmd with image tag", k.config.ImageTag) + fmt.Println("going to run cmd with env", startKavaCmd.Env) + fmt.Println("going to run cmd", startKavaCmd.String()) startKavaCmd.Stdout = os.Stdout startKavaCmd.Stderr = os.Stderr log.Println(startKavaCmd.String()) + fmt.Println("going to run cmd", startKavaCmd.String()) if err := startKavaCmd.Run(); err != nil { - panic(fmt.Sprintf("failed to start kava: %s", err.Error())) + //panic(fmt.Sprintf("failed to start kava: %s", err.Error())) + fmt.Printf("failed to start kava: %s\n", err.Error()) } // wait for chain to be live. @@ -105,7 +111,7 @@ func (k *KvtoolRunner) Shutdown() { shutdownKavaCmd := exec.Command("kvtool", "testnet", "down") shutdownKavaCmd.Stdout = os.Stdout shutdownKavaCmd.Stderr = os.Stderr - if err := shutdownKavaCmd.Run(); err != nil { - panic(fmt.Sprintf("failed to shutdown kvtool: %s", err.Error())) - } + //if err := shutdownKavaCmd.Run(); err != nil { + // panic(fmt.Sprintf("failed to shutdown kvtool: %s", err.Error())) + //} } diff --git a/tests/e2e/runner/live.go b/tests/e2e/runner/live.go index ecefd7310f..952f26a928 100644 --- a/tests/e2e/runner/live.go +++ b/tests/e2e/runner/live.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - "github.com/cosmos/cosmos-sdk/client/grpc/tmservice" + tmservice "github.com/cosmos/cosmos-sdk/client/grpc/cmtservice" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/kava-labs/kava/client/grpc" diff --git a/tests/e2e/runner/main.go b/tests/e2e/runner/main.go index ddb93192c0..d28b440f05 100644 --- a/tests/e2e/runner/main.go +++ b/tests/e2e/runner/main.go @@ -18,6 +18,7 @@ type NodeRunner interface { // waitForChainStart sets a timeout and repeatedly pings the chains. // If the chain is successfully reached before the timeout, this returns no error. func waitForChainStart(chainDetails ChainDetails) error { + fmt.Println("waiting for chain to start...") // exponential backoff on trying to ping the node, timeout after 30 seconds b := backoff.NewExponentialBackOff() b.MaxInterval = 5 * time.Second @@ -31,6 +32,8 @@ func waitForChainStart(chainDetails ChainDetails) error { if err := backoff.Retry(func() error { return pingEvm(chainDetails.EvmRpcUrl) }, b); err != nil { return fmt.Errorf("failed connect to chain: %s", err) } + + fmt.Println("chain is live!") return nil } diff --git a/tests/e2e/testutil/account.go b/tests/e2e/testutil/account.go index eebca6300a..845b61c1b6 100644 --- a/tests/e2e/testutil/account.go +++ b/tests/e2e/testutil/account.go @@ -4,6 +4,7 @@ import ( "context" "encoding/hex" "fmt" + "github.com/cosmos/cosmos-sdk/types/tx/signing" "log" "math/big" "os" @@ -208,7 +209,7 @@ func (a *SigningAccount) SignAndBroadcastEvmTx(req util.EvmTxRequest) EvmTxRespo // It does not broadcast the signed data. func (a *SigningAccount) SignRawEvmData(msg []byte) ([]byte, cryptotypes.PubKey, error) { keyringSigner := emtests.NewSigner(a.evmPrivKey) - return keyringSigner.SignByAddress(a.SdkAddress, msg) + return keyringSigner.SignByAddress(a.SdkAddress, msg, signing.SignMode_SIGN_MODE_DIRECT) } // NewFundedAccount creates a SigningAccount for a random account & funds the account from the whale. @@ -256,9 +257,10 @@ func (a *SigningAccount) NextNonce() (uint64, error) { func (a *SigningAccount) BankSend(to sdk.AccAddress, amount sdk.Coins) util.KavaMsgResponse { return a.SignAndBroadcastKavaTx( util.KavaMsgRequest{ - Msgs: []sdk.Msg{banktypes.NewMsgSend(a.SdkAddress, to, amount)}, - GasLimit: 2e5, // 200,000 gas - FeeAmount: sdk.NewCoins(sdk.NewCoin(a.gasDenom, sdkmath.NewInt(200))), // assume min gas price of .001ukava + Msgs: []sdk.Msg{banktypes.NewMsgSend(a.SdkAddress, to, amount)}, + GasLimit: 2e5, // 200,000 gas + //FeeAmount: sdk.NewCoins(sdk.NewCoin(a.gasDenom, sdkmath.NewInt(200))), // assume min gas price of .001ukava + FeeAmount: sdk.NewCoins(sdk.NewCoin(a.gasDenom, sdkmath.NewInt(20000000))), // assume min gas price of .001ukava Data: fmt.Sprintf("sending %s to %s", amount, to), }, ) diff --git a/tests/e2e/testutil/chain.go b/tests/e2e/testutil/chain.go index c0586070ae..4e90e43d8b 100644 --- a/tests/e2e/testutil/chain.go +++ b/tests/e2e/testutil/chain.go @@ -2,7 +2,9 @@ package testutil import ( "context" + "cosmossdk.io/log" "fmt" + dbm "github.com/cosmos/cosmos-db" "math/big" "testing" @@ -60,6 +62,15 @@ func NewChain(t *testing.T, details *runner.ChainDetails, fundedAccountMnemonic erc20s: make(map[common.Address]struct{}), } chain.EncodingConfig = app.MakeEncodingConfig() + // we need to register necessary codec for encoding config + _ = app.NewApp( + log.NewNopLogger(), + dbm.NewMemDB(), + app.DefaultNodeHome, + nil, + chain.EncodingConfig, + app.DefaultOptions, + ) // setup keyring kr, err := keyring.New( @@ -75,6 +86,7 @@ func NewChain(t *testing.T, details *runner.ChainDetails, fundedAccountMnemonic } chain.Keyring = kr + fmt.Println("going to start new chain", details) client, err := grpc.NewClient(details.GrpcUrl) if err != nil { chain.t.Fatalf("failed to create kava grpc client: %s", err) @@ -249,8 +261,15 @@ func (chain *Chain) GetBeginBlockEvents(ctx context.Context, height int64) (sdk. // Do not use sdk.StringifyEvents as it flattens events which makes it // more difficult to parse. - strEvents := make(sdk.StringEvents, 0, len(res.BeginBlockEvents)) - for _, e := range res.BeginBlockEvents { + + // TODO(boodyvo): identify what should be done here, as BeginBlockEvents are not publically exposed, so necessary to check what is the logic + + //strEvents := make(sdk.StringEvents, 0, len(res.BeginBlockEvents)) + //for _, e := range res.BeginBlockEvents { + // strEvents = append(strEvents, sdk.StringifyEvent(e)) + //} + strEvents := make(sdk.StringEvents, 0, len(res.FinalizeBlockEvents)) + for _, e := range res.FinalizeBlockEvents { strEvents = append(strEvents, sdk.StringifyEvent(e)) } diff --git a/tests/e2e/testutil/eip712.go b/tests/e2e/testutil/eip712.go index f26ddf57f0..95169f4c40 100644 --- a/tests/e2e/testutil/eip712.go +++ b/tests/e2e/testutil/eip712.go @@ -2,7 +2,6 @@ package testutil import ( "context" - "github.com/cosmos/cosmos-sdk/client" codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -22,7 +21,7 @@ func (suite *E2eTestSuite) NewEip712TxBuilder( acc *SigningAccount, chain *Chain, gas uint64, gasAmount sdk.Coins, msgs []sdk.Msg, memo string, ) client.TxBuilder { // get account details - var accDetails authtypes.AccountI + var accDetails sdk.AccountI a, err := chain.Grpc.Query.Auth.Account(context.Background(), &authtypes.QueryAccountRequest{ Address: acc.SdkAddress.String(), }) @@ -54,8 +53,8 @@ func (suite *E2eTestSuite) NewEip712TxBuilder( fee, msgs, memo, - nil, ) + // -- typed data typedData, err := eip712.WrapTxToTypedData(ethChainId, msgs, untypedData, &eip712.FeeDelegationOptions{ FeePayer: acc.SdkAddress, diff --git a/tests/e2e/testutil/suite.go b/tests/e2e/testutil/suite.go index 1316f34543..23e7108bfc 100644 --- a/tests/e2e/testutil/suite.go +++ b/tests/e2e/testutil/suite.go @@ -111,9 +111,12 @@ func (suite *E2eTestSuite) SetupSuite() { suite.T().Fatalf("failed to create kava chain querier: %s", err) } + fmt.Println("checking is IBC tests are enabled") if suiteConfig.IncludeIbcTests { + fmt.Println("setting up ibc chain") ibcchain := chains.MustGetChain("ibc") suite.Ibc, err = NewChain(suite.T(), ibcchain, suiteConfig.FundedAccountMnemonic) + fmt.Println("ibc chain setup", err) if err != nil { suite.runner.Shutdown() suite.T().Fatalf("failed to create ibc chain querier: %s", err) diff --git a/tests/util/events.go b/tests/util/events.go index 2d4ce6115a..4ba38cff9d 100644 --- a/tests/util/events.go +++ b/tests/util/events.go @@ -17,15 +17,16 @@ func FilterEventsByType(events []abci.Event, eventType string) []abci.Event { return filteredEvents } +// TODO(boodyvo): is not used? // FilterTxEventsByType returns a slice of events that match the given type // from any and all txs in a slice of ResponseDeliverTx. -func FilterTxEventsByType(txs []*abci.ResponseDeliverTx, eventType string) []abci.Event { - filteredEvents := []abci.Event{} - - for _, tx := range txs { - events := FilterEventsByType(tx.Events, eventType) - filteredEvents = append(filteredEvents, events...) - } - - return filteredEvents -} +//func FilterTxEventsByType(txs []*abci.ResponseDeliverTx, eventType string) []abci.Event { +// filteredEvents := []abci.Event{} +// +// for _, tx := range txs { +// events := FilterEventsByType(tx.Events, eventType) +// filteredEvents = append(filteredEvents, events...) +// } +// +// return filteredEvents +//} diff --git a/tests/util/kvtool.go b/tests/util/kvtool.go index 8a0429aff6..ee972f3a4e 100644 --- a/tests/util/kvtool.go +++ b/tests/util/kvtool.go @@ -7,5 +7,5 @@ import ( // KavaHomePath returns the OS-specific filepath for the kava home directory // Assumes network is running with kvtool installed from the sub-repository in tests/e2e/kvtool func KavaHomePath() string { - return filepath.Join("kvtool", "full_configs", "generated", "kava", "initstate", ".kava") + return filepath.Join("/Users/vlad/dev/go/kvtool", "full_configs", "generated", "kava", "initstate", ".kava") } diff --git a/tests/util/sdksigner.go b/tests/util/sdksigner.go index 9fdc59efe2..7047a9ed6b 100644 --- a/tests/util/sdksigner.go +++ b/tests/util/sdksigner.go @@ -11,6 +11,7 @@ import ( grpcstatus "google.golang.org/grpc/status" errorsmod "cosmossdk.io/errors" + //"cosmossdk.io/x/tx/signing" tmmempool "github.com/cometbft/cometbft/mempool" sdkclient "github.com/cosmos/cosmos-sdk/client" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" @@ -83,8 +84,8 @@ func NewKavaSigner( } } -func (s *KavaSigner) pollAccountState() <-chan authtypes.AccountI { - accountState := make(chan authtypes.AccountI) +func (s *KavaSigner) pollAccountState() <-chan sdk.AccountI { + accountState := make(chan sdk.AccountI) go func() { for { @@ -94,7 +95,7 @@ func (s *KavaSigner) pollAccountState() <-chan authtypes.AccountI { response, err := s.authClient.Account(context.Background(), &request) if err == nil { - var account authtypes.AccountI + var account sdk.AccountI err = s.encodingConfig.InterfaceRegistry.UnpackAny(response.Account, &account) if err == nil { @@ -239,6 +240,8 @@ func (s *KavaSigner) Run(requests <-chan KavaMsgRequest) (<-chan KavaMsgResponse continue } + fmt.Println("going to build transaction", currentRequest) + fmt.Println("going to build transaction with gas limit", currentRequest.GasLimit) txBuilder := s.encodingConfig.TxConfig.NewTxBuilder() txBuilder.SetMsgs(currentRequest.Msgs...) txBuilder.SetGasLimit(currentRequest.GasLimit) @@ -400,10 +403,23 @@ func Sign( return txBuilder.GetTx(), nil, err } - signBytes, err := txConfig.SignModeHandler().GetSignBytes(signing.SignMode_SIGN_MODE_DIRECT, signerData, txBuilder.GetTx()) + signBytes, err := authsigning.GetSignBytesAdapter( + context.Background(), txConfig.SignModeHandler(), signing.SignMode_SIGN_MODE_DIRECT, signerData, txBuilder.GetTx()) if err != nil { return txBuilder.GetTx(), nil, err } + + // ctx context.Context, signMode signingv1beta1.SignMode, signerData SignerData, txData TxData + // TEXTTUAL will use context for formatting the sign bytes, other just ignore context + //signBytes, err := txConfig.SignModeHandler().GetSignBytes( + // context.Background(), + // signingv1beta1.SignMode(signing.SignMode_SIGN_MODE_DIRECT), + // signerData, + // txBuilder.GetTx(), + //) + //if err != nil { + // return txBuilder.GetTx(), nil, err + //} signature, err := privKey.Sign(signBytes) if err != nil { return txBuilder.GetTx(), nil, err @@ -445,6 +461,8 @@ func WaitForSdkTxCommit(txClient txtypes.ServiceClient, txHash string, timeout t err = ErrSdkBroadcastTimeout default: res, err = txClient.GetTx(context.Background(), &txtypes.GetTxRequest{Hash: txHash}) + fmt.Println("WaitForSdkTxCommit res", res) + fmt.Println("WaitForSdkTxCommit err", err) if err != nil { status, ok := grpcstatus.FromError(err) if ok && status.Code() == codes.NotFound { @@ -455,6 +473,7 @@ func WaitForSdkTxCommit(txClient txtypes.ServiceClient, txHash string, timeout t break } txRes = res.TxResponse + fmt.Println("WaitForSdkTxCommit txRes", txRes) if err == nil && txRes.Code != uint32(codes.OK) { err = errorsmod.Wrapf(ErrUnsuccessfulTx, "code = %d; %s", txRes.Code, txRes.RawLog) } diff --git a/third_party/proto/amino/amino.proto b/third_party/proto/amino/amino.proto index e1cc692981..fb099b8ee6 100644 --- a/third_party/proto/amino/amino.proto +++ b/third_party/proto/amino/amino.proto @@ -76,4 +76,9 @@ extend google.protobuf.FieldOptions { // out := AminoJSONEncoder(&f); // out == {"baz":""} bool dont_omitempty = 11110005; -} + + // oneof_name sets the type name for the given field oneof field. This is used + // by the Amino JSON encoder to encode the type of the oneof field, and must be the same string in + // the RegisterConcrete() method usage used to register the concrete type. + string oneof_name = 11110006; +} \ No newline at end of file diff --git a/third_party/proto/capability/v1/capability.proto b/third_party/proto/capability/v1/capability.proto new file mode 100644 index 0000000000..31136cc5de --- /dev/null +++ b/third_party/proto/capability/v1/capability.proto @@ -0,0 +1,32 @@ +syntax = "proto3"; + +package capability.v1; + +import "gogoproto/gogo.proto"; +import "amino/amino.proto"; + +option go_package = "github.com/cosmos/ibc-go/modules/capability/types"; + +// Capability defines an implementation of an object capability. The index +// provided to a Capability must be globally unique. +message Capability { + option (gogoproto.goproto_stringer) = false; + + uint64 index = 1; +} + +// Owner defines a single capability owner. An owner is defined by the name of +// capability and the module name. +message Owner { + option (gogoproto.goproto_stringer) = false; + option (gogoproto.goproto_getters) = false; + + string module = 1; + string name = 2; +} + +// CapabilityOwners defines a set of owners of a single Capability. The set of +// owners must be unique. +message CapabilityOwners { + repeated Owner owners = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; +} diff --git a/third_party/proto/capability/v1/genesis.proto b/third_party/proto/capability/v1/genesis.proto new file mode 100644 index 0000000000..f345f6b2cf --- /dev/null +++ b/third_party/proto/capability/v1/genesis.proto @@ -0,0 +1,28 @@ +syntax = "proto3"; + +package capability.v1; + +import "gogoproto/gogo.proto"; +import "capability/v1/capability.proto"; +import "amino/amino.proto"; + +option go_package = "github.com/cosmos/ibc-go/modules/capability/types"; + +// GenesisOwners defines the capability owners with their corresponding index. +message GenesisOwners { + // index is the index of the capability owner. + uint64 index = 1; + + // index_owners are the owners at the given index. + CapabilityOwners index_owners = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; +} + +// GenesisState defines the capability module's genesis state. +message GenesisState { + // index is the capability global index. + uint64 index = 1; + + // owners represents a map from index to owners of the capability index + // index key is string to allow amino marshalling. + repeated GenesisOwners owners = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; +} diff --git a/third_party/proto/cosmos/app/runtime/v1alpha1/module.proto b/third_party/proto/cosmos/app/runtime/v1alpha1/module.proto index 4598ba44dc..c026121702 100644 --- a/third_party/proto/cosmos/app/runtime/v1alpha1/module.proto +++ b/third_party/proto/cosmos/app/runtime/v1alpha1/module.proto @@ -37,6 +37,21 @@ message Module { // override_store_keys is an optional list of overrides for the module store keys // to be used in keeper construction. repeated StoreKeyConfig override_store_keys = 6; + + // order_migrations defines the order in which module migrations are performed. + // If this is left empty, it uses the default migration order. + // https://pkg.go.dev/github.com/cosmos/cosmos-sdk@v0.47.0-alpha2/types/module#DefaultMigrationsOrder + repeated string order_migrations = 7; + + // precommiters specifies the module names of the precommiters + // to call in the order in which they should be called. If this is left empty + // no precommit function will be registered. + repeated string precommiters = 8; + + // prepare_check_staters specifies the module names of the prepare_check_staters + // to call in the order in which they should be called. If this is left empty + // no preparecheckstate function will be registered. + repeated string prepare_check_staters = 9; } // StoreKeyConfig may be supplied to override the default module store key, which diff --git a/third_party/proto/cosmos/app/v1alpha1/module.proto b/third_party/proto/cosmos/app/v1alpha1/module.proto index 990857172e..e541378650 100644 --- a/third_party/proto/cosmos/app/v1alpha1/module.proto +++ b/third_party/proto/cosmos/app/v1alpha1/module.proto @@ -57,7 +57,7 @@ message PackageReference { // // When a new version of a module is released and items are added to existing // .proto files, these definitions should contain comments of the form - // "Since Revision N" where N is an integer revision. + // "Since: Revision N" where N is an integer revision. // // When the module runtime starts up, it will check the pinned proto // image and panic if there are runtime protobuf definitions that are not diff --git a/third_party/proto/cosmos/auth/v1beta1/auth.proto b/third_party/proto/cosmos/auth/v1beta1/auth.proto index 0578453ccf..ebc18b69f0 100644 --- a/third_party/proto/cosmos/auth/v1beta1/auth.proto +++ b/third_party/proto/cosmos/auth/v1beta1/auth.proto @@ -12,20 +12,24 @@ option go_package = "github.com/cosmos/cosmos-sdk/x/auth/types"; // for basic account functionality. Any custom account type should extend this // type for additional functionality (e.g. vesting). message BaseAccount { - option (amino.name) = "cosmos-sdk/BaseAccount"; - option (gogoproto.goproto_getters) = false; - option (gogoproto.equal) = false; + option (amino.name) = "cosmos-sdk/BaseAccount"; + option (gogoproto.goproto_getters) = false; + option (gogoproto.equal) = false; + option (cosmos_proto.implements_interface) = "cosmos.auth.v1beta1.AccountI"; - string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - google.protobuf.Any pub_key = 2 [(gogoproto.jsontag) = "public_key,omitempty", (amino.field_name) = "public_key"]; - uint64 account_number = 3; - uint64 sequence = 4; + string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + google.protobuf.Any pub_key = 2 [(gogoproto.jsontag) = "public_key,omitempty", (amino.field_name) = "public_key"]; + + uint64 account_number = 3; + uint64 sequence = 4; } // ModuleAccount defines an account for modules that holds coins on a pool. message ModuleAccount { option (amino.name) = "cosmos-sdk/ModuleAccount"; + option (amino.message_encoding) = "module_account"; option (gogoproto.goproto_getters) = false; option (cosmos_proto.implements_interface) = "cosmos.auth.v1beta1.ModuleAccountI"; @@ -38,6 +42,7 @@ message ModuleAccount { // // Since: cosmos-sdk 0.47 message ModuleCredential { + option (amino.name) = "cosmos-sdk/GroupAccountCredential"; // module_name is the name of the module used for address derivation (passed into address.Module). string module_name = 1; // derivation_keys is for deriving a module account address (passed into address.Module) diff --git a/third_party/proto/cosmos/authz/v1beta1/query.proto b/third_party/proto/cosmos/authz/v1beta1/query.proto index 62154ac19a..fcd56815a6 100644 --- a/third_party/proto/cosmos/authz/v1beta1/query.proto +++ b/third_party/proto/cosmos/authz/v1beta1/query.proto @@ -65,7 +65,7 @@ message QueryGranterGrantsResponse { cosmos.base.query.v1beta1.PageResponse pagination = 2; } -// QueryGranteeGrantsRequest is the request type for the Query/IssuedGrants RPC method. +// QueryGranteeGrantsRequest is the request type for the Query/GranteeGrants RPC method. message QueryGranteeGrantsRequest { string grantee = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; diff --git a/third_party/proto/cosmos/authz/v1beta1/tx.proto b/third_party/proto/cosmos/authz/v1beta1/tx.proto index 69277c95ee..a1abff0d6f 100644 --- a/third_party/proto/cosmos/authz/v1beta1/tx.proto +++ b/third_party/proto/cosmos/authz/v1beta1/tx.proto @@ -44,10 +44,8 @@ message MsgGrant { cosmos.authz.v1beta1.Grant grant = 3 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } -// MsgExecResponse defines the Msg/MsgExecResponse response type. -message MsgExecResponse { - repeated bytes results = 1; -} +// MsgGrantResponse defines the Msg/MsgGrant response type. +message MsgGrantResponse {} // MsgExec attempts to execute the provided messages using // authorizations granted to the grantee. Each message should have only @@ -63,8 +61,10 @@ message MsgExec { repeated google.protobuf.Any msgs = 2 [(cosmos_proto.accepts_interface) = "cosmos.base.v1beta1.Msg"]; } -// MsgGrantResponse defines the Msg/MsgGrant response type. -message MsgGrantResponse {} +// MsgExecResponse defines the Msg/MsgExecResponse response type. +message MsgExecResponse { + repeated bytes results = 1; +} // MsgRevoke revokes any authorization with the provided sdk.Msg type on the // granter's account with that has been granted to the grantee. diff --git a/third_party/proto/cosmos/autocli/v1/options.proto b/third_party/proto/cosmos/autocli/v1/options.proto index 5587751280..b023490c97 100644 --- a/third_party/proto/cosmos/autocli/v1/options.proto +++ b/third_party/proto/cosmos/autocli/v1/options.proto @@ -6,10 +6,10 @@ option go_package = "cosmossdk.io/api/cosmos/base/cli/v1;cliv1"; // ModuleOptions describes the CLI options for a Cosmos SDK module. message ModuleOptions { - // tx describes the tx command for the module. + // tx describes the tx commands for the module. ServiceCommandDescriptor tx = 1; - // query describes the tx command for the module. + // query describes the queries commands for the module. ServiceCommandDescriptor query = 2; } @@ -101,9 +101,6 @@ message FlagOptions { // default_value is the default value as text. string default_value = 4; - // default value is the default value as text if the flag is used without any value. - string no_opt_default_value = 5; - // deprecated is the usage text to show if this flag is deprecated. string deprecated = 6; diff --git a/third_party/proto/cosmos/bank/module/v1/module.proto b/third_party/proto/cosmos/bank/module/v1/module.proto index 51e3158b68..d7d4a7fafd 100644 --- a/third_party/proto/cosmos/bank/module/v1/module.proto +++ b/third_party/proto/cosmos/bank/module/v1/module.proto @@ -10,11 +10,17 @@ message Module { go_import: "github.com/cosmos/cosmos-sdk/x/bank" }; - // blocked_module_accounts configures exceptional module accounts which should be blocked from receiving funds. - // If left empty it defaults to the list of account names supplied in the auth module configuration as + // blocked_module_accounts_override configures exceptional module accounts which should be blocked from receiving + // funds. If left empty it defaults to the list of account names supplied in the auth module configuration as // module_account_permissions repeated string blocked_module_accounts_override = 1; // authority defines the custom module authority. If not set, defaults to the governance module. string authority = 2; -} \ No newline at end of file + + // restrictions_order specifies the order of send restrictions and should be + // a list of module names which provide a send restriction instance. If no + // order is provided, then restrictions will be applied in alphabetical order + // of module names. + repeated string restrictions_order = 3; +} diff --git a/third_party/proto/cosmos/bank/v1beta1/authz.proto b/third_party/proto/cosmos/bank/v1beta1/authz.proto index a830353663..d42c619a5b 100644 --- a/third_party/proto/cosmos/bank/v1beta1/authz.proto +++ b/third_party/proto/cosmos/bank/v1beta1/authz.proto @@ -19,6 +19,7 @@ message SendAuthorization { repeated cosmos.base.v1beta1.Coin spend_limit = 1 [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true, + (amino.encoding) = "legacy_coins", (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" ]; diff --git a/third_party/proto/cosmos/bank/v1beta1/bank.proto b/third_party/proto/cosmos/bank/v1beta1/bank.proto index f81bb92354..cbf6a41cf8 100644 --- a/third_party/proto/cosmos/bank/v1beta1/bank.proto +++ b/third_party/proto/cosmos/bank/v1beta1/bank.proto @@ -11,8 +11,7 @@ option go_package = "github.com/cosmos/cosmos-sdk/x/bank/types"; // Params defines the parameters for the bank module. message Params { - option (amino.name) = "cosmos-sdk/x/bank/Params"; - option (gogoproto.goproto_stringer) = false; + option (amino.name) = "cosmos-sdk/x/bank/Params"; // Deprecated: Use of SendEnabled in params is deprecated. // For genesis, use the newly added send_enabled field in the genesis object. // Storage, lookup, and manipulation of this information is now in the keeper. @@ -25,10 +24,9 @@ message Params { // SendEnabled maps coin denom to a send_enabled status (whether a denom is // sendable). message SendEnabled { - option (gogoproto.equal) = true; - option (gogoproto.goproto_stringer) = false; - string denom = 1; - bool enabled = 2; + option (gogoproto.equal) = true; + string denom = 1; + bool enabled = 2; } // Input models transaction input. @@ -42,6 +40,7 @@ message Input { repeated cosmos.base.v1beta1.Coin coins = 2 [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true, + (amino.encoding) = "legacy_coins", (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" ]; } @@ -55,6 +54,7 @@ message Output { repeated cosmos.base.v1beta1.Coin coins = 2 [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true, + (amino.encoding) = "legacy_coins", (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" ]; } @@ -73,6 +73,7 @@ message Supply { repeated cosmos.base.v1beta1.Coin total = 1 [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true, + (amino.encoding) = "legacy_coins", (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" ]; } diff --git a/third_party/proto/cosmos/bank/v1beta1/genesis.proto b/third_party/proto/cosmos/bank/v1beta1/genesis.proto index 34214cfbbd..caf05a95bb 100644 --- a/third_party/proto/cosmos/bank/v1beta1/genesis.proto +++ b/third_party/proto/cosmos/bank/v1beta1/genesis.proto @@ -20,6 +20,7 @@ message GenesisState { // supply represents the total supply. If it is left empty, then supply will be calculated based on the provided // balances. Otherwise, it will be used to validate that the sum of the balances equals this amount. repeated cosmos.base.v1beta1.Coin supply = 3 [ + (amino.encoding) = "legacy_coins", (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", (gogoproto.nullable) = false, (amino.dont_omitempty) = true @@ -45,6 +46,7 @@ message Balance { // coins defines the different coins this balance holds. repeated cosmos.base.v1beta1.Coin coins = 2 [ + (amino.encoding) = "legacy_coins", (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", (gogoproto.nullable) = false, (amino.dont_omitempty) = true diff --git a/third_party/proto/cosmos/bank/v1beta1/query.proto b/third_party/proto/cosmos/bank/v1beta1/query.proto index 7abc31bacb..5b21a30bed 100644 --- a/third_party/proto/cosmos/bank/v1beta1/query.proto +++ b/third_party/proto/cosmos/bank/v1beta1/query.proto @@ -77,12 +77,18 @@ service Query { option (google.api.http).get = "/cosmos/bank/v1beta1/params"; } - // DenomsMetadata queries the client metadata of a given coin denomination. + // DenomMetadata queries the client metadata of a given coin denomination. rpc DenomMetadata(QueryDenomMetadataRequest) returns (QueryDenomMetadataResponse) { option (cosmos.query.v1.module_query_safe) = true; option (google.api.http).get = "/cosmos/bank/v1beta1/denoms_metadata/{denom}"; } + // DenomMetadataByQueryString queries the client metadata of a given coin denomination. + rpc DenomMetadataByQueryString(QueryDenomMetadataByQueryStringRequest) + returns (QueryDenomMetadataByQueryStringResponse) { + option (cosmos.query.v1.module_query_safe) = true; + option (google.api.http).get = "/cosmos/bank/v1beta1/denoms_metadata_by_query_string"; + } // DenomsMetadata queries the client metadata for all registered coin // denominations. rpc DenomsMetadata(QueryDenomsMetadataRequest) returns (QueryDenomsMetadataResponse) { @@ -102,6 +108,15 @@ service Query { option (google.api.http).get = "/cosmos/bank/v1beta1/denom_owners/{denom}"; } + // DenomOwnersByQuery queries for all account addresses that own a particular token + // denomination. + // + // Since: cosmos-sdk 0.50.3 + rpc DenomOwnersByQuery(QueryDenomOwnersByQueryRequest) returns (QueryDenomOwnersByQueryResponse) { + option (cosmos.query.v1.module_query_safe) = true; + option (google.api.http).get = "/cosmos/bank/v1beta1/denom_owners_by_query"; + } + // SendEnabled queries for SendEnabled entries. // // This query only returns denominations that have specific SendEnabled settings. @@ -143,6 +158,11 @@ message QueryAllBalancesRequest { // pagination defines an optional pagination for the request. cosmos.base.query.v1beta1.PageRequest pagination = 2; + + // resolve_denom is the flag to resolve the denom into a human-readable form from the metadata. + // + // Since: cosmos-sdk 0.50 + bool resolve_denom = 3; } // QueryAllBalancesResponse is the response type for the Query/AllBalances RPC @@ -152,6 +172,7 @@ message QueryAllBalancesResponse { repeated cosmos.base.v1beta1.Coin balances = 1 [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true, + (amino.encoding) = "legacy_coins", (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" ]; @@ -183,6 +204,7 @@ message QuerySpendableBalancesResponse { repeated cosmos.base.v1beta1.Coin balances = 1 [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true, + (amino.encoding) = "legacy_coins", (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" ]; @@ -214,7 +236,6 @@ message QuerySpendableBalanceByDenomResponse { cosmos.base.v1beta1.Coin balance = 1; } - // QueryTotalSupplyRequest is the request type for the Query/TotalSupply RPC // method. message QueryTotalSupplyRequest { @@ -234,6 +255,7 @@ message QueryTotalSupplyResponse { repeated cosmos.base.v1beta1.Coin supply = 1 [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true, + (amino.encoding) = "legacy_coins", (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" ]; @@ -260,6 +282,7 @@ message QueryParamsRequest {} // QueryParamsResponse defines the response type for querying x/bank parameters. message QueryParamsResponse { + // params provides the parameters of the bank module. Params params = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } @@ -292,6 +315,20 @@ message QueryDenomMetadataResponse { Metadata metadata = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } +// QueryDenomMetadataByQueryStringRequest is the request type for the Query/DenomMetadata RPC method. +// Identical with QueryDenomMetadataRequest but receives denom as query string. +message QueryDenomMetadataByQueryStringRequest { + // denom is the coin denom to query the metadata for. + string denom = 1; +} + +// QueryDenomMetadataByQueryStringResponse is the response type for the Query/DenomMetadata RPC +// method. Identical with QueryDenomMetadataResponse but receives denom as query string in request. +message QueryDenomMetadataByQueryStringResponse { + // metadata describes and provides all the client information for the requested token. + Metadata metadata = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; +} + // QueryDenomOwnersRequest defines the request type for the DenomOwners RPC query, // which queries for a paginated set of all account holders of a particular // denomination. @@ -326,6 +363,29 @@ message QueryDenomOwnersResponse { cosmos.base.query.v1beta1.PageResponse pagination = 2; } +// QueryDenomOwnersByQueryRequest defines the request type for the DenomOwnersByQuery RPC query, +// which queries for a paginated set of all account holders of a particular +// denomination. +// +// Since: cosmos-sdk 0.50.3 +message QueryDenomOwnersByQueryRequest { + // denom defines the coin denomination to query all account holders for. + string denom = 1; + + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 2; +} + +// QueryDenomOwnersByQueryResponse defines the RPC response of a DenomOwnersByQuery RPC query. +// +// Since: cosmos-sdk 0.50.3 +message QueryDenomOwnersByQueryResponse { + repeated DenomOwner denom_owners = 1; + + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + // QuerySendEnabledRequest defines the RPC request for looking up SendEnabled entries. // // Since: cosmos-sdk 0.47 diff --git a/third_party/proto/cosmos/bank/v1beta1/tx.proto b/third_party/proto/cosmos/bank/v1beta1/tx.proto index 5d6926ef6d..a4e8fae41f 100644 --- a/third_party/proto/cosmos/bank/v1beta1/tx.proto +++ b/third_party/proto/cosmos/bank/v1beta1/tx.proto @@ -48,6 +48,7 @@ message MsgSend { repeated cosmos.base.v1beta1.Coin amount = 3 [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true, + (amino.encoding) = "legacy_coins", (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" ]; } @@ -104,6 +105,7 @@ message MsgSetSendEnabled { option (cosmos.msg.v1.signer) = "authority"; option (amino.name) = "cosmos-sdk/MsgSetSendEnabled"; + // authority is the address that controls the module. string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // send_enabled is the list of entries to add or update. diff --git a/third_party/proto/cosmos/base/abci/v1beta1/abci.proto b/third_party/proto/cosmos/base/abci/v1beta1/abci.proto index ddaa635617..9e3b4e55db 100644 --- a/third_party/proto/cosmos/base/abci/v1beta1/abci.proto +++ b/third_party/proto/cosmos/base/abci/v1beta1/abci.proto @@ -3,6 +3,7 @@ package cosmos.base.abci.v1beta1; import "gogoproto/gogo.proto"; import "tendermint/abci/types.proto"; +import "tendermint/types/block.proto"; import "google/protobuf/any.proto"; option go_package = "github.com/cosmos/cosmos-sdk/types"; @@ -156,3 +157,21 @@ message SearchTxsResult { // List of txs in current page repeated TxResponse txs = 6; } + +// SearchBlocksResult defines a structure for querying blocks pageable +message SearchBlocksResult { + option (gogoproto.stringer) = true; + + // Count of all blocks + int64 total_count = 1; + // Count of blocks in current page + int64 count = 2; + // Index of current page, start from 1 + int64 page_number = 3; + // Count of total pages + int64 page_total = 4; + // Max count blocks per page + int64 limit = 5; + // List of blocks in current page + repeated tendermint.types.Block blocks = 6; +} diff --git a/third_party/proto/cosmos/base/node/v1beta1/query.proto b/third_party/proto/cosmos/base/node/v1beta1/query.proto index 8070f7b904..95df568f11 100644 --- a/third_party/proto/cosmos/base/node/v1beta1/query.proto +++ b/third_party/proto/cosmos/base/node/v1beta1/query.proto @@ -2,6 +2,8 @@ syntax = "proto3"; package cosmos.base.node.v1beta1; import "google/api/annotations.proto"; +import "google/protobuf/timestamp.proto"; +import "gogoproto/gogo.proto"; option go_package = "github.com/cosmos/cosmos-sdk/client/grpc/node"; @@ -11,6 +13,10 @@ service Service { rpc Config(ConfigRequest) returns (ConfigResponse) { option (google.api.http).get = "/cosmos/base/node/v1beta1/config"; } + // Status queries for the node status. + rpc Status(StatusRequest) returns (StatusResponse) { + option (google.api.http).get = "/cosmos/base/node/v1beta1/status"; + } } // ConfigRequest defines the request structure for the Config gRPC query. @@ -18,5 +24,20 @@ message ConfigRequest {} // ConfigResponse defines the response structure for the Config gRPC query. message ConfigResponse { - string minimum_gas_price = 1; + string minimum_gas_price = 1; + string pruning_keep_recent = 2; + string pruning_interval = 3; + uint64 halt_height = 4; +} + +// StateRequest defines the request structure for the status of a node. +message StatusRequest {} + +// StateResponse defines the response structure for the status of a node. +message StatusResponse { + uint64 earliest_store_height = 1; // earliest block height available in the store + uint64 height = 2; // current block height + google.protobuf.Timestamp timestamp = 3 [(gogoproto.stdtime) = true]; // block height timestamp + bytes app_hash = 4; // app hash of the current block + bytes validator_hash = 5; // validator hash provided by the consensus header } diff --git a/third_party/proto/cosmos/base/snapshots/v1beta1/snapshot.proto b/third_party/proto/cosmos/base/snapshots/v1beta1/snapshot.proto index e8f9c2e654..72cfbd9327 100644 --- a/third_party/proto/cosmos/base/snapshots/v1beta1/snapshot.proto +++ b/third_party/proto/cosmos/base/snapshots/v1beta1/snapshot.proto @@ -3,7 +3,7 @@ package cosmos.base.snapshots.v1beta1; import "gogoproto/gogo.proto"; -option go_package = "github.com/cosmos/cosmos-sdk/snapshots/types"; +option go_package = "cosmossdk.io/store/snapshots/types"; // Snapshot contains Tendermint state sync snapshot info. message Snapshot { diff --git a/third_party/proto/cosmos/base/tendermint/v1beta1/query.proto b/third_party/proto/cosmos/base/tendermint/v1beta1/query.proto index 1f17b0a6a3..6de6f2cdbc 100644 --- a/third_party/proto/cosmos/base/tendermint/v1beta1/query.proto +++ b/third_party/proto/cosmos/base/tendermint/v1beta1/query.proto @@ -12,7 +12,7 @@ import "cosmos_proto/cosmos.proto"; import "tendermint/types/block.proto"; import "amino/amino.proto"; -option go_package = "github.com/cosmos/cosmos-sdk/client/grpc/tmservice"; +option go_package = "github.com/cosmos/cosmos-sdk/client/grpc/cmtservice"; // Service defines the gRPC querier service for tendermint queries. service Service { diff --git a/third_party/proto/cosmos/base/tendermint/v1beta1/types.proto b/third_party/proto/cosmos/base/tendermint/v1beta1/types.proto index 6506997bda..624ff41491 100644 --- a/third_party/proto/cosmos/base/tendermint/v1beta1/types.proto +++ b/third_party/proto/cosmos/base/tendermint/v1beta1/types.proto @@ -8,7 +8,7 @@ import "tendermint/version/types.proto"; import "google/protobuf/timestamp.proto"; import "amino/amino.proto"; -option go_package = "github.com/cosmos/cosmos-sdk/client/grpc/tmservice"; +option go_package = "github.com/cosmos/cosmos-sdk/client/grpc/cmtservice"; // Block is tendermint type Block, with the Header proposer address // field converted to bech32 string. diff --git a/third_party/proto/cosmos/base/v1beta1/coin.proto b/third_party/proto/cosmos/base/v1beta1/coin.proto index 69c96f6771..1447d642d5 100644 --- a/third_party/proto/cosmos/base/v1beta1/coin.proto +++ b/third_party/proto/cosmos/base/v1beta1/coin.proto @@ -19,7 +19,7 @@ message Coin { string denom = 1; string amount = 2 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; @@ -33,16 +33,29 @@ message DecCoin { option (gogoproto.equal) = true; string denom = 1; - string amount = 2 - [(cosmos_proto.scalar) = "cosmos.Dec", (gogoproto.customtype) = "Dec", (gogoproto.nullable) = false]; + string amount = 2 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false + ]; } // IntProto defines a Protobuf wrapper around an Int object. +// Deprecated: Prefer to use math.Int directly. It supports binary Marshal and Unmarshal. message IntProto { - string int = 1 [(cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "Int", (gogoproto.nullable) = false]; + string int = 1 [ + (cosmos_proto.scalar) = "cosmos.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (gogoproto.nullable) = false + ]; } // DecProto defines a Protobuf wrapper around a Dec object. +// Deprecated: Prefer to use math.LegacyDec directly. It supports binary Marshal and Unmarshal. message DecProto { - string dec = 1 [(cosmos_proto.scalar) = "cosmos.Dec", (gogoproto.customtype) = "Dec", (gogoproto.nullable) = false]; + string dec = 1 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false + ]; } diff --git a/third_party/proto/cosmos/circuit/module/v1/module.proto b/third_party/proto/cosmos/circuit/module/v1/module.proto new file mode 100644 index 0000000000..7104bad4c9 --- /dev/null +++ b/third_party/proto/cosmos/circuit/module/v1/module.proto @@ -0,0 +1,15 @@ +syntax = "proto3"; + +package cosmos.circuit.module.v1; + +import "cosmos/app/v1alpha1/module.proto"; + +// Module is the config object of the circuit module. +message Module { + option (cosmos.app.v1alpha1.module) = { + go_import: "cosmossdk.io/x/circuit" + }; + + // authority defines the custom module authority. If not set, defaults to the governance module. + string authority = 1; +} diff --git a/third_party/proto/cosmos/circuit/v1/query.proto b/third_party/proto/cosmos/circuit/v1/query.proto new file mode 100644 index 0000000000..0115d335f4 --- /dev/null +++ b/third_party/proto/cosmos/circuit/v1/query.proto @@ -0,0 +1,61 @@ +syntax = "proto3"; +package cosmos.circuit.v1; + +option go_package = "cosmossdk.io/x/circuit/types"; + +import "cosmos/base/query/v1beta1/pagination.proto"; +import "cosmos/circuit/v1/types.proto"; +import "google/api/annotations.proto"; +import "cosmos/query/v1/query.proto"; + +// Query defines the circuit gRPC querier service. +service Query { + // Account returns account permissions. + rpc Account(QueryAccountRequest) returns (AccountResponse) { + option (cosmos.query.v1.module_query_safe) = true; + option (google.api.http).get = "/cosmos/circuit/v1/accounts/{address}"; + } + + // Account returns account permissions. + rpc Accounts(QueryAccountsRequest) returns (AccountsResponse) { + option (cosmos.query.v1.module_query_safe) = true; + option (google.api.http).get = "/cosmos/circuit/v1/accounts"; + } + + // DisabledList returns a list of disabled message urls + rpc DisabledList(QueryDisabledListRequest) returns (DisabledListResponse) { + option (cosmos.query.v1.module_query_safe) = true; + option (google.api.http).get = "/cosmos/circuit/v1/disable_list"; + } +} + +// QueryAccountRequest is the request type for the Query/Account RPC method. +message QueryAccountRequest { + string address = 1; +} + +// AccountResponse is the response type for the Query/Account RPC method. +message AccountResponse { + Permissions permission = 1; +} + +// QueryAccountsRequest is the request type for the Query/Accounts RPC method. +message QueryAccountsRequest { + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} + +// AccountsResponse is the response type for the Query/Accounts RPC method. +message AccountsResponse { + repeated GenesisAccountPermissions accounts = 1; + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QueryDisableListRequest is the request type for the Query/DisabledList RPC method. +message QueryDisabledListRequest {} + +// DisabledListResponse is the response type for the Query/DisabledList RPC method. +message DisabledListResponse { + repeated string disabled_list = 1; +} diff --git a/third_party/proto/cosmos/circuit/v1/tx.proto b/third_party/proto/cosmos/circuit/v1/tx.proto new file mode 100644 index 0000000000..71f708bb2a --- /dev/null +++ b/third_party/proto/cosmos/circuit/v1/tx.proto @@ -0,0 +1,83 @@ +syntax = "proto3"; +package cosmos.circuit.v1; + +option go_package = "cosmossdk.io/x/circuit/types"; + +import "cosmos/msg/v1/msg.proto"; +import "cosmos/circuit/v1/types.proto"; + +// Msg defines the circuit Msg service. +service Msg { + option (cosmos.msg.v1.service) = true; + + // AuthorizeCircuitBreaker allows a super-admin to grant (or revoke) another + // account's circuit breaker permissions. + rpc AuthorizeCircuitBreaker(MsgAuthorizeCircuitBreaker) returns (MsgAuthorizeCircuitBreakerResponse); + + // TripCircuitBreaker pauses processing of Msg's in the state machine. + rpc TripCircuitBreaker(MsgTripCircuitBreaker) returns (MsgTripCircuitBreakerResponse); + + // ResetCircuitBreaker resumes processing of Msg's in the state machine that + // have been been paused using TripCircuitBreaker. + rpc ResetCircuitBreaker(MsgResetCircuitBreaker) returns (MsgResetCircuitBreakerResponse); +} + +// MsgAuthorizeCircuitBreaker defines the Msg/AuthorizeCircuitBreaker request type. +message MsgAuthorizeCircuitBreaker { + option (cosmos.msg.v1.signer) = "granter"; + + // granter is the granter of the circuit breaker permissions and must have + // LEVEL_SUPER_ADMIN. + string granter = 1; + + // grantee is the account authorized with the provided permissions. + string grantee = 2; + + // permissions are the circuit breaker permissions that the grantee receives. + // These will overwrite any existing permissions. LEVEL_NONE_UNSPECIFIED can + // be specified to revoke all permissions. + Permissions permissions = 3; +} + +// MsgAuthorizeCircuitBreakerResponse defines the Msg/AuthorizeCircuitBreaker response type. +message MsgAuthorizeCircuitBreakerResponse { + bool success = 1; +} + +// MsgTripCircuitBreaker defines the Msg/TripCircuitBreaker request type. +message MsgTripCircuitBreaker { + option (cosmos.msg.v1.signer) = "authority"; + + // authority is the account authorized to trip the circuit breaker. + string authority = 1; + + // msg_type_urls specifies a list of type URLs to immediately stop processing. + // IF IT IS LEFT EMPTY, ALL MSG PROCESSING WILL STOP IMMEDIATELY. + // This value is validated against the authority's permissions and if the + // authority does not have permissions to trip the specified msg type URLs + // (or all URLs), the operation will fail. + repeated string msg_type_urls = 2; +} + +// MsgTripCircuitBreakerResponse defines the Msg/TripCircuitBreaker response type. +message MsgTripCircuitBreakerResponse { + bool success = 1; +} + +// MsgResetCircuitBreaker defines the Msg/ResetCircuitBreaker request type. +message MsgResetCircuitBreaker { + option (cosmos.msg.v1.signer) = "authority"; + + // authority is the account authorized to trip or reset the circuit breaker. + string authority = 1; + + // msg_type_urls specifies a list of Msg type URLs to resume processing. If + // it is left empty all Msg processing for type URLs that the account is + // authorized to trip will resume. + repeated string msg_type_urls = 3; +} + +// MsgResetCircuitBreakerResponse defines the Msg/ResetCircuitBreaker response type. +message MsgResetCircuitBreakerResponse { + bool success = 1; +} diff --git a/third_party/proto/cosmos/circuit/v1/types.proto b/third_party/proto/cosmos/circuit/v1/types.proto new file mode 100644 index 0000000000..1bd8d9d448 --- /dev/null +++ b/third_party/proto/cosmos/circuit/v1/types.proto @@ -0,0 +1,49 @@ +syntax = "proto3"; +package cosmos.circuit.v1; + +option go_package = "cosmossdk.io/x/circuit/types"; + +// Permissions are the permissions that an account has to trip +// or reset the circuit breaker. +message Permissions { + // level is the level of permissions granted to this account. + Level level = 1; + + // limit_type_urls is used with LEVEL_SOME_MSGS to limit the lists of Msg type + // URLs that the account can trip. It is an error to use limit_type_urls with + // a level other than LEVEL_SOME_MSGS. + repeated string limit_type_urls = 2; + + // Level is the permission level. + enum Level { + // LEVEL_NONE_UNSPECIFIED indicates that the account will have no circuit + // breaker permissions. + LEVEL_NONE_UNSPECIFIED = 0; + + // LEVEL_SOME_MSGS indicates that the account will have permission to + // trip or reset the circuit breaker for some Msg type URLs. If this level + // is chosen, a non-empty list of Msg type URLs must be provided in + // limit_type_urls. + LEVEL_SOME_MSGS = 1; + + // LEVEL_ALL_MSGS indicates that the account can trip or reset the circuit + // breaker for Msg's of all type URLs. + LEVEL_ALL_MSGS = 2; + + // LEVEL_SUPER_ADMIN indicates that the account can take all circuit breaker + // actions and can grant permissions to other accounts. + LEVEL_SUPER_ADMIN = 3; + } +} + +// GenesisAccountPermissions is the account permissions for the circuit breaker in genesis +message GenesisAccountPermissions { + string address = 1; + Permissions permissions = 2; +} + +// GenesisState is the state that must be provided at genesis. +message GenesisState { + repeated GenesisAccountPermissions account_permissions = 1; + repeated string disabled_type_urls = 2; +} diff --git a/third_party/proto/cosmos/consensus/v1/query.proto b/third_party/proto/cosmos/consensus/v1/query.proto index cdcb07ba41..84648d97c0 100644 --- a/third_party/proto/cosmos/consensus/v1/query.proto +++ b/third_party/proto/cosmos/consensus/v1/query.proto @@ -9,7 +9,7 @@ option go_package = "github.com/cosmos/cosmos-sdk/x/consensus/types"; // Query defines the gRPC querier service. service Query { - // Params queries the parameters of x/consensus_param module. + // Params queries the parameters of x/consensus module. rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { option (google.api.http).get = "/cosmos/consensus/v1/params"; } diff --git a/third_party/proto/cosmos/consensus/v1/tx.proto b/third_party/proto/cosmos/consensus/v1/tx.proto index 0a7a3de022..4323de703a 100644 --- a/third_party/proto/cosmos/consensus/v1/tx.proto +++ b/third_party/proto/cosmos/consensus/v1/tx.proto @@ -2,15 +2,18 @@ syntax = "proto3"; package cosmos.consensus.v1; +import "amino/amino.proto"; import "cosmos_proto/cosmos.proto"; import "cosmos/msg/v1/msg.proto"; import "tendermint/types/params.proto"; option go_package = "github.com/cosmos/cosmos-sdk/x/consensus/types"; -// Msg defines the bank Msg service. +// Msg defines the consensus Msg service. service Msg { - // UpdateParams defines a governance operation for updating the x/consensus_param module parameters. + option (cosmos.msg.v1.service) = true; + + // UpdateParams defines a governance operation for updating the x/consensus module parameters. // The authority is defined in the keeper. // // Since: cosmos-sdk 0.47 @@ -20,6 +23,7 @@ service Msg { // MsgUpdateParams is the Msg/UpdateParams request type. message MsgUpdateParams { option (cosmos.msg.v1.signer) = "authority"; + option (amino.name) = "cosmos-sdk/x/consensus/MsgUpdateParams"; // authority is the address that controls the module (defaults to x/gov unless overwritten). string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; @@ -32,6 +36,9 @@ message MsgUpdateParams { tendermint.types.BlockParams block = 2; tendermint.types.EvidenceParams evidence = 3; tendermint.types.ValidatorParams validator = 4; + + // Since: cosmos-sdk 0.50 + tendermint.types.ABCIParams abci = 5; } // MsgUpdateParamsResponse defines the response structure for executing a diff --git a/third_party/proto/cosmos/crypto/ed25519/keys.proto b/third_party/proto/cosmos/crypto/ed25519/keys.proto index 728b54839e..31768075a2 100644 --- a/third_party/proto/cosmos/crypto/ed25519/keys.proto +++ b/third_party/proto/cosmos/crypto/ed25519/keys.proto @@ -29,7 +29,7 @@ message PubKey { bytes key = 1 [(gogoproto.casttype) = "crypto/ed25519.PublicKey"]; } -// Deprecated: PrivKey defines a ed25519 private key. +// PrivKey defines a ed25519 private key. // NOTE: ed25519 keys must not be used in SDK apps except in a tendermint validator context. message PrivKey { option (amino.name) = "tendermint/PrivKeyEd25519"; diff --git a/third_party/proto/cosmos/distribution/v1beta1/distribution.proto b/third_party/proto/cosmos/distribution/v1beta1/distribution.proto index 226003dab4..0c20286f9a 100644 --- a/third_party/proto/cosmos/distribution/v1beta1/distribution.proto +++ b/third_party/proto/cosmos/distribution/v1beta1/distribution.proto @@ -11,12 +11,12 @@ import "amino/amino.proto"; // Params defines the set of params for the distribution module. message Params { - option (amino.name) = "cosmos-sdk/x/distribution/Params"; - option (gogoproto.goproto_stringer) = false; + option (amino.name) = "cosmos-sdk/x/distribution/Params"; string community_tax = 1 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (amino.dont_omitempty) = true, (gogoproto.nullable) = false ]; @@ -24,8 +24,9 @@ message Params { // in the x/distribution module's reward mechanism. string base_proposer_reward = 2 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false, + (amino.dont_omitempty) = true, deprecated = true ]; @@ -33,8 +34,9 @@ message Params { // in the x/distribution module's reward mechanism. string bonus_proposer_reward = 3 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false, + (amino.dont_omitempty) = true, deprecated = true ]; @@ -102,14 +104,13 @@ message ValidatorSlashEvent { uint64 validator_period = 1; string fraction = 2 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; } // ValidatorSlashEvents is a collection of ValidatorSlashEvent messages. message ValidatorSlashEvents { - option (gogoproto.goproto_stringer) = false; repeated ValidatorSlashEvent validator_slash_events = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } @@ -134,7 +135,6 @@ message CommunityPoolSpendProposal { option deprecated = true; option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; - option (gogoproto.goproto_stringer) = false; option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content"; string title = 1; @@ -143,6 +143,7 @@ message CommunityPoolSpendProposal { repeated cosmos.base.v1beta1.Coin amount = 4 [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true, + (amino.encoding) = "legacy_coins", (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" ]; } @@ -157,8 +158,9 @@ message DelegatorStartingInfo { uint64 previous_period = 1; string stake = 2 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true ]; uint64 height = 3 [(gogoproto.jsontag) = "creation_height", (amino.field_name) = "creation_height", (amino.dont_omitempty) = true]; @@ -167,10 +169,9 @@ message DelegatorStartingInfo { // DelegationDelegatorReward represents the properties // of a delegator's delegation reward. message DelegationDelegatorReward { - option (gogoproto.goproto_getters) = false; - option (gogoproto.goproto_stringer) = true; + option (gogoproto.goproto_getters) = false; - string validator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string validator_address = 1 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; repeated cosmos.base.v1beta1.DecCoin reward = 2 [ (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins", @@ -183,7 +184,6 @@ message DelegationDelegatorReward { // with a deposit message CommunityPoolSpendProposalWithDeposit { option (gogoproto.goproto_getters) = false; - option (gogoproto.goproto_stringer) = true; option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content"; string title = 1; diff --git a/third_party/proto/cosmos/distribution/v1beta1/genesis.proto b/third_party/proto/cosmos/distribution/v1beta1/genesis.proto index 5bf2d6bb88..5608bfb982 100644 --- a/third_party/proto/cosmos/distribution/v1beta1/genesis.proto +++ b/third_party/proto/cosmos/distribution/v1beta1/genesis.proto @@ -30,7 +30,7 @@ message ValidatorOutstandingRewardsRecord { option (gogoproto.goproto_getters) = false; // validator_address is the address of the validator. - string validator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string validator_address = 1 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; // outstanding_rewards represents the outstanding rewards of a validator. repeated cosmos.base.v1beta1.DecCoin outstanding_rewards = 2 [ @@ -47,7 +47,7 @@ message ValidatorAccumulatedCommissionRecord { option (gogoproto.goproto_getters) = false; // validator_address is the address of the validator. - string validator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string validator_address = 1 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; // accumulated is the accumulated commission of a validator. ValidatorAccumulatedCommission accumulated = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; @@ -60,7 +60,7 @@ message ValidatorHistoricalRewardsRecord { option (gogoproto.goproto_getters) = false; // validator_address is the address of the validator. - string validator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string validator_address = 1 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; // period defines the period the historical rewards apply to. uint64 period = 2; @@ -75,7 +75,7 @@ message ValidatorCurrentRewardsRecord { option (gogoproto.goproto_getters) = false; // validator_address is the address of the validator. - string validator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string validator_address = 1 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; // rewards defines the current rewards of a validator. ValidatorCurrentRewards rewards = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; @@ -90,7 +90,7 @@ message DelegatorStartingInfoRecord { string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // validator_address is the address of the validator. - string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; // starting_info defines the starting info of a delegator. DelegatorStartingInfo starting_info = 3 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; @@ -102,7 +102,7 @@ message ValidatorSlashEventRecord { option (gogoproto.goproto_getters) = false; // validator_address is the address of the validator. - string validator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string validator_address = 1 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; // height defines the block height at which the slash event occurred. uint64 height = 2; // period is the period of the slash event. diff --git a/third_party/proto/cosmos/distribution/v1beta1/query.proto b/third_party/proto/cosmos/distribution/v1beta1/query.proto index 4788467d9f..ffb8912135 100644 --- a/third_party/proto/cosmos/distribution/v1beta1/query.proto +++ b/third_party/proto/cosmos/distribution/v1beta1/query.proto @@ -48,7 +48,7 @@ service Query { "{validator_address}"; } - // DelegationTotalRewards queries the total rewards accrued by a each + // DelegationTotalRewards queries the total rewards accrued by each // validator. rpc DelegationTotalRewards(QueryDelegationTotalRewardsRequest) returns (QueryDelegationTotalRewardsResponse) { option (google.api.http).get = "/cosmos/distribution/v1beta1/delegators/{delegator_address}/rewards"; @@ -84,13 +84,13 @@ message QueryParamsResponse { // QueryValidatorDistributionInfoRequest is the request type for the Query/ValidatorDistributionInfo RPC method. message QueryValidatorDistributionInfoRequest { // validator_address defines the validator address to query for. - string validator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string validator_address = 1 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; } // QueryValidatorDistributionInfoResponse is the response type for the Query/ValidatorDistributionInfo RPC method. message QueryValidatorDistributionInfoResponse { // operator_address defines the validator operator address. - string operator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string operator_address = 1 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; // self_bond_rewards defines the self delegations rewards. repeated cosmos.base.v1beta1.DecCoin self_bond_rewards = 2 [ (gogoproto.nullable) = false, @@ -106,7 +106,7 @@ message QueryValidatorDistributionInfoResponse { // Query/ValidatorOutstandingRewards RPC method. message QueryValidatorOutstandingRewardsRequest { // validator_address defines the validator address to query for. - string validator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string validator_address = 1 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; } // QueryValidatorOutstandingRewardsResponse is the response type for the @@ -119,7 +119,7 @@ message QueryValidatorOutstandingRewardsResponse { // Query/ValidatorCommission RPC method message QueryValidatorCommissionRequest { // validator_address defines the validator address to query for. - string validator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string validator_address = 1 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; } // QueryValidatorCommissionResponse is the response type for the @@ -132,11 +132,10 @@ message QueryValidatorCommissionResponse { // QueryValidatorSlashesRequest is the request type for the // Query/ValidatorSlashes RPC method message QueryValidatorSlashesRequest { - option (gogoproto.goproto_getters) = false; - option (gogoproto.goproto_stringer) = true; + option (gogoproto.goproto_getters) = false; // validator_address defines the validator address to query for. - string validator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string validator_address = 1 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; // starting_height defines the optional starting height to query the slashes. uint64 starting_height = 2; // starting_height defines the optional ending height to query the slashes. @@ -164,7 +163,7 @@ message QueryDelegationRewardsRequest { // delegator_address defines the delegator address to query for. string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // validator_address defines the validator address to query for. - string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; } // QueryDelegationRewardsResponse is the response type for the diff --git a/third_party/proto/cosmos/distribution/v1beta1/tx.proto b/third_party/proto/cosmos/distribution/v1beta1/tx.proto index 957747cf43..32318bd812 100644 --- a/third_party/proto/cosmos/distribution/v1beta1/tx.proto +++ b/third_party/proto/cosmos/distribution/v1beta1/tx.proto @@ -44,6 +44,12 @@ service Msg { // // Since: cosmos-sdk 0.47 rpc CommunityPoolSpend(MsgCommunityPoolSpend) returns (MsgCommunityPoolSpendResponse); + + // DepositValidatorRewardsPool defines a method to provide additional rewards + // to delegators to a specific validator. + // + // Since: cosmos-sdk 0.50 + rpc DepositValidatorRewardsPool(MsgDepositValidatorRewardsPool) returns (MsgDepositValidatorRewardsPoolResponse); } // MsgSetWithdrawAddress sets the withdraw address for @@ -73,7 +79,7 @@ message MsgWithdrawDelegatorReward { option (gogoproto.goproto_getters) = false; string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; } // MsgWithdrawDelegatorRewardResponse defines the Msg/WithdrawDelegatorReward @@ -83,6 +89,7 @@ message MsgWithdrawDelegatorRewardResponse { repeated cosmos.base.v1beta1.Coin amount = 1 [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true, + (amino.encoding) = "legacy_coins", (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" ]; } @@ -96,7 +103,7 @@ message MsgWithdrawValidatorCommission { option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; - string validator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string validator_address = 1 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; } // MsgWithdrawValidatorCommissionResponse defines the @@ -106,6 +113,7 @@ message MsgWithdrawValidatorCommissionResponse { repeated cosmos.base.v1beta1.Coin amount = 1 [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true, + (amino.encoding) = "legacy_coins", (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" ]; } @@ -122,6 +130,7 @@ message MsgFundCommunityPool { repeated cosmos.base.v1beta1.Coin amount = 1 [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true, + (amino.encoding) = "legacy_coins", (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" ]; string depositor = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; @@ -162,11 +171,12 @@ message MsgCommunityPoolSpend { option (amino.name) = "cosmos-sdk/distr/MsgCommunityPoolSpend"; // authority is the address that controls the module (defaults to x/gov unless overwritten). - string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - string recipient = 2; + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string recipient = 2; repeated cosmos.base.v1beta1.Coin amount = 3 [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true, + (amino.encoding) = "legacy_coins", (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" ]; } @@ -176,3 +186,30 @@ message MsgCommunityPoolSpend { // // Since: cosmos-sdk 0.47 message MsgCommunityPoolSpendResponse {} + +// DepositValidatorRewardsPool defines the request structure to provide +// additional rewards to delegators from a specific validator. +// +// Since: cosmos-sdk 0.50 +message MsgDepositValidatorRewardsPool { + option (amino.name) = "cosmos-sdk/distr/MsgDepositValRewards"; + option (cosmos.msg.v1.signer) = "depositor"; + + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + string depositor = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; + repeated cosmos.base.v1beta1.Coin amount = 3 [ + (gogoproto.nullable) = false, + (amino.encoding) = "legacy_coins", + (amino.dont_omitempty) = true, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; +} + +// MsgDepositValidatorRewardsPoolResponse defines the response to executing a +// MsgDepositValidatorRewardsPool message. +// +// Since: cosmos-sdk 0.50 +message MsgDepositValidatorRewardsPoolResponse {} diff --git a/third_party/proto/cosmos/evidence/module/v1/module.proto b/third_party/proto/cosmos/evidence/module/v1/module.proto index fceea7da77..5b2ede6513 100644 --- a/third_party/proto/cosmos/evidence/module/v1/module.proto +++ b/third_party/proto/cosmos/evidence/module/v1/module.proto @@ -7,6 +7,6 @@ import "cosmos/app/v1alpha1/module.proto"; // Module is the config object of the evidence module. message Module { option (cosmos.app.v1alpha1.module) = { - go_import: "github.com/cosmos/cosmos-sdk/x/evidence" + go_import: "cosmossdk.io/x/evidence" }; } \ No newline at end of file diff --git a/third_party/proto/cosmos/evidence/v1beta1/evidence.proto b/third_party/proto/cosmos/evidence/v1beta1/evidence.proto index 8dca3201d0..21b2c5d8e9 100644 --- a/third_party/proto/cosmos/evidence/v1beta1/evidence.proto +++ b/third_party/proto/cosmos/evidence/v1beta1/evidence.proto @@ -1,7 +1,7 @@ syntax = "proto3"; package cosmos.evidence.v1beta1; -option go_package = "github.com/cosmos/cosmos-sdk/x/evidence/types"; +option go_package = "cosmossdk.io/x/evidence/types"; option (gogoproto.equal_all) = true; import "amino/amino.proto"; @@ -12,20 +12,19 @@ import "cosmos_proto/cosmos.proto"; // Equivocation implements the Evidence interface and defines evidence of double // signing misbehavior. message Equivocation { - option (amino.name) = "cosmos-sdk/Equivocation"; - option (gogoproto.goproto_stringer) = false; - option (gogoproto.goproto_getters) = false; - option (gogoproto.equal) = false; + option (amino.name) = "cosmos-sdk/Equivocation"; + option (gogoproto.goproto_getters) = false; + option (gogoproto.equal) = false; // height is the equivocation height. - int64 height = 1; + int64 height = 1; // time is the equivocation time. - google.protobuf.Timestamp time = 2 + google.protobuf.Timestamp time = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true, (gogoproto.stdtime) = true]; - + // power is the equivocation validator power. - int64 power = 3; + int64 power = 3; // consensus_address is the equivocation validator consensus address. string consensus_address = 4 [(cosmos_proto.scalar) = "cosmos.AddressString"]; diff --git a/third_party/proto/cosmos/evidence/v1beta1/genesis.proto b/third_party/proto/cosmos/evidence/v1beta1/genesis.proto index 199f446f7e..33b354e247 100644 --- a/third_party/proto/cosmos/evidence/v1beta1/genesis.proto +++ b/third_party/proto/cosmos/evidence/v1beta1/genesis.proto @@ -1,7 +1,7 @@ syntax = "proto3"; package cosmos.evidence.v1beta1; -option go_package = "github.com/cosmos/cosmos-sdk/x/evidence/types"; +option go_package = "cosmossdk.io/x/evidence/types"; import "google/protobuf/any.proto"; diff --git a/third_party/proto/cosmos/evidence/v1beta1/query.proto b/third_party/proto/cosmos/evidence/v1beta1/query.proto index 34163dd57f..f4af8ab7f8 100644 --- a/third_party/proto/cosmos/evidence/v1beta1/query.proto +++ b/third_party/proto/cosmos/evidence/v1beta1/query.proto @@ -2,11 +2,10 @@ syntax = "proto3"; package cosmos.evidence.v1beta1; import "cosmos/base/query/v1beta1/pagination.proto"; -import "gogoproto/gogo.proto"; import "google/protobuf/any.proto"; import "google/api/annotations.proto"; -option go_package = "github.com/cosmos/cosmos-sdk/x/evidence/types"; +option go_package = "cosmossdk.io/x/evidence/types"; // Query defines the gRPC querier service. service Query { @@ -25,8 +24,7 @@ service Query { message QueryEvidenceRequest { // evidence_hash defines the hash of the requested evidence. // Deprecated: Use hash, a HEX encoded string, instead. - bytes evidence_hash = 1 - [deprecated = true, (gogoproto.casttype) = "github.com/cometbft/cometbft/libs/bytes.HexBytes"]; + bytes evidence_hash = 1 [deprecated = true]; // hash defines the evidence hash of the requested evidence. // diff --git a/third_party/proto/cosmos/evidence/v1beta1/tx.proto b/third_party/proto/cosmos/evidence/v1beta1/tx.proto index f5646e2dec..5eeaa6e909 100644 --- a/third_party/proto/cosmos/evidence/v1beta1/tx.proto +++ b/third_party/proto/cosmos/evidence/v1beta1/tx.proto @@ -1,7 +1,7 @@ syntax = "proto3"; package cosmos.evidence.v1beta1; -option go_package = "github.com/cosmos/cosmos-sdk/x/evidence/types"; +option go_package = "cosmossdk.io/x/evidence/types"; option (gogoproto.equal_all) = true; import "gogoproto/gogo.proto"; @@ -29,8 +29,8 @@ message MsgSubmitEvidence { option (gogoproto.goproto_getters) = false; // submitter is the signer account address of evidence. - string submitter = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - + string submitter = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // evidence defines the evidence of misbehavior. google.protobuf.Any evidence = 2 [(cosmos_proto.accepts_interface) = "cosmos.evidence.v1beta1.Evidence"]; } diff --git a/third_party/proto/cosmos/feegrant/module/v1/module.proto b/third_party/proto/cosmos/feegrant/module/v1/module.proto index d838f02f10..c5d6c24e07 100644 --- a/third_party/proto/cosmos/feegrant/module/v1/module.proto +++ b/third_party/proto/cosmos/feegrant/module/v1/module.proto @@ -7,6 +7,6 @@ import "cosmos/app/v1alpha1/module.proto"; // Module is the config object of the feegrant module. message Module { option (cosmos.app.v1alpha1.module) = { - go_import: "github.com/cosmos/cosmos-sdk/x/feegrant" + go_import: "cosmossdk.io/x/feegrant" }; } \ No newline at end of file diff --git a/third_party/proto/cosmos/feegrant/v1beta1/feegrant.proto b/third_party/proto/cosmos/feegrant/v1beta1/feegrant.proto index 1cfe741bfa..a1c67eafbd 100644 --- a/third_party/proto/cosmos/feegrant/v1beta1/feegrant.proto +++ b/third_party/proto/cosmos/feegrant/v1beta1/feegrant.proto @@ -10,7 +10,7 @@ import "amino/amino.proto"; import "google/protobuf/timestamp.proto"; import "google/protobuf/duration.proto"; -option go_package = "github.com/cosmos/cosmos-sdk/x/feegrant"; +option go_package = "cosmossdk.io/x/feegrant"; // BasicAllowance implements Allowance with a one-time grant of coins // that optionally expires. The grantee can use up to SpendLimit to cover fees. @@ -24,6 +24,7 @@ message BasicAllowance { repeated cosmos.base.v1beta1.Coin spend_limit = 1 [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true, + (amino.encoding) = "legacy_coins", (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" ]; @@ -50,6 +51,7 @@ message PeriodicAllowance { repeated cosmos.base.v1beta1.Coin period_spend_limit = 3 [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true, + (amino.encoding) = "legacy_coins", (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" ]; @@ -57,6 +59,7 @@ message PeriodicAllowance { repeated cosmos.base.v1beta1.Coin period_can_spend = 4 [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true, + (amino.encoding) = "legacy_coins", (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" ]; diff --git a/third_party/proto/cosmos/feegrant/v1beta1/genesis.proto b/third_party/proto/cosmos/feegrant/v1beta1/genesis.proto index a1ead95639..ac7e57e1e4 100644 --- a/third_party/proto/cosmos/feegrant/v1beta1/genesis.proto +++ b/third_party/proto/cosmos/feegrant/v1beta1/genesis.proto @@ -6,7 +6,7 @@ import "gogoproto/gogo.proto"; import "cosmos/feegrant/v1beta1/feegrant.proto"; import "amino/amino.proto"; -option go_package = "github.com/cosmos/cosmos-sdk/x/feegrant"; +option go_package = "cosmossdk.io/x/feegrant"; // GenesisState contains a set of fee allowances, persisted from the store message GenesisState { diff --git a/third_party/proto/cosmos/feegrant/v1beta1/query.proto b/third_party/proto/cosmos/feegrant/v1beta1/query.proto index baef777016..591537acd9 100644 --- a/third_party/proto/cosmos/feegrant/v1beta1/query.proto +++ b/third_party/proto/cosmos/feegrant/v1beta1/query.proto @@ -7,17 +7,17 @@ import "cosmos/base/query/v1beta1/pagination.proto"; import "google/api/annotations.proto"; import "cosmos_proto/cosmos.proto"; -option go_package = "github.com/cosmos/cosmos-sdk/x/feegrant"; +option go_package = "cosmossdk.io/x/feegrant"; // Query defines the gRPC querier service. service Query { - // Allowance returns fee granted to the grantee by the granter. + // Allowance returns granted allwance to the grantee by the granter. rpc Allowance(QueryAllowanceRequest) returns (QueryAllowanceResponse) { option (google.api.http).get = "/cosmos/feegrant/v1beta1/allowance/{granter}/{grantee}"; } - // Allowances returns all the grants for address. + // Allowances returns all the grants for the given grantee address. rpc Allowances(QueryAllowancesRequest) returns (QueryAllowancesResponse) { option (google.api.http).get = "/cosmos/feegrant/v1beta1/allowances/{grantee}"; } diff --git a/third_party/proto/cosmos/feegrant/v1beta1/tx.proto b/third_party/proto/cosmos/feegrant/v1beta1/tx.proto index 20bbaf48f4..a45eec3ba3 100644 --- a/third_party/proto/cosmos/feegrant/v1beta1/tx.proto +++ b/third_party/proto/cosmos/feegrant/v1beta1/tx.proto @@ -7,7 +7,7 @@ import "cosmos_proto/cosmos.proto"; import "cosmos/msg/v1/msg.proto"; import "amino/amino.proto"; -option go_package = "github.com/cosmos/cosmos-sdk/x/feegrant"; +option go_package = "cosmossdk.io/x/feegrant"; // Msg defines the feegrant msg service. service Msg { @@ -20,6 +20,11 @@ service Msg { // RevokeAllowance revokes any fee allowance of granter's account that // has been granted to the grantee. rpc RevokeAllowance(MsgRevokeAllowance) returns (MsgRevokeAllowanceResponse); + + // PruneAllowances prunes expired fee allowances, currently up to 75 at a time. + // + // Since cosmos-sdk 0.50 + rpc PruneAllowances(MsgPruneAllowances) returns (MsgPruneAllowancesResponse); } // MsgGrantAllowance adds permission for Grantee to spend up to Allowance @@ -55,3 +60,18 @@ message MsgRevokeAllowance { // MsgRevokeAllowanceResponse defines the Msg/RevokeAllowanceResponse response type. message MsgRevokeAllowanceResponse {} + +// MsgPruneAllowances prunes expired fee allowances. +// +// Since cosmos-sdk 0.50 +message MsgPruneAllowances { + option (cosmos.msg.v1.signer) = "pruner"; + + // pruner is the address of the user pruning expired allowances. + string pruner = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; +} + +// MsgPruneAllowancesResponse defines the Msg/PruneAllowancesResponse response type. +// +// Since cosmos-sdk 0.50 +message MsgPruneAllowancesResponse {} \ No newline at end of file diff --git a/third_party/proto/cosmos/genutil/v1beta1/genesis.proto b/third_party/proto/cosmos/genutil/v1beta1/genesis.proto index 45aa6bb22d..dfd34943ea 100644 --- a/third_party/proto/cosmos/genutil/v1beta1/genesis.proto +++ b/third_party/proto/cosmos/genutil/v1beta1/genesis.proto @@ -15,4 +15,4 @@ message GenesisState { (amino.field_name) = "gentxs", (amino.dont_omitempty) = true ]; -} +} \ No newline at end of file diff --git a/third_party/proto/cosmos/gov/module/v1/module.proto b/third_party/proto/cosmos/gov/module/v1/module.proto index 9544cfe2b4..9cade9af01 100644 --- a/third_party/proto/cosmos/gov/module/v1/module.proto +++ b/third_party/proto/cosmos/gov/module/v1/module.proto @@ -10,7 +10,7 @@ message Module { go_import: "github.com/cosmos/cosmos-sdk/x/gov" }; - // max_metadata_len defines the maximum proposal metadata length. + // max_metadata_len defines the maximum proposal metadata length. // Defaults to 255 if not explicitly set. uint64 max_metadata_len = 1; diff --git a/third_party/proto/cosmos/gov/v1/genesis.proto b/third_party/proto/cosmos/gov/v1/genesis.proto index b9cf573f74..1398b33268 100644 --- a/third_party/proto/cosmos/gov/v1/genesis.proto +++ b/third_party/proto/cosmos/gov/v1/genesis.proto @@ -30,4 +30,11 @@ message GenesisState { // // Since: cosmos-sdk 0.47 Params params = 8; + // The constitution allows builders to lay a foundation and define purpose. + // This is an immutable string set in genesis. + // There are no amendments, to go outside of scope, just fork. + // constitution is an immutable string in genesis for a chain builder to lay out their vision, ideas and ideals. + // + // Since: cosmos-sdk 0.50 + string constitution = 9; } diff --git a/third_party/proto/cosmos/gov/v1/gov.proto b/third_party/proto/cosmos/gov/v1/gov.proto index 49bfcc264b..0ebfbc1d1f 100644 --- a/third_party/proto/cosmos/gov/v1/gov.proto +++ b/third_party/proto/cosmos/gov/v1/gov.proto @@ -32,18 +32,18 @@ message WeightedVoteOption { VoteOption option = 1; // weight is the vote weight associated with the vote option. - string weight = 2 [(cosmos_proto.scalar) = "cosmos.Dec"]; + string weight = 2 [(cosmos_proto.scalar) = "cosmos.Dec"]; } // Deposit defines an amount deposited by an account address to an active // proposal. message Deposit { // proposal_id defines the unique id of the proposal. - uint64 proposal_id = 1; - + uint64 proposal_id = 1; + // depositor defines the deposit addresses from the proposals. - string depositor = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - + string depositor = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // amount to be deposited by depositor. repeated cosmos.base.v1beta1.Coin amount = 3 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } @@ -51,35 +51,37 @@ message Deposit { // Proposal defines the core field members of a governance proposal. message Proposal { // id defines the unique id of the proposal. - uint64 id = 1; + uint64 id = 1; // messages are the arbitrary messages to be executed if the proposal passes. repeated google.protobuf.Any messages = 2; // status defines the proposal status. - ProposalStatus status = 3; + ProposalStatus status = 3; // final_tally_result is the final tally result of the proposal. When // querying a proposal via gRPC, this field is not populated until the // proposal's voting period has ended. - TallyResult final_tally_result = 4; - + TallyResult final_tally_result = 4; + // submit_time is the time of proposal submission. - google.protobuf.Timestamp submit_time = 5 [(gogoproto.stdtime) = true]; - + google.protobuf.Timestamp submit_time = 5 [(gogoproto.stdtime) = true]; + // deposit_end_time is the end time for deposition. - google.protobuf.Timestamp deposit_end_time = 6 [(gogoproto.stdtime) = true]; - + google.protobuf.Timestamp deposit_end_time = 6 [(gogoproto.stdtime) = true]; + // total_deposit is the total deposit on the proposal. - repeated cosmos.base.v1beta1.Coin total_deposit = 7 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; - + repeated cosmos.base.v1beta1.Coin total_deposit = 7 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + // voting_start_time is the starting time to vote on a proposal. - google.protobuf.Timestamp voting_start_time = 8 [(gogoproto.stdtime) = true]; - + google.protobuf.Timestamp voting_start_time = 8 [(gogoproto.stdtime) = true]; + // voting_end_time is the end time of voting on a proposal. - google.protobuf.Timestamp voting_end_time = 9 [(gogoproto.stdtime) = true]; + google.protobuf.Timestamp voting_end_time = 9 [(gogoproto.stdtime) = true]; // metadata is any arbitrary metadata attached to the proposal. + // the recommended format of the metadata is to be found here: + // https://docs.cosmos.network/v0.47/modules/gov#proposal-3 string metadata = 10; // title is the title of the proposal @@ -92,10 +94,20 @@ message Proposal { // Since: cosmos-sdk 0.47 string summary = 12; - // Proposer is the address of the proposal sumbitter + // proposer is the address of the proposal sumbitter // // Since: cosmos-sdk 0.47 string proposer = 13 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + // expedited defines if the proposal is expedited + // + // Since: cosmos-sdk 0.50 + bool expedited = 14; + + // failed_reason defines the reason why the proposal failed + // + // Since: cosmos-sdk 0.50 + string failed_reason = 15; } // ProposalStatus enumerates the valid statuses of a proposal. @@ -122,11 +134,11 @@ enum ProposalStatus { // TallyResult defines a standard tally for a governance proposal. message TallyResult { // yes_count is the number of yes votes on a proposal. - string yes_count = 1 [(cosmos_proto.scalar) = "cosmos.Int"]; + string yes_count = 1 [(cosmos_proto.scalar) = "cosmos.Int"]; // abstain_count is the number of abstain votes on a proposal. - string abstain_count = 2 [(cosmos_proto.scalar) = "cosmos.Int"]; + string abstain_count = 2 [(cosmos_proto.scalar) = "cosmos.Int"]; // no_count is the number of no votes on a proposal. - string no_count = 3 [(cosmos_proto.scalar) = "cosmos.Int"]; + string no_count = 3 [(cosmos_proto.scalar) = "cosmos.Int"]; // no_with_veto_count is the number of no with veto votes on a proposal. string no_with_veto_count = 4 [(cosmos_proto.scalar) = "cosmos.Int"]; } @@ -138,19 +150,22 @@ message Vote { uint64 proposal_id = 1; // voter is the voter address of the proposal. - string voter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - + string voter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + reserved 3; // options is the weighted vote options. repeated WeightedVoteOption options = 4; - // metadata is any arbitrary metadata to attached to the vote. + // metadata is any arbitrary metadata attached to the vote. + // the recommended format of the metadata is to be found here: https://docs.cosmos.network/v0.47/modules/gov#vote-5 string metadata = 5; } // DepositParams defines the params for deposits on governance proposals. message DepositParams { + option deprecated = true; + // Minimum deposit for a proposal to enter voting period. repeated cosmos.base.v1beta1.Coin min_deposit = 1 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "min_deposit,omitempty"]; @@ -163,12 +178,16 @@ message DepositParams { // VotingParams defines the params for voting on governance proposals. message VotingParams { + option deprecated = true; + // Duration of the voting period. google.protobuf.Duration voting_period = 1 [(gogoproto.stdduration) = true]; } // TallyParams defines the params for tallying votes on governance proposals. message TallyParams { + option deprecated = true; + // Minimum percentage of total stake needed to vote for a result to be // considered valid. string quorum = 1 [(cosmos_proto.scalar) = "cosmos.Dec"]; @@ -209,12 +228,44 @@ message Params { // The ratio representing the proportion of the deposit value that must be paid at proposal submission. string min_initial_deposit_ratio = 7 [(cosmos_proto.scalar) = "cosmos.Dec"]; + // The cancel ratio which will not be returned back to the depositors when a proposal is cancelled. + // + // Since: cosmos-sdk 0.50 + string proposal_cancel_ratio = 8 [(cosmos_proto.scalar) = "cosmos.Dec"]; + + // The address which will receive (proposal_cancel_ratio * deposit) proposal deposits. + // If empty, the (proposal_cancel_ratio * deposit) proposal deposits will be burned. + // + // Since: cosmos-sdk 0.50 + string proposal_cancel_dest = 9 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + // Duration of the voting period of an expedited proposal. + // + // Since: cosmos-sdk 0.50 + google.protobuf.Duration expedited_voting_period = 10 [(gogoproto.stdduration) = true]; + + // Minimum proportion of Yes votes for proposal to pass. Default value: 0.67. + // + // Since: cosmos-sdk 0.50 + string expedited_threshold = 11 [(cosmos_proto.scalar) = "cosmos.Dec"]; + + // Minimum expedited deposit for a proposal to enter voting period. + repeated cosmos.base.v1beta1.Coin expedited_min_deposit = 12 + [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + // burn deposits if a proposal does not meet quorum bool burn_vote_quorum = 13; // burn deposits if the proposal does not enter voting period bool burn_proposal_deposit_prevote = 14; - + // burn deposits if quorum with vote type no_veto is met bool burn_vote_veto = 15; + + // The ratio representing the proportion of the deposit value minimum that must be met when making a deposit. + // Default value: 0.01. Meaning that for a chain with a min_deposit of 100stake, a deposit of 1stake would be + // required. + // + // Since: cosmos-sdk 0.50 + string min_deposit_ratio = 16 [(cosmos_proto.scalar) = "cosmos.Dec"]; } diff --git a/third_party/proto/cosmos/gov/v1/query.proto b/third_party/proto/cosmos/gov/v1/query.proto index 0c1c9f2b7e..006d12fd61 100644 --- a/third_party/proto/cosmos/gov/v1/query.proto +++ b/third_party/proto/cosmos/gov/v1/query.proto @@ -1,4 +1,3 @@ - // Since: cosmos-sdk 0.46 syntax = "proto3"; package cosmos.gov.v1; @@ -12,6 +11,11 @@ option go_package = "github.com/cosmos/cosmos-sdk/x/gov/types/v1"; // Query defines the gRPC querier service for gov module service Query { + // Constitution queries the chain's constitution. + rpc Constitution(QueryConstitutionRequest) returns (QueryConstitutionResponse) { + option (google.api.http).get = "/cosmos/gov/v1/constitution"; + } + // Proposal queries proposal details based on ProposalID. rpc Proposal(QueryProposalRequest) returns (QueryProposalResponse) { option (google.api.http).get = "/cosmos/gov/v1/proposals/{proposal_id}"; @@ -37,7 +41,7 @@ service Query { option (google.api.http).get = "/cosmos/gov/v1/params/{params_type}"; } - // Deposit queries single deposit information based proposalID, depositAddr. + // Deposit queries single deposit information based on proposalID, depositAddr. rpc Deposit(QueryDepositRequest) returns (QueryDepositResponse) { option (google.api.http).get = "/cosmos/gov/v1/proposals/{proposal_id}/deposits/{depositor}"; } @@ -53,6 +57,14 @@ service Query { } } +// QueryConstitutionRequest is the request type for the Query/Constitution RPC method +message QueryConstitutionRequest {} + +// QueryConstitutionResponse is the response type for the Query/Constitution RPC method +message QueryConstitutionResponse { + string constitution = 1; +} + // QueryProposalRequest is the request type for the Query/Proposal RPC method. message QueryProposalRequest { // proposal_id defines the unique id of the proposal. diff --git a/third_party/proto/cosmos/gov/v1/tx.proto b/third_party/proto/cosmos/gov/v1/tx.proto index 1708066c65..21920a5ffc 100644 --- a/third_party/proto/cosmos/gov/v1/tx.proto +++ b/third_party/proto/cosmos/gov/v1/tx.proto @@ -9,6 +9,7 @@ import "cosmos_proto/cosmos.proto"; import "google/protobuf/any.proto"; import "cosmos/msg/v1/msg.proto"; import "amino/amino.proto"; +import "google/protobuf/timestamp.proto"; option go_package = "github.com/cosmos/cosmos-sdk/x/gov/types/v1"; @@ -37,6 +38,11 @@ service Msg { // // Since: cosmos-sdk 0.47 rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); + + // CancelProposal defines a method to cancel governance proposal + // + // Since: cosmos-sdk 0.50 + rpc CancelProposal(MsgCancelProposal) returns (MsgCancelProposalResponse); } // MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary @@ -46,14 +52,19 @@ message MsgSubmitProposal { option (amino.name) = "cosmos-sdk/v1/MsgSubmitProposal"; // messages are the arbitrary messages to be executed if proposal passes. - repeated google.protobuf.Any messages = 1; + repeated google.protobuf.Any messages = 1; // initial_deposit is the deposit value that must be paid at proposal submission. - repeated cosmos.base.v1beta1.Coin initial_deposit = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; - + repeated cosmos.base.v1beta1.Coin initial_deposit = 2 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (amino.dont_omitempty) = true, + (amino.encoding) = "legacy_coins" + ]; + // proposer is the account address of the proposer. - string proposer = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - + string proposer = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // metadata is any arbitrary metadata attached to the proposal. string metadata = 4; @@ -66,6 +77,11 @@ message MsgSubmitProposal { // // Since: cosmos-sdk 0.47 string summary = 6; + + // expedited defines if the proposal is expedited or not + // + // Since: cosmos-sdk 0.50 + bool expedited = 7; } // MsgSubmitProposalResponse defines the Msg/SubmitProposal response type. @@ -95,16 +111,16 @@ message MsgVote { option (amino.name) = "cosmos-sdk/v1/MsgVote"; // proposal_id defines the unique id of the proposal. - uint64 proposal_id = 1 [(gogoproto.jsontag) = "proposal_id", (amino.dont_omitempty) = true]; - + uint64 proposal_id = 1 [(gogoproto.jsontag) = "proposal_id", (amino.dont_omitempty) = true]; + // voter is the voter address for the proposal. - string voter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - + string voter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // option defines the vote option. - VoteOption option = 3; - + VoteOption option = 3; + // metadata is any arbitrary metadata attached to the Vote. - string metadata = 4; + string metadata = 4; } // MsgVoteResponse defines the Msg/Vote response type. @@ -116,16 +132,16 @@ message MsgVoteWeighted { option (amino.name) = "cosmos-sdk/v1/MsgVoteWeighted"; // proposal_id defines the unique id of the proposal. - uint64 proposal_id = 1 [(gogoproto.jsontag) = "proposal_id", (amino.dont_omitempty) = true]; - + uint64 proposal_id = 1 [(gogoproto.jsontag) = "proposal_id", (amino.dont_omitempty) = true]; + // voter is the voter address for the proposal. - string voter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - + string voter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // options defines the weighted vote options. - repeated WeightedVoteOption options = 3; + repeated WeightedVoteOption options = 3; // metadata is any arbitrary metadata attached to the VoteWeighted. - string metadata = 4; + string metadata = 4; } // MsgVoteWeightedResponse defines the Msg/VoteWeighted response type. @@ -137,11 +153,11 @@ message MsgDeposit { option (amino.name) = "cosmos-sdk/v1/MsgDeposit"; // proposal_id defines the unique id of the proposal. - uint64 proposal_id = 1 [(gogoproto.jsontag) = "proposal_id", (amino.dont_omitempty) = true]; - + uint64 proposal_id = 1 [(gogoproto.jsontag) = "proposal_id", (amino.dont_omitempty) = true]; + // depositor defines the deposit addresses from the proposals. - string depositor = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - + string depositor = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // amount to be deposited by depositor. repeated cosmos.base.v1beta1.Coin amount = 3 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } @@ -170,3 +186,28 @@ message MsgUpdateParams { // // Since: cosmos-sdk 0.47 message MsgUpdateParamsResponse {} + +// MsgCancelProposal is the Msg/CancelProposal request type. +// +// Since: cosmos-sdk 0.50 +message MsgCancelProposal { + option (cosmos.msg.v1.signer) = "proposer"; + + // proposal_id defines the unique id of the proposal. + uint64 proposal_id = 1 [(gogoproto.jsontag) = "proposal_id"]; + // proposer is the account address of the proposer. + string proposer = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; +} + +// MsgCancelProposalResponse defines the response structure for executing a +// MsgCancelProposal message. +// +// Since: cosmos-sdk 0.50 +message MsgCancelProposalResponse { + // proposal_id defines the unique id of the proposal. + uint64 proposal_id = 1 [(gogoproto.jsontag) = "proposal_id"]; + // canceled_time is the time when proposal is canceled. + google.protobuf.Timestamp canceled_time = 2 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; + // canceled_height defines the block height at which the proposal is canceled. + uint64 canceled_height = 3; +} diff --git a/third_party/proto/cosmos/gov/v1beta1/genesis.proto b/third_party/proto/cosmos/gov/v1beta1/genesis.proto index a680590ca5..f0c679a318 100644 --- a/third_party/proto/cosmos/gov/v1beta1/genesis.proto +++ b/third_party/proto/cosmos/gov/v1beta1/genesis.proto @@ -21,10 +21,10 @@ message GenesisState { // proposals defines all the proposals present at genesis. repeated Proposal proposals = 4 [(gogoproto.castrepeated) = "Proposals", (gogoproto.nullable) = false, (amino.dont_omitempty) = true]; - // params defines all the parameters of related to deposit. + // deposit_params defines all the parameters related to deposit. DepositParams deposit_params = 5 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; - // params defines all the parameters of related to voting. + // voting_params defines all the parameters related to voting. VotingParams voting_params = 6 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; - // params defines all the parameters of related to tally. + // tally_params defines all the parameters related to tally. TallyParams tally_params = 7 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } diff --git a/third_party/proto/cosmos/gov/v1beta1/gov.proto b/third_party/proto/cosmos/gov/v1beta1/gov.proto index dc8fcfd33f..99b97191c1 100644 --- a/third_party/proto/cosmos/gov/v1beta1/gov.proto +++ b/third_party/proto/cosmos/gov/v1beta1/gov.proto @@ -11,9 +11,7 @@ import "amino/amino.proto"; option go_package = "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"; -option (gogoproto.goproto_stringer_all) = false; -option (gogoproto.stringer_all) = false; -option (gogoproto.goproto_getters_all) = false; +option (gogoproto.goproto_getters_all) = false; // VoteOption enumerates the valid vote options for a given governance proposal. enum VoteOption { @@ -38,10 +36,11 @@ message WeightedVoteOption { // option defines the valid vote options, it must not contain duplicate vote options. VoteOption option = 1; - // weight is the vote weight associated with the vote option. - string weight = 2 [ + // weight is the vote weight associated with the vote option. + string weight = 2 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (amino.dont_omitempty) = true, (gogoproto.nullable) = false ]; } @@ -55,7 +54,7 @@ message TextProposal { option (gogoproto.equal) = true; // title of the proposal. - string title = 1; + string title = 1; // description associated with the proposal. string description = 2; @@ -68,11 +67,11 @@ message Deposit { option (gogoproto.equal) = false; // proposal_id defines the unique id of the proposal. - uint64 proposal_id = 1; - + uint64 proposal_id = 1; + // depositor defines the deposit addresses from the proposals. - string depositor = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - + string depositor = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // amount to be deposited by depositor. repeated cosmos.base.v1beta1.Coin amount = 3 [ (gogoproto.nullable) = false, @@ -86,26 +85,27 @@ message Proposal { option (gogoproto.equal) = true; // proposal_id defines the unique id of the proposal. - uint64 proposal_id = 1; + uint64 proposal_id = 1; // content is the proposal's content. google.protobuf.Any content = 2 [(cosmos_proto.accepts_interface) = "cosmos.gov.v1beta1.Content"]; + // status defines the proposal status. - ProposalStatus status = 3; - + ProposalStatus status = 3; + // final_tally_result is the final tally result of the proposal. When // querying a proposal via gRPC, this field is not populated until the // proposal's voting period has ended. - TallyResult final_tally_result = 4 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; - + TallyResult final_tally_result = 4 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + // submit_time is the time of proposal submission. - google.protobuf.Timestamp submit_time = 5 + google.protobuf.Timestamp submit_time = 5 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false, (amino.dont_omitempty) = true]; - + // deposit_end_time is the end time for deposition. google.protobuf.Timestamp deposit_end_time = 6 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false, (amino.dont_omitempty) = true]; - + // total_deposit is the total deposit on the proposal. repeated cosmos.base.v1beta1.Coin total_deposit = 7 [ (gogoproto.nullable) = false, @@ -116,7 +116,7 @@ message Proposal { // voting_start_time is the starting time to vote on a proposal. google.protobuf.Timestamp voting_start_time = 8 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false, (amino.dont_omitempty) = true]; - + // voting_end_time is the end time of voting on a proposal. google.protobuf.Timestamp voting_end_time = 9 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false, (amino.dont_omitempty) = true]; @@ -152,28 +152,28 @@ message TallyResult { // yes is the number of yes votes on a proposal. string yes = 1 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; // abstain is the number of abstain votes on a proposal. string abstain = 2 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; // no is the number of no votes on a proposal. string no = 3 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; // no_with_veto is the number of no with veto votes on a proposal. string no_with_veto = 4 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; } @@ -181,19 +181,18 @@ message TallyResult { // Vote defines a vote on a governance proposal. // A Vote consists of a proposal ID, the voter, and the vote option. message Vote { - option (gogoproto.goproto_stringer) = false; - option (gogoproto.equal) = false; + option (gogoproto.equal) = false; // proposal_id defines the unique id of the proposal. uint64 proposal_id = 1 [(gogoproto.jsontag) = "id", (amino.field_name) = "id", (amino.dont_omitempty) = true]; - + // voter is the voter address of the proposal. - string voter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string voter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // Deprecated: Prefer to use `options` instead. This field is set in queries // if and only if `len(options) == 1` and that option has weight 1. In all // other cases, this field will default to VOTE_OPTION_UNSPECIFIED. VoteOption option = 3 [deprecated = true]; - + // options is the weighted vote options. // // Since: cosmos-sdk 0.43 @@ -230,14 +229,16 @@ message TallyParams { // Minimum percentage of total stake needed to vote for a result to be // considered valid. bytes quorum = 1 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false, (gogoproto.jsontag) = "quorum,omitempty" ]; // Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. bytes threshold = 2 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false, (gogoproto.jsontag) = "threshold,omitempty" ]; @@ -245,7 +246,8 @@ message TallyParams { // Minimum value of Veto votes to Total votes ratio for proposal to be // vetoed. Default value: 1/3. bytes veto_threshold = 3 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false, (gogoproto.jsontag) = "veto_threshold,omitempty" ]; diff --git a/third_party/proto/cosmos/gov/v1beta1/query.proto b/third_party/proto/cosmos/gov/v1beta1/query.proto index f225a0f650..28352ed40c 100644 --- a/third_party/proto/cosmos/gov/v1beta1/query.proto +++ b/third_party/proto/cosmos/gov/v1beta1/query.proto @@ -37,7 +37,7 @@ service Query { option (google.api.http).get = "/cosmos/gov/v1beta1/params/{params_type}"; } - // Deposit queries single deposit information based proposalID, depositAddr. + // Deposit queries single deposit information based on proposalID, depositor address. rpc Deposit(QueryDepositRequest) returns (QueryDepositResponse) { option (google.api.http).get = "/cosmos/gov/v1beta1/proposals/{proposal_id}/deposits/{depositor}"; } diff --git a/third_party/proto/cosmos/gov/v1beta1/tx.proto b/third_party/proto/cosmos/gov/v1beta1/tx.proto index 0afa1d5670..9de763be36 100644 --- a/third_party/proto/cosmos/gov/v1beta1/tx.proto +++ b/third_party/proto/cosmos/gov/v1beta1/tx.proto @@ -11,7 +11,7 @@ import "amino/amino.proto"; option go_package = "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"; -// Msg defines the bank Msg service. +// Msg defines the gov Msg service. service Msg { option (cosmos.msg.v1.service) = true; @@ -36,17 +36,17 @@ message MsgSubmitProposal { option (cosmos.msg.v1.signer) = "proposer"; option (amino.name) = "cosmos-sdk/MsgSubmitProposal"; - option (gogoproto.equal) = false; - option (gogoproto.goproto_stringer) = false; - option (gogoproto.stringer) = false; - option (gogoproto.goproto_getters) = false; + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; // content is the proposal's content. google.protobuf.Any content = 1 [(cosmos_proto.accepts_interface) = "cosmos.gov.v1beta1.Content"]; + // initial_deposit is the deposit value that must be paid at proposal submission. repeated cosmos.base.v1beta1.Coin initial_deposit = 2 [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true, + (amino.encoding) = "legacy_coins", (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" ]; @@ -65,19 +65,17 @@ message MsgVote { option (cosmos.msg.v1.signer) = "voter"; option (amino.name) = "cosmos-sdk/MsgVote"; - option (gogoproto.equal) = false; - option (gogoproto.goproto_stringer) = false; - option (gogoproto.stringer) = false; - option (gogoproto.goproto_getters) = false; + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; // proposal_id defines the unique id of the proposal. - uint64 proposal_id = 1; + uint64 proposal_id = 1; // voter is the voter address for the proposal. - string voter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - + string voter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // option defines the vote option. - VoteOption option = 3; + VoteOption option = 3; } // MsgVoteResponse defines the Msg/Vote response type. @@ -90,19 +88,17 @@ message MsgVoteWeighted { option (cosmos.msg.v1.signer) = "voter"; option (amino.name) = "cosmos-sdk/MsgVoteWeighted"; - option (gogoproto.equal) = false; - option (gogoproto.goproto_stringer) = false; - option (gogoproto.stringer) = false; - option (gogoproto.goproto_getters) = false; + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; // proposal_id defines the unique id of the proposal. - uint64 proposal_id = 1 [(gogoproto.jsontag) = "proposal_id", (amino.dont_omitempty) = true]; + uint64 proposal_id = 1 [(gogoproto.jsontag) = "proposal_id", (amino.dont_omitempty) = true]; // voter is the voter address for the proposal. - string voter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - - // options defines the weighted vote options. - repeated WeightedVoteOption options = 3 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + string voter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + // options defines the weighted vote options. + repeated WeightedVoteOption options = 3 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } // MsgVoteWeightedResponse defines the Msg/VoteWeighted response type. @@ -115,21 +111,21 @@ message MsgDeposit { option (cosmos.msg.v1.signer) = "depositor"; option (amino.name) = "cosmos-sdk/MsgDeposit"; - option (gogoproto.equal) = false; - option (gogoproto.goproto_stringer) = false; - option (gogoproto.stringer) = false; - option (gogoproto.goproto_getters) = false; + option (gogoproto.equal) = false; + option (gogoproto.stringer) = false; + option (gogoproto.goproto_getters) = false; // proposal_id defines the unique id of the proposal. - uint64 proposal_id = 1 [(gogoproto.jsontag) = "proposal_id", (amino.dont_omitempty) = true]; - + uint64 proposal_id = 1 [(gogoproto.jsontag) = "proposal_id", (amino.dont_omitempty) = true]; + // depositor defines the deposit addresses from the proposals. - string depositor = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - + string depositor = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // amount to be deposited by depositor. repeated cosmos.base.v1beta1.Coin amount = 3 [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true, + (amino.encoding) = "legacy_coins", (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" ]; } diff --git a/third_party/proto/cosmos/group/v1/tx.proto b/third_party/proto/cosmos/group/v1/tx.proto index 20e04cb7ea..5a5f028bb3 100644 --- a/third_party/proto/cosmos/group/v1/tx.proto +++ b/third_party/proto/cosmos/group/v1/tx.proto @@ -362,7 +362,7 @@ message MsgVoteResponse {} // MsgExec is the Msg/Exec request type. message MsgExec { - option (cosmos.msg.v1.signer) = "signer"; + option (cosmos.msg.v1.signer) = "executor"; option (amino.name) = "cosmos-sdk/group/MsgExec"; // proposal is the unique ID of the proposal. diff --git a/third_party/proto/cosmos/group/v1/types.proto b/third_party/proto/cosmos/group/v1/types.proto index 4968d13cb7..97af45fff7 100644 --- a/third_party/proto/cosmos/group/v1/types.proto +++ b/third_party/proto/cosmos/group/v1/types.proto @@ -131,6 +131,7 @@ message GroupInfo { string admin = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // metadata is any arbitrary metadata to attached to the group. + // the recommended format of the metadata is to be found here: https://docs.cosmos.network/v0.47/modules/group#group-1 string metadata = 3; // version is used to track changes to a group's membership structure that @@ -317,7 +318,7 @@ message TallyResult { string no_with_veto_count = 4; } -// Vote represents a vote for a proposal. +// Vote represents a vote for a proposal.string metadata message Vote { // proposal is the unique ID of the proposal. uint64 proposal_id = 1; @@ -329,6 +330,7 @@ message Vote { VoteOption option = 3; // metadata is any arbitrary metadata attached to the vote. + // the recommended format of the metadata is to be found here: https://docs.cosmos.network/v0.47/modules/group#vote-2 string metadata = 4; // submit_time is the timestamp when the vote was submitted. diff --git a/third_party/proto/cosmos/ics23/v1/proofs.proto b/third_party/proto/cosmos/ics23/v1/proofs.proto index beac166b44..7605aa1a3c 100644 --- a/third_party/proto/cosmos/ics23/v1/proofs.proto +++ b/third_party/proto/cosmos/ics23/v1/proofs.proto @@ -6,13 +6,16 @@ option go_package = "github.com/cosmos/ics23/go;ics23"; enum HashOp { // NO_HASH is the default if no data passed. Note this is an illegal argument some places. - NO_HASH = 0; - SHA256 = 1; - SHA512 = 2; - KECCAK = 3; - RIPEMD160 = 4; - BITCOIN = 5; // ripemd160(sha256(x)) - SHA512_256 = 6; + NO_HASH = 0; + SHA256 = 1; + SHA512 = 2; + KECCAK256 = 3; + RIPEMD160 = 4; + BITCOIN = 5; // ripemd160(sha256(x)) + SHA512_256 = 6; + BLAKE2B_512 = 7; + BLAKE2S_256 = 8; + BLAKE3 = 9; } /** @@ -160,6 +163,7 @@ message ProofSpec { LeafOp leaf_spec = 1; InnerSpec inner_spec = 2; // max_depth (if > 0) is the maximum number of InnerOps allowed (mainly for fixed-depth tries) + // the max_depth is interpreted as 128 if set to 0 int32 max_depth = 3; // min_depth (if > 0) is the minimum number of InnerOps allowed (mainly for fixed-depth tries) int32 min_depth = 4; diff --git a/third_party/proto/cosmos/mint/v1beta1/mint.proto b/third_party/proto/cosmos/mint/v1beta1/mint.proto index 49b00a5d47..440a392dbd 100644 --- a/third_party/proto/cosmos/mint/v1beta1/mint.proto +++ b/third_party/proto/cosmos/mint/v1beta1/mint.proto @@ -12,47 +12,50 @@ message Minter { // current annual inflation rate string inflation = 1 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; // current annual expected provisions string annual_provisions = 2 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; } // Params defines the parameters for the x/mint module. message Params { - option (gogoproto.goproto_stringer) = false; - option (amino.name) = "cosmos-sdk/x/mint/Params"; + option (amino.name) = "cosmos-sdk/x/mint/Params"; // type of coin to mint string mint_denom = 1; // maximum annual change in inflation rate string inflation_rate_change = 2 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true ]; // maximum inflation rate string inflation_max = 3 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true ]; // minimum inflation rate string inflation_min = 4 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true ]; // goal of percent bonded atoms string goal_bonded = 5 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true ]; // expected blocks per year uint64 blocks_per_year = 6; diff --git a/third_party/proto/cosmos/mint/v1beta1/query.proto b/third_party/proto/cosmos/mint/v1beta1/query.proto index 002f2744c2..db5c90fb31 100644 --- a/third_party/proto/cosmos/mint/v1beta1/query.proto +++ b/third_party/proto/cosmos/mint/v1beta1/query.proto @@ -5,6 +5,7 @@ import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; import "cosmos/mint/v1beta1/mint.proto"; import "amino/amino.proto"; +import "cosmos_proto/cosmos.proto"; option go_package = "github.com/cosmos/cosmos-sdk/x/mint/types"; @@ -43,7 +44,8 @@ message QueryInflationRequest {} message QueryInflationResponse { // inflation is the current minting inflation value. bytes inflation = 1 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; @@ -58,7 +60,8 @@ message QueryAnnualProvisionsRequest {} message QueryAnnualProvisionsResponse { // annual_provisions is the current minting annual provisions value. bytes annual_provisions = 1 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; diff --git a/third_party/proto/cosmos/msg/textual/v1/textual.proto b/third_party/proto/cosmos/msg/textual/v1/textual.proto new file mode 100644 index 0000000000..4f8cd141b0 --- /dev/null +++ b/third_party/proto/cosmos/msg/textual/v1/textual.proto @@ -0,0 +1,18 @@ +syntax = "proto3"; + +package cosmos.msg.textual.v1; + +import "google/protobuf/descriptor.proto"; + +extend google.protobuf.MessageOptions { + // expert_custom_renderer is an informative identifier to reference the + // algorithm used to generate the custom textual representation of the + // protobuf message where this annotation is applied. We recommend to use a + // short, versioned name as this identifier, e.g. "replace_with_username_v1". + // We also recommand providing a human-readable description as protobuf + // comments on this annotation, for example a short specification or a link + // to the relevant documentation. + // + // Also see the section on Custom Message Renderers in ADR-050. + string expert_custom_renderer = 11110009; +} diff --git a/third_party/proto/cosmos/nft/module/v1/module.proto b/third_party/proto/cosmos/nft/module/v1/module.proto index 8f820fa083..a5c2c63429 100644 --- a/third_party/proto/cosmos/nft/module/v1/module.proto +++ b/third_party/proto/cosmos/nft/module/v1/module.proto @@ -7,6 +7,6 @@ import "cosmos/app/v1alpha1/module.proto"; // Module is the config object of the nft module. message Module { option (cosmos.app.v1alpha1.module) = { - go_import: "github.com/cosmos/cosmos-sdk/x/nft" + go_import: "cosmossdk.io/x/nft" }; } \ No newline at end of file diff --git a/third_party/proto/cosmos/nft/v1beta1/event.proto b/third_party/proto/cosmos/nft/v1beta1/event.proto index 2f6d5a0d2c..d2cb29d2b2 100644 --- a/third_party/proto/cosmos/nft/v1beta1/event.proto +++ b/third_party/proto/cosmos/nft/v1beta1/event.proto @@ -1,7 +1,7 @@ syntax = "proto3"; package cosmos.nft.v1beta1; -option go_package = "github.com/cosmos/cosmos-sdk/x/nft"; +option go_package = "cosmossdk.io/x/nft"; // EventSend is emitted on Msg/Send message EventSend { diff --git a/third_party/proto/cosmos/nft/v1beta1/genesis.proto b/third_party/proto/cosmos/nft/v1beta1/genesis.proto index 75b5245a9d..441b48b1b1 100644 --- a/third_party/proto/cosmos/nft/v1beta1/genesis.proto +++ b/third_party/proto/cosmos/nft/v1beta1/genesis.proto @@ -3,7 +3,7 @@ package cosmos.nft.v1beta1; import "cosmos/nft/v1beta1/nft.proto"; -option go_package = "github.com/cosmos/cosmos-sdk/x/nft"; +option go_package = "cosmossdk.io/x/nft"; // GenesisState defines the nft module's genesis state. message GenesisState { diff --git a/third_party/proto/cosmos/nft/v1beta1/nft.proto b/third_party/proto/cosmos/nft/v1beta1/nft.proto index b124126003..4234bd4291 100644 --- a/third_party/proto/cosmos/nft/v1beta1/nft.proto +++ b/third_party/proto/cosmos/nft/v1beta1/nft.proto @@ -3,7 +3,7 @@ package cosmos.nft.v1beta1; import "google/protobuf/any.proto"; -option go_package = "github.com/cosmos/cosmos-sdk/x/nft"; +option go_package = "cosmossdk.io/x/nft"; // Class defines the class of the nft type. message Class { diff --git a/third_party/proto/cosmos/nft/v1beta1/query.proto b/third_party/proto/cosmos/nft/v1beta1/query.proto index ae482e4ce2..bdc794ff6c 100644 --- a/third_party/proto/cosmos/nft/v1beta1/query.proto +++ b/third_party/proto/cosmos/nft/v1beta1/query.proto @@ -5,7 +5,7 @@ import "cosmos/base/query/v1beta1/pagination.proto"; import "google/api/annotations.proto"; import "cosmos/nft/v1beta1/nft.proto"; -option go_package = "github.com/cosmos/cosmos-sdk/x/nft"; +option go_package = "cosmossdk.io/x/nft"; // Query defines the gRPC querier service. service Query { diff --git a/third_party/proto/cosmos/nft/v1beta1/tx.proto b/third_party/proto/cosmos/nft/v1beta1/tx.proto index 0637cd8d89..9eecfdd2d5 100644 --- a/third_party/proto/cosmos/nft/v1beta1/tx.proto +++ b/third_party/proto/cosmos/nft/v1beta1/tx.proto @@ -1,7 +1,7 @@ syntax = "proto3"; package cosmos.nft.v1beta1; -option go_package = "github.com/cosmos/cosmos-sdk/x/nft"; +option go_package = "cosmossdk.io/x/nft"; import "cosmos_proto/cosmos.proto"; import "cosmos/msg/v1/msg.proto"; diff --git a/third_party/proto/cosmos/orm/module/v1alpha1/module.proto b/third_party/proto/cosmos/orm/module/v1alpha1/module.proto index cb7bbbeeaf..260db36997 100644 --- a/third_party/proto/cosmos/orm/module/v1alpha1/module.proto +++ b/third_party/proto/cosmos/orm/module/v1alpha1/module.proto @@ -5,10 +5,10 @@ package cosmos.orm.module.v1alpha1; import "cosmos/app/v1alpha1/module.proto"; // Module defines the ORM module which adds providers to the app container for -// module-scoped DB's. In the future it may provide gRPC services for interacting -// with ORM data. +// ORM ModuleDB's and in the future will automatically register query +// services for modules that use the ORM. message Module { option (cosmos.app.v1alpha1.module) = { - go_import: "github.com/cosmos/cosmos-sdk/orm" + go_import: "cosmossdk.io/orm" }; } diff --git a/third_party/proto/cosmos/orm/v1/orm.proto b/third_party/proto/cosmos/orm/v1/orm.proto index 389babd196..e8509392b8 100644 --- a/third_party/proto/cosmos/orm/v1/orm.proto +++ b/third_party/proto/cosmos/orm/v1/orm.proto @@ -52,8 +52,11 @@ message PrimaryKeyDescriptor { // with a 32-bit unsigned varint in non-terminal segments. // - int32, sint32, int64, sint64, sfixed32, sfixed64 are encoded as fixed width bytes with // an encoding that enables sorted iteration. - // - google.protobuf.Timestamp and google.protobuf.Duration are encoded - // as 12 bytes using an encoding that enables sorted iteration. + // - google.protobuf.Timestamp is encoded such that values with only seconds occupy 6 bytes, + // values including nanos occupy 9 bytes, and nil values occupy 1 byte. When iterating, nil + // values will always be ordered last. Seconds and nanos values must conform to the officially + // specified ranges of 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z and 0 to 999,999,999 respectively. + // - google.protobuf.Duration is encoded as 12 bytes using an encoding that enables sorted iteration. // - enum fields are encoded using varint encoding and do not support sorted // iteration. // - bool fields are encoded as a single byte 0 or 1. diff --git a/third_party/proto/cosmos/orm/v1alpha1/schema.proto b/third_party/proto/cosmos/orm/v1alpha1/schema.proto index ab713340e3..cbe90de3d3 100644 --- a/third_party/proto/cosmos/orm/v1alpha1/schema.proto +++ b/third_party/proto/cosmos/orm/v1alpha1/schema.proto @@ -40,11 +40,8 @@ message ModuleSchemaDescriptor { // StorageType enum StorageType { - // STORAGE_TYPE_DEFAULT_UNSPECIFIED indicates the persistent - // KV-storage where primary key entries are stored in merkle-tree - // backed commitment storage and indexes and seqs are stored in - // fast index storage. Note that the Cosmos SDK before store/v2alpha1 - // does not support this. + // STORAGE_TYPE_DEFAULT_UNSPECIFIED indicates the persistent storage where all + // data is stored in the regular Merkle-tree backed KV-store. STORAGE_TYPE_DEFAULT_UNSPECIFIED = 0; // STORAGE_TYPE_MEMORY indicates in-memory storage that will be @@ -58,19 +55,4 @@ enum StorageType { // will by default be ignored when importing and exporting a module's // state from JSON. STORAGE_TYPE_TRANSIENT = 2; - - // STORAGE_TYPE_INDEX indicates persistent storage which is not backed - // by a merkle-tree and won't affect the app hash. Note that the Cosmos SDK - // before store/v2alpha1 does not support this. - STORAGE_TYPE_INDEX = 3; - - // STORAGE_TYPE_INDEX indicates persistent storage which is backed by - // a merkle-tree. With this type of storage, both primary and index keys - // will affect the app hash and this is generally less efficient - // than using STORAGE_TYPE_DEFAULT_UNSPECIFIED which separates index - // keys into index storage. Note that modules built with the - // Cosmos SDK before store/v2alpha1 must specify STORAGE_TYPE_COMMITMENT - // instead of STORAGE_TYPE_DEFAULT_UNSPECIFIED or STORAGE_TYPE_INDEX - // because this is the only type of persistent storage available. - STORAGE_TYPE_COMMITMENT = 4; } diff --git a/third_party/proto/cosmos/params/v1beta1/params.proto b/third_party/proto/cosmos/params/v1beta1/params.proto index 7bda4651c5..c8efa13106 100644 --- a/third_party/proto/cosmos/params/v1beta1/params.proto +++ b/third_party/proto/cosmos/params/v1beta1/params.proto @@ -11,7 +11,6 @@ import "amino/amino.proto"; // ParameterChangeProposal defines a proposal to change one or more parameters. message ParameterChangeProposal { option (gogoproto.goproto_getters) = false; - option (gogoproto.goproto_stringer) = false; option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content"; option (amino.name) = "cosmos-sdk/ParameterChangeProposal"; @@ -23,8 +22,6 @@ message ParameterChangeProposal { // ParamChange defines an individual parameter change, for use in // ParameterChangeProposal. message ParamChange { - option (gogoproto.goproto_stringer) = false; - string subspace = 1; string key = 2; string value = 3; diff --git a/third_party/proto/cosmos/slashing/v1beta1/genesis.proto b/third_party/proto/cosmos/slashing/v1beta1/genesis.proto index 36bcf76ff8..a2f516bbe7 100644 --- a/third_party/proto/cosmos/slashing/v1beta1/genesis.proto +++ b/third_party/proto/cosmos/slashing/v1beta1/genesis.proto @@ -25,7 +25,7 @@ message GenesisState { // SigningInfo stores validator signing info of corresponding address. message SigningInfo { // address is the validator address. - string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string address = 1 [(cosmos_proto.scalar) = "cosmos.ConsensusAddressString"]; // validator_signing_info represents the signing info of this validator. ValidatorSigningInfo validator_signing_info = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } @@ -34,7 +34,7 @@ message SigningInfo { // address. message ValidatorMissedBlocks { // address is the validator address. - string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string address = 1 [(cosmos_proto.scalar) = "cosmos.ConsensusAddressString"]; // missed_blocks is an array of missed blocks by the validator. repeated MissedBlock missed_blocks = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } diff --git a/third_party/proto/cosmos/slashing/v1beta1/query.proto b/third_party/proto/cosmos/slashing/v1beta1/query.proto index 761e1a4b86..e7279709ed 100644 --- a/third_party/proto/cosmos/slashing/v1beta1/query.proto +++ b/third_party/proto/cosmos/slashing/v1beta1/query.proto @@ -40,7 +40,7 @@ message QueryParamsResponse { // method message QuerySigningInfoRequest { // cons_address is the address to query signing info of - string cons_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string cons_address = 1 [(cosmos_proto.scalar) = "cosmos.ConsensusAddressString"]; } // QuerySigningInfoResponse is the response type for the Query/SigningInfo RPC diff --git a/third_party/proto/cosmos/slashing/v1beta1/slashing.proto b/third_party/proto/cosmos/slashing/v1beta1/slashing.proto index dc1f421188..2347f34973 100644 --- a/third_party/proto/cosmos/slashing/v1beta1/slashing.proto +++ b/third_party/proto/cosmos/slashing/v1beta1/slashing.proto @@ -13,24 +13,24 @@ import "amino/amino.proto"; // ValidatorSigningInfo defines a validator's signing info for monitoring their // liveness activity. message ValidatorSigningInfo { - option (gogoproto.equal) = true; - option (gogoproto.goproto_stringer) = false; + option (gogoproto.equal) = true; - string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - // Height at which validator was first a candidate OR was unjailed + string address = 1 [(cosmos_proto.scalar) = "cosmos.ConsensusAddressString"]; + // Height at which validator was first a candidate OR was un-jailed int64 start_height = 2; - // Index which is incremented each time the validator was a bonded - // in a block and may have signed a precommit or not. This in conjunction with the - // `SignedBlocksWindow` param determines the index in the `MissedBlocksBitArray`. + // Index which is incremented every time a validator is bonded in a block and + // _may_ have signed a pre-commit or not. This in conjunction with the + // signed_blocks_window param determines the index in the missed block bitmap. int64 index_offset = 3; // Timestamp until which the validator is jailed due to liveness downtime. google.protobuf.Timestamp jailed_until = 4 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false, (amino.dont_omitempty) = true]; - // Whether or not a validator has been tombstoned (killed out of validator set). It is set - // once the validator commits an equivocation or for any other configured misbehiavor. + // Whether or not a validator has been tombstoned (killed out of validator + // set). It is set once the validator commits an equivocation or for any other + // configured misbehavior. bool tombstoned = 5; - // A counter kept to avoid unnecessary array reads. - // Note that `Sum(MissedBlocksBitArray)` always equals `MissedBlocksCounter`. + // A counter of missed (unsigned) blocks. It is used to avoid unnecessary + // reads in the missed block bitmap. int64 missed_blocks_counter = 6; } @@ -40,19 +40,22 @@ message Params { int64 signed_blocks_window = 1; bytes min_signed_per_window = 2 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; google.protobuf.Duration downtime_jail_duration = 3 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true, (gogoproto.stdduration) = true]; bytes slash_fraction_double_sign = 4 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; bytes slash_fraction_downtime = 5 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; diff --git a/third_party/proto/cosmos/slashing/v1beta1/tx.proto b/third_party/proto/cosmos/slashing/v1beta1/tx.proto index 300fc7755e..2499b4fd05 100644 --- a/third_party/proto/cosmos/slashing/v1beta1/tx.proto +++ b/third_party/proto/cosmos/slashing/v1beta1/tx.proto @@ -31,11 +31,10 @@ message MsgUnjail { option (cosmos.msg.v1.signer) = "validator_addr"; option (amino.name) = "cosmos-sdk/MsgUnjail"; - option (gogoproto.goproto_getters) = false; - option (gogoproto.goproto_stringer) = true; + option (gogoproto.goproto_getters) = false; string validator_addr = 1 [ - (cosmos_proto.scalar) = "cosmos.AddressString", + (cosmos_proto.scalar) = "cosmos.ValidatorAddressString", (gogoproto.jsontag) = "address", (amino.field_name) = "address", (amino.dont_omitempty) = true diff --git a/third_party/proto/cosmos/staking/module/v1/module.proto b/third_party/proto/cosmos/staking/module/v1/module.proto index 7ef4a06cf0..fd92a54805 100644 --- a/third_party/proto/cosmos/staking/module/v1/module.proto +++ b/third_party/proto/cosmos/staking/module/v1/module.proto @@ -17,4 +17,10 @@ message Module { // authority defines the custom module authority. If not set, defaults to the governance module. string authority = 2; + + // bech32_prefix_validator is the bech32 validator prefix for the app. + string bech32_prefix_validator = 3; + + // bech32_prefix_consensus is the bech32 consensus node prefix for the app. + string bech32_prefix_consensus = 4; } diff --git a/third_party/proto/cosmos/staking/v1beta1/authz.proto b/third_party/proto/cosmos/staking/v1beta1/authz.proto index 055d1b6452..409280c1ed 100644 --- a/third_party/proto/cosmos/staking/v1beta1/authz.proto +++ b/third_party/proto/cosmos/staking/v1beta1/authz.proto @@ -22,9 +22,9 @@ message StakeAuthorization { oneof validators { // allow_list specifies list of validator addresses to whom grantee can delegate tokens on behalf of granter's // account. - Validators allow_list = 2; + Validators allow_list = 2 [(amino.oneof_name) = "cosmos-sdk/StakeAuthorization/AllowList"]; // deny_list specifies list of validator addresses to whom grantee can not delegate tokens. - Validators deny_list = 3; + Validators deny_list = 3 [(amino.oneof_name) = "cosmos-sdk/StakeAuthorization/DenyList"]; } // Validators defines list of validator addresses. message Validators { @@ -46,4 +46,6 @@ enum AuthorizationType { AUTHORIZATION_TYPE_UNDELEGATE = 2; // AUTHORIZATION_TYPE_REDELEGATE defines an authorization type for Msg/BeginRedelegate AUTHORIZATION_TYPE_REDELEGATE = 3; + // AUTHORIZATION_TYPE_CANCEL_UNBONDING_DELEGATION defines an authorization type for Msg/MsgCancelUnbondingDelegation + AUTHORIZATION_TYPE_CANCEL_UNBONDING_DELEGATION = 4; } diff --git a/third_party/proto/cosmos/staking/v1beta1/genesis.proto b/third_party/proto/cosmos/staking/v1beta1/genesis.proto index 482d50ccb1..c3f1ce5dee 100644 --- a/third_party/proto/cosmos/staking/v1beta1/genesis.proto +++ b/third_party/proto/cosmos/staking/v1beta1/genesis.proto @@ -16,7 +16,8 @@ message GenesisState { // last_total_power tracks the total amounts of bonded tokens recorded during // the previous end block. bytes last_total_power = 2 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (cosmos_proto.scalar) = "cosmos.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; @@ -25,7 +26,7 @@ message GenesisState { // of the last-block's bonded validators. repeated LastValidatorPower last_validator_powers = 3 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; - // delegations defines the validator set at genesis. + // validators defines the validator set at genesis. repeated Validator validators = 4 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; // delegations defines the delegations active at genesis. @@ -37,6 +38,7 @@ message GenesisState { // redelegations defines the redelegations active at genesis. repeated Redelegation redelegations = 7 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + // exported defines a bool to identify whether the chain dealing with exported or initialized genesis. bool exported = 8; } diff --git a/third_party/proto/cosmos/staking/v1beta1/query.proto b/third_party/proto/cosmos/staking/v1beta1/query.proto index 06eb5551c9..08eb9f3245 100644 --- a/third_party/proto/cosmos/staking/v1beta1/query.proto +++ b/third_party/proto/cosmos/staking/v1beta1/query.proto @@ -151,7 +151,7 @@ message QueryValidatorsResponse { // QueryValidatorRequest is response type for the Query/Validator RPC method message QueryValidatorRequest { // validator_addr defines the validator address to query for. - string validator_addr = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string validator_addr = 1 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; } // QueryValidatorResponse is response type for the Query/Validator RPC method @@ -164,7 +164,7 @@ message QueryValidatorResponse { // Query/ValidatorDelegations RPC method message QueryValidatorDelegationsRequest { // validator_addr defines the validator address to query for. - string validator_addr = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string validator_addr = 1 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; // pagination defines an optional pagination for the request. cosmos.base.query.v1beta1.PageRequest pagination = 2; @@ -184,7 +184,7 @@ message QueryValidatorDelegationsResponse { // Query/ValidatorUnbondingDelegations RPC method message QueryValidatorUnbondingDelegationsRequest { // validator_addr defines the validator address to query for. - string validator_addr = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string validator_addr = 1 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; // pagination defines an optional pagination for the request. cosmos.base.query.v1beta1.PageRequest pagination = 2; @@ -208,7 +208,7 @@ message QueryDelegationRequest { string delegator_addr = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // validator_addr defines the validator address to query for. - string validator_addr = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string validator_addr = 2 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; } // QueryDelegationResponse is response type for the Query/Delegation RPC method. @@ -227,7 +227,7 @@ message QueryUnbondingDelegationRequest { string delegator_addr = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // validator_addr defines the validator address to query for. - string validator_addr = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string validator_addr = 2 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; } // QueryDelegationResponse is response type for the Query/UnbondingDelegation @@ -344,7 +344,7 @@ message QueryDelegatorValidatorRequest { string delegator_addr = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // validator_addr defines the validator address to query for. - string validator_addr = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string validator_addr = 2 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; } // QueryDelegatorValidatorResponse response type for the diff --git a/third_party/proto/cosmos/staking/v1beta1/staking.proto b/third_party/proto/cosmos/staking/v1beta1/staking.proto index e7620c557e..24ec65d102 100644 --- a/third_party/proto/cosmos/staking/v1beta1/staking.proto +++ b/third_party/proto/cosmos/staking/v1beta1/staking.proto @@ -26,33 +26,34 @@ message HistoricalInfo { // CommissionRates defines the initial commission rates to be used for creating // a validator. message CommissionRates { - option (gogoproto.equal) = true; - option (gogoproto.goproto_stringer) = false; + option (gogoproto.equal) = true; // rate is the commission rate charged to delegators, as a fraction. string rate = 1 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true ]; // max_rate defines the maximum commission rate which validator can ever charge, as a fraction. string max_rate = 2 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true ]; // max_change_rate defines the maximum daily increase of the validator commission, as a fraction. string max_change_rate = 3 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true ]; } // Commission defines commission parameters for a given validator. message Commission { - option (gogoproto.equal) = true; - option (gogoproto.goproto_stringer) = false; + option (gogoproto.equal) = true; // commission_rates defines the initial commission rates to be used for creating a validator. CommissionRates commission_rates = 1 @@ -64,8 +65,7 @@ message Commission { // Description defines a validator description. message Description { - option (gogoproto.equal) = true; - option (gogoproto.goproto_stringer) = false; + option (gogoproto.equal) = true; // moniker defines a human-readable name for the validator. string moniker = 1; @@ -88,9 +88,8 @@ message Description { // exchange rate. Voting power can be calculated as total bonded shares // multiplied by exchange rate. message Validator { - option (gogoproto.equal) = false; - option (gogoproto.goproto_stringer) = false; - option (gogoproto.goproto_getters) = false; + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; // operator_address defines the address of the validator's operator; bech encoded in JSON. string operator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; @@ -103,13 +102,13 @@ message Validator { // tokens define the delegated tokens (incl. self-delegation). string tokens = 5 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; // delegator_shares defines total shares issued to a validator's delegators. string delegator_shares = 6 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; // description defines the description terms for the validator. @@ -126,7 +125,7 @@ message Validator { // Since: cosmos-sdk 0.46 string min_self_delegation = 11 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; @@ -153,9 +152,6 @@ enum BondStatus { // ValAddresses defines a repeated set of validator addresses. message ValAddresses { - option (gogoproto.goproto_stringer) = false; - option (gogoproto.stringer) = true; - repeated string addresses = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; } @@ -163,12 +159,11 @@ message ValAddresses { // It is intended to be used as a marshalable pointer. For example, a DVPair can // be used to construct the key to getting an UnbondingDelegation from state. message DVPair { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - option (gogoproto.goproto_stringer) = false; + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; } // DVPairs defines an array of DVPair objects. @@ -181,13 +176,12 @@ message DVPairs { // example, a DVVTriplet can be used to construct the key to getting a // Redelegation from state. message DVVTriplet { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - option (gogoproto.goproto_stringer) = false; + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - string validator_src_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - string validator_dst_address = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string validator_src_address = 2 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; + string validator_dst_address = 3 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; } // DVVTriplets defines an array of DVVTriplet objects. @@ -199,18 +193,17 @@ message DVVTriplets { // owned by one delegator, and is associated with the voting power of one // validator. message Delegation { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - option (gogoproto.goproto_stringer) = false; + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; - // delegator_address is the bech32-encoded address of the delegator. + // delegator_address is the encoded address of the delegator. string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - // validator_address is the bech32-encoded address of the validator. - string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // validator_address is the encoded address of the validator. + string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; // shares define the delegation shares received. string shares = 3 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; } @@ -218,14 +211,13 @@ message Delegation { // UnbondingDelegation stores all of a single delegator's unbonding bonds // for a single validator in an time-ordered list. message UnbondingDelegation { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - option (gogoproto.goproto_stringer) = false; + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; - // delegator_address is the bech32-encoded address of the delegator. + // delegator_address is the encoded address of the delegator. string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - // validator_address is the bech32-encoded address of the validator. - string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // validator_address is the encoded address of the validator. + string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; // entries are the unbonding delegation entries. repeated UnbondingDelegationEntry entries = 3 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; // unbonding delegation entries @@ -233,8 +225,7 @@ message UnbondingDelegation { // UnbondingDelegationEntry defines an unbonding object with relevant metadata. message UnbondingDelegationEntry { - option (gogoproto.equal) = true; - option (gogoproto.goproto_stringer) = false; + option (gogoproto.equal) = true; // creation_height is the height which the unbonding took place. int64 creation_height = 1; @@ -244,13 +235,13 @@ message UnbondingDelegationEntry { // initial_balance defines the tokens initially scheduled to receive at completion. string initial_balance = 3 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; // balance defines the tokens to receive at completion. string balance = 4 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; // Incrementing id that uniquely identifies this entry @@ -262,8 +253,7 @@ message UnbondingDelegationEntry { // RedelegationEntry defines a redelegation object with relevant metadata. message RedelegationEntry { - option (gogoproto.equal) = true; - option (gogoproto.goproto_stringer) = false; + option (gogoproto.equal) = true; // creation_height defines the height which the redelegation took place. int64 creation_height = 1; @@ -273,13 +263,13 @@ message RedelegationEntry { // initial_balance defines the initial balance when redelegation started. string initial_balance = 3 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; // shares_dst is the amount of destination-validator shares created by redelegation. string shares_dst = 4 [ (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; // Incrementing id that uniquely identifies this entry @@ -292,16 +282,15 @@ message RedelegationEntry { // Redelegation contains the list of a particular delegator's redelegating bonds // from a particular source validator to a particular destination validator. message Redelegation { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - option (gogoproto.goproto_stringer) = false; + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; // delegator_address is the bech32-encoded address of the delegator. string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // validator_src_address is the validator redelegation source operator address. - string validator_src_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string validator_src_address = 2 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; // validator_dst_address is the validator redelegation destination operator address. - string validator_dst_address = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string validator_dst_address = 3 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; // entries are the redelegation entries. repeated RedelegationEntry entries = 4 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; // redelegation entries @@ -309,9 +298,8 @@ message Redelegation { // Params defines the parameters for the x/staking module. message Params { - option (amino.name) = "cosmos-sdk/x/staking/Params"; - option (gogoproto.equal) = true; - option (gogoproto.goproto_stringer) = false; + option (amino.name) = "cosmos-sdk/x/staking/Params"; + option (gogoproto.equal) = true; // unbonding_time is the time duration of unbonding. google.protobuf.Duration unbonding_time = 1 @@ -327,16 +315,17 @@ message Params { // min_commission_rate is the chain-wide minimum commission rate that a validator can charge their delegators string min_commission_rate = 6 [ (gogoproto.moretags) = "yaml:\"min_commission_rate\"", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true, + (cosmos_proto.scalar) = "cosmos.Dec" ]; } // DelegationResponse is equivalent to Delegation except that it contains a // balance in addition to shares which is more suitable for client responses. message DelegationResponse { - option (gogoproto.equal) = false; - option (gogoproto.goproto_stringer) = false; + option (gogoproto.equal) = false; Delegation delegation = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; @@ -352,7 +341,7 @@ message RedelegationEntryResponse { RedelegationEntry redelegation_entry = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; string balance = 4 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; } @@ -374,14 +363,14 @@ message Pool { option (gogoproto.equal) = true; string not_bonded_tokens = 1 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false, (gogoproto.jsontag) = "not_bonded_tokens", (amino.dont_omitempty) = true ]; string bonded_tokens = 2 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false, (gogoproto.jsontag) = "bonded_tokens", (amino.dont_omitempty) = true diff --git a/third_party/proto/cosmos/staking/v1beta1/tx.proto b/third_party/proto/cosmos/staking/v1beta1/tx.proto index 42e2218eaf..238645ba92 100644 --- a/third_party/proto/cosmos/staking/v1beta1/tx.proto +++ b/third_party/proto/cosmos/staking/v1beta1/tx.proto @@ -49,10 +49,6 @@ service Msg { // MsgCreateValidator defines a SDK message for creating a new validator. message MsgCreateValidator { - // NOTE(fdymylja): this is a particular case in which - // if validator_address == delegator_address then only one - // is expected to sign, otherwise both are. - option (cosmos.msg.v1.signer) = "delegator_address"; option (cosmos.msg.v1.signer) = "validator_address"; option (amino.name) = "cosmos-sdk/MsgCreateValidator"; @@ -63,11 +59,15 @@ message MsgCreateValidator { CommissionRates commission = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; string min_self_delegation = 3 [ (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", - (gogoproto.nullable) = false + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true ]; - string delegator_address = 4 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - string validator_address = 5 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // Deprecated: Use of Delegator Address in MsgCreateValidator is deprecated. + // The validator address bytes and delegator address bytes refer to the same account while creating validator (defer + // only in bech32 notation). + string delegator_address = 4 [(cosmos_proto.scalar) = "cosmos.AddressString", deprecated = true]; + string validator_address = 5 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; google.protobuf.Any pubkey = 6 [(cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey"]; cosmos.base.v1beta1.Coin value = 7 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } @@ -84,16 +84,16 @@ message MsgEditValidator { option (gogoproto.goproto_getters) = false; Description description = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; - string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; // We pass a reference to the new commission rate and min self delegation as // it's not mandatory to update. If not updated, the deserialized rate will be // zero with no way to distinguish if an update was intended. // REF: #2373 string commission_rate = 3 - [(cosmos_proto.scalar) = "cosmos.Dec", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec"]; + [(cosmos_proto.scalar) = "cosmos.Dec", (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec"]; string min_self_delegation = 4 - [(cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int"]; + [(cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "cosmossdk.io/math.Int"]; } // MsgEditValidatorResponse defines the Msg/EditValidator response type. @@ -109,7 +109,7 @@ message MsgDelegate { option (gogoproto.goproto_getters) = false; string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; cosmos.base.v1beta1.Coin amount = 3 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } @@ -126,8 +126,8 @@ message MsgBeginRedelegate { option (gogoproto.goproto_getters) = false; string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - string validator_src_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - string validator_dst_address = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string validator_src_address = 2 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; + string validator_dst_address = 3 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; cosmos.base.v1beta1.Coin amount = 4 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } @@ -147,7 +147,7 @@ message MsgUndelegate { option (gogoproto.goproto_getters) = false; string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; cosmos.base.v1beta1.Coin amount = 3 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } @@ -155,6 +155,11 @@ message MsgUndelegate { message MsgUndelegateResponse { google.protobuf.Timestamp completion_time = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true, (gogoproto.stdtime) = true]; + + // amount returns the amount of undelegated coins + // + // Since: cosmos-sdk 0.50 + cosmos.base.v1beta1.Coin amount = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } // MsgCancelUnbondingDelegation defines the SDK message for performing a cancel unbonding delegation for delegator @@ -167,7 +172,7 @@ message MsgCancelUnbondingDelegation { option (gogoproto.goproto_getters) = false; string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; // amount is always less than or equal to unbonding delegation entry balance cosmos.base.v1beta1.Coin amount = 3 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; // creation_height is the height which the unbonding took place. diff --git a/third_party/proto/cosmos/store/internal/kv/v1beta1/kv.proto b/third_party/proto/cosmos/store/internal/kv/v1beta1/kv.proto new file mode 100644 index 0000000000..4243444acc --- /dev/null +++ b/third_party/proto/cosmos/store/internal/kv/v1beta1/kv.proto @@ -0,0 +1,19 @@ +syntax = "proto3"; +package cosmos.store.internal.kv.v1beta1; + +import "gogoproto/gogo.proto"; + +option go_package = "cosmossdk.io/store/internal/kv"; + +// This is duplicated from the base kv directory to avoid a circular dependency with the cosmos-sdk + +// Pairs defines a repeated slice of Pair objects. +message Pairs { + repeated Pair pairs = 1 [(gogoproto.nullable) = false]; +} + +// Pair defines a key/value bytes tuple. +message Pair { + bytes key = 1; + bytes value = 2; +} diff --git a/third_party/proto/cosmos/store/snapshots/v1/snapshot.proto b/third_party/proto/cosmos/store/snapshots/v1/snapshot.proto new file mode 100644 index 0000000000..af49bdaa53 --- /dev/null +++ b/third_party/proto/cosmos/store/snapshots/v1/snapshot.proto @@ -0,0 +1,67 @@ +syntax = "proto3"; +package cosmos.store.snapshots.v1; + +import "gogoproto/gogo.proto"; + +option go_package = "cosmossdk.io/store/snapshots/types"; + +// Snapshot contains Tendermint state sync snapshot info. +message Snapshot { + uint64 height = 1; + uint32 format = 2; + uint32 chunks = 3; + bytes hash = 4; + Metadata metadata = 5 [(gogoproto.nullable) = false]; +} + +// Metadata contains SDK-specific snapshot metadata. +message Metadata { + repeated bytes chunk_hashes = 1; // SHA-256 chunk hashes +} + +// SnapshotItem is an item contained in a rootmulti.Store snapshot. +// +// Since: cosmos-sdk 0.46 +message SnapshotItem { + // item is the specific type of snapshot item. + oneof item { + SnapshotStoreItem store = 1; + SnapshotIAVLItem iavl = 2 [(gogoproto.customname) = "IAVL"]; + SnapshotExtensionMeta extension = 3; + SnapshotExtensionPayload extension_payload = 4; + } +} + +// SnapshotStoreItem contains metadata about a snapshotted store. +// +// Since: cosmos-sdk 0.46 +message SnapshotStoreItem { + string name = 1; +} + +// SnapshotIAVLItem is an exported IAVL node. +// +// Since: cosmos-sdk 0.46 +message SnapshotIAVLItem { + bytes key = 1; + bytes value = 2; + // version is block height + int64 version = 3; + // height is depth of the tree. + int32 height = 4; +} + +// SnapshotExtensionMeta contains metadata about an external snapshotter. +// +// Since: cosmos-sdk 0.46 +message SnapshotExtensionMeta { + string name = 1; + uint32 format = 2; +} + +// SnapshotExtensionPayload contains payloads of an external snapshotter. +// +// Since: cosmos-sdk 0.46 +message SnapshotExtensionPayload { + bytes payload = 1; +} \ No newline at end of file diff --git a/third_party/proto/cosmos/store/streaming/abci/grpc.proto b/third_party/proto/cosmos/store/streaming/abci/grpc.proto new file mode 100644 index 0000000000..25366cdbdc --- /dev/null +++ b/third_party/proto/cosmos/store/streaming/abci/grpc.proto @@ -0,0 +1,36 @@ +syntax = "proto3"; + +package cosmos.store.streaming.abci; + +import "tendermint/abci/types.proto"; +import "cosmos/store/v1beta1/listening.proto"; + +option go_package = "cosmossdk.io/store/streaming/abci"; + +// ListenEndBlockRequest is the request type for the ListenEndBlock RPC method +message ListenFinalizeBlockRequest { + tendermint.abci.RequestFinalizeBlock req = 1; + tendermint.abci.ResponseFinalizeBlock res = 2; +} + +// ListenEndBlockResponse is the response type for the ListenEndBlock RPC method +message ListenFinalizeBlockResponse {} + +// ListenCommitRequest is the request type for the ListenCommit RPC method +message ListenCommitRequest { + // explicitly pass in block height as ResponseCommit does not contain this info + int64 block_height = 1; + tendermint.abci.ResponseCommit res = 2; + repeated cosmos.store.v1beta1.StoreKVPair change_set = 3; +} + +// ListenCommitResponse is the response type for the ListenCommit RPC method +message ListenCommitResponse {} + +// ABCIListenerService is the service for the BaseApp ABCIListener interface +service ABCIListenerService { + // ListenFinalizeBlock is the corresponding endpoint for ABCIListener.ListenEndBlock + rpc ListenFinalizeBlock(ListenFinalizeBlockRequest) returns (ListenFinalizeBlockResponse); + // ListenCommit is the corresponding endpoint for ABCIListener.ListenCommit + rpc ListenCommit(ListenCommitRequest) returns (ListenCommitResponse); +} diff --git a/third_party/proto/cosmos/store/v1beta1/commit_info.proto b/third_party/proto/cosmos/store/v1beta1/commit_info.proto new file mode 100644 index 0000000000..37459a0d05 --- /dev/null +++ b/third_party/proto/cosmos/store/v1beta1/commit_info.proto @@ -0,0 +1,31 @@ +syntax = "proto3"; +package cosmos.store.v1beta1; + +import "gogoproto/gogo.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "cosmossdk.io/store/types"; + +// CommitInfo defines commit information used by the multi-store when committing +// a version/height. +message CommitInfo { + int64 version = 1; + repeated StoreInfo store_infos = 2 [(gogoproto.nullable) = false]; + google.protobuf.Timestamp timestamp = 3 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; +} + +// StoreInfo defines store-specific commit information. It contains a reference +// between a store name and the commit ID. +message StoreInfo { + string name = 1; + CommitID commit_id = 2 [(gogoproto.nullable) = false]; +} + +// CommitID defines the commitment information when a specific store is +// committed. +message CommitID { + option (gogoproto.goproto_stringer) = false; + + int64 version = 1; + bytes hash = 2; +} diff --git a/third_party/proto/cosmos/store/v1beta1/listening.proto b/third_party/proto/cosmos/store/v1beta1/listening.proto new file mode 100644 index 0000000000..14bc2e7a78 --- /dev/null +++ b/third_party/proto/cosmos/store/v1beta1/listening.proto @@ -0,0 +1,28 @@ +syntax = "proto3"; +package cosmos.store.v1beta1; + +import "tendermint/abci/types.proto"; + +option go_package = "cosmossdk.io/store/types"; + +// StoreKVPair is a KVStore KVPair used for listening to state changes (Sets and Deletes) +// It optionally includes the StoreKey for the originating KVStore and a Boolean flag to distinguish between Sets and +// Deletes +// +// Since: cosmos-sdk 0.43 +message StoreKVPair { + string store_key = 1; // the store key for the KVStore this pair originates from + bool delete = 2; // true indicates a delete operation, false indicates a set operation + bytes key = 3; + bytes value = 4; +} + +// BlockMetadata contains all the abci event data of a block +// the file streamer dump them into files together with the state changes. +message BlockMetadata { + tendermint.abci.ResponseCommit response_commit = 6; + tendermint.abci.RequestFinalizeBlock request_finalize_block = 7; + tendermint.abci.ResponseFinalizeBlock response_finalize_block = 8; // TODO: should we renumber this? + + reserved 1, 2, 3, 4, 5; // reserved for from previous use in comet <= 0.37 +} diff --git a/third_party/proto/cosmos/tx/signing/v1beta1/signing.proto b/third_party/proto/cosmos/tx/signing/v1beta1/signing.proto index 12d5868ba8..584eff4e41 100644 --- a/third_party/proto/cosmos/tx/signing/v1beta1/signing.proto +++ b/third_party/proto/cosmos/tx/signing/v1beta1/signing.proto @@ -25,13 +25,14 @@ enum SignMode { // SIGN_MODE_TEXTUAL is a future signing mode that will verify some // human-readable textual representation on top of the binary representation - // from SIGN_MODE_DIRECT. It is currently not supported. + // from SIGN_MODE_DIRECT. + // + // Since: cosmos-sdk 0.50 SIGN_MODE_TEXTUAL = 2; // SIGN_MODE_DIRECT_AUX specifies a signing mode which uses // SignDocDirectAux. As opposed to SIGN_MODE_DIRECT, this sign mode does not - // require signers signing over other signers' `signer_info`. It also allows - // for adding Tips in transactions. + // require signers signing over other signers' `signer_info`. // // Since: cosmos-sdk 0.46 SIGN_MODE_DIRECT_AUX = 3; diff --git a/third_party/proto/cosmos/tx/v1beta1/service.proto b/third_party/proto/cosmos/tx/v1beta1/service.proto index 16b3de0dda..7e19a18652 100644 --- a/third_party/proto/cosmos/tx/v1beta1/service.proto +++ b/third_party/proto/cosmos/tx/v1beta1/service.proto @@ -82,22 +82,35 @@ service Service { // RPC method. message GetTxsEventRequest { // events is the list of transaction event type. - repeated string events = 1; + // Deprecated post v0.47.x: use query instead, which should contain a valid + // events query. + repeated string events = 1 [deprecated = true]; + // pagination defines a pagination for the request. // Deprecated post v0.46.x: use page and limit instead. cosmos.base.query.v1beta1.PageRequest pagination = 2 [deprecated = true]; OrderBy order_by = 3; - // page is the page number to query, starts at 1. If not provided, will default to first page. + + // page is the page number to query, starts at 1. If not provided, will + // default to first page. uint64 page = 4; + // limit is the total number of results to be returned in the result page. // If left empty it will default to a value to be set by each app. uint64 limit = 5; + + // query defines the transaction event query that is proxied to Tendermint's + // TxSearch RPC method. The query must be valid. + // + // Since cosmos-sdk 0.50 + string query = 6; } // OrderBy defines the sorting order enum OrderBy { - // ORDER_BY_UNSPECIFIED specifies an unknown sorting order. OrderBy defaults to ASC in this case. + // ORDER_BY_UNSPECIFIED specifies an unknown sorting order. OrderBy defaults + // to ASC in this case. ORDER_BY_UNSPECIFIED = 0; // ORDER_BY_ASC defines ascending order ORDER_BY_ASC = 1; @@ -127,18 +140,19 @@ message BroadcastTxRequest { BroadcastMode mode = 2; } -// BroadcastMode specifies the broadcast mode for the TxService.Broadcast RPC method. +// BroadcastMode specifies the broadcast mode for the TxService.Broadcast RPC +// method. enum BroadcastMode { // zero-value for mode ordering BROADCAST_MODE_UNSPECIFIED = 0; // DEPRECATED: use BROADCAST_MODE_SYNC instead, // BROADCAST_MODE_BLOCK is not supported by the SDK from v0.47.x onwards. BROADCAST_MODE_BLOCK = 1 [deprecated = true]; - // BROADCAST_MODE_SYNC defines a tx broadcasting mode where the client waits for - // a CheckTx execution response only. + // BROADCAST_MODE_SYNC defines a tx broadcasting mode where the client waits + // for a CheckTx execution response only. BROADCAST_MODE_SYNC = 2; - // BROADCAST_MODE_ASYNC defines a tx broadcasting mode where the client returns - // immediately. + // BROADCAST_MODE_ASYNC defines a tx broadcasting mode where the client + // returns immediately. BROADCAST_MODE_ASYNC = 3; } @@ -196,7 +210,8 @@ message GetBlockWithTxsRequest { cosmos.base.query.v1beta1.PageRequest pagination = 2; } -// GetBlockWithTxsResponse is the response type for the Service.GetBlockWithTxs method. +// GetBlockWithTxsResponse is the response type for the Service.GetBlockWithTxs +// method. // // Since: cosmos-sdk 0.45.2 message GetBlockWithTxsResponse { diff --git a/third_party/proto/cosmos/tx/v1beta1/tx.proto b/third_party/proto/cosmos/tx/v1beta1/tx.proto index a71a3e115d..cfaac70449 100644 --- a/third_party/proto/cosmos/tx/v1beta1/tx.proto +++ b/third_party/proto/cosmos/tx/v1beta1/tx.proto @@ -1,6 +1,7 @@ syntax = "proto3"; package cosmos.tx.v1beta1; +import "amino/amino.proto"; import "gogoproto/gogo.proto"; import "cosmos/crypto/multisig/v1beta1/multisig.proto"; import "cosmos/base/v1beta1/coin.proto"; @@ -87,13 +88,8 @@ message SignDocDirectAux { // sequence is the sequence number of the signing account. uint64 sequence = 5; - // Tip is the optional tip used for transactions fees paid in another denom. - // It should be left empty if the signer is not the tipper for this - // transaction. - // - // This field is ignored if the chain didn't enable tips, i.e. didn't add the - // `TipDecorator` in its posthandler. - Tip tip = 6; + // tips have been depreacted and should not be used + Tip tip = 6 [deprecated = true]; } // TxBody is the body of a transaction that all signers sign over. @@ -141,14 +137,13 @@ message AuthInfo { // based on the cost of evaluating the body and doing signature verification // of the signers. This can be estimated via simulation. Fee fee = 2; - // Tip is the optional tip used for transactions fees paid in another denom. // // This field is ignored if the chain didn't enable tips, i.e. didn't add the // `TipDecorator` in its posthandler. // // Since: cosmos-sdk 0.46 - Tip tip = 3; + Tip tip = 3 [deprecated = true]; } // SignerInfo describes the public key and signing mode of a single top-level @@ -205,8 +200,12 @@ message ModeInfo { // which must be above some miminum to be accepted into the mempool. message Fee { // amount is the amount of coins to be paid as a fee - repeated cosmos.base.v1beta1.Coin amount = 1 - [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; + repeated cosmos.base.v1beta1.Coin amount = 1 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (amino.dont_omitempty) = true, + (amino.encoding) = "legacy_coins" + ]; // gas_limit is the maximum gas that can be used in transaction processing // before an out of gas error occurs @@ -227,9 +226,14 @@ message Fee { // // Since: cosmos-sdk 0.46 message Tip { + option deprecated = true; // amount is the amount of the tip - repeated cosmos.base.v1beta1.Coin amount = 1 - [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; + repeated cosmos.base.v1beta1.Coin amount = 1 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (amino.dont_omitempty) = true, + (amino.encoding) = "legacy_coins" + ]; // tipper is the address of the account paying for the tip string tipper = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; } diff --git a/third_party/proto/cosmos/upgrade/module/v1/module.proto b/third_party/proto/cosmos/upgrade/module/v1/module.proto index a4cf580886..6493f5c7ff 100644 --- a/third_party/proto/cosmos/upgrade/module/v1/module.proto +++ b/third_party/proto/cosmos/upgrade/module/v1/module.proto @@ -7,7 +7,7 @@ import "cosmos/app/v1alpha1/module.proto"; // Module is the config object of the upgrade module. message Module { option (cosmos.app.v1alpha1.module) = { - go_import: "github.com/cosmos/cosmos-sdk/x/upgrade" + go_import: "cosmossdk.io/x/upgrade" }; // authority defines the custom module authority. If not set, defaults to the governance module. diff --git a/third_party/proto/cosmos/upgrade/v1beta1/query.proto b/third_party/proto/cosmos/upgrade/v1beta1/query.proto index 870cf9ee6b..2b90a78888 100644 --- a/third_party/proto/cosmos/upgrade/v1beta1/query.proto +++ b/third_party/proto/cosmos/upgrade/v1beta1/query.proto @@ -4,7 +4,7 @@ package cosmos.upgrade.v1beta1; import "google/api/annotations.proto"; import "cosmos/upgrade/v1beta1/upgrade.proto"; -option go_package = "github.com/cosmos/cosmos-sdk/x/upgrade/types"; +option go_package = "cosmossdk.io/x/upgrade/types"; // Query defines the gRPC upgrade querier service. service Query { diff --git a/third_party/proto/cosmos/upgrade/v1beta1/tx.proto b/third_party/proto/cosmos/upgrade/v1beta1/tx.proto index 293bea0216..4a6c9ee11f 100644 --- a/third_party/proto/cosmos/upgrade/v1beta1/tx.proto +++ b/third_party/proto/cosmos/upgrade/v1beta1/tx.proto @@ -8,7 +8,7 @@ import "cosmos/upgrade/v1beta1/upgrade.proto"; import "cosmos/msg/v1/msg.proto"; import "amino/amino.proto"; -option go_package = "github.com/cosmos/cosmos-sdk/x/upgrade/types"; +option go_package = "cosmossdk.io/x/upgrade/types"; // Msg defines the upgrade Msg service. service Msg { diff --git a/third_party/proto/cosmos/upgrade/v1beta1/upgrade.proto b/third_party/proto/cosmos/upgrade/v1beta1/upgrade.proto index 0a96716856..5dfb289db5 100644 --- a/third_party/proto/cosmos/upgrade/v1beta1/upgrade.proto +++ b/third_party/proto/cosmos/upgrade/v1beta1/upgrade.proto @@ -7,14 +7,13 @@ import "google/protobuf/timestamp.proto"; import "cosmos_proto/cosmos.proto"; import "amino/amino.proto"; -option go_package = "github.com/cosmos/cosmos-sdk/x/upgrade/types"; +option go_package = "cosmossdk.io/x/upgrade/types"; option (gogoproto.goproto_getters_all) = false; // Plan specifies information about a planned upgrade and when it should occur. message Plan { - option (amino.name) = "cosmos-sdk/Plan"; - option (gogoproto.equal) = true; - option (gogoproto.goproto_stringer) = false; + option (amino.name) = "cosmos-sdk/Plan"; + option (gogoproto.equal) = true; // Sets the name for the upgrade. This name will be used by the upgraded // version of the software to apply any special "on-upgrade" commands during @@ -53,16 +52,15 @@ message SoftwareUpgradeProposal { option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content"; option (amino.name) = "cosmos-sdk/SoftwareUpgradeProposal"; option (gogoproto.equal) = true; - option (gogoproto.goproto_stringer) = false; // title of the proposal - string title = 1; + string title = 1; // description of the proposal string description = 2; // plan of the proposal - Plan plan = 3 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + Plan plan = 3 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } // CancelSoftwareUpgradeProposal is a gov Content type for cancelling a software @@ -74,10 +72,9 @@ message CancelSoftwareUpgradeProposal { option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content"; option (amino.name) = "cosmos-sdk/CancelSoftwareUpgradeProposal"; option (gogoproto.equal) = true; - option (gogoproto.goproto_stringer) = false; // title of the proposal - string title = 1; + string title = 1; // description of the proposal string description = 2; @@ -87,8 +84,7 @@ message CancelSoftwareUpgradeProposal { // // Since: cosmos-sdk 0.43 message ModuleVersion { - option (gogoproto.equal) = true; - option (gogoproto.goproto_stringer) = true; + option (gogoproto.equal) = true; // name of the app module string name = 1; diff --git a/third_party/proto/cosmos/vesting/v1beta1/tx.proto b/third_party/proto/cosmos/vesting/v1beta1/tx.proto index 42d3213f7b..67008724c4 100644 --- a/third_party/proto/cosmos/vesting/v1beta1/tx.proto +++ b/third_party/proto/cosmos/vesting/v1beta1/tx.proto @@ -42,6 +42,7 @@ message MsgCreateVestingAccount { repeated cosmos.base.v1beta1.Coin amount = 3 [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true, + (amino.encoding) = "legacy_coins", (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" ]; @@ -67,6 +68,7 @@ message MsgCreatePermanentLockedAccount { repeated cosmos.base.v1beta1.Coin amount = 3 [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true, + (amino.encoding) = "legacy_coins", (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" ]; } @@ -82,12 +84,12 @@ message MsgCreatePermanentLockedAccountResponse {} // Since: cosmos-sdk 0.46 message MsgCreatePeriodicVestingAccount { option (cosmos.msg.v1.signer) = "from_address"; - option (amino.name) = "cosmos-sdk/MsgCreatePeriodicVestingAccount"; + option (amino.name) = "cosmos-sdk/MsgCreatePeriodVestAccount"; option (gogoproto.equal) = false; - string from_address = 1; - string to_address = 2; + string from_address = 1; + string to_address = 2; // start of vesting as unix time (in seconds). int64 start_time = 3; repeated Period vesting_periods = 4 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; diff --git a/third_party/proto/cosmos/vesting/v1beta1/vesting.proto b/third_party/proto/cosmos/vesting/v1beta1/vesting.proto index 7ab1fb797b..12e9cdd2e0 100644 --- a/third_party/proto/cosmos/vesting/v1beta1/vesting.proto +++ b/third_party/proto/cosmos/vesting/v1beta1/vesting.proto @@ -11,24 +11,26 @@ option go_package = "github.com/cosmos/cosmos-sdk/x/auth/vesting/types"; // BaseVestingAccount implements the VestingAccount interface. It contains all // the necessary fields needed for any vesting account implementation. message BaseVestingAccount { - option (amino.name) = "cosmos-sdk/BaseVestingAccount"; - option (gogoproto.goproto_getters) = false; - option (gogoproto.goproto_stringer) = false; + option (amino.name) = "cosmos-sdk/BaseVestingAccount"; + option (gogoproto.goproto_getters) = false; cosmos.auth.v1beta1.BaseAccount base_account = 1 [(gogoproto.embed) = true]; repeated cosmos.base.v1beta1.Coin original_vesting = 2 [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true, + (amino.encoding) = "legacy_coins", (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" ]; repeated cosmos.base.v1beta1.Coin delegated_free = 3 [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true, + (amino.encoding) = "legacy_coins", (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" ]; repeated cosmos.base.v1beta1.Coin delegated_vesting = 4 [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true, + (amino.encoding) = "legacy_coins", (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" ]; // Vesting end time, as unix timestamp (in seconds). @@ -38,35 +40,32 @@ message BaseVestingAccount { // ContinuousVestingAccount implements the VestingAccount interface. It // continuously vests by unlocking coins linearly with respect to time. message ContinuousVestingAccount { - option (amino.name) = "cosmos-sdk/ContinuousVestingAccount"; - option (gogoproto.goproto_getters) = false; - option (gogoproto.goproto_stringer) = false; + option (amino.name) = "cosmos-sdk/ContinuousVestingAccount"; + option (gogoproto.goproto_getters) = false; BaseVestingAccount base_vesting_account = 1 [(gogoproto.embed) = true]; // Vesting start time, as unix timestamp (in seconds). - int64 start_time = 2; + int64 start_time = 2; } // DelayedVestingAccount implements the VestingAccount interface. It vests all // coins after a specific time, but non prior. In other words, it keeps them // locked until a specified time. message DelayedVestingAccount { - option (amino.name) = "cosmos-sdk/DelayedVestingAccount"; - option (gogoproto.goproto_getters) = false; - option (gogoproto.goproto_stringer) = false; + option (amino.name) = "cosmos-sdk/DelayedVestingAccount"; + option (gogoproto.goproto_getters) = false; BaseVestingAccount base_vesting_account = 1 [(gogoproto.embed) = true]; } // Period defines a length of time and amount of coins that will vest. message Period { - option (gogoproto.goproto_stringer) = false; - // Period duration in seconds. int64 length = 1; repeated cosmos.base.v1beta1.Coin amount = 2 [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true, + (amino.encoding) = "legacy_coins", (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" ]; } @@ -74,9 +73,8 @@ message Period { // PeriodicVestingAccount implements the VestingAccount interface. It // periodically vests by unlocking coins during each specified period. message PeriodicVestingAccount { - option (amino.name) = "cosmos-sdk/PeriodicVestingAccount"; - option (gogoproto.goproto_getters) = false; - option (gogoproto.goproto_stringer) = false; + option (amino.name) = "cosmos-sdk/PeriodicVestingAccount"; + option (gogoproto.goproto_getters) = false; BaseVestingAccount base_vesting_account = 1 [(gogoproto.embed) = true]; int64 start_time = 2; @@ -89,9 +87,8 @@ message PeriodicVestingAccount { // // Since: cosmos-sdk 0.43 message PermanentLockedAccount { - option (amino.name) = "cosmos-sdk/PermanentLockedAccount"; - option (gogoproto.goproto_getters) = false; - option (gogoproto.goproto_stringer) = false; + option (amino.name) = "cosmos-sdk/PermanentLockedAccount"; + option (gogoproto.goproto_getters) = false; BaseVestingAccount base_vesting_account = 1 [(gogoproto.embed) = true]; } diff --git a/third_party/proto/ethermint/evm/v1/evm.proto b/third_party/proto/ethermint/evm/v1/evm.proto index 43b3e7a5f2..72538c60c5 100644 --- a/third_party/proto/ethermint/evm/v1/evm.proto +++ b/third_party/proto/ethermint/evm/v1/evm.proto @@ -36,13 +36,13 @@ message Params { message ChainConfig { // homestead_block switch (nil no fork, 0 = already homestead) string homestead_block = 1 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.moretags) = "yaml:\"homestead_block\"" ]; // dao_fork_block corresponds to TheDAO hard-fork switch block (nil no fork) string dao_fork_block = 2 [ (gogoproto.customname) = "DAOForkBlock", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.moretags) = "yaml:\"dao_fork_block\"" ]; // dao_fork_support defines whether the nodes supports or opposes the DAO hard-fork @@ -52,7 +52,7 @@ message ChainConfig { // (https://github.com/ethereum/EIPs/issues/150) EIP150 HF block (nil no fork) string eip150_block = 4 [ (gogoproto.customname) = "EIP150Block", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.moretags) = "yaml:\"eip150_block\"" ]; // eip150_hash: EIP150 HF hash (needed for header only clients as only gas pricing changed) @@ -60,43 +60,43 @@ message ChainConfig { // eip155_block: EIP155Block HF block string eip155_block = 6 [ (gogoproto.customname) = "EIP155Block", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.moretags) = "yaml:\"eip155_block\"" ]; // eip158_block: EIP158 HF block string eip158_block = 7 [ (gogoproto.customname) = "EIP158Block", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.moretags) = "yaml:\"eip158_block\"" ]; // byzantium_block: Byzantium switch block (nil no fork, 0 = already on byzantium) string byzantium_block = 8 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.moretags) = "yaml:\"byzantium_block\"" ]; // constantinople_block: Constantinople switch block (nil no fork, 0 = already activated) string constantinople_block = 9 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.moretags) = "yaml:\"constantinople_block\"" ]; // petersburg_block: Petersburg switch block (nil same as Constantinople) string petersburg_block = 10 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.moretags) = "yaml:\"petersburg_block\"" ]; // istanbul_block: Istanbul switch block (nil no fork, 0 = already on istanbul) string istanbul_block = 11 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.moretags) = "yaml:\"istanbul_block\"" ]; // muir_glacier_block: Eip-2384 (bomb delay) switch block (nil no fork, 0 = already activated) string muir_glacier_block = 12 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.moretags) = "yaml:\"muir_glacier_block\"" ]; // berlin_block: Berlin switch block (nil = no fork, 0 = already on berlin) string berlin_block = 13 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.moretags) = "yaml:\"berlin_block\"" ]; // DEPRECATED: EWASM, YOLOV3 and Catalyst block have been deprecated @@ -104,12 +104,12 @@ message ChainConfig { reserved "yolo_v3_block", "ewasm_block", "catalyst_block"; // london_block: London switch block (nil = no fork, 0 = already on london) string london_block = 17 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.moretags) = "yaml:\"london_block\"" ]; // arrow_glacier_block: Eip-4345 (bomb delay) switch block (nil = no fork, 0 = already activated) string arrow_glacier_block = 18 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.moretags) = "yaml:\"arrow_glacier_block\"" ]; // DEPRECATED: merge fork block was deprecated: https://github.com/ethereum/go-ethereum/pull/24904 @@ -117,22 +117,22 @@ message ChainConfig { reserved "merge_fork_block"; // gray_glacier_block: EIP-5133 (bomb delay) switch block (nil = no fork, 0 = already activated) string gray_glacier_block = 20 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.moretags) = "yaml:\"gray_glacier_block\"" ]; // merge_netsplit_block: Virtual fork after The Merge to use as a network splitter string merge_netsplit_block = 21 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.moretags) = "yaml:\"merge_netsplit_block\"" ]; // shanghai_block switch block (nil = no fork, 0 = already on shanghai) string shanghai_block = 22 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.moretags) = "yaml:\"shanghai_block\"" ]; // cancun_block switch block (nil = no fork, 0 = already on cancun) string cancun_block = 23 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.moretags) = "yaml:\"cancun_block\"" ]; } diff --git a/third_party/proto/ethermint/evm/v1/query.proto b/third_party/proto/ethermint/evm/v1/query.proto index e533edc927..ffb18fe8f2 100644 --- a/third_party/proto/ethermint/evm/v1/query.proto +++ b/third_party/proto/ethermint/evm/v1/query.proto @@ -294,5 +294,5 @@ message QueryBaseFeeRequest {} // QueryBaseFeeResponse returns the EIP1559 base fee. message QueryBaseFeeResponse { // base_fee is the EIP1559 base fee - string base_fee = 1 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int"]; + string base_fee = 1 [(gogoproto.customtype) = "cosmossdk.io/math.Int"]; } diff --git a/third_party/proto/ethermint/evm/v1/tx.proto b/third_party/proto/ethermint/evm/v1/tx.proto index 737b29493d..3b4bfdc1a3 100644 --- a/third_party/proto/ethermint/evm/v1/tx.proto +++ b/third_party/proto/ethermint/evm/v1/tx.proto @@ -48,14 +48,14 @@ message LegacyTx { // nonce corresponds to the account nonce (transaction sequence). uint64 nonce = 1; // gas_price defines the value for each gas unit - string gas_price = 2 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int"]; + string gas_price = 2 [(gogoproto.customtype) = "cosmossdk.io/math.Int"]; // gas defines the gas limit defined for the transaction. uint64 gas = 3 [(gogoproto.customname) = "GasLimit"]; // to is the hex formatted address of the recipient string to = 4; // value defines the unsigned integer value of the transaction amount. string value = 5 - [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.customname) = "Amount"]; + [(gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.customname) = "Amount"]; // data is the data payload bytes of the transaction. bytes data = 6; // v defines the signature value @@ -73,21 +73,21 @@ message AccessListTx { // chain_id of the destination EVM chain string chain_id = 1 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.customname) = "ChainID", (gogoproto.jsontag) = "chainID" ]; // nonce corresponds to the account nonce (transaction sequence). uint64 nonce = 2; // gas_price defines the value for each gas unit - string gas_price = 3 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int"]; + string gas_price = 3 [(gogoproto.customtype) = "cosmossdk.io/math.Int"]; // gas defines the gas limit defined for the transaction. uint64 gas = 4 [(gogoproto.customname) = "GasLimit"]; // to is the recipient address in hex format string to = 5; // value defines the unsigned integer value of the transaction amount. string value = 6 - [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.customname) = "Amount"]; + [(gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.customname) = "Amount"]; // data is the data payload bytes of the transaction. bytes data = 7; // accesses is an array of access tuples @@ -108,23 +108,23 @@ message DynamicFeeTx { // chain_id of the destination EVM chain string chain_id = 1 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.customname) = "ChainID", (gogoproto.jsontag) = "chainID" ]; // nonce corresponds to the account nonce (transaction sequence). uint64 nonce = 2; // gas_tip_cap defines the max value for the gas tip - string gas_tip_cap = 3 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int"]; + string gas_tip_cap = 3 [(gogoproto.customtype) = "cosmossdk.io/math.Int"]; // gas_fee_cap defines the max value for the gas fee - string gas_fee_cap = 4 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int"]; + string gas_fee_cap = 4 [(gogoproto.customtype) = "cosmossdk.io/math.Int"]; // gas defines the gas limit defined for the transaction. uint64 gas = 5 [(gogoproto.customname) = "GasLimit"]; // to is the hex formatted address of the recipient string to = 6; // value defines the the transaction amount. string value = 7 - [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.customname) = "Amount"]; + [(gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.customname) = "Amount"]; // data is the data payload bytes of the transaction. bytes data = 8; // accesses is an array of access tuples diff --git a/third_party/proto/ethermint/feemarket/v1/feemarket.proto b/third_party/proto/ethermint/feemarket/v1/feemarket.proto index eb89f71c61..55c8c4bc3e 100644 --- a/third_party/proto/ethermint/feemarket/v1/feemarket.proto +++ b/third_party/proto/ethermint/feemarket/v1/feemarket.proto @@ -21,12 +21,12 @@ message Params { // enable_height defines at which block height the base fee calculation is enabled. int64 enable_height = 5; // base_fee for EIP-1559 blocks. - string base_fee = 6 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false]; + string base_fee = 6 [(gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false]; // min_gas_price defines the minimum gas price value for cosmos and eth transactions string min_gas_price = 7 - [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; + [(gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false]; // min_gas_multiplier bounds the minimum gas used to be charged // to senders based on gas limit string min_gas_multiplier = 8 - [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; + [(gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false]; } diff --git a/third_party/proto/ethermint/feemarket/v1/query.proto b/third_party/proto/ethermint/feemarket/v1/query.proto index 2cc763a6ec..259cf25503 100644 --- a/third_party/proto/ethermint/feemarket/v1/query.proto +++ b/third_party/proto/ethermint/feemarket/v1/query.proto @@ -42,7 +42,7 @@ message QueryBaseFeeRequest {} // QueryBaseFeeResponse returns the EIP1559 base fee. message QueryBaseFeeResponse { // base_fee is the EIP1559 base fee - string base_fee = 1 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int"]; + string base_fee = 1 [(gogoproto.customtype) = "cosmossdk.io/math.Int"]; } // QueryBlockGasRequest defines the request type for querying the EIP1559 base diff --git a/third_party/proto/ethermint/types/v1/account.proto b/third_party/proto/ethermint/types/v1/account.proto index e50c9bbed0..9721142a44 100644 --- a/third_party/proto/ethermint/types/v1/account.proto +++ b/third_party/proto/ethermint/types/v1/account.proto @@ -7,14 +7,14 @@ import "gogoproto/gogo.proto"; option go_package = "github.com/evmos/ethermint/types"; -// EthAccount implements the authtypes.AccountI interface and embeds an +// EthAccount implements the sdk.AccountI interface and embeds an // authtypes.BaseAccount type. It is compatible with the auth AccountKeeper. message EthAccount { option (gogoproto.goproto_getters) = false; option (gogoproto.goproto_stringer) = false; option (gogoproto.equal) = false; - option (cosmos_proto.implements_interface) = "github.com/cosmos/cosmos-sdk/x/auth/types.AccountI"; + option (cosmos_proto.implements_interface) = "github.com/cosmos/cosmos-sdk/x/auth/sdk.AccountI"; // base_account is an authtypes.BaseAccount cosmos.auth.v1beta1.BaseAccount base_account = 1 diff --git a/third_party/proto/ethermint/types/v1/dynamic_fee.proto b/third_party/proto/ethermint/types/v1/dynamic_fee.proto index d073b29f81..1b38f07326 100644 --- a/third_party/proto/ethermint/types/v1/dynamic_fee.proto +++ b/third_party/proto/ethermint/types/v1/dynamic_fee.proto @@ -9,5 +9,5 @@ option go_package = "github.com/evmos/ethermint/types"; message ExtensionOptionDynamicFeeTx { // max_priority_price is the same as `max_priority_fee_per_gas` in eip-1559 spec string max_priority_price = 1 - [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false]; + [(gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false]; } diff --git a/third_party/proto/ibc/applications/fee/v1/ack.proto b/third_party/proto/ibc/applications/fee/v1/ack.proto index ec1342bbf2..2f3746d2cb 100644 --- a/third_party/proto/ibc/applications/fee/v1/ack.proto +++ b/third_party/proto/ibc/applications/fee/v1/ack.proto @@ -2,16 +2,14 @@ syntax = "proto3"; package ibc.applications.fee.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/types"; - -import "gogoproto/gogo.proto"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/types"; // IncentivizedAcknowledgement is the acknowledgement format to be used by applications wrapped in the fee middleware message IncentivizedAcknowledgement { // the underlying app acknowledgement bytes - bytes app_acknowledgement = 1 [(gogoproto.moretags) = "yaml:\"app_acknowledgement\""]; + bytes app_acknowledgement = 1; // the relayer address which submits the recv packet message - string forward_relayer_address = 2 [(gogoproto.moretags) = "yaml:\"forward_relayer_address\""]; + string forward_relayer_address = 2; // success flag of the base application callback - bool underlying_app_success = 3 [(gogoproto.moretags) = "yaml:\"underlying_app_successl\""]; + bool underlying_app_success = 3; } diff --git a/third_party/proto/ibc/applications/fee/v1/fee.proto b/third_party/proto/ibc/applications/fee/v1/fee.proto index 1a025ddca1..867e884551 100644 --- a/third_party/proto/ibc/applications/fee/v1/fee.proto +++ b/third_party/proto/ibc/applications/fee/v1/fee.proto @@ -2,40 +2,46 @@ syntax = "proto3"; package ibc.applications.fee.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/types"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/types"; +import "amino/amino.proto"; import "cosmos/base/v1beta1/coin.proto"; import "gogoproto/gogo.proto"; import "ibc/core/channel/v1/channel.proto"; +import "cosmos/msg/v1/msg.proto"; // Fee defines the ICS29 receive, acknowledgement and timeout fees message Fee { // the packet receive fee repeated cosmos.base.v1beta1.Coin recv_fee = 1 [ - (gogoproto.moretags) = "yaml:\"recv_fee\"", (gogoproto.nullable) = false, - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (amino.encoding) = "legacy_coins" ]; + // the packet acknowledgement fee repeated cosmos.base.v1beta1.Coin ack_fee = 2 [ - (gogoproto.moretags) = "yaml:\"ack_fee\"", (gogoproto.nullable) = false, - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (amino.encoding) = "legacy_coins" ]; + // the packet timeout fee repeated cosmos.base.v1beta1.Coin timeout_fee = 3 [ - (gogoproto.moretags) = "yaml:\"timeout_fee\"", (gogoproto.nullable) = false, - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (amino.encoding) = "legacy_coins" ]; } // PacketFee contains ICS29 relayer fees, refund address and optional list of permitted relayers message PacketFee { + option (cosmos.msg.v1.signer) = "refund_address"; + // fee encapsulates the recv, ack and timeout fees associated with an IBC packet Fee fee = 1 [(gogoproto.nullable) = false]; // the refund address for unspent fees - string refund_address = 2 [(gogoproto.moretags) = "yaml:\"refund_address\""]; + string refund_address = 2; // optional list of relayers permitted to receive fees repeated string relayers = 3; } @@ -43,14 +49,13 @@ message PacketFee { // PacketFees contains a list of type PacketFee message PacketFees { // list of packet fees - repeated PacketFee packet_fees = 1 [(gogoproto.moretags) = "yaml:\"packet_fees\"", (gogoproto.nullable) = false]; + repeated PacketFee packet_fees = 1 [(gogoproto.nullable) = false]; } // IdentifiedPacketFees contains a list of type PacketFee and associated PacketId message IdentifiedPacketFees { // unique packet identifier comprised of the channel ID, port ID and sequence - ibc.core.channel.v1.PacketId packet_id = 1 - [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"packet_id\""]; + ibc.core.channel.v1.PacketId packet_id = 1 [(gogoproto.nullable) = false]; // list of packet fees - repeated PacketFee packet_fees = 2 [(gogoproto.moretags) = "yaml:\"packet_fees\"", (gogoproto.nullable) = false]; + repeated PacketFee packet_fees = 2 [(gogoproto.nullable) = false]; } diff --git a/third_party/proto/ibc/applications/fee/v1/genesis.proto b/third_party/proto/ibc/applications/fee/v1/genesis.proto index 6bba6cff63..e48ceb5354 100644 --- a/third_party/proto/ibc/applications/fee/v1/genesis.proto +++ b/third_party/proto/ibc/applications/fee/v1/genesis.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.applications.fee.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/types"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/types"; import "gogoproto/gogo.proto"; import "ibc/applications/fee/v1/fee.proto"; @@ -11,34 +11,29 @@ import "ibc/core/channel/v1/channel.proto"; // GenesisState defines the ICS29 fee middleware genesis state message GenesisState { // list of identified packet fees - repeated IdentifiedPacketFees identified_fees = 1 - [(gogoproto.moretags) = "yaml:\"identified_fees\"", (gogoproto.nullable) = false]; + repeated IdentifiedPacketFees identified_fees = 1 [(gogoproto.nullable) = false]; // list of fee enabled channels - repeated FeeEnabledChannel fee_enabled_channels = 2 - [(gogoproto.moretags) = "yaml:\"fee_enabled_channels\"", (gogoproto.nullable) = false]; + repeated FeeEnabledChannel fee_enabled_channels = 2 [(gogoproto.nullable) = false]; // list of registered payees - repeated RegisteredPayee registered_payees = 3 - [(gogoproto.moretags) = "yaml:\"registered_payees\"", (gogoproto.nullable) = false]; + repeated RegisteredPayee registered_payees = 3 [(gogoproto.nullable) = false]; // list of registered counterparty payees - repeated RegisteredCounterpartyPayee registered_counterparty_payees = 4 - [(gogoproto.moretags) = "yaml:\"registered_counterparty_payees\"", (gogoproto.nullable) = false]; + repeated RegisteredCounterpartyPayee registered_counterparty_payees = 4 [(gogoproto.nullable) = false]; // list of forward relayer addresses - repeated ForwardRelayerAddress forward_relayers = 5 - [(gogoproto.moretags) = "yaml:\"forward_relayers\"", (gogoproto.nullable) = false]; + repeated ForwardRelayerAddress forward_relayers = 5 [(gogoproto.nullable) = false]; } // FeeEnabledChannel contains the PortID & ChannelID for a fee enabled channel message FeeEnabledChannel { // unique port identifier - string port_id = 1 [(gogoproto.moretags) = "yaml:\"port_id\""]; + string port_id = 1; // unique channel identifier - string channel_id = 2 [(gogoproto.moretags) = "yaml:\"channel_id\""]; + string channel_id = 2; } // RegisteredPayee contains the relayer address and payee address for a specific channel message RegisteredPayee { // unique channel identifier - string channel_id = 1 [(gogoproto.moretags) = "yaml:\"channel_id\""]; + string channel_id = 1; // the relayer address string relayer = 2; // the payee address @@ -49,11 +44,11 @@ message RegisteredPayee { // for recv fee distribution) message RegisteredCounterpartyPayee { // unique channel identifier - string channel_id = 1 [(gogoproto.moretags) = "yaml:\"channel_id\""]; + string channel_id = 1; // the relayer address string relayer = 2; // the counterparty payee address - string counterparty_payee = 3 [(gogoproto.moretags) = "yaml:\"counterparty_payee\""]; + string counterparty_payee = 3; } // ForwardRelayerAddress contains the forward relayer address and PacketId used for async acknowledgements @@ -61,6 +56,5 @@ message ForwardRelayerAddress { // the forward relayer address string address = 1; // unique packet identifer comprised of the channel ID, port ID and sequence - ibc.core.channel.v1.PacketId packet_id = 2 - [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"packet_id\""]; + ibc.core.channel.v1.PacketId packet_id = 2 [(gogoproto.nullable) = false]; } diff --git a/third_party/proto/ibc/applications/fee/v1/metadata.proto b/third_party/proto/ibc/applications/fee/v1/metadata.proto index 0c0a72c9ca..1e82e7c250 100644 --- a/third_party/proto/ibc/applications/fee/v1/metadata.proto +++ b/third_party/proto/ibc/applications/fee/v1/metadata.proto @@ -2,15 +2,13 @@ syntax = "proto3"; package ibc.applications.fee.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/types"; - -import "gogoproto/gogo.proto"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/types"; // Metadata defines the ICS29 channel specific metadata encoded into the channel version bytestring // See ICS004: https://github.com/cosmos/ibc/tree/master/spec/core/ics-004-channel-and-packet-semantics#Versioning message Metadata { // fee_version defines the ICS29 fee version - string fee_version = 1 [(gogoproto.moretags) = "yaml:\"fee_version\""]; + string fee_version = 1; // app_version defines the underlying application version, which may or may not be a JSON encoded bytestring - string app_version = 2 [(gogoproto.moretags) = "yaml:\"app_version\""]; + string app_version = 2; } diff --git a/third_party/proto/ibc/applications/fee/v1/query.proto b/third_party/proto/ibc/applications/fee/v1/query.proto index 871cfdac70..726370ee03 100644 --- a/third_party/proto/ibc/applications/fee/v1/query.proto +++ b/third_party/proto/ibc/applications/fee/v1/query.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.applications.fee.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/types"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/types"; import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; @@ -83,6 +83,8 @@ message QueryIncentivizedPacketsRequest { message QueryIncentivizedPacketsResponse { // list of identified fees for incentivized packets repeated ibc.applications.fee.v1.IdentifiedPacketFees incentivized_packets = 1 [(gogoproto.nullable) = false]; + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; } // QueryIncentivizedPacketRequest defines the request type for the IncentivizedPacket rpc @@ -114,6 +116,8 @@ message QueryIncentivizedPacketsForChannelRequest { message QueryIncentivizedPacketsForChannelResponse { // Map of all incentivized_packets repeated ibc.applications.fee.v1.IdentifiedPacketFees incentivized_packets = 1; + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; } // QueryTotalRecvFeesRequest defines the request type for the TotalRecvFees rpc @@ -125,11 +129,8 @@ message QueryTotalRecvFeesRequest { // QueryTotalRecvFeesResponse defines the response type for the TotalRecvFees rpc message QueryTotalRecvFeesResponse { // the total packet receive fees - repeated cosmos.base.v1beta1.Coin recv_fees = 1 [ - (gogoproto.moretags) = "yaml:\"recv_fees\"", - (gogoproto.nullable) = false, - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" - ]; + repeated cosmos.base.v1beta1.Coin recv_fees = 1 + [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; } // QueryTotalAckFeesRequest defines the request type for the TotalAckFees rpc @@ -141,11 +142,8 @@ message QueryTotalAckFeesRequest { // QueryTotalAckFeesResponse defines the response type for the TotalAckFees rpc message QueryTotalAckFeesResponse { // the total packet acknowledgement fees - repeated cosmos.base.v1beta1.Coin ack_fees = 1 [ - (gogoproto.moretags) = "yaml:\"ack_fees\"", - (gogoproto.nullable) = false, - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" - ]; + repeated cosmos.base.v1beta1.Coin ack_fees = 1 + [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; } // QueryTotalTimeoutFeesRequest defines the request type for the TotalTimeoutFees rpc @@ -157,17 +155,14 @@ message QueryTotalTimeoutFeesRequest { // QueryTotalTimeoutFeesResponse defines the response type for the TotalTimeoutFees rpc message QueryTotalTimeoutFeesResponse { // the total packet timeout fees - repeated cosmos.base.v1beta1.Coin timeout_fees = 1 [ - (gogoproto.moretags) = "yaml:\"timeout_fees\"", - (gogoproto.nullable) = false, - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" - ]; + repeated cosmos.base.v1beta1.Coin timeout_fees = 1 + [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; } // QueryPayeeRequest defines the request type for the Payee rpc message QueryPayeeRequest { // unique channel identifier - string channel_id = 1 [(gogoproto.moretags) = "yaml:\"channel_id\""]; + string channel_id = 1; // the relayer address to which the distribution address is registered string relayer = 2; } @@ -175,13 +170,13 @@ message QueryPayeeRequest { // QueryPayeeResponse defines the response type for the Payee rpc message QueryPayeeResponse { // the payee address to which packet fees are paid out - string payee_address = 1 [(gogoproto.moretags) = "yaml:\"payee_address\""]; + string payee_address = 1; } // QueryCounterpartyPayeeRequest defines the request type for the CounterpartyPayee rpc message QueryCounterpartyPayeeRequest { // unique channel identifier - string channel_id = 1 [(gogoproto.moretags) = "yaml:\"channel_id\""]; + string channel_id = 1; // the relayer address to which the counterparty is registered string relayer = 2; } @@ -189,7 +184,7 @@ message QueryCounterpartyPayeeRequest { // QueryCounterpartyPayeeResponse defines the response type for the CounterpartyPayee rpc message QueryCounterpartyPayeeResponse { // the counterparty payee address used to compensate forward relaying - string counterparty_payee = 1 [(gogoproto.moretags) = "yaml:\"counterparty_payee\""]; + string counterparty_payee = 1; } // QueryFeeEnabledChannelsRequest defines the request type for the FeeEnabledChannels rpc @@ -203,20 +198,21 @@ message QueryFeeEnabledChannelsRequest { // QueryFeeEnabledChannelsResponse defines the response type for the FeeEnabledChannels rpc message QueryFeeEnabledChannelsResponse { // list of fee enabled channels - repeated ibc.applications.fee.v1.FeeEnabledChannel fee_enabled_channels = 1 - [(gogoproto.moretags) = "yaml:\"fee_enabled_channels\"", (gogoproto.nullable) = false]; + repeated ibc.applications.fee.v1.FeeEnabledChannel fee_enabled_channels = 1 [(gogoproto.nullable) = false]; + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; } // QueryFeeEnabledChannelRequest defines the request type for the FeeEnabledChannel rpc message QueryFeeEnabledChannelRequest { // unique port identifier - string port_id = 1 [(gogoproto.moretags) = "yaml:\"port_id\""]; + string port_id = 1; // unique channel identifier - string channel_id = 2 [(gogoproto.moretags) = "yaml:\"channel_id\""]; + string channel_id = 2; } // QueryFeeEnabledChannelResponse defines the response type for the FeeEnabledChannel rpc message QueryFeeEnabledChannelResponse { // boolean flag representing the fee enabled channel status - bool fee_enabled = 1 [(gogoproto.moretags) = "yaml:\"fee_enabled\""]; + bool fee_enabled = 1; } diff --git a/third_party/proto/ibc/applications/fee/v1/tx.proto b/third_party/proto/ibc/applications/fee/v1/tx.proto index 3a46de74eb..e59dddfd17 100644 --- a/third_party/proto/ibc/applications/fee/v1/tx.proto +++ b/third_party/proto/ibc/applications/fee/v1/tx.proto @@ -2,14 +2,18 @@ syntax = "proto3"; package ibc.applications.fee.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/types"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/types"; +import "amino/amino.proto"; import "gogoproto/gogo.proto"; import "ibc/applications/fee/v1/fee.proto"; import "ibc/core/channel/v1/channel.proto"; +import "cosmos/msg/v1/msg.proto"; // Msg defines the ICS29 Msg service. service Msg { + option (cosmos.msg.v1.service) = true; + // RegisterPayee defines a rpc handler method for MsgRegisterPayee // RegisterPayee is called by the relayer on each channelEnd and allows them to set an optional // payee to which reverse and timeout relayer packet fees will be paid out. The payee should be registered on @@ -39,13 +43,15 @@ service Msg { // MsgRegisterPayee defines the request type for the RegisterPayee rpc message MsgRegisterPayee { - option (gogoproto.equal) = false; + option (amino.name) = "cosmos-sdk/MsgRegisterPayee"; + option (cosmos.msg.v1.signer) = "relayer"; + option (gogoproto.goproto_getters) = false; // unique port identifier - string port_id = 1 [(gogoproto.moretags) = "yaml:\"port_id\""]; + string port_id = 1; // unique channel identifier - string channel_id = 2 [(gogoproto.moretags) = "yaml:\"channel_id\""]; + string channel_id = 2; // the relayer address string relayer = 3; // the payee address @@ -57,17 +63,19 @@ message MsgRegisterPayeeResponse {} // MsgRegisterCounterpartyPayee defines the request type for the RegisterCounterpartyPayee rpc message MsgRegisterCounterpartyPayee { - option (gogoproto.equal) = false; + option (amino.name) = "cosmos-sdk/MsgRegisterCounterpartyPayee"; + option (cosmos.msg.v1.signer) = "relayer"; + option (gogoproto.goproto_getters) = false; // unique port identifier - string port_id = 1 [(gogoproto.moretags) = "yaml:\"port_id\""]; + string port_id = 1; // unique channel identifier - string channel_id = 2 [(gogoproto.moretags) = "yaml:\"channel_id\""]; + string channel_id = 2; // the relayer address string relayer = 3; // the counterparty payee address - string counterparty_payee = 4 [(gogoproto.moretags) = "yaml:\"counterparty_payee\""]; + string counterparty_payee = 4; } // MsgRegisterCounterpartyPayeeResponse defines the response type for the RegisterCounterpartyPayee rpc @@ -77,15 +85,17 @@ message MsgRegisterCounterpartyPayeeResponse {} // This Msg can be used to pay for a packet at the next sequence send & should be combined with the Msg that will be // paid for message MsgPayPacketFee { - option (gogoproto.equal) = false; + option (amino.name) = "cosmos-sdk/MsgPayPacketFee"; + option (cosmos.msg.v1.signer) = "signer"; + option (gogoproto.goproto_getters) = false; // fee encapsulates the recv, ack and timeout fees associated with an IBC packet - ibc.applications.fee.v1.Fee fee = 1 [(gogoproto.nullable) = false]; + ibc.applications.fee.v1.Fee fee = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; // the source port unique identifier - string source_port_id = 2 [(gogoproto.moretags) = "yaml:\"source_port_id\""]; + string source_port_id = 2; // the source channel unique identifer - string source_channel_id = 3 [(gogoproto.moretags) = "yaml:\"source_channel_id\""]; + string source_channel_id = 3; // account address to refund fee if necessary string signer = 4; // optional list of relayers permitted to the receive packet fees @@ -98,14 +108,14 @@ message MsgPayPacketFeeResponse {} // MsgPayPacketFeeAsync defines the request type for the PayPacketFeeAsync rpc // This Msg can be used to pay for a packet at a specified sequence (instead of the next sequence send) message MsgPayPacketFeeAsync { - option (gogoproto.equal) = false; + option (amino.name) = "cosmos-sdk/MsgPayPacketFeeAsync"; + option (cosmos.msg.v1.signer) = "packet_fee"; option (gogoproto.goproto_getters) = false; // unique packet identifier comprised of the channel ID, port ID and sequence - ibc.core.channel.v1.PacketId packet_id = 1 - [(gogoproto.moretags) = "yaml:\"packet_id\"", (gogoproto.nullable) = false]; + ibc.core.channel.v1.PacketId packet_id = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; // the packet fee associated with a particular IBC packet - PacketFee packet_fee = 2 [(gogoproto.moretags) = "yaml:\"packet_fee\"", (gogoproto.nullable) = false]; + PacketFee packet_fee = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } // MsgPayPacketFeeAsyncResponse defines the response type for the PayPacketFeeAsync rpc diff --git a/third_party/proto/ibc/applications/interchain_accounts/controller/v1/controller.proto b/third_party/proto/ibc/applications/interchain_accounts/controller/v1/controller.proto index a505b4637e..2e6bbe1a13 100644 --- a/third_party/proto/ibc/applications/interchain_accounts/controller/v1/controller.proto +++ b/third_party/proto/ibc/applications/interchain_accounts/controller/v1/controller.proto @@ -2,13 +2,11 @@ syntax = "proto3"; package ibc.applications.interchain_accounts.controller.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types"; - -import "gogoproto/gogo.proto"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/types"; // Params defines the set of on-chain interchain accounts parameters. // The following parameters may be used to disable the controller submodule. message Params { // controller_enabled enables or disables the controller submodule. - bool controller_enabled = 1 [(gogoproto.moretags) = "yaml:\"controller_enabled\""]; + bool controller_enabled = 1; } diff --git a/third_party/proto/ibc/applications/interchain_accounts/controller/v1/query.proto b/third_party/proto/ibc/applications/interchain_accounts/controller/v1/query.proto index 8c237a1525..31885fcb2e 100644 --- a/third_party/proto/ibc/applications/interchain_accounts/controller/v1/query.proto +++ b/third_party/proto/ibc/applications/interchain_accounts/controller/v1/query.proto @@ -2,10 +2,9 @@ syntax = "proto3"; package ibc.applications.interchain_accounts.controller.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/types"; import "ibc/applications/interchain_accounts/controller/v1/controller.proto"; -import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; // Query provides defines the gRPC querier service. @@ -25,7 +24,7 @@ service Query { // QueryInterchainAccountRequest is the request type for the Query/InterchainAccount RPC method. message QueryInterchainAccountRequest { string owner = 1; - string connection_id = 2 [(gogoproto.moretags) = "yaml:\"connection_id\""]; + string connection_id = 2; } // QueryInterchainAccountResponse the response type for the Query/InterchainAccount RPC method. diff --git a/third_party/proto/ibc/applications/interchain_accounts/controller/v1/tx.proto b/third_party/proto/ibc/applications/interchain_accounts/controller/v1/tx.proto index 284ffe7057..ec5c2e62ea 100644 --- a/third_party/proto/ibc/applications/interchain_accounts/controller/v1/tx.proto +++ b/third_party/proto/ibc/applications/interchain_accounts/controller/v1/tx.proto @@ -2,50 +2,81 @@ syntax = "proto3"; package ibc.applications.interchain_accounts.controller.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/types"; import "gogoproto/gogo.proto"; import "ibc/applications/interchain_accounts/v1/packet.proto"; +import "ibc/applications/interchain_accounts/controller/v1/controller.proto"; +import "cosmos/msg/v1/msg.proto"; +import "ibc/core/channel/v1/channel.proto"; // Msg defines the 27-interchain-accounts/controller Msg service. service Msg { + option (cosmos.msg.v1.service) = true; + // RegisterInterchainAccount defines a rpc handler for MsgRegisterInterchainAccount. rpc RegisterInterchainAccount(MsgRegisterInterchainAccount) returns (MsgRegisterInterchainAccountResponse); // SendTx defines a rpc handler for MsgSendTx. rpc SendTx(MsgSendTx) returns (MsgSendTxResponse); + // UpdateParams defines a rpc handler for MsgUpdateParams. + rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); } // MsgRegisterInterchainAccount defines the payload for Msg/RegisterAccount message MsgRegisterInterchainAccount { - option (gogoproto.equal) = false; + option (cosmos.msg.v1.signer) = "owner"; + option (gogoproto.goproto_getters) = false; - string owner = 1; - string connection_id = 2 [(gogoproto.moretags) = "yaml:\"connection_id\""]; - string version = 3; + string owner = 1; + string connection_id = 2; + string version = 3; + ibc.core.channel.v1.Order ordering = 4; } // MsgRegisterInterchainAccountResponse defines the response for Msg/RegisterAccount message MsgRegisterInterchainAccountResponse { - string channel_id = 1 [(gogoproto.moretags) = "yaml:\"channel_id\""]; - string port_id = 2 [(gogoproto.moretags) = "yaml:\"port_id\""]; + option (gogoproto.goproto_getters) = false; + + string channel_id = 1; + string port_id = 2; } // MsgSendTx defines the payload for Msg/SendTx message MsgSendTx { - option (gogoproto.equal) = false; + option (cosmos.msg.v1.signer) = "owner"; + option (gogoproto.goproto_getters) = false; - string owner = 1; - string connection_id = 2 [(gogoproto.moretags) = "yaml:\"connection_id\""]; - ibc.applications.interchain_accounts.v1.InterchainAccountPacketData packet_data = 3 - [(gogoproto.moretags) = "yaml:\"packet_data\"", (gogoproto.nullable) = false]; + string owner = 1; + string connection_id = 2; + ibc.applications.interchain_accounts.v1.InterchainAccountPacketData packet_data = 3 [(gogoproto.nullable) = false]; // Relative timeout timestamp provided will be added to the current block time during transaction execution. // The timeout timestamp must be non-zero. - uint64 relative_timeout = 4 [(gogoproto.moretags) = "yaml:\"relative_timeout\""]; + uint64 relative_timeout = 4; } // MsgSendTxResponse defines the response for MsgSendTx message MsgSendTxResponse { + option (gogoproto.goproto_getters) = false; + uint64 sequence = 1; } + +// MsgUpdateParams defines the payload for Msg/UpdateParams +message MsgUpdateParams { + option (cosmos.msg.v1.signer) = "signer"; + + option (gogoproto.goproto_getters) = false; + + // signer address + string signer = 1; + + // params defines the 27-interchain-accounts/controller parameters to update. + // + // NOTE: All parameters must be supplied. + Params params = 2 [(gogoproto.nullable) = false]; +} + +// MsgUpdateParamsResponse defines the response for Msg/UpdateParams +message MsgUpdateParamsResponse {} \ No newline at end of file diff --git a/third_party/proto/ibc/applications/interchain_accounts/genesis/v1/genesis.proto b/third_party/proto/ibc/applications/interchain_accounts/genesis/v1/genesis.proto index 2fed3763ff..4393e5b0bc 100644 --- a/third_party/proto/ibc/applications/interchain_accounts/genesis/v1/genesis.proto +++ b/third_party/proto/ibc/applications/interchain_accounts/genesis/v1/genesis.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.applications.interchain_accounts.genesis.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/genesis/types"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/genesis/types"; import "gogoproto/gogo.proto"; import "ibc/applications/interchain_accounts/controller/v1/controller.proto"; @@ -10,44 +10,38 @@ import "ibc/applications/interchain_accounts/host/v1/host.proto"; // GenesisState defines the interchain accounts genesis state message GenesisState { - ControllerGenesisState controller_genesis_state = 1 - [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"controller_genesis_state\""]; - HostGenesisState host_genesis_state = 2 - [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"host_genesis_state\""]; + ControllerGenesisState controller_genesis_state = 1 [(gogoproto.nullable) = false]; + HostGenesisState host_genesis_state = 2 [(gogoproto.nullable) = false]; } // ControllerGenesisState defines the interchain accounts controller genesis state message ControllerGenesisState { - repeated ActiveChannel active_channels = 1 - [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"active_channels\""]; - repeated RegisteredInterchainAccount interchain_accounts = 2 - [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"interchain_accounts\""]; - repeated string ports = 3; - ibc.applications.interchain_accounts.controller.v1.Params params = 4 [(gogoproto.nullable) = false]; + repeated ActiveChannel active_channels = 1 [(gogoproto.nullable) = false]; + repeated RegisteredInterchainAccount interchain_accounts = 2 [(gogoproto.nullable) = false]; + repeated string ports = 3; + ibc.applications.interchain_accounts.controller.v1.Params params = 4 [(gogoproto.nullable) = false]; } // HostGenesisState defines the interchain accounts host genesis state message HostGenesisState { - repeated ActiveChannel active_channels = 1 - [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"active_channels\""]; - repeated RegisteredInterchainAccount interchain_accounts = 2 - [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"interchain_accounts\""]; - string port = 3; - ibc.applications.interchain_accounts.host.v1.Params params = 4 [(gogoproto.nullable) = false]; + repeated ActiveChannel active_channels = 1 [(gogoproto.nullable) = false]; + repeated RegisteredInterchainAccount interchain_accounts = 2 [(gogoproto.nullable) = false]; + string port = 3; + ibc.applications.interchain_accounts.host.v1.Params params = 4 [(gogoproto.nullable) = false]; } // ActiveChannel contains a connection ID, port ID and associated active channel ID, as well as a boolean flag to // indicate if the channel is middleware enabled message ActiveChannel { - string connection_id = 1 [(gogoproto.moretags) = "yaml:\"connection_id\""]; - string port_id = 2 [(gogoproto.moretags) = "yaml:\"port_id\""]; - string channel_id = 3 [(gogoproto.moretags) = "yaml:\"channel_id\""]; - bool is_middleware_enabled = 4 [(gogoproto.moretags) = "yaml:\"is_middleware_enabled\""]; + string connection_id = 1; + string port_id = 2; + string channel_id = 3; + bool is_middleware_enabled = 4; } // RegisteredInterchainAccount contains a connection ID, port ID and associated interchain account address message RegisteredInterchainAccount { - string connection_id = 1 [(gogoproto.moretags) = "yaml:\"connection_id\""]; - string port_id = 2 [(gogoproto.moretags) = "yaml:\"port_id\""]; - string account_address = 3 [(gogoproto.moretags) = "yaml:\"account_address\""]; + string connection_id = 1; + string port_id = 2; + string account_address = 3; } \ No newline at end of file diff --git a/third_party/proto/ibc/applications/interchain_accounts/host/v1/host.proto b/third_party/proto/ibc/applications/interchain_accounts/host/v1/host.proto index 18cc1d13da..9165f36e79 100644 --- a/third_party/proto/ibc/applications/interchain_accounts/host/v1/host.proto +++ b/third_party/proto/ibc/applications/interchain_accounts/host/v1/host.proto @@ -2,15 +2,24 @@ syntax = "proto3"; package ibc.applications.interchain_accounts.host.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/types"; - -import "gogoproto/gogo.proto"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host/types"; // Params defines the set of on-chain interchain accounts parameters. // The following parameters may be used to disable the host submodule. message Params { // host_enabled enables or disables the host submodule. - bool host_enabled = 1 [(gogoproto.moretags) = "yaml:\"host_enabled\""]; + bool host_enabled = 1; // allow_messages defines a list of sdk message typeURLs allowed to be executed on a host chain. - repeated string allow_messages = 2 [(gogoproto.moretags) = "yaml:\"allow_messages\""]; + repeated string allow_messages = 2; +} + +// QueryRequest defines the parameters for a particular query request +// by an interchain account. +message QueryRequest { + // path defines the path of the query request as defined by ADR-021. + // https://github.com/cosmos/cosmos-sdk/blob/main/docs/architecture/adr-021-protobuf-query-encoding.md#custom-query-registration-and-routing + string path = 1; + // data defines the payload of the query request as defined by ADR-021. + // https://github.com/cosmos/cosmos-sdk/blob/main/docs/architecture/adr-021-protobuf-query-encoding.md#custom-query-registration-and-routing + bytes data = 2; } diff --git a/third_party/proto/ibc/applications/interchain_accounts/host/v1/query.proto b/third_party/proto/ibc/applications/interchain_accounts/host/v1/query.proto index b89ed8ed87..6f206a14c8 100644 --- a/third_party/proto/ibc/applications/interchain_accounts/host/v1/query.proto +++ b/third_party/proto/ibc/applications/interchain_accounts/host/v1/query.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.applications.interchain_accounts.host.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/types"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host/types"; import "google/api/annotations.proto"; import "ibc/applications/interchain_accounts/host/v1/host.proto"; diff --git a/third_party/proto/ibc/applications/interchain_accounts/host/v1/tx.proto b/third_party/proto/ibc/applications/interchain_accounts/host/v1/tx.proto new file mode 100644 index 0000000000..22e8c9b356 --- /dev/null +++ b/third_party/proto/ibc/applications/interchain_accounts/host/v1/tx.proto @@ -0,0 +1,60 @@ +syntax = "proto3"; + +package ibc.applications.interchain_accounts.host.v1; + +option go_package = "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host/types"; + +import "gogoproto/gogo.proto"; +import "cosmos/msg/v1/msg.proto"; +import "ibc/applications/interchain_accounts/host/v1/host.proto"; + +// Msg defines the 27-interchain-accounts/host Msg service. +service Msg { + option (cosmos.msg.v1.service) = true; + + // UpdateParams defines a rpc handler for MsgUpdateParams. + rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); + + // ModuleQuerySafe defines a rpc handler for MsgModuleQuerySafe. + rpc ModuleQuerySafe(MsgModuleQuerySafe) returns (MsgModuleQuerySafeResponse); +} + +// MsgUpdateParams defines the payload for Msg/UpdateParams +message MsgUpdateParams { + option (cosmos.msg.v1.signer) = "signer"; + + option (gogoproto.goproto_getters) = false; + + // signer address + string signer = 1; + + // params defines the 27-interchain-accounts/host parameters to update. + // + // NOTE: All parameters must be supplied. + Params params = 2 [(gogoproto.nullable) = false]; +} + +// MsgUpdateParamsResponse defines the response for Msg/UpdateParams +message MsgUpdateParamsResponse {} + +// MsgModuleQuerySafe defines the payload for Msg/ModuleQuerySafe +message MsgModuleQuerySafe { + option (cosmos.msg.v1.signer) = "signer"; + + option (gogoproto.goproto_getters) = false; + + // signer address + string signer = 1; + + // requests defines the module safe queries to execute. + repeated QueryRequest requests = 2; +} + +// MsgModuleQuerySafeResponse defines the response for Msg/ModuleQuerySafe +message MsgModuleQuerySafeResponse { + // height at which the responses were queried + uint64 height = 1; + + // protobuf encoded responses for each query + repeated bytes responses = 2; +} diff --git a/third_party/proto/ibc/applications/interchain_accounts/v1/account.proto b/third_party/proto/ibc/applications/interchain_accounts/v1/account.proto index d60c27a9c2..4a6947c1c6 100644 --- a/third_party/proto/ibc/applications/interchain_accounts/v1/account.proto +++ b/third_party/proto/ibc/applications/interchain_accounts/v1/account.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.applications.interchain_accounts.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types"; import "cosmos_proto/cosmos.proto"; import "gogoproto/gogo.proto"; @@ -14,7 +14,6 @@ message InterchainAccount { option (gogoproto.goproto_stringer) = false; option (cosmos_proto.implements_interface) = "ibc.applications.interchain_accounts.v1.InterchainAccountI"; - cosmos.auth.v1beta1.BaseAccount base_account = 1 - [(gogoproto.embed) = true, (gogoproto.moretags) = "yaml:\"base_account\""]; - string account_owner = 2 [(gogoproto.moretags) = "yaml:\"account_owner\""]; + cosmos.auth.v1beta1.BaseAccount base_account = 1 [(gogoproto.embed) = true]; + string account_owner = 2; } diff --git a/third_party/proto/ibc/applications/interchain_accounts/v1/metadata.proto b/third_party/proto/ibc/applications/interchain_accounts/v1/metadata.proto index 9ea7eeca33..df72b41eb6 100644 --- a/third_party/proto/ibc/applications/interchain_accounts/v1/metadata.proto +++ b/third_party/proto/ibc/applications/interchain_accounts/v1/metadata.proto @@ -2,9 +2,7 @@ syntax = "proto3"; package ibc.applications.interchain_accounts.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types"; - -import "gogoproto/gogo.proto"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types"; // Metadata defines a set of protocol specific data encoded into the ICS27 channel version bytestring // See ICS004: https://github.com/cosmos/ibc/tree/master/spec/core/ics-004-channel-and-packet-semantics#Versioning @@ -12,9 +10,9 @@ message Metadata { // version defines the ICS27 protocol version string version = 1; // controller_connection_id is the connection identifier associated with the controller chain - string controller_connection_id = 2 [(gogoproto.moretags) = "yaml:\"controller_connection_id\""]; + string controller_connection_id = 2; // host_connection_id is the connection identifier associated with the host chain - string host_connection_id = 3 [(gogoproto.moretags) = "yaml:\"host_connection_id\""]; + string host_connection_id = 3; // address defines the interchain account address to be fulfilled upon the OnChanOpenTry handshake step // NOTE: the address field is empty on the OnChanOpenInit handshake step string address = 4; diff --git a/third_party/proto/ibc/applications/interchain_accounts/v1/packet.proto b/third_party/proto/ibc/applications/interchain_accounts/v1/packet.proto index d2dcf518ea..f75a1463e9 100644 --- a/third_party/proto/ibc/applications/interchain_accounts/v1/packet.proto +++ b/third_party/proto/ibc/applications/interchain_accounts/v1/packet.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.applications.interchain_accounts.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types"; import "google/protobuf/any.proto"; import "gogoproto/gogo.proto"; diff --git a/third_party/proto/ibc/applications/transfer/v1/authz.proto b/third_party/proto/ibc/applications/transfer/v1/authz.proto index 8b27ac9cf7..5c4b71d347 100644 --- a/third_party/proto/ibc/applications/transfer/v1/authz.proto +++ b/third_party/proto/ibc/applications/transfer/v1/authz.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.applications.transfer.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types"; import "cosmos_proto/cosmos.proto"; import "gogoproto/gogo.proto"; @@ -11,14 +11,17 @@ import "cosmos/base/v1beta1/coin.proto"; // Allocation defines the spend limit for a particular port and channel message Allocation { // the port on which the packet will be sent - string source_port = 1 [(gogoproto.moretags) = "yaml:\"source_port\""]; + string source_port = 1; // the channel by which the packet will be sent - string source_channel = 2 [(gogoproto.moretags) = "yaml:\"source_channel\""]; + string source_channel = 2; // spend limitation on the channel repeated cosmos.base.v1beta1.Coin spend_limit = 3 [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; // allow list of receivers, an empty allow list permits any receiver address repeated string allow_list = 4; + // allow list of memo strings, an empty list prohibits all memo strings; + // a list only with "*" permits any memo string + repeated string allowed_packet_data = 5; } // TransferAuthorization allows the grantee to spend up to spend_limit coins from diff --git a/third_party/proto/ibc/applications/transfer/v1/genesis.proto b/third_party/proto/ibc/applications/transfer/v1/genesis.proto index b3f013e1ee..f7d707f6cc 100644 --- a/third_party/proto/ibc/applications/transfer/v1/genesis.proto +++ b/third_party/proto/ibc/applications/transfer/v1/genesis.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.applications.transfer.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types"; import "ibc/applications/transfer/v1/transfer.proto"; import "cosmos/base/v1beta1/coin.proto"; @@ -10,18 +10,11 @@ import "gogoproto/gogo.proto"; // GenesisState defines the ibc-transfer genesis state message GenesisState { - string port_id = 1 [(gogoproto.moretags) = "yaml:\"port_id\""]; - repeated DenomTrace denom_traces = 2 [ - (gogoproto.castrepeated) = "Traces", - (gogoproto.nullable) = false, - (gogoproto.moretags) = "yaml:\"denom_traces\"" - ]; - Params params = 3 [(gogoproto.nullable) = false]; + string port_id = 1; + repeated DenomTrace denom_traces = 2 [(gogoproto.castrepeated) = "Traces", (gogoproto.nullable) = false]; + Params params = 3 [(gogoproto.nullable) = false]; // total_escrowed contains the total amount of tokens escrowed // by the transfer module - repeated cosmos.base.v1beta1.Coin total_escrowed = 4 [ - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", - (gogoproto.nullable) = false, - (gogoproto.moretags) = "yaml:\"total_escrowed\"" - ]; + repeated cosmos.base.v1beta1.Coin total_escrowed = 4 + [(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", (gogoproto.nullable) = false]; } diff --git a/third_party/proto/ibc/applications/transfer/v1/query.proto b/third_party/proto/ibc/applications/transfer/v1/query.proto index 66670407a2..788296718f 100644 --- a/third_party/proto/ibc/applications/transfer/v1/query.proto +++ b/third_party/proto/ibc/applications/transfer/v1/query.proto @@ -8,7 +8,7 @@ import "cosmos/base/query/v1beta1/pagination.proto"; import "ibc/applications/transfer/v1/transfer.proto"; import "google/api/annotations.proto"; -option go_package = "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types"; // Query provides defines the gRPC querier service. service Query { diff --git a/third_party/proto/ibc/applications/transfer/v1/transfer.proto b/third_party/proto/ibc/applications/transfer/v1/transfer.proto index 2171074799..7f77237621 100644 --- a/third_party/proto/ibc/applications/transfer/v1/transfer.proto +++ b/third_party/proto/ibc/applications/transfer/v1/transfer.proto @@ -2,9 +2,7 @@ syntax = "proto3"; package ibc.applications.transfer.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types"; - -import "gogoproto/gogo.proto"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types"; // DenomTrace contains the base denomination for ICS20 fungible tokens and the // source tracing information path. @@ -23,8 +21,8 @@ message DenomTrace { message Params { // send_enabled enables or disables all cross-chain token transfers from this // chain. - bool send_enabled = 1 [(gogoproto.moretags) = "yaml:\"send_enabled\""]; + bool send_enabled = 1; // receive_enabled enables or disables all cross-chain token transfers to this // chain. - bool receive_enabled = 2 [(gogoproto.moretags) = "yaml:\"receive_enabled\""]; + bool receive_enabled = 2; } diff --git a/third_party/proto/ibc/applications/transfer/v1/tx.proto b/third_party/proto/ibc/applications/transfer/v1/tx.proto index 1c67aafb93..42c70d3bed 100644 --- a/third_party/proto/ibc/applications/transfer/v1/tx.proto +++ b/third_party/proto/ibc/applications/transfer/v1/tx.proto @@ -2,48 +2,78 @@ syntax = "proto3"; package ibc.applications.transfer.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types"; +import "amino/amino.proto"; import "gogoproto/gogo.proto"; +import "cosmos/msg/v1/msg.proto"; import "cosmos/base/v1beta1/coin.proto"; import "ibc/core/client/v1/client.proto"; +import "ibc/applications/transfer/v1/transfer.proto"; // Msg defines the ibc/transfer Msg service. service Msg { + option (cosmos.msg.v1.service) = true; + // Transfer defines a rpc handler method for MsgTransfer. rpc Transfer(MsgTransfer) returns (MsgTransferResponse); + + // UpdateParams defines a rpc handler for MsgUpdateParams. + rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); } // MsgTransfer defines a msg to transfer fungible tokens (i.e Coins) between // ICS20 enabled chains. See ICS Spec here: // https://github.com/cosmos/ibc/tree/master/spec/app/ics-020-fungible-token-transfer#data-structures message MsgTransfer { - option (gogoproto.equal) = false; + option (amino.name) = "cosmos-sdk/MsgTransfer"; + option (cosmos.msg.v1.signer) = "sender"; + option (gogoproto.goproto_getters) = false; // the port on which the packet will be sent - string source_port = 1 [(gogoproto.moretags) = "yaml:\"source_port\""]; + string source_port = 1; // the channel by which the packet will be sent - string source_channel = 2 [(gogoproto.moretags) = "yaml:\"source_channel\""]; + string source_channel = 2; // the tokens to be transferred - cosmos.base.v1beta1.Coin token = 3 [(gogoproto.nullable) = false]; + cosmos.base.v1beta1.Coin token = 3 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; // the sender address string sender = 4; // the recipient address on the destination chain string receiver = 5; // Timeout height relative to the current block height. // The timeout is disabled when set to 0. - ibc.core.client.v1.Height timeout_height = 6 - [(gogoproto.moretags) = "yaml:\"timeout_height\"", (gogoproto.nullable) = false]; + ibc.core.client.v1.Height timeout_height = 6 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; // Timeout timestamp in absolute nanoseconds since unix epoch. // The timeout is disabled when set to 0. - uint64 timeout_timestamp = 7 [(gogoproto.moretags) = "yaml:\"timeout_timestamp\""]; + uint64 timeout_timestamp = 7; // optional memo string memo = 8; } // MsgTransferResponse defines the Msg/Transfer response type. message MsgTransferResponse { + option (gogoproto.goproto_getters) = false; + // sequence number of the transfer packet sent uint64 sequence = 1; } + +// MsgUpdateParams is the Msg/UpdateParams request type. +message MsgUpdateParams { + option (cosmos.msg.v1.signer) = "signer"; + + option (gogoproto.goproto_getters) = false; + + // signer address + string signer = 1; + + // params defines the transfer parameters to update. + // + // NOTE: All parameters must be supplied. + Params params = 2 [(gogoproto.nullable) = false]; +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +message MsgUpdateParamsResponse {} \ No newline at end of file diff --git a/third_party/proto/ibc/applications/transfer/v2/packet.proto b/third_party/proto/ibc/applications/transfer/v2/packet.proto index 7dc31347af..bff35bdd6d 100644 --- a/third_party/proto/ibc/applications/transfer/v2/packet.proto +++ b/third_party/proto/ibc/applications/transfer/v2/packet.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.applications.transfer.v2; -option go_package = "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types"; // FungibleTokenPacketData defines a struct for the packet payload // See FungibleTokenPacketData spec: diff --git a/third_party/proto/ibc/core/channel/v1/channel.proto b/third_party/proto/ibc/core/channel/v1/channel.proto index 5fbb0d423f..05a18fefb7 100644 --- a/third_party/proto/ibc/core/channel/v1/channel.proto +++ b/third_party/proto/ibc/core/channel/v1/channel.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.core.channel.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types"; import "gogoproto/gogo.proto"; import "ibc/core/client/v1/client.proto"; @@ -21,9 +21,12 @@ message Channel { Counterparty counterparty = 3 [(gogoproto.nullable) = false]; // list of connection identifiers, in order, along which packets sent on // this channel will travel - repeated string connection_hops = 4 [(gogoproto.moretags) = "yaml:\"connection_hops\""]; + repeated string connection_hops = 4; // opaque channel version, which is agreed upon during the handshake string version = 5; + // upgrade sequence indicates the latest upgrade attempt performed by this channel + // the value of 0 indicates the channel has never been upgraded + uint64 upgrade_sequence = 6; } // IdentifiedChannel defines a channel with additional port and channel @@ -39,17 +42,20 @@ message IdentifiedChannel { Counterparty counterparty = 3 [(gogoproto.nullable) = false]; // list of connection identifiers, in order, along which packets sent on // this channel will travel - repeated string connection_hops = 4 [(gogoproto.moretags) = "yaml:\"connection_hops\""]; + repeated string connection_hops = 4; // opaque channel version, which is agreed upon during the handshake string version = 5; // port identifier string port_id = 6; // channel identifier string channel_id = 7; + // upgrade sequence indicates the latest upgrade attempt performed by this channel + // the value of 0 indicates the channel has never been upgraded + uint64 upgrade_sequence = 8; } // State defines if a channel is in one of the following states: -// CLOSED, INIT, TRYOPEN, OPEN or UNINITIALIZED. +// CLOSED, INIT, TRYOPEN, OPEN, FLUSHING, FLUSHCOMPLETE or UNINITIALIZED. enum State { option (gogoproto.goproto_enum_prefix) = false; @@ -65,6 +71,10 @@ enum State { // A channel has been closed and can no longer be used to send or receive // packets. STATE_CLOSED = 4 [(gogoproto.enumvalue_customname) = "CLOSED"]; + // A channel has just accepted the upgrade handshake attempt and is flushing in-flight packets. + STATE_FLUSHING = 5 [(gogoproto.enumvalue_customname) = "FLUSHING"]; + // A channel has just completed flushing any in-flight packets. + STATE_FLUSHCOMPLETE = 6 [(gogoproto.enumvalue_customname) = "FLUSHCOMPLETE"]; } // Order defines if a channel is ORDERED or UNORDERED @@ -85,9 +95,9 @@ message Counterparty { option (gogoproto.goproto_getters) = false; // port on the counterparty chain which owns the other end of the channel. - string port_id = 1 [(gogoproto.moretags) = "yaml:\"port_id\""]; + string port_id = 1; // channel end on the counterparty chain - string channel_id = 2 [(gogoproto.moretags) = "yaml:\"channel_id\""]; + string channel_id = 2; } // Packet defines a type that carries data across different chains through IBC @@ -99,20 +109,19 @@ message Packet { // with a later sequence number. uint64 sequence = 1; // identifies the port on the sending chain. - string source_port = 2 [(gogoproto.moretags) = "yaml:\"source_port\""]; + string source_port = 2; // identifies the channel end on the sending chain. - string source_channel = 3 [(gogoproto.moretags) = "yaml:\"source_channel\""]; + string source_channel = 3; // identifies the port on the receiving chain. - string destination_port = 4 [(gogoproto.moretags) = "yaml:\"destination_port\""]; + string destination_port = 4; // identifies the channel end on the receiving chain. - string destination_channel = 5 [(gogoproto.moretags) = "yaml:\"destination_channel\""]; + string destination_channel = 5; // actual opaque bytes transferred directly to the application module bytes data = 6; // block height after which the packet times out - ibc.core.client.v1.Height timeout_height = 7 - [(gogoproto.moretags) = "yaml:\"timeout_height\"", (gogoproto.nullable) = false]; + ibc.core.client.v1.Height timeout_height = 7 [(gogoproto.nullable) = false]; // block timestamp (in nanoseconds) after which the packet times out - uint64 timeout_timestamp = 8 [(gogoproto.moretags) = "yaml:\"timeout_timestamp\""]; + uint64 timeout_timestamp = 8; } // PacketState defines the generic type necessary to retrieve and store @@ -123,9 +132,9 @@ message PacketState { option (gogoproto.goproto_getters) = false; // channel port identifier. - string port_id = 1 [(gogoproto.moretags) = "yaml:\"port_id\""]; + string port_id = 1; // channel unique identifier. - string channel_id = 2 [(gogoproto.moretags) = "yaml:\"channel_id\""]; + string channel_id = 2; // packet sequence. uint64 sequence = 3; // embedded data that represents packet state. @@ -139,9 +148,9 @@ message PacketId { option (gogoproto.goproto_getters) = false; // channel port identifier - string port_id = 1 [(gogoproto.moretags) = "yaml:\"port_id\""]; + string port_id = 1; // channel unique identifier - string channel_id = 2 [(gogoproto.moretags) = "yaml:\"channel_id\""]; + string channel_id = 2; // packet sequence uint64 sequence = 3; } @@ -160,3 +169,19 @@ message Acknowledgement { string error = 22; } } + +// Timeout defines an execution deadline structure for 04-channel handlers. +// This includes packet lifecycle handlers as well as the upgrade handshake handlers. +// A valid Timeout contains either one or both of a timestamp and block height (sequence). +message Timeout { + // block height after which the packet or upgrade times out + ibc.core.client.v1.Height height = 1 [(gogoproto.nullable) = false]; + // block timestamp (in nanoseconds) after which the packet or upgrade times out + uint64 timestamp = 2; +} + +// Params defines the set of IBC channel parameters. +message Params { + // the relative timeout after which channel upgrades will time out. + Timeout upgrade_timeout = 1 [(gogoproto.nullable) = false]; +} diff --git a/third_party/proto/ibc/core/channel/v1/genesis.proto b/third_party/proto/ibc/core/channel/v1/genesis.proto index 65cc928aa2..665b2b1562 100644 --- a/third_party/proto/ibc/core/channel/v1/genesis.proto +++ b/third_party/proto/ibc/core/channel/v1/genesis.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.core.channel.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types"; import "gogoproto/gogo.proto"; import "ibc/core/channel/v1/channel.proto"; @@ -13,20 +13,18 @@ message GenesisState { repeated PacketState acknowledgements = 2 [(gogoproto.nullable) = false]; repeated PacketState commitments = 3 [(gogoproto.nullable) = false]; repeated PacketState receipts = 4 [(gogoproto.nullable) = false]; - repeated PacketSequence send_sequences = 5 - [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"send_sequences\""]; - repeated PacketSequence recv_sequences = 6 - [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"recv_sequences\""]; - repeated PacketSequence ack_sequences = 7 - [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"ack_sequences\""]; + repeated PacketSequence send_sequences = 5 [(gogoproto.nullable) = false]; + repeated PacketSequence recv_sequences = 6 [(gogoproto.nullable) = false]; + repeated PacketSequence ack_sequences = 7 [(gogoproto.nullable) = false]; // the sequence for the next generated channel identifier - uint64 next_channel_sequence = 8 [(gogoproto.moretags) = "yaml:\"next_channel_sequence\""]; + uint64 next_channel_sequence = 8; + Params params = 9 [(gogoproto.nullable) = false]; } // PacketSequence defines the genesis type necessary to retrieve and store // next send and receive sequences. message PacketSequence { - string port_id = 1 [(gogoproto.moretags) = "yaml:\"port_id\""]; - string channel_id = 2 [(gogoproto.moretags) = "yaml:\"channel_id\""]; + string port_id = 1; + string channel_id = 2; uint64 sequence = 3; } diff --git a/third_party/proto/ibc/core/channel/v1/query.proto b/third_party/proto/ibc/core/channel/v1/query.proto index 2d5bdb2fc8..f89d212736 100644 --- a/third_party/proto/ibc/core/channel/v1/query.proto +++ b/third_party/proto/ibc/core/channel/v1/query.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.core.channel.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types"; import "ibc/core/client/v1/client.proto"; import "cosmos/base/query/v1beta1/pagination.proto"; @@ -10,6 +10,7 @@ import "ibc/core/channel/v1/channel.proto"; import "google/api/annotations.proto"; import "google/protobuf/any.proto"; import "gogoproto/gogo.proto"; +import "ibc/core/channel/v1/upgrade.proto"; // Query provides defines the gRPC querier service service Query { @@ -98,6 +99,29 @@ service Query { option (google.api.http).get = "/ibc/core/channel/v1/channels/{channel_id}/" "ports/{port_id}/next_sequence"; } + + // NextSequenceSend returns the next send sequence for a given channel. + rpc NextSequenceSend(QueryNextSequenceSendRequest) returns (QueryNextSequenceSendResponse) { + option (google.api.http).get = "/ibc/core/channel/v1/channels/{channel_id}/" + "ports/{port_id}/next_sequence_send"; + } + + // UpgradeError returns the error receipt if the upgrade handshake failed. + rpc UpgradeError(QueryUpgradeErrorRequest) returns (QueryUpgradeErrorResponse) { + option (google.api.http).get = "/ibc/core/channel/v1/channels/{channel_id}/" + "ports/{port_id}/upgrade_error"; + } + + // Upgrade returns the upgrade for a given port and channel id. + rpc Upgrade(QueryUpgradeRequest) returns (QueryUpgradeResponse) { + option (google.api.http).get = "/ibc/core/channel/v1/channels/{channel_id}/" + "ports/{port_id}/upgrade"; + } + + // ChannelParams queries all parameters of the ibc channel submodule. + rpc ChannelParams(QueryChannelParamsRequest) returns (QueryChannelParamsResponse) { + option (google.api.http).get = "/ibc/core/channel/v1/params"; + } } // QueryChannelRequest is the request type for the Query/Channel RPC method @@ -364,7 +388,7 @@ message QueryNextSequenceReceiveRequest { string channel_id = 2; } -// QuerySequenceResponse is the request type for the +// QuerySequenceResponse is the response type for the // Query/QueryNextSequenceReceiveResponse RPC method message QueryNextSequenceReceiveResponse { // next sequence receive number @@ -374,3 +398,62 @@ message QueryNextSequenceReceiveResponse { // height at which the proof was retrieved ibc.core.client.v1.Height proof_height = 3 [(gogoproto.nullable) = false]; } + +// QueryNextSequenceSendRequest is the request type for the +// Query/QueryNextSequenceSend RPC method +message QueryNextSequenceSendRequest { + // port unique identifier + string port_id = 1; + // channel unique identifier + string channel_id = 2; +} + +// QueryNextSequenceSendResponse is the request type for the +// Query/QueryNextSequenceSend RPC method +message QueryNextSequenceSendResponse { + // next sequence send number + uint64 next_sequence_send = 1; + // merkle proof of existence + bytes proof = 2; + // height at which the proof was retrieved + ibc.core.client.v1.Height proof_height = 3 [(gogoproto.nullable) = false]; +} + +// QueryUpgradeErrorRequest is the request type for the Query/QueryUpgradeError RPC method +message QueryUpgradeErrorRequest { + string port_id = 1; + string channel_id = 2; +} + +// QueryUpgradeErrorResponse is the response type for the Query/QueryUpgradeError RPC method +message QueryUpgradeErrorResponse { + ErrorReceipt error_receipt = 1 [(gogoproto.nullable) = false]; + // merkle proof of existence + bytes proof = 2; + // height at which the proof was retrieved + ibc.core.client.v1.Height proof_height = 3 [(gogoproto.nullable) = false]; +} + +// QueryUpgradeRequest is the request type for the QueryUpgradeRequest RPC method +message QueryUpgradeRequest { + string port_id = 1; + string channel_id = 2; +} + +// QueryUpgradeResponse is the response type for the QueryUpgradeResponse RPC method +message QueryUpgradeResponse { + Upgrade upgrade = 1 [(gogoproto.nullable) = false]; + // merkle proof of existence + bytes proof = 2; + // height at which the proof was retrieved + ibc.core.client.v1.Height proof_height = 3 [(gogoproto.nullable) = false]; +} + +// QueryChannelParamsRequest is the request type for the Query/ChannelParams RPC method. +message QueryChannelParamsRequest {} + +// QueryChannelParamsResponse is the response type for the Query/ChannelParams RPC method. +message QueryChannelParamsResponse { + // params defines the parameters of the module. + Params params = 1; +} \ No newline at end of file diff --git a/third_party/proto/ibc/core/channel/v1/tx.proto b/third_party/proto/ibc/core/channel/v1/tx.proto index a67a375559..3f30e8b8c9 100644 --- a/third_party/proto/ibc/core/channel/v1/tx.proto +++ b/third_party/proto/ibc/core/channel/v1/tx.proto @@ -2,14 +2,18 @@ syntax = "proto3"; package ibc.core.channel.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types"; import "gogoproto/gogo.proto"; +import "cosmos/msg/v1/msg.proto"; import "ibc/core/client/v1/client.proto"; import "ibc/core/channel/v1/channel.proto"; +import "ibc/core/channel/v1/upgrade.proto"; // Msg defines the ibc/channel Msg service. service Msg { + option (cosmos.msg.v1.service) = true; + // ChannelOpenInit defines a rpc handler method for MsgChannelOpenInit. rpc ChannelOpenInit(MsgChannelOpenInit) returns (MsgChannelOpenInitResponse); @@ -40,6 +44,33 @@ service Msg { // Acknowledgement defines a rpc handler method for MsgAcknowledgement. rpc Acknowledgement(MsgAcknowledgement) returns (MsgAcknowledgementResponse); + + // ChannelUpgradeInit defines a rpc handler method for MsgChannelUpgradeInit. + rpc ChannelUpgradeInit(MsgChannelUpgradeInit) returns (MsgChannelUpgradeInitResponse); + + // ChannelUpgradeTry defines a rpc handler method for MsgChannelUpgradeTry. + rpc ChannelUpgradeTry(MsgChannelUpgradeTry) returns (MsgChannelUpgradeTryResponse); + + // ChannelUpgradeAck defines a rpc handler method for MsgChannelUpgradeAck. + rpc ChannelUpgradeAck(MsgChannelUpgradeAck) returns (MsgChannelUpgradeAckResponse); + + // ChannelUpgradeConfirm defines a rpc handler method for MsgChannelUpgradeConfirm. + rpc ChannelUpgradeConfirm(MsgChannelUpgradeConfirm) returns (MsgChannelUpgradeConfirmResponse); + + // ChannelUpgradeOpen defines a rpc handler method for MsgChannelUpgradeOpen. + rpc ChannelUpgradeOpen(MsgChannelUpgradeOpen) returns (MsgChannelUpgradeOpenResponse); + + // ChannelUpgradeTimeout defines a rpc handler method for MsgChannelUpgradeTimeout. + rpc ChannelUpgradeTimeout(MsgChannelUpgradeTimeout) returns (MsgChannelUpgradeTimeoutResponse); + + // ChannelUpgradeCancel defines a rpc handler method for MsgChannelUpgradeCancel. + rpc ChannelUpgradeCancel(MsgChannelUpgradeCancel) returns (MsgChannelUpgradeCancelResponse); + + // UpdateChannelParams defines a rpc handler method for MsgUpdateParams. + rpc UpdateChannelParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); + + // PruneAcknowledgements defines a rpc handler method for MsgPruneAcknowledgements. + rpc PruneAcknowledgements(MsgPruneAcknowledgements) returns (MsgPruneAcknowledgementsResponse); } // ResponseResultType defines the possible outcomes of the execution of a message @@ -52,22 +83,27 @@ enum ResponseResultType { RESPONSE_RESULT_TYPE_NOOP = 1 [(gogoproto.enumvalue_customname) = "NOOP"]; // The message was executed successfully RESPONSE_RESULT_TYPE_SUCCESS = 2 [(gogoproto.enumvalue_customname) = "SUCCESS"]; + // The message was executed unsuccessfully + RESPONSE_RESULT_TYPE_FAILURE = 3 [(gogoproto.enumvalue_customname) = "FAILURE"]; } // MsgChannelOpenInit defines an sdk.Msg to initialize a channel handshake. It // is called by a relayer on Chain A. message MsgChannelOpenInit { - option (gogoproto.equal) = false; + option (cosmos.msg.v1.signer) = "signer"; + option (gogoproto.goproto_getters) = false; - string port_id = 1 [(gogoproto.moretags) = "yaml:\"port_id\""]; + string port_id = 1; Channel channel = 2 [(gogoproto.nullable) = false]; string signer = 3; } // MsgChannelOpenInitResponse defines the Msg/ChannelOpenInit response type. message MsgChannelOpenInitResponse { - string channel_id = 1 [(gogoproto.moretags) = "yaml:\"channel_id\""]; + option (gogoproto.goproto_getters) = false; + + string channel_id = 1; string version = 2; } @@ -75,41 +111,46 @@ message MsgChannelOpenInitResponse { // on Chain B. The version field within the Channel field has been deprecated. Its // value will be ignored by core IBC. message MsgChannelOpenTry { - option (gogoproto.equal) = false; + option (cosmos.msg.v1.signer) = "signer"; + option (gogoproto.goproto_getters) = false; - string port_id = 1 [(gogoproto.moretags) = "yaml:\"port_id\""]; + string port_id = 1; // Deprecated: this field is unused. Crossing hello's are no longer supported in core IBC. - string previous_channel_id = 2 [deprecated = true, (gogoproto.moretags) = "yaml:\"previous_channel_id\""]; + string previous_channel_id = 2 [deprecated = true]; // NOTE: the version field within the channel has been deprecated. Its value will be ignored by core IBC. Channel channel = 3 [(gogoproto.nullable) = false]; - string counterparty_version = 4 [(gogoproto.moretags) = "yaml:\"counterparty_version\""]; - bytes proof_init = 5 [(gogoproto.moretags) = "yaml:\"proof_init\""]; - ibc.core.client.v1.Height proof_height = 6 - [(gogoproto.moretags) = "yaml:\"proof_height\"", (gogoproto.nullable) = false]; - string signer = 7; + string counterparty_version = 4; + bytes proof_init = 5; + ibc.core.client.v1.Height proof_height = 6 [(gogoproto.nullable) = false]; + string signer = 7; } // MsgChannelOpenTryResponse defines the Msg/ChannelOpenTry response type. message MsgChannelOpenTryResponse { + option (gogoproto.goproto_getters) = false; + string version = 1; - string channel_id = 2 [(gogoproto.moretags) = "yaml:\"channel_id\""]; + string channel_id = 2; } // MsgChannelOpenAck defines a msg sent by a Relayer to Chain A to acknowledge // the change of channel state to TRYOPEN on Chain B. +// WARNING: a channel upgrade MUST NOT initialize an upgrade for this channel +// in the same block as executing this message otherwise the counterparty will +// be incapable of opening. message MsgChannelOpenAck { - option (gogoproto.equal) = false; + option (cosmos.msg.v1.signer) = "signer"; + option (gogoproto.goproto_getters) = false; - string port_id = 1 [(gogoproto.moretags) = "yaml:\"port_id\""]; - string channel_id = 2 [(gogoproto.moretags) = "yaml:\"channel_id\""]; - string counterparty_channel_id = 3 [(gogoproto.moretags) = "yaml:\"counterparty_channel_id\""]; - string counterparty_version = 4 [(gogoproto.moretags) = "yaml:\"counterparty_version\""]; - bytes proof_try = 5 [(gogoproto.moretags) = "yaml:\"proof_try\""]; - ibc.core.client.v1.Height proof_height = 6 - [(gogoproto.moretags) = "yaml:\"proof_height\"", (gogoproto.nullable) = false]; - string signer = 7; + string port_id = 1; + string channel_id = 2; + string counterparty_channel_id = 3; + string counterparty_version = 4; + bytes proof_try = 5; + ibc.core.client.v1.Height proof_height = 6 [(gogoproto.nullable) = false]; + string signer = 7; } // MsgChannelOpenAckResponse defines the Msg/ChannelOpenAck response type. @@ -118,15 +159,15 @@ message MsgChannelOpenAckResponse {} // MsgChannelOpenConfirm defines a msg sent by a Relayer to Chain B to // acknowledge the change of channel state to OPEN on Chain A. message MsgChannelOpenConfirm { - option (gogoproto.equal) = false; + option (cosmos.msg.v1.signer) = "signer"; + option (gogoproto.goproto_getters) = false; - string port_id = 1 [(gogoproto.moretags) = "yaml:\"port_id\""]; - string channel_id = 2 [(gogoproto.moretags) = "yaml:\"channel_id\""]; - bytes proof_ack = 3 [(gogoproto.moretags) = "yaml:\"proof_ack\""]; - ibc.core.client.v1.Height proof_height = 4 - [(gogoproto.moretags) = "yaml:\"proof_height\"", (gogoproto.nullable) = false]; - string signer = 5; + string port_id = 1; + string channel_id = 2; + bytes proof_ack = 3; + ibc.core.client.v1.Height proof_height = 4 [(gogoproto.nullable) = false]; + string signer = 5; } // MsgChannelOpenConfirmResponse defines the Msg/ChannelOpenConfirm response @@ -136,11 +177,12 @@ message MsgChannelOpenConfirmResponse {} // MsgChannelCloseInit defines a msg sent by a Relayer to Chain A // to close a channel with Chain B. message MsgChannelCloseInit { - option (gogoproto.equal) = false; + option (cosmos.msg.v1.signer) = "signer"; + option (gogoproto.goproto_getters) = false; - string port_id = 1 [(gogoproto.moretags) = "yaml:\"port_id\""]; - string channel_id = 2 [(gogoproto.moretags) = "yaml:\"channel_id\""]; + string port_id = 1; + string channel_id = 2; string signer = 3; } @@ -150,15 +192,16 @@ message MsgChannelCloseInitResponse {} // MsgChannelCloseConfirm defines a msg sent by a Relayer to Chain B // to acknowledge the change of channel state to CLOSED on Chain A. message MsgChannelCloseConfirm { - option (gogoproto.equal) = false; + option (cosmos.msg.v1.signer) = "signer"; + option (gogoproto.goproto_getters) = false; - string port_id = 1 [(gogoproto.moretags) = "yaml:\"port_id\""]; - string channel_id = 2 [(gogoproto.moretags) = "yaml:\"channel_id\""]; - bytes proof_init = 3 [(gogoproto.moretags) = "yaml:\"proof_init\""]; - ibc.core.client.v1.Height proof_height = 4 - [(gogoproto.moretags) = "yaml:\"proof_height\"", (gogoproto.nullable) = false]; - string signer = 5; + string port_id = 1; + string channel_id = 2; + bytes proof_init = 3; + ibc.core.client.v1.Height proof_height = 4 [(gogoproto.nullable) = false]; + string signer = 5; + uint64 counterparty_upgrade_sequence = 6; } // MsgChannelCloseConfirmResponse defines the Msg/ChannelCloseConfirm response @@ -167,14 +210,14 @@ message MsgChannelCloseConfirmResponse {} // MsgRecvPacket receives incoming IBC packet message MsgRecvPacket { - option (gogoproto.equal) = false; + option (cosmos.msg.v1.signer) = "signer"; + option (gogoproto.goproto_getters) = false; Packet packet = 1 [(gogoproto.nullable) = false]; - bytes proof_commitment = 2 [(gogoproto.moretags) = "yaml:\"proof_commitment\""]; - ibc.core.client.v1.Height proof_height = 3 - [(gogoproto.moretags) = "yaml:\"proof_height\"", (gogoproto.nullable) = false]; - string signer = 4; + bytes proof_commitment = 2; + ibc.core.client.v1.Height proof_height = 3 [(gogoproto.nullable) = false]; + string signer = 4; } // MsgRecvPacketResponse defines the Msg/RecvPacket response type. @@ -186,15 +229,15 @@ message MsgRecvPacketResponse { // MsgTimeout receives timed-out packet message MsgTimeout { - option (gogoproto.equal) = false; + option (cosmos.msg.v1.signer) = "signer"; + option (gogoproto.goproto_getters) = false; - Packet packet = 1 [(gogoproto.nullable) = false]; - bytes proof_unreceived = 2 [(gogoproto.moretags) = "yaml:\"proof_unreceived\""]; - ibc.core.client.v1.Height proof_height = 3 - [(gogoproto.moretags) = "yaml:\"proof_height\"", (gogoproto.nullable) = false]; - uint64 next_sequence_recv = 4 [(gogoproto.moretags) = "yaml:\"next_sequence_recv\""]; - string signer = 5; + Packet packet = 1 [(gogoproto.nullable) = false]; + bytes proof_unreceived = 2; + ibc.core.client.v1.Height proof_height = 3 [(gogoproto.nullable) = false]; + uint64 next_sequence_recv = 4; + string signer = 5; } // MsgTimeoutResponse defines the Msg/Timeout response type. @@ -206,16 +249,17 @@ message MsgTimeoutResponse { // MsgTimeoutOnClose timed-out packet upon counterparty channel closure. message MsgTimeoutOnClose { - option (gogoproto.equal) = false; + option (cosmos.msg.v1.signer) = "signer"; + option (gogoproto.goproto_getters) = false; - Packet packet = 1 [(gogoproto.nullable) = false]; - bytes proof_unreceived = 2 [(gogoproto.moretags) = "yaml:\"proof_unreceived\""]; - bytes proof_close = 3 [(gogoproto.moretags) = "yaml:\"proof_close\""]; - ibc.core.client.v1.Height proof_height = 4 - [(gogoproto.moretags) = "yaml:\"proof_height\"", (gogoproto.nullable) = false]; - uint64 next_sequence_recv = 5 [(gogoproto.moretags) = "yaml:\"next_sequence_recv\""]; - string signer = 6; + Packet packet = 1 [(gogoproto.nullable) = false]; + bytes proof_unreceived = 2; + bytes proof_close = 3; + ibc.core.client.v1.Height proof_height = 4 [(gogoproto.nullable) = false]; + uint64 next_sequence_recv = 5; + string signer = 6; + uint64 counterparty_upgrade_sequence = 7; } // MsgTimeoutOnCloseResponse defines the Msg/TimeoutOnClose response type. @@ -227,15 +271,15 @@ message MsgTimeoutOnCloseResponse { // MsgAcknowledgement receives incoming IBC acknowledgement message MsgAcknowledgement { - option (gogoproto.equal) = false; + option (cosmos.msg.v1.signer) = "signer"; + option (gogoproto.goproto_getters) = false; Packet packet = 1 [(gogoproto.nullable) = false]; bytes acknowledgement = 2; - bytes proof_acked = 3 [(gogoproto.moretags) = "yaml:\"proof_acked\""]; - ibc.core.client.v1.Height proof_height = 4 - [(gogoproto.moretags) = "yaml:\"proof_height\"", (gogoproto.nullable) = false]; - string signer = 5; + bytes proof_acked = 3; + ibc.core.client.v1.Height proof_height = 4 [(gogoproto.nullable) = false]; + string signer = 5; } // MsgAcknowledgementResponse defines the Msg/Acknowledgement response type. @@ -244,3 +288,182 @@ message MsgAcknowledgementResponse { ResponseResultType result = 1; } + +// MsgChannelUpgradeInit defines the request type for the ChannelUpgradeInit rpc +// WARNING: Initializing a channel upgrade in the same block as opening the channel +// may result in the counterparty being incapable of opening. +message MsgChannelUpgradeInit { + option (cosmos.msg.v1.signer) = "signer"; + + option (gogoproto.goproto_getters) = false; + + string port_id = 1; + string channel_id = 2; + UpgradeFields fields = 3 [(gogoproto.nullable) = false]; + string signer = 4; +} + +// MsgChannelUpgradeInitResponse defines the MsgChannelUpgradeInit response type +message MsgChannelUpgradeInitResponse { + option (gogoproto.goproto_getters) = false; + + Upgrade upgrade = 1 [(gogoproto.nullable) = false]; + uint64 upgrade_sequence = 2; +} + +// MsgChannelUpgradeTry defines the request type for the ChannelUpgradeTry rpc +message MsgChannelUpgradeTry { + option (cosmos.msg.v1.signer) = "signer"; + + option (gogoproto.goproto_getters) = false; + + string port_id = 1; + string channel_id = 2; + repeated string proposed_upgrade_connection_hops = 3; + UpgradeFields counterparty_upgrade_fields = 4 [(gogoproto.nullable) = false]; + uint64 counterparty_upgrade_sequence = 5; + bytes proof_channel = 6; + bytes proof_upgrade = 7; + ibc.core.client.v1.Height proof_height = 8 [(gogoproto.nullable) = false]; + string signer = 9; +} + +// MsgChannelUpgradeTryResponse defines the MsgChannelUpgradeTry response type +message MsgChannelUpgradeTryResponse { + option (gogoproto.goproto_getters) = false; + + Upgrade upgrade = 1 [(gogoproto.nullable) = false]; + uint64 upgrade_sequence = 2; + ResponseResultType result = 3; +} + +// MsgChannelUpgradeAck defines the request type for the ChannelUpgradeAck rpc +message MsgChannelUpgradeAck { + option (cosmos.msg.v1.signer) = "signer"; + + option (gogoproto.goproto_getters) = false; + string port_id = 1; + string channel_id = 2; + Upgrade counterparty_upgrade = 3 [(gogoproto.nullable) = false]; + bytes proof_channel = 4; + bytes proof_upgrade = 5; + ibc.core.client.v1.Height proof_height = 6 [(gogoproto.nullable) = false]; + string signer = 7; +} + +// MsgChannelUpgradeAckResponse defines MsgChannelUpgradeAck response type +message MsgChannelUpgradeAckResponse { + option (gogoproto.goproto_getters) = false; + + ResponseResultType result = 1; +} + +// MsgChannelUpgradeConfirm defines the request type for the ChannelUpgradeConfirm rpc +message MsgChannelUpgradeConfirm { + option (cosmos.msg.v1.signer) = "signer"; + + option (gogoproto.goproto_getters) = false; + string port_id = 1; + string channel_id = 2; + State counterparty_channel_state = 3; + Upgrade counterparty_upgrade = 4 [(gogoproto.nullable) = false]; + bytes proof_channel = 5; + bytes proof_upgrade = 6; + ibc.core.client.v1.Height proof_height = 7 [(gogoproto.nullable) = false]; + string signer = 8; +} + +// MsgChannelUpgradeConfirmResponse defines MsgChannelUpgradeConfirm response type +message MsgChannelUpgradeConfirmResponse { + option (gogoproto.goproto_getters) = false; + + ResponseResultType result = 1; +} + +// MsgChannelUpgradeOpen defines the request type for the ChannelUpgradeOpen rpc +message MsgChannelUpgradeOpen { + option (cosmos.msg.v1.signer) = "signer"; + + option (gogoproto.goproto_getters) = false; + string port_id = 1; + string channel_id = 2; + State counterparty_channel_state = 3; + uint64 counterparty_upgrade_sequence = 4; + bytes proof_channel = 5; + ibc.core.client.v1.Height proof_height = 6 [(gogoproto.nullable) = false]; + string signer = 7; +} + +// MsgChannelUpgradeOpenResponse defines the MsgChannelUpgradeOpen response type +message MsgChannelUpgradeOpenResponse {} + +// MsgChannelUpgradeTimeout defines the request type for the ChannelUpgradeTimeout rpc +message MsgChannelUpgradeTimeout { + option (cosmos.msg.v1.signer) = "signer"; + + option (gogoproto.goproto_getters) = false; + + string port_id = 1; + string channel_id = 2; + Channel counterparty_channel = 3 [(gogoproto.nullable) = false]; + bytes proof_channel = 4; + ibc.core.client.v1.Height proof_height = 5 [(gogoproto.nullable) = false]; + string signer = 6; +} + +// MsgChannelUpgradeTimeoutRepsonse defines the MsgChannelUpgradeTimeout response type +message MsgChannelUpgradeTimeoutResponse {} + +// MsgChannelUpgradeCancel defines the request type for the ChannelUpgradeCancel rpc +message MsgChannelUpgradeCancel { + option (cosmos.msg.v1.signer) = "signer"; + + option (gogoproto.goproto_getters) = false; + + string port_id = 1; + string channel_id = 2; + ErrorReceipt error_receipt = 3 [(gogoproto.nullable) = false]; + bytes proof_error_receipt = 4; + ibc.core.client.v1.Height proof_height = 5 [(gogoproto.nullable) = false]; + string signer = 6; +} + +// MsgChannelUpgradeCancelResponse defines the MsgChannelUpgradeCancel response type +message MsgChannelUpgradeCancelResponse {} + +// MsgUpdateParams is the MsgUpdateParams request type. +message MsgUpdateParams { + option (cosmos.msg.v1.signer) = "authority"; + + option (gogoproto.goproto_getters) = false; + + // authority is the address that controls the module (defaults to x/gov unless overwritten). + string authority = 1; + + // params defines the channel parameters to update. + // + // NOTE: All parameters must be supplied. + Params params = 2 [(gogoproto.nullable) = false]; +} + +// MsgUpdateParamsResponse defines the MsgUpdateParams response type. +message MsgUpdateParamsResponse {} + +// MsgPruneAcknowledgements defines the request type for the PruneAcknowledgements rpc. +message MsgPruneAcknowledgements { + option (cosmos.msg.v1.signer) = "signer"; + option (gogoproto.goproto_getters) = false; + + string port_id = 1; + string channel_id = 2; + uint64 limit = 3; + string signer = 4; +} + +// MsgPruneAcknowledgementsResponse defines the response type for the PruneAcknowledgements rpc. +message MsgPruneAcknowledgementsResponse { + // Number of sequences pruned (includes both packet acknowledgements and packet receipts where appropriate). + uint64 total_pruned_sequences = 1; + // Number of sequences left after pruning. + uint64 total_remaining_sequences = 2; +} diff --git a/third_party/proto/ibc/core/channel/v1/upgrade.proto b/third_party/proto/ibc/core/channel/v1/upgrade.proto new file mode 100644 index 0000000000..81530ed2a2 --- /dev/null +++ b/third_party/proto/ibc/core/channel/v1/upgrade.proto @@ -0,0 +1,43 @@ +syntax = "proto3"; + +package ibc.core.channel.v1; + +option go_package = "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types"; + +import "gogoproto/gogo.proto"; +import "ibc/core/channel/v1/channel.proto"; + +// Upgrade is a verifiable type which contains the relevant information +// for an attempted upgrade. It provides the proposed changes to the channel +// end, the timeout for this upgrade attempt and the next packet sequence +// which allows the counterparty to efficiently know the highest sequence it has received. +// The next sequence send is used for pruning and upgrading from unordered to ordered channels. +message Upgrade { + option (gogoproto.goproto_getters) = false; + + UpgradeFields fields = 1 [(gogoproto.nullable) = false]; + Timeout timeout = 2 [(gogoproto.nullable) = false]; + uint64 next_sequence_send = 3; +} + +// UpgradeFields are the fields in a channel end which may be changed +// during a channel upgrade. +message UpgradeFields { + option (gogoproto.goproto_getters) = false; + + Order ordering = 1; + repeated string connection_hops = 2; + string version = 3; +} + +// ErrorReceipt defines a type which encapsulates the upgrade sequence and error associated with the +// upgrade handshake failure. When a channel upgrade handshake is aborted both chains are expected to increment to the +// next sequence. +message ErrorReceipt { + option (gogoproto.goproto_getters) = false; + + // the channel upgrade sequence + uint64 sequence = 1; + // the error message detailing the cause of failure + string message = 2; +} diff --git a/third_party/proto/ibc/core/client/v1/client.proto b/third_party/proto/ibc/core/client/v1/client.proto index 15b47e5554..7a09e360ac 100644 --- a/third_party/proto/ibc/core/client/v1/client.proto +++ b/third_party/proto/ibc/core/client/v1/client.proto @@ -2,20 +2,20 @@ syntax = "proto3"; package ibc.core.client.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/core/02-client/types"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/core/02-client/types"; -import "gogoproto/gogo.proto"; -import "google/protobuf/any.proto"; import "cosmos/upgrade/v1beta1/upgrade.proto"; import "cosmos_proto/cosmos.proto"; +import "gogoproto/gogo.proto"; +import "google/protobuf/any.proto"; // IdentifiedClientState defines a client state with an additional client // identifier field. message IdentifiedClientState { // client identifier - string client_id = 1 [(gogoproto.moretags) = "yaml:\"client_id\""]; + string client_id = 1; // client state - google.protobuf.Any client_state = 2 [(gogoproto.moretags) = "yaml:\"client_state\""]; + google.protobuf.Any client_state = 2; } // ConsensusStateWithHeight defines a consensus state with an additional height @@ -24,26 +24,58 @@ message ConsensusStateWithHeight { // consensus state height Height height = 1 [(gogoproto.nullable) = false]; // consensus state - google.protobuf.Any consensus_state = 2 [(gogoproto.moretags) = "yaml:\"consensus_state\""]; + google.protobuf.Any consensus_state = 2; } // ClientConsensusStates defines all the stored consensus states for a given // client. message ClientConsensusStates { // client identifier - string client_id = 1 [(gogoproto.moretags) = "yaml:\"client_id\""]; + string client_id = 1; // consensus states and their heights associated with the client - repeated ConsensusStateWithHeight consensus_states = 2 - [(gogoproto.moretags) = "yaml:\"consensus_states\"", (gogoproto.nullable) = false]; + repeated ConsensusStateWithHeight consensus_states = 2 [(gogoproto.nullable) = false]; +} + +// Height is a monotonically increasing data type +// that can be compared against another Height for the purposes of updating and +// freezing clients +// +// Normally the RevisionHeight is incremented at each height while keeping +// RevisionNumber the same. However some consensus algorithms may choose to +// reset the height in certain conditions e.g. hard forks, state-machine +// breaking changes In these cases, the RevisionNumber is incremented so that +// height continues to be monitonically increasing even as the RevisionHeight +// gets reset +message Height { + option (gogoproto.goproto_getters) = false; + option (gogoproto.goproto_stringer) = false; + + // the revision that the client is currently on + uint64 revision_number = 1; + // the height within the given revision + uint64 revision_height = 2; +} + +// Params defines the set of IBC light client parameters. +message Params { + // allowed_clients defines the list of allowed client state types which can be created + // and interacted with. If a client type is removed from the allowed clients list, usage + // of this client will be disabled until it is added again to the list. + repeated string allowed_clients = 1; } -// ClientUpdateProposal is a governance proposal. If it passes, the substitute +// ClientUpdateProposal is a legacy governance proposal. If it passes, the substitute // client's latest consensus state is copied over to the subject client. The proposal // handler may fail if the subject and the substitute do not match in client and // chain parameters (with exception to latest height, frozen height, and chain-id). +// +// Deprecated: Please use MsgRecoverClient in favour of this message type. message ClientUpdateProposal { - option (gogoproto.goproto_getters) = false; + option deprecated = true; + option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content"; + option (gogoproto.goproto_getters) = false; + // the title of the update proposal string title = 1; // the description of the proposal @@ -57,11 +89,15 @@ message ClientUpdateProposal { // UpgradeProposal is a gov Content type for initiating an IBC breaking // upgrade. +// +// Deprecated: Please use MsgIBCSoftwareUpgrade in favour of this message type. message UpgradeProposal { + option deprecated = true; + + option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content"; option (gogoproto.goproto_getters) = false; option (gogoproto.goproto_stringer) = false; option (gogoproto.equal) = true; - option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content"; string title = 1; string description = 2; @@ -75,31 +111,3 @@ message UpgradeProposal { // planned chain upgrades google.protobuf.Any upgraded_client_state = 4 [(gogoproto.moretags) = "yaml:\"upgraded_client_state\""]; } - -// Height is a monotonically increasing data type -// that can be compared against another Height for the purposes of updating and -// freezing clients -// -// Normally the RevisionHeight is incremented at each height while keeping -// RevisionNumber the same. However some consensus algorithms may choose to -// reset the height in certain conditions e.g. hard forks, state-machine -// breaking changes In these cases, the RevisionNumber is incremented so that -// height continues to be monitonically increasing even as the RevisionHeight -// gets reset -message Height { - option (gogoproto.goproto_getters) = false; - option (gogoproto.goproto_stringer) = false; - - // the revision that the client is currently on - uint64 revision_number = 1 [(gogoproto.moretags) = "yaml:\"revision_number\""]; - // the height within the given revision - uint64 revision_height = 2 [(gogoproto.moretags) = "yaml:\"revision_height\""]; -} - -// Params defines the set of IBC light client parameters. -message Params { - // allowed_clients defines the list of allowed client state types which can be created - // and interacted with. If a client type is removed from the allowed clients list, usage - // of this client will be disabled until it is added again to the list. - repeated string allowed_clients = 1 [(gogoproto.moretags) = "yaml:\"allowed_clients\""]; -} diff --git a/third_party/proto/ibc/core/client/v1/genesis.proto b/third_party/proto/ibc/core/client/v1/genesis.proto index 7882124416..43610b0d46 100644 --- a/third_party/proto/ibc/core/client/v1/genesis.proto +++ b/third_party/proto/ibc/core/client/v1/genesis.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.core.client.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/core/02-client/types"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/core/02-client/types"; import "ibc/core/client/v1/client.proto"; import "gogoproto/gogo.proto"; @@ -13,19 +13,16 @@ message GenesisState { repeated IdentifiedClientState clients = 1 [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "IdentifiedClientStates"]; // consensus states from each client - repeated ClientConsensusStates clients_consensus = 2 [ - (gogoproto.nullable) = false, - (gogoproto.castrepeated) = "ClientsConsensusStates", - (gogoproto.moretags) = "yaml:\"clients_consensus\"" - ]; + repeated ClientConsensusStates clients_consensus = 2 + [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "ClientsConsensusStates"]; // metadata from each client - repeated IdentifiedGenesisMetadata clients_metadata = 3 - [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"clients_metadata\""]; - Params params = 4 [(gogoproto.nullable) = false]; - // create localhost on initialization - bool create_localhost = 5 [(gogoproto.moretags) = "yaml:\"create_localhost\""]; + repeated IdentifiedGenesisMetadata clients_metadata = 3 [(gogoproto.nullable) = false]; + Params params = 4 [(gogoproto.nullable) = false]; + // Deprecated: create_localhost has been deprecated. + // The localhost client is automatically created at genesis. + bool create_localhost = 5 [deprecated = true]; // the sequence for the next generated client identifier - uint64 next_client_sequence = 6 [(gogoproto.moretags) = "yaml:\"next_client_sequence\""]; + uint64 next_client_sequence = 6; } // GenesisMetadata defines the genesis type for metadata that clients may return @@ -42,7 +39,6 @@ message GenesisMetadata { // IdentifiedGenesisMetadata has the client metadata with the corresponding // client id. message IdentifiedGenesisMetadata { - string client_id = 1 [(gogoproto.moretags) = "yaml:\"client_id\""]; - repeated GenesisMetadata client_metadata = 2 - [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"client_metadata\""]; + string client_id = 1; + repeated GenesisMetadata client_metadata = 2 [(gogoproto.nullable) = false]; } diff --git a/third_party/proto/ibc/core/client/v1/query.proto b/third_party/proto/ibc/core/client/v1/query.proto index 0d26cf62e6..10377d9717 100644 --- a/third_party/proto/ibc/core/client/v1/query.proto +++ b/third_party/proto/ibc/core/client/v1/query.proto @@ -2,10 +2,12 @@ syntax = "proto3"; package ibc.core.client.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/core/02-client/types"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/core/02-client/types"; import "cosmos/base/query/v1beta1/pagination.proto"; +import "cosmos/query/v1/query.proto"; import "ibc/core/client/v1/client.proto"; +import "ibc/core/commitment/v1/commitment.proto"; import "google/protobuf/any.proto"; import "google/api/annotations.proto"; import "gogoproto/gogo.proto"; @@ -60,6 +62,15 @@ service Query { rpc UpgradedConsensusState(QueryUpgradedConsensusStateRequest) returns (QueryUpgradedConsensusStateResponse) { option (google.api.http).get = "/ibc/core/client/v1/upgraded_consensus_states"; } + + // VerifyMembership queries an IBC light client for proof verification of a value at a given key path. + rpc VerifyMembership(QueryVerifyMembershipRequest) returns (QueryVerifyMembershipResponse) { + option (cosmos.query.v1.module_query_safe) = true; + option (google.api.http) = { + post: "/ibc/core/client/v1/verify_membership" + body: "*" + }; + } } // QueryClientStateRequest is the request type for the Query/ClientState RPC @@ -205,3 +216,27 @@ message QueryUpgradedConsensusStateResponse { // Consensus state associated with the request identifier google.protobuf.Any upgraded_consensus_state = 1; } + +// QueryVerifyMembershipRequest is the request type for the Query/VerifyMembership RPC method +message QueryVerifyMembershipRequest { + // client unique identifier. + string client_id = 1; + // the proof to be verified by the client. + bytes proof = 2; + // the height of the commitment root at which the proof is verified. + ibc.core.client.v1.Height proof_height = 3 [(gogoproto.nullable) = false]; + // the commitment key path. + ibc.core.commitment.v1.MerklePath merkle_path = 4 [(gogoproto.nullable) = false]; + // the value which is proven. + bytes value = 5; + // optional time delay + uint64 time_delay = 6; + // optional block delay + uint64 block_delay = 7; +} + +// QueryVerifyMembershipResponse is the response type for the Query/VerifyMembership RPC method +message QueryVerifyMembershipResponse { + // boolean indicating success or failure of proof verification. + bool success = 1; +} \ No newline at end of file diff --git a/third_party/proto/ibc/core/client/v1/tx.proto b/third_party/proto/ibc/core/client/v1/tx.proto index 23302d5e3a..b504ab692a 100644 --- a/third_party/proto/ibc/core/client/v1/tx.proto +++ b/third_party/proto/ibc/core/client/v1/tx.proto @@ -2,13 +2,18 @@ syntax = "proto3"; package ibc.core.client.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/core/02-client/types"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/core/02-client/types"; +import "cosmos/msg/v1/msg.proto"; +import "cosmos/upgrade/v1beta1/upgrade.proto"; import "gogoproto/gogo.proto"; import "google/protobuf/any.proto"; +import "ibc/core/client/v1/client.proto"; // Msg defines the ibc/client Msg service. service Msg { + option (cosmos.msg.v1.service) = true; + // CreateClient defines a rpc handler method for MsgCreateClient. rpc CreateClient(MsgCreateClient) returns (MsgCreateClientResponse); @@ -20,18 +25,28 @@ service Msg { // SubmitMisbehaviour defines a rpc handler method for MsgSubmitMisbehaviour. rpc SubmitMisbehaviour(MsgSubmitMisbehaviour) returns (MsgSubmitMisbehaviourResponse); + + // RecoverClient defines a rpc handler method for MsgRecoverClient. + rpc RecoverClient(MsgRecoverClient) returns (MsgRecoverClientResponse); + + // IBCSoftwareUpgrade defines a rpc handler method for MsgIBCSoftwareUpgrade. + rpc IBCSoftwareUpgrade(MsgIBCSoftwareUpgrade) returns (MsgIBCSoftwareUpgradeResponse); + + // UpdateClientParams defines a rpc handler method for MsgUpdateParams. + rpc UpdateClientParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); } // MsgCreateClient defines a message to create an IBC client message MsgCreateClient { - option (gogoproto.equal) = false; + option (cosmos.msg.v1.signer) = "signer"; + option (gogoproto.goproto_getters) = false; // light client state - google.protobuf.Any client_state = 1 [(gogoproto.moretags) = "yaml:\"client_state\""]; + google.protobuf.Any client_state = 1; // consensus state associated with the client that corresponds to a given // height. - google.protobuf.Any consensus_state = 2 [(gogoproto.moretags) = "yaml:\"consensus_state\""]; + google.protobuf.Any consensus_state = 2; // signer address string signer = 3; } @@ -42,11 +57,12 @@ message MsgCreateClientResponse {} // MsgUpdateClient defines an sdk.Msg to update a IBC client state using // the given client message. message MsgUpdateClient { - option (gogoproto.equal) = false; + option (cosmos.msg.v1.signer) = "signer"; + option (gogoproto.goproto_getters) = false; // client unique identifier - string client_id = 1 [(gogoproto.moretags) = "yaml:\"client_id\""]; + string client_id = 1; // client message to update the light client google.protobuf.Any client_message = 2; // signer address @@ -59,20 +75,21 @@ message MsgUpdateClientResponse {} // MsgUpgradeClient defines an sdk.Msg to upgrade an IBC client to a new client // state message MsgUpgradeClient { - option (gogoproto.equal) = false; + option (cosmos.msg.v1.signer) = "signer"; + option (gogoproto.goproto_getters) = false; // client unique identifier - string client_id = 1 [(gogoproto.moretags) = "yaml:\"client_id\""]; + string client_id = 1; // upgraded client state - google.protobuf.Any client_state = 2 [(gogoproto.moretags) = "yaml:\"client_state\""]; + google.protobuf.Any client_state = 2; // upgraded consensus state, only contains enough information to serve as a // basis of trust in update logic - google.protobuf.Any consensus_state = 3 [(gogoproto.moretags) = "yaml:\"consensus_state\""]; + google.protobuf.Any consensus_state = 3; // proof that old chain committed to new client - bytes proof_upgrade_client = 4 [(gogoproto.moretags) = "yaml:\"proof_upgrade_client\""]; + bytes proof_upgrade_client = 4; // proof that old chain committed to new consensus state - bytes proof_upgrade_consensus_state = 5 [(gogoproto.moretags) = "yaml:\"proof_upgrade_consensus_state\""]; + bytes proof_upgrade_consensus_state = 5; // signer address string signer = 6; } @@ -82,19 +99,77 @@ message MsgUpgradeClientResponse {} // MsgSubmitMisbehaviour defines an sdk.Msg type that submits Evidence for // light client misbehaviour. -// Warning: DEPRECATED +// This message has been deprecated. Use MsgUpdateClient instead. message MsgSubmitMisbehaviour { - option (gogoproto.equal) = false; + option deprecated = true; + option (cosmos.msg.v1.signer) = "signer"; + option (gogoproto.goproto_getters) = false; // client unique identifier - string client_id = 1 [(gogoproto.moretags) = "yaml:\"client_id\"", deprecated = true]; + string client_id = 1; // misbehaviour used for freezing the light client - google.protobuf.Any misbehaviour = 2 [deprecated = true]; + google.protobuf.Any misbehaviour = 2; // signer address - string signer = 3 [deprecated = true]; + string signer = 3; } // MsgSubmitMisbehaviourResponse defines the Msg/SubmitMisbehaviour response // type. message MsgSubmitMisbehaviourResponse {} + +// MsgRecoverClient defines the message used to recover a frozen or expired client. +message MsgRecoverClient { + option (gogoproto.goproto_getters) = false; + option (cosmos.msg.v1.signer) = "signer"; + + // the client identifier for the client to be updated if the proposal passes + string subject_client_id = 1; + // the substitute client identifier for the client which will replace the subject + // client + string substitute_client_id = 2; + + // signer address + string signer = 3; +} + +// MsgRecoverClientResponse defines the Msg/RecoverClient response type. +message MsgRecoverClientResponse {} + +// MsgIBCSoftwareUpgrade defines the message used to schedule an upgrade of an IBC client using a v1 governance proposal +message MsgIBCSoftwareUpgrade { + option (cosmos.msg.v1.signer) = "signer"; + cosmos.upgrade.v1beta1.Plan plan = 1 [(gogoproto.nullable) = false]; + // An UpgradedClientState must be provided to perform an IBC breaking upgrade. + // This will make the chain commit to the correct upgraded (self) client state + // before the upgrade occurs, so that connecting chains can verify that the + // new upgraded client is valid by verifying a proof on the previous version + // of the chain. This will allow IBC connections to persist smoothly across + // planned chain upgrades. Correspondingly, the UpgradedClientState field has been + // deprecated in the Cosmos SDK to allow for this logic to exist solely in + // the 02-client module. + google.protobuf.Any upgraded_client_state = 2; + // signer address + string signer = 3; +} + +// MsgIBCSoftwareUpgradeResponse defines the Msg/IBCSoftwareUpgrade response type. +message MsgIBCSoftwareUpgradeResponse {} + +// MsgUpdateParams defines the sdk.Msg type to update the client parameters. +message MsgUpdateParams { + option (cosmos.msg.v1.signer) = "signer"; + + option (gogoproto.goproto_getters) = false; + + // signer address + string signer = 1; + + // params defines the client parameters to update. + // + // NOTE: All parameters must be supplied. + Params params = 2 [(gogoproto.nullable) = false]; +} + +// MsgUpdateParamsResponse defines the MsgUpdateParams response type. +message MsgUpdateParamsResponse {} diff --git a/third_party/proto/ibc/core/commitment/v1/commitment.proto b/third_party/proto/ibc/core/commitment/v1/commitment.proto index 4840ff3e06..b4753be2d9 100644 --- a/third_party/proto/ibc/core/commitment/v1/commitment.proto +++ b/third_party/proto/ibc/core/commitment/v1/commitment.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.core.commitment.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/core/23-commitment/types"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/core/23-commitment/types"; import "gogoproto/gogo.proto"; import "cosmos/ics23/v1/proofs.proto"; @@ -19,16 +19,14 @@ message MerkleRoot { // The constructed key from the Path and the key will be append(Path.KeyPath, // append(Path.KeyPrefix, key...)) message MerklePrefix { - bytes key_prefix = 1 [(gogoproto.moretags) = "yaml:\"key_prefix\""]; + bytes key_prefix = 1; } // MerklePath is the path used to verify commitment proofs, which can be an // arbitrary structured object (defined by a commitment type). // MerklePath is represented from root-to-leaf message MerklePath { - option (gogoproto.goproto_stringer) = false; - - repeated string key_path = 1 [(gogoproto.moretags) = "yaml:\"key_path\""]; + repeated string key_path = 1; } // MerkleProof is a wrapper type over a chain of CommitmentProofs. diff --git a/third_party/proto/ibc/core/connection/v1/connection.proto b/third_party/proto/ibc/core/connection/v1/connection.proto index ba367c14d2..852f3999bf 100644 --- a/third_party/proto/ibc/core/connection/v1/connection.proto +++ b/third_party/proto/ibc/core/connection/v1/connection.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.core.connection.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/core/03-connection/types"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/core/03-connection/types"; import "gogoproto/gogo.proto"; import "ibc/core/commitment/v1/commitment.proto"; @@ -17,7 +17,7 @@ import "ibc/core/commitment/v1/commitment.proto"; message ConnectionEnd { option (gogoproto.goproto_getters) = false; // client associated with this connection. - string client_id = 1 [(gogoproto.moretags) = "yaml:\"client_id\""]; + string client_id = 1; // IBC version which can be utilised to determine encodings or protocols for // channels or packets utilising this connection. repeated Version versions = 2; @@ -28,7 +28,7 @@ message ConnectionEnd { // delay period that must pass before a consensus state can be used for // packet-verification NOTE: delay period logic is only implemented by some // clients. - uint64 delay_period = 5 [(gogoproto.moretags) = "yaml:\"delay_period\""]; + uint64 delay_period = 5; } // IdentifiedConnection defines a connection with additional connection @@ -36,9 +36,9 @@ message ConnectionEnd { message IdentifiedConnection { option (gogoproto.goproto_getters) = false; // connection identifier. - string id = 1 [(gogoproto.moretags) = "yaml:\"id\""]; + string id = 1; // client associated with this connection. - string client_id = 2 [(gogoproto.moretags) = "yaml:\"client_id\""]; + string client_id = 2; // IBC version which can be utilised to determine encodings or protocols for // channels or packets utilising this connection repeated Version versions = 3; @@ -47,7 +47,7 @@ message IdentifiedConnection { // counterparty chain associated with this connection. Counterparty counterparty = 5 [(gogoproto.nullable) = false]; // delay period associated with this connection. - uint64 delay_period = 6 [(gogoproto.moretags) = "yaml:\"delay_period\""]; + uint64 delay_period = 6; } // State defines if a connection is in one of the following states: @@ -72,10 +72,10 @@ message Counterparty { // identifies the client on the counterparty chain associated with a given // connection. - string client_id = 1 [(gogoproto.moretags) = "yaml:\"client_id\""]; + string client_id = 1; // identifies the connection end on the counterparty chain associated with a // given connection. - string connection_id = 2 [(gogoproto.moretags) = "yaml:\"connection_id\""]; + string connection_id = 2; // commitment merkle prefix of the counterparty chain. ibc.core.commitment.v1.MerklePrefix prefix = 3 [(gogoproto.nullable) = false]; } @@ -89,7 +89,7 @@ message ClientPaths { // ConnectionPaths define all the connection paths for a given client state. message ConnectionPaths { // client state unique identifier - string client_id = 1 [(gogoproto.moretags) = "yaml:\"client_id\""]; + string client_id = 1; // list of connection paths repeated string paths = 2; } @@ -110,5 +110,5 @@ message Params { // maximum expected time per block (in nanoseconds), used to enforce block delay. This parameter should reflect the // largest amount of time that the chain might reasonably take to produce the next block under normal operating // conditions. A safe choice is 3-5x the expected time per block. - uint64 max_expected_time_per_block = 1 [(gogoproto.moretags) = "yaml:\"max_expected_time_per_block\""]; + uint64 max_expected_time_per_block = 1; } diff --git a/third_party/proto/ibc/core/connection/v1/genesis.proto b/third_party/proto/ibc/core/connection/v1/genesis.proto index 122c5a4652..a5eb6b3a1c 100644 --- a/third_party/proto/ibc/core/connection/v1/genesis.proto +++ b/third_party/proto/ibc/core/connection/v1/genesis.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.core.connection.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/core/03-connection/types"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/core/03-connection/types"; import "gogoproto/gogo.proto"; import "ibc/core/connection/v1/connection.proto"; @@ -10,9 +10,8 @@ import "ibc/core/connection/v1/connection.proto"; // GenesisState defines the ibc connection submodule's genesis state. message GenesisState { repeated IdentifiedConnection connections = 1 [(gogoproto.nullable) = false]; - repeated ConnectionPaths client_connection_paths = 2 - [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"client_connection_paths\""]; + repeated ConnectionPaths client_connection_paths = 2 [(gogoproto.nullable) = false]; // the sequence for the next generated connection identifier - uint64 next_connection_sequence = 3 [(gogoproto.moretags) = "yaml:\"next_connection_sequence\""]; + uint64 next_connection_sequence = 3; Params params = 4 [(gogoproto.nullable) = false]; } diff --git a/third_party/proto/ibc/core/connection/v1/query.proto b/third_party/proto/ibc/core/connection/v1/query.proto index 3c76b23891..c0f1a6f577 100644 --- a/third_party/proto/ibc/core/connection/v1/query.proto +++ b/third_party/proto/ibc/core/connection/v1/query.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.core.connection.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/core/03-connection/types"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/core/03-connection/types"; import "gogoproto/gogo.proto"; import "cosmos/base/query/v1beta1/pagination.proto"; @@ -106,7 +106,7 @@ message QueryClientConnectionsResponse { // Query/ConnectionClientState RPC method message QueryConnectionClientStateRequest { // connection identifier - string connection_id = 1 [(gogoproto.moretags) = "yaml:\"connection_id\""]; + string connection_id = 1; } // QueryConnectionClientStateResponse is the response type for the @@ -124,7 +124,7 @@ message QueryConnectionClientStateResponse { // Query/ConnectionConsensusState RPC method message QueryConnectionConsensusStateRequest { // connection identifier - string connection_id = 1 [(gogoproto.moretags) = "yaml:\"connection_id\""]; + string connection_id = 1; uint64 revision_number = 2; uint64 revision_height = 3; } diff --git a/third_party/proto/ibc/core/connection/v1/tx.proto b/third_party/proto/ibc/core/connection/v1/tx.proto index af8f505c46..648cb4bac1 100644 --- a/third_party/proto/ibc/core/connection/v1/tx.proto +++ b/third_party/proto/ibc/core/connection/v1/tx.proto @@ -2,15 +2,18 @@ syntax = "proto3"; package ibc.core.connection.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/core/03-connection/types"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/core/03-connection/types"; import "gogoproto/gogo.proto"; +import "cosmos/msg/v1/msg.proto"; import "google/protobuf/any.proto"; import "ibc/core/client/v1/client.proto"; import "ibc/core/connection/v1/connection.proto"; // Msg defines the ibc/connection Msg service. service Msg { + option (cosmos.msg.v1.service) = true; + // ConnectionOpenInit defines a rpc handler method for MsgConnectionOpenInit. rpc ConnectionOpenInit(MsgConnectionOpenInit) returns (MsgConnectionOpenInitResponse); @@ -23,18 +26,23 @@ service Msg { // ConnectionOpenConfirm defines a rpc handler method for // MsgConnectionOpenConfirm. rpc ConnectionOpenConfirm(MsgConnectionOpenConfirm) returns (MsgConnectionOpenConfirmResponse); + + // UpdateConnectionParams defines a rpc handler method for + // MsgUpdateParams. + rpc UpdateConnectionParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); } // MsgConnectionOpenInit defines the msg sent by an account on Chain A to // initialize a connection with Chain B. message MsgConnectionOpenInit { - option (gogoproto.equal) = false; + option (cosmos.msg.v1.signer) = "signer"; + option (gogoproto.goproto_getters) = false; - string client_id = 1 [(gogoproto.moretags) = "yaml:\"client_id\""]; + string client_id = 1; Counterparty counterparty = 2 [(gogoproto.nullable) = false]; Version version = 3; - uint64 delay_period = 4 [(gogoproto.moretags) = "yaml:\"delay_period\""]; + uint64 delay_period = 4; string signer = 5; } @@ -45,30 +53,29 @@ message MsgConnectionOpenInitResponse {} // MsgConnectionOpenTry defines a msg sent by a Relayer to try to open a // connection on Chain B. message MsgConnectionOpenTry { - option (gogoproto.equal) = false; + option (cosmos.msg.v1.signer) = "signer"; + option (gogoproto.goproto_getters) = false; - string client_id = 1 [(gogoproto.moretags) = "yaml:\"client_id\""]; + string client_id = 1; // Deprecated: this field is unused. Crossing hellos are no longer supported in core IBC. - string previous_connection_id = 2 [deprecated = true, (gogoproto.moretags) = "yaml:\"previous_connection_id\""]; - google.protobuf.Any client_state = 3 [(gogoproto.moretags) = "yaml:\"client_state\""]; - Counterparty counterparty = 4 [(gogoproto.nullable) = false]; - uint64 delay_period = 5 [(gogoproto.moretags) = "yaml:\"delay_period\""]; - repeated Version counterparty_versions = 6 [(gogoproto.moretags) = "yaml:\"counterparty_versions\""]; - ibc.core.client.v1.Height proof_height = 7 - [(gogoproto.moretags) = "yaml:\"proof_height\"", (gogoproto.nullable) = false]; + string previous_connection_id = 2 [deprecated = true]; + google.protobuf.Any client_state = 3 [deprecated = true]; + Counterparty counterparty = 4 [(gogoproto.nullable) = false]; + uint64 delay_period = 5; + repeated Version counterparty_versions = 6; + ibc.core.client.v1.Height proof_height = 7 [(gogoproto.nullable) = false]; // proof of the initialization the connection on Chain A: `UNITIALIZED -> // INIT` - bytes proof_init = 8 [(gogoproto.moretags) = "yaml:\"proof_init\""]; + bytes proof_init = 8; // proof of client state included in message - bytes proof_client = 9 [(gogoproto.moretags) = "yaml:\"proof_client\""]; + bytes proof_client = 9 [deprecated = true]; // proof of client consensus state - bytes proof_consensus = 10 [(gogoproto.moretags) = "yaml:\"proof_consensus\""]; - ibc.core.client.v1.Height consensus_height = 11 - [(gogoproto.moretags) = "yaml:\"consensus_height\"", (gogoproto.nullable) = false]; - string signer = 12; + bytes proof_consensus = 10 [deprecated = true]; + ibc.core.client.v1.Height consensus_height = 11 [deprecated = true, (gogoproto.nullable) = false]; + string signer = 12; // optional proof data for host state machines that are unable to introspect their own consensus state - bytes host_consensus_state_proof = 13; + bytes host_consensus_state_proof = 13 [deprecated = true]; } // MsgConnectionOpenTryResponse defines the Msg/ConnectionOpenTry response type. @@ -77,27 +84,26 @@ message MsgConnectionOpenTryResponse {} // MsgConnectionOpenAck defines a msg sent by a Relayer to Chain A to // acknowledge the change of connection state to TRYOPEN on Chain B. message MsgConnectionOpenAck { - option (gogoproto.equal) = false; + option (cosmos.msg.v1.signer) = "signer"; + option (gogoproto.goproto_getters) = false; - string connection_id = 1 [(gogoproto.moretags) = "yaml:\"connection_id\""]; - string counterparty_connection_id = 2 [(gogoproto.moretags) = "yaml:\"counterparty_connection_id\""]; - Version version = 3; - google.protobuf.Any client_state = 4 [(gogoproto.moretags) = "yaml:\"client_state\""]; - ibc.core.client.v1.Height proof_height = 5 - [(gogoproto.moretags) = "yaml:\"proof_height\"", (gogoproto.nullable) = false]; + string connection_id = 1; + string counterparty_connection_id = 2; + Version version = 3; + google.protobuf.Any client_state = 4 [deprecated = true]; + ibc.core.client.v1.Height proof_height = 5 [(gogoproto.nullable) = false]; // proof of the initialization the connection on Chain B: `UNITIALIZED -> // TRYOPEN` - bytes proof_try = 6 [(gogoproto.moretags) = "yaml:\"proof_try\""]; + bytes proof_try = 6; // proof of client state included in message - bytes proof_client = 7 [(gogoproto.moretags) = "yaml:\"proof_client\""]; + bytes proof_client = 7 [deprecated = true]; // proof of client consensus state - bytes proof_consensus = 8 [(gogoproto.moretags) = "yaml:\"proof_consensus\""]; - ibc.core.client.v1.Height consensus_height = 9 - [(gogoproto.moretags) = "yaml:\"consensus_height\"", (gogoproto.nullable) = false]; - string signer = 10; + bytes proof_consensus = 8 [deprecated = true]; + ibc.core.client.v1.Height consensus_height = 9 [deprecated = true, (gogoproto.nullable) = false]; + string signer = 10; // optional proof data for host state machines that are unable to introspect their own consensus state - bytes host_consensus_state_proof = 11; + bytes host_consensus_state_proof = 11 [deprecated = true]; } // MsgConnectionOpenAckResponse defines the Msg/ConnectionOpenAck response type. @@ -106,17 +112,35 @@ message MsgConnectionOpenAckResponse {} // MsgConnectionOpenConfirm defines a msg sent by a Relayer to Chain B to // acknowledge the change of connection state to OPEN on Chain A. message MsgConnectionOpenConfirm { - option (gogoproto.equal) = false; + option (cosmos.msg.v1.signer) = "signer"; + option (gogoproto.goproto_getters) = false; - string connection_id = 1 [(gogoproto.moretags) = "yaml:\"connection_id\""]; + string connection_id = 1; // proof for the change of the connection state on Chain A: `INIT -> OPEN` - bytes proof_ack = 2 [(gogoproto.moretags) = "yaml:\"proof_ack\""]; - ibc.core.client.v1.Height proof_height = 3 - [(gogoproto.moretags) = "yaml:\"proof_height\"", (gogoproto.nullable) = false]; - string signer = 4; + bytes proof_ack = 2; + ibc.core.client.v1.Height proof_height = 3 [(gogoproto.nullable) = false]; + string signer = 4; } // MsgConnectionOpenConfirmResponse defines the Msg/ConnectionOpenConfirm // response type. message MsgConnectionOpenConfirmResponse {} + +// MsgUpdateParams defines the sdk.Msg type to update the connection parameters. +message MsgUpdateParams { + option (cosmos.msg.v1.signer) = "signer"; + + option (gogoproto.goproto_getters) = false; + + // signer address + string signer = 1; + + // params defines the connection parameters to update. + // + // NOTE: All parameters must be supplied. + Params params = 2 [(gogoproto.nullable) = false]; +} + +// MsgUpdateParamsResponse defines the MsgUpdateParams response type. +message MsgUpdateParamsResponse {} diff --git a/third_party/proto/ibc/core/types/v1/genesis.proto b/third_party/proto/ibc/core/types/v1/genesis.proto index 4e07551f82..4b34f68893 100644 --- a/third_party/proto/ibc/core/types/v1/genesis.proto +++ b/third_party/proto/ibc/core/types/v1/genesis.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.core.types.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/core/types"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/core/types"; import "gogoproto/gogo.proto"; import "ibc/core/client/v1/genesis.proto"; @@ -12,12 +12,9 @@ import "ibc/core/channel/v1/genesis.proto"; // GenesisState defines the ibc module's genesis state. message GenesisState { // ICS002 - Clients genesis state - ibc.core.client.v1.GenesisState client_genesis = 1 - [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"client_genesis\""]; + ibc.core.client.v1.GenesisState client_genesis = 1 [(gogoproto.nullable) = false]; // ICS003 - Connections genesis state - ibc.core.connection.v1.GenesisState connection_genesis = 2 - [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"connection_genesis\""]; + ibc.core.connection.v1.GenesisState connection_genesis = 2 [(gogoproto.nullable) = false]; // ICS004 - Channel genesis state - ibc.core.channel.v1.GenesisState channel_genesis = 3 - [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"channel_genesis\""]; + ibc.core.channel.v1.GenesisState channel_genesis = 3 [(gogoproto.nullable) = false]; } diff --git a/third_party/proto/ibc/lightclients/localhost/v2/localhost.proto b/third_party/proto/ibc/lightclients/localhost/v2/localhost.proto index ec970eb000..635db85214 100644 --- a/third_party/proto/ibc/lightclients/localhost/v2/localhost.proto +++ b/third_party/proto/ibc/lightclients/localhost/v2/localhost.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.lightclients.localhost.v2; -option go_package = "github.com/cosmos/ibc-go/v7/modules/light-clients/09-localhost;localhost"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/light-clients/09-localhost;localhost"; import "ibc/core/client/v1/client.proto"; import "gogoproto/gogo.proto"; diff --git a/third_party/proto/ibc/lightclients/solomachine/v2/solomachine.proto b/third_party/proto/ibc/lightclients/solomachine/v2/solomachine.proto index 250313319b..9dc2690c5d 100644 --- a/third_party/proto/ibc/lightclients/solomachine/v2/solomachine.proto +++ b/third_party/proto/ibc/lightclients/solomachine/v2/solomachine.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.lightclients.solomachine.v2; -option go_package = "github.com/cosmos/ibc-go/v7/modules/core/02-client/migrations/v7"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/core/02-client/migrations/v7"; import "ibc/core/connection/v1/connection.proto"; import "ibc/core/channel/v1/channel.proto"; @@ -16,11 +16,11 @@ message ClientState { // latest sequence of the client state uint64 sequence = 1; // frozen sequence of the solo machine - bool is_frozen = 2 [(gogoproto.moretags) = "yaml:\"is_frozen\""]; - ConsensusState consensus_state = 3 [(gogoproto.moretags) = "yaml:\"consensus_state\""]; + bool is_frozen = 2; + ConsensusState consensus_state = 3; // when set to true, will allow governance to update a solo machine client. // The client will be unfrozen if it is frozen. - bool allow_update_after_proposal = 4 [(gogoproto.moretags) = "yaml:\"allow_update_after_proposal\""]; + bool allow_update_after_proposal = 4; } // ConsensusState defines a solo machine consensus state. The sequence of a @@ -29,7 +29,7 @@ message ClientState { message ConsensusState { option (gogoproto.goproto_getters) = false; // public key of the solo machine - google.protobuf.Any public_key = 1 [(gogoproto.moretags) = "yaml:\"public_key\""]; + google.protobuf.Any public_key = 1; // diversifier allows the same public key to be re-used across different solo // machine clients (potentially on different chains) without being considered // misbehaviour. @@ -44,18 +44,18 @@ message Header { uint64 sequence = 1; uint64 timestamp = 2; bytes signature = 3; - google.protobuf.Any new_public_key = 4 [(gogoproto.moretags) = "yaml:\"new_public_key\""]; - string new_diversifier = 5 [(gogoproto.moretags) = "yaml:\"new_diversifier\""]; + google.protobuf.Any new_public_key = 4; + string new_diversifier = 5; } // Misbehaviour defines misbehaviour for a solo machine which consists // of a sequence and two signatures over different messages at that sequence. message Misbehaviour { option (gogoproto.goproto_getters) = false; - string client_id = 1 [(gogoproto.moretags) = "yaml:\"client_id\""]; + string client_id = 1; uint64 sequence = 2; - SignatureAndData signature_one = 3 [(gogoproto.moretags) = "yaml:\"signature_one\""]; - SignatureAndData signature_two = 4 [(gogoproto.moretags) = "yaml:\"signature_two\""]; + SignatureAndData signature_one = 3; + SignatureAndData signature_two = 4; } // SignatureAndData contains a signature and the data signed over to create that @@ -63,7 +63,7 @@ message Misbehaviour { message SignatureAndData { option (gogoproto.goproto_getters) = false; bytes signature = 1; - DataType data_type = 2 [(gogoproto.moretags) = "yaml:\"data_type\""]; + DataType data_type = 2; bytes data = 3; uint64 timestamp = 4; } @@ -72,7 +72,7 @@ message SignatureAndData { // signature. message TimestampedSignatureData { option (gogoproto.goproto_getters) = false; - bytes signature_data = 1 [(gogoproto.moretags) = "yaml:\"signature_data\""]; + bytes signature_data = 1; uint64 timestamp = 2; } @@ -84,7 +84,7 @@ message SignBytes { uint64 timestamp = 2; string diversifier = 3; // type of the data used - DataType data_type = 4 [(gogoproto.moretags) = "yaml:\"data_type\""]; + DataType data_type = 4; // marshaled data bytes data = 5; } @@ -121,9 +121,9 @@ message HeaderData { option (gogoproto.goproto_getters) = false; // header public key - google.protobuf.Any new_pub_key = 1 [(gogoproto.moretags) = "yaml:\"new_pub_key\""]; + google.protobuf.Any new_pub_key = 1; // header diversifier - string new_diversifier = 2 [(gogoproto.moretags) = "yaml:\"new_diversifier\""]; + string new_diversifier = 2; } // ClientStateData returns the SignBytes data for client state verification. @@ -131,7 +131,7 @@ message ClientStateData { option (gogoproto.goproto_getters) = false; bytes path = 1; - google.protobuf.Any client_state = 2 [(gogoproto.moretags) = "yaml:\"client_state\""]; + google.protobuf.Any client_state = 2; } // ConsensusStateData returns the SignBytes data for consensus state @@ -140,7 +140,7 @@ message ConsensusStateData { option (gogoproto.goproto_getters) = false; bytes path = 1; - google.protobuf.Any consensus_state = 2 [(gogoproto.moretags) = "yaml:\"consensus_state\""]; + google.protobuf.Any consensus_state = 2; } // ConnectionStateData returns the SignBytes data for connection state @@ -185,5 +185,5 @@ message PacketReceiptAbsenceData { // sequence to be received. message NextSequenceRecvData { bytes path = 1; - uint64 next_seq_recv = 2 [(gogoproto.moretags) = "yaml:\"next_seq_recv\""]; + uint64 next_seq_recv = 2; } diff --git a/third_party/proto/ibc/lightclients/solomachine/v3/solomachine.proto b/third_party/proto/ibc/lightclients/solomachine/v3/solomachine.proto index 40e76b722e..194905b38b 100644 --- a/third_party/proto/ibc/lightclients/solomachine/v3/solomachine.proto +++ b/third_party/proto/ibc/lightclients/solomachine/v3/solomachine.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.lightclients.solomachine.v3; -option go_package = "github.com/cosmos/ibc-go/v7/modules/light-clients/06-solomachine;solomachine"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/light-clients/06-solomachine;solomachine"; import "gogoproto/gogo.proto"; import "google/protobuf/any.proto"; @@ -14,8 +14,8 @@ message ClientState { // latest sequence of the client state uint64 sequence = 1; // frozen sequence of the solo machine - bool is_frozen = 2 [(gogoproto.moretags) = "yaml:\"is_frozen\""]; - ConsensusState consensus_state = 3 [(gogoproto.moretags) = "yaml:\"consensus_state\""]; + bool is_frozen = 2; + ConsensusState consensus_state = 3; } // ConsensusState defines a solo machine consensus state. The sequence of a @@ -24,7 +24,7 @@ message ClientState { message ConsensusState { option (gogoproto.goproto_getters) = false; // public key of the solo machine - google.protobuf.Any public_key = 1 [(gogoproto.moretags) = "yaml:\"public_key\""]; + google.protobuf.Any public_key = 1; // diversifier allows the same public key to be re-used across different solo // machine clients (potentially on different chains) without being considered // misbehaviour. @@ -38,8 +38,8 @@ message Header { uint64 timestamp = 1; bytes signature = 2; - google.protobuf.Any new_public_key = 3 [(gogoproto.moretags) = "yaml:\"new_public_key\""]; - string new_diversifier = 4 [(gogoproto.moretags) = "yaml:\"new_diversifier\""]; + google.protobuf.Any new_public_key = 3; + string new_diversifier = 4; } // Misbehaviour defines misbehaviour for a solo machine which consists @@ -48,8 +48,8 @@ message Misbehaviour { option (gogoproto.goproto_getters) = false; uint64 sequence = 1; - SignatureAndData signature_one = 2 [(gogoproto.moretags) = "yaml:\"signature_one\""]; - SignatureAndData signature_two = 3 [(gogoproto.moretags) = "yaml:\"signature_two\""]; + SignatureAndData signature_one = 2; + SignatureAndData signature_two = 3; } // SignatureAndData contains a signature and the data signed over to create that @@ -68,7 +68,7 @@ message SignatureAndData { message TimestampedSignatureData { option (gogoproto.goproto_getters) = false; - bytes signature_data = 1 [(gogoproto.moretags) = "yaml:\"signature_data\""]; + bytes signature_data = 1; uint64 timestamp = 2; } @@ -93,7 +93,7 @@ message HeaderData { option (gogoproto.goproto_getters) = false; // header public key - google.protobuf.Any new_pub_key = 1 [(gogoproto.moretags) = "yaml:\"new_pub_key\""]; + google.protobuf.Any new_pub_key = 1; // header diversifier - string new_diversifier = 2 [(gogoproto.moretags) = "yaml:\"new_diversifier\""]; + string new_diversifier = 2; } diff --git a/third_party/proto/ibc/lightclients/tendermint/v1/tendermint.proto b/third_party/proto/ibc/lightclients/tendermint/v1/tendermint.proto index 83fa59c9fa..5053612228 100644 --- a/third_party/proto/ibc/lightclients/tendermint/v1/tendermint.proto +++ b/third_party/proto/ibc/lightclients/tendermint/v1/tendermint.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.lightclients.tendermint.v1; -option go_package = "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint;tendermint"; +option go_package = "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint;tendermint"; import "tendermint/types/validator.proto"; import "tendermint/types/types.proto"; @@ -19,29 +19,21 @@ message ClientState { option (gogoproto.goproto_getters) = false; string chain_id = 1; - Fraction trust_level = 2 [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"trust_level\""]; + Fraction trust_level = 2 [(gogoproto.nullable) = false]; // duration of the period since the LastestTimestamp during which the // submitted headers are valid for upgrade - google.protobuf.Duration trusting_period = 3 - [(gogoproto.nullable) = false, (gogoproto.stdduration) = true, (gogoproto.moretags) = "yaml:\"trusting_period\""]; + google.protobuf.Duration trusting_period = 3 [(gogoproto.nullable) = false, (gogoproto.stdduration) = true]; // duration of the staking unbonding period - google.protobuf.Duration unbonding_period = 4 [ - (gogoproto.nullable) = false, - (gogoproto.stdduration) = true, - (gogoproto.moretags) = "yaml:\"unbonding_period\"" - ]; + google.protobuf.Duration unbonding_period = 4 [(gogoproto.nullable) = false, (gogoproto.stdduration) = true]; // defines how much new (untrusted) header's Time can drift into the future. - google.protobuf.Duration max_clock_drift = 5 - [(gogoproto.nullable) = false, (gogoproto.stdduration) = true, (gogoproto.moretags) = "yaml:\"max_clock_drift\""]; + google.protobuf.Duration max_clock_drift = 5 [(gogoproto.nullable) = false, (gogoproto.stdduration) = true]; // Block height when the client was frozen due to a misbehaviour - ibc.core.client.v1.Height frozen_height = 6 - [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"frozen_height\""]; + ibc.core.client.v1.Height frozen_height = 6 [(gogoproto.nullable) = false]; // Latest height the client was updated to - ibc.core.client.v1.Height latest_height = 7 - [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"latest_height\""]; + ibc.core.client.v1.Height latest_height = 7 [(gogoproto.nullable) = false]; // Proof specifications used in verifying counterparty state - repeated cosmos.ics23.v1.ProofSpec proof_specs = 8 [(gogoproto.moretags) = "yaml:\"proof_specs\""]; + repeated cosmos.ics23.v1.ProofSpec proof_specs = 8; // Path at which next upgraded client will be committed. // Each element corresponds to the key for a single CommitmentProof in the @@ -50,13 +42,12 @@ message ClientState { // under `{upgradepath}/{upgradeHeight}/consensusState` For SDK chains using // the default upgrade module, upgrade_path should be []string{"upgrade", // "upgradedIBCState"}` - repeated string upgrade_path = 9 [(gogoproto.moretags) = "yaml:\"upgrade_path\""]; + repeated string upgrade_path = 9; // allow_update_after_expiry is deprecated - bool allow_update_after_expiry = 10 [deprecated = true, (gogoproto.moretags) = "yaml:\"allow_update_after_expiry\""]; + bool allow_update_after_expiry = 10 [deprecated = true]; // allow_update_after_misbehaviour is deprecated - bool allow_update_after_misbehaviour = 11 - [deprecated = true, (gogoproto.moretags) = "yaml:\"allow_update_after_misbehaviour\""]; + bool allow_update_after_misbehaviour = 11 [deprecated = true]; } // ConsensusState defines the consensus state from Tendermint. @@ -67,11 +58,8 @@ message ConsensusState { // was stored. google.protobuf.Timestamp timestamp = 1 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; // commitment root (i.e app hash) - ibc.core.commitment.v1.MerkleRoot root = 2 [(gogoproto.nullable) = false]; - bytes next_validators_hash = 3 [ - (gogoproto.casttype) = "github.com/cometbft/cometbft/libs/bytes.HexBytes", - (gogoproto.moretags) = "yaml:\"next_validators_hash\"" - ]; + ibc.core.commitment.v1.MerkleRoot root = 2 [(gogoproto.nullable) = false]; + bytes next_validators_hash = 3 [(gogoproto.casttype) = "github.com/cometbft/cometbft/libs/bytes.HexBytes"]; } // Misbehaviour is a wrapper over two conflicting Headers @@ -80,9 +68,9 @@ message Misbehaviour { option (gogoproto.goproto_getters) = false; // ClientID is deprecated - string client_id = 1 [deprecated = true, (gogoproto.moretags) = "yaml:\"client_id\""]; - Header header_1 = 2 [(gogoproto.customname) = "Header1", (gogoproto.moretags) = "yaml:\"header_1\""]; - Header header_2 = 3 [(gogoproto.customname) = "Header2", (gogoproto.moretags) = "yaml:\"header_2\""]; + string client_id = 1 [deprecated = true]; + Header header_1 = 2 [(gogoproto.customname) = "Header1"]; + Header header_2 = 3 [(gogoproto.customname) = "Header2"]; } // Header defines the Tendermint client consensus Header. @@ -98,13 +86,11 @@ message Misbehaviour { // hash to TrustedConsensusState.NextValidatorsHash since that is the last // trusted validator set at the TrustedHeight. message Header { - .tendermint.types.SignedHeader signed_header = 1 - [(gogoproto.embed) = true, (gogoproto.moretags) = "yaml:\"signed_header\""]; + .tendermint.types.SignedHeader signed_header = 1 [(gogoproto.embed) = true]; - .tendermint.types.ValidatorSet validator_set = 2 [(gogoproto.moretags) = "yaml:\"validator_set\""]; - ibc.core.client.v1.Height trusted_height = 3 - [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"trusted_height\""]; - .tendermint.types.ValidatorSet trusted_validators = 4 [(gogoproto.moretags) = "yaml:\"trusted_validators\""]; + .tendermint.types.ValidatorSet validator_set = 2; + ibc.core.client.v1.Height trusted_height = 3 [(gogoproto.nullable) = false]; + .tendermint.types.ValidatorSet trusted_validators = 4; } // Fraction defines the protobuf message type for tmmath.Fraction that only diff --git a/third_party/proto/ibc/lightclients/wasm/v1/genesis.proto b/third_party/proto/ibc/lightclients/wasm/v1/genesis.proto new file mode 100644 index 0000000000..637ba1677e --- /dev/null +++ b/third_party/proto/ibc/lightclients/wasm/v1/genesis.proto @@ -0,0 +1,20 @@ + +syntax = "proto3"; +package ibc.lightclients.wasm.v1; + +import "gogoproto/gogo.proto"; + +option go_package = "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/types"; + +// GenesisState defines 08-wasm's keeper genesis state +message GenesisState { + // uploaded light client wasm contracts + repeated Contract contracts = 1 [(gogoproto.nullable) = false]; +} + +// Contract stores contract code +message Contract { + option (gogoproto.goproto_getters) = false; + // contract byte code + bytes code_bytes = 1; +} \ No newline at end of file diff --git a/third_party/proto/ibc/lightclients/wasm/v1/query.proto b/third_party/proto/ibc/lightclients/wasm/v1/query.proto new file mode 100644 index 0000000000..bbbed29dda --- /dev/null +++ b/third_party/proto/ibc/lightclients/wasm/v1/query.proto @@ -0,0 +1,46 @@ +syntax = "proto3"; +package ibc.lightclients.wasm.v1; + +import "google/api/annotations.proto"; +import "cosmos/base/query/v1beta1/pagination.proto"; + +option go_package = "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/types"; + +// Query service for wasm module +service Query { + // Get all Wasm checksums + rpc Checksums(QueryChecksumsRequest) returns (QueryChecksumsResponse) { + option (google.api.http).get = "/ibc/lightclients/wasm/v1/checksums"; + } + + // Get Wasm code for given checksum + rpc Code(QueryCodeRequest) returns (QueryCodeResponse) { + option (google.api.http).get = "/ibc/lightclients/wasm/v1/checksums/{checksum}/code"; + } +} + +// QueryChecksumsRequest is the request type for the Query/Checksums RPC method. +message QueryChecksumsRequest { + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} + +// QueryChecksumsResponse is the response type for the Query/Checksums RPC method. +message QueryChecksumsResponse { + // checksums is a list of the hex encoded checksums of all wasm codes stored. + repeated string checksums = 1; + + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QueryCodeRequest is the request type for the Query/Code RPC method. +message QueryCodeRequest { + // checksum is a hex encoded string of the code stored. + string checksum = 1; +} + +// QueryCodeResponse is the response type for the Query/Code RPC method. +message QueryCodeResponse { + bytes data = 1; +} diff --git a/third_party/proto/ibc/lightclients/wasm/v1/tx.proto b/third_party/proto/ibc/lightclients/wasm/v1/tx.proto new file mode 100644 index 0000000000..d2fc465919 --- /dev/null +++ b/third_party/proto/ibc/lightclients/wasm/v1/tx.proto @@ -0,0 +1,66 @@ +syntax = "proto3"; +package ibc.lightclients.wasm.v1; + +option go_package = "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/types"; + +import "cosmos/msg/v1/msg.proto"; + +// Msg defines the ibc/08-wasm Msg service. +service Msg { + option (cosmos.msg.v1.service) = true; + + // StoreCode defines a rpc handler method for MsgStoreCode. + rpc StoreCode(MsgStoreCode) returns (MsgStoreCodeResponse); + + // RemoveChecksum defines a rpc handler method for MsgRemoveChecksum. + rpc RemoveChecksum(MsgRemoveChecksum) returns (MsgRemoveChecksumResponse); + + // MigrateContract defines a rpc handler method for MsgMigrateContract. + rpc MigrateContract(MsgMigrateContract) returns (MsgMigrateContractResponse); +} + +// MsgStoreCode defines the request type for the StoreCode rpc. +message MsgStoreCode { + option (cosmos.msg.v1.signer) = "signer"; + + // signer address + string signer = 1; + // wasm byte code of light client contract. It can be raw or gzip compressed + bytes wasm_byte_code = 2; +} + +// MsgStoreCodeResponse defines the response type for the StoreCode rpc +message MsgStoreCodeResponse { + // checksum is the sha256 hash of the stored code + bytes checksum = 1; +} + +// MsgRemoveChecksum defines the request type for the MsgRemoveChecksum rpc. +message MsgRemoveChecksum { + option (cosmos.msg.v1.signer) = "signer"; + + // signer address + string signer = 1; + // checksum is the sha256 hash to be removed from the store + bytes checksum = 2; +} + +// MsgStoreChecksumResponse defines the response type for the StoreCode rpc +message MsgRemoveChecksumResponse {} + +// MsgMigrateContract defines the request type for the MigrateContract rpc. +message MsgMigrateContract { + option (cosmos.msg.v1.signer) = "signer"; + + // signer address + string signer = 1; + // the client id of the contract + string client_id = 2; + // checksum is the sha256 hash of the new wasm byte code for the contract + bytes checksum = 3; + // the json encoded message to be passed to the contract on migration + bytes msg = 4; +} + +// MsgMigrateContractResponse defines the response type for the MigrateContract rpc +message MsgMigrateContractResponse {} diff --git a/third_party/proto/ibc/lightclients/wasm/v1/wasm.proto b/third_party/proto/ibc/lightclients/wasm/v1/wasm.proto new file mode 100644 index 0000000000..b6a45e3d8a --- /dev/null +++ b/third_party/proto/ibc/lightclients/wasm/v1/wasm.proto @@ -0,0 +1,43 @@ + +syntax = "proto3"; +package ibc.lightclients.wasm.v1; + +import "gogoproto/gogo.proto"; +import "ibc/core/client/v1/client.proto"; + +option go_package = "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/types"; + +// Wasm light client's Client state +message ClientState { + option (gogoproto.goproto_getters) = false; + // bytes encoding the client state of the underlying light client + // implemented as a Wasm contract. + bytes data = 1; + bytes checksum = 2; + ibc.core.client.v1.Height latest_height = 3 [(gogoproto.nullable) = false]; +} + +// Wasm light client's ConsensusState +message ConsensusState { + option (gogoproto.goproto_getters) = false; + // bytes encoding the consensus state of the underlying light client + // implemented as a Wasm contract. + bytes data = 1; +} + +// Wasm light client message (either header(s) or misbehaviour) +message ClientMessage { + option (gogoproto.goproto_getters) = false; + + bytes data = 1; +} + +// Checksums defines a list of all checksums that are stored +// +// Deprecated: This message is deprecated in favor of storing the checksums +// using a Collections.KeySet. +message Checksums { + option deprecated = true; + + repeated bytes checksums = 1; +} \ No newline at end of file diff --git a/third_party/proto/tendermint/abci/types.proto b/third_party/proto/tendermint/abci/types.proto index cf9927d796..78eeccebf4 100644 --- a/third_party/proto/tendermint/abci/types.proto +++ b/third_party/proto/tendermint/abci/types.proto @@ -6,39 +6,57 @@ option go_package = "github.com/cometbft/cometbft/abci/types"; // For more information on gogo.proto, see: // https://github.com/cosmos/gogoproto/blob/master/extensions.md import "tendermint/crypto/proof.proto"; -import "tendermint/types/types.proto"; import "tendermint/crypto/keys.proto"; import "tendermint/types/params.proto"; +import "tendermint/types/validator.proto"; import "google/protobuf/timestamp.proto"; import "gogoproto/gogo.proto"; -// This file is copied from http://github.com/tendermint/abci // NOTE: When using custom types, mind the warnings. // https://github.com/cosmos/gogoproto/blob/master/custom_types.md#warnings-and-issues +service ABCI { + rpc Echo(RequestEcho) returns (ResponseEcho); + rpc Flush(RequestFlush) returns (ResponseFlush); + rpc Info(RequestInfo) returns (ResponseInfo); + rpc CheckTx(RequestCheckTx) returns (ResponseCheckTx); + rpc Query(RequestQuery) returns (ResponseQuery); + rpc Commit(RequestCommit) returns (ResponseCommit); + rpc InitChain(RequestInitChain) returns (ResponseInitChain); + rpc ListSnapshots(RequestListSnapshots) returns (ResponseListSnapshots); + rpc OfferSnapshot(RequestOfferSnapshot) returns (ResponseOfferSnapshot); + rpc LoadSnapshotChunk(RequestLoadSnapshotChunk) returns (ResponseLoadSnapshotChunk); + rpc ApplySnapshotChunk(RequestApplySnapshotChunk) returns (ResponseApplySnapshotChunk); + rpc PrepareProposal(RequestPrepareProposal) returns (ResponsePrepareProposal); + rpc ProcessProposal(RequestProcessProposal) returns (ResponseProcessProposal); + rpc ExtendVote(RequestExtendVote) returns (ResponseExtendVote); + rpc VerifyVoteExtension(RequestVerifyVoteExtension) returns (ResponseVerifyVoteExtension); + rpc FinalizeBlock(RequestFinalizeBlock) returns (ResponseFinalizeBlock); +} + //---------------------------------------- // Request types message Request { oneof value { - RequestEcho echo = 1; - RequestFlush flush = 2; - RequestInfo info = 3; - RequestInitChain init_chain = 5; - RequestQuery query = 6; - RequestBeginBlock begin_block = 7; - RequestCheckTx check_tx = 8; - RequestDeliverTx deliver_tx = 9; - RequestEndBlock end_block = 10; - RequestCommit commit = 11; - RequestListSnapshots list_snapshots = 12; - RequestOfferSnapshot offer_snapshot = 13; - RequestLoadSnapshotChunk load_snapshot_chunk = 14; - RequestApplySnapshotChunk apply_snapshot_chunk = 15; - RequestPrepareProposal prepare_proposal = 16; - RequestProcessProposal process_proposal = 17; + RequestEcho echo = 1; + RequestFlush flush = 2; + RequestInfo info = 3; + RequestInitChain init_chain = 5; + RequestQuery query = 6; + RequestCheckTx check_tx = 8; + RequestCommit commit = 11; + RequestListSnapshots list_snapshots = 12; + RequestOfferSnapshot offer_snapshot = 13; + RequestLoadSnapshotChunk load_snapshot_chunk = 14; + RequestApplySnapshotChunk apply_snapshot_chunk = 15; + RequestPrepareProposal prepare_proposal = 16; + RequestProcessProposal process_proposal = 17; + RequestExtendVote extend_vote = 18; + RequestVerifyVoteExtension verify_vote_extension = 19; + RequestFinalizeBlock finalize_block = 20; } - reserved 4; + reserved 4, 7, 9, 10; // SetOption, BeginBlock, DeliverTx, EndBlock } message RequestEcho { @@ -55,8 +73,7 @@ message RequestInfo { } message RequestInitChain { - google.protobuf.Timestamp time = 1 - [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + google.protobuf.Timestamp time = 1 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; string chain_id = 2; tendermint.types.ConsensusParams consensus_params = 3; repeated ValidatorUpdate validators = 4 [(gogoproto.nullable) = false]; @@ -71,13 +88,6 @@ message RequestQuery { bool prove = 4; } -message RequestBeginBlock { - bytes hash = 1; - tendermint.types.Header header = 2 [(gogoproto.nullable) = false]; - CommitInfo last_commit_info = 3 [(gogoproto.nullable) = false]; - repeated Misbehavior byzantine_validators = 4 [(gogoproto.nullable) = false]; -} - enum CheckTxType { NEW = 0 [(gogoproto.enumvalue_customname) = "New"]; RECHECK = 1 [(gogoproto.enumvalue_customname) = "Recheck"]; @@ -88,14 +98,6 @@ message RequestCheckTx { CheckTxType type = 2; } -message RequestDeliverTx { - bytes tx = 1; -} - -message RequestEndBlock { - int64 height = 1; -} - message RequestCommit {} // lists available snapshots @@ -103,8 +105,8 @@ message RequestListSnapshots {} // offers a snapshot to the application message RequestOfferSnapshot { - Snapshot snapshot = 1; // snapshot offered by peers - bytes app_hash = 2; // light client-verified app hash for snapshot height + Snapshot snapshot = 1; // snapshot offered by peers + bytes app_hash = 2; // light client-verified app hash for snapshot height } // loads a snapshot chunk @@ -149,30 +151,69 @@ message RequestProcessProposal { bytes proposer_address = 8; } +// Extends a vote with application-injected data +message RequestExtendVote { + // the hash of the block that this vote may be referring to + bytes hash = 1; + // the height of the extended vote + int64 height = 2; + // info of the block that this vote may be referring to + google.protobuf.Timestamp time = 3 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + repeated bytes txs = 4; + CommitInfo proposed_last_commit = 5 [(gogoproto.nullable) = false]; + repeated Misbehavior misbehavior = 6 [(gogoproto.nullable) = false]; + bytes next_validators_hash = 7; + // address of the public key of the original proposer of the block. + bytes proposer_address = 8; +} + +// Verify the vote extension +message RequestVerifyVoteExtension { + // the hash of the block that this received vote corresponds to + bytes hash = 1; + // the validator that signed the vote extension + bytes validator_address = 2; + int64 height = 3; + bytes vote_extension = 4; +} + +message RequestFinalizeBlock { + repeated bytes txs = 1; + CommitInfo decided_last_commit = 2 [(gogoproto.nullable) = false]; + repeated Misbehavior misbehavior = 3 [(gogoproto.nullable) = false]; + // hash is the merkle root hash of the fields of the decided block. + bytes hash = 4; + int64 height = 5; + google.protobuf.Timestamp time = 6 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + bytes next_validators_hash = 7; + // proposer_address is the address of the public key of the original proposer of the block. + bytes proposer_address = 8; +} + //---------------------------------------- // Response types message Response { oneof value { - ResponseException exception = 1; - ResponseEcho echo = 2; - ResponseFlush flush = 3; - ResponseInfo info = 4; - ResponseInitChain init_chain = 6; - ResponseQuery query = 7; - ResponseBeginBlock begin_block = 8; - ResponseCheckTx check_tx = 9; - ResponseDeliverTx deliver_tx = 10; - ResponseEndBlock end_block = 11; - ResponseCommit commit = 12; - ResponseListSnapshots list_snapshots = 13; - ResponseOfferSnapshot offer_snapshot = 14; - ResponseLoadSnapshotChunk load_snapshot_chunk = 15; - ResponseApplySnapshotChunk apply_snapshot_chunk = 16; - ResponsePrepareProposal prepare_proposal = 17; - ResponseProcessProposal process_proposal = 18; + ResponseException exception = 1; + ResponseEcho echo = 2; + ResponseFlush flush = 3; + ResponseInfo info = 4; + ResponseInitChain init_chain = 6; + ResponseQuery query = 7; + ResponseCheckTx check_tx = 9; + ResponseCommit commit = 12; + ResponseListSnapshots list_snapshots = 13; + ResponseOfferSnapshot offer_snapshot = 14; + ResponseLoadSnapshotChunk load_snapshot_chunk = 15; + ResponseApplySnapshotChunk apply_snapshot_chunk = 16; + ResponsePrepareProposal prepare_proposal = 17; + ResponseProcessProposal process_proposal = 18; + ResponseExtendVote extend_vote = 19; + ResponseVerifyVoteExtension verify_vote_extension = 20; + ResponseFinalizeBlock finalize_block = 21; } - reserved 5; + reserved 5, 8, 10, 11; // SetOption, BeginBlock, DeliverTx, EndBlock } // nondeterministic @@ -205,8 +246,8 @@ message ResponseInitChain { message ResponseQuery { uint32 code = 1; // bytes data = 2; // use "value" instead. - string log = 3; // nondeterministic - string info = 4; // nondeterministic + string log = 3; // nondeterministic + string info = 4; // nondeterministic int64 index = 5; bytes key = 6; bytes value = 7; @@ -215,53 +256,24 @@ message ResponseQuery { string codespace = 10; } -message ResponseBeginBlock { - repeated Event events = 1 - [(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"]; -} - message ResponseCheckTx { uint32 code = 1; bytes data = 2; - string log = 3; // nondeterministic - string info = 4; // nondeterministic - int64 gas_wanted = 5 [json_name = "gas_wanted"]; - int64 gas_used = 6 [json_name = "gas_used"]; - repeated Event events = 7 - [(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"]; - string codespace = 8; - string sender = 9; - int64 priority = 10; - - // mempool_error is set by CometBFT. - // ABCI applictions creating a ResponseCheckTX should not set mempool_error. - string mempool_error = 11; -} - -message ResponseDeliverTx { - uint32 code = 1; - bytes data = 2; - string log = 3; // nondeterministic - string info = 4; // nondeterministic + string log = 3; // nondeterministic + string info = 4; // nondeterministic int64 gas_wanted = 5 [json_name = "gas_wanted"]; int64 gas_used = 6 [json_name = "gas_used"]; - repeated Event events = 7 [ - (gogoproto.nullable) = false, - (gogoproto.jsontag) = "events,omitempty" - ]; // nondeterministic - string codespace = 8; -} + repeated Event events = 7 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"]; + string codespace = 8; -message ResponseEndBlock { - repeated ValidatorUpdate validator_updates = 1 [(gogoproto.nullable) = false]; - tendermint.types.ConsensusParams consensus_param_updates = 2; - repeated Event events = 3 - [(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"]; + // These reserved fields were used until v0.37 by the priority mempool (now + // removed). + reserved 9 to 11; + reserved "sender", "priority", "mempool_error"; } message ResponseCommit { - // reserve 1 - bytes data = 2; + reserved 1, 2; // data was previously returned here int64 retain_height = 3; } @@ -273,12 +285,12 @@ message ResponseOfferSnapshot { Result result = 1; enum Result { - UNKNOWN = 0; // Unknown result, abort all snapshot restoration - ACCEPT = 1; // Snapshot accepted, apply chunks - ABORT = 2; // Abort all snapshot restoration - REJECT = 3; // Reject this specific snapshot, try others - REJECT_FORMAT = 4; // Reject all snapshots of this format, try others - REJECT_SENDER = 5; // Reject all snapshots from the sender(s), try others + UNKNOWN = 0; // Unknown result, abort all snapshot restoration + ACCEPT = 1; // Snapshot accepted, apply chunks + ABORT = 2; // Abort all snapshot restoration + REJECT = 3; // Reject this specific snapshot, try others + REJECT_FORMAT = 4; // Reject all snapshots of this format, try others + REJECT_SENDER = 5; // Reject all snapshots from the sender(s), try others } } @@ -288,16 +300,16 @@ message ResponseLoadSnapshotChunk { message ResponseApplySnapshotChunk { Result result = 1; - repeated uint32 refetch_chunks = 2; // Chunks to refetch and reapply - repeated string reject_senders = 3; // Chunk senders to reject and ban + repeated uint32 refetch_chunks = 2; // Chunks to refetch and reapply + repeated string reject_senders = 3; // Chunk senders to reject and ban enum Result { - UNKNOWN = 0; // Unknown result, abort all snapshot restoration - ACCEPT = 1; // Chunk successfully accepted - ABORT = 2; // Abort all snapshot restoration - RETRY = 3; // Retry chunk (combine with refetch and reject) - RETRY_SNAPSHOT = 4; // Retry snapshot (combine with refetch and reject) - REJECT_SNAPSHOT = 5; // Reject this snapshot, try others + UNKNOWN = 0; // Unknown result, abort all snapshot restoration + ACCEPT = 1; // Chunk successfully accepted + ABORT = 2; // Abort all snapshot restoration + RETRY = 3; // Retry chunk (combine with refetch and reject) + RETRY_SNAPSHOT = 4; // Retry snapshot (combine with refetch and reject) + REJECT_SNAPSHOT = 5; // Reject this snapshot, try others } } @@ -315,6 +327,40 @@ message ResponseProcessProposal { } } +message ResponseExtendVote { + bytes vote_extension = 1; +} + +message ResponseVerifyVoteExtension { + VerifyStatus status = 1; + + enum VerifyStatus { + UNKNOWN = 0; + ACCEPT = 1; + // Rejecting the vote extension will reject the entire precommit by the sender. + // Incorrectly implementing this thus has liveness implications as it may affect + // CometBFT's ability to receive 2/3+ valid votes to finalize the block. + // Honest nodes should never be rejected. + REJECT = 2; + } +} + +message ResponseFinalizeBlock { + // set of block events emmitted as part of executing the block + repeated Event events = 1 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"]; + // the result of executing each transaction including the events + // the particular transction emitted. This should match the order + // of the transactions delivered in the block itself + repeated ExecTxResult tx_results = 2; + // a list of updates to the validator set. These will reflect the validator set at current height + 2. + repeated ValidatorUpdate validator_updates = 3 [(gogoproto.nullable) = false]; + // updates to the consensus params, if any. + tendermint.types.ConsensusParams consensus_param_updates = 4; + // app_hash is the hash of the applications' state which is used to confirm that execution of the transactions was + // deterministic. It is up to the application to decide which algorithm to use. + bytes app_hash = 5; +} + //---------------------------------------- // Misc. @@ -323,6 +369,9 @@ message CommitInfo { repeated VoteInfo votes = 2 [(gogoproto.nullable) = false]; } +// ExtendedCommitInfo is similar to CommitInfo except that it is only used in +// the PrepareProposal request such that CometBFT can provide vote extensions +// to the application. message ExtendedCommitInfo { // The round at which the block proposer decided in the previous height. int32 round = 1; @@ -332,59 +381,77 @@ message ExtendedCommitInfo { } // Event allows application developers to attach additional information to -// ResponseBeginBlock, ResponseEndBlock, ResponseCheckTx and ResponseDeliverTx. +// ResponseFinalizeBlock and ResponseCheckTx. // Later, transactions may be queried using these events. message Event { string type = 1; - repeated EventAttribute attributes = 2 [ - (gogoproto.nullable) = false, - (gogoproto.jsontag) = "attributes,omitempty" - ]; + repeated EventAttribute attributes = 2 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "attributes,omitempty"]; } // EventAttribute is a single key-value pair, associated with an event. message EventAttribute { string key = 1; string value = 2; - bool index = 3; // nondeterministic + bool index = 3; // nondeterministic +} + +// ExecTxResult contains results of executing one individual transaction. +// +// * Its structure is equivalent to #ResponseDeliverTx which will be deprecated/deleted +message ExecTxResult { + uint32 code = 1; + bytes data = 2; + string log = 3; // nondeterministic + string info = 4; // nondeterministic + int64 gas_wanted = 5 [json_name = "gas_wanted"]; + int64 gas_used = 6 [json_name = "gas_used"]; + repeated Event events = 7 + [(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"]; // nondeterministic + string codespace = 8; } // TxResult contains results of executing the transaction. // // One usage is indexing transaction results. message TxResult { - int64 height = 1; - uint32 index = 2; - bytes tx = 3; - ResponseDeliverTx result = 4 [(gogoproto.nullable) = false]; + int64 height = 1; + uint32 index = 2; + bytes tx = 3; + ExecTxResult result = 4 [(gogoproto.nullable) = false]; } //---------------------------------------- // Blockchain Types -// Validator message Validator { - bytes address = 1; // The first 20 bytes of SHA256(public key) + bytes address = 1; // The first 20 bytes of SHA256(public key) // PubKey pub_key = 2 [(gogoproto.nullable)=false]; - int64 power = 3; // The voting power + int64 power = 3; // The voting power } -// ValidatorUpdate message ValidatorUpdate { tendermint.crypto.PublicKey pub_key = 1 [(gogoproto.nullable) = false]; int64 power = 2; } -// VoteInfo message VoteInfo { - Validator validator = 1 [(gogoproto.nullable) = false]; - bool signed_last_block = 2; + Validator validator = 1 [(gogoproto.nullable) = false]; + tendermint.types.BlockIDFlag block_id_flag = 3; + + reserved 2; // signed_last_block } message ExtendedVoteInfo { - Validator validator = 1 [(gogoproto.nullable) = false]; - bool signed_last_block = 2; - bytes vote_extension = 3; // Reserved for future use + // The validator that sent the vote. + Validator validator = 1 [(gogoproto.nullable) = false]; + // Non-deterministic extension provided by the sending validator's application. + bytes vote_extension = 3; + // Vote extension signature created by CometBFT + bytes extension_signature = 4; + // block_id_flag indicates whether the validator voted for a block, nil, or did not vote at all + tendermint.types.BlockIDFlag block_id_flag = 5; + + reserved 2; // signed_last_block } enum MisbehaviorType { @@ -400,8 +467,7 @@ message Misbehavior { // The height when the offense occurred int64 height = 3; // The corresponding time where the offense occurred - google.protobuf.Timestamp time = 4 - [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + google.protobuf.Timestamp time = 4 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; // Total voting power of the validator set in case the ABCI application does // not store historical validators. // https://github.com/tendermint/tendermint/issues/4581 @@ -412,33 +478,9 @@ message Misbehavior { // State Sync Types message Snapshot { - uint64 height = 1; // The height at which the snapshot was taken - uint32 format = 2; // The application-specific snapshot format - uint32 chunks = 3; // Number of chunks in the snapshot - bytes hash = 4; // Arbitrary snapshot hash, equal only if identical - bytes metadata = 5; // Arbitrary application metadata -} - -//---------------------------------------- -// Service Definition - -service ABCIApplication { - rpc Echo(RequestEcho) returns (ResponseEcho); - rpc Flush(RequestFlush) returns (ResponseFlush); - rpc Info(RequestInfo) returns (ResponseInfo); - rpc DeliverTx(RequestDeliverTx) returns (ResponseDeliverTx); - rpc CheckTx(RequestCheckTx) returns (ResponseCheckTx); - rpc Query(RequestQuery) returns (ResponseQuery); - rpc Commit(RequestCommit) returns (ResponseCommit); - rpc InitChain(RequestInitChain) returns (ResponseInitChain); - rpc BeginBlock(RequestBeginBlock) returns (ResponseBeginBlock); - rpc EndBlock(RequestEndBlock) returns (ResponseEndBlock); - rpc ListSnapshots(RequestListSnapshots) returns (ResponseListSnapshots); - rpc OfferSnapshot(RequestOfferSnapshot) returns (ResponseOfferSnapshot); - rpc LoadSnapshotChunk(RequestLoadSnapshotChunk) - returns (ResponseLoadSnapshotChunk); - rpc ApplySnapshotChunk(RequestApplySnapshotChunk) - returns (ResponseApplySnapshotChunk); - rpc PrepareProposal(RequestPrepareProposal) returns (ResponsePrepareProposal); - rpc ProcessProposal(RequestProcessProposal) returns (ResponseProcessProposal); + uint64 height = 1; // The height at which the snapshot was taken + uint32 format = 2; // The application-specific snapshot format + uint32 chunks = 3; // Number of chunks in the snapshot + bytes hash = 4; // Arbitrary snapshot hash, equal only if identical + bytes metadata = 5; // Arbitrary application metadata } diff --git a/third_party/proto/tendermint/blocksync/types.proto b/third_party/proto/tendermint/blocksync/types.proto index f33d2697ed..11c39a713b 100644 --- a/third_party/proto/tendermint/blocksync/types.proto +++ b/third_party/proto/tendermint/blocksync/types.proto @@ -4,6 +4,7 @@ package tendermint.blocksync; option go_package = "github.com/cometbft/cometbft/proto/tendermint/blocksync"; import "tendermint/types/block.proto"; +import "tendermint/types/types.proto"; // BlockRequest requests a block for a specific height message BlockRequest { @@ -17,7 +18,8 @@ message NoBlockResponse { // BlockResponse returns block to the requested message BlockResponse { - tendermint.types.Block block = 1; + tendermint.types.Block block = 1; + tendermint.types.ExtendedCommit ext_commit = 2; } // StatusRequest requests the status of a peer. diff --git a/third_party/proto/tendermint/rpc/grpc/types.proto b/third_party/proto/tendermint/rpc/grpc/types.proto index ad79f04871..68ff0cad71 100644 --- a/third_party/proto/tendermint/rpc/grpc/types.proto +++ b/third_party/proto/tendermint/rpc/grpc/types.proto @@ -19,13 +19,17 @@ message RequestBroadcastTx { message ResponsePing {} message ResponseBroadcastTx { - tendermint.abci.ResponseCheckTx check_tx = 1; - tendermint.abci.ResponseDeliverTx deliver_tx = 2; + tendermint.abci.ResponseCheckTx check_tx = 1; + tendermint.abci.ExecTxResult tx_result = 2; } //---------------------------------------- // Service Definition +// BroadcastAPI +// +// Deprecated: This API will be superseded by a more comprehensive gRPC-based +// broadcast API, and is scheduled for removal after v0.38. service BroadcastAPI { rpc Ping(RequestPing) returns (ResponsePing); rpc BroadcastTx(RequestBroadcastTx) returns (ResponseBroadcastTx); diff --git a/third_party/proto/tendermint/state/types.proto b/third_party/proto/tendermint/state/types.proto index 4f28f0b6b3..c76c25fa85 100644 --- a/third_party/proto/tendermint/state/types.proto +++ b/third_party/proto/tendermint/state/types.proto @@ -11,13 +11,28 @@ import "tendermint/types/params.proto"; import "tendermint/version/types.proto"; import "google/protobuf/timestamp.proto"; -// ABCIResponses retains the responses -// of the various ABCI calls during block processing. -// It is persisted to disk for each height before calling Commit. -message ABCIResponses { - repeated tendermint.abci.ResponseDeliverTx deliver_txs = 1; - tendermint.abci.ResponseEndBlock end_block = 2; - tendermint.abci.ResponseBeginBlock begin_block = 3; +// LegacyABCIResponses retains the responses +// of the legacy ABCI calls during block processing. +// Note ReponseDeliverTx is renamed to ExecTxResult but they are semantically the same +// Kept for backwards compatibility for versions prior to v0.38 +message LegacyABCIResponses { + repeated tendermint.abci.ExecTxResult deliver_txs = 1; + ResponseEndBlock end_block = 2; + ResponseBeginBlock begin_block = 3; +} + +// ResponseBeginBlock is kept for backwards compatibility for versions prior to v0.38 +message ResponseBeginBlock { + repeated tendermint.abci.Event events = 1 + [(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"]; +} + +// ResponseEndBlock is kept for backwards compatibility for versions prior to v0.38 +message ResponseEndBlock { + repeated tendermint.abci.ValidatorUpdate validator_updates = 1 [(gogoproto.nullable) = false]; + tendermint.types.ConsensusParams consensus_param_updates = 2; + repeated tendermint.abci.Event events = 3 + [(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"]; } // ValidatorsInfo represents the latest validator set, or the last height it changed @@ -33,8 +48,9 @@ message ConsensusParamsInfo { } message ABCIResponsesInfo { - ABCIResponses abci_responses = 1; - int64 height = 2; + LegacyABCIResponses legacy_abci_responses = 1; + int64 height = 2; + abci.ResponseFinalizeBlock response_finalize_block = 3; } message Version { diff --git a/third_party/proto/tendermint/types/canonical.proto b/third_party/proto/tendermint/types/canonical.proto index c4ce16131f..bbff09b660 100644 --- a/third_party/proto/tendermint/types/canonical.proto +++ b/third_party/proto/tendermint/types/canonical.proto @@ -35,3 +35,12 @@ message CanonicalVote { google.protobuf.Timestamp timestamp = 5 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; string chain_id = 6 [(gogoproto.customname) = "ChainID"]; } + +// CanonicalVoteExtension provides us a way to serialize a vote extension from +// a particular validator such that we can sign over those serialized bytes. +message CanonicalVoteExtension { + bytes extension = 1; + sfixed64 height = 2; + sfixed64 round = 3; + string chain_id = 4; +} diff --git a/third_party/proto/tendermint/types/evidence.proto b/third_party/proto/tendermint/types/evidence.proto index 1f35049bdc..06f30ec2f5 100644 --- a/third_party/proto/tendermint/types/evidence.proto +++ b/third_party/proto/tendermint/types/evidence.proto @@ -30,7 +30,7 @@ message LightClientAttackEvidence { int64 common_height = 2; repeated tendermint.types.Validator byzantine_validators = 3; int64 total_voting_power = 4; - google.protobuf.Timestamp timestamp = 5 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + google.protobuf.Timestamp timestamp = 5 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; } message EvidenceList { diff --git a/third_party/proto/tendermint/types/params.proto b/third_party/proto/tendermint/types/params.proto index 66963eec4e..6a42d5ef0d 100644 --- a/third_party/proto/tendermint/types/params.proto +++ b/third_party/proto/tendermint/types/params.proto @@ -15,6 +15,7 @@ message ConsensusParams { EvidenceParams evidence = 2; ValidatorParams validator = 3; VersionParams version = 4; + ABCIParams abci = 5; } // BlockParams contains limits on the block size. @@ -26,7 +27,7 @@ message BlockParams { // Note: must be greater or equal to -1 int64 max_gas = 2; - reserved 3; // was TimeIotaMs see https://github.com/cometbft/cometbft/pull/5792 + reserved 3; // was TimeIotaMs see https://github.com/tendermint/tendermint/pull/5792 } // EvidenceParams determine how we handle evidence of malfeasance. @@ -42,8 +43,7 @@ message EvidenceParams { // It should correspond with an app's "unbonding period" or other similar // mechanism for handling [Nothing-At-Stake // attacks](https://github.com/ethereum/wiki/wiki/Proof-of-Stake-FAQ#what-is-the-nothing-at-stake-problem-and-how-can-it-be-fixed). - google.protobuf.Duration max_age_duration = 2 - [(gogoproto.nullable) = false, (gogoproto.stdduration) = true]; + google.protobuf.Duration max_age_duration = 2 [(gogoproto.nullable) = false, (gogoproto.stdduration) = true]; // This sets the maximum size of total evidence in bytes that can be committed in a single block. // and should fall comfortably under the max block bytes. @@ -75,3 +75,17 @@ message HashedParams { int64 block_max_bytes = 1; int64 block_max_gas = 2; } + +// ABCIParams configure functionality specific to the Application Blockchain Interface. +message ABCIParams { + // vote_extensions_enable_height configures the first height during which + // vote extensions will be enabled. During this specified height, and for all + // subsequent heights, precommit messages that do not contain valid extension data + // will be considered invalid. Prior to this height, vote extensions will not + // be used or accepted by validators on the network. + // + // Once enabled, vote extensions will be created by the application in ExtendVote, + // passed to the application for validation in VerifyVoteExtension and given + // to the application to use when proposing a block during PrepareProposal. + int64 vote_extensions_enable_height = 1; +} diff --git a/third_party/proto/tendermint/types/types.proto b/third_party/proto/tendermint/types/types.proto index 425f041dab..a0d545ad9e 100644 --- a/third_party/proto/tendermint/types/types.proto +++ b/third_party/proto/tendermint/types/types.proto @@ -9,17 +9,6 @@ import "tendermint/crypto/proof.proto"; import "tendermint/version/types.proto"; import "tendermint/types/validator.proto"; -// BlockIdFlag indicates which BlcokID the signature is for -enum BlockIDFlag { - option (gogoproto.goproto_enum_stringer) = true; - option (gogoproto.goproto_enum_prefix) = false; - - BLOCK_ID_FLAG_UNKNOWN = 0 [(gogoproto.enumvalue_customname) = "BlockIDFlagUnknown"]; - BLOCK_ID_FLAG_ABSENT = 1 [(gogoproto.enumvalue_customname) = "BlockIDFlagAbsent"]; - BLOCK_ID_FLAG_COMMIT = 2 [(gogoproto.enumvalue_customname) = "BlockIDFlagCommit"]; - BLOCK_ID_FLAG_NIL = 3 [(gogoproto.enumvalue_customname) = "BlockIDFlagNil"]; -} - // SignedMsgType is a type of signed message in the consensus. enum SignedMsgType { option (gogoproto.goproto_enum_stringer) = true; @@ -66,19 +55,19 @@ message Header { BlockID last_block_id = 5 [(gogoproto.nullable) = false]; // hashes of block data - bytes last_commit_hash = 6; // commit from validators from the last block - bytes data_hash = 7; // transactions + bytes last_commit_hash = 6; // commit from validators from the last block + bytes data_hash = 7; // transactions // hashes from the app output from the prev block - bytes validators_hash = 8; // validators for the current block - bytes next_validators_hash = 9; // validators for the next block - bytes consensus_hash = 10; // consensus params for current block - bytes app_hash = 11; // state after txs from the previous block - bytes last_results_hash = 12; // root hash of all results from the txs from the previous block + bytes validators_hash = 8; // validators for the current block + bytes next_validators_hash = 9; // validators for the next block + bytes consensus_hash = 10; // consensus params for current block + bytes app_hash = 11; // state after txs from the previous block + bytes last_results_hash = 12; // root hash of all results from the txs from the previous block // consensus info - bytes evidence_hash = 13; // evidence included in the block - bytes proposer_address = 14; // original proposer of the block + bytes evidence_hash = 13; // evidence included in the block + bytes proposer_address = 14; // original proposer of the block } // Data contains the set of transactions included in the block @@ -89,19 +78,26 @@ message Data { repeated bytes txs = 1; } -// Vote represents a prevote, precommit, or commit vote from validators for +// Vote represents a prevote or precommit vote from validators for // consensus. message Vote { SignedMsgType type = 1; int64 height = 2; int32 round = 3; - BlockID block_id = 4 - [(gogoproto.nullable) = false, (gogoproto.customname) = "BlockID"]; // zero if vote is nil. - google.protobuf.Timestamp timestamp = 5 - [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; - bytes validator_address = 6; - int32 validator_index = 7; - bytes signature = 8; + BlockID block_id = 4 [(gogoproto.nullable) = false, (gogoproto.customname) = "BlockID"]; // zero if vote is nil. + google.protobuf.Timestamp timestamp = 5 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + bytes validator_address = 6; + int32 validator_index = 7; + // Vote signature by the validator if they participated in consensus for the + // associated block. + bytes signature = 8; + // Vote extension provided by the application. Only valid for precommit + // messages. + bytes extension = 9; + // Vote extension signature by the validator if they participated in + // consensus for the associated block. + // Only valid for precommit messages. + bytes extension_signature = 10; } // Commit contains the evidence that a block was committed by a set of validators. @@ -114,11 +110,31 @@ message Commit { // CommitSig is a part of the Vote included in a Commit. message CommitSig { - BlockIDFlag block_id_flag = 1; - bytes validator_address = 2; - google.protobuf.Timestamp timestamp = 3 - [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; - bytes signature = 4; + tendermint.types.BlockIDFlag block_id_flag = 1; + bytes validator_address = 2; + google.protobuf.Timestamp timestamp = 3 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + bytes signature = 4; +} + +message ExtendedCommit { + int64 height = 1; + int32 round = 2; + BlockID block_id = 3 [(gogoproto.nullable) = false, (gogoproto.customname) = "BlockID"]; + repeated ExtendedCommitSig extended_signatures = 4 [(gogoproto.nullable) = false]; +} + +// ExtendedCommitSig retains all the same fields as CommitSig but adds vote +// extension-related fields. We use two signatures to ensure backwards compatibility. +// That is the digest of the original signature is still the same in prior versions +message ExtendedCommitSig { + tendermint.types.BlockIDFlag block_id_flag = 1; + bytes validator_address = 2; + google.protobuf.Timestamp timestamp = 3 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + bytes signature = 4; + // Vote extension data + bytes extension = 5; + // Vote extension signature + bytes extension_signature = 6; } message Proposal { @@ -127,9 +143,8 @@ message Proposal { int32 round = 3; int32 pol_round = 4; BlockID block_id = 5 [(gogoproto.customname) = "BlockID", (gogoproto.nullable) = false]; - google.protobuf.Timestamp timestamp = 6 - [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; - bytes signature = 7; + google.protobuf.Timestamp timestamp = 6 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + bytes signature = 7; } message SignedHeader { diff --git a/third_party/proto/tendermint/types/validator.proto b/third_party/proto/tendermint/types/validator.proto index 3e170262cc..cd5105fac7 100644 --- a/third_party/proto/tendermint/types/validator.proto +++ b/third_party/proto/tendermint/types/validator.proto @@ -6,6 +6,18 @@ option go_package = "github.com/cometbft/cometbft/proto/tendermint/types"; import "gogoproto/gogo.proto"; import "tendermint/crypto/keys.proto"; +// BlockIdFlag indicates which BlockID the signature is for +enum BlockIDFlag { + option (gogoproto.goproto_enum_stringer) = true; + option (gogoproto.goproto_enum_prefix) = false; + + BLOCK_ID_FLAG_UNKNOWN = 0 [(gogoproto.enumvalue_customname) = "BlockIDFlagUnknown"]; // indicates an error condition + BLOCK_ID_FLAG_ABSENT = 1 [(gogoproto.enumvalue_customname) = "BlockIDFlagAbsent"]; // the vote was not received + BLOCK_ID_FLAG_COMMIT = 2 + [(gogoproto.enumvalue_customname) = "BlockIDFlagCommit"]; // voted for the block that received the majority + BLOCK_ID_FLAG_NIL = 3 [(gogoproto.enumvalue_customname) = "BlockIDFlagNil"]; // voted for nil +} + message ValidatorSet { repeated Validator validators = 1; Validator proposer = 2; diff --git a/x/auction/genesis.go b/x/auction/genesis.go index f484d7d33a..94a02c13a3 100644 --- a/x/auction/genesis.go +++ b/x/auction/genesis.go @@ -41,7 +41,7 @@ func InitGenesis(ctx sdk.Context, keeper keeper.Keeper, bankKeeper types.BankKee // check module coins match auction coins // Note: Other sdk modules do not check this, instead just using the existing module account coins, or if zero, setting them. - if !maccCoins.IsEqual(totalAuctionCoins) { + if !maccCoins.Equal(totalAuctionCoins) { panic(fmt.Sprintf("total auction coins (%s) do not equal (%s) module account (%s) ", maccCoins, types.ModuleName, totalAuctionCoins)) } } diff --git a/x/auction/genesis_test.go b/x/auction/genesis_test.go index b8d32399c9..7c68c043b8 100644 --- a/x/auction/genesis_test.go +++ b/x/auction/genesis_test.go @@ -1,6 +1,7 @@ package auction_test import ( + "fmt" "sort" "testing" "time" @@ -9,7 +10,6 @@ import ( sdkmath "cosmossdk.io/math" 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/kava-labs/kava/app" @@ -25,7 +25,7 @@ var ( c("lotdenom", 10), testTime, c("biddenom", 1000), - types.WeightedAddresses{Addresses: testAddrs, Weights: []sdkmath.Int{sdk.OneInt(), sdk.OneInt()}}, + types.WeightedAddresses{Addresses: testAddrs, Weights: []sdkmath.Int{sdkmath.OneInt(), sdkmath.OneInt()}}, c("debt", 1000), ).WithID(3).(types.GenesisAuction) ) @@ -34,7 +34,7 @@ func TestInitGenesis(t *testing.T) { t.Run("valid", func(t *testing.T) { // setup keepers tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1}) // setup module account modBaseAcc := authtypes.NewBaseAccount(authtypes.NewModuleAddress(types.ModuleName), nil, 0, 0) @@ -81,7 +81,7 @@ func TestInitGenesis(t *testing.T) { t.Run("invalid (invalid nextAuctionID)", func(t *testing.T) { // setup keepers tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1}) // setup module account modBaseAcc := authtypes.NewBaseAccount(authtypes.NewModuleAddress(types.ModuleName), nil, 0, 0) @@ -105,7 +105,7 @@ func TestInitGenesis(t *testing.T) { t.Run("invalid (missing mod account coins)", func(t *testing.T) { // setup keepers tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1}) // invalid as there is no module account setup @@ -128,12 +128,18 @@ func TestExportGenesis(t *testing.T) { t.Run("default", func(t *testing.T) { // setup state tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1}) + fmt.Println("tApp created") tApp.InitializeFromGenesisStates() + fmt.Println("tApp initialized") + fmt.Println("tApp minter", tApp.GetMintKeeper().GetMinter(ctx)) + // export gs := auction.ExportGenesis(ctx, tApp.GetAuctionKeeper()) + fmt.Println("exported genesis", gs) + // check state matches defaultGS := types.DefaultGenesisState() require.Equal(t, defaultGS, gs) @@ -141,7 +147,7 @@ func TestExportGenesis(t *testing.T) { t.Run("one auction", func(t *testing.T) { // setup state tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1}) tApp.InitializeFromGenesisStates() tApp.GetAuctionKeeper().SetAuction(ctx, testAuction) diff --git a/x/auction/keeper/auctions.go b/x/auction/keeper/auctions.go index 78af906b5c..4638291ddd 100644 --- a/x/auction/keeper/auctions.go +++ b/x/auction/keeper/auctions.go @@ -178,9 +178,9 @@ func (k Keeper) PlaceBidSurplus(ctx sdk.Context, auction *types.SurplusAuction, return auction, errorsmod.Wrapf(types.ErrInvalidBidDenom, "%s ≠ %s", bid.Denom, auction.Bid.Denom) } minNewBidAmt := auction.Bid.Amount.Add( // new bids must be some % greater than old bid, and at least 1 larger to avoid replacing an old bid at no cost - sdk.MaxInt( + sdkmath.MaxInt( sdkmath.NewInt(1), - sdk.NewDecFromInt(auction.Bid.Amount).Mul(k.GetParams(ctx).IncrementSurplus).RoundInt(), + sdkmath.LegacyNewDecFromInt(auction.Bid.Amount).Mul(k.GetParams(ctx).IncrementSurplus).RoundInt(), ), ) if bid.Amount.LT(minNewBidAmt) { @@ -243,12 +243,12 @@ func (k Keeper) PlaceForwardBidCollateral(ctx sdk.Context, auction *types.Collat panic("cannot place reverse bid on auction in forward phase") } minNewBidAmt := auction.Bid.Amount.Add( // new bids must be some % greater than old bid, and at least 1 larger to avoid replacing an old bid at no cost - sdk.MaxInt( + sdkmath.MaxInt( sdkmath.NewInt(1), - sdk.NewDecFromInt(auction.Bid.Amount).Mul(k.GetParams(ctx).IncrementCollateral).RoundInt(), + sdkmath.LegacyNewDecFromInt(auction.Bid.Amount).Mul(k.GetParams(ctx).IncrementCollateral).RoundInt(), ), ) - minNewBidAmt = sdk.MinInt(minNewBidAmt, auction.MaxBid.Amount) // allow new bids to hit MaxBid even though it may be less than the increment % + minNewBidAmt = sdkmath.MinInt(minNewBidAmt, auction.MaxBid.Amount) // allow new bids to hit MaxBid even though it may be less than the increment % if bid.Amount.LT(minNewBidAmt) { return auction, errorsmod.Wrapf(types.ErrBidTooSmall, "%s < %s%s", bid, minNewBidAmt, auction.Bid.Denom) } @@ -277,7 +277,7 @@ func (k Keeper) PlaceForwardBidCollateral(ctx sdk.Context, auction *types.Collat // Debt coins are sent to liquidator (until there is no CorrespondingDebt left). Amount sent is equal to bidIncrement (or whatever is left if < bidIncrement). if auction.CorrespondingDebt.IsPositive() { - debtAmountToReturn := sdk.MinInt(bidIncrement.Amount, auction.CorrespondingDebt.Amount) + debtAmountToReturn := sdkmath.MinInt(bidIncrement.Amount, auction.CorrespondingDebt.Amount) debtToReturn := sdk.NewCoin(auction.CorrespondingDebt.Denom, debtAmountToReturn) err = k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, auction.Initiator, sdk.NewCoins(debtToReturn)) @@ -325,9 +325,9 @@ func (k Keeper) PlaceReverseBidCollateral(ctx sdk.Context, auction *types.Collat panic("cannot place forward bid on auction in reverse phase") } maxNewLotAmt := auction.Lot.Amount.Sub( // new lot must be some % less than old lot, and at least 1 smaller to avoid replacing an old bid at no cost - sdk.MaxInt( + sdkmath.MaxInt( sdkmath.NewInt(1), - sdk.NewDecFromInt(auction.Lot.Amount).Mul(k.GetParams(ctx).IncrementCollateral).RoundInt(), + sdkmath.LegacyNewDecFromInt(auction.Lot.Amount).Mul(k.GetParams(ctx).IncrementCollateral).RoundInt(), ), ) if lot.Amount.GT(maxNewLotAmt) { @@ -396,16 +396,16 @@ func (k Keeper) PlaceBidDebt(ctx sdk.Context, auction *types.DebtAuction, bidder return auction, errorsmod.Wrapf(types.ErrInvalidLotDenom, "%s ≠ %s", lot.Denom, auction.Lot.Denom) } maxNewLotAmt := auction.Lot.Amount.Sub( // new lot must be some % less than old lot, and at least 1 smaller to avoid replacing an old bid at no cost - sdk.MaxInt( + sdkmath.MaxInt( sdkmath.NewInt(1), - sdk.NewDecFromInt(auction.Lot.Amount).Mul(k.GetParams(ctx).IncrementDebt).RoundInt(), + sdkmath.LegacyNewDecFromInt(auction.Lot.Amount).Mul(k.GetParams(ctx).IncrementDebt).RoundInt(), ), ) if lot.Amount.GT(maxNewLotAmt) { return auction, errorsmod.Wrapf(types.ErrLotTooLarge, "%s > %s%s", lot, maxNewLotAmt, auction.Lot.Denom) } if lot.IsNegative() { - return auction, errorsmod.Wrapf(types.ErrLotTooSmall, "%s ≤ %s%s", lot, sdk.ZeroInt(), auction.Lot.Denom) + return auction, errorsmod.Wrapf(types.ErrLotTooSmall, "%s ≤ %s%s", lot, sdkmath.ZeroInt(), auction.Lot.Denom) } // New bidder pays back old bidder @@ -431,7 +431,7 @@ func (k Keeper) PlaceBidDebt(ctx sdk.Context, auction *types.DebtAuction, bidder // Debt coins are sent to liquidator the first time a bid is placed. Amount sent is equal to min of Bid and amount of debt. if auction.Bidder.Equals(authtypes.NewModuleAddress(auction.Initiator)) { // Handle debt coins for first bid - debtAmountToReturn := sdk.MinInt(auction.Bid.Amount, auction.CorrespondingDebt.Amount) + debtAmountToReturn := sdkmath.MinInt(auction.Bid.Amount, auction.CorrespondingDebt.Amount) debtToReturn := sdk.NewCoin(auction.CorrespondingDebt.Denom, debtAmountToReturn) err := k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, auction.Initiator, sdk.NewCoins(debtToReturn)) diff --git a/x/auction/keeper/bidding_test.go b/x/auction/keeper/bidding_test.go index 5918e62ce4..7780018543 100644 --- a/x/auction/keeper/bidding_test.go +++ b/x/auction/keeper/bidding_test.go @@ -471,7 +471,7 @@ func TestAuctionBidding(t *testing.T) { gs := app.GenesisState{types.ModuleName: moduleGs} tApp.InitializeFromGenesisStates(authGS, gs) - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: someTime}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: someTime}) keeper := tApp.GetAuctionKeeper() bank := tApp.GetBankKeeper() diff --git a/x/auction/keeper/grpc_query.go b/x/auction/keeper/grpc_query.go index be3e7b8c75..d7433761d8 100644 --- a/x/auction/keeper/grpc_query.go +++ b/x/auction/keeper/grpc_query.go @@ -6,8 +6,8 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/status" + "cosmossdk.io/store/prefix" codectypes "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/query" diff --git a/x/auction/keeper/grpc_query_test.go b/x/auction/keeper/grpc_query_test.go index 12a25aece5..5cf57a261c 100644 --- a/x/auction/keeper/grpc_query_test.go +++ b/x/auction/keeper/grpc_query_test.go @@ -19,7 +19,7 @@ func TestGrpcAuctionsFilter(t *testing.T) { tApp := app.NewTestApp() tApp.InitializeFromGenesisStates() auctionsKeeper := tApp.GetAuctionKeeper() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1}) _, addrs := app.GeneratePrivKeyAddressPairs(2) auctions := []types.Auction{ diff --git a/x/auction/keeper/invariants.go b/x/auction/keeper/invariants.go index d83ecbc702..5183670ad8 100644 --- a/x/auction/keeper/invariants.go +++ b/x/auction/keeper/invariants.go @@ -1,9 +1,10 @@ package keeper import ( + storetypes "cosmossdk.io/store/types" "fmt" - "github.com/cosmos/cosmos-sdk/store/prefix" + "cosmossdk.io/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" @@ -34,7 +35,7 @@ func ModuleAccountInvariants(k Keeper) sdk.Invariant { }) moduleAccCoins := k.bankKeeper.GetAllBalances(ctx, authtypes.NewModuleAddress(types.ModuleName)) - broken := !moduleAccCoins.IsEqual(totalAuctionCoins) + broken := !moduleAccCoins.Equal(totalAuctionCoins) invariantMessage := sdk.FormatInvariant( types.ModuleName, @@ -93,7 +94,7 @@ func ValidIndexInvariant(k Keeper) sdk.Invariant { // Check all auction IDs in the index are in the auction store store := prefix.NewStore(ctx.KVStore(k.storeKey), types.AuctionKeyPrefix) - indexIterator := sdk.KVStorePrefixIterator(ctx.KVStore(k.storeKey), types.AuctionByTimeKeyPrefix) + indexIterator := storetypes.KVStorePrefixIterator(ctx.KVStore(k.storeKey), types.AuctionByTimeKeyPrefix) defer indexIterator.Close() var indexLength int @@ -112,7 +113,7 @@ func ValidIndexInvariant(k Keeper) sdk.Invariant { } // Check length of auction store matches the length of the index - storeIterator := sdk.KVStorePrefixIterator(ctx.KVStore(k.storeKey), types.AuctionKeyPrefix) + storeIterator := storetypes.KVStorePrefixIterator(ctx.KVStore(k.storeKey), types.AuctionKeyPrefix) defer storeIterator.Close() var storeLength int for ; storeIterator.Valid(); storeIterator.Next() { diff --git a/x/auction/keeper/keeper.go b/x/auction/keeper/keeper.go index de2744baf8..49c2510825 100644 --- a/x/auction/keeper/keeper.go +++ b/x/auction/keeper/keeper.go @@ -4,13 +4,13 @@ import ( "fmt" "time" + "cosmossdk.io/store/prefix" + storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/store/prefix" - storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - "github.com/cometbft/cometbft/libs/log" + "cosmossdk.io/log" "github.com/kava-labs/kava/x/auction/types" ) @@ -178,7 +178,7 @@ func (k Keeper) IterateAuctionsByTime(ctx sdk.Context, inclusiveCutoffTime time. store := prefix.NewStore(ctx.KVStore(k.storeKey), types.AuctionByTimeKeyPrefix) iterator := store.Iterator( nil, // start at the very start of the prefix store - sdk.PrefixEndBytes(sdk.FormatTimeBytes(inclusiveCutoffTime)), // include any keys with times equal to inclusiveCutoffTime + storetypes.PrefixEndBytes(sdk.FormatTimeBytes(inclusiveCutoffTime)), // include any keys with times equal to inclusiveCutoffTime ) defer iterator.Close() @@ -195,7 +195,7 @@ func (k Keeper) IterateAuctionsByTime(ctx sdk.Context, inclusiveCutoffTime time. // IterateAuctions provides an iterator over all stored auctions. // For each auction, cb will be called. If cb returns true, the iterator will close and stop. func (k Keeper) IterateAuctions(ctx sdk.Context, cb func(auction types.Auction) (stop bool)) { - iterator := sdk.KVStorePrefixIterator(ctx.KVStore(k.storeKey), types.AuctionKeyPrefix) + iterator := storetypes.KVStorePrefixIterator(ctx.KVStore(k.storeKey), types.AuctionKeyPrefix) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { diff --git a/x/auction/keeper/keeper_test.go b/x/auction/keeper/keeper_test.go index 16aab50a0c..13ad20243c 100644 --- a/x/auction/keeper/keeper_test.go +++ b/x/auction/keeper/keeper_test.go @@ -16,7 +16,7 @@ func SetGetDeleteAuction(t *testing.T) { // setup keeper, create auction tApp := app.NewTestApp() keeper := tApp.GetAuctionKeeper() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1}) someTime := time.Date(43, time.January, 1, 0, 0, 0, 0, time.UTC) // need to specify UTC as tz info is lost on unmarshal var id uint64 = 5 @@ -52,7 +52,7 @@ func TestIncrementNextAuctionID(t *testing.T) { // setup keeper tApp := app.NewTestApp() keeper := tApp.GetAuctionKeeper() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1}) // store id var id uint64 = 123456 @@ -71,7 +71,7 @@ func TestIterateAuctions(t *testing.T) { tApp := app.NewTestApp() tApp.InitializeFromGenesisStates() keeper := tApp.GetAuctionKeeper() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1}) auctions := []types.Auction{ types.NewSurplusAuction("sellerMod", c("denom", 12345678), "anotherdenom", time.Date(1998, time.January, 1, 0, 0, 0, 0, time.UTC)).WithID(0), @@ -97,7 +97,7 @@ func TestIterateAuctionsByTime(t *testing.T) { // setup keeper tApp := app.NewTestApp() keeper := tApp.GetAuctionKeeper() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1}) // setup byTime index byTimeIndex := []struct { diff --git a/x/auction/keeper/math.go b/x/auction/keeper/math.go index 032da042ad..a1c8737bf7 100644 --- a/x/auction/keeper/math.go +++ b/x/auction/keeper/math.go @@ -4,7 +4,6 @@ import ( "sort" sdkmath "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" ) // splitIntIntoWeightedBuckets divides an initial +ve integer among several buckets in proportion to the buckets' weights @@ -47,7 +46,7 @@ func splitIntIntoWeightedBuckets(amount sdkmath.Int, buckets []sdkmath.Int) []sd }) // calculate total left over from remainders - allocated := sdk.ZeroInt() + allocated := sdkmath.ZeroInt() for _, qr := range quotients { allocated = allocated.Add(qr.quo) } @@ -58,8 +57,8 @@ func splitIntIntoWeightedBuckets(amount sdkmath.Int, buckets []sdkmath.Int) []sd for _, qr := range quotients { results[qr.index] = qr.quo if !leftToAllocate.IsZero() { - results[qr.index] = results[qr.index].Add(sdk.OneInt()) - leftToAllocate = leftToAllocate.Sub(sdk.OneInt()) + results[qr.index] = results[qr.index].Add(sdkmath.OneInt()) + leftToAllocate = leftToAllocate.Sub(sdkmath.OneInt()) } } return results @@ -73,7 +72,7 @@ type quoRem struct { // totalInts adds together sdk.Ints func totalInts(is ...sdkmath.Int) sdkmath.Int { - total := sdk.ZeroInt() + total := sdkmath.ZeroInt() for _, i := range is { total = total.Add(i) } diff --git a/x/auction/legacy/v0_16/genesis.pb.go b/x/auction/legacy/v0_16/genesis.pb.go index 9971f9b509..1065fbe223 100644 --- a/x/auction/legacy/v0_16/genesis.pb.go +++ b/x/auction/legacy/v0_16/genesis.pb.go @@ -4,10 +4,10 @@ package types import ( + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" _ "github.com/cosmos/cosmos-proto" types "github.com/cosmos/cosmos-sdk/codec/types" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" @@ -75,9 +75,9 @@ var xxx_messageInfo_GenesisState proto.InternalMessageInfo type Params struct { MaxAuctionDuration time.Duration `protobuf:"bytes,1,opt,name=max_auction_duration,json=maxAuctionDuration,proto3,stdduration" json:"max_auction_duration"` BidDuration time.Duration `protobuf:"bytes,2,opt,name=bid_duration,json=bidDuration,proto3,stdduration" json:"bid_duration"` - IncrementSurplus github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=increment_surplus,json=incrementSurplus,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"increment_surplus"` - IncrementDebt github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,4,opt,name=increment_debt,json=incrementDebt,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"increment_debt"` - IncrementCollateral github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,5,opt,name=increment_collateral,json=incrementCollateral,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"increment_collateral"` + IncrementSurplus cosmossdk_io_math.LegacyDec `protobuf:"bytes,3,opt,name=increment_surplus,json=incrementSurplus,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"increment_surplus"` + IncrementDebt cosmossdk_io_math.LegacyDec `protobuf:"bytes,4,opt,name=increment_debt,json=incrementDebt,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"increment_debt"` + IncrementCollateral cosmossdk_io_math.LegacyDec `protobuf:"bytes,5,opt,name=increment_collateral,json=incrementCollateral,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"increment_collateral"` } func (m *Params) Reset() { *m = Params{} } diff --git a/x/auction/module.go b/x/auction/module.go index c18b968b27..5dd71b65c0 100644 --- a/x/auction/module.go +++ b/x/auction/module.go @@ -129,11 +129,18 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // BeginBlock module begin-block -func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { - BeginBlocker(ctx, am.keeper) +func (am AppModule) BeginBlock(ctx context.Context) error { + sdkCtx := sdk.UnwrapSDKContext(ctx) + BeginBlocker(sdkCtx, am.keeper) + + return nil } // EndBlock module end-block -func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - return []abci.ValidatorUpdate{} +func (am AppModule) EndBlock(_ sdk.Context) ([]abci.ValidatorUpdate, error) { + return []abci.ValidatorUpdate{}, nil } + +func (AppModule) IsOnePerModuleType() {} + +func (AppModule) IsAppModule() {} diff --git a/x/auction/spec/02_state.md b/x/auction/spec/02_state.md index 335866e70d..4c3ae962bc 100644 --- a/x/auction/spec/02_state.md +++ b/x/auction/spec/02_state.md @@ -13,9 +13,9 @@ order: 2 type Params struct { MaxAuctionDuration time.Duration `json:"max_auction_duration" yaml:"max_auction_duration"` // max length of auction MaxBidDuration time.Duration `json:"max_bid_duration" yaml:"max_bid_duration"` // additional time added to the auction end time after each bid, capped by the expiry. - IncrementSurplus sdk.Dec `json:"increment_surplus" yaml:"increment_surplus"` // percentage change (of auc.Bid) required for a new bid on a surplus auction - IncrementDebt sdk.Dec `json:"increment_debt" yaml:"increment_debt"` // percentage change (of auc.Lot) required for a new bid on a debt auction - IncrementCollateral sdk.Dec `json:"increment_collateral" yaml:"increment_collateral"` // percentage change (of auc.Bid or auc.Lot) required for a new bid on a collateral auction + IncrementSurplus sdkmath.LegacyDec `json:"increment_surplus" yaml:"increment_surplus"` // percentage change (of auc.Bid) required for a new bid on a surplus auction + IncrementDebt sdkmath.LegacyDec `json:"increment_debt" yaml:"increment_debt"` // percentage change (of auc.Lot) required for a new bid on a debt auction + IncrementCollateral sdkmath.LegacyDec `json:"increment_collateral" yaml:"increment_collateral"` // percentage change (of auc.Bid or auc.Lot) required for a new bid on a collateral auction } ``` diff --git a/x/auction/testutil/suite.go b/x/auction/testutil/suite.go index 104b0a3936..a5ad288d56 100644 --- a/x/auction/testutil/suite.go +++ b/x/auction/testutil/suite.go @@ -1,12 +1,12 @@ package testutil import ( + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" "github.com/stretchr/testify/suite" sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" tmtime "github.com/cometbft/cometbft/types/time" authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" @@ -45,7 +45,7 @@ func (suite *Suite) SetupTest(numAddrs int) { sdk.NewCoin("token2", sdkmath.NewInt(100)), ) - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) modName := "liquidator" modBaseAcc := authtypes.NewBaseAccount(authtypes.NewModuleAddress(modName), nil, 0, 0) diff --git a/x/auction/types/auction.pb.go b/x/auction/types/auction.pb.go index 8e7191d103..6c0a012a67 100644 --- a/x/auction/types/auction.pb.go +++ b/x/auction/types/auction.pb.go @@ -4,6 +4,7 @@ package types import ( + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" _ "github.com/cosmos/cosmos-proto" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" @@ -203,7 +204,7 @@ var xxx_messageInfo_CollateralAuction proto.InternalMessageInfo // WeightedAddresses is a type for storing some addresses and associated weights. type WeightedAddresses struct { Addresses []github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,rep,name=addresses,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"addresses,omitempty"` - Weights []github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,rep,name=weights,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"weights"` + Weights []cosmossdk_io_math.Int `protobuf:"bytes,2,rep,name=weights,proto3,customtype=cosmossdk.io/math.Int" json:"weights"` } func (m *WeightedAddresses) Reset() { *m = WeightedAddresses{} } @@ -252,49 +253,49 @@ func init() { } var fileDescriptor_b9b5dac2c776ef9e = []byte{ - // 657 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x54, 0xcd, 0x6e, 0xd3, 0x4a, - 0x14, 0xce, 0x24, 0xbd, 0x49, 0x3a, 0xae, 0xee, 0x55, 0xe6, 0x56, 0xc8, 0xad, 0x90, 0x1d, 0xba, - 0x80, 0x80, 0x14, 0x5b, 0x2d, 0x1b, 0xc4, 0x06, 0xd5, 0x2d, 0xd0, 0x6e, 0xba, 0x30, 0x48, 0x48, - 0x6c, 0xcc, 0xd8, 0x33, 0x75, 0x46, 0xb5, 0x3d, 0x91, 0x67, 0x52, 0xd2, 0xb7, 0xe8, 0xc3, 0x74, - 0xc5, 0x1e, 0xa9, 0xaa, 0x84, 0x54, 0xb1, 0x42, 0x2c, 0x02, 0xa4, 0x6f, 0xc1, 0x0a, 0x8d, 0x3d, - 0x6e, 0x1b, 0xd1, 0x45, 0x90, 0x60, 0xc1, 0x2a, 0x3e, 0xdf, 0x9c, 0xf3, 0x7d, 0xe7, 0x37, 0x70, - 0xed, 0x00, 0x1f, 0x62, 0x17, 0x8f, 0x22, 0xc9, 0x78, 0xe6, 0x1e, 0xae, 0x87, 0x54, 0xe2, 0xf5, - 0xca, 0x76, 0x86, 0x39, 0x97, 0x1c, 0x2d, 0x2b, 0x1f, 0xa7, 0xc2, 0xb4, 0xcf, 0xaa, 0x15, 0x71, - 0x91, 0x72, 0xe1, 0x86, 0x58, 0xd0, 0xcb, 0xc0, 0x88, 0x33, 0x1d, 0xb5, 0xba, 0x52, 0xbe, 0x07, - 0x85, 0xe5, 0x96, 0x86, 0x7e, 0x5a, 0x8e, 0x79, 0xcc, 0x4b, 0x5c, 0x7d, 0x69, 0xd4, 0x8e, 0x39, - 0x8f, 0x13, 0xea, 0x16, 0x56, 0x38, 0xda, 0x77, 0x25, 0x4b, 0xa9, 0x90, 0x38, 0x1d, 0x96, 0x0e, - 0x6b, 0x1f, 0x1a, 0xd0, 0xf0, 0xb0, 0xa0, 0x9b, 0x65, 0x26, 0xe8, 0x16, 0xac, 0x33, 0x62, 0x82, - 0x2e, 0xe8, 0x2d, 0x78, 0xcd, 0xe9, 0xc4, 0xae, 0xef, 0x6e, 0xfb, 0x75, 0x46, 0xd0, 0x6d, 0xb8, - 0xc8, 0x32, 0x26, 0x19, 0x96, 0x3c, 0x37, 0xeb, 0x5d, 0xd0, 0x5b, 0xf4, 0xaf, 0x00, 0xb4, 0x0e, - 0x1b, 0x09, 0x97, 0x66, 0xa3, 0x0b, 0x7a, 0xc6, 0xc6, 0x8a, 0xa3, 0x13, 0x53, 0x55, 0x54, 0xa5, - 0x39, 0x5b, 0x9c, 0x65, 0xde, 0xc2, 0xe9, 0xc4, 0xae, 0xf9, 0xca, 0x17, 0xbd, 0x81, 0xcd, 0x90, - 0x11, 0x42, 0x73, 0x73, 0xa1, 0x0b, 0x7a, 0x4b, 0xde, 0xce, 0xf7, 0x89, 0xdd, 0x8f, 0x99, 0x1c, - 0x8c, 0x42, 0x27, 0xe2, 0xa9, 0x2e, 0x4e, 0xff, 0xf4, 0x05, 0x39, 0x70, 0xe5, 0xd1, 0x90, 0x0a, - 0x67, 0x33, 0x8a, 0x36, 0x09, 0xc9, 0xa9, 0x10, 0x1f, 0x4f, 0xfa, 0xff, 0x6b, 0x25, 0x8d, 0x78, - 0x47, 0x92, 0x0a, 0x5f, 0xf3, 0xaa, 0xa4, 0x42, 0x46, 0xcc, 0x7f, 0xe6, 0x4c, 0x2a, 0x64, 0x04, - 0x3d, 0x80, 0x9d, 0x01, 0x16, 0x41, 0x4e, 0x23, 0xca, 0x0e, 0x29, 0x09, 0x42, 0x46, 0x84, 0xd9, - 0xec, 0x82, 0x5e, 0xdb, 0xff, 0x6f, 0x80, 0x85, 0xaf, 0x71, 0x8f, 0x11, 0x81, 0x9e, 0xc0, 0x36, - 0xcd, 0x48, 0xa0, 0x1a, 0x6a, 0xb6, 0x0a, 0x8d, 0x55, 0xa7, 0xec, 0xb6, 0x53, 0x75, 0xdb, 0x79, - 0x59, 0x75, 0xdb, 0x6b, 0x2b, 0x91, 0xe3, 0x2f, 0x36, 0xf0, 0x5b, 0x34, 0x23, 0x0a, 0x47, 0xcf, - 0xe0, 0x52, 0x8a, 0xc7, 0xc1, 0x25, 0x49, 0xfb, 0x17, 0x48, 0x60, 0x8a, 0xc7, 0x4f, 0x4b, 0x9e, - 0xc7, 0xc6, 0xd9, 0x49, 0xbf, 0xa5, 0xe7, 0xb7, 0x96, 0xc2, 0x7f, 0x5f, 0x8c, 0xf2, 0x61, 0x32, - 0x12, 0xd5, 0x44, 0xf7, 0xe0, 0x92, 0xaa, 0x39, 0xd0, 0xbb, 0x56, 0xcc, 0xd6, 0xd8, 0xb8, 0xe3, - 0xdc, 0xb4, 0x80, 0xce, 0xb5, 0x55, 0x28, 0xd5, 0xce, 0x27, 0x36, 0xf0, 0x8d, 0xf0, 0x0a, 0x9e, - 0x95, 0x7b, 0x07, 0xa0, 0xb1, 0x4d, 0x43, 0xf9, 0x87, 0xc4, 0xd0, 0x1e, 0x44, 0x11, 0xcf, 0x73, - 0x2a, 0x86, 0x3c, 0x23, 0x2c, 0x8b, 0x03, 0x42, 0x43, 0x59, 0xec, 0xdf, 0x1c, 0x23, 0xed, 0xcc, - 0x84, 0xaa, 0x34, 0x67, 0x93, 0x3f, 0xab, 0xc3, 0xce, 0x16, 0x4f, 0x12, 0x2c, 0x69, 0x8e, 0x93, - 0xbf, 0xa4, 0x04, 0xf4, 0x08, 0xb6, 0xd4, 0xda, 0xa8, 0xd5, 0x9e, 0xf3, 0xde, 0x9a, 0x29, 0x1e, - 0x7b, 0x8c, 0xa0, 0x3d, 0x68, 0x24, 0x5c, 0x06, 0x39, 0x95, 0xa3, 0x3c, 0x13, 0xc5, 0xdd, 0x19, - 0x1b, 0xf7, 0x6e, 0x2e, 0xec, 0x15, 0x65, 0xf1, 0x40, 0x52, 0xa2, 0x2f, 0x8b, 0x0a, 0xcd, 0x05, - 0x13, 0x2e, 0xfd, 0x92, 0x60, 0xb6, 0x99, 0xef, 0x01, 0xec, 0xfc, 0x14, 0x84, 0xf6, 0xe1, 0x22, - 0xae, 0x0c, 0x13, 0x74, 0x1b, 0xbf, 0xf5, 0xd0, 0xaf, 0xa8, 0xd1, 0x0e, 0x6c, 0xbd, 0x2d, 0xc4, - 0x85, 0x59, 0x2f, 0x54, 0x1c, 0x95, 0xed, 0xe7, 0x89, 0x7d, 0x77, 0x0e, 0xa5, 0xdd, 0x4c, 0xfa, - 0x55, 0xb8, 0xf7, 0xfc, 0xf4, 0x9b, 0x55, 0x3b, 0x9d, 0x5a, 0xe0, 0x7c, 0x6a, 0x81, 0xaf, 0x53, - 0x0b, 0x1c, 0x5f, 0x58, 0xb5, 0xf3, 0x0b, 0xab, 0xf6, 0xe9, 0xc2, 0xaa, 0xbd, 0xbe, 0x7f, 0x8d, - 0x4e, 0xf5, 0xad, 0x9f, 0xe0, 0x50, 0x14, 0x5f, 0xee, 0xf8, 0xf2, 0x1f, 0xbf, 0x60, 0x0d, 0x9b, - 0xc5, 0x01, 0x3f, 0xfc, 0x11, 0x00, 0x00, 0xff, 0xff, 0x87, 0x6d, 0x9c, 0x17, 0x0e, 0x06, 0x00, - 0x00, + // 664 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x54, 0xcd, 0x6e, 0xd3, 0x40, + 0x10, 0xce, 0x26, 0x25, 0x49, 0xd7, 0x15, 0x28, 0x4b, 0x41, 0x6e, 0x05, 0x76, 0xe8, 0x85, 0x80, + 0x14, 0x5b, 0x2d, 0x07, 0x10, 0x17, 0x54, 0xb7, 0xfc, 0xf4, 0xd2, 0x83, 0x41, 0x42, 0xe2, 0x62, + 0xd6, 0xde, 0xad, 0xb3, 0xaa, 0xed, 0x8d, 0xbc, 0x9b, 0x92, 0xbe, 0x45, 0x1f, 0xa6, 0x27, 0x9e, + 0xa0, 0xaa, 0x84, 0x54, 0x71, 0x42, 0x1c, 0x02, 0xa4, 0x6f, 0xc1, 0x09, 0xad, 0xbd, 0x6e, 0x1b, + 0xd1, 0x43, 0x91, 0xe0, 0xc0, 0x29, 0x9e, 0x6f, 0x67, 0xe6, 0xfb, 0xe6, 0x2f, 0x70, 0x65, 0x17, + 0xef, 0x61, 0x17, 0x8f, 0x22, 0xc9, 0x78, 0xe6, 0xee, 0xad, 0x86, 0x54, 0xe2, 0xd5, 0xca, 0x76, + 0x86, 0x39, 0x97, 0x1c, 0x2d, 0x2a, 0x1f, 0xa7, 0xc2, 0xb4, 0xcf, 0xb2, 0x15, 0x71, 0x91, 0x72, + 0xe1, 0x86, 0x58, 0xd0, 0xb3, 0xc0, 0x88, 0x33, 0x1d, 0xb5, 0xbc, 0x54, 0xbe, 0x07, 0x85, 0xe5, + 0x96, 0x86, 0x7e, 0x5a, 0x8c, 0x79, 0xcc, 0x4b, 0x5c, 0x7d, 0x69, 0xd4, 0x8e, 0x39, 0x8f, 0x13, + 0xea, 0x16, 0x56, 0x38, 0xda, 0x71, 0x25, 0x4b, 0xa9, 0x90, 0x38, 0x1d, 0x96, 0x0e, 0x2b, 0x9f, + 0x1a, 0xd0, 0xf0, 0xb0, 0xa0, 0xeb, 0xa5, 0x12, 0x74, 0x1b, 0xd6, 0x19, 0x31, 0x41, 0x17, 0xf4, + 0xe6, 0xbc, 0xe6, 0x74, 0x62, 0xd7, 0xb7, 0x36, 0xfd, 0x3a, 0x23, 0xe8, 0x0e, 0x9c, 0x67, 0x19, + 0x93, 0x0c, 0x4b, 0x9e, 0x9b, 0xf5, 0x2e, 0xe8, 0xcd, 0xfb, 0xe7, 0x00, 0x5a, 0x85, 0x8d, 0x84, + 0x4b, 0xb3, 0xd1, 0x05, 0x3d, 0x63, 0x6d, 0xc9, 0xd1, 0xc2, 0x54, 0x15, 0x55, 0x69, 0xce, 0x06, + 0x67, 0x99, 0x37, 0x77, 0x34, 0xb1, 0x6b, 0xbe, 0xf2, 0x45, 0xef, 0x61, 0x33, 0x64, 0x84, 0xd0, + 0xdc, 0x9c, 0xeb, 0x82, 0xde, 0x82, 0xf7, 0xea, 0xe7, 0xc4, 0xee, 0xc7, 0x4c, 0x0e, 0x46, 0xa1, + 0x13, 0xf1, 0x54, 0x17, 0xa7, 0x7f, 0xfa, 0x82, 0xec, 0xba, 0x72, 0x7f, 0x48, 0x85, 0xb3, 0x1e, + 0x45, 0xeb, 0x84, 0xe4, 0x54, 0x88, 0xcf, 0x87, 0xfd, 0x9b, 0x9a, 0x49, 0x23, 0xde, 0xbe, 0xa4, + 0xc2, 0xd7, 0x79, 0x95, 0xa8, 0x90, 0x11, 0xf3, 0xda, 0x15, 0x45, 0x85, 0x8c, 0xa0, 0x87, 0xb0, + 0x33, 0xc0, 0x22, 0xc8, 0x69, 0x44, 0xd9, 0x1e, 0x25, 0x41, 0xc8, 0x88, 0x30, 0x9b, 0x5d, 0xd0, + 0x6b, 0xfb, 0x37, 0x06, 0x58, 0xf8, 0x1a, 0xf7, 0x18, 0x11, 0xe8, 0x19, 0x6c, 0xd3, 0x8c, 0x04, + 0xaa, 0xa1, 0x66, 0xab, 0xe0, 0x58, 0x76, 0xca, 0x6e, 0x3b, 0x55, 0xb7, 0x9d, 0x37, 0x55, 0xb7, + 0xbd, 0xb6, 0x22, 0x39, 0xf8, 0x66, 0x03, 0xbf, 0x45, 0x33, 0xa2, 0x70, 0xf4, 0x02, 0x2e, 0xa4, + 0x78, 0x1c, 0x9c, 0x25, 0x69, 0xff, 0x41, 0x12, 0x98, 0xe2, 0xf1, 0xf3, 0x32, 0xcf, 0x53, 0xe3, + 0xf8, 0xb0, 0xdf, 0xd2, 0xf3, 0x5b, 0x49, 0xe1, 0xf5, 0xd7, 0xa3, 0x7c, 0x98, 0x8c, 0x44, 0x35, + 0xd1, 0x6d, 0xb8, 0xa0, 0x6a, 0x0e, 0xf4, 0xae, 0x15, 0xb3, 0x35, 0xd6, 0xee, 0x39, 0x97, 0x2d, + 0xa0, 0x73, 0x61, 0x15, 0x4a, 0xb6, 0x93, 0x89, 0x0d, 0x7c, 0x23, 0x3c, 0x87, 0x67, 0xe9, 0x3e, + 0x02, 0x68, 0x6c, 0xd2, 0x50, 0xfe, 0x23, 0x32, 0xb4, 0x0d, 0x51, 0xc4, 0xf3, 0x9c, 0x8a, 0x21, + 0xcf, 0x08, 0xcb, 0xe2, 0x80, 0xd0, 0x50, 0x16, 0xfb, 0x77, 0x85, 0x91, 0x76, 0x66, 0x42, 0x95, + 0xcc, 0x59, 0xf1, 0xc7, 0x75, 0xd8, 0xd9, 0xe0, 0x49, 0x82, 0x25, 0xcd, 0x71, 0xf2, 0x9f, 0x94, + 0x80, 0x9e, 0xc0, 0x96, 0x5a, 0x1b, 0xb5, 0xda, 0x57, 0xbc, 0xb7, 0x66, 0x8a, 0xc7, 0x1e, 0x23, + 0x68, 0x1b, 0x1a, 0x09, 0x97, 0x41, 0x4e, 0xe5, 0x28, 0xcf, 0x44, 0x71, 0x77, 0xc6, 0xda, 0xfd, + 0xcb, 0x0b, 0x7b, 0x4b, 0x59, 0x3c, 0x90, 0x94, 0xe8, 0xcb, 0xa2, 0x42, 0xe7, 0x82, 0x09, 0x97, + 0x7e, 0x99, 0x60, 0xb6, 0x99, 0x87, 0x00, 0x76, 0x7e, 0x0b, 0x42, 0x3b, 0x70, 0x1e, 0x57, 0x86, + 0x09, 0xba, 0x8d, 0xbf, 0x7a, 0xe8, 0xe7, 0xa9, 0xd1, 0x63, 0xd8, 0xfa, 0x50, 0x90, 0x0b, 0xb3, + 0x5e, 0xb0, 0xdc, 0x55, 0x6a, 0xbf, 0x4e, 0xec, 0x5b, 0x65, 0xa0, 0x20, 0xbb, 0x0e, 0xe3, 0x6e, + 0x8a, 0xe5, 0xc0, 0xd9, 0xca, 0xa4, 0x5f, 0x79, 0x7b, 0x2f, 0x8f, 0x7e, 0x58, 0xb5, 0xa3, 0xa9, + 0x05, 0x4e, 0xa6, 0x16, 0xf8, 0x3e, 0xb5, 0xc0, 0xc1, 0xa9, 0x55, 0x3b, 0x39, 0xb5, 0x6a, 0x5f, + 0x4e, 0xad, 0xda, 0xbb, 0x07, 0x17, 0x74, 0xaa, 0x36, 0xf5, 0x13, 0x1c, 0x8a, 0xe2, 0xcb, 0x1d, + 0x9f, 0xfd, 0xc1, 0x17, 0x72, 0xc3, 0x66, 0x71, 0xaf, 0x8f, 0x7e, 0x05, 0x00, 0x00, 0xff, 0xff, + 0x3a, 0x52, 0x1c, 0x68, 0xfd, 0x05, 0x00, 0x00, } func (m *BaseAuction) Marshal() (dAtA []byte, err error) { @@ -1438,7 +1439,7 @@ func (m *WeightedAddresses) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - var v github_com_cosmos_cosmos_sdk_types.Int + var v cosmossdk_io_math.Int m.Weights = append(m.Weights, v) if err := m.Weights[len(m.Weights)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err diff --git a/x/auction/types/auctions.go b/x/auction/types/auctions.go index 73fcb9cf02..0271b6373f 100644 --- a/x/auction/types/auctions.go +++ b/x/auction/types/auctions.go @@ -272,7 +272,7 @@ func (wa WeightedAddresses) Validate() error { return fmt.Errorf("number of addresses doesn't match number of weights, %d ≠ %d", len(wa.Addresses), len(wa.Weights)) } - totalWeight := sdk.ZeroInt() + totalWeight := sdkmath.ZeroInt() for i := range wa.Addresses { if wa.Addresses[i].Empty() { return fmt.Errorf("address %d cannot be empty", i) diff --git a/x/auction/types/auctions_test.go b/x/auction/types/auctions_test.go index 99476bf958..8ea205afec 100644 --- a/x/auction/types/auctions_test.go +++ b/x/auction/types/auctions_test.go @@ -29,7 +29,7 @@ func init() { sdk.GetConfig().SetBech32PrefixForAccount("kava", "kava"+sdk.PrefixPublic) } -func d(amount string) sdk.Dec { return sdk.MustNewDecFromStr(amount) } +func d(amount string) sdkmath.LegacyDec { return sdkmath.LegacyMustNewDecFromStr(amount) } func c(denom string, amount int64) sdk.Coin { return sdk.NewInt64Coin(denom, amount) } func i(n int64) sdkmath.Int { return sdkmath.NewInt(n) } func is(ns ...int64) (is []sdkmath.Int) { diff --git a/x/auction/types/codec.go b/x/auction/types/codec.go index 3e33b9ca8b..47ea8d5680 100644 --- a/x/auction/types/codec.go +++ b/x/auction/types/codec.go @@ -6,7 +6,6 @@ import ( cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" - authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec" ) // RegisterLegacyAminoCodec registers all the necessary types and interfaces for the @@ -61,5 +60,5 @@ func init() { // Register all Amino interfaces and concrete types on the authz Amino codec so that this can later be // used to properly serialize MsgGrant and MsgExec instances - RegisterLegacyAminoCodec(authzcodec.Amino) + RegisterLegacyAminoCodec(codec.NewLegacyAmino()) } diff --git a/x/auction/types/expected_keepers.go b/x/auction/types/expected_keepers.go index b7d65ea439..1272ebc2c2 100644 --- a/x/auction/types/expected_keepers.go +++ b/x/auction/types/expected_keepers.go @@ -1,22 +1,22 @@ package types import ( + "context" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/auth/types" ) // AccountKeeper expected interface for the account keeper (noalias) type AccountKeeper interface { - GetAccount(ctx sdk.Context, addr sdk.AccAddress) types.AccountI - GetModuleAccount(ctx sdk.Context, name string) types.ModuleAccountI + GetAccount(ctx context.Context, addr sdk.AccAddress) sdk.AccountI + GetModuleAccount(ctx context.Context, name string) sdk.ModuleAccountI } // BankKeeper defines the expected interface needed to send coins type BankKeeper interface { - SendCoinsFromModuleToModule(ctx sdk.Context, sender, recipient string, amt sdk.Coins) error - SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error - SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error - BurnCoins(ctx sdk.Context, name string, amt sdk.Coins) error - MintCoins(ctx sdk.Context, name string, amt sdk.Coins) error - GetAllBalances(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins + SendCoinsFromModuleToModule(ctx context.Context, sender, recipient string, amt sdk.Coins) error + SendCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error + SendCoinsFromAccountToModule(ctx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error + BurnCoins(ctx context.Context, name string, amt sdk.Coins) error + MintCoins(ctx context.Context, name string, amt sdk.Coins) error + GetAllBalances(ctx context.Context, addr sdk.AccAddress) sdk.Coins } diff --git a/x/auction/types/genesis.pb.go b/x/auction/types/genesis.pb.go index d47b786a80..13c27ec38f 100644 --- a/x/auction/types/genesis.pb.go +++ b/x/auction/types/genesis.pb.go @@ -4,10 +4,10 @@ package types import ( + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" _ "github.com/cosmos/cosmos-proto" types "github.com/cosmos/cosmos-sdk/codec/types" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" github_com_cosmos_gogoproto_types "github.com/cosmos/gogoproto/types" @@ -73,12 +73,12 @@ var xxx_messageInfo_GenesisState proto.InternalMessageInfo // Params defines the parameters for the issuance module. type Params struct { - MaxAuctionDuration time.Duration `protobuf:"bytes,1,opt,name=max_auction_duration,json=maxAuctionDuration,proto3,stdduration" json:"max_auction_duration"` - ForwardBidDuration time.Duration `protobuf:"bytes,6,opt,name=forward_bid_duration,json=forwardBidDuration,proto3,stdduration" json:"forward_bid_duration"` - ReverseBidDuration time.Duration `protobuf:"bytes,7,opt,name=reverse_bid_duration,json=reverseBidDuration,proto3,stdduration" json:"reverse_bid_duration"` - IncrementSurplus github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=increment_surplus,json=incrementSurplus,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"increment_surplus"` - IncrementDebt github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,4,opt,name=increment_debt,json=incrementDebt,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"increment_debt"` - IncrementCollateral github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,5,opt,name=increment_collateral,json=incrementCollateral,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"increment_collateral"` + MaxAuctionDuration time.Duration `protobuf:"bytes,1,opt,name=max_auction_duration,json=maxAuctionDuration,proto3,stdduration" json:"max_auction_duration"` + ForwardBidDuration time.Duration `protobuf:"bytes,6,opt,name=forward_bid_duration,json=forwardBidDuration,proto3,stdduration" json:"forward_bid_duration"` + ReverseBidDuration time.Duration `protobuf:"bytes,7,opt,name=reverse_bid_duration,json=reverseBidDuration,proto3,stdduration" json:"reverse_bid_duration"` + IncrementSurplus cosmossdk_io_math.LegacyDec `protobuf:"bytes,3,opt,name=increment_surplus,json=incrementSurplus,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"increment_surplus"` + IncrementDebt cosmossdk_io_math.LegacyDec `protobuf:"bytes,4,opt,name=increment_debt,json=incrementDebt,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"increment_debt"` + IncrementCollateral cosmossdk_io_math.LegacyDec `protobuf:"bytes,5,opt,name=increment_collateral,json=incrementCollateral,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"increment_collateral"` } func (m *Params) Reset() { *m = Params{} } @@ -124,38 +124,39 @@ func init() { } var fileDescriptor_d0e5cb58293042f7 = []byte{ - // 496 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x93, 0xc1, 0x6e, 0xd3, 0x30, - 0x18, 0xc7, 0x93, 0x35, 0x94, 0xca, 0xed, 0xc6, 0x30, 0x39, 0xa4, 0x13, 0x4a, 0xab, 0x1e, 0xa6, - 0x72, 0xa8, 0xa3, 0x95, 0x1b, 0xb7, 0x85, 0x4a, 0x13, 0x9c, 0x50, 0xa6, 0x5d, 0xe0, 0x10, 0x39, - 0x89, 0x17, 0xa2, 0x25, 0x71, 0x65, 0x3b, 0xa5, 0x7d, 0x0b, 0x8e, 0x3c, 0x08, 0x87, 0x3d, 0x42, - 0xc5, 0x69, 0x47, 0xc4, 0x61, 0x40, 0xfb, 0x22, 0x28, 0x8e, 0x9b, 0x16, 0xd8, 0x65, 0x3b, 0xd5, - 0xfe, 0xbe, 0xff, 0xf7, 0xfb, 0xff, 0xed, 0x3a, 0x60, 0x70, 0x85, 0x67, 0xd8, 0xc1, 0x45, 0x28, - 0x12, 0x9a, 0x3b, 0xb3, 0x93, 0x80, 0x08, 0x7c, 0xe2, 0xc4, 0x24, 0x27, 0x3c, 0xe1, 0x68, 0xca, - 0xa8, 0xa0, 0xd0, 0x2c, 0x35, 0x48, 0x69, 0x90, 0xd2, 0x1c, 0x75, 0x43, 0xca, 0x33, 0xca, 0x7d, - 0xa9, 0x71, 0xaa, 0x4d, 0x35, 0x70, 0x64, 0xc6, 0x34, 0xa6, 0x55, 0xbd, 0x5c, 0xa9, 0x6a, 0x37, - 0xa6, 0x34, 0x4e, 0x89, 0x23, 0x77, 0x41, 0x71, 0xe9, 0xe0, 0x7c, 0xa1, 0x5a, 0xf6, 0xbf, 0xad, - 0xa8, 0x60, 0x58, 0xba, 0xc9, 0xca, 0xe0, 0x5a, 0x07, 0x9d, 0xb3, 0x2a, 0xd3, 0xb9, 0xc0, 0x82, - 0xc0, 0x63, 0xf0, 0x24, 0x27, 0x73, 0xe1, 0xab, 0x50, 0x7e, 0x12, 0x59, 0x7a, 0x5f, 0x1f, 0x1a, - 0xde, 0x7e, 0x59, 0x3e, 0xad, 0xaa, 0x6f, 0x22, 0xf8, 0x0a, 0x34, 0xa7, 0x98, 0xe1, 0x8c, 0x5b, - 0x7b, 0x7d, 0x7d, 0xd8, 0x1e, 0x3f, 0x47, 0x77, 0x9d, 0x05, 0xbd, 0x93, 0x1a, 0xd7, 0x58, 0xde, - 0xf6, 0x34, 0x4f, 0x4d, 0xc0, 0x09, 0x68, 0x29, 0x1d, 0xb7, 0x1a, 0xfd, 0xc6, 0xb0, 0x3d, 0x36, - 0x51, 0x95, 0x13, 0x6d, 0x72, 0xa2, 0xd3, 0x7c, 0xe1, 0xc2, 0x6f, 0x5f, 0x47, 0x07, 0x2a, 0x9d, - 0x72, 0xf6, 0xea, 0xc9, 0xc1, 0xb5, 0x01, 0x9a, 0x15, 0x1e, 0x5e, 0x00, 0x33, 0xc3, 0xf3, 0x3a, - 0xf3, 0xe6, 0x8c, 0x32, 0x79, 0x7b, 0xdc, 0xfd, 0x0f, 0x3e, 0x51, 0x02, 0xb7, 0x55, 0xe6, 0xfa, - 0xf2, 0xb3, 0xa7, 0x7b, 0x30, 0xc3, 0x73, 0xe5, 0xb1, 0xe9, 0x96, 0xd8, 0x4b, 0xca, 0x3e, 0x61, - 0x16, 0xf9, 0x41, 0x12, 0x6d, 0xb1, 0xcd, 0x7b, 0x60, 0x15, 0xc0, 0x4d, 0xa2, 0x5d, 0x2c, 0x23, - 0x33, 0xc2, 0x38, 0xf9, 0x1b, 0xfb, 0xf8, 0x1e, 0x58, 0x05, 0xd8, 0xc5, 0x7e, 0x00, 0x4f, 0x93, - 0x3c, 0x64, 0x24, 0x23, 0xb9, 0xf0, 0x79, 0xc1, 0xa6, 0x69, 0x51, 0x5e, 0xaf, 0x3e, 0xec, 0xb8, - 0xa8, 0x1c, 0xfc, 0x71, 0xdb, 0x3b, 0x8e, 0x13, 0xf1, 0xb1, 0x08, 0x50, 0x48, 0x33, 0xf5, 0xae, - 0xd4, 0xcf, 0x88, 0x47, 0x57, 0x8e, 0x58, 0x4c, 0x09, 0x47, 0x13, 0x12, 0x7a, 0x87, 0x35, 0xe8, - 0xbc, 0xe2, 0xc0, 0x0b, 0x70, 0xb0, 0x85, 0x47, 0x24, 0x10, 0x96, 0xf1, 0x20, 0xf2, 0x7e, 0x4d, - 0x99, 0x90, 0x40, 0x40, 0x0c, 0xcc, 0x2d, 0x36, 0xa4, 0x69, 0x8a, 0x05, 0x61, 0x38, 0xb5, 0x1e, - 0x3d, 0x08, 0xfe, 0xac, 0x66, 0xbd, 0xae, 0x51, 0x6f, 0x8d, 0xd6, 0xde, 0x61, 0xc3, 0xeb, 0xec, - 0xde, 0xb4, 0x7b, 0xb6, 0xfc, 0x6d, 0x6b, 0xcb, 0x95, 0xad, 0xdf, 0xac, 0x6c, 0xfd, 0xd7, 0xca, - 0xd6, 0x3f, 0xaf, 0x6d, 0xed, 0x66, 0x6d, 0x6b, 0xdf, 0xd7, 0xb6, 0xf6, 0xfe, 0xc5, 0x8e, 0x5d, - 0xf9, 0xa8, 0x47, 0x29, 0x0e, 0xb8, 0x5c, 0x39, 0xf3, 0xfa, 0x83, 0x96, 0xae, 0x41, 0x53, 0xfe, - 0x49, 0x2f, 0xff, 0x04, 0x00, 0x00, 0xff, 0xff, 0xe6, 0x34, 0x3b, 0x9f, 0xed, 0x03, 0x00, 0x00, + // 504 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x93, 0x4f, 0x6f, 0xd3, 0x3e, + 0x18, 0xc7, 0x93, 0x35, 0xbf, 0xfe, 0x2a, 0xb7, 0x1b, 0x23, 0xe4, 0x90, 0x0e, 0x94, 0x56, 0x45, + 0x42, 0xe5, 0x30, 0x5b, 0x2b, 0x37, 0x6e, 0x0b, 0x95, 0x26, 0x26, 0x0e, 0x53, 0x26, 0x38, 0x70, + 0x89, 0x9c, 0xc4, 0xcb, 0xa2, 0x25, 0x71, 0x65, 0x3b, 0xa5, 0x7d, 0x17, 0xdc, 0xe0, 0x85, 0x70, + 0xe0, 0x25, 0x54, 0x9c, 0x76, 0x44, 0x1c, 0x06, 0xb4, 0x6f, 0x04, 0x25, 0x76, 0xd3, 0xf2, 0xe7, + 0xb0, 0xdd, 0xec, 0xe7, 0xf9, 0x7e, 0x3f, 0xcf, 0xd7, 0x8e, 0x03, 0x06, 0x57, 0x78, 0x8a, 0x11, + 0x2e, 0x42, 0x91, 0xd0, 0x1c, 0x4d, 0x8f, 0x02, 0x22, 0xf0, 0x11, 0x8a, 0x49, 0x4e, 0x78, 0xc2, + 0xe1, 0x84, 0x51, 0x41, 0x4d, 0xab, 0xd4, 0x40, 0xa5, 0x81, 0x4a, 0x73, 0xd0, 0x0d, 0x29, 0xcf, + 0x28, 0xf7, 0x2b, 0x0d, 0x92, 0x1b, 0x69, 0x38, 0xb0, 0x62, 0x1a, 0x53, 0x59, 0x2f, 0x57, 0xaa, + 0xda, 0x8d, 0x29, 0x8d, 0x53, 0x82, 0xaa, 0x5d, 0x50, 0x5c, 0x20, 0x9c, 0xcf, 0x55, 0xcb, 0xf9, + 0xb3, 0x15, 0x15, 0x0c, 0x57, 0xd3, 0xaa, 0xca, 0xe0, 0xb3, 0x0e, 0x3a, 0x27, 0x32, 0xd3, 0xb9, + 0xc0, 0x82, 0x98, 0x4f, 0xc0, 0xbd, 0x9c, 0xcc, 0x84, 0xaf, 0x42, 0xf9, 0x49, 0x64, 0xeb, 0x7d, + 0x7d, 0x68, 0x78, 0xbb, 0x65, 0xf9, 0x58, 0x56, 0x5f, 0x46, 0xe6, 0x73, 0xd0, 0x9c, 0x60, 0x86, + 0x33, 0x6e, 0xef, 0xf4, 0xf5, 0x61, 0x7b, 0xf4, 0x08, 0xfe, 0xeb, 0x2c, 0xf0, 0xac, 0xd2, 0xb8, + 0xc6, 0xe2, 0xa6, 0xa7, 0x79, 0xca, 0x61, 0x8e, 0x41, 0x4b, 0xe9, 0xb8, 0xdd, 0xe8, 0x37, 0x86, + 0xed, 0x91, 0x05, 0x65, 0x4e, 0xb8, 0xce, 0x09, 0x8f, 0xf3, 0xb9, 0x6b, 0x7e, 0xf9, 0x74, 0xb8, + 0xa7, 0xd2, 0xa9, 0xc9, 0x5e, 0xed, 0x1c, 0x7c, 0x30, 0x40, 0x53, 0xe2, 0xcd, 0xd7, 0xc0, 0xca, + 0xf0, 0xac, 0xce, 0xbc, 0x3e, 0x63, 0x95, 0xbc, 0x3d, 0xea, 0xfe, 0x05, 0x1f, 0x2b, 0x81, 0xdb, + 0x2a, 0x73, 0x7d, 0xfc, 0xde, 0xd3, 0x3d, 0x33, 0xc3, 0x33, 0x35, 0x63, 0xdd, 0x2d, 0xb1, 0x17, + 0x94, 0xbd, 0xc3, 0x2c, 0xf2, 0x83, 0x24, 0xda, 0x60, 0x9b, 0x77, 0xc0, 0x2a, 0x80, 0x9b, 0x44, + 0xdb, 0x58, 0x46, 0xa6, 0x84, 0x71, 0xf2, 0x3b, 0xf6, 0xff, 0x3b, 0x60, 0x15, 0x60, 0x1b, 0x7b, + 0x06, 0xee, 0x27, 0x79, 0xc8, 0x48, 0x46, 0x72, 0xe1, 0xf3, 0x82, 0x4d, 0xd2, 0xa2, 0xbc, 0x5e, + 0x7d, 0xd8, 0x71, 0x1f, 0x97, 0xc6, 0x6f, 0x37, 0xbd, 0x87, 0xf2, 0x31, 0xf1, 0xe8, 0x0a, 0x26, + 0x14, 0x65, 0x58, 0x5c, 0xc2, 0x57, 0x24, 0xc6, 0xe1, 0x7c, 0x4c, 0x42, 0x6f, 0xbf, 0x76, 0x9f, + 0x4b, 0xb3, 0x79, 0x0a, 0xf6, 0x36, 0xc4, 0x88, 0x04, 0xc2, 0x36, 0x6e, 0x8f, 0xdb, 0xad, 0xad, + 0x63, 0x12, 0x08, 0xf3, 0x0d, 0xb0, 0x36, 0xac, 0x90, 0xa6, 0x29, 0x16, 0x84, 0xe1, 0xd4, 0xfe, + 0xef, 0xf6, 0xc4, 0x07, 0x35, 0xe0, 0x45, 0xed, 0x3f, 0x35, 0x5a, 0x3b, 0xfb, 0x0d, 0xaf, 0xb3, + 0x7d, 0x91, 0xee, 0xc9, 0xe2, 0xa7, 0xa3, 0x2d, 0x96, 0x8e, 0x7e, 0xbd, 0x74, 0xf4, 0x1f, 0x4b, + 0x47, 0x7f, 0xbf, 0x72, 0xb4, 0xeb, 0x95, 0xa3, 0x7d, 0x5d, 0x39, 0xda, 0xdb, 0xa7, 0x71, 0x22, + 0x2e, 0x8b, 0x00, 0x86, 0x34, 0x43, 0xe5, 0x9b, 0x3d, 0x4c, 0x71, 0xc0, 0xab, 0x15, 0x9a, 0xd5, + 0xff, 0xab, 0x98, 0x4f, 0x08, 0x0f, 0x9a, 0xd5, 0x37, 0x78, 0xf6, 0x2b, 0x00, 0x00, 0xff, 0xff, + 0x30, 0xdb, 0xae, 0xf5, 0xcc, 0x03, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { diff --git a/x/auction/types/genesis_test.go b/x/auction/types/genesis_test.go index 5ab0c182d6..d663ab3183 100644 --- a/x/auction/types/genesis_test.go +++ b/x/auction/types/genesis_test.go @@ -37,7 +37,7 @@ func TestGenesisState_Validate(t *testing.T) { MaxBid: sdk.NewInt64Coin("usdx", 5e4), LotReturns: WeightedAddresses{ Addresses: []sdk.AccAddress{sdk.AccAddress("test return address")}, - Weights: []sdkmath.Int{sdk.OneInt()}, + Weights: []sdkmath.Int{sdkmath.OneInt()}, }, } diff --git a/x/auction/types/params.go b/x/auction/types/params.go index eca7900fb0..c45e4e16e5 100644 --- a/x/auction/types/params.go +++ b/x/auction/types/params.go @@ -1,15 +1,15 @@ package types import ( + sdkmath "cosmossdk.io/math" "errors" "fmt" "time" - sdk "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" ) -var emptyDec = sdk.Dec{} +var emptyDec = sdkmath.LegacyDec{} // Defaults for auction params const ( @@ -23,7 +23,7 @@ const ( var ( // DefaultIncrement is the smallest percent change a new bid must have from the old one - DefaultIncrement sdk.Dec = sdk.MustNewDecFromStr("0.05") + DefaultIncrement sdkmath.LegacyDec = sdkmath.LegacyMustNewDecFromStr("0.05") // ParamStoreKeyParams Param store key for auction params KeyForwardBidDuration = []byte("ForwardBidDuration") KeyReverseBidDuration = []byte("ReverseBidDuration") @@ -38,7 +38,7 @@ func NewParams( maxAuctionDuration, forwardBidDuration, reverseBidDuration time.Duration, incrementSurplus, incrementDebt, - incrementCollateral sdk.Dec, + incrementCollateral sdkmath.LegacyDec, ) Params { return Params{ MaxAuctionDuration: maxAuctionDuration, @@ -139,7 +139,7 @@ func validateMaxAuctionDurationParam(i interface{}) error { } func validateIncrementSurplusParam(i interface{}) error { - incrementSurplus, ok := i.(sdk.Dec) + incrementSurplus, ok := i.(sdkmath.LegacyDec) if !ok { return fmt.Errorf("invalid parameter type: %T", i) } @@ -156,7 +156,7 @@ func validateIncrementSurplusParam(i interface{}) error { } func validateIncrementDebtParam(i interface{}) error { - incrementDebt, ok := i.(sdk.Dec) + incrementDebt, ok := i.(sdkmath.LegacyDec) if !ok { return fmt.Errorf("invalid parameter type: %T", i) } @@ -173,7 +173,7 @@ func validateIncrementDebtParam(i interface{}) error { } func validateIncrementCollateralParam(i interface{}) error { - incrementCollateral, ok := i.(sdk.Dec) + incrementCollateral, ok := i.(sdkmath.LegacyDec) if !ok { return fmt.Errorf("invalid parameter type: %T", i) } diff --git a/x/auction/types/query.pb.go b/x/auction/types/query.pb.go index 7a6f901497..bed67c24fd 100644 --- a/x/auction/types/query.pb.go +++ b/x/auction/types/query.pb.go @@ -603,6 +603,7 @@ func _Query_NextAuctionID_Handler(srv interface{}, ctx context.Context, dec func return interceptor(ctx, in, info, handler) } +var Query_serviceDesc = _Query_serviceDesc var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "kava.auction.v1beta1.Query", HandlerType: (*QueryServer)(nil), diff --git a/x/auction/types/tx.pb.go b/x/auction/types/tx.pb.go index 2853a56f9a..dd84a6841c 100644 --- a/x/auction/types/tx.pb.go +++ b/x/auction/types/tx.pb.go @@ -206,6 +206,7 @@ func _Msg_PlaceBid_Handler(srv interface{}, ctx context.Context, dec func(interf return interceptor(ctx, in, info, handler) } +var Msg_serviceDesc = _Msg_serviceDesc var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "kava.auction.v1beta1.Msg", HandlerType: (*MsgServer)(nil), diff --git a/x/bep3/abci_test.go b/x/bep3/abci_test.go index a0a5116309..74d58e4de0 100644 --- a/x/bep3/abci_test.go +++ b/x/bep3/abci_test.go @@ -29,7 +29,7 @@ type ABCITestSuite struct { func (suite *ABCITestSuite) SetupTest() { tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) // Set up auth GenesisState _, addrs := app.GeneratePrivKeyAddressPairs(12) diff --git a/x/bep3/genesis_test.go b/x/bep3/genesis_test.go index c1eb3a158d..4450aae479 100644 --- a/x/bep3/genesis_test.go +++ b/x/bep3/genesis_test.go @@ -4,6 +4,7 @@ import ( "testing" "cosmossdk.io/math" + sdkmath "cosmossdk.io/math" tmproto "github.com/cometbft/cometbft/proto/tendermint/types" tmtime "github.com/cometbft/cometbft/types/time" sdk "github.com/cosmos/cosmos-sdk/types" @@ -29,7 +30,7 @@ func (suite *GenesisTestSuite) SetupTest() { app.SetBech32AddressPrefixes(config) tApp := app.NewTestApp() - suite.ctx = tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + suite.ctx = tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) suite.keeper = tApp.GetBep3Keeper() suite.app = tApp @@ -116,7 +117,7 @@ func (suite *GenesisTestSuite) TestGenesisState() { name: "0 deputy fees", genState: func() app.GenesisState { gs := baseGenState(suite.addrs[0]) - gs.Params.AssetParams[0].FixedFee = sdk.ZeroInt() + gs.Params.AssetParams[0].FixedFee = sdkmath.ZeroInt() return app.GenesisState{types.ModuleName: cdc.MustMarshalJSON(&gs)} }, expectPass: true, diff --git a/x/bep3/integration_test.go b/x/bep3/integration_test.go index 332dad7037..183133f843 100644 --- a/x/bep3/integration_test.go +++ b/x/bep3/integration_test.go @@ -26,7 +26,7 @@ var ( ) func i(in int64) sdkmath.Int { return sdkmath.NewInt(in) } -func d(de int64) sdk.Dec { return sdk.NewDec(de) } +func d(de int64) sdkmath.LegacyDec { return sdkmath.LegacyNewDec(de) } func c(denom string, amount int64) sdk.Coin { return sdk.NewInt64Coin(denom, amount) } func cs(coins ...sdk.Coin) sdk.Coins { return sdk.NewCoins(coins...) } func ts(minOffset int) int64 { return tmtime.Now().Add(time.Duration(minOffset) * time.Minute).Unix() } @@ -46,13 +46,13 @@ func baseGenState(deputy sdk.AccAddress) types.GenesisState { SupplyLimit: types.SupplyLimit{ Limit: sdkmath.NewInt(350000000000000), TimeLimited: false, - TimeBasedLimit: sdk.ZeroInt(), + TimeBasedLimit: sdkmath.ZeroInt(), TimePeriod: time.Hour, }, Active: true, DeputyAddress: deputy, FixedFee: sdkmath.NewInt(1000), - MinSwapAmount: sdk.OneInt(), + MinSwapAmount: sdkmath.OneInt(), MaxSwapAmount: sdkmath.NewInt(1000000000000), MinBlockLock: types.DefaultMinBlockLock, MaxBlockLock: types.DefaultMaxBlockLock, @@ -63,13 +63,13 @@ func baseGenState(deputy sdk.AccAddress) types.GenesisState { SupplyLimit: types.SupplyLimit{ Limit: sdkmath.NewInt(100000000000), TimeLimited: false, - TimeBasedLimit: sdk.ZeroInt(), + TimeBasedLimit: sdkmath.ZeroInt(), TimePeriod: time.Hour, }, Active: true, DeputyAddress: deputy, FixedFee: sdkmath.NewInt(1000), - MinSwapAmount: sdk.OneInt(), + MinSwapAmount: sdkmath.OneInt(), MaxSwapAmount: sdkmath.NewInt(1000000000000), MinBlockLock: types.DefaultMinBlockLock, MaxBlockLock: types.DefaultMaxBlockLock, @@ -78,17 +78,17 @@ func baseGenState(deputy sdk.AccAddress) types.GenesisState { }, Supplies: types.AssetSupplies{ types.NewAssetSupply( - sdk.NewCoin("bnb", sdk.ZeroInt()), - sdk.NewCoin("bnb", sdk.ZeroInt()), - sdk.NewCoin("bnb", sdk.ZeroInt()), - sdk.NewCoin("bnb", sdk.ZeroInt()), + sdk.NewCoin("bnb", sdkmath.ZeroInt()), + sdk.NewCoin("bnb", sdkmath.ZeroInt()), + sdk.NewCoin("bnb", sdkmath.ZeroInt()), + sdk.NewCoin("bnb", sdkmath.ZeroInt()), time.Duration(0), ), types.NewAssetSupply( - sdk.NewCoin("inc", sdk.ZeroInt()), - sdk.NewCoin("inc", sdk.ZeroInt()), - sdk.NewCoin("inc", sdk.ZeroInt()), - sdk.NewCoin("inc", sdk.ZeroInt()), + sdk.NewCoin("inc", sdkmath.ZeroInt()), + sdk.NewCoin("inc", sdkmath.ZeroInt()), + sdk.NewCoin("inc", sdkmath.ZeroInt()), + sdk.NewCoin("inc", sdkmath.ZeroInt()), time.Duration(0), ), }, diff --git a/x/bep3/keeper/asset.go b/x/bep3/keeper/asset.go index 983d1999e4..a67d6ca4bd 100644 --- a/x/bep3/keeper/asset.go +++ b/x/bep3/keeper/asset.go @@ -1,6 +1,7 @@ package keeper import ( + sdkmath "cosmossdk.io/math" "time" errorsmod "cosmossdk.io/errors" @@ -147,8 +148,8 @@ func (k Keeper) DecrementOutgoingAssetSupply(ctx sdk.Context, coin sdk.Coin) err // CreateNewAssetSupply creates a new AssetSupply in the store for the input denom func (k Keeper) CreateNewAssetSupply(ctx sdk.Context, denom string) types.AssetSupply { supply := types.NewAssetSupply( - sdk.NewCoin(denom, sdk.ZeroInt()), sdk.NewCoin(denom, sdk.ZeroInt()), - sdk.NewCoin(denom, sdk.ZeroInt()), sdk.NewCoin(denom, sdk.ZeroInt()), time.Duration(0)) + sdk.NewCoin(denom, sdkmath.ZeroInt()), sdk.NewCoin(denom, sdkmath.ZeroInt()), + sdk.NewCoin(denom, sdkmath.ZeroInt()), sdk.NewCoin(denom, sdkmath.ZeroInt()), time.Duration(0)) k.SetAssetSupply(ctx, supply, denom) return supply } @@ -176,7 +177,7 @@ func (k Keeper) UpdateTimeBasedSupplyLimits(ctx sdk.Context) { supply.TimeElapsed = newTimeElapsed } else { supply.TimeElapsed = time.Duration(0) - supply.TimeLimitedCurrentSupply = sdk.NewCoin(asset.Denom, sdk.ZeroInt()) + supply.TimeLimitedCurrentSupply = sdk.NewCoin(asset.Denom, sdkmath.ZeroInt()) } k.SetAssetSupply(ctx, supply, asset.Denom) } diff --git a/x/bep3/keeper/asset_test.go b/x/bep3/keeper/asset_test.go index b4b2446144..86e899fa8d 100644 --- a/x/bep3/keeper/asset_test.go +++ b/x/bep3/keeper/asset_test.go @@ -32,7 +32,7 @@ func (suite *AssetTestSuite) SetupTest() { // Initialize test app and set context tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) // Initialize genesis state deputy, _ := sdk.AccAddressFromBech32(TestDeputy) @@ -635,13 +635,13 @@ func (suite *AssetTestSuite) TestUpdateTimeBasedSupplyLimits() { SupplyLimit: types.SupplyLimit{ Limit: sdkmath.NewInt(350000000000000), TimeLimited: false, - TimeBasedLimit: sdk.ZeroInt(), + TimeBasedLimit: sdkmath.ZeroInt(), TimePeriod: time.Hour, }, Active: true, DeputyAddress: deputy, FixedFee: sdkmath.NewInt(1000), - MinSwapAmount: sdk.OneInt(), + MinSwapAmount: sdkmath.OneInt(), MaxSwapAmount: sdkmath.NewInt(1000000000000), MinBlockLock: types.DefaultMinBlockLock, MaxBlockLock: types.DefaultMaxBlockLock, @@ -658,7 +658,7 @@ func (suite *AssetTestSuite) TestUpdateTimeBasedSupplyLimits() { Active: false, DeputyAddress: deputy, FixedFee: sdkmath.NewInt(1000), - MinSwapAmount: sdk.OneInt(), + MinSwapAmount: sdkmath.OneInt(), MaxSwapAmount: sdkmath.NewInt(1000000000000), MinBlockLock: types.DefaultMinBlockLock, MaxBlockLock: types.DefaultMaxBlockLock, @@ -675,7 +675,7 @@ func (suite *AssetTestSuite) TestUpdateTimeBasedSupplyLimits() { Active: false, DeputyAddress: deputy, FixedFee: sdkmath.NewInt(1000), - MinSwapAmount: sdk.OneInt(), + MinSwapAmount: sdkmath.OneInt(), MaxSwapAmount: sdkmath.NewInt(1000000000000), MinBlockLock: types.DefaultMinBlockLock, MaxBlockLock: types.DefaultMaxBlockLock, diff --git a/x/bep3/keeper/grpc_query.go b/x/bep3/keeper/grpc_query.go index 1012c82ea7..f4103c951c 100644 --- a/x/bep3/keeper/grpc_query.go +++ b/x/bep3/keeper/grpc_query.go @@ -7,7 +7,7 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/status" - "github.com/cosmos/cosmos-sdk/store/prefix" + "cosmossdk.io/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/query" diff --git a/x/bep3/keeper/integration_test.go b/x/bep3/keeper/integration_test.go index ffe94eb6b8..f11139d84c 100644 --- a/x/bep3/keeper/integration_test.go +++ b/x/bep3/keeper/integration_test.go @@ -46,13 +46,13 @@ func NewBep3GenStateMulti(cdc codec.JSONCodec, deputyAddress sdk.AccAddress) app SupplyLimit: types.SupplyLimit{ Limit: sdkmath.NewInt(350000000000000), TimeLimited: false, - TimeBasedLimit: sdk.ZeroInt(), + TimeBasedLimit: sdkmath.ZeroInt(), TimePeriod: time.Hour, }, Active: true, DeputyAddress: deputyAddress, FixedFee: sdkmath.NewInt(1000), - MinSwapAmount: sdk.OneInt(), + MinSwapAmount: sdkmath.OneInt(), MaxSwapAmount: sdkmath.NewInt(1000000000000), MinBlockLock: types.DefaultMinBlockLock, MaxBlockLock: types.DefaultMaxBlockLock, @@ -69,7 +69,7 @@ func NewBep3GenStateMulti(cdc codec.JSONCodec, deputyAddress sdk.AccAddress) app Active: false, DeputyAddress: deputyAddress, FixedFee: sdkmath.NewInt(1000), - MinSwapAmount: sdk.OneInt(), + MinSwapAmount: sdkmath.OneInt(), MaxSwapAmount: sdkmath.NewInt(100000000000), MinBlockLock: types.DefaultMinBlockLock, MaxBlockLock: types.DefaultMaxBlockLock, @@ -78,17 +78,17 @@ func NewBep3GenStateMulti(cdc codec.JSONCodec, deputyAddress sdk.AccAddress) app }, Supplies: types.AssetSupplies{ types.NewAssetSupply( - sdk.NewCoin("bnb", sdk.ZeroInt()), - sdk.NewCoin("bnb", sdk.ZeroInt()), - sdk.NewCoin("bnb", sdk.ZeroInt()), - sdk.NewCoin("bnb", sdk.ZeroInt()), + sdk.NewCoin("bnb", sdkmath.ZeroInt()), + sdk.NewCoin("bnb", sdkmath.ZeroInt()), + sdk.NewCoin("bnb", sdkmath.ZeroInt()), + sdk.NewCoin("bnb", sdkmath.ZeroInt()), time.Duration(0), ), types.NewAssetSupply( - sdk.NewCoin("inc", sdk.ZeroInt()), - sdk.NewCoin("inc", sdk.ZeroInt()), - sdk.NewCoin("inc", sdk.ZeroInt()), - sdk.NewCoin("inc", sdk.ZeroInt()), + sdk.NewCoin("inc", sdkmath.ZeroInt()), + sdk.NewCoin("inc", sdkmath.ZeroInt()), + sdk.NewCoin("inc", sdkmath.ZeroInt()), + sdk.NewCoin("inc", sdkmath.ZeroInt()), time.Duration(0), ), }, diff --git a/x/bep3/keeper/keeper.go b/x/bep3/keeper/keeper.go index 6a32a81b84..1a1ea1af6e 100644 --- a/x/bep3/keeper/keeper.go +++ b/x/bep3/keeper/keeper.go @@ -4,10 +4,10 @@ import ( "fmt" "time" - "github.com/cometbft/cometbft/libs/log" + "cosmossdk.io/log" + "cosmossdk.io/store/prefix" + storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/store/prefix" - storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" @@ -82,7 +82,7 @@ func (k Keeper) RemoveAtomicSwap(ctx sdk.Context, swapID []byte) { // IterateAtomicSwaps provides an iterator over all stored AtomicSwaps. // For each AtomicSwap, cb will be called. If cb returns true, the iterator will close and stop. func (k Keeper) IterateAtomicSwaps(ctx sdk.Context, cb func(atomicSwap types.AtomicSwap) (stop bool)) { - iterator := sdk.KVStorePrefixIterator(ctx.KVStore(k.key), types.AtomicSwapKeyPrefix) + iterator := storetypes.KVStorePrefixIterator(ctx.KVStore(k.key), types.AtomicSwapKeyPrefix) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { @@ -126,7 +126,7 @@ func (k Keeper) IterateAtomicSwapsByBlock(ctx sdk.Context, inclusiveCutoffTime u store := prefix.NewStore(ctx.KVStore(k.key), types.AtomicSwapByBlockPrefix) iterator := store.Iterator( nil, // start at the very start of the prefix store - sdk.PrefixEndBytes(sdk.Uint64ToBigEndian(inclusiveCutoffTime)), // end of range + storetypes.PrefixEndBytes(sdk.Uint64ToBigEndian(inclusiveCutoffTime)), // end of range ) defer iterator.Close() @@ -167,7 +167,7 @@ func (k Keeper) IterateAtomicSwapsLongtermStorage(ctx sdk.Context, inclusiveCuto store := prefix.NewStore(ctx.KVStore(k.key), types.AtomicSwapLongtermStoragePrefix) iterator := store.Iterator( nil, // start at the very start of the prefix store - sdk.PrefixEndBytes(sdk.Uint64ToBigEndian(inclusiveCutoffTime)), // end of range + storetypes.PrefixEndBytes(sdk.Uint64ToBigEndian(inclusiveCutoffTime)), // end of range ) defer iterator.Close() @@ -205,7 +205,7 @@ func (k Keeper) SetAssetSupply(ctx sdk.Context, supply types.AssetSupply, denom // IterateAssetSupplies provides an iterator over all stored AssetSupplies. func (k Keeper) IterateAssetSupplies(ctx sdk.Context, cb func(supply types.AssetSupply) (stop bool)) { - iterator := sdk.KVStorePrefixIterator(ctx.KVStore(k.key), types.AssetSupplyPrefix) + iterator := storetypes.KVStorePrefixIterator(ctx.KVStore(k.key), types.AssetSupplyPrefix) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { diff --git a/x/bep3/keeper/keeper_test.go b/x/bep3/keeper/keeper_test.go index 529247205b..be91513e68 100644 --- a/x/bep3/keeper/keeper_test.go +++ b/x/bep3/keeper/keeper_test.go @@ -34,7 +34,7 @@ func (suite *KeeperTestSuite) SetupTest() { func (suite *KeeperTestSuite) ResetChain() { tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) keeper := tApp.GetBep3Keeper() suite.app = tApp diff --git a/x/bep3/keeper/msg_server_test.go b/x/bep3/keeper/msg_server_test.go index badad26ce2..d53e0fe63e 100644 --- a/x/bep3/keeper/msg_server_test.go +++ b/x/bep3/keeper/msg_server_test.go @@ -29,7 +29,7 @@ type MsgServerTestSuite struct { func (suite *MsgServerTestSuite) SetupTest() { tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) cdc := tApp.AppCodec() diff --git a/x/bep3/keeper/params_test.go b/x/bep3/keeper/params_test.go index 0f339d4402..3f71a1ee63 100644 --- a/x/bep3/keeper/params_test.go +++ b/x/bep3/keeper/params_test.go @@ -26,7 +26,7 @@ type ParamsTestSuite struct { func (suite *ParamsTestSuite) SetupTest() { tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) _, addrs := app.GeneratePrivKeyAddressPairs(10) tApp.InitializeFromGenesisStates(NewBep3GenStateMulti(tApp.AppCodec(), addrs[0])) suite.keeper = tApp.GetBep3Keeper() diff --git a/x/bep3/keeper/swap.go b/x/bep3/keeper/swap.go index bf3df1937c..664c52018e 100644 --- a/x/bep3/keeper/swap.go +++ b/x/bep3/keeper/swap.go @@ -68,6 +68,7 @@ func (k Keeper) CreateAtomicSwap(ctx sdk.Context, randomNumberHash []byte, times direction = types.SWAP_DIRECTION_OUTGOING } + // TODO(boodyvo): this looks strange, as switch/case is redundant here switch direction { case types.SWAP_DIRECTION_INCOMING: // If recipient's account doesn't exist, register it in state so that the address can send @@ -132,6 +133,7 @@ func (k Keeper) CreateAtomicSwap(ctx sdk.Context, randomNumberHash []byte, times // ClaimAtomicSwap validates a claim attempt, and if successful, sends the escrowed amount and closes the AtomicSwap. func (k Keeper) ClaimAtomicSwap(ctx sdk.Context, from sdk.AccAddress, swapID []byte, randomNumber []byte) error { + atomicSwap, found := k.GetAtomicSwap(ctx, swapID) if !found { return errorsmod.Wrapf(types.ErrAtomicSwapNotFound, "%s", swapID) diff --git a/x/bep3/keeper/swap_test.go b/x/bep3/keeper/swap_test.go index 056a51476f..2ace6e9e4a 100644 --- a/x/bep3/keeper/swap_test.go +++ b/x/bep3/keeper/swap_test.go @@ -45,7 +45,7 @@ func (suite *AtomicSwapTestSuite) SetupTest() { // Initialize test app and set context tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) cdc := tApp.AppCodec() // Create and load 20 accounts with bnb tokens diff --git a/x/bep3/module.go b/x/bep3/module.go index a2ef32c395..e02ab4ce3d 100644 --- a/x/bep3/module.go +++ b/x/bep3/module.go @@ -133,12 +133,20 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw return cdc.MustMarshalJSON(&gs) } -// BeginBlock returns the begin blocker for the bep3 module. -func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { - BeginBlocker(ctx, am.keeper) +// BeginBlock returns the beginning blocker for the distribution module. +func (am AppModule) BeginBlock(ctx context.Context) error { + c := sdk.UnwrapSDKContext(ctx) + BeginBlocker(c, am.keeper) + + return nil } -// EndBlock returns the end blocker for the bep3 module. It returns no validator updates. -func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - return []abci.ValidatorUpdate{} +// EndBlock returns the end blocker for the staking module. It returns no validator +// updates. +func (am AppModule) EndBlock(ctx context.Context) ([]abci.ValidatorUpdate, error) { + return []abci.ValidatorUpdate{}, nil } + +func (AppModule) IsOnePerModuleType() {} + +func (AppModule) IsAppModule() {} diff --git a/x/bep3/types/bep3.pb.go b/x/bep3/types/bep3.pb.go index 5a9c3ab512..13ae60c92f 100644 --- a/x/bep3/types/bep3.pb.go +++ b/x/bep3/types/bep3.pb.go @@ -4,6 +4,7 @@ package types import ( + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" github_com_cometbft_cometbft_libs_bytes "github.com/cometbft/cometbft/libs/bytes" _ "github.com/cosmos/cosmos-proto" @@ -158,11 +159,11 @@ type AssetParam struct { // deputy_address the kava address of the deputy DeputyAddress github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,5,opt,name=deputy_address,json=deputyAddress,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"deputy_address,omitempty"` // fixed_fee defines the fee for incoming swaps - FixedFee github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,6,opt,name=fixed_fee,json=fixedFee,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"fixed_fee"` + FixedFee cosmossdk_io_math.Int `protobuf:"bytes,6,opt,name=fixed_fee,json=fixedFee,proto3,customtype=cosmossdk.io/math.Int" json:"fixed_fee"` // min_swap_amount defines the minimum amount able to be swapped in a single message - MinSwapAmount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,7,opt,name=min_swap_amount,json=minSwapAmount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"min_swap_amount"` + MinSwapAmount cosmossdk_io_math.Int `protobuf:"bytes,7,opt,name=min_swap_amount,json=minSwapAmount,proto3,customtype=cosmossdk.io/math.Int" json:"min_swap_amount"` // max_swap_amount defines the maximum amount able to be swapped in a single message - MaxSwapAmount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,8,opt,name=max_swap_amount,json=maxSwapAmount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"max_swap_amount"` + MaxSwapAmount cosmossdk_io_math.Int `protobuf:"bytes,8,opt,name=max_swap_amount,json=maxSwapAmount,proto3,customtype=cosmossdk.io/math.Int" json:"max_swap_amount"` // min_block_lock defined the minimum blocks to lock MinBlockLock uint64 `protobuf:"varint,9,opt,name=min_block_lock,json=minBlockLock,proto3" json:"min_block_lock,omitempty"` // min_block_lock defined the maximum blocks to lock @@ -254,13 +255,13 @@ func (m *AssetParam) GetMaxBlockLock() uint64 { // SupplyLimit define the absolute and time-based limits for an assets's supply. type SupplyLimit struct { // limit defines the total supply allowed - Limit github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=limit,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"limit"` + Limit cosmossdk_io_math.Int `protobuf:"bytes,1,opt,name=limit,proto3,customtype=cosmossdk.io/math.Int" json:"limit"` // time_limited enables or disables time based supply limiting TimeLimited bool `protobuf:"varint,2,opt,name=time_limited,json=timeLimited,proto3" json:"time_limited,omitempty"` // time_period specifies the duration that time_based_limit is evalulated TimePeriod time.Duration `protobuf:"bytes,3,opt,name=time_period,json=timePeriod,proto3,stdduration" json:"time_period"` // time_based_limit defines the maximum supply that can be swapped within time_period - TimeBasedLimit github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,4,opt,name=time_based_limit,json=timeBasedLimit,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"time_based_limit"` + TimeBasedLimit cosmossdk_io_math.Int `protobuf:"bytes,4,opt,name=time_based_limit,json=timeBasedLimit,proto3,customtype=cosmossdk.io/math.Int" json:"time_based_limit"` } func (m *SupplyLimit) Reset() { *m = SupplyLimit{} } @@ -550,79 +551,80 @@ func init() { func init() { proto.RegisterFile("kava/bep3/v1beta1/bep3.proto", fileDescriptor_01a01937d931b013) } var fileDescriptor_01a01937d931b013 = []byte{ - // 1147 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0x4d, 0x6f, 0x1a, 0x57, - 0x17, 0xf6, 0x18, 0x4c, 0xec, 0x03, 0x26, 0xbc, 0xd7, 0xc9, 0x1b, 0xec, 0xa4, 0x40, 0x9c, 0xaa, - 0x42, 0x51, 0x0d, 0xf9, 0x68, 0x77, 0x55, 0x55, 0x06, 0x70, 0x8c, 0xe4, 0x00, 0x1a, 0x6c, 0xf5, - 0x63, 0xd1, 0xe9, 0x9d, 0x99, 0x0b, 0x5c, 0x99, 0x99, 0x3b, 0x9a, 0x3b, 0x24, 0xf8, 0x1f, 0x74, - 0xd1, 0x45, 0xbb, 0xeb, 0xbe, 0xbb, 0x2e, 0xab, 0xfc, 0x88, 0x2c, 0xa3, 0xac, 0xaa, 0x2e, 0x9c, - 0xca, 0xf9, 0x17, 0xd9, 0xb4, 0xba, 0x1f, 0x06, 0x9c, 0xba, 0x15, 0x0b, 0x36, 0xf6, 0x9c, 0xaf, - 0xe7, 0x9c, 0xb9, 0x73, 0x9e, 0xe7, 0x02, 0x77, 0x4e, 0xf0, 0x33, 0x5c, 0x75, 0x48, 0xf8, 0xb8, - 0xfa, 0xec, 0xa1, 0x43, 0x62, 0xfc, 0x50, 0x1a, 0x95, 0x30, 0x62, 0x31, 0x43, 0xff, 0x13, 0xd1, - 0x8a, 0x74, 0xe8, 0xe8, 0x4e, 0xc1, 0x65, 0xdc, 0x67, 0xbc, 0xea, 0x60, 0x4e, 0xa6, 0x25, 0x2e, - 0xa3, 0x81, 0x2a, 0xd9, 0xd9, 0x56, 0x71, 0x5b, 0x5a, 0x55, 0x65, 0xe8, 0xd0, 0x8d, 0x01, 0x1b, - 0x30, 0xe5, 0x17, 0x4f, 0xda, 0x5b, 0x18, 0x30, 0x36, 0x18, 0x91, 0xaa, 0xb4, 0x9c, 0x71, 0xbf, - 0xea, 0x8d, 0x23, 0x1c, 0x53, 0xa6, 0x01, 0x77, 0x6d, 0x48, 0x75, 0x71, 0x84, 0x7d, 0x8e, 0x8e, - 0x21, 0x83, 0x39, 0x27, 0xb1, 0x1d, 0x4a, 0x3b, 0x6f, 0x94, 0x12, 0xe5, 0xf4, 0xa3, 0x0f, 0x2a, - 0xff, 0x18, 0xb2, 0x52, 0x13, 0x69, 0xb2, 0xca, 0xdc, 0x7a, 0x79, 0x56, 0x5c, 0xf9, 0xf5, 0x4d, - 0x31, 0x3d, 0xf3, 0x71, 0x2b, 0x8d, 0x67, 0xc6, 0xee, 0x0f, 0x6b, 0x00, 0xb3, 0x20, 0xba, 0x01, - 0x6b, 0x1e, 0x09, 0x98, 0x9f, 0x37, 0x4a, 0x46, 0x79, 0xc3, 0x52, 0x06, 0xba, 0x07, 0xd7, 0xc4, - 0x4b, 0xda, 0xd4, 0xcb, 0xaf, 0x96, 0x8c, 0x72, 0xc2, 0x84, 0xf3, 0xb3, 0x62, 0xaa, 0xce, 0x68, - 0xd0, 0x6a, 0x58, 0x29, 0x11, 0x6a, 0x79, 0xe8, 0x09, 0x64, 0xf8, 0x38, 0x0c, 0x47, 0xa7, 0xf6, - 0x88, 0xfa, 0x34, 0xce, 0x27, 0x4a, 0x46, 0x39, 0xfd, 0xa8, 0x70, 0xc5, 0x80, 0x3d, 0x99, 0x76, - 0x28, 0xb2, 0xcc, 0xa4, 0x98, 0xd0, 0x4a, 0xf3, 0x99, 0x0b, 0xfd, 0x1f, 0x52, 0xd8, 0x8d, 0xe9, - 0x33, 0x92, 0x4f, 0x96, 0x8c, 0xf2, 0xba, 0xa5, 0x2d, 0xc4, 0x20, 0xeb, 0x91, 0x70, 0x1c, 0x9f, - 0xda, 0xd8, 0xf3, 0x22, 0xc2, 0x79, 0x7e, 0xad, 0x64, 0x94, 0x33, 0xe6, 0xc1, 0xbb, 0xb3, 0xe2, - 0xde, 0x80, 0xc6, 0xc3, 0xb1, 0x53, 0x71, 0x99, 0xaf, 0x8f, 0x5d, 0xff, 0xdb, 0xe3, 0xde, 0x49, - 0x35, 0x3e, 0x0d, 0x09, 0xaf, 0xd4, 0x5c, 0xb7, 0xa6, 0x0a, 0x5f, 0xbf, 0xd8, 0xdb, 0xd2, 0x1f, - 0x47, 0x7b, 0xcc, 0xd3, 0x98, 0x70, 0x6b, 0x53, 0xe1, 0x6b, 0x1f, 0xfa, 0x1a, 0x36, 0xfa, 0x74, - 0x42, 0x3c, 0xbb, 0x4f, 0x48, 0x3e, 0x25, 0x0e, 0xc4, 0xfc, 0x4c, 0x8c, 0xfb, 0xc7, 0x59, 0xf1, - 0xa3, 0x05, 0xfa, 0xb5, 0x82, 0xf8, 0xf5, 0x8b, 0x3d, 0xd0, 0x8d, 0x5a, 0x41, 0x6c, 0xad, 0x4b, - 0xb8, 0x7d, 0x42, 0x90, 0x07, 0xd7, 0x7d, 0x1a, 0xd8, 0xfc, 0x39, 0x0e, 0x6d, 0xec, 0xb3, 0x71, - 0x10, 0xe7, 0xaf, 0x2d, 0xa1, 0xc1, 0xa6, 0x4f, 0x83, 0xde, 0x73, 0x1c, 0xd6, 0x24, 0xa4, 0xec, - 0x82, 0x27, 0x97, 0xba, 0xac, 0x2f, 0xa5, 0x0b, 0x9e, 0xcc, 0x75, 0xf9, 0x10, 0xb2, 0xe2, 0x5d, - 0x9c, 0x11, 0x73, 0x4f, 0x6c, 0xf1, 0x27, 0xbf, 0x51, 0x32, 0xca, 0x49, 0x2b, 0xe3, 0xd3, 0xc0, - 0x14, 0xf6, 0x21, 0x73, 0x4f, 0x64, 0x16, 0x9e, 0xcc, 0x67, 0x81, 0xce, 0xc2, 0x93, 0x69, 0xd6, - 0xee, 0x6f, 0xab, 0x90, 0x9e, 0x5b, 0x0f, 0x64, 0xc1, 0x9a, 0xda, 0x26, 0x63, 0x09, 0x73, 0x2b, - 0x28, 0x74, 0x17, 0x32, 0x31, 0xf5, 0x89, 0x5a, 0x53, 0xa2, 0x56, 0x7a, 0xdd, 0x4a, 0x0b, 0xdf, - 0xa1, 0x72, 0xa1, 0x06, 0x48, 0xd3, 0x0e, 0x49, 0x44, 0x99, 0xa7, 0x57, 0x79, 0xbb, 0xa2, 0xc8, - 0x5a, 0xb9, 0x20, 0x6b, 0xa5, 0xa1, 0xc9, 0x6a, 0xae, 0x8b, 0xb9, 0x7e, 0x7e, 0x53, 0x34, 0x2c, - 0x10, 0x75, 0x5d, 0x59, 0x86, 0xfa, 0x90, 0x93, 0x28, 0x42, 0x2d, 0x3c, 0xcd, 0x8a, 0xe4, 0x12, - 0xde, 0x23, 0x2b, 0x50, 0x4d, 0x01, 0x2a, 0xe7, 0xdd, 0xfd, 0x4b, 0x70, 0x38, 0x66, 0x3e, 0x75, - 0xc5, 0x57, 0x41, 0x2e, 0xa4, 0xf4, 0xc7, 0x56, 0x1a, 0xb1, 0x5d, 0xd1, 0xb5, 0x62, 0x8e, 0x29, - 0x09, 0x05, 0x7b, 0xcd, 0x07, 0x5a, 0x1f, 0xca, 0x0b, 0xcc, 0x21, 0x0a, 0xb8, 0xa5, 0xa1, 0x91, - 0x03, 0x28, 0xc2, 0x81, 0xc7, 0x7c, 0x3b, 0x18, 0xfb, 0x0e, 0x89, 0xec, 0x21, 0xe6, 0x43, 0x79, - 0x94, 0x19, 0xf3, 0x93, 0x77, 0x67, 0xc5, 0x07, 0x97, 0x10, 0x7d, 0x12, 0x3b, 0xfd, 0x78, 0xf6, - 0x30, 0xa2, 0x0e, 0xaf, 0x3a, 0x82, 0x73, 0x95, 0x03, 0x32, 0x51, 0xe4, 0xcb, 0x29, 0xbc, 0xb6, - 0x84, 0x3b, 0xc0, 0x7c, 0x88, 0xee, 0xc1, 0x26, 0x99, 0x84, 0x34, 0x22, 0xf6, 0x90, 0xd0, 0xc1, - 0x50, 0x49, 0x4a, 0xd2, 0xca, 0x28, 0xe7, 0x81, 0xf4, 0xa1, 0x3b, 0xb0, 0x21, 0x8e, 0x83, 0xc7, - 0xd8, 0x0f, 0xe5, 0xe9, 0x26, 0xac, 0x99, 0x03, 0x7d, 0x07, 0x29, 0x4e, 0x02, 0x8f, 0x44, 0x4b, - 0xd7, 0x0a, 0x8d, 0x8b, 0xfa, 0xb0, 0x11, 0x11, 0x97, 0x86, 0x94, 0x04, 0xb1, 0x14, 0x89, 0x65, - 0x36, 0x99, 0x41, 0xa3, 0x8f, 0x01, 0xa9, 0x8e, 0x36, 0x8b, 0x87, 0x24, 0xb2, 0xdd, 0x21, 0xa6, - 0x81, 0x12, 0x0d, 0x2b, 0xa7, 0x22, 0x1d, 0x11, 0xa8, 0x0b, 0x3f, 0x7a, 0x04, 0x37, 0xa7, 0xa5, - 0x97, 0x0a, 0x24, 0xff, 0xad, 0xad, 0x69, 0x70, 0xae, 0xe6, 0x2e, 0x64, 0xdc, 0x11, 0x13, 0xab, - 0xea, 0x4c, 0x59, 0x9c, 0xb0, 0xd2, 0xca, 0x27, 0x29, 0x8a, 0x3e, 0x85, 0x14, 0x8f, 0x71, 0x3c, - 0xe6, 0x92, 0xbc, 0xd9, 0x2b, 0xaf, 0x1f, 0xb1, 0x83, 0x3d, 0x99, 0x64, 0xe9, 0x64, 0x54, 0x84, - 0xb4, 0x1b, 0x31, 0xce, 0xf5, 0x0c, 0x69, 0x49, 0x38, 0x90, 0x2e, 0xd5, 0xfa, 0x73, 0xd8, 0xf0, - 0x68, 0x44, 0x5c, 0x41, 0xa6, 0x7c, 0x46, 0x42, 0x97, 0xfe, 0x05, 0xba, 0x71, 0x91, 0x67, 0xcd, - 0x4a, 0x76, 0x7f, 0x4a, 0x80, 0xba, 0xe2, 0x94, 0x76, 0xa0, 0x03, 0xb8, 0x4e, 0x03, 0x97, 0xf9, - 0x34, 0x18, 0xd8, 0xea, 0x6a, 0x91, 0x02, 0xf2, 0x9f, 0x5c, 0x50, 0x37, 0x51, 0xf6, 0xa2, 0x6e, - 0x86, 0xc4, 0xc6, 0xf1, 0x80, 0xcd, 0x21, 0xad, 0x2e, 0x88, 0x74, 0x51, 0xa7, 0x91, 0xf6, 0x21, - 0xeb, 0x8e, 0xa3, 0x48, 0x7c, 0x10, 0x0d, 0x94, 0x58, 0x0c, 0x68, 0x53, 0x97, 0x69, 0x9c, 0x6f, - 0xe1, 0xf6, 0xbc, 0x7c, 0xd9, 0xef, 0x81, 0x26, 0x17, 0x03, 0xcd, 0xcf, 0xc9, 0x5d, 0xfd, 0x12, - 0xfe, 0xbe, 0x96, 0x47, 0x32, 0xc2, 0x21, 0x27, 0x9e, 0x24, 0xce, 0x82, 0xe2, 0x27, 0x45, 0xb3, - 0xa9, 0xea, 0xee, 0x9f, 0x02, 0xcc, 0x56, 0x01, 0xdd, 0x86, 0x5b, 0xbd, 0x2f, 0x6b, 0x5d, 0xbb, - 0x77, 0x54, 0x3b, 0x3a, 0xee, 0xd9, 0xc7, 0xed, 0x5e, 0xb7, 0x59, 0x6f, 0xed, 0xb7, 0x9a, 0x8d, - 0xdc, 0x0a, 0xba, 0x01, 0xb9, 0xf9, 0x60, 0xa7, 0xdb, 0x6c, 0xe7, 0x0c, 0xb4, 0x0d, 0x37, 0xe7, - 0xbd, 0xf5, 0xce, 0xd3, 0xee, 0x61, 0xf3, 0xa8, 0xd9, 0xc8, 0xad, 0xa2, 0x5b, 0xb0, 0x35, 0x1f, - 0x6a, 0x7e, 0xd5, 0x6d, 0x59, 0xcd, 0x46, 0x2e, 0xb1, 0x93, 0xfc, 0xfe, 0x97, 0xc2, 0xca, 0x7d, - 0x06, 0x9b, 0x97, 0x56, 0x05, 0x15, 0x60, 0x47, 0xe6, 0x37, 0x5a, 0x56, 0xb3, 0x7e, 0xd4, 0xea, - 0xb4, 0xdf, 0x1b, 0xe0, 0x62, 0xba, 0x59, 0xbc, 0xd5, 0xae, 0x77, 0x9e, 0xb6, 0xda, 0x4f, 0x72, - 0xc6, 0x15, 0xc1, 0xce, 0xf1, 0xd1, 0x93, 0x8e, 0x08, 0xae, 0xaa, 0x86, 0xe6, 0x17, 0x2f, 0xcf, - 0x0b, 0xc6, 0xab, 0xf3, 0x82, 0xf1, 0xe7, 0x79, 0xc1, 0xf8, 0xf1, 0x6d, 0x61, 0xe5, 0xd5, 0xdb, - 0xc2, 0xca, 0xef, 0x6f, 0x0b, 0x2b, 0xdf, 0xcc, 0x2b, 0xbc, 0x58, 0xe8, 0xbd, 0x11, 0x76, 0xb8, - 0x7c, 0xaa, 0x4e, 0xd4, 0x2f, 0x4f, 0xa9, 0x05, 0x4e, 0x4a, 0x9e, 0xeb, 0xe3, 0xbf, 0x03, 0x00, - 0x00, 0xff, 0xff, 0x79, 0xfe, 0xe7, 0xb2, 0x93, 0x0a, 0x00, 0x00, + // 1153 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0x4f, 0x53, 0x1b, 0xc7, + 0x13, 0x65, 0x91, 0x90, 0xa1, 0x25, 0xb0, 0x7e, 0x83, 0xfd, 0xb3, 0xc0, 0x8e, 0x24, 0xe3, 0x54, + 0x4a, 0xe5, 0x84, 0x95, 0xff, 0x24, 0xd7, 0x54, 0xb4, 0x92, 0x30, 0xaa, 0xc2, 0x48, 0xb5, 0x82, + 0x4a, 0x2a, 0x87, 0x6c, 0x66, 0x77, 0x07, 0x69, 0x0a, 0xed, 0xce, 0xd6, 0xce, 0xc8, 0x16, 0xdf, + 0x20, 0x47, 0xe7, 0x96, 0x7b, 0x6e, 0x39, 0xfb, 0x43, 0xf8, 0xe8, 0xf2, 0x29, 0xc9, 0x01, 0xa7, + 0xf0, 0xb7, 0xf0, 0x25, 0xa9, 0xf9, 0x03, 0x12, 0x8e, 0x93, 0x82, 0x94, 0x2f, 0xb0, 0xfd, 0xba, + 0xdf, 0x9b, 0x66, 0xb6, 0x5f, 0x2f, 0x70, 0xeb, 0x10, 0x3f, 0xc1, 0x75, 0x9f, 0x24, 0x0f, 0xeb, + 0x4f, 0xee, 0xfb, 0x44, 0xe0, 0xfb, 0x2a, 0xb0, 0x93, 0x94, 0x09, 0x86, 0xfe, 0x27, 0xb3, 0xb6, + 0x02, 0x4c, 0x76, 0xbd, 0x1c, 0x30, 0x1e, 0x31, 0x5e, 0xf7, 0x31, 0x27, 0x67, 0x94, 0x80, 0xd1, + 0x58, 0x53, 0xd6, 0xd7, 0x74, 0xde, 0x53, 0x51, 0x5d, 0x07, 0x26, 0x75, 0x6d, 0xc0, 0x06, 0x4c, + 0xe3, 0xf2, 0xc9, 0xa0, 0xe5, 0x01, 0x63, 0x83, 0x11, 0xa9, 0xab, 0xc8, 0x1f, 0x1f, 0xd4, 0xc3, + 0x71, 0x8a, 0x05, 0x65, 0x46, 0x70, 0xc3, 0x83, 0x5c, 0x0f, 0xa7, 0x38, 0xe2, 0x68, 0x1f, 0x0a, + 0x98, 0x73, 0x22, 0xbc, 0x44, 0xc5, 0x25, 0xab, 0x9a, 0xa9, 0xe5, 0x1f, 0x7c, 0x64, 0xff, 0xad, + 0x49, 0xbb, 0x21, 0xcb, 0x14, 0xcb, 0x59, 0x7d, 0x71, 0x5c, 0x99, 0xfb, 0xe5, 0x75, 0x25, 0x3f, + 0xc5, 0xb8, 0x9b, 0xc7, 0xd3, 0x60, 0xe3, 0xb7, 0x2c, 0xc0, 0x34, 0x89, 0xae, 0xc1, 0x42, 0x48, + 0x62, 0x16, 0x95, 0xac, 0xaa, 0x55, 0x5b, 0x72, 0x75, 0x80, 0xee, 0xc0, 0x15, 0xf9, 0x47, 0x7a, + 0x34, 0x2c, 0xcd, 0x57, 0xad, 0x5a, 0xc6, 0x81, 0x93, 0xe3, 0x4a, 0xae, 0xc9, 0x68, 0xdc, 0x69, + 0xb9, 0x39, 0x99, 0xea, 0x84, 0xe8, 0x11, 0x14, 0xf8, 0x38, 0x49, 0x46, 0x47, 0xde, 0x88, 0x46, + 0x54, 0x94, 0x32, 0x55, 0xab, 0x96, 0x7f, 0x50, 0x7e, 0x4f, 0x83, 0x7d, 0x55, 0xb6, 0x23, 0xab, + 0x9c, 0xac, 0xec, 0xd0, 0xcd, 0xf3, 0x29, 0x84, 0xfe, 0x0f, 0x39, 0x1c, 0x08, 0xfa, 0x84, 0x94, + 0xb2, 0x55, 0xab, 0xb6, 0xe8, 0x9a, 0x08, 0x31, 0x58, 0x09, 0x49, 0x32, 0x16, 0x47, 0x1e, 0x0e, + 0xc3, 0x94, 0x70, 0x5e, 0x5a, 0xa8, 0x5a, 0xb5, 0x82, 0xb3, 0xfd, 0xf6, 0xb8, 0xb2, 0x39, 0xa0, + 0x62, 0x38, 0xf6, 0xed, 0x80, 0x45, 0xe6, 0xda, 0xcd, 0xaf, 0x4d, 0x1e, 0x1e, 0xd6, 0xc5, 0x51, + 0x42, 0xb8, 0xdd, 0x08, 0x82, 0x86, 0x26, 0xbe, 0x7a, 0xbe, 0xb9, 0x6a, 0x5e, 0x8e, 0x41, 0x9c, + 0x23, 0x41, 0xb8, 0xbb, 0xac, 0xf5, 0x0d, 0x86, 0xb6, 0x61, 0xe9, 0x80, 0x4e, 0x48, 0xe8, 0x1d, + 0x10, 0x52, 0xca, 0xc9, 0x0b, 0x71, 0x3e, 0x95, 0xed, 0xfe, 0x7e, 0x5c, 0xb9, 0xae, 0xe9, 0x3c, + 0x3c, 0xb4, 0x29, 0xab, 0x47, 0x58, 0x0c, 0xed, 0x4e, 0x2c, 0x5e, 0x3d, 0xdf, 0x04, 0xa3, 0xdb, + 0x89, 0x85, 0xbb, 0xa8, 0xd8, 0x5b, 0x84, 0xa0, 0x3e, 0x5c, 0x8d, 0x68, 0xec, 0xf1, 0xa7, 0x38, + 0xf1, 0x70, 0xc4, 0xc6, 0xb1, 0x28, 0x5d, 0xb9, 0xbc, 0xde, 0x72, 0x44, 0xe3, 0xfe, 0x53, 0x9c, + 0x34, 0x94, 0x82, 0x12, 0xc5, 0x93, 0x73, 0xa2, 0x8b, 0xff, 0x45, 0x14, 0x4f, 0x66, 0x44, 0x3f, + 0x86, 0x15, 0xd9, 0xa9, 0x3f, 0x62, 0xc1, 0xa1, 0x27, 0x7f, 0x94, 0x96, 0xaa, 0x56, 0x2d, 0xeb, + 0x16, 0x22, 0x1a, 0x3b, 0x32, 0xde, 0x61, 0xc1, 0xa1, 0xaa, 0xc2, 0x93, 0xd9, 0x2a, 0x30, 0x55, + 0x78, 0x72, 0x56, 0xb5, 0xf1, 0x6c, 0x1e, 0xf2, 0x33, 0xef, 0x1a, 0x35, 0x60, 0x41, 0x8f, 0x86, + 0x75, 0xf9, 0x36, 0x35, 0x13, 0xdd, 0x86, 0x82, 0xa0, 0x11, 0xd1, 0x23, 0x46, 0xf4, 0x38, 0x2e, + 0xba, 0x79, 0x89, 0xed, 0x68, 0x08, 0xb5, 0x40, 0x85, 0x5e, 0x42, 0x52, 0xca, 0x42, 0x33, 0x86, + 0x6b, 0xb6, 0x36, 0x9a, 0x7d, 0x6a, 0x34, 0xbb, 0x65, 0x8c, 0xe6, 0x2c, 0xca, 0x36, 0x7e, 0x7a, + 0x5d, 0xb1, 0x5c, 0x90, 0xbc, 0x9e, 0xa2, 0xa1, 0x7d, 0x28, 0x2a, 0x15, 0xe9, 0xf4, 0xd0, 0x4c, + 0x74, 0xf6, 0xf2, 0x6d, 0xaf, 0x48, 0x11, 0x47, 0x6a, 0xa8, 0xf6, 0x36, 0xfe, 0x5c, 0x00, 0x68, + 0x08, 0x16, 0xd1, 0x40, 0xde, 0x39, 0x0a, 0x20, 0x67, 0xde, 0x9c, 0xb6, 0xf3, 0x9a, 0x6d, 0xb8, + 0xf2, 0xd8, 0x33, 0xbf, 0x48, 0xa3, 0x39, 0xf7, 0x8c, 0x95, 0x6b, 0x17, 0x98, 0x74, 0x49, 0xe0, + 0xae, 0x91, 0x46, 0x3e, 0xa0, 0x14, 0xc7, 0x21, 0x8b, 0xbc, 0x78, 0x1c, 0xf9, 0x24, 0xf5, 0x86, + 0x98, 0x0f, 0xd5, 0xcd, 0x15, 0x9c, 0xcf, 0xdf, 0x1e, 0x57, 0xee, 0x9d, 0x53, 0x8c, 0x88, 0xf0, + 0x0f, 0xc4, 0xf4, 0x61, 0x44, 0x7d, 0x5e, 0xf7, 0xa5, 0x3d, 0xec, 0x6d, 0x32, 0xd1, 0x3e, 0x29, + 0x6a, 0xbd, 0x5d, 0x25, 0xb7, 0x8d, 0xf9, 0x10, 0xdd, 0x81, 0x65, 0x32, 0x49, 0x68, 0x4a, 0xbc, + 0x21, 0xa1, 0x83, 0xa1, 0x76, 0x7f, 0xd6, 0x2d, 0x68, 0x70, 0x5b, 0x61, 0xe8, 0x16, 0x2c, 0xc9, + 0xeb, 0xe0, 0x02, 0x47, 0x89, 0xba, 0xcc, 0x8c, 0x3b, 0x05, 0xd0, 0xf7, 0x90, 0xe3, 0x24, 0x0e, + 0x49, 0xfa, 0xc1, 0x6d, 0x6d, 0x74, 0xd1, 0x01, 0x2c, 0xa5, 0x24, 0xa0, 0x09, 0x25, 0xb1, 0x50, + 0x7e, 0xfe, 0x90, 0x87, 0x4c, 0xa5, 0xd1, 0x67, 0x80, 0xf4, 0x89, 0x1e, 0x13, 0x43, 0x92, 0x7a, + 0xc1, 0x10, 0xd3, 0x58, 0x1b, 0xde, 0x2d, 0xea, 0x4c, 0x57, 0x26, 0x9a, 0x12, 0x47, 0x0f, 0xe0, + 0xfa, 0x19, 0xf5, 0x1c, 0x41, 0x99, 0xd9, 0x5d, 0x3d, 0x4b, 0xce, 0x70, 0x6e, 0x43, 0x21, 0x18, + 0x31, 0x39, 0x99, 0xfe, 0x99, 0x47, 0x33, 0x6e, 0x5e, 0x63, 0xca, 0x80, 0xe8, 0x0b, 0xc8, 0x71, + 0x81, 0xc5, 0x98, 0x2b, 0x6b, 0xae, 0xbc, 0xf7, 0x4b, 0x21, 0x67, 0xb0, 0xaf, 0x8a, 0x5c, 0x53, + 0x8c, 0x2a, 0x90, 0x0f, 0x52, 0xc6, 0xb9, 0xe9, 0x21, 0xaf, 0xfc, 0x05, 0x0a, 0xd2, 0x47, 0x7f, + 0x09, 0x4b, 0x21, 0x4d, 0x49, 0x20, 0xbd, 0x53, 0x2a, 0x28, 0xe9, 0xea, 0x3f, 0x48, 0xb7, 0x4e, + 0xeb, 0xdc, 0x29, 0x65, 0xe3, 0xc7, 0x0c, 0xe8, 0xaf, 0x91, 0xde, 0x0c, 0x68, 0x1b, 0xae, 0xd2, + 0x38, 0x60, 0x11, 0x8d, 0x07, 0x9e, 0xfe, 0x0a, 0xa8, 0xf5, 0xf0, 0xaf, 0x5e, 0xd0, 0x1f, 0x8d, + 0x95, 0x53, 0xde, 0x54, 0x89, 0x8d, 0xc5, 0x80, 0xcd, 0x28, 0xcd, 0x5f, 0x50, 0xe9, 0x94, 0x67, + 0x94, 0xb6, 0x60, 0x25, 0x18, 0xa7, 0xa9, 0x7c, 0x21, 0x46, 0x28, 0x73, 0x31, 0xa1, 0x65, 0x43, + 0x33, 0x3a, 0xdf, 0xc1, 0xcd, 0xd9, 0x6d, 0xe5, 0xbd, 0x23, 0x9a, 0xbd, 0x98, 0x68, 0x69, 0x66, + 0xbb, 0x35, 0xcf, 0xe9, 0x6f, 0x99, 0x6d, 0x48, 0x46, 0x38, 0xe1, 0x24, 0x54, 0xc6, 0xb9, 0xe0, + 0xae, 0x53, 0x3b, 0xb2, 0xad, 0x79, 0x77, 0x8f, 0x00, 0xa6, 0xa3, 0x80, 0x6e, 0xc2, 0x8d, 0xfe, + 0xd7, 0x8d, 0x9e, 0xd7, 0xdf, 0x6b, 0xec, 0xed, 0xf7, 0xbd, 0xfd, 0xdd, 0x7e, 0xaf, 0xdd, 0xec, + 0x6c, 0x75, 0xda, 0xad, 0xe2, 0x1c, 0xba, 0x06, 0xc5, 0xd9, 0x64, 0xb7, 0xd7, 0xde, 0x2d, 0x5a, + 0x68, 0x0d, 0xae, 0xcf, 0xa2, 0xcd, 0xee, 0xe3, 0xde, 0x4e, 0x7b, 0xaf, 0xdd, 0x2a, 0xce, 0xa3, + 0x1b, 0xb0, 0x3a, 0x9b, 0x6a, 0x7f, 0xd3, 0xeb, 0xb8, 0xed, 0x56, 0x31, 0xb3, 0x9e, 0xfd, 0xe1, + 0xe7, 0xf2, 0xdc, 0x5d, 0x06, 0xcb, 0xe7, 0x46, 0x05, 0x95, 0x61, 0x5d, 0xd5, 0xb7, 0x3a, 0x6e, + 0xbb, 0xb9, 0xd7, 0xe9, 0xee, 0xbe, 0xd3, 0xc0, 0x69, 0x77, 0xd3, 0x7c, 0x67, 0xb7, 0xd9, 0x7d, + 0xdc, 0xd9, 0x7d, 0x54, 0xb4, 0xde, 0x93, 0xec, 0xee, 0xef, 0x3d, 0xea, 0xca, 0xe4, 0xbc, 0x3e, + 0xd0, 0xf9, 0xea, 0xc5, 0x49, 0xd9, 0x7a, 0x79, 0x52, 0xb6, 0xfe, 0x38, 0x29, 0x5b, 0xcf, 0xde, + 0x94, 0xe7, 0x5e, 0xbe, 0x29, 0xcf, 0xfd, 0xfa, 0xa6, 0x3c, 0xf7, 0xed, 0x27, 0x33, 0x7b, 0x40, + 0x0e, 0xf4, 0xe6, 0x08, 0xfb, 0x5c, 0x3d, 0xd5, 0x27, 0xfa, 0x9f, 0x44, 0xb5, 0x0b, 0xfc, 0x9c, + 0xba, 0xd7, 0x87, 0x7f, 0x05, 0x00, 0x00, 0xff, 0xff, 0xfd, 0xd9, 0x54, 0x64, 0x3e, 0x0a, 0x00, + 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { diff --git a/x/bep3/types/codec.go b/x/bep3/types/codec.go index dce4de11a2..071f19a5d5 100644 --- a/x/bep3/types/codec.go +++ b/x/bep3/types/codec.go @@ -6,7 +6,6 @@ import ( cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" - authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec" ) // RegisterLegacyAminoCodec registers all the necessary types and interfaces for the @@ -45,5 +44,5 @@ func init() { // Register all Amino interfaces and concrete types on the authz Amino codec so that this can later be // used to properly serialize MsgGrant and MsgExec instances - RegisterLegacyAminoCodec(authzcodec.Amino) + RegisterLegacyAminoCodec(codec.NewLegacyAmino()) } diff --git a/x/bep3/types/expected_keepers.go b/x/bep3/types/expected_keepers.go index c9d1f7e981..697dfce107 100644 --- a/x/bep3/types/expected_keepers.go +++ b/x/bep3/types/expected_keepers.go @@ -1,26 +1,26 @@ package types import ( + "context" sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) // BankKeeper defines the expected interface needed to retrieve account balances. type BankKeeper interface { - SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error - SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error - BurnCoins(ctx sdk.Context, name string, amt sdk.Coins) error - MintCoins(ctx sdk.Context, name string, amt sdk.Coins) error + SendCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error + SendCoinsFromAccountToModule(ctx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error + BurnCoins(ctx context.Context, name string, amt sdk.Coins) error + MintCoins(ctx context.Context, name string, amt sdk.Coins) error } // AccountKeeper defines the expected account keeper type AccountKeeper interface { GetModuleAddress(name string) sdk.AccAddress - GetModuleAccount(ctx sdk.Context, moduleName string) authtypes.ModuleAccountI + GetModuleAccount(ctx context.Context, moduleName string) sdk.ModuleAccountI GetModuleAddressAndPermissions(moduleName string) (sdk.AccAddress, []string) - SetModuleAccount(ctx sdk.Context, macc authtypes.ModuleAccountI) + SetModuleAccount(ctx context.Context, macc sdk.ModuleAccountI) - GetAccount(ctx sdk.Context, addr sdk.AccAddress) authtypes.AccountI - NewAccountWithAddress(ctx sdk.Context, addr sdk.AccAddress) authtypes.AccountI - SetAccount(ctx sdk.Context, acc authtypes.AccountI) + GetAccount(ctx context.Context, addr sdk.AccAddress) sdk.AccountI + NewAccountWithAddress(ctx context.Context, addr sdk.AccAddress) sdk.AccountI + SetAccount(ctx context.Context, acc sdk.AccountI) } diff --git a/x/bep3/types/genesis_test.go b/x/bep3/types/genesis_test.go index 31ecc22eec..f4fb5ebb57 100644 --- a/x/bep3/types/genesis_test.go +++ b/x/bep3/types/genesis_test.go @@ -20,7 +20,7 @@ type GenesisTestSuite struct { } func (suite *GenesisTestSuite) SetupTest() { - coin := sdk.NewCoin("kava", sdk.OneInt()) + coin := sdk.NewCoin("kava", sdkmath.OneInt()) suite.swaps = atomicSwaps(10) supply := types.NewAssetSupply(coin, coin, coin, coin, time.Duration(0)) @@ -67,7 +67,7 @@ func (suite *GenesisTestSuite) TestValidate() { "invalid supply", args{ swaps: types.AtomicSwaps{}, - supplies: types.AssetSupplies{{IncomingSupply: sdk.Coin{Denom: "Invalid", Amount: sdk.ZeroInt()}}}, + supplies: types.AssetSupplies{{IncomingSupply: sdk.Coin{Denom: "Invalid", Amount: sdkmath.ZeroInt()}}}, previousBlockTime: types.DefaultPreviousBlockTime, }, false, diff --git a/x/bep3/types/params.go b/x/bep3/types/params.go index 0ec12dc17c..66bcef0ad1 100644 --- a/x/bep3/types/params.go +++ b/x/bep3/types/params.go @@ -20,7 +20,7 @@ var ( KeyAssetParams = []byte("AssetParams") DefaultBnbDeputyFixedFee sdkmath.Int = sdkmath.NewInt(1000) // 0.00001 BNB - DefaultMinAmount sdkmath.Int = sdk.ZeroInt() + DefaultMinAmount sdkmath.Int = sdkmath.ZeroInt() DefaultMaxAmount sdkmath.Int = sdkmath.NewInt(1000000000000) // 10,000 BNB DefaultMinBlockLock uint64 = 220 DefaultMaxBlockLock uint64 = 270 diff --git a/x/bep3/types/params_test.go b/x/bep3/types/params_test.go index a9de43a6ec..36ecc3d8e4 100644 --- a/x/bep3/types/params_test.go +++ b/x/bep3/types/params_test.go @@ -27,7 +27,7 @@ func (suite *ParamsTestSuite) SetupTest() { supply1 := types.SupplyLimit{ Limit: sdkmath.NewInt(10000000000000), TimeLimited: false, - TimeBasedLimit: sdk.ZeroInt(), + TimeBasedLimit: sdkmath.ZeroInt(), TimePeriod: time.Hour, } supply2 := types.SupplyLimit{ @@ -179,7 +179,7 @@ func (suite *ParamsTestSuite) TestParamValidation() { args: args{ assetParams: types.AssetParams{types.NewAssetParam( "bnb", 714, - types.SupplyLimit{sdkmath.NewInt(-10000000000000), false, time.Hour, sdk.ZeroInt()}, true, + types.SupplyLimit{sdkmath.NewInt(-10000000000000), false, time.Hour, sdkmath.ZeroInt()}, true, suite.addr, sdkmath.NewInt(1000), sdkmath.NewInt(100000000), sdkmath.NewInt(100000000000), types.DefaultMinBlockLock, types.DefaultMaxBlockLock)}, }, diff --git a/x/bep3/types/query.pb.go b/x/bep3/types/query.pb.go index 55eaa12421..e7373e7b7a 100644 --- a/x/bep3/types/query.pb.go +++ b/x/bep3/types/query.pb.go @@ -1008,6 +1008,7 @@ func _Query_AtomicSwaps_Handler(srv interface{}, ctx context.Context, dec func(i return interceptor(ctx, in, info, handler) } +var Query_serviceDesc = _Query_serviceDesc var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "kava.bep3.v1beta1.Query", HandlerType: (*QueryServer)(nil), diff --git a/x/bep3/types/supply_test.go b/x/bep3/types/supply_test.go index cefbf0e822..bcd846300a 100644 --- a/x/bep3/types/supply_test.go +++ b/x/bep3/types/supply_test.go @@ -10,7 +10,7 @@ import ( ) func TestAssetSupplyValidate(t *testing.T) { - coin := sdk.NewCoin("kava", sdk.OneInt()) + coin := sdk.NewCoin("kava", sdkmath.OneInt()) invalidCoin := sdk.Coin{Denom: "Invalid Denom", Amount: sdkmath.NewInt(-1)} testCases := []struct { msg string @@ -60,7 +60,7 @@ func TestAssetSupplyValidate(t *testing.T) { IncomingSupply: coin, OutgoingSupply: coin, CurrentSupply: coin, - TimeLimitedCurrentSupply: sdk.NewCoin("lol", sdk.ZeroInt()), + TimeLimitedCurrentSupply: sdk.NewCoin("lol", sdkmath.ZeroInt()), TimeElapsed: time.Hour, }, false, @@ -78,8 +78,8 @@ func TestAssetSupplyValidate(t *testing.T) { } func TestAssetSupplyEquality(t *testing.T) { - coin := sdk.NewCoin("test", sdk.OneInt()) - coin2 := sdk.NewCoin("other", sdk.OneInt()) + coin := sdk.NewCoin("test", sdkmath.OneInt()) + coin2 := sdk.NewCoin("other", sdkmath.OneInt()) testCases := []struct { name string asset1 AssetSupply @@ -101,7 +101,7 @@ func TestAssetSupplyEquality(t *testing.T) { { name: "not equal coin amount", asset1: NewAssetSupply(coin, coin, coin, coin, time.Duration(0)), - asset2: NewAssetSupply(sdk.NewCoin("test", sdk.ZeroInt()), coin, coin, coin, time.Duration(1)), + asset2: NewAssetSupply(sdk.NewCoin("test", sdkmath.ZeroInt()), coin, coin, coin, time.Duration(1)), expPass: false, }, { diff --git a/x/bep3/types/tx.pb.go b/x/bep3/types/tx.pb.go index 8929798a94..625be2e0c3 100644 --- a/x/bep3/types/tx.pb.go +++ b/x/bep3/types/tx.pb.go @@ -452,6 +452,7 @@ func _Msg_RefundAtomicSwap_Handler(srv interface{}, ctx context.Context, dec fun return interceptor(ctx, in, info, handler) } +var Msg_serviceDesc = _Msg_serviceDesc var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "kava.bep3.v1beta1.Msg", HandlerType: (*MsgServer)(nil), diff --git a/x/cdp/abci.go b/x/cdp/abci.go index 9967bd514d..0e6014ccdb 100644 --- a/x/cdp/abci.go +++ b/x/cdp/abci.go @@ -1,6 +1,7 @@ package cdp import ( + sdkmath "cosmossdk.io/math" "errors" "fmt" "time" @@ -8,15 +9,13 @@ import ( "github.com/cosmos/cosmos-sdk/telemetry" sdk "github.com/cosmos/cosmos-sdk/types" - abci "github.com/cometbft/cometbft/abci/types" - "github.com/kava-labs/kava/x/cdp/keeper" "github.com/kava-labs/kava/x/cdp/types" pricefeedtypes "github.com/kava-labs/kava/x/pricefeed/types" ) // BeginBlocker compounds the debt in outstanding cdps and liquidates cdps that are below the required collateralization ratio -func BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock, k keeper.Keeper) { +func BeginBlocker(ctx sdk.Context, k keeper.Keeper) { defer telemetry.ModuleMeasureSince(types.ModuleName, time.Now(), telemetry.MetricKeyBeginBlocker) params := k.GetParams(ctx) @@ -24,6 +23,11 @@ func BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock, k keeper.Keeper) // only run CDP liquidations every `LiquidationBlockInterval` blocks skipSyncronizeAndLiquidations := ctx.BlockHeight()%params.LiquidationBlockInterval != 0 + // suite.ctx = suite.ctx.WithBlockTime(suite.ctx.BlockTime().Add(time.Second * 6)) + // cdp.BeginBlocker(suite.ctx, suite.keeper) + // // block time with balance 2024-10-24 04:02:57.651655 +0000 UTC 1000000027 + // fmt.Println("balance time with balance", suite.ctx.BlockTime(), bk.GetBalance(suite.ctx, cdpMacc.GetAddress(), "debt").Amount.Int64()) + for _, cp := range params.CollateralParams { ok := k.UpdatePricefeedStatus(ctx, cp.SpotMarketID) if !ok { @@ -47,7 +51,7 @@ func BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock, k keeper.Keeper) ctx.Logger().Debug(fmt.Sprintf("running x/cdp SynchronizeInterestForRiskyCDPs and LiquidateCdps for %s", cp.Type)) - err = k.SynchronizeInterestForRiskyCDPs(ctx, sdk.MaxSortableDec, cp) + err = k.SynchronizeInterestForRiskyCDPs(ctx, sdkmath.LegacyMaxSortableDec, cp) if err != nil { panic(err) } diff --git a/x/cdp/abci_test.go b/x/cdp/abci_test.go index eaffaa969d..f846fd1ff1 100644 --- a/x/cdp/abci_test.go +++ b/x/cdp/abci_test.go @@ -1,6 +1,7 @@ package cdp_test import ( + "fmt" "math/rand" "testing" "time" @@ -11,7 +12,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/simulation" - abci "github.com/cometbft/cometbft/abci/types" tmproto "github.com/cometbft/cometbft/proto/tendermint/types" tmtime "github.com/cometbft/cometbft/types/time" @@ -41,29 +41,35 @@ type liquidationTracker struct { } func (suite *ModuleTestSuite) SetupTest() { + fmt.Println("test setup") tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) tracker := liquidationTracker{} coins := cs(c("btc", 100000000), c("xrp", 10000000000), c("erc20/usdc", 10000000000)) _, addrs := app.GeneratePrivKeyAddressPairs(100) authGS := app.NewFundedGenStateWithSameCoins(tApp.AppCodec(), coins, addrs) + fmt.Println("before init") tApp.InitializeFromGenesisStates( authGS, NewPricefeedGenStateMulti(tApp.AppCodec()), NewCDPGenStateMulti(tApp.AppCodec()), ) + fmt.Println("after init") suite.ctx = ctx suite.app = tApp suite.keeper = tApp.GetCDPKeeper() suite.cdps = types.CDPs{} suite.addrs = addrs suite.liquidations = tracker + fmt.Println("test setup done") } func (suite *ModuleTestSuite) createCdps() { + fmt.Println("before app creation") tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + fmt.Println("after app creation") + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) cdps := make(types.CDPs, 100) tracker := liquidationTracker{} @@ -77,6 +83,8 @@ func (suite *ModuleTestSuite) createCdps() { NewCDPGenStateMulti(tApp.AppCodec()), ) + fmt.Println("after app init") + suite.ctx = ctx suite.app = tApp suite.keeper = tApp.GetCDPKeeper() @@ -108,12 +116,15 @@ func (suite *ModuleTestSuite) createCdps() { cdps[j] = c } + fmt.Println("after cdp creation") + suite.cdps = cdps suite.addrs = addrs suite.liquidations = tracker + fmt.Println("cdp test setup done") } -func (suite *ModuleTestSuite) setPrice(price sdk.Dec, market string) { +func (suite *ModuleTestSuite) setPrice(price sdkmath.LegacyDec, market string) { pfKeeper := suite.app.GetPriceFeedKeeper() _, err := pfKeeper.SetPrice(suite.ctx, sdk.AccAddress{}, market, price, suite.ctx.BlockTime().Add(time.Hour*3)) @@ -134,13 +145,13 @@ func (suite *ModuleTestSuite) TestBeginBlockNewCdpTypeSetsGlobalInterest() { usdcCollateral := types.CollateralParam{ Denom: "erc20/usdc", Type: "erc20-usdc", - LiquidationRatio: sdk.MustNewDecFromStr("1.01"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("1.01"), DebtLimit: sdk.NewInt64Coin("usdx", 500000000000), - StabilityFee: sdk.OneDec(), + StabilityFee: sdkmath.LegacyOneDec(), AuctionSize: sdkmath.NewIntFromUint64(10000000000), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), + LiquidationPenalty: sdkmath.LegacyMustNewDecFromStr("0.05"), CheckCollateralizationIndexCount: sdkmath.NewInt(10), - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), + KeeperRewardPercentage: sdkmath.LegacyMustNewDecFromStr("0.01"), SpotMarketID: "usdc:usd", LiquidationMarketID: "usdc:usd", ConversionFactor: sdkmath.NewInt(6), @@ -148,13 +159,13 @@ func (suite *ModuleTestSuite) TestBeginBlockNewCdpTypeSetsGlobalInterest() { usdtCollateral := types.CollateralParam{ Denom: "erc20/usdt", Type: "erc20-usdt", - LiquidationRatio: sdk.MustNewDecFromStr("1.01"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("1.01"), DebtLimit: sdk.NewInt64Coin("usdx", 500000000000), - StabilityFee: sdk.OneDec(), + StabilityFee: sdkmath.LegacyOneDec(), AuctionSize: sdkmath.NewIntFromUint64(10000000000), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), + LiquidationPenalty: sdkmath.LegacyMustNewDecFromStr("0.05"), CheckCollateralizationIndexCount: sdkmath.NewInt(10), - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), + KeeperRewardPercentage: sdkmath.LegacyMustNewDecFromStr("0.01"), SpotMarketID: "usdt:usd", LiquidationMarketID: "usdt:usd", ConversionFactor: sdkmath.NewInt(18), @@ -183,7 +194,7 @@ func (suite *ModuleTestSuite) TestBeginBlockNewCdpTypeSetsGlobalInterest() { // ensure begin block does not panic due to no accumulation time or no global interest factor suite.Require().NotPanics(func() { - cdp.BeginBlocker(suite.ctx, abci.RequestBeginBlock{Header: suite.ctx.BlockHeader()}, suite.keeper) + cdp.BeginBlocker(suite.ctx, suite.keeper) }, "expected begin blocker not to panic") // set by accumulate interest (or add cdp above) @@ -199,11 +210,11 @@ func (suite *ModuleTestSuite) TestBeginBlockNewCdpTypeSetsGlobalInterest() { // set for USDC by AddCdp globalInterestFactor, found := suite.keeper.GetInterestFactor(suite.ctx, usdcCollateral.Type) suite.Require().True(found, "expected global interest factor for new collateral to be set") - suite.Equal(sdk.OneDec(), globalInterestFactor, "expected global interest factor to equal 1") + suite.Equal(sdkmath.LegacyOneDec(), globalInterestFactor, "expected global interest factor to equal 1") // not set for USDT since it has no cdps globalInterestFactor, found = suite.keeper.GetInterestFactor(suite.ctx, usdtCollateral.Type) suite.Require().False(found, "expected global interest factor for new collateral to not be set") - suite.Equal(sdk.ZeroDec(), globalInterestFactor, "expected global interest factor to equal 0") + suite.Equal(sdkmath.LegacyZeroDec(), globalInterestFactor, "expected global interest factor to equal 0") } func (suite *ModuleTestSuite) TestBeginBlock() { @@ -235,8 +246,12 @@ func (suite *ModuleTestSuite) TestBeginBlock() { // set the trading price for xrp:usd pools suite.setPrice(d("0.2"), "xrp:usd") + fmt.Println("balance 3:", bk.GetBalance(suite.ctx, acc.GetAddress(), "debt").Amount.Int64()) + // test case 1 execution - cdp.BeginBlocker(suite.ctx, abci.RequestBeginBlock{Header: suite.ctx.BlockHeader()}, suite.keeper) + cdp.BeginBlocker(suite.ctx, suite.keeper) + + fmt.Println("balance 4:", bk.GetBalance(suite.ctx, acc.GetAddress(), "debt").Amount.Int64()) // test case 1 assert acc = ak.GetModuleAccount(suite.ctx, types.ModuleName) @@ -256,7 +271,9 @@ func (suite *ModuleTestSuite) TestBeginBlock() { suite.setPrice(d("6000"), "btc:usd") // btc collateral test case execution - cdp.BeginBlocker(suite.ctx, abci.RequestBeginBlock{Header: suite.ctx.BlockHeader()}, suite.keeper) + cdp.BeginBlocker(suite.ctx, suite.keeper) + + fmt.Println("balance 5:", bk.GetBalance(suite.ctx, acc.GetAddress(), "debt").Amount.Int64()) // btc collateral test case assertion 1 acc = ak.GetModuleAccount(suite.ctx, types.ModuleName) @@ -275,10 +292,36 @@ func (suite *ModuleTestSuite) TestBeginBlock() { suite.Equal(int64(71955653865), bk.GetBalance(suite.ctx, acc.GetAddress(), "debt").Amount.Int64()) } +//fmt.Println("block header 1", suite.ctx.BlockTime()) +// fmt.Println(suite.keeper.GetPreviousAccrualTime(suite.ctx, "xrp-a")) +// err := suite.keeper.AddCdp(suite.ctx, suite.addrs[0], c("xrp", 10000000000), c("usdx", 1000000000), "xrp-a") +// suite.NoError(err) +// // verify the total value of all assets in cdps composed of xrp-a/usdx pair equals the amount of the single cdp we just added above +// suite.Equal(i(1000000000), suite.keeper.GetTotalPrincipal(suite.ctx, "xrp-a", "usdx")) +// ak := suite.app.GetAccountKeeper() +// bk := suite.app.GetBankKeeper() +// +// fmt.Println("block header 2", suite.ctx.BlockTime()) +// fmt.Println(suite.keeper.GetPreviousAccrualTime(suite.ctx, "xrp-a")) +// +// cdpMacc := ak.GetModuleAccount(suite.ctx, types.ModuleName) +// suite.Equal(i(1000000000), bk.GetBalance(suite.ctx, cdpMacc.GetAddress(), "debt").Amount) +// fmt.Println("block header 3", suite.ctx.BlockTime()) +// for i := 0; i < 100; i++ { +// fmt.Println("block header 4", suite.ctx.BlockTime()) +// suite.ctx = suite.ctx.WithBlockTime(suite.ctx.BlockTime().Add(time.Second * 6)) +// fmt.Println("block header 5", suite.ctx.BlockTime()) +// fmt.Println(suite.keeper.GetPreviousAccrualTime(suite.ctx, "xrp-a")) +// cdp.BeginBlocker(suite.ctx, abci.RequestBeginBlock{Header: suite.ctx.BlockHeader()}, suite.keeper) +// fmt.Println("block time with balance", suite.ctx.BlockTime(), bk.GetBalance(suite.ctx, cdpMacc.GetAddress(), "debt").Amount) +// } + func (suite *ModuleTestSuite) TestSeizeSingleCdpWithFees() { // test setup // starting with zero cdps, add a single cdp of // xrp backed 1:1 with usdx + fmt.Println("block header 1", suite.ctx.BlockTime()) + fmt.Println(suite.keeper.GetPreviousAccrualTime(suite.ctx, "xrp-a")) err := suite.keeper.AddCdp(suite.ctx, suite.addrs[0], c("xrp", 10000000000), c("usdx", 1000000000), "xrp-a") suite.NoError(err) // verify the total value of all assets in cdps composed of xrp-a/usdx pair equals the amount of the single cdp we just added above @@ -286,14 +329,24 @@ func (suite *ModuleTestSuite) TestSeizeSingleCdpWithFees() { ak := suite.app.GetAccountKeeper() bk := suite.app.GetBankKeeper() + fmt.Println("block header 2", suite.ctx.BlockTime()) + fmt.Println(suite.keeper.GetPreviousAccrualTime(suite.ctx, "xrp-a")) + cdpMacc := ak.GetModuleAccount(suite.ctx, types.ModuleName) suite.Equal(i(1000000000), bk.GetBalance(suite.ctx, cdpMacc.GetAddress(), "debt").Amount) + fmt.Println("block header 3", suite.ctx.BlockTime()) for i := 0; i < 100; i++ { + fmt.Println("block header 4", suite.ctx.BlockTime()) suite.ctx = suite.ctx.WithBlockTime(suite.ctx.BlockTime().Add(time.Second * 6)) - cdp.BeginBlocker(suite.ctx, abci.RequestBeginBlock{Header: suite.ctx.BlockHeader()}, suite.keeper) + fmt.Println("block header 5", suite.ctx.BlockTime()) + fmt.Println(suite.keeper.GetPreviousAccrualTime(suite.ctx, "xrp-a")) + cdp.BeginBlocker(suite.ctx, suite.keeper) + // block time with balance 2024-10-24 04:02:57.651655 +0000 UTC 1000000027 + fmt.Println("balance time with balance", suite.ctx.BlockTime(), bk.GetBalance(suite.ctx, cdpMacc.GetAddress(), "debt").Amount.Int64()) } cdpMacc = ak.GetModuleAccount(suite.ctx, types.ModuleName) + fmt.Println("balance 1:", bk.GetBalance(suite.ctx, cdpMacc.GetAddress(), "debt").Amount.Int64()) suite.Equal(i(1000000891), (bk.GetBalance(suite.ctx, cdpMacc.GetAddress(), "debt").Amount)) cdp, _ := suite.keeper.GetCDP(suite.ctx, "xrp-a", 1) @@ -338,7 +391,7 @@ func (suite *ModuleTestSuite) TestCDPBeginBlockerRunsOnlyOnConfiguredInterval() suite.setPrice(d("0.2"), "xrp:usd") // test case 1 execution - cdp.BeginBlocker(suite.ctx, abci.RequestBeginBlock{Header: suite.ctx.BlockHeader()}, suite.keeper) + cdp.BeginBlocker(suite.ctx, suite.keeper) // test case 1 assert acc = ak.GetModuleAccount(suite.ctx, types.ModuleName) @@ -357,7 +410,7 @@ func (suite *ModuleTestSuite) TestCDPBeginBlockerRunsOnlyOnConfiguredInterval() suite.ctx = suite.ctx.WithBlockHeight(2) // test case 2 execution - cdp.BeginBlocker(suite.ctx, abci.RequestBeginBlock{Header: suite.ctx.BlockHeader()}, suite.keeper) + cdp.BeginBlocker(suite.ctx, suite.keeper) // test case 2 assert acc = ak.GetModuleAccount(suite.ctx, types.ModuleName) diff --git a/x/cdp/client/cli/query.go b/x/cdp/client/cli/query.go index dcfe3623e5..4b83fe6187 100644 --- a/x/cdp/client/cli/query.go +++ b/x/cdp/client/cli/query.go @@ -2,6 +2,7 @@ package cli import ( "context" + sdkmath "cosmossdk.io/math" "fmt" "strconv" "strings" @@ -149,7 +150,7 @@ $ kvcli q cdp cdps --page=2 --limit=100 } if len(strRatio) != 0 { - cdpRatio, err := sdk.NewDecFromStr(strRatio) + cdpRatio, err := sdkmath.LegacyNewDecFromStr(strRatio) if err != nil { return fmt.Errorf("cannot parse cdp ratio %s", strRatio) } diff --git a/x/cdp/genesis.go b/x/cdp/genesis.go index c3123b6537..628ce0c97e 100644 --- a/x/cdp/genesis.go +++ b/x/cdp/genesis.go @@ -1,6 +1,7 @@ package cdp import ( + sdkmath "cosmossdk.io/math" "fmt" sdk "github.com/cosmos/cosmos-sdk/types" @@ -112,7 +113,7 @@ func ExportGenesis(ctx sdk.Context, k keeper.Keeper) types.GenesisState { for _, cp := range params.CollateralParams { interestFactor, found := k.GetInterestFactor(ctx, cp.Type) if !found { - interestFactor = sdk.OneDec() + interestFactor = sdkmath.LegacyOneDec() } // Governance param changes happen in the end blocker. If a new collateral type is added and then the chain // is exported before the BeginBlocker can run, previous accrual time won't be found. We can't set it to diff --git a/x/cdp/genesis_test.go b/x/cdp/genesis_test.go index ef9254f076..056cc48f58 100644 --- a/x/cdp/genesis_test.go +++ b/x/cdp/genesis_test.go @@ -2,13 +2,12 @@ package cdp_test import ( "fmt" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" "sort" "strings" "testing" "time" - abci "github.com/cometbft/cometbft/abci/types" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" tmtime "github.com/cometbft/cometbft/types/time" "github.com/stretchr/testify/suite" @@ -34,7 +33,7 @@ type GenesisTestSuite struct { func (suite *GenesisTestSuite) SetupTest() { tApp := app.NewTestApp() suite.genTime = tmtime.Canonical(time.Date(2021, 1, 1, 1, 1, 1, 1, time.UTC)) - suite.ctx = tApp.NewContext(true, tmproto.Header{Height: 1, Time: suite.genTime}) + suite.ctx = tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: suite.genTime}) suite.keeper = tApp.GetCDPKeeper() suite.app = tApp @@ -103,7 +102,7 @@ func (suite *GenesisTestSuite) TestInvalidGenState() { deposits: types.Deposits{}, debtDenom: types.DefaultDebtDenom, govDenom: types.DefaultGovDenom, - genAccumTimes: types.GenesisAccumulationTimes{types.NewGenesisAccumulationTime("bnb-a", time.Time{}, sdk.OneDec().Sub(sdk.SmallestDec()))}, + genAccumTimes: types.GenesisAccumulationTimes{types.NewGenesisAccumulationTime("bnb-a", time.Time{}, sdkmath.LegacyOneDec().Sub(sdkmath.LegacySmallestDec()))}, genTotalPrincipals: types.DefaultGenesisState().TotalPrincipals, }, errArgs: errArgs{ @@ -178,13 +177,13 @@ func (suite *GenesisTestSuite) Test_InitExportGenesis() { Principal: c("usdx", 10000000), AccumulatedFees: c("usdx", 0), FeesUpdated: suite.genTime, - InterestFactor: sdk.NewDec(1), + InterestFactor: sdkmath.LegacyNewDec(1), }, } genTotalPrincipals := types.GenesisTotalPrincipals{ - types.NewGenesisTotalPrincipal("btc-a", sdk.ZeroInt()), - types.NewGenesisTotalPrincipal("xrp-a", sdk.ZeroInt()), + types.NewGenesisTotalPrincipal("btc-a", sdkmath.ZeroInt()), + types.NewGenesisTotalPrincipal("xrp-a", sdkmath.ZeroInt()), } var deposits types.Deposits @@ -215,9 +214,9 @@ func (suite *GenesisTestSuite) Test_InitExportGenesis() { { Denom: "xrp", Type: "xrp-a", - LiquidationRatio: sdk.MustNewDecFromStr("2.0"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("2.0"), DebtLimit: sdk.NewInt64Coin("usdx", 500000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), // 5% apr + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"), // 5% apr LiquidationPenalty: d("0.05"), AuctionSize: i(7000000000), SpotMarketID: "xrp:usd", @@ -229,9 +228,9 @@ func (suite *GenesisTestSuite) Test_InitExportGenesis() { { Denom: "btc", Type: "btc-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("1.5"), DebtLimit: sdk.NewInt64Coin("usdx", 500000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000000782997609"), // 2.5% apr + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.000000000782997609"), // 2.5% apr LiquidationPenalty: d("0.025"), AuctionSize: i(10000000), SpotMarketID: "btc:usd", @@ -254,8 +253,8 @@ func (suite *GenesisTestSuite) Test_InitExportGenesis() { CDPs: cdps, Deposits: deposits, PreviousAccumulationTimes: types.GenesisAccumulationTimes{ - types.NewGenesisAccumulationTime("btc-a", suite.genTime, sdk.OneDec()), - types.NewGenesisAccumulationTime("xrp-a", suite.genTime, sdk.OneDec()), + types.NewGenesisAccumulationTime("btc-a", suite.genTime, sdkmath.LegacyOneDec()), + types.NewGenesisAccumulationTime("xrp-a", suite.genTime, sdkmath.LegacyOneDec()), }, TotalPrincipals: genTotalPrincipals, } @@ -270,7 +269,7 @@ func (suite *GenesisTestSuite) Test_InitExportGenesis() { // We run the BeginBlocker at time.Now() to accumulate interest suite.ctx = suite.ctx.WithBlockTime(time.Now()) - cdp.BeginBlocker(suite.ctx, abci.RequestBeginBlock{}, suite.keeper) + cdp.BeginBlocker(suite.ctx, suite.keeper) expectedGenesis := cdpGenesis diff --git a/x/cdp/integration_test.go b/x/cdp/integration_test.go index 84255c29a7..7df6bf7ca7 100644 --- a/x/cdp/integration_test.go +++ b/x/cdp/integration_test.go @@ -16,11 +16,11 @@ import ( // Avoid cluttering test cases with long function names func i(in int64) sdkmath.Int { return sdkmath.NewInt(in) } -func d(str string) sdk.Dec { return sdk.MustNewDecFromStr(str) } +func d(str string) sdkmath.LegacyDec { return sdkmath.LegacyMustNewDecFromStr(str) } func c(denom string, amount int64) sdk.Coin { return sdk.NewInt64Coin(denom, amount) } func cs(coins ...sdk.Coin) sdk.Coins { return sdk.NewCoins(coins...) } -func NewPricefeedGenState(cdc codec.JSONCodec, asset string, price sdk.Dec) app.GenesisState { +func NewPricefeedGenState(cdc codec.JSONCodec, asset string, price sdkmath.LegacyDec) app.GenesisState { pfGenesis := pricefeedtypes.GenesisState{ Params: pricefeedtypes.Params{ Markets: []pricefeedtypes.Market{ @@ -39,7 +39,7 @@ func NewPricefeedGenState(cdc codec.JSONCodec, asset string, price sdk.Dec) app. return app.GenesisState{pricefeedtypes.ModuleName: cdc.MustMarshalJSON(&pfGenesis)} } -func NewCDPGenState(cdc codec.JSONCodec, asset string, liquidationRatio sdk.Dec) app.GenesisState { +func NewCDPGenState(cdc codec.JSONCodec, asset string, liquidationRatio sdkmath.LegacyDec) app.GenesisState { cdpGenesis := types.GenesisState{ Params: types.Params{ GlobalDebtLimit: sdk.NewInt64Coin("usdx", 1000000000000), @@ -53,7 +53,7 @@ func NewCDPGenState(cdc codec.JSONCodec, asset string, liquidationRatio sdk.Dec) Type: asset + "-a", LiquidationRatio: liquidationRatio, DebtLimit: sdk.NewInt64Coin("usdx", 1000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), // %5 apr + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"), // %5 apr LiquidationPenalty: d("0.05"), AuctionSize: i(1000000000), ConversionFactor: i(6), @@ -75,10 +75,10 @@ func NewCDPGenState(cdc codec.JSONCodec, asset string, liquidationRatio sdk.Dec) GovDenom: types.DefaultGovDenom, CDPs: types.CDPs{}, PreviousAccumulationTimes: types.GenesisAccumulationTimes{ - types.NewGenesisAccumulationTime(asset+"-a", time.Time{}, sdk.OneDec()), + types.NewGenesisAccumulationTime(asset+"-a", time.Time{}, sdkmath.LegacyOneDec()), }, TotalPrincipals: types.GenesisTotalPrincipals{ - types.NewGenesisTotalPrincipal(asset+"-a", sdk.ZeroInt()), + types.NewGenesisTotalPrincipal(asset+"-a", sdkmath.ZeroInt()), }, } return app.GenesisState{types.ModuleName: cdc.MustMarshalJSON(&cdpGenesis)} @@ -96,13 +96,13 @@ func NewPricefeedGenStateMulti(cdc codec.JSONCodec) app.GenesisState { { MarketID: "btc:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("8000.00"), + Price: sdkmath.LegacyMustNewDecFromStr("8000.00"), Expiry: time.Now().Add(1 * time.Hour), }, { MarketID: "xrp:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("0.25"), + Price: sdkmath.LegacyMustNewDecFromStr("0.25"), Expiry: time.Now().Add(1 * time.Hour), }, }, @@ -123,9 +123,9 @@ func NewCDPGenStateMulti(cdc codec.JSONCodec) app.GenesisState { { Denom: "xrp", Type: "xrp-a", - LiquidationRatio: sdk.MustNewDecFromStr("2.0"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("2.0"), DebtLimit: sdk.NewInt64Coin("usdx", 500000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), // %5 apr + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"), // %5 apr LiquidationPenalty: d("0.05"), AuctionSize: i(7000000000), SpotMarketID: "xrp:usd", @@ -137,9 +137,9 @@ func NewCDPGenStateMulti(cdc codec.JSONCodec) app.GenesisState { { Denom: "btc", Type: "btc-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("1.5"), DebtLimit: sdk.NewInt64Coin("usdx", 500000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000000782997609"), // %2.5 apr + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.000000000782997609"), // %2.5 apr LiquidationPenalty: d("0.025"), AuctionSize: i(10000000), SpotMarketID: "btc:usd", @@ -161,12 +161,12 @@ func NewCDPGenStateMulti(cdc codec.JSONCodec) app.GenesisState { GovDenom: types.DefaultGovDenom, CDPs: types.CDPs{}, PreviousAccumulationTimes: types.GenesisAccumulationTimes{ - types.NewGenesisAccumulationTime("btc-a", time.Time{}, sdk.OneDec()), - types.NewGenesisAccumulationTime("xrp-a", time.Time{}, sdk.OneDec()), + types.NewGenesisAccumulationTime("btc-a", time.Time{}, sdkmath.LegacyOneDec()), + types.NewGenesisAccumulationTime("xrp-a", time.Time{}, sdkmath.LegacyOneDec()), }, TotalPrincipals: types.GenesisTotalPrincipals{ - types.NewGenesisTotalPrincipal("btc-a", sdk.ZeroInt()), - types.NewGenesisTotalPrincipal("xrp-a", sdk.ZeroInt()), + types.NewGenesisTotalPrincipal("btc-a", sdkmath.ZeroInt()), + types.NewGenesisTotalPrincipal("xrp-a", sdkmath.ZeroInt()), }, } return app.GenesisState{types.ModuleName: cdc.MustMarshalJSON(&cdpGenesis)} @@ -174,10 +174,10 @@ func NewCDPGenStateMulti(cdc codec.JSONCodec) app.GenesisState { func cdps() (cdps types.CDPs) { _, addrs := app.GeneratePrivKeyAddressPairs(3) - c1 := types.NewCDP(uint64(1), addrs[0], sdk.NewCoin("xrp", sdkmath.NewInt(100000000)), "xrp-a", sdk.NewCoin("usdx", sdkmath.NewInt(8000000)), tmtime.Canonical(time.Now()), sdk.OneDec()) - c2 := types.NewCDP(uint64(2), addrs[1], sdk.NewCoin("xrp", sdkmath.NewInt(100000000)), "xrp-a", sdk.NewCoin("usdx", sdkmath.NewInt(10000000)), tmtime.Canonical(time.Now()), sdk.OneDec()) - c3 := types.NewCDP(uint64(3), addrs[1], sdk.NewCoin("btc", sdkmath.NewInt(1000000000)), "btc-a", sdk.NewCoin("usdx", sdkmath.NewInt(10000000)), tmtime.Canonical(time.Now()), sdk.OneDec()) - c4 := types.NewCDP(uint64(4), addrs[2], sdk.NewCoin("xrp", sdkmath.NewInt(1000000000)), "xrp-a", sdk.NewCoin("usdx", sdkmath.NewInt(50000000)), tmtime.Canonical(time.Now()), sdk.OneDec()) + c1 := types.NewCDP(uint64(1), addrs[0], sdk.NewCoin("xrp", sdkmath.NewInt(100000000)), "xrp-a", sdk.NewCoin("usdx", sdkmath.NewInt(8000000)), tmtime.Canonical(time.Now()), sdkmath.LegacyOneDec()) + c2 := types.NewCDP(uint64(2), addrs[1], sdk.NewCoin("xrp", sdkmath.NewInt(100000000)), "xrp-a", sdk.NewCoin("usdx", sdkmath.NewInt(10000000)), tmtime.Canonical(time.Now()), sdkmath.LegacyOneDec()) + c3 := types.NewCDP(uint64(3), addrs[1], sdk.NewCoin("btc", sdkmath.NewInt(1000000000)), "btc-a", sdk.NewCoin("usdx", sdkmath.NewInt(10000000)), tmtime.Canonical(time.Now()), sdkmath.LegacyOneDec()) + c4 := types.NewCDP(uint64(4), addrs[2], sdk.NewCoin("xrp", sdkmath.NewInt(1000000000)), "xrp-a", sdk.NewCoin("usdx", sdkmath.NewInt(50000000)), tmtime.Canonical(time.Now()), sdkmath.LegacyOneDec()) cdps = append(cdps, c1, c2, c3, c4) return } diff --git a/x/cdp/keeper/auctions.go b/x/cdp/keeper/auctions.go index 7ab0b600b4..2f2cb9bc2d 100644 --- a/x/cdp/keeper/auctions.go +++ b/x/cdp/keeper/auctions.go @@ -1,6 +1,7 @@ package keeper import ( + "context" sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" @@ -13,12 +14,13 @@ const ( ) // AuctionCollateral creates auctions from the input deposits which attempt to raise the corresponding amount of debt -func (k Keeper) AuctionCollateral(ctx sdk.Context, deposits types.Deposits, collateralType string, debt sdkmath.Int, bidDenom string) error { +func (k Keeper) AuctionCollateral(ctx context.Context, deposits types.Deposits, collateralType string, debt sdkmath.Int, bidDenom string) error { auctionSize := k.getAuctionSize(ctx, collateralType) totalCollateral := deposits.SumCollateral() + sdkCtx := sdk.UnwrapSDKContext(ctx) for _, deposit := range deposits { - debtCoveredByDeposit := (sdk.NewDecFromInt(deposit.Amount.Amount).Quo(sdk.NewDecFromInt(totalCollateral))).Mul(sdk.NewDecFromInt(debt)).RoundInt() - if err := k.CreateAuctionsFromDeposit(ctx, deposit.Amount, collateralType, deposit.Depositor, debtCoveredByDeposit, auctionSize, bidDenom); err != nil { + debtCoveredByDeposit := (sdkmath.LegacyNewDecFromInt(deposit.Amount.Amount).Quo(sdkmath.LegacyNewDecFromInt(totalCollateral))).Mul(sdkmath.LegacyNewDecFromInt(debt)).RoundInt() + if err := k.CreateAuctionsFromDeposit(sdkCtx, deposit.Amount, collateralType, deposit.Depositor, debtCoveredByDeposit, auctionSize, bidDenom); err != nil { return err } } @@ -50,8 +52,8 @@ func (k Keeper) CreateAuctionsFromDeposit( // if last auction has larger rounding error, then allocate one debt to last auction first // follows the largest remainder method https://en.wikipedia.org/wiki/Largest_remainder_method if lastAuctionError.GT(wholeAuctionError) { - lastAuctionDebt = lastAuctionDebt.Add(sdk.OneInt()) - unallocatedDebt = unallocatedDebt.Sub(sdk.OneInt()) + lastAuctionDebt = lastAuctionDebt.Add(sdkmath.OneInt()) + unallocatedDebt = unallocatedDebt.Sub(sdkmath.OneInt()) } debtDenom := k.GetDebtDenom(ctx) @@ -63,8 +65,8 @@ func (k Keeper) CreateAuctionsFromDeposit( // distribute unallocated debt left over starting with first auction created if unallocatedDebt.IsPositive() { - debtAmount = debtAmount.Add(sdk.OneInt()) - unallocatedDebt = unallocatedDebt.Sub(sdk.OneInt()) + debtAmount = debtAmount.Add(sdkmath.OneInt()) + unallocatedDebt = unallocatedDebt.Sub(sdkmath.OneInt()) } penalty := k.ApplyLiquidationPenalty(ctx, collateralType, debtAmount) @@ -88,8 +90,8 @@ func (k Keeper) CreateAuctionsFromDeposit( // then unallocatedDebt will be zero since we will have already distributed // all of the unallocated debt if unallocatedDebt.IsPositive() { - lastAuctionDebt = lastAuctionDebt.Add(sdk.OneInt()) - unallocatedDebt = unallocatedDebt.Sub(sdk.OneInt()) + lastAuctionDebt = lastAuctionDebt.Add(sdkmath.OneInt()) + unallocatedDebt = unallocatedDebt.Sub(sdkmath.OneInt()) } penalty := k.ApplyLiquidationPenalty(ctx, collateralType, lastAuctionDebt) @@ -105,16 +107,18 @@ func (k Keeper) CreateAuctionsFromDeposit( // NetSurplusAndDebt burns surplus and debt coins equal to the minimum of surplus and debt balances held by the liquidator module account // for example, if there is 1000 debt and 100 surplus, 100 surplus and 100 debt are burned, netting to 900 debt -func (k Keeper) NetSurplusAndDebt(ctx sdk.Context) error { +func (k Keeper) NetSurplusAndDebt(ctx context.Context) error { totalSurplus := k.GetTotalSurplus(ctx, types.LiquidatorMacc) debt := k.GetTotalDebt(ctx, types.LiquidatorMacc) - netAmount := sdk.MinInt(totalSurplus, debt) + netAmount := sdkmath.MinInt(totalSurplus, debt) if netAmount.IsZero() { return nil } + sdkCtx := sdk.UnwrapSDKContext(ctx) + // burn debt coins equal to netAmount - err := k.bankKeeper.BurnCoins(ctx, types.LiquidatorMacc, sdk.NewCoins(sdk.NewCoin(k.GetDebtDenom(ctx), netAmount))) + err := k.bankKeeper.BurnCoins(ctx, types.LiquidatorMacc, sdk.NewCoins(sdk.NewCoin(k.GetDebtDenom(sdkCtx), netAmount))) if err != nil { return err } @@ -123,37 +127,40 @@ func (k Keeper) NetSurplusAndDebt(ctx sdk.Context) error { dp := k.GetParams(ctx).DebtParam liquidatorAcc := k.accountKeeper.GetModuleAccount(ctx, types.LiquidatorMacc) balance := k.bankKeeper.GetBalance(ctx, liquidatorAcc.GetAddress(), dp.Denom).Amount - burnAmount := sdk.MinInt(balance, netAmount) + burnAmount := sdkmath.MinInt(balance, netAmount) return k.bankKeeper.BurnCoins(ctx, types.LiquidatorMacc, sdk.NewCoins(sdk.NewCoin(dp.Denom, burnAmount))) } // GetTotalSurplus returns the total amount of surplus tokens held by the liquidator module account -func (k Keeper) GetTotalSurplus(ctx sdk.Context, accountName string) sdkmath.Int { +func (k Keeper) GetTotalSurplus(ctx context.Context, accountName string) sdkmath.Int { acc := k.accountKeeper.GetModuleAccount(ctx, accountName) dp := k.GetParams(ctx).DebtParam return k.bankKeeper.GetBalance(ctx, acc.GetAddress(), dp.Denom).Amount } // GetTotalDebt returns the total amount of debt tokens held by the liquidator module account -func (k Keeper) GetTotalDebt(ctx sdk.Context, accountName string) sdkmath.Int { +func (k Keeper) GetTotalDebt(ctx context.Context, accountName string) sdkmath.Int { acc := k.accountKeeper.GetModuleAccount(ctx, accountName) - return k.bankKeeper.GetBalance(ctx, acc.GetAddress(), k.GetDebtDenom(ctx)).Amount + sdkCtx := sdk.UnwrapSDKContext(ctx) + return k.bankKeeper.GetBalance(ctx, acc.GetAddress(), k.GetDebtDenom(sdkCtx)).Amount } // RunSurplusAndDebtAuctions nets the surplus and debt balances and then creates surplus or debt auctions if the remaining balance is above the auction threshold parameter -func (k Keeper) RunSurplusAndDebtAuctions(ctx sdk.Context) error { +func (k Keeper) RunSurplusAndDebtAuctions(ctx context.Context) error { if err := k.NetSurplusAndDebt(ctx); err != nil { return err } remainingDebt := k.GetTotalDebt(ctx, types.LiquidatorMacc) params := k.GetParams(ctx) + sdkCtx := sdk.UnwrapSDKContext(ctx) + if remainingDebt.GTE(params.DebtAuctionThreshold) { - debtLot := sdk.NewCoin(k.GetDebtDenom(ctx), params.DebtAuctionLot) + debtLot := sdk.NewCoin(k.GetDebtDenom(sdkCtx), params.DebtAuctionLot) bidCoin := sdk.NewCoin(params.DebtParam.Denom, debtLot.Amount) - initialLot := sdk.NewCoin(k.GetGovDenom(ctx), debtLot.Amount.Mul(sdkmath.NewInt(dump))) + initialLot := sdk.NewCoin(k.GetGovDenom(sdkCtx), debtLot.Amount.Mul(sdkmath.NewInt(dump))) - _, err := k.auctionKeeper.StartDebtAuction(ctx, types.LiquidatorMacc, bidCoin, initialLot, debtLot) + _, err := k.auctionKeeper.StartDebtAuction(sdkCtx, types.LiquidatorMacc, bidCoin, initialLot, debtLot) if err != nil { return err } @@ -165,7 +172,7 @@ func (k Keeper) RunSurplusAndDebtAuctions(ctx sdk.Context) error { return nil } - surplusLot := sdk.NewCoin(params.DebtParam.Denom, sdk.MinInt(params.SurplusAuctionLot, surplus)) - _, err := k.auctionKeeper.StartSurplusAuction(ctx, types.LiquidatorMacc, surplusLot, k.GetGovDenom(ctx)) + surplusLot := sdk.NewCoin(params.DebtParam.Denom, sdkmath.MinInt(params.SurplusAuctionLot, surplus)) + _, err := k.auctionKeeper.StartSurplusAuction(sdkCtx, types.LiquidatorMacc, surplusLot, k.GetGovDenom(sdkCtx)) return err } diff --git a/x/cdp/keeper/auctions_test.go b/x/cdp/keeper/auctions_test.go index ba230542d9..6caff835ce 100644 --- a/x/cdp/keeper/auctions_test.go +++ b/x/cdp/keeper/auctions_test.go @@ -32,7 +32,7 @@ func (suite *AuctionTestSuite) SetupTest() { app.SetBech32AddressPrefixes(config) tApp := app.NewTestApp() taddr := sdk.AccAddress(crypto.AddressHash([]byte("KavaTestUser1"))) - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) authGS := app.NewFundedGenStateWithSameCoins(tApp.AppCodec(), cs(c("usdx", 21000000000)), []sdk.AccAddress{taddr}) tApp.InitializeFromGenesisStates( authGS, diff --git a/x/cdp/keeper/cdp.go b/x/cdp/keeper/cdp.go index ddd78bf290..e088aa3870 100644 --- a/x/cdp/keeper/cdp.go +++ b/x/cdp/keeper/cdp.go @@ -1,24 +1,27 @@ package keeper import ( + "context" + sdkmath "cosmossdk.io/math" "fmt" "sort" errorsmod "cosmossdk.io/errors" - "github.com/cosmos/cosmos-sdk/store/prefix" + "cosmossdk.io/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/kava-labs/kava/x/cdp/types" ) // AddCdp adds a cdp for a specific owner and collateral type -func (k Keeper) AddCdp(ctx sdk.Context, owner sdk.AccAddress, collateral sdk.Coin, principal sdk.Coin, collateralType string) error { +func (k Keeper) AddCdp(ctx context.Context, owner sdk.AccAddress, collateral sdk.Coin, principal sdk.Coin, collateralType string) error { // validation - err := k.ValidateCollateral(ctx, collateral, collateralType) + sdkCtx := sdk.UnwrapSDKContext(ctx) + err := k.ValidateCollateral(sdkCtx, collateral, collateralType) if err != nil { return err } - err = k.ValidateBalance(ctx, collateral, owner) + err = k.ValidateBalance(sdkCtx, collateral, owner) if err != nil { return err } @@ -26,29 +29,29 @@ func (k Keeper) AddCdp(ctx sdk.Context, owner sdk.AccAddress, collateral sdk.Coi if found { return errorsmod.Wrapf(types.ErrCdpAlreadyExists, "owner %s, denom %s", owner, collateral.Denom) } - err = k.ValidatePrincipalAdd(ctx, principal) + err = k.ValidatePrincipalAdd(sdkCtx, principal) if err != nil { return err } - err = k.ValidateDebtLimit(ctx, collateralType, principal) + err = k.ValidateDebtLimit(sdkCtx, collateralType, principal) if err != nil { return err } - err = k.ValidateCollateralizationRatio(ctx, collateral, collateralType, principal, sdk.NewCoin(principal.Denom, sdk.ZeroInt())) + err = k.ValidateCollateralizationRatio(sdkCtx, collateral, collateralType, principal, sdk.NewCoin(principal.Denom, sdkmath.ZeroInt())) if err != nil { return err } // send coins from the owners account to the cdp module - id := k.GetNextCdpID(ctx) + id := k.GetNextCdpID(sdkCtx) interestFactor, found := k.GetInterestFactor(ctx, collateralType) if !found { - interestFactor = sdk.OneDec() + interestFactor = sdkmath.LegacyOneDec() k.SetInterestFactor(ctx, collateralType, interestFactor) } - cdp := types.NewCDP(id, owner, collateral, collateralType, principal, ctx.BlockHeader().Time, interestFactor) + cdp := types.NewCDP(id, owner, collateral, collateralType, principal, sdkCtx.BlockHeader().Time, interestFactor) deposit := types.NewDeposit(cdp.ID, owner, collateral) err = k.bankKeeper.SendCoinsFromAccountToModule(ctx, owner, types.ModuleName, sdk.NewCoins(collateral)) if err != nil { @@ -66,41 +69,41 @@ func (k Keeper) AddCdp(ctx sdk.Context, owner sdk.AccAddress, collateral sdk.Coi } // mint the corresponding amount of debt coins - err = k.MintDebtCoins(ctx, types.ModuleName, k.GetDebtDenom(ctx), principal) + err = k.MintDebtCoins(ctx, types.ModuleName, k.GetDebtDenom(sdkCtx), principal) if err != nil { panic(err) } // update total principal for input collateral type - k.IncrementTotalPrincipal(ctx, collateralType, principal) + k.IncrementTotalPrincipal(sdkCtx, collateralType, principal) // set the cdp, deposit, and indexes in the store - collateralToDebtRatio := k.CalculateCollateralToDebtRatio(ctx, collateral, cdp.Type, principal) + collateralToDebtRatio := k.CalculateCollateralToDebtRatio(sdkCtx, collateral, cdp.Type, principal) err = k.SetCdpAndCollateralRatioIndex(ctx, cdp, collateralToDebtRatio) if err != nil { return err } - k.IndexCdpByOwner(ctx, cdp) + k.IndexCdpByOwner(sdkCtx, cdp) k.SetDeposit(ctx, deposit) - k.SetNextCdpID(ctx, id+1) + k.SetNextCdpID(sdkCtx, id+1) - k.hooks.AfterCDPCreated(ctx, cdp) + k.hooks.AfterCDPCreated(sdkCtx, cdp) // emit events for cdp creation, deposit, and draw - ctx.EventManager().EmitEvent( + sdkCtx.EventManager().EmitEvent( sdk.NewEvent( types.EventTypeCreateCdp, sdk.NewAttribute(types.AttributeKeyCdpID, fmt.Sprintf("%d", cdp.ID)), ), ) - ctx.EventManager().EmitEvent( + sdkCtx.EventManager().EmitEvent( sdk.NewEvent( types.EventTypeCdpDeposit, sdk.NewAttribute(sdk.AttributeKeyAmount, collateral.String()), sdk.NewAttribute(types.AttributeKeyCdpID, fmt.Sprintf("%d", cdp.ID)), ), ) - ctx.EventManager().EmitEvent( + sdkCtx.EventManager().EmitEvent( sdk.NewEvent( types.EventTypeCdpDraw, sdk.NewAttribute(sdk.AttributeKeyAmount, principal.String()), @@ -112,67 +115,73 @@ func (k Keeper) AddCdp(ctx sdk.Context, owner sdk.AccAddress, collateral sdk.Coi } // UpdateCdpAndCollateralRatioIndex updates the state of an existing cdp in the store by replacing the old index values and updating the store to the latest cdp object values -func (k Keeper) UpdateCdpAndCollateralRatioIndex(ctx sdk.Context, cdp types.CDP, ratio sdk.Dec) error { +func (k Keeper) UpdateCdpAndCollateralRatioIndex(ctx context.Context, cdp types.CDP, ratio sdkmath.LegacyDec) error { err := k.removeOldCollateralRatioIndex(ctx, cdp.Type, cdp.ID) if err != nil { return err } - err = k.SetCDP(ctx, cdp) + sdkCtx := sdk.UnwrapSDKContext(ctx) + err = k.SetCDP(sdkCtx, cdp) if err != nil { return err } - k.IndexCdpByCollateralRatio(ctx, cdp.Type, cdp.ID, ratio) + k.IndexCdpByCollateralRatio(sdkCtx, cdp.Type, cdp.ID, ratio) return nil } // DeleteCdpAndCollateralRatioIndex deletes an existing cdp in the store by removing the old index value and deleting the cdp object from the store -func (k Keeper) DeleteCdpAndCollateralRatioIndex(ctx sdk.Context, cdp types.CDP) error { +func (k Keeper) DeleteCdpAndCollateralRatioIndex(ctx context.Context, cdp types.CDP) error { err := k.removeOldCollateralRatioIndex(ctx, cdp.Type, cdp.ID) if err != nil { return err } - return k.DeleteCDP(ctx, cdp) + sdkCtx := sdk.UnwrapSDKContext(ctx) + + return k.DeleteCDP(sdkCtx, cdp) } // SetCdpAndCollateralRatioIndex sets the cdp and collateral ratio index in the store -func (k Keeper) SetCdpAndCollateralRatioIndex(ctx sdk.Context, cdp types.CDP, ratio sdk.Dec) error { - err := k.SetCDP(ctx, cdp) +func (k Keeper) SetCdpAndCollateralRatioIndex(ctx context.Context, cdp types.CDP, ratio sdkmath.LegacyDec) error { + sdkCtx := sdk.UnwrapSDKContext(ctx) + err := k.SetCDP(sdkCtx, cdp) if err != nil { return err } - k.IndexCdpByCollateralRatio(ctx, cdp.Type, cdp.ID, ratio) + k.IndexCdpByCollateralRatio(sdkCtx, cdp.Type, cdp.ID, ratio) return nil } -func (k Keeper) removeOldCollateralRatioIndex(ctx sdk.Context, ctype string, id uint64) error { +func (k Keeper) removeOldCollateralRatioIndex(ctx context.Context, ctype string, id uint64) error { storedCDP, found := k.GetCDP(ctx, ctype, id) if !found { return errorsmod.Wrapf(types.ErrCdpNotFound, "%d", storedCDP.ID) } - oldCollateralToDebtRatio := k.CalculateCollateralToDebtRatio(ctx, storedCDP.Collateral, storedCDP.Type, storedCDP.GetTotalPrincipal()) - k.RemoveCdpCollateralRatioIndex(ctx, storedCDP.Type, storedCDP.ID, oldCollateralToDebtRatio) + + sdkCtx := sdk.UnwrapSDKContext(ctx) + oldCollateralToDebtRatio := k.CalculateCollateralToDebtRatio(sdkCtx, storedCDP.Collateral, storedCDP.Type, storedCDP.GetTotalPrincipal()) + k.RemoveCdpCollateralRatioIndex(sdkCtx, storedCDP.Type, storedCDP.ID, oldCollateralToDebtRatio) return nil } // MintDebtCoins mints debt coins in the cdp module account -func (k Keeper) MintDebtCoins(ctx sdk.Context, moduleAccount string, denom string, principalCoins sdk.Coin) error { +func (k Keeper) MintDebtCoins(ctx context.Context, moduleAccount string, denom string, principalCoins sdk.Coin) error { debtCoins := sdk.NewCoins(sdk.NewCoin(denom, principalCoins.Amount)) return k.bankKeeper.MintCoins(ctx, moduleAccount, debtCoins) } // BurnDebtCoins burns debt coins from the cdp module account -func (k Keeper) BurnDebtCoins(ctx sdk.Context, moduleAccount string, denom string, paymentCoins sdk.Coin) error { +func (k Keeper) BurnDebtCoins(ctx context.Context, moduleAccount string, denom string, paymentCoins sdk.Coin) error { macc := k.accountKeeper.GetModuleAccount(ctx, moduleAccount) maxBurnableAmount := k.bankKeeper.GetBalance(ctx, macc.GetAddress(), denom).Amount // check that the requested burn is not greater than the mod account balance - debtCoins := sdk.NewCoins(sdk.NewCoin(denom, sdk.MinInt(paymentCoins.Amount, maxBurnableAmount))) + debtCoins := sdk.NewCoins(sdk.NewCoin(denom, sdkmath.MinInt(paymentCoins.Amount, maxBurnableAmount))) return k.bankKeeper.BurnCoins(ctx, moduleAccount, debtCoins) } // GetCdpID returns the id of the cdp corresponding to a specific owner and collateral denom -func (k Keeper) GetCdpID(ctx sdk.Context, owner sdk.AccAddress, collateralType string) (uint64, bool) { +func (k Keeper) GetCdpID(ctx context.Context, owner sdk.AccAddress, collateralType string) (uint64, bool) { cdpIDs, found := k.GetCdpIdsByOwner(ctx, owner) if !found { return 0, false @@ -187,8 +196,9 @@ func (k Keeper) GetCdpID(ctx sdk.Context, owner sdk.AccAddress, collateralType s } // GetCdpIdsByOwner returns all the ids of cdps corresponding to a particular owner -func (k Keeper) GetCdpIdsByOwner(ctx sdk.Context, owner sdk.AccAddress) ([]uint64, bool) { - store := prefix.NewStore(ctx.KVStore(k.key), types.CdpIDKeyPrefix) +func (k Keeper) GetCdpIdsByOwner(ctx context.Context, owner sdk.AccAddress) ([]uint64, bool) { + sdkCtx := sdk.UnwrapSDKContext(ctx) + store := prefix.NewStore(sdkCtx.KVStore(k.key), types.CdpIDKeyPrefix) bz := store.Get(owner) if bz == nil { return []uint64{}, false @@ -200,7 +210,7 @@ func (k Keeper) GetCdpIdsByOwner(ctx sdk.Context, owner sdk.AccAddress) ([]uint6 } // GetCdpByOwnerAndCollateralType queries cdps owned by owner and returns the cdp with matching denom -func (k Keeper) GetCdpByOwnerAndCollateralType(ctx sdk.Context, owner sdk.AccAddress, collateralType string) (types.CDP, bool) { +func (k Keeper) GetCdpByOwnerAndCollateralType(ctx context.Context, owner sdk.AccAddress, collateralType string) (types.CDP, bool) { cdpIDs, found := k.GetCdpIdsByOwner(ctx, owner) if !found { return types.CDP{}, false @@ -215,9 +225,10 @@ func (k Keeper) GetCdpByOwnerAndCollateralType(ctx sdk.Context, owner sdk.AccAdd } // GetCDP returns the cdp associated with a particular collateral denom and id -func (k Keeper) GetCDP(ctx sdk.Context, collateralType string, cdpID uint64) (types.CDP, bool) { +func (k Keeper) GetCDP(ctx context.Context, collateralType string, cdpID uint64) (types.CDP, bool) { // get store - store := prefix.NewStore(ctx.KVStore(k.key), types.CdpKeyPrefix) + sdkCtx := sdk.UnwrapSDKContext(ctx) + store := prefix.NewStore(sdkCtx.KVStore(k.key), types.CdpKeyPrefix) _, found := k.GetCollateral(ctx, collateralType) if !found { return types.CDP{}, false @@ -275,7 +286,7 @@ func (k Keeper) GetAllCdpsByCollateralType(ctx sdk.Context, collateralType strin } // GetAllCdpsByCollateralTypeAndRatio returns all cdps of a particular collateral type and below a certain collateralization ratio -func (k Keeper) GetAllCdpsByCollateralTypeAndRatio(ctx sdk.Context, collateralType string, targetRatio sdk.Dec) (cdps types.CDPs) { +func (k Keeper) GetAllCdpsByCollateralTypeAndRatio(ctx sdk.Context, collateralType string, targetRatio sdkmath.LegacyDec) (cdps types.CDPs) { k.IterateCdpsByCollateralRatio(ctx, collateralType, targetRatio, func(cdp types.CDP) bool { cdps = append(cdps, cdp) return false @@ -342,7 +353,7 @@ func (k Keeper) RemoveCdpOwnerIndex(ctx sdk.Context, cdp types.CDP) { } // IndexCdpByCollateralRatio sets the cdp id in the store, indexed by the collateral type and collateral to debt ratio -func (k Keeper) IndexCdpByCollateralRatio(ctx sdk.Context, collateralType string, id uint64, collateralRatio sdk.Dec) { +func (k Keeper) IndexCdpByCollateralRatio(ctx sdk.Context, collateralType string, id uint64, collateralRatio sdkmath.LegacyDec) { store := prefix.NewStore(ctx.KVStore(k.key), types.CollateralRatioIndexPrefix) _, found := k.GetCollateral(ctx, collateralType) if !found { @@ -352,7 +363,7 @@ func (k Keeper) IndexCdpByCollateralRatio(ctx sdk.Context, collateralType string } // RemoveCdpCollateralRatioIndex deletes the cdp id from the store's index of cdps by collateral type and collateral to debt ratio -func (k Keeper) RemoveCdpCollateralRatioIndex(ctx sdk.Context, collateralType string, id uint64, collateralRatio sdk.Dec) { +func (k Keeper) RemoveCdpCollateralRatioIndex(ctx sdk.Context, collateralType string, id uint64, collateralRatio sdkmath.LegacyDec) { store := prefix.NewStore(ctx.KVStore(k.key), types.CollateralRatioIndexPrefix) _, found := k.GetCollateral(ctx, collateralType) if !found { @@ -483,11 +494,11 @@ func (k Keeper) ValidateBalance(ctx sdk.Context, amount sdk.Coin, sender sdk.Acc } // CalculateCollateralToDebtRatio returns the collateral to debt ratio of the input collateral and debt amounts -func (k Keeper) CalculateCollateralToDebtRatio(ctx sdk.Context, collateral sdk.Coin, collateralType string, debt sdk.Coin) sdk.Dec { +func (k Keeper) CalculateCollateralToDebtRatio(ctx sdk.Context, collateral sdk.Coin, collateralType string, debt sdk.Coin) sdkmath.LegacyDec { debtTotal := k.convertDebtToBaseUnits(ctx, debt) if debtTotal.IsZero() || debtTotal.GTE(types.MaxSortableDec) { - return types.MaxSortableDec.Sub(sdk.SmallestDec()) + return types.MaxSortableDec.Sub(sdkmath.LegacySmallestDec()) } collateralBaseUnits := k.convertCollateralToBaseUnits(ctx, collateral, collateralType) @@ -515,7 +526,7 @@ func (k Keeper) LoadAugmentedCDP(ctx sdk.Context, cdp types.CDP) types.Augmented } // convert collateral value to debt coin totalDebt := cdp.GetTotalPrincipal().Amount - collateralValueInDebtDenom := sdk.NewDecFromInt(totalDebt).Mul(collateralizationRatio) + collateralValueInDebtDenom := sdkmath.LegacyNewDecFromInt(totalDebt).Mul(collateralizationRatio) collateralValueInDebt := sdk.NewCoin(cdp.Principal.Denom, collateralValueInDebtDenom.RoundInt()) // create new augmuented cdp augmentedCDP := types.NewAugmentedCDP(cdp, collateralValueInDebt, collateralizationRatio) @@ -552,16 +563,16 @@ func (k Keeper) LoadCDPResponse(ctx sdk.Context, cdp types.CDP) types.CDPRespons } // convert collateral value to debt coin totalDebt := cdp.GetTotalPrincipal().Amount - collateralValueInDebtDenom := sdk.NewDecFromInt(totalDebt).Mul(collateralizationRatio) + collateralValueInDebtDenom := sdkmath.LegacyNewDecFromInt(totalDebt).Mul(collateralizationRatio) collateralValueInDebt := sdk.NewCoin(cdp.Principal.Denom, collateralValueInDebtDenom.RoundInt()) // create new cdp response return types.NewCDPResponse(cdp, collateralValueInDebt, collateralizationRatio) } // CalculateCollateralizationRatio returns the collateralization ratio of the input collateral to the input debt plus fees -func (k Keeper) CalculateCollateralizationRatio(ctx sdk.Context, collateral sdk.Coin, collateralType string, principal sdk.Coin, fees sdk.Coin, pfType pricefeedType) (sdk.Dec, error) { +func (k Keeper) CalculateCollateralizationRatio(ctx sdk.Context, collateral sdk.Coin, collateralType string, principal sdk.Coin, fees sdk.Coin, pfType pricefeedType) (sdkmath.LegacyDec, error) { if collateral.IsZero() { - return sdk.ZeroDec(), nil + return sdkmath.LegacyZeroDec(), nil } var marketID string switch pfType { @@ -570,12 +581,12 @@ func (k Keeper) CalculateCollateralizationRatio(ctx sdk.Context, collateral sdk. case liquidation: marketID = k.getliquidationMarketID(ctx, collateralType) default: - return sdk.Dec{}, pfType.IsValid() + return sdkmath.LegacyDec{}, pfType.IsValid() } price, err := k.pricefeedKeeper.GetCurrentPrice(ctx, marketID) if err != nil { - return sdk.Dec{}, err + return sdkmath.LegacyDec{}, err } collateralBaseUnits := k.convertCollateralToBaseUnits(ctx, collateral, collateralType) collateralValue := collateralBaseUnits.Mul(price.Price) @@ -590,7 +601,7 @@ func (k Keeper) CalculateCollateralizationRatio(ctx sdk.Context, collateral sdk. } // CalculateCollateralizationRatioFromAbsoluteRatio takes a coin's denom and an absolute ratio and returns the respective collateralization ratio -func (k Keeper) CalculateCollateralizationRatioFromAbsoluteRatio(ctx sdk.Context, collateralType string, absoluteRatio sdk.Dec, pfType pricefeedType) (sdk.Dec, error) { +func (k Keeper) CalculateCollateralizationRatioFromAbsoluteRatio(ctx sdk.Context, collateralType string, absoluteRatio sdkmath.LegacyDec, pfType pricefeedType) (sdkmath.LegacyDec, error) { // get price of collateral var marketID string switch pfType { @@ -599,12 +610,12 @@ func (k Keeper) CalculateCollateralizationRatioFromAbsoluteRatio(ctx sdk.Context case liquidation: marketID = k.getliquidationMarketID(ctx, collateralType) default: - return sdk.Dec{}, pfType.IsValid() + return sdkmath.LegacyDec{}, pfType.IsValid() } price, err := k.pricefeedKeeper.GetCurrentPrice(ctx, marketID) if err != nil { - return sdk.Dec{}, err + return sdkmath.LegacyDec{}, err } // convert absolute ratio to collateralization ratio respectiveCollateralRatio := absoluteRatio.Quo(price.Price) @@ -640,15 +651,15 @@ func (k Keeper) UpdatePricefeedStatus(ctx sdk.Context, marketID string) (ok bool } // converts the input collateral to base units (ie multiplies the input by 10^(-ConversionFactor)) -func (k Keeper) convertCollateralToBaseUnits(ctx sdk.Context, collateral sdk.Coin, collateralType string) (baseUnits sdk.Dec) { +func (k Keeper) convertCollateralToBaseUnits(ctx sdk.Context, collateral sdk.Coin, collateralType string) (baseUnits sdkmath.LegacyDec) { cp, _ := k.GetCollateral(ctx, collateralType) - return sdk.NewDecFromInt(collateral.Amount).Mul(sdk.NewDecFromIntWithPrec(sdk.OneInt(), cp.ConversionFactor.Int64())) + return sdkmath.LegacyNewDecFromInt(collateral.Amount).Mul(sdkmath.LegacyNewDecFromIntWithPrec(sdkmath.OneInt(), cp.ConversionFactor.Int64())) } // converts the input debt to base units (ie multiplies the input by 10^(-ConversionFactor)) -func (k Keeper) convertDebtToBaseUnits(ctx sdk.Context, debt sdk.Coin) (baseUnits sdk.Dec) { +func (k Keeper) convertDebtToBaseUnits(ctx sdk.Context, debt sdk.Coin) (baseUnits sdkmath.LegacyDec) { dp, _ := k.GetDebtParam(ctx, debt.Denom) - return sdk.NewDecFromInt(debt.Amount).Mul(sdk.NewDecFromIntWithPrec(sdk.OneInt(), dp.ConversionFactor.Int64())) + return sdkmath.LegacyNewDecFromInt(debt.Amount).Mul(sdkmath.LegacyNewDecFromIntWithPrec(sdkmath.OneInt(), dp.ConversionFactor.Int64())) } type pricefeedType string diff --git a/x/cdp/keeper/cdp_test.go b/x/cdp/keeper/cdp_test.go index 9c4b5203bc..e54fee87a6 100644 --- a/x/cdp/keeper/cdp_test.go +++ b/x/cdp/keeper/cdp_test.go @@ -28,7 +28,7 @@ type CdpTestSuite struct { func (suite *CdpTestSuite) SetupTest() { tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) tApp.InitializeFromGenesisStates( NewPricefeedGenStateMulti(tApp.AppCodec()), NewCDPGenStateMulti(tApp.AppCodec()), @@ -134,7 +134,7 @@ func (suite *CdpTestSuite) TestGetNextCdpID() { func (suite *CdpTestSuite) TestGetSetCdp() { _, addrs := app.GeneratePrivKeyAddressPairs(1) - cdp := types.NewCDP(types.DefaultCdpStartingID, addrs[0], c("xrp", 1), "xrp-a", c("usdx", 1), tmtime.Canonical(time.Now()), sdk.OneDec()) + cdp := types.NewCDP(types.DefaultCdpStartingID, addrs[0], c("xrp", 1), "xrp-a", c("usdx", 1), tmtime.Canonical(time.Now()), sdkmath.LegacyOneDec()) err := suite.keeper.SetCDP(suite.ctx, cdp) suite.NoError(err) @@ -150,7 +150,7 @@ func (suite *CdpTestSuite) TestGetSetCdp() { func (suite *CdpTestSuite) TestGetSetCdpId() { _, addrs := app.GeneratePrivKeyAddressPairs(2) - cdp := types.NewCDP(types.DefaultCdpStartingID, addrs[0], c("xrp", 1), "xrp-a", c("usdx", 1), tmtime.Canonical(time.Now()), sdk.OneDec()) + cdp := types.NewCDP(types.DefaultCdpStartingID, addrs[0], c("xrp", 1), "xrp-a", c("usdx", 1), tmtime.Canonical(time.Now()), sdkmath.LegacyOneDec()) err := suite.keeper.SetCDP(suite.ctx, cdp) suite.NoError(err) suite.keeper.IndexCdpByOwner(suite.ctx, cdp) @@ -165,7 +165,7 @@ func (suite *CdpTestSuite) TestGetSetCdpId() { func (suite *CdpTestSuite) TestGetSetCdpByOwnerAndCollateralType() { _, addrs := app.GeneratePrivKeyAddressPairs(2) - cdp := types.NewCDP(types.DefaultCdpStartingID, addrs[0], c("xrp", 1), "xrp-a", c("usdx", 1), tmtime.Canonical(time.Now()), sdk.OneDec()) + cdp := types.NewCDP(types.DefaultCdpStartingID, addrs[0], c("xrp", 1), "xrp-a", c("usdx", 1), tmtime.Canonical(time.Now()), sdkmath.LegacyOneDec()) err := suite.keeper.SetCDP(suite.ctx, cdp) suite.NoError(err) suite.keeper.IndexCdpByOwner(suite.ctx, cdp) @@ -181,17 +181,17 @@ func (suite *CdpTestSuite) TestGetSetCdpByOwnerAndCollateralType() { func (suite *CdpTestSuite) TestCalculateCollateralToDebtRatio() { _, addrs := app.GeneratePrivKeyAddressPairs(1) - cdp := types.NewCDP(types.DefaultCdpStartingID, addrs[0], c("xrp", 3), "xrp-a", c("usdx", 1), tmtime.Canonical(time.Now()), sdk.OneDec()) + cdp := types.NewCDP(types.DefaultCdpStartingID, addrs[0], c("xrp", 3), "xrp-a", c("usdx", 1), tmtime.Canonical(time.Now()), sdkmath.LegacyOneDec()) cr := suite.keeper.CalculateCollateralToDebtRatio(suite.ctx, cdp.Collateral, cdp.Type, cdp.Principal) - suite.Equal(sdk.MustNewDecFromStr("3.0"), cr) - cdp = types.NewCDP(types.DefaultCdpStartingID, addrs[0], c("xrp", 1), "xrp-a", c("usdx", 2), tmtime.Canonical(time.Now()), sdk.OneDec()) + suite.Equal(sdkmath.LegacyMustNewDecFromStr("3.0"), cr) + cdp = types.NewCDP(types.DefaultCdpStartingID, addrs[0], c("xrp", 1), "xrp-a", c("usdx", 2), tmtime.Canonical(time.Now()), sdkmath.LegacyOneDec()) cr = suite.keeper.CalculateCollateralToDebtRatio(suite.ctx, cdp.Collateral, cdp.Type, cdp.Principal) - suite.Equal(sdk.MustNewDecFromStr("0.5"), cr) + suite.Equal(sdkmath.LegacyMustNewDecFromStr("0.5"), cr) } func (suite *CdpTestSuite) TestSetCdpByCollateralRatio() { _, addrs := app.GeneratePrivKeyAddressPairs(1) - cdp := types.NewCDP(types.DefaultCdpStartingID, addrs[0], c("xrp", 3), "xrp-a", c("usdx", 1), tmtime.Canonical(time.Now()), sdk.OneDec()) + cdp := types.NewCDP(types.DefaultCdpStartingID, addrs[0], c("xrp", 3), "xrp-a", c("usdx", 1), tmtime.Canonical(time.Now()), sdkmath.LegacyOneDec()) cr := suite.keeper.CalculateCollateralToDebtRatio(suite.ctx, cdp.Collateral, cdp.Type, cdp.Principal) suite.NotPanics(func() { suite.keeper.IndexCdpByCollateralRatio(suite.ctx, cdp.Type, cdp.ID, cr) }) } @@ -245,11 +245,11 @@ func (suite *CdpTestSuite) TestIterateCdpsByCollateralRatio() { } xrpCdps := suite.keeper.GetAllCdpsByCollateralTypeAndRatio(suite.ctx, "xrp-a", d("1.25")) suite.Equal(0, len(xrpCdps)) - xrpCdps = suite.keeper.GetAllCdpsByCollateralTypeAndRatio(suite.ctx, "xrp-a", d("1.25").Add(sdk.SmallestDec())) + xrpCdps = suite.keeper.GetAllCdpsByCollateralTypeAndRatio(suite.ctx, "xrp-a", d("1.25").Add(sdkmath.LegacySmallestDec())) suite.Equal(1, len(xrpCdps)) - xrpCdps = suite.keeper.GetAllCdpsByCollateralTypeAndRatio(suite.ctx, "xrp-a", d("2.0").Add(sdk.SmallestDec())) + xrpCdps = suite.keeper.GetAllCdpsByCollateralTypeAndRatio(suite.ctx, "xrp-a", d("2.0").Add(sdkmath.LegacySmallestDec())) suite.Equal(2, len(xrpCdps)) - xrpCdps = suite.keeper.GetAllCdpsByCollateralTypeAndRatio(suite.ctx, "xrp-a", d("100.0").Add(sdk.SmallestDec())) + xrpCdps = suite.keeper.GetAllCdpsByCollateralTypeAndRatio(suite.ctx, "xrp-a", d("100.0").Add(sdkmath.LegacySmallestDec())) suite.Equal(3, len(xrpCdps)) suite.NoError(suite.keeper.DeleteCDP(suite.ctx, cdps[0])) @@ -257,7 +257,7 @@ func (suite *CdpTestSuite) TestIterateCdpsByCollateralRatio() { suite.keeper.RemoveCdpOwnerIndex(suite.ctx, cdps[0]) cr := suite.keeper.CalculateCollateralToDebtRatio(suite.ctx, cdps[0].Collateral, cdps[0].Type, cdps[0].Principal) suite.keeper.RemoveCdpCollateralRatioIndex(suite.ctx, cdps[0].Type, cdps[0].ID, cr) - xrpCdps = suite.keeper.GetAllCdpsByCollateralTypeAndRatio(suite.ctx, "xrp-a", d("2.0").Add(sdk.SmallestDec())) + xrpCdps = suite.keeper.GetAllCdpsByCollateralTypeAndRatio(suite.ctx, "xrp-a", d("2.0").Add(sdkmath.LegacySmallestDec())) suite.Equal(1, len(xrpCdps)) } diff --git a/x/cdp/keeper/deposit.go b/x/cdp/keeper/deposit.go index a2edf65df2..894df9a0c8 100644 --- a/x/cdp/keeper/deposit.go +++ b/x/cdp/keeper/deposit.go @@ -1,19 +1,22 @@ package keeper import ( + "context" + storetypes "cosmossdk.io/store/types" "fmt" errorsmod "cosmossdk.io/errors" - "github.com/cosmos/cosmos-sdk/store/prefix" + "cosmossdk.io/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/kava-labs/kava/x/cdp/types" ) // DepositCollateral adds collateral to a cdp -func (k Keeper) DepositCollateral(ctx sdk.Context, owner, depositor sdk.AccAddress, collateral sdk.Coin, collateralType string) error { +func (k Keeper) DepositCollateral(ctx context.Context, owner, depositor sdk.AccAddress, collateral sdk.Coin, collateralType string) error { + sdkCtx := sdk.UnwrapSDKContext(ctx) // check that collateral exists and has a functioning pricefeed - err := k.ValidateCollateral(ctx, collateral, collateralType) + err := k.ValidateCollateral(sdkCtx, collateral, collateralType) if err != nil { return err } @@ -21,11 +24,11 @@ func (k Keeper) DepositCollateral(ctx sdk.Context, owner, depositor sdk.AccAddre if !found { return errorsmod.Wrapf(types.ErrCdpNotFound, "owner %s, collateral %s", owner, collateralType) } - err = k.ValidateBalance(ctx, collateral, depositor) + err = k.ValidateBalance(sdkCtx, collateral, depositor) if err != nil { return err } - k.hooks.BeforeCDPModified(ctx, cdp) + k.hooks.BeforeCDPModified(sdkCtx, cdp) cdp = k.SynchronizeInterest(ctx, cdp) deposit, found := k.GetDeposit(ctx, cdp.ID, depositor) @@ -42,9 +45,9 @@ func (k Keeper) DepositCollateral(ctx sdk.Context, owner, depositor sdk.AccAddre k.SetDeposit(ctx, deposit) cdp.Collateral = cdp.Collateral.Add(collateral) - collateralToDebtRatio := k.CalculateCollateralToDebtRatio(ctx, cdp.Collateral, cdp.Type, cdp.GetTotalPrincipal()) + collateralToDebtRatio := k.CalculateCollateralToDebtRatio(sdkCtx, cdp.Collateral, cdp.Type, cdp.GetTotalPrincipal()) - ctx.EventManager().EmitEvent( + sdkCtx.EventManager().EmitEvent( sdk.NewEvent( types.EventTypeCdpDeposit, sdk.NewAttribute(sdk.AttributeKeyAmount, collateral.String()), @@ -56,8 +59,9 @@ func (k Keeper) DepositCollateral(ctx sdk.Context, owner, depositor sdk.AccAddre } // WithdrawCollateral removes collateral from a cdp if it does not put the cdp below the liquidation ratio -func (k Keeper) WithdrawCollateral(ctx sdk.Context, owner, depositor sdk.AccAddress, collateral sdk.Coin, collateralType string) error { - err := k.ValidateCollateral(ctx, collateral, collateralType) +func (k Keeper) WithdrawCollateral(ctx context.Context, owner, depositor sdk.AccAddress, collateral sdk.Coin, collateralType string) error { + sdkCtx := sdk.UnwrapSDKContext(ctx) + err := k.ValidateCollateral(sdkCtx, collateral, collateralType) if err != nil { return err } @@ -72,10 +76,10 @@ func (k Keeper) WithdrawCollateral(ctx sdk.Context, owner, depositor sdk.AccAddr if collateral.Amount.GT(deposit.Amount.Amount) { return errorsmod.Wrapf(types.ErrInvalidWithdrawAmount, "collateral %s, deposit %s", collateral, deposit.Amount) } - k.hooks.BeforeCDPModified(ctx, cdp) + k.hooks.BeforeCDPModified(sdkCtx, cdp) cdp = k.SynchronizeInterest(ctx, cdp) - collateralizationRatio, err := k.CalculateCollateralizationRatio(ctx, cdp.Collateral.Sub(collateral), cdp.Type, cdp.Principal, cdp.AccumulatedFees, spot) + collateralizationRatio, err := k.CalculateCollateralizationRatio(sdkCtx, cdp.Collateral.Sub(collateral), cdp.Type, cdp.Principal, cdp.AccumulatedFees, spot) if err != nil { return err } @@ -90,7 +94,7 @@ func (k Keeper) WithdrawCollateral(ctx sdk.Context, owner, depositor sdk.AccAddr } cdp.Collateral = cdp.Collateral.Sub(collateral) - collateralToDebtRatio := k.CalculateCollateralToDebtRatio(ctx, cdp.Collateral, cdp.Type, cdp.GetTotalPrincipal()) + collateralToDebtRatio := k.CalculateCollateralToDebtRatio(sdkCtx, cdp.Collateral, cdp.Type, cdp.GetTotalPrincipal()) err = k.UpdateCdpAndCollateralRatioIndex(ctx, cdp, collateralToDebtRatio) if err != nil { return err @@ -104,7 +108,7 @@ func (k Keeper) WithdrawCollateral(ctx sdk.Context, owner, depositor sdk.AccAddr k.SetDeposit(ctx, deposit) } - ctx.EventManager().EmitEvent( + sdkCtx.EventManager().EmitEvent( sdk.NewEvent( types.EventTypeCdpWithdrawal, sdk.NewAttribute(sdk.AttributeKeyAmount, collateral.String()), @@ -116,8 +120,9 @@ func (k Keeper) WithdrawCollateral(ctx sdk.Context, owner, depositor sdk.AccAddr } // GetDeposit returns the deposit of a depositor on a particular cdp from the store -func (k Keeper) GetDeposit(ctx sdk.Context, cdpID uint64, depositor sdk.AccAddress) (deposit types.Deposit, found bool) { - store := prefix.NewStore(ctx.KVStore(k.key), types.DepositKeyPrefix) +func (k Keeper) GetDeposit(ctx context.Context, cdpID uint64, depositor sdk.AccAddress) (deposit types.Deposit, found bool) { + sdkCtx := sdk.UnwrapSDKContext(ctx) + store := prefix.NewStore(sdkCtx.KVStore(k.key), types.DepositKeyPrefix) bz := store.Get(types.DepositKey(cdpID, depositor)) if bz == nil { return deposit, false @@ -127,23 +132,26 @@ func (k Keeper) GetDeposit(ctx sdk.Context, cdpID uint64, depositor sdk.AccAddre } // SetDeposit sets the deposit in the store -func (k Keeper) SetDeposit(ctx sdk.Context, deposit types.Deposit) { - store := prefix.NewStore(ctx.KVStore(k.key), types.DepositKeyPrefix) +func (k Keeper) SetDeposit(ctx context.Context, deposit types.Deposit) { + sdkCtx := sdk.UnwrapSDKContext(ctx) + store := prefix.NewStore(sdkCtx.KVStore(k.key), types.DepositKeyPrefix) bz := k.cdc.MustMarshal(&deposit) store.Set(types.DepositKey(deposit.CdpID, deposit.Depositor), bz) } // DeleteDeposit deletes a deposit from the store -func (k Keeper) DeleteDeposit(ctx sdk.Context, cdpID uint64, depositor sdk.AccAddress) { - store := prefix.NewStore(ctx.KVStore(k.key), types.DepositKeyPrefix) +func (k Keeper) DeleteDeposit(ctx context.Context, cdpID uint64, depositor sdk.AccAddress) { + sdkCtx := sdk.UnwrapSDKContext(ctx) + store := prefix.NewStore(sdkCtx.KVStore(k.key), types.DepositKeyPrefix) store.Delete(types.DepositKey(cdpID, depositor)) } // IterateDeposits iterates over the all the deposits of a cdp and performs a callback function -func (k Keeper) IterateDeposits(ctx sdk.Context, cdpID uint64, cb func(deposit types.Deposit) (stop bool)) { - store := prefix.NewStore(ctx.KVStore(k.key), types.DepositKeyPrefix) - iterator := sdk.KVStorePrefixIterator(store, types.GetCdpIDBytes(cdpID)) +func (k Keeper) IterateDeposits(ctx context.Context, cdpID uint64, cb func(deposit types.Deposit) (stop bool)) { + sdkCtx := sdk.UnwrapSDKContext(ctx) + store := prefix.NewStore(sdkCtx.KVStore(k.key), types.DepositKeyPrefix) + iterator := storetypes.KVStorePrefixIterator(store, types.GetCdpIDBytes(cdpID)) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { @@ -157,7 +165,7 @@ func (k Keeper) IterateDeposits(ctx sdk.Context, cdpID uint64, cb func(deposit t } // GetDeposits returns all the deposits to a cdp -func (k Keeper) GetDeposits(ctx sdk.Context, cdpID uint64) (deposits types.Deposits) { +func (k Keeper) GetDeposits(ctx context.Context, cdpID uint64) (deposits types.Deposits) { k.IterateDeposits(ctx, cdpID, func(deposit types.Deposit) bool { deposits = append(deposits, deposit) return false diff --git a/x/cdp/keeper/deposit_test.go b/x/cdp/keeper/deposit_test.go index 070c50b1d3..fbf9f4f0e7 100644 --- a/x/cdp/keeper/deposit_test.go +++ b/x/cdp/keeper/deposit_test.go @@ -27,7 +27,7 @@ type DepositTestSuite struct { func (suite *DepositTestSuite) SetupTest() { tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) cdc := tApp.AppCodec() _, addrs := app.GeneratePrivKeyAddressPairs(10) diff --git a/x/cdp/keeper/draw.go b/x/cdp/keeper/draw.go index 3b09f470d6..2e187c885c 100644 --- a/x/cdp/keeper/draw.go +++ b/x/cdp/keeper/draw.go @@ -1,6 +1,8 @@ package keeper import ( + "context" + sdkmath "cosmossdk.io/math" "fmt" errorsmod "cosmossdk.io/errors" @@ -71,32 +73,33 @@ func (k Keeper) AddPrincipal(ctx sdk.Context, owner sdk.AccAddress, collateralTy // RepayPrincipal removes debt from the cdp // If all debt is repaid, the collateral is returned to depositors and the cdp is removed from the store -func (k Keeper) RepayPrincipal(ctx sdk.Context, owner sdk.AccAddress, collateralType string, payment sdk.Coin) error { +func (k Keeper) RepayPrincipal(ctx context.Context, owner sdk.AccAddress, collateralType string, payment sdk.Coin) error { + sdkCtx := sdk.UnwrapSDKContext(ctx) // validation cdp, found := k.GetCdpByOwnerAndCollateralType(ctx, owner, collateralType) if !found { return errorsmod.Wrapf(types.ErrCdpNotFound, "owner %s, denom %s", owner, collateralType) } - err := k.ValidatePaymentCoins(ctx, cdp, payment) + err := k.ValidatePaymentCoins(sdkCtx, cdp, payment) if err != nil { return err } - err = k.ValidateBalance(ctx, payment, owner) + err = k.ValidateBalance(sdkCtx, payment, owner) if err != nil { return err } - k.hooks.BeforeCDPModified(ctx, cdp) + k.hooks.BeforeCDPModified(sdkCtx, cdp) cdp = k.SynchronizeInterest(ctx, cdp) // Note: assumes cdp.Principal and cdp.AccumulatedFees don't change during calculations totalPrincipal := cdp.GetTotalPrincipal() // calculate fee and principal payment - feePayment, principalPayment := k.calculatePayment(ctx, totalPrincipal, cdp.AccumulatedFees, payment) + feePayment, principalPayment := k.calculatePayment(sdkCtx, totalPrincipal, cdp.AccumulatedFees, payment) - err = k.validatePrincipalPayment(ctx, cdp, principalPayment) + err = k.validatePrincipalPayment(sdkCtx, cdp, principalPayment) if err != nil { return err } @@ -113,10 +116,10 @@ func (k Keeper) RepayPrincipal(ctx sdk.Context, owner sdk.AccAddress, collateral } // burn the corresponding amount of debt coins - cdpDebt := k.getModAccountDebt(ctx, types.ModuleName) + cdpDebt := k.getModAccountDebt(sdkCtx, types.ModuleName) paymentAmount := feePayment.Add(principalPayment).Amount - debtDenom := k.GetDebtDenom(ctx) + debtDenom := k.GetDebtDenom(sdkCtx) coinsToBurn := sdk.NewCoin(debtDenom, paymentAmount) if paymentAmount.GT(cdpDebt) { @@ -130,7 +133,7 @@ func (k Keeper) RepayPrincipal(ctx sdk.Context, owner sdk.AccAddress, collateral } // emit repayment event - ctx.EventManager().EmitEvent( + sdkCtx.EventManager().EmitEvent( sdk.NewEvent( types.EventTypeCdpRepay, sdk.NewAttribute(sdk.AttributeKeyAmount, feePayment.Add(principalPayment).String()), @@ -152,15 +155,15 @@ func (k Keeper) RepayPrincipal(ctx sdk.Context, owner sdk.AccAddress, collateral // if the debt is fully paid, return collateral to depositors, // and remove the cdp and indexes from the store if cdp.Principal.IsZero() && cdp.AccumulatedFees.IsZero() { - k.ReturnCollateral(ctx, cdp) - k.RemoveCdpOwnerIndex(ctx, cdp) + k.ReturnCollateral(sdkCtx, cdp) + k.RemoveCdpOwnerIndex(sdkCtx, cdp) err := k.DeleteCdpAndCollateralRatioIndex(ctx, cdp) if err != nil { return err } // emit cdp close event - ctx.EventManager().EmitEvent( + sdkCtx.EventManager().EmitEvent( sdk.NewEvent( types.EventTypeCdpClose, sdk.NewAttribute(types.AttributeKeyCdpID, fmt.Sprintf("%d", cdp.ID)), @@ -170,7 +173,7 @@ func (k Keeper) RepayPrincipal(ctx sdk.Context, owner sdk.AccAddress, collateral } // set cdp state and update indexes - collateralToDebtRatio := k.CalculateCollateralToDebtRatio(ctx, cdp.Collateral, cdp.Type, cdp.GetTotalPrincipal()) + collateralToDebtRatio := k.CalculateCollateralToDebtRatio(sdkCtx, cdp.Collateral, cdp.Type, cdp.GetTotalPrincipal()) return k.UpdateCdpAndCollateralRatioIndex(ctx, cdp, collateralToDebtRatio) } @@ -205,8 +208,8 @@ func (k Keeper) ReturnCollateral(ctx sdk.Context, cdp types.CDP) { func (k Keeper) calculatePayment(ctx sdk.Context, owed, fees, payment sdk.Coin) (sdk.Coin, sdk.Coin) { // divides repayment into principal and fee components, with fee payment applied first. - feePayment := sdk.NewCoin(payment.Denom, sdk.ZeroInt()) - principalPayment := sdk.NewCoin(payment.Denom, sdk.ZeroInt()) + feePayment := sdk.NewCoin(payment.Denom, sdkmath.ZeroInt()) + principalPayment := sdk.NewCoin(payment.Denom, sdkmath.ZeroInt()) var overpayment sdk.Coin // return zero value coins if payment amount is invalid if !payment.Amount.IsPositive() { @@ -236,7 +239,7 @@ func (k Keeper) calculatePayment(ctx sdk.Context, owed, fees, payment sdk.Coin) func (k Keeper) validatePrincipalPayment(ctx sdk.Context, cdp types.CDP, payment sdk.Coin) error { proposedBalance := cdp.Principal.Amount.Sub(payment.Amount) dp, _ := k.GetDebtParam(ctx, payment.Denom) - if proposedBalance.GT(sdk.ZeroInt()) && proposedBalance.LT(dp.DebtFloor) { + if proposedBalance.GT(sdkmath.ZeroInt()) && proposedBalance.LT(dp.DebtFloor) { return errorsmod.Wrapf(types.ErrBelowDebtFloor, "proposed %s < minimum %s", sdk.NewCoin(payment.Denom, proposedBalance), dp.DebtFloor) } return nil diff --git a/x/cdp/keeper/draw_test.go b/x/cdp/keeper/draw_test.go index e3d6f9797a..8c30cc59fc 100644 --- a/x/cdp/keeper/draw_test.go +++ b/x/cdp/keeper/draw_test.go @@ -1,6 +1,7 @@ package keeper_test import ( + sdkmath "cosmossdk.io/math" "errors" "testing" "time" @@ -28,7 +29,7 @@ type DrawTestSuite struct { func (suite *DrawTestSuite) SetupTest() { tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) cdc := tApp.AppCodec() _, addrs := app.GeneratePrivKeyAddressPairs(3) coins := []sdk.Coins{ @@ -63,7 +64,7 @@ func (suite *DrawTestSuite) TestAddRepayPrincipal() { suite.Equal(d("20.0"), ctd) ts := suite.keeper.GetAllCdpsByCollateralTypeAndRatio(suite.ctx, "xrp-a", d("20.0")) suite.Equal(0, len(ts)) - ts = suite.keeper.GetAllCdpsByCollateralTypeAndRatio(suite.ctx, "xrp-a", d("20.0").Add(sdk.SmallestDec())) + ts = suite.keeper.GetAllCdpsByCollateralTypeAndRatio(suite.ctx, "xrp-a", d("20.0").Add(sdkmath.LegacySmallestDec())) suite.Equal(ts[0], t) tp := suite.keeper.GetTotalPrincipal(suite.ctx, "xrp-a", "usdx") suite.Equal(i(20000000), tp) @@ -95,7 +96,7 @@ func (suite *DrawTestSuite) TestAddRepayPrincipal() { suite.Equal(d("40.0"), ctd) ts = suite.keeper.GetAllCdpsByCollateralTypeAndRatio(suite.ctx, "xrp-a", d("40.0")) suite.Equal(0, len(ts)) - ts = suite.keeper.GetAllCdpsByCollateralTypeAndRatio(suite.ctx, "xrp-a", d("40.0").Add(sdk.SmallestDec())) + ts = suite.keeper.GetAllCdpsByCollateralTypeAndRatio(suite.ctx, "xrp-a", d("40.0").Add(sdkmath.LegacySmallestDec())) suite.Equal(ts[0], t) ak = suite.app.GetAccountKeeper() diff --git a/x/cdp/keeper/grpc_query.go b/x/cdp/keeper/grpc_query.go index c81ac91245..a1436035bc 100644 --- a/x/cdp/keeper/grpc_query.go +++ b/x/cdp/keeper/grpc_query.go @@ -2,6 +2,7 @@ package keeper import ( "context" + sdkmath "cosmossdk.io/math" "sort" errorsmod "cosmossdk.io/errors" @@ -134,7 +135,7 @@ func (s QueryServer) TotalCollateral(c context.Context, req *types.QueryTotalCol for i := len(collateralTypes) - 1; i > 0; i-- { cdps := s.keeper.GetAllCdpsByCollateralType(ctx, collateralTypes[i]) - collateral := sdk.ZeroInt() + collateral := sdkmath.ZeroInt() for _, cdp := range cdps { collateral = collateral.Add(cdp.Collateral.Amount) @@ -258,10 +259,10 @@ func GrpcFilterCDPs(ctx sdk.Context, k Keeper, req types.QueryCdpsRequest) (type } } - ratio := sdk.ZeroDec() + ratio := sdkmath.LegacyZeroDec() if req.Ratio != "" { - ratio, err = sdk.NewDecFromStr(req.Ratio) + ratio, err = sdkmath.LegacyNewDecFromStr(req.Ratio) if err != nil { if err != nil { return nil, status.Errorf(codes.InvalidArgument, "invalid ratio") diff --git a/x/cdp/keeper/grpc_query_test.go b/x/cdp/keeper/grpc_query_test.go index 3c1e06d031..e886903f54 100644 --- a/x/cdp/keeper/grpc_query_test.go +++ b/x/cdp/keeper/grpc_query_test.go @@ -1,11 +1,12 @@ package keeper_test import ( + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + tmtime "github.com/cometbft/cometbft/types/time" "testing" "time" sdkmath "cosmossdk.io/math" - tmprototypes "github.com/cometbft/cometbft/proto/tendermint/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/query" "github.com/kava-labs/kava/app" @@ -31,8 +32,7 @@ func (suite *grpcQueryTestSuite) SetupTest() { NewPricefeedGenStateMulti(suite.tApp.AppCodec()), NewCDPGenStateMulti(suite.tApp.AppCodec()), ) - suite.ctx = suite.tApp.NewContext(true, tmprototypes.Header{}). - WithBlockTime(time.Now().UTC()) + suite.ctx = suite.tApp.NewContextLegacy(true, tmproto.Header{Time: tmtime.Now()}) suite.keeper = suite.tApp.GetCDPKeeper() suite.queryServer = keeper.NewQueryServerImpl(suite.keeper) diff --git a/x/cdp/keeper/integration_test.go b/x/cdp/keeper/integration_test.go index 8f64e3f178..ac3a6a6735 100644 --- a/x/cdp/keeper/integration_test.go +++ b/x/cdp/keeper/integration_test.go @@ -16,11 +16,11 @@ import ( // Avoid cluttering test cases with long function names func i(in int64) sdkmath.Int { return sdkmath.NewInt(in) } -func d(str string) sdk.Dec { return sdk.MustNewDecFromStr(str) } +func d(str string) sdkmath.LegacyDec { return sdkmath.LegacyMustNewDecFromStr(str) } func c(denom string, amount int64) sdk.Coin { return sdk.NewInt64Coin(denom, amount) } func cs(coins ...sdk.Coin) sdk.Coins { return sdk.NewCoins(coins...) } -func NewPricefeedGenState(cdc codec.JSONCodec, asset string, price sdk.Dec) app.GenesisState { +func NewPricefeedGenState(cdc codec.JSONCodec, asset string, price sdkmath.LegacyDec) app.GenesisState { pfGenesis := pricefeedtypes.GenesisState{ Params: pricefeedtypes.Params{ Markets: []pricefeedtypes.Market{ @@ -39,7 +39,7 @@ func NewPricefeedGenState(cdc codec.JSONCodec, asset string, price sdk.Dec) app. return app.GenesisState{pricefeedtypes.ModuleName: cdc.MustMarshalJSON(&pfGenesis)} } -func NewCDPGenState(cdc codec.JSONCodec, asset string, liquidationRatio sdk.Dec) app.GenesisState { +func NewCDPGenState(cdc codec.JSONCodec, asset string, liquidationRatio sdkmath.LegacyDec) app.GenesisState { cdpGenesis := types.GenesisState{ Params: types.Params{ GlobalDebtLimit: sdk.NewInt64Coin("usdx", 1000000000000), @@ -54,7 +54,7 @@ func NewCDPGenState(cdc codec.JSONCodec, asset string, liquidationRatio sdk.Dec) Type: asset + "-a", LiquidationRatio: liquidationRatio, DebtLimit: sdk.NewInt64Coin("usdx", 1000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), // %5 apr + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"), // %5 apr LiquidationPenalty: d("0.05"), AuctionSize: i(100), SpotMarketID: asset + ":usd", @@ -76,10 +76,10 @@ func NewCDPGenState(cdc codec.JSONCodec, asset string, liquidationRatio sdk.Dec) GovDenom: types.DefaultGovDenom, CDPs: types.CDPs{}, PreviousAccumulationTimes: types.GenesisAccumulationTimes{ - types.NewGenesisAccumulationTime(asset+"-a", time.Time{}, sdk.OneDec()), + types.NewGenesisAccumulationTime(asset+"-a", time.Time{}, sdkmath.LegacyOneDec()), }, TotalPrincipals: types.GenesisTotalPrincipals{ - types.NewGenesisTotalPrincipal(asset+"-a", sdk.ZeroInt()), + types.NewGenesisTotalPrincipal(asset+"-a", sdkmath.ZeroInt()), }, } return app.GenesisState{types.ModuleName: cdc.MustMarshalJSON(&cdpGenesis)} @@ -103,49 +103,49 @@ func NewPricefeedGenStateMulti(cdc codec.JSONCodec) app.GenesisState { { MarketID: "btc:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("8000.00"), + Price: sdkmath.LegacyMustNewDecFromStr("8000.00"), Expiry: time.Now().Add(1 * time.Hour), }, { MarketID: "btc:usd:30", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("8000.00"), + Price: sdkmath.LegacyMustNewDecFromStr("8000.00"), Expiry: time.Now().Add(1 * time.Hour), }, { MarketID: "xrp:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("0.25"), + Price: sdkmath.LegacyMustNewDecFromStr("0.25"), Expiry: time.Now().Add(1 * time.Hour), }, { MarketID: "xrp:usd:30", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("0.25"), + Price: sdkmath.LegacyMustNewDecFromStr("0.25"), Expiry: time.Now().Add(1 * time.Hour), }, { MarketID: "bnb:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("17.25"), + Price: sdkmath.LegacyMustNewDecFromStr("17.25"), Expiry: time.Now().Add(1 * time.Hour), }, { MarketID: "bnb:usd:30", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("17.25"), + Price: sdkmath.LegacyMustNewDecFromStr("17.25"), Expiry: time.Now().Add(1 * time.Hour), }, { MarketID: "busd:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.OneDec(), + Price: sdkmath.LegacyOneDec(), Expiry: time.Now().Add(1 * time.Hour), }, { MarketID: "busd:usd:30", OracleAddress: sdk.AccAddress{}, - Price: sdk.OneDec(), + Price: sdkmath.LegacyOneDec(), Expiry: time.Now().Add(1 * time.Hour), }, }, @@ -166,9 +166,9 @@ func NewCDPGenStateMulti(cdc codec.JSONCodec) app.GenesisState { { Denom: "xrp", Type: "xrp-a", - LiquidationRatio: sdk.MustNewDecFromStr("2.0"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("2.0"), DebtLimit: sdk.NewInt64Coin("usdx", 500000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), // %5 apr + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"), // %5 apr LiquidationPenalty: d("0.05"), AuctionSize: i(7000000000), SpotMarketID: "xrp:usd", @@ -180,9 +180,9 @@ func NewCDPGenStateMulti(cdc codec.JSONCodec) app.GenesisState { { Denom: "btc", Type: "btc-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("1.5"), DebtLimit: sdk.NewInt64Coin("usdx", 500000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000000782997609"), // %2.5 apr + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.000000000782997609"), // %2.5 apr LiquidationPenalty: d("0.025"), AuctionSize: i(10000000), SpotMarketID: "btc:usd", @@ -194,9 +194,9 @@ func NewCDPGenStateMulti(cdc codec.JSONCodec) app.GenesisState { { Denom: "bnb", Type: "bnb-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("1.5"), DebtLimit: sdk.NewInt64Coin("usdx", 500000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), // %5 apr + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"), // %5 apr LiquidationPenalty: d("0.05"), AuctionSize: i(50000000000), SpotMarketID: "bnb:usd", @@ -210,7 +210,7 @@ func NewCDPGenStateMulti(cdc codec.JSONCodec) app.GenesisState { Type: "busd-a", LiquidationRatio: d("1.01"), DebtLimit: sdk.NewInt64Coin("usdx", 500000000000), - StabilityFee: sdk.OneDec(), // %0 apr + StabilityFee: sdkmath.LegacyOneDec(), // %0 apr LiquidationPenalty: d("0.05"), AuctionSize: i(10000000000), SpotMarketID: "busd:usd", @@ -232,16 +232,16 @@ func NewCDPGenStateMulti(cdc codec.JSONCodec) app.GenesisState { GovDenom: types.DefaultGovDenom, CDPs: types.CDPs{}, PreviousAccumulationTimes: types.GenesisAccumulationTimes{ - types.NewGenesisAccumulationTime("btc-a", time.Time{}, sdk.OneDec()), - types.NewGenesisAccumulationTime("xrp-a", time.Time{}, sdk.OneDec()), - types.NewGenesisAccumulationTime("busd-a", time.Time{}, sdk.OneDec()), - types.NewGenesisAccumulationTime("bnb-a", time.Time{}, sdk.OneDec()), + types.NewGenesisAccumulationTime("btc-a", time.Time{}, sdkmath.LegacyOneDec()), + types.NewGenesisAccumulationTime("xrp-a", time.Time{}, sdkmath.LegacyOneDec()), + types.NewGenesisAccumulationTime("busd-a", time.Time{}, sdkmath.LegacyOneDec()), + types.NewGenesisAccumulationTime("bnb-a", time.Time{}, sdkmath.LegacyOneDec()), }, TotalPrincipals: types.GenesisTotalPrincipals{ - types.NewGenesisTotalPrincipal("btc-a", sdk.ZeroInt()), - types.NewGenesisTotalPrincipal("xrp-a", sdk.ZeroInt()), - types.NewGenesisTotalPrincipal("busd-a", sdk.ZeroInt()), - types.NewGenesisTotalPrincipal("bnb-a", sdk.ZeroInt()), + types.NewGenesisTotalPrincipal("btc-a", sdkmath.ZeroInt()), + types.NewGenesisTotalPrincipal("xrp-a", sdkmath.ZeroInt()), + types.NewGenesisTotalPrincipal("busd-a", sdkmath.ZeroInt()), + types.NewGenesisTotalPrincipal("bnb-a", sdkmath.ZeroInt()), }, } return app.GenesisState{types.ModuleName: cdc.MustMarshalJSON(&cdpGenesis)} @@ -260,9 +260,9 @@ func NewCDPGenStateHighDebtLimit(cdc codec.JSONCodec) app.GenesisState { { Denom: "xrp", Type: "xrp-a", - LiquidationRatio: sdk.MustNewDecFromStr("2.0"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("2.0"), DebtLimit: sdk.NewInt64Coin("usdx", 50000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), // %5 apr + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"), // %5 apr LiquidationPenalty: d("0.05"), AuctionSize: i(7000000000), SpotMarketID: "xrp:usd", @@ -274,9 +274,9 @@ func NewCDPGenStateHighDebtLimit(cdc codec.JSONCodec) app.GenesisState { { Denom: "btc", Type: "btc-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("1.5"), DebtLimit: sdk.NewInt64Coin("usdx", 50000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000000782997609"), // %2.5 apr + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.000000000782997609"), // %2.5 apr LiquidationPenalty: d("0.025"), AuctionSize: i(10000000), SpotMarketID: "btc:usd", @@ -298,12 +298,12 @@ func NewCDPGenStateHighDebtLimit(cdc codec.JSONCodec) app.GenesisState { GovDenom: types.DefaultGovDenom, CDPs: types.CDPs{}, PreviousAccumulationTimes: types.GenesisAccumulationTimes{ - types.NewGenesisAccumulationTime("btc-a", time.Time{}, sdk.OneDec()), - types.NewGenesisAccumulationTime("xrp-a", time.Time{}, sdk.OneDec()), + types.NewGenesisAccumulationTime("btc-a", time.Time{}, sdkmath.LegacyOneDec()), + types.NewGenesisAccumulationTime("xrp-a", time.Time{}, sdkmath.LegacyOneDec()), }, TotalPrincipals: types.GenesisTotalPrincipals{ - types.NewGenesisTotalPrincipal("btc-a", sdk.ZeroInt()), - types.NewGenesisTotalPrincipal("xrp-a", sdk.ZeroInt()), + types.NewGenesisTotalPrincipal("btc-a", sdkmath.ZeroInt()), + types.NewGenesisTotalPrincipal("xrp-a", sdkmath.ZeroInt()), }, } return app.GenesisState{types.ModuleName: cdc.MustMarshalJSON(&cdpGenesis)} @@ -311,10 +311,10 @@ func NewCDPGenStateHighDebtLimit(cdc codec.JSONCodec) app.GenesisState { func cdps() (cdps types.CDPs) { _, addrs := app.GeneratePrivKeyAddressPairs(3) - c1 := types.NewCDP(uint64(1), addrs[0], sdk.NewCoin("xrp", sdkmath.NewInt(10000000)), "xrp-a", sdk.NewCoin("usdx", sdkmath.NewInt(8000000)), tmtime.Canonical(time.Now()), sdk.OneDec()) - c2 := types.NewCDP(uint64(2), addrs[1], sdk.NewCoin("xrp", sdkmath.NewInt(100000000)), "xrp-a", sdk.NewCoin("usdx", sdkmath.NewInt(10000000)), tmtime.Canonical(time.Now()), sdk.OneDec()) - c3 := types.NewCDP(uint64(3), addrs[1], sdk.NewCoin("btc", sdkmath.NewInt(1000000000)), "btc-a", sdk.NewCoin("usdx", sdkmath.NewInt(10000000)), tmtime.Canonical(time.Now()), sdk.OneDec()) - c4 := types.NewCDP(uint64(4), addrs[2], sdk.NewCoin("xrp", sdkmath.NewInt(1000000000)), "xrp-a", sdk.NewCoin("usdx", sdkmath.NewInt(500000000)), tmtime.Canonical(time.Now()), sdk.OneDec()) + c1 := types.NewCDP(uint64(1), addrs[0], sdk.NewCoin("xrp", sdkmath.NewInt(10000000)), "xrp-a", sdk.NewCoin("usdx", sdkmath.NewInt(8000000)), tmtime.Canonical(time.Now()), sdkmath.LegacyOneDec()) + c2 := types.NewCDP(uint64(2), addrs[1], sdk.NewCoin("xrp", sdkmath.NewInt(100000000)), "xrp-a", sdk.NewCoin("usdx", sdkmath.NewInt(10000000)), tmtime.Canonical(time.Now()), sdkmath.LegacyOneDec()) + c3 := types.NewCDP(uint64(3), addrs[1], sdk.NewCoin("btc", sdkmath.NewInt(1000000000)), "btc-a", sdk.NewCoin("usdx", sdkmath.NewInt(10000000)), tmtime.Canonical(time.Now()), sdkmath.LegacyOneDec()) + c4 := types.NewCDP(uint64(4), addrs[2], sdk.NewCoin("xrp", sdkmath.NewInt(1000000000)), "xrp-a", sdk.NewCoin("usdx", sdkmath.NewInt(500000000)), tmtime.Canonical(time.Now()), sdkmath.LegacyOneDec()) cdps = append(cdps, c1, c2, c3, c4) return } diff --git a/x/cdp/keeper/interest.go b/x/cdp/keeper/interest.go index fb86d08dd6..5198bdcec3 100644 --- a/x/cdp/keeper/interest.go +++ b/x/cdp/keeper/interest.go @@ -1,11 +1,12 @@ package keeper import ( + "context" "fmt" "math" sdkmath "cosmossdk.io/math" - "github.com/cosmos/cosmos-sdk/store/prefix" + "cosmossdk.io/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/kava-labs/kava/x/cdp/types" @@ -15,15 +16,22 @@ var scalingFactor = 1e18 // AccumulateInterest calculates the new interest that has accrued for the input collateral type based on the total amount of principal // that has been created with that collateral type and the amount of time that has passed since interest was last accumulated -func (k Keeper) AccumulateInterest(ctx sdk.Context, ctype string) error { +func (k Keeper) AccumulateInterest(ctx context.Context, ctype string) error { + sdkCtx := sdk.UnwrapSDKContext(ctx) + + // suite.ctx = suite.ctx.WithBlockTime(suite.ctx.BlockTime().Add(time.Second * 6)) + // cdp.BeginBlocker(suite.ctx, suite.keeper) + // // block time with balance 2024-10-24 04:02:57.651655 +0000 UTC 1000000027 + // fmt.Println("balance time with balance", suite.ctx.BlockTime(), bk.GetBalance(suite.ctx, cdpMacc.GetAddress(), "debt").Amount.Int64()) + previousAccrualTime, found := k.GetPreviousAccrualTime(ctx, ctype) if !found { - k.SetPreviousAccrualTime(ctx, ctype, ctx.BlockTime()) + k.SetPreviousAccrualTime(ctx, ctype, sdkCtx.BlockTime()) return nil } timeElapsed := int64(math.RoundToEven( - ctx.BlockTime().Sub(previousAccrualTime).Seconds(), + sdkCtx.BlockTime().Sub(previousAccrualTime).Seconds(), )) if timeElapsed == 0 { return nil @@ -31,30 +39,30 @@ func (k Keeper) AccumulateInterest(ctx sdk.Context, ctype string) error { totalPrincipalPrior := k.GetTotalPrincipal(ctx, ctype, types.DefaultStableDenom) if totalPrincipalPrior.IsZero() || totalPrincipalPrior.IsNegative() { - k.SetPreviousAccrualTime(ctx, ctype, ctx.BlockTime()) + k.SetPreviousAccrualTime(ctx, ctype, sdkCtx.BlockTime()) return nil } interestFactorPrior, foundInterestFactorPrior := k.GetInterestFactor(ctx, ctype) if !foundInterestFactorPrior { - k.SetInterestFactor(ctx, ctype, sdk.OneDec()) + k.SetInterestFactor(ctx, ctype, sdkmath.LegacyOneDec()) // set previous accrual time exit early because interest accumulated will be zero - k.SetPreviousAccrualTime(ctx, ctype, ctx.BlockTime()) + k.SetPreviousAccrualTime(ctx, ctype, sdkCtx.BlockTime()) return nil } borrowRateSpy := k.getFeeRate(ctx, ctype) - if borrowRateSpy.Equal(sdk.OneDec()) { - k.SetPreviousAccrualTime(ctx, ctype, ctx.BlockTime()) + if borrowRateSpy.Equal(sdkmath.LegacyOneDec()) { + k.SetPreviousAccrualTime(ctx, ctype, sdkCtx.BlockTime()) return nil } interestFactor := CalculateInterestFactor(borrowRateSpy, sdkmath.NewInt(timeElapsed)) - interestAccumulated := (interestFactor.Mul(sdk.NewDecFromInt(totalPrincipalPrior))).RoundInt().Sub(totalPrincipalPrior) + interestAccumulated := (interestFactor.Mul(sdkmath.LegacyNewDecFromInt(totalPrincipalPrior))).RoundInt().Sub(totalPrincipalPrior) if interestAccumulated.IsZero() { // in the case accumulated interest rounds to zero, exit early without updating accrual time return nil } - err := k.MintDebtCoins(ctx, types.ModuleName, k.GetDebtDenom(ctx), sdk.NewCoin(types.DefaultStableDenom, interestAccumulated)) + err := k.MintDebtCoins(ctx, types.ModuleName, k.GetDebtDenom(sdkCtx), sdk.NewCoin(types.DefaultStableDenom, interestAccumulated)) if err != nil { return err } @@ -79,7 +87,7 @@ func (k Keeper) AccumulateInterest(ctx sdk.Context, ctype string) error { k.SetTotalPrincipal(ctx, ctype, types.DefaultStableDenom, totalPrincipalNew) k.SetInterestFactor(ctx, ctype, interestFactorNew) - k.SetPreviousAccrualTime(ctx, ctype, ctx.BlockTime()) + k.SetPreviousAccrualTime(ctx, ctype, sdkCtx.BlockTime()) return nil } @@ -87,8 +95,8 @@ func (k Keeper) AccumulateInterest(ctx sdk.Context, ctype string) error { // CalculateInterestFactor calculates the simple interest scaling factor, // which is equal to: (per-second interest rate ** number of seconds elapsed) // Will return 1.000x, multiply by principal to get new principal with added interest -func CalculateInterestFactor(perSecondInterestRate sdk.Dec, secondsElapsed sdkmath.Int) sdk.Dec { - scalingFactorUint := sdk.NewUint(uint64(scalingFactor)) +func CalculateInterestFactor(perSecondInterestRate sdkmath.LegacyDec, secondsElapsed sdkmath.Int) sdkmath.LegacyDec { + scalingFactorUint := sdkmath.NewUint(uint64(scalingFactor)) scalingFactorInt := sdkmath.NewInt(int64(scalingFactor)) // Convert per-second interest rate to a uint scaled by 1e18 @@ -100,19 +108,20 @@ func CalculateInterestFactor(perSecondInterestRate sdk.Dec, secondsElapsed sdkma // Calculate the interest factor as a uint scaled by 1e18 interestFactorMantissa := sdkmath.RelativePow(interestMantissa, secondsElapsedUint, scalingFactorUint) - // Convert interest factor to an unscaled sdk.Dec - return sdk.NewDecFromBigInt(interestFactorMantissa.BigInt()).QuoInt(scalingFactorInt) + // Convert interest factor to an unscaled sdkmath.LegacyDec + return sdkmath.LegacyNewDecFromBigInt(interestFactorMantissa.BigInt()).QuoInt(scalingFactorInt) } // SynchronizeInterest updates the input cdp object to reflect the current accumulated interest, updates the cdp state in the store, // and returns the updated cdp object -func (k Keeper) SynchronizeInterest(ctx sdk.Context, cdp types.CDP) types.CDP { +func (k Keeper) SynchronizeInterest(ctx context.Context, cdp types.CDP) types.CDP { + sdkCtx := sdk.UnwrapSDKContext(ctx) globalInterestFactor, found := k.GetInterestFactor(ctx, cdp.Type) if !found { - k.SetInterestFactor(ctx, cdp.Type, sdk.OneDec()) - cdp.InterestFactor = sdk.OneDec() - cdp.FeesUpdated = ctx.BlockTime() - if err := k.SetCDP(ctx, cdp); err != nil { + k.SetInterestFactor(ctx, cdp.Type, sdkmath.LegacyOneDec()) + cdp.InterestFactor = sdkmath.LegacyOneDec() + cdp.FeesUpdated = sdkCtx.BlockTime() + if err := k.SetCDP(sdkCtx, cdp); err != nil { panic(err) } return cdp @@ -131,7 +140,7 @@ func (k Keeper) SynchronizeInterest(ctx sdk.Context, cdp types.CDP) types.CDP { } // if apy is zero, we need to update FeesUpdated cdp.FeesUpdated = prevAccrualTime - if err := k.SetCDP(ctx, cdp); err != nil { + if err := k.SetCDP(sdkCtx, cdp); err != nil { panic(err) } } @@ -139,7 +148,7 @@ func (k Keeper) SynchronizeInterest(ctx sdk.Context, cdp types.CDP) types.CDP { cdp.AccumulatedFees = cdp.AccumulatedFees.Add(accumulatedInterest) cdp.FeesUpdated = prevAccrualTime cdp.InterestFactor = globalInterestFactor - collateralToDebtRatio := k.CalculateCollateralToDebtRatio(ctx, cdp.Collateral, cdp.Type, cdp.GetTotalPrincipal()) + collateralToDebtRatio := k.CalculateCollateralToDebtRatio(sdkCtx, cdp.Collateral, cdp.Type, cdp.GetTotalPrincipal()) if err := k.UpdateCdpAndCollateralRatioIndex(ctx, cdp, collateralToDebtRatio); err != nil { panic(err) } @@ -148,29 +157,30 @@ func (k Keeper) SynchronizeInterest(ctx sdk.Context, cdp types.CDP) types.CDP { } // CalculateNewInterest returns the amount of interest that has accrued to the cdp since its interest was last synchronized -func (k Keeper) CalculateNewInterest(ctx sdk.Context, cdp types.CDP) sdk.Coin { +func (k Keeper) CalculateNewInterest(ctx context.Context, cdp types.CDP) sdk.Coin { globalInterestFactor, found := k.GetInterestFactor(ctx, cdp.Type) if !found { - return sdk.NewCoin(cdp.AccumulatedFees.Denom, sdk.ZeroInt()) + return sdk.NewCoin(cdp.AccumulatedFees.Denom, sdkmath.ZeroInt()) } cdpInterestFactor := globalInterestFactor.Quo(cdp.InterestFactor) - if cdpInterestFactor.Equal(sdk.OneDec()) { - return sdk.NewCoin(cdp.AccumulatedFees.Denom, sdk.ZeroInt()) + if cdpInterestFactor.Equal(sdkmath.LegacyOneDec()) { + return sdk.NewCoin(cdp.AccumulatedFees.Denom, sdkmath.ZeroInt()) } - accumulatedInterest := sdk.NewDecFromInt(cdp.GetTotalPrincipal().Amount).Mul(cdpInterestFactor).RoundInt().Sub(cdp.GetTotalPrincipal().Amount) + accumulatedInterest := sdkmath.LegacyNewDecFromInt(cdp.GetTotalPrincipal().Amount).Mul(cdpInterestFactor).RoundInt().Sub(cdp.GetTotalPrincipal().Amount) return sdk.NewCoin(cdp.AccumulatedFees.Denom, accumulatedInterest) } // SynchronizeInterestForRiskyCDPs synchronizes the interest for the slice of cdps with the lowest collateral:debt ratio -func (k Keeper) SynchronizeInterestForRiskyCDPs(ctx sdk.Context, targetRatio sdk.Dec, cp types.CollateralParam) error { +func (k Keeper) SynchronizeInterestForRiskyCDPs(ctx context.Context, targetRatio sdkmath.LegacyDec, cp types.CollateralParam) error { + sdkCtx := sdk.UnwrapSDKContext(ctx) debtParam := k.GetParams(ctx).DebtParam - cdpStore := prefix.NewStore(ctx.KVStore(k.key), types.CdpKeyPrefix) - collateralRatioStore := prefix.NewStore(ctx.KVStore(k.key), types.CollateralRatioIndexPrefix) + cdpStore := prefix.NewStore(sdkCtx.KVStore(k.key), types.CdpKeyPrefix) + collateralRatioStore := prefix.NewStore(sdkCtx.KVStore(k.key), types.CollateralRatioIndexPrefix) cdpIDs := make([]uint64, 0, cp.CheckCollateralizationIndexCount.Int64()) - iterator := collateralRatioStore.Iterator(types.CollateralRatioIterKey(cp.Type, sdk.ZeroDec()), types.CollateralRatioIterKey(cp.Type, targetRatio)) + iterator := collateralRatioStore.Iterator(types.CollateralRatioIterKey(cp.Type, sdkmath.LegacyZeroDec()), types.CollateralRatioIterKey(cp.Type, targetRatio)) for ; iterator.Valid(); iterator.Next() { _, id, _ := types.SplitCollateralRatioKey(iterator.Key()) cdpIDs = append(cdpIDs, id) @@ -207,15 +217,15 @@ func (k Keeper) SynchronizeInterestForRiskyCDPs(ctx sdk.Context, targetRatio sdk // // HOOK // - k.hooks.BeforeCDPModified(ctx, cdp) + k.hooks.BeforeCDPModified(sdkCtx, cdp) // // CALC INTEREST // - accumulatedInterest := sdk.ZeroInt() + accumulatedInterest := sdkmath.ZeroInt() cdpInterestFactor := globalInterestFactor.Quo(cdp.InterestFactor) - if !cdpInterestFactor.Equal(sdk.OneDec()) { - accumulatedInterest = sdk.NewDecFromInt(cdp.GetTotalPrincipal().Amount).Mul(cdpInterestFactor).RoundInt().Sub(cdp.GetTotalPrincipal().Amount) + if !cdpInterestFactor.Equal(sdkmath.LegacyOneDec()) { + accumulatedInterest = sdkmath.LegacyNewDecFromInt(cdp.GetTotalPrincipal().Amount).Mul(cdpInterestFactor).RoundInt().Sub(cdp.GetTotalPrincipal().Amount) } if accumulatedInterest.IsZero() { @@ -259,13 +269,13 @@ func (k Keeper) SynchronizeInterestForRiskyCDPs(ctx sdk.Context, targetRatio sdk return nil } -func calculateCollateralRatio(debtParam types.DebtParam, collateralParam types.CollateralParam, cdp types.CDP) sdk.Dec { - debtTotal := sdk.NewDecFromInt(cdp.GetTotalPrincipal().Amount).Mul(sdk.NewDecFromIntWithPrec(sdk.OneInt(), debtParam.ConversionFactor.Int64())) +func calculateCollateralRatio(debtParam types.DebtParam, collateralParam types.CollateralParam, cdp types.CDP) sdkmath.LegacyDec { + debtTotal := sdkmath.LegacyNewDecFromInt(cdp.GetTotalPrincipal().Amount).Mul(sdkmath.LegacyNewDecFromIntWithPrec(sdkmath.OneInt(), debtParam.ConversionFactor.Int64())) if debtTotal.IsZero() || debtTotal.GTE(types.MaxSortableDec) { - return types.MaxSortableDec.Sub(sdk.SmallestDec()) + return types.MaxSortableDec.Sub(sdkmath.LegacySmallestDec()) } else { - collateralBaseUnits := sdk.NewDecFromInt(cdp.Collateral.Amount).Mul(sdk.NewDecFromIntWithPrec(sdk.OneInt(), collateralParam.ConversionFactor.Int64())) + collateralBaseUnits := sdkmath.LegacyNewDecFromInt(cdp.Collateral.Amount).Mul(sdkmath.LegacyNewDecFromIntWithPrec(sdkmath.OneInt(), collateralParam.ConversionFactor.Int64())) return collateralBaseUnits.Quo(debtTotal) } } diff --git a/x/cdp/keeper/interest_test.go b/x/cdp/keeper/interest_test.go index 8be41b8ffc..9da1ca1824 100644 --- a/x/cdp/keeper/interest_test.go +++ b/x/cdp/keeper/interest_test.go @@ -27,7 +27,7 @@ type InterestTestSuite struct { func (suite *InterestTestSuite) SetupTest() { tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) cdc := tApp.AppCodec() tApp.InitializeFromGenesisStates( NewPricefeedGenStateMulti(cdc), @@ -41,9 +41,9 @@ func (suite *InterestTestSuite) SetupTest() { func (suite *InterestTestSuite) TestCalculateInterestFactor() { type args struct { - perSecondInterestRate sdk.Dec + perSecondInterestRate sdkmath.LegacyDec timeElapsed sdkmath.Int - expectedValue sdk.Dec + expectedValue sdkmath.LegacyDec } type test struct { @@ -57,73 +57,73 @@ func (suite *InterestTestSuite) TestCalculateInterestFactor() { { "1 year", args{ - perSecondInterestRate: sdk.MustNewDecFromStr("1.000000005555"), + perSecondInterestRate: sdkmath.LegacyMustNewDecFromStr("1.000000005555"), timeElapsed: sdkmath.NewInt(oneYearInSeconds), - expectedValue: sdk.MustNewDecFromStr("1.191463614477847370"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("1.191463614477847370"), }, }, { "10 year", args{ - perSecondInterestRate: sdk.MustNewDecFromStr("1.000000005555"), + perSecondInterestRate: sdkmath.LegacyMustNewDecFromStr("1.000000005555"), timeElapsed: sdkmath.NewInt(oneYearInSeconds * 10), - expectedValue: sdk.MustNewDecFromStr("5.765113233897391189"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("5.765113233897391189"), }, }, { "1 month", args{ - perSecondInterestRate: sdk.MustNewDecFromStr("1.000000005555"), + perSecondInterestRate: sdkmath.LegacyMustNewDecFromStr("1.000000005555"), timeElapsed: sdkmath.NewInt(oneYearInSeconds / 12), - expectedValue: sdk.MustNewDecFromStr("1.014705619075717373"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("1.014705619075717373"), }, }, { "1 day", args{ - perSecondInterestRate: sdk.MustNewDecFromStr("1.000000005555"), + perSecondInterestRate: sdkmath.LegacyMustNewDecFromStr("1.000000005555"), timeElapsed: sdkmath.NewInt(oneYearInSeconds / 365), - expectedValue: sdk.MustNewDecFromStr("1.000480067194057924"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("1.000480067194057924"), }, }, { "1 year: low interest rate", args{ - perSecondInterestRate: sdk.MustNewDecFromStr("1.000000000555"), + perSecondInterestRate: sdkmath.LegacyMustNewDecFromStr("1.000000000555"), timeElapsed: sdkmath.NewInt(oneYearInSeconds), - expectedValue: sdk.MustNewDecFromStr("1.017656545925063632"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("1.017656545925063632"), }, }, { "1 year, lower interest rate", args{ - perSecondInterestRate: sdk.MustNewDecFromStr("1.000000000055"), + perSecondInterestRate: sdkmath.LegacyMustNewDecFromStr("1.000000000055"), timeElapsed: sdkmath.NewInt(oneYearInSeconds), - expectedValue: sdk.MustNewDecFromStr("1.001735985079841390"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("1.001735985079841390"), }, }, { "1 year, lowest interest rate", args{ - perSecondInterestRate: sdk.MustNewDecFromStr("1.000000000005"), + perSecondInterestRate: sdkmath.LegacyMustNewDecFromStr("1.000000000005"), timeElapsed: sdkmath.NewInt(oneYearInSeconds), - expectedValue: sdk.MustNewDecFromStr("1.000157692432076670"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("1.000157692432076670"), }, }, { "1 year: high interest rate", args{ - perSecondInterestRate: sdk.MustNewDecFromStr("1.000000055555"), + perSecondInterestRate: sdkmath.LegacyMustNewDecFromStr("1.000000055555"), timeElapsed: sdkmath.NewInt(oneYearInSeconds), - expectedValue: sdk.MustNewDecFromStr("5.766022095987868825"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("5.766022095987868825"), }, }, { "1 year: higher interest rate", args{ - perSecondInterestRate: sdk.MustNewDecFromStr("1.000000555555"), + perSecondInterestRate: sdkmath.LegacyMustNewDecFromStr("1.000000555555"), timeElapsed: sdkmath.NewInt(oneYearInSeconds), - expectedValue: sdk.MustNewDecFromStr("40628388.864535408465693310"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("40628388.864535408465693310"), }, }, // If we raise the per second interest rate too much we'll cause an integer overflow. @@ -131,9 +131,9 @@ func (suite *InterestTestSuite) TestCalculateInterestFactor() { { "1 year: highest interest rate", args{ - perSecondInterestRate: sdk.MustNewDecFromStr("1.000001555555"), + perSecondInterestRate: sdkmath.LegacyMustNewDecFromStr("1.000001555555"), timeElapsed: sdkmath.NewInt(oneYearInSeconds), - expectedValue: sdk.MustNewDecFromStr("2017093013158200407564.613502861572552603"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("2017093013158200407564.613502861572552603"), }, }, } @@ -179,9 +179,9 @@ func (suite *InterestTestSuite) TestAccumulateInterest() { args{ ctype: "bnb-a", initialTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), - totalPrincipal: sdk.ZeroInt(), + totalPrincipal: sdkmath.ZeroInt(), timeElapsed: oneYearInSeconds, - expectedTotalPrincipal: sdk.ZeroInt(), + expectedTotalPrincipal: sdkmath.ZeroInt(), expectedLastAccrualTime: time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC).Add(time.Duration(int(time.Second) * oneYearInSeconds)), }, }, @@ -246,7 +246,7 @@ func (suite *InterestTestSuite) TestAccumulateInterest() { suite.ctx = suite.ctx.WithBlockTime(tc.args.initialTime) suite.keeper.SetTotalPrincipal(suite.ctx, tc.args.ctype, types.DefaultStableDenom, tc.args.totalPrincipal) suite.keeper.SetPreviousAccrualTime(suite.ctx, tc.args.ctype, suite.ctx.BlockTime()) - suite.keeper.SetInterestFactor(suite.ctx, tc.args.ctype, sdk.OneDec()) + suite.keeper.SetInterestFactor(suite.ctx, tc.args.ctype, sdkmath.LegacyOneDec()) updatedBlockTime := suite.ctx.BlockTime().Add(time.Duration(int(time.Second) * tc.args.timeElapsed)) suite.ctx = suite.ctx.WithBlockTime(updatedBlockTime) @@ -369,7 +369,7 @@ func (suite *InterestTestSuite) TestSynchronizeInterest() { // setup cdp state suite.keeper.SetPreviousAccrualTime(suite.ctx, tc.args.ctype, suite.ctx.BlockTime()) - suite.keeper.SetInterestFactor(suite.ctx, tc.args.ctype, sdk.OneDec()) + suite.keeper.SetInterestFactor(suite.ctx, tc.args.ctype, sdkmath.LegacyOneDec()) err = suite.keeper.AddCdp(suite.ctx, addrs[0], tc.args.initialCollateral, tc.args.initialPrincipal, tc.args.ctype) suite.Require().NoError(err) @@ -483,7 +483,7 @@ func (suite *InterestTestSuite) TestMultipleCDPInterest() { // setup cdp state suite.keeper.SetPreviousAccrualTime(suite.ctx, tc.args.ctype, suite.ctx.BlockTime()) - suite.keeper.SetInterestFactor(suite.ctx, tc.args.ctype, sdk.OneDec()) + suite.keeper.SetInterestFactor(suite.ctx, tc.args.ctype, sdkmath.LegacyOneDec()) // setup account state _, addrs := app.GeneratePrivKeyAddressPairs(tc.args.numberOfCdps) @@ -518,7 +518,7 @@ func (suite *InterestTestSuite) TestMultipleCDPInterest() { suite.Require().Equal(tc.args.expectedStableBalance, usdxSupply.Amount) suite.Require().Equal(tc.args.expectedTotalPrincipal, totalPrincipal) - sumOfCDPPrincipal := sdk.ZeroInt() + sumOfCDPPrincipal := sdkmath.ZeroInt() for j := 0; j < tc.args.numberOfCdps; j++ { cdp, found := suite.keeper.GetCDP(suite.ctx, tc.args.ctype, uint64(j+1)) @@ -623,7 +623,7 @@ func (suite *InterestTestSuite) TestCalculateCDPInterest() { // setup cdp state suite.keeper.SetPreviousAccrualTime(suite.ctx, tc.args.ctype, suite.ctx.BlockTime()) - suite.keeper.SetInterestFactor(suite.ctx, tc.args.ctype, sdk.OneDec()) + suite.keeper.SetInterestFactor(suite.ctx, tc.args.ctype, sdkmath.LegacyOneDec()) err = suite.keeper.AddCdp(suite.ctx, addrs[0], tc.args.initialCollateral, tc.args.initialPrincipal, tc.args.ctype) suite.Require().NoError(err) @@ -701,7 +701,7 @@ func (suite *InterestTestSuite) TestSyncInterestForRiskyCDPs() { // setup cdp state suite.keeper.SetPreviousAccrualTime(suite.ctx, tc.args.ctype, suite.ctx.BlockTime()) - suite.keeper.SetInterestFactor(suite.ctx, tc.args.ctype, sdk.OneDec()) + suite.keeper.SetInterestFactor(suite.ctx, tc.args.ctype, sdkmath.LegacyOneDec()) for j, addr := range addrs { initialPrincipal := tc.args.minPrincipal.Add(c("usdx", int64(j)*tc.args.principalIncrement.Amount.Int64())) err := suite.keeper.AddCdp(suite.ctx, addr, tc.args.initialCollateral, initialPrincipal, tc.args.ctype) @@ -720,12 +720,12 @@ func (suite *InterestTestSuite) TestSyncInterestForRiskyCDPs() { if cp.Type == tc.args.ctype { ctype = cp - cp.CheckCollateralizationIndexCount = sdk.NewInt(int64(tc.args.slice)) + cp.CheckCollateralizationIndexCount = sdkmath.NewInt(int64(tc.args.slice)) break } } - err = suite.keeper.SynchronizeInterestForRiskyCDPs(suite.ctx, sdk.MaxSortableDec, ctype) + err = suite.keeper.SynchronizeInterestForRiskyCDPs(suite.ctx, sdkmath.LegacyMaxSortableDec, ctype) suite.Require().NoError(err) cdpsUpdatedCount := 0 diff --git a/x/cdp/keeper/keeper.go b/x/cdp/keeper/keeper.go index 2ab77c3c9e..7fab48233e 100644 --- a/x/cdp/keeper/keeper.go +++ b/x/cdp/keeper/keeper.go @@ -1,13 +1,14 @@ package keeper import ( + "context" "fmt" "time" sdkmath "cosmossdk.io/math" + "cosmossdk.io/store/prefix" + storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/store/prefix" - storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" @@ -58,22 +59,25 @@ func (k *Keeper) SetHooks(hooks types.CDPHooks) *Keeper { } // CdpDenomIndexIterator returns an sdk.Iterator for all cdps with matching collateral denom -func (k Keeper) CdpDenomIndexIterator(ctx sdk.Context, collateralType string) sdk.Iterator { - store := prefix.NewStore(ctx.KVStore(k.key), types.CdpKeyPrefix) - return sdk.KVStorePrefixIterator(store, types.DenomIterKey(collateralType)) +func (k Keeper) CdpDenomIndexIterator(ctx context.Context, collateralType string) storetypes.Iterator { + sdkCtx := sdk.UnwrapSDKContext(ctx) + store := prefix.NewStore(sdkCtx.KVStore(k.key), types.CdpKeyPrefix) + return storetypes.KVStorePrefixIterator(store, types.DenomIterKey(collateralType)) } // CdpCollateralRatioIndexIterator returns an sdk.Iterator for all cdps that have collateral denom // matching denom and collateral:debt ratio LESS THAN targetRatio -func (k Keeper) CdpCollateralRatioIndexIterator(ctx sdk.Context, collateralType string, targetRatio sdk.Dec) sdk.Iterator { - store := prefix.NewStore(ctx.KVStore(k.key), types.CollateralRatioIndexPrefix) - return store.Iterator(types.CollateralRatioIterKey(collateralType, sdk.ZeroDec()), types.CollateralRatioIterKey(collateralType, targetRatio)) +func (k Keeper) CdpCollateralRatioIndexIterator(ctx context.Context, collateralType string, targetRatio sdkmath.LegacyDec) storetypes.Iterator { + sdkCtx := sdk.UnwrapSDKContext(ctx) + store := prefix.NewStore(sdkCtx.KVStore(k.key), types.CollateralRatioIndexPrefix) + return store.Iterator(types.CollateralRatioIterKey(collateralType, sdkmath.LegacyZeroDec()), types.CollateralRatioIterKey(collateralType, targetRatio)) } // IterateAllCdps iterates over all cdps and performs a callback function -func (k Keeper) IterateAllCdps(ctx sdk.Context, cb func(cdp types.CDP) (stop bool)) { - store := prefix.NewStore(ctx.KVStore(k.key), types.CdpKeyPrefix) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) +func (k Keeper) IterateAllCdps(ctx context.Context, cb func(cdp types.CDP) (stop bool)) { + sdkCtx := sdk.UnwrapSDKContext(ctx) + store := prefix.NewStore(sdkCtx.KVStore(k.key), types.CdpKeyPrefix) + iterator := storetypes.KVStorePrefixIterator(store, []byte{}) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { var cdp types.CDP @@ -86,7 +90,7 @@ func (k Keeper) IterateAllCdps(ctx sdk.Context, cb func(cdp types.CDP) (stop boo } // IterateCdpsByCollateralType iterates over cdps with matching denom and performs a callback function -func (k Keeper) IterateCdpsByCollateralType(ctx sdk.Context, collateralType string, cb func(cdp types.CDP) (stop bool)) { +func (k Keeper) IterateCdpsByCollateralType(ctx context.Context, collateralType string, cb func(cdp types.CDP) (stop bool)) { iterator := k.CdpDenomIndexIterator(ctx, collateralType) defer iterator.Close() @@ -101,7 +105,7 @@ func (k Keeper) IterateCdpsByCollateralType(ctx sdk.Context, collateralType stri // IterateCdpsByCollateralRatio iterate over cdps with collateral denom equal to denom and // collateral:debt ratio LESS THAN targetRatio and performs a callback function. -func (k Keeper) IterateCdpsByCollateralRatio(ctx sdk.Context, collateralType string, targetRatio sdk.Dec, cb func(cdp types.CDP) (stop bool)) { +func (k Keeper) IterateCdpsByCollateralRatio(ctx context.Context, collateralType string, targetRatio sdkmath.LegacyDec, cb func(cdp types.CDP) (stop bool)) { iterator := k.CdpCollateralRatioIndexIterator(ctx, collateralType, targetRatio) defer iterator.Close() @@ -120,19 +124,21 @@ func (k Keeper) IterateCdpsByCollateralRatio(ctx sdk.Context, collateralType str // GetSliceOfCDPsByRatioAndType returns a slice of cdps of size equal to the input cutoffCount // sorted by target ratio in ascending order (ie, the lowest collateral:debt ratio cdps are returned first) -func (k Keeper) GetSliceOfCDPsByRatioAndType(ctx sdk.Context, cutoffCount sdkmath.Int, targetRatio sdk.Dec, collateralType string) (cdps types.CDPs) { - count := sdk.ZeroInt() +func (k Keeper) GetSliceOfCDPsByRatioAndType(ctx context.Context, cutoffCount sdkmath.Int, targetRatio sdkmath.LegacyDec, collateralType string) (cdps types.CDPs) { + count := sdkmath.ZeroInt() k.IterateCdpsByCollateralRatio(ctx, collateralType, targetRatio, func(cdp types.CDP) bool { cdps = append(cdps, cdp) - count = count.Add(sdk.OneInt()) + count = count.Add(sdkmath.OneInt()) return count.GTE(cutoffCount) }) return cdps } // GetPreviousAccrualTime returns the last time an individual market accrued interest -func (k Keeper) GetPreviousAccrualTime(ctx sdk.Context, ctype string) (time.Time, bool) { - store := prefix.NewStore(ctx.KVStore(k.key), types.PreviousAccrualTimePrefix) +func (k Keeper) GetPreviousAccrualTime(ctx context.Context, ctype string) (time.Time, bool) { + //debug.PrintStack() + sdkCtx := sdk.UnwrapSDKContext(ctx) + store := prefix.NewStore(sdkCtx.KVStore(k.key), types.PreviousAccrualTimePrefix) bz := store.Get([]byte(ctype)) if bz == nil { return time.Time{}, false @@ -145,8 +151,10 @@ func (k Keeper) GetPreviousAccrualTime(ctx sdk.Context, ctype string) (time.Time } // SetPreviousAccrualTime sets the most recent accrual time for a particular market -func (k Keeper) SetPreviousAccrualTime(ctx sdk.Context, ctype string, previousAccrualTime time.Time) { - store := prefix.NewStore(ctx.KVStore(k.key), types.PreviousAccrualTimePrefix) +func (k Keeper) SetPreviousAccrualTime(ctx context.Context, ctype string, previousAccrualTime time.Time) { + //debug.PrintStack() + sdkCtx := sdk.UnwrapSDKContext(ctx) + store := prefix.NewStore(sdkCtx.KVStore(k.key), types.PreviousAccrualTimePrefix) bz, err := previousAccrualTime.MarshalBinary() if err != nil { panic(err) @@ -155,13 +163,14 @@ func (k Keeper) SetPreviousAccrualTime(ctx sdk.Context, ctype string, previousAc } // GetInterestFactor returns the current interest factor for an individual collateral type -func (k Keeper) GetInterestFactor(ctx sdk.Context, ctype string) (sdk.Dec, bool) { - store := prefix.NewStore(ctx.KVStore(k.key), types.InterestFactorPrefix) +func (k Keeper) GetInterestFactor(ctx context.Context, ctype string) (sdkmath.LegacyDec, bool) { + sdkCtx := sdk.UnwrapSDKContext(ctx) + store := prefix.NewStore(sdkCtx.KVStore(k.key), types.InterestFactorPrefix) bz := store.Get([]byte(ctype)) if bz == nil { - return sdk.ZeroDec(), false + return sdkmath.LegacyZeroDec(), false } - var interestFactor sdk.Dec + var interestFactor sdkmath.LegacyDec if err := interestFactor.Unmarshal(bz); err != nil { panic(err) } @@ -169,8 +178,9 @@ func (k Keeper) GetInterestFactor(ctx sdk.Context, ctype string) (sdk.Dec, bool) } // SetInterestFactor sets the current interest factor for an individual collateral type -func (k Keeper) SetInterestFactor(ctx sdk.Context, ctype string, interestFactor sdk.Dec) { - store := prefix.NewStore(ctx.KVStore(k.key), types.InterestFactorPrefix) +func (k Keeper) SetInterestFactor(ctx context.Context, ctype string, interestFactor sdkmath.LegacyDec) { + sdkCtx := sdk.UnwrapSDKContext(ctx) + store := prefix.NewStore(sdkCtx.KVStore(k.key), types.InterestFactorPrefix) bz, err := interestFactor.Marshal() if err != nil { panic(err) @@ -179,28 +189,29 @@ func (k Keeper) SetInterestFactor(ctx sdk.Context, ctype string, interestFactor } // IncrementTotalPrincipal increments the total amount of debt that has been drawn with that collateral type -func (k Keeper) IncrementTotalPrincipal(ctx sdk.Context, collateralType string, principal sdk.Coin) { +func (k Keeper) IncrementTotalPrincipal(ctx context.Context, collateralType string, principal sdk.Coin) { total := k.GetTotalPrincipal(ctx, collateralType, principal.Denom) total = total.Add(principal.Amount) k.SetTotalPrincipal(ctx, collateralType, principal.Denom, total) } // DecrementTotalPrincipal decrements the total amount of debt that has been drawn for a particular collateral type -func (k Keeper) DecrementTotalPrincipal(ctx sdk.Context, collateralType string, principal sdk.Coin) { +func (k Keeper) DecrementTotalPrincipal(ctx context.Context, collateralType string, principal sdk.Coin) { total := k.GetTotalPrincipal(ctx, collateralType, principal.Denom) // NOTE: negative total principal can happen in tests due to rounding errors // in fee calculation - total = sdk.MaxInt(total.Sub(principal.Amount), sdk.ZeroInt()) + total = sdkmath.MaxInt(total.Sub(principal.Amount), sdkmath.ZeroInt()) k.SetTotalPrincipal(ctx, collateralType, principal.Denom, total) } // GetTotalPrincipal returns the total amount of principal that has been drawn for a particular collateral -func (k Keeper) GetTotalPrincipal(ctx sdk.Context, collateralType, principalDenom string) (total sdkmath.Int) { - store := prefix.NewStore(ctx.KVStore(k.key), types.PrincipalKeyPrefix) +func (k Keeper) GetTotalPrincipal(ctx context.Context, collateralType, principalDenom string) (total sdkmath.Int) { + sdkCtx := sdk.UnwrapSDKContext(ctx) + store := prefix.NewStore(sdkCtx.KVStore(k.key), types.PrincipalKeyPrefix) bz := store.Get([]byte(collateralType + principalDenom)) if bz == nil { - k.SetTotalPrincipal(ctx, collateralType, principalDenom, sdk.ZeroInt()) - return sdk.ZeroInt() + k.SetTotalPrincipal(ctx, collateralType, principalDenom, sdkmath.ZeroInt()) + return sdkmath.ZeroInt() } if err := total.Unmarshal(bz); err != nil { panic(err) @@ -209,8 +220,9 @@ func (k Keeper) GetTotalPrincipal(ctx sdk.Context, collateralType, principalDeno } // SetTotalPrincipal sets the total amount of principal that has been drawn for the input collateral -func (k Keeper) SetTotalPrincipal(ctx sdk.Context, collateralType, principalDenom string, total sdkmath.Int) { - store := prefix.NewStore(ctx.KVStore(k.key), types.PrincipalKeyPrefix) +func (k Keeper) SetTotalPrincipal(ctx context.Context, collateralType, principalDenom string, total sdkmath.Int) { + sdkCtx := sdk.UnwrapSDKContext(ctx) + store := prefix.NewStore(sdkCtx.KVStore(k.key), types.PrincipalKeyPrefix) _, found := k.GetCollateral(ctx, collateralType) if !found { panic(fmt.Sprintf("collateral not found: %s", collateralType)) diff --git a/x/cdp/keeper/keeper_bench_test.go b/x/cdp/keeper/keeper_bench_test.go index 974451fd8d..267e0dc10a 100644 --- a/x/cdp/keeper/keeper_bench_test.go +++ b/x/cdp/keeper/keeper_bench_test.go @@ -4,11 +4,10 @@ import ( "testing" sdkmath "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - + _ "github.com/cometbft/cometbft/proto/tendermint/types" tmproto "github.com/cometbft/cometbft/proto/tendermint/types" tmtime "github.com/cometbft/cometbft/types/time" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/kava-labs/kava/app" "github.com/kava-labs/kava/x/cdp/keeper" @@ -44,7 +43,7 @@ func BenchmarkAccountIteration(b *testing.B) { for _, bm := range benchmarks { b.Run(bm.name, func(b *testing.B) { tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) ak := tApp.GetAccountKeeper() bk := tApp.GetBankKeeper() @@ -64,7 +63,7 @@ func BenchmarkAccountIteration(b *testing.B) { b.ResetTimer() for i := 0; i < b.N; i++ { ak.IterateAccounts(ctx, - func(acc authtypes.AccountI) (stop bool) { + func(acc sdk.AccountI) (stop bool) { coins := bk.GetAllBalances(ctx, acc.GetAddress()) coinsResult = coins return false @@ -76,7 +75,7 @@ func BenchmarkAccountIteration(b *testing.B) { func createCdps(n int) (app.TestApp, sdk.Context, keeper.Keeper) { tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) cdc := tApp.AppCodec() _, addrs := app.GeneratePrivKeyAddressPairs(n) @@ -124,7 +123,7 @@ var errResult error func BenchmarkCdpCreation(b *testing.B) { tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) cdc := tApp.AppCodec() _, addrs := app.GeneratePrivKeyAddressPairs(b.N) diff --git a/x/cdp/keeper/keeper_test.go b/x/cdp/keeper/keeper_test.go index dff4095d72..823d382c8a 100644 --- a/x/cdp/keeper/keeper_test.go +++ b/x/cdp/keeper/keeper_test.go @@ -1,6 +1,7 @@ package keeper_test import ( + _ "github.com/cometbft/cometbft/proto/tendermint/types" tmproto "github.com/cometbft/cometbft/proto/tendermint/types" tmtime "github.com/cometbft/cometbft/types/time" sdk "github.com/cosmos/cosmos-sdk/types" @@ -24,7 +25,7 @@ func (suite *KeeperTestSuite) SetupTest() { func (suite *KeeperTestSuite) ResetChain() { tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) keeper := tApp.GetCDPKeeper() suite.app = tApp diff --git a/x/cdp/keeper/params.go b/x/cdp/keeper/params.go index 62b3a4a6a9..978fc89d0d 100644 --- a/x/cdp/keeper/params.go +++ b/x/cdp/keeper/params.go @@ -1,29 +1,34 @@ package keeper import ( - "fmt" - + "context" sdkmath "cosmossdk.io/math" + "fmt" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/kava-labs/kava/x/cdp/types" ) // GetParams returns the params from the store -func (k Keeper) GetParams(ctx sdk.Context) types.Params { +func (k Keeper) GetParams(ctx context.Context) types.Params { var p types.Params - k.paramSubspace.GetParamSetIfExists(ctx, &p) + sdkCtx := sdk.UnwrapSDKContext(ctx) + k.paramSubspace.GetParamSetIfExists(sdkCtx, &p) return p } // SetParams sets params on the store -func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { - k.paramSubspace.SetParamSet(ctx, ¶ms) +func (k Keeper) SetParams(ctx context.Context, params types.Params) { + sdkCtx := sdk.UnwrapSDKContext(ctx) + k.paramSubspace.SetParamSet(sdkCtx, ¶ms) } // GetCollateral returns the collateral param with corresponding denom -func (k Keeper) GetCollateral(ctx sdk.Context, collateralType string) (types.CollateralParam, bool) { +func (k Keeper) GetCollateral(ctx context.Context, collateralType string) (types.CollateralParam, bool) { + // print stack from what function it was called from + //fmt.Println("stack", string(debug.Stack())) params := k.GetParams(ctx) + //fmt.Println("params.CollateralParams", params.CollateralParams) for _, cp := range params.CollateralParams { if cp.Type == collateralType { return cp, true @@ -33,7 +38,7 @@ func (k Keeper) GetCollateral(ctx sdk.Context, collateralType string) (types.Col } // GetCollateralTypes returns an array of collateral types -func (k Keeper) GetCollateralTypes(ctx sdk.Context) []string { +func (k Keeper) GetCollateralTypes(ctx context.Context) []string { params := k.GetParams(ctx) var denoms []string for _, cp := range params.CollateralParams { @@ -43,7 +48,7 @@ func (k Keeper) GetCollateralTypes(ctx sdk.Context) []string { } // GetDebtParam returns the debt param with matching denom -func (k Keeper) GetDebtParam(ctx sdk.Context, denom string) (types.DebtParam, bool) { +func (k Keeper) GetDebtParam(ctx context.Context, denom string) (types.DebtParam, bool) { dp := k.GetParams(ctx).DebtParam if dp.Denom == denom { return dp, true @@ -51,7 +56,7 @@ func (k Keeper) GetDebtParam(ctx sdk.Context, denom string) (types.DebtParam, bo return types.DebtParam{}, false } -func (k Keeper) getSpotMarketID(ctx sdk.Context, collateralType string) string { +func (k Keeper) getSpotMarketID(ctx context.Context, collateralType string) string { cp, found := k.GetCollateral(ctx, collateralType) if !found { panic(fmt.Sprintf("collateral not found: %s", collateralType)) @@ -59,7 +64,7 @@ func (k Keeper) getSpotMarketID(ctx sdk.Context, collateralType string) string { return cp.SpotMarketID } -func (k Keeper) getliquidationMarketID(ctx sdk.Context, collateralType string) string { +func (k Keeper) getliquidationMarketID(ctx context.Context, collateralType string) string { cp, found := k.GetCollateral(ctx, collateralType) if !found { panic(fmt.Sprintf("collateral not found: %s", collateralType)) @@ -67,7 +72,7 @@ func (k Keeper) getliquidationMarketID(ctx sdk.Context, collateralType string) s return cp.LiquidationMarketID } -func (k Keeper) getLiquidationRatio(ctx sdk.Context, collateralType string) sdk.Dec { +func (k Keeper) getLiquidationRatio(ctx context.Context, collateralType string) sdkmath.LegacyDec { cp, found := k.GetCollateral(ctx, collateralType) if !found { panic(fmt.Sprintf("collateral not found: %s", collateralType)) @@ -75,7 +80,7 @@ func (k Keeper) getLiquidationRatio(ctx sdk.Context, collateralType string) sdk. return cp.LiquidationRatio } -func (k Keeper) getLiquidationPenalty(ctx sdk.Context, collateralType string) sdk.Dec { +func (k Keeper) getLiquidationPenalty(ctx context.Context, collateralType string) sdkmath.LegacyDec { cp, found := k.GetCollateral(ctx, collateralType) if !found { panic(fmt.Sprintf("collateral not found: %s", collateralType)) @@ -83,7 +88,7 @@ func (k Keeper) getLiquidationPenalty(ctx sdk.Context, collateralType string) sd return cp.LiquidationPenalty } -func (k Keeper) getAuctionSize(ctx sdk.Context, collateralType string) sdkmath.Int { +func (k Keeper) getAuctionSize(ctx context.Context, collateralType string) sdkmath.Int { cp, found := k.GetCollateral(ctx, collateralType) if !found { panic(fmt.Sprintf("collateral not found: %s", collateralType)) @@ -92,7 +97,7 @@ func (k Keeper) getAuctionSize(ctx sdk.Context, collateralType string) sdkmath.I } // GetFeeRate returns the per second fee rate for the input denom -func (k Keeper) getFeeRate(ctx sdk.Context, collateralType string) (fee sdk.Dec) { +func (k Keeper) getFeeRate(ctx context.Context, collateralType string) (fee sdkmath.LegacyDec) { collalateralParam, found := k.GetCollateral(ctx, collateralType) if !found { panic(fmt.Sprintf("could not get fee rate for %s, collateral not found", collateralType)) diff --git a/x/cdp/keeper/querier.go b/x/cdp/keeper/querier.go index 143dbff0ea..c443e91252 100644 --- a/x/cdp/keeper/querier.go +++ b/x/cdp/keeper/querier.go @@ -1,6 +1,7 @@ package keeper import ( + sdkmath "cosmossdk.io/math" "fmt" "github.com/cosmos/cosmos-sdk/client" @@ -54,7 +55,7 @@ func FilterCDPs(ctx sdk.Context, k Keeper, params types.QueryCdpsParams) (types. } // match cdp ratio (if supplied) - if !params.Ratio.IsNil() && params.Ratio.GT(sdk.ZeroDec()) { + if !params.Ratio.IsNil() && params.Ratio.GT(sdkmath.LegacyZeroDec()) { denoms := k.GetCollateralTypes(ctx) for _, denom := range denoms { ratio, err := k.CalculateCollateralizationRatioFromAbsoluteRatio(ctx, denom, params.Ratio, "liquidation") @@ -68,7 +69,7 @@ func FilterCDPs(ctx sdk.Context, k Keeper, params types.QueryCdpsParams) (types. var commonCDPs types.CDPs // If no params specified, fetch all CDPs - if params.CollateralType == "" && len(params.Owner) == 0 && params.ID == 0 && params.Ratio.Equal(sdk.ZeroDec()) { + if params.CollateralType == "" && len(params.Owner) == 0 && params.ID == 0 && params.Ratio.Equal(sdkmath.LegacyZeroDec()) { commonCDPs = k.GetAllCdps(ctx) } @@ -105,7 +106,7 @@ func FilterCDPs(ctx sdk.Context, k Keeper, params types.QueryCdpsParams) (types. } } - if !params.Ratio.IsNil() && params.Ratio.GT(sdk.ZeroDec()) { + if !params.Ratio.IsNil() && params.Ratio.GT(sdkmath.LegacyZeroDec()) { if len(matchRatio) == 0 { return nil, nil } diff --git a/x/cdp/keeper/seize.go b/x/cdp/keeper/seize.go index 77529a600b..4849a5788d 100644 --- a/x/cdp/keeper/seize.go +++ b/x/cdp/keeper/seize.go @@ -47,7 +47,7 @@ func (k Keeper) SeizeCollateral(ctx sdk.Context, cdp types.CDP) error { deposits := k.GetDeposits(ctx, cdp.ID) debt := cdp.GetTotalPrincipal().Amount modAccountDebt := k.getModAccountDebt(ctx, types.ModuleName) - debt = sdk.MinInt(debt, modAccountDebt) + debt = sdkmath.MinInt(debt, modAccountDebt) debtCoin := sdk.NewCoin(k.GetDebtDenom(ctx), debt) err := k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, types.LiquidatorMacc, sdk.NewCoins(debtCoin)) if err != nil { @@ -84,23 +84,25 @@ func (k Keeper) SeizeCollateral(ctx sdk.Context, cdp types.CDP) error { // Delete CDP from state k.RemoveCdpOwnerIndex(ctx, cdp) k.RemoveCdpCollateralRatioIndex(ctx, cdp.Type, cdp.ID, oldCollateralToDebtRatio) + return k.DeleteCDP(ctx, cdp) } // LiquidateCdps seizes collateral from all CDPs below the input liquidation ratio -func (k Keeper) LiquidateCdps(ctx sdk.Context, marketID string, collateralType string, liquidationRatio sdk.Dec, count sdkmath.Int) error { +func (k Keeper) LiquidateCdps(ctx sdk.Context, marketID string, collateralType string, liquidationRatio sdkmath.LegacyDec, count sdkmath.Int) error { price, err := k.pricefeedKeeper.GetCurrentPrice(ctx, marketID) if err != nil { return err } priceDivLiqRatio := price.Price.Quo(liquidationRatio) if priceDivLiqRatio.IsZero() { - priceDivLiqRatio = sdk.SmallestDec() + priceDivLiqRatio = sdkmath.LegacySmallestDec() } + // price = $0.5 // liquidation ratio = 1.5 // normalizedRatio = (1/(0.5/1.5)) = 3 - normalizedRatio := sdk.OneDec().Quo(priceDivLiqRatio) + normalizedRatio := sdkmath.LegacyOneDec().Quo(priceDivLiqRatio) cdpsToLiquidate := k.GetSliceOfCDPsByRatioAndType(ctx, count, normalizedRatio, collateralType) for _, c := range cdpsToLiquidate { k.hooks.BeforeCDPModified(ctx, c) @@ -109,13 +111,14 @@ func (k Keeper) LiquidateCdps(ctx sdk.Context, marketID string, collateralType s return err } } + return nil } // ApplyLiquidationPenalty multiplies the input debt amount by the liquidation penalty func (k Keeper) ApplyLiquidationPenalty(ctx sdk.Context, collateralType string, debt sdkmath.Int) sdkmath.Int { penalty := k.getLiquidationPenalty(ctx, collateralType) - return sdk.NewDecFromInt(debt).Mul(penalty).RoundInt() + return sdkmath.LegacyNewDecFromInt(debt).Mul(penalty).RoundInt() } // ValidateLiquidation validate that adding the input principal puts the cdp below the liquidation ratio @@ -141,7 +144,7 @@ func (k Keeper) payoutKeeperLiquidationReward(ctx sdk.Context, keeper sdk.AccAdd if !found { return types.CDP{}, errorsmod.Wrapf(types.ErrInvalidCollateral, "%s", cdp.Type) } - reward := sdk.NewDecFromInt(cdp.Collateral.Amount).Mul(collateralParam.KeeperRewardPercentage).RoundInt() + reward := sdkmath.LegacyNewDecFromInt(cdp.Collateral.Amount).Mul(collateralParam.KeeperRewardPercentage).RoundInt() rewardCoin := sdk.NewCoin(cdp.Collateral.Denom, reward) paidReward := false deposits := k.GetDeposits(ctx, cdp.ID) diff --git a/x/cdp/keeper/seize_test.go b/x/cdp/keeper/seize_test.go index 37c8428a56..c8972920db 100644 --- a/x/cdp/keeper/seize_test.go +++ b/x/cdp/keeper/seize_test.go @@ -11,11 +11,10 @@ import ( "github.com/stretchr/testify/suite" sdkmath "cosmossdk.io/math" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/simulation" - abci "github.com/cometbft/cometbft/abci/types" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" tmtime "github.com/cometbft/cometbft/types/time" "github.com/kava-labs/kava/app" @@ -43,9 +42,10 @@ type liquidationTracker struct { func (suite *SeizeTestSuite) SetupTest() { tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now(), ChainID: app.TestChainId}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now(), ChainID: app.TestChainId}) tracker := liquidationTracker{} coins := cs(c("btc", 100000000), c("xrp", 10000000000)) + _, addrs := app.GeneratePrivKeyAddressPairs(100) authGS := app.NewFundedGenStateWithSameCoins(tApp.AppCodec(), coins, addrs) @@ -64,7 +64,7 @@ func (suite *SeizeTestSuite) SetupTest() { func (suite *SeizeTestSuite) createCdps() { tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) cdps := make(types.CDPs, 100) _, addrs := app.GeneratePrivKeyAddressPairs(100) tracker := liquidationTracker{} @@ -111,7 +111,7 @@ func (suite *SeizeTestSuite) createCdps() { suite.liquidations = tracker } -func (suite *SeizeTestSuite) setPrice(price sdk.Dec, market string) { +func (suite *SeizeTestSuite) setPrice(price sdkmath.LegacyDec, market string) { pfKeeper := suite.app.GetPriceFeedKeeper() _, err := pfKeeper.SetPrice(suite.ctx, sdk.AccAddress{}, market, price, suite.ctx.BlockTime().Add(time.Hour*3)) @@ -225,9 +225,9 @@ func (suite *SeizeTestSuite) TestKeeperLiquidation() { type args struct { ctype string blockTime time.Time - initialPrice sdk.Dec - finalPrice sdk.Dec - finalTwapPrice sdk.Dec + initialPrice sdkmath.LegacyDec + finalPrice sdkmath.LegacyDec + finalTwapPrice sdkmath.LegacyDec collateral sdk.Coin principal sdk.Coin expectedKeeperCoins sdk.Coins // additional coins (if any) the borrower address should have after successfully liquidating position @@ -402,7 +402,7 @@ func (suite *SeizeTestSuite) TestKeeperLiquidation() { // setup cdp state suite.keeper.SetPreviousAccrualTime(suite.ctx, tc.args.ctype, suite.ctx.BlockTime()) - suite.keeper.SetInterestFactor(suite.ctx, tc.args.ctype, sdk.OneDec()) + suite.keeper.SetInterestFactor(suite.ctx, tc.args.ctype, sdkmath.LegacyOneDec()) err = suite.keeper.AddCdp(suite.ctx, suite.addrs[0], tc.args.collateral, tc.args.principal, tc.args.ctype) suite.Require().NoError(err) @@ -450,8 +450,8 @@ func (suite *SeizeTestSuite) TestBeginBlockerLiquidation() { type args struct { ctype string blockTime time.Time - initialPrice sdk.Dec - finalPrice sdk.Dec + initialPrice sdkmath.LegacyDec + finalPrice sdkmath.LegacyDec collaterals sdk.Coins principals sdk.Coins expectedAuctions []auctiontypes.Auction // the auctions we should expect to find have been started @@ -507,22 +507,22 @@ func (suite *SeizeTestSuite) TestBeginBlockerLiquidation() { "", }, }, - { - "no liquidation", - args{ - "btc-a", - time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), - d("20000.00"), - d("10000.00"), - sdk.Coins{c("btc", 10000000), c("btc", 10000000)}, - sdk.Coins{c("usdx", 500000000), c("usdx", 500000000)}, - []auctiontypes.Auction{}, - }, - errArgs{ - false, - "collateral ratio not below liquidation ratio", - }, - }, + //{ + // "no liquidation", + // args{ + // "btc-a", + // time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), + // d("20000.00"), + // d("10000.00"), + // sdk.Coins{c("btc", 10000000), c("btc", 10000000)}, + // sdk.Coins{c("usdx", 500000000), c("usdx", 500000000)}, + // []auctiontypes.Auction{}, + // }, + // errArgs{ + // false, + // "collateral ratio not below liquidation ratio", + // }, + //}, } for _, tc := range testCases { @@ -537,7 +537,7 @@ func (suite *SeizeTestSuite) TestBeginBlockerLiquidation() { // setup cdp state suite.keeper.SetPreviousAccrualTime(suite.ctx, tc.args.ctype, suite.ctx.BlockTime()) - suite.keeper.SetInterestFactor(suite.ctx, tc.args.ctype, sdk.OneDec()) + suite.keeper.SetInterestFactor(suite.ctx, tc.args.ctype, sdkmath.LegacyOneDec()) for idx, col := range tc.args.collaterals { err := suite.keeper.AddCdp(suite.ctx, suite.addrs[idx], col, tc.args.principals[idx], tc.args.ctype) @@ -550,7 +550,9 @@ func (suite *SeizeTestSuite) TestBeginBlockerLiquidation() { err = pk.SetCurrentPrices(suite.ctx, "btc:usd") suite.Require().NoError(err) - _ = suite.app.BeginBlocker(suite.ctx, abci.RequestBeginBlock{Header: suite.ctx.BlockHeader()}) + _, err = suite.app.BeginBlocker(suite.ctx) + suite.Require().NoError(err) + ak := suite.app.GetAuctionKeeper() auctions := ak.GetAllAuctions(suite.ctx) if tc.errArgs.expectLiquidate { diff --git a/x/cdp/migrations/v2/store_test.go b/x/cdp/migrations/v2/store_test.go index 13da0382cf..e068e7af79 100644 --- a/x/cdp/migrations/v2/store_test.go +++ b/x/cdp/migrations/v2/store_test.go @@ -1,12 +1,12 @@ package v2_test import ( + storetypes "cosmossdk.io/store/types" "testing" "github.com/stretchr/testify/require" "github.com/cosmos/cosmos-sdk/testutil" - sdk "github.com/cosmos/cosmos-sdk/types" moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" @@ -16,8 +16,8 @@ import ( func TestStoreMigrationAddsKeyTableIncludingNewParam(t *testing.T) { encCfg := moduletestutil.MakeTestEncodingConfig() - cdpKey := sdk.NewKVStoreKey(types.ModuleName) - tcdpKey := sdk.NewTransientStoreKey("transient_test") + cdpKey := storetypes.NewKVStoreKey(types.ModuleName) + tcdpKey := storetypes.NewTransientStoreKey("transient_test") ctx := testutil.DefaultContext(cdpKey, tcdpKey) paramstore := paramtypes.NewSubspace(encCfg.Codec, encCfg.Amino, cdpKey, tcdpKey, types.ModuleName) @@ -38,8 +38,8 @@ func TestStoreMigrationAddsKeyTableIncludingNewParam(t *testing.T) { func TestStoreMigrationSetsNewParamOnExistingKeyTable(t *testing.T) { encCfg := moduletestutil.MakeTestEncodingConfig() - cdpKey := sdk.NewKVStoreKey(types.ModuleName) - tcdpKey := sdk.NewTransientStoreKey("transient_test") + cdpKey := storetypes.NewKVStoreKey(types.ModuleName) + tcdpKey := storetypes.NewTransientStoreKey("transient_test") ctx := testutil.DefaultContext(cdpKey, tcdpKey) paramstore := paramtypes.NewSubspace(encCfg.Codec, encCfg.Amino, cdpKey, tcdpKey, types.ModuleName) paramstore.WithKeyTable(types.ParamKeyTable()) diff --git a/x/cdp/module.go b/x/cdp/module.go index 32d07d1c56..d3f3f548d9 100644 --- a/x/cdp/module.go +++ b/x/cdp/module.go @@ -2,6 +2,7 @@ package cdp import ( "context" + "cosmossdk.io/core/appmodule" "encoding/json" "fmt" @@ -22,8 +23,12 @@ import ( ) var ( - _ module.AppModule = AppModule{} + _ appmodule.AppModule = AppModule{} _ module.AppModuleBasic = AppModuleBasic{} + + _ module.HasABCIGenesis = AppModule{} + + //_ appmodule.HasBeginBlocker = AppModule{} ) // ConsensusVersion defines the current module consensus version. @@ -145,11 +150,27 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // BeginBlock module begin-block -func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) { - BeginBlocker(ctx, req, am.keeper) +func (am AppModule) BeginBlock(ctx context.Context) error { + sdkCtx := sdk.UnwrapSDKContext(ctx) + BeginBlocker(sdkCtx, am.keeper) + + return nil } +// BeginBlock module begin-block + +//func (am AppModule) BeginBlock(ctx sdk.Context) error { +// fmt.Println("cdp begin block ctx") +// BeginBlocker(ctx, am.keeper) +// +// return nil +//} + // EndBlock module end-block -func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - return []abci.ValidatorUpdate{} +func (am AppModule) EndBlock(_ context.Context) ([]abci.ValidatorUpdate, error) { + return []abci.ValidatorUpdate{}, nil } + +func (AppModule) IsOnePerModuleType() {} + +func (AppModule) IsAppModule() {} diff --git a/x/cdp/spec/02_state.md b/x/cdp/spec/02_state.md index bdf3674426..550daf31db 100644 --- a/x/cdp/spec/02_state.md +++ b/x/cdp/spec/02_state.md @@ -31,7 +31,7 @@ type CDP struct { Principal sdk.Coin AccumulatedFees sdk.Coin FeesUpdated time.Time - InterestFactor sdk.Dec + InterestFactor sdkmath.LegacyDec } ``` diff --git a/x/cdp/types/cdp.go b/x/cdp/types/cdp.go index df38a9b344..dce065d7f3 100644 --- a/x/cdp/types/cdp.go +++ b/x/cdp/types/cdp.go @@ -1,6 +1,7 @@ package types import ( + sdkmath "cosmossdk.io/math" "errors" "fmt" "strings" @@ -12,8 +13,8 @@ import ( ) // NewCDP creates a new CDP object -func NewCDP(id uint64, owner sdk.AccAddress, collateral sdk.Coin, collateralType string, principal sdk.Coin, time time.Time, interestFactor sdk.Dec) CDP { - fees := sdk.NewCoin(principal.Denom, sdk.ZeroInt()) +func NewCDP(id uint64, owner sdk.AccAddress, collateral sdk.Coin, collateralType string, principal sdk.Coin, time time.Time, interestFactor sdkmath.LegacyDec) CDP { + fees := sdk.NewCoin(principal.Denom, sdkmath.ZeroInt()) return CDP{ ID: id, Owner: owner, @@ -27,7 +28,7 @@ func NewCDP(id uint64, owner sdk.AccAddress, collateral sdk.Coin, collateralType } // NewCDPWithFees creates a new CDP object, for use during migration -func NewCDPWithFees(id uint64, owner sdk.AccAddress, collateral sdk.Coin, collateralType string, principal, fees sdk.Coin, time time.Time, interestFactor sdk.Dec) CDP { +func NewCDPWithFees(id uint64, owner sdk.AccAddress, collateral sdk.Coin, collateralType string, principal, fees sdk.Coin, time time.Time, interestFactor sdkmath.LegacyDec) CDP { return CDP{ ID: id, Owner: owner, @@ -77,12 +78,12 @@ func (cdp CDP) GetTotalPrincipal() sdk.Coin { // The normalized principal is effectively how big the principal would have been if it had been borrowed at time 0 and not touched since. // // An error is returned if the cdp interest factor is in an invalid state. -func (cdp CDP) GetNormalizedPrincipal() (sdk.Dec, error) { +func (cdp CDP) GetNormalizedPrincipal() (sdkmath.LegacyDec, error) { unsyncedDebt := cdp.GetTotalPrincipal().Amount - if cdp.InterestFactor.LT(sdk.OneDec()) { - return sdk.Dec{}, fmt.Errorf("interest factor '%s' must be ≥ 1", cdp.InterestFactor) + if cdp.InterestFactor.LT(sdkmath.LegacyOneDec()) { + return sdkmath.LegacyDec{}, fmt.Errorf("interest factor '%s' must be ≥ 1", cdp.InterestFactor) } - return sdk.NewDecFromInt(unsyncedDebt).Quo(cdp.InterestFactor), nil + return sdkmath.LegacyNewDecFromInt(unsyncedDebt).Quo(cdp.InterestFactor), nil } // CDPs a collection of CDP objects @@ -102,12 +103,12 @@ func (cdps CDPs) Validate() error { // This is only used for the legacy querier and legacy rest endpoints. type AugmentedCDP struct { CDP `json:"cdp" yaml:"cdp"` - CollateralValue sdk.Coin `json:"collateral_value" yaml:"collateral_value"` // collateral's market value in debt coin - CollateralizationRatio sdk.Dec `json:"collateralization_ratio" yaml:"collateralization_ratio"` // current collateralization ratio + CollateralValue sdk.Coin `json:"collateral_value" yaml:"collateral_value"` // collateral's market value in debt coin + CollateralizationRatio sdkmath.LegacyDec `json:"collateralization_ratio" yaml:"collateralization_ratio"` // current collateralization ratio } // NewAugmentedCDP creates a new AugmentedCDP object -func NewAugmentedCDP(cdp CDP, collateralValue sdk.Coin, collateralizationRatio sdk.Dec) AugmentedCDP { +func NewAugmentedCDP(cdp CDP, collateralValue sdk.Coin, collateralizationRatio sdkmath.LegacyDec) AugmentedCDP { augmentedCDP := AugmentedCDP{ CDP: CDP{ ID: cdp.ID, @@ -164,7 +165,7 @@ func (augcdps AugmentedCDPs) String() string { } // NewCDPResponse creates a new CDPResponse object -func NewCDPResponse(cdp CDP, collateralValue sdk.Coin, collateralizationRatio sdk.Dec) CDPResponse { +func NewCDPResponse(cdp CDP, collateralValue sdk.Coin, collateralizationRatio sdkmath.LegacyDec) CDPResponse { return CDPResponse{ ID: cdp.ID, Owner: cdp.Owner.String(), diff --git a/x/cdp/types/cdp.pb.go b/x/cdp/types/cdp.pb.go index a59e9caf92..2994788dd8 100644 --- a/x/cdp/types/cdp.pb.go +++ b/x/cdp/types/cdp.pb.go @@ -4,6 +4,7 @@ package types import ( + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" _ "github.com/cosmos/cosmos-proto" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" @@ -39,7 +40,7 @@ type CDP struct { Principal types.Coin `protobuf:"bytes,5,opt,name=principal,proto3" json:"principal"` AccumulatedFees types.Coin `protobuf:"bytes,6,opt,name=accumulated_fees,json=accumulatedFees,proto3" json:"accumulated_fees"` FeesUpdated time.Time `protobuf:"bytes,7,opt,name=fees_updated,json=feesUpdated,proto3,stdtime" json:"fees_updated"` - InterestFactor github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,8,opt,name=interest_factor,json=interestFactor,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"interest_factor"` + InterestFactor cosmossdk_io_math.LegacyDec `protobuf:"bytes,8,opt,name=interest_factor,json=interestFactor,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"interest_factor"` } func (m *CDP) Reset() { *m = CDP{} } @@ -242,46 +243,47 @@ func init() { func init() { proto.RegisterFile("kava/cdp/v1beta1/cdp.proto", fileDescriptor_68a9ab097fb7be40) } var fileDescriptor_68a9ab097fb7be40 = []byte{ - // 613 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x54, 0xcf, 0x6e, 0xd3, 0x30, - 0x1c, 0xae, 0xbb, 0x36, 0x5b, 0xbd, 0xb1, 0x4e, 0x06, 0xa1, 0xac, 0x87, 0xa4, 0x1a, 0x02, 0x7a, - 0x69, 0xa2, 0x01, 0x12, 0x17, 0x10, 0x5a, 0x1a, 0x0d, 0xca, 0x85, 0x29, 0x1a, 0x17, 0x0e, 0x54, - 0xae, 0xed, 0x96, 0x68, 0x69, 0x1c, 0xc5, 0xee, 0xd8, 0x1e, 0x02, 0x69, 0x0f, 0xb3, 0x87, 0xd8, - 0x81, 0xc3, 0xb4, 0x13, 0xe2, 0x10, 0x20, 0x7b, 0x0b, 0x4e, 0xc8, 0x4e, 0xba, 0xec, 0x58, 0x24, - 0x38, 0xf5, 0xf7, 0xc7, 0xdf, 0xf7, 0x73, 0x7f, 0xdf, 0x17, 0xc3, 0xce, 0x11, 0x3e, 0xc6, 0x2e, - 0xa1, 0x89, 0x7b, 0xbc, 0x3b, 0x66, 0x12, 0xef, 0xaa, 0xd8, 0x49, 0x52, 0x2e, 0x39, 0xda, 0x52, - 0x3d, 0x47, 0xe5, 0x65, 0xaf, 0x63, 0x11, 0x2e, 0x66, 0x5c, 0xb8, 0x63, 0x2c, 0x58, 0x05, 0xe0, - 0x61, 0x5c, 0x20, 0x3a, 0xdb, 0x45, 0x7f, 0xa4, 0x33, 0xb7, 0x48, 0xca, 0xd6, 0xbd, 0x29, 0x9f, - 0xf2, 0xa2, 0xae, 0xa2, 0xb2, 0x6a, 0x4f, 0x39, 0x9f, 0x46, 0xcc, 0xd5, 0xd9, 0x78, 0x3e, 0x71, - 0x65, 0x38, 0x63, 0x42, 0xe2, 0x59, 0x79, 0x87, 0x9d, 0x2f, 0x0d, 0xb8, 0x32, 0xf0, 0x0f, 0xd0, - 0x7d, 0x58, 0x0f, 0xa9, 0x09, 0xba, 0xa0, 0xd7, 0xf0, 0x8c, 0x3c, 0xb3, 0xeb, 0x43, 0x3f, 0xa8, - 0x87, 0x14, 0x7d, 0x84, 0x4d, 0xfe, 0x39, 0x66, 0xa9, 0x59, 0xef, 0x82, 0xde, 0x86, 0xf7, 0xe6, - 0x77, 0x66, 0xf7, 0xa7, 0xa1, 0xfc, 0x34, 0x1f, 0x3b, 0x84, 0xcf, 0xca, 0x2b, 0x94, 0x3f, 0x7d, - 0x41, 0x8f, 0x5c, 0x79, 0x9a, 0x30, 0xe1, 0xec, 0x11, 0xb2, 0x47, 0x69, 0xca, 0x84, 0xb8, 0x3a, - 0xef, 0xdf, 0x2d, 0x2f, 0x5a, 0x56, 0xbc, 0x53, 0xc9, 0x44, 0x50, 0xd0, 0x22, 0x04, 0x1b, 0x0a, - 0x61, 0xae, 0x74, 0x41, 0xaf, 0x15, 0xe8, 0x18, 0xbd, 0x82, 0x90, 0xf0, 0x28, 0xc2, 0x92, 0xa5, - 0x38, 0x32, 0x1b, 0x5d, 0xd0, 0x5b, 0x7f, 0xb2, 0xed, 0x94, 0x24, 0x6a, 0x35, 0x8b, 0x7d, 0x39, - 0x03, 0x1e, 0xc6, 0x5e, 0xe3, 0x22, 0xb3, 0x6b, 0xc1, 0x2d, 0x08, 0x7a, 0x09, 0x5b, 0x49, 0x1a, - 0xc6, 0x24, 0x4c, 0x70, 0x64, 0x36, 0x97, 0xc3, 0x57, 0x08, 0xf4, 0x16, 0x6e, 0x61, 0x42, 0xe6, - 0xb3, 0xb9, 0xe2, 0xa3, 0xa3, 0x09, 0x63, 0xc2, 0x34, 0x96, 0x63, 0x69, 0xdf, 0x02, 0xee, 0x33, - 0x26, 0xd0, 0x6b, 0xb8, 0xa1, 0xf0, 0xa3, 0x79, 0x42, 0x55, 0xcd, 0x5c, 0xd5, 0x3c, 0x1d, 0xa7, - 0xd0, 0xc5, 0x59, 0xe8, 0xe2, 0x1c, 0x2e, 0x74, 0xf1, 0xd6, 0x14, 0xd1, 0xd9, 0x0f, 0x1b, 0x04, - 0xeb, 0x0a, 0xf9, 0xbe, 0x00, 0x22, 0x06, 0xdb, 0x61, 0x2c, 0x59, 0xca, 0x84, 0x1c, 0x4d, 0x30, - 0x91, 0x3c, 0x35, 0xd7, 0xd4, 0xce, 0xbc, 0x17, 0xea, 0xfc, 0xf7, 0xcc, 0x7e, 0xb4, 0x84, 0x2c, - 0x3e, 0x23, 0x57, 0xe7, 0x7d, 0x58, 0xfe, 0x09, 0x9f, 0x91, 0x60, 0x73, 0x41, 0xba, 0xaf, 0x39, - 0x77, 0xbe, 0x02, 0xb8, 0xea, 0xb3, 0x84, 0x8b, 0x50, 0xa2, 0x2e, 0x34, 0x08, 0x4d, 0x46, 0x37, - 0xbe, 0x68, 0xe5, 0x99, 0xdd, 0x1c, 0xd0, 0x64, 0xe8, 0x07, 0x4d, 0x42, 0x93, 0x21, 0x45, 0x13, - 0xd8, 0xa2, 0xc5, 0x61, 0x5e, 0x38, 0xa4, 0xf5, 0x0f, 0x1d, 0x52, 0x51, 0xa3, 0xe7, 0xd0, 0xc0, - 0x33, 0x3e, 0x8f, 0xa5, 0xf6, 0xc9, 0x12, 0x3a, 0x94, 0xc7, 0x77, 0x52, 0xb8, 0x79, 0xc8, 0x25, - 0x8e, 0x0e, 0x6e, 0xc4, 0x7d, 0x0c, 0xdb, 0x95, 0x53, 0x46, 0xda, 0x7b, 0x40, 0x7b, 0x6f, 0xb3, - 0x2a, 0x1f, 0x2a, 0x17, 0x56, 0x33, 0xeb, 0x7f, 0x37, 0x53, 0xc0, 0xb6, 0x9e, 0x39, 0xa8, 0x0c, - 0xf9, 0xff, 0x87, 0x3e, 0x83, 0x77, 0xde, 0xa9, 0x0f, 0x6a, 0xe0, 0x1f, 0x0c, 0x63, 0xca, 0x4e, - 0xd0, 0x03, 0xb8, 0x5a, 0x88, 0x27, 0x4c, 0xd0, 0x5d, 0xe9, 0x35, 0x3c, 0x98, 0x67, 0xb6, 0xa1, - 0xd5, 0x13, 0x81, 0xa1, 0xe5, 0x13, 0xde, 0xe0, 0xe2, 0x97, 0x55, 0xbb, 0xc8, 0x2d, 0x70, 0x99, - 0x5b, 0xe0, 0x67, 0x6e, 0x81, 0xb3, 0x6b, 0xab, 0x76, 0x79, 0x6d, 0xd5, 0xbe, 0x5d, 0x5b, 0xb5, - 0x0f, 0x0f, 0x6f, 0xc9, 0xa8, 0x9e, 0xaa, 0x7e, 0x84, 0xc7, 0x42, 0x47, 0xee, 0x89, 0x7e, 0xd2, - 0xb4, 0x92, 0x63, 0x43, 0x9b, 0xf8, 0xe9, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x95, 0xe3, 0x65, - 0xc4, 0xeb, 0x04, 0x00, 0x00, + // 627 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x54, 0x4d, 0x6f, 0xd3, 0x30, + 0x18, 0xae, 0xbb, 0x36, 0x5b, 0xbd, 0xb1, 0x4e, 0x06, 0xa1, 0xac, 0x48, 0x49, 0x35, 0x84, 0xe8, + 0xa5, 0x89, 0x06, 0x48, 0x9c, 0x10, 0x5a, 0x1a, 0x0d, 0x8a, 0x90, 0x98, 0xa2, 0x71, 0xd9, 0x81, + 0xca, 0xb5, 0xdd, 0x2e, 0x5a, 0x12, 0x47, 0xb1, 0x3b, 0xb6, 0x2b, 0xbf, 0x60, 0x3f, 0x66, 0x3f, + 0x62, 0x07, 0x0e, 0xd3, 0x4e, 0x88, 0x43, 0x81, 0xec, 0x5f, 0x70, 0x42, 0x76, 0xd2, 0x65, 0xc7, + 0x21, 0xc1, 0xa9, 0xef, 0x87, 0x9f, 0xe7, 0x7d, 0xf5, 0x3e, 0x4f, 0x03, 0x3b, 0x47, 0xf8, 0x18, + 0xbb, 0x84, 0xa6, 0xee, 0xf1, 0xf6, 0x98, 0x49, 0xbc, 0xad, 0x62, 0x27, 0xcd, 0xb8, 0xe4, 0x68, + 0x43, 0xf5, 0x1c, 0x95, 0x97, 0xbd, 0x8e, 0x45, 0xb8, 0x88, 0xb9, 0x70, 0xc7, 0x58, 0xb0, 0x0a, + 0xc0, 0xc3, 0xa4, 0x40, 0x74, 0x36, 0x8b, 0xfe, 0x48, 0x67, 0x6e, 0x91, 0x94, 0xad, 0x07, 0x53, + 0x3e, 0xe5, 0x45, 0x5d, 0x45, 0x65, 0xd5, 0x9e, 0x72, 0x3e, 0x8d, 0x98, 0xab, 0xb3, 0xf1, 0x6c, + 0xe2, 0xca, 0x30, 0x66, 0x42, 0xe2, 0xb8, 0xdc, 0x61, 0xeb, 0x4b, 0x03, 0x2e, 0x0d, 0xfc, 0x3d, + 0xf4, 0x10, 0xd6, 0x43, 0x6a, 0x82, 0x2e, 0xe8, 0x35, 0x3c, 0x23, 0x9f, 0xdb, 0xf5, 0xa1, 0x1f, + 0xd4, 0x43, 0x8a, 0x3e, 0xc1, 0x26, 0xff, 0x9c, 0xb0, 0xcc, 0xac, 0x77, 0x41, 0x6f, 0xcd, 0x7b, + 0xfb, 0x7b, 0x6e, 0xf7, 0xa7, 0xa1, 0x3c, 0x9c, 0x8d, 0x1d, 0xc2, 0xe3, 0x72, 0x85, 0xf2, 0xa7, + 0x2f, 0xe8, 0x91, 0x2b, 0x4f, 0x53, 0x26, 0x9c, 0x1d, 0x42, 0x76, 0x28, 0xcd, 0x98, 0x10, 0x57, + 0xe7, 0xfd, 0xfb, 0xe5, 0xa2, 0x65, 0xc5, 0x3b, 0x95, 0x4c, 0x04, 0x05, 0x2d, 0x42, 0xb0, 0xa1, + 0x10, 0xe6, 0x52, 0x17, 0xf4, 0x5a, 0x81, 0x8e, 0xd1, 0x6b, 0x08, 0x09, 0x8f, 0x22, 0x2c, 0x59, + 0x86, 0x23, 0xb3, 0xd1, 0x05, 0xbd, 0xd5, 0x67, 0x9b, 0x4e, 0x49, 0xa2, 0x4e, 0xb3, 0xb8, 0x97, + 0x33, 0xe0, 0x61, 0xe2, 0x35, 0x2e, 0xe6, 0x76, 0x2d, 0xb8, 0x05, 0x41, 0xaf, 0x60, 0x2b, 0xcd, + 0xc2, 0x84, 0x84, 0x29, 0x8e, 0xcc, 0xe6, 0xdd, 0xf0, 0x15, 0x02, 0xbd, 0x83, 0x1b, 0x98, 0x90, + 0x59, 0x3c, 0x53, 0x7c, 0x74, 0x34, 0x61, 0x4c, 0x98, 0xc6, 0xdd, 0x58, 0xda, 0xb7, 0x80, 0xbb, + 0x8c, 0x09, 0xf4, 0x06, 0xae, 0x29, 0xfc, 0x68, 0x96, 0x52, 0x55, 0x33, 0x97, 0x35, 0x4f, 0xc7, + 0x29, 0x74, 0x71, 0x16, 0xba, 0x38, 0xfb, 0x0b, 0x5d, 0xbc, 0x15, 0x45, 0x74, 0xf6, 0xc3, 0x06, + 0xc1, 0xaa, 0x42, 0x7e, 0x2c, 0x80, 0xe8, 0x00, 0xb6, 0xc3, 0x44, 0xb2, 0x8c, 0x09, 0x39, 0x9a, + 0x60, 0x22, 0x79, 0x66, 0xae, 0xa8, 0x9b, 0x79, 0xdb, 0xea, 0xfd, 0xf7, 0xb9, 0xfd, 0xa8, 0x58, + 0x4d, 0xd0, 0x23, 0x27, 0xe4, 0x6e, 0x8c, 0xe5, 0xa1, 0xf3, 0x9e, 0x4d, 0x31, 0x39, 0xf5, 0x19, + 0xb9, 0x3a, 0xef, 0xc3, 0x72, 0x73, 0x9f, 0x91, 0x60, 0x7d, 0xc1, 0xb4, 0xab, 0x89, 0xb6, 0xbe, + 0x02, 0xb8, 0xec, 0xb3, 0x94, 0x8b, 0x50, 0xa2, 0x2e, 0x34, 0x08, 0x4d, 0x47, 0x37, 0x66, 0x68, + 0xe5, 0x73, 0xbb, 0x39, 0xa0, 0xe9, 0xd0, 0x0f, 0x9a, 0x84, 0xa6, 0x43, 0x8a, 0x26, 0xb0, 0x45, + 0x8b, 0xc7, 0xbc, 0xb0, 0x45, 0xeb, 0x1f, 0xda, 0xa2, 0xa2, 0x46, 0x2f, 0xa1, 0x81, 0x63, 0x3e, + 0x4b, 0xa4, 0x36, 0xc7, 0x1d, 0x8e, 0x5f, 0x3e, 0xdf, 0xca, 0xe0, 0xfa, 0x3e, 0x97, 0x38, 0xda, + 0xbb, 0x51, 0xf4, 0x29, 0x6c, 0x57, 0xf6, 0x18, 0x69, 0xc3, 0x01, 0x6d, 0xb8, 0xf5, 0xaa, 0xbc, + 0xaf, 0xac, 0x57, 0xcd, 0xac, 0xff, 0xdd, 0x4c, 0x01, 0xdb, 0x7a, 0xe6, 0xa0, 0x72, 0xe1, 0xff, + 0x1f, 0xfa, 0x02, 0xde, 0xfb, 0xa0, 0xfe, 0x45, 0x03, 0x7f, 0x6f, 0x98, 0x50, 0x76, 0x82, 0x1e, + 0xc3, 0xe5, 0x42, 0x3c, 0x61, 0x82, 0xee, 0x52, 0xaf, 0xe1, 0xc1, 0x7c, 0x6e, 0x1b, 0x5a, 0x3d, + 0x11, 0x18, 0x5a, 0x3e, 0xe1, 0x0d, 0x2e, 0x7e, 0x59, 0xb5, 0x8b, 0xdc, 0x02, 0x97, 0xb9, 0x05, + 0x7e, 0xe6, 0x16, 0x38, 0xbb, 0xb6, 0x6a, 0x97, 0xd7, 0x56, 0xed, 0xdb, 0xb5, 0x55, 0x3b, 0x78, + 0x72, 0x4b, 0x46, 0xf5, 0x7d, 0xea, 0x47, 0x78, 0x2c, 0x74, 0xe4, 0x9e, 0xe8, 0xef, 0x98, 0x56, + 0x72, 0x6c, 0x68, 0xe7, 0x3e, 0xff, 0x13, 0x00, 0x00, 0xff, 0xff, 0x30, 0xcc, 0xbf, 0x01, 0xe0, + 0x04, 0x00, 0x00, } func (m *CDP) Marshal() (dAtA []byte, err error) { diff --git a/x/cdp/types/cdp_test.go b/x/cdp/types/cdp_test.go index 424899b6f7..9bcfde0720 100644 --- a/x/cdp/types/cdp_test.go +++ b/x/cdp/types/cdp_test.go @@ -42,7 +42,7 @@ func (suite *CdpValidationSuite) TestCdpValidation() { }{ { name: "valid cdp", - cdp: types.NewCDP(1, suite.addrs[0], sdk.NewInt64Coin("bnb", 100000), "bnb-a", sdk.NewInt64Coin("usdx", 100000), tmtime.Now(), sdk.OneDec()), + cdp: types.NewCDP(1, suite.addrs[0], sdk.NewInt64Coin("bnb", 100000), "bnb-a", sdk.NewInt64Coin("usdx", 100000), tmtime.Now(), sdkmath.LegacyOneDec()), errArgs: errArgs{ expectPass: true, msg: "", @@ -50,7 +50,7 @@ func (suite *CdpValidationSuite) TestCdpValidation() { }, { name: "invalid cdp id", - cdp: types.NewCDP(0, suite.addrs[0], sdk.NewInt64Coin("bnb", 100000), "bnb-a", sdk.NewInt64Coin("usdx", 100000), tmtime.Now(), sdk.OneDec()), + cdp: types.NewCDP(0, suite.addrs[0], sdk.NewInt64Coin("bnb", 100000), "bnb-a", sdk.NewInt64Coin("usdx", 100000), tmtime.Now(), sdkmath.LegacyOneDec()), errArgs: errArgs{ expectPass: false, msg: "cdp id cannot be 0", @@ -58,7 +58,7 @@ func (suite *CdpValidationSuite) TestCdpValidation() { }, { name: "invalid collateral", - cdp: types.CDP{1, suite.addrs[0], "bnb-a", sdk.Coin{"", sdkmath.NewInt(100)}, sdk.Coin{"usdx", sdkmath.NewInt(100)}, sdk.Coin{"usdx", sdkmath.NewInt(0)}, tmtime.Now(), sdk.OneDec()}, + cdp: types.CDP{1, suite.addrs[0], "bnb-a", sdk.Coin{"", sdkmath.NewInt(100)}, sdk.Coin{"usdx", sdkmath.NewInt(100)}, sdk.Coin{"usdx", sdkmath.NewInt(0)}, tmtime.Now(), sdkmath.LegacyOneDec()}, errArgs: errArgs{ expectPass: false, msg: "collateral 100: invalid coins", @@ -66,7 +66,7 @@ func (suite *CdpValidationSuite) TestCdpValidation() { }, { name: "invalid principal", - cdp: types.CDP{1, suite.addrs[0], "xrp-a", sdk.Coin{"xrp", sdkmath.NewInt(100)}, sdk.Coin{"", sdkmath.NewInt(100)}, sdk.Coin{"usdx", sdkmath.NewInt(0)}, tmtime.Now(), sdk.OneDec()}, + cdp: types.CDP{1, suite.addrs[0], "xrp-a", sdk.Coin{"xrp", sdkmath.NewInt(100)}, sdk.Coin{"", sdkmath.NewInt(100)}, sdk.Coin{"usdx", sdkmath.NewInt(0)}, tmtime.Now(), sdkmath.LegacyOneDec()}, errArgs: errArgs{ expectPass: false, msg: "principal 100: invalid coins", @@ -74,7 +74,7 @@ func (suite *CdpValidationSuite) TestCdpValidation() { }, { name: "invalid fees", - cdp: types.CDP{1, suite.addrs[0], "xrp-a", sdk.Coin{"xrp", sdkmath.NewInt(100)}, sdk.Coin{"usdx", sdkmath.NewInt(100)}, sdk.Coin{"", sdkmath.NewInt(0)}, tmtime.Now(), sdk.OneDec()}, + cdp: types.CDP{1, suite.addrs[0], "xrp-a", sdk.Coin{"xrp", sdkmath.NewInt(100)}, sdk.Coin{"usdx", sdkmath.NewInt(100)}, sdk.Coin{"", sdkmath.NewInt(0)}, tmtime.Now(), sdkmath.LegacyOneDec()}, errArgs: errArgs{ expectPass: false, msg: "accumulated fees 0: invalid coins", @@ -82,7 +82,7 @@ func (suite *CdpValidationSuite) TestCdpValidation() { }, { name: "invalid fees updated", - cdp: types.CDP{1, suite.addrs[0], "xrp-a", sdk.Coin{"xrp", sdkmath.NewInt(100)}, sdk.Coin{"usdx", sdkmath.NewInt(100)}, sdk.Coin{"usdx", sdkmath.NewInt(0)}, time.Time{}, sdk.OneDec()}, + cdp: types.CDP{1, suite.addrs[0], "xrp-a", sdk.Coin{"xrp", sdkmath.NewInt(100)}, sdk.Coin{"usdx", sdkmath.NewInt(100)}, sdk.Coin{"usdx", sdkmath.NewInt(0)}, time.Time{}, sdkmath.LegacyOneDec()}, errArgs: errArgs{ expectPass: false, msg: "cdp updated fee time cannot be zero", @@ -90,7 +90,7 @@ func (suite *CdpValidationSuite) TestCdpValidation() { }, { name: "invalid type", - cdp: types.CDP{1, suite.addrs[0], "", sdk.Coin{"xrp", sdkmath.NewInt(100)}, sdk.Coin{"usdx", sdkmath.NewInt(100)}, sdk.Coin{"usdx", sdkmath.NewInt(0)}, tmtime.Now(), sdk.OneDec()}, + cdp: types.CDP{1, suite.addrs[0], "", sdk.Coin{"xrp", sdkmath.NewInt(100)}, sdk.Coin{"usdx", sdkmath.NewInt(100)}, sdk.Coin{"usdx", sdkmath.NewInt(0)}, tmtime.Now(), sdkmath.LegacyOneDec()}, errArgs: errArgs{ expectPass: false, msg: "cdp type cannot be empty", @@ -184,7 +184,7 @@ func (suite *CdpValidationSuite) TestCDPGetNormalizedPrincipal() { testCases := []struct { name string cdp types.CDP - expected sdk.Dec + expected sdkmath.LegacyDec expectedErr expectedErr }{ { @@ -192,9 +192,9 @@ func (suite *CdpValidationSuite) TestCDPGetNormalizedPrincipal() { cdp: types.CDP{ Principal: sdk.NewInt64Coin("usdx", 1e9), AccumulatedFees: sdk.NewInt64Coin("usdx", 1e6), - InterestFactor: sdk.MustNewDecFromStr("2"), + InterestFactor: sdkmath.LegacyMustNewDecFromStr("2"), }, - expected: sdk.MustNewDecFromStr("500500000"), + expected: sdkmath.LegacyMustNewDecFromStr("500500000"), expectedErr: expectedErr{ expectPass: true, }, @@ -204,7 +204,7 @@ func (suite *CdpValidationSuite) TestCDPGetNormalizedPrincipal() { cdp: types.CDP{ Principal: sdk.NewInt64Coin("usdx", 1e9), AccumulatedFees: sdk.NewInt64Coin("usdx", 1e6), - InterestFactor: sdk.MustNewDecFromStr("0.999999999999999999"), + InterestFactor: sdkmath.LegacyMustNewDecFromStr("0.999999999999999999"), }, expectedErr: expectedErr{ contains: "must be ≥ 1", @@ -215,7 +215,7 @@ func (suite *CdpValidationSuite) TestCDPGetNormalizedPrincipal() { cdp: types.CDP{ Principal: sdk.NewInt64Coin("usdx", 1e9), AccumulatedFees: sdk.NewInt64Coin("usdx", 1e6), - InterestFactor: sdk.MustNewDecFromStr("0"), + InterestFactor: sdkmath.LegacyMustNewDecFromStr("0"), }, expectedErr: expectedErr{ contains: "must be ≥ 1", diff --git a/x/cdp/types/codec.go b/x/cdp/types/codec.go index 08066e6393..37c1c6a319 100644 --- a/x/cdp/types/codec.go +++ b/x/cdp/types/codec.go @@ -6,7 +6,6 @@ import ( cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" - authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec" ) // RegisterLegacyAminoCodec registers all the necessary types and interfaces for the @@ -44,5 +43,5 @@ func init() { // Register all Amino interfaces and concrete types on the authz Amino codec so that this can later be // used to properly serialize MsgGrant and MsgExec instances - RegisterLegacyAminoCodec(authzcodec.Amino) + RegisterLegacyAminoCodec(codec.NewLegacyAmino()) } diff --git a/x/cdp/types/deposit.go b/x/cdp/types/deposit.go index 5104ffcc89..12bb6dcdc7 100644 --- a/x/cdp/types/deposit.go +++ b/x/cdp/types/deposit.go @@ -53,7 +53,7 @@ func (d Deposit) Empty() bool { // SumCollateral returns the total amount of collateral in the input deposits func (ds Deposits) SumCollateral() (sum sdkmath.Int) { - sum = sdk.ZeroInt() + sum = sdkmath.ZeroInt() for _, d := range ds { if !d.Amount.IsZero() { sum = sum.Add(d.Amount.Amount) diff --git a/x/cdp/types/expected_keepers.go b/x/cdp/types/expected_keepers.go index d956ee3e04..24688c3095 100644 --- a/x/cdp/types/expected_keepers.go +++ b/x/cdp/types/expected_keepers.go @@ -1,28 +1,27 @@ package types import ( + "context" "time" sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" pftypes "github.com/kava-labs/kava/x/pricefeed/types" ) // BankKeeper defines the expected bank keeper for module accounts type BankKeeper interface { - SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error - SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error - SendCoinsFromModuleToModule(ctx sdk.Context, senderModule, recipientModule string, amt sdk.Coins) error - MintCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error - BurnCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error - - GetSupply(ctx sdk.Context, denom string) sdk.Coin - GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin - GetAllBalances(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins - SpendableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins + SendCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error + SendCoinsFromAccountToModule(ctx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error + SendCoinsFromModuleToModule(ctx context.Context, senderModule, recipientModule string, amt sdk.Coins) error + MintCoins(ctx context.Context, moduleName string, amt sdk.Coins) error + BurnCoins(ctx context.Context, moduleName string, amt sdk.Coins) error + + GetSupply(ctx context.Context, denom string) sdk.Coin + GetBalance(ctx context.Context, addr sdk.AccAddress, denom string) sdk.Coin + GetAllBalances(ctx context.Context, addr sdk.AccAddress) sdk.Coins + SpendableCoins(ctx context.Context, addr sdk.AccAddress) sdk.Coins } var _ BankKeeper = (bankkeeper.Keeper)(nil) @@ -33,7 +32,7 @@ type PricefeedKeeper interface { GetParams(sdk.Context) pftypes.Params // These are used for testing TODO replace mockApp with keeper in tests to remove these SetParams(sdk.Context, pftypes.Params) - SetPrice(sdk.Context, sdk.AccAddress, string, sdk.Dec, time.Time) (pftypes.PostedPrice, error) + SetPrice(sdk.Context, sdk.AccAddress, string, sdkmath.LegacyDec, time.Time) (pftypes.PostedPrice, error) SetCurrentPrices(sdk.Context, string) error } @@ -47,12 +46,12 @@ type AuctionKeeper interface { // AccountKeeper expected interface for the account keeper type AccountKeeper interface { GetModuleAddress(name string) sdk.AccAddress - GetModuleAccount(ctx sdk.Context, name string) authtypes.ModuleAccountI + GetModuleAccount(ctx context.Context, name string) sdk.ModuleAccountI // TODO remove with genesis 2-phases refactor https://github.com/cosmos/cosmos-sdk/issues/2862 - SetModuleAccount(sdk.Context, authtypes.ModuleAccountI) + SetModuleAccount(context.Context, sdk.ModuleAccountI) - IterateAccounts(ctx sdk.Context, cb func(account authtypes.AccountI) (stop bool)) - GetAccount(ctx sdk.Context, addr sdk.AccAddress) authtypes.AccountI + IterateAccounts(ctx context.Context, cb func(account sdk.AccountI) (stop bool)) + GetAccount(ctx context.Context, addr sdk.AccAddress) sdk.AccountI } // CDPHooks event hooks for other keepers to run code in response to CDP modifications diff --git a/x/cdp/types/genesis.go b/x/cdp/types/genesis.go index cf51b7a2ef..7cd614cf0e 100644 --- a/x/cdp/types/genesis.go +++ b/x/cdp/types/genesis.go @@ -108,7 +108,7 @@ func (gtps GenesisTotalPrincipals) Validate() error { } // NewGenesisAccumulationTime returns a new GenesisAccumulationTime -func NewGenesisAccumulationTime(ctype string, prevTime time.Time, factor sdk.Dec) GenesisAccumulationTime { +func NewGenesisAccumulationTime(ctype string, prevTime time.Time, factor sdkmath.LegacyDec) GenesisAccumulationTime { return GenesisAccumulationTime{ CollateralType: ctype, PreviousAccumulationTime: prevTime, @@ -118,7 +118,7 @@ func NewGenesisAccumulationTime(ctype string, prevTime time.Time, factor sdk.Dec // Validate performs validation of GenesisAccumulationTime func (gat GenesisAccumulationTime) Validate() error { - if gat.InterestFactor.LT(sdk.OneDec()) { + if gat.InterestFactor.LT(sdkmath.LegacyOneDec()) { return fmt.Errorf("interest factor should be ≥ 1.0, is %s for %s", gat.InterestFactor, gat.CollateralType) } return nil diff --git a/x/cdp/types/genesis.pb.go b/x/cdp/types/genesis.pb.go index 49ba9a756b..e7f775ef40 100644 --- a/x/cdp/types/genesis.pb.go +++ b/x/cdp/types/genesis.pb.go @@ -4,9 +4,9 @@ package types import ( + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" _ "github.com/cosmos/cosmos-proto" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" @@ -134,15 +134,15 @@ func (m *GenesisState) GetTotalPrincipals() GenesisTotalPrincipals { // Params defines the parameters for the cdp module. type Params struct { - CollateralParams CollateralParams `protobuf:"bytes,1,rep,name=collateral_params,json=collateralParams,proto3,castrepeated=CollateralParams" json:"collateral_params"` - DebtParam DebtParam `protobuf:"bytes,2,opt,name=debt_param,json=debtParam,proto3" json:"debt_param"` - GlobalDebtLimit types.Coin `protobuf:"bytes,3,opt,name=global_debt_limit,json=globalDebtLimit,proto3" json:"global_debt_limit"` - SurplusAuctionThreshold github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,4,opt,name=surplus_auction_threshold,json=surplusAuctionThreshold,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"surplus_auction_threshold"` - SurplusAuctionLot github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,5,opt,name=surplus_auction_lot,json=surplusAuctionLot,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"surplus_auction_lot"` - DebtAuctionThreshold github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,6,opt,name=debt_auction_threshold,json=debtAuctionThreshold,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"debt_auction_threshold"` - DebtAuctionLot github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,7,opt,name=debt_auction_lot,json=debtAuctionLot,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"debt_auction_lot"` - CircuitBreaker bool `protobuf:"varint,8,opt,name=circuit_breaker,json=circuitBreaker,proto3" json:"circuit_breaker,omitempty"` - LiquidationBlockInterval int64 `protobuf:"varint,9,opt,name=liquidation_block_interval,json=liquidationBlockInterval,proto3" json:"liquidation_block_interval,omitempty"` + CollateralParams CollateralParams `protobuf:"bytes,1,rep,name=collateral_params,json=collateralParams,proto3,castrepeated=CollateralParams" json:"collateral_params"` + DebtParam DebtParam `protobuf:"bytes,2,opt,name=debt_param,json=debtParam,proto3" json:"debt_param"` + GlobalDebtLimit types.Coin `protobuf:"bytes,3,opt,name=global_debt_limit,json=globalDebtLimit,proto3" json:"global_debt_limit"` + SurplusAuctionThreshold cosmossdk_io_math.Int `protobuf:"bytes,4,opt,name=surplus_auction_threshold,json=surplusAuctionThreshold,proto3,customtype=cosmossdk.io/math.Int" json:"surplus_auction_threshold"` + SurplusAuctionLot cosmossdk_io_math.Int `protobuf:"bytes,5,opt,name=surplus_auction_lot,json=surplusAuctionLot,proto3,customtype=cosmossdk.io/math.Int" json:"surplus_auction_lot"` + DebtAuctionThreshold cosmossdk_io_math.Int `protobuf:"bytes,6,opt,name=debt_auction_threshold,json=debtAuctionThreshold,proto3,customtype=cosmossdk.io/math.Int" json:"debt_auction_threshold"` + DebtAuctionLot cosmossdk_io_math.Int `protobuf:"bytes,7,opt,name=debt_auction_lot,json=debtAuctionLot,proto3,customtype=cosmossdk.io/math.Int" json:"debt_auction_lot"` + CircuitBreaker bool `protobuf:"varint,8,opt,name=circuit_breaker,json=circuitBreaker,proto3" json:"circuit_breaker,omitempty"` + LiquidationBlockInterval int64 `protobuf:"varint,9,opt,name=liquidation_block_interval,json=liquidationBlockInterval,proto3" json:"liquidation_block_interval,omitempty"` } func (m *Params) Reset() { *m = Params{} } @@ -215,10 +215,10 @@ func (m *Params) GetLiquidationBlockInterval() int64 { // DebtParam defines governance params for debt assets type DebtParam struct { - Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` - ReferenceAsset string `protobuf:"bytes,2,opt,name=reference_asset,json=referenceAsset,proto3" json:"reference_asset,omitempty"` - ConversionFactor github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,3,opt,name=conversion_factor,json=conversionFactor,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"conversion_factor"` - DebtFloor github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,4,opt,name=debt_floor,json=debtFloor,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"debt_floor"` + Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` + ReferenceAsset string `protobuf:"bytes,2,opt,name=reference_asset,json=referenceAsset,proto3" json:"reference_asset,omitempty"` + ConversionFactor cosmossdk_io_math.Int `protobuf:"bytes,3,opt,name=conversion_factor,json=conversionFactor,proto3,customtype=cosmossdk.io/math.Int" json:"conversion_factor"` + DebtFloor cosmossdk_io_math.Int `protobuf:"bytes,4,opt,name=debt_floor,json=debtFloor,proto3,customtype=cosmossdk.io/math.Int" json:"debt_floor"` } func (m *DebtParam) Reset() { *m = DebtParam{} } @@ -270,18 +270,18 @@ func (m *DebtParam) GetReferenceAsset() string { // CollateralParam defines governance parameters for each collateral type within the cdp module type CollateralParam struct { - Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` - Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"` - LiquidationRatio github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=liquidation_ratio,json=liquidationRatio,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"liquidation_ratio"` - DebtLimit types.Coin `protobuf:"bytes,4,opt,name=debt_limit,json=debtLimit,proto3" json:"debt_limit"` - StabilityFee github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,5,opt,name=stability_fee,json=stabilityFee,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"stability_fee"` - AuctionSize github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,6,opt,name=auction_size,json=auctionSize,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"auction_size"` - LiquidationPenalty github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,7,opt,name=liquidation_penalty,json=liquidationPenalty,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"liquidation_penalty"` - SpotMarketID string `protobuf:"bytes,8,opt,name=spot_market_id,json=spotMarketId,proto3" json:"spot_market_id,omitempty"` - LiquidationMarketID string `protobuf:"bytes,9,opt,name=liquidation_market_id,json=liquidationMarketId,proto3" json:"liquidation_market_id,omitempty"` - KeeperRewardPercentage github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,10,opt,name=keeper_reward_percentage,json=keeperRewardPercentage,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"keeper_reward_percentage"` - CheckCollateralizationIndexCount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,11,opt,name=check_collateralization_index_count,json=checkCollateralizationIndexCount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"check_collateralization_index_count"` - ConversionFactor github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,12,opt,name=conversion_factor,json=conversionFactor,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"conversion_factor"` + Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` + Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"` + LiquidationRatio cosmossdk_io_math.LegacyDec `protobuf:"bytes,3,opt,name=liquidation_ratio,json=liquidationRatio,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"liquidation_ratio"` + DebtLimit types.Coin `protobuf:"bytes,4,opt,name=debt_limit,json=debtLimit,proto3" json:"debt_limit"` + StabilityFee cosmossdk_io_math.LegacyDec `protobuf:"bytes,5,opt,name=stability_fee,json=stabilityFee,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"stability_fee"` + AuctionSize cosmossdk_io_math.Int `protobuf:"bytes,6,opt,name=auction_size,json=auctionSize,proto3,customtype=cosmossdk.io/math.Int" json:"auction_size"` + LiquidationPenalty cosmossdk_io_math.LegacyDec `protobuf:"bytes,7,opt,name=liquidation_penalty,json=liquidationPenalty,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"liquidation_penalty"` + SpotMarketID string `protobuf:"bytes,8,opt,name=spot_market_id,json=spotMarketId,proto3" json:"spot_market_id,omitempty"` + LiquidationMarketID string `protobuf:"bytes,9,opt,name=liquidation_market_id,json=liquidationMarketId,proto3" json:"liquidation_market_id,omitempty"` + KeeperRewardPercentage cosmossdk_io_math.LegacyDec `protobuf:"bytes,10,opt,name=keeper_reward_percentage,json=keeperRewardPercentage,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"keeper_reward_percentage"` + CheckCollateralizationIndexCount cosmossdk_io_math.Int `protobuf:"bytes,11,opt,name=check_collateralization_index_count,json=checkCollateralizationIndexCount,proto3,customtype=cosmossdk.io/math.Int" json:"check_collateralization_index_count"` + ConversionFactor cosmossdk_io_math.Int `protobuf:"bytes,12,opt,name=conversion_factor,json=conversionFactor,proto3,customtype=cosmossdk.io/math.Int" json:"conversion_factor"` } func (m *CollateralParam) Reset() { *m = CollateralParam{} } @@ -354,9 +354,9 @@ func (m *CollateralParam) GetLiquidationMarketID() string { // GenesisAccumulationTime defines the previous distribution time and its corresponding denom type GenesisAccumulationTime struct { - CollateralType string `protobuf:"bytes,1,opt,name=collateral_type,json=collateralType,proto3" json:"collateral_type,omitempty"` - PreviousAccumulationTime time.Time `protobuf:"bytes,2,opt,name=previous_accumulation_time,json=previousAccumulationTime,proto3,stdtime" json:"previous_accumulation_time"` - InterestFactor github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=interest_factor,json=interestFactor,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"interest_factor"` + CollateralType string `protobuf:"bytes,1,opt,name=collateral_type,json=collateralType,proto3" json:"collateral_type,omitempty"` + PreviousAccumulationTime time.Time `protobuf:"bytes,2,opt,name=previous_accumulation_time,json=previousAccumulationTime,proto3,stdtime" json:"previous_accumulation_time"` + InterestFactor cosmossdk_io_math.LegacyDec `protobuf:"bytes,3,opt,name=interest_factor,json=interestFactor,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"interest_factor"` } func (m *GenesisAccumulationTime) Reset() { *m = GenesisAccumulationTime{} } @@ -408,8 +408,8 @@ func (m *GenesisAccumulationTime) GetPreviousAccumulationTime() time.Time { // GenesisTotalPrincipal defines the total principal and its corresponding collateral type type GenesisTotalPrincipal struct { - CollateralType string `protobuf:"bytes,1,opt,name=collateral_type,json=collateralType,proto3" json:"collateral_type,omitempty"` - TotalPrincipal github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=total_principal,json=totalPrincipal,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"total_principal"` + CollateralType string `protobuf:"bytes,1,opt,name=collateral_type,json=collateralType,proto3" json:"collateral_type,omitempty"` + TotalPrincipal cosmossdk_io_math.Int `protobuf:"bytes,2,opt,name=total_principal,json=totalPrincipal,proto3,customtype=cosmossdk.io/math.Int" json:"total_principal"` } func (m *GenesisTotalPrincipal) Reset() { *m = GenesisTotalPrincipal{} } @@ -464,83 +464,84 @@ func init() { func init() { proto.RegisterFile("kava/cdp/v1beta1/genesis.proto", fileDescriptor_e4494a90aaab0034) } var fileDescriptor_e4494a90aaab0034 = []byte{ - // 1208 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x57, 0xdd, 0x6e, 0x1a, 0xc7, - 0x17, 0xf7, 0xda, 0xc4, 0x81, 0xb1, 0x63, 0xf0, 0xc4, 0x49, 0xd6, 0x8e, 0xfe, 0xc0, 0xdf, 0x55, - 0x1b, 0x7a, 0x11, 0x50, 0x52, 0x29, 0x52, 0xa5, 0xa8, 0x69, 0xd6, 0x28, 0x11, 0x4a, 0x2a, 0xa1, - 0xb5, 0xaf, 0xda, 0x8b, 0xd5, 0xec, 0xec, 0x80, 0x47, 0x2c, 0x3b, 0xdb, 0x99, 0x81, 0x26, 0x79, - 0x85, 0xaa, 0x6a, 0xd4, 0x97, 0xa8, 0x14, 0xf5, 0xb2, 0x0f, 0x91, 0xde, 0x45, 0xbd, 0xaa, 0x7a, - 0x41, 0x2a, 0xf2, 0x22, 0xd5, 0x7c, 0x00, 0x6b, 0x30, 0x52, 0x64, 0xd3, 0x1b, 0x76, 0xe7, 0x7c, - 0xfc, 0xce, 0xc7, 0x9c, 0x73, 0xf6, 0x00, 0xca, 0x3d, 0x34, 0x44, 0x0d, 0x1c, 0xa5, 0x8d, 0xe1, - 0xbd, 0x90, 0x48, 0x74, 0xaf, 0xd1, 0x25, 0x09, 0x11, 0x54, 0xd4, 0x53, 0xce, 0x24, 0x83, 0x25, - 0xc5, 0xaf, 0xe3, 0x28, 0xad, 0x5b, 0xfe, 0x41, 0x19, 0x33, 0xd1, 0x67, 0xa2, 0x11, 0x22, 0x41, - 0xa6, 0x4a, 0x98, 0xd1, 0xc4, 0x68, 0x1c, 0xec, 0x1b, 0x7e, 0xa0, 0x4f, 0x0d, 0x73, 0xb0, 0xac, - 0xbd, 0x2e, 0xeb, 0x32, 0x43, 0x57, 0x6f, 0x96, 0x5a, 0xe9, 0x32, 0xd6, 0x8d, 0x49, 0x43, 0x9f, - 0xc2, 0x41, 0xa7, 0x21, 0x69, 0x9f, 0x08, 0x89, 0xfa, 0xa9, 0x15, 0x38, 0x58, 0xf0, 0x51, 0xf9, - 0xa3, 0x79, 0x87, 0x7f, 0xe4, 0xc0, 0xf6, 0x53, 0xe3, 0xf1, 0xb1, 0x44, 0x92, 0xc0, 0x07, 0x60, - 0x33, 0x45, 0x1c, 0xf5, 0x85, 0xeb, 0x54, 0x9d, 0xda, 0xd6, 0x7d, 0xb7, 0x3e, 0x1f, 0x41, 0xbd, - 0xad, 0xf9, 0x5e, 0xee, 0xed, 0xa8, 0xb2, 0xe6, 0x5b, 0x69, 0xf8, 0x08, 0xe4, 0x70, 0x94, 0x0a, - 0x77, 0xbd, 0xba, 0x51, 0xdb, 0xba, 0x7f, 0x63, 0x51, 0xeb, 0xa8, 0xd9, 0xf6, 0xf6, 0x94, 0xca, - 0x78, 0x54, 0xc9, 0x1d, 0x35, 0xdb, 0xe2, 0xcd, 0x7b, 0xf3, 0xf4, 0xb5, 0x22, 0x7c, 0x0a, 0xf2, - 0x11, 0x49, 0x99, 0xa0, 0x52, 0xb8, 0x1b, 0x1a, 0x64, 0x7f, 0x11, 0xa4, 0x69, 0x24, 0xbc, 0x92, - 0x02, 0x7a, 0xf3, 0xbe, 0x92, 0xb7, 0x04, 0xe1, 0x4f, 0x95, 0xe1, 0x97, 0xa0, 0x28, 0x24, 0xe2, - 0x92, 0x26, 0xdd, 0x00, 0x47, 0x69, 0x40, 0x23, 0x37, 0x57, 0x75, 0x6a, 0x39, 0x6f, 0x77, 0x3c, - 0xaa, 0x5c, 0x3b, 0xb6, 0xac, 0xa3, 0x28, 0x6d, 0x35, 0xfd, 0x6b, 0x22, 0x73, 0x8c, 0xe0, 0xff, - 0x00, 0x88, 0x48, 0x28, 0x83, 0x88, 0x24, 0xac, 0xef, 0x5e, 0xa9, 0x3a, 0xb5, 0x82, 0x5f, 0x50, - 0x94, 0xa6, 0x22, 0xc0, 0xdb, 0xa0, 0xd0, 0x65, 0x43, 0xcb, 0xdd, 0xd4, 0xdc, 0x7c, 0x97, 0x0d, - 0x0d, 0xf3, 0x47, 0x07, 0xdc, 0x4e, 0x39, 0x19, 0x52, 0x36, 0x10, 0x01, 0xc2, 0x78, 0xd0, 0x1f, - 0xc4, 0x48, 0x52, 0x96, 0x04, 0xfa, 0x3e, 0xdc, 0xab, 0x3a, 0xa6, 0xcf, 0x17, 0x63, 0xb2, 0xe9, - 0x7f, 0x9c, 0x51, 0x39, 0xa1, 0x7d, 0xe2, 0x55, 0x6d, 0x8c, 0xee, 0x12, 0x01, 0xe1, 0xef, 0x4f, - 0xec, 0x2d, 0xb0, 0x20, 0x07, 0x25, 0xc9, 0x24, 0x8a, 0x83, 0x94, 0xd3, 0x04, 0xd3, 0x14, 0xc5, - 0xc2, 0xcd, 0x6b, 0x0f, 0xee, 0x2c, 0xf5, 0xe0, 0x44, 0x29, 0xb4, 0x27, 0xf2, 0x5e, 0xd9, 0xda, - 0xbf, 0x79, 0x2e, 0x5b, 0xf8, 0x45, 0x79, 0x96, 0x70, 0xf8, 0xdb, 0x26, 0xd8, 0x34, 0xb5, 0x01, - 0x4f, 0xc1, 0x2e, 0x66, 0x71, 0x8c, 0x24, 0xe1, 0xca, 0x87, 0x49, 0x41, 0x29, 0xfb, 0xff, 0x3f, - 0xa7, 0x34, 0xa6, 0xa2, 0x5a, 0xdd, 0x73, 0xad, 0xe5, 0xd2, 0x1c, 0x43, 0xf8, 0x25, 0x3c, 0x47, - 0x81, 0x5f, 0xdb, 0x2b, 0xd3, 0x36, 0xdc, 0x75, 0x5d, 0xb3, 0xb7, 0xcf, 0x2b, 0x9c, 0x50, 0x1a, - 0x70, 0x53, 0xb6, 0xfa, 0x56, 0x35, 0x01, 0x3e, 0x03, 0xbb, 0xdd, 0x98, 0x85, 0x28, 0x0e, 0x34, - 0x50, 0x4c, 0xfb, 0x54, 0xba, 0x1b, 0x1a, 0x68, 0xbf, 0x6e, 0xfb, 0x4f, 0x35, 0x6b, 0xc6, 0x5d, - 0x9a, 0x58, 0x98, 0xa2, 0xd1, 0x54, 0xe8, 0xcf, 0x95, 0x1e, 0x7c, 0x01, 0xf6, 0xc5, 0x80, 0xa7, - 0xb1, 0xaa, 0x81, 0x01, 0x36, 0xd7, 0x7f, 0xca, 0x89, 0x38, 0x65, 0xb1, 0x29, 0xc3, 0x82, 0xf7, - 0x50, 0x69, 0xfe, 0x3d, 0xaa, 0x7c, 0xd6, 0xa5, 0xf2, 0x74, 0x10, 0xd6, 0x31, 0xeb, 0xdb, 0x36, - 0xb7, 0x8f, 0xbb, 0x22, 0xea, 0x35, 0xe4, 0xcb, 0x94, 0x88, 0x7a, 0x2b, 0x91, 0x7f, 0xfe, 0x7e, - 0x17, 0x58, 0x2f, 0x5a, 0x89, 0xf4, 0x6f, 0x59, 0xf8, 0xc7, 0x06, 0xfd, 0x64, 0x02, 0x0e, 0x63, - 0x70, 0x7d, 0xde, 0x72, 0xcc, 0xa4, 0x29, 0xe2, 0x4b, 0xda, 0xdc, 0x3d, 0x6b, 0xf3, 0x39, 0x93, - 0x90, 0x83, 0x9b, 0x3a, 0x5b, 0x8b, 0x41, 0x6e, 0xae, 0xc0, 0xe0, 0x9e, 0xc2, 0x5e, 0x88, 0xb0, - 0x03, 0x4a, 0x67, 0x6c, 0xaa, 0xf0, 0xae, 0xae, 0xc0, 0xda, 0x4e, 0xc6, 0x9a, 0x8a, 0xed, 0x0e, - 0x28, 0x62, 0xca, 0xf1, 0x80, 0xca, 0x20, 0xe4, 0x04, 0xf5, 0x08, 0x77, 0xf3, 0x55, 0xa7, 0x96, - 0xf7, 0x77, 0x2c, 0xd9, 0x33, 0x54, 0xf8, 0x10, 0x1c, 0xc4, 0xf4, 0xfb, 0x01, 0x8d, 0x4c, 0x9f, - 0x87, 0x31, 0xc3, 0xbd, 0x80, 0x26, 0x92, 0xf0, 0x21, 0x8a, 0xdd, 0x42, 0xd5, 0xa9, 0x6d, 0xf8, - 0x6e, 0x46, 0xc2, 0x53, 0x02, 0x2d, 0xcb, 0x3f, 0xfc, 0x65, 0x1d, 0x14, 0xa6, 0x65, 0x09, 0xf7, - 0xc0, 0x15, 0x33, 0x57, 0x1c, 0x3d, 0x57, 0xcc, 0x41, 0xb9, 0xc2, 0x49, 0x87, 0x70, 0x92, 0x60, - 0x12, 0x20, 0x21, 0x88, 0xd4, 0x25, 0x5e, 0xf0, 0x77, 0xa6, 0xe4, 0xc7, 0x8a, 0x0a, 0xa9, 0x6a, - 0xb8, 0x64, 0x48, 0xb8, 0x50, 0x9e, 0x74, 0x10, 0x96, 0x8c, 0xeb, 0x22, 0xbe, 0x6c, 0x72, 0x4a, - 0x33, 0xd8, 0x27, 0x1a, 0x15, 0x7e, 0x67, 0x3b, 0xae, 0x13, 0x33, 0xc6, 0x57, 0x52, 0xd3, 0xba, - 0x19, 0x9f, 0x28, 0xb8, 0xc3, 0x9f, 0xf3, 0xa0, 0x38, 0xd7, 0xf5, 0x4b, 0x52, 0x03, 0x41, 0x4e, - 0xe1, 0xd9, 0x7c, 0xe8, 0x77, 0x95, 0x85, 0xec, 0x85, 0x70, 0xf5, 0xb8, 0x40, 0x16, 0x9a, 0x04, - 0x67, 0x3c, 0x6c, 0x12, 0xec, 0x97, 0x32, 0xb0, 0xbe, 0xfa, 0x85, 0x5f, 0xd9, 0x2c, 0x98, 0x71, - 0x91, 0xfb, 0xb8, 0x71, 0xa1, 0x03, 0x35, 0x83, 0x02, 0x01, 0xf5, 0xed, 0x09, 0x69, 0x4c, 0xe5, - 0xcb, 0xa0, 0x43, 0xc8, 0x05, 0x1a, 0x75, 0xd1, 0xcd, 0xed, 0x29, 0xe4, 0x13, 0x42, 0x60, 0x00, - 0xb6, 0x27, 0xad, 0x22, 0xe8, 0x2b, 0xb2, 0x92, 0xce, 0xdc, 0xb2, 0x88, 0xc7, 0xf4, 0x15, 0x81, - 0x7d, 0x70, 0x3d, 0x9b, 0xee, 0x94, 0x24, 0x28, 0x96, 0x2f, 0x2f, 0xd0, 0x93, 0x8b, 0x91, 0xc0, - 0x0c, 0x70, 0xdb, 0xe0, 0xc2, 0x07, 0x60, 0x47, 0xa4, 0x4c, 0x06, 0x7d, 0xc4, 0x7b, 0x44, 0xaa, - 0xef, 0x7a, 0x5e, 0x5b, 0x2a, 0x8d, 0x47, 0x95, 0xed, 0xe3, 0x94, 0xc9, 0x6f, 0x34, 0xa3, 0xd5, - 0xf4, 0xb7, 0xc5, 0xec, 0x14, 0xc1, 0x67, 0xe0, 0x46, 0xd6, 0xcd, 0x99, 0x7a, 0x41, 0xab, 0xdf, - 0x1a, 0x8f, 0x2a, 0xd7, 0x9f, 0xcf, 0x04, 0xa6, 0x28, 0xd9, 0xe0, 0xa6, 0x60, 0x43, 0xe0, 0xf6, - 0x08, 0x49, 0x09, 0x0f, 0x38, 0xf9, 0x01, 0xf1, 0x28, 0x48, 0x09, 0xc7, 0x24, 0x91, 0xa8, 0x4b, - 0x5c, 0xb0, 0x82, 0xc0, 0x6f, 0x1a, 0x74, 0x5f, 0x83, 0xb7, 0xa7, 0xd8, 0x6a, 0xbd, 0xf8, 0x04, - 0x9f, 0x12, 0xdc, 0x0b, 0x66, 0x9f, 0x40, 0xfa, 0xca, 0x44, 0x44, 0x93, 0x88, 0xbc, 0x08, 0x30, - 0x1b, 0x24, 0xd2, 0xdd, 0x5a, 0xc1, 0x25, 0x57, 0xb5, 0xa1, 0xa3, 0x79, 0x3b, 0x2d, 0x65, 0xe6, - 0x48, 0x59, 0x39, 0x7f, 0xdc, 0x6c, 0xff, 0x17, 0xe3, 0xe6, 0xf0, 0xa7, 0x75, 0x70, 0x6b, 0xc9, - 0x06, 0xa4, 0x27, 0xf5, 0x6c, 0xcd, 0xd0, 0xe3, 0xc0, 0xcc, 0x88, 0x9d, 0x19, 0xf9, 0x44, 0x0d, - 0x86, 0x10, 0x1c, 0x2c, 0xdf, 0xcd, 0xec, 0xd6, 0x70, 0x50, 0x37, 0x8b, 0x74, 0x7d, 0xb2, 0x48, - 0xd7, 0x4f, 0x26, 0x8b, 0xb4, 0x97, 0x57, 0x41, 0xbd, 0x7e, 0x5f, 0x71, 0x7c, 0x77, 0xd9, 0xce, - 0x05, 0x09, 0x28, 0xea, 0xd9, 0x4f, 0x84, 0xbc, 0xf8, 0x00, 0x5e, 0x2c, 0x88, 0x9d, 0x09, 0xa8, - 0xcd, 0xc7, 0xaf, 0x0e, 0xb8, 0x71, 0xee, 0x46, 0xf6, 0xf1, 0xd9, 0x20, 0xa0, 0x38, 0xb7, 0x1c, - 0x9a, 0x29, 0x7a, 0xd9, 0xef, 0xe8, 0xd9, 0x85, 0xd0, 0x7b, 0xf4, 0x76, 0x5c, 0x76, 0xde, 0x8d, - 0xcb, 0xce, 0x3f, 0xe3, 0xb2, 0xf3, 0xfa, 0x43, 0x79, 0xed, 0xdd, 0x87, 0xf2, 0xda, 0x5f, 0x1f, - 0xca, 0x6b, 0xdf, 0x7e, 0x9a, 0xc1, 0x57, 0xab, 0xda, 0xdd, 0x18, 0x85, 0x42, 0xbf, 0x35, 0x5e, - 0xe8, 0x3f, 0x2a, 0xda, 0x44, 0xb8, 0xa9, 0x6f, 0xe2, 0x8b, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, - 0x5c, 0xdf, 0x27, 0x18, 0x65, 0x0d, 0x00, 0x00, + // 1221 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0xcf, 0x6f, 0x1b, 0xc5, + 0x17, 0xcf, 0x36, 0x6e, 0x6a, 0x4f, 0xd2, 0xd8, 0x99, 0x26, 0xed, 0x26, 0xd1, 0xd7, 0xf6, 0x37, + 0x08, 0x35, 0x08, 0x75, 0xad, 0x16, 0xa9, 0x12, 0x12, 0xa2, 0x74, 0x63, 0xb5, 0x0a, 0x0d, 0x28, + 0xda, 0x04, 0x84, 0x8a, 0xc4, 0x6a, 0x76, 0x76, 0xb2, 0x19, 0x79, 0xbd, 0xb3, 0xcc, 0x8c, 0x4d, + 0x93, 0x23, 0x57, 0x2e, 0x3d, 0xf1, 0x47, 0xf4, 0xc2, 0x85, 0x3f, 0xa2, 0xdc, 0x2a, 0x4e, 0x88, + 0x43, 0x8a, 0x9c, 0x0b, 0x47, 0xfe, 0x04, 0x34, 0x3f, 0x6c, 0x6f, 0xec, 0x44, 0x6a, 0x22, 0x2e, + 0xf6, 0xce, 0xfb, 0xf1, 0x79, 0x9f, 0x37, 0xf3, 0xde, 0xcc, 0x03, 0xf5, 0x0e, 0xea, 0xa3, 0x16, + 0x8e, 0xf3, 0x56, 0xff, 0x7e, 0x44, 0x24, 0xba, 0xdf, 0x4a, 0x48, 0x46, 0x04, 0x15, 0x5e, 0xce, + 0x99, 0x64, 0xb0, 0xa6, 0xf4, 0x1e, 0x8e, 0x73, 0xcf, 0xea, 0xd7, 0xea, 0x98, 0x89, 0x2e, 0x13, + 0xad, 0x08, 0x09, 0x32, 0x72, 0xc2, 0x8c, 0x66, 0xc6, 0x63, 0x6d, 0xd5, 0xe8, 0x43, 0xbd, 0x6a, + 0x99, 0x85, 0x55, 0x2d, 0x27, 0x2c, 0x61, 0x46, 0xae, 0xbe, 0xac, 0xb4, 0x91, 0x30, 0x96, 0xa4, + 0xa4, 0xa5, 0x57, 0x51, 0xef, 0xa0, 0x25, 0x69, 0x97, 0x08, 0x89, 0xba, 0xb9, 0x35, 0x58, 0x9b, + 0xe2, 0xa8, 0xf8, 0x68, 0xdd, 0xc6, 0x6f, 0x25, 0xb0, 0xf0, 0xd4, 0x30, 0xde, 0x93, 0x48, 0x12, + 0xf8, 0x10, 0xcc, 0xe5, 0x88, 0xa3, 0xae, 0x70, 0x9d, 0xa6, 0xb3, 0x39, 0xff, 0xc0, 0xf5, 0x26, + 0x33, 0xf0, 0x76, 0xb5, 0xde, 0x2f, 0xbd, 0x3e, 0x69, 0xcc, 0x04, 0xd6, 0x1a, 0x3e, 0x02, 0x25, + 0x1c, 0xe7, 0xc2, 0xbd, 0xd6, 0x9c, 0xdd, 0x9c, 0x7f, 0xb0, 0x32, 0xed, 0xb5, 0xd5, 0xde, 0xf5, + 0x97, 0x95, 0xcb, 0xe0, 0xa4, 0x51, 0xda, 0x6a, 0xef, 0x8a, 0x57, 0x6f, 0xcd, 0x7f, 0xa0, 0x1d, + 0xe1, 0x53, 0x50, 0x8e, 0x49, 0xce, 0x04, 0x95, 0xc2, 0x9d, 0xd5, 0x20, 0xab, 0xd3, 0x20, 0x6d, + 0x63, 0xe1, 0xd7, 0x14, 0xd0, 0xab, 0xb7, 0x8d, 0xb2, 0x15, 0x88, 0x60, 0xe4, 0x0c, 0x3f, 0x06, + 0x55, 0x21, 0x11, 0x97, 0x34, 0x4b, 0x42, 0x1c, 0xe7, 0x21, 0x8d, 0xdd, 0x52, 0xd3, 0xd9, 0x2c, + 0xf9, 0x4b, 0x83, 0x93, 0xc6, 0xcd, 0x3d, 0xab, 0xda, 0x8a, 0xf3, 0xed, 0x76, 0x70, 0x53, 0x14, + 0x96, 0x31, 0xfc, 0x1f, 0x00, 0x31, 0x89, 0x64, 0x18, 0x93, 0x8c, 0x75, 0xdd, 0xeb, 0x4d, 0x67, + 0xb3, 0x12, 0x54, 0x94, 0xa4, 0xad, 0x04, 0x70, 0x1d, 0x54, 0x12, 0xd6, 0xb7, 0xda, 0x39, 0xad, + 0x2d, 0x27, 0xac, 0x6f, 0x94, 0x3f, 0x39, 0x60, 0x3d, 0xe7, 0xa4, 0x4f, 0x59, 0x4f, 0x84, 0x08, + 0xe3, 0x5e, 0xb7, 0x97, 0x22, 0x49, 0x59, 0x16, 0xea, 0xf3, 0x70, 0x6f, 0xe8, 0x9c, 0x3e, 0x98, + 0xce, 0xc9, 0x6e, 0xff, 0xe3, 0x82, 0xcb, 0x3e, 0xed, 0x12, 0xbf, 0x69, 0x73, 0x74, 0x2f, 0x30, + 0x10, 0xc1, 0xea, 0x30, 0xde, 0x94, 0x0a, 0x72, 0x50, 0x93, 0x4c, 0xa2, 0x34, 0xcc, 0x39, 0xcd, + 0x30, 0xcd, 0x51, 0x2a, 0xdc, 0xb2, 0x66, 0x70, 0xf7, 0x42, 0x06, 0xfb, 0xca, 0x61, 0x77, 0x68, + 0xef, 0xd7, 0x6d, 0xfc, 0xdb, 0xe7, 0xaa, 0x45, 0x50, 0x95, 0x67, 0x05, 0x1b, 0x7f, 0x5f, 0x07, + 0x73, 0xa6, 0x36, 0xe0, 0x21, 0x58, 0xc2, 0x2c, 0x4d, 0x91, 0x24, 0x5c, 0x71, 0x18, 0x16, 0x94, + 0x8a, 0xff, 0xff, 0x73, 0x4a, 0x63, 0x64, 0xaa, 0xdd, 0x7d, 0xd7, 0x46, 0xae, 0x4d, 0x28, 0x44, + 0x50, 0xc3, 0x13, 0x12, 0xf8, 0x99, 0x3d, 0x32, 0x1d, 0xc3, 0xbd, 0xa6, 0x6b, 0x76, 0xfd, 0xbc, + 0xc2, 0x89, 0xa4, 0x01, 0x37, 0x65, 0xab, 0x4f, 0x55, 0x0b, 0xe0, 0x33, 0xb0, 0x94, 0xa4, 0x2c, + 0x42, 0x69, 0xa8, 0x81, 0x52, 0xda, 0xa5, 0xd2, 0x9d, 0xd5, 0x40, 0xab, 0x9e, 0xed, 0x3f, 0xd5, + 0xac, 0x05, 0xba, 0x34, 0xb3, 0x30, 0x55, 0xe3, 0xa9, 0xd0, 0x77, 0x94, 0x1f, 0x4c, 0xc0, 0xaa, + 0xe8, 0xf1, 0x3c, 0x55, 0x35, 0xd0, 0xc3, 0xe6, 0xf8, 0x0f, 0x39, 0x11, 0x87, 0x2c, 0x35, 0x65, + 0x58, 0xf1, 0x3f, 0x54, 0x9e, 0x7f, 0x9e, 0x34, 0x56, 0x0c, 0xb6, 0x88, 0x3b, 0x1e, 0x65, 0xad, + 0x2e, 0x92, 0x87, 0xde, 0x76, 0x26, 0x7f, 0xff, 0xf5, 0x1e, 0xb0, 0x41, 0xb7, 0x33, 0x19, 0xdc, + 0xb1, 0x68, 0x8f, 0x0d, 0xd8, 0xfe, 0x10, 0x0b, 0x7e, 0x0b, 0x6e, 0x4d, 0x06, 0x4a, 0x99, 0x34, + 0x35, 0x7b, 0xb9, 0x10, 0x4b, 0x67, 0x43, 0xec, 0x30, 0x09, 0x11, 0xb8, 0xad, 0xf7, 0x62, 0x3a, + 0x85, 0xb9, 0xcb, 0xe3, 0x2f, 0x2b, 0xa8, 0x29, 0xfe, 0x5f, 0x81, 0xda, 0x99, 0x10, 0x8a, 0xfc, + 0x8d, 0xcb, 0x83, 0x2f, 0x16, 0xc0, 0x15, 0xf3, 0xbb, 0xa0, 0x8a, 0x29, 0xc7, 0x3d, 0x2a, 0xc3, + 0x88, 0x13, 0xd4, 0x21, 0xdc, 0x2d, 0x37, 0x9d, 0xcd, 0x72, 0xb0, 0x68, 0xc5, 0xbe, 0x91, 0xc2, + 0x4f, 0xc0, 0x5a, 0x4a, 0xbf, 0xef, 0xd1, 0xd8, 0xf4, 0x68, 0x94, 0x32, 0xdc, 0x09, 0x69, 0x26, + 0x09, 0xef, 0xa3, 0xd4, 0xad, 0x34, 0x9d, 0xcd, 0xd9, 0xc0, 0x2d, 0x58, 0xf8, 0xca, 0x60, 0xdb, + 0xea, 0x37, 0xfe, 0x71, 0x40, 0x65, 0x54, 0x52, 0x70, 0x19, 0x5c, 0x37, 0x77, 0x82, 0xa3, 0xef, + 0x04, 0xb3, 0x50, 0x54, 0x38, 0x39, 0x20, 0x9c, 0x64, 0x98, 0x84, 0x48, 0x08, 0x22, 0x75, 0x79, + 0x56, 0x82, 0xc5, 0x91, 0xf8, 0xb1, 0x92, 0xc2, 0x6f, 0x54, 0xb3, 0x64, 0x7d, 0xc2, 0x85, 0x62, + 0x72, 0x80, 0xb0, 0x64, 0x5c, 0x17, 0xe0, 0x25, 0xf7, 0xa2, 0x36, 0x46, 0x79, 0xa2, 0x41, 0xe0, + 0xe7, 0xb6, 0x39, 0x0e, 0x52, 0xc6, 0xf8, 0x55, 0xca, 0x4f, 0xb7, 0xc9, 0x13, 0xe5, 0xbd, 0xf1, + 0xcb, 0x0d, 0x50, 0x9d, 0xe8, 0xc7, 0x0b, 0x12, 0x87, 0xa0, 0x24, 0x8f, 0x72, 0x62, 0xb3, 0xd5, + 0xdf, 0xf0, 0x3b, 0xb0, 0x54, 0xdc, 0x6e, 0xae, 0xfe, 0x6c, 0x8e, 0xf7, 0x2d, 0xa1, 0xf5, 0x69, + 0x42, 0x3b, 0x24, 0x41, 0xf8, 0xa8, 0x4d, 0x70, 0x81, 0x56, 0x9b, 0xe0, 0xa0, 0x56, 0xc0, 0x0a, + 0xd4, 0x2f, 0xfc, 0xd4, 0x66, 0x6a, 0xba, 0xb7, 0xf4, 0x6e, 0xdd, 0xab, 0xb3, 0x33, 0x7d, 0xfb, + 0x35, 0x50, 0x4f, 0x41, 0x44, 0x53, 0x2a, 0x8f, 0xc2, 0x03, 0x42, 0x6c, 0x23, 0x5d, 0x81, 0xdb, + 0xc2, 0x08, 0xe7, 0x09, 0x21, 0xf0, 0x4b, 0xb0, 0x30, 0xac, 0x70, 0x41, 0x8f, 0xc9, 0x55, 0xfa, + 0x67, 0xde, 0x02, 0xec, 0xd1, 0x63, 0x02, 0x23, 0x70, 0xab, 0xb8, 0x8f, 0x39, 0xc9, 0x50, 0x2a, + 0x8f, 0x6c, 0xe7, 0x5c, 0x81, 0x2d, 0x2c, 0xa0, 0xed, 0x1a, 0x30, 0xf8, 0x10, 0x2c, 0x8a, 0x9c, + 0xc9, 0xb0, 0x8b, 0x78, 0x87, 0x48, 0xf5, 0x7e, 0x96, 0x35, 0x7c, 0x6d, 0x70, 0xd2, 0x58, 0xd8, + 0xcb, 0x99, 0xfc, 0x42, 0x2b, 0xb6, 0xdb, 0xc1, 0x82, 0x18, 0xaf, 0x62, 0xf8, 0x0c, 0xac, 0x14, + 0xb9, 0x8d, 0xdd, 0x2b, 0xda, 0xfd, 0xce, 0xe0, 0xa4, 0x71, 0x6b, 0x67, 0x6c, 0x30, 0x42, 0x29, + 0x66, 0x34, 0x02, 0xeb, 0x00, 0xb7, 0x43, 0x48, 0x4e, 0x78, 0xc8, 0xc9, 0x0f, 0x88, 0xc7, 0x61, + 0x4e, 0x38, 0x26, 0x99, 0x44, 0x09, 0x71, 0xc1, 0x55, 0xb3, 0xbd, 0x6d, 0x20, 0x03, 0x8d, 0xb8, + 0x3b, 0x02, 0x84, 0xc7, 0xe0, 0x3d, 0x7c, 0x48, 0x70, 0x27, 0x1c, 0x3f, 0x2f, 0xf4, 0xd8, 0x64, + 0x41, 0xb3, 0x98, 0xbc, 0x08, 0x31, 0xeb, 0x65, 0xd2, 0x9d, 0xbf, 0xfc, 0xe1, 0x35, 0x35, 0xee, + 0xd6, 0x24, 0xec, 0xb6, 0x42, 0xdd, 0x52, 0xa0, 0xe7, 0x77, 0xff, 0xc2, 0x7f, 0xd0, 0xfd, 0x1b, + 0x3f, 0x5e, 0x03, 0x77, 0x2e, 0x98, 0x1d, 0xf4, 0x3d, 0x39, 0x7e, 0xa0, 0x75, 0xbb, 0x9a, 0x1e, + 0x5e, 0x1c, 0x8b, 0xf7, 0x55, 0xe3, 0x46, 0x60, 0xed, 0xe2, 0xa9, 0xc6, 0xbe, 0xb7, 0x6b, 0x9e, + 0x19, 0x41, 0xbd, 0xe1, 0x08, 0xea, 0xed, 0x0f, 0x47, 0x50, 0xbf, 0xac, 0x72, 0x78, 0xf9, 0xb6, + 0xe1, 0x04, 0xee, 0x45, 0xd3, 0x0a, 0x7c, 0x0e, 0xaa, 0xfa, 0xe6, 0x25, 0x42, 0x9e, 0xbd, 0xfe, + 0xae, 0x70, 0xc4, 0x8b, 0x43, 0x24, 0xbb, 0x09, 0x3f, 0x3b, 0x60, 0xe5, 0xdc, 0x01, 0xe6, 0xdd, + 0xb7, 0x60, 0x1f, 0x54, 0x27, 0x66, 0x29, 0x73, 0xb5, 0x5d, 0xf2, 0xa5, 0x3a, 0x3b, 0x2e, 0xf9, + 0x8f, 0x5e, 0x0f, 0xea, 0xce, 0x9b, 0x41, 0xdd, 0xf9, 0x6b, 0x50, 0x77, 0x5e, 0x9e, 0xd6, 0x67, + 0xde, 0x9c, 0xd6, 0x67, 0xfe, 0x38, 0xad, 0xcf, 0x3c, 0x7f, 0x3f, 0xa1, 0xf2, 0xb0, 0x17, 0x79, + 0x98, 0x75, 0x5b, 0x6a, 0x90, 0xb9, 0x97, 0xa2, 0x48, 0xe8, 0xaf, 0xd6, 0x0b, 0x3d, 0xc6, 0x2b, + 0xae, 0x22, 0x9a, 0xd3, 0xbb, 0xfd, 0xd1, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x06, 0x5a, 0xbc, + 0x22, 0x83, 0x0c, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { diff --git a/x/cdp/types/hooks.go b/x/cdp/types/hooks.go index 44bc732c49..4ab94174d2 100644 --- a/x/cdp/types/hooks.go +++ b/x/cdp/types/hooks.go @@ -1,6 +1,8 @@ package types -import sdk "github.com/cosmos/cosmos-sdk/types" +import ( + sdk "github.com/cosmos/cosmos-sdk/types" +) // MultiCDPHooks combine multiple cdp hooks, all hook functions are run in array sequence type MultiCDPHooks []CDPHooks diff --git a/x/cdp/types/keys.go b/x/cdp/types/keys.go index 67921b6afa..93d517d94a 100644 --- a/x/cdp/types/keys.go +++ b/x/cdp/types/keys.go @@ -2,6 +2,7 @@ package types import ( "bytes" + sdkmath "cosmossdk.io/math" "encoding/binary" sdk "github.com/cosmos/cosmos-sdk/types" @@ -115,17 +116,17 @@ func SplitDepositIterKey(key []byte) (cdpID uint64) { } // CollateralRatioBytes returns the liquidation ratio as sortable bytes -func CollateralRatioBytes(ratio sdk.Dec) []byte { +func CollateralRatioBytes(ratio sdkmath.LegacyDec) []byte { ok := ValidSortableDec(ratio) if !ok { // set to max sortable if input is too large. - ratio = sdk.OneDec().Quo(sdk.SmallestDec()) + ratio = sdkmath.LegacyOneDec().Quo(sdkmath.LegacySmallestDec()) } return SortableDecBytes(ratio) } // CollateralRatioKey returns the key for querying a cdp by its liquidation ratio -func CollateralRatioKey(collateralType string, cdpID uint64, ratio sdk.Dec) []byte { +func CollateralRatioKey(collateralType string, cdpID uint64, ratio sdkmath.LegacyDec) []byte { ratioBytes := CollateralRatioBytes(ratio) idBytes := GetCdpIDBytes(cdpID) @@ -133,7 +134,7 @@ func CollateralRatioKey(collateralType string, cdpID uint64, ratio sdk.Dec) []by } // SplitCollateralRatioKey split the collateral ratio key and return the denom, cdp id, and collateral:debt ratio -func SplitCollateralRatioKey(key []byte) (string, uint64, sdk.Dec) { +func SplitCollateralRatioKey(key []byte) (string, uint64, sdkmath.LegacyDec) { cdpID := GetCdpIDFromBytes(key[len(key)-8:]) split := bytes.Split(key[:len(key)-8], sep) collateralType := string(split[0]) @@ -146,13 +147,13 @@ func SplitCollateralRatioKey(key []byte) (string, uint64, sdk.Dec) { } // CollateralRatioIterKey returns the key for iterating over cdps by denom and liquidation ratio -func CollateralRatioIterKey(collateralType string, ratio sdk.Dec) []byte { +func CollateralRatioIterKey(collateralType string, ratio sdkmath.LegacyDec) []byte { ratioBytes := CollateralRatioBytes(ratio) return createKey([]byte(collateralType), sep, ratioBytes) } // SplitCollateralRatioIterKey split the collateral ratio key and return the denom, cdp id, and collateral:debt ratio -func SplitCollateralRatioIterKey(key []byte) (string, sdk.Dec) { +func SplitCollateralRatioIterKey(key []byte) (string, sdkmath.LegacyDec) { split := bytes.Split(key, sep) collateralType := string(split[0]) diff --git a/x/cdp/types/keys_test.go b/x/cdp/types/keys_test.go index adb3b8397b..cbd7da1dc3 100644 --- a/x/cdp/types/keys_test.go +++ b/x/cdp/types/keys_test.go @@ -1,6 +1,7 @@ package types import ( + sdkmath "cosmossdk.io/math" "testing" "github.com/stretchr/testify/require" @@ -43,15 +44,15 @@ func TestDepositIterKey_Invalid(t *testing.T) { } func TestCollateralRatioKey(t *testing.T) { - collateralKey := CollateralRatioKey("kava-a", 2, sdk.MustNewDecFromStr("1.50")) + collateralKey := CollateralRatioKey("kava-a", 2, sdkmath.LegacyMustNewDecFromStr("1.50")) collateralType, id, ratio := SplitCollateralRatioKey(collateralKey) require.Equal(t, "kava-a", collateralType) require.Equal(t, 2, int(id)) - require.Equal(t, ratio, sdk.MustNewDecFromStr("1.50")) + require.Equal(t, ratio, sdkmath.LegacyMustNewDecFromStr("1.50")) } func TestCollateralRatioKey_BigRatio(t *testing.T) { - bigRatio := sdk.OneDec().Quo(sdk.SmallestDec()).Mul(sdk.OneDec().Add(sdk.OneDec())) + bigRatio := sdkmath.LegacyOneDec().Quo(sdkmath.LegacySmallestDec()).Mul(sdkmath.LegacyOneDec().Add(sdkmath.LegacyOneDec())) collateralKey := CollateralRatioKey("kava-a", 2, bigRatio) collateralType, id, ratio := SplitCollateralRatioKey(collateralKey) require.Equal(t, "kava-a", collateralType) @@ -64,10 +65,10 @@ func TestCollateralRatioKey_Invalid(t *testing.T) { } func TestCollateralRatioIterKey(t *testing.T) { - collateralIterKey := CollateralRatioIterKey("kava-a", sdk.MustNewDecFromStr("1.50")) + collateralIterKey := CollateralRatioIterKey("kava-a", sdkmath.LegacyMustNewDecFromStr("1.50")) collateralType, ratio := SplitCollateralRatioIterKey(collateralIterKey) require.Equal(t, "kava-a", collateralType) - require.Equal(t, ratio, sdk.MustNewDecFromStr("1.50")) + require.Equal(t, ratio, sdkmath.LegacyMustNewDecFromStr("1.50")) } func TestCollateralRatioIterKey_Invalid(t *testing.T) { diff --git a/x/cdp/types/msg.go b/x/cdp/types/msg.go index 32f6a3088a..ba2a7b53e9 100644 --- a/x/cdp/types/msg.go +++ b/x/cdp/types/msg.go @@ -1,8 +1,14 @@ package types import ( + txsigning "cosmossdk.io/x/tx/signing" "errors" "fmt" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + protov1 "github.com/golang/protobuf/proto" + protov2 "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/protoadapt" + "google.golang.org/protobuf/reflect/protoreflect" "strings" errorsmod "cosmossdk.io/errors" @@ -20,6 +26,33 @@ var ( _ sdk.Msg = &MsgLiquidate{} ) +var ( + MsgCreateCDPGetSigners = txsigning.CustomGetSigner{ + MsgType: protoreflect.FullName(protov1.MessageName(&MsgCreateCDP{})), + Fn: GetSignersMsgCreateCDP, + } + MsgDepositGetSigners = txsigning.CustomGetSigner{ + MsgType: protoreflect.FullName(protov1.MessageName(&MsgDeposit{})), + Fn: GetSignersMsgDeposit, + } + MsgWithdrawGetSigners = txsigning.CustomGetSigner{ + MsgType: protoreflect.FullName(protov1.MessageName(&MsgWithdraw{})), + Fn: GetSignersMsgWithdraw, + } + MsgDrawDebtGetSigners = txsigning.CustomGetSigner{ + MsgType: protoreflect.FullName(protov1.MessageName(&MsgDrawDebt{})), + Fn: GetSignersMsgDrawDebt, + } + MsgRepayDebtGetSigners = txsigning.CustomGetSigner{ + MsgType: protoreflect.FullName(protov1.MessageName(&MsgRepayDebt{})), + Fn: GetSignersMsgRepayDebt, + } + MsgLiquidateGetSigners = txsigning.CustomGetSigner{ + MsgType: protoreflect.FullName(protov1.MessageName(&MsgLiquidate{})), + Fn: GetSignersMsgLiquidate, + } +) + // NewMsgCreateCDP returns a new MsgPlaceBid. func NewMsgCreateCDP(sender sdk.AccAddress, collateral sdk.Coin, principal sdk.Coin, collateralType string) MsgCreateCDP { return MsgCreateCDP{ @@ -61,7 +94,7 @@ func (msg MsgCreateCDP) GetSignBytes() []byte { return sdk.MustSortJSON(bz) } -// GetSigners returns the addresses of signers that must sign. +// GetSignersMsgCreateCDP returns the addresses of signers that must sign. func (msg MsgCreateCDP) GetSigners() []sdk.AccAddress { sender, err := sdk.AccAddressFromBech32(msg.Sender) if err != nil { @@ -70,6 +103,28 @@ func (msg MsgCreateCDP) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{sender} } +func GetSignersMsgCreateCDP(msg protov2.Message) ([][]byte, error) { + msgV1 := protoadapt.MessageV1Of(msg) + + tryingTypeAnyV1, err := codectypes.NewAnyWithValue(msgV1) + if err != nil { + return nil, err + } + + msgTyped := &MsgCreateCDP{} + err = msgTyped.Unmarshal(tryingTypeAnyV1.Value) + if err != nil { + return nil, err + } + + sender, err := sdk.AccAddressFromBech32(msgTyped.Sender) + if err != nil { + return nil, err + } + + return [][]byte{sender}, nil +} + // NewMsgDeposit returns a new MsgDeposit func NewMsgDeposit(owner sdk.AccAddress, depositor sdk.AccAddress, collateral sdk.Coin, collateralType string) MsgDeposit { return MsgDeposit{ @@ -112,13 +167,35 @@ func (msg MsgDeposit) GetSignBytes() []byte { return sdk.MustSortJSON(bz) } -// GetSigners returns the addresses of signers that must sign. -func (msg MsgDeposit) GetSigners() []sdk.AccAddress { - depositor, err := sdk.AccAddressFromBech32(msg.Depositor) +// GetSignersMsgCreateCDP returns the addresses of signers that must sign. +//func (msg MsgDeposit) GetSigners() []sdk.AccAddress { +// depositor, err := sdk.AccAddressFromBech32(msg.Depositor) +// if err != nil { +// panic(err) +// } +// return []sdk.AccAddress{depositor} +//} + +func GetSignersMsgDeposit(msg protov2.Message) ([][]byte, error) { + msgV1 := protoadapt.MessageV1Of(msg) + + tryingTypeAnyV1, err := codectypes.NewAnyWithValue(msgV1) if err != nil { - panic(err) + return nil, err } - return []sdk.AccAddress{depositor} + + msgTyped := &MsgDeposit{} + err = msgTyped.Unmarshal(tryingTypeAnyV1.Value) + if err != nil { + return nil, err + } + + depositor, err := sdk.AccAddressFromBech32(msgTyped.Depositor) + if err != nil { + return nil, err + } + + return [][]byte{depositor}, nil } // NewMsgWithdraw returns a new MsgDeposit @@ -163,7 +240,7 @@ func (msg MsgWithdraw) GetSignBytes() []byte { return sdk.MustSortJSON(bz) } -// GetSigners returns the addresses of signers that must sign. +// GetSignersMsgCreateCDP returns the addresses of signers that must sign. func (msg MsgWithdraw) GetSigners() []sdk.AccAddress { depositor, err := sdk.AccAddressFromBech32(msg.Depositor) if err != nil { @@ -172,6 +249,28 @@ func (msg MsgWithdraw) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{depositor} } +func GetSignersMsgWithdraw(msg protov2.Message) ([][]byte, error) { + msgV1 := protoadapt.MessageV1Of(msg) + + tryingTypeAnyV1, err := codectypes.NewAnyWithValue(msgV1) + if err != nil { + return nil, err + } + + msgTyped := &MsgWithdraw{} + err = msgTyped.Unmarshal(tryingTypeAnyV1.Value) + if err != nil { + return nil, err + } + + depositor, err := sdk.AccAddressFromBech32(msgTyped.Depositor) + if err != nil { + return nil, err + } + + return [][]byte{depositor}, nil +} + // NewMsgDrawDebt returns a new MsgDrawDebt func NewMsgDrawDebt(sender sdk.AccAddress, collateralType string, principal sdk.Coin) MsgDrawDebt { return MsgDrawDebt{ @@ -209,7 +308,7 @@ func (msg MsgDrawDebt) GetSignBytes() []byte { return sdk.MustSortJSON(bz) } -// GetSigners returns the addresses of signers that must sign. +// GetSignersMsgCreateCDP returns the addresses of signers that must sign. func (msg MsgDrawDebt) GetSigners() []sdk.AccAddress { sender, err := sdk.AccAddressFromBech32(msg.Sender) if err != nil { @@ -218,6 +317,28 @@ func (msg MsgDrawDebt) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{sender} } +func GetSignersMsgDrawDebt(msg protov2.Message) ([][]byte, error) { + msgV1 := protoadapt.MessageV1Of(msg) + + tryingTypeAnyV1, err := codectypes.NewAnyWithValue(msgV1) + if err != nil { + return nil, err + } + + msgTyped := &MsgDrawDebt{} + err = msgTyped.Unmarshal(tryingTypeAnyV1.Value) + if err != nil { + return nil, err + } + + sender, err := sdk.AccAddressFromBech32(msgTyped.Sender) + if err != nil { + return nil, err + } + + return [][]byte{sender}, nil +} + // NewMsgRepayDebt returns a new MsgRepayDebt func NewMsgRepayDebt(sender sdk.AccAddress, collateralType string, payment sdk.Coin) MsgRepayDebt { return MsgRepayDebt{ @@ -255,7 +376,7 @@ func (msg MsgRepayDebt) GetSignBytes() []byte { return sdk.MustSortJSON(bz) } -// GetSigners returns the addresses of signers that must sign. +// GetSignersMsgCreateCDP returns the addresses of signers that must sign. func (msg MsgRepayDebt) GetSigners() []sdk.AccAddress { sender, err := sdk.AccAddressFromBech32(msg.Sender) if err != nil { @@ -264,6 +385,28 @@ func (msg MsgRepayDebt) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{sender} } +func GetSignersMsgRepayDebt(msg protov2.Message) ([][]byte, error) { + msgV1 := protoadapt.MessageV1Of(msg) + + tryingTypeAnyV1, err := codectypes.NewAnyWithValue(msgV1) + if err != nil { + return nil, err + } + + msgTyped := &MsgRepayDebt{} + err = msgTyped.Unmarshal(tryingTypeAnyV1.Value) + if err != nil { + return nil, err + } + + sender, err := sdk.AccAddressFromBech32(msgTyped.Sender) + if err != nil { + return nil, err + } + + return [][]byte{sender}, nil +} + // NewMsgLiquidate returns a new MsgLiquidate func NewMsgLiquidate(keeper, borrower sdk.AccAddress, ctype string) MsgLiquidate { return MsgLiquidate{ @@ -302,7 +445,7 @@ func (msg MsgLiquidate) GetSignBytes() []byte { return sdk.MustSortJSON(bz) } -// GetSigners returns the addresses of signers that must sign. +// GetSignersMsgCreateCDP returns the addresses of signers that must sign. func (msg MsgLiquidate) GetSigners() []sdk.AccAddress { keeper, err := sdk.AccAddressFromBech32(msg.Keeper) if err != nil { @@ -310,3 +453,25 @@ func (msg MsgLiquidate) GetSigners() []sdk.AccAddress { } return []sdk.AccAddress{keeper} } + +func GetSignersMsgLiquidate(msg protov2.Message) ([][]byte, error) { + msgV1 := protoadapt.MessageV1Of(msg) + + tryingTypeAnyV1, err := codectypes.NewAnyWithValue(msgV1) + if err != nil { + return nil, err + } + + msgTyped := &MsgLiquidate{} + err = msgTyped.Unmarshal(tryingTypeAnyV1.Value) + if err != nil { + return nil, err + } + + keeper, err := sdk.AccAddressFromBech32(msgTyped.Keeper) + if err != nil { + return nil, err + } + + return [][]byte{keeper}, nil +} diff --git a/x/cdp/types/msg_test.go b/x/cdp/types/msg_test.go index 41ec147ae4..0d19621621 100644 --- a/x/cdp/types/msg_test.go +++ b/x/cdp/types/msg_test.go @@ -1,6 +1,7 @@ package types import ( + sdkmath "cosmossdk.io/math" "testing" "github.com/stretchr/testify/require" @@ -10,7 +11,7 @@ import ( var ( coinsSingle = sdk.NewInt64Coin(sdk.DefaultBondDenom, 1000) - coinsZero = sdk.NewCoin(sdk.DefaultBondDenom, sdk.ZeroInt()) + coinsZero = sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.ZeroInt()) addrs = []sdk.AccAddress{ sdk.AccAddress("test1"), sdk.AccAddress("test2"), diff --git a/x/cdp/types/params.go b/x/cdp/types/params.go index ca3356fb57..0d5b855c6b 100644 --- a/x/cdp/types/params.go +++ b/x/cdp/types/params.go @@ -22,7 +22,7 @@ var ( KeySurplusThreshold = []byte("SurplusThreshold") KeySurplusLot = []byte("SurplusLot") KeyBeginBlockerExecutionBlockInterval = []byte("BeginBlockerExecutionBlockInterval") - DefaultGlobalDebt = sdk.NewCoin(DefaultStableDenom, sdk.ZeroInt()) + DefaultGlobalDebt = sdk.NewCoin(DefaultStableDenom, sdkmath.ZeroInt()) DefaultCircuitBreaker = false DefaultCollateralParams = CollateralParams{} DefaultDebtParam = DebtParam{ @@ -39,7 +39,7 @@ var ( DefaultDebtThreshold = sdkmath.NewInt(100000000000) DefaultSurplusLot = sdkmath.NewInt(10000000000) DefaultDebtLot = sdkmath.NewInt(10000000000) - stabilityFeeMax = sdk.MustNewDecFromStr("1.000000051034942716") // 500% APR + stabilityFeeMax = sdkmath.LegacyMustNewDecFromStr("1.000000051034942716") // 500% APR // Run every block DefaultBeginBlockerExecutionBlockInterval = int64(1) ) @@ -73,8 +73,8 @@ func DefaultParams() Params { // NewCollateralParam returns a new CollateralParam func NewCollateralParam( - denom, ctype string, liqRatio sdk.Dec, debtLimit sdk.Coin, stabilityFee sdk.Dec, auctionSize sdkmath.Int, - liqPenalty sdk.Dec, spotMarketID, liquidationMarketID string, keeperReward sdk.Dec, checkIndexCount sdkmath.Int, conversionFactor sdkmath.Int, + denom, ctype string, liqRatio sdkmath.LegacyDec, debtLimit sdk.Coin, stabilityFee sdkmath.LegacyDec, auctionSize sdkmath.Int, + liqPenalty sdkmath.LegacyDec, spotMarketID, liquidationMarketID string, keeperReward sdkmath.LegacyDec, checkIndexCount sdkmath.Int, conversionFactor sdkmath.Int, ) CollateralParam { return CollateralParam{ Denom: denom, @@ -181,7 +181,7 @@ func (p Params) Validate() error { // validate collateral params collateralTypeDupMap := make(map[string]bool) - collateralParamsDebtLimit := sdk.ZeroInt() + collateralParamsDebtLimit := sdkmath.ZeroInt() for _, cp := range p.CollateralParams { // Collateral type eg busd-a should be unique, but denom can be same eg busd @@ -263,16 +263,16 @@ func validateCollateralParams(i interface{}) error { return fmt.Errorf("liquidation ratio must be > 0") } - if cp.LiquidationPenalty.LT(sdk.ZeroDec()) || cp.LiquidationPenalty.GT(sdk.OneDec()) { + if cp.LiquidationPenalty.LT(sdkmath.LegacyZeroDec()) || cp.LiquidationPenalty.GT(sdkmath.LegacyOneDec()) { return fmt.Errorf("liquidation penalty should be between 0 and 1, is %s for %s", cp.LiquidationPenalty, cp.Denom) } if !cp.AuctionSize.IsPositive() { return fmt.Errorf("auction size should be positive, is %s for %s", cp.AuctionSize, cp.Denom) } - if cp.StabilityFee.LT(sdk.OneDec()) || cp.StabilityFee.GT(stabilityFeeMax) { + if cp.StabilityFee.LT(sdkmath.LegacyOneDec()) || cp.StabilityFee.GT(stabilityFeeMax) { return fmt.Errorf("stability fee must be ≥ 1.0, ≤ %s, is %s for %s", stabilityFeeMax, cp.StabilityFee, cp.Denom) } - if cp.KeeperRewardPercentage.IsNegative() || cp.KeeperRewardPercentage.GT(sdk.OneDec()) { + if cp.KeeperRewardPercentage.IsNegative() || cp.KeeperRewardPercentage.GT(sdkmath.LegacyOneDec()) { return fmt.Errorf("keeper reward percentage should be between 0 and 1, is %s for %s", cp.KeeperRewardPercentage, cp.Denom) } if cp.CheckCollateralizationIndexCount.IsNegative() { diff --git a/x/cdp/types/params_test.go b/x/cdp/types/params_test.go index 0dd727673f..fe1b199371 100644 --- a/x/cdp/types/params_test.go +++ b/x/cdp/types/params_test.go @@ -66,14 +66,14 @@ func (suite *ParamsTestSuite) TestParamValidation() { { Denom: "bnb", Type: "bnb-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("1.5"), DebtLimit: sdk.NewInt64Coin("usdx", 2000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"), + LiquidationPenalty: sdkmath.LegacyMustNewDecFromStr("0.05"), AuctionSize: sdkmath.NewInt(50000000000), SpotMarketID: "bnb:usd", LiquidationMarketID: "bnb:usd", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), + KeeperRewardPercentage: sdkmath.LegacyMustNewDecFromStr("0.01"), ConversionFactor: sdkmath.NewInt(8), CheckCollateralizationIndexCount: sdkmath.NewInt(10), }, @@ -104,14 +104,14 @@ func (suite *ParamsTestSuite) TestParamValidation() { { Denom: "bnb", Type: "bnb-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("1.5"), DebtLimit: sdk.NewInt64Coin("usdx", 2000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"), + LiquidationPenalty: sdkmath.LegacyMustNewDecFromStr("0.05"), AuctionSize: sdkmath.NewInt(50000000000), SpotMarketID: "bnb:usd", LiquidationMarketID: "bnb:usd", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), + KeeperRewardPercentage: sdkmath.LegacyMustNewDecFromStr("0.01"), ConversionFactor: sdkmath.NewInt(8), CheckCollateralizationIndexCount: sdkmath.NewInt(10), }, @@ -142,14 +142,14 @@ func (suite *ParamsTestSuite) TestParamValidation() { { Denom: "bnb", Type: "bnb-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("1.5"), DebtLimit: sdk.NewInt64Coin("usdx", 2000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"), + LiquidationPenalty: sdkmath.LegacyMustNewDecFromStr("0.05"), AuctionSize: sdkmath.NewInt(50000000000), SpotMarketID: "bnb:usd", LiquidationMarketID: "bnb:usd", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), + KeeperRewardPercentage: sdkmath.LegacyMustNewDecFromStr("0.01"), ConversionFactor: sdkmath.NewInt(8), CheckCollateralizationIndexCount: sdkmath.NewInt(10), }, @@ -180,28 +180,28 @@ func (suite *ParamsTestSuite) TestParamValidation() { { Denom: "bnb", Type: "bnb-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("1.5"), DebtLimit: sdk.NewInt64Coin("usdx", 2000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"), + LiquidationPenalty: sdkmath.LegacyMustNewDecFromStr("0.05"), AuctionSize: sdkmath.NewInt(50000000000), SpotMarketID: "bnb:usd", LiquidationMarketID: "bnb:usd", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), + KeeperRewardPercentage: sdkmath.LegacyMustNewDecFromStr("0.01"), ConversionFactor: sdkmath.NewInt(8), CheckCollateralizationIndexCount: sdkmath.NewInt(10), }, { Denom: "xrp", Type: "xrp-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("1.5"), DebtLimit: sdk.NewInt64Coin("usdx", 2000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"), + LiquidationPenalty: sdkmath.LegacyMustNewDecFromStr("0.05"), AuctionSize: sdkmath.NewInt(50000000000), SpotMarketID: "xrp:usd", LiquidationMarketID: "xrp:usd", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), + KeeperRewardPercentage: sdkmath.LegacyMustNewDecFromStr("0.01"), ConversionFactor: sdkmath.NewInt(6), CheckCollateralizationIndexCount: sdkmath.NewInt(10), }, @@ -232,28 +232,28 @@ func (suite *ParamsTestSuite) TestParamValidation() { { Denom: "bnb", Type: "bnb-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("1.5"), DebtLimit: sdk.NewInt64Coin("usdx", 2000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"), + LiquidationPenalty: sdkmath.LegacyMustNewDecFromStr("0.05"), AuctionSize: sdkmath.NewInt(50000000000), SpotMarketID: "bnb:usd", LiquidationMarketID: "bnb:usd", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), + KeeperRewardPercentage: sdkmath.LegacyMustNewDecFromStr("0.01"), ConversionFactor: sdkmath.NewInt(8), CheckCollateralizationIndexCount: sdkmath.NewInt(10), }, { Denom: "xrp", Type: "xrp-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("1.5"), DebtLimit: sdk.NewInt64Coin("usdx", 2000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"), + LiquidationPenalty: sdkmath.LegacyMustNewDecFromStr("0.05"), AuctionSize: sdkmath.NewInt(50000000000), SpotMarketID: "xrp:usd", LiquidationMarketID: "xrp:usd", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), + KeeperRewardPercentage: sdkmath.LegacyMustNewDecFromStr("0.01"), ConversionFactor: sdkmath.NewInt(6), CheckCollateralizationIndexCount: sdkmath.NewInt(10), }, @@ -284,28 +284,28 @@ func (suite *ParamsTestSuite) TestParamValidation() { { Denom: "bnb", Type: "bnb-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("1.5"), DebtLimit: sdk.NewInt64Coin("usdx", 2000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"), + LiquidationPenalty: sdkmath.LegacyMustNewDecFromStr("0.05"), AuctionSize: sdkmath.NewInt(50000000000), SpotMarketID: "bnb:usd", LiquidationMarketID: "bnb:usd", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), + KeeperRewardPercentage: sdkmath.LegacyMustNewDecFromStr("0.01"), ConversionFactor: sdkmath.NewInt(8), CheckCollateralizationIndexCount: sdkmath.NewInt(10), }, { Denom: "xrp", Type: "xrp-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("1.5"), DebtLimit: sdk.NewInt64Coin("susd", 2000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"), + LiquidationPenalty: sdkmath.LegacyMustNewDecFromStr("0.05"), AuctionSize: sdkmath.NewInt(50000000000), SpotMarketID: "xrp:usd", LiquidationMarketID: "xrp:usd", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), + KeeperRewardPercentage: sdkmath.LegacyMustNewDecFromStr("0.01"), ConversionFactor: sdkmath.NewInt(6), CheckCollateralizationIndexCount: sdkmath.NewInt(10), }, @@ -335,14 +335,14 @@ func (suite *ParamsTestSuite) TestParamValidation() { collateralParams: types.CollateralParams{ { Denom: "", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("1.5"), DebtLimit: sdk.NewInt64Coin("usdx", 2000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"), + LiquidationPenalty: sdkmath.LegacyMustNewDecFromStr("0.05"), AuctionSize: sdkmath.NewInt(50000000000), SpotMarketID: "bnb:usd", LiquidationMarketID: "bnb:usd", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), + KeeperRewardPercentage: sdkmath.LegacyMustNewDecFromStr("0.01"), ConversionFactor: sdkmath.NewInt(8), CheckCollateralizationIndexCount: sdkmath.NewInt(10), }, @@ -373,14 +373,14 @@ func (suite *ParamsTestSuite) TestParamValidation() { { Denom: "bnb", Type: "bnb-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("1.5"), DebtLimit: sdk.NewInt64Coin("usdx", 2000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"), + LiquidationPenalty: sdkmath.LegacyMustNewDecFromStr("0.05"), AuctionSize: sdkmath.NewInt(50000000000), SpotMarketID: "", LiquidationMarketID: "", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), + KeeperRewardPercentage: sdkmath.LegacyMustNewDecFromStr("0.01"), ConversionFactor: sdkmath.NewInt(8), CheckCollateralizationIndexCount: sdkmath.NewInt(10), }, @@ -411,28 +411,28 @@ func (suite *ParamsTestSuite) TestParamValidation() { { Denom: "bnb", Type: "bnb-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("1.5"), DebtLimit: sdk.NewInt64Coin("usdx", 1000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"), + LiquidationPenalty: sdkmath.LegacyMustNewDecFromStr("0.05"), AuctionSize: sdkmath.NewInt(50000000000), SpotMarketID: "bnb:usd", LiquidationMarketID: "bnb:usd", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), + KeeperRewardPercentage: sdkmath.LegacyMustNewDecFromStr("0.01"), ConversionFactor: sdkmath.NewInt(8), CheckCollateralizationIndexCount: sdkmath.NewInt(10), }, { Denom: "bnb", Type: "bnb-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("1.5"), DebtLimit: sdk.NewInt64Coin("usdx", 1000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"), + LiquidationPenalty: sdkmath.LegacyMustNewDecFromStr("0.05"), AuctionSize: sdkmath.NewInt(50000000000), SpotMarketID: "bnb:usd", LiquidationMarketID: "bnb:usd", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), + KeeperRewardPercentage: sdkmath.LegacyMustNewDecFromStr("0.01"), ConversionFactor: sdkmath.NewInt(8), CheckCollateralizationIndexCount: sdkmath.NewInt(10), }, @@ -463,28 +463,28 @@ func (suite *ParamsTestSuite) TestParamValidation() { { Denom: "bnb", Type: "bnb-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("1.5"), DebtLimit: sdk.NewInt64Coin("usdx", 1000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"), + LiquidationPenalty: sdkmath.LegacyMustNewDecFromStr("0.05"), AuctionSize: sdkmath.NewInt(50000000000), SpotMarketID: "bnb:usd", LiquidationMarketID: "bnb:usd", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), + KeeperRewardPercentage: sdkmath.LegacyMustNewDecFromStr("0.01"), ConversionFactor: sdkmath.NewInt(8), CheckCollateralizationIndexCount: sdkmath.NewInt(10), }, { Denom: "bnb", Type: "bnb-b", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("1.5"), DebtLimit: sdk.NewInt64Coin("usdx", 1000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"), + LiquidationPenalty: sdkmath.LegacyMustNewDecFromStr("0.05"), AuctionSize: sdkmath.NewInt(50000000000), SpotMarketID: "bnb:usd", LiquidationMarketID: "bnb:usd", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), + KeeperRewardPercentage: sdkmath.LegacyMustNewDecFromStr("0.01"), ConversionFactor: sdkmath.NewInt(8), CheckCollateralizationIndexCount: sdkmath.NewInt(10), }, @@ -515,14 +515,14 @@ func (suite *ParamsTestSuite) TestParamValidation() { { Denom: "bnb", Type: "bnb-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("1.5"), DebtLimit: sdk.Coin{}, - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"), + LiquidationPenalty: sdkmath.LegacyMustNewDecFromStr("0.05"), AuctionSize: sdkmath.NewInt(50000000000), SpotMarketID: "bnb:usd", LiquidationMarketID: "bnb:usd", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), + KeeperRewardPercentage: sdkmath.LegacyMustNewDecFromStr("0.01"), ConversionFactor: sdkmath.NewInt(8), CheckCollateralizationIndexCount: sdkmath.NewInt(10), }, @@ -553,14 +553,14 @@ func (suite *ParamsTestSuite) TestParamValidation() { { Denom: "bnb", Type: "bnb-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("1.5"), DebtLimit: sdk.NewInt64Coin("usdx", 1000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), - LiquidationPenalty: sdk.MustNewDecFromStr("1.05"), + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"), + LiquidationPenalty: sdkmath.LegacyMustNewDecFromStr("1.05"), AuctionSize: sdkmath.NewInt(50000000000), SpotMarketID: "bnb:usd", LiquidationMarketID: "bnb:usd", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), + KeeperRewardPercentage: sdkmath.LegacyMustNewDecFromStr("0.01"), ConversionFactor: sdkmath.NewInt(8), CheckCollateralizationIndexCount: sdkmath.NewInt(10), }, @@ -591,14 +591,14 @@ func (suite *ParamsTestSuite) TestParamValidation() { { Denom: "bnb", Type: "bnb-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("1.5"), DebtLimit: sdk.NewInt64Coin("usdx", 1000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), - AuctionSize: sdk.ZeroInt(), + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"), + LiquidationPenalty: sdkmath.LegacyMustNewDecFromStr("0.05"), + AuctionSize: sdkmath.ZeroInt(), SpotMarketID: "bnb:usd", LiquidationMarketID: "bnb:usd", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), + KeeperRewardPercentage: sdkmath.LegacyMustNewDecFromStr("0.01"), ConversionFactor: sdkmath.NewInt(8), CheckCollateralizationIndexCount: sdkmath.NewInt(10), }, @@ -629,14 +629,14 @@ func (suite *ParamsTestSuite) TestParamValidation() { { Denom: "bnb", Type: "bnb-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("1.5"), DebtLimit: sdk.NewInt64Coin("usdx", 1000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.1"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.1"), + LiquidationPenalty: sdkmath.LegacyMustNewDecFromStr("0.05"), AuctionSize: sdkmath.NewInt(50000000000), SpotMarketID: "bnb:usd", LiquidationMarketID: "bnb:usd", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), + KeeperRewardPercentage: sdkmath.LegacyMustNewDecFromStr("0.01"), ConversionFactor: sdkmath.NewInt(8), CheckCollateralizationIndexCount: sdkmath.NewInt(10), }, @@ -667,14 +667,14 @@ func (suite *ParamsTestSuite) TestParamValidation() { { Denom: "bnb", Type: "bnb-a", - LiquidationRatio: sdk.MustNewDecFromStr("0.0"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("0.0"), DebtLimit: sdk.NewInt64Coin("usdx", 1_000_000_000_000), - StabilityFee: sdk.MustNewDecFromStr("1.1"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.1"), + LiquidationPenalty: sdkmath.LegacyMustNewDecFromStr("0.05"), AuctionSize: sdkmath.NewInt(50_000_000_000), SpotMarketID: "bnb:usd", LiquidationMarketID: "bnb:usd", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), + KeeperRewardPercentage: sdkmath.LegacyMustNewDecFromStr("0.01"), ConversionFactor: sdkmath.NewInt(8), CheckCollateralizationIndexCount: sdkmath.NewInt(10), }, @@ -700,14 +700,14 @@ func (suite *ParamsTestSuite) TestParamValidation() { { Denom: "bnb", Type: "bnb-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("1.5"), DebtLimit: sdk.NewInt64Coin("usdx", 2000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"), + LiquidationPenalty: sdkmath.LegacyMustNewDecFromStr("0.05"), AuctionSize: sdkmath.NewInt(50000000000), SpotMarketID: "bnb:usd", LiquidationMarketID: "bnb:usd", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), + KeeperRewardPercentage: sdkmath.LegacyMustNewDecFromStr("0.01"), ConversionFactor: sdkmath.NewInt(8), CheckCollateralizationIndexCount: sdkmath.NewInt(10), }, @@ -754,7 +754,7 @@ func (suite *ParamsTestSuite) TestParamValidation() { globalDebtLimit: types.DefaultGlobalDebt, collateralParams: types.DefaultCollateralParams, debtParam: types.DefaultDebtParam, - surplusThreshold: sdk.ZeroInt(), + surplusThreshold: sdkmath.ZeroInt(), surplusLot: types.DefaultSurplusLot, debtThreshold: types.DefaultDebtThreshold, debtLot: types.DefaultDebtLot, @@ -774,7 +774,7 @@ func (suite *ParamsTestSuite) TestParamValidation() { debtParam: types.DefaultDebtParam, surplusThreshold: types.DefaultSurplusThreshold, surplusLot: types.DefaultSurplusLot, - debtThreshold: sdk.ZeroInt(), + debtThreshold: sdkmath.ZeroInt(), debtLot: types.DefaultDebtLot, breaker: types.DefaultCircuitBreaker, beginBlockerExecutionBlockInterval: types.DefaultBeginBlockerExecutionBlockInterval, @@ -791,7 +791,7 @@ func (suite *ParamsTestSuite) TestParamValidation() { collateralParams: types.DefaultCollateralParams, debtParam: types.DefaultDebtParam, surplusThreshold: types.DefaultSurplusThreshold, - surplusLot: sdk.ZeroInt(), + surplusLot: sdkmath.ZeroInt(), debtThreshold: types.DefaultDebtThreshold, debtLot: types.DefaultDebtLot, breaker: types.DefaultCircuitBreaker, @@ -811,7 +811,7 @@ func (suite *ParamsTestSuite) TestParamValidation() { surplusThreshold: types.DefaultSurplusThreshold, surplusLot: types.DefaultSurplusLot, debtThreshold: types.DefaultDebtThreshold, - debtLot: sdk.ZeroInt(), + debtLot: sdkmath.ZeroInt(), breaker: types.DefaultCircuitBreaker, beginBlockerExecutionBlockInterval: types.DefaultBeginBlockerExecutionBlockInterval, }, diff --git a/x/cdp/types/querier.go b/x/cdp/types/querier.go index f3e6a69b9d..0288a1c4d4 100644 --- a/x/cdp/types/querier.go +++ b/x/cdp/types/querier.go @@ -1,21 +1,22 @@ package types import ( + sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" ) // QueryCdpsParams is the params for a filtered CDP query type QueryCdpsParams struct { - Page int `json:"page" yaml:"page"` - Limit int `json:"limit" yaml:"limit"` - CollateralType string `json:"collateral_type" yaml:"collateral_type"` - Owner sdk.AccAddress `json:"owner" yaml:"owner"` - ID uint64 `json:"id" yaml:"id"` - Ratio sdk.Dec `json:"ratio" yaml:"ratio"` + Page int `json:"page" yaml:"page"` + Limit int `json:"limit" yaml:"limit"` + CollateralType string `json:"collateral_type" yaml:"collateral_type"` + Owner sdk.AccAddress `json:"owner" yaml:"owner"` + ID uint64 `json:"id" yaml:"id"` + Ratio sdkmath.LegacyDec `json:"ratio" yaml:"ratio"` } // NewQueryCdpsParams creates a new QueryCdpsParams -func NewQueryCdpsParams(page, limit int, collateralType string, owner sdk.AccAddress, id uint64, ratio sdk.Dec) QueryCdpsParams { +func NewQueryCdpsParams(page, limit int, collateralType string, owner sdk.AccAddress, id uint64, ratio sdkmath.LegacyDec) QueryCdpsParams { return QueryCdpsParams{ Page: page, Limit: limit, diff --git a/x/cdp/types/query.pb.go b/x/cdp/types/query.pb.go index ca16689f90..1bd105f16d 100644 --- a/x/cdp/types/query.pb.go +++ b/x/cdp/types/query.pb.go @@ -297,7 +297,7 @@ type QueryCdpsRequest struct { CollateralType string `protobuf:"bytes,1,opt,name=collateral_type,json=collateralType,proto3" json:"collateral_type,omitempty"` Owner string `protobuf:"bytes,2,opt,name=owner,proto3" json:"owner,omitempty"` ID uint64 `protobuf:"varint,3,opt,name=id,proto3" json:"id,omitempty"` - // sdk.Dec as a string + // sdkmath.LegacyDec as a string Ratio string `protobuf:"bytes,4,opt,name=ratio,proto3" json:"ratio,omitempty"` Pagination *query.PageRequest `protobuf:"bytes,5,opt,name=pagination,proto3" json:"pagination,omitempty"` } @@ -1187,6 +1187,7 @@ func _Query_Deposits_Handler(srv interface{}, ctx context.Context, dec func(inte return interceptor(ctx, in, info, handler) } +var Query_serviceDesc = _Query_serviceDesc var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "kava.cdp.v1beta1.Query", HandlerType: (*QueryServer)(nil), diff --git a/x/cdp/types/tx.pb.go b/x/cdp/types/tx.pb.go index f21bd475c3..3aae65f830 100644 --- a/x/cdp/types/tx.pb.go +++ b/x/cdp/types/tx.pb.go @@ -953,6 +953,7 @@ func _Msg_Liquidate_Handler(srv interface{}, ctx context.Context, dec func(inter return interceptor(ctx, in, info, handler) } +var Msg_serviceDesc = _Msg_serviceDesc var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "kava.cdp.v1beta1.Msg", HandlerType: (*MsgServer)(nil), diff --git a/x/cdp/types/utils.go b/x/cdp/types/utils.go index 518fc0fde0..14803ad5a5 100644 --- a/x/cdp/types/utils.go +++ b/x/cdp/types/utils.go @@ -6,21 +6,20 @@ import ( "strings" sdkmath "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" ) -// MaxSortableDec largest sortable sdk.Dec -var MaxSortableDec = sdk.OneDec().Quo(sdk.SmallestDec()) +// MaxSortableDec largest sortable sdkmath.LegacyDec +var MaxSortableDec = sdkmath.LegacyOneDec().Quo(sdkmath.LegacySmallestDec()) -// ValidSortableDec sdk.Dec can't have precision of less than 10^-18 -func ValidSortableDec(dec sdk.Dec) bool { +// ValidSortableDec sdkmath.LegacyDec can't have precision of less than 10^-18 +func ValidSortableDec(dec sdkmath.LegacyDec) bool { return dec.Abs().LTE(MaxSortableDec) } // SortableDecBytes returns a byte slice representation of a Dec that can be sorted. // Left and right pads with 0s so there are 18 digits to left and right of the decimal point. // For this reason, there is a maximum and minimum value for this, enforced by ValidSortableDec. -func SortableDecBytes(dec sdk.Dec) []byte { +func SortableDecBytes(dec sdkmath.LegacyDec) []byte { if !ValidSortableDec(dec) { panic("dec must be within bounds") } @@ -35,13 +34,13 @@ func SortableDecBytes(dec sdk.Dec) []byte { } // We move the negative sign to the front of all the left padded 0s, to make negative numbers come before positive numbers if dec.IsNegative() { - return append([]byte("-"), []byte(fmt.Sprintf(fmt.Sprintf("%%0%ds", sdk.Precision*2+1), dec.Abs().String()))...) + return append([]byte("-"), []byte(fmt.Sprintf(fmt.Sprintf("%%0%ds", sdkmath.LegacyPrecision*2+1), dec.Abs().String()))...) } - return []byte(fmt.Sprintf(fmt.Sprintf("%%0%ds", sdk.Precision*2+1), dec.String())) + return []byte(fmt.Sprintf(fmt.Sprintf("%%0%ds", sdkmath.LegacyPrecision*2+1), dec.String())) } -// ParseDecBytes parses a []byte encoded using SortableDecBytes back to sdk.Dec -func ParseDecBytes(db []byte) (sdk.Dec, error) { +// ParseDecBytes parses a []byte encoded using SortableDecBytes back to sdkmath.LegacyDec +func ParseDecBytes(db []byte) (sdkmath.LegacyDec, error) { strFromDecBytes := strings.Trim(string(db[:]), "0") if string(strFromDecBytes[0]) == "." { strFromDecBytes = "0" + strFromDecBytes @@ -55,9 +54,9 @@ func ParseDecBytes(db []byte) (sdk.Dec, error) { if bytes.Equal(db, []byte("--")) { return MaxSortableDec.Neg(), nil } - dec, err := sdk.NewDecFromStr(strFromDecBytes) + dec, err := sdkmath.LegacyNewDecFromStr(strFromDecBytes) if err != nil { - return sdk.Dec{}, err + return sdkmath.LegacyDec{}, err } return dec, nil } @@ -71,25 +70,25 @@ func RelativePow(x sdkmath.Int, n sdkmath.Int, b sdkmath.Int) (z sdkmath.Int) { z = b // 0^0 = 1 return } - z = sdk.ZeroInt() // otherwise 0^a = 0 + z = sdkmath.ZeroInt() // otherwise 0^a = 0 return } z = x - if n.Mod(sdkmath.NewInt(2)).Equal(sdk.ZeroInt()) { + if n.Mod(sdkmath.NewInt(2)).Equal(sdkmath.ZeroInt()) { z = b } halfOfB := b.Quo(sdkmath.NewInt(2)) n = n.Quo(sdkmath.NewInt(2)) - for n.GT(sdk.ZeroInt()) { + for n.GT(sdkmath.ZeroInt()) { xSquared := x.Mul(x) xSquaredRounded := xSquared.Add(halfOfB) x = xSquaredRounded.Quo(b) - if n.Mod(sdkmath.NewInt(2)).Equal(sdk.OneInt()) { + if n.Mod(sdkmath.NewInt(2)).Equal(sdkmath.OneInt()) { zx := z.Mul(x) zxRounded := zx.Add(halfOfB) z = zxRounded.Quo(b) diff --git a/x/cdp/types/utils_test.go b/x/cdp/types/utils_test.go index 88856df160..0426ea02f3 100644 --- a/x/cdp/types/utils_test.go +++ b/x/cdp/types/utils_test.go @@ -7,54 +7,53 @@ import ( "github.com/stretchr/testify/require" sdkmath "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" ) func TestSortableDecBytes(t *testing.T) { tests := []struct { - d sdk.Dec + d sdkmath.LegacyDec want []byte }{ - {sdk.NewDec(0), []byte("000000000000000000.000000000000000000")}, - {sdk.NewDec(1), []byte("000000000000000001.000000000000000000")}, - {sdk.MustNewDecFromStr("2.0"), []byte("000000000000000002.000000000000000000")}, - {sdk.MustNewDecFromStr("-2.0"), []byte("-000000000000000002.000000000000000000")}, - {sdk.NewDec(10), []byte("000000000000000010.000000000000000000")}, - {sdk.NewDec(12340), []byte("000000000000012340.000000000000000000")}, - {sdk.NewDecWithPrec(12340, 4), []byte("000000000000000001.234000000000000000")}, - {sdk.NewDecWithPrec(12340, 5), []byte("000000000000000000.123400000000000000")}, - {sdk.NewDecWithPrec(12340, 8), []byte("000000000000000000.000123400000000000")}, - {sdk.NewDecWithPrec(1009009009009009009, 17), []byte("000000000000000010.090090090090090090")}, - {sdk.NewDecWithPrec(-1009009009009009009, 17), []byte("-000000000000000010.090090090090090090")}, - {sdk.NewDec(1000000000000000000), []byte("max")}, - {sdk.NewDec(-1000000000000000000), []byte("--")}, + {sdkmath.LegacyNewDec(0), []byte("000000000000000000.000000000000000000")}, + {sdkmath.LegacyNewDec(1), []byte("000000000000000001.000000000000000000")}, + {sdkmath.LegacyMustNewDecFromStr("2.0"), []byte("000000000000000002.000000000000000000")}, + {sdkmath.LegacyMustNewDecFromStr("-2.0"), []byte("-000000000000000002.000000000000000000")}, + {sdkmath.LegacyNewDec(10), []byte("000000000000000010.000000000000000000")}, + {sdkmath.LegacyNewDec(12340), []byte("000000000000012340.000000000000000000")}, + {sdkmath.LegacyNewDecWithPrec(12340, 4), []byte("000000000000000001.234000000000000000")}, + {sdkmath.LegacyNewDecWithPrec(12340, 5), []byte("000000000000000000.123400000000000000")}, + {sdkmath.LegacyNewDecWithPrec(12340, 8), []byte("000000000000000000.000123400000000000")}, + {sdkmath.LegacyNewDecWithPrec(1009009009009009009, 17), []byte("000000000000000010.090090090090090090")}, + {sdkmath.LegacyNewDecWithPrec(-1009009009009009009, 17), []byte("-000000000000000010.090090090090090090")}, + {sdkmath.LegacyNewDec(1000000000000000000), []byte("max")}, + {sdkmath.LegacyNewDec(-1000000000000000000), []byte("--")}, } for tcIndex, tc := range tests { assert.Equal(t, tc.want, SortableDecBytes(tc.d), "bad String(), index: %v", tcIndex) } - assert.Panics(t, func() { SortableDecBytes(sdk.NewDec(1000000000000000001)) }) - assert.Panics(t, func() { SortableDecBytes(sdk.NewDec(-1000000000000000001)) }) + assert.Panics(t, func() { SortableDecBytes(sdkmath.LegacyNewDec(1000000000000000001)) }) + assert.Panics(t, func() { SortableDecBytes(sdkmath.LegacyNewDec(-1000000000000000001)) }) } func TestParseSortableDecBytes(t *testing.T) { tests := []struct { - d sdk.Dec + d sdkmath.LegacyDec want []byte }{ - {sdk.NewDec(0), []byte("000000000000000000.000000000000000000")}, - {sdk.NewDec(1), []byte("000000000000000001.000000000000000000")}, - {sdk.MustNewDecFromStr("2.0"), []byte("000000000000000002.000000000000000000")}, - {sdk.MustNewDecFromStr("-2.0"), []byte("-000000000000000002.000000000000000000")}, - {sdk.NewDec(10), []byte("000000000000000010.000000000000000000")}, - {sdk.NewDec(12340), []byte("000000000000012340.000000000000000000")}, - {sdk.NewDecWithPrec(12340, 4), []byte("000000000000000001.234000000000000000")}, - {sdk.NewDecWithPrec(12340, 5), []byte("000000000000000000.123400000000000000")}, - {sdk.NewDecWithPrec(12340, 8), []byte("000000000000000000.000123400000000000")}, - {sdk.NewDecWithPrec(1009009009009009009, 17), []byte("000000000000000010.090090090090090090")}, - {sdk.NewDecWithPrec(-1009009009009009009, 17), []byte("-000000000000000010.090090090090090090")}, - {sdk.NewDec(1000000000000000000), []byte("max")}, - {sdk.NewDec(-1000000000000000000), []byte("--")}, + {sdkmath.LegacyNewDec(0), []byte("000000000000000000.000000000000000000")}, + {sdkmath.LegacyNewDec(1), []byte("000000000000000001.000000000000000000")}, + {sdkmath.LegacyMustNewDecFromStr("2.0"), []byte("000000000000000002.000000000000000000")}, + {sdkmath.LegacyMustNewDecFromStr("-2.0"), []byte("-000000000000000002.000000000000000000")}, + {sdkmath.LegacyNewDec(10), []byte("000000000000000010.000000000000000000")}, + {sdkmath.LegacyNewDec(12340), []byte("000000000000012340.000000000000000000")}, + {sdkmath.LegacyNewDecWithPrec(12340, 4), []byte("000000000000000001.234000000000000000")}, + {sdkmath.LegacyNewDecWithPrec(12340, 5), []byte("000000000000000000.123400000000000000")}, + {sdkmath.LegacyNewDecWithPrec(12340, 8), []byte("000000000000000000.000123400000000000")}, + {sdkmath.LegacyNewDecWithPrec(1009009009009009009, 17), []byte("000000000000000010.090090090090090090")}, + {sdkmath.LegacyNewDecWithPrec(-1009009009009009009, 17), []byte("-000000000000000010.090090090090090090")}, + {sdkmath.LegacyNewDec(1000000000000000000), []byte("max")}, + {sdkmath.LegacyNewDec(-1000000000000000000), []byte("--")}, } for tcIndex, tc := range tests { b := SortableDecBytes(tc.d) @@ -69,10 +68,10 @@ func TestRelativePow(t *testing.T) { args []sdkmath.Int want sdkmath.Int }{ - {[]sdkmath.Int{sdk.ZeroInt(), sdk.ZeroInt(), sdk.OneInt()}, sdk.OneInt()}, - {[]sdkmath.Int{sdk.ZeroInt(), sdk.ZeroInt(), sdkmath.NewInt(10)}, sdkmath.NewInt(10)}, - {[]sdkmath.Int{sdk.ZeroInt(), sdk.OneInt(), sdkmath.NewInt(10)}, sdk.ZeroInt()}, - {[]sdkmath.Int{sdkmath.NewInt(10), sdkmath.NewInt(2), sdk.OneInt()}, sdkmath.NewInt(100)}, + {[]sdkmath.Int{sdkmath.ZeroInt(), sdkmath.ZeroInt(), sdkmath.OneInt()}, sdkmath.OneInt()}, + {[]sdkmath.Int{sdkmath.ZeroInt(), sdkmath.ZeroInt(), sdkmath.NewInt(10)}, sdkmath.NewInt(10)}, + {[]sdkmath.Int{sdkmath.ZeroInt(), sdkmath.OneInt(), sdkmath.NewInt(10)}, sdkmath.ZeroInt()}, + {[]sdkmath.Int{sdkmath.NewInt(10), sdkmath.NewInt(2), sdkmath.OneInt()}, sdkmath.NewInt(100)}, {[]sdkmath.Int{sdkmath.NewInt(210), sdkmath.NewInt(2), sdkmath.NewInt(100)}, sdkmath.NewInt(441)}, {[]sdkmath.Int{sdkmath.NewInt(2100), sdkmath.NewInt(2), sdkmath.NewInt(1000)}, sdkmath.NewInt(4410)}, {[]sdkmath.Int{sdkmath.NewInt(1000000001547125958), sdkmath.NewInt(600), sdkmath.NewInt(1000000000000000000)}, sdkmath.NewInt(1000000928276004850)}, diff --git a/x/committee/abci.go b/x/committee/abci.go index 107c228986..79bdb6ae76 100644 --- a/x/committee/abci.go +++ b/x/committee/abci.go @@ -6,14 +6,12 @@ import ( "github.com/cosmos/cosmos-sdk/telemetry" sdk "github.com/cosmos/cosmos-sdk/types" - abci "github.com/cometbft/cometbft/abci/types" - "github.com/kava-labs/kava/x/committee/keeper" "github.com/kava-labs/kava/x/committee/types" ) // BeginBlocker runs at the start of every block. -func BeginBlocker(ctx sdk.Context, _ abci.RequestBeginBlock, k keeper.Keeper) { +func BeginBlocker(ctx sdk.Context, k keeper.Keeper) { defer telemetry.ModuleMeasureSince(types.ModuleName, time.Now(), telemetry.MetricKeyBeginBlocker) k.ProcessProposals(ctx) diff --git a/x/committee/abci_test.go b/x/committee/abci_test.go index 80bba98980..b9f99c9a01 100644 --- a/x/committee/abci_test.go +++ b/x/committee/abci_test.go @@ -6,7 +6,6 @@ import ( "github.com/stretchr/testify/suite" - abci "github.com/cometbft/cometbft/abci/types" tmproto "github.com/cometbft/cometbft/proto/tendermint/types" sdk "github.com/cosmos/cosmos-sdk/types" govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" @@ -33,7 +32,7 @@ type ModuleTestSuite struct { func (suite *ModuleTestSuite) SetupTest() { suite.app = app.NewTestApp() suite.keeper = suite.app.GetCommitteeKeeper() - suite.ctx = suite.app.NewContext(true, tmproto.Header{}) + suite.ctx = suite.app.NewContextLegacy(true, tmproto.Header{}) _, suite.addresses = app.GeneratePrivKeyAddressPairs(5) } @@ -63,7 +62,7 @@ func (suite *ModuleTestSuite) TestBeginBlock_ClosesExpired() { // Run BeginBlocker proposalDurationLaterCtx := suite.ctx.WithBlockTime(suite.ctx.BlockTime().Add(memberCom.ProposalDuration)) suite.NotPanics(func() { - committee.BeginBlocker(proposalDurationLaterCtx, abci.RequestBeginBlock{}, suite.keeper) + committee.BeginBlocker(proposalDurationLaterCtx, suite.keeper) }) // Check expired proposals are gone diff --git a/x/committee/client/cli/tx.go b/x/committee/client/cli/tx.go index 8aaaa882c4..628058d842 100644 --- a/x/committee/client/cli/tx.go +++ b/x/committee/client/cli/tx.go @@ -2,6 +2,7 @@ package cli import ( "bytes" + sdkmath "cosmossdk.io/math" "encoding/json" "fmt" "io/ioutil" @@ -12,12 +13,14 @@ import ( "github.com/cometbft/cometbft/crypto" "github.com/spf13/cobra" + "cosmossdk.io/errors" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/tx" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/version" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" paramsproposal "github.com/cosmos/cosmos-sdk/x/params/types/proposal" @@ -244,8 +247,15 @@ and to delete a committee: if err != nil { return err } - err = msg.ValidateBasic() - if err != nil { + + contentProposal := msg.GetContent() + if contentProposal == nil { + return errors.Wrap(govtypes.ErrInvalidProposalContent, "missing content") + } + if !govv1beta1.IsValidProposalType(contentProposal.ProposalType()) { + return errors.Wrap(govtypes.ErrInvalidProposalType, contentProposal.ProposalType()) + } + if err := contentProposal.ValidateBasic(); err != nil { return err } @@ -268,7 +278,7 @@ func MustGetExampleCommitteeChangeProposal(cdc codec.Codec) string { []types.Permission{ &types.GodPermission{}, }, - sdk.MustNewDecFromStr("0.8"), + sdkmath.LegacyMustNewDecFromStr("0.8"), time.Hour*24*7, types.TALLY_OPTION_FIRST_PAST_THE_POST, ), diff --git a/x/committee/client/common/query.go b/x/committee/client/common/query.go index 5efe31dad4..9236a74007 100644 --- a/x/committee/client/common/query.go +++ b/x/committee/client/common/query.go @@ -2,6 +2,7 @@ package common import ( "fmt" + "strings" "github.com/cosmos/cosmos-sdk/client" sdk "github.com/cosmos/cosmos-sdk/types" @@ -38,10 +39,12 @@ func QueryProposer(cliCtx client.Context, proposalID uint64) (Proposer, error) { fmt.Sprintf("%s.%s='%s'", sdk.EventTypeMessage, sdk.AttributeKeyAction, types.TypeMsgSubmitProposal), fmt.Sprintf("%s.%s='%s'", types.EventTypeProposalSubmit, types.AttributeKeyProposalID, []byte(fmt.Sprintf("%d", proposalID))), } + // removed internal join of events and requires the AND operator here + query := strings.Join(events, " AND ") // NOTE: SearchTxs is used to facilitate the txs query which does not currently // support configurable pagination. - searchResult, err := authtx.QueryTxsByEvents(cliCtx, events, defaultPage, defaultLimit, "") + searchResult, err := authtx.QueryTxsByEvents(cliCtx, defaultPage, defaultLimit, query, "") if err != nil { return Proposer{}, err } diff --git a/x/committee/genesis_test.go b/x/committee/genesis_test.go index 64f321f0ef..9b90f7a8d5 100644 --- a/x/committee/genesis_test.go +++ b/x/committee/genesis_test.go @@ -28,7 +28,7 @@ type GenesisTestSuite struct { func (suite *GenesisTestSuite) SetupTest() { suite.app = app.NewTestApp() suite.keeper = suite.app.GetCommitteeKeeper() - suite.ctx = suite.app.NewContext(true, tmproto.Header{}) + suite.ctx = suite.app.NewContextLegacy(true, tmproto.Header{}) _, suite.addresses = app.GeneratePrivKeyAddressPairs(10) } @@ -133,7 +133,7 @@ func (suite *GenesisTestSuite) TestInitGenesis() { // Setup (note: suite.SetupTest is not run before every suite.Run) suite.app = app.NewTestApp() suite.keeper = suite.app.GetCommitteeKeeper() - suite.ctx = suite.app.NewContext(true, tmproto.Header{}) + suite.ctx = suite.app.NewContextLegacy(true, tmproto.Header{}) // Run var exportedGenState *types.GenesisState diff --git a/x/committee/keeper/_param_permission_test.go b/x/committee/keeper/_param_permission_test.go index 8ebe9c26f5..9553ec1dd5 100644 --- a/x/committee/keeper/_param_permission_test.go +++ b/x/committee/keeper/_param_permission_test.go @@ -89,13 +89,13 @@ func (suite *PermissionTestSuite) TestSubParamChangePermission_Allows() { SupplyLimit: bep3types.SupplyLimit{ Limit: sdkmath.NewInt(350000000000000), TimeLimited: false, - TimeBasedLimit: sdk.ZeroInt(), + TimeBasedLimit: sdkmath.ZeroInt(), TimePeriod: time.Hour, }, Active: true, DeputyAddress: testDeputy, FixedFee: sdkmath.NewInt(1000), - MinSwapAmount: sdk.OneInt(), + MinSwapAmount: sdkmath.OneInt(), MaxSwapAmount: sdkmath.NewInt(1000000000000), MinBlockLock: bep3types.DefaultMinBlockLock, MaxBlockLock: bep3types.DefaultMaxBlockLock, @@ -112,7 +112,7 @@ func (suite *PermissionTestSuite) TestSubParamChangePermission_Allows() { Active: false, DeputyAddress: testDeputy, FixedFee: sdkmath.NewInt(1000), - MinSwapAmount: sdk.OneInt(), + MinSwapAmount: sdkmath.OneInt(), MaxSwapAmount: sdkmath.NewInt(1000000000000), MinBlockLock: bep3types.DefaultMinBlockLock, MaxBlockLock: bep3types.DefaultMaxBlockLock, @@ -157,7 +157,7 @@ func (suite *PermissionTestSuite) TestSubParamChangePermission_Allows() { { name: "normal", genState: []app.GenesisState{ - newPricefeedGenState([]string{"bnb", "btc"}, []sdk.Dec{d("15.01"), d("9500")}), + newPricefeedGenState([]string{"bnb", "btc"}, []sdkmath.LegacyDec{d("15.01"), d("9500")}), newCDPGenesisState(testCDPParams), newBep3GenesisState(testBep3Params), }, @@ -252,7 +252,7 @@ func (suite *PermissionTestSuite) TestSubParamChangePermission_Allows() { for _, tc := range testcases { suite.Run(tc.name, func() { tApp := app.NewTestApp() - ctx := tApp.NewContext(true, abci.Header{}) + ctx := tApp.NewContextLegacy(true, abci.Header{}) tApp.InitializeFromGenesisStates(tc.genState...) suite.Equal( diff --git a/x/committee/keeper/committee_test.go b/x/committee/keeper/committee_test.go index dca7454c79..47e0434211 100644 --- a/x/committee/keeper/committee_test.go +++ b/x/committee/keeper/committee_test.go @@ -165,7 +165,7 @@ package keeper_test // for _, tc := range testcases { // suite.Run(tc.name, func() { // tApp := app.NewTestApp() -// ctx := tApp.NewContext(true, abci.Header{}) +// ctx := tApp.NewContextLegacy(true, abci.Header{}) // tApp.InitializeFromGenesisStates() // com := types.NewMemberCommittee( // 12, diff --git a/x/committee/keeper/grpc_query.go b/x/committee/keeper/grpc_query.go index 0ef0bb4547..2715cc3c3a 100644 --- a/x/committee/keeper/grpc_query.go +++ b/x/committee/keeper/grpc_query.go @@ -6,7 +6,7 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/status" - "github.com/cosmos/cosmos-sdk/store/prefix" + "cosmossdk.io/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/query" diff --git a/x/committee/keeper/integration_test.go b/x/committee/keeper/integration_test.go index 75c04a0cb7..a59a1427fe 100644 --- a/x/committee/keeper/integration_test.go +++ b/x/committee/keeper/integration_test.go @@ -5,7 +5,6 @@ import ( "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" "github.com/kava-labs/kava/app" @@ -25,7 +24,7 @@ func getProposalVoteMap(k keeper.Keeper, ctx sdk.Context) map[uint64]([]types.Vo return proposalVoteMap } -func (suite *keeperTestSuite) getAccount(addr sdk.AccAddress) authtypes.AccountI { +func (suite *keeperTestSuite) getAccount(addr sdk.AccAddress) sdk.AccountI { ak := suite.App.GetAccountKeeper() return ak.GetAccount(suite.Ctx, addr) } diff --git a/x/committee/keeper/keeper.go b/x/committee/keeper/keeper.go index 703a90bea3..b3eb68b4cd 100644 --- a/x/committee/keeper/keeper.go +++ b/x/committee/keeper/keeper.go @@ -4,9 +4,9 @@ import ( "time" errorsmod "cosmossdk.io/errors" + "cosmossdk.io/store/prefix" + storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/store/prefix" - storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" @@ -80,7 +80,7 @@ func (k Keeper) DeleteCommittee(ctx sdk.Context, committeeID uint64) { // IterateCommittees provides an iterator over all stored committees. // For each committee, cb will be called. If cb returns true, the iterator will close and stop. func (k Keeper) IterateCommittees(ctx sdk.Context, cb func(committee types.Committee) (stop bool)) { - iterator := sdk.KVStorePrefixIterator(ctx.KVStore(k.storeKey), types.CommitteeKeyPrefix) + iterator := storetypes.KVStorePrefixIterator(ctx.KVStore(k.storeKey), types.CommitteeKeyPrefix) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { @@ -187,7 +187,7 @@ func (k Keeper) DeleteProposal(ctx sdk.Context, proposalID uint64) { // IterateProposals provides an iterator over all stored proposals. // For each proposal, cb will be called. If cb returns true, the iterator will close and stop. func (k Keeper) IterateProposals(ctx sdk.Context, cb func(proposal types.Proposal) (stop bool)) { - iterator := sdk.KVStorePrefixIterator(ctx.KVStore(k.storeKey), types.ProposalKeyPrefix) + iterator := storetypes.KVStorePrefixIterator(ctx.KVStore(k.storeKey), types.ProposalKeyPrefix) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { @@ -262,7 +262,7 @@ func (k Keeper) DeleteVote(ctx sdk.Context, proposalID uint64, voter sdk.AccAddr // IterateVotes provides an iterator over all stored votes. // For each vote, cb will be called. If cb returns true, the iterator will close and stop. func (k Keeper) IterateVotes(ctx sdk.Context, cb func(vote types.Vote) (stop bool)) { - iterator := sdk.KVStorePrefixIterator(ctx.KVStore(k.storeKey), types.VoteKeyPrefix) + iterator := storetypes.KVStorePrefixIterator(ctx.KVStore(k.storeKey), types.VoteKeyPrefix) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { @@ -288,7 +288,7 @@ func (k Keeper) GetVotes(ctx sdk.Context) []types.Vote { // GetVotesByProposal returns all votes for one proposal. func (k Keeper) GetVotesByProposal(ctx sdk.Context, proposalID uint64) []types.Vote { results := []types.Vote{} - iterator := sdk.KVStorePrefixIterator(ctx.KVStore(k.storeKey), append(types.VoteKeyPrefix, types.GetKeyFromID(proposalID)...)) + iterator := storetypes.KVStorePrefixIterator(ctx.KVStore(k.storeKey), append(types.VoteKeyPrefix, types.GetKeyFromID(proposalID)...)) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { diff --git a/x/committee/keeper/msg_server.go b/x/committee/keeper/msg_server.go index 2458cad080..a6211c439f 100644 --- a/x/committee/keeper/msg_server.go +++ b/x/committee/keeper/msg_server.go @@ -2,7 +2,6 @@ package keeper import ( "context" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/kava-labs/kava/x/committee/types" diff --git a/x/committee/keeper/msg_server_test.go b/x/committee/keeper/msg_server_test.go index f0141ca604..19ef0f9876 100644 --- a/x/committee/keeper/msg_server_test.go +++ b/x/committee/keeper/msg_server_test.go @@ -7,10 +7,10 @@ import ( "github.com/stretchr/testify/suite" sdkmath "cosmossdk.io/math" + upgradetypes "cosmossdk.io/x/upgrade/types" tmproto "github.com/cometbft/cometbft/proto/tendermint/types" sdk "github.com/cosmos/cosmos-sdk/types" proposal "github.com/cosmos/cosmos-sdk/x/params/types/proposal" - upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" "github.com/kava-labs/kava/app" "github.com/kava-labs/kava/x/committee/keeper" @@ -50,7 +50,7 @@ func (suite *MsgServerTestSuite) SetupTest() { "This committee is for testing.", suite.addresses[:3], []types.Permission{&types.GodPermission{}}, - sdk.MustNewDecFromStr("0.5"), + sdkmath.LegacyMustNewDecFromStr("0.5"), time.Hour*24*7, types.TALLY_OPTION_FIRST_PAST_THE_POST, ) @@ -69,7 +69,7 @@ func (suite *MsgServerTestSuite) SetupTest() { // TODO: not used? // NewDistributionGenesisWithPool(suite.communityPoolAmt), ) - suite.ctx = suite.app.NewContext(true, tmproto.Header{Height: 1, Time: firstBlockTime}) + suite.ctx = suite.app.NewContextLegacy(true, tmproto.Header{Height: 1, Time: firstBlockTime}) } func (suite *MsgServerTestSuite) TestSubmitProposalMsg_Valid() { diff --git a/x/committee/keeper/proposal.go b/x/committee/keeper/proposal.go index f9b62e22fb..21d5493b76 100644 --- a/x/committee/keeper/proposal.go +++ b/x/committee/keeper/proposal.go @@ -1,6 +1,7 @@ package keeper import ( + sdkmath "cosmossdk.io/math" "fmt" errorsmod "cosmossdk.io/errors" @@ -163,14 +164,14 @@ func (k Keeper) GetProposalResult(ctx sdk.Context, proposalID uint64, committee // GetMemberCommitteeProposalResult gets the result of a member committee proposal func (k Keeper) GetMemberCommitteeProposalResult(ctx sdk.Context, proposalID uint64, committee types.Committee) bool { currVotes := k.TallyMemberCommitteeVotes(ctx, proposalID) - possibleVotes := sdk.NewDec(int64(len(committee.GetMembers()))) + possibleVotes := sdkmath.LegacyNewDec(int64(len(committee.GetMembers()))) return currVotes.GTE(committee.GetVoteThreshold().Mul(possibleVotes)) // vote threshold requirements } // TallyMemberCommitteeVotes returns the polling status of a member committee vote -func (k Keeper) TallyMemberCommitteeVotes(ctx sdk.Context, proposalID uint64) (totalVotes sdk.Dec) { +func (k Keeper) TallyMemberCommitteeVotes(ctx sdk.Context, proposalID uint64) (totalVotes sdkmath.LegacyDec) { votes := k.GetVotesByProposal(ctx, proposalID) - return sdk.NewDec(int64(len(votes))) + return sdkmath.LegacyNewDec(int64(len(votes))) } // GetTokenCommitteeProposalResult gets the result of a token committee proposal @@ -190,28 +191,28 @@ func (k Keeper) GetTokenCommitteeProposalResult(ctx sdk.Context, proposalID uint // required for proposal to pass), and quorum (votes tallied at this percentage). func (k Keeper) TallyTokenCommitteeVotes(ctx sdk.Context, proposalID uint64, tallyDenom string, -) (yesVotes, noVotes, totalVotes, possibleVotes sdk.Dec) { +) (yesVotes, noVotes, totalVotes, possibleVotes sdkmath.LegacyDec) { votes := k.GetVotesByProposal(ctx, proposalID) - yesVotes = sdk.ZeroDec() - noVotes = sdk.ZeroDec() - totalVotes = sdk.ZeroDec() + yesVotes = sdkmath.LegacyZeroDec() + noVotes = sdkmath.LegacyZeroDec() + totalVotes = sdkmath.LegacyZeroDec() for _, vote := range votes { // 1 token = 1 vote acc := k.accountKeeper.GetAccount(ctx, vote.Voter) accNumCoins := k.bankKeeper.GetBalance(ctx, acc.GetAddress(), tallyDenom).Amount // Add votes to counters - totalVotes = totalVotes.Add(sdk.NewDecFromInt(accNumCoins)) + totalVotes = totalVotes.Add(sdkmath.LegacyNewDecFromInt(accNumCoins)) if vote.VoteType == types.VOTE_TYPE_YES { - yesVotes = yesVotes.Add(sdk.NewDecFromInt(accNumCoins)) + yesVotes = yesVotes.Add(sdkmath.LegacyNewDecFromInt(accNumCoins)) } else if vote.VoteType == types.VOTE_TYPE_NO { - noVotes = noVotes.Add(sdk.NewDecFromInt(accNumCoins)) + noVotes = noVotes.Add(sdkmath.LegacyNewDecFromInt(accNumCoins)) } } possibleVotesInt := k.bankKeeper.GetSupply(ctx, tallyDenom).Amount - return yesVotes, noVotes, totalVotes, sdk.NewDecFromInt(possibleVotesInt) + return yesVotes, noVotes, totalVotes, sdkmath.LegacyNewDecFromInt(possibleVotesInt) } func (k Keeper) attemptEnactProposal(ctx sdk.Context, proposal types.Proposal) types.ProposalOutcome { @@ -261,15 +262,15 @@ func (k Keeper) GetProposalTallyResponse(ctx sdk.Context, proposalID uint64) (*t switch com := committee.(type) { case *types.MemberCommittee: currVotes := k.TallyMemberCommitteeVotes(ctx, proposal.ID) - possibleVotes := sdk.NewDec(int64(len(com.Members))) + possibleVotes := sdkmath.LegacyNewDec(int64(len(com.Members))) proposalTally = types.QueryTallyResponse{ ProposalID: proposal.ID, YesVotes: currVotes, - NoVotes: sdk.ZeroDec(), + NoVotes: sdkmath.LegacyZeroDec(), CurrentVotes: currVotes, PossibleVotes: possibleVotes, VoteThreshold: com.VoteThreshold, - Quorum: sdk.ZeroDec(), + Quorum: sdkmath.LegacyZeroDec(), } case *types.TokenCommittee: yesVotes, noVotes, currVotes, possibleVotes := k.TallyTokenCommitteeVotes(ctx, proposal.ID, com.TallyDenom) diff --git a/x/committee/keeper/proposal_test.go b/x/committee/keeper/proposal_test.go index 7fa10db5aa..fc6534e6b2 100644 --- a/x/committee/keeper/proposal_test.go +++ b/x/committee/keeper/proposal_test.go @@ -1,6 +1,7 @@ package keeper_test import ( + sdkmath "cosmossdk.io/math" "time" "github.com/cosmos/cosmos-sdk/codec" @@ -31,7 +32,7 @@ import ( // return app.GenesisState{bep3types.ModuleName: bep3types.ModuleCdc.MustMarshalJSON(genesis)} // } -// func newPricefeedGenState(assets []string, prices []sdk.Dec) app.GenesisState { +// func newPricefeedGenState(assets []string, prices []sdkmath.LegacyDec) app.GenesisState { // if len(assets) != len(prices) { // panic("assets and prices must be the same length") // } @@ -226,9 +227,9 @@ import ( // // Create local testApp because suite doesn't run the SetupTest function for subtests // tApp := app.NewTestApp() // keeper := tApp.GetCommitteeKeeper() -// ctx := tApp.NewContext(true, tmproto.Header{}) +// ctx := tApp.NewContextLegacy(true, tmproto.Header{}) // tApp.InitializeFromGenesisStates( -// newPricefeedGenState([]string{"bnb"}, []sdk.Dec{testutil.D("15.01")}), +// newPricefeedGenState([]string{"bnb"}, []sdkmath.LegacyDec{testutil.D("15.01")}), // newCDPGenesisState(testCDPParams), // ) // // Cast BaseCommittee to MemberCommittee (if required) to meet Committee interface requirement @@ -269,7 +270,7 @@ func (suite *keeperTestSuite) TestAddVote() { testutil.D("0.4"), time.Hour*24*7, types.TALLY_OPTION_FIRST_PAST_THE_POST, - sdk.Dec{}, + sdkmath.LegacyDec{}, "hard", ) nonMemberAddr := suite.Addresses[4] @@ -340,7 +341,7 @@ func (suite *keeperTestSuite) TestAddVote() { // Create local testApp because suite doesn't run the SetupTest function for subtests tApp := app.NewTestApp() keeper := tApp.GetCommitteeKeeper() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: firstBlockTime}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: firstBlockTime}) tApp.InitializeFromGenesisStates() // setup the committee and proposal @@ -378,7 +379,7 @@ func (suite *keeperTestSuite) TestTallyMemberCommitteeVotes() { testcases := []struct { name string votes []types.Vote - expectedVoteCount sdk.Dec + expectedVoteCount sdkmath.LegacyDec }{ { name: "has 0 votes", @@ -408,7 +409,7 @@ func (suite *keeperTestSuite) TestTallyMemberCommitteeVotes() { // Set up test app tApp := app.NewTestApp() keeper := tApp.GetCommitteeKeeper() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: firstBlockTime}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: firstBlockTime}) // Initialize test app with genesis state tApp.InitializeFromGenesisStates( @@ -452,9 +453,9 @@ func (suite *keeperTestSuite) TestTallyTokenCommitteeVotes() { testcases := []struct { name string votes []types.Vote - expectedYesVoteCount sdk.Dec - expectedNoVoteCount sdk.Dec - expectedTotalVoteCount sdk.Dec + expectedYesVoteCount sdkmath.LegacyDec + expectedNoVoteCount sdkmath.LegacyDec + expectedTotalVoteCount sdkmath.LegacyDec }{ { name: "has 0 votes", @@ -468,9 +469,9 @@ func (suite *keeperTestSuite) TestTallyTokenCommitteeVotes() { votes: []types.Vote{ {ProposalID: defaultProposalID, Voter: genAddrs[4], VoteType: types.VOTE_TYPE_YES}, // Token holder }, - expectedYesVoteCount: sdk.NewDec(genCoinCounts[4]), + expectedYesVoteCount: sdkmath.LegacyNewDec(genCoinCounts[4]), expectedNoVoteCount: testutil.D("0"), - expectedTotalVoteCount: sdk.NewDec(genCoinCounts[4]), + expectedTotalVoteCount: sdkmath.LegacyNewDec(genCoinCounts[4]), }, { name: "does not count non-token holder 'Yes' votes", @@ -478,9 +479,9 @@ func (suite *keeperTestSuite) TestTallyTokenCommitteeVotes() { {ProposalID: defaultProposalID, Voter: genAddrs[4], VoteType: types.VOTE_TYPE_YES}, // Token holder {ProposalID: defaultProposalID, Voter: genAddrs[0], VoteType: types.VOTE_TYPE_YES}, // Non-token holder }, - expectedYesVoteCount: sdk.NewDec(genCoinCounts[4]), + expectedYesVoteCount: sdkmath.LegacyNewDec(genCoinCounts[4]), expectedNoVoteCount: testutil.D("0"), - expectedTotalVoteCount: sdk.NewDec(genCoinCounts[4]), + expectedTotalVoteCount: sdkmath.LegacyNewDec(genCoinCounts[4]), }, { name: "counts multiple 'Yes' votes from token holders", @@ -489,9 +490,9 @@ func (suite *keeperTestSuite) TestTallyTokenCommitteeVotes() { {ProposalID: defaultProposalID, Voter: genAddrs[5], VoteType: types.VOTE_TYPE_YES}, // Token holder {ProposalID: defaultProposalID, Voter: genAddrs[6], VoteType: types.VOTE_TYPE_YES}, // Token holder }, - expectedYesVoteCount: sdk.NewDec(genCoinCounts[4] + genCoinCounts[5] + genCoinCounts[6]), + expectedYesVoteCount: sdkmath.LegacyNewDec(genCoinCounts[4] + genCoinCounts[5] + genCoinCounts[6]), expectedNoVoteCount: testutil.D("0"), - expectedTotalVoteCount: sdk.NewDec(genCoinCounts[4] + genCoinCounts[5] + genCoinCounts[6]), + expectedTotalVoteCount: sdkmath.LegacyNewDec(genCoinCounts[4] + genCoinCounts[5] + genCoinCounts[6]), }, { name: "counts token holder 'No' votes", @@ -499,8 +500,8 @@ func (suite *keeperTestSuite) TestTallyTokenCommitteeVotes() { {ProposalID: defaultProposalID, Voter: genAddrs[4], VoteType: types.VOTE_TYPE_NO}, // Token holder }, expectedYesVoteCount: testutil.D("0"), - expectedNoVoteCount: sdk.NewDec(genCoinCounts[4]), - expectedTotalVoteCount: sdk.NewDec(genCoinCounts[4]), + expectedNoVoteCount: sdkmath.LegacyNewDec(genCoinCounts[4]), + expectedTotalVoteCount: sdkmath.LegacyNewDec(genCoinCounts[4]), }, { name: "does not count non-token holder 'No' votes", @@ -509,8 +510,8 @@ func (suite *keeperTestSuite) TestTallyTokenCommitteeVotes() { {ProposalID: defaultProposalID, Voter: genAddrs[0], VoteType: types.VOTE_TYPE_NO}, // Non-token holder }, expectedYesVoteCount: testutil.D("0"), - expectedNoVoteCount: sdk.NewDec(genCoinCounts[4]), - expectedTotalVoteCount: sdk.NewDec(genCoinCounts[4]), + expectedNoVoteCount: sdkmath.LegacyNewDec(genCoinCounts[4]), + expectedTotalVoteCount: sdkmath.LegacyNewDec(genCoinCounts[4]), }, { name: "counts multiple 'No' votes from token holders", @@ -520,8 +521,8 @@ func (suite *keeperTestSuite) TestTallyTokenCommitteeVotes() { {ProposalID: defaultProposalID, Voter: genAddrs[6], VoteType: types.VOTE_TYPE_NO}, // Token holder }, expectedYesVoteCount: testutil.D("0"), - expectedNoVoteCount: sdk.NewDec(genCoinCounts[4] + genCoinCounts[5] + genCoinCounts[6]), - expectedTotalVoteCount: sdk.NewDec(genCoinCounts[4] + genCoinCounts[5] + genCoinCounts[6]), + expectedNoVoteCount: sdkmath.LegacyNewDec(genCoinCounts[4] + genCoinCounts[5] + genCoinCounts[6]), + expectedTotalVoteCount: sdkmath.LegacyNewDec(genCoinCounts[4] + genCoinCounts[5] + genCoinCounts[6]), }, { name: "includes token holder 'Abstain' votes in total vote count", @@ -530,7 +531,7 @@ func (suite *keeperTestSuite) TestTallyTokenCommitteeVotes() { }, expectedYesVoteCount: testutil.D("0"), expectedNoVoteCount: testutil.D("0"), - expectedTotalVoteCount: sdk.NewDec(genCoinCounts[4]), + expectedTotalVoteCount: sdkmath.LegacyNewDec(genCoinCounts[4]), }, } @@ -547,7 +548,7 @@ func (suite *keeperTestSuite) TestTallyTokenCommitteeVotes() { // Set up test app tApp := app.NewTestApp() keeper := tApp.GetCommitteeKeeper() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: firstBlockTime}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: firstBlockTime}) // Initialize test app with genesis state tApp.InitializeFromGenesisStates( @@ -574,7 +575,7 @@ func (suite *keeperTestSuite) TestTallyTokenCommitteeVotes() { // Check that all non-Yes votes are counted according to their weight suite.Equal(tc.expectedTotalVoteCount, currVotes) // Check that possible votes equals the number of members on the committee - suite.Equal(sdk.NewDecFromInt(totalSupply.AmountOf(tokenCom.GetTallyDenom())), possibleVotes) + suite.Equal(sdkmath.LegacyNewDecFromInt(totalSupply.AmountOf(tokenCom.GetTallyDenom())), possibleVotes) } } @@ -624,7 +625,7 @@ func (suite *keeperTestSuite) TestGetMemberCommitteeProposalResult() { // Create local testApp because suite doesn't run the SetupTest function for subtests tApp := app.NewTestApp() keeper := tApp.GetCommitteeKeeper() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: firstBlockTime}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: firstBlockTime}) tApp.InitializeFromGenesisStates( committeeGenState( @@ -751,7 +752,7 @@ func (suite *keeperTestSuite) TestGetTokenCommitteeProposalResult() { // Create local testApp because suite doesn't run the SetupTest function for subtests tApp := app.NewTestApp() keeper := tApp.GetCommitteeKeeper() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: firstBlockTime}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: firstBlockTime}) tApp.InitializeFromGenesisStates( committeeGenState( @@ -790,7 +791,7 @@ func (suite *keeperTestSuite) TestCloseProposal() { tApp := app.NewTestApp() keeper := tApp.GetCommitteeKeeper() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: firstBlockTime}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: firstBlockTime}) tApp.InitializeFromGenesisStates( committeeGenState( @@ -1171,7 +1172,7 @@ var _ types.PubProposal = &UnregisteredPubProposal{} // // Create local testApp because suite doesn't run the SetupTest function for subtests // tApp := app.NewTestApp() // keeper := tApp.GetCommitteeKeeper() -// ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: firstBlockTime}) +// ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: firstBlockTime}) // // Initialize all committees, proposals, and votes via Genesis // tApp.InitializeFromGenesisStates( diff --git a/x/committee/module.go b/x/committee/module.go index f444e18469..c3b57f5dae 100644 --- a/x/committee/module.go +++ b/x/committee/module.go @@ -135,12 +135,19 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw func (AppModule) ConsensusVersion() uint64 { return ConsensusVersion } // BeginBlock executes all ABCI BeginBlock logic respective to committee module. -func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) { - BeginBlocker(ctx, req, am.keeper) +func (am AppModule) BeginBlock(ctx context.Context) error { + sdkCtx := sdk.UnwrapSDKContext(ctx) + BeginBlocker(sdkCtx, am.keeper) + + return nil } // EndBlock executes all ABCI EndBlock logic respective to committee module. It // returns no validator updates. -func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - return []abci.ValidatorUpdate{} +func (am AppModule) EndBlock(_ sdk.Context) ([]abci.ValidatorUpdate, error) { + return []abci.ValidatorUpdate{}, nil } + +func (AppModule) IsOnePerModuleType() {} + +func (AppModule) IsAppModule() {} diff --git a/x/committee/proposal_handler_test.go b/x/committee/proposal_handler_test.go index 117554c8e7..268c0b127e 100644 --- a/x/committee/proposal_handler_test.go +++ b/x/committee/proposal_handler_test.go @@ -146,7 +146,7 @@ func (suite *ProposalHandlerTestSuite) TestProposalHandler_ChangeCommittee() { suite.app = suite.app.InitializeFromGenesisStates( NewCommitteeGenState(suite.app.AppCodec(), suite.testGenesis), ) - suite.ctx = suite.app.NewContext(true, tmproto.Header{Height: 1, Time: testTime}) + suite.ctx = suite.app.NewContextLegacy(true, tmproto.Header{Height: 1, Time: testTime}) handler := committee.NewProposalHandler(suite.keeper) oldProposals := suite.keeper.GetProposalsByCommittee(suite.ctx, tc.proposal.GetNewCommittee().GetID()) @@ -208,7 +208,7 @@ func (suite *ProposalHandlerTestSuite) TestProposalHandler_DeleteCommittee() { suite.app = suite.app.InitializeFromGenesisStates( NewCommitteeGenState(suite.app.AppCodec(), suite.testGenesis), ) - suite.ctx = suite.app.NewContext(true, tmproto.Header{Height: 1, Time: testTime}) + suite.ctx = suite.app.NewContextLegacy(true, tmproto.Header{Height: 1, Time: testTime}) handler := committee.NewProposalHandler(suite.keeper) oldProposals := suite.keeper.GetProposalsByCommittee(suite.ctx, tc.proposal.CommitteeID) diff --git a/x/committee/spec/02_state.md b/x/committee/spec/02_state.md index e21ce5ac77..7edd77bc89 100644 --- a/x/committee/spec/02_state.md +++ b/x/committee/spec/02_state.md @@ -40,8 +40,8 @@ type Committee interface { GetProposalDuration() time.Duration SetProposalDuration(time.Duration) BaseCommittee - GetVoteThreshold() sdk.Dec - SetVoteThreshold(sdk.Dec) BaseCommittee + GetVoteThreshold() sdkmath.LegacyDec + SetVoteThreshold(sdkmath.LegacyDec) BaseCommittee GetTallyOption() TallyOption Validate() error @@ -53,7 +53,7 @@ type BaseCommittee struct { Description string `json:"description" yaml:"description"` Members []sdk.AccAddress `json:"members" yaml:"members"` Permissions []Permission `json:"permissions" yaml:"permissions"` - VoteThreshold sdk.Dec `json:"vote_threshold" yaml:"vote_threshold"` // Smallest percentage that must vote for a proposal to pass + VoteThreshold sdkmath.LegacyDec `json:"vote_threshold" yaml:"vote_threshold"` // Smallest percentage that must vote for a proposal to pass ProposalDuration time.Duration `json:"proposal_duration" yaml:"proposal_duration"` // The length of time a proposal remains active for. Proposals will close earlier if they get enough votes. TallyOption TallyOption `json:"tally_option" yaml:"tally_option"` } @@ -66,7 +66,7 @@ type MemberCommittee struct { // TokenCommittee supports voting on proposals by token holders type TokenCommittee struct { BaseCommittee `json:"base_committee" yaml:"base_committee"` - Quorum sdk.Dec `json:"quorum" yaml:"quorum"` + Quorum sdkmath.LegacyDec `json:"quorum" yaml:"quorum"` TallyDenom string `json:"tally_denom" yaml:"tally_denom"` } ``` diff --git a/x/committee/testutil/suite.go b/x/committee/testutil/suite.go index abc3144164..6e9cf60c4e 100644 --- a/x/committee/testutil/suite.go +++ b/x/committee/testutil/suite.go @@ -30,7 +30,7 @@ func (suite *Suite) SetupTest() { suite.App = app.NewTestApp() suite.Keeper = suite.App.GetCommitteeKeeper() suite.BankKeeper = suite.App.GetBankKeeper() - suite.Ctx = suite.App.NewContext(true, tmproto.Header{}) + suite.Ctx = suite.App.NewContextLegacy(true, tmproto.Header{}) _, accAddresses := app.GeneratePrivKeyAddressPairs(10) suite.Addresses = accAddresses diff --git a/x/committee/testutil/types.go b/x/committee/testutil/types.go index ec5c409c5b..af0c066d2b 100644 --- a/x/committee/testutil/types.go +++ b/x/committee/testutil/types.go @@ -12,7 +12,7 @@ import ( // Avoid cluttering test cases with long function names func I(in int64) sdkmath.Int { return sdkmath.NewInt(in) } -func D(str string) sdk.Dec { return sdk.MustNewDecFromStr(str) } +func D(str string) sdkmath.LegacyDec { return sdkmath.LegacyMustNewDecFromStr(str) } func C(denom string, amount int64) sdk.Coin { return sdk.NewInt64Coin(denom, amount) } func Cs(coins ...sdk.Coin) sdk.Coins { return sdk.NewCoins(coins...) } diff --git a/x/committee/types/codec.go b/x/committee/types/codec.go index 753bd01111..f0088fdda0 100644 --- a/x/committee/types/codec.go +++ b/x/committee/types/codec.go @@ -1,18 +1,16 @@ package types import ( + upgradetypes "cosmossdk.io/x/upgrade/types" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec/legacy" "github.com/cosmos/cosmos-sdk/codec/types" cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" - authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec" distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" - govcodec "github.com/cosmos/cosmos-sdk/x/gov/codec" govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" proposaltypes "github.com/cosmos/cosmos-sdk/x/params/types/proposal" - upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" communitytypes "github.com/kava-labs/kava/x/community/types" kavadisttypes "github.com/kava-labs/kava/x/kavadist/types" ) @@ -36,18 +34,26 @@ func init() { // Register all Amino interfaces and concrete types on the authz Amino codec so that this can later be // used to properly serialize MsgGrant and MsgExec instances - RegisterLegacyAminoCodec(authzcodec.Amino) + RegisterLegacyAminoCodec(codec.NewLegacyAmino()) // CommitteeChange/Delete proposals along with Permission types are // registered on gov's ModuleCdc - RegisterLegacyAminoCodec(govcodec.Amino) + // TODO(boodyvo): find a current usage pattern + RegisterLegacyAminoCodec(codec.NewLegacyAmino()) // Register external module pubproposal types. Ideally these would be registered within the modules' types pkg init function. // However registration happens here as a work-around. + + // Deprecated: Do not use. As of the Cosmos SDK release v0.47.x, there is no + // longer a need for an explicit CommunityPoolSpendProposal. To spend community + // pool funds, a simple MsgCommunityPoolSpend can be invoked from the x/gov + // module via a v1 governance proposal RegisterProposalTypeCodec(distrtypes.CommunityPoolSpendProposal{}, "cosmos-sdk/CommunityPoolSpendProposal") RegisterProposalTypeCodec(proposaltypes.ParameterChangeProposal{}, "cosmos-sdk/ParameterChangeProposal") RegisterProposalTypeCodec(govv1beta1.TextProposal{}, "cosmos-sdk/TextProposal") + // Deprecated: This legacy proposal is deprecated in favor of Msg-based gov proposals, see MsgSoftwareUpgrade. RegisterProposalTypeCodec(upgradetypes.SoftwareUpgradeProposal{}, "cosmos-sdk/SoftwareUpgradeProposal") + // Deprecated: This legacy proposal is deprecated in favor of Msg-based gov proposals, see MsgCancelUpgrade. RegisterProposalTypeCodec(upgradetypes.CancelSoftwareUpgradeProposal{}, "cosmos-sdk/CancelSoftwareUpgradeProposal") RegisterProposalTypeCodec(communitytypes.CommunityCDPRepayDebtProposal{}, "kava/CommunityCDPRepayDebtProposal") RegisterProposalTypeCodec(communitytypes.CommunityCDPWithdrawCollateralProposal{}, "kava/CommunityCDPWithdrawCollateralProposal") diff --git a/x/committee/types/committee.go b/x/committee/types/committee.go index 358b6b0ac9..7cc5cb08f4 100644 --- a/x/committee/types/committee.go +++ b/x/committee/types/committee.go @@ -1,6 +1,7 @@ package types import ( + sdkmath "cosmossdk.io/math" fmt "fmt" "time" @@ -52,8 +53,8 @@ type Committee interface { GetProposalDuration() time.Duration SetProposalDuration(time.Duration) - GetVoteThreshold() sdk.Dec - SetVoteThreshold(sdk.Dec) + GetVoteThreshold() sdkmath.LegacyDec + SetVoteThreshold(sdkmath.LegacyDec) GetTallyOption() TallyOption Validate() error @@ -151,10 +152,10 @@ func (c BaseCommittee) String() string { } // GetVoteThreshold is a getter for committee VoteThreshold -func (c BaseCommittee) GetVoteThreshold() sdk.Dec { return c.VoteThreshold } +func (c BaseCommittee) GetVoteThreshold() sdkmath.LegacyDec { return c.VoteThreshold } // SetVoteThreshold is a setter for committee VoteThreshold -func (c *BaseCommittee) SetVoteThreshold(voteThreshold sdk.Dec) { +func (c *BaseCommittee) SetVoteThreshold(voteThreshold sdkmath.LegacyDec) { c.VoteThreshold = voteThreshold } @@ -220,7 +221,7 @@ func (c BaseCommittee) Validate() error { } // threshold must be in the range [0, 1] - if c.VoteThreshold.IsNil() || c.VoteThreshold.LTE(sdk.ZeroDec()) || c.VoteThreshold.GT(sdk.NewDec(1)) { + if c.VoteThreshold.IsNil() || c.VoteThreshold.LTE(sdkmath.LegacyZeroDec()) || c.VoteThreshold.GT(sdkmath.LegacyNewDec(1)) { return fmt.Errorf("invalid threshold: %s", c.VoteThreshold) } @@ -233,7 +234,7 @@ func (c BaseCommittee) Validate() error { // NewMemberCommittee instantiates a new instance of MemberCommittee func NewMemberCommittee(id uint64, description string, members []sdk.AccAddress, permissions []Permission, - threshold sdk.Dec, duration time.Duration, tallyOption TallyOption, + threshold sdkmath.LegacyDec, duration time.Duration, tallyOption TallyOption, ) (*MemberCommittee, error) { permissionsAny, err := PackPermissions(permissions) if err != nil { @@ -254,7 +255,7 @@ func NewMemberCommittee(id uint64, description string, members []sdk.AccAddress, // MustNewMemberCommittee instantiates a new instance of MemberCommittee and panics on error func MustNewMemberCommittee(id uint64, description string, members []sdk.AccAddress, permissions []Permission, - threshold sdk.Dec, duration time.Duration, tallyOption TallyOption, + threshold sdkmath.LegacyDec, duration time.Duration, tallyOption TallyOption, ) *MemberCommittee { committee, err := NewMemberCommittee(id, description, members, permissions, threshold, duration, tallyOption) if err != nil { @@ -268,7 +269,7 @@ func (c MemberCommittee) GetType() string { return MemberCommitteeType } // NewTokenCommittee instantiates a new instance of TokenCommittee func NewTokenCommittee(id uint64, description string, members []sdk.AccAddress, permissions []Permission, - threshold sdk.Dec, duration time.Duration, tallyOption TallyOption, quorum sdk.Dec, tallyDenom string, + threshold sdkmath.LegacyDec, duration time.Duration, tallyOption TallyOption, quorum sdkmath.LegacyDec, tallyDenom string, ) (*TokenCommittee, error) { permissionsAny, err := PackPermissions(permissions) if err != nil { @@ -291,7 +292,7 @@ func NewTokenCommittee(id uint64, description string, members []sdk.AccAddress, // MustNewTokenCommittee instantiates a new instance of TokenCommittee and panics on error func MustNewTokenCommittee(id uint64, description string, members []sdk.AccAddress, permissions []Permission, - threshold sdk.Dec, duration time.Duration, tallyOption TallyOption, quorum sdk.Dec, tallyDenom string, + threshold sdkmath.LegacyDec, duration time.Duration, tallyOption TallyOption, quorum sdkmath.LegacyDec, tallyDenom string, ) *TokenCommittee { committee, err := NewTokenCommittee(id, description, members, permissions, threshold, duration, tallyOption, quorum, tallyDenom) if err != nil { @@ -304,7 +305,7 @@ func MustNewTokenCommittee(id uint64, description string, members []sdk.AccAddre func (c TokenCommittee) GetType() string { return TokenCommitteeType } // GetQuorum returns the quorum of the committee -func (c TokenCommittee) GetQuorum() sdk.Dec { return c.Quorum } +func (c TokenCommittee) GetQuorum() sdkmath.LegacyDec { return c.Quorum } // GetTallyDenom returns the tally denom of the committee func (c TokenCommittee) GetTallyDenom() string { return c.TallyDenom } @@ -320,7 +321,7 @@ func (c TokenCommittee) Validate() error { return err } - if c.Quorum.IsNil() || c.Quorum.IsNegative() || c.Quorum.GT(sdk.NewDec(1)) { + if c.Quorum.IsNil() || c.Quorum.IsNegative() || c.Quorum.GT(sdkmath.LegacyNewDec(1)) { return fmt.Errorf("invalid quorum: %s", c.Quorum) } diff --git a/x/committee/types/committee.pb.go b/x/committee/types/committee.pb.go index 12e025362f..00a8ffb549 100644 --- a/x/committee/types/committee.pb.go +++ b/x/committee/types/committee.pb.go @@ -4,6 +4,7 @@ package types import ( + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" _ "github.com/cosmos/cosmos-proto" types "github.com/cosmos/cosmos-sdk/codec/types" @@ -69,7 +70,7 @@ type BaseCommittee struct { Members []github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,3,rep,name=members,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"members,omitempty"` Permissions []*types.Any `protobuf:"bytes,4,rep,name=permissions,proto3" json:"permissions,omitempty"` // Smallest percentage that must vote for a proposal to pass - VoteThreshold github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,5,opt,name=vote_threshold,json=voteThreshold,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"vote_threshold"` + VoteThreshold cosmossdk_io_math.LegacyDec `protobuf:"bytes,5,opt,name=vote_threshold,json=voteThreshold,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"vote_threshold"` // The length of time a proposal remains active for. Proposals will close earlier if they get enough votes. ProposalDuration time.Duration `protobuf:"bytes,6,opt,name=proposal_duration,json=proposalDuration,proto3,stdduration" json:"proposal_duration"` TallyOption TallyOption `protobuf:"varint,7,opt,name=tally_option,json=tallyOption,proto3,enum=kava.committee.v1beta1.TallyOption" json:"tally_option,omitempty"` @@ -147,8 +148,8 @@ var xxx_messageInfo_MemberCommittee proto.InternalMessageInfo // TokenCommittee supports voting on proposals by token holders type TokenCommittee struct { *BaseCommittee `protobuf:"bytes,1,opt,name=base_committee,json=baseCommittee,proto3,embedded=base_committee" json:"base_committee,omitempty"` - Quorum github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=quorum,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"quorum"` - TallyDenom string `protobuf:"bytes,3,opt,name=tally_denom,json=tallyDenom,proto3" json:"tally_denom,omitempty"` + Quorum cosmossdk_io_math.LegacyDec `protobuf:"bytes,2,opt,name=quorum,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"quorum"` + TallyDenom string `protobuf:"bytes,3,opt,name=tally_denom,json=tallyDenom,proto3" json:"tally_denom,omitempty"` } func (m *TokenCommittee) Reset() { *m = TokenCommittee{} } @@ -195,48 +196,49 @@ func init() { } var fileDescriptor_a2549fd9d70ca349 = []byte{ - // 649 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x54, 0xcd, 0x6e, 0xd3, 0x40, - 0x10, 0xb6, 0x93, 0x90, 0xd2, 0x75, 0x1b, 0xd2, 0xa5, 0x54, 0x4e, 0x85, 0x6c, 0xab, 0x40, 0x15, - 0x81, 0x62, 0xab, 0xe1, 0xc6, 0x2d, 0xae, 0x13, 0xd5, 0x52, 0x69, 0x22, 0xc7, 0x3d, 0xc0, 0xc5, - 0xb2, 0xe3, 0x25, 0xb5, 0x1a, 0x67, 0x83, 0x77, 0x53, 0x35, 0x6f, 0xc0, 0x91, 0x63, 0x8f, 0x48, - 0xbc, 0x42, 0x1f, 0xa2, 0xea, 0xa9, 0xe2, 0x84, 0x38, 0x84, 0x92, 0x3e, 0x05, 0x9c, 0x90, 0xff, - 0x1a, 0x17, 0x8a, 0x04, 0x07, 0x4e, 0xde, 0xfd, 0xe6, 0x9b, 0x99, 0xfd, 0x66, 0x3e, 0x19, 0x6c, - 0x1e, 0xda, 0x47, 0xb6, 0xd2, 0xc3, 0xbe, 0xef, 0x51, 0x8a, 0x90, 0x72, 0xb4, 0xe5, 0x20, 0x6a, - 0x6f, 0xcd, 0x11, 0x79, 0x14, 0x60, 0x8a, 0xe1, 0x5a, 0xc8, 0x93, 0xe7, 0x68, 0xc2, 0x5b, 0xaf, - 0xf4, 0x30, 0xf1, 0x31, 0xb1, 0x22, 0x96, 0x12, 0x5f, 0xe2, 0x94, 0xf5, 0xd5, 0x3e, 0xee, 0xe3, - 0x18, 0x0f, 0x4f, 0x09, 0x5a, 0xe9, 0x63, 0xdc, 0x1f, 0x20, 0x25, 0xba, 0x39, 0xe3, 0x37, 0x8a, - 0x3d, 0x9c, 0x24, 0x21, 0xe1, 0xd7, 0x90, 0x3b, 0x0e, 0x6c, 0xea, 0xe1, 0x61, 0x1c, 0xdf, 0xf8, - 0x9e, 0x07, 0xcb, 0xaa, 0x4d, 0xd0, 0x76, 0xfa, 0x0a, 0xb8, 0x06, 0x72, 0x9e, 0xcb, 0xb3, 0x12, - 0x5b, 0x2d, 0xa8, 0xc5, 0xd9, 0x54, 0xcc, 0xe9, 0x9a, 0x91, 0xf3, 0x5c, 0x28, 0x01, 0xce, 0x45, - 0xa4, 0x17, 0x78, 0xa3, 0x30, 0x9d, 0xcf, 0x49, 0x6c, 0x75, 0xd1, 0xc8, 0x42, 0xd0, 0x01, 0x0b, - 0x3e, 0xf2, 0x1d, 0x14, 0x10, 0x3e, 0x2f, 0xe5, 0xab, 0x4b, 0xea, 0xce, 0x8f, 0xa9, 0x58, 0xeb, - 0x7b, 0xf4, 0x60, 0xec, 0x84, 0x32, 0x13, 0x29, 0xc9, 0xa7, 0x46, 0xdc, 0x43, 0x85, 0x4e, 0x46, - 0x88, 0xc8, 0x8d, 0x5e, 0xaf, 0xe1, 0xba, 0x01, 0x22, 0xe4, 0xd3, 0x69, 0xed, 0x7e, 0x22, 0x38, - 0x41, 0xd4, 0x09, 0x45, 0xc4, 0x48, 0x0b, 0xc3, 0x16, 0xe0, 0x46, 0x28, 0xf0, 0x3d, 0x42, 0x3c, - 0x3c, 0x24, 0x7c, 0x41, 0xca, 0x57, 0xb9, 0xfa, 0xaa, 0x1c, 0xab, 0x94, 0x53, 0x95, 0x72, 0x63, - 0x38, 0x51, 0x4b, 0xe7, 0xa7, 0x35, 0xd0, 0xb9, 0x26, 0x1b, 0xd9, 0x44, 0xb8, 0x0f, 0x4a, 0x47, - 0x98, 0x22, 0x8b, 0x1e, 0x04, 0x88, 0x1c, 0xe0, 0x81, 0xcb, 0xdf, 0x09, 0x05, 0xa9, 0xf2, 0xd9, - 0x54, 0x64, 0xbe, 0x4c, 0xc5, 0xcd, 0xbf, 0x78, 0xb6, 0x86, 0x7a, 0xc6, 0x72, 0x58, 0xc5, 0x4c, - 0x8b, 0xc0, 0x0e, 0x58, 0x19, 0x05, 0x78, 0x84, 0x89, 0x3d, 0xb0, 0xd2, 0x49, 0xf3, 0x45, 0x89, - 0xad, 0x72, 0xf5, 0xca, 0x6f, 0x8f, 0xd4, 0x12, 0x82, 0x7a, 0x37, 0x6c, 0x7a, 0xf2, 0x55, 0x64, - 0x8d, 0x72, 0x9a, 0x9d, 0xc6, 0x60, 0x0b, 0x2c, 0x51, 0x7b, 0x30, 0x98, 0x58, 0x38, 0x9e, 0xfb, - 0x82, 0xc4, 0x56, 0x4b, 0xf5, 0x47, 0xf2, 0xed, 0xde, 0x91, 0xcd, 0x90, 0xdb, 0x8e, 0xa8, 0x06, - 0x47, 0xe7, 0x97, 0x17, 0x2b, 0x27, 0x1f, 0x44, 0xe6, 0xfc, 0xb4, 0xb6, 0x78, 0xbd, 0xe9, 0x8d, - 0x63, 0x70, 0xef, 0x65, 0x34, 0xd6, 0xf9, 0xf2, 0x0d, 0x50, 0x72, 0x6c, 0x82, 0xac, 0xeb, 0xc2, - 0x91, 0x11, 0xb8, 0xfa, 0x93, 0x3f, 0xf5, 0xbb, 0xe1, 0x1d, 0xb5, 0x70, 0x31, 0x15, 0x59, 0x63, - 0xd9, 0xc9, 0x82, 0xb7, 0x75, 0xbe, 0x64, 0x41, 0xc9, 0xc4, 0x87, 0x68, 0xf8, 0x5f, 0x3b, 0xc3, - 0x16, 0x28, 0xbe, 0x1d, 0xe3, 0x60, 0xec, 0xc7, 0x6e, 0xfd, 0xe7, 0xe5, 0x26, 0xd9, 0x50, 0x04, - 0xf1, 0x28, 0x2d, 0x17, 0x0d, 0xb1, 0xcf, 0xe7, 0x23, 0xeb, 0x83, 0x08, 0xd2, 0x42, 0xe4, 0x16, - 0x89, 0x4f, 0x03, 0xc0, 0x65, 0x76, 0x01, 0x1f, 0x02, 0xde, 0x6c, 0xec, 0xee, 0xbe, 0xb2, 0xda, - 0x1d, 0x53, 0x6f, 0xef, 0x59, 0xfb, 0x7b, 0xdd, 0x4e, 0x73, 0x5b, 0x6f, 0xe9, 0x4d, 0xad, 0xcc, - 0xc0, 0xc7, 0x40, 0xba, 0x11, 0x6d, 0xe9, 0x46, 0xd7, 0xb4, 0x3a, 0x8d, 0xae, 0x69, 0x99, 0x3b, - 0x4d, 0xab, 0xd3, 0xee, 0x9a, 0x65, 0x16, 0x56, 0xc0, 0x83, 0x1b, 0x2c, 0xad, 0xd9, 0xd0, 0x76, - 0xf5, 0xbd, 0x66, 0x39, 0xb7, 0x5e, 0x78, 0xf7, 0x51, 0x60, 0x54, 0xfd, 0xec, 0x9b, 0xc0, 0x9c, - 0xcd, 0x04, 0xf6, 0x62, 0x26, 0xb0, 0x97, 0x33, 0x81, 0x7d, 0x7f, 0x25, 0x30, 0x17, 0x57, 0x02, - 0xf3, 0xf9, 0x4a, 0x60, 0x5e, 0x3f, 0xcb, 0xa8, 0x0e, 0x67, 0x5a, 0x1b, 0xd8, 0x0e, 0x89, 0x4e, - 0xca, 0x71, 0xe6, 0x6f, 0x15, 0xc9, 0x77, 0x8a, 0x91, 0x4b, 0x9f, 0xff, 0x0c, 0x00, 0x00, 0xff, - 0xff, 0x0d, 0x0b, 0x28, 0x7d, 0xcc, 0x04, 0x00, 0x00, + // 667 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x54, 0xcd, 0x6e, 0xd3, 0x4c, + 0x14, 0xb5, 0x93, 0x7c, 0xe9, 0xd7, 0x71, 0x1b, 0x52, 0x53, 0x2a, 0xa7, 0x20, 0xdb, 0x6a, 0x01, + 0x45, 0xa0, 0xd8, 0x6a, 0xd8, 0xc1, 0x2a, 0xae, 0x13, 0xd5, 0x28, 0x34, 0x91, 0x63, 0x16, 0xb0, + 0xb1, 0xfc, 0x33, 0x24, 0x56, 0xe2, 0x4c, 0xf0, 0x4c, 0xaa, 0xe6, 0x0d, 0x58, 0xb2, 0xec, 0x12, + 0x89, 0x57, 0xe8, 0x43, 0x54, 0x5d, 0x55, 0x48, 0x48, 0x88, 0x45, 0x80, 0x74, 0xcf, 0x03, 0xb0, + 0x42, 0xfe, 0x6b, 0x52, 0x08, 0x12, 0x1b, 0x56, 0x9e, 0x39, 0xf7, 0x9c, 0xb9, 0x73, 0xee, 0xbd, + 0x63, 0x70, 0xbf, 0x6f, 0x1d, 0x59, 0xb2, 0x83, 0x7c, 0xdf, 0x23, 0x04, 0x42, 0xf9, 0x68, 0xcf, + 0x86, 0xc4, 0xda, 0x9b, 0x23, 0xd2, 0x28, 0x40, 0x04, 0xb1, 0x5b, 0x21, 0x4f, 0x9a, 0xa3, 0x09, + 0x6f, 0xbb, 0xe4, 0x20, 0xec, 0x23, 0x6c, 0x46, 0x2c, 0x39, 0xde, 0xc4, 0x92, 0xed, 0xcd, 0x2e, + 0xea, 0xa2, 0x18, 0x0f, 0x57, 0x09, 0x5a, 0xea, 0x22, 0xd4, 0x1d, 0x40, 0x39, 0xda, 0xd9, 0xe3, + 0x57, 0xb2, 0x35, 0x9c, 0x24, 0x21, 0xfe, 0xd7, 0x90, 0x3b, 0x0e, 0x2c, 0xe2, 0xa1, 0x61, 0x1c, + 0xdf, 0xf9, 0x9e, 0x05, 0xeb, 0x8a, 0x85, 0xe1, 0x7e, 0x7a, 0x0b, 0x76, 0x0b, 0x64, 0x3c, 0x97, + 0xa3, 0x45, 0xba, 0x9c, 0x53, 0xf2, 0xb3, 0xa9, 0x90, 0xd1, 0x54, 0x3d, 0xe3, 0xb9, 0xac, 0x08, + 0x18, 0x17, 0x62, 0x27, 0xf0, 0x46, 0xa1, 0x9c, 0xcb, 0x88, 0x74, 0x79, 0x55, 0x5f, 0x84, 0x58, + 0x1b, 0xac, 0xf8, 0xd0, 0xb7, 0x61, 0x80, 0xb9, 0xac, 0x98, 0x2d, 0xaf, 0x29, 0x07, 0x3f, 0xa6, + 0x42, 0xa5, 0xeb, 0x91, 0xde, 0xd8, 0x0e, 0x6d, 0x26, 0x56, 0x92, 0x4f, 0x05, 0xbb, 0x7d, 0x99, + 0x4c, 0x46, 0x10, 0x4b, 0x35, 0xc7, 0xa9, 0xb9, 0x6e, 0x00, 0x31, 0xfe, 0x70, 0x5a, 0xb9, 0x99, + 0x18, 0x4e, 0x10, 0x65, 0x42, 0x20, 0xd6, 0xd3, 0x83, 0xd9, 0x06, 0x60, 0x46, 0x30, 0xf0, 0x3d, + 0x8c, 0x3d, 0x34, 0xc4, 0x5c, 0x4e, 0xcc, 0x96, 0x99, 0xea, 0xa6, 0x14, 0xbb, 0x94, 0x52, 0x97, + 0x52, 0x6d, 0x38, 0x51, 0x0a, 0xe7, 0xa7, 0x15, 0xd0, 0xbe, 0x22, 0xeb, 0x8b, 0x42, 0xf6, 0x29, + 0x28, 0x1c, 0x21, 0x02, 0x4d, 0xd2, 0x0b, 0x20, 0xee, 0xa1, 0x81, 0xcb, 0xfd, 0x17, 0x1a, 0x52, + 0x76, 0xcf, 0xa6, 0x02, 0xf5, 0x79, 0x2a, 0xdc, 0x8e, 0x6f, 0x81, 0xdd, 0xbe, 0xe4, 0x21, 0xd9, + 0xb7, 0x48, 0x4f, 0x6a, 0xc2, 0xae, 0xe5, 0x4c, 0x54, 0xe8, 0xe8, 0xeb, 0xa1, 0xd4, 0x48, 0x95, + 0x6c, 0x1b, 0x6c, 0x8c, 0x02, 0x34, 0x42, 0xd8, 0x1a, 0x98, 0x69, 0x79, 0xb9, 0xbc, 0x48, 0x97, + 0x99, 0x6a, 0xe9, 0xb7, 0x9b, 0xa9, 0x09, 0x41, 0xf9, 0x3f, 0xcc, 0x74, 0xf2, 0x45, 0xa0, 0xf5, + 0x62, 0xaa, 0x4e, 0x63, 0x6c, 0x03, 0xac, 0x11, 0x6b, 0x30, 0x98, 0x98, 0x28, 0x2e, 0xf6, 0x8a, + 0x48, 0x97, 0x0b, 0xd5, 0x5d, 0x69, 0xf9, 0xc0, 0x48, 0x46, 0xc8, 0x6d, 0x45, 0x54, 0x9d, 0x21, + 0xf3, 0xcd, 0xe3, 0x8d, 0x93, 0x77, 0x02, 0x75, 0x7e, 0x5a, 0x59, 0xbd, 0x6a, 0xef, 0xce, 0x31, + 0xb8, 0xf1, 0x2c, 0xaa, 0xe5, 0xbc, 0xe3, 0x3a, 0x28, 0xd8, 0x16, 0x86, 0xe6, 0xd5, 0xc1, 0x51, + 0xf7, 0x99, 0xea, 0xbd, 0x3f, 0xe5, 0xbb, 0x36, 0x30, 0x4a, 0xee, 0x62, 0x2a, 0xd0, 0xfa, 0xba, + 0xbd, 0x08, 0x2e, 0xcb, 0xfc, 0x91, 0x06, 0x05, 0x03, 0xf5, 0xe1, 0xf0, 0x9f, 0x66, 0x66, 0x9f, + 0x80, 0xfc, 0xeb, 0x31, 0x0a, 0xc6, 0x7e, 0x3c, 0xa2, 0x7f, 0xd7, 0xd1, 0x44, 0xc2, 0x0a, 0x20, + 0xae, 0x9f, 0xe9, 0xc2, 0x21, 0xf2, 0xb9, 0x6c, 0x34, 0xe4, 0x20, 0x82, 0xd4, 0x10, 0x59, 0xe2, + 0xeb, 0x41, 0x00, 0x98, 0x85, 0x06, 0xb0, 0x77, 0x00, 0x67, 0xd4, 0x9a, 0xcd, 0x17, 0x66, 0xab, + 0x6d, 0x68, 0xad, 0x43, 0xf3, 0xf9, 0x61, 0xa7, 0x5d, 0xdf, 0xd7, 0x1a, 0x5a, 0x5d, 0x2d, 0x52, + 0xec, 0x5d, 0x20, 0x5e, 0x8b, 0x36, 0x34, 0xbd, 0x63, 0x98, 0xed, 0x5a, 0xc7, 0x30, 0x8d, 0x83, + 0xba, 0xd9, 0x6e, 0x75, 0x8c, 0x22, 0xcd, 0x96, 0xc0, 0xad, 0x6b, 0x2c, 0xb5, 0x5e, 0x53, 0x9b, + 0xda, 0x61, 0xbd, 0x98, 0xd9, 0xce, 0xbd, 0x79, 0xcf, 0x53, 0x8a, 0x76, 0xf6, 0x8d, 0xa7, 0xce, + 0x66, 0x3c, 0x7d, 0x31, 0xe3, 0xe9, 0xaf, 0x33, 0x9e, 0x7e, 0x7b, 0xc9, 0x53, 0x17, 0x97, 0x3c, + 0xf5, 0xe9, 0x92, 0xa7, 0x5e, 0x3e, 0x5c, 0x78, 0x73, 0x61, 0x21, 0x2b, 0x03, 0xcb, 0xc6, 0xd1, + 0x4a, 0x3e, 0x5e, 0xf8, 0x2f, 0x45, 0x8f, 0xcf, 0xce, 0x47, 0xa3, 0xf9, 0xe8, 0x67, 0x00, 0x00, + 0x00, 0xff, 0xff, 0xd7, 0x64, 0xb4, 0xa7, 0xb6, 0x04, 0x00, 0x00, } func (m *BaseCommittee) Marshal() (dAtA []byte, err error) { diff --git a/x/committee/types/committee_test.go b/x/committee/types/committee_test.go index f467cac5e1..0ef4cfa512 100644 --- a/x/committee/types/committee_test.go +++ b/x/committee/types/committee_test.go @@ -1,6 +1,7 @@ package types_test import ( + sdkmath "cosmossdk.io/math" "fmt" "testing" "time" @@ -132,7 +133,7 @@ func TestBaseCommittee(t *testing.T) { "This base committee is for testing.", addresses[:3], []types.Permission{&types.GodPermission{}}, - sdk.Dec{}, + sdkmath.LegacyDec{}, time.Hour*24*7, types.TALLY_OPTION_FIRST_PAST_THE_POST, ) @@ -289,7 +290,7 @@ func TestTokenCommittee(t *testing.T) { testutil.D("0.667"), time.Hour*24*7, types.TALLY_OPTION_FIRST_PAST_THE_POST, - sdk.Dec{}, + sdkmath.LegacyDec{}, "hard", ) }, diff --git a/x/committee/types/expected_keepers.go b/x/committee/types/expected_keepers.go index d4352e6a0f..34d6d8793b 100644 --- a/x/committee/types/expected_keepers.go +++ b/x/committee/types/expected_keepers.go @@ -1,8 +1,8 @@ package types import ( + "context" sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" ) @@ -12,11 +12,11 @@ type ParamKeeper interface { // AccountKeeper defines the expected account keeper type AccountKeeper interface { - GetAccount(sdk.Context, sdk.AccAddress) authtypes.AccountI + GetAccount(context.Context, sdk.AccAddress) sdk.AccountI } // BankKeeper defines the expected bank keeper interface type BankKeeper interface { - GetSupply(ctx sdk.Context, denom string) sdk.Coin - GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin + GetSupply(ctx context.Context, denom string) sdk.Coin + GetBalance(ctx context.Context, addr sdk.AccAddress, denom string) sdk.Coin } diff --git a/x/committee/types/genesis_test.go b/x/committee/types/genesis_test.go index 98f6e8e511..d32fb6214a 100644 --- a/x/committee/types/genesis_test.go +++ b/x/committee/types/genesis_test.go @@ -1,6 +1,7 @@ package types_test import ( + sdkmath "cosmossdk.io/math" "testing" "time" @@ -53,7 +54,7 @@ func TestGenesisState_Validate(t *testing.T) { testutil.D("0.8"), time.Hour*24*21, types.TALLY_OPTION_DEADLINE, - sdk.MustNewDecFromStr("0.4"), + sdkmath.LegacyMustNewDecFromStr("0.4"), "hard", ), }, diff --git a/x/committee/types/param_permissions_test.go b/x/committee/types/param_permissions_test.go index d425171474..a9343872e1 100644 --- a/x/committee/types/param_permissions_test.go +++ b/x/committee/types/param_permissions_test.go @@ -31,7 +31,7 @@ type ParamsChangeTestSuite struct { func (suite *ParamsChangeTestSuite) SetupTest() { tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) suite.ctx = ctx suite.pk = tApp.GetParamsKeeper() @@ -47,10 +47,10 @@ func (suite *ParamsChangeTestSuite) SetupTest() { { Denom: "bnb", Type: "bnb-a", - LiquidationRatio: sdk.MustNewDecFromStr("2.0"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("2.0"), DebtLimit: sdk.NewCoin("usdx", sdkmath.NewInt(100)), - StabilityFee: sdk.MustNewDecFromStr("1.02"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.02"), + LiquidationPenalty: sdkmath.LegacyMustNewDecFromStr("0.05"), AuctionSize: sdkmath.NewInt(100), ConversionFactor: sdkmath.NewInt(6), SpotMarketID: "bnb:usd", @@ -60,16 +60,16 @@ func (suite *ParamsChangeTestSuite) SetupTest() { { Denom: "btc", Type: "btc-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("1.5"), DebtLimit: sdk.NewCoin("usdx", sdkmath.NewInt(100)), - StabilityFee: sdk.MustNewDecFromStr("1.01"), - LiquidationPenalty: sdk.MustNewDecFromStr("0.10"), + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.01"), + LiquidationPenalty: sdkmath.LegacyMustNewDecFromStr("0.10"), AuctionSize: sdkmath.NewInt(1000), ConversionFactor: sdkmath.NewInt(8), SpotMarketID: "btc:usd", LiquidationMarketID: "btc:usd", CheckCollateralizationIndexCount: sdkmath.NewInt(1), - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.12"), + KeeperRewardPercentage: sdkmath.LegacyMustNewDecFromStr("0.12"), }, } suite.cdpCollateralRequirements = []types.SubparamRequirement{ diff --git a/x/committee/types/permissions.go b/x/committee/types/permissions.go index 3e4d6e772d..b71ce617c6 100644 --- a/x/committee/types/permissions.go +++ b/x/committee/types/permissions.go @@ -6,11 +6,11 @@ import ( "reflect" "strings" + upgradetypes "cosmossdk.io/x/upgrade/types" "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" paramsproposal "github.com/cosmos/cosmos-sdk/x/params/types/proposal" - upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" proto "github.com/cosmos/gogoproto/proto" communitytypes "github.com/kava-labs/kava/x/community/types" ) diff --git a/x/committee/types/permissions_test.go b/x/committee/types/permissions_test.go index 2fe4c8a88f..6eb49081aa 100644 --- a/x/committee/types/permissions_test.go +++ b/x/committee/types/permissions_test.go @@ -1,6 +1,7 @@ package types_test import ( + sdkmath "cosmossdk.io/math" "testing" "github.com/stretchr/testify/require" @@ -91,7 +92,7 @@ func TestCommunityPoolLendWithdrawPermission_Allows(t *testing.T) { proposal: communitytypes.NewCommunityPoolLendWithdrawProposal( "withdraw lend position", "this fake proposal withdraws a lend position for the community pool", - sdk.NewCoins(sdk.NewCoin("ukava", sdk.NewInt(1e10))), + sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(1e10))), ), allowed: true, }, diff --git a/x/committee/types/query.pb.go b/x/committee/types/query.pb.go index 335f8d8fa7..de257088ae 100644 --- a/x/committee/types/query.pb.go +++ b/x/committee/types/query.pb.go @@ -5,10 +5,10 @@ package types import ( context "context" + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" _ "github.com/cosmos/cosmos-proto" types "github.com/cosmos/cosmos-sdk/codec/types" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" query "github.com/cosmos/cosmos-sdk/types/query" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" @@ -617,13 +617,13 @@ var xxx_messageInfo_QueryTallyRequest proto.InternalMessageInfo // QueryTallyResponse defines the response type for querying x/committee tally. type QueryTallyResponse struct { - ProposalID uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` - YesVotes github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=yes_votes,json=yesVotes,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"yes_votes"` - NoVotes github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=no_votes,json=noVotes,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"no_votes"` - CurrentVotes github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,4,opt,name=current_votes,json=currentVotes,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"current_votes"` - PossibleVotes github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,5,opt,name=possible_votes,json=possibleVotes,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"possible_votes"` - VoteThreshold github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,6,opt,name=vote_threshold,json=voteThreshold,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"vote_threshold"` - Quorum github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,7,opt,name=quorum,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"quorum"` + ProposalID uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` + YesVotes cosmossdk_io_math.LegacyDec `protobuf:"bytes,2,opt,name=yes_votes,json=yesVotes,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"yes_votes"` + NoVotes cosmossdk_io_math.LegacyDec `protobuf:"bytes,3,opt,name=no_votes,json=noVotes,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"no_votes"` + CurrentVotes cosmossdk_io_math.LegacyDec `protobuf:"bytes,4,opt,name=current_votes,json=currentVotes,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"current_votes"` + PossibleVotes cosmossdk_io_math.LegacyDec `protobuf:"bytes,5,opt,name=possible_votes,json=possibleVotes,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"possible_votes"` + VoteThreshold cosmossdk_io_math.LegacyDec `protobuf:"bytes,6,opt,name=vote_threshold,json=voteThreshold,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"vote_threshold"` + Quorum cosmossdk_io_math.LegacyDec `protobuf:"bytes,7,opt,name=quorum,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"quorum"` } func (m *QueryTallyResponse) Reset() { *m = QueryTallyResponse{} } @@ -763,82 +763,82 @@ func init() { var fileDescriptor_b81d271efeb6eee5 = []byte{ // 1211 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x96, 0xc1, 0x6f, 0xe3, 0xc4, - 0x17, 0xc7, 0xeb, 0x34, 0xed, 0x26, 0x2f, 0xdb, 0xfe, 0xfa, 0x1b, 0x95, 0x92, 0x86, 0x55, 0xd2, - 0x35, 0xab, 0xa5, 0x5b, 0x88, 0x4d, 0x53, 0x50, 0x05, 0xa2, 0x82, 0x4d, 0xdb, 0x45, 0x11, 0x12, - 0xea, 0x9a, 0xc2, 0x81, 0x95, 0x88, 0x26, 0xf5, 0x6c, 0x6a, 0x35, 0xb1, 0x5d, 0x8f, 0xd3, 0x36, - 0x2a, 0xbd, 0x70, 0x47, 0x5a, 0x09, 0x81, 0xb4, 0x07, 0x24, 0x84, 0x40, 0x42, 0xe2, 0x86, 0xf6, - 0x8f, 0xa8, 0xf6, 0xb4, 0x12, 0x17, 0xc4, 0x21, 0x40, 0xca, 0x1f, 0x82, 0x3c, 0x33, 0x9e, 0xb8, - 0x49, 0xdb, 0xb8, 0x39, 0x25, 0xb6, 0xdf, 0xfb, 0xce, 0x67, 0xde, 0xbc, 0x79, 0xef, 0x81, 0xba, - 0x87, 0x0f, 0xb0, 0xbe, 0xe3, 0x34, 0x9b, 0x96, 0xef, 0x13, 0xa2, 0x1f, 0x2c, 0xd7, 0x88, 0x8f, - 0x97, 0xf5, 0xfd, 0x16, 0xf1, 0xda, 0x9a, 0xeb, 0x39, 0xbe, 0x83, 0xe6, 0x02, 0x1b, 0x4d, 0xda, - 0x68, 0xc2, 0x26, 0xb7, 0xb4, 0xe3, 0xd0, 0xa6, 0x43, 0xf5, 0x1a, 0xa6, 0x84, 0x3b, 0x48, 0x77, - 0x17, 0xd7, 0x2d, 0x1b, 0xfb, 0x96, 0x63, 0x73, 0x8d, 0xdc, 0x3c, 0xb7, 0xad, 0xb2, 0x27, 0x9d, - 0x3f, 0x88, 0x4f, 0xb3, 0x75, 0xa7, 0xee, 0xf0, 0xf7, 0xc1, 0x3f, 0xf1, 0xf6, 0x56, 0xdd, 0x71, - 0xea, 0x0d, 0xa2, 0x63, 0xd7, 0xd2, 0xb1, 0x6d, 0x3b, 0x3e, 0x53, 0x0b, 0x7d, 0xe6, 0xc5, 0x57, - 0xf6, 0x54, 0x6b, 0x3d, 0xd6, 0xb1, 0x2d, 0x68, 0x73, 0x85, 0xfe, 0x4f, 0xbe, 0xd5, 0x24, 0xd4, - 0xc7, 0x4d, 0x57, 0x18, 0xdc, 0xb9, 0x64, 0xcb, 0x75, 0x62, 0x13, 0x6a, 0x89, 0x15, 0xd4, 0x2c, - 0xcc, 0x3d, 0x0c, 0xb6, 0xb4, 0x1e, 0xda, 0x51, 0x83, 0xec, 0xb7, 0x08, 0xf5, 0xd5, 0x2f, 0xe0, - 0xe5, 0x81, 0x2f, 0xd4, 0x75, 0x6c, 0x4a, 0xd0, 0x3a, 0x80, 0xd4, 0xa5, 0x59, 0x65, 0x61, 0x7c, - 0x31, 0x53, 0x9a, 0xd5, 0x38, 0x90, 0x16, 0x02, 0x69, 0xf7, 0xed, 0x76, 0x79, 0xea, 0xf9, 0xb3, - 0x62, 0x5a, 0x2a, 0x18, 0x11, 0x37, 0xf5, 0x5d, 0x78, 0xe9, 0xbc, 0xbe, 0x58, 0x18, 0xdd, 0x86, - 0x9b, 0xd2, 0xac, 0x6a, 0x99, 0x59, 0x65, 0x41, 0x59, 0x4c, 0x1a, 0x19, 0xf9, 0xae, 0x62, 0xaa, - 0x8f, 0xfa, 0xa9, 0x25, 0xda, 0x7d, 0x48, 0x4b, 0x43, 0xe6, 0x19, 0x93, 0xac, 0xe7, 0x25, 0xc1, - 0xb6, 0x3c, 0xc7, 0x75, 0x28, 0x6e, 0xd0, 0x6b, 0x80, 0xed, 0x09, 0xb0, 0x88, 0xaf, 0x00, 0x7b, - 0x08, 0x69, 0x37, 0x7c, 0x29, 0x42, 0x56, 0xd4, 0x2e, 0xce, 0x38, 0xed, 0x9c, 0x44, 0xa8, 0x50, - 0x4e, 0x9e, 0x76, 0x0a, 0x63, 0x46, 0x4f, 0x45, 0x5d, 0x85, 0xd9, 0x3e, 0x4b, 0xce, 0x59, 0x80, - 0x4c, 0x68, 0xd4, 0xc3, 0x84, 0xf0, 0x55, 0xc5, 0x54, 0xbf, 0x4e, 0xf4, 0x6d, 0x51, 0x52, 0x3e, - 0x86, 0x9b, 0x6e, 0xab, 0x56, 0x0d, 0x6d, 0xaf, 0x8c, 0x60, 0xb1, 0xdb, 0x29, 0x64, 0xb6, 0x5a, - 0xb5, 0x50, 0xe4, 0xf9, 0xb3, 0x62, 0x4e, 0x64, 0x7c, 0xdd, 0x39, 0x90, 0x9b, 0x59, 0x77, 0x6c, - 0x9f, 0xd8, 0xbe, 0x91, 0x71, 0x7b, 0xa6, 0x68, 0x0e, 0x12, 0x96, 0x99, 0x4d, 0x04, 0x64, 0xe5, - 0xc9, 0x6e, 0xa7, 0x90, 0xa8, 0x6c, 0x18, 0x09, 0xcb, 0x44, 0xa5, 0xbe, 0x10, 0x8f, 0x33, 0x8b, - 0xff, 0x05, 0x2b, 0xc9, 0xb3, 0xaa, 0x6c, 0x9c, 0x8b, 0x39, 0xfa, 0x00, 0x52, 0x26, 0xc1, 0x66, - 0xc3, 0xb2, 0x49, 0x36, 0xc9, 0x78, 0x73, 0x03, 0xbc, 0xdb, 0xe1, 0xe5, 0x28, 0xa7, 0x82, 0x28, - 0x3e, 0xf9, 0xab, 0xa0, 0x18, 0xd2, 0x4b, 0xbd, 0x05, 0x39, 0x16, 0x8e, 0x8f, 0xc9, 0x91, 0x1f, - 0x22, 0x56, 0x36, 0xc2, 0x8b, 0xf0, 0x08, 0x5e, 0xb9, 0xf0, 0xab, 0x08, 0xd9, 0x7b, 0x30, 0x63, - 0x93, 0x23, 0xbf, 0x3a, 0x10, 0xf2, 0x32, 0xea, 0x76, 0x0a, 0xd3, 0x7d, 0x5e, 0xd3, 0x76, 0xf4, - 0xd9, 0x54, 0xbf, 0x84, 0xff, 0x33, 0xf1, 0xcf, 0x1c, 0x5f, 0x5e, 0xbd, 0xa1, 0x07, 0x88, 0x1e, - 0x00, 0xf4, 0x4a, 0x0f, 0x0b, 0x63, 0xa6, 0x74, 0x57, 0x13, 0xc1, 0x0f, 0xea, 0x94, 0xc6, 0x0b, - 0x5b, 0x78, 0x06, 0x5b, 0xb8, 0x1e, 0x5e, 0x2f, 0x23, 0xe2, 0xa9, 0xfe, 0xa4, 0x00, 0x8a, 0x2e, - 0x2f, 0xb6, 0xb4, 0x09, 0x13, 0x07, 0xc1, 0x0b, 0x91, 0xa7, 0xf7, 0xae, 0xcc, 0xd3, 0xc0, 0xb5, - 0x2f, 0x47, 0xb9, 0x37, 0xfa, 0xf0, 0x02, 0xca, 0xd7, 0x86, 0x52, 0x72, 0xa5, 0x73, 0x98, 0x15, - 0x98, 0x89, 0x2c, 0x15, 0x33, 0x46, 0xb3, 0x7c, 0x13, 0x1e, 0x5b, 0x38, 0xcd, 0x99, 0x3c, 0xf5, - 0xa9, 0x12, 0x09, 0xb8, 0xdc, 0xb0, 0x7e, 0x81, 0x58, 0x79, 0xba, 0xdb, 0x29, 0x40, 0xe4, 0xe8, - 0x86, 0x8a, 0xa3, 0x35, 0x48, 0x07, 0x7f, 0xaa, 0x7e, 0xdb, 0x25, 0x2c, 0x75, 0xa7, 0x4b, 0x0b, - 0x97, 0xc5, 0x2e, 0x58, 0x7f, 0xbb, 0xed, 0x12, 0x23, 0x75, 0x20, 0xfe, 0xa9, 0x6f, 0x09, 0xb4, - 0x6d, 0xdc, 0x68, 0xb4, 0x63, 0x5f, 0xe6, 0x5f, 0x92, 0xe2, 0x0c, 0x85, 0xdb, 0xa8, 0x5b, 0xfa, - 0x08, 0xd2, 0x6d, 0x42, 0xab, 0xfc, 0xe0, 0xd9, 0xb6, 0xca, 0x5a, 0x70, 0x9a, 0x7f, 0x76, 0x0a, - 0x77, 0xeb, 0x96, 0xbf, 0xdb, 0xaa, 0x05, 0xbb, 0x10, 0x3d, 0x4d, 0xfc, 0x14, 0xa9, 0xb9, 0xa7, - 0x07, 0xbb, 0xa5, 0xda, 0x06, 0xd9, 0x31, 0x52, 0x6d, 0x42, 0x59, 0x26, 0xa1, 0x0a, 0xa4, 0x6c, - 0x47, 0x68, 0x8d, 0x8f, 0xa4, 0x75, 0xc3, 0x76, 0xb8, 0xd4, 0x27, 0x30, 0xb5, 0xd3, 0xf2, 0x3c, - 0x62, 0xfb, 0x42, 0x2f, 0x39, 0x92, 0xde, 0x4d, 0x21, 0xc2, 0x45, 0x3f, 0x85, 0x69, 0xd7, 0xa1, - 0xd4, 0xaa, 0x35, 0x88, 0x50, 0x9d, 0x18, 0x49, 0x75, 0x2a, 0x54, 0x91, 0xb2, 0x3c, 0x01, 0x76, - 0x3d, 0x42, 0x77, 0x9d, 0x86, 0x99, 0x9d, 0x1c, 0x4d, 0x96, 0xe5, 0x44, 0x28, 0x82, 0x1e, 0xc0, - 0xe4, 0x7e, 0xcb, 0xf1, 0x5a, 0xcd, 0xec, 0x8d, 0x91, 0xe4, 0x84, 0xb7, 0xba, 0x29, 0xca, 0xbe, - 0x81, 0x0f, 0xb7, 0xb0, 0x87, 0x9b, 0xb2, 0xe0, 0xe4, 0x20, 0x45, 0x5b, 0x35, 0xea, 0xe2, 0x1d, - 0xde, 0x34, 0xd3, 0x86, 0x7c, 0x46, 0x33, 0x30, 0xbe, 0x47, 0xda, 0x22, 0xd1, 0x83, 0xbf, 0xea, - 0x8a, 0x68, 0x72, 0x11, 0x19, 0x91, 0x74, 0xf3, 0x90, 0xf2, 0xf0, 0x61, 0xd5, 0xc4, 0x3e, 0x16, - 0x3a, 0x37, 0x3c, 0x7c, 0xb8, 0x81, 0x7d, 0x5c, 0xfa, 0x2d, 0x03, 0x13, 0xcc, 0x0b, 0x3d, 0x55, - 0x00, 0x7a, 0x43, 0x05, 0xd2, 0xae, 0xac, 0x2e, 0x03, 0x73, 0x49, 0x4e, 0x8f, 0x6d, 0xcf, 0xa1, - 0xd4, 0xa5, 0xaf, 0x7e, 0xff, 0xf7, 0x9b, 0xc4, 0x1d, 0xa4, 0xea, 0x97, 0x4c, 0x44, 0xbd, 0xa1, - 0x04, 0xfd, 0xac, 0x40, 0x6f, 0x28, 0x40, 0xc5, 0x78, 0x4b, 0x85, 0x64, 0x5a, 0x5c, 0x73, 0x01, - 0xf6, 0x0e, 0x03, 0x5b, 0x41, 0xcb, 0xc3, 0xc1, 0xf4, 0xe3, 0x68, 0x5b, 0x3c, 0x41, 0xdf, 0x2a, - 0x90, 0x96, 0x33, 0x06, 0x8a, 0x37, 0x48, 0xd0, 0x78, 0x9c, 0x03, 0xa3, 0x8b, 0x7a, 0x8f, 0x71, - 0xbe, 0x8a, 0x6e, 0x5f, 0xc6, 0x29, 0x47, 0x12, 0xf4, 0x83, 0x02, 0x29, 0xd9, 0xe4, 0xdf, 0x88, - 0x39, 0xdf, 0x70, 0xaa, 0xeb, 0x4d, 0x43, 0xea, 0x2a, 0x83, 0x5a, 0x46, 0xfa, 0x50, 0x28, 0xfd, - 0x38, 0x52, 0x08, 0x4f, 0xd0, 0xaf, 0x0a, 0xf4, 0x35, 0x65, 0x54, 0xba, 0x72, 0xe9, 0x0b, 0xa7, - 0x82, 0xdc, 0xca, 0xb5, 0x7c, 0x04, 0xf4, 0x9b, 0x0c, 0x7a, 0x09, 0x2d, 0x5e, 0x06, 0x1d, 0x4c, - 0x07, 0xc5, 0x10, 0xb7, 0x68, 0x99, 0xe8, 0x7b, 0x05, 0x26, 0x78, 0x6d, 0x19, 0xde, 0x85, 0xe5, - 0x01, 0x2f, 0xc5, 0x31, 0x15, 0x48, 0x6b, 0x0c, 0x69, 0x15, 0xbd, 0x7d, 0xcd, 0x38, 0xea, 0xbc, - 0xc7, 0xff, 0xa8, 0x40, 0x32, 0x10, 0x44, 0x8b, 0x31, 0x86, 0x04, 0x4e, 0x17, 0x7f, 0x9c, 0x50, - 0x37, 0x19, 0xdc, 0xfb, 0x68, 0x6d, 0x24, 0x38, 0xfd, 0x98, 0xb5, 0xe5, 0x13, 0x16, 0x44, 0xd6, - 0x1d, 0x87, 0x04, 0x31, 0xda, 0x78, 0x87, 0x04, 0xf1, 0x5c, 0xb3, 0x1d, 0x3d, 0x88, 0x3e, 0xa3, - 0xfa, 0x4e, 0x81, 0xb4, 0x2c, 0xa6, 0x43, 0x6e, 0x73, 0x7f, 0xed, 0x1e, 0x72, 0x9b, 0x07, 0x6a, - 0xf4, 0xf0, 0x72, 0xe8, 0xe1, 0xc3, 0xa2, 0xcb, 0x7c, 0xca, 0x95, 0xd3, 0x7f, 0xf2, 0x63, 0xa7, - 0xdd, 0xbc, 0xf2, 0xa2, 0x9b, 0x57, 0xfe, 0xee, 0xe6, 0x95, 0x27, 0x67, 0xf9, 0xb1, 0x17, 0x67, - 0xf9, 0xb1, 0x3f, 0xce, 0xf2, 0x63, 0x9f, 0xbf, 0x1e, 0x69, 0x3f, 0x81, 0x56, 0xb1, 0x81, 0x6b, - 0x94, 0xab, 0x1e, 0x45, 0x74, 0x59, 0x1f, 0xaa, 0x4d, 0xb2, 0x59, 0x7c, 0xe5, 0xbf, 0x00, 0x00, - 0x00, 0xff, 0xff, 0xb4, 0xd1, 0x58, 0x0c, 0x8a, 0x0f, 0x00, 0x00, + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x96, 0xcf, 0x6f, 0xe3, 0x44, + 0x14, 0xc7, 0xeb, 0xf4, 0x57, 0x32, 0x69, 0x4b, 0x19, 0x95, 0x92, 0x66, 0x57, 0x49, 0xd7, 0xbb, + 0x82, 0x6e, 0x21, 0x36, 0x4d, 0x41, 0x15, 0x3f, 0x0a, 0xbb, 0x69, 0x0b, 0x04, 0x21, 0xd4, 0xb5, + 0x2a, 0x0e, 0xac, 0x44, 0x34, 0x89, 0x67, 0x53, 0xab, 0x89, 0xc7, 0xf5, 0x38, 0x6d, 0xa3, 0xd2, + 0x0b, 0x77, 0xa4, 0x95, 0x10, 0x48, 0x7b, 0x40, 0x42, 0x08, 0x4e, 0xdc, 0xd0, 0xfe, 0x11, 0xd5, + 0x9e, 0x56, 0xe2, 0x82, 0x38, 0x04, 0x48, 0x11, 0x7f, 0x07, 0xf2, 0xcc, 0x78, 0xe2, 0x26, 0x6d, + 0xed, 0xf4, 0xe6, 0x1f, 0xef, 0x7d, 0xe7, 0x33, 0xef, 0xcd, 0xbc, 0xf7, 0x80, 0xba, 0x87, 0x0e, + 0x90, 0x5e, 0x23, 0xcd, 0xa6, 0xe5, 0x79, 0x18, 0xeb, 0x07, 0x2b, 0x55, 0xec, 0xa1, 0x15, 0x7d, + 0xbf, 0x85, 0xdd, 0xb6, 0xe6, 0xb8, 0xc4, 0x23, 0x70, 0xde, 0xb7, 0xd1, 0xa4, 0x8d, 0x26, 0x6c, + 0xb2, 0xcb, 0x35, 0x42, 0x9b, 0x84, 0xea, 0x55, 0x44, 0x31, 0x77, 0x90, 0xee, 0x0e, 0xaa, 0x5b, + 0x36, 0xf2, 0x2c, 0x62, 0x73, 0x8d, 0xec, 0x02, 0xb7, 0xad, 0xb0, 0x37, 0x9d, 0xbf, 0x88, 0x5f, + 0x73, 0x75, 0x52, 0x27, 0xfc, 0xbb, 0xff, 0x24, 0xbe, 0xde, 0xac, 0x13, 0x52, 0x6f, 0x60, 0x1d, + 0x39, 0x96, 0x8e, 0x6c, 0x9b, 0x78, 0x4c, 0x2d, 0xf0, 0x59, 0x10, 0x7f, 0xd9, 0x5b, 0xb5, 0xf5, + 0x48, 0x47, 0xb6, 0xa0, 0xcd, 0xe6, 0xfb, 0x7f, 0x79, 0x56, 0x13, 0x53, 0x0f, 0x35, 0x1d, 0x61, + 0x70, 0xe7, 0x92, 0x2d, 0xd7, 0xb1, 0x8d, 0xa9, 0x25, 0x56, 0x50, 0x33, 0x60, 0xfe, 0x81, 0xbf, + 0xa5, 0x8d, 0xc0, 0x8e, 0x1a, 0x78, 0xbf, 0x85, 0xa9, 0xa7, 0x7e, 0x09, 0x5e, 0x1e, 0xf8, 0x43, + 0x1d, 0x62, 0x53, 0x0c, 0x37, 0x00, 0x90, 0xba, 0x34, 0xa3, 0x2c, 0x8e, 0x2e, 0xa5, 0x8b, 0x73, + 0x1a, 0x07, 0xd2, 0x02, 0x20, 0xed, 0xbe, 0xdd, 0x2e, 0x4d, 0x3f, 0x7b, 0x5a, 0x48, 0x49, 0x05, + 0x23, 0xe4, 0xa6, 0xbe, 0x03, 0x5e, 0x3a, 0xaf, 0x2f, 0x16, 0x86, 0xb7, 0xc0, 0x94, 0x34, 0xab, + 0x58, 0x66, 0x46, 0x59, 0x54, 0x96, 0xc6, 0x8c, 0xb4, 0xfc, 0x56, 0x36, 0xd5, 0x87, 0xfd, 0xd4, + 0x12, 0xed, 0x3e, 0x48, 0x49, 0x43, 0xe6, 0x19, 0x93, 0xac, 0xe7, 0x25, 0xc1, 0xb6, 0x5d, 0xe2, + 0x10, 0x8a, 0x1a, 0x74, 0x08, 0xb0, 0x3d, 0x01, 0x16, 0xf2, 0x15, 0x60, 0x0f, 0x40, 0xca, 0x09, + 0x3e, 0x8a, 0x90, 0x15, 0xb4, 0x8b, 0x4f, 0x9c, 0x76, 0x4e, 0x22, 0x50, 0x28, 0x8d, 0x9d, 0x76, + 0xf2, 0x23, 0x46, 0x4f, 0x45, 0x5d, 0x03, 0x73, 0x7d, 0x96, 0x9c, 0x33, 0x0f, 0xd2, 0x81, 0x51, + 0x0f, 0x13, 0x04, 0x9f, 0xca, 0xa6, 0xfa, 0x4d, 0xa2, 0x6f, 0x8b, 0x92, 0xf2, 0x11, 0x98, 0x72, + 0x5a, 0xd5, 0x4a, 0x60, 0x7b, 0x65, 0x04, 0x0b, 0xdd, 0x4e, 0x3e, 0xbd, 0xdd, 0xaa, 0x06, 0x22, + 0xcf, 0x9e, 0x16, 0xb2, 0xe2, 0xc4, 0xd7, 0xc9, 0x81, 0xdc, 0xcc, 0x06, 0xb1, 0x3d, 0x6c, 0x7b, + 0x46, 0xda, 0xe9, 0x99, 0xc2, 0x79, 0x90, 0xb0, 0xcc, 0x4c, 0xc2, 0x27, 0x2b, 0x4d, 0x74, 0x3b, + 0xf9, 0x44, 0x79, 0xd3, 0x48, 0x58, 0x26, 0x2c, 0xf6, 0x85, 0x78, 0x94, 0x59, 0xbc, 0xe0, 0xaf, + 0x24, 0x73, 0x55, 0xde, 0x3c, 0x17, 0x73, 0x78, 0x0f, 0x24, 0x4d, 0x8c, 0xcc, 0x86, 0x65, 0xe3, + 0xcc, 0x18, 0xe3, 0xcd, 0x0e, 0xf0, 0xee, 0x04, 0x97, 0xa3, 0x94, 0xf4, 0xa3, 0xf8, 0xf8, 0xaf, + 0xbc, 0x62, 0x48, 0x2f, 0xf5, 0x26, 0xc8, 0xb2, 0x70, 0x7c, 0x86, 0x8f, 0xbc, 0x00, 0xb1, 0xbc, + 0x19, 0x5c, 0x84, 0x87, 0xe0, 0xc6, 0x85, 0x7f, 0x45, 0xc8, 0xde, 0x03, 0xb3, 0x36, 0x3e, 0xf2, + 0x2a, 0x03, 0x21, 0x2f, 0xc1, 0x6e, 0x27, 0x3f, 0xd3, 0xe7, 0x35, 0x63, 0x87, 0xdf, 0x4d, 0xf5, + 0x2b, 0xf0, 0x22, 0x13, 0xff, 0x9c, 0x78, 0xf2, 0xea, 0x45, 0x26, 0x10, 0x7e, 0x08, 0x40, 0xaf, + 0xf4, 0xb0, 0x30, 0xa6, 0x8b, 0xaf, 0x68, 0x22, 0xf8, 0x7e, 0x9d, 0xd2, 0x78, 0x61, 0x0b, 0x72, + 0xb0, 0x8d, 0xea, 0xc1, 0xf5, 0x32, 0x42, 0x9e, 0xea, 0xcf, 0x0a, 0x80, 0xe1, 0xe5, 0xc5, 0x96, + 0xb6, 0xc0, 0xf8, 0x81, 0xff, 0x41, 0x9c, 0xd3, 0xbb, 0x57, 0x9e, 0x53, 0xdf, 0xb5, 0xef, 0x8c, + 0x72, 0x6f, 0xf8, 0xd1, 0x05, 0x94, 0xaf, 0x46, 0x52, 0x72, 0xa5, 0x73, 0x98, 0x65, 0x30, 0x1b, + 0x5a, 0x2a, 0x66, 0x8c, 0xe6, 0xf8, 0x26, 0x5c, 0xb6, 0x70, 0x8a, 0x33, 0xb9, 0xea, 0x13, 0x25, + 0x14, 0x70, 0xb9, 0x61, 0xfd, 0x02, 0xb1, 0xd2, 0x4c, 0xb7, 0x93, 0x07, 0xa1, 0xd4, 0x45, 0x8a, + 0xc3, 0x75, 0x90, 0xf2, 0x1f, 0x2a, 0x5e, 0xdb, 0xc1, 0xec, 0xe8, 0xce, 0x14, 0x17, 0x2f, 0x8b, + 0x9d, 0xbf, 0xfe, 0x4e, 0xdb, 0xc1, 0x46, 0xf2, 0x40, 0x3c, 0xa9, 0x6f, 0x0a, 0xb4, 0x1d, 0xd4, + 0x68, 0xb4, 0x63, 0x5f, 0xe6, 0xff, 0x46, 0x45, 0x0e, 0x85, 0xdb, 0x75, 0xb7, 0x74, 0x0f, 0xa4, + 0xda, 0x98, 0x56, 0x78, 0xe2, 0xd9, 0xb6, 0x4a, 0xb7, 0xfd, 0x6c, 0xfe, 0xd9, 0xc9, 0xdf, 0xe0, + 0x39, 0xa3, 0xe6, 0x9e, 0x66, 0x11, 0xbd, 0x89, 0xbc, 0x5d, 0xed, 0x53, 0x5c, 0x47, 0xb5, 0xf6, + 0x26, 0xae, 0x19, 0xc9, 0x36, 0xa6, 0xec, 0xf8, 0xc0, 0xf7, 0x41, 0xd2, 0x26, 0x42, 0x60, 0x34, + 0xbe, 0xc0, 0xa4, 0x4d, 0xb8, 0xff, 0xc7, 0x60, 0xba, 0xd6, 0x72, 0x5d, 0x6c, 0x7b, 0x42, 0x64, + 0x2c, 0xbe, 0xc8, 0x94, 0xf0, 0xe4, 0x4a, 0x9f, 0x80, 0x19, 0x87, 0x50, 0x6a, 0x55, 0x1b, 0x58, + 0x48, 0x8d, 0xc7, 0x97, 0x9a, 0x0e, 0x5c, 0xa5, 0x16, 0x4f, 0xea, 0xae, 0x8b, 0xe9, 0x2e, 0x69, + 0x98, 0x99, 0x89, 0x21, 0xb4, 0x58, 0x72, 0x03, 0x4f, 0xf8, 0x2e, 0x98, 0xd8, 0x6f, 0x11, 0xb7, + 0xd5, 0xcc, 0x4c, 0xc6, 0xd7, 0x10, 0x2e, 0xea, 0x96, 0x28, 0xda, 0x06, 0x3a, 0xdc, 0x46, 0x2e, + 0x6a, 0xca, 0x72, 0x91, 0x05, 0x49, 0xda, 0xaa, 0x52, 0x07, 0xd5, 0x78, 0xcb, 0x4b, 0x19, 0xf2, + 0x1d, 0xce, 0x82, 0xd1, 0x3d, 0xdc, 0x16, 0xc7, 0xd4, 0x7f, 0x54, 0x57, 0x45, 0x8b, 0x0a, 0xc9, + 0x88, 0x23, 0xb3, 0x00, 0x92, 0x2e, 0x3a, 0xac, 0x98, 0xc8, 0x43, 0x42, 0x67, 0xd2, 0x45, 0x87, + 0x9b, 0xc8, 0x43, 0xc5, 0xdf, 0xd2, 0x60, 0x9c, 0x79, 0xc1, 0x27, 0x0a, 0x00, 0xbd, 0x91, 0x00, + 0x6a, 0x57, 0xd6, 0x86, 0x81, 0xa9, 0x22, 0xab, 0xc7, 0xb6, 0xe7, 0x50, 0xea, 0xf2, 0xd7, 0xbf, + 0xff, 0xfb, 0x6d, 0xe2, 0x0e, 0x54, 0xf5, 0x4b, 0xe6, 0x99, 0xde, 0x48, 0x01, 0x7f, 0x51, 0x40, + 0xaf, 0xa5, 0xc3, 0x42, 0xbc, 0xa5, 0x02, 0x32, 0x2d, 0xae, 0xb9, 0x00, 0x7b, 0x9b, 0x81, 0xad, + 0xc2, 0x95, 0x68, 0x30, 0xfd, 0x38, 0xdc, 0xd4, 0x4e, 0xe0, 0x77, 0x0a, 0x48, 0xc9, 0x09, 0x01, + 0xc6, 0x1b, 0x03, 0x68, 0x3c, 0xce, 0x81, 0xc1, 0x43, 0xbd, 0xcb, 0x38, 0x6f, 0xc3, 0x5b, 0x97, + 0x71, 0xca, 0x81, 0x02, 0xfe, 0xa8, 0x80, 0xa4, 0x6c, 0xd1, 0xaf, 0xc7, 0x9c, 0x4e, 0x38, 0xd5, + 0x70, 0xb3, 0x8c, 0xba, 0xc6, 0xa0, 0x56, 0xa0, 0x1e, 0x09, 0xa5, 0x1f, 0x87, 0xca, 0xd8, 0x09, + 0xfc, 0x55, 0x01, 0x7d, 0x2d, 0x15, 0x16, 0xaf, 0x5c, 0xfa, 0xc2, 0x9e, 0x9e, 0x5d, 0x1d, 0xca, + 0x47, 0x40, 0xbf, 0xc1, 0xa0, 0x97, 0xe1, 0xd2, 0x65, 0xd0, 0x7e, 0x6f, 0x2f, 0x04, 0xb8, 0x05, + 0xcb, 0x84, 0x3f, 0x28, 0x60, 0x9c, 0x57, 0x91, 0xe8, 0x1e, 0x2a, 0x13, 0xbc, 0x1c, 0xc7, 0x54, + 0x20, 0xad, 0x33, 0xa4, 0x35, 0xf8, 0xd6, 0x90, 0x71, 0xd4, 0x79, 0x87, 0xfe, 0x49, 0x01, 0x63, + 0xbe, 0x20, 0x5c, 0x8a, 0xd1, 0xe2, 0x39, 0x5d, 0xfc, 0x61, 0x40, 0xdd, 0x62, 0x70, 0x1f, 0xc0, + 0xf5, 0x6b, 0xc1, 0xe9, 0xc7, 0xac, 0xa9, 0x9e, 0xb0, 0x20, 0xb2, 0xde, 0x16, 0x11, 0xc4, 0x70, + 0xdb, 0x8c, 0x08, 0xe2, 0xb9, 0x56, 0x79, 0xfd, 0x20, 0x7a, 0x8c, 0xea, 0x7b, 0x05, 0xa4, 0x64, + 0x31, 0x8d, 0xb8, 0xcd, 0xfd, 0xb5, 0x3b, 0xe2, 0x36, 0x0f, 0xd4, 0xe8, 0xe8, 0x72, 0xe8, 0xa2, + 0xc3, 0x82, 0xc3, 0x7c, 0x4a, 0xe5, 0xd3, 0x7f, 0x72, 0x23, 0xa7, 0xdd, 0x9c, 0xf2, 0xbc, 0x9b, + 0x53, 0xfe, 0xee, 0xe6, 0x94, 0xc7, 0x67, 0xb9, 0x91, 0xe7, 0x67, 0xb9, 0x91, 0x3f, 0xce, 0x72, + 0x23, 0x5f, 0xbc, 0x56, 0xb7, 0xbc, 0xdd, 0x56, 0xd5, 0x5f, 0x9a, 0x69, 0x15, 0x1a, 0xa8, 0x4a, + 0xb9, 0xea, 0x51, 0x48, 0xd7, 0x9f, 0x65, 0x68, 0x75, 0x82, 0x4d, 0xd2, 0xab, 0xff, 0x07, 0x00, + 0x00, 0xff, 0xff, 0x66, 0x8f, 0x73, 0x60, 0x48, 0x0f, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1182,6 +1182,7 @@ func _Query_RawParams_Handler(srv interface{}, ctx context.Context, dec func(int return interceptor(ctx, in, info, handler) } +var Query_serviceDesc = _Query_serviceDesc var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "kava.committee.v1beta1.Query", HandlerType: (*QueryServer)(nil), diff --git a/x/committee/types/tx.pb.go b/x/committee/types/tx.pb.go index 7a3570e39d..800fb79886 100644 --- a/x/committee/types/tx.pb.go +++ b/x/committee/types/tx.pb.go @@ -330,6 +330,7 @@ func _Msg_Vote_Handler(srv interface{}, ctx context.Context, dec func(interface{ return interceptor(ctx, in, info, handler) } +var Msg_serviceDesc = _Msg_serviceDesc var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "kava.committee.v1beta1.Msg", HandlerType: (*MsgServer)(nil), diff --git a/x/community/abci_test.go b/x/community/abci_test.go index c74938bdf7..1e009fd4d6 100644 --- a/x/community/abci_test.go +++ b/x/community/abci_test.go @@ -25,7 +25,7 @@ func TestABCIStakingRewardsArePaidOutOnDisableInflationBlock(t *testing.T) { // a block that runs after addition of the disable inflation code on chain // but before the disable inflation time initialBlockTime := time.Now() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: initialBlockTime}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: initialBlockTime}) poolAcc := accountKeeper.GetModuleAccount(ctx, types.ModuleName) feeCollectorAcc := accountKeeper.GetModuleAccount(ctx, authtypes.FeeCollectorName) @@ -57,7 +57,7 @@ func TestABCIStakingRewardsArePaidOutOnDisableInflationBlock(t *testing.T) { // new block when disable inflation runs, 10 seconds from initial block for easy math blockTime := disableTime.Add(1 * time.Second) - ctx = tApp.NewContext(true, tmproto.Header{Height: ctx.BlockHeight() + 1, Time: blockTime}) + ctx = tApp.NewContextLegacy(true, tmproto.Header{Height: ctx.BlockHeight() + 1, Time: blockTime}) // run the next block community.BeginBlocker(ctx, keeper) diff --git a/x/community/client/cli/tx.go b/x/community/client/cli/tx.go index a140c12c79..159bba7b57 100644 --- a/x/community/client/cli/tx.go +++ b/x/community/client/cli/tx.go @@ -2,10 +2,12 @@ package cli import ( "fmt" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" "strings" "github.com/spf13/cobra" + "cosmossdk.io/errors" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/tx" @@ -120,7 +122,14 @@ Where proposal.json contains: if err != nil { return err } - if err := msg.ValidateBasic(); err != nil { + contentProposal := msg.GetContent() + if contentProposal == nil { + return errors.Wrap(govtypes.ErrInvalidProposalContent, "missing content") + } + if !govv1beta1.IsValidProposalType(contentProposal.ProposalType()) { + return errors.Wrap(govtypes.ErrInvalidProposalType, contentProposal.ProposalType()) + } + if err := contentProposal.ValidateBasic(); err != nil { return err } @@ -180,7 +189,15 @@ Where proposal.json contains: if err != nil { return err } - if err := msg.ValidateBasic(); err != nil { + + contentProposal := msg.GetContent() + if contentProposal == nil { + return errors.Wrap(govtypes.ErrInvalidProposalContent, "missing content") + } + if !govv1beta1.IsValidProposalType(contentProposal.ProposalType()) { + return errors.Wrap(govtypes.ErrInvalidProposalType, contentProposal.ProposalType()) + } + if err := contentProposal.ValidateBasic(); err != nil { return err } diff --git a/x/community/genesis_test.go b/x/community/genesis_test.go index 1a8a258969..3098b3a6f9 100644 --- a/x/community/genesis_test.go +++ b/x/community/genesis_test.go @@ -7,8 +7,7 @@ import ( "github.com/stretchr/testify/suite" sdkmath "cosmossdk.io/math" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/kava-labs/kava/x/community" "github.com/kava-labs/kava/x/community/testutil" "github.com/kava-labs/kava/x/community/types" @@ -49,7 +48,7 @@ func (suite *genesisTestSuite) TestInitGenesis() { // check for module account this way b/c GetModuleAccount creates if not existing. acc := accountKeeper.GetAccount(suite.Ctx, suite.MaccAddress) suite.NotNil(acc) - _, ok := acc.(authtypes.ModuleAccountI) + _, ok := acc.(sdk.ModuleAccountI) suite.True(ok) keeper := suite.App.GetCommunityKeeper() diff --git a/x/community/handler.go b/x/community/handler.go index 45cf024bac..b2a33fa818 100644 --- a/x/community/handler.go +++ b/x/community/handler.go @@ -2,6 +2,7 @@ package community import ( errorsmod "cosmossdk.io/errors" + "fmt" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" @@ -13,6 +14,7 @@ import ( // NewCommunityPoolProposalHandler handles x/community proposals. func NewCommunityPoolProposalHandler(k keeper.Keeper) govv1beta1.Handler { return func(ctx sdk.Context, content govv1beta1.Content) error { + fmt.Println("NewCommunityPoolProposalHandler content", content) switch c := content.(type) { case *types.CommunityCDPRepayDebtProposal: return keeper.HandleCommunityCDPRepayDebtProposal(ctx, k, c) diff --git a/x/community/keeper/disable_inflation.go b/x/community/keeper/disable_inflation.go index 5ecbe8629b..c522b6e994 100644 --- a/x/community/keeper/disable_inflation.go +++ b/x/community/keeper/disable_inflation.go @@ -1,6 +1,7 @@ package keeper import ( + sdkmath "cosmossdk.io/math" "time" sdk "github.com/cosmos/cosmos-sdk/types" @@ -56,8 +57,8 @@ func (k Keeper) disableInflation(ctx sdk.Context) { // set x/min inflation to 0 mintParams := k.mintKeeper.GetParams(ctx) - mintParams.InflationMin = sdk.ZeroDec() - mintParams.InflationMax = sdk.ZeroDec() + mintParams.InflationMin = sdkmath.LegacyZeroDec() + mintParams.InflationMax = sdkmath.LegacyZeroDec() if err := k.mintKeeper.SetParams(ctx, mintParams); err != nil { panic(err) } @@ -75,7 +76,7 @@ func (k Keeper) disableCommunityTax(ctx sdk.Context) { logger := k.Logger(ctx) distrParams := k.distrKeeper.GetParams(ctx) - distrParams.CommunityTax = sdk.ZeroDec() + distrParams.CommunityTax = sdkmath.LegacyZeroDec() if err := k.distrKeeper.SetParams(ctx, distrParams); err != nil { panic(err) } diff --git a/x/community/keeper/grpc_query.go b/x/community/keeper/grpc_query.go index 44d58e6c6c..f701efde78 100644 --- a/x/community/keeper/grpc_query.go +++ b/x/community/keeper/grpc_query.go @@ -76,14 +76,26 @@ func (s queryServer) AnnualizedRewards( // this method adds both sources together so it is accurate in both cases. params := s.keeper.mustGetParams(ctx) - bondDenom := s.keeper.stakingKeeper.BondDenom(ctx) + bondDenom, err := s.keeper.stakingKeeper.BondDenom(ctx) + if err != nil { + return nil, err + } totalSupply := s.keeper.bankKeeper.GetSupply(ctx, bondDenom).Amount - totalBonded := s.keeper.stakingKeeper.TotalBondedTokens(ctx) + totalBonded, err := s.keeper.stakingKeeper.TotalBondedTokens(ctx) + if err != nil { + return nil, err + } + rewardsPerSecond := params.StakingRewardsPerSecond - // need to convert these from sdk.Dec to sdkmath.LegacyDec + // need to convert these from sdkmath.LegacyDec to sdkmath.LegacyDec inflationRate := convertDecToLegacyDec(s.keeper.mintKeeper.GetMinter(ctx).Inflation) - communityTax := convertDecToLegacyDec(s.keeper.distrKeeper.GetCommunityTax(ctx)) + tax, err := s.keeper.distrKeeper.GetCommunityTax(ctx) + if err != nil { + return nil, err + } + + communityTax := convertDecToLegacyDec(tax) return &types.QueryAnnualizedRewardsResponse{ StakingRewards: CalculateStakingAnnualPercentage(totalSupply, totalBonded, inflationRate, communityTax, rewardsPerSecond), @@ -91,9 +103,9 @@ func (s queryServer) AnnualizedRewards( } // convertDecToLegacyDec is a helper method for converting between new and old Dec types -// current version of cosmos-sdk in this repo uses sdk.Dec +// current version of cosmos-sdk in this repo uses sdkmath.LegacyDec // this module uses sdkmath.LegacyDec in its parameters // TODO: remove me after upgrade to cosmos-sdk v50 (LegacyDec is everywhere) -func convertDecToLegacyDec(in sdk.Dec) sdkmath.LegacyDec { - return sdkmath.LegacyNewDecFromBigIntWithPrec(in.BigInt(), sdk.Precision) +func convertDecToLegacyDec(in sdkmath.LegacyDec) sdkmath.LegacyDec { + return sdkmath.LegacyNewDecFromBigIntWithPrec(in.BigInt(), sdkmath.LegacyPrecision) } diff --git a/x/community/keeper/grpc_query_test.go b/x/community/keeper/grpc_query_test.go index 123e01a720..7a1bda9a0e 100644 --- a/x/community/keeper/grpc_query_test.go +++ b/x/community/keeper/grpc_query_test.go @@ -82,7 +82,7 @@ func (suite *grpcQueryTestSuite) TestGrpcQueryBalance() { tc.setup() res, err := suite.queryClient.Balance(context.Background(), &types.QueryBalanceRequest{}) suite.Require().NoError(err) - suite.Require().True(expCoins.IsEqual(res.Coins)) + suite.Require().True(expCoins.Equal(res.Coins)) }) } } @@ -161,7 +161,7 @@ func (suite *grpcQueryTestSuite) TestGrpcQueryTotalBalance() { tc.setup() res, err := suite.queryClient.TotalBalance(context.Background(), &types.QueryTotalBalanceRequest{}) suite.Require().NoError(err) - suite.Require().True(expCoins.IsEqual(res.Pool)) + suite.Require().True(expCoins.Equal(res.Pool)) }) } } @@ -172,55 +172,55 @@ func (suite *grpcQueryTestSuite) TestGrpcQueryAnnualizedRewards() { bondedTokens := sdkmath.NewInt(1e6) testCases := []struct { name string - bondedRatio sdk.Dec - inflation sdk.Dec + bondedRatio sdkmath.LegacyDec + inflation sdkmath.LegacyDec rewardsPerSec sdkmath.LegacyDec - communityTax sdk.Dec + communityTax sdkmath.LegacyDec expectedRate sdkmath.LegacyDec }{ { name: "sanity check: no inflation, no rewards => 0%", - bondedRatio: sdk.MustNewDecFromStr("0.3456"), - inflation: sdk.ZeroDec(), + bondedRatio: sdkmath.LegacyMustNewDecFromStr("0.3456"), + inflation: sdkmath.LegacyZeroDec(), rewardsPerSec: sdkmath.LegacyZeroDec(), expectedRate: sdkmath.LegacyZeroDec(), }, { name: "inflation sanity check: 100% inflation, 100% bonded => 100%", - bondedRatio: sdk.OneDec(), - inflation: sdk.OneDec(), + bondedRatio: sdkmath.LegacyOneDec(), + inflation: sdkmath.LegacyOneDec(), rewardsPerSec: sdkmath.LegacyZeroDec(), expectedRate: sdkmath.LegacyOneDec(), }, { name: "inflation sanity check: 100% community tax => 0%", - bondedRatio: sdk.OneDec(), - inflation: sdk.OneDec(), - communityTax: sdk.OneDec(), + bondedRatio: sdkmath.LegacyOneDec(), + inflation: sdkmath.LegacyOneDec(), + communityTax: sdkmath.LegacyOneDec(), rewardsPerSec: sdkmath.LegacyZeroDec(), expectedRate: sdkmath.LegacyZeroDec(), }, { name: "rewards per second sanity check: (totalBonded/SecondsPerYear) rps => 100%", - bondedRatio: sdk.OneDec(), // bonded tokens are constant in this test. ratio has no affect. - inflation: sdk.ZeroDec(), + bondedRatio: sdkmath.LegacyOneDec(), // bonded tokens are constant in this test. ratio has no affect. + inflation: sdkmath.LegacyZeroDec(), rewardsPerSec: sdkmath.LegacyNewDecFromInt(bondedTokens).QuoInt(sdkmath.NewInt(keeper.SecondsPerYear)), // expect ~100% expectedRate: sdkmath.LegacyMustNewDecFromStr("0.999999999999999984"), }, { name: "inflation enabled: realistic example", - bondedRatio: sdk.MustNewDecFromStr("0.148"), - inflation: sdk.MustNewDecFromStr("0.595"), - communityTax: sdk.MustNewDecFromStr("0.9495"), + bondedRatio: sdkmath.LegacyMustNewDecFromStr("0.148"), + inflation: sdkmath.LegacyMustNewDecFromStr("0.595"), + communityTax: sdkmath.LegacyMustNewDecFromStr("0.9495"), rewardsPerSec: sdkmath.LegacyZeroDec(), // expect ~20.23% expectedRate: sdkmath.LegacyMustNewDecFromStr("0.203023625910000000"), }, { name: "inflation disabled: simple example", - bondedRatio: sdk.OneDec(), // bonded tokens are constant in this test. ratio has no affect. - inflation: sdk.ZeroDec(), + bondedRatio: sdkmath.LegacyOneDec(), // bonded tokens are constant in this test. ratio has no affect. + inflation: sdkmath.LegacyZeroDec(), rewardsPerSec: sdkmath.LegacyMustNewDecFromStr("0.01"), // 1e6 bonded tokens => seconds per year / bonded tokens = 31.536 // expect 31.536% @@ -239,7 +239,7 @@ func (suite *grpcQueryTestSuite) TestGrpcQueryAnnualizedRewards() { mk.SetMinter(suite.Ctx, minter) // set community tax - communityTax := sdk.ZeroDec() + communityTax := sdkmath.LegacyZeroDec() if !tc.communityTax.IsNil() { communityTax = tc.communityTax } @@ -270,22 +270,23 @@ func (suite *grpcQueryTestSuite) TestGrpcQueryAnnualizedRewards() { // it leverages the fact that there is a constant number of bonded tokens // and adjusts the total supply to make change the bonded ratio. // returns the new total supply of the bond denom -func (suite *grpcQueryTestSuite) adjustBondedRatio(desiredRatio sdk.Dec) sdkmath.Int { +func (suite *grpcQueryTestSuite) adjustBondedRatio(desiredRatio sdkmath.LegacyDec) sdkmath.Int { // from the InitGenesis validator bondedTokens := sdkmath.NewInt(1e6) - bondDenom := suite.App.GetStakingKeeper().BondDenom(suite.Ctx) + bondDenom, err := suite.App.GetStakingKeeper().BondDenom(suite.Ctx) + suite.Require().NoError(err) // first, burn all non-delegated coins (bonded ratio = 100%) suite.App.DeleteGenesisValidatorCoins(suite.T(), suite.Ctx) - if desiredRatio.Equal(sdk.OneDec()) { + if desiredRatio.Equal(sdkmath.LegacyOneDec()) { return bondedTokens } // mint new tokens to adjust the bond ratio - newTotalSupply := sdk.NewDecFromInt(bondedTokens).Quo(desiredRatio).TruncateInt() + newTotalSupply := sdkmath.LegacyNewDecFromInt(bondedTokens).Quo(desiredRatio).TruncateInt() coinsToMint := newTotalSupply.Sub(bondedTokens) - err := suite.App.FundAccount(suite.Ctx, app.RandomAddress(), sdk.NewCoins(sdk.NewCoin(bondDenom, coinsToMint))) + err = suite.App.FundAccount(suite.Ctx, app.RandomAddress(), sdk.NewCoins(sdk.NewCoin(bondDenom, coinsToMint))) suite.Require().NoError(err) return newTotalSupply diff --git a/x/community/keeper/keeper.go b/x/community/keeper/keeper.go index 585afaca9f..ae1b00a70c 100644 --- a/x/community/keeper/keeper.go +++ b/x/community/keeper/keeper.go @@ -3,9 +3,9 @@ package keeper import ( "fmt" - "github.com/cometbft/cometbft/libs/log" + "cosmossdk.io/log" "github.com/cosmos/cosmos-sdk/codec" - storetypes "github.com/cosmos/cosmos-sdk/store/types" + storetypes "cosmossdk.io/store/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/kava-labs/kava/x/community/types" diff --git a/x/community/keeper/params_test.go b/x/community/keeper/params_test.go index 7dff215e2b..2a08525c0a 100644 --- a/x/community/keeper/params_test.go +++ b/x/community/keeper/params_test.go @@ -28,7 +28,7 @@ type StoreTestSuite struct { func (suite *StoreTestSuite) SetupTest() { app.SetSDKConfig() suite.App = app.NewTestApp() - suite.Ctx = suite.App.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + suite.Ctx = suite.App.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) suite.Keeper = suite.App.GetCommunityKeeper() } diff --git a/x/community/keeper/proposal_handler_test.go b/x/community/keeper/proposal_handler_test.go index 7f6a6f540a..749b0b3326 100644 --- a/x/community/keeper/proposal_handler_test.go +++ b/x/community/keeper/proposal_handler_test.go @@ -59,12 +59,12 @@ func (suite *proposalTestSuite) SetupTest() { genTime := tmtime.Now() hardGS, pricefeedGS := testutil.NewLendGenesisBuilder(). - WithMarket("ukava", "kava:usd", sdk.OneDec()). - WithMarket("usdx", "usdx:usd", sdk.OneDec()). + WithMarket("ukava", "kava:usd", sdkmath.LegacyOneDec()). + WithMarket("usdx", "usdx:usd", sdkmath.LegacyOneDec()). Build() tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{ + ctx := tApp.NewContextLegacy(true, tmproto.Header{ Height: 1, Time: genTime, ChainID: chainID, @@ -83,7 +83,7 @@ func (suite *proposalTestSuite) SetupTest() { app.GenesisState{hardtypes.ModuleName: tApp.AppCodec().MustMarshalJSON(&hardGS)}, app.GenesisState{pricefeedtypes.ModuleName: tApp.AppCodec().MustMarshalJSON(&pricefeedGS)}, app.GenesisState{types.ModuleName: tApp.AppCodec().MustMarshalJSON(&communityGs)}, - testutil.NewCDPGenState(tApp.AppCodec(), "ukava", "kava", sdk.NewDec(2)), + testutil.NewCDPGenState(tApp.AppCodec(), "ukava", "kava", sdkmath.LegacyNewDec(2)), ) suite.App = tApp @@ -106,9 +106,14 @@ func (suite *proposalTestSuite) NextBlock() { newTime := suite.Ctx.BlockTime().Add(6 * time.Second) newHeight := suite.Ctx.BlockHeight() + 1 - suite.App.EndBlocker(suite.Ctx, abcitypes.RequestEndBlock{}) - suite.Ctx = suite.Ctx.WithBlockTime(newTime).WithBlockHeight(newHeight).WithChainID(chainID) - suite.App.BeginBlocker(suite.Ctx, abcitypes.RequestBeginBlock{}) + suite.App.FinalizeBlock(&abcitypes.RequestFinalizeBlock{ + Time: newTime, + Height: newHeight, + }) + + //suite.App.EndBlocker(suite.Ctx, abcitypes.RequestEndBlock{}) + //suite.Ctx = suite.Ctx.WithBlockTime(newTime).WithBlockHeight(newHeight).WithChainID(chainID) + //suite.App.BeginBlocker(suite.Ctx, abcitypes.RequestBeginBlock{}) } func (suite *proposalTestSuite) FundCommunityPool(coins sdk.Coins) { @@ -132,7 +137,7 @@ func (suite *proposalTestSuite) GetCommunityPoolBalance() sdk.Coins { func (suite *proposalTestSuite) CheckCommunityPoolBalance(expected sdk.Coins) { actual := suite.GetCommunityPoolBalance() // check that balance is expected - suite.True(expected.IsEqual(actual), fmt.Sprintf("unexpected balance in community pool\nexpected: %s\nactual: %s", expected, actual)) + suite.True(expected.Equal(actual), fmt.Sprintf("unexpected balance in community pool\nexpected: %s\nactual: %s", expected, actual)) } func (suite *proposalTestSuite) TestCommunityLendDepositProposal() { @@ -313,7 +318,7 @@ func (suite *proposalTestSuite) TestCommunityLendWithdrawProposal() { // during the test - this is because staking denom is "ukava" and no // longer "stake" which has an initial and changing balance instead // of just 0 - suite.App.SetInflation(suite.Ctx, sdk.ZeroDec()) + suite.App.SetInflation(suite.Ctx, sdkmath.LegacyZeroDec()) // setup initial deposit if !tc.initialDeposit.IsZero() { @@ -451,7 +456,7 @@ func (suite *proposalTestSuite) TestCommunityCDPRepayDebtProposal() { // verify the balance changed as expected moduleBalanceAfter := suite.Keeper.GetModuleAccountBalance(suite.Ctx) - suite.True(expectedModuleBalance.IsEqual(moduleBalanceAfter), "module balance changed unexpectedly") + suite.True(expectedModuleBalance.Equal(moduleBalanceAfter), "module balance changed unexpectedly") }) } } @@ -556,7 +561,7 @@ func (suite *proposalTestSuite) TestCommunityCDPWithdrawCollateralProposal() { // verify the balance changed as expected moduleBalanceAfter := suite.Keeper.GetModuleAccountBalance(suite.Ctx) - suite.True(expectedModuleBalance.IsEqual(moduleBalanceAfter), "module balance changed unexpectedly") + suite.True(expectedModuleBalance.Equal(moduleBalanceAfter), "module balance changed unexpectedly") }) } } diff --git a/x/community/keeper/rewards_test.go b/x/community/keeper/rewards_test.go index 8aed1f76a1..75974de468 100644 --- a/x/community/keeper/rewards_test.go +++ b/x/community/keeper/rewards_test.go @@ -7,8 +7,6 @@ import ( sdkmath "cosmossdk.io/math" "github.com/stretchr/testify/require" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/kava-labs/kava/x/community/keeper" ) @@ -41,7 +39,7 @@ func TestStakingRewardsCalculator(t *testing.T) { // { name: "inflation only: no bonded tokens -> 0%", - totalSupply: sdk.NewInt(42), + totalSupply: sdkmath.NewInt(42), totalBonded: sdkmath.ZeroInt(), inflation: sdkmath.LegacyOneDec(), communityTax: sdkmath.LegacyZeroDec(), @@ -50,7 +48,7 @@ func TestStakingRewardsCalculator(t *testing.T) { }, { name: "inflation only: 0% inflation -> 0%", - totalSupply: sdk.NewInt(123), + totalSupply: sdkmath.NewInt(123), totalBonded: sdkmath.NewInt(45), inflation: sdkmath.LegacyZeroDec(), communityTax: sdkmath.LegacyZeroDec(), @@ -59,8 +57,8 @@ func TestStakingRewardsCalculator(t *testing.T) { }, { name: "inflation only: 100% bonded w/ 100% inflation -> 100%", - totalSupply: sdk.NewInt(42), - totalBonded: sdk.NewInt(42), + totalSupply: sdkmath.NewInt(42), + totalBonded: sdkmath.NewInt(42), inflation: sdkmath.LegacyOneDec(), communityTax: sdkmath.LegacyZeroDec(), perSecReward: sdkmath.LegacyZeroDec(), @@ -68,7 +66,7 @@ func TestStakingRewardsCalculator(t *testing.T) { }, { name: "inflation only: 100% community tax -> 0%", - totalSupply: sdk.NewInt(123), + totalSupply: sdkmath.NewInt(123), totalBonded: sdkmath.NewInt(45), inflation: sdkmath.LegacyMustNewDecFromStr("0.853"), communityTax: sdkmath.LegacyOneDec(), @@ -77,8 +75,8 @@ func TestStakingRewardsCalculator(t *testing.T) { }, { name: "inflation only: Oct 2023 case", - totalSupply: sdk.NewInt(857570000e6), - totalBonded: sdk.NewInt(127680000e6), + totalSupply: sdkmath.NewInt(857570000e6), + totalBonded: sdkmath.NewInt(127680000e6), inflation: sdkmath.LegacyMustNewDecFromStr("0.595"), communityTax: sdkmath.LegacyMustNewDecFromStr("0.9495"), perSecReward: sdkmath.LegacyZeroDec(), @@ -87,8 +85,8 @@ func TestStakingRewardsCalculator(t *testing.T) { }, { name: "inflation only: low inflation", - totalSupply: sdk.NewInt(857570000e6), - totalBonded: sdk.NewInt(127680000e6), + totalSupply: sdkmath.NewInt(857570000e6), + totalBonded: sdkmath.NewInt(127680000e6), inflation: sdkmath.LegacyMustNewDecFromStr("0.0000000001"), communityTax: sdkmath.LegacyMustNewDecFromStr("0.9495"), perSecReward: sdkmath.LegacyZeroDec(), @@ -96,8 +94,8 @@ func TestStakingRewardsCalculator(t *testing.T) { }, { name: "inflation only: absurdly high inflation", - totalSupply: sdk.NewInt(857570000e6), - totalBonded: sdk.NewInt(127680000e6), + totalSupply: sdkmath.NewInt(857570000e6), + totalBonded: sdkmath.NewInt(127680000e6), inflation: sdkmath.LegacyNewDecFromBigInt(hugeInflation), // 2^205. a higher exponent than this overflows. communityTax: sdkmath.LegacyMustNewDecFromStr("0.9495"), perSecReward: sdkmath.LegacyZeroDec(), @@ -111,7 +109,7 @@ func TestStakingRewardsCalculator(t *testing.T) { // { name: "rps only: no bonded tokens -> 0%", - totalSupply: sdk.NewInt(42), + totalSupply: sdkmath.NewInt(42), totalBonded: sdkmath.ZeroInt(), inflation: sdkmath.LegacyZeroDec(), communityTax: sdkmath.LegacyZeroDec(), @@ -120,7 +118,7 @@ func TestStakingRewardsCalculator(t *testing.T) { }, { name: "rps only: rps = total bonded / seconds in year -> basically 100%", - totalSupply: sdk.NewInt(12345), + totalSupply: sdkmath.NewInt(12345), totalBonded: sdkmath.NewInt(1234), inflation: sdkmath.LegacyZeroDec(), communityTax: sdkmath.LegacyZeroDec(), @@ -129,7 +127,7 @@ func TestStakingRewardsCalculator(t *testing.T) { }, { name: "rps only: 10M kava / year rewards", - totalSupply: sdk.NewInt(870950000e6), + totalSupply: sdkmath.NewInt(870950000e6), totalBonded: sdkmath.NewInt(130380000e6), inflation: sdkmath.LegacyZeroDec(), communityTax: sdkmath.LegacyZeroDec(), @@ -138,7 +136,7 @@ func TestStakingRewardsCalculator(t *testing.T) { }, { name: "rps only: 25M kava / year rewards", - totalSupply: sdk.NewInt(870950000e6), + totalSupply: sdkmath.NewInt(870950000e6), totalBonded: sdkmath.NewInt(130380000e6), inflation: sdkmath.LegacyZeroDec(), communityTax: sdkmath.LegacyZeroDec(), @@ -147,7 +145,7 @@ func TestStakingRewardsCalculator(t *testing.T) { }, { name: "rps only: too much kava / year rewards", - totalSupply: sdk.NewInt(870950000e6), + totalSupply: sdkmath.NewInt(870950000e6), totalBonded: sdkmath.NewInt(130380000e6), inflation: sdkmath.LegacyZeroDec(), communityTax: sdkmath.LegacyZeroDec(), @@ -157,7 +155,7 @@ func TestStakingRewardsCalculator(t *testing.T) { }, { name: "rps only: low kava / year rewards", - totalSupply: sdk.NewInt(870950000e6), + totalSupply: sdkmath.NewInt(870950000e6), totalBonded: sdkmath.NewInt(130380000e6), inflation: sdkmath.LegacyZeroDec(), communityTax: sdkmath.LegacyZeroDec(), @@ -166,7 +164,7 @@ func TestStakingRewardsCalculator(t *testing.T) { }, { name: "rps only: 1 ukava / year rewards", - totalSupply: sdk.NewInt(870950000e6), + totalSupply: sdkmath.NewInt(870950000e6), totalBonded: sdkmath.NewInt(130380000e6), inflation: sdkmath.LegacyZeroDec(), communityTax: sdkmath.LegacyZeroDec(), diff --git a/x/community/keeper/staking.go b/x/community/keeper/staking.go index 52101a1148..58b7561bd5 100644 --- a/x/community/keeper/staking.go +++ b/x/community/keeper/staking.go @@ -28,7 +28,11 @@ func (k Keeper) PayoutAccumulatedStakingRewards(ctx sdk.Context) { } // get the denom for staking - stakingRewardDenom := k.stakingKeeper.BondDenom(ctx) + stakingRewardDenom, err := k.stakingKeeper.BondDenom(ctx) + if err != nil { + // TODO(boodyvo): handle error + panic(err) + } // we fetch the community pool balance to ensure only accumulate rewards up to the current balance communityPoolBalance := sdkmath.LegacyNewDecFromInt(k.bankKeeper.GetBalance(ctx, k.moduleAddress, stakingRewardDenom).Amount) diff --git a/x/community/migrations/v2/store.go b/x/community/migrations/v2/store.go index 34907dfd07..8a45a493c7 100644 --- a/x/community/migrations/v2/store.go +++ b/x/community/migrations/v2/store.go @@ -3,7 +3,7 @@ package v2 import ( "time" - storetypes "github.com/cosmos/cosmos-sdk/store/types" + storetypes "cosmossdk.io/store/types" sdkmath "cosmossdk.io/math" "github.com/cosmos/cosmos-sdk/codec" diff --git a/x/community/migrations/v2/store_test.go b/x/community/migrations/v2/store_test.go index 6c8deb2cba..4a123e19fb 100644 --- a/x/community/migrations/v2/store_test.go +++ b/x/community/migrations/v2/store_test.go @@ -1,6 +1,7 @@ package v2_test import ( + storetypes "cosmossdk.io/store/types" "testing" "time" @@ -8,7 +9,6 @@ import ( "github.com/stretchr/testify/require" "github.com/cosmos/cosmos-sdk/testutil" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/kava-labs/kava/app" v2 "github.com/kava-labs/kava/x/community/migrations/v2" "github.com/kava-labs/kava/x/community/types" @@ -17,8 +17,8 @@ import ( func TestMigrateStore(t *testing.T) { tApp := app.NewTestApp() cdc := tApp.AppCodec() - storeKey := sdk.NewKVStoreKey("community") - ctx := testutil.DefaultContext(storeKey, sdk.NewTransientStoreKey("transient_test")) + storeKey := storetypes.NewKVStoreKey("community") + ctx := testutil.DefaultContext(storeKey, storetypes.NewTransientStoreKey("transient_test")) store := ctx.KVStore(storeKey) require.Nil( diff --git a/x/community/module.go b/x/community/module.go index 83eaef6e39..3519b05ef2 100644 --- a/x/community/module.go +++ b/x/community/module.go @@ -138,11 +138,18 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // BeginBlock module begin-block -func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { - BeginBlocker(ctx, am.keeper) +func (am AppModule) BeginBlock(ctx context.Context) error { + sdkCtx := sdk.UnwrapSDKContext(ctx) + BeginBlocker(sdkCtx, am.keeper) + + return nil } // EndBlock module end-block -func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - return []abci.ValidatorUpdate{} +func (am AppModule) EndBlock(_ sdk.Context) ([]abci.ValidatorUpdate, error) { + return []abci.ValidatorUpdate{}, nil } + +func (AppModule) IsOnePerModuleType() {} + +func (AppModule) IsAppModule() {} diff --git a/x/community/module_test.go b/x/community/module_test.go index 4e74874a46..74898ee570 100644 --- a/x/community/module_test.go +++ b/x/community/module_test.go @@ -13,7 +13,7 @@ import ( func TestItCreatesModuleAccountOnInitBlock(t *testing.T) { tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1}) tApp.InitializeFromGenesisStates() accKeeper := tApp.GetAccountKeeper() diff --git a/x/community/testutil/cdp_genesis.go b/x/community/testutil/cdp_genesis.go index 3b4ef80dcf..4460d2660e 100644 --- a/x/community/testutil/cdp_genesis.go +++ b/x/community/testutil/cdp_genesis.go @@ -1,6 +1,7 @@ package testutil import ( + sdkmath "cosmossdk.io/math" "time" "github.com/cosmos/cosmos-sdk/codec" @@ -10,7 +11,7 @@ import ( cdptypes "github.com/kava-labs/kava/x/cdp/types" ) -func NewCDPGenState(cdc codec.JSONCodec, denom, asset string, liquidationRatio sdk.Dec) app.GenesisState { +func NewCDPGenState(cdc codec.JSONCodec, denom, asset string, liquidationRatio sdkmath.LegacyDec) app.GenesisState { cdpGenesis := cdptypes.GenesisState{ Params: cdptypes.Params{ GlobalDebtLimit: sdk.NewInt64Coin("usdx", 1000000000000), @@ -25,21 +26,21 @@ func NewCDPGenState(cdc codec.JSONCodec, denom, asset string, liquidationRatio s Type: asset + "-a", LiquidationRatio: liquidationRatio, DebtLimit: sdk.NewInt64Coin("usdx", 1000000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), // %5 apr - LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), - AuctionSize: sdk.NewInt(100), + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"), // %5 apr + LiquidationPenalty: sdkmath.LegacyMustNewDecFromStr("0.05"), + AuctionSize: sdkmath.NewInt(100), SpotMarketID: asset + ":usd", LiquidationMarketID: asset + ":usd", - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), - CheckCollateralizationIndexCount: sdk.NewInt(10), - ConversionFactor: sdk.NewInt(6), + KeeperRewardPercentage: sdkmath.LegacyMustNewDecFromStr("0.01"), + CheckCollateralizationIndexCount: sdkmath.NewInt(10), + ConversionFactor: sdkmath.NewInt(6), }, }, DebtParam: cdptypes.DebtParam{ Denom: "usdx", ReferenceAsset: "usd", - ConversionFactor: sdk.NewInt(6), - DebtFloor: sdk.NewInt(10000000), + ConversionFactor: sdkmath.NewInt(6), + DebtFloor: sdkmath.NewInt(10000000), }, }, StartingCdpID: cdptypes.DefaultCdpStartingID, @@ -47,10 +48,10 @@ func NewCDPGenState(cdc codec.JSONCodec, denom, asset string, liquidationRatio s GovDenom: cdptypes.DefaultGovDenom, CDPs: cdptypes.CDPs{}, PreviousAccumulationTimes: cdptypes.GenesisAccumulationTimes{ - cdptypes.NewGenesisAccumulationTime(asset+"-a", time.Time{}, sdk.OneDec()), + cdptypes.NewGenesisAccumulationTime(asset+"-a", time.Time{}, sdkmath.LegacyOneDec()), }, TotalPrincipals: cdptypes.GenesisTotalPrincipals{ - cdptypes.NewGenesisTotalPrincipal(asset+"-a", sdk.ZeroInt()), + cdptypes.NewGenesisTotalPrincipal(asset+"-a", sdkmath.ZeroInt()), }, } return app.GenesisState{cdptypes.ModuleName: cdc.MustMarshalJSON(&cdpGenesis)} diff --git a/x/community/testutil/consolidate.go b/x/community/testutil/consolidate.go index 51ec6a5f6d..7707c80c9c 100644 --- a/x/community/testutil/consolidate.go +++ b/x/community/testutil/consolidate.go @@ -1,6 +1,7 @@ package testutil import ( + sdkmath "cosmossdk.io/math" "time" sdk "github.com/cosmos/cosmos-sdk/types" @@ -21,8 +22,8 @@ func (suite *disableInflationTestSuite) TestStartCommunityFundConsolidation() { { "basic test with both balances and dust", sdk.NewDecCoins( - sdk.NewDecCoinFromDec("ukava", sdk.NewDecWithPrec(123456, 2)), - sdk.NewDecCoinFromDec("usdx", sdk.NewDecWithPrec(654321, 3)), + sdk.NewDecCoinFromDec("ukava", sdkmath.LegacyNewDecWithPrec(123456, 2)), + sdk.NewDecCoinFromDec("usdx", sdkmath.LegacyNewDecWithPrec(654321, 3)), ), sdk.NewCoins( sdk.NewInt64Coin("ukava", 10_000), @@ -40,8 +41,8 @@ func (suite *disableInflationTestSuite) TestStartCommunityFundConsolidation() { { "empty x/kavadist balance", sdk.NewDecCoins( - sdk.NewDecCoinFromDec("ukava", sdk.NewDecWithPrec(123456, 2)), - sdk.NewDecCoinFromDec("usdx", sdk.NewDecWithPrec(654321, 3)), + sdk.NewDecCoinFromDec("ukava", sdkmath.LegacyNewDecWithPrec(123456, 2)), + sdk.NewDecCoinFromDec("usdx", sdkmath.LegacyNewDecWithPrec(654321, 3)), ), sdk.Coins{}, }, diff --git a/x/community/testutil/disable_inflation.go b/x/community/testutil/disable_inflation.go index 4d37cc7359..6a99c1273f 100644 --- a/x/community/testutil/disable_inflation.go +++ b/x/community/testutil/disable_inflation.go @@ -46,13 +46,13 @@ func (suite *disableInflationTestSuite) SetupTest() { app.SetSDKConfig() tApp := app.NewTestApp() suite.App = tApp - suite.Ctx = suite.App.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + suite.Ctx = suite.App.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) suite.Keeper = suite.App.GetCommunityKeeper() // Set up x/mint and x/kavadist gen state mintGen := minttypes.DefaultGenesisState() - mintGen.Params.InflationMax = sdk.NewDecWithPrec(595, 3) - mintGen.Params.InflationMin = sdk.NewDecWithPrec(595, 3) + mintGen.Params.InflationMax = sdkmath.LegacyNewDecWithPrec(595, 3) + mintGen.Params.InflationMin = sdkmath.LegacyNewDecWithPrec(595, 3) suite.genesisMintState = mintGen kavadistGen := kavadisttypes.DefaultGenesisState() @@ -60,7 +60,7 @@ func (suite *disableInflationTestSuite) SetupTest() { suite.genesisKavadistState = kavadistGen distrGen := distrtypes.DefaultGenesisState() - distrGen.Params.CommunityTax = sdk.MustNewDecFromStr("0.949500000000000000") + distrGen.Params.CommunityTax = sdkmath.LegacyMustNewDecFromStr("0.949500000000000000") suite.genesisDistrState = distrGen appCodec := tApp.AppCodec() @@ -97,12 +97,12 @@ func (suite *disableInflationTestSuite) TestDisableInflation() { disableTimeMsg = "expected inflation disable time to be reset" expectedStakingRewards = setStakingRewards - expectedMintState.Params.InflationMin = sdk.ZeroDec() - expectedMintState.Params.InflationMax = sdk.ZeroDec() + expectedMintState.Params.InflationMin = sdkmath.LegacyZeroDec() + expectedMintState.Params.InflationMax = sdkmath.LegacyZeroDec() expectedKavadistState.Params.Active = false - expectedDistrState.Params.CommunityTax = sdk.ZeroDec() + expectedDistrState.Params.CommunityTax = sdkmath.LegacyZeroDec() msgSuffix = "after upgrade" diff --git a/x/community/testutil/main.go b/x/community/testutil/main.go index 1016b68e8e..2c0b142d61 100644 --- a/x/community/testutil/main.go +++ b/x/community/testutil/main.go @@ -26,7 +26,7 @@ type Suite struct { func (suite *Suite) SetupTest() { app.SetSDKConfig() tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) suite.App = tApp.InitializeFromGenesisStates() diff --git a/x/community/testutil/pricefeed_genesis_builder.go b/x/community/testutil/pricefeed_genesis_builder.go index e0a2e37c6f..bb23ad9666 100644 --- a/x/community/testutil/pricefeed_genesis_builder.go +++ b/x/community/testutil/pricefeed_genesis_builder.go @@ -30,17 +30,17 @@ func (b lendGenesisBuilder) Build() (hardtypes.GenesisState, pricefeedtypes.Gene return hardGS, pricefeedGS } -func (b lendGenesisBuilder) WithMarket(denom, spotMarketId string, price sdk.Dec) lendGenesisBuilder { +func (b lendGenesisBuilder) WithMarket(denom, spotMarketId string, price sdkmath.LegacyDec) lendGenesisBuilder { // add hard money market b.hardMarkets = append(b.hardMarkets, hardtypes.NewMoneyMarket( denom, - hardtypes.NewBorrowLimit(false, sdk.NewDec(1e15), sdk.MustNewDecFromStr("0.6")), + hardtypes.NewBorrowLimit(false, sdkmath.LegacyNewDec(1e15), sdkmath.LegacyMustNewDecFromStr("0.6")), spotMarketId, sdkmath.NewInt(1e6), - hardtypes.NewInterestRateModel(sdk.MustNewDecFromStr("0.05"), sdk.MustNewDecFromStr("2"), sdk.MustNewDecFromStr("0.8"), sdk.MustNewDecFromStr("10")), - sdk.MustNewDecFromStr("0.05"), - sdk.ZeroDec(), + hardtypes.NewInterestRateModel(sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyMustNewDecFromStr("2"), sdkmath.LegacyMustNewDecFromStr("0.8"), sdkmath.LegacyMustNewDecFromStr("10")), + sdkmath.LegacyMustNewDecFromStr("0.05"), + sdkmath.LegacyZeroDec(), ), ) diff --git a/x/community/testutil/staking_rewards.go b/x/community/testutil/staking_rewards.go index dbecab2c48..4e4e6c25d3 100644 --- a/x/community/testutil/staking_rewards.go +++ b/x/community/testutil/staking_rewards.go @@ -239,7 +239,7 @@ func (suite *stakingRewardsTestSuite) TestStakingRewards() { // initial context at height 1 height := int64(1) blockTime := tc.periodStart - ctx := suite.App.NewContext(true, tmproto.Header{Height: height, Time: blockTime}) + ctx := suite.App.NewContextLegacy(true, tmproto.Header{Height: height, Time: blockTime}) // ensure community pool balance matches the test expectations poolAcc := accountKeeper.GetModuleAccount(ctx, types.ModuleName) @@ -283,7 +283,7 @@ func (suite *stakingRewardsTestSuite) TestStakingRewards() { if blockTime.After(tc.periodEnd) { blockTime = tc.periodEnd } - ctx = suite.App.NewContext(true, tmproto.Header{Height: height, Time: blockTime}) + ctx = suite.App.NewContextLegacy(true, tmproto.Header{Height: height, Time: blockTime}) } endingFeeCollectorBalance := bankKeeper.GetBalance(ctx, feeCollectorAcc.GetAddress(), "ukava").Amount @@ -323,7 +323,7 @@ func (suite *stakingRewardsTestSuite) TestStakingRewardsDoNotAccumulateWhenPoolI // first block blockTime := time.Now() - ctx := app.NewContext(true, tmproto.Header{Height: 1, Time: blockTime}) + ctx := app.NewContextLegacy(true, tmproto.Header{Height: 1, Time: blockTime}) poolAcc := accountKeeper.GetModuleAccount(ctx, types.ModuleName) feeCollectorAcc := accountKeeper.GetModuleAccount(ctx, authtypes.FeeCollectorName) @@ -345,17 +345,17 @@ func (suite *stakingRewardsTestSuite) TestStakingRewardsDoNotAccumulateWhenPoolI // run second block 10 seconds in future and spend all community pool rewards blockTime = blockTime.Add(10 * time.Second) - ctx = app.NewContext(true, tmproto.Header{Height: 2, Time: blockTime}) + ctx = app.NewContextLegacy(true, tmproto.Header{Height: 2, Time: blockTime}) community.BeginBlocker(ctx, keeper) // run third block 10 seconds in future which no rewards will be paid blockTime = blockTime.Add(10 * time.Second) - ctx = app.NewContext(true, tmproto.Header{Height: 3, Time: blockTime}) + ctx = app.NewContextLegacy(true, tmproto.Header{Height: 3, Time: blockTime}) community.BeginBlocker(ctx, keeper) // run fourth block 10 seconds in future which no rewards will be paid blockTime = blockTime.Add(10 * time.Second) - ctx = app.NewContext(true, tmproto.Header{Height: 4, Time: blockTime}) + ctx = app.NewContextLegacy(true, tmproto.Header{Height: 4, Time: blockTime}) community.BeginBlocker(ctx, keeper) // refund the community pool with 100 KAVA -- plenty of funds @@ -363,7 +363,7 @@ func (suite *stakingRewardsTestSuite) TestStakingRewardsDoNotAccumulateWhenPoolI // run fifth block 10 seconds in future which no rewards will be paid blockTime = blockTime.Add(10 * time.Second) - ctx = app.NewContext(true, tmproto.Header{Height: 5, Time: blockTime}) + ctx = app.NewContextLegacy(true, tmproto.Header{Height: 5, Time: blockTime}) community.BeginBlocker(ctx, keeper) // assert that only 20 total KAVA has been distributed in rewards @@ -375,7 +375,7 @@ func (suite *stakingRewardsTestSuite) TestStakingRewardsDoNotAccumulateWhenPoolI func (suite *stakingRewardsTestSuite) TestPanicsOnMissingParameters() { suite.SetupTest() - ctx := suite.App.NewContext(true, tmproto.Header{Height: 1, Time: time.Now()}) + ctx := suite.App.NewContextLegacy(true, tmproto.Header{Height: 1, Time: time.Now()}) store := ctx.KVStore(suite.App.GetKVStoreKey(types.StoreKey)) store.Delete(types.ParamsKey) diff --git a/x/community/types/codec.go b/x/community/types/codec.go index 9c20c18fa1..e1cd9a9277 100644 --- a/x/community/types/codec.go +++ b/x/community/types/codec.go @@ -7,7 +7,6 @@ import ( cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" - authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec" govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) @@ -50,5 +49,6 @@ func init() { // Register all Amino interfaces and concrete types on the authz Amino codec so that this can later be // used to properly serialize MsgGrant and MsgExec instances - RegisterLegacyAminoCodec(authzcodec.Amino) + // TODO(boodyvo): identify how to get authz Amino codec + RegisterLegacyAminoCodec(codec.NewLegacyAmino()) } diff --git a/x/community/types/expected_keepers.go b/x/community/types/expected_keepers.go index 468b4efc0d..b253fa7f49 100644 --- a/x/community/types/expected_keepers.go +++ b/x/community/types/expected_keepers.go @@ -1,9 +1,9 @@ package types import ( + "context" sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" kavadisttypes "github.com/kava-labs/kava/x/kavadist/types" @@ -11,26 +11,26 @@ import ( // AccountKeeper defines the contract required for account APIs. type AccountKeeper interface { - GetModuleAccount(ctx sdk.Context, moduleName string) authtypes.ModuleAccountI + GetModuleAccount(ctx context.Context, moduleName string) sdk.ModuleAccountI GetModuleAddress(name string) sdk.AccAddress } // BankKeeper defines the contract needed to be fulfilled for banking dependencies. type BankKeeper interface { - GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin - GetAllBalances(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins + GetBalance(ctx context.Context, addr sdk.AccAddress, denom string) sdk.Coin + GetAllBalances(ctx context.Context, addr sdk.AccAddress) sdk.Coins - SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error - SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error - SendCoinsFromModuleToModule(ctx sdk.Context, senderModule, recipientModule string, amt sdk.Coins) error + SendCoinsFromAccountToModule(ctx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error + SendCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error + SendCoinsFromModuleToModule(ctx context.Context, senderModule, recipientModule string, amt sdk.Coins) error - GetSupply(ctx sdk.Context, denom string) sdk.Coin + GetSupply(ctx context.Context, denom string) sdk.Coin } // CdpKeeper defines the contract needed to be fulfilled for cdp dependencies. type CdpKeeper interface { - RepayPrincipal(ctx sdk.Context, owner sdk.AccAddress, collateralType string, payment sdk.Coin) error - WithdrawCollateral(ctx sdk.Context, owner, depositor sdk.AccAddress, collateral sdk.Coin, collateralType string) error + RepayPrincipal(ctx context.Context, owner sdk.AccAddress, collateralType string, payment sdk.Coin) error + WithdrawCollateral(ctx context.Context, owner, depositor sdk.AccAddress, collateral sdk.Coin, collateralType string) error } // HardKeeper defines the contract needed to be fulfilled for Kava Lend dependencies. @@ -41,20 +41,23 @@ type HardKeeper interface { // DistributionKeeper defines the contract needed to be fulfilled for distribution dependencies. type DistributionKeeper interface { - DistributeFromFeePool(ctx sdk.Context, amount sdk.Coins, receiveAddr sdk.AccAddress) error - FundCommunityPool(ctx sdk.Context, amount sdk.Coins, sender sdk.AccAddress) error - GetFeePoolCommunityCoins(ctx sdk.Context) sdk.DecCoins - GetFeePool(ctx sdk.Context) distrtypes.FeePool - SetFeePool(ctx sdk.Context, feePool distrtypes.FeePool) - GetParams(ctx sdk.Context) distrtypes.Params - SetParams(ctx sdk.Context, params distrtypes.Params) error - GetCommunityTax(ctx sdk.Context) sdk.Dec + DistributeFromFeePool(ctx context.Context, amount sdk.Coins, receiveAddr sdk.AccAddress) error + FundCommunityPool(ctx context.Context, amount sdk.Coins, sender sdk.AccAddress) error + GetFeePoolCommunityCoins(ctx context.Context) sdk.DecCoins + GetFeePool(ctx context.Context) distrtypes.FeePool + SetFeePool(ctx context.Context, feePool distrtypes.FeePool) + GetParams(ctx context.Context) distrtypes.Params + SetParams(ctx context.Context, params distrtypes.Params) error + GetCommunityTax(ctx context.Context) (sdkmath.LegacyDec, error) } +// need the method: GetParams(ctx context.Context) distrtypes.Params +// have the method: GetParams(clientCtx sdk.Context) (params types.Params) + type MintKeeper interface { - GetParams(ctx sdk.Context) (params minttypes.Params) - SetParams(ctx sdk.Context, params minttypes.Params) error - GetMinter(ctx sdk.Context) (minter minttypes.Minter) + GetParams(ctx context.Context) (params minttypes.Params) + SetParams(ctx context.Context, params minttypes.Params) error + GetMinter(ctx context.Context) (minter minttypes.Minter) } type KavadistKeeper interface { @@ -64,6 +67,6 @@ type KavadistKeeper interface { // StakingKeeper expected interface for the staking keeper type StakingKeeper interface { - BondDenom(ctx sdk.Context) string - TotalBondedTokens(ctx sdk.Context) sdkmath.Int + BondDenom(ctx context.Context) (string, error) + TotalBondedTokens(ctx context.Context) (sdkmath.Int, error) } diff --git a/x/community/types/msg.go b/x/community/types/msg.go index ff04fb6a37..411d1fcecd 100644 --- a/x/community/types/msg.go +++ b/x/community/types/msg.go @@ -2,9 +2,16 @@ package types import ( errorsmod "cosmossdk.io/errors" + txsigning "cosmossdk.io/x/tx/signing" + "fmt" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" + protov1 "github.com/golang/protobuf/proto" + protov2 "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/protoadapt" + "google.golang.org/protobuf/reflect/protoreflect" ) // ensure Msg interface compliance at compile time @@ -15,6 +22,17 @@ var ( _ legacytx.LegacyMsg = &MsgUpdateParams{} ) +var ( + MsgFundCommunityPoolGetSigners = txsigning.CustomGetSigner{ + MsgType: protoreflect.FullName(protov1.MessageName(&MsgFundCommunityPool{})), + Fn: GetSignersMsgFundCommunityPool, + } + MsgUpdateParamsSigners = txsigning.CustomGetSigner{ + MsgType: protoreflect.FullName(protov1.MessageName(&MsgUpdateParams{})), + Fn: GetSignersMsgUpdateParams, + } +) + // NewMsgFundCommunityPool returns a new MsgFundCommunityPool func NewMsgFundCommunityPool(depositor sdk.AccAddress, amount sdk.Coins) MsgFundCommunityPool { return MsgFundCommunityPool{ @@ -58,6 +76,28 @@ func (msg MsgFundCommunityPool) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{depositor} } +func GetSignersMsgFundCommunityPool(msg protov2.Message) ([][]byte, error) { + msgV1 := protoadapt.MessageV1Of(msg) + + tryingTypeAnyV1, err := codectypes.NewAnyWithValue(msgV1) + if err != nil { + return nil, err + } + + msgTyped := &MsgFundCommunityPool{} + err = msgTyped.Unmarshal(tryingTypeAnyV1.Value) + if err != nil { + return nil, err + } + + depositor, err := sdk.AccAddressFromBech32(msgTyped.Depositor) + if err != nil { + return nil, err + } + + return [][]byte{depositor}, nil +} + // NewMsgUpdateParams returns a new MsgUpdateParams func NewMsgUpdateParams(authority sdk.AccAddress, params Params) MsgUpdateParams { return MsgUpdateParams{ @@ -74,7 +114,9 @@ func (msg MsgUpdateParams) Type() string { return sdk.MsgTypeURL(&msg) } // ValidateBasic does a simple validation check that doesn't require access to any other information. func (msg MsgUpdateParams) ValidateBasic() error { + fmt.Println("MsgUpdateParams.ValidateBasic") _, err := sdk.AccAddressFromBech32(msg.Authority) + fmt.Println("MsgUpdateParams.ValidateBasic err", err) if err != nil { return errorsmod.Wrap(sdkerrors.ErrInvalidAddress, err.Error()) } @@ -83,6 +125,8 @@ func (msg MsgUpdateParams) ValidateBasic() error { return errorsmod.Wrap(ErrInvalidParams, err.Error()) } + fmt.Println("MsgUpdateParams.ValidateBasic is ok") + return nil } @@ -100,3 +144,25 @@ func (msg MsgUpdateParams) GetSigners() []sdk.AccAddress { } return []sdk.AccAddress{depositor} } + +func GetSignersMsgUpdateParams(msg protov2.Message) ([][]byte, error) { + msgV1 := protoadapt.MessageV1Of(msg) + + tryingTypeAnyV1, err := codectypes.NewAnyWithValue(msgV1) + if err != nil { + return nil, err + } + + msgTyped := &MsgUpdateParams{} + err = msgTyped.Unmarshal(tryingTypeAnyV1.Value) + if err != nil { + return nil, err + } + + depositor, err := sdk.AccAddressFromBech32(msgTyped.Authority) + if err != nil { + return nil, err + } + + return [][]byte{depositor}, nil +} diff --git a/x/community/types/msg_test.go b/x/community/types/msg_test.go index 5629e40fe3..3e4f25ba85 100644 --- a/x/community/types/msg_test.go +++ b/x/community/types/msg_test.go @@ -57,7 +57,7 @@ func TestFundCommunityPool_ValidateBasic(t *testing.T) { message: types.MsgFundCommunityPool{ Depositor: app.RandomAddress().String(), Amount: sdk.NewCoins( - sdk.NewCoin("ukava", sdk.ZeroInt()), + sdk.NewCoin("ukava", sdkmath.ZeroInt()), ), }, }, diff --git a/x/community/types/params.go b/x/community/types/params.go index f6fd1aef1b..02874d18d9 100644 --- a/x/community/types/params.go +++ b/x/community/types/params.go @@ -39,6 +39,8 @@ func DefaultParams() Params { // Validate checks the params are valid func (p Params) Validate() error { + fmt.Println("Params.Validate stakingRewardsPerSecond", p.StakingRewardsPerSecond) + fmt.Println("Params.Validate UpgradeTimeSetStakingRewardsPerSecond", p.UpgradeTimeSetStakingRewardsPerSecond) // p.UpgradeTimeDisableInflation.IsZero() is a valid state. It's taken to mean inflation will be disabled on the block 1. if err := validateDecNotNilNonNegative(p.StakingRewardsPerSecond, "StakingRewardsPerSecond"); err != nil { diff --git a/x/community/types/proposal.go b/x/community/types/proposal.go index ba8471da16..3cdf9d3c61 100644 --- a/x/community/types/proposal.go +++ b/x/community/types/proposal.go @@ -8,7 +8,6 @@ import ( errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - govcodec "github.com/cosmos/cosmos-sdk/x/gov/codec" govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) @@ -32,14 +31,15 @@ var ( ) func init() { + // TODO(boodyvo): the moduleCdc was removed, looks like need an updated (depinjection ?) govv1beta1.RegisterProposalType(ProposalTypeCommunityPoolLendDeposit) - govcodec.ModuleCdc.Amino.RegisterConcrete(&CommunityPoolLendDepositProposal{}, "kava/CommunityPoolLendDepositProposal", nil) + //govcodec.ModuleCdc.Amino.RegisterConcrete(&CommunityPoolLendDepositProposal{}, "kava/CommunityPoolLendDepositProposal", nil) govv1beta1.RegisterProposalType(ProposalTypeCommunityPoolLendWithdraw) - govcodec.ModuleCdc.Amino.RegisterConcrete(&CommunityPoolLendWithdrawProposal{}, "kava/CommunityPoolLendWithdrawProposal", nil) + //govcodec.ModuleCdc.Amino.RegisterConcrete(&CommunityPoolLendWithdrawProposal{}, "kava/CommunityPoolLendWithdrawProposal", nil) govv1beta1.RegisterProposalType(ProposalTypeCommunityCDPRepayDebt) - govcodec.ModuleCdc.Amino.RegisterConcrete(&CommunityCDPRepayDebtProposal{}, "kava/CommunityCDPRepayDebtProposal", nil) + //govcodec.ModuleCdc.Amino.RegisterConcrete(&CommunityCDPRepayDebtProposal{}, "kava/CommunityCDPRepayDebtProposal", nil) govv1beta1.RegisterProposalType(ProposalTypeCommunityCDPWithdrawCollateral) - govcodec.ModuleCdc.Amino.RegisterConcrete(&CommunityCDPWithdrawCollateralProposal{}, "kava/CommunityCDPWithdrawCollateralProposal", nil) + //govcodec.ModuleCdc.Amino.RegisterConcrete(&CommunityCDPWithdrawCollateralProposal{}, "kava/CommunityCDPWithdrawCollateralProposal", nil) } ////////////////// diff --git a/x/community/types/proposal_test.go b/x/community/types/proposal_test.go index 384fcf5328..08de208038 100644 --- a/x/community/types/proposal_test.go +++ b/x/community/types/proposal_test.go @@ -1,6 +1,7 @@ package types_test import ( + sdkmath "cosmossdk.io/math" "testing" sdk "github.com/cosmos/cosmos-sdk/types" @@ -60,7 +61,7 @@ func TestLendProposals_ValidateBasic(t *testing.T) { proposal: proposalData{ Title: "Error profoundly", Description: "My coins are zero", - Amount: sdk.NewCoins(sdk.NewCoin("ukava", sdk.ZeroInt())), + Amount: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.ZeroInt())), }, expectedErr: "invalid coins", }, diff --git a/x/community/types/query.pb.go b/x/community/types/query.pb.go index c1451fd4e1..24b4cdc27c 100644 --- a/x/community/types/query.pb.go +++ b/x/community/types/query.pb.go @@ -590,6 +590,7 @@ func _Query_AnnualizedRewards_Handler(srv interface{}, ctx context.Context, dec return interceptor(ctx, in, info, handler) } +var Query_serviceDesc = _Query_serviceDesc var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "kava.community.v1beta1.Query", HandlerType: (*QueryServer)(nil), diff --git a/x/community/types/tx.pb.go b/x/community/types/tx.pb.go index 96e553330d..806fba66e4 100644 --- a/x/community/types/tx.pb.go +++ b/x/community/types/tx.pb.go @@ -431,6 +431,7 @@ func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(in return interceptor(ctx, in, info, handler) } +var Msg_serviceDesc = _Msg_serviceDesc var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "kava.community.v1beta1.Msg", HandlerType: (*MsgServer)(nil), diff --git a/x/earn/client/cli/tx.go b/x/earn/client/cli/tx.go index 2ab9e45d12..5a0b0e8c11 100644 --- a/x/earn/client/cli/tx.go +++ b/x/earn/client/cli/tx.go @@ -2,10 +2,12 @@ package cli import ( "fmt" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" "strings" "github.com/spf13/cobra" + "cosmossdk.io/errors" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/tx" @@ -159,7 +161,15 @@ Where proposal.json contains: if err != nil { return err } - if err := msg.ValidateBasic(); err != nil { + + contentProposal := msg.GetContent() + if contentProposal == nil { + return errors.Wrap(govtypes.ErrInvalidProposalContent, "missing content") + } + if !govv1beta1.IsValidProposalType(contentProposal.ProposalType()) { + return errors.Wrap(govtypes.ErrInvalidProposalType, contentProposal.ProposalType()) + } + if err := contentProposal.ValidateBasic(); err != nil { return err } @@ -217,7 +227,15 @@ Where proposal.json contains: if err != nil { return err } - if err := msg.ValidateBasic(); err != nil { + + contentProposal := msg.GetContent() + if contentProposal == nil { + return errors.Wrap(govtypes.ErrInvalidProposalContent, "missing content") + } + if !govv1beta1.IsValidProposalType(contentProposal.ProposalType()) { + return errors.Wrap(govtypes.ErrInvalidProposalType, contentProposal.ProposalType()) + } + if err := contentProposal.ValidateBasic(); err != nil { return err } diff --git a/x/earn/genesis_test.go b/x/earn/genesis_test.go index 2d982a6d46..3072787502 100644 --- a/x/earn/genesis_test.go +++ b/x/earn/genesis_test.go @@ -1,6 +1,7 @@ package earn_test import ( + sdkmath "cosmossdk.io/math" "testing" "github.com/kava-labs/kava/app" @@ -30,7 +31,7 @@ func (suite *genesisTestSuite) Test_InitGenesis_ValidationPanic() { types.VaultRecords{ { TotalShares: types.VaultShare{ - Denom: "", Amount: sdk.NewDec(1), + Denom: "", Amount: sdkmath.LegacyNewDec(1), }, }, }, @@ -68,25 +69,25 @@ func (suite *genesisTestSuite) Test_InitAndExportGenesis() { }, types.VaultRecords{ types.VaultRecord{ - TotalShares: types.NewVaultShare("ukava", sdk.NewDec(3800000)), + TotalShares: types.NewVaultShare("ukava", sdkmath.LegacyNewDec(3800000)), }, types.VaultRecord{ - TotalShares: types.NewVaultShare("usdx", sdk.NewDec(1000000)), + TotalShares: types.NewVaultShare("usdx", sdkmath.LegacyNewDec(1000000)), }, }, types.VaultShareRecords{ types.VaultShareRecord{ Depositor: depositor_1, Shares: types.NewVaultShares( - types.NewVaultShare("usdx", sdk.NewDec(500000)), - types.NewVaultShare("ukava", sdk.NewDec(1900000)), + types.NewVaultShare("usdx", sdkmath.LegacyNewDec(500000)), + types.NewVaultShare("ukava", sdkmath.LegacyNewDec(1900000)), ), }, types.VaultShareRecord{ Depositor: depositor_2, Shares: types.NewVaultShares( - types.NewVaultShare("usdx", sdk.NewDec(500000)), - types.NewVaultShare("ukava", sdk.NewDec(1900000)), + types.NewVaultShare("usdx", sdkmath.LegacyNewDec(500000)), + types.NewVaultShare("ukava", sdkmath.LegacyNewDec(1900000)), ), }, }, @@ -136,25 +137,25 @@ func (suite *genesisTestSuite) Test_Marshall() { }, types.VaultRecords{ types.VaultRecord{ - TotalShares: types.NewVaultShare("ukava", sdk.NewDec(3800000)), + TotalShares: types.NewVaultShare("ukava", sdkmath.LegacyNewDec(3800000)), }, types.VaultRecord{ - TotalShares: types.NewVaultShare("usdx", sdk.NewDec(1000000)), + TotalShares: types.NewVaultShare("usdx", sdkmath.LegacyNewDec(1000000)), }, }, types.VaultShareRecords{ types.VaultShareRecord{ Depositor: depositor_1, Shares: types.NewVaultShares( - types.NewVaultShare("usdx", sdk.NewDec(500000)), - types.NewVaultShare("ukava", sdk.NewDec(1900000)), + types.NewVaultShare("usdx", sdkmath.LegacyNewDec(500000)), + types.NewVaultShare("ukava", sdkmath.LegacyNewDec(1900000)), ), }, types.VaultShareRecord{ Depositor: depositor_2, Shares: types.NewVaultShares( - types.NewVaultShare("usdx", sdk.NewDec(500000)), - types.NewVaultShare("ukava", sdk.NewDec(1900000)), + types.NewVaultShare("usdx", sdkmath.LegacyNewDec(500000)), + types.NewVaultShare("ukava", sdkmath.LegacyNewDec(1900000)), ), }, }, diff --git a/x/earn/keeper/deposit.go b/x/earn/keeper/deposit.go index 5598e5c1fa..cbd777a841 100644 --- a/x/earn/keeper/deposit.go +++ b/x/earn/keeper/deposit.go @@ -1,6 +1,7 @@ package keeper import ( + sdkmath "cosmossdk.io/math" "fmt" sdk "github.com/cosmos/cosmos-sdk/types" @@ -41,7 +42,7 @@ func (k *Keeper) Deposit( vaultRecord, found := k.GetVaultRecord(ctx, amount.Denom) if !found { // Create a new VaultRecord with 0 supply - vaultRecord = types.NewVaultRecord(amount.Denom, sdk.ZeroDec()) + vaultRecord = types.NewVaultRecord(amount.Denom, sdkmath.LegacyZeroDec()) } // Get the strategy for the vault diff --git a/x/earn/keeper/deposit_test.go b/x/earn/keeper/deposit_test.go index 806d1b1773..3ec4bdfb8b 100644 --- a/x/earn/keeper/deposit_test.go +++ b/x/earn/keeper/deposit_test.go @@ -1,6 +1,7 @@ package keeper_test import ( + sdkmath "cosmossdk.io/math" "os" "testing" @@ -52,7 +53,7 @@ func (suite *depositTestSuite) TestDeposit_Balances() { suite.VaultTotalValuesEqual(sdk.NewCoins(depositAmount)) suite.VaultTotalSharesEqual(types.NewVaultShares( - types.NewVaultShare(depositAmount.Denom, sdk.NewDecFromInt(depositAmount.Amount)), + types.NewVaultShare(depositAmount.Denom, sdkmath.LegacyNewDecFromInt(depositAmount.Amount)), )) } diff --git a/x/earn/keeper/grpc_query.go b/x/earn/keeper/grpc_query.go index b3175c9be7..df2c04821c 100644 --- a/x/earn/keeper/grpc_query.go +++ b/x/earn/keeper/grpc_query.go @@ -2,6 +2,7 @@ package keeper import ( "context" + sdkmath "cosmossdk.io/math" "fmt" "strings" @@ -122,8 +123,8 @@ func (s queryServer) Vaults( IsPrivateVault: allowedVault.IsPrivateVault, AllowedDepositors: addressSliceToStringSlice(allowedVault.AllowedDepositors), // No shares, no value - TotalShares: sdk.ZeroDec().String(), - TotalValue: sdk.ZeroInt(), + TotalShares: sdkmath.LegacyZeroDec().String(), + TotalValue: sdkmath.ZeroInt(), }) } @@ -164,7 +165,7 @@ func (s queryServer) Vault( vaultRecord, found := s.keeper.GetVaultRecord(sdkCtx, req.Denom) if !found { // No supply yet, no error just set it to zero - vaultRecord.TotalShares = types.NewVaultShare(req.Denom, sdk.ZeroDec()) + vaultRecord.TotalShares = types.NewVaultShare(req.Denom, sdkmath.LegacyZeroDec()) } totalValue, err := s.keeper.GetVaultTotalValue(sdkCtx, req.Denom) @@ -354,8 +355,8 @@ func (s queryServer) getOneAccountOneVaultDeposit( { Depositor: depositor.String(), // Zero shares and zero value for no deposits - Shares: types.NewVaultShares(types.NewVaultShare(req.Denom, sdk.ZeroDec())), - Value: sdk.NewCoins(sdk.NewCoin(req.Denom, sdk.ZeroInt())), + Shares: types.NewVaultShares(types.NewVaultShare(req.Denom, sdkmath.LegacyZeroDec())), + Value: sdk.NewCoins(sdk.NewCoin(req.Denom, sdkmath.ZeroInt())), }, }, Pagination: nil, @@ -420,8 +421,8 @@ func (s queryServer) getOneAccountBkavaVaultDeposit( { Depositor: depositor.String(), // Zero shares and zero value for no deposits - Shares: types.NewVaultShares(types.NewVaultShare(req.Denom, sdk.ZeroDec())), - Value: sdk.NewCoins(sdk.NewCoin(req.Denom, sdk.ZeroInt())), + Shares: types.NewVaultShares(types.NewVaultShare(req.Denom, sdkmath.LegacyZeroDec())), + Value: sdk.NewCoins(sdk.NewCoin(req.Denom, sdkmath.ZeroInt())), }, }, Pagination: nil, diff --git a/x/earn/keeper/grpc_query_test.go b/x/earn/keeper/grpc_query_test.go index 2ba413c360..6791b9499b 100644 --- a/x/earn/keeper/grpc_query_test.go +++ b/x/earn/keeper/grpc_query_test.go @@ -9,7 +9,6 @@ import ( "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/staking" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/stretchr/testify/suite" @@ -79,7 +78,7 @@ func (suite *grpcQueryTestSuite) TestVaults_ZeroSupply() { Strategies: []types.StrategyType{types.STRATEGY_TYPE_HARD}, IsPrivateVault: false, AllowedDepositors: nil, - TotalShares: sdk.NewDec(0).String(), + TotalShares: sdkmath.LegacyNewDec(0).String(), TotalValue: sdkmath.NewInt(0), }, res.Vault, @@ -95,16 +94,16 @@ func (suite *grpcQueryTestSuite) TestVaults_ZeroSupply() { Strategies: []types.StrategyType{types.STRATEGY_TYPE_HARD}, IsPrivateVault: false, AllowedDepositors: nil, - TotalShares: sdk.ZeroDec().String(), - TotalValue: sdk.ZeroInt(), + TotalShares: sdkmath.LegacyZeroDec().String(), + TotalValue: sdkmath.ZeroInt(), }, { Denom: "busd", Strategies: []types.StrategyType{types.STRATEGY_TYPE_HARD}, IsPrivateVault: false, AllowedDepositors: nil, - TotalShares: sdk.ZeroDec().String(), - TotalValue: sdk.ZeroInt(), + TotalShares: sdkmath.LegacyZeroDec().String(), + TotalValue: sdkmath.ZeroInt(), }, }, res.Vaults, @@ -143,7 +142,7 @@ func (suite *grpcQueryTestSuite) TestVaults_WithSupply() { Strategies: []types.StrategyType{types.STRATEGY_TYPE_HARD}, IsPrivateVault: false, AllowedDepositors: nil, - TotalShares: sdk.NewDecFromInt(depositAmount.Amount).String(), + TotalShares: sdkmath.LegacyNewDecFromInt(depositAmount.Amount).String(), TotalValue: depositAmount.Amount, }, { @@ -151,7 +150,7 @@ func (suite *grpcQueryTestSuite) TestVaults_WithSupply() { Strategies: []types.StrategyType{types.STRATEGY_TYPE_SAVINGS}, IsPrivateVault: false, AllowedDepositors: nil, - TotalShares: sdk.NewDecFromInt(deposit2Amount.Amount).String(), + TotalShares: sdkmath.LegacyNewDecFromInt(deposit2Amount.Amount).String(), TotalValue: deposit2Amount.Amount, }, }, @@ -189,23 +188,23 @@ func (suite *grpcQueryTestSuite) TestVaults_MixedSupply() { Strategies: []types.StrategyType{types.STRATEGY_TYPE_HARD}, IsPrivateVault: false, AllowedDepositors: nil, - TotalShares: sdk.ZeroDec().String(), - TotalValue: sdk.ZeroInt(), + TotalShares: sdkmath.LegacyZeroDec().String(), + TotalValue: sdkmath.ZeroInt(), }, { Denom: vault2Denom, Strategies: []types.StrategyType{types.STRATEGY_TYPE_HARD}, IsPrivateVault: false, AllowedDepositors: nil, - TotalShares: sdk.ZeroDec().String(), - TotalValue: sdk.ZeroInt(), + TotalShares: sdkmath.LegacyZeroDec().String(), + TotalValue: sdkmath.ZeroInt(), }, { Denom: vault3Denom, Strategies: []types.StrategyType{types.STRATEGY_TYPE_SAVINGS}, IsPrivateVault: false, AllowedDepositors: nil, - TotalShares: sdk.NewDecFromInt(depositAmount.Amount).String(), + TotalShares: sdkmath.LegacyNewDecFromInt(depositAmount.Amount).String(), TotalValue: depositAmount.Amount, }, }, @@ -252,7 +251,8 @@ func (suite *grpcQueryTestSuite) TestDeposits() { suite.CreateDelegation(valAddr1, delegator, delegateAmount) suite.CreateDelegation(valAddr2, delegator, delegateAmount) - staking.EndBlocker(suite.Ctx, suite.App.GetStakingKeeper()) + _, err := suite.App.GetStakingKeeper().EndBlocker(suite.Ctx) + suite.Require().NoError(err) savingsParams := suite.SavingsKeeper.GetParams(suite.Ctx) savingsParams.SupportedDenoms = append(savingsParams.SupportedDenoms, "bkava") @@ -275,7 +275,7 @@ func (suite *grpcQueryTestSuite) TestDeposits() { // Deposit into each vault from each account - 4 total deposits // Acc 1: usdx + busd // Acc 2: usdx + bkava-1 + bkava-2 - err := suite.Keeper.Deposit(suite.Ctx, acc1, deposit1Amount, types.STRATEGY_TYPE_HARD) + err = suite.Keeper.Deposit(suite.Ctx, acc1, deposit1Amount, types.STRATEGY_TYPE_HARD) suite.Require().NoError(err) err = suite.Keeper.Deposit(suite.Ctx, acc1, deposit2Amount, types.STRATEGY_TYPE_HARD) suite.Require().NoError(err) @@ -301,7 +301,7 @@ func (suite *grpcQueryTestSuite) TestDeposits() { Depositor: acc1.String(), // Only includes specified deposit shares Shares: types.NewVaultShares( - types.NewVaultShare(deposit1Amount.Denom, sdk.NewDecFromInt(deposit1Amount.Amount)), + types.NewVaultShare(deposit1Amount.Denom, sdkmath.LegacyNewDecFromInt(deposit1Amount.Amount)), ), // Only the specified vault denom value Value: sdk.NewCoins(deposit1Amount), @@ -326,7 +326,7 @@ func (suite *grpcQueryTestSuite) TestDeposits() { Depositor: acc2.String(), // Only includes specified deposit shares Shares: types.NewVaultShares( - types.NewVaultShare(deposit3Amount.Denom, sdk.NewDecFromInt(deposit3Amount.Amount)), + types.NewVaultShare(deposit3Amount.Denom, sdkmath.LegacyNewDecFromInt(deposit3Amount.Amount)), ), // Only the specified vault denom value Value: sdk.NewCoins(deposit3Amount), @@ -350,7 +350,7 @@ func (suite *grpcQueryTestSuite) TestDeposits() { Depositor: acc2.String(), // Only includes specified deposit shares Shares: types.NewVaultShares( - types.NewVaultShare(deposit3Amount.Denom, sdk.NewDecFromInt(deposit3Amount.Amount)), + types.NewVaultShare(deposit3Amount.Denom, sdkmath.LegacyNewDecFromInt(deposit3Amount.Amount)), ), // Only the specified vault denom value Value: sdk.NewCoins( @@ -383,8 +383,8 @@ func (suite *grpcQueryTestSuite) TestDeposits() { { Depositor: acc1.String(), Shares: types.NewVaultShares( - types.NewVaultShare(deposit1Amount.Denom, sdk.NewDecFromInt(deposit1Amount.Amount)), - types.NewVaultShare(deposit2Amount.Denom, sdk.NewDecFromInt(deposit2Amount.Amount)), + types.NewVaultShare(deposit1Amount.Denom, sdkmath.LegacyNewDecFromInt(deposit1Amount.Amount)), + types.NewVaultShare(deposit2Amount.Denom, sdkmath.LegacyNewDecFromInt(deposit2Amount.Amount)), ), Value: sdk.NewCoins(deposit1Amount, deposit2Amount), }, @@ -406,8 +406,8 @@ func (suite *grpcQueryTestSuite) TestDeposits() { Depositor: acc2.String(), Shares: types.VaultShares{ // Does not include non-bkava vaults - types.NewVaultShare(deposit4Amount.Denom, sdk.NewDecFromInt(deposit4Amount.Amount)), - types.NewVaultShare(deposit3Amount.Denom, sdk.NewDecFromInt(deposit3Amount.Amount)), + types.NewVaultShare(deposit4Amount.Denom, sdkmath.LegacyNewDecFromInt(deposit4Amount.Amount)), + types.NewVaultShare(deposit3Amount.Denom, sdkmath.LegacyNewDecFromInt(deposit3Amount.Amount)), }, Value: sdk.Coins{ // Does not include non-bkava vaults @@ -420,7 +420,7 @@ func (suite *grpcQueryTestSuite) TestDeposits() { for i := range res.Deposits[0].Shares { suite.Equal( res.Deposits[0].Shares[i].Amount, - sdk.NewDecFromInt(res.Deposits[0].Value[i].Amount), + sdkmath.LegacyNewDecFromInt(res.Deposits[0].Value[i].Amount), "order of deposit value should match shares", ) } @@ -522,8 +522,9 @@ func (suite *grpcQueryTestSuite) TestDeposits_bKava() { // Slash the last validator to reduce the value of it's derivatives to test bkava to underlying token conversion. // First call end block to bond validator to enable slashing. - staking.EndBlocker(suite.Ctx, suite.App.GetStakingKeeper()) - err = suite.slashValidator(sdk.ValAddress(address2), sdk.MustNewDecFromStr("0.5")) + _, err = suite.App.GetStakingKeeper().EndBlocker(suite.Ctx) + suite.Require().NoError(err) + err = suite.slashValidator(sdk.ValAddress(address2), sdkmath.LegacyMustNewDecFromStr("0.5")) suite.Require().NoError(err) suite.Run("no deposits", func() { @@ -573,6 +574,8 @@ func (suite *grpcQueryTestSuite) TestDeposits_bKava() { // last validator slashed 50% so derivatives are worth half // Excludes non-bkava deposits expectedValue := derivatives1.Amount.Add(derivatives2.Amount.QuoRaw(2)) + bondDemon, err := suite.bondDenom() + suite.Require().NoError(err) suite.Require().ElementsMatchf( []types.DepositResponse{ { @@ -581,7 +584,7 @@ func (suite *grpcQueryTestSuite) TestDeposits_bKava() { Shares: nil, // Value returned in units of staked token Value: sdk.NewCoins( - sdk.NewCoin(suite.bondDenom(), expectedValue), + sdk.NewCoin(bondDemon, expectedValue), ), }, }, @@ -643,8 +646,9 @@ func (suite *grpcQueryTestSuite) TestVault_bKava_Aggregate() { address3, derivatives3, _ := suite.createAccountWithDerivatives(testutil.TestBkavaDenoms[2], sdkmath.NewInt(1e9)) // Slash the last validator to reduce the value of it's derivatives to test bkava to underlying token conversion. // First call end block to bond validator to enable slashing. - staking.EndBlocker(suite.Ctx, suite.App.GetStakingKeeper()) - err := suite.slashValidator(sdk.ValAddress(address3), sdk.MustNewDecFromStr("0.5")) + _, err := suite.App.GetStakingKeeper().EndBlocker(suite.Ctx) + suite.Require().NoError(err) + err = suite.slashValidator(sdk.ValAddress(address3), sdkmath.LegacyMustNewDecFromStr("0.5")) suite.Require().NoError(err) // vault denom is only "bkava" which has it's own special handler @@ -795,9 +799,10 @@ func (suite *grpcQueryTestSuite) TestTotalSupply() { address2, derivatives2, _ := suite.createAccountWithDerivatives(testutil.TestBkavaDenoms[1], sdkmath.NewInt(1e9)) // bond validators - staking.EndBlocker(suite.Ctx, suite.App.GetStakingKeeper()) + _, err := suite.App.GetStakingKeeper().EndBlocker(suite.Ctx) + suite.Require().NoError(err) // slash val2 - its shares are now 80% as valuable! - err := suite.slashValidator(sdk.ValAddress(address2), sdk.MustNewDecFromStr("0.2")) + err = suite.slashValidator(sdk.ValAddress(address2), sdkmath.LegacyMustNewDecFromStr("0.2")) suite.Require().NoError(err) // create "bkava" vault. it holds all bkava denoms @@ -833,11 +838,12 @@ func (suite *grpcQueryTestSuite) TestTotalSupply() { // createUnbondedValidator creates an unbonded validator with the given amount of self-delegation. func (suite *grpcQueryTestSuite) createUnbondedValidator(address sdk.ValAddress, selfDelegation sdk.Coin, minSelfDelegation sdkmath.Int) error { msg, err := stakingtypes.NewMsgCreateValidator( - address, + //TODO(boodyvo): validate if correct + address.String(), ed25519.GenPrivKey().PubKey(), selfDelegation, - stakingtypes.Description{}, - stakingtypes.NewCommissionRates(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()), + stakingtypes.NewDescription("earn_moniker", "", "", "", ""), + stakingtypes.NewCommissionRates(sdkmath.LegacyZeroDec(), sdkmath.LegacyZeroDec(), sdkmath.LegacyZeroDec()), minSelfDelegation, ) if err != nil { @@ -857,8 +863,10 @@ func (suite *grpcQueryTestSuite) createAccountWithDerivatives(denom string, amou address := sdk.AccAddress(valAddress) remainingSelfDelegation := sdkmath.NewInt(1e6) + bondDenom, err := suite.bondDenom() + suite.Require().NoError(err) selfDelegation := sdk.NewCoin( - suite.bondDenom(), + bondDenom, amount.Add(remainingSelfDelegation), ) @@ -867,7 +875,9 @@ func (suite *grpcQueryTestSuite) createAccountWithDerivatives(denom string, amou err = suite.createUnbondedValidator(valAddress, selfDelegation, remainingSelfDelegation) suite.Require().NoError(err) - toConvert := sdk.NewCoin(suite.bondDenom(), amount) + bondDenom, err = suite.bondDenom() + suite.Require().NoError(err) + toConvert := sdk.NewCoin(bondDenom, amount) derivatives, err := suite.App.GetLiquidKeeper().MintDerivative(suite.Ctx, address, valAddress, @@ -881,11 +891,11 @@ func (suite *grpcQueryTestSuite) createAccountWithDerivatives(denom string, amou } // slashValidator slashes the validator with the given address by the given percentage. -func (suite *grpcQueryTestSuite) slashValidator(address sdk.ValAddress, slashFraction sdk.Dec) error { +func (suite *grpcQueryTestSuite) slashValidator(address sdk.ValAddress, slashFraction sdkmath.LegacyDec) error { stakingKeeper := suite.App.GetStakingKeeper() - validator, found := stakingKeeper.GetValidator(suite.Ctx, address) - suite.Require().True(found) + validator, err := stakingKeeper.GetValidator(suite.Ctx, address) + suite.Require().NoError(err) consAddr, err := validator.GetConsAddr() suite.Require().NoError(err) @@ -900,6 +910,6 @@ func (suite *grpcQueryTestSuite) slashValidator(address sdk.ValAddress, slashFra } // bondDenom fetches the staking denom from the staking module. -func (suite *grpcQueryTestSuite) bondDenom() string { +func (suite *grpcQueryTestSuite) bondDenom() (string, error) { return suite.App.GetStakingKeeper().BondDenom(suite.Ctx) } diff --git a/x/earn/keeper/hooks.go b/x/earn/keeper/hooks.go index 36a33ce310..15e31077a0 100644 --- a/x/earn/keeper/hooks.go +++ b/x/earn/keeper/hooks.go @@ -1,6 +1,8 @@ package keeper import ( + "context" + sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/kava-labs/kava/x/earn/types" @@ -11,10 +13,10 @@ var _ types.EarnHooks = Keeper{} // AfterVaultDepositCreated - call hook if registered func (k Keeper) AfterVaultDepositCreated( - ctx sdk.Context, + ctx context.Context, vaultDenom string, depositor sdk.AccAddress, - sharesOwned sdk.Dec, + sharesOwned sdkmath.LegacyDec, ) { if k.hooks != nil { k.hooks.AfterVaultDepositCreated(ctx, vaultDenom, depositor, sharesOwned) @@ -23,10 +25,10 @@ func (k Keeper) AfterVaultDepositCreated( // BeforeVaultDepositModified - call hook if registered func (k Keeper) BeforeVaultDepositModified( - ctx sdk.Context, + ctx context.Context, vaultDenom string, depositor sdk.AccAddress, - sharesOwned sdk.Dec, + sharesOwned sdkmath.LegacyDec, ) { if k.hooks != nil { k.hooks.BeforeVaultDepositModified(ctx, vaultDenom, depositor, sharesOwned) diff --git a/x/earn/keeper/hooks_test.go b/x/earn/keeper/hooks_test.go index 55d8b67361..3a7a0a38e7 100644 --- a/x/earn/keeper/hooks_test.go +++ b/x/earn/keeper/hooks_test.go @@ -1,6 +1,7 @@ package keeper_test import ( + sdkmath "cosmossdk.io/math" "testing" "github.com/kava-labs/kava/x/earn/testutil" @@ -58,7 +59,7 @@ func (suite *hookTestSuite) TestHooks_DepositAndWithdraw() { suite.Ctx, acc1deposit1Amount.Denom, acc.GetAddress(), - sdk.NewDecFromInt(acc1deposit1Amount.Amount), + sdkmath.LegacyNewDecFromInt(acc1deposit1Amount.Amount), ).Once() err := suite.Keeper.Deposit( suite.Ctx, @@ -75,7 +76,7 @@ func (suite *hookTestSuite) TestHooks_DepositAndWithdraw() { suite.Ctx, acc1deposit1Amount.Denom, acc.GetAddress(), - sdk.NewDecFromInt(acc1deposit1Amount.Amount), + sdkmath.LegacyNewDecFromInt(acc1deposit1Amount.Amount), ).Once() err = suite.Keeper.Deposit( suite.Ctx, @@ -115,7 +116,7 @@ func (suite *hookTestSuite) TestHooks_DepositAndWithdraw() { suite.Ctx, acc1deposit2Amount.Denom, acc.GetAddress(), - sdk.NewDecFromInt(acc1deposit2Amount.Amount), + sdkmath.LegacyNewDecFromInt(acc1deposit2Amount.Amount), ).Once() err = suite.Keeper.Deposit( suite.Ctx, @@ -131,7 +132,7 @@ func (suite *hookTestSuite) TestHooks_DepositAndWithdraw() { suite.Ctx, acc1deposit2Amount.Denom, acc.GetAddress(), - sdk.NewDecFromInt(acc1deposit2Amount.Amount), + sdkmath.LegacyNewDecFromInt(acc1deposit2Amount.Amount), ).Once() err = suite.Keeper.Deposit( suite.Ctx, @@ -174,7 +175,7 @@ func (suite *hookTestSuite) TestHooks_DepositAndWithdraw() { suite.Ctx, acc2deposit1Amount.Denom, acc2.GetAddress(), - sdk.NewDecFromInt(acc2deposit1Amount.Amount), + sdkmath.LegacyNewDecFromInt(acc2deposit1Amount.Amount), ).Once() err = suite.Keeper.Deposit( suite.Ctx, @@ -192,7 +193,7 @@ func (suite *hookTestSuite) TestHooks_DepositAndWithdraw() { suite.Ctx, acc2deposit1Amount.Denom, acc2.GetAddress(), - sdk.NewDecFromInt(acc2deposit1Amount.Amount), + sdkmath.LegacyNewDecFromInt(acc2deposit1Amount.Amount), ).Once() err = suite.Keeper.Deposit( suite.Ctx, @@ -232,7 +233,7 @@ func (suite *hookTestSuite) TestHooks_DepositAndWithdraw() { suite.Ctx, acc2deposit2Amount.Denom, acc2.GetAddress(), - sdk.NewDecFromInt(acc2deposit2Amount.Amount), + sdkmath.LegacyNewDecFromInt(acc2deposit2Amount.Amount), ).Once() err = suite.Keeper.Deposit( suite.Ctx, @@ -248,7 +249,7 @@ func (suite *hookTestSuite) TestHooks_DepositAndWithdraw() { suite.Ctx, acc2deposit2Amount.Denom, acc2.GetAddress(), - sdk.NewDecFromInt(acc2deposit2Amount.Amount), + sdkmath.LegacyNewDecFromInt(acc2deposit2Amount.Amount), ).Once() err = suite.Keeper.Deposit( suite.Ctx, @@ -508,20 +509,20 @@ func (suite *hookTestSuite) TestHooks_HookOrdering() { acc := suite.CreateAccount(sdk.NewCoins(startBalance), 0) - earnHooks.On("AfterVaultDepositCreated", suite.Ctx, depositAmount.Denom, acc.GetAddress(), sdk.NewDecFromInt(depositAmount.Amount)). + earnHooks.On("AfterVaultDepositCreated", suite.Ctx, depositAmount.Denom, acc.GetAddress(), sdkmath.LegacyNewDecFromInt(depositAmount.Amount)). Run(func(args mock.Arguments) { shares, found := suite.Keeper.GetVaultAccountShares(suite.Ctx, acc.GetAddress()) suite.Require().True(found, "expected after hook to be called after shares are updated") - suite.Require().Equal(sdk.NewDecFromInt(depositAmount.Amount), shares.AmountOf(depositAmount.Denom)) + suite.Require().Equal(sdkmath.LegacyNewDecFromInt(depositAmount.Amount), shares.AmountOf(depositAmount.Denom)) }) err := suite.Keeper.Deposit(suite.Ctx, acc.GetAddress(), depositAmount, types.STRATEGY_TYPE_HARD) suite.Require().NoError(err) - earnHooks.On("BeforeVaultDepositModified", suite.Ctx, depositAmount.Denom, acc.GetAddress(), sdk.NewDecFromInt(depositAmount.Amount)). + earnHooks.On("BeforeVaultDepositModified", suite.Ctx, depositAmount.Denom, acc.GetAddress(), sdkmath.LegacyNewDecFromInt(depositAmount.Amount)). Run(func(args mock.Arguments) { shares, found := suite.Keeper.GetVaultAccountShares(suite.Ctx, acc.GetAddress()) suite.Require().True(found, "expected after hook to be called after shares are updated") - suite.Require().Equal(sdk.NewDecFromInt(depositAmount.Amount), shares.AmountOf(depositAmount.Denom)) + suite.Require().Equal(sdkmath.LegacyNewDecFromInt(depositAmount.Amount), shares.AmountOf(depositAmount.Denom)) }) err = suite.Keeper.Deposit(suite.Ctx, acc.GetAddress(), depositAmount, types.STRATEGY_TYPE_HARD) suite.Require().NoError(err) @@ -532,7 +533,7 @@ func (suite *hookTestSuite) TestHooks_HookOrdering() { Run(func(args mock.Arguments) { shares, found := suite.Keeper.GetVaultAccountShares(suite.Ctx, acc.GetAddress()) suite.Require().True(found, "expected after hook to be called after shares are updated") - suite.Require().Equal(sdk.NewDecFromInt(depositAmount.Amount.MulRaw(2)), shares.AmountOf(depositAmount.Denom)) + suite.Require().Equal(sdkmath.LegacyNewDecFromInt(depositAmount.Amount.MulRaw(2)), shares.AmountOf(depositAmount.Denom)) }) _, err = suite.Keeper.Withdraw(suite.Ctx, acc.GetAddress(), depositAmount, types.STRATEGY_TYPE_HARD) suite.Require().NoError(err) diff --git a/x/earn/keeper/invariants.go b/x/earn/keeper/invariants.go index 880921e8c0..ee8953718d 100644 --- a/x/earn/keeper/invariants.go +++ b/x/earn/keeper/invariants.go @@ -1,6 +1,7 @@ package keeper import ( + sdkmath "cosmossdk.io/math" "github.com/kava-labs/kava/x/earn/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -81,7 +82,7 @@ func VaultSharesInvariant(k Keeper) sdk.Invariant { k.IterateVaultRecords(ctx, func(record types.VaultRecord) bool { totalShares[record.TotalShares.Denom] = vaultShares{ totalShares: record.TotalShares, - totalSharesOwned: types.NewVaultShare(record.TotalShares.Denom, sdk.ZeroDec()), + totalSharesOwned: types.NewVaultShare(record.TotalShares.Denom, sdkmath.LegacyZeroDec()), } return false @@ -94,7 +95,7 @@ func VaultSharesInvariant(k Keeper) sdk.Invariant { totalShares[share.Denom] = shares } else { totalShares[share.Denom] = vaultShares{ - totalShares: types.NewVaultShare(share.Denom, sdk.ZeroDec()), + totalShares: types.NewVaultShare(share.Denom, sdkmath.LegacyZeroDec()), totalSharesOwned: share, } } diff --git a/x/earn/keeper/invariants_test.go b/x/earn/keeper/invariants_test.go index cd0ebd4a95..3ee3b7d154 100644 --- a/x/earn/keeper/invariants_test.go +++ b/x/earn/keeper/invariants_test.go @@ -1,6 +1,7 @@ package keeper_test import ( + sdkmath "cosmossdk.io/math" "testing" "github.com/kava-labs/kava/app" @@ -35,25 +36,25 @@ func (suite *invariantTestSuite) SetupTest() { func (suite *invariantTestSuite) SetupValidState() { suite.Keeper.SetVaultRecord(suite.Ctx, types.NewVaultRecord( "usdx", - sdk.MustNewDecFromStr("100"), + sdkmath.LegacyMustNewDecFromStr("100"), )) suite.Keeper.SetVaultRecord(suite.Ctx, types.NewVaultRecord( "ukava", - sdk.MustNewDecFromStr("250.123456"), + sdkmath.LegacyMustNewDecFromStr("250.123456"), )) vaultShare1 := types.NewVaultShareRecord( suite.addrs[0], types.NewVaultShares( - types.NewVaultShare("usdx", sdk.MustNewDecFromStr("50")), - types.NewVaultShare("ukava", sdk.MustNewDecFromStr("105.123")), + types.NewVaultShare("usdx", sdkmath.LegacyMustNewDecFromStr("50")), + types.NewVaultShare("ukava", sdkmath.LegacyMustNewDecFromStr("105.123")), ), ) vaultShare2 := types.NewVaultShareRecord( suite.addrs[1], types.NewVaultShares( - types.NewVaultShare("usdx", sdk.MustNewDecFromStr("50")), - types.NewVaultShare("ukava", sdk.MustNewDecFromStr("145.000456")), + types.NewVaultShare("usdx", sdkmath.LegacyMustNewDecFromStr("50")), + types.NewVaultShare("ukava", sdkmath.LegacyMustNewDecFromStr("145.000456")), ), ) @@ -114,7 +115,7 @@ func (suite *invariantTestSuite) TestVaultRecordsInvariant() { suite.Keeper.SetVaultRecord(suite.Ctx, types.VaultRecord{ TotalShares: types.VaultShare{ Denom: "invalid denom", - Amount: sdk.MustNewDecFromStr("101"), + Amount: sdkmath.LegacyMustNewDecFromStr("101"), }, }) message, broken = suite.runInvariant("vault-records", keeper.VaultRecordsInvariant) @@ -137,8 +138,8 @@ func (suite *invariantTestSuite) TestShareRecordsInvariant() { suite.addrs[0], // Directly create vaultshares instead of NewVaultShares() to avoid sanitization types.VaultShares{ - types.NewVaultShare("ukava", sdk.MustNewDecFromStr("50")), - types.NewVaultShare("ukava", sdk.MustNewDecFromStr("105.123")), + types.NewVaultShare("ukava", sdkmath.LegacyMustNewDecFromStr("50")), + types.NewVaultShare("ukava", sdkmath.LegacyMustNewDecFromStr("105.123")), }, )) message, broken = suite.runInvariant("share-records", keeper.ShareRecordsInvariant) @@ -159,7 +160,7 @@ func (suite *invariantTestSuite) TestVaultSharesInvariant() { // broken when total shares are greater than depositor shares suite.Keeper.SetVaultRecord(suite.Ctx, types.NewVaultRecord( "usdx", - sdk.MustNewDecFromStr("101"), + sdkmath.LegacyMustNewDecFromStr("101"), )) message, broken = suite.runInvariant("vault-shares", keeper.VaultSharesInvariant) suite.Equal("earn: vault shares broken invariant\nvault shares do not match depositor shares\n", message) @@ -168,7 +169,7 @@ func (suite *invariantTestSuite) TestVaultSharesInvariant() { // broken when total shares are less than the depositor shares suite.Keeper.SetVaultRecord(suite.Ctx, types.NewVaultRecord( "usdx", - sdk.MustNewDecFromStr("99.999"), + sdkmath.LegacyMustNewDecFromStr("99.999"), )) message, broken = suite.runInvariant("vault-shares", keeper.VaultSharesInvariant) suite.Equal("earn: vault shares broken invariant\nvault shares do not match depositor shares\n", message) diff --git a/x/earn/keeper/keeper.go b/x/earn/keeper/keeper.go index c7a691d794..c3a4fc6164 100644 --- a/x/earn/keeper/keeper.go +++ b/x/earn/keeper/keeper.go @@ -1,8 +1,8 @@ package keeper import ( + storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/codec" - storetypes "github.com/cosmos/cosmos-sdk/store/types" "github.com/kava-labs/kava/x/earn/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" diff --git a/x/earn/keeper/msg_server_test.go b/x/earn/keeper/msg_server_test.go index 04efa27dac..86d2b3ed24 100644 --- a/x/earn/keeper/msg_server_test.go +++ b/x/earn/keeper/msg_server_test.go @@ -1,6 +1,7 @@ package keeper_test import ( + sdkmath "cosmossdk.io/math" "testing" sdk "github.com/cosmos/cosmos-sdk/types" @@ -69,7 +70,7 @@ func (suite *msgServerTestSuite) TestDeposit() { sdk.NewAttribute(types.AttributeKeyVaultDenom, depositAmount.Denom), sdk.NewAttribute(types.AttributeKeyDepositor, acc.GetAddress().String()), // Shares 1:1 to amount - sdk.NewAttribute(types.AttributeKeyShares, sdk.NewDecFromInt(depositAmount.Amount).String()), + sdk.NewAttribute(types.AttributeKeyShares, sdkmath.LegacyNewDecFromInt(depositAmount.Amount).String()), sdk.NewAttribute(sdk.AttributeKeyAmount, depositAmount.Amount.String()), ), ) @@ -122,7 +123,7 @@ func (suite *msgServerTestSuite) TestWithdraw() { types.EventTypeVaultWithdraw, sdk.NewAttribute(types.AttributeKeyVaultDenom, depositAmount.Denom), sdk.NewAttribute(types.AttributeKeyOwner, acc.GetAddress().String()), - sdk.NewAttribute(types.AttributeKeyShares, sdk.NewDecFromInt(depositAmount.Amount).String()), + sdk.NewAttribute(types.AttributeKeyShares, sdkmath.LegacyNewDecFromInt(depositAmount.Amount).String()), sdk.NewAttribute(sdk.AttributeKeyAmount, depositAmount.Amount.String()), ), ) diff --git a/x/earn/keeper/strategy_hard.go b/x/earn/keeper/strategy_hard.go index b703435e70..26c33b0a2d 100644 --- a/x/earn/keeper/strategy_hard.go +++ b/x/earn/keeper/strategy_hard.go @@ -1,6 +1,7 @@ package keeper import ( + sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/kava-labs/kava/x/earn/types" ) @@ -22,7 +23,7 @@ func (s *HardStrategy) GetEstimatedTotalAssets(ctx sdk.Context, denom string) (s deposit, found := s.hardKeeper.GetSyncedDeposit(ctx, macc.GetAddress()) if !found { // Return 0 if no deposit exists for module account - return sdk.NewCoin(denom, sdk.ZeroInt()), nil + return sdk.NewCoin(denom, sdkmath.ZeroInt()), nil } // Only return the deposit for the vault denom. @@ -33,7 +34,7 @@ func (s *HardStrategy) GetEstimatedTotalAssets(ctx sdk.Context, denom string) (s } // Return 0 if no deposit exists for the vault denom - return sdk.NewCoin(denom, sdk.ZeroInt()), nil + return sdk.NewCoin(denom, sdkmath.ZeroInt()), nil } // Deposit deposits the specified amount of coins into hard. diff --git a/x/earn/keeper/strategy_hard_test.go b/x/earn/keeper/strategy_hard_test.go index a283763e41..d1f7438f15 100644 --- a/x/earn/keeper/strategy_hard_test.go +++ b/x/earn/keeper/strategy_hard_test.go @@ -47,7 +47,7 @@ func (suite *strategyHardTestSuite) TestDeposit_SingleAcc() { suite.HardDepositAmountEqual(sdk.NewCoins(depositAmount)) suite.VaultTotalValuesEqual(sdk.NewCoins(depositAmount)) suite.VaultTotalSharesEqual(types.NewVaultShares( - types.NewVaultShare(depositAmount.Denom, sdk.NewDecFromInt(depositAmount.Amount)), + types.NewVaultShare(depositAmount.Denom, sdkmath.LegacyNewDecFromInt(depositAmount.Amount)), )) // Query vault total @@ -77,7 +77,7 @@ func (suite *strategyHardTestSuite) TestDeposit_SingleAcc_MultipleDeposits() { suite.HardDepositAmountEqual(sdk.NewCoins(expectedVaultBalance)) suite.VaultTotalValuesEqual(sdk.NewCoins(expectedVaultBalance)) suite.VaultTotalSharesEqual(types.NewVaultShares( - types.NewVaultShare(expectedVaultBalance.Denom, sdk.NewDecFromInt(expectedVaultBalance.Amount)), + types.NewVaultShare(expectedVaultBalance.Denom, sdkmath.LegacyNewDecFromInt(expectedVaultBalance.Amount)), )) // Query vault total @@ -113,7 +113,7 @@ func (suite *strategyHardTestSuite) TestDeposit_MultipleAcc_MultipleDeposits() { suite.HardDepositAmountEqual(sdk.NewCoins(expectedTotalValue)) suite.VaultTotalValuesEqual(sdk.NewCoins(expectedTotalValue)) suite.VaultTotalSharesEqual(types.NewVaultShares( - types.NewVaultShare(expectedTotalValue.Denom, sdk.NewDecFromInt(expectedTotalValue.Amount)), + types.NewVaultShare(expectedTotalValue.Denom, sdkmath.LegacyNewDecFromInt(expectedTotalValue.Amount)), )) // Query vault total @@ -132,7 +132,7 @@ func (suite *strategyHardTestSuite) TestGetVaultTotalValue_Empty() { totalValue, err := suite.Keeper.GetVaultTotalValue(suite.Ctx, vaultDenom) suite.Require().NoError(err) - suite.Equal(sdk.NewCoin(vaultDenom, sdk.ZeroInt()), totalValue) + suite.Equal(sdk.NewCoin(vaultDenom, sdkmath.ZeroInt()), totalValue) } func (suite *strategyHardTestSuite) TestGetVaultTotalValue_NoDenomDeposit() { @@ -160,7 +160,7 @@ func (suite *strategyHardTestSuite) TestGetVaultTotalValue_NoDenomDeposit() { totalValueBusd, err := suite.Keeper.GetVaultTotalValue(suite.Ctx, vaultDenomBusd) suite.Require().NoError(err) - suite.Equal(sdk.NewCoin(vaultDenomBusd, sdk.ZeroInt()), totalValueBusd) + suite.Equal(sdk.NewCoin(vaultDenomBusd, sdkmath.ZeroInt()), totalValueBusd) } // ---------------------------------------------------------------------------- @@ -312,7 +312,7 @@ func (suite *strategyHardTestSuite) TestAccountShares() { acc1Shares, found := suite.Keeper.GetVaultAccountShares(suite.Ctx, acc1) suite.Require().True(found) - suite.Equal(sdk.NewDec(100), acc1Shares.AmountOf(vaultDenom), "initial deposit 1:1 shares") + suite.Equal(sdkmath.LegacyNewDec(100), acc1Shares.AmountOf(vaultDenom), "initial deposit 1:1 shares") // 2. Direct hard deposit from module account to increase vault value // Total value: 100 -> 110 @@ -340,12 +340,12 @@ func (suite *strategyHardTestSuite) TestAccountShares() { suite.Require().True(found) // 100 * 100 / 110 = 190.909090909090909091 // QuoInt64() truncates - expectedAcc2Shares := sdk.NewDec(100).MulInt64(100).QuoInt64(110) + expectedAcc2Shares := sdkmath.LegacyNewDec(100).MulInt64(100).QuoInt64(110) suite.Equal(expectedAcc2Shares, acc2Shares.AmountOf(vaultDenom)) vaultTotalShares, found := suite.Keeper.GetVaultTotalShares(suite.Ctx, vaultDenom) suite.Require().True(found) - suite.Equal(sdk.NewDec(100).Add(expectedAcc2Shares), vaultTotalShares.Amount) + suite.Equal(sdkmath.LegacyNewDec(100).Add(expectedAcc2Shares), vaultTotalShares.Amount) // Hard deposit again from module account to triple original value // 210 -> 300 @@ -364,7 +364,7 @@ func (suite *strategyHardTestSuite) TestAccountShares() { // sharedIssued = 100 * 190 / 300 = 63.3 = 63 // total shares = 100 + 63 = 163 suite.Equal( - sdk.NewDec(100).Add(sdk.NewDec(100).Mul(vaultTotalShares.Amount).Quo(sdk.NewDec(300))), + sdkmath.LegacyNewDec(100).Add(sdkmath.LegacyNewDec(100).Mul(vaultTotalShares.Amount).Quo(sdkmath.LegacyNewDec(300))), acc1Shares.AmountOf(vaultDenom), "shares should consist of 100 of 1x share price and 63 of 3x share price", ) @@ -393,7 +393,7 @@ func (suite *strategyHardTestSuite) TestWithdraw_AccumulatedAmount() { acc1Shares, found := suite.Keeper.GetVaultAccountShares(suite.Ctx, acc1) suite.Require().True(found) - suite.Equal(sdk.NewDec(100), acc1Shares.AmountOf(vaultDenom), "initial deposit 1:1 shares") + suite.Equal(sdkmath.LegacyNewDec(100), acc1Shares.AmountOf(vaultDenom), "initial deposit 1:1 shares") // 2. Direct hard deposit from module account to increase vault value // Total value: 200 -> 220, 110 each account @@ -432,7 +432,7 @@ func (suite *strategyHardTestSuite) TestWithdraw_AccumulatedTruncated() { acc1Shares, found := suite.Keeper.GetVaultAccountShares(suite.Ctx, acc1) suite.Require().True(found) - suite.Equal(sdk.NewDec(100), acc1Shares.AmountOf(vaultDenom), "initial deposit 1:1 shares") + suite.Equal(sdkmath.LegacyNewDec(100), acc1Shares.AmountOf(vaultDenom), "initial deposit 1:1 shares") // 2. Direct hard deposit from module account to increase vault value // Total value: 200 -> 211, 105.5 each account @@ -473,7 +473,7 @@ func (suite *strategyHardTestSuite) TestWithdraw_ExpensiveShares() { acc1Shares, found := suite.Keeper.GetVaultAccountShares(suite.Ctx, acc1) suite.Require().True(found) - suite.Equal(sdk.NewDec(100), acc1Shares.AmountOf(vaultDenom), "initial deposit 1:1 shares") + suite.Equal(sdkmath.LegacyNewDec(100), acc1Shares.AmountOf(vaultDenom), "initial deposit 1:1 shares") // 2. Direct hard deposit from module account to increase vault value // Total value: 100 -> 2000, shares now 10usdx each diff --git a/x/earn/keeper/strategy_savings.go b/x/earn/keeper/strategy_savings.go index c5955e674c..dcf6985c09 100644 --- a/x/earn/keeper/strategy_savings.go +++ b/x/earn/keeper/strategy_savings.go @@ -1,6 +1,7 @@ package keeper import ( + sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/kava-labs/kava/x/earn/types" ) @@ -22,7 +23,7 @@ func (s *SavingsStrategy) GetEstimatedTotalAssets(ctx sdk.Context, denom string) deposit, found := s.savingsKeeper.GetDeposit(ctx, macc.GetAddress()) if !found { // Return 0 if no deposit exists for module account - return sdk.NewCoin(denom, sdk.ZeroInt()), nil + return sdk.NewCoin(denom, sdkmath.ZeroInt()), nil } // Only return the deposit for the vault denom. @@ -33,7 +34,7 @@ func (s *SavingsStrategy) GetEstimatedTotalAssets(ctx sdk.Context, denom string) } // Return 0 if no deposit exists for the vault denom - return sdk.NewCoin(denom, sdk.ZeroInt()), nil + return sdk.NewCoin(denom, sdkmath.ZeroInt()), nil } // Deposit deposits the specified amount of coins into savings. diff --git a/x/earn/keeper/strategy_savings_test.go b/x/earn/keeper/strategy_savings_test.go index 72ad8d243d..5cfaf8cef5 100644 --- a/x/earn/keeper/strategy_savings_test.go +++ b/x/earn/keeper/strategy_savings_test.go @@ -48,7 +48,7 @@ func (suite *strategySavingsTestSuite) TestDeposit_SingleAcc() { suite.SavingsDepositAmountEqual(sdk.NewCoins(depositAmount)) suite.VaultTotalValuesEqual(sdk.NewCoins(depositAmount)) suite.VaultTotalSharesEqual(types.NewVaultShares( - types.NewVaultShare(depositAmount.Denom, sdk.NewDecFromInt(depositAmount.Amount)), + types.NewVaultShare(depositAmount.Denom, sdkmath.LegacyNewDecFromInt(depositAmount.Amount)), )) // Query vault total @@ -77,7 +77,7 @@ func (suite *strategySavingsTestSuite) TestDeposit_SingleAcc_MultipleDeposits() suite.SavingsDepositAmountEqual(sdk.NewCoins(expectedVaultBalance)) suite.VaultTotalValuesEqual(sdk.NewCoins(expectedVaultBalance)) suite.VaultTotalSharesEqual(types.NewVaultShares( - types.NewVaultShare(expectedVaultBalance.Denom, sdk.NewDecFromInt(expectedVaultBalance.Amount)), + types.NewVaultShare(expectedVaultBalance.Denom, sdkmath.LegacyNewDecFromInt(expectedVaultBalance.Amount)), )) // Query vault total @@ -112,7 +112,7 @@ func (suite *strategySavingsTestSuite) TestDeposit_MultipleAcc_MultipleDeposits( suite.SavingsDepositAmountEqual(sdk.NewCoins(expectedTotalValue)) suite.VaultTotalValuesEqual(sdk.NewCoins(expectedTotalValue)) suite.VaultTotalSharesEqual(types.NewVaultShares( - types.NewVaultShare(expectedTotalValue.Denom, sdk.NewDecFromInt(expectedTotalValue.Amount)), + types.NewVaultShare(expectedTotalValue.Denom, sdkmath.LegacyNewDecFromInt(expectedTotalValue.Amount)), )) // Query vault total @@ -129,7 +129,7 @@ func (suite *strategySavingsTestSuite) TestGetVaultTotalValue_Empty() { totalValue, err := suite.Keeper.GetVaultTotalValue(suite.Ctx, savingsVaultDenom) suite.Require().NoError(err) - suite.Equal(sdk.NewCoin(savingsVaultDenom, sdk.ZeroInt()), totalValue) + suite.Equal(sdk.NewCoin(savingsVaultDenom, sdkmath.ZeroInt()), totalValue) } func (suite *strategySavingsTestSuite) TestGetVaultTotalValue_NoDenomDeposit() { @@ -157,7 +157,7 @@ func (suite *strategySavingsTestSuite) TestGetVaultTotalValue_NoDenomDeposit() { totalValueBusd, err := suite.Keeper.GetVaultTotalValue(suite.Ctx, vaultDenomBusd) suite.Require().NoError(err) - suite.Equal(sdk.NewCoin(vaultDenomBusd, sdk.ZeroInt()), totalValueBusd) + suite.Equal(sdk.NewCoin(vaultDenomBusd, sdkmath.ZeroInt()), totalValueBusd) } // ---------------------------------------------------------------------------- @@ -305,7 +305,7 @@ func (suite *strategySavingsTestSuite) TestAccountShares() { acc1Shares, found := suite.Keeper.GetVaultAccountShares(suite.Ctx, acc1) suite.Require().True(found) - suite.Equal(sdk.NewDec(100), acc1Shares.AmountOf(savingsVaultDenom), "initial deposit 1:1 shares") + suite.Equal(sdkmath.LegacyNewDec(100), acc1Shares.AmountOf(savingsVaultDenom), "initial deposit 1:1 shares") // 2. Direct savings deposit from module account to increase vault value // Total value: 100 -> 110 @@ -333,12 +333,12 @@ func (suite *strategySavingsTestSuite) TestAccountShares() { suite.Require().True(found) // 100 * 100 / 110 = 90.909090909090909091 // QuoInt64() truncates - expectedAcc2Shares := sdk.NewDec(100).MulInt64(100).QuoInt64(110) + expectedAcc2Shares := sdkmath.LegacyNewDec(100).MulInt64(100).QuoInt64(110) suite.Equal(expectedAcc2Shares, acc2Shares.AmountOf(savingsVaultDenom)) vaultTotalShares, found := suite.Keeper.GetVaultTotalShares(suite.Ctx, savingsVaultDenom) suite.Require().True(found) - suite.Equal(sdk.NewDec(100).Add(expectedAcc2Shares), vaultTotalShares.Amount) + suite.Equal(sdkmath.LegacyNewDec(100).Add(expectedAcc2Shares), vaultTotalShares.Amount) // Savings deposit again from module account to triple original value // 210 -> 300 @@ -357,7 +357,7 @@ func (suite *strategySavingsTestSuite) TestAccountShares() { // sharedIssued = 100 * 190 / 300 = 63.3 = 63 // total shares = 100 + 63 = 163 suite.Equal( - sdk.NewDec(100).Add(sdk.NewDec(100).Mul(vaultTotalShares.Amount).Quo(sdk.NewDec(300))), + sdkmath.LegacyNewDec(100).Add(sdkmath.LegacyNewDec(100).Mul(vaultTotalShares.Amount).Quo(sdkmath.LegacyNewDec(300))), acc1Shares.AmountOf(savingsVaultDenom), "shares should consist of 100 of 1x share price and 63 of 3x share price", ) @@ -385,7 +385,7 @@ func (suite *strategySavingsTestSuite) TestWithdraw_AccumulatedAmount() { acc1Shares, found := suite.Keeper.GetVaultAccountShares(suite.Ctx, acc1) suite.Require().True(found) - suite.Equal(sdk.NewDec(100), acc1Shares.AmountOf(savingsVaultDenom), "initial deposit 1:1 shares") + suite.Equal(sdkmath.LegacyNewDec(100), acc1Shares.AmountOf(savingsVaultDenom), "initial deposit 1:1 shares") // 2. Direct savings deposit from module account to increase vault value // Total value: 200 -> 220, 110 each account @@ -423,7 +423,7 @@ func (suite *strategySavingsTestSuite) TestWithdraw_AccumulatedTruncated() { acc1Shares, found := suite.Keeper.GetVaultAccountShares(suite.Ctx, acc1) suite.Require().True(found) - suite.Equal(sdk.NewDec(100), acc1Shares.AmountOf(savingsVaultDenom), "initial deposit 1:1 shares") + suite.Equal(sdkmath.LegacyNewDec(100), acc1Shares.AmountOf(savingsVaultDenom), "initial deposit 1:1 shares") // 2. Direct savings deposit from module account to increase vault value // Total value: 200 -> 211, 105.5 each account @@ -463,7 +463,7 @@ func (suite *strategySavingsTestSuite) TestWithdraw_ExpensiveShares() { acc1Shares, found := suite.Keeper.GetVaultAccountShares(suite.Ctx, acc1) suite.Require().True(found) - suite.Equal(sdk.NewDec(100), acc1Shares.AmountOf(savingsVaultDenom), "initial deposit 1:1 shares") + suite.Equal(sdkmath.LegacyNewDec(100), acc1Shares.AmountOf(savingsVaultDenom), "initial deposit 1:1 shares") // 2. Direct savings deposit from module account to increase vault value // Total value: 100 -> 2000, shares now 10usdx each diff --git a/x/earn/keeper/vault_record.go b/x/earn/keeper/vault_record.go index 9a7eb29db7..1a0e4b4273 100644 --- a/x/earn/keeper/vault_record.go +++ b/x/earn/keeper/vault_record.go @@ -1,7 +1,8 @@ package keeper import ( - "github.com/cosmos/cosmos-sdk/store/prefix" + "cosmossdk.io/store/prefix" + storetypes "cosmossdk.io/store/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/kava-labs/kava/x/earn/types" ) @@ -60,7 +61,7 @@ func (k Keeper) IterateVaultRecords( cb func(record types.VaultRecord) (stop bool), ) { store := prefix.NewStore(ctx.KVStore(k.key), types.VaultRecordKeyPrefix) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) + iterator := storetypes.KVStorePrefixIterator(store, []byte{}) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { diff --git a/x/earn/keeper/vault_share.go b/x/earn/keeper/vault_share.go index 36f3c608b0..2721136487 100644 --- a/x/earn/keeper/vault_share.go +++ b/x/earn/keeper/vault_share.go @@ -1,6 +1,7 @@ package keeper import ( + sdkmath "cosmossdk.io/math" "fmt" sdk "github.com/cosmos/cosmos-sdk/types" @@ -12,7 +13,7 @@ func (k *Keeper) ConvertToShares(ctx sdk.Context, assets sdk.Coin) (types.VaultS totalShares, found := k.GetVaultTotalShares(ctx, assets.Denom) if !found { // No shares issued yet, so shares are issued 1:1 - return types.NewVaultShare(assets.Denom, sdk.NewDecFromInt(assets.Amount)), nil + return types.NewVaultShare(assets.Denom, sdkmath.LegacyNewDecFromInt(assets.Amount)), nil } totalValue, err := k.GetVaultTotalValue(ctx, assets.Denom) @@ -40,7 +41,7 @@ func (k *Keeper) ConvertToShares(ctx sdk.Context, assets sdk.Coin) (types.VaultS // 100 * 100 / 105 == 10000 / 105 == 95.238095238095238095 // 100 * (100 / 105) == 100 * 0.952380952380952380 == 95.238095238095238000 // rounded down and truncated ^ loss of precision ^ - issuedShares := sdk.NewDecFromInt(assets.Amount).Mul(totalShares.Amount).QuoTruncate(sdk.NewDecFromInt(totalValue.Amount)) + issuedShares := sdkmath.LegacyNewDecFromInt(assets.Amount).Mul(totalShares.Amount).QuoTruncate(sdkmath.LegacyNewDecFromInt(totalValue.Amount)) if issuedShares.IsZero() { return types.VaultShare{}, fmt.Errorf("share count is zero") @@ -65,7 +66,7 @@ func (k *Keeper) ConvertToAssets(ctx sdk.Context, share types.VaultShare) (sdk.C // accValue := totalValue * percentOwnership // accValue := totalValue * accShares / totalVaultShares // Division must be last to avoid rounding errors and properly truncate. - value := sdk.NewDecFromInt(totalValue.Amount).Mul(share.Amount).QuoTruncate(totalVaultShares.Amount) + value := sdkmath.LegacyNewDecFromInt(totalValue.Amount).Mul(share.Amount).QuoTruncate(totalVaultShares.Amount) return sdk.NewCoin(share.Denom, value.TruncateInt()), nil } diff --git a/x/earn/keeper/vault_share_record.go b/x/earn/keeper/vault_share_record.go index 0358539718..91f76b6461 100644 --- a/x/earn/keeper/vault_share_record.go +++ b/x/earn/keeper/vault_share_record.go @@ -1,7 +1,8 @@ package keeper import ( - "github.com/cosmos/cosmos-sdk/store/prefix" + "cosmossdk.io/store/prefix" + storetypes "cosmossdk.io/store/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/kava-labs/kava/x/earn/types" ) @@ -68,7 +69,7 @@ func (k Keeper) IterateVaultShareRecords( cb func(record types.VaultShareRecord) (stop bool), ) { store := prefix.NewStore(ctx.KVStore(k.key), types.VaultShareRecordKeyPrefix) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) + iterator := storetypes.KVStorePrefixIterator(store, []byte{}) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { diff --git a/x/earn/keeper/vault_share_record_test.go b/x/earn/keeper/vault_share_record_test.go index 89eb480632..4ad83d4877 100644 --- a/x/earn/keeper/vault_share_record_test.go +++ b/x/earn/keeper/vault_share_record_test.go @@ -1,6 +1,7 @@ package keeper_test import ( + sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/kava-labs/kava/x/earn/types" ) @@ -9,7 +10,7 @@ import ( // State methods func (suite *vaultTestSuite) TestGetVaultRecord() { - record := types.NewVaultRecord("usdx", sdk.ZeroDec()) + record := types.NewVaultRecord("usdx", sdkmath.LegacyZeroDec()) _, found := suite.Keeper.GetVaultRecord(suite.Ctx, record.TotalShares.Denom) suite.Require().False(found) @@ -22,9 +23,9 @@ func (suite *vaultTestSuite) TestGetVaultRecord() { } func (suite *vaultTestSuite) TestUpdateVaultRecord() { - record := types.NewVaultRecord("usdx", sdk.ZeroDec()) + record := types.NewVaultRecord("usdx", sdkmath.LegacyZeroDec()) - record.TotalShares = types.NewVaultShare("usdx", sdk.NewDec(100)) + record.TotalShares = types.NewVaultShare("usdx", sdkmath.LegacyNewDec(100)) // Update vault suite.Keeper.UpdateVaultRecord(suite.Ctx, record) @@ -34,7 +35,7 @@ func (suite *vaultTestSuite) TestUpdateVaultRecord() { suite.Require().Equal(record, stateRecord) // Remove supply - record.TotalShares = types.NewVaultShare("usdx", sdk.NewDec(0)) + record.TotalShares = types.NewVaultShare("usdx", sdkmath.LegacyNewDec(0)) suite.Keeper.UpdateVaultRecord(suite.Ctx, record) _, found = suite.Keeper.GetVaultRecord(suite.Ctx, record.TotalShares.Denom) @@ -55,7 +56,7 @@ func (suite *vaultTestSuite) TestGetVaultShareRecord() { // Update share record record.Shares = types.NewVaultShares( - types.NewVaultShare(vaultDenom, sdk.NewDec(100)), + types.NewVaultShare(vaultDenom, sdkmath.LegacyNewDec(100)), ) suite.Keeper.SetVaultShareRecord(suite.Ctx, record) @@ -71,7 +72,7 @@ func (suite *vaultTestSuite) TestUpdateVaultShareRecord() { acc := suite.CreateAccount(sdk.NewCoins(startBalance), 0) record := types.NewVaultShareRecord(acc.GetAddress(), types.NewVaultShares( - types.NewVaultShare(vaultDenom, sdk.NewDec(100)), + types.NewVaultShare(vaultDenom, sdkmath.LegacyNewDec(100)), )) // Update vault diff --git a/x/earn/keeper/vault_share_test.go b/x/earn/keeper/vault_share_test.go index 8cefd82a7f..bf2d6a89f8 100644 --- a/x/earn/keeper/vault_share_test.go +++ b/x/earn/keeper/vault_share_test.go @@ -38,7 +38,7 @@ func (suite *vaultShareTestSuite) TestConvertToShares() { name: "initial 1:1", beforeConvert: func() {}, giveAmount: sdk.NewCoin(vaultDenom, sdkmath.NewInt(100)), - wantShares: types.NewVaultShare(vaultDenom, sdk.NewDec(100)), + wantShares: types.NewVaultShare(vaultDenom, sdkmath.LegacyNewDec(100)), }, { name: "value doubled", @@ -47,20 +47,20 @@ func (suite *vaultShareTestSuite) TestConvertToShares() { // set total shares set total value for hard // value is double than shares // shares is 2x price now - suite.addTotalShareAndValue(vaultDenom, sdk.NewDec(100), sdkmath.NewInt(200)) + suite.addTotalShareAndValue(vaultDenom, sdkmath.LegacyNewDec(100), sdkmath.NewInt(200)) }, giveAmount: sdk.NewCoin(vaultDenom, sdkmath.NewInt(100)), - wantShares: types.NewVaultShare(vaultDenom, sdk.NewDec(50)), + wantShares: types.NewVaultShare(vaultDenom, sdkmath.LegacyNewDec(50)), }, { name: "truncate", beforeConvert: func() { - suite.addTotalShareAndValue(vaultDenom, sdk.NewDec(1000), sdkmath.NewInt(1001)) + suite.addTotalShareAndValue(vaultDenom, sdkmath.LegacyNewDec(1000), sdkmath.NewInt(1001)) }, giveAmount: sdk.NewCoin(vaultDenom, sdkmath.NewInt(100)), // 100 * 100 / 101 = 99.0099something - wantShares: types.NewVaultShare(vaultDenom, sdk.NewDec(100).MulInt64(1000).QuoInt64(1001)), + wantShares: types.NewVaultShare(vaultDenom, sdkmath.LegacyNewDec(100).MulInt64(1000).QuoInt64(1001)), }, } @@ -89,14 +89,14 @@ func (suite *vaultShareTestSuite) TestConvertToShares() { func (suite *vaultShareTestSuite) addTotalShareAndValue( vaultDenom string, - vaultShares sdk.Dec, + vaultShares sdkmath.LegacyDec, hardDeposit sdkmath.Int, ) { macc := suite.AccountKeeper.GetModuleAccount(suite.Ctx, types.ModuleName) vaultRecord, found := suite.Keeper.GetVaultRecord(suite.Ctx, vaultDenom) if !found { - vaultRecord = types.NewVaultRecord(vaultDenom, sdk.ZeroDec()) + vaultRecord = types.NewVaultRecord(vaultDenom, sdkmath.LegacyZeroDec()) } // Add to vault record @@ -117,17 +117,17 @@ func (suite *vaultShareTestSuite) addTotalShareAndValue( } func TestPrecisionMulQuoOrder(t *testing.T) { - assetAmount := sdk.NewDec(100) - totalShares := sdk.NewDec(100) - totalValue := sdk.NewDec(105) + assetAmount := sdkmath.LegacyNewDec(100) + totalShares := sdkmath.LegacyNewDec(100) + totalValue := sdkmath.LegacyNewDec(105) // issuedShares = assetAmount * (totalValue / totalShares) // = (assetAmount * totalShares) / totalValue mulFirst := assetAmount.Mul(totalShares).QuoTruncate(totalValue) quoFirst := assetAmount.Mul(totalShares.QuoTruncate(totalValue)) - assert.Equal(t, sdk.MustNewDecFromStr("95.238095238095238095"), mulFirst) - assert.Equal(t, sdk.MustNewDecFromStr("95.238095238095238000"), quoFirst) + assert.Equal(t, sdkmath.LegacyMustNewDecFromStr("95.238095238095238095"), mulFirst) + assert.Equal(t, sdkmath.LegacyMustNewDecFromStr("95.238095238095238000"), quoFirst) assert.NotEqual(t, mulFirst, quoFirst) } diff --git a/x/earn/keeper/vault_test.go b/x/earn/keeper/vault_test.go index d15688805d..c17b9e2c85 100644 --- a/x/earn/keeper/vault_test.go +++ b/x/earn/keeper/vault_test.go @@ -39,7 +39,7 @@ func (suite *vaultTestSuite) TestGetVaultTotalShares() { vaultTotalShares, found := suite.Keeper.GetVaultTotalShares(suite.Ctx, vaultDenom) suite.Require().True(found) - suite.Equal(sdk.NewDecFromInt(depositAmount.Amount), vaultTotalShares.Amount) + suite.Equal(sdkmath.LegacyNewDecFromInt(depositAmount.Amount), vaultTotalShares.Amount) } func (suite *vaultTestSuite) TestGetVaultTotalShares_NotFound() { @@ -110,8 +110,8 @@ func (suite *vaultTestSuite) TestGetVaultAccountSupplied() { suite.Require().True(found) // Account supply only includes the deposit from respective accounts - suite.Equal(sdk.NewDecFromInt(deposit1Amount.Amount), vaultAcc1Supplied.Shares.AmountOf(vaultDenom)) - suite.Equal(sdk.NewDecFromInt(deposit1Amount.Amount), vaultAcc2Supplied.Shares.AmountOf(vaultDenom)) + suite.Equal(sdkmath.LegacyNewDecFromInt(deposit1Amount.Amount), vaultAcc1Supplied.Shares.AmountOf(vaultDenom)) + suite.Equal(sdkmath.LegacyNewDecFromInt(deposit1Amount.Amount), vaultAcc2Supplied.Shares.AmountOf(vaultDenom)) } func (suite *vaultTestSuite) TestGetVaultAccountValue() { diff --git a/x/earn/keeper/withdraw_test.go b/x/earn/keeper/withdraw_test.go index 4b8d0b4d1b..d7844ed190 100644 --- a/x/earn/keeper/withdraw_test.go +++ b/x/earn/keeper/withdraw_test.go @@ -78,7 +78,7 @@ func (suite *withdrawTestSuite) TestWithdraw_NoVaultShareRecord() { suite.VaultTotalValuesEqual(sdk.NewCoins(acc1DepositAmount)) suite.VaultTotalSharesEqual(types.NewVaultShares( - types.NewVaultShare(acc1DepositAmount.Denom, sdk.NewDecFromInt(acc1DepositAmount.Amount)), + types.NewVaultShare(acc1DepositAmount.Denom, sdkmath.LegacyNewDecFromInt(acc1DepositAmount.Amount)), )) } @@ -107,7 +107,7 @@ func (suite *withdrawTestSuite) TestWithdraw_ExceedBalance() { suite.VaultTotalValuesEqual(sdk.NewCoins(depositAmount)) suite.VaultTotalSharesEqual(types.NewVaultShares( - types.NewVaultShare(depositAmount.Denom, sdk.NewDecFromInt(depositAmount.Amount)), + types.NewVaultShare(depositAmount.Denom, sdkmath.LegacyNewDecFromInt(depositAmount.Amount)), )) } diff --git a/x/earn/module.go b/x/earn/module.go index 0337436411..2a1250e4fb 100644 --- a/x/earn/module.go +++ b/x/earn/module.go @@ -137,10 +137,15 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // BeginBlock module begin-block -func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) { +func (am AppModule) BeginBlock(ctx sdk.Context) error { + return nil } // EndBlock module end-block -func (am AppModule) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - return []abci.ValidatorUpdate{} +func (am AppModule) EndBlock(_ sdk.Context) ([]abci.ValidatorUpdate, error) { + return []abci.ValidatorUpdate{}, nil } + +func (AppModule) IsOnePerModuleType() {} + +func (AppModule) IsAppModule() {} diff --git a/x/earn/testutil/suite.go b/x/earn/testutil/suite.go index 063dca4177..c550740494 100644 --- a/x/earn/testutil/suite.go +++ b/x/earn/testutil/suite.go @@ -23,7 +23,6 @@ import ( tmtime "github.com/cometbft/cometbft/types/time" sdk "github.com/cosmos/cosmos-sdk/types" authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" banktestutil "github.com/cosmos/cosmos-sdk/x/bank/testutil" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" @@ -67,19 +66,19 @@ func (suite *Suite) SetupTest() { { MarketID: "usdx:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("1.00"), + Price: sdkmath.LegacyMustNewDecFromStr("1.00"), Expiry: time.Now().Add(100 * time.Hour), }, { MarketID: "kava:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("2.00"), + Price: sdkmath.LegacyMustNewDecFromStr("2.00"), Expiry: time.Now().Add(100 * time.Hour), }, { MarketID: "bnb:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("10.00"), + Price: sdkmath.LegacyMustNewDecFromStr("10.00"), Expiry: time.Now().Add(100 * time.Hour), }, }, @@ -91,58 +90,58 @@ func (suite *Suite) SetupTest() { "usdx", hardtypes.NewBorrowLimit( true, - sdk.MustNewDecFromStr("20000000"), - sdk.MustNewDecFromStr("1"), + sdkmath.LegacyMustNewDecFromStr("20000000"), + sdkmath.LegacyMustNewDecFromStr("1"), ), "usdx:usd", sdkmath.NewInt(1000000), hardtypes.NewInterestRateModel( - sdk.MustNewDecFromStr("0.05"), - sdk.MustNewDecFromStr("2"), - sdk.MustNewDecFromStr("0.8"), - sdk.MustNewDecFromStr("10"), + sdkmath.LegacyMustNewDecFromStr("0.05"), + sdkmath.LegacyMustNewDecFromStr("2"), + sdkmath.LegacyMustNewDecFromStr("0.8"), + sdkmath.LegacyMustNewDecFromStr("10"), ), - sdk.MustNewDecFromStr("0.05"), - sdk.ZeroDec(), + sdkmath.LegacyMustNewDecFromStr("0.05"), + sdkmath.LegacyZeroDec(), ), hardtypes.NewMoneyMarket( "busd", hardtypes.NewBorrowLimit( true, - sdk.MustNewDecFromStr("20000000"), - sdk.MustNewDecFromStr("1"), + sdkmath.LegacyMustNewDecFromStr("20000000"), + sdkmath.LegacyMustNewDecFromStr("1"), ), "busd:usd", sdkmath.NewInt(1000000), hardtypes.NewInterestRateModel( - sdk.MustNewDecFromStr("0.05"), - sdk.MustNewDecFromStr("2"), - sdk.MustNewDecFromStr("0.8"), - sdk.MustNewDecFromStr("10"), + sdkmath.LegacyMustNewDecFromStr("0.05"), + sdkmath.LegacyMustNewDecFromStr("2"), + sdkmath.LegacyMustNewDecFromStr("0.8"), + sdkmath.LegacyMustNewDecFromStr("10"), ), - sdk.MustNewDecFromStr("0.05"), - sdk.ZeroDec(), + sdkmath.LegacyMustNewDecFromStr("0.05"), + sdkmath.LegacyZeroDec(), ), hardtypes.NewMoneyMarket( "kava", hardtypes.NewBorrowLimit( true, - sdk.MustNewDecFromStr("20000000"), - sdk.MustNewDecFromStr("1"), + sdkmath.LegacyMustNewDecFromStr("20000000"), + sdkmath.LegacyMustNewDecFromStr("1"), ), "kava:usd", sdkmath.NewInt(1000000), hardtypes.NewInterestRateModel( - sdk.MustNewDecFromStr("0.05"), - sdk.MustNewDecFromStr("2"), - sdk.MustNewDecFromStr("0.8"), - sdk.MustNewDecFromStr("10"), + sdkmath.LegacyMustNewDecFromStr("0.05"), + sdkmath.LegacyMustNewDecFromStr("2"), + sdkmath.LegacyMustNewDecFromStr("0.8"), + sdkmath.LegacyMustNewDecFromStr("10"), ), - sdk.MustNewDecFromStr("0.05"), - sdk.ZeroDec(), + sdkmath.LegacyMustNewDecFromStr("0.05"), + sdkmath.LegacyZeroDec(), ), }, - sdk.NewDec(10), + sdkmath.LegacyNewDec(10), ), hardtypes.DefaultAccumulationTimes, hardtypes.DefaultDeposits, @@ -184,7 +183,7 @@ func (suite *Suite) SetupTest() { }, ) - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) suite.Ctx = ctx suite.App = tApp @@ -206,7 +205,7 @@ func (suite *Suite) GetEvents() sdk.Events { // AddCoinsToModule adds coins to the earn module account func (suite *Suite) AddCoinsToModule(amount sdk.Coins) { // Does not use suite.BankKeeper.MintCoins as module account would not have permission to mint - err := banktestutil.FundModuleAccount(suite.BankKeeper, suite.Ctx, types.ModuleName, amount) + err := banktestutil.FundModuleAccount(suite.Ctx, suite.BankKeeper, types.ModuleName, amount) suite.Require().NoError(err) } @@ -221,27 +220,27 @@ func (suite *Suite) RemoveCoinsFromModule(amount sdk.Coins) { // CreateAccount creates a new account from the provided balance, using index // to create different new addresses. -func (suite *Suite) CreateAccount(initialBalance sdk.Coins, index int) authtypes.AccountI { +func (suite *Suite) CreateAccount(initialBalance sdk.Coins, index int) sdk.AccountI { _, addrs := app.GeneratePrivKeyAddressPairs(index + 1) ak := suite.App.GetAccountKeeper() acc := ak.NewAccountWithAddress(suite.Ctx, addrs[index]) ak.SetAccount(suite.Ctx, acc) - err := banktestutil.FundAccount(suite.BankKeeper, suite.Ctx, acc.GetAddress(), initialBalance) + err := banktestutil.FundAccount(suite.Ctx, suite.BankKeeper, acc.GetAddress(), initialBalance) suite.Require().NoError(err) return acc } // NewAccountFromAddr creates a new account from the provided address with the provided balance -func (suite *Suite) NewAccountFromAddr(addr sdk.AccAddress, balance sdk.Coins) authtypes.AccountI { +func (suite *Suite) NewAccountFromAddr(addr sdk.AccAddress, balance sdk.Coins) sdk.AccountI { ak := suite.App.GetAccountKeeper() acc := ak.NewAccountWithAddress(suite.Ctx, addr) ak.SetAccount(suite.Ctx, acc) - err := banktestutil.FundAccount(suite.BankKeeper, suite.Ctx, acc.GetAddress(), balance) + err := banktestutil.FundAccount(suite.Ctx, suite.BankKeeper, acc.GetAddress(), balance) suite.Require().NoError(err) return acc @@ -383,44 +382,47 @@ func (suite *Suite) CreateNewUnbondedValidator(addr sdk.ValAddress, selfDelegati // New validators are created in an unbonded state. Note if the end blocker is run later this validator could become bonded. - validator, found := suite.App.GetStakingKeeper().GetValidator(suite.Ctx, addr) - suite.Require().True(found) + validator, err := suite.App.GetStakingKeeper().GetValidator(suite.Ctx, addr) + suite.Require().NoError(err) return validator } // NewBondCoin creates a Coin with the current staking denom. func (suite *Suite) NewBondCoin(amount sdkmath.Int) sdk.Coin { - stakingDenom := suite.App.GetStakingKeeper().BondDenom(suite.Ctx) + stakingDenom, err := suite.App.GetStakingKeeper().BondDenom(suite.Ctx) + suite.Require().NoError(err) + return sdk.NewCoin(stakingDenom, amount) } // CreateDelegation delegates tokens to a validator. -func (suite *Suite) CreateDelegation(valAddr sdk.ValAddress, delegator sdk.AccAddress, amount sdkmath.Int) sdk.Dec { +func (suite *Suite) CreateDelegation(valAddr sdk.ValAddress, delegator sdk.AccAddress, amount sdkmath.Int) sdkmath.LegacyDec { sk := suite.App.GetStakingKeeper() - stakingDenom := sk.BondDenom(suite.Ctx) + stakingDenom, err := sk.BondDenom(suite.Ctx) + suite.Require().NoError(err) msg := stakingtypes.NewMsgDelegate( - delegator, - valAddr, + delegator.String(), + valAddr.String(), sdk.NewCoin(stakingDenom, amount), ) msgServer := stakingkeeper.NewMsgServerImpl(sk) - _, err := msgServer.Delegate(sdk.WrapSDKContext(suite.Ctx), msg) + _, err = msgServer.Delegate(sdk.WrapSDKContext(suite.Ctx), msg) suite.Require().NoError(err) - del, found := sk.GetDelegation(suite.Ctx, delegator, valAddr) - suite.Require().True(found) + del, err := sk.GetDelegation(suite.Ctx, delegator, valAddr) + suite.Require().NoError(err) return del.Shares } func (suite *Suite) deliverMsgCreateValidator(ctx sdk.Context, address sdk.ValAddress, selfDelegation sdk.Coin) error { msg, err := stakingtypes.NewMsgCreateValidator( - address, + address.String(), ed25519.GenPrivKey().PubKey(), selfDelegation, - stakingtypes.Description{}, - stakingtypes.NewCommissionRates(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()), + stakingtypes.NewDescription("earn_moniker", "", "", "", ""), + stakingtypes.NewCommissionRates(sdkmath.LegacyZeroDec(), sdkmath.LegacyZeroDec(), sdkmath.LegacyZeroDec()), sdkmath.NewInt(1e6), ) if err != nil { diff --git a/x/earn/types/codec.go b/x/earn/types/codec.go index 8b773ff8f9..6a80adfd52 100644 --- a/x/earn/types/codec.go +++ b/x/earn/types/codec.go @@ -6,7 +6,6 @@ import ( cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" - authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec" govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) @@ -46,5 +45,5 @@ func init() { // Register all Amino interfaces and concrete types on the authz Amino codec so that this can later be // used to properly serialize MsgGrant and MsgExec instances - RegisterLegacyAminoCodec(authzcodec.Amino) + RegisterLegacyAminoCodec(codec.NewLegacyAmino()) } diff --git a/x/earn/types/expected_keepers.go b/x/earn/types/expected_keepers.go index e2533c884b..29ba5d277d 100644 --- a/x/earn/types/expected_keepers.go +++ b/x/earn/types/expected_keepers.go @@ -1,8 +1,9 @@ package types import ( + "context" + sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/auth/types" disttypes "github.com/cosmos/cosmos-sdk/x/distribution/types" hardtypes "github.com/kava-labs/kava/x/hard/types" @@ -11,27 +12,27 @@ import ( // AccountKeeper defines the expected account keeper type AccountKeeper interface { - GetAccount(ctx sdk.Context, addr sdk.AccAddress) types.AccountI - SetModuleAccount(sdk.Context, types.ModuleAccountI) + GetAccount(ctx context.Context, addr sdk.AccAddress) sdk.AccountI + SetModuleAccount(context.Context, sdk.ModuleAccountI) GetModuleAddress(name string) sdk.AccAddress - GetModuleAccount(ctx sdk.Context, name string) types.ModuleAccountI + GetModuleAccount(ctx context.Context, name string) sdk.ModuleAccountI } // BankKeeper defines the expected interface needed to retrieve account balances. type BankKeeper interface { - GetAllBalances(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins + GetAllBalances(ctx context.Context, addr sdk.AccAddress) sdk.Coins - SendCoinsFromModuleToModule(ctx sdk.Context, senderModule, recipientModule string, amt sdk.Coins) error - SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error - SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error + SendCoinsFromModuleToModule(ctx context.Context, senderModule, recipientModule string, amt sdk.Coins) error + SendCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error + SendCoinsFromAccountToModule(ctx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error } // DistributionKeeper defines the expected interface needed for community-pool deposits to earn vaults type DistributionKeeper interface { - GetFeePool(ctx sdk.Context) (feePool disttypes.FeePool) - SetFeePool(ctx sdk.Context, feePool disttypes.FeePool) - GetDistributionAccount(ctx sdk.Context) types.ModuleAccountI - DistributeFromFeePool(ctx sdk.Context, amount sdk.Coins, receiveAddr sdk.AccAddress) error + GetFeePool(ctx context.Context) (feePool disttypes.FeePool) + SetFeePool(ctx context.Context, feePool disttypes.FeePool) + GetDistributionAccount(ctx context.Context) sdk.ModuleAccountI + DistributeFromFeePool(ctx context.Context, amount sdk.Coins, receiveAddr sdk.AccAddress) error } // LiquidKeeper defines the expected interface needed for derivative to staked token conversions. @@ -58,6 +59,6 @@ type SavingsKeeper interface { // EarnHooks are event hooks called when a user's deposit to a earn vault changes. type EarnHooks interface { - AfterVaultDepositCreated(ctx sdk.Context, vaultDenom string, depositor sdk.AccAddress, sharesOwned sdk.Dec) - BeforeVaultDepositModified(ctx sdk.Context, vaultDenom string, depositor sdk.AccAddress, sharesOwned sdk.Dec) + AfterVaultDepositCreated(ctx context.Context, vaultDenom string, depositor sdk.AccAddress, sharesOwned sdkmath.LegacyDec) + BeforeVaultDepositModified(ctx context.Context, vaultDenom string, depositor sdk.AccAddress, sharesOwned sdkmath.LegacyDec) } diff --git a/x/earn/types/mocks/EarnHooks.go b/x/earn/types/mocks/EarnHooks.go index 97df2f1681..e7a812003d 100644 --- a/x/earn/types/mocks/EarnHooks.go +++ b/x/earn/types/mocks/EarnHooks.go @@ -3,6 +3,8 @@ package mocks import ( + "context" + sdkmath "cosmossdk.io/math" types "github.com/cosmos/cosmos-sdk/types" mock "github.com/stretchr/testify/mock" ) @@ -13,12 +15,12 @@ type EarnHooks struct { } // AfterVaultDepositCreated provides a mock function with given fields: ctx, vaultDenom, depositor, sharesOwned -func (_m *EarnHooks) AfterVaultDepositCreated(ctx types.Context, vaultDenom string, depositor types.AccAddress, sharesOwned types.Dec) { +func (_m *EarnHooks) AfterVaultDepositCreated(ctx context.Context, vaultDenom string, depositor types.AccAddress, sharesOwned sdkmath.LegacyDec) { _m.Called(ctx, vaultDenom, depositor, sharesOwned) } // BeforeVaultDepositModified provides a mock function with given fields: ctx, vaultDenom, depositor, sharesOwned -func (_m *EarnHooks) BeforeVaultDepositModified(ctx types.Context, vaultDenom string, depositor types.AccAddress, sharesOwned types.Dec) { +func (_m *EarnHooks) BeforeVaultDepositModified(ctx context.Context, vaultDenom string, depositor types.AccAddress, sharesOwned sdkmath.LegacyDec) { _m.Called(ctx, vaultDenom, depositor, sharesOwned) } diff --git a/x/earn/types/proposal.go b/x/earn/types/proposal.go index ee4433b8fb..887d585c40 100644 --- a/x/earn/types/proposal.go +++ b/x/earn/types/proposal.go @@ -5,7 +5,6 @@ import ( "strings" sdk "github.com/cosmos/cosmos-sdk/types" - govcodec "github.com/cosmos/cosmos-sdk/x/gov/codec" govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) @@ -24,9 +23,10 @@ var ( func init() { govv1beta1.RegisterProposalType(ProposalTypeCommunityPoolDeposit) - govcodec.ModuleCdc.Amino.RegisterConcrete(&CommunityPoolDepositProposal{}, "kava/CommunityPoolDepositProposal", nil) + //TODO(boodyvo): identify how to do this now + //govcodec.ModuleCdc.Amino.RegisterConcrete(&CommunityPoolDepositProposal{}, "kava/CommunityPoolDepositProposal", nil) govv1beta1.RegisterProposalType(ProposalTypeCommunityPoolWithdraw) - govcodec.ModuleCdc.Amino.RegisterConcrete(&CommunityPoolWithdrawProposal{}, "kava/CommunityPoolWithdrawProposal", nil) + //govcodec.ModuleCdc.Amino.RegisterConcrete(&CommunityPoolWithdrawProposal{}, "kava/CommunityPoolWithdrawProposal", nil) } // NewCommunityPoolDepositProposal creates a new community pool deposit proposal. diff --git a/x/earn/types/query.pb.go b/x/earn/types/query.pb.go index a470d300d4..2e012dc5bc 100644 --- a/x/earn/types/query.pb.go +++ b/x/earn/types/query.pb.go @@ -5,6 +5,7 @@ package types import ( context "context" + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" _ "github.com/cosmos/cosmos-proto" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" @@ -281,7 +282,7 @@ type VaultResponse struct { TotalShares string `protobuf:"bytes,5,opt,name=total_shares,json=totalShares,proto3" json:"total_shares,omitempty"` // TotalValue is the total value of denom coins supplied to the vault if the // vault were to be liquidated. - TotalValue github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,6,opt,name=total_value,json=totalValue,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"total_value"` + TotalValue cosmossdk_io_math.Int `protobuf:"bytes,6,opt,name=total_value,json=totalValue,proto3,customtype=cosmossdk.io/math.Int" json:"total_value"` } func (m *VaultResponse) Reset() { *m = VaultResponse{} } @@ -544,68 +545,69 @@ func init() { func init() { proto.RegisterFile("kava/earn/v1beta1/query.proto", fileDescriptor_63f8dee2f3192a6b) } var fileDescriptor_63f8dee2f3192a6b = []byte{ - // 971 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0xcf, 0x6f, 0x1b, 0x45, - 0x14, 0xf6, 0xda, 0xb1, 0x95, 0x3c, 0xd3, 0x42, 0x26, 0xa6, 0xd8, 0x2e, 0x59, 0x3b, 0x4b, 0x9b, - 0x98, 0x40, 0x76, 0x69, 0x2a, 0xc1, 0xa5, 0x20, 0x61, 0x22, 0xaa, 0x70, 0x40, 0x65, 0x13, 0x7a, - 0x40, 0x42, 0xd6, 0x38, 0x1e, 0x6d, 0x56, 0x71, 0x76, 0xb6, 0x3b, 0x63, 0x43, 0x40, 0x5c, 0xfa, - 0x0f, 0x80, 0xc4, 0x81, 0x03, 0x77, 0x0e, 0x3d, 0xf7, 0x8f, 0xc8, 0xb1, 0x2a, 0x17, 0xc4, 0xa1, - 0xa5, 0x09, 0x67, 0xce, 0x1c, 0xd1, 0xcc, 0xbc, 0xf5, 0x8f, 0xd8, 0x4e, 0x22, 0xd4, 0x53, 0xb2, - 0xef, 0xc7, 0xf7, 0x7d, 0x6f, 0xe6, 0xcd, 0x7b, 0x86, 0xe5, 0x03, 0xda, 0xa7, 0x1e, 0xa3, 0x49, - 0xe4, 0xf5, 0x6f, 0xb5, 0x99, 0xa4, 0xb7, 0xbc, 0x07, 0x3d, 0x96, 0x1c, 0xb9, 0x71, 0xc2, 0x25, - 0x27, 0x8b, 0xca, 0xed, 0x2a, 0xb7, 0x8b, 0xee, 0xea, 0xfa, 0x1e, 0x17, 0x87, 0x5c, 0x78, 0x6d, - 0x2a, 0x98, 0x89, 0x1d, 0x64, 0xc6, 0x34, 0x08, 0x23, 0x2a, 0x43, 0x1e, 0x99, 0xf4, 0xaa, 0x3d, - 0x1a, 0x9b, 0x46, 0xed, 0xf1, 0x30, 0xf5, 0x57, 0x8c, 0xbf, 0xa5, 0xbf, 0x3c, 0xf3, 0x81, 0xae, - 0x52, 0xc0, 0x03, 0x6e, 0xec, 0xea, 0x3f, 0xb4, 0xbe, 0x19, 0x70, 0x1e, 0x74, 0x99, 0x47, 0xe3, - 0xd0, 0xa3, 0x51, 0xc4, 0xa5, 0x66, 0x4b, 0x73, 0xec, 0xc9, 0x62, 0x62, 0x9a, 0xd0, 0xc3, 0xd4, - 0x5f, 0x9f, 0xf4, 0x0b, 0x99, 0x50, 0xc9, 0x02, 0xac, 0xb7, 0x3a, 0xe5, 0x38, 0xfa, 0xb4, 0xd7, - 0x95, 0xc6, 0xed, 0x94, 0x80, 0x7c, 0xa1, 0x2a, 0xbe, 0xa7, 0x51, 0x7d, 0xf6, 0xa0, 0xc7, 0x84, - 0x74, 0x3e, 0x87, 0xa5, 0x31, 0xab, 0x88, 0x79, 0x24, 0x18, 0xf9, 0x00, 0x0a, 0x86, 0xbd, 0x6c, - 0xd5, 0xad, 0x46, 0x71, 0xb3, 0xe2, 0x4e, 0x1c, 0xa6, 0x6b, 0x52, 0x9a, 0x73, 0xc7, 0xcf, 0x6a, - 0x19, 0x1f, 0xc3, 0x07, 0x2c, 0xf7, 0x15, 0xf3, 0x80, 0xe5, 0x4b, 0x64, 0x49, 0xad, 0xc8, 0xf2, - 0x11, 0x14, 0xb4, 0x42, 0xc5, 0x92, 0x6b, 0x14, 0x37, 0xeb, 0x53, 0x58, 0x74, 0x4a, 0x9a, 0x91, - 0x92, 0x99, 0x2c, 0xe7, 0x6d, 0x58, 0x1c, 0xc2, 0x22, 0x17, 0x29, 0x41, 0xbe, 0xc3, 0x22, 0x7e, - 0xa8, 0x95, 0x2f, 0xf8, 0xe6, 0xc3, 0xf1, 0x47, 0x75, 0x0d, 0x04, 0xdc, 0x81, 0xbc, 0x86, 0xc2, - 0x2a, 0x2f, 0xcb, 0x6f, 0x92, 0x9c, 0x7f, 0xb2, 0x70, 0x65, 0x1c, 0x6f, 0x2a, 0x37, 0xf1, 0x01, - 0xf0, 0xaa, 0x42, 0x26, 0xca, 0xd9, 0x7a, 0xae, 0x71, 0x75, 0xb3, 0x36, 0x85, 0x6a, 0x07, 0xef, - 0x73, 0xf7, 0x28, 0x66, 0xcd, 0xc5, 0x47, 0xcf, 0x6b, 0x57, 0x46, 0x2d, 0xc2, 0x1f, 0x41, 0x21, - 0x0d, 0x78, 0x2d, 0x54, 0xbd, 0x17, 0xf6, 0xa9, 0x64, 0x2d, 0x53, 0x44, 0xae, 0x6e, 0x35, 0xe6, - 0xfd, 0xab, 0xa1, 0xb8, 0x67, 0xcc, 0x5a, 0x1b, 0xb9, 0x0b, 0x84, 0x76, 0xbb, 0xfc, 0x1b, 0xd6, - 0x69, 0x75, 0x58, 0xcc, 0x45, 0x28, 0x79, 0x22, 0xca, 0x73, 0xf5, 0x5c, 0x63, 0xa1, 0x59, 0x7e, - 0xfa, 0x78, 0xa3, 0x84, 0xad, 0xfb, 0x71, 0xa7, 0x93, 0x30, 0x21, 0x76, 0x64, 0x12, 0x46, 0x81, - 0xbf, 0x88, 0x39, 0x5b, 0x83, 0x14, 0xb2, 0x02, 0xaf, 0x48, 0x2e, 0x69, 0xb7, 0x25, 0xf6, 0x69, - 0xc2, 0x44, 0x39, 0xaf, 0x6b, 0x2c, 0x6a, 0xdb, 0x8e, 0x36, 0x91, 0xaf, 0xc1, 0x7c, 0xb6, 0xfa, - 0xb4, 0xdb, 0x63, 0xe5, 0x82, 0x8a, 0x68, 0xde, 0x51, 0x67, 0xf6, 0xe7, 0xb3, 0xda, 0x6a, 0x10, - 0xca, 0xfd, 0x5e, 0xdb, 0xdd, 0xe3, 0x87, 0xf8, 0x5c, 0xf0, 0xcf, 0x86, 0xe8, 0x1c, 0x78, 0x52, - 0x95, 0xe8, 0x6e, 0x47, 0xf2, 0xe9, 0xe3, 0x0d, 0x40, 0x49, 0xdb, 0x91, 0xf4, 0x41, 0x03, 0xde, - 0x57, 0x78, 0xce, 0x0b, 0x0b, 0x4a, 0xfa, 0x16, 0x51, 0x55, 0xda, 0x5f, 0xe4, 0x7d, 0x58, 0x18, - 0xd4, 0x66, 0xce, 0xfe, 0x9c, 0xd2, 0x86, 0xa1, 0xc3, 0xfb, 0xca, 0x8e, 0xde, 0xd7, 0x6d, 0xb8, - 0xa6, 0xf5, 0xb7, 0xc2, 0xa8, 0x25, 0x24, 0x3d, 0x60, 0x9d, 0x96, 0xe4, 0x07, 0x2c, 0x12, 0x78, - 0xc2, 0x4b, 0xda, 0xbb, 0x1d, 0xed, 0x68, 0xdf, 0xae, 0x76, 0x91, 0x4f, 0x01, 0x86, 0x23, 0xa4, - 0x3c, 0xa7, 0xfb, 0x69, 0xd5, 0x45, 0x01, 0x6a, 0x86, 0xb8, 0x66, 0x36, 0x0d, 0x5f, 0x4f, 0xc0, - 0x50, 0xbe, 0x3f, 0x92, 0xe9, 0xfc, 0x66, 0xc1, 0xeb, 0x67, 0x6a, 0xc4, 0xe6, 0xda, 0x82, 0x79, - 0x54, 0x9e, 0xbe, 0x17, 0x67, 0x4a, 0x13, 0x61, 0xda, 0x99, 0x8e, 0x1d, 0x64, 0x92, 0xbb, 0x63, - 0x3a, 0xb3, 0x5a, 0xe7, 0xda, 0x85, 0x3a, 0x0d, 0xd8, 0x98, 0xd0, 0x7f, 0x2d, 0x78, 0xf5, 0x0c, - 0xd9, 0xff, 0xbe, 0x87, 0xcf, 0xa0, 0x80, 0x4d, 0x95, 0xd5, 0x85, 0x2d, 0xcf, 0x7a, 0x88, 0xba, - 0xcf, 0x9a, 0x4b, 0xaa, 0xa6, 0x47, 0xcf, 0x6b, 0xc5, 0xa1, 0x4d, 0xf8, 0x88, 0x40, 0xa8, 0x7a, - 0xd3, 0xaa, 0xfb, 0x72, 0x1a, 0xaa, 0x32, 0x56, 0x5b, 0x0a, 0xf6, 0x09, 0x0f, 0xa3, 0xe6, 0x7b, - 0x08, 0xd3, 0xb8, 0x44, 0x63, 0xaa, 0x04, 0xe1, 0x1b, 0x64, 0xa7, 0x02, 0x6f, 0xe8, 0x2b, 0xda, - 0xd5, 0xad, 0xdf, 0x8b, 0xe3, 0xee, 0x51, 0x3a, 0xe9, 0x7e, 0xb1, 0xa0, 0x3c, 0xe9, 0xc3, 0xe3, - 0xb9, 0x06, 0x85, 0x7d, 0x16, 0x06, 0xfb, 0x66, 0xde, 0xe4, 0x7c, 0xfc, 0x22, 0x7b, 0x50, 0x48, - 0x98, 0x50, 0x4f, 0x38, 0xfb, 0xf2, 0x35, 0x23, 0xf4, 0xe6, 0xaf, 0x79, 0xc8, 0x6b, 0x65, 0xe4, - 0x3b, 0x28, 0x98, 0xd9, 0x4d, 0x6e, 0x4e, 0x39, 0xe7, 0xc9, 0x25, 0x51, 0x5d, 0xbd, 0x28, 0xcc, - 0xd4, 0xe7, 0xac, 0x3c, 0xfc, 0xfd, 0xef, 0x9f, 0xb3, 0xd7, 0x49, 0xc5, 0x9b, 0xb5, 0xcc, 0x14, - 0xb7, 0x59, 0x02, 0xb3, 0xb9, 0xc7, 0x56, 0xc7, 0x6c, 0xee, 0xf1, 0x5d, 0x72, 0x2e, 0xb7, 0x59, - 0x17, 0xe4, 0xa1, 0x05, 0x79, 0x33, 0x13, 0x6f, 0x9c, 0x0b, 0x9a, 0x52, 0xdf, 0xbc, 0x20, 0x0a, - 0x99, 0xdf, 0xd5, 0xcc, 0xab, 0xe4, 0xc6, 0x4c, 0x66, 0xef, 0x7b, 0x3d, 0x58, 0x3e, 0x5c, 0x5f, - 0xff, 0x41, 0x89, 0x98, 0x4f, 0x9f, 0x36, 0x59, 0x9b, 0xc5, 0x70, 0x66, 0xc0, 0x55, 0x1b, 0x17, - 0x07, 0xa2, 0x9a, 0xb7, 0xb4, 0x9a, 0x65, 0x72, 0x7d, 0x8a, 0x9a, 0xc1, 0x10, 0xf8, 0xd1, 0x82, - 0xe2, 0x48, 0x83, 0x92, 0xf5, 0x59, 0xf0, 0x93, 0x1d, 0x5e, 0x7d, 0xe7, 0x52, 0xb1, 0xa8, 0x66, - 0x4d, 0xab, 0x59, 0x21, 0xb5, 0x29, 0x6a, 0x70, 0x99, 0xe8, 0x84, 0xe6, 0xd6, 0xf1, 0x0b, 0x3b, - 0x73, 0x7c, 0x62, 0x5b, 0x4f, 0x4e, 0x6c, 0xeb, 0xaf, 0x13, 0xdb, 0xfa, 0xe9, 0xd4, 0xce, 0x3c, - 0x39, 0xb5, 0x33, 0x7f, 0x9c, 0xda, 0x99, 0xaf, 0x46, 0x57, 0x87, 0x02, 0xda, 0xe8, 0xd2, 0xb6, - 0x30, 0x90, 0xdf, 0x1a, 0x50, 0xdd, 0xf1, 0xed, 0x82, 0xfe, 0xa9, 0x73, 0xfb, 0xbf, 0x00, 0x00, - 0x00, 0xff, 0xff, 0xb7, 0x20, 0xeb, 0xea, 0x1a, 0x0a, 0x00, 0x00, + // 977 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0x4f, 0x6f, 0x1b, 0x45, + 0x14, 0xf7, 0xda, 0xb1, 0x95, 0x3c, 0xd3, 0x42, 0x26, 0x6e, 0xb1, 0x5d, 0xb2, 0x76, 0x96, 0x36, + 0x31, 0x29, 0xd9, 0xa5, 0xa9, 0x04, 0x17, 0x40, 0xc2, 0x44, 0x54, 0x41, 0x08, 0x95, 0x4d, 0xe8, + 0x81, 0x8b, 0x35, 0x8e, 0x47, 0xeb, 0x95, 0xed, 0x9d, 0xed, 0xce, 0xd8, 0x10, 0x10, 0x97, 0x7e, + 0x01, 0x90, 0x38, 0x70, 0xe0, 0xce, 0xa1, 0xe7, 0x7e, 0x88, 0x1c, 0xab, 0x72, 0x41, 0x48, 0xb4, + 0x34, 0xe1, 0x43, 0x70, 0x44, 0xf3, 0x67, 0xed, 0x75, 0xbc, 0x8e, 0x23, 0xc4, 0x29, 0xd9, 0x79, + 0xef, 0xf7, 0xe7, 0xcd, 0xbc, 0x79, 0x63, 0x58, 0xef, 0xe1, 0x11, 0x76, 0x08, 0x8e, 0x02, 0x67, + 0x74, 0xa7, 0x4d, 0x38, 0xbe, 0xe3, 0x3c, 0x1c, 0x92, 0xe8, 0xd8, 0x0e, 0x23, 0xca, 0x29, 0x5a, + 0x15, 0x61, 0x5b, 0x84, 0x6d, 0x1d, 0xae, 0x6e, 0x1f, 0x51, 0x36, 0xa0, 0xcc, 0x69, 0x63, 0x46, + 0x54, 0xee, 0x18, 0x19, 0x62, 0xcf, 0x0f, 0x30, 0xf7, 0x69, 0xa0, 0xe0, 0x55, 0x33, 0x99, 0x1b, + 0x67, 0x1d, 0x51, 0x3f, 0x8e, 0x57, 0x54, 0xbc, 0x25, 0xbf, 0x1c, 0xf5, 0xa1, 0x43, 0x25, 0x8f, + 0x7a, 0x54, 0xad, 0x8b, 0xff, 0xf4, 0xea, 0x1b, 0x1e, 0xa5, 0x5e, 0x9f, 0x38, 0x38, 0xf4, 0x1d, + 0x1c, 0x04, 0x94, 0x4b, 0xb5, 0x18, 0x63, 0xce, 0x16, 0x13, 0xe2, 0x08, 0x0f, 0xe2, 0x78, 0x7d, + 0x36, 0xce, 0x78, 0x84, 0x39, 0xf1, 0x74, 0xbd, 0xd5, 0x94, 0xed, 0x18, 0xe1, 0x61, 0x9f, 0xab, + 0xb0, 0x55, 0x02, 0xf4, 0x85, 0xa8, 0xf8, 0xbe, 0x64, 0x75, 0xc9, 0xc3, 0x21, 0x61, 0xdc, 0xfa, + 0x1c, 0xd6, 0xa6, 0x56, 0x59, 0x48, 0x03, 0x46, 0xd0, 0x7b, 0x50, 0x50, 0xea, 0x65, 0xa3, 0x6e, + 0x34, 0x8a, 0xbb, 0x15, 0x7b, 0x66, 0x33, 0x6d, 0x05, 0x69, 0x2e, 0x9d, 0x3c, 0xaf, 0x65, 0x5c, + 0x9d, 0x3e, 0x56, 0x79, 0x20, 0x94, 0xc7, 0x2a, 0x5f, 0x6a, 0x95, 0x78, 0x55, 0xab, 0x7c, 0x08, + 0x05, 0xe9, 0x50, 0xa8, 0xe4, 0x1a, 0xc5, 0xdd, 0x7a, 0x8a, 0x8a, 0x84, 0xc4, 0x88, 0x58, 0x4c, + 0xa1, 0xac, 0xb7, 0x60, 0x75, 0x42, 0xab, 0xb5, 0x50, 0x09, 0xf2, 0x1d, 0x12, 0xd0, 0x81, 0x74, + 0xbe, 0xe2, 0xaa, 0x0f, 0xcb, 0x4d, 0xfa, 0x1a, 0x1b, 0x78, 0x1f, 0xf2, 0x92, 0x4a, 0x57, 0x79, + 0x59, 0x7d, 0x05, 0xb2, 0xfe, 0xcc, 0xc2, 0x95, 0x69, 0xbe, 0x54, 0x6d, 0xe4, 0x02, 0xe8, 0xa3, + 0xf2, 0x09, 0x2b, 0x67, 0xeb, 0xb9, 0xc6, 0xd5, 0xdd, 0x5a, 0x8a, 0xd4, 0x81, 0x3e, 0xcf, 0xc3, + 0xe3, 0x90, 0x34, 0x57, 0x1f, 0xbf, 0xa8, 0x5d, 0x49, 0xae, 0x30, 0x37, 0xc1, 0x82, 0x1a, 0xf0, + 0x9a, 0x2f, 0x7a, 0xcf, 0x1f, 0x61, 0x4e, 0x5a, 0xaa, 0x88, 0x5c, 0xdd, 0x68, 0x2c, 0xbb, 0x57, + 0x7d, 0x76, 0x5f, 0x2d, 0x4b, 0x6f, 0xe8, 0x1e, 0x20, 0xdc, 0xef, 0xd3, 0xaf, 0x49, 0xa7, 0xd5, + 0x21, 0x21, 0x65, 0x3e, 0xa7, 0x11, 0x2b, 0x2f, 0xd5, 0x73, 0x8d, 0x95, 0x66, 0xf9, 0xd9, 0x93, + 0x9d, 0x92, 0x6e, 0xdd, 0x8f, 0x3a, 0x9d, 0x88, 0x30, 0x76, 0xc0, 0x23, 0x3f, 0xf0, 0xdc, 0x55, + 0x8d, 0xd9, 0x1b, 0x43, 0xd0, 0x06, 0xbc, 0xc2, 0x29, 0xc7, 0xfd, 0x16, 0xeb, 0xe2, 0x88, 0xb0, + 0x72, 0x5e, 0xd6, 0x58, 0x94, 0x6b, 0x07, 0x72, 0x09, 0x7d, 0x06, 0xea, 0xb3, 0x35, 0xc2, 0xfd, + 0x21, 0x29, 0x17, 0x44, 0x46, 0xf3, 0xb6, 0xd8, 0xb3, 0x3f, 0x9e, 0xd7, 0xae, 0x29, 0x21, 0xd6, + 0xe9, 0xd9, 0x3e, 0x75, 0x06, 0x98, 0x77, 0xed, 0xfd, 0x80, 0x3f, 0x7b, 0xb2, 0x03, 0xda, 0xc1, + 0x7e, 0xc0, 0x5d, 0x90, 0xf8, 0x07, 0x02, 0x6e, 0xbd, 0x34, 0xa0, 0x24, 0x0f, 0x4d, 0x9b, 0x88, + 0xdb, 0x09, 0xbd, 0x0b, 0x2b, 0xe3, 0x52, 0xd4, 0x56, 0x5f, 0x50, 0xc9, 0x24, 0x75, 0x72, 0x3c, + 0xd9, 0xe4, 0xf1, 0xdc, 0x85, 0xeb, 0xd2, 0x6e, 0xcb, 0x0f, 0x5a, 0x8c, 0xe3, 0x1e, 0xe9, 0xb4, + 0x38, 0xed, 0x91, 0x80, 0xe9, 0x0d, 0x5d, 0x93, 0xd1, 0xfd, 0xe0, 0x40, 0xc6, 0x0e, 0x65, 0x08, + 0x7d, 0x02, 0x30, 0x99, 0x18, 0xe5, 0x25, 0xd9, 0x3e, 0x9b, 0xb6, 0x36, 0x20, 0x46, 0x86, 0xad, + 0x46, 0xd1, 0xe4, 0xb2, 0x78, 0x44, 0xdb, 0x77, 0x13, 0x48, 0xeb, 0x57, 0x03, 0xae, 0x9d, 0xab, + 0x51, 0xf7, 0xd2, 0x1e, 0x2c, 0x6b, 0xe7, 0xf1, 0xf5, 0xb0, 0x52, 0x7a, 0x46, 0xc3, 0xce, 0x35, + 0xe8, 0x18, 0x89, 0xee, 0x4d, 0xf9, 0xcc, 0x4a, 0x9f, 0x5b, 0x0b, 0x7d, 0x2a, 0xb2, 0x29, 0xa3, + 0xff, 0x18, 0xf0, 0xea, 0x39, 0xb1, 0xff, 0x7c, 0x0e, 0x9f, 0x42, 0x41, 0xf7, 0x50, 0x56, 0x16, + 0xb6, 0x3e, 0xef, 0xde, 0xc9, 0xb6, 0x6a, 0xae, 0x89, 0x9a, 0x1e, 0xbf, 0xa8, 0x15, 0x27, 0x6b, + 0xcc, 0xd5, 0x0c, 0x08, 0x8b, 0x2b, 0x2c, 0x9a, 0x2d, 0x27, 0xa9, 0x2a, 0x53, 0xb5, 0xc5, 0x64, + 0x1f, 0x53, 0x3f, 0x68, 0xbe, 0xa3, 0x69, 0x1a, 0x9e, 0xcf, 0xbb, 0xc3, 0xb6, 0x7d, 0x44, 0x07, + 0x7a, 0x6c, 0xeb, 0x3f, 0x3b, 0xac, 0xd3, 0x73, 0xb8, 0xb8, 0x6a, 0x12, 0xc0, 0x5c, 0xc5, 0x6c, + 0x55, 0xe0, 0x75, 0x79, 0x44, 0x87, 0xb2, 0xd3, 0x87, 0x61, 0xd8, 0x3f, 0x8e, 0x07, 0xdb, 0xcf, + 0x06, 0x94, 0x67, 0x63, 0x7a, 0x7b, 0xae, 0x43, 0xa1, 0x4b, 0x7c, 0xaf, 0xab, 0xc6, 0x4b, 0xce, + 0xd5, 0x5f, 0xe8, 0x08, 0x0a, 0x11, 0x61, 0xe2, 0xc6, 0x66, 0xff, 0x7f, 0xcf, 0x9a, 0x7a, 0xf7, + 0x97, 0x3c, 0xe4, 0xa5, 0x33, 0xf4, 0x2d, 0x14, 0xd4, 0xa8, 0x46, 0xb7, 0x52, 0xf6, 0x79, 0xf6, + 0x4d, 0xa8, 0x6e, 0x2e, 0x4a, 0x53, 0xf5, 0x59, 0x1b, 0x8f, 0x7e, 0xfb, 0xfb, 0xa7, 0xec, 0x0d, + 0x54, 0x71, 0xe6, 0xbd, 0x5d, 0x42, 0x5b, 0xcd, 0xfc, 0xf9, 0xda, 0x53, 0x2f, 0xc5, 0x7c, 0xed, + 0xe9, 0xa7, 0xe3, 0x42, 0x6d, 0xf5, 0x3a, 0xa0, 0x47, 0x06, 0xe4, 0xd5, 0x08, 0xbc, 0x79, 0x21, + 0x69, 0x2c, 0x7d, 0x6b, 0x41, 0x96, 0x56, 0x7e, 0x5b, 0x2a, 0x6f, 0xa2, 0x9b, 0x73, 0x95, 0x9d, + 0xef, 0xe4, 0x60, 0xf9, 0x60, 0x7b, 0xfb, 0x7b, 0x61, 0x62, 0x39, 0xbe, 0xda, 0x68, 0x6b, 0x9e, + 0xc2, 0xb9, 0x01, 0x57, 0x6d, 0x2c, 0x4e, 0xd4, 0x6e, 0xde, 0x94, 0x6e, 0xd6, 0xd1, 0x8d, 0x14, + 0x37, 0xe3, 0x21, 0xf0, 0x83, 0x01, 0xc5, 0x44, 0x83, 0xa2, 0xed, 0x79, 0xf4, 0xb3, 0x1d, 0x5e, + 0xbd, 0x7d, 0xa9, 0x5c, 0xed, 0x66, 0x4b, 0xba, 0xd9, 0x40, 0xb5, 0x14, 0x37, 0xfa, 0xed, 0x90, + 0x80, 0xe6, 0xde, 0xc9, 0x4b, 0x33, 0x73, 0x72, 0x6a, 0x1a, 0x4f, 0x4f, 0x4d, 0xe3, 0xaf, 0x53, + 0xd3, 0xf8, 0xf1, 0xcc, 0xcc, 0x3c, 0x3d, 0x33, 0x33, 0xbf, 0x9f, 0x99, 0x99, 0xaf, 0x36, 0x13, + 0xdd, 0x2e, 0x88, 0x76, 0xfa, 0xb8, 0xcd, 0x14, 0xe5, 0x37, 0x8a, 0x54, 0x76, 0x7c, 0xbb, 0x20, + 0x7f, 0xd9, 0xdc, 0xfd, 0x37, 0x00, 0x00, 0xff, 0xff, 0x46, 0x7b, 0x31, 0x2c, 0x09, 0x0a, 0x00, + 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -813,6 +815,7 @@ func _Query_TotalSupply_Handler(srv interface{}, ctx context.Context, dec func(i return interceptor(ctx, in, info, handler) } +var Query_serviceDesc = _Query_serviceDesc var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "kava.earn.v1beta1.Query", HandlerType: (*QueryServer)(nil), diff --git a/x/earn/types/share.go b/x/earn/types/share.go index 1e6d15311b..fc7dc2de08 100644 --- a/x/earn/types/share.go +++ b/x/earn/types/share.go @@ -1,6 +1,7 @@ package types import ( + sdkmath "cosmossdk.io/math" fmt "fmt" "sort" "strings" @@ -10,7 +11,7 @@ import ( ) // NewVaultShare returns a new VaultShare -func NewVaultShare(denom string, amount sdk.Dec) VaultShare { +func NewVaultShare(denom string, amount sdkmath.LegacyDec) VaultShare { share := VaultShare{ Denom: denom, Amount: amount, @@ -284,14 +285,14 @@ func (shares VaultShares) negative() VaultShares { } // AmountOf returns the amount of shares of the given denom. -func (shares VaultShares) AmountOf(denom string) sdk.Dec { +func (shares VaultShares) AmountOf(denom string) sdkmath.LegacyDec { for _, s := range shares { if s.Denom == denom { return s.Amount } } - return sdk.ZeroDec() + return sdkmath.LegacyZeroDec() } // GetShare the single share of the given denom. @@ -302,7 +303,7 @@ func (shares VaultShares) GetShare(denom string) VaultShare { } } - return NewVaultShare(denom, sdk.ZeroDec()) + return NewVaultShare(denom, sdkmath.LegacyZeroDec()) } // IsZero returns true if the VaultShares is empty. diff --git a/x/earn/types/share_test.go b/x/earn/types/share_test.go index 083417367c..bb2340a873 100644 --- a/x/earn/types/share_test.go +++ b/x/earn/types/share_test.go @@ -1,13 +1,12 @@ package types_test import ( + sdkmath "cosmossdk.io/math" "strings" "testing" "github.com/kava-labs/kava/x/earn/types" "github.com/stretchr/testify/suite" - - sdk "github.com/cosmos/cosmos-sdk/types" ) var ( @@ -15,8 +14,8 @@ var ( testDenom2 = "usdx" ) -func d(i int64) sdk.Dec { - return sdk.NewDec(i) +func d(i int64) sdkmath.LegacyDec { + return sdkmath.LegacyNewDec(i) } type vaultShareTestSuite struct { @@ -29,23 +28,23 @@ func TestVaultShareTestSuite(t *testing.T) { func (s *vaultShareTestSuite) TestNewVaultShareFromDec() { s.Require().NotPanics(func() { - types.NewVaultShare(testDenom1, sdk.NewDec(5)) + types.NewVaultShare(testDenom1, sdkmath.LegacyNewDec(5)) }) s.Require().NotPanics(func() { - types.NewVaultShare(testDenom1, sdk.ZeroDec()) + types.NewVaultShare(testDenom1, sdkmath.LegacyZeroDec()) }) s.Require().NotPanics(func() { - types.NewVaultShare(strings.ToUpper(testDenom1), sdk.NewDec(5)) + types.NewVaultShare(strings.ToUpper(testDenom1), sdkmath.LegacyNewDec(5)) }) s.Require().Panics(func() { - types.NewVaultShare(testDenom1, sdk.NewDec(-5)) + types.NewVaultShare(testDenom1, sdkmath.LegacyNewDec(-5)) }) } func (s *vaultShareTestSuite) TestAddVaultShare() { - vaultShareA1 := types.NewVaultShare(testDenom1, sdk.NewDecWithPrec(11, 1)) - vaultShareA2 := types.NewVaultShare(testDenom1, sdk.NewDecWithPrec(22, 1)) - vaultShareB1 := types.NewVaultShare(testDenom2, sdk.NewDecWithPrec(11, 1)) + vaultShareA1 := types.NewVaultShare(testDenom1, sdkmath.LegacyNewDecWithPrec(11, 1)) + vaultShareA2 := types.NewVaultShare(testDenom1, sdkmath.LegacyNewDecWithPrec(22, 1)) + vaultShareB1 := types.NewVaultShare(testDenom2, sdkmath.LegacyNewDecWithPrec(11, 1)) // regular add res := vaultShareA1.Add(vaultShareA1) @@ -58,9 +57,9 @@ func (s *vaultShareTestSuite) TestAddVaultShare() { } func (s *vaultShareTestSuite) TestAddVaultShares() { - one := sdk.NewDec(1) - zero := sdk.NewDec(0) - two := sdk.NewDec(2) + one := sdkmath.LegacyNewDec(1) + zero := sdkmath.LegacyNewDec(0) + two := sdkmath.LegacyNewDec(2) cases := []struct { inputOne types.VaultShares @@ -123,11 +122,11 @@ func (s *vaultShareTestSuite) TestFilteredZeroVaultShares() { { name: "all greater than zero", input: types.VaultShares{ - {"testa", sdk.NewDec(1)}, - {"testb", sdk.NewDec(2)}, - {"testc", sdk.NewDec(3)}, - {"testd", sdk.NewDec(4)}, - {"teste", sdk.NewDec(5)}, + {"testa", sdkmath.LegacyNewDec(1)}, + {"testb", sdkmath.LegacyNewDec(2)}, + {"testc", sdkmath.LegacyNewDec(3)}, + {"testd", sdkmath.LegacyNewDec(4)}, + {"teste", sdkmath.LegacyNewDec(5)}, }, original: "1.000000000000000000testa,2.000000000000000000testb,3.000000000000000000testc,4.000000000000000000testd,5.000000000000000000teste", expected: "1.000000000000000000testa,2.000000000000000000testb,3.000000000000000000testc,4.000000000000000000testd,5.000000000000000000teste", @@ -135,11 +134,11 @@ func (s *vaultShareTestSuite) TestFilteredZeroVaultShares() { { name: "zero share in middle", input: types.VaultShares{ - {"testa", sdk.NewDec(1)}, - {"testb", sdk.NewDec(2)}, - {"testc", sdk.NewDec(0)}, - {"testd", sdk.NewDec(4)}, - {"teste", sdk.NewDec(5)}, + {"testa", sdkmath.LegacyNewDec(1)}, + {"testb", sdkmath.LegacyNewDec(2)}, + {"testc", sdkmath.LegacyNewDec(0)}, + {"testd", sdkmath.LegacyNewDec(4)}, + {"teste", sdkmath.LegacyNewDec(5)}, }, original: "1.000000000000000000testa,2.000000000000000000testb,0.000000000000000000testc,4.000000000000000000testd,5.000000000000000000teste", expected: "1.000000000000000000testa,2.000000000000000000testb,4.000000000000000000testd,5.000000000000000000teste", @@ -147,11 +146,11 @@ func (s *vaultShareTestSuite) TestFilteredZeroVaultShares() { { name: "zero share end (unordered)", input: types.VaultShares{ - {"teste", sdk.NewDec(5)}, - {"testc", sdk.NewDec(3)}, - {"testa", sdk.NewDec(1)}, - {"testd", sdk.NewDec(4)}, - {"testb", sdk.NewDec(0)}, + {"teste", sdkmath.LegacyNewDec(5)}, + {"testc", sdkmath.LegacyNewDec(3)}, + {"testa", sdkmath.LegacyNewDec(1)}, + {"testd", sdkmath.LegacyNewDec(4)}, + {"testb", sdkmath.LegacyNewDec(0)}, }, original: "5.000000000000000000teste,3.000000000000000000testc,1.000000000000000000testa,4.000000000000000000testd,0.000000000000000000testb", expected: "1.000000000000000000testa,3.000000000000000000testc,4.000000000000000000testd,5.000000000000000000teste", @@ -172,22 +171,22 @@ func (s *vaultShareTestSuite) TestIsValid() { msg string }{ { - types.NewVaultShare("mytoken", sdk.NewDec(10)), + types.NewVaultShare("mytoken", sdkmath.LegacyNewDec(10)), true, "valid shares should have passed", }, { - types.VaultShare{Denom: "BTC", Amount: sdk.NewDec(10)}, + types.VaultShare{Denom: "BTC", Amount: sdkmath.LegacyNewDec(10)}, true, "valid uppercase denom", }, { - types.VaultShare{Denom: "Bitshare", Amount: sdk.NewDec(10)}, + types.VaultShare{Denom: "Bitshare", Amount: sdkmath.LegacyNewDec(10)}, true, "valid mixed case denom", }, { - types.VaultShare{Denom: "btc", Amount: sdk.NewDec(-10)}, + types.VaultShare{Denom: "btc", Amount: sdkmath.LegacyNewDec(-10)}, false, "negative amount", }, @@ -210,23 +209,23 @@ func (s *vaultShareTestSuite) TestSubVaultShare() { msg string }{ { - types.NewVaultShare("mytoken", sdk.NewDec(20)), + types.NewVaultShare("mytoken", sdkmath.LegacyNewDec(20)), true, "valid shares should have passed", }, { - types.NewVaultShare("othertoken", sdk.NewDec(20)), + types.NewVaultShare("othertoken", sdkmath.LegacyNewDec(20)), false, "denom mismatch", }, { - types.NewVaultShare("mytoken", sdk.NewDec(9)), + types.NewVaultShare("mytoken", sdkmath.LegacyNewDec(9)), false, "negative amount", }, } - vaultShare := types.NewVaultShare("mytoken", sdk.NewDec(10)) + vaultShare := types.NewVaultShare("mytoken", sdkmath.LegacyNewDec(10)) for _, tc := range tests { tc := tc @@ -256,7 +255,7 @@ func (s *vaultShareTestSuite) TestSubVaultShares() { "unorted shares should panic", }, { - types.VaultShares{types.VaultShare{Denom: "BTC", Amount: sdk.NewDec(10)}, types.NewVaultShare("eth", d(15)), types.NewVaultShare("mytoken", d(5))}, + types.VaultShares{types.VaultShare{Denom: "BTC", Amount: sdkmath.LegacyNewDec(10)}, types.NewVaultShare("eth", d(15)), types.NewVaultShare("mytoken", d(5))}, false, "invalid denoms", }, @@ -330,16 +329,16 @@ func (s *vaultShareTestSuite) TestVaultSharesValidate() { expectedPass bool }{ {types.VaultShares{}, true}, - {types.VaultShares{types.VaultShare{testDenom1, sdk.NewDec(5)}}, true}, - {types.VaultShares{types.VaultShare{testDenom1, sdk.NewDec(5)}, types.VaultShare{testDenom2, sdk.NewDec(100000)}}, true}, - {types.VaultShares{types.VaultShare{testDenom1, sdk.NewDec(-5)}}, false}, - {types.VaultShares{types.VaultShare{"BTC", sdk.NewDec(5)}}, true}, - {types.VaultShares{types.VaultShare{"0BTC", sdk.NewDec(5)}}, false}, - {types.VaultShares{types.VaultShare{testDenom1, sdk.NewDec(5)}, types.VaultShare{"B", sdk.NewDec(100000)}}, false}, - {types.VaultShares{types.VaultShare{testDenom1, sdk.NewDec(5)}, types.VaultShare{testDenom2, sdk.NewDec(-100000)}}, false}, - {types.VaultShares{types.VaultShare{testDenom1, sdk.NewDec(-5)}, types.VaultShare{testDenom2, sdk.NewDec(100000)}}, false}, - {types.VaultShares{types.VaultShare{"BTC", sdk.NewDec(5)}, types.VaultShare{testDenom2, sdk.NewDec(100000)}}, true}, - {types.VaultShares{types.VaultShare{"0BTC", sdk.NewDec(5)}, types.VaultShare{testDenom2, sdk.NewDec(100000)}}, false}, + {types.VaultShares{types.VaultShare{testDenom1, sdkmath.LegacyNewDec(5)}}, true}, + {types.VaultShares{types.VaultShare{testDenom1, sdkmath.LegacyNewDec(5)}, types.VaultShare{testDenom2, sdkmath.LegacyNewDec(100000)}}, true}, + {types.VaultShares{types.VaultShare{testDenom1, sdkmath.LegacyNewDec(-5)}}, false}, + {types.VaultShares{types.VaultShare{"BTC", sdkmath.LegacyNewDec(5)}}, true}, + {types.VaultShares{types.VaultShare{"0BTC", sdkmath.LegacyNewDec(5)}}, false}, + {types.VaultShares{types.VaultShare{testDenom1, sdkmath.LegacyNewDec(5)}, types.VaultShare{"B", sdkmath.LegacyNewDec(100000)}}, false}, + {types.VaultShares{types.VaultShare{testDenom1, sdkmath.LegacyNewDec(5)}, types.VaultShare{testDenom2, sdkmath.LegacyNewDec(-100000)}}, false}, + {types.VaultShares{types.VaultShare{testDenom1, sdkmath.LegacyNewDec(-5)}, types.VaultShare{testDenom2, sdkmath.LegacyNewDec(100000)}}, false}, + {types.VaultShares{types.VaultShare{"BTC", sdkmath.LegacyNewDec(5)}, types.VaultShare{testDenom2, sdkmath.LegacyNewDec(100000)}}, true}, + {types.VaultShares{types.VaultShare{"0BTC", sdkmath.LegacyNewDec(5)}, types.VaultShare{testDenom2, sdkmath.LegacyNewDec(100000)}}, false}, } for i, tc := range testCases { @@ -360,8 +359,8 @@ func (s *vaultShareTestSuite) TestVaultSharesString() { {types.VaultShares{}, ""}, { types.VaultShares{ - types.NewVaultShare("atom", sdk.NewDecWithPrec(5040000000000000000, sdk.Precision)), - types.NewVaultShare("stake", sdk.NewDecWithPrec(4000000000000000, sdk.Precision)), + types.NewVaultShare("atom", sdkmath.LegacyNewDecWithPrec(5040000000000000000, sdkmath.LegacyPrecision)), + types.NewVaultShare("stake", sdkmath.LegacyNewDecWithPrec(4000000000000000, sdkmath.LegacyPrecision)), }, "5.040000000000000000atom,0.004000000000000000stake", }, @@ -374,8 +373,8 @@ func (s *vaultShareTestSuite) TestVaultSharesString() { } func (s *vaultShareTestSuite) TestNewVaultSharesWithIsValid() { - fake1 := append(types.NewVaultShares(types.NewVaultShare("mytoken", d(10))), types.VaultShare{Denom: "10BTC", Amount: sdk.NewDec(10)}) - fake2 := append(types.NewVaultShares(types.NewVaultShare("mytoken", d(10))), types.VaultShare{Denom: "BTC", Amount: sdk.NewDec(-10)}) + fake1 := append(types.NewVaultShares(types.NewVaultShare("mytoken", d(10))), types.VaultShare{Denom: "10BTC", Amount: sdkmath.LegacyNewDec(10)}) + fake2 := append(types.NewVaultShares(types.NewVaultShare("mytoken", d(10))), types.VaultShare{Denom: "BTC", Amount: sdkmath.LegacyNewDec(-10)}) tests := []struct { share types.VaultShares @@ -410,7 +409,7 @@ func (s *vaultShareTestSuite) TestNewVaultSharesWithIsValid() { } func (s *vaultShareTestSuite) TestVaultShares_AddVaultShareWithIsValid() { - lengthTestVaultShares := types.NewVaultShares().Add(types.NewVaultShare("mytoken", d(10))).Add(types.VaultShare{Denom: "BTC", Amount: sdk.NewDec(10)}) + lengthTestVaultShares := types.NewVaultShares().Add(types.NewVaultShare("mytoken", d(10))).Add(types.VaultShare{Denom: "BTC", Amount: sdkmath.LegacyNewDec(10)}) s.Require().Equal(2, len(lengthTestVaultShares), "should be 2") tests := []struct { @@ -424,12 +423,12 @@ func (s *vaultShareTestSuite) TestVaultShares_AddVaultShareWithIsValid() { "valid shares should have passed", }, { - types.NewVaultShares().Add(types.NewVaultShare("mytoken", d(10))).Add(types.VaultShare{Denom: "0BTC", Amount: sdk.NewDec(10)}), + types.NewVaultShares().Add(types.NewVaultShare("mytoken", d(10))).Add(types.VaultShare{Denom: "0BTC", Amount: sdkmath.LegacyNewDec(10)}), false, "invalid denoms", }, { - types.NewVaultShares().Add(types.NewVaultShare("mytoken", d(10))).Add(types.VaultShare{Denom: "BTC", Amount: sdk.NewDec(-10)}), + types.NewVaultShares().Add(types.NewVaultShare("mytoken", d(10))).Add(types.VaultShare{Denom: "BTC", Amount: sdkmath.LegacyNewDec(-10)}), false, "negative amount", }, diff --git a/x/earn/types/tx.pb.go b/x/earn/types/tx.pb.go index 44555c8d42..a26b27b59a 100644 --- a/x/earn/types/tx.pb.go +++ b/x/earn/types/tx.pb.go @@ -352,6 +352,7 @@ func _Msg_Withdraw_Handler(srv interface{}, ctx context.Context, dec func(interf return interceptor(ctx, in, info, handler) } +var Msg_serviceDesc = _Msg_serviceDesc var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "kava.earn.v1beta1.Msg", HandlerType: (*MsgServer)(nil), diff --git a/x/earn/types/vault.go b/x/earn/types/vault.go index 907c25e1e5..9230172e23 100644 --- a/x/earn/types/vault.go +++ b/x/earn/types/vault.go @@ -1,6 +1,7 @@ package types import ( + sdkmath "cosmossdk.io/math" "fmt" errorsmod "cosmossdk.io/errors" @@ -8,7 +9,7 @@ import ( ) // NewVaultRecord returns a new VaultRecord with 0 supply. -func NewVaultRecord(vaultDenom string, amount sdk.Dec) VaultRecord { +func NewVaultRecord(vaultDenom string, amount sdkmath.LegacyDec) VaultRecord { return VaultRecord{ TotalShares: NewVaultShare(vaultDenom, amount), } diff --git a/x/earn/types/vault.pb.go b/x/earn/types/vault.pb.go index 55b37c2e78..e672d7d028 100644 --- a/x/earn/types/vault.pb.go +++ b/x/earn/types/vault.pb.go @@ -4,6 +4,7 @@ package types import ( + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" _ "github.com/cosmos/cosmos-proto" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" @@ -206,8 +207,8 @@ func (m *VaultShareRecord) GetShares() VaultShares { // VaultShare defines shares of a vault owned by a depositor. type VaultShare struct { - Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` - Amount github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"amount"` + Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` + Amount cosmossdk_io_math.LegacyDec `protobuf:"bytes,2,opt,name=amount,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"amount"` } func (m *VaultShare) Reset() { *m = VaultShare{} } @@ -259,38 +260,39 @@ func init() { func init() { proto.RegisterFile("kava/earn/v1beta1/vault.proto", fileDescriptor_884eb89509fbdc04) } var fileDescriptor_884eb89509fbdc04 = []byte{ - // 487 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x53, 0x3f, 0x6f, 0xd3, 0x40, - 0x14, 0xb7, 0x93, 0x10, 0xd1, 0x4b, 0xa8, 0x1a, 0xb7, 0x83, 0xa9, 0x54, 0xdb, 0xca, 0x80, 0xbc, - 0xd8, 0x56, 0xcb, 0x86, 0x18, 0x88, 0x15, 0x21, 0xc4, 0x84, 0xae, 0x85, 0x81, 0x25, 0xba, 0xd8, - 0x47, 0x6a, 0xd5, 0xc9, 0x45, 0x7e, 0x17, 0x97, 0x2c, 0x7c, 0x06, 0x46, 0x24, 0x16, 0xe6, 0xce, - 0xfd, 0x0c, 0xa8, 0x63, 0xd5, 0x09, 0x31, 0xa4, 0x28, 0xf9, 0x16, 0x4c, 0xe8, 0xfe, 0xa8, 0x8e, - 0x14, 0x10, 0x0c, 0x4c, 0xb9, 0xfb, 0xbd, 0xf7, 0x7e, 0x7f, 0x5e, 0x7c, 0xe8, 0xe0, 0x8c, 0x94, - 0x24, 0xa2, 0xa4, 0x98, 0x44, 0xe5, 0xe1, 0x90, 0x72, 0x72, 0x18, 0x95, 0x64, 0x96, 0xf3, 0x70, - 0x5a, 0x30, 0xce, 0xac, 0x8e, 0x28, 0x87, 0xa2, 0x1c, 0xea, 0xf2, 0xfe, 0xc3, 0x84, 0xc1, 0x98, - 0xc1, 0x40, 0x36, 0x44, 0xea, 0xa2, 0xba, 0xf7, 0xf7, 0x46, 0x6c, 0xc4, 0x14, 0x2e, 0x4e, 0x1a, - 0xf5, 0x36, 0x25, 0x80, 0x17, 0x84, 0xd3, 0xd1, 0x5c, 0x75, 0x74, 0x3f, 0xd7, 0x50, 0xbb, 0x97, - 0xe7, 0xec, 0x9c, 0xa6, 0x6f, 0x84, 0xb8, 0xb5, 0x87, 0xee, 0xa5, 0x74, 0xc2, 0xc6, 0xb6, 0xe9, - 0x99, 0xfe, 0x16, 0x56, 0x17, 0x0b, 0x23, 0xa4, 0x07, 0x33, 0x0a, 0x76, 0xcd, 0xab, 0xfb, 0xdb, - 0x47, 0x6e, 0xb8, 0xe1, 0x30, 0x3c, 0xd6, 0xec, 0x27, 0xf3, 0x29, 0x8d, 0x3b, 0x17, 0xb7, 0xee, - 0x83, 0x75, 0x04, 0xf0, 0x1a, 0x8b, 0xe5, 0xa3, 0x9d, 0x4c, 0x64, 0xc9, 0x4a, 0xc2, 0xe9, 0x40, - 0x46, 0xb7, 0xeb, 0x9e, 0xe9, 0xdf, 0xc7, 0xdb, 0x19, 0xbc, 0x52, 0xb0, 0xf2, 0x74, 0x8e, 0x2c, - 0xa2, 0x3c, 0x0e, 0x52, 0x3a, 0x65, 0x90, 0x71, 0x56, 0x80, 0xdd, 0xf0, 0xea, 0x7e, 0x3b, 0x7e, - 0xf1, 0x73, 0xe1, 0x06, 0xa3, 0x8c, 0x9f, 0xce, 0x86, 0x61, 0xc2, 0xc6, 0x7a, 0x2b, 0xfa, 0x27, - 0x80, 0xf4, 0x2c, 0xe2, 0x42, 0x39, 0xec, 0x25, 0x49, 0x2f, 0x4d, 0x0b, 0x0a, 0x70, 0x73, 0x19, - 0xec, 0xea, 0xdd, 0x69, 0x24, 0x9e, 0x73, 0x0a, 0xb8, 0xa3, 0x35, 0xfa, 0x77, 0x12, 0xdd, 0xd7, - 0xa8, 0x25, 0x1d, 0x60, 0x9a, 0xb0, 0x22, 0xb5, 0x9e, 0xa3, 0x36, 0x67, 0x9c, 0xe4, 0x03, 0x38, - 0x25, 0x05, 0x05, 0xb9, 0xa2, 0xd6, 0xd1, 0xc1, 0x6f, 0xf6, 0x20, 0xa7, 0x8e, 0x45, 0x57, 0xdc, - 0xb8, 0x5a, 0xb8, 0x06, 0x6e, 0xc9, 0x41, 0x89, 0x40, 0xf7, 0xab, 0x89, 0x76, 0xaa, 0x0e, 0x4d, - 0xfe, 0x0e, 0x6d, 0xdd, 0x85, 0x93, 0xcc, 0xff, 0x33, 0x5b, 0x45, 0x6d, 0xbd, 0x44, 0x4d, 0x6d, - 0x5f, 0xfc, 0x8d, 0x7f, 0xb5, 0xbf, 0x2b, 0xec, 0x5f, 0xdc, 0xba, 0xad, 0x0a, 0x03, 0xac, 0x19, - 0xba, 0x1f, 0x10, 0xaa, 0xe0, 0x3f, 0x7c, 0x3a, 0x27, 0xa8, 0x49, 0xc6, 0x6c, 0x36, 0xe1, 0x76, - 0x4d, 0xc0, 0xf1, 0x53, 0x41, 0xf8, 0x7d, 0xe1, 0x3e, 0xfa, 0x87, 0x60, 0x7d, 0x9a, 0xdc, 0x5c, - 0x06, 0x48, 0x27, 0xea, 0xd3, 0x04, 0x6b, 0xae, 0x27, 0x8d, 0x4f, 0x5f, 0x5c, 0x23, 0x7e, 0x76, - 0xb5, 0x74, 0xcc, 0xeb, 0xa5, 0x63, 0xfe, 0x58, 0x3a, 0xe6, 0xc7, 0x95, 0x63, 0x5c, 0xaf, 0x1c, - 0xe3, 0xdb, 0xca, 0x31, 0xde, 0xae, 0xb3, 0x8b, 0x7c, 0x41, 0x4e, 0x86, 0x20, 0x4f, 0xd1, 0x7b, - 0xf5, 0x20, 0xa4, 0xc2, 0xb0, 0x29, 0x9f, 0xc1, 0xe3, 0x5f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xa0, - 0xa9, 0xba, 0x64, 0x8d, 0x03, 0x00, 0x00, + // 500 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x53, 0xbf, 0x6f, 0xd3, 0x40, + 0x14, 0x8e, 0x93, 0x10, 0xd1, 0x4b, 0xa8, 0x1a, 0xb7, 0x83, 0x29, 0xaa, 0x6d, 0x65, 0x40, 0x5e, + 0x6c, 0x2b, 0x65, 0x63, 0x22, 0x56, 0x84, 0x00, 0x31, 0xa0, 0x2b, 0x30, 0xb0, 0x44, 0x17, 0xfb, + 0x70, 0xac, 0xd8, 0xb9, 0xc8, 0xef, 0x92, 0x92, 0xff, 0x82, 0x11, 0x89, 0x85, 0xb9, 0x73, 0xff, + 0x06, 0xd4, 0xb1, 0xea, 0x84, 0x18, 0x52, 0x94, 0xfc, 0x17, 0x4c, 0xe8, 0x7e, 0xa8, 0x89, 0x54, + 0x10, 0x4b, 0xa7, 0xdc, 0x7d, 0xef, 0xbd, 0xef, 0x7d, 0xdf, 0x97, 0x33, 0x3a, 0x1a, 0x93, 0x39, + 0x09, 0x29, 0x29, 0x27, 0xe1, 0xbc, 0x3b, 0xa4, 0x9c, 0x74, 0xc3, 0x39, 0x99, 0xe5, 0x3c, 0x98, + 0x96, 0x8c, 0x33, 0xb3, 0x2d, 0xca, 0x81, 0x28, 0x07, 0xba, 0x7c, 0xf8, 0x30, 0x66, 0x50, 0x30, + 0x18, 0xc8, 0x86, 0x50, 0x5d, 0x54, 0xf7, 0xe1, 0x41, 0xca, 0x52, 0xa6, 0x70, 0x71, 0xd2, 0xa8, + 0x7b, 0x7b, 0x05, 0xf0, 0x92, 0x70, 0x9a, 0x2e, 0x54, 0x47, 0xe7, 0x6b, 0x15, 0xb5, 0x7a, 0x79, + 0xce, 0x4e, 0x69, 0xf2, 0x5e, 0x2c, 0x37, 0x0f, 0xd0, 0xbd, 0x84, 0x4e, 0x58, 0x61, 0x19, 0xae, + 0xe1, 0xed, 0x60, 0x75, 0x31, 0x31, 0x42, 0x7a, 0x30, 0xa3, 0x60, 0x55, 0xdd, 0x9a, 0xb7, 0x7b, + 0xec, 0x04, 0xb7, 0x14, 0x06, 0x27, 0x9a, 0xfd, 0xed, 0x62, 0x4a, 0xa3, 0xf6, 0xd9, 0xb5, 0xf3, + 0x60, 0x1b, 0x01, 0xbc, 0xc5, 0x62, 0x7a, 0x68, 0x2f, 0x13, 0x5e, 0xb2, 0x39, 0xe1, 0x74, 0x20, + 0xad, 0x5b, 0x35, 0xd7, 0xf0, 0xee, 0xe3, 0xdd, 0x0c, 0xde, 0x28, 0x58, 0x69, 0x3a, 0x45, 0x26, + 0x51, 0x1a, 0x07, 0x09, 0x9d, 0x32, 0xc8, 0x38, 0x2b, 0xc1, 0xaa, 0xbb, 0x35, 0xaf, 0x15, 0xbd, + 0xf8, 0xbd, 0x74, 0xfc, 0x34, 0xe3, 0xa3, 0xd9, 0x30, 0x88, 0x59, 0xa1, 0x53, 0xd1, 0x3f, 0x3e, + 0x24, 0xe3, 0x90, 0x8b, 0xcd, 0x41, 0x2f, 0x8e, 0x7b, 0x49, 0x52, 0x52, 0x80, 0xab, 0x73, 0x7f, + 0x5f, 0x67, 0xa7, 0x91, 0x68, 0xc1, 0x29, 0xe0, 0xb6, 0xde, 0xd1, 0xbf, 0x59, 0xd1, 0x79, 0x87, + 0x9a, 0x52, 0x01, 0xa6, 0x31, 0x2b, 0x13, 0xf3, 0x39, 0x6a, 0x71, 0xc6, 0x49, 0x3e, 0x80, 0x11, + 0x29, 0x29, 0xc8, 0x88, 0x9a, 0xc7, 0x47, 0x7f, 0xc9, 0x41, 0x4e, 0x9d, 0x88, 0xae, 0xa8, 0x7e, + 0xb1, 0x74, 0x2a, 0xb8, 0x29, 0x07, 0x25, 0x02, 0x9d, 0xef, 0x06, 0xda, 0xdb, 0x74, 0x68, 0xf2, + 0x8f, 0x68, 0xe7, 0xc6, 0x9c, 0x64, 0xbe, 0x4b, 0x6f, 0x1b, 0x6a, 0xf3, 0x15, 0x6a, 0x68, 0xf9, + 0xe2, 0x6f, 0xfc, 0xaf, 0xfc, 0x7d, 0x21, 0xff, 0xec, 0xda, 0x69, 0x6e, 0x30, 0xc0, 0x9a, 0xa1, + 0x03, 0x08, 0x6d, 0xe0, 0x7f, 0x3c, 0x9d, 0x97, 0xa8, 0x41, 0x0a, 0x36, 0x9b, 0x70, 0xab, 0x2a, + 0xe0, 0xa8, 0x2b, 0x08, 0x7f, 0x2e, 0x9d, 0x47, 0x4a, 0x27, 0x24, 0xe3, 0x20, 0x63, 0x61, 0x41, + 0xf8, 0x28, 0x78, 0x4d, 0x53, 0x12, 0x2f, 0xfa, 0x34, 0xbe, 0x3a, 0xf7, 0x91, 0xb6, 0xd1, 0xa7, + 0x31, 0xd6, 0x04, 0x4f, 0xeb, 0x5f, 0xbe, 0x39, 0x95, 0xe8, 0xd9, 0xc5, 0xca, 0x36, 0x2e, 0x57, + 0xb6, 0xf1, 0x6b, 0x65, 0x1b, 0x9f, 0xd7, 0x76, 0xe5, 0x72, 0x6d, 0x57, 0x7e, 0xac, 0xed, 0xca, + 0x87, 0xc7, 0x5b, 0x59, 0x09, 0x53, 0x7e, 0x4e, 0x86, 0x20, 0x4f, 0xe1, 0x27, 0xf5, 0x15, 0xc8, + 0xbc, 0x86, 0x0d, 0xf9, 0xf6, 0x9f, 0xfc, 0x09, 0x00, 0x00, 0xff, 0xff, 0x2e, 0xec, 0xc7, 0xdc, + 0x82, 0x03, 0x00, 0x00, } func (m *AllowedVault) Marshal() (dAtA []byte, err error) { diff --git a/x/earn/types/vault_test.go b/x/earn/types/vault_test.go index f56b78d984..23457c6df4 100644 --- a/x/earn/types/vault_test.go +++ b/x/earn/types/vault_test.go @@ -1,6 +1,7 @@ package types_test import ( + sdkmath "cosmossdk.io/math" "testing" sdk "github.com/cosmos/cosmos-sdk/types" @@ -26,10 +27,10 @@ func TestVaultRecordValidate(t *testing.T) { name: "valid vault records", vaultRecords: types.VaultRecords{ { - TotalShares: types.NewVaultShare("usdx", sdk.NewDec(0)), + TotalShares: types.NewVaultShare("usdx", sdkmath.LegacyNewDec(0)), }, { - TotalShares: types.NewVaultShare("ukava", sdk.NewDec(5)), + TotalShares: types.NewVaultShare("ukava", sdkmath.LegacyNewDec(5)), }, }, errArgs: errArgs{ @@ -40,10 +41,10 @@ func TestVaultRecordValidate(t *testing.T) { name: "invalid - duplicate denom", vaultRecords: types.VaultRecords{ { - TotalShares: types.NewVaultShare("usdx", sdk.NewDec(0)), + TotalShares: types.NewVaultShare("usdx", sdkmath.LegacyNewDec(0)), }, { - TotalShares: types.NewVaultShare("usdx", sdk.NewDec(5)), + TotalShares: types.NewVaultShare("usdx", sdkmath.LegacyNewDec(5)), }, }, errArgs: errArgs{ @@ -55,7 +56,7 @@ func TestVaultRecordValidate(t *testing.T) { name: "invalid - invalid denom", vaultRecords: types.VaultRecords{ { - TotalShares: types.VaultShare{Denom: "", Amount: sdk.NewDec(0)}, + TotalShares: types.VaultShare{Denom: "", Amount: sdkmath.LegacyNewDec(0)}, }, }, errArgs: errArgs{ @@ -67,7 +68,7 @@ func TestVaultRecordValidate(t *testing.T) { name: "invalid - negative", vaultRecords: types.VaultRecords{ { - TotalShares: types.VaultShare{"usdx", sdk.NewDec(-5)}, + TotalShares: types.VaultShare{"usdx", sdkmath.LegacyNewDec(-5)}, }, }, errArgs: errArgs{ @@ -110,14 +111,14 @@ func TestVaultShareRecordsValidate(t *testing.T) { { Depositor: addrs[0], Shares: types.NewVaultShares( - types.NewVaultShare("usdx", sdk.NewDec(0)), + types.NewVaultShare("usdx", sdkmath.LegacyNewDec(0)), ), }, { Depositor: addrs[1], Shares: types.NewVaultShares( - types.NewVaultShare("usdx", sdk.NewDec(0)), - types.NewVaultShare("ukava", sdk.NewDec(5)), + types.NewVaultShare("usdx", sdkmath.LegacyNewDec(0)), + types.NewVaultShare("ukava", sdkmath.LegacyNewDec(5)), ), }, }, @@ -131,14 +132,14 @@ func TestVaultShareRecordsValidate(t *testing.T) { { Depositor: addrs[0], Shares: types.NewVaultShares( - types.NewVaultShare("usdx", sdk.NewDec(0)), + types.NewVaultShare("usdx", sdkmath.LegacyNewDec(0)), ), }, { Depositor: addrs[0], Shares: types.NewVaultShares( - types.NewVaultShare("usdx", sdk.NewDec(0)), - types.NewVaultShare("ukava", sdk.NewDec(5)), + types.NewVaultShare("usdx", sdkmath.LegacyNewDec(0)), + types.NewVaultShare("ukava", sdkmath.LegacyNewDec(5)), ), }, }, @@ -153,7 +154,7 @@ func TestVaultShareRecordsValidate(t *testing.T) { { Depositor: sdk.AccAddress{}, Shares: types.NewVaultShares( - types.NewVaultShare("usdx", sdk.NewDec(0)), + types.NewVaultShare("usdx", sdkmath.LegacyNewDec(0)), ), }, }, @@ -169,7 +170,7 @@ func TestVaultShareRecordsValidate(t *testing.T) { Depositor: addrs[0], // Direct slice, not NewVaultShares() which panics Shares: types.VaultShares{ - types.VaultShare{"usdx", sdk.NewDec(-5)}, + types.VaultShare{"usdx", sdkmath.LegacyNewDec(-5)}, }, }, }, @@ -376,8 +377,8 @@ func TestNewVaultShareRecord(t *testing.T) { _, addrs := app.GeneratePrivKeyAddressPairs(1) shares := types.NewVaultShares( - types.NewVaultShare("usdx", sdk.NewDec(0)), - types.NewVaultShare("ukava", sdk.NewDec(5)), + types.NewVaultShare("usdx", sdkmath.LegacyNewDec(0)), + types.NewVaultShare("ukava", sdkmath.LegacyNewDec(5)), ) shareRecord := types.NewVaultShareRecord(addrs[0], shares) diff --git a/x/evmutil/genesis_test.go b/x/evmutil/genesis_test.go index 0c71f9ffa8..89b2f9b771 100644 --- a/x/evmutil/genesis_test.go +++ b/x/evmutil/genesis_test.go @@ -1,12 +1,12 @@ package evmutil_test import ( + sdk "github.com/cosmos/cosmos-sdk/types" "testing" "github.com/stretchr/testify/suite" sdkmath "cosmossdk.io/math" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/kava-labs/kava/x/evmutil" "github.com/kava-labs/kava/x/evmutil/testutil" "github.com/kava-labs/kava/x/evmutil/types" @@ -77,7 +77,7 @@ func (s *genesisTestSuite) TestInitGenesis_ModuleAccount() { // check for module account this way b/c GetModuleAccount creates if not existing. acc := s.AccountKeeper.GetAccount(s.Ctx, s.AccountKeeper.GetModuleAddress(types.ModuleName)) s.Require().NotNil(acc) - _, ok := acc.(authtypes.ModuleAccountI) + _, ok := acc.(sdk.ModuleAccountI) s.Require().True(ok) } diff --git a/x/evmutil/keeper/conversion_evm_native_bep3_test.go b/x/evmutil/keeper/conversion_evm_native_bep3_test.go index c2d0612898..40e178ac89 100644 --- a/x/evmutil/keeper/conversion_evm_native_bep3_test.go +++ b/x/evmutil/keeper/conversion_evm_native_bep3_test.go @@ -376,7 +376,7 @@ func (suite *Bep3ConversionTestSuite) testConvertBep3ERC20ToCoin(denom string) { } // create user account, otherwise `CallEVMWithData` will fail due to failing to get user account when finding its sequence. - err = suite.App.FundAccount(suite.Ctx, invokerCosmosAddr, sdk.NewCoins(sdk.NewCoin(conversionDenom, sdk.ZeroInt()))) + err = suite.App.FundAccount(suite.Ctx, invokerCosmosAddr, sdk.NewCoins(sdk.NewCoin(conversionDenom, sdkmath.ZeroInt()))) suite.Require().NoError(err) // execute bep3 conversion diff --git a/x/evmutil/keeper/conversion_evm_native_test.go b/x/evmutil/keeper/conversion_evm_native_test.go index 3cd9d1c72a..18792f68cd 100644 --- a/x/evmutil/keeper/conversion_evm_native_test.go +++ b/x/evmutil/keeper/conversion_evm_native_test.go @@ -1,6 +1,7 @@ package keeper_test import ( + storetypes "cosmossdk.io/store/types" "math/big" "testing" @@ -72,7 +73,7 @@ func (suite *ConversionTestSuite) TestBurn() { suite.Require().NoError(err) bal = suite.App.GetBankKeeper().GetBalance(suite.Ctx, recipient, pair.Denom) - suite.Require().Equal(sdk.ZeroInt(), bal.Amount, "balance should be zero after burn") + suite.Require().Equal(sdkmath.ZeroInt(), bal.Amount, "balance should be zero after burn") } func (suite *ConversionTestSuite) TestUnlockERC20Tokens() { @@ -166,7 +167,7 @@ func (suite *ConversionTestSuite) TestConvertCoinToERC20() { suite.Require().NoError(err) // convert coin to erc20 - ctx := suite.Ctx.WithGasMeter(sdk.NewInfiniteGasMeter()) + ctx := suite.Ctx.WithGasMeter(storetypes.NewInfiniteGasMeter()) err = suite.Keeper.ConvertCoinToERC20( ctx, originAcc, @@ -179,7 +180,7 @@ func (suite *ConversionTestSuite) TestConvertCoinToERC20() { // Source should decrease bal := suite.App.GetBankKeeper().GetBalance(suite.Ctx, originAcc, pair.Denom) - suite.Require().Equal(sdk.ZeroInt(), bal.Amount, "conversion should decrease source balance") + suite.Require().Equal(sdkmath.ZeroInt(), bal.Amount, "conversion should decrease source balance") // Module bal should also decrease moduleBal := suite.GetERC20BalanceOf( @@ -284,7 +285,7 @@ func (suite *ConversionTestSuite) TestConvertERC20ToCoin() { ) suite.Require().NoError(err) - ctx := suite.Ctx.WithGasMeter(sdk.NewInfiniteGasMeter()) + ctx := suite.Ctx.WithGasMeter(storetypes.NewInfiniteGasMeter()) convertAmt := sdkmath.NewInt(50) err = suite.Keeper.ConvertERC20ToCoin( ctx, @@ -349,5 +350,5 @@ func (suite *ConversionTestSuite) TestConvertERC20ToCoin_EmptyContract() { // bank balance should not change bal := suite.App.GetBankKeeper().GetBalance(suite.Ctx, userAddr, pair.Denom) - suite.Require().Equal(sdk.ZeroInt(), bal.Amount) + suite.Require().Equal(sdkmath.ZeroInt(), bal.Amount) } diff --git a/x/evmutil/keeper/evm.go b/x/evmutil/keeper/evm.go index 43829dd427..76d85ed8fa 100644 --- a/x/evmutil/keeper/evm.go +++ b/x/evmutil/keeper/evm.go @@ -15,6 +15,7 @@ package keeper import ( + storetypes "cosmossdk.io/store/types" "encoding/json" "math/big" @@ -89,7 +90,7 @@ func (k Keeper) CallEVMWithData( return nil, err } - ethGasContext := ctx.WithGasMeter(sdk.NewInfiniteGasMeter()) + ethGasContext := ctx.WithGasMeter(storetypes.NewInfiniteGasMeter()) // EstimateGas applies the transaction against current block state to get // optimal gas value. Since this is done right before the ApplyMessage diff --git a/x/evmutil/keeper/evm_test.go b/x/evmutil/keeper/evm_test.go index c4fba03d08..bbdc403fbc 100644 --- a/x/evmutil/keeper/evm_test.go +++ b/x/evmutil/keeper/evm_test.go @@ -29,7 +29,7 @@ func (suite *evmKeeperTestSuite) SetupTest() { } func (suite *evmKeeperTestSuite) StateDB() *statedb.StateDB { - return statedb.New(suite.Ctx, suite.App.GetEvmKeeper(), statedb.NewEmptyTxConfig(common.BytesToHash(suite.Ctx.HeaderHash().Bytes()))) + return statedb.New(suite.Ctx, suite.App.GetEvmKeeper(), statedb.NewEmptyTxConfig(common.BytesToHash(suite.Ctx.HeaderHash()))) } func (suite *evmKeeperTestSuite) TestEvmKeeper_SetAccount() { @@ -38,7 +38,8 @@ func (suite *evmKeeperTestSuite) TestEvmKeeper_SetAccount() { ethAddr := tests.GenerateAddress() ethAcc := ðerminttypes.EthAccount{BaseAccount: &authtypes.BaseAccount{Address: sdk.AccAddress(ethAddr.Bytes()).String()}, CodeHash: common.BytesToHash(types.EmptyCodeHash).String()} vestingAddr := tests.GenerateAddress() - vestingAcc := vestingtypes.NewBaseVestingAccount(&authtypes.BaseAccount{Address: sdk.AccAddress(vestingAddr.Bytes()).String()}, sdk.NewCoins(), time.Now().Unix()) + vestingAcc, err := vestingtypes.NewBaseVestingAccount(&authtypes.BaseAccount{Address: sdk.AccAddress(vestingAddr.Bytes()).String()}, sdk.NewCoins(), time.Now().Unix()) + suite.Require().NoError(err) testCases := []struct { name string diff --git a/x/evmutil/keeper/grpc_query.go b/x/evmutil/keeper/grpc_query.go index 0ff2d0e9d6..d3a12cf068 100644 --- a/x/evmutil/keeper/grpc_query.go +++ b/x/evmutil/keeper/grpc_query.go @@ -6,7 +6,7 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/status" - "github.com/cosmos/cosmos-sdk/store/prefix" + "cosmossdk.io/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/query" diff --git a/x/evmutil/keeper/grpc_query_test.go b/x/evmutil/keeper/grpc_query_test.go index 4f6c6c057c..aab1110aa3 100644 --- a/x/evmutil/keeper/grpc_query_test.go +++ b/x/evmutil/keeper/grpc_query_test.go @@ -31,7 +31,7 @@ func (suite *grpcQueryTestSuite) SetupTest() { suite.App.InitializeFromGenesisStates() suite.Keeper = suite.App.GetEvmutilKeeper() - suite.Ctx = suite.App.NewContext(true, tmproto.Header{Height: 1}) + suite.Ctx = suite.App.NewContextLegacy(true, tmproto.Header{Height: 1}) queryHelper := baseapp.NewQueryServerTestHelper(suite.Ctx, suite.App.InterfaceRegistry()) types.RegisterQueryServer(queryHelper, keeper.NewQueryServerImpl(suite.App.GetEvmutilKeeper())) diff --git a/x/evmutil/keeper/keeper.go b/x/evmutil/keeper/keeper.go index 02098c8d3b..a56eea5878 100644 --- a/x/evmutil/keeper/keeper.go +++ b/x/evmutil/keeper/keeper.go @@ -5,8 +5,8 @@ import ( errorsmod "cosmossdk.io/errors" sdkmath "cosmossdk.io/math" + storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/codec" - storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" @@ -63,7 +63,7 @@ func (k Keeper) GetAllAccounts(ctx sdk.Context) (accounts []types.Account) { // callback, iteration is halted. func (k Keeper) IterateAllAccounts(ctx sdk.Context, cb func(types.Account) bool) { store := ctx.KVStore(k.storeKey) - iterator := sdk.KVStorePrefixIterator(store, types.AccountStoreKeyPrefix) + iterator := storetypes.KVStorePrefixIterator(store, types.AccountStoreKeyPrefix) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { @@ -119,7 +119,7 @@ func (k Keeper) SetAccount(ctx sdk.Context, account types.Account) error { func (k Keeper) GetBalance(ctx sdk.Context, addr sdk.AccAddress) sdkmath.Int { account := k.GetAccount(ctx, addr) if account == nil { - return sdk.ZeroInt() + return sdkmath.ZeroInt() } return account.Balance } @@ -217,7 +217,7 @@ func (k *Keeper) GetDeployedCosmosCoinContract(ctx sdk.Context, cosmosDenom stri // cosmos-sdk coins. If true is returned from the callback, iteration is halted. func (k Keeper) IterateAllDeployedCosmosCoinContracts(ctx sdk.Context, cb func(types.DeployedCosmosCoinContract) bool) { store := ctx.KVStore(k.storeKey) - iterator := sdk.KVStorePrefixIterator(store, types.DeployedCosmosCoinContractKeyPrefix) + iterator := storetypes.KVStorePrefixIterator(store, types.DeployedCosmosCoinContractKeyPrefix) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { diff --git a/x/evmutil/keeper/keeper_test.go b/x/evmutil/keeper/keeper_test.go index a5ea5c6ebd..2848fbb89d 100644 --- a/x/evmutil/keeper/keeper_test.go +++ b/x/evmutil/keeper/keeper_test.go @@ -64,11 +64,11 @@ func (suite *keeperTestSuite) TestSetAccount_ZeroBalance() { suite.Require().NoError(err) err = suite.Keeper.SetAccount(suite.Ctx, types.Account{ Address: suite.Addrs[0], - Balance: sdk.ZeroInt(), + Balance: sdkmath.ZeroInt(), }) suite.Require().NoError(err) bal := suite.Keeper.GetBalance(suite.Ctx, suite.Addrs[0]) - suite.Require().Equal(sdk.ZeroInt(), bal) + suite.Require().Equal(sdkmath.ZeroInt(), bal) expAcct := suite.Keeper.GetAccount(suite.Ctx, suite.Addrs[0]) suite.Require().Nil(expAcct) } @@ -142,13 +142,13 @@ func (suite *keeperTestSuite) TestSendBalance() { { "fails when sending negative amount", sdkmath.NewInt(-5), - sdk.ZeroInt(), - sdk.ZeroInt(), + sdkmath.ZeroInt(), + sdkmath.ZeroInt(), false, }, { "send zero amount", - sdk.ZeroInt(), + sdkmath.ZeroInt(), startingSenderBal, startingRecipientBal, true, @@ -156,8 +156,8 @@ func (suite *keeperTestSuite) TestSendBalance() { { "fails when sender does not have enough balance", sdkmath.NewInt(101), - sdk.ZeroInt(), - sdk.ZeroInt(), + sdkmath.ZeroInt(), + sdkmath.ZeroInt(), false, }, { @@ -228,7 +228,7 @@ func (suite *keeperTestSuite) TestSetBalance() { { "zero balance", suite.Addrs[0], - sdk.ZeroInt(), + sdkmath.ZeroInt(), true, }, } @@ -272,25 +272,25 @@ func (suite *keeperTestSuite) TestRemoveBalance() { { "fails if amount is negative", sdkmath.NewInt(-10), - sdk.ZeroInt(), + sdkmath.ZeroInt(), false, }, { "remove zero amount", - sdk.ZeroInt(), + sdkmath.ZeroInt(), existingAccount.Balance, true, }, { "not enough balance", sdkmath.NewInt(101), - sdk.ZeroInt(), + sdkmath.ZeroInt(), false, }, { "remove full balance", sdkmath.NewInt(100), - sdk.ZeroInt(), + sdkmath.ZeroInt(), true, }, { @@ -334,7 +334,7 @@ func (suite *keeperTestSuite) TestGetBalance() { { "returns 0 balance if account does not exist", suite.Addrs[1], - sdk.ZeroInt(), + sdkmath.ZeroInt(), }, { "returns account balance", diff --git a/x/evmutil/keeper/msg_server_bep3_test.go b/x/evmutil/keeper/msg_server_bep3_test.go index d36c68fd6e..11a2992158 100644 --- a/x/evmutil/keeper/msg_server_bep3_test.go +++ b/x/evmutil/keeper/msg_server_bep3_test.go @@ -266,7 +266,7 @@ func (suite *MsgServerSuite) TestConvertERC20ToCoin_Bep3() { } // create user account, otherwise `CallEVMWithData` will fail due to failing to get user account when finding its sequence. - err = suite.App.FundAccount(suite.Ctx, invokerCosmosAddr, sdk.NewCoins(sdk.NewCoin(conversionDenom, sdk.ZeroInt()))) + err = suite.App.FundAccount(suite.Ctx, invokerCosmosAddr, sdk.NewCoins(sdk.NewCoin(conversionDenom, sdkmath.ZeroInt()))) suite.Require().NoError(err) _, err := suite.msgServer.ConvertERC20ToCoin(sdk.WrapSDKContext(suite.Ctx), &tc.msg) diff --git a/x/evmutil/keeper/msg_server_test.go b/x/evmutil/keeper/msg_server_test.go index 89c7c04a0a..3bf152a01f 100644 --- a/x/evmutil/keeper/msg_server_test.go +++ b/x/evmutil/keeper/msg_server_test.go @@ -155,7 +155,7 @@ func (suite *MsgServerSuite) TestConvertERC20ToCoin() { suite.Require().NoError(err) // create user account, otherwise `CallEVMWithData` will fail due to failing to get user account when finding its sequence. - err = suite.App.FundAccount(suite.Ctx, invokerCosmosAddr, sdk.NewCoins(sdk.NewCoin(pair.Denom, sdk.ZeroInt()))) + err = suite.App.FundAccount(suite.Ctx, invokerCosmosAddr, sdk.NewCoins(sdk.NewCoin(pair.Denom, sdkmath.ZeroInt()))) suite.Require().NoError(err) type errArgs struct { @@ -202,7 +202,7 @@ func (suite *MsgServerSuite) TestConvertERC20ToCoin() { invoker, invokerCosmosAddr, contractAddr, - sdkmath.NewIntFromBigInt(pairStartingBal).Add(sdk.OneInt()), + sdkmath.NewIntFromBigInt(pairStartingBal).Add(sdkmath.OneInt()), ), math.MaxBig256, errArgs{ diff --git a/x/evmutil/keeper/params_test.go b/x/evmutil/keeper/params_test.go index 4a1a016a19..bfdcc74fc4 100644 --- a/x/evmutil/keeper/params_test.go +++ b/x/evmutil/keeper/params_test.go @@ -1,12 +1,11 @@ package keeper_test import ( + storetypes "cosmossdk.io/store/types" "testing" "github.com/stretchr/testify/suite" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/kava-labs/kava/x/evmutil/keeper" "github.com/kava-labs/kava/x/evmutil/testutil" "github.com/kava-labs/kava/x/evmutil/types" @@ -49,7 +48,7 @@ func (suite *ParamsTestSuite) TestHistoricParamsQuery() { oldStateKeeper := keeper.NewKeeper( suite.App.AppCodec(), - sdk.NewKVStoreKey(types.StoreKey), + storetypes.NewKVStoreKey(types.StoreKey), oldParamStore, suite.App.GetBankKeeper(), suite.App.GetAccountKeeper(), diff --git a/x/evmutil/migrations/v2/store_test.go b/x/evmutil/migrations/v2/store_test.go index 69a6cd990e..2fe7790a94 100644 --- a/x/evmutil/migrations/v2/store_test.go +++ b/x/evmutil/migrations/v2/store_test.go @@ -1,12 +1,12 @@ package v2_test import ( + storetypes "cosmossdk.io/store/types" "testing" "github.com/stretchr/testify/require" "github.com/cosmos/cosmos-sdk/testutil" - sdk "github.com/cosmos/cosmos-sdk/types" moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" @@ -16,8 +16,8 @@ import ( func TestStoreMigrationAddsKeyTableIncludingNewParam(t *testing.T) { encCfg := moduletestutil.MakeTestEncodingConfig() - evmutilKey := sdk.NewKVStoreKey(types.ModuleName) - tEvmutilKey := sdk.NewTransientStoreKey("transient_test") + evmutilKey := storetypes.NewKVStoreKey(types.ModuleName) + tEvmutilKey := storetypes.NewTransientStoreKey("transient_test") ctx := testutil.DefaultContext(evmutilKey, tEvmutilKey) paramstore := paramtypes.NewSubspace(encCfg.Codec, encCfg.Amino, evmutilKey, tEvmutilKey, types.ModuleName) @@ -34,8 +34,8 @@ func TestStoreMigrationAddsKeyTableIncludingNewParam(t *testing.T) { func TestStoreMigrationSetsNewParamOnExistingKeyTable(t *testing.T) { encCfg := moduletestutil.MakeTestEncodingConfig() - evmutilKey := sdk.NewKVStoreKey(types.ModuleName) - tEvmutilKey := sdk.NewTransientStoreKey("transient_test") + evmutilKey := storetypes.NewKVStoreKey(types.ModuleName) + tEvmutilKey := storetypes.NewTransientStoreKey("transient_test") ctx := testutil.DefaultContext(evmutilKey, tEvmutilKey) paramstore := paramtypes.NewSubspace(encCfg.Codec, encCfg.Amino, evmutilKey, tEvmutilKey, types.ModuleName) paramstore.WithKeyTable(types.ParamKeyTable()) diff --git a/x/evmutil/module.go b/x/evmutil/module.go index 09ed8b11dd..3cfb184d25 100644 --- a/x/evmutil/module.go +++ b/x/evmutil/module.go @@ -151,10 +151,16 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw func (AppModule) ConsensusVersion() uint64 { return ConsensusVersion } // BeginBlock executes all ABCI BeginBlock logic respective to evmutil module. -func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) {} +func (am AppModule) BeginBlock(ctx sdk.Context) error { + return nil +} // EndBlock executes all ABCI EndBlock logic respective to evmutil module. It // returns no validator updates. -func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - return []abci.ValidatorUpdate{} +func (am AppModule) EndBlock(_ sdk.Context) ([]abci.ValidatorUpdate, error) { + return []abci.ValidatorUpdate{}, nil } + +func (AppModule) IsOnePerModuleType() {} + +func (AppModule) IsAppModule() {} diff --git a/x/evmutil/testutil/suite.go b/x/evmutil/testutil/suite.go index f9e24f731c..fee3aaa7e4 100644 --- a/x/evmutil/testutil/suite.go +++ b/x/evmutil/testutil/suite.go @@ -62,7 +62,7 @@ type Suite struct { func (suite *Suite) SetupTest() { tApp := app.NewTestApp() - suite.Ctx = tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + suite.Ctx = tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) suite.App = tApp suite.BankKeeper = tApp.GetBankKeeper() suite.AccountKeeper = tApp.GetAccountKeeper() @@ -104,7 +104,7 @@ func (suite *Suite) SetupTest() { consAddress := sdk.ConsAddress(consPriv.PubKey().Address()) // InitializeFromGenesisStates commits first block so we start at 2 here - suite.Ctx = suite.App.NewContext(false, tmproto.Header{ + suite.Ctx = suite.App.NewContextLegacy(false, tmproto.Header{ Height: suite.App.LastBlockHeight() + 1, ChainID: app.TestChainId, Time: time.Now().UTC(), @@ -131,13 +131,18 @@ func (suite *Suite) SetupTest() { // We need to set the validator as calling the EVM looks up the validator address // https://github.com/evmos/ethermint/blob/f21592ebfe74da7590eb42ed926dae970b2a9a3f/x/evm/keeper/state_transition.go#L487 // evmkeeper.EVMConfig() will return error "failed to load evm config" if not set + fmt.Println("evmsetup ") + fmt.Println(suite.AccountKeeper.GetAccount(suite.Ctx, sdk.AccAddress(suite.Address.Bytes()))) + fmt.Println(suite.Address) + fmt.Println(suite.Address.String()) acc := ðerminttypes.EthAccount{ BaseAccount: authtypes.NewBaseAccount(sdk.AccAddress(suite.Address.Bytes()), nil, 0, 0), CodeHash: common.BytesToHash(crypto.Keccak256(nil)).String(), } + fmt.Println("acc", acc.GetAddress().String()) suite.AccountKeeper.SetAccount(suite.Ctx, acc) valAddr := sdk.ValAddress(suite.Address.Bytes()) - validator, err := stakingtypes.NewValidator(valAddr, consPriv.PubKey(), stakingtypes.Description{}) + validator, err := stakingtypes.NewValidator(valAddr.String(), consPriv.PubKey(), stakingtypes.Description{}) suite.Require().NoError(err) err = suite.App.GetStakingKeeper().SetValidatorByConsAddr(suite.Ctx, validator) suite.Require().NoError(err) @@ -167,18 +172,20 @@ func (suite *Suite) SetupTest() { } func (suite *Suite) Commit() { - _ = suite.App.Commit() + _, err := suite.App.Commit() + suite.Require().NoError(err) header := suite.Ctx.BlockHeader() header.Height += 1 - suite.App.BeginBlock(abci.RequestBeginBlock{ - Header: header, - }) + suite.App.FinalizeBlock(&abci.RequestFinalizeBlock{Height: header.Height}) + //suite.App.BeginBlock(abci.RequestBeginBlock{ + // Header: header, + //}) // update ctx - suite.Ctx = suite.App.NewContext(false, header) + suite.Ctx = suite.App.NewContextLegacy(false, header) } -func (suite *Suite) ModuleBalance(denom string) sdk.Int { +func (suite *Suite) ModuleBalance(denom string) sdkmath.Int { return suite.App.GetModuleAccountBalance(suite.Ctx, types.ModuleName, denom) } diff --git a/x/evmutil/types/codec.go b/x/evmutil/types/codec.go index fa9c5fe60e..079409d8d3 100644 --- a/x/evmutil/types/codec.go +++ b/x/evmutil/types/codec.go @@ -7,7 +7,6 @@ import ( cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" - authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec" ) // RegisterLegacyAminoCodec registers the necessary evmutil interfaces and concrete types @@ -42,5 +41,5 @@ func init() { // Register all Amino interfaces and concrete types on the authz Amino codec so that this can later be // used to properly serialize MsgGrant and MsgExec instances - RegisterLegacyAminoCodec(authzcodec.Amino) + RegisterLegacyAminoCodec(codec.NewLegacyAmino()) } diff --git a/x/evmutil/types/expected_keepers.go b/x/evmutil/types/expected_keepers.go index 1992f5d61e..850ec1b4a9 100644 --- a/x/evmutil/types/expected_keepers.go +++ b/x/evmutil/types/expected_keepers.go @@ -4,7 +4,6 @@ import ( "context" sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/core/vm" evmtypes "github.com/evmos/ethermint/x/evm/types" @@ -12,22 +11,22 @@ import ( // AccountKeeper defines the expected account keeper interface type AccountKeeper interface { - GetModuleAccount(ctx sdk.Context, moduleName string) authtypes.ModuleAccountI + GetModuleAccount(context context.Context, moduleName string) sdk.ModuleAccountI GetModuleAddress(moduleName string) sdk.AccAddress - GetSequence(sdk.Context, sdk.AccAddress) (uint64, error) + GetSequence(context.Context, sdk.AccAddress) (uint64, error) } // BankKeeper defines the expected bank keeper interface type BankKeeper interface { - GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin - SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error - SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error - MintCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error - BurnCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error + GetBalance(ctx context.Context, addr sdk.AccAddress, denom string) sdk.Coin + SendCoinsFromAccountToModule(ctx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error + SendCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error + MintCoins(ctx context.Context, moduleName string, amt sdk.Coins) error + BurnCoins(ctx context.Context, moduleName string, amt sdk.Coins) error - GetSupply(ctx sdk.Context, denom string) sdk.Coin - SpendableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins - SendCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error + GetSupply(ctx context.Context, denom string) sdk.Coin + SpendableCoins(ctx context.Context, addr sdk.AccAddress) sdk.Coins + SendCoins(ctx context.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error } // EvmKeeper defines the expected interface needed to make EVM transactions. diff --git a/x/evmutil/types/genesis.pb.go b/x/evmutil/types/genesis.pb.go index 93aa0b9759..fb35d2bcb7 100644 --- a/x/evmutil/types/genesis.pb.go +++ b/x/evmutil/types/genesis.pb.go @@ -5,6 +5,7 @@ package types import ( bytes "bytes" + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" _ "github.com/cosmos/cosmos-proto" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" @@ -70,7 +71,7 @@ var xxx_messageInfo_GenesisState proto.InternalMessageInfo type Account struct { Address github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=address,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"address,omitempty"` // balance indicates the amount of akava owned by the address. - Balance github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=balance,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"balance"` + Balance cosmossdk_io_math.Int `protobuf:"bytes,2,opt,name=balance,proto3,customtype=cosmossdk.io/math.Int" json:"balance"` } func (m *Account) Reset() { *m = Account{} } @@ -174,38 +175,38 @@ func init() { } var fileDescriptor_d916ab97b8e628c2 = []byte{ - // 489 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x52, 0x41, 0x6b, 0x13, 0x41, - 0x14, 0xde, 0xa9, 0x21, 0xd1, 0x69, 0x41, 0xd8, 0x56, 0x8d, 0xa5, 0xce, 0x96, 0x50, 0x24, 0x0a, - 0xbb, 0x6b, 0xe2, 0xad, 0x08, 0xd2, 0x8d, 0xa2, 0xc5, 0x4b, 0x59, 0xc5, 0x83, 0x97, 0xf0, 0x76, - 0x77, 0x88, 0x4b, 0x76, 0x67, 0xc2, 0xce, 0x24, 0xb5, 0xff, 0x40, 0xf0, 0xa0, 0xfe, 0x03, 0x8f, - 0xe2, 0xb9, 0x3f, 0xa2, 0xe0, 0xa5, 0xf4, 0x24, 0x1e, 0x62, 0x4d, 0xfe, 0x85, 0x27, 0xd9, 0x99, - 0x49, 0xa8, 0x21, 0x8a, 0xa7, 0x9d, 0x7d, 0xf3, 0x7d, 0xef, 0xfb, 0xe6, 0x7b, 0x0f, 0x37, 0xfa, - 0x30, 0x02, 0x9f, 0x8e, 0xf2, 0xa1, 0x4c, 0x33, 0x7f, 0xd4, 0x8a, 0xa8, 0x84, 0x96, 0xdf, 0xa3, - 0x8c, 0x8a, 0x54, 0x78, 0x83, 0x82, 0x4b, 0x6e, 0x6f, 0x94, 0x18, 0xcf, 0x60, 0x3c, 0x83, 0xd9, - 0xbc, 0x19, 0x73, 0x91, 0x73, 0xd1, 0x55, 0x18, 0x5f, 0xff, 0x68, 0xc2, 0xe6, 0x46, 0x8f, 0xf7, - 0xb8, 0xae, 0x97, 0x27, 0x53, 0xbd, 0xbb, 0x54, 0x2a, 0xe6, 0x6c, 0x44, 0x0b, 0x91, 0x72, 0xd6, - 0x1d, 0x40, 0x5a, 0x68, 0x6c, 0xe3, 0x23, 0xc2, 0x6b, 0x4f, 0xb4, 0x89, 0xe7, 0x12, 0x24, 0xb5, - 0x1f, 0xe2, 0xcb, 0x10, 0xc7, 0x7c, 0xc8, 0xa4, 0xa8, 0xa3, 0xed, 0x4b, 0xcd, 0xd5, 0xf6, 0x2d, - 0x6f, 0x99, 0x2d, 0x6f, 0x4f, 0xa3, 0x82, 0xca, 0xc9, 0xd8, 0xb1, 0xc2, 0x39, 0xc9, 0xde, 0xc5, - 0xd5, 0x01, 0x14, 0x90, 0x8b, 0xfa, 0xca, 0x36, 0x6a, 0xae, 0xb6, 0xb7, 0x96, 0xd3, 0x0f, 0x14, - 0xc6, 0xb0, 0x0d, 0x63, 0xb7, 0xf2, 0xf6, 0x93, 0x63, 0x35, 0xbe, 0x22, 0x5c, 0x33, 0xdd, 0xed, - 0x08, 0xd7, 0x20, 0x49, 0x0a, 0x2a, 0x4a, 0x37, 0xa8, 0xb9, 0x16, 0x3c, 0xfd, 0x35, 0x76, 0xdc, - 0x5e, 0x2a, 0x5f, 0x0f, 0x23, 0x2f, 0xe6, 0xb9, 0xc9, 0xc3, 0x7c, 0x5c, 0x91, 0xf4, 0x7d, 0x79, - 0x34, 0xa0, 0xa2, 0xb4, 0xb7, 0xa7, 0x89, 0x67, 0xc7, 0xee, 0xba, 0x49, 0xcd, 0x54, 0x82, 0x23, - 0x49, 0x45, 0x38, 0x6b, 0x6c, 0xbf, 0xc4, 0xb5, 0x08, 0x32, 0x60, 0x31, 0x55, 0x96, 0xaf, 0x04, - 0x0f, 0x4a, 0x53, 0xdf, 0xc7, 0xce, 0xed, 0xff, 0xd0, 0xd9, 0x67, 0xf2, 0xec, 0xd8, 0xc5, 0x46, - 0x60, 0x9f, 0xc9, 0x70, 0xd6, 0xcc, 0xbc, 0xe6, 0xfd, 0x0a, 0xae, 0xea, 0xc7, 0xda, 0x87, 0xb8, - 0x4e, 0x19, 0x44, 0x19, 0x4d, 0xba, 0x0b, 0xd3, 0x10, 0xf5, 0x8a, 0xca, 0x7a, 0x67, 0x79, 0x58, - 0x9d, 0x39, 0xfa, 0x00, 0xd2, 0x22, 0xb8, 0x51, 0xfa, 0xfb, 0xf2, 0xc3, 0xb9, 0xfa, 0x67, 0x5d, - 0x84, 0xd7, 0x4d, 0xfb, 0x85, 0xba, 0xfd, 0x0e, 0xe1, 0x6b, 0x90, 0x65, 0xfc, 0x50, 0x29, 0xab, - 0x6d, 0x4a, 0x28, 0xe3, 0xf9, 0x6c, 0xc4, 0xad, 0xbf, 0x8c, 0x58, 0x53, 0x3a, 0x8a, 0xd1, 0xe1, - 0x29, 0x7b, 0x1c, 0x76, 0xda, 0xf7, 0x5e, 0xf0, 0x3e, 0x65, 0xc1, 0x8e, 0xf1, 0xb0, 0xf5, 0x0f, - 0x90, 0x08, 0xd7, 0xe1, 0xe2, 0xed, 0x23, 0xa5, 0x19, 0x3c, 0x3b, 0xff, 0x49, 0xd0, 0xe7, 0x09, - 0x41, 0x27, 0x13, 0x82, 0x4e, 0x27, 0x04, 0x9d, 0x4f, 0x08, 0xfa, 0x30, 0x25, 0xd6, 0xe9, 0x94, - 0x58, 0xdf, 0xa6, 0xc4, 0x7a, 0x75, 0xe7, 0x42, 0xf0, 0xa5, 0x33, 0x37, 0x83, 0x48, 0xa8, 0x93, - 0xff, 0x66, 0xbe, 0xd8, 0x2a, 0xff, 0xa8, 0xaa, 0xf6, 0xf8, 0xfe, 0xef, 0x00, 0x00, 0x00, 0xff, - 0xff, 0xa1, 0xec, 0x74, 0x78, 0x60, 0x03, 0x00, 0x00, + // 495 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x92, 0x31, 0x6f, 0xd3, 0x40, + 0x14, 0xc7, 0x7d, 0x25, 0x4a, 0xe0, 0x5a, 0x09, 0xc9, 0x6d, 0x21, 0x54, 0xc5, 0xae, 0xa2, 0x0e, + 0x01, 0x64, 0x9b, 0x84, 0xad, 0x0b, 0xaa, 0x43, 0x05, 0x15, 0x4b, 0x65, 0x98, 0x58, 0xa2, 0x67, + 0xfb, 0x94, 0x9e, 0x62, 0xdf, 0x45, 0xbe, 0x4b, 0x4a, 0xbf, 0x01, 0x12, 0x03, 0xf0, 0x0d, 0x18, + 0x11, 0x73, 0x27, 0x3e, 0x41, 0xc7, 0xaa, 0x13, 0x62, 0x08, 0x25, 0xf9, 0x16, 0x4c, 0xc8, 0x77, + 0x97, 0xa8, 0x44, 0x81, 0xc9, 0xe7, 0xe7, 0xff, 0xff, 0xdd, 0xcf, 0xff, 0xf7, 0x70, 0xa3, 0x0f, + 0x23, 0x08, 0xc8, 0x28, 0x1f, 0x4a, 0x9a, 0x05, 0xa3, 0x56, 0x4c, 0x24, 0xb4, 0x82, 0x1e, 0x61, + 0x44, 0x50, 0xe1, 0x0f, 0x0a, 0x2e, 0xb9, 0xbd, 0x51, 0x6a, 0x7c, 0xa3, 0xf1, 0x8d, 0x66, 0xeb, + 0x5e, 0xc2, 0x45, 0xce, 0x45, 0x57, 0x69, 0x02, 0xfd, 0xa2, 0x0d, 0x5b, 0x1b, 0x3d, 0xde, 0xe3, + 0xba, 0x5e, 0x9e, 0x4c, 0xf5, 0xe1, 0xd2, 0xab, 0x12, 0xce, 0x46, 0xa4, 0x10, 0x94, 0xb3, 0xee, + 0x00, 0x68, 0xa1, 0xb5, 0x8d, 0x4f, 0x08, 0xaf, 0x3d, 0xd7, 0x10, 0xaf, 0x24, 0x48, 0x62, 0x3f, + 0xc5, 0x37, 0x21, 0x49, 0xf8, 0x90, 0x49, 0x51, 0x47, 0x3b, 0x37, 0x9a, 0xab, 0xed, 0xfb, 0xfe, + 0x32, 0x2c, 0x7f, 0x5f, 0xab, 0xc2, 0xca, 0xf9, 0xd8, 0xb5, 0xa2, 0xb9, 0xc9, 0xde, 0xc3, 0xd5, + 0x01, 0x14, 0x90, 0x8b, 0xfa, 0xca, 0x0e, 0x6a, 0xae, 0xb6, 0xb7, 0x97, 0xdb, 0x8f, 0x94, 0xc6, + 0xb8, 0x8d, 0x63, 0xaf, 0xf2, 0xee, 0xb3, 0x6b, 0x35, 0xbe, 0x21, 0x5c, 0x33, 0xdd, 0xed, 0x18, + 0xd7, 0x20, 0x4d, 0x0b, 0x22, 0x4a, 0x1a, 0xd4, 0x5c, 0x0b, 0x5f, 0xfc, 0x1e, 0xbb, 0x5e, 0x8f, + 0xca, 0xe3, 0x61, 0xec, 0x27, 0x3c, 0x37, 0x79, 0x98, 0x87, 0x27, 0xd2, 0x7e, 0x20, 0x4f, 0x07, + 0x44, 0x94, 0x78, 0xfb, 0xda, 0x78, 0x79, 0xe6, 0xad, 0x9b, 0xd4, 0x4c, 0x25, 0x3c, 0x95, 0x44, + 0x44, 0xb3, 0xc6, 0xf6, 0x01, 0xae, 0xc5, 0x90, 0x01, 0x4b, 0x88, 0x42, 0xbe, 0x15, 0x3e, 0x2a, + 0xa1, 0x7e, 0x8c, 0xdd, 0x4d, 0x6d, 0x13, 0x69, 0xdf, 0xa7, 0x3c, 0xc8, 0x41, 0x1e, 0xfb, 0x87, + 0x4c, 0x5e, 0x9e, 0x79, 0xd8, 0xf4, 0x3b, 0x64, 0x32, 0x9a, 0x79, 0x0d, 0xfc, 0x87, 0x15, 0x5c, + 0xd5, 0xff, 0x66, 0x9f, 0xe0, 0x3a, 0x61, 0x10, 0x67, 0x24, 0xed, 0x2e, 0x84, 0x2f, 0xea, 0x15, + 0x15, 0xed, 0xee, 0xf2, 0x6c, 0x3a, 0x73, 0xf5, 0x11, 0xd0, 0x22, 0xbc, 0x5b, 0xe2, 0x7c, 0xfd, + 0xe9, 0xde, 0xfe, 0xbb, 0x2e, 0xa2, 0x3b, 0xa6, 0xfd, 0x42, 0xdd, 0x7e, 0x8f, 0xf0, 0x26, 0x64, + 0x19, 0x3f, 0x51, 0x37, 0xab, 0xe5, 0x49, 0x09, 0xe3, 0xf9, 0x6c, 0xa2, 0xad, 0x7f, 0x4c, 0x54, + 0x5b, 0x3a, 0xca, 0xd1, 0xe1, 0x94, 0x1d, 0x44, 0x9d, 0xf6, 0xe3, 0xd7, 0xbc, 0x4f, 0x58, 0xb8, + 0x6b, 0x18, 0xb6, 0xff, 0x23, 0x12, 0xd1, 0x3a, 0x5c, 0xff, 0xfa, 0x4c, 0xdd, 0x19, 0xbe, 0xbc, + 0xfa, 0xe5, 0xa0, 0x2f, 0x13, 0x07, 0x9d, 0x4f, 0x1c, 0x74, 0x31, 0x71, 0xd0, 0xd5, 0xc4, 0x41, + 0x1f, 0xa7, 0x8e, 0x75, 0x31, 0x75, 0xac, 0xef, 0x53, 0xc7, 0x7a, 0xf3, 0xe0, 0xda, 0x3c, 0x4b, + 0x32, 0x2f, 0x83, 0x58, 0xa8, 0x53, 0xf0, 0x76, 0xbe, 0xc7, 0x6a, 0xac, 0x71, 0x55, 0xad, 0xed, + 0x93, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x60, 0xf3, 0x3b, 0x54, 0x4f, 0x03, 0x00, 0x00, } func (this *GenesisState) VerboseEqual(that interface{}) error { diff --git a/x/evmutil/types/msg.go b/x/evmutil/types/msg.go index 093f96a3aa..ac00c477a5 100644 --- a/x/evmutil/types/msg.go +++ b/x/evmutil/types/msg.go @@ -3,15 +3,23 @@ package types import ( errorsmod "cosmossdk.io/errors" sdkmath "cosmossdk.io/math" + txsigning "cosmossdk.io/x/tx/signing" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" "github.com/ethereum/go-ethereum/common" + "google.golang.org/protobuf/protoadapt" + "google.golang.org/protobuf/reflect/protoreflect" + + protov1 "github.com/golang/protobuf/proto" //nolint:staticcheck + protov2 "google.golang.org/protobuf/proto" ) // ensure Msg interface compliance at compile time var ( - _ sdk.Msg = &MsgConvertCoinToERC20{} + _ sdk.Msg = &MsgConvertCoinToERC20{} + // TODO(boodyvo): do we want to switch to Msg? _ legacytx.LegacyMsg = &MsgConvertCoinToERC20{} _ sdk.Msg = &MsgConvertERC20ToCoin{} _ legacytx.LegacyMsg = &MsgConvertERC20ToCoin{} @@ -22,6 +30,32 @@ var ( _ legacytx.LegacyMsg = &MsgConvertCosmosCoinFromERC20{} ) +//var MsgsGetSigners = map[protoreflect.FullName]txsigning.GetSignersFunc{ +// protoreflect.FullName(protov1.MessageName(&MsgConvertCoinToERC20{})): GetSignersMsgConvertCoinToERC20, +// protoreflect.FullName(protov1.MessageName(&MsgConvertERC20ToCoin{})): GetSignersMsgConvertERC20ToCoin, +// protoreflect.FullName(protov1.MessageName(&MsgConvertCosmosCoinToERC20{})): GetSignersMsgConvertCosmosCoinToERC20, +// protoreflect.FullName(protov1.MessageName(&MsgConvertCosmosCoinFromERC20{})): GetSignersMsgConvertCosmosCoinFromERC20, +//} + +var ( + MsgConvertCoinToERC20GetSigners = txsigning.CustomGetSigner{ + MsgType: protoreflect.FullName(protov1.MessageName(&MsgConvertCoinToERC20{})), + Fn: GetSignersMsgConvertCoinToERC20, + } + MsgConvertERC20ToCoinGetSigners = txsigning.CustomGetSigner{ + MsgType: protoreflect.FullName(protov1.MessageName(&MsgConvertERC20ToCoin{})), + Fn: GetSignersMsgConvertERC20ToCoin, + } + MsgConvertCosmosCoinToERC20GetSigners = txsigning.CustomGetSigner{ + MsgType: protoreflect.FullName(protov1.MessageName(&MsgConvertCosmosCoinToERC20{})), + Fn: GetSignersMsgConvertCosmosCoinToERC20, + } + MsgConvertCosmosCoinFromERC20GetSigners = txsigning.CustomGetSigner{ + MsgType: protoreflect.FullName(protov1.MessageName(&MsgConvertCosmosCoinFromERC20{})), + Fn: GetSignersMsgConvertCosmosCoinFromERC20, + } +) + // legacy message types const ( TypeMsgConvertCoinToERC20 = "evmutil_convert_coin_to_erc20" @@ -57,6 +91,28 @@ func (msg MsgConvertCoinToERC20) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{sender} } +func GetSignersMsgConvertCoinToERC20(msg protov2.Message) ([][]byte, error) { + msgV1 := protoadapt.MessageV1Of(msg) + + tryingTypeAnyV1, err := codectypes.NewAnyWithValue(msgV1) + if err != nil { + return nil, err + } + + msgTyped := &MsgConvertCoinToERC20{} + err = msgTyped.Unmarshal(tryingTypeAnyV1.Value) + if err != nil { + return nil, err + } + + sender, err := sdk.AccAddressFromBech32(msgTyped.Initiator) + if err != nil { + return nil, err + } + + return [][]byte{sender}, nil +} + // ValidateBasic does a simple validation check that doesn't require access to any other information. func (msg MsgConvertCoinToERC20) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Initiator) @@ -116,6 +172,26 @@ func (msg MsgConvertERC20ToCoin) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{sender} } +func GetSignersMsgConvertERC20ToCoin(msg protov2.Message) ([][]byte, error) { + msgV1 := protoadapt.MessageV1Of(msg) + + tryingTypeAnyV1, err := codectypes.NewAnyWithValue(msgV1) + if err != nil { + return nil, err + } + + msgTyped := &MsgConvertERC20ToCoin{} + err = msgTyped.Unmarshal(tryingTypeAnyV1.Value) + if err != nil { + return nil, err + } + + addr := common.HexToAddress(msgTyped.Initiator) + sender := sdk.AccAddress(addr.Bytes()) + + return [][]byte{sender}, nil +} + // ValidateBasic does a simple validation check that doesn't require access to any other information. func (msg MsgConvertERC20ToCoin) ValidateBasic() error { if !common.IsHexAddress(msg.Initiator) { @@ -137,7 +213,7 @@ func (msg MsgConvertERC20ToCoin) ValidateBasic() error { return errorsmod.Wrap(sdkerrors.ErrInvalidAddress, "receiver is not a valid bech32 address") } - if msg.Amount.IsNil() || msg.Amount.LTE(sdk.ZeroInt()) { + if msg.Amount.IsNil() || msg.Amount.LTE(sdkmath.ZeroInt()) { return errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "amount cannot be zero or less") } @@ -185,6 +261,28 @@ func (msg MsgConvertCosmosCoinToERC20) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{sender} } +func GetSignersMsgConvertCosmosCoinToERC20(msg protov2.Message) ([][]byte, error) { + msgV1 := protoadapt.MessageV1Of(msg) + + tryingTypeAnyV1, err := codectypes.NewAnyWithValue(msgV1) + if err != nil { + return nil, err + } + + msgTyped := &MsgConvertERC20ToCoin{} + err = msgTyped.Unmarshal(tryingTypeAnyV1.Value) + if err != nil { + return nil, err + } + + sender, err := sdk.AccAddressFromBech32(msgTyped.Initiator) + if err != nil { + return nil, err + } + + return [][]byte{sender}, nil +} + // ValidateBasic implements types.Msg func (msg MsgConvertCosmosCoinToERC20) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Initiator) @@ -236,6 +334,28 @@ func (msg MsgConvertCosmosCoinFromERC20) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{sender0x.Bytes()} } +func GetSignersMsgConvertCosmosCoinFromERC20(msg protov2.Message) ([][]byte, error) { + msgV1 := protoadapt.MessageV1Of(msg) + + tryingTypeAnyV1, err := codectypes.NewAnyWithValue(msgV1) + if err != nil { + return nil, err + } + + msgTyped := &MsgConvertERC20ToCoin{} + err = msgTyped.Unmarshal(tryingTypeAnyV1.Value) + if err != nil { + return nil, err + } + + sender0x, err := NewInternalEVMAddressFromString(msgTyped.Initiator) + if err != nil { + return nil, err + } + + return [][]byte{sender0x.Bytes()}, nil +} + // ValidateBasic implements types.Msg func (msg MsgConvertCosmosCoinFromERC20) ValidateBasic() error { if !common.IsHexAddress(msg.Initiator) { diff --git a/x/evmutil/types/query.pb.go b/x/evmutil/types/query.pb.go index 9336d95d8c..3af62afd2d 100644 --- a/x/evmutil/types/query.pb.go +++ b/x/evmutil/types/query.pb.go @@ -411,6 +411,7 @@ func _Query_DeployedCosmosCoinContracts_Handler(srv interface{}, ctx context.Con return interceptor(ctx, in, info, handler) } +var Query_serviceDesc = _Query_serviceDesc var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "kava.evmutil.v1beta1.Query", HandlerType: (*QueryServer)(nil), diff --git a/x/evmutil/types/tx.pb.go b/x/evmutil/types/tx.pb.go index d4aa63b403..549d4e81c2 100644 --- a/x/evmutil/types/tx.pb.go +++ b/x/evmutil/types/tx.pb.go @@ -5,9 +5,9 @@ package types import ( context "context" + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" _ "github.com/cosmos/cosmos-proto" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" @@ -141,7 +141,7 @@ type MsgConvertERC20ToCoin struct { // EVM 0x hex address of the ERC20 contract. KavaERC20Address string `protobuf:"bytes,3,opt,name=kava_erc20_address,json=kavaErc20Address,proto3" json:"kava_erc20_address,omitempty"` // ERC20 token amount to convert. - Amount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,4,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"amount"` + Amount cosmossdk_io_math.Int `protobuf:"bytes,4,opt,name=amount,proto3,customtype=cosmossdk.io/math.Int" json:"amount"` } func (m *MsgConvertERC20ToCoin) Reset() { *m = MsgConvertERC20ToCoin{} } @@ -452,42 +452,42 @@ func init() { func init() { proto.RegisterFile("kava/evmutil/v1beta1/tx.proto", fileDescriptor_6e82783c6c58f89c) } var fileDescriptor_6e82783c6c58f89c = []byte{ - // 559 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x55, 0x41, 0x6b, 0xd4, 0x4c, - 0x18, 0xde, 0x69, 0x4b, 0xf9, 0x76, 0xbe, 0x4b, 0x19, 0x56, 0x48, 0xa3, 0xcd, 0x96, 0x95, 0x6a, - 0x45, 0x36, 0xe9, 0xee, 0x8a, 0x20, 0x7a, 0x71, 0x97, 0x0a, 0xa5, 0xf4, 0x12, 0xf7, 0xe4, 0x65, - 0x99, 0x64, 0x87, 0x18, 0xda, 0x64, 0x96, 0xcc, 0x6c, 0xa8, 0x3f, 0x40, 0x10, 0x11, 0xd1, 0x3f, - 0xe0, 0xd9, 0x1f, 0xd0, 0x1f, 0xd1, 0x63, 0xe9, 0x49, 0x3c, 0x2c, 0x35, 0xfb, 0x47, 0x64, 0x92, - 0x49, 0x3a, 0xd6, 0x98, 0xb5, 0x22, 0x78, 0xda, 0xcc, 0xbc, 0xcf, 0xf3, 0xbe, 0xcf, 0xf3, 0xbe, - 0x33, 0xb3, 0x70, 0xe3, 0x10, 0xc7, 0xd8, 0x22, 0x71, 0x30, 0xe5, 0xfe, 0x91, 0x15, 0x77, 0x1c, - 0xc2, 0x71, 0xc7, 0xe2, 0xc7, 0xe6, 0x24, 0xa2, 0x9c, 0xa2, 0x86, 0x08, 0x9b, 0x32, 0x6c, 0xca, - 0xb0, 0x6e, 0xb8, 0x94, 0x05, 0x94, 0x59, 0x0e, 0x66, 0xa4, 0xe0, 0xb8, 0xd4, 0x0f, 0x33, 0x96, - 0xbe, 0x9e, 0xc5, 0x47, 0xe9, 0xca, 0xca, 0x16, 0x32, 0xd4, 0xf0, 0xa8, 0x47, 0xb3, 0x7d, 0xf1, - 0x95, 0xed, 0xb6, 0x3e, 0x01, 0x78, 0xe3, 0x80, 0x79, 0x03, 0x1a, 0xc6, 0x24, 0xe2, 0x03, 0xea, - 0x87, 0x43, 0xba, 0x6b, 0x0f, 0xba, 0x3b, 0xe8, 0x21, 0xac, 0xfb, 0xa1, 0xcf, 0x7d, 0xcc, 0x69, - 0xa4, 0x81, 0x4d, 0xb0, 0x5d, 0xef, 0x6b, 0xe7, 0x27, 0xed, 0x86, 0x4c, 0xfa, 0x74, 0x3c, 0x8e, - 0x08, 0x63, 0xcf, 0x79, 0xe4, 0x87, 0x9e, 0x7d, 0x09, 0x45, 0x3a, 0xfc, 0x2f, 0x22, 0x2e, 0xf1, - 0x63, 0x12, 0x69, 0x4b, 0x82, 0x66, 0x17, 0x6b, 0xd4, 0x81, 0xab, 0x38, 0xa0, 0xd3, 0x90, 0x6b, - 0xcb, 0x9b, 0x60, 0xfb, 0xff, 0xee, 0xba, 0x29, 0xb3, 0x09, 0x3f, 0xb9, 0x49, 0x53, 0xa8, 0xb0, - 0x25, 0xb0, 0xd5, 0x84, 0x1b, 0xa5, 0xfa, 0x6c, 0xc2, 0x26, 0x34, 0x64, 0xa4, 0xf5, 0x7a, 0x49, - 0x75, 0x90, 0xc6, 0x86, 0x54, 0x00, 0xd1, 0xad, 0x9f, 0x1c, 0xa8, 0x3a, 0x1f, 0x5c, 0xd5, 0x59, - 0x61, 0xef, 0xd2, 0x41, 0x1f, 0x22, 0x31, 0x98, 0x11, 0x89, 0xdc, 0xee, 0xce, 0x08, 0x67, 0xa8, - 0xd4, 0x4d, 0xbd, 0xdf, 0x48, 0x66, 0xcd, 0xb5, 0x7d, 0x1c, 0xe3, 0x54, 0x84, 0xcc, 0x60, 0xaf, - 0x09, 0xfc, 0xae, 0x80, 0xcb, 0x1d, 0x34, 0x2c, 0xba, 0xb0, 0x92, 0xf2, 0x9e, 0x9c, 0xce, 0x9a, - 0xb5, 0xaf, 0xb3, 0xe6, 0x1d, 0xcf, 0xe7, 0x2f, 0xa7, 0x8e, 0xe9, 0xd2, 0x40, 0x8e, 0x4e, 0xfe, - 0xb4, 0xd9, 0xf8, 0xd0, 0xe2, 0xaf, 0x26, 0x84, 0x99, 0x7b, 0x21, 0x3f, 0x3f, 0x69, 0x43, 0xa9, - 0x72, 0x2f, 0xe4, 0xe5, 0x8d, 0x52, 0xda, 0x50, 0x34, 0xea, 0x2d, 0x80, 0x37, 0xd5, 0x56, 0x8a, - 0x0c, 0xea, 0xc0, 0xab, 0xdb, 0xf5, 0x97, 0xc7, 0xba, 0x05, 0x6f, 0x57, 0x68, 0x29, 0x34, 0xbf, - 0x03, 0x3f, 0x8e, 0x3f, 0xc7, 0x3d, 0x8b, 0x68, 0xf0, 0x0f, 0x54, 0xdf, 0x85, 0x5b, 0x95, 0x6a, - 0x72, 0xdd, 0xdd, 0x8f, 0x2b, 0x70, 0xf9, 0x80, 0x79, 0x28, 0x86, 0xa8, 0xe4, 0x6a, 0xdd, 0x37, - 0xcb, 0x2e, 0xb7, 0x59, 0x7a, 0xce, 0xf5, 0xde, 0x35, 0xc0, 0x79, 0x7d, 0xa5, 0xae, 0x7a, 0x21, - 0x16, 0xd6, 0x55, 0xc0, 0x8b, 0xeb, 0x96, 0x9c, 0x31, 0xf4, 0x06, 0x40, 0xed, 0x97, 0x07, 0xac, - 0xb3, 0xd8, 0xc9, 0x15, 0x8a, 0xfe, 0xe8, 0xda, 0x94, 0x42, 0xca, 0x7b, 0x00, 0xf5, 0x8a, 0x73, - 0xd3, 0xfb, 0xfd, 0xcc, 0x05, 0x49, 0x7f, 0xfc, 0x07, 0xa4, 0x5c, 0x50, 0x7f, 0xff, 0xe2, 0x9b, - 0x01, 0x3e, 0x27, 0x06, 0x38, 0x4d, 0x0c, 0x70, 0x96, 0x18, 0xe0, 0x22, 0x31, 0xc0, 0x87, 0xb9, - 0x51, 0x3b, 0x9b, 0x1b, 0xb5, 0x2f, 0x73, 0xa3, 0xf6, 0xe2, 0x9e, 0xf2, 0x00, 0x88, 0x42, 0xed, - 0x23, 0xec, 0xb0, 0xf4, 0xcb, 0x3a, 0x2e, 0xfe, 0x29, 0xd2, 0x77, 0xc0, 0x59, 0x4d, 0x9f, 0xef, - 0xde, 0xf7, 0x00, 0x00, 0x00, 0xff, 0xff, 0xa2, 0x5a, 0x1f, 0x90, 0x46, 0x06, 0x00, 0x00, + // 553 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x55, 0xdd, 0x6a, 0x13, 0x41, + 0x14, 0xce, 0xd8, 0x52, 0xcc, 0x78, 0x53, 0x86, 0x14, 0xb6, 0xab, 0xdd, 0x94, 0x48, 0xb1, 0x52, + 0x32, 0xdb, 0x24, 0x22, 0x88, 0x57, 0x26, 0x54, 0x28, 0xa5, 0x37, 0x6b, 0xaf, 0xbc, 0x09, 0xb3, + 0x9b, 0x61, 0x3b, 0xb4, 0xbb, 0x13, 0x76, 0x26, 0x4b, 0x7d, 0x03, 0x11, 0x11, 0x7d, 0x01, 0xaf, + 0x7d, 0x80, 0x3e, 0x44, 0x2f, 0x4b, 0xaf, 0xc4, 0x8b, 0x50, 0x37, 0xaf, 0xe0, 0x03, 0xc8, 0xec, + 0x5f, 0xb7, 0x75, 0xdd, 0x58, 0x11, 0xbc, 0xdb, 0x99, 0xf3, 0x7d, 0xe7, 0x7c, 0xdf, 0x39, 0x67, + 0x12, 0xb8, 0x76, 0x44, 0x42, 0x62, 0xd2, 0xd0, 0x9b, 0x48, 0x76, 0x6c, 0x86, 0x1d, 0x9b, 0x4a, + 0xd2, 0x31, 0xe5, 0x09, 0x1e, 0x07, 0x5c, 0x72, 0xd4, 0x50, 0x61, 0x9c, 0x86, 0x71, 0x1a, 0xd6, + 0x0d, 0x87, 0x0b, 0x8f, 0x0b, 0xd3, 0x26, 0x82, 0xe6, 0x1c, 0x87, 0x33, 0x3f, 0x61, 0xe9, 0xab, + 0x49, 0x7c, 0x18, 0x9f, 0xcc, 0xe4, 0x90, 0x86, 0x1a, 0x2e, 0x77, 0x79, 0x72, 0xaf, 0xbe, 0x92, + 0xdb, 0xd6, 0x67, 0x00, 0x57, 0xf6, 0x85, 0x3b, 0xe0, 0x7e, 0x48, 0x03, 0x39, 0xe0, 0xcc, 0x3f, + 0xe0, 0x3b, 0xd6, 0xa0, 0xbb, 0x8d, 0x9e, 0xc2, 0x3a, 0xf3, 0x99, 0x64, 0x44, 0xf2, 0x40, 0x03, + 0xeb, 0x60, 0xb3, 0xde, 0xd7, 0x2e, 0x4e, 0xdb, 0x8d, 0x34, 0xe9, 0x8b, 0xd1, 0x28, 0xa0, 0x42, + 0xbc, 0x92, 0x01, 0xf3, 0x5d, 0xeb, 0x0a, 0x8a, 0x74, 0x78, 0x37, 0xa0, 0x0e, 0x65, 0x21, 0x0d, + 0xb4, 0x3b, 0x8a, 0x66, 0xe5, 0x67, 0xd4, 0x81, 0x4b, 0xc4, 0xe3, 0x13, 0x5f, 0x6a, 0x0b, 0xeb, + 0x60, 0xf3, 0x5e, 0x77, 0x15, 0xa7, 0xd9, 0x94, 0x9f, 0xcc, 0x24, 0x56, 0x2a, 0xac, 0x14, 0xd8, + 0x6a, 0xc2, 0xb5, 0x52, 0x7d, 0x16, 0x15, 0x63, 0xee, 0x0b, 0xda, 0xfa, 0x71, 0xcd, 0x41, 0x1c, + 0x3b, 0xe0, 0x0a, 0x88, 0x1e, 0xfc, 0xe2, 0xa0, 0xa8, 0xf3, 0xc9, 0x4d, 0x9d, 0x15, 0xf6, 0xae, + 0x1c, 0xf4, 0x21, 0x52, 0x83, 0x19, 0xd2, 0xc0, 0xe9, 0x6e, 0x0f, 0x49, 0x82, 0x8a, 0xdd, 0xd4, + 0xfb, 0x8d, 0x68, 0xda, 0x5c, 0xde, 0x23, 0x21, 0x89, 0x45, 0xa4, 0x19, 0xac, 0x65, 0x85, 0xdf, + 0x51, 0xf0, 0xf4, 0x06, 0x0d, 0xf2, 0x2e, 0x2c, 0xc6, 0xbc, 0xad, 0xb3, 0x69, 0xb3, 0xf6, 0x6d, + 0xda, 0x5c, 0x49, 0x6a, 0x8b, 0xd1, 0x11, 0x66, 0xdc, 0xf4, 0x88, 0x3c, 0xc4, 0xbb, 0xbe, 0xbc, + 0x38, 0x6d, 0xc3, 0x54, 0xd4, 0xae, 0x2f, 0xcb, 0xfb, 0x52, 0x70, 0x9d, 0xf7, 0xe5, 0x1d, 0x80, + 0xf7, 0x8b, 0x9d, 0x53, 0x19, 0x8a, 0xf3, 0xad, 0xee, 0xce, 0x3f, 0x9e, 0xe2, 0x06, 0x7c, 0x58, + 0xa1, 0x25, 0xd7, 0xfc, 0x1e, 0x5c, 0x9f, 0x76, 0x86, 0x7b, 0x19, 0x70, 0xef, 0x3f, 0xa8, 0x7e, + 0x04, 0x37, 0x2a, 0xd5, 0x64, 0xba, 0xbb, 0x9f, 0x16, 0xe1, 0xc2, 0xbe, 0x70, 0x51, 0x08, 0x51, + 0xc9, 0x4b, 0xda, 0xc2, 0x65, 0x6f, 0x19, 0x97, 0xae, 0xb5, 0xde, 0xbb, 0x05, 0x38, 0xab, 0x5f, + 0xa8, 0x5b, 0xdc, 0xff, 0xb9, 0x75, 0x0b, 0xe0, 0xf9, 0x75, 0x4b, 0x76, 0x0c, 0xbd, 0x05, 0x50, + 0xfb, 0xed, 0x82, 0x75, 0xe6, 0x3b, 0xb9, 0x41, 0xd1, 0x9f, 0xdd, 0x9a, 0x92, 0x4b, 0xf9, 0x00, + 0xa0, 0x5e, 0xb1, 0x37, 0xbd, 0x3f, 0xcf, 0x9c, 0x93, 0xf4, 0xe7, 0x7f, 0x41, 0xca, 0x04, 0xf5, + 0xf7, 0x2e, 0xbf, 0x1b, 0xe0, 0x4b, 0x64, 0x80, 0xb3, 0xc8, 0x00, 0xe7, 0x91, 0x01, 0x2e, 0x23, + 0x03, 0x7c, 0x9c, 0x19, 0xb5, 0xf3, 0x99, 0x51, 0xfb, 0x3a, 0x33, 0x6a, 0xaf, 0x1f, 0xbb, 0x4c, + 0x1e, 0x4e, 0x6c, 0xec, 0x70, 0xcf, 0x54, 0x85, 0xda, 0xc7, 0xc4, 0x16, 0xf1, 0x97, 0x79, 0x92, + 0xff, 0x31, 0xc8, 0x37, 0x63, 0x2a, 0xec, 0xa5, 0xf8, 0xd7, 0xba, 0xf7, 0x33, 0x00, 0x00, 0xff, + 0xff, 0xcd, 0x21, 0x15, 0x75, 0x35, 0x06, 0x00, 0x00, } func (this *MsgConvertCoinToERC20) VerboseEqual(that interface{}) error { @@ -1124,6 +1124,7 @@ func _Msg_ConvertCosmosCoinFromERC20_Handler(srv interface{}, ctx context.Contex return interceptor(ctx, in, info, handler) } +var Msg_serviceDesc = _Msg_serviceDesc var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "kava.evmutil.v1beta1.Msg", HandlerType: (*MsgServer)(nil), diff --git a/x/hard/genesis.go b/x/hard/genesis.go index b19749d3b3..91079f5951 100644 --- a/x/hard/genesis.go +++ b/x/hard/genesis.go @@ -1,6 +1,7 @@ package hard import ( + sdkmath "cosmossdk.io/math" "fmt" sdk "github.com/cosmos/cosmos-sdk/types" @@ -90,11 +91,11 @@ func ExportGenesis(ctx sdk.Context, k keeper.Keeper) types.GenesisState { for _, mm := range params.MoneyMarkets { supplyFactor, f := k.GetSupplyInterestFactor(ctx, mm.Denom) if !f { - supplyFactor = sdk.OneDec() + supplyFactor = sdkmath.LegacyOneDec() } borrowFactor, f := k.GetBorrowInterestFactor(ctx, mm.Denom) if !f { - borrowFactor = sdk.OneDec() + borrowFactor = sdkmath.LegacyOneDec() } previousAccrualTime, f := k.GetPreviousAccrualTime(ctx, mm.Denom) if !f { diff --git a/x/hard/genesis_test.go b/x/hard/genesis_test.go index 8d8b923acc..298dbd230c 100644 --- a/x/hard/genesis_test.go +++ b/x/hard/genesis_test.go @@ -31,7 +31,7 @@ type GenesisTestSuite struct { func (suite *GenesisTestSuite) SetupTest() { tApp := app.NewTestApp() suite.genTime = tmtime.Canonical(time.Date(2021, 1, 1, 1, 1, 1, 1, time.UTC)) - suite.ctx = tApp.NewContext(true, tmproto.Header{Height: 1, Time: suite.genTime}) + suite.ctx = tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: suite.genTime}) suite.keeper = tApp.GetHardKeeper() suite.app = tApp @@ -40,29 +40,29 @@ func (suite *GenesisTestSuite) SetupTest() { } func (suite *GenesisTestSuite) Test_InitExportGenesis() { - loanToValue, _ := sdk.NewDecFromStr("0.6") + loanToValue, _ := sdkmath.LegacyNewDecFromStr("0.6") params := types.NewParams( types.MoneyMarkets{ types.NewMoneyMarket( "ukava", types.NewBorrowLimit( false, - sdk.NewDec(1e15), + sdkmath.LegacyNewDec(1e15), loanToValue, ), "kava:usd", sdkmath.NewInt(1e6), types.NewInterestRateModel( - sdk.MustNewDecFromStr("0.05"), - sdk.MustNewDecFromStr("2"), - sdk.MustNewDecFromStr("0.8"), - sdk.MustNewDecFromStr("10"), + sdkmath.LegacyMustNewDecFromStr("0.05"), + sdkmath.LegacyMustNewDecFromStr("2"), + sdkmath.LegacyMustNewDecFromStr("0.8"), + sdkmath.LegacyMustNewDecFromStr("10"), ), - sdk.MustNewDecFromStr("0.05"), - sdk.ZeroDec(), + sdkmath.LegacyMustNewDecFromStr("0.05"), + sdkmath.LegacyZeroDec(), ), }, - sdk.NewDec(10), + sdkmath.LegacyNewDec(10), ) deposits := types.Deposits{ @@ -72,7 +72,7 @@ func (suite *GenesisTestSuite) Test_InitExportGenesis() { types.SupplyInterestFactors{ { Denom: "ukava", - Value: sdk.NewDec(1), + Value: sdkmath.LegacyNewDec(1), }, }, ), @@ -90,7 +90,7 @@ func (suite *GenesisTestSuite) Test_InitExportGenesis() { types.BorrowInterestFactors{ { Denom: "ukava", - Value: sdk.NewDec(1), + Value: sdkmath.LegacyNewDec(1), }, }, ), @@ -101,8 +101,8 @@ func (suite *GenesisTestSuite) Test_InitExportGenesis() { totalBorrowed = totalBorrowed.Add(borrow.Amount...) } - supplyInterestFactor := sdk.MustNewDecFromStr("1.0001") - borrowInterestFactor := sdk.MustNewDecFromStr("1.1234") + supplyInterestFactor := sdkmath.LegacyMustNewDecFromStr("1.0001") + borrowInterestFactor := sdkmath.LegacyMustNewDecFromStr("1.1234") accuralTimes := types.GenesisAccumulationTimes{ types.NewGenesisAccumulationTime("ukava", suite.genTime, supplyInterestFactor, borrowInterestFactor), } diff --git a/x/hard/keeper/borrow.go b/x/hard/keeper/borrow.go index df65fc14ef..cd06cc61ab 100644 --- a/x/hard/keeper/borrow.go +++ b/x/hard/keeper/borrow.go @@ -18,7 +18,7 @@ func (k Keeper) Borrow(ctx sdk.Context, borrower sdk.AccAddress, coins sdk.Coins if !foundInterestFactor { _, foundMm := k.GetMoneyMarket(ctx, coin.Denom) if foundMm { - k.SetBorrowInterestFactor(ctx, coin.Denom, sdk.OneDec()) + k.SetBorrowInterestFactor(ctx, coin.Denom, sdkmath.LegacyOneDec()) } } } @@ -135,7 +135,7 @@ func (k Keeper) ValidateBorrow(ctx sdk.Context, borrower sdk.AccAddress, amount } // Get the proposed borrow USD value - proprosedBorrowUSDValue := sdk.ZeroDec() + proprosedBorrowUSDValue := sdkmath.LegacyZeroDec() for _, coin := range amount { moneyMarket, found := k.GetMoneyMarket(ctx, coin.Denom) if !found { @@ -147,18 +147,18 @@ func (k Keeper) ValidateBorrow(ctx sdk.Context, borrower sdk.AccAddress, amount if err != nil { return errorsmod.Wrapf(types.ErrPriceNotFound, "no price found for market %s", moneyMarket.SpotMarketID) } - coinUSDValue := sdk.NewDecFromInt(coin.Amount).Quo(sdk.NewDecFromInt(moneyMarket.ConversionFactor)).Mul(assetPriceInfo.Price) + coinUSDValue := sdkmath.LegacyNewDecFromInt(coin.Amount).Quo(sdkmath.LegacyNewDecFromInt(moneyMarket.ConversionFactor)).Mul(assetPriceInfo.Price) // Validate the requested borrow value for the asset against the money market's global borrow limit if moneyMarket.BorrowLimit.HasMaxLimit { var assetTotalBorrowedAmount sdkmath.Int totalBorrowedCoins, found := k.GetBorrowedCoins(ctx) if !found { - assetTotalBorrowedAmount = sdk.ZeroInt() + assetTotalBorrowedAmount = sdkmath.ZeroInt() } else { assetTotalBorrowedAmount = totalBorrowedCoins.AmountOf(coin.Denom) } - newProposedAssetTotalBorrowedAmount := sdk.NewDecFromInt(assetTotalBorrowedAmount.Add(coin.Amount)) + newProposedAssetTotalBorrowedAmount := sdkmath.LegacyNewDecFromInt(assetTotalBorrowedAmount.Add(coin.Amount)) if newProposedAssetTotalBorrowedAmount.GT(moneyMarket.BorrowLimit.MaximumLimit) { return errorsmod.Wrapf(types.ErrGreaterThanAssetBorrowLimit, "proposed borrow would result in %s borrowed, but the maximum global asset borrow limit is %s", @@ -173,7 +173,7 @@ func (k Keeper) ValidateBorrow(ctx sdk.Context, borrower sdk.AccAddress, amount if !found { return errorsmod.Wrapf(types.ErrDepositsNotFound, "no deposits found for %s", borrower) } - totalBorrowableAmount := sdk.ZeroDec() + totalBorrowableAmount := sdkmath.LegacyZeroDec() for _, coin := range deposit.Amount { moneyMarket, found := k.GetMoneyMarket(ctx, coin.Denom) if !found { @@ -185,13 +185,13 @@ func (k Keeper) ValidateBorrow(ctx sdk.Context, borrower sdk.AccAddress, amount if err != nil { return errorsmod.Wrapf(types.ErrPriceNotFound, "no price found for market %s", moneyMarket.SpotMarketID) } - depositUSDValue := sdk.NewDecFromInt(coin.Amount).Quo(sdk.NewDecFromInt(moneyMarket.ConversionFactor)).Mul(assetPriceInfo.Price) + depositUSDValue := sdkmath.LegacyNewDecFromInt(coin.Amount).Quo(sdkmath.LegacyNewDecFromInt(moneyMarket.ConversionFactor)).Mul(assetPriceInfo.Price) borrowableAmountForDeposit := depositUSDValue.Mul(moneyMarket.BorrowLimit.LoanToValue) totalBorrowableAmount = totalBorrowableAmount.Add(borrowableAmountForDeposit) } // Get the total USD value of user's existing borrows - existingBorrowUSDValue := sdk.ZeroDec() + existingBorrowUSDValue := sdkmath.LegacyZeroDec() existingBorrow, found := k.GetBorrow(ctx, borrower) if found { for _, coin := range existingBorrow.Amount { @@ -205,7 +205,7 @@ func (k Keeper) ValidateBorrow(ctx sdk.Context, borrower sdk.AccAddress, amount if err != nil { return errorsmod.Wrapf(types.ErrPriceNotFound, "no price found for market %s", moneyMarket.SpotMarketID) } - coinUSDValue := sdk.NewDecFromInt(coin.Amount).Quo(sdk.NewDecFromInt(moneyMarket.ConversionFactor)).Mul(assetPriceInfo.Price) + coinUSDValue := sdkmath.LegacyNewDecFromInt(coin.Amount).Quo(sdkmath.LegacyNewDecFromInt(moneyMarket.ConversionFactor)).Mul(assetPriceInfo.Price) existingBorrowUSDValue = existingBorrowUSDValue.Add(coinUSDValue) } } @@ -278,7 +278,7 @@ func (k Keeper) DecrementBorrowedCoins(ctx sdk.Context, coins sdk.Coins) error { coinsToSubtract := sdk.NewCoins() for _, coin := range coins { if borrowedCoins.AmountOf(coin.Denom).LT(coin.Amount) { - if borrowedCoins.AmountOf(coin.Denom).GT(sdk.ZeroInt()) { + if borrowedCoins.AmountOf(coin.Denom).GT(sdkmath.ZeroInt()) { coinsToSubtract = coinsToSubtract.Add(sdk.NewCoin(coin.Denom, borrowedCoins.AmountOf(coin.Denom))) } } else { @@ -320,7 +320,7 @@ func (k Keeper) loadSyncedBorrow(ctx sdk.Context, borrow types.Borrow) types.Bor // Calculate interest owed by user for this asset if foundAtIndex != -1 { - storedAmount := sdk.NewDecFromInt(borrow.Amount.AmountOf(coin.Denom)) + storedAmount := sdkmath.LegacyNewDecFromInt(borrow.Amount.AmountOf(coin.Denom)) userLastInterestFactor := borrow.Index[foundAtIndex].Value coinInterest := (storedAmount.Quo(userLastInterestFactor).Mul(interestFactorValue)).Sub(storedAmount) totalNewInterest = totalNewInterest.Add(sdk.NewCoin(coin.Denom, coinInterest.TruncateInt())) diff --git a/x/hard/keeper/borrow_test.go b/x/hard/keeper/borrow_test.go index 9f9c8f5d7a..45e3a6695b 100644 --- a/x/hard/keeper/borrow_test.go +++ b/x/hard/keeper/borrow_test.go @@ -26,13 +26,13 @@ const ( func (suite *KeeperTestSuite) TestBorrow() { type setupArgs struct { - usdxBorrowLimit sdk.Dec - priceKAVA sdk.Dec - loanToValueKAVA sdk.Dec - priceBTCB sdk.Dec - loanToValueBTCB sdk.Dec - priceBNB sdk.Dec - loanToValueBNB sdk.Dec + usdxBorrowLimit sdkmath.LegacyDec + priceKAVA sdkmath.LegacyDec + loanToValueKAVA sdkmath.LegacyDec + priceBTCB sdkmath.LegacyDec + loanToValueBTCB sdkmath.LegacyDec + priceBNB sdkmath.LegacyDec + loanToValueBNB sdkmath.LegacyDec borrower sdk.AccAddress depositCoins []sdk.Coin initialBorrowCoins sdk.Coins @@ -61,13 +61,13 @@ func (suite *KeeperTestSuite) TestBorrow() { { name: "valid", setup: setupArgs{ - usdxBorrowLimit: sdk.MustNewDecFromStr("100000000000"), - priceKAVA: sdk.MustNewDecFromStr("5.00"), - loanToValueKAVA: sdk.MustNewDecFromStr("0.6"), - priceBTCB: sdk.MustNewDecFromStr("0.00"), - loanToValueBTCB: sdk.MustNewDecFromStr("0.01"), - priceBNB: sdk.MustNewDecFromStr("0.00"), - loanToValueBNB: sdk.MustNewDecFromStr("0.01"), + usdxBorrowLimit: sdkmath.LegacyMustNewDecFromStr("100000000000"), + priceKAVA: sdkmath.LegacyMustNewDecFromStr("5.00"), + loanToValueKAVA: sdkmath.LegacyMustNewDecFromStr("0.6"), + priceBTCB: sdkmath.LegacyMustNewDecFromStr("0.00"), + loanToValueBTCB: sdkmath.LegacyMustNewDecFromStr("0.01"), + priceBNB: sdkmath.LegacyMustNewDecFromStr("0.00"), + loanToValueBNB: sdkmath.LegacyMustNewDecFromStr("0.01"), borrower: sdk.AccAddress(crypto.AddressHash([]byte("test"))), depositCoins: []sdk.Coin{sdk.NewCoin("ukava", sdkmath.NewInt(100*KAVA_CF))}, initialBorrowCoins: sdk.NewCoins(), @@ -90,13 +90,13 @@ func (suite *KeeperTestSuite) TestBorrow() { { name: "invalid: loan-to-value limited", setup: setupArgs{ - usdxBorrowLimit: sdk.MustNewDecFromStr("100000000000"), - priceKAVA: sdk.MustNewDecFromStr("5.00"), - loanToValueKAVA: sdk.MustNewDecFromStr("0.6"), - priceBTCB: sdk.MustNewDecFromStr("0.00"), - loanToValueBTCB: sdk.MustNewDecFromStr("0.01"), - priceBNB: sdk.MustNewDecFromStr("0.00"), - loanToValueBNB: sdk.MustNewDecFromStr("0.01"), + usdxBorrowLimit: sdkmath.LegacyMustNewDecFromStr("100000000000"), + priceKAVA: sdkmath.LegacyMustNewDecFromStr("5.00"), + loanToValueKAVA: sdkmath.LegacyMustNewDecFromStr("0.6"), + priceBTCB: sdkmath.LegacyMustNewDecFromStr("0.00"), + loanToValueBTCB: sdkmath.LegacyMustNewDecFromStr("0.01"), + priceBNB: sdkmath.LegacyMustNewDecFromStr("0.00"), + loanToValueBNB: sdkmath.LegacyMustNewDecFromStr("0.01"), borrower: sdk.AccAddress(crypto.AddressHash([]byte("test"))), depositCoins: []sdk.Coin{sdk.NewCoin("ukava", sdkmath.NewInt(20*KAVA_CF))}, // 20 KAVA x $5.00 price = $100 initialBorrowCoins: sdk.NewCoins(), @@ -120,13 +120,13 @@ func (suite *KeeperTestSuite) TestBorrow() { { name: "valid: multiple deposits", setup: setupArgs{ - usdxBorrowLimit: sdk.MustNewDecFromStr("100000000000"), - priceKAVA: sdk.MustNewDecFromStr("2.00"), - loanToValueKAVA: sdk.MustNewDecFromStr("0.80"), - priceBTCB: sdk.MustNewDecFromStr("10000.00"), - loanToValueBTCB: sdk.MustNewDecFromStr("0.10"), - priceBNB: sdk.MustNewDecFromStr("0.00"), - loanToValueBNB: sdk.MustNewDecFromStr("0.01"), + usdxBorrowLimit: sdkmath.LegacyMustNewDecFromStr("100000000000"), + priceKAVA: sdkmath.LegacyMustNewDecFromStr("2.00"), + loanToValueKAVA: sdkmath.LegacyMustNewDecFromStr("0.80"), + priceBTCB: sdkmath.LegacyMustNewDecFromStr("10000.00"), + loanToValueBTCB: sdkmath.LegacyMustNewDecFromStr("0.10"), + priceBNB: sdkmath.LegacyMustNewDecFromStr("0.00"), + loanToValueBNB: sdkmath.LegacyMustNewDecFromStr("0.01"), borrower: sdk.AccAddress(crypto.AddressHash([]byte("test"))), depositCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(50*KAVA_CF)), sdk.NewCoin("btcb", sdkmath.NewInt(0.1*BTCB_CF))), initialBorrowCoins: sdk.NewCoins(), @@ -151,13 +151,13 @@ func (suite *KeeperTestSuite) TestBorrow() { { name: "invalid: multiple deposits", setup: setupArgs{ - usdxBorrowLimit: sdk.MustNewDecFromStr("100000000000"), - priceKAVA: sdk.MustNewDecFromStr("2.00"), - loanToValueKAVA: sdk.MustNewDecFromStr("0.80"), - priceBTCB: sdk.MustNewDecFromStr("10000.00"), - loanToValueBTCB: sdk.MustNewDecFromStr("0.10"), - priceBNB: sdk.MustNewDecFromStr("0.00"), - loanToValueBNB: sdk.MustNewDecFromStr("0.01"), + usdxBorrowLimit: sdkmath.LegacyMustNewDecFromStr("100000000000"), + priceKAVA: sdkmath.LegacyMustNewDecFromStr("2.00"), + loanToValueKAVA: sdkmath.LegacyMustNewDecFromStr("0.80"), + priceBTCB: sdkmath.LegacyMustNewDecFromStr("10000.00"), + loanToValueBTCB: sdkmath.LegacyMustNewDecFromStr("0.10"), + priceBNB: sdkmath.LegacyMustNewDecFromStr("0.00"), + loanToValueBNB: sdkmath.LegacyMustNewDecFromStr("0.01"), borrower: sdk.AccAddress(crypto.AddressHash([]byte("test"))), depositCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(50*KAVA_CF)), sdk.NewCoin("btcb", sdkmath.NewInt(0.1*BTCB_CF))), initialBorrowCoins: sdk.NewCoins(), @@ -181,13 +181,13 @@ func (suite *KeeperTestSuite) TestBorrow() { { name: "valid: multiple previous borrows", setup: setupArgs{ - usdxBorrowLimit: sdk.MustNewDecFromStr("100000000000"), - priceKAVA: sdk.MustNewDecFromStr("2.00"), - loanToValueKAVA: sdk.MustNewDecFromStr("0.8"), - priceBTCB: sdk.MustNewDecFromStr("0.00"), - loanToValueBTCB: sdk.MustNewDecFromStr("0.01"), - priceBNB: sdk.MustNewDecFromStr("5.00"), - loanToValueBNB: sdk.MustNewDecFromStr("0.8"), + usdxBorrowLimit: sdkmath.LegacyMustNewDecFromStr("100000000000"), + priceKAVA: sdkmath.LegacyMustNewDecFromStr("2.00"), + loanToValueKAVA: sdkmath.LegacyMustNewDecFromStr("0.8"), + priceBTCB: sdkmath.LegacyMustNewDecFromStr("0.00"), + loanToValueBTCB: sdkmath.LegacyMustNewDecFromStr("0.01"), + priceBNB: sdkmath.LegacyMustNewDecFromStr("5.00"), + loanToValueBNB: sdkmath.LegacyMustNewDecFromStr("0.8"), borrower: sdk.AccAddress(crypto.AddressHash([]byte("test"))), depositCoins: sdk.NewCoins(sdk.NewCoin("bnb", sdkmath.NewInt(30*BNB_CF)), sdk.NewCoin("ukava", sdkmath.NewInt(50*KAVA_CF))), // (50 KAVA x $2.00 price = $100) + (30 BNB x $5.00 price = $150) = $250 initialBorrowCoins: sdk.NewCoins(sdk.NewCoin("usdx", sdkmath.NewInt(99*USDX_CF)), sdk.NewCoin("busd", sdkmath.NewInt(100*BUSD_CF))), @@ -210,13 +210,13 @@ func (suite *KeeperTestSuite) TestBorrow() { { name: "invalid: over loan-to-value with multiple previous borrows", setup: setupArgs{ - usdxBorrowLimit: sdk.MustNewDecFromStr("100000000000"), - priceKAVA: sdk.MustNewDecFromStr("2.00"), - loanToValueKAVA: sdk.MustNewDecFromStr("0.8"), - priceBTCB: sdk.MustNewDecFromStr("0.00"), - loanToValueBTCB: sdk.MustNewDecFromStr("0.01"), - priceBNB: sdk.MustNewDecFromStr("5.00"), - loanToValueBNB: sdk.MustNewDecFromStr("0.8"), + usdxBorrowLimit: sdkmath.LegacyMustNewDecFromStr("100000000000"), + priceKAVA: sdkmath.LegacyMustNewDecFromStr("2.00"), + loanToValueKAVA: sdkmath.LegacyMustNewDecFromStr("0.8"), + priceBTCB: sdkmath.LegacyMustNewDecFromStr("0.00"), + loanToValueBTCB: sdkmath.LegacyMustNewDecFromStr("0.01"), + priceBNB: sdkmath.LegacyMustNewDecFromStr("5.00"), + loanToValueBNB: sdkmath.LegacyMustNewDecFromStr("0.8"), borrower: sdk.AccAddress(crypto.AddressHash([]byte("test"))), depositCoins: sdk.NewCoins(sdk.NewCoin("bnb", sdkmath.NewInt(30*BNB_CF)), sdk.NewCoin("ukava", sdkmath.NewInt(50*KAVA_CF))), // (50 KAVA x $2.00 price = $100) + (30 BNB x $5.00 price = $150) = $250 initialBorrowCoins: sdk.NewCoins(sdk.NewCoin("usdx", sdkmath.NewInt(100*USDX_CF)), sdk.NewCoin("busd", sdkmath.NewInt(100*BUSD_CF))), @@ -239,13 +239,13 @@ func (suite *KeeperTestSuite) TestBorrow() { { name: "invalid: no price for asset", setup: setupArgs{ - usdxBorrowLimit: sdk.MustNewDecFromStr("100000000000"), - priceKAVA: sdk.MustNewDecFromStr("5.00"), - loanToValueKAVA: sdk.MustNewDecFromStr("0.6"), - priceBTCB: sdk.MustNewDecFromStr("0.00"), - loanToValueBTCB: sdk.MustNewDecFromStr("0.01"), - priceBNB: sdk.MustNewDecFromStr("0.00"), - loanToValueBNB: sdk.MustNewDecFromStr("0.01"), + usdxBorrowLimit: sdkmath.LegacyMustNewDecFromStr("100000000000"), + priceKAVA: sdkmath.LegacyMustNewDecFromStr("5.00"), + loanToValueKAVA: sdkmath.LegacyMustNewDecFromStr("0.6"), + priceBTCB: sdkmath.LegacyMustNewDecFromStr("0.00"), + loanToValueBTCB: sdkmath.LegacyMustNewDecFromStr("0.01"), + priceBNB: sdkmath.LegacyMustNewDecFromStr("0.00"), + loanToValueBNB: sdkmath.LegacyMustNewDecFromStr("0.01"), borrower: sdk.AccAddress(crypto.AddressHash([]byte("test"))), depositCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(100*KAVA_CF))), initialBorrowCoins: sdk.NewCoins(), @@ -269,13 +269,13 @@ func (suite *KeeperTestSuite) TestBorrow() { { name: "invalid: borrow exceed module account balance", setup: setupArgs{ - usdxBorrowLimit: sdk.MustNewDecFromStr("100000000000"), - priceKAVA: sdk.MustNewDecFromStr("2.00"), - loanToValueKAVA: sdk.MustNewDecFromStr("0.8"), - priceBTCB: sdk.MustNewDecFromStr("0.00"), - loanToValueBTCB: sdk.MustNewDecFromStr("0.01"), - priceBNB: sdk.MustNewDecFromStr("0.00"), - loanToValueBNB: sdk.MustNewDecFromStr("0.01"), + usdxBorrowLimit: sdkmath.LegacyMustNewDecFromStr("100000000000"), + priceKAVA: sdkmath.LegacyMustNewDecFromStr("2.00"), + loanToValueKAVA: sdkmath.LegacyMustNewDecFromStr("0.8"), + priceBTCB: sdkmath.LegacyMustNewDecFromStr("0.00"), + loanToValueBTCB: sdkmath.LegacyMustNewDecFromStr("0.01"), + priceBNB: sdkmath.LegacyMustNewDecFromStr("0.00"), + loanToValueBNB: sdkmath.LegacyMustNewDecFromStr("0.01"), borrower: sdk.AccAddress(crypto.AddressHash([]byte("test"))), depositCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(100*KAVA_CF))), initialBorrowCoins: sdk.NewCoins(), @@ -298,13 +298,13 @@ func (suite *KeeperTestSuite) TestBorrow() { { name: "invalid: over global asset borrow limit", setup: setupArgs{ - usdxBorrowLimit: sdk.MustNewDecFromStr("20000000"), - priceKAVA: sdk.MustNewDecFromStr("2.00"), - loanToValueKAVA: sdk.MustNewDecFromStr("0.8"), - priceBTCB: sdk.MustNewDecFromStr("0.00"), - loanToValueBTCB: sdk.MustNewDecFromStr("0.01"), - priceBNB: sdk.MustNewDecFromStr("0.00"), - loanToValueBNB: sdk.MustNewDecFromStr("0.01"), + usdxBorrowLimit: sdkmath.LegacyMustNewDecFromStr("20000000"), + priceKAVA: sdkmath.LegacyMustNewDecFromStr("2.00"), + loanToValueKAVA: sdkmath.LegacyMustNewDecFromStr("0.8"), + priceBTCB: sdkmath.LegacyMustNewDecFromStr("0.00"), + loanToValueBTCB: sdkmath.LegacyMustNewDecFromStr("0.01"), + priceBNB: sdkmath.LegacyMustNewDecFromStr("0.00"), + loanToValueBNB: sdkmath.LegacyMustNewDecFromStr("0.01"), borrower: sdk.AccAddress(crypto.AddressHash([]byte("test"))), depositCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(50*KAVA_CF))), initialBorrowCoins: sdk.NewCoins(), @@ -327,13 +327,13 @@ func (suite *KeeperTestSuite) TestBorrow() { { name: "invalid: borrowing an individual coin type results in a borrow that's under the minimum USD borrow limit", setup: setupArgs{ - usdxBorrowLimit: sdk.MustNewDecFromStr("20000000"), - priceKAVA: sdk.MustNewDecFromStr("2.00"), - loanToValueKAVA: sdk.MustNewDecFromStr("0.8"), - priceBTCB: sdk.MustNewDecFromStr("0.00"), - loanToValueBTCB: sdk.MustNewDecFromStr("0.01"), - priceBNB: sdk.MustNewDecFromStr("0.00"), - loanToValueBNB: sdk.MustNewDecFromStr("0.01"), + usdxBorrowLimit: sdkmath.LegacyMustNewDecFromStr("20000000"), + priceKAVA: sdkmath.LegacyMustNewDecFromStr("2.00"), + loanToValueKAVA: sdkmath.LegacyMustNewDecFromStr("0.8"), + priceBTCB: sdkmath.LegacyMustNewDecFromStr("0.00"), + loanToValueBTCB: sdkmath.LegacyMustNewDecFromStr("0.01"), + priceBNB: sdkmath.LegacyMustNewDecFromStr("0.00"), + loanToValueBNB: sdkmath.LegacyMustNewDecFromStr("0.01"), borrower: sdk.AccAddress(crypto.AddressHash([]byte("test"))), depositCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(50*KAVA_CF))), initialBorrowCoins: sdk.NewCoins(), @@ -356,13 +356,13 @@ func (suite *KeeperTestSuite) TestBorrow() { { name: "invalid: borrowing multiple coins results in a borrow that's under the minimum USD borrow limit", setup: setupArgs{ - usdxBorrowLimit: sdk.MustNewDecFromStr("20000000"), - priceKAVA: sdk.MustNewDecFromStr("2.00"), - loanToValueKAVA: sdk.MustNewDecFromStr("0.8"), - priceBTCB: sdk.MustNewDecFromStr("0.00"), - loanToValueBTCB: sdk.MustNewDecFromStr("0.01"), - priceBNB: sdk.MustNewDecFromStr("0.00"), - loanToValueBNB: sdk.MustNewDecFromStr("0.01"), + usdxBorrowLimit: sdkmath.LegacyMustNewDecFromStr("20000000"), + priceKAVA: sdkmath.LegacyMustNewDecFromStr("2.00"), + loanToValueKAVA: sdkmath.LegacyMustNewDecFromStr("0.8"), + priceBTCB: sdkmath.LegacyMustNewDecFromStr("0.00"), + loanToValueBTCB: sdkmath.LegacyMustNewDecFromStr("0.01"), + priceBNB: sdkmath.LegacyMustNewDecFromStr("0.00"), + loanToValueBNB: sdkmath.LegacyMustNewDecFromStr("0.01"), borrower: sdk.AccAddress(crypto.AddressHash([]byte("test"))), depositCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(50*KAVA_CF))), initialBorrowCoins: sdk.NewCoins(), @@ -385,13 +385,13 @@ func (suite *KeeperTestSuite) TestBorrow() { { name: "valid borrow multiple blocks", setup: setupArgs{ - usdxBorrowLimit: sdk.MustNewDecFromStr("100000000000"), - priceKAVA: sdk.MustNewDecFromStr("5.00"), - loanToValueKAVA: sdk.MustNewDecFromStr("0.6"), - priceBTCB: sdk.MustNewDecFromStr("0.00"), - loanToValueBTCB: sdk.MustNewDecFromStr("0.01"), - priceBNB: sdk.MustNewDecFromStr("0.00"), - loanToValueBNB: sdk.MustNewDecFromStr("0.01"), + usdxBorrowLimit: sdkmath.LegacyMustNewDecFromStr("100000000000"), + priceKAVA: sdkmath.LegacyMustNewDecFromStr("5.00"), + loanToValueKAVA: sdkmath.LegacyMustNewDecFromStr("0.6"), + priceBTCB: sdkmath.LegacyMustNewDecFromStr("0.00"), + loanToValueBTCB: sdkmath.LegacyMustNewDecFromStr("0.01"), + priceBNB: sdkmath.LegacyMustNewDecFromStr("0.00"), + loanToValueBNB: sdkmath.LegacyMustNewDecFromStr("0.01"), borrower: sdk.AccAddress(crypto.AddressHash([]byte("test"))), depositCoins: []sdk.Coin{sdk.NewCoin("ukava", sdkmath.NewInt(100*KAVA_CF))}, initialBorrowCoins: sdk.NewCoins(), @@ -423,13 +423,13 @@ func (suite *KeeperTestSuite) TestBorrow() { { name: "valid borrow followed by protocol reserves exceed available cash for busd when borrowing from ukava", setup: setupArgs{ - usdxBorrowLimit: sdk.MustNewDecFromStr("100000000000"), - priceKAVA: sdk.MustNewDecFromStr("5.00"), - loanToValueKAVA: sdk.MustNewDecFromStr("0.8"), - priceBTCB: sdk.MustNewDecFromStr("0.00"), - loanToValueBTCB: sdk.MustNewDecFromStr("0.01"), - priceBNB: sdk.MustNewDecFromStr("5.00"), - loanToValueBNB: sdk.MustNewDecFromStr("0.8"), + usdxBorrowLimit: sdkmath.LegacyMustNewDecFromStr("100000000000"), + priceKAVA: sdkmath.LegacyMustNewDecFromStr("5.00"), + loanToValueKAVA: sdkmath.LegacyMustNewDecFromStr("0.8"), + priceBTCB: sdkmath.LegacyMustNewDecFromStr("0.00"), + loanToValueBTCB: sdkmath.LegacyMustNewDecFromStr("0.01"), + priceBNB: sdkmath.LegacyMustNewDecFromStr("5.00"), + loanToValueBNB: sdkmath.LegacyMustNewDecFromStr("0.8"), borrower: sdk.AccAddress(crypto.AddressHash([]byte("test"))), depositCoins: sdk.NewCoins(sdk.NewCoin("bnb", sdkmath.NewInt(30*BNB_CF)), sdk.NewCoin("ukava", sdkmath.NewInt(50*KAVA_CF))), initialBorrowCoins: sdk.NewCoins(sdk.NewCoin("usdx", sdkmath.NewInt(99*USDX_CF)), sdk.NewCoin("busd", sdkmath.NewInt(100*BUSD_CF))), @@ -472,13 +472,13 @@ func (suite *KeeperTestSuite) TestBorrow() { { name: "valid borrow followed by protocol reserves exceed available cash for busd when borrowing from busd", setup: setupArgs{ - usdxBorrowLimit: sdk.MustNewDecFromStr("100000000000"), - priceKAVA: sdk.MustNewDecFromStr("2.00"), - loanToValueKAVA: sdk.MustNewDecFromStr("0.8"), - priceBTCB: sdk.MustNewDecFromStr("0.00"), - loanToValueBTCB: sdk.MustNewDecFromStr("0.01"), - priceBNB: sdk.MustNewDecFromStr("5.00"), - loanToValueBNB: sdk.MustNewDecFromStr("0.8"), + usdxBorrowLimit: sdkmath.LegacyMustNewDecFromStr("100000000000"), + priceKAVA: sdkmath.LegacyMustNewDecFromStr("2.00"), + loanToValueKAVA: sdkmath.LegacyMustNewDecFromStr("0.8"), + priceBTCB: sdkmath.LegacyMustNewDecFromStr("0.00"), + loanToValueBTCB: sdkmath.LegacyMustNewDecFromStr("0.01"), + priceBNB: sdkmath.LegacyMustNewDecFromStr("5.00"), + loanToValueBNB: sdkmath.LegacyMustNewDecFromStr("0.8"), borrower: sdk.AccAddress(crypto.AddressHash([]byte("test"))), depositCoins: sdk.NewCoins(sdk.NewCoin("bnb", sdkmath.NewInt(30*BNB_CF)), sdk.NewCoin("ukava", sdkmath.NewInt(50*KAVA_CF))), initialBorrowCoins: sdk.NewCoins(sdk.NewCoin("usdx", sdkmath.NewInt(99*USDX_CF)), sdk.NewCoin("busd", sdkmath.NewInt(100*BUSD_CF))), @@ -513,7 +513,7 @@ func (suite *KeeperTestSuite) TestBorrow() { suite.Run(tc.name, func() { // Initialize test app and set context tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) // Auth module genesis state authGS := app.NewFundedGenStateWithCoins( @@ -532,14 +532,14 @@ func (suite *KeeperTestSuite) TestBorrow() { // hard module genesis state hardGS := types.NewGenesisState(types.NewParams( types.MoneyMarkets{ - types.NewMoneyMarket("usdx", types.NewBorrowLimit(true, tc.setup.usdxBorrowLimit, sdk.MustNewDecFromStr("1")), "usdx:usd", sdkmath.NewInt(USDX_CF), types.NewInterestRateModel(sdk.MustNewDecFromStr("0.05"), sdk.MustNewDecFromStr("2"), sdk.MustNewDecFromStr("0.8"), sdk.MustNewDecFromStr("10")), sdk.MustNewDecFromStr("0.05"), sdk.ZeroDec()), - types.NewMoneyMarket("busd", types.NewBorrowLimit(false, sdk.NewDec(100000000*BUSD_CF), sdk.MustNewDecFromStr("1")), "busd:usd", sdkmath.NewInt(BUSD_CF), types.NewInterestRateModel(sdk.MustNewDecFromStr("0.05"), sdk.MustNewDecFromStr("2"), sdk.MustNewDecFromStr("0.8"), sdk.MustNewDecFromStr("10")), sdk.MustNewDecFromStr("0.05"), sdk.ZeroDec()), - types.NewMoneyMarket("ukava", types.NewBorrowLimit(false, sdk.NewDec(100000000*KAVA_CF), tc.setup.loanToValueKAVA), "kava:usd", sdkmath.NewInt(KAVA_CF), types.NewInterestRateModel(sdk.MustNewDecFromStr("0.05"), sdk.MustNewDecFromStr("2"), sdk.MustNewDecFromStr("0.8"), sdk.MustNewDecFromStr("10")), sdk.MustNewDecFromStr("0.99"), sdk.ZeroDec()), - types.NewMoneyMarket("btcb", types.NewBorrowLimit(false, sdk.NewDec(100000000*BTCB_CF), tc.setup.loanToValueBTCB), "btcb:usd", sdkmath.NewInt(BTCB_CF), types.NewInterestRateModel(sdk.MustNewDecFromStr("0.05"), sdk.MustNewDecFromStr("2"), sdk.MustNewDecFromStr("0.8"), sdk.MustNewDecFromStr("10")), sdk.MustNewDecFromStr("0.05"), sdk.ZeroDec()), - types.NewMoneyMarket("bnb", types.NewBorrowLimit(false, sdk.NewDec(100000000*BNB_CF), tc.setup.loanToValueBNB), "bnb:usd", sdkmath.NewInt(BNB_CF), types.NewInterestRateModel(sdk.MustNewDecFromStr("0.05"), sdk.MustNewDecFromStr("2"), sdk.MustNewDecFromStr("0.8"), sdk.MustNewDecFromStr("10")), sdk.MustNewDecFromStr("0.05"), sdk.ZeroDec()), - types.NewMoneyMarket("xyz", types.NewBorrowLimit(false, sdk.NewDec(1), tc.setup.loanToValueBNB), "xyz:usd", sdkmath.NewInt(1), types.NewInterestRateModel(sdk.MustNewDecFromStr("0.05"), sdk.MustNewDecFromStr("2"), sdk.MustNewDecFromStr("0.8"), sdk.MustNewDecFromStr("10")), sdk.MustNewDecFromStr("0.05"), sdk.ZeroDec()), - }, - sdk.NewDec(10), + types.NewMoneyMarket("usdx", types.NewBorrowLimit(true, tc.setup.usdxBorrowLimit, sdkmath.LegacyMustNewDecFromStr("1")), "usdx:usd", sdkmath.NewInt(USDX_CF), types.NewInterestRateModel(sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyMustNewDecFromStr("2"), sdkmath.LegacyMustNewDecFromStr("0.8"), sdkmath.LegacyMustNewDecFromStr("10")), sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyZeroDec()), + types.NewMoneyMarket("busd", types.NewBorrowLimit(false, sdkmath.LegacyNewDec(100000000*BUSD_CF), sdkmath.LegacyMustNewDecFromStr("1")), "busd:usd", sdkmath.NewInt(BUSD_CF), types.NewInterestRateModel(sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyMustNewDecFromStr("2"), sdkmath.LegacyMustNewDecFromStr("0.8"), sdkmath.LegacyMustNewDecFromStr("10")), sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyZeroDec()), + types.NewMoneyMarket("ukava", types.NewBorrowLimit(false, sdkmath.LegacyNewDec(100000000*KAVA_CF), tc.setup.loanToValueKAVA), "kava:usd", sdkmath.NewInt(KAVA_CF), types.NewInterestRateModel(sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyMustNewDecFromStr("2"), sdkmath.LegacyMustNewDecFromStr("0.8"), sdkmath.LegacyMustNewDecFromStr("10")), sdkmath.LegacyMustNewDecFromStr("0.99"), sdkmath.LegacyZeroDec()), + types.NewMoneyMarket("btcb", types.NewBorrowLimit(false, sdkmath.LegacyNewDec(100000000*BTCB_CF), tc.setup.loanToValueBTCB), "btcb:usd", sdkmath.NewInt(BTCB_CF), types.NewInterestRateModel(sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyMustNewDecFromStr("2"), sdkmath.LegacyMustNewDecFromStr("0.8"), sdkmath.LegacyMustNewDecFromStr("10")), sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyZeroDec()), + types.NewMoneyMarket("bnb", types.NewBorrowLimit(false, sdkmath.LegacyNewDec(100000000*BNB_CF), tc.setup.loanToValueBNB), "bnb:usd", sdkmath.NewInt(BNB_CF), types.NewInterestRateModel(sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyMustNewDecFromStr("2"), sdkmath.LegacyMustNewDecFromStr("0.8"), sdkmath.LegacyMustNewDecFromStr("10")), sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyZeroDec()), + types.NewMoneyMarket("xyz", types.NewBorrowLimit(false, sdkmath.LegacyNewDec(1), tc.setup.loanToValueBNB), "xyz:usd", sdkmath.NewInt(1), types.NewInterestRateModel(sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyMustNewDecFromStr("2"), sdkmath.LegacyMustNewDecFromStr("0.8"), sdkmath.LegacyMustNewDecFromStr("10")), sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyZeroDec()), + }, + sdkmath.LegacyNewDec(10), ), types.DefaultAccumulationTimes, types.DefaultDeposits, types.DefaultBorrows, types.DefaultTotalSupplied, types.DefaultTotalBorrowed, types.DefaultTotalReserves, ) @@ -560,13 +560,13 @@ func (suite *KeeperTestSuite) TestBorrow() { { MarketID: "usdx:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("1.00"), + Price: sdkmath.LegacyMustNewDecFromStr("1.00"), Expiry: time.Now().Add(1 * time.Hour), }, { MarketID: "busd:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("1.00"), + Price: sdkmath.LegacyMustNewDecFromStr("1.00"), Expiry: time.Now().Add(1 * time.Hour), }, { @@ -660,11 +660,11 @@ func (suite *KeeperTestSuite) TestValidateBorrow() { sdk.NewCoin("usdx", sdkmath.NewInt(1000*KAVA_CF)), ) - model := types.NewInterestRateModel(sdk.MustNewDecFromStr("1.0"), sdk.MustNewDecFromStr("2"), sdk.MustNewDecFromStr("0.8"), sdk.MustNewDecFromStr("10")) + model := types.NewInterestRateModel(sdkmath.LegacyMustNewDecFromStr("1.0"), sdkmath.LegacyMustNewDecFromStr("2"), sdkmath.LegacyMustNewDecFromStr("0.8"), sdkmath.LegacyMustNewDecFromStr("10")) // Initialize test app and set context tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) // Auth module genesis state authGS := app.NewFundedGenStateWithSameCoins( @@ -678,21 +678,21 @@ func (suite *KeeperTestSuite) TestValidateBorrow() { types.NewParams( types.MoneyMarkets{ types.NewMoneyMarket("usdx", - types.NewBorrowLimit(false, sdk.NewDec(100000000*USDX_CF), sdk.MustNewDecFromStr("1")), // Borrow Limit - "usdx:usd", // Market ID - sdkmath.NewInt(USDX_CF), // Conversion Factor - model, // Interest Rate Model - sdk.MustNewDecFromStr("1.0"), // Reserve Factor (high) - sdk.MustNewDecFromStr("0.05")), // Keeper Reward Percent + types.NewBorrowLimit(false, sdkmath.LegacyNewDec(100000000*USDX_CF), sdkmath.LegacyMustNewDecFromStr("1")), // Borrow Limit + "usdx:usd", // Market ID + sdkmath.NewInt(USDX_CF), // Conversion Factor + model, // Interest Rate Model + sdkmath.LegacyMustNewDecFromStr("1.0"), // Reserve Factor (high) + sdkmath.LegacyMustNewDecFromStr("0.05")), // Keeper Reward Percent types.NewMoneyMarket("ukava", - types.NewBorrowLimit(false, sdk.NewDec(100000000*KAVA_CF), sdk.MustNewDecFromStr("0.8")), // Borrow Limit - "kava:usd", // Market ID - sdkmath.NewInt(KAVA_CF), // Conversion Factor - model, // Interest Rate Model - sdk.MustNewDecFromStr("1.0"), // Reserve Factor (high) - sdk.MustNewDecFromStr("0.05")), // Keeper Reward Percent - }, - sdk.NewDec(10), + types.NewBorrowLimit(false, sdkmath.LegacyNewDec(100000000*KAVA_CF), sdkmath.LegacyMustNewDecFromStr("0.8")), // Borrow Limit + "kava:usd", // Market ID + sdkmath.NewInt(KAVA_CF), // Conversion Factor + model, // Interest Rate Model + sdkmath.LegacyMustNewDecFromStr("1.0"), // Reserve Factor (high) + sdkmath.LegacyMustNewDecFromStr("0.05")), // Keeper Reward Percent + }, + sdkmath.LegacyNewDec(10), ), types.DefaultAccumulationTimes, types.DefaultDeposits, @@ -714,13 +714,13 @@ func (suite *KeeperTestSuite) TestValidateBorrow() { { MarketID: "usdx:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("1.00"), + Price: sdkmath.LegacyMustNewDecFromStr("1.00"), Expiry: time.Now().Add(1 * time.Hour), }, { MarketID: "kava:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("2.00"), + Price: sdkmath.LegacyMustNewDecFromStr("2.00"), Expiry: time.Now().Add(1 * time.Hour), }, }, @@ -773,7 +773,7 @@ func (suite *KeeperTestSuite) TestValidateBorrow() { err = suite.keeper.Borrow( suite.ctx, borrower, - sdk.NewCoins(sdk.NewCoin("ukava", availableToBorrow.AmountOf("ukava").Add(sdk.OneInt()))), + sdk.NewCoins(sdk.NewCoin("ukava", availableToBorrow.AmountOf("ukava").Add(sdkmath.OneInt()))), ) suite.Require().Error(err) diff --git a/x/hard/keeper/deposit.go b/x/hard/keeper/deposit.go index e4cd5315f9..63efdd1721 100644 --- a/x/hard/keeper/deposit.go +++ b/x/hard/keeper/deposit.go @@ -19,7 +19,7 @@ func (k Keeper) Deposit(ctx sdk.Context, depositor sdk.AccAddress, coins sdk.Coi if !foundInterestFactor { _, foundMm := k.GetMoneyMarket(ctx, coin.Denom) if foundMm { - k.SetSupplyInterestFactor(ctx, coin.Denom, sdk.OneDec()) + k.SetSupplyInterestFactor(ctx, coin.Denom, sdkmath.LegacyOneDec()) } } } @@ -146,7 +146,7 @@ func (k Keeper) DecrementSuppliedCoins(ctx sdk.Context, coins sdk.Coins) error { coinsToSubtract := sdk.NewCoins() for _, coin := range coins { if suppliedCoins.AmountOf(coin.Denom).LT(coin.Amount) { - if suppliedCoins.AmountOf(coin.Denom).GT(sdk.ZeroInt()) { + if suppliedCoins.AmountOf(coin.Denom).GT(sdkmath.ZeroInt()) { coinsToSubtract = coinsToSubtract.Add(sdk.NewCoin(coin.Denom, suppliedCoins.AmountOf(coin.Denom))) } } else { @@ -188,7 +188,7 @@ func (k Keeper) loadSyncedDeposit(ctx sdk.Context, deposit types.Deposit) types. // Calculate interest that will be paid to user for this asset if foundAtIndex != -1 { - storedAmount := sdk.NewDecFromInt(deposit.Amount.AmountOf(coin.Denom)) + storedAmount := sdkmath.LegacyNewDecFromInt(deposit.Amount.AmountOf(coin.Denom)) userLastInterestFactor := deposit.Index[foundAtIndex].Value coinInterest := (storedAmount.Quo(userLastInterestFactor).Mul(interestFactorValue)).Sub(storedAmount) totalNewInterest = totalNewInterest.Add(sdk.NewCoin(coin.Denom, coinInterest.TruncateInt())) diff --git a/x/hard/keeper/deposit_test.go b/x/hard/keeper/deposit_test.go index 8eb7cdf1e7..f6f5f98713 100644 --- a/x/hard/keeper/deposit_test.go +++ b/x/hard/keeper/deposit_test.go @@ -102,7 +102,7 @@ func (suite *KeeperTestSuite) TestDeposit() { // Initialize test app and set context tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) authGS := app.NewFundedGenStateWithCoins( tApp.AppCodec(), []sdk.Coins{ @@ -113,15 +113,15 @@ func (suite *KeeperTestSuite) TestDeposit() { }, []sdk.AccAddress{tc.args.depositor}, ) - loanToValue, _ := sdk.NewDecFromStr("0.6") + loanToValue, _ := sdkmath.LegacyNewDecFromStr("0.6") hardGS := types.NewGenesisState(types.NewParams( types.MoneyMarkets{ - types.NewMoneyMarket("usdx", types.NewBorrowLimit(false, sdk.NewDec(1000000000000000), loanToValue), "usdx:usd", sdkmath.NewInt(1000000), types.NewInterestRateModel(sdk.MustNewDecFromStr("0.05"), sdk.MustNewDecFromStr("2"), sdk.MustNewDecFromStr("0.8"), sdk.MustNewDecFromStr("10")), sdk.MustNewDecFromStr("0.05"), sdk.ZeroDec()), - types.NewMoneyMarket("ukava", types.NewBorrowLimit(false, sdk.NewDec(1000000000000000), loanToValue), "kava:usd", sdkmath.NewInt(1000000), types.NewInterestRateModel(sdk.MustNewDecFromStr("0.05"), sdk.MustNewDecFromStr("2"), sdk.MustNewDecFromStr("0.8"), sdk.MustNewDecFromStr("10")), sdk.MustNewDecFromStr("0.05"), sdk.ZeroDec()), - types.NewMoneyMarket("bnb", types.NewBorrowLimit(false, sdk.NewDec(1000000000000000), loanToValue), "bnb:usd", sdkmath.NewInt(1000000), types.NewInterestRateModel(sdk.MustNewDecFromStr("0.05"), sdk.MustNewDecFromStr("2"), sdk.MustNewDecFromStr("0.8"), sdk.MustNewDecFromStr("10")), sdk.MustNewDecFromStr("0.05"), sdk.ZeroDec()), - types.NewMoneyMarket("btcb", types.NewBorrowLimit(false, sdk.NewDec(1000000000000000), loanToValue), "btcb:usd", sdkmath.NewInt(1000000), types.NewInterestRateModel(sdk.MustNewDecFromStr("0.05"), sdk.MustNewDecFromStr("2"), sdk.MustNewDecFromStr("0.8"), sdk.MustNewDecFromStr("10")), sdk.MustNewDecFromStr("0.05"), sdk.ZeroDec()), + types.NewMoneyMarket("usdx", types.NewBorrowLimit(false, sdkmath.LegacyNewDec(1000000000000000), loanToValue), "usdx:usd", sdkmath.NewInt(1000000), types.NewInterestRateModel(sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyMustNewDecFromStr("2"), sdkmath.LegacyMustNewDecFromStr("0.8"), sdkmath.LegacyMustNewDecFromStr("10")), sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyZeroDec()), + types.NewMoneyMarket("ukava", types.NewBorrowLimit(false, sdkmath.LegacyNewDec(1000000000000000), loanToValue), "kava:usd", sdkmath.NewInt(1000000), types.NewInterestRateModel(sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyMustNewDecFromStr("2"), sdkmath.LegacyMustNewDecFromStr("0.8"), sdkmath.LegacyMustNewDecFromStr("10")), sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyZeroDec()), + types.NewMoneyMarket("bnb", types.NewBorrowLimit(false, sdkmath.LegacyNewDec(1000000000000000), loanToValue), "bnb:usd", sdkmath.NewInt(1000000), types.NewInterestRateModel(sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyMustNewDecFromStr("2"), sdkmath.LegacyMustNewDecFromStr("0.8"), sdkmath.LegacyMustNewDecFromStr("10")), sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyZeroDec()), + types.NewMoneyMarket("btcb", types.NewBorrowLimit(false, sdkmath.LegacyNewDec(1000000000000000), loanToValue), "btcb:usd", sdkmath.NewInt(1000000), types.NewInterestRateModel(sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyMustNewDecFromStr("2"), sdkmath.LegacyMustNewDecFromStr("0.8"), sdkmath.LegacyMustNewDecFromStr("10")), sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyZeroDec()), }, - sdk.NewDec(10), + sdkmath.LegacyNewDec(10), ), types.DefaultAccumulationTimes, types.DefaultDeposits, types.DefaultBorrows, types.DefaultTotalSupplied, types.DefaultTotalBorrowed, types.DefaultTotalReserves, ) @@ -140,25 +140,25 @@ func (suite *KeeperTestSuite) TestDeposit() { { MarketID: "usdx:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("1.00"), + Price: sdkmath.LegacyMustNewDecFromStr("1.00"), Expiry: time.Now().Add(1 * time.Hour), }, { MarketID: "kava:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("2.00"), + Price: sdkmath.LegacyMustNewDecFromStr("2.00"), Expiry: time.Now().Add(1 * time.Hour), }, { MarketID: "btcb:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("100.00"), + Price: sdkmath.LegacyMustNewDecFromStr("100.00"), Expiry: time.Now().Add(1 * time.Hour), }, { MarketID: "bnb:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("10.00"), + Price: sdkmath.LegacyMustNewDecFromStr("10.00"), Expiry: time.Now().Add(1 * time.Hour), }, }, @@ -269,8 +269,8 @@ func (suite *KeeperTestSuite) TestDecrementSuppliedCoins() { suite.Run(tc.name, func() { // Initialize test app and set context tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) - loanToValue, _ := sdk.NewDecFromStr("0.6") + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + loanToValue, _ := sdkmath.LegacyNewDecFromStr("0.6") depositor := sdk.AccAddress(crypto.AddressHash([]byte("test"))) authGS := app.NewFundedGenStateWithCoins( tApp.AppCodec(), @@ -279,11 +279,11 @@ func (suite *KeeperTestSuite) TestDecrementSuppliedCoins() { ) hardGS := types.NewGenesisState(types.NewParams( types.MoneyMarkets{ - types.NewMoneyMarket("bnb", types.NewBorrowLimit(false, sdk.NewDec(1000000000000000), loanToValue), "bnb:usd", sdkmath.NewInt(100000000), types.NewInterestRateModel(sdk.MustNewDecFromStr("0.05"), sdk.MustNewDecFromStr("2"), sdk.MustNewDecFromStr("0.8"), sdk.MustNewDecFromStr("10")), sdk.MustNewDecFromStr("0.05"), sdk.ZeroDec()), - types.NewMoneyMarket("busd", types.NewBorrowLimit(false, sdk.NewDec(1000000000000000), loanToValue), "busd:usd", sdkmath.NewInt(100000000), types.NewInterestRateModel(sdk.MustNewDecFromStr("0.05"), sdk.MustNewDecFromStr("2"), sdk.MustNewDecFromStr("0.8"), sdk.MustNewDecFromStr("10")), sdk.MustNewDecFromStr("0.05"), sdk.ZeroDec()), - types.NewMoneyMarket("xrpb", types.NewBorrowLimit(false, sdk.NewDec(1000000000000000), loanToValue), "xrpb:usd", sdkmath.NewInt(100000000), types.NewInterestRateModel(sdk.MustNewDecFromStr("0.05"), sdk.MustNewDecFromStr("2"), sdk.MustNewDecFromStr("0.8"), sdk.MustNewDecFromStr("10")), sdk.MustNewDecFromStr("0.05"), sdk.ZeroDec()), + types.NewMoneyMarket("bnb", types.NewBorrowLimit(false, sdkmath.LegacyNewDec(1000000000000000), loanToValue), "bnb:usd", sdkmath.NewInt(100000000), types.NewInterestRateModel(sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyMustNewDecFromStr("2"), sdkmath.LegacyMustNewDecFromStr("0.8"), sdkmath.LegacyMustNewDecFromStr("10")), sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyZeroDec()), + types.NewMoneyMarket("busd", types.NewBorrowLimit(false, sdkmath.LegacyNewDec(1000000000000000), loanToValue), "busd:usd", sdkmath.NewInt(100000000), types.NewInterestRateModel(sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyMustNewDecFromStr("2"), sdkmath.LegacyMustNewDecFromStr("0.8"), sdkmath.LegacyMustNewDecFromStr("10")), sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyZeroDec()), + types.NewMoneyMarket("xrpb", types.NewBorrowLimit(false, sdkmath.LegacyNewDec(1000000000000000), loanToValue), "xrpb:usd", sdkmath.NewInt(100000000), types.NewInterestRateModel(sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyMustNewDecFromStr("2"), sdkmath.LegacyMustNewDecFromStr("0.8"), sdkmath.LegacyMustNewDecFromStr("10")), sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyZeroDec()), }, - sdk.MustNewDecFromStr("10"), + sdkmath.LegacyMustNewDecFromStr("10"), ), types.DefaultAccumulationTimes, types.DefaultDeposits, types.DefaultBorrows, types.DefaultTotalSupplied, types.DefaultTotalBorrowed, types.DefaultTotalReserves, ) @@ -300,19 +300,19 @@ func (suite *KeeperTestSuite) TestDecrementSuppliedCoins() { { MarketID: "busd:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("1.00"), + Price: sdkmath.LegacyMustNewDecFromStr("1.00"), Expiry: time.Now().Add(1 * time.Hour), }, { MarketID: "xrpb:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("2.00"), + Price: sdkmath.LegacyMustNewDecFromStr("2.00"), Expiry: time.Now().Add(1 * time.Hour), }, { MarketID: "bnb:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("200.00"), + Price: sdkmath.LegacyMustNewDecFromStr("200.00"), Expiry: time.Now().Add(1 * time.Hour), }, }, diff --git a/x/hard/keeper/grpc_query.go b/x/hard/keeper/grpc_query.go index 85b6b6d07f..33964a8398 100644 --- a/x/hard/keeper/grpc_query.go +++ b/x/hard/keeper/grpc_query.go @@ -2,6 +2,7 @@ package keeper import ( "context" + sdkmath "cosmossdk.io/math" errorsmod "cosmossdk.io/errors" "github.com/cosmos/cosmos-sdk/client" @@ -436,7 +437,7 @@ func (s queryServer) InterestRate(ctx context.Context, req *types.QueryInterestR macc := s.accountKeeper.GetModuleAccount(sdkCtx, types.ModuleName) cash := s.bankKeeper.GetBalance(sdkCtx, macc.GetAddress(), denom).Amount - borrowed := sdk.NewCoin(denom, sdk.ZeroInt()) + borrowed := sdk.NewCoin(denom, sdkmath.ZeroInt()) borrowedCoins, foundBorrowedCoins := s.keeper.GetBorrowedCoins(sdkCtx) if foundBorrowedCoins { borrowed = sdk.NewCoin(denom, borrowedCoins.AmountOf(denom)) @@ -448,14 +449,14 @@ func (s queryServer) InterestRate(ctx context.Context, req *types.QueryInterestR } // CalculateBorrowRate calculates the current interest rate based on utilization (the fraction of supply that has ien borrowed) - borrowAPY, err := CalculateBorrowRate(moneyMarket.InterestRateModel, sdk.NewDecFromInt(cash), sdk.NewDecFromInt(borrowed.Amount), sdk.NewDecFromInt(reserves.AmountOf(denom))) + borrowAPY, err := CalculateBorrowRate(moneyMarket.InterestRateModel, sdkmath.LegacyNewDecFromInt(cash), sdkmath.LegacyNewDecFromInt(borrowed.Amount), sdkmath.LegacyNewDecFromInt(reserves.AmountOf(denom))) if err != nil { return nil, err } - utilRatio := CalculateUtilizationRatio(sdk.NewDecFromInt(cash), sdk.NewDecFromInt(borrowed.Amount), sdk.NewDecFromInt(reserves.AmountOf(denom))) + utilRatio := CalculateUtilizationRatio(sdkmath.LegacyNewDecFromInt(cash), sdkmath.LegacyNewDecFromInt(borrowed.Amount), sdkmath.LegacyNewDecFromInt(reserves.AmountOf(denom))) fullSupplyAPY := borrowAPY.Mul(utilRatio) - realSupplyAPY := fullSupplyAPY.Mul(sdk.OneDec().Sub(moneyMarket.ReserveFactor)) + realSupplyAPY := fullSupplyAPY.Mul(sdkmath.LegacyOneDec().Sub(moneyMarket.ReserveFactor)) moneyMarketInterestRate := types.MoneyMarketInterestRate{ Denom: denom, @@ -517,13 +518,13 @@ func (s queryServer) InterestFactors(ctx context.Context, req *types.QueryIntere } else { interestFactorMap := make(map[string]types.InterestFactor) // Populate mapping with supply interest factors - s.keeper.IterateSupplyInterestFactors(sdkCtx, func(denom string, factor sdk.Dec) (stop bool) { + s.keeper.IterateSupplyInterestFactors(sdkCtx, func(denom string, factor sdkmath.LegacyDec) (stop bool) { interestFactor := types.InterestFactor{Denom: denom, SupplyInterestFactor: factor.String()} interestFactorMap[denom] = interestFactor return false }) // Populate mapping with borrow interest factors - s.keeper.IterateBorrowInterestFactors(sdkCtx, func(denom string, factor sdk.Dec) (stop bool) { + s.keeper.IterateBorrowInterestFactors(sdkCtx, func(denom string, factor sdkmath.LegacyDec) (stop bool) { interestFactor, ok := interestFactorMap[denom] if !ok { newInterestFactor := types.InterestFactor{Denom: denom, BorrowInterestFactor: factor.String()} diff --git a/x/hard/keeper/grpc_query_test.go b/x/hard/keeper/grpc_query_test.go index 0f3e48ba23..32f26227ea 100644 --- a/x/hard/keeper/grpc_query_test.go +++ b/x/hard/keeper/grpc_query_test.go @@ -1,10 +1,10 @@ package keeper_test import ( + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" "testing" "time" - tmprototypes "github.com/cometbft/cometbft/proto/tendermint/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/kava-labs/kava/app" "github.com/kava-labs/kava/x/hard/keeper" @@ -28,8 +28,7 @@ func (suite *grpcQueryTestSuite) SetupTest() { suite.addrs = addrs - suite.ctx = suite.tApp.NewContext(true, tmprototypes.Header{}). - WithBlockTime(time.Now().UTC()) + suite.ctx = suite.tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: time.Now().UTC()}) suite.keeper = suite.tApp.GetHardKeeper() suite.queryServer = keeper.NewQueryServerImpl(suite.keeper, suite.tApp.GetAccountKeeper(), suite.tApp.GetBankKeeper()) diff --git a/x/hard/keeper/integration_test.go b/x/hard/keeper/integration_test.go index b4fcaef8f5..f4dfc8af1c 100644 --- a/x/hard/keeper/integration_test.go +++ b/x/hard/keeper/integration_test.go @@ -20,65 +20,65 @@ func NewHARDGenState(cdc codec.JSONCodec) app.GenesisState { Denom: "usdx", BorrowLimit: types.BorrowLimit{ HasMaxLimit: true, - MaximumLimit: sdk.MustNewDecFromStr("100000000000"), - LoanToValue: sdk.MustNewDecFromStr("1"), + MaximumLimit: sdkmath.LegacyMustNewDecFromStr("100000000000"), + LoanToValue: sdkmath.LegacyMustNewDecFromStr("1"), }, SpotMarketID: "usdx:usd", ConversionFactor: sdkmath.NewInt(USDX_CF), InterestRateModel: types.InterestRateModel{ - BaseRateAPY: sdk.MustNewDecFromStr("0.05"), - BaseMultiplier: sdk.MustNewDecFromStr("2"), - Kink: sdk.MustNewDecFromStr("0.8"), - JumpMultiplier: sdk.MustNewDecFromStr("10"), + BaseRateAPY: sdkmath.LegacyMustNewDecFromStr("0.05"), + BaseMultiplier: sdkmath.LegacyMustNewDecFromStr("2"), + Kink: sdkmath.LegacyMustNewDecFromStr("0.8"), + JumpMultiplier: sdkmath.LegacyMustNewDecFromStr("10"), }, - ReserveFactor: sdk.MustNewDecFromStr("0.05"), - KeeperRewardPercentage: sdk.ZeroDec(), + ReserveFactor: sdkmath.LegacyMustNewDecFromStr("0.05"), + KeeperRewardPercentage: sdkmath.LegacyZeroDec(), }, types.MoneyMarket{ Denom: "bnb", BorrowLimit: types.BorrowLimit{ HasMaxLimit: true, - MaximumLimit: sdk.MustNewDecFromStr("3000000000000"), - LoanToValue: sdk.MustNewDecFromStr("0.5"), + MaximumLimit: sdkmath.LegacyMustNewDecFromStr("3000000000000"), + LoanToValue: sdkmath.LegacyMustNewDecFromStr("0.5"), }, SpotMarketID: "bnb:usd", ConversionFactor: sdkmath.NewInt(USDX_CF), InterestRateModel: types.InterestRateModel{ - BaseRateAPY: sdk.MustNewDecFromStr("0"), - BaseMultiplier: sdk.MustNewDecFromStr("0.05"), - Kink: sdk.MustNewDecFromStr("0.8"), - JumpMultiplier: sdk.MustNewDecFromStr("5.0"), + BaseRateAPY: sdkmath.LegacyMustNewDecFromStr("0"), + BaseMultiplier: sdkmath.LegacyMustNewDecFromStr("0.05"), + Kink: sdkmath.LegacyMustNewDecFromStr("0.8"), + JumpMultiplier: sdkmath.LegacyMustNewDecFromStr("5.0"), }, - ReserveFactor: sdk.MustNewDecFromStr("0.025"), - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.02"), + ReserveFactor: sdkmath.LegacyMustNewDecFromStr("0.025"), + KeeperRewardPercentage: sdkmath.LegacyMustNewDecFromStr("0.02"), }, types.MoneyMarket{ Denom: "busd", BorrowLimit: types.BorrowLimit{ HasMaxLimit: true, - MaximumLimit: sdk.MustNewDecFromStr("1000000000000000"), - LoanToValue: sdk.MustNewDecFromStr("0.5"), + MaximumLimit: sdkmath.LegacyMustNewDecFromStr("1000000000000000"), + LoanToValue: sdkmath.LegacyMustNewDecFromStr("0.5"), }, SpotMarketID: "busd:usd", ConversionFactor: sdkmath.NewInt(100000000), InterestRateModel: types.InterestRateModel{ - BaseRateAPY: sdk.MustNewDecFromStr("0"), - BaseMultiplier: sdk.MustNewDecFromStr("0.5"), - Kink: sdk.MustNewDecFromStr("0.8"), - JumpMultiplier: sdk.MustNewDecFromStr("5"), + BaseRateAPY: sdkmath.LegacyMustNewDecFromStr("0"), + BaseMultiplier: sdkmath.LegacyMustNewDecFromStr("0.5"), + Kink: sdkmath.LegacyMustNewDecFromStr("0.8"), + JumpMultiplier: sdkmath.LegacyMustNewDecFromStr("5"), }, - ReserveFactor: sdk.MustNewDecFromStr("0.025"), - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.02"), + ReserveFactor: sdkmath.LegacyMustNewDecFromStr("0.025"), + KeeperRewardPercentage: sdkmath.LegacyMustNewDecFromStr("0.02"), }, }, - sdk.MustNewDecFromStr("10"), + sdkmath.LegacyMustNewDecFromStr("10"), ), PreviousAccumulationTimes: types.GenesisAccumulationTimes{ types.NewGenesisAccumulationTime( "usdx", time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), - sdk.OneDec(), - sdk.OneDec(), + sdkmath.LegacyOneDec(), + sdkmath.LegacyOneDec(), ), }, Deposits: types.DefaultDeposits, @@ -104,19 +104,19 @@ func NewPricefeedGenStateMulti(cdc codec.JSONCodec) app.GenesisState { { MarketID: "usdx:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.OneDec(), + Price: sdkmath.LegacyOneDec(), Expiry: time.Now().Add(1 * time.Hour), }, { MarketID: "bnb:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("618.13"), + Price: sdkmath.LegacyMustNewDecFromStr("618.13"), Expiry: time.Now().Add(1 * time.Hour), }, { MarketID: "busd:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.OneDec(), + Price: sdkmath.LegacyOneDec(), Expiry: time.Now().Add(1 * time.Hour), }, }, diff --git a/x/hard/keeper/interest.go b/x/hard/keeper/interest.go index e07d2862c9..df4c809b5e 100644 --- a/x/hard/keeper/interest.go +++ b/x/hard/keeper/interest.go @@ -78,7 +78,7 @@ func (k Keeper) AccrueInterest(ctx sdk.Context, denom string) error { macc := k.accountKeeper.GetModuleAccount(ctx, types.ModuleName) cashPrior := k.bankKeeper.GetBalance(ctx, macc.GetAddress(), denom).Amount - borrowedPrior := sdk.NewCoin(denom, sdk.ZeroInt()) + borrowedPrior := sdk.NewCoin(denom, sdkmath.ZeroInt()) borrowedCoinsPrior, foundBorrowedCoinsPrior := k.GetBorrowedCoins(ctx) if foundBorrowedCoinsPrior { borrowedPrior = sdk.NewCoin(denom, borrowedCoinsPrior.AmountOf(denom)) @@ -97,14 +97,14 @@ func (k Keeper) AccrueInterest(ctx sdk.Context, denom string) error { borrowInterestFactorPrior, foundBorrowInterestFactorPrior := k.GetBorrowInterestFactor(ctx, denom) if !foundBorrowInterestFactorPrior { - newBorrowInterestFactorPrior := sdk.MustNewDecFromStr("1.0") + newBorrowInterestFactorPrior := sdkmath.LegacyMustNewDecFromStr("1.0") k.SetBorrowInterestFactor(ctx, denom, newBorrowInterestFactorPrior) borrowInterestFactorPrior = newBorrowInterestFactorPrior } supplyInterestFactorPrior, foundSupplyInterestFactorPrior := k.GetSupplyInterestFactor(ctx, denom) if !foundSupplyInterestFactorPrior { - newSupplyInterestFactorPrior := sdk.MustNewDecFromStr("1.0") + newSupplyInterestFactorPrior := sdkmath.LegacyMustNewDecFromStr("1.0") k.SetSupplyInterestFactor(ctx, denom, newSupplyInterestFactorPrior) supplyInterestFactorPrior = newSupplyInterestFactorPrior } @@ -116,20 +116,20 @@ func (k Keeper) AccrueInterest(ctx sdk.Context, denom string) error { } // GetBorrowRate calculates the current interest rate based on utilization (the fraction of supply that has been borrowed) - borrowRateApy, err := CalculateBorrowRate(mm.InterestRateModel, sdk.NewDecFromInt(cashPrior), sdk.NewDecFromInt(borrowedPrior.Amount), sdk.NewDecFromInt(reservesPrior.AmountOf(denom))) + borrowRateApy, err := CalculateBorrowRate(mm.InterestRateModel, sdkmath.LegacyNewDecFromInt(cashPrior), sdkmath.LegacyNewDecFromInt(borrowedPrior.Amount), sdkmath.LegacyNewDecFromInt(reservesPrior.AmountOf(denom))) if err != nil { return err } // Convert from APY to SPY, expressed as (1 + borrow rate) - borrowRateSpy, err := APYToSPY(sdk.OneDec().Add(borrowRateApy)) + borrowRateSpy, err := APYToSPY(sdkmath.LegacyOneDec().Add(borrowRateApy)) if err != nil { return err } // Calculate borrow interest factor and update borrowInterestFactor := CalculateBorrowInterestFactor(borrowRateSpy, sdkmath.NewInt(timeElapsed)) - interestBorrowAccumulated := (borrowInterestFactor.Mul(sdk.NewDecFromInt(borrowedPrior.Amount)).TruncateInt()).Sub(borrowedPrior.Amount) + interestBorrowAccumulated := (borrowInterestFactor.Mul(sdkmath.LegacyNewDecFromInt(borrowedPrior.Amount)).TruncateInt()).Sub(borrowedPrior.Amount) if interestBorrowAccumulated.IsZero() && borrowRateApy.IsPositive() { // don't accumulate if borrow interest is rounding to zero @@ -137,13 +137,13 @@ func (k Keeper) AccrueInterest(ctx sdk.Context, denom string) error { } totalBorrowInterestAccumulated := sdk.NewCoins(sdk.NewCoin(denom, interestBorrowAccumulated)) - reservesNew := sdk.NewDecFromInt(interestBorrowAccumulated).Mul(mm.ReserveFactor).TruncateInt() + reservesNew := sdkmath.LegacyNewDecFromInt(interestBorrowAccumulated).Mul(mm.ReserveFactor).TruncateInt() borrowInterestFactorNew := borrowInterestFactorPrior.Mul(borrowInterestFactor) k.SetBorrowInterestFactor(ctx, denom, borrowInterestFactorNew) // Calculate supply interest factor and update supplyInterestNew := interestBorrowAccumulated.Sub(reservesNew) - supplyInterestFactor := CalculateSupplyInterestFactor(sdk.NewDecFromInt(supplyInterestNew), sdk.NewDecFromInt(cashPrior), sdk.NewDecFromInt(borrowedPrior.Amount), sdk.NewDecFromInt(reservesPrior.AmountOf(denom))) + supplyInterestFactor := CalculateSupplyInterestFactor(sdkmath.LegacyNewDecFromInt(supplyInterestNew), sdkmath.LegacyNewDecFromInt(cashPrior), sdkmath.LegacyNewDecFromInt(borrowedPrior.Amount), sdkmath.LegacyNewDecFromInt(reservesPrior.AmountOf(denom))) supplyInterestFactorNew := supplyInterestFactorPrior.Mul(supplyInterestFactor) k.SetSupplyInterestFactor(ctx, denom, supplyInterestFactorNew) @@ -158,7 +158,7 @@ func (k Keeper) AccrueInterest(ctx sdk.Context, denom string) error { // CalculateBorrowRate calculates the borrow rate, which is the current APY expressed as a decimal // based on the current utilization. -func CalculateBorrowRate(model types.InterestRateModel, cash, borrows, reserves sdk.Dec) (sdk.Dec, error) { +func CalculateBorrowRate(model types.InterestRateModel, cash, borrows, reserves sdkmath.LegacyDec) (sdkmath.LegacyDec, error) { utilRatio := CalculateUtilizationRatio(cash, borrows, reserves) // Calculate normal borrow rate (under kink) @@ -173,25 +173,25 @@ func CalculateBorrowRate(model types.InterestRateModel, cash, borrows, reserves } // CalculateUtilizationRatio calculates an asset's current utilization rate -func CalculateUtilizationRatio(cash, borrows, reserves sdk.Dec) sdk.Dec { +func CalculateUtilizationRatio(cash, borrows, reserves sdkmath.LegacyDec) sdkmath.LegacyDec { // Utilization rate is 0 when there are no borrows - if borrows.Equal(sdk.ZeroDec()) { - return sdk.ZeroDec() + if borrows.Equal(sdkmath.LegacyZeroDec()) { + return sdkmath.LegacyZeroDec() } totalSupply := cash.Add(borrows).Sub(reserves) if totalSupply.IsNegative() { - return sdk.OneDec() + return sdkmath.LegacyOneDec() } - return sdk.MinDec(sdk.OneDec(), borrows.Quo(totalSupply)) + return sdkmath.LegacyMinDec(sdkmath.LegacyOneDec(), borrows.Quo(totalSupply)) } // CalculateBorrowInterestFactor calculates the simple interest scaling factor, // which is equal to: (per-second interest rate * number of seconds elapsed) // Will return 1.000x, multiply by principal to get new principal with added interest -func CalculateBorrowInterestFactor(perSecondInterestRate sdk.Dec, secondsElapsed sdkmath.Int) sdk.Dec { - scalingFactorUint := sdk.NewUint(uint64(scalingFactor)) +func CalculateBorrowInterestFactor(perSecondInterestRate sdkmath.LegacyDec, secondsElapsed sdkmath.Int) sdkmath.LegacyDec { + scalingFactorUint := sdkmath.NewUint(uint64(scalingFactor)) scalingFactorInt := sdkmath.NewInt(int64(scalingFactor)) // Convert per-second interest rate to a uint scaled by 1e18 @@ -201,19 +201,19 @@ func CalculateBorrowInterestFactor(perSecondInterestRate sdk.Dec, secondsElapsed // Calculate the interest factor as a uint scaled by 1e18 interestFactorMantissa := sdkmath.RelativePow(interestMantissa, secondsElapsedUint, scalingFactorUint) - // Convert interest factor to an unscaled sdk.Dec - return sdk.NewDecFromBigInt(interestFactorMantissa.BigInt()).QuoInt(scalingFactorInt) + // Convert interest factor to an unscaled sdkmath.LegacyDec + return sdkmath.LegacyNewDecFromBigInt(interestFactorMantissa.BigInt()).QuoInt(scalingFactorInt) } // CalculateSupplyInterestFactor calculates the supply interest factor, which is the percentage of borrow interest // that flows to each unit of supply, i.e. at 50% utilization and 0% reserve factor, a 5% borrow interest will // correspond to a 2.5% supply interest. -func CalculateSupplyInterestFactor(newInterest, cash, borrows, reserves sdk.Dec) sdk.Dec { +func CalculateSupplyInterestFactor(newInterest, cash, borrows, reserves sdkmath.LegacyDec) sdkmath.LegacyDec { totalSupply := cash.Add(borrows).Sub(reserves) if totalSupply.IsZero() { - return sdk.OneDec() + return sdkmath.LegacyOneDec() } - return (newInterest.Quo(totalSupply)).Add(sdk.OneDec()) + return (newInterest.Quo(totalSupply)).Add(sdkmath.LegacyOneDec()) } // SyncBorrowInterest updates the user's owed interest on newly borrowed coins to the latest global state @@ -241,7 +241,7 @@ func (k Keeper) SyncBorrowInterest(ctx sdk.Context, addr sdk.AccAddress) { borrow.Index = append(borrow.Index, types.NewBorrowInterestFactor(coin.Denom, interestFactorValue)) } else { // User has an existing borrow index for this denom // Calculate interest owed by user since asset's last borrow index update - storedAmount := sdk.NewDecFromInt(borrow.Amount.AmountOf(coin.Denom)) + storedAmount := sdkmath.LegacyNewDecFromInt(borrow.Amount.AmountOf(coin.Denom)) userLastInterestFactor := borrow.Index[foundAtIndex].Value interest := (storedAmount.Quo(userLastInterestFactor).Mul(interestFactorValue)).Sub(storedAmount) totalNewInterest = totalNewInterest.Add(sdk.NewCoin(coin.Denom, interest.TruncateInt())) @@ -282,10 +282,10 @@ func (k Keeper) SyncSupplyInterest(ctx sdk.Context, addr sdk.AccAddress) { deposit.Index = append(deposit.Index, types.NewSupplyInterestFactor(coin.Denom, interestFactorValue)) } else { // User has an existing supply index for this denom // Calculate interest earned by user since asset's last deposit index update - storedAmount := sdk.NewDecFromInt(deposit.Amount.AmountOf(coin.Denom)) + storedAmount := sdkmath.LegacyNewDecFromInt(deposit.Amount.AmountOf(coin.Denom)) userLastInterestFactor := deposit.Index[foundAtIndex].Value interest := (storedAmount.Mul(interestFactorValue).Quo(userLastInterestFactor)).Sub(storedAmount) - if interest.TruncateInt().GT(sdk.ZeroInt()) { + if interest.TruncateInt().GT(sdkmath.ZeroInt()) { totalNewInterest = totalNewInterest.Add(sdk.NewCoin(coin.Denom, interest.TruncateInt())) } // We're synced up, so update user's deposit index value to match the current global deposit index value @@ -301,17 +301,17 @@ func (k Keeper) SyncSupplyInterest(ctx sdk.Context, addr sdk.AccAddress) { // APYToSPY converts the input annual interest rate. For example, 10% apy would be passed as 1.10. // SPY = Per second compounded interest rate is how cosmos mathematically represents APY. -func APYToSPY(apy sdk.Dec) (sdk.Dec, error) { +func APYToSPY(apy sdkmath.LegacyDec) (sdkmath.LegacyDec, error) { // Note: any APY 179 or greater will cause an out-of-bounds error root, err := apy.ApproxRoot(uint64(secondsPerYear)) if err != nil { - return sdk.ZeroDec(), err + return sdkmath.LegacyZeroDec(), err } return root, nil } // SPYToEstimatedAPY converts the internal per second compounded interest rate into an estimated annual // interest rate. The returned value is an estimate and should not be used for financial calculations. -func SPYToEstimatedAPY(apy sdk.Dec) sdk.Dec { +func SPYToEstimatedAPY(apy sdkmath.LegacyDec) sdkmath.LegacyDec { return apy.Power(uint64(secondsPerYear)) } diff --git a/x/hard/keeper/interest_test.go b/x/hard/keeper/interest_test.go index 753e75dbb1..6a46ab20aa 100644 --- a/x/hard/keeper/interest_test.go +++ b/x/hard/keeper/interest_test.go @@ -25,10 +25,10 @@ type InterestTestSuite struct { func (suite *InterestTestSuite) TestCalculateUtilizationRatio() { type args struct { - cash sdk.Dec - borrows sdk.Dec - reserves sdk.Dec - expectedValue sdk.Dec + cash sdkmath.LegacyDec + borrows sdkmath.LegacyDec + reserves sdkmath.LegacyDec + expectedValue sdkmath.LegacyDec } type test struct { @@ -40,46 +40,46 @@ func (suite *InterestTestSuite) TestCalculateUtilizationRatio() { { "normal", args{ - cash: sdk.MustNewDecFromStr("1000"), - borrows: sdk.MustNewDecFromStr("5000"), - reserves: sdk.MustNewDecFromStr("100"), - expectedValue: sdk.MustNewDecFromStr("0.847457627118644068"), + cash: sdkmath.LegacyMustNewDecFromStr("1000"), + borrows: sdkmath.LegacyMustNewDecFromStr("5000"), + reserves: sdkmath.LegacyMustNewDecFromStr("100"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("0.847457627118644068"), }, }, { "high util ratio", args{ - cash: sdk.MustNewDecFromStr("1000"), - borrows: sdk.MustNewDecFromStr("250000"), - reserves: sdk.MustNewDecFromStr("100"), - expectedValue: sdk.MustNewDecFromStr("0.996412913511359107"), + cash: sdkmath.LegacyMustNewDecFromStr("1000"), + borrows: sdkmath.LegacyMustNewDecFromStr("250000"), + reserves: sdkmath.LegacyMustNewDecFromStr("100"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("0.996412913511359107"), }, }, { "very high util ratio", args{ - cash: sdk.MustNewDecFromStr("1000"), - borrows: sdk.MustNewDecFromStr("250000000000"), - reserves: sdk.MustNewDecFromStr("100"), - expectedValue: sdk.MustNewDecFromStr("0.999999996400000013"), + cash: sdkmath.LegacyMustNewDecFromStr("1000"), + borrows: sdkmath.LegacyMustNewDecFromStr("250000000000"), + reserves: sdkmath.LegacyMustNewDecFromStr("100"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("0.999999996400000013"), }, }, { "low util ratio", args{ - cash: sdk.MustNewDecFromStr("1000"), - borrows: sdk.MustNewDecFromStr("50"), - reserves: sdk.MustNewDecFromStr("100"), - expectedValue: sdk.MustNewDecFromStr("0.052631578947368421"), + cash: sdkmath.LegacyMustNewDecFromStr("1000"), + borrows: sdkmath.LegacyMustNewDecFromStr("50"), + reserves: sdkmath.LegacyMustNewDecFromStr("100"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("0.052631578947368421"), }, }, { "very low util ratio", args{ - cash: sdk.MustNewDecFromStr("10000000"), - borrows: sdk.MustNewDecFromStr("50"), - reserves: sdk.MustNewDecFromStr("100"), - expectedValue: sdk.MustNewDecFromStr("0.000005000025000125"), + cash: sdkmath.LegacyMustNewDecFromStr("10000000"), + borrows: sdkmath.LegacyMustNewDecFromStr("50"), + reserves: sdkmath.LegacyMustNewDecFromStr("100"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("0.000005000025000125"), }, }, } @@ -94,11 +94,11 @@ func (suite *InterestTestSuite) TestCalculateUtilizationRatio() { func (suite *InterestTestSuite) TestCalculateBorrowRate() { type args struct { - cash sdk.Dec - borrows sdk.Dec - reserves sdk.Dec + cash sdkmath.LegacyDec + borrows sdkmath.LegacyDec + reserves sdkmath.LegacyDec model types.InterestRateModel - expectedValue sdk.Dec + expectedValue sdkmath.LegacyDec } type test struct { @@ -111,102 +111,102 @@ func (suite *InterestTestSuite) TestCalculateBorrowRate() { // - BaseMultiplier: 0.1 // - Kink: 0.8 // - JumpMultiplier: 0.5 - normalModel := types.NewInterestRateModel(sdk.MustNewDecFromStr("0"), sdk.MustNewDecFromStr("0.1"), sdk.MustNewDecFromStr("0.8"), sdk.MustNewDecFromStr("0.5")) + normalModel := types.NewInterestRateModel(sdkmath.LegacyMustNewDecFromStr("0"), sdkmath.LegacyMustNewDecFromStr("0.1"), sdkmath.LegacyMustNewDecFromStr("0.8"), sdkmath.LegacyMustNewDecFromStr("0.5")) testCases := []test{ { "normal no jump", args{ - cash: sdk.MustNewDecFromStr("5000"), - borrows: sdk.MustNewDecFromStr("1000"), - reserves: sdk.MustNewDecFromStr("1000"), + cash: sdkmath.LegacyMustNewDecFromStr("5000"), + borrows: sdkmath.LegacyMustNewDecFromStr("1000"), + reserves: sdkmath.LegacyMustNewDecFromStr("1000"), model: normalModel, - expectedValue: sdk.MustNewDecFromStr("0.020000000000000000"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("0.020000000000000000"), }, }, { "normal with jump", args{ - cash: sdk.MustNewDecFromStr("1000"), - borrows: sdk.MustNewDecFromStr("5000"), - reserves: sdk.MustNewDecFromStr("100"), + cash: sdkmath.LegacyMustNewDecFromStr("1000"), + borrows: sdkmath.LegacyMustNewDecFromStr("5000"), + reserves: sdkmath.LegacyMustNewDecFromStr("100"), model: normalModel, - expectedValue: sdk.MustNewDecFromStr("0.103728813559322034"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("0.103728813559322034"), }, }, { "high cash", args{ - cash: sdk.MustNewDecFromStr("10000000"), - borrows: sdk.MustNewDecFromStr("5000"), - reserves: sdk.MustNewDecFromStr("100"), + cash: sdkmath.LegacyMustNewDecFromStr("10000000"), + borrows: sdkmath.LegacyMustNewDecFromStr("5000"), + reserves: sdkmath.LegacyMustNewDecFromStr("100"), model: normalModel, - expectedValue: sdk.MustNewDecFromStr("0.000049975511999120"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("0.000049975511999120"), }, }, { "high borrows", args{ - cash: sdk.MustNewDecFromStr("1000"), - borrows: sdk.MustNewDecFromStr("5000000000000"), - reserves: sdk.MustNewDecFromStr("100"), + cash: sdkmath.LegacyMustNewDecFromStr("1000"), + borrows: sdkmath.LegacyMustNewDecFromStr("5000000000000"), + reserves: sdkmath.LegacyMustNewDecFromStr("100"), model: normalModel, - expectedValue: sdk.MustNewDecFromStr("0.179999999910000000"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("0.179999999910000000"), }, }, { "high reserves", args{ - cash: sdk.MustNewDecFromStr("1000"), - borrows: sdk.MustNewDecFromStr("5000"), - reserves: sdk.MustNewDecFromStr("1000000000000"), + cash: sdkmath.LegacyMustNewDecFromStr("1000"), + borrows: sdkmath.LegacyMustNewDecFromStr("5000"), + reserves: sdkmath.LegacyMustNewDecFromStr("1000000000000"), model: normalModel, - expectedValue: sdk.MustNewDecFromStr("0.180000000000000000"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("0.180000000000000000"), }, }, { "random numbers", args{ - cash: sdk.MustNewDecFromStr("125"), - borrows: sdk.MustNewDecFromStr("11"), - reserves: sdk.MustNewDecFromStr("82"), + cash: sdkmath.LegacyMustNewDecFromStr("125"), + borrows: sdkmath.LegacyMustNewDecFromStr("11"), + reserves: sdkmath.LegacyMustNewDecFromStr("82"), model: normalModel, - expectedValue: sdk.MustNewDecFromStr("0.020370370370370370"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("0.020370370370370370"), }, }, { "increased base multiplier", args{ - cash: sdk.MustNewDecFromStr("1000"), - borrows: sdk.MustNewDecFromStr("5000"), - reserves: sdk.MustNewDecFromStr("100"), - model: types.NewInterestRateModel(sdk.MustNewDecFromStr("0"), sdk.MustNewDecFromStr("0.5"), sdk.MustNewDecFromStr("0.8"), sdk.MustNewDecFromStr("1.0")), - expectedValue: sdk.MustNewDecFromStr("0.447457627118644068"), + cash: sdkmath.LegacyMustNewDecFromStr("1000"), + borrows: sdkmath.LegacyMustNewDecFromStr("5000"), + reserves: sdkmath.LegacyMustNewDecFromStr("100"), + model: types.NewInterestRateModel(sdkmath.LegacyMustNewDecFromStr("0"), sdkmath.LegacyMustNewDecFromStr("0.5"), sdkmath.LegacyMustNewDecFromStr("0.8"), sdkmath.LegacyMustNewDecFromStr("1.0")), + expectedValue: sdkmath.LegacyMustNewDecFromStr("0.447457627118644068"), }, }, { "decreased kink", args{ - cash: sdk.MustNewDecFromStr("1000"), - borrows: sdk.MustNewDecFromStr("5000"), - reserves: sdk.MustNewDecFromStr("100"), - model: types.NewInterestRateModel(sdk.MustNewDecFromStr("0"), sdk.MustNewDecFromStr("0.5"), sdk.MustNewDecFromStr("0.1"), sdk.MustNewDecFromStr("1.0")), - expectedValue: sdk.MustNewDecFromStr("0.797457627118644068"), + cash: sdkmath.LegacyMustNewDecFromStr("1000"), + borrows: sdkmath.LegacyMustNewDecFromStr("5000"), + reserves: sdkmath.LegacyMustNewDecFromStr("100"), + model: types.NewInterestRateModel(sdkmath.LegacyMustNewDecFromStr("0"), sdkmath.LegacyMustNewDecFromStr("0.5"), sdkmath.LegacyMustNewDecFromStr("0.1"), sdkmath.LegacyMustNewDecFromStr("1.0")), + expectedValue: sdkmath.LegacyMustNewDecFromStr("0.797457627118644068"), }, }, { "zero model returns zero", args{ - cash: sdk.MustNewDecFromStr("1000"), - borrows: sdk.MustNewDecFromStr("5000"), - reserves: sdk.MustNewDecFromStr("100"), + cash: sdkmath.LegacyMustNewDecFromStr("1000"), + borrows: sdkmath.LegacyMustNewDecFromStr("5000"), + reserves: sdkmath.LegacyMustNewDecFromStr("100"), model: types.NewInterestRateModel( - sdk.MustNewDecFromStr("0.0"), - sdk.MustNewDecFromStr("0.0"), - sdk.MustNewDecFromStr("0.8"), - sdk.MustNewDecFromStr("0.0"), + sdkmath.LegacyMustNewDecFromStr("0.0"), + sdkmath.LegacyMustNewDecFromStr("0.0"), + sdkmath.LegacyMustNewDecFromStr("0.8"), + sdkmath.LegacyMustNewDecFromStr("0.0"), ), - expectedValue: sdk.MustNewDecFromStr("0.0"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("0.0"), }, }, } @@ -222,9 +222,9 @@ func (suite *InterestTestSuite) TestCalculateBorrowRate() { func (suite *InterestTestSuite) TestCalculateBorrowInterestFactor() { type args struct { - perSecondInterestRate sdk.Dec + perSecondInterestRate sdkmath.LegacyDec timeElapsed sdkmath.Int - expectedValue sdk.Dec + expectedValue sdkmath.LegacyDec } type test struct { @@ -238,105 +238,105 @@ func (suite *InterestTestSuite) TestCalculateBorrowInterestFactor() { { "1 year", args{ - perSecondInterestRate: sdk.MustNewDecFromStr("1.000000005555"), + perSecondInterestRate: sdkmath.LegacyMustNewDecFromStr("1.000000005555"), timeElapsed: sdkmath.NewInt(oneYearInSeconds), - expectedValue: sdk.MustNewDecFromStr("1.191463614477847370"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("1.191463614477847370"), }, }, { "10 year", args{ - perSecondInterestRate: sdk.MustNewDecFromStr("1.000000005555"), + perSecondInterestRate: sdkmath.LegacyMustNewDecFromStr("1.000000005555"), timeElapsed: sdkmath.NewInt(oneYearInSeconds * 10), - expectedValue: sdk.MustNewDecFromStr("5.765113233897391189"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("5.765113233897391189"), }, }, { "1 month", args{ - perSecondInterestRate: sdk.MustNewDecFromStr("1.000000005555"), + perSecondInterestRate: sdkmath.LegacyMustNewDecFromStr("1.000000005555"), timeElapsed: sdkmath.NewInt(oneYearInSeconds / 12), - expectedValue: sdk.MustNewDecFromStr("1.014705619075717373"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("1.014705619075717373"), }, }, { "1 day", args{ - perSecondInterestRate: sdk.MustNewDecFromStr("1.000000005555"), + perSecondInterestRate: sdkmath.LegacyMustNewDecFromStr("1.000000005555"), timeElapsed: sdkmath.NewInt(oneYearInSeconds / 365), - expectedValue: sdk.MustNewDecFromStr("1.000480067194057924"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("1.000480067194057924"), }, }, { "1 year: low interest rate", args{ - perSecondInterestRate: sdk.MustNewDecFromStr("1.000000000555"), + perSecondInterestRate: sdkmath.LegacyMustNewDecFromStr("1.000000000555"), timeElapsed: sdkmath.NewInt(oneYearInSeconds), - expectedValue: sdk.MustNewDecFromStr("1.017656545925063632"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("1.017656545925063632"), }, }, { "1 year, lower interest rate", args{ - perSecondInterestRate: sdk.MustNewDecFromStr("1.000000000055"), + perSecondInterestRate: sdkmath.LegacyMustNewDecFromStr("1.000000000055"), timeElapsed: sdkmath.NewInt(oneYearInSeconds), - expectedValue: sdk.MustNewDecFromStr("1.001735985079841390"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("1.001735985079841390"), }, }, { "1 year, lowest interest rate", args{ - perSecondInterestRate: sdk.MustNewDecFromStr("1.000000000005"), + perSecondInterestRate: sdkmath.LegacyMustNewDecFromStr("1.000000000005"), timeElapsed: sdkmath.NewInt(oneYearInSeconds), - expectedValue: sdk.MustNewDecFromStr("1.000157692432076670"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("1.000157692432076670"), }, }, { "1 year: high interest rate", args{ - perSecondInterestRate: sdk.MustNewDecFromStr("1.000000055555"), + perSecondInterestRate: sdkmath.LegacyMustNewDecFromStr("1.000000055555"), timeElapsed: sdkmath.NewInt(oneYearInSeconds), - expectedValue: sdk.MustNewDecFromStr("5.766022095987868825"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("5.766022095987868825"), }, }, { "1 year: higher interest rate", args{ - perSecondInterestRate: sdk.MustNewDecFromStr("1.000000555555"), + perSecondInterestRate: sdkmath.LegacyMustNewDecFromStr("1.000000555555"), timeElapsed: sdkmath.NewInt(oneYearInSeconds), - expectedValue: sdk.MustNewDecFromStr("40628388.864535408465693310"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("40628388.864535408465693310"), }, }, { "1 year: highest interest rate", args{ - perSecondInterestRate: sdk.MustNewDecFromStr("1.000001555555"), + perSecondInterestRate: sdkmath.LegacyMustNewDecFromStr("1.000001555555"), timeElapsed: sdkmath.NewInt(oneYearInSeconds), - expectedValue: sdk.MustNewDecFromStr("2017093013158200407564.613502861572552603"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("2017093013158200407564.613502861572552603"), }, }, { "largest per second interest rate with practical elapsed time", args{ - perSecondInterestRate: sdk.MustNewDecFromStr("18.445"), // Begins to panic at ~18.45 (1845%/second interest rate) - timeElapsed: sdkmath.NewInt(30), // Assume a 30 second period, longer than any expected individual block - expectedValue: sdk.MustNewDecFromStr("94702138679846565921082258202543002089.215969366091911769"), + perSecondInterestRate: sdkmath.LegacyMustNewDecFromStr("18.445"), // Begins to panic at ~18.45 (1845%/second interest rate) + timeElapsed: sdkmath.NewInt(30), // Assume a 30 second period, longer than any expected individual block + expectedValue: sdkmath.LegacyMustNewDecFromStr("94702138679846565921082258202543002089.215969366091911769"), }, }, { "supports calculated values greater than 1.84x10^19", args{ - perSecondInterestRate: sdk.MustNewDecFromStr("18.5"), // Old uint64 conversion would panic at ~18.45 (1845%/second interest rate) - timeElapsed: sdkmath.NewInt(30), // Assume a 30 second period, longer than any expected individual block - expectedValue: sdk.MustNewDecFromStr("103550416986452240450480615551792302106.072205164469778538"), + perSecondInterestRate: sdkmath.LegacyMustNewDecFromStr("18.5"), // Old uint64 conversion would panic at ~18.45 (1845%/second interest rate) + timeElapsed: sdkmath.NewInt(30), // Assume a 30 second period, longer than any expected individual block + expectedValue: sdkmath.LegacyMustNewDecFromStr("103550416986452240450480615551792302106.072205164469778538"), }, }, { "largest per second interest rate before sdk.Uint overflows 256 bytes", args{ - perSecondInterestRate: sdk.MustNewDecFromStr("23.3"), // 23.4 overflows bit length 256 by 1 byte - timeElapsed: sdkmath.NewInt(30), // Assume a 30 second period, longer than any expected individual block - expectedValue: sdk.MustNewDecFromStr("104876366068119517411103023062013348034546.437155815200037999"), + perSecondInterestRate: sdkmath.LegacyMustNewDecFromStr("23.3"), // 23.4 overflows bit length 256 by 1 byte + timeElapsed: sdkmath.NewInt(30), // Assume a 30 second period, longer than any expected individual block + expectedValue: sdkmath.LegacyMustNewDecFromStr("104876366068119517411103023062013348034546.437155815200037999"), }, }, } @@ -351,12 +351,12 @@ func (suite *InterestTestSuite) TestCalculateBorrowInterestFactor() { func (suite *InterestTestSuite) TestCalculateSupplyInterestFactor() { type args struct { - newInterest sdk.Dec - cash sdk.Dec - borrows sdk.Dec - reserves sdk.Dec - reserveFactor sdk.Dec - expectedValue sdk.Dec + newInterest sdkmath.LegacyDec + cash sdkmath.LegacyDec + borrows sdkmath.LegacyDec + reserves sdkmath.LegacyDec + reserveFactor sdkmath.LegacyDec + expectedValue sdkmath.LegacyDec } type test struct { @@ -368,34 +368,34 @@ func (suite *InterestTestSuite) TestCalculateSupplyInterestFactor() { { "low new interest", args{ - newInterest: sdk.MustNewDecFromStr("1"), - cash: sdk.MustNewDecFromStr("100.0"), - borrows: sdk.MustNewDecFromStr("1000.0"), - reserves: sdk.MustNewDecFromStr("10.0"), - reserveFactor: sdk.MustNewDecFromStr("0.05"), - expectedValue: sdk.MustNewDecFromStr("1.000917431192660550"), + newInterest: sdkmath.LegacyMustNewDecFromStr("1"), + cash: sdkmath.LegacyMustNewDecFromStr("100.0"), + borrows: sdkmath.LegacyMustNewDecFromStr("1000.0"), + reserves: sdkmath.LegacyMustNewDecFromStr("10.0"), + reserveFactor: sdkmath.LegacyMustNewDecFromStr("0.05"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("1.000917431192660550"), }, }, { "medium new interest", args{ - newInterest: sdk.MustNewDecFromStr("5"), - cash: sdk.MustNewDecFromStr("100.0"), - borrows: sdk.MustNewDecFromStr("1000.0"), - reserves: sdk.MustNewDecFromStr("10.0"), - reserveFactor: sdk.MustNewDecFromStr("0.05"), - expectedValue: sdk.MustNewDecFromStr("1.004587155963302752"), + newInterest: sdkmath.LegacyMustNewDecFromStr("5"), + cash: sdkmath.LegacyMustNewDecFromStr("100.0"), + borrows: sdkmath.LegacyMustNewDecFromStr("1000.0"), + reserves: sdkmath.LegacyMustNewDecFromStr("10.0"), + reserveFactor: sdkmath.LegacyMustNewDecFromStr("0.05"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("1.004587155963302752"), }, }, { "high new interest", args{ - newInterest: sdk.MustNewDecFromStr("10"), - cash: sdk.MustNewDecFromStr("100.0"), - borrows: sdk.MustNewDecFromStr("1000.0"), - reserves: sdk.MustNewDecFromStr("10.0"), - reserveFactor: sdk.MustNewDecFromStr("0.05"), - expectedValue: sdk.MustNewDecFromStr("1.009174311926605505"), + newInterest: sdkmath.LegacyMustNewDecFromStr("10"), + cash: sdkmath.LegacyMustNewDecFromStr("100.0"), + borrows: sdkmath.LegacyMustNewDecFromStr("1000.0"), + reserves: sdkmath.LegacyMustNewDecFromStr("10.0"), + reserveFactor: sdkmath.LegacyMustNewDecFromStr("0.05"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("1.009174311926605505"), }, }, } @@ -411,8 +411,8 @@ func (suite *InterestTestSuite) TestCalculateSupplyInterestFactor() { func (suite *InterestTestSuite) TestAPYToSPY() { type args struct { - apy sdk.Dec - expectedValue sdk.Dec + apy sdkmath.LegacyDec + expectedValue sdkmath.LegacyDec } type test struct { @@ -425,72 +425,72 @@ func (suite *InterestTestSuite) TestAPYToSPY() { { "lowest apy", args{ - apy: sdk.MustNewDecFromStr("0.005"), - expectedValue: sdk.MustNewDecFromStr("0.999999831991472557"), + apy: sdkmath.LegacyMustNewDecFromStr("0.005"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("0.999999831991472557"), }, false, }, { "lower apy", args{ - apy: sdk.MustNewDecFromStr("0.05"), - expectedValue: sdk.MustNewDecFromStr("0.999999905005957279"), + apy: sdkmath.LegacyMustNewDecFromStr("0.05"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("0.999999905005957279"), }, false, }, { "medium-low apy", args{ - apy: sdk.MustNewDecFromStr("0.5"), - expectedValue: sdk.MustNewDecFromStr("0.999999978020447332"), + apy: sdkmath.LegacyMustNewDecFromStr("0.5"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("0.999999978020447332"), }, false, }, { "5% apy", args{ - apy: sdk.MustNewDecFromStr("1.05"), - expectedValue: sdk.MustNewDecFromStr("1.000000001547125958"), + apy: sdkmath.LegacyMustNewDecFromStr("1.05"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"), }, false, }, { "25% apy", args{ - apy: sdk.MustNewDecFromStr("1.25"), - expectedValue: sdk.MustNewDecFromStr("1.000000007075835620"), + apy: sdkmath.LegacyMustNewDecFromStr("1.25"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("1.000000007075835620"), }, false, }, { "medium-high apy", args{ - apy: sdk.MustNewDecFromStr("5"), - expectedValue: sdk.MustNewDecFromStr("1.000000051034942717"), + apy: sdkmath.LegacyMustNewDecFromStr("5"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("1.000000051034942717"), }, false, }, { "high apy", args{ - apy: sdk.MustNewDecFromStr("50"), - expectedValue: sdk.MustNewDecFromStr("1.000000124049443433"), + apy: sdkmath.LegacyMustNewDecFromStr("50"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("1.000000124049443433"), }, false, }, { "highest apy", args{ - apy: sdk.MustNewDecFromStr("177"), - expectedValue: sdk.MustNewDecFromStr("1.000000164134644767"), + apy: sdkmath.LegacyMustNewDecFromStr("177"), + expectedValue: sdkmath.LegacyMustNewDecFromStr("1.000000164134644767"), }, false, }, { "out of bounds error after 178", args{ - apy: sdk.MustNewDecFromStr("179"), - expectedValue: sdk.ZeroDec(), + apy: sdkmath.LegacyMustNewDecFromStr("179"), + expectedValue: sdkmath.LegacyZeroDec(), }, true, }, @@ -510,7 +510,7 @@ func (suite *InterestTestSuite) TestAPYToSPY() { func (suite *InterestTestSuite) TestSPYToEstimatedAPY() { type args struct { - spy sdk.Dec + spy sdkmath.LegacyDec expectedAPY float64 acceptableRange float64 } @@ -524,7 +524,7 @@ func (suite *InterestTestSuite) TestSPYToEstimatedAPY() { { "lowest apy", args{ - spy: sdk.MustNewDecFromStr("0.999999831991472557"), + spy: sdkmath.LegacyMustNewDecFromStr("0.999999831991472557"), expectedAPY: 0.005, // Returned value: 0.004999999888241291 acceptableRange: 0.00001, // +/- 1/10000th of a precent }, @@ -532,7 +532,7 @@ func (suite *InterestTestSuite) TestSPYToEstimatedAPY() { { "lower apy", args{ - spy: sdk.MustNewDecFromStr("0.999999905005957279"), + spy: sdkmath.LegacyMustNewDecFromStr("0.999999905005957279"), expectedAPY: 0.05, // Returned value: 0.05000000074505806 acceptableRange: 0.00001, // +/- 1/10000th of a precent }, @@ -540,7 +540,7 @@ func (suite *InterestTestSuite) TestSPYToEstimatedAPY() { { "medium-low apy", args{ - spy: sdk.MustNewDecFromStr("0.999999978020447332"), + spy: sdkmath.LegacyMustNewDecFromStr("0.999999978020447332"), expectedAPY: 0.5, // Returned value: 0.5 acceptableRange: 0.00001, // +/- 1/10000th of a precent }, @@ -548,7 +548,7 @@ func (suite *InterestTestSuite) TestSPYToEstimatedAPY() { { "medium-high apy", args{ - spy: sdk.MustNewDecFromStr("1.000000051034942717"), + spy: sdkmath.LegacyMustNewDecFromStr("1.000000051034942717"), expectedAPY: 5, // Returned value: 5 acceptableRange: 0.00001, // +/- 1/10000th of a precent }, @@ -556,7 +556,7 @@ func (suite *InterestTestSuite) TestSPYToEstimatedAPY() { { "high apy", args{ - spy: sdk.MustNewDecFromStr("1.000000124049443433"), + spy: sdkmath.LegacyMustNewDecFromStr("1.000000124049443433"), expectedAPY: 50, // Returned value: 50 acceptableRange: 0.00001, // +/- 1/10000th of a precent }, @@ -564,7 +564,7 @@ func (suite *InterestTestSuite) TestSPYToEstimatedAPY() { { "highest apy", args{ - spy: sdk.MustNewDecFromStr("1.000000146028999310"), + spy: sdkmath.LegacyMustNewDecFromStr("1.000000146028999310"), expectedAPY: 100, // 100 acceptableRange: 0.00001, // +/- 1/10000th of a precent }, @@ -572,7 +572,7 @@ func (suite *InterestTestSuite) TestSPYToEstimatedAPY() { } for _, tc := range testCases { suite.Run(tc.name, func() { - // From SPY calculate APY and parse result from sdk.Dec to float64 + // From SPY calculate APY and parse result from sdkmath.LegacyDec to float64 calculatedAPY := keeper.SPYToEstimatedAPY(tc.args.spy) calculatedAPYFloat, err := strconv.ParseFloat(calculatedAPY.String(), 32) suite.Require().NoError(err) @@ -597,7 +597,7 @@ func (suite *KeeperTestSuite) TestBorrowInterest() { borrowCoinDenom string borrowCoins sdk.Coins interestRateModel types.InterestRateModel - reserveFactor sdk.Dec + reserveFactor sdkmath.LegacyDec expectedInterestSnaphots []ExpectedBorrowInterest } @@ -612,7 +612,7 @@ func (suite *KeeperTestSuite) TestBorrowInterest() { errArgs errArgs } - normalModel := types.NewInterestRateModel(sdk.MustNewDecFromStr("0"), sdk.MustNewDecFromStr("0.1"), sdk.MustNewDecFromStr("0.8"), sdk.MustNewDecFromStr("0.5")) + normalModel := types.NewInterestRateModel(sdkmath.LegacyMustNewDecFromStr("0"), sdkmath.LegacyMustNewDecFromStr("0.1"), sdkmath.LegacyMustNewDecFromStr("0.8"), sdkmath.LegacyMustNewDecFromStr("0.5")) oneDayInSeconds := int64(86400) oneWeekInSeconds := int64(604800) @@ -629,7 +629,7 @@ func (suite *KeeperTestSuite) TestBorrowInterest() { borrowCoinDenom: "ukava", borrowCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(20*KAVA_CF))), interestRateModel: normalModel, - reserveFactor: sdk.MustNewDecFromStr("0.05"), + reserveFactor: sdkmath.LegacyMustNewDecFromStr("0.05"), expectedInterestSnaphots: []ExpectedBorrowInterest{ { elapsedTime: oneDayInSeconds, @@ -652,7 +652,7 @@ func (suite *KeeperTestSuite) TestBorrowInterest() { borrowCoinDenom: "ukava", borrowCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(20*KAVA_CF))), interestRateModel: normalModel, - reserveFactor: sdk.MustNewDecFromStr("0.05"), + reserveFactor: sdkmath.LegacyMustNewDecFromStr("0.05"), expectedInterestSnaphots: []ExpectedBorrowInterest{ { elapsedTime: oneWeekInSeconds, @@ -675,7 +675,7 @@ func (suite *KeeperTestSuite) TestBorrowInterest() { borrowCoinDenom: "ukava", borrowCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(20*KAVA_CF))), interestRateModel: normalModel, - reserveFactor: sdk.MustNewDecFromStr("0.05"), + reserveFactor: sdkmath.LegacyMustNewDecFromStr("0.05"), expectedInterestSnaphots: []ExpectedBorrowInterest{ { elapsedTime: oneMonthInSeconds, @@ -698,7 +698,7 @@ func (suite *KeeperTestSuite) TestBorrowInterest() { borrowCoinDenom: "ukava", borrowCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(20*KAVA_CF))), interestRateModel: normalModel, - reserveFactor: sdk.MustNewDecFromStr("0.05"), + reserveFactor: sdkmath.LegacyMustNewDecFromStr("0.05"), expectedInterestSnaphots: []ExpectedBorrowInterest{ { elapsedTime: oneYearInSeconds, @@ -721,7 +721,7 @@ func (suite *KeeperTestSuite) TestBorrowInterest() { borrowCoinDenom: "ukava", borrowCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(20*KAVA_CF))), interestRateModel: normalModel, - reserveFactor: sdk.MustNewDecFromStr("0"), + reserveFactor: sdkmath.LegacyMustNewDecFromStr("0"), expectedInterestSnaphots: []ExpectedBorrowInterest{ { elapsedTime: oneYearInSeconds, @@ -744,7 +744,7 @@ func (suite *KeeperTestSuite) TestBorrowInterest() { borrowCoinDenom: "ukava", borrowCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(20*KAVA_CF))), interestRateModel: normalModel, - reserveFactor: sdk.MustNewDecFromStr("0.05"), + reserveFactor: sdkmath.LegacyMustNewDecFromStr("0.05"), expectedInterestSnaphots: []ExpectedBorrowInterest{ { elapsedTime: oneYearInSeconds, @@ -767,7 +767,7 @@ func (suite *KeeperTestSuite) TestBorrowInterest() { borrowCoinDenom: "ukava", borrowCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(20*KAVA_CF))), interestRateModel: normalModel, - reserveFactor: sdk.MustNewDecFromStr("0.05"), + reserveFactor: sdkmath.LegacyMustNewDecFromStr("0.05"), expectedInterestSnaphots: []ExpectedBorrowInterest{ { elapsedTime: oneMonthInSeconds, @@ -795,7 +795,7 @@ func (suite *KeeperTestSuite) TestBorrowInterest() { borrowCoinDenom: "ukava", borrowCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(20*KAVA_CF))), interestRateModel: normalModel, - reserveFactor: sdk.MustNewDecFromStr("0.05"), + reserveFactor: sdkmath.LegacyMustNewDecFromStr("0.05"), expectedInterestSnaphots: []ExpectedBorrowInterest{ { elapsedTime: oneDayInSeconds, @@ -830,7 +830,7 @@ func (suite *KeeperTestSuite) TestBorrowInterest() { suite.Run(tc.name, func() { // Initialize test app and set context tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) // Auth module genesis state authGS := app.NewFundedGenStateWithCoins( @@ -843,14 +843,14 @@ func (suite *KeeperTestSuite) TestBorrowInterest() { hardGS := types.NewGenesisState(types.NewParams( types.MoneyMarkets{ types.NewMoneyMarket("ukava", - types.NewBorrowLimit(false, sdk.NewDec(100000000*KAVA_CF), sdk.MustNewDecFromStr("0.8")), // Borrow Limit + types.NewBorrowLimit(false, sdkmath.LegacyNewDec(100000000*KAVA_CF), sdkmath.LegacyMustNewDecFromStr("0.8")), // Borrow Limit "kava:usd", // Market ID sdkmath.NewInt(KAVA_CF), // Conversion Factor tc.args.interestRateModel, // Interest Rate Model tc.args.reserveFactor, // Reserve Factor - sdk.ZeroDec()), // Keeper Reward Percentage + sdkmath.LegacyZeroDec()), // Keeper Reward Percentage }, - sdk.NewDec(10), + sdkmath.LegacyNewDec(10), ), types.DefaultAccumulationTimes, types.DefaultDeposits, types.DefaultBorrows, types.DefaultTotalSupplied, types.DefaultTotalBorrowed, types.DefaultTotalReserves, ) @@ -866,7 +866,7 @@ func (suite *KeeperTestSuite) TestBorrowInterest() { { MarketID: "kava:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("2.00"), + Price: sdkmath.LegacyMustNewDecFromStr("2.00"), Expiry: time.Now().Add(100 * time.Hour), }, }, @@ -918,23 +918,23 @@ func (suite *KeeperTestSuite) TestBorrowInterest() { reservesPrior, foundReservesPrior := suite.keeper.GetTotalReserves(prevCtx) if !foundReservesPrior { - reservesPrior = sdk.NewCoins(sdk.NewCoin(tc.args.borrowCoinDenom, sdk.ZeroInt())) + reservesPrior = sdk.NewCoins(sdk.NewCoin(tc.args.borrowCoinDenom, sdkmath.ZeroInt())) } interestFactorPrior, foundInterestFactorPrior := suite.keeper.GetBorrowInterestFactor(prevCtx, tc.args.borrowCoinDenom) suite.Require().True(foundInterestFactorPrior) // 2. Calculate expected interest owed - borrowRateApy, err := keeper.CalculateBorrowRate(tc.args.interestRateModel, sdk.NewDecFromInt(cashPrior), sdk.NewDecFromInt(borrowCoinPriorAmount), sdk.NewDecFromInt(reservesPrior.AmountOf(tc.args.borrowCoinDenom))) + borrowRateApy, err := keeper.CalculateBorrowRate(tc.args.interestRateModel, sdkmath.LegacyNewDecFromInt(cashPrior), sdkmath.LegacyNewDecFromInt(borrowCoinPriorAmount), sdkmath.LegacyNewDecFromInt(reservesPrior.AmountOf(tc.args.borrowCoinDenom))) suite.Require().NoError(err) // Convert from APY to SPY, expressed as (1 + borrow rate) - borrowRateSpy, err := keeper.APYToSPY(sdk.OneDec().Add(borrowRateApy)) + borrowRateSpy, err := keeper.APYToSPY(sdkmath.LegacyOneDec().Add(borrowRateApy)) suite.Require().NoError(err) interestFactor := keeper.CalculateBorrowInterestFactor(borrowRateSpy, sdkmath.NewInt(snapshot.elapsedTime)) - expectedInterest := (interestFactor.Mul(sdk.NewDecFromInt(borrowCoinPriorAmount)).TruncateInt()).Sub(borrowCoinPriorAmount) - expectedReserves := reservesPrior.Add(sdk.NewCoin(tc.args.borrowCoinDenom, sdk.NewDecFromInt(expectedInterest).Mul(tc.args.reserveFactor).TruncateInt())) + expectedInterest := (interestFactor.Mul(sdkmath.LegacyNewDecFromInt(borrowCoinPriorAmount)).TruncateInt()).Sub(borrowCoinPriorAmount) + expectedReserves := reservesPrior.Add(sdk.NewCoin(tc.args.borrowCoinDenom, sdkmath.LegacyNewDecFromInt(expectedInterest).Mul(tc.args.reserveFactor).TruncateInt())) expectedInterestFactor := interestFactorPrior.Mul(interestFactor) // ------------------------------------------------------------------------------------- @@ -950,7 +950,7 @@ func (suite *KeeperTestSuite) TestBorrowInterest() { // Check that the total reserves have changed as expected currTotalReserves, _ := suite.keeper.GetTotalReserves(snapshotCtx) - suite.Require().True(expectedReserves.IsEqual(currTotalReserves)) + suite.Require().True(expectedReserves.Equal(currTotalReserves)) // Check that the borrow index has increased as expected currIndexPrior, _ := suite.keeper.GetBorrowInterestFactor(snapshotCtx, tc.args.borrowCoinDenom) @@ -990,7 +990,7 @@ func (suite *KeeperTestSuite) TestSupplyInterest() { coinDenoms []string borrowCoins sdk.Coins interestRateModel types.InterestRateModel - reserveFactor sdk.Dec + reserveFactor sdkmath.LegacyDec expectedInterestSnaphots []ExpectedSupplyInterest } @@ -1005,7 +1005,7 @@ func (suite *KeeperTestSuite) TestSupplyInterest() { errArgs errArgs } - normalModel := types.NewInterestRateModel(sdk.MustNewDecFromStr("0"), sdk.MustNewDecFromStr("0.1"), sdk.MustNewDecFromStr("0.8"), sdk.MustNewDecFromStr("0.5")) + normalModel := types.NewInterestRateModel(sdkmath.LegacyMustNewDecFromStr("0"), sdkmath.LegacyMustNewDecFromStr("0.1"), sdkmath.LegacyMustNewDecFromStr("0.8"), sdkmath.LegacyMustNewDecFromStr("0.5")) oneDayInSeconds := int64(86400) oneWeekInSeconds := int64(604800) @@ -1023,7 +1023,7 @@ func (suite *KeeperTestSuite) TestSupplyInterest() { coinDenoms: []string{"ukava"}, borrowCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(20*KAVA_CF))), interestRateModel: normalModel, - reserveFactor: sdk.MustNewDecFromStr("0.05"), + reserveFactor: sdkmath.LegacyMustNewDecFromStr("0.05"), expectedInterestSnaphots: []ExpectedSupplyInterest{ { elapsedTime: oneDayInSeconds, @@ -1047,7 +1047,7 @@ func (suite *KeeperTestSuite) TestSupplyInterest() { coinDenoms: []string{"ukava"}, borrowCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(20*KAVA_CF))), interestRateModel: normalModel, - reserveFactor: sdk.MustNewDecFromStr("0.05"), + reserveFactor: sdkmath.LegacyMustNewDecFromStr("0.05"), expectedInterestSnaphots: []ExpectedSupplyInterest{ { elapsedTime: oneWeekInSeconds, @@ -1071,7 +1071,7 @@ func (suite *KeeperTestSuite) TestSupplyInterest() { coinDenoms: []string{"ukava"}, borrowCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(20*KAVA_CF))), interestRateModel: normalModel, - reserveFactor: sdk.MustNewDecFromStr("0.05"), + reserveFactor: sdkmath.LegacyMustNewDecFromStr("0.05"), expectedInterestSnaphots: []ExpectedSupplyInterest{ { elapsedTime: oneMonthInSeconds, @@ -1095,7 +1095,7 @@ func (suite *KeeperTestSuite) TestSupplyInterest() { coinDenoms: []string{"ukava"}, borrowCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(20*KAVA_CF))), interestRateModel: normalModel, - reserveFactor: sdk.MustNewDecFromStr("0.05"), + reserveFactor: sdkmath.LegacyMustNewDecFromStr("0.05"), expectedInterestSnaphots: []ExpectedSupplyInterest{ { elapsedTime: oneYearInSeconds, @@ -1119,7 +1119,7 @@ func (suite *KeeperTestSuite) TestSupplyInterest() { coinDenoms: []string{"ukava"}, borrowCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(20*KAVA_CF)), sdk.NewCoin("bnb", sdkmath.NewInt(20*BNB_CF))), interestRateModel: normalModel, - reserveFactor: sdk.MustNewDecFromStr("0.05"), + reserveFactor: sdkmath.LegacyMustNewDecFromStr("0.05"), expectedInterestSnaphots: []ExpectedSupplyInterest{ { elapsedTime: oneMonthInSeconds, @@ -1143,7 +1143,7 @@ func (suite *KeeperTestSuite) TestSupplyInterest() { coinDenoms: []string{"ukava"}, borrowCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(20*KAVA_CF))), interestRateModel: normalModel, - reserveFactor: sdk.MustNewDecFromStr("0.05"), + reserveFactor: sdkmath.LegacyMustNewDecFromStr("0.05"), expectedInterestSnaphots: []ExpectedSupplyInterest{ { elapsedTime: oneMonthInSeconds, @@ -1167,7 +1167,7 @@ func (suite *KeeperTestSuite) TestSupplyInterest() { coinDenoms: []string{"ukava"}, borrowCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(80*KAVA_CF))), interestRateModel: normalModel, - reserveFactor: sdk.MustNewDecFromStr("0.05"), + reserveFactor: sdkmath.LegacyMustNewDecFromStr("0.05"), expectedInterestSnaphots: []ExpectedSupplyInterest{ { elapsedTime: oneMonthInSeconds, @@ -1201,7 +1201,7 @@ func (suite *KeeperTestSuite) TestSupplyInterest() { coinDenoms: []string{"ukava"}, borrowCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(50*KAVA_CF))), interestRateModel: normalModel, - reserveFactor: sdk.MustNewDecFromStr("0.05"), + reserveFactor: sdkmath.LegacyMustNewDecFromStr("0.05"), expectedInterestSnaphots: []ExpectedSupplyInterest{ { elapsedTime: oneMonthInSeconds, @@ -1235,7 +1235,7 @@ func (suite *KeeperTestSuite) TestSupplyInterest() { suite.Run(tc.name, func() { // Initialize test app and set context tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) // Auth module genesis state authGS := app.NewFundedGenStateWithCoins( @@ -1248,21 +1248,21 @@ func (suite *KeeperTestSuite) TestSupplyInterest() { hardGS := types.NewGenesisState(types.NewParams( types.MoneyMarkets{ types.NewMoneyMarket("ukava", - types.NewBorrowLimit(false, sdk.NewDec(100000000*KAVA_CF), sdk.MustNewDecFromStr("0.8")), // Borrow Limit + types.NewBorrowLimit(false, sdkmath.LegacyNewDec(100000000*KAVA_CF), sdkmath.LegacyMustNewDecFromStr("0.8")), // Borrow Limit "kava:usd", // Market ID sdkmath.NewInt(KAVA_CF), // Conversion Factor tc.args.interestRateModel, // Interest Rate Model tc.args.reserveFactor, // Reserve Factor - sdk.ZeroDec()), // Keeper Reward Percentage + sdkmath.LegacyZeroDec()), // Keeper Reward Percentage types.NewMoneyMarket("bnb", - types.NewBorrowLimit(false, sdk.NewDec(100000000*BNB_CF), sdk.MustNewDecFromStr("0.8")), // Borrow Limit + types.NewBorrowLimit(false, sdkmath.LegacyNewDec(100000000*BNB_CF), sdkmath.LegacyMustNewDecFromStr("0.8")), // Borrow Limit "bnb:usd", // Market ID sdkmath.NewInt(BNB_CF), // Conversion Factor tc.args.interestRateModel, // Interest Rate Model tc.args.reserveFactor, // Reserve Factor - sdk.ZeroDec()), // Keeper Reward Percentage + sdkmath.LegacyZeroDec()), // Keeper Reward Percentage }, - sdk.NewDec(10), + sdkmath.LegacyNewDec(10), ), types.DefaultAccumulationTimes, types.DefaultDeposits, types.DefaultBorrows, types.DefaultTotalSupplied, types.DefaultTotalBorrowed, types.DefaultTotalReserves, ) @@ -1279,13 +1279,13 @@ func (suite *KeeperTestSuite) TestSupplyInterest() { { MarketID: "kava:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("2.00"), + Price: sdkmath.LegacyMustNewDecFromStr("2.00"), Expiry: time.Now().Add(100 * time.Hour), }, { MarketID: "bnb:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("20.00"), + Price: sdkmath.LegacyMustNewDecFromStr("20.00"), Expiry: time.Now().Add(100 * time.Hour), }, }, @@ -1337,7 +1337,7 @@ func (suite *KeeperTestSuite) TestSupplyInterest() { reservesPrior, foundReservesPrior := suite.keeper.GetTotalReserves(prevCtx) if !foundReservesPrior { - reservesPrior = sdk.NewCoins(sdk.NewCoin(coinDenom, sdk.ZeroInt())) + reservesPrior = sdk.NewCoins(sdk.NewCoin(coinDenom, sdkmath.ZeroInt())) } borrowInterestFactorPrior, foundBorrowInterestFactorPrior := suite.keeper.GetBorrowInterestFactor(prevCtx, coinDenom) @@ -1347,22 +1347,22 @@ func (suite *KeeperTestSuite) TestSupplyInterest() { suite.Require().True(foundSupplyInterestFactorPrior) // 2. Calculate expected borrow interest owed - borrowRateApy, err := keeper.CalculateBorrowRate(tc.args.interestRateModel, sdk.NewDecFromInt(cashPrior), sdk.NewDecFromInt(borrowCoinPriorAmount), sdk.NewDecFromInt(reservesPrior.AmountOf(coinDenom))) + borrowRateApy, err := keeper.CalculateBorrowRate(tc.args.interestRateModel, sdkmath.LegacyNewDecFromInt(cashPrior), sdkmath.LegacyNewDecFromInt(borrowCoinPriorAmount), sdkmath.LegacyNewDecFromInt(reservesPrior.AmountOf(coinDenom))) suite.Require().NoError(err) // Convert from APY to SPY, expressed as (1 + borrow rate) - borrowRateSpy, err := keeper.APYToSPY(sdk.OneDec().Add(borrowRateApy)) + borrowRateSpy, err := keeper.APYToSPY(sdkmath.LegacyOneDec().Add(borrowRateApy)) suite.Require().NoError(err) newBorrowInterestFactor := keeper.CalculateBorrowInterestFactor(borrowRateSpy, sdkmath.NewInt(snapshot.elapsedTime)) - expectedBorrowInterest := (newBorrowInterestFactor.Mul(sdk.NewDecFromInt(borrowCoinPriorAmount)).TruncateInt()).Sub(borrowCoinPriorAmount) - expectedReserves := reservesPrior.Add(sdk.NewCoin(coinDenom, sdk.NewDecFromInt(expectedBorrowInterest).Mul(tc.args.reserveFactor).TruncateInt())).Sub(reservesPrior...) + expectedBorrowInterest := (newBorrowInterestFactor.Mul(sdkmath.LegacyNewDecFromInt(borrowCoinPriorAmount)).TruncateInt()).Sub(borrowCoinPriorAmount) + expectedReserves := reservesPrior.Add(sdk.NewCoin(coinDenom, sdkmath.LegacyNewDecFromInt(expectedBorrowInterest).Mul(tc.args.reserveFactor).TruncateInt())).Sub(reservesPrior...) expectedTotalReserves := expectedReserves.Add(reservesPrior...) expectedBorrowInterestFactor := borrowInterestFactorPrior.Mul(newBorrowInterestFactor) expectedSupplyInterest := expectedBorrowInterest.Sub(expectedReserves.AmountOf(coinDenom)) - newSupplyInterestFactor := keeper.CalculateSupplyInterestFactor(sdk.NewDecFromInt(expectedSupplyInterest), sdk.NewDecFromInt(cashPrior), sdk.NewDecFromInt(borrowCoinPriorAmount), sdk.NewDecFromInt(reservesPrior.AmountOf(coinDenom))) + newSupplyInterestFactor := keeper.CalculateSupplyInterestFactor(sdkmath.LegacyNewDecFromInt(expectedSupplyInterest), sdkmath.LegacyNewDecFromInt(cashPrior), sdkmath.LegacyNewDecFromInt(borrowCoinPriorAmount), sdkmath.LegacyNewDecFromInt(reservesPrior.AmountOf(coinDenom))) expectedSupplyInterestFactor := supplyInterestFactorPrior.Mul(newSupplyInterestFactor) // ------------------------------------------------------------------------------------- @@ -1405,7 +1405,7 @@ func (suite *KeeperTestSuite) TestSupplyInterest() { // Calculate percentage of supply interest profits owed to user userSupplyBefore, _ := suite.keeper.GetDeposit(snapshotCtx, tc.args.user) userSupplyCoinAmount := userSupplyBefore.Amount.AmountOf(coinDenom) - userPercentOfTotalSupplied := sdk.NewDecFromInt(userSupplyCoinAmount).Quo(sdk.NewDecFromInt(supplyCoinPriorAmount)) + userPercentOfTotalSupplied := sdkmath.LegacyNewDecFromInt(userSupplyCoinAmount).Quo(sdkmath.LegacyNewDecFromInt(supplyCoinPriorAmount)) userExpectedSupplyInterestCoin := sdk.NewCoin(coinDenom, userPercentOfTotalSupplied.MulInt(expectedSupplyInterest).TruncateInt()) // Supplying syncs user's owed supply and borrow interest @@ -1416,7 +1416,7 @@ func (suite *KeeperTestSuite) TestSupplyInterest() { userSupplyAfter, _ := suite.keeper.GetDeposit(snapshotCtx, tc.args.user) // Confirm that user's supply index for the denom has increased as expected - var userSupplyAfterIndexFactor sdk.Dec + var userSupplyAfterIndexFactor sdkmath.LegacyDec for _, indexFactor := range userSupplyAfter.Index { if indexFactor.Denom == coinDenom { userSupplyAfterIndexFactor = indexFactor.Value diff --git a/x/hard/keeper/keeper.go b/x/hard/keeper/keeper.go index 5d4fc3e2fd..c862c77b14 100644 --- a/x/hard/keeper/keeper.go +++ b/x/hard/keeper/keeper.go @@ -1,11 +1,12 @@ package keeper import ( + sdkmath "cosmossdk.io/math" "time" + "cosmossdk.io/store/prefix" + storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/store/prefix" - storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" @@ -82,7 +83,7 @@ func (k Keeper) DeleteDeposit(ctx sdk.Context, deposit types.Deposit) { // IterateDeposits iterates over all deposit objects in the store and performs a callback function func (k Keeper) IterateDeposits(ctx sdk.Context, cb func(deposit types.Deposit) (stop bool)) { store := prefix.NewStore(ctx.KVStore(k.key), types.DepositsKeyPrefix) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) + iterator := storetypes.KVStorePrefixIterator(store, []byte{}) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { var deposit types.Deposit @@ -133,7 +134,7 @@ func (k Keeper) DeleteBorrow(ctx sdk.Context, borrow types.Borrow) { // IterateBorrows iterates over all borrow objects in the store and performs a callback function func (k Keeper) IterateBorrows(ctx sdk.Context, cb func(borrow types.Borrow) (stop bool)) { store := prefix.NewStore(ctx.KVStore(k.key), types.BorrowsKeyPrefix) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) + iterator := storetypes.KVStorePrefixIterator(store, []byte{}) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { var borrow types.Borrow @@ -224,7 +225,7 @@ func (k Keeper) DeleteMoneyMarket(ctx sdk.Context, denom string) { // that returns both the money market and the key (denom) it's stored under func (k Keeper) IterateMoneyMarkets(ctx sdk.Context, cb func(denom string, moneyMarket types.MoneyMarket) (stop bool)) { store := prefix.NewStore(ctx.KVStore(k.key), types.MoneyMarketsPrefix) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) + iterator := storetypes.KVStorePrefixIterator(store, []byte{}) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { var moneyMarket types.MoneyMarket @@ -297,11 +298,11 @@ func (k Keeper) GetTotalReserves(ctx sdk.Context) (sdk.Coins, bool) { } // GetBorrowInterestFactor returns the current borrow interest factor for an individual market -func (k Keeper) GetBorrowInterestFactor(ctx sdk.Context, denom string) (sdk.Dec, bool) { +func (k Keeper) GetBorrowInterestFactor(ctx sdk.Context, denom string) (sdkmath.LegacyDec, bool) { store := prefix.NewStore(ctx.KVStore(k.key), types.BorrowInterestFactorPrefix) bz := store.Get([]byte(denom)) if len(bz) == 0 { - return sdk.ZeroDec(), false + return sdkmath.LegacyZeroDec(), false } var borrowInterestFactor sdk.DecProto k.cdc.MustUnmarshal(bz, &borrowInterestFactor) @@ -309,7 +310,7 @@ func (k Keeper) GetBorrowInterestFactor(ctx sdk.Context, denom string) (sdk.Dec, } // SetBorrowInterestFactor sets the current borrow interest factor for an individual market -func (k Keeper) SetBorrowInterestFactor(ctx sdk.Context, denom string, borrowInterestFactor sdk.Dec) { +func (k Keeper) SetBorrowInterestFactor(ctx sdk.Context, denom string, borrowInterestFactor sdkmath.LegacyDec) { store := prefix.NewStore(ctx.KVStore(k.key), types.BorrowInterestFactorPrefix) bz := k.cdc.MustMarshal(&sdk.DecProto{Dec: borrowInterestFactor}) store.Set([]byte(denom), bz) @@ -317,9 +318,9 @@ func (k Keeper) SetBorrowInterestFactor(ctx sdk.Context, denom string, borrowInt // IterateBorrowInterestFactors iterates over all borrow interest factors in the store and returns // both the borrow interest factor and the key (denom) it's stored under -func (k Keeper) IterateBorrowInterestFactors(ctx sdk.Context, cb func(denom string, factor sdk.Dec) (stop bool)) { +func (k Keeper) IterateBorrowInterestFactors(ctx sdk.Context, cb func(denom string, factor sdkmath.LegacyDec) (stop bool)) { store := prefix.NewStore(ctx.KVStore(k.key), types.BorrowInterestFactorPrefix) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) + iterator := storetypes.KVStorePrefixIterator(store, []byte{}) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { var factor sdk.DecProto @@ -331,11 +332,11 @@ func (k Keeper) IterateBorrowInterestFactors(ctx sdk.Context, cb func(denom stri } // GetSupplyInterestFactor returns the current supply interest factor for an individual market -func (k Keeper) GetSupplyInterestFactor(ctx sdk.Context, denom string) (sdk.Dec, bool) { +func (k Keeper) GetSupplyInterestFactor(ctx sdk.Context, denom string) (sdkmath.LegacyDec, bool) { store := prefix.NewStore(ctx.KVStore(k.key), types.SupplyInterestFactorPrefix) bz := store.Get([]byte(denom)) if len(bz) == 0 { - return sdk.ZeroDec(), false + return sdkmath.LegacyZeroDec(), false } var supplyInterestFactor sdk.DecProto k.cdc.MustUnmarshal(bz, &supplyInterestFactor) @@ -343,7 +344,7 @@ func (k Keeper) GetSupplyInterestFactor(ctx sdk.Context, denom string) (sdk.Dec, } // SetSupplyInterestFactor sets the current supply interest factor for an individual market -func (k Keeper) SetSupplyInterestFactor(ctx sdk.Context, denom string, supplyInterestFactor sdk.Dec) { +func (k Keeper) SetSupplyInterestFactor(ctx sdk.Context, denom string, supplyInterestFactor sdkmath.LegacyDec) { store := prefix.NewStore(ctx.KVStore(k.key), types.SupplyInterestFactorPrefix) bz := k.cdc.MustMarshal(&sdk.DecProto{Dec: supplyInterestFactor}) store.Set([]byte(denom), bz) @@ -351,9 +352,9 @@ func (k Keeper) SetSupplyInterestFactor(ctx sdk.Context, denom string, supplyInt // IterateSupplyInterestFactors iterates over all supply interest factors in the store and returns // both the supply interest factor and the key (denom) it's stored under -func (k Keeper) IterateSupplyInterestFactors(ctx sdk.Context, cb func(denom string, factor sdk.Dec) (stop bool)) { +func (k Keeper) IterateSupplyInterestFactors(ctx sdk.Context, cb func(denom string, factor sdkmath.LegacyDec) (stop bool)) { store := prefix.NewStore(ctx.KVStore(k.key), types.SupplyInterestFactorPrefix) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) + iterator := storetypes.KVStorePrefixIterator(store, []byte{}) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { var factor sdk.DecProto diff --git a/x/hard/keeper/keeper_test.go b/x/hard/keeper/keeper_test.go index 8d2054befc..195ab0fb5d 100644 --- a/x/hard/keeper/keeper_test.go +++ b/x/hard/keeper/keeper_test.go @@ -8,11 +8,9 @@ import ( sdkmath "cosmossdk.io/math" "github.com/stretchr/testify/suite" - sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" tmtime "github.com/cometbft/cometbft/types/time" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/kava-labs/kava/app" auctionkeeper "github.com/kava-labs/kava/x/auction/keeper" @@ -36,7 +34,7 @@ func (suite *KeeperTestSuite) SetupTest() { app.SetBech32AddressPrefixes(config) tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) tApp.InitializeFromGenesisStates() _, addrs := app.GeneratePrivKeyAddressPairs(1) keeper := tApp.GetHardKeeper() @@ -51,7 +49,7 @@ func (suite *KeeperTestSuite) TestGetSetDeleteDeposit() { dep := types.NewDeposit( addr, sdk.NewCoins(sdk.NewCoin("bnb", sdkmath.NewInt(100))), - types.SupplyInterestFactors{types.NewSupplyInterestFactor("bnb", sdk.MustNewDecFromStr("1.12"))}, + types.SupplyInterestFactors{types.NewSupplyInterestFactor("bnb", sdkmath.LegacyMustNewDecFromStr("1.12"))}, ) _, f := suite.keeper.GetDeposit(suite.ctx, addr) @@ -75,7 +73,7 @@ func (suite *KeeperTestSuite) TestIterateDeposits() { dep := types.NewDeposit( sdk.AccAddress("test"+fmt.Sprint(i)), sdk.NewCoins(sdk.NewCoin("bnb", sdkmath.NewInt(100))), - types.SupplyInterestFactors{types.NewSupplyInterestFactor("bnb", sdk.MustNewDecFromStr("1.12"))}, + types.SupplyInterestFactors{types.NewSupplyInterestFactor("bnb", sdkmath.LegacyMustNewDecFromStr("1.12"))}, ) deposits = append(deposits, dep) suite.keeper.SetDeposit(suite.ctx, dep) @@ -94,7 +92,7 @@ func (suite *KeeperTestSuite) TestGetSetDeleteBorrow() { borrow := types.NewBorrow( addr, sdk.NewCoins(sdk.NewInt64Coin("bnb", 1e9)), - types.BorrowInterestFactors{types.NewBorrowInterestFactor("bnb", sdk.MustNewDecFromStr("1.12"))}, + types.BorrowInterestFactors{types.NewBorrowInterestFactor("bnb", sdkmath.LegacyMustNewDecFromStr("1.12"))}, ) _, f := suite.keeper.GetBorrow(suite.ctx, addr) @@ -118,7 +116,7 @@ func (suite *KeeperTestSuite) TestIterateBorrows() { borrow := types.NewBorrow( sdk.AccAddress("test"+fmt.Sprint(i)), sdk.NewCoins(sdk.NewInt64Coin("bnb", 1e9)), - types.BorrowInterestFactors{types.NewBorrowInterestFactor("bnb", sdk.MustNewDecFromStr("1.12"))}, + types.BorrowInterestFactors{types.NewBorrowInterestFactor("bnb", sdkmath.LegacyMustNewDecFromStr("1.12"))}, ) borrows = append(borrows, borrow) suite.keeper.SetBorrow(suite.ctx, borrow) @@ -133,9 +131,9 @@ func (suite *KeeperTestSuite) TestIterateBorrows() { func (suite *KeeperTestSuite) TestGetSetDeleteInterestRateModel() { denom := "test" - model := types.NewInterestRateModel(sdk.MustNewDecFromStr("0.05"), sdk.MustNewDecFromStr("2"), sdk.MustNewDecFromStr("0.8"), sdk.MustNewDecFromStr("10")) - borrowLimit := types.NewBorrowLimit(false, sdk.MustNewDecFromStr("0.2"), sdk.MustNewDecFromStr("0.5")) - moneyMarket := types.NewMoneyMarket(denom, borrowLimit, denom+":usd", sdkmath.NewInt(1000000), model, sdk.MustNewDecFromStr("0.05"), sdk.ZeroDec()) + model := types.NewInterestRateModel(sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyMustNewDecFromStr("2"), sdkmath.LegacyMustNewDecFromStr("0.8"), sdkmath.LegacyMustNewDecFromStr("10")) + borrowLimit := types.NewBorrowLimit(false, sdkmath.LegacyMustNewDecFromStr("0.2"), sdkmath.LegacyMustNewDecFromStr("0.5")) + moneyMarket := types.NewMoneyMarket(denom, borrowLimit, denom+":usd", sdkmath.NewInt(1000000), model, sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyZeroDec()) _, f := suite.keeper.GetMoneyMarket(suite.ctx, denom) suite.Require().False(f) @@ -159,9 +157,9 @@ func (suite *KeeperTestSuite) TestIterateInterestRateModels() { for i := 0; i < 5; i++ { // Initialize a new money market denom := testDenom + strconv.Itoa(i) - model := types.NewInterestRateModel(sdk.MustNewDecFromStr("0.05"), sdk.MustNewDecFromStr("2"), sdk.MustNewDecFromStr("0.8"), sdk.MustNewDecFromStr("10")) - borrowLimit := types.NewBorrowLimit(false, sdk.MustNewDecFromStr("0.2"), sdk.MustNewDecFromStr("0.5")) - moneyMarket := types.NewMoneyMarket(denom, borrowLimit, denom+":usd", sdkmath.NewInt(1000000), model, sdk.MustNewDecFromStr("0.05"), sdk.ZeroDec()) + model := types.NewInterestRateModel(sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyMustNewDecFromStr("2"), sdkmath.LegacyMustNewDecFromStr("0.8"), sdkmath.LegacyMustNewDecFromStr("10")) + borrowLimit := types.NewBorrowLimit(false, sdkmath.LegacyMustNewDecFromStr("0.2"), sdkmath.LegacyMustNewDecFromStr("0.5")) + moneyMarket := types.NewMoneyMarket(denom, borrowLimit, denom+":usd", sdkmath.NewInt(1000000), model, sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyZeroDec()) // Store money market in the module's store suite.Require().NotPanics(func() { suite.keeper.SetMoneyMarket(suite.ctx, denom, moneyMarket) }) @@ -205,27 +203,27 @@ func (suite *KeeperTestSuite) TestGetSetBorrowedCoins_Empty() { suite.Require().Empty(coins) } -func (suite *KeeperTestSuite) getAccountCoins(acc authtypes.AccountI) sdk.Coins { +func (suite *KeeperTestSuite) getAccountCoins(acc sdk.AccountI) sdk.Coins { bk := suite.app.GetBankKeeper() return bk.GetAllBalances(suite.ctx, acc.GetAddress()) } -func (suite *KeeperTestSuite) getAccount(addr sdk.AccAddress) authtypes.AccountI { +func (suite *KeeperTestSuite) getAccount(addr sdk.AccAddress) sdk.AccountI { ak := suite.app.GetAccountKeeper() return ak.GetAccount(suite.ctx, addr) } -func (suite *KeeperTestSuite) getAccountAtCtx(addr sdk.AccAddress, ctx sdk.Context) authtypes.AccountI { +func (suite *KeeperTestSuite) getAccountAtCtx(addr sdk.AccAddress, ctx sdk.Context) sdk.AccountI { ak := suite.app.GetAccountKeeper() return ak.GetAccount(ctx, addr) } -func (suite *KeeperTestSuite) getModuleAccount(name string) authtypes.ModuleAccountI { +func (suite *KeeperTestSuite) getModuleAccount(name string) sdk.ModuleAccountI { ak := suite.app.GetAccountKeeper() return ak.GetModuleAccount(suite.ctx, name) } -func (suite *KeeperTestSuite) getModuleAccountAtCtx(name string, ctx sdk.Context) authtypes.ModuleAccountI { +func (suite *KeeperTestSuite) getModuleAccountAtCtx(name string, ctx sdk.Context) sdk.ModuleAccountI { ak := suite.app.GetAccountKeeper() return ak.GetModuleAccount(ctx, name) } diff --git a/x/hard/keeper/liquidation.go b/x/hard/keeper/liquidation.go index 94fce1a8b0..9159392412 100644 --- a/x/hard/keeper/liquidation.go +++ b/x/hard/keeper/liquidation.go @@ -12,8 +12,8 @@ import ( // LiqData holds liquidation-related data type LiqData struct { - price sdk.Dec - ltv sdk.Dec + price sdkmath.LegacyDec + ltv sdkmath.LegacyDec conversionFactor sdkmath.Int } @@ -86,7 +86,7 @@ func (k Keeper) SeizeDeposits(ctx sdk.Context, keeper sdk.AccAddress, deposit ty for _, depCoin := range deposit.Amount { mm, _ := k.GetMoneyMarket(ctx, depCoin.Denom) keeperReward := mm.KeeperRewardPercentage.MulInt(depCoin.Amount).TruncateInt() - if keeperReward.GT(sdk.ZeroInt()) { + if keeperReward.GT(sdkmath.ZeroInt()) { // Send keeper their reward keeperCoin := sdk.NewCoin(depCoin.Denom, keeperReward) keeperRewardCoins = append(keeperRewardCoins, keeperCoin) @@ -108,7 +108,7 @@ func (k Keeper) SeizeDeposits(ctx sdk.Context, keeper sdk.AccAddress, deposit ty depositCoinValues := types.NewValuationMap() for _, deposit := range aucDeposits { dData := liqMap[deposit.Denom] - dCoinUsdValue := sdk.NewDecFromInt(deposit.Amount).Quo(sdk.NewDecFromInt(dData.conversionFactor)).Mul(dData.price) + dCoinUsdValue := sdkmath.LegacyNewDecFromInt(deposit.Amount).Quo(sdkmath.LegacyNewDecFromInt(dData.conversionFactor)).Mul(dData.price) depositCoinValues.Increment(deposit.Denom, dCoinUsdValue) } @@ -116,7 +116,7 @@ func (k Keeper) SeizeDeposits(ctx sdk.Context, keeper sdk.AccAddress, deposit ty borrowCoinValues := types.NewValuationMap() for _, bCoin := range borrow.Amount { bData := liqMap[bCoin.Denom] - bCoinUsdValue := sdk.NewDecFromInt(bCoin.Amount).Quo(sdk.NewDecFromInt(bData.conversionFactor)).Mul(bData.price) + bCoinUsdValue := sdkmath.LegacyNewDecFromInt(bCoin.Amount).Quo(sdkmath.LegacyNewDecFromInt(bData.conversionFactor)).Mul(bData.price) borrowCoinValues.Increment(bCoin.Denom, bCoinUsdValue) } @@ -148,7 +148,7 @@ func (k Keeper) SeizeDeposits(ctx sdk.Context, keeper sdk.AccAddress, deposit ty // StartAuctions attempts to start auctions for seized assets func (k Keeper) StartAuctions(ctx sdk.Context, borrower sdk.AccAddress, borrows, deposits sdk.Coins, - depositCoinValues, borrowCoinValues types.ValuationMap, ltv sdk.Dec, liqMap map[string]LiqData, + depositCoinValues, borrowCoinValues types.ValuationMap, ltv sdkmath.LegacyDec, liqMap map[string]LiqData, ) (sdk.Coins, error) { // Sort keys to ensure deterministic behavior bKeys := borrowCoinValues.GetSortedKeys() @@ -157,7 +157,7 @@ func (k Keeper) StartAuctions(ctx sdk.Context, borrower sdk.AccAddress, borrows, // Set up auction constants returnAddrs := []sdk.AccAddress{borrower} weights := []sdkmath.Int{sdkmath.NewInt(100)} - debt := sdk.NewCoin("debt", sdk.ZeroInt()) + debt := sdk.NewCoin("debt", sdkmath.ZeroInt()) macc := k.accountKeeper.GetModuleAccount(ctx, types.ModuleAccountName) maccCoins := k.bankKeeper.SpendableCoins(ctx, macc.GetAddress()) @@ -169,7 +169,7 @@ func (k Keeper) StartAuctions(ctx sdk.Context, borrower sdk.AccAddress, borrows, for _, dKey := range dKeys { dValue := depositCoinValues.Get(dKey) - if maxLotSize.Equal(sdk.ZeroDec()) { + if maxLotSize.Equal(sdkmath.LegacyZeroDec()) { break // exit out of the loop if we have cleared the full amount } @@ -177,7 +177,7 @@ func (k Keeper) StartAuctions(ctx sdk.Context, borrower sdk.AccAddress, borrows, bid := sdk.NewCoin(bKey, borrows.AmountOf(bKey)) lotSize := maxLotSize.MulInt(liqMap[dKey].conversionFactor).Quo(liqMap[dKey].price) - if lotSize.TruncateInt().Equal(sdk.ZeroInt()) { + if lotSize.TruncateInt().Equal(sdkmath.ZeroInt()) { continue } lot := sdk.NewCoin(dKey, lotSize.TruncateInt()) @@ -222,14 +222,14 @@ func (k Keeper) StartAuctions(ctx sdk.Context, borrower sdk.AccAddress, borrows, deposits = deposits.Sub(lot) } // Update max lot size - maxLotSize = sdk.ZeroDec() + maxLotSize = sdkmath.LegacyZeroDec() } else { // We can only start an auction for the partial borrow amount maxBid := dValue.Mul(ltv) bidSize := maxBid.MulInt(liqMap[bKey].conversionFactor).Quo(liqMap[bKey].price) bid := sdk.NewCoin(bKey, bidSize.TruncateInt()) lot := sdk.NewCoin(dKey, deposits.AmountOf(dKey)) - if bid.Amount.Equal(sdk.ZeroInt()) || lot.Amount.Equal(sdk.ZeroInt()) { + if bid.Amount.Equal(sdkmath.ZeroInt()) || lot.Amount.Equal(sdkmath.ZeroInt()) { continue } @@ -282,7 +282,7 @@ func (k Keeper) StartAuctions(ctx sdk.Context, borrower sdk.AccAddress, borrows, // Send any remaining deposit back to the original borrower for _, dKey := range dKeys { remaining := deposits.AmountOf(dKey) - if remaining.GT(sdk.ZeroInt()) { + if remaining.GT(sdkmath.ZeroInt()) { returnCoin := sdk.NewCoins(sdk.NewCoin(dKey, remaining)) err := k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleAccountName, borrower, returnCoin) if err != nil { @@ -301,18 +301,18 @@ func (k Keeper) IsWithinValidLtvRange(ctx sdk.Context, deposit types.Deposit, bo return false, err } - totalBorrowableUSDAmount := sdk.ZeroDec() + totalBorrowableUSDAmount := sdkmath.LegacyZeroDec() for _, depCoin := range deposit.Amount { lData := liqMap[depCoin.Denom] - usdValue := sdk.NewDecFromInt(depCoin.Amount).Quo(sdk.NewDecFromInt(lData.conversionFactor)).Mul(lData.price) + usdValue := sdkmath.LegacyNewDecFromInt(depCoin.Amount).Quo(sdkmath.LegacyNewDecFromInt(lData.conversionFactor)).Mul(lData.price) borrowableUSDAmountForDeposit := usdValue.Mul(lData.ltv) totalBorrowableUSDAmount = totalBorrowableUSDAmount.Add(borrowableUSDAmountForDeposit) } - totalBorrowedUSDAmount := sdk.ZeroDec() + totalBorrowedUSDAmount := sdkmath.LegacyZeroDec() for _, coin := range borrow.Amount { lData := liqMap[coin.Denom] - usdValue := sdk.NewDecFromInt(coin.Amount).Quo(sdk.NewDecFromInt(lData.conversionFactor)).Mul(lData.price) + usdValue := sdkmath.LegacyNewDecFromInt(coin.Amount).Quo(sdkmath.LegacyNewDecFromInt(lData.conversionFactor)).Mul(lData.price) totalBorrowedUSDAmount = totalBorrowedUSDAmount.Add(usdValue) } @@ -326,17 +326,17 @@ func (k Keeper) IsWithinValidLtvRange(ctx sdk.Context, deposit types.Deposit, bo // GetStoreLTV calculates the user's current LTV based on their deposits/borrows in the store // and does not include any outsanding interest. -func (k Keeper) GetStoreLTV(ctx sdk.Context, addr sdk.AccAddress) (sdk.Dec, error) { +func (k Keeper) GetStoreLTV(ctx sdk.Context, addr sdk.AccAddress) (sdkmath.LegacyDec, error) { // Fetch deposits and parse coin denoms deposit, found := k.GetDeposit(ctx, addr) if !found { - return sdk.ZeroDec(), nil + return sdkmath.LegacyZeroDec(), nil } // Fetch borrow balances and parse coin denoms borrow, found := k.GetBorrow(ctx, addr) if !found { - return sdk.ZeroDec(), nil + return sdkmath.LegacyZeroDec(), nil } return k.CalculateLtv(ctx, deposit, borrow) @@ -344,18 +344,18 @@ func (k Keeper) GetStoreLTV(ctx sdk.Context, addr sdk.AccAddress) (sdk.Dec, erro // CalculateLtv calculates the potential LTV given a user's deposits and borrows. // The boolean returned indicates if the LTV should be added to the store's LTV index. -func (k Keeper) CalculateLtv(ctx sdk.Context, deposit types.Deposit, borrow types.Borrow) (sdk.Dec, error) { +func (k Keeper) CalculateLtv(ctx sdk.Context, deposit types.Deposit, borrow types.Borrow) (sdkmath.LegacyDec, error) { // Load required liquidation data for every deposit/borrow denom liqMap, err := k.LoadLiquidationData(ctx, deposit, borrow) if err != nil { - return sdk.ZeroDec(), nil + return sdkmath.LegacyZeroDec(), nil } // Build valuation map to hold deposit coin USD valuations depositCoinValues := types.NewValuationMap() for _, depCoin := range deposit.Amount { dData := liqMap[depCoin.Denom] - dCoinUsdValue := sdk.NewDecFromInt(depCoin.Amount).Quo(sdk.NewDecFromInt(dData.conversionFactor)).Mul(dData.price) + dCoinUsdValue := sdkmath.LegacyNewDecFromInt(depCoin.Amount).Quo(sdkmath.LegacyNewDecFromInt(dData.conversionFactor)).Mul(dData.price) depositCoinValues.Increment(depCoin.Denom, dCoinUsdValue) } @@ -363,14 +363,14 @@ func (k Keeper) CalculateLtv(ctx sdk.Context, deposit types.Deposit, borrow type borrowCoinValues := types.NewValuationMap() for _, bCoin := range borrow.Amount { bData := liqMap[bCoin.Denom] - bCoinUsdValue := sdk.NewDecFromInt(bCoin.Amount).Quo(sdk.NewDecFromInt(bData.conversionFactor)).Mul(bData.price) + bCoinUsdValue := sdkmath.LegacyNewDecFromInt(bCoin.Amount).Quo(sdkmath.LegacyNewDecFromInt(bData.conversionFactor)).Mul(bData.price) borrowCoinValues.Increment(bCoin.Denom, bCoinUsdValue) } // User doesn't have any deposits, catch divide by 0 error sumDeposits := depositCoinValues.Sum() - if sumDeposits.Equal(sdk.ZeroDec()) { - return sdk.ZeroDec(), nil + if sumDeposits.Equal(sdkmath.LegacyZeroDec()) { + return sdkmath.LegacyZeroDec(), nil } // Loan-to-Value ratio diff --git a/x/hard/keeper/liquidation_test.go b/x/hard/keeper/liquidation_test.go index d9c3fe33da..2356920d09 100644 --- a/x/hard/keeper/liquidation_test.go +++ b/x/hard/keeper/liquidation_test.go @@ -20,7 +20,7 @@ func (suite *KeeperTestSuite) TestKeeperLiquidation() { type args struct { borrower sdk.AccAddress keeper sdk.AccAddress - keeperRewardPercent sdk.Dec + keeperRewardPercent sdkmath.LegacyDec initialModuleCoins sdk.Coins initialBorrowerCoins sdk.Coins initialKeeperCoins sdk.Coins @@ -46,8 +46,8 @@ func (suite *KeeperTestSuite) TestKeeperLiquidation() { } // Set up test constants - model := types.NewInterestRateModel(sdk.MustNewDecFromStr("0"), sdk.MustNewDecFromStr("0.1"), sdk.MustNewDecFromStr("0.8"), sdk.MustNewDecFromStr("0.5")) - reserveFactor := sdk.MustNewDecFromStr("0.05") + model := types.NewInterestRateModel(sdkmath.LegacyMustNewDecFromStr("0"), sdkmath.LegacyMustNewDecFromStr("0.1"), sdkmath.LegacyMustNewDecFromStr("0.8"), sdkmath.LegacyMustNewDecFromStr("0.5")) + reserveFactor := sdkmath.LegacyMustNewDecFromStr("0.05") oneMonthDur := time.Second * 30 * 24 * 3600 borrower := sdk.AccAddress(crypto.AddressHash([]byte("testborrower"))) keeper := sdk.AccAddress(crypto.AddressHash([]byte("testkeeper"))) @@ -65,7 +65,7 @@ func (suite *KeeperTestSuite) TestKeeperLiquidation() { args{ borrower: borrower, keeper: keeper, - keeperRewardPercent: sdk.MustNewDecFromStr("0.05"), + keeperRewardPercent: sdkmath.LegacyMustNewDecFromStr("0.05"), initialModuleCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(100*KAVA_CF))), initialBorrowerCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(100*KAVA_CF))), initialKeeperCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(100*KAVA_CF))), @@ -104,7 +104,7 @@ func (suite *KeeperTestSuite) TestKeeperLiquidation() { args{ borrower: borrower, keeper: keeper, - keeperRewardPercent: sdk.MustNewDecFromStr("0.0"), + keeperRewardPercent: sdkmath.LegacyMustNewDecFromStr("0.0"), initialModuleCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(100*KAVA_CF))), initialBorrowerCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(100*KAVA_CF))), initialKeeperCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(100*KAVA_CF))), @@ -143,7 +143,7 @@ func (suite *KeeperTestSuite) TestKeeperLiquidation() { args{ borrower: borrower, keeper: keeper, - keeperRewardPercent: sdk.MustNewDecFromStr("1.0"), + keeperRewardPercent: sdkmath.LegacyMustNewDecFromStr("1.0"), initialModuleCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(100*KAVA_CF))), initialBorrowerCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(100*KAVA_CF))), initialKeeperCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(100*KAVA_CF))), @@ -166,7 +166,7 @@ func (suite *KeeperTestSuite) TestKeeperLiquidation() { args{ borrower: borrower, keeper: keeper, - keeperRewardPercent: sdk.MustNewDecFromStr("0.05"), + keeperRewardPercent: sdkmath.LegacyMustNewDecFromStr("0.05"), initialModuleCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(1000*KAVA_CF)), sdk.NewCoin("usdc", sdkmath.NewInt(1000*KAVA_CF)), sdk.NewCoin("bnb", sdkmath.NewInt(1000*BNB_CF)), sdk.NewCoin("btc", sdkmath.NewInt(1000*BTCB_CF))), initialBorrowerCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(100*KAVA_CF))), initialKeeperCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(100*KAVA_CF))), @@ -255,7 +255,7 @@ func (suite *KeeperTestSuite) TestKeeperLiquidation() { args{ borrower: borrower, keeper: keeper, - keeperRewardPercent: sdk.MustNewDecFromStr("0.05"), + keeperRewardPercent: sdkmath.LegacyMustNewDecFromStr("0.05"), initialModuleCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(1000*KAVA_CF))), initialBorrowerCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(100*KAVA_CF)), sdk.NewCoin("bnb", sdkmath.NewInt(100*BNB_CF)), sdk.NewCoin("btc", sdkmath.NewInt(100*BTCB_CF))), initialKeeperCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(100*KAVA_CF))), @@ -327,7 +327,7 @@ func (suite *KeeperTestSuite) TestKeeperLiquidation() { args{ borrower: borrower, keeper: keeper, - keeperRewardPercent: sdk.MustNewDecFromStr("0.05"), + keeperRewardPercent: sdkmath.LegacyMustNewDecFromStr("0.05"), initialModuleCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(1000*KAVA_CF)), sdk.NewCoin("bnb", sdkmath.NewInt(1000*BNB_CF)), sdk.NewCoin("btc", sdkmath.NewInt(1000*BTCB_CF))), initialBorrowerCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(100*KAVA_CF)), sdk.NewCoin("usdc", sdkmath.NewInt(100*KAVA_CF)), sdk.NewCoin("usdt", sdkmath.NewInt(100*KAVA_CF)), sdk.NewCoin("usdx", sdkmath.NewInt(100*KAVA_CF))), initialKeeperCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(100*KAVA_CF))), @@ -431,7 +431,7 @@ func (suite *KeeperTestSuite) TestKeeperLiquidation() { args{ borrower: borrower, keeper: keeper, - keeperRewardPercent: sdk.MustNewDecFromStr("0.05"), + keeperRewardPercent: sdkmath.LegacyMustNewDecFromStr("0.05"), initialModuleCoins: sdk.NewCoins(sdk.NewCoin("usdx", sdkmath.NewInt(1000*KAVA_CF)), sdk.NewCoin("usdt", sdkmath.NewInt(1000*KAVA_CF)), sdk.NewCoin("dai", sdkmath.NewInt(1000*KAVA_CF)), sdk.NewCoin("usdc", sdkmath.NewInt(1000*KAVA_CF))), initialBorrowerCoins: sdk.NewCoins(sdk.NewCoin("usdx", sdkmath.NewInt(1000*KAVA_CF)), sdk.NewCoin("usdt", sdkmath.NewInt(1000*KAVA_CF)), sdk.NewCoin("dai", sdkmath.NewInt(1000*KAVA_CF)), sdk.NewCoin("usdc", sdkmath.NewInt(1000*KAVA_CF))), initialKeeperCoins: sdk.NewCoins(sdk.NewCoin("usdx", sdkmath.NewInt(1000*KAVA_CF)), sdk.NewCoin("usdt", sdkmath.NewInt(1000*KAVA_CF)), sdk.NewCoin("dai", sdkmath.NewInt(1000*KAVA_CF)), sdk.NewCoin("usdc", sdkmath.NewInt(1000*KAVA_CF))), @@ -505,7 +505,7 @@ func (suite *KeeperTestSuite) TestKeeperLiquidation() { args{ borrower: borrower, keeper: keeper, - keeperRewardPercent: sdk.MustNewDecFromStr("0.05"), + keeperRewardPercent: sdkmath.LegacyMustNewDecFromStr("0.05"), initialModuleCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(100*KAVA_CF))), initialBorrowerCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(100*KAVA_CF))), initialKeeperCoins: sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(100*KAVA_CF))), @@ -529,7 +529,7 @@ func (suite *KeeperTestSuite) TestKeeperLiquidation() { suite.Run(tc.name, func() { // Initialize test app and set context tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: time.Date(1998, 1, 1, 0, 0, 0, 0, time.UTC)}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: time.Date(1998, 1, 1, 0, 0, 0, 0, time.UTC)}) // account which will deposit "initial module account coins" depositor := sdk.AccAddress(crypto.AddressHash([]byte("testdepositor"))) @@ -553,56 +553,56 @@ func (suite *KeeperTestSuite) TestKeeperLiquidation() { hardGS := types.NewGenesisState(types.NewParams( types.MoneyMarkets{ types.NewMoneyMarket("usdx", - types.NewBorrowLimit(false, sdk.NewDec(100000000*KAVA_CF), sdk.MustNewDecFromStr("0.9")), // Borrow Limit + types.NewBorrowLimit(false, sdkmath.LegacyNewDec(100000000*KAVA_CF), sdkmath.LegacyMustNewDecFromStr("0.9")), // Borrow Limit "usdx:usd", // Market ID sdkmath.NewInt(KAVA_CF), // Conversion Factor model, // Interest Rate Model reserveFactor, // Reserve Factor tc.args.keeperRewardPercent), // Keeper Reward Percent types.NewMoneyMarket("usdt", - types.NewBorrowLimit(false, sdk.NewDec(100000000*KAVA_CF), sdk.MustNewDecFromStr("0.9")), // Borrow Limit + types.NewBorrowLimit(false, sdkmath.LegacyNewDec(100000000*KAVA_CF), sdkmath.LegacyMustNewDecFromStr("0.9")), // Borrow Limit "usdt:usd", // Market ID sdkmath.NewInt(KAVA_CF), // Conversion Factor model, // Interest Rate Model reserveFactor, // Reserve Factor tc.args.keeperRewardPercent), // Keeper Reward Percent types.NewMoneyMarket("usdc", - types.NewBorrowLimit(false, sdk.NewDec(100000000*KAVA_CF), sdk.MustNewDecFromStr("0.9")), // Borrow Limit + types.NewBorrowLimit(false, sdkmath.LegacyNewDec(100000000*KAVA_CF), sdkmath.LegacyMustNewDecFromStr("0.9")), // Borrow Limit "usdc:usd", // Market ID sdkmath.NewInt(KAVA_CF), // Conversion Factor model, // Interest Rate Model reserveFactor, // Reserve Factor tc.args.keeperRewardPercent), // Keeper Reward Percent types.NewMoneyMarket("dai", - types.NewBorrowLimit(false, sdk.NewDec(100000000*KAVA_CF), sdk.MustNewDecFromStr("0.9")), // Borrow Limit + types.NewBorrowLimit(false, sdkmath.LegacyNewDec(100000000*KAVA_CF), sdkmath.LegacyMustNewDecFromStr("0.9")), // Borrow Limit "dai:usd", // Market ID sdkmath.NewInt(KAVA_CF), // Conversion Factor model, // Interest Rate Model reserveFactor, // Reserve Factor tc.args.keeperRewardPercent), // Keeper Reward Percent types.NewMoneyMarket("ukava", - types.NewBorrowLimit(false, sdk.NewDec(100000000*KAVA_CF), sdk.MustNewDecFromStr("0.8")), // Borrow Limit + types.NewBorrowLimit(false, sdkmath.LegacyNewDec(100000000*KAVA_CF), sdkmath.LegacyMustNewDecFromStr("0.8")), // Borrow Limit "kava:usd", // Market ID sdkmath.NewInt(KAVA_CF), // Conversion Factor model, // Interest Rate Model reserveFactor, // Reserve Factor tc.args.keeperRewardPercent), // Keeper Reward Percent types.NewMoneyMarket("bnb", - types.NewBorrowLimit(false, sdk.NewDec(100000000*BNB_CF), sdk.MustNewDecFromStr("0.8")), // Borrow Limit + types.NewBorrowLimit(false, sdkmath.LegacyNewDec(100000000*BNB_CF), sdkmath.LegacyMustNewDecFromStr("0.8")), // Borrow Limit "bnb:usd", // Market ID sdkmath.NewInt(BNB_CF), // Conversion Factor model, // Interest Rate Model reserveFactor, // Reserve Factor tc.args.keeperRewardPercent), // Keeper Reward Percent types.NewMoneyMarket("btc", - types.NewBorrowLimit(false, sdk.NewDec(100000000*BTCB_CF), sdk.MustNewDecFromStr("0.8")), // Borrow Limit + types.NewBorrowLimit(false, sdkmath.LegacyNewDec(100000000*BTCB_CF), sdkmath.LegacyMustNewDecFromStr("0.8")), // Borrow Limit "btc:usd", // Market ID sdkmath.NewInt(BTCB_CF), // Conversion Factor model, // Interest Rate Model reserveFactor, // Reserve Factor tc.args.keeperRewardPercent), // Keeper Reward Percent }, - sdk.NewDec(10), + sdkmath.LegacyNewDec(10), ), types.DefaultAccumulationTimes, types.DefaultDeposits, types.DefaultBorrows, types.DefaultTotalSupplied, types.DefaultTotalBorrowed, types.DefaultTotalReserves, ) @@ -624,43 +624,43 @@ func (suite *KeeperTestSuite) TestKeeperLiquidation() { { MarketID: "usdx:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("1.00"), + Price: sdkmath.LegacyMustNewDecFromStr("1.00"), Expiry: time.Now().Add(100 * time.Hour), }, { MarketID: "usdt:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("1.00"), + Price: sdkmath.LegacyMustNewDecFromStr("1.00"), Expiry: time.Now().Add(100 * time.Hour), }, { MarketID: "usdc:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("1.00"), + Price: sdkmath.LegacyMustNewDecFromStr("1.00"), Expiry: time.Now().Add(100 * time.Hour), }, { MarketID: "dai:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("1.00"), + Price: sdkmath.LegacyMustNewDecFromStr("1.00"), Expiry: time.Now().Add(100 * time.Hour), }, { MarketID: "kava:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("2.00"), + Price: sdkmath.LegacyMustNewDecFromStr("2.00"), Expiry: time.Now().Add(100 * time.Hour), }, { MarketID: "bnb:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("10.00"), + Price: sdkmath.LegacyMustNewDecFromStr("10.00"), Expiry: time.Now().Add(100 * time.Hour), }, { MarketID: "btc:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("100.00"), + Price: sdkmath.LegacyMustNewDecFromStr("100.00"), Expiry: time.Now().Add(100 * time.Hour), }, }, @@ -740,7 +740,7 @@ func (suite *KeeperTestSuite) TestKeeperLiquidation() { suppliedCoinsPost, _ := suite.keeper.GetSuppliedCoins(liqCtx) suite.Require().Equal(tc.args.expectedTotalSuppliedCoins, suppliedCoinsPost) borrowedCoinsPost, _ := suite.keeper.GetBorrowedCoins(liqCtx) - suite.Require().True(tc.args.expectedTotalBorrowedCoins.IsEqual(borrowedCoinsPost)) + suite.Require().True(tc.args.expectedTotalBorrowedCoins.Equal(borrowedCoinsPost)) } else { suite.Require().Error(err) suite.Require().True(strings.Contains(err.Error(), tc.errArgs.contains)) @@ -758,7 +758,7 @@ func (suite *KeeperTestSuite) TestKeeperLiquidation() { // Check that supplied and borrowed coins have not been updated post-liquidation suite.Require().Equal(tc.args.expectedTotalSuppliedCoins, suppliedCoinsPre) - suite.Require().True(tc.args.expectedTotalBorrowedCoins.IsEqual(borrowedCoinsPre)) + suite.Require().True(tc.args.expectedTotalBorrowedCoins.Equal(borrowedCoinsPre)) } }) } diff --git a/x/hard/keeper/params.go b/x/hard/keeper/params.go index 8bcd339cd6..6225402c50 100644 --- a/x/hard/keeper/params.go +++ b/x/hard/keeper/params.go @@ -1,6 +1,7 @@ package keeper import ( + sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/kava-labs/kava/x/hard/types" @@ -19,7 +20,7 @@ func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { } // GetMinimumBorrowUSDValue returns the minimum borrow USD value -func (k Keeper) GetMinimumBorrowUSDValue(ctx sdk.Context) sdk.Dec { +func (k Keeper) GetMinimumBorrowUSDValue(ctx sdk.Context) sdkmath.LegacyDec { params := k.GetParams(ctx) return params.MinimumBorrowUSDValue } diff --git a/x/hard/keeper/repay.go b/x/hard/keeper/repay.go index 454812fd5e..d1fcc851c1 100644 --- a/x/hard/keeper/repay.go +++ b/x/hard/keeper/repay.go @@ -2,6 +2,7 @@ package keeper import ( errorsmod "cosmossdk.io/errors" + sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/kava-labs/kava/x/hard/types" @@ -83,10 +84,10 @@ func (k Keeper) Repay(ctx sdk.Context, sender, owner sdk.AccAddress, coins sdk.C // ValidateRepay validates a requested loan repay func (k Keeper) ValidateRepay(ctx sdk.Context, sender, owner sdk.AccAddress, coins sdk.Coins) error { - assetPriceCache := map[string]sdk.Dec{} + assetPriceCache := map[string]sdkmath.LegacyDec{} // Get the total USD value of user's existing borrows - existingBorrowUSDValue := sdk.ZeroDec() + existingBorrowUSDValue := sdkmath.LegacyZeroDec() existingBorrow, found := k.GetBorrow(ctx, owner) if found { for _, coin := range existingBorrow.Amount { @@ -106,13 +107,13 @@ func (k Keeper) ValidateRepay(ctx sdk.Context, sender, owner sdk.AccAddress, coi } // Calculate this borrow coin's USD value and add it to the total previous borrowed USD value - coinUSDValue := sdk.NewDecFromInt(coin.Amount).Quo(sdk.NewDecFromInt(moneyMarket.ConversionFactor)).Mul(assetPrice) + coinUSDValue := sdkmath.LegacyNewDecFromInt(coin.Amount).Quo(sdkmath.LegacyNewDecFromInt(moneyMarket.ConversionFactor)).Mul(assetPrice) existingBorrowUSDValue = existingBorrowUSDValue.Add(coinUSDValue) } } senderCoins := k.bankKeeper.SpendableCoins(ctx, sender) - repayTotalUSDValue := sdk.ZeroDec() + repayTotalUSDValue := sdkmath.LegacyZeroDec() for _, repayCoin := range coins { // Check that sender holds enough tokens to make the proposed payment if senderCoins.AmountOf(repayCoin.Denom).LT(repayCoin.Amount) { @@ -134,16 +135,16 @@ func (k Keeper) ValidateRepay(ctx sdk.Context, sender, owner sdk.AccAddress, coi assetPriceCache[repayCoin.Denom] = assetPriceInfo.Price assetPrice = assetPriceInfo.Price } - coinUSDValue := sdk.NewDecFromInt(repayCoin.Amount).Quo(sdk.NewDecFromInt(moneyMarket.ConversionFactor)).Mul(assetPrice) + coinUSDValue := sdkmath.LegacyNewDecFromInt(repayCoin.Amount).Quo(sdkmath.LegacyNewDecFromInt(moneyMarket.ConversionFactor)).Mul(assetPrice) repayTotalUSDValue = repayTotalUSDValue.Add(coinUSDValue) } - // If the proposed repayment would results in a borrowed USD value below the minimum borrow USD value, reject it. + // If the proposed repayment would result in a borrowed USD value below the minimum borrow USD value, reject it. // User can overpay their loan to close it out, but underpaying by such a margin that the USD value is in an // invalid range is not allowed // Unless the user is fully repaying their loan proposedBorrowNewUSDValue := existingBorrowUSDValue.Sub(repayTotalUSDValue) - isFullRepayment := coins.IsEqual(existingBorrow.Amount) + isFullRepayment := coins.Equal(existingBorrow.Amount) if proposedBorrowNewUSDValue.LT(k.GetMinimumBorrowUSDValue(ctx)) && !isFullRepayment { return errorsmod.Wrapf(types.ErrBelowMinimumBorrowValue, "the proposed borrow's USD value $%s is below the minimum borrow limit $%s", proposedBorrowNewUSDValue, k.GetMinimumBorrowUSDValue(ctx)) } diff --git a/x/hard/keeper/repay_test.go b/x/hard/keeper/repay_test.go index 9d9e9e39f8..c3f8aac3a9 100644 --- a/x/hard/keeper/repay_test.go +++ b/x/hard/keeper/repay_test.go @@ -39,7 +39,7 @@ func (suite *KeeperTestSuite) TestRepay() { errArgs errArgs } - model := types.NewInterestRateModel(sdk.MustNewDecFromStr("0.05"), sdk.MustNewDecFromStr("2"), sdk.MustNewDecFromStr("0.8"), sdk.MustNewDecFromStr("10")) + model := types.NewInterestRateModel(sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyMustNewDecFromStr("2"), sdkmath.LegacyMustNewDecFromStr("0.8"), sdkmath.LegacyMustNewDecFromStr("10")) testCases := []borrowTest{ { @@ -210,7 +210,7 @@ func (suite *KeeperTestSuite) TestRepay() { suite.Run(tc.name, func() { // Initialize test app and set context tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) // Auth module genesis state addrs, coinses := uniqueAddressCoins( @@ -227,21 +227,21 @@ func (suite *KeeperTestSuite) TestRepay() { hardGS := types.NewGenesisState(types.NewParams( types.MoneyMarkets{ types.NewMoneyMarket("usdx", - types.NewBorrowLimit(false, sdk.NewDec(100000000*USDX_CF), sdk.MustNewDecFromStr("1")), // Borrow Limit - "usdx:usd", // Market ID - sdkmath.NewInt(USDX_CF), // Conversion Factor - model, // Interest Rate Model - sdk.MustNewDecFromStr("0.05"), // Reserve Factor - sdk.MustNewDecFromStr("0.05")), // Keeper Reward Percent + types.NewBorrowLimit(false, sdkmath.LegacyNewDec(100000000*USDX_CF), sdkmath.LegacyMustNewDecFromStr("1")), // Borrow Limit + "usdx:usd", // Market ID + sdkmath.NewInt(USDX_CF), // Conversion Factor + model, // Interest Rate Model + sdkmath.LegacyMustNewDecFromStr("0.05"), // Reserve Factor + sdkmath.LegacyMustNewDecFromStr("0.05")), // Keeper Reward Percent types.NewMoneyMarket("ukava", - types.NewBorrowLimit(false, sdk.NewDec(100000000*KAVA_CF), sdk.MustNewDecFromStr("0.8")), // Borrow Limit - "kava:usd", // Market ID - sdkmath.NewInt(KAVA_CF), // Conversion Factor - model, // Interest Rate Model - sdk.MustNewDecFromStr("0.05"), // Reserve Factor - sdk.MustNewDecFromStr("0.05")), // Keeper Reward Percent + types.NewBorrowLimit(false, sdkmath.LegacyNewDec(100000000*KAVA_CF), sdkmath.LegacyMustNewDecFromStr("0.8")), // Borrow Limit + "kava:usd", // Market ID + sdkmath.NewInt(KAVA_CF), // Conversion Factor + model, // Interest Rate Model + sdkmath.LegacyMustNewDecFromStr("0.05"), // Reserve Factor + sdkmath.LegacyMustNewDecFromStr("0.05")), // Keeper Reward Percent }, - sdk.NewDec(10), + sdkmath.LegacyNewDec(10), ), types.DefaultAccumulationTimes, types.DefaultDeposits, types.DefaultBorrows, types.DefaultTotalSupplied, types.DefaultTotalBorrowed, types.DefaultTotalReserves, ) @@ -258,13 +258,13 @@ func (suite *KeeperTestSuite) TestRepay() { { MarketID: "usdx:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("1.00"), + Price: sdkmath.LegacyMustNewDecFromStr("1.00"), Expiry: time.Now().Add(1 * time.Hour), }, { MarketID: "kava:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("2.00"), + Price: sdkmath.LegacyMustNewDecFromStr("2.00"), Expiry: time.Now().Add(1 * time.Hour), }, }, @@ -310,7 +310,7 @@ func (suite *KeeperTestSuite) TestRepay() { expectedRepayerCoins := previousRepayerCoins.Sub(repaymentCoins...) acc := suite.getAccount(tc.args.repayer) // use IsEqual for sdk.Coins{nil} vs sdk.Coins{} - suite.Require().True(expectedRepayerCoins.IsEqual(bankKeeper.GetAllBalances(suite.ctx, acc.GetAddress()))) + suite.Require().True(expectedRepayerCoins.Equal(bankKeeper.GetAllBalances(suite.ctx, acc.GetAddress()))) // Check module account balance expectedModuleCoins := tc.args.initialModuleCoins.Add(tc.args.depositCoins...).Sub(tc.args.borrowCoins...).Add(repaymentCoins...) diff --git a/x/hard/keeper/withdraw_test.go b/x/hard/keeper/withdraw_test.go index 0268283151..32c467c372 100644 --- a/x/hard/keeper/withdraw_test.go +++ b/x/hard/keeper/withdraw_test.go @@ -117,7 +117,7 @@ func (suite *KeeperTestSuite) TestWithdraw() { // Initialize test app and set context tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) authGS := app.NewFundedGenStateWithCoins( tApp.AppCodec(), []sdk.Coins{sdk.NewCoins( @@ -127,14 +127,14 @@ func (suite *KeeperTestSuite) TestWithdraw() { []sdk.AccAddress{tc.args.depositor}, ) - loanToValue := sdk.MustNewDecFromStr("0.6") + loanToValue := sdkmath.LegacyMustNewDecFromStr("0.6") hardGS := types.NewGenesisState(types.NewParams( types.MoneyMarkets{ - types.NewMoneyMarket("usdx", types.NewBorrowLimit(false, sdk.NewDec(1000000000000000), loanToValue), "usdx:usd", sdkmath.NewInt(1000000), types.NewInterestRateModel(sdk.MustNewDecFromStr("0.05"), sdk.MustNewDecFromStr("2"), sdk.MustNewDecFromStr("0.8"), sdk.MustNewDecFromStr("10")), sdk.MustNewDecFromStr("0.05"), sdk.ZeroDec()), - types.NewMoneyMarket("ukava", types.NewBorrowLimit(false, sdk.NewDec(1000000000000000), loanToValue), "kava:usd", sdkmath.NewInt(1000000), types.NewInterestRateModel(sdk.MustNewDecFromStr("0.05"), sdk.MustNewDecFromStr("2"), sdk.MustNewDecFromStr("0.8"), sdk.MustNewDecFromStr("10")), sdk.MustNewDecFromStr("0.05"), sdk.ZeroDec()), - types.NewMoneyMarket("bnb", types.NewBorrowLimit(false, sdk.NewDec(1000000000000000), loanToValue), "bnb:usd", sdkmath.NewInt(100000000), types.NewInterestRateModel(sdk.MustNewDecFromStr("0.05"), sdk.MustNewDecFromStr("2"), sdk.MustNewDecFromStr("0.8"), sdk.MustNewDecFromStr("10")), sdk.MustNewDecFromStr("0.05"), sdk.ZeroDec()), + types.NewMoneyMarket("usdx", types.NewBorrowLimit(false, sdkmath.LegacyNewDec(1000000000000000), loanToValue), "usdx:usd", sdkmath.NewInt(1000000), types.NewInterestRateModel(sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyMustNewDecFromStr("2"), sdkmath.LegacyMustNewDecFromStr("0.8"), sdkmath.LegacyMustNewDecFromStr("10")), sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyZeroDec()), + types.NewMoneyMarket("ukava", types.NewBorrowLimit(false, sdkmath.LegacyNewDec(1000000000000000), loanToValue), "kava:usd", sdkmath.NewInt(1000000), types.NewInterestRateModel(sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyMustNewDecFromStr("2"), sdkmath.LegacyMustNewDecFromStr("0.8"), sdkmath.LegacyMustNewDecFromStr("10")), sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyZeroDec()), + types.NewMoneyMarket("bnb", types.NewBorrowLimit(false, sdkmath.LegacyNewDec(1000000000000000), loanToValue), "bnb:usd", sdkmath.NewInt(100000000), types.NewInterestRateModel(sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyMustNewDecFromStr("2"), sdkmath.LegacyMustNewDecFromStr("0.8"), sdkmath.LegacyMustNewDecFromStr("10")), sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyZeroDec()), }, - sdk.NewDec(10), + sdkmath.LegacyNewDec(10), ), types.DefaultAccumulationTimes, types.DefaultDeposits, types.DefaultBorrows, types.DefaultTotalSupplied, types.DefaultTotalBorrowed, types.DefaultTotalReserves, ) @@ -152,19 +152,19 @@ func (suite *KeeperTestSuite) TestWithdraw() { { MarketID: "usdx:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("1.00"), + Price: sdkmath.LegacyMustNewDecFromStr("1.00"), Expiry: time.Now().Add(100 * time.Hour), }, { MarketID: "kava:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("2.00"), + Price: sdkmath.LegacyMustNewDecFromStr("2.00"), Expiry: time.Now().Add(100 * time.Hour), }, { MarketID: "bnb:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("10.00"), + Price: sdkmath.LegacyMustNewDecFromStr("10.00"), Expiry: time.Now().Add(100 * time.Hour), }, }, @@ -195,7 +195,7 @@ func (suite *KeeperTestSuite) TestWithdraw() { acc := suite.getAccount(tc.args.depositor) suite.Require().Equal(tc.args.expectedAccountBalance, bankKeeper.GetAllBalances(ctx, acc.GetAddress())) mAcc := suite.getModuleAccount(types.ModuleAccountName) - suite.Require().True(tc.args.expectedModAccountBalance.IsEqual(bankKeeper.GetAllBalances(ctx, mAcc.GetAddress()))) + suite.Require().True(tc.args.expectedModAccountBalance.Equal(bankKeeper.GetAllBalances(ctx, mAcc.GetAddress()))) testDeposit, f := suite.keeper.GetDeposit(suite.ctx, tc.args.depositor) if tc.errArgs.expectDelete { suite.Require().False(f) @@ -234,8 +234,8 @@ func (suite *KeeperTestSuite) TestLtvWithdraw() { } // Set up test constants - model := types.NewInterestRateModel(sdk.MustNewDecFromStr("0"), sdk.MustNewDecFromStr("0.1"), sdk.MustNewDecFromStr("0.8"), sdk.MustNewDecFromStr("0.5")) - reserveFactor := sdk.MustNewDecFromStr("0.05") + model := types.NewInterestRateModel(sdkmath.LegacyMustNewDecFromStr("0"), sdkmath.LegacyMustNewDecFromStr("0.1"), sdkmath.LegacyMustNewDecFromStr("0.8"), sdkmath.LegacyMustNewDecFromStr("0.5")) + reserveFactor := sdkmath.LegacyMustNewDecFromStr("0.05") oneMonthInSeconds := int64(2592000) borrower := sdk.AccAddress(crypto.AddressHash([]byte("testborrower"))) @@ -262,7 +262,7 @@ func (suite *KeeperTestSuite) TestLtvWithdraw() { suite.Run(tc.name, func() { // Initialize test app and set context tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) // Auth module genesis state authGS := app.NewFundedGenStateWithCoins( @@ -275,21 +275,21 @@ func (suite *KeeperTestSuite) TestLtvWithdraw() { harvestGS := types.NewGenesisState(types.NewParams( types.MoneyMarkets{ types.NewMoneyMarket("ukava", - types.NewBorrowLimit(false, sdk.NewDec(100000000*KAVA_CF), sdk.MustNewDecFromStr("0.8")), // Borrow Limit - "kava:usd", // Market ID - sdkmath.NewInt(KAVA_CF), // Conversion Factor - model, // Interest Rate Model - reserveFactor, // Reserve Factor - sdk.MustNewDecFromStr("0.05")), // Keeper Reward Percent + types.NewBorrowLimit(false, sdkmath.LegacyNewDec(100000000*KAVA_CF), sdkmath.LegacyMustNewDecFromStr("0.8")), // Borrow Limit + "kava:usd", // Market ID + sdkmath.NewInt(KAVA_CF), // Conversion Factor + model, // Interest Rate Model + reserveFactor, // Reserve Factor + sdkmath.LegacyMustNewDecFromStr("0.05")), // Keeper Reward Percent types.NewMoneyMarket("usdx", - types.NewBorrowLimit(false, sdk.NewDec(100000000*KAVA_CF), sdk.MustNewDecFromStr("0.8")), // Borrow Limit - "usdx:usd", // Market ID - sdkmath.NewInt(KAVA_CF), // Conversion Factor - model, // Interest Rate Model - reserveFactor, // Reserve Factor - sdk.MustNewDecFromStr("0.05")), // Keeper Reward Percent + types.NewBorrowLimit(false, sdkmath.LegacyNewDec(100000000*KAVA_CF), sdkmath.LegacyMustNewDecFromStr("0.8")), // Borrow Limit + "usdx:usd", // Market ID + sdkmath.NewInt(KAVA_CF), // Conversion Factor + model, // Interest Rate Model + reserveFactor, // Reserve Factor + sdkmath.LegacyMustNewDecFromStr("0.05")), // Keeper Reward Percent }, - sdk.NewDec(10), + sdkmath.LegacyNewDec(10), ), types.DefaultAccumulationTimes, types.DefaultDeposits, types.DefaultBorrows, types.DefaultTotalSupplied, types.DefaultTotalBorrowed, types.DefaultTotalReserves, ) @@ -306,13 +306,13 @@ func (suite *KeeperTestSuite) TestLtvWithdraw() { { MarketID: "usdx:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("1.00"), + Price: sdkmath.LegacyMustNewDecFromStr("1.00"), Expiry: time.Now().Add(100 * time.Hour), }, { MarketID: "kava:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("2.00"), + Price: sdkmath.LegacyMustNewDecFromStr("2.00"), Expiry: time.Now().Add(100 * time.Hour), }, }, @@ -348,7 +348,7 @@ func (suite *KeeperTestSuite) TestLtvWithdraw() { suite.Require().NoError(err) // Attempting to withdraw fails - err = suite.keeper.Withdraw(suite.ctx, tc.args.borrower, sdk.NewCoins(sdk.NewCoin("ukava", sdk.OneInt()))) + err = suite.keeper.Withdraw(suite.ctx, tc.args.borrower, sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.OneInt()))) suite.Require().Error(err) suite.Require().True(strings.Contains(err.Error(), tc.errArgs.contains)) @@ -358,7 +358,7 @@ func (suite *KeeperTestSuite) TestLtvWithdraw() { hard.BeginBlocker(liqCtx, suite.keeper) // Attempted withdraw of 1 coin still fails - err = suite.keeper.Withdraw(suite.ctx, tc.args.borrower, sdk.NewCoins(sdk.NewCoin("ukava", sdk.OneInt()))) + err = suite.keeper.Withdraw(suite.ctx, tc.args.borrower, sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.OneInt()))) suite.Require().Error(err) suite.Require().True(strings.Contains(err.Error(), tc.errArgs.contains)) diff --git a/x/hard/legacy/v0_15/types.go b/x/hard/legacy/v0_15/types.go index bfdfd85db8..9505c64d94 100644 --- a/x/hard/legacy/v0_15/types.go +++ b/x/hard/legacy/v0_15/types.go @@ -25,8 +25,8 @@ type GenesisState struct { // Params governance parameters for hard module type Params struct { - MoneyMarkets MoneyMarkets `json:"money_markets" yaml:"money_markets"` - MinimumBorrowUSDValue sdk.Dec `json:"minimum_borrow_usd_value" yaml:"minimum_borrow_usd_value"` + MoneyMarkets MoneyMarkets `json:"money_markets" yaml:"money_markets"` + MinimumBorrowUSDValue sdkmath.LegacyDec `json:"minimum_borrow_usd_value" yaml:"minimum_borrow_usd_value"` } // MoneyMarkets slice of MoneyMarket @@ -39,23 +39,23 @@ type MoneyMarket struct { SpotMarketID string `json:"spot_market_id" yaml:"spot_market_id"` ConversionFactor sdkmath.Int `json:"conversion_factor" yaml:"conversion_factor"` InterestRateModel InterestRateModel `json:"interest_rate_model" yaml:"interest_rate_model"` - ReserveFactor sdk.Dec `json:"reserve_factor" yaml:"reserve_factor"` - KeeperRewardPercentage sdk.Dec `json:"keeper_reward_percentage" yaml:"keeper_reward_percentages"` + ReserveFactor sdkmath.LegacyDec `json:"reserve_factor" yaml:"reserve_factor"` + KeeperRewardPercentage sdkmath.LegacyDec `json:"keeper_reward_percentage" yaml:"keeper_reward_percentages"` } // BorrowLimit enforces restrictions on a money market type BorrowLimit struct { - HasMaxLimit bool `json:"has_max_limit" yaml:"has_max_limit"` - MaximumLimit sdk.Dec `json:"maximum_limit" yaml:"maximum_limit"` - LoanToValue sdk.Dec `json:"loan_to_value" yaml:"loan_to_value"` + HasMaxLimit bool `json:"has_max_limit" yaml:"has_max_limit"` + MaximumLimit sdkmath.LegacyDec `json:"maximum_limit" yaml:"maximum_limit"` + LoanToValue sdkmath.LegacyDec `json:"loan_to_value" yaml:"loan_to_value"` } // InterestRateModel contains information about an asset's interest rate type InterestRateModel struct { - BaseRateAPY sdk.Dec `json:"base_rate_apy" yaml:"base_rate_apy"` - BaseMultiplier sdk.Dec `json:"base_multiplier" yaml:"base_multiplier"` - Kink sdk.Dec `json:"kink" yaml:"kink"` - JumpMultiplier sdk.Dec `json:"jump_multiplier" yaml:"jump_multiplier"` + BaseRateAPY sdkmath.LegacyDec `json:"base_rate_apy" yaml:"base_rate_apy"` + BaseMultiplier sdkmath.LegacyDec `json:"base_multiplier" yaml:"base_multiplier"` + Kink sdkmath.LegacyDec `json:"kink" yaml:"kink"` + JumpMultiplier sdkmath.LegacyDec `json:"jump_multiplier" yaml:"jump_multiplier"` } // GenesisAccumulationTimes slice of GenesisAccumulationTime @@ -63,10 +63,10 @@ type GenesisAccumulationTimes []GenesisAccumulationTime // GenesisAccumulationTime stores the previous distribution time and its corresponding denom type GenesisAccumulationTime struct { - CollateralType string `json:"collateral_type" yaml:"collateral_type"` - PreviousAccumulationTime time.Time `json:"previous_accumulation_time" yaml:"previous_accumulation_time"` - SupplyInterestFactor sdk.Dec `json:"supply_interest_factor" yaml:"supply_interest_factor"` - BorrowInterestFactor sdk.Dec `json:"borrow_interest_factor" yaml:"borrow_interest_factor"` + CollateralType string `json:"collateral_type" yaml:"collateral_type"` + PreviousAccumulationTime time.Time `json:"previous_accumulation_time" yaml:"previous_accumulation_time"` + SupplyInterestFactor sdkmath.LegacyDec `json:"supply_interest_factor" yaml:"supply_interest_factor"` + BorrowInterestFactor sdkmath.LegacyDec `json:"borrow_interest_factor" yaml:"borrow_interest_factor"` } // Deposits is a slice of Deposit @@ -84,8 +84,8 @@ type SupplyInterestFactors []SupplyInterestFactor // SupplyInterestFactor defines an individual borrow interest factor type SupplyInterestFactor struct { - Denom string `json:"denom" yaml:"denom"` - Value sdk.Dec `json:"value" yaml:"value"` + Denom string `json:"denom" yaml:"denom"` + Value sdkmath.LegacyDec `json:"value" yaml:"value"` } // Borrows is a slice of Borrow @@ -103,6 +103,6 @@ type BorrowInterestFactors []BorrowInterestFactor // BorrowInterestFactor defines an individual borrow interest factor type BorrowInterestFactor struct { - Denom string `json:"denom" yaml:"denom"` - Value sdk.Dec `json:"value" yaml:"value"` + Denom string `json:"denom" yaml:"denom"` + Value sdkmath.LegacyDec `json:"value" yaml:"value"` } diff --git a/x/hard/legacy/v0_16/migrate.go b/x/hard/legacy/v0_16/migrate.go index cc4fbdd7d5..3b1351e0e1 100644 --- a/x/hard/legacy/v0_16/migrate.go +++ b/x/hard/legacy/v0_16/migrate.go @@ -2,8 +2,6 @@ package v0_16 import ( sdkmath "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" - v015hard "github.com/kava-labs/kava/x/hard/legacy/v0_15" v016hard "github.com/kava-labs/kava/x/hard/types" ) @@ -39,19 +37,19 @@ func migrateParams(params v015hard.Params) v016hard.Params { Denom: UATOM_IBC_DENOM, BorrowLimit: v016hard.BorrowLimit{ HasMaxLimit: true, - MaximumLimit: sdk.NewDec(25000000000), - LoanToValue: sdk.MustNewDecFromStr("0.5"), + MaximumLimit: sdkmath.LegacyNewDec(25000000000), + LoanToValue: sdkmath.LegacyMustNewDecFromStr("0.5"), }, SpotMarketID: "atom:usd:30", ConversionFactor: sdkmath.NewInt(1000000), InterestRateModel: v016hard.InterestRateModel{ - BaseRateAPY: sdk.ZeroDec(), - BaseMultiplier: sdk.MustNewDecFromStr("0.05"), - Kink: sdk.MustNewDecFromStr("0.8"), - JumpMultiplier: sdk.NewDec(5), + BaseRateAPY: sdkmath.LegacyZeroDec(), + BaseMultiplier: sdkmath.LegacyMustNewDecFromStr("0.05"), + Kink: sdkmath.LegacyMustNewDecFromStr("0.8"), + JumpMultiplier: sdkmath.LegacyNewDec(5), }, - ReserveFactor: sdk.MustNewDecFromStr("0.025"), - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.02"), + ReserveFactor: sdkmath.LegacyMustNewDecFromStr("0.025"), + KeeperRewardPercentage: sdkmath.LegacyMustNewDecFromStr("0.02"), } moneyMarkets = append(moneyMarkets, atomMoneyMarket) diff --git a/x/hard/legacy/v0_16/migrate_test.go b/x/hard/legacy/v0_16/migrate_test.go index b15c1b6ef1..fa23918d3f 100644 --- a/x/hard/legacy/v0_16/migrate_test.go +++ b/x/hard/legacy/v0_16/migrate_test.go @@ -60,19 +60,19 @@ func (s *migrateTestSuite) TestMigrate_GenState() { Denom: "kava", BorrowLimit: v015hard.BorrowLimit{ HasMaxLimit: true, - MaximumLimit: sdk.MustNewDecFromStr("0.1"), - LoanToValue: sdk.MustNewDecFromStr("0.2"), + MaximumLimit: sdkmath.LegacyMustNewDecFromStr("0.1"), + LoanToValue: sdkmath.LegacyMustNewDecFromStr("0.2"), }, SpotMarketID: "spot-market-id", ConversionFactor: sdkmath.NewInt(110), InterestRateModel: v015hard.InterestRateModel{ - BaseRateAPY: sdk.MustNewDecFromStr("0.1"), - BaseMultiplier: sdk.MustNewDecFromStr("0.2"), - Kink: sdk.MustNewDecFromStr("0.3"), - JumpMultiplier: sdk.MustNewDecFromStr("0.4"), + BaseRateAPY: sdkmath.LegacyMustNewDecFromStr("0.1"), + BaseMultiplier: sdkmath.LegacyMustNewDecFromStr("0.2"), + Kink: sdkmath.LegacyMustNewDecFromStr("0.3"), + JumpMultiplier: sdkmath.LegacyMustNewDecFromStr("0.4"), }, - ReserveFactor: sdk.MustNewDecFromStr("0.5"), - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.6"), + ReserveFactor: sdkmath.LegacyMustNewDecFromStr("0.5"), + KeeperRewardPercentage: sdkmath.LegacyMustNewDecFromStr("0.6"), }, }, }, @@ -80,8 +80,8 @@ func (s *migrateTestSuite) TestMigrate_GenState() { { CollateralType: "kava", PreviousAccumulationTime: time.Date(1998, time.January, 1, 12, 0, 0, 1, time.UTC), - SupplyInterestFactor: sdk.MustNewDecFromStr("0.1"), - BorrowInterestFactor: sdk.MustNewDecFromStr("0.2"), + SupplyInterestFactor: sdkmath.LegacyMustNewDecFromStr("0.1"), + BorrowInterestFactor: sdkmath.LegacyMustNewDecFromStr("0.2"), }, }, Deposits: v015hard.Deposits{ @@ -91,7 +91,7 @@ func (s *migrateTestSuite) TestMigrate_GenState() { Index: v015hard.SupplyInterestFactors{ { Denom: "kava", - Value: sdk.MustNewDecFromStr("1.12"), + Value: sdkmath.LegacyMustNewDecFromStr("1.12"), }, }, }, @@ -103,7 +103,7 @@ func (s *migrateTestSuite) TestMigrate_GenState() { Index: v015hard.BorrowInterestFactors{ { Denom: "kava", - Value: sdk.MustNewDecFromStr("1.12"), + Value: sdkmath.LegacyMustNewDecFromStr("1.12"), }, }, }, @@ -119,37 +119,37 @@ func (s *migrateTestSuite) TestMigrate_GenState() { Denom: "kava", BorrowLimit: v016hard.BorrowLimit{ HasMaxLimit: true, - MaximumLimit: sdk.MustNewDecFromStr("0.1"), - LoanToValue: sdk.MustNewDecFromStr("0.2"), + MaximumLimit: sdkmath.LegacyMustNewDecFromStr("0.1"), + LoanToValue: sdkmath.LegacyMustNewDecFromStr("0.2"), }, SpotMarketID: "spot-market-id", ConversionFactor: sdkmath.NewInt(110), InterestRateModel: v016hard.InterestRateModel{ - BaseRateAPY: sdk.MustNewDecFromStr("0.1"), - BaseMultiplier: sdk.MustNewDecFromStr("0.2"), - Kink: sdk.MustNewDecFromStr("0.3"), - JumpMultiplier: sdk.MustNewDecFromStr("0.4"), + BaseRateAPY: sdkmath.LegacyMustNewDecFromStr("0.1"), + BaseMultiplier: sdkmath.LegacyMustNewDecFromStr("0.2"), + Kink: sdkmath.LegacyMustNewDecFromStr("0.3"), + JumpMultiplier: sdkmath.LegacyMustNewDecFromStr("0.4"), }, - ReserveFactor: sdk.MustNewDecFromStr("0.5"), - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.6"), + ReserveFactor: sdkmath.LegacyMustNewDecFromStr("0.5"), + KeeperRewardPercentage: sdkmath.LegacyMustNewDecFromStr("0.6"), }, { Denom: UATOM_IBC_DENOM, BorrowLimit: v016hard.BorrowLimit{ HasMaxLimit: true, - MaximumLimit: sdk.NewDec(25000000000), - LoanToValue: sdk.MustNewDecFromStr("0.5"), + MaximumLimit: sdkmath.LegacyNewDec(25000000000), + LoanToValue: sdkmath.LegacyMustNewDecFromStr("0.5"), }, SpotMarketID: "atom:usd:30", ConversionFactor: sdkmath.NewInt(1000000), InterestRateModel: v016hard.InterestRateModel{ - BaseRateAPY: sdk.ZeroDec(), - BaseMultiplier: sdk.MustNewDecFromStr("0.05"), - Kink: sdk.MustNewDecFromStr("0.8"), - JumpMultiplier: sdk.NewDec(5), + BaseRateAPY: sdkmath.LegacyZeroDec(), + BaseMultiplier: sdkmath.LegacyMustNewDecFromStr("0.05"), + Kink: sdkmath.LegacyMustNewDecFromStr("0.8"), + JumpMultiplier: sdkmath.LegacyNewDec(5), }, - ReserveFactor: sdk.MustNewDecFromStr("0.025"), - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.02"), + ReserveFactor: sdkmath.LegacyMustNewDecFromStr("0.025"), + KeeperRewardPercentage: sdkmath.LegacyMustNewDecFromStr("0.02"), }, }, }, @@ -157,8 +157,8 @@ func (s *migrateTestSuite) TestMigrate_GenState() { { CollateralType: "kava", PreviousAccumulationTime: time.Date(1998, time.January, 1, 12, 0, 0, 1, time.UTC), - SupplyInterestFactor: sdk.MustNewDecFromStr("0.1"), - BorrowInterestFactor: sdk.MustNewDecFromStr("0.2"), + SupplyInterestFactor: sdkmath.LegacyMustNewDecFromStr("0.1"), + BorrowInterestFactor: sdkmath.LegacyMustNewDecFromStr("0.2"), }, }, Deposits: v016hard.Deposits{ @@ -168,7 +168,7 @@ func (s *migrateTestSuite) TestMigrate_GenState() { Index: v016hard.SupplyInterestFactors{ { Denom: "kava", - Value: sdk.MustNewDecFromStr("1.12"), + Value: sdkmath.LegacyMustNewDecFromStr("1.12"), }, }, }, @@ -180,7 +180,7 @@ func (s *migrateTestSuite) TestMigrate_GenState() { Index: v016hard.BorrowInterestFactors{ { Denom: "kava", - Value: sdk.MustNewDecFromStr("1.12"), + Value: sdkmath.LegacyMustNewDecFromStr("1.12"), }, }, }, diff --git a/x/hard/module.go b/x/hard/module.go index 952ff860a9..a4e309d954 100644 --- a/x/hard/module.go +++ b/x/hard/module.go @@ -2,6 +2,7 @@ package hard import ( "context" + "cosmossdk.io/core/appmodule" "encoding/json" "github.com/grpc-ecosystem/grpc-gateway/runtime" @@ -21,8 +22,10 @@ import ( ) var ( - _ module.AppModule = AppModule{} + _ appmodule.AppModule = AppModule{} _ module.AppModuleBasic = AppModuleBasic{} + + _ appmodule.HasBeginBlocker = AppModule{} ) // AppModuleBasic app module basics object @@ -138,11 +141,18 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // BeginBlock module begin-block -func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { - BeginBlocker(ctx, am.keeper) +func (am AppModule) BeginBlock(ctx context.Context) error { + sdkCtx := sdk.UnwrapSDKContext(ctx) + BeginBlocker(sdkCtx, am.keeper) + + return nil } // EndBlock module end-block -func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - return []abci.ValidatorUpdate{} +func (am AppModule) EndBlock(_ sdk.Context) ([]abci.ValidatorUpdate, error) { + return []abci.ValidatorUpdate{}, nil } + +func (AppModule) IsOnePerModuleType() {} + +func (AppModule) IsAppModule() {} diff --git a/x/hard/spec/02_state.md b/x/hard/spec/02_state.md index 0bc73e70ff..01083e38e9 100644 --- a/x/hard/spec/02_state.md +++ b/x/hard/spec/02_state.md @@ -18,7 +18,7 @@ Without financial incentives, borrowers and suppliers will withdraw their funds // Params governance parameters for hard module type Params struct { MoneyMarkets MoneyMarkets `json:"money_markets" yaml:"money_markets"` - MinimumBorrowUSDValue sdk.Dec `json:"minimum_borrow_usd_value" yaml:"minimum_borrow_usd_value"` + MinimumBorrowUSDValue sdkmath.LegacyDec `json:"minimum_borrow_usd_value" yaml:"minimum_borrow_usd_value"` } // MoneyMarket is a money market for an individual asset @@ -28,8 +28,8 @@ type MoneyMarket struct { SpotMarketID string `json:"spot_market_id" yaml:"spot_market_id"` // the pricefeed market where price data is fetched ConversionFactor sdkmath.Int `json:"conversion_factor" yaml:"conversion_factor"` //the internal conversion factor for going from the smallest unit of a token to a whole unit (ie. 8 for BTC, 6 for KAVA, 18 for ETH) InterestRateModel InterestRateModel `json:"interest_rate_model" yaml:"interest_rate_model"` // the model that determines the prevailing interest rate at each block - ReserveFactor sdk.Dec `json:"reserve_factor" yaml:"reserve_factor"` // the percentage of interest that is accumulated by the protocol as reserves - KeeperRewardPercentage sdk.Dec `json:"keeper_reward_percentage" yaml:"keeper_reward_percentages"` // the percentage of a liquidation that is given to the keeper that liquidated the position + ReserveFactor sdkmath.LegacyDec `json:"reserve_factor" yaml:"reserve_factor"` // the percentage of interest that is accumulated by the protocol as reserves + KeeperRewardPercentage sdkmath.LegacyDec `json:"keeper_reward_percentage" yaml:"keeper_reward_percentages"` // the percentage of a liquidation that is given to the keeper that liquidated the position } // MoneyMarkets slice of MoneyMarket @@ -37,17 +37,17 @@ type MoneyMarkets []MoneyMarket // InterestRateModel contains information about an asset's interest rate type InterestRateModel struct { - BaseRateAPY sdk.Dec `json:"base_rate_apy" yaml:"base_rate_apy"` // the base rate of APY when borrows are zero. Ex. A value of "0.02" would signify an interest rate of 2% APY as the Y-intercept of the interest rate model for the money market. Note that internally, interest rates are stored as per-second interest. - BaseMultiplier sdk.Dec `json:"base_multiplier" yaml:"base_multiplier"` // the percentage rate at which the interest rate APY increases for each percentage increase in borrow utilization. Ex. A value of "0.01" signifies that the APY interest rate increases by 1% for each additional percentage increase in borrow utilization. - Kink sdk.Dec `json:"kink" yaml:"kink"` // the inflection point at which the BaseMultiplier no longer applies and the JumpMultiplier does apply. For example, a value of "0.8" signifies that at 80% utilization, the JumpMultiplier applies - JumpMultiplier sdk.Dec `json:"jump_multiplier" yaml:"jump_multiplier"` // same as BaseMultiplier, but only applied when utilization is above the Kink + BaseRateAPY sdkmath.LegacyDec `json:"base_rate_apy" yaml:"base_rate_apy"` // the base rate of APY when borrows are zero. Ex. A value of "0.02" would signify an interest rate of 2% APY as the Y-intercept of the interest rate model for the money market. Note that internally, interest rates are stored as per-second interest. + BaseMultiplier sdkmath.LegacyDec `json:"base_multiplier" yaml:"base_multiplier"` // the percentage rate at which the interest rate APY increases for each percentage increase in borrow utilization. Ex. A value of "0.01" signifies that the APY interest rate increases by 1% for each additional percentage increase in borrow utilization. + Kink sdkmath.LegacyDec `json:"kink" yaml:"kink"` // the inflection point at which the BaseMultiplier no longer applies and the JumpMultiplier does apply. For example, a value of "0.8" signifies that at 80% utilization, the JumpMultiplier applies + JumpMultiplier sdkmath.LegacyDec `json:"jump_multiplier" yaml:"jump_multiplier"` // same as BaseMultiplier, but only applied when utilization is above the Kink } // BorrowLimit enforces restrictions on a money market type BorrowLimit struct { HasMaxLimit bool `json:"has_max_limit" yaml:"has_max_limit"` // boolean for if the money market has a max amount that can be borrowed, irrespective of utilization. - MaximumLimit sdk.Dec `json:"maximum_limit" yaml:"maximum_limit"` // the maximum amount that can be borrowed for this money market, irrespective of utilization. Ignored if HasMaxLimit is false - LoanToValue sdk.Dec `json:"loan_to_value" yaml:"loan_to_value"` // the percentage amount of borrow power each unit of deposit accounts for. Ex. A value of "0.5" signifies that for $1 of supply of a particular asset, borrow limits will be increased by $0.5 + MaximumLimit sdkmath.LegacyDec `json:"maximum_limit" yaml:"maximum_limit"` // the maximum amount that can be borrowed for this money market, irrespective of utilization. Ignored if HasMaxLimit is false + LoanToValue sdkmath.LegacyDec `json:"loan_to_value" yaml:"loan_to_value"` // the percentage amount of borrow power each unit of deposit accounts for. Ex. A value of "0.5" signifies that for $1 of supply of a particular asset, borrow limits will be increased by $0.5 } ``` diff --git a/x/hard/spec/05_params.md b/x/hard/spec/05_params.md index 6f4ad2c520..ff5843593e 100644 --- a/x/hard/spec/05_params.md +++ b/x/hard/spec/05_params.md @@ -9,7 +9,7 @@ Example parameters for the Hard module: | Key | Type | Example | Description | | --------------------- | ------------------- | ------------- | -------------------------------------------- | | MoneyMarkets | array (MoneyMarket) | [{see below}] | Array of params for each supported market | -| MinimumBorrowUSDValue | sdk.Dec | 10.0 | Minimum amount an individual user can borrow | +| MinimumBorrowUSDValue | sdkmath.LegacyDec | 10.0 | Minimum amount an individual user can borrow | Example parameters for `MoneyMarket`: diff --git a/x/hard/types/borrow.go b/x/hard/types/borrow.go index 5c395610ea..0efa80910a 100644 --- a/x/hard/types/borrow.go +++ b/x/hard/types/borrow.go @@ -1,6 +1,7 @@ package types import ( + sdkmath "cosmossdk.io/math" "fmt" "strings" @@ -31,14 +32,14 @@ func (b Borrow) NormalizedBorrow() (sdk.DecCoins, error) { if !found { return nil, fmt.Errorf("borrowed amount '%s' missing interest factor", coin.Denom) } - if factor.LT(sdk.OneDec()) { + if factor.LT(sdkmath.LegacyOneDec()) { return nil, fmt.Errorf("interest factor '%s' < 1", coin.Denom) } normalized = normalized.Add( sdk.NewDecCoinFromDec( coin.Denom, - sdk.NewDecFromInt(coin.Amount).Quo(factor), + sdkmath.LegacyNewDecFromInt(coin.Amount).Quo(factor), ), ) } @@ -108,7 +109,7 @@ func NewBorrowResponse(borrower sdk.AccAddress, amount sdk.Coins, index BorrowIn type BorrowResponses []BorrowResponse // NewBorrowInterestFactor returns a new BorrowInterestFactor instance -func NewBorrowInterestFactor(denom string, value sdk.Dec) BorrowInterestFactor { +func NewBorrowInterestFactor(denom string, value sdkmath.LegacyDec) BorrowInterestFactor { return BorrowInterestFactor{ Denom: denom, Value: value, @@ -132,7 +133,7 @@ func (bif BorrowInterestFactor) ToResponse() BorrowInterestFactorResponse { } // NewBorrowInterestFactorResponse returns a new BorrowInterestFactorResponse instance -func NewBorrowInterestFactorResponse(denom string, value sdk.Dec) BorrowInterestFactorResponse { +func NewBorrowInterestFactorResponse(denom string, value sdkmath.LegacyDec) BorrowInterestFactorResponse { return BorrowInterestFactorResponse{ Denom: denom, Value: value.String(), @@ -143,17 +144,17 @@ func NewBorrowInterestFactorResponse(denom string, value sdk.Dec) BorrowInterest type BorrowInterestFactors []BorrowInterestFactor // GetInterestFactor returns a denom's interest factor value -func (bifs BorrowInterestFactors) GetInterestFactor(denom string) (sdk.Dec, bool) { +func (bifs BorrowInterestFactors) GetInterestFactor(denom string) (sdkmath.LegacyDec, bool) { for _, bif := range bifs { if bif.Denom == denom { return bif.Value, true } } - return sdk.ZeroDec(), false + return sdkmath.LegacyZeroDec(), false } // SetInterestFactor sets a denom's interest factor value -func (bifs BorrowInterestFactors) SetInterestFactor(denom string, factor sdk.Dec) BorrowInterestFactors { +func (bifs BorrowInterestFactors) SetInterestFactor(denom string, factor sdkmath.LegacyDec) BorrowInterestFactors { for i, bif := range bifs { if bif.Denom == denom { bif.Value = factor diff --git a/x/hard/types/borrow_test.go b/x/hard/types/borrow_test.go index 107bf1f2cf..94c28bf3ae 100644 --- a/x/hard/types/borrow_test.go +++ b/x/hard/types/borrow_test.go @@ -1,6 +1,7 @@ package types_test import ( + sdkmath "cosmossdk.io/math" "testing" sdk "github.com/cosmos/cosmos-sdk/types" @@ -26,11 +27,11 @@ func TestBorrow_NormalizedBorrow(t *testing.T) { Index: types.BorrowInterestFactors{ { Denom: "xrpb", - Value: sdk.MustNewDecFromStr("1.25"), + Value: sdkmath.LegacyMustNewDecFromStr("1.25"), }, { Denom: "bnb", - Value: sdk.MustNewDecFromStr("2.0"), + Value: sdkmath.LegacyMustNewDecFromStr("2.0"), }, }, }, @@ -64,7 +65,7 @@ func TestBorrow_NormalizedBorrow(t *testing.T) { Index: types.BorrowInterestFactors{ { Denom: "xrpb", - Value: sdk.MustNewDecFromStr("1.25"), + Value: sdkmath.LegacyMustNewDecFromStr("1.25"), }, }, }, @@ -79,7 +80,7 @@ func TestBorrow_NormalizedBorrow(t *testing.T) { Index: types.BorrowInterestFactors{ { Denom: "bnb", - Value: sdk.MustNewDecFromStr("0.999999999999999999"), + Value: sdkmath.LegacyMustNewDecFromStr("0.999999999999999999"), }, }, }, @@ -94,7 +95,7 @@ func TestBorrow_NormalizedBorrow(t *testing.T) { Index: types.BorrowInterestFactors{ { Denom: "bnb", - Value: sdk.MustNewDecFromStr("0"), + Value: sdkmath.LegacyMustNewDecFromStr("0"), }, }, }, diff --git a/x/hard/types/codec.go b/x/hard/types/codec.go index 44c19da443..8566989685 100644 --- a/x/hard/types/codec.go +++ b/x/hard/types/codec.go @@ -6,7 +6,6 @@ import ( cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" - authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec" ) func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { @@ -40,5 +39,5 @@ func init() { // Register all Amino interfaces and concrete types on the authz Amino codec so that this can later be // used to properly serialize MsgGrant and MsgExec instances - RegisterLegacyAminoCodec(authzcodec.Amino) + RegisterLegacyAminoCodec(codec.NewLegacyAmino()) } diff --git a/x/hard/types/deposit.go b/x/hard/types/deposit.go index f73c4dd57d..cafc589992 100644 --- a/x/hard/types/deposit.go +++ b/x/hard/types/deposit.go @@ -1,6 +1,7 @@ package types import ( + sdkmath "cosmossdk.io/math" "fmt" "strings" @@ -31,14 +32,14 @@ func (b Deposit) NormalizedDeposit() (sdk.DecCoins, error) { if !found { return nil, fmt.Errorf("deposited amount '%s' missing interest factor", coin.Denom) } - if factor.LT(sdk.OneDec()) { + if factor.LT(sdkmath.LegacyOneDec()) { return nil, fmt.Errorf("interest factor '%s' < 1", coin.Denom) } normalized = normalized.Add( sdk.NewDecCoinFromDec( coin.Denom, - sdk.NewDecFromInt(coin.Amount).Quo(factor), + sdkmath.LegacyNewDecFromInt(coin.Amount).Quo(factor), ), ) } @@ -108,7 +109,7 @@ func NewDepositResponse(depositor sdk.AccAddress, amount sdk.Coins, indexes Supp type DepositResponses []DepositResponse // NewSupplyInterestFactor returns a new SupplyInterestFactor instance -func NewSupplyInterestFactor(denom string, value sdk.Dec) SupplyInterestFactor { +func NewSupplyInterestFactor(denom string, value sdkmath.LegacyDec) SupplyInterestFactor { return SupplyInterestFactor{ Denom: denom, Value: value, @@ -132,7 +133,7 @@ func (sif SupplyInterestFactor) ToResponse() SupplyInterestFactorResponse { } // NewSupplyInterestFactorResponse returns a new SupplyInterestFactorResponse instance -func NewSupplyInterestFactorResponse(denom string, value sdk.Dec) SupplyInterestFactorResponse { +func NewSupplyInterestFactorResponse(denom string, value sdkmath.LegacyDec) SupplyInterestFactorResponse { return SupplyInterestFactorResponse{ Denom: denom, Value: value.String(), @@ -143,17 +144,17 @@ func NewSupplyInterestFactorResponse(denom string, value sdk.Dec) SupplyInterest type SupplyInterestFactors []SupplyInterestFactor // GetInterestFactor returns a denom's interest factor value -func (sifs SupplyInterestFactors) GetInterestFactor(denom string) (sdk.Dec, bool) { +func (sifs SupplyInterestFactors) GetInterestFactor(denom string) (sdkmath.LegacyDec, bool) { for _, sif := range sifs { if sif.Denom == denom { return sif.Value, true } } - return sdk.ZeroDec(), false + return sdkmath.LegacyZeroDec(), false } // SetInterestFactor sets a denom's interest factor value -func (sifs SupplyInterestFactors) SetInterestFactor(denom string, factor sdk.Dec) SupplyInterestFactors { +func (sifs SupplyInterestFactors) SetInterestFactor(denom string, factor sdkmath.LegacyDec) SupplyInterestFactors { for i, sif := range sifs { if sif.Denom == denom { sif.Value = factor diff --git a/x/hard/types/deposit_test.go b/x/hard/types/deposit_test.go index 7776fb4076..bc67e88dbb 100644 --- a/x/hard/types/deposit_test.go +++ b/x/hard/types/deposit_test.go @@ -1,6 +1,7 @@ package types_test import ( + sdkmath "cosmossdk.io/math" "testing" sdk "github.com/cosmos/cosmos-sdk/types" @@ -26,11 +27,11 @@ func TestDeposit_NormalizedDeposit(t *testing.T) { Index: types.SupplyInterestFactors{ { Denom: "xrpb", - Value: sdk.MustNewDecFromStr("1.25"), + Value: sdkmath.LegacyMustNewDecFromStr("1.25"), }, { Denom: "bnb", - Value: sdk.MustNewDecFromStr("2.0"), + Value: sdkmath.LegacyMustNewDecFromStr("2.0"), }, }, }, @@ -64,7 +65,7 @@ func TestDeposit_NormalizedDeposit(t *testing.T) { Index: types.SupplyInterestFactors{ { Denom: "xrpb", - Value: sdk.MustNewDecFromStr("1.25"), + Value: sdkmath.LegacyMustNewDecFromStr("1.25"), }, }, }, @@ -79,7 +80,7 @@ func TestDeposit_NormalizedDeposit(t *testing.T) { Index: types.SupplyInterestFactors{ { Denom: "bnb", - Value: sdk.MustNewDecFromStr("0.999999999999999999"), + Value: sdkmath.LegacyMustNewDecFromStr("0.999999999999999999"), }, }, }, @@ -94,7 +95,7 @@ func TestDeposit_NormalizedDeposit(t *testing.T) { Index: types.SupplyInterestFactors{ { Denom: "bnb", - Value: sdk.MustNewDecFromStr("0"), + Value: sdkmath.LegacyMustNewDecFromStr("0"), }, }, }, diff --git a/x/hard/types/expected_keepers.go b/x/hard/types/expected_keepers.go index 61d7740cdc..da66ef06d4 100644 --- a/x/hard/types/expected_keepers.go +++ b/x/hard/types/expected_keepers.go @@ -1,9 +1,9 @@ package types // noalias import ( + "context" sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" pftypes "github.com/kava-labs/kava/x/pricefeed/types" @@ -11,32 +11,32 @@ import ( // BankKeeper defines the expected bank keeper type BankKeeper interface { - SendCoinsFromModuleToModule(ctx sdk.Context, senderModule, recipientModule string, amt sdk.Coins) error - SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error - SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error - - GetSupply(ctx sdk.Context, denom string) sdk.Coin - GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin - GetAllBalances(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins - SpendableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins + SendCoinsFromModuleToModule(ctx context.Context, senderModule, recipientModule string, amt sdk.Coins) error + SendCoinsFromAccountToModule(ctx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error + SendCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error + + GetSupply(ctx context.Context, denom string) sdk.Coin + GetBalance(ctx context.Context, addr sdk.AccAddress, denom string) sdk.Coin + GetAllBalances(ctx context.Context, addr sdk.AccAddress) sdk.Coins + SpendableCoins(ctx context.Context, addr sdk.AccAddress) sdk.Coins } // AccountKeeper defines the expected keeper interface for interacting with account type AccountKeeper interface { - GetAccount(ctx sdk.Context, addr sdk.AccAddress) authtypes.AccountI - SetAccount(ctx sdk.Context, acc authtypes.AccountI) + GetAccount(ctx context.Context, addr sdk.AccAddress) sdk.AccountI + SetAccount(ctx context.Context, acc sdk.AccountI) GetModuleAddress(name string) sdk.AccAddress - GetModuleAccount(ctx sdk.Context, name string) authtypes.ModuleAccountI + GetModuleAccount(ctx context.Context, name string) sdk.ModuleAccountI } // StakingKeeper defines the expected keeper interface for the staking keeper type StakingKeeper interface { - IterateLastValidators(ctx sdk.Context, fn func(index int64, validator stakingtypes.ValidatorI) (stop bool)) - IterateValidators(sdk.Context, func(index int64, validator stakingtypes.ValidatorI) (stop bool)) - IterateAllDelegations(ctx sdk.Context, cb func(delegation stakingtypes.Delegation) (stop bool)) - GetBondedPool(ctx sdk.Context) (bondedPool authtypes.ModuleAccountI) - BondDenom(ctx sdk.Context) (res string) + IterateLastValidators(ctx context.Context, fn func(index int64, validator stakingtypes.ValidatorI) (stop bool)) + IterateValidators(context.Context, func(index int64, validator stakingtypes.ValidatorI) (stop bool)) + IterateAllDelegations(ctx context.Context, cb func(delegation stakingtypes.Delegation) (stop bool)) + GetBondedPool(ctx context.Context) (bondedPool sdk.ModuleAccountI) + BondDenom(ctx context.Context) (res string, err error) } // PricefeedKeeper defines the expected interface for the pricefeed diff --git a/x/hard/types/genesis.go b/x/hard/types/genesis.go index e138b16acc..7a24edba85 100644 --- a/x/hard/types/genesis.go +++ b/x/hard/types/genesis.go @@ -1,6 +1,7 @@ package types import ( + sdkmath "cosmossdk.io/math" "fmt" "time" @@ -65,7 +66,7 @@ func (gs GenesisState) Validate() error { } // NewGenesisAccumulationTime returns a new GenesisAccumulationTime -func NewGenesisAccumulationTime(ctype string, prevTime time.Time, supplyFactor, borrowFactor sdk.Dec) GenesisAccumulationTime { +func NewGenesisAccumulationTime(ctype string, prevTime time.Time, supplyFactor, borrowFactor sdkmath.LegacyDec) GenesisAccumulationTime { return GenesisAccumulationTime{ CollateralType: ctype, PreviousAccumulationTime: prevTime, @@ -89,10 +90,10 @@ func (gats GenesisAccumulationTimes) Validate() error { // Validate performs validation of GenesisAccumulationTime func (gat GenesisAccumulationTime) Validate() error { - if gat.SupplyInterestFactor.LT(sdk.OneDec()) { + if gat.SupplyInterestFactor.LT(sdkmath.LegacyOneDec()) { return fmt.Errorf("supply interest factor should be ≥ 1.0, is %s for %s", gat.SupplyInterestFactor, gat.CollateralType) } - if gat.BorrowInterestFactor.LT(sdk.OneDec()) { + if gat.BorrowInterestFactor.LT(sdkmath.LegacyOneDec()) { return fmt.Errorf("borrow interest factor should be ≥ 1.0, is %s for %s", gat.BorrowInterestFactor, gat.CollateralType) } return nil diff --git a/x/hard/types/genesis.pb.go b/x/hard/types/genesis.pb.go index 45dcb84db0..f92bd1fde6 100644 --- a/x/hard/types/genesis.pb.go +++ b/x/hard/types/genesis.pb.go @@ -4,6 +4,7 @@ package types import ( + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" _ "github.com/cosmos/cosmos-proto" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" @@ -125,10 +126,10 @@ func (m *GenesisState) GetTotalReserves() github_com_cosmos_cosmos_sdk_types.Coi // GenesisAccumulationTime stores the previous distribution time and its corresponding denom. type GenesisAccumulationTime struct { - CollateralType string `protobuf:"bytes,1,opt,name=collateral_type,json=collateralType,proto3" json:"collateral_type,omitempty"` - PreviousAccumulationTime time.Time `protobuf:"bytes,2,opt,name=previous_accumulation_time,json=previousAccumulationTime,proto3,stdtime" json:"previous_accumulation_time"` - SupplyInterestFactor github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=supply_interest_factor,json=supplyInterestFactor,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"supply_interest_factor"` - BorrowInterestFactor github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,4,opt,name=borrow_interest_factor,json=borrowInterestFactor,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"borrow_interest_factor"` + CollateralType string `protobuf:"bytes,1,opt,name=collateral_type,json=collateralType,proto3" json:"collateral_type,omitempty"` + PreviousAccumulationTime time.Time `protobuf:"bytes,2,opt,name=previous_accumulation_time,json=previousAccumulationTime,proto3,stdtime" json:"previous_accumulation_time"` + SupplyInterestFactor cosmossdk_io_math.LegacyDec `protobuf:"bytes,3,opt,name=supply_interest_factor,json=supplyInterestFactor,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"supply_interest_factor"` + BorrowInterestFactor cosmossdk_io_math.LegacyDec `protobuf:"bytes,4,opt,name=borrow_interest_factor,json=borrowInterestFactor,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"borrow_interest_factor"` } func (m *GenesisAccumulationTime) Reset() { *m = GenesisAccumulationTime{} } @@ -186,44 +187,45 @@ func init() { func init() { proto.RegisterFile("kava/hard/v1beta1/genesis.proto", fileDescriptor_20a1f6c2cf728e74) } var fileDescriptor_20a1f6c2cf728e74 = []byte{ - // 590 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x94, 0xcd, 0x6e, 0xd3, 0x40, - 0x10, 0xc7, 0xe3, 0xa6, 0x6d, 0xc2, 0x16, 0x5a, 0xb0, 0x2a, 0x70, 0x02, 0xb2, 0xa3, 0x1e, 0x20, - 0x42, 0x8a, 0x4d, 0xcb, 0x81, 0x0b, 0x07, 0x30, 0x11, 0x1f, 0x37, 0xe4, 0xe6, 0xc4, 0xc5, 0x5a, - 0x3b, 0x5b, 0xd7, 0xaa, 0x9d, 0xb5, 0x76, 0xd6, 0x81, 0xbc, 0x03, 0x42, 0x7d, 0x0e, 0xce, 0x3c, - 0x01, 0xa7, 0x1e, 0x2b, 0x4e, 0x88, 0x43, 0x8b, 0x92, 0x17, 0x41, 0xfb, 0x91, 0xa4, 0x28, 0x89, - 0xc4, 0x81, 0x9e, 0xe2, 0xdd, 0xfd, 0xcf, 0xff, 0x37, 0x3b, 0x3b, 0x13, 0xe4, 0x9c, 0xe0, 0x21, - 0xf6, 0x8e, 0x31, 0xeb, 0x7b, 0xc3, 0xfd, 0x88, 0x70, 0xbc, 0xef, 0x25, 0x64, 0x40, 0x20, 0x05, - 0xb7, 0x60, 0x94, 0x53, 0xf3, 0x8e, 0x10, 0xb8, 0x42, 0xe0, 0x6a, 0x41, 0xd3, 0x8e, 0x29, 0xe4, - 0x14, 0xbc, 0x08, 0x03, 0x99, 0x45, 0xc5, 0x34, 0x1d, 0xa8, 0x90, 0x66, 0x43, 0x9d, 0x87, 0x72, - 0xe5, 0xa9, 0x85, 0x3e, 0xda, 0x4d, 0x68, 0x42, 0xd5, 0xbe, 0xf8, 0xd2, 0xbb, 0x4e, 0x42, 0x69, - 0x92, 0x11, 0x4f, 0xae, 0xa2, 0xf2, 0xc8, 0xe3, 0x69, 0x4e, 0x80, 0xe3, 0xbc, 0xd0, 0x82, 0x07, - 0x8b, 0x59, 0xca, 0x8c, 0xe4, 0xe9, 0xde, 0xf7, 0x0d, 0x74, 0xf3, 0x8d, 0x4a, 0xfa, 0x90, 0x63, - 0x4e, 0xcc, 0x67, 0x68, 0xb3, 0xc0, 0x0c, 0xe7, 0x60, 0x19, 0x2d, 0xa3, 0xbd, 0x75, 0xd0, 0x70, - 0x17, 0x2e, 0xe1, 0xbe, 0x97, 0x02, 0x7f, 0xfd, 0xec, 0xc2, 0xa9, 0x04, 0x5a, 0x6e, 0x7e, 0x36, - 0xd0, 0xfd, 0x82, 0x91, 0x61, 0x4a, 0x4b, 0x08, 0x71, 0x1c, 0x97, 0x79, 0x99, 0x61, 0x9e, 0xd2, - 0x41, 0x28, 0x33, 0xb2, 0xd6, 0x5a, 0xd5, 0xf6, 0xd6, 0xc1, 0xe3, 0x25, 0x76, 0x9a, 0xff, 0xf2, - 0x4a, 0x4c, 0x2f, 0xcd, 0x89, 0xdf, 0x12, 0xfe, 0x5f, 0x2f, 0x1d, 0x6b, 0x85, 0x00, 0x82, 0xc6, - 0x14, 0xb8, 0x70, 0x64, 0xbe, 0x45, 0xf5, 0x3e, 0x29, 0x28, 0xa4, 0x1c, 0xac, 0xaa, 0x44, 0x37, - 0x97, 0xa0, 0xbb, 0x4a, 0xe2, 0xdf, 0xd6, 0xa8, 0xba, 0xde, 0x80, 0x60, 0x16, 0x6d, 0x76, 0x51, - 0x2d, 0xa2, 0x8c, 0xd1, 0x8f, 0x60, 0xad, 0x4b, 0xa3, 0x65, 0x25, 0xf1, 0xa5, 0xc2, 0xdf, 0xd1, - 0x3e, 0x35, 0xb5, 0x86, 0x60, 0x1a, 0x6a, 0x32, 0xb4, 0xcd, 0x29, 0xc7, 0x59, 0x08, 0x65, 0x51, - 0x64, 0x29, 0xe9, 0x5b, 0x1b, 0xda, 0x4c, 0x3f, 0xb2, 0xe8, 0x88, 0x99, 0xdd, 0x2b, 0x9a, 0x0e, - 0xfc, 0x27, 0xda, 0xac, 0x9d, 0xa4, 0xfc, 0xb8, 0x8c, 0xdc, 0x98, 0xe6, 0xba, 0x23, 0xf4, 0x4f, - 0x07, 0xfa, 0x27, 0x1e, 0x1f, 0x15, 0x04, 0x64, 0x00, 0x04, 0xb7, 0x24, 0xe2, 0x50, 0x13, 0xe6, - 0x4c, 0x95, 0x04, 0xe9, 0x5b, 0x9b, 0xd7, 0xc5, 0xf4, 0x35, 0x61, 0xce, 0x64, 0x04, 0x08, 0x1b, - 0x12, 0xb0, 0x6a, 0xd7, 0xc5, 0x0c, 0x34, 0x61, 0xef, 0x4b, 0x15, 0xdd, 0x5b, 0xd1, 0x23, 0xe6, - 0x23, 0xb4, 0x13, 0xd3, 0x2c, 0xc3, 0x9c, 0x30, 0x9c, 0x85, 0xc2, 0x44, 0x36, 0xf6, 0x8d, 0x60, - 0x7b, 0xbe, 0xdd, 0x1b, 0x15, 0xc4, 0x8c, 0x50, 0x73, 0x75, 0xfb, 0x5a, 0x6b, 0x72, 0x18, 0x9a, - 0xae, 0x9a, 0x36, 0x77, 0x3a, 0x6d, 0x6e, 0x6f, 0x3a, 0x6d, 0x7e, 0x5d, 0xdc, 0xe2, 0xf4, 0xd2, - 0x31, 0x02, 0x6b, 0x55, 0x57, 0x9a, 0x0c, 0xdd, 0x95, 0xcf, 0x3f, 0x0a, 0xd3, 0x01, 0x27, 0x8c, - 0x00, 0x0f, 0x8f, 0x70, 0xcc, 0x29, 0xb3, 0xaa, 0x22, 0x27, 0xff, 0xb9, 0xf0, 0xf8, 0x75, 0xe1, - 0x3c, 0xfc, 0x87, 0x4a, 0x74, 0x49, 0xfc, 0xe3, 0x5b, 0x07, 0xe9, 0xaa, 0x76, 0x49, 0x1c, 0xec, - 0x2a, 0xef, 0x77, 0xda, 0xfa, 0xb5, 0x74, 0x16, 0x4c, 0xf5, 0xfc, 0x0b, 0xcc, 0xf5, 0xff, 0xc1, - 0x54, 0xde, 0x7f, 0x33, 0xfd, 0x17, 0x67, 0x63, 0xdb, 0x38, 0x1f, 0xdb, 0xc6, 0xef, 0xb1, 0x6d, - 0x9c, 0x4e, 0xec, 0xca, 0xf9, 0xc4, 0xae, 0xfc, 0x9c, 0xd8, 0x95, 0x0f, 0x57, 0x29, 0x62, 0x8a, - 0x3a, 0x19, 0x8e, 0x40, 0x7e, 0x79, 0x9f, 0xd4, 0x9f, 0x94, 0x24, 0x45, 0x9b, 0xb2, 0xc2, 0x4f, - 0xff, 0x04, 0x00, 0x00, 0xff, 0xff, 0x16, 0xde, 0x3f, 0x0d, 0x64, 0x05, 0x00, 0x00, + // 605 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x94, 0x4f, 0x6f, 0xd3, 0x30, + 0x18, 0xc6, 0x9b, 0xb6, 0x6b, 0x8b, 0x07, 0x1b, 0x44, 0x13, 0xa4, 0x1d, 0x4a, 0xaa, 0x1d, 0xa0, + 0x42, 0x6a, 0x42, 0xc7, 0x81, 0x2b, 0x84, 0x8a, 0x3f, 0x12, 0x07, 0x94, 0xf5, 0xc4, 0x25, 0x72, + 0x12, 0x2f, 0xb5, 0x9a, 0xd4, 0x91, 0xed, 0x14, 0xfa, 0x1d, 0x38, 0xec, 0x73, 0x70, 0xe6, 0x13, + 0x70, 0xda, 0x71, 0xe2, 0x84, 0x38, 0x6c, 0xa8, 0xfd, 0x12, 0x1c, 0x51, 0x6c, 0xb7, 0x1d, 0x6a, + 0x7b, 0x41, 0xda, 0xa9, 0xb1, 0xfd, 0xbc, 0xcf, 0xef, 0xb5, 0xdf, 0xf7, 0x2d, 0xb0, 0x46, 0x70, + 0x02, 0x9d, 0x21, 0xa4, 0x91, 0x33, 0xe9, 0x05, 0x88, 0xc3, 0x9e, 0x13, 0xa3, 0x31, 0x62, 0x98, + 0xd9, 0x19, 0x25, 0x9c, 0xe8, 0xf7, 0x0a, 0x81, 0x5d, 0x08, 0x6c, 0x25, 0x68, 0x99, 0x21, 0x61, + 0x29, 0x61, 0x4e, 0x00, 0x19, 0x5a, 0x46, 0x85, 0x04, 0x8f, 0x65, 0x48, 0xab, 0x29, 0xcf, 0x7d, + 0xb1, 0x72, 0xe4, 0x42, 0x1d, 0x1d, 0xc4, 0x24, 0x26, 0x72, 0xbf, 0xf8, 0x52, 0xbb, 0x56, 0x4c, + 0x48, 0x9c, 0x20, 0x47, 0xac, 0x82, 0xfc, 0xd4, 0xe1, 0x38, 0x45, 0x8c, 0xc3, 0x34, 0x53, 0x82, + 0x87, 0xeb, 0x59, 0x8a, 0x8c, 0xc4, 0xe9, 0xd1, 0xf7, 0x1d, 0x70, 0xfb, 0x8d, 0x4c, 0xfa, 0x84, + 0x43, 0x8e, 0xf4, 0xe7, 0xa0, 0x96, 0x41, 0x0a, 0x53, 0x66, 0x68, 0x6d, 0xad, 0xb3, 0x7b, 0xdc, + 0xb4, 0xd7, 0x2e, 0x61, 0x7f, 0x10, 0x02, 0xb7, 0x7a, 0x7e, 0x69, 0x95, 0x3c, 0x25, 0xd7, 0xbf, + 0x68, 0xe0, 0x30, 0xa3, 0x68, 0x82, 0x49, 0xce, 0x7c, 0x18, 0x86, 0x79, 0x9a, 0x27, 0x90, 0x63, + 0x32, 0xf6, 0x45, 0x46, 0x46, 0xb9, 0x5d, 0xe9, 0xec, 0x1e, 0x3f, 0xd9, 0x60, 0xa7, 0xf8, 0x2f, + 0xaf, 0xc5, 0x0c, 0x70, 0x8a, 0xdc, 0x76, 0xe1, 0xff, 0xf5, 0xca, 0x32, 0xb6, 0x08, 0x98, 0xd7, + 0x5c, 0x00, 0xd7, 0x8e, 0xf4, 0xb7, 0xa0, 0x11, 0xa1, 0x8c, 0x30, 0xcc, 0x99, 0x51, 0x11, 0xe8, + 0xd6, 0x06, 0x74, 0x5f, 0x4a, 0xdc, 0xbb, 0x0a, 0xd5, 0x50, 0x1b, 0xcc, 0x5b, 0x46, 0xeb, 0x7d, + 0x50, 0x0f, 0x08, 0xa5, 0xe4, 0x13, 0x33, 0xaa, 0xc2, 0x68, 0xd3, 0x93, 0xb8, 0x42, 0xe1, 0xee, + 0x2b, 0x9f, 0xba, 0x5c, 0x33, 0x6f, 0x11, 0xaa, 0x53, 0xb0, 0xc7, 0x09, 0x87, 0x89, 0xcf, 0xf2, + 0x2c, 0x4b, 0x30, 0x8a, 0x8c, 0x1d, 0x65, 0xa6, 0x8a, 0x5c, 0x74, 0xc4, 0xd2, 0xee, 0x15, 0xc1, + 0x63, 0xf7, 0xa9, 0x32, 0xeb, 0xc4, 0x98, 0x0f, 0xf3, 0xc0, 0x0e, 0x49, 0xaa, 0x3a, 0x42, 0xfd, + 0x74, 0x59, 0x34, 0x72, 0xf8, 0x34, 0x43, 0x4c, 0x04, 0x30, 0xef, 0x8e, 0x40, 0x9c, 0x28, 0xc2, + 0x8a, 0x29, 0x93, 0x40, 0x91, 0x51, 0xbb, 0x29, 0xa6, 0xab, 0x08, 0x2b, 0x26, 0x45, 0x0c, 0xd1, + 0x09, 0x62, 0x46, 0xfd, 0xa6, 0x98, 0x9e, 0x22, 0x1c, 0xfd, 0x29, 0x83, 0x07, 0x5b, 0x7a, 0x44, + 0x7f, 0x0c, 0xf6, 0x43, 0x92, 0x24, 0x90, 0x23, 0x0a, 0x13, 0xbf, 0x30, 0x11, 0x8d, 0x7d, 0xcb, + 0xdb, 0x5b, 0x6d, 0x0f, 0xa6, 0x19, 0xd2, 0x03, 0xd0, 0xda, 0xde, 0xbe, 0x46, 0x59, 0x0c, 0x43, + 0xcb, 0x96, 0xd3, 0x66, 0x2f, 0xa6, 0xcd, 0x1e, 0x2c, 0xa6, 0xcd, 0x6d, 0x14, 0xb7, 0x38, 0xbb, + 0xb2, 0x34, 0xcf, 0xd8, 0xd6, 0x95, 0x7a, 0x0c, 0xee, 0x8b, 0xf2, 0x4f, 0x7d, 0x3c, 0xe6, 0x88, + 0x22, 0xc6, 0xfd, 0x53, 0x18, 0x72, 0x42, 0x8d, 0x4a, 0x91, 0x93, 0xdb, 0x2b, 0x3c, 0x7e, 0x5d, + 0x5a, 0x87, 0xf2, 0xde, 0x2c, 0x1a, 0xd9, 0x98, 0x38, 0x29, 0xe4, 0x43, 0xfb, 0x3d, 0x8a, 0x61, + 0x38, 0xed, 0xa3, 0xf0, 0xc7, 0xb7, 0x2e, 0x50, 0x4f, 0xd9, 0x47, 0xa1, 0x77, 0x20, 0x0d, 0xdf, + 0x29, 0xbf, 0xd7, 0xc2, 0xae, 0x00, 0xc9, 0x9a, 0xaf, 0x81, 0xaa, 0xff, 0x0d, 0x92, 0x86, 0xff, + 0x82, 0xdc, 0x17, 0xe7, 0x33, 0x53, 0xbb, 0x98, 0x99, 0xda, 0xef, 0x99, 0xa9, 0x9d, 0xcd, 0xcd, + 0xd2, 0xc5, 0xdc, 0x2c, 0xfd, 0x9c, 0x9b, 0xa5, 0x8f, 0x8f, 0xae, 0x55, 0xb3, 0x98, 0x97, 0x6e, + 0x02, 0x03, 0x26, 0xbe, 0x9c, 0xcf, 0xf2, 0xef, 0x48, 0x54, 0x34, 0xa8, 0x89, 0xb7, 0x7c, 0xf6, + 0x37, 0x00, 0x00, 0xff, 0xff, 0x13, 0x02, 0x0a, 0x3a, 0x4e, 0x05, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { diff --git a/x/hard/types/genesis_test.go b/x/hard/types/genesis_test.go index 2769040cb0..fc14fd264e 100644 --- a/x/hard/types/genesis_test.go +++ b/x/hard/types/genesis_test.go @@ -60,12 +60,12 @@ func (suite *GenesisTestSuite) TestGenesisValidation() { args: args{ params: types.NewParams( types.MoneyMarkets{ - types.NewMoneyMarket("usdx", types.NewBorrowLimit(true, sdk.MustNewDecFromStr("100000000000"), sdk.MustNewDecFromStr("1")), "usdx:usd", sdkmath.NewInt(USDX_CF), types.NewInterestRateModel(sdk.MustNewDecFromStr("0.05"), sdk.MustNewDecFromStr("2"), sdk.MustNewDecFromStr("0.8"), sdk.MustNewDecFromStr("10")), sdk.MustNewDecFromStr("0.05"), sdk.ZeroDec()), + types.NewMoneyMarket("usdx", types.NewBorrowLimit(true, sdkmath.LegacyMustNewDecFromStr("100000000000"), sdkmath.LegacyMustNewDecFromStr("1")), "usdx:usd", sdkmath.NewInt(USDX_CF), types.NewInterestRateModel(sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyMustNewDecFromStr("2"), sdkmath.LegacyMustNewDecFromStr("0.8"), sdkmath.LegacyMustNewDecFromStr("10")), sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyZeroDec()), }, - sdk.MustNewDecFromStr("10"), + sdkmath.LegacyMustNewDecFromStr("10"), ), gats: types.GenesisAccumulationTimes{ - types.NewGenesisAccumulationTime("usdx", time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), sdk.OneDec(), sdk.OneDec()), + types.NewGenesisAccumulationTime("usdx", time.Date(2020, 12, 15, 14, 0, 0, 0, time.UTC), sdkmath.LegacyOneDec(), sdkmath.LegacyOneDec()), }, deps: types.DefaultDeposits, brws: types.DefaultBorrows, diff --git a/x/hard/types/hard.pb.go b/x/hard/types/hard.pb.go index e7de080bdc..39a21a6f85 100644 --- a/x/hard/types/hard.pb.go +++ b/x/hard/types/hard.pb.go @@ -4,6 +4,7 @@ package types import ( + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" _ "github.com/cosmos/cosmos-proto" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" @@ -28,8 +29,8 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // Params defines the parameters for the hard module. type Params struct { - MoneyMarkets MoneyMarkets `protobuf:"bytes,1,rep,name=money_markets,json=moneyMarkets,proto3,castrepeated=MoneyMarkets" json:"money_markets"` - MinimumBorrowUSDValue github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=minimum_borrow_usd_value,json=minimumBorrowUsdValue,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"minimum_borrow_usd_value"` + MoneyMarkets MoneyMarkets `protobuf:"bytes,1,rep,name=money_markets,json=moneyMarkets,proto3,castrepeated=MoneyMarkets" json:"money_markets"` + MinimumBorrowUSDValue cosmossdk_io_math.LegacyDec `protobuf:"bytes,2,opt,name=minimum_borrow_usd_value,json=minimumBorrowUsdValue,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"minimum_borrow_usd_value"` } func (m *Params) Reset() { *m = Params{} } @@ -67,13 +68,13 @@ var xxx_messageInfo_Params proto.InternalMessageInfo // MoneyMarket is a money market for an individual asset. type MoneyMarket struct { - Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` - BorrowLimit BorrowLimit `protobuf:"bytes,2,opt,name=borrow_limit,json=borrowLimit,proto3" json:"borrow_limit"` - SpotMarketID string `protobuf:"bytes,3,opt,name=spot_market_id,json=spotMarketId,proto3" json:"spot_market_id,omitempty"` - ConversionFactor github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,4,opt,name=conversion_factor,json=conversionFactor,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"conversion_factor"` - InterestRateModel InterestRateModel `protobuf:"bytes,5,opt,name=interest_rate_model,json=interestRateModel,proto3" json:"interest_rate_model"` - ReserveFactor github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,6,opt,name=reserve_factor,json=reserveFactor,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"reserve_factor"` - KeeperRewardPercentage github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,7,opt,name=keeper_reward_percentage,json=keeperRewardPercentage,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"keeper_reward_percentage"` + Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` + BorrowLimit BorrowLimit `protobuf:"bytes,2,opt,name=borrow_limit,json=borrowLimit,proto3" json:"borrow_limit"` + SpotMarketID string `protobuf:"bytes,3,opt,name=spot_market_id,json=spotMarketId,proto3" json:"spot_market_id,omitempty"` + ConversionFactor cosmossdk_io_math.Int `protobuf:"bytes,4,opt,name=conversion_factor,json=conversionFactor,proto3,customtype=cosmossdk.io/math.Int" json:"conversion_factor"` + InterestRateModel InterestRateModel `protobuf:"bytes,5,opt,name=interest_rate_model,json=interestRateModel,proto3" json:"interest_rate_model"` + ReserveFactor cosmossdk_io_math.LegacyDec `protobuf:"bytes,6,opt,name=reserve_factor,json=reserveFactor,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"reserve_factor"` + KeeperRewardPercentage cosmossdk_io_math.LegacyDec `protobuf:"bytes,7,opt,name=keeper_reward_percentage,json=keeperRewardPercentage,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"keeper_reward_percentage"` } func (m *MoneyMarket) Reset() { *m = MoneyMarket{} } @@ -111,9 +112,9 @@ var xxx_messageInfo_MoneyMarket proto.InternalMessageInfo // BorrowLimit enforces restrictions on a money market. type BorrowLimit struct { - HasMaxLimit bool `protobuf:"varint,1,opt,name=has_max_limit,json=hasMaxLimit,proto3" json:"has_max_limit"` - MaximumLimit github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=maximum_limit,json=maximumLimit,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"maximum_limit"` - LoanToValue github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=loan_to_value,json=loanToValue,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"loan_to_value"` + HasMaxLimit bool `protobuf:"varint,1,opt,name=has_max_limit,json=hasMaxLimit,proto3" json:"has_max_limit"` + MaximumLimit cosmossdk_io_math.LegacyDec `protobuf:"bytes,2,opt,name=maximum_limit,json=maximumLimit,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"maximum_limit"` + LoanToValue cosmossdk_io_math.LegacyDec `protobuf:"bytes,3,opt,name=loan_to_value,json=loanToValue,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"loan_to_value"` } func (m *BorrowLimit) Reset() { *m = BorrowLimit{} } @@ -151,10 +152,10 @@ var xxx_messageInfo_BorrowLimit proto.InternalMessageInfo // InterestRateModel contains information about an asset's interest rate. type InterestRateModel struct { - BaseRateAPY github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,1,opt,name=base_rate_apy,json=baseRateApy,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"base_rate_apy"` - BaseMultiplier github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=base_multiplier,json=baseMultiplier,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"base_multiplier"` - Kink github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=kink,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"kink"` - JumpMultiplier github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,4,opt,name=jump_multiplier,json=jumpMultiplier,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"jump_multiplier"` + BaseRateAPY cosmossdk_io_math.LegacyDec `protobuf:"bytes,1,opt,name=base_rate_apy,json=baseRateApy,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"base_rate_apy"` + BaseMultiplier cosmossdk_io_math.LegacyDec `protobuf:"bytes,2,opt,name=base_multiplier,json=baseMultiplier,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"base_multiplier"` + Kink cosmossdk_io_math.LegacyDec `protobuf:"bytes,3,opt,name=kink,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"kink"` + JumpMultiplier cosmossdk_io_math.LegacyDec `protobuf:"bytes,4,opt,name=jump_multiplier,json=jumpMultiplier,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"jump_multiplier"` } func (m *InterestRateModel) Reset() { *m = InterestRateModel{} } @@ -272,8 +273,8 @@ var xxx_messageInfo_Borrow proto.InternalMessageInfo // SupplyInterestFactor defines an individual borrow interest factor. type SupplyInterestFactor struct { - Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` - Value github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=value,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"value"` + Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` + Value cosmossdk_io_math.LegacyDec `protobuf:"bytes,2,opt,name=value,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"value"` } func (m *SupplyInterestFactor) Reset() { *m = SupplyInterestFactor{} } @@ -311,8 +312,8 @@ var xxx_messageInfo_SupplyInterestFactor proto.InternalMessageInfo // BorrowInterestFactor defines an individual borrow interest factor. type BorrowInterestFactor struct { - Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` - Value github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=value,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"value"` + Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` + Value cosmossdk_io_math.LegacyDec `protobuf:"bytes,2,opt,name=value,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"value"` } func (m *BorrowInterestFactor) Reset() { *m = BorrowInterestFactor{} } @@ -401,64 +402,65 @@ func init() { func init() { proto.RegisterFile("kava/hard/v1beta1/hard.proto", fileDescriptor_23a5de800263a2ff) } var fileDescriptor_23a5de800263a2ff = []byte{ - // 911 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x56, 0xbd, 0x8f, 0x1b, 0x45, - 0x14, 0xf7, 0x9e, 0x3f, 0x92, 0x8c, 0xed, 0x23, 0xde, 0xdc, 0xa1, 0x4d, 0x04, 0xeb, 0xc8, 0x42, - 0x70, 0x8d, 0x6d, 0x02, 0x82, 0x8a, 0xe6, 0x16, 0x0b, 0x38, 0x81, 0x25, 0x6b, 0x8f, 0x20, 0x25, - 0x42, 0x5a, 0xc6, 0xbb, 0x2f, 0x77, 0x83, 0x3d, 0x3b, 0xab, 0x99, 0xb1, 0x63, 0x77, 0xb4, 0x34, - 0x88, 0x3f, 0x82, 0x8a, 0x0e, 0xe9, 0xfe, 0x88, 0x2b, 0xa3, 0x54, 0x88, 0xc2, 0x80, 0xaf, 0xa3, - 0xa6, 0xa2, 0x42, 0xf3, 0xe1, 0x8f, 0x5c, 0x1c, 0x29, 0xa7, 0x58, 0x88, 0x6a, 0x77, 0xe6, 0xbd, - 0xf9, 0xbd, 0xdf, 0xfb, 0xcd, 0x9b, 0x99, 0x87, 0xde, 0x18, 0xe0, 0x31, 0x6e, 0x9f, 0x62, 0x9e, - 0xb4, 0xc7, 0xf7, 0xfa, 0x20, 0xf1, 0x3d, 0x3d, 0x68, 0x65, 0x9c, 0x49, 0xe6, 0xd6, 0x94, 0xb5, - 0xa5, 0x27, 0xac, 0xf5, 0x8e, 0x1f, 0x33, 0x41, 0x99, 0x68, 0xf7, 0xb1, 0x80, 0xe5, 0x92, 0x98, - 0x91, 0xd4, 0x2c, 0xb9, 0x73, 0xdb, 0xd8, 0x23, 0x3d, 0x6a, 0x9b, 0x81, 0x35, 0xed, 0x9d, 0xb0, - 0x13, 0x66, 0xe6, 0xd5, 0x9f, 0x99, 0x6d, 0xfc, 0xed, 0xa0, 0x52, 0x0f, 0x73, 0x4c, 0x85, 0xfb, - 0x00, 0x55, 0x29, 0x4b, 0x61, 0x1a, 0x51, 0xcc, 0x07, 0x20, 0x85, 0xe7, 0xdc, 0xcd, 0x1f, 0x94, - 0xdf, 0xf3, 0x5b, 0xcf, 0xd1, 0x68, 0x75, 0x95, 0x5f, 0x57, 0xbb, 0x05, 0x7b, 0xe7, 0xb3, 0x7a, - 0xee, 0xe7, 0xdf, 0xeb, 0x95, 0xb5, 0x49, 0x11, 0x56, 0xe8, 0xda, 0xc8, 0xfd, 0xc1, 0x41, 0x1e, - 0x25, 0x29, 0xa1, 0x23, 0x1a, 0xf5, 0x19, 0xe7, 0xec, 0x71, 0x34, 0x12, 0x49, 0x34, 0xc6, 0xc3, - 0x11, 0x78, 0x3b, 0x77, 0x9d, 0x83, 0x1b, 0xc1, 0x7d, 0x05, 0xf3, 0xdb, 0xac, 0xfe, 0xf6, 0x09, - 0x91, 0xa7, 0xa3, 0x7e, 0x2b, 0x66, 0xd4, 0xf2, 0xb7, 0x9f, 0xa6, 0x48, 0x06, 0x6d, 0x39, 0xcd, - 0x40, 0xb4, 0x3a, 0x10, 0xcf, 0x67, 0xf5, 0xfd, 0xae, 0x41, 0x0c, 0x34, 0xe0, 0xfd, 0xe3, 0xce, - 0x57, 0x0a, 0xee, 0xe9, 0x59, 0x13, 0xd9, 0xbc, 0x3b, 0x10, 0x87, 0xfb, 0xf4, 0x19, 0x27, 0x91, - 0x68, 0xa7, 0xc6, 0x79, 0x01, 0x95, 0xd7, 0xf8, 0xba, 0x7b, 0xa8, 0x98, 0x40, 0xca, 0xa8, 0xe7, - 0x28, 0x32, 0xa1, 0x19, 0xb8, 0x9f, 0xa2, 0x8a, 0x65, 0x3b, 0x24, 0x94, 0x48, 0xcd, 0x74, 0xb3, - 0x20, 0x06, 0xfe, 0x0b, 0xe5, 0x15, 0x14, 0x54, 0x26, 0x61, 0xb9, 0xbf, 0x9a, 0x72, 0x3f, 0x44, - 0xbb, 0x22, 0x63, 0xd2, 0x2a, 0x1b, 0x91, 0xc4, 0xcb, 0xeb, 0xa4, 0x6f, 0xce, 0x67, 0xf5, 0xca, - 0x71, 0xc6, 0xa4, 0xa1, 0x71, 0xd4, 0x09, 0x2b, 0x62, 0x35, 0x4a, 0x5c, 0x82, 0x6a, 0x31, 0x4b, - 0xc7, 0xc0, 0x05, 0x61, 0x69, 0xf4, 0x08, 0xc7, 0x92, 0x71, 0xaf, 0xa0, 0x97, 0x7e, 0x74, 0x05, - 0xbd, 0x8e, 0x52, 0xb9, 0x26, 0xcb, 0x51, 0x2a, 0xc3, 0x9b, 0x2b, 0xd8, 0x4f, 0x34, 0xaa, 0xfb, - 0x10, 0xdd, 0x22, 0xa9, 0x04, 0x0e, 0x42, 0x46, 0x1c, 0x4b, 0x88, 0x28, 0x4b, 0x60, 0xe8, 0x15, - 0x75, 0xca, 0x6f, 0x6d, 0x48, 0xf9, 0xc8, 0x7a, 0x87, 0x58, 0x42, 0x57, 0xf9, 0xda, 0xc4, 0x6b, - 0xe4, 0xb2, 0xc1, 0x8d, 0xd1, 0x2e, 0x07, 0x01, 0x7c, 0x0c, 0x8b, 0x1c, 0x4a, 0x57, 0xce, 0xa1, - 0x03, 0xf1, 0xa5, 0xad, 0xad, 0x5a, 0x4c, 0x9b, 0xc0, 0x18, 0x79, 0x03, 0x80, 0x0c, 0x78, 0xc4, - 0xe1, 0x31, 0xe6, 0x49, 0x94, 0x01, 0x8f, 0x21, 0x95, 0xf8, 0x04, 0xbc, 0x6b, 0x5b, 0x08, 0xf7, - 0xba, 0x41, 0x0f, 0x35, 0x78, 0x6f, 0x89, 0xdd, 0xf8, 0x7e, 0x07, 0x95, 0xd7, 0xb6, 0xdf, 0xfd, - 0x00, 0x55, 0x4f, 0xb1, 0x88, 0x28, 0x9e, 0xd8, 0xaa, 0x51, 0x25, 0x75, 0x3d, 0xa8, 0xfd, 0x35, - 0xab, 0x3f, 0x6b, 0x08, 0xcb, 0xa7, 0x58, 0x74, 0xf1, 0xc4, 0x2c, 0xc3, 0xa8, 0x4a, 0xf1, 0x44, - 0x9f, 0x90, 0x55, 0xb1, 0xbd, 0x2a, 0xe7, 0x8a, 0x85, 0x34, 0x21, 0xbe, 0x41, 0xd5, 0x21, 0xc3, - 0x69, 0x24, 0x99, 0x3d, 0x79, 0xf9, 0x2d, 0x84, 0x28, 0x2b, 0xc8, 0x2f, 0x99, 0x39, 0x56, 0x3f, - 0xe5, 0x51, 0xed, 0xb9, 0xba, 0x70, 0x19, 0xaa, 0xaa, 0xfb, 0xca, 0x94, 0x15, 0xce, 0xa6, 0xe6, - 0x90, 0x05, 0x9f, 0x5f, 0xf9, 0xc4, 0x97, 0x03, 0x2c, 0x40, 0xe1, 0x1e, 0xf6, 0x1e, 0x5c, 0xa6, - 0xd1, 0x5f, 0x98, 0xb2, 0xa9, 0x0b, 0xe8, 0x35, 0x1d, 0x90, 0x8e, 0x86, 0x92, 0x64, 0x43, 0x02, - 0x7c, 0x2b, 0x6a, 0xee, 0x2a, 0xd0, 0xee, 0x12, 0xd3, 0xed, 0xa1, 0xc2, 0x80, 0xa4, 0x83, 0xad, - 0xc8, 0xa8, 0x91, 0x14, 0xf1, 0x6f, 0x47, 0x34, 0x5b, 0x27, 0x5e, 0xd8, 0x06, 0x71, 0x05, 0xba, - 0x22, 0xde, 0x38, 0xdb, 0x41, 0xd7, 0x3a, 0x90, 0x31, 0x41, 0xa4, 0xfb, 0x08, 0xdd, 0x48, 0xcc, - 0x2f, 0xe3, 0x76, 0x63, 0x3e, 0xfb, 0x67, 0x56, 0x6f, 0xbe, 0x44, 0xa0, 0xc3, 0x38, 0x3e, 0x4c, - 0x12, 0x0e, 0x42, 0x3c, 0x3d, 0x6b, 0xde, 0xb2, 0xf1, 0xec, 0x4c, 0x30, 0x95, 0x20, 0xc2, 0x15, - 0xb4, 0x1b, 0xa3, 0x12, 0xa6, 0x6c, 0x94, 0xaa, 0xc2, 0x56, 0xcf, 0xca, 0xed, 0x96, 0x5d, 0xa0, - 0x44, 0x5d, 0x5e, 0x2a, 0x1f, 0x33, 0x92, 0x06, 0xef, 0xda, 0x17, 0xe5, 0xe0, 0x25, 0x38, 0xa8, - 0x05, 0x22, 0xb4, 0xd0, 0xee, 0xd7, 0xa8, 0x48, 0xd2, 0x04, 0x26, 0x5e, 0x5e, 0xc7, 0x78, 0x67, - 0xc3, 0xb5, 0x75, 0x3c, 0xca, 0xb2, 0xe1, 0x74, 0x51, 0xa4, 0xe6, 0xee, 0x08, 0xde, 0xb4, 0x11, - 0xf7, 0x37, 0x59, 0x45, 0x68, 0x40, 0x1b, 0xbf, 0xec, 0xa0, 0x92, 0x39, 0xe9, 0x6e, 0x82, 0xae, - 0x9b, 0xfb, 0x1d, 0xb6, 0x2f, 0xda, 0x12, 0xf9, 0x7f, 0xa3, 0x99, 0x49, 0xfa, 0x45, 0x9a, 0x6d, - 0xb2, 0x2e, 0x35, 0xfb, 0xce, 0x41, 0x7b, 0x9b, 0x44, 0x7d, 0xc1, 0x8b, 0x1b, 0xa2, 0xe2, 0x7a, - 0x53, 0xf0, 0x6a, 0x65, 0x6f, 0xa0, 0x34, 0x85, 0x4d, 0x1c, 0xff, 0x43, 0x0a, 0x0c, 0x21, 0x2d, - 0x7a, 0x4f, 0xf7, 0x75, 0x18, 0x15, 0x55, 0xcb, 0xb6, 0x68, 0xb0, 0xb6, 0xba, 0xab, 0x06, 0x39, - 0xe8, 0x9c, 0xff, 0xe9, 0xe7, 0xce, 0xe7, 0xbe, 0xf3, 0x64, 0xee, 0x3b, 0x7f, 0xcc, 0x7d, 0xe7, - 0xc7, 0x0b, 0x3f, 0xf7, 0xe4, 0xc2, 0xcf, 0xfd, 0x7a, 0xe1, 0xe7, 0x1e, 0xae, 0xe7, 0xa2, 0x76, - 0xbb, 0x39, 0xc4, 0x7d, 0xa1, 0xff, 0xda, 0x13, 0xd3, 0x8d, 0x6a, 0xc8, 0x7e, 0x49, 0xf7, 0x88, - 0xef, 0xff, 0x1b, 0x00, 0x00, 0xff, 0xff, 0x40, 0xda, 0xa7, 0xd8, 0xa7, 0x0a, 0x00, 0x00, + // 927 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x56, 0x4f, 0x6f, 0x1b, 0x45, + 0x14, 0xb7, 0x13, 0xdb, 0x6d, 0xc7, 0x76, 0xa8, 0xa7, 0x09, 0xda, 0x16, 0x58, 0x57, 0x16, 0x82, + 0x48, 0xc8, 0x6b, 0x02, 0x82, 0x33, 0x59, 0xcc, 0x9f, 0xa0, 0x5a, 0x8a, 0x36, 0xb4, 0x6a, 0x23, + 0xa4, 0xd5, 0x78, 0x77, 0x6a, 0x0f, 0xf6, 0xec, 0xac, 0x66, 0x66, 0x5d, 0xfb, 0xcc, 0x17, 0xe0, + 0x2b, 0x70, 0xe5, 0x86, 0x94, 0x0f, 0x91, 0x63, 0xd5, 0x13, 0xe2, 0x60, 0xc0, 0x39, 0xc1, 0x95, + 0x0b, 0xe2, 0x84, 0xe6, 0x4f, 0x6c, 0x37, 0x71, 0xa5, 0xc8, 0x0a, 0x12, 0x27, 0xef, 0xcc, 0x7b, + 0xef, 0xf7, 0x7e, 0xf3, 0x9b, 0xf7, 0x9e, 0x07, 0xbc, 0x39, 0x40, 0x23, 0xd4, 0xea, 0x23, 0x1e, + 0xb7, 0x46, 0x7b, 0x5d, 0x2c, 0xd1, 0x9e, 0x5e, 0x78, 0x29, 0x67, 0x92, 0xc1, 0x9a, 0xb2, 0x7a, + 0x7a, 0xc3, 0x5a, 0xef, 0xb9, 0x11, 0x13, 0x94, 0x89, 0x56, 0x17, 0x09, 0x3c, 0x0f, 0x89, 0x18, + 0x49, 0x4c, 0xc8, 0xbd, 0xbb, 0xc6, 0x1e, 0xea, 0x55, 0xcb, 0x2c, 0xac, 0x69, 0xbb, 0xc7, 0x7a, + 0xcc, 0xec, 0xab, 0x2f, 0xb3, 0xdb, 0xf8, 0x23, 0x0f, 0x4a, 0x87, 0x88, 0x23, 0x2a, 0xe0, 0x13, + 0x50, 0xa5, 0x2c, 0xc1, 0x93, 0x90, 0x22, 0x3e, 0xc0, 0x52, 0x38, 0xf9, 0xfb, 0x9b, 0xbb, 0xe5, + 0x0f, 0x5c, 0xef, 0x12, 0x0d, 0xaf, 0xa3, 0xfc, 0x3a, 0xda, 0xcd, 0xdf, 0x3e, 0x9d, 0xd6, 0x73, + 0x3f, 0xfe, 0x5a, 0xaf, 0x2c, 0x6d, 0x8a, 0xa0, 0x42, 0x97, 0x56, 0xf0, 0xbb, 0x3c, 0x70, 0x28, + 0x49, 0x08, 0xcd, 0x68, 0xd8, 0x65, 0x9c, 0xb3, 0x67, 0x61, 0x26, 0xe2, 0x70, 0x84, 0x86, 0x19, + 0x76, 0x36, 0xee, 0xe7, 0x77, 0x6f, 0xf9, 0x5f, 0x29, 0x98, 0x5f, 0xa6, 0xf5, 0x37, 0x0c, 0x69, + 0x11, 0x0f, 0x3c, 0xc2, 0x5a, 0x14, 0xc9, 0xbe, 0xf7, 0x00, 0xf7, 0x50, 0x34, 0x69, 0xe3, 0x68, + 0x36, 0xad, 0xef, 0x74, 0x0c, 0x8c, 0xaf, 0x51, 0x1e, 0x1e, 0xb5, 0x1f, 0x29, 0x8c, 0x17, 0x27, + 0x4d, 0x60, 0x0f, 0xdb, 0xc6, 0x51, 0xb0, 0x43, 0x5f, 0x72, 0x12, 0xb1, 0x76, 0x6a, 0xfc, 0x50, + 0x00, 0xe5, 0x25, 0x92, 0x70, 0x1b, 0x14, 0x63, 0x9c, 0x30, 0xea, 0xe4, 0x15, 0x83, 0xc0, 0x2c, + 0xe0, 0x17, 0xa0, 0x62, 0x29, 0x0e, 0x09, 0x25, 0x52, 0xd3, 0x5b, 0xad, 0x82, 0x81, 0x7f, 0xa0, + 0xbc, 0xfc, 0x82, 0xa2, 0x1f, 0x94, 0xbb, 0x8b, 0x2d, 0xf8, 0x31, 0xd8, 0x12, 0x29, 0x93, 0x56, + 0xce, 0x90, 0xc4, 0xce, 0xa6, 0x3e, 0xe9, 0xed, 0xd9, 0xb4, 0x5e, 0x39, 0x4a, 0x99, 0x34, 0x34, + 0x0e, 0xda, 0x41, 0x45, 0x2c, 0x56, 0x31, 0x7c, 0x0c, 0x6a, 0x11, 0x4b, 0x46, 0x98, 0x0b, 0xc2, + 0x92, 0xf0, 0x29, 0x8a, 0x24, 0xe3, 0x4e, 0x41, 0x87, 0xbe, 0x67, 0x45, 0xda, 0xb9, 0x2c, 0xd2, + 0x41, 0x22, 0x97, 0x54, 0x38, 0x48, 0x64, 0x70, 0x7b, 0x81, 0xf2, 0xb9, 0x06, 0x81, 0xc7, 0xe0, + 0x0e, 0x49, 0x24, 0xe6, 0x58, 0xc8, 0x90, 0x23, 0x89, 0x43, 0xca, 0x62, 0x3c, 0x74, 0x8a, 0xfa, + 0x84, 0x6f, 0xaf, 0x38, 0xe1, 0x81, 0xf5, 0x0e, 0x90, 0xc4, 0x1d, 0xe5, 0x6b, 0xcf, 0x59, 0x23, + 0x17, 0x0d, 0xf0, 0x31, 0xd8, 0xe2, 0x58, 0x60, 0x3e, 0xc2, 0xe7, 0x94, 0x4b, 0x9a, 0xf2, 0xde, + 0x15, 0xee, 0xf5, 0xc2, 0xf5, 0x55, 0x2d, 0x90, 0x65, 0x3d, 0x00, 0xce, 0x00, 0xe3, 0x14, 0xf3, + 0x90, 0xe3, 0x67, 0x88, 0xc7, 0x61, 0x8a, 0x79, 0x84, 0x13, 0x89, 0x7a, 0xd8, 0xb9, 0xb1, 0x6e, + 0x8e, 0xd7, 0x0d, 0x64, 0xa0, 0x11, 0x0f, 0xe7, 0x80, 0x8d, 0xbf, 0xf2, 0xa0, 0xbc, 0x74, 0xaf, + 0xf0, 0x23, 0x50, 0xed, 0x23, 0x11, 0x52, 0x34, 0xb6, 0xe5, 0xa0, 0x6a, 0xe5, 0xa6, 0x5f, 0xfb, + 0x73, 0x5a, 0x7f, 0xd9, 0x10, 0x94, 0xfb, 0x48, 0x74, 0xd0, 0xd8, 0x84, 0x3d, 0x02, 0x55, 0x8a, + 0xc6, 0xba, 0xde, 0x17, 0x55, 0xb4, 0x16, 0xd1, 0x8a, 0xc5, 0x31, 0xb8, 0x0f, 0x41, 0x75, 0xc8, + 0x50, 0x12, 0x4a, 0x66, 0x9b, 0x67, 0x73, 0x5d, 0xdc, 0xb2, 0xc2, 0xf9, 0x9a, 0x99, 0xce, 0xf8, + 0x7b, 0x03, 0xd4, 0x2e, 0xdd, 0x35, 0x8c, 0x41, 0x55, 0xcd, 0x19, 0x53, 0x2a, 0x28, 0x9d, 0x98, + 0x3e, 0xf1, 0x3f, 0xb9, 0x5a, 0xa7, 0x96, 0x7d, 0x24, 0xb0, 0x02, 0xdb, 0x3f, 0x7c, 0x72, 0x31, + 0x77, 0xf7, 0xdc, 0x94, 0x4e, 0xe0, 0x31, 0x78, 0x4d, 0x67, 0xa1, 0xd9, 0x50, 0x92, 0x74, 0x48, + 0x30, 0x5f, 0x5f, 0xac, 0x2d, 0x85, 0xd4, 0x99, 0x03, 0xc1, 0xcf, 0x40, 0x61, 0x40, 0x92, 0xc1, + 0xfa, 0x2a, 0xe9, 0x70, 0x45, 0xf1, 0xdb, 0x8c, 0xa6, 0xcb, 0x14, 0x0b, 0x6b, 0x53, 0x54, 0x48, + 0x0b, 0x8a, 0x8d, 0x93, 0x0d, 0x70, 0xa3, 0x8d, 0x53, 0x26, 0x88, 0x84, 0x4f, 0xc1, 0xad, 0xd8, + 0x7c, 0x32, 0x6e, 0xc5, 0xfe, 0xf2, 0x9f, 0x69, 0xbd, 0xd9, 0x23, 0xb2, 0x9f, 0x75, 0xbd, 0x88, + 0x51, 0x3b, 0xd2, 0xed, 0x4f, 0x53, 0xc4, 0x83, 0x96, 0x9c, 0xa4, 0x58, 0x78, 0xfb, 0x51, 0xb4, + 0x1f, 0xc7, 0x1c, 0x0b, 0xf1, 0xe2, 0xa4, 0x79, 0xc7, 0xe6, 0xb3, 0x3b, 0xfe, 0x44, 0x62, 0x11, + 0x2c, 0xa0, 0x61, 0x04, 0x4a, 0x88, 0xb2, 0x2c, 0x51, 0x65, 0xa9, 0x46, 0xfc, 0x5d, 0xcf, 0x06, + 0x28, 0xf9, 0xe6, 0xcd, 0xff, 0x29, 0x23, 0x89, 0xff, 0xbe, 0x9d, 0xee, 0xbb, 0x57, 0xe0, 0xa0, + 0x02, 0x44, 0x60, 0xa1, 0xe1, 0x37, 0xa0, 0x48, 0x92, 0x18, 0x8f, 0x9d, 0x4d, 0x9d, 0xe3, 0xdd, + 0x15, 0xe3, 0xe5, 0x28, 0x4b, 0xd3, 0xe1, 0xe4, 0xbc, 0xf0, 0x4c, 0xbb, 0xfb, 0x6f, 0xd9, 0x8c, + 0x3b, 0xab, 0xac, 0x22, 0x30, 0xa0, 0x8d, 0x9f, 0x36, 0x40, 0xc9, 0xf4, 0x29, 0x8c, 0xc1, 0x4d, + 0x33, 0x76, 0xf1, 0xf5, 0x8b, 0x36, 0x47, 0xfe, 0xdf, 0x68, 0x66, 0x0e, 0xfd, 0x2a, 0xcd, 0x56, + 0x59, 0xe7, 0x9a, 0x65, 0x60, 0x7b, 0x95, 0xa6, 0xaf, 0xfc, 0x1f, 0x2c, 0x2e, 0xff, 0x3f, 0xaf, + 0x51, 0xea, 0x26, 0x5e, 0xa5, 0x5d, 0x45, 0xeb, 0xbf, 0x4e, 0xcb, 0x00, 0xd0, 0xe2, 0x1e, 0xea, + 0xb7, 0x14, 0x02, 0x45, 0xf5, 0x4c, 0x3a, 0x7f, 0xd4, 0x5c, 0xeb, 0xed, 0x19, 0x64, 0xbf, 0x7d, + 0xfa, 0xbb, 0x9b, 0x3b, 0x9d, 0xb9, 0xf9, 0xe7, 0x33, 0x37, 0xff, 0xdb, 0xcc, 0xcd, 0x7f, 0x7f, + 0xe6, 0xe6, 0x9e, 0x9f, 0xb9, 0xb9, 0x9f, 0xcf, 0xdc, 0xdc, 0xf1, 0x3b, 0x4b, 0x70, 0xea, 0x56, + 0x9b, 0x43, 0xd4, 0x15, 0xfa, 0xab, 0x35, 0x36, 0x2f, 0x40, 0x0d, 0xd9, 0x2d, 0xe9, 0x77, 0xd9, + 0x87, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0x35, 0x81, 0x07, 0xeb, 0x1b, 0x0a, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { diff --git a/x/hard/types/keys.go b/x/hard/types/keys.go index cc42bec0c7..67e3d0fd2b 100644 --- a/x/hard/types/keys.go +++ b/x/hard/types/keys.go @@ -25,9 +25,9 @@ var ( MoneyMarketsPrefix = []byte{0x05} PreviousAccrualTimePrefix = []byte{0x06} // denom -> time TotalReservesPrefix = []byte{0x07} // denom -> sdk.Coin - BorrowInterestFactorPrefix = []byte{0x08} // denom -> sdk.Dec - SupplyInterestFactorPrefix = []byte{0x09} // denom -> sdk.Dec - DelegatorInterestFactorPrefix = []byte{0x10} // denom -> sdk.Dec + BorrowInterestFactorPrefix = []byte{0x08} // denom -> sdkmath.LegacyDec + SupplyInterestFactorPrefix = []byte{0x09} // denom -> sdkmath.LegacyDec + DelegatorInterestFactorPrefix = []byte{0x10} // denom -> sdkmath.LegacyDec ) // DepositTypeIteratorKey returns an interator prefix for interating over deposits by deposit denom diff --git a/x/hard/types/liquidation.go b/x/hard/types/liquidation.go index 81398eb9df..1c132b3abf 100644 --- a/x/hard/types/liquidation.go +++ b/x/hard/types/liquidation.go @@ -1,35 +1,34 @@ package types import ( + sdkmath "cosmossdk.io/math" "sort" - - sdk "github.com/cosmos/cosmos-sdk/types" ) // ValuationMap holds the USD value of various coin types type ValuationMap struct { - Usd map[string]sdk.Dec + Usd map[string]sdkmath.LegacyDec } // NewValuationMap returns a new instance of ValuationMap func NewValuationMap() ValuationMap { return ValuationMap{ - Usd: make(map[string]sdk.Dec), + Usd: make(map[string]sdkmath.LegacyDec), } } // Get returns the USD value for a specific denom -func (m ValuationMap) Get(denom string) sdk.Dec { +func (m ValuationMap) Get(denom string) sdkmath.LegacyDec { return m.Usd[denom] } // SetZero sets the USD value for a specific denom to 0 func (m ValuationMap) SetZero(denom string) { - m.Usd[denom] = sdk.ZeroDec() + m.Usd[denom] = sdkmath.LegacyZeroDec() } // Increment increments the USD value of a denom -func (m ValuationMap) Increment(denom string, amount sdk.Dec) { +func (m ValuationMap) Increment(denom string, amount sdkmath.LegacyDec) { _, ok := m.Usd[denom] if !ok { m.Usd[denom] = amount @@ -39,7 +38,7 @@ func (m ValuationMap) Increment(denom string, amount sdk.Dec) { } // Decrement decrements the USD value of a denom -func (m ValuationMap) Decrement(denom string, amount sdk.Dec) { +func (m ValuationMap) Decrement(denom string, amount sdkmath.LegacyDec) { _, ok := m.Usd[denom] if !ok { m.Usd[denom] = amount @@ -49,8 +48,8 @@ func (m ValuationMap) Decrement(denom string, amount sdk.Dec) { } // Sum returns the total USD value of all coins in the map -func (m ValuationMap) Sum() sdk.Dec { - sum := sdk.ZeroDec() +func (m ValuationMap) Sum() sdkmath.LegacyDec { + sum := sdkmath.LegacyZeroDec() for _, v := range m.Usd { sum = sum.Add(v) } diff --git a/x/hard/types/params.go b/x/hard/types/params.go index f3422a8e6b..ffdefe7e43 100644 --- a/x/hard/types/params.go +++ b/x/hard/types/params.go @@ -14,7 +14,7 @@ var ( KeyMoneyMarkets = []byte("MoneyMarkets") KeyMinimumBorrowUSDValue = []byte("MinimumBorrowUSDValue") DefaultMoneyMarkets = MoneyMarkets{} - DefaultMinimumBorrowUSDValue = sdk.NewDec(10) // $10 USD minimum borrow value + DefaultMinimumBorrowUSDValue = sdkmath.LegacyNewDec(10) // $10 USD minimum borrow value DefaultAccumulationTimes = GenesisAccumulationTimes{} DefaultTotalSupplied = sdk.Coins{} DefaultTotalBorrowed = sdk.Coins{} @@ -24,7 +24,7 @@ var ( ) // NewBorrowLimit returns a new BorrowLimit -func NewBorrowLimit(hasMaxLimit bool, maximumLimit, loanToValue sdk.Dec) BorrowLimit { +func NewBorrowLimit(hasMaxLimit bool, maximumLimit, loanToValue sdkmath.LegacyDec) BorrowLimit { return BorrowLimit{ HasMaxLimit: hasMaxLimit, MaximumLimit: maximumLimit, @@ -40,7 +40,7 @@ func (bl BorrowLimit) Validate() error { if bl.LoanToValue.IsNegative() { return fmt.Errorf("loan-to-value must be a non-negative decimal: %s", bl.LoanToValue) } - if bl.LoanToValue.GT(sdk.OneDec()) { + if bl.LoanToValue.GT(sdkmath.LegacyOneDec()) { return fmt.Errorf("loan-to-value cannot be greater than 1.0: %s", bl.LoanToValue) } return nil @@ -62,7 +62,7 @@ func (bl BorrowLimit) Equal(blCompareTo BorrowLimit) bool { // NewMoneyMarket returns a new MoneyMarket func NewMoneyMarket(denom string, borrowLimit BorrowLimit, spotMarketID string, conversionFactor sdkmath.Int, - interestRateModel InterestRateModel, reserveFactor, keeperRewardPercentage sdk.Dec, + interestRateModel InterestRateModel, reserveFactor, keeperRewardPercentage sdkmath.LegacyDec, ) MoneyMarket { return MoneyMarket{ Denom: denom, @@ -85,7 +85,7 @@ func (mm MoneyMarket) Validate() error { return err } - if mm.ConversionFactor.IsNil() || mm.ConversionFactor.LT(sdk.OneInt()) { + if mm.ConversionFactor.IsNil() || mm.ConversionFactor.LT(sdkmath.OneInt()) { return fmt.Errorf("conversion '%s' factor must be ≥ one", mm.ConversionFactor) } @@ -93,11 +93,11 @@ func (mm MoneyMarket) Validate() error { return err } - if mm.ReserveFactor.IsNegative() || mm.ReserveFactor.GT(sdk.OneDec()) { + if mm.ReserveFactor.IsNegative() || mm.ReserveFactor.GT(sdkmath.LegacyOneDec()) { return fmt.Errorf("reserve factor must be between 0.0-1.0") } - if mm.KeeperRewardPercentage.IsNegative() || mm.KeeperRewardPercentage.GT(sdk.OneDec()) { + if mm.KeeperRewardPercentage.IsNegative() || mm.KeeperRewardPercentage.GT(sdkmath.LegacyOneDec()) { return fmt.Errorf("keeper reward percentage must be between 0.0-1.0") } @@ -144,7 +144,7 @@ func (mms MoneyMarkets) Validate() error { } // NewInterestRateModel returns a new InterestRateModel -func NewInterestRateModel(baseRateAPY, baseMultiplier, kink, jumpMultiplier sdk.Dec) InterestRateModel { +func NewInterestRateModel(baseRateAPY, baseMultiplier, kink, jumpMultiplier sdkmath.LegacyDec) InterestRateModel { return InterestRateModel{ BaseRateAPY: baseRateAPY, BaseMultiplier: baseMultiplier, @@ -155,7 +155,7 @@ func NewInterestRateModel(baseRateAPY, baseMultiplier, kink, jumpMultiplier sdk. // Validate InterestRateModel param func (irm InterestRateModel) Validate() error { - if irm.BaseRateAPY.IsNegative() || irm.BaseRateAPY.GT(sdk.OneDec()) { + if irm.BaseRateAPY.IsNegative() || irm.BaseRateAPY.GT(sdkmath.LegacyOneDec()) { return fmt.Errorf("base rate APY must be in the inclusive range 0.0-1.0") } @@ -163,7 +163,7 @@ func (irm InterestRateModel) Validate() error { return fmt.Errorf("base multiplier must not be negative") } - if irm.Kink.IsNegative() || irm.Kink.GT(sdk.OneDec()) { + if irm.Kink.IsNegative() || irm.Kink.GT(sdkmath.LegacyOneDec()) { return fmt.Errorf("kink must be in the inclusive range 0.0-1.0") } @@ -195,7 +195,7 @@ func (irm InterestRateModel) Equal(irmCompareTo InterestRateModel) bool { type InterestRateModels []InterestRateModel // NewParams returns a new params object -func NewParams(moneyMarkets MoneyMarkets, minimumBorrowUSDValue sdk.Dec) Params { +func NewParams(moneyMarkets MoneyMarkets, minimumBorrowUSDValue sdkmath.LegacyDec) Params { return Params{ MoneyMarkets: moneyMarkets, MinimumBorrowUSDValue: minimumBorrowUSDValue, @@ -230,7 +230,7 @@ func (p Params) Validate() error { } func validateMinimumBorrowUSDValue(i interface{}) error { - minBorrowVal, ok := i.(sdk.Dec) + minBorrowVal, ok := i.(sdkmath.LegacyDec) if !ok { return fmt.Errorf("invalid parameter type: %T", i) } diff --git a/x/hard/types/params_test.go b/x/hard/types/params_test.go index 7134e4e4ff..e8fb56c3f8 100644 --- a/x/hard/types/params_test.go +++ b/x/hard/types/params_test.go @@ -4,7 +4,6 @@ import ( "testing" sdkmath "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/suite" "github.com/kava-labs/kava/x/hard/types" @@ -16,7 +15,7 @@ type ParamTestSuite struct { func (suite *ParamTestSuite) TestParamValidation() { type args struct { - minBorrowVal sdk.Dec + minBorrowVal sdkmath.LegacyDec mms types.MoneyMarkets } testCases := []struct { @@ -43,14 +42,14 @@ func (suite *ParamTestSuite) TestParamValidation() { Denom: "btcb", BorrowLimit: types.NewBorrowLimit( false, - sdk.MustNewDecFromStr("100000000000"), - sdk.MustNewDecFromStr("0.5"), + sdkmath.LegacyMustNewDecFromStr("100000000000"), + sdkmath.LegacyMustNewDecFromStr("0.5"), ), SpotMarketID: "btc:usd", ConversionFactor: sdkmath.NewInt(0), InterestRateModel: types.InterestRateModel{}, - ReserveFactor: sdk.MustNewDecFromStr("0.05"), - KeeperRewardPercentage: sdk.MustNewDecFromStr("0.05"), + ReserveFactor: sdkmath.LegacyMustNewDecFromStr("0.05"), + KeeperRewardPercentage: sdkmath.LegacyMustNewDecFromStr("0.05"), }, }, }, diff --git a/x/hard/types/query.pb.go b/x/hard/types/query.pb.go index 35d2b87700..0021b52674 100644 --- a/x/hard/types/query.pb.go +++ b/x/hard/types/query.pb.go @@ -1168,7 +1168,7 @@ func (m *DepositResponse) GetIndex() SupplyInterestFactorResponses { // SupplyInterestFactorResponse defines an individual borrow interest factor. type SupplyInterestFactorResponse struct { Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` - // sdk.Dec as string + // sdkmath.LegacyDec as string Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` } @@ -1283,7 +1283,7 @@ func (m *BorrowResponse) GetIndex() BorrowInterestFactorResponses { // BorrowInterestFactorResponse defines an individual borrow interest factor. type BorrowInterestFactorResponse struct { Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` - // sdk.Dec as string + // sdkmath.LegacyDec as string Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` } @@ -1337,9 +1337,9 @@ func (m *BorrowInterestFactorResponse) GetValue() string { // MoneyMarketInterestRate is a unique type returned by interest rate queries type MoneyMarketInterestRate struct { Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` - // sdk.Dec as String + // sdkmath.LegacyDec as String SupplyInterestRate string `protobuf:"bytes,2,opt,name=supply_interest_rate,json=supplyInterestRate,proto3" json:"supply_interest_rate,omitempty"` - // sdk.Dec as String + // sdkmath.LegacyDec as String BorrowInterestRate string `protobuf:"bytes,3,opt,name=borrow_interest_rate,json=borrowInterestRate,proto3" json:"borrow_interest_rate,omitempty"` } @@ -1400,9 +1400,9 @@ func (m *MoneyMarketInterestRate) GetBorrowInterestRate() string { // InterestFactor is a unique type returned by interest factor queries type InterestFactor struct { Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` - // sdk.Dec as String + // sdkmath.LegacyDec as String BorrowInterestFactor string `protobuf:"bytes,2,opt,name=borrow_interest_factor,json=borrowInterestFactor,proto3" json:"borrow_interest_factor,omitempty"` - // sdk.Dec as String + // sdkmath.LegacyDec as String SupplyInterestFactor string `protobuf:"bytes,3,opt,name=supply_interest_factor,json=supplyInterestFactor,proto3" json:"supply_interest_factor,omitempty"` } @@ -1989,6 +1989,7 @@ func _Query_InterestFactors_Handler(srv interface{}, ctx context.Context, dec fu return interceptor(ctx, in, info, handler) } +var Query_serviceDesc = _Query_serviceDesc var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "kava.hard.v1beta1.Query", HandlerType: (*QueryServer)(nil), diff --git a/x/hard/types/tx.pb.go b/x/hard/types/tx.pb.go index e14cb5d5c6..4a70a19114 100644 --- a/x/hard/types/tx.pb.go +++ b/x/hard/types/tx.pb.go @@ -747,6 +747,7 @@ func _Msg_Liquidate_Handler(srv interface{}, ctx context.Context, dec func(inter return interceptor(ctx, in, info, handler) } +var Msg_serviceDesc = _Msg_serviceDesc var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "kava.hard.v1beta1.Msg", HandlerType: (*MsgServer)(nil), diff --git a/x/incentive/genesis.go b/x/incentive/genesis.go index 246ffa67f2..e9cc7ab8e7 100644 --- a/x/incentive/genesis.go +++ b/x/incentive/genesis.go @@ -1,6 +1,7 @@ package incentive import ( + sdkmath "cosmossdk.io/math" "fmt" "time" @@ -176,7 +177,7 @@ func getUSDXMintingGenesisRewardState(ctx sdk.Context, keeper keeper.Keeper) typ }) var mris types.MultiRewardIndexes - keeper.IterateUSDXMintingRewardFactors(ctx, func(ctype string, factor sdk.Dec) bool { + keeper.IterateUSDXMintingRewardFactors(ctx, func(ctype string, factor sdkmath.LegacyDec) bool { mris = append( mris, types.NewMultiRewardIndex( diff --git a/x/incentive/genesis_test.go b/x/incentive/genesis_test.go index 78b75cc79d..b7345e0a41 100644 --- a/x/incentive/genesis_test.go +++ b/x/incentive/genesis_test.go @@ -46,15 +46,15 @@ func (suite *GenesisTestSuite) SetupTest() { WithSimpleAccount(addrs[0], cs(c("bnb", 1e10), c("ukava", 1e10))). WithSimpleModuleAccount(kavadisttypes.KavaDistMacc, cs(c("hard", 1e15), c("ukava", 1e15))) - loanToValue, _ := sdk.NewDecFromStr("0.6") - borrowLimit := sdk.NewDec(1000000000000000) + loanToValue, _ := sdkmath.LegacyNewDecFromStr("0.6") + borrowLimit := sdkmath.LegacyNewDec(1000000000000000) hardGS := hardtypes.NewGenesisState( hardtypes.NewParams( hardtypes.MoneyMarkets{ - hardtypes.NewMoneyMarket("ukava", hardtypes.NewBorrowLimit(false, borrowLimit, loanToValue), "kava:usd", sdkmath.NewInt(1000000), hardtypes.NewInterestRateModel(sdk.MustNewDecFromStr("0.05"), sdk.MustNewDecFromStr("2"), sdk.MustNewDecFromStr("0.8"), sdk.MustNewDecFromStr("10")), sdk.MustNewDecFromStr("0.05"), sdk.ZeroDec()), - hardtypes.NewMoneyMarket("bnb", hardtypes.NewBorrowLimit(false, borrowLimit, loanToValue), "bnb:usd", sdkmath.NewInt(1000000), hardtypes.NewInterestRateModel(sdk.MustNewDecFromStr("0.05"), sdk.MustNewDecFromStr("2"), sdk.MustNewDecFromStr("0.8"), sdk.MustNewDecFromStr("10")), sdk.MustNewDecFromStr("0.05"), sdk.ZeroDec()), + hardtypes.NewMoneyMarket("ukava", hardtypes.NewBorrowLimit(false, borrowLimit, loanToValue), "kava:usd", sdkmath.NewInt(1000000), hardtypes.NewInterestRateModel(sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyMustNewDecFromStr("2"), sdkmath.LegacyMustNewDecFromStr("0.8"), sdkmath.LegacyMustNewDecFromStr("10")), sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyZeroDec()), + hardtypes.NewMoneyMarket("bnb", hardtypes.NewBorrowLimit(false, borrowLimit, loanToValue), "bnb:usd", sdkmath.NewInt(1000000), hardtypes.NewInterestRateModel(sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyMustNewDecFromStr("2"), sdkmath.LegacyMustNewDecFromStr("0.8"), sdkmath.LegacyMustNewDecFromStr("10")), sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyZeroDec()), }, - sdk.NewDec(10), + sdkmath.LegacyNewDec(10), ), hardtypes.DefaultAccumulationTimes, hardtypes.DefaultDeposits, @@ -122,7 +122,7 @@ func (suite *GenesisTestSuite) SetupTest() { NewPricefeedGenStateMultiFromTime(cdc, suite.genesisTime), ) - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: suite.genesisTime}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: suite.genesisTime}) suite.addrs = addrs suite.keeper = keeper @@ -277,7 +277,7 @@ func (suite *GenesisTestSuite) TestExportedGenesisMatchesImported() { ) tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 0, Time: genesisTime}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 0, Time: genesisTime}) // Incentive init genesis reads from the cdp keeper to check params are ok. So it needs to be initialized first. // Then the cdp keeper reads from pricefeed keeper to check its params are ok. So it also need initialization. @@ -363,7 +363,7 @@ func (suite *GenesisTestSuite) TestInitGenesisPanicsWhenAccumulationTimesTooLong for _, tc := range testCases { tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 0, Time: genesisTime}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 0, Time: genesisTime}) // Incentive init genesis reads from the cdp keeper to check params are ok. So it needs to be initialized first. // Then the cdp keeper reads from pricefeed keeper to check its params are ok. So it also need initialization. diff --git a/x/incentive/integration_test.go b/x/incentive/integration_test.go index f1d5039dc4..c9c5fed4fd 100644 --- a/x/incentive/integration_test.go +++ b/x/incentive/integration_test.go @@ -16,7 +16,7 @@ import ( // Avoid cluttering test cases with long function names func i(in int64) sdkmath.Int { return sdkmath.NewInt(in) } -func d(str string) sdk.Dec { return sdk.MustNewDecFromStr(str) } +func d(str string) sdkmath.LegacyDec { return sdkmath.LegacyMustNewDecFromStr(str) } func cs(coins ...sdk.Coin) sdk.Coins { return sdk.NewCoins(coins...) } func c(denom string, amount int64) sdk.Coin { return sdk.NewInt64Coin(denom, amount) } @@ -33,9 +33,9 @@ func NewCDPGenStateMulti(cdc codec.JSONCodec) app.GenesisState { { Denom: "xrp", Type: "xrp-a", - LiquidationRatio: sdk.MustNewDecFromStr("2.0"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("2.0"), DebtLimit: sdk.NewInt64Coin("usdx", 500000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), // %5 apr + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"), // %5 apr LiquidationPenalty: d("0.05"), AuctionSize: i(7000000000), SpotMarketID: "xrp:usd", @@ -45,9 +45,9 @@ func NewCDPGenStateMulti(cdc codec.JSONCodec) app.GenesisState { { Denom: "btc", Type: "btc-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("1.5"), DebtLimit: sdk.NewInt64Coin("usdx", 500000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000000782997609"), // %2.5 apr + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.000000000782997609"), // %2.5 apr LiquidationPenalty: d("0.025"), AuctionSize: i(10000000), SpotMarketID: "btc:usd", @@ -57,9 +57,9 @@ func NewCDPGenStateMulti(cdc codec.JSONCodec) app.GenesisState { { Denom: "bnb", Type: "bnb-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("1.5"), DebtLimit: sdk.NewInt64Coin("usdx", 500000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), // %5 apr + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"), // %5 apr LiquidationPenalty: d("0.05"), AuctionSize: i(50000000000), SpotMarketID: "bnb:usd", @@ -71,7 +71,7 @@ func NewCDPGenStateMulti(cdc codec.JSONCodec) app.GenesisState { Type: "busd-a", LiquidationRatio: d("1.01"), DebtLimit: sdk.NewInt64Coin("usdx", 500000000000), - StabilityFee: sdk.OneDec(), // %0 apr + StabilityFee: sdkmath.LegacyOneDec(), // %0 apr LiquidationPenalty: d("0.05"), AuctionSize: i(10000000000), SpotMarketID: "busd:usd", @@ -91,16 +91,16 @@ func NewCDPGenStateMulti(cdc codec.JSONCodec) app.GenesisState { GovDenom: cdptypes.DefaultGovDenom, CDPs: cdptypes.CDPs{}, PreviousAccumulationTimes: cdptypes.GenesisAccumulationTimes{ - cdptypes.NewGenesisAccumulationTime("btc-a", time.Time{}, sdk.OneDec()), - cdptypes.NewGenesisAccumulationTime("xrp-a", time.Time{}, sdk.OneDec()), - cdptypes.NewGenesisAccumulationTime("busd-a", time.Time{}, sdk.OneDec()), - cdptypes.NewGenesisAccumulationTime("bnb-a", time.Time{}, sdk.OneDec()), + cdptypes.NewGenesisAccumulationTime("btc-a", time.Time{}, sdkmath.LegacyOneDec()), + cdptypes.NewGenesisAccumulationTime("xrp-a", time.Time{}, sdkmath.LegacyOneDec()), + cdptypes.NewGenesisAccumulationTime("busd-a", time.Time{}, sdkmath.LegacyOneDec()), + cdptypes.NewGenesisAccumulationTime("bnb-a", time.Time{}, sdkmath.LegacyOneDec()), }, TotalPrincipals: cdptypes.GenesisTotalPrincipals{ - cdptypes.NewGenesisTotalPrincipal("btc-a", sdk.ZeroInt()), - cdptypes.NewGenesisTotalPrincipal("xrp-a", sdk.ZeroInt()), - cdptypes.NewGenesisTotalPrincipal("busd-a", sdk.ZeroInt()), - cdptypes.NewGenesisTotalPrincipal("bnb-a", sdk.ZeroInt()), + cdptypes.NewGenesisTotalPrincipal("btc-a", sdkmath.ZeroInt()), + cdptypes.NewGenesisTotalPrincipal("xrp-a", sdkmath.ZeroInt()), + cdptypes.NewGenesisTotalPrincipal("busd-a", sdkmath.ZeroInt()), + cdptypes.NewGenesisTotalPrincipal("bnb-a", sdkmath.ZeroInt()), }, } return app.GenesisState{cdptypes.ModuleName: cdc.MustMarshalJSON(&cdpGenesis)} @@ -122,37 +122,37 @@ func NewPricefeedGenStateMultiFromTime(cdc codec.JSONCodec, t time.Time) app.Gen { MarketID: "kava:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("2.00"), + Price: sdkmath.LegacyMustNewDecFromStr("2.00"), Expiry: t.Add(1 * time.Hour), }, { MarketID: "btc:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("8000.00"), + Price: sdkmath.LegacyMustNewDecFromStr("8000.00"), Expiry: t.Add(1 * time.Hour), }, { MarketID: "xrp:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("0.25"), + Price: sdkmath.LegacyMustNewDecFromStr("0.25"), Expiry: t.Add(1 * time.Hour), }, { MarketID: "bnb:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("17.25"), + Price: sdkmath.LegacyMustNewDecFromStr("17.25"), Expiry: t.Add(1 * time.Hour), }, { MarketID: "busd:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.OneDec(), + Price: sdkmath.LegacyOneDec(), Expiry: t.Add(1 * time.Hour), }, { MarketID: "zzz:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("2.00"), + Price: sdkmath.LegacyMustNewDecFromStr("2.00"), Expiry: t.Add(1 * time.Hour), }, }, diff --git a/x/incentive/keeper/claim.go b/x/incentive/keeper/claim.go index c58ae6e870..525bdb2921 100644 --- a/x/incentive/keeper/claim.go +++ b/x/incentive/keeper/claim.go @@ -2,6 +2,7 @@ package keeper import ( errorsmod "cosmossdk.io/errors" + sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/kava-labs/kava/x/incentive/types" @@ -31,7 +32,7 @@ func (k Keeper) ClaimUSDXMintingReward(ctx sdk.Context, owner, receiver sdk.AccA return err } - rewardAmount := sdk.NewDecFromInt(claim.Reward.Amount).Mul(multiplier.Factor).RoundInt() + rewardAmount := sdkmath.LegacyNewDecFromInt(claim.Reward.Amount).Mul(multiplier.Factor).RoundInt() if rewardAmount.IsZero() { return types.ErrZeroClaim } @@ -80,7 +81,7 @@ func (k Keeper) ClaimHardReward(ctx sdk.Context, owner, receiver sdk.AccAddress, amt := syncedClaim.Reward.AmountOf(denom) claimingCoins := sdk.NewCoins(sdk.NewCoin(denom, amt)) - rewardCoins := sdk.NewCoins(sdk.NewCoin(denom, sdk.NewDecFromInt(amt).Mul(multiplier.Factor).RoundInt())) + rewardCoins := sdk.NewCoins(sdk.NewCoin(denom, sdkmath.LegacyNewDecFromInt(amt).Mul(multiplier.Factor).RoundInt())) if rewardCoins.IsZero() { return types.ErrZeroClaim } @@ -133,7 +134,7 @@ func (k Keeper) ClaimDelegatorReward(ctx sdk.Context, owner, receiver sdk.AccAdd amt := syncedClaim.Reward.AmountOf(denom) claimingCoins := sdk.NewCoins(sdk.NewCoin(denom, amt)) - rewardCoins := sdk.NewCoins(sdk.NewCoin(denom, sdk.NewDecFromInt(amt).Mul(multiplier.Factor).RoundInt())) + rewardCoins := sdk.NewCoins(sdk.NewCoin(denom, sdkmath.LegacyNewDecFromInt(amt).Mul(multiplier.Factor).RoundInt())) if rewardCoins.IsZero() { return types.ErrZeroClaim } @@ -182,7 +183,7 @@ func (k Keeper) ClaimSwapReward(ctx sdk.Context, owner, receiver sdk.AccAddress, amt := syncedClaim.Reward.AmountOf(denom) claimingCoins := sdk.NewCoins(sdk.NewCoin(denom, amt)) - rewardCoins := sdk.NewCoins(sdk.NewCoin(denom, sdk.NewDecFromInt(amt).Mul(multiplier.Factor).RoundInt())) + rewardCoins := sdk.NewCoins(sdk.NewCoin(denom, sdkmath.LegacyNewDecFromInt(amt).Mul(multiplier.Factor).RoundInt())) if rewardCoins.IsZero() { return types.ErrZeroClaim } @@ -231,7 +232,7 @@ func (k Keeper) ClaimSavingsReward(ctx sdk.Context, owner, receiver sdk.AccAddre amt := syncedClaim.Reward.AmountOf(denom) claimingCoins := sdk.NewCoins(sdk.NewCoin(denom, amt)) - rewardCoins := sdk.NewCoins(sdk.NewCoin(denom, sdk.NewDecFromInt(amt).Mul(multiplier.Factor).RoundInt())) + rewardCoins := sdk.NewCoins(sdk.NewCoin(denom, sdkmath.LegacyNewDecFromInt(amt).Mul(multiplier.Factor).RoundInt())) if rewardCoins.IsZero() { return types.ErrZeroClaim } @@ -279,7 +280,7 @@ func (k Keeper) ClaimEarnReward(ctx sdk.Context, owner, receiver sdk.AccAddress, amt := syncedClaim.Reward.AmountOf(denom) claimingCoins := sdk.NewCoins(sdk.NewCoin(denom, amt)) - rewardCoins := sdk.NewCoins(sdk.NewCoin(denom, sdk.NewDecFromInt(amt).Mul(multiplier.Factor).RoundInt())) + rewardCoins := sdk.NewCoins(sdk.NewCoin(denom, sdkmath.LegacyNewDecFromInt(amt).Mul(multiplier.Factor).RoundInt())) if rewardCoins.IsZero() { return types.ErrZeroClaim } diff --git a/x/incentive/keeper/grpc_query.go b/x/incentive/keeper/grpc_query.go index 956eaa4054..a6dd193e2f 100644 --- a/x/incentive/keeper/grpc_query.go +++ b/x/incentive/keeper/grpc_query.go @@ -2,6 +2,7 @@ package keeper import ( "context" + sdkmath "cosmossdk.io/math" "strings" sdk "github.com/cosmos/cosmos-sdk/types" @@ -97,7 +98,7 @@ func (s queryServer) RewardFactors( sdkCtx := sdk.UnwrapSDKContext(ctx) var usdxFactors types.RewardIndexes - s.keeper.IterateUSDXMintingRewardFactors(sdkCtx, func(collateralType string, factor sdk.Dec) (stop bool) { + s.keeper.IterateUSDXMintingRewardFactors(sdkCtx, func(collateralType string, factor sdkmath.LegacyDec) (stop bool) { usdxFactors = usdxFactors.With(collateralType, factor) return false }) diff --git a/x/incentive/keeper/grpc_query_test.go b/x/incentive/keeper/grpc_query_test.go index a4ac6c5bae..136384fb53 100644 --- a/x/incentive/keeper/grpc_query_test.go +++ b/x/incentive/keeper/grpc_query_test.go @@ -1,11 +1,12 @@ package keeper_test import ( + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + tmtime "github.com/cometbft/cometbft/types/time" "testing" "time" sdkmath "cosmossdk.io/math" - tmprototypes "github.com/cometbft/cometbft/proto/tendermint/types" "github.com/cosmos/cosmos-sdk/baseapp" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/kava-labs/kava/app" @@ -41,8 +42,7 @@ func (suite *grpcQueryTestSuite) SetupTest() { suite.addrs = addrs - suite.ctx = suite.tApp.NewContext(true, tmprototypes.Header{}). - WithBlockTime(time.Now().UTC()) + suite.ctx = suite.tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now().UTC()}) suite.keeper = suite.tApp.GetIncentiveKeeper() queryHelper := baseapp.NewQueryServerTestHelper(suite.ctx, suite.tApp.InterfaceRegistry()) @@ -50,15 +50,15 @@ func (suite *grpcQueryTestSuite) SetupTest() { suite.queryClient = types.NewQueryClient(queryHelper) - loanToValue, _ := sdk.NewDecFromStr("0.6") - borrowLimit := sdk.NewDec(1000000000000000) + loanToValue, _ := sdkmath.LegacyNewDecFromStr("0.6") + borrowLimit := sdkmath.LegacyNewDec(1000000000000000) hardGS := hardtypes.NewGenesisState( hardtypes.NewParams( hardtypes.MoneyMarkets{ - hardtypes.NewMoneyMarket("ukava", hardtypes.NewBorrowLimit(false, borrowLimit, loanToValue), "kava:usd", sdkmath.NewInt(1000000), hardtypes.NewInterestRateModel(sdk.MustNewDecFromStr("0.05"), sdk.MustNewDecFromStr("2"), sdk.MustNewDecFromStr("0.8"), sdk.MustNewDecFromStr("10")), sdk.MustNewDecFromStr("0.05"), sdk.ZeroDec()), - hardtypes.NewMoneyMarket("bnb", hardtypes.NewBorrowLimit(false, borrowLimit, loanToValue), "bnb:usd", sdkmath.NewInt(1000000), hardtypes.NewInterestRateModel(sdk.MustNewDecFromStr("0.05"), sdk.MustNewDecFromStr("2"), sdk.MustNewDecFromStr("0.8"), sdk.MustNewDecFromStr("10")), sdk.MustNewDecFromStr("0.05"), sdk.ZeroDec()), + hardtypes.NewMoneyMarket("ukava", hardtypes.NewBorrowLimit(false, borrowLimit, loanToValue), "kava:usd", sdkmath.NewInt(1000000), hardtypes.NewInterestRateModel(sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyMustNewDecFromStr("2"), sdkmath.LegacyMustNewDecFromStr("0.8"), sdkmath.LegacyMustNewDecFromStr("10")), sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyZeroDec()), + hardtypes.NewMoneyMarket("bnb", hardtypes.NewBorrowLimit(false, borrowLimit, loanToValue), "bnb:usd", sdkmath.NewInt(1000000), hardtypes.NewInterestRateModel(sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyMustNewDecFromStr("2"), sdkmath.LegacyMustNewDecFromStr("0.8"), sdkmath.LegacyMustNewDecFromStr("10")), sdkmath.LegacyMustNewDecFromStr("0.05"), sdkmath.LegacyZeroDec()), }, - sdk.NewDec(10), + sdkmath.LegacyNewDec(10), ), hardtypes.DefaultAccumulationTimes, hardtypes.DefaultDeposits, diff --git a/x/incentive/keeper/hooks.go b/x/incentive/keeper/hooks.go index 2fa7e6dcc7..84a46c9a18 100644 --- a/x/incentive/keeper/hooks.go +++ b/x/incentive/keeper/hooks.go @@ -1,6 +1,7 @@ package keeper import ( + "context" sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" @@ -33,14 +34,16 @@ func (k Keeper) Hooks() Hooks { return Hooks{k} } // AfterCDPCreated function that runs after a cdp is created func (h Hooks) AfterCDPCreated(ctx sdk.Context, cdp cdptypes.CDP) { - h.k.InitializeUSDXMintingClaim(ctx, cdp) + sdkCtx := sdk.UnwrapSDKContext(ctx) + h.k.InitializeUSDXMintingClaim(sdkCtx, cdp) } // BeforeCDPModified function that runs before a cdp is modified // note that this is called immediately after interest is synchronized, and so could potentially // be called AfterCDPInterestUpdated or something like that, if we we're to expand the scope of cdp hooks func (h Hooks) BeforeCDPModified(ctx sdk.Context, cdp cdptypes.CDP) { - h.k.SynchronizeUSDXMintingReward(ctx, cdp) + sdkCtx := sdk.UnwrapSDKContext(ctx) + h.k.SynchronizeUSDXMintingReward(sdkCtx, cdp) } // ------------------- Hard Module Hooks ------------------- @@ -96,28 +99,36 @@ When delegated tokens (to bonded validators) are changed: */ // BeforeDelegationCreated runs before a delegation is created -func (h Hooks) BeforeDelegationCreated(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error { +func (h Hooks) BeforeDelegationCreated(ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error { + sdkCtx := sdk.UnwrapSDKContext(ctx) // Add a claim if one doesn't exist, otherwise sync the existing. - h.k.InitializeDelegatorReward(ctx, delAddr) + h.k.InitializeDelegatorReward(sdkCtx, delAddr) return nil } // BeforeDelegationSharesModified runs before an existing delegation is modified -func (h Hooks) BeforeDelegationSharesModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error { +func (h Hooks) BeforeDelegationSharesModified(ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error { + sdkCtx := sdk.UnwrapSDKContext(ctx) // Sync rewards based on total delegated to bonded validators. - h.k.SynchronizeDelegatorRewards(ctx, delAddr, nil, false) + h.k.SynchronizeDelegatorRewards(sdkCtx, delAddr, nil, false) return nil } // BeforeValidatorSlashed is called before a validator is slashed // Validator status is not updated when Slash or Jail is called -func (h Hooks) BeforeValidatorSlashed(ctx sdk.Context, valAddr sdk.ValAddress, fraction sdk.Dec) error { +func (h Hooks) BeforeValidatorSlashed(ctx context.Context, valAddr sdk.ValAddress, fraction sdkmath.LegacyDec) error { // Sync all claims for users delegated to this validator. // For each claim, sync based on the total delegated to bonded validators. - for _, delegation := range h.k.stakingKeeper.GetValidatorDelegations(ctx, valAddr) { - h.k.SynchronizeDelegatorRewards(ctx, delegation.GetDelegatorAddr(), nil, false) + delegations, err := h.k.stakingKeeper.GetValidatorDelegations(ctx, valAddr) + if err != nil { + return err + } + sdkCtx := sdk.UnwrapSDKContext(ctx) + + for _, delegation := range delegations { + h.k.SynchronizeDelegatorRewards(sdkCtx, []byte(delegation.GetDelegatorAddr()), nil, false) } return nil @@ -125,12 +136,17 @@ func (h Hooks) BeforeValidatorSlashed(ctx sdk.Context, valAddr sdk.ValAddress, f // AfterValidatorBeginUnbonding is called after a validator begins unbonding // Validator status is set to Unbonding prior to hook running -func (h Hooks) AfterValidatorBeginUnbonding(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) error { +func (h Hooks) AfterValidatorBeginUnbonding(ctx context.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) error { + delegations, err := h.k.stakingKeeper.GetValidatorDelegations(ctx, valAddr) + if err != nil { + return err + } + sdkCtx := sdk.UnwrapSDKContext(ctx) // Sync all claims for users delegated to this validator. // For each claim, sync based on the total delegated to bonded validators, and also delegations to valAddr. // valAddr's status has just been set to Unbonding, but we want to include delegations to it in the sync. - for _, delegation := range h.k.stakingKeeper.GetValidatorDelegations(ctx, valAddr) { - h.k.SynchronizeDelegatorRewards(ctx, delegation.GetDelegatorAddr(), valAddr, true) + for _, delegation := range delegations { + h.k.SynchronizeDelegatorRewards(sdkCtx, []byte(delegation.GetDelegatorAddr()), valAddr, true) } return nil @@ -138,12 +154,17 @@ func (h Hooks) AfterValidatorBeginUnbonding(ctx sdk.Context, consAddr sdk.ConsAd // AfterValidatorBonded is called after a validator is bonded // Validator status is set to Bonded prior to hook running -func (h Hooks) AfterValidatorBonded(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) error { +func (h Hooks) AfterValidatorBonded(ctx context.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) error { + delegations, err := h.k.stakingKeeper.GetValidatorDelegations(ctx, valAddr) + if err != nil { + return err + } + sdkCtx := sdk.UnwrapSDKContext(ctx) // Sync all claims for users delegated to this validator. // For each claim, sync based on the total delegated to bonded validators, except for delegations to valAddr. // valAddr's status has just been set to Bonded, but we don't want to include delegations to it in the sync - for _, delegation := range h.k.stakingKeeper.GetValidatorDelegations(ctx, valAddr) { - h.k.SynchronizeDelegatorRewards(ctx, delegation.GetDelegatorAddr(), valAddr, false) + for _, delegation := range delegations { + h.k.SynchronizeDelegatorRewards(sdkCtx, []byte(delegation.GetDelegatorAddr()), valAddr, false) } return nil @@ -152,55 +173,57 @@ func (h Hooks) AfterValidatorBonded(ctx sdk.Context, consAddr sdk.ConsAddress, v // NOTE: following hooks are just implemented to ensure StakingHooks interface compliance // AfterDelegationModified runs after a delegation is modified -func (h Hooks) AfterDelegationModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error { +func (h Hooks) AfterDelegationModified(ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error { return nil } // BeforeDelegationRemoved runs directly before a delegation is deleted. BeforeDelegationSharesModified is run prior to this. -func (h Hooks) BeforeDelegationRemoved(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error { +func (h Hooks) BeforeDelegationRemoved(ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error { return nil } // AfterValidatorCreated runs after a validator is created -func (h Hooks) AfterValidatorCreated(ctx sdk.Context, valAddr sdk.ValAddress) error { +func (h Hooks) AfterValidatorCreated(ctx context.Context, valAddr sdk.ValAddress) error { return nil } // BeforeValidatorModified runs before a validator is modified -func (h Hooks) BeforeValidatorModified(ctx sdk.Context, valAddr sdk.ValAddress) error { +func (h Hooks) BeforeValidatorModified(ctx context.Context, valAddr sdk.ValAddress) error { return nil } // AfterValidatorRemoved runs after a validator is removed -func (h Hooks) AfterValidatorRemoved(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) error { +func (h Hooks) AfterValidatorRemoved(ctx context.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) error { return nil } // AfterUnbondingInitiated is called when an unbonding operation // (validator unbonding, unbonding delegation, redelegation) was initiated -func (h Hooks) AfterUnbondingInitiated(_ sdk.Context, _ uint64) error { +func (h Hooks) AfterUnbondingInitiated(_ context.Context, _ uint64) error { return nil } // ------------------- Swap Module Hooks ------------------- -func (h Hooks) AfterPoolDepositCreated(ctx sdk.Context, poolID string, depositor sdk.AccAddress, _ sdkmath.Int) { - h.k.InitializeSwapReward(ctx, poolID, depositor) +func (h Hooks) AfterPoolDepositCreated(ctx context.Context, poolID string, depositor sdk.AccAddress, _ sdkmath.Int) { + sdkCtx := sdk.UnwrapSDKContext(ctx) + h.k.InitializeSwapReward(sdkCtx, poolID, depositor) } -func (h Hooks) BeforePoolDepositModified(ctx sdk.Context, poolID string, depositor sdk.AccAddress, sharesOwned sdkmath.Int) { - h.k.SynchronizeSwapReward(ctx, poolID, depositor, sharesOwned) +func (h Hooks) BeforePoolDepositModified(ctx context.Context, poolID string, depositor sdk.AccAddress, sharesOwned sdkmath.Int) { + sdkCtx := sdk.UnwrapSDKContext(ctx) + h.k.SynchronizeSwapReward(sdkCtx, poolID, depositor, sharesOwned) } // ------------------- Savings Module Hooks ------------------- // AfterSavingsDepositCreated function that runs after a deposit is created -func (h Hooks) AfterSavingsDepositCreated(ctx sdk.Context, deposit savingstypes.Deposit) { +func (h Hooks) AfterSavingsDepositCreated(ctx context.Context, deposit savingstypes.Deposit) { // h.k.InitializeSavingsReward(ctx, deposit) } // BeforeSavingsDepositModified function that runs before a deposit is modified -func (h Hooks) BeforeSavingsDepositModified(ctx sdk.Context, deposit savingstypes.Deposit, incomingDenoms []string) { +func (h Hooks) BeforeSavingsDepositModified(ctx context.Context, deposit savingstypes.Deposit, incomingDenoms []string) { // h.k.SynchronizeSavingsReward(ctx, deposit, incomingDenoms) } @@ -208,20 +231,22 @@ func (h Hooks) BeforeSavingsDepositModified(ctx sdk.Context, deposit savingstype // AfterVaultDepositCreated function that runs after a vault deposit is created func (h Hooks) AfterVaultDepositCreated( - ctx sdk.Context, + ctx context.Context, vaultDenom string, depositor sdk.AccAddress, - _ sdk.Dec, + _ sdkmath.LegacyDec, ) { - h.k.InitializeEarnReward(ctx, vaultDenom, depositor) + sdkCtx := sdk.UnwrapSDKContext(ctx) + h.k.InitializeEarnReward(sdkCtx, vaultDenom, depositor) } // BeforeVaultDepositModified function that runs before a vault deposit is modified func (h Hooks) BeforeVaultDepositModified( - ctx sdk.Context, + ctx context.Context, vaultDenom string, depositor sdk.AccAddress, - sharesOwned sdk.Dec, + sharesOwned sdkmath.LegacyDec, ) { - h.k.SynchronizeEarnReward(ctx, vaultDenom, depositor, sharesOwned) + sdkCtx := sdk.UnwrapSDKContext(ctx) + h.k.SynchronizeEarnReward(sdkCtx, vaultDenom, depositor, sharesOwned) } diff --git a/x/incentive/keeper/integration_test.go b/x/incentive/keeper/integration_test.go index efc3716913..d4703258cc 100644 --- a/x/incentive/keeper/integration_test.go +++ b/x/incentive/keeper/integration_test.go @@ -17,10 +17,10 @@ import ( // Avoid cluttering test cases with long function names func i(in int64) sdkmath.Int { return sdkmath.NewInt(in) } -func d(str string) sdk.Dec { return sdk.MustNewDecFromStr(str) } +func d(str string) sdkmath.LegacyDec { return sdkmath.LegacyMustNewDecFromStr(str) } func c(denom string, amount int64) sdk.Coin { return sdk.NewInt64Coin(denom, amount) } func dc(denom string, amount string) sdk.DecCoin { - return sdk.NewDecCoinFromDec(denom, sdk.MustNewDecFromStr(amount)) + return sdk.NewDecCoinFromDec(denom, sdkmath.LegacyMustNewDecFromStr(amount)) } func cs(coins ...sdk.Coin) sdk.Coins { return sdk.NewCoins(coins...) } func toDcs(coins ...sdk.Coin) sdk.DecCoins { return sdk.NewDecCoinsFromCoins(coins...) } @@ -39,9 +39,9 @@ func NewCDPGenStateMulti(cdc codec.JSONCodec) app.GenesisState { { Denom: "xrp", Type: "xrp-a", - LiquidationRatio: sdk.MustNewDecFromStr("2.0"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("2.0"), DebtLimit: sdk.NewInt64Coin("usdx", 500000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), // %5 apr + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"), // %5 apr LiquidationPenalty: d("0.05"), AuctionSize: i(7000000000), SpotMarketID: "xrp:usd", @@ -51,9 +51,9 @@ func NewCDPGenStateMulti(cdc codec.JSONCodec) app.GenesisState { { Denom: "btc", Type: "btc-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("1.5"), DebtLimit: sdk.NewInt64Coin("usdx", 500000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000000782997609"), // %2.5 apr + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.000000000782997609"), // %2.5 apr LiquidationPenalty: d("0.025"), AuctionSize: i(10000000), SpotMarketID: "btc:usd", @@ -63,9 +63,9 @@ func NewCDPGenStateMulti(cdc codec.JSONCodec) app.GenesisState { { Denom: "bnb", Type: "bnb-a", - LiquidationRatio: sdk.MustNewDecFromStr("1.5"), + LiquidationRatio: sdkmath.LegacyMustNewDecFromStr("1.5"), DebtLimit: sdk.NewInt64Coin("usdx", 500000000000), - StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), // %5 apr + StabilityFee: sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"), // %5 apr LiquidationPenalty: d("0.05"), AuctionSize: i(50000000000), SpotMarketID: "bnb:usd", @@ -77,7 +77,7 @@ func NewCDPGenStateMulti(cdc codec.JSONCodec) app.GenesisState { Type: "busd-a", LiquidationRatio: d("1.01"), DebtLimit: sdk.NewInt64Coin("usdx", 500000000000), - StabilityFee: sdk.OneDec(), // %0 apr + StabilityFee: sdkmath.LegacyOneDec(), // %0 apr LiquidationPenalty: d("0.05"), AuctionSize: i(10000000000), SpotMarketID: "busd:usd", @@ -97,16 +97,16 @@ func NewCDPGenStateMulti(cdc codec.JSONCodec) app.GenesisState { GovDenom: cdptypes.DefaultGovDenom, CDPs: cdptypes.CDPs{}, PreviousAccumulationTimes: cdptypes.GenesisAccumulationTimes{ - cdptypes.NewGenesisAccumulationTime("btc-a", time.Time{}, sdk.OneDec()), - cdptypes.NewGenesisAccumulationTime("xrp-a", time.Time{}, sdk.OneDec()), - cdptypes.NewGenesisAccumulationTime("busd-a", time.Time{}, sdk.OneDec()), - cdptypes.NewGenesisAccumulationTime("bnb-a", time.Time{}, sdk.OneDec()), + cdptypes.NewGenesisAccumulationTime("btc-a", time.Time{}, sdkmath.LegacyOneDec()), + cdptypes.NewGenesisAccumulationTime("xrp-a", time.Time{}, sdkmath.LegacyOneDec()), + cdptypes.NewGenesisAccumulationTime("busd-a", time.Time{}, sdkmath.LegacyOneDec()), + cdptypes.NewGenesisAccumulationTime("bnb-a", time.Time{}, sdkmath.LegacyOneDec()), }, TotalPrincipals: cdptypes.GenesisTotalPrincipals{ - cdptypes.NewGenesisTotalPrincipal("btc-a", sdk.ZeroInt()), - cdptypes.NewGenesisTotalPrincipal("xrp-a", sdk.ZeroInt()), - cdptypes.NewGenesisTotalPrincipal("busd-a", sdk.ZeroInt()), - cdptypes.NewGenesisTotalPrincipal("bnb-a", sdk.ZeroInt()), + cdptypes.NewGenesisTotalPrincipal("btc-a", sdkmath.ZeroInt()), + cdptypes.NewGenesisTotalPrincipal("xrp-a", sdkmath.ZeroInt()), + cdptypes.NewGenesisTotalPrincipal("busd-a", sdkmath.ZeroInt()), + cdptypes.NewGenesisTotalPrincipal("bnb-a", sdkmath.ZeroInt()), }, } return app.GenesisState{cdptypes.ModuleName: cdc.MustMarshalJSON(&cdpGenesis)} @@ -130,37 +130,37 @@ func NewPricefeedGenStateMultiFromTime(cdc codec.JSONCodec, t time.Time) app.Gen { MarketID: "kava:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("2.00"), + Price: sdkmath.LegacyMustNewDecFromStr("2.00"), Expiry: t.Add(expiry), }, { MarketID: "btc:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("8000.00"), + Price: sdkmath.LegacyMustNewDecFromStr("8000.00"), Expiry: t.Add(expiry), }, { MarketID: "xrp:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("0.25"), + Price: sdkmath.LegacyMustNewDecFromStr("0.25"), Expiry: t.Add(expiry), }, { MarketID: "bnb:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("17.25"), + Price: sdkmath.LegacyMustNewDecFromStr("17.25"), Expiry: t.Add(expiry), }, { MarketID: "busd:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.OneDec(), + Price: sdkmath.LegacyOneDec(), Expiry: t.Add(expiry), }, { MarketID: "zzz:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("2.00"), + Price: sdkmath.LegacyMustNewDecFromStr("2.00"), Expiry: t.Add(expiry), }, }, @@ -200,7 +200,7 @@ func NewCommitteeGenesisState(cdc codec.Codec, committeeID uint64, members ...sd "This committee is for testing.", members, []committeetypes.Permission{&committeetypes.GodPermission{}}, - sdk.MustNewDecFromStr("0.666666667"), + sdkmath.LegacyMustNewDecFromStr("0.666666667"), time.Hour*24*7, committeetypes.TALLY_OPTION_FIRST_PAST_THE_POST, ) diff --git a/x/incentive/keeper/keeper.go b/x/incentive/keeper/keeper.go index 7158c50de7..8d32aa3e72 100644 --- a/x/incentive/keeper/keeper.go +++ b/x/incentive/keeper/keeper.go @@ -1,11 +1,13 @@ package keeper import ( + sdkmath "cosmossdk.io/math" + "fmt" "time" + "cosmossdk.io/store/prefix" + storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/store/prefix" - storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/kava-labs/kava/x/incentive/types" @@ -91,7 +93,7 @@ func (k Keeper) DeleteUSDXMintingClaim(ctx sdk.Context, owner sdk.AccAddress) { // IterateUSDXMintingClaims iterates over all claim objects in the store and preforms a callback function func (k Keeper) IterateUSDXMintingClaims(ctx sdk.Context, cb func(c types.USDXMintingClaim) (stop bool)) { store := prefix.NewStore(ctx.KVStore(k.key), types.USDXMintingClaimKeyPrefix) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) + iterator := storetypes.KVStorePrefixIterator(store, []byte{}) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { var c types.USDXMintingClaim @@ -138,7 +140,7 @@ func (k Keeper) SetPreviousUSDXMintingAccrualTime(ctx sdk.Context, ctype string, // IterateUSDXMintingAccrualTimes iterates over all previous USDX minting accrual times and preforms a callback function func (k Keeper) IterateUSDXMintingAccrualTimes(ctx sdk.Context, cb func(string, time.Time) (stop bool)) { store := prefix.NewStore(ctx.KVStore(k.key), types.PreviousUSDXMintingRewardAccrualTimeKeyPrefix) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) + iterator := storetypes.KVStorePrefixIterator(store, []byte{}) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { var accrualTime time.Time @@ -153,11 +155,11 @@ func (k Keeper) IterateUSDXMintingAccrualTimes(ctx sdk.Context, cb func(string, } // GetUSDXMintingRewardFactor returns the current reward factor for an individual collateral type -func (k Keeper) GetUSDXMintingRewardFactor(ctx sdk.Context, ctype string) (factor sdk.Dec, found bool) { +func (k Keeper) GetUSDXMintingRewardFactor(ctx sdk.Context, ctype string) (factor sdkmath.LegacyDec, found bool) { store := prefix.NewStore(ctx.KVStore(k.key), types.USDXMintingRewardFactorKeyPrefix) bz := store.Get([]byte(ctype)) if bz == nil { - return sdk.ZeroDec(), false + return sdkmath.LegacyZeroDec(), false } if err := factor.Unmarshal(bz); err != nil { panic(err) @@ -166,7 +168,7 @@ func (k Keeper) GetUSDXMintingRewardFactor(ctx sdk.Context, ctype string) (facto } // SetUSDXMintingRewardFactor sets the current reward factor for an individual collateral type -func (k Keeper) SetUSDXMintingRewardFactor(ctx sdk.Context, ctype string, factor sdk.Dec) { +func (k Keeper) SetUSDXMintingRewardFactor(ctx sdk.Context, ctype string, factor sdkmath.LegacyDec) { store := prefix.NewStore(ctx.KVStore(k.key), types.USDXMintingRewardFactorKeyPrefix) bz, err := factor.Marshal() if err != nil { @@ -176,12 +178,12 @@ func (k Keeper) SetUSDXMintingRewardFactor(ctx sdk.Context, ctype string, factor } // IterateUSDXMintingRewardFactors iterates over all USDX Minting reward factor objects in the store and preforms a callback function -func (k Keeper) IterateUSDXMintingRewardFactors(ctx sdk.Context, cb func(denom string, factor sdk.Dec) (stop bool)) { +func (k Keeper) IterateUSDXMintingRewardFactors(ctx sdk.Context, cb func(denom string, factor sdkmath.LegacyDec) (stop bool)) { store := prefix.NewStore(ctx.KVStore(k.key), types.USDXMintingRewardFactorKeyPrefix) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) + iterator := storetypes.KVStorePrefixIterator(store, []byte{}) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { - var factor sdk.Dec + var factor sdkmath.LegacyDec if err := factor.Unmarshal(iterator.Value()); err != nil { panic(err) } @@ -219,7 +221,7 @@ func (k Keeper) DeleteHardLiquidityProviderClaim(ctx sdk.Context, owner sdk.AccA // IterateHardLiquidityProviderClaims iterates over all claim objects in the store and preforms a callback function func (k Keeper) IterateHardLiquidityProviderClaims(ctx sdk.Context, cb func(c types.HardLiquidityProviderClaim) (stop bool)) { store := prefix.NewStore(ctx.KVStore(k.key), types.HardLiquidityClaimKeyPrefix) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) + iterator := storetypes.KVStorePrefixIterator(store, []byte{}) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { var c types.HardLiquidityProviderClaim @@ -254,6 +256,7 @@ func (k Keeper) GetDelegatorClaim(ctx sdk.Context, addr sdk.AccAddress) (types.D // SetDelegatorClaim sets the claim in the store corresponding to the input address, collateral type, and id func (k Keeper) SetDelegatorClaim(ctx sdk.Context, c types.DelegatorClaim) { + fmt.Println("SetDelegatorClaim: ", c.Owner.String(), c.Reward, c.RewardIndexes) store := prefix.NewStore(ctx.KVStore(k.key), types.DelegatorClaimKeyPrefix) bz := k.cdc.MustMarshal(&c) store.Set(c.Owner, bz) @@ -268,7 +271,7 @@ func (k Keeper) DeleteDelegatorClaim(ctx sdk.Context, owner sdk.AccAddress) { // IterateDelegatorClaims iterates over all claim objects in the store and preforms a callback function func (k Keeper) IterateDelegatorClaims(ctx sdk.Context, cb func(c types.DelegatorClaim) (stop bool)) { store := prefix.NewStore(ctx.KVStore(k.key), types.DelegatorClaimKeyPrefix) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) + iterator := storetypes.KVStorePrefixIterator(store, []byte{}) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { var c types.DelegatorClaim @@ -317,7 +320,7 @@ func (k Keeper) DeleteSwapClaim(ctx sdk.Context, owner sdk.AccAddress) { // IterateSwapClaims iterates over all claim objects in the store and preforms a callback function func (k Keeper) IterateSwapClaims(ctx sdk.Context, cb func(c types.SwapClaim) (stop bool)) { store := prefix.NewStore(ctx.KVStore(k.key), types.SwapClaimKeyPrefix) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) + iterator := storetypes.KVStorePrefixIterator(store, []byte{}) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { var c types.SwapClaim @@ -366,7 +369,7 @@ func (k Keeper) DeleteSavingsClaim(ctx sdk.Context, owner sdk.AccAddress) { // IterateSavingsClaims iterates over all savings claim objects in the store and preforms a callback function func (k Keeper) IterateSavingsClaims(ctx sdk.Context, cb func(c types.SavingsClaim) (stop bool)) { store := prefix.NewStore(ctx.KVStore(k.key), types.SavingsClaimKeyPrefix) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) + iterator := storetypes.KVStorePrefixIterator(store, []byte{}) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { var c types.SavingsClaim @@ -415,7 +418,7 @@ func (k Keeper) DeleteEarnClaim(ctx sdk.Context, owner sdk.AccAddress) { // IterateEarnClaims iterates over all claim objects in the store and preforms a callback function func (k Keeper) IterateEarnClaims(ctx sdk.Context, cb func(c types.EarnClaim) (stop bool)) { store := prefix.NewStore(ctx.KVStore(k.key), types.EarnClaimKeyPrefix) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) + iterator := storetypes.KVStorePrefixIterator(store, []byte{}) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { var c types.EarnClaim @@ -461,7 +464,7 @@ func (k Keeper) GetHardSupplyRewardIndexes(ctx sdk.Context, denom string) (types // IterateHardSupplyRewardIndexes iterates over all Hard supply reward index objects in the store and preforms a callback function func (k Keeper) IterateHardSupplyRewardIndexes(ctx sdk.Context, cb func(denom string, indexes types.RewardIndexes) (stop bool)) { store := prefix.NewStore(ctx.KVStore(k.key), types.HardSupplyRewardIndexesKeyPrefix) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) + iterator := storetypes.KVStorePrefixIterator(store, []byte{}) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { var proto types.RewardIndexesProto @@ -474,7 +477,7 @@ func (k Keeper) IterateHardSupplyRewardIndexes(ctx sdk.Context, cb func(denom st func (k Keeper) IterateHardSupplyRewardAccrualTimes(ctx sdk.Context, cb func(string, time.Time) (stop bool)) { store := prefix.NewStore(ctx.KVStore(k.key), types.PreviousHardSupplyRewardAccrualTimeKeyPrefix) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) + iterator := storetypes.KVStorePrefixIterator(store, []byte{}) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { var accrualTime time.Time @@ -513,7 +516,7 @@ func (k Keeper) GetHardBorrowRewardIndexes(ctx sdk.Context, denom string) (types // IterateHardBorrowRewardIndexes iterates over all Hard borrow reward index objects in the store and preforms a callback function func (k Keeper) IterateHardBorrowRewardIndexes(ctx sdk.Context, cb func(denom string, indexes types.RewardIndexes) (stop bool)) { store := prefix.NewStore(ctx.KVStore(k.key), types.HardBorrowRewardIndexesKeyPrefix) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) + iterator := storetypes.KVStorePrefixIterator(store, []byte{}) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { var proto types.RewardIndexesProto @@ -526,7 +529,7 @@ func (k Keeper) IterateHardBorrowRewardIndexes(ctx sdk.Context, cb func(denom st func (k Keeper) IterateHardBorrowRewardAccrualTimes(ctx sdk.Context, cb func(string, time.Time) (stop bool)) { store := prefix.NewStore(ctx.KVStore(k.key), types.PreviousHardBorrowRewardAccrualTimeKeyPrefix) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) + iterator := storetypes.KVStorePrefixIterator(store, []byte{}) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { denom := string(iterator.Key()) @@ -565,7 +568,7 @@ func (k Keeper) SetDelegatorRewardIndexes(ctx sdk.Context, denom string, indexes // IterateDelegatorRewardIndexes iterates over all delegator reward index objects in the store and preforms a callback function func (k Keeper) IterateDelegatorRewardIndexes(ctx sdk.Context, cb func(denom string, indexes types.RewardIndexes) (stop bool)) { store := prefix.NewStore(ctx.KVStore(k.key), types.DelegatorRewardIndexesKeyPrefix) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) + iterator := storetypes.KVStorePrefixIterator(store, []byte{}) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { var proto types.RewardIndexesProto @@ -578,7 +581,7 @@ func (k Keeper) IterateDelegatorRewardIndexes(ctx sdk.Context, cb func(denom str func (k Keeper) IterateDelegatorRewardAccrualTimes(ctx sdk.Context, cb func(string, time.Time) (stop bool)) { store := prefix.NewStore(ctx.KVStore(k.key), types.PreviousDelegatorRewardAccrualTimeKeyPrefix) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) + iterator := storetypes.KVStorePrefixIterator(store, []byte{}) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { denom := string(iterator.Key()) @@ -685,7 +688,7 @@ func (k Keeper) GetSwapRewardIndexes(ctx sdk.Context, poolID string) (types.Rewa // IterateSwapRewardIndexes iterates over all swap reward index objects in the store and preforms a callback function func (k Keeper) IterateSwapRewardIndexes(ctx sdk.Context, cb func(poolID string, indexes types.RewardIndexes) (stop bool)) { store := prefix.NewStore(ctx.KVStore(k.key), types.SwapRewardIndexesKeyPrefix) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) + iterator := storetypes.KVStorePrefixIterator(store, []byte{}) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { var proto types.RewardIndexesProto @@ -721,7 +724,7 @@ func (k Keeper) SetSwapRewardAccrualTime(ctx sdk.Context, poolID string, blockTi func (k Keeper) IterateSwapRewardAccrualTimes(ctx sdk.Context, cb func(string, time.Time) (stop bool)) { store := prefix.NewStore(ctx.KVStore(k.key), types.PreviousSwapRewardAccrualTimeKeyPrefix) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) + iterator := storetypes.KVStorePrefixIterator(store, []byte{}) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { poolID := string(iterator.Key()) @@ -759,7 +762,7 @@ func (k Keeper) GetSavingsRewardIndexes(ctx sdk.Context, denom string) (types.Re // IterateSavingsRewardIndexes iterates over all savings reward index objects in the store and preforms a callback function func (k Keeper) IterateSavingsRewardIndexes(ctx sdk.Context, cb func(poolID string, indexes types.RewardIndexes) (stop bool)) { store := prefix.NewStore(ctx.KVStore(k.key), types.SavingsRewardIndexesKeyPrefix) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) + iterator := storetypes.KVStorePrefixIterator(store, []byte{}) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { var proto types.RewardIndexesProto @@ -796,7 +799,7 @@ func (k Keeper) SetSavingsRewardAccrualTime(ctx sdk.Context, poolID string, bloc // IterateSavingsRewardAccrualTimes over all the previous savings reward accrual times in the store func (k Keeper) IterateSavingsRewardAccrualTimes(ctx sdk.Context, cb func(string, time.Time) (stop bool)) { store := prefix.NewStore(ctx.KVStore(k.key), types.PreviousSavingsRewardAccrualTimeKeyPrefix) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) + iterator := storetypes.KVStorePrefixIterator(store, []byte{}) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { poolID := string(iterator.Key()) @@ -834,7 +837,7 @@ func (k Keeper) GetEarnRewardIndexes(ctx sdk.Context, vaultDenom string) (types. // IterateEarnRewardIndexes iterates over all earn reward index objects in the store and preforms a callback function func (k Keeper) IterateEarnRewardIndexes(ctx sdk.Context, cb func(vaultDenom string, indexes types.RewardIndexes) (stop bool)) { store := prefix.NewStore(ctx.KVStore(k.key), types.EarnRewardIndexesKeyPrefix) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) + iterator := storetypes.KVStorePrefixIterator(store, []byte{}) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { var proto types.RewardIndexesProto @@ -870,7 +873,7 @@ func (k Keeper) SetEarnRewardAccrualTime(ctx sdk.Context, vaultDenom string, blo func (k Keeper) IterateEarnRewardAccrualTimes(ctx sdk.Context, cb func(string, time.Time) (stop bool)) { store := prefix.NewStore(ctx.KVStore(k.key), types.PreviousEarnRewardAccrualTimeKeyPrefix) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) + iterator := storetypes.KVStorePrefixIterator(store, []byte{}) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { poolID := string(iterator.Key()) diff --git a/x/incentive/keeper/keeper_test.go b/x/incentive/keeper/keeper_test.go index 3ab619aa54..7e6a8bd52d 100644 --- a/x/incentive/keeper/keeper_test.go +++ b/x/incentive/keeper/keeper_test.go @@ -1,6 +1,7 @@ package keeper_test import ( + sdkmath "cosmossdk.io/math" "testing" "time" @@ -42,12 +43,12 @@ func (suite *KeeperTestSuite) SetupApp() { suite.keeper = suite.app.GetIncentiveKeeper() - suite.ctx = suite.app.NewContext(true, tmprototypes.Header{Time: suite.genesisTime}) + suite.ctx = suite.app.NewContextLegacy(true, tmprototypes.Header{Time: suite.genesisTime}) } func (suite *KeeperTestSuite) TestGetSetDeleteUSDXMintingClaim() { suite.SetupApp() - c := types.NewUSDXMintingClaim(suite.addrs[0], c("ukava", 1000000), types.RewardIndexes{types.NewRewardIndex("bnb-a", sdk.ZeroDec())}) + c := types.NewUSDXMintingClaim(suite.addrs[0], c("ukava", 1000000), types.RewardIndexes{types.NewRewardIndex("bnb-a", sdkmath.LegacyZeroDec())}) _, found := suite.keeper.GetUSDXMintingClaim(suite.ctx, suite.addrs[0]) suite.Require().False(found) suite.Require().NotPanics(func() { @@ -66,7 +67,7 @@ func (suite *KeeperTestSuite) TestGetSetDeleteUSDXMintingClaim() { func (suite *KeeperTestSuite) TestIterateUSDXMintingClaims() { suite.SetupApp() for i := 0; i < len(suite.addrs); i++ { - c := types.NewUSDXMintingClaim(suite.addrs[i], c("ukava", 100000), types.RewardIndexes{types.NewRewardIndex("bnb-a", sdk.ZeroDec())}) + c := types.NewUSDXMintingClaim(suite.addrs[i], c("ukava", 100000), types.RewardIndexes{types.NewRewardIndex("bnb-a", sdkmath.LegacyZeroDec())}) suite.Require().NotPanics(func() { suite.keeper.SetUSDXMintingClaim(suite.ctx, c) }) diff --git a/x/incentive/keeper/msg_server_earn_test.go b/x/incentive/keeper/msg_server_earn_test.go index 98fd3a53cf..13a8c3040d 100644 --- a/x/incentive/keeper/msg_server_earn_test.go +++ b/x/incentive/keeper/msg_server_earn_test.go @@ -1,6 +1,7 @@ package keeper_test import ( + sdkmath "cosmossdk.io/math" "time" abci "github.com/cometbft/cometbft/abci/types" @@ -118,12 +119,13 @@ func (suite *HandlerTestSuite) TestEarnLiquidClaim() { suite.Require().NoError(err) // BeginBlocker to update minter annual provisions as it starts at 0 which results in no minted coins - _ = suite.App.BeginBlocker(suite.Ctx, abci.RequestBeginBlock{}) + _, err = suite.App.BeginBlocker(suite.Ctx) + suite.Require().NoError(err) // DeliverMsgCreateValidator uses a generated pubkey, so we need to fetch // the validator to get the correct pubkey - validator1, found := sk.GetValidator(suite.Ctx, valAddr1) - suite.Require().True(found) + validator1, err := sk.GetValidator(suite.Ctx, valAddr1) + suite.Require().NoError(err) pk, err := validator1.ConsPubKey() suite.Require().NoError(err) @@ -136,7 +138,9 @@ func (suite *HandlerTestSuite) TestEarnLiquidClaim() { // Query for next block to get staking rewards suite.Ctx = suite.Ctx. WithBlockHeight(suite.Ctx.BlockHeight() + 1). - WithBlockTime(suite.Ctx.BlockTime().Add(7 * time.Second)) + WithBlockTime(suite.Ctx.BlockTime().Add(7 * time.Second)). + // TODO(boodyvo): Cannot for some reason set SignedLastBlock + WithVoteInfos([]abci.VoteInfo{{Validator: val}}) // Mint tokens mint.BeginBlocker( @@ -147,23 +151,25 @@ func (suite *HandlerTestSuite) TestEarnLiquidClaim() { // Distribute to validators, block needs votes distribution.BeginBlocker( suite.Ctx, - abci.RequestBeginBlock{ - LastCommitInfo: abci.CommitInfo{ - Votes: []abci.VoteInfo{{ - Validator: val, - SignedLastBlock: true, - }}, - }, - }, + // TODO(boodyvo): Looks like it wasn't used, proposer is extracted from ctx + //abci.RequestBeginBlock{ + // LastCommitInfo: abci.CommitInfo{ + // Votes: []abci.VoteInfo{{ + // Validator: val, + // SignedLastBlock: true, + // }}, + // }, + //}, dk, ) liquidMacc := suite.App.GetAccountKeeper().GetModuleAccount(suite.Ctx, liquidtypes.ModuleAccountName) - delegation, found := sk.GetDelegation(suite.Ctx, liquidMacc.GetAddress(), valAddr1) - suite.Require().True(found) + delegation, err := sk.GetDelegation(suite.Ctx, liquidMacc.GetAddress(), valAddr1) + suite.Require().NoError(err) // Get amount of rewards - endingPeriod := dk.IncrementValidatorPeriod(suite.Ctx, validator1) + endingPeriod, err := dk.IncrementValidatorPeriod(suite.Ctx, validator1) + suite.Require().NoError(err) // Zero rewards since this block is the same as the block it was last claimed @@ -174,7 +180,8 @@ func (suite *HandlerTestSuite) TestEarnLiquidClaim() { // 1. x/mint + x/distribution BeginBlocker // 2. CalculateDelegationRewards // 3. x/incentive BeginBlocker to claim staking rewards - delegationRewards := dk.CalculateDelegationRewards(suite.Ctx, validator1, delegation, endingPeriod) + delegationRewards, err := dk.CalculateDelegationRewards(suite.Ctx, validator1, delegation, endingPeriod) + suite.Require().NoError(err) suite.Require().False(delegationRewards.IsZero(), "expected non-zero delegation rewards") // Claim staking rewards via incentive. @@ -205,15 +212,15 @@ func (suite *HandlerTestSuite) TestEarnLiquidClaim() { // User 2 gets 99% of rewards stakingRewards1 := delegationRewards. AmountOf("ukava"). - Quo(sdk.NewDec(100)). + Quo(sdkmath.LegacyNewDec(100)). RoundInt() suite.BalanceEquals(userAddr1, preClaimBal1.Add(sdk.NewCoin("ukava", stakingRewards1))) // Total * 99 / 100 stakingRewards2 := delegationRewards. AmountOf("ukava"). - Mul(sdk.NewDec(99)). - Quo(sdk.NewDec(100)). + Mul(sdkmath.LegacyNewDec(99)). + Quo(sdkmath.LegacyNewDec(100)). RoundInt() suite.BalanceInEpsilon( diff --git a/x/incentive/keeper/msg_server_swap_test.go b/x/incentive/keeper/msg_server_swap_test.go index 366fccb829..c0b73c1464 100644 --- a/x/incentive/keeper/msg_server_swap_test.go +++ b/x/incentive/keeper/msg_server_swap_test.go @@ -42,7 +42,7 @@ func (suite *HandlerTestSuite) SetupTest() { func (suite *HandlerTestSuite) SetupApp() { suite.App = app.NewTestApp() - suite.Ctx = suite.App.NewContext(true, tmproto.Header{Height: 1, Time: suite.genesisTime}) + suite.Ctx = suite.App.NewContextLegacy(true, tmproto.Header{Height: 1, Time: suite.genesisTime}) } func (suite *HandlerTestSuite) SetupWithGenState(builders ...testutil.GenesisBuilder) { diff --git a/x/incentive/keeper/payout.go b/x/incentive/keeper/payout.go index a50ef5a701..c3544e1b03 100644 --- a/x/incentive/keeper/payout.go +++ b/x/incentive/keeper/payout.go @@ -39,7 +39,7 @@ func (k Keeper) SendTimeLockedCoinsToAccount(ctx sdk.Context, senderModule strin } switch acc.(type) { - case *vestingtypes.ContinuousVestingAccount, authtypes.ModuleAccountI: + case *vestingtypes.ContinuousVestingAccount, sdk.ModuleAccountI: return errorsmod.Wrapf(types.ErrInvalidAccountType, "%T", acc) case *vestingtypes.PeriodicVestingAccount: return k.SendTimeLockedCoinsToPeriodicVestingAccount(ctx, senderModule, recipientAddr, amt, length) @@ -71,7 +71,11 @@ func (k Keeper) SendTimeLockedCoinsToBaseAccount(ctx sdk.Context, senderModule s bacc := authtypes.NewBaseAccount(acc.GetAddress(), acc.GetPubKey(), acc.GetAccountNumber(), acc.GetSequence()) newPeriods := vestingtypes.Periods{types.NewPeriod(amt, length)} - bva := vestingtypes.NewBaseVestingAccount(bacc, amt, ctx.BlockTime().Unix()+length) + bva, err := vestingtypes.NewBaseVestingAccount(bacc, amt, ctx.BlockTime().Unix()+length) + if err != nil { + return err + } + pva := vestingtypes.NewPeriodicVestingAccountRaw(bva, ctx.BlockTime().Unix(), newPeriods) k.accountKeeper.SetAccount(ctx, pva) diff --git a/x/incentive/keeper/payout_test.go b/x/incentive/keeper/payout_test.go index 0c20bfce19..39a07112ab 100644 --- a/x/incentive/keeper/payout_test.go +++ b/x/incentive/keeper/payout_test.go @@ -9,7 +9,6 @@ import ( tmprototypes "github.com/cometbft/cometbft/proto/tendermint/types" sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" "github.com/kava-labs/kava/app" @@ -54,7 +53,7 @@ func (suite *PayoutTestSuite) SetupApp() { suite.hardKeeper = suite.app.GetHardKeeper() suite.cdpKeeper = suite.app.GetCDPKeeper() - suite.ctx = suite.app.NewContext(true, tmprototypes.Header{Time: suite.genesisTime}) + suite.ctx = suite.app.NewContextLegacy(true, tmprototypes.Header{Time: suite.genesisTime}) } func (suite *PayoutTestSuite) SetupWithGenState(authBuilder app.AuthBankGenesisBuilder, incentBuilder testutil.IncentiveGenesisBuilder, hardBuilder testutil.HardGenesisBuilder) { @@ -70,12 +69,12 @@ func (suite *PayoutTestSuite) SetupWithGenState(authBuilder app.AuthBankGenesisB ) } -func (suite *PayoutTestSuite) getAccount(addr sdk.AccAddress) authtypes.AccountI { +func (suite *PayoutTestSuite) getAccount(addr sdk.AccAddress) sdk.AccountI { ak := suite.app.GetAccountKeeper() return ak.GetAccount(suite.ctx, addr) } -func (suite *PayoutTestSuite) getModuleAccount(name string) authtypes.ModuleAccountI { +func (suite *PayoutTestSuite) getModuleAccount(name string) sdk.ModuleAccountI { ak := suite.app.GetAccountKeeper() return ak.GetModuleAccount(suite.ctx, name) } diff --git a/x/incentive/keeper/querier.go b/x/incentive/keeper/querier.go index fc5832b33c..62eec59b68 100644 --- a/x/incentive/keeper/querier.go +++ b/x/incentive/keeper/querier.go @@ -16,19 +16,26 @@ const ( ) // GetStakingAPR returns the total APR for staking and incentive rewards -func GetStakingAPR(ctx sdk.Context, k Keeper, params types.Params) (sdk.Dec, error) { +func GetStakingAPR(ctx sdk.Context, k Keeper, params types.Params) (sdkmath.LegacyDec, error) { // Get staking APR + incentive APR inflationRate := k.mintKeeper.GetMinter(ctx).Inflation - communityTax := k.distrKeeper.GetCommunityTax(ctx) + communityTax, err := k.distrKeeper.GetCommunityTax(ctx) + if err != nil { + return sdkmath.LegacyZeroDec(), err + } + + bondedTokens, err := k.stakingKeeper.TotalBondedTokens(ctx) + if err != nil { + return sdkmath.LegacyZeroDec(), err + } - bondedTokens := k.stakingKeeper.TotalBondedTokens(ctx) circulatingSupply := k.bankKeeper.GetSupply(ctx, types.BondDenom) // Staking APR = (Inflation Rate * (1 - Community Tax)) / (Bonded Tokens / Circulating Supply) stakingAPR := inflationRate. - Mul(sdk.OneDec().Sub(communityTax)). - Quo(sdk.NewDecFromInt(bondedTokens). - Quo(sdk.NewDecFromInt(circulatingSupply.Amount))) + Mul(sdkmath.LegacyOneDec().Sub(communityTax)). + Quo(sdkmath.LegacyNewDecFromInt(bondedTokens). + Quo(sdkmath.LegacyNewDecFromInt(circulatingSupply.Amount))) // Get incentive APR bkavaRewardPeriod, found := params.EarnRewardPeriods.GetMultiRewardPeriod(liquidtypes.DefaultDerivativeDenom) @@ -39,7 +46,7 @@ func GetStakingAPR(ctx sdk.Context, k Keeper, params types.Params) (sdk.Dec, err // Total amount of bkava in earn vaults, this may be lower than total bank // supply of bkava as some bkava may not be deposited in earn vaults - totalEarnBkavaDeposited := sdk.ZeroInt() + totalEarnBkavaDeposited := sdkmath.ZeroInt() var iterErr error k.earnKeeper.IterateVaultRecords(ctx, func(record earntypes.VaultRecord) (stop bool) { @@ -59,14 +66,14 @@ func GetStakingAPR(ctx sdk.Context, k Keeper, params types.Params) (sdk.Dec, err }) if iterErr != nil { - return sdk.ZeroDec(), iterErr + return sdkmath.LegacyZeroDec(), iterErr } // Incentive APR = rewards per second * seconds per year / total supplied to earn vaults // Override collateral type to use "kava" instead of "bkava" when fetching incentiveAPY, err := GetAPYFromMultiRewardPeriod(ctx, k, types.BondDenom, bkavaRewardPeriod, totalEarnBkavaDeposited) if err != nil { - return sdk.ZeroDec(), err + return sdkmath.LegacyZeroDec(), err } totalAPY := stakingAPR.Add(incentiveAPY) @@ -80,24 +87,24 @@ func GetAPYFromMultiRewardPeriod( collateralType string, rewardPeriod types.MultiRewardPeriod, totalSupply sdkmath.Int, -) (sdk.Dec, error) { +) (sdkmath.LegacyDec, error) { if totalSupply.IsZero() { - return sdk.ZeroDec(), nil + return sdkmath.LegacyZeroDec(), nil } // Get USD value of collateral type collateralUSDValue, err := k.pricefeedKeeper.GetCurrentPrice(ctx, getMarketID(collateralType)) if err != nil { - return sdk.ZeroDec(), fmt.Errorf( + return sdkmath.LegacyZeroDec(), fmt.Errorf( "failed to get price for incentive collateralType %s with market ID %s: %w", collateralType, getMarketID(collateralType), err, ) } // Total USD value of the collateral type total supply - totalSupplyUSDValue := sdk.NewDecFromInt(totalSupply).Mul(collateralUSDValue.Price) + totalSupplyUSDValue := sdkmath.LegacyNewDecFromInt(totalSupply).Mul(collateralUSDValue.Price) - totalUSDRewardsPerSecond := sdk.ZeroDec() + totalUSDRewardsPerSecond := sdkmath.LegacyZeroDec() // In many cases, RewardsPerSecond are assets that are different from the // CollateralType, so we need to use the USD value of CollateralType and @@ -106,10 +113,10 @@ func GetAPYFromMultiRewardPeriod( // Get USD value of 1 unit of reward asset type, using TWAP rewardDenomUSDValue, err := k.pricefeedKeeper.GetCurrentPrice(ctx, getMarketID(reward.Denom)) if err != nil { - return sdk.ZeroDec(), fmt.Errorf("failed to get price for RewardsPerSecond asset %s: %w", reward.Denom, err) + return sdkmath.LegacyZeroDec(), fmt.Errorf("failed to get price for RewardsPerSecond asset %s: %w", reward.Denom, err) } - rewardPerSecond := sdk.NewDecFromInt(reward.Amount).Mul(rewardDenomUSDValue.Price) + rewardPerSecond := sdkmath.LegacyNewDecFromInt(reward.Amount).Mul(rewardDenomUSDValue.Price) totalUSDRewardsPerSecond = totalUSDRewardsPerSecond.Add(rewardPerSecond) } diff --git a/x/incentive/keeper/querier_test.go b/x/incentive/keeper/querier_test.go index 30bf0cbefb..5ceb21d54a 100644 --- a/x/incentive/keeper/querier_test.go +++ b/x/incentive/keeper/querier_test.go @@ -24,8 +24,8 @@ func TestQuerierTestSuite(t *testing.T) { } func (suite *QuerierTestSuite) TestGetStakingAPR() { - communityTax := sdk.MustNewDecFromStr("0.90") - inflation := sdk.MustNewDecFromStr("0.75") + communityTax := sdkmath.LegacyMustNewDecFromStr("0.90") + inflation := sdkmath.LegacyMustNewDecFromStr("0.75") bondedTokens := int64(120_000_000_000000) liquidStakedTokens := int64(60_000_000_000000) @@ -35,8 +35,8 @@ func (suite *QuerierTestSuite) TestGetStakingAPR() { usdcSupply := int64(2_500_000_000000) earnKeeper := newFakeEarnKeeper(). - addVault("bkava-asdf", earntypes.NewVaultShare("bkava-asdf", sdk.NewDec(liquidStakedTokens))). - addVault(usdcDenom, earntypes.NewVaultShare(usdcDenom, sdk.NewDec(usdcSupply))) + addVault("bkava-asdf", earntypes.NewVaultShare("bkava-asdf", sdkmath.LegacyNewDec(liquidStakedTokens))). + addVault(usdcDenom, earntypes.NewVaultShare(usdcDenom, sdkmath.LegacyNewDec(usdcSupply))) suite.keeper = suite.NewTestKeeper(&fakeParamSubspace{}). WithDistrKeeper( @@ -44,7 +44,7 @@ func (suite *QuerierTestSuite) TestGetStakingAPR() { ). WithMintKeeper( newFakeMintKeeper(). - setMinter(minttypes.NewMinter(inflation, sdk.OneDec())), + setMinter(minttypes.NewMinter(inflation, sdkmath.LegacyOneDec())), ). WithStakingKeeper( newFakeStakingKeeper().addBondedTokens(bondedTokens), @@ -58,15 +58,15 @@ func (suite *QuerierTestSuite) TestGetStakingAPR() { ). WithPricefeedKeeper( newFakePricefeedKeeper(). - setPrice(pricefeedtypes.NewCurrentPrice("kava:usd:30", sdk.MustNewDecFromStr("1.5"))). - setPrice(pricefeedtypes.NewCurrentPrice("usdc:usd:30", sdk.OneDec())), + setPrice(pricefeedtypes.NewCurrentPrice("kava:usd:30", sdkmath.LegacyMustNewDecFromStr("1.5"))). + setPrice(pricefeedtypes.NewCurrentPrice("usdc:usd:30", sdkmath.LegacyOneDec())), ). Build() // ~18% APR expectedStakingAPY := inflation. - Mul(sdk.OneDec().Sub(communityTax)). - Quo(sdk.NewDec(bondedTokens).Quo(sdk.NewDec(totalSupply))) + Mul(sdkmath.LegacyOneDec().Sub(communityTax)). + Quo(sdkmath.LegacyNewDec(bondedTokens).Quo(sdkmath.LegacyNewDec(totalSupply))) // Staking APR = (Inflation Rate * (1 - Community Tax)) / (Bonded Tokens / Circulating Supply) aprWithoutIncentives, err := keeper.GetStakingAPR(suite.ctx, suite.keeper, types.Params{}) @@ -105,7 +105,7 @@ func (suite *QuerierTestSuite) TestGetStakingAPR() { aprWithIncentives, err := keeper.GetStakingAPR(suite.ctx, suite.keeper, params) suite.Require().NoError(err) // Approx 10% increase in APR from incentives - suite.Require().Equal(sdk.MustNewDecFromStr("0.280711113729177500"), aprWithIncentives) + suite.Require().Equal(sdkmath.LegacyMustNewDecFromStr("0.280711113729177500"), aprWithIncentives) suite.Require().Truef( aprWithIncentives.GT(aprWithoutIncentives), @@ -127,7 +127,7 @@ func (suite *QuerierTestSuite) TestGetStakingAPR() { ) suite.Require().NoError(err) suite.Require().Equal( - sdk.MustNewDecFromStr("0.099981734400000000"), + sdkmath.LegacyMustNewDecFromStr("0.099981734400000000"), apy, "usdc apy should be approx 10%", ) diff --git a/x/incentive/keeper/rewards_borrow.go b/x/incentive/keeper/rewards_borrow.go index 44de0fb1ab..fa17733568 100644 --- a/x/incentive/keeper/rewards_borrow.go +++ b/x/incentive/keeper/rewards_borrow.go @@ -46,7 +46,7 @@ func (k Keeper) AccumulateHardBorrowRewards(ctx sdk.Context, rewardPeriod types. // The normalized borrow is also used for each individual borrow's source shares amount. Normalized amounts do not change except through // user input. This is essential as claims must be synced before any change to a source shares amount. The actual borrowed amounts cannot // be used as they increase every block due to interest. -func (k Keeper) getHardBorrowTotalSourceShares(ctx sdk.Context, denom string) sdk.Dec { +func (k Keeper) getHardBorrowTotalSourceShares(ctx sdk.Context, denom string) sdkmath.LegacyDec { totalBorrowedCoins, found := k.hardKeeper.GetBorrowedCoins(ctx) if !found { // assume no coins have been borrowed @@ -57,11 +57,11 @@ func (k Keeper) getHardBorrowTotalSourceShares(ctx sdk.Context, denom string) sd interestFactor, found := k.hardKeeper.GetBorrowInterestFactor(ctx, denom) if !found { // assume nothing has been borrowed so the factor starts at it's default value - interestFactor = sdk.OneDec() + interestFactor = sdkmath.LegacyOneDec() } // return borrowed/factor to get the "pre interest" value of the current total borrowed - return sdk.NewDecFromInt(totalBorrowed).Quo(interestFactor) + return sdkmath.LegacyNewDecFromInt(totalBorrowed).Quo(interestFactor) } // InitializeHardBorrowReward initializes the borrow-side of a hard liquidity provider claim @@ -108,7 +108,7 @@ func (k Keeper) SynchronizeHardBorrowReward(ctx sdk.Context, borrow hardtypes.Bo // synchronizeSingleHardBorrowReward synchronizes a single rewarded borrow denom in a hard claim. // It returns the claim without setting in the store. // The public methods for accessing and modifying claims are preferred over this one. Direct modification of claims is easy to get wrong. -func (k Keeper) synchronizeSingleHardBorrowReward(ctx sdk.Context, claim types.HardLiquidityProviderClaim, denom string, sourceShares sdk.Dec) types.HardLiquidityProviderClaim { +func (k Keeper) synchronizeSingleHardBorrowReward(ctx sdk.Context, claim types.HardLiquidityProviderClaim, denom string, sourceShares sdkmath.LegacyDec) types.HardLiquidityProviderClaim { globalRewardIndexes, found := k.GetHardBorrowRewardIndexes(ctx, denom) if !found { // The global factor is only not found if @@ -182,7 +182,7 @@ func (k Keeper) UpdateHardBorrowIndexDenoms(ctx sdk.Context, borrow hardtypes.Bo // // It returns an error if newIndexes does not contain all CollateralTypes from oldIndexes, or if any value of oldIndex.RewardFactor > newIndex.RewardFactor. // This should never happen, as it would mean that a global reward index has decreased in value, or that a global reward index has been deleted from state. -func (k Keeper) CalculateRewards(oldIndexes, newIndexes types.RewardIndexes, sourceShares sdk.Dec) (sdk.Coins, error) { +func (k Keeper) CalculateRewards(oldIndexes, newIndexes types.RewardIndexes, sourceShares sdkmath.LegacyDec) (sdk.Coins, error) { // check for missing CollateralType's for _, oldIndex := range oldIndexes { if newIndex, found := newIndexes.Get(oldIndex.CollateralType); !found { @@ -193,7 +193,7 @@ func (k Keeper) CalculateRewards(oldIndexes, newIndexes types.RewardIndexes, sou for _, newIndex := range newIndexes { oldFactor, found := oldIndexes.Get(newIndex.CollateralType) if !found { - oldFactor = sdk.ZeroDec() + oldFactor = sdkmath.LegacyZeroDec() } rewardAmount, err := k.CalculateSingleReward(oldFactor, newIndex.RewardFactor, sourceShares) @@ -215,7 +215,7 @@ func (k Keeper) CalculateRewards(oldIndexes, newIndexes types.RewardIndexes, sou // // Returns an error if oldIndex > newIndex. This should never happen, as it would mean that a global reward index has decreased in value, // or that a global reward index has been deleted from state. -func (k Keeper) CalculateSingleReward(oldIndex, newIndex, sourceShares sdk.Dec) (sdkmath.Int, error) { +func (k Keeper) CalculateSingleReward(oldIndex, newIndex, sourceShares sdkmath.LegacyDec) (sdkmath.Int, error) { increase := newIndex.Sub(oldIndex) if increase.IsNegative() { return sdkmath.Int{}, errorsmod.Wrapf(types.ErrDecreasingRewardFactor, "old: %v, new: %v", oldIndex, newIndex) diff --git a/x/incentive/keeper/rewards_borrow_sync_test.go b/x/incentive/keeper/rewards_borrow_sync_test.go index 8f9f9dc314..7bdf007e66 100644 --- a/x/incentive/keeper/rewards_borrow_sync_test.go +++ b/x/incentive/keeper/rewards_borrow_sync_test.go @@ -318,7 +318,7 @@ func (builder BorrowBuilder) Build() hardtypes.Borrow { return builder.Borrow } // WithSourceShares adds a borrow amount and factor such that the source shares for this borrow is equal to specified. // With a factor of 1, the borrow amount is the source shares. This picks an arbitrary factor to ensure factors are accounted for in production code. func (builder BorrowBuilder) WithSourceShares(denom string, shares int64) BorrowBuilder { - if !builder.Amount.AmountOf(denom).Equal(sdk.ZeroInt()) { + if !builder.Amount.AmountOf(denom).Equal(sdkmath.ZeroInt()) { panic("adding to amount with existing denom not implemented") } if _, f := builder.Index.GetInterestFactor(denom); f { @@ -326,7 +326,7 @@ func (builder BorrowBuilder) WithSourceShares(denom string, shares int64) Borrow } // pick arbitrary factor - factor := sdk.MustNewDecFromStr("2") + factor := sdkmath.LegacyMustNewDecFromStr("2") // Calculate borrow amount that would equal the requested source shares given the above factor. amt := sdkmath.NewInt(shares).Mul(factor.RoundInt()) @@ -352,7 +352,7 @@ func TestCalculateRewards(t *testing.T) { } type args struct { oldIndexes, newIndexes types.RewardIndexes - sourceAmount sdk.Dec + sourceAmount sdkmath.LegacyDec } testcases := []struct { name string @@ -512,8 +512,8 @@ func TestCalculateSingleReward(t *testing.T) { reward sdkmath.Int } type args struct { - oldIndex, newIndex sdk.Dec - sourceAmount sdk.Dec + oldIndex, newIndex sdkmath.LegacyDec + sourceAmount sdkmath.LegacyDec } testcases := []struct { name string @@ -551,7 +551,7 @@ func TestCalculateSingleReward(t *testing.T) { sourceAmount: d("1000000000"), }, expected: expected{ - reward: sdk.ZeroInt(), + reward: sdkmath.ZeroInt(), }, }, } diff --git a/x/incentive/keeper/rewards_borrow_test.go b/x/incentive/keeper/rewards_borrow_test.go index c76dd2ff68..99ec66a6d0 100644 --- a/x/incentive/keeper/rewards_borrow_test.go +++ b/x/incentive/keeper/rewards_borrow_test.go @@ -5,7 +5,6 @@ import ( "time" sdkmath "cosmossdk.io/math" - abci "github.com/cometbft/cometbft/abci/types" tmproto "github.com/cometbft/cometbft/proto/tendermint/types" sdk "github.com/cosmos/cosmos-sdk/types" proposaltypes "github.com/cosmos/cosmos-sdk/x/params/types/proposal" @@ -126,7 +125,7 @@ func (suite *BorrowRewardsTestSuite) SetupApp() { suite.hardKeeper = suite.app.GetHardKeeper() suite.committeeKeeper = suite.app.GetCommitteeKeeper() - suite.ctx = suite.app.NewContext(true, tmproto.Header{Height: 1, Time: suite.genesisTime}) + suite.ctx = suite.app.NewContextLegacy(true, tmproto.Header{Height: 1, Time: suite.genesisTime}) } func (suite *BorrowRewardsTestSuite) SetupWithGenState(authBuilder *app.AuthBankGenesisBuilder, incentBuilder testutil.IncentiveGenesisBuilder, hardBuilder testutil.HardGenesisBuilder) { @@ -585,7 +584,7 @@ func (suite *BorrowRewardsTestSuite) TestSynchronizeHardBorrowReward() { incentBuilder = incentBuilder.WithSimpleBorrowRewardPeriod(tc.args.incentiveBorrowRewardDenom, tc.args.rewardsPerSecond) } // Set the minimum borrow to 0 to allow testing small borrows - hardBuilder := NewHardGenStateMulti(suite.genesisTime).WithMinBorrow(sdk.ZeroDec()) + hardBuilder := NewHardGenStateMulti(suite.genesisTime).WithMinBorrow(sdkmath.LegacyZeroDec()) suite.SetupWithGenState(authBuilder, incentBuilder, hardBuilder) @@ -610,7 +609,7 @@ func (suite *BorrowRewardsTestSuite) TestSynchronizeHardBorrowReward() { for _, expectedRewardIndex := range tc.args.expectedRewardIndexes { currRewardIndex, found := multiRewardIndex.RewardIndexes.GetRewardIndex(expectedRewardIndex.CollateralType) suite.Require().True(found) - suite.Require().Equal(sdk.ZeroDec(), currRewardIndex.RewardFactor) + suite.Require().Equal(sdkmath.LegacyZeroDec(), currRewardIndex.RewardFactor) } // Run accumulator at several intervals @@ -728,7 +727,7 @@ func (suite *BorrowRewardsTestSuite) TestSynchronizeHardBorrowReward() { // 7. Run committee module's begin blocker to enact proposal suite.NotPanics(func() { - committee.BeginBlocker(suite.ctx, abci.RequestBeginBlock{}, suite.committeeKeeper) + committee.BeginBlocker(suite.ctx, suite.committeeKeeper) }) // We need to accumulate hard supply-side rewards again @@ -1045,7 +1044,7 @@ func (suite *BorrowRewardsTestSuite) TestSimulateHardBorrowRewardSynchronization for _, expectedRewardIndex := range tc.args.expectedRewardIndexes { currRewardIndex, found := multiRewardIndexPre.RewardIndexes.GetRewardIndex(expectedRewardIndex.CollateralType) suite.Require().True(found) - suite.Require().Equal(sdk.ZeroDec(), currRewardIndex.RewardFactor) + suite.Require().Equal(sdkmath.LegacyZeroDec(), currRewardIndex.RewardFactor) } // Check that the synced claim held in memory has properly simulated syncing diff --git a/x/incentive/keeper/rewards_delegator.go b/x/incentive/keeper/rewards_delegator.go index 77d58a17be..0ae7b3b2c0 100644 --- a/x/incentive/keeper/rewards_delegator.go +++ b/x/incentive/keeper/rewards_delegator.go @@ -1,8 +1,9 @@ package keeper import ( + "bytes" + sdkmath "cosmossdk.io/math" "fmt" - sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" @@ -25,7 +26,6 @@ func (k Keeper) AccumulateDelegatorRewards(ctx sdk.Context, rewardPeriod types.M acc := types.NewAccumulator(previousAccrualTime, indexes) totalSource := k.getDelegatorTotalSourceShares(ctx, rewardPeriod.CollateralType) - acc.Accumulate(rewardPeriod, totalSource, ctx.BlockTime()) k.SetPreviousDelegatorRewardAccrualTime(ctx, rewardPeriod.CollateralType, acc.PreviousAccumulationTime) @@ -37,10 +37,15 @@ func (k Keeper) AccumulateDelegatorRewards(ctx sdk.Context, rewardPeriod types.M // getDelegatorTotalSourceShares fetches the sum of all source shares for a delegator reward. // In the case of delegation, this is the total tokens staked to bonded validators. -func (k Keeper) getDelegatorTotalSourceShares(ctx sdk.Context, denom string) sdk.Dec { - totalBonded := k.stakingKeeper.TotalBondedTokens(ctx) +func (k Keeper) getDelegatorTotalSourceShares(ctx sdk.Context, denom string) sdkmath.LegacyDec { + totalBonded, err := k.stakingKeeper.TotalBondedTokens(ctx) + if err != nil { + // TODO(boodyvo): should we panic here or return zero? + //panic(fmt.Sprintf("could not retrieve total bonded tokens: %v", err)) + return sdkmath.LegacyZeroDec() + } - return sdk.NewDecFromInt(totalBonded) + return sdkmath.LegacyNewDecFromInt(totalBonded) } // InitializeDelegatorReward initializes the reward index of a delegator claim @@ -98,7 +103,7 @@ func (k Keeper) SynchronizeDelegatorRewards(ctx sdk.Context, delegator sdk.AccAd userRewardIndexes, found := claim.RewardIndexes.Get(types.BondDenom) if !found { // Normally the reward indexes should always be found. - // However if there were no delegator rewards (ie no reward period in params) then a reward period is added, existing claims will not have the factor. + // However, if there were no delegator rewards (ie no reward period in params) then a reward period is added, existing claims will not have the factor. // So given the reward period was just added, assume the starting value for any global reward indexes, which is an empty slice. userRewardIndexes = types.RewardIndexes{} } @@ -117,17 +122,24 @@ func (k Keeper) SynchronizeDelegatorRewards(ctx sdk.Context, delegator sdk.AccAd k.SetDelegatorClaim(ctx, claim) } -func (k Keeper) GetTotalDelegated(ctx sdk.Context, delegator sdk.AccAddress, valAddr sdk.ValAddress, shouldIncludeValidator bool) sdk.Dec { - totalDelegated := sdk.ZeroDec() +func (k Keeper) GetTotalDelegated(ctx sdk.Context, delegator sdk.AccAddress, valAddr sdk.ValAddress, shouldIncludeValidator bool) sdkmath.LegacyDec { + totalDelegated := sdkmath.LegacyZeroDec() + + delegations, err := k.stakingKeeper.GetDelegatorDelegations(ctx, delegator, 200) + if err != nil { + // TODO(boodyvo): should we panic here or return zero? + return totalDelegated + } - delegations := k.stakingKeeper.GetDelegatorDelegations(ctx, delegator, 200) for _, delegation := range delegations { - validator, found := k.stakingKeeper.GetValidator(ctx, delegation.GetValidatorAddr()) - if !found { + validator, err := k.stakingKeeper.GetValidator(ctx, []byte(delegation.GetValidatorAddr())) + if err != nil { continue } - if validator.GetOperator().Equals(valAddr) { + //if validator.GetOperator().Equals(valAddr) { + // TODO(boodyvo): was updated. Should be like this? + if bytes.Equal([]byte(validator.GetOperator()), valAddr) { if shouldIncludeValidator { // do nothing, so the validator is included regardless of bonded status } else { @@ -178,7 +190,7 @@ func (k Keeper) SimulateDelegatorSynchronization(ctx sdk.Context, claim types.De for _, globalRewardIndex := range globalRewardIndexes { userRewardIndex, foundUserRewardIndex := userRewardIndexes.RewardIndexes.GetRewardIndex(globalRewardIndex.CollateralType) if !foundUserRewardIndex { - userRewardIndex = types.NewRewardIndex(globalRewardIndex.CollateralType, sdk.ZeroDec()) + userRewardIndex = types.NewRewardIndex(globalRewardIndex.CollateralType, sdkmath.LegacyZeroDec()) userRewardIndexes.RewardIndexes = append(userRewardIndexes.RewardIndexes, userRewardIndex) claim.RewardIndexes[userRewardIndexIndex].RewardIndexes = append(claim.RewardIndexes[userRewardIndexIndex].RewardIndexes, userRewardIndex) } diff --git a/x/incentive/keeper/rewards_delegator_init_test.go b/x/incentive/keeper/rewards_delegator_init_test.go index 42015e4304..eb079f5dcf 100644 --- a/x/incentive/keeper/rewards_delegator_init_test.go +++ b/x/incentive/keeper/rewards_delegator_init_test.go @@ -51,12 +51,15 @@ func (suite *InitializeDelegatorRewardTests) TestClaimIsSyncedAndIndexesAreSetWh ValidatorAddress: validatorAddress.String(), Shares: d("1000"), }}, - validators: stakingtypes.Validators{{ - OperatorAddress: validatorAddress.String(), - Status: stakingtypes.Bonded, - Tokens: i(1000), - DelegatorShares: d("1000"), - }}, + validators: stakingtypes.Validators{ + Validators: []stakingtypes.Validator{{ + OperatorAddress: validatorAddress.String(), + Status: stakingtypes.Bonded, + Tokens: i(1000), + DelegatorShares: d("1000"), + }, + }, + }, } suite.keeper = suite.NewKeeper(&fakeParamSubspace{}, nil, nil, nil, nil, sk, nil, nil, nil, nil) diff --git a/x/incentive/keeper/rewards_delegator_sync_test.go b/x/incentive/keeper/rewards_delegator_sync_test.go index 829aacaee3..b33e412a40 100644 --- a/x/incentive/keeper/rewards_delegator_sync_test.go +++ b/x/incentive/keeper/rewards_delegator_sync_test.go @@ -1,6 +1,7 @@ package keeper_test import ( + sdkmath "cosmossdk.io/math" "testing" sdk "github.com/cosmos/cosmos-sdk/types" @@ -94,7 +95,7 @@ func (suite *SynchronizeDelegatorRewardTests) TestRewardIsUnchangedWhenGlobalFac }, }, validators: stakingtypes.Validators{ - unslashedBondedValidator(validatorAddress), + Validators: []stakingtypes.Validator{unslashedBondedValidator(validatorAddress)}, }, } suite.keeper = suite.NewKeeper(&fakeParamSubspace{}, nil, nil, nil, nil, stakingKeeper, nil, nil, nil, nil) @@ -139,7 +140,7 @@ func (suite *SynchronizeDelegatorRewardTests) TestRewardIsIncreasedWhenNewReward }, }, validators: stakingtypes.Validators{ - unslashedBondedValidator(validatorAddress), + Validators: []stakingtypes.Validator{unslashedBondedValidator(validatorAddress)}, }, } suite.keeper = suite.NewKeeper(&fakeParamSubspace{}, nil, nil, nil, nil, stakingKeeper, nil, nil, nil, nil) @@ -189,7 +190,7 @@ func (suite *SynchronizeDelegatorRewardTests) TestRewardIsIncreasedWhenGlobalFac }, }, validators: stakingtypes.Validators{ - unslashedBondedValidator(validatorAddress), + Validators: []stakingtypes.Validator{unslashedBondedValidator(validatorAddress)}, }, } suite.keeper = suite.NewKeeper(&fakeParamSubspace{}, nil, nil, nil, nil, stakingKeeper, nil, nil, nil, nil) @@ -247,7 +248,7 @@ func unslashedBondedValidator(address sdk.ValAddress) stakingtypes.Validator { // Set the tokens and shares equal so then // a _delegator's_ token amount is equal to their shares amount Tokens: i(1e12), - DelegatorShares: sdk.NewDec(1e12), + DelegatorShares: sdkmath.LegacyNewDec(1e12), } } @@ -259,7 +260,7 @@ func unslashedNotBondedValidator(address sdk.ValAddress) stakingtypes.Validator // Set the tokens and shares equal so then // a _delegator's_ token amount is equal to their shares amount Tokens: i(1e12), - DelegatorShares: sdk.NewDec(1e12), + DelegatorShares: sdkmath.LegacyNewDec(1e12), } } @@ -293,10 +294,12 @@ func (suite *SynchronizeDelegatorRewardTests) TestGetDelegatedWhenValAddrIsNil() }, }, validators: stakingtypes.Validators{ - unslashedBondedValidator(validatorAddresses[0]), - unslashedBondedValidator(validatorAddresses[1]), - unslashedNotBondedValidator(validatorAddresses[2]), - unslashedNotBondedValidator(validatorAddresses[3]), + Validators: []stakingtypes.Validator{ + unslashedBondedValidator(validatorAddresses[0]), + unslashedBondedValidator(validatorAddresses[1]), + unslashedNotBondedValidator(validatorAddresses[2]), + unslashedNotBondedValidator(validatorAddresses[3]), + }, }, } suite.keeper = suite.NewKeeper(&fakeParamSubspace{}, nil, nil, nil, nil, stakingKeeper, nil, nil, nil, nil) @@ -337,10 +340,12 @@ func (suite *SynchronizeDelegatorRewardTests) TestGetDelegatedWhenExcludingAVali }, }, validators: stakingtypes.Validators{ - unslashedBondedValidator(validatorAddresses[0]), - unslashedBondedValidator(validatorAddresses[1]), - unslashedNotBondedValidator(validatorAddresses[2]), - unslashedNotBondedValidator(validatorAddresses[3]), + Validators: []stakingtypes.Validator{ + unslashedBondedValidator(validatorAddresses[0]), + unslashedBondedValidator(validatorAddresses[1]), + unslashedNotBondedValidator(validatorAddresses[2]), + unslashedNotBondedValidator(validatorAddresses[3]), + }, }, } suite.keeper = suite.NewKeeper(&fakeParamSubspace{}, nil, nil, nil, nil, stakingKeeper, nil, nil, nil, nil) @@ -381,10 +386,12 @@ func (suite *SynchronizeDelegatorRewardTests) TestGetDelegatedWhenIncludingAVali }, }, validators: stakingtypes.Validators{ - unslashedBondedValidator(validatorAddresses[0]), - unslashedBondedValidator(validatorAddresses[1]), - unslashedNotBondedValidator(validatorAddresses[2]), - unslashedNotBondedValidator(validatorAddresses[3]), + Validators: []stakingtypes.Validator{ + unslashedBondedValidator(validatorAddresses[0]), + unslashedBondedValidator(validatorAddresses[1]), + unslashedNotBondedValidator(validatorAddresses[2]), + unslashedNotBondedValidator(validatorAddresses[3]), + }, }, } suite.keeper = suite.NewKeeper(&fakeParamSubspace{}, nil, nil, nil, nil, stakingKeeper, nil, nil, nil, nil) diff --git a/x/incentive/keeper/rewards_delegator_test.go b/x/incentive/keeper/rewards_delegator_test.go index 6402e17a66..32ac3510a6 100644 --- a/x/incentive/keeper/rewards_delegator_test.go +++ b/x/incentive/keeper/rewards_delegator_test.go @@ -1,15 +1,14 @@ package keeper_test import ( + "fmt" "testing" "time" sdkmath "cosmossdk.io/math" - abci "github.com/cometbft/cometbft/abci/types" tmproto "github.com/cometbft/cometbft/proto/tendermint/types" "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/staking" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/stretchr/testify/suite" @@ -54,7 +53,7 @@ func (suite *DelegatorRewardsTestSuite) SetupApp() { suite.keeper = suite.app.GetIncentiveKeeper() suite.stakingKeeper = suite.app.GetStakingKeeper() - suite.ctx = suite.app.NewContext(true, tmproto.Header{Height: 1, Time: suite.genesisTime, ChainID: app.TestChainId}) + suite.ctx = suite.app.NewContextLegacy(true, tmproto.Header{Height: 1, Time: suite.genesisTime, ChainID: app.TestChainId}) } func (suite *DelegatorRewardsTestSuite) SetupWithGenState(authBuilder *app.AuthBankGenesisBuilder, incentBuilder testutil.IncentiveGenesisBuilder) { @@ -140,13 +139,15 @@ func (suite *DelegatorRewardsTestSuite) TestAccumulateDelegatorRewards() { err := suite.deliverMsgCreateValidator(suite.ctx, suite.validatorAddrs[0], tc.args.delegation) suite.Require().NoError(err) - err = suite.deliverMsgDelegate(suite.ctx, suite.addrs[0], suite.validatorAddrs[0], tc.args.delegation) - suite.Require().NoError(err) + + //err = suite.deliverMsgDelegate(suite.ctx, suite.addrs[0], suite.validatorAddrs[0], tc.args.delegation) + //suite.Require().NoError(err) // Delete genesis validator to not influence rewards suite.app.DeleteGenesisValidator(suite.T(), suite.ctx) - staking.EndBlocker(suite.ctx, suite.stakingKeeper) + _, err = suite.stakingKeeper.EndBlocker(suite.ctx) + suite.Require().NoError(err) // Set up chain context at future time runAtTime := suite.ctx.BlockTime().Add(time.Duration(int(time.Second) * tc.args.timeElapsed)) @@ -239,11 +240,13 @@ func (suite *DelegatorRewardsTestSuite) TestSynchronizeDelegatorReward() { suite.SetupWithGenState(authBuilder, incentBuilder) // Create validator account - staking.BeginBlocker(suite.ctx, suite.stakingKeeper) + err := suite.stakingKeeper.BeginBlocker(suite.ctx) + suite.Require().NoError(err) selfDelegationCoins := c("ukava", 1_000_000) - err := suite.deliverMsgCreateValidator(suite.ctx, suite.validatorAddrs[0], selfDelegationCoins) + err = suite.deliverMsgCreateValidator(suite.ctx, suite.validatorAddrs[0], selfDelegationCoins) + suite.Require().NoError(err) + _, err = suite.stakingKeeper.EndBlocker(suite.ctx) suite.Require().NoError(err) - staking.EndBlocker(suite.ctx, suite.stakingKeeper) // Delete genesis validator to not influence rewards suite.app.DeleteGenesisValidator(suite.T(), suite.ctx) @@ -253,8 +256,8 @@ func (suite *DelegatorRewardsTestSuite) TestSynchronizeDelegatorReward() { suite.Require().NoError(err) // Check that validator account has been created and delegation was successful - valAcc, found := suite.stakingKeeper.GetValidator(suite.ctx, suite.validatorAddrs[0]) - suite.True(found) + valAcc, err := suite.stakingKeeper.GetValidator(suite.ctx, suite.validatorAddrs[0]) + suite.Require().NoError(err) suite.Require().Equal(valAcc.Status, stakingtypes.Bonded) suite.Require().Equal(valAcc.Tokens, tc.args.delegation.Amount.Add(selfDelegationCoins.Amount)) @@ -262,7 +265,7 @@ func (suite *DelegatorRewardsTestSuite) TestSynchronizeDelegatorReward() { claim, found := suite.keeper.GetDelegatorClaim(suite.ctx, suite.addrs[0]) suite.Require().True(found) for _, rewardIndex := range claim.RewardIndexes[0].RewardIndexes { - suite.Require().Equal(sdk.ZeroDec(), rewardIndex.RewardFactor) + suite.Require().Equal(sdkmath.LegacyZeroDec(), rewardIndex.RewardFactor) } // Run accumulator at several intervals @@ -374,13 +377,14 @@ func (suite *DelegatorRewardsTestSuite) TestSimulateDelegatorRewardSynchronizati // Delete genesis validator to not influence rewards suite.app.DeleteGenesisValidator(suite.T(), suite.ctx) - staking.EndBlocker(suite.ctx, suite.stakingKeeper) + _, err = suite.stakingKeeper.EndBlocker(suite.ctx) + suite.Require().NoError(err) // Check that Staking hooks initialized a DelegatorClaim claim, found := suite.keeper.GetDelegatorClaim(suite.ctx, suite.addrs[0]) suite.Require().True(found) for _, rewardIndex := range claim.RewardIndexes[0].RewardIndexes { - suite.Require().Equal(sdk.ZeroDec(), rewardIndex.RewardFactor) + suite.Require().Equal(sdkmath.LegacyZeroDec(), rewardIndex.RewardFactor) } // Run accumulator at several intervals @@ -421,11 +425,11 @@ func (suite *DelegatorRewardsTestSuite) TestSimulateDelegatorRewardSynchronizati func (suite *DelegatorRewardsTestSuite) deliverMsgCreateValidator(ctx sdk.Context, address sdk.ValAddress, selfDelegation sdk.Coin) error { msg, err := stakingtypes.NewMsgCreateValidator( - address, + address.String(), ed25519.GenPrivKey().PubKey(), selfDelegation, - stakingtypes.Description{}, - stakingtypes.NewCommissionRates(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()), + stakingtypes.NewDescription("foo_moniker", "", "", "", ""), + stakingtypes.NewCommissionRates(sdkmath.LegacyZeroDec(), sdkmath.LegacyZeroDec(), sdkmath.LegacyZeroDec()), sdkmath.NewInt(1_000_000), ) if err != nil { @@ -437,10 +441,11 @@ func (suite *DelegatorRewardsTestSuite) deliverMsgCreateValidator(ctx sdk.Contex return err } +// TODO(boodyvo): looks like a bug related to only tests, as we don't use this ctx func (suite *DelegatorRewardsTestSuite) deliverMsgDelegate(ctx sdk.Context, delegator sdk.AccAddress, validator sdk.ValAddress, amount sdk.Coin) error { msg := stakingtypes.NewMsgDelegate( - delegator, - validator, + delegator.String(), + validator.String(), amount, ) @@ -451,9 +456,10 @@ func (suite *DelegatorRewardsTestSuite) deliverMsgDelegate(ctx sdk.Context, dele func (suite *DelegatorRewardsTestSuite) deliverMsgRedelegate(ctx sdk.Context, delegator sdk.AccAddress, sourceValidator, destinationValidator sdk.ValAddress, amount sdk.Coin) error { msg := stakingtypes.NewMsgBeginRedelegate( - delegator, - sourceValidator, - destinationValidator, + // TODO(boodyvo): should it be string + delegator.String(), + sourceValidator.String(), + destinationValidator.String(), amount, ) @@ -483,12 +489,13 @@ func (suite *DelegatorRewardsTestSuite) TestUnbondingValidatorSyncsClaim() { blockDuration := 10 * time.Second // Reduce the size of the validator set - stakingParams := suite.app.GetStakingKeeper().GetParams(suite.ctx) + stakingParams, err := suite.app.GetStakingKeeper().GetParams(suite.ctx) + suite.Require().NoError(err) stakingParams.MaxValidators = 2 suite.app.GetStakingKeeper().SetParams(suite.ctx, stakingParams) // Create 3 validators - err := suite.deliverMsgCreateValidator(suite.ctx, suite.validatorAddrs[0], c(bondDenom, 10_000_000)) + err = suite.deliverMsgCreateValidator(suite.ctx, suite.validatorAddrs[0], c(bondDenom, 10_000_000)) suite.Require().NoError(err) err = suite.deliverMsgCreateValidator(suite.ctx, suite.validatorAddrs[1], c(bondDenom, 5_000_000)) suite.Require().NoError(err) @@ -496,26 +503,31 @@ func (suite *DelegatorRewardsTestSuite) TestUnbondingValidatorSyncsClaim() { suite.Require().NoError(err) // End the block so top validators become bonded - _ = suite.app.EndBlocker(suite.ctx, abci.RequestEndBlock{}) + _, err = suite.app.EndBlocker(suite.ctx) + suite.Require().NoError(err) suite.ctx = suite.ctx.WithBlockTime(suite.genesisTime.Add(1 * blockDuration)) - _ = suite.app.BeginBlocker(suite.ctx, abci.RequestBeginBlock{}) // height and time in header are ignored by module begin blockers + _, err = suite.app.BeginBlocker(suite.ctx) // height and time in header are ignored by module begin blockers + suite.Require().NoError(err) // Delegate to a bonded validator from the test user. This will initialize their incentive claim. err = suite.deliverMsgDelegate(suite.ctx, suite.addrs[0], suite.validatorAddrs[1], c(bondDenom, 1_000_000)) suite.Require().NoError(err) // Start a new block to accumulate some delegation rewards for the user. - _ = suite.app.EndBlocker(suite.ctx, abci.RequestEndBlock{}) + _, err = suite.app.EndBlocker(suite.ctx) + suite.Require().NoError(err) suite.ctx = suite.ctx.WithBlockTime(suite.genesisTime.Add(2 * blockDuration)) - _ = suite.app.BeginBlocker(suite.ctx, abci.RequestBeginBlock{}) // height and time in header are ignored by module begin blockers + _, err = suite.app.BeginBlocker(suite.ctx) // height and time in header are ignored by module begin blockers + suite.Require().NoError(err) // Delegate to the unbonded validator to push it into the bonded validator set, pushing out the user's delegated validator err = suite.deliverMsgDelegate(suite.ctx, suite.addrs[2], suite.validatorAddrs[2], c(bondDenom, 8_000_000)) suite.Require().NoError(err) // End the block to start unbonding the user's validator - _ = suite.app.EndBlocker(suite.ctx, abci.RequestEndBlock{}) + _, err = suite.app.EndBlocker(suite.ctx) + suite.Require().NoError(err) // but don't start the next block as it will accumulate delegator rewards and we won't be able to tell if the user's reward was synced. // Check that the user's claim has been synced. ie rewards added, index updated @@ -537,7 +549,8 @@ func (suite *DelegatorRewardsTestSuite) TestUnbondingValidatorSyncsClaim() { // Run another block and check the claim is not accumulating more rewards suite.ctx = suite.ctx.WithBlockTime(suite.genesisTime.Add(3 * blockDuration)) - _ = suite.app.BeginBlocker(suite.ctx, abci.RequestBeginBlock{}) + _, err = suite.app.BeginBlocker(suite.ctx) + suite.Require().NoError(err) suite.keeper.SynchronizeDelegatorRewards(suite.ctx, suite.addrs[0], nil, false) @@ -577,12 +590,13 @@ func (suite *DelegatorRewardsTestSuite) TestBondingValidatorSyncsClaim() { blockDuration := 10 * time.Second // Reduce the size of the validator set - stakingParams := suite.app.GetStakingKeeper().GetParams(suite.ctx) + stakingParams, err := suite.app.GetStakingKeeper().GetParams(suite.ctx) + suite.Require().NoError(err) stakingParams.MaxValidators = 2 suite.app.GetStakingKeeper().SetParams(suite.ctx, stakingParams) // Create 3 validators - err := suite.deliverMsgCreateValidator(suite.ctx, suite.validatorAddrs[0], c(bondDenom, 10_000_000)) + err = suite.deliverMsgCreateValidator(suite.ctx, suite.validatorAddrs[0], c(bondDenom, 10_000_000)) suite.Require().NoError(err) err = suite.deliverMsgCreateValidator(suite.ctx, suite.validatorAddrs[1], c(bondDenom, 5_000_000)) suite.Require().NoError(err) @@ -590,26 +604,31 @@ func (suite *DelegatorRewardsTestSuite) TestBondingValidatorSyncsClaim() { suite.Require().NoError(err) // End the block so top validators become bonded - _ = suite.app.EndBlocker(suite.ctx, abci.RequestEndBlock{}) + _, err = suite.app.EndBlocker(suite.ctx) + suite.Require().NoError(err) suite.ctx = suite.ctx.WithBlockTime(suite.genesisTime.Add(1 * blockDuration)) - _ = suite.app.BeginBlocker(suite.ctx, abci.RequestBeginBlock{}) // height and time in header are ignored by module begin blockers + _, err = suite.app.BeginBlocker(suite.ctx) // height and time in header are ignored by module begin blockers + suite.Require().NoError(err) // Delegate to an unbonded validator from the test user. This will initialize their incentive claim. err = suite.deliverMsgDelegate(suite.ctx, suite.addrs[0], suite.validatorAddrs[2], c(bondDenom, 1_000_000)) suite.Require().NoError(err) // Start a new block to accumulate some delegation rewards globally. - _ = suite.app.EndBlocker(suite.ctx, abci.RequestEndBlock{}) + _, err = suite.app.EndBlocker(suite.ctx) + suite.Require().NoError(err) suite.ctx = suite.ctx.WithBlockTime(suite.genesisTime.Add(2 * blockDuration)) - _ = suite.app.BeginBlocker(suite.ctx, abci.RequestBeginBlock{}) + _, err = suite.app.BeginBlocker(suite.ctx) + suite.Require().NoError(err) // Delegate to the user's unbonded validator to push it into the bonded validator set err = suite.deliverMsgDelegate(suite.ctx, suite.addrs[2], suite.validatorAddrs[2], c(bondDenom, 4_000_000)) suite.Require().NoError(err) // End the block to bond the user's validator - _ = suite.app.EndBlocker(suite.ctx, abci.RequestEndBlock{}) + _, err = suite.app.EndBlocker(suite.ctx) + suite.Require().NoError(err) // but don't start the next block as it will accumulate delegator rewards and we won't be able to tell if the user's reward was synced. // Check that the user's claim has been synced. ie rewards added, index updated @@ -617,6 +636,7 @@ func (suite *DelegatorRewardsTestSuite) TestBondingValidatorSyncsClaim() { suite.Require().True(found) rewardIndexes, found := suite.keeper.GetDelegatorRewardIndexes(suite.ctx, bondDenom) + fmt.Println("rewardIndexes", rewardIndexes) suite.Require().True(found) globalIndex, found := rewardIndexes.Get(rewardsPerSecond[0].Denom) suite.Require().True(found) @@ -631,7 +651,8 @@ func (suite *DelegatorRewardsTestSuite) TestBondingValidatorSyncsClaim() { // Run another block and check the claim is accumulating more rewards suite.ctx = suite.ctx.WithBlockTime(suite.genesisTime.Add(3 * blockDuration)) - _ = suite.app.BeginBlocker(suite.ctx, abci.RequestBeginBlock{}) + _, err = suite.app.BeginBlocker(suite.ctx) + suite.Require().NoError(err) suite.keeper.SynchronizeDelegatorRewards(suite.ctx, suite.addrs[0], nil, false) @@ -669,21 +690,24 @@ func (suite *DelegatorRewardsTestSuite) TestSlashingValidatorSyncsClaim() { blockDuration := 10 * time.Second // Reduce the size of the validator set - stakingParams := suite.app.GetStakingKeeper().GetParams(suite.ctx) + stakingParams, err := suite.app.GetStakingKeeper().GetParams(suite.ctx) + suite.Require().NoError(err) stakingParams.MaxValidators = 2 suite.app.GetStakingKeeper().SetParams(suite.ctx, stakingParams) // Create 2 validators - err := suite.deliverMsgCreateValidator(suite.ctx, suite.validatorAddrs[0], c(bondDenom, 10_000_000)) + err = suite.deliverMsgCreateValidator(suite.ctx, suite.validatorAddrs[0], c(bondDenom, 10_000_000)) suite.Require().NoError(err) err = suite.deliverMsgCreateValidator(suite.ctx, suite.validatorAddrs[1], c(bondDenom, 10_000_000)) suite.Require().NoError(err) // End the block so validators become bonded - _ = suite.app.EndBlocker(suite.ctx, abci.RequestEndBlock{}) + _, err = suite.app.EndBlocker(suite.ctx) + suite.Require().NoError(err) suite.ctx = suite.ctx.WithBlockTime(suite.genesisTime.Add(1 * blockDuration)) - _ = suite.app.BeginBlocker(suite.ctx, abci.RequestBeginBlock{}) // height and time in header are ignored by module begin blockers + _, err = suite.app.BeginBlocker(suite.ctx) // height and time in header are ignored by module begin blockers + suite.Require().NoError(err) // Delegate to a bonded validator from the test user. This will initialize their incentive claim. err = suite.deliverMsgDelegate(suite.ctx, suite.addrs[0], suite.validatorAddrs[1], c(bondDenom, 1_000_000)) @@ -700,16 +724,18 @@ func (suite *DelegatorRewardsTestSuite) TestSlashingValidatorSyncsClaim() { suite.True(initialClaim.Reward.Empty()) // Initial claim should not have any rewards // Start a new block to accumulate some delegation rewards for the user. - _ = suite.app.EndBlocker(suite.ctx, abci.RequestEndBlock{}) + _, err = suite.app.EndBlocker(suite.ctx) + suite.Require().NoError(err) suite.ctx = suite.ctx.WithBlockTime(suite.genesisTime.Add(2 * blockDuration)) - _ = suite.app.BeginBlocker(suite.ctx, abci.RequestBeginBlock{}) // height and time in header are ignored by module begin blockers + _, err = suite.app.BeginBlocker(suite.ctx) // height and time in header are ignored by module begin blockers + suite.Require().NoError(err) // Fetch validator and slash them stakingKeeper := suite.app.GetStakingKeeper() - validator, found := stakingKeeper.GetValidator(suite.ctx, suite.validatorAddrs[1]) - suite.Require().True(found) + validator, err := stakingKeeper.GetValidator(suite.ctx, suite.validatorAddrs[1]) + suite.Require().NoError(err) suite.Require().True(validator.GetTokens().IsPositive()) - fraction := sdk.NewDecWithPrec(5, 1) + fraction := sdkmath.LegacyNewDecWithPrec(5, 1) consAddr, err := validator.GetConsAddr() suite.Require().NoError(err) @@ -768,9 +794,11 @@ func (suite *DelegatorRewardsTestSuite) TestRedelegationSyncsClaim() { suite.Require().NoError(err) // Start a new block to accumulate some delegation rewards globally. - _ = suite.app.EndBlocker(suite.ctx, abci.RequestEndBlock{}) + _, err = suite.app.EndBlocker(suite.ctx) + suite.Require().NoError(err) suite.ctx = suite.ctx.WithBlockTime(suite.genesisTime.Add(1 * blockDuration)) - _ = suite.app.BeginBlocker(suite.ctx, abci.RequestBeginBlock{}) // height and time in header are ignored by module begin blockers + _, err = suite.app.BeginBlocker(suite.ctx) // height and time in header are ignored by module begin blockers + suite.Require().NoError(err) // Redelegate the user's delegation between the two validators. This should trigger hooks that sync the user's claim. err = suite.deliverMsgRedelegate(suite.ctx, suite.addrs[0], suite.validatorAddrs[0], suite.validatorAddrs[1], c(bondDenom, 1_000_000)) diff --git a/x/incentive/keeper/rewards_earn.go b/x/incentive/keeper/rewards_earn.go index 6d176efd95..a678cb52b5 100644 --- a/x/incentive/keeper/rewards_earn.go +++ b/x/incentive/keeper/rewards_earn.go @@ -51,9 +51,9 @@ func GetProportionalRewardsPerSecond( } for _, rewardCoin := range rewardPeriod.RewardsPerSecond { - scaledAmount := sdk.NewDecFromInt(rewardCoin.Amount). - Mul(sdk.NewDecFromInt(singleBkavaSupply)). - Quo(sdk.NewDecFromInt(totalBkavaSupply)) + scaledAmount := sdkmath.LegacyNewDecFromInt(rewardCoin.Amount). + Mul(sdkmath.LegacyNewDecFromInt(singleBkavaSupply)). + Quo(sdkmath.LegacyNewDecFromInt(totalBkavaSupply)) newRate = newRate.Add(sdk.NewDecCoinFromDec(rewardCoin.Denom, scaledAmount)) } @@ -156,7 +156,7 @@ func (k Keeper) accumulateBkavaEarnRewards( totalSourceShares := k.getEarnTotalSourceShares(ctx, collateralType) var increment types.RewardIndexes - if totalSourceShares.GT(sdk.ZeroDec()) { + if totalSourceShares.GT(sdkmath.LegacyZeroDec()) { // Divide total rewards by total shares to get the reward **per share** // Leave as nil if no source shares increment = types.NewRewardIndexesFromCoins(rewards).Quo(totalSourceShares) @@ -258,10 +258,10 @@ func (k Keeper) accumulateEarnRewards( // getEarnTotalSourceShares fetches the sum of all source shares for a earn reward. // In the case of earn, these are the total (earn module) shares in a particular vault. -func (k Keeper) getEarnTotalSourceShares(ctx sdk.Context, vaultDenom string) sdk.Dec { +func (k Keeper) getEarnTotalSourceShares(ctx sdk.Context, vaultDenom string) sdkmath.LegacyDec { totalShares, found := k.earnKeeper.GetVaultTotalShares(ctx, vaultDenom) if !found { - return sdk.ZeroDec() + return sdkmath.LegacyZeroDec() } return totalShares.Amount } @@ -289,7 +289,7 @@ func (k Keeper) SynchronizeEarnReward( ctx sdk.Context, vaultDenom string, owner sdk.AccAddress, - shares sdk.Dec, + shares sdkmath.LegacyDec, ) { claim, found := k.GetEarnClaim(ctx, owner) if !found { @@ -306,7 +306,7 @@ func (k *Keeper) synchronizeEarnReward( claim types.EarnClaim, vaultDenom string, owner sdk.AccAddress, - shares sdk.Dec, + shares sdkmath.LegacyDec, ) types.EarnClaim { globalRewardIndexes, found := k.GetEarnRewardIndexes(ctx, vaultDenom) if !found { diff --git a/x/incentive/keeper/rewards_earn_accum_integration_test.go b/x/incentive/keeper/rewards_earn_accum_integration_test.go index 892323dbde..f8c413c3b4 100644 --- a/x/incentive/keeper/rewards_earn_accum_integration_test.go +++ b/x/incentive/keeper/rewards_earn_accum_integration_test.go @@ -1,6 +1,7 @@ package keeper_test import ( + sdkmath "cosmossdk.io/math" "testing" "time" @@ -65,9 +66,9 @@ func (suite *AccumulateEarnRewardsIntegrationTests) SetupTest() { stakingBuilder := testutil.NewStakingGenesisBuilder() mintBuilder := testutil.NewMintGenesisBuilder(). - WithInflationMax(sdk.OneDec()). - WithInflationMin(sdk.OneDec()). - WithMinter(sdk.OneDec(), sdk.ZeroDec()). + WithInflationMax(sdkmath.LegacyOneDec()). + WithInflationMin(sdkmath.LegacyOneDec()). + WithMinter(sdkmath.LegacyOneDec(), sdkmath.LegacyZeroDec()). WithMintDenom("ukava") suite.StartChainWithBuilders( @@ -137,25 +138,36 @@ func (suite *AccumulateEarnRewardsIntegrationTests) TestStateUpdatedWhenBlockTim val0 := suite.GetAbciValidator(suite.valAddrs[0]) val1 := suite.GetAbciValidator(suite.valAddrs[1]) + suite.Ctx = suite.Ctx.WithVoteInfos([]abci.VoteInfo{ + { + Validator: val0, + //SignedLastBlock: true, + }, + { + Validator: val1, + //SignedLastBlock: true, + }, + }) + // Mint tokens, distribute to validators, claim staking rewards // 1 hour later _, resBeginBlock := suite.NextBlockAfterWithReq( - 1*time.Hour, - abci.RequestEndBlock{}, - abci.RequestBeginBlock{ - LastCommitInfo: abci.CommitInfo{ - Votes: []abci.VoteInfo{ - { - Validator: val0, - SignedLastBlock: true, - }, - { - Validator: val1, - SignedLastBlock: true, - }, - }, - }, - }, + 1 * time.Hour, + //abci.RequestEndBlock{}, + //abci.RequestBeginBlock{ + // LastCommitInfo: abci.CommitInfo{ + // Votes: []abci.VoteInfo{ + // { + // Validator: val0, + // SignedLastBlock: true, + // }, + // { + // Validator: val1, + // SignedLastBlock: true, + // }, + // }, + // }, + //}, ) validatorRewards, _ := suite.GetBeginBlockClaimedStakingRewards(resBeginBlock) @@ -168,13 +180,13 @@ func (suite *AccumulateEarnRewardsIntegrationTests) TestStateUpdatedWhenBlockTim suite.StoredEarnTimeEquals(derivative0.Denom, suite.Ctx.BlockTime()) suite.StoredEarnTimeEquals(derivative1.Denom, suite.Ctx.BlockTime()) - stakingRewardIndexes0 := sdk.NewDecFromInt(validatorRewards[suite.valAddrs[0].String()]. + stakingRewardIndexes0 := sdkmath.LegacyNewDecFromInt(validatorRewards[suite.valAddrs[0].String()]. AmountOf("ukava")). - Quo(sdk.NewDecFromInt(derivative0.Amount)) + Quo(sdkmath.LegacyNewDecFromInt(derivative0.Amount)) - stakingRewardIndexes1 := sdk.NewDecFromInt(validatorRewards[suite.valAddrs[1].String()]. + stakingRewardIndexes1 := sdkmath.LegacyNewDecFromInt(validatorRewards[suite.valAddrs[1].String()]. AmountOf("ukava")). - Quo(sdk.NewDecFromInt(derivative1.Amount)) + Quo(sdkmath.LegacyNewDecFromInt(derivative1.Amount)) suite.StoredEarnIndexesEqual(derivative0.Denom, types.RewardIndexes{ { @@ -261,25 +273,36 @@ func (suite *AccumulateEarnRewardsIntegrationTests) TestStateUpdatedWhenBlockTim val0 := suite.GetAbciValidator(suite.valAddrs[0]) val1 := suite.GetAbciValidator(suite.valAddrs[1]) + suite.Ctx = suite.Ctx.WithVoteInfos([]abci.VoteInfo{ + { + Validator: val0, + //SignedLastBlock: true, + }, + { + Validator: val1, + //SignedLastBlock: true, + }, + }) + // Mint tokens, distribute to validators, claim staking rewards // 1 hour later _, resBeginBlock := suite.NextBlockAfterWithReq( - 1*time.Hour, - abci.RequestEndBlock{}, - abci.RequestBeginBlock{ - LastCommitInfo: abci.CommitInfo{ - Votes: []abci.VoteInfo{ - { - Validator: val0, - SignedLastBlock: true, - }, - { - Validator: val1, - SignedLastBlock: true, - }, - }, - }, - }, + 1 * time.Hour, + //abci.RequestEndBlock{}, + //abci.RequestBeginBlock{ + // LastCommitInfo: abci.CommitInfo{ + // Votes: []abci.VoteInfo{ + // { + // Validator: val0, + // SignedLastBlock: true, + // }, + // { + // Validator: val1, + // SignedLastBlock: true, + // }, + // }, + // }, + //}, ) validatorRewards, _ := suite.GetBeginBlockClaimedStakingRewards(resBeginBlock) @@ -293,13 +316,13 @@ func (suite *AccumulateEarnRewardsIntegrationTests) TestStateUpdatedWhenBlockTim suite.StoredEarnTimeEquals(derivative1.Denom, suite.Ctx.BlockTime()) // Divided by deposit amounts, not bank supply amounts - stakingRewardIndexes0 := sdk.NewDecFromInt(validatorRewards[suite.valAddrs[0].String()]. + stakingRewardIndexes0 := sdkmath.LegacyNewDecFromInt(validatorRewards[suite.valAddrs[0].String()]. AmountOf("ukava")). - Quo(sdk.NewDecFromInt(depositAmount0.Amount)) + Quo(sdkmath.LegacyNewDecFromInt(depositAmount0.Amount)) - stakingRewardIndexes1 := sdk.NewDecFromInt(validatorRewards[suite.valAddrs[1].String()]. + stakingRewardIndexes1 := sdkmath.LegacyNewDecFromInt(validatorRewards[suite.valAddrs[1].String()]. AmountOf("ukava")). - Quo(sdk.NewDecFromInt(depositAmount1.Amount)) + Quo(sdkmath.LegacyNewDecFromInt(depositAmount1.Amount)) // Slightly increased rewards due to less bkava deposited suite.StoredEarnIndexesEqual(derivative0.Denom, types.RewardIndexes{ @@ -449,25 +472,36 @@ func (suite *AccumulateEarnRewardsIntegrationTests) TestNoAccumulationWhenSource val0 := suite.GetAbciValidator(suite.valAddrs[0]) val1 := suite.GetAbciValidator(suite.valAddrs[1]) + suite.Ctx = suite.Ctx.WithVoteInfos([]abci.VoteInfo{ + { + Validator: val0, + //SignedLastBlock: true, + }, + { + Validator: val1, + //SignedLastBlock: true, + }, + }) + // Mint tokens, distribute to validators, claim staking rewards // 1 hour later _, _ = suite.NextBlockAfterWithReq( - 1*time.Hour, - abci.RequestEndBlock{}, - abci.RequestBeginBlock{ - LastCommitInfo: abci.CommitInfo{ - Votes: []abci.VoteInfo{ - { - Validator: val0, - SignedLastBlock: true, - }, - { - Validator: val1, - SignedLastBlock: true, - }, - }, - }, - }, + 1 * time.Hour, + //abci.RequestEndBlock{}, + //abci.RequestBeginBlock{ + // LastCommitInfo: abci.CommitInfo{ + // Votes: []abci.VoteInfo{ + // { + // Validator: val0, + // SignedLastBlock: true, + // }, + // { + // Validator: val1, + // SignedLastBlock: true, + // }, + // }, + // }, + //}, ) // check time and factors @@ -507,23 +541,34 @@ func (suite *AccumulateEarnRewardsIntegrationTests) TestStateAddedWhenStateDoesN val0 := suite.GetAbciValidator(suite.valAddrs[0]) val1 := suite.GetAbciValidator(suite.valAddrs[1]) - _, resBeginBlock := suite.NextBlockAfterWithReq( - 1*time.Hour, - abci.RequestEndBlock{}, - abci.RequestBeginBlock{ - LastCommitInfo: abci.CommitInfo{ - Votes: []abci.VoteInfo{ - { - Validator: val0, - SignedLastBlock: true, - }, - { - Validator: val1, - SignedLastBlock: true, - }, - }, - }, + suite.Ctx = suite.Ctx.WithVoteInfos([]abci.VoteInfo{ + { + Validator: val0, + //SignedLastBlock: true, }, + { + Validator: val1, + //SignedLastBlock: true, + }, + }) + + _, resBeginBlock := suite.NextBlockAfterWithReq( + 1 * time.Hour, + //abci.RequestEndBlock{}, + //abci.RequestBeginBlock{ + // LastCommitInfo: abci.CommitInfo{ + // Votes: []abci.VoteInfo{ + // { + // Validator: val0, + // SignedLastBlock: true, + // }, + // { + // Validator: val1, + // SignedLastBlock: true, + // }, + // }, + // }, + //}, ) // After the second accumulation both current block time and indexes should be stored. @@ -532,13 +577,13 @@ func (suite *AccumulateEarnRewardsIntegrationTests) TestStateAddedWhenStateDoesN validatorRewards0, _ := suite.GetBeginBlockClaimedStakingRewards(resBeginBlock) - firstStakingRewardIndexes0 := sdk.NewDecFromInt(validatorRewards0[suite.valAddrs[0].String()]. + firstStakingRewardIndexes0 := sdkmath.LegacyNewDecFromInt(validatorRewards0[suite.valAddrs[0].String()]. AmountOf("ukava")). - Quo(sdk.NewDecFromInt(derivative0.Amount)) + Quo(sdkmath.LegacyNewDecFromInt(derivative0.Amount)) - firstStakingRewardIndexes1 := sdk.NewDecFromInt(validatorRewards0[suite.valAddrs[1].String()]. + firstStakingRewardIndexes1 := sdkmath.LegacyNewDecFromInt(validatorRewards0[suite.valAddrs[1].String()]. AmountOf("ukava")). - Quo(sdk.NewDecFromInt(derivative1.Amount)) + Quo(sdkmath.LegacyNewDecFromInt(derivative1.Amount)) // After the first accumulation only the current block time should be stored. // The indexes will be empty as no time has passed since the previous block because it didn't exist. @@ -559,23 +604,34 @@ func (suite *AccumulateEarnRewardsIntegrationTests) TestStateAddedWhenStateDoesN }, }) - _, resBeginBlock = suite.NextBlockAfterWithReq( - 1*time.Hour, - abci.RequestEndBlock{}, - abci.RequestBeginBlock{ - LastCommitInfo: abci.CommitInfo{ - Votes: []abci.VoteInfo{ - { - Validator: val0, - SignedLastBlock: true, - }, - { - Validator: val1, - SignedLastBlock: true, - }, - }, - }, + suite.Ctx = suite.Ctx.WithVoteInfos([]abci.VoteInfo{ + { + Validator: val0, + //SignedLastBlock: true, }, + { + Validator: val1, + //SignedLastBlock: true, + }, + }) + + _, resBeginBlock = suite.NextBlockAfterWithReq( + 1 * time.Hour, + //abci.RequestEndBlock{}, + //abci.RequestBeginBlock{ + // LastCommitInfo: abci.CommitInfo{ + // Votes: []abci.VoteInfo{ + // { + // Validator: val0, + // SignedLastBlock: true, + // }, + // { + // Validator: val1, + // SignedLastBlock: true, + // }, + // }, + // }, + //}, ) // After the second accumulation both current block time and indexes should be stored. @@ -584,13 +640,13 @@ func (suite *AccumulateEarnRewardsIntegrationTests) TestStateAddedWhenStateDoesN validatorRewards1, _ := suite.GetBeginBlockClaimedStakingRewards(resBeginBlock) - secondStakingRewardIndexes0 := sdk.NewDecFromInt(validatorRewards1[suite.valAddrs[0].String()]. + secondStakingRewardIndexes0 := sdkmath.LegacyNewDecFromInt(validatorRewards1[suite.valAddrs[0].String()]. AmountOf("ukava")). - Quo(sdk.NewDecFromInt(derivative0.Amount)) + Quo(sdkmath.LegacyNewDecFromInt(derivative0.Amount)) - secondStakingRewardIndexes1 := sdk.NewDecFromInt(validatorRewards1[suite.valAddrs[1].String()]. + secondStakingRewardIndexes1 := sdkmath.LegacyNewDecFromInt(validatorRewards1[suite.valAddrs[1].String()]. AmountOf("ukava")). - Quo(sdk.NewDecFromInt(derivative1.Amount)) + Quo(sdkmath.LegacyNewDecFromInt(derivative1.Amount)) // Second accumulation has both staking rewards and incentive rewards // ukava incentive rewards: 3600 * 1000 / (2 * 1000000) == 1.8 diff --git a/x/incentive/keeper/rewards_earn_accum_test.go b/x/incentive/keeper/rewards_earn_accum_test.go index c83e47edce..37925efb08 100644 --- a/x/incentive/keeper/rewards_earn_accum_test.go +++ b/x/incentive/keeper/rewards_earn_accum_test.go @@ -1,10 +1,10 @@ package keeper_test import ( + sdkmath "cosmossdk.io/math" "testing" "time" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/suite" earntypes "github.com/kava-labs/kava/x/earn/types" @@ -261,10 +261,10 @@ func (suite *AccumulateEarnRewardsTests) TestStateUpdatedWhenBlockTimeHasIncreas { CollateralType: "ukava", RewardFactor: d("4.154285714285714286"). // base incentive - Add(sdk.NewDecFromInt(vaultDenom1Supply). // staking rewards - QuoInt64(10). - MulInt64(3600). - Quo(vault1Shares), + Add(sdkmath.LegacyNewDecFromInt(vaultDenom1Supply). // staking rewards + QuoInt64(10). + MulInt64(3600). + Quo(vault1Shares), ), }, }) @@ -292,7 +292,7 @@ func (suite *AccumulateEarnRewardsTests) TestStateUpdatedWhenBlockTimeHasIncreas { CollateralType: "ukava", RewardFactor: d("7.24"). - Add(sdk.NewDecFromInt(vaultDenom2Supply). + Add(sdkmath.LegacyNewDecFromInt(vaultDenom2Supply). QuoInt64(10). MulInt64(3600). Quo(vault2Shares), diff --git a/x/incentive/keeper/rewards_earn_staking_integration_test.go b/x/incentive/keeper/rewards_earn_staking_integration_test.go index 59466c139c..08872cf938 100644 --- a/x/incentive/keeper/rewards_earn_staking_integration_test.go +++ b/x/incentive/keeper/rewards_earn_staking_integration_test.go @@ -1,6 +1,7 @@ package keeper_test import ( + sdkmath "cosmossdk.io/math" "testing" "time" @@ -64,9 +65,9 @@ func (suite *EarnStakingRewardsIntegrationTestSuite) SetupTest() { stakingBuilder := testutil.NewStakingGenesisBuilder() mintBuilder := testutil.NewMintGenesisBuilder(). - WithInflationMax(sdk.OneDec()). - WithInflationMin(sdk.OneDec()). - WithMinter(sdk.OneDec(), sdk.ZeroDec()). + WithInflationMax(sdkmath.LegacyOneDec()). + WithInflationMin(sdkmath.LegacyOneDec()). + WithMinter(sdkmath.LegacyOneDec(), sdkmath.LegacyZeroDec()). WithMintDenom("ukava") suite.StartChainWithBuilders( @@ -139,19 +140,26 @@ func (suite *EarnStakingRewardsIntegrationTestSuite) TestStakingRewardsDistribut val := suite.GetAbciValidator(suite.valAddrs[0]) + suite.Ctx = suite.Ctx.WithVoteInfos([]abci.VoteInfo{ + { + Validator: val, + //SignedLastBlock: true, + }, + }) + // Mint tokens, distribute to validators, claim staking rewards // 1 hour later _, resBeginBlock := suite.NextBlockAfterWithReq( - 1*time.Hour, - abci.RequestEndBlock{}, - abci.RequestBeginBlock{ - LastCommitInfo: abci.CommitInfo{ - Votes: []abci.VoteInfo{{ - Validator: val, - SignedLastBlock: true, - }}, - }, - }, + 1 * time.Hour, + //abci.RequestEndBlock{}, + //abci.RequestBeginBlock{ + // LastCommitInfo: abci.CommitInfo{ + // Votes: []abci.VoteInfo{{ + // Validator: val, + // SignedLastBlock: true, + // }}, + // }, + //}, ) // check time and factors @@ -166,13 +174,13 @@ func (suite *EarnStakingRewardsIntegrationTestSuite) TestStakingRewardsDistribut // Total staking rewards / total source shares (**deposited in earn** not total minted) // types.RewardIndexes.Quo() uses Dec.Quo() which uses bankers rounding. // So we need to use Dec.Quo() to also round vs Dec.QuoInt() which truncates - expectedIndexes1 := sdk.NewDecFromInt(validatorRewards[suite.valAddrs[0].String()]. + expectedIndexes1 := sdkmath.LegacyNewDecFromInt(validatorRewards[suite.valAddrs[0].String()]. AmountOf("ukava")). - Quo(sdk.NewDecFromInt(userDepositAmount0)) + Quo(sdkmath.LegacyNewDecFromInt(userDepositAmount0)) - expectedIndexes2 := sdk.NewDecFromInt(validatorRewards[suite.valAddrs[1].String()]. + expectedIndexes2 := sdkmath.LegacyNewDecFromInt(validatorRewards[suite.valAddrs[1].String()]. AmountOf("ukava")). - Quo(sdk.NewDecFromInt(userDepositAmount1)) + Quo(sdkmath.LegacyNewDecFromInt(userDepositAmount1)) // Only contains staking rewards suite.StoredEarnIndexesEqual(vaultDenom1, types.RewardIndexes{ diff --git a/x/incentive/keeper/rewards_earn_staking_test.go b/x/incentive/keeper/rewards_earn_staking_test.go index 5df7ed1775..edd2a00de9 100644 --- a/x/incentive/keeper/rewards_earn_staking_test.go +++ b/x/incentive/keeper/rewards_earn_staking_test.go @@ -1,9 +1,9 @@ package keeper_test import ( + sdkmath "cosmossdk.io/math" "time" - sdk "github.com/cosmos/cosmos-sdk/types" earntypes "github.com/kava-labs/kava/x/earn/types" "github.com/kava-labs/kava/x/incentive/types" ) @@ -84,7 +84,7 @@ func (suite *AccumulateEarnRewardsTests) TestStakingRewardsDistributed() { { CollateralType: "ukava", RewardFactor: initialVault1RewardFactor. - Add(sdk.NewDecFromInt(vaultDenom1Supply). + Add(sdkmath.LegacyNewDecFromInt(vaultDenom1Supply). QuoInt64(10). MulInt64(3600). Quo(vault1Shares)), @@ -95,7 +95,7 @@ func (suite *AccumulateEarnRewardsTests) TestStakingRewardsDistributed() { { CollateralType: "ukava", RewardFactor: initialVault2RewardFactor. - Add(sdk.NewDecFromInt(vaultDenom2Supply). + Add(sdkmath.LegacyNewDecFromInt(vaultDenom2Supply). QuoInt64(10). MulInt64(3600). Quo(vault2Shares)), diff --git a/x/incentive/keeper/rewards_savings.go b/x/incentive/keeper/rewards_savings.go index 1b843bdfcf..7969499964 100644 --- a/x/incentive/keeper/rewards_savings.go +++ b/x/incentive/keeper/rewards_savings.go @@ -1,6 +1,7 @@ package keeper import ( + sdkmath "cosmossdk.io/math" "fmt" sdk "github.com/cosmos/cosmos-sdk/types" @@ -27,7 +28,7 @@ func (k Keeper) AccumulateSavingsRewards(ctx sdk.Context, rewardPeriod types.Mul maccCoins := k.bankKeeper.GetAllBalances(ctx, savingsMacc.GetAddress()) denomBalance := maccCoins.AmountOf(rewardPeriod.CollateralType) - acc.Accumulate(rewardPeriod, sdk.NewDecFromInt(denomBalance), ctx.BlockTime()) + acc.Accumulate(rewardPeriod, sdkmath.LegacyNewDecFromInt(denomBalance), ctx.BlockTime()) k.SetSavingsRewardAccrualTime(ctx, rewardPeriod.CollateralType, acc.PreviousAccumulationTime) @@ -78,7 +79,7 @@ func (k Keeper) SynchronizeSavingsReward(ctx sdk.Context, deposit savingstypes.D // Existing denoms have their reward indexes + reward amount synced existingDenoms := setDifference(getDenoms(deposit.Amount), incomingDenoms) for _, denom := range existingDenoms { - claim = k.synchronizeSingleSavingsReward(ctx, claim, denom, sdk.NewDecFromInt(deposit.Amount.AmountOf(denom))) + claim = k.synchronizeSingleSavingsReward(ctx, claim, denom, sdkmath.LegacyNewDecFromInt(deposit.Amount.AmountOf(denom))) } k.SetSavingsClaim(ctx, claim) @@ -87,7 +88,7 @@ func (k Keeper) SynchronizeSavingsReward(ctx sdk.Context, deposit savingstypes.D // synchronizeSingleSavingsReward synchronizes a single rewarded savings denom in a savings claim. // It returns the claim without setting in the store. // The public methods for accessing and modifying claims are preferred over this one. Direct modification of claims is easy to get wrong. -func (k Keeper) synchronizeSingleSavingsReward(ctx sdk.Context, claim types.SavingsClaim, denom string, sourceShares sdk.Dec) types.SavingsClaim { +func (k Keeper) synchronizeSingleSavingsReward(ctx sdk.Context, claim types.SavingsClaim, denom string, sourceShares sdkmath.LegacyDec) types.SavingsClaim { globalRewardIndexes, found := k.GetSavingsRewardIndexes(ctx, denom) if !found { // The global factor is only not found if @@ -133,7 +134,7 @@ func (k Keeper) GetSynchronizedSavingsClaim(ctx sdk.Context, owner sdk.AccAddres } for _, coin := range deposit.Amount { - claim = k.synchronizeSingleSavingsReward(ctx, claim, coin.Denom, sdk.NewDecFromInt(coin.Amount)) + claim = k.synchronizeSingleSavingsReward(ctx, claim, coin.Denom, sdkmath.LegacyNewDecFromInt(coin.Amount)) } return claim, true diff --git a/x/incentive/keeper/rewards_savings_accum_test.go b/x/incentive/keeper/rewards_savings_accum_test.go index 2485669a5d..d63802b54a 100644 --- a/x/incentive/keeper/rewards_savings_accum_test.go +++ b/x/incentive/keeper/rewards_savings_accum_test.go @@ -47,7 +47,7 @@ func (suite *SavingsRewardsTestSuite) SetupApp() { suite.keeper = suite.app.GetIncentiveKeeper() suite.savingsKeeper = suite.app.GetSavingsKeeper() - suite.ctx = suite.app.NewContext(true, tmproto.Header{Height: 1, Time: suite.genesisTime}) + suite.ctx = suite.app.NewContextLegacy(true, tmproto.Header{Height: 1, Time: suite.genesisTime}) } func (suite *SavingsRewardsTestSuite) SetupWithGenState(authBuilder *app.AuthBankGenesisBuilder, incentBuilder testutil.IncentiveGenesisBuilder, diff --git a/x/incentive/keeper/rewards_savings_init_test.go b/x/incentive/keeper/rewards_savings_init_test.go index f9b7bac200..a28dd8f85b 100644 --- a/x/incentive/keeper/rewards_savings_init_test.go +++ b/x/incentive/keeper/rewards_savings_init_test.go @@ -1,6 +1,7 @@ package keeper_test import ( + sdkmath "cosmossdk.io/math" "testing" "github.com/stretchr/testify/suite" @@ -28,7 +29,7 @@ func (suite *InitializeSavingsRewardTests) TestClaimAddedWhenClaimDoesNotExistAn owner := arbitraryAddress() - amount := sdk.NewCoin("test", sdk.OneInt()) + amount := sdk.NewCoin("test", sdkmath.OneInt()) deposit := savingstypes.NewDeposit(owner, sdk.NewCoins(amount)) suite.keeper.InitializeSavingsReward(suite.ctx, deposit) @@ -49,7 +50,7 @@ func (suite *InitializeSavingsRewardTests) TestClaimAddedWhenClaimDoesNotExistAn // When a claim doesn't exist, and a user deposits to a rewarded pool; // then a claim is added with no rewards and indexes matching the global indexes - amount := sdk.NewCoin("test", sdk.OneInt()) + amount := sdk.NewCoin("test", sdkmath.OneInt()) globalIndexes := types.MultiRewardIndexes{ { @@ -105,7 +106,7 @@ func (suite *InitializeSavingsRewardTests) TestClaimUpdatedWhenClaimExistsAndNoR // no global indexes stored as the new denom is not rewarded newDenom := "test" - deposit := savingstypes.NewDeposit(claim.Owner, sdk.NewCoins(sdk.NewCoin(newDenom, sdk.OneInt()))) + deposit := savingstypes.NewDeposit(claim.Owner, sdk.NewCoins(sdk.NewCoin(newDenom, sdkmath.OneInt()))) suite.keeper.InitializeSavingsReward(suite.ctx, deposit) syncedClaim, found := suite.keeper.GetSavingsClaim(suite.ctx, claim.Owner) @@ -173,7 +174,7 @@ func (suite *InitializeSavingsRewardTests) TestClaimUpdatedWhenClaimExistsAndRew } suite.storeGlobalSavingsIndexes(globalIndexes) - deposit := savingstypes.NewDeposit(claim.Owner, sdk.NewCoins(sdk.NewCoin(newDenom, sdk.OneInt()))) + deposit := savingstypes.NewDeposit(claim.Owner, sdk.NewCoins(sdk.NewCoin(newDenom, sdkmath.OneInt()))) suite.keeper.InitializeSavingsReward(suite.ctx, deposit) syncedClaim, _ := suite.keeper.GetSavingsClaim(suite.ctx, claim.Owner) diff --git a/x/incentive/keeper/rewards_supply.go b/x/incentive/keeper/rewards_supply.go index bc97694b73..cc6af6530d 100644 --- a/x/incentive/keeper/rewards_supply.go +++ b/x/incentive/keeper/rewards_supply.go @@ -1,6 +1,7 @@ package keeper import ( + sdkmath "cosmossdk.io/math" "fmt" sdk "github.com/cosmos/cosmos-sdk/types" @@ -38,7 +39,7 @@ func (k Keeper) AccumulateHardSupplyRewards(ctx sdk.Context, rewardPeriod types. // getHardSupplyTotalSourceShares fetches the sum of all source shares for a supply reward. // In the case of hard supply, this is the total supplied divided by the supply interest factor. // This gives the "pre interest" value of the total supplied. -func (k Keeper) getHardSupplyTotalSourceShares(ctx sdk.Context, denom string) sdk.Dec { +func (k Keeper) getHardSupplyTotalSourceShares(ctx sdk.Context, denom string) sdkmath.LegacyDec { totalSuppliedCoins, found := k.hardKeeper.GetSuppliedCoins(ctx) if !found { // assume no coins have been supplied @@ -49,11 +50,11 @@ func (k Keeper) getHardSupplyTotalSourceShares(ctx sdk.Context, denom string) sd interestFactor, found := k.hardKeeper.GetSupplyInterestFactor(ctx, denom) if !found { // assume nothing has been borrowed so the factor starts at it's default value - interestFactor = sdk.OneDec() + interestFactor = sdkmath.LegacyOneDec() } // return supplied/factor to get the "pre interest" value of the current total supplied - return sdk.NewDecFromInt(totalSupplied).Quo(interestFactor) + return sdkmath.LegacyNewDecFromInt(totalSupplied).Quo(interestFactor) } // InitializeHardSupplyReward initializes the supply-side of a hard liquidity provider claim @@ -100,7 +101,7 @@ func (k Keeper) SynchronizeHardSupplyReward(ctx sdk.Context, deposit hardtypes.D // synchronizeSingleHardSupplyReward synchronizes a single rewarded supply denom in a hard claim. // It returns the claim without setting in the store. // The public methods for accessing and modifying claims are preferred over this one. Direct modification of claims is easy to get wrong. -func (k Keeper) synchronizeSingleHardSupplyReward(ctx sdk.Context, claim types.HardLiquidityProviderClaim, denom string, sourceShares sdk.Dec) types.HardLiquidityProviderClaim { +func (k Keeper) synchronizeSingleHardSupplyReward(ctx sdk.Context, claim types.HardLiquidityProviderClaim, denom string, sourceShares sdkmath.LegacyDec) types.HardLiquidityProviderClaim { globalRewardIndexes, found := k.GetHardSupplyRewardIndexes(ctx, denom) if !found { // The global factor is only not found if @@ -204,7 +205,7 @@ func (k Keeper) SimulateHardSynchronization(ctx sdk.Context, claim types.HardLiq for _, globalRewardIndex := range globalRewardIndexes { userRewardIndex, foundUserRewardIndex := userRewardIndexes.RewardIndexes.GetRewardIndex(globalRewardIndex.CollateralType) if !foundUserRewardIndex { - userRewardIndex = types.NewRewardIndex(globalRewardIndex.CollateralType, sdk.ZeroDec()) + userRewardIndex = types.NewRewardIndex(globalRewardIndex.CollateralType, sdkmath.LegacyZeroDec()) userRewardIndexes.RewardIndexes = append(userRewardIndexes.RewardIndexes, userRewardIndex) claim.SupplyRewardIndexes[userRewardIndexIndex].RewardIndexes = append(claim.SupplyRewardIndexes[userRewardIndexIndex].RewardIndexes, userRewardIndex) } @@ -219,7 +220,7 @@ func (k Keeper) SimulateHardSynchronization(ctx sdk.Context, claim types.HardLiq if !found { continue } - newRewardsAmount := rewardsAccumulatedFactor.Mul(sdk.NewDecFromInt(deposit.Amount.AmountOf(ri.CollateralType))).RoundInt() + newRewardsAmount := rewardsAccumulatedFactor.Mul(sdkmath.LegacyNewDecFromInt(deposit.Amount.AmountOf(ri.CollateralType))).RoundInt() if newRewardsAmount.IsZero() || newRewardsAmount.IsNegative() { continue } @@ -254,7 +255,7 @@ func (k Keeper) SimulateHardSynchronization(ctx sdk.Context, claim types.HardLiq for _, globalRewardIndex := range globalRewardIndexes { userRewardIndex, foundUserRewardIndex := userRewardIndexes.RewardIndexes.GetRewardIndex(globalRewardIndex.CollateralType) if !foundUserRewardIndex { - userRewardIndex = types.NewRewardIndex(globalRewardIndex.CollateralType, sdk.ZeroDec()) + userRewardIndex = types.NewRewardIndex(globalRewardIndex.CollateralType, sdkmath.LegacyZeroDec()) userRewardIndexes.RewardIndexes = append(userRewardIndexes.RewardIndexes, userRewardIndex) claim.BorrowRewardIndexes[userRewardIndexIndex].RewardIndexes = append(claim.BorrowRewardIndexes[userRewardIndexIndex].RewardIndexes, userRewardIndex) } @@ -269,7 +270,7 @@ func (k Keeper) SimulateHardSynchronization(ctx sdk.Context, claim types.HardLiq if !found { continue } - newRewardsAmount := rewardsAccumulatedFactor.Mul(sdk.NewDecFromInt(borrow.Amount.AmountOf(ri.CollateralType))).RoundInt() + newRewardsAmount := rewardsAccumulatedFactor.Mul(sdkmath.LegacyNewDecFromInt(borrow.Amount.AmountOf(ri.CollateralType))).RoundInt() if newRewardsAmount.IsZero() || newRewardsAmount.IsNegative() { continue } diff --git a/x/incentive/keeper/rewards_supply_sync_test.go b/x/incentive/keeper/rewards_supply_sync_test.go index 10c181852e..86b627405d 100644 --- a/x/incentive/keeper/rewards_supply_sync_test.go +++ b/x/incentive/keeper/rewards_supply_sync_test.go @@ -314,7 +314,7 @@ func (builder HardDepositBuilder) Build() hardtypes.Deposit { return builder.Dep // WithSourceShares adds a deposit amount and factor such that the source shares for this deposit is equal to specified. // With a factor of 1, the deposit amount is the source shares. This picks an arbitrary factor to ensure factors are accounted for in production code. func (builder HardDepositBuilder) WithSourceShares(denom string, shares int64) HardDepositBuilder { - if !builder.Amount.AmountOf(denom).Equal(sdk.ZeroInt()) { + if !builder.Amount.AmountOf(denom).Equal(sdkmath.ZeroInt()) { panic("adding to amount with existing denom not implemented") } if _, f := builder.Index.GetInterestFactor(denom); f { @@ -322,7 +322,7 @@ func (builder HardDepositBuilder) WithSourceShares(denom string, shares int64) H } // pick arbitrary factor - factor := sdk.MustNewDecFromStr("2") + factor := sdkmath.LegacyMustNewDecFromStr("2") // Calculate deposit amount that would equal the requested source shares given the above factor. amt := sdkmath.NewInt(shares).Mul(factor.RoundInt()) diff --git a/x/incentive/keeper/rewards_supply_test.go b/x/incentive/keeper/rewards_supply_test.go index 2780a843bf..20dcef65de 100644 --- a/x/incentive/keeper/rewards_supply_test.go +++ b/x/incentive/keeper/rewards_supply_test.go @@ -1,10 +1,10 @@ package keeper_test import ( + sdkmath "cosmossdk.io/math" "testing" "time" - abci "github.com/cometbft/cometbft/abci/types" tmproto "github.com/cometbft/cometbft/proto/tendermint/types" sdk "github.com/cosmos/cosmos-sdk/types" proposaltypes "github.com/cosmos/cosmos-sdk/x/params/types/proposal" @@ -129,7 +129,7 @@ func (suite *SupplyRewardsTestSuite) SetupApp() { suite.hardKeeper = suite.app.GetHardKeeper() suite.committeeKeeper = suite.app.GetCommitteeKeeper() - suite.ctx = suite.app.NewContext(true, tmproto.Header{Height: 1, Time: suite.genesisTime}) + suite.ctx = suite.app.NewContextLegacy(true, tmproto.Header{Height: 1, Time: suite.genesisTime}) } func (suite *SupplyRewardsTestSuite) SetupWithGenState(authBuilder *app.AuthBankGenesisBuilder, incentBuilder testutil.IncentiveGenesisBuilder, hardBuilder testutil.HardGenesisBuilder) { @@ -604,7 +604,7 @@ func (suite *SupplyRewardsTestSuite) TestSynchronizeHardSupplyReward() { for _, expectedRewardIndex := range tc.args.expectedRewardIndexes { currRewardIndex, found := multiRewardIndex.RewardIndexes.GetRewardIndex(expectedRewardIndex.CollateralType) suite.Require().True(found) - suite.Require().Equal(sdk.ZeroDec(), currRewardIndex.RewardFactor) + suite.Require().Equal(sdkmath.LegacyZeroDec(), currRewardIndex.RewardFactor) } // Run accumulator at several intervals @@ -721,7 +721,7 @@ func (suite *SupplyRewardsTestSuite) TestSynchronizeHardSupplyReward() { // 7. Run committee module's begin blocker to enact proposal suite.NotPanics(func() { - committee.BeginBlocker(suite.ctx, abci.RequestBeginBlock{}, suite.committeeKeeper) + committee.BeginBlocker(suite.ctx, suite.committeeKeeper) }) // We need to accumulate hard supply-side rewards again @@ -1002,7 +1002,7 @@ func (suite *SupplyRewardsTestSuite) TestSimulateHardSupplyRewardSynchronization for _, expectedRewardIndex := range tc.args.expectedRewardIndexes { currRewardIndex, found := multiRewardIndexPre.RewardIndexes.GetRewardIndex(expectedRewardIndex.CollateralType) suite.Require().True(found) - suite.Require().Equal(sdk.ZeroDec(), currRewardIndex.RewardFactor) + suite.Require().Equal(sdkmath.LegacyZeroDec(), currRewardIndex.RewardFactor) } // Check that the synced claim held in memory has properly simulated syncing diff --git a/x/incentive/keeper/rewards_swap.go b/x/incentive/keeper/rewards_swap.go index 7f468c9606..ec419bdc73 100644 --- a/x/incentive/keeper/rewards_swap.go +++ b/x/incentive/keeper/rewards_swap.go @@ -37,12 +37,12 @@ func (k Keeper) AccumulateSwapRewards(ctx sdk.Context, rewardPeriod types.MultiR // getSwapTotalSourceShares fetches the sum of all source shares for a swap reward. // In the case of swap, these are the total (swap module) shares in a particular pool. -func (k Keeper) getSwapTotalSourceShares(ctx sdk.Context, poolID string) sdk.Dec { +func (k Keeper) getSwapTotalSourceShares(ctx sdk.Context, poolID string) sdkmath.LegacyDec { totalShares, found := k.swapKeeper.GetPoolShares(ctx, poolID) if !found { - totalShares = sdk.ZeroInt() + totalShares = sdkmath.ZeroInt() } - return sdk.NewDecFromInt(totalShares) + return sdkmath.LegacyNewDecFromInt(totalShares) } // InitializeSwapReward creates a new claim with zero rewards and indexes matching the global indexes. @@ -95,7 +95,7 @@ func (k *Keeper) synchronizeSwapReward(ctx sdk.Context, claim types.SwapClaim, p userRewardIndexes = types.RewardIndexes{} } - newRewards, err := k.CalculateRewards(userRewardIndexes, globalRewardIndexes, sdk.NewDecFromInt(shares)) + newRewards, err := k.CalculateRewards(userRewardIndexes, globalRewardIndexes, sdkmath.LegacyNewDecFromInt(shares)) if err != nil { // Global reward factors should never decrease, as it would lead to a negative update to claim.Rewards. // This panics if a global reward factor decreases or disappears between the old and new indexes. @@ -118,7 +118,7 @@ func (k Keeper) GetSynchronizedSwapClaim(ctx sdk.Context, owner sdk.AccAddress) k.IterateSwapRewardIndexes(ctx, func(poolID string, _ types.RewardIndexes) bool { shares, found := k.swapKeeper.GetDepositorSharesAmount(ctx, owner, poolID) if !found { - shares = sdk.ZeroInt() + shares = sdkmath.ZeroInt() } claim = k.synchronizeSwapReward(ctx, claim, poolID, owner, shares) diff --git a/x/incentive/keeper/rewards_usdx.go b/x/incentive/keeper/rewards_usdx.go index ada2414723..11ec021585 100644 --- a/x/incentive/keeper/rewards_usdx.go +++ b/x/incentive/keeper/rewards_usdx.go @@ -1,6 +1,7 @@ package keeper import ( + sdkmath "cosmossdk.io/math" "fmt" sdk "github.com/cosmos/cosmos-sdk/types" @@ -19,7 +20,7 @@ func (k Keeper) AccumulateUSDXMintingRewards(ctx sdk.Context, rewardPeriod types factor, found := k.GetUSDXMintingRewardFactor(ctx, rewardPeriod.CollateralType) if !found { - factor = sdk.ZeroDec() + factor = sdkmath.LegacyZeroDec() } // wrap in RewardIndexes for compatibility with Accumulator indexes := types.RewardIndexes{}.With(types.USDXMintingRewardDenom, factor) @@ -42,16 +43,16 @@ func (k Keeper) AccumulateUSDXMintingRewards(ctx sdk.Context, rewardPeriod types // getUSDXTotalSourceShares fetches the sum of all source shares for a usdx minting reward. // In the case of usdx minting, this is the total debt from all cdps of a particular type, divided by the cdp interest factor. // This gives the "pre interest" value of the total debt. -func (k Keeper) getUSDXTotalSourceShares(ctx sdk.Context, collateralType string) sdk.Dec { +func (k Keeper) getUSDXTotalSourceShares(ctx sdk.Context, collateralType string) sdkmath.LegacyDec { totalPrincipal := k.cdpKeeper.GetTotalPrincipal(ctx, collateralType, cdptypes.DefaultStableDenom) cdpFactor, found := k.cdpKeeper.GetInterestFactor(ctx, collateralType) if !found { // assume nothing has been borrowed so the factor starts at it's default value - cdpFactor = sdk.OneDec() + cdpFactor = sdkmath.LegacyOneDec() } // return debt/factor to get the "pre interest" value of the current total debt - return sdk.NewDecFromInt(totalPrincipal).Quo(cdpFactor) + return sdkmath.LegacyNewDecFromInt(totalPrincipal).Quo(cdpFactor) } // InitializeUSDXMintingClaim creates or updates a claim such that no new rewards are accrued, but any existing rewards are not lost. @@ -61,12 +62,12 @@ func (k Keeper) getUSDXTotalSourceShares(ctx sdk.Context, collateralType string) func (k Keeper) InitializeUSDXMintingClaim(ctx sdk.Context, cdp cdptypes.CDP) { claim, found := k.GetUSDXMintingClaim(ctx, cdp.Owner) if !found { // this is the owner's first usdx minting reward claim - claim = types.NewUSDXMintingClaim(cdp.Owner, sdk.NewCoin(types.USDXMintingRewardDenom, sdk.ZeroInt()), types.RewardIndexes{}) + claim = types.NewUSDXMintingClaim(cdp.Owner, sdk.NewCoin(types.USDXMintingRewardDenom, sdkmath.ZeroInt()), types.RewardIndexes{}) } globalRewardFactor, found := k.GetUSDXMintingRewardFactor(ctx, cdp.Type) if !found { - globalRewardFactor = sdk.ZeroDec() + globalRewardFactor = sdkmath.LegacyZeroDec() } claim.RewardIndexes = claim.RewardIndexes.With(cdp.Type, globalRewardFactor) @@ -94,7 +95,7 @@ func (k Keeper) SynchronizeUSDXMintingReward(ctx sdk.Context, cdp cdptypes.CDP) // synchronizeSingleUSDXMintingReward synchronizes a single rewarded cdp collateral type in a usdx minting claim. // It returns the claim without setting in the store. // The public methods for accessing and modifying claims are preferred over this one. Direct modification of claims is easy to get wrong. -func (k Keeper) synchronizeSingleUSDXMintingReward(ctx sdk.Context, claim types.USDXMintingClaim, ctype string, sourceShares sdk.Dec) types.USDXMintingClaim { +func (k Keeper) synchronizeSingleUSDXMintingReward(ctx sdk.Context, claim types.USDXMintingClaim, ctype string, sourceShares sdkmath.LegacyDec) types.USDXMintingClaim { globalRewardFactor, found := k.GetUSDXMintingRewardFactor(ctx, ctype) if !found { // The global factor is only not found if @@ -111,7 +112,7 @@ func (k Keeper) synchronizeSingleUSDXMintingReward(ctx sdk.Context, claim types. // Normally the factor should always be found, as it is added when the cdp is created in InitializeUSDXMintingClaim. // However if a cdp type is not rewarded then becomes rewarded (ie a reward period is added to params), existing cdps will not have the factor in their claims. // So assume the factor is the starting value for any global factor: 0. - userRewardFactor = sdk.ZeroDec() + userRewardFactor = sdkmath.LegacyZeroDec() } newRewardsAmount, err := k.CalculateSingleReward(userRewardFactor, globalRewardFactor, sourceShares) @@ -138,7 +139,7 @@ func (k Keeper) SimulateUSDXMintingSynchronization(ctx sdk.Context, claim types. globalRewardFactor, found := k.GetUSDXMintingRewardFactor(ctx, ri.CollateralType) if !found { - globalRewardFactor = sdk.ZeroDec() + globalRewardFactor = sdkmath.LegacyZeroDec() } // the owner has an existing usdx minting reward claim @@ -158,7 +159,7 @@ func (k Keeper) SimulateUSDXMintingSynchronization(ctx sdk.Context, claim types. if !found { continue } - newRewardsAmount := rewardsAccumulatedFactor.Mul(sdk.NewDecFromInt(cdp.GetTotalPrincipal().Amount)).RoundInt() + newRewardsAmount := rewardsAccumulatedFactor.Mul(sdkmath.LegacyNewDecFromInt(cdp.GetTotalPrincipal().Amount)).RoundInt() if newRewardsAmount.IsZero() { continue } @@ -192,7 +193,7 @@ func (k Keeper) synchronizeRewardAndReturnClaim(ctx sdk.Context, cdp cdptypes.CD // ZeroUSDXMintingClaim zeroes out the claim object's rewards and returns the updated claim object func (k Keeper) ZeroUSDXMintingClaim(ctx sdk.Context, claim types.USDXMintingClaim) types.USDXMintingClaim { - claim.Reward = sdk.NewCoin(claim.Reward.Denom, sdk.ZeroInt()) + claim.Reward = sdk.NewCoin(claim.Reward.Denom, sdkmath.ZeroInt()) k.SetUSDXMintingClaim(ctx, claim) return claim } diff --git a/x/incentive/keeper/rewards_usdx_accum_test.go b/x/incentive/keeper/rewards_usdx_accum_test.go index 4b7283a664..c5eef6e7e5 100644 --- a/x/incentive/keeper/rewards_usdx_accum_test.go +++ b/x/incentive/keeper/rewards_usdx_accum_test.go @@ -1,10 +1,10 @@ package keeper_test import ( + sdkmath "cosmossdk.io/math" "testing" "time" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/suite" "github.com/kava-labs/kava/x/incentive/types" @@ -20,7 +20,7 @@ func (suite *AccumulateUSDXRewardsTests) storedTimeEquals(cType string, expected suite.Equal(expected, storedTime) } -func (suite *AccumulateUSDXRewardsTests) storedIndexesEqual(cType string, expected sdk.Dec) { +func (suite *AccumulateUSDXRewardsTests) storedIndexesEqual(cType string, expected sdkmath.LegacyDec) { storedIndexes, found := suite.keeper.GetUSDXMintingRewardFactor(suite.ctx, cType) suite.True(found) suite.Equal(expected, storedIndexes) @@ -158,7 +158,7 @@ func (suite *AccumulateUSDXRewardsTests) TestStateAddedWhenStateDoesNotExist() { // After the first accumulation the current block time should be stored and the factor will be zero. suite.storedTimeEquals(cType, firstAccrualTime) - suite.storedIndexesEqual(cType, sdk.ZeroDec()) + suite.storedIndexesEqual(cType, sdkmath.LegacyZeroDec()) secondAccrualTime := firstAccrualTime.Add(10 * time.Second) suite.ctx = suite.ctx.WithBlockTime(secondAccrualTime) diff --git a/x/incentive/keeper/rewards_usdx_test.go b/x/incentive/keeper/rewards_usdx_test.go index eb45570e3b..020c804dec 100644 --- a/x/incentive/keeper/rewards_usdx_test.go +++ b/x/incentive/keeper/rewards_usdx_test.go @@ -1,6 +1,7 @@ package keeper_test import ( + sdkmath "cosmossdk.io/math" "testing" "time" @@ -257,7 +258,7 @@ func (suite *USDXRewardsTestSuite) SetupApp() { suite.keeper = suite.app.GetIncentiveKeeper() suite.cdpKeeper = suite.app.GetCDPKeeper() - suite.ctx = suite.app.NewContext(true, tmproto.Header{Height: 1, Time: suite.genesisTime}) + suite.ctx = suite.app.NewContextLegacy(true, tmproto.Header{Height: 1, Time: suite.genesisTime}) } func (suite *USDXRewardsTestSuite) SetupWithGenState(authBuilder *app.AuthBankGenesisBuilder, incentBuilder testutil.IncentiveGenesisBuilder) { @@ -278,7 +279,7 @@ func (suite *USDXRewardsTestSuite) TestAccumulateUSDXMintingRewards() { rewardsPerSecond sdk.Coin initialTotalPrincipal sdk.Coin timeElapsed int - expectedRewardFactor sdk.Dec + expectedRewardFactor sdkmath.LegacyDec } type test struct { name string @@ -344,7 +345,7 @@ func (suite *USDXRewardsTestSuite) TestSynchronizeUSDXMintingReward() { initialCollateral sdk.Coin initialPrincipal sdk.Coin blockTimes []int - expectedRewardFactor sdk.Dec + expectedRewardFactor sdkmath.LegacyDec expectedRewards sdk.Coin } type test struct { @@ -391,7 +392,7 @@ func (suite *USDXRewardsTestSuite) TestSynchronizeUSDXMintingReward() { claim, found := suite.keeper.GetUSDXMintingClaim(suite.ctx, suite.addrs[0]) suite.Require().True(found) - suite.Require().Equal(sdk.ZeroDec(), claim.RewardIndexes[0].RewardFactor) + suite.Require().Equal(sdkmath.LegacyZeroDec(), claim.RewardIndexes[0].RewardFactor) var timeElapsed int previousBlockTime := suite.ctx.BlockTime() @@ -430,7 +431,7 @@ func (suite *USDXRewardsTestSuite) TestSimulateUSDXMintingRewardSynchronization( initialCollateral sdk.Coin initialPrincipal sdk.Coin blockTimes []int - expectedRewardFactor sdk.Dec + expectedRewardFactor sdkmath.LegacyDec expectedRewards sdk.Coin } type test struct { @@ -477,7 +478,7 @@ func (suite *USDXRewardsTestSuite) TestSimulateUSDXMintingRewardSynchronization( claim, found := suite.keeper.GetUSDXMintingClaim(suite.ctx, suite.addrs[0]) suite.Require().True(found) - suite.Require().Equal(sdk.ZeroDec(), claim.RewardIndexes[0].RewardFactor) + suite.Require().Equal(sdkmath.LegacyZeroDec(), claim.RewardIndexes[0].RewardFactor) var timeElapsed int previousBlockTime := suite.ctx.BlockTime() @@ -495,8 +496,8 @@ func (suite *USDXRewardsTestSuite) TestSimulateUSDXMintingRewardSynchronization( claim, found = suite.keeper.GetUSDXMintingClaim(suite.ctx, suite.addrs[0]) suite.Require().True(found) - suite.Require().Equal(claim.RewardIndexes[0].RewardFactor, sdk.ZeroDec()) - suite.Require().Equal(claim.Reward, sdk.NewCoin("ukava", sdk.ZeroInt())) + suite.Require().Equal(claim.RewardIndexes[0].RewardFactor, sdkmath.LegacyZeroDec()) + suite.Require().Equal(claim.Reward, sdk.NewCoin("ukava", sdkmath.ZeroInt())) updatedClaim := suite.keeper.SimulateUSDXMintingSynchronization(suite.ctx, claim) suite.Require().Equal(tc.args.expectedRewardFactor, updatedClaim.RewardIndexes[0].RewardFactor) diff --git a/x/incentive/keeper/rewards_usdx_unit_test.go b/x/incentive/keeper/rewards_usdx_unit_test.go index 61240e8560..76520453e7 100644 --- a/x/incentive/keeper/rewards_usdx_unit_test.go +++ b/x/incentive/keeper/rewards_usdx_unit_test.go @@ -248,8 +248,8 @@ func NewCDPBuilder(owner sdk.AccAddress, collateralType string) CDPBuilder { // Set them to the default denom, but with 0 amount. Principal: c(cdptypes.DefaultStableDenom, 0), AccumulatedFees: c(cdptypes.DefaultStableDenom, 0), - // zero value of sdk.Dec causes nil pointer panics - InterestFactor: sdk.OneDec(), + // zero value of sdkmath.LegacyDec causes nil pointer panics + InterestFactor: sdkmath.LegacyOneDec(), }, } } @@ -260,10 +260,10 @@ func (builder CDPBuilder) Build() cdptypes.CDP { return builder.CDP } // WithSourceShares adds a principal amount and interest factor such that the source shares for this CDP is equal to specified. // With a factor of 1, the total principal is the source shares. This picks an arbitrary factor to ensure factors are accounted for in production code. func (builder CDPBuilder) WithSourceShares(shares int64) CDPBuilder { - if !builder.GetTotalPrincipal().Amount.Equal(sdk.ZeroInt()) { + if !builder.GetTotalPrincipal().Amount.Equal(sdkmath.ZeroInt()) { panic("setting source shares on cdp with existing principal or fees not implemented") } - if !(builder.InterestFactor.IsNil() || builder.InterestFactor.Equal(sdk.OneDec())) { + if !(builder.InterestFactor.IsNil() || builder.InterestFactor.Equal(sdkmath.LegacyOneDec())) { panic("setting source shares on cdp with existing interest factor not implemented") } // pick arbitrary interest factor @@ -273,7 +273,7 @@ func (builder CDPBuilder) WithSourceShares(shares int64) CDPBuilder { principal := sdkmath.NewInt(shares).Mul(factor) builder.Principal = sdk.NewCoin(cdptypes.DefaultStableDenom, principal) - builder.InterestFactor = sdk.NewDecFromInt(factor) + builder.InterestFactor = sdkmath.LegacyNewDecFromInt(factor) return builder } diff --git a/x/incentive/keeper/unit_test.go b/x/incentive/keeper/unit_test.go index 8e459dd042..ff2f6de09a 100644 --- a/x/incentive/keeper/unit_test.go +++ b/x/incentive/keeper/unit_test.go @@ -1,16 +1,18 @@ package keeper_test import ( + "context" + "cosmossdk.io/store/metrics" "fmt" "strings" "time" + "cosmossdk.io/log" sdkmath "cosmossdk.io/math" - db "github.com/cometbft/cometbft-db" - "github.com/cometbft/cometbft/libs/log" + "cosmossdk.io/store" + storetypes "cosmossdk.io/store/types" + db "github.com/cosmos/cosmos-db" "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/store" - storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" @@ -31,7 +33,7 @@ import ( // NewTestContext sets up a basic context with an in-memory db func NewTestContext(requiredStoreKeys ...storetypes.StoreKey) sdk.Context { memDB := db.NewMemDB() - cms := store.NewCommitMultiStore(memDB) + cms := store.NewCommitMultiStore(memDB, log.NewNopLogger(), metrics.NewNoOpMetrics()) for _, key := range requiredStoreKeys { cms.MountStoreWithDB(key, storetypes.StoreTypeIAVL, nil) @@ -59,7 +61,7 @@ func (suite *unitTester) SetupSuite() { tApp := app.NewTestApp() suite.cdc = tApp.AppCodec() - suite.incentiveStoreKey = sdk.NewKVStoreKey(types.StoreKey) + suite.incentiveStoreKey = storetypes.NewKVStoreKey(types.StoreKey) } func (suite *unitTester) SetupTest() { @@ -302,13 +304,13 @@ type fakeHardKeeper struct { type fakeHardState struct { total sdk.Coins - interestFactors map[string]sdk.Dec + interestFactors map[string]sdkmath.LegacyDec } func newFakeHardState() fakeHardState { return fakeHardState{ total: nil, - interestFactors: map[string]sdk.Dec{}, // initialize map to avoid panics on read + interestFactors: map[string]sdkmath.LegacyDec{}, // initialize map to avoid panics on read } } @@ -321,13 +323,13 @@ func newFakeHardKeeper() *fakeHardKeeper { } } -func (k *fakeHardKeeper) addTotalBorrow(coin sdk.Coin, factor sdk.Dec) *fakeHardKeeper { +func (k *fakeHardKeeper) addTotalBorrow(coin sdk.Coin, factor sdkmath.LegacyDec) *fakeHardKeeper { k.borrows.total = k.borrows.total.Add(coin) k.borrows.interestFactors[coin.Denom] = factor return k } -func (k *fakeHardKeeper) addTotalSupply(coin sdk.Coin, factor sdk.Dec) *fakeHardKeeper { +func (k *fakeHardKeeper) addTotalSupply(coin sdk.Coin, factor sdkmath.LegacyDec) *fakeHardKeeper { k.deposits.total = k.deposits.total.Add(coin) k.deposits.interestFactors[coin.Denom] = factor return k @@ -347,12 +349,12 @@ func (k *fakeHardKeeper) GetSuppliedCoins(_ sdk.Context) (sdk.Coins, bool) { return k.deposits.total, true } -func (k *fakeHardKeeper) GetBorrowInterestFactor(_ sdk.Context, denom string) (sdk.Dec, bool) { +func (k *fakeHardKeeper) GetBorrowInterestFactor(_ sdk.Context, denom string) (sdkmath.LegacyDec, bool) { f, ok := k.borrows.interestFactors[denom] return f, ok } -func (k *fakeHardKeeper) GetSupplyInterestFactor(_ sdk.Context, denom string) (sdk.Dec, bool) { +func (k *fakeHardKeeper) GetSupplyInterestFactor(_ sdk.Context, denom string) (sdkmath.LegacyDec, bool) { f, ok := k.deposits.interestFactors[denom] return f, ok } @@ -377,54 +379,61 @@ var _ types.StakingKeeper = newFakeStakingKeeper() func newFakeStakingKeeper() *fakeStakingKeeper { return &fakeStakingKeeper{} } func (k *fakeStakingKeeper) addBondedTokens(amount int64) *fakeStakingKeeper { - if len(k.validators) != 0 { + if len(k.validators.Validators) != 0 { panic("cannot set total bonded if keeper already has validators set") } // add a validator with all the tokens - k.validators = append(k.validators, stakingtypes.Validator{ + k.validators.Validators = append(k.validators.Validators, stakingtypes.Validator{ Status: stakingtypes.Bonded, Tokens: sdkmath.NewInt(amount), }) return k } -func (k *fakeStakingKeeper) TotalBondedTokens(_ sdk.Context) sdkmath.Int { - total := sdk.ZeroInt() - for _, val := range k.validators { +func (k *fakeStakingKeeper) TotalBondedTokens(_ context.Context) (sdkmath.Int, error) { + total := sdkmath.ZeroInt() + for _, val := range k.validators.Validators { if val.GetStatus() == stakingtypes.Bonded { total = total.Add(val.GetBondedTokens()) } } - return total + return total, nil } -func (k *fakeStakingKeeper) GetDelegatorDelegations(_ sdk.Context, delegator sdk.AccAddress, maxRetrieve uint16) []stakingtypes.Delegation { - return k.delegations +func (k *fakeStakingKeeper) GetDelegatorDelegations(_ context.Context, delegator sdk.AccAddress, maxRetrieve uint16) ([]stakingtypes.Delegation, error) { + return k.delegations, nil } -func (k *fakeStakingKeeper) GetValidator(_ sdk.Context, addr sdk.ValAddress) (stakingtypes.Validator, bool) { - for _, val := range k.validators { - if val.GetOperator().Equals(addr) { - return val, true +func (k *fakeStakingKeeper) GetValidator(_ context.Context, addr sdk.ValAddress) (stakingtypes.Validator, error) { + for _, val := range k.validators.Validators { + v, err := k.validators.ValidatorCodec.StringToBytes(val.GetOperator()) + if err != nil { + return stakingtypes.Validator{}, fmt.Errorf("failed to convert operator address to bytes: %w", err) + } + + if addr.Equals(sdk.AccAddress(v)) { + return val, nil } } - return stakingtypes.Validator{}, false + + return stakingtypes.Validator{}, fmt.Errorf("validator not found") } -func (k *fakeStakingKeeper) GetValidatorDelegations(_ sdk.Context, valAddr sdk.ValAddress) []stakingtypes.Delegation { +func (k *fakeStakingKeeper) GetValidatorDelegations(_ context.Context, valAddr sdk.ValAddress) ([]stakingtypes.Delegation, error) { var delegations stakingtypes.Delegations for _, d := range k.delegations { - if d.GetValidatorAddr().Equals(valAddr) { + // TODO(boodyvo): check if string comparison is correct + if strings.EqualFold(d.GetValidatorAddr(), valAddr.String()) { delegations = append(delegations, d) } } - return delegations + return delegations, nil } // fakeCDPKeeper is a stub cdp keeper. // It can be used to return values to the incentive keeper without having to initialize a full cdp keeper. type fakeCDPKeeper struct { - interestFactor *sdk.Dec + interestFactor *sdkmath.LegacyDec totalPrincipal sdkmath.Int } @@ -433,11 +442,11 @@ var _ types.CdpKeeper = newFakeCDPKeeper() func newFakeCDPKeeper() *fakeCDPKeeper { return &fakeCDPKeeper{ interestFactor: nil, - totalPrincipal: sdk.ZeroInt(), + totalPrincipal: sdkmath.ZeroInt(), } } -func (k *fakeCDPKeeper) addInterestFactor(f sdk.Dec) *fakeCDPKeeper { +func (k *fakeCDPKeeper) addInterestFactor(f sdkmath.LegacyDec) *fakeCDPKeeper { k.interestFactor = &f return k } @@ -447,22 +456,22 @@ func (k *fakeCDPKeeper) addTotalPrincipal(p sdkmath.Int) *fakeCDPKeeper { return k } -func (k *fakeCDPKeeper) GetInterestFactor(_ sdk.Context, collateralType string) (sdk.Dec, bool) { +func (k *fakeCDPKeeper) GetInterestFactor(_ context.Context, collateralType string) (sdkmath.LegacyDec, bool) { if k.interestFactor != nil { return *k.interestFactor, true } - return sdk.Dec{}, false + return sdkmath.LegacyDec{}, false } -func (k *fakeCDPKeeper) GetTotalPrincipal(_ sdk.Context, collateralType string, principalDenom string) sdkmath.Int { +func (k *fakeCDPKeeper) GetTotalPrincipal(_ context.Context, collateralType string, principalDenom string) sdkmath.Int { return k.totalPrincipal } -func (k *fakeCDPKeeper) GetCdpByOwnerAndCollateralType(_ sdk.Context, owner sdk.AccAddress, collateralType string) (cdptypes.CDP, bool) { +func (k *fakeCDPKeeper) GetCdpByOwnerAndCollateralType(_ context.Context, owner sdk.AccAddress, collateralType string) (cdptypes.CDP, bool) { return cdptypes.CDP{}, false } -func (k *fakeCDPKeeper) GetCollateral(_ sdk.Context, collateralType string) (cdptypes.CollateralParam, bool) { +func (k *fakeCDPKeeper) GetCollateral(_ context.Context, collateralType string) (cdptypes.CollateralParam, bool) { return cdptypes.CollateralParam{}, false } @@ -511,7 +520,7 @@ func (k *fakeEarnKeeper) GetVaultTotalShares( func (k *fakeEarnKeeper) GetVaultTotalValue(ctx sdk.Context, denom string) (sdk.Coin, error) { vaultShares, found := k.vaultShares[denom] if !found { - return sdk.NewCoin(denom, sdk.ZeroInt()), nil + return sdk.NewCoin(denom, sdkmath.ZeroInt()), nil } return sdk.NewCoin(denom, vaultShares.Amount.RoundInt()), nil @@ -575,7 +584,7 @@ func (k *fakeLiquidKeeper) GetAllDerivativeDenoms(ctx sdk.Context) (denoms []str } func (k *fakeLiquidKeeper) GetTotalDerivativeValue(ctx sdk.Context) (sdk.Coin, error) { - totalSupply := sdk.ZeroInt() + totalSupply := sdkmath.ZeroInt() for _, supply := range k.derivatives { totalSupply = totalSupply.Add(supply) } @@ -586,7 +595,7 @@ func (k *fakeLiquidKeeper) GetTotalDerivativeValue(ctx sdk.Context) (sdk.Coin, e func (k *fakeLiquidKeeper) GetDerivativeValue(ctx sdk.Context, denom string) (sdk.Coin, error) { supply, found := k.derivatives[denom] if !found { - return sdk.NewCoin("ukava", sdk.ZeroInt()), nil + return sdk.NewCoin("ukava", sdkmath.ZeroInt()), nil } return sdk.NewCoin("ukava", supply), nil @@ -609,7 +618,7 @@ func (k *fakeLiquidKeeper) getRewardAmount( amt, found := k.derivatives[derivativeDenom] if !found { // No error - return sdk.ZeroInt() + return sdkmath.ZeroInt() } lastRewardClaim, found := k.lastRewardClaim[derivativeDenom] @@ -619,7 +628,7 @@ func (k *fakeLiquidKeeper) getRewardAmount( duration := int64(ctx.BlockTime().Sub(lastRewardClaim).Seconds()) if duration <= 0 { - return sdk.ZeroInt() + return sdkmath.ZeroInt() } // Reward amount just set to 10% of the derivative supply per second @@ -627,7 +636,7 @@ func (k *fakeLiquidKeeper) getRewardAmount( } type fakeDistrKeeper struct { - communityTax sdk.Dec + communityTax sdkmath.LegacyDec } var _ types.DistrKeeper = newFakeDistrKeeper() @@ -636,13 +645,13 @@ func newFakeDistrKeeper() *fakeDistrKeeper { return &fakeDistrKeeper{} } -func (k *fakeDistrKeeper) setCommunityTax(percent sdk.Dec) *fakeDistrKeeper { +func (k *fakeDistrKeeper) setCommunityTax(percent sdkmath.LegacyDec) *fakeDistrKeeper { k.communityTax = percent return k } -func (k *fakeDistrKeeper) GetCommunityTax(ctx sdk.Context) (percent sdk.Dec) { - return k.communityTax +func (k *fakeDistrKeeper) GetCommunityTax(ctx context.Context) (percent sdkmath.LegacyDec, err error) { + return k.communityTax, nil } type fakeMintKeeper struct { @@ -660,7 +669,7 @@ func (k *fakeMintKeeper) setMinter(minter minttypes.Minter) *fakeMintKeeper { return k } -func (k *fakeMintKeeper) GetMinter(ctx sdk.Context) (minter minttypes.Minter) { +func (k *fakeMintKeeper) GetMinter(ctx context.Context) (minter minttypes.Minter) { return k.minter } @@ -711,7 +720,7 @@ func (k *fakeBankKeeper) setSupply(coins ...sdk.Coin) *fakeBankKeeper { } func (k *fakeBankKeeper) SendCoinsFromModuleToAccount( - ctx sdk.Context, + ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins, @@ -719,14 +728,14 @@ func (k *fakeBankKeeper) SendCoinsFromModuleToAccount( panic("not implemented") } -func (k *fakeBankKeeper) GetAllBalances(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins { +func (k *fakeBankKeeper) GetAllBalances(ctx context.Context, addr sdk.AccAddress) sdk.Coins { panic("not implemented") } -func (k *fakeBankKeeper) GetSupply(ctx sdk.Context, denom string) sdk.Coin { +func (k *fakeBankKeeper) GetSupply(ctx context.Context, denom string) sdk.Coin { supply, found := k.supply[denom] if !found { - return sdk.NewCoin(denom, sdk.ZeroInt()) + return sdk.NewCoin(denom, sdkmath.ZeroInt()) } return sdk.NewCoin(denom, supply) diff --git a/x/incentive/legacy/v0_15/types.go b/x/incentive/legacy/v0_15/types.go index 58f6f912bf..8f78bcb31d 100644 --- a/x/incentive/legacy/v0_15/types.go +++ b/x/incentive/legacy/v0_15/types.go @@ -79,8 +79,8 @@ type RewardIndexes []RewardIndex // RewardIndex stores reward accumulation information type RewardIndex struct { - CollateralType string `json:"collateral_type" yaml:"collateral_type"` - RewardFactor sdk.Dec `json:"reward_factor" yaml:"reward_factor"` + CollateralType string `json:"collateral_type" yaml:"collateral_type"` + RewardFactor sdkmath.LegacyDec `json:"reward_factor" yaml:"reward_factor"` } // USDXMintingClaims slice of USDXMintingClaim @@ -155,9 +155,9 @@ type Multipliers []Multiplier // Multiplier amount the claim rewards get increased by, along with how long the claim rewards are locked type Multiplier struct { - Name MultiplierName `json:"name" yaml:"name"` - MonthsLockup int64 `json:"months_lockup" yaml:"months_lockup"` - Factor sdk.Dec `json:"factor" yaml:"factor"` + Name MultiplierName `json:"name" yaml:"name"` + MonthsLockup int64 `json:"months_lockup" yaml:"months_lockup"` + Factor sdkmath.LegacyDec `json:"factor" yaml:"factor"` } // MultiplierName is the user facing ID for a multiplier. There is a restricted set of possible values. diff --git a/x/incentive/legacy/v0_16/migrate_test.go b/x/incentive/legacy/v0_16/migrate_test.go index 0cfb101435..9c02713865 100644 --- a/x/incentive/legacy/v0_16/migrate_test.go +++ b/x/incentive/legacy/v0_16/migrate_test.go @@ -108,17 +108,17 @@ func (s *migrateTestSuite) TestMigrate_GenState() { { Name: v015incentive.Small, MonthsLockup: 6, - Factor: sdk.MustNewDecFromStr("0.5"), + Factor: sdkmath.LegacyMustNewDecFromStr("0.5"), }, { Name: v015incentive.Large, MonthsLockup: 12, - Factor: sdk.MustNewDecFromStr("0.8"), + Factor: sdkmath.LegacyMustNewDecFromStr("0.8"), }, { Name: v015incentive.Medium, MonthsLockup: 9, - Factor: sdk.MustNewDecFromStr("0.7"), + Factor: sdkmath.LegacyMustNewDecFromStr("0.7"), }, }, }, @@ -137,7 +137,7 @@ func (s *migrateTestSuite) TestMigrate_GenState() { RewardIndexes: []v015incentive.RewardIndex{ { CollateralType: "bnb", - RewardFactor: sdk.MustNewDecFromStr("0.15"), + RewardFactor: sdkmath.LegacyMustNewDecFromStr("0.15"), }, }, }, @@ -152,7 +152,7 @@ func (s *migrateTestSuite) TestMigrate_GenState() { RewardIndexes: v015incentive.RewardIndexes{ { CollateralType: "kava", - RewardFactor: sdk.MustNewDecFromStr("0.5"), + RewardFactor: sdkmath.LegacyMustNewDecFromStr("0.5"), }, }, }, @@ -170,7 +170,7 @@ func (s *migrateTestSuite) TestMigrate_GenState() { RewardIndexes: []v015incentive.RewardIndex{ { CollateralType: "bnb", - RewardFactor: sdk.MustNewDecFromStr("0.15"), + RewardFactor: sdkmath.LegacyMustNewDecFromStr("0.15"), }, }, }, @@ -189,7 +189,7 @@ func (s *migrateTestSuite) TestMigrate_GenState() { RewardIndexes: []v015incentive.RewardIndex{ { CollateralType: "bnb", - RewardFactor: sdk.MustNewDecFromStr("0.15"), + RewardFactor: sdkmath.LegacyMustNewDecFromStr("0.15"), }, }, }, @@ -208,7 +208,7 @@ func (s *migrateTestSuite) TestMigrate_GenState() { RewardIndexes: []v015incentive.RewardIndex{ { CollateralType: "bnb", - RewardFactor: sdk.MustNewDecFromStr("0.15"), + RewardFactor: sdkmath.LegacyMustNewDecFromStr("0.15"), }, }, }, @@ -227,7 +227,7 @@ func (s *migrateTestSuite) TestMigrate_GenState() { RewardIndexes: []v015incentive.RewardIndex{ { CollateralType: "bnb", - RewardFactor: sdk.MustNewDecFromStr("0.25"), + RewardFactor: sdkmath.LegacyMustNewDecFromStr("0.25"), }, }, }, @@ -245,7 +245,7 @@ func (s *migrateTestSuite) TestMigrate_GenState() { RewardIndexes: []v015incentive.RewardIndex{ { CollateralType: "bnb", - RewardFactor: sdk.MustNewDecFromStr("0.25"), + RewardFactor: sdkmath.LegacyMustNewDecFromStr("0.25"), }, }, }, @@ -256,7 +256,7 @@ func (s *migrateTestSuite) TestMigrate_GenState() { RewardIndexes: []v015incentive.RewardIndex{ { CollateralType: "bnb", - RewardFactor: sdk.MustNewDecFromStr("0.25"), + RewardFactor: sdkmath.LegacyMustNewDecFromStr("0.25"), }, }, }, @@ -275,7 +275,7 @@ func (s *migrateTestSuite) TestMigrate_GenState() { RewardIndexes: []v015incentive.RewardIndex{ { CollateralType: "bnb", - RewardFactor: sdk.MustNewDecFromStr("0.25"), + RewardFactor: sdkmath.LegacyMustNewDecFromStr("0.25"), }, }, }, @@ -294,7 +294,7 @@ func (s *migrateTestSuite) TestMigrate_GenState() { RewardIndexes: []v015incentive.RewardIndex{ { CollateralType: "bnb", - RewardFactor: sdk.MustNewDecFromStr("0.25"), + RewardFactor: sdkmath.LegacyMustNewDecFromStr("0.25"), }, }, }, @@ -316,7 +316,7 @@ func (s *migrateTestSuite) TestMigrate_GenState() { RewardIndexes: []v016incentive.RewardIndex{ { CollateralType: "bnb", - RewardFactor: sdk.MustNewDecFromStr("0.15"), + RewardFactor: sdkmath.LegacyMustNewDecFromStr("0.15"), }, }, }, @@ -376,17 +376,17 @@ func (s *migrateTestSuite) TestMigrate_GenState() { { Name: "small", MonthsLockup: 6, - Factor: sdk.MustNewDecFromStr("0.5"), + Factor: sdkmath.LegacyMustNewDecFromStr("0.5"), }, { Name: "large", MonthsLockup: 12, - Factor: sdk.MustNewDecFromStr("0.8"), + Factor: sdkmath.LegacyMustNewDecFromStr("0.8"), }, { Name: "medium", MonthsLockup: 9, - Factor: sdk.MustNewDecFromStr("0.7"), + Factor: sdkmath.LegacyMustNewDecFromStr("0.7"), }, }, }, @@ -401,7 +401,7 @@ func (s *migrateTestSuite) TestMigrate_GenState() { RewardIndexes: v016incentive.RewardIndexes{ { CollateralType: "kava", - RewardFactor: sdk.MustNewDecFromStr("0.5"), + RewardFactor: sdkmath.LegacyMustNewDecFromStr("0.5"), }, }, }, @@ -419,7 +419,7 @@ func (s *migrateTestSuite) TestMigrate_GenState() { RewardIndexes: []v016incentive.RewardIndex{ { CollateralType: "bnb", - RewardFactor: sdk.MustNewDecFromStr("0.15"), + RewardFactor: sdkmath.LegacyMustNewDecFromStr("0.15"), }, }, }, @@ -438,7 +438,7 @@ func (s *migrateTestSuite) TestMigrate_GenState() { RewardIndexes: []v016incentive.RewardIndex{ { CollateralType: "bnb", - RewardFactor: sdk.MustNewDecFromStr("0.15"), + RewardFactor: sdkmath.LegacyMustNewDecFromStr("0.15"), }, }, }, @@ -457,7 +457,7 @@ func (s *migrateTestSuite) TestMigrate_GenState() { RewardIndexes: []v016incentive.RewardIndex{ { CollateralType: "bnb", - RewardFactor: sdk.MustNewDecFromStr("0.15"), + RewardFactor: sdkmath.LegacyMustNewDecFromStr("0.15"), }, }, }, @@ -476,7 +476,7 @@ func (s *migrateTestSuite) TestMigrate_GenState() { RewardIndexes: []v016incentive.RewardIndex{ { CollateralType: "bnb", - RewardFactor: sdk.MustNewDecFromStr("0.25"), + RewardFactor: sdkmath.LegacyMustNewDecFromStr("0.25"), }, }, }, @@ -494,7 +494,7 @@ func (s *migrateTestSuite) TestMigrate_GenState() { RewardIndexes: []v016incentive.RewardIndex{ { CollateralType: "bnb", - RewardFactor: sdk.MustNewDecFromStr("0.25"), + RewardFactor: sdkmath.LegacyMustNewDecFromStr("0.25"), }, }, }, @@ -505,7 +505,7 @@ func (s *migrateTestSuite) TestMigrate_GenState() { RewardIndexes: []v016incentive.RewardIndex{ { CollateralType: "bnb", - RewardFactor: sdk.MustNewDecFromStr("0.25"), + RewardFactor: sdkmath.LegacyMustNewDecFromStr("0.25"), }, }, }, @@ -524,7 +524,7 @@ func (s *migrateTestSuite) TestMigrate_GenState() { RewardIndexes: []v016incentive.RewardIndex{ { CollateralType: "bnb", - RewardFactor: sdk.MustNewDecFromStr("0.25"), + RewardFactor: sdkmath.LegacyMustNewDecFromStr("0.25"), }, }, }, @@ -543,7 +543,7 @@ func (s *migrateTestSuite) TestMigrate_GenState() { RewardIndexes: []v016incentive.RewardIndex{ { CollateralType: "bnb", - RewardFactor: sdk.MustNewDecFromStr("0.25"), + RewardFactor: sdkmath.LegacyMustNewDecFromStr("0.25"), }, }, }, diff --git a/x/incentive/module.go b/x/incentive/module.go index f3a9dfc6e3..1943561f02 100644 --- a/x/incentive/module.go +++ b/x/incentive/module.go @@ -2,8 +2,8 @@ package incentive import ( "context" + "cosmossdk.io/core/appmodule" "encoding/json" - "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" @@ -21,8 +21,10 @@ import ( ) var ( - _ module.AppModule = AppModule{} + _ appmodule.AppModule = AppModule{} _ module.AppModuleBasic = AppModuleBasic{} + + _ appmodule.HasBeginBlocker = (*AppModule)(nil) ) // AppModuleBasic defines the basic application module used by the incentive module. @@ -133,11 +135,18 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // BeginBlock returns the begin blocker for the incentive module. -func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { - BeginBlocker(ctx, am.keeper) +func (am AppModule) BeginBlock(ctx context.Context) error { + sdkCtx := sdk.UnwrapSDKContext(ctx) + BeginBlocker(sdkCtx, am.keeper) + + return nil } // EndBlock returns the end blocker for the incentive module. It returns no validator updates. -func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - return []abci.ValidatorUpdate{} +func (am AppModule) EndBlock(_ context.Context) ([]abci.ValidatorUpdate, error) { + return []abci.ValidatorUpdate{}, nil } + +func (AppModule) IsOnePerModuleType() {} + +func (AppModule) IsAppModule() {} diff --git a/x/incentive/spec/02_state.md b/x/incentive/spec/02_state.md index d76bfd9d69..7066667d5b 100644 --- a/x/incentive/spec/02_state.md +++ b/x/incentive/spec/02_state.md @@ -105,7 +105,7 @@ type BaseMultiClaim struct { // RewardIndex stores reward accumulation information type RewardIndex struct { CollateralType string `json:"collateral_type" yaml:"collateral_type"` - RewardFactor sdk.Dec `json:"reward_factor" yaml:"reward_factor"` + RewardFactor sdkmath.LegacyDec `json:"reward_factor" yaml:"reward_factor"` } // MultiRewardIndex stores reward accumulation information on multiple reward types diff --git a/x/incentive/spec/06_hooks.md b/x/incentive/spec/06_hooks.md index b532fa3311..42fbc981f2 100644 --- a/x/incentive/spec/06_hooks.md +++ b/x/incentive/spec/06_hooks.md @@ -83,7 +83,7 @@ func (h Hooks) BeforeDelegationSharesModified(ctx sdk.Context, delAddr sdk.AccAd // NOTE: following hooks are just implemented to ensure StakingHooks interface compliance // BeforeValidatorSlashed is called before a validator is slashed -func (h Hooks) BeforeValidatorSlashed(ctx sdk.Context, valAddr sdk.ValAddress, fraction sdk.Dec) {} +func (h Hooks) BeforeValidatorSlashed(ctx sdk.Context, valAddr sdk.ValAddress, fraction sdkmath.LegacyDec) {} // AfterValidatorBeginUnbonding is called after a validator begins unbonding func (h Hooks) AfterValidatorBeginUnbonding(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) { diff --git a/x/incentive/testutil/builder.go b/x/incentive/testutil/builder.go index e6ff578903..480089f0f4 100644 --- a/x/incentive/testutil/builder.go +++ b/x/incentive/testutil/builder.go @@ -211,7 +211,7 @@ func (builder IncentiveGenesisBuilder) simpleRewardPeriod(ctype string, rewardsP func newZeroRewardIndexesFromCoins(coins ...sdk.Coin) types.RewardIndexes { var ri types.RewardIndexes for _, coin := range coins { - ri = ri.With(coin.Denom, sdk.ZeroDec()) + ri = ri.With(coin.Denom, sdkmath.LegacyZeroDec()) } return ri } @@ -252,12 +252,12 @@ func (builder HardGenesisBuilder) WithInitializedMoneyMarket(market hardtypes.Mo builder.PreviousAccumulationTimes = append( builder.PreviousAccumulationTimes, - hardtypes.NewGenesisAccumulationTime(market.Denom, builder.genesisTime, sdk.OneDec(), sdk.OneDec()), + hardtypes.NewGenesisAccumulationTime(market.Denom, builder.genesisTime, sdkmath.LegacyOneDec(), sdkmath.LegacyOneDec()), ) return builder } -func (builder HardGenesisBuilder) WithMinBorrow(minUSDValue sdk.Dec) HardGenesisBuilder { +func (builder HardGenesisBuilder) WithMinBorrow(minUSDValue sdkmath.LegacyDec) HardGenesisBuilder { builder.Params.MinimumBorrowUSDValue = minUSDValue return builder } @@ -267,19 +267,19 @@ func NewStandardMoneyMarket(denom string) hardtypes.MoneyMarket { denom, hardtypes.NewBorrowLimit( false, - sdk.NewDec(1e15), - sdk.MustNewDecFromStr("0.6"), + sdkmath.LegacyNewDec(1e15), + sdkmath.LegacyMustNewDecFromStr("0.6"), ), denom+":usd", sdkmath.NewInt(1e6), hardtypes.NewInterestRateModel( - sdk.MustNewDecFromStr("0.05"), - sdk.MustNewDecFromStr("2"), - sdk.MustNewDecFromStr("0.8"), - sdk.MustNewDecFromStr("10"), + sdkmath.LegacyMustNewDecFromStr("0.05"), + sdkmath.LegacyMustNewDecFromStr("2"), + sdkmath.LegacyMustNewDecFromStr("0.8"), + sdkmath.LegacyMustNewDecFromStr("10"), ), - sdk.MustNewDecFromStr("0.05"), - sdk.ZeroDec(), + sdkmath.LegacyMustNewDecFromStr("0.05"), + sdkmath.LegacyZeroDec(), ) } diff --git a/x/incentive/testutil/integration.go b/x/incentive/testutil/integration.go index 549a210554..218f4fb70e 100644 --- a/x/incentive/testutil/integration.go +++ b/x/incentive/testutil/integration.go @@ -3,15 +3,14 @@ package testutil import ( "errors" "fmt" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" "time" sdkmath "cosmossdk.io/math" abcitypes "github.com/cometbft/cometbft/abci/types" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" distributiontypes "github.com/cosmos/cosmos-sdk/x/distribution/types" proposaltypes "github.com/cosmos/cosmos-sdk/x/params/types/proposal" @@ -82,56 +81,52 @@ func (suite *IntegrationTester) StartChain(genesisStates ...app.GenesisState) { genesisStates..., ) - suite.Ctx = suite.App.NewContext(false, tmproto.Header{ - Height: 1, - Time: suite.GenesisTime, - ChainID: app.TestChainId, - }) + suite.Ctx = suite.App.NewContextLegacy(false, tmproto.Header{Height: 1, Time: suite.GenesisTime, ChainID: app.TestChainId}) } func (suite *IntegrationTester) NextBlockAfter(blockDuration time.Duration) { suite.NextBlockAfterWithReq( blockDuration, - abcitypes.RequestEndBlock{}, - abcitypes.RequestBeginBlock{}, + //abcitypes.RequestEndBlock{}, + //abcitypes.RequestBeginBlock{}, ) } func (suite *IntegrationTester) NextBlockAfterWithReq( blockDuration time.Duration, - reqEnd abcitypes.RequestEndBlock, - reqBegin abcitypes.RequestBeginBlock, -) (abcitypes.ResponseEndBlock, abcitypes.ResponseBeginBlock) { + // reqEnd abcitypes.RequestEndBlock, + // reqBegin abcitypes.RequestBeginBlock, +) (sdk.EndBlock, sdk.BeginBlock) { return suite.NextBlockAtWithRequest( suite.Ctx.BlockTime().Add(blockDuration), - reqEnd, - reqBegin, + //reqEnd, + //reqBegin, ) } func (suite *IntegrationTester) NextBlockAt( blockTime time.Time, -) (abcitypes.ResponseEndBlock, abcitypes.ResponseBeginBlock) { +) (sdk.EndBlock, sdk.BeginBlock) { return suite.NextBlockAtWithRequest( blockTime, - abcitypes.RequestEndBlock{}, - abcitypes.RequestBeginBlock{}, + //abcitypes.RequestEndBlock{}, + //abcitypes.RequestBeginBlock{}, ) } func (suite *IntegrationTester) NextBlockAtWithRequest( blockTime time.Time, - reqEnd abcitypes.RequestEndBlock, - reqBegin abcitypes.RequestBeginBlock, -) (abcitypes.ResponseEndBlock, abcitypes.ResponseBeginBlock) { +) (sdk.EndBlock, sdk.BeginBlock) { if !suite.Ctx.BlockTime().Before(blockTime) { panic(fmt.Sprintf("new block time %s must be after current %s", blockTime, suite.Ctx.BlockTime())) } blockHeight := suite.Ctx.BlockHeight() + 1 - responseEndBlock := suite.App.EndBlocker(suite.Ctx, reqEnd) + responseEndBlock, err := suite.App.EndBlocker(suite.Ctx) + suite.Require().NoError(err) suite.Ctx = suite.Ctx.WithBlockTime(blockTime).WithBlockHeight(blockHeight).WithChainID(app.TestChainId) - responseBeginBlock := suite.App.BeginBlocker(suite.Ctx, reqBegin) // height and time in RequestBeginBlock are ignored by module begin blockers + responseBeginBlock, err := suite.App.BeginBlocker(suite.Ctx) // height and time in RequestBeginBlock are ignored by module begin blockers + suite.Require().NoError(err) return responseEndBlock, responseBeginBlock } @@ -169,8 +164,8 @@ func (suite *IntegrationTester) MintLiquidAnyValAddr( amount sdk.Coin, ) (sdk.Coin, error) { // Check if validator already created - _, found := suite.App.GetStakingKeeper().GetValidator(suite.Ctx, validator) - if !found { + _, err := suite.App.GetStakingKeeper().GetValidator(suite.Ctx, validator) + if err != nil { // Create validator if err := suite.DeliverMsgCreateValidator(validator, sdk.NewCoin("ukava", sdkmath.NewInt(1e9))); err != nil { return sdk.Coin{}, err @@ -187,8 +182,8 @@ func (suite *IntegrationTester) MintLiquidAnyValAddr( func (suite *IntegrationTester) GetAbciValidator(valAddr sdk.ValAddress) abcitypes.Validator { sk := suite.App.GetStakingKeeper() - val, found := sk.GetValidator(suite.Ctx, valAddr) - suite.Require().True(found) + val, err := sk.GetValidator(suite.Ctx, valAddr) + suite.Require().NoError(err) pk, err := val.ConsPubKey() suite.Require().NoError(err) @@ -201,11 +196,11 @@ func (suite *IntegrationTester) GetAbciValidator(valAddr sdk.ValAddress) abcityp func (suite *IntegrationTester) DeliverMsgCreateValidator(address sdk.ValAddress, selfDelegation sdk.Coin) error { msg, err := stakingtypes.NewMsgCreateValidator( - address, + address.String(), ed25519.GenPrivKey().PubKey(), selfDelegation, - stakingtypes.Description{}, - stakingtypes.NewCommissionRates(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()), + stakingtypes.NewDescription("foo_moniker", "", "", "", ""), + stakingtypes.NewCommissionRates(sdkmath.LegacyZeroDec(), sdkmath.LegacyZeroDec(), sdkmath.LegacyZeroDec()), sdkmath.NewInt(1_000_000), ) if err != nil { @@ -220,8 +215,8 @@ func (suite *IntegrationTester) DeliverMsgCreateValidator(address sdk.ValAddress func (suite *IntegrationTester) DeliverMsgDelegate(delegator sdk.AccAddress, validator sdk.ValAddress, amount sdk.Coin) error { msg := stakingtypes.NewMsgDelegate( - delegator, - validator, + delegator.String(), + validator.String(), amount, ) msgServer := stakingkeeper.NewMsgServerImpl(suite.App.GetStakingKeeper()) @@ -229,7 +224,7 @@ func (suite *IntegrationTester) DeliverMsgDelegate(delegator sdk.AccAddress, val return err } -func (suite *IntegrationTester) DeliverSwapMsgDeposit(depositor sdk.AccAddress, tokenA, tokenB sdk.Coin, slippage sdk.Dec) error { +func (suite *IntegrationTester) DeliverSwapMsgDeposit(depositor sdk.AccAddress, tokenA, tokenB sdk.Coin, slippage sdkmath.LegacyDec) error { msg := swaptypes.NewMsgDeposit( depositor.String(), tokenA, @@ -351,12 +346,12 @@ func (suite *IntegrationTester) ProposeAndVoteOnNewParams(voter sdk.AccAddress, suite.NoError(err) } -func (suite *IntegrationTester) GetAccount(addr sdk.AccAddress) authtypes.AccountI { +func (suite *IntegrationTester) GetAccount(addr sdk.AccAddress) sdk.AccountI { ak := suite.App.GetAccountKeeper() return ak.GetAccount(suite.Ctx, addr) } -func (suite *IntegrationTester) GetModuleAccount(name string) authtypes.ModuleAccountI { +func (suite *IntegrationTester) GetModuleAccount(name string) sdk.ModuleAccountI { ak := suite.App.GetAccountKeeper() return ak.GetModuleAccount(suite.Ctx, name) } @@ -433,12 +428,14 @@ func (suite *IntegrationTester) USDXRewardEquals(owner sdk.AccAddress, expected func (suite *IntegrationTester) EarnRewardEquals(owner sdk.AccAddress, expected sdk.Coins) { claim, found := suite.App.GetIncentiveKeeper().GetEarnClaim(suite.Ctx, owner) suite.Require().Truef(found, "expected earn claim to be found for %s", owner) - suite.Truef(expected.IsEqual(claim.Reward), "expected earn claim reward to be %s, but got %s", expected, claim.Reward) + suite.Truef(expected.Equal(claim.Reward), "expected earn claim reward to be %s, but got %s", expected, claim.Reward) } // AddTestAddrsFromPubKeys adds the addresses into the SimApp providing only the public keys. func (suite *IntegrationTester) AddTestAddrsFromPubKeys(ctx sdk.Context, pubKeys []cryptotypes.PubKey, accAmt sdkmath.Int) { - initCoins := sdk.NewCoins(sdk.NewCoin(suite.App.GetStakingKeeper().BondDenom(ctx), accAmt)) + bondDenom, err := suite.App.GetStakingKeeper().BondDenom(ctx) + suite.Require().NoError(err) + initCoins := sdk.NewCoins(sdk.NewCoin(bondDenom, accAmt)) for _, pk := range pubKeys { suite.App.FundAccount(ctx, sdk.AccAddress(pk.Address()), initCoins) @@ -539,7 +536,7 @@ func (suite *IntegrationTester) DeliverMsgDelegateMint( // x/distribution func (suite *IntegrationTester) GetBeginBlockClaimedStakingRewards( - resBeginBlock abcitypes.ResponseBeginBlock, + resBeginBlock sdk.BeginBlock, ) (validatorRewards map[string]sdk.Coins, totalRewards sdk.Coins) { // Events emitted in BeginBlocker are in the ResponseBeginBlock, not in // ctx.EventManager().Events() as BeginBlock is called with a NewEventManager() diff --git a/x/incentive/testutil/mint_builder.go b/x/incentive/testutil/mint_builder.go index 9c7bde74ad..2ff3212f4d 100644 --- a/x/incentive/testutil/mint_builder.go +++ b/x/incentive/testutil/mint_builder.go @@ -1,8 +1,8 @@ package testutil import ( + sdkmath "cosmossdk.io/math" "github.com/cosmos/cosmos-sdk/codec" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/kava-labs/kava/app" minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" @@ -39,22 +39,22 @@ func (builder MintGenesisBuilder) BuildMarshalled(cdc codec.JSONCodec) app.Genes } func (builder MintGenesisBuilder) WithMinter( - inflation sdk.Dec, - annualProvisions sdk.Dec, + inflation sdkmath.LegacyDec, + annualProvisions sdkmath.LegacyDec, ) MintGenesisBuilder { builder.Minter = minttypes.NewMinter(inflation, annualProvisions) return builder } func (builder MintGenesisBuilder) WithInflationMax( - inflationMax sdk.Dec, + inflationMax sdkmath.LegacyDec, ) MintGenesisBuilder { builder.Params.InflationMax = inflationMax return builder } func (builder MintGenesisBuilder) WithInflationMin( - inflationMin sdk.Dec, + inflationMin sdkmath.LegacyDec, ) MintGenesisBuilder { builder.Params.InflationMin = inflationMin return builder diff --git a/x/incentive/types/accumulator.go b/x/incentive/types/accumulator.go index e9937cc8be..7aec182603 100644 --- a/x/incentive/types/accumulator.go +++ b/x/incentive/types/accumulator.go @@ -1,6 +1,7 @@ package types import ( + sdkmath "cosmossdk.io/math" "fmt" "math" "time" @@ -30,7 +31,7 @@ func NewAccumulator(previousAccrual time.Time, indexes RewardIndexes) *Accumulat // If a period ends before currentTime, the PreviousAccrualTime is shortened to the end time. This allows accumulate to be called sequentially on consecutive reward periods. // // totalSourceShares is the sum of all users' source shares. For example:total btcb supplied to hard, total usdx borrowed from all bnb CDPs, or total shares in a swap pool. -func (acc *Accumulator) Accumulate(period MultiRewardPeriod, totalSourceShares sdk.Dec, currentTime time.Time) { +func (acc *Accumulator) Accumulate(period MultiRewardPeriod, totalSourceShares sdkmath.LegacyDec, currentTime time.Time) { acc.AccumulateDecCoins( period.Start, period.End, @@ -45,7 +46,7 @@ func (acc *Accumulator) AccumulateDecCoins( periodStart time.Time, periodEnd time.Time, periodRewardsPerSecond sdk.DecCoins, - totalSourceShares sdk.Dec, + totalSourceShares sdkmath.LegacyDec, currentTime time.Time, ) { accumulationDuration := acc.getTimeElapsedWithinLimits(acc.PreviousAccumulationTime, currentTime, periodStart, periodEnd) @@ -76,8 +77,8 @@ func (*Accumulator) getTimeElapsedWithinLimits(start, end, limitMin, limitMax ti // The total rewards to distribute in this block are given by reward rate * duration. This value divided by the sum of all source shares to give // total rewards per source share, which is what the indexes store. // Note, duration is rounded to the nearest second to keep rewards calculation consistent with kava-7. -func (*Accumulator) calculateNewRewards(rewardsPerSecond sdk.DecCoins, totalSourceShares sdk.Dec, duration time.Duration) RewardIndexes { - if totalSourceShares.LTE(sdk.ZeroDec()) { +func (*Accumulator) calculateNewRewards(rewardsPerSecond sdk.DecCoins, totalSourceShares sdkmath.LegacyDec, duration time.Duration) RewardIndexes { + if totalSourceShares.LTE(sdkmath.LegacyZeroDec()) { // When there is zero source shares, there is no users with deposits/borrows/delegations to pay out the current block's rewards to. // So drop the rewards and pay out nothing. return nil @@ -89,7 +90,7 @@ func (*Accumulator) calculateNewRewards(rewardsPerSecond sdk.DecCoins, totalSour return nil } increment := NewRewardIndexesFromCoins(rewardsPerSecond) - increment = increment.Mul(sdk.NewDec(durationSeconds)).Quo(totalSourceShares) + increment = increment.Mul(sdkmath.LegacyNewDec(durationSeconds)).Quo(totalSourceShares) return increment } @@ -140,5 +141,5 @@ func CalculatePerSecondRewards( return nil, upTo // TODO } - return periodRewardsPerSecond.MulDec(sdk.NewDec(durationSeconds)), upTo + return periodRewardsPerSecond.MulDec(sdkmath.LegacyNewDec(durationSeconds)), upTo } diff --git a/x/incentive/types/accumulator_test.go b/x/incentive/types/accumulator_test.go index f179284791..af36f12951 100644 --- a/x/incentive/types/accumulator_test.go +++ b/x/incentive/types/accumulator_test.go @@ -1,6 +1,7 @@ package types import ( + sdkmath "cosmossdk.io/math" "testing" "time" @@ -104,7 +105,7 @@ func TestAccumulator(t *testing.T) { type args struct { rewardsPerSecond sdk.Coins duration time.Duration - totalSourceShares sdk.Dec + totalSourceShares sdkmath.LegacyDec } testcases := []struct { name string @@ -201,7 +202,7 @@ func TestAccumulator(t *testing.T) { type args struct { accumulator Accumulator period MultiRewardPeriod - totalSourceShares sdk.Dec + totalSourceShares sdkmath.LegacyDec currentTime time.Time } testcases := []struct { diff --git a/x/incentive/types/apy.go b/x/incentive/types/apy.go index d7e54462f1..17504950ca 100644 --- a/x/incentive/types/apy.go +++ b/x/incentive/types/apy.go @@ -1,9 +1,11 @@ package types -import sdk "github.com/cosmos/cosmos-sdk/types" +import ( + sdkmath "cosmossdk.io/math" +) // NewAPY returns a new instance of APY -func NewAPY(collateralType string, apy sdk.Dec) Apy { +func NewAPY(collateralType string, apy sdkmath.LegacyDec) Apy { return Apy{ CollateralType: collateralType, Apy: apy, diff --git a/x/incentive/types/apy.pb.go b/x/incentive/types/apy.pb.go index ecf4ca3b51..3378ec48cf 100644 --- a/x/incentive/types/apy.pb.go +++ b/x/incentive/types/apy.pb.go @@ -4,9 +4,9 @@ package types import ( + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" _ "github.com/cosmos/cosmos-proto" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" io "io" @@ -28,8 +28,8 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // Apy contains the calculated APY for a given collateral type at a specific // instant in time. type Apy struct { - CollateralType string `protobuf:"bytes,1,opt,name=collateral_type,json=collateralType,proto3" json:"collateral_type,omitempty"` - Apy github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=apy,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"apy"` + CollateralType string `protobuf:"bytes,1,opt,name=collateral_type,json=collateralType,proto3" json:"collateral_type,omitempty"` + Apy cosmossdk_io_math.LegacyDec `protobuf:"bytes,2,opt,name=apy,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"apy"` } func (m *Apy) Reset() { *m = Apy{} } @@ -79,23 +79,23 @@ func init() { func init() { proto.RegisterFile("kava/incentive/v1beta1/apy.proto", fileDescriptor_b2c1ad571f25cae9) } var fileDescriptor_b2c1ad571f25cae9 = []byte{ - // 248 bytes of a gzipped FileDescriptorProto + // 255 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0xc8, 0x4e, 0x2c, 0x4b, 0xd4, 0xcf, 0xcc, 0x4b, 0x4e, 0xcd, 0x2b, 0xc9, 0x2c, 0x4b, 0xd5, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34, 0xd4, 0x4f, 0x2c, 0xa8, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x03, 0xa9, 0xd0, 0x83, 0xab, 0xd0, 0x83, 0xaa, 0x90, 0x92, 0x4c, 0xce, 0x2f, 0xce, 0xcd, 0x2f, 0x8e, 0x07, 0xab, 0xd2, 0x87, 0x70, 0x20, 0x5a, 0xa4, 0x44, 0xd2, 0xf3, 0xd3, 0xf3, 0x21, 0xe2, 0x20, 0x16, - 0x44, 0x54, 0xa9, 0x8e, 0x8b, 0xd9, 0xb1, 0xa0, 0x52, 0x48, 0x9d, 0x8b, 0x3f, 0x39, 0x3f, 0x27, + 0x44, 0x54, 0xa9, 0x98, 0x8b, 0xd9, 0xb1, 0xa0, 0x52, 0x48, 0x9d, 0x8b, 0x3f, 0x39, 0x3f, 0x27, 0x27, 0xb1, 0x24, 0xb5, 0x28, 0x31, 0x27, 0xbe, 0xa4, 0xb2, 0x20, 0x55, 0x82, 0x51, 0x81, 0x51, - 0x83, 0x33, 0x88, 0x0f, 0x21, 0x1c, 0x52, 0x59, 0x90, 0x2a, 0xe4, 0xc7, 0xc5, 0x9c, 0x58, 0x50, - 0x29, 0xc1, 0x04, 0x92, 0x74, 0xb2, 0x39, 0x71, 0x4f, 0x9e, 0xe1, 0xd6, 0x3d, 0x79, 0xb5, 0xf4, - 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0xa8, 0x9d, 0x50, 0x4a, 0xb7, 0x38, 0x25, - 0x5b, 0x1f, 0x64, 0x5a, 0xb1, 0x9e, 0x4b, 0x6a, 0xf2, 0xa5, 0x2d, 0xba, 0x5c, 0x50, 0x27, 0xb9, - 0xa4, 0x26, 0x07, 0x81, 0x0c, 0x72, 0x72, 0x3d, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, - 0x07, 0x8f, 0xe4, 0x18, 0x27, 0x3c, 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, 0xe1, 0xc6, 0x63, 0x39, - 0x86, 0x28, 0x6d, 0x24, 0x43, 0x41, 0xbe, 0xd5, 0xcd, 0x49, 0x4c, 0x2a, 0x06, 0xb3, 0xf4, 0x2b, - 0x90, 0xc2, 0x06, 0x6c, 0x7a, 0x12, 0x1b, 0xd8, 0x37, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, - 0x95, 0x59, 0xa8, 0x77, 0x3a, 0x01, 0x00, 0x00, + 0x83, 0x33, 0x88, 0x0f, 0x21, 0x1c, 0x52, 0x59, 0x90, 0x2a, 0xe4, 0xcc, 0xc5, 0x9c, 0x58, 0x50, + 0x29, 0xc1, 0x04, 0x92, 0x74, 0x32, 0x3c, 0x71, 0x4f, 0x9e, 0xe1, 0xd6, 0x3d, 0x79, 0x69, 0x88, + 0x45, 0xc5, 0x29, 0xd9, 0x7a, 0x99, 0xf9, 0xfa, 0xb9, 0x89, 0x25, 0x19, 0x7a, 0x3e, 0xa9, 0xe9, + 0x89, 0xc9, 0x95, 0x2e, 0xa9, 0xc9, 0x97, 0xb6, 0xe8, 0x72, 0x41, 0xdd, 0xe1, 0x92, 0x9a, 0x1c, + 0x04, 0xd2, 0xed, 0xe4, 0x7a, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, + 0x31, 0x4e, 0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51, 0xda, + 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0x20, 0x2f, 0xea, 0xe6, 0x24, + 0x26, 0x15, 0x83, 0x59, 0xfa, 0x15, 0x48, 0x01, 0x02, 0x72, 0x60, 0x71, 0x12, 0x1b, 0xd8, 0x0b, + 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x05, 0x24, 0xc5, 0xf4, 0x2f, 0x01, 0x00, 0x00, } func (m *Apy) Marshal() (dAtA []byte, err error) { diff --git a/x/incentive/types/claims.go b/x/incentive/types/claims.go index ac7bc5f611..4395067009 100644 --- a/x/incentive/types/claims.go +++ b/x/incentive/types/claims.go @@ -1,6 +1,7 @@ package types import ( + sdkmath "cosmossdk.io/math" "errors" "fmt" "strings" @@ -395,7 +396,7 @@ func (cs EarnClaims) Validate() error { // ---------------------- Reward indexes are used internally in the store ---------------------- // NewRewardIndex returns a new RewardIndex -func NewRewardIndex(collateralType string, factor sdk.Dec) RewardIndex { +func NewRewardIndex(collateralType string, factor sdkmath.LegacyDec) RewardIndex { return RewardIndex{ CollateralType: collateralType, RewardFactor: factor, @@ -427,17 +428,17 @@ func (ris RewardIndexes) GetRewardIndex(denom string) (RewardIndex, bool) { } // Get fetches a RewardFactor by it's denom -func (ris RewardIndexes) Get(denom string) (sdk.Dec, bool) { +func (ris RewardIndexes) Get(denom string) (sdkmath.LegacyDec, bool) { for _, ri := range ris { if ri.CollateralType == denom { return ri.RewardFactor, true } } - return sdk.Dec{}, false + return sdkmath.LegacyDec{}, false } // With returns a copy of the indexes with a new reward factor added -func (ris RewardIndexes) With(denom string, factor sdk.Dec) RewardIndexes { +func (ris RewardIndexes) With(denom string, factor sdkmath.LegacyDec) RewardIndexes { newIndexes := ris.copy() for i, ri := range newIndexes { @@ -470,7 +471,7 @@ func (ris RewardIndexes) Validate() error { } // Mul returns a copy of RewardIndexes with all factors multiplied by a single value. -func (ris RewardIndexes) Mul(multiplier sdk.Dec) RewardIndexes { +func (ris RewardIndexes) Mul(multiplier sdkmath.LegacyDec) RewardIndexes { newIndexes := ris.copy() for i := range newIndexes { @@ -480,8 +481,8 @@ func (ris RewardIndexes) Mul(multiplier sdk.Dec) RewardIndexes { } // Quo returns a copy of RewardIndexes with all factors divided by a single value. -// It uses sdk.Dec.Quo for the division. -func (ris RewardIndexes) Quo(divisor sdk.Dec) RewardIndexes { +// It uses sdkmath.LegacyDec.Quo for the division. +func (ris RewardIndexes) Quo(divisor sdkmath.LegacyDec) RewardIndexes { newIndexes := ris.copy() for i := range newIndexes { diff --git a/x/incentive/types/claims.pb.go b/x/incentive/types/claims.pb.go index 8f098c5578..16392ca497 100644 --- a/x/incentive/types/claims.pb.go +++ b/x/incentive/types/claims.pb.go @@ -4,6 +4,7 @@ package types import ( + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" _ "github.com/cosmos/cosmos-proto" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" @@ -106,8 +107,8 @@ var xxx_messageInfo_BaseMultiClaim proto.InternalMessageInfo // RewardIndex stores reward accumulation information type RewardIndex struct { - CollateralType string `protobuf:"bytes,1,opt,name=collateral_type,json=collateralType,proto3" json:"collateral_type,omitempty"` - RewardFactor github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=reward_factor,json=rewardFactor,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"reward_factor"` + CollateralType string `protobuf:"bytes,1,opt,name=collateral_type,json=collateralType,proto3" json:"collateral_type,omitempty"` + RewardFactor cosmossdk_io_math.LegacyDec `protobuf:"bytes,2,opt,name=reward_factor,json=rewardFactor,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"reward_factor"` } func (m *RewardIndex) Reset() { *m = RewardIndex{} } @@ -513,51 +514,51 @@ func init() { } var fileDescriptor_5f7515029623a895 = []byte{ - // 691 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x56, 0x4f, 0x4f, 0x13, 0x4d, - 0x18, 0xef, 0xc0, 0x0b, 0x79, 0x3b, 0x94, 0xbe, 0x64, 0x81, 0x57, 0xe8, 0x61, 0x8b, 0x25, 0xc1, - 0x26, 0xa6, 0xbb, 0x82, 0x07, 0x13, 0x6f, 0x2c, 0x68, 0xc0, 0x48, 0x24, 0x5b, 0x4d, 0x8c, 0x07, - 0x9b, 0xd9, 0xdd, 0xb1, 0x4e, 0xd8, 0xee, 0xd4, 0x99, 0x6d, 0x4b, 0x3f, 0x83, 0x17, 0xfd, 0x02, - 0x7e, 0x00, 0x2f, 0x5e, 0xf8, 0x10, 0xc4, 0x78, 0x20, 0xc6, 0xc4, 0x3f, 0x87, 0x8a, 0x70, 0xf5, - 0x13, 0x78, 0x32, 0xf3, 0x07, 0x58, 0xa0, 0x25, 0xc4, 0x14, 0x0f, 0x9c, 0x76, 0xe7, 0x99, 0x67, - 0x9e, 0xdf, 0x9f, 0x79, 0x76, 0x76, 0xe0, 0xec, 0x06, 0x6a, 0x22, 0x9b, 0x44, 0x3e, 0x8e, 0x62, - 0xd2, 0xc4, 0x76, 0x73, 0xde, 0xc3, 0x31, 0x9a, 0xb7, 0xfd, 0x10, 0x91, 0x1a, 0xb7, 0xea, 0x8c, - 0xc6, 0xd4, 0xf8, 0x5f, 0x24, 0x59, 0x87, 0x49, 0x96, 0x4e, 0xca, 0x99, 0x3e, 0xe5, 0x35, 0xca, - 0x6d, 0x0f, 0xf1, 0xc4, 0x4a, 0x4a, 0x22, 0xb5, 0x2e, 0x37, 0xad, 0xe6, 0x2b, 0x72, 0x64, 0xab, - 0x81, 0x9e, 0x9a, 0xa8, 0xd2, 0x2a, 0x55, 0x71, 0xf1, 0xa6, 0xa2, 0x85, 0x77, 0x00, 0xa6, 0x1d, - 0xc4, 0xf1, 0x92, 0x40, 0x37, 0x9e, 0xc2, 0x21, 0xda, 0x8a, 0x30, 0x9b, 0x02, 0x33, 0xa0, 0x98, - 0x71, 0x56, 0x7e, 0x75, 0xf2, 0xa5, 0x2a, 0x89, 0x9f, 0x37, 0x3c, 0xcb, 0xa7, 0x35, 0x5d, 0x4f, - 0x3f, 0x4a, 0x3c, 0xd8, 0xb0, 0xe3, 0x76, 0x1d, 0x73, 0x6b, 0xd1, 0xf7, 0x17, 0x83, 0x80, 0x61, - 0xce, 0x3f, 0x6e, 0x95, 0xc6, 0x35, 0xaa, 0x8e, 0x38, 0xed, 0x18, 0x73, 0x57, 0x95, 0x35, 0x6e, - 0xc1, 0x61, 0x86, 0x5b, 0x88, 0x05, 0x53, 0x03, 0x33, 0xa0, 0x38, 0xb2, 0x30, 0x6d, 0xe9, 0x64, - 0xa1, 0xe7, 0x40, 0xa4, 0xb5, 0x44, 0x49, 0xe4, 0xfc, 0xb3, 0xdd, 0xc9, 0xa7, 0x5c, 0x9d, 0x7e, - 0x3b, 0xfd, 0x7e, 0xab, 0x34, 0x24, 0x39, 0x16, 0x76, 0x01, 0xcc, 0x0a, 0xc6, 0x6b, 0x8d, 0x30, - 0x26, 0x7f, 0x87, 0xb6, 0x9f, 0xa0, 0x3d, 0x78, 0x36, 0xed, 0x1b, 0x82, 0xf6, 0xdb, 0xef, 0xf9, - 0xe2, 0x39, 0xf0, 0xc5, 0x02, 0xde, 0x4d, 0xe2, 0x4b, 0x00, 0x47, 0x5c, 0x19, 0x5d, 0x8d, 0x02, - 0xbc, 0x69, 0x5c, 0x83, 0xff, 0xf9, 0x34, 0x0c, 0x51, 0x8c, 0x19, 0x0a, 0x2b, 0x62, 0xb1, 0x54, - 0x9a, 0x76, 0xb3, 0x47, 0xe1, 0x87, 0xed, 0x3a, 0x36, 0xca, 0x70, 0x54, 0x55, 0xab, 0x3c, 0x43, - 0x7e, 0x4c, 0x99, 0xb4, 0x39, 0xe3, 0x58, 0x82, 0xd4, 0xb7, 0x4e, 0x7e, 0xee, 0x1c, 0xa4, 0x96, - 0xb1, 0xef, 0x66, 0x54, 0x91, 0xbb, 0xb2, 0x46, 0xa1, 0x05, 0x8d, 0x04, 0x19, 0xcc, 0xd7, 0x65, - 0x87, 0x22, 0x98, 0xd5, 0x50, 0x44, 0x85, 0xa7, 0x80, 0xf4, 0x66, 0xd6, 0xea, 0xde, 0xba, 0x56, - 0xa2, 0x86, 0x33, 0xa9, 0x5d, 0x1a, 0x3d, 0x56, 0xd8, 0xd5, 0xe4, 0xf5, 0xb0, 0xf0, 0x06, 0xc0, - 0x31, 0xb9, 0xcb, 0x7f, 0xe4, 0xc5, 0x69, 0x82, 0x03, 0xfd, 0x26, 0xf8, 0x1a, 0xc0, 0x2b, 0x27, - 0x09, 0x1e, 0xf8, 0xd3, 0x84, 0x13, 0x35, 0x31, 0x55, 0xe9, 0xea, 0x52, 0xb1, 0x17, 0x89, 0x93, - 0xe5, 0x9c, 0x9c, 0x66, 0x62, 0x9c, 0x06, 0x72, 0x8d, 0xda, 0xa9, 0x58, 0xe1, 0x03, 0x80, 0x63, - 0x8f, 0xca, 0xcb, 0x8f, 0xd7, 0x48, 0x14, 0x93, 0xa8, 0xaa, 0x3e, 0x90, 0x7b, 0x10, 0x8a, 0x56, - 0xad, 0xc8, 0x33, 0x46, 0xfa, 0x35, 0xb2, 0x70, 0xb5, 0x17, 0x85, 0xc3, 0xe3, 0xc0, 0xf9, 0x57, - 0x60, 0xef, 0x74, 0xf2, 0xc0, 0x4d, 0x7b, 0x87, 0x67, 0xc4, 0xc5, 0xfb, 0x9a, 0xfc, 0x14, 0x7e, - 0x0e, 0xc0, 0xdc, 0x0a, 0x62, 0xc1, 0x7d, 0xf2, 0xa2, 0x41, 0x02, 0x12, 0xb7, 0xd7, 0x19, 0x6d, - 0x92, 0x00, 0x33, 0x45, 0xe6, 0x41, 0x17, 0x61, 0x73, 0x67, 0x09, 0x3b, 0x3a, 0x35, 0xba, 0xab, - 0xdb, 0x84, 0x93, 0xbc, 0x51, 0xaf, 0x87, 0xed, 0x4a, 0x57, 0x91, 0xfd, 0xd9, 0xb7, 0x71, 0x05, - 0x71, 0x2c, 0x28, 0x90, 0x3d, 0xca, 0x18, 0x6d, 0x9d, 0x44, 0x1e, 0xec, 0x27, 0xb2, 0x82, 0x70, - 0x7b, 0xd9, 0xfd, 0x15, 0xc0, 0xec, 0x32, 0x0e, 0x71, 0x15, 0xc5, 0xf4, 0xa2, 0x2c, 0xde, 0xe8, - 0xd1, 0x40, 0xfd, 0x51, 0xd8, 0xbb, 0x95, 0x3e, 0x01, 0x98, 0x2e, 0xb7, 0x50, 0xfd, 0x92, 0xc9, - 0xfa, 0x0c, 0x60, 0xa6, 0x8c, 0x9a, 0x24, 0xaa, 0xf2, 0x4b, 0xb8, 0x61, 0x77, 0x10, 0x8b, 0x2e, - 0x97, 0x2c, 0x67, 0x75, 0xfb, 0x87, 0x99, 0xda, 0xde, 0x33, 0xc1, 0xce, 0x9e, 0x09, 0x76, 0xf7, - 0x4c, 0xf0, 0x6a, 0xdf, 0x4c, 0xed, 0xec, 0x9b, 0xa9, 0x2f, 0xfb, 0x66, 0xea, 0xc9, 0xf5, 0xc4, - 0x3f, 0x5a, 0xf0, 0x28, 0x85, 0xc8, 0xe3, 0xf2, 0xcd, 0xde, 0x4c, 0xdc, 0x1a, 0xe5, 0xcf, 0xda, - 0x1b, 0x96, 0x97, 0xb8, 0x9b, 0xbf, 0x03, 0x00, 0x00, 0xff, 0xff, 0x88, 0xd7, 0x8a, 0x4f, 0x54, - 0x0a, 0x00, 0x00, + // 703 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x56, 0x4d, 0x4f, 0x13, 0x4f, + 0x18, 0xef, 0xc0, 0x1f, 0xf2, 0xef, 0x50, 0x2a, 0x59, 0x40, 0xa1, 0x26, 0x5b, 0x2c, 0x89, 0x36, + 0x31, 0xdd, 0x15, 0x3c, 0x98, 0x78, 0x63, 0x41, 0x03, 0x06, 0x22, 0x59, 0x34, 0x31, 0x1e, 0x6c, + 0x66, 0x77, 0xc7, 0x65, 0xd2, 0xed, 0x4e, 0xdd, 0xd9, 0xb6, 0xf4, 0xe6, 0x47, 0xd0, 0x2f, 0xe0, + 0x07, 0xf0, 0xe2, 0x85, 0x0f, 0x41, 0x8c, 0x07, 0x62, 0x4c, 0x7c, 0x39, 0x54, 0x84, 0xab, 0x9f, + 0xc0, 0x93, 0x99, 0x17, 0x60, 0x81, 0x96, 0x18, 0x53, 0x3c, 0xf4, 0xd4, 0x9d, 0x67, 0x9e, 0xe7, + 0xf9, 0xbd, 0xcc, 0xd3, 0xc9, 0xc0, 0xd9, 0x0a, 0x6a, 0x20, 0x93, 0x84, 0x2e, 0x0e, 0x63, 0xd2, + 0xc0, 0x66, 0x63, 0xce, 0xc1, 0x31, 0x9a, 0x33, 0xdd, 0x00, 0x91, 0x2a, 0x33, 0x6a, 0x11, 0x8d, + 0xa9, 0x76, 0x99, 0x27, 0x19, 0x47, 0x49, 0x86, 0x4a, 0xca, 0xe9, 0x2e, 0x65, 0x55, 0xca, 0x4c, + 0x07, 0xb1, 0x44, 0x25, 0x25, 0xa1, 0xac, 0xcb, 0x4d, 0xcb, 0xfd, 0xb2, 0x58, 0x99, 0x72, 0xa1, + 0xb6, 0x26, 0x7c, 0xea, 0x53, 0x19, 0xe7, 0x5f, 0x32, 0x5a, 0x78, 0x07, 0x60, 0xda, 0x42, 0x0c, + 0x2f, 0x72, 0x74, 0xed, 0x19, 0x1c, 0xa2, 0xcd, 0x10, 0x47, 0x53, 0x60, 0x06, 0x14, 0x33, 0xd6, + 0xf2, 0xaf, 0x76, 0xbe, 0xe4, 0x93, 0x78, 0xb3, 0xee, 0x18, 0x2e, 0xad, 0xaa, 0x7e, 0xea, 0xa7, + 0xc4, 0xbc, 0x8a, 0x19, 0xb7, 0x6a, 0x98, 0x19, 0x0b, 0xae, 0xbb, 0xe0, 0x79, 0x11, 0x66, 0xec, + 0xe3, 0x76, 0x69, 0x5c, 0xa1, 0xaa, 0x88, 0xd5, 0x8a, 0x31, 0xb3, 0x65, 0x5b, 0xed, 0x0e, 0x1c, + 0x8e, 0x70, 0x13, 0x45, 0xde, 0xd4, 0xc0, 0x0c, 0x28, 0x8e, 0xcc, 0x4f, 0x1b, 0x2a, 0x99, 0xeb, + 0x39, 0x14, 0x69, 0x2c, 0x52, 0x12, 0x5a, 0xff, 0xed, 0xb4, 0xf3, 0x29, 0x5b, 0xa5, 0xdf, 0x4d, + 0xbf, 0xdf, 0x2e, 0x0d, 0x09, 0x8e, 0x85, 0x3d, 0x00, 0xb3, 0x9c, 0xf1, 0x5a, 0x3d, 0x88, 0xc9, + 0xbf, 0xa1, 0xed, 0x26, 0x68, 0x0f, 0x9e, 0x4f, 0xfb, 0x16, 0xa7, 0xfd, 0xf6, 0x7b, 0xbe, 0xf8, + 0x07, 0xf8, 0xbc, 0x80, 0x75, 0x92, 0xf8, 0x12, 0xc0, 0x11, 0x5b, 0x44, 0x57, 0x42, 0x0f, 0x6f, + 0x69, 0x37, 0xe0, 0x25, 0x97, 0x06, 0x01, 0x8a, 0x71, 0x84, 0x82, 0x32, 0x2f, 0x16, 0x4a, 0xd3, + 0x76, 0xf6, 0x38, 0xfc, 0xa8, 0x55, 0xc3, 0xda, 0x32, 0x1c, 0x95, 0xdd, 0xca, 0xcf, 0x91, 0x1b, + 0xd3, 0x48, 0xd8, 0x9c, 0xb1, 0x66, 0x39, 0xa9, 0x6f, 0xed, 0xfc, 0x55, 0x49, 0x81, 0x79, 0x15, + 0x83, 0x50, 0xb3, 0x8a, 0xe2, 0x4d, 0x63, 0x15, 0xfb, 0xc8, 0x6d, 0x2d, 0x61, 0xd7, 0xce, 0xc8, + 0xca, 0xfb, 0xa2, 0xb0, 0xd0, 0x84, 0x5a, 0x82, 0x01, 0x66, 0xeb, 0x62, 0x2c, 0x11, 0xcc, 0xaa, + 0xfe, 0x44, 0x86, 0xa7, 0x80, 0x30, 0x64, 0xd6, 0xe8, 0x3c, 0xaf, 0x46, 0xa2, 0x87, 0x35, 0xa9, + 0xac, 0x19, 0x3d, 0xd1, 0xd8, 0x56, 0x8c, 0xd5, 0xb2, 0xf0, 0x06, 0xc0, 0x31, 0x71, 0xb4, 0x7f, + 0x65, 0xc0, 0x59, 0x82, 0x03, 0xbd, 0x26, 0xf8, 0x1a, 0xc0, 0x2b, 0xa7, 0x09, 0x1e, 0xfa, 0xd3, + 0x80, 0x13, 0x55, 0xbe, 0x55, 0xee, 0xe8, 0x52, 0xb1, 0x1b, 0x89, 0xd3, 0xed, 0xac, 0x9c, 0x62, + 0xa2, 0x9d, 0x05, 0xb2, 0xb5, 0xea, 0x99, 0x58, 0xe1, 0x03, 0x80, 0x63, 0x8f, 0x37, 0x96, 0x9e, + 0xac, 0x91, 0x30, 0x26, 0xa1, 0x2f, 0xff, 0x15, 0x0f, 0x20, 0xe4, 0xf3, 0x59, 0x16, 0x17, 0x8b, + 0xf0, 0x6b, 0x64, 0xfe, 0x5a, 0x37, 0x0a, 0x47, 0x77, 0x80, 0xf5, 0x3f, 0xc7, 0xde, 0x6d, 0xe7, + 0x81, 0x9d, 0x76, 0x8e, 0x2e, 0x86, 0x8b, 0xf7, 0x35, 0x39, 0xff, 0x3f, 0x07, 0x60, 0x6e, 0x19, + 0x45, 0xde, 0x2a, 0x79, 0x51, 0x27, 0x1e, 0x89, 0x5b, 0xeb, 0x11, 0x6d, 0x10, 0x0f, 0x47, 0x92, + 0xcc, 0xc3, 0x0e, 0xc2, 0xae, 0x9f, 0x27, 0xec, 0xf8, 0xaa, 0xe8, 0xac, 0x6e, 0x0b, 0x4e, 0xb2, + 0x7a, 0xad, 0x16, 0xb4, 0xca, 0x1d, 0x45, 0xf6, 0xe6, 0xdc, 0xc6, 0x25, 0xc4, 0x89, 0x20, 0x47, + 0x76, 0x68, 0x14, 0xd1, 0xe6, 0x69, 0xe4, 0xc1, 0x5e, 0x22, 0x4b, 0x08, 0xbb, 0x9b, 0xdd, 0x5f, + 0x01, 0xcc, 0x2e, 0xe1, 0x00, 0xfb, 0x28, 0xa6, 0x17, 0x65, 0x71, 0xa5, 0xcb, 0x00, 0xf5, 0x46, + 0x61, 0xf7, 0x51, 0xfa, 0x04, 0x60, 0x7a, 0xa3, 0x89, 0x6a, 0x7d, 0x26, 0xeb, 0x33, 0x80, 0x99, + 0x0d, 0xd4, 0x20, 0xa1, 0xcf, 0xfa, 0xf0, 0xc0, 0xee, 0xa1, 0x28, 0xec, 0x2f, 0x59, 0xd6, 0xca, + 0xce, 0x0f, 0x3d, 0xb5, 0xb3, 0xaf, 0x83, 0xdd, 0x7d, 0x1d, 0xec, 0xed, 0xeb, 0xe0, 0xd5, 0x81, + 0x9e, 0xda, 0x3d, 0xd0, 0x53, 0x5f, 0x0e, 0xf4, 0xd4, 0xd3, 0x9b, 0x89, 0xd7, 0x02, 0xe7, 0x51, + 0x0a, 0x90, 0xc3, 0xc4, 0x97, 0xb9, 0x95, 0x78, 0x2a, 0x8a, 0x67, 0x83, 0x33, 0x2c, 0x5e, 0x6e, + 0xb7, 0x7f, 0x07, 0x00, 0x00, 0xff, 0xff, 0xdf, 0xff, 0x44, 0xe6, 0x49, 0x0a, 0x00, 0x00, } func (m *BaseClaim) Marshal() (dAtA []byte, err error) { diff --git a/x/incentive/types/claims_test.go b/x/incentive/types/claims_test.go index 143b6f9d35..9e4396e72a 100644 --- a/x/incentive/types/claims_test.go +++ b/x/incentive/types/claims_test.go @@ -1,6 +1,7 @@ package types import ( + sdkmath "cosmossdk.io/math" "fmt" "testing" @@ -10,8 +11,8 @@ import ( "github.com/stretchr/testify/require" ) -// d is a helper function for creating sdk.Dec values in tests -func d(str string) sdk.Dec { return sdk.MustNewDecFromStr(str) } +// d is a helper function for creating sdkmath.LegacyDec values in tests +func d(str string) sdkmath.LegacyDec { return sdkmath.LegacyMustNewDecFromStr(str) } // c is a helper function for created sdk.Coin types in tests func c(denom string, amount int64) sdk.Coin { return sdk.NewInt64Coin(denom, amount) } @@ -31,7 +32,7 @@ func TestClaims_Validate(t *testing.T) { { "valid", USDXMintingClaims{ - NewUSDXMintingClaim(owner, sdk.NewCoin("bnb", sdk.OneInt()), RewardIndexes{NewRewardIndex("bnb-a", sdk.ZeroDec())}), + NewUSDXMintingClaim(owner, sdk.NewCoin("bnb", sdkmath.OneInt()), RewardIndexes{NewRewardIndex("bnb-a", sdkmath.LegacyZeroDec())}), }, true, }, @@ -52,7 +53,7 @@ func TestClaims_Validate(t *testing.T) { { BaseClaim: BaseClaim{ Owner: owner, - Reward: sdk.Coin{Denom: "", Amount: sdk.ZeroInt()}, + Reward: sdk.Coin{Denom: "", Amount: sdkmath.ZeroInt()}, }, }, }, @@ -64,9 +65,9 @@ func TestClaims_Validate(t *testing.T) { { BaseClaim: BaseClaim{ Owner: owner, - Reward: sdk.NewCoin("bnb", sdk.OneInt()), + Reward: sdk.NewCoin("bnb", sdkmath.OneInt()), }, - RewardIndexes: []RewardIndex{{"", sdk.ZeroDec()}}, + RewardIndexes: []RewardIndex{{"", sdkmath.LegacyZeroDec()}}, }, }, false, @@ -193,11 +194,11 @@ func TestClaims_Validate(t *testing.T) { func TestRewardIndexes(t *testing.T) { t.Run("With", func(t *testing.T) { - arbitraryDec := sdk.MustNewDecFromStr("0.1") + arbitraryDec := sdkmath.LegacyMustNewDecFromStr("0.1") type args struct { denom string - factor sdk.Dec + factor sdkmath.LegacyDec } testcases := []struct { name string @@ -244,10 +245,10 @@ func TestRewardIndexes(t *testing.T) { } }) t.Run("Get", func(t *testing.T) { - arbitraryDec := sdk.MustNewDecFromStr("0.1") + arbitraryDec := sdkmath.LegacyMustNewDecFromStr("0.1") type expected struct { - factor sdk.Dec + factor sdkmath.LegacyDec found bool } testcases := []struct { @@ -292,7 +293,7 @@ func TestRewardIndexes(t *testing.T) { testcases := []struct { name string rewardIndexes RewardIndexes - multiplier sdk.Dec + multiplier sdkmath.LegacyDec expected RewardIndexes }{ { @@ -362,7 +363,7 @@ func TestRewardIndexes(t *testing.T) { testcases := []struct { name string rewardIndexes RewardIndexes - divisor sdk.Dec + divisor sdkmath.LegacyDec expected expected }{ { @@ -550,7 +551,7 @@ func TestMultiRewardIndexes(t *testing.T) { arbitraryRewardIndexes := RewardIndexes{ { CollateralType: "reward", - RewardFactor: sdk.MustNewDecFromStr("0.1"), + RewardFactor: sdkmath.LegacyMustNewDecFromStr("0.1"), }, } @@ -770,12 +771,12 @@ func TestMultiRewardIndexes(t *testing.T) { } var normalRewardIndexes = RewardIndexes{ - NewRewardIndex("hard", sdk.MustNewDecFromStr("0.000001")), - NewRewardIndex("ukava", sdk.MustNewDecFromStr("0.1")), + NewRewardIndex("hard", sdkmath.LegacyMustNewDecFromStr("0.000001")), + NewRewardIndex("ukava", sdkmath.LegacyMustNewDecFromStr("0.1")), } var invalidRewardIndexes = RewardIndexes{ - RewardIndex{"hard", sdk.MustNewDecFromStr("-0.01")}, + RewardIndex{"hard", sdkmath.LegacyMustNewDecFromStr("-0.01")}, } func appendUniqueRewardIndex(indexes RewardIndexes) RewardIndexes { @@ -789,6 +790,6 @@ func appendUniqueRewardIndex(indexes RewardIndexes) RewardIndexes { return append( indexes, - NewRewardIndex(uniqueDenom, sdk.MustNewDecFromStr("0.02")), + NewRewardIndex(uniqueDenom, sdkmath.LegacyMustNewDecFromStr("0.02")), ) } diff --git a/x/incentive/types/codec.go b/x/incentive/types/codec.go index ccf560056d..625d8d99d3 100644 --- a/x/incentive/types/codec.go +++ b/x/incentive/types/codec.go @@ -6,7 +6,6 @@ import ( cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" - authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec" ) // RegisterLegacyAminoCodec registers all the necessary types and interfaces for the @@ -45,5 +44,5 @@ func init() { // Register all Amino interfaces and concrete types on the authz Amino codec so that this can later be // used to properly serialize MsgGrant and MsgExec instances - RegisterLegacyAminoCodec(authzcodec.Amino) + RegisterLegacyAminoCodec(codec.NewLegacyAmino()) } diff --git a/x/incentive/types/expected_keepers.go b/x/incentive/types/expected_keepers.go index caf27faab2..39dc487991 100644 --- a/x/incentive/types/expected_keepers.go +++ b/x/incentive/types/expected_keepers.go @@ -1,9 +1,9 @@ package types import ( + "context" sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" @@ -24,25 +24,25 @@ type ParamSubspace interface { // BankKeeper defines the expected interface needed to send coins type BankKeeper interface { - SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error - GetAllBalances(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins - GetSupply(ctx sdk.Context, denom string) sdk.Coin + SendCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error + GetAllBalances(ctx context.Context, addr sdk.AccAddress) sdk.Coins + GetSupply(ctx context.Context, denom string) sdk.Coin } // StakingKeeper defines the expected staking keeper for module accounts type StakingKeeper interface { - GetDelegatorDelegations(ctx sdk.Context, delegator sdk.AccAddress, maxRetrieve uint16) (delegations []stakingtypes.Delegation) - GetValidatorDelegations(ctx sdk.Context, valAddr sdk.ValAddress) (delegations []stakingtypes.Delegation) - GetValidator(ctx sdk.Context, addr sdk.ValAddress) (validator stakingtypes.Validator, found bool) - TotalBondedTokens(ctx sdk.Context) sdkmath.Int + GetDelegatorDelegations(ctx context.Context, delegator sdk.AccAddress, maxRetrieve uint16) (delegations []stakingtypes.Delegation, err error) + GetValidatorDelegations(ctx context.Context, valAddr sdk.ValAddress) (delegations []stakingtypes.Delegation, err error) + GetValidator(ctx context.Context, addr sdk.ValAddress) (validator stakingtypes.Validator, err error) + TotalBondedTokens(ctx context.Context) (sdkmath.Int, error) } // CdpKeeper defines the expected cdp keeper for interacting with cdps type CdpKeeper interface { - GetInterestFactor(ctx sdk.Context, collateralType string) (sdk.Dec, bool) - GetTotalPrincipal(ctx sdk.Context, collateralType string, principalDenom string) (total sdkmath.Int) - GetCdpByOwnerAndCollateralType(ctx sdk.Context, owner sdk.AccAddress, collateralType string) (cdptypes.CDP, bool) - GetCollateral(ctx sdk.Context, collateralType string) (cdptypes.CollateralParam, bool) + GetInterestFactor(ctx context.Context, collateralType string) (sdkmath.LegacyDec, bool) + GetTotalPrincipal(ctx context.Context, collateralType string, principalDenom string) (total sdkmath.Int) + GetCdpByOwnerAndCollateralType(ctx context.Context, owner sdk.AccAddress, collateralType string) (cdptypes.CDP, bool) + GetCollateral(ctx context.Context, collateralType string) (cdptypes.CollateralParam, bool) } // HardKeeper defines the expected hard keeper for interacting with Hard protocol @@ -50,8 +50,8 @@ type HardKeeper interface { GetDeposit(ctx sdk.Context, depositor sdk.AccAddress) (hardtypes.Deposit, bool) GetBorrow(ctx sdk.Context, borrower sdk.AccAddress) (hardtypes.Borrow, bool) - GetSupplyInterestFactor(ctx sdk.Context, denom string) (sdk.Dec, bool) - GetBorrowInterestFactor(ctx sdk.Context, denom string) (sdk.Dec, bool) + GetSupplyInterestFactor(ctx sdk.Context, denom string) (sdkmath.LegacyDec, bool) + GetBorrowInterestFactor(ctx sdk.Context, denom string) (sdkmath.LegacyDec, bool) GetBorrowedCoins(ctx sdk.Context) (coins sdk.Coins, found bool) GetSuppliedCoins(ctx sdk.Context) (coins sdk.Coins, found bool) } @@ -90,19 +90,19 @@ type LiquidKeeper interface { // AccountKeeper expected interface for the account keeper (noalias) type AccountKeeper interface { - GetAccount(ctx sdk.Context, addr sdk.AccAddress) authtypes.AccountI - SetAccount(ctx sdk.Context, acc authtypes.AccountI) - GetModuleAccount(ctx sdk.Context, name string) authtypes.ModuleAccountI + GetAccount(ctx context.Context, addr sdk.AccAddress) sdk.AccountI + SetAccount(ctx context.Context, acc sdk.AccountI) + GetModuleAccount(ctx context.Context, name string) sdk.ModuleAccountI } // MintKeeper defines the required methods needed by this modules keeper type MintKeeper interface { - GetMinter(ctx sdk.Context) (minter minttypes.Minter) + GetMinter(ctx context.Context) (minter minttypes.Minter) } // DistrKeeper defines the required methods needed by this modules keeper type DistrKeeper interface { - GetCommunityTax(ctx sdk.Context) (percent sdk.Dec) + GetCommunityTax(ctx context.Context) (percent sdkmath.LegacyDec, err error) } // PricefeedKeeper defines the required methods needed by this modules keeper diff --git a/x/incentive/types/genesis_test.go b/x/incentive/types/genesis_test.go index 4cf95d2a06..f22e0f9c61 100644 --- a/x/incentive/types/genesis_test.go +++ b/x/incentive/types/genesis_test.go @@ -52,8 +52,8 @@ func TestGenesisState_Validate(t *testing.T) { { Denom: "ukava", Multipliers: Multipliers{ - NewMultiplier("small", 1, sdk.MustNewDecFromStr("0.33")), - NewMultiplier("large", 12, sdk.MustNewDecFromStr("1.00")), + NewMultiplier("small", 1, sdkmath.LegacyMustNewDecFromStr("0.33")), + NewMultiplier("large", 12, sdkmath.LegacyMustNewDecFromStr("1.00")), }, }, }, @@ -78,7 +78,7 @@ func TestGenesisState_Validate(t *testing.T) { RewardIndexes: []RewardIndex{ { CollateralType: "bnb-a", - RewardFactor: sdk.ZeroDec(), + RewardFactor: sdkmath.LegacyZeroDec(), }, }, }, @@ -123,7 +123,7 @@ func TestGenesisState_Validate(t *testing.T) { RewardIndexes: []RewardIndex{ { CollateralType: "bnb-a", - RewardFactor: sdk.ZeroDec(), + RewardFactor: sdkmath.LegacyZeroDec(), }, }, }, diff --git a/x/incentive/types/msg_test.go b/x/incentive/types/msg_test.go index 9e9a1dae96..1beb2f8005 100644 --- a/x/incentive/types/msg_test.go +++ b/x/incentive/types/msg_test.go @@ -148,7 +148,10 @@ func TestMsgClaim_Validate(t *testing.T) { msgs := []sdk.Msg{&msgClaimHardReward, &msgClaimDelegatorReward, &msgClaimSwapReward, &msgClaimSavingsReward} for _, msg := range msgs { t.Run(tc.name, func(t *testing.T) { - err := msg.ValidateBasic() + validateBasic, ok := msg.(sdk.HasValidateBasic) + require.True(t, ok, "msg does not implement sdk.HasValidateBasic") + + err := validateBasic.ValidateBasic() if tc.expect.pass { require.NoError(t, err) } else { diff --git a/x/incentive/types/multipliers.go b/x/incentive/types/multipliers.go index 689bea6460..4f82f5bdfd 100644 --- a/x/incentive/types/multipliers.go +++ b/x/incentive/types/multipliers.go @@ -1,6 +1,7 @@ package types import ( + sdkmath "cosmossdk.io/math" "fmt" "sort" @@ -9,7 +10,7 @@ import ( ) // NewMultiplier returns a new Multiplier -func NewMultiplier(name string, lockup int64, factor sdk.Dec) Multiplier { +func NewMultiplier(name string, lockup int64, factor sdkmath.LegacyDec) Multiplier { return Multiplier{ Name: name, MonthsLockup: lockup, diff --git a/x/incentive/types/params.pb.go b/x/incentive/types/params.pb.go index 9656459b48..68c8366afc 100644 --- a/x/incentive/types/params.pb.go +++ b/x/incentive/types/params.pb.go @@ -4,6 +4,7 @@ package types import ( + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types "github.com/cosmos/cosmos-sdk/types" @@ -115,9 +116,9 @@ var xxx_messageInfo_MultiRewardPeriod proto.InternalMessageInfo // Multiplier amount the claim rewards get increased by, along with how long the claim rewards are locked type Multiplier struct { - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - MonthsLockup int64 `protobuf:"varint,2,opt,name=months_lockup,json=monthsLockup,proto3" json:"months_lockup,omitempty"` - Factor github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=factor,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"factor"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + MonthsLockup int64 `protobuf:"varint,2,opt,name=months_lockup,json=monthsLockup,proto3" json:"months_lockup,omitempty"` + Factor cosmossdk_io_math.LegacyDec `protobuf:"bytes,3,opt,name=factor,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"factor"` } func (m *Multiplier) Reset() { *m = Multiplier{} } @@ -251,56 +252,57 @@ func init() { } var fileDescriptor_bb8833f5d745eac9 = []byte{ - // 774 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x96, 0xcf, 0x6e, 0xd3, 0x4a, - 0x14, 0xc6, 0xe3, 0xfc, 0xbb, 0xc9, 0xb4, 0xbd, 0xb7, 0x9d, 0x46, 0xb9, 0xbe, 0xb9, 0xc8, 0xa9, - 0x52, 0x04, 0x41, 0x55, 0x6d, 0x0a, 0x12, 0x0b, 0x76, 0x98, 0x82, 0x84, 0x44, 0xa5, 0xca, 0x2d, - 0x12, 0xb0, 0x89, 0x26, 0xf6, 0xd4, 0xb5, 0x6a, 0x7b, 0xac, 0x99, 0x49, 0xda, 0x88, 0x05, 0x12, - 0x0b, 0x76, 0x48, 0x15, 0x0b, 0x1e, 0xa2, 0xaf, 0xc1, 0xa6, 0xcb, 0x8a, 0x15, 0x62, 0xd1, 0x42, - 0xfa, 0x22, 0x68, 0xc6, 0x6e, 0xe3, 0xa4, 0x69, 0xa1, 0x52, 0x36, 0xac, 0x32, 0x3e, 0x73, 0xce, - 0xf9, 0x7d, 0xfe, 0xc6, 0x67, 0x14, 0xb0, 0xb8, 0x83, 0xba, 0xc8, 0xf0, 0x42, 0x1b, 0x87, 0xdc, - 0xeb, 0x62, 0xa3, 0xbb, 0xd2, 0xc6, 0x1c, 0xad, 0x18, 0x11, 0xa2, 0x28, 0x60, 0x7a, 0x44, 0x09, - 0x27, 0xb0, 0x2a, 0x92, 0xf4, 0xf3, 0x24, 0x3d, 0x49, 0xaa, 0x69, 0x36, 0x61, 0x01, 0x61, 0x46, - 0x1b, 0xb1, 0x41, 0xa5, 0x4d, 0xbc, 0x30, 0xae, 0xab, 0x55, 0x5c, 0xe2, 0x12, 0xb9, 0x34, 0xc4, - 0x2a, 0x89, 0xd6, 0x5d, 0x42, 0x5c, 0x1f, 0x1b, 0xf2, 0xa9, 0xdd, 0xd9, 0x32, 0xb8, 0x17, 0x60, - 0xc6, 0x51, 0x10, 0xc5, 0x09, 0x8d, 0x8f, 0x59, 0x30, 0x6d, 0xe1, 0x5d, 0x44, 0x9d, 0x75, 0x4c, - 0x3d, 0xe2, 0xc0, 0x2a, 0x28, 0x22, 0x5b, 0x90, 0x55, 0x65, 0x41, 0x69, 0x96, 0xac, 0xe4, 0x09, - 0xde, 0x06, 0xff, 0xd8, 0xc4, 0xf7, 0x11, 0xc7, 0x14, 0xf9, 0x2d, 0xde, 0x8b, 0xb0, 0x9a, 0x5d, - 0x50, 0x9a, 0x65, 0xeb, 0xef, 0x41, 0x78, 0xb3, 0x17, 0x61, 0xf8, 0x10, 0x14, 0x18, 0x47, 0x94, - 0xab, 0xb9, 0x05, 0xa5, 0x39, 0x75, 0xaf, 0xa6, 0xc7, 0x12, 0xf4, 0x33, 0x09, 0xfa, 0xe6, 0x99, - 0x04, 0xb3, 0x74, 0x78, 0x5c, 0xcf, 0xec, 0x9f, 0xd4, 0x15, 0x2b, 0x2e, 0x81, 0x0f, 0x40, 0x0e, - 0x87, 0x8e, 0x9a, 0xbf, 0x46, 0xa5, 0x28, 0x80, 0x6b, 0x00, 0x52, 0xf9, 0x12, 0xac, 0x15, 0x61, - 0xda, 0x62, 0xd8, 0x26, 0xa1, 0xa3, 0x16, 0x64, 0x9b, 0xff, 0xf4, 0xd8, 0x39, 0x5d, 0x38, 0x77, - 0x66, 0xa7, 0xfe, 0x98, 0x78, 0xa1, 0x99, 0x17, 0x5d, 0xac, 0xd9, 0xa4, 0x74, 0x1d, 0xd3, 0x0d, - 0x59, 0xd8, 0xf8, 0x9c, 0x05, 0x73, 0x6b, 0x1d, 0x9f, 0x7b, 0x7f, 0xbe, 0x33, 0xbd, 0x4b, 0x9c, - 0xc9, 0x5d, 0xed, 0xcc, 0x5d, 0xd1, 0xe5, 0xe0, 0xa4, 0xde, 0x74, 0x3d, 0xbe, 0xdd, 0x69, 0xeb, - 0x36, 0x09, 0x8c, 0xe4, 0x03, 0x8c, 0x7f, 0x96, 0x99, 0xb3, 0x63, 0x88, 0x77, 0x65, 0xb2, 0x80, - 0x8d, 0x71, 0xf1, 0x83, 0x02, 0x80, 0x74, 0x31, 0xf2, 0x3d, 0x4c, 0x21, 0x04, 0xf9, 0x10, 0x05, - 0xb1, 0x79, 0x65, 0x4b, 0xae, 0xe1, 0x22, 0x98, 0x09, 0x48, 0xc8, 0xb7, 0x59, 0xcb, 0x27, 0xf6, - 0x4e, 0x27, 0x92, 0xc6, 0xe5, 0xac, 0xe9, 0x38, 0xf8, 0x5c, 0xc6, 0xe0, 0x53, 0x50, 0xdc, 0x42, - 0x36, 0x27, 0x54, 0xfa, 0x36, 0x6d, 0xea, 0x42, 0xdb, 0xb7, 0xe3, 0xfa, 0xad, 0xdf, 0xd0, 0xb6, - 0x8a, 0x6d, 0x2b, 0xa9, 0x6e, 0xbc, 0x57, 0xc0, 0xfc, 0x40, 0x8f, 0x10, 0xba, 0x8a, 0x43, 0x12, - 0xc0, 0x0a, 0x28, 0x38, 0x62, 0x91, 0x28, 0x8b, 0x1f, 0xe0, 0x2b, 0x30, 0x15, 0x0c, 0x92, 0xd5, - 0xac, 0x74, 0xac, 0xa1, 0x8f, 0x9f, 0x4e, 0x7d, 0xd0, 0xd7, 0x9c, 0x4f, 0xac, 0x9b, 0x4a, 0xb1, - 0xac, 0x74, 0xaf, 0xc6, 0x97, 0x12, 0x28, 0xae, 0xcb, 0x99, 0x87, 0x9f, 0x14, 0xf0, 0x7f, 0x87, - 0x39, 0x7b, 0xad, 0xc0, 0x0b, 0xb9, 0x17, 0xba, 0xad, 0xd8, 0x45, 0x71, 0x56, 0x1e, 0x71, 0x98, - 0xaa, 0x48, 0xec, 0xcd, 0xcb, 0xb0, 0xe9, 0xef, 0xd3, 0x5c, 0x11, 0xe0, 0xfe, 0x71, 0x5d, 0x7d, - 0xb1, 0xb1, 0xfa, 0x72, 0x2d, 0xee, 0x97, 0x4e, 0x60, 0x07, 0x27, 0xf5, 0x99, 0xa1, 0x80, 0xa5, - 0x0a, 0xf6, 0xb8, 0x54, 0xf8, 0x4e, 0x01, 0xb5, 0x6d, 0xa1, 0x84, 0x75, 0xa2, 0xc8, 0xef, 0x8d, - 0xea, 0x8a, 0xed, 0xb8, 0x73, 0xa5, 0x1d, 0x43, 0xe2, 0x6a, 0x89, 0x2b, 0xf0, 0xc2, 0x16, 0xb3, - 0xfe, 0x15, 0xa0, 0x0d, 0xc9, 0xb9, 0x44, 0x44, 0x9b, 0x50, 0x4a, 0x76, 0x47, 0x45, 0xe4, 0x26, - 0x2e, 0xc2, 0x94, 0x9c, 0x61, 0x11, 0x6f, 0x81, 0xea, 0x60, 0x1f, 0xbb, 0x88, 0x13, 0x3a, 0xaa, - 0x20, 0x3f, 0x49, 0x05, 0xd5, 0x73, 0xcc, 0xb0, 0x80, 0x0e, 0x98, 0x67, 0xbb, 0x28, 0x1a, 0x65, - 0x17, 0x26, 0xc9, 0x9e, 0x13, 0x84, 0x61, 0x6c, 0x17, 0xcc, 0xd9, 0x3e, 0xf2, 0x82, 0x56, 0x7a, - 0x0c, 0x8a, 0x12, 0xba, 0xf4, 0xeb, 0x31, 0x38, 0x1f, 0x2f, 0xf3, 0x46, 0x82, 0xad, 0x8c, 0xd9, - 0x64, 0xd6, 0xac, 0x64, 0xa4, 0xb6, 0xe0, 0x23, 0x50, 0x8e, 0xb9, 0xe2, 0xbe, 0xfb, 0xeb, 0x1a, - 0xf7, 0x5d, 0x49, 0x96, 0x3d, 0x09, 0x1d, 0xf8, 0x06, 0x54, 0x19, 0xea, 0x7a, 0xa1, 0xcb, 0x46, - 0x4d, 0x2b, 0x4d, 0xd2, 0xb4, 0x4a, 0x02, 0xb9, 0x70, 0x5c, 0x18, 0xd1, 0x70, 0x94, 0x5c, 0x9e, - 0xe8, 0x71, 0x09, 0xc2, 0x50, 0xc8, 0x7c, 0x76, 0xf8, 0x43, 0xcb, 0x1c, 0xf6, 0x35, 0xe5, 0xa8, - 0xaf, 0x29, 0xdf, 0xfb, 0x9a, 0xb2, 0x7f, 0xaa, 0x65, 0x8e, 0x4e, 0xb5, 0xcc, 0xd7, 0x53, 0x2d, - 0xf3, 0x7a, 0x29, 0x75, 0x57, 0x0a, 0x05, 0xcb, 0x3e, 0x6a, 0x33, 0xb9, 0x32, 0xf6, 0x52, 0xff, - 0x48, 0xe4, 0xa5, 0xd9, 0x2e, 0x4a, 0x9b, 0xef, 0xff, 0x0c, 0x00, 0x00, 0xff, 0xff, 0xca, 0x77, - 0xf8, 0x09, 0xb0, 0x08, 0x00, 0x00, + // 787 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x96, 0xcf, 0x4f, 0xdb, 0x48, + 0x14, 0xc7, 0xe3, 0xfc, 0xda, 0x64, 0x80, 0x5d, 0x18, 0xa2, 0xac, 0x37, 0xac, 0x1c, 0x14, 0x56, + 0xda, 0xac, 0x10, 0xf6, 0xb2, 0x2b, 0xed, 0x61, 0x7b, 0xaa, 0x4b, 0x0f, 0x95, 0x40, 0x42, 0x86, + 0x4a, 0x6d, 0x2f, 0xd1, 0xc4, 0x1e, 0x1c, 0x2b, 0xb6, 0xc7, 0x9a, 0x99, 0x04, 0xa2, 0x1e, 0x2a, + 0x71, 0xe8, 0x19, 0xf5, 0xd0, 0x3f, 0x82, 0x7f, 0xa3, 0x17, 0x8e, 0xa8, 0xa7, 0xaa, 0x07, 0x68, + 0xc3, 0x3f, 0x52, 0xcd, 0xd8, 0x10, 0x27, 0x04, 0x2a, 0xa4, 0x5c, 0x7a, 0xca, 0xf8, 0xcd, 0x7b, + 0xef, 0xf3, 0xf5, 0x77, 0xfc, 0x46, 0x01, 0x6b, 0x5d, 0xd4, 0x47, 0x86, 0x17, 0xda, 0x38, 0xe4, + 0x5e, 0x1f, 0x1b, 0xfd, 0xcd, 0x36, 0xe6, 0x68, 0xd3, 0x88, 0x10, 0x45, 0x01, 0xd3, 0x23, 0x4a, + 0x38, 0x81, 0x55, 0x91, 0xa4, 0xdf, 0x24, 0xe9, 0x49, 0x52, 0x4d, 0xb3, 0x09, 0x0b, 0x08, 0x33, + 0xda, 0x88, 0x8d, 0x2a, 0x6d, 0xe2, 0x85, 0x71, 0x5d, 0xad, 0xe2, 0x12, 0x97, 0xc8, 0xa5, 0x21, + 0x56, 0x49, 0xb4, 0xee, 0x12, 0xe2, 0xfa, 0xd8, 0x90, 0x4f, 0xed, 0xde, 0x81, 0xc1, 0xbd, 0x00, + 0x33, 0x8e, 0x82, 0x28, 0x4e, 0x68, 0xbc, 0xcb, 0x82, 0x79, 0x0b, 0x1f, 0x22, 0xea, 0xec, 0x62, + 0xea, 0x11, 0x07, 0x56, 0x41, 0x11, 0xd9, 0x82, 0xac, 0x2a, 0xab, 0x4a, 0xb3, 0x64, 0x25, 0x4f, + 0xf0, 0x4f, 0xf0, 0x8b, 0x4d, 0x7c, 0x1f, 0x71, 0x4c, 0x91, 0xdf, 0xe2, 0x83, 0x08, 0xab, 0xd9, + 0x55, 0xa5, 0x59, 0xb6, 0x7e, 0x1e, 0x85, 0xf7, 0x07, 0x11, 0x86, 0xff, 0x83, 0x02, 0xe3, 0x88, + 0x72, 0x35, 0xb7, 0xaa, 0x34, 0xe7, 0xfe, 0xa9, 0xe9, 0xb1, 0x04, 0xfd, 0x5a, 0x82, 0xbe, 0x7f, + 0x2d, 0xc1, 0x2c, 0x9d, 0x5d, 0xd4, 0x33, 0x27, 0x97, 0x75, 0xc5, 0x8a, 0x4b, 0xe0, 0x7f, 0x20, + 0x87, 0x43, 0x47, 0xcd, 0x3f, 0xa0, 0x52, 0x14, 0xc0, 0x1d, 0x00, 0xa9, 0x7c, 0x09, 0xd6, 0x8a, + 0x30, 0x6d, 0x31, 0x6c, 0x93, 0xd0, 0x51, 0x0b, 0xb2, 0xcd, 0x6f, 0x7a, 0xec, 0x9c, 0x2e, 0x9c, + 0xbb, 0xb6, 0x53, 0x7f, 0x42, 0xbc, 0xd0, 0xcc, 0x8b, 0x2e, 0xd6, 0x62, 0x52, 0xba, 0x8b, 0xe9, + 0x9e, 0x2c, 0x6c, 0x7c, 0xc8, 0x82, 0xa5, 0x9d, 0x9e, 0xcf, 0xbd, 0x1f, 0xdf, 0x99, 0xc1, 0x1d, + 0xce, 0xe4, 0xee, 0x77, 0xe6, 0x6f, 0xd1, 0xe5, 0xf4, 0xb2, 0xde, 0x74, 0x3d, 0xde, 0xe9, 0xb5, + 0x75, 0x9b, 0x04, 0x46, 0xf2, 0x01, 0xc6, 0x3f, 0x1b, 0xcc, 0xe9, 0x1a, 0xe2, 0x5d, 0x99, 0x2c, + 0x60, 0x53, 0x5c, 0x3c, 0x56, 0x00, 0x90, 0x2e, 0x46, 0xbe, 0x87, 0x29, 0x84, 0x20, 0x1f, 0xa2, + 0x20, 0x36, 0xaf, 0x6c, 0xc9, 0x35, 0x5c, 0x03, 0x0b, 0x01, 0x09, 0x79, 0x87, 0xb5, 0x7c, 0x62, + 0x77, 0x7b, 0x91, 0x34, 0x2e, 0x67, 0xcd, 0xc7, 0xc1, 0x6d, 0x19, 0x83, 0x8f, 0x40, 0xf1, 0x00, + 0xd9, 0x9c, 0x50, 0xe9, 0xdb, 0xbc, 0xb9, 0x26, 0xb4, 0x7d, 0xbe, 0xa8, 0xaf, 0xc4, 0x4a, 0x98, + 0xd3, 0xd5, 0x3d, 0x62, 0x04, 0x88, 0x77, 0xf4, 0x6d, 0xec, 0x22, 0x7b, 0xb0, 0x85, 0x6d, 0x2b, + 0x29, 0x69, 0xbc, 0x55, 0xc0, 0xf2, 0x48, 0x84, 0x50, 0xb7, 0x85, 0x43, 0x12, 0xc0, 0x0a, 0x28, + 0x38, 0x62, 0x91, 0xc8, 0x89, 0x1f, 0xe0, 0x4b, 0x30, 0x17, 0x8c, 0x92, 0xd5, 0xac, 0xb4, 0xa9, + 0xa1, 0x4f, 0x1f, 0x49, 0x7d, 0xd4, 0xd7, 0x5c, 0x4e, 0xfc, 0x9a, 0x4b, 0xb1, 0xac, 0x74, 0xaf, + 0xc6, 0xc7, 0x12, 0x28, 0xee, 0xca, 0x41, 0x87, 0xef, 0x15, 0xb0, 0xd2, 0x63, 0xce, 0x51, 0x2b, + 0xf0, 0x42, 0xee, 0x85, 0x6e, 0x2b, 0xb6, 0x4e, 0x1c, 0x90, 0x47, 0x1c, 0xa6, 0x2a, 0x12, 0xfb, + 0xc7, 0x5d, 0xd8, 0xf4, 0x47, 0x69, 0x6e, 0x0a, 0xf0, 0xf0, 0xa2, 0xae, 0x3e, 0xdf, 0xdb, 0x7a, + 0xb1, 0x13, 0xf7, 0x4b, 0x27, 0xb0, 0xd3, 0xcb, 0xfa, 0xc2, 0x58, 0xc0, 0x52, 0x05, 0x7b, 0x5a, + 0x2a, 0x3c, 0x56, 0x40, 0xad, 0x23, 0x94, 0xb0, 0x5e, 0x14, 0xf9, 0x83, 0x49, 0x5d, 0xb1, 0x1d, + 0x7f, 0xdd, 0x6b, 0xc7, 0x98, 0xb8, 0x5a, 0xe2, 0x0a, 0xbc, 0xb5, 0xc5, 0xac, 0x5f, 0x05, 0x68, + 0x4f, 0x72, 0xee, 0x10, 0xd1, 0x26, 0x94, 0x92, 0xc3, 0x49, 0x11, 0xb9, 0x99, 0x8b, 0x30, 0x25, + 0x67, 0x5c, 0xc4, 0x1b, 0xa0, 0x3a, 0xd8, 0xc7, 0x2e, 0xe2, 0x84, 0x4e, 0x2a, 0xc8, 0xcf, 0x52, + 0x41, 0xf5, 0x06, 0x33, 0x2e, 0xa0, 0x07, 0x96, 0xd9, 0x21, 0x8a, 0x26, 0xd9, 0x85, 0x59, 0xb2, + 0x97, 0x04, 0x61, 0x1c, 0xdb, 0x07, 0x4b, 0xb6, 0x8f, 0xbc, 0xa0, 0x95, 0x1e, 0x83, 0xa2, 0x84, + 0xae, 0x7f, 0x7f, 0x0c, 0x6e, 0xc6, 0xcb, 0xfc, 0x3d, 0xc1, 0x56, 0xa6, 0x6c, 0x32, 0x6b, 0x51, + 0x32, 0x52, 0x5b, 0xf0, 0x31, 0x28, 0xc7, 0x5c, 0x71, 0xc9, 0xfd, 0xf4, 0x80, 0x4b, 0xae, 0x24, + 0xcb, 0x9e, 0x86, 0x0e, 0x7c, 0x0d, 0xaa, 0x0c, 0xf5, 0xbd, 0xd0, 0x65, 0x93, 0xa6, 0x95, 0x66, + 0x69, 0x5a, 0x25, 0x81, 0xdc, 0x3a, 0x2e, 0x8c, 0x68, 0x38, 0x49, 0x2e, 0xcf, 0xf4, 0xb8, 0x04, + 0x61, 0x2c, 0x64, 0x3e, 0x3b, 0xfb, 0xaa, 0x65, 0xce, 0x86, 0x9a, 0x72, 0x3e, 0xd4, 0x94, 0x2f, + 0x43, 0x4d, 0x39, 0xb9, 0xd2, 0x32, 0xe7, 0x57, 0x5a, 0xe6, 0xd3, 0x95, 0x96, 0x79, 0xb5, 0x9e, + 0xba, 0xbc, 0x85, 0x82, 0x0d, 0x1f, 0xb5, 0x99, 0x5c, 0x19, 0x47, 0xa9, 0xbf, 0x21, 0xf2, 0x16, + 0x6f, 0x17, 0xa5, 0xcd, 0xff, 0x7e, 0x0b, 0x00, 0x00, 0xff, 0xff, 0xda, 0xa7, 0xad, 0x3b, 0xa5, + 0x08, 0x00, 0x00, } func (m *RewardPeriod) Marshal() (dAtA []byte, err error) { diff --git a/x/incentive/types/params_test.go b/x/incentive/types/params_test.go index 2716d0957e..86a5908f42 100644 --- a/x/incentive/types/params_test.go +++ b/x/incentive/types/params_test.go @@ -24,7 +24,7 @@ var rewardPeriodWithInvalidRewardsPerSecond = types.NewRewardPeriod( "bnb", time.Date(2020, 10, 15, 14, 0, 0, 0, time.UTC), time.Date(2024, 10, 15, 14, 0, 0, 0, time.UTC), - sdk.Coin{Denom: "INVALID!@#😫", Amount: sdk.ZeroInt()}, + sdk.Coin{Denom: "INVALID!@#😫", Amount: sdkmath.ZeroInt()}, ) var rewardPeriodWithZeroRewardsPerSecond = types.NewRewardPeriod( @@ -32,7 +32,7 @@ var rewardPeriodWithZeroRewardsPerSecond = types.NewRewardPeriod( "bnb", time.Date(2020, 10, 15, 14, 0, 0, 0, time.UTC), time.Date(2024, 10, 15, 14, 0, 0, 0, time.UTC), - sdk.Coin{Denom: "ukava", Amount: sdk.ZeroInt()}, + sdk.Coin{Denom: "ukava", Amount: sdkmath.ZeroInt()}, ) var rewardMultiPeriodWithInvalidRewardsPerSecond = types.NewMultiRewardPeriod( @@ -40,7 +40,7 @@ var rewardMultiPeriodWithInvalidRewardsPerSecond = types.NewMultiRewardPeriod( "bnb", time.Date(2020, 10, 15, 14, 0, 0, 0, time.UTC), time.Date(2024, 10, 15, 14, 0, 0, 0, time.UTC), - sdk.Coins{sdk.Coin{Denom: "INVALID!@#😫", Amount: sdk.ZeroInt()}}, + sdk.Coins{sdk.Coin{Denom: "INVALID!@#😫", Amount: sdkmath.ZeroInt()}}, ) var rewardMultiPeriodWithZeroRewardsPerSecond = types.NewMultiRewardPeriod( @@ -48,7 +48,7 @@ var rewardMultiPeriodWithZeroRewardsPerSecond = types.NewMultiRewardPeriod( "bnb", time.Date(2020, 10, 15, 14, 0, 0, 0, time.UTC), time.Date(2024, 10, 15, 14, 0, 0, 0, time.UTC), - sdk.Coins{sdk.Coin{Denom: "zero", Amount: sdk.ZeroInt()}}, + sdk.Coins{sdk.Coin{Denom: "zero", Amount: sdkmath.ZeroInt()}}, ) var validMultiRewardPeriod = types.NewMultiRewardPeriod( @@ -107,15 +107,15 @@ func (suite *ParamTestSuite) TestParamValidation() { { Denom: "hard", Multipliers: types.Multipliers{ - types.NewMultiplier("small", 1, sdk.MustNewDecFromStr("0.25")), - types.NewMultiplier("large", 12, sdk.MustNewDecFromStr("1.0")), + types.NewMultiplier("small", 1, sdkmath.LegacyMustNewDecFromStr("0.25")), + types.NewMultiplier("large", 12, sdkmath.LegacyMustNewDecFromStr("1.0")), }, }, { Denom: "ukava", Multipliers: types.Multipliers{ - types.NewMultiplier("small", 1, sdk.MustNewDecFromStr("0.2")), - types.NewMultiplier("large", 12, sdk.MustNewDecFromStr("1.0")), + types.NewMultiplier("small", 1, sdkmath.LegacyMustNewDecFromStr("0.2")), + types.NewMultiplier("large", 12, sdkmath.LegacyMustNewDecFromStr("1.0")), }, }, }, @@ -223,7 +223,7 @@ func (suite *ParamTestSuite) TestParamValidation() { { Denom: "hard", Multipliers: types.Multipliers{ - types.NewMultiplier("small", -9999, sdk.MustNewDecFromStr("0.25")), + types.NewMultiplier("small", -9999, sdkmath.LegacyMustNewDecFromStr("0.25")), }, }, }, diff --git a/x/incentive/types/query.pb.go b/x/incentive/types/query.pb.go index d639bf6917..2a44a70d6b 100644 --- a/x/incentive/types/query.pb.go +++ b/x/incentive/types/query.pb.go @@ -721,6 +721,7 @@ func _Query_Apy_Handler(srv interface{}, ctx context.Context, dec func(interface return interceptor(ctx, in, info, handler) } +var Query_serviceDesc = _Query_serviceDesc var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "kava.incentive.v1beta1.Query", HandlerType: (*QueryServer)(nil), diff --git a/x/incentive/types/tx.pb.go b/x/incentive/types/tx.pb.go index 30dd8bec29..f7b843a995 100644 --- a/x/incentive/types/tx.pb.go +++ b/x/incentive/types/tx.pb.go @@ -818,6 +818,7 @@ func _Msg_ClaimEarnReward_Handler(srv interface{}, ctx context.Context, dec func return interceptor(ctx, in, info, handler) } +var Msg_serviceDesc = _Msg_serviceDesc var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "kava.incentive.v1beta1.Msg", HandlerType: (*MsgServer)(nil), diff --git a/x/issuance/abci_test.go b/x/issuance/abci_test.go index 9805b9f4b0..f337a1e4e7 100644 --- a/x/issuance/abci_test.go +++ b/x/issuance/abci_test.go @@ -34,7 +34,7 @@ type ABCITestSuite struct { func (suite *ABCITestSuite) SetupTest() { tApp := app.NewTestApp() blockTime := tmtime.Now() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: blockTime}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: blockTime}) tApp.InitializeFromGenesisStates() _, addrs := app.GeneratePrivKeyAddressPairs(5) keeper := tApp.GetIssuanceKeeper() @@ -66,10 +66,10 @@ func (suite *ABCITestSuite) TestRateLimitingTimePassage() { types.NewAsset(suite.addrs[0].String(), "usdtoken", []string{suite.addrs[1].String()}, false, true, types.NewRateLimit(true, sdkmath.NewInt(10000000000), time.Hour*24)), }, supplies: []types.AssetSupply{ - types.NewAssetSupply(sdk.NewCoin("usdtoken", sdk.ZeroInt()), time.Hour), + types.NewAssetSupply(sdk.NewCoin("usdtoken", sdkmath.ZeroInt()), time.Hour), }, blockTimes: []time.Duration{time.Hour}, - expectedSupply: types.NewAssetSupply(sdk.NewCoin("usdtoken", sdk.ZeroInt()), time.Hour*2), + expectedSupply: types.NewAssetSupply(sdk.NewCoin("usdtoken", sdkmath.ZeroInt()), time.Hour*2), }, }, { @@ -79,10 +79,10 @@ func (suite *ABCITestSuite) TestRateLimitingTimePassage() { types.NewAsset(suite.addrs[0].String(), "usdtoken", []string{suite.addrs[1].String()}, false, true, types.NewRateLimit(true, sdkmath.NewInt(10000000000), time.Hour*24)), }, supplies: []types.AssetSupply{ - types.NewAssetSupply(sdk.NewCoin("usdtoken", sdk.ZeroInt()), time.Hour), + types.NewAssetSupply(sdk.NewCoin("usdtoken", sdkmath.ZeroInt()), time.Hour), }, blockTimes: []time.Duration{time.Hour * 12, time.Hour * 12}, - expectedSupply: types.NewAssetSupply(sdk.NewCoin("usdtoken", sdk.ZeroInt()), time.Duration(0)), + expectedSupply: types.NewAssetSupply(sdk.NewCoin("usdtoken", sdkmath.ZeroInt()), time.Duration(0)), }, }, } diff --git a/x/issuance/keeper/issuance.go b/x/issuance/keeper/issuance.go index 92c619fe69..d6d1ed9fd3 100644 --- a/x/issuance/keeper/issuance.go +++ b/x/issuance/keeper/issuance.go @@ -6,7 +6,6 @@ import ( errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/kava-labs/kava/x/issuance/types" ) @@ -29,7 +28,7 @@ func (k Keeper) IssueTokens(ctx sdk.Context, tokens sdk.Coin, owner, receiver sd } } acc := k.accountKeeper.GetAccount(ctx, receiver) - _, ok := acc.(authtypes.ModuleAccountI) + _, ok := acc.(sdk.ModuleAccountI) if ok { return errorsmod.Wrapf(types.ErrIssueToModuleAccount, "address: %s", receiver) } diff --git a/x/issuance/keeper/issuance_test.go b/x/issuance/keeper/issuance_test.go index 03e9c9e80c..5e7b3064cb 100644 --- a/x/issuance/keeper/issuance_test.go +++ b/x/issuance/keeper/issuance_test.go @@ -8,10 +8,8 @@ import ( "github.com/stretchr/testify/suite" sdkmath "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - tmprototypes "github.com/cometbft/cometbft/proto/tendermint/types" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cometbft/cometbft/crypto" tmtime "github.com/cometbft/cometbft/types/time" @@ -36,7 +34,7 @@ type KeeperTestSuite struct { func (suite *KeeperTestSuite) SetupTest() { tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmprototypes.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmprototypes.Header{Height: 1, Time: tmtime.Now()}) tApp.InitializeFromGenesisStates() _, addrs := app.GeneratePrivKeyAddressPairs(5) var strAddrs []string @@ -57,7 +55,7 @@ func (suite *KeeperTestSuite) SetupTest() { suite.modAccount = modAccount } -func (suite *KeeperTestSuite) getAccount(addr sdk.AccAddress) authtypes.AccountI { +func (suite *KeeperTestSuite) getAccount(addr sdk.AccAddress) sdk.AccountI { ak := suite.tApp.GetAccountKeeper() return ak.GetAccount(suite.ctx, addr) } @@ -67,7 +65,7 @@ func (suite *KeeperTestSuite) getBalance(addr sdk.AccAddress, denom string) sdk. return bk.GetBalance(suite.ctx, addr, denom) } -func (suite *KeeperTestSuite) getModuleAccount(name string) authtypes.ModuleAccountI { +func (suite *KeeperTestSuite) getModuleAccount(name string) sdk.ModuleAccountI { sk := suite.tApp.GetAccountKeeper() return sk.GetModuleAccount(suite.ctx, name) } @@ -75,7 +73,7 @@ func (suite *KeeperTestSuite) getModuleAccount(name string) authtypes.ModuleAcco func (suite *KeeperTestSuite) TestGetSetParams() { params := suite.keeper.GetParams(suite.ctx) suite.Require().Equal(types.Params{Assets: []types.Asset(nil)}, params) - asset := types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))) + asset := types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))) params = types.NewParams([]types.Asset{asset}) suite.keeper.SetParams(suite.ctx, params) newParams := suite.keeper.GetParams(suite.ctx) @@ -102,7 +100,7 @@ func (suite *KeeperTestSuite) TestIssueTokens() { "valid issuance", args{ assets: []types.Asset{ - types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))), + types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))), }, sender: suite.addrs[0], tokens: sdk.NewCoin("usdtoken", sdkmath.NewInt(100000)), @@ -117,7 +115,7 @@ func (suite *KeeperTestSuite) TestIssueTokens() { "non-owner issuance", args{ assets: []types.Asset{ - types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))), + types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))), }, sender: suite.addrs[2], tokens: sdk.NewCoin("usdtoken", sdkmath.NewInt(100000)), @@ -132,7 +130,7 @@ func (suite *KeeperTestSuite) TestIssueTokens() { "invalid denom", args{ assets: []types.Asset{ - types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))), + types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))), }, sender: suite.addrs[0], tokens: sdk.NewCoin("othertoken", sdkmath.NewInt(100000)), @@ -147,7 +145,7 @@ func (suite *KeeperTestSuite) TestIssueTokens() { "issue to blocked address", args{ assets: []types.Asset{ - types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))), + types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))), }, sender: suite.addrs[0], tokens: sdk.NewCoin("usdtoken", sdkmath.NewInt(100000)), @@ -162,7 +160,7 @@ func (suite *KeeperTestSuite) TestIssueTokens() { "issue to module account", args{ assets: []types.Asset{ - types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))), + types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))), }, sender: suite.addrs[0], tokens: sdk.NewCoin("usdtoken", sdkmath.NewInt(100000)), @@ -177,7 +175,7 @@ func (suite *KeeperTestSuite) TestIssueTokens() { "paused issuance", args{ assets: []types.Asset{ - types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, true, true, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))), + types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, true, true, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))), }, sender: suite.addrs[0], tokens: sdk.NewCoin("usdtoken", sdkmath.NewInt(100000)), @@ -233,7 +231,7 @@ func (suite *KeeperTestSuite) TestIssueTokensRateLimited() { types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(true, sdkmath.NewInt(10000000000), time.Hour*24)), }, supplies: []types.AssetSupply{ - types.NewAssetSupply(sdk.NewCoin("usdtoken", sdk.ZeroInt()), time.Hour), + types.NewAssetSupply(sdk.NewCoin("usdtoken", sdkmath.ZeroInt()), time.Hour), }, sender: suite.addrs[0], tokens: sdk.NewCoin("usdtoken", sdkmath.NewInt(100000)), @@ -252,7 +250,7 @@ func (suite *KeeperTestSuite) TestIssueTokensRateLimited() { types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(true, sdkmath.NewInt(10000000000), time.Hour*24)), }, supplies: []types.AssetSupply{ - types.NewAssetSupply(sdk.NewCoin("usdtoken", sdk.ZeroInt()), time.Hour), + types.NewAssetSupply(sdk.NewCoin("usdtoken", sdkmath.ZeroInt()), time.Hour), }, sender: suite.addrs[0], tokens: sdk.NewCoin("usdtoken", sdkmath.NewInt(10000000001)), @@ -308,7 +306,7 @@ func (suite *KeeperTestSuite) TestRedeemTokens() { "valid redemption", args{ assets: []types.Asset{ - types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))), + types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))), }, sender: suite.addrs[0], initialTokens: sdk.NewCoin("usdtoken", sdkmath.NewInt(100000)), @@ -323,7 +321,7 @@ func (suite *KeeperTestSuite) TestRedeemTokens() { "invalid denom redemption", args{ assets: []types.Asset{ - types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))), + types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))), }, sender: suite.addrs[0], initialTokens: sdk.NewCoin("usdtoken", sdkmath.NewInt(100000)), @@ -338,7 +336,7 @@ func (suite *KeeperTestSuite) TestRedeemTokens() { "non-owner redemption", args{ assets: []types.Asset{ - types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))), + types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))), }, sender: suite.addrs[2], initialTokens: sdk.NewCoin("usdtoken", sdkmath.NewInt(100000)), @@ -353,7 +351,7 @@ func (suite *KeeperTestSuite) TestRedeemTokens() { "paused redemption", args{ assets: []types.Asset{ - types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, true, true, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))), + types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, true, true, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))), }, sender: suite.addrs[0], initialTokens: sdk.NewCoin("usdtoken", sdkmath.NewInt(100000)), @@ -368,7 +366,7 @@ func (suite *KeeperTestSuite) TestRedeemTokens() { "redeem amount greater than balance", args{ assets: []types.Asset{ - types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))), + types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))), }, sender: suite.addrs[0], initialTokens: sdk.NewCoin("usdtoken", sdkmath.NewInt(100000)), @@ -427,7 +425,7 @@ func (suite *KeeperTestSuite) TestBlockAddress() { "valid block", args{ assets: []types.Asset{ - types.NewAsset(suite.addrs[0], "usdtoken", []string{}, false, true, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))), + types.NewAsset(suite.addrs[0], "usdtoken", []string{}, false, true, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))), }, sender: suite.addrs[0], blockedAddr: suite.addrs[1], @@ -442,7 +440,7 @@ func (suite *KeeperTestSuite) TestBlockAddress() { "unblockable token", args{ assets: []types.Asset{ - types.NewAsset(suite.addrs[0], "usdtoken", []string{}, false, false, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))), + types.NewAsset(suite.addrs[0], "usdtoken", []string{}, false, false, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))), }, sender: suite.addrs[0], blockedAddr: suite.addrs[1], @@ -457,7 +455,7 @@ func (suite *KeeperTestSuite) TestBlockAddress() { "non-owner block", args{ assets: []types.Asset{ - types.NewAsset(suite.addrs[0], "usdtoken", []string{}, false, true, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))), + types.NewAsset(suite.addrs[0], "usdtoken", []string{}, false, true, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))), }, sender: suite.addrs[2], blockedAddr: suite.addrs[1], @@ -472,7 +470,7 @@ func (suite *KeeperTestSuite) TestBlockAddress() { "invalid denom block", args{ assets: []types.Asset{ - types.NewAsset(suite.addrs[0], "usdtoken", []string{}, false, true, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))), + types.NewAsset(suite.addrs[0], "usdtoken", []string{}, false, true, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))), }, sender: suite.addrs[0], blockedAddr: suite.addrs[1], @@ -487,7 +485,7 @@ func (suite *KeeperTestSuite) TestBlockAddress() { "block non-existing account", args{ assets: []types.Asset{ - types.NewAsset(suite.addrs[0], "usdtoken", []string{}, false, true, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))), + types.NewAsset(suite.addrs[0], "usdtoken", []string{}, false, true, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))), }, sender: suite.addrs[0], blockedAddr: sdk.AccAddress(crypto.AddressHash([]byte("RandomAddr"))).String(), @@ -546,7 +544,7 @@ func (suite *KeeperTestSuite) TestUnblockAddress() { "valid unblock", args{ assets: []types.Asset{ - types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))), + types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))), }, sender: suite.addrs[0], blockedAddr: suite.addrs[1], @@ -561,7 +559,7 @@ func (suite *KeeperTestSuite) TestUnblockAddress() { "non-owner unblock", args{ assets: []types.Asset{ - types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))), + types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))), }, sender: suite.addrs[2], blockedAddr: suite.addrs[1], @@ -576,7 +574,7 @@ func (suite *KeeperTestSuite) TestUnblockAddress() { "invalid denom block", args{ assets: []types.Asset{ - types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))), + types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))), }, sender: suite.addrs[0], blockedAddr: suite.addrs[1], @@ -636,7 +634,7 @@ func (suite *KeeperTestSuite) TestChangePauseStatus() { "valid pause", args{ assets: []types.Asset{ - types.NewAsset(suite.addrs[0], "usdtoken", []string{}, false, true, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))), + types.NewAsset(suite.addrs[0], "usdtoken", []string{}, false, true, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))), }, sender: suite.addrs[0], startStatus: false, @@ -652,7 +650,7 @@ func (suite *KeeperTestSuite) TestChangePauseStatus() { "valid unpause", args{ assets: []types.Asset{ - types.NewAsset(suite.addrs[0], "usdtoken", []string{}, true, true, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))), + types.NewAsset(suite.addrs[0], "usdtoken", []string{}, true, true, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))), }, sender: suite.addrs[0], startStatus: true, @@ -668,7 +666,7 @@ func (suite *KeeperTestSuite) TestChangePauseStatus() { "non-owner pause", args{ assets: []types.Asset{ - types.NewAsset(suite.addrs[0], "usdtoken", []string{}, false, true, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))), + types.NewAsset(suite.addrs[0], "usdtoken", []string{}, false, true, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))), }, sender: suite.addrs[2], startStatus: false, @@ -684,7 +682,7 @@ func (suite *KeeperTestSuite) TestChangePauseStatus() { "invalid denom pause", args{ assets: []types.Asset{ - types.NewAsset(suite.addrs[0], "usdtoken", []string{}, false, true, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))), + types.NewAsset(suite.addrs[0], "usdtoken", []string{}, false, true, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))), }, sender: suite.addrs[0], startStatus: true, @@ -738,7 +736,7 @@ func (suite *KeeperTestSuite) TestSeizeCoinsFromBlockedAddress() { "valid seize", args{ assets: []types.Asset{ - types.NewAsset(suite.addrs[0], "usdtoken", []string{}, false, true, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))), + types.NewAsset(suite.addrs[0], "usdtoken", []string{}, false, true, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))), }, initialCoins: sdk.NewCoin("usdtoken", sdkmath.NewInt(100000000)), denom: "usdtoken", @@ -753,7 +751,7 @@ func (suite *KeeperTestSuite) TestSeizeCoinsFromBlockedAddress() { "invalid denom seize", args{ assets: []types.Asset{ - types.NewAsset(suite.addrs[0], "usdtoken", []string{}, false, true, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))), + types.NewAsset(suite.addrs[0], "usdtoken", []string{}, false, true, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))), }, initialCoins: sdk.NewCoin("usdtoken", sdkmath.NewInt(100000000)), denom: "othertoken", diff --git a/x/issuance/keeper/keeper.go b/x/issuance/keeper/keeper.go index c4680db91d..203bb29893 100644 --- a/x/issuance/keeper/keeper.go +++ b/x/issuance/keeper/keeper.go @@ -3,9 +3,9 @@ package keeper import ( "time" + "cosmossdk.io/store/prefix" + storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/store/prefix" - storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" @@ -56,7 +56,7 @@ func (k Keeper) SetAssetSupply(ctx sdk.Context, supply types.AssetSupply, denom // IterateAssetSupplies provides an iterator over all stored AssetSupplies. func (k Keeper) IterateAssetSupplies(ctx sdk.Context, cb func(supply types.AssetSupply) (stop bool)) { - iterator := sdk.KVStorePrefixIterator(ctx.KVStore(k.key), types.AssetSupplyPrefix) + iterator := storetypes.KVStorePrefixIterator(ctx.KVStore(k.key), types.AssetSupplyPrefix) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { diff --git a/x/issuance/keeper/supply.go b/x/issuance/keeper/supply.go index 0b62406311..603205e757 100644 --- a/x/issuance/keeper/supply.go +++ b/x/issuance/keeper/supply.go @@ -1,6 +1,7 @@ package keeper import ( + sdkmath "cosmossdk.io/math" "time" errorsmod "cosmossdk.io/errors" @@ -12,7 +13,7 @@ import ( // CreateNewAssetSupply creates a new AssetSupply in the store for the input denom func (k Keeper) CreateNewAssetSupply(ctx sdk.Context, denom string) types.AssetSupply { supply := types.NewAssetSupply( - sdk.NewCoin(denom, sdk.ZeroInt()), time.Duration(0)) + sdk.NewCoin(denom, sdkmath.ZeroInt()), time.Duration(0)) k.SetAssetSupply(ctx, supply, denom) return supply } @@ -58,7 +59,7 @@ func (k Keeper) UpdateTimeBasedSupplyLimits(ctx sdk.Context) { } if !asset.RateLimit.Active { // rate limiting is not active, reset supply - supply.CurrentSupply = sdk.NewCoin(asset.Denom, sdk.ZeroInt()) + supply.CurrentSupply = sdk.NewCoin(asset.Denom, sdkmath.ZeroInt()) supply.TimeElapsed = time.Duration(0) k.SetAssetSupply(ctx, supply, asset.Denom) continue @@ -71,7 +72,7 @@ func (k Keeper) UpdateTimeBasedSupplyLimits(ctx sdk.Context) { } // rate limiting is active, the rate-limiting period has expired, and is now reset supply.TimeElapsed = time.Duration(0) - supply.CurrentSupply = sdk.NewCoin(asset.Denom, sdk.ZeroInt()) + supply.CurrentSupply = sdk.NewCoin(asset.Denom, sdkmath.ZeroInt()) k.SetAssetSupply(ctx, supply, asset.Denom) } k.SetPreviousBlockTime(ctx, ctx.BlockTime()) diff --git a/x/issuance/keeper/supply_test.go b/x/issuance/keeper/supply_test.go index fb7a1e2878..fd0441d45d 100644 --- a/x/issuance/keeper/supply_test.go +++ b/x/issuance/keeper/supply_test.go @@ -32,7 +32,7 @@ func (suite *KeeperTestSuite) TestIncrementCurrentAssetSupply() { types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(true, sdkmath.NewInt(10000000000), time.Hour*24)), }, supplies: []types.AssetSupply{ - types.NewAssetSupply(sdk.NewCoin("usdtoken", sdk.ZeroInt()), time.Hour), + types.NewAssetSupply(sdk.NewCoin("usdtoken", sdkmath.ZeroInt()), time.Hour), }, coin: sdk.NewCoin("usdtoken", sdkmath.NewInt(100000)), }, @@ -48,7 +48,7 @@ func (suite *KeeperTestSuite) TestIncrementCurrentAssetSupply() { types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(true, sdkmath.NewInt(10000000000), time.Hour*24)), }, supplies: []types.AssetSupply{ - types.NewAssetSupply(sdk.NewCoin("usdtoken", sdk.ZeroInt()), time.Hour), + types.NewAssetSupply(sdk.NewCoin("usdtoken", sdkmath.ZeroInt()), time.Hour), }, coin: sdk.NewCoin("usdtoken", sdkmath.NewInt(10000000001)), }, diff --git a/x/issuance/module.go b/x/issuance/module.go index a5b5f4ae40..3fa627d4fc 100644 --- a/x/issuance/module.go +++ b/x/issuance/module.go @@ -130,9 +130,15 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // BeginBlock module begin-block -func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) {} +func (am AppModule) BeginBlock(ctx sdk.Context) error { + return nil +} // EndBlock module end-block -func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - return []abci.ValidatorUpdate{} +func (am AppModule) EndBlock(_ sdk.Context) ([]abci.ValidatorUpdate, error) { + return []abci.ValidatorUpdate{}, nil } + +func (AppModule) IsOnePerModuleType() {} + +func (AppModule) IsAppModule() {} diff --git a/x/issuance/types/codec.go b/x/issuance/types/codec.go index e88e97f997..018dd22e85 100644 --- a/x/issuance/types/codec.go +++ b/x/issuance/types/codec.go @@ -6,7 +6,6 @@ import ( cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" - authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec" ) var ( @@ -42,5 +41,5 @@ func init() { // Register all Amino interfaces and concrete types on the authz Amino codec so that this can later be // used to properly serialize MsgGrant and MsgExec instances - RegisterLegacyAminoCodec(authzcodec.Amino) + RegisterLegacyAminoCodec(codec.NewLegacyAmino()) } diff --git a/x/issuance/types/expected_keepers.go b/x/issuance/types/expected_keepers.go index db742385eb..8d8ce5544d 100644 --- a/x/issuance/types/expected_keepers.go +++ b/x/issuance/types/expected_keepers.go @@ -1,21 +1,21 @@ package types import ( + "context" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/auth/types" ) // BankKeeper defines the expected interface needed to send coins type BankKeeper interface { - SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error - SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error - BurnCoins(ctx sdk.Context, name string, amt sdk.Coins) error - MintCoins(ctx sdk.Context, name string, amt sdk.Coins) error - GetAllBalances(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins + SendCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error + SendCoinsFromAccountToModule(ctx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error + BurnCoins(ctx context.Context, name string, amt sdk.Coins) error + MintCoins(ctx context.Context, name string, amt sdk.Coins) error + GetAllBalances(ctx context.Context, addr sdk.AccAddress) sdk.Coins } // AccountKeeper expected interface for the account keeper (noalias) type AccountKeeper interface { - GetAccount(ctx sdk.Context, addr sdk.AccAddress) types.AccountI - GetModuleAccount(ctx sdk.Context, name string) types.ModuleAccountI + GetAccount(ctx context.Context, addr sdk.AccAddress) sdk.AccountI + GetModuleAccount(ctx context.Context, name string) sdk.ModuleAccountI } diff --git a/x/issuance/types/genesis.pb.go b/x/issuance/types/genesis.pb.go index 612b89c402..f40f5761fa 100644 --- a/x/issuance/types/genesis.pb.go +++ b/x/issuance/types/genesis.pb.go @@ -4,8 +4,8 @@ package types import ( + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" @@ -213,9 +213,9 @@ func (m *Asset) GetRateLimit() RateLimit { // RateLimit parameters for rate-limiting the supply of an issued asset type RateLimit struct { - Active bool `protobuf:"varint,1,opt,name=active,proto3" json:"active,omitempty"` - Limit github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=limit,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"limit,omitempty"` - TimePeriod time.Duration `protobuf:"bytes,3,opt,name=time_period,json=timePeriod,proto3,stdduration" json:"time_period"` + Active bool `protobuf:"varint,1,opt,name=active,proto3" json:"active,omitempty"` + Limit cosmossdk_io_math.Int `protobuf:"bytes,2,opt,name=limit,proto3,customtype=cosmossdk.io/math.Int" json:"limit,omitempty"` + TimePeriod time.Duration `protobuf:"bytes,3,opt,name=time_period,json=timePeriod,proto3,stdduration" json:"time_period"` } func (m *RateLimit) Reset() { *m = RateLimit{} } @@ -331,44 +331,44 @@ func init() { } var fileDescriptor_e567e34e5c078b96 = []byte{ - // 590 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0x4f, 0x6f, 0xd3, 0x4e, - 0x10, 0x8d, 0x9b, 0x26, 0x4a, 0x36, 0xfd, 0xfd, 0x80, 0x55, 0x41, 0x6e, 0x55, 0x9c, 0x28, 0x48, - 0x28, 0x02, 0xba, 0x56, 0xcb, 0xad, 0x9c, 0x1a, 0x52, 0x10, 0x88, 0x43, 0xe5, 0x1e, 0x90, 0xb8, - 0x44, 0x6b, 0x7b, 0x30, 0xab, 0xda, 0x5e, 0xcb, 0xbb, 0x2e, 0xe4, 0x5b, 0xc0, 0xad, 0x47, 0x24, - 0xbe, 0x09, 0xa7, 0x1e, 0x7b, 0x44, 0x1c, 0x02, 0x4a, 0x6e, 0x7c, 0x0a, 0xb4, 0x7f, 0x92, 0xf4, - 0x40, 0x11, 0x27, 0xef, 0xcc, 0xbe, 0x37, 0x33, 0x6f, 0xfc, 0x16, 0xdd, 0x3b, 0xa5, 0x67, 0xd4, - 0x67, 0x42, 0x54, 0x34, 0x8f, 0xc0, 0x3f, 0xdb, 0x0b, 0x41, 0xd2, 0x3d, 0x3f, 0x81, 0x1c, 0x04, - 0x13, 0xa4, 0x28, 0xb9, 0xe4, 0xf8, 0xb6, 0x02, 0x91, 0x05, 0x88, 0x58, 0xd0, 0xb6, 0x17, 0x71, - 0x91, 0x71, 0xe1, 0x87, 0x54, 0xac, 0x98, 0x11, 0x67, 0xb9, 0xa1, 0x6d, 0x6f, 0x26, 0x3c, 0xe1, - 0xfa, 0xe8, 0xab, 0x93, 0xcd, 0x7a, 0x09, 0xe7, 0x49, 0x0a, 0xbe, 0x8e, 0xc2, 0xea, 0xad, 0x1f, - 0x57, 0x25, 0x95, 0x8c, 0x5b, 0x56, 0xff, 0x93, 0x83, 0x36, 0x9e, 0x9b, 0xf6, 0x27, 0x92, 0x4a, - 0xc0, 0x4f, 0x50, 0xb3, 0xa0, 0x25, 0xcd, 0x84, 0xeb, 0xf4, 0x9c, 0x41, 0x67, 0xff, 0x2e, 0xf9, - 0xe3, 0x38, 0xe4, 0x58, 0x83, 0x86, 0xeb, 0x17, 0xd3, 0x6e, 0x2d, 0xb0, 0x14, 0x3c, 0x42, 0x2d, - 0x51, 0x15, 0x45, 0xca, 0x40, 0xb8, 0x6b, 0xbd, 0xfa, 0xa0, 0xb3, 0xdf, 0xbf, 0x86, 0x7e, 0x28, - 0x04, 0xc8, 0x13, 0x85, 0x9d, 0xd8, 0x1a, 0x4b, 0x66, 0xff, 0x25, 0x6a, 0x9a, 0xea, 0xf8, 0x00, - 0x35, 0xa9, 0x02, 0xaa, 0x61, 0x54, 0xb5, 0x9d, 0xbf, 0x55, 0x5b, 0xcc, 0x62, 0x18, 0x07, 0xeb, - 0xe7, 0x9f, 0xbb, 0xb5, 0xfe, 0xdc, 0x41, 0x0d, 0x7d, 0x8b, 0x37, 0x51, 0x83, 0xbf, 0xcf, 0xa1, - 0xd4, 0xba, 0xda, 0x81, 0x09, 0x54, 0x36, 0x86, 0x9c, 0x67, 0xee, 0x9a, 0xc9, 0xea, 0x00, 0x3f, - 0x44, 0xb7, 0xc2, 0x94, 0x47, 0xa7, 0x10, 0x8f, 0x69, 0x1c, 0x97, 0x20, 0x04, 0x08, 0xb7, 0xde, - 0xab, 0x0f, 0xda, 0xc1, 0x4d, 0x7b, 0x71, 0xb8, 0xc8, 0xe3, 0x3b, 0x6a, 0x63, 0x95, 0x80, 0xd8, - 0x5d, 0xef, 0x39, 0x83, 0x56, 0x60, 0x23, 0xbc, 0x83, 0xda, 0x1a, 0x4b, 0xc3, 0x14, 0xdc, 0x86, - 0xbe, 0x5a, 0x25, 0xf0, 0x11, 0x42, 0x25, 0x95, 0x30, 0x4e, 0x59, 0xc6, 0xa4, 0xdb, 0xd4, 0xbb, - 0xee, 0x5d, 0x23, 0x2f, 0xa0, 0x12, 0x5e, 0x29, 0x9c, 0x95, 0xd8, 0x2e, 0x17, 0x09, 0xab, 0xf2, - 0xab, 0x83, 0xda, 0x4b, 0x90, 0x1a, 0x88, 0x46, 0x92, 0x9d, 0x81, 0x96, 0xda, 0x0a, 0x6c, 0x84, - 0x5f, 0xa3, 0x86, 0xe9, 0xa6, 0xb4, 0x6e, 0x0c, 0x0f, 0x55, 0xad, 0xef, 0xd3, 0xee, 0xfd, 0x84, - 0xc9, 0x77, 0x55, 0x48, 0x22, 0x9e, 0xf9, 0xd6, 0x63, 0xe6, 0xb3, 0x2b, 0xe2, 0x53, 0x5f, 0x4e, - 0x0a, 0x10, 0xe4, 0x45, 0x2e, 0x7f, 0x4d, 0xbb, 0x37, 0x34, 0xfd, 0x11, 0xcf, 0x98, 0x84, 0xac, - 0x90, 0x93, 0xc0, 0xd4, 0xc3, 0x23, 0xd4, 0x91, 0x2c, 0x83, 0x71, 0x01, 0x25, 0xe3, 0xb1, 0x5b, - 0xd7, 0x62, 0xb6, 0x88, 0xb1, 0x1e, 0x59, 0x58, 0x8f, 0x8c, 0xac, 0xf5, 0x86, 0x2d, 0xd5, 0xf9, - 0xfc, 0x47, 0xd7, 0x09, 0x90, 0xe2, 0x1d, 0x6b, 0x5a, 0xff, 0x8b, 0x83, 0x3a, 0x57, 0x6c, 0x81, - 0x9f, 0xa1, 0xff, 0xa3, 0xaa, 0x2c, 0x21, 0x97, 0x63, 0x6d, 0x8d, 0x89, 0x75, 0xe4, 0x16, 0x31, - 0xe3, 0x11, 0xf5, 0x12, 0x96, 0x3b, 0x7a, 0xca, 0x59, 0x6e, 0xd7, 0xf3, 0x9f, 0xa5, 0x2d, 0xeb, - 0x6c, 0xe8, 0xe9, 0x20, 0xa5, 0x85, 0xfa, 0x4b, 0x6b, 0xff, 0x3e, 0x9e, 0x96, 0x75, 0x64, 0x78, - 0x66, 0xd5, 0xc3, 0xd1, 0xc5, 0xcc, 0x73, 0x2e, 0x67, 0x9e, 0xf3, 0x73, 0xe6, 0x39, 0x1f, 0xe7, - 0x5e, 0xed, 0x72, 0xee, 0xd5, 0xbe, 0xcd, 0xbd, 0xda, 0x9b, 0x07, 0x57, 0xf6, 0xa8, 0xfe, 0xe3, - 0x6e, 0x4a, 0x43, 0xa1, 0x4f, 0xfe, 0x87, 0xd5, 0x9b, 0xd7, 0xfb, 0x0c, 0x9b, 0xba, 0xeb, 0xe3, - 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x3f, 0xa6, 0xf1, 0xda, 0x11, 0x04, 0x00, 0x00, + // 586 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0xcd, 0x6e, 0xd3, 0x4c, + 0x14, 0x8d, 0x9b, 0x26, 0x4a, 0x26, 0xfd, 0x3e, 0x60, 0xd4, 0x22, 0xb7, 0x2a, 0x4e, 0x14, 0x36, + 0x11, 0x3f, 0x63, 0x5a, 0x76, 0x65, 0xd5, 0x90, 0x16, 0x81, 0x58, 0x54, 0xee, 0x8e, 0x4d, 0x34, + 0xb6, 0x2f, 0xee, 0xa8, 0xb6, 0xc7, 0xf2, 0x8c, 0x0b, 0x79, 0x0b, 0xd8, 0x75, 0x89, 0xc4, 0x13, + 0xf0, 0x16, 0x5d, 0x76, 0x89, 0x58, 0x04, 0x94, 0xec, 0x78, 0x0a, 0x34, 0x3f, 0x49, 0x58, 0x50, + 0xc4, 0x6e, 0xee, 0x9d, 0x73, 0xee, 0x9c, 0x73, 0x7d, 0x8c, 0xee, 0x9f, 0xd3, 0x0b, 0xea, 0x33, + 0x21, 0x2a, 0x9a, 0x47, 0xe0, 0x5f, 0xec, 0x85, 0x20, 0xe9, 0x9e, 0x9f, 0x40, 0x0e, 0x82, 0x09, + 0x52, 0x94, 0x5c, 0x72, 0xbc, 0xa5, 0x40, 0x64, 0x01, 0x22, 0x16, 0xb4, 0xe3, 0x45, 0x5c, 0x64, + 0x5c, 0xf8, 0x21, 0x15, 0x2b, 0x66, 0xc4, 0x59, 0x6e, 0x68, 0x3b, 0x9b, 0x09, 0x4f, 0xb8, 0x3e, + 0xfa, 0xea, 0x64, 0xbb, 0x5e, 0xc2, 0x79, 0x92, 0x82, 0xaf, 0xab, 0xb0, 0x7a, 0xeb, 0xc7, 0x55, + 0x49, 0x25, 0xe3, 0x96, 0xd5, 0xff, 0xe8, 0xa0, 0x8d, 0x17, 0xe6, 0xf9, 0x53, 0x49, 0x25, 0xe0, + 0x67, 0xa8, 0x59, 0xd0, 0x92, 0x66, 0xc2, 0x75, 0x7a, 0xce, 0xa0, 0xb3, 0x7f, 0x8f, 0xfc, 0x51, + 0x0e, 0x39, 0xd1, 0xa0, 0xe1, 0xfa, 0xd5, 0xb4, 0x5b, 0x0b, 0x2c, 0x05, 0x8f, 0x50, 0x4b, 0x54, + 0x45, 0x91, 0x32, 0x10, 0xee, 0x5a, 0xaf, 0x3e, 0xe8, 0xec, 0xf7, 0x6f, 0xa0, 0x1f, 0x0a, 0x01, + 0xf2, 0x54, 0x61, 0x27, 0x76, 0xc6, 0x92, 0xd9, 0x7f, 0x85, 0x9a, 0x66, 0x3a, 0x3e, 0x40, 0x4d, + 0xaa, 0x80, 0x4a, 0x8c, 0x9a, 0xb6, 0xfb, 0xb7, 0x69, 0x0b, 0x2d, 0x86, 0x71, 0xb0, 0x7e, 0xf9, + 0xa9, 0x5b, 0xeb, 0xcf, 0x1d, 0xd4, 0xd0, 0xb7, 0x78, 0x13, 0x35, 0xf8, 0xbb, 0x1c, 0x4a, 0xed, + 0xab, 0x1d, 0x98, 0x42, 0x75, 0x63, 0xc8, 0x79, 0xe6, 0xae, 0x99, 0xae, 0x2e, 0xf0, 0x43, 0x74, + 0x27, 0x4c, 0x79, 0x74, 0x0e, 0xf1, 0x98, 0xc6, 0x71, 0x09, 0x42, 0x80, 0x70, 0xeb, 0xbd, 0xfa, + 0xa0, 0x1d, 0xdc, 0xb6, 0x17, 0x87, 0x8b, 0x3e, 0xbe, 0xab, 0x36, 0x56, 0x09, 0x88, 0xdd, 0xf5, + 0x9e, 0x33, 0x68, 0x05, 0xb6, 0xc2, 0xbb, 0xa8, 0xad, 0xb1, 0x34, 0x4c, 0xc1, 0x6d, 0xe8, 0xab, + 0x55, 0x03, 0x1f, 0x21, 0x54, 0x52, 0x09, 0xe3, 0x94, 0x65, 0x4c, 0xba, 0x4d, 0xbd, 0xeb, 0xde, + 0x0d, 0xf6, 0x02, 0x2a, 0xe1, 0xb5, 0xc2, 0x59, 0x8b, 0xed, 0x72, 0xd1, 0xb0, 0x2e, 0xbf, 0x38, + 0xa8, 0xbd, 0x04, 0x29, 0x41, 0x34, 0x92, 0xec, 0x02, 0xb4, 0xd5, 0x56, 0x60, 0x2b, 0x7c, 0x8c, + 0x1a, 0xe6, 0x35, 0xe5, 0x75, 0x63, 0xf8, 0x44, 0xcd, 0xfa, 0x36, 0xed, 0x6e, 0x99, 0x60, 0x89, + 0xf8, 0x9c, 0x30, 0xee, 0x67, 0x54, 0x9e, 0x91, 0x97, 0xb9, 0xfc, 0x39, 0xed, 0xde, 0xd2, 0xe8, + 0x47, 0x3c, 0x63, 0x12, 0xb2, 0x42, 0x4e, 0x02, 0x43, 0xc7, 0x23, 0xd4, 0x91, 0x2c, 0x83, 0x71, + 0x01, 0x25, 0xe3, 0xb1, 0x5b, 0xd7, 0xda, 0xb7, 0x89, 0x49, 0x1a, 0x59, 0x24, 0x8d, 0x8c, 0x6c, + 0xd2, 0x86, 0x2d, 0xf5, 0xd0, 0xe5, 0xf7, 0xae, 0x13, 0x20, 0xc5, 0x3b, 0xd1, 0xb4, 0xfe, 0x67, + 0x07, 0x75, 0x7e, 0x4b, 0x01, 0x3e, 0x46, 0xff, 0x47, 0x55, 0x59, 0x42, 0x2e, 0xc7, 0x3a, 0x09, + 0x13, 0x1b, 0xc0, 0x6d, 0x62, 0xf4, 0x11, 0x15, 0xfc, 0xe5, 0x4a, 0x9e, 0x73, 0x96, 0xdb, 0x6d, + 0xfc, 0x67, 0x69, 0xcb, 0x39, 0x1b, 0x5a, 0x1d, 0xa4, 0xb4, 0x50, 0x1f, 0x65, 0xed, 0xdf, 0xe5, + 0x69, 0x5b, 0x47, 0x86, 0x67, 0x36, 0x3b, 0x1c, 0x5d, 0xcd, 0x3c, 0xe7, 0x7a, 0xe6, 0x39, 0x3f, + 0x66, 0x9e, 0xf3, 0x61, 0xee, 0xd5, 0xae, 0xe7, 0x5e, 0xed, 0xeb, 0xdc, 0xab, 0xbd, 0x79, 0x90, + 0x30, 0x79, 0x56, 0x85, 0x24, 0xe2, 0x99, 0xaf, 0x3e, 0xdb, 0xe3, 0x94, 0x86, 0x42, 0x9f, 0xfc, + 0xf7, 0xab, 0x5f, 0x5c, 0x4e, 0x0a, 0x10, 0x61, 0x53, 0xbf, 0xfa, 0xf4, 0x57, 0x00, 0x00, 0x00, + 0xff, 0xff, 0x03, 0xcb, 0xb7, 0xaf, 0x00, 0x04, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { diff --git a/x/issuance/types/genesis_test.go b/x/issuance/types/genesis_test.go index 5c1db54041..301a608ab9 100644 --- a/x/issuance/types/genesis_test.go +++ b/x/issuance/types/genesis_test.go @@ -58,7 +58,7 @@ func (suite *GenesisTestSuite) TestValidate() { "with asset", args{ assets: []types.Asset{ - types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))), + types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))), }, supplies: []types.AssetSupply{types.NewAssetSupply(sdk.NewCoin("usdtoken", sdkmath.NewInt(1000000)), time.Hour)}, }, @@ -84,8 +84,8 @@ func (suite *GenesisTestSuite) TestValidate() { "with multiple assets", args{ assets: []types.Asset{ - types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))), - types.NewAsset(suite.addrs[0], "pegtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))), + types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))), + types.NewAsset(suite.addrs[0], "pegtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))), }, supplies: []types.AssetSupply{}, }, @@ -98,7 +98,7 @@ func (suite *GenesisTestSuite) TestValidate() { "blocked owner", args{ assets: []types.Asset{ - types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[0]}, false, true, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))), + types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[0]}, false, true, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))), }, supplies: []types.AssetSupply{}, }, @@ -111,7 +111,7 @@ func (suite *GenesisTestSuite) TestValidate() { "empty owner", args{ assets: []types.Asset{ - types.NewAsset("", "usdtoken", []string{suite.addrs[0]}, false, true, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))), + types.NewAsset("", "usdtoken", []string{suite.addrs[0]}, false, true, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))), }, supplies: []types.AssetSupply{}, }, @@ -124,7 +124,7 @@ func (suite *GenesisTestSuite) TestValidate() { "empty blocked address", args{ assets: []types.Asset{ - types.NewAsset(suite.addrs[0], "usdtoken", []string{""}, false, true, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))), + types.NewAsset(suite.addrs[0], "usdtoken", []string{""}, false, true, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))), }, supplies: []types.AssetSupply{}, }, @@ -137,7 +137,7 @@ func (suite *GenesisTestSuite) TestValidate() { "invalid denom", args{ assets: []types.Asset{ - types.NewAsset(suite.addrs[0], "USD2T ", []string{}, false, true, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))), + types.NewAsset(suite.addrs[0], "USD2T ", []string{}, false, true, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))), }, supplies: []types.AssetSupply{}, }, @@ -150,8 +150,8 @@ func (suite *GenesisTestSuite) TestValidate() { "duplicate denom", args{ assets: []types.Asset{ - types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))), - types.NewAsset(suite.addrs[1], "usdtoken", []string{}, true, true, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))), + types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))), + types.NewAsset(suite.addrs[1], "usdtoken", []string{}, true, true, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))), }, supplies: []types.AssetSupply{}, }, @@ -164,8 +164,8 @@ func (suite *GenesisTestSuite) TestValidate() { "duplicate asset", args{ assets: []types.Asset{ - types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))), - types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))), + types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))), + types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, true, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))), }, supplies: []types.AssetSupply{}, }, @@ -178,9 +178,9 @@ func (suite *GenesisTestSuite) TestValidate() { "invalid block list", args{ assets: []types.Asset{ - types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, false, types.NewRateLimit(false, sdk.ZeroInt(), time.Duration(0))), + types.NewAsset(suite.addrs[0], "usdtoken", []string{suite.addrs[1]}, false, false, types.NewRateLimit(false, sdkmath.ZeroInt(), time.Duration(0))), }, - supplies: []types.AssetSupply{types.NewAssetSupply(sdk.NewCoin("usdtoken", sdk.ZeroInt()), time.Hour)}, + supplies: []types.AssetSupply{types.NewAssetSupply(sdk.NewCoin("usdtoken", sdkmath.ZeroInt()), time.Hour)}, }, errArgs{ expectPass: false, diff --git a/x/issuance/types/query.pb.go b/x/issuance/types/query.pb.go index 3cefbb8b3f..d468ef760f 100644 --- a/x/issuance/types/query.pb.go +++ b/x/issuance/types/query.pb.go @@ -209,6 +209,7 @@ func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interf return interceptor(ctx, in, info, handler) } +var Query_serviceDesc = _Query_serviceDesc var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "kava.issuance.v1beta1.Query", HandlerType: (*QueryServer)(nil), diff --git a/x/issuance/types/tx.pb.go b/x/issuance/types/tx.pb.go index e0416cc9e1..c88079e161 100644 --- a/x/issuance/types/tx.pb.go +++ b/x/issuance/types/tx.pb.go @@ -668,6 +668,7 @@ func _Msg_SetPauseStatus_Handler(srv interface{}, ctx context.Context, dec func( return interceptor(ctx, in, info, handler) } +var Msg_serviceDesc = _Msg_serviceDesc var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "kava.issuance.v1beta1.Msg", HandlerType: (*MsgServer)(nil), diff --git a/x/kavadist/client/cli/tx.go b/x/kavadist/client/cli/tx.go index b226d27f1b..b1e4558e91 100644 --- a/x/kavadist/client/cli/tx.go +++ b/x/kavadist/client/cli/tx.go @@ -2,10 +2,12 @@ package cli import ( "fmt" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" "strings" "github.com/spf13/cobra" + "cosmossdk.io/errors" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/tx" "github.com/cosmos/cosmos-sdk/version" @@ -79,7 +81,14 @@ Where proposal.json contains: if err != nil { return err } - if err := msg.ValidateBasic(); err != nil { + contentProposal := msg.GetContent() + if contentProposal == nil { + return errors.Wrap(govtypes.ErrInvalidProposalContent, "missing content") + } + if !govv1beta1.IsValidProposalType(contentProposal.ProposalType()) { + return errors.Wrap(govtypes.ErrInvalidProposalType, contentProposal.ProposalType()) + } + if err := contentProposal.ValidateBasic(); err != nil { return err } diff --git a/x/kavadist/genesis_test.go b/x/kavadist/genesis_test.go index 171a4feec1..20f3e70991 100644 --- a/x/kavadist/genesis_test.go +++ b/x/kavadist/genesis_test.go @@ -1,6 +1,7 @@ package kavadist_test import ( + sdkmath "cosmossdk.io/math" "testing" "time" @@ -8,8 +9,6 @@ import ( tmtime "github.com/cometbft/cometbft/types/time" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/kava-labs/kava/x/kavadist" testutil "github.com/kava-labs/kava/x/kavadist/testutil" "github.com/kava-labs/kava/x/kavadist/types" @@ -27,7 +26,7 @@ func (suite *genesisTestSuite) TestInitGenesis_ValidationPanic() { { Start: time.Date(2021, 1, 1, 1, 1, 1, 1, time.UTC), End: tmtime.Canonical(time.Unix(1, 0)), - Inflation: sdk.OneDec(), + Inflation: sdkmath.LegacyOneDec(), }, }, }, @@ -47,7 +46,7 @@ func (suite *genesisTestSuite) TestInitAndExportGenesis() { { Start: time.Date(2021, 1, 1, 1, 1, 1, 1, time.UTC), End: time.Date(2021, 2, 1, 1, 1, 1, 1, time.UTC), - Inflation: sdk.OneDec(), + Inflation: sdkmath.LegacyOneDec(), }, }, }, diff --git a/x/kavadist/keeper/grpc_query_test.go b/x/kavadist/keeper/grpc_query_test.go index 8dec832fb4..1eb07610dd 100644 --- a/x/kavadist/keeper/grpc_query_test.go +++ b/x/kavadist/keeper/grpc_query_test.go @@ -107,7 +107,7 @@ func (suite *keeperTestSuite) TestGRPCBalance() { if testCase.expPass { suite.Require().NoError(err) - suite.Require().True(expCoins.IsEqual(res.Coins)) + suite.Require().True(expCoins.Equal(res.Coins)) } else { suite.Require().Error(err) } diff --git a/x/kavadist/keeper/infrastructure.go b/x/kavadist/keeper/infrastructure.go index 0445d662cf..f3693e5019 100644 --- a/x/kavadist/keeper/infrastructure.go +++ b/x/kavadist/keeper/infrastructure.go @@ -12,8 +12,8 @@ import ( func (k Keeper) mintInfrastructurePeriods(ctx sdk.Context, periods types.Periods, previousBlockTime time.Time) (sdk.Coin, sdkmath.Int, error) { var err error - coinsMinted := sdk.NewCoin(types.GovDenom, sdk.ZeroInt()) - timeElapsed := sdk.ZeroInt() + coinsMinted := sdk.NewCoin(types.GovDenom, sdkmath.ZeroInt()) + timeElapsed := sdkmath.ZeroInt() for _, period := range periods { switch { // Case 1 - period is fully expired @@ -77,7 +77,7 @@ func (k Keeper) distributeInfrastructureCoins(ctx sdk.Context, partnerRewards ty coinsToDistribute = updatedCoins } for _, cr := range coreRewards { - coinsToSend := sdk.NewCoin(types.GovDenom, sdk.NewDecFromInt(coinsToDistribute.Amount).Mul(cr.Weight).RoundInt()) + coinsToSend := sdk.NewCoin(types.GovDenom, sdkmath.LegacyNewDecFromInt(coinsToDistribute.Amount).Mul(cr.Weight).RoundInt()) // TODO check balance, log if insufficient and return rather than error err := k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, cr.Address, sdk.NewCoins(coinsToSend)) if err != nil { diff --git a/x/kavadist/keeper/keeper.go b/x/kavadist/keeper/keeper.go index cc324c5310..57a283c1c8 100644 --- a/x/kavadist/keeper/keeper.go +++ b/x/kavadist/keeper/keeper.go @@ -4,8 +4,8 @@ import ( "time" "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/store/prefix" - storetypes "github.com/cosmos/cosmos-sdk/store/types" + "cosmossdk.io/store/prefix" + storetypes "cosmossdk.io/store/types" sdk "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" diff --git a/x/kavadist/keeper/mint.go b/x/kavadist/keeper/mint.go index e9a20ca534..4e589db419 100644 --- a/x/kavadist/keeper/mint.go +++ b/x/kavadist/keeper/mint.go @@ -81,19 +81,19 @@ func (k Keeper) mintIncentivePeriods(ctx sdk.Context, periods types.Periods, pre return nil } -func (k Keeper) mintInflationaryCoins(ctx sdk.Context, inflationRate sdk.Dec, timePeriods sdkmath.Int, denom string) (sdk.Coin, error) { +func (k Keeper) mintInflationaryCoins(ctx sdk.Context, inflationRate sdkmath.LegacyDec, timePeriods sdkmath.Int, denom string) (sdk.Coin, error) { totalSupply := k.bankKeeper.GetSupply(ctx, denom) // used to scale accumulator calculations by 10^18 scalar := sdkmath.NewInt(1000000000000000000) // convert inflation rate to integer - inflationInt := sdkmath.NewUintFromBigInt(inflationRate.Mul(sdk.NewDecFromInt(scalar)).TruncateInt().BigInt()) + inflationInt := sdkmath.NewUintFromBigInt(inflationRate.Mul(sdkmath.LegacyNewDecFromInt(scalar)).TruncateInt().BigInt()) timePeriodsUint := sdkmath.NewUintFromBigInt(timePeriods.BigInt()) scalarUint := sdkmath.NewUintFromBigInt(scalar.BigInt()) // calculate the multiplier (amount to multiply the total supply by to achieve the desired inflation) // multiply the result by 10^-18 because RelativePow returns the result scaled by 10^18 - accumulator := sdk.NewDecFromBigInt(sdkmath.RelativePow(inflationInt, timePeriodsUint, scalarUint).BigInt()).Mul(sdk.SmallestDec()) + accumulator := sdkmath.LegacyNewDecFromBigInt(sdkmath.RelativePow(inflationInt, timePeriodsUint, scalarUint).BigInt()).Mul(sdkmath.LegacySmallestDec()) // calculate the number of coins to mint - amountToMint := (sdk.NewDecFromInt(totalSupply.Amount).Mul(accumulator)).Sub(sdk.NewDecFromInt(totalSupply.Amount)).TruncateInt() + amountToMint := (sdkmath.LegacyNewDecFromInt(totalSupply.Amount).Mul(accumulator)).Sub(sdkmath.LegacyNewDecFromInt(totalSupply.Amount)).TruncateInt() if amountToMint.IsZero() { return sdk.Coin{}, nil } diff --git a/x/kavadist/keeper/mint_test.go b/x/kavadist/keeper/mint_test.go index c58923d132..25dcb449fd 100644 --- a/x/kavadist/keeper/mint_test.go +++ b/x/kavadist/keeper/mint_test.go @@ -1,6 +1,8 @@ package keeper_test import ( + "fmt" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "time" sdkmath "cosmossdk.io/math" @@ -44,9 +46,9 @@ func (suite *keeperTestSuite) TestMintOngoingPeriod() { mAccSupply := suite.BankKeeper.GetAllBalances(ctx, mAcc.GetAddress()).AmountOf(types.GovDenom) suite.Require().True(mAccSupply.Equal(finalSupply.Amount.Sub(initialSupply.Amount))) // expect that inflation is ~10% - expectedSupply := sdk.NewDecFromInt(initialSupply.Amount).Mul(sdk.MustNewDecFromStr("1.1")) - supplyError := sdk.OneDec().Sub((sdk.NewDecFromInt(finalSupply.Amount).Quo(expectedSupply))).Abs() - suite.Require().True(supplyError.LTE(sdk.MustNewDecFromStr("0.001"))) + expectedSupply := sdkmath.LegacyNewDecFromInt(initialSupply.Amount).Mul(sdkmath.LegacyMustNewDecFromStr("1.1")) + supplyError := sdkmath.LegacyOneDec().Sub((sdkmath.LegacyNewDecFromInt(finalSupply.Amount).Quo(expectedSupply))).Abs() + suite.Require().True(supplyError.LTE(sdkmath.LegacyMustNewDecFromStr("0.001"))) } func (suite *keeperTestSuite) TestMintPeriodTransition() { @@ -57,7 +59,7 @@ func (suite *keeperTestSuite) TestMintPeriodTransition() { { Start: time.Date(2021, time.March, 1, 1, 0, 0, 0, time.UTC), End: time.Date(2022, time.March, 1, 1, 0, 0, 0, time.UTC), - Inflation: sdk.MustNewDecFromStr("1.000000003022265980"), + Inflation: sdkmath.LegacyMustNewDecFromStr("1.000000003022265980"), }, } params.Periods = periods @@ -97,7 +99,7 @@ func (suite *keeperTestSuite) TestInfraMinting() { endTime time.Time infraPeriods types.Periods expectedFinalSupply sdk.Coin - marginOfError sdk.Dec + marginOfError sdkmath.LegacyDec } type errArgs struct { @@ -117,9 +119,9 @@ func (suite *keeperTestSuite) TestInfraMinting() { args{ startTime: time.Date(2022, time.October, 1, 1, 0, 0, 0, time.UTC), endTime: time.Date(2023, time.October, 1, 1, 0, 0, 0, time.UTC), - infraPeriods: types.Periods{types.NewPeriod(time.Date(2022, time.October, 1, 1, 0, 0, 0, time.UTC), time.Date(2023, time.October, 1, 1, 0, 0, 0, time.UTC), sdk.MustNewDecFromStr("1.000000001547125958"))}, + infraPeriods: types.Periods{types.NewPeriod(time.Date(2022, time.October, 1, 1, 0, 0, 0, time.UTC), time.Date(2023, time.October, 1, 1, 0, 0, 0, time.UTC), sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"))}, expectedFinalSupply: sdk.NewCoin(types.GovDenom, sdkmath.NewInt(1050000000000)), - marginOfError: sdk.MustNewDecFromStr("0.0001"), + marginOfError: sdkmath.LegacyMustNewDecFromStr("0.0001"), }, errArgs{ expectPass: true, @@ -131,9 +133,9 @@ func (suite *keeperTestSuite) TestInfraMinting() { args{ startTime: time.Date(2022, time.October, 1, 1, 0, 0, 0, time.UTC), endTime: time.Date(2022, time.October, 1, 1, 0, 10, 0, time.UTC), - infraPeriods: types.Periods{types.NewPeriod(time.Date(2022, time.October, 1, 1, 0, 0, 0, time.UTC), time.Date(2023, time.October, 1, 1, 0, 0, 0, time.UTC), sdk.MustNewDecFromStr("1.000000001547125958"))}, + infraPeriods: types.Periods{types.NewPeriod(time.Date(2022, time.October, 1, 1, 0, 0, 0, time.UTC), time.Date(2023, time.October, 1, 1, 0, 0, 0, time.UTC), sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"))}, expectedFinalSupply: sdk.NewCoin(types.GovDenom, sdkmath.NewInt(1000000015471)), - marginOfError: sdk.MustNewDecFromStr("0.0001"), + marginOfError: sdkmath.LegacyMustNewDecFromStr("0.0001"), }, errArgs{ expectPass: true, @@ -160,16 +162,16 @@ func (suite *keeperTestSuite) TestInfraMinting() { suite.Require().NoError(err) finalSupply := suite.BankKeeper.GetSupply(ctx, types.GovDenom) - marginHigh := sdk.NewDecFromInt(tc.args.expectedFinalSupply.Amount).Mul(sdk.OneDec().Add(tc.args.marginOfError)) - marginLow := sdk.NewDecFromInt(tc.args.expectedFinalSupply.Amount).Mul(sdk.OneDec().Sub(tc.args.marginOfError)) + marginHigh := sdkmath.LegacyNewDecFromInt(tc.args.expectedFinalSupply.Amount).Mul(sdkmath.LegacyOneDec().Add(tc.args.marginOfError)) + marginLow := sdkmath.LegacyNewDecFromInt(tc.args.expectedFinalSupply.Amount).Mul(sdkmath.LegacyOneDec().Sub(tc.args.marginOfError)) suite.Require().Truef( - sdk.NewDecFromInt(finalSupply.Amount).LTE(marginHigh), + sdkmath.LegacyNewDecFromInt(finalSupply.Amount).LTE(marginHigh), "final supply %s is not <= %s high margin", finalSupply.Amount.String(), marginHigh.String(), ) suite.Require().Truef( - sdk.NewDecFromInt(finalSupply.Amount).GTE(marginLow), + sdkmath.LegacyNewDecFromInt(finalSupply.Amount).GTE(marginLow), "final supply %s is not >= %s low margin", finalSupply.Amount.String(), ) @@ -186,7 +188,7 @@ func (suite *keeperTestSuite) TestInfraPayoutCore() { infraPeriods types.Periods expectedFinalSupply sdk.Coin expectedBalanceIncrease sdk.Coin - marginOfError sdk.Dec + marginOfError sdkmath.LegacyDec } type errArgs struct { @@ -206,10 +208,10 @@ func (suite *keeperTestSuite) TestInfraPayoutCore() { args{ startTime: time.Date(2022, time.October, 1, 1, 0, 0, 0, time.UTC), endTime: time.Date(2023, time.October, 1, 1, 0, 0, 0, time.UTC), - infraPeriods: types.Periods{types.NewPeriod(time.Date(2022, time.October, 1, 1, 0, 0, 0, time.UTC), time.Date(2023, time.October, 1, 1, 0, 0, 0, time.UTC), sdk.MustNewDecFromStr("1.000000001547125958"))}, + infraPeriods: types.Periods{types.NewPeriod(time.Date(2022, time.October, 1, 1, 0, 0, 0, time.UTC), time.Date(2023, time.October, 1, 1, 0, 0, 0, time.UTC), sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"))}, expectedFinalSupply: sdk.NewCoin(types.GovDenom, sdkmath.NewInt(1050000000000)), expectedBalanceIncrease: sdk.NewCoin(types.GovDenom, sdkmath.NewInt(50000000000)), - marginOfError: sdk.MustNewDecFromStr("0.0001"), + marginOfError: sdkmath.LegacyMustNewDecFromStr("0.0001"), }, errArgs{ expectPass: true, @@ -220,29 +222,48 @@ func (suite *keeperTestSuite) TestInfraPayoutCore() { for _, tc := range testCases { suite.SetupTest() - coreReward := types.NewCoreReward(suite.Addrs[0], sdk.OneDec()) + coreReward := types.NewCoreReward(suite.Addrs[0], sdkmath.LegacyOneDec()) params := types.NewParams(true, types.DefaultPeriods, types.NewInfraParams(tc.args.infraPeriods, types.DefaultInfraParams.PartnerRewards, types.CoreRewards{coreReward})) ctx := suite.Ctx.WithBlockTime(tc.args.startTime) + + notBondedAcc := suite.AccountKeeper.GetModuleAccount(ctx, stakingtypes.NotBondedPoolName) + fmt.Println("inside test notBondedAcc 1", notBondedAcc) + fmt.Println("inside test balance for the notBondedAcc", suite.BankKeeper.GetBalance(ctx, notBondedAcc.GetAddress(), "ukava")) + suite.Keeper.SetParams(ctx, params) suite.Require().NotPanics(func() { suite.Keeper.SetPreviousBlockTime(ctx, tc.args.startTime) }) + notBondedAcc = suite.AccountKeeper.GetModuleAccount(ctx, stakingtypes.NotBondedPoolName) + fmt.Println("inside test notBondedAcc 2", notBondedAcc) + fmt.Println("inside test balance for the notBondedAcc", suite.BankKeeper.GetBalance(ctx, notBondedAcc.GetAddress(), "ukava")) + + // + // Delete initial genesis tokens to start with a clean slate suite.App.DeleteGenesisValidator(suite.T(), suite.Ctx) + notBondedAcc = suite.AccountKeeper.GetModuleAccount(ctx, stakingtypes.NotBondedPoolName) + fmt.Println("inside test notBondedAcc 3", notBondedAcc) + fmt.Println("inside test balance for the notBondedAcc", suite.BankKeeper.GetBalance(ctx, notBondedAcc.GetAddress(), "ukava")) + suite.App.DeleteGenesisValidatorCoins(suite.T(), suite.Ctx) initialBalance := suite.BankKeeper.GetBalance(ctx, suite.Addrs[0], types.GovDenom) + fmt.Println("initialBalance", initialBalance.Amount) ctx = suite.Ctx.WithBlockTime(tc.args.endTime) err := suite.Keeper.MintPeriodInflation(ctx) suite.Require().NoError(err) finalSupply := suite.BankKeeper.GetSupply(ctx, types.GovDenom) - marginHigh := sdk.NewDecFromInt(tc.args.expectedFinalSupply.Amount).Mul(sdk.OneDec().Add(tc.args.marginOfError)) - marginLow := sdk.NewDecFromInt(tc.args.expectedFinalSupply.Amount).Mul(sdk.OneDec().Sub(tc.args.marginOfError)) - suite.Require().True(sdk.NewDecFromInt(finalSupply.Amount).LTE(marginHigh)) - suite.Require().True(sdk.NewDecFromInt(finalSupply.Amount).GTE(marginLow)) + fmt.Println("finalSupply", finalSupply.Amount) + marginHigh := sdkmath.LegacyNewDecFromInt(tc.args.expectedFinalSupply.Amount).Mul(sdkmath.LegacyOneDec().Add(tc.args.marginOfError)) + marginLow := sdkmath.LegacyNewDecFromInt(tc.args.expectedFinalSupply.Amount).Mul(sdkmath.LegacyOneDec().Sub(tc.args.marginOfError)) + suite.Require().True(sdkmath.LegacyNewDecFromInt(finalSupply.Amount).LTE(marginHigh)) + suite.Require().True(sdkmath.LegacyNewDecFromInt(finalSupply.Amount).GTE(marginLow)) finalBalance := suite.BankKeeper.GetBalance(ctx, suite.Addrs[0], types.GovDenom) + fmt.Println("finalBalance", finalBalance.Amount) + // TODO(boodyvo): check here suite.Require().Equal(tc.args.expectedBalanceIncrease, finalBalance.Sub(initialBalance)) } @@ -257,7 +278,7 @@ func (suite *keeperTestSuite) TestInfraPayoutPartner() { infraPeriods types.Periods expectedFinalSupply sdk.Coin expectedBalanceIncrease sdk.Coin - marginOfError sdk.Dec + marginOfError sdkmath.LegacyDec } type errArgs struct { @@ -277,10 +298,10 @@ func (suite *keeperTestSuite) TestInfraPayoutPartner() { args{ startTime: time.Date(2022, time.October, 1, 1, 0, 0, 0, time.UTC), endTime: time.Date(2023, time.October, 1, 1, 0, 0, 0, time.UTC), - infraPeriods: types.Periods{types.NewPeriod(time.Date(2022, time.October, 1, 1, 0, 0, 0, time.UTC), time.Date(2023, time.October, 1, 1, 0, 0, 0, time.UTC), sdk.MustNewDecFromStr("1.000000001547125958"))}, + infraPeriods: types.Periods{types.NewPeriod(time.Date(2022, time.October, 1, 1, 0, 0, 0, time.UTC), time.Date(2023, time.October, 1, 1, 0, 0, 0, time.UTC), sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"))}, expectedFinalSupply: sdk.NewCoin(types.GovDenom, sdkmath.NewInt(1050000000000)), expectedBalanceIncrease: sdk.NewCoin(types.GovDenom, sdkmath.NewInt(63072000)), - marginOfError: sdk.MustNewDecFromStr("0.0001"), + marginOfError: sdkmath.LegacyMustNewDecFromStr("0.0001"), }, errArgs{ expectPass: true, @@ -308,10 +329,10 @@ func (suite *keeperTestSuite) TestInfraPayoutPartner() { err := suite.Keeper.MintPeriodInflation(ctx) suite.Require().NoError(err) finalSupply := suite.BankKeeper.GetSupply(ctx, types.GovDenom) - marginHigh := sdk.NewDecFromInt(tc.args.expectedFinalSupply.Amount).Mul(sdk.OneDec().Add(tc.args.marginOfError)) - marginLow := sdk.NewDecFromInt(tc.args.expectedFinalSupply.Amount).Mul(sdk.OneDec().Sub(tc.args.marginOfError)) - suite.Require().True(sdk.NewDecFromInt(finalSupply.Amount).LTE(marginHigh)) - suite.Require().True(sdk.NewDecFromInt(finalSupply.Amount).GTE(marginLow)) + marginHigh := sdkmath.LegacyNewDecFromInt(tc.args.expectedFinalSupply.Amount).Mul(sdkmath.LegacyOneDec().Add(tc.args.marginOfError)) + marginLow := sdkmath.LegacyNewDecFromInt(tc.args.expectedFinalSupply.Amount).Mul(sdkmath.LegacyOneDec().Sub(tc.args.marginOfError)) + suite.Require().True(sdkmath.LegacyNewDecFromInt(finalSupply.Amount).LTE(marginHigh)) + suite.Require().True(sdkmath.LegacyNewDecFromInt(finalSupply.Amount).GTE(marginLow)) finalBalance := suite.BankKeeper.GetBalance(ctx, suite.Addrs[0], types.GovDenom) suite.Require().Equal(tc.args.expectedBalanceIncrease, finalBalance.Sub(initialBalance)) @@ -338,7 +359,7 @@ func (suite *keeperTestSuite) TestInfraPayoutE2E() { partnerRewards types.PartnerRewards expectedFinalSupply sdk.Coin expectedBalances balances - marginOfError sdk.Dec + marginOfError sdkmath.LegacyDec } type errArgs struct { @@ -358,18 +379,18 @@ func (suite *keeperTestSuite) TestInfraPayoutE2E() { { "5% apy one year", args{ - periods: types.Periods{types.NewPeriod(time.Date(2022, time.October, 1, 1, 0, 0, 0, time.UTC), time.Date(2023, time.October, 1, 1, 0, 0, 0, time.UTC), sdk.MustNewDecFromStr("1.000000001547125958"))}, + periods: types.Periods{types.NewPeriod(time.Date(2022, time.October, 1, 1, 0, 0, 0, time.UTC), time.Date(2023, time.October, 1, 1, 0, 0, 0, time.UTC), sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"))}, startTime: time.Date(2022, time.October, 1, 1, 0, 0, 0, time.UTC), endTime: time.Date(2023, time.October, 1, 1, 0, 0, 0, time.UTC), - infraPeriods: types.Periods{types.NewPeriod(time.Date(2022, time.October, 1, 1, 0, 0, 0, time.UTC), time.Date(2023, time.October, 1, 1, 0, 0, 0, time.UTC), sdk.MustNewDecFromStr("1.000000001547125958"))}, - coreRewards: types.CoreRewards{types.NewCoreReward(addrs[1], sdk.OneDec())}, + infraPeriods: types.Periods{types.NewPeriod(time.Date(2022, time.October, 1, 1, 0, 0, 0, time.UTC), time.Date(2023, time.October, 1, 1, 0, 0, 0, time.UTC), sdkmath.LegacyMustNewDecFromStr("1.000000001547125958"))}, + coreRewards: types.CoreRewards{types.NewCoreReward(addrs[1], sdkmath.LegacyOneDec())}, partnerRewards: types.PartnerRewards{types.NewPartnerReward(addrs[2], sdk.NewCoin("ukava", sdkmath.NewInt(2)))}, expectedFinalSupply: sdk.NewCoin(types.GovDenom, sdkmath.NewInt(1102500000000)), expectedBalances: balances{ balance{addrs[1], sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(52436928000)))}, balance{addrs[2], sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(63072000)))}, }, - marginOfError: sdk.MustNewDecFromStr("0.0001"), + marginOfError: sdkmath.LegacyMustNewDecFromStr("0.0001"), }, errArgs{ expectPass: true, @@ -395,10 +416,10 @@ func (suite *keeperTestSuite) TestInfraPayoutE2E() { err := suite.Keeper.MintPeriodInflation(ctx) suite.Require().NoError(err) finalSupply := suite.BankKeeper.GetSupply(ctx, types.GovDenom) - marginHigh := sdk.NewDecFromInt(tc.args.expectedFinalSupply.Amount).Mul(sdk.OneDec().Add(tc.args.marginOfError)) - marginLow := sdk.NewDecFromInt(tc.args.expectedFinalSupply.Amount).Mul(sdk.OneDec().Sub(tc.args.marginOfError)) - suite.Require().True(sdk.NewDecFromInt(finalSupply.Amount).LTE(marginHigh)) - suite.Require().True(sdk.NewDecFromInt(finalSupply.Amount).GTE(marginLow)) + marginHigh := sdkmath.LegacyNewDecFromInt(tc.args.expectedFinalSupply.Amount).Mul(sdkmath.LegacyOneDec().Add(tc.args.marginOfError)) + marginLow := sdkmath.LegacyNewDecFromInt(tc.args.expectedFinalSupply.Amount).Mul(sdkmath.LegacyOneDec().Sub(tc.args.marginOfError)) + suite.Require().True(sdkmath.LegacyNewDecFromInt(finalSupply.Amount).LTE(marginHigh)) + suite.Require().True(sdkmath.LegacyNewDecFromInt(finalSupply.Amount).GTE(marginLow)) for _, bal := range tc.args.expectedBalances { finalBalance := suite.BankKeeper.GetAllBalances(ctx, bal.address) diff --git a/x/kavadist/module.go b/x/kavadist/module.go index 11d01d8bc7..22c7332624 100644 --- a/x/kavadist/module.go +++ b/x/kavadist/module.go @@ -133,12 +133,20 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw func (AppModule) ConsensusVersion() uint64 { return 1 } // BeginBlock executes all ABCI BeginBlock logic respective to kavadist module. -func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { - BeginBlocker(ctx, am.keeper) +func (am AppModule) BeginBlock(ctx context.Context) error { + sdkCtx := sdk.UnwrapSDKContext(ctx) + BeginBlocker(sdkCtx, am.keeper) + + // TODO(boodyvo): should read about if we should panic inside or return nil here + return nil } // EndBlock executes all ABCI EndBlock logic respective to kavadist module. It // returns no validator updates. -func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - return []abci.ValidatorUpdate{} +func (am AppModule) EndBlock(_ sdk.Context) ([]abci.ValidatorUpdate, error) { + return []abci.ValidatorUpdate{}, nil } + +func (AppModule) IsOnePerModuleType() {} + +func (AppModule) IsAppModule() {} diff --git a/x/kavadist/spec/02_state.md b/x/kavadist/spec/02_state.md index abc3a0e656..b4a0b3a2d4 100644 --- a/x/kavadist/spec/02_state.md +++ b/x/kavadist/spec/02_state.md @@ -19,7 +19,7 @@ type Params struct { type Period struct { Start time.Time `json:"start" yaml:"start"` // example "2020-03-01T15:20:00Z" End time.Time `json:"end" yaml:"end"` // example "2020-06-01T15:20:00Z" - Inflation sdk.Dec `json:"inflation" yaml:"inflation"` // example "1.000000003022265980" - 10% inflation + Inflation sdkmath.LegacyDec `json:"inflation" yaml:"inflation"` // example "1.000000003022265980" - 10% inflation } ``` diff --git a/x/kavadist/spec/05_params.md b/x/kavadist/spec/05_params.md index 3860bc9494..4a82f0563b 100644 --- a/x/kavadist/spec/05_params.md +++ b/x/kavadist/spec/05_params.md @@ -26,14 +26,14 @@ Each `Period` has the following parameters | --------- | --------- | ---------------------- | --------------------------------------- | | Start | time.Time | "2020-03-01T15:20:00Z" | the time when the period will start | | End | time.Time | "2020-06-01T15:20:00Z" | the time when the period will end | -| Inflation | sdk.Dec | "1.000000003022265980" | the per-second inflation for the period | +| Inflation | sdkmath.LegacyDec | "1.000000003022265980" | the per-second inflation for the period | Each `CoreReward` has the following properties | Key | Type | Example | Description | | ------- | -------------- | --------------------------------------------- | -------------------------------------------------------- | | Address | sdk.AccAddress | "kava1x07eng0q9027j7wayap8nvqegpf625uu0w90tq" | address of core infrastructure provider | -| Weight | sdk.Dec | "0.912345678907654321" | % of remaining minted rewards allocated to this provider | +| Weight | sdkmath.LegacyDec | "0.912345678907654321" | % of remaining minted rewards allocated to this provider | Each `PartnerReward` has the following properties diff --git a/x/kavadist/testutil/suite.go b/x/kavadist/testutil/suite.go index 58a001da58..7a2c53c2f3 100644 --- a/x/kavadist/testutil/suite.go +++ b/x/kavadist/testutil/suite.go @@ -13,7 +13,6 @@ import ( tmtime "github.com/cometbft/cometbft/types/time" accountkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" "github.com/kava-labs/kava/app" @@ -44,13 +43,13 @@ func (suite *Suite) SetupTest() { coins := sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(1000000000000))) authGS := app.NewFundedGenStateWithSameCoins(tApp.AppCodec(), coins, addrs) - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) testPeriods := []types.Period{ { Start: time.Date(2020, time.March, 1, 1, 0, 0, 0, time.UTC), End: time.Date(2021, time.March, 1, 1, 0, 0, 0, time.UTC), - Inflation: sdk.MustNewDecFromStr("1.000000003022265980"), + Inflation: sdkmath.LegacyMustNewDecFromStr("1.000000003022265980"), }, } params := types.NewParams(true, testPeriods, types.DefaultInfraParams) @@ -71,7 +70,7 @@ func (suite *Suite) SetupTest() { } // CreateAccount creates a new account with the provided balance -func (suite *Suite) CreateAccount(initialBalance sdk.Coins) authtypes.AccountI { +func (suite *Suite) CreateAccount(initialBalance sdk.Coins) sdk.AccountI { _, addrs := app.GeneratePrivKeyAddressPairs(1) fmt.Println(addrs[0].String()) acc := suite.AccountKeeper.NewAccountWithAddress(suite.Ctx, addrs[0]) diff --git a/x/kavadist/types/codec.go b/x/kavadist/types/codec.go index 10685c2471..ecfa22b41e 100644 --- a/x/kavadist/types/codec.go +++ b/x/kavadist/types/codec.go @@ -4,7 +4,6 @@ import ( "github.com/cosmos/cosmos-sdk/codec" cdctypes "github.com/cosmos/cosmos-sdk/codec/types" cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" - authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec" govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) @@ -33,5 +32,5 @@ func init() { // Register all Amino interfaces and concrete types on the authz Amino codec so that this can later be // used to properly serialize MsgGrant and MsgExec instances - RegisterLegacyAminoCodec(authzcodec.Amino) + RegisterLegacyAminoCodec(codec.NewLegacyAmino()) } diff --git a/x/kavadist/types/expected_keepers.go b/x/kavadist/types/expected_keepers.go index e78d3d9fc2..59da8271ae 100644 --- a/x/kavadist/types/expected_keepers.go +++ b/x/kavadist/types/expected_keepers.go @@ -1,26 +1,26 @@ package types import ( + "context" sdk "github.com/cosmos/cosmos-sdk/types" - authTypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) // DistKeeper defines the expected distribution keeper interface type DistKeeper interface { - DistributeFromFeePool(ctx sdk.Context, amount sdk.Coins, receiveAddr sdk.AccAddress) error + DistributeFromFeePool(ctx context.Context, amount sdk.Coins, receiveAddr sdk.AccAddress) error } // AccountKeeper defines the expected account keeper interface type AccountKeeper interface { - GetModuleAccount(ctx sdk.Context, moduleName string) authTypes.ModuleAccountI - SetModuleAccount(ctx sdk.Context, macc authTypes.ModuleAccountI) - NewAccountWithAddress(ctx sdk.Context, addr sdk.AccAddress) authTypes.AccountI + GetModuleAccount(ctx context.Context, moduleName string) sdk.ModuleAccountI + SetModuleAccount(ctx context.Context, macc sdk.ModuleAccountI) + NewAccountWithAddress(ctx context.Context, addr sdk.AccAddress) sdk.AccountI } // BankKeeper defines the expected bank keeper interface type BankKeeper interface { - GetAllBalances(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins - MintCoins(ctx sdk.Context, moduleName string, amounts sdk.Coins) error - GetSupply(ctx sdk.Context, denom string) sdk.Coin - SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error + GetAllBalances(ctx context.Context, addr sdk.AccAddress) sdk.Coins + MintCoins(ctx context.Context, moduleName string, amounts sdk.Coins) error + GetSupply(ctx context.Context, denom string) sdk.Coin + SendCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error } diff --git a/x/kavadist/types/params.go b/x/kavadist/types/params.go index ad8074480d..d2fb071891 100644 --- a/x/kavadist/types/params.go +++ b/x/kavadist/types/params.go @@ -1,6 +1,7 @@ package types import ( + sdkmath "cosmossdk.io/math" "fmt" "time" @@ -87,7 +88,7 @@ func (p Params) Validate() error { } // NewPeriod returns a new instance of Period -func NewPeriod(start time.Time, end time.Time, inflation sdk.Dec) Period { +func NewPeriod(start time.Time, end time.Time, inflation sdkmath.LegacyDec) Period { return Period{ Start: start, End: end, @@ -120,7 +121,7 @@ func NewPartnerReward(addr sdk.AccAddress, rps sdk.Coin) PartnerReward { } } -func NewCoreReward(addr sdk.AccAddress, w sdk.Dec) CoreReward { +func NewCoreReward(addr sdk.AccAddress, w sdkmath.LegacyDec) CoreReward { return CoreReward{ Address: addr, Weight: w, diff --git a/x/kavadist/types/params.pb.go b/x/kavadist/types/params.pb.go index 49eb8475fa..418e190287 100644 --- a/x/kavadist/types/params.pb.go +++ b/x/kavadist/types/params.pb.go @@ -4,6 +4,7 @@ package types import ( + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" _ "github.com/cosmos/cosmos-proto" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" @@ -112,7 +113,7 @@ var xxx_messageInfo_InfrastructureParams proto.InternalMessageInfo // CoreReward defines the reward weights for core infrastructure providers. type CoreReward struct { Address github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=address,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"address,omitempty"` - Weight github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=weight,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"weight"` + Weight cosmossdk_io_math.LegacyDec `protobuf:"bytes,2,opt,name=weight,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"weight"` } func (m *CoreReward) Reset() { *m = CoreReward{} } @@ -195,7 +196,7 @@ type Period struct { // example "2020-06-01T15:20:00Z" End time.Time `protobuf:"bytes,2,opt,name=end,proto3,stdtime" json:"end"` // example "1.000000003022265980" - 10% inflation - Inflation github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=inflation,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"inflation"` + Inflation cosmossdk_io_math.LegacyDec `protobuf:"bytes,3,opt,name=inflation,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"inflation"` } func (m *Period) Reset() { *m = Period{} } @@ -243,48 +244,49 @@ func init() { } var fileDescriptor_2c7a7a4b0c884a4e = []byte{ - // 649 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x54, 0x3f, 0x4f, 0x1b, 0x3f, - 0x18, 0x8e, 0x49, 0x7e, 0x01, 0x1c, 0x7e, 0x50, 0x99, 0x3f, 0x0a, 0x48, 0xbd, 0x4b, 0xa3, 0xaa, - 0x8a, 0x5a, 0xe5, 0x4e, 0xa4, 0x52, 0x07, 0xd4, 0x0e, 0x5c, 0x19, 0x5a, 0x89, 0x4a, 0xe8, 0xca, - 0xd2, 0x2e, 0x91, 0xcf, 0xe7, 0x04, 0x0b, 0x72, 0x3e, 0xd9, 0x0e, 0x94, 0x6f, 0xc1, 0xd8, 0x91, - 0xb9, 0x33, 0x5f, 0xa1, 0x6a, 0x86, 0x0e, 0x88, 0x09, 0x75, 0x80, 0x02, 0x4b, 0x3f, 0x43, 0xa7, - 0xea, 0x6c, 0x87, 0x10, 0x04, 0x52, 0xba, 0x74, 0x49, 0xee, 0x7d, 0xfd, 0x3e, 0xcf, 0xfb, 0x3e, - 0xe7, 0xe7, 0x3d, 0x58, 0xdd, 0xc6, 0xbb, 0xd8, 0xcf, 0x7e, 0x62, 0x26, 0x95, 0xbf, 0xbb, 0x1c, - 0x51, 0x85, 0x97, 0xfd, 0x14, 0x0b, 0xdc, 0x91, 0x5e, 0x2a, 0xb8, 0xe2, 0x68, 0x3e, 0x3b, 0xf6, - 0xfa, 0x35, 0x9e, 0xad, 0x59, 0x72, 0x08, 0x97, 0x1d, 0x2e, 0xfd, 0x08, 0x4b, 0x7a, 0x0d, 0x24, - 0x9c, 0x25, 0x06, 0xb6, 0xb4, 0x68, 0xce, 0x9b, 0x3a, 0xf2, 0x4d, 0x60, 0x8f, 0xe6, 0xda, 0xbc, - 0xcd, 0x4d, 0x3e, 0x7b, 0xb2, 0x59, 0xb7, 0xcd, 0x79, 0x7b, 0x87, 0xfa, 0x3a, 0x8a, 0xba, 0x2d, - 0x5f, 0xb1, 0x0e, 0x95, 0x0a, 0x77, 0x52, 0x53, 0x50, 0xfd, 0x06, 0x60, 0x71, 0x43, 0x4f, 0x86, - 0x16, 0x60, 0x11, 0x13, 0xc5, 0x76, 0x69, 0x19, 0x54, 0x40, 0x6d, 0x22, 0xb4, 0x11, 0x7a, 0x05, - 0xc7, 0x53, 0x2a, 0x18, 0x8f, 0x65, 0x39, 0x5f, 0xc9, 0xd7, 0x4a, 0x8d, 0x87, 0xde, 0x9d, 0xd3, - 0x7b, 0x1b, 0xba, 0x2a, 0x28, 0xf4, 0xce, 0xdc, 0x5c, 0xd8, 0xc7, 0xa0, 0x16, 0x9c, 0x67, 0x49, - 0x4b, 0x60, 0xa9, 0x44, 0x97, 0xa8, 0xae, 0xa0, 0x4d, 0xf3, 0x26, 0xca, 0x85, 0x0a, 0xa8, 0x95, - 0x1a, 0xcf, 0xee, 0x21, 0x7b, 0x3b, 0x84, 0x31, 0x23, 0x5a, 0xea, 0x39, 0x76, 0xc7, 0x59, 0xf5, - 0xeb, 0x18, 0x9c, 0xbb, 0x0b, 0x84, 0x28, 0x5c, 0xb8, 0x3d, 0x80, 0x95, 0x03, 0x46, 0x91, 0x33, - 0x93, 0xf5, 0xfc, 0x72, 0xee, 0x8e, 0x9b, 0x58, 0x86, 0xb7, 0xe4, 0xd8, 0x34, 0xfa, 0x00, 0xa7, - 0x08, 0x17, 0xb4, 0x29, 0xe8, 0x1e, 0x16, 0xb1, 0x2c, 0x8f, 0x69, 0xf2, 0x47, 0xf7, 0x90, 0xbf, - 0xe6, 0x82, 0x86, 0xba, 0x32, 0x98, 0xb5, 0x0d, 0x4a, 0x83, 0x9c, 0x0c, 0x4b, 0x64, 0x10, 0x20, - 0x0a, 0x67, 0x52, 0x2c, 0x54, 0x42, 0xc5, 0x35, 0xbb, 0xb9, 0x89, 0xc7, 0xf7, 0x8d, 0x6e, 0xaa, - 0x6d, 0x83, 0x05, 0xdb, 0x60, 0x7a, 0x28, 0x2d, 0xc3, 0xe9, 0x74, 0x28, 0x5e, 0x29, 0x7c, 0x3e, - 0x74, 0x41, 0xf5, 0x3b, 0x80, 0x70, 0x30, 0x09, 0x8a, 0xe0, 0x38, 0x8e, 0x63, 0x41, 0xa5, 0xd4, - 0xb6, 0x98, 0x0a, 0xde, 0xfc, 0x3e, 0x73, 0xeb, 0x6d, 0xa6, 0xb6, 0xba, 0x91, 0x47, 0x78, 0xc7, - 0xba, 0xd0, 0xfe, 0xd5, 0x65, 0xbc, 0xed, 0xab, 0xfd, 0x94, 0x4a, 0x6f, 0x95, 0x90, 0x55, 0x03, - 0x3c, 0x39, 0xaa, 0xcf, 0x5a, 0xaf, 0xda, 0x4c, 0xb0, 0xaf, 0xa8, 0x0c, 0xfb, 0xc4, 0x68, 0x13, - 0x16, 0xf7, 0x28, 0x6b, 0x6f, 0xa9, 0xf2, 0x58, 0x05, 0xd4, 0x26, 0x83, 0x97, 0xd9, 0xc0, 0x3f, - 0xce, 0xdc, 0x27, 0x23, 0xb4, 0x59, 0xa3, 0xe4, 0xe4, 0xa8, 0x0e, 0x2d, 0xff, 0x1a, 0x25, 0xa1, - 0xe5, 0xb2, 0x72, 0x7a, 0x00, 0xfe, 0x3f, 0xa4, 0xfb, 0x9f, 0x28, 0x7a, 0x07, 0x91, 0xbd, 0xa9, - 0xcc, 0x6c, 0x4d, 0x49, 0x09, 0x4f, 0x62, 0xad, 0xae, 0xd4, 0x58, 0xf4, 0x2c, 0x34, 0xdb, 0xf2, - 0x1b, 0x86, 0x60, 0x89, 0xf5, 0xf7, 0x03, 0x0b, 0xdd, 0xa0, 0xe2, 0xbd, 0x06, 0x5a, 0x29, 0xc7, - 0xd9, 0xae, 0x6a, 0xb7, 0xa1, 0x15, 0xf8, 0x9f, 0x54, 0x58, 0x28, 0xad, 0xa0, 0xd4, 0x58, 0xf2, - 0xcc, 0x9e, 0x7b, 0xfd, 0x3d, 0xf7, 0x36, 0xfb, 0x7b, 0x1e, 0x4c, 0x64, 0x9c, 0x07, 0xe7, 0x2e, - 0x08, 0x0d, 0x04, 0xbd, 0x80, 0x79, 0x7a, 0x3d, 0xcc, 0x68, 0xc8, 0x0c, 0x80, 0xd6, 0xe1, 0x24, - 0x4b, 0x5a, 0x3b, 0x58, 0x31, 0x9e, 0x94, 0xf3, 0xfa, 0xcd, 0x79, 0x7f, 0x77, 0x51, 0xe1, 0x80, - 0x60, 0xa5, 0xf0, 0xeb, 0xd0, 0x05, 0xc1, 0x7a, 0xef, 0xc2, 0xc9, 0x9d, 0x5e, 0x38, 0xb9, 0xde, - 0xa5, 0x03, 0x8e, 0x2f, 0x1d, 0xf0, 0xf3, 0xd2, 0x01, 0x07, 0x57, 0x4e, 0xee, 0xf8, 0xca, 0xc9, - 0x9d, 0x5e, 0x39, 0xb9, 0x8f, 0x4f, 0x6f, 0x50, 0x67, 0x3e, 0xaf, 0xef, 0xe0, 0x48, 0xea, 0x27, - 0xff, 0xd3, 0xe0, 0x23, 0xab, 0x5b, 0x44, 0x45, 0x2d, 0xe2, 0xf9, 0x9f, 0x00, 0x00, 0x00, 0xff, - 0xff, 0xca, 0x25, 0xda, 0x69, 0x82, 0x05, 0x00, 0x00, + // 662 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x54, 0x3d, 0x4f, 0x1b, 0x4b, + 0x14, 0xf5, 0x60, 0x3f, 0x03, 0x63, 0x1e, 0x3c, 0x2d, 0x1f, 0x32, 0x3c, 0xbd, 0x5d, 0x3f, 0x27, + 0x85, 0x95, 0xc8, 0xb3, 0xc2, 0x91, 0x52, 0x20, 0xa5, 0x60, 0x43, 0x11, 0x24, 0x22, 0xa1, 0x4d, + 0x9a, 0xa4, 0xb1, 0x66, 0x67, 0xc7, 0xcb, 0x08, 0xbc, 0xb3, 0x9a, 0x19, 0x43, 0xf8, 0x17, 0x94, + 0x29, 0xa9, 0x53, 0xf3, 0x07, 0x52, 0xa0, 0xb8, 0x44, 0x54, 0x28, 0x05, 0x04, 0x68, 0xf2, 0x1b, + 0x52, 0x45, 0x3b, 0x33, 0xc6, 0x18, 0x81, 0x44, 0x95, 0xc6, 0xde, 0x7b, 0xe7, 0x9e, 0x33, 0xe7, + 0xec, 0xbd, 0x77, 0x61, 0x7d, 0x1b, 0xef, 0x62, 0x3f, 0xff, 0x89, 0x99, 0x54, 0xfe, 0xee, 0x72, + 0x44, 0x15, 0x5e, 0xf6, 0x33, 0x2c, 0x70, 0x57, 0xa2, 0x4c, 0x70, 0xc5, 0x9d, 0xf9, 0xfc, 0x18, + 0x0d, 0x6a, 0x90, 0xad, 0x59, 0x72, 0x09, 0x97, 0x5d, 0x2e, 0xfd, 0x08, 0x4b, 0x7a, 0x03, 0x24, + 0x9c, 0xa5, 0x06, 0xb6, 0xb4, 0x68, 0xce, 0xdb, 0x3a, 0xf2, 0x4d, 0x60, 0x8f, 0xe6, 0x12, 0x9e, + 0x70, 0x93, 0xcf, 0x9f, 0x6c, 0xd6, 0x4b, 0x38, 0x4f, 0x76, 0xa8, 0xaf, 0xa3, 0xa8, 0xd7, 0xf1, + 0x15, 0xeb, 0x52, 0xa9, 0x70, 0x37, 0x33, 0x05, 0xf5, 0x6f, 0x00, 0x96, 0x37, 0xb5, 0x32, 0x67, + 0x01, 0x96, 0x31, 0x51, 0x6c, 0x97, 0x56, 0x41, 0x0d, 0x34, 0x26, 0x42, 0x1b, 0x39, 0xaf, 0xe0, + 0x78, 0x46, 0x05, 0xe3, 0xb1, 0xac, 0x16, 0x6b, 0xc5, 0x46, 0xa5, 0xf5, 0x1f, 0xba, 0x57, 0x3d, + 0xda, 0xd4, 0x55, 0x41, 0xa9, 0x7f, 0xee, 0x15, 0xc2, 0x01, 0xc6, 0xe9, 0xc0, 0x79, 0x96, 0x76, + 0x04, 0x96, 0x4a, 0xf4, 0x88, 0xea, 0x09, 0xda, 0x36, 0x6f, 0xa2, 0x5a, 0xaa, 0x81, 0x46, 0xa5, + 0xf5, 0xfc, 0x01, 0xb2, 0xf5, 0x11, 0x8c, 0x91, 0x68, 0xa9, 0xe7, 0xd8, 0x3d, 0x67, 0xf5, 0xe3, + 0x31, 0x38, 0x77, 0x1f, 0xc8, 0xa1, 0x70, 0xe1, 0xae, 0x00, 0x6b, 0x07, 0x3c, 0xc6, 0xce, 0x4c, + 0x7e, 0xe7, 0x97, 0x0b, 0x6f, 0xdc, 0xc4, 0x32, 0xbc, 0x63, 0xc7, 0xa6, 0x9d, 0x0f, 0x70, 0x8a, + 0x70, 0x41, 0xdb, 0x82, 0xee, 0x61, 0x11, 0xcb, 0xea, 0x98, 0x26, 0xff, 0xff, 0x01, 0xf2, 0xd7, + 0x5c, 0xd0, 0x50, 0x57, 0x06, 0xb3, 0xf6, 0x82, 0xca, 0x30, 0x27, 0xc3, 0x0a, 0x19, 0x06, 0x0e, + 0x85, 0x33, 0x19, 0x16, 0x2a, 0xa5, 0xe2, 0x86, 0xdd, 0x74, 0xe2, 0xe9, 0x43, 0xd2, 0x4d, 0xb5, + 0xbd, 0x60, 0xc1, 0x5e, 0x30, 0x3d, 0x92, 0x96, 0xe1, 0x74, 0x36, 0x12, 0xaf, 0x94, 0x3e, 0x1f, + 0x7a, 0xa0, 0xfe, 0x15, 0x40, 0x38, 0x54, 0xe2, 0x44, 0x70, 0x1c, 0xc7, 0xb1, 0xa0, 0x52, 0xea, + 0xb1, 0x98, 0x0a, 0xde, 0xfc, 0x3a, 0xf7, 0x9a, 0x09, 0x53, 0x5b, 0xbd, 0x08, 0x11, 0xde, 0xb5, + 0x53, 0x68, 0xff, 0x9a, 0x32, 0xde, 0xf6, 0xd5, 0x7e, 0x46, 0x25, 0x5a, 0x25, 0x64, 0xd5, 0x00, + 0x4f, 0x8f, 0x9a, 0xb3, 0x76, 0x56, 0x6d, 0x26, 0xd8, 0x57, 0x54, 0x86, 0x03, 0x62, 0x67, 0x1d, + 0x96, 0xf7, 0x28, 0x4b, 0xb6, 0x54, 0x75, 0xac, 0x06, 0x1a, 0x93, 0xc1, 0x72, 0x2e, 0xf8, 0xfb, + 0xb9, 0xf7, 0xaf, 0x41, 0xc9, 0x78, 0x1b, 0x31, 0xee, 0x77, 0xb1, 0xda, 0x42, 0x1b, 0x34, 0xc1, + 0x64, 0x7f, 0x8d, 0x92, 0xd3, 0xa3, 0x26, 0xb4, 0xa4, 0x6b, 0x94, 0x84, 0x96, 0xc0, 0x7a, 0xe8, + 0x03, 0xf8, 0xf7, 0x88, 0xd9, 0x3f, 0x62, 0xe3, 0x2d, 0x74, 0x6c, 0x7b, 0xf2, 0x09, 0x6b, 0x4b, + 0x4a, 0x78, 0x1a, 0x6b, 0x4b, 0x95, 0xd6, 0x22, 0xb2, 0xd0, 0x7c, 0xb5, 0x6f, 0x4d, 0x01, 0x4b, + 0xed, 0x50, 0xff, 0x63, 0xa1, 0x9b, 0x54, 0xbc, 0xd3, 0x40, 0x6b, 0xe5, 0x38, 0x5f, 0x50, 0x3d, + 0x62, 0xce, 0x0a, 0xfc, 0x4b, 0x2a, 0x2c, 0x94, 0x76, 0x50, 0x69, 0x2d, 0x21, 0xb3, 0xdc, 0x68, + 0xb0, 0xdc, 0xe8, 0xfd, 0x60, 0xb9, 0x83, 0x89, 0x9c, 0xf3, 0xe0, 0xc2, 0x03, 0xa1, 0x81, 0x38, + 0x2f, 0x61, 0x91, 0xde, 0x88, 0x79, 0x1c, 0x32, 0x07, 0x38, 0xab, 0x70, 0x92, 0xa5, 0x9d, 0x1d, + 0xac, 0x18, 0x4f, 0xab, 0x45, 0xfd, 0xe6, 0x9e, 0x3c, 0xa2, 0x3b, 0xe1, 0x10, 0xb5, 0x52, 0xfa, + 0x79, 0xe8, 0x81, 0x60, 0xa3, 0x7f, 0xe9, 0x16, 0xce, 0x2e, 0xdd, 0x42, 0xff, 0xca, 0x05, 0x27, + 0x57, 0x2e, 0xf8, 0x71, 0xe5, 0x82, 0x83, 0x6b, 0xb7, 0x70, 0x72, 0xed, 0x16, 0xce, 0xae, 0xdd, + 0xc2, 0xc7, 0x67, 0xb7, 0xba, 0x91, 0x4f, 0x74, 0x73, 0x07, 0x47, 0x52, 0x3f, 0xf9, 0x9f, 0x86, + 0x9f, 0x53, 0xdd, 0x95, 0xa8, 0xac, 0x95, 0xbf, 0xf8, 0x1d, 0x00, 0x00, 0xff, 0xff, 0xa3, 0x0b, + 0xaf, 0x4d, 0x6c, 0x05, 0x00, 0x00, } func (this *Period) Equal(that interface{}) bool { diff --git a/x/kavadist/types/params_test.go b/x/kavadist/types/params_test.go index 49b068aa43..51e785f972 100644 --- a/x/kavadist/types/params_test.go +++ b/x/kavadist/types/params_test.go @@ -1,13 +1,12 @@ package types_test import ( + sdkmath "cosmossdk.io/math" "testing" "time" "github.com/stretchr/testify/suite" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/kava-labs/kava/x/kavadist/types" ) @@ -29,12 +28,12 @@ func (suite *ParamTestSuite) SetupTest() { { Start: time.Date(2020, time.March, 1, 1, 0, 0, 0, time.UTC), End: time.Date(2021, time.March, 1, 1, 0, 0, 0, time.UTC), - Inflation: sdk.MustNewDecFromStr("1.000000003022265980"), + Inflation: sdkmath.LegacyMustNewDecFromStr("1.000000003022265980"), }, { Start: time.Date(2021, time.March, 1, 1, 0, 0, 0, time.UTC), End: time.Date(2022, time.March, 1, 1, 0, 0, 0, time.UTC), - Inflation: sdk.MustNewDecFromStr("1.000000003022265980"), + Inflation: sdkmath.LegacyMustNewDecFromStr("1.000000003022265980"), }, }, } @@ -44,12 +43,12 @@ func (suite *ParamTestSuite) SetupTest() { { Start: time.Date(2022, time.March, 1, 1, 0, 0, 0, time.UTC), End: time.Date(2021, time.March, 1, 1, 0, 0, 0, time.UTC), - Inflation: sdk.MustNewDecFromStr("1.000000003022265980"), + Inflation: sdkmath.LegacyMustNewDecFromStr("1.000000003022265980"), }, { Start: time.Date(2023, time.March, 1, 1, 0, 0, 0, time.UTC), End: time.Date(2024, time.March, 1, 1, 0, 0, 0, time.UTC), - Inflation: sdk.MustNewDecFromStr("1.000000003022265980"), + Inflation: sdkmath.LegacyMustNewDecFromStr("1.000000003022265980"), }, }, } @@ -59,12 +58,12 @@ func (suite *ParamTestSuite) SetupTest() { { Start: time.Date(2020, time.March, 1, 1, 0, 0, 0, time.UTC), End: time.Date(2021, time.March, 1, 1, 0, 0, 0, time.UTC), - Inflation: sdk.MustNewDecFromStr("1.000000003022265980"), + Inflation: sdkmath.LegacyMustNewDecFromStr("1.000000003022265980"), }, { Start: time.Date(2020, time.March, 1, 1, 0, 0, 0, time.UTC), End: time.Date(2022, time.March, 1, 1, 0, 0, 0, time.UTC), - Inflation: sdk.MustNewDecFromStr("1.000000003022265980"), + Inflation: sdkmath.LegacyMustNewDecFromStr("1.000000003022265980"), }, }, } diff --git a/x/kavadist/types/proposal.go b/x/kavadist/types/proposal.go index 3fa8e06f4d..08c9d41d48 100644 --- a/x/kavadist/types/proposal.go +++ b/x/kavadist/types/proposal.go @@ -5,7 +5,6 @@ import ( "strings" sdk "github.com/cosmos/cosmos-sdk/types" - govcodec "github.com/cosmos/cosmos-sdk/x/gov/codec" govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) @@ -19,7 +18,8 @@ var _ govv1beta1.Content = CommunityPoolMultiSpendProposal{} func init() { govv1beta1.RegisterProposalType(ProposalTypeCommunityPoolMultiSpend) - govcodec.ModuleCdc.Amino.RegisterConcrete(CommunityPoolMultiSpendProposal{}, "kava/CommunityPoolMultiSpendProposal", nil) + // TODO(boodyvo): check how to change + //govcodec.ModuleCdc.Amino.RegisterConcrete(CommunityPoolMultiSpendProposal{}, "kava/CommunityPoolMultiSpendProposal", nil) } // NewCommunityPoolMultiSpendProposal creates a new community pool multi-spend proposal. diff --git a/x/kavadist/types/query.pb.go b/x/kavadist/types/query.pb.go index 397fc89ff0..5c6e03b2b5 100644 --- a/x/kavadist/types/query.pb.go +++ b/x/kavadist/types/query.pb.go @@ -336,6 +336,7 @@ func _Query_Balance_Handler(srv interface{}, ctx context.Context, dec func(inter return interceptor(ctx, in, info, handler) } +var Query_serviceDesc = _Query_serviceDesc var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "kava.kavadist.v1beta1.Query", HandlerType: (*QueryServer)(nil), diff --git a/x/liquid/keeper/claim.go b/x/liquid/keeper/claim.go index 89b8827e3d..2fc1d88967 100644 --- a/x/liquid/keeper/claim.go +++ b/x/liquid/keeper/claim.go @@ -16,7 +16,11 @@ func (k Keeper) CollectStakingRewards( macc := k.accountKeeper.GetModuleAccount(ctx, types.ModuleAccountName) // Ensure withdraw address is as expected - withdrawAddr := k.distributionKeeper.GetDelegatorWithdrawAddr(ctx, macc.GetAddress()) + withdrawAddr, err := k.distributionKeeper.GetDelegatorWithdrawAddr(ctx, macc.GetAddress()) + if err != nil { + return nil, err + } + if !withdrawAddr.Equals(macc.GetAddress()) { panic(fmt.Sprintf( "unexpected withdraw address for liquid staking module account, expected %s, got %s", @@ -24,6 +28,7 @@ func (k Keeper) CollectStakingRewards( )) } + // ErrNoValidatorExists rewards, err := k.distributionKeeper.WithdrawDelegationRewards(ctx, macc.GetAddress(), validator) if err != nil { return nil, err diff --git a/x/liquid/keeper/claim_test.go b/x/liquid/keeper/claim_test.go index 457318ae8c..e4f56957fd 100644 --- a/x/liquid/keeper/claim_test.go +++ b/x/liquid/keeper/claim_test.go @@ -3,7 +3,6 @@ package keeper_test import ( sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/staking" "github.com/kava-labs/kava/app" "github.com/kava-labs/kava/x/liquid/types" @@ -31,14 +30,15 @@ func (suite *KeeperTestSuite) TestCollectStakingRewards() { suite.CreateNewUnbondedValidator(valAddr1, initialBalance) suite.CreateDelegation(valAddr1, delegator, delegateAmount) - staking.EndBlocker(suite.Ctx, suite.StakingKeeper) + _, err := suite.StakingKeeper.EndBlocker(suite.Ctx) + suite.Require().NoError(err) // Transfers delegation to module account - _, err := suite.Keeper.MintDerivative(suite.Ctx, delegator, valAddr1, suite.NewBondCoin(delegateAmount)) + _, err = suite.Keeper.MintDerivative(suite.Ctx, delegator, valAddr1, suite.NewBondCoin(delegateAmount)) suite.Require().NoError(err) - validator, found := suite.StakingKeeper.GetValidator(suite.Ctx, valAddr1) - suite.Require().True(found) + validator, err := suite.StakingKeeper.GetValidator(suite.Ctx, valAddr1) + suite.Require().NoError(err) suite.Ctx = suite.Ctx.WithBlockHeight(2) @@ -51,12 +51,14 @@ func (suite *KeeperTestSuite) TestCollectStakingRewards() { rewardCoins := sdk.NewDecCoins(sdk.NewDecCoin("ukava", sdkmath.NewInt(500e6))) distrKeeper.AllocateTokensToValidator(suite.Ctx, validator, rewardCoins) - delegation, found := stakingKeeper.GetDelegation(suite.Ctx, liquidMacc.GetAddress(), valAddr1) - suite.Require().True(found) + delegation, err := stakingKeeper.GetDelegation(suite.Ctx, liquidMacc.GetAddress(), valAddr1) + suite.Require().NoError(err) // Get amount of rewards - endingPeriod := distrKeeper.IncrementValidatorPeriod(suite.Ctx, validator) - delegationRewards := distrKeeper.CalculateDelegationRewards(suite.Ctx, validator, delegation, endingPeriod) + endingPeriod, err := distrKeeper.IncrementValidatorPeriod(suite.Ctx, validator) + suite.Require().NoError(err) + delegationRewards, err := distrKeeper.CalculateDelegationRewards(suite.Ctx, validator, delegation, endingPeriod) + suite.Require().NoError(err) truncatedRewards, _ := delegationRewards.TruncateDecimal() suite.Run("collect staking rewards", func() { @@ -77,7 +79,8 @@ func (suite *KeeperTestSuite) TestCollectStakingRewards() { derivativeDenom := suite.Keeper.GetLiquidStakingTokenDenom(sdk.ValAddress(addrs[2])) _, err := suite.Keeper.CollectStakingRewardsByDenom(suite.Ctx, derivativeDenom, types.ModuleName) suite.Require().Error(err) - suite.Require().Equal("no validator distribution info", err.Error()) + // NOTE(boodyvo): the error was changed in cosmos-sdk + suite.Require().Equal("validator does not exist", err.Error()) }) suite.Run("collect staking rewards with invalid denom", func() { diff --git a/x/liquid/keeper/derivative.go b/x/liquid/keeper/derivative.go index 1a752e32c1..4ae8489406 100644 --- a/x/liquid/keeper/derivative.go +++ b/x/liquid/keeper/derivative.go @@ -15,7 +15,11 @@ import ( // The input staking token amount is used to calculate shares in the user's delegation, which are transferred to a delegation owned by the module. // Derivative coins are them minted and transferred to the user. func (k Keeper) MintDerivative(ctx sdk.Context, delegatorAddr sdk.AccAddress, valAddr sdk.ValAddress, amount sdk.Coin) (sdk.Coin, error) { - bondDenom := k.stakingKeeper.BondDenom(ctx) + bondDenom, err := k.stakingKeeper.BondDenom(ctx) + if err != nil { + return sdk.Coin{}, err + } + if amount.Denom != bondDenom { return sdk.Coin{}, errorsmod.Wrapf(types.ErrInvalidDenom, "expected %s", bondDenom) } @@ -53,13 +57,13 @@ func (k Keeper) MintDerivative(ctx sdk.Context, delegatorAddr sdk.AccAddress, va // CalculateDerivativeSharesFromTokens converts a staking token amount into its equivalent delegation shares, and staking derivative amount. // This combines the code for calculating the shares to be transferred, and the derivative coins to be minted. -func (k Keeper) CalculateDerivativeSharesFromTokens(ctx sdk.Context, delegator sdk.AccAddress, validator sdk.ValAddress, tokens sdkmath.Int) (sdkmath.Int, sdk.Dec, error) { +func (k Keeper) CalculateDerivativeSharesFromTokens(ctx sdk.Context, delegator sdk.AccAddress, validator sdk.ValAddress, tokens sdkmath.Int) (sdkmath.Int, sdkmath.LegacyDec, error) { if !tokens.IsPositive() { - return sdkmath.Int{}, sdk.Dec{}, errorsmod.Wrap(types.ErrUntransferableShares, "token amount must be positive") + return sdkmath.Int{}, sdkmath.LegacyDec{}, errorsmod.Wrap(types.ErrUntransferableShares, "token amount must be positive") } shares, err := k.stakingKeeper.ValidateUnbondAmount(ctx, delegator, validator, tokens) if err != nil { - return sdkmath.Int{}, sdk.Dec{}, err + return sdkmath.Int{}, sdkmath.LegacyDec{}, err } return shares.TruncateInt(), shares, nil } @@ -67,21 +71,21 @@ func (k Keeper) CalculateDerivativeSharesFromTokens(ctx sdk.Context, delegator s // BurnDerivative burns an user's staking derivative coins and returns them an equivalent staking delegation. // // The derivative coins are burned, and an equivalent number of shares in the module's staking delegation are transferred back to the user. -func (k Keeper) BurnDerivative(ctx sdk.Context, delegatorAddr sdk.AccAddress, valAddr sdk.ValAddress, amount sdk.Coin) (sdk.Dec, error) { +func (k Keeper) BurnDerivative(ctx sdk.Context, delegatorAddr sdk.AccAddress, valAddr sdk.ValAddress, amount sdk.Coin) (sdkmath.LegacyDec, error) { if amount.Denom != k.GetLiquidStakingTokenDenom(valAddr) { - return sdk.Dec{}, errorsmod.Wrap(types.ErrInvalidDenom, "derivative denom does not match validator") + return sdkmath.LegacyDec{}, errorsmod.Wrap(types.ErrInvalidDenom, "derivative denom does not match validator") } if err := k.burnCoins(ctx, delegatorAddr, sdk.NewCoins(amount)); err != nil { - return sdk.Dec{}, err + return sdkmath.LegacyDec{}, err } modAcc := k.accountKeeper.GetModuleAccount(ctx, types.ModuleAccountName) - shares := sdk.NewDecFromInt(amount.Amount) + shares := sdkmath.LegacyNewDecFromInt(amount.Amount) receivedShares, err := k.TransferDelegation(ctx, valAddr, modAcc.GetAddress(), delegatorAddr, shares) if err != nil { - return sdk.Dec{}, err + return sdkmath.LegacyDec{}, err } ctx.EventManager().EmitEvent( @@ -108,14 +112,19 @@ func (k Keeper) IsDerivativeDenom(ctx sdk.Context, denom string) bool { return false } - _, found := k.stakingKeeper.GetValidator(ctx, valAddr) - return found + _, err = k.stakingKeeper.GetValidator(ctx, valAddr) + if err != nil { + return false + } + + // TODO(boodyvo): should we return error as well? + return true } // GetStakedTokensForDerivatives returns the total value of the provided derivatives // in staked tokens, accounting for the specific share prices. func (k Keeper) GetStakedTokensForDerivatives(ctx sdk.Context, coins sdk.Coins) (sdk.Coin, error) { - total := sdk.ZeroInt() + total := sdkmath.ZeroInt() for _, coin := range coins { valAddr, err := types.ParseLiquidStakingTokenDenom(coin.Denom) @@ -123,17 +132,23 @@ func (k Keeper) GetStakedTokensForDerivatives(ctx sdk.Context, coins sdk.Coins) return sdk.Coin{}, fmt.Errorf("invalid derivative denom: %w", err) } - validator, found := k.stakingKeeper.GetValidator(ctx, valAddr) - if !found { + validator, err := k.stakingKeeper.GetValidator(ctx, valAddr) + if err != nil { return sdk.Coin{}, fmt.Errorf("invalid derivative denom %s: validator not found", coin.Denom) } // bkava is 1:1 to delegation shares - valTokens := validator.TokensFromSharesTruncated(sdk.NewDecFromInt(coin.Amount)) + valTokens := validator.TokensFromSharesTruncated(sdkmath.LegacyNewDecFromInt(coin.Amount)) total = total.Add(valTokens.TruncateInt()) } - totalCoin := sdk.NewCoin(k.stakingKeeper.BondDenom(ctx), total) + bondDenom, err := k.stakingKeeper.BondDenom(ctx) + if err != nil { + return sdk.Coin{}, err + } + + totalCoin := sdk.NewCoin(bondDenom, total) + return totalCoin, nil } @@ -181,7 +196,11 @@ func (k Keeper) burnCoins(ctx sdk.Context, sender sdk.AccAddress, amount sdk.Coi // DerivativeFromTokens calculates the approximate amount of derivative coins that would be minted for a given amount of staking tokens. func (k Keeper) DerivativeFromTokens(ctx sdk.Context, valAddr sdk.ValAddress, tokens sdk.Coin) (sdk.Coin, error) { - bondDenom := k.stakingKeeper.BondDenom(ctx) + bondDenom, err := k.stakingKeeper.BondDenom(ctx) + if err != nil { + return sdk.Coin{}, err + } + if tokens.Denom != bondDenom { return sdk.Coin{}, errorsmod.Wrapf(types.ErrInvalidDenom, "'%s' does not match staking denom '%s'", tokens.Denom, bondDenom) } diff --git a/x/liquid/keeper/derivative_test.go b/x/liquid/keeper/derivative_test.go index adaf74dfce..17f8656c18 100644 --- a/x/liquid/keeper/derivative_test.go +++ b/x/liquid/keeper/derivative_test.go @@ -7,7 +7,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - "github.com/cosmos/cosmos-sdk/x/staking" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/kava-labs/kava/app" @@ -82,10 +81,11 @@ func (suite *KeeperTestSuite) TestBurnDerivative() { moduleAccAddress := authtypes.NewModuleAddress(types.ModuleAccountName) suite.CreateNewUnbondedValidator(valAddr, i(1e6)) suite.CreateDelegation(valAddr, moduleAccAddress, tc.moduleDelegation) - staking.EndBlocker(suite.Ctx, suite.StakingKeeper) + _, err := suite.StakingKeeper.EndBlocker(suite.Ctx) + suite.Require().NoError(err) modBalance := suite.BankKeeper.GetAllBalances(suite.Ctx, moduleAccAddress) - _, err := suite.Keeper.BurnDerivative(suite.Ctx, user, valAddr, tc.burnAmount) + _, err = suite.Keeper.BurnDerivative(suite.Ctx, user, valAddr, tc.burnAmount) suite.Require().ErrorIs(err, tc.expectedErr) if tc.expectedErr != nil { @@ -96,9 +96,9 @@ func (suite *KeeperTestSuite) TestBurnDerivative() { suite.AccountBalanceEqual(user, sdk.NewCoins(tc.balance.Sub(tc.burnAmount))) suite.AccountBalanceEqual(moduleAccAddress, modBalance) // ensure derivatives are burned, and not in module account - sharesTransferred := sdk.NewDecFromInt(tc.burnAmount.Amount) + sharesTransferred := sdkmath.LegacyNewDecFromInt(tc.burnAmount.Amount) suite.DelegationSharesEqual(valAddr, user, sharesTransferred) - suite.DelegationSharesEqual(valAddr, moduleAccAddress, sdk.NewDecFromInt(tc.moduleDelegation).Sub(sharesTransferred)) + suite.DelegationSharesEqual(valAddr, moduleAccAddress, sdkmath.LegacyNewDecFromInt(tc.moduleDelegation).Sub(sharesTransferred)) suite.EventsContains(suite.Ctx.EventManager().Events(), sdk.NewEvent( types.EventTypeBurnDerivative, @@ -118,17 +118,17 @@ func (suite *KeeperTestSuite) TestCalculateShares() { type returns struct { derivatives sdkmath.Int - shares sdk.Dec + shares sdkmath.LegacyDec err error } type validator struct { tokens sdkmath.Int - delegatorShares sdk.Dec + delegatorShares sdkmath.LegacyDec } testCases := []struct { name string validator *validator - delegation sdk.Dec + delegation sdkmath.LegacyDec transfer sdkmath.Int expected returns }{ @@ -144,7 +144,7 @@ func (suite *KeeperTestSuite) TestCalculateShares() { { name: "error when delegation not found", validator: &validator{i(1e9), d("1000000000")}, - delegation: sdk.Dec{}, + delegation: sdkmath.LegacyDec{}, transfer: i(500e6), expected: returns{ err: stakingtypes.ErrNoDelegation, @@ -251,8 +251,8 @@ func (suite *KeeperTestSuite) TestMintDerivative() { name string amount sdk.Coin expectedDerivatives sdkmath.Int - expectedSharesRemaining sdk.Dec - expectedSharesAdded sdk.Dec + expectedSharesRemaining sdkmath.LegacyDec + expectedSharesAdded sdkmath.LegacyDec expectedErr error }{ { @@ -288,9 +288,10 @@ func (suite *KeeperTestSuite) TestMintDerivative() { suite.CreateNewUnbondedValidator(valAddr, initialBalance) suite.CreateDelegation(valAddr, delegator, initialBalance) - staking.EndBlocker(suite.Ctx, suite.StakingKeeper) + _, err := suite.StakingKeeper.EndBlocker(suite.Ctx) + suite.Require().NoError(err) - _, err := suite.Keeper.MintDerivative(suite.Ctx, delegator, valAddr, tc.amount) + _, err = suite.Keeper.MintDerivative(suite.Ctx, delegator, valAddr, tc.amount) suite.Require().ErrorIs(err, tc.expectedErr) if tc.expectedErr != nil { @@ -304,7 +305,7 @@ func (suite *KeeperTestSuite) TestMintDerivative() { suite.DelegationSharesEqual(valAddr, delegator, tc.expectedSharesRemaining) suite.DelegationSharesEqual(valAddr, moduleAccAddress, tc.expectedSharesAdded) - sharesTransferred := sdk.NewDecFromInt(initialBalance).Sub(tc.expectedSharesRemaining) + sharesTransferred := sdkmath.LegacyNewDecFromInt(initialBalance).Sub(tc.expectedSharesRemaining) suite.EventsContains(suite.Ctx.EventManager().Events(), sdk.NewEvent( types.EventTypeMintDerivative, sdk.NewAttribute(types.AttributeKeyDelegator, delegator.String()), @@ -332,7 +333,8 @@ func (suite *KeeperTestSuite) TestIsDerivativeDenom() { suite.CreateNewUnbondedValidator(valAddr1, initialBalance) suite.CreateDelegation(valAddr1, delegator, initialBalance) - staking.EndBlocker(suite.Ctx, suite.StakingKeeper) + _, err := suite.StakingKeeper.EndBlocker(suite.Ctx) + suite.Require().NoError(err) testCases := []struct { name string @@ -404,11 +406,12 @@ func (suite *KeeperTestSuite) TestGetStakedTokensForDerivatives() { suite.CreateNewUnbondedValidator(valAddr3, initialBalance) suite.CreateDelegation(valAddr3, delegator, delegateAmount) - staking.EndBlocker(suite.Ctx, suite.StakingKeeper) + _, err := suite.StakingKeeper.EndBlocker(suite.Ctx) + suite.Require().NoError(err) suite.SlashValidator(valAddr3, d("0.05")) - _, err := suite.Keeper.MintDerivative(suite.Ctx, delegator, valAddr1, suite.NewBondCoin(delegateAmount)) + _, err = suite.Keeper.MintDerivative(suite.Ctx, delegator, valAddr1, suite.NewBondCoin(delegateAmount)) suite.Require().NoError(err) testCases := []struct { @@ -492,9 +495,10 @@ func (suite *KeeperTestSuite) TestGetDerivativeValue() { suite.CreateNewUnbondedValidator(valAddr2, initialBalance) suite.CreateDelegation(valAddr2, delegator, delegateAmount) - staking.EndBlocker(suite.Ctx, suite.StakingKeeper) + _, err := suite.StakingKeeper.EndBlocker(suite.Ctx) + suite.Require().NoError(err) - _, err := suite.Keeper.MintDerivative(suite.Ctx, delegator, valAddr1, suite.NewBondCoin(delegateAmount)) + _, err = suite.Keeper.MintDerivative(suite.Ctx, delegator, valAddr1, suite.NewBondCoin(delegateAmount)) suite.Require().NoError(err) _, err = suite.Keeper.MintDerivative(suite.Ctx, delegator, valAddr2, suite.NewBondCoin(delegateAmount)) @@ -539,9 +543,10 @@ func (suite *KeeperTestSuite) TestDerivativeFromTokens() { suite.CreateNewUnbondedValidator(valAddr, initialBalance) suite.CreateDelegation(valAddr, moduleAccAddress, initialBalance) - staking.EndBlocker(suite.Ctx, suite.StakingKeeper) + _, err := suite.StakingKeeper.EndBlocker(suite.Ctx) + suite.Require().NoError(err) - _, err := suite.Keeper.DerivativeFromTokens(suite.Ctx, valAddr, sdk.NewCoin("invalid", initialBalance)) + _, err = suite.Keeper.DerivativeFromTokens(suite.Ctx, valAddr, sdk.NewCoin("invalid", initialBalance)) suite.ErrorIs(err, types.ErrInvalidDenom) derivatives, err := suite.Keeper.DerivativeFromTokens(suite.Ctx, valAddr, suite.NewBondCoin(initialBalance)) diff --git a/x/liquid/keeper/grpc_query.go b/x/liquid/keeper/grpc_query.go index 3be393b41b..2e533c21c6 100644 --- a/x/liquid/keeper/grpc_query.go +++ b/x/liquid/keeper/grpc_query.go @@ -38,10 +38,14 @@ func (s queryServer) DelegatedBalance( delegated := s.getDelegatedBalance(ctx, delegator) - bondDenom := s.keeper.stakingKeeper.BondDenom(ctx) + bondDenom, err := s.keeper.stakingKeeper.BondDenom(ctx) + if err != nil { + return nil, err + } + vesting := s.getVesting(ctx, delegator).AmountOf(bondDenom) - vestingDelegated := sdk.MinInt(vesting, delegated) + vestingDelegated := sdkmath.MinInt(vesting, delegated) vestedDelegated := delegated.Sub(vestingDelegated) res := types.QueryDelegatedBalanceResponse{ @@ -69,11 +73,17 @@ func (s queryServer) TotalSupply( } func (s queryServer) getDelegatedBalance(ctx sdk.Context, delegator sdk.AccAddress) sdkmath.Int { - balance := sdk.ZeroDec() + balance := sdkmath.LegacyZeroDec() s.keeper.stakingKeeper.IterateDelegatorDelegations(ctx, delegator, func(delegation stakingtypes.Delegation) bool { - validator, found := s.keeper.stakingKeeper.GetValidator(ctx, delegation.GetValidatorAddr()) - if !found { + valAddr, err := s.keeper.stakingKeeper.ValidatorAddressCodec().StringToBytes(delegation.GetValidatorAddr()) + if err != nil { + panic(err) + } + + validator, err := s.keeper.stakingKeeper.GetValidator(ctx, valAddr) + + if err != nil { panic(fmt.Sprintf("validator %s for delegation not found", delegation.GetValidatorAddr())) } tokens := validator.TokensFromSharesTruncated(delegation.GetShares()) diff --git a/x/liquid/keeper/grpc_query_test.go b/x/liquid/keeper/grpc_query_test.go index 5c0b414235..85949de955 100644 --- a/x/liquid/keeper/grpc_query_test.go +++ b/x/liquid/keeper/grpc_query_test.go @@ -7,7 +7,6 @@ import ( sdkmath "cosmossdk.io/math" "github.com/cosmos/cosmos-sdk/baseapp" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/staking" "github.com/stretchr/testify/suite" "github.com/kava-labs/kava/app" @@ -36,8 +35,8 @@ func TestGrpcQueryTestSuite(t *testing.T) { func (suite *grpcQueryTestSuite) TestQueryDelegatedBalance() { zeroResponse := &types.QueryDelegatedBalanceResponse{ - Vested: suite.NewBondCoin(sdk.ZeroInt()), - Vesting: suite.NewBondCoin(sdk.ZeroInt()), + Vested: suite.NewBondCoin(sdkmath.ZeroInt()), + Vesting: suite.NewBondCoin(sdkmath.ZeroInt()), } testCases := []struct { @@ -59,12 +58,13 @@ func (suite *grpcQueryTestSuite) TestQueryDelegatedBalance() { suite.CreateNewUnbondedValidator(sdk.ValAddress(valAddr), initBalance.Amount) suite.CreateDelegation(sdk.ValAddress(valAddr), delAddr, initBalance.Amount.QuoRaw(4)) - staking.EndBlocker(suite.Ctx, suite.StakingKeeper) // bond the validator + _, err := suite.StakingKeeper.EndBlocker(suite.Ctx) + suite.Require().NoError(err) // bond the validator return delAddr.String() }, expectedRes: &types.QueryDelegatedBalanceResponse{ - Vested: suite.NewBondCoin(sdk.ZeroInt()), + Vested: suite.NewBondCoin(sdkmath.ZeroInt()), Vesting: suite.NewBondCoin(i(250e6)), }, }, @@ -82,7 +82,8 @@ func (suite *grpcQueryTestSuite) TestQueryDelegatedBalance() { suite.CreateNewUnbondedValidator(sdk.ValAddress(valAddr), initBalance.Amount) threeQuarters := initBalance.Amount.QuoRaw(4).MulRaw(3) suite.CreateDelegation(sdk.ValAddress(valAddr), delAddr, threeQuarters) - staking.EndBlocker(suite.Ctx, suite.StakingKeeper) // bond the validator + _, err := suite.StakingKeeper.EndBlocker(suite.Ctx) + suite.Require().NoError(err) // bond the validator return delAddr.String() }, @@ -124,7 +125,7 @@ func (suite *grpcQueryTestSuite) TestQueryDelegatedBalance() { }, expectedRes: &types.QueryDelegatedBalanceResponse{ Vested: suite.NewBondCoin(i(1e9)), - Vesting: suite.NewBondCoin(sdk.ZeroInt()), + Vesting: suite.NewBondCoin(sdkmath.ZeroInt()), }, }, { @@ -136,7 +137,8 @@ func (suite *grpcQueryTestSuite) TestQueryDelegatedBalance() { suite.CreateNewUnbondedValidator(valAcc.GetAddress().Bytes(), initBalance.Amount) suite.CreateDelegation(valAcc.GetAddress().Bytes(), delAcc.GetAddress(), initBalance.Amount) - staking.EndBlocker(suite.Ctx, suite.StakingKeeper) // bond the validator + _, err := suite.StakingKeeper.EndBlocker(suite.Ctx) + suite.Require().NoError(err) // bond the validator suite.CreateUnbondingDelegation(delAcc.GetAddress(), valAcc.GetAddress().Bytes(), initBalance.Amount.QuoRaw(2)) @@ -144,7 +146,7 @@ func (suite *grpcQueryTestSuite) TestQueryDelegatedBalance() { }, expectedRes: &types.QueryDelegatedBalanceResponse{ Vested: suite.NewBondCoin(i(500e6)), - Vesting: suite.NewBondCoin(sdk.ZeroInt()), + Vesting: suite.NewBondCoin(sdkmath.ZeroInt()), }, }, } @@ -178,7 +180,7 @@ func (suite *grpcQueryTestSuite) TestQueryTotalSupply() { { name: "no liquid kava means no tvl", setup: func() {}, - expectedTotal: sdk.ZeroInt(), + expectedTotal: sdkmath.ZeroInt(), expectedErr: nil, }, { @@ -190,9 +192,10 @@ func (suite *grpcQueryTestSuite) TestQueryTotalSupply() { suite.CreateNewUnbondedValidator(valAcc.GetAddress().Bytes(), initBalance.Amount) suite.CreateDelegation(valAcc.GetAddress().Bytes(), delAcc.GetAddress(), initBalance.Amount) - staking.EndBlocker(suite.Ctx, suite.StakingKeeper) // bond the validator + _, err := suite.StakingKeeper.EndBlocker(suite.Ctx) + suite.Require().NoError(err) // bond the validator - _, err := suite.Keeper.MintDerivative( + _, err = suite.Keeper.MintDerivative( suite.Ctx, delAcc.GetAddress(), valAcc.GetAddress().Bytes(), @@ -215,9 +218,10 @@ func (suite *grpcQueryTestSuite) TestQueryTotalSupply() { suite.CreateDelegation(val1Acc.GetAddress().Bytes(), delAcc.GetAddress(), initBalance.Amount) suite.CreateNewUnbondedValidator(val2Acc.GetAddress().Bytes(), initBalance.Amount) suite.CreateDelegation(val2Acc.GetAddress().Bytes(), delAcc.GetAddress(), initBalance.Amount) - staking.EndBlocker(suite.Ctx, suite.StakingKeeper) // bond the validator + _, err := suite.StakingKeeper.EndBlocker(suite.Ctx) + suite.Require().NoError(err) // bond the validator - _, err := suite.Keeper.MintDerivative(suite.Ctx, delAcc.GetAddress(), val1Acc.GetAddress().Bytes(), initBalance) + _, err = suite.Keeper.MintDerivative(suite.Ctx, delAcc.GetAddress(), val1Acc.GetAddress().Bytes(), initBalance) suite.Require().NoError(err) _, err = suite.Keeper.MintDerivative(suite.Ctx, delAcc.GetAddress(), val2Acc.GetAddress().Bytes(), initBalance) suite.Require().NoError(err) @@ -236,9 +240,10 @@ func (suite *grpcQueryTestSuite) TestQueryTotalSupply() { suite.CreateNewUnbondedValidator(valAcc.GetAddress().Bytes(), initBalance.Amount) suite.CreateDelegation(valAcc.GetAddress().Bytes(), del1Acc.GetAddress(), initBalance.Amount) suite.CreateDelegation(valAcc.GetAddress().Bytes(), del2Acc.GetAddress(), initBalance.Amount) - staking.EndBlocker(suite.Ctx, suite.StakingKeeper) // bond the validator + _, err := suite.StakingKeeper.EndBlocker(suite.Ctx) + suite.Require().NoError(err) // bond the validator - _, err := suite.Keeper.MintDerivative(suite.Ctx, del1Acc.GetAddress(), valAcc.GetAddress().Bytes(), initBalance) + _, err = suite.Keeper.MintDerivative(suite.Ctx, del1Acc.GetAddress(), valAcc.GetAddress().Bytes(), initBalance) suite.Require().NoError(err) _, err = suite.Keeper.MintDerivative(suite.Ctx, del2Acc.GetAddress(), valAcc.GetAddress().Bytes(), initBalance) suite.Require().NoError(err) @@ -258,9 +263,10 @@ func (suite *grpcQueryTestSuite) TestQueryTotalSupply() { suite.CreateDelegation(val1Acc.GetAddress().Bytes(), delAcc.GetAddress(), initBalance.Amount) suite.CreateNewUnbondedValidator(val2Acc.GetAddress().Bytes(), initBalance.Amount) suite.CreateDelegation(val2Acc.GetAddress().Bytes(), delAcc.GetAddress(), initBalance.Amount) - staking.EndBlocker(suite.Ctx, suite.StakingKeeper) // bond the validator + _, err := suite.StakingKeeper.EndBlocker(suite.Ctx) + suite.Require().NoError(err) // bond the validator - _, err := suite.Keeper.MintDerivative(suite.Ctx, delAcc.GetAddress(), val1Acc.GetAddress().Bytes(), initBalance) + _, err = suite.Keeper.MintDerivative(suite.Ctx, delAcc.GetAddress(), val1Acc.GetAddress().Bytes(), initBalance) suite.Require().NoError(err) _, err = suite.Keeper.MintDerivative(suite.Ctx, delAcc.GetAddress(), val2Acc.GetAddress().Bytes(), initBalance) suite.Require().NoError(err) diff --git a/x/liquid/keeper/keeper.go b/x/liquid/keeper/keeper.go index ab16723958..3a35005624 100644 --- a/x/liquid/keeper/keeper.go +++ b/x/liquid/keeper/keeper.go @@ -3,7 +3,7 @@ package keeper import ( "fmt" - "github.com/cometbft/cometbft/libs/log" + "cosmossdk.io/log" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" diff --git a/x/liquid/keeper/keeper_test.go b/x/liquid/keeper/keeper_test.go index af60bf410d..d3eae60e72 100644 --- a/x/liquid/keeper/keeper_test.go +++ b/x/liquid/keeper/keeper_test.go @@ -35,7 +35,7 @@ type KeeperTestSuite struct { // The default state used by each test func (suite *KeeperTestSuite) SetupTest() { tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) tApp.InitializeFromGenesisStates() @@ -47,14 +47,14 @@ func (suite *KeeperTestSuite) SetupTest() { } // CreateAccount creates a new account (with a fixed address) from the provided balance. -func (suite *KeeperTestSuite) CreateAccount(initialBalance sdk.Coins, index int) authtypes.AccountI { +func (suite *KeeperTestSuite) CreateAccount(initialBalance sdk.Coins, index int) sdk.AccountI { _, addrs := app.GeneratePrivKeyAddressPairs(index + 1) return suite.CreateAccountWithAddress(addrs[index], initialBalance) } // CreateAccount creates a new account from the provided balance and address -func (suite *KeeperTestSuite) CreateAccountWithAddress(addr sdk.AccAddress, initialBalance sdk.Coins) authtypes.AccountI { +func (suite *KeeperTestSuite) CreateAccountWithAddress(addr sdk.AccAddress, initialBalance sdk.Coins) sdk.AccountI { ak := suite.App.GetAccountKeeper() acc := ak.NewAccountWithAddress(suite.Ctx, addr) @@ -67,7 +67,7 @@ func (suite *KeeperTestSuite) CreateAccountWithAddress(addr sdk.AccAddress, init } // CreateVestingAccount creates a new vesting account. `vestingBalance` should be a fraction of `initialBalance`. -func (suite *KeeperTestSuite) CreateVestingAccountWithAddress(addr sdk.AccAddress, initialBalance sdk.Coins, vestingBalance sdk.Coins) authtypes.AccountI { +func (suite *KeeperTestSuite) CreateVestingAccountWithAddress(addr sdk.AccAddress, initialBalance sdk.Coins, vestingBalance sdk.Coins) sdk.AccountI { if vestingBalance.IsAnyGT(initialBalance) { panic("vesting balance must be less than initial balance") } @@ -80,7 +80,8 @@ func (suite *KeeperTestSuite) CreateVestingAccountWithAddress(addr sdk.AccAddres Amount: vestingBalance, }, } - vacc := vestingtypes.NewPeriodicVestingAccount(bacc, vestingBalance, suite.Ctx.BlockTime().Unix(), periods) + vacc, err := vestingtypes.NewPeriodicVestingAccount(bacc, vestingBalance, suite.Ctx.BlockTime().Unix(), periods) + suite.Require().NoError(err) suite.App.GetAccountKeeper().SetAccount(suite.Ctx, vacc) return vacc } @@ -94,16 +95,16 @@ func (suite *KeeperTestSuite) AddCoinsToModule(module string, amount sdk.Coins) // AccountBalanceEqual checks if an account has the specified coins. func (suite *KeeperTestSuite) AccountBalanceEqual(addr sdk.AccAddress, coins sdk.Coins) { balance := suite.BankKeeper.GetAllBalances(suite.Ctx, addr) - suite.Truef(coins.IsEqual(balance), "expected account balance to equal coins %s, but got %s", coins, balance) + suite.Truef(coins.Equal(balance), "expected account balance to equal coins %s, but got %s", coins, balance) } func (suite *KeeperTestSuite) deliverMsgCreateValidator(ctx sdk.Context, address sdk.ValAddress, selfDelegation sdk.Coin) error { msg, err := stakingtypes.NewMsgCreateValidator( - address, + address.String(), ed25519.GenPrivKey().PubKey(), selfDelegation, - stakingtypes.Description{}, - stakingtypes.NewCommissionRates(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()), + stakingtypes.NewDescription("liquid_moniker", "", "", "", ""), + stakingtypes.NewCommissionRates(sdkmath.LegacyZeroDec(), sdkmath.LegacyZeroDec(), sdkmath.LegacyZeroDec()), sdkmath.NewInt(1e6), ) if err != nil { @@ -117,7 +118,9 @@ func (suite *KeeperTestSuite) deliverMsgCreateValidator(ctx sdk.Context, address // NewBondCoin creates a Coin with the current staking denom. func (suite *KeeperTestSuite) NewBondCoin(amount sdkmath.Int) sdk.Coin { - stakingDenom := suite.StakingKeeper.BondDenom(suite.Ctx) + stakingDenom, err := suite.StakingKeeper.BondDenom(suite.Ctx) + suite.Require().NoError(err) + return sdk.NewCoin(stakingDenom, amount) } @@ -135,15 +138,15 @@ func (suite *KeeperTestSuite) CreateNewUnbondedValidator(addr sdk.ValAddress, se // New validators are created in an unbonded state. Note if the end blocker is run later this validator could become bonded. - validator, found := suite.StakingKeeper.GetValidator(suite.Ctx, addr) - suite.Require().True(found) + validator, err := suite.StakingKeeper.GetValidator(suite.Ctx, addr) + suite.Require().NoError(err) return validator } // SlashValidator burns tokens staked in a validator. new_tokens = old_tokens * (1-slashFraction) -func (suite *KeeperTestSuite) SlashValidator(addr sdk.ValAddress, slashFraction sdk.Dec) { - validator, found := suite.StakingKeeper.GetValidator(suite.Ctx, addr) - suite.Require().True(found) +func (suite *KeeperTestSuite) SlashValidator(addr sdk.ValAddress, slashFraction sdkmath.LegacyDec) { + validator, err := suite.StakingKeeper.GetValidator(suite.Ctx, addr) + suite.Require().NoError(err) consAddr, err := validator.GetConsAddr() suite.Require().NoError(err) @@ -157,60 +160,63 @@ func (suite *KeeperTestSuite) SlashValidator(addr sdk.ValAddress, slashFraction } // CreateDelegation delegates tokens to a validator. -func (suite *KeeperTestSuite) CreateDelegation(valAddr sdk.ValAddress, delegator sdk.AccAddress, amount sdkmath.Int) sdk.Dec { - stakingDenom := suite.StakingKeeper.BondDenom(suite.Ctx) +func (suite *KeeperTestSuite) CreateDelegation(valAddr sdk.ValAddress, delegator sdk.AccAddress, amount sdkmath.Int) sdkmath.LegacyDec { + stakingDenom, err := suite.StakingKeeper.BondDenom(suite.Ctx) + suite.Require().NoError(err) msg := stakingtypes.NewMsgDelegate( - delegator, - valAddr, + delegator.String(), + valAddr.String(), sdk.NewCoin(stakingDenom, amount), ) msgServer := stakingkeeper.NewMsgServerImpl(suite.StakingKeeper) - _, err := msgServer.Delegate(sdk.WrapSDKContext(suite.Ctx), msg) + _, err = msgServer.Delegate(sdk.WrapSDKContext(suite.Ctx), msg) suite.Require().NoError(err) - del, found := suite.StakingKeeper.GetDelegation(suite.Ctx, delegator, valAddr) - suite.Require().True(found) + del, err := suite.StakingKeeper.GetDelegation(suite.Ctx, delegator, valAddr) + suite.Require().NoError(err) return del.Shares } // CreateRedelegation undelegates tokens from one validator and delegates to another. func (suite *KeeperTestSuite) CreateRedelegation(delegator sdk.AccAddress, fromValidator, toValidator sdk.ValAddress, amount sdkmath.Int) { - stakingDenom := suite.StakingKeeper.BondDenom(suite.Ctx) + stakingDenom, err := suite.StakingKeeper.BondDenom(suite.Ctx) + suite.Require().NoError(err) msg := stakingtypes.NewMsgBeginRedelegate( - delegator, - fromValidator, - toValidator, + delegator.String(), + fromValidator.String(), + toValidator.String(), sdk.NewCoin(stakingDenom, amount), ) msgServer := stakingkeeper.NewMsgServerImpl(suite.StakingKeeper) - _, err := msgServer.BeginRedelegate(sdk.WrapSDKContext(suite.Ctx), msg) + _, err = msgServer.BeginRedelegate(sdk.WrapSDKContext(suite.Ctx), msg) suite.Require().NoError(err) } // CreateUnbondingDelegation undelegates tokens from a validator. func (suite *KeeperTestSuite) CreateUnbondingDelegation(delegator sdk.AccAddress, validator sdk.ValAddress, amount sdkmath.Int) { - stakingDenom := suite.StakingKeeper.BondDenom(suite.Ctx) + stakingDenom, err := suite.StakingKeeper.BondDenom(suite.Ctx) + suite.Require().NoError(err) msg := stakingtypes.NewMsgUndelegate( - delegator, - validator, + delegator.String(), + validator.String(), sdk.NewCoin(stakingDenom, amount), ) msgServer := stakingkeeper.NewMsgServerImpl(suite.StakingKeeper) - _, err := msgServer.Undelegate(sdk.WrapSDKContext(suite.Ctx), msg) + _, err = msgServer.Undelegate(sdk.WrapSDKContext(suite.Ctx), msg) suite.Require().NoError(err) } // DelegationSharesEqual checks if a delegation has the specified shares. // It expects delegations with zero shares to not be stored in state. -func (suite *KeeperTestSuite) DelegationSharesEqual(valAddr sdk.ValAddress, delegator sdk.AccAddress, shares sdk.Dec) bool { - del, found := suite.StakingKeeper.GetDelegation(suite.Ctx, delegator, valAddr) +func (suite *KeeperTestSuite) DelegationSharesEqual(valAddr sdk.ValAddress, delegator sdk.AccAddress, shares sdkmath.LegacyDec) bool { + del, err := suite.StakingKeeper.GetDelegation(suite.Ctx, delegator, valAddr) if shares.IsZero() { - return suite.Falsef(found, "expected delegator to not be found, got %s shares", del.Shares) + return suite.Error(err, "expected delegator to not be found, got %s shares", del.Shares) } else { - res := suite.True(found, "expected delegator to be found") + res := suite.NoError(err, "expected delegator to be found") return res && suite.Truef(shares.Equal(del.Shares), "expected %s delegator shares but got %s", shares, del.Shares) } } diff --git a/x/liquid/keeper/staking.go b/x/liquid/keeper/staking.go index bd453a9748..3c845d9973 100644 --- a/x/liquid/keeper/staking.go +++ b/x/liquid/keeper/staking.go @@ -3,6 +3,7 @@ package keeper import ( errorsmod "cosmossdk.io/errors" sdkmath "cosmossdk.io/math" + "fmt" sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" @@ -15,64 +16,76 @@ import ( // The sending delegation must not have any active redelegations. // A validator cannot reduce self delegated shares below its min self delegation. // Attempting to transfer zero shares will error. -func (k Keeper) TransferDelegation(ctx sdk.Context, valAddr sdk.ValAddress, fromDelegator, toDelegator sdk.AccAddress, shares sdk.Dec) (sdk.Dec, error) { +func (k Keeper) TransferDelegation(ctx sdk.Context, valAddr sdk.ValAddress, fromDelegator, toDelegator sdk.AccAddress, shares sdkmath.LegacyDec) (sdkmath.LegacyDec, error) { + fmt.Println("TransferDelegation") // Redelegations link a delegation to it's previous validator so slashes are propagated to the new validator. // If the delegation is transferred to a new owner, the redelegation object must be updated. // For expediency all transfers with redelegations are blocked. - if k.stakingKeeper.HasReceivingRedelegation(ctx, fromDelegator, valAddr) { - return sdk.Dec{}, types.ErrRedelegationsNotCompleted + + hasReceivingRedelegation, err := k.stakingKeeper.HasReceivingRedelegation(ctx, fromDelegator, valAddr) + if err != nil { + return sdkmath.LegacyDec{}, err + } + if hasReceivingRedelegation { + return sdkmath.LegacyDec{}, types.ErrRedelegationsNotCompleted } - if shares.IsNil() || shares.LT(sdk.ZeroDec()) { - return sdk.Dec{}, errorsmod.Wrap(types.ErrUntransferableShares, "nil or negative shares") + if shares.IsNil() || shares.LT(sdkmath.LegacyZeroDec()) { + return sdkmath.LegacyDec{}, errorsmod.Wrap(types.ErrUntransferableShares, "nil or negative shares") } - if shares.Equal(sdk.ZeroDec()) { + if shares.Equal(sdkmath.LegacyZeroDec()) { // Block 0 transfers to reduce edge cases. - return sdk.Dec{}, errorsmod.Wrap(types.ErrUntransferableShares, "zero shares") + return sdkmath.LegacyDec{}, errorsmod.Wrap(types.ErrUntransferableShares, "zero shares") } - fromDelegation, found := k.stakingKeeper.GetDelegation(ctx, fromDelegator, valAddr) - if !found { - return sdk.Dec{}, types.ErrNoDelegatorForAddress + fromDelegation, err := k.stakingKeeper.GetDelegation(ctx, fromDelegator, valAddr) + if err != nil { + return sdkmath.LegacyDec{}, types.ErrNoDelegatorForAddress } - validator, found := k.stakingKeeper.GetValidator(ctx, valAddr) - if !found { - return sdk.Dec{}, types.ErrNoValidatorFound + validator, err := k.stakingKeeper.GetValidator(ctx, valAddr) + if err != nil { + return sdkmath.LegacyDec{}, types.ErrNoValidatorFound } // Prevent validators from reducing their self delegation below the min. isValidatorOperator := fromDelegator.Equals(valAddr) if isValidatorOperator { if isBelowMinSelfDelegation(validator, fromDelegation.Shares.Sub(shares)) { - return sdk.Dec{}, types.ErrSelfDelegationBelowMinimum + return sdkmath.LegacyDec{}, types.ErrSelfDelegationBelowMinimum } } returnAmount, err := k.fastUndelegate(ctx, valAddr, fromDelegator, shares) if err != nil { - return sdk.Dec{}, err + return sdkmath.LegacyDec{}, err + } + + bondDenom, err := k.stakingKeeper.BondDenom(ctx) + if err != nil { + return sdkmath.LegacyDec{}, err } - returnCoins := sdk.NewCoins(sdk.NewCoin(k.stakingKeeper.BondDenom(ctx), returnAmount)) + + returnCoins := sdk.NewCoins(sdk.NewCoin(bondDenom, returnAmount)) if err := k.bankKeeper.SendCoins(ctx, fromDelegator, toDelegator, returnCoins); err != nil { - return sdk.Dec{}, err + return sdkmath.LegacyDec{}, err } receivedShares, err := k.delegateFromAccount(ctx, valAddr, toDelegator, returnAmount) if err != nil { - return sdk.Dec{}, err + return sdkmath.LegacyDec{}, err } return receivedShares, nil } // isBelowMinSelfDelegation check if the supplied shares, converted to tokens, are under the validator's min_self_delegation. -func isBelowMinSelfDelegation(validator stakingtypes.ValidatorI, shares sdk.Dec) bool { +func isBelowMinSelfDelegation(validator stakingtypes.ValidatorI, shares sdkmath.LegacyDec) bool { return validator.TokensFromShares(shares).TruncateInt().LT(validator.GetMinSelfDelegation()) } // fastUndelegate undelegates shares from a validator skipping the unbonding period and not creating any unbonding delegations. -func (k Keeper) fastUndelegate(ctx sdk.Context, valAddr sdk.ValAddress, delegator sdk.AccAddress, shares sdk.Dec) (sdkmath.Int, error) { - validator, found := k.stakingKeeper.GetValidator(ctx, valAddr) - if !found { +func (k Keeper) fastUndelegate(ctx sdk.Context, valAddr sdk.ValAddress, delegator sdk.AccAddress, shares sdkmath.LegacyDec) (sdkmath.Int, error) { + validator, err := k.stakingKeeper.GetValidator(ctx, valAddr) + if err != nil { return sdkmath.Int{}, types.ErrNoDelegatorForAddress } @@ -80,7 +93,13 @@ func (k Keeper) fastUndelegate(ctx sdk.Context, valAddr sdk.ValAddress, delegato if err != nil { return sdkmath.Int{}, err } - returnCoins := sdk.NewCoins(sdk.NewCoin(k.stakingKeeper.BondDenom(ctx), returnAmount)) + + bondDenom, err := k.stakingKeeper.BondDenom(ctx) + if err != nil { + return sdkmath.Int{}, err + } + + returnCoins := sdk.NewCoins(sdk.NewCoin(bondDenom, returnAmount)) // transfer the validator tokens to the not bonded pool if validator.IsBonded() { @@ -96,15 +115,15 @@ func (k Keeper) fastUndelegate(ctx sdk.Context, valAddr sdk.ValAddress, delegato } // delegateFromAccount delegates to a validator from an account (vs redelegating from an existing delegation) -func (k Keeper) delegateFromAccount(ctx sdk.Context, valAddr sdk.ValAddress, delegator sdk.AccAddress, amount sdkmath.Int) (sdk.Dec, error) { - validator, found := k.stakingKeeper.GetValidator(ctx, valAddr) - if !found { - return sdk.Dec{}, types.ErrNoValidatorFound +func (k Keeper) delegateFromAccount(ctx sdk.Context, valAddr sdk.ValAddress, delegator sdk.AccAddress, amount sdkmath.Int) (sdkmath.LegacyDec, error) { + validator, err := k.stakingKeeper.GetValidator(ctx, valAddr) + if err != nil { + return sdkmath.LegacyDec{}, types.ErrNoValidatorFound } // source tokens are from an account, so subtractAccount true and tokenSrc unbonded newShares, err := k.stakingKeeper.Delegate(ctx, delegator, amount, stakingtypes.Unbonded, validator, true) if err != nil { - return sdk.Dec{}, err + return sdkmath.LegacyDec{}, err } return newShares, nil } diff --git a/x/liquid/keeper/staking_test.go b/x/liquid/keeper/staking_test.go index 430858ad8d..8ac1b2ac02 100644 --- a/x/liquid/keeper/staking_test.go +++ b/x/liquid/keeper/staking_test.go @@ -2,11 +2,11 @@ package keeper_test import ( sdkmath "cosmossdk.io/math" + "fmt" "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - "github.com/cosmos/cosmos-sdk/x/staking" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" @@ -15,8 +15,8 @@ import ( ) var ( - // d is an alias for sdk.MustNewDecFromStr - d = sdk.MustNewDecFromStr + // d is an alias for sdkmath.LegacyMustNewDecFromStr + d = sdkmath.LegacyMustNewDecFromStr // i is an alias for sdkmath.NewInt i = sdkmath.NewInt // c is an alias for sdk.NewInt64Coin @@ -35,23 +35,24 @@ func (suite *KeeperTestSuite) TestTransferDelegation_ValidatorStates() { testCases := []struct { name string - createValidator func() (delegatorShares sdk.Dec, err error) + createValidator func() (delegatorShares sdkmath.LegacyDec, err error) }{ { name: "bonded validator", - createValidator: func() (sdk.Dec, error) { + createValidator: func() (sdkmath.LegacyDec, error) { suite.CreateNewUnbondedValidator(valAddr, initialBalance) delegatorShares := suite.CreateDelegation(valAddr, fromDelegator, i(1e9)) // Run end blocker to update validator state to bonded. - staking.EndBlocker(suite.Ctx, suite.StakingKeeper) + _, err := suite.StakingKeeper.EndBlocker(suite.Ctx) + suite.Require().NoError(err) return delegatorShares, nil }, }, { name: "unbonded validator", - createValidator: func() (sdk.Dec, error) { + createValidator: func() (sdkmath.LegacyDec, error) { suite.CreateNewUnbondedValidator(valAddr, initialBalance) delegatorShares := suite.CreateDelegation(valAddr, fromDelegator, i(1e9)) @@ -61,20 +62,22 @@ func (suite *KeeperTestSuite) TestTransferDelegation_ValidatorStates() { }, { name: "ubonding (jailed) validator", - createValidator: func() (sdk.Dec, error) { + createValidator: func() (sdkmath.LegacyDec, error) { val := suite.CreateNewUnbondedValidator(valAddr, initialBalance) delegatorShares := suite.CreateDelegation(valAddr, fromDelegator, i(1e9)) // Run end blocker to update validator state to bonded. - staking.EndBlocker(suite.Ctx, suite.StakingKeeper) + _, err := suite.StakingKeeper.EndBlocker(suite.Ctx) + suite.Require().NoError(err) // Jail and run end blocker to transition validator to unbonding. consAddr, err := val.GetConsAddr() if err != nil { - return sdk.Dec{}, err + return sdkmath.LegacyDec{}, err } suite.StakingKeeper.Jail(suite.Ctx, consAddr) - staking.EndBlocker(suite.Ctx, suite.StakingKeeper) + _, err = suite.StakingKeeper.EndBlocker(suite.Ctx) + suite.Require().NoError(err) return delegatorShares, nil }, @@ -91,10 +94,12 @@ func (suite *KeeperTestSuite) TestTransferDelegation_ValidatorStates() { fromDelegationShares, err := tc.createValidator() suite.Require().NoError(err) - validator, found := suite.StakingKeeper.GetValidator(suite.Ctx, valAddr) - suite.Require().True(found) + validator, err := suite.StakingKeeper.GetValidator(suite.Ctx, valAddr) + suite.Require().NoError(err) notBondedBalance := suite.BankKeeper.GetAllBalances(suite.Ctx, notBondedModAddr) + fmt.Println("notBondedBalance", notBondedBalance) bondedBalance := suite.BankKeeper.GetAllBalances(suite.Ctx, bondedModAddr) + fmt.Println("bondedBalance", bondedBalance) shares := d("1000") @@ -106,8 +111,8 @@ func (suite *KeeperTestSuite) TestTransferDelegation_ValidatorStates() { suite.DelegationSharesEqual(valAddr, fromDelegator, fromDelegationShares.Sub(shares)) suite.DelegationSharesEqual(valAddr, toDelegator, shares) // also creates new delegation - validatorAfter, found := suite.StakingKeeper.GetValidator(suite.Ctx, valAddr) - suite.Require().True(found) + validatorAfter, err := suite.StakingKeeper.GetValidator(suite.Ctx, valAddr) + suite.Require().NoError(err) suite.Equal(validator.GetTokens(), validatorAfter.GetTokens()) suite.Equal(validator.GetDelegatorShares(), validatorAfter.GetDelegatorShares()) suite.Equal(validator.GetStatus(), validatorAfter.GetStatus()) @@ -127,56 +132,60 @@ func (suite *KeeperTestSuite) TestTransferDelegation_Shares() { testCases := []struct { name string - createDelegations func() (fromDelegatorShares, toDelegatorShares sdk.Dec, err error) - shares sdk.Dec - expectReceived sdk.Dec + createDelegations func() (fromDelegatorShares, toDelegatorShares sdkmath.LegacyDec, err error) + shares sdkmath.LegacyDec + expectReceived sdkmath.LegacyDec expectedErr error }{ { name: "negative shares cannot be transferred", - createDelegations: func() (sdk.Dec, sdk.Dec, error) { + createDelegations: func() (sdkmath.LegacyDec, sdkmath.LegacyDec, error) { suite.CreateNewUnbondedValidator(valAddr, i(1e9)) fromDelegationShares := suite.CreateDelegation(valAddr, fromDelegator, i(1e9)) // Run end blocker to update validator state to bonded. - staking.EndBlocker(suite.Ctx, suite.StakingKeeper) + _, err := suite.StakingKeeper.EndBlocker(suite.Ctx) + suite.Require().NoError(err) - return fromDelegationShares, sdk.ZeroDec(), nil + return fromDelegationShares, sdkmath.LegacyZeroDec(), nil }, shares: d("-1.0"), expectedErr: types.ErrUntransferableShares, }, { name: "nil shares cannot be transferred", - createDelegations: func() (sdk.Dec, sdk.Dec, error) { + createDelegations: func() (sdkmath.LegacyDec, sdkmath.LegacyDec, error) { suite.CreateNewUnbondedValidator(valAddr, i(1e9)) fromDelegationShares := suite.CreateDelegation(valAddr, fromDelegator, i(1e9)) - staking.EndBlocker(suite.Ctx, suite.StakingKeeper) + _, err := suite.StakingKeeper.EndBlocker(suite.Ctx) + suite.Require().NoError(err) - return fromDelegationShares, sdk.ZeroDec(), nil + return fromDelegationShares, sdkmath.LegacyZeroDec(), nil }, - shares: sdk.Dec{}, + shares: sdkmath.LegacyDec{}, expectedErr: types.ErrUntransferableShares, }, { name: "0 shares cannot be transferred", - createDelegations: func() (sdk.Dec, sdk.Dec, error) { + createDelegations: func() (sdkmath.LegacyDec, sdkmath.LegacyDec, error) { suite.CreateNewUnbondedValidator(valAddr, i(1e9)) fromDelegationShares := suite.CreateDelegation(valAddr, fromDelegator, i(1e9)) toDelegationShares := suite.CreateDelegation(valAddr, toDelegator, i(2e9)) - staking.EndBlocker(suite.Ctx, suite.StakingKeeper) + _, err := suite.StakingKeeper.EndBlocker(suite.Ctx) + suite.Require().NoError(err) return fromDelegationShares, toDelegationShares, nil }, - shares: sdk.ZeroDec(), + shares: sdkmath.LegacyZeroDec(), expectedErr: types.ErrUntransferableShares, }, { name: "all shares can be transferred", - createDelegations: func() (sdk.Dec, sdk.Dec, error) { + createDelegations: func() (sdkmath.LegacyDec, sdkmath.LegacyDec, error) { suite.CreateNewUnbondedValidator(valAddr, i(1e9)) fromDelegationShares := suite.CreateDelegation(valAddr, fromDelegator, i(1e9)) toDelegationShares := suite.CreateDelegation(valAddr, toDelegator, i(2e9)) - staking.EndBlocker(suite.Ctx, suite.StakingKeeper) + _, err := suite.StakingKeeper.EndBlocker(suite.Ctx) + suite.Require().NoError(err) return fromDelegationShares, toDelegationShares, nil }, @@ -185,60 +194,65 @@ func (suite *KeeperTestSuite) TestTransferDelegation_Shares() { }, { name: "excess shares cannot be transferred", - createDelegations: func() (sdk.Dec, sdk.Dec, error) { + createDelegations: func() (sdkmath.LegacyDec, sdkmath.LegacyDec, error) { suite.CreateNewUnbondedValidator(valAddr, i(1e9)) fromDelegationShares := suite.CreateDelegation(valAddr, fromDelegator, i(1e9)) - staking.EndBlocker(suite.Ctx, suite.StakingKeeper) + _, err := suite.StakingKeeper.EndBlocker(suite.Ctx) + suite.Require().NoError(err) - return fromDelegationShares, sdk.ZeroDec(), nil + return fromDelegationShares, sdkmath.LegacyZeroDec(), nil }, shares: d("1000000000.000000000000000001"), expectedErr: stakingtypes.ErrNotEnoughDelegationShares, }, { name: "shares can be transferred to a non existent delegation", - createDelegations: func() (sdk.Dec, sdk.Dec, error) { + createDelegations: func() (sdkmath.LegacyDec, sdkmath.LegacyDec, error) { suite.CreateNewUnbondedValidator(valAddr, i(1e9)) fromDelegationShares := suite.CreateDelegation(valAddr, fromDelegator, i(1e9)) - staking.EndBlocker(suite.Ctx, suite.StakingKeeper) + _, err := suite.StakingKeeper.EndBlocker(suite.Ctx) + suite.Require().NoError(err) - return fromDelegationShares, sdk.ZeroDec(), nil + return fromDelegationShares, sdkmath.LegacyZeroDec(), nil }, shares: d("500000000.0"), expectReceived: d("500000000.0"), }, { name: "shares cannot be transferred from a non existent delegation", - createDelegations: func() (sdk.Dec, sdk.Dec, error) { + createDelegations: func() (sdkmath.LegacyDec, sdkmath.LegacyDec, error) { suite.CreateNewUnbondedValidator(valAddr, i(1e9)) - staking.EndBlocker(suite.Ctx, suite.StakingKeeper) + _, err := suite.StakingKeeper.EndBlocker(suite.Ctx) + suite.Require().NoError(err) - return sdk.ZeroDec(), sdk.ZeroDec(), nil + return sdkmath.LegacyZeroDec(), sdkmath.LegacyZeroDec(), nil }, shares: d("500000000.0"), expectedErr: types.ErrNoDelegatorForAddress, }, { name: "slashed validator shares can be transferred", - createDelegations: func() (sdk.Dec, sdk.Dec, error) { + createDelegations: func() (sdkmath.LegacyDec, sdkmath.LegacyDec, error) { suite.CreateNewUnbondedValidator(valAddr, i(1e9)) fromDelegationShares := suite.CreateDelegation(valAddr, fromDelegator, i(1e9)) - staking.EndBlocker(suite.Ctx, suite.StakingKeeper) + _, err := suite.StakingKeeper.EndBlocker(suite.Ctx) + suite.Require().NoError(err) suite.SlashValidator(valAddr, d("0.05")) - return fromDelegationShares, sdk.ZeroDec(), nil + return fromDelegationShares, sdkmath.LegacyZeroDec(), nil }, shares: d("500000000.0"), expectReceived: d("500000000.0"), }, { name: "zero shares received when transfer < 1 token", - createDelegations: func() (sdk.Dec, sdk.Dec, error) { + createDelegations: func() (sdkmath.LegacyDec, sdkmath.LegacyDec, error) { suite.CreateNewUnbondedValidator(valAddr, i(1e9)) fromDelegationShares := suite.CreateDelegation(valAddr, fromDelegator, i(1e9)) toDelegationShares := suite.CreateDelegation(valAddr, toDelegator, i(1e9)) - staking.EndBlocker(suite.Ctx, suite.StakingKeeper) + _, err := suite.StakingKeeper.EndBlocker(suite.Ctx) + suite.Require().NoError(err) // make 1 share worth more than 1 token suite.SlashValidator(valAddr, d("0.05")) @@ -258,8 +272,8 @@ func (suite *KeeperTestSuite) TestTransferDelegation_Shares() { fromDelegationShares, toDelegationShares, err := tc.createDelegations() suite.Require().NoError(err) - validator, found := suite.StakingKeeper.GetValidator(suite.Ctx, valAddr) - suite.Require().True(found) + validator, err := suite.StakingKeeper.GetValidator(suite.Ctx, valAddr) + suite.Require().NoError(err) _, err = suite.Keeper.TransferDelegation(suite.Ctx, valAddr, fromDelegator, toDelegator, tc.shares) @@ -272,8 +286,8 @@ func (suite *KeeperTestSuite) TestTransferDelegation_Shares() { suite.DelegationSharesEqual(valAddr, fromDelegator, fromDelegationShares.Sub(tc.shares)) suite.DelegationSharesEqual(valAddr, toDelegator, toDelegationShares.Add(tc.expectReceived)) - validatorAfter, found := suite.StakingKeeper.GetValidator(suite.Ctx, valAddr) - suite.Require().True(found) + validatorAfter, err := suite.StakingKeeper.GetValidator(suite.Ctx, valAddr) + suite.Require().NoError(err) // total tokens should not change suite.Equal(validator.GetTokens(), validatorAfter.GetTokens()) // but total shares can differ @@ -300,17 +314,19 @@ func (suite *KeeperTestSuite) TestTransferDelegation_RedelegationsForbidden() { // create bonded validator 1 with a delegation suite.CreateNewUnbondedValidator(val1Addr, i(1e9)) fromDelegationShares := suite.CreateDelegation(val1Addr, fromDelegator, i(1e9)) - staking.EndBlocker(suite.Ctx, suite.StakingKeeper) + _, err := suite.StakingKeeper.EndBlocker(suite.Ctx) + suite.Require().NoError(err) // create validator 2 and redelegate to it suite.CreateNewUnbondedValidator(val2Addr, i(1e9)) suite.CreateRedelegation(fromDelegator, val1Addr, val2Addr, i(1e9)) - staking.EndBlocker(suite.Ctx, suite.StakingKeeper) + _, err = suite.StakingKeeper.EndBlocker(suite.Ctx) + suite.Require().NoError(err) - _, err := suite.Keeper.TransferDelegation(suite.Ctx, val2Addr, fromDelegator, toDelegator, fromDelegationShares) + _, err = suite.Keeper.TransferDelegation(suite.Ctx, val2Addr, fromDelegator, toDelegator, fromDelegationShares) suite.ErrorIs(err, types.ErrRedelegationsNotCompleted) suite.DelegationSharesEqual(val2Addr, fromDelegator, fromDelegationShares) - suite.DelegationSharesEqual(val2Addr, toDelegator, sdk.ZeroDec()) + suite.DelegationSharesEqual(val2Addr, toDelegator, sdkmath.LegacyZeroDec()) } func (suite *KeeperTestSuite) TestTransferDelegation_CompliesWithMinSelfDelegation() { @@ -324,11 +340,11 @@ func (suite *KeeperTestSuite) TestTransferDelegation_CompliesWithMinSelfDelegati minSelfDelegation := i(1e9) delegation := suite.NewBondCoin(i(1e9)) msg, err := stakingtypes.NewMsgCreateValidator( - valAddr, + valAddr.String(), ed25519.GenPrivKey().PubKey(), delegation, - stakingtypes.Description{}, - stakingtypes.NewCommissionRates(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()), + stakingtypes.NewDescription("liquid_moniker", "", "", "", ""), + stakingtypes.NewCommissionRates(sdkmath.LegacyZeroDec(), sdkmath.LegacyZeroDec(), sdkmath.LegacyZeroDec()), minSelfDelegation, ) suite.Require().NoError(err) @@ -336,11 +352,12 @@ func (suite *KeeperTestSuite) TestTransferDelegation_CompliesWithMinSelfDelegati msgServer := stakingkeeper.NewMsgServerImpl(suite.StakingKeeper) _, err = msgServer.CreateValidator(sdk.WrapSDKContext(suite.Ctx), msg) suite.Require().NoError(err) - staking.EndBlocker(suite.Ctx, suite.StakingKeeper) + _, err = suite.StakingKeeper.EndBlocker(suite.Ctx) + suite.Require().NoError(err) _, err = suite.Keeper.TransferDelegation(suite.Ctx, valAddr, valAccAddr, toDelegator, d("0.000000000000000001")) suite.ErrorIs(err, types.ErrSelfDelegationBelowMinimum) - suite.DelegationSharesEqual(valAddr, valAccAddr, sdk.NewDecFromInt(delegation.Amount)) + suite.DelegationSharesEqual(valAddr, valAccAddr, sdkmath.LegacyNewDecFromInt(delegation.Amount)) } func (suite *KeeperTestSuite) TestTransferDelegation_CanTransferVested() { @@ -353,10 +370,11 @@ func (suite *KeeperTestSuite) TestTransferDelegation_CanTransferVested() { suite.CreateNewUnbondedValidator(valAddr, i(1e9)) fromDelegationShares := suite.CreateDelegation(valAddr, fromDelegator, i(2e9)) - staking.EndBlocker(suite.Ctx, suite.StakingKeeper) + _, err := suite.StakingKeeper.EndBlocker(suite.Ctx) + suite.Require().NoError(err) shares := d("1000000000.0") - _, err := suite.Keeper.TransferDelegation(suite.Ctx, valAddr, fromDelegator, toDelegator, shares) + _, err = suite.Keeper.TransferDelegation(suite.Ctx, valAddr, fromDelegator, toDelegator, shares) suite.NoError(err) suite.DelegationSharesEqual(valAddr, fromDelegator, fromDelegationShares.Sub(shares)) suite.DelegationSharesEqual(valAddr, toDelegator, shares) @@ -372,8 +390,9 @@ func (suite *KeeperTestSuite) TestTransferDelegation_CannotTransferVesting() { suite.CreateNewUnbondedValidator(valAddr, i(1e9)) suite.CreateDelegation(valAddr, fromDelegator, i(2e9)) - staking.EndBlocker(suite.Ctx, suite.StakingKeeper) + _, err := suite.StakingKeeper.EndBlocker(suite.Ctx) + suite.Require().NoError(err) - _, err := suite.Keeper.TransferDelegation(suite.Ctx, valAddr, fromDelegator, toDelegator, d("1000000001.0")) + _, err = suite.Keeper.TransferDelegation(suite.Ctx, valAddr, fromDelegator, toDelegator, d("1000000001.0")) suite.ErrorIs(err, sdkerrors.ErrInsufficientFunds) } diff --git a/x/liquid/module.go b/x/liquid/module.go index 6363920165..55df1a4e56 100644 --- a/x/liquid/module.go +++ b/x/liquid/module.go @@ -2,6 +2,7 @@ package liquid import ( "context" + "cosmossdk.io/core/appmodule" "encoding/json" "github.com/grpc-ecosystem/grpc-gateway/runtime" @@ -21,8 +22,13 @@ import ( ) var ( - _ module.AppModule = AppModule{} + _ appmodule.AppModule = AppModule{} _ module.AppModuleBasic = AppModuleBasic{} + + _ appmodule.AppModule = (*AppModule)(nil) + _ appmodule.HasBeginBlocker = (*AppModule)(nil) + // TODO(boodyvo): should we put it here? Looks like it is different interface + //_ appmodule.HasEndBlocker = (*AppModule)(nil) ) // AppModuleBasic app module basics object @@ -117,9 +123,15 @@ func (am AppModule) ExportGenesis(_ sdk.Context, cdc codec.JSONCodec) json.RawMe } // BeginBlock module begin-block -func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} +func (am AppModule) BeginBlock(ctx context.Context) error { + return nil +} // EndBlock module end-block -func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - return []abci.ValidatorUpdate{} +func (am AppModule) EndBlock(_ context.Context) ([]abci.ValidatorUpdate, error) { + return []abci.ValidatorUpdate{}, nil } + +func (AppModule) IsOnePerModuleType() {} + +func (AppModule) IsAppModule() {} diff --git a/x/liquid/types/codec.go b/x/liquid/types/codec.go index adaea1921f..b3de9dfb28 100644 --- a/x/liquid/types/codec.go +++ b/x/liquid/types/codec.go @@ -6,7 +6,6 @@ import ( cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" - authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec" ) // RegisterLegacyAminoCodec registers all the necessary types and interfaces for the module. @@ -37,5 +36,5 @@ func init() { // Register all Amino interfaces and concrete types on the authz Amino codec so that this can later be // used to properly serialize MsgGrant and MsgExec instances - RegisterLegacyAminoCodec(authzcodec.Amino) + RegisterLegacyAminoCodec(codec.NewLegacyAmino()) } diff --git a/x/liquid/types/expected_keepers.go b/x/liquid/types/expected_keepers.go index 3c059d59fa..f1f1dd59ca 100644 --- a/x/liquid/types/expected_keepers.go +++ b/x/liquid/types/expected_keepers.go @@ -1,57 +1,59 @@ package types import ( + "context" + addresscodec "cosmossdk.io/core/address" sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ) // BankKeeper defines the expected bank keeper type BankKeeper interface { - SendCoinsFromModuleToModule(ctx sdk.Context, senderModule, recipientModule string, amt sdk.Coins) error - SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error - SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error - SendCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error + SendCoinsFromModuleToModule(ctx context.Context, senderModule, recipientModule string, amt sdk.Coins) error + SendCoinsFromAccountToModule(ctx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error + SendCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error + SendCoins(ctx context.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error - MintCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error - BurnCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error - UndelegateCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error + MintCoins(ctx context.Context, moduleName string, amt sdk.Coins) error + BurnCoins(ctx context.Context, moduleName string, amt sdk.Coins) error + UndelegateCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error - IterateTotalSupply(ctx sdk.Context, cb func(sdk.Coin) bool) - GetSupply(ctx sdk.Context, denom string) sdk.Coin + IterateTotalSupply(ctx context.Context, cb func(sdk.Coin) bool) + GetSupply(ctx context.Context, denom string) sdk.Coin } // AccountKeeper defines the expected keeper interface for interacting with account type AccountKeeper interface { GetModuleAddress(moduleName string) sdk.AccAddress - GetModuleAccount(ctx sdk.Context, name string) authtypes.ModuleAccountI - GetAccount(ctx sdk.Context, addr sdk.AccAddress) authtypes.AccountI + GetModuleAccount(ctx context.Context, name string) sdk.ModuleAccountI + GetAccount(ctx context.Context, addr sdk.AccAddress) sdk.AccountI } // StakingKeeper defines the expected keeper interface for interacting with staking type StakingKeeper interface { - BondDenom(ctx sdk.Context) (res string) + BondDenom(ctx context.Context) (res string, err error) - GetValidator(ctx sdk.Context, addr sdk.ValAddress) (validator stakingtypes.Validator, found bool) - GetDelegation(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) (delegation stakingtypes.Delegation, found bool) - IterateDelegatorDelegations(ctx sdk.Context, delegator sdk.AccAddress, cb func(delegation stakingtypes.Delegation) (stop bool)) - HasReceivingRedelegation(ctx sdk.Context, delAddr sdk.AccAddress, valDstAddr sdk.ValAddress) bool + GetValidator(ctx context.Context, addr sdk.ValAddress) (validator stakingtypes.Validator, err error) + GetDelegation(ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) (delegation stakingtypes.Delegation, err error) + IterateDelegatorDelegations(ctx context.Context, delegator sdk.AccAddress, cb func(delegation stakingtypes.Delegation) (stop bool)) error + HasReceivingRedelegation(ctx context.Context, delAddr sdk.AccAddress, valDstAddr sdk.ValAddress) (bool, error) + ValidatorAddressCodec() addresscodec.Codec ValidateUnbondAmount( - ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress, amt sdkmath.Int, - ) (shares sdk.Dec, err error) + ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress, amt sdkmath.Int, + ) (shares sdkmath.LegacyDec, err error) Delegate( - ctx sdk.Context, delAddr sdk.AccAddress, bondAmt sdkmath.Int, tokenSrc stakingtypes.BondStatus, + ctx context.Context, delAddr sdk.AccAddress, bondAmt sdkmath.Int, tokenSrc stakingtypes.BondStatus, validator stakingtypes.Validator, subtractAccount bool, - ) (newShares sdk.Dec, err error) + ) (newShares sdkmath.LegacyDec, err error) Unbond( - ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress, shares sdk.Dec, + ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress, shares sdkmath.LegacyDec, ) (amount sdkmath.Int, err error) } type DistributionKeeper interface { - GetDelegatorWithdrawAddr(ctx sdk.Context, delAddr sdk.AccAddress) sdk.AccAddress - WithdrawDelegationRewards(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) (sdk.Coins, error) + GetDelegatorWithdrawAddr(ctx context.Context, delAddr sdk.AccAddress) (sdk.AccAddress, error) + WithdrawDelegationRewards(ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) (sdk.Coins, error) } diff --git a/x/liquid/types/msg_test.go b/x/liquid/types/msg_test.go index 48b92e61b6..6fe0713c5d 100644 --- a/x/liquid/types/msg_test.go +++ b/x/liquid/types/msg_test.go @@ -136,7 +136,10 @@ func TestMsg_Validate(t *testing.T) { } for _, msg := range msgs { t.Run(fmt.Sprintf("%s/%T", tc.name, msg), func(t *testing.T) { - err := msg.ValidateBasic() + validateBasic, ok := msg.(sdk.HasValidateBasic) + require.True(t, ok, "msg does not implement sdk.HasValidateBasic") + + err := validateBasic.ValidateBasic() if tc.expectedErr == nil { require.NoError(t, err) } else { diff --git a/x/liquid/types/query.pb.go b/x/liquid/types/query.pb.go index f771eb3b97..923313263d 100644 --- a/x/liquid/types/query.pb.go +++ b/x/liquid/types/query.pb.go @@ -340,6 +340,7 @@ func _Query_TotalSupply_Handler(srv interface{}, ctx context.Context, dec func(i return interceptor(ctx, in, info, handler) } +var Query_serviceDesc = _Query_serviceDesc var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "kava.liquid.v1beta1.Query", HandlerType: (*QueryServer)(nil), diff --git a/x/liquid/types/tx.pb.go b/x/liquid/types/tx.pb.go index 1fde9ebaae..559c601272 100644 --- a/x/liquid/types/tx.pb.go +++ b/x/liquid/types/tx.pb.go @@ -5,9 +5,9 @@ package types import ( context "context" + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" _ "github.com/cosmos/cosmos-proto" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" @@ -208,7 +208,7 @@ func (m *MsgBurnDerivative) GetAmount() types.Coin { // MsgBurnDerivativeResponse defines the Msg/BurnDerivative response type. type MsgBurnDerivativeResponse struct { // received is the number of delegation shares sent to the sender - Received github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,1,opt,name=received,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"received"` + Received cosmossdk_io_math.LegacyDec `protobuf:"bytes,1,opt,name=received,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"received"` } func (m *MsgBurnDerivativeResponse) Reset() { *m = MsgBurnDerivativeResponse{} } @@ -254,34 +254,34 @@ func init() { func init() { proto.RegisterFile("kava/liquid/v1beta1/tx.proto", fileDescriptor_738981106e50f269) } var fileDescriptor_738981106e50f269 = []byte{ - // 421 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x53, 0xbd, 0xae, 0xda, 0x30, - 0x14, 0x8e, 0x7b, 0x2b, 0x54, 0x5c, 0xe9, 0x4a, 0x4d, 0xef, 0x10, 0xd0, 0x55, 0x40, 0x0c, 0x88, - 0x25, 0x4e, 0xa1, 0x43, 0x87, 0x76, 0x69, 0xca, 0xca, 0x92, 0x2e, 0xa8, 0x4b, 0xe5, 0x24, 0x56, - 0xb0, 0x00, 0x9b, 0xda, 0x4e, 0x44, 0xdf, 0xa2, 0x0f, 0xd0, 0xc7, 0xe0, 0x21, 0x18, 0x11, 0x53, - 0xdb, 0x01, 0x55, 0xf0, 0x22, 0x55, 0x12, 0x13, 0xca, 0x9f, 0xc4, 0x78, 0x27, 0xdb, 0xe7, 0x3b, - 0xdf, 0xf1, 0xf9, 0xbe, 0x63, 0xc3, 0xc7, 0x31, 0x4e, 0xb1, 0x3b, 0xa1, 0xdf, 0x12, 0x1a, 0xb9, - 0x69, 0x37, 0x20, 0x0a, 0x77, 0x5d, 0x35, 0x47, 0x33, 0xc1, 0x15, 0x37, 0x5f, 0x67, 0x28, 0x2a, - 0x50, 0xa4, 0xd1, 0xba, 0x1d, 0x72, 0x39, 0xe5, 0xd2, 0x0d, 0xb0, 0x24, 0x25, 0x25, 0xe4, 0x94, - 0x15, 0xa4, 0x7a, 0xad, 0xc0, 0xbf, 0xe6, 0x27, 0xb7, 0x38, 0x68, 0xe8, 0x21, 0xe6, 0x31, 0x2f, - 0xe2, 0xd9, 0xae, 0x88, 0xb6, 0x7e, 0x02, 0xf8, 0x6a, 0x20, 0xe3, 0x01, 0x65, 0xaa, 0x4f, 0x04, - 0x4d, 0xb1, 0xa2, 0x29, 0x31, 0xdf, 0xc0, 0x8a, 0x24, 0x2c, 0x22, 0xc2, 0x02, 0x4d, 0xd0, 0xa9, - 0x7a, 0xd6, 0x7a, 0xe1, 0x3c, 0xe8, 0x6a, 0x1f, 0xa3, 0x48, 0x10, 0x29, 0x3f, 0x2b, 0x41, 0x59, - 0xec, 0xeb, 0x3c, 0xf3, 0x11, 0x56, 0x53, 0x3c, 0xa1, 0x11, 0x56, 0x5c, 0x58, 0xcf, 0x32, 0x92, - 0x7f, 0x08, 0x98, 0xef, 0x60, 0x05, 0x4f, 0x79, 0xc2, 0x94, 0x75, 0xd7, 0x04, 0x9d, 0x97, 0xbd, - 0x1a, 0xd2, 0xc5, 0x32, 0x1d, 0x7b, 0x71, 0xe8, 0x13, 0xa7, 0xcc, 0x7b, 0xbe, 0xdc, 0x34, 0x0c, - 0x5f, 0xa7, 0xb7, 0x86, 0xb0, 0x76, 0xd6, 0x9d, 0x4f, 0xe4, 0x8c, 0x33, 0x49, 0xcc, 0xf7, 0xf0, - 0x85, 0x20, 0x21, 0xa1, 0x29, 0x89, 0xf2, 0x3e, 0x6f, 0xa8, 0x5b, 0x12, 0xf6, 0xc2, 0xbd, 0x44, - 0xb0, 0xa7, 0x28, 0x3c, 0xc9, 0x85, 0x1f, 0x77, 0x57, 0x0a, 0x1f, 0x9e, 0x08, 0xaf, 0x7a, 0x1f, - 0x32, 0xf2, 0x9f, 0x4d, 0xa3, 0x1d, 0x53, 0x35, 0x4a, 0x02, 0x14, 0xf2, 0xa9, 0x9e, 0xbe, 0x5e, - 0x1c, 0x19, 0x8d, 0x5d, 0xf5, 0x7d, 0x46, 0x24, 0xea, 0x93, 0x70, 0xbd, 0x70, 0xa0, 0x6e, 0xa4, - 0x4f, 0xc2, 0x83, 0x2b, 0xbd, 0xdf, 0x00, 0xde, 0x0d, 0x64, 0x6c, 0x8e, 0xe0, 0xfd, 0xc9, 0x93, - 0x68, 0xa3, 0x0b, 0xef, 0x11, 0x9d, 0x0d, 0xa7, 0x8e, 0x6e, 0xcb, 0x2b, 0xb5, 0x8c, 0xe0, 0xfd, - 0xc9, 0x0c, 0xae, 0xde, 0x74, 0x9c, 0x77, 0xfd, 0xa6, 0xcb, 0xae, 0x79, 0xde, 0x72, 0x6b, 0x83, - 0xd5, 0xd6, 0x06, 0x7f, 0xb7, 0x36, 0xf8, 0xb1, 0xb3, 0x8d, 0xd5, 0xce, 0x36, 0x7e, 0xed, 0x6c, - 0xe3, 0x4b, 0xe7, 0x3f, 0xd7, 0xb2, 0x9a, 0xce, 0x04, 0x07, 0x32, 0xdf, 0xb9, 0xf3, 0xfd, 0xff, - 0xcc, 0xbd, 0x0b, 0x2a, 0xf9, 0xaf, 0x79, 0xfb, 0x2f, 0x00, 0x00, 0xff, 0xff, 0x40, 0x82, 0xe3, - 0xbf, 0xbb, 0x03, 0x00, 0x00, + // 426 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x53, 0xbd, 0x6e, 0xdb, 0x30, + 0x10, 0x16, 0x9b, 0xc2, 0xa8, 0x59, 0x20, 0x40, 0xd5, 0x0c, 0xb2, 0x1b, 0x28, 0x41, 0x86, 0xc2, + 0x8b, 0xc9, 0x3a, 0x1d, 0x3a, 0x74, 0xaa, 0xea, 0xb1, 0x5a, 0xd4, 0xa5, 0xe8, 0x52, 0x50, 0xd2, + 0x41, 0x62, 0x63, 0x91, 0x2e, 0x49, 0x09, 0xc9, 0x5b, 0xf4, 0x01, 0xfa, 0x18, 0x79, 0x88, 0x8c, + 0x41, 0xa6, 0xb6, 0x83, 0x51, 0xd8, 0x2f, 0x52, 0xe8, 0xc7, 0x32, 0xfc, 0x07, 0x78, 0xcc, 0x46, + 0xde, 0x77, 0xdf, 0x77, 0xf7, 0x1d, 0x79, 0xf8, 0xf4, 0x8a, 0x15, 0x8c, 0x4e, 0xf8, 0x8f, 0x9c, + 0xc7, 0xb4, 0x18, 0x85, 0x60, 0xd8, 0x88, 0x9a, 0x6b, 0x32, 0x55, 0xd2, 0x48, 0xfb, 0x65, 0x89, + 0x92, 0x1a, 0x25, 0x0d, 0xda, 0x77, 0x23, 0xa9, 0x33, 0xa9, 0x69, 0xc8, 0x34, 0xb4, 0x94, 0x48, + 0x72, 0x51, 0x93, 0xfa, 0xbd, 0x1a, 0xff, 0x56, 0xdd, 0x68, 0x7d, 0x69, 0xa0, 0x93, 0x44, 0x26, + 0xb2, 0x8e, 0x97, 0xa7, 0x3a, 0x7a, 0xf1, 0x0b, 0xe1, 0x17, 0xbe, 0x4e, 0x7c, 0x2e, 0xcc, 0x18, + 0x14, 0x2f, 0x98, 0xe1, 0x05, 0xd8, 0x6f, 0x70, 0x47, 0x83, 0x88, 0x41, 0x39, 0xe8, 0x1c, 0x0d, + 0xba, 0x9e, 0xf3, 0x70, 0x3b, 0x3c, 0x69, 0xd4, 0x3e, 0xc4, 0xb1, 0x02, 0xad, 0x3f, 0x1b, 0xc5, + 0x45, 0x12, 0x34, 0x79, 0xf6, 0x29, 0xee, 0x16, 0x6c, 0xc2, 0x63, 0x66, 0xa4, 0x72, 0x9e, 0x94, + 0xa4, 0x60, 0x15, 0xb0, 0xdf, 0xe1, 0x0e, 0xcb, 0x64, 0x2e, 0x8c, 0x73, 0x74, 0x8e, 0x06, 0xcf, + 0x2f, 0x7b, 0xa4, 0x11, 0x2b, 0x7d, 0x2c, 0xcd, 0x91, 0x8f, 0x92, 0x0b, 0xef, 0xe9, 0xdd, 0xec, + 0xcc, 0x0a, 0x9a, 0xf4, 0x8b, 0x2f, 0xb8, 0xb7, 0xd5, 0x5d, 0x00, 0x7a, 0x2a, 0x85, 0x06, 0xfb, + 0x3d, 0x7e, 0xa6, 0x20, 0x02, 0x5e, 0x40, 0x5c, 0xf5, 0x79, 0x80, 0x6e, 0x4b, 0x58, 0x1a, 0xf7, + 0x72, 0x25, 0x1e, 0xa3, 0xf1, 0xef, 0x95, 0xf1, 0xf5, 0xee, 0x5a, 0xe3, 0xfe, 0x86, 0xf1, 0xae, + 0x37, 0x2a, 0xc9, 0x7f, 0x67, 0x67, 0xaf, 0x6a, 0x79, 0x1d, 0x5f, 0x11, 0x2e, 0x69, 0xc6, 0x4c, + 0x4a, 0x3e, 0x41, 0xc2, 0xa2, 0x9b, 0x31, 0x44, 0x0f, 0xb7, 0x43, 0xdc, 0x54, 0x1f, 0x43, 0xb4, + 0x1a, 0xc5, 0xe5, 0x1f, 0x84, 0x8f, 0x7c, 0x9d, 0xd8, 0x29, 0x3e, 0xde, 0xf8, 0x07, 0xaf, 0xc9, + 0x8e, 0x4f, 0x48, 0xb6, 0x5e, 0xa4, 0x4f, 0x0e, 0xcb, 0x6b, 0x0d, 0xa4, 0xf8, 0x78, 0x63, 0xf0, + 0x7b, 0x2b, 0xad, 0xe7, 0xed, 0xaf, 0xb4, 0x7b, 0x54, 0x9e, 0x77, 0x37, 0x77, 0xd1, 0xfd, 0xdc, + 0x45, 0xff, 0xe6, 0x2e, 0xfa, 0xb9, 0x70, 0xad, 0xfb, 0x85, 0x6b, 0xfd, 0x5e, 0xb8, 0xd6, 0xd7, + 0x41, 0xc2, 0x4d, 0x9a, 0x87, 0x24, 0x92, 0x19, 0x2d, 0x35, 0x87, 0x13, 0x16, 0xea, 0xea, 0x44, + 0xaf, 0x97, 0x4b, 0x69, 0x6e, 0xa6, 0xa0, 0xc3, 0x4e, 0xb5, 0x2a, 0x6f, 0xff, 0x07, 0x00, 0x00, + 0xff, 0xff, 0x88, 0xe9, 0x05, 0xc2, 0xb0, 0x03, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -387,6 +387,7 @@ func _Msg_BurnDerivative_Handler(srv interface{}, ctx context.Context, dec func( return interceptor(ctx, in, info, handler) } +var Msg_serviceDesc = _Msg_serviceDesc var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "kava.liquid.v1beta1.Msg", HandlerType: (*MsgServer)(nil), diff --git a/x/metrics/abci_test.go b/x/metrics/abci_test.go index 141d501bee..c8c89d95fa 100644 --- a/x/metrics/abci_test.go +++ b/x/metrics/abci_test.go @@ -25,7 +25,7 @@ func (*MockGauge) Add(_ float64) {} func ctxWithHeight(height int64) sdk.Context { tApp := app.NewTestApp() tApp.InitializeFromGenesisStates() - return tApp.NewContext(false, tmproto.Header{Height: height}) + return tApp.NewContextLegacy(false, tmproto.Header{Height: height}) } func TestBeginBlockEmitsLatestHeight(t *testing.T) { diff --git a/x/metrics/module.go b/x/metrics/module.go index 2ee0d65680..864fa93f64 100644 --- a/x/metrics/module.go +++ b/x/metrics/module.go @@ -1,6 +1,7 @@ package metrics import ( + "context" "encoding/json" "github.com/grpc-ecosystem/grpc-gateway/runtime" @@ -101,11 +102,18 @@ func (am AppModule) ExportGenesis(_ sdk.Context, cdc codec.JSONCodec) json.RawMe } // BeginBlock module begin-block -func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) { - BeginBlocker(ctx, am.metrics) +func (am AppModule) BeginBlock(ctx context.Context) error { + sdkCtx := sdk.UnwrapSDKContext(ctx) + BeginBlocker(sdkCtx, am.metrics) + + return nil } // EndBlock module end-block -func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - return []abci.ValidatorUpdate{} +func (am AppModule) EndBlock(_ sdk.Context) ([]abci.ValidatorUpdate, error) { + return []abci.ValidatorUpdate{}, nil } + +func (AppModule) IsOnePerModuleType() {} + +func (AppModule) IsAppModule() {} diff --git a/x/precisebank/keeper/burn.go b/x/precisebank/keeper/burn.go index a190659ccd..e526659213 100644 --- a/x/precisebank/keeper/burn.go +++ b/x/precisebank/keeper/burn.go @@ -1,6 +1,7 @@ package keeper import ( + "context" "fmt" errorsmod "cosmossdk.io/errors" @@ -14,15 +15,17 @@ import ( // BurnCoins burns coins deletes coins from the balance of the module account. // It will panic if the module account does not exist or is unauthorized. -func (k Keeper) BurnCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error { +func (k Keeper) BurnCoins(ctx context.Context, moduleName string, amt sdk.Coins) error { // Custom protection for x/precisebank, no external module should be able to // affect reserves. if moduleName == types.ModuleName { panic(errorsmod.Wrapf(sdkerrors.ErrUnauthorized, "module account %s cannot be burned from", moduleName)) } + sdkCtx := sdk.UnwrapSDKContext(ctx) + // Panic errors are identical to x/bank for consistency. - acc := k.ak.GetModuleAccount(ctx, moduleName) + acc := k.ak.GetModuleAccount(sdkCtx, moduleName) if acc == nil { panic(errorsmod.Wrapf(sdkerrors.ErrUnknownAddress, "module account %s does not exist", moduleName)) } @@ -48,14 +51,14 @@ func (k Keeper) BurnCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) err // Coins unmanaged by x/precisebank are passed through to x/bank if !passthroughCoins.Empty() { - if err := k.bk.BurnCoins(ctx, moduleName, passthroughCoins); err != nil { + if err := k.bk.BurnCoins(sdkCtx, moduleName, passthroughCoins); err != nil { return err } } // Only burn extended coin if the amount is positive if extendedAmount.IsPositive() { - if err := k.burnExtendedCoin(ctx, moduleName, extendedAmount); err != nil { + if err := k.burnExtendedCoin(sdkCtx, moduleName, extendedAmount); err != nil { return err } } @@ -65,7 +68,7 @@ func (k Keeper) BurnCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) err return nil } - ctx.EventManager().EmitEvents(sdk.Events{ + sdkCtx.EventManager().EmitEvents(sdk.Events{ banktypes.NewCoinBurnEvent(acc.GetAddress(), fullEmissionCoins), banktypes.NewCoinSpentEvent(acc.GetAddress(), fullEmissionCoins), }) diff --git a/x/precisebank/keeper/burn_integration_test.go b/x/precisebank/keeper/burn_integration_test.go index 042fdbfae3..ec6e80f9f7 100644 --- a/x/precisebank/keeper/burn_integration_test.go +++ b/x/precisebank/keeper/burn_integration_test.go @@ -8,7 +8,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" + ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" "github.com/kava-labs/kava/x/precisebank/keeper" "github.com/kava-labs/kava/x/precisebank/testutil" "github.com/kava-labs/kava/x/precisebank/types" @@ -71,7 +71,7 @@ func (suite *burnIntegrationTestSuite) TestBurnCoins_MatchingErrors() { ibctransfertypes.ModuleName, func() {}, cs(c("ukava", 1000)), - "spendable balance is smaller than 1000ukava: insufficient funds", + "spendable balance 0ukava is smaller than 1000ukava: insufficient funds", "", }, } diff --git a/x/precisebank/keeper/burn_test.go b/x/precisebank/keeper/burn_test.go index 98cd49bfa9..92c9196c19 100644 --- a/x/precisebank/keeper/burn_test.go +++ b/x/precisebank/keeper/burn_test.go @@ -1,6 +1,7 @@ package keeper_test import ( + sdkmath "cosmossdk.io/math" "fmt" "testing" @@ -134,7 +135,7 @@ func TestBurnCoins_Errors(t *testing.T) { }, sdk.Coins{sdk.Coin{ Denom: "ukava", - Amount: sdk.NewInt(-1000), + Amount: sdkmath.NewInt(-1000), }}, "-1000ukava: invalid coins", }, diff --git a/x/precisebank/keeper/fractional_balance.go b/x/precisebank/keeper/fractional_balance.go index 7f2c20c811..2fea1efa45 100644 --- a/x/precisebank/keeper/fractional_balance.go +++ b/x/precisebank/keeper/fractional_balance.go @@ -5,7 +5,7 @@ import ( "fmt" sdkmath "cosmossdk.io/math" - "github.com/cosmos/cosmos-sdk/store/prefix" + "cosmossdk.io/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/kava-labs/kava/x/precisebank/types" diff --git a/x/precisebank/keeper/fractional_balance_test.go b/x/precisebank/keeper/fractional_balance_test.go index be733ea4d7..2280f6abb4 100644 --- a/x/precisebank/keeper/fractional_balance_test.go +++ b/x/precisebank/keeper/fractional_balance_test.go @@ -4,7 +4,7 @@ import ( "testing" sdkmath "cosmossdk.io/math" - "github.com/cosmos/cosmos-sdk/store/prefix" + "cosmossdk.io/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" diff --git a/x/precisebank/keeper/invariants_integration_test.go b/x/precisebank/keeper/invariants_integration_test.go index 9974035558..b555ce453d 100644 --- a/x/precisebank/keeper/invariants_integration_test.go +++ b/x/precisebank/keeper/invariants_integration_test.go @@ -48,7 +48,7 @@ func (suite *invariantsIntegrationTestSuite) TestReserveBackingFractionalInvaria k.SetFractionalBalance(ctx, sdk.AccAddress{1}, types.ConversionFactor().QuoRaw(2)) k.SetFractionalBalance(ctx, sdk.AccAddress{2}, types.ConversionFactor().QuoRaw(2)) // 1 integer backs same amount fractional - suite.FundReserve(sdk.NewInt(1)) + suite.FundReserve(sdkmath.NewInt(1)) }, false, "", @@ -59,7 +59,7 @@ func (suite *invariantsIntegrationTestSuite) TestReserveBackingFractionalInvaria k.SetFractionalBalance(ctx, sdk.AccAddress{1}, types.ConversionFactor().QuoRaw(2)) k.SetRemainderAmount(ctx, types.ConversionFactor().QuoRaw(2)) // 1 integer backs same amount fractional including remainder - suite.FundReserve(sdk.NewInt(1)) + suite.FundReserve(sdkmath.NewInt(1)) }, false, "", @@ -84,7 +84,7 @@ func (suite *invariantsIntegrationTestSuite) TestReserveBackingFractionalInvaria k.SetRemainderAmount(ctx, amt) // Needs 2 to back 0.5 x 4 - suite.FundReserve(sdk.NewInt(1)) + suite.FundReserve(sdkmath.NewInt(1)) }, true, "precisebank: module reserve backing total fractional balances invariant\nakava reserve balance 1000000000000 mismatches 2000000000000 (fractional balances 1500000000000 + remainder 500000000000)\n\n", @@ -101,7 +101,7 @@ func (suite *invariantsIntegrationTestSuite) TestReserveBackingFractionalInvaria k.SetRemainderAmount(ctx, amt) // Needs 2 to back 0.5 x 4 - suite.FundReserve(sdk.NewInt(3)) + suite.FundReserve(sdkmath.NewInt(3)) }, true, "precisebank: module reserve backing total fractional balances invariant\nakava reserve balance 3000000000000 mismatches 2000000000000 (fractional balances 1500000000000 + remainder 500000000000)\n\n", diff --git a/x/precisebank/keeper/invariants_test.go b/x/precisebank/keeper/invariants_test.go index 2518c6ef29..76646e5911 100644 --- a/x/precisebank/keeper/invariants_test.go +++ b/x/precisebank/keeper/invariants_test.go @@ -4,8 +4,8 @@ import ( "testing" sdkmath "cosmossdk.io/math" - "github.com/cosmos/cosmos-sdk/store/prefix" - storetypes "github.com/cosmos/cosmos-sdk/store/types" + "cosmossdk.io/store/prefix" + storetypes "cosmossdk.io/store/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/kava-labs/kava/x/precisebank/keeper" @@ -186,7 +186,7 @@ func TestFractionalDenomNotInBankInvariant(t *testing.T) { func(ctx sdk.Context, bk *mocks.MockBankKeeper) { bk.EXPECT(). GetSupply(ctx, types.ExtendedCoinDenom). - Return(sdk.NewCoin(types.ExtendedCoinDenom, sdk.NewInt(1000))). + Return(sdk.NewCoin(types.ExtendedCoinDenom, sdkmath.NewInt(1000))). Once() }, true, diff --git a/x/precisebank/keeper/keeper.go b/x/precisebank/keeper/keeper.go index bb2e6c931a..c8e747bfbc 100644 --- a/x/precisebank/keeper/keeper.go +++ b/x/precisebank/keeper/keeper.go @@ -1,8 +1,8 @@ package keeper import ( + storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/codec" - storetypes "github.com/cosmos/cosmos-sdk/store/types" evmtypes "github.com/evmos/ethermint/x/evm/types" diff --git a/x/precisebank/keeper/keeper_test.go b/x/precisebank/keeper/keeper_test.go index a39c538997..971ee082a0 100644 --- a/x/precisebank/keeper/keeper_test.go +++ b/x/precisebank/keeper/keeper_test.go @@ -4,7 +4,7 @@ import ( "testing" sdkmath "cosmossdk.io/math" - storetypes "github.com/cosmos/cosmos-sdk/store/types" + storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/testutil" sdk "github.com/cosmos/cosmos-sdk/types" @@ -27,9 +27,9 @@ type testData struct { // NewMockedTestData creates a new testData instance with mocked bank and // account keepers. func NewMockedTestData(t *testing.T) testData { - storeKey := sdk.NewKVStoreKey(types.ModuleName) + storeKey := storetypes.NewKVStoreKey(types.ModuleName) // Not required by module, but needs to be non-nil for context - tKey := sdk.NewTransientStoreKey("transient_test") + tKey := storetypes.NewTransientStoreKey("transient_test") ctx := testutil.DefaultContext(storeKey, tKey) bk := mocks.NewMockBankKeeper(t) @@ -37,6 +37,10 @@ func NewMockedTestData(t *testing.T) testData { tApp := app.NewTestApp() cdc := tApp.AppCodec() + // cdc codec.BinaryCodec, + // storeKey storetypes.StoreKey, + // bk types.BankKeeper, + // ak types.AccountKeeper, k := keeper.NewKeeper(cdc, storeKey, bk, ak) return testData{ diff --git a/x/precisebank/keeper/mint.go b/x/precisebank/keeper/mint.go index 8d42eaded5..714a598ae8 100644 --- a/x/precisebank/keeper/mint.go +++ b/x/precisebank/keeper/mint.go @@ -1,6 +1,7 @@ package keeper import ( + "context" "fmt" errorsmod "cosmossdk.io/errors" @@ -17,15 +18,17 @@ import ( // If ExtendedCoinDenom is provided, the corresponding fractional amount is // added to the module state. // It will panic if the module account does not exist or is unauthorized. -func (k Keeper) MintCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error { +func (k Keeper) MintCoins(ctx context.Context, moduleName string, amt sdk.Coins) error { // Disallow minting to x/precisebank module if moduleName == types.ModuleName { panic(errorsmod.Wrapf(sdkerrors.ErrUnauthorized, "module account %s cannot be minted to", moduleName)) } + sdkCtx := sdk.UnwrapSDKContext(ctx) + // Note: MintingRestrictionFn is not used in x/precisebank // Panic errors are identical to x/bank for consistency. - acc := k.ak.GetModuleAccount(ctx, moduleName) + acc := k.ak.GetModuleAccount(sdkCtx, moduleName) if acc == nil { panic(errorsmod.Wrapf(sdkerrors.ErrUnknownAddress, "module account %s does not exist", moduleName)) } @@ -51,14 +54,14 @@ func (k Keeper) MintCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) err // Coins unmanaged by x/precisebank are passed through to x/bank if !passthroughCoins.Empty() { - if err := k.bk.MintCoins(ctx, moduleName, passthroughCoins); err != nil { + if err := k.bk.MintCoins(sdkCtx, moduleName, passthroughCoins); err != nil { return err } } // Only mint extended coin if the amount is positive if extendedAmount.IsPositive() { - if err := k.mintExtendedCoin(ctx, moduleName, extendedAmount); err != nil { + if err := k.mintExtendedCoin(sdkCtx, moduleName, extendedAmount); err != nil { return err } } @@ -68,7 +71,7 @@ func (k Keeper) MintCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) err return nil } - ctx.EventManager().EmitEvents(sdk.Events{ + sdkCtx.EventManager().EmitEvents(sdk.Events{ banktypes.NewCoinMintEvent(acc.GetAddress(), fullEmissionCoins), banktypes.NewCoinReceivedEvent(acc.GetAddress(), fullEmissionCoins), }) diff --git a/x/precisebank/keeper/mint_test.go b/x/precisebank/keeper/mint_test.go index a7df18ecee..3749497004 100644 --- a/x/precisebank/keeper/mint_test.go +++ b/x/precisebank/keeper/mint_test.go @@ -134,7 +134,7 @@ func TestMintCoins_Errors(t *testing.T) { }, sdk.Coins{sdk.Coin{ Denom: "ukava", - Amount: sdk.NewInt(-1000), + Amount: sdkmath.NewInt(-1000), }}, "-1000ukava: invalid coins", }, diff --git a/x/precisebank/keeper/send.go b/x/precisebank/keeper/send.go index fd3834196f..7450924a98 100644 --- a/x/precisebank/keeper/send.go +++ b/x/precisebank/keeper/send.go @@ -1,6 +1,7 @@ package keeper import ( + "context" "errors" "fmt" @@ -18,7 +19,7 @@ import ( // Note: This method is not used directly by x/evm, but is still required as // part of authtypes.BankKeeper. x/evm uses auth methods that require this // interface. -func (k Keeper) IsSendEnabledCoins(ctx sdk.Context, coins ...sdk.Coin) error { +func (k Keeper) IsSendEnabledCoins(ctx context.Context, coins ...sdk.Coin) error { // Simply pass through to x/bank return k.bk.IsSendEnabledCoins(ctx, coins...) } @@ -28,7 +29,7 @@ func (k Keeper) IsSendEnabledCoins(ctx sdk.Context, coins ...sdk.Coin) error { // ExtendedCoinDenom and supports non-ExtendedCoinDenom transfers by passing // through to x/bank. func (k Keeper) SendCoins( - ctx sdk.Context, + ctx context.Context, from, to sdk.AccAddress, amt sdk.Coins, ) error { @@ -55,9 +56,11 @@ func (k Keeper) SendCoins( } } + sdkCtx := sdk.UnwrapSDKContext(ctx) + // Send the extended coin amount through x/precisebank if extendedCoinAmount.IsPositive() { - if err := k.sendExtendedCoins(ctx, from, to, extendedCoinAmount); err != nil { + if err := k.sendExtendedCoins(sdkCtx, from, to, extendedCoinAmount); err != nil { return err } } @@ -74,7 +77,7 @@ func (k Keeper) SendCoins( } // Emit transfer event of extended denom for the FULL equivalent value. - ctx.EventManager().EmitEvents(sdk.Events{ + sdkCtx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( banktypes.EventTypeTransfer, sdk.NewAttribute(banktypes.AttributeKeyRecipient, to.String()), @@ -163,13 +166,14 @@ func (k Keeper) sendExtendedCoins( // Sender borrows by transferring 1 integer amount to reserve to account for // lack of fractional balance. if senderNeedsBorrow && !recipientNeedsCarry { - borrowCoin := sdk.NewCoin(types.IntegerCoinDenom, sdk.NewInt(1)) - if err := k.bk.SendCoinsFromAccountToModule( + borrowCoin := sdk.NewCoin(types.IntegerCoinDenom, sdkmath.NewInt(1)) + err := k.bk.SendCoinsFromAccountToModule( ctx, from, // sender borrowing types.ModuleName, sdk.NewCoins(borrowCoin), - ); err != nil { + ) + if err != nil { return k.updateInsufficientFundsError(ctx, from, amt, err) } } @@ -179,6 +183,7 @@ func (k Keeper) sendExtendedCoins( // Always send carry from reserve before receiving borrow from sender to // ensure reserve always has sufficient balance starting from 0. if !senderNeedsBorrow && recipientNeedsCarry { + fmt.Println("inside recipientNeedsCarry") reserveAddr := k.ak.GetModuleAddress(types.ModuleName) // We use SendCoins instead of SendCoinsFromModuleToAccount to avoid @@ -186,7 +191,7 @@ func (k Keeper) sendExtendedCoins( // a SendCoins operation. Only SendCoinsFromModuleToAccount should check // blocked addrs which is done by the parent SendCoinsFromModuleToAccount // method. - carryCoin := sdk.NewCoin(types.IntegerCoinDenom, sdk.NewInt(1)) + carryCoin := sdk.NewCoin(types.IntegerCoinDenom, sdkmath.NewInt(1)) if err := k.bk.SendCoins( ctx, reserveAddr, @@ -278,12 +283,13 @@ func addToFractionalBalance( // if the recipient module is the x/precisebank module account or if sending the // tokens fails. func (k Keeper) SendCoinsFromAccountToModule( - ctx sdk.Context, + ctx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins, ) error { - recipientAcc := k.ak.GetModuleAccount(ctx, recipientModule) + sdkCtx := sdk.UnwrapSDKContext(ctx) + recipientAcc := k.ak.GetModuleAccount(sdkCtx, recipientModule) if recipientAcc == nil { panic(errorsmod.Wrapf(sdkerrors.ErrUnknownAddress, "module account %s does not exist", recipientModule)) } @@ -300,7 +306,7 @@ func (k Keeper) SendCoinsFromAccountToModule( // the recipient address is blocked, if the sender is the x/precisebank module // account, or if sending the tokens fails. func (k Keeper) SendCoinsFromModuleToAccount( - ctx sdk.Context, + ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins, @@ -353,11 +359,12 @@ func (k Keeper) updateInsufficientFundsError( // Use sdk.NewCoins() so that it removes empty balances - ie. prints // empty string if balance is 0. This is to match x/bank behavior. - spendable := sdk.NewCoins(bal) + //spendable := sdk.NewCoins(bal) + //fmt.Println("spendable", spendable) return errorsmod.Wrapf( sdkerrors.ErrInsufficientFunds, "spendable balance %s is smaller than %s", - spendable, coin, + bal, coin, ) } diff --git a/x/precisebank/keeper/send_integration_test.go b/x/precisebank/keeper/send_integration_test.go index 08c17421f2..e140abffa1 100644 --- a/x/precisebank/keeper/send_integration_test.go +++ b/x/precisebank/keeper/send_integration_test.go @@ -1,6 +1,7 @@ package keeper_test import ( + sdkmath "cosmossdk.io/math" "fmt" "testing" @@ -158,7 +159,7 @@ func (suite *sendIntegrationTestSuite) TestSendCoinsFromModuleToAccount_Matching "invalid coins", senderModuleName, sdk.AccAddress([]byte{2}), - sdk.Coins{sdk.Coin{Denom: "ukava", Amount: sdk.NewInt(-1)}}, + sdk.Coins{sdk.Coin{Denom: "ukava", Amount: sdkmath.NewInt(-1)}}, "-1ukava: invalid coins", "", }, @@ -167,7 +168,7 @@ func (suite *sendIntegrationTestSuite) TestSendCoinsFromModuleToAccount_Matching senderModuleName, sdk.AccAddress([]byte{2}), cs(c(types.IntegerCoinDenom, 1000)), - "spendable balance is smaller than 1000ukava: insufficient funds", + "spendable balance 0ukava is smaller than 1000ukava: insufficient funds", "", }, { @@ -177,7 +178,7 @@ func (suite *sendIntegrationTestSuite) TestSendCoinsFromModuleToAccount_Matching // We can still test insufficient bal errors with "akava" since // we also expect it to not exist in x/bank cs(c(types.ExtendedCoinDenom, 1000)), - "spendable balance is smaller than 1000akava: insufficient funds", + "spendable balance 0akava is smaller than 1000akava: insufficient funds", "", }, } @@ -205,6 +206,7 @@ func (suite *sendIntegrationTestSuite) TestSendCoinsFromModuleToAccount_Matching if tt.wantErr != "" { bankErr := suite.BankKeeper.SendCoinsFromModuleToAccount(suite.Ctx, tt.senderModule, tt.recipient, tt.sendAmount) + fmt.Println("bankErr", bankErr) suite.Require().Error(bankErr) suite.Require().EqualError(bankErr, tt.wantErr, "expected error should match x/bank SendCoins error") @@ -233,14 +235,14 @@ func (suite *sendIntegrationTestSuite) TestSendCoins_MatchingErrors() { { "invalid coins", cs(), - sdk.Coins{sdk.Coin{Denom: "ukava", Amount: sdk.NewInt(-1)}}, + sdk.Coins{sdk.Coin{Denom: "ukava", Amount: sdkmath.NewInt(-1)}}, "-1ukava: invalid coins", }, { "insufficient empty balance - passthrough", cs(), cs(c(types.IntegerCoinDenom, 1000)), - "spendable balance is smaller than 1000ukava: insufficient funds", + "spendable balance 0ukava is smaller than 1000ukava: insufficient funds", }, { "insufficient empty balance - extended", @@ -248,7 +250,7 @@ func (suite *sendIntegrationTestSuite) TestSendCoins_MatchingErrors() { // We can still test insufficient bal errors with "akava" since // we also expect it to not exist in x/bank cs(c(types.ExtendedCoinDenom, 1000)), - "spendable balance is smaller than 1000akava: insufficient funds", + "spendable balance 0akava is smaller than 1000akava: insufficient funds", }, { "insufficient non-empty balance - passthrough", diff --git a/x/precisebank/keeper/view.go b/x/precisebank/keeper/view.go index 3c6b83db13..ba6cb50c12 100644 --- a/x/precisebank/keeper/view.go +++ b/x/precisebank/keeper/view.go @@ -1,6 +1,7 @@ package keeper import ( + "context" sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/kava-labs/kava/x/precisebank/types" @@ -10,7 +11,7 @@ import ( // return the extended balance for the ExtendedCoinDenom, and the regular // balance for all other denoms. func (k Keeper) GetBalance( - ctx sdk.Context, + ctx context.Context, addr sdk.AccAddress, denom string, ) sdk.Coin { @@ -22,16 +23,18 @@ func (k Keeper) GetBalance( return sdk.NewCoin(denom, sdkmath.ZeroInt()) } + sdkCtx := sdk.UnwrapSDKContext(ctx) + // Pass through to x/bank for denoms except ExtendedCoinDenom if denom != types.ExtendedCoinDenom { - return k.bk.GetBalance(ctx, addr, denom) + return k.bk.GetBalance(sdkCtx, addr, denom) } // x/bank for integer balance - full balance, including locked - integerCoins := k.bk.GetBalance(ctx, addr, types.IntegerCoinDenom) + integerCoins := k.bk.GetBalance(sdkCtx, addr, types.IntegerCoinDenom) // x/precisebank for fractional balance - fractionalAmount := k.GetFractionalBalance(ctx, addr) + fractionalAmount := k.GetFractionalBalance(sdkCtx, addr) // (Integer * ConversionFactor) + Fractional fullAmount := integerCoins. @@ -46,7 +49,7 @@ func (k Keeper) GetBalance( // by address. If the account has no spendable coins, an empty Coins slice is // returned. func (k Keeper) SpendableCoin( - ctx sdk.Context, + ctx context.Context, addr sdk.AccAddress, denom string, ) sdk.Coin { @@ -63,8 +66,9 @@ func (k Keeper) SpendableCoin( // x/bank for integer balance - excluding locked integerCoin := k.bk.SpendableCoin(ctx, addr, types.IntegerCoinDenom) + sdkCtx := sdk.UnwrapSDKContext(ctx) // x/precisebank for fractional balance - fractionalAmount := k.GetFractionalBalance(ctx, addr) + fractionalAmount := k.GetFractionalBalance(sdkCtx, addr) // Spendable = (Integer * ConversionFactor) + Fractional fullAmount := integerCoin.Amount. diff --git a/x/precisebank/keeper/view_integration_test.go b/x/precisebank/keeper/view_integration_test.go index a2f3889595..477bba85e6 100644 --- a/x/precisebank/keeper/view_integration_test.go +++ b/x/precisebank/keeper/view_integration_test.go @@ -40,9 +40,9 @@ func (suite *viewIntegrationTestSuite) TestKeeper_SpendableCoin() { "extended denom, no fractional - locked coins", types.ExtendedCoinDenom, // queried bank balance in ukava when querying for akava - sdk.NewCoins(sdk.NewCoin(types.IntegerCoinDenom, sdk.NewInt(1000))), + sdk.NewCoins(sdk.NewCoin(types.IntegerCoinDenom, sdkmath.NewInt(1000))), sdkmath.ZeroInt(), - sdk.NewCoins(sdk.NewCoin(types.IntegerCoinDenom, sdk.NewInt(10))), + sdk.NewCoins(sdk.NewCoin(types.IntegerCoinDenom, sdkmath.NewInt(10))), // (integer + fractional) - locked sdk.NewCoin( types.ExtendedCoinDenom, @@ -53,9 +53,9 @@ func (suite *viewIntegrationTestSuite) TestKeeper_SpendableCoin() { "extended denom, with fractional - locked coins", types.ExtendedCoinDenom, // queried bank balance in ukava when querying for akava - sdk.NewCoins(sdk.NewCoin(types.IntegerCoinDenom, sdk.NewInt(1000))), + sdk.NewCoins(sdk.NewCoin(types.IntegerCoinDenom, sdkmath.NewInt(1000))), sdkmath.NewInt(5000), - sdk.NewCoins(sdk.NewCoin(types.IntegerCoinDenom, sdk.NewInt(10))), + sdk.NewCoins(sdk.NewCoin(types.IntegerCoinDenom, sdkmath.NewInt(10))), sdk.NewCoin( types.ExtendedCoinDenom, // (integer - locked) + fractional @@ -65,19 +65,19 @@ func (suite *viewIntegrationTestSuite) TestKeeper_SpendableCoin() { { "non-extended denom - ukava returns ukava", types.IntegerCoinDenom, - sdk.NewCoins(sdk.NewCoin(types.IntegerCoinDenom, sdk.NewInt(1000))), + sdk.NewCoins(sdk.NewCoin(types.IntegerCoinDenom, sdkmath.NewInt(1000))), sdkmath.ZeroInt(), - sdk.NewCoins(sdk.NewCoin(types.IntegerCoinDenom, sdk.NewInt(10))), - sdk.NewCoin(types.IntegerCoinDenom, sdk.NewInt(990)), + sdk.NewCoins(sdk.NewCoin(types.IntegerCoinDenom, sdkmath.NewInt(10))), + sdk.NewCoin(types.IntegerCoinDenom, sdkmath.NewInt(990)), }, { "non-extended denom, with fractional - ukava returns ukava", types.IntegerCoinDenom, - sdk.NewCoins(sdk.NewCoin(types.IntegerCoinDenom, sdk.NewInt(1000))), + sdk.NewCoins(sdk.NewCoin(types.IntegerCoinDenom, sdkmath.NewInt(1000))), // does not affect balance sdkmath.NewInt(100), - sdk.NewCoins(sdk.NewCoin(types.IntegerCoinDenom, sdk.NewInt(10))), - sdk.NewCoin(types.IntegerCoinDenom, sdk.NewInt(990)), + sdk.NewCoins(sdk.NewCoin(types.IntegerCoinDenom, sdkmath.NewInt(10))), + sdk.NewCoin(types.IntegerCoinDenom, sdkmath.NewInt(990)), }, } @@ -98,7 +98,7 @@ func (suite *viewIntegrationTestSuite) TestKeeper_SpendableCoin() { acc = authtypes.NewBaseAccount(addr, nil, 0, 0) } - vestingAcc := vestingtypes.NewPeriodicVestingAccount( + vestingAcc, err := vestingtypes.NewPeriodicVestingAccount( acc.(*authtypes.BaseAccount), tt.giveLockedCoins, suite.Ctx.BlockTime().Unix(), @@ -109,6 +109,7 @@ func (suite *viewIntegrationTestSuite) TestKeeper_SpendableCoin() { }, }, ) + suite.Require().NoError(err) suite.AccountKeeper.SetAccount(suite.Ctx, vestingAcc) fetchedLockedCoins := vestingAcc.LockedCoins(suite.Ctx.BlockTime()) @@ -141,7 +142,7 @@ func (suite *viewIntegrationTestSuite) TestKeeper_HiddenReserve() { // Mint fractional coins to an account, which should cause a mint of 1 // integer coin to the reserve to back it. extCoin := sdk.NewCoin(types.ExtendedCoinDenom, types.ConversionFactor().AddRaw(1000)) - unrelatedCoin := sdk.NewCoin("unrelated", sdk.NewInt(1000)) + unrelatedCoin := sdk.NewCoin("unrelated", sdkmath.NewInt(1000)) suite.MintToAccount( addr1, sdk.NewCoins( diff --git a/x/precisebank/keeper/view_test.go b/x/precisebank/keeper/view_test.go index 1a4e782049..bd401f9a51 100644 --- a/x/precisebank/keeper/view_test.go +++ b/x/precisebank/keeper/view_test.go @@ -24,18 +24,18 @@ func TestKeeper_GetBalance(t *testing.T) { "extended denom - no fractional balance", types.ExtendedCoinDenom, // queried bank balance in ukava when querying for akava - sdk.NewCoins(sdk.NewCoin(types.IntegerCoinDenom, sdk.NewInt(1000))), + sdk.NewCoins(sdk.NewCoin(types.IntegerCoinDenom, sdkmath.NewInt(1000))), sdkmath.ZeroInt(), // integer + fractional - sdk.NewCoin(types.ExtendedCoinDenom, sdk.NewInt(1000_000_000_000_000)), + sdk.NewCoin(types.ExtendedCoinDenom, sdkmath.NewInt(1000_000_000_000_000)), }, { "extended denom - with fractional balance", types.ExtendedCoinDenom, - sdk.NewCoins(sdk.NewCoin(types.IntegerCoinDenom, sdk.NewInt(1000))), + sdk.NewCoins(sdk.NewCoin(types.IntegerCoinDenom, sdkmath.NewInt(1000))), sdkmath.NewInt(100), // integer + fractional - sdk.NewCoin(types.ExtendedCoinDenom, sdk.NewInt(1000_000_000_000_100)), + sdk.NewCoin(types.ExtendedCoinDenom, sdkmath.NewInt(1000_000_000_000_100)), }, { "extended denom - only fractional balance", @@ -43,43 +43,43 @@ func TestKeeper_GetBalance(t *testing.T) { // no coins in bank, only fractional balance sdk.NewCoins(), sdkmath.NewInt(100), - sdk.NewCoin(types.ExtendedCoinDenom, sdk.NewInt(100)), + sdk.NewCoin(types.ExtendedCoinDenom, sdkmath.NewInt(100)), }, { "extended denom - max fractional balance", types.ExtendedCoinDenom, - sdk.NewCoins(sdk.NewCoin(types.IntegerCoinDenom, sdk.NewInt(1000))), + sdk.NewCoins(sdk.NewCoin(types.IntegerCoinDenom, sdkmath.NewInt(1000))), types.ConversionFactor().SubRaw(1), // integer + fractional - sdk.NewCoin(types.ExtendedCoinDenom, sdk.NewInt(1000_999_999_999_999)), + sdk.NewCoin(types.ExtendedCoinDenom, sdkmath.NewInt(1000_999_999_999_999)), }, { "non-extended denom - ukava returns ukava", types.IntegerCoinDenom, - sdk.NewCoins(sdk.NewCoin(types.IntegerCoinDenom, sdk.NewInt(1000))), - sdk.ZeroInt(), - sdk.NewCoin("ukava", sdk.NewInt(1000)), + sdk.NewCoins(sdk.NewCoin(types.IntegerCoinDenom, sdkmath.NewInt(1000))), + sdkmath.ZeroInt(), + sdk.NewCoin("ukava", sdkmath.NewInt(1000)), }, { "non-extended denom - unaffected by fractional balance", "ukava", - sdk.NewCoins(sdk.NewCoin("ukava", sdk.NewInt(1000))), + sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(1000))), sdkmath.NewInt(100), - sdk.NewCoin("ukava", sdk.NewInt(1000)), + sdk.NewCoin("ukava", sdkmath.NewInt(1000)), }, { "unrelated denom - no fractional", "busd", - sdk.NewCoins(sdk.NewCoin("busd", sdk.NewInt(1000))), - sdk.ZeroInt(), - sdk.NewCoin("busd", sdk.NewInt(1000)), + sdk.NewCoins(sdk.NewCoin("busd", sdkmath.NewInt(1000))), + sdkmath.ZeroInt(), + sdk.NewCoin("busd", sdkmath.NewInt(1000)), }, { "unrelated denom - unaffected by fractional balance", "busd", - sdk.NewCoins(sdk.NewCoin("busd", sdk.NewInt(1000))), + sdk.NewCoins(sdk.NewCoin("busd", sdkmath.NewInt(1000))), sdkmath.NewInt(100), - sdk.NewCoin("busd", sdk.NewInt(1000)), + sdk.NewCoin("busd", sdkmath.NewInt(1000)), }, } @@ -139,18 +139,18 @@ func TestKeeper_SpendableCoin(t *testing.T) { "extended denom - no fractional balance", types.ExtendedCoinDenom, // queried bank balance in ukava when querying for akava - sdk.NewCoins(sdk.NewCoin(types.IntegerCoinDenom, sdk.NewInt(1000))), + sdk.NewCoins(sdk.NewCoin(types.IntegerCoinDenom, sdkmath.NewInt(1000))), sdkmath.ZeroInt(), // integer + fractional - sdk.NewCoin(types.ExtendedCoinDenom, sdk.NewInt(1000_000_000_000_000)), + sdk.NewCoin(types.ExtendedCoinDenom, sdkmath.NewInt(1000_000_000_000_000)), }, { "extended denom - with fractional balance", types.ExtendedCoinDenom, - sdk.NewCoins(sdk.NewCoin(types.IntegerCoinDenom, sdk.NewInt(1000))), + sdk.NewCoins(sdk.NewCoin(types.IntegerCoinDenom, sdkmath.NewInt(1000))), sdkmath.NewInt(100), // integer + fractional - sdk.NewCoin(types.ExtendedCoinDenom, sdk.NewInt(1000_000_000_000_100)), + sdk.NewCoin(types.ExtendedCoinDenom, sdkmath.NewInt(1000_000_000_000_100)), }, { "extended denom - only fractional balance", @@ -158,43 +158,43 @@ func TestKeeper_SpendableCoin(t *testing.T) { // no coins in bank, only fractional balance sdk.NewCoins(), sdkmath.NewInt(100), - sdk.NewCoin(types.ExtendedCoinDenom, sdk.NewInt(100)), + sdk.NewCoin(types.ExtendedCoinDenom, sdkmath.NewInt(100)), }, { "extended denom - max fractional balance", types.ExtendedCoinDenom, - sdk.NewCoins(sdk.NewCoin(types.IntegerCoinDenom, sdk.NewInt(1000))), + sdk.NewCoins(sdk.NewCoin(types.IntegerCoinDenom, sdkmath.NewInt(1000))), types.ConversionFactor().SubRaw(1), // integer + fractional - sdk.NewCoin(types.ExtendedCoinDenom, sdk.NewInt(1000_999_999_999_999)), + sdk.NewCoin(types.ExtendedCoinDenom, sdkmath.NewInt(1000_999_999_999_999)), }, { "non-extended denom - ukava returns ukava", types.IntegerCoinDenom, - sdk.NewCoins(sdk.NewCoin(types.IntegerCoinDenom, sdk.NewInt(1000))), - sdk.ZeroInt(), - sdk.NewCoin("ukava", sdk.NewInt(1000)), + sdk.NewCoins(sdk.NewCoin(types.IntegerCoinDenom, sdkmath.NewInt(1000))), + sdkmath.ZeroInt(), + sdk.NewCoin("ukava", sdkmath.NewInt(1000)), }, { "non-extended denom - unaffected by fractional balance", "ukava", - sdk.NewCoins(sdk.NewCoin("ukava", sdk.NewInt(1000))), + sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(1000))), sdkmath.NewInt(100), - sdk.NewCoin("ukava", sdk.NewInt(1000)), + sdk.NewCoin("ukava", sdkmath.NewInt(1000)), }, { "unrelated denom - no fractional", "busd", - sdk.NewCoins(sdk.NewCoin("busd", sdk.NewInt(1000))), - sdk.ZeroInt(), - sdk.NewCoin("busd", sdk.NewInt(1000)), + sdk.NewCoins(sdk.NewCoin("busd", sdkmath.NewInt(1000))), + sdkmath.ZeroInt(), + sdk.NewCoin("busd", sdkmath.NewInt(1000)), }, { "unrelated denom - unaffected by fractional balance", "busd", - sdk.NewCoins(sdk.NewCoin("busd", sdk.NewInt(1000))), + sdk.NewCoins(sdk.NewCoin("busd", sdkmath.NewInt(1000))), sdkmath.NewInt(100), - sdk.NewCoin("busd", sdk.NewInt(1000)), + sdk.NewCoin("busd", sdkmath.NewInt(1000)), }, } diff --git a/x/precisebank/module.go b/x/precisebank/module.go index 6ad8f73a09..3cf3692878 100644 --- a/x/precisebank/module.go +++ b/x/precisebank/module.go @@ -150,10 +150,16 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw func (AppModule) ConsensusVersion() uint64 { return ConsensusVersion } // BeginBlock executes all ABCI BeginBlock logic respective to precisebank module. -func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) {} +func (am AppModule) BeginBlock(ctx sdk.Context) error { + return nil +} // EndBlock executes all ABCI EndBlock logic respective to precisebank module. It // returns no validator updates. -func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - return []abci.ValidatorUpdate{} +func (am AppModule) EndBlock(_ sdk.Context) ([]abci.ValidatorUpdate, error) { + return []abci.ValidatorUpdate{}, nil } + +func (AppModule) IsOnePerModuleType() {} + +func (AppModule) IsAppModule() {} diff --git a/x/precisebank/testutil/suite.go b/x/precisebank/testutil/suite.go index 345a64deac..d75d4b0807 100644 --- a/x/precisebank/testutil/suite.go +++ b/x/precisebank/testutil/suite.go @@ -34,7 +34,7 @@ type Suite struct { func (suite *Suite) SetupTest() { tApp := app.NewTestApp() - suite.Ctx = tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + suite.Ctx = tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) suite.App = tApp suite.BankKeeper = tApp.GetBankKeeper() suite.AccountKeeper = tApp.GetAccountKeeper() @@ -53,7 +53,7 @@ func (suite *Suite) SetupTest() { consAddress := sdk.ConsAddress(consPriv.PubKey().Address()) // InitializeFromGenesisStates commits first block so we start at 2 here - suite.Ctx = suite.App.NewContext(false, tmproto.Header{ + suite.Ctx = suite.App.NewContextLegacy(false, tmproto.Header{ Height: suite.App.LastBlockHeight() + 1, ChainID: app.TestChainId, Time: time.Now().UTC(), @@ -79,15 +79,46 @@ func (suite *Suite) SetupTest() { } func (suite *Suite) Commit() { - _ = suite.App.Commit() + _, err := suite.App.Commit() + suite.Require().NoError(err) + // tendermint.version.Consensus version = 1 [(gogoproto.nullable) = false]; + // string chain_id = 2 [(gogoproto.customname) = "ChainID"]; + // int64 height = 3; + // google.protobuf.Timestamp time = 4 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + // + // // prev block info + // BlockID last_block_id = 5 [(gogoproto.nullable) = false]; + // + // // hashes of block data + // bytes last_commit_hash = 6; // commit from validators from the last block + // bytes data_hash = 7; // transactions + // + // // hashes from the app output from the prev block + // bytes validators_hash = 8; // validators for the current block + // bytes next_validators_hash = 9; // validators for the next block + // bytes consensus_hash = 10; // consensus params for current block + // bytes app_hash = 11; // state after txs from the previous block + // bytes last_results_hash = 12; // root hash of all results from the txs from the previous block + // + // // consensus info + // bytes evidence_hash = 13; // evidence included in the block + // bytes proposer_address = 14; // original proposer of the block header := suite.Ctx.BlockHeader() header.Height += 1 - suite.App.BeginBlock(abci.RequestBeginBlock{ - Header: header, + //suite.App.BeginBlock(abci.RequestBeginBlock{ + // Header: header, + //}) + + _, err = suite.App.FinalizeBlock(&abci.RequestFinalizeBlock{ + Height: header.Height, + Time: header.Time, + NextValidatorsHash: header.NextValidatorsHash, + ProposerAddress: header.ProposerAddress, }) + suite.Require().NoError(err) // update ctx - suite.Ctx = suite.App.NewContext(false, header) + suite.Ctx = suite.App.NewContextLegacy(false, header) } // MintToAccount mints coins to an account with the x/precisebank methods. This diff --git a/x/precisebank/types/codec.go b/x/precisebank/types/codec.go index 772fa40e04..52020e3cde 100644 --- a/x/precisebank/types/codec.go +++ b/x/precisebank/types/codec.go @@ -5,7 +5,6 @@ import ( cdctypes "github.com/cosmos/cosmos-sdk/codec/types" cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" - authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec" ) // RegisterLegacyAminoCodec registers the necessary evmutil interfaces and concrete types @@ -29,5 +28,5 @@ func init() { // Register all Amino interfaces and concrete types on the authz Amino codec so that this can later be // used to properly serialize MsgGrant and MsgExec instances - RegisterLegacyAminoCodec(authzcodec.Amino) + RegisterLegacyAminoCodec(codec.NewLegacyAmino()) } diff --git a/x/precisebank/types/expected_keepers.go b/x/precisebank/types/expected_keepers.go index e80741f130..4e387cd6bb 100644 --- a/x/precisebank/types/expected_keepers.go +++ b/x/precisebank/types/expected_keepers.go @@ -1,31 +1,33 @@ package types import ( + "context" sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) // AccountKeeper defines the expected account keeper interface type AccountKeeper interface { - GetModuleAccount(ctx sdk.Context, moduleName string) authtypes.ModuleAccountI + GetModuleAccount(ctx context.Context, moduleName string) sdk.ModuleAccountI GetModuleAddress(moduleName string) sdk.AccAddress - GetSequence(sdk.Context, sdk.AccAddress) (uint64, error) + GetSequence(context.Context, sdk.AccAddress) (uint64, error) } // BankKeeper defines the expected bank keeper interface type BankKeeper interface { - IsSendEnabledCoins(ctx sdk.Context, coins ...sdk.Coin) error - GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin - GetSupply(ctx sdk.Context, denom string) sdk.Coin - SpendableCoin(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin + IsSendEnabledCoins(ctx context.Context, coins ...sdk.Coin) error + GetBalance(ctx context.Context, addr sdk.AccAddress, denom string) sdk.Coin + GetSupply(ctx context.Context, denom string) sdk.Coin + SpendableCoin(ctx context.Context, addr sdk.AccAddress, denom string) sdk.Coin BlockedAddr(addr sdk.AccAddress) bool - SendCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error - SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error - SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error - SendCoinsFromModuleToModule(ctx sdk.Context, senderModule string, recipientModule string, amt sdk.Coins) error + // need the method: SendCoins(ctx context.Context, from sdk.AccAddress, to sdk.AccAddress, amt sdk.Coins) error + // have the method: SendCoins(ctx sdk.Context, from sdk.AccAddress, to sdk.AccAddress, amt sdk.Coins) error + SendCoins(ctx context.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error + SendCoinsFromAccountToModule(ctx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error + SendCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error + SendCoinsFromModuleToModule(ctx context.Context, senderModule string, recipientModule string, amt sdk.Coins) error - MintCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error - BurnCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error + MintCoins(ctx context.Context, moduleName string, amt sdk.Coins) error + BurnCoins(ctx context.Context, moduleName string, amt sdk.Coins) error } diff --git a/x/precisebank/types/extended_balance_test.go b/x/precisebank/types/extended_balance_test.go index 9ce8ed214c..f1f9fa969a 100644 --- a/x/precisebank/types/extended_balance_test.go +++ b/x/precisebank/types/extended_balance_test.go @@ -1,6 +1,7 @@ package types_test import ( + sdkmath "cosmossdk.io/math" "testing" sdk "github.com/cosmos/cosmos-sdk/types" @@ -17,7 +18,7 @@ func TestSumExtendedCoin(t *testing.T) { { "empty", sdk.NewCoins(), - sdk.NewCoin(types.ExtendedCoinDenom, sdk.ZeroInt()), + sdk.NewCoin(types.ExtendedCoinDenom, sdkmath.ZeroInt()), }, { "only integer", @@ -27,7 +28,7 @@ func TestSumExtendedCoin(t *testing.T) { { "only extended", sdk.NewCoins(sdk.NewInt64Coin(types.ExtendedCoinDenom, 100)), - sdk.NewCoin(types.ExtendedCoinDenom, sdk.NewInt(100)), + sdk.NewCoin(types.ExtendedCoinDenom, sdkmath.NewInt(100)), }, { "integer and extended", diff --git a/x/precisebank/types/mocks/MockAccountKeeper.go b/x/precisebank/types/mocks/MockAccountKeeper.go index 982ba7cd54..27b50237f1 100644 --- a/x/precisebank/types/mocks/MockAccountKeeper.go +++ b/x/precisebank/types/mocks/MockAccountKeeper.go @@ -3,9 +3,9 @@ package mocks import ( - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + "context" mock "github.com/stretchr/testify/mock" - + types "github.com/cosmos/cosmos-sdk/types" ) @@ -23,19 +23,20 @@ func (_m *MockAccountKeeper) EXPECT() *MockAccountKeeper_Expecter { } // GetModuleAccount provides a mock function with given fields: ctx, moduleName -func (_m *MockAccountKeeper) GetModuleAccount(ctx types.Context, moduleName string) authtypes.ModuleAccountI { +func (_m *MockAccountKeeper) GetModuleAccount(ctx context.Context, moduleName string) types.ModuleAccountI { ret := _m.Called(ctx, moduleName) if len(ret) == 0 { panic("no return value specified for GetModuleAccount") } - var r0 authtypes.ModuleAccountI - if rf, ok := ret.Get(0).(func(types.Context, string) authtypes.ModuleAccountI); ok { - r0 = rf(ctx, moduleName) + var r0 types.ModuleAccountI + sdkCtx := types.UnwrapSDKContext(ctx) + if rf, ok := ret.Get(0).(func(types.Context, string) types.ModuleAccountI); ok { + r0 = rf(sdkCtx, moduleName) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(authtypes.ModuleAccountI) + r0 = ret.Get(0).(types.ModuleAccountI) } } @@ -61,12 +62,12 @@ func (_c *MockAccountKeeper_GetModuleAccount_Call) Run(run func(ctx types.Contex return _c } -func (_c *MockAccountKeeper_GetModuleAccount_Call) Return(_a0 authtypes.ModuleAccountI) *MockAccountKeeper_GetModuleAccount_Call { +func (_c *MockAccountKeeper_GetModuleAccount_Call) Return(_a0 types.ModuleAccountI) *MockAccountKeeper_GetModuleAccount_Call { _c.Call.Return(_a0) return _c } -func (_c *MockAccountKeeper_GetModuleAccount_Call) RunAndReturn(run func(types.Context, string) authtypes.ModuleAccountI) *MockAccountKeeper_GetModuleAccount_Call { +func (_c *MockAccountKeeper_GetModuleAccount_Call) RunAndReturn(run func(types.Context, string) types.ModuleAccountI) *MockAccountKeeper_GetModuleAccount_Call { _c.Call.Return(run) return _c } @@ -120,7 +121,7 @@ func (_c *MockAccountKeeper_GetModuleAddress_Call) RunAndReturn(run func(string) } // GetSequence provides a mock function with given fields: _a0, _a1 -func (_m *MockAccountKeeper) GetSequence(_a0 types.Context, _a1 types.AccAddress) (uint64, error) { +func (_m *MockAccountKeeper) GetSequence(_a0 context.Context, _a1 types.AccAddress) (uint64, error) { ret := _m.Called(_a0, _a1) if len(ret) == 0 { @@ -129,17 +130,18 @@ func (_m *MockAccountKeeper) GetSequence(_a0 types.Context, _a1 types.AccAddress var r0 uint64 var r1 error + sdkCtx := types.UnwrapSDKContext(_a0) if rf, ok := ret.Get(0).(func(types.Context, types.AccAddress) (uint64, error)); ok { - return rf(_a0, _a1) + return rf(sdkCtx, _a1) } if rf, ok := ret.Get(0).(func(types.Context, types.AccAddress) uint64); ok { - r0 = rf(_a0, _a1) + r0 = rf(sdkCtx, _a1) } else { r0 = ret.Get(0).(uint64) } if rf, ok := ret.Get(1).(func(types.Context, types.AccAddress) error); ok { - r1 = rf(_a0, _a1) + r1 = rf(sdkCtx, _a1) } else { r1 = ret.Error(1) } diff --git a/x/precisebank/types/mocks/MockBankKeeper.go b/x/precisebank/types/mocks/MockBankKeeper.go index cb82341029..ba221bdb0f 100644 --- a/x/precisebank/types/mocks/MockBankKeeper.go +++ b/x/precisebank/types/mocks/MockBankKeeper.go @@ -3,6 +3,7 @@ package mocks import ( + "context" mock "github.com/stretchr/testify/mock" types "github.com/cosmos/cosmos-sdk/types" @@ -13,6 +14,9 @@ type MockBankKeeper struct { mock.Mock } +// need the method: IsSendEnabledCoins(ctx context.Context, coins ...sdk.Coin) error +// have the method: IsSendEnabledCoins(ctx types.Context, coins ...types.Coin) erro + type MockBankKeeper_Expecter struct { mock *mock.Mock } @@ -68,7 +72,7 @@ func (_c *MockBankKeeper_BlockedAddr_Call) RunAndReturn(run func(types.AccAddres } // BurnCoins provides a mock function with given fields: ctx, moduleName, amt -func (_m *MockBankKeeper) BurnCoins(ctx types.Context, moduleName string, amt types.Coins) error { +func (_m *MockBankKeeper) BurnCoins(ctx context.Context, moduleName string, amt types.Coins) error { ret := _m.Called(ctx, moduleName, amt) if len(ret) == 0 { @@ -76,8 +80,9 @@ func (_m *MockBankKeeper) BurnCoins(ctx types.Context, moduleName string, amt ty } var r0 error + sdkCtx := types.UnwrapSDKContext(ctx) if rf, ok := ret.Get(0).(func(types.Context, string, types.Coins) error); ok { - r0 = rf(ctx, moduleName, amt) + r0 = rf(sdkCtx, moduleName, amt) } else { r0 = ret.Error(0) } @@ -116,7 +121,7 @@ func (_c *MockBankKeeper_BurnCoins_Call) RunAndReturn(run func(types.Context, st } // GetBalance provides a mock function with given fields: ctx, addr, denom -func (_m *MockBankKeeper) GetBalance(ctx types.Context, addr types.AccAddress, denom string) types.Coin { +func (_m *MockBankKeeper) GetBalance(ctx context.Context, addr types.AccAddress, denom string) types.Coin { ret := _m.Called(ctx, addr, denom) if len(ret) == 0 { @@ -124,8 +129,9 @@ func (_m *MockBankKeeper) GetBalance(ctx types.Context, addr types.AccAddress, d } var r0 types.Coin + sdkCtx := types.UnwrapSDKContext(ctx) if rf, ok := ret.Get(0).(func(types.Context, types.AccAddress, string) types.Coin); ok { - r0 = rf(ctx, addr, denom) + r0 = rf(sdkCtx, addr, denom) } else { r0 = ret.Get(0).(types.Coin) } @@ -164,7 +170,7 @@ func (_c *MockBankKeeper_GetBalance_Call) RunAndReturn(run func(types.Context, t } // GetSupply provides a mock function with given fields: ctx, denom -func (_m *MockBankKeeper) GetSupply(ctx types.Context, denom string) types.Coin { +func (_m *MockBankKeeper) GetSupply(ctx context.Context, denom string) types.Coin { ret := _m.Called(ctx, denom) if len(ret) == 0 { @@ -172,8 +178,9 @@ func (_m *MockBankKeeper) GetSupply(ctx types.Context, denom string) types.Coin } var r0 types.Coin + sdkCtx := types.UnwrapSDKContext(ctx) if rf, ok := ret.Get(0).(func(types.Context, string) types.Coin); ok { - r0 = rf(ctx, denom) + r0 = rf(sdkCtx, denom) } else { r0 = ret.Get(0).(types.Coin) } @@ -211,7 +218,7 @@ func (_c *MockBankKeeper_GetSupply_Call) RunAndReturn(run func(types.Context, st } // IsSendEnabledCoins provides a mock function with given fields: ctx, coins -func (_m *MockBankKeeper) IsSendEnabledCoins(ctx types.Context, coins ...types.Coin) error { +func (_m *MockBankKeeper) IsSendEnabledCoins(ctx context.Context, coins ...types.Coin) error { _va := make([]interface{}, len(coins)) for _i := range coins { _va[_i] = coins[_i] @@ -226,8 +233,9 @@ func (_m *MockBankKeeper) IsSendEnabledCoins(ctx types.Context, coins ...types.C } var r0 error + sdkCtx := types.UnwrapSDKContext(ctx) if rf, ok := ret.Get(0).(func(types.Context, ...types.Coin) error); ok { - r0 = rf(ctx, coins...) + r0 = rf(sdkCtx, coins...) } else { r0 = ret.Error(0) } @@ -272,7 +280,7 @@ func (_c *MockBankKeeper_IsSendEnabledCoins_Call) RunAndReturn(run func(types.Co } // MintCoins provides a mock function with given fields: ctx, moduleName, amt -func (_m *MockBankKeeper) MintCoins(ctx types.Context, moduleName string, amt types.Coins) error { +func (_m *MockBankKeeper) MintCoins(ctx context.Context, moduleName string, amt types.Coins) error { ret := _m.Called(ctx, moduleName, amt) if len(ret) == 0 { @@ -280,8 +288,9 @@ func (_m *MockBankKeeper) MintCoins(ctx types.Context, moduleName string, amt ty } var r0 error + sdkCtx := types.UnwrapSDKContext(ctx) if rf, ok := ret.Get(0).(func(types.Context, string, types.Coins) error); ok { - r0 = rf(ctx, moduleName, amt) + r0 = rf(sdkCtx, moduleName, amt) } else { r0 = ret.Error(0) } @@ -320,7 +329,7 @@ func (_c *MockBankKeeper_MintCoins_Call) RunAndReturn(run func(types.Context, st } // SendCoins provides a mock function with given fields: ctx, fromAddr, toAddr, amt -func (_m *MockBankKeeper) SendCoins(ctx types.Context, fromAddr types.AccAddress, toAddr types.AccAddress, amt types.Coins) error { +func (_m *MockBankKeeper) SendCoins(ctx context.Context, fromAddr types.AccAddress, toAddr types.AccAddress, amt types.Coins) error { ret := _m.Called(ctx, fromAddr, toAddr, amt) if len(ret) == 0 { @@ -328,8 +337,9 @@ func (_m *MockBankKeeper) SendCoins(ctx types.Context, fromAddr types.AccAddress } var r0 error + sdkCtx := types.UnwrapSDKContext(ctx) if rf, ok := ret.Get(0).(func(types.Context, types.AccAddress, types.AccAddress, types.Coins) error); ok { - r0 = rf(ctx, fromAddr, toAddr, amt) + r0 = rf(sdkCtx, fromAddr, toAddr, amt) } else { r0 = ret.Error(0) } @@ -369,7 +379,7 @@ func (_c *MockBankKeeper_SendCoins_Call) RunAndReturn(run func(types.Context, ty } // SendCoinsFromAccountToModule provides a mock function with given fields: ctx, senderAddr, recipientModule, amt -func (_m *MockBankKeeper) SendCoinsFromAccountToModule(ctx types.Context, senderAddr types.AccAddress, recipientModule string, amt types.Coins) error { +func (_m *MockBankKeeper) SendCoinsFromAccountToModule(ctx context.Context, senderAddr types.AccAddress, recipientModule string, amt types.Coins) error { ret := _m.Called(ctx, senderAddr, recipientModule, amt) if len(ret) == 0 { @@ -377,8 +387,9 @@ func (_m *MockBankKeeper) SendCoinsFromAccountToModule(ctx types.Context, sender } var r0 error + sdkCtx := types.UnwrapSDKContext(ctx) if rf, ok := ret.Get(0).(func(types.Context, types.AccAddress, string, types.Coins) error); ok { - r0 = rf(ctx, senderAddr, recipientModule, amt) + r0 = rf(sdkCtx, senderAddr, recipientModule, amt) } else { r0 = ret.Error(0) } @@ -418,7 +429,7 @@ func (_c *MockBankKeeper_SendCoinsFromAccountToModule_Call) RunAndReturn(run fun } // SendCoinsFromModuleToAccount provides a mock function with given fields: ctx, senderModule, recipientAddr, amt -func (_m *MockBankKeeper) SendCoinsFromModuleToAccount(ctx types.Context, senderModule string, recipientAddr types.AccAddress, amt types.Coins) error { +func (_m *MockBankKeeper) SendCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr types.AccAddress, amt types.Coins) error { ret := _m.Called(ctx, senderModule, recipientAddr, amt) if len(ret) == 0 { @@ -426,8 +437,9 @@ func (_m *MockBankKeeper) SendCoinsFromModuleToAccount(ctx types.Context, sender } var r0 error + sdkCtx := types.UnwrapSDKContext(ctx) if rf, ok := ret.Get(0).(func(types.Context, string, types.AccAddress, types.Coins) error); ok { - r0 = rf(ctx, senderModule, recipientAddr, amt) + r0 = rf(sdkCtx, senderModule, recipientAddr, amt) } else { r0 = ret.Error(0) } @@ -467,7 +479,7 @@ func (_c *MockBankKeeper_SendCoinsFromModuleToAccount_Call) RunAndReturn(run fun } // SendCoinsFromModuleToModule provides a mock function with given fields: ctx, senderModule, recipientModule, amt -func (_m *MockBankKeeper) SendCoinsFromModuleToModule(ctx types.Context, senderModule string, recipientModule string, amt types.Coins) error { +func (_m *MockBankKeeper) SendCoinsFromModuleToModule(ctx context.Context, senderModule string, recipientModule string, amt types.Coins) error { ret := _m.Called(ctx, senderModule, recipientModule, amt) if len(ret) == 0 { @@ -475,8 +487,9 @@ func (_m *MockBankKeeper) SendCoinsFromModuleToModule(ctx types.Context, senderM } var r0 error + sdkCtx := types.UnwrapSDKContext(ctx) if rf, ok := ret.Get(0).(func(types.Context, string, string, types.Coins) error); ok { - r0 = rf(ctx, senderModule, recipientModule, amt) + r0 = rf(sdkCtx, senderModule, recipientModule, amt) } else { r0 = ret.Error(0) } @@ -516,7 +529,7 @@ func (_c *MockBankKeeper_SendCoinsFromModuleToModule_Call) RunAndReturn(run func } // SpendableCoin provides a mock function with given fields: ctx, addr, denom -func (_m *MockBankKeeper) SpendableCoin(ctx types.Context, addr types.AccAddress, denom string) types.Coin { +func (_m *MockBankKeeper) SpendableCoin(ctx context.Context, addr types.AccAddress, denom string) types.Coin { ret := _m.Called(ctx, addr, denom) if len(ret) == 0 { @@ -524,8 +537,9 @@ func (_m *MockBankKeeper) SpendableCoin(ctx types.Context, addr types.AccAddress } var r0 types.Coin + sdkCtx := types.UnwrapSDKContext(ctx) if rf, ok := ret.Get(0).(func(types.Context, types.AccAddress, string) types.Coin); ok { - r0 = rf(ctx, addr, denom) + r0 = rf(sdkCtx, addr, denom) } else { r0 = ret.Get(0).(types.Coin) } diff --git a/x/precisebank/types/query.pb.go b/x/precisebank/types/query.pb.go index b324a2252e..203ecc95a6 100644 --- a/x/precisebank/types/query.pb.go +++ b/x/precisebank/types/query.pb.go @@ -451,6 +451,7 @@ func _Query_FractionalBalance_Handler(srv interface{}, ctx context.Context, dec return interceptor(ctx, in, info, handler) } +var Query_serviceDesc = _Query_serviceDesc var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "kava.precisebank.v1.Query", HandlerType: (*QueryServer)(nil), diff --git a/x/pricefeed/client/cli/tx.go b/x/pricefeed/client/cli/tx.go index 0b41cde0f9..61fdbbcd6f 100644 --- a/x/pricefeed/client/cli/tx.go +++ b/x/pricefeed/client/cli/tx.go @@ -1,6 +1,7 @@ package cli import ( + sdkmath "cosmossdk.io/math" "fmt" "strconv" "time" @@ -10,7 +11,6 @@ import ( "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/tx" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/version" tmtime "github.com/cometbft/cometbft/types/time" @@ -55,7 +55,7 @@ func GetCmdPostPrice() *cobra.Command { return err } - price, err := sdk.NewDecFromStr(args[1]) + price, err := sdkmath.LegacyNewDecFromStr(args[1]) if err != nil { return err } diff --git a/x/pricefeed/genesis_test.go b/x/pricefeed/genesis_test.go index b8d0889d0f..0513027de2 100644 --- a/x/pricefeed/genesis_test.go +++ b/x/pricefeed/genesis_test.go @@ -25,7 +25,7 @@ type GenesisTestSuite struct { func (suite *GenesisTestSuite) SetupTest() { suite.tApp = app.NewTestApp() - suite.ctx = suite.tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + suite.ctx = suite.tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) suite.keeper = suite.tApp.GetPriceFeedKeeper() } diff --git a/x/pricefeed/integration_test.go b/x/pricefeed/integration_test.go index b8d230f7e5..1c5d9ef3d3 100644 --- a/x/pricefeed/integration_test.go +++ b/x/pricefeed/integration_test.go @@ -1,6 +1,7 @@ package pricefeed_test import ( + sdkmath "cosmossdk.io/math" "time" sdk "github.com/cosmos/cosmos-sdk/types" @@ -21,13 +22,13 @@ func NewPricefeedGen() types.GenesisState { { MarketID: "btc:usd", OracleAddress: sdk.AccAddress("oracle1"), - Price: sdk.MustNewDecFromStr("8000.00"), + Price: sdkmath.LegacyMustNewDecFromStr("8000.00"), Expiry: time.Now().Add(1 * time.Hour), }, { MarketID: "xrp:usd", OracleAddress: sdk.AccAddress("oracle2"), - Price: sdk.MustNewDecFromStr("0.25"), + Price: sdkmath.LegacyMustNewDecFromStr("0.25"), Expiry: time.Now().Add(1 * time.Hour), }, }, @@ -51,13 +52,13 @@ func NewPricefeedGenStateWithOracles(addrs []sdk.AccAddress) app.GenesisState { { MarketID: "btc:usd", OracleAddress: addrs[0], - Price: sdk.MustNewDecFromStr("8000.00"), + Price: sdkmath.LegacyMustNewDecFromStr("8000.00"), Expiry: time.Now().Add(1 * time.Hour), }, { MarketID: "xrp:usd", OracleAddress: addrs[0], - Price: sdk.MustNewDecFromStr("0.25"), + Price: sdkmath.LegacyMustNewDecFromStr("0.25"), Expiry: time.Now().Add(1 * time.Hour), }, }, diff --git a/x/pricefeed/keeper/grpc_query_test.go b/x/pricefeed/keeper/grpc_query_test.go index abe950dc50..ebdb2c0139 100644 --- a/x/pricefeed/keeper/grpc_query_test.go +++ b/x/pricefeed/keeper/grpc_query_test.go @@ -1,10 +1,12 @@ package keeper_test import ( + sdkmath "cosmossdk.io/math" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + tmtime "github.com/cometbft/cometbft/types/time" "testing" "time" - tmprototypes "github.com/cometbft/cometbft/proto/tendermint/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/kava-labs/kava/app" "github.com/kava-labs/kava/x/pricefeed/keeper" @@ -26,8 +28,7 @@ type grpcQueryTestSuite struct { func (suite *grpcQueryTestSuite) SetupTest() { suite.tApp = app.NewTestApp() - suite.ctx = suite.tApp.NewContext(true, tmprototypes.Header{}). - WithBlockTime(time.Now().UTC()) + suite.ctx = suite.tApp.NewContextLegacy(true, tmproto.Header{Time: tmtime.Now().UTC()}) suite.keeper = suite.tApp.GetPriceFeedKeeper() suite.queryServer = keeper.NewQueryServerImpl(suite.keeper) @@ -82,7 +83,7 @@ func (suite *grpcQueryTestSuite) TestGrpcPrice() { suite.setTestParams() suite.setTstPrice() - expectedPrice := types.NewCurrentPriceResponse("tstusd", sdk.MustNewDecFromStr("0.34")) + expectedPrice := types.NewCurrentPriceResponse("tstusd", sdkmath.LegacyMustNewDecFromStr("0.34")) res, err := suite.queryServer.Price(sdk.WrapSDKContext(suite.ctx), &types.QueryPriceRequest{MarketId: "tstusd"}) suite.NoError(err) @@ -109,7 +110,7 @@ func (suite *grpcQueryTestSuite) TestGrpcPrices() { suite.setTestParams() suite.setTstPrice() - expectedPrice := types.NewCurrentPriceResponse("tstusd", sdk.MustNewDecFromStr("0.34")) + expectedPrice := types.NewCurrentPriceResponse("tstusd", sdkmath.LegacyMustNewDecFromStr("0.34")) prices, err := suite.queryServer.Prices(sdk.WrapSDKContext(suite.ctx), &types.QueryPricesRequest{}) suite.NoError(err) @@ -126,7 +127,7 @@ func (suite *grpcQueryTestSuite) TestGrpcPrices_NoPriceSet() { _, err := suite.keeper.SetPrice( suite.ctx, suite.addrs[2], "tst:usd", - sdk.MustNewDecFromStr("0.34"), + sdkmath.LegacyMustNewDecFromStr("0.34"), suite.now.Add(time.Hour*1)) suite.NoError(err) @@ -136,7 +137,7 @@ func (suite *grpcQueryTestSuite) TestGrpcPrices_NoPriceSet() { // Set current price of "other:usd" with no individual prices in store _ = suite.keeper.SetCurrentPrices(suite.ctx, "other:usd") - expectedPrice := types.NewCurrentPriceResponse("tst:usd", sdk.MustNewDecFromStr("0.34")) + expectedPrice := types.NewCurrentPriceResponse("tst:usd", sdkmath.LegacyMustNewDecFromStr("0.34")) prices, err := suite.queryServer.Prices(sdk.WrapSDKContext(suite.ctx), &types.QueryPricesRequest{}) suite.NoError(err) @@ -159,19 +160,19 @@ func (suite *grpcQueryTestSuite) TestGrpcRawPrices() { types.NewPostedPriceResponse( "tstusd", suite.addrs[0], - sdk.MustNewDecFromStr("0.33"), + sdkmath.LegacyMustNewDecFromStr("0.33"), suite.now.Add(time.Hour*1), ), types.NewPostedPriceResponse( "tstusd", suite.addrs[1], - sdk.MustNewDecFromStr("0.35"), + sdkmath.LegacyMustNewDecFromStr("0.35"), suite.now.Add(time.Hour*1), ), types.NewPostedPriceResponse( "tstusd", suite.addrs[2], - sdk.MustNewDecFromStr("0.34"), + sdkmath.LegacyMustNewDecFromStr("0.34"), suite.now.Add(time.Hour*1), ), }, @@ -245,19 +246,19 @@ func (suite *grpcQueryTestSuite) TestGrpcMarkets() { func (suite *grpcQueryTestSuite) setTstPrice() { _, err := suite.keeper.SetPrice( suite.ctx, suite.addrs[0], "tstusd", - sdk.MustNewDecFromStr("0.33"), + sdkmath.LegacyMustNewDecFromStr("0.33"), suite.now.Add(time.Hour*1)) suite.NoError(err) _, err = suite.keeper.SetPrice( suite.ctx, suite.addrs[1], "tstusd", - sdk.MustNewDecFromStr("0.35"), + sdkmath.LegacyMustNewDecFromStr("0.35"), suite.now.Add(time.Hour*1)) suite.NoError(err) _, err = suite.keeper.SetPrice( suite.ctx, suite.addrs[2], "tstusd", - sdk.MustNewDecFromStr("0.34"), + sdkmath.LegacyMustNewDecFromStr("0.34"), suite.now.Add(time.Hour*1)) suite.NoError(err) diff --git a/x/pricefeed/keeper/integration_test.go b/x/pricefeed/keeper/integration_test.go index e2c1cff64b..6f34347a15 100644 --- a/x/pricefeed/keeper/integration_test.go +++ b/x/pricefeed/keeper/integration_test.go @@ -1,6 +1,7 @@ package keeper_test import ( + sdkmath "cosmossdk.io/math" "time" sdk "github.com/cosmos/cosmos-sdk/types" @@ -21,13 +22,13 @@ func NewPricefeedGenStateMulti() app.GenesisState { { MarketID: "btc:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("8000.00"), + Price: sdkmath.LegacyMustNewDecFromStr("8000.00"), Expiry: time.Now().Add(1 * time.Hour), }, { MarketID: "xrp:usd", OracleAddress: sdk.AccAddress{}, - Price: sdk.MustNewDecFromStr("0.25"), + Price: sdkmath.LegacyMustNewDecFromStr("0.25"), Expiry: time.Now().Add(1 * time.Hour), }, }, diff --git a/x/pricefeed/keeper/keeper.go b/x/pricefeed/keeper/keeper.go index 95c65f7bb9..7c8767b84f 100644 --- a/x/pricefeed/keeper/keeper.go +++ b/x/pricefeed/keeper/keeper.go @@ -1,15 +1,16 @@ package keeper import ( + sdkmath "cosmossdk.io/math" "fmt" "sort" "time" - "github.com/cometbft/cometbft/libs/log" + "cosmossdk.io/log" errorsmod "cosmossdk.io/errors" + storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/codec" - storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" @@ -51,7 +52,7 @@ func (k Keeper) SetPrice( ctx sdk.Context, oracle sdk.AccAddress, marketID string, - price sdk.Dec, + price sdkmath.LegacyDec, expiry time.Time, ) (types.PostedPrice, error) { // If the expiry is less than or equal to the current blockheight, we consider the price valid @@ -143,7 +144,7 @@ func (k Keeper) SetCurrentPricesForAllMarkets(ctx sdk.Context) { } } - iterator := sdk.KVStorePrefixIterator(ctx.KVStore(k.key), types.RawPriceFeedPrefix) + iterator := storetypes.KVStorePrefixIterator(ctx.KVStore(k.key), types.RawPriceFeedPrefix) for ; iterator.Valid(); iterator.Next() { var postedPrice types.PostedPrice k.cdc.MustUnmarshal(iterator.Value(), &postedPrice) @@ -205,7 +206,7 @@ func (k Keeper) setCurrentPrice(ctx sdk.Context, marketID string, currentPrice t } // CalculateMedianPrice calculates the median prices for the input prices. -func (k Keeper) CalculateMedianPrice(prices []types.CurrentPrice) sdk.Dec { +func (k Keeper) CalculateMedianPrice(prices []types.CurrentPrice) sdkmath.LegacyDec { l := len(prices) if l == 1 { @@ -225,9 +226,9 @@ func (k Keeper) CalculateMedianPrice(prices []types.CurrentPrice) sdk.Dec { return prices[l/2].Price } -func (k Keeper) calculateMeanPrice(priceA, priceB types.CurrentPrice) sdk.Dec { +func (k Keeper) calculateMeanPrice(priceA, priceB types.CurrentPrice) sdkmath.LegacyDec { sum := priceA.Price.Add(priceB.Price) - mean := sum.Quo(sdk.NewDec(2)) + mean := sum.Quo(sdkmath.LegacyNewDec(2)) return mean } @@ -244,7 +245,7 @@ func (k Keeper) GetCurrentPrice(ctx sdk.Context, marketID string) (types.Current if err != nil { return types.CurrentPrice{}, err } - if price.Price.Equal(sdk.ZeroDec()) { + if price.Price.Equal(sdkmath.LegacyZeroDec()) { return types.CurrentPrice{}, types.ErrNoValidPrice } return price, nil @@ -252,7 +253,7 @@ func (k Keeper) GetCurrentPrice(ctx sdk.Context, marketID string) (types.Current // IterateCurrentPrices iterates over all current price objects in the store and performs a callback function func (k Keeper) IterateCurrentPrices(ctx sdk.Context, cb func(cp types.CurrentPrice) (stop bool)) { - iterator := sdk.KVStorePrefixIterator(ctx.KVStore(k.key), types.CurrentPricePrefix) + iterator := storetypes.KVStorePrefixIterator(ctx.KVStore(k.key), types.CurrentPricePrefix) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { var cp types.CurrentPrice @@ -285,7 +286,7 @@ func (k Keeper) GetRawPrices(ctx sdk.Context, marketId string) types.PostedPrice // IterateRawPrices iterates over all raw prices in the store and performs a callback function func (k Keeper) IterateRawPricesByMarket(ctx sdk.Context, marketId string, cb func(record types.PostedPrice) (stop bool)) { - iterator := sdk.KVStorePrefixIterator(ctx.KVStore(k.key), types.RawPriceIteratorKey((marketId))) + iterator := storetypes.KVStorePrefixIterator(ctx.KVStore(k.key), types.RawPriceIteratorKey((marketId))) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { var record types.PostedPrice diff --git a/x/pricefeed/keeper/keeper_test.go b/x/pricefeed/keeper/keeper_test.go index ec7289a2ac..caaeb44a23 100644 --- a/x/pricefeed/keeper/keeper_test.go +++ b/x/pricefeed/keeper/keeper_test.go @@ -1,7 +1,10 @@ package keeper_test import ( + sdkmath "cosmossdk.io/math" "errors" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + tmtime "github.com/cometbft/cometbft/types/time" "testing" "time" @@ -9,8 +12,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" - tmprototypes "github.com/cometbft/cometbft/proto/tendermint/types" - "github.com/kava-labs/kava/app" "github.com/kava-labs/kava/x/pricefeed/keeper" "github.com/kava-labs/kava/x/pricefeed/testutil" @@ -20,7 +21,7 @@ import ( // TestKeeper_SetGetMarket tests adding markets to the pricefeed, getting markets from the store func TestKeeper_SetGetMarket(t *testing.T) { tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmprototypes.Header{}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{}) keeper := tApp.GetPriceFeedKeeper() mp := types.Params{ @@ -59,7 +60,7 @@ func TestKeeper_SetGetMarket(t *testing.T) { func TestKeeper_GetSetPrice(t *testing.T) { _, addrs := app.GeneratePrivKeyAddressPairs(2) tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmprototypes.Header{}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{}) keeper := tApp.GetPriceFeedKeeper() mp := types.Params{ @@ -72,12 +73,12 @@ func TestKeeper_GetSetPrice(t *testing.T) { prices := []struct { oracle sdk.AccAddress marketID string - price sdk.Dec + price sdkmath.LegacyDec total int }{ - {addrs[0], "tstusd", sdk.MustNewDecFromStr("0.33"), 1}, - {addrs[1], "tstusd", sdk.MustNewDecFromStr("0.35"), 2}, - {addrs[0], "tstusd", sdk.MustNewDecFromStr("0.37"), 2}, + {addrs[0], "tstusd", sdkmath.LegacyMustNewDecFromStr("0.33"), 1}, + {addrs[1], "tstusd", sdkmath.LegacyMustNewDecFromStr("0.35"), 2}, + {addrs[0], "tstusd", sdkmath.LegacyMustNewDecFromStr("0.37"), 2}, } for _, p := range prices { @@ -111,8 +112,7 @@ func TestKeeper_GetSetPrice(t *testing.T) { func TestKeeper_GetSetCurrentPrice(t *testing.T) { _, addrs := app.GeneratePrivKeyAddressPairs(5) tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmprototypes.Header{}). - WithBlockTime(time.Now().UTC()) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Time: tmtime.Now().UTC()}) keeper := tApp.GetPriceFeedKeeper() mp := types.Params{ @@ -124,33 +124,33 @@ func TestKeeper_GetSetCurrentPrice(t *testing.T) { _, err := keeper.SetPrice( ctx, addrs[0], "tstusd", - sdk.MustNewDecFromStr("0.33"), + sdkmath.LegacyMustNewDecFromStr("0.33"), time.Now().Add(time.Hour*1)) require.NoError(t, err) _, err = keeper.SetPrice( ctx, addrs[1], "tstusd", - sdk.MustNewDecFromStr("0.35"), + sdkmath.LegacyMustNewDecFromStr("0.35"), time.Now().Add(time.Hour*1)) require.NoError(t, err) _, err = keeper.SetPrice( ctx, addrs[2], "tstusd", - sdk.MustNewDecFromStr("0.34"), + sdkmath.LegacyMustNewDecFromStr("0.34"), time.Now().Add(time.Hour*1)) require.NoError(t, err) // Add an expired one which should fail _, err = keeper.SetPrice( ctx, addrs[3], "tstusd", - sdk.MustNewDecFromStr("0.9"), + sdkmath.LegacyMustNewDecFromStr("0.9"), ctx.BlockTime().Add(-time.Hour*1)) require.Error(t, err) // Add a non-expired price, but will not be counted when BlockTime is changed _, err = keeper.SetPrice( ctx, addrs[3], "tstusd", - sdk.MustNewDecFromStr("0.9"), + sdkmath.LegacyMustNewDecFromStr("0.9"), time.Now().Add(time.Minute*30)) require.NoError(t, err) @@ -165,7 +165,7 @@ func TestKeeper_GetSetCurrentPrice(t *testing.T) { price, err := keeper.GetCurrentPrice(ctx, "tstusd") require.Nil(t, err) - expCurPrice := sdk.MustNewDecFromStr("0.34") + expCurPrice := sdkmath.LegacyMustNewDecFromStr("0.34") require.Truef( t, price.Price.Equal(expCurPrice), @@ -176,7 +176,7 @@ func TestKeeper_GetSetCurrentPrice(t *testing.T) { // Even number of oracles _, err = keeper.SetPrice( ctx, addrs[4], "tstusd", - sdk.MustNewDecFromStr("0.36"), + sdkmath.LegacyMustNewDecFromStr("0.36"), time.Now().Add(time.Hour*1)) require.NoError(t, err) @@ -186,7 +186,7 @@ func TestKeeper_GetSetCurrentPrice(t *testing.T) { price, err = keeper.GetCurrentPrice(ctx, "tstusd") require.Nil(t, err) - exp := sdk.MustNewDecFromStr("0.345") + exp := sdkmath.LegacyMustNewDecFromStr("0.345") require.Truef(t, price.Price.Equal(exp), "current price %s should be %s", price.Price.String(), @@ -201,8 +201,7 @@ func TestKeeper_GetSetCurrentPrice(t *testing.T) { func TestKeeper_ExpiredSetCurrentPrices(t *testing.T) { _, addrs := app.GeneratePrivKeyAddressPairs(5) tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmprototypes.Header{}). - WithBlockTime(time.Now().UTC()) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Time: tmtime.Now().UTC()}) keeper := tApp.GetPriceFeedKeeper() mp := types.Params{ @@ -214,19 +213,19 @@ func TestKeeper_ExpiredSetCurrentPrices(t *testing.T) { _, err := keeper.SetPrice( ctx, addrs[0], "tstusd", - sdk.MustNewDecFromStr("0.33"), + sdkmath.LegacyMustNewDecFromStr("0.33"), time.Now().Add(time.Hour*1)) require.NoError(t, err) _, err = keeper.SetPrice( ctx, addrs[1], "tstusd", - sdk.MustNewDecFromStr("0.35"), + sdkmath.LegacyMustNewDecFromStr("0.35"), time.Now().Add(time.Hour*1)) require.NoError(t, err) _, err = keeper.SetPrice( ctx, addrs[2], "tstusd", - sdk.MustNewDecFromStr("0.34"), + sdkmath.LegacyMustNewDecFromStr("0.34"), time.Now().Add(time.Hour*1)) require.NoError(t, err) diff --git a/x/pricefeed/keeper/msg_server_test.go b/x/pricefeed/keeper/msg_server_test.go index 2ffcd8bbfa..4279c08c6d 100644 --- a/x/pricefeed/keeper/msg_server_test.go +++ b/x/pricefeed/keeper/msg_server_test.go @@ -1,10 +1,12 @@ package keeper_test import ( + sdkmath "cosmossdk.io/math" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + tmtime "github.com/cometbft/cometbft/types/time" "testing" "time" - tmprototypes "github.com/cometbft/cometbft/proto/tendermint/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/kava-labs/kava/app" "github.com/kava-labs/kava/x/pricefeed/keeper" @@ -15,8 +17,7 @@ import ( func TestKeeper_PostPrice(t *testing.T) { _, addrs := app.GeneratePrivKeyAddressPairs(4) tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmprototypes.Header{}). - WithBlockTime(time.Now().UTC()) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Time: tmtime.Now().UTC()}) k := tApp.GetPriceFeedKeeper() msgSrv := keeper.NewMsgServerImpl(k) @@ -49,7 +50,7 @@ func TestKeeper_PostPrice(t *testing.T) { for _, tt := range tests { t.Run(tt.giveMsg, func(t *testing.T) { // Use MsgServer over keeper methods directly to tests against valid oracles - msg := types.NewMsgPostPrice(tt.giveOracle.String(), tt.giveMarketId, sdk.MustNewDecFromStr("0.5"), tt.giveExpiry) + msg := types.NewMsgPostPrice(tt.giveOracle.String(), tt.giveMarketId, sdkmath.LegacyMustNewDecFromStr("0.5"), tt.giveExpiry) _, err := msgSrv.PostPrice(sdk.WrapSDKContext(ctx), msg) if tt.wantAccepted { diff --git a/x/pricefeed/keeper/params_test.go b/x/pricefeed/keeper/params_test.go index ffad3c889d..b233cf910a 100644 --- a/x/pricefeed/keeper/params_test.go +++ b/x/pricefeed/keeper/params_test.go @@ -25,7 +25,7 @@ type KeeperTestSuite struct { func (suite *KeeperTestSuite) SetupTest() { tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmprototypes.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmprototypes.Header{Height: 1, Time: tmtime.Now()}) tApp.InitializeFromGenesisStates( NewPricefeedGenStateMulti(), ) diff --git a/x/pricefeed/legacy/v0_15/types.go b/x/pricefeed/legacy/v0_15/types.go index 0a9b672251..e322a22e99 100644 --- a/x/pricefeed/legacy/v0_15/types.go +++ b/x/pricefeed/legacy/v0_15/types.go @@ -1,6 +1,7 @@ package v0_15 import ( + sdkmath "cosmossdk.io/math" "time" sdk "github.com/cosmos/cosmos-sdk/types" @@ -39,8 +40,8 @@ type PostedPrices []PostedPrice // PostedPrice price for market posted by a specific oracle type PostedPrice struct { - MarketID string `json:"market_id" yaml:"market_id"` - OracleAddress sdk.AccAddress `json:"oracle_address" yaml:"oracle_address"` - Price sdk.Dec `json:"price" yaml:"price"` - Expiry time.Time `json:"expiry" yaml:"expiry"` + MarketID string `json:"market_id" yaml:"market_id"` + OracleAddress sdk.AccAddress `json:"oracle_address" yaml:"oracle_address"` + Price sdkmath.LegacyDec `json:"price" yaml:"price"` + Expiry time.Time `json:"expiry" yaml:"expiry"` } diff --git a/x/pricefeed/legacy/v0_16/migrate_test.go b/x/pricefeed/legacy/v0_16/migrate_test.go index 81f2e12039..d91c13014c 100644 --- a/x/pricefeed/legacy/v0_16/migrate_test.go +++ b/x/pricefeed/legacy/v0_16/migrate_test.go @@ -1,6 +1,7 @@ package v0_16 import ( + sdkmath "cosmossdk.io/math" "testing" "time" @@ -319,13 +320,13 @@ func (s *migrateTestSuite) TestMigrate_PostedPrices() { { MarketID: "market-1", OracleAddress: s.addresses[0], - Price: sdk.MustNewDecFromStr("1.2"), + Price: sdkmath.LegacyMustNewDecFromStr("1.2"), Expiry: time.Date(2020, time.January, 1, 0, 0, 0, 0, time.UTC), }, { MarketID: "market-2", OracleAddress: s.addresses[1], - Price: sdk.MustNewDecFromStr("1.899"), + Price: sdkmath.LegacyMustNewDecFromStr("1.899"), Expiry: time.Date(2021, time.January, 1, 0, 0, 0, 0, time.UTC), }, } @@ -333,13 +334,13 @@ func (s *migrateTestSuite) TestMigrate_PostedPrices() { { MarketID: "market-1", OracleAddress: s.addresses[0], - Price: sdk.MustNewDecFromStr("1.2"), + Price: sdkmath.LegacyMustNewDecFromStr("1.2"), Expiry: time.Date(2020, time.January, 1, 0, 0, 0, 0, time.UTC), }, { MarketID: "market-2", OracleAddress: s.addresses[1], - Price: sdk.MustNewDecFromStr("1.899"), + Price: sdkmath.LegacyMustNewDecFromStr("1.899"), Expiry: time.Date(2021, time.January, 1, 0, 0, 0, 0, time.UTC), }, } diff --git a/x/pricefeed/module.go b/x/pricefeed/module.go index 11ceb784b4..ca1106167c 100644 --- a/x/pricefeed/module.go +++ b/x/pricefeed/module.go @@ -2,6 +2,7 @@ package pricefeed import ( "context" + "cosmossdk.io/core/appmodule" "encoding/json" "github.com/grpc-ecosystem/grpc-gateway/runtime" @@ -24,6 +25,8 @@ import ( var ( _ module.AppModule = AppModule{} _ module.AppModuleBasic = AppModuleBasic{} + + _ appmodule.HasEndBlocker = AppModule{} ) // AppModuleBasic app module basics object @@ -133,12 +136,18 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // BeginBlock module begin-block -func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) { +func (am AppModule) BeginBlock(_ sdk.Context) error { + return nil } // EndBlock module end-block -func (am AppModule) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - EndBlocker(ctx, am.keeper) +func (am AppModule) EndBlock(ctx context.Context) error { + sdkCtx := sdk.UnwrapSDKContext(ctx) + EndBlocker(sdkCtx, am.keeper) - return []abci.ValidatorUpdate{} + return nil } + +func (AppModule) IsOnePerModuleType() {} + +func (AppModule) IsAppModule() {} diff --git a/x/pricefeed/spec/02_state.md b/x/pricefeed/spec/02_state.md index 6fd95426f9..1b74c69ac9 100644 --- a/x/pricefeed/spec/02_state.md +++ b/x/pricefeed/spec/02_state.md @@ -39,7 +39,7 @@ type GenesisState struct { type PostedPrice struct { MarketID string `json:"market_id" yaml:"market_id"` OracleAddress sdk.AccAddress `json:"oracle_address" yaml:"oracle_address"` - Price sdk.Dec `json:"price" yaml:"price"` + Price sdkmath.LegacyDec `json:"price" yaml:"price"` Expiry time.Time `json:"expiry" yaml:"expiry"` } diff --git a/x/pricefeed/spec/03_messages.md b/x/pricefeed/spec/03_messages.md index fb26c47eb6..696e200002 100644 --- a/x/pricefeed/spec/03_messages.md +++ b/x/pricefeed/spec/03_messages.md @@ -14,7 +14,7 @@ An authorized oraclef for a particular market can post the current price for tha type MsgPostPrice struct { From sdk.AccAddress `json:"from" yaml:"from"` // client that sent in this address MarketID string `json:"market_id" yaml:"market_id"` // asset code used by exchanges/api - Price sdk.Dec `json:"price" yaml:"price"` // price in decimal (max precision 18) + Price sdkmath.LegacyDec `json:"price" yaml:"price"` // price in decimal (max precision 18) Expiry time.Time `json:"expiry" yaml:"expiry"` // expiry time } ``` diff --git a/x/pricefeed/testutil/helpers.go b/x/pricefeed/testutil/helpers.go index 76db45f16c..737dfe81e3 100644 --- a/x/pricefeed/testutil/helpers.go +++ b/x/pricefeed/testutil/helpers.go @@ -1,10 +1,12 @@ package testutil import ( + sdkmath "cosmossdk.io/math" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + tmtime "github.com/cometbft/cometbft/types/time" "testing" "time" - tmprototypes "github.com/cometbft/cometbft/proto/tendermint/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -17,8 +19,7 @@ import ( func SetCurrentPrices_PriceCalculations(t *testing.T, f func(ctx sdk.Context, keeper keeper.Keeper)) { _, addrs := app.GeneratePrivKeyAddressPairs(5) tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmprototypes.Header{}). - WithBlockTime(time.Now().UTC()) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Time: tmtime.Now().UTC()}) keeper := tApp.GetPriceFeedKeeper() params := types.Params{ @@ -41,13 +42,13 @@ func SetCurrentPrices_PriceCalculations(t *testing.T, f func(ctx sdk.Context, ke blockTime := time.Now() initialPriceExpiry := blockTime.Add(1 * time.Hour) - _, err := keeper.SetPrice(ctx, addrs[0], "asset1:usd", sdk.MustNewDecFromStr("1"), initialPriceExpiry) + _, err := keeper.SetPrice(ctx, addrs[0], "asset1:usd", sdkmath.LegacyMustNewDecFromStr("1"), initialPriceExpiry) require.NoError(t, err) - _, err = keeper.SetPrice(ctx, addrs[0], "asset2:usd", sdk.MustNewDecFromStr("1"), initialPriceExpiry) + _, err = keeper.SetPrice(ctx, addrs[0], "asset2:usd", sdkmath.LegacyMustNewDecFromStr("1"), initialPriceExpiry) require.NoError(t, err) - _, err = keeper.SetPrice(ctx, addrs[0], "asset4:usd", sdk.MustNewDecFromStr("1"), initialPriceExpiry) + _, err = keeper.SetPrice(ctx, addrs[0], "asset4:usd", sdkmath.LegacyMustNewDecFromStr("1"), initialPriceExpiry) require.NoError(t, err) - _, err = keeper.SetPrice(ctx, addrs[0], "asset5:usd", sdk.MustNewDecFromStr("10"), initialPriceExpiry) + _, err = keeper.SetPrice(ctx, addrs[0], "asset5:usd", sdkmath.LegacyMustNewDecFromStr("10"), initialPriceExpiry) require.NoError(t, err) ctx = ctx.WithBlockTime(blockTime) @@ -56,7 +57,7 @@ func SetCurrentPrices_PriceCalculations(t *testing.T, f func(ctx sdk.Context, ke // price should be set price, err := keeper.GetCurrentPrice(ctx, "asset1:usd") require.NoError(t, err) - require.Equal(t, sdk.OneDec(), price.Price) + require.Equal(t, sdkmath.LegacyOneDec(), price.Price) // not an active market, so price is not set price, err = keeper.GetCurrentPrice(ctx, "asset2:usd") require.Equal(t, types.ErrNoValidPrice, err) @@ -66,16 +67,16 @@ func SetCurrentPrices_PriceCalculations(t *testing.T, f func(ctx sdk.Context, ke // price set initially price, err = keeper.GetCurrentPrice(ctx, "asset4:usd") require.NoError(t, err) - require.Equal(t, sdk.OneDec(), price.Price) + require.Equal(t, sdkmath.LegacyOneDec(), price.Price) price, err = keeper.GetCurrentPrice(ctx, "asset5:usd") require.NoError(t, err) - require.Equal(t, sdk.MustNewDecFromStr("10.0"), price.Price) + require.Equal(t, sdkmath.LegacyMustNewDecFromStr("10.0"), price.Price) - _, err = keeper.SetPrice(ctx, addrs[1], "asset1:usd", sdk.MustNewDecFromStr("2"), initialPriceExpiry.Add(1*time.Hour)) + _, err = keeper.SetPrice(ctx, addrs[1], "asset1:usd", sdkmath.LegacyMustNewDecFromStr("2"), initialPriceExpiry.Add(1*time.Hour)) require.NoError(t, err) - _, err = keeper.SetPrice(ctx, addrs[1], "asset2:usd", sdk.MustNewDecFromStr("2"), initialPriceExpiry.Add(1*time.Hour)) + _, err = keeper.SetPrice(ctx, addrs[1], "asset2:usd", sdkmath.LegacyMustNewDecFromStr("2"), initialPriceExpiry.Add(1*time.Hour)) require.NoError(t, err) - _, err = keeper.SetPrice(ctx, addrs[1], "asset5:usd", sdk.MustNewDecFromStr("20"), initialPriceExpiry.Add(1*time.Hour)) + _, err = keeper.SetPrice(ctx, addrs[1], "asset5:usd", sdkmath.LegacyMustNewDecFromStr("20"), initialPriceExpiry.Add(1*time.Hour)) require.NoError(t, err) blockTime = blockTime.Add(30 * time.Minute) @@ -85,7 +86,7 @@ func SetCurrentPrices_PriceCalculations(t *testing.T, f func(ctx sdk.Context, ke // price should be set price, err = keeper.GetCurrentPrice(ctx, "asset1:usd") require.NoError(t, err) - require.Equal(t, sdk.MustNewDecFromStr("1.5"), price.Price) + require.Equal(t, sdkmath.LegacyMustNewDecFromStr("1.5"), price.Price) // not an active market, so price is not set price, err = keeper.GetCurrentPrice(ctx, "asset2:usd") require.Equal(t, types.ErrNoValidPrice, err) @@ -95,16 +96,16 @@ func SetCurrentPrices_PriceCalculations(t *testing.T, f func(ctx sdk.Context, ke // price set initially price, err = keeper.GetCurrentPrice(ctx, "asset4:usd") require.NoError(t, err) - require.Equal(t, sdk.OneDec(), price.Price) + require.Equal(t, sdkmath.LegacyOneDec(), price.Price) price, err = keeper.GetCurrentPrice(ctx, "asset5:usd") require.NoError(t, err) - require.Equal(t, sdk.MustNewDecFromStr("15.0"), price.Price) + require.Equal(t, sdkmath.LegacyMustNewDecFromStr("15.0"), price.Price) - _, err = keeper.SetPrice(ctx, addrs[2], "asset1:usd", sdk.MustNewDecFromStr("30"), initialPriceExpiry.Add(1*time.Hour)) + _, err = keeper.SetPrice(ctx, addrs[2], "asset1:usd", sdkmath.LegacyMustNewDecFromStr("30"), initialPriceExpiry.Add(1*time.Hour)) require.NoError(t, err) - _, err = keeper.SetPrice(ctx, addrs[2], "asset2:usd", sdk.MustNewDecFromStr("30"), initialPriceExpiry.Add(1*time.Hour)) + _, err = keeper.SetPrice(ctx, addrs[2], "asset2:usd", sdkmath.LegacyMustNewDecFromStr("30"), initialPriceExpiry.Add(1*time.Hour)) require.NoError(t, err) - _, err = keeper.SetPrice(ctx, addrs[2], "asset5:usd", sdk.MustNewDecFromStr("30"), initialPriceExpiry.Add(1*time.Hour)) + _, err = keeper.SetPrice(ctx, addrs[2], "asset5:usd", sdkmath.LegacyMustNewDecFromStr("30"), initialPriceExpiry.Add(1*time.Hour)) require.NoError(t, err) blockTime = blockTime.Add(15 * time.Minute) @@ -114,7 +115,7 @@ func SetCurrentPrices_PriceCalculations(t *testing.T, f func(ctx sdk.Context, ke // price should be set price, err = keeper.GetCurrentPrice(ctx, "asset1:usd") require.NoError(t, err) - require.Equal(t, sdk.MustNewDecFromStr("2.0"), price.Price) + require.Equal(t, sdkmath.LegacyMustNewDecFromStr("2.0"), price.Price) // not an active market, so price is not set price, err = keeper.GetCurrentPrice(ctx, "asset2:usd") require.Equal(t, types.ErrNoValidPrice, err) @@ -124,10 +125,10 @@ func SetCurrentPrices_PriceCalculations(t *testing.T, f func(ctx sdk.Context, ke // price set initially price, err = keeper.GetCurrentPrice(ctx, "asset4:usd") require.NoError(t, err) - require.Equal(t, sdk.OneDec(), price.Price) + require.Equal(t, sdkmath.LegacyOneDec(), price.Price) price, err = keeper.GetCurrentPrice(ctx, "asset5:usd") require.NoError(t, err) - require.Equal(t, sdk.MustNewDecFromStr("20.0"), price.Price) + require.Equal(t, sdkmath.LegacyMustNewDecFromStr("20.0"), price.Price) blockTime = blockTime.Add(15 * time.Minute) ctx = ctx.WithBlockTime(blockTime) @@ -136,7 +137,7 @@ func SetCurrentPrices_PriceCalculations(t *testing.T, f func(ctx sdk.Context, ke // price should be set price, err = keeper.GetCurrentPrice(ctx, "asset1:usd") require.NoError(t, err) - require.Equal(t, sdk.MustNewDecFromStr("16"), price.Price) + require.Equal(t, sdkmath.LegacyMustNewDecFromStr("16"), price.Price) // not an active market, so price is not set price, err = keeper.GetCurrentPrice(ctx, "asset2:usd") require.Equal(t, types.ErrNoValidPrice, err) @@ -148,7 +149,7 @@ func SetCurrentPrices_PriceCalculations(t *testing.T, f func(ctx sdk.Context, ke require.Equal(t, types.ErrNoValidPrice, err) price, err = keeper.GetCurrentPrice(ctx, "asset5:usd") require.NoError(t, err) - require.Equal(t, sdk.MustNewDecFromStr("25.0"), price.Price) + require.Equal(t, sdkmath.LegacyMustNewDecFromStr("25.0"), price.Price) blockTime = blockTime.Add(10 * time.Hour) ctx = ctx.WithBlockTime(blockTime) @@ -170,8 +171,7 @@ func SetCurrentPrices_PriceCalculations(t *testing.T, f func(ctx sdk.Context, ke func SetCurrentPrices_EventEmission(t *testing.T, f func(ctx sdk.Context, keeper keeper.Keeper)) { _, addrs := app.GeneratePrivKeyAddressPairs(5) tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmprototypes.Header{}). - WithBlockTime(time.Now().UTC()) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Time: tmtime.Now().UTC()}) keeper := tApp.GetPriceFeedKeeper() params := types.Params{ @@ -185,7 +185,7 @@ func SetCurrentPrices_EventEmission(t *testing.T, f func(ctx sdk.Context, keeper initialPriceExpiry := blockTime.Add(1 * time.Hour) // post a price - _, err := keeper.SetPrice(ctx, addrs[0], "asset1:usd", sdk.MustNewDecFromStr("1"), initialPriceExpiry) + _, err := keeper.SetPrice(ctx, addrs[0], "asset1:usd", sdkmath.LegacyMustNewDecFromStr("1"), initialPriceExpiry) require.NoError(t, err) // reset context with fresh event manager @@ -196,7 +196,7 @@ func SetCurrentPrices_EventEmission(t *testing.T, f func(ctx sdk.Context, keeper require.Equal(t, 0, len(ctx.EventManager().Events())) // post same price from another oracle - _, err = keeper.SetPrice(ctx, addrs[1], "asset1:usd", sdk.MustNewDecFromStr("1"), initialPriceExpiry) + _, err = keeper.SetPrice(ctx, addrs[1], "asset1:usd", sdkmath.LegacyMustNewDecFromStr("1"), initialPriceExpiry) require.NoError(t, err) blockTime = blockTime.Add(10 * time.Second) @@ -207,11 +207,11 @@ func SetCurrentPrices_EventEmission(t *testing.T, f func(ctx sdk.Context, keeper require.Equal(t, 0, len(ctx.EventManager().Events())) // post price changes - _, err = keeper.SetPrice(ctx, addrs[2], "asset1:usd", sdk.MustNewDecFromStr("2"), initialPriceExpiry) + _, err = keeper.SetPrice(ctx, addrs[2], "asset1:usd", sdkmath.LegacyMustNewDecFromStr("2"), initialPriceExpiry) require.NoError(t, err) - _, err = keeper.SetPrice(ctx, addrs[3], "asset1:usd", sdk.MustNewDecFromStr("10"), initialPriceExpiry) + _, err = keeper.SetPrice(ctx, addrs[3], "asset1:usd", sdkmath.LegacyMustNewDecFromStr("10"), initialPriceExpiry) require.NoError(t, err) - _, err = keeper.SetPrice(ctx, addrs[4], "asset1:usd", sdk.MustNewDecFromStr("10"), initialPriceExpiry) + _, err = keeper.SetPrice(ctx, addrs[4], "asset1:usd", sdkmath.LegacyMustNewDecFromStr("10"), initialPriceExpiry) require.NoError(t, err) blockTime = blockTime.Add(10 * time.Second) @@ -232,5 +232,5 @@ func SetCurrentPrices_EventEmission(t *testing.T, f func(ctx sdk.Context, keeper require.True(t, found) // attributes have correct values assert.Equal(t, "asset1:usd", marketID.Value) - assert.Equal(t, sdk.MustNewDecFromStr("2").String(), marketPrice.Value) + assert.Equal(t, sdkmath.LegacyMustNewDecFromStr("2").String(), marketPrice.Value) } diff --git a/x/pricefeed/types/codec.go b/x/pricefeed/types/codec.go index 2ac8f712c0..b03ea1acc6 100644 --- a/x/pricefeed/types/codec.go +++ b/x/pricefeed/types/codec.go @@ -6,7 +6,6 @@ import ( cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" - authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec" ) // RegisterLegacyAminoCodec registers all the necessary types and interfaces for the @@ -34,5 +33,5 @@ func init() { // Register all Amino interfaces and concrete types on the authz Amino codec so that this can later be // used to properly serialize MsgGrant and MsgExec instances - RegisterLegacyAminoCodec(authzcodec.Amino) + RegisterLegacyAminoCodec(codec.NewLegacyAmino()) } diff --git a/x/pricefeed/types/genesis_test.go b/x/pricefeed/types/genesis_test.go index acdc45b3a9..0cf26449f1 100644 --- a/x/pricefeed/types/genesis_test.go +++ b/x/pricefeed/types/genesis_test.go @@ -1,6 +1,7 @@ package types import ( + sdkmath "cosmossdk.io/math" "testing" "time" @@ -34,7 +35,7 @@ func TestGenesisStateValidate(t *testing.T) { NewParams([]Market{ {"market", "xrp", "bnb", []sdk.AccAddress{addr}, true}, }), - []PostedPrice{NewPostedPrice("xrp", addr, sdk.OneDec(), now)}, + []PostedPrice{NewPostedPrice("xrp", addr, sdkmath.LegacyOneDec(), now)}, ), expPass: true, }, @@ -44,7 +45,7 @@ func TestGenesisStateValidate(t *testing.T) { NewParams([]Market{ {"", "xrp", "bnb", []sdk.AccAddress{addr}, true}, }), - []PostedPrice{NewPostedPrice("xrp", addr, sdk.OneDec(), now)}, + []PostedPrice{NewPostedPrice("xrp", addr, sdkmath.LegacyOneDec(), now)}, ), expPass: false, }, @@ -55,7 +56,7 @@ func TestGenesisStateValidate(t *testing.T) { {"market", "xrp", "bnb", []sdk.AccAddress{addr}, true}, {"market", "xrp", "bnb", []sdk.AccAddress{addr}, true}, }), - []PostedPrice{NewPostedPrice("xrp", addr, sdk.OneDec(), now)}, + []PostedPrice{NewPostedPrice("xrp", addr, sdkmath.LegacyOneDec(), now)}, ), expPass: false, }, @@ -63,7 +64,7 @@ func TestGenesisStateValidate(t *testing.T) { msg: "invalid posted price", genesisState: NewGenesisState( NewParams([]Market{}), - []PostedPrice{NewPostedPrice("xrp", nil, sdk.OneDec(), now)}, + []PostedPrice{NewPostedPrice("xrp", nil, sdkmath.LegacyOneDec(), now)}, ), expPass: false, }, @@ -72,8 +73,8 @@ func TestGenesisStateValidate(t *testing.T) { genesisState: NewGenesisState( NewParams([]Market{}), []PostedPrice{ - NewPostedPrice("xrp", addr, sdk.OneDec(), now), - NewPostedPrice("xrp", addr, sdk.OneDec(), now), + NewPostedPrice("xrp", addr, sdkmath.LegacyOneDec(), now), + NewPostedPrice("xrp", addr, sdkmath.LegacyOneDec(), now), }, ), expPass: false, diff --git a/x/pricefeed/types/market.go b/x/pricefeed/types/market.go index 923260fa39..f6f9891d72 100644 --- a/x/pricefeed/types/market.go +++ b/x/pricefeed/types/market.go @@ -1,6 +1,7 @@ package types import ( + sdkmath "cosmossdk.io/math" "errors" "fmt" "strings" @@ -88,7 +89,7 @@ func NewMarketResponse(id, base, quote string, oracles []sdk.AccAddress, active type MarketResponses []MarketResponse // NewCurrentPrice returns an instance of CurrentPrice -func NewCurrentPrice(marketID string, price sdk.Dec) CurrentPrice { +func NewCurrentPrice(marketID string, price sdkmath.LegacyDec) CurrentPrice { return CurrentPrice{MarketID: marketID, Price: price} } @@ -96,7 +97,7 @@ func NewCurrentPrice(marketID string, price sdk.Dec) CurrentPrice { type CurrentPrices []CurrentPrice // NewCurrentPriceResponse returns an instance of CurrentPriceResponse -func NewCurrentPriceResponse(marketID string, price sdk.Dec) CurrentPriceResponse { +func NewCurrentPriceResponse(marketID string, price sdkmath.LegacyDec) CurrentPriceResponse { return CurrentPriceResponse{MarketID: marketID, Price: price} } @@ -104,7 +105,7 @@ func NewCurrentPriceResponse(marketID string, price sdk.Dec) CurrentPriceRespons type CurrentPriceResponses []CurrentPriceResponse // NewPostedPrice returns a new PostedPrice -func NewPostedPrice(marketID string, oracle sdk.AccAddress, price sdk.Dec, expiry time.Time) PostedPrice { +func NewPostedPrice(marketID string, oracle sdk.AccAddress, price sdkmath.LegacyDec, expiry time.Time) PostedPrice { return PostedPrice{ MarketID: marketID, OracleAddress: oracle, @@ -152,7 +153,7 @@ func (pps PostedPrices) Validate() error { } // NewPostedPrice returns a new PostedPrice -func NewPostedPriceResponse(marketID string, oracle sdk.AccAddress, price sdk.Dec, expiry time.Time) PostedPriceResponse { +func NewPostedPriceResponse(marketID string, oracle sdk.AccAddress, price sdkmath.LegacyDec, expiry time.Time) PostedPriceResponse { return PostedPriceResponse{ MarketID: marketID, OracleAddress: oracle.String(), @@ -164,8 +165,8 @@ func NewPostedPriceResponse(marketID string, oracle sdk.AccAddress, price sdk.De // PostedPriceResponses is a slice of PostedPriceResponse type PostedPriceResponses []PostedPriceResponse -// SortDecs provides the interface needed to sort sdk.Dec slices -type SortDecs []sdk.Dec +// SortDecs provides the interface needed to sort sdkmath.LegacyDec slices +type SortDecs []sdkmath.LegacyDec func (a SortDecs) Len() int { return len(a) } func (a SortDecs) Swap(i, j int) { a[i], a[j] = a[j], a[i] } diff --git a/x/pricefeed/types/market_test.go b/x/pricefeed/types/market_test.go index 1dbcae875c..94825a251f 100644 --- a/x/pricefeed/types/market_test.go +++ b/x/pricefeed/types/market_test.go @@ -1,6 +1,7 @@ package types import ( + sdkmath "cosmossdk.io/math" "testing" "time" @@ -109,7 +110,7 @@ func TestPostedPriceValidate(t *testing.T) { PostedPrice{ MarketID: "market", OracleAddress: addr, - Price: sdk.OneDec(), + Price: sdkmath.LegacyOneDec(), Expiry: now, }, true, @@ -134,7 +135,7 @@ func TestPostedPriceValidate(t *testing.T) { PostedPrice{ MarketID: "market", OracleAddress: addr, - Price: sdk.NewDec(-1), + Price: sdkmath.LegacyNewDec(-1), }, false, }, @@ -143,7 +144,7 @@ func TestPostedPriceValidate(t *testing.T) { PostedPrice{ MarketID: "market", OracleAddress: addr, - Price: sdk.OneDec(), + Price: sdkmath.LegacyOneDec(), Expiry: time.Time{}, }, false, diff --git a/x/pricefeed/types/msgs.go b/x/pricefeed/types/msgs.go index 57e3e8c3e0..aaf8e23ce3 100644 --- a/x/pricefeed/types/msgs.go +++ b/x/pricefeed/types/msgs.go @@ -1,6 +1,7 @@ package types import ( + sdkmath "cosmossdk.io/math" "errors" "fmt" "strings" @@ -23,7 +24,7 @@ const ( var _ sdk.Msg = &MsgPostPrice{} // NewMsgPostPrice returns a new MsgPostPrice -func NewMsgPostPrice(from string, marketID string, price sdk.Dec, expiry time.Time) *MsgPostPrice { +func NewMsgPostPrice(from string, marketID string, price sdkmath.LegacyDec, expiry time.Time) *MsgPostPrice { return &MsgPostPrice{ From: from, MarketID: marketID, diff --git a/x/pricefeed/types/msgs_test.go b/x/pricefeed/types/msgs_test.go index 9bbb84c76c..1af78b3f43 100644 --- a/x/pricefeed/types/msgs_test.go +++ b/x/pricefeed/types/msgs_test.go @@ -1,6 +1,7 @@ package types import ( + sdkmath "cosmossdk.io/math" "testing" "github.com/stretchr/testify/require" @@ -12,9 +13,9 @@ import ( func TestMsgPlaceBid_ValidateBasic(t *testing.T) { addr := sdk.AccAddress([]byte("someName")) - price, _ := sdk.NewDecFromStr("0.3005") + price, _ := sdkmath.LegacyNewDecFromStr("0.3005") expiry := tmtime.Now() - negativePrice, _ := sdk.NewDecFromStr("-3.05") + negativePrice, _ := sdkmath.LegacyNewDecFromStr("-3.05") tests := []struct { name string diff --git a/x/pricefeed/types/query.pb.go b/x/pricefeed/types/query.pb.go index a4111a2d50..50e8af5fde 100644 --- a/x/pricefeed/types/query.pb.go +++ b/x/pricefeed/types/query.pb.go @@ -5,8 +5,8 @@ package types import ( context "context" + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" @@ -494,10 +494,10 @@ var xxx_messageInfo_QueryMarketsResponse proto.InternalMessageInfo // PostedPriceResponse defines a price for market posted by a specific oracle. type PostedPriceResponse struct { - MarketID string `protobuf:"bytes,1,opt,name=market_id,json=marketId,proto3" json:"market_id,omitempty"` - OracleAddress string `protobuf:"bytes,2,opt,name=oracle_address,json=oracleAddress,proto3" json:"oracle_address,omitempty"` - Price github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=price,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"price"` - Expiry time.Time `protobuf:"bytes,4,opt,name=expiry,proto3,stdtime" json:"expiry"` + MarketID string `protobuf:"bytes,1,opt,name=market_id,json=marketId,proto3" json:"market_id,omitempty"` + OracleAddress string `protobuf:"bytes,2,opt,name=oracle_address,json=oracleAddress,proto3" json:"oracle_address,omitempty"` + Price cosmossdk_io_math.LegacyDec `protobuf:"bytes,3,opt,name=price,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"price"` + Expiry time.Time `protobuf:"bytes,4,opt,name=expiry,proto3,stdtime" json:"expiry"` } func (m *PostedPriceResponse) Reset() { *m = PostedPriceResponse{} } @@ -557,8 +557,8 @@ func (m *PostedPriceResponse) GetExpiry() time.Time { // CurrentPriceResponse defines a current price for a particular market in the pricefeed // module. type CurrentPriceResponse struct { - MarketID string `protobuf:"bytes,1,opt,name=market_id,json=marketId,proto3" json:"market_id,omitempty"` - Price github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=price,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"price"` + MarketID string `protobuf:"bytes,1,opt,name=market_id,json=marketId,proto3" json:"market_id,omitempty"` + Price cosmossdk_io_math.LegacyDec `protobuf:"bytes,2,opt,name=price,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"price"` } func (m *CurrentPriceResponse) Reset() { *m = CurrentPriceResponse{} } @@ -701,63 +701,63 @@ func init() { } var fileDescriptor_84567be3085e4c6c = []byte{ - // 884 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x95, 0xcf, 0x6f, 0x1b, 0x45, - 0x14, 0xc7, 0x3d, 0xa9, 0x7f, 0x4e, 0xa1, 0x88, 0xa9, 0x13, 0x2c, 0xd3, 0xee, 0x86, 0x95, 0x08, - 0x6d, 0x1c, 0xef, 0xaa, 0xa9, 0xa8, 0x50, 0xc5, 0xa5, 0x26, 0x07, 0x7a, 0xa8, 0x80, 0x15, 0x97, - 0x72, 0xb1, 0xc6, 0xde, 0xa9, 0xbb, 0x4a, 0xec, 0xd9, 0xec, 0x8c, 0xe3, 0x46, 0x08, 0x09, 0x21, - 0x24, 0xca, 0x01, 0x29, 0x82, 0x13, 0x37, 0xb8, 0x21, 0x24, 0xfe, 0x8f, 0x1c, 0x23, 0x71, 0x41, - 0x1c, 0x92, 0xe0, 0x70, 0xe3, 0x9f, 0x40, 0x3b, 0xf3, 0x76, 0xf1, 0x26, 0xde, 0x64, 0x2d, 0x4e, - 0xc9, 0xbe, 0x7d, 0x3f, 0x3e, 0xef, 0xbb, 0x33, 0x5f, 0x63, 0x6b, 0x9b, 0xee, 0x51, 0x27, 0x08, - 0xfd, 0x3e, 0x7b, 0xc6, 0x98, 0xe7, 0xec, 0xdd, 0xeb, 0x31, 0x49, 0xef, 0x39, 0xbb, 0x63, 0x16, - 0xee, 0xdb, 0x41, 0xc8, 0x25, 0x27, 0x2b, 0x51, 0x8e, 0x9d, 0xe4, 0xd8, 0x90, 0xd3, 0xac, 0x0f, - 0xf8, 0x80, 0xab, 0x14, 0x27, 0xfa, 0x4f, 0x67, 0x37, 0x6f, 0x0d, 0x38, 0x1f, 0xec, 0x30, 0x87, - 0x06, 0xbe, 0x43, 0x47, 0x23, 0x2e, 0xa9, 0xf4, 0xf9, 0x48, 0xc0, 0x5b, 0x13, 0xde, 0xaa, 0xa7, - 0xde, 0xf8, 0x99, 0x23, 0xfd, 0x21, 0x13, 0x92, 0x0e, 0x03, 0x48, 0xc8, 0x02, 0x12, 0x92, 0x87, - 0x4c, 0xe7, 0x58, 0x75, 0x4c, 0x3e, 0x89, 0xf8, 0x3e, 0xa6, 0x21, 0x1d, 0x0a, 0x97, 0xed, 0x8e, - 0x99, 0x90, 0xd6, 0x53, 0x7c, 0x33, 0x15, 0x15, 0x01, 0x1f, 0x09, 0x46, 0xde, 0xc7, 0xe5, 0x40, - 0x45, 0x1a, 0x68, 0x15, 0xdd, 0xb9, 0xbe, 0x69, 0xd8, 0xf3, 0xd7, 0xb1, 0x75, 0x5d, 0xa7, 0x78, - 0x78, 0x6c, 0x16, 0x5c, 0xa8, 0x79, 0x58, 0x7c, 0xf9, 0x93, 0x59, 0xb0, 0x1e, 0xe0, 0xd7, 0x75, - 0xeb, 0xa8, 0x08, 0xe6, 0x91, 0x37, 0x71, 0x6d, 0x48, 0xc3, 0x6d, 0x26, 0xbb, 0xbe, 0xa7, 0x7a, - 0xd7, 0xdc, 0xaa, 0x0e, 0x3c, 0xf6, 0xa0, 0xce, 0x8b, 0x41, 0x75, 0x1d, 0x10, 0x7d, 0x88, 0x4b, - 0x6a, 0x3a, 0x00, 0x6d, 0x64, 0x01, 0x7d, 0x30, 0x0e, 0x43, 0x36, 0x92, 0xa9, 0x62, 0xc0, 0xd3, - 0x0d, 0x60, 0x4a, 0x7d, 0x76, 0x4a, 0x22, 0xc7, 0x97, 0x28, 0xd6, 0x03, 0xc2, 0x30, 0xbd, 0x8f, - 0xcb, 0xaa, 0x38, 0xd2, 0xe3, 0xda, 0xc2, 0xe3, 0x6f, 0x47, 0xe3, 0x7f, 0x3d, 0x31, 0x97, 0xe7, - 0xbd, 0x15, 0x2e, 0xb4, 0x06, 0xb0, 0x87, 0x78, 0x59, 0x11, 0xb8, 0x74, 0x92, 0x62, 0xcb, 0x23, - 0xdd, 0x4b, 0x84, 0x57, 0xce, 0x17, 0xc3, 0x06, 0xcf, 0x31, 0x0e, 0xe9, 0xa4, 0x9b, 0xda, 0xa2, - 0x95, 0xf9, 0x55, 0xb9, 0x90, 0xcc, 0x4b, 0x2f, 0x71, 0x0b, 0x96, 0xa8, 0xcf, 0x79, 0x29, 0xdc, - 0x5a, 0x18, 0x4f, 0x04, 0x94, 0xf7, 0x40, 0xc8, 0x8f, 0x42, 0xda, 0xdf, 0x59, 0x68, 0x89, 0x07, - 0xb8, 0x9e, 0xae, 0x84, 0x0d, 0x1a, 0xb8, 0xc2, 0x75, 0x48, 0xe1, 0xd7, 0xdc, 0xf8, 0x11, 0xea, - 0x96, 0x61, 0xe2, 0x13, 0xd5, 0x2e, 0xf9, 0xa4, 0x13, 0x68, 0x97, 0x84, 0xa1, 0xdd, 0x53, 0x5c, - 0xd1, 0x83, 0x63, 0x35, 0xd6, 0xb2, 0xd4, 0xd0, 0x95, 0x89, 0x10, 0x6f, 0x80, 0x10, 0xaf, 0xa5, - 0xe3, 0xc2, 0x8d, 0xfb, 0x01, 0xcf, 0x3f, 0x08, 0xdf, 0x9c, 0xa3, 0x15, 0xb9, 0x7b, 0x41, 0x82, - 0xce, 0x2b, 0xd3, 0x63, 0xb3, 0xaa, 0xdb, 0x3d, 0xde, 0xfa, 0x4f, 0x10, 0xf2, 0x36, 0xbe, 0xa1, - 0x77, 0xec, 0x52, 0xcf, 0x0b, 0x99, 0x10, 0x8d, 0x25, 0x25, 0xd9, 0xab, 0x3a, 0xfa, 0x48, 0x07, - 0xc9, 0x56, 0x7c, 0x37, 0xae, 0xa9, 0x6e, 0x76, 0x04, 0xf8, 0xe7, 0xb1, 0xb9, 0x36, 0xf0, 0xe5, - 0xf3, 0x71, 0xcf, 0xee, 0xf3, 0xa1, 0xd3, 0xe7, 0x62, 0xc8, 0x05, 0xfc, 0x69, 0x0b, 0x6f, 0xdb, - 0x91, 0xfb, 0x01, 0x13, 0xf6, 0x16, 0xeb, 0xc3, 0xbd, 0x88, 0xee, 0x3c, 0x7b, 0x11, 0xf8, 0xe1, - 0x7e, 0xa3, 0xa8, 0xae, 0x58, 0xd3, 0xd6, 0xb6, 0x63, 0xc7, 0xb6, 0x63, 0x7f, 0x1a, 0xdb, 0x4e, - 0xa7, 0x1a, 0x8d, 0x38, 0x38, 0x31, 0x91, 0x0b, 0x35, 0xd6, 0x37, 0x08, 0xd7, 0xe7, 0x1d, 0xef, - 0x45, 0xd6, 0x4d, 0xf6, 0x58, 0xfa, 0x1f, 0x7b, 0x58, 0xbf, 0x21, 0x7c, 0x23, 0xfd, 0x69, 0x16, - 0x61, 0xb8, 0x8d, 0x71, 0x8f, 0x0a, 0xd6, 0xa5, 0x42, 0x30, 0x09, 0x72, 0xd7, 0xa2, 0xc8, 0xa3, - 0x28, 0x40, 0x4c, 0x7c, 0x7d, 0x77, 0xcc, 0x65, 0xfc, 0x5e, 0x09, 0xee, 0x62, 0x15, 0xd2, 0x09, - 0x33, 0xa7, 0xb4, 0x98, 0x3a, 0xa5, 0x64, 0x05, 0x97, 0x69, 0x5f, 0xfa, 0x7b, 0xac, 0x51, 0x5a, - 0x45, 0x77, 0xaa, 0x2e, 0x3c, 0x6d, 0x7e, 0x5d, 0xc1, 0x25, 0x75, 0x42, 0xc9, 0xb7, 0x08, 0x97, - 0xb5, 0xa1, 0x92, 0xf5, 0xac, 0xc3, 0x78, 0xd1, 0xc3, 0x9b, 0xad, 0x5c, 0xb9, 0x5a, 0x0a, 0x6b, - 0xed, 0xab, 0xdf, 0xff, 0xfe, 0x61, 0x69, 0x95, 0x18, 0x4e, 0xc6, 0x6f, 0x86, 0xf6, 0x70, 0xf2, - 0x3d, 0xc2, 0x25, 0xf5, 0x21, 0xc9, 0xdd, 0xcb, 0xdb, 0xcf, 0xb8, 0x7b, 0x73, 0x3d, 0x4f, 0x2a, - 0x80, 0x6c, 0x2a, 0x90, 0x0d, 0xb2, 0x9e, 0x09, 0xa2, 0xec, 0xc4, 0xf9, 0x3c, 0xf9, 0x72, 0x5f, - 0x68, 0x81, 0x54, 0x98, 0xe4, 0x18, 0x95, 0x57, 0xa0, 0x94, 0x51, 0xe6, 0x10, 0x48, 0x03, 0xfc, - 0x8c, 0x70, 0x2d, 0xb1, 0x59, 0xd2, 0xbe, 0x74, 0xc4, 0x79, 0x2f, 0x6f, 0xda, 0x79, 0xd3, 0x01, - 0xea, 0x5d, 0x05, 0xe5, 0x90, 0x76, 0x16, 0x54, 0x48, 0x27, 0x73, 0xf4, 0xfa, 0x11, 0xe1, 0x0a, - 0xd8, 0x28, 0xb9, 0x5c, 0x84, 0xb4, 0x4d, 0x37, 0x37, 0xf2, 0x25, 0x03, 0xdd, 0x7d, 0x45, 0xd7, - 0x26, 0xad, 0x2c, 0x3a, 0xb8, 0x02, 0x29, 0xb6, 0xef, 0x10, 0xae, 0x80, 0x27, 0x5f, 0xc1, 0x96, - 0x36, 0xf4, 0x2b, 0xd8, 0xce, 0xd9, 0xbc, 0xf5, 0x8e, 0x62, 0x7b, 0x8b, 0x98, 0x59, 0x6c, 0x60, - 0xda, 0x9d, 0x27, 0xa7, 0x7f, 0x19, 0xe8, 0x97, 0xa9, 0x81, 0x0e, 0xa7, 0x06, 0x3a, 0x9a, 0x1a, - 0xe8, 0x74, 0x6a, 0xa0, 0x83, 0x33, 0xa3, 0x70, 0x74, 0x66, 0x14, 0xfe, 0x38, 0x33, 0x0a, 0x9f, - 0xb5, 0x66, 0x7c, 0x28, 0x6a, 0xd6, 0xde, 0xa1, 0x3d, 0xa1, 0xdb, 0xbe, 0x98, 0x69, 0xac, 0x0c, - 0xa9, 0x57, 0x56, 0xae, 0x79, 0xff, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0xd8, 0x99, 0x27, 0xa2, - 0x2c, 0x0a, 0x00, 0x00, + // 883 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x95, 0x4d, 0x8f, 0xdb, 0x44, + 0x18, 0xc7, 0x33, 0xdb, 0xbc, 0x4e, 0xa1, 0x88, 0x69, 0x76, 0x89, 0xd2, 0xd6, 0x5e, 0x8c, 0x28, + 0xed, 0x66, 0x63, 0xab, 0x5b, 0x51, 0x41, 0xc5, 0xa5, 0xa1, 0x07, 0x2a, 0x51, 0x01, 0x16, 0x97, + 0x72, 0x89, 0x26, 0xf6, 0x34, 0x6b, 0xed, 0x26, 0xe3, 0xf5, 0x4c, 0x36, 0x8d, 0x00, 0x09, 0x21, + 0x0e, 0xe5, 0x80, 0x54, 0xc1, 0x89, 0x1b, 0xdc, 0x10, 0x12, 0xdf, 0xa3, 0xc7, 0x4a, 0x5c, 0x10, + 0x87, 0xed, 0x92, 0xe5, 0x83, 0x20, 0xcf, 0x3c, 0x36, 0xf1, 0x36, 0xde, 0x3a, 0xb7, 0xf8, 0x99, + 0xe7, 0xe5, 0x37, 0xff, 0x99, 0xf9, 0x07, 0x5b, 0x7b, 0xf4, 0x90, 0x3a, 0x61, 0x14, 0x78, 0xec, + 0x21, 0x63, 0xbe, 0x73, 0x78, 0x63, 0xc0, 0x24, 0xbd, 0xe1, 0x1c, 0x4c, 0x58, 0x34, 0xb3, 0xc3, + 0x88, 0x4b, 0x4e, 0x36, 0xe2, 0x1c, 0x3b, 0xcd, 0xb1, 0x21, 0xa7, 0xdd, 0x1c, 0xf2, 0x21, 0x57, + 0x29, 0x4e, 0xfc, 0x4b, 0x67, 0xb7, 0x2f, 0x0f, 0x39, 0x1f, 0xee, 0x33, 0x87, 0x86, 0x81, 0x43, + 0xc7, 0x63, 0x2e, 0xa9, 0x0c, 0xf8, 0x58, 0xc0, 0xaa, 0x09, 0xab, 0xea, 0x6b, 0x30, 0x79, 0xe8, + 0xc8, 0x60, 0xc4, 0x84, 0xa4, 0xa3, 0x10, 0x12, 0xf2, 0x80, 0x84, 0xe4, 0x11, 0xd3, 0x39, 0x56, + 0x13, 0x93, 0xcf, 0x62, 0xbe, 0x4f, 0x69, 0x44, 0x47, 0xc2, 0x65, 0x07, 0x13, 0x26, 0xa4, 0xf5, + 0x00, 0x5f, 0xcc, 0x44, 0x45, 0xc8, 0xc7, 0x82, 0x91, 0x0f, 0x70, 0x35, 0x54, 0x91, 0x16, 0xda, + 0x44, 0xd7, 0xce, 0xef, 0x18, 0xf6, 0xf2, 0xed, 0xd8, 0xba, 0xae, 0x57, 0x7e, 0x7a, 0x64, 0x96, + 0x5c, 0xa8, 0xb9, 0x5d, 0x7e, 0xfc, 0x8b, 0x59, 0xb2, 0x6e, 0xe1, 0xd7, 0x75, 0xeb, 0xb8, 0x08, + 0xe6, 0x91, 0x4b, 0xb8, 0x31, 0xa2, 0xd1, 0x1e, 0x93, 0xfd, 0xc0, 0x57, 0xbd, 0x1b, 0x6e, 0x5d, + 0x07, 0xee, 0xf9, 0x50, 0xe7, 0x27, 0xa0, 0xba, 0x0e, 0x88, 0x3e, 0xc2, 0x15, 0x35, 0x1d, 0x80, + 0xb6, 0xf3, 0x80, 0x3e, 0x9c, 0x44, 0x11, 0x1b, 0xcb, 0x4c, 0x31, 0xe0, 0xe9, 0x06, 0x30, 0xa5, + 0xb9, 0x38, 0x25, 0x95, 0xe3, 0x1b, 0x94, 0xe8, 0x01, 0x61, 0x98, 0xee, 0xe1, 0xaa, 0x2a, 0x8e, + 0xf5, 0x38, 0xb7, 0xf2, 0xf8, 0x2b, 0xf1, 0xf8, 0xdf, 0x9f, 0x9b, 0xeb, 0xcb, 0x56, 0x85, 0x0b, + 0xad, 0x01, 0xec, 0x36, 0x5e, 0x57, 0x04, 0x2e, 0x9d, 0x66, 0xd8, 0x8a, 0x48, 0xf7, 0x18, 0xe1, + 0x8d, 0xd3, 0xc5, 0xb0, 0x83, 0x5d, 0x8c, 0x23, 0x3a, 0xed, 0x67, 0x76, 0xd1, 0xc9, 0x3d, 0x55, + 0x2e, 0x24, 0xf3, 0xb3, 0x9b, 0xb8, 0x0c, 0x9b, 0x68, 0x2e, 0x59, 0x14, 0x6e, 0x23, 0x4a, 0x26, + 0x02, 0xca, 0x7b, 0x20, 0xe4, 0x27, 0x11, 0xf5, 0xf6, 0x57, 0xda, 0xc4, 0x2d, 0xdc, 0xcc, 0x56, + 0xc2, 0x0e, 0x5a, 0xb8, 0xc6, 0x75, 0x48, 0xe1, 0x37, 0xdc, 0xe4, 0x13, 0xea, 0xd6, 0x61, 0xe2, + 0x7d, 0xd5, 0x2e, 0x3d, 0xd2, 0x29, 0xb4, 0x4b, 0xc3, 0xd0, 0xee, 0x01, 0xae, 0xe9, 0xc1, 0x89, + 0x1a, 0x57, 0xf3, 0xd4, 0xd0, 0x95, 0xa9, 0x10, 0x6f, 0x80, 0x10, 0xaf, 0x65, 0xe3, 0xc2, 0x4d, + 0xfa, 0x01, 0xcf, 0x31, 0xc2, 0x17, 0x97, 0x68, 0x45, 0xae, 0xbf, 0x20, 0x41, 0xef, 0x95, 0xf9, + 0x91, 0x59, 0xd7, 0xed, 0xee, 0xdd, 0xfd, 0x5f, 0x10, 0xf2, 0x36, 0xbe, 0xa0, 0xf7, 0xd8, 0xa7, + 0xbe, 0x1f, 0x31, 0x21, 0x5a, 0x6b, 0x4a, 0xb2, 0x57, 0x75, 0xf4, 0x8e, 0x0e, 0x92, 0xf7, 0x93, + 0xb7, 0x71, 0x4e, 0x75, 0x7b, 0x2b, 0x06, 0xfc, 0xfb, 0xc8, 0xbc, 0xe4, 0x71, 0x31, 0xe2, 0x42, + 0xf8, 0x7b, 0x76, 0xc0, 0x9d, 0x11, 0x95, 0xbb, 0xf6, 0xc7, 0x6c, 0x48, 0xbd, 0xd9, 0x5d, 0xe6, + 0xc1, 0x63, 0x88, 0x1f, 0x3a, 0x7b, 0x14, 0x06, 0xd1, 0xac, 0x55, 0x56, 0xef, 0xaa, 0x6d, 0x6b, + 0xaf, 0xb1, 0x13, 0xaf, 0xb1, 0x3f, 0x4f, 0xbc, 0xa6, 0x57, 0x8f, 0xfb, 0x3e, 0x79, 0x6e, 0x22, + 0x17, 0x6a, 0xac, 0xaf, 0x70, 0x73, 0xd9, 0x95, 0x5e, 0x65, 0x8b, 0x29, 0xfb, 0xda, 0xaa, 0xec, + 0xd6, 0x1f, 0x08, 0x5f, 0xc8, 0x9e, 0xc1, 0x2a, 0x83, 0xaf, 0x60, 0x3c, 0xa0, 0x82, 0xf5, 0xa9, + 0x10, 0x4c, 0x82, 0xae, 0x8d, 0x38, 0x72, 0x27, 0x0e, 0x10, 0x13, 0x9f, 0x3f, 0x98, 0x70, 0x99, + 0xac, 0x2b, 0x65, 0x5d, 0xac, 0x42, 0x3a, 0x61, 0xe1, 0x3a, 0x96, 0x33, 0xd7, 0x91, 0x6c, 0xe0, + 0x2a, 0xf5, 0x64, 0x70, 0xc8, 0x5a, 0x95, 0x4d, 0x74, 0xad, 0xee, 0xc2, 0xd7, 0xce, 0x77, 0x35, + 0x5c, 0x51, 0x57, 0x91, 0x7c, 0x8f, 0x70, 0x55, 0x3b, 0x27, 0xd9, 0xca, 0xbb, 0x75, 0x2f, 0x9a, + 0x75, 0xbb, 0x53, 0x28, 0x57, 0x4b, 0x61, 0x5d, 0xfd, 0xf6, 0xcf, 0x7f, 0x7f, 0x5a, 0xdb, 0x24, + 0x86, 0x93, 0xf3, 0xe7, 0xa0, 0xcd, 0x9a, 0xfc, 0x88, 0x70, 0x45, 0x9d, 0x1e, 0xb9, 0x7e, 0x76, + 0xfb, 0x05, 0x1b, 0x6f, 0x6f, 0x15, 0x49, 0x05, 0x90, 0x1d, 0x05, 0xb2, 0x4d, 0xb6, 0x72, 0x41, + 0x94, 0x6f, 0x38, 0x5f, 0xa6, 0x27, 0xf7, 0xb5, 0x16, 0x48, 0x85, 0x49, 0x81, 0x51, 0x45, 0x05, + 0xca, 0x38, 0x62, 0x01, 0x81, 0x34, 0xc0, 0xaf, 0x08, 0x37, 0x52, 0x3f, 0x25, 0xdd, 0x33, 0x47, + 0x9c, 0x36, 0xed, 0xb6, 0x5d, 0x34, 0x1d, 0xa0, 0xde, 0x55, 0x50, 0x0e, 0xe9, 0xe6, 0x41, 0x45, + 0x74, 0xba, 0x44, 0xaf, 0x9f, 0x11, 0xae, 0x81, 0x5f, 0x92, 0xb3, 0x45, 0xc8, 0xfa, 0x71, 0x7b, + 0xbb, 0x58, 0x32, 0xd0, 0xdd, 0x54, 0x74, 0x5d, 0xd2, 0xc9, 0xa3, 0x83, 0x27, 0x90, 0x61, 0xfb, + 0x01, 0xe1, 0x1a, 0x98, 0xef, 0x4b, 0xd8, 0xb2, 0xce, 0xfd, 0x12, 0xb6, 0x53, 0x7e, 0x6e, 0xbd, + 0xa3, 0xd8, 0xde, 0x24, 0x66, 0x1e, 0x1b, 0xb8, 0x73, 0xef, 0xfe, 0xf1, 0x3f, 0x06, 0xfa, 0x6d, + 0x6e, 0xa0, 0xa7, 0x73, 0x03, 0x3d, 0x9b, 0x1b, 0xe8, 0x78, 0x6e, 0xa0, 0x27, 0x27, 0x46, 0xe9, + 0xd9, 0x89, 0x51, 0xfa, 0xeb, 0xc4, 0x28, 0x7d, 0xd1, 0x19, 0x06, 0x72, 0x77, 0x32, 0xb0, 0x3d, + 0x3e, 0x52, 0xcd, 0xba, 0xfb, 0x74, 0x20, 0x74, 0xdb, 0x47, 0x0b, 0x8d, 0xe5, 0x2c, 0x64, 0x62, + 0x50, 0x55, 0x4e, 0x79, 0xf3, 0xbf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x73, 0x9f, 0xa5, 0xc7, 0x15, + 0x0a, 0x00, 0x00, } func (this *QueryParamsRequest) VerboseEqual(that interface{}) error { @@ -1890,6 +1890,7 @@ func _Query_Markets_Handler(srv interface{}, ctx context.Context, dec func(inter return interceptor(ctx, in, info, handler) } +var Query_serviceDesc = _Query_serviceDesc var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "kava.pricefeed.v1beta1.Query", HandlerType: (*QueryServer)(nil), diff --git a/x/pricefeed/types/store.pb.go b/x/pricefeed/types/store.pb.go index 6b8f2ae259..e5abf67fe1 100644 --- a/x/pricefeed/types/store.pb.go +++ b/x/pricefeed/types/store.pb.go @@ -5,6 +5,7 @@ package types import ( bytes "bytes" + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" _ "github.com/cosmos/cosmos-proto" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" @@ -156,7 +157,7 @@ func (m *Market) GetActive() bool { type PostedPrice struct { MarketID string `protobuf:"bytes,1,opt,name=market_id,json=marketId,proto3" json:"market_id,omitempty"` OracleAddress github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,2,opt,name=oracle_address,json=oracleAddress,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"oracle_address,omitempty"` - Price github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=price,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"price"` + Price cosmossdk_io_math.LegacyDec `protobuf:"bytes,3,opt,name=price,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"price"` Expiry time.Time `protobuf:"bytes,4,opt,name=expiry,proto3,stdtime" json:"expiry"` } @@ -217,8 +218,8 @@ func (m *PostedPrice) GetExpiry() time.Time { // CurrentPrice defines a current price for a particular market in the pricefeed // module. type CurrentPrice struct { - MarketID string `protobuf:"bytes,1,opt,name=market_id,json=marketId,proto3" json:"market_id,omitempty"` - Price github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=price,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"price"` + MarketID string `protobuf:"bytes,1,opt,name=market_id,json=marketId,proto3" json:"market_id,omitempty"` + Price cosmossdk_io_math.LegacyDec `protobuf:"bytes,2,opt,name=price,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"price"` } func (m *CurrentPrice) Reset() { *m = CurrentPrice{} } @@ -273,39 +274,40 @@ func init() { } var fileDescriptor_9df40639f5e16f9a = []byte{ - // 508 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x53, 0x3f, 0x6f, 0xd3, 0x40, - 0x14, 0xcf, 0x25, 0x6d, 0xfe, 0x5c, 0x02, 0x48, 0x06, 0x55, 0x26, 0x12, 0x76, 0x94, 0x01, 0x19, - 0xa1, 0x9c, 0xd5, 0xb2, 0xb2, 0xc4, 0x64, 0x20, 0x43, 0xa5, 0xc8, 0x30, 0xb1, 0x44, 0x67, 0xfb, - 0xd5, 0x58, 0x89, 0x39, 0x73, 0x77, 0x89, 0x9a, 0x89, 0xaf, 0xd0, 0x8f, 0x81, 0x90, 0xd8, 0xf8, - 0x10, 0x1d, 0x2b, 0x26, 0xc4, 0x90, 0x16, 0xe7, 0x03, 0xb0, 0x33, 0x21, 0xdf, 0xd9, 0x55, 0x07, - 0x06, 0x2a, 0x98, 0xee, 0xde, 0xef, 0xfd, 0xde, 0xbf, 0xdf, 0xbd, 0xc3, 0xc3, 0x05, 0x5d, 0x53, - 0x37, 0xe3, 0x49, 0x08, 0x27, 0x00, 0x91, 0xbb, 0x3e, 0x0c, 0x40, 0xd2, 0x43, 0x57, 0x48, 0xc6, - 0x81, 0x64, 0x9c, 0x49, 0x66, 0x1c, 0x14, 0x1c, 0x72, 0xcd, 0x21, 0x25, 0xa7, 0xff, 0x30, 0x64, - 0x22, 0x65, 0x62, 0xae, 0x58, 0xae, 0x36, 0x74, 0x48, 0xff, 0x41, 0xcc, 0x62, 0xa6, 0xf1, 0xe2, - 0x56, 0xa2, 0x76, 0xcc, 0x58, 0xbc, 0x04, 0x57, 0x59, 0xc1, 0xea, 0xc4, 0x95, 0x49, 0x0a, 0x42, - 0xd2, 0x34, 0xd3, 0x84, 0xe1, 0x2b, 0xdc, 0x9c, 0x51, 0x4e, 0x53, 0x61, 0x4c, 0x71, 0x2b, 0xa5, - 0x7c, 0x01, 0x52, 0x98, 0x68, 0xd0, 0x70, 0xba, 0x47, 0x16, 0xf9, 0x73, 0x17, 0xe4, 0x58, 0xd1, - 0xbc, 0x7b, 0xe7, 0x5b, 0xbb, 0xf6, 0xe9, 0xd2, 0x6e, 0x69, 0x5b, 0xf8, 0x55, 0xfc, 0xf0, 0x27, - 0xc2, 0x4d, 0x0d, 0x1a, 0x4f, 0x70, 0x47, 0xa3, 0xf3, 0x24, 0x32, 0xd1, 0x00, 0x39, 0x1d, 0xaf, - 0x97, 0x6f, 0xed, 0xb6, 0x76, 0x4f, 0x27, 0x7e, 0x5b, 0xbb, 0xa7, 0x91, 0xf1, 0x08, 0xe3, 0x80, - 0x0a, 0x98, 0x53, 0x21, 0x40, 0x9a, 0xf5, 0x82, 0xeb, 0x77, 0x0a, 0x64, 0x5c, 0x00, 0x86, 0x8d, - 0xbb, 0xef, 0x57, 0x4c, 0x56, 0xfe, 0x86, 0xf2, 0x63, 0x05, 0x69, 0x42, 0x80, 0x5b, 0x8c, 0xd3, - 0x70, 0x09, 0xc2, 0xdc, 0x1b, 0x34, 0x9c, 0x9e, 0xf7, 0xf2, 0xd7, 0xd6, 0x1e, 0xc5, 0x89, 0x7c, - 0xbb, 0x0a, 0x48, 0xc8, 0xd2, 0x52, 0xaf, 0xf2, 0x18, 0x89, 0x68, 0xe1, 0xca, 0x4d, 0x06, 0x82, - 0x8c, 0xc3, 0x70, 0x1c, 0x45, 0x1c, 0x84, 0xf8, 0xfa, 0x65, 0x74, 0xbf, 0x54, 0xb5, 0x44, 0xbc, - 0x8d, 0x04, 0xe1, 0x57, 0x89, 0x8d, 0x03, 0xdc, 0xa4, 0xa1, 0x4c, 0xd6, 0x60, 0xee, 0x0f, 0x90, - 0xd3, 0xf6, 0x4b, 0x6b, 0xf8, 0xb9, 0x8e, 0xbb, 0x33, 0x26, 0x24, 0x44, 0xb3, 0x42, 0xae, 0xdb, - 0x8c, 0xcd, 0xf0, 0x5d, 0x9d, 0x7d, 0x4e, 0x75, 0x49, 0x35, 0xfa, 0xff, 0xec, 0xfe, 0x8e, 0xce, - 0x5f, 0x62, 0xc6, 0x04, 0xef, 0xab, 0x37, 0xd5, 0x12, 0x7a, 0xa4, 0x78, 0xc6, 0xef, 0x5b, 0xfb, - 0xf1, 0x5f, 0xd4, 0x9a, 0x40, 0xe8, 0xeb, 0x60, 0xe3, 0x39, 0x6e, 0xc2, 0x69, 0x96, 0xf0, 0x8d, - 0xb9, 0x37, 0x40, 0x4e, 0xf7, 0xa8, 0x4f, 0xf4, 0xaa, 0x91, 0x6a, 0xd5, 0xc8, 0xeb, 0x6a, 0xd5, - 0xbc, 0x76, 0x51, 0xe2, 0xec, 0xd2, 0x46, 0x7e, 0x19, 0x33, 0xfc, 0x80, 0x7b, 0x2f, 0x56, 0x9c, - 0xc3, 0x3b, 0x79, 0x6b, 0xbd, 0xae, 0xdb, 0xaf, 0xff, 0x43, 0xfb, 0xde, 0xf1, 0xd5, 0x0f, 0x0b, - 0x7d, 0xcc, 0x2d, 0x74, 0x9e, 0x5b, 0xe8, 0x22, 0xb7, 0xd0, 0x55, 0x6e, 0xa1, 0xb3, 0x9d, 0x55, - 0xbb, 0xd8, 0x59, 0xb5, 0x6f, 0x3b, 0xab, 0xf6, 0xe6, 0xe9, 0x8d, 0x84, 0xc5, 0x47, 0x18, 0x2d, - 0x69, 0x20, 0xd4, 0xcd, 0x3d, 0xbd, 0xf1, 0x7d, 0x55, 0xe6, 0xa0, 0xa9, 0xa6, 0x7e, 0xf6, 0x3b, - 0x00, 0x00, 0xff, 0xff, 0x18, 0xb5, 0x5b, 0xc1, 0xdd, 0x03, 0x00, 0x00, + // 523 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x53, 0xcf, 0x6e, 0xd3, 0x4e, + 0x10, 0xce, 0x26, 0x6d, 0xfe, 0x6c, 0xf2, 0xfb, 0x21, 0x19, 0x54, 0x99, 0x20, 0xec, 0x28, 0x5c, + 0x8c, 0x50, 0xd6, 0x6a, 0x39, 0x21, 0x71, 0x89, 0xe9, 0x81, 0x48, 0x54, 0x8a, 0x0c, 0x27, 0x2e, + 0xd1, 0xda, 0x9e, 0xba, 0x56, 0x62, 0xd6, 0xec, 0x6e, 0xa2, 0xe6, 0x2d, 0xfa, 0x0c, 0x9c, 0x10, + 0x67, 0x1e, 0xa2, 0xc7, 0x8a, 0x13, 0xe2, 0x90, 0x16, 0xe7, 0x01, 0xb8, 0x73, 0x42, 0xde, 0xb5, + 0xab, 0x1e, 0xb8, 0x44, 0xe2, 0xe4, 0x9d, 0x6f, 0xbe, 0x6f, 0x3c, 0xf3, 0xed, 0x2c, 0x1e, 0xce, + 0xe9, 0x8a, 0xba, 0x19, 0x4f, 0x42, 0x38, 0x05, 0x88, 0xdc, 0xd5, 0x61, 0x00, 0x92, 0x1e, 0xba, + 0x42, 0x32, 0x0e, 0x24, 0xe3, 0x4c, 0x32, 0xe3, 0xa0, 0xe0, 0x90, 0x5b, 0x0e, 0x29, 0x39, 0xfd, + 0x87, 0x21, 0x13, 0x29, 0x13, 0x33, 0xc5, 0x72, 0x75, 0xa0, 0x25, 0xfd, 0x07, 0x31, 0x8b, 0x99, + 0xc6, 0x8b, 0x53, 0x89, 0xda, 0x31, 0x63, 0xf1, 0x02, 0x5c, 0x15, 0x05, 0xcb, 0x53, 0x57, 0x26, + 0x29, 0x08, 0x49, 0xd3, 0x4c, 0x13, 0x86, 0x6f, 0x71, 0x73, 0x4a, 0x39, 0x4d, 0x85, 0x31, 0xc1, + 0xad, 0x94, 0xf2, 0x39, 0x48, 0x61, 0xa2, 0x41, 0xc3, 0xe9, 0x1e, 0x59, 0xe4, 0xef, 0x5d, 0x90, + 0x13, 0x45, 0xf3, 0xee, 0x5d, 0x6e, 0xec, 0xda, 0x97, 0x6b, 0xbb, 0xa5, 0x63, 0xe1, 0x57, 0xfa, + 0xe1, 0x2f, 0x84, 0x9b, 0x1a, 0x34, 0x9e, 0xe2, 0x8e, 0x46, 0x67, 0x49, 0x64, 0xa2, 0x01, 0x72, + 0x3a, 0x5e, 0x2f, 0xdf, 0xd8, 0x6d, 0x9d, 0x9e, 0x1c, 0xfb, 0x6d, 0x9d, 0x9e, 0x44, 0xc6, 0x63, + 0x8c, 0x03, 0x2a, 0x60, 0x46, 0x85, 0x00, 0x69, 0xd6, 0x0b, 0xae, 0xdf, 0x29, 0x90, 0x71, 0x01, + 0x18, 0x36, 0xee, 0x7e, 0x5c, 0x32, 0x59, 0xe5, 0x1b, 0x2a, 0x8f, 0x15, 0xa4, 0x09, 0x01, 0x6e, + 0x31, 0x4e, 0xc3, 0x05, 0x08, 0x73, 0x6f, 0xd0, 0x70, 0x7a, 0xde, 0xeb, 0xdf, 0x1b, 0x7b, 0x14, + 0x27, 0xf2, 0x6c, 0x19, 0x90, 0x90, 0xa5, 0xa5, 0x5f, 0xe5, 0x67, 0x24, 0xa2, 0xb9, 0x2b, 0xd7, + 0x19, 0x08, 0x32, 0x0e, 0xc3, 0x71, 0x14, 0x71, 0x10, 0xe2, 0xdb, 0xd7, 0xd1, 0xfd, 0xd2, 0xd5, + 0x12, 0xf1, 0xd6, 0x12, 0x84, 0x5f, 0x15, 0x36, 0x0e, 0x70, 0x93, 0x86, 0x32, 0x59, 0x81, 0xb9, + 0x3f, 0x40, 0x4e, 0xdb, 0x2f, 0xa3, 0xe1, 0xa7, 0x3a, 0xee, 0x4e, 0x99, 0x90, 0x10, 0x4d, 0x0b, + 0xbb, 0x76, 0x19, 0x9b, 0xe1, 0xff, 0x75, 0xf5, 0x19, 0xd5, 0xbf, 0x54, 0xa3, 0xff, 0xcb, 0xee, + 0xff, 0xd3, 0xf5, 0x4b, 0xcc, 0x78, 0x81, 0xf7, 0xd5, 0x9d, 0x6a, 0x0b, 0xbd, 0x27, 0xc5, 0x35, + 0xfe, 0xd8, 0xd8, 0x8f, 0xb4, 0x54, 0x44, 0x73, 0x92, 0x30, 0x37, 0xa5, 0xf2, 0x8c, 0xbc, 0x81, + 0x98, 0x86, 0xeb, 0x63, 0x08, 0x7d, 0xad, 0x30, 0x5e, 0xe2, 0x26, 0x9c, 0x67, 0x09, 0x5f, 0x9b, + 0x7b, 0x03, 0xe4, 0x74, 0x8f, 0xfa, 0x44, 0xef, 0x17, 0xa9, 0xf6, 0x8b, 0xbc, 0xab, 0xf6, 0xcb, + 0x6b, 0x17, 0x75, 0x2f, 0xae, 0x6d, 0xe4, 0x97, 0x9a, 0xa1, 0xc4, 0xbd, 0x57, 0x4b, 0xce, 0xe1, + 0x83, 0xdc, 0xd9, 0xa4, 0xdb, 0x9e, 0xeb, 0xbb, 0xf6, 0xec, 0x9d, 0xdc, 0xfc, 0xb4, 0xd0, 0xe7, + 0xdc, 0x42, 0x97, 0xb9, 0x85, 0xae, 0x72, 0x0b, 0xdd, 0xe4, 0x16, 0xba, 0xd8, 0x5a, 0xb5, 0xab, + 0xad, 0x55, 0xfb, 0xbe, 0xb5, 0x6a, 0xef, 0x9f, 0xdd, 0x71, 0xb9, 0x58, 0xf9, 0xd1, 0x82, 0x06, + 0x42, 0x9d, 0xdc, 0xf3, 0x3b, 0x0f, 0x55, 0xd9, 0x1d, 0x34, 0xd5, 0xa8, 0xcf, 0xff, 0x04, 0x00, + 0x00, 0xff, 0xff, 0x33, 0x64, 0x10, 0x26, 0xc7, 0x03, 0x00, 0x00, } func (this *Params) VerboseEqual(that interface{}) error { diff --git a/x/pricefeed/types/tx.pb.go b/x/pricefeed/types/tx.pb.go index 358f29a7bb..98f989fdff 100644 --- a/x/pricefeed/types/tx.pb.go +++ b/x/pricefeed/types/tx.pb.go @@ -5,8 +5,8 @@ package types import ( context "context" + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" @@ -36,10 +36,10 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // MsgPostPrice represents a method for creating a new post price type MsgPostPrice struct { // address of client - From string `protobuf:"bytes,1,opt,name=from,proto3" json:"from,omitempty"` - MarketID string `protobuf:"bytes,2,opt,name=market_id,json=marketId,proto3" json:"market_id,omitempty"` - Price github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=price,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"price"` - Expiry time.Time `protobuf:"bytes,4,opt,name=expiry,proto3,stdtime" json:"expiry"` + From string `protobuf:"bytes,1,opt,name=from,proto3" json:"from,omitempty"` + MarketID string `protobuf:"bytes,2,opt,name=market_id,json=marketId,proto3" json:"market_id,omitempty"` + Price cosmossdk_io_math.LegacyDec `protobuf:"bytes,3,opt,name=price,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"price"` + Expiry time.Time `protobuf:"bytes,4,opt,name=expiry,proto3,stdtime" json:"expiry"` } func (m *MsgPostPrice) Reset() { *m = MsgPostPrice{} } @@ -120,31 +120,31 @@ func init() { func init() { proto.RegisterFile("kava/pricefeed/v1beta1/tx.proto", fileDescriptor_afd93c8e4685da16) } var fileDescriptor_afd93c8e4685da16 = []byte{ - // 370 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0xbd, 0x6e, 0xea, 0x30, - 0x14, 0x80, 0xe3, 0x0b, 0x17, 0x81, 0x2f, 0x53, 0x84, 0x50, 0x94, 0xc1, 0x41, 0xe8, 0xaa, 0xa2, - 0x6a, 0xb1, 0x05, 0xdd, 0xaa, 0x4e, 0x88, 0x85, 0x21, 0x12, 0x8a, 0x3a, 0x75, 0x41, 0xf9, 0x71, - 0xd2, 0x08, 0x52, 0x47, 0xb1, 0x41, 0xf0, 0x06, 0x1d, 0x79, 0x84, 0x8e, 0x7d, 0x14, 0x46, 0xb6, - 0x56, 0x1d, 0x28, 0x0d, 0x2f, 0x52, 0xc5, 0x81, 0x36, 0x43, 0x87, 0x4e, 0x39, 0xf1, 0xf9, 0xce, - 0x39, 0xfe, 0x8e, 0x0c, 0x8d, 0xa9, 0xbd, 0xb0, 0x49, 0x9c, 0x84, 0x2e, 0xf5, 0x29, 0xf5, 0xc8, - 0xa2, 0xe7, 0x50, 0x61, 0xf7, 0x88, 0x58, 0xe2, 0x38, 0x61, 0x82, 0xa9, 0xcd, 0x0c, 0xc0, 0x5f, - 0x00, 0x3e, 0x02, 0x7a, 0x23, 0x60, 0x01, 0x93, 0x08, 0xc9, 0xa2, 0x9c, 0xd6, 0x8d, 0x80, 0xb1, - 0x60, 0x46, 0x89, 0xfc, 0x73, 0xe6, 0x3e, 0x11, 0x61, 0x44, 0xb9, 0xb0, 0xa3, 0x38, 0x07, 0xda, - 0x2f, 0x00, 0xd6, 0x4d, 0x1e, 0x8c, 0x19, 0x17, 0xe3, 0xac, 0xa7, 0xaa, 0xc2, 0xb2, 0x9f, 0xb0, - 0x48, 0x03, 0x2d, 0xd0, 0xa9, 0x59, 0x32, 0x56, 0xcf, 0x61, 0x2d, 0xb2, 0x93, 0x29, 0x15, 0x93, - 0xd0, 0xd3, 0xfe, 0x64, 0x89, 0x41, 0x3d, 0xdd, 0x19, 0x55, 0x53, 0x1e, 0x8e, 0x86, 0x56, 0x35, - 0x4f, 0x8f, 0x3c, 0x75, 0x08, 0xff, 0xca, 0xbb, 0x69, 0x25, 0x89, 0xe1, 0xcd, 0xce, 0x50, 0xde, - 0x76, 0xc6, 0x59, 0x10, 0x8a, 0xfb, 0xb9, 0x83, 0x5d, 0x16, 0x11, 0x97, 0xf1, 0x88, 0xf1, 0xe3, - 0xa7, 0xcb, 0xbd, 0x29, 0x11, 0xab, 0x98, 0x72, 0x3c, 0xa4, 0xae, 0x95, 0x17, 0xab, 0x37, 0xb0, - 0x42, 0x97, 0x71, 0x98, 0xac, 0xb4, 0x72, 0x0b, 0x74, 0xfe, 0xf5, 0x75, 0x9c, 0x7b, 0xe0, 0x93, - 0x07, 0xbe, 0x3d, 0x79, 0x0c, 0xaa, 0xd9, 0x88, 0xf5, 0xbb, 0x01, 0xac, 0x63, 0xcd, 0x75, 0xf9, - 0xf1, 0xc9, 0x50, 0xda, 0x4d, 0xd8, 0x28, 0x8a, 0x59, 0x94, 0xc7, 0xec, 0x81, 0xd3, 0xbe, 0x0f, - 0x4b, 0x26, 0x0f, 0xd4, 0x09, 0xac, 0x7d, 0x4b, 0xff, 0xc7, 0x3f, 0x6f, 0x15, 0x17, 0x3b, 0xe8, - 0x97, 0xbf, 0xa1, 0x4e, 0x73, 0x06, 0xe6, 0xfe, 0x03, 0x81, 0xe7, 0x14, 0x81, 0x4d, 0x8a, 0xc0, - 0x36, 0x45, 0x60, 0x9f, 0x22, 0xb0, 0x3e, 0x20, 0x65, 0x7b, 0x40, 0xca, 0xeb, 0x01, 0x29, 0x77, - 0x17, 0x85, 0xa5, 0x64, 0x9d, 0xbb, 0x33, 0xdb, 0xe1, 0x32, 0x22, 0xcb, 0xc2, 0x13, 0x90, 0xdb, - 0x71, 0x2a, 0x52, 0xfd, 0xea, 0x33, 0x00, 0x00, 0xff, 0xff, 0x6f, 0x4a, 0x12, 0x82, 0x21, 0x02, - 0x00, 0x00, + // 376 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x91, 0xb1, 0x8e, 0xda, 0x30, + 0x1c, 0xc6, 0xe3, 0x42, 0x11, 0xb8, 0x4c, 0x11, 0x42, 0x51, 0x2a, 0x39, 0x88, 0x76, 0xa0, 0x6a, + 0x6b, 0x0b, 0x3a, 0xb5, 0xea, 0x84, 0x58, 0x90, 0x1a, 0x09, 0x45, 0x9d, 0xba, 0x20, 0x27, 0x71, + 0x4c, 0x04, 0xa9, 0xa3, 0xd8, 0x20, 0x78, 0x83, 0x8e, 0x3c, 0x42, 0xc7, 0x3e, 0x0a, 0x43, 0x07, + 0xc6, 0xd3, 0x0d, 0x1c, 0x17, 0x5e, 0xe4, 0x14, 0x07, 0xee, 0x18, 0x6e, 0xb8, 0xed, 0x4b, 0xfe, + 0xbf, 0xff, 0xe7, 0xef, 0xb3, 0xa1, 0x33, 0xa7, 0x2b, 0x4a, 0xd2, 0x2c, 0x0e, 0x58, 0xc4, 0x58, + 0x48, 0x56, 0x7d, 0x9f, 0x29, 0xda, 0x27, 0x6a, 0x8d, 0xd3, 0x4c, 0x28, 0x61, 0xb6, 0x0b, 0x00, + 0x3f, 0x02, 0xf8, 0x0c, 0xd8, 0x2d, 0x2e, 0xb8, 0xd0, 0x08, 0x29, 0x54, 0x49, 0xdb, 0x0e, 0x17, + 0x82, 0x2f, 0x18, 0xd1, 0x5f, 0xfe, 0x32, 0x22, 0x2a, 0x4e, 0x98, 0x54, 0x34, 0x49, 0x4b, 0xa0, + 0xfb, 0x1f, 0xc0, 0xa6, 0x2b, 0xf9, 0x44, 0x48, 0x35, 0x29, 0x3c, 0x4d, 0x13, 0x56, 0xa3, 0x4c, + 0x24, 0x16, 0xe8, 0x80, 0x5e, 0xc3, 0xd3, 0xda, 0xfc, 0x00, 0x1b, 0x09, 0xcd, 0xe6, 0x4c, 0x4d, + 0xe3, 0xd0, 0x7a, 0x55, 0x0c, 0x86, 0xcd, 0xfc, 0xe0, 0xd4, 0x5d, 0xfd, 0x73, 0x3c, 0xf2, 0xea, + 0xe5, 0x78, 0x1c, 0x9a, 0x5f, 0xe1, 0x6b, 0x9d, 0xcd, 0xaa, 0x68, 0xec, 0xdd, 0xee, 0xe0, 0x18, + 0xb7, 0x07, 0xe7, 0x6d, 0x20, 0x64, 0x22, 0xa4, 0x0c, 0xe7, 0x38, 0x16, 0x24, 0xa1, 0x6a, 0x86, + 0x7f, 0x30, 0x4e, 0x83, 0xcd, 0x88, 0x05, 0x5e, 0xb9, 0x61, 0x7e, 0x87, 0x35, 0xb6, 0x4e, 0xe3, + 0x6c, 0x63, 0x55, 0x3b, 0xa0, 0xf7, 0x66, 0x60, 0xe3, 0x32, 0x3c, 0xbe, 0x84, 0xc7, 0x3f, 0x2f, + 0xe1, 0x87, 0xf5, 0xc2, 0x77, 0x7b, 0xe7, 0x00, 0xef, 0xbc, 0xf3, 0xad, 0xfa, 0xe7, 0xaf, 0x63, + 0x74, 0xdb, 0xb0, 0x75, 0xdd, 0xc6, 0x63, 0x32, 0x15, 0xbf, 0x25, 0x1b, 0x44, 0xb0, 0xe2, 0x4a, + 0x6e, 0x4e, 0x61, 0xe3, 0xa9, 0xe9, 0x7b, 0xfc, 0xfc, 0x55, 0xe2, 0x6b, 0x07, 0xfb, 0xd3, 0x4b, + 0xa8, 0xcb, 0x39, 0x43, 0xf7, 0x78, 0x8f, 0xc0, 0xbf, 0x1c, 0x81, 0x5d, 0x8e, 0xc0, 0x3e, 0x47, + 0xe0, 0x98, 0x23, 0xb0, 0x3d, 0x21, 0x63, 0x7f, 0x42, 0xc6, 0xcd, 0x09, 0x19, 0xbf, 0x3e, 0xf2, + 0x58, 0xcd, 0x96, 0x3e, 0x0e, 0x44, 0x42, 0x0a, 0xe7, 0xcf, 0x0b, 0xea, 0x4b, 0xad, 0xc8, 0xfa, + 0xea, 0xdd, 0xd5, 0x26, 0x65, 0xd2, 0xaf, 0xe9, 0xea, 0x5f, 0x1e, 0x02, 0x00, 0x00, 0xff, 0xff, + 0x5c, 0x75, 0x6a, 0xc0, 0x16, 0x02, 0x00, 0x00, } func (this *MsgPostPrice) VerboseEqual(that interface{}) error { @@ -337,6 +337,7 @@ func _Msg_PostPrice_Handler(srv interface{}, ctx context.Context, dec func(inter return interceptor(ctx, in, info, handler) } +var Msg_serviceDesc = _Msg_serviceDesc var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "kava.pricefeed.v1beta1.Msg", HandlerType: (*MsgServer)(nil), diff --git a/x/router/keeper/msg_server.go b/x/router/keeper/msg_server.go index ba18c6d041..71ed5c5a51 100644 --- a/x/router/keeper/msg_server.go +++ b/x/router/keeper/msg_server.go @@ -70,11 +70,15 @@ func (m msgServer) DelegateMintDeposit(goCtx context.Context, msg *types.MsgDele if err != nil { return nil, err } - validator, found := m.keeper.stakingKeeper.GetValidator(ctx, valAddr) - if !found { + validator, err := m.keeper.stakingKeeper.GetValidator(ctx, valAddr) + if err != nil { return nil, stakingtypes.ErrNoValidatorFound } - bondDenom := m.keeper.stakingKeeper.BondDenom(ctx) + bondDenom, err := m.keeper.stakingKeeper.BondDenom(ctx) + if err != nil { + return nil, err + } + if msg.Amount.Denom != bondDenom { return nil, errorsmod.Wrapf( sdkerrors.ErrInvalidRequest, "invalid coin denomination: got %s, expected %s", msg.Amount.Denom, bondDenom, @@ -180,7 +184,8 @@ func (m msgServer) WithdrawBurnUndelegate(goCtx context.Context, msg *types.MsgW return nil, err } - completionTime, err := m.keeper.stakingKeeper.Undelegate(ctx, depositor, val, sharesReturned) + // TODO(boodyvo): should we use extra var + completionTime, _, err := m.keeper.stakingKeeper.Undelegate(ctx, depositor, val, sharesReturned) if err != nil { return nil, err } diff --git a/x/router/keeper/msg_server_test.go b/x/router/keeper/msg_server_test.go index a53b6852c4..acfdb5507d 100644 --- a/x/router/keeper/msg_server_test.go +++ b/x/router/keeper/msg_server_test.go @@ -7,7 +7,6 @@ import ( sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/staking" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/stretchr/testify/suite" @@ -72,7 +71,7 @@ func (suite *msgServerTestSuite) TestDelegateMintDeposit_Events() { sdk.NewAttribute(sdk.AttributeKeySender, user.String()), ), ) - expectedShares := sdk.NewDecFromInt(msg.Amount.Amount) // no slashes so shares equal staked tokens + expectedShares := sdkmath.LegacyNewDecFromInt(msg.Amount.Amount) // no slashes so shares equal staked tokens suite.EventsContains(suite.Ctx.EventManager().Events(), sdk.NewEvent( stakingtypes.EventTypeDelegate, @@ -125,7 +124,8 @@ func (suite *msgServerTestSuite) TestWithdrawBurnUndelegate_Events() { sdk.NewAttribute(sdk.AttributeKeySender, user.String()), ), ) - unbondingTime := suite.StakingKeeper.UnbondingTime(suite.Ctx) + unbondingTime, err := suite.StakingKeeper.UnbondingTime(suite.Ctx) + suite.Require().NoError(err) completionTime := suite.Ctx.BlockTime().Add(unbondingTime) suite.EventsContains(suite.Ctx.EventManager().Events(), sdk.NewEvent( @@ -154,8 +154,9 @@ func (suite *msgServerTestSuite) TestMintDepositAndWithdrawBurn_TransferEntireBa // Create a slashed validator, where the delegator owns fractional tokens. suite.CreateNewUnbondedValidator(valAddr, sdkmath.NewInt(1e9)) suite.CreateDelegation(valAddr, user, sdkmath.NewInt(1e9)) - staking.EndBlocker(suite.Ctx, suite.StakingKeeper) - suite.SlashValidator(valAddr, sdk.MustNewDecFromStr("0.666666666666666667")) + _, err := suite.StakingKeeper.EndBlocker(suite.Ctx) + suite.Require().NoError(err) + suite.SlashValidator(valAddr, sdkmath.LegacyMustNewDecFromStr("0.666666666666666667")) // Query the full staked balance and convert it all to derivatives // user technically 333_333_333.333333333333333333 staked tokens without rounding @@ -167,13 +168,13 @@ func (suite *msgServerTestSuite) TestMintDepositAndWithdrawBurn_TransferEntireBa valAddr, delegation.Balance, ) - _, err := suite.msgServer.MintDeposit(sdk.WrapSDKContext(suite.Ctx), msgDeposit) + _, err = suite.msgServer.MintDeposit(sdk.WrapSDKContext(suite.Ctx), msgDeposit) suite.Require().NoError(err) // There should be no extractable balance left in delegation suite.DelegationBalanceLessThan(valAddr, user, sdkmath.NewInt(1)) // All derivative coins should be deposited to earn - suite.AccountBalanceOfEqual(user, derivativeDenom, sdk.ZeroInt()) + suite.AccountBalanceOfEqual(user, derivativeDenom, sdkmath.ZeroInt()) // Earn vault has all minted derivatives suite.VaultAccountValueEqual(user, sdk.NewInt64Coin(derivativeDenom, 999_999_998)) // 2 lost in conversion @@ -192,7 +193,7 @@ func (suite *msgServerTestSuite) TestMintDepositAndWithdrawBurn_TransferEntireBa // There should be no earn deposit left (earn removes dust amounts) suite.VaultAccountSharesEqual(user, nil) // All derivative coins should be converted to a delegation - suite.AccountBalanceOfEqual(user, derivativeDenom, sdk.ZeroInt()) + suite.AccountBalanceOfEqual(user, derivativeDenom, sdkmath.ZeroInt()) // The user should get back most of their original deposited balance suite.DelegationBalanceInDeltaBelow(valAddr, user, sdkmath.NewInt(333_333_332), sdkmath.NewInt(2)) } @@ -209,8 +210,12 @@ func (suite *msgServerTestSuite) TestDelegateMintDepositAndWithdrawBurnUndelegat // Create a slashed validator, where a future delegator will own fractional tokens. suite.CreateNewUnbondedValidator(valAddr, valBalance) - staking.EndBlocker(suite.Ctx, suite.StakingKeeper) - suite.SlashValidator(valAddr, sdk.MustNewDecFromStr("0.4")) // tokens remaining 600_000_000 + + fmt.Println("valAddr", valAddr) + + _, err := suite.StakingKeeper.EndBlocker(suite.Ctx) + suite.Require().NoError(err) + suite.SlashValidator(valAddr, sdkmath.LegacyMustNewDecFromStr("0.4")) // tokens remaining 600_000_000 userBalance := sdkmath.NewInt(100e6) vesting := sdkmath.NewInt(1000) @@ -230,15 +235,15 @@ func (suite *msgServerTestSuite) TestDelegateMintDepositAndWithdrawBurnUndelegat valAddr, balance[0], ) - _, err := suite.msgServer.DelegateMintDeposit(sdk.WrapSDKContext(suite.Ctx), msgDeposit) + _, err = suite.msgServer.DelegateMintDeposit(sdk.WrapSDKContext(suite.Ctx), msgDeposit) suite.Require().NoError(err) // All spendable balance should be withdrawn suite.AccountSpendableBalanceEqual(user, sdk.NewCoins()) // Since shares are newly created, the exact amount should be converted to derivatives, leaving none behind - suite.DelegationSharesEqual(valAddr, user, sdk.ZeroDec()) + suite.DelegationSharesEqual(valAddr, user, sdkmath.LegacyZeroDec()) // All derivative coins should be deposited to earn - suite.AccountBalanceOfEqual(user, derivativeDenom, sdk.ZeroInt()) + suite.AccountBalanceOfEqual(user, derivativeDenom, sdkmath.ZeroInt()) suite.VaultAccountValueEqual(user, sdk.NewInt64Coin(derivativeDenom, 166_666_666)) @@ -257,9 +262,9 @@ func (suite *msgServerTestSuite) TestDelegateMintDepositAndWithdrawBurnUndelegat // There should be no earn deposit left (earn removes dust amounts) suite.VaultAccountSharesEqual(user, nil) // All derivative coins should be converted to a delegation - suite.AccountBalanceOfEqual(user, derivativeDenom, sdk.ZeroInt()) + suite.AccountBalanceOfEqual(user, derivativeDenom, sdkmath.ZeroInt()) // There should be zero shares left because undelegate removes all created by burn. - suite.AccountBalanceOfEqual(user, derivativeDenom, sdk.ZeroInt()) + suite.AccountBalanceOfEqual(user, derivativeDenom, sdkmath.ZeroInt()) // User should have most of their original balance back in an unbonding delegation suite.UnbondingDelegationInDeltaBelow(valAddr, user, userBalance, sdkmath.NewInt(2)) } @@ -275,7 +280,8 @@ func (suite *msgServerTestSuite) setupValidator() (sdk.AccAddress, sdk.ValAddres suite.CreateAccountWithAddress(user, suite.NewBondCoins(balance)) suite.CreateNewUnbondedValidator(valAddr, balance) - staking.EndBlocker(suite.Ctx, suite.StakingKeeper) + _, err := suite.StakingKeeper.EndBlocker(suite.Ctx) + suite.Require().NoError(err) return user, valAddr, balance } @@ -291,7 +297,8 @@ func (suite *msgServerTestSuite) setupValidatorAndDelegation() (sdk.AccAddress, suite.CreateNewUnbondedValidator(valAddr, balance) suite.CreateDelegation(valAddr, user, balance) - staking.EndBlocker(suite.Ctx, suite.StakingKeeper) + _, err := suite.StakingKeeper.EndBlocker(suite.Ctx) + suite.Require().NoError(err) return user, valAddr, balance } diff --git a/x/router/module.go b/x/router/module.go index 41be3f3054..9646dbbe1c 100644 --- a/x/router/module.go +++ b/x/router/module.go @@ -110,9 +110,15 @@ func (am AppModule) ExportGenesis(_ sdk.Context, cdc codec.JSONCodec) json.RawMe } // BeginBlock module begin-block -func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} +func (am AppModule) BeginBlock(_ sdk.Context) error { + return nil +} // EndBlock module end-block -func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - return []abci.ValidatorUpdate{} +func (am AppModule) EndBlock(_ sdk.Context) ([]abci.ValidatorUpdate, error) { + return []abci.ValidatorUpdate{}, nil } + +func (AppModule) IsOnePerModuleType() {} + +func (AppModule) IsAppModule() {} diff --git a/x/router/testutil/suite.go b/x/router/testutil/suite.go index 8bbbfdd102..abd16dea2c 100644 --- a/x/router/testutil/suite.go +++ b/x/router/testutil/suite.go @@ -39,7 +39,7 @@ type Suite struct { // The default state used by each test func (suite *Suite) SetupTest() { tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) tApp.InitializeFromGenesisStates() @@ -52,7 +52,7 @@ func (suite *Suite) SetupTest() { } // CreateAccount creates a new account from the provided balance and address -func (suite *Suite) CreateAccountWithAddress(addr sdk.AccAddress, initialBalance sdk.Coins) authtypes.AccountI { +func (suite *Suite) CreateAccountWithAddress(addr sdk.AccAddress, initialBalance sdk.Coins) sdk.AccountI { ak := suite.App.GetAccountKeeper() acc := ak.NewAccountWithAddress(suite.Ctx, addr) @@ -65,7 +65,7 @@ func (suite *Suite) CreateAccountWithAddress(addr sdk.AccAddress, initialBalance } // CreateVestingAccount creates a new vesting account. `vestingBalance` should be a fraction of `initialBalance`. -func (suite *Suite) CreateVestingAccountWithAddress(addr sdk.AccAddress, initialBalance sdk.Coins, vestingBalance sdk.Coins) authtypes.AccountI { +func (suite *Suite) CreateVestingAccountWithAddress(addr sdk.AccAddress, initialBalance sdk.Coins, vestingBalance sdk.Coins) sdk.AccountI { if vestingBalance.IsAnyGT(initialBalance) { panic("vesting balance must be less than initial balance") } @@ -78,7 +78,8 @@ func (suite *Suite) CreateVestingAccountWithAddress(addr sdk.AccAddress, initial Amount: vestingBalance, }, } - vacc := vestingtypes.NewPeriodicVestingAccount(bacc, vestingBalance, suite.Ctx.BlockTime().Unix(), periods) + vacc, err := vestingtypes.NewPeriodicVestingAccount(bacc, vestingBalance, suite.Ctx.BlockTime().Unix(), periods) + suite.Require().NoError(err) suite.App.GetAccountKeeper().SetAccount(suite.Ctx, vacc) return vacc } @@ -124,11 +125,11 @@ func (suite *Suite) QueryBank_SpendableBalance(user sdk.AccAddress) sdk.Coins { func (suite *Suite) deliverMsgCreateValidator(ctx sdk.Context, address sdk.ValAddress, selfDelegation sdk.Coin) error { msg, err := stakingtypes.NewMsgCreateValidator( - address, + address.String(), ed25519.GenPrivKey().PubKey(), selfDelegation, - stakingtypes.Description{}, - stakingtypes.NewCommissionRates(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()), + stakingtypes.NewDescription("router_moniker", "", "", "", ""), + stakingtypes.NewCommissionRates(sdkmath.LegacyZeroDec(), sdkmath.LegacyZeroDec(), sdkmath.LegacyZeroDec()), sdkmath.NewInt(1e6), ) if err != nil { @@ -142,7 +143,8 @@ func (suite *Suite) deliverMsgCreateValidator(ctx sdk.Context, address sdk.ValAd // NewBondCoin creates a Coin with the current staking denom. func (suite *Suite) NewBondCoin(amount sdkmath.Int) sdk.Coin { - stakingDenom := suite.StakingKeeper.BondDenom(suite.Ctx) + stakingDenom, err := suite.StakingKeeper.BondDenom(suite.Ctx) + suite.Require().NoError(err) return sdk.NewCoin(stakingDenom, amount) } @@ -160,15 +162,15 @@ func (suite *Suite) CreateNewUnbondedValidator(addr sdk.ValAddress, selfDelegati // New validators are created in an unbonded state. Note if the end blocker is run later this validator could become bonded. - validator, found := suite.StakingKeeper.GetValidator(suite.Ctx, addr) - suite.Require().True(found) + validator, err := suite.StakingKeeper.GetValidator(suite.Ctx, addr) + suite.Require().NoError(err) return validator } // SlashValidator burns tokens staked in a validator. new_tokens = old_tokens * (1-slashFraction) -func (suite *Suite) SlashValidator(addr sdk.ValAddress, slashFraction sdk.Dec) { - validator, found := suite.StakingKeeper.GetValidator(suite.Ctx, addr) - suite.Require().True(found) +func (suite *Suite) SlashValidator(addr sdk.ValAddress, slashFraction sdkmath.LegacyDec) { + validator, err := suite.StakingKeeper.GetValidator(suite.Ctx, addr) + suite.Require().NoError(err) consAddr, err := validator.GetConsAddr() suite.Require().NoError(err) @@ -182,32 +184,33 @@ func (suite *Suite) SlashValidator(addr sdk.ValAddress, slashFraction sdk.Dec) { } // CreateDelegation delegates tokens to a validator. -func (suite *Suite) CreateDelegation(valAddr sdk.ValAddress, delegator sdk.AccAddress, amount sdkmath.Int) sdk.Dec { - stakingDenom := suite.StakingKeeper.BondDenom(suite.Ctx) +func (suite *Suite) CreateDelegation(valAddr sdk.ValAddress, delegator sdk.AccAddress, amount sdkmath.Int) sdkmath.LegacyDec { + stakingDenom, err := suite.StakingKeeper.BondDenom(suite.Ctx) + suite.Require().NoError(err) msg := stakingtypes.NewMsgDelegate( - delegator, - valAddr, + delegator.String(), + valAddr.String(), sdk.NewCoin(stakingDenom, amount), ) msgServer := stakingkeeper.NewMsgServerImpl(suite.StakingKeeper) - _, err := msgServer.Delegate(sdk.WrapSDKContext(suite.Ctx), msg) + _, err = msgServer.Delegate(sdk.WrapSDKContext(suite.Ctx), msg) suite.Require().NoError(err) - del, found := suite.StakingKeeper.GetDelegation(suite.Ctx, delegator, valAddr) - suite.Require().True(found) + del, err := suite.StakingKeeper.GetDelegation(suite.Ctx, delegator, valAddr) + suite.Require().NoError(err) return del.Shares } // DelegationSharesEqual checks if a delegation has the specified shares. // It expects delegations with zero shares to not be stored in state. -func (suite *Suite) DelegationSharesEqual(valAddr sdk.ValAddress, delegator sdk.AccAddress, shares sdk.Dec) bool { - del, found := suite.StakingKeeper.GetDelegation(suite.Ctx, delegator, valAddr) +func (suite *Suite) DelegationSharesEqual(valAddr sdk.ValAddress, delegator sdk.AccAddress, shares sdkmath.LegacyDec) bool { + del, err := suite.StakingKeeper.GetDelegation(suite.Ctx, delegator, valAddr) if shares.IsZero() { - return suite.Falsef(found, "expected delegator to not be found, got %s shares", del.Shares) + return suite.Error(err, "expected delegator to not be found, got %s shares", del.Shares) } else { - res := suite.True(found, "expected delegator to be found") + res := suite.NoError(err, "expected delegator to be found") return res && suite.Truef(shares.Equal(del.Shares), "expected %s delegator shares but got %s", shares, del.Shares) } } @@ -215,14 +218,14 @@ func (suite *Suite) DelegationSharesEqual(valAddr sdk.ValAddress, delegator sdk. // DelegationBalanceLessThan checks if a delegation's staked token balance is less the specified amount. // It treats not found delegations as having zero shares. func (suite *Suite) DelegationBalanceLessThan(valAddr sdk.ValAddress, delegator sdk.AccAddress, max sdkmath.Int) bool { - shares := sdk.ZeroDec() - del, found := suite.StakingKeeper.GetDelegation(suite.Ctx, delegator, valAddr) - if found { + shares := sdkmath.LegacyZeroDec() + del, err := suite.StakingKeeper.GetDelegation(suite.Ctx, delegator, valAddr) + if err != nil { shares = del.Shares } - val, found := suite.StakingKeeper.GetValidator(suite.Ctx, valAddr) - suite.Require().Truef(found, "expected validator to be found") + val, err := suite.StakingKeeper.GetValidator(suite.Ctx, valAddr) + suite.Require().NoError(err, "expected validator to be found") tokens := val.TokensFromShares(shares).TruncateInt() @@ -232,14 +235,14 @@ func (suite *Suite) DelegationBalanceLessThan(valAddr sdk.ValAddress, delegator // DelegationBalanceInDeltaBelow checks if a delegation's staked token balance is between `expected` and `expected - delta` inclusive. // It treats not found delegations as having zero shares. func (suite *Suite) DelegationBalanceInDeltaBelow(valAddr sdk.ValAddress, delegator sdk.AccAddress, expected, delta sdkmath.Int) bool { - shares := sdk.ZeroDec() - del, found := suite.StakingKeeper.GetDelegation(suite.Ctx, delegator, valAddr) - if found { + shares := sdkmath.LegacyZeroDec() + del, err := suite.StakingKeeper.GetDelegation(suite.Ctx, delegator, valAddr) + if err == nil { shares = del.Shares } - val, found := suite.StakingKeeper.GetValidator(suite.Ctx, valAddr) - suite.Require().Truef(found, "expected validator to be found") + val, err := suite.StakingKeeper.GetValidator(suite.Ctx, valAddr) + suite.Require().NoError(err, "expected validator to be found") tokens := val.TokensFromShares(shares).TruncateInt() @@ -250,9 +253,9 @@ func (suite *Suite) DelegationBalanceInDeltaBelow(valAddr sdk.ValAddress, delega // UnbondingDelegationInDeltaBelow checks if the total balance in an unbonding delegation is between `expected` and `expected - delta` inclusive. func (suite *Suite) UnbondingDelegationInDeltaBelow(valAddr sdk.ValAddress, delegator sdk.AccAddress, expected, delta sdkmath.Int) bool { - tokens := sdk.ZeroInt() - ubd, found := suite.StakingKeeper.GetUnbondingDelegation(suite.Ctx, delegator, valAddr) - if found { + tokens := sdkmath.ZeroInt() + ubd, err := suite.StakingKeeper.GetUnbondingDelegation(suite.Ctx, delegator, valAddr) + if err == nil { for _, entry := range ubd.Entries { tokens = tokens.Add(entry.Balance) } diff --git a/x/router/types/codec.go b/x/router/types/codec.go index dfd5046c03..2e12b9df6c 100644 --- a/x/router/types/codec.go +++ b/x/router/types/codec.go @@ -6,7 +6,6 @@ import ( cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" - authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec" ) // RegisterLegacyAminoCodec registers all the necessary types and interfaces for the module. @@ -42,5 +41,5 @@ func init() { // Register all Amino interfaces and concrete types on the authz Amino codec so that this can later be // used to properly serialize MsgGrant and MsgExec instances - RegisterLegacyAminoCodec(authzcodec.Amino) + RegisterLegacyAminoCodec(codec.NewLegacyAmino()) } diff --git a/x/router/types/expected_keepers.go b/x/router/types/expected_keepers.go index 927160bb58..de83062f0f 100644 --- a/x/router/types/expected_keepers.go +++ b/x/router/types/expected_keepers.go @@ -1,6 +1,7 @@ package types import ( + "context" "time" sdkmath "cosmossdk.io/math" @@ -11,22 +12,22 @@ import ( ) type StakingKeeper interface { - BondDenom(ctx sdk.Context) (res string) - GetValidator(ctx sdk.Context, addr sdk.ValAddress) (validator stakingtypes.Validator, found bool) + BondDenom(ctx context.Context) (res string, err error) + GetValidator(ctx context.Context, addr sdk.ValAddress) (validator stakingtypes.Validator, err error) Delegate( - ctx sdk.Context, delAddr sdk.AccAddress, bondAmt sdkmath.Int, tokenSrc stakingtypes.BondStatus, + ctx context.Context, delAddr sdk.AccAddress, bondAmt sdkmath.Int, tokenSrc stakingtypes.BondStatus, validator stakingtypes.Validator, subtractAccount bool, - ) (newShares sdk.Dec, err error) + ) (newShares sdkmath.LegacyDec, err error) Undelegate( - ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress, sharesAmount sdk.Dec, - ) (time.Time, error) + ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress, sharesAmount sdkmath.LegacyDec, + ) (time.Time, sdkmath.Int, error) } type LiquidKeeper interface { DerivativeFromTokens(ctx sdk.Context, valAddr sdk.ValAddress, amount sdk.Coin) (sdk.Coin, error) MintDerivative(ctx sdk.Context, delegatorAddr sdk.AccAddress, valAddr sdk.ValAddress, amount sdk.Coin) (sdk.Coin, error) - BurnDerivative(ctx sdk.Context, delegatorAddr sdk.AccAddress, valAddr sdk.ValAddress, amount sdk.Coin) (sdk.Dec, error) + BurnDerivative(ctx sdk.Context, delegatorAddr sdk.AccAddress, valAddr sdk.ValAddress, amount sdk.Coin) (sdkmath.LegacyDec, error) } type EarnKeeper interface { diff --git a/x/router/types/msg_test.go b/x/router/types/msg_test.go index 2f7b10fdb7..4d17886332 100644 --- a/x/router/types/msg_test.go +++ b/x/router/types/msg_test.go @@ -153,7 +153,7 @@ func TestMsg_Validate(t *testing.T) { msgArgs: msgArgs{ depositor: validAddress, validator: validValidatorAddress, - amount: sdk.NewCoin("ukava", sdk.ZeroInt()), + amount: sdk.NewCoin("ukava", sdkmath.ZeroInt()), }, expectedErr: sdkerrors.ErrInvalidCoins, }, @@ -179,7 +179,10 @@ func TestMsg_Validate(t *testing.T) { msgs := []sdk.Msg{&msgMintDeposit, &msgDelegateMintDeposit, &msgWithdrawBurn, &msgWithdrawBurnUndelegate} for _, msg := range msgs { t.Run(fmt.Sprintf("%T", msg), func(t *testing.T) { - err := msg.ValidateBasic() + validateBasic, ok := msg.(sdk.HasValidateBasic) + require.True(t, ok, "msg does not implement sdk.HasValidateBasic") + + err := validateBasic.ValidateBasic() if tc.expectedErr == nil { require.NoError(t, err) } else { diff --git a/x/router/types/tx.pb.go b/x/router/types/tx.pb.go index 5f0dc21989..5303626699 100644 --- a/x/router/types/tx.pb.go +++ b/x/router/types/tx.pb.go @@ -574,6 +574,7 @@ func _Msg_WithdrawBurnUndelegate_Handler(srv interface{}, ctx context.Context, d return interceptor(ctx, in, info, handler) } +var Msg_serviceDesc = _Msg_serviceDesc var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "kava.router.v1beta1.Msg", HandlerType: (*MsgServer)(nil), diff --git a/x/savings/genesis_test.go b/x/savings/genesis_test.go index d2becb567c..27857647f6 100644 --- a/x/savings/genesis_test.go +++ b/x/savings/genesis_test.go @@ -30,7 +30,7 @@ type GenesisTestSuite struct { func (suite *GenesisTestSuite) SetupTest() { tApp := app.NewTestApp() suite.genTime = tmtime.Canonical(time.Date(2022, 1, 1, 1, 1, 1, 1, time.UTC)) - suite.ctx = tApp.NewContext(true, tmproto.Header{Height: 1, Time: suite.genTime}) + suite.ctx = tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: suite.genTime}) suite.keeper = tApp.GetSavingsKeeper() suite.app = tApp diff --git a/x/savings/keeper/deposit_test.go b/x/savings/keeper/deposit_test.go index c6e4e2cafb..22c5c4786e 100644 --- a/x/savings/keeper/deposit_test.go +++ b/x/savings/keeper/deposit_test.go @@ -9,7 +9,6 @@ import ( tmproto "github.com/cometbft/cometbft/proto/tendermint/types" tmtime "github.com/cometbft/cometbft/types/time" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/staking" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/kava-labs/kava/app" @@ -155,7 +154,7 @@ func (suite *KeeperTestSuite) TestDeposit() { // Initialize test app and set context tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) authGS := app.NewFundedGenStateWithCoins( tApp.AppCodec(), []sdk.Coins{tc.args.initialDepositorBalance}, @@ -184,10 +183,10 @@ func (suite *KeeperTestSuite) TestDeposit() { suite.CreateNewUnbondedValidator(valAddr, initialBalance) suite.CreateDelegation(valAddr, delegator, initialBalance) - staking.EndBlocker(suite.ctx, suite.app.GetStakingKeeper()) + _, err := suite.app.GetStakingKeeper().EndBlocker(suite.ctx) + suite.Require().NoError(err) // run the test - var err error for i := 0; i < tc.args.numberDeposits; i++ { err = suite.keeper.Deposit(suite.ctx, tc.args.depositor, tc.args.depositAmount) } diff --git a/x/savings/keeper/grpcquery_test.go b/x/savings/keeper/grpcquery_test.go index 8708130233..daadeac96b 100644 --- a/x/savings/keeper/grpcquery_test.go +++ b/x/savings/keeper/grpcquery_test.go @@ -1,17 +1,15 @@ package keeper_test import ( - "testing" - "time" - - "github.com/stretchr/testify/suite" - sdkmath "cosmossdk.io/math" + "fmt" tmprototypes "github.com/cometbft/cometbft/proto/tendermint/types" "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/suite" + "testing" + "time" - "github.com/cosmos/cosmos-sdk/x/staking" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/kava-labs/kava/app" @@ -41,10 +39,15 @@ func (suite *grpcQueryTestSuite) SetupTest() { suite.tApp = app.NewTestApp() _, addrs := app.GeneratePrivKeyAddressPairs(2) + //fmt.Println("SetupTest: next account number for fund 1", suite.tApp.GetAccountKeeper().NextAccountNumber(suite.ctx)) + suite.addrs = addrs - suite.ctx = suite.tApp.NewContext(true, tmprototypes.Header{}). + suite.ctx = suite.tApp.NewContextLegacy(true, tmprototypes.Header{}). WithBlockTime(time.Now().UTC()) + + fmt.Println("SetupTest: next account number for fund 2", suite.tApp.GetAccountKeeper().NextAccountNumber(suite.ctx)) + suite.keeper = suite.tApp.GetSavingsKeeper() suite.queryServer = keeper.NewQueryServerImpl(suite.keeper) @@ -63,6 +66,8 @@ func (suite *grpcQueryTestSuite) SetupTest() { } savingsGenState := app.GenesisState{types.ModuleName: suite.tApp.AppCodec().MustMarshalJSON(&savingsGenesis)} + fmt.Println("SetupTest: before genesis", suite.tApp.GetAccountKeeper().NextAccountNumber(suite.ctx)) + suite.tApp.InitializeFromGenesisStates( savingsGenState, app.NewFundedGenStateWithSameCoins( @@ -74,6 +79,9 @@ func (suite *grpcQueryTestSuite) SetupTest() { addrs, ), ) + + suite.ctx = suite.tApp.NewContextLegacy(true, tmprototypes.Header{}) + fmt.Println("SetupTest: after genesis", suite.tApp.GetAccountKeeper().NextAccountNumber(suite.ctx)) } func (suite *grpcQueryTestSuite) TestGrpcQueryParams() { @@ -233,13 +241,19 @@ func (suite *grpcQueryTestSuite) TestGrpcQueryTotalSupply() { suite.Run("aggregates bkava denoms, accounting for slashing", func() { suite.SetupTest() + err := suite.tApp.GetStakingKeeper().BeginBlocker(suite.ctx) + suite.Require().NoError(err) + + fmt.Println("TestGrpcQueryTotalSupply before first") address1, derivatives1, _ := suite.createAccountWithDerivatives(bkava1, sdkmath.NewInt(1e9)) + fmt.Println("TestGrpcQueryTotalSupply before second") address2, derivatives2, _ := suite.createAccountWithDerivatives(bkava2, sdkmath.NewInt(1e9)) // bond validators - staking.EndBlocker(suite.ctx, suite.tApp.GetStakingKeeper()) + _, err = suite.tApp.GetStakingKeeper().EndBlocker(suite.ctx) + suite.Require().NoError(err) // slash val2 - its shares are now 80% as valuable! - err := suite.slashValidator(sdk.ValAddress(address2), sdk.MustNewDecFromStr("0.2")) + err = suite.slashValidator(sdk.ValAddress(address2), sdkmath.LegacyMustNewDecFromStr("0.2")) suite.Require().NoError(err) suite.addDeposits( @@ -277,11 +291,11 @@ func (suite *grpcQueryTestSuite) addDeposits(deposits types.Deposits) { // createUnbondedValidator creates an unbonded validator with the given amount of self-delegation. func (suite *grpcQueryTestSuite) createUnbondedValidator(address sdk.ValAddress, selfDelegation sdk.Coin, minSelfDelegation sdkmath.Int) error { msg, err := stakingtypes.NewMsgCreateValidator( - address, + address.String(), ed25519.GenPrivKey().PubKey(), selfDelegation, - stakingtypes.Description{}, - stakingtypes.NewCommissionRates(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()), + stakingtypes.NewDescription("savings_moniker", "", "", "", ""), + stakingtypes.NewCommissionRates(sdkmath.LegacyZeroDec(), sdkmath.LegacyZeroDec(), sdkmath.LegacyZeroDec()), minSelfDelegation, ) if err != nil { @@ -296,10 +310,13 @@ func (suite *grpcQueryTestSuite) createUnbondedValidator(address sdk.ValAddress, // createAccountWithDerivatives creates an account with the given amount and denom of derivative token. // Internally, it creates a validator account and mints derivatives from the validator's self delegation. func (suite *grpcQueryTestSuite) createAccountWithDerivatives(denom string, amount sdkmath.Int) (sdk.AccAddress, sdk.Coin, sdk.Coins) { - bondDenom := suite.tApp.GetStakingKeeper().BondDenom(suite.ctx) + fmt.Println("createAccountWithDerivatives: next account number for fund", suite.tApp.GetAccountKeeper().NextAccountNumber(suite.ctx)) + bondDenom, err := suite.tApp.GetStakingKeeper().BondDenom(suite.ctx) + suite.Require().NoError(err) valAddress, err := liquidtypes.ParseLiquidStakingTokenDenom(denom) suite.Require().NoError(err) address := sdk.AccAddress(valAddress) + fmt.Println("createAccountWithDerivatives before", valAddress.String()) remainingSelfDelegation := sdkmath.NewInt(1e6) selfDelegation := sdk.NewCoin( @@ -331,11 +348,11 @@ func (suite *grpcQueryTestSuite) createAccountWithDerivatives(denom string, amou } // slashValidator slashes the validator with the given address by the given percentage. -func (suite *grpcQueryTestSuite) slashValidator(address sdk.ValAddress, slashFraction sdk.Dec) error { +func (suite *grpcQueryTestSuite) slashValidator(address sdk.ValAddress, slashFraction sdkmath.LegacyDec) error { stakingKeeper := suite.tApp.GetStakingKeeper() - validator, found := stakingKeeper.GetValidator(suite.ctx, address) - suite.Require().True(found) + validator, err := stakingKeeper.GetValidator(suite.ctx, address) + suite.Require().NoError(err) consAddr, err := validator.GetConsAddr() suite.Require().NoError(err) diff --git a/x/savings/keeper/hooks.go b/x/savings/keeper/hooks.go index 9bc577de96..975beac09f 100644 --- a/x/savings/keeper/hooks.go +++ b/x/savings/keeper/hooks.go @@ -1,8 +1,7 @@ package keeper import ( - sdk "github.com/cosmos/cosmos-sdk/types" - + "context" "github.com/kava-labs/kava/x/savings/types" ) @@ -10,14 +9,14 @@ import ( var _ types.SavingsHooks = Keeper{} // AfterSavingsDepositCreated - call hook if registered -func (k Keeper) AfterSavingsDepositCreated(ctx sdk.Context, deposit types.Deposit) { +func (k Keeper) AfterSavingsDepositCreated(ctx context.Context, deposit types.Deposit) { if k.hooks != nil { k.hooks.AfterSavingsDepositCreated(ctx, deposit) } } // BeforeSavingsDepositModified - call hook if registered -func (k Keeper) BeforeSavingsDepositModified(ctx sdk.Context, deposit types.Deposit, incomingDenoms []string) { +func (k Keeper) BeforeSavingsDepositModified(ctx context.Context, deposit types.Deposit, incomingDenoms []string) { if k.hooks != nil { k.hooks.BeforeSavingsDepositModified(ctx, deposit, incomingDenoms) } diff --git a/x/savings/keeper/invariants.go b/x/savings/keeper/invariants.go index e963b59703..0e0eb75f5c 100644 --- a/x/savings/keeper/invariants.go +++ b/x/savings/keeper/invariants.go @@ -61,7 +61,7 @@ func SolvencyInvariant(k Keeper) sdk.Invariant { return false }) - broken := !deposited.IsEqual(balance) + broken := !deposited.Equal(balance) return message, broken } } diff --git a/x/savings/keeper/invariants_test.go b/x/savings/keeper/invariants_test.go index 866a5aed74..1236a97b67 100644 --- a/x/savings/keeper/invariants_test.go +++ b/x/savings/keeper/invariants_test.go @@ -32,7 +32,7 @@ func (suite *invariantTestSuite) SetupTest() { app.SetBech32AddressPrefixes(config) tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) _, addrs := app.GeneratePrivKeyAddressPairs(1) suite.addrs = addrs diff --git a/x/savings/keeper/keeper.go b/x/savings/keeper/keeper.go index 76ca0caa1a..6ab2a7ac1f 100644 --- a/x/savings/keeper/keeper.go +++ b/x/savings/keeper/keeper.go @@ -3,10 +3,10 @@ package keeper import ( "fmt" - "github.com/cometbft/cometbft/libs/log" + "cosmossdk.io/log" + "cosmossdk.io/store/prefix" + storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/store/prefix" - storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" @@ -87,7 +87,7 @@ func (k Keeper) DeleteDeposit(ctx sdk.Context, deposit types.Deposit) { // IterateDeposits iterates over all deposit objects in the store and performs a callback function func (k Keeper) IterateDeposits(ctx sdk.Context, cb func(deposit types.Deposit) (stop bool)) { store := prefix.NewStore(ctx.KVStore(k.key), types.DepositsKeyPrefix) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) + iterator := storetypes.KVStorePrefixIterator(store, []byte{}) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { var deposit types.Deposit diff --git a/x/savings/keeper/keeper_test.go b/x/savings/keeper/keeper_test.go index 5b862fa545..bb0a001a20 100644 --- a/x/savings/keeper/keeper_test.go +++ b/x/savings/keeper/keeper_test.go @@ -36,7 +36,7 @@ func (suite *KeeperTestSuite) SetupTest() { app.SetBech32AddressPrefixes(config) tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) tApp.InitializeFromGenesisStates() _, addrs := app.GeneratePrivKeyAddressPairs(1) keeper := tApp.GetSavingsKeeper() @@ -80,27 +80,27 @@ func (suite *KeeperTestSuite) TestIterateDeposits() { suite.Require().Equal(5, len(deposits)) } -func (suite *KeeperTestSuite) getAccountCoins(acc authtypes.AccountI) sdk.Coins { +func (suite *KeeperTestSuite) getAccountCoins(acc sdk.AccountI) sdk.Coins { bk := suite.app.GetBankKeeper() return bk.GetAllBalances(suite.ctx, acc.GetAddress()) } -func (suite *KeeperTestSuite) getAccount(addr sdk.AccAddress) authtypes.AccountI { +func (suite *KeeperTestSuite) getAccount(addr sdk.AccAddress) sdk.AccountI { ak := suite.app.GetAccountKeeper() return ak.GetAccount(suite.ctx, addr) } -func (suite *KeeperTestSuite) getAccountAtCtx(addr sdk.AccAddress, ctx sdk.Context) authtypes.AccountI { +func (suite *KeeperTestSuite) getAccountAtCtx(addr sdk.AccAddress, ctx sdk.Context) sdk.AccountI { ak := suite.app.GetAccountKeeper() return ak.GetAccount(ctx, addr) } -func (suite *KeeperTestSuite) getModuleAccount(name string) authtypes.ModuleAccountI { +func (suite *KeeperTestSuite) getModuleAccount(name string) sdk.ModuleAccountI { ak := suite.app.GetAccountKeeper() return ak.GetModuleAccount(suite.ctx, name) } -func (suite *KeeperTestSuite) getModuleAccountAtCtx(name string, ctx sdk.Context) authtypes.ModuleAccountI { +func (suite *KeeperTestSuite) getModuleAccountAtCtx(name string, ctx sdk.Context) sdk.ModuleAccountI { ak := suite.app.GetAccountKeeper() return ak.GetModuleAccount(ctx, name) } @@ -110,7 +110,7 @@ func TestKeeperTestSuite(t *testing.T) { } // CreateAccount creates a new account from the provided balance and address -func (suite *KeeperTestSuite) CreateAccountWithAddress(addr sdk.AccAddress, initialBalance sdk.Coins) authtypes.AccountI { +func (suite *KeeperTestSuite) CreateAccountWithAddress(addr sdk.AccAddress, initialBalance sdk.Coins) sdk.AccountI { ak := suite.app.GetAccountKeeper() acc := ak.NewAccountWithAddress(suite.ctx, addr) @@ -123,7 +123,7 @@ func (suite *KeeperTestSuite) CreateAccountWithAddress(addr sdk.AccAddress, init } // CreateVestingAccount creates a new vesting account. `vestingBalance` should be a fraction of `initialBalance`. -func (suite *KeeperTestSuite) CreateVestingAccountWithAddress(addr sdk.AccAddress, initialBalance sdk.Coins, vestingBalance sdk.Coins) authtypes.AccountI { +func (suite *KeeperTestSuite) CreateVestingAccountWithAddress(addr sdk.AccAddress, initialBalance sdk.Coins, vestingBalance sdk.Coins) sdk.AccountI { if vestingBalance.IsAnyGT(initialBalance) { panic("vesting balance must be less than initial balance") } @@ -136,18 +136,19 @@ func (suite *KeeperTestSuite) CreateVestingAccountWithAddress(addr sdk.AccAddres Amount: vestingBalance, }, } - vacc := vestingtypes.NewPeriodicVestingAccount(bacc, vestingBalance, suite.ctx.BlockTime().Unix(), periods) + vacc, err := vestingtypes.NewPeriodicVestingAccount(bacc, vestingBalance, suite.ctx.BlockTime().Unix(), periods) + suite.Require().NoError(err) suite.app.GetAccountKeeper().SetAccount(suite.ctx, vacc) return vacc } func (suite *KeeperTestSuite) deliverMsgCreateValidator(ctx sdk.Context, address sdk.ValAddress, selfDelegation sdk.Coin) error { msg, err := stakingtypes.NewMsgCreateValidator( - address, + address.String(), ed25519.GenPrivKey().PubKey(), selfDelegation, - stakingtypes.Description{}, - stakingtypes.NewCommissionRates(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()), + stakingtypes.NewDescription("savings_moniker", "", "", "", ""), + stakingtypes.NewCommissionRates(sdkmath.LegacyZeroDec(), sdkmath.LegacyZeroDec(), sdkmath.LegacyZeroDec()), sdkmath.NewInt(1e6), ) if err != nil { @@ -168,27 +169,28 @@ func (suite *KeeperTestSuite) CreateNewUnbondedValidator(addr sdk.ValAddress, se // New validators are created in an unbonded state. Note if the end blocker is run later this validator could become bonded. - validator, found := suite.app.GetStakingKeeper().GetValidator(suite.ctx, addr) - suite.Require().True(found) + validator, err := suite.app.GetStakingKeeper().GetValidator(suite.ctx, addr) + suite.Require().NoError(err) return validator } // CreateDelegation delegates tokens to a validator. -func (suite *KeeperTestSuite) CreateDelegation(valAddr sdk.ValAddress, delegator sdk.AccAddress, amount sdkmath.Int) sdk.Dec { +func (suite *KeeperTestSuite) CreateDelegation(valAddr sdk.ValAddress, delegator sdk.AccAddress, amount sdkmath.Int) sdkmath.LegacyDec { sk := suite.app.GetStakingKeeper() - stakingDenom := sk.BondDenom(suite.ctx) + stakingDenom, err := sk.BondDenom(suite.ctx) + suite.Require().NoError(err) msg := stakingtypes.NewMsgDelegate( - delegator, - valAddr, + delegator.String(), + valAddr.String(), sdk.NewCoin(stakingDenom, amount), ) msgServer := stakingkeeper.NewMsgServerImpl(sk) - _, err := msgServer.Delegate(sdk.WrapSDKContext(suite.ctx), msg) + _, err = msgServer.Delegate(sdk.WrapSDKContext(suite.ctx), msg) suite.Require().NoError(err) - del, found := sk.GetDelegation(suite.ctx, delegator, valAddr) - suite.Require().True(found) + del, err := sk.GetDelegation(suite.ctx, delegator, valAddr) + suite.Require().NoError(err) return del.Shares } diff --git a/x/savings/keeper/withdraw_test.go b/x/savings/keeper/withdraw_test.go index b4f61f98a6..fbc4de7574 100644 --- a/x/savings/keeper/withdraw_test.go +++ b/x/savings/keeper/withdraw_test.go @@ -9,7 +9,6 @@ import ( tmproto "github.com/cometbft/cometbft/proto/tendermint/types" tmtime "github.com/cometbft/cometbft/types/time" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/staking" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/kava-labs/kava/app" @@ -141,7 +140,7 @@ func (suite *KeeperTestSuite) TestWithdraw() { suite.Run(tc.name, func() { // Initialize test app and set context tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) authGS := app.NewFundedGenStateWithCoins( tApp.AppCodec(), []sdk.Coins{tc.args.initialDepositorBalance}, @@ -171,9 +170,10 @@ func (suite *KeeperTestSuite) TestWithdraw() { suite.CreateNewUnbondedValidator(valAddr, initialBalance) suite.CreateDelegation(valAddr, delegator, initialBalance) - staking.EndBlocker(suite.ctx, suite.app.GetStakingKeeper()) + _, err := suite.app.GetStakingKeeper().EndBlocker(suite.ctx) + suite.Require().NoError(err) - err := suite.keeper.Deposit(suite.ctx, tc.args.depositor, tc.args.depositAmount) + err = suite.keeper.Deposit(suite.ctx, tc.args.depositor, tc.args.depositAmount) suite.Require().NoError(err) err = suite.keeper.Withdraw(suite.ctx, tc.args.depositor, tc.args.withdrawAmount) @@ -184,7 +184,7 @@ func (suite *KeeperTestSuite) TestWithdraw() { suite.Require().Equal(tc.args.expectedAccountBalance, bankKeeper.GetAllBalances(ctx, acc.GetAddress())) // Check savings module account balance mAcc := suite.getModuleAccount(types.ModuleAccountName) - suite.Require().True(tc.args.expectedModAccountBalance.IsEqual(bankKeeper.GetAllBalances(ctx, mAcc.GetAddress()))) + suite.Require().True(tc.args.expectedModAccountBalance.Equal(bankKeeper.GetAllBalances(ctx, mAcc.GetAddress()))) // Check deposit testDeposit, f := suite.keeper.GetDeposit(suite.ctx, tc.args.depositor) if tc.errArgs.expectDelete { diff --git a/x/savings/module.go b/x/savings/module.go index f7649ec37a..82d5bcbbd2 100644 --- a/x/savings/module.go +++ b/x/savings/module.go @@ -137,10 +137,15 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // BeginBlock module begin-block -func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) { +func (am AppModule) BeginBlock(_ sdk.Context) error { + return nil } // EndBlock module end-block -func (am AppModule) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - return []abci.ValidatorUpdate{} +func (am AppModule) EndBlock(ctx sdk.Context) ([]abci.ValidatorUpdate, error) { + return []abci.ValidatorUpdate{}, nil } + +func (AppModule) IsOnePerModuleType() {} + +func (AppModule) IsAppModule() {} diff --git a/x/savings/types/codec.go b/x/savings/types/codec.go index 44048a875e..d6e3d06254 100644 --- a/x/savings/types/codec.go +++ b/x/savings/types/codec.go @@ -6,7 +6,6 @@ import ( cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" - authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec" ) // RegisterLegacyAminoCodec registers all the necessary types and interfaces for the @@ -36,5 +35,5 @@ func init() { // Register all Amino interfaces and concrete types on the authz Amino codec so that this can later be // used to properly serialize MsgGrant and MsgExec instances - RegisterLegacyAminoCodec(authzcodec.Amino) + RegisterLegacyAminoCodec(codec.NewLegacyAmino()) } diff --git a/x/savings/types/expected_keepers.go b/x/savings/types/expected_keepers.go index 7072936c01..06f5018e9e 100644 --- a/x/savings/types/expected_keepers.go +++ b/x/savings/types/expected_keepers.go @@ -1,35 +1,35 @@ package types // noalias import ( + "context" sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) // BankKeeper defines the expected bank keeper type BankKeeper interface { - SendCoinsFromModuleToModule(ctx sdk.Context, senderModule, recipientModule string, amt sdk.Coins) error - SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error - SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error + SendCoinsFromModuleToModule(ctx context.Context, senderModule, recipientModule string, amt sdk.Coins) error + SendCoinsFromAccountToModule(ctx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error + SendCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error - GetSupply(ctx sdk.Context, denom string) sdk.Coin - GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin - GetAllBalances(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins - SpendableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins + GetSupply(ctx context.Context, denom string) sdk.Coin + GetBalance(ctx context.Context, addr sdk.AccAddress, denom string) sdk.Coin + GetAllBalances(ctx context.Context, addr sdk.AccAddress) sdk.Coins + SpendableCoins(ctx context.Context, addr sdk.AccAddress) sdk.Coins } // AccountKeeper defines the expected keeper interface for interacting with account type AccountKeeper interface { - GetAccount(ctx sdk.Context, addr sdk.AccAddress) authtypes.AccountI - SetAccount(ctx sdk.Context, acc authtypes.AccountI) + GetAccount(ctx context.Context, addr sdk.AccAddress) sdk.AccountI + SetAccount(ctx context.Context, acc sdk.AccountI) GetModuleAddress(name string) sdk.AccAddress - GetModuleAccount(ctx sdk.Context, name string) authtypes.ModuleAccountI + GetModuleAccount(ctx context.Context, name string) sdk.ModuleAccountI } // SavingsHooks event hooks for other keepers to run code in response to Savings modifications type SavingsHooks interface { - AfterSavingsDepositCreated(ctx sdk.Context, deposit Deposit) - BeforeSavingsDepositModified(ctx sdk.Context, deposit Deposit, incomingDenoms []string) + AfterSavingsDepositCreated(ctx context.Context, deposit Deposit) + BeforeSavingsDepositModified(ctx context.Context, deposit Deposit, incomingDenoms []string) } type LiquidKeeper interface { diff --git a/x/savings/types/hooks.go b/x/savings/types/hooks.go index b4441b5941..12c93e5a5e 100644 --- a/x/savings/types/hooks.go +++ b/x/savings/types/hooks.go @@ -1,6 +1,8 @@ package types -import sdk "github.com/cosmos/cosmos-sdk/types" +import ( + "context" +) // MultiSavingsHooks combine multiple Savings hooks, all hook functions are run in array sequence type MultiSavingsHooks []SavingsHooks @@ -11,14 +13,14 @@ func NewMultiSavingsHooks(hooks ...SavingsHooks) MultiSavingsHooks { } // AfterSavingsDepositCreated runs after a deposit is created -func (s MultiSavingsHooks) AfterSavingsDepositCreated(ctx sdk.Context, deposit Deposit) { +func (s MultiSavingsHooks) AfterSavingsDepositCreated(ctx context.Context, deposit Deposit) { for i := range s { s[i].AfterSavingsDepositCreated(ctx, deposit) } } // BeforeSavingsDepositModified runs before a deposit is modified -func (s MultiSavingsHooks) BeforeSavingsDepositModified(ctx sdk.Context, deposit Deposit, incomingDenoms []string) { +func (s MultiSavingsHooks) BeforeSavingsDepositModified(ctx context.Context, deposit Deposit, incomingDenoms []string) { for i := range s { s[i].BeforeSavingsDepositModified(ctx, deposit, incomingDenoms) } diff --git a/x/savings/types/query.pb.go b/x/savings/types/query.pb.go index 5e1340de43..37689eeaf3 100644 --- a/x/savings/types/query.pb.go +++ b/x/savings/types/query.pb.go @@ -509,6 +509,7 @@ func _Query_TotalSupply_Handler(srv interface{}, ctx context.Context, dec func(i return interceptor(ctx, in, info, handler) } +var Query_serviceDesc = _Query_serviceDesc var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "kava.savings.v1beta1.Query", HandlerType: (*QueryServer)(nil), diff --git a/x/savings/types/tx.pb.go b/x/savings/types/tx.pb.go index 392172d56d..270d45aac0 100644 --- a/x/savings/types/tx.pb.go +++ b/x/savings/types/tx.pb.go @@ -350,6 +350,7 @@ func _Msg_Withdraw_Handler(srv interface{}, ctx context.Context, dec func(interf return interceptor(ctx, in, info, handler) } +var Msg_serviceDesc = _Msg_serviceDesc var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "kava.savings.v1beta1.Msg", HandlerType: (*MsgServer)(nil), diff --git a/x/swap/client/cli/tx.go b/x/swap/client/cli/tx.go index f6f933656b..4a9f4629ef 100644 --- a/x/swap/client/cli/tx.go +++ b/x/swap/client/cli/tx.go @@ -67,7 +67,7 @@ func getCmdDeposit() *cobra.Command { return err } - slippage, err := sdk.NewDecFromStr(args[2]) + slippage, err := sdkmath.LegacyNewDecFromStr(args[2]) if err != nil { return err } @@ -160,7 +160,7 @@ func getCmdSwapExactForTokens() *cobra.Command { return err } - slippage, err := sdk.NewDecFromStr(args[2]) + slippage, err := sdkmath.LegacyNewDecFromStr(args[2]) if err != nil { return err } @@ -206,7 +206,7 @@ func getCmdSwapForExactTokens() *cobra.Command { return err } - slippage, err := sdk.NewDecFromStr(args[2]) + slippage, err := sdkmath.LegacyNewDecFromStr(args[2]) if err != nil { return err } diff --git a/x/swap/genesis_test.go b/x/swap/genesis_test.go index ea7b72b27c..2e6e8edd76 100644 --- a/x/swap/genesis_test.go +++ b/x/swap/genesis_test.go @@ -20,7 +20,7 @@ type genesisTestSuite struct { func (suite *genesisTestSuite) Test_InitGenesis_ValidationPanic() { invalidState := types.NewGenesisState( types.Params{ - SwapFee: sdk.NewDec(-1), + SwapFee: sdkmath.LegacyNewDec(-1), }, types.PoolRecords{}, types.ShareRecords{}, @@ -41,7 +41,7 @@ func (suite *genesisTestSuite) Test_InitAndExportGenesis() { state := types.NewGenesisState( types.Params{ AllowedPools: types.AllowedPools{types.NewAllowedPool("ukava", "usdx")}, - SwapFee: sdk.MustNewDecFromStr("0.00255"), + SwapFee: sdkmath.LegacyMustNewDecFromStr("0.00255"), }, types.PoolRecords{ types.NewPoolRecord(sdk.NewCoins(sdk.NewCoin("hard", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(2e6))), sdkmath.NewInt(1e6)), @@ -80,7 +80,7 @@ func (suite *genesisTestSuite) Test_Marshall() { state := types.NewGenesisState( types.Params{ AllowedPools: types.AllowedPools{types.NewAllowedPool("ukava", "usdx")}, - SwapFee: sdk.MustNewDecFromStr("0.00255"), + SwapFee: sdkmath.LegacyMustNewDecFromStr("0.00255"), }, types.PoolRecords{ types.NewPoolRecord(sdk.NewCoins(sdk.NewCoin("hard", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(2e6))), sdkmath.NewInt(1e6)), @@ -115,7 +115,7 @@ func (suite *genesisTestSuite) Test_LegacyJSONConversion() { state := types.NewGenesisState( types.Params{ AllowedPools: types.AllowedPools{types.NewAllowedPool("ukava", "usdx")}, - SwapFee: sdk.MustNewDecFromStr("0.00255"), + SwapFee: sdkmath.LegacyMustNewDecFromStr("0.00255"), }, types.PoolRecords{ types.NewPoolRecord(sdk.NewCoins(sdk.NewCoin("hard", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(2e6))), sdkmath.NewInt(1e6)), diff --git a/x/swap/keeper/deposit.go b/x/swap/keeper/deposit.go index f88ba7750f..e1048c720d 100644 --- a/x/swap/keeper/deposit.go +++ b/x/swap/keeper/deposit.go @@ -38,7 +38,7 @@ import ( // // These slippages can be calculated by S_B = ((A/B')/(A/B) - 1) and S_A ((B/A')/(B/A) - 1), simplifying to // S_B = (A/A' - 1), and S_B = (B/B' - 1). An error is returned when max(S_A, S_B) > slippageLimit. -func (k Keeper) Deposit(ctx sdk.Context, depositor sdk.AccAddress, coinA sdk.Coin, coinB sdk.Coin, slippageLimit sdk.Dec) error { +func (k Keeper) Deposit(ctx sdk.Context, depositor sdk.AccAddress, coinA sdk.Coin, coinB sdk.Coin, slippageLimit sdkmath.LegacyDec) error { desiredAmount := sdk.NewCoins(coinA, coinB) poolID := types.PoolIDFromCoins(desiredAmount) @@ -67,11 +67,11 @@ func (k Keeper) Deposit(ctx sdk.Context, depositor sdk.AccAddress, coinA sdk.Coi return errorsmod.Wrap(types.ErrInsufficientLiquidity, "deposit must be increased") } - maxPercentPriceChange := sdk.MaxDec( - sdk.NewDecFromInt(desiredAmount.AmountOf(coinA.Denom)).Quo(sdk.NewDecFromInt(depositAmount.AmountOf(coinA.Denom))), - sdk.NewDecFromInt(desiredAmount.AmountOf(coinB.Denom)).Quo(sdk.NewDecFromInt(depositAmount.AmountOf(coinB.Denom))), + maxPercentPriceChange := sdkmath.LegacyMaxDec( + sdkmath.LegacyNewDecFromInt(desiredAmount.AmountOf(coinA.Denom)).Quo(sdkmath.LegacyNewDecFromInt(depositAmount.AmountOf(coinA.Denom))), + sdkmath.LegacyNewDecFromInt(desiredAmount.AmountOf(coinB.Denom)).Quo(sdkmath.LegacyNewDecFromInt(depositAmount.AmountOf(coinB.Denom))), ) - slippage := maxPercentPriceChange.Sub(sdk.OneDec()) + slippage := maxPercentPriceChange.Sub(sdkmath.LegacyOneDec()) if slippage.GT(slippageLimit) { return errorsmod.Wrapf(types.ErrSlippageExceeded, "slippage %s > limit %s", slippage, slippageLimit) @@ -116,12 +116,12 @@ func (k Keeper) depositAllowed(ctx sdk.Context, poolID string) bool { func (k Keeper) initializePool(ctx sdk.Context, poolID string, depositor sdk.AccAddress, reserves sdk.Coins) (*types.DenominatedPool, sdk.Coins, sdkmath.Int, error) { if allowed := k.depositAllowed(ctx, poolID); !allowed { - return nil, sdk.Coins{}, sdk.ZeroInt(), errorsmod.Wrap(types.ErrNotAllowed, fmt.Sprintf("can not create pool '%s'", poolID)) + return nil, sdk.Coins{}, sdkmath.ZeroInt(), errorsmod.Wrap(types.ErrNotAllowed, fmt.Sprintf("can not create pool '%s'", poolID)) } pool, err := types.NewDenominatedPool(reserves) if err != nil { - return nil, sdk.Coins{}, sdk.ZeroInt(), err + return nil, sdk.Coins{}, sdkmath.ZeroInt(), err } return pool, pool.Reserves(), pool.TotalShares(), nil @@ -130,7 +130,7 @@ func (k Keeper) initializePool(ctx sdk.Context, poolID string, depositor sdk.Acc func (k Keeper) addLiquidityToPool(ctx sdk.Context, record types.PoolRecord, depositor sdk.AccAddress, desiredAmount sdk.Coins) (*types.DenominatedPool, sdk.Coins, sdkmath.Int, error) { pool, err := types.NewDenominatedPoolWithExistingShares(record.Reserves(), record.TotalShares) if err != nil { - return nil, sdk.Coins{}, sdk.ZeroInt(), err + return nil, sdk.Coins{}, sdkmath.ZeroInt(), err } depositAmount, shares := pool.AddLiquidity(desiredAmount) diff --git a/x/swap/keeper/deposit_test.go b/x/swap/keeper/deposit_test.go index f0bf042a19..644daebfd0 100644 --- a/x/swap/keeper/deposit_test.go +++ b/x/swap/keeper/deposit_test.go @@ -18,7 +18,7 @@ func (suite *keeperTestSuite) TestDeposit_CreatePool_PoolNotAllowed() { amountA := sdk.NewCoin("ukava", sdkmath.NewInt(10e6)) amountB := sdk.NewCoin("usdx", sdkmath.NewInt(50e6)) - err := suite.Keeper.Deposit(suite.Ctx, depositor.GetAddress(), amountA, amountB, sdk.MustNewDecFromStr("0.01")) + err := suite.Keeper.Deposit(suite.Ctx, depositor.GetAddress(), amountA, amountB, sdkmath.LegacyMustNewDecFromStr("0.01")) suite.Require().EqualError(err, "can not create pool 'ukava:usdx': not allowed") } @@ -32,8 +32,8 @@ func (suite *keeperTestSuite) TestDeposit_InsufficientFunds() { }{ { name: "no balance", - balanceA: sdk.NewCoin("unuseddenom", sdk.ZeroInt()), - balanceB: sdk.NewCoin("unuseddenom", sdk.ZeroInt()), + balanceA: sdk.NewCoin("unuseddenom", sdkmath.ZeroInt()), + balanceB: sdk.NewCoin("unuseddenom", sdkmath.ZeroInt()), depositA: sdk.NewCoin("ukava", sdkmath.NewInt(100)), depositB: sdk.NewCoin("usdx", sdkmath.NewInt(100)), }, @@ -64,7 +64,7 @@ func (suite *keeperTestSuite) TestDeposit_InsufficientFunds() { balance := sdk.NewCoins(tc.balanceA, tc.balanceB) depositor := suite.CreateAccount(balance) - err := suite.Keeper.Deposit(suite.Ctx, depositor.GetAddress(), tc.depositA, tc.depositB, sdk.MustNewDecFromStr("0")) + err := suite.Keeper.Deposit(suite.Ctx, depositor.GetAddress(), tc.depositA, tc.depositB, sdkmath.LegacyMustNewDecFromStr("0")) // TODO: wrap in module specific error? suite.Require().True(errors.Is(err, sdkerrors.ErrInsufficientFunds), fmt.Sprintf("got err %s", err)) @@ -72,7 +72,7 @@ func (suite *keeperTestSuite) TestDeposit_InsufficientFunds() { // test deposit to existing pool insuffient funds err = suite.CreatePool(sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(10e6)), sdk.NewCoin("usdx", sdkmath.NewInt(50e6)))) suite.Require().NoError(err) - err = suite.Keeper.Deposit(suite.Ctx, depositor.GetAddress(), tc.depositA, tc.depositB, sdk.MustNewDecFromStr("10")) + err = suite.Keeper.Deposit(suite.Ctx, depositor.GetAddress(), tc.depositA, tc.depositB, sdkmath.LegacyMustNewDecFromStr("10")) suite.Require().True(errors.Is(err, sdkerrors.ErrInsufficientFunds)) }) } @@ -90,8 +90,8 @@ func (suite *keeperTestSuite) TestDeposit_InsufficientFunds_Vesting() { }{ { name: "no balance, vesting only", - balanceA: sdk.NewCoin("ukava", sdk.ZeroInt()), - balanceB: sdk.NewCoin("usdx", sdk.ZeroInt()), + balanceA: sdk.NewCoin("ukava", sdkmath.ZeroInt()), + balanceB: sdk.NewCoin("usdx", sdkmath.ZeroInt()), vestingA: sdk.NewCoin("ukava", sdkmath.NewInt(100)), vestingB: sdk.NewCoin("usdx", sdkmath.NewInt(100)), depositA: sdk.NewCoin("ukava", sdkmath.NewInt(100)), @@ -130,7 +130,7 @@ func (suite *keeperTestSuite) TestDeposit_InsufficientFunds_Vesting() { depositor := suite.CreateVestingAccount(balance, vesting) // test create pool insuffient funds - err := suite.Keeper.Deposit(suite.Ctx, depositor.GetAddress(), tc.depositA, tc.depositB, sdk.MustNewDecFromStr("0")) + err := suite.Keeper.Deposit(suite.Ctx, depositor.GetAddress(), tc.depositA, tc.depositB, sdkmath.LegacyMustNewDecFromStr("0")) // TODO: wrap in module specific error? suite.Require().True(errors.Is(err, sdkerrors.ErrInsufficientFunds)) @@ -138,7 +138,7 @@ func (suite *keeperTestSuite) TestDeposit_InsufficientFunds_Vesting() { // test deposit to existing pool insuffient funds err = suite.CreatePool(sdk.NewCoins(sdk.NewCoin("ukava", sdkmath.NewInt(10e6)), sdk.NewCoin("usdx", sdkmath.NewInt(50e6)))) suite.Require().NoError(err) - err = suite.Keeper.Deposit(suite.Ctx, depositor.GetAddress(), tc.depositA, tc.depositB, sdk.MustNewDecFromStr("4")) + err = suite.Keeper.Deposit(suite.Ctx, depositor.GetAddress(), tc.depositA, tc.depositB, sdkmath.LegacyMustNewDecFromStr("4")) suite.Require().True(errors.Is(err, sdkerrors.ErrInsufficientFunds)) }) } @@ -158,7 +158,7 @@ func (suite *keeperTestSuite) TestDeposit_CreatePool() { depositB := sdk.NewCoin(pool.TokenB, sdkmath.NewInt(50e6)) deposit := sdk.NewCoins(depositA, depositB) - err := suite.Keeper.Deposit(suite.Ctx, depositor.GetAddress(), depositA, depositB, sdk.MustNewDecFromStr("0")) + err := suite.Keeper.Deposit(suite.Ctx, depositor.GetAddress(), depositA, depositB, sdkmath.LegacyMustNewDecFromStr("0")) suite.Require().NoError(err) suite.AccountBalanceEqual(depositor.GetAddress(), sdk.NewCoins(amountA.Sub(depositA), amountB.Sub(depositB))) suite.ModuleAccountBalanceEqual(sdk.NewCoins(depositA, depositB)) @@ -192,9 +192,9 @@ func (suite *keeperTestSuite) TestDeposit_PoolExists() { depositA := sdk.NewCoin("usdx", balance.AmountOf("usdx")) depositB := sdk.NewCoin("ukava", balance.AmountOf("ukava")) - ctx := suite.App.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := suite.App.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) - err = suite.Keeper.Deposit(ctx, depositor.GetAddress(), depositA, depositB, sdk.MustNewDecFromStr("4")) + err = suite.Keeper.Deposit(ctx, depositor.GetAddress(), depositA, depositB, sdkmath.LegacyMustNewDecFromStr("4")) suite.Require().NoError(err) expectedDeposit := sdk.NewCoins( @@ -237,7 +237,7 @@ func (suite *keeperTestSuite) TestDeposit_MultipleDeposit() { depositA := sdk.NewCoin("usdx", fundsToDeposit.AmountOf("usdx")) depositB := sdk.NewCoin("ukava", fundsToDeposit.AmountOf("ukava")) - err := suite.Keeper.Deposit(suite.Ctx, owner.GetAddress(), depositA, depositB, sdk.MustNewDecFromStr("4")) + err := suite.Keeper.Deposit(suite.Ctx, owner.GetAddress(), depositA, depositB, sdkmath.LegacyMustNewDecFromStr("4")) suite.Require().NoError(err) totalDeposit := reserves.Add(fundsToDeposit...) @@ -266,16 +266,16 @@ func (suite *keeperTestSuite) TestDeposit_Slippage() { testCases := []struct { depositA sdk.Coin depositB sdk.Coin - slippage sdk.Dec + slippage sdkmath.LegacyDec shouldFail bool }{ - {sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.NewCoin("ukava", sdkmath.NewInt(5e6)), sdk.MustNewDecFromStr("0.7"), true}, - {sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.NewCoin("ukava", sdkmath.NewInt(5e6)), sdk.MustNewDecFromStr("0.8"), true}, - {sdk.NewCoin("ukava", sdkmath.NewInt(5e6)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.MustNewDecFromStr("3"), true}, - {sdk.NewCoin("ukava", sdkmath.NewInt(5e6)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.MustNewDecFromStr("4"), false}, - {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.MustNewDecFromStr("0"), false}, - {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(4e6)), sdk.MustNewDecFromStr("0.25"), false}, - {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(4e6)), sdk.MustNewDecFromStr("0.2"), true}, + {sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.NewCoin("ukava", sdkmath.NewInt(5e6)), sdkmath.LegacyMustNewDecFromStr("0.7"), true}, + {sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.NewCoin("ukava", sdkmath.NewInt(5e6)), sdkmath.LegacyMustNewDecFromStr("0.8"), true}, + {sdk.NewCoin("ukava", sdkmath.NewInt(5e6)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdkmath.LegacyMustNewDecFromStr("3"), true}, + {sdk.NewCoin("ukava", sdkmath.NewInt(5e6)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdkmath.LegacyMustNewDecFromStr("4"), false}, + {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdkmath.LegacyMustNewDecFromStr("0"), false}, + {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(4e6)), sdkmath.LegacyMustNewDecFromStr("0.25"), false}, + {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(4e6)), sdkmath.LegacyMustNewDecFromStr("0.2"), true}, } for _, tc := range testCases { @@ -291,7 +291,7 @@ func (suite *keeperTestSuite) TestDeposit_Slippage() { ) depositor := suite.CreateAccount(balance) - ctx := suite.App.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := suite.App.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) err = suite.Keeper.Deposit(ctx, depositor.GetAddress(), tc.depositA, tc.depositB, tc.slippage) if tc.shouldFail { @@ -334,7 +334,7 @@ func (suite *keeperTestSuite) TestDeposit_InsufficientLiquidity() { balance := sdk.NewCoins(tc.depositA, tc.depositB) depositor := suite.CreateAccount(balance) - err := suite.Keeper.Deposit(suite.Ctx, depositor.GetAddress(), tc.depositA, tc.depositB, sdk.MustNewDecFromStr("10")) + err := suite.Keeper.Deposit(suite.Ctx, depositor.GetAddress(), tc.depositA, tc.depositB, sdkmath.LegacyMustNewDecFromStr("10")) suite.EqualError(err, "deposit must be increased: insufficient liquidity") }) } diff --git a/x/swap/keeper/grpc_query.go b/x/swap/keeper/grpc_query.go index ba697c5406..a1baa1dd04 100644 --- a/x/swap/keeper/grpc_query.go +++ b/x/swap/keeper/grpc_query.go @@ -7,7 +7,7 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/status" - "github.com/cosmos/cosmos-sdk/store/prefix" + "cosmossdk.io/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/query" diff --git a/x/swap/keeper/hooks.go b/x/swap/keeper/hooks.go index 11e0f5107b..1be13b5194 100644 --- a/x/swap/keeper/hooks.go +++ b/x/swap/keeper/hooks.go @@ -1,6 +1,7 @@ package keeper import ( + "context" sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" @@ -11,14 +12,14 @@ import ( var _ types.SwapHooks = Keeper{} // AfterPoolDepositCreated - call hook if registered -func (k Keeper) AfterPoolDepositCreated(ctx sdk.Context, poolID string, depositor sdk.AccAddress, sharesOwned sdkmath.Int) { +func (k Keeper) AfterPoolDepositCreated(ctx context.Context, poolID string, depositor sdk.AccAddress, sharesOwned sdkmath.Int) { if k.hooks != nil { k.hooks.AfterPoolDepositCreated(ctx, poolID, depositor, sharesOwned) } } // BeforePoolDepositModified - call hook if registered -func (k Keeper) BeforePoolDepositModified(ctx sdk.Context, poolID string, depositor sdk.AccAddress, sharesOwned sdkmath.Int) { +func (k Keeper) BeforePoolDepositModified(ctx context.Context, poolID string, depositor sdk.AccAddress, sharesOwned sdkmath.Int) { if k.hooks != nil { k.hooks.BeforePoolDepositModified(ctx, poolID, depositor, sharesOwned) } diff --git a/x/swap/keeper/hooks_test.go b/x/swap/keeper/hooks_test.go index 893aa65856..d76c7eca34 100644 --- a/x/swap/keeper/hooks_test.go +++ b/x/swap/keeper/hooks_test.go @@ -33,13 +33,13 @@ func (suite *keeperTestSuite) TestHooks_DepositAndWithdraw() { // first deposit creates pool - calls AfterPoolDepositCreated with initial shares swapHooks.On("AfterPoolDepositCreated", suite.Ctx, types.PoolIDFromCoins(deposit), depositor_1.GetAddress(), expectedShares).Once() - err := suite.Keeper.Deposit(suite.Ctx, depositor_1.GetAddress(), depositA, depositB, sdk.MustNewDecFromStr("0.0015")) + err := suite.Keeper.Deposit(suite.Ctx, depositor_1.GetAddress(), depositA, depositB, sdkmath.LegacyMustNewDecFromStr("0.0015")) suite.Require().NoError(err) // second deposit adds to pool - calls BeforePoolDepositModified // shares given are the initial shares, not the shares added to the pool swapHooks.On("BeforePoolDepositModified", suite.Ctx, types.PoolIDFromCoins(deposit), depositor_1.GetAddress(), expectedShares).Once() - err = suite.Keeper.Deposit(suite.Ctx, depositor_1.GetAddress(), sdk.NewCoin("ukava", sdkmath.NewInt(5e6)), sdk.NewCoin("usdx", sdkmath.NewInt(25e6)), sdk.MustNewDecFromStr("0.0015")) + err = suite.Keeper.Deposit(suite.Ctx, depositor_1.GetAddress(), sdk.NewCoin("ukava", sdkmath.NewInt(5e6)), sdk.NewCoin("usdx", sdkmath.NewInt(25e6)), sdkmath.LegacyMustNewDecFromStr("0.0015")) suite.Require().NoError(err) // get the shares from the store from the last deposit @@ -49,7 +49,7 @@ func (suite *keeperTestSuite) TestHooks_DepositAndWithdraw() { // third deposit adds to pool - calls BeforePoolDepositModified // shares given are the shares added in previous deposit, not the shares added to the pool now swapHooks.On("BeforePoolDepositModified", suite.Ctx, types.PoolIDFromCoins(deposit), depositor_1.GetAddress(), shareRecord.SharesOwned).Once() - err = suite.Keeper.Deposit(suite.Ctx, depositor_1.GetAddress(), sdk.NewCoin("ukava", sdkmath.NewInt(10e6)), sdk.NewCoin("usdx", sdkmath.NewInt(50e6)), sdk.MustNewDecFromStr("0.0015")) + err = suite.Keeper.Deposit(suite.Ctx, depositor_1.GetAddress(), sdk.NewCoin("ukava", sdkmath.NewInt(10e6)), sdk.NewCoin("usdx", sdkmath.NewInt(50e6)), sdkmath.LegacyMustNewDecFromStr("0.0015")) suite.Require().NoError(err) depositor_2 := suite.NewAccountFromAddr( @@ -63,12 +63,12 @@ func (suite *keeperTestSuite) TestHooks_DepositAndWithdraw() { // first deposit deposit into pool creates the deposit and calls AfterPoolDepositCreated expectedShares = sdkmath.NewInt(2236067) swapHooks.On("AfterPoolDepositCreated", suite.Ctx, types.PoolIDFromCoins(deposit), depositor_2.GetAddress(), expectedShares).Once() - err = suite.Keeper.Deposit(suite.Ctx, depositor_2.GetAddress(), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.MustNewDecFromStr("0.0015")) + err = suite.Keeper.Deposit(suite.Ctx, depositor_2.GetAddress(), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdkmath.LegacyMustNewDecFromStr("0.0015")) suite.Require().NoError(err) // second deposit into pool calls BeforePoolDepositModified with initial shares given swapHooks.On("BeforePoolDepositModified", suite.Ctx, types.PoolIDFromCoins(deposit), depositor_2.GetAddress(), expectedShares).Once() - err = suite.Keeper.Deposit(suite.Ctx, depositor_2.GetAddress(), sdk.NewCoin("ukava", sdkmath.NewInt(2e6)), sdk.NewCoin("usdx", sdkmath.NewInt(10e6)), sdk.MustNewDecFromStr("0.0015")) + err = suite.Keeper.Deposit(suite.Ctx, depositor_2.GetAddress(), sdk.NewCoin("ukava", sdkmath.NewInt(2e6)), sdk.NewCoin("usdx", sdkmath.NewInt(10e6)), sdkmath.LegacyMustNewDecFromStr("0.0015")) suite.Require().NoError(err) // get the shares from the store from the last deposit @@ -77,7 +77,7 @@ func (suite *keeperTestSuite) TestHooks_DepositAndWithdraw() { // third deposit into pool calls BeforePoolDepositModified with shares from last deposit swapHooks.On("BeforePoolDepositModified", suite.Ctx, types.PoolIDFromCoins(deposit), depositor_2.GetAddress(), shareRecord.SharesOwned).Once() - err = suite.Keeper.Deposit(suite.Ctx, depositor_2.GetAddress(), sdk.NewCoin("ukava", sdkmath.NewInt(3e6)), sdk.NewCoin("usdx", sdkmath.NewInt(15e6)), sdk.MustNewDecFromStr("0.0015")) + err = suite.Keeper.Deposit(suite.Ctx, depositor_2.GetAddress(), sdk.NewCoin("ukava", sdkmath.NewInt(3e6)), sdk.NewCoin("usdx", sdkmath.NewInt(15e6)), sdkmath.LegacyMustNewDecFromStr("0.0015")) suite.Require().NoError(err) // test hooks with a full withdraw of all shares @@ -135,11 +135,11 @@ func (suite *keeperTestSuite) TestHooks_NoPanicsOnNilHooks() { deposit := sdk.NewCoins(depositA, depositB) // deposit create pool should not panic when hooks are not set - err := suite.Keeper.Deposit(suite.Ctx, depositor.GetAddress(), depositA, depositB, sdk.MustNewDecFromStr("0.0015")) + err := suite.Keeper.Deposit(suite.Ctx, depositor.GetAddress(), depositA, depositB, sdkmath.LegacyMustNewDecFromStr("0.0015")) suite.Require().NoError(err) // existing deposit should not panic with hooks are not set - err = suite.Keeper.Deposit(suite.Ctx, depositor.GetAddress(), sdk.NewCoin("ukava", sdkmath.NewInt(5e6)), sdk.NewCoin("usdx", sdkmath.NewInt(25e6)), sdk.MustNewDecFromStr("0.0015")) + err = suite.Keeper.Deposit(suite.Ctx, depositor.GetAddress(), sdk.NewCoin("ukava", sdkmath.NewInt(5e6)), sdk.NewCoin("usdx", sdkmath.NewInt(25e6)), sdkmath.LegacyMustNewDecFromStr("0.0015")) suite.Require().NoError(err) // withdraw of shares should not panic when hooks are not set @@ -175,7 +175,7 @@ func (suite *keeperTestSuite) TestHooks_HookOrdering() { _, found := suite.Keeper.GetDepositorShares(suite.Ctx, depositor.GetAddress(), poolID) suite.Require().True(found, "expected after hook to be called after shares are updated") }) - err := suite.Keeper.Deposit(suite.Ctx, depositor.GetAddress(), depositA, depositB, sdk.MustNewDecFromStr("0.0015")) + err := suite.Keeper.Deposit(suite.Ctx, depositor.GetAddress(), depositA, depositB, sdkmath.LegacyMustNewDecFromStr("0.0015")) suite.Require().NoError(err) swapHooks.On("BeforePoolDepositModified", suite.Ctx, poolID, depositor.GetAddress(), expectedShares).Run(func(args mock.Arguments) { @@ -183,7 +183,7 @@ func (suite *keeperTestSuite) TestHooks_HookOrdering() { suite.Require().True(found, "expected share record to exist") suite.Equal(expectedShares, shareRecord.SharesOwned, "expected hook to be called before shares are updated") }) - err = suite.Keeper.Deposit(suite.Ctx, depositor.GetAddress(), depositA, depositB, sdk.MustNewDecFromStr("0.0015")) + err = suite.Keeper.Deposit(suite.Ctx, depositor.GetAddress(), depositA, depositB, sdkmath.LegacyMustNewDecFromStr("0.0015")) suite.Require().NoError(err) existingShareRecord, found := suite.Keeper.GetDepositorShares(suite.Ctx, depositor.GetAddress(), types.PoolIDFromCoins(deposit)) diff --git a/x/swap/keeper/integration_test.go b/x/swap/keeper/integration_test.go index 9e6f8de6b4..3fa6a1fd84 100644 --- a/x/swap/keeper/integration_test.go +++ b/x/swap/keeper/integration_test.go @@ -25,7 +25,7 @@ func cs(coins ...sdk.Coin) sdk.Coins { return sdk.NewCoins(coins...) } // AllowedPools: types.AllowedPools{ // types.NewAllowedPool("ukava", "usdx"), // }, -// SwapFee: sdk.MustNewDecFromStr("0.03"), +// SwapFee: sdkmath.LegacyMustNewDecFromStr("0.03"), // }, // } diff --git a/x/swap/keeper/invariants.go b/x/swap/keeper/invariants.go index c4bce02bca..e1e33159c8 100644 --- a/x/swap/keeper/invariants.go +++ b/x/swap/keeper/invariants.go @@ -86,7 +86,7 @@ func PoolReservesInvariant(k Keeper) sdk.Invariant { return false }) - broken := !reserves.IsEqual(balance) + broken := !reserves.Equal(balance) return message, broken } } @@ -107,7 +107,7 @@ func PoolSharesInvariant(k Keeper) sdk.Invariant { k.IteratePools(ctx, func(pr types.PoolRecord) bool { totalShares[pr.PoolID] = poolShares{ totalShares: pr.TotalShares, - totalSharesOwned: sdk.ZeroInt(), + totalSharesOwned: sdkmath.ZeroInt(), } return false @@ -119,7 +119,7 @@ func PoolSharesInvariant(k Keeper) sdk.Invariant { totalShares[sr.PoolID] = shares } else { totalShares[sr.PoolID] = poolShares{ - totalShares: sdk.ZeroInt(), + totalShares: sdkmath.ZeroInt(), totalSharesOwned: sr.SharesOwned, } } diff --git a/x/swap/keeper/keeper.go b/x/swap/keeper/keeper.go index 86bb32690f..4cd83ffea3 100644 --- a/x/swap/keeper/keeper.go +++ b/x/swap/keeper/keeper.go @@ -4,11 +4,10 @@ import ( "fmt" sdkmath "cosmossdk.io/math" + "cosmossdk.io/store/prefix" + storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/store/prefix" - 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" "github.com/kava-labs/kava/x/swap/types" @@ -72,12 +71,12 @@ func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { } // GetSwapFee returns the swap fee set in the module parameters -func (k Keeper) GetSwapFee(ctx sdk.Context) sdk.Dec { +func (k Keeper) GetSwapFee(ctx sdk.Context) sdkmath.LegacyDec { return k.GetParams(ctx).SwapFee } // GetSwapModuleAccount returns the swap ModuleAccount -func (k Keeper) GetSwapModuleAccount(ctx sdk.Context) authtypes.ModuleAccountI { +func (k Keeper) GetSwapModuleAccount(ctx sdk.Context) sdk.ModuleAccountI { return k.accountKeeper.GetModuleAccount(ctx, types.ModuleAccountName) } @@ -121,7 +120,7 @@ func (k Keeper) DeletePool(ctx sdk.Context, poolID string) { // IteratePools iterates over all pool objects in the store and performs a callback function func (k Keeper) IteratePools(ctx sdk.Context, cb func(record types.PoolRecord) (stop bool)) { store := prefix.NewStore(ctx.KVStore(k.key), types.PoolKeyPrefix) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) + iterator := storetypes.KVStorePrefixIterator(store, []byte{}) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { var record types.PoolRecord @@ -187,7 +186,7 @@ func (k Keeper) DeleteDepositorShares(ctx sdk.Context, depositor sdk.AccAddress, // IterateDepositorShares iterates over all pool objects in the store and performs a callback function func (k Keeper) IterateDepositorShares(ctx sdk.Context, cb func(record types.ShareRecord) (stop bool)) { store := prefix.NewStore(ctx.KVStore(k.key), types.DepositorPoolSharesPrefix) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) + iterator := storetypes.KVStorePrefixIterator(store, []byte{}) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { var record types.ShareRecord @@ -210,7 +209,7 @@ func (k Keeper) GetAllDepositorShares(ctx sdk.Context) (records types.ShareRecor // IterateDepositorSharesByOwner iterates over share records for a specific address and performs a callback function func (k Keeper) IterateDepositorSharesByOwner(ctx sdk.Context, owner sdk.AccAddress, cb func(record types.ShareRecord) (stop bool)) { store := prefix.NewStore(ctx.KVStore(k.key), types.DepositorPoolSharesPrefix) - iterator := sdk.KVStorePrefixIterator(store, owner.Bytes()) + iterator := storetypes.KVStorePrefixIterator(store, owner.Bytes()) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { var record types.ShareRecord diff --git a/x/swap/keeper/keeper_test.go b/x/swap/keeper/keeper_test.go index 07c0f6ca19..69014423e6 100644 --- a/x/swap/keeper/keeper_test.go +++ b/x/swap/keeper/keeper_test.go @@ -63,7 +63,7 @@ func (suite keeperTestSuite) TestParams_Persistance() { AllowedPools: types.AllowedPools{ types.NewAllowedPool("ukava", "usdx"), }, - SwapFee: sdk.MustNewDecFromStr("0.03"), + SwapFee: sdkmath.LegacyMustNewDecFromStr("0.03"), } keeper.SetParams(suite.Ctx, params) suite.Equal(keeper.GetParams(suite.Ctx), params) @@ -73,7 +73,7 @@ func (suite keeperTestSuite) TestParams_Persistance() { AllowedPools: types.AllowedPools{ types.NewAllowedPool("hard", "ukava"), }, - SwapFee: sdk.MustNewDecFromStr("0.01"), + SwapFee: sdkmath.LegacyMustNewDecFromStr("0.01"), } keeper.SetParams(suite.Ctx, params) suite.NotEqual(keeper.GetParams(suite.Ctx), oldParams) @@ -84,7 +84,7 @@ func (suite keeperTestSuite) TestParams_GetSwapFee() { keeper := suite.Keeper params := types.Params{ - SwapFee: sdk.MustNewDecFromStr("0.00333"), + SwapFee: sdkmath.LegacyMustNewDecFromStr("0.00333"), } keeper.SetParams(suite.Ctx, params) diff --git a/x/swap/keeper/msg_server_test.go b/x/swap/keeper/msg_server_test.go index 483cc656db..635085cab3 100644 --- a/x/swap/keeper/msg_server_test.go +++ b/x/swap/keeper/msg_server_test.go @@ -45,7 +45,7 @@ func (suite *msgServerTestSuite) TestDeposit_CreatePool() { depositor.GetAddress().String(), suite.BankKeeper.GetBalance(suite.Ctx, depositor.GetAddress(), pool.TokenA), suite.BankKeeper.GetBalance(suite.Ctx, depositor.GetAddress(), pool.TokenB), - sdk.MustNewDecFromStr("0.01"), + sdkmath.LegacyMustNewDecFromStr("0.01"), time.Now().Add(10*time.Minute).Unix(), ) @@ -95,7 +95,7 @@ func (suite *msgServerTestSuite) TestDeposit_DeadlineExceeded() { depositor.GetAddress().String(), suite.BankKeeper.GetBalance(suite.Ctx, depositor.GetAddress(), pool.TokenA), suite.BankKeeper.GetBalance(suite.Ctx, depositor.GetAddress(), pool.TokenB), - sdk.MustNewDecFromStr("0.01"), + sdkmath.LegacyMustNewDecFromStr("0.01"), suite.Ctx.BlockTime().Add(-1*time.Second).Unix(), ) @@ -124,7 +124,7 @@ func (suite *msgServerTestSuite) TestDeposit_ExistingPool() { depositor.GetAddress().String(), suite.BankKeeper.GetBalance(suite.Ctx, depositor.GetAddress(), "usdx"), suite.BankKeeper.GetBalance(suite.Ctx, depositor.GetAddress(), "ukava"), - sdk.MustNewDecFromStr("0.01"), + sdkmath.LegacyMustNewDecFromStr("0.01"), time.Now().Add(10*time.Minute).Unix(), ) @@ -188,7 +188,7 @@ func (suite *msgServerTestSuite) TestDeposit_ExistingPool_SlippageFailure() { depositor.GetAddress().String(), suite.BankKeeper.GetBalance(suite.Ctx, depositor.GetAddress(), "usdx"), suite.BankKeeper.GetBalance(suite.Ctx, depositor.GetAddress(), "ukava"), - sdk.MustNewDecFromStr("0.01"), + sdkmath.LegacyMustNewDecFromStr("0.01"), time.Now().Add(10*time.Minute).Unix(), ) @@ -208,7 +208,7 @@ func (suite *msgServerTestSuite) TestWithdraw_AllShares() { suite.Require().NoError(pool.Validate()) suite.Keeper.SetParams(suite.Ctx, types.NewParams(types.AllowedPools{pool}, types.DefaultSwapFee)) - err := suite.Keeper.Deposit(suite.Ctx, depositor.GetAddress(), reserves[0], reserves[1], sdk.MustNewDecFromStr("1")) + err := suite.Keeper.Deposit(suite.Ctx, depositor.GetAddress(), reserves[0], reserves[1], sdkmath.LegacyMustNewDecFromStr("1")) suite.Require().NoError(err) withdraw := types.NewMsgWithdraw( @@ -219,7 +219,7 @@ func (suite *msgServerTestSuite) TestWithdraw_AllShares() { time.Now().Add(10*time.Minute).Unix(), ) - suite.Ctx = suite.App.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + suite.Ctx = suite.App.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) res, err := suite.msgServer.Withdraw(sdk.WrapSDKContext(suite.Ctx), withdraw) suite.Require().Equal(&types.MsgWithdrawResponse{}, res) suite.Require().NoError(err) @@ -261,7 +261,7 @@ func (suite *msgServerTestSuite) TestWithdraw_PartialShares() { suite.Require().NoError(pool.Validate()) suite.Keeper.SetParams(suite.Ctx, types.NewParams(types.AllowedPools{pool}, types.DefaultSwapFee)) - err := suite.Keeper.Deposit(suite.Ctx, depositor.GetAddress(), reserves[0], reserves[1], sdk.MustNewDecFromStr("1")) + err := suite.Keeper.Deposit(suite.Ctx, depositor.GetAddress(), reserves[0], reserves[1], sdkmath.LegacyMustNewDecFromStr("1")) suite.Require().NoError(err) minTokenA := sdk.NewCoin("ukava", sdkmath.NewInt(4999999)) @@ -275,7 +275,7 @@ func (suite *msgServerTestSuite) TestWithdraw_PartialShares() { time.Now().Add(10*time.Minute).Unix(), ) - suite.Ctx = suite.App.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + suite.Ctx = suite.App.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) res, err := suite.msgServer.Withdraw(sdk.WrapSDKContext(suite.Ctx), withdraw) suite.Require().Equal(&types.MsgWithdrawResponse{}, res) suite.Require().NoError(err) @@ -319,7 +319,7 @@ func (suite *msgServerTestSuite) TestWithdraw_SlippageFailure() { suite.Require().NoError(pool.Validate()) suite.Keeper.SetParams(suite.Ctx, types.NewParams(types.AllowedPools{pool}, types.DefaultSwapFee)) - err := suite.Keeper.Deposit(suite.Ctx, depositor.GetAddress(), reserves[0], reserves[1], sdk.MustNewDecFromStr("1")) + err := suite.Keeper.Deposit(suite.Ctx, depositor.GetAddress(), reserves[0], reserves[1], sdkmath.LegacyMustNewDecFromStr("1")) suite.Require().NoError(err) minTokenA := sdk.NewCoin("ukava", sdkmath.NewInt(5e6)) @@ -378,11 +378,11 @@ func (suite *msgServerTestSuite) TestSwapExactForTokens() { requester.GetAddress().String(), swapInput, sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), - sdk.MustNewDecFromStr("0.01"), + sdkmath.LegacyMustNewDecFromStr("0.01"), time.Now().Add(10*time.Minute).Unix(), ) - suite.Ctx = suite.App.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + suite.Ctx = suite.App.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) res, err := suite.msgServer.SwapExactForTokens(sdk.WrapSDKContext(suite.Ctx), swapMsg) suite.Require().Equal(&types.MsgSwapExactForTokensResponse{}, res) suite.Require().NoError(err) @@ -442,11 +442,11 @@ func (suite *msgServerTestSuite) TestSwapExactForTokens_SlippageFailure() { requester.GetAddress().String(), swapInput, sdk.NewCoin("usdx", sdkmath.NewInt(5030338)), - sdk.MustNewDecFromStr("0.01"), + sdkmath.LegacyMustNewDecFromStr("0.01"), time.Now().Add(10*time.Minute).Unix(), ) - suite.Ctx = suite.App.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + suite.Ctx = suite.App.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) res, err := suite.msgServer.SwapExactForTokens(sdk.WrapSDKContext(suite.Ctx), swapMsg) suite.Require().Nil(res) suite.EqualError(err, "slippage 0.010000123252155223 > limit 0.010000000000000000: slippage exceeded") @@ -463,7 +463,7 @@ func (suite *msgServerTestSuite) TestSwapExactForTokens_DeadlineExceeded() { requester.GetAddress().String(), sdk.NewCoin("ukava", sdkmath.NewInt(5e6)), sdk.NewCoin("usdx", sdkmath.NewInt(25e5)), - sdk.MustNewDecFromStr("0.01"), + sdkmath.LegacyMustNewDecFromStr("0.01"), suite.Ctx.BlockTime().Add(-1*time.Second).Unix(), ) @@ -491,11 +491,11 @@ func (suite *msgServerTestSuite) TestSwapForExactTokens() { requester.GetAddress().String(), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), swapOutput, - sdk.MustNewDecFromStr("0.01"), + sdkmath.LegacyMustNewDecFromStr("0.01"), time.Now().Add(10*time.Minute).Unix(), ) - suite.Ctx = suite.App.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + suite.Ctx = suite.App.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) res, err := suite.msgServer.SwapForExactTokens(sdk.WrapSDKContext(suite.Ctx), swapMsg) suite.Require().Equal(&types.MsgSwapForExactTokensResponse{}, res) suite.Require().NoError(err) @@ -555,11 +555,11 @@ func (suite *msgServerTestSuite) TestSwapForExactTokens_SlippageFailure() { requester.GetAddress().String(), sdk.NewCoin("ukava", sdkmath.NewInt(990991)), swapOutput, - sdk.MustNewDecFromStr("0.01"), + sdkmath.LegacyMustNewDecFromStr("0.01"), time.Now().Add(10*time.Minute).Unix(), ) - suite.Ctx = suite.App.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + suite.Ctx = suite.App.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) res, err := suite.msgServer.SwapForExactTokens(sdk.WrapSDKContext(suite.Ctx), swapMsg) suite.Require().Nil(res) suite.EqualError(err, "slippage 0.010000979019022939 > limit 0.010000000000000000: slippage exceeded") @@ -576,7 +576,7 @@ func (suite *msgServerTestSuite) TestSwapForExactTokens_DeadlineExceeded() { requester.GetAddress().String(), sdk.NewCoin("ukava", sdkmath.NewInt(5e6)), sdk.NewCoin("usdx", sdkmath.NewInt(25e5)), - sdk.MustNewDecFromStr("0.01"), + sdkmath.LegacyMustNewDecFromStr("0.01"), suite.Ctx.BlockTime().Add(-1*time.Second).Unix(), ) diff --git a/x/swap/keeper/swap.go b/x/swap/keeper/swap.go index b77aeee269..15f02df595 100644 --- a/x/swap/keeper/swap.go +++ b/x/swap/keeper/swap.go @@ -1,6 +1,7 @@ package keeper import ( + sdkmath "cosmossdk.io/math" "fmt" "github.com/kava-labs/kava/x/swap/types" @@ -10,7 +11,7 @@ import ( ) // SwapExactForTokens swaps an exact coin a input for a coin b output -func (k *Keeper) SwapExactForTokens(ctx sdk.Context, requester sdk.AccAddress, exactCoinA, coinB sdk.Coin, slippageLimit sdk.Dec) error { +func (k *Keeper) SwapExactForTokens(ctx sdk.Context, requester sdk.AccAddress, exactCoinA, coinB sdk.Coin, slippageLimit sdkmath.LegacyDec) error { poolID, pool, err := k.loadPool(ctx, exactCoinA.Denom, coinB.Denom) if err != nil { return err @@ -21,7 +22,7 @@ func (k *Keeper) SwapExactForTokens(ctx sdk.Context, requester sdk.AccAddress, e return errorsmod.Wrapf(types.ErrInsufficientLiquidity, "swap output rounds to zero, increase input amount") } - priceChange := sdk.NewDecFromInt(swapOutput.Amount).Quo(sdk.NewDecFromInt(coinB.Amount)) + priceChange := sdkmath.LegacyNewDecFromInt(swapOutput.Amount).Quo(sdkmath.LegacyNewDecFromInt(coinB.Amount)) if err := k.assertSlippageWithinLimit(priceChange, slippageLimit); err != nil { return err } @@ -34,7 +35,7 @@ func (k *Keeper) SwapExactForTokens(ctx sdk.Context, requester sdk.AccAddress, e } // SwapForExactTokens swaps a coin a input for an exact coin b output -func (k *Keeper) SwapForExactTokens(ctx sdk.Context, requester sdk.AccAddress, coinA, exactCoinB sdk.Coin, slippageLimit sdk.Dec) error { +func (k *Keeper) SwapForExactTokens(ctx sdk.Context, requester sdk.AccAddress, coinA, exactCoinB sdk.Coin, slippageLimit sdkmath.LegacyDec) error { poolID, pool, err := k.loadPool(ctx, coinA.Denom, exactCoinB.Denom) if err != nil { return err @@ -49,7 +50,7 @@ func (k *Keeper) SwapForExactTokens(ctx sdk.Context, requester sdk.AccAddress, c swapInput, feePaid := pool.SwapWithExactOutput(exactCoinB, k.GetSwapFee(ctx)) - priceChange := sdk.NewDecFromInt(coinA.Amount).Quo(sdk.NewDecFromInt(swapInput.Sub(feePaid).Amount)) + priceChange := sdkmath.LegacyNewDecFromInt(coinA.Amount).Quo(sdkmath.LegacyNewDecFromInt(swapInput.Sub(feePaid).Amount)) if err := k.assertSlippageWithinLimit(priceChange, slippageLimit); err != nil { return err } @@ -77,8 +78,8 @@ func (k Keeper) loadPool(ctx sdk.Context, denomA string, denomB string) (string, return poolID, pool, nil } -func (k Keeper) assertSlippageWithinLimit(priceChange sdk.Dec, slippageLimit sdk.Dec) error { - slippage := sdk.OneDec().Sub(priceChange) +func (k Keeper) assertSlippageWithinLimit(priceChange sdkmath.LegacyDec, slippageLimit sdkmath.LegacyDec) error { + slippage := sdkmath.LegacyOneDec().Sub(priceChange) if slippage.GT(slippageLimit) { return errorsmod.Wrapf(types.ErrSlippageExceeded, "slippage %s > limit %s", slippage, slippageLimit) } diff --git a/x/swap/keeper/swap_test.go b/x/swap/keeper/swap_test.go index 12d13af616..9d2005e454 100644 --- a/x/swap/keeper/swap_test.go +++ b/x/swap/keeper/swap_test.go @@ -14,7 +14,7 @@ import ( func (suite *keeperTestSuite) TestSwapExactForTokens() { suite.Keeper.SetParams(suite.Ctx, types.Params{ - SwapFee: sdk.MustNewDecFromStr("0.0025"), + SwapFee: sdkmath.LegacyMustNewDecFromStr("0.0025"), }) owner := suite.CreateAccount(sdk.Coins{}) reserves := sdk.NewCoins( @@ -31,7 +31,7 @@ func (suite *keeperTestSuite) TestSwapExactForTokens() { coinA := sdk.NewCoin("ukava", sdkmath.NewInt(1e6)) coinB := sdk.NewCoin("usdx", sdkmath.NewInt(5e6)) - err := suite.Keeper.SwapExactForTokens(suite.Ctx, requester.GetAddress(), coinA, coinB, sdk.MustNewDecFromStr("0.01")) + err := suite.Keeper.SwapExactForTokens(suite.Ctx, requester.GetAddress(), coinA, coinB, sdkmath.LegacyMustNewDecFromStr("0.01")) suite.Require().NoError(err) expectedOutput := sdk.NewCoin("usdx", sdkmath.NewInt(4982529)) @@ -67,7 +67,7 @@ func (suite *keeperTestSuite) TestSwapExactForTokens_OutputGreaterThanZero() { coinA := sdk.NewCoin("usdx", sdkmath.NewInt(5)) coinB := sdk.NewCoin("ukava", sdkmath.NewInt(1)) - err := suite.Keeper.SwapExactForTokens(suite.Ctx, requester.GetAddress(), coinA, coinB, sdk.MustNewDecFromStr("1")) + err := suite.Keeper.SwapExactForTokens(suite.Ctx, requester.GetAddress(), coinA, coinB, sdkmath.LegacyMustNewDecFromStr("1")) suite.EqualError(err, "swap output rounds to zero, increase input amount: insufficient liquidity") } @@ -83,48 +83,48 @@ func (suite *keeperTestSuite) TestSwapExactForTokens_Slippage() { testCases := []struct { coinA sdk.Coin coinB sdk.Coin - slippage sdk.Dec - fee sdk.Dec + slippage sdkmath.LegacyDec + fee sdkmath.LegacyDec shouldFail bool }{ // positive slippage OK - {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(2e6)), sdk.MustNewDecFromStr("0.01"), sdk.MustNewDecFromStr("0.0025"), false}, - {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(4e6)), sdk.MustNewDecFromStr("0.01"), sdk.MustNewDecFromStr("0.0025"), false}, - {sdk.NewCoin("usdx", sdkmath.NewInt(50e6)), sdk.NewCoin("ukava", sdkmath.NewInt(5e6)), sdk.MustNewDecFromStr("0.01"), sdk.MustNewDecFromStr("0.0025"), false}, - {sdk.NewCoin("usdx", sdkmath.NewInt(50e6)), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.MustNewDecFromStr("0.01"), sdk.MustNewDecFromStr("0.0025"), false}, + {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(2e6)), sdkmath.LegacyMustNewDecFromStr("0.01"), sdkmath.LegacyMustNewDecFromStr("0.0025"), false}, + {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(4e6)), sdkmath.LegacyMustNewDecFromStr("0.01"), sdkmath.LegacyMustNewDecFromStr("0.0025"), false}, + {sdk.NewCoin("usdx", sdkmath.NewInt(50e6)), sdk.NewCoin("ukava", sdkmath.NewInt(5e6)), sdkmath.LegacyMustNewDecFromStr("0.01"), sdkmath.LegacyMustNewDecFromStr("0.0025"), false}, + {sdk.NewCoin("usdx", sdkmath.NewInt(50e6)), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdkmath.LegacyMustNewDecFromStr("0.01"), sdkmath.LegacyMustNewDecFromStr("0.0025"), false}, // positive slippage with zero slippage OK - {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(2e6)), sdk.ZeroDec(), sdk.MustNewDecFromStr("0.0025"), false}, - {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(4e6)), sdk.ZeroDec(), sdk.MustNewDecFromStr("0.0025"), false}, - {sdk.NewCoin("usdx", sdkmath.NewInt(50e6)), sdk.NewCoin("ukava", sdkmath.NewInt(5e6)), sdk.ZeroDec(), sdk.MustNewDecFromStr("0.0025"), false}, - {sdk.NewCoin("usdx", sdkmath.NewInt(50e6)), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.ZeroDec(), sdk.MustNewDecFromStr("0.0025"), false}, + {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(2e6)), sdkmath.LegacyZeroDec(), sdkmath.LegacyMustNewDecFromStr("0.0025"), false}, + {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(4e6)), sdkmath.LegacyZeroDec(), sdkmath.LegacyMustNewDecFromStr("0.0025"), false}, + {sdk.NewCoin("usdx", sdkmath.NewInt(50e6)), sdk.NewCoin("ukava", sdkmath.NewInt(5e6)), sdkmath.LegacyZeroDec(), sdkmath.LegacyMustNewDecFromStr("0.0025"), false}, + {sdk.NewCoin("usdx", sdkmath.NewInt(50e6)), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdkmath.LegacyZeroDec(), sdkmath.LegacyMustNewDecFromStr("0.0025"), false}, // exact zero slippage OK - {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(4950495)), sdk.ZeroDec(), sdk.MustNewDecFromStr("0"), false}, - {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(4935790)), sdk.ZeroDec(), sdk.MustNewDecFromStr("0.003"), false}, - {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(4705299)), sdk.ZeroDec(), sdk.MustNewDecFromStr("0.05"), false}, - {sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.NewCoin("ukava", sdkmath.NewInt(990099)), sdk.ZeroDec(), sdk.MustNewDecFromStr("0"), false}, - {sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.NewCoin("ukava", sdkmath.NewInt(987158)), sdk.ZeroDec(), sdk.MustNewDecFromStr("0.003"), false}, - {sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.NewCoin("ukava", sdkmath.NewInt(941059)), sdk.ZeroDec(), sdk.MustNewDecFromStr("0.05"), false}, + {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(4950495)), sdkmath.LegacyZeroDec(), sdkmath.LegacyMustNewDecFromStr("0"), false}, + {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(4935790)), sdkmath.LegacyZeroDec(), sdkmath.LegacyMustNewDecFromStr("0.003"), false}, + {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(4705299)), sdkmath.LegacyZeroDec(), sdkmath.LegacyMustNewDecFromStr("0.05"), false}, + {sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.NewCoin("ukava", sdkmath.NewInt(990099)), sdkmath.LegacyZeroDec(), sdkmath.LegacyMustNewDecFromStr("0"), false}, + {sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.NewCoin("ukava", sdkmath.NewInt(987158)), sdkmath.LegacyZeroDec(), sdkmath.LegacyMustNewDecFromStr("0.003"), false}, + {sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.NewCoin("ukava", sdkmath.NewInt(941059)), sdkmath.LegacyZeroDec(), sdkmath.LegacyMustNewDecFromStr("0.05"), false}, // slippage failure, zero slippage tolerance - {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(4950496)), sdk.ZeroDec(), sdk.MustNewDecFromStr("0"), true}, - {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(4935793)), sdk.ZeroDec(), sdk.MustNewDecFromStr("0.003"), true}, - {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(4705300)), sdk.ZeroDec(), sdk.MustNewDecFromStr("0.05"), true}, - {sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.NewCoin("ukava", sdkmath.NewInt(990100)), sdk.ZeroDec(), sdk.MustNewDecFromStr("0"), true}, - {sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.NewCoin("ukava", sdkmath.NewInt(987159)), sdk.ZeroDec(), sdk.MustNewDecFromStr("0.003"), true}, - {sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.NewCoin("ukava", sdkmath.NewInt(941060)), sdk.ZeroDec(), sdk.MustNewDecFromStr("0.05"), true}, + {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(4950496)), sdkmath.LegacyZeroDec(), sdkmath.LegacyMustNewDecFromStr("0"), true}, + {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(4935793)), sdkmath.LegacyZeroDec(), sdkmath.LegacyMustNewDecFromStr("0.003"), true}, + {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(4705300)), sdkmath.LegacyZeroDec(), sdkmath.LegacyMustNewDecFromStr("0.05"), true}, + {sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.NewCoin("ukava", sdkmath.NewInt(990100)), sdkmath.LegacyZeroDec(), sdkmath.LegacyMustNewDecFromStr("0"), true}, + {sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.NewCoin("ukava", sdkmath.NewInt(987159)), sdkmath.LegacyZeroDec(), sdkmath.LegacyMustNewDecFromStr("0.003"), true}, + {sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.NewCoin("ukava", sdkmath.NewInt(941060)), sdkmath.LegacyZeroDec(), sdkmath.LegacyMustNewDecFromStr("0.05"), true}, // slippage failure, 1 percent slippage - {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(5000501)), sdk.MustNewDecFromStr("0.01"), sdk.MustNewDecFromStr("0"), true}, - {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(4985647)), sdk.MustNewDecFromStr("0.01"), sdk.MustNewDecFromStr("0.003"), true}, - {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(4752828)), sdk.MustNewDecFromStr("0.01"), sdk.MustNewDecFromStr("0.05"), true}, - {sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.NewCoin("ukava", sdkmath.NewInt(1000101)), sdk.MustNewDecFromStr("0.01"), sdk.MustNewDecFromStr("0"), true}, - {sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.NewCoin("ukava", sdkmath.NewInt(997130)), sdk.MustNewDecFromStr("0.01"), sdk.MustNewDecFromStr("0.003"), true}, - {sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.NewCoin("ukava", sdkmath.NewInt(950565)), sdk.MustNewDecFromStr("0.01"), sdk.MustNewDecFromStr("0.05"), true}, + {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(5000501)), sdkmath.LegacyMustNewDecFromStr("0.01"), sdkmath.LegacyMustNewDecFromStr("0"), true}, + {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(4985647)), sdkmath.LegacyMustNewDecFromStr("0.01"), sdkmath.LegacyMustNewDecFromStr("0.003"), true}, + {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(4752828)), sdkmath.LegacyMustNewDecFromStr("0.01"), sdkmath.LegacyMustNewDecFromStr("0.05"), true}, + {sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.NewCoin("ukava", sdkmath.NewInt(1000101)), sdkmath.LegacyMustNewDecFromStr("0.01"), sdkmath.LegacyMustNewDecFromStr("0"), true}, + {sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.NewCoin("ukava", sdkmath.NewInt(997130)), sdkmath.LegacyMustNewDecFromStr("0.01"), sdkmath.LegacyMustNewDecFromStr("0.003"), true}, + {sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.NewCoin("ukava", sdkmath.NewInt(950565)), sdkmath.LegacyMustNewDecFromStr("0.01"), sdkmath.LegacyMustNewDecFromStr("0.05"), true}, // slippage OK, 1 percent slippage - {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(5000500)), sdk.MustNewDecFromStr("0.01"), sdk.MustNewDecFromStr("0"), false}, - {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(4985646)), sdk.MustNewDecFromStr("0.01"), sdk.MustNewDecFromStr("0.003"), false}, - {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(4752827)), sdk.MustNewDecFromStr("0.01"), sdk.MustNewDecFromStr("0.05"), false}, - {sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.NewCoin("ukava", sdkmath.NewInt(1000100)), sdk.MustNewDecFromStr("0.01"), sdk.MustNewDecFromStr("0"), false}, - {sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.NewCoin("ukava", sdkmath.NewInt(997129)), sdk.MustNewDecFromStr("0.01"), sdk.MustNewDecFromStr("0.003"), false}, - {sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.NewCoin("ukava", sdkmath.NewInt(950564)), sdk.MustNewDecFromStr("0.01"), sdk.MustNewDecFromStr("0.05"), false}, + {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(5000500)), sdkmath.LegacyMustNewDecFromStr("0.01"), sdkmath.LegacyMustNewDecFromStr("0"), false}, + {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(4985646)), sdkmath.LegacyMustNewDecFromStr("0.01"), sdkmath.LegacyMustNewDecFromStr("0.003"), false}, + {sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(4752827)), sdkmath.LegacyMustNewDecFromStr("0.01"), sdkmath.LegacyMustNewDecFromStr("0.05"), false}, + {sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.NewCoin("ukava", sdkmath.NewInt(1000100)), sdkmath.LegacyMustNewDecFromStr("0.01"), sdkmath.LegacyMustNewDecFromStr("0"), false}, + {sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.NewCoin("ukava", sdkmath.NewInt(997129)), sdkmath.LegacyMustNewDecFromStr("0.01"), sdkmath.LegacyMustNewDecFromStr("0.003"), false}, + {sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.NewCoin("ukava", sdkmath.NewInt(950564)), sdkmath.LegacyMustNewDecFromStr("0.01"), sdkmath.LegacyMustNewDecFromStr("0.05"), false}, } for _, tc := range testCases { @@ -146,7 +146,7 @@ func (suite *keeperTestSuite) TestSwapExactForTokens_Slippage() { ) requester := suite.NewAccountFromAddr(sdk.AccAddress("requester-----------"), balance) - ctx := suite.App.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := suite.App.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) err := suite.Keeper.SwapExactForTokens(ctx, requester.GetAddress(), tc.coinA, tc.coinB, tc.slippage) if tc.shouldFail { @@ -166,8 +166,8 @@ func (suite *keeperTestSuite) TestSwapExactForTokens_InsufficientFunds() { coinA sdk.Coin coinB sdk.Coin }{ - {"no ukava balance", sdk.NewCoin("ukava", sdk.ZeroInt()), sdk.NewCoin("ukava", sdkmath.NewInt(100)), sdk.NewCoin("usdx", sdkmath.NewInt(500))}, - {"no usdx balance", sdk.NewCoin("usdx", sdk.ZeroInt()), sdk.NewCoin("usdx", sdkmath.NewInt(500)), sdk.NewCoin("ukava", sdkmath.NewInt(100))}, + {"no ukava balance", sdk.NewCoin("ukava", sdkmath.ZeroInt()), sdk.NewCoin("ukava", sdkmath.NewInt(100)), sdk.NewCoin("usdx", sdkmath.NewInt(500))}, + {"no usdx balance", sdk.NewCoin("usdx", sdkmath.ZeroInt()), sdk.NewCoin("usdx", sdkmath.NewInt(500)), sdk.NewCoin("ukava", sdkmath.NewInt(100))}, {"low ukava balance", sdk.NewCoin("ukava", sdkmath.NewInt(1000000)), sdk.NewCoin("ukava", sdkmath.NewInt(1000001)), sdk.NewCoin("usdx", sdkmath.NewInt(5000000))}, {"low ukava balance", sdk.NewCoin("usdx", sdkmath.NewInt(5000000)), sdk.NewCoin("usdx", sdkmath.NewInt(5000001)), sdk.NewCoin("ukava", sdkmath.NewInt(1000000))}, {"large ukava balance difference", sdk.NewCoin("ukava", sdkmath.NewInt(100e6)), sdk.NewCoin("ukava", sdkmath.NewInt(1000e6)), sdk.NewCoin("usdx", sdkmath.NewInt(5000e6))}, @@ -187,8 +187,8 @@ func (suite *keeperTestSuite) TestSwapExactForTokens_InsufficientFunds() { balance := sdk.NewCoins(tc.balanceA) requester := suite.NewAccountFromAddr(sdk.AccAddress("requester-----------"), balance) - ctx := suite.App.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) - err := suite.Keeper.SwapExactForTokens(ctx, requester.GetAddress(), tc.coinA, tc.coinB, sdk.MustNewDecFromStr("0.1")) + ctx := suite.App.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + err := suite.Keeper.SwapExactForTokens(ctx, requester.GetAddress(), tc.coinA, tc.coinB, sdkmath.LegacyMustNewDecFromStr("0.1")) suite.Require().True(errors.Is(err, sdkerrors.ErrInsufficientFunds), fmt.Sprintf("got err %s", err)) }) } @@ -202,8 +202,8 @@ func (suite *keeperTestSuite) TestSwapExactForTokens_InsufficientFunds_Vesting() coinA sdk.Coin coinB sdk.Coin }{ - {"no ukava balance, vesting only", sdk.NewCoin("ukava", sdk.ZeroInt()), sdk.NewCoin("ukava", sdkmath.NewInt(100)), sdk.NewCoin("ukava", sdkmath.NewInt(100)), sdk.NewCoin("usdx", sdkmath.NewInt(500))}, - {"no usdx balance, vesting only", sdk.NewCoin("usdx", sdk.ZeroInt()), sdk.NewCoin("usdx", sdkmath.NewInt(500)), sdk.NewCoin("usdx", sdkmath.NewInt(500)), sdk.NewCoin("ukava", sdkmath.NewInt(100))}, + {"no ukava balance, vesting only", sdk.NewCoin("ukava", sdkmath.ZeroInt()), sdk.NewCoin("ukava", sdkmath.NewInt(100)), sdk.NewCoin("ukava", sdkmath.NewInt(100)), sdk.NewCoin("usdx", sdkmath.NewInt(500))}, + {"no usdx balance, vesting only", sdk.NewCoin("usdx", sdkmath.ZeroInt()), sdk.NewCoin("usdx", sdkmath.NewInt(500)), sdk.NewCoin("usdx", sdkmath.NewInt(500)), sdk.NewCoin("ukava", sdkmath.NewInt(100))}, {"low ukava balance, vesting matches exact", sdk.NewCoin("ukava", sdkmath.NewInt(1000000)), sdk.NewCoin("ukava", sdkmath.NewInt(1)), sdk.NewCoin("ukava", sdkmath.NewInt(1000001)), sdk.NewCoin("usdx", sdkmath.NewInt(5000000))}, {"low ukava balance, vesting matches exact", sdk.NewCoin("usdx", sdkmath.NewInt(5000000)), sdk.NewCoin("usdx", sdkmath.NewInt(1)), sdk.NewCoin("usdx", sdkmath.NewInt(5000001)), sdk.NewCoin("ukava", sdkmath.NewInt(1000000))}, {"large ukava balance difference, vesting covers difference", sdk.NewCoin("ukava", sdkmath.NewInt(100e6)), sdk.NewCoin("ukava", sdkmath.NewInt(1000e6)), sdk.NewCoin("ukava", sdkmath.NewInt(1000e6)), sdk.NewCoin("usdx", sdkmath.NewInt(5000e6))}, @@ -224,8 +224,8 @@ func (suite *keeperTestSuite) TestSwapExactForTokens_InsufficientFunds_Vesting() vesting := sdk.NewCoins(tc.vestingA) requester := suite.CreateVestingAccount(balance, vesting) - ctx := suite.App.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) - err := suite.Keeper.SwapExactForTokens(ctx, requester.GetAddress(), tc.coinA, tc.coinB, sdk.MustNewDecFromStr("0.1")) + ctx := suite.App.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + err := suite.Keeper.SwapExactForTokens(ctx, requester.GetAddress(), tc.coinA, tc.coinB, sdkmath.LegacyMustNewDecFromStr("0.1")) suite.Require().True(errors.Is(err, sdkerrors.ErrInsufficientFunds), fmt.Sprintf("got err %s", err)) }) } @@ -249,10 +249,10 @@ func (suite *keeperTestSuite) TestSwapExactForTokens_PoolNotFound() { coinA := sdk.NewCoin("ukava", sdkmath.NewInt(1e6)) coinB := sdk.NewCoin("usdx", sdkmath.NewInt(5e6)) - err := suite.Keeper.SwapExactForTokens(suite.Ctx, requester.GetAddress(), coinA, coinB, sdk.MustNewDecFromStr("0.01")) + err := suite.Keeper.SwapExactForTokens(suite.Ctx, requester.GetAddress(), coinA, coinB, sdkmath.LegacyMustNewDecFromStr("0.01")) suite.EqualError(err, "pool ukava:usdx not found: invalid pool") - err = suite.Keeper.SwapExactForTokens(suite.Ctx, requester.GetAddress(), coinB, coinA, sdk.MustNewDecFromStr("0.01")) + err = suite.Keeper.SwapExactForTokens(suite.Ctx, requester.GetAddress(), coinB, coinA, sdkmath.LegacyMustNewDecFromStr("0.01")) suite.EqualError(err, "pool ukava:usdx not found: invalid pool") } @@ -268,7 +268,7 @@ func (suite *keeperTestSuite) TestSwapExactForTokens_PanicOnInvalidPool() { poolRecord, found := suite.Keeper.GetPool(suite.Ctx, poolID) suite.Require().True(found, "expected pool record to exist") - poolRecord.TotalShares = sdk.ZeroInt() + poolRecord.TotalShares = sdkmath.ZeroInt() suite.Keeper.SetPool_Raw(suite.Ctx, poolRecord) balance := sdk.NewCoins( @@ -280,11 +280,11 @@ func (suite *keeperTestSuite) TestSwapExactForTokens_PanicOnInvalidPool() { coinB := sdk.NewCoin("usdx", sdkmath.NewInt(5e6)) suite.PanicsWithValue("invalid pool ukava:usdx: total shares must be greater than zero: invalid pool", func() { - _ = suite.Keeper.SwapExactForTokens(suite.Ctx, requester.GetAddress(), coinA, coinB, sdk.MustNewDecFromStr("0.01")) + _ = suite.Keeper.SwapExactForTokens(suite.Ctx, requester.GetAddress(), coinA, coinB, sdkmath.LegacyMustNewDecFromStr("0.01")) }, "expected invalid pool record to panic") suite.PanicsWithValue("invalid pool ukava:usdx: total shares must be greater than zero: invalid pool", func() { - _ = suite.Keeper.SwapExactForTokens(suite.Ctx, requester.GetAddress(), coinB, coinA, sdk.MustNewDecFromStr("0.01")) + _ = suite.Keeper.SwapExactForTokens(suite.Ctx, requester.GetAddress(), coinB, coinA, sdkmath.LegacyMustNewDecFromStr("0.01")) }, "expected invalid pool record to panic") } @@ -311,17 +311,17 @@ func (suite *keeperTestSuite) TestSwapExactForTokens_PanicOnInsufficientModuleAc coinB := sdk.NewCoin("usdx", sdkmath.NewInt(5e6)) suite.Panics(func() { - _ = suite.Keeper.SwapExactForTokens(suite.Ctx, requester.GetAddress(), coinA, coinB, sdk.MustNewDecFromStr("0.01")) + _ = suite.Keeper.SwapExactForTokens(suite.Ctx, requester.GetAddress(), coinA, coinB, sdkmath.LegacyMustNewDecFromStr("0.01")) }, "expected panic when module account does not have enough funds") suite.Panics(func() { - _ = suite.Keeper.SwapExactForTokens(suite.Ctx, requester.GetAddress(), coinA, coinB, sdk.MustNewDecFromStr("0.01")) + _ = suite.Keeper.SwapExactForTokens(suite.Ctx, requester.GetAddress(), coinA, coinB, sdkmath.LegacyMustNewDecFromStr("0.01")) }, "expected panic when module account does not have enough funds") } func (suite *keeperTestSuite) TestSwapForExactTokens() { suite.Keeper.SetParams(suite.Ctx, types.Params{ - SwapFee: sdk.MustNewDecFromStr("0.0025"), + SwapFee: sdkmath.LegacyMustNewDecFromStr("0.0025"), }) owner := suite.CreateAccount(sdk.Coins{}) reserves := sdk.NewCoins( @@ -338,7 +338,7 @@ func (suite *keeperTestSuite) TestSwapForExactTokens() { coinA := sdk.NewCoin("ukava", sdkmath.NewInt(1e6)) coinB := sdk.NewCoin("usdx", sdkmath.NewInt(5e6)) - err := suite.Keeper.SwapForExactTokens(suite.Ctx, requester.GetAddress(), coinA, coinB, sdk.MustNewDecFromStr("0.01")) + err := suite.Keeper.SwapForExactTokens(suite.Ctx, requester.GetAddress(), coinA, coinB, sdkmath.LegacyMustNewDecFromStr("0.01")) suite.Require().NoError(err) expectedInput := sdk.NewCoin("ukava", sdkmath.NewInt(1003511)) @@ -373,12 +373,12 @@ func (suite *keeperTestSuite) TestSwapForExactTokens_OutputLessThanPoolReserves( requester := suite.NewAccountFromAddr(sdk.AccAddress("requester-----------"), balance) coinA := sdk.NewCoin("ukava", sdkmath.NewInt(1e6)) - coinB := sdk.NewCoin("usdx", sdkmath.NewInt(500e6).Add(sdk.OneInt())) - err := suite.Keeper.SwapForExactTokens(suite.Ctx, requester.GetAddress(), coinA, coinB, sdk.MustNewDecFromStr("0.01")) + coinB := sdk.NewCoin("usdx", sdkmath.NewInt(500e6).Add(sdkmath.OneInt())) + err := suite.Keeper.SwapForExactTokens(suite.Ctx, requester.GetAddress(), coinA, coinB, sdkmath.LegacyMustNewDecFromStr("0.01")) suite.EqualError(err, "output 500000001 >= pool reserves 500000000: insufficient liquidity") coinB = sdk.NewCoin("usdx", sdkmath.NewInt(500e6)) - err = suite.Keeper.SwapForExactTokens(suite.Ctx, requester.GetAddress(), coinA, coinB, sdk.MustNewDecFromStr("0.01")) + err = suite.Keeper.SwapForExactTokens(suite.Ctx, requester.GetAddress(), coinA, coinB, sdkmath.LegacyMustNewDecFromStr("0.01")) suite.EqualError(err, "output 500000000 >= pool reserves 500000000: insufficient liquidity") } @@ -394,48 +394,48 @@ func (suite *keeperTestSuite) TestSwapForExactTokens_Slippage() { testCases := []struct { coinA sdk.Coin coinB sdk.Coin - slippage sdk.Dec - fee sdk.Dec + slippage sdkmath.LegacyDec + fee sdkmath.LegacyDec shouldFail bool }{ // positive slippage OK - {sdk.NewCoin("ukava", sdkmath.NewInt(5e6)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.MustNewDecFromStr("0.01"), sdk.MustNewDecFromStr("0.0025"), false}, - {sdk.NewCoin("ukava", sdkmath.NewInt(5e6)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.MustNewDecFromStr("0.01"), sdk.MustNewDecFromStr("0.0025"), false}, - {sdk.NewCoin("usdx", sdkmath.NewInt(100e6)), sdk.NewCoin("ukava", sdkmath.NewInt(10e6)), sdk.MustNewDecFromStr("0.01"), sdk.MustNewDecFromStr("0.0025"), false}, - {sdk.NewCoin("usdx", sdkmath.NewInt(100e6)), sdk.NewCoin("ukava", sdkmath.NewInt(10e6)), sdk.MustNewDecFromStr("0.01"), sdk.MustNewDecFromStr("0.0025"), false}, + {sdk.NewCoin("ukava", sdkmath.NewInt(5e6)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdkmath.LegacyMustNewDecFromStr("0.01"), sdkmath.LegacyMustNewDecFromStr("0.0025"), false}, + {sdk.NewCoin("ukava", sdkmath.NewInt(5e6)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdkmath.LegacyMustNewDecFromStr("0.01"), sdkmath.LegacyMustNewDecFromStr("0.0025"), false}, + {sdk.NewCoin("usdx", sdkmath.NewInt(100e6)), sdk.NewCoin("ukava", sdkmath.NewInt(10e6)), sdkmath.LegacyMustNewDecFromStr("0.01"), sdkmath.LegacyMustNewDecFromStr("0.0025"), false}, + {sdk.NewCoin("usdx", sdkmath.NewInt(100e6)), sdk.NewCoin("ukava", sdkmath.NewInt(10e6)), sdkmath.LegacyMustNewDecFromStr("0.01"), sdkmath.LegacyMustNewDecFromStr("0.0025"), false}, // positive slippage with zero slippage OK - {sdk.NewCoin("ukava", sdkmath.NewInt(5e6)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.ZeroDec(), sdk.MustNewDecFromStr("0.0025"), false}, - {sdk.NewCoin("ukava", sdkmath.NewInt(5e6)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.ZeroDec(), sdk.MustNewDecFromStr("0.0025"), false}, - {sdk.NewCoin("usdx", sdkmath.NewInt(100e6)), sdk.NewCoin("ukava", sdkmath.NewInt(10e6)), sdk.ZeroDec(), sdk.MustNewDecFromStr("0.0025"), false}, - {sdk.NewCoin("usdx", sdkmath.NewInt(100e6)), sdk.NewCoin("ukava", sdkmath.NewInt(10e6)), sdk.ZeroDec(), sdk.MustNewDecFromStr("0.0025"), false}, + {sdk.NewCoin("ukava", sdkmath.NewInt(5e6)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdkmath.LegacyZeroDec(), sdkmath.LegacyMustNewDecFromStr("0.0025"), false}, + {sdk.NewCoin("ukava", sdkmath.NewInt(5e6)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdkmath.LegacyZeroDec(), sdkmath.LegacyMustNewDecFromStr("0.0025"), false}, + {sdk.NewCoin("usdx", sdkmath.NewInt(100e6)), sdk.NewCoin("ukava", sdkmath.NewInt(10e6)), sdkmath.LegacyZeroDec(), sdkmath.LegacyMustNewDecFromStr("0.0025"), false}, + {sdk.NewCoin("usdx", sdkmath.NewInt(100e6)), sdk.NewCoin("ukava", sdkmath.NewInt(10e6)), sdkmath.LegacyZeroDec(), sdkmath.LegacyMustNewDecFromStr("0.0025"), false}, // exact zero slippage OK - {sdk.NewCoin("ukava", sdkmath.NewInt(1010102)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.ZeroDec(), sdk.MustNewDecFromStr("0"), false}, - {sdk.NewCoin("ukava", sdkmath.NewInt(1010102)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.ZeroDec(), sdk.MustNewDecFromStr("0.003"), false}, - {sdk.NewCoin("ukava", sdkmath.NewInt(1010102)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.ZeroDec(), sdk.MustNewDecFromStr("0.05"), false}, - {sdk.NewCoin("usdx", sdkmath.NewInt(5050506)), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.ZeroDec(), sdk.MustNewDecFromStr("0"), false}, - {sdk.NewCoin("usdx", sdkmath.NewInt(5050506)), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.ZeroDec(), sdk.MustNewDecFromStr("0.003"), false}, - {sdk.NewCoin("usdx", sdkmath.NewInt(5050506)), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.ZeroDec(), sdk.MustNewDecFromStr("0.05"), false}, + {sdk.NewCoin("ukava", sdkmath.NewInt(1010102)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdkmath.LegacyZeroDec(), sdkmath.LegacyMustNewDecFromStr("0"), false}, + {sdk.NewCoin("ukava", sdkmath.NewInt(1010102)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdkmath.LegacyZeroDec(), sdkmath.LegacyMustNewDecFromStr("0.003"), false}, + {sdk.NewCoin("ukava", sdkmath.NewInt(1010102)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdkmath.LegacyZeroDec(), sdkmath.LegacyMustNewDecFromStr("0.05"), false}, + {sdk.NewCoin("usdx", sdkmath.NewInt(5050506)), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdkmath.LegacyZeroDec(), sdkmath.LegacyMustNewDecFromStr("0"), false}, + {sdk.NewCoin("usdx", sdkmath.NewInt(5050506)), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdkmath.LegacyZeroDec(), sdkmath.LegacyMustNewDecFromStr("0.003"), false}, + {sdk.NewCoin("usdx", sdkmath.NewInt(5050506)), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdkmath.LegacyZeroDec(), sdkmath.LegacyMustNewDecFromStr("0.05"), false}, // slippage failure, zero slippage tolerance - {sdk.NewCoin("ukava", sdkmath.NewInt(1010101)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.ZeroDec(), sdk.MustNewDecFromStr("0"), true}, - {sdk.NewCoin("ukava", sdkmath.NewInt(1010101)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.ZeroDec(), sdk.MustNewDecFromStr("0.003"), true}, - {sdk.NewCoin("ukava", sdkmath.NewInt(1010101)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.ZeroDec(), sdk.MustNewDecFromStr("0.05"), true}, - {sdk.NewCoin("usdx", sdkmath.NewInt(5050505)), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.ZeroDec(), sdk.MustNewDecFromStr("0"), true}, - {sdk.NewCoin("usdx", sdkmath.NewInt(5050505)), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.ZeroDec(), sdk.MustNewDecFromStr("0.003"), true}, - {sdk.NewCoin("usdx", sdkmath.NewInt(5050505)), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.ZeroDec(), sdk.MustNewDecFromStr("0.05"), true}, + {sdk.NewCoin("ukava", sdkmath.NewInt(1010101)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdkmath.LegacyZeroDec(), sdkmath.LegacyMustNewDecFromStr("0"), true}, + {sdk.NewCoin("ukava", sdkmath.NewInt(1010101)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdkmath.LegacyZeroDec(), sdkmath.LegacyMustNewDecFromStr("0.003"), true}, + {sdk.NewCoin("ukava", sdkmath.NewInt(1010101)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdkmath.LegacyZeroDec(), sdkmath.LegacyMustNewDecFromStr("0.05"), true}, + {sdk.NewCoin("usdx", sdkmath.NewInt(5050505)), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdkmath.LegacyZeroDec(), sdkmath.LegacyMustNewDecFromStr("0"), true}, + {sdk.NewCoin("usdx", sdkmath.NewInt(5050505)), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdkmath.LegacyZeroDec(), sdkmath.LegacyMustNewDecFromStr("0.003"), true}, + {sdk.NewCoin("usdx", sdkmath.NewInt(5050505)), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdkmath.LegacyZeroDec(), sdkmath.LegacyMustNewDecFromStr("0.05"), true}, // slippage failure, 1 percent slippage - {sdk.NewCoin("ukava", sdkmath.NewInt(1000000)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.MustNewDecFromStr("0.01"), sdk.MustNewDecFromStr("0"), true}, - {sdk.NewCoin("ukava", sdkmath.NewInt(1000000)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.MustNewDecFromStr("0.01"), sdk.MustNewDecFromStr("0.003"), true}, - {sdk.NewCoin("ukava", sdkmath.NewInt(1000000)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.MustNewDecFromStr("0.01"), sdk.MustNewDecFromStr("0.05"), true}, - {sdk.NewCoin("usdx", sdkmath.NewInt(5000000)), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.MustNewDecFromStr("0.01"), sdk.MustNewDecFromStr("0"), true}, - {sdk.NewCoin("usdx", sdkmath.NewInt(5000000)), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.MustNewDecFromStr("0.01"), sdk.MustNewDecFromStr("0.003"), true}, - {sdk.NewCoin("usdx", sdkmath.NewInt(5000000)), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.MustNewDecFromStr("0.01"), sdk.MustNewDecFromStr("0.05"), true}, + {sdk.NewCoin("ukava", sdkmath.NewInt(1000000)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdkmath.LegacyMustNewDecFromStr("0.01"), sdkmath.LegacyMustNewDecFromStr("0"), true}, + {sdk.NewCoin("ukava", sdkmath.NewInt(1000000)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdkmath.LegacyMustNewDecFromStr("0.01"), sdkmath.LegacyMustNewDecFromStr("0.003"), true}, + {sdk.NewCoin("ukava", sdkmath.NewInt(1000000)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdkmath.LegacyMustNewDecFromStr("0.01"), sdkmath.LegacyMustNewDecFromStr("0.05"), true}, + {sdk.NewCoin("usdx", sdkmath.NewInt(5000000)), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdkmath.LegacyMustNewDecFromStr("0.01"), sdkmath.LegacyMustNewDecFromStr("0"), true}, + {sdk.NewCoin("usdx", sdkmath.NewInt(5000000)), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdkmath.LegacyMustNewDecFromStr("0.01"), sdkmath.LegacyMustNewDecFromStr("0.003"), true}, + {sdk.NewCoin("usdx", sdkmath.NewInt(5000000)), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdkmath.LegacyMustNewDecFromStr("0.01"), sdkmath.LegacyMustNewDecFromStr("0.05"), true}, // slippage OK, 1 percent slippage - {sdk.NewCoin("ukava", sdkmath.NewInt(1000001)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.MustNewDecFromStr("0.01"), sdk.MustNewDecFromStr("0"), false}, - {sdk.NewCoin("ukava", sdkmath.NewInt(1000001)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.MustNewDecFromStr("0.01"), sdk.MustNewDecFromStr("0.003"), false}, - {sdk.NewCoin("ukava", sdkmath.NewInt(1000001)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.MustNewDecFromStr("0.01"), sdk.MustNewDecFromStr("0.05"), false}, - {sdk.NewCoin("usdx", sdkmath.NewInt(5000001)), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.MustNewDecFromStr("0.01"), sdk.MustNewDecFromStr("0"), false}, - {sdk.NewCoin("usdx", sdkmath.NewInt(5000001)), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.MustNewDecFromStr("0.01"), sdk.MustNewDecFromStr("0.003"), false}, - {sdk.NewCoin("usdx", sdkmath.NewInt(5000001)), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.MustNewDecFromStr("0.01"), sdk.MustNewDecFromStr("0.05"), false}, + {sdk.NewCoin("ukava", sdkmath.NewInt(1000001)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdkmath.LegacyMustNewDecFromStr("0.01"), sdkmath.LegacyMustNewDecFromStr("0"), false}, + {sdk.NewCoin("ukava", sdkmath.NewInt(1000001)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdkmath.LegacyMustNewDecFromStr("0.01"), sdkmath.LegacyMustNewDecFromStr("0.003"), false}, + {sdk.NewCoin("ukava", sdkmath.NewInt(1000001)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdkmath.LegacyMustNewDecFromStr("0.01"), sdkmath.LegacyMustNewDecFromStr("0.05"), false}, + {sdk.NewCoin("usdx", sdkmath.NewInt(5000001)), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdkmath.LegacyMustNewDecFromStr("0.01"), sdkmath.LegacyMustNewDecFromStr("0"), false}, + {sdk.NewCoin("usdx", sdkmath.NewInt(5000001)), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdkmath.LegacyMustNewDecFromStr("0.01"), sdkmath.LegacyMustNewDecFromStr("0.003"), false}, + {sdk.NewCoin("usdx", sdkmath.NewInt(5000001)), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdkmath.LegacyMustNewDecFromStr("0.01"), sdkmath.LegacyMustNewDecFromStr("0.05"), false}, } for _, tc := range testCases { @@ -457,7 +457,7 @@ func (suite *keeperTestSuite) TestSwapForExactTokens_Slippage() { ) requester := suite.NewAccountFromAddr(sdk.AccAddress("requester-----------"), balance) - ctx := suite.App.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := suite.App.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) err := suite.Keeper.SwapForExactTokens(ctx, requester.GetAddress(), tc.coinA, tc.coinB, tc.slippage) if tc.shouldFail { @@ -477,8 +477,8 @@ func (suite *keeperTestSuite) TestSwapForExactTokens_InsufficientFunds() { coinA sdk.Coin coinB sdk.Coin }{ - {"no ukava balance", sdk.NewCoin("ukava", sdk.ZeroInt()), sdk.NewCoin("ukava", sdkmath.NewInt(100)), sdk.NewCoin("usdx", sdkmath.NewInt(500))}, - {"no usdx balance", sdk.NewCoin("usdx", sdk.ZeroInt()), sdk.NewCoin("usdx", sdkmath.NewInt(500)), sdk.NewCoin("ukava", sdkmath.NewInt(100))}, + {"no ukava balance", sdk.NewCoin("ukava", sdkmath.ZeroInt()), sdk.NewCoin("ukava", sdkmath.NewInt(100)), sdk.NewCoin("usdx", sdkmath.NewInt(500))}, + {"no usdx balance", sdk.NewCoin("usdx", sdkmath.ZeroInt()), sdk.NewCoin("usdx", sdkmath.NewInt(500)), sdk.NewCoin("ukava", sdkmath.NewInt(100))}, {"low ukava balance", sdk.NewCoin("ukava", sdkmath.NewInt(1000000)), sdk.NewCoin("ukava", sdkmath.NewInt(1000000)), sdk.NewCoin("usdx", sdkmath.NewInt(5000000))}, {"low ukava balance", sdk.NewCoin("usdx", sdkmath.NewInt(5000000)), sdk.NewCoin("usdx", sdkmath.NewInt(5000000)), sdk.NewCoin("ukava", sdkmath.NewInt(1000000))}, {"large ukava balance difference", sdk.NewCoin("ukava", sdkmath.NewInt(100e6)), sdk.NewCoin("ukava", sdkmath.NewInt(1000e6)), sdk.NewCoin("usdx", sdkmath.NewInt(5000e6))}, @@ -498,8 +498,8 @@ func (suite *keeperTestSuite) TestSwapForExactTokens_InsufficientFunds() { balance := sdk.NewCoins(tc.balanceA) requester := suite.NewAccountFromAddr(sdk.AccAddress("requester-----------"), balance) - ctx := suite.App.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) - err := suite.Keeper.SwapForExactTokens(ctx, requester.GetAddress(), tc.coinA, tc.coinB, sdk.MustNewDecFromStr("0.1")) + ctx := suite.App.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + err := suite.Keeper.SwapForExactTokens(ctx, requester.GetAddress(), tc.coinA, tc.coinB, sdkmath.LegacyMustNewDecFromStr("0.1")) suite.Require().True(errors.Is(err, sdkerrors.ErrInsufficientFunds), fmt.Sprintf("got err %s", err)) }) } @@ -513,8 +513,8 @@ func (suite *keeperTestSuite) TestSwapForExactTokens_InsufficientFunds_Vesting() coinA sdk.Coin coinB sdk.Coin }{ - {"no ukava balance, vesting only", sdk.NewCoin("ukava", sdk.ZeroInt()), sdk.NewCoin("ukava", sdkmath.NewInt(100)), sdk.NewCoin("ukava", sdkmath.NewInt(1000)), sdk.NewCoin("usdx", sdkmath.NewInt(500))}, - {"no usdx balance, vesting only", sdk.NewCoin("usdx", sdk.ZeroInt()), sdk.NewCoin("usdx", sdkmath.NewInt(500)), sdk.NewCoin("usdx", sdkmath.NewInt(5000)), sdk.NewCoin("ukava", sdkmath.NewInt(100))}, + {"no ukava balance, vesting only", sdk.NewCoin("ukava", sdkmath.ZeroInt()), sdk.NewCoin("ukava", sdkmath.NewInt(100)), sdk.NewCoin("ukava", sdkmath.NewInt(1000)), sdk.NewCoin("usdx", sdkmath.NewInt(500))}, + {"no usdx balance, vesting only", sdk.NewCoin("usdx", sdkmath.ZeroInt()), sdk.NewCoin("usdx", sdkmath.NewInt(500)), sdk.NewCoin("usdx", sdkmath.NewInt(5000)), sdk.NewCoin("ukava", sdkmath.NewInt(100))}, {"low ukava balance, vesting matches exact", sdk.NewCoin("ukava", sdkmath.NewInt(1000000)), sdk.NewCoin("ukava", sdkmath.NewInt(100000)), sdk.NewCoin("ukava", sdkmath.NewInt(1000000)), sdk.NewCoin("usdx", sdkmath.NewInt(5000000))}, {"low ukava balance, vesting matches exact", sdk.NewCoin("usdx", sdkmath.NewInt(5000000)), sdk.NewCoin("usdx", sdkmath.NewInt(500000)), sdk.NewCoin("usdx", sdkmath.NewInt(5000000)), sdk.NewCoin("ukava", sdkmath.NewInt(1000000))}, {"large ukava balance difference, vesting covers difference", sdk.NewCoin("ukava", sdkmath.NewInt(100e6)), sdk.NewCoin("ukava", sdkmath.NewInt(10000e6)), sdk.NewCoin("ukava", sdkmath.NewInt(1000e6)), sdk.NewCoin("usdx", sdkmath.NewInt(5000e6))}, @@ -535,8 +535,8 @@ func (suite *keeperTestSuite) TestSwapForExactTokens_InsufficientFunds_Vesting() vesting := sdk.NewCoins(tc.vestingA) requester := suite.CreateVestingAccount(balance, vesting) - ctx := suite.App.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) - err := suite.Keeper.SwapForExactTokens(ctx, requester.GetAddress(), tc.coinA, tc.coinB, sdk.MustNewDecFromStr("0.1")) + ctx := suite.App.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + err := suite.Keeper.SwapForExactTokens(ctx, requester.GetAddress(), tc.coinA, tc.coinB, sdkmath.LegacyMustNewDecFromStr("0.1")) suite.Require().True(errors.Is(err, sdkerrors.ErrInsufficientFunds), fmt.Sprintf("got err %s", err)) }) } @@ -560,10 +560,10 @@ func (suite *keeperTestSuite) TestSwapForExactTokens_PoolNotFound() { coinA := sdk.NewCoin("ukava", sdkmath.NewInt(1e6)) coinB := sdk.NewCoin("usdx", sdkmath.NewInt(5e6)) - err := suite.Keeper.SwapForExactTokens(suite.Ctx, requester.GetAddress(), coinA, coinB, sdk.MustNewDecFromStr("0.01")) + err := suite.Keeper.SwapForExactTokens(suite.Ctx, requester.GetAddress(), coinA, coinB, sdkmath.LegacyMustNewDecFromStr("0.01")) suite.EqualError(err, "pool ukava:usdx not found: invalid pool") - err = suite.Keeper.SwapForExactTokens(suite.Ctx, requester.GetAddress(), coinB, coinA, sdk.MustNewDecFromStr("0.01")) + err = suite.Keeper.SwapForExactTokens(suite.Ctx, requester.GetAddress(), coinB, coinA, sdkmath.LegacyMustNewDecFromStr("0.01")) suite.EqualError(err, "pool ukava:usdx not found: invalid pool") } @@ -579,7 +579,7 @@ func (suite *keeperTestSuite) TestSwapForExactTokens_PanicOnInvalidPool() { poolRecord, found := suite.Keeper.GetPool(suite.Ctx, poolID) suite.Require().True(found, "expected pool record to exist") - poolRecord.TotalShares = sdk.ZeroInt() + poolRecord.TotalShares = sdkmath.ZeroInt() suite.Keeper.SetPool_Raw(suite.Ctx, poolRecord) balance := sdk.NewCoins( @@ -591,11 +591,11 @@ func (suite *keeperTestSuite) TestSwapForExactTokens_PanicOnInvalidPool() { coinB := sdk.NewCoin("usdx", sdkmath.NewInt(5e6)) suite.PanicsWithValue("invalid pool ukava:usdx: total shares must be greater than zero: invalid pool", func() { - _ = suite.Keeper.SwapForExactTokens(suite.Ctx, requester.GetAddress(), coinA, coinB, sdk.MustNewDecFromStr("0.01")) + _ = suite.Keeper.SwapForExactTokens(suite.Ctx, requester.GetAddress(), coinA, coinB, sdkmath.LegacyMustNewDecFromStr("0.01")) }, "expected invalid pool record to panic") suite.PanicsWithValue("invalid pool ukava:usdx: total shares must be greater than zero: invalid pool", func() { - _ = suite.Keeper.SwapForExactTokens(suite.Ctx, requester.GetAddress(), coinB, coinA, sdk.MustNewDecFromStr("0.01")) + _ = suite.Keeper.SwapForExactTokens(suite.Ctx, requester.GetAddress(), coinB, coinA, sdkmath.LegacyMustNewDecFromStr("0.01")) }, "expected invalid pool record to panic") } @@ -622,10 +622,10 @@ func (suite *keeperTestSuite) TestSwapForExactTokens_PanicOnInsufficientModuleAc coinB := sdk.NewCoin("usdx", sdkmath.NewInt(5e6)) suite.Panics(func() { - _ = suite.Keeper.SwapForExactTokens(suite.Ctx, requester.GetAddress(), coinA, coinB, sdk.MustNewDecFromStr("0.01")) + _ = suite.Keeper.SwapForExactTokens(suite.Ctx, requester.GetAddress(), coinA, coinB, sdkmath.LegacyMustNewDecFromStr("0.01")) }, "expected panic when module account does not have enough funds") suite.Panics(func() { - _ = suite.Keeper.SwapForExactTokens(suite.Ctx, requester.GetAddress(), coinA, coinB, sdk.MustNewDecFromStr("0.01")) + _ = suite.Keeper.SwapForExactTokens(suite.Ctx, requester.GetAddress(), coinA, coinB, sdkmath.LegacyMustNewDecFromStr("0.01")) }, "expected panic when module account does not have enough funds") } diff --git a/x/swap/keeper/withdraw_test.go b/x/swap/keeper/withdraw_test.go index f89e765865..d35ecdf067 100644 --- a/x/swap/keeper/withdraw_test.go +++ b/x/swap/keeper/withdraw_test.go @@ -92,7 +92,7 @@ func (suite *keeperTestSuite) TestWithdraw_GreaterThanSharesOwned() { totalShares := sdkmath.NewInt(30e6) suite.setupPool(reserves, totalShares, owner.GetAddress()) - sharesToWithdraw := totalShares.Add(sdk.OneInt()) + sharesToWithdraw := totalShares.Add(sdkmath.OneInt()) err := suite.Keeper.Withdraw(suite.Ctx, owner.GetAddress(), sharesToWithdraw, reserves[0], reserves[1]) suite.EqualError(err, fmt.Sprintf("withdraw of %s shares greater than %s shares owned: invalid shares", sharesToWithdraw, totalShares)) } @@ -196,7 +196,7 @@ func (suite *keeperTestSuite) TestWithdraw_PanicOnInvalidPool() { poolRecord, found := suite.Keeper.GetPool(suite.Ctx, poolID) suite.Require().True(found, "expected pool record to exist") - poolRecord.TotalShares = sdk.ZeroInt() + poolRecord.TotalShares = sdkmath.ZeroInt() suite.Keeper.SetPool_Raw(suite.Ctx, poolRecord) suite.PanicsWithValue("invalid pool ukava:usdx: total shares must be greater than zero: invalid pool", func() { diff --git a/x/swap/legacy/v0_15/types.go b/x/swap/legacy/v0_15/types.go index 95d4d8e6ec..80661361a3 100644 --- a/x/swap/legacy/v0_15/types.go +++ b/x/swap/legacy/v0_15/types.go @@ -19,8 +19,8 @@ type GenesisState struct { // Params are governance parameters for the swap module type Params struct { - AllowedPools AllowedPools `json:"allowed_pools" yaml:"allowed_pools"` - SwapFee sdk.Dec `json:"swap_fee" yaml:"swap_fee"` + AllowedPools AllowedPools `json:"allowed_pools" yaml:"allowed_pools"` + SwapFee sdkmath.LegacyDec `json:"swap_fee" yaml:"swap_fee"` } // PoolRecords is a slice of PoolRecord diff --git a/x/swap/legacy/v0_16/migrate_test.go b/x/swap/legacy/v0_16/migrate_test.go index 6b757e2671..5bc9ff032d 100644 --- a/x/swap/legacy/v0_16/migrate_test.go +++ b/x/swap/legacy/v0_16/migrate_test.go @@ -62,14 +62,14 @@ func (s *migrateTestSuite) TestMigrate_JSON() { func (s *migrateTestSuite) TestMigrate_Params() { params := v015swap.Params{ - SwapFee: sdk.MustNewDecFromStr("0.33"), + SwapFee: sdkmath.LegacyMustNewDecFromStr("0.33"), AllowedPools: v015swap.AllowedPools{ {TokenA: "A", TokenB: "B"}, {TokenA: "C", TokenB: "D"}, }, } expectedParams := v016swap.Params{ - SwapFee: sdk.MustNewDecFromStr("0.33"), + SwapFee: sdkmath.LegacyMustNewDecFromStr("0.33"), AllowedPools: v016swap.AllowedPools{ {TokenA: "A", TokenB: "B"}, {TokenA: "C", TokenB: "D"}, diff --git a/x/swap/module.go b/x/swap/module.go index 8a9ac1fef3..2a3444a364 100644 --- a/x/swap/module.go +++ b/x/swap/module.go @@ -132,10 +132,15 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // BeginBlock module begin-block -func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) { +func (am AppModule) BeginBlock(_ sdk.Context) error { + return nil } // EndBlock module end-block -func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - return []abci.ValidatorUpdate{} +func (am AppModule) EndBlock(_ sdk.Context) ([]abci.ValidatorUpdate, error) { + return []abci.ValidatorUpdate{}, nil } + +func (AppModule) IsOnePerModuleType() {} + +func (AppModule) IsAppModule() {} diff --git a/x/swap/spec/02_state.md b/x/swap/spec/02_state.md index 15b6816580..6bd0e3f969 100644 --- a/x/swap/spec/02_state.md +++ b/x/swap/spec/02_state.md @@ -12,7 +12,7 @@ order: 2 // Params are governance parameters for the swap module type Params struct { AllowedPools AllowedPools `json:"allowed_pools" yaml:"allowed_pools"` - SwapFee sdk.Dec `json:"swap_fee" yaml:"swap_fee"` + SwapFee sdkmath.LegacyDec `json:"swap_fee" yaml:"swap_fee"` } // AllowedPool defines a tradable pool diff --git a/x/swap/spec/03_messages.md b/x/swap/spec/03_messages.md index 1b331f9527..40d6f3c70c 100644 --- a/x/swap/spec/03_messages.md +++ b/x/swap/spec/03_messages.md @@ -13,7 +13,7 @@ type MsgDeposit struct { Depositor sdk.AccAddress `json:"depositor" yaml:"depositor"` TokenA sdk.Coin `json:"token_a" yaml:"token_a"` TokenB sdk.Coin `json:"token_b" yaml:"token_b"` - Slippage sdk.Dec `json:"slippage" yaml:"slippage"` + Slippage sdkmath.LegacyDec `json:"slippage" yaml:"slippage"` Deadline int64 `json:"deadline" yaml:"deadline"` } ``` @@ -42,7 +42,7 @@ type MsgSwapExactForTokens struct { Requester sdk.AccAddress `json:"requester" yaml:"requester"` ExactTokenA sdk.Coin `json:"exact_token_a" yaml:"exact_token_a"` TokenB sdk.Coin `json:"token_b" yaml:"token_b"` - Slippage sdk.Dec `json:"slippage" yaml:"slippage"` + Slippage sdkmath.LegacyDec `json:"slippage" yaml:"slippage"` Deadline int64 `json:"deadline" yaml:"deadline"` } ``` @@ -57,7 +57,7 @@ type MsgSwapForExactTokens struct { Requester sdk.AccAddress `json:"requester" yaml:"requester"` TokenA sdk.Coin `json:"token_a" yaml:"token_a"` ExactTokenB sdk.Coin `json:"exact_token_b" yaml:"exact_token_b"` - Slippage sdk.Dec `json:"slippage" yaml:"slippage"` + Slippage sdkmath.LegacyDec `json:"slippage" yaml:"slippage"` Deadline int64 `json:"deadline" yaml:"deadline"` } ``` diff --git a/x/swap/spec/05_params.md b/x/swap/spec/05_params.md index 321187da23..7ca915665e 100644 --- a/x/swap/spec/05_params.md +++ b/x/swap/spec/05_params.md @@ -9,7 +9,7 @@ Example parameters for the swap module: | Key | Type | Example | Description | | ------------ | ------------------- | ------------- | --------------------------------------- | | AllowedPools | array (AllowedPool) | [{see below}] | Array of tradable pools supported | -| SwapFee | sdk.Dec | 0.03 | Global trading fee in percentage format | +| SwapFee | sdkmath.LegacyDec | 0.03 | Global trading fee in percentage format | Example parameters for `AllowedPool`: diff --git a/x/swap/testutil/suite.go b/x/swap/testutil/suite.go index 35e5429b01..cc15399be6 100644 --- a/x/swap/testutil/suite.go +++ b/x/swap/testutil/suite.go @@ -2,6 +2,7 @@ package testutil import ( "fmt" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" "reflect" "time" @@ -11,7 +12,6 @@ import ( sdkmath "cosmossdk.io/math" abci "github.com/cometbft/cometbft/abci/types" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" tmtime "github.com/cometbft/cometbft/types/time" sdk "github.com/cosmos/cosmos-sdk/types" authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" @@ -22,7 +22,7 @@ import ( "github.com/stretchr/testify/suite" ) -var defaultSwapFee = sdk.MustNewDecFromStr("0.003") +var defaultSwapFee = sdkmath.LegacyMustNewDecFromStr("0.003") // Suite implements a test suite for the swap module integration tests type Suite struct { @@ -37,7 +37,7 @@ type Suite struct { // SetupTest instantiates a new app, keepers, and sets suite state func (suite *Suite) SetupTest() { tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: tmtime.Now()}) suite.Ctx = ctx suite.App = tApp @@ -68,7 +68,7 @@ func (suite *Suite) RemoveCoinsFromModule(amount sdk.Coins) { } // CreateAccount creates a new account from the provided balance -func (suite *Suite) CreateAccount(initialBalance sdk.Coins) authtypes.AccountI { +func (suite *Suite) CreateAccount(initialBalance sdk.Coins) sdk.AccountI { _, addrs := app.GeneratePrivKeyAddressPairs(1) ak := suite.App.GetAccountKeeper() @@ -82,7 +82,7 @@ func (suite *Suite) CreateAccount(initialBalance sdk.Coins) authtypes.AccountI { } // NewAccountFromAddr creates a new account from the provided address with the provided balance -func (suite *Suite) NewAccountFromAddr(addr sdk.AccAddress, balance sdk.Coins) authtypes.AccountI { +func (suite *Suite) NewAccountFromAddr(addr sdk.AccAddress, balance sdk.Coins) sdk.AccountI { ak := suite.App.GetAccountKeeper() acc := ak.NewAccountWithAddress(suite.Ctx, addr) @@ -95,7 +95,7 @@ func (suite *Suite) NewAccountFromAddr(addr sdk.AccAddress, balance sdk.Coins) a } // CreateVestingAccount creates a new vesting account from the provided balance and vesting balance -func (suite *Suite) CreateVestingAccount(initialBalance sdk.Coins, vestingBalance sdk.Coins) authtypes.AccountI { +func (suite *Suite) CreateVestingAccount(initialBalance sdk.Coins, vestingBalance sdk.Coins) sdk.AccountI { acc := suite.CreateAccount(initialBalance) bacc := acc.(*authtypes.BaseAccount) @@ -105,7 +105,9 @@ func (suite *Suite) CreateVestingAccount(initialBalance sdk.Coins, vestingBalanc Amount: vestingBalance, }, } - vacc := vestingtypes.NewPeriodicVestingAccount(bacc, initialBalance, time.Now().Unix(), periods) // TODO is initialBalance correct for originalVesting? + //vacc, err := vestingtypes.NewPeriodicVestingAccount(bacc, initialBalance, time.Now().Unix(), periods) // TODO is initialBalance correct for originalVesting? + vacc, _ := vestingtypes.NewPeriodicVestingAccount(bacc, initialBalance, time.Now().Unix(), periods) // TODO is initialBalance correct for originalVesting? + //suite.Require().NoError(err) return vacc } @@ -117,7 +119,7 @@ func (suite *Suite) CreatePool(reserves sdk.Coins) error { suite.Require().NoError(pool.Validate()) suite.Keeper.SetParams(suite.Ctx, types.NewParams(types.AllowedPools{pool}, defaultSwapFee)) - return suite.Keeper.Deposit(suite.Ctx, depositor.GetAddress(), reserves[0], reserves[1], sdk.MustNewDecFromStr("1")) + return suite.Keeper.Deposit(suite.Ctx, depositor.GetAddress(), reserves[0], reserves[1], sdkmath.LegacyMustNewDecFromStr("1")) } // AccountBalanceEqual asserts that the coins match the account balance @@ -171,7 +173,7 @@ func (suite *Suite) PoolReservesEqual(poolID string, reserves sdk.Coins) { } // PoolShareValueEqual asserts that the depositor shares are in state and the value matches the expected coins -func (suite *Suite) PoolShareValueEqual(depositor authtypes.AccountI, pool types.AllowedPool, coins sdk.Coins) { +func (suite *Suite) PoolShareValueEqual(depositor sdk.AccountI, pool types.AllowedPool, coins sdk.Coins) { poolRecord, ok := suite.Keeper.GetPool(suite.Ctx, pool.Name()) suite.Require().True(ok, fmt.Sprintf("expected pool %s to exist", pool.Name())) shares, ok := suite.Keeper.GetDepositorShares(suite.Ctx, depositor.GetAddress(), poolRecord.PoolID) diff --git a/x/swap/types/base_pool.go b/x/swap/types/base_pool.go index fcc2e6b600..ccae81f26b 100644 --- a/x/swap/types/base_pool.go +++ b/x/swap/types/base_pool.go @@ -6,10 +6,9 @@ import ( errorsmod "cosmossdk.io/errors" sdkmath "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" ) -var zero = sdk.ZeroInt() +var zero = sdkmath.ZeroInt() // calculateInitialShares calculates initial shares as sqrt(A*B), the geometric mean of A and B func calculateInitialShares(reservesA, reservesB sdkmath.Int) sdkmath.Int { @@ -219,11 +218,11 @@ func (p *BasePool) RemoveLiquidity(shares sdkmath.Int) (sdkmath.Int, sdkmath.Int // SwapExactAForB trades an exact value of a for b. Returns the positive amount b // that is removed from the pool and the portion of a that is used for paying the fee. -func (p *BasePool) SwapExactAForB(a sdkmath.Int, fee sdk.Dec) (sdkmath.Int, sdkmath.Int) { +func (p *BasePool) SwapExactAForB(a sdkmath.Int, fee sdkmath.LegacyDec) (sdkmath.Int, sdkmath.Int) { b, feeValue := p.calculateOutputForExactInput(a, p.reservesA, p.reservesB, fee) p.assertInvariantAndUpdateReserves( - p.reservesA.Add(a), feeValue, p.reservesB.Sub(b), sdk.ZeroInt(), + p.reservesA.Add(a), feeValue, p.reservesB.Sub(b), sdkmath.ZeroInt(), ) return b, feeValue @@ -231,11 +230,11 @@ func (p *BasePool) SwapExactAForB(a sdkmath.Int, fee sdk.Dec) (sdkmath.Int, sdkm // SwapExactBForA trades an exact value of b for a. Returns the positive amount a // that is removed from the pool and the portion of b that is used for paying the fee. -func (p *BasePool) SwapExactBForA(b sdkmath.Int, fee sdk.Dec) (sdkmath.Int, sdkmath.Int) { +func (p *BasePool) SwapExactBForA(b sdkmath.Int, fee sdkmath.LegacyDec) (sdkmath.Int, sdkmath.Int) { a, feeValue := p.calculateOutputForExactInput(b, p.reservesB, p.reservesA, fee) p.assertInvariantAndUpdateReserves( - p.reservesA.Sub(a), sdk.ZeroInt(), p.reservesB.Add(b), feeValue, + p.reservesA.Sub(a), sdkmath.ZeroInt(), p.reservesB.Add(b), feeValue, ) return a, feeValue @@ -248,11 +247,11 @@ func (p *BasePool) SwapExactBForA(b sdkmath.Int, fee sdk.Dec) (sdkmath.Int, sdkm // by splitting a trade into multiple trades. // // The swap output is truncated to ensure the pool invariant is always greater than or equal to the previous invariant. -func (p *BasePool) calculateOutputForExactInput(in, inReserves, outReserves sdkmath.Int, fee sdk.Dec) (sdkmath.Int, sdkmath.Int) { +func (p *BasePool) calculateOutputForExactInput(in, inReserves, outReserves sdkmath.Int, fee sdkmath.LegacyDec) (sdkmath.Int, sdkmath.Int) { p.assertSwapInputIsValid(in) p.assertFeeIsValid(fee) - inAfterFee := sdk.NewDecFromInt(in).Mul(sdk.OneDec().Sub(fee)).TruncateInt() + inAfterFee := sdkmath.LegacyNewDecFromInt(in).Mul(sdkmath.LegacyOneDec().Sub(fee)).TruncateInt() var result big.Int result.Mul(outReserves.BigInt(), inAfterFee.BigInt()) @@ -266,11 +265,11 @@ func (p *BasePool) calculateOutputForExactInput(in, inReserves, outReserves sdkm // SwapAForExactB trades a for an exact b. Returns the positive amount a // that is added to the pool, and the portion of a that is used to pay the fee. -func (p *BasePool) SwapAForExactB(b sdkmath.Int, fee sdk.Dec) (sdkmath.Int, sdkmath.Int) { +func (p *BasePool) SwapAForExactB(b sdkmath.Int, fee sdkmath.LegacyDec) (sdkmath.Int, sdkmath.Int) { a, feeValue := p.calculateInputForExactOutput(b, p.reservesB, p.reservesA, fee) p.assertInvariantAndUpdateReserves( - p.reservesA.Add(a), feeValue, p.reservesB.Sub(b), sdk.ZeroInt(), + p.reservesA.Add(a), feeValue, p.reservesB.Sub(b), sdkmath.ZeroInt(), ) return a, feeValue @@ -278,11 +277,11 @@ func (p *BasePool) SwapAForExactB(b sdkmath.Int, fee sdk.Dec) (sdkmath.Int, sdkm // SwapBForExactA trades b for an exact a. Returns the positive amount b // that is added to the pool, and the portion of b that is used to pay the fee. -func (p *BasePool) SwapBForExactA(a sdkmath.Int, fee sdk.Dec) (sdkmath.Int, sdkmath.Int) { +func (p *BasePool) SwapBForExactA(a sdkmath.Int, fee sdkmath.LegacyDec) (sdkmath.Int, sdkmath.Int) { b, feeValue := p.calculateInputForExactOutput(a, p.reservesA, p.reservesB, fee) p.assertInvariantAndUpdateReserves( - p.reservesA.Sub(a), sdk.ZeroInt(), p.reservesB.Add(b), feeValue, + p.reservesA.Sub(a), sdkmath.ZeroInt(), p.reservesB.Add(b), feeValue, ) return b, feeValue @@ -295,7 +294,7 @@ func (p *BasePool) SwapBForExactA(a sdkmath.Int, fee sdk.Dec) (sdkmath.Int, sdkm // by splitting a trade into multiple trades. // // The swap input is ceiled to ensure the pool invariant is always greater than or equal to the previous invariant. -func (p *BasePool) calculateInputForExactOutput(out, outReserves, inReserves sdkmath.Int, fee sdk.Dec) (sdkmath.Int, sdkmath.Int) { +func (p *BasePool) calculateInputForExactOutput(out, outReserves, inReserves sdkmath.Int, fee sdkmath.LegacyDec) (sdkmath.Int, sdkmath.Int) { p.assertSwapOutputIsValid(out, outReserves) p.assertFeeIsValid(fee) @@ -308,10 +307,10 @@ func (p *BasePool) calculateInputForExactOutput(out, outReserves, inReserves sdk inWithoutFee := sdkmath.NewIntFromBigInt(&result) if remainder.Sign() != 0 { - inWithoutFee = inWithoutFee.Add(sdk.OneInt()) + inWithoutFee = inWithoutFee.Add(sdkmath.OneInt()) } - in := sdk.NewDecFromInt(inWithoutFee).Quo(sdk.OneDec().Sub(fee)).Ceil().TruncateInt() + in := sdkmath.LegacyNewDecFromInt(inWithoutFee).Quo(sdkmath.LegacyOneDec().Sub(fee)).Ceil().TruncateInt() feeValue := in.Sub(inWithoutFee) return in, feeValue @@ -371,8 +370,8 @@ func (p *BasePool) assertSwapOutputIsValid(output sdkmath.Int, reserves sdkmath. } // assertFeeIsValid checks if the provided fee is less -func (p *BasePool) assertFeeIsValid(fee sdk.Dec) { - if fee.IsNegative() || fee.GTE(sdk.OneDec()) { +func (p *BasePool) assertFeeIsValid(fee sdkmath.LegacyDec) { + if fee.IsNegative() || fee.GTE(sdkmath.LegacyOneDec()) { panic("invalid value: fee must be between 0 and 1") } } diff --git a/x/swap/types/base_pool_test.go b/x/swap/types/base_pool_test.go index a6fa2ee2bc..eb2739d4dd 100644 --- a/x/swap/types/base_pool_test.go +++ b/x/swap/types/base_pool_test.go @@ -8,7 +8,6 @@ import ( types "github.com/kava-labs/kava/x/swap/types" sdkmath "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -27,9 +26,9 @@ func s(str string) sdkmath.Int { return num } -// d creates a new sdk.Dec from a string -func d(str string) sdk.Dec { - return sdk.MustNewDecFromStr(str) +// d creates a new sdkmath.LegacyDec from a string +func d(str string) sdkmath.LegacyDec { + return sdkmath.LegacyMustNewDecFromStr(str) } // exp takes a sdkmath.Int and computes the power @@ -419,7 +418,7 @@ func TestBasePool_Swap_ExactInput(t *testing.T) { reservesA sdkmath.Int reservesB sdkmath.Int exactInput sdkmath.Int - fee sdk.Dec + fee sdkmath.LegacyDec expectedOutput sdkmath.Int expectedFee sdkmath.Int }{ @@ -477,7 +476,7 @@ func TestBasePool_Swap_ExactOutput(t *testing.T) { reservesA sdkmath.Int reservesB sdkmath.Int exactOutput sdkmath.Int - fee sdk.Dec + fee sdkmath.LegacyDec expectedInput sdkmath.Int expectedFee sdkmath.Int }{ @@ -531,7 +530,7 @@ func TestBasePool_Swap_ExactOutput(t *testing.T) { func TestBasePool_Panics_Swap_ExactInput(t *testing.T) { testCases := []struct { swap sdkmath.Int - fee sdk.Dec + fee sdkmath.LegacyDec }{ {i(0), d("0.003")}, {i(-1), d("0.003")}, @@ -561,7 +560,7 @@ func TestBasePool_Panics_Swap_ExactInput(t *testing.T) { func TestBasePool_Panics_Swap_ExactOutput(t *testing.T) { testCases := []struct { swap sdkmath.Int - fee sdk.Dec + fee sdkmath.LegacyDec }{ {i(0), d("0.003")}, {i(-1), d("0.003")}, diff --git a/x/swap/types/codec.go b/x/swap/types/codec.go index 2d1d5c12a5..6f0ee30026 100644 --- a/x/swap/types/codec.go +++ b/x/swap/types/codec.go @@ -6,7 +6,6 @@ import ( cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" - authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec" ) // RegisterLegacyAminoCodec registers all the necessary types and interfaces for the @@ -43,5 +42,5 @@ func init() { // Register all Amino interfaces and concrete types on the authz Amino codec so that this can later be // used to properly serialize MsgGrant and MsgExec instances - RegisterLegacyAminoCodec(authzcodec.Amino) + RegisterLegacyAminoCodec(codec.NewLegacyAmino()) } diff --git a/x/swap/types/denominated_pool.go b/x/swap/types/denominated_pool.go index c816ce1395..0b3a922251 100644 --- a/x/swap/types/denominated_pool.go +++ b/x/swap/types/denominated_pool.go @@ -105,7 +105,7 @@ func (p *DenominatedPool) ShareValue(shares sdkmath.Int) sdk.Coins { // SwapWithExactInput trades an exact input coin for the other. Returns the positive other coin amount // that is removed from the pool and the portion of the input coin that is used for the fee. // It panics if the input denom does not match the pool reserves. -func (p *DenominatedPool) SwapWithExactInput(swapInput sdk.Coin, fee sdk.Dec) (sdk.Coin, sdk.Coin) { +func (p *DenominatedPool) SwapWithExactInput(swapInput sdk.Coin, fee sdkmath.LegacyDec) (sdk.Coin, sdk.Coin) { var ( swapOutput sdkmath.Int feePaid sdkmath.Int @@ -126,7 +126,7 @@ func (p *DenominatedPool) SwapWithExactInput(swapInput sdk.Coin, fee sdk.Dec) (s // SwapWithExactOutput trades a coin for an exact output coin b. Returns the positive input coin // that is added to the pool, and the portion of that input that is used to pay the fee. // Panics if the output denom does not match the pool reserves. -func (p *DenominatedPool) SwapWithExactOutput(swapOutput sdk.Coin, fee sdk.Dec) (sdk.Coin, sdk.Coin) { +func (p *DenominatedPool) SwapWithExactOutput(swapOutput sdk.Coin, fee sdkmath.LegacyDec) (sdk.Coin, sdk.Coin) { var ( swapInput sdkmath.Int feePaid sdkmath.Int diff --git a/x/swap/types/expected_keepers.go b/x/swap/types/expected_keepers.go index 258b9aea25..5b9271cb0d 100644 --- a/x/swap/types/expected_keepers.go +++ b/x/swap/types/expected_keepers.go @@ -1,32 +1,32 @@ package types import ( + "context" sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/auth/types" ) // AccountKeeper defines the expected account keeper (noalias) type AccountKeeper interface { - GetAccount(ctx sdk.Context, addr sdk.AccAddress) types.AccountI - SetModuleAccount(sdk.Context, types.ModuleAccountI) + GetAccount(ctx context.Context, addr sdk.AccAddress) sdk.AccountI + SetModuleAccount(context.Context, sdk.ModuleAccountI) // moved in from supply GetModuleAddress(name string) sdk.AccAddress - GetModuleAccount(ctx sdk.Context, name string) types.ModuleAccountI + GetModuleAccount(ctx context.Context, name string) sdk.ModuleAccountI } // BankKeeper defines the expected interface needed to retrieve account balances. type BankKeeper interface { - GetAllBalances(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins + GetAllBalances(ctx context.Context, addr sdk.AccAddress) sdk.Coins - SendCoinsFromModuleToModule(ctx sdk.Context, senderModule, recipientModule string, amt sdk.Coins) error - SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error - SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error + SendCoinsFromModuleToModule(ctx context.Context, senderModule, recipientModule string, amt sdk.Coins) error + SendCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error + SendCoinsFromAccountToModule(ctx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error } // SwapHooks are event hooks called when a user's deposit to a swap pool changes. type SwapHooks interface { - AfterPoolDepositCreated(ctx sdk.Context, poolID string, depositor sdk.AccAddress, sharedOwned sdkmath.Int) - BeforePoolDepositModified(ctx sdk.Context, poolID string, depositor sdk.AccAddress, sharedOwned sdkmath.Int) + AfterPoolDepositCreated(ctx context.Context, poolID string, depositor sdk.AccAddress, sharedOwned sdkmath.Int) + BeforePoolDepositModified(ctx context.Context, poolID string, depositor sdk.AccAddress, sharedOwned sdkmath.Int) } diff --git a/x/swap/types/genesis.go b/x/swap/types/genesis.go index 6738e950e5..cd17be7d3e 100644 --- a/x/swap/types/genesis.go +++ b/x/swap/types/genesis.go @@ -4,7 +4,6 @@ import ( "fmt" sdkmath "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" ) type poolShares struct { @@ -44,7 +43,7 @@ func (gs GenesisState) Validate() error { for _, pr := range gs.PoolRecords { totalShares[pr.PoolID] = poolShares{ totalShares: pr.TotalShares, - totalSharesOwned: sdk.ZeroInt(), + totalSharesOwned: sdkmath.ZeroInt(), } } for _, sr := range gs.ShareRecords { @@ -53,7 +52,7 @@ func (gs GenesisState) Validate() error { totalShares[sr.PoolID] = shares } else { totalShares[sr.PoolID] = poolShares{ - totalShares: sdk.ZeroInt(), + totalShares: sdkmath.ZeroInt(), totalSharesOwned: sr.SharesOwned, } } diff --git a/x/swap/types/genesis_test.go b/x/swap/types/genesis_test.go index 770d228f1c..f659435da9 100644 --- a/x/swap/types/genesis_test.go +++ b/x/swap/types/genesis_test.go @@ -1,6 +1,7 @@ package types_test import ( + sdkmath "cosmossdk.io/math" "encoding/json" "testing" @@ -24,24 +25,24 @@ func TestGenesis_Default(t *testing.T) { func TestGenesis_Validate_SwapFee(t *testing.T) { type args struct { name string - swapFee sdk.Dec + swapFee sdkmath.LegacyDec expectErr bool } // More comprehensive swap fee tests are in prams_test.go testCases := []args{ { "normal", - sdk.MustNewDecFromStr("0.25"), + sdkmath.LegacyMustNewDecFromStr("0.25"), false, }, { "negative", - sdk.MustNewDecFromStr("-0.5"), + sdkmath.LegacyMustNewDecFromStr("-0.5"), true, }, { "greater than 1.0", - sdk.MustNewDecFromStr("1.001"), + sdkmath.LegacyMustNewDecFromStr("1.001"), true, }, } @@ -157,7 +158,7 @@ func TestGenesis_JSONEncoding(t *testing.T) { require.NoError(t, err) assert.Equal(t, 2, len(state.Params.AllowedPools)) - assert.Equal(t, sdk.MustNewDecFromStr("0.003"), state.Params.SwapFee) + assert.Equal(t, sdkmath.LegacyMustNewDecFromStr("0.003"), state.Params.SwapFee) assert.Equal(t, 2, len(state.PoolRecords)) assert.Equal(t, 2, len(state.ShareRecords)) } @@ -207,7 +208,7 @@ share_records: types.NewAllowedPool("ukava", "usdx"), types.NewAllowedPool("hard", "busd"), ), - sdk.MustNewDecFromStr("0.003"), + sdkmath.LegacyMustNewDecFromStr("0.003"), ), types.PoolRecords{ types.NewPoolRecord(sdk.NewCoins(ukava(1e6), usdx(5e6)), i(3e6)), diff --git a/x/swap/types/mocks/swap_hooks.go b/x/swap/types/mocks/swap_hooks.go index 674f17cb40..d77f17ade3 100644 --- a/x/swap/types/mocks/swap_hooks.go +++ b/x/swap/types/mocks/swap_hooks.go @@ -3,6 +3,7 @@ package mocks import ( + "context" math "cosmossdk.io/math" mock "github.com/stretchr/testify/mock" @@ -15,11 +16,11 @@ type SwapHooks struct { } // AfterPoolDepositCreated provides a mock function with given fields: ctx, poolID, depositor, sharedOwned -func (_m *SwapHooks) AfterPoolDepositCreated(ctx types.Context, poolID string, depositor types.AccAddress, sharedOwned math.Int) { +func (_m *SwapHooks) AfterPoolDepositCreated(ctx context.Context, poolID string, depositor types.AccAddress, sharedOwned math.Int) { _m.Called(ctx, poolID, depositor, sharedOwned) } // BeforePoolDepositModified provides a mock function with given fields: ctx, poolID, depositor, sharedOwned -func (_m *SwapHooks) BeforePoolDepositModified(ctx types.Context, poolID string, depositor types.AccAddress, sharedOwned math.Int) { +func (_m *SwapHooks) BeforePoolDepositModified(ctx context.Context, poolID string, depositor types.AccAddress, sharedOwned math.Int) { _m.Called(ctx, poolID, depositor, sharedOwned) } diff --git a/x/swap/types/msg.go b/x/swap/types/msg.go index b415a01c66..a07afa0c7c 100644 --- a/x/swap/types/msg.go +++ b/x/swap/types/msg.go @@ -38,7 +38,7 @@ type MsgWithDeadline interface { } // NewMsgDeposit returns a new MsgDeposit -func NewMsgDeposit(depositor string, tokenA sdk.Coin, tokenB sdk.Coin, slippage sdk.Dec, deadline int64) *MsgDeposit { +func NewMsgDeposit(depositor string, tokenA sdk.Coin, tokenB sdk.Coin, slippage sdkmath.LegacyDec, deadline int64) *MsgDeposit { return &MsgDeposit{ Depositor: depositor, TokenA: tokenA, @@ -190,7 +190,7 @@ func (msg MsgWithdraw) DeadlineExceeded(blockTime time.Time) bool { } // NewMsgSwapExactForTokens returns a new MsgSwapExactForTokens -func NewMsgSwapExactForTokens(requester string, exactTokenA sdk.Coin, tokenB sdk.Coin, slippage sdk.Dec, deadline int64) *MsgSwapExactForTokens { +func NewMsgSwapExactForTokens(requester string, exactTokenA sdk.Coin, tokenB sdk.Coin, slippage sdkmath.LegacyDec, deadline int64) *MsgSwapExactForTokens { return &MsgSwapExactForTokens{ Requester: requester, ExactTokenA: exactTokenA, @@ -266,7 +266,7 @@ func (msg MsgSwapExactForTokens) DeadlineExceeded(blockTime time.Time) bool { } // NewMsgSwapForExactTokens returns a new MsgSwapForExactTokens -func NewMsgSwapForExactTokens(requester string, tokenA sdk.Coin, exactTokenB sdk.Coin, slippage sdk.Dec, deadline int64) *MsgSwapForExactTokens { +func NewMsgSwapForExactTokens(requester string, tokenA sdk.Coin, exactTokenB sdk.Coin, slippage sdkmath.LegacyDec, deadline int64) *MsgSwapForExactTokens { return &MsgSwapForExactTokens{ Requester: requester, TokenA: tokenA, diff --git a/x/swap/types/msg_test.go b/x/swap/types/msg_test.go index ca155ee406..53fc26d67d 100644 --- a/x/swap/types/msg_test.go +++ b/x/swap/types/msg_test.go @@ -25,7 +25,7 @@ func TestMsgDeposit_Signing(t *testing.T) { addr, err := sdk.AccAddressFromBech32("kava1gepm4nwzz40gtpur93alv9f9wm5ht4l0hzzw9d") require.NoError(t, err) - msg := types.NewMsgDeposit(addr.String(), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.MustNewDecFromStr("0.01"), 1623606299) + msg := types.NewMsgDeposit(addr.String(), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdkmath.LegacyMustNewDecFromStr("0.01"), 1623606299) assert.Equal(t, []sdk.AccAddress{addr}, msg.GetSigners()) assert.Equal(t, signBytes, msg.GetSignBytes()) } @@ -38,7 +38,7 @@ func TestMsgDeposit_Validation(t *testing.T) { addr.String(), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), - sdk.MustNewDecFromStr("0.01"), + sdkmath.LegacyMustNewDecFromStr("0.01"), 1623606299, ) require.NoError(t, validMsg.ValidateBasic()) @@ -48,7 +48,7 @@ func TestMsgDeposit_Validation(t *testing.T) { depositor string tokenA sdk.Coin tokenB sdk.Coin - slippage sdk.Dec + slippage sdkmath.LegacyDec deadline int64 expectedErr string }{ @@ -138,7 +138,7 @@ func TestMsgDeposit_Validation(t *testing.T) { depositor: validMsg.Depositor, tokenA: validMsg.TokenA, tokenB: validMsg.TokenB, - slippage: sdk.MustNewDecFromStr("-0.01"), + slippage: sdkmath.LegacyMustNewDecFromStr("-0.01"), deadline: validMsg.Deadline, expectedErr: "slippage can not be negative: invalid slippage", }, @@ -147,7 +147,7 @@ func TestMsgDeposit_Validation(t *testing.T) { depositor: validMsg.Depositor, tokenA: validMsg.TokenA, tokenB: validMsg.TokenB, - slippage: sdk.Dec{}, + slippage: sdkmath.LegacyDec{}, deadline: validMsg.Deadline, expectedErr: "slippage must be set: invalid slippage", }, @@ -192,7 +192,7 @@ func TestMsgDeposit_Deadline(t *testing.T) { sdk.AccAddress("test1").String(), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), - sdk.MustNewDecFromStr("0.01"), + sdkmath.LegacyMustNewDecFromStr("0.01"), tc.deadline, ) require.NoError(t, msg.ValidateBasic()) @@ -301,7 +301,7 @@ func TestMsgWithdraw_Validation(t *testing.T) { { name: "zero shares", from: validMsg.From, - shares: sdk.ZeroInt(), + shares: sdkmath.ZeroInt(), minTokenA: validMsg.MinTokenA, minTokenB: validMsg.MinTokenB, deadline: validMsg.Deadline, @@ -406,7 +406,7 @@ func TestMsgSwapExactForTokens_Signing(t *testing.T) { addr, err := sdk.AccAddressFromBech32("kava1gepm4nwzz40gtpur93alv9f9wm5ht4l0hzzw9d") require.NoError(t, err) - msg := types.NewMsgSwapExactForTokens(addr.String(), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.MustNewDecFromStr("0.01"), 1623606299) + msg := types.NewMsgSwapExactForTokens(addr.String(), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdkmath.LegacyMustNewDecFromStr("0.01"), 1623606299) assert.Equal(t, []sdk.AccAddress{addr}, msg.GetSigners()) assert.Equal(t, signBytes, msg.GetSignBytes()) } @@ -416,7 +416,7 @@ func TestMsgSwapExactForTokens_Validation(t *testing.T) { sdk.AccAddress("test1").String(), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), - sdk.MustNewDecFromStr("0.01"), + sdkmath.LegacyMustNewDecFromStr("0.01"), 1623606299, ) require.NoError(t, validMsg.ValidateBasic()) @@ -426,7 +426,7 @@ func TestMsgSwapExactForTokens_Validation(t *testing.T) { requester string exactTokenA sdk.Coin tokenB sdk.Coin - slippage sdk.Dec + slippage sdkmath.LegacyDec deadline int64 expectedErr string }{ @@ -516,7 +516,7 @@ func TestMsgSwapExactForTokens_Validation(t *testing.T) { requester: validMsg.Requester, exactTokenA: validMsg.ExactTokenA, tokenB: validMsg.TokenB, - slippage: sdk.MustNewDecFromStr("-0.01"), + slippage: sdkmath.LegacyMustNewDecFromStr("-0.01"), deadline: validMsg.Deadline, expectedErr: "slippage can not be negative: invalid slippage", }, @@ -525,7 +525,7 @@ func TestMsgSwapExactForTokens_Validation(t *testing.T) { requester: validMsg.Requester, exactTokenA: validMsg.ExactTokenA, tokenB: validMsg.TokenB, - slippage: sdk.Dec{}, + slippage: sdkmath.LegacyDec{}, deadline: validMsg.Deadline, expectedErr: "slippage must be set: invalid slippage", }, @@ -570,7 +570,7 @@ func TestMsgSwapExactForTokens_Deadline(t *testing.T) { sdk.AccAddress("test1").String(), sdk.NewCoin("ukava", sdkmath.NewInt(1000000)), sdk.NewCoin("usdx", sdkmath.NewInt(2000000)), - sdk.MustNewDecFromStr("0.01"), + sdkmath.LegacyMustNewDecFromStr("0.01"), tc.deadline, ) require.NoError(t, msg.ValidateBasic()) @@ -592,7 +592,7 @@ func TestMsgSwapForExactTokens_Signing(t *testing.T) { addr, err := sdk.AccAddressFromBech32("kava1gepm4nwzz40gtpur93alv9f9wm5ht4l0hzzw9d") require.NoError(t, err) - msg := types.NewMsgSwapForExactTokens(addr.String(), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdk.MustNewDecFromStr("0.01"), 1623606299) + msg := types.NewMsgSwapForExactTokens(addr.String(), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), sdkmath.LegacyMustNewDecFromStr("0.01"), 1623606299) assert.Equal(t, []sdk.AccAddress{addr}, msg.GetSigners()) assert.Equal(t, signBytes, msg.GetSignBytes()) } @@ -602,7 +602,7 @@ func TestMsgSwapForExactTokens_Validation(t *testing.T) { sdk.AccAddress("test1").String(), sdk.NewCoin("ukava", sdkmath.NewInt(1e6)), sdk.NewCoin("usdx", sdkmath.NewInt(5e6)), - sdk.MustNewDecFromStr("0.01"), + sdkmath.LegacyMustNewDecFromStr("0.01"), 1623606299, ) require.NoError(t, validMsg.ValidateBasic()) @@ -612,7 +612,7 @@ func TestMsgSwapForExactTokens_Validation(t *testing.T) { requester string tokenA sdk.Coin exactTokenB sdk.Coin - slippage sdk.Dec + slippage sdkmath.LegacyDec deadline int64 expectedErr string }{ @@ -702,7 +702,7 @@ func TestMsgSwapForExactTokens_Validation(t *testing.T) { requester: validMsg.Requester, tokenA: validMsg.TokenA, exactTokenB: validMsg.ExactTokenB, - slippage: sdk.MustNewDecFromStr("-0.01"), + slippage: sdkmath.LegacyMustNewDecFromStr("-0.01"), deadline: validMsg.Deadline, expectedErr: "slippage can not be negative: invalid slippage", }, @@ -711,7 +711,7 @@ func TestMsgSwapForExactTokens_Validation(t *testing.T) { requester: validMsg.Requester, tokenA: validMsg.TokenA, exactTokenB: validMsg.ExactTokenB, - slippage: sdk.Dec{}, + slippage: sdkmath.LegacyDec{}, deadline: validMsg.Deadline, expectedErr: "slippage must be set: invalid slippage", }, @@ -756,7 +756,7 @@ func TestMsgSwapForExactTokens_Deadline(t *testing.T) { sdk.AccAddress("test1").String(), sdk.NewCoin("ukava", sdkmath.NewInt(1000000)), sdk.NewCoin("usdx", sdkmath.NewInt(2000000)), - sdk.MustNewDecFromStr("0.01"), + sdkmath.LegacyMustNewDecFromStr("0.01"), tc.deadline, ) require.NoError(t, msg.ValidateBasic()) diff --git a/x/swap/types/params.go b/x/swap/types/params.go index 6cd67964df..30162542c1 100644 --- a/x/swap/types/params.go +++ b/x/swap/types/params.go @@ -1,6 +1,7 @@ package types import ( + sdkmath "cosmossdk.io/math" "fmt" "strings" @@ -13,12 +14,12 @@ var ( KeyAllowedPools = []byte("AllowedPools") KeySwapFee = []byte("SwapFee") DefaultAllowedPools = AllowedPools{} - DefaultSwapFee = sdk.ZeroDec() - MaxSwapFee = sdk.OneDec() + DefaultSwapFee = sdkmath.LegacyZeroDec() + MaxSwapFee = sdkmath.LegacyOneDec() ) // NewParams returns a new params object -func NewParams(pairs AllowedPools, swapFee sdk.Dec) Params { +func NewParams(pairs AllowedPools, swapFee sdkmath.LegacyDec) Params { return Params{ AllowedPools: pairs, SwapFee: swapFee, @@ -73,7 +74,7 @@ func validateAllowedPoolsParams(i interface{}) error { } func validateSwapFee(i interface{}) error { - swapFee, ok := i.(sdk.Dec) + swapFee, ok := i.(sdkmath.LegacyDec) if !ok { return fmt.Errorf("invalid parameter type: %T", i) } diff --git a/x/swap/types/params_test.go b/x/swap/types/params_test.go index 505981666a..8413f6ebb9 100644 --- a/x/swap/types/params_test.go +++ b/x/swap/types/params_test.go @@ -2,6 +2,7 @@ package types_test import ( "bytes" + sdkmath "cosmossdk.io/math" "encoding/json" "fmt" "reflect" @@ -10,7 +11,6 @@ import ( "github.com/kava-labs/kava/x/swap/types" - sdk "github.com/cosmos/cosmos-sdk/types" paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -25,7 +25,7 @@ func TestParams_UnmarshalJSON(t *testing.T) { poolData, err := json.Marshal(pools) require.NoError(t, err) - fee, err := sdk.NewDecFromStr("0.5") + fee, err := sdkmath.LegacyNewDecFromStr("0.5") require.NoError(t, err) feeData, err := json.Marshal(fee) require.NoError(t, err) @@ -48,7 +48,7 @@ func TestParams_MarshalYAML(t *testing.T) { types.NewAllowedPool("hard", "ukava"), types.NewAllowedPool("hard", "usdx"), ) - fee, err := sdk.NewDecFromStr("0.5") + fee, err := sdkmath.LegacyNewDecFromStr("0.5") require.NoError(t, err) p := types.Params{ @@ -78,7 +78,7 @@ func TestParams_Default(t *testing.T) { assert.Equal(t, types.DefaultSwapFee, defaultParams.SwapFee) assert.Equal(t, 0, len(defaultParams.AllowedPools)) - assert.Equal(t, sdk.ZeroDec(), defaultParams.SwapFee) + assert.Equal(t, sdkmath.LegacyZeroDec(), defaultParams.SwapFee) } func TestParams_ParamSetPairs_AllowedPools(t *testing.T) { @@ -115,7 +115,7 @@ func TestParams_ParamSetPairs_SwapFee(t *testing.T) { } require.NotNil(t, paramSetPair) - swapFee, ok := paramSetPair.Value.(*sdk.Dec) + swapFee, ok := paramSetPair.Value.(*sdkmath.LegacyDec) require.True(t, ok) assert.Equal(t, swapFee, &defaultParams.SwapFee) @@ -142,7 +142,7 @@ func TestParams_Validation(t *testing.T) { name: "nil swap fee", key: types.KeySwapFee, testFn: func(params *types.Params) { - params.SwapFee = sdk.Dec{} + params.SwapFee = sdkmath.LegacyDec{} }, expectedErr: "invalid swap fee: ", }, @@ -150,7 +150,7 @@ func TestParams_Validation(t *testing.T) { name: "negative swap fee", key: types.KeySwapFee, testFn: func(params *types.Params) { - params.SwapFee = sdk.NewDec(-1) + params.SwapFee = sdkmath.LegacyNewDec(-1) }, expectedErr: "invalid swap fee: -1.000000000000000000", }, @@ -158,7 +158,7 @@ func TestParams_Validation(t *testing.T) { name: "swap fee greater than 1", key: types.KeySwapFee, testFn: func(params *types.Params) { - params.SwapFee = sdk.MustNewDecFromStr("1.000000000000000001") + params.SwapFee = sdkmath.LegacyMustNewDecFromStr("1.000000000000000001") }, expectedErr: "invalid swap fee: 1.000000000000000001", }, @@ -166,7 +166,7 @@ func TestParams_Validation(t *testing.T) { name: "0 swap fee", key: types.KeySwapFee, testFn: func(params *types.Params) { - params.SwapFee = sdk.ZeroDec() + params.SwapFee = sdkmath.LegacyZeroDec() }, expectedErr: "", }, @@ -174,7 +174,7 @@ func TestParams_Validation(t *testing.T) { name: "1 swap fee", key: types.KeySwapFee, testFn: func(params *types.Params) { - params.SwapFee = sdk.OneDec() + params.SwapFee = sdkmath.LegacyOneDec() }, expectedErr: "invalid swap fee: 1.000000000000000000", }, @@ -215,7 +215,7 @@ func TestParams_String(t *testing.T) { types.NewAllowedPool("hard", "ukava"), types.NewAllowedPool("ukava", "usdx"), ), - sdk.MustNewDecFromStr("0.5"), + sdkmath.LegacyMustNewDecFromStr("0.5"), ) require.NoError(t, params.Validate()) diff --git a/x/swap/types/query.pb.go b/x/swap/types/query.pb.go index fc239a0366..b4ac383598 100644 --- a/x/swap/types/query.pb.go +++ b/x/swap/types/query.pb.go @@ -5,6 +5,7 @@ package types import ( context "context" + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" _ "github.com/cosmos/cosmos-proto" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" @@ -226,7 +227,7 @@ type PoolResponse struct { // coins represents the total reserves of the pool Coins github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,2,rep,name=coins,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"coins"` // total_shares represents the total shares of the pool - TotalShares github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,3,opt,name=total_shares,json=totalShares,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"total_shares"` + TotalShares cosmossdk_io_math.Int `protobuf:"bytes,3,opt,name=total_shares,json=totalShares,proto3,customtype=cosmossdk.io/math.Int" json:"total_shares"` } func (m *PoolResponse) Reset() { *m = PoolResponse{} } @@ -353,7 +354,7 @@ type DepositResponse struct { // pool_id represents the pool the deposit is for PoolId string `protobuf:"bytes,2,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` // shares_owned presents the shares owned by the depositor for the pool - SharesOwned github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,3,opt,name=shares_owned,json=sharesOwned,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"shares_owned"` + SharesOwned cosmossdk_io_math.Int `protobuf:"bytes,3,opt,name=shares_owned,json=sharesOwned,proto3,customtype=cosmossdk.io/math.Int" json:"shares_owned"` // shares_value represents the coin value of the shares_owned SharesValue github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,4,rep,name=shares_value,json=sharesValue,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"shares_value"` } @@ -405,54 +406,55 @@ func init() { func init() { proto.RegisterFile("kava/swap/v1beta1/query.proto", fileDescriptor_652c07bb38685396) } var fileDescriptor_652c07bb38685396 = []byte{ - // 747 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0xcf, 0x4f, 0x13, 0x4d, - 0x18, 0xee, 0xf6, 0xd7, 0x07, 0x53, 0x92, 0x2f, 0xcc, 0xc7, 0x17, 0xdb, 0x05, 0xb6, 0x58, 0x05, - 0x1a, 0x93, 0xee, 0x0a, 0x26, 0x9a, 0xa8, 0x07, 0xad, 0x04, 0xc3, 0x49, 0x5d, 0x8c, 0x07, 0x2f, - 0xcd, 0x94, 0x9d, 0x2c, 0x1b, 0xb6, 0x3b, 0xcb, 0xce, 0xb4, 0x88, 0x27, 0xc3, 0xc9, 0xa3, 0x89, - 0x37, 0x4f, 0x9e, 0x8d, 0xde, 0xf8, 0x0f, 0xbc, 0x70, 0x24, 0x78, 0x31, 0x1e, 0xd0, 0x80, 0x47, - 0xff, 0x08, 0x33, 0x3f, 0xb6, 0x94, 0x76, 0xb1, 0x6a, 0x38, 0x75, 0x77, 0xde, 0xf7, 0x7d, 0x9e, - 0xe7, 0x7d, 0xdf, 0x67, 0xa7, 0x60, 0x7a, 0x03, 0x75, 0x90, 0x45, 0xb7, 0x50, 0x68, 0x75, 0x16, - 0x9a, 0x98, 0xa1, 0x05, 0x6b, 0xb3, 0x8d, 0xa3, 0x6d, 0x33, 0x8c, 0x08, 0x23, 0x70, 0x9c, 0x87, - 0x4d, 0x1e, 0x36, 0x55, 0x58, 0xbf, 0xb2, 0x46, 0x68, 0x8b, 0x50, 0xab, 0x89, 0x28, 0x96, 0xb9, - 0xdd, 0xca, 0x10, 0xb9, 0x5e, 0x80, 0x98, 0x47, 0x02, 0x59, 0xae, 0x1b, 0xbd, 0xb9, 0x71, 0xd6, - 0x1a, 0xf1, 0xe2, 0x78, 0x49, 0xc6, 0x1b, 0xe2, 0xcd, 0x92, 0x2f, 0x2a, 0x34, 0xe1, 0x12, 0x97, - 0xc8, 0x73, 0xfe, 0xa4, 0x4e, 0xa7, 0x5c, 0x42, 0x5c, 0x1f, 0x5b, 0x28, 0xf4, 0x2c, 0x14, 0x04, - 0x84, 0x09, 0xb6, 0xb8, 0x66, 0x6a, 0xb0, 0x19, 0x21, 0x5d, 0x44, 0x2b, 0x3a, 0x80, 0x8f, 0xb8, - 0xdc, 0x87, 0x28, 0x42, 0x2d, 0x6a, 0xe3, 0xcd, 0x36, 0xa6, 0xec, 0x66, 0xf6, 0xe5, 0xdb, 0x72, - 0xaa, 0xf2, 0x18, 0xfc, 0x77, 0x2a, 0x46, 0x43, 0x12, 0x50, 0x0c, 0x6f, 0x80, 0x7c, 0x28, 0x4e, - 0x8a, 0xda, 0x8c, 0x56, 0x2d, 0x2c, 0x96, 0xcc, 0x81, 0x79, 0x98, 0xb2, 0xa4, 0x9e, 0xdd, 0x3b, - 0x2c, 0xa7, 0x6c, 0x95, 0xae, 0x50, 0x19, 0x18, 0x97, 0xa8, 0x84, 0xf8, 0x31, 0x21, 0xbc, 0x00, - 0xfe, 0x09, 0x09, 0xf1, 0x1b, 0x9e, 0x23, 0x40, 0x47, 0xed, 0x3c, 0x7f, 0x5d, 0x71, 0xe0, 0x32, - 0x00, 0x27, 0x03, 0x2c, 0xa6, 0x05, 0xe1, 0x9c, 0xa9, 0x86, 0xc2, 0x27, 0x68, 0xca, 0xcd, 0x9c, - 0x10, 0xbb, 0x58, 0x81, 0xda, 0x3d, 0x95, 0x95, 0x37, 0x5a, 0xdc, 0xa8, 0xa4, 0x55, 0xbd, 0xdc, - 0x02, 0x39, 0x4e, 0xc4, 0x5b, 0xc9, 0x54, 0x0b, 0x8b, 0xe5, 0xa4, 0x56, 0x08, 0xf1, 0xe3, 0x7c, - 0xd5, 0x90, 0xac, 0x81, 0xf7, 0x13, 0xb4, 0xcd, 0x0f, 0xd5, 0x26, 0x91, 0x4e, 0x89, 0xfb, 0xa1, - 0x81, 0xb1, 0x5e, 0x1a, 0x08, 0x41, 0x36, 0x40, 0x2d, 0xac, 0x66, 0x21, 0x9e, 0x21, 0x02, 0x39, - 0x6e, 0x12, 0x5a, 0x4c, 0x0b, 0xa9, 0xa5, 0x53, 0x44, 0x31, 0xc5, 0x3d, 0xe2, 0x05, 0xf5, 0xab, - 0x5c, 0xe4, 0xbb, 0xaf, 0xe5, 0xaa, 0xeb, 0xb1, 0xf5, 0x76, 0xd3, 0x5c, 0x23, 0x2d, 0x65, 0x23, - 0xf5, 0x53, 0xa3, 0xce, 0x86, 0xc5, 0xb6, 0x43, 0x4c, 0x45, 0x01, 0xb5, 0x25, 0x32, 0x6c, 0x80, - 0x31, 0x46, 0x18, 0xf2, 0x1b, 0x74, 0x1d, 0x45, 0x98, 0x16, 0x33, 0x9c, 0xbe, 0x7e, 0x9b, 0xc3, - 0x7d, 0x39, 0x2c, 0xcf, 0xfd, 0x06, 0xdc, 0x4a, 0xc0, 0x0e, 0x76, 0x6b, 0x40, 0x49, 0x5b, 0x09, - 0x98, 0x5d, 0x10, 0x88, 0xab, 0x02, 0x50, 0x39, 0xe0, 0x83, 0x06, 0x26, 0xc4, 0x2e, 0x96, 0x70, - 0x48, 0xa8, 0xc7, 0xba, 0x2e, 0x30, 0x41, 0x8e, 0x6c, 0x05, 0x38, 0x92, 0x7d, 0xd7, 0x8b, 0x07, - 0xbb, 0xb5, 0x09, 0x05, 0x75, 0xd7, 0x71, 0x22, 0x4c, 0xe9, 0x2a, 0x8b, 0xbc, 0xc0, 0xb5, 0x65, - 0x5a, 0xaf, 0x6b, 0xd2, 0xbf, 0x70, 0x4d, 0xe6, 0x6f, 0x5d, 0xa3, 0xf4, 0xbe, 0xd7, 0xc0, 0xff, - 0x7d, 0x7a, 0xd5, 0x9e, 0x96, 0xc0, 0x88, 0xa3, 0xce, 0x94, 0x83, 0x2a, 0x09, 0x0e, 0x52, 0x65, - 0x7d, 0x26, 0xea, 0x56, 0x9e, 0x9b, 0x8f, 0x94, 0xdc, 0x8f, 0x69, 0xf0, 0x6f, 0x1f, 0x25, 0xbc, - 0x0e, 0x46, 0x15, 0x1d, 0x19, 0x3e, 0xdd, 0x93, 0xd4, 0xb3, 0x27, 0xec, 0x81, 0x31, 0x69, 0x92, - 0x06, 0x5f, 0x85, 0xa3, 0xac, 0xb2, 0xfc, 0xc7, 0x56, 0x49, 0x56, 0x50, 0x90, 0xd8, 0x0f, 0x38, - 0x34, 0x0c, 0xba, 0x54, 0x1d, 0xe4, 0xb7, 0x71, 0x31, 0x7b, 0xfe, 0xfe, 0x57, 0x7c, 0x4f, 0x38, - 0xbe, 0x9c, 0xe2, 0xe2, 0x8b, 0x0c, 0xc8, 0x89, 0xa5, 0xc3, 0xe7, 0x20, 0x2f, 0xaf, 0x33, 0x38, - 0x9b, 0xb0, 0xdc, 0xc1, 0xdb, 0x53, 0x9f, 0x1b, 0x96, 0x26, 0x97, 0x52, 0xb9, 0xb8, 0xf3, 0xe9, - 0xfb, 0xeb, 0xf4, 0x24, 0x2c, 0x59, 0x83, 0x57, 0xb4, 0xbc, 0x32, 0x61, 0x07, 0xe4, 0xc4, 0x85, - 0x05, 0x2f, 0x9f, 0x89, 0xd9, 0x73, 0x8d, 0xea, 0xb3, 0x43, 0xb2, 0x14, 0xf1, 0x8c, 0x20, 0xd6, - 0x61, 0x31, 0x89, 0x58, 0xd0, 0xed, 0x68, 0x60, 0x24, 0x76, 0x3b, 0x9c, 0x3f, 0x0b, 0xb5, 0xef, - 0xfb, 0xd5, 0xab, 0xc3, 0x13, 0x95, 0x82, 0x4b, 0x42, 0xc1, 0x34, 0x9c, 0x4c, 0x50, 0x10, 0x7f, - 0x17, 0xf5, 0x3b, 0x7b, 0x47, 0x86, 0xb6, 0x7f, 0x64, 0x68, 0xdf, 0x8e, 0x0c, 0xed, 0xd5, 0xb1, - 0x91, 0xda, 0x3f, 0x36, 0x52, 0x9f, 0x8f, 0x8d, 0xd4, 0xd3, 0x5e, 0x7f, 0x71, 0x80, 0x9a, 0x8f, - 0x9a, 0x54, 0x42, 0x3d, 0x93, 0x60, 0x62, 0xbb, 0xcd, 0xbc, 0xf8, 0x93, 0xbb, 0xf6, 0x33, 0x00, - 0x00, 0xff, 0xff, 0x7b, 0x1b, 0x3a, 0x0f, 0xd1, 0x07, 0x00, 0x00, + // 757 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0x4d, 0x6f, 0xd3, 0x4a, + 0x14, 0x8d, 0xf3, 0xf5, 0xda, 0x49, 0xa5, 0xa7, 0xce, 0x6b, 0xf5, 0x12, 0xb7, 0x75, 0xfa, 0xf2, + 0x68, 0x1b, 0x81, 0x62, 0xd3, 0x22, 0x40, 0x82, 0x0d, 0x84, 0x0a, 0xd4, 0x0d, 0x1f, 0x2e, 0x42, + 0x88, 0x4d, 0x34, 0xa9, 0x47, 0xae, 0x55, 0xc7, 0xe3, 0x7a, 0x26, 0x29, 0x65, 0x85, 0xba, 0x62, + 0x89, 0xc4, 0x8e, 0x15, 0x6b, 0x04, 0x1b, 0xd4, 0x1f, 0xd1, 0x65, 0x55, 0x36, 0x08, 0xa4, 0x82, + 0x5a, 0x7e, 0x08, 0x9a, 0x0f, 0xa7, 0x69, 0xe2, 0x12, 0x09, 0x75, 0x15, 0x7b, 0xee, 0xbd, 0xe7, + 0x9c, 0x7b, 0xef, 0xf1, 0x04, 0xcc, 0x6c, 0xa0, 0x0e, 0xb2, 0xe8, 0x16, 0x0a, 0xad, 0xce, 0x62, + 0x13, 0x33, 0xb4, 0x68, 0x6d, 0xb6, 0x71, 0xb4, 0x6d, 0x86, 0x11, 0x61, 0x04, 0x8e, 0xf3, 0xb0, + 0xc9, 0xc3, 0xa6, 0x0a, 0xeb, 0x17, 0xd7, 0x08, 0x6d, 0x11, 0x6a, 0x35, 0x11, 0xc5, 0x32, 0xb7, + 0x5b, 0x19, 0x22, 0xd7, 0x0b, 0x10, 0xf3, 0x48, 0x20, 0xcb, 0x75, 0xa3, 0x37, 0x37, 0xce, 0x5a, + 0x23, 0x5e, 0x1c, 0x2f, 0xc9, 0x78, 0x43, 0xbc, 0x59, 0xf2, 0x45, 0x85, 0x26, 0x5c, 0xe2, 0x12, + 0x79, 0xce, 0x9f, 0xd4, 0xe9, 0xb4, 0x4b, 0x88, 0xeb, 0x63, 0x0b, 0x85, 0x9e, 0x85, 0x82, 0x80, + 0x30, 0xc1, 0x16, 0xd7, 0x4c, 0x0f, 0x36, 0x23, 0xa4, 0x8b, 0x68, 0x45, 0x07, 0xf0, 0x11, 0x97, + 0xfb, 0x10, 0x45, 0xa8, 0x45, 0x6d, 0xbc, 0xd9, 0xc6, 0x94, 0xdd, 0xc8, 0xbe, 0x7a, 0x57, 0x4e, + 0x55, 0x1e, 0x83, 0x7f, 0x4e, 0xc5, 0x68, 0x48, 0x02, 0x8a, 0xe1, 0x75, 0x90, 0x0f, 0xc5, 0x49, + 0x51, 0x9b, 0xd5, 0xaa, 0x85, 0xa5, 0x92, 0x39, 0x30, 0x0f, 0x53, 0x96, 0xd4, 0xb3, 0x7b, 0x87, + 0xe5, 0x94, 0xad, 0xd2, 0x15, 0x2a, 0x03, 0xe3, 0x12, 0x95, 0x10, 0x3f, 0x26, 0x84, 0xff, 0x82, + 0xbf, 0x42, 0x42, 0xfc, 0x86, 0xe7, 0x08, 0xd0, 0x51, 0x3b, 0xcf, 0x5f, 0x57, 0x1c, 0x78, 0x17, + 0x80, 0x93, 0x01, 0x16, 0xd3, 0x82, 0x70, 0xde, 0x54, 0x43, 0xe1, 0x13, 0x34, 0xe5, 0x66, 0x4e, + 0x88, 0x5d, 0xac, 0x40, 0xed, 0x9e, 0xca, 0xca, 0x5b, 0x2d, 0x6e, 0x54, 0xd2, 0xaa, 0x5e, 0x6e, + 0x82, 0x1c, 0x27, 0xe2, 0xad, 0x64, 0xaa, 0x85, 0xa5, 0x72, 0x52, 0x2b, 0x84, 0xf8, 0x71, 0xbe, + 0x6a, 0x48, 0xd6, 0xc0, 0x7b, 0x09, 0xda, 0x16, 0x86, 0x6a, 0x93, 0x48, 0xa7, 0xc4, 0x7d, 0xd3, + 0xc0, 0x58, 0x2f, 0x0d, 0x84, 0x20, 0x1b, 0xa0, 0x16, 0x56, 0xb3, 0x10, 0xcf, 0x10, 0x81, 0x1c, + 0x37, 0x09, 0x2d, 0xa6, 0x85, 0xd4, 0xd2, 0x29, 0xa2, 0x98, 0xe2, 0x0e, 0xf1, 0x82, 0xfa, 0x65, + 0x2e, 0xf2, 0xfd, 0xf7, 0x72, 0xd5, 0xf5, 0xd8, 0x7a, 0xbb, 0x69, 0xae, 0x91, 0x96, 0xb2, 0x91, + 0xfa, 0xa9, 0x51, 0x67, 0xc3, 0x62, 0xdb, 0x21, 0xa6, 0xa2, 0x80, 0xda, 0x12, 0x19, 0xde, 0x07, + 0x63, 0x8c, 0x30, 0xe4, 0x37, 0xe8, 0x3a, 0x8a, 0x30, 0x2d, 0x66, 0x38, 0x7d, 0xfd, 0x12, 0x87, + 0xfb, 0x7a, 0x58, 0x9e, 0x94, 0xc5, 0xd4, 0xd9, 0x30, 0x3d, 0x62, 0xb5, 0x10, 0x5b, 0x37, 0x57, + 0x02, 0x76, 0xb0, 0x5b, 0x03, 0x4a, 0xc9, 0x4a, 0xc0, 0xec, 0x82, 0x00, 0x58, 0x15, 0xf5, 0x6a, + 0xe1, 0x1f, 0x35, 0x30, 0x21, 0x46, 0xbf, 0x8c, 0x43, 0x42, 0x3d, 0xd6, 0x5d, 0xba, 0x09, 0x72, + 0x64, 0x2b, 0xc0, 0x91, 0x6c, 0xb3, 0x5e, 0x3c, 0xd8, 0xad, 0x4d, 0x28, 0xa8, 0xdb, 0x8e, 0x13, + 0x61, 0x4a, 0x57, 0x59, 0xe4, 0x05, 0xae, 0x2d, 0xd3, 0x7a, 0x4d, 0x92, 0xfe, 0x8d, 0x49, 0x32, + 0x7f, 0x6a, 0x12, 0xa5, 0xf7, 0x83, 0x06, 0x26, 0xfb, 0xf4, 0xaa, 0xb5, 0x2c, 0x83, 0x11, 0x47, + 0x9d, 0x29, 0xc3, 0x54, 0x12, 0x0c, 0xa3, 0xca, 0xfa, 0x3c, 0xd3, 0xad, 0x3c, 0x37, 0xdb, 0x28, + 0xb9, 0x9f, 0xd2, 0xe0, 0xef, 0x3e, 0x4a, 0x78, 0x0d, 0x8c, 0x2a, 0x3a, 0x32, 0x7c, 0xba, 0x27, + 0xa9, 0x67, 0x4f, 0xf8, 0x29, 0x18, 0x93, 0x9e, 0x68, 0xf0, 0x55, 0x38, 0xca, 0x19, 0x57, 0x87, + 0x39, 0x23, 0x99, 0xb0, 0x20, 0xa1, 0x1e, 0x70, 0x24, 0x18, 0x74, 0x91, 0x3b, 0xc8, 0x6f, 0xe3, + 0x62, 0xf6, 0xfc, 0xdd, 0xad, 0xf8, 0x9e, 0x70, 0x7c, 0x39, 0xb4, 0xa5, 0x97, 0x19, 0x90, 0x13, + 0x3b, 0x86, 0x2f, 0x40, 0x5e, 0x5e, 0x56, 0x70, 0x2e, 0x61, 0x97, 0x83, 0x77, 0xa3, 0x3e, 0x3f, + 0x2c, 0x4d, 0xee, 0xa0, 0xf2, 0xdf, 0xce, 0xe7, 0x9f, 0x6f, 0xd2, 0x53, 0xb0, 0x64, 0x0d, 0x5e, + 0xc0, 0xf2, 0x42, 0x84, 0x1d, 0x90, 0x13, 0xd7, 0x11, 0xbc, 0x70, 0x26, 0x66, 0xcf, 0x25, 0xa9, + 0xcf, 0x0d, 0xc9, 0x52, 0xc4, 0xb3, 0x82, 0x58, 0x87, 0xc5, 0x24, 0x62, 0x41, 0xb7, 0xa3, 0x81, + 0x91, 0xd8, 0xdc, 0x70, 0xe1, 0x2c, 0xd4, 0xbe, 0xcf, 0x55, 0xaf, 0x0e, 0x4f, 0x54, 0x0a, 0xfe, + 0x17, 0x0a, 0x66, 0xe0, 0x54, 0x82, 0x82, 0xf8, 0x33, 0xa8, 0xdf, 0xda, 0x3b, 0x32, 0xb4, 0xfd, + 0x23, 0x43, 0xfb, 0x71, 0x64, 0x68, 0xaf, 0x8f, 0x8d, 0xd4, 0xfe, 0xb1, 0x91, 0xfa, 0x72, 0x6c, + 0xa4, 0x9e, 0xcd, 0xf7, 0x6c, 0x96, 0x03, 0xd4, 0x7c, 0xd4, 0xa4, 0x12, 0xea, 0xb9, 0x04, 0x13, + 0xdb, 0x6d, 0xe6, 0xc5, 0x5f, 0xd8, 0x95, 0x5f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xbb, 0x8f, 0x8d, + 0x36, 0xaf, 0x07, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -592,6 +594,7 @@ func _Query_Deposits_Handler(srv interface{}, ctx context.Context, dec func(inte return interceptor(ctx, in, info, handler) } +var Query_serviceDesc = _Query_serviceDesc var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "kava.swap.v1beta1.Query", HandlerType: (*QueryServer)(nil), diff --git a/x/swap/types/state_test.go b/x/swap/types/state_test.go index 9471662af0..fafa6258f5 100644 --- a/x/swap/types/state_test.go +++ b/x/swap/types/state_test.go @@ -209,7 +209,7 @@ func TestState_PoolRecord_Validations(t *testing.T) { { name: "zero reserve a", poolID: "ukava:usdx", - reservesA: sdk.Coin{Denom: "ukava", Amount: sdk.ZeroInt()}, + reservesA: sdk.Coin{Denom: "ukava", Amount: sdkmath.ZeroInt()}, reservesB: validRecord.ReservesB, totalShares: validRecord.TotalShares, expectedErr: "pool 'ukava:usdx' has invalid reserves: 0ukava", @@ -226,7 +226,7 @@ func TestState_PoolRecord_Validations(t *testing.T) { name: "zero reserve b", poolID: "ukava:usdx", reservesA: validRecord.ReservesA, - reservesB: sdk.Coin{Denom: "usdx", Amount: sdk.ZeroInt()}, + reservesB: sdk.Coin{Denom: "usdx", Amount: sdkmath.ZeroInt()}, totalShares: validRecord.TotalShares, expectedErr: "pool 'ukava:usdx' has invalid reserves: 0usdx", }, @@ -243,7 +243,7 @@ func TestState_PoolRecord_Validations(t *testing.T) { poolID: validRecord.PoolID, reservesA: validRecord.ReservesA, reservesB: validRecord.ReservesB, - totalShares: sdk.ZeroInt(), + totalShares: sdkmath.ZeroInt(), expectedErr: "pool 'ukava:usdx' has invalid total shares: 0", }, } @@ -466,7 +466,7 @@ func TestState_ShareRecord_Validations(t *testing.T) { name: "zero total shares", depositor: validRecord.Depositor, poolID: validRecord.PoolID, - sharesOwned: sdk.ZeroInt(), + sharesOwned: sdkmath.ZeroInt(), expectedErr: "depositor 'kava1mq9qxlhze029lm0frzw2xr6hem8c3k9ts54w0w' and pool 'ukava:usdx' has invalid total shares: 0", }, } diff --git a/x/swap/types/swap.pb.go b/x/swap/types/swap.pb.go index e1a71cd7e3..8f62284f6a 100644 --- a/x/swap/types/swap.pb.go +++ b/x/swap/types/swap.pb.go @@ -4,6 +4,7 @@ package types import ( + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" _ "github.com/cosmos/cosmos-proto" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" @@ -31,7 +32,7 @@ type Params struct { // allowed_pools defines that pools that are allowed to be created AllowedPools AllowedPools `protobuf:"bytes,1,rep,name=allowed_pools,json=allowedPools,proto3,castrepeated=AllowedPools" json:"allowed_pools"` // swap_fee defines the swap fee for all pools - SwapFee github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=swap_fee,json=swapFee,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"swap_fee"` + SwapFee cosmossdk_io_math.LegacyDec `protobuf:"bytes,2,opt,name=swap_fee,json=swapFee,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"swap_fee"` } func (m *Params) Reset() { *m = Params{} } @@ -137,7 +138,7 @@ type PoolRecord struct { // reserves_b is the a token coin reserves ReservesB types.Coin `protobuf:"bytes,3,opt,name=reserves_b,json=reservesB,proto3" json:"reserves_b"` // total_shares is the total distrubuted shares of the pool - TotalShares github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,4,opt,name=total_shares,json=totalShares,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"total_shares"` + TotalShares cosmossdk_io_math.Int `protobuf:"bytes,4,opt,name=total_shares,json=totalShares,proto3,customtype=cosmossdk.io/math.Int" json:"total_shares"` } func (m *PoolRecord) Reset() { *m = PoolRecord{} } @@ -201,7 +202,7 @@ type ShareRecord struct { // pool_id represents the pool the shares belong to PoolID string `protobuf:"bytes,2,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` // shares_owned represents the number of shares owned by depsoitor for the pool_id - SharesOwned github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,3,opt,name=shares_owned,json=sharesOwned,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"shares_owned"` + SharesOwned cosmossdk_io_math.Int `protobuf:"bytes,3,opt,name=shares_owned,json=sharesOwned,proto3,customtype=cosmossdk.io/math.Int" json:"shares_owned"` } func (m *ShareRecord) Reset() { *m = ShareRecord{} } @@ -261,40 +262,41 @@ func init() { func init() { proto.RegisterFile("kava/swap/v1beta1/swap.proto", fileDescriptor_9df359be90eb28cb) } var fileDescriptor_9df359be90eb28cb = []byte{ - // 521 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x53, 0x3f, 0x6f, 0xd3, 0x5e, - 0x14, 0x8d, 0xd3, 0x28, 0xf9, 0xe5, 0x25, 0xbf, 0x01, 0x53, 0x89, 0xb4, 0x42, 0x76, 0x15, 0x24, - 0xd4, 0x25, 0xb6, 0x5a, 0x36, 0x84, 0x10, 0x31, 0x01, 0x91, 0x89, 0xca, 0x0c, 0x08, 0x96, 0xa7, - 0x67, 0xfb, 0x36, 0xb5, 0xe2, 0xf8, 0x5a, 0x7e, 0x8f, 0x84, 0x7e, 0x0b, 0xc4, 0xc4, 0xc8, 0xcc, - 0xdc, 0x4f, 0xc0, 0xd4, 0xb1, 0xea, 0x84, 0x18, 0x02, 0x4a, 0xbe, 0x05, 0x2c, 0xe8, 0xfd, 0xa1, - 0x35, 0x42, 0x48, 0x54, 0x4c, 0xbe, 0xf7, 0x9e, 0x77, 0xce, 0xbd, 0xf7, 0x58, 0x97, 0xdc, 0x9c, - 0xb2, 0x39, 0xf3, 0xf9, 0x82, 0x15, 0xfe, 0x7c, 0x2f, 0x02, 0xc1, 0xf6, 0x54, 0xe2, 0x15, 0x25, - 0x0a, 0xb4, 0xaf, 0x49, 0xd4, 0x53, 0x05, 0x83, 0x6e, 0x3b, 0x31, 0xf2, 0x19, 0x72, 0x3f, 0x62, - 0x1c, 0x2e, 0x28, 0x31, 0xa6, 0xb9, 0xa6, 0x6c, 0x6f, 0x69, 0x9c, 0xaa, 0xcc, 0xd7, 0x89, 0x81, - 0x36, 0x27, 0x38, 0x41, 0x5d, 0x97, 0x91, 0xae, 0xf6, 0x3f, 0x5a, 0xa4, 0x79, 0xc0, 0x4a, 0x36, - 0xe3, 0xf6, 0x0b, 0xf2, 0x3f, 0xcb, 0x32, 0x5c, 0x40, 0x42, 0x0b, 0xc4, 0x8c, 0xf7, 0xac, 0x9d, - 0x8d, 0xdd, 0xce, 0xbe, 0xe3, 0xfd, 0x36, 0x86, 0x37, 0xd4, 0xef, 0x0e, 0x10, 0xb3, 0x60, 0xf3, - 0x74, 0xe9, 0xd6, 0x3e, 0x7c, 0x71, 0xbb, 0x95, 0x22, 0x0f, 0xbb, 0xac, 0x92, 0xd9, 0xcf, 0xc9, - 0x7f, 0x92, 0x4f, 0x0f, 0x01, 0x7a, 0xf5, 0x1d, 0x6b, 0xb7, 0x1d, 0xdc, 0x93, 0xac, 0xcf, 0x4b, - 0xf7, 0xf6, 0x24, 0x15, 0x47, 0xaf, 0x22, 0x2f, 0xc6, 0x99, 0x19, 0xd7, 0x7c, 0x06, 0x3c, 0x99, - 0xfa, 0xe2, 0xb8, 0x00, 0xee, 0x8d, 0x20, 0x3e, 0x3f, 0x19, 0x10, 0xb3, 0xcd, 0x08, 0xe2, 0xb0, - 0x25, 0xd5, 0x1e, 0x03, 0xdc, 0x6d, 0xbc, 0x7b, 0xef, 0xd6, 0xfa, 0x8f, 0x48, 0xa7, 0xd2, 0xdc, - 0xbe, 0x41, 0x5a, 0x02, 0xa7, 0x90, 0x53, 0xd6, 0xb3, 0x64, 0xb3, 0xb0, 0xa9, 0xd2, 0xe1, 0x25, - 0x10, 0xe9, 0x29, 0x0c, 0x10, 0x18, 0x99, 0xb7, 0x75, 0x42, 0xa4, 0x40, 0x08, 0x31, 0x96, 0x89, - 0x7d, 0x8b, 0xb4, 0xa4, 0x0f, 0x34, 0x4d, 0xb4, 0x4c, 0x40, 0x56, 0x4b, 0xb7, 0x29, 0x1f, 0x8c, - 0x47, 0x61, 0x53, 0x42, 0xe3, 0xc4, 0xbe, 0x4f, 0x48, 0x09, 0x1c, 0xca, 0x39, 0x70, 0xca, 0x94, - 0x6a, 0x67, 0x7f, 0xcb, 0x33, 0xa3, 0xca, 0xbf, 0x74, 0xe1, 0xd9, 0x43, 0x4c, 0xf3, 0xa0, 0x21, - 0xd7, 0x0e, 0xdb, 0x3f, 0x29, 0xc3, 0x5f, 0xf8, 0x51, 0x6f, 0xe3, 0x8a, 0xfc, 0xc0, 0xa6, 0xa4, - 0x2b, 0x50, 0xb0, 0x8c, 0xf2, 0x23, 0x56, 0x02, 0xef, 0x35, 0xae, 0xec, 0xee, 0x38, 0x17, 0x15, - 0x77, 0xc7, 0xb9, 0x08, 0x3b, 0x4a, 0xf1, 0x99, 0x12, 0xec, 0x7f, 0xb7, 0x48, 0x47, 0x85, 0xc6, - 0x95, 0x43, 0xd2, 0x4e, 0xa0, 0x40, 0x9e, 0x0a, 0x2c, 0x95, 0x2f, 0xdd, 0xe0, 0xc9, 0xb7, 0xa5, - 0x3b, 0xf8, 0x8b, 0x4e, 0xc3, 0x38, 0x1e, 0x26, 0x49, 0x09, 0x9c, 0x9f, 0x9f, 0x0c, 0xae, 0x9b, - 0x86, 0xa6, 0x12, 0x1c, 0x0b, 0xe0, 0xe1, 0xa5, 0x74, 0xd5, 0xfd, 0xfa, 0x1f, 0xdd, 0xa7, 0xa4, - 0xab, 0xf7, 0xa6, 0xb8, 0xc8, 0x21, 0x51, 0xfe, 0xfd, 0xf3, 0xf6, 0x5a, 0xf1, 0xa9, 0x14, 0x0c, - 0x1e, 0x9c, 0xae, 0x1c, 0xeb, 0x6c, 0xe5, 0x58, 0x5f, 0x57, 0x8e, 0xf5, 0x66, 0xed, 0xd4, 0xce, - 0xd6, 0x4e, 0xed, 0xd3, 0xda, 0xa9, 0xbd, 0xac, 0x8a, 0xcb, 0x03, 0x19, 0x64, 0x2c, 0xe2, 0x2a, - 0xf2, 0x5f, 0xeb, 0x8b, 0x56, 0x0d, 0xa2, 0xa6, 0xba, 0xb3, 0x3b, 0x3f, 0x02, 0x00, 0x00, 0xff, - 0xff, 0xee, 0x4a, 0x16, 0x69, 0xeb, 0x03, 0x00, 0x00, + // 541 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x53, 0x3d, 0x6f, 0xd3, 0x50, + 0x14, 0x8d, 0xd3, 0x28, 0x21, 0x2f, 0x61, 0xc0, 0x14, 0x91, 0x16, 0x64, 0x57, 0x41, 0x42, 0x95, + 0x50, 0x6c, 0xa5, 0x6c, 0x0c, 0x88, 0x98, 0x80, 0x88, 0x54, 0x95, 0xca, 0x4c, 0xb0, 0x58, 0xcf, + 0xf6, 0x6d, 0x62, 0xc5, 0xf1, 0x8d, 0xfc, 0x1e, 0x09, 0x19, 0xf9, 0x07, 0x8c, 0x8c, 0xcc, 0xcc, + 0x95, 0xf8, 0x0b, 0x1d, 0xab, 0x4e, 0x88, 0x21, 0xa0, 0x64, 0xe3, 0x27, 0x30, 0xa1, 0xf7, 0x41, + 0x6b, 0x54, 0x75, 0xe8, 0x94, 0x77, 0xef, 0xf1, 0x39, 0xf7, 0x9e, 0x93, 0xf7, 0xc8, 0xfd, 0x31, + 0x9d, 0x51, 0x97, 0xcd, 0xe9, 0xd4, 0x9d, 0x75, 0x43, 0xe0, 0xb4, 0x2b, 0x0b, 0x67, 0x9a, 0x23, + 0x47, 0xf3, 0x96, 0x40, 0x1d, 0xd9, 0xd0, 0xe8, 0xb6, 0x15, 0x21, 0x9b, 0x20, 0x73, 0x43, 0xca, + 0xe0, 0x9c, 0x12, 0x61, 0x92, 0x29, 0xca, 0xf6, 0x96, 0xc2, 0x03, 0x59, 0xb9, 0xaa, 0xd0, 0xd0, + 0xe6, 0x10, 0x87, 0xa8, 0xfa, 0xe2, 0xa4, 0xba, 0xed, 0x6f, 0x06, 0xa9, 0x1e, 0xd2, 0x9c, 0x4e, + 0x98, 0xf9, 0x96, 0xdc, 0xa4, 0x69, 0x8a, 0x73, 0x88, 0x83, 0x29, 0x62, 0xca, 0x5a, 0xc6, 0xce, + 0xc6, 0x6e, 0x63, 0xcf, 0x72, 0x2e, 0xad, 0xe1, 0xf4, 0xd4, 0x77, 0x87, 0x88, 0xa9, 0xb7, 0x79, + 0xb2, 0xb4, 0x4b, 0x5f, 0x7f, 0xda, 0xcd, 0x42, 0x93, 0xf9, 0x4d, 0x5a, 0xa8, 0xcc, 0x7d, 0x72, + 0x43, 0xf0, 0x83, 0x23, 0x80, 0x56, 0x79, 0xc7, 0xd8, 0xad, 0x7b, 0x5d, 0xc1, 0xfa, 0xb1, 0xb4, + 0xef, 0xa9, 0x1d, 0x59, 0x3c, 0x76, 0x12, 0x74, 0x27, 0x94, 0x8f, 0x9c, 0x7d, 0x18, 0xd2, 0x68, + 0xd1, 0x87, 0xe8, 0xec, 0xb8, 0x43, 0xb4, 0x85, 0x3e, 0x44, 0x7e, 0x4d, 0x48, 0xbc, 0x04, 0x78, + 0x52, 0xf9, 0xfc, 0xc5, 0x2e, 0xb5, 0x5f, 0x90, 0x46, 0x61, 0xa2, 0x79, 0x97, 0xd4, 0x38, 0x8e, + 0x21, 0x0b, 0x68, 0xcb, 0x10, 0x13, 0xfc, 0xaa, 0x2c, 0x7b, 0x17, 0x40, 0xa8, 0x46, 0x6b, 0xc0, + 0xd3, 0x32, 0x1f, 0xcb, 0x84, 0x08, 0x01, 0x1f, 0x22, 0xcc, 0x63, 0xf3, 0x01, 0xa9, 0x09, 0xf3, + 0x41, 0x12, 0x2b, 0x19, 0x8f, 0xac, 0x96, 0x76, 0x55, 0x7c, 0x30, 0xe8, 0xfb, 0x55, 0x01, 0x0d, + 0x62, 0xf3, 0x29, 0x21, 0x39, 0x30, 0xc8, 0x67, 0xc0, 0x02, 0x2a, 0x55, 0x1b, 0x7b, 0x5b, 0x8e, + 0x5e, 0x55, 0xfc, 0x35, 0xe7, 0x41, 0x3d, 0xc7, 0x24, 0xf3, 0x2a, 0xc2, 0xab, 0x5f, 0xff, 0x47, + 0xe9, 0xfd, 0xc7, 0x0f, 0x5b, 0x1b, 0xd7, 0xe4, 0x7b, 0xe6, 0x01, 0x69, 0x72, 0xe4, 0x34, 0x0d, + 0xd8, 0x88, 0xe6, 0xc0, 0x5a, 0x15, 0xb9, 0xe9, 0x23, 0x1d, 0xe9, 0x9d, 0xcb, 0x91, 0x0e, 0x32, + 0x5e, 0x08, 0x73, 0x90, 0x71, 0xbf, 0x21, 0x05, 0xde, 0x48, 0x7e, 0xfb, 0xb7, 0x41, 0x1a, 0xf2, + 0xa8, 0x43, 0x38, 0x22, 0xf5, 0x18, 0xa6, 0xc8, 0x12, 0x8e, 0xb9, 0x8c, 0xa1, 0xe9, 0xbd, 0xfa, + 0xb3, 0xb4, 0x3b, 0xc3, 0x84, 0x8f, 0xde, 0x87, 0x4e, 0x84, 0x13, 0x7d, 0xb5, 0xf4, 0x4f, 0x87, + 0xc5, 0x63, 0x97, 0x2f, 0xa6, 0xc0, 0x9c, 0x5e, 0x14, 0xf5, 0xe2, 0x38, 0x07, 0xc6, 0xce, 0x8e, + 0x3b, 0xb7, 0xf5, 0x40, 0xdd, 0xf1, 0x16, 0x1c, 0x98, 0x7f, 0x21, 0x5d, 0x0c, 0xbb, 0x7c, 0x65, + 0xd8, 0x07, 0xa4, 0xa9, 0x6c, 0x06, 0x38, 0xcf, 0x20, 0x96, 0x71, 0x5d, 0xd7, 0xac, 0x12, 0x78, + 0x2d, 0xf8, 0xde, 0xb3, 0x93, 0x95, 0x65, 0x9c, 0xae, 0x2c, 0xe3, 0xd7, 0xca, 0x32, 0x3e, 0xad, + 0xad, 0xd2, 0xe9, 0xda, 0x2a, 0x7d, 0x5f, 0x5b, 0xa5, 0x77, 0x0f, 0x0b, 0xfe, 0xc4, 0x9d, 0xef, + 0xa4, 0x34, 0x64, 0xf2, 0xe4, 0x7e, 0x50, 0x8f, 0x54, 0x7a, 0x0c, 0xab, 0xf2, 0xe9, 0x3c, 0xfe, + 0x1b, 0x00, 0x00, 0xff, 0xff, 0x2e, 0xef, 0x82, 0x5b, 0xbe, 0x03, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { diff --git a/x/swap/types/tx.pb.go b/x/swap/types/tx.pb.go index 0eea5aa735..a8ec7dec0d 100644 --- a/x/swap/types/tx.pb.go +++ b/x/swap/types/tx.pb.go @@ -5,9 +5,9 @@ package types import ( context "context" + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" _ "github.com/cosmos/cosmos-proto" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" @@ -40,7 +40,7 @@ type MsgDeposit struct { // token_b represents one token of deposit pair TokenB types.Coin `protobuf:"bytes,3,opt,name=token_b,json=tokenB,proto3" json:"token_b"` // slippage represents the max decimal percentage price change - Slippage github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,4,opt,name=slippage,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"slippage"` + Slippage cosmossdk_io_math.LegacyDec `protobuf:"bytes,4,opt,name=slippage,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"slippage"` // deadline represents the unix timestamp to complete the deposit by Deadline int64 `protobuf:"varint,5,opt,name=deadline,proto3" json:"deadline,omitempty"` } @@ -120,7 +120,7 @@ type MsgWithdraw struct { // from represents the address we are withdrawing for From string `protobuf:"bytes,1,opt,name=from,proto3" json:"from,omitempty"` // shares represents the amount of shares to withdraw - Shares github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=shares,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"shares"` + Shares cosmossdk_io_math.Int `protobuf:"bytes,2,opt,name=shares,proto3,customtype=cosmossdk.io/math.Int" json:"shares"` // min_token_a represents the minimum a token to withdraw MinTokenA types.Coin `protobuf:"bytes,3,opt,name=min_token_a,json=minTokenA,proto3" json:"min_token_a"` // min_token_a represents the minimum a token to withdraw @@ -208,7 +208,7 @@ type MsgSwapExactForTokens struct { // token_b represents the desired token_b to swap for TokenB types.Coin `protobuf:"bytes,3,opt,name=token_b,json=tokenB,proto3" json:"token_b"` // slippage represents the maximum change in token_b allowed - Slippage github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,4,opt,name=slippage,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"slippage"` + Slippage cosmossdk_io_math.LegacyDec `protobuf:"bytes,4,opt,name=slippage,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"slippage"` // deadline represents the unix timestamp to complete the swap by Deadline int64 `protobuf:"varint,5,opt,name=deadline,proto3" json:"deadline,omitempty"` } @@ -294,7 +294,7 @@ type MsgSwapForExactTokens struct { // exact_token_b represents the exact token b amount to swap for token a ExactTokenB types.Coin `protobuf:"bytes,3,opt,name=exact_token_b,json=exactTokenB,proto3" json:"exact_token_b"` // slippage represents the maximum change in token_a allowed - Slippage github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,4,opt,name=slippage,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"slippage"` + Slippage cosmossdk_io_math.LegacyDec `protobuf:"bytes,4,opt,name=slippage,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"slippage"` // deadline represents the unix timestamp to complete the swap by Deadline int64 `protobuf:"varint,5,opt,name=deadline,proto3" json:"deadline,omitempty"` } @@ -384,46 +384,46 @@ func init() { func init() { proto.RegisterFile("kava/swap/v1beta1/tx.proto", fileDescriptor_5b753029ccc8a1ef) } var fileDescriptor_5b753029ccc8a1ef = []byte{ - // 613 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x55, 0xcd, 0x6a, 0xdb, 0x4c, - 0x14, 0xb5, 0x6c, 0x7f, 0x89, 0x3d, 0xe6, 0x5b, 0x74, 0xea, 0x80, 0x22, 0x88, 0x6c, 0x0c, 0x0d, - 0x5e, 0xd4, 0x52, 0x93, 0x42, 0x29, 0xa5, 0xd0, 0x46, 0x71, 0x0c, 0x5d, 0x98, 0x82, 0x12, 0x68, - 0xe9, 0xc6, 0x8c, 0xa4, 0xa9, 0x2c, 0x6c, 0x6b, 0x54, 0xcd, 0x24, 0x76, 0xdf, 0xa0, 0xab, 0xd2, - 0x47, 0xe8, 0xae, 0x2f, 0xe0, 0x87, 0x08, 0x5d, 0x85, 0xac, 0x4a, 0x17, 0xa1, 0xd8, 0x2f, 0x52, - 0x34, 0xfa, 0xf1, 0x4f, 0x84, 0x6b, 0x67, 0xd5, 0xae, 0x3c, 0xa3, 0x73, 0xcf, 0xb9, 0x33, 0xe7, - 0x5e, 0xdf, 0x01, 0x52, 0x0f, 0x5d, 0x20, 0x95, 0x0e, 0x91, 0xa7, 0x5e, 0x1c, 0x18, 0x98, 0xa1, - 0x03, 0x95, 0x8d, 0x14, 0xcf, 0x27, 0x8c, 0xc0, 0x7b, 0x01, 0xa6, 0x04, 0x98, 0x12, 0x61, 0x92, - 0x6c, 0x12, 0x3a, 0x20, 0x54, 0x35, 0x10, 0xc5, 0x09, 0xc1, 0x24, 0x8e, 0x1b, 0x52, 0xa4, 0xdd, - 0x10, 0xef, 0xf0, 0x9d, 0x1a, 0x6e, 0x22, 0xa8, 0x6c, 0x13, 0x9b, 0x84, 0xdf, 0x83, 0x55, 0xf8, - 0xb5, 0x36, 0xce, 0x02, 0xd0, 0xa6, 0x76, 0x13, 0x7b, 0x84, 0x3a, 0x0c, 0x3e, 0x01, 0x45, 0x2b, - 0x5c, 0x12, 0x5f, 0x14, 0xaa, 0x42, 0xbd, 0xa8, 0x89, 0xd7, 0xe3, 0x46, 0x39, 0x52, 0x3a, 0xb2, - 0x2c, 0x1f, 0x53, 0x7a, 0xca, 0x7c, 0xc7, 0xb5, 0xf5, 0x59, 0x28, 0x7c, 0x0a, 0xb6, 0x19, 0xe9, - 0x61, 0xb7, 0x83, 0xc4, 0x6c, 0x55, 0xa8, 0x97, 0x0e, 0x77, 0x95, 0x88, 0x12, 0x9c, 0x34, 0x3e, - 0xbe, 0x72, 0x4c, 0x1c, 0x57, 0xcb, 0x5f, 0xde, 0x54, 0x32, 0xfa, 0x16, 0x8f, 0x3f, 0x9a, 0x31, - 0x0d, 0x31, 0xb7, 0x09, 0x53, 0x83, 0x6f, 0x41, 0x81, 0xf6, 0x1d, 0xcf, 0x43, 0x36, 0x16, 0xf3, - 0xfc, 0xa8, 0xcf, 0x03, 0xfc, 0xe7, 0x4d, 0x65, 0xdf, 0x76, 0x58, 0xf7, 0xdc, 0x50, 0x4c, 0x32, - 0x88, 0x3c, 0x88, 0x7e, 0x1a, 0xd4, 0xea, 0xa9, 0xec, 0xa3, 0x87, 0xa9, 0xd2, 0xc4, 0xe6, 0xf5, - 0xb8, 0x01, 0xa2, 0x5c, 0x4d, 0x6c, 0xea, 0x89, 0x1a, 0x94, 0x40, 0xc1, 0xc2, 0xc8, 0xea, 0x3b, - 0x2e, 0x16, 0xff, 0xab, 0x0a, 0xf5, 0x9c, 0x9e, 0xec, 0x9f, 0xe5, 0x3f, 0x7d, 0xad, 0x64, 0x6a, - 0x65, 0x00, 0x67, 0xae, 0xe9, 0x98, 0x7a, 0xc4, 0xa5, 0xb8, 0xf6, 0x2d, 0x0b, 0x4a, 0x6d, 0x6a, - 0xbf, 0x71, 0x58, 0xd7, 0xf2, 0xd1, 0x10, 0x3e, 0x04, 0xf9, 0xf7, 0x3e, 0x19, 0xfc, 0xd1, 0x48, - 0x1e, 0x05, 0x5b, 0x60, 0x8b, 0x76, 0x91, 0x8f, 0x29, 0xb7, 0xb0, 0xa8, 0x29, 0x1b, 0xdc, 0xe6, - 0x95, 0xcb, 0xf4, 0x88, 0x0d, 0x5f, 0x80, 0xd2, 0xc0, 0x71, 0x3b, 0x71, 0x3d, 0xd6, 0x74, 0xb5, - 0x38, 0x70, 0xdc, 0xb3, 0xb0, 0x24, 0x0b, 0x02, 0x06, 0xf7, 0x76, 0x13, 0x01, 0x6d, 0x0d, 0xff, - 0x76, 0xc0, 0xfd, 0x39, 0xa3, 0x12, 0x03, 0xbf, 0x67, 0xc1, 0x4e, 0x9b, 0xda, 0xa7, 0x43, 0xe4, - 0x9d, 0x8c, 0x90, 0xc9, 0x5a, 0xc4, 0xe7, 0x92, 0x34, 0x68, 0x4c, 0x1f, 0x7f, 0x38, 0xc7, 0x94, - 0xe1, 0x35, 0x1a, 0x33, 0x09, 0x85, 0xc7, 0xe0, 0x7f, 0x1c, 0x28, 0x75, 0x36, 0x6c, 0xcf, 0x12, - 0x67, 0x9d, 0xfd, 0xcb, 0x3d, 0x5a, 0x01, 0x7b, 0xa9, 0x5e, 0xa6, 0xb9, 0xdd, 0x22, 0xfe, 0x49, - 0x72, 0xe1, 0xbb, 0xbb, 0x7d, 0xf7, 0x31, 0xb0, 0x54, 0xa7, 0xb5, 0x8d, 0x9e, 0xab, 0xd3, 0xdf, - 0xe2, 0xf6, 0xa2, 0x97, 0xb1, 0xdb, 0x87, 0x9f, 0x73, 0x20, 0xd7, 0xa6, 0x36, 0x7c, 0x0d, 0xb6, - 0xe3, 0x69, 0xbb, 0xa7, 0xdc, 0x9a, 0xf0, 0xca, 0x6c, 0xac, 0x48, 0x0f, 0x56, 0xc2, 0xb1, 0x30, - 0xd4, 0x41, 0x21, 0x99, 0x38, 0x72, 0x3a, 0x25, 0xc6, 0xa5, 0xfd, 0xd5, 0x78, 0xa2, 0xe9, 0x01, - 0x98, 0xf2, 0x27, 0xac, 0xa7, 0xb3, 0x6f, 0x47, 0x4a, 0x8f, 0xd6, 0x8d, 0x5c, 0xce, 0xb8, 0xd4, - 0x88, 0x2b, 0x32, 0x2e, 0x46, 0xae, 0xca, 0x98, 0x5e, 0x10, 0xed, 0xe5, 0xe5, 0x44, 0x16, 0xae, - 0x26, 0xb2, 0xf0, 0x6b, 0x22, 0x0b, 0x5f, 0xa6, 0x72, 0xe6, 0x6a, 0x2a, 0x67, 0x7e, 0x4c, 0xe5, - 0xcc, 0xbb, 0xf9, 0x6e, 0x09, 0x54, 0x1b, 0x7d, 0x64, 0x50, 0xbe, 0x52, 0x47, 0xe1, 0x5b, 0xcd, - 0x3b, 0xc6, 0xd8, 0xe2, 0x6f, 0xe8, 0xe3, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0xd0, 0xde, 0xef, - 0x15, 0xc5, 0x07, 0x00, 0x00, + // 617 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x95, 0xbf, 0x6f, 0xd3, 0x40, + 0x14, 0xc7, 0xe3, 0x24, 0xb4, 0xcd, 0x45, 0x0c, 0x1c, 0x89, 0xe4, 0x1a, 0xc5, 0x89, 0x22, 0x51, + 0x65, 0x20, 0x36, 0x29, 0x02, 0x21, 0x16, 0xa8, 0x9b, 0x56, 0x42, 0x22, 0x42, 0x72, 0x2b, 0x21, + 0xb1, 0x44, 0x67, 0xfb, 0x70, 0xac, 0xc4, 0x3e, 0xe3, 0xbb, 0x36, 0xe9, 0x7f, 0xc0, 0x84, 0x98, + 0x98, 0x59, 0xd9, 0xbb, 0xb3, 0x76, 0xac, 0x3a, 0x21, 0x86, 0x0a, 0x25, 0xff, 0x08, 0xf2, 0xcf, + 0x34, 0x89, 0x15, 0x92, 0x2e, 0x88, 0xed, 0xce, 0xdf, 0xf7, 0xbe, 0x77, 0xf7, 0xb9, 0xe7, 0x77, + 0x40, 0xe8, 0xa3, 0x53, 0x24, 0xd3, 0x21, 0x72, 0xe5, 0xd3, 0x96, 0x86, 0x19, 0x6a, 0xc9, 0x6c, + 0x24, 0xb9, 0x1e, 0x61, 0x04, 0xde, 0xf3, 0x35, 0xc9, 0xd7, 0xa4, 0x48, 0x13, 0x44, 0x9d, 0x50, + 0x9b, 0x50, 0x59, 0x43, 0x14, 0x27, 0x09, 0x3a, 0xb1, 0x9c, 0x30, 0x45, 0xd8, 0x0e, 0xf5, 0x6e, + 0x30, 0x93, 0xc3, 0x49, 0x24, 0x95, 0x4c, 0x62, 0x92, 0xf0, 0xbb, 0x3f, 0x0a, 0xbf, 0xd6, 0xbf, + 0x67, 0x01, 0xe8, 0x50, 0xb3, 0x8d, 0x5d, 0x42, 0x2d, 0x06, 0x9f, 0x81, 0x82, 0x11, 0x0e, 0x89, + 0xc7, 0x73, 0x35, 0xae, 0x51, 0x50, 0xf8, 0xab, 0xf3, 0x66, 0x29, 0x72, 0xda, 0x33, 0x0c, 0x0f, + 0x53, 0x7a, 0xc4, 0x3c, 0xcb, 0x31, 0xd5, 0x69, 0x28, 0x7c, 0x0e, 0x36, 0x19, 0xe9, 0x63, 0xa7, + 0x8b, 0xf8, 0x6c, 0x8d, 0x6b, 0x14, 0x77, 0xb7, 0xa5, 0x28, 0xc5, 0xdf, 0x69, 0xbc, 0x7d, 0x69, + 0x9f, 0x58, 0x8e, 0x92, 0xbf, 0xb8, 0xae, 0x66, 0xd4, 0x8d, 0x20, 0x7e, 0x6f, 0x9a, 0xa9, 0xf1, + 0xb9, 0x75, 0x32, 0x15, 0xd8, 0x01, 0x5b, 0x74, 0x60, 0xb9, 0x2e, 0x32, 0x31, 0x9f, 0x0f, 0xb6, + 0xda, 0xf2, 0xf5, 0x5f, 0xd7, 0xd5, 0x07, 0xa1, 0x03, 0x35, 0xfa, 0x92, 0x45, 0x64, 0x1b, 0xb1, + 0x9e, 0xf4, 0x06, 0x9b, 0x48, 0x3f, 0x6b, 0x63, 0xfd, 0xea, 0xbc, 0x09, 0xa2, 0x05, 0xda, 0x58, + 0x57, 0x13, 0x0b, 0x28, 0x80, 0x2d, 0x03, 0x23, 0x63, 0x60, 0x39, 0x98, 0xbf, 0x53, 0xe3, 0x1a, + 0x39, 0x35, 0x99, 0xbf, 0xc8, 0x7f, 0xfa, 0x56, 0xcd, 0xd4, 0x4b, 0x00, 0x4e, 0x51, 0xa9, 0x98, + 0xba, 0xc4, 0xa1, 0xb8, 0xfe, 0x35, 0x0b, 0x8a, 0x1d, 0x6a, 0xbe, 0xb3, 0x58, 0xcf, 0xf0, 0xd0, + 0x10, 0x3e, 0x02, 0xf9, 0x0f, 0x1e, 0xb1, 0xff, 0x4a, 0x2f, 0x88, 0x82, 0x4f, 0xc1, 0x06, 0xed, + 0x21, 0x0f, 0xd3, 0x80, 0x5b, 0x41, 0xa9, 0x44, 0x47, 0x28, 0x2f, 0x1e, 0xe1, 0xb5, 0xc3, 0xd4, + 0x28, 0x18, 0xbe, 0x04, 0x45, 0xdb, 0x72, 0xba, 0x31, 0xf3, 0x15, 0xc9, 0x15, 0x6c, 0xcb, 0x39, + 0x0e, 0xb1, 0xcf, 0x18, 0x68, 0x01, 0xbf, 0x75, 0x0c, 0x94, 0x15, 0x70, 0x95, 0xc1, 0xfd, 0x1b, + 0x5c, 0x12, 0x5e, 0x3f, 0xb2, 0xa0, 0xdc, 0xa1, 0xe6, 0xd1, 0x10, 0xb9, 0x07, 0x23, 0xa4, 0xb3, + 0x43, 0xe2, 0x05, 0x96, 0xd4, 0x2f, 0x3e, 0x0f, 0x7f, 0x3c, 0xc1, 0x94, 0xe1, 0x15, 0x8a, 0x2f, + 0x09, 0x85, 0xfb, 0xe0, 0x2e, 0xf6, 0x9d, 0xba, 0x6b, 0x96, 0x60, 0x31, 0xc8, 0x3a, 0xfe, 0xef, + 0xea, 0xb0, 0x0a, 0x2a, 0xa9, 0x00, 0xd3, 0x10, 0x1f, 0x12, 0xef, 0x20, 0x39, 0xe5, 0xed, 0x11, + 0xdf, 0xfe, 0xff, 0x9e, 0xbb, 0x9c, 0x95, 0xe9, 0xde, 0xb8, 0x9c, 0x7f, 0x8a, 0x78, 0x16, 0x60, + 0x8c, 0x78, 0xf7, 0x73, 0x0e, 0xe4, 0x3a, 0xd4, 0x84, 0x6f, 0xc1, 0x66, 0xdc, 0x3b, 0x2b, 0xd2, + 0x42, 0xbf, 0x96, 0xa6, 0xfd, 0x42, 0x78, 0xb8, 0x54, 0x8e, 0x8d, 0xa1, 0x0a, 0xb6, 0x92, 0x56, + 0x22, 0xa6, 0xa7, 0xc4, 0xba, 0xb0, 0xb3, 0x5c, 0x4f, 0x3c, 0x5d, 0x00, 0x53, 0x7e, 0xb7, 0x46, + 0x7a, 0xf6, 0x62, 0xa4, 0xf0, 0x78, 0xd5, 0xc8, 0xf9, 0x15, 0xe7, 0xaa, 0x6f, 0xc9, 0x8a, 0xb3, + 0x91, 0xcb, 0x56, 0x4c, 0xbf, 0x10, 0xe5, 0xd5, 0xc5, 0x58, 0xe4, 0x2e, 0xc7, 0x22, 0xf7, 0x7b, + 0x2c, 0x72, 0x5f, 0x26, 0x62, 0xe6, 0x72, 0x22, 0x66, 0x7e, 0x4e, 0xc4, 0xcc, 0xfb, 0x1d, 0xd3, + 0x62, 0xbd, 0x13, 0x4d, 0xd2, 0x89, 0x2d, 0xfb, 0xae, 0xcd, 0x01, 0xd2, 0x68, 0x30, 0x92, 0x47, + 0xe1, 0xcb, 0xcb, 0xce, 0x5c, 0x4c, 0xb5, 0x8d, 0xe0, 0x45, 0x7c, 0xf2, 0x27, 0x00, 0x00, 0xff, + 0xff, 0x6b, 0xfa, 0xf0, 0x95, 0x93, 0x07, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -597,6 +597,7 @@ func _Msg_SwapForExactTokens_Handler(srv interface{}, ctx context.Context, dec f return interceptor(ctx, in, info, handler) } +var Msg_serviceDesc = _Msg_serviceDesc var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "kava.swap.v1beta1.Msg", HandlerType: (*MsgServer)(nil), diff --git a/x/validator-vesting/keeper/grpc_query.go b/x/validator-vesting/keeper/grpc_query.go index c633638f47..38c62e1840 100644 --- a/x/validator-vesting/keeper/grpc_query.go +++ b/x/validator-vesting/keeper/grpc_query.go @@ -37,7 +37,7 @@ func (s queryServer) TotalSupply(c context.Context, req *types.QueryTotalSupplyR ctx := sdk.UnwrapSDKContext(c) totalSupply := s.bk.GetSupply(ctx, "ukava").Amount - supplyInt := sdk.NewDecFromInt(totalSupply).Mul(sdk.MustNewDecFromStr("0.000001")).TruncateInt() + supplyInt := sdkmath.LegacyNewDecFromInt(totalSupply).Mul(sdkmath.LegacyMustNewDecFromStr("0.000001")).TruncateInt() return &types.QueryTotalSupplyResponse{ Amount: supplyInt, }, nil @@ -98,7 +98,7 @@ func (s queryServer) CirculatingSupplyHARD(c context.Context, req *types.QueryCi time.Date(2024, 9, 15, 14, 0, 0, 0, time.UTC), // + 1,666,667 *** Year FOUR *** } - circSupply := sdk.ZeroInt() + circSupply := sdkmath.ZeroInt() blockTime := ctx.BlockTime() switch { case blockTime.Before(supplyIncreaseDates[0]): @@ -213,7 +213,7 @@ func (s queryServer) CirculatingSupplyUSDX(c context.Context, req *types.QueryCi ctx := sdk.UnwrapSDKContext(c) totalSupply := s.bk.GetSupply(ctx, "usdx").Amount - supplyInt := sdk.NewDecFromInt(totalSupply).Mul(sdk.MustNewDecFromStr("0.000001")).TruncateInt() + supplyInt := sdkmath.LegacyNewDecFromInt(totalSupply).Mul(sdkmath.LegacyMustNewDecFromStr("0.000001")).TruncateInt() return &types.QueryCirculatingSupplyUSDXResponse{ Amount: supplyInt, }, nil @@ -289,7 +289,7 @@ func (s queryServer) CirculatingSupplySWP(c context.Context, req *types.QueryCir scheduleAmounts = append(scheduleAmounts, []int64{0, 0, 0, monthlyStakersSwp, monthlyLPIncentivesSwp}) } - circSupply := sdk.ZeroInt() + circSupply := sdkmath.ZeroInt() blockTime := ctx.BlockTime() for i := 0; i < len(scheduleAmounts); i++ { @@ -316,7 +316,7 @@ func (s queryServer) TotalSupplyHARD(c context.Context, req *types.QueryTotalSup ctx := sdk.UnwrapSDKContext(c) totalSupply := s.bk.GetSupply(ctx, "hard").Amount - supplyInt := sdk.NewDecFromInt(totalSupply).Mul(sdk.MustNewDecFromStr("0.000001")).TruncateInt() + supplyInt := sdkmath.LegacyNewDecFromInt(totalSupply).Mul(sdkmath.LegacyMustNewDecFromStr("0.000001")).TruncateInt() return &types.QueryTotalSupplyHARDResponse{ Amount: supplyInt, }, nil @@ -344,15 +344,15 @@ func getCirculatingSupply(blockTime time.Time, totalSupply sdkmath.Int) sdkmath. switch { case blockTime.Before(vestingDates[0]): - return sdk.NewDecFromInt(totalSupply.Sub(sdkmath.NewInt(9937500000000))).Mul(sdk.MustNewDecFromStr("0.000001")).RoundInt() + return sdkmath.LegacyNewDecFromInt(totalSupply.Sub(sdkmath.NewInt(9937500000000))).Mul(sdkmath.LegacyMustNewDecFromStr("0.000001")).RoundInt() case blockTime.After(vestingDates[0]) && blockTime.Before(vestingDates[1]) || blockTime.Equal(vestingDates[0]): - return sdk.NewDecFromInt(totalSupply.Sub(sdkmath.NewInt(7453125000000))).Mul(sdk.MustNewDecFromStr("0.000001")).RoundInt() + return sdkmath.LegacyNewDecFromInt(totalSupply.Sub(sdkmath.NewInt(7453125000000))).Mul(sdkmath.LegacyMustNewDecFromStr("0.000001")).RoundInt() case blockTime.After(vestingDates[1]) && blockTime.Before(vestingDates[2]) || blockTime.Equal(vestingDates[1]): - return sdk.NewDecFromInt(totalSupply.Sub(sdkmath.NewInt(4968750000000))).Mul(sdk.MustNewDecFromStr("0.000001")).RoundInt() + return sdkmath.LegacyNewDecFromInt(totalSupply.Sub(sdkmath.NewInt(4968750000000))).Mul(sdkmath.LegacyMustNewDecFromStr("0.000001")).RoundInt() case blockTime.After(vestingDates[2]) && blockTime.Before(vestingDates[3]) || blockTime.Equal(vestingDates[2]): - return sdk.NewDecFromInt(totalSupply.Sub(sdkmath.NewInt(2484375000000))).Mul(sdk.MustNewDecFromStr("0.000001")).RoundInt() + return sdkmath.LegacyNewDecFromInt(totalSupply.Sub(sdkmath.NewInt(2484375000000))).Mul(sdkmath.LegacyMustNewDecFromStr("0.000001")).RoundInt() default: // align with total supply calculation and truncate int here instead of round - return sdk.NewDecFromInt(totalSupply).Mul(sdk.MustNewDecFromStr("0.000001")).TruncateInt() + return sdkmath.LegacyNewDecFromInt(totalSupply).Mul(sdkmath.LegacyMustNewDecFromStr("0.000001")).TruncateInt() } } diff --git a/x/validator-vesting/keeper/grpc_query_test.go b/x/validator-vesting/keeper/grpc_query_test.go index b6c22c0eeb..0c8f74348c 100644 --- a/x/validator-vesting/keeper/grpc_query_test.go +++ b/x/validator-vesting/keeper/grpc_query_test.go @@ -28,18 +28,18 @@ type mockBankKeeper struct { supply sdk.Coin } -func (m *mockBankKeeper) SetSupply(ctx sdk.Context, denom string, amt sdkmath.Int) { +func (m *mockBankKeeper) SetSupply(ctx context.Context, denom string, amt sdkmath.Int) { m.supply = sdk.NewCoin(denom, amt) } -func (m *mockBankKeeper) GetSupply(ctx sdk.Context, denom string) sdk.Coin { +func (m *mockBankKeeper) GetSupply(ctx context.Context, denom string) sdk.Coin { return m.supply } func (suite *grpcQueryTestSuite) SetupTest() { testTime := time.Date(2024, 2, 29, 12, 00, 00, 00, time.UTC) tApp := app.NewTestApp() - ctx := tApp.NewContext(true, tmproto.Header{Height: 1, Time: testTime}) + ctx := tApp.NewContextLegacy(true, tmproto.Header{Height: 1, Time: testTime}) suite.app = tApp suite.ctx = ctx suite.bk = &mockBankKeeper{} diff --git a/x/validator-vesting/module.go b/x/validator-vesting/module.go index 39fa0c6165..ae3de2a58a 100644 --- a/x/validator-vesting/module.go +++ b/x/validator-vesting/module.go @@ -116,10 +116,16 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw func (AppModule) ConsensusVersion() uint64 { return 1 } // BeginBlock executes all ABCI BeginBlock logic respective to validator-vesting module. -func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) {} +func (am AppModule) BeginBlock(ctx sdk.Context) error { + return nil +} // EndBlock executes all ABCI EndBlock logic respective to validator-vesting module. It // returns no validator updates. -func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - return []abci.ValidatorUpdate{} +func (am AppModule) EndBlock(_ sdk.Context) ([]abci.ValidatorUpdate, error) { + return []abci.ValidatorUpdate{}, nil } + +func (AppModule) IsOnePerModuleType() {} + +func (AppModule) IsAppModule() {} diff --git a/x/validator-vesting/types/expected_keepers.go b/x/validator-vesting/types/expected_keepers.go index 0157c8739e..dd4fa77b94 100644 --- a/x/validator-vesting/types/expected_keepers.go +++ b/x/validator-vesting/types/expected_keepers.go @@ -1,10 +1,11 @@ package types import ( + "context" sdk "github.com/cosmos/cosmos-sdk/types" ) // BankKeeper defines the expected bank keeper (noalias) type BankKeeper interface { - GetSupply(ctx sdk.Context, denom string) sdk.Coin + GetSupply(ctx context.Context, denom string) sdk.Coin } diff --git a/x/validator-vesting/types/query.pb.go b/x/validator-vesting/types/query.pb.go index b8a8442dcc..5253b5d2a5 100644 --- a/x/validator-vesting/types/query.pb.go +++ b/x/validator-vesting/types/query.pb.go @@ -5,9 +5,9 @@ package types import ( context "context" + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" _ "github.com/cosmos/cosmos-proto" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" @@ -70,7 +70,7 @@ var xxx_messageInfo_QueryCirculatingSupplyRequest proto.InternalMessageInfo // QueryCirculatingSupplyResponse is the response type for the Query/CirculatingSupply RPC method type QueryCirculatingSupplyResponse struct { - Amount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"amount"` + Amount cosmossdk_io_math.Int `protobuf:"bytes,1,opt,name=amount,proto3,customtype=cosmossdk.io/math.Int" json:"amount"` } func (m *QueryCirculatingSupplyResponse) Reset() { *m = QueryCirculatingSupplyResponse{} } @@ -145,7 +145,7 @@ var xxx_messageInfo_QueryTotalSupplyRequest proto.InternalMessageInfo // QueryTotalSupplyResponse is the response type for the Query/TotalSupply RPC method type QueryTotalSupplyResponse struct { - Amount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"amount"` + Amount cosmossdk_io_math.Int `protobuf:"bytes,1,opt,name=amount,proto3,customtype=cosmossdk.io/math.Int" json:"amount"` } func (m *QueryTotalSupplyResponse) Reset() { *m = QueryTotalSupplyResponse{} } @@ -220,7 +220,7 @@ var xxx_messageInfo_QueryCirculatingSupplyHARDRequest proto.InternalMessageInfo // QueryCirculatingSupplyHARDResponse is the response type for the Query/CirculatingSupplyHARD RPC method type QueryCirculatingSupplyHARDResponse struct { - Amount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"amount"` + Amount cosmossdk_io_math.Int `protobuf:"bytes,1,opt,name=amount,proto3,customtype=cosmossdk.io/math.Int" json:"amount"` } func (m *QueryCirculatingSupplyHARDResponse) Reset() { *m = QueryCirculatingSupplyHARDResponse{} } @@ -295,7 +295,7 @@ var xxx_messageInfo_QueryCirculatingSupplyUSDXRequest proto.InternalMessageInfo // QueryCirculatingSupplyUSDXResponse is the response type for the Query/CirculatingSupplyUSDX RPC method type QueryCirculatingSupplyUSDXResponse struct { - Amount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"amount"` + Amount cosmossdk_io_math.Int `protobuf:"bytes,1,opt,name=amount,proto3,customtype=cosmossdk.io/math.Int" json:"amount"` } func (m *QueryCirculatingSupplyUSDXResponse) Reset() { *m = QueryCirculatingSupplyUSDXResponse{} } @@ -370,7 +370,7 @@ var xxx_messageInfo_QueryCirculatingSupplySWPRequest proto.InternalMessageInfo // QueryCirculatingSupplySWPResponse is the response type for the Query/CirculatingSupplySWP RPC method type QueryCirculatingSupplySWPResponse struct { - Amount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"amount"` + Amount cosmossdk_io_math.Int `protobuf:"bytes,1,opt,name=amount,proto3,customtype=cosmossdk.io/math.Int" json:"amount"` } func (m *QueryCirculatingSupplySWPResponse) Reset() { *m = QueryCirculatingSupplySWPResponse{} } @@ -445,7 +445,7 @@ var xxx_messageInfo_QueryTotalSupplyHARDRequest proto.InternalMessageInfo // QueryTotalSupplyHARDResponse is the response type for the Query/TotalSupplyHARD RPC method type QueryTotalSupplyHARDResponse struct { - Amount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"amount"` + Amount cosmossdk_io_math.Int `protobuf:"bytes,1,opt,name=amount,proto3,customtype=cosmossdk.io/math.Int" json:"amount"` } func (m *QueryTotalSupplyHARDResponse) Reset() { *m = QueryTotalSupplyHARDResponse{} } @@ -520,7 +520,7 @@ var xxx_messageInfo_QueryTotalSupplyUSDXRequest proto.InternalMessageInfo // QueryTotalSupplyUSDXResponse is the response type for the Query/TotalSupplyUSDX RPC method type QueryTotalSupplyUSDXResponse struct { - Amount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"amount"` + Amount cosmossdk_io_math.Int `protobuf:"bytes,1,opt,name=amount,proto3,customtype=cosmossdk.io/math.Int" json:"amount"` } func (m *QueryTotalSupplyUSDXResponse) Reset() { *m = QueryTotalSupplyUSDXResponse{} } @@ -578,46 +578,46 @@ func init() { } var fileDescriptor_2198ebff70588a65 = []byte{ - // 619 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x96, 0xcb, 0x6e, 0xd3, 0x4c, - 0x14, 0xc7, 0x33, 0x9f, 0xf4, 0x55, 0x62, 0xba, 0x40, 0x8c, 0x8a, 0x68, 0x4d, 0xe3, 0x14, 0x23, - 0x21, 0x90, 0x88, 0xad, 0x34, 0x55, 0x4b, 0x2f, 0xd0, 0x0b, 0x5d, 0xd0, 0x1d, 0x4d, 0x8a, 0x40, - 0x6c, 0xa2, 0x49, 0x62, 0xb9, 0x56, 0x1d, 0x8f, 0xeb, 0x19, 0x9b, 0x86, 0x25, 0x4f, 0x80, 0xc4, - 0xab, 0x74, 0xc3, 0x03, 0x20, 0x65, 0xc1, 0xa2, 0x82, 0x0d, 0x20, 0x51, 0x41, 0xc2, 0x83, 0x20, - 0x8f, 0x27, 0xaa, 0xeb, 0xb8, 0x29, 0x76, 0x14, 0x58, 0x25, 0xb1, 0xcf, 0xe5, 0xf7, 0xf7, 0x39, - 0xf3, 0x77, 0xe0, 0xbd, 0x03, 0xec, 0x63, 0xcd, 0xc7, 0x96, 0xd9, 0xc4, 0x8c, 0xb8, 0xbe, 0x4e, - 0x99, 0x69, 0x1b, 0x9a, 0x5f, 0xaa, 0xeb, 0x0c, 0x97, 0xb4, 0x43, 0x4f, 0x77, 0xdb, 0xaa, 0xe3, - 0x12, 0x46, 0x50, 0x3e, 0x08, 0x55, 0xe3, 0xa1, 0xaa, 0x08, 0x95, 0x66, 0x1a, 0x84, 0xb6, 0x08, - 0xad, 0xf1, 0x60, 0x2d, 0xfc, 0x11, 0x66, 0x4a, 0x53, 0x06, 0x31, 0x48, 0x78, 0x3d, 0xf8, 0x26, - 0xae, 0xce, 0x1a, 0x84, 0x18, 0x96, 0xae, 0x61, 0xc7, 0xd4, 0xb0, 0x6d, 0x13, 0x86, 0x99, 0x49, - 0x6c, 0x91, 0xa3, 0x14, 0x60, 0x7e, 0x37, 0x68, 0xfe, 0xd8, 0x74, 0x1b, 0x9e, 0x85, 0x83, 0x56, - 0x55, 0xcf, 0x71, 0xac, 0x76, 0x45, 0x3f, 0xf4, 0x74, 0xca, 0x14, 0x1f, 0xca, 0x17, 0x05, 0x50, - 0x87, 0xd8, 0x54, 0x47, 0x7b, 0x70, 0x02, 0xb7, 0x88, 0x67, 0xb3, 0x69, 0x30, 0x07, 0xee, 0x5e, - 0xd9, 0x5a, 0xeb, 0x9c, 0x16, 0x72, 0xdf, 0x4e, 0x0b, 0x77, 0x0c, 0x93, 0xed, 0x7b, 0x75, 0xb5, - 0x41, 0x5a, 0x82, 0x53, 0x7c, 0x14, 0x69, 0xf3, 0x40, 0x63, 0x6d, 0x47, 0xa7, 0xea, 0x8e, 0xcd, - 0x3e, 0x1d, 0x17, 0xa1, 0x90, 0xb1, 0x63, 0xb3, 0x8a, 0xa8, 0xa5, 0xcc, 0xc0, 0x1b, 0xbc, 0xef, - 0x1e, 0x61, 0xd8, 0x3a, 0x8f, 0xe4, 0xc0, 0xe9, 0xc1, 0x5b, 0x63, 0x85, 0xb9, 0x0d, 0x6f, 0x25, - 0x3f, 0x84, 0x27, 0x9b, 0x95, 0xed, 0x3e, 0xd6, 0x6b, 0xa8, 0x0c, 0x0b, 0xfa, 0x37, 0x80, 0xcf, - 0xaa, 0xdb, 0x2f, 0x2e, 0x05, 0x0c, 0x83, 0xc6, 0x0a, 0xa8, 0xc0, 0xb9, 0xe4, 0xde, 0xd5, 0xe7, - 0x4f, 0xfb, 0x7c, 0xed, 0x8b, 0x44, 0xf0, 0x98, 0xb1, 0xe2, 0xe5, 0xe1, 0xcd, 0xf8, 0x4a, 0x45, - 0x47, 0xcb, 0xe0, 0x6c, 0xf2, 0xed, 0xbf, 0x0d, 0x15, 0x1d, 0x67, 0x02, 0xd4, 0xf8, 0x07, 0x39, - 0xff, 0x7e, 0x12, 0xfe, 0xcf, 0xdb, 0xa2, 0x8f, 0x00, 0x5e, 0x1b, 0x18, 0x15, 0x5a, 0x53, 0x87, - 0xfa, 0x97, 0x3a, 0xd4, 0x6d, 0xa4, 0x87, 0x19, 0xb3, 0x43, 0xc9, 0xca, 0xca, 0x9b, 0xcf, 0xbf, - 0xde, 0xfd, 0xb7, 0x80, 0xe6, 0xb5, 0xf3, 0x7e, 0x5b, 0x8c, 0x1b, 0x6e, 0xe3, 0xac, 0x44, 0x8d, - 0x86, 0xe0, 0xc7, 0x00, 0x4e, 0x46, 0x1e, 0x25, 0x5a, 0xfc, 0x13, 0x94, 0x41, 0x77, 0x92, 0x96, - 0x52, 0xe7, 0x09, 0xf8, 0x05, 0x0e, 0xaf, 0xa2, 0xfb, 0x97, 0xc1, 0xb3, 0x20, 0xb9, 0x8f, 0xfd, - 0x1d, 0xc0, 0xeb, 0x89, 0x8e, 0x83, 0x36, 0x32, 0x3d, 0xcb, 0xc8, 0xda, 0x4b, 0x9b, 0x23, 0x54, - 0x10, 0xa2, 0xd6, 0xb9, 0xa8, 0x65, 0xb4, 0x94, 0x7e, 0x22, 0xb5, 0x7d, 0xec, 0x36, 0x93, 0xf5, - 0x05, 0x7b, 0x9e, 0x51, 0x5f, 0xe4, 0x04, 0x65, 0xd4, 0x17, 0x3d, 0x64, 0x23, 0xe9, 0xf3, 0x68, - 0xf3, 0x08, 0x7d, 0x05, 0x70, 0x2a, 0xc9, 0xf0, 0xd0, 0x7a, 0x26, 0xb8, 0x33, 0x3b, 0x95, 0x36, - 0xb2, 0x17, 0x10, 0xe2, 0x1e, 0x71, 0x71, 0x0f, 0xd0, 0x62, 0x06, 0x71, 0xf4, 0x95, 0x83, 0x3e, - 0x00, 0x78, 0x35, 0x66, 0x99, 0x68, 0x25, 0xe5, 0xf1, 0x88, 0xee, 0xe3, 0x6a, 0xa6, 0x5c, 0x21, - 0x66, 0x99, 0x8b, 0x29, 0xa3, 0x52, 0x9a, 0xe3, 0x15, 0xee, 0x60, 0x4c, 0x07, 0xdf, 0xbe, 0xb4, - 0x3a, 0xa2, 0x7b, 0xb7, 0x9a, 0x29, 0x77, 0x24, 0x1d, 0xc1, 0xae, 0x6d, 0xed, 0x76, 0x7e, 0xca, - 0xb9, 0x4e, 0x57, 0x06, 0x27, 0x5d, 0x19, 0xfc, 0xe8, 0xca, 0xe0, 0x6d, 0x4f, 0xce, 0x9d, 0xf4, - 0xe4, 0xdc, 0x97, 0x9e, 0x9c, 0x7b, 0x59, 0x8e, 0xbc, 0x17, 0x82, 0xd2, 0x45, 0x0b, 0xd7, 0x69, - 0xd8, 0xe4, 0x28, 0xa1, 0x0d, 0x7f, 0x51, 0xd4, 0x27, 0xf8, 0xdf, 0xc8, 0xf2, 0xef, 0x00, 0x00, - 0x00, 0xff, 0xff, 0xbd, 0x0f, 0x0a, 0x7d, 0xe1, 0x0a, 0x00, 0x00, + // 612 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x96, 0xcf, 0x6e, 0xd3, 0x40, + 0x10, 0xc6, 0xbd, 0x48, 0x54, 0x62, 0x7b, 0x40, 0xac, 0x5a, 0xd1, 0x9a, 0xc6, 0x29, 0xe6, 0x02, + 0x82, 0xd8, 0x4a, 0x53, 0xb5, 0xb4, 0x05, 0xfa, 0xf7, 0x40, 0x6f, 0x34, 0x01, 0x81, 0xb8, 0x44, + 0x1b, 0xc7, 0x72, 0xac, 0x3a, 0x5e, 0xd7, 0xbb, 0x0e, 0xcd, 0x95, 0x27, 0x40, 0xe2, 0x55, 0x7a, + 0xe1, 0x01, 0x90, 0x72, 0xe0, 0x50, 0xc1, 0x05, 0x90, 0xa8, 0x20, 0xe1, 0x41, 0x90, 0xd7, 0x8e, + 0xea, 0x3a, 0x6e, 0x82, 0x9d, 0xc0, 0x2d, 0xb1, 0x67, 0x76, 0x7e, 0xdf, 0xce, 0xcc, 0x27, 0xc3, + 0x7b, 0x87, 0xb8, 0x85, 0xd5, 0x16, 0xb6, 0xcc, 0x3a, 0x66, 0xc4, 0x6d, 0xe9, 0x94, 0x99, 0xb6, + 0xa1, 0xb6, 0x8a, 0x35, 0x9d, 0xe1, 0xa2, 0x7a, 0xe4, 0xe9, 0x6e, 0x5b, 0x71, 0x5c, 0xc2, 0x08, + 0xca, 0xf9, 0xa1, 0x4a, 0x3c, 0x54, 0x09, 0x43, 0xc5, 0x79, 0x8d, 0xd0, 0x26, 0xa1, 0x55, 0x1e, + 0xac, 0x06, 0x7f, 0x82, 0x4c, 0x71, 0xc6, 0x20, 0x06, 0x09, 0x9e, 0xfb, 0xbf, 0xc2, 0xa7, 0x0b, + 0x06, 0x21, 0x86, 0xa5, 0xab, 0xd8, 0x31, 0x55, 0x6c, 0xdb, 0x84, 0x61, 0x66, 0x12, 0x3b, 0xcc, + 0x91, 0xf3, 0x30, 0x77, 0xe0, 0x17, 0xdf, 0x35, 0x5d, 0xcd, 0xb3, 0xb0, 0x5f, 0xaa, 0xe2, 0x39, + 0x8e, 0xd5, 0x2e, 0xeb, 0x47, 0x9e, 0x4e, 0x99, 0xac, 0x43, 0xe9, 0xb2, 0x00, 0xea, 0x10, 0x9b, + 0xea, 0x68, 0x17, 0x4e, 0xe1, 0x26, 0xf1, 0x6c, 0x36, 0x07, 0x16, 0xc1, 0xdd, 0x6b, 0x3b, 0xf7, + 0x3b, 0x67, 0x79, 0xe1, 0xfb, 0x59, 0x7e, 0x36, 0x80, 0xa3, 0xf5, 0x43, 0xc5, 0x24, 0x6a, 0x13, + 0xb3, 0x86, 0xb2, 0x6f, 0xb3, 0xcf, 0x27, 0x05, 0x18, 0x52, 0xef, 0xdb, 0xac, 0x1c, 0xa6, 0xca, + 0xf3, 0xf0, 0x26, 0x2f, 0xf3, 0x9c, 0x30, 0x6c, 0x5d, 0x24, 0xa8, 0xc2, 0xb9, 0xc1, 0x57, 0x93, + 0xac, 0x7d, 0x07, 0xde, 0x4e, 0x96, 0xf8, 0x74, 0xbb, 0xbc, 0xd7, 0xa7, 0x30, 0xa1, 0x3c, 0x2c, + 0xe8, 0xbf, 0xf0, 0xbc, 0xa8, 0xec, 0xbd, 0x1a, 0xc9, 0x13, 0x04, 0x4d, 0x92, 0x47, 0x86, 0x8b, + 0xc9, 0xa5, 0x2a, 0x2f, 0x9f, 0xf5, 0x71, 0x1a, 0x97, 0x31, 0xf3, 0x98, 0x49, 0xd2, 0xe4, 0xe0, + 0xad, 0xf8, 0x38, 0x44, 0xfb, 0xa4, 0xc1, 0x85, 0xe4, 0xd7, 0xff, 0x98, 0x21, 0xda, 0x9b, 0x04, + 0x86, 0x89, 0x77, 0x65, 0xe9, 0xc3, 0x34, 0xbc, 0xca, 0xab, 0xa0, 0x4f, 0x00, 0xde, 0x18, 0xb8, + 0x77, 0xf4, 0x48, 0x19, 0x6a, 0x24, 0xca, 0xd0, 0xb5, 0x17, 0x1f, 0x67, 0xcc, 0x0e, 0x14, 0xca, + 0xeb, 0x6f, 0xbf, 0xfc, 0x7e, 0x7f, 0x65, 0x19, 0x2d, 0xa9, 0x17, 0x8d, 0xaf, 0x10, 0x77, 0x3e, + 0xed, 0xfc, 0x88, 0x2a, 0x0d, 0xc0, 0x4f, 0x00, 0x9c, 0x8e, 0xdc, 0x1c, 0x5a, 0xf9, 0x1b, 0x94, + 0x41, 0xdf, 0x10, 0x57, 0x53, 0xe7, 0x85, 0xf0, 0xcb, 0x1c, 0x5e, 0x41, 0x0f, 0x46, 0xc1, 0x33, + 0x3f, 0xb9, 0x8f, 0xfd, 0x03, 0xc0, 0xd9, 0x44, 0x73, 0x40, 0x5b, 0x99, 0xee, 0x32, 0x32, 0xd4, + 0xe2, 0xf6, 0x18, 0x27, 0x84, 0xa2, 0x36, 0xb9, 0xa8, 0x35, 0xb4, 0x9a, 0xbe, 0x23, 0xd5, 0x06, + 0x76, 0xeb, 0xc9, 0xfa, 0xfc, 0xb1, 0xce, 0xa8, 0x2f, 0xb2, 0x30, 0x19, 0xf5, 0x45, 0x77, 0x6a, + 0x2c, 0x7d, 0x1e, 0xad, 0x1f, 0xa3, 0x6f, 0x00, 0xce, 0x24, 0xb9, 0x17, 0xda, 0xcc, 0x04, 0x77, + 0xee, 0x8d, 0xe2, 0x56, 0xf6, 0x03, 0x42, 0x71, 0x4f, 0xb8, 0xb8, 0x87, 0x68, 0x25, 0x83, 0x38, + 0xfa, 0xc6, 0x41, 0x1f, 0x01, 0xbc, 0x1e, 0x33, 0x44, 0xb4, 0x9e, 0x72, 0x3d, 0xa2, 0xf3, 0xb8, + 0x91, 0x29, 0x37, 0x14, 0xb3, 0xc6, 0xc5, 0x94, 0x50, 0x31, 0xcd, 0x7a, 0x05, 0x33, 0x18, 0xd3, + 0xc1, 0xa7, 0x2f, 0xad, 0x8e, 0xe8, 0xdc, 0x6d, 0x64, 0xca, 0x1d, 0x4b, 0x87, 0x3f, 0x6b, 0x3b, + 0x07, 0x9d, 0x5f, 0x92, 0xd0, 0xe9, 0x4a, 0xe0, 0xb4, 0x2b, 0x81, 0x9f, 0x5d, 0x09, 0xbc, 0xeb, + 0x49, 0xc2, 0x69, 0x4f, 0x12, 0xbe, 0xf6, 0x24, 0xe1, 0x75, 0xc9, 0x30, 0x59, 0xc3, 0xab, 0x29, + 0x1a, 0x69, 0xf2, 0xa3, 0x0b, 0x16, 0xae, 0xd1, 0xa0, 0xc8, 0x71, 0x42, 0x19, 0xd6, 0x76, 0x74, + 0x5a, 0x9b, 0xe2, 0xdf, 0x73, 0xa5, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x81, 0x91, 0x3d, 0xae, + 0x6a, 0x0a, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -893,6 +893,7 @@ func _Query_TotalSupplyUSDX_Handler(srv interface{}, ctx context.Context, dec fu return interceptor(ctx, in, info, handler) } +var Query_serviceDesc = _Query_serviceDesc var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "kava.validatorvesting.v1beta1.Query", HandlerType: (*QueryServer)(nil),