Skip to content

Commit

Permalink
Merge branch 'main' into robert/uibc-unit-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
robert-zaremba authored May 5, 2023
2 parents 9c79664 + 855fc06 commit 1389500
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 61 deletions.
10 changes: 8 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -64,7 +64,13 @@ Ref: https://keepachangelog.com/en/1.0.0/

- .

## [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

Expand Down
14 changes: 11 additions & 3 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

Release Procedure is defined in the [CONTRIBUTING](CONTRIBUTING.md#release-procedure) document.

## v4.4.0
## v4.5.0

Highlights:

Expand Down Expand Up @@ -35,6 +35,14 @@ You can use Cosmovisor → see [instructions](https://github.com/umee-network/um

Docker images are available in [ghcr.io umee-network](https://github.com/umee-network/umee/pkgs/container/umeed) repository.

## v4.4.0

This is a small, intermediate release.

For the Stride onboarding process, we decided to disable the IBC ICS-20 inflow limit of x/leverage registered tokens only. That means, now all tokens will be available for inflow transfers. Outflows quota will still hold: unregistered tokens can be transferred out without any limit and x/leverage registered tokens are limited to the daily quota.

See [CHANGELOG](https://github.com/umee-network/umee/blob/v4.4.0/CHANGELOG.md) for a full list of changes.

## v4.3.0

Highlights:
Expand All @@ -48,7 +56,7 @@ See [CHANGELOG](https://github.com/umee-network/umee/blob/v4.3.0/CHANGELOG.md) f

### Validators

### libwasmvm update
#### libwasmvm update

Our dependencies have been updated. Now the binary requires `libwasmvm v1.2.1`. When you build the binary from source on the server machine you probably don't need any change. However when you download a binary from GitHub, or from other source, make sure you update the `/usr/lib/libwasmvm.<cpu_arch>.so`. For example:

Expand All @@ -57,7 +65,7 @@ Our dependencies have been updated. Now the binary requires `libwasmvm v1.2.1`.

You don't need to do anything if you are using our Docker image.

### Min Gas Prices
#### Min Gas Prices

Same as with v4.2 release. We request all validators set a `minimum-gas-prices` setting (in app `config/app.toml` file, general settings). We recommend `0.1uumee` which is equal the current Keplr _average_ setting:

Expand Down
54 changes: 16 additions & 38 deletions app/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,26 +40,16 @@ func (app UmeeApp) RegisterUpgradeHandlers(bool) {
}

app.registerUpgrade3_0(upgradeInfo)
app.registerUpgrade3_1(upgradeInfo)
app.registerUpgrade("v3.1.0", upgradeInfo)
app.registerUpgrade3_1to3_3(upgradeInfo)
app.registerUpgrade3_2to3_3(upgradeInfo)
app.registerUpgrade3_3to4_0(upgradeInfo)
app.registerUpgrade4_0_1(upgradeInfo)
app.registerUpgrade("v4.0.1", upgradeInfo)
app.registerUpgrade4_1(upgradeInfo)
app.registerUpgrade4_2(upgradeInfo)
app.registerUpgrade("v4.2", upgradeInfo, uibc.ModuleName)
app.registerUpgrade4_3(upgradeInfo)
app.registerUpgrade4_4(upgradeInfo)
}

// performs upgrade from v4.3 to v4.4
func (app *UmeeApp) registerUpgrade4_4(upgradeInfo upgradetypes.Plan) {
const planName = "v4.4-alpha1" // TODO: set correct name
app.UpgradeKeeper.SetUpgradeHandler(planName, onlyModuleMigrations(app, planName))
app.storeUpgrade(planName, upgradeInfo, storetypes.StoreUpgrades{
Added: []string{
incentive.ModuleName,
},
})
app.registerUpgrade("v4.4", upgradeInfo)
app.registerUpgrade("v4.5-alpha1", upgradeInfo, incentive.ModuleName) // TODO: set correct name
}

// performs upgrade from v4.2 to v4.3
Expand Down Expand Up @@ -112,17 +102,6 @@ func (app *UmeeApp) registerUpgrade4_3(upgradeInfo upgradetypes.Plan) {
})
}

// performs upgrade from v4.1 to v4.2
func (app *UmeeApp) registerUpgrade4_2(upgradeInfo upgradetypes.Plan) {
const planName = "v4.2"
app.UpgradeKeeper.SetUpgradeHandler(planName, onlyModuleMigrations(app, planName))
app.storeUpgrade(planName, upgradeInfo, storetypes.StoreUpgrades{
Added: []string{
uibc.ModuleName,
},
})
}

// performs upgrade from v4.0 to v4.1
func (app *UmeeApp) registerUpgrade4_1(_ upgradetypes.Plan) {
const planName = "v4.1.0"
Expand All @@ -145,12 +124,6 @@ func (app *UmeeApp) registerUpgrade4_1(_ upgradetypes.Plan) {
)
}

// performs upgrade from v4.0.0 to v4.0.1
func (app *UmeeApp) registerUpgrade4_0_1(_ upgradetypes.Plan) {
const planName = "v4.0.1"
app.UpgradeKeeper.SetUpgradeHandler(planName, onlyModuleMigrations(app, planName))
}

// performs upgrade from v3.3 -> v4
func (app *UmeeApp) registerUpgrade3_3to4_0(_ upgradetypes.Plan) {
const planName = "v4.0"
Expand Down Expand Up @@ -208,12 +181,6 @@ func (app *UmeeApp) registerUpgrade3_2to3_3(_ upgradetypes.Plan) {
})
}

// performs upgrade from v3.0 -> v3.1
func (app *UmeeApp) registerUpgrade3_1(_ upgradetypes.Plan) {
const planName = "v3.1.0"
app.UpgradeKeeper.SetUpgradeHandler(planName, onlyModuleMigrations(app, planName))
}

// performs upgrade from v1->v3
func (app *UmeeApp) registerUpgrade3_0(upgradeInfo upgradetypes.Plan) {
const planName = "v1.1-v3.0"
Expand Down Expand Up @@ -280,3 +247,14 @@ func (app *UmeeApp) storeUpgrade(planName string, ui upgradetypes.Plan, stores s
upgradetypes.UpgradeStoreLoader(ui.Height, &stores))
}
}

