diff --git a/e2e/tests/transfer/base_test.go b/e2e/tests/transfer/base_test.go index 577f4a89bd1..a8ae1a52c07 100644 --- a/e2e/tests/transfer/base_test.go +++ b/e2e/tests/transfer/base_test.go @@ -6,7 +6,8 @@ import ( "testing" "time" - // "cosmossdk.io/math" + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" paramsproposaltypes "github.com/cosmos/cosmos-sdk/x/params/types/proposal" "github.com/strangelove-ventures/interchaintest/v7/ibc" test "github.com/strangelove-ventures/interchaintest/v7/testutil" @@ -90,11 +91,11 @@ func (s *TransferTestSuite) TestMsgTransfer_Succeeds_Nonincentivized() { expected := testvalues.StartingTokenAmount - testvalues.IBCTransferAmount s.Require().Equal(expected, actualBalance) - // actualTotalEscrow, err := s.QueryTotalEscrowForDenom(ctx, chainA, chainADenom) - // s.Require().NoError(err) + actualTotalEscrow, err := s.QueryTotalEscrowForDenom(ctx, chainA, chainADenom) + s.Require().NoError(err) - // expectedTotalEscrow := math.NewInt(testvalues.IBCTransferAmount) - // s.Require().Equal(expectedTotalEscrow, actualTotalEscrow) + expectedTotalEscrow := sdk.NewCoin(chainADenom, math.NewInt(testvalues.IBCTransferAmount)) + s.Require().Equal(expectedTotalEscrow, actualTotalEscrow) }) t.Run("start relayer", func(t *testing.T) { @@ -125,9 +126,9 @@ func (s *TransferTestSuite) TestMsgTransfer_Succeeds_Nonincentivized() { s.Require().Equal(int64(0), actualBalance) - // actualTotalEscrow, err := s.QueryTotalEscrowForDenom(ctx, chainB, chainBIBCToken.IBCDenom()) - // s.Require().NoError(err) - // s.Require().Equal(math.ZeroInt(), actualTotalEscrow) // total escrow is zero because sending chain is not source for tokens + actualTotalEscrow, err := s.QueryTotalEscrowForDenom(ctx, chainB, chainBIBCToken.IBCDenom()) + s.Require().NoError(err) + s.Require().Equal(sdk.NewCoin(chainBIBCToken.IBCDenom(), sdk.NewInt(0)), actualTotalEscrow) // total escrow is zero because sending chain is not source for tokens }) s.Require().NoError(test.WaitForBlocks(ctx, 5, chainA, chainB), "failed to wait for blocks") @@ -142,11 +143,11 @@ func (s *TransferTestSuite) TestMsgTransfer_Succeeds_Nonincentivized() { s.Require().Equal(expected, actualBalance) }) - // t.Run("tokens are un-escrowed", func(t *testing.T) { - // actualTotalEscrow, err := s.QueryTotalEscrowForDenom(ctx, chainA, chainADenom) - // s.Require().NoError(err) - // s.Require().Equal(math.ZeroInt(), actualTotalEscrow) // total escrow is zero because tokens have come back - // }) + t.Run("tokens are un-escrowed", func(t *testing.T) { + actualTotalEscrow, err := s.QueryTotalEscrowForDenom(ctx, chainA, chainADenom) + s.Require().NoError(err) + s.Require().Equal(sdk.NewCoin(chainADenom, sdk.NewInt(0)), actualTotalEscrow) // total escrow is zero because tokens have come back + }) } // TestMsgTransfer_Fails_InvalidAddress attempts to send an IBC transfer to an invalid address and ensures diff --git a/e2e/testsuite/grpc_query.go b/e2e/testsuite/grpc_query.go index 4a83d863897..31cf5910176 100644 --- a/e2e/testsuite/grpc_query.go +++ b/e2e/testsuite/grpc_query.go @@ -5,7 +5,6 @@ import ( "fmt" "sort" - "cosmossdk.io/math" tmproto "github.com/cometbft/cometbft/proto/tendermint/types" "github.com/cosmos/cosmos-sdk/client/grpc/tmservice" sdk "github.com/cosmos/cosmos-sdk/types" @@ -163,13 +162,14 @@ func (s *E2ETestSuite) QueryPacketCommitment(ctx context.Context, chain ibc.Chai } // QueryTotalEscrowForDenom queries the total amount of tokens in escrow for a denom -func (s *E2ETestSuite) QueryTotalEscrowForDenom(ctx context.Context, chain ibc.Chain, denom string) (math.Int, error) { +func (s *E2ETestSuite) QueryTotalEscrowForDenom(ctx context.Context, chain ibc.Chain, denom string) (sdk.Coin, error) { queryClient := s.GetChainGRCPClients(chain).TransferQueryClient res, err := queryClient.TotalEscrowForDenom(ctx, &transfertypes.QueryTotalEscrowForDenomRequest{ Denom: denom, }) + if err != nil { - return math.ZeroInt(), err + return sdk.Coin{}, err } return res.Amount, nil diff --git a/modules/apps/transfer/keeper/genesis.go b/modules/apps/transfer/keeper/genesis.go index b31f53229e2..02b29d32ca1 100644 --- a/modules/apps/transfer/keeper/genesis.go +++ b/modules/apps/transfer/keeper/genesis.go @@ -32,7 +32,7 @@ func (k Keeper) InitGenesis(ctx sdk.Context, state types.GenesisState) { // Every denom will have only one total escrow amount, since any // duplicate entry will fail validation in Validate of GenesisState for _, denomEscrow := range state.TotalEscrowed { - k.SetTotalEscrowForDenom(ctx, denomEscrow.Denom, denomEscrow.Amount) + k.SetTotalEscrowForDenom(ctx, denomEscrow) } } diff --git a/modules/apps/transfer/keeper/genesis_test.go b/modules/apps/transfer/keeper/genesis_test.go index e878ffbe229..0ea92efcf52 100644 --- a/modules/apps/transfer/keeper/genesis_test.go +++ b/modules/apps/transfer/keeper/genesis_test.go @@ -41,7 +41,7 @@ func (suite *KeeperTestSuite) TestGenesis() { amount, ok := math.NewIntFromString(pathAndEscrowMount.escrow) suite.Require().True(ok) escrows = append(sdk.NewCoins(sdk.NewCoin(denom, amount)), escrows...) - suite.chainA.GetSimApp().TransferKeeper.SetTotalEscrowForDenom(suite.chainA.GetContext(), denom, amount) + suite.chainA.GetSimApp().TransferKeeper.SetTotalEscrowForDenom(suite.chainA.GetContext(), sdk.NewCoin(denom, amount)) } genesis := suite.chainA.GetSimApp().TransferKeeper.ExportGenesis(suite.chainA.GetContext()) diff --git a/modules/apps/transfer/keeper/grpc_query.go b/modules/apps/transfer/keeper/grpc_query.go index 256df6ee1f6..87648d2f9dc 100644 --- a/modules/apps/transfer/keeper/grpc_query.go +++ b/modules/apps/transfer/keeper/grpc_query.go @@ -134,9 +134,9 @@ func (k Keeper) TotalEscrowForDenom(c context.Context, req *types.QueryTotalEscr return nil, status.Error(codes.InvalidArgument, err.Error()) } - denomAmount := k.GetTotalEscrowForDenom(ctx, req.Denom) + amount := k.GetTotalEscrowForDenom(ctx, req.Denom) return &types.QueryTotalEscrowForDenomResponse{ - Amount: denomAmount, + Amount: amount, }, nil } diff --git a/modules/apps/transfer/keeper/grpc_query_test.go b/modules/apps/transfer/keeper/grpc_query_test.go index 32fa80b7f3c..38a97401120 100644 --- a/modules/apps/transfer/keeper/grpc_query_test.go +++ b/modules/apps/transfer/keeper/grpc_query_test.go @@ -282,7 +282,7 @@ func (suite *KeeperTestSuite) TestTotalEscrowForDenom() { } expEscrowAmount = math.NewInt(100) - suite.chainA.GetSimApp().TransferKeeper.SetTotalEscrowForDenom(suite.chainA.GetContext(), sdk.DefaultBondDenom, expEscrowAmount) + suite.chainA.GetSimApp().TransferKeeper.SetTotalEscrowForDenom(suite.chainA.GetContext(), sdk.NewCoin(sdk.DefaultBondDenom, expEscrowAmount)) }, true, }, @@ -297,7 +297,7 @@ func (suite *KeeperTestSuite) TestTotalEscrowForDenom() { suite.chainA.GetSimApp().TransferKeeper.SetDenomTrace(suite.chainA.GetContext(), denomTrace) expEscrowAmount, ok := math.NewIntFromString("100000000000000000000") suite.Require().True(ok) - suite.chainA.GetSimApp().TransferKeeper.SetTotalEscrowForDenom(suite.chainA.GetContext(), sdk.DefaultBondDenom, expEscrowAmount) + suite.chainA.GetSimApp().TransferKeeper.SetTotalEscrowForDenom(suite.chainA.GetContext(), sdk.NewCoin(sdk.DefaultBondDenom, expEscrowAmount)) req = &types.QueryTotalEscrowForDenomRequest{ Denom: denomTrace.IBCDenom(), @@ -343,7 +343,7 @@ func (suite *KeeperTestSuite) TestTotalEscrowForDenom() { suite.Run(fmt.Sprintf("Case %s", tc.msg), func() { suite.SetupTest() // reset - expEscrowAmount = math.ZeroInt() + expEscrowAmount = sdk.ZeroInt() tc.malleate() ctx := sdk.WrapSDKContext(suite.chainA.GetContext()) @@ -351,7 +351,7 @@ func (suite *KeeperTestSuite) TestTotalEscrowForDenom() { if tc.expPass { suite.Require().NoError(err) - suite.Require().Equal(expEscrowAmount, res.Amount) + suite.Require().Equal(expEscrowAmount, res.Amount.Amount) } else { suite.Require().Error(err) } diff --git a/modules/apps/transfer/keeper/keeper.go b/modules/apps/transfer/keeper/keeper.go index 9b54521d352..63e2847a680 100644 --- a/modules/apps/transfer/keeper/keeper.go +++ b/modules/apps/transfer/keeper/keeper.go @@ -4,7 +4,6 @@ import ( "fmt" "strings" - "cosmossdk.io/math" tmbytes "github.com/cometbft/cometbft/libs/bytes" "github.com/cometbft/cometbft/libs/log" "github.com/cosmos/cosmos-sdk/codec" @@ -12,6 +11,7 @@ import ( storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" @@ -146,28 +146,31 @@ func (k Keeper) IterateDenomTraces(ctx sdk.Context, cb func(denomTrace types.Den // GetTotalEscrowForDenom gets the total amount of source chain tokens that // are in escrow, keyed by the denomination. -func (k Keeper) GetTotalEscrowForDenom(ctx sdk.Context, denom string) math.Int { +// +// NOTE: if there is no value stored in state for the provided denom then a new Coin is returned for the denom with an initial value of zero. +// This accommodates callers to simply call `Add()` on the returned Coin as an empty Coin literal (e.g. sdk.Coin{}) will trigger a panic due to the absence of a denom. +func (k Keeper) GetTotalEscrowForDenom(ctx sdk.Context, denom string) sdk.Coin { store := ctx.KVStore(k.storeKey) bz := store.Get(types.TotalEscrowForDenomKey(denom)) if bz == nil { - return math.ZeroInt() + return sdk.NewCoin(denom, sdk.ZeroInt()) } amount := sdk.IntProto{} k.cdc.MustUnmarshal(bz, &amount) - return amount.Int + return sdk.NewCoin(denom, amount.Int) } // SetTotalEscrowForDenom stores the total amount of source chain tokens that are in escrow. -func (k Keeper) SetTotalEscrowForDenom(ctx sdk.Context, denom string, amount math.Int) { - if amount.IsNegative() { - panic(fmt.Sprintf("amount cannot be negative: %s", amount)) +func (k Keeper) SetTotalEscrowForDenom(ctx sdk.Context, coin sdk.Coin) { + if coin.Amount.IsNegative() { + panic(fmt.Sprintf("amount cannot be negative: %s", coin.Amount)) } store := ctx.KVStore(k.storeKey) - bz := k.cdc.MustMarshal(&sdk.IntProto{Int: amount}) - store.Set(types.TotalEscrowForDenomKey(denom), bz) + bz := k.cdc.MustMarshal(&sdk.IntProto{Int: coin.Amount}) + store.Set(types.TotalEscrowForDenomKey(coin.Denom), bz) } // GetAllTotalEscrowed returns the escrow information for all the denominations. diff --git a/modules/apps/transfer/keeper/keeper_test.go b/modules/apps/transfer/keeper/keeper_test.go index 9c3a7a2e4fd..c22489391cc 100644 --- a/modules/apps/transfer/keeper/keeper_test.go +++ b/modules/apps/transfer/keeper/keeper_test.go @@ -91,15 +91,15 @@ func (suite *KeeperTestSuite) TestSetGetTotalEscrowForDenom() { tc.malleate() if tc.expPass { - suite.chainA.GetSimApp().TransferKeeper.SetTotalEscrowForDenom(ctx, denom, expAmount) + suite.chainA.GetSimApp().TransferKeeper.SetTotalEscrowForDenom(ctx, sdk.NewCoin(denom, expAmount)) total := suite.chainA.GetSimApp().TransferKeeper.GetTotalEscrowForDenom(ctx, denom) - suite.Require().Equal(expAmount, total) + suite.Require().Equal(expAmount, total.Amount) } else { - suite.Require().PanicsWithValue("amount cannot be negative: -1", func() { - suite.chainA.GetSimApp().TransferKeeper.SetTotalEscrowForDenom(ctx, denom, expAmount) + suite.Require().PanicsWithError("negative coin amount: -1", func() { + suite.chainA.GetSimApp().TransferKeeper.SetTotalEscrowForDenom(ctx, sdk.NewCoin(denom, expAmount)) }) total := suite.chainA.GetSimApp().TransferKeeper.GetTotalEscrowForDenom(ctx, denom) - suite.Require().Equal(math.ZeroInt(), total) + suite.Require().Equal(math.ZeroInt(), total.Amount) } }) } diff --git a/modules/apps/transfer/keeper/migrations.go b/modules/apps/transfer/keeper/migrations.go index d9dfdcfb398..759f2e1d2b7 100644 --- a/modules/apps/transfer/keeper/migrations.go +++ b/modules/apps/transfer/keeper/migrations.go @@ -67,7 +67,7 @@ func (m Migrator) MigrateTotalEscrowForDenom(ctx sdk.Context) error { } for _, totalEscrow := range totalEscrowed { - m.keeper.SetTotalEscrowForDenom(ctx, totalEscrow.Denom, totalEscrow.Amount) + m.keeper.SetTotalEscrowForDenom(ctx, totalEscrow) } return nil diff --git a/modules/apps/transfer/keeper/migrations_test.go b/modules/apps/transfer/keeper/migrations_test.go index 23564dece4e..5faca42989d 100644 --- a/modules/apps/transfer/keeper/migrations_test.go +++ b/modules/apps/transfer/keeper/migrations_test.go @@ -197,7 +197,7 @@ func (suite *KeeperTestSuite) TestMigrateTotalEscrowForDenom() { // check that the migration set the expected amount for both native and IBC tokens amount := suite.chainA.GetSimApp().TransferKeeper.GetTotalEscrowForDenom(suite.chainA.GetContext(), denom) - suite.Require().Equal(tc.expectedEscrowAmt, amount) + suite.Require().Equal(tc.expectedEscrowAmt, amount.Amount) }) } } diff --git a/modules/apps/transfer/keeper/relay.go b/modules/apps/transfer/keeper/relay.go index 284ab4ca83f..756fa1c3b02 100644 --- a/modules/apps/transfer/keeper/relay.go +++ b/modules/apps/transfer/keeper/relay.go @@ -376,8 +376,8 @@ func (k Keeper) escrowToken(ctx sdk.Context, sender, escrowAddress sdk.AccAddres // track the total amount in escrow keyed by denomination to allow for efficient iteration currentTotalEscrow := k.GetTotalEscrowForDenom(ctx, token.GetDenom()) - newTotalEscrow := currentTotalEscrow.Add(token.Amount) - k.SetTotalEscrowForDenom(ctx, token.GetDenom(), newTotalEscrow) + newTotalEscrow := currentTotalEscrow.Add(token) + k.SetTotalEscrowForDenom(ctx, newTotalEscrow) return nil } @@ -395,8 +395,8 @@ func (k Keeper) unescrowToken(ctx sdk.Context, escrowAddress, receiver sdk.AccAd // track the total amount in escrow keyed by denomination to allow for efficient iteration currentTotalEscrow := k.GetTotalEscrowForDenom(ctx, token.GetDenom()) - newTotalEscrow := currentTotalEscrow.Sub(token.Amount) - k.SetTotalEscrowForDenom(ctx, token.GetDenom(), newTotalEscrow) + newTotalEscrow := currentTotalEscrow.Sub(token) + k.SetTotalEscrowForDenom(ctx, newTotalEscrow) return nil } diff --git a/modules/apps/transfer/keeper/relay_test.go b/modules/apps/transfer/keeper/relay_test.go index ddda92004ca..c59c7326979 100644 --- a/modules/apps/transfer/keeper/relay_test.go +++ b/modules/apps/transfer/keeper/relay_test.go @@ -145,7 +145,7 @@ func (suite *KeeperTestSuite) TestSendTransfer() { // check total amount in escrow of sent token denom on sending chain amount := suite.chainA.GetSimApp().TransferKeeper.GetTotalEscrowForDenom(suite.chainA.GetContext(), coin.GetDenom()) - suite.Require().Equal(expEscrowAmount, amount) + suite.Require().Equal(expEscrowAmount, amount.Amount) if tc.expPass { suite.Require().NoError(err) @@ -233,7 +233,7 @@ func (suite *KeeperTestSuite) TestSendTransferSetsTotalEscrowAmountForSourceIBCT // check total amount in escrow of sent token on sending chain totalEscrow := suite.chainB.GetSimApp().TransferKeeper.GetTotalEscrowForDenom(suite.chainB.GetContext(), coin.GetDenom()) - suite.Require().Equal(math.NewInt(100), totalEscrow) + suite.Require().Equal(math.NewInt(100), totalEscrow.Amount) } // test receiving coin on chainB with coin that orignate on chainA and @@ -385,14 +385,14 @@ func (suite *KeeperTestSuite) TestOnRecvPacket() { // check total amount in escrow of received token denom on receiving chain var denom string - var totalEscrow math.Int + var totalEscrow sdk.Coin if tc.recvIsSource { denom = sdk.DefaultBondDenom } else { denom = trace.IBCDenom() } totalEscrow = suite.chainB.GetSimApp().TransferKeeper.GetTotalEscrowForDenom(suite.chainB.GetContext(), denom) - suite.Require().Equal(expEscrowAmount, totalEscrow) + suite.Require().Equal(expEscrowAmount, totalEscrow.Amount) if tc.expPass { suite.Require().NoError(err) @@ -483,9 +483,9 @@ func (suite *KeeperTestSuite) TestOnRecvPacketSetsTotalEscrowAmountForSourceIBCT ), ) - suite.chainB.GetSimApp().TransferKeeper.SetTotalEscrowForDenom(suite.chainB.GetContext(), coin.GetDenom(), coin.Amount) + suite.chainB.GetSimApp().TransferKeeper.SetTotalEscrowForDenom(suite.chainB.GetContext(), coin) totalEscrowChainB := suite.chainB.GetSimApp().TransferKeeper.GetTotalEscrowForDenom(suite.chainB.GetContext(), coin.GetDenom()) - suite.Require().Equal(math.NewInt(100), totalEscrowChainB) + suite.Require().Equal(math.NewInt(100), totalEscrowChainB.Amount) // execute onRecvPacket, when chaninB receives the source token the escrow amount should decrease err := suite.chainB.GetSimApp().TransferKeeper.OnRecvPacket(suite.chainB.GetContext(), packet, data) @@ -493,7 +493,7 @@ func (suite *KeeperTestSuite) TestOnRecvPacketSetsTotalEscrowAmountForSourceIBCT // check total amount in escrow of sent token on reveiving chain totalEscrowChainB = suite.chainB.GetSimApp().TransferKeeper.GetTotalEscrowForDenom(suite.chainB.GetContext(), coin.GetDenom()) - suite.Require().Equal(math.ZeroInt(), totalEscrowChainB) + suite.Require().Equal(math.ZeroInt(), totalEscrowChainB.Amount) } // TestOnAcknowledgementPacket tests that successful acknowledgement is a no-op @@ -535,7 +535,7 @@ func (suite *KeeperTestSuite) TestOnAcknowledgementPacket() { suite.Require().NoError(banktestutil.FundAccount(suite.chainA.GetSimApp().BankKeeper, suite.chainA.GetContext(), escrow, sdk.NewCoins(coin))) // set escrow amount that would have been stored after successful execution of MsgTransfer - suite.chainA.GetSimApp().TransferKeeper.SetTotalEscrowForDenom(suite.chainA.GetContext(), sdk.DefaultBondDenom, amount) + suite.chainA.GetSimApp().TransferKeeper.SetTotalEscrowForDenom(suite.chainA.GetContext(), sdk.NewCoin(sdk.DefaultBondDenom, amount)) }, false, true, }, { @@ -545,7 +545,7 @@ func (suite *KeeperTestSuite) TestOnAcknowledgementPacket() { trace = types.ParseDenomTrace(sdk.DefaultBondDenom) // set escrow amount that would have been stored after successful execution of MsgTransfer - suite.chainA.GetSimApp().TransferKeeper.SetTotalEscrowForDenom(suite.chainA.GetContext(), sdk.DefaultBondDenom, amount) + suite.chainA.GetSimApp().TransferKeeper.SetTotalEscrowForDenom(suite.chainA.GetContext(), sdk.NewCoin(sdk.DefaultBondDenom, amount)) expEscrowAmount = math.NewInt(100) }, false, false, }, @@ -582,7 +582,7 @@ func (suite *KeeperTestSuite) TestOnAcknowledgementPacket() { // check total amount in escrow of sent token denom on sending chain totalEscrow := suite.chainA.GetSimApp().TransferKeeper.GetTotalEscrowForDenom(suite.chainA.GetContext(), trace.IBCDenom()) - suite.Require().Equal(expEscrowAmount, totalEscrow) + suite.Require().Equal(expEscrowAmount, totalEscrow.Amount) if tc.expPass { suite.Require().NoError(err) @@ -675,16 +675,16 @@ func (suite *KeeperTestSuite) TestOnAcknowledgementPacketSetsTotalEscrowAmountFo suite.chainA.GetTimeoutHeight(), 0, ) - suite.chainB.GetSimApp().TransferKeeper.SetTotalEscrowForDenom(suite.chainB.GetContext(), coin.GetDenom(), coin.Amount) + suite.chainB.GetSimApp().TransferKeeper.SetTotalEscrowForDenom(suite.chainB.GetContext(), coin) totalEscrowChainB := suite.chainB.GetSimApp().TransferKeeper.GetTotalEscrowForDenom(suite.chainB.GetContext(), coin.GetDenom()) - suite.Require().Equal(math.NewInt(100), totalEscrowChainB) + suite.Require().Equal(math.NewInt(100), totalEscrowChainB.Amount) err := suite.chainB.GetSimApp().TransferKeeper.OnAcknowledgementPacket(suite.chainB.GetContext(), packet, data, ack) suite.Require().NoError(err) // check total amount in escrow of sent token on sending chain totalEscrowChainB = suite.chainB.GetSimApp().TransferKeeper.GetTotalEscrowForDenom(suite.chainB.GetContext(), coin.GetDenom()) - suite.Require().Equal(math.ZeroInt(), totalEscrowChainB) + suite.Require().Equal(math.ZeroInt(), totalEscrowChainB.Amount) } // TestOnTimeoutPacket test private refundPacket function since it is a simple @@ -716,7 +716,7 @@ func (suite *KeeperTestSuite) TestOnTimeoutPacket() { // funds the escrow account to have balance suite.Require().NoError(banktestutil.FundAccount(suite.chainA.GetSimApp().BankKeeper, suite.chainA.GetContext(), escrow, sdk.NewCoins(coin))) // set escrow amount that would have been stored after successful execution of MsgTransfer - suite.chainA.GetSimApp().TransferKeeper.SetTotalEscrowForDenom(suite.chainA.GetContext(), coin.GetDenom(), coin.Amount) + suite.chainA.GetSimApp().TransferKeeper.SetTotalEscrowForDenom(suite.chainA.GetContext(), coin) }, true, }, { @@ -738,7 +738,7 @@ func (suite *KeeperTestSuite) TestOnTimeoutPacket() { expEscrowAmount = amount // set escrow amount that would have been stored after successful execution of MsgTransfer - suite.chainA.GetSimApp().TransferKeeper.SetTotalEscrowForDenom(suite.chainA.GetContext(), trace.IBCDenom(), amount) + suite.chainA.GetSimApp().TransferKeeper.SetTotalEscrowForDenom(suite.chainA.GetContext(), sdk.NewCoin(trace.IBCDenom(), amount)) }, false, }, { @@ -748,7 +748,7 @@ func (suite *KeeperTestSuite) TestOnTimeoutPacket() { expEscrowAmount = amount // set escrow amount that would have been stored after successful execution of MsgTransfer - suite.chainA.GetSimApp().TransferKeeper.SetTotalEscrowForDenom(suite.chainA.GetContext(), trace.IBCDenom(), amount) + suite.chainA.GetSimApp().TransferKeeper.SetTotalEscrowForDenom(suite.chainA.GetContext(), sdk.NewCoin(trace.IBCDenom(), amount)) }, false, }, { @@ -786,7 +786,7 @@ func (suite *KeeperTestSuite) TestOnTimeoutPacket() { // check total amount in escrow of sent token denom on sending chain totalEscrow := suite.chainA.GetSimApp().TransferKeeper.GetTotalEscrowForDenom(suite.chainA.GetContext(), trace.IBCDenom()) - suite.Require().Equal(expEscrowAmount, totalEscrow) + suite.Require().Equal(expEscrowAmount, totalEscrow.Amount) if tc.expPass { suite.Require().NoError(err) @@ -869,14 +869,14 @@ func (suite *KeeperTestSuite) TestOnTimeoutPacketSetsTotalEscrowAmountForSourceI suite.chainA.GetTimeoutHeight(), 0, ) - suite.chainB.GetSimApp().TransferKeeper.SetTotalEscrowForDenom(suite.chainB.GetContext(), coin.GetDenom(), coin.Amount) + suite.chainB.GetSimApp().TransferKeeper.SetTotalEscrowForDenom(suite.chainB.GetContext(), coin) totalEscrowChainB := suite.chainB.GetSimApp().TransferKeeper.GetTotalEscrowForDenom(suite.chainB.GetContext(), coin.GetDenom()) - suite.Require().Equal(math.NewInt(100), totalEscrowChainB) + suite.Require().Equal(math.NewInt(100), totalEscrowChainB.Amount) err := suite.chainB.GetSimApp().TransferKeeper.OnTimeoutPacket(suite.chainB.GetContext(), packet, data) suite.Require().NoError(err) // check total amount in escrow of sent token on sending chain totalEscrowChainB = suite.chainB.GetSimApp().TransferKeeper.GetTotalEscrowForDenom(suite.chainB.GetContext(), coin.GetDenom()) - suite.Require().Equal(math.ZeroInt(), totalEscrowChainB) + suite.Require().Equal(math.ZeroInt(), totalEscrowChainB.Amount) } diff --git a/modules/apps/transfer/types/query.pb.go b/modules/apps/transfer/types/query.pb.go index ed4becfe8e1..b7a3904461e 100644 --- a/modules/apps/transfer/types/query.pb.go +++ b/modules/apps/transfer/types/query.pb.go @@ -5,9 +5,8 @@ package types import ( context "context" - cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" - _ "github.com/cosmos/cosmos-proto" + 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" @@ -554,7 +553,7 @@ func (m *QueryTotalEscrowForDenomRequest) GetDenom() string { // QueryTotalEscrowForDenomResponse is the response type for TotalEscrowForDenom RPC method. type QueryTotalEscrowForDenomResponse struct { - Amount cosmossdk_io_math.Int `protobuf:"bytes,1,opt,name=amount,proto3,customtype=cosmossdk.io/math.Int" json:"amount"` + Amount types.Coin `protobuf:"bytes,1,opt,name=amount,proto3" json:"amount"` } func (m *QueryTotalEscrowForDenomResponse) Reset() { *m = QueryTotalEscrowForDenomResponse{} } @@ -590,6 +589,13 @@ func (m *QueryTotalEscrowForDenomResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryTotalEscrowForDenomResponse proto.InternalMessageInfo +func (m *QueryTotalEscrowForDenomResponse) GetAmount() types.Coin { + if m != nil { + return m.Amount + } + return types.Coin{} +} + func init() { proto.RegisterType((*QueryDenomTraceRequest)(nil), "ibc.applications.transfer.v1.QueryDenomTraceRequest") proto.RegisterType((*QueryDenomTraceResponse)(nil), "ibc.applications.transfer.v1.QueryDenomTraceResponse") @@ -610,60 +616,59 @@ func init() { } var fileDescriptor_a638e2800a01538c = []byte{ - // 847 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x56, 0x4f, 0x6f, 0xe3, 0x44, - 0x14, 0x8f, 0x0b, 0x1b, 0xc8, 0x0b, 0xbb, 0x87, 0xd9, 0x2e, 0xdb, 0xb5, 0x4a, 0x52, 0x59, 0x05, - 0xaa, 0xec, 0xc6, 0x43, 0x76, 0xd3, 0x86, 0x43, 0x8b, 0x44, 0x0b, 0x85, 0x20, 0x0e, 0x6d, 0xda, - 0x13, 0x1c, 0xa2, 0x89, 0x3d, 0x38, 0x16, 0x89, 0xc7, 0xf5, 0x4c, 0x82, 0xaa, 0xa8, 0x17, 0x3e, - 0x01, 0x52, 0xbf, 0x04, 0x42, 0x42, 0x5c, 0xf8, 0x00, 0x1c, 0x7b, 0xac, 0x8a, 0x84, 0x2a, 0x0e, - 0x05, 0xb5, 0x7c, 0x10, 0xe4, 0x99, 0x49, 0x62, 0xd3, 0x34, 0x4d, 0x38, 0xc5, 0x33, 0xf3, 0x7e, - 0xef, 0xfd, 0x7e, 0xef, 0x9f, 0x02, 0x6b, 0x7e, 0xcb, 0xc1, 0x24, 0x0c, 0x3b, 0xbe, 0x43, 0x84, - 0xcf, 0x02, 0x8e, 0x45, 0x44, 0x02, 0xfe, 0x0d, 0x8d, 0x70, 0xbf, 0x82, 0x8f, 0x7a, 0x34, 0x3a, - 0xb6, 0xc3, 0x88, 0x09, 0x86, 0x96, 0xfd, 0x96, 0x63, 0x27, 0x2d, 0xed, 0xa1, 0xa5, 0xdd, 0xaf, - 0x98, 0x8b, 0x1e, 0xf3, 0x98, 0x34, 0xc4, 0xf1, 0x97, 0xc2, 0x98, 0xcf, 0x1c, 0xc6, 0xbb, 0x8c, - 0x37, 0xd5, 0x83, 0x3a, 0xe8, 0xa7, 0x92, 0x3a, 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x64, 0xee, 0x7a, 0x83, 0x70, 0x3c, 0x18, 0x6f, 0x97, - 0x13, 0x1c, 0xef, 0x1c, 0x8e, 0x07, 0x7a, 0x13, 0x9d, 0xe0, 0xf4, 0xf2, 0x40, 0x17, 0x06, 0x3c, - 0x9e, 0x30, 0xea, 0x68, 0x6b, 0x06, 0x96, 0x77, 0xef, 0x16, 0xf3, 0xa3, 0xff, 0x0b, 0xd7, 0x52, - 0x37, 0xa5, 0xd4, 0x0d, 0x54, 0x9d, 0x52, 0x26, 0x8e, 0x07, 0xf2, 0x37, 0x2e, 0x10, 0x16, 0xb1, - 0xb3, 0xa6, 0x12, 0xb7, 0xbd, 0x7f, 0x76, 0x5d, 0x30, 0xce, 0xaf, 0x0b, 0xc6, 0xdf, 0xd7, 0x05, - 0xe3, 0x87, 0x9b, 0x42, 0xe6, 0xfc, 0xa6, 0x90, 0xb9, 0xbc, 0x29, 0x64, 0xbe, 0xaa, 0x79, 0xbe, - 0x68, 0xf7, 0x5a, 0xb6, 0xc3, 0xba, 0xfa, 0x2f, 0x4c, 0x1c, 0xa0, 0xec, 0x31, 0xdc, 0xaf, 0xe1, - 0x2e, 0x73, 0x7b, 0x1d, 0xca, 0xff, 0x13, 0x4e, 0x1c, 0x87, 0x94, 0xb7, 0xb2, 0xf2, 0x2f, 0xc7, - 0xab, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0x14, 0x3b, 0x12, 0x7f, 0x64, 0x09, 0x00, 0x00, + // 830 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x56, 0x4f, 0x4f, 0xe3, 0x46, + 0x14, 0x8f, 0x29, 0xa4, 0xcd, 0x4b, 0xe1, 0x30, 0xd0, 0x02, 0x16, 0x35, 0xc8, 0xa2, 0x2d, 0x4a, + 0xc1, 0xd3, 0x40, 0x20, 0x3d, 0x40, 0xa5, 0x42, 0x4b, 0x4b, 0xd5, 0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, 0xee, 0xb4, 0xcc, 0xdf, 0x65, 0xdb, 0x09, 0xea, 0xad, + 0x9a, 0x61, 0xb2, 0x26, 0x96, 0x7f, 0x54, 0x9c, 0x9a, 0xb9, 0x66, 0x33, 0xdc, 0x2e, 0xe3, 0x26, + 0xb3, 0x5a, 0x0d, 0xca, 0x3f, 0x2a, 0x17, 0x9c, 0x7b, 0x94, 0xd7, 0xb2, 0xe2, 0x6f, 0xc6, 0xc6, + 0x87, 0x00, 0x00, 0x00, 0xff, 0xff, 0xd9, 0x35, 0xa9, 0x75, 0x5d, 0x09, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1323,11 +1328,11 @@ func (m *QueryTotalEscrowForDenomResponse) MarshalToSizedBuffer(dAtA []byte) (in var l int _ = l { - size := m.Amount.Size() - i -= size - if _, err := m.Amount.MarshalTo(dAtA[i:]); err != nil { + size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { return 0, err } + i -= size i = encodeVarintQuery(dAtA, i, uint64(size)) } i-- @@ -2497,7 +2502,7 @@ func (m *QueryTotalEscrowForDenomResponse) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -2507,16 +2512,15 @@ func (m *QueryTotalEscrowForDenomResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthQuery } diff --git a/proto/ibc/applications/transfer/v1/query.proto b/proto/ibc/applications/transfer/v1/query.proto index 83b8317def7..9a41aa847b3 100644 --- a/proto/ibc/applications/transfer/v1/query.proto +++ b/proto/ibc/applications/transfer/v1/query.proto @@ -3,7 +3,7 @@ syntax = "proto3"; package ibc.applications.transfer.v1; import "gogoproto/gogo.proto"; -import "cosmos_proto/cosmos.proto"; +import "cosmos/base/v1beta1/coin.proto"; import "cosmos/base/query/v1beta1/pagination.proto"; import "ibc/applications/transfer/v1/transfer.proto"; import "google/api/annotations.proto"; @@ -114,12 +114,7 @@ message QueryEscrowAddressResponse { message QueryTotalEscrowForDenomRequest { string denom = 1; } - // QueryTotalEscrowForDenomResponse is the response type for TotalEscrowForDenom RPC method. message QueryTotalEscrowForDenomResponse { - string amount = 1 [ - (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "cosmossdk.io/math.Int", - (gogoproto.nullable) = false - ]; -} \ No newline at end of file + cosmos.base.v1beta1.Coin amount = 1 [(gogoproto.nullable) = false]; +}