Skip to content

Commit

Permalink
Merge branch 'main' into adam/fix
Browse files Browse the repository at this point in the history
  • Loading branch information
robert-zaremba authored Jul 20, 2023
2 parents 0305763 + b52a3b7 commit b802609
Show file tree
Hide file tree
Showing 25 changed files with 542 additions and 194 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ See [Release procedure](CONTRIBUTING.md#release-procedure) for more information
| v4.4.x || v0.46.11+ | v6.1.x | v1.3.x+ | umee/v2.1.4+ | umee/v4 v1.5.3-umee-6 | v1.2.3 |
| v5.0.x || v0.46.13+ | v6.2.x | v1.3.x+ | umee/v2.1.4+ | umee/v4 v1.5.3-umee-8 | v1.2.4 |
| v5.1.x || v0.46.13+ | v6.2.x | --- | umee/v2.1.6+ | umee/v4 v1.5.3-umee-10 | v1.2.4 |
| v6.0.x || v0.46.14+ | v6.2.x | --- | umee/v2.1.6+ | --- | v1.3.0 |

#### Price Feeder

Expand Down
18 changes: 10 additions & 8 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,24 @@

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

## v5.1.0
## v6.0.0

Highlights:

- [`x/incentive`](x/incentive/README.md) module: allows to create incentive programs for liquidity mining.
- new x/leverage security measure: [Borrow Factor](x/leverage/README.md#borrow-factor)
- new x/leverage [`MsgLeveragedLiquidate`](proto/umee/leverage/v1/tx.proto#L59) was added. Allows suppliers to use their active collateral to absorb unhealthy debts. See [Liquidation](x/leverage/README.md#liquidation) for more details.
- Gravity Bridge phase-4: the GB valset was correctly burned. Slashing is removed and there is no need to run Peggo any more.
- TODO

[v5.1.0 CHANGELOG](https://github.com/umee-network/umee/blob/v5.1.0/CHANGELOG.md).
[v6.0.0 CHANGELOG](https://github.com/umee-network/umee/blob/v6.0.0/CHANGELOG.md).

### Validators

#### Peggo
#### libwasmvm update

You can kill Peggo (there is no need to run it any more).
Our dependencies have been updated. Now the binary requires `libwasmvm v1.3.0`. 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:

- copy from `$GOPATH/pkg/mod/github.com/!cosm!wasm/wasmvm@v1.3.0/internal/api/libwasmvm.$(uname -m).so`
- or download from github `wget https://raw.githubusercontent.com/CosmWasm/wasmvm/v1.3.0/internal/api/libwasmvm.$(uname -m).so -O /lib/libwasmvm.$(uname -m).so`

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

#### Min Gas Prices

Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/CosmWasm/wasmd v0.31.0
github.com/CosmWasm/wasmvm v1.3.0
github.com/cosmos/cosmos-proto v1.0.0-beta.3
github.com/cosmos/cosmos-sdk v0.46.13
github.com/cosmos/cosmos-sdk v0.46.14
github.com/cosmos/go-bip39 v1.0.0
github.com/cosmos/ibc-go/v6 v6.2.0
github.com/gogo/protobuf v1.3.3
Expand All @@ -27,7 +27,7 @@ require (
github.com/spf13/cobra v1.7.0
github.com/spf13/viper v1.16.0
github.com/stretchr/testify v1.8.4
github.com/tendermint/tendermint v0.34.28
github.com/tendermint/tendermint v0.34.29
github.com/tendermint/tm-db v0.6.7
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1
google.golang.org/grpc v1.56.2
Expand Down Expand Up @@ -328,7 +328,7 @@ require (

replace (
github.com/CosmWasm/wasmd => github.com/notional-labs/wasmd v0.31.0-umee.46
github.com/cosmos/cosmos-sdk => github.com/umee-network/cosmos-sdk v0.46.13-umee
github.com/cosmos/cosmos-sdk => github.com/umee-network/cosmos-sdk v0.46.14-umee
// dgrijalva/jwt-go is deprecated and doesn't receive security updates.
github.com/dgrijalva/jwt-go => github.com/golang-jwt/jwt/v4 v4.4.2
github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1441,8 +1441,8 @@ github.com/ultraware/whitespace v0.0.5 h1:hh+/cpIcopyMYbZNVov9iSxvJU3OYQg78Sfaqz
github.com/ultraware/whitespace v0.0.5/go.mod h1:aVMh/gQve5Maj9hQ/hg+F75lr/X5A89uZnzAmWSineA=
github.com/umee-network/bech32-ibc v0.3.3 h1:wUX5uSYZl8yiFdttOvunfRihsE4miYmzl7pK2FEUs+U=
github.com/umee-network/bech32-ibc v0.3.3/go.mod h1:UbhzCKN+Z7RoUdCkAanmIy+wufwQ/aQJrDEoVORhC2Y=
github.com/umee-network/cosmos-sdk v0.46.13-umee h1:EeSalZHGoWdkKkCNhNd80jzRMNEQWLyDPUU5aUJQpIs=
github.com/umee-network/cosmos-sdk v0.46.13-umee/go.mod h1:EfY521ATNEla8eJ6oJuZBdgP5+p360s7InnRqX+TWdM=
github.com/umee-network/cosmos-sdk v0.46.14-umee h1:AICL1BKdVrmNcaIp8BkbgsEfaKDW2PXEEBh36Bf09HY=
github.com/umee-network/cosmos-sdk v0.46.14-umee/go.mod h1:9MRixWsgoJ2UmVsCRRePtENFPP3cM+gTC5azEpxgllo=
github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
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=
Expand Down
2 changes: 1 addition & 1 deletion sdkclient/tx/gov.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func (c *Client) TxGovVoteYesAll(proposalID uint64) error {
if _, err = BroadcastTx(*c.ClientContext, *c.txFactory, []sdk.Msg{msg}...); err == nil {
break
}
time.Sleep(time.Second * 1)
time.Sleep(time.Millisecond * 300)
}

if err != nil {
Expand Down
126 changes: 64 additions & 62 deletions tests/e2e/e2e_ibc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"time"

"cosmossdk.io/math"

sdk "github.com/cosmos/cosmos-sdk/types"

appparams "github.com/umee-network/umee/v5/app/params"
Expand All @@ -30,32 +31,51 @@ func (s *E2ETest) checkOutflows(umeeAPIEndpoint, denom string, checkWithExcRate
s.Require().Eventually(
func() bool {
a, err := s.QueryOutflows(umeeAPIEndpoint, denom)
s.Require().NoError(err)
if err != nil {
return false
}
if checkWithExcRate {
s.checkOutflowByPercentage(umeeAPIEndpoint, excDenom, a, amount, sdk.MustNewDecFromStr("0.01"))
}
return true
},
time.Minute,
5*time.Second,
30*time.Second,
500*time.Millisecond,
)
}

func (s *E2ETest) checkSupply(endpoint, ibcDenom string, amount math.Int) {
s.Require().Eventually(
func() bool {
supply, err := s.QueryTotalSupply(endpoint)
s.Require().NoError(err)
s.Require().Equal(supply.AmountOf(ibcDenom).Int64(), amount.Int64())
if err != nil {
return false
}

return supply.AmountOf(ibcDenom).Equal(amount)
},
time.Minute,
5*time.Second,
2*time.Minute,
time.Second,
)
}

func (s *E2ETest) TestIBCTokenTransfer() {
// s.T().Parallel()
// 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)
stakeIBCHash := "ibc/C053D637CCA2A2BA030E2C5EE1B28A16F71CCB0E45E8BE52766DC1B241B77878"
umeeAPIEndpoint := s.UmeeREST()

valAddr, err := s.Chain.Validators[0].KeyInfo.GetAddress()
s.Require().NoError(err)
recipient := valAddr.String()

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

s.checkSupply(umeeAPIEndpoint, stakeIBCHash, token.Amount)
})

s.Run("ibc_transfer_quota", func() {
// require the recipient account receives the IBC tokens (IBC packets ACKd)
Expand All @@ -79,7 +99,7 @@ func (s *E2ETest) TestIBCTokenTransfer() {
s.Require().True(atomPrice.GT(sdk.OneDec()), "price should be non zero, and expecting higher than 1, got: %s", atomPrice)
s.Require().True(c.Amount.GT(sdk.NewInt(2_000_000)), "amount should be non zero, and expecting much higher than 2 atom = 2e6 uatom, got: %s", c.Amount)

s.SendIBC(setup.GaiaChainID, s.Chain.ID, "", c)
s.SendIBC(setup.GaiaChainID, s.Chain.ID, "", c, false)
s.checkSupply(umeeAPIEndpoint, uatomIBCHash, c.Amount)

// sending more tokens than token_quota limit of umee (token_quota is 100$)
Expand All @@ -88,7 +108,7 @@ func (s *E2ETest) TestIBCTokenTransfer() {
exceedAmountOfUmee := sdk.NewDecFromInt(totalQuota).Quo(histoAvgPriceOfUmee)
s.T().Logf("sending %s amount %s more than %s", umeeSymbol, exceedAmountOfUmee.String(), totalQuota.String())
exceedAmountCoin := sdk.NewInt64Coin(appparams.BondDenom, exceedAmountOfUmee.Mul(powerReduction).RoundInt64())
s.SendIBC(s.Chain.ID, setup.GaiaChainID, "", exceedAmountCoin)
s.SendIBC(s.Chain.ID, setup.GaiaChainID, "", exceedAmountCoin, true)
// check the ibc (umee) quota after ibc txs
s.checkSupply(gaiaAPIEndpoint, umeeIBCHash, math.ZeroInt())

Expand All @@ -99,14 +119,14 @@ func (s *E2ETest) TestIBCTokenTransfer() {
belowTokenQuota := sdk.NewDecFromInt(umeeInitialQuota).Quo(histoAvgPriceOfUmee)
s.T().Logf("sending %s amount %s less than token quota %s", "UMEE", belowTokenQuota.String(), tokenQuota.String())
token := sdk.NewInt64Coin(appparams.BondDenom, belowTokenQuota.Mul(powerReduction).RoundInt64())
s.SendIBC(s.Chain.ID, setup.GaiaChainID, "", token)
s.SendIBC(s.Chain.ID, setup.GaiaChainID, "", token, false)
s.checkOutflows(umeeAPIEndpoint, appparams.BondDenom, true, sdk.NewDecFromInt(token.Amount), appparams.Name)
s.checkSupply(gaiaAPIEndpoint, umeeIBCHash, token.Amount)

// send uatom (ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2) from umee to gaia
uatomIBCToken := sdk.NewInt64Coin(uatomIBCHash, c.Amount.Int64())
// supply will be not be decreased because sending uatomIBCToken amount is more than token quota so it will fail
s.SendIBC(s.Chain.ID, setup.GaiaChainID, "", uatomIBCToken)
s.SendIBC(s.Chain.ID, setup.GaiaChainID, "", uatomIBCToken, true)
s.checkSupply(umeeAPIEndpoint, uatomIBCHash, uatomIBCToken.Amount)

// send uatom below the token quota
Expand All @@ -117,111 +137,93 @@ func (s *E2ETest) TestIBCTokenTransfer() {
*/
belowTokenQuotabutNotBelowTotalQuota := sdk.NewDecFromInt(math.NewInt(90)).Quo(atomPrice)
uatomIBCToken.Amount = math.NewInt(belowTokenQuotabutNotBelowTotalQuota.Mul(powerReduction).RoundInt64())
s.SendIBC(s.Chain.ID, setup.GaiaChainID, "", uatomIBCToken)
s.SendIBC(s.Chain.ID, setup.GaiaChainID, "", uatomIBCToken, true)
// supply will be not be decreased because sending more than total quota from umee to gaia
s.checkSupply(umeeAPIEndpoint, uatomIBCHash, c.Amount)
// making sure below the total quota
belowTokenQuotaInUSD := totalQuota.Sub(umeeInitialQuota).Sub(math.NewInt(2))
belowTokenQuotaforAtom := sdk.NewDecFromInt(belowTokenQuotaInUSD).Quo(atomPrice)
uatomIBCToken.Amount = math.NewInt(belowTokenQuotaforAtom.Mul(powerReduction).RoundInt64())
s.SendIBC(s.Chain.ID, setup.GaiaChainID, "", uatomIBCToken)
s.SendIBC(s.Chain.ID, setup.GaiaChainID, "", uatomIBCToken, false)
// remaing supply still exists for uatom in umee
s.checkSupply(umeeAPIEndpoint, uatomIBCHash, c.Amount.Sub(uatomIBCToken.Amount))
s.checkOutflows(umeeAPIEndpoint, uatomIBCHash, true, sdk.NewDecFromInt(uatomIBCToken.Amount), atomSymbol)

// sending more tokens then token_quota limit of umee
s.SendIBC(s.Chain.ID, setup.GaiaChainID, "", exceedAmountCoin)
s.SendIBC(s.Chain.ID, setup.GaiaChainID, "", exceedAmountCoin, true)
// check the ibc (umee) supply after ibc txs, it will same as previous because it will fail because to quota limit exceed
s.checkSupply(gaiaAPIEndpoint, umeeIBCHash, token.Amount)

/* sending back some amount from receiver to sender (ibc/XXX)
gaia -> umee
*/
s.SendIBC(setup.GaiaChainID, s.Chain.ID, "", sdk.NewInt64Coin(umeeIBCHash, 1000))
s.SendIBC(setup.GaiaChainID, s.Chain.ID, "", sdk.NewInt64Coin(umeeIBCHash, 1000), false)
s.checkSupply(gaiaAPIEndpoint, umeeIBCHash, token.Amount.Sub(math.NewInt(1000)))
// sending back remaining ibc amount from receiver to sender (ibc/XXX)
s.SendIBC(setup.GaiaChainID, s.Chain.ID, "", sdk.NewInt64Coin(umeeIBCHash, token.Amount.Sub(math.NewInt(1000)).Int64()))
s.SendIBC(setup.GaiaChainID, s.Chain.ID, "", sdk.NewInt64Coin(umeeIBCHash, token.Amount.Sub(math.NewInt(1000)).Int64()), false)
s.checkSupply(gaiaAPIEndpoint, umeeIBCHash, math.ZeroInt())

// reset the outflows
s.T().Logf("waiting until quota reset, basically it will take around 300 seconds to do quota reset")
s.Require().Eventually(
func() bool {
amount, err := s.QueryOutflows(umeeAPIEndpoint, appparams.BondDenom)
s.Require().NoError(err)
if err != nil {
return false
}
if amount.IsZero() {
s.T().Logf("quota is reset : %s is 0", appparams.BondDenom)
return true
}
return false
},
5*time.Minute,
5*time.Second,
4*time.Minute,
3*time.Second,
)

/****
IBC_Status : disble (making ibc_transfer quota check disabled)
No Outflows will updated
***/
// Make gov proposal to disable the quota check on ibc-transfer
err = grpc.UIBCIBCTransferSatusUpdate(
s.Umee,
uibc.IBCTransferStatus_IBC_TRANSFER_STATUS_QUOTA_DISABLED,
)

for i := 0; i < 5; i++ {
err = grpc.UIBCIBCTransferSatusUpdate(
s.Umee,
uibc.IBCTransferStatus_IBC_TRANSFER_STATUS_QUOTA_DISABLED,
)

if err == nil {
break
}

time.Sleep(1 * time.Second)
}

s.Require().NoError(err)
// Get the uibc params for quota checking
uibcParams, err := s.Umee.QueryUIBCParams()
s.Require().NoError(err)
s.Require().Equal(uibcParams.IbcStatus, uibc.IBCTransferStatus_IBC_TRANSFER_STATUS_QUOTA_DISABLED)
token = sdk.NewInt64Coin("uumee", 100000000) // 100 Umee
// sending the umee tokens
s.SendIBC(s.Chain.ID, setup.GaiaChainID, "", token)

s.SendIBC(s.Chain.ID, setup.GaiaChainID, "", token, false)
// Check the outflows
s.checkSupply(gaiaAPIEndpoint, umeeIBCHash, token.Amount)
s.Require().Eventually(
func() bool {
a, err := s.QueryOutflows(umeeAPIEndpoint, appparams.BondDenom)
s.Require().NoError(err)
if err != nil {
return false
}
return a.Equal(sdk.ZeroDec())
},
time.Minute,
5*time.Second,
30*time.Second,
1*time.Second,
)
// resend the umee token from gaia to umee
s.SendIBC(setup.GaiaChainID, s.Chain.ID, "", sdk.NewInt64Coin(umeeIBCHash, token.Amount.Int64()))
s.SendIBC(setup.GaiaChainID, s.Chain.ID, "", sdk.NewInt64Coin(umeeIBCHash, token.Amount.Int64()), false)
s.checkSupply(gaiaAPIEndpoint, umeeIBCHash, sdk.ZeroInt())
})

// 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 (
balances sdk.Coins
err error
)

stakeIBCHash := "ibc/C053D637CCA2A2BA030E2C5EE1B28A16F71CCB0E45E8BE52766DC1B241B77878"
umeeAPIEndpoint := s.UmeeREST()

valAddr, err := s.Chain.Validators[0].KeyInfo.GetAddress()
s.Require().NoError(err)
recipient := valAddr.String()
token := sdk.NewInt64Coin("stake", 3300000000) // 3300stake
s.SendIBC(setup.GaiaChainID, s.Chain.ID, recipient, token)

s.Require().Eventually(
func() bool {
balances, err = s.QueryUmeeAllBalances(umeeAPIEndpoint, recipient)
s.Require().NoError(err)
// 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, token.Amount)
})
}
20 changes: 15 additions & 5 deletions tests/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package e2e

import (
"testing"
"time"

"github.com/stretchr/testify/suite"

Expand Down Expand Up @@ -34,11 +35,20 @@ func (s *E2ETest) TestUpdateOracleParams() {
s.Require().Equal(uint64(4), params.MaximumPriceStamps)
s.Require().Equal(uint64(20), params.MedianStampPeriod)

err = grpc.SubmitAndPassProposal(
s.Umee,
grpc.OracleParamChanges(10, 2, 20),
)
s.Require().NoError(err)
// simple retry loop to submit and pass a proposal
for i := 0; i < 3; i++ {
err = grpc.SubmitAndPassProposal(
s.Umee,
grpc.OracleParamChanges(10, 2, 20),
)
if err == nil {
break
}

time.Sleep(1 * time.Second)
}

s.Require().NoError(err, "submit and pass proposal")

params, err = s.Umee.QueryOracleParams()
s.Require().NoError(err)
Expand Down
2 changes: 2 additions & 0 deletions tests/e2e/scripts/gaia_bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ gaiad gentx val01 500000000000stake --chain-id=$UMEE_E2E_GAIA_CHAIN_ID --keyring
gaiad collect-gentxs
sed -i 's/127.0.0.1:26657/0.0.0.0:26657/g' /root/.gaia/config/config.toml
sed -i -e 's/enable = false/enable = true/g' /root/.gaia/config/app.toml
sed -i -e 's/pruning = "default"/pruning = "nothing"/g' /root/.gaia/config/app.toml
sed -i 's/timeout_commit = "5s"/timeout_commit = "300ms"/g' /root/.gaia/config/config.toml
gaiad start --x-crisis-skip-assert-invariants
2 changes: 1 addition & 1 deletion tests/e2e/scripts/hermes_bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ enabled = false
[mode.packets]
enabled = true
clear_interval = 100
clear_interval = 10
clear_on_start = true
tx_confirmation = true
Expand Down
Loading

0 comments on commit b802609

Please sign in to comment.