// registerUpgrade sets an upgrade handler which only runs module migrations
// and adds new storages storages
func (app *UmeeApp) registerUpgrade(planName string, upgradeInfo upgradetypes.Plan, newStores ...string) {
app.UpgradeKeeper.SetUpgradeHandler(planName, onlyModuleMigrations(app, planName))

if len(newStores) > 0 {
app.storeUpgrade(planName, upgradeInfo, storetypes.StoreUpgrades{
Added: newStores})
}
}
11 changes: 7 additions & 4 deletions tests/e2e/e2e_ibc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,8 @@ func (s *IntegrationTestSuite) TestIBCTokenTransfer() {

})

// 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 (
Expand All @@ -215,12 +215,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
Expand Down
19 changes: 12 additions & 7 deletions x/uibc/ics20/ibc_module.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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)
}
}

Expand Down
8 changes: 4 additions & 4 deletions x/uibc/quota/ibc_module.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func (im ICS20Middleware) OnAcknowledgementPacket(ctx sdk.Context, packet channe
if _, ok := ack.Response.(*channeltypes.Acknowledgement_Error); ok {
params := im.kb.Keeper(&ctx).GetParams()
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)
}
}
Expand All @@ -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 {
Expand Down
2 changes: 0 additions & 2 deletions x/uibc/quota/keeper/ics4_wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ import (
* Implementation of ICS4Wrapper interface
******/

// TODO: use new structure for ICS4Wrapper

// SendPacket wraps IBC ChannelKeeper's SendPacket function
func (kb Builder) SendPacket(ctx sdk.Context,
chanCap *capabilitytypes.Capability,
Expand Down
2 changes: 1 addition & 1 deletion x/uibc/quota/keeper/quota.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func (k Keeper) ResetAllQuotas() 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(denom string, newOutflow sdkmath.Int) error {
params := k.GetParams()
Expand Down

0 comments on commit 1389500

Please sign in to comment.