diff --git a/CHANGELOG.md b/CHANGELOG.md index f9ed2f5b23..0c403fb1b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,13 +22,13 @@ the Github PR referenced in the following format: Types of changes (Stanzas): +State Machine Breaking: for any changes that result in a divergent application state. Features: for new features. Improvements: for changes in existing functionality. Deprecated: for soon-to-be removed features. Bug Fixes: for any bug fixes. Client Breaking: for breaking Protobuf, CLI, gRPC and REST routes used by clients. API Breaking: for breaking exported Go APIs used by developers. -State Machine Breaking: for any changes that result in a divergent application state. To release a new version, ensure an appropriate release branch exists. Add a release version and date to the existing Unreleased section which takes the form @@ -46,7 +46,13 @@ Ref: https://keepachangelog.com/en/1.0.0/ ## [Unreleased] -## [v4.3.0](https://github.com/umee-network/umee/releases/tag/v4.3.0) - 2023-04-5 +## [v4.4.0](https://github.com/umee-network/umee/releases/tag/v4.3.0) - 2023-05-05 + +### State Machine Breaking + +- [2022](https://github.com/umee-network/umee/pull/2022) Disable IBC ICS-20 inflow of only x/leverage registered tokens. + +## [v4.3.0](https://github.com/umee-network/umee/releases/tag/v4.3.0) - 2023-04-05 ### Features diff --git a/tests/e2e/e2e_ibc_test.go b/tests/e2e/e2e_ibc_test.go index 2c6185ee85..e1411999c9 100644 --- a/tests/e2e/e2e_ibc_test.go +++ b/tests/e2e/e2e_ibc_test.go @@ -164,8 +164,8 @@ func (s *IntegrationTestSuite) TestIBCTokenTransfer() { s.checkSupply(gaiaAPIEndpoint, umeeIBCHash, token.Amount) }) - // Non registered tokens (not exists in oracle for quota test) - // IBC Transfer will failed because it is not registered in leverage on receiver chain (UMEE) + // IBC inbound transfer of non x/leverage registered tokens must fail, because + // because we won't have price for it. s.Run("send_stake_to_umee", func() { // require the recipient account receives the IBC tokens (IBC packets ACKd) var ( @@ -186,12 +186,15 @@ func (s *IntegrationTestSuite) TestIBCTokenTransfer() { func() bool { balances, err = queryUmeeAllBalances(umeeAPIEndpoint, recipient) s.Require().NoError(err) - return math.ZeroInt().Equal(balances.AmountOf(stakeIBCHash)) + // uncomment whene we re-enable inflow limit + // return math.ZeroInt().Equal(balances.AmountOf(stakeIBCHash)) + return token.Amount.Equal(balances.AmountOf(stakeIBCHash)) }, time.Minute, 5*time.Second, ) - s.checkSupply(umeeAPIEndpoint, stakeIBCHash, math.ZeroInt()) + // s.checkSupply(umeeAPIEndpoint, stakeIBCHash, math.ZeroInt()) + s.checkSupply(umeeAPIEndpoint, stakeIBCHash, token.Amount) }) var ibcStakeERC20Addr string diff --git a/x/uibc/ics20/ibc_module.go b/x/uibc/ics20/ibc_module.go index 60ce905986..4e0c9ce91e 100644 --- a/x/uibc/ics20/ibc_module.go +++ b/x/uibc/ics20/ibc_module.go @@ -46,11 +46,12 @@ func (am IBCModule) OnRecvPacket( } // Allowing only registered token for ibc transfer - isSourceChain := ibctransfertypes.SenderChainIsSource(packet.GetSourcePort(), packet.GetSourceChannel(), data.Denom) - ackErr := CheckIBCInflow(ctx, packet, am.lkeeper, data.Denom, isSourceChain) - if ackErr != nil { - return ackErr - } + // TODO: re-enable inflow checks + // isSourceChain := ibctransfertypes.SenderChainIsSource(packet.GetSourcePort(), packet.GetSourceChannel(), data.Denom) + // ackErr := CheckIBCInflow(ctx, packet, am.lkeeper, data.Denom, isSourceChain) + // if ackErr != nil { + // return ackErr + // } ack := am.IBCModule.OnRecvPacket(ctx, packet, relayer) if ack.Success() { @@ -79,8 +80,12 @@ func CheckIBCInflow(ctx sdk.Context, // construct the denomination trace from the full raw denomination and get the ibc_denom ibcDenom := ibctransfertypes.ParseDenomTrace(prefixedDenom).IBCDenom() _, err := lkeeper.GetTokenSettings(ctx, ibcDenom) - if err != nil && ltypes.ErrNotRegisteredToken.Is(err) { - return channeltypes.NewErrorAcknowledgement(err) + if err != nil { + if ltypes.ErrNotRegisteredToken.Is(err) { + return channeltypes.NewErrorAcknowledgement(err) + } + // other leverage keeper error -> log the error and allow the inflow transfer. + ctx.Logger().Error("IBC inflows: can't load token registry", "err", err) } } diff --git a/x/uibc/quota/ibc_module.go b/x/uibc/quota/ibc_module.go index 4c6c9ee5bf..c3924fc450 100644 --- a/x/uibc/quota/ibc_module.go +++ b/x/uibc/quota/ibc_module.go @@ -48,7 +48,7 @@ func (im ICS20Middleware) OnAcknowledgementPacket(ctx sdk.Context, packet channe if _, ok := ack.Response.(*channeltypes.Acknowledgement_Error); ok { params := im.keeper.GetParams(ctx) if params.IbcStatus == uibc.IBCTransferStatus_IBC_TRANSFER_STATUS_QUOTA_ENABLED { - err := im.RevertQuotaUpdate(ctx, packet.Data) + err := im.revertQuotaUpdate(ctx, packet.Data) emitOnRevertQuota(&ctx, "acknowledgement", packet.Data, err) } } @@ -58,14 +58,14 @@ func (im ICS20Middleware) OnAcknowledgementPacket(ctx sdk.Context, packet channe // OnTimeoutPacket implements types.Middleware func (im ICS20Middleware) OnTimeoutPacket(ctx sdk.Context, packet channeltypes.Packet, relayer sdk.AccAddress) error { - err := im.RevertQuotaUpdate(ctx, packet.Data) + err := im.revertQuotaUpdate(ctx, packet.Data) emitOnRevertQuota(&ctx, "timeout", packet.Data, err) return im.IBCModule.OnTimeoutPacket(ctx, packet, relayer) } -// RevertQuotaUpdate Notifies the contract that a sent packet wasn't properly received -func (im ICS20Middleware) RevertQuotaUpdate( +// revertQuotaUpdate must be called on packet acknnowledgemenet error to revert necessary changes. +func (im ICS20Middleware) revertQuotaUpdate( ctx sdk.Context, packetData []byte, ) error { diff --git a/x/uibc/quota/keeper/ics4_wrapper.go b/x/uibc/quota/keeper/ics4_wrapper.go index 90e993c9de..65ffd2616d 100644 --- a/x/uibc/quota/keeper/ics4_wrapper.go +++ b/x/uibc/quota/keeper/ics4_wrapper.go @@ -16,7 +16,7 @@ import ( * Implementation of ICS4Wrapper interface ******/ -// SendPacket wraps IBC ChannelKeeper's SendPacket function +// SendPacket wraps IBC ChannelKeeper's SendPacket function to record quota outflows. func (k Keeper) SendPacket(ctx sdk.Context, chanCap *capabilitytypes.Capability, sourcePort string, diff --git a/x/uibc/quota/keeper/quota.go b/x/uibc/quota/keeper/quota.go index a087b309f1..3800276ee9 100644 --- a/x/uibc/quota/keeper/quota.go +++ b/x/uibc/quota/keeper/quota.go @@ -128,7 +128,7 @@ func (k Keeper) ResetAllQuotas(ctx sdk.Context) error { return nil } -// CheckAndUpdateQuota checks if adding a newOutflow is doesn't exceed the max quota and +// CheckAndUpdateQuota checks if adding a newOutflow doesn't exceed the max quota and // updates the current quota metrics. func (k Keeper) CheckAndUpdateQuota(ctx sdk.Context, denom string, newOutflow sdkmath.Int) error { params := k.GetParams(ctx)