Skip to content

Commit

Permalink
chore: bump ibc (#2557)
Browse files Browse the repository at this point in the history
* chore: bump ibc

---------

Co-authored-by: Sai Kumar <sai@umee.cc>
  • Loading branch information
robert-zaremba and gsk967 authored Jun 21, 2024
1 parent fcb0f16 commit 31db868
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 34 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ See [Release procedure](CONTRIBUTING.md#release-procedure) for more information
| v6.2.x || v0.47.6+ | v7.2.x | --- | umee/v2.3.0 | --- | v1.5.0 |
| v6.3.x || v0.47.7+ | v7.3.1 | --- | umee/v2.3.0+ | --- | v1.5.0 |
| v6.4.x | x | v0.47.10+ | v7.3.2 | --- | umee/v2.4.1+ | --- | v1.5.2 |
| v6.5.x | x | v0.47.11+ | v7.5.1 | --- | umee/v2.4.3+ | --- | v1.5.2 |
| v6.5.x | x | v0.47.11+ | v7.6.0 | --- | umee/v2.4.3+ | --- | v1.5.2 |

#### Price Feeder

Expand Down
2 changes: 1 addition & 1 deletion RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ In this release, we are introducing validations for the IBC transfer message rec

- Maximum length for IBC transfer memo field: 32'768 characters
- Maximum length for IBC transfer receiver address field: 2'048 characters
- Bump `ibc-go` to v7.5.1.
- Bump `ibc-go` to v7.6.0

### Validators

Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ require (
github.com/cometbft/cometbft v0.37.6
github.com/cometbft/cometbft-db v0.11.0
github.com/cosmos/cosmos-proto v1.0.0-beta.5
github.com/cosmos/cosmos-sdk v0.47.11
github.com/cosmos/cosmos-sdk v0.47.12
github.com/cosmos/go-bip39 v1.0.0
github.com/cosmos/gogoproto v1.4.10 // NOTE: v1.4.11+ is not compatible with sdk v0.47
github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7 v7.1.3
github.com/cosmos/ibc-go/v7 v7.5.1
github.com/cosmos/ibc-go/v7 v7.6.0
github.com/golang/mock v1.6.0
github.com/golang/protobuf v1.5.4
github.com/gorilla/mux v1.8.1
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -405,8 +405,8 @@ github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk=
github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis=
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/cosmos-sdk v0.47.11 h1:0Qx7eORw0RJqPv+mvDuU8NQ1LV3nJJKJnPoYblWHolc=
github.com/cosmos/cosmos-sdk v0.47.11/go.mod h1:ADjORYzUQqQv/FxDi0H0K5gW/rAk1CiDR3ZKsExfJV0=
github.com/cosmos/cosmos-sdk v0.47.12 h1:KOZHAVWrcilHywBN/FabBaXbDFMzoFmtdX0hqy5Ory8=
github.com/cosmos/cosmos-sdk v0.47.12/go.mod h1:ADjORYzUQqQv/FxDi0H0K5gW/rAk1CiDR3ZKsExfJV0=
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=
Expand All @@ -419,8 +419,8 @@ github.com/cosmos/iavl v0.20.1 h1:rM1kqeG3/HBT85vsZdoSNsehciqUQPWrR4BYmqE2+zg=
github.com/cosmos/iavl v0.20.1/go.mod h1:WO7FyvaZJoH65+HFOsDir7xU9FWk2w9cHXNW1XHcl7A=
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.5.1 h1:KqS/g7W7EMX1OtOvufS8lWMJibOKpdgtNNZIU6fAgVU=
github.com/cosmos/ibc-go/v7 v7.5.1/go.mod h1:ktFg5GvKOyrGCqTWtW7Grj5uweU4ZapxrNeVS1CLLbo=
github.com/cosmos/ibc-go/v7 v7.6.0 h1:S1G5hcIVe9go+jQV6F9+I9yy+hylbJeLiVHUmktQNrM=
github.com/cosmos/ibc-go/v7 v7.6.0/go.mod h1:LifBA7JHRHl95ujjHIaBEHmUqy2qCGyqDCXB7qmAsZk=
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/keyring v1.2.0 h1:8C1lBP9xhImmIabyXW4c3vFjjLiBdGCmfLUfeZlV1Yo=
Expand Down
6 changes: 3 additions & 3 deletions tests/e2e/e2e_ibc_memo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func (s *E2ETest) testIBCTokenTransferWithMemo(umeeAPIEndpoint string, atomQuota

invalidMemoBZ, err := cdc.MarshalJSON(&invalidMemo)
assert.Nil(err)
s.SendIBC(setup.GaiaChainID, s.Chain.ID, accs.Alice.String(), atomFromGaia, false, "", string(invalidMemoBZ))
s.SendIBC(setup.GaiaChainID, s.Chain.ID, accs.Alice.String(), atomFromGaia, "", string(invalidMemoBZ), "")
updatedIBCAtomBalance := atomFromGaia.Amount.Add(prevIBCAtomBalance)
s.checkSupply(umeeAPIEndpoint, uatomIBCHash, updatedIBCAtomBalance)
s.checkLeverageAccountBalance(umeeAPIEndpoint, fallbackAddr, uatomIBCHash, math.ZeroInt())
Expand All @@ -60,7 +60,7 @@ func (s *E2ETest) testIBCTokenTransferWithMemo(umeeAPIEndpoint string, atomQuota
invalidMemo = uibc.ICS20Memo{Messages: anyMsgOfCollateralize, FallbackAddr: ""}
invalidMemoBZ, err = cdc.MarshalJSON(&invalidMemo)
assert.Nil(err)
s.SendIBC(setup.GaiaChainID, s.Chain.ID, accs.Alice.String(), atomFromGaia, false, "", string(invalidMemoBZ))
s.SendIBC(setup.GaiaChainID, s.Chain.ID, accs.Alice.String(), atomFromGaia, "", string(invalidMemoBZ), "")
updatedIBCAtomBalance = updatedIBCAtomBalance.Add(atomFromGaia.Amount)
s.checkSupply(umeeAPIEndpoint, uatomIBCHash, updatedIBCAtomBalance)
s.checkLeverageAccountBalance(umeeAPIEndpoint, fallbackAddr, uatomIBCHash, math.ZeroInt())
Expand All @@ -82,7 +82,7 @@ func (s *E2ETest) testIBCTokenTransferWithMemo(umeeAPIEndpoint string, atomQuota

bz, err := cdc.MarshalJSON(&memo)
assert.Nil(err)
s.SendIBC(setup.GaiaChainID, s.Chain.ID, accs.Alice.String(), atomFromGaia, false, "", string(bz))
s.SendIBC(setup.GaiaChainID, s.Chain.ID, accs.Alice.String(), atomFromGaia, "", string(bz), "")
updatedIBCAtomBalance = updatedIBCAtomBalance.Add(atomFromGaia.Amount)
s.checkSupply(umeeAPIEndpoint, uatomIBCHash, updatedIBCAtomBalance)
s.checkLeverageAccountBalance(umeeAPIEndpoint, accs.Alice.String(), uatomIBCHash, atomFromGaia.Amount)
Expand Down
30 changes: 16 additions & 14 deletions tests/e2e/e2e_ibc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ const (

atomSymbol = "ATOM"
umeeSymbol = "UMEE"

errQuotaExceed = "quota transfer exceeded"
)

var powerReduction = sdk.MustNewDecFromStr("10").Power(6)
Expand Down Expand Up @@ -136,7 +138,7 @@ func (s *E2ETest) TestIBCTokenTransfer() {
recipient := s.AccountAddr(0).String()

token := sdk.NewInt64Coin("stake", 3300000000) // 3300stake
s.SendIBC(setup.GaiaChainID, s.Chain.ID, recipient, token, false, "", "")
s.SendIBC(setup.GaiaChainID, s.Chain.ID, recipient, token, "", "", "")
s.checkSupply(umeeAPIEndpoint, stakeIBCHash, token.Amount)
})

Expand All @@ -145,7 +147,7 @@ func (s *E2ETest) TestIBCTokenTransfer() {
// send $500 ATOM from gaia to umee. (ibc_quota will not check token limit)
atomFromGaia := mulCoin(atomQuota, "5.0")
atomFromGaia.Denom = "uatom"
s.SendIBC(setup.GaiaChainID, s.Chain.ID, "", atomFromGaia, false, "", "")
s.SendIBC(setup.GaiaChainID, s.Chain.ID, "", atomFromGaia, "", "", "")
s.checkSupply(umeeAPIEndpoint, uatomIBCHash, atomFromGaia.Amount)

// <<< OUTLOW : umee -> gaia >>
Expand All @@ -161,45 +163,45 @@ func (s *E2ETest) TestIBCTokenTransfer() {
// << TOKEN QUOTA EXCCEED >>
// send $110 UMEE from umee to gaia (token_quota is 100$)
exceedUmee := mulCoin(umeeQuota, "1.1")
s.SendIBC(s.Chain.ID, setup.GaiaChainID, "", exceedUmee, true, "", "")
s.SendIBC(s.Chain.ID, setup.GaiaChainID, "", exceedUmee, "", "", errQuotaExceed)
// check the ibc (umee) quota after ibc txs - this one should have failed
// supply don't change
s.checkSupply(gaiaAPIEndpoint, umeeIBCHash, math.ZeroInt())

// << Receiver Addr = maximum length + 1
// send $110 UMEE from umee to gaia (token_quota is 100$)
recvAddr := tsdk.GenerateString(ibcutil.MaximumMemoLength + 1)
s.SendIBC(s.Chain.ID, setup.GaiaChainID, recvAddr, exceedUmee, true, "", "")
// check the ibc (umee) quota after ibc txs - this one should have failed
// supply don't change
s.SendIBC(s.Chain.ID, setup.GaiaChainID, recvAddr, exceedUmee, "", "",
"recipient address must not exceed 2048 bytes")
// supply should not change
s.checkSupply(gaiaAPIEndpoint, umeeIBCHash, math.ZeroInt())

// send $110 ATOM from umee to gaia
exceedAtom := mulCoin(atomQuota, "1.1")
// supply will be not be decreased because sending amount is more than token quota so it will fail
s.SendIBC(s.Chain.ID, setup.GaiaChainID, "", exceedAtom, true, "uatom from umee to gaia", "")
s.SendIBC(s.Chain.ID, setup.GaiaChainID, "", exceedAtom, "uatom from umee to gaia", "", errQuotaExceed)
s.checkSupply(umeeAPIEndpoint, uatomIBCHash, atomFromGaia.Amount)

// << BELOW TOKEN QUOTA >>
// send $90 UMEE from umee to gaia (ibc_quota will check)
// Note: receiver is null so hermes will default send to key_name (from config) of target chain (gaia)
sendUmee := mulCoin(umeeQuota, "0.9")
s.SendIBC(s.Chain.ID, setup.GaiaChainID, "", sendUmee, false, fmt.Sprintf(
"sending %s (less than token quota) ", sendUmee.String()), "")
s.SendIBC(s.Chain.ID, setup.GaiaChainID, "", sendUmee,
fmt.Sprintf("sending %s (less than token quota) ", sendUmee.String()), "", "")
s.checkOutflows(umeeAPIEndpoint, appparams.BondDenom, true, sdk.NewDecFromInt(sendUmee.Amount), appparams.Name)
s.checkSupply(gaiaAPIEndpoint, umeeIBCHash, sendUmee.Amount)

// << BELOW TOKEN QUOTA 40$ but ATOM_QUOTA (40$)+ UMEE_QUOTA(90$) >= TOTAL QUOTA (120$) >>
// send $40 ATOM from umee to gaia
atom40 := mulCoin(atomQuota, "0.4")
s.SendIBC(s.Chain.ID, setup.GaiaChainID, "", atom40, true, "below token quota but not total quota", "")
s.SendIBC(s.Chain.ID, setup.GaiaChainID, "", atom40, "below token quota but not total quota", "", errQuotaExceed)
// supply will be not be decreased because sending more than total quota from umee to gaia
s.checkSupply(umeeAPIEndpoint, uatomIBCHash, atomFromGaia.Amount)

// ✅ << BELOW TOKEN QUTOA 5$ but ATOM_QUOTA (5$)+ UMEE_QUOTA(90$) <= TOTAL QUOTA (120$)
// send $5 ATOM from umee to gaia
sendAtom := mulCoin(atomQuota, "0.05")
s.SendIBC(s.Chain.ID, setup.GaiaChainID, "", sendAtom, false, "below both quotas", "")
s.SendIBC(s.Chain.ID, setup.GaiaChainID, "", sendAtom, "below both quotas", "", "")
// remaing supply decreased uatom on umee
s.checkSupply(umeeAPIEndpoint, uatomIBCHash, atomFromGaia.Amount.Sub(sendAtom.Amount))
s.checkOutflows(umeeAPIEndpoint, uatomIBCHash, true, sdk.NewDecFromInt(sendAtom.Amount), atomSymbol)
Expand All @@ -210,11 +212,11 @@ func (s *E2ETest) TestIBCTokenTransfer() {
coins, err := s.QueryTotalSupply(gaiaAPIEndpoint) // before sending back
remainingTokens := coins.AmountOf(umeeIBCHash).Sub(returnUmee.Amount)
s.Require().NoError(err)
s.SendIBC(setup.GaiaChainID, s.Chain.ID, "", returnUmee, false, "send back some umee", "")
s.SendIBC(setup.GaiaChainID, s.Chain.ID, "", returnUmee, "send back some umee", "", "")
s.checkSupply(gaiaAPIEndpoint, umeeIBCHash, remainingTokens)

// sending back remaining amount
s.SendIBC(setup.GaiaChainID, s.Chain.ID, "", sdk.NewCoin(umeeIBCHash, remainingTokens), false, "send back remaining umee", "")
s.SendIBC(setup.GaiaChainID, s.Chain.ID, "", sdk.NewCoin(umeeIBCHash, remainingTokens), "send back remaining umee", "", "")
s.checkSupply(gaiaAPIEndpoint, umeeIBCHash, math.ZeroInt())

/*
Expand Down Expand Up @@ -267,7 +269,7 @@ func (s *E2ETest) TestIBCTokenTransfer() {
s.Require().Equal(uibcParams.IbcStatus, uibc.IBCTransferStatus_IBC_TRANSFER_STATUS_QUOTA_DISABLED)

// sending the umee tokens - they would have exceeded quota before
s.SendIBC(s.Chain.ID, setup.GaiaChainID, "", exceedUmee, false, "sending umee", "")
s.SendIBC(s.Chain.ID, setup.GaiaChainID, "", exceedUmee, "sending umee", "", "")
s.checkSupply(gaiaAPIEndpoint, umeeIBCHash, exceedUmee.Amount)
// Check the outflows
s.Require().Eventually(
Expand Down
17 changes: 8 additions & 9 deletions tests/e2e/setup/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ func (s *E2ETestSuite) Delegate(testAccount, valIndex int, amount uint64) error
return s.BroadcastTxWithRetry(msg, s.AccountClient(testAccount))
}

func (s *E2ETestSuite) SendIBC(srcChainID, dstChainID, recipient string, token sdk.Coin, failDueToQuota bool,
desc, memo string) {
if failDueToQuota {
s.T().Logf("sending %s from %s to %s (exceed quota: %v) %s",
token, srcChainID, dstChainID, failDueToQuota, desc)
func (s *E2ETestSuite) SendIBC(srcChainID, dstChainID, recipient string, token sdk.Coin,
desc, memo, expectedErr string) {
if expectedErr != "" {
s.T().Logf("sending %s from %s to %s, %s (expectedErr: %s)",
token, srcChainID, dstChainID, desc, expectedErr)
}
ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
defer cancel()
Expand Down Expand Up @@ -131,9 +131,8 @@ func (s *E2ETestSuite) SendIBC(srcChainID, dstChainID, recipient string, token s
// Note: we are cchecking only one side of ibc , we don't know whethever ibc transfer is succeed on one side
// some times relayer can't send the packets to another chain

// // don't check for the tx hash if we expect this to fail due to quota
if strings.Contains(errBuf.String(), "quota transfer exceeded") {
s.Require().True(failDueToQuota)
if expectedErr != "" {
s.Require().Contains(outBuf.String(), expectedErr)
return
}

Expand All @@ -142,7 +141,7 @@ func (s *E2ETestSuite) SendIBC(srcChainID, dstChainID, recipient string, token s
if i < 4 {
continue
}
if !strings.Contains(outBuf.String(), "bad packet in rate limit's SendPacket") {
if !strings.Contains(outBuf.String(), "must not exceed") {
s.Require().Failf("failed to find transaction hash in output outBuf: %s errBuf: %s",
outBuf.String(), errBuf.String())
}
Expand Down

0 comments on commit 31db868

Please sign in to comment.