From f9a58fc681b6aa7bee210cbdb8b30e4f9f476f3c Mon Sep 17 00:00:00 2001 From: Adam Wozniak <29418299+adamewozniak@users.noreply.github.com> Date: Mon, 19 Sep 2022 06:46:59 -0700 Subject: [PATCH 01/20] docs: price-feeder updates (#1423) --- .mergify.yml | 6 +++--- README.md | 3 ++- price-feeder/CHANGELOG.md | 2 ++ 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.mergify.yml b/.mergify.yml index 649f9a4857..91c5a61fa3 100644 --- a/.mergify.yml +++ b/.mergify.yml @@ -27,11 +27,11 @@ pull_request_rules: branches: - release/v3.x.x - - name: Backport patches to the release/price-feeder/v0.3.x branch + - name: Backport patches to the release/price-feeder/v1.x.x branch conditions: - base=main - - label=S:backport/price-feeder/v0.3.x + - label=S:backport/price-feeder/v1.x.x actions: backport: branches: - - release/price-feeder/v0.3.x + - release/price-feeder/v1.x.x diff --git a/README.md b/README.md index 63d3388d8d..4a9aa862e8 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,7 @@ Umee will allow a multitude of decentralized debt products. - [Public](#public) - [Private](#private) - [Install](#install) + - [Swagger](#swagger) ## Releases @@ -42,7 +43,7 @@ See [Release procedure](CONTRIBUTING.md#release-procedure) for more information | v0.8.x | ✗ | ✓ | v0.45.x | v2.0.x | v0.2.x | v0.1.x | | | v1.x.x | ✓ | ✗ | v0.45.x | v2.0.x | v0.2.x | N/A | umee/v1 module/v1.4.x-umee | | v2.x.x | ✗ | ✓ | v0.45.x | v2.3.x | v0.2.x | v0.2.x | umee/v2 module/v1.4.x | -| v3.x.x | ✓ | ✗ | v0.46.x | v5.0.x | v1.0.x | v0.3.x | umee/v3 module/v1.5.x-umee | +| v3.x.x | ✓ | ✗ | v0.46.x | v5.0.x | v1.0.x | v1.0.x | umee/v3 module/v1.5.x-umee | ## Active Networks diff --git a/price-feeder/CHANGELOG.md b/price-feeder/CHANGELOG.md index 5471a14ea0..8a346b856a 100644 --- a/price-feeder/CHANGELOG.md +++ b/price-feeder/CHANGELOG.md @@ -46,6 +46,8 @@ Ref: https://keepachangelog.com/en/1.0.0/ ## [Unreleased] +## [v1.0.0](https://github.com/umee-network/umee/releases/tag/price-feeder%2Fv1.0.0) - 2022-09-19 + ### Features - [1328](https://github.com/umee-network/umee/pull/1328) Add bitget provider. From 6dfc8be1406eeb1f2dccc96a1e1fa872465b03d3 Mon Sep 17 00:00:00 2001 From: Robert Zaremba Date: Mon, 19 Sep 2022 16:08:37 +0100 Subject: [PATCH 02/20] docs: release notes draft (#1404) ## Description + Adding a first version of the release notes + backported changelog notes related to v1.1 release --- ### Author Checklist _All items are required. Please add a note to the item if the item is not applicable and please add links to any relevant follow up issues._ I have... - [ ] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] added `!` to the type prefix if API or client breaking change - [ ] added appropriate labels to the PR - [ ] targeted the correct branch (see [PR Targeting](https://github.com/umee-network/umee/blob/main/CONTRIBUTING.md#pr-targeting)) - [ ] provided a link to the relevant issue or specification - [ ] added a changelog entry to `CHANGELOG.md` - [ ] included comments for [documenting Go code](https://blog.golang.org/godoc) - [ ] updated the relevant documentation or specification - [ ] reviewed "Files changed" and left comments if necessary - [ ] confirmed all CI checks have passed ### Reviewers Checklist _All items are required. Please add a note if the item is not applicable and please add your handle next to the items reviewed if you only reviewed selected items._ I have... - [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] confirmed all author checklist items have been addressed - [ ] reviewed state machine logic - [ ] reviewed API design and naming - [ ] reviewed documentation is accurate - [ ] reviewed tests and test coverage - [ ] manually tested (if applicable) --- CHANGELOG.md | 16 +++++++++++ RELEASE_NOTES.md | 51 ++++++++++++++++++++++++++++++++++ ante/fee.go | 6 ++-- ante/fee_test.go | 2 +- app/params/app_settings.go | 8 ++++-- app/test_helpers.go | 2 +- cmd/umeed/cmd/app_creator.go | 2 +- tests/e2e/e2e_setup_test.go | 2 +- util/sim/deliver.go | 4 +-- x/oracle/client/tests/suite.go | 2 +- 10 files changed, 83 insertions(+), 12 deletions(-) create mode 100644 RELEASE_NOTES.md diff --git a/CHANGELOG.md b/CHANGELOG.md index c126d1bf84..dc2da72664 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -175,6 +175,22 @@ Ref: https://keepachangelog.com/en/1.0.0/ - Convexity upgrade!!! +## [v1.1.0](https://github.com/umee-network/umee/releases/tag/v1.1.0) - 2022-09-08 + +### State Machine Breaking + +- [1358](https://github.com/umee-network/umee/pull/1358/files) Disable Gravity Bridge bridge messages. + +### Improvements + +- [#1355](https://github.com/umee-network/umee/pull/1355) Update tooling to go1.19 and CI to the latest setup (based on v3). + +## [v1.0.4](https://github.com/umee-network/umee/releases/tag/v1.0.4) - - 2022-09-08 + +### Improvements + +- [#1353](https://github.com/umee-network/umee/pull/1353) Gravity Bridge update + ## [v1.0.3](https://github.com/umee-network/umee/releases/tag/v1.0.3) - 2022-02-17 ### State Machine Breaking diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md new file mode 100644 index 0000000000..613c7683f0 --- /dev/null +++ b/RELEASE_NOTES.md @@ -0,0 +1,51 @@ + + + +# Release Notes + +## v3.0.0 + +v3.0.0 improves upon the _umeemania_ testnet release (v2.0.x) which introduced our **lending** and **oracle** functionality. + +### Highlights since v1.x + +- `x/leverage` module, which allows anyone to: + - supply liquidity (and earn interest) + - collateralize the supplied assets to enable borrowing + - borrow (and pay interest) + - participate in governance of `x/leverage` [parameters](https://github.com/umee-network/umee/blob/main/proto/umee/leverage/v1/leverage.proto) file. +- `x/oracle` module - a decentralized price oracle for the `x/leverage` module, as well as any app built in the Umee blockchain. UMEE holders set `x/oracle` [parameters](https://github.com/umee-network/umee/blob/main/proto/umee/oracle/v1/oracle.proto) by governance. +- Cosmos v0.46 upgrade, which features: + - [`x/group`](https://tutorials.cosmos.network/tutorials/understanding-group/) module + - [`x/nft`](https://github.com/cosmos/cosmos-sdk/tree/v0.46.1/x/nft/spec) module + - [Transaction Tips](https://github.com/cosmos/cosmos-sdk/blob/v0.46.0/RELEASE_NOTES.md#transaction-tips-and-sign_mode_direct_aux) + - [SIGN_MODE_DIRECT_AUX](https://github.com/cosmos/cosmos-sdk/blob/v0.46.0/RELEASE_NOTES.md#transaction-tips-and-sign_mode_direct_aux) + - transaction prioritization +- IBC v5.0 + + +#### x/leverage settings + +The leverage module is by default compiled without support for the `liquidation_targets` query. + +Validators should NOT enable this query on their nodes - it is inefficient due to iterating over all borrower accounts, and can delay time-sensitive consensus operations when a sufficient number of addresses must be checked. + +To run a node capable of supporting a liquidator, enable the query at compile time using `LIQUIDATOR=true make install`. + +### Gravity Bridge + +In `v1.1.x` (current mainnet) we disabled Gravity Bridge (GB) module due to Ethereum PoS migration (_the merge_). +This release is the first step to re-enable GB. We start by enabling validators update end evidence messages (`MsgValsetConfirm` and `MsgValsetUpdatedClaim`), but the bridge messages: batch creation, claims (both ways: Ethereum->Cosmos and Cosmos->Ethereum) remain disabled. + +See [Gravity Bridge](https://github.com/umee-network/Gravity-Bridge/blob/module/v1.5.3-umee-1/module/RELEASE_NOTES.md) Release Notes. + +### Update notes + +Each validator must run: + +- Peggo (Gravity Bridge Orchestrator). +- [Price Feeder](https://github.com/umee-network/umee/tree/main/price-feeder). + +Instructions: [umeeversity/validator](https://umeeversity.umee.cc/validators/mainnet-validator.html) + +Failure to run Peggo and Price Feeder results in being slashed, as do certain types of misbehavior such as consistently submitting incorrect prices. diff --git a/ante/fee.go b/ante/fee.go index daa6ae6673..0d19f0a028 100644 --- a/ante/fee.go +++ b/ante/fee.go @@ -50,7 +50,7 @@ func checkFees(minGasPrices sdk.DecCoins, fees sdk.Coins, gasLimit uint64) error } } else { // in deliverTx = use protocol min gas price - minGasPrices = sdk.DecCoins{appparams.MinMinGasPrice} + minGasPrices = sdk.DecCoins{appparams.ProtocolMinGasPrice} } requiredFees := sdk.NewCoins() @@ -109,9 +109,9 @@ func IsOracleOrGravityTx(msgs []sdk.Msg) bool { // AssertMinProtocolGasPrice returns an error if the provided gasPrices are lower then // the required by protocol. func AssertMinProtocolGasPrice(gasPrices sdk.DecCoins) error { - if gasPrices.AmountOf(appparams.MinMinGasPrice.Denom).LT(appparams.MinMinGasPrice.Amount) { + if gasPrices.AmountOf(appparams.ProtocolMinGasPrice.Denom).LT(appparams.ProtocolMinGasPrice.Amount) { return sdkerrors.ErrInsufficientFee.Wrapf( - "gas price too small; got: %v required min: %v", gasPrices, appparams.MinMinGasPrice) + "gas price too small; got: %v required min: %v", gasPrices, appparams.ProtocolMinGasPrice) } return nil diff --git a/ante/fee_test.go b/ante/fee_test.go index 4d4433f97d..03db76cf7a 100644 --- a/ante/fee_test.go +++ b/ante/fee_test.go @@ -21,7 +21,7 @@ func (suite *IntegrationTestSuite) TestFeeAndPriority() { msgs := testdata.NewTestMsg(addr1) require.NoError(suite.txBuilder.SetMsgs(msgs)) - minGas := appparams.MinMinGasPrice + minGas := appparams.ProtocolMinGasPrice mkFee := func(factor string) sdk.Coins { return coin.NewDecBld(minGas).Scale(int64(appparams.DefaultGasLimit)).ScaleStr(factor).ToCoins() } diff --git a/app/params/app_settings.go b/app/params/app_settings.go index fe3b821f86..c0d489dd82 100644 --- a/app/params/app_settings.go +++ b/app/params/app_settings.go @@ -21,8 +21,12 @@ const ( DefaultGasLimit = 200000 ) -// MinMinGasPrice is the minimum value a validator can set for `minimum-gas-prices` his app.toml config -var MinMinGasPrice = sdk.NewDecCoinFromDec(BondDenom, sdk.MustNewDecFromStr("0.00")) +var ( + // ProtocolMinGasPrice is a consensus controlled gas price. Each validator must set his + // `minimum-gas-prices` in app.toml config to value above ProtocolMinGasPrice. + // Transactions with gas-price smaller than ProtocolMinGasPrice will fail during DeliverTx. + ProtocolMinGasPrice = sdk.NewDecCoinFromDec(BondDenom, sdk.MustNewDecFromStr("0.00")) +) func init() { // XXX: If other upstream or external application's depend on any of Umee's diff --git a/app/test_helpers.go b/app/test_helpers.go index fa2d3c7d86..db19d3d6bc 100644 --- a/app/test_helpers.go +++ b/app/test_helpers.go @@ -308,7 +308,7 @@ func IntegrationTestNetworkConfig() network.Config { cfg.InterfaceRegistry = encCfg.InterfaceRegistry cfg.GenesisState = appGenState cfg.BondDenom = params.BondDenom - cfg.MinGasPrices = params.MinMinGasPrice.String() + cfg.MinGasPrices = params.ProtocolMinGasPrice.String() cfg.AppConstructor = func(val network.Validator) servertypes.Application { return New( val.Ctx.Logger, diff --git a/cmd/umeed/cmd/app_creator.go b/cmd/umeed/cmd/app_creator.go index bb45b595c0..42bebfe146 100644 --- a/cmd/umeed/cmd/app_creator.go +++ b/cmd/umeed/cmd/app_creator.go @@ -95,7 +95,7 @@ func mustMinUmeeGasPrice(minGasPrices string) { } if err := ante.AssertMinProtocolGasPrice(gasPrices); err != nil { stdlog.Fatal("minimum-gas-price config in app.toml must be at least ", - appparams.MinMinGasPrice, " [", err, "]") + appparams.ProtocolMinGasPrice, " [", err, "]") } } diff --git a/tests/e2e/e2e_setup_test.go b/tests/e2e/e2e_setup_test.go index 20efa84ec6..a40fd0e7c8 100644 --- a/tests/e2e/e2e_setup_test.go +++ b/tests/e2e/e2e_setup_test.go @@ -47,7 +47,7 @@ const ( ) var ( - minGasPrice = appparams.MinMinGasPrice.String() + minGasPrice = appparams.ProtocolMinGasPrice.String() stakeAmount, _ = sdk.NewIntFromString("100000000000") stakeAmountCoin = sdk.NewCoin(appparams.BondDenom, stakeAmount) ) diff --git a/util/sim/deliver.go b/util/sim/deliver.go index 4c2f25bcc1..2b03f47df8 100644 --- a/util/sim/deliver.go +++ b/util/sim/deliver.go @@ -29,10 +29,10 @@ func GenAndDeliver(bk bankkeeper.Keeper, o simulation.OperationInput, gasLimit s return simtypes.NoOpMsg(o.ModuleName, o.MsgType, "message doesn't leave room for fees"), nil, nil } - fees := coin.NewDecBld(appparams.MinMinGasPrice). + fees := coin.NewDecBld(appparams.ProtocolMinGasPrice). Scale(int64(gasLimit)).ToCoins() if _, hasNeg = spendable.SafeSub(fees...); hasNeg { - fund := coin.NewDecBld(appparams.MinMinGasPrice). + fund := coin.NewDecBld(appparams.ProtocolMinGasPrice). Scale(int64(gasLimit * 1000)).ToCoins() err := banktestutil.FundAccount(bk, o.Context, o.SimAccount.Address, fund) if err != nil { diff --git a/x/oracle/client/tests/suite.go b/x/oracle/client/tests/suite.go index 249166c89a..9a760e53d0 100644 --- a/x/oracle/client/tests/suite.go +++ b/x/oracle/client/tests/suite.go @@ -81,7 +81,7 @@ func (s *IntegrationTestSuite) TestDelegateFeedConsent() { s.network.Validators[1].Address.String(), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), - fmt.Sprintf("--%s=%s", flags.FlagGasPrices, appparams.MinMinGasPrice), + fmt.Sprintf("--%s=%s", flags.FlagGasPrices, appparams.ProtocolMinGasPrice), }, expectErr: false, expectedCode: 0, From 3caffaf91933546142e3b1967125cb6a0af0968b Mon Sep 17 00:00:00 2001 From: Robert Zaremba Date: Tue, 20 Sep 2022 00:55:23 +0100 Subject: [PATCH 03/20] Use 1.2 gas_adjustment in price-feeder e2e tests (#1420) --- tests/e2e/scripts/price_feeder_bootstrap.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/e2e/scripts/price_feeder_bootstrap.sh b/tests/e2e/scripts/price_feeder_bootstrap.sh index c233d1b9ab..70e8d715c7 100755 --- a/tests/e2e/scripts/price_feeder_bootstrap.sh +++ b/tests/e2e/scripts/price_feeder_bootstrap.sh @@ -8,7 +8,7 @@ touch /root/.price-feeder/config.toml # setup price-feeder configuration tee /root/.price-feeder/config.toml < Date: Mon, 19 Sep 2022 23:45:02 -0300 Subject: [PATCH 04/20] fix: moved to v300rc1 (#1428) * moved to v300rc1 * add #1428 to changelog Co-authored-by: toteki <63419657+toteki@users.noreply.github.com> --- price-feeder/CHANGELOG.md | 4 ++++ price-feeder/go.mod | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/price-feeder/CHANGELOG.md b/price-feeder/CHANGELOG.md index 8a346b856a..e0d3fc8f2c 100644 --- a/price-feeder/CHANGELOG.md +++ b/price-feeder/CHANGELOG.md @@ -46,6 +46,10 @@ Ref: https://keepachangelog.com/en/1.0.0/ ## [Unreleased] +### Bugs + +- [1428](https://github.com/umee-network/umee/pull/1428) Update umeed version to an actual tag. + ## [v1.0.0](https://github.com/umee-network/umee/releases/tag/price-feeder%2Fv1.0.0) - 2022-09-19 ### Features diff --git a/price-feeder/go.mod b/price-feeder/go.mod index 18e1ba3437..00d28b50a5 100644 --- a/price-feeder/go.mod +++ b/price-feeder/go.mod @@ -17,7 +17,7 @@ require ( github.com/spf13/viper v1.13.0 github.com/stretchr/testify v1.8.0 github.com/tendermint/tendermint v0.34.21 - github.com/umee-network/umee/v3 v3.0.0 + github.com/umee-network/umee/v3 v3.0.0-rc1 golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 google.golang.org/grpc v1.49.0 gopkg.in/yaml.v3 v3.0.1 From f8863d9ed4ffa5326371a9babf36d484b98a1bf2 Mon Sep 17 00:00:00 2001 From: Robert Zaremba Date: Tue, 20 Sep 2022 18:14:21 +0100 Subject: [PATCH 05/20] fix: oracle EndBlocker must be before gov and staking (#1434) --- app/app.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/app.go b/app/app.go index 4abbffa04e..481e90f242 100644 --- a/app/app.go +++ b/app/app.go @@ -576,7 +576,9 @@ func New( ) app.mm.SetOrderEndBlockers( - crisistypes.ModuleName, govtypes.ModuleName, stakingtypes.ModuleName, + crisistypes.ModuleName, + oracletypes.ModuleName, // must be before gov and staking + govtypes.ModuleName, stakingtypes.ModuleName, ibchost.ModuleName, ibctransfertypes.ModuleName, capabilitytypes.ModuleName, authtypes.ModuleName, banktypes.ModuleName, distrtypes.ModuleName, slashingtypes.ModuleName, minttypes.ModuleName, From 09bbf02ed38b1d66c0fbe275991cfb83e57fb774 Mon Sep 17 00:00:00 2001 From: Robert Zaremba Date: Tue, 20 Sep 2022 18:24:54 +0100 Subject: [PATCH 06/20] fix: RewardBallotWinners determinism (#1433) ## Description Fixes RC1 Canon consensus failure. Bug was in: https://github.com/umee-network/umee/pull/1433/files#diff-971aeedb004816fd5770d86dfa2d9ee39c5e53d7802773dd9e81cbc2cf890f62L60 --- ### Author Checklist _All items are required. Please add a note to the item if the item is not applicable and please add links to any relevant follow up issues._ I have... - [ ] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] added `!` to the type prefix if API or client breaking change - [ ] added appropriate labels to the PR - [ ] targeted the correct branch (see [PR Targeting](https://github.com/umee-network/umee/blob/main/CONTRIBUTING.md#pr-targeting)) - [ ] provided a link to the relevant issue or specification - [ ] added a changelog entry to `CHANGELOG.md` - [ ] included comments for [documenting Go code](https://blog.golang.org/godoc) - [ ] updated the relevant documentation or specification - [ ] reviewed "Files changed" and left comments if necessary - [ ] confirmed all CI checks have passed ### Reviewers Checklist _All items are required. Please add a note if the item is not applicable and please add your handle next to the items reviewed if you only reviewed selected items._ I have... - [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] confirmed all author checklist items have been addressed - [ ] reviewed state machine logic - [ ] reviewed API design and naming - [ ] reviewed documentation is accurate - [ ] reviewed tests and test coverage - [ ] manually tested (if applicable) --- x/oracle/abci.go | 2 +- x/oracle/keeper/reward.go | 3 ++- x/oracle/keeper/reward_test.go | 9 +++++---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/x/oracle/abci.go b/x/oracle/abci.go index 02686abd8e..e936ea6277 100644 --- a/x/oracle/abci.go +++ b/x/oracle/abci.go @@ -77,7 +77,7 @@ func EndBlocker(ctx sdk.Context, k keeper.Keeper) error { int64(params.VotePeriod), int64(params.RewardDistributionWindow), voteTargetDenoms, - validatorClaimMap, + claimSlice, ) // Clear the ballot diff --git a/x/oracle/keeper/reward.go b/x/oracle/keeper/reward.go index a55622a972..d1e3cfb3d5 100644 --- a/x/oracle/keeper/reward.go +++ b/x/oracle/keeper/reward.go @@ -16,7 +16,7 @@ func (k Keeper) RewardBallotWinners( votePeriod int64, rewardDistributionWindow int64, voteTargets []string, - ballotWinners map[string]types.Claim, + ballotWinners []types.Claim, ) { rewardDenoms := make([]string, len(voteTargets)+1) rewardDenoms[0] = types.UmeeDenom @@ -57,6 +57,7 @@ func (k Keeper) RewardBallotWinners( // distribute rewards var distributedReward sdk.Coins + for _, winner := range ballotWinners { receiverVal := k.StakingKeeper.Validator(ctx, winner.Recipient) // in case absence of the validator, we just skip distribution diff --git a/x/oracle/keeper/reward_test.go b/x/oracle/keeper/reward_test.go index 58a84c2b6e..9c9d7a872a 100644 --- a/x/oracle/keeper/reward_test.go +++ b/x/oracle/keeper/reward_test.go @@ -9,9 +9,9 @@ import ( // Test the reward giving mechanism func (s *IntegrationTestSuite) TestRewardBallotWinners() { // Add claim pools - claims := map[string]types.Claim{ - valAddr.String(): types.NewClaim(10, 10, 0, valAddr), - valAddr2.String(): types.NewClaim(20, 20, 0, valAddr2), + claims := []types.Claim{ + types.NewClaim(10, 10, 0, valAddr), + types.NewClaim(20, 20, 0, valAddr2), } // Prepare reward pool @@ -38,7 +38,8 @@ func (s *IntegrationTestSuite) TestRewardBallotWinners() { } func (s *IntegrationTestSuite) TestRewardBallotWinnersZeroPower() { - s.app.OracleKeeper.RewardBallotWinners(s.ctx, 0, 0, []string{}, map[string]types.Claim{valAddr.String(): {}}) + zeroClaim := types.NewClaim(0, 0, 0, valAddr) + s.app.OracleKeeper.RewardBallotWinners(s.ctx, 0, 0, []string{}, []types.Claim{zeroClaim}) outstandingRewardsDec := s.app.DistrKeeper.GetValidatorOutstandingRewardsCoins(s.ctx, valAddr) s.Require().Equal("", outstandingRewardsDec.String()) } From abcdb11b82d39a6b6e08bb480e3579e37a585054 Mon Sep 17 00:00:00 2001 From: Robert Zaremba Date: Tue, 20 Sep 2022 18:43:19 +0100 Subject: [PATCH 07/20] fix: oracle.RewardBallotWinner detect duplicated uumee (#1432) ## Description --- ### Author Checklist _All items are required. Please add a note to the item if the item is not applicable and please add links to any relevant follow up issues._ I have... - [ ] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] added `!` to the type prefix if API or client breaking change - [ ] added appropriate labels to the PR - [ ] targeted the correct branch (see [PR Targeting](https://github.com/umee-network/umee/blob/main/CONTRIBUTING.md#pr-targeting)) - [ ] provided a link to the relevant issue or specification - [ ] added a changelog entry to `CHANGELOG.md` - [ ] included comments for [documenting Go code](https://blog.golang.org/godoc) - [ ] updated the relevant documentation or specification - [ ] reviewed "Files changed" and left comments if necessary - [ ] confirmed all CI checks have passed ### Reviewers Checklist _All items are required. Please add a note if the item is not applicable and please add your handle next to the items reviewed if you only reviewed selected items._ I have... - [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] confirmed all author checklist items have been addressed - [ ] reviewed state machine logic - [ ] reviewed API design and naming - [ ] reviewed documentation is accurate - [ ] reviewed tests and test coverage - [ ] manually tested (if applicable) --- util/genmap/list.go | 11 +++++++++++ x/oracle/keeper/reward.go | 23 +++++++++++++---------- x/oracle/keeper/reward_unit_test.go | 25 +++++++++++++++++++++++++ 3 files changed, 49 insertions(+), 10 deletions(-) create mode 100644 util/genmap/list.go create mode 100644 x/oracle/keeper/reward_unit_test.go diff --git a/util/genmap/list.go b/util/genmap/list.go new file mode 100644 index 0000000000..610c40b5ff --- /dev/null +++ b/util/genmap/list.go @@ -0,0 +1,11 @@ +package genmap + +// Contains returns true if x is in ls +func Contains[T comparable](x T, ls []T) bool { + for i := range ls { + if ls[i] == x { + return true + } + } + return false +} diff --git a/x/oracle/keeper/reward.go b/x/oracle/keeper/reward.go index d1e3cfb3d5..339ddb2775 100644 --- a/x/oracle/keeper/reward.go +++ b/x/oracle/keeper/reward.go @@ -5,9 +5,21 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/umee-network/umee/v3/util/genmap" "github.com/umee-network/umee/v3/x/oracle/types" ) +// prependUmeeIfUnique pushs `uumee` denom to the front of the list, if it is not yet included. +func prependUmeeIfUnique(voteTargets []string) []string { + if genmap.Contains(types.UmeeDenom, voteTargets) { + return voteTargets + } + rewardDenoms := make([]string, len(voteTargets)+1) + rewardDenoms[0] = types.UmeeDenom + copy(rewardDenoms[1:], voteTargets) + return rewardDenoms +} + // RewardBallotWinners is executed at the end of every voting period, where we // give out a portion of seigniorage reward(reward-weight) to the oracle voters // that voted correctly. @@ -18,15 +30,6 @@ func (k Keeper) RewardBallotWinners( voteTargets []string, ballotWinners []types.Claim, ) { - rewardDenoms := make([]string, len(voteTargets)+1) - rewardDenoms[0] = types.UmeeDenom - - i := 1 - for _, denom := range voteTargets { - rewardDenoms[i] = denom - i++ - } - // sum weight of the claims var ballotPowerSum int64 for _, winner := range ballotWinners { @@ -39,8 +42,8 @@ func (k Keeper) RewardBallotWinners( } distributionRatio := sdk.NewDec(votePeriod).QuoInt64(rewardDistributionWindow) - var periodRewards sdk.DecCoins + rewardDenoms := prependUmeeIfUnique(voteTargets) for _, denom := range rewardDenoms { rewardPool := k.GetRewardPool(ctx, denom) diff --git a/x/oracle/keeper/reward_unit_test.go b/x/oracle/keeper/reward_unit_test.go new file mode 100644 index 0000000000..a7e0e0c224 --- /dev/null +++ b/x/oracle/keeper/reward_unit_test.go @@ -0,0 +1,25 @@ +package keeper + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func TestPrependUmeeIfUnique(t *testing.T) { + require := require.New(t) + tcs := []struct { + in []string + out []string + }{ + // Should prepend "uumee" to a slice of denoms, unless it is already present. + {[]string{}, []string{"uumee"}}, + {[]string{"a"}, []string{"uumee", "a"}}, + {[]string{"x", "a", "heeeyyy"}, []string{"uumee", "x", "a", "heeeyyy"}}, + {[]string{"x", "a", "uumee"}, []string{"x", "a", "uumee"}}, + } + for i, tc := range tcs { + require.Equal(tc.out, prependUmeeIfUnique(tc.in), i) + } + +} From 7c5df71062a9b9f56342a07a15e087cee9a40128 Mon Sep 17 00:00:00 2001 From: Robert Zaremba Date: Tue, 20 Sep 2022 19:23:12 +0100 Subject: [PATCH 08/20] chore: update gravity bridge (#1435) ## Description backporting the "disable slashing" --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 1ef82dfea9..0901281060 100644 --- a/go.mod +++ b/go.mod @@ -317,7 +317,7 @@ require ( ) replace ( - github.com/Gravity-Bridge/Gravity-Bridge/module => github.com/umee-network/Gravity-Bridge/module v1.5.3-umee-1 + github.com/Gravity-Bridge/Gravity-Bridge/module => github.com/umee-network/Gravity-Bridge/module v1.5.3-umee-1.0.20220920174852-ca3dc9795c13 github.com/cosmos/cosmos-sdk => github.com/umee-network/cosmos-sdk v0.46.1-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 diff --git a/go.sum b/go.sum index 84dec14319..98063c4519 100644 --- a/go.sum +++ b/go.sum @@ -1293,8 +1293,8 @@ github.com/ultraware/funlen v0.0.3 h1:5ylVWm8wsNwH5aWo9438pwvsK0QiqVuUrt9bn7S/iL github.com/ultraware/funlen v0.0.3/go.mod h1:Dp4UiAus7Wdb9KUZsYWZEWiRzGuM2kXM1lPbfaF6xhA= github.com/ultraware/whitespace v0.0.5 h1:hh+/cpIcopyMYbZNVov9iSxvJU3OYQg78Sfaqzi/CzI= github.com/ultraware/whitespace v0.0.5/go.mod h1:aVMh/gQve5Maj9hQ/hg+F75lr/X5A89uZnzAmWSineA= -github.com/umee-network/Gravity-Bridge/module v1.5.3-umee-1 h1:a4OGAGfmZ+jcHH//HuQCLeDYpLy3282t3deVKRPt+RU= -github.com/umee-network/Gravity-Bridge/module v1.5.3-umee-1/go.mod h1:UN4ehDuy5PA1YY7juvBMMulyiKv7uBMLUbTV/vONzH0= +github.com/umee-network/Gravity-Bridge/module v1.5.3-umee-1.0.20220920174852-ca3dc9795c13 h1:pW4doyPRJOD64oxAT96enYa+ADAsFpLGlsoAlpITOC0= +github.com/umee-network/Gravity-Bridge/module v1.5.3-umee-1.0.20220920174852-ca3dc9795c13/go.mod h1:UN4ehDuy5PA1YY7juvBMMulyiKv7uBMLUbTV/vONzH0= github.com/umee-network/bech32-ibc v0.3.0-rc1.0.20220831212913-42baad053f6e h1:RCxnO359ieolUDIT1cF7Ic3ms4epgmZxzNiz1a2IBeU= github.com/umee-network/bech32-ibc v0.3.0-rc1.0.20220831212913-42baad053f6e/go.mod h1:Prssr3u1p2ICcgkhtMaX55NZv7A7E2ernO6fKrpolSg= github.com/umee-network/cosmos-sdk v0.46.1-umee h1:htt48oCN/i0An5z8AS8ttXU3Dk7fiE/gWNvwQGGOJgs= From 421da96607b66302c75feedc2e40092e70f2e10c Mon Sep 17 00:00:00 2001 From: Adam Wozniak <29418299+adamewozniak@users.noreply.github.com> Date: Tue, 20 Sep 2022 19:55:25 -0700 Subject: [PATCH 09/20] fix: oracle endblocker order fix (#1438) --- app/app.go | 1 - 1 file changed, 1 deletion(-) diff --git a/app/app.go b/app/app.go index 481e90f242..b75ba3004a 100644 --- a/app/app.go +++ b/app/app.go @@ -587,7 +587,6 @@ func New( paramstypes.ModuleName, upgradetypes.ModuleName, vestingtypes.ModuleName, // icatypes.ModuleName, leveragetypes.ModuleName, - oracletypes.ModuleName, gravitytypes.ModuleName, bech32ibctypes.ModuleName, ) From c54d166b163235be67db076dafb3b785f7398f90 Mon Sep 17 00:00:00 2001 From: Robert Zaremba Date: Wed, 21 Sep 2022 13:43:20 +0100 Subject: [PATCH 10/20] feat: ibc ante handlers and upgrade cleanup (#1441) ## Description streamming down https://github.com/umee-network/umee/pull/1425 changes. --- ### Author Checklist _All items are required. Please add a note to the item if the item is not applicable and please add links to any relevant follow up issues._ I have... - [ ] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] added `!` to the type prefix if API or client breaking change - [ ] added appropriate labels to the PR - [ ] targeted the correct branch (see [PR Targeting](https://github.com/umee-network/umee/blob/main/CONTRIBUTING.md#pr-targeting)) - [ ] provided a link to the relevant issue or specification - [ ] added a changelog entry to `CHANGELOG.md` - [ ] included comments for [documenting Go code](https://blog.golang.org/godoc) - [ ] updated the relevant documentation or specification - [ ] reviewed "Files changed" and left comments if necessary - [ ] confirmed all CI checks have passed ### Reviewers Checklist _All items are required. Please add a note if the item is not applicable and please add your handle next to the items reviewed if you only reviewed selected items._ I have... - [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] confirmed all author checklist items have been addressed - [ ] reviewed state machine logic - [ ] reviewed API design and naming - [ ] reviewed documentation is accurate - [ ] reviewed tests and test coverage - [ ] manually tested (if applicable) --- ante/ante.go | 4 +++ app/app.go | 3 +- app/upgrades.go | 33 ++++++++----------- .../v3 => upgradev3}/expected_types.go | 2 +- .../migrations.go} | 10 +++++- .../v3 => upgradev3}/min_commission_test.go | 2 +- .../v3 => upgradev3}/staking_util_test.go | 2 +- 7 files changed, 32 insertions(+), 24 deletions(-) rename app/{upgrades/v3 => upgradev3}/expected_types.go (96%) rename app/{upgrades/v3/min_commission.go => upgradev3/migrations.go} (71%) rename app/{upgrades/v3 => upgradev3}/min_commission_test.go (98%) rename app/{upgrades/v3 => upgradev3}/staking_util_test.go (99%) diff --git a/ante/ante.go b/ante/ante.go index 4139fe5da0..01ad29a64b 100644 --- a/ante/ante.go +++ b/ante/ante.go @@ -6,6 +6,8 @@ import ( cosmosante "github.com/cosmos/cosmos-sdk/x/auth/ante" "github.com/cosmos/cosmos-sdk/x/auth/signing" "github.com/cosmos/cosmos-sdk/x/auth/types" + ibcante "github.com/cosmos/ibc-go/v5/modules/core/ante" + ibckeeper "github.com/cosmos/ibc-go/v5/modules/core/keeper" ) type HandlerOptions struct { @@ -13,6 +15,7 @@ type HandlerOptions struct { BankKeeper types.BankKeeper FeegrantKeeper cosmosante.FeegrantKeeper OracleKeeper OracleKeeper + IBCKeeper *ibckeeper.Keeper SignModeHandler signing.SignModeHandler SigGasConsumer cosmosante.SignatureVerificationGasConsumer } @@ -49,5 +52,6 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) { cosmosante.NewSigGasConsumeDecorator(options.AccountKeeper, options.SigGasConsumer), cosmosante.NewSigVerificationDecorator(options.AccountKeeper, options.SignModeHandler), cosmosante.NewIncrementSequenceDecorator(options.AccountKeeper), + ibcante.NewRedundantRelayDecorator(options.IBCKeeper), ), nil } diff --git a/app/app.go b/app/app.go index b75ba3004a..2aefa5e7b4 100644 --- a/app/app.go +++ b/app/app.go @@ -691,10 +691,11 @@ func (app *UmeeApp) setAnteHandler(txConfig client.TxConfig) { customante.HandlerOptions{ AccountKeeper: app.AccountKeeper, BankKeeper: app.BankKeeper, + OracleKeeper: app.OracleKeeper, + IBCKeeper: app.IBCKeeper, SignModeHandler: txConfig.SignModeHandler(), FeegrantKeeper: app.FeeGrantKeeper, SigGasConsumer: ante.DefaultSigVerificationGasConsumer, - OracleKeeper: app.OracleKeeper, }, ) if err != nil { diff --git a/app/upgrades.go b/app/upgrades.go index 286e8087f8..ce04e32211 100644 --- a/app/upgrades.go +++ b/app/upgrades.go @@ -8,10 +8,9 @@ import ( "github.com/cosmos/cosmos-sdk/x/group" "github.com/cosmos/cosmos-sdk/x/nft" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - - bech32ibckeeper "github.com/osmosis-labs/bech32-ibc/x/bech32ibc/keeper" bech32ibctypes "github.com/osmosis-labs/bech32-ibc/x/bech32ibc/types" - v3upgrades "github.com/umee-network/umee/v3/app/upgrades/v3" + + "github.com/umee-network/umee/v3/app/upgradev3" leveragetypes "github.com/umee-network/umee/v3/x/leverage/types" oracletypes "github.com/umee-network/umee/v3/x/oracle/types" ) @@ -24,33 +23,33 @@ func (app UmeeApp) RegisterUpgradeHandlers() { UpgradeV3_0Plan, func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { ctx.Logger().Info("Upgrade handler execution", "name", UpgradeV3_0Plan) - err := setupBech32ibcKeeper(&app.bech32IbcKeeper, ctx) + ctx.Logger().Info("Running setupBech32ibcKeeper") + err := upgradev3.SetupBech32ibcKeeper(&app.bech32IbcKeeper, ctx) if err != nil { return nil, sdkerrors.Wrapf( - err, "Calypso %q Upgrade: Unable to upgrade, bech32ibc module not initialized", UpgradeV3_0Plan) + err, "%q Upgrade: Unable to upgrade, bech32ibc module not initialized", UpgradeV3_0Plan) } - ctx.Logger().Info("Upgrade handler execution finished, running migrations", "name", UpgradeV3_0Plan) + ctx.Logger().Info("Running module migrations") vm, err := app.mm.RunMigrations(ctx, app.configurator, fromVM) if err != nil { return vm, err } - ctx.Logger().Info("Upgrade handler execution finished, updating minimum commission rate param of staking module", - "name", UpgradeV3_0Plan) - minCommissionRate, err := v3upgrades.UpdateMinimumCommissionRateParam(ctx, app.StakingKeeper) + ctx.Logger().Info("Updating validator minimum commission rate param of staking module") + minCommissionRate, err := upgradev3.UpdateMinimumCommissionRateParam(ctx, app.StakingKeeper) if err != nil { return vm, sdkerrors.Wrapf( - err, "Calypso %q Upgrade: Unable to upgrade, failed to update minimum commission rate param of staking module", + err, "%q Upgrade: failed to update minimum commission rate param of staking module", UpgradeV3_0Plan) } ctx.Logger().Info("Upgrade handler execution finished, updating minimum commission rate of all validators", "name", UpgradeV3_0Plan) - err = v3upgrades.SetMinimumCommissionRateToValidators(ctx, app.StakingKeeper, minCommissionRate) + err = upgradev3.SetMinimumCommissionRateToValidators(ctx, app.StakingKeeper, minCommissionRate) if err != nil { return vm, sdkerrors.Wrapf( - err, "Calypso %q Upgrade: Unable to upgrade, failed to update minimum commission rate for validators", + err, "%q Upgrade: failed to update minimum commission rate for validators", UpgradeV3_0Plan) } @@ -68,6 +67,9 @@ func (app UmeeApp) RegisterUpgradeHandlers() { group.ModuleName, nft.ModuleName, bech32ibctypes.ModuleName, + // icacontrollertypes.StoreKey, + // icahosttypes.StoreKey, + oracletypes.ModuleName, leveragetypes.ModuleName, }, @@ -77,10 +79,3 @@ func (app UmeeApp) RegisterUpgradeHandlers() { upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades)) } } - -// Sets up bech32ibc module by setting the native account prefix to "umee". -// Failing to set the native prefix will cause a chain halt on init genesis or -// in the firstBeginBlocker assertions. -func setupBech32ibcKeeper(bech32IbcKeeper *bech32ibckeeper.Keeper, ctx sdk.Context) error { - return bech32IbcKeeper.SetNativeHrp(ctx, sdk.GetConfig().GetBech32AccountAddrPrefix()) -} diff --git a/app/upgrades/v3/expected_types.go b/app/upgradev3/expected_types.go similarity index 96% rename from app/upgrades/v3/expected_types.go rename to app/upgradev3/expected_types.go index 9526cc6038..ec370efd9c 100644 --- a/app/upgrades/v3/expected_types.go +++ b/app/upgradev3/expected_types.go @@ -1,4 +1,4 @@ -package v3 +package upgradev3 import ( sdk "github.com/cosmos/cosmos-sdk/types" diff --git a/app/upgrades/v3/min_commission.go b/app/upgradev3/migrations.go similarity index 71% rename from app/upgrades/v3/min_commission.go rename to app/upgradev3/migrations.go index 1895751602..a61cd208d9 100644 --- a/app/upgrades/v3/min_commission.go +++ b/app/upgradev3/migrations.go @@ -1,7 +1,8 @@ -package v3 +package upgradev3 import ( sdk "github.com/cosmos/cosmos-sdk/types" + bech32ibckeeper "github.com/osmosis-labs/bech32-ibc/x/bech32ibc/keeper" ) var minCommissionRate = sdk.MustNewDecFromStr("0.05") @@ -37,3 +38,10 @@ func SetMinimumCommissionRateToValidators(ctx sdk.Context, keeper StakingKeeper, return nil } + +// SetupBech32ibcKeeper updates keeper by setting the native account prefix to "umee". +// Failing to set the native prefix will cause a chain halt on init genesis or +// in the firstBeginBlocker assertions. +func SetupBech32ibcKeeper(bech32IbcKeeper *bech32ibckeeper.Keeper, ctx sdk.Context) error { + return bech32IbcKeeper.SetNativeHrp(ctx, sdk.GetConfig().GetBech32AccountAddrPrefix()) +} diff --git a/app/upgrades/v3/min_commission_test.go b/app/upgradev3/min_commission_test.go similarity index 98% rename from app/upgrades/v3/min_commission_test.go rename to app/upgradev3/min_commission_test.go index e4413c7ed6..9ce5c02f12 100644 --- a/app/upgrades/v3/min_commission_test.go +++ b/app/upgradev3/min_commission_test.go @@ -1,4 +1,4 @@ -package v3 +package upgradev3 import ( "testing" diff --git a/app/upgrades/v3/staking_util_test.go b/app/upgradev3/staking_util_test.go similarity index 99% rename from app/upgrades/v3/staking_util_test.go rename to app/upgradev3/staking_util_test.go index ce576fc710..36bb55fa88 100644 --- a/app/upgrades/v3/staking_util_test.go +++ b/app/upgradev3/staking_util_test.go @@ -1,4 +1,4 @@ -package v3 +package upgradev3 import ( "crypto/rand" From ae43ccbd25c382cdfc5bcde26f21bc2002be5bf3 Mon Sep 17 00:00:00 2001 From: Robert Zaremba Date: Wed, 21 Sep 2022 22:50:30 +0100 Subject: [PATCH 11/20] docs: update release notes (#1427) * doc: update release notes * add app config.yaml update instructions * review * update the changelog * add more details about the mempool * Update RELEASE_NOTES.md Co-authored-by: toteki <63419657+toteki@users.noreply.github.com> * Version comments Co-authored-by: Adam Wozniak <29418299+adamewozniak@users.noreply.github.com> Co-authored-by: toteki <63419657+toteki@users.noreply.github.com> --- CHANGELOG.md | 2 ++ RELEASE_NOTES.md | 17 ++++++++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dc2da72664..0ea1924c5e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,6 +46,8 @@ Ref: https://keepachangelog.com/en/1.0.0/ ## [Unreleased] +## [v3.0.0](https://github.com/umee-network/umee/releases/tag/v3.0.0) - 2022-09-22 + ### State Machine Breaking - [1326](https://github.com/umee-network/umee/pull/1326) Setting protocol controlled min gas price. diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 613c7683f0..0240ae9a18 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -23,7 +23,6 @@ v3.0.0 improves upon the _umeemania_ testnet release (v2.0.x) which introduced o - transaction prioritization - IBC v5.0 - #### x/leverage settings The leverage module is by default compiled without support for the `liquidation_targets` query. @@ -35,16 +34,24 @@ To run a node capable of supporting a liquidator, enable the query at compile ti ### Gravity Bridge In `v1.1.x` (current mainnet) we disabled Gravity Bridge (GB) module due to Ethereum PoS migration (_the merge_). -This release is the first step to re-enable GB. We start by enabling validators update end evidence messages (`MsgValsetConfirm` and `MsgValsetUpdatedClaim`), but the bridge messages: batch creation, claims (both ways: Ethereum->Cosmos and Cosmos->Ethereum) remain disabled. +This release is the first step to re-enable GB. We start by enabling validators update and evidence messages (`MsgValsetConfirm` and `MsgValsetUpdatedClaim`), but the bridge messages: batch creation, claims (both ways: Ethereum->Cosmos and Cosmos->Ethereum) remain disabled. + +Validators are expected to run Peggo and update the valiator set in Gravity smart contract. See [Gravity Bridge](https://github.com/umee-network/Gravity-Bridge/blob/module/v1.5.3-umee-1/module/RELEASE_NOTES.md) Release Notes. ### Update notes -Each validator must run: +Each validator MUST: + +- Run Peggo (Gravity Bridge Orchestrator) v1.0.x +- Run [Price Feeder](https://github.com/umee-network/umee/tree/main/price-feeder) v1.0.x +- Update `config.toml` file by setting `mempool.version="v1"`. Ideally you should do it before the upgrade time, then at the upgrade switch binaries and start with the upgraded config: -- Peggo (Gravity Bridge Orchestrator). -- [Price Feeder](https://github.com/umee-network/umee/tree/main/price-feeder). + ```toml + [mempool] + version = "v1" + ``` Instructions: [umeeversity/validator](https://umeeversity.umee.cc/validators/mainnet-validator.html) From 8b54dd0400c4bc303d038d21d226ca220407a418 Mon Sep 17 00:00:00 2001 From: Sai Kumar <17549398+gsk967@users.noreply.github.com> Date: Sat, 24 Sep 2022 14:18:47 +0530 Subject: [PATCH 12/20] fix: fix the github workflow for upgrade (#1444) ## Description closes: #XXXX --- ### Author Checklist _All items are required. Please add a note to the item if the item is not applicable and please add links to any relevant follow up issues._ I have... - [ ] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] added `!` to the type prefix if API or client breaking change - [ ] added appropriate labels to the PR - [ ] targeted the correct branch (see [PR Targeting](https://github.com/umee-network/umee/blob/main/CONTRIBUTING.md#pr-targeting)) - [ ] provided a link to the relevant issue or specification - [ ] added a changelog entry to `CHANGELOG.md` - [ ] included comments for [documenting Go code](https://blog.golang.org/godoc) - [ ] updated the relevant documentation or specification - [ ] reviewed "Files changed" and left comments if necessary - [ ] confirmed all CI checks have passed ### Reviewers Checklist _All items are required. Please add a note if the item is not applicable and please add your handle next to the items reviewed if you only reviewed selected items._ I have... - [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] confirmed all author checklist items have been addressed - [ ] reviewed state machine logic - [ ] reviewed API design and naming - [ ] reviewed documentation is accurate - [ ] reviewed tests and test coverage - [ ] manually tested (if applicable) --- contrib/scripts/download-mainnet-umeed.sh | 61 ++++++++++++++++----- contrib/scripts/umeemainnet_fork.sh | 31 ++++++++--- contrib/scripts/upgrade-test-single-node.sh | 11 ++-- 3 files changed, 77 insertions(+), 26 deletions(-) diff --git a/contrib/scripts/download-mainnet-umeed.sh b/contrib/scripts/download-mainnet-umeed.sh index 8b1b699e45..773c962421 100755 --- a/contrib/scripts/download-mainnet-umeed.sh +++ b/contrib/scripts/download-mainnet-umeed.sh @@ -4,23 +4,58 @@ # USAGE: ./download-mainnet-umeed.sh +is_macos() { + [[ "$OSTYPE" == "darwin"* ]] +} + +architecture=$(uname -m) + CWD="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" -UMEED_BIN_MAINNET_URL_TARBALL=${UMEED_BIN_MAINNET_URL_TARBALL:-"https://github.com/umee-network/umee/releases/download/v1.1.2/umeed-v1.1.2-linux-amd64.tar.gz"} -UMEED_BIN_MAINNET=${UMEED_BIN_MAINNET:-"$CWD/umeed-releases/umeed-v1.1.2-linux-amd64/umeed"} +MAINNET_VERSION=${MAINNET_VERSION:-"v1.1.2"} + +download_mainnet_binary(){ + # Checks for the umeed v1 file + if [ ! -f "$UMEED_BIN_MAINNET" ]; then + echo "$UMEED_BIN_MAINNET doesn't exist" + + if [ -z $UMEED_BIN_MAINNET_URL_TARBALL ]; then + echo You need to set the UMEED_BIN_MAINNET_URL_TARBALL variable + exit 1 + fi -# Checks for the umeed v1 file -if [ ! -f "$UMEED_BIN_MAINNET" ]; then - echo "$UMEED_BIN_MAINNET doesn't exist" + UMEED_RELEASES_PATH=$CWD/umeed-releases + mkdir -p $UMEED_RELEASES_PATH + wget -c $UMEED_BIN_MAINNET_URL_TARBALL -O - | tar -xz -C $UMEED_RELEASES_PATH - if [ -z $UMEED_BIN_MAINNET_URL_TARBALL ]; then - echo You need to set the UMEED_BIN_MAINNET_URL_TARBALL variable - exit 1 + UMEED_BIN_MAINNET_BASENAME=$(basename $UMEED_BIN_MAINNET_URL_TARBALL .tar.gz) + UMEED_BIN_MAINNET=$UMEED_RELEASES_PATH/$UMEED_BIN_MAINNET_BASENAME/umeed fi +} - UMEED_RELEASES_PATH=$CWD/umeed-releases - mkdir -p $UMEED_RELEASES_PATH - wget -c $UMEED_BIN_MAINNET_URL_TARBALL -O - | tar -xz -C $UMEED_RELEASES_PATH +mac_mainnet() { + if [[ "$architecture" == "arm64" ]];then + UMEED_BIN_MAINNET_URL_TARBALL=${UMEED_BIN_MAINNET_URL_TARBALL:-"https://github.com/umee-network/umee/releases/download/${MAINNET_VERSION}/umeed-${MAINNET_VERSION}-darwin-arm64.tar.gz"} + UMEED_BIN_MAINNET=${UMEED_BIN_MAINNET:-"$CWD/umeed-releases/umeed-${MAINNET_VERSION}-darwin-arm64/umeed"} + else + UMEED_BIN_MAINNET_URL_TARBALL=${UMEED_BIN_MAINNET_URL_TARBALL:-"https://github.com/umee-network/umee/releases/download/${MAINNET_VERSION}/umeed-${MAINNET_VERSION}-darwin-amd64.tar.gz"} + UMEED_BIN_MAINNET=${UMEED_BIN_MAINNET:-"$CWD/umeed-releases/umeed-${MAINNET_VERSION}-darwin-amd64/umeed"} + fi +} + +linux_mainnet(){ + if [[ "$architecture" == "arm64" ]];then + UMEED_BIN_MAINNET_URL_TARBALL=${UMEED_BIN_MAINNET_URL_TARBALL:-"https://github.com/umee-network/umee/releases/download/${MAINNET_VERSION}/umeed-${MAINNET_VERSION}-linux-arm64.tar.gz"} + UMEED_BIN_MAINNET=${UMEED_BIN_MAINNET:-"$CWD/umeed-releases/umeed-${MAINNET_VERSION}-linux-arm64/umeed"} + else + UMEED_BIN_MAINNET_URL_TARBALL=${UMEED_BIN_MAINNET_URL_TARBALL:-"https://github.com/umee-network/umee/releases/download/${MAINNET_VERSION}/umeed-${MAINNET_VERSION}-linux-amd64.tar.gz"} + UMEED_BIN_MAINNET=${UMEED_BIN_MAINNET:-"$CWD/umeed-releases/umeed-${MAINNET_VERSION}-linux-amd64/umeed"} + fi +} - UMEED_BIN_MAINNET_BASENAME=$(basename $UMEED_BIN_MAINNET_URL_TARBALL .tar.gz) - UMEED_BIN_MAINNET=$UMEED_RELEASES_PATH/$UMEED_BIN_MAINNET_BASENAME/umeed +if is_macos ; then + mac_mainnet + download_mainnet_binary +else + linux_mainnet + download_mainnet_binary fi diff --git a/contrib/scripts/umeemainnet_fork.sh b/contrib/scripts/umeemainnet_fork.sh index 0d8a2ba1f0..a5c31ce9e7 100755 --- a/contrib/scripts/umeemainnet_fork.sh +++ b/contrib/scripts/umeemainnet_fork.sh @@ -14,17 +14,23 @@ CHAIN_ID="${CHAIN_ID:-umeemain-local-testnet}" FORK_DIR="${FORK_DIR:-$CWD}" CHAIN_DIR="${CHAIN_DIR:-$FORK_DIR/node-data}" LOG_LEVEL="${LOG_LEVEL:-debug}" -BLOCK_TIME="${BLOCK_TIME:-6}" +BLOCK_TIME="${BLOCK_TIME:-1}" UPGRADE_TITLE="${UPGRADE_TITLE:-"v1.1-v3.0"}" -UMEED_BIN_CURRENT="${UMEED_BIN_CURRENT:-$FORK_DIR/../../build/umeed}" -UMEED_BIN_MAINNET="${UMEED_BIN_MAINNET:-$FORK_DIR/umeed-releases/umeed-v1.1.2-linux-amd64/umeed}" UMEEMAINNET_GENESIS_PATH="${UMEEMAINNET_GENESIS_PATH:-$CWD/mainnet_tinkered_genesis.json}" NODE_PRIV_KEY="${NODE_PRIV_KEY:-$FORK_DIR/priv_validator_key.json}" SEC_AWAIT_NODE_START="${SEC_AWAIT_NODE_START:-80}" +MAINNET_VERSION="${MAINNET_VERSION:-"v1.1.2"}" + +UMEED_BIN_CURRENT="${UMEED_BIN_CURRENT:-$FORK_DIR/../../build/umeed}" +# UMEED_BIN_MAINNET="${UMEED_BIN_MAINNET:-$FORK_DIR/umeed-releases/umeed-v1.1.2-linux-amd64/umeed}" -# Loads another sources +# Loads another sources , +# It will download the mainnet binaries . $CWD/download-mainnet-umeed.sh + +# It will download the mainnet genesis UMEEMAINNET_GENESIS_PATH=$UMEEMAINNET_GENESIS_PATH . $CWD/tinker-mainnet-genesis.sh + . $CWD/blocks.sh nodeHome="$CHAIN_DIR/$CHAIN_ID" @@ -90,13 +96,19 @@ rm $nodeDir/$genesisConfigPath cp $UMEEMAINNET_GENESIS_PATH $nodeDir/$genesisConfigPath +## Updating the gov proposal voting perioid to 20seconds +jq '.app_state.gov.voting_params.voting_period = "20s"' $nodeDir/$genesisConfigPath > $nodeDir/new-genesis.json +## Copy the new updated genesis +cp $nodeDir/new-genesis.json $nodeDir/$genesisConfigPath + + perl -i -pe 's|fast_sync = true|fast_sync = false|g' $nodeCfg perl -i -pe 's|addr_book_strict = true|addr_book_strict = false|g' $nodeCfg perl -i -pe 's|external_address = ""|external_address = "tcp://127.0.0.1:26657"|g' $nodeCfg perl -i -pe 's|"tcp://127.0.0.1:26657"|"tcp://0.0.0.0:26657"|g' $nodeCfg perl -i -pe 's|allow_duplicate_ip = false|allow_duplicate_ip = true|g' $nodeCfg perl -i -pe 's|log_level = "info"|log_level = "'$LOG_LEVEL'"|g' $nodeCfg -perl -i -pe 's|timeout_commit = ".*?"|timeout_commit = "5s"|g' $nodeCfg +perl -i -pe 's|timeout_commit = ".*?"|timeout_commit = "1s"|g' $nodeCfg perl -i -pe 's|minimum-gas-prices = ""|minimum-gas-prices = "0.05uumee"|g' $nodeApp nodeLogPath=$hdir.umeed-main.log @@ -126,17 +138,18 @@ CURRENT_BLOCK_HEIGHT=$(CHAIN_ID=$CHAIN_ID UMEED_BIN=$UMEED_BIN_CURRENT get_block echo "Current Block: $CURRENT_BLOCK_HEIGHT >= $WAIT_UNTIL_HEIGHT" # we should produce at least 20 blocks with the new version -((WAIT_UNTIL_HEIGHT=CURRENT_BLOCK_HEIGHT+20)) +((WAIT_UNTIL_HEIGHT=CURRENT_BLOCK_HEIGHT+40)) UMEED_V1_PID_FILE=$pid_path CHAIN_DIR=$CHAIN_DIR CHAIN_ID=$CHAIN_ID LOG_LEVEL=$LOG_LEVEL NODE_NAME=node UPGRADE_TITLE=$UPGRADE_TITLE UMEED_BIN_V1=$UMEED_BIN_MAINNET UMEED_BIN_V2=$UMEED_BIN_CURRENT $CWD/upgrade-test-single-node.sh -echo "UPGRADE FINISH, going to wait to produce 20 blocks from: $CURRENT_BLOCK_HEIGHT to $WAIT_UNTIL_HEIGHT" -sleep $SEC_AWAIT_NODE_START +echo "UPGRADE FINISH, going to wait to produce blocks from upgrade height to $WAIT_UNTIL_HEIGHT" +echo "Sleep for 50s, wait for upgrade binary to produce blocks for sometime" +sleep 50 CHAIN_ID=$CHAIN_ID UMEED_BIN=$UMEED_BIN_CURRENT wait_until_block $WAIT_UNTIL_HEIGHT echo -echo Upgrade Process Finish +echo "👍 Upgrade Process Finish to $UMEED_BIN_CURRENT" echo pid_value=$(cat $pid_path) diff --git a/contrib/scripts/upgrade-test-single-node.sh b/contrib/scripts/upgrade-test-single-node.sh index a6c0a988ee..4b9b55760b 100755 --- a/contrib/scripts/upgrade-test-single-node.sh +++ b/contrib/scripts/upgrade-test-single-node.sh @@ -48,17 +48,20 @@ cid="--chain-id $CHAIN_ID" CURRENT_HEIGHT=$(CHAIN_ID=$CHAIN_ID UMEED_BIN=$UMEED_BIN_V1 get_block_current_height) echo blockchain CURRENT_HEIGHT is $CURRENT_HEIGHT -UPGRADE_HEIGHT=$(($CURRENT_HEIGHT + 10)) +UPGRADE_HEIGHT=$(($CURRENT_HEIGHT + 30)) echo blockchain UPGRADE_HEIGHT is $UPGRADE_HEIGHT +echo "Submitting the software-upgrade proposal..." $UMEED_BIN_V1 tx gov submit-proposal software-upgrade $UPGRADE_TITLE --deposit 1000000000uumee \ - --upgrade-height $UPGRADE_HEIGHT --upgrade-info '{"binaries":{"linux/amd64":"https://github.com/cosmos/gaia/releases/download/v6.0.0-rc1/gaiad-v6.0.0-rc1-linux-amd64","linux/arm64":"https://github.com/cosmos/gaia/releases/download/v6.0.0-rc1/gaiad-v6.0.0-rc1-linux-arm64","darwin/amd64":"https://github.com/cosmos/gaia/releases/download/v6.0.0-rc1/gaiad-v6.0.0-rc1-darwin-amd64"}}' \ - -b block $nodeHomeFlag --from admin $nodeUrlFlag $kbt --title yeet --description megayeet $cid --yes --fees 10000uumee + --upgrade-height $UPGRADE_HEIGHT \ + -b block $nodeHomeFlag --from admin $nodeUrlFlag $kbt --title yeet --description megayeet $cid --yes --fees 100000uumee +## PROPOSAL_ID=$($UMEED_BIN_V1 q gov $nodeUrlFlag proposals -o json | jq ".proposals[-1].proposal_id" -r) echo proposal ID is $PROPOSAL_ID -$UMEED_BIN_V1 tx gov vote -b async --from admin $nodeUrlFlag $kbt $PROPOSAL_ID yes $nodeHomeFlag $cid --yes --fees 10000uumee +echo "Voting on proposaal : $PROPOSAL_ID" +$UMEED_BIN_V1 tx gov vote $PROPOSAL_ID yes -b block --from admin $nodeHomeFlag $cid $nodeUrlFlag $kbt --yes --fees 100000uumee echo "..." echo "Finished voting on the proposal" From 60b7c2dc89c5b6838a24f02613bb9df8d4a8943d Mon Sep 17 00:00:00 2001 From: Robert Zaremba Date: Wed, 28 Sep 2022 04:57:55 +0100 Subject: [PATCH 13/20] fix: token registry cache (#1450) * fix: token registry cache * changelog --- CHANGELOG.md | 6 ++++++ x/leverage/keeper/gas.go | 6 ------ x/leverage/keeper/keeper.go | 20 +++++--------------- x/leverage/keeper/token.go | 6 ------ 4 files changed, 11 insertions(+), 27 deletions(-) delete mode 100644 x/leverage/keeper/gas.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ea1924c5e..9e7d89f4de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,6 +46,12 @@ Ref: https://keepachangelog.com/en/1.0.0/ ## [Unreleased] +## [v3.0.1](https://github.com/umee-network/umee/releases/tag/v3.0.1) - 2022-09-28 + +### Fixes + +- [1450](https://github.com/umee-network/umee/pull/1450) fix: token registry cache which caused v3.0.0 halt. + ## [v3.0.0](https://github.com/umee-network/umee/releases/tag/v3.0.0) - 2022-09-22 ### State Machine Breaking diff --git a/x/leverage/keeper/gas.go b/x/leverage/keeper/gas.go deleted file mode 100644 index 6898bb8bab..0000000000 --- a/x/leverage/keeper/gas.go +++ /dev/null @@ -1,6 +0,0 @@ -package keeper - -const ( - gasCacheAccess = 20 - gasCacheUpdate = 40 -) diff --git a/x/leverage/keeper/keeper.go b/x/leverage/keeper/keeper.go index d46258c3c4..d496b3c153 100644 --- a/x/leverage/keeper/keeper.go +++ b/x/leverage/keeper/keeper.go @@ -9,7 +9,6 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - "github.com/hashicorp/golang-lru/simplelru" "github.com/tendermint/tendermint/libs/log" "github.com/umee-network/umee/v3/x/leverage/types" @@ -22,8 +21,6 @@ type Keeper struct { hooks types.Hooks bankKeeper types.BankKeeper oracleKeeper types.OracleKeeper - - tokenRegCache simplelru.LRUCache } func NewKeeper( @@ -38,19 +35,12 @@ func NewKeeper( paramSpace = paramSpace.WithKeyTable(types.ParamKeyTable()) } - const tokenRegCacheSize = 100 - tokenRegCache, err := simplelru.NewLRU(tokenRegCacheSize, nil) - if err != nil { - return Keeper{}, err - } - return Keeper{ - cdc: cdc, - storeKey: storeKey, - paramSpace: paramSpace, - bankKeeper: bk, - oracleKeeper: ok, - tokenRegCache: tokenRegCache, + cdc: cdc, + storeKey: storeKey, + paramSpace: paramSpace, + bankKeeper: bk, + oracleKeeper: ok, }, nil } diff --git a/x/leverage/keeper/token.go b/x/leverage/keeper/token.go index fb7fe25eea..6b54235a71 100644 --- a/x/leverage/keeper/token.go +++ b/x/leverage/keeper/token.go @@ -23,17 +23,11 @@ func (k Keeper) SetTokenSettings(ctx sdk.Context, token types.Token) error { k.hooks.AfterTokenRegistered(ctx, token) store.Set(tokenKey, bz) - k.tokenRegCache.Add(token.BaseDenom, token) - ctx.GasMeter().ConsumeGas(gasCacheUpdate, "cache update") return nil } // GetTokenSettings gets a token from the x/leverage module's KVStore. func (k Keeper) GetTokenSettings(ctx sdk.Context, denom string) (types.Token, error) { - ctx.GasMeter().ConsumeGas(gasCacheAccess, "cache access") - if v, ok := k.tokenRegCache.Get(denom); ok { - return v.(types.Token), nil - } store := ctx.KVStore(k.storeKey) tokenKey := types.CreateRegisteredTokenKey(denom) From e21af739f707267393fd5d33ddd9be1609f0b0f1 Mon Sep 17 00:00:00 2001 From: Robert Zaremba Date: Wed, 28 Sep 2022 05:08:10 +0100 Subject: [PATCH 14/20] docs: v3.0.1 release notes (#1453) --- ### Author Checklist _All items are required. Please add a note to the item if the item is not applicable and please add links to any relevant follow up issues._ I have... - [ ] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] added `!` to the type prefix if API or client breaking change - [ ] added appropriate labels to the PR - [ ] targeted the correct branch (see [PR Targeting](https://github.com/umee-network/umee/blob/main/CONTRIBUTING.md#pr-targeting)) - [ ] provided a link to the relevant issue or specification - [ ] added a changelog entry to `CHANGELOG.md` - [ ] included comments for [documenting Go code](https://blog.golang.org/godoc) - [ ] updated the relevant documentation or specification - [ ] reviewed "Files changed" and left comments if necessary - [ ] confirmed all CI checks have passed ### Reviewers Checklist _All items are required. Please add a note if the item is not applicable and please add your handle next to the items reviewed if you only reviewed selected items._ I have... - [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] confirmed all author checklist items have been addressed - [ ] reviewed state machine logic - [ ] reviewed API design and naming - [ ] reviewed documentation is accurate - [ ] reviewed tests and test coverage - [ ] manually tested (if applicable) --- RELEASE_NOTES.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 0240ae9a18..66d3e43d71 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,8 +1,20 @@ + # Release Notes +Release Procedure is defined in the [CONTRIBUTING](CONTRIBUTING.md#release-procedure) document. + +## v3.0.1 + +Fix v3.0.0 `Block.Header.LastResultsHash` problem. +During inspections we found that `tx.GasUsage` didn't match across some nodes, causing chain halt: + +``` +ERR prevote step: ProposalBlock is invalid err="wrong Block.Header.LastResultsHash. Expected EDEE3056AA71C73EC8B7089AAA5414D1298EF78ADC4D510498DB834E499E42C2, got 5ADF2EA7E0B31BA21E802071E1A9E4C4803259FE3AFFF17AAA53F93DA1D6264F" height=3216273 module=consensus round=68 +``` + ## v3.0.0 v3.0.0 improves upon the _umeemania_ testnet release (v2.0.x) which introduced our **lending** and **oracle** functionality. @@ -22,6 +34,7 @@ v3.0.0 improves upon the _umeemania_ testnet release (v2.0.x) which introduced o - [SIGN_MODE_DIRECT_AUX](https://github.com/cosmos/cosmos-sdk/blob/v0.46.0/RELEASE_NOTES.md#transaction-tips-and-sign_mode_direct_aux) - transaction prioritization - IBC v5.0 +- Minimum validator commission rate is set to 5% per [prop 16](https://www.mintscan.io/umee/proposals/16). Validators with smaller commission rate will be automatically updated. #### x/leverage settings @@ -46,6 +59,15 @@ Each validator MUST: - Run Peggo (Gravity Bridge Orchestrator) v1.0.x - Run [Price Feeder](https://github.com/umee-network/umee/tree/main/price-feeder) v1.0.x +- Update `app.toml` file by setting `minimum-gas-prices = "0uumee"`: + + ```toml + # The minimum gas prices a validator is willing to accept for processing a + # transaction. A transaction's fees must meet the minimum of any denomination + # specified in this config (e.g. 0.25token1;0.0001token2). + minimum-gas-prices = "0uumee" + ``` + - Update `config.toml` file by setting `mempool.version="v1"`. Ideally you should do it before the upgrade time, then at the upgrade switch binaries and start with the upgraded config: ```toml From 81ba33395c6b232ae8ea954abbe70cdcc65ace8c Mon Sep 17 00:00:00 2001 From: Robert Zaremba Date: Thu, 29 Sep 2022 20:52:16 +0100 Subject: [PATCH 15/20] fix: update & fix gravity bridge (#1460) * update & fix gravity bridge * release notes * changelog --- CHANGELOG.md | 6 ++++++ RELEASE_NOTES.md | 12 ++++++++++++ go.mod | 4 ++-- go.sum | 4 ++-- 4 files changed, 22 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e7d89f4de..4ccf381549 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,6 +46,12 @@ Ref: https://keepachangelog.com/en/1.0.0/ ## [Unreleased] +## [v3.0.2](https://github.com/umee-network/umee/releases/tag/v3.0.2) - 2022-09-29 + +### Fixes + +- [1460](https://github.com/umee-network/umee/pull/1460) Bump Gravity Bridge. + ## [v3.0.1](https://github.com/umee-network/umee/releases/tag/v3.0.1) - 2022-09-28 ### Fixes diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 66d3e43d71..801cb2bcf5 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -6,6 +6,18 @@ Release Procedure is defined in the [CONTRIBUTING](CONTRIBUTING.md#release-procedure) document. +## v3.0.2 + +Gravity Bridge update. In v3.0.0 we enabled Gravity Bridge, but there was an error in the way how the +`ValsetUpdate` attestation is handled, causing the chain to halt in EndBlocker. +The bug didn't involved any security issue and the bridge is safe. + +Update instructions: + +- stop the chain +- swap the binary +- restart (no additional coordination is required) + ## v3.0.1 Fix v3.0.0 `Block.Header.LastResultsHash` problem. diff --git a/go.mod b/go.mod index 0901281060..e255c99096 100644 --- a/go.mod +++ b/go.mod @@ -16,7 +16,6 @@ require ( github.com/golangci/golangci-lint v1.49.0 github.com/gorilla/mux v1.8.0 github.com/grpc-ecosystem/grpc-gateway v1.16.0 - github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d github.com/ignite/cli v0.24.0 github.com/ory/dockertest/v3 v3.9.1 github.com/osmosis-labs/bech32-ibc v0.3.0-rc2 @@ -167,6 +166,7 @@ require ( github.com/hashicorp/go-multierror v1.1.1 // indirect github.com/hashicorp/go-safetemp v1.0.0 // indirect github.com/hashicorp/go-version v1.6.0 // indirect + github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/hdevalence/ed25519consensus v0.0.0-20220222234857-c00d1f31bab3 // indirect github.com/hexops/gotextdiff v1.0.3 // indirect @@ -317,7 +317,7 @@ require ( ) replace ( - github.com/Gravity-Bridge/Gravity-Bridge/module => github.com/umee-network/Gravity-Bridge/module v1.5.3-umee-1.0.20220920174852-ca3dc9795c13 + github.com/Gravity-Bridge/Gravity-Bridge/module => github.com/umee-network/Gravity-Bridge/module v1.5.3-umee-2 github.com/cosmos/cosmos-sdk => github.com/umee-network/cosmos-sdk v0.46.1-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 diff --git a/go.sum b/go.sum index 98063c4519..8e49ce7636 100644 --- a/go.sum +++ b/go.sum @@ -1293,8 +1293,8 @@ github.com/ultraware/funlen v0.0.3 h1:5ylVWm8wsNwH5aWo9438pwvsK0QiqVuUrt9bn7S/iL github.com/ultraware/funlen v0.0.3/go.mod h1:Dp4UiAus7Wdb9KUZsYWZEWiRzGuM2kXM1lPbfaF6xhA= github.com/ultraware/whitespace v0.0.5 h1:hh+/cpIcopyMYbZNVov9iSxvJU3OYQg78Sfaqzi/CzI= github.com/ultraware/whitespace v0.0.5/go.mod h1:aVMh/gQve5Maj9hQ/hg+F75lr/X5A89uZnzAmWSineA= -github.com/umee-network/Gravity-Bridge/module v1.5.3-umee-1.0.20220920174852-ca3dc9795c13 h1:pW4doyPRJOD64oxAT96enYa+ADAsFpLGlsoAlpITOC0= -github.com/umee-network/Gravity-Bridge/module v1.5.3-umee-1.0.20220920174852-ca3dc9795c13/go.mod h1:UN4ehDuy5PA1YY7juvBMMulyiKv7uBMLUbTV/vONzH0= +github.com/umee-network/Gravity-Bridge/module v1.5.3-umee-2 h1:qb/enEHRxoPi26mZ4B5FDhaI8r7MAgaITJs35wdDXmY= +github.com/umee-network/Gravity-Bridge/module v1.5.3-umee-2/go.mod h1:UN4ehDuy5PA1YY7juvBMMulyiKv7uBMLUbTV/vONzH0= github.com/umee-network/bech32-ibc v0.3.0-rc1.0.20220831212913-42baad053f6e h1:RCxnO359ieolUDIT1cF7Ic3ms4epgmZxzNiz1a2IBeU= github.com/umee-network/bech32-ibc v0.3.0-rc1.0.20220831212913-42baad053f6e/go.mod h1:Prssr3u1p2ICcgkhtMaX55NZv7A7E2ernO6fKrpolSg= github.com/umee-network/cosmos-sdk v0.46.1-umee h1:htt48oCN/i0An5z8AS8ttXU3Dk7fiE/gWNvwQGGOJgs= From d84136f29975483f113a2dff75d46e16d613cfad Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 30 Sep 2022 16:26:11 +0000 Subject: [PATCH 16/20] build(deps): Bump github.com/cosmos/ibc-go/v5 from 5.0.0-rc2 to 5.0.0 (#1458) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [github.com/cosmos/ibc-go/v5](https://github.com/cosmos/ibc-go) from 5.0.0-rc2 to 5.0.0.
Release notes

Sourced from github.com/cosmos/ibc-go/v5's releases.

v5.0.0

This release bumps the Cosmos SDK to v0.46.1 (for more information, see Cosmos SDK v0.46 Release Notes) and Tendermint to v0.34.21 (for more information, see Tendermint 0.34.21 changelog). It also introduces several code style improvements flagged by linting tools. We present here a summary of the most relevant changes, but please see the v5.0.0 changelog for the full set of changes included in this release.

core/02-client

apps/27-interchain-accounts

  • Support for Cosmos-SDK simulation has been added.
  • The InterchainAccount gRPC query endpoint and CLI query have been added to the controller submodule to allow end users the ability to inspect the interchain account address generated on the host chain. has been added the controller submodule to allow users to retrieve the registered interchain account addresses on the host chain.
  • A MessageRouter interface has been added. It has replaced the *baseapp.MsgServiceRouter used in the controller and host keepers.

testing

Special thanks to our external contributors on this release: @​faddat @​Taztingo @​jhernandezb


To learn more about ibc-go versioning, please read our RELEASES.md.

IMPORTANT: Please read the migration guides for any versions of ibc-go that you might be going through when upgrading to this version. For example: if you upgrade from the IBC module contained in the Cosmos SDK 0.42.0 to SDK v0.46.1 and ibc-go v5.0.0, please follow:

  1. The migration from SDK 0.41.x or 0.42.x to the IBC module in the ibc-go repository based on the SDK v0.44.x.
  2. The migration from ibc-go v1 to v2.
  3. The migration from ibc-go v2 to v3.
  4. The migration from ibc-go v3 to v4.
  5. The migration from ibc-go v4 to v5.
Changelog

Sourced from github.com/cosmos/ibc-go/v5's changelog.

v5.0.0 - 2022-09-28

Dependencies

  • #1653 Bump SDK version to v0.46
  • #2124 Bump SDK version to v0.46.1

API Breaking

  • (testing)#2028 New interface ibctestingtypes.StakingKeeper added and set for the testing app StakingKeeper setup.
  • (core/04-channel) #1418 NewPacketId has been renamed to NewPacketID to comply with go linting rules.
  • (core/ante) #1418 AnteDecorator has been renamed to RedundancyDecorator to comply with go linting rules and to give more clarity to the purpose of the Decorator.
  • (core/ante) #1820 RedundancyDecorator has been renamed to RedundantRelayDecorator to make the name for explicit.
  • (testing) #1418 MockIBCApp has been renamed to IBCApp and MockEmptyAcknowledgement has been renamed to EmptyAcknowledgement to comply with go linting rules
  • (apps/27-interchain-accounts) #2058 Added MessageRouter interface and replaced *baseapp.MsgServiceRouter with it. The controller and host keepers of apps/27-interchain-accounts have been updated to use it.
  • (apps/27-interchain-accounts)#2302 Handle unwrapping of channel version in interchain accounts channel reopening handshake flow. The host submodule Keeper now requires an ICS4Wrapper similarly to the controller submodule.

Improvements

  • (27-interchain-accounts) #1352 Add support for Cosmos-SDK simulation to ics27 module.
  • (linting) #1418 Fix linting errors, resulting compatiblity with go1.18 linting style, golangci-lint 1.46.2 and the revivie linter. This caused breaking changes in core/04-channel, core/ante, and the testing library.

Features

  • (apps/27-interchain-accounts) #2193 Adding InterchainAccount gRPC query endpont to ICS27 controller submodule to allow users to retrieve registered interchain account addresses.

Bug Fixes

  • (27-interchain-accounts) #2308 Nil checks have been added to ensure services are not registered for nil host or controller keepers.
  • (makefile) #1785 Fetch the correct versions of protocol buffers dependencies from tendermint, cosmos-sdk, and ics23.
  • (modules/core/04-channel)#1919 Fixed formatting of sequence for packet "acknowledgement written" logs.

v3.1.0 - 2022-04-16

Dependencies

  • #1300 Bump SDK version to v0.45.4

API Breaking

State Machine Breaking

Improvements

  • (transfer) #1342 DenomTrace grpc now takes in either an ibc denom or a hash instead of only accepting a hash.
  • (modules/core/04-channel) #1160 Improve uint64 -> string performance in Logger.
  • (modules/core/04-channel) #1279 Add selected channel version to MsgChanOpenInitResponse and MsgChanOpenTryResponse. Emit channel version during OpenInit/OpenTry
  • (modules/core/keeper) #1284 Add sanity check for the keepers passed into ibckeeper.NewKeeper. ibckeeper.NewKeeper now panics if any of the keepers passed in is empty.
  • (transfer) #1414 Emitting Sender address from fungible_token_packet events in OnRecvPacket and OnAcknowledgementPacket.
  • (modules/core/04-channel) #1464 Emit a channel close event when an ordered channel is closed.

... (truncated)

Commits
  • ed56c0b update changelog for v5.0.0 release
  • 7e5c0e2 revert #2361 (#2410)
  • 1b538f7 docs: add ics29 integration for sdk module (#2394) (#2408)
  • 833f578 Update v4-to-v5.md
  • 1313dc9 Update CLI to recover expired client for SDK 46 updates to gov module (backpo...
  • e0e157d docs: updating v3->v4 migration docs with fee middleware (#2127) (#2390)
  • 64269cc docs: migration docs v4 to v5 (#1826) (#2385)
  • 259522d docs: include ics4Wrapper in hostkeeper.NewKeeper ics27 integration docs (...
  • b6921cd fix: ica handshake reopening channel - use GetAppVersion in favour of `chan...
  • e4ff2c6 Add scoped keeper interface for interchain app (backport #2035) (#2361)
  • Additional commits viewable in compare view

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=github.com/cosmos/ibc-go/v5&package-manager=go_modules&previous-version=5.0.0-rc2&new-version=5.0.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
--- go.mod | 2 +- go.sum | 4 ++-- price-feeder/go.mod | 2 +- price-feeder/go.sum | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index e255c99096..38c0e7e47a 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,7 @@ require ( github.com/cosmos/cosmos-proto v1.0.0-alpha7 github.com/cosmos/cosmos-sdk v0.46.1 github.com/cosmos/go-bip39 v1.0.0 - github.com/cosmos/ibc-go/v5 v5.0.0-rc2 + github.com/cosmos/ibc-go/v5 v5.0.0 github.com/ethereum/go-ethereum v1.10.25 github.com/gogo/protobuf v1.3.3 github.com/golang/protobuf v1.5.2 diff --git a/go.sum b/go.sum index 8e49ce7636..5aee2be974 100644 --- a/go.sum +++ b/go.sum @@ -290,8 +290,8 @@ github.com/cosmos/gorocksdb v1.2.0 h1:d0l3jJG8M4hBouIZq0mDUHZ+zjOx044J3nGRskwTb4 github.com/cosmos/gorocksdb v1.2.0/go.mod h1:aaKvKItm514hKfNJpUJXnnOWeBnk2GL4+Qw9NHizILw= github.com/cosmos/iavl v0.19.1 h1:3gaq9b6SjiB0KBTygRnAvEGml2pQlu1TH8uma5g63Ys= github.com/cosmos/iavl v0.19.1/go.mod h1:X9PKD3J0iFxdmgNLa7b2LYWdsGd90ToV5cAONApkEPw= -github.com/cosmos/ibc-go/v5 v5.0.0-rc2 h1:7rGkZwojUwK1Dvgze3ZP5K1upIKygudxU3WaeFFU2ts= -github.com/cosmos/ibc-go/v5 v5.0.0-rc2/go.mod h1:Wqsguq98Iuns8tgTv8+xaGYbC+Q8zJfbpjzT6IgMJbs= +github.com/cosmos/ibc-go/v5 v5.0.0 h1:MkObdarpoICPHXoRg/Ne9NRix4j7eQlJZq74/uzH3Zc= +github.com/cosmos/ibc-go/v5 v5.0.0/go.mod h1:Wqsguq98Iuns8tgTv8+xaGYbC+Q8zJfbpjzT6IgMJbs= github.com/cosmos/ledger-cosmos-go v0.11.1 h1:9JIYsGnXP613pb2vPjFeMMjBI5lEDsEaF6oYorTy6J4= github.com/cosmos/ledger-cosmos-go v0.11.1/go.mod h1:J8//BsAGTo3OC/vDLjMRFLW6q0WAaXvHnVc7ZmE8iUY= github.com/cosmos/ledger-go v0.9.2 h1:Nnao/dLwaVTk1Q5U9THldpUMMXU94BOTWPddSmVB6pI= diff --git a/price-feeder/go.mod b/price-feeder/go.mod index 00d28b50a5..c552bd35f0 100644 --- a/price-feeder/go.mod +++ b/price-feeder/go.mod @@ -73,7 +73,7 @@ require ( github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gorocksdb v1.2.0 // indirect github.com/cosmos/iavl v0.19.1 // indirect - github.com/cosmos/ibc-go/v5 v5.0.0-rc2 // indirect + github.com/cosmos/ibc-go/v5 v5.0.0 // indirect github.com/cosmos/ledger-cosmos-go v0.11.1 // indirect github.com/cosmos/ledger-go v0.9.2 // indirect github.com/creachadair/taskgroup v0.3.2 // indirect diff --git a/price-feeder/go.sum b/price-feeder/go.sum index f99f739185..73379ce20a 100644 --- a/price-feeder/go.sum +++ b/price-feeder/go.sum @@ -278,8 +278,8 @@ github.com/cosmos/gorocksdb v1.2.0 h1:d0l3jJG8M4hBouIZq0mDUHZ+zjOx044J3nGRskwTb4 github.com/cosmos/gorocksdb v1.2.0/go.mod h1:aaKvKItm514hKfNJpUJXnnOWeBnk2GL4+Qw9NHizILw= github.com/cosmos/iavl v0.19.1 h1:3gaq9b6SjiB0KBTygRnAvEGml2pQlu1TH8uma5g63Ys= github.com/cosmos/iavl v0.19.1/go.mod h1:X9PKD3J0iFxdmgNLa7b2LYWdsGd90ToV5cAONApkEPw= -github.com/cosmos/ibc-go/v5 v5.0.0-rc2 h1:7rGkZwojUwK1Dvgze3ZP5K1upIKygudxU3WaeFFU2ts= -github.com/cosmos/ibc-go/v5 v5.0.0-rc2/go.mod h1:Wqsguq98Iuns8tgTv8+xaGYbC+Q8zJfbpjzT6IgMJbs= +github.com/cosmos/ibc-go/v5 v5.0.0 h1:MkObdarpoICPHXoRg/Ne9NRix4j7eQlJZq74/uzH3Zc= +github.com/cosmos/ibc-go/v5 v5.0.0/go.mod h1:Wqsguq98Iuns8tgTv8+xaGYbC+Q8zJfbpjzT6IgMJbs= github.com/cosmos/ledger-cosmos-go v0.11.1 h1:9JIYsGnXP613pb2vPjFeMMjBI5lEDsEaF6oYorTy6J4= github.com/cosmos/ledger-cosmos-go v0.11.1/go.mod h1:J8//BsAGTo3OC/vDLjMRFLW6q0WAaXvHnVc7ZmE8iUY= github.com/cosmos/ledger-go v0.9.2 h1:Nnao/dLwaVTk1Q5U9THldpUMMXU94BOTWPddSmVB6pI= From bc5cace0164ac40efaa6c9c519fc1d0969cae976 Mon Sep 17 00:00:00 2001 From: ryanbajollari <54822716+rbajollari@users.noreply.github.com> Date: Fri, 30 Sep 2022 14:13:44 -0400 Subject: [PATCH 17/20] refactor: Cleaned up float->dec conversions (#1431) * Cleaned up float->dec conversions * Update CHANGELOG.md * fix updating wrong changelog * Update CHANGELOG.md * Fix CHANGELOG.md * Order imports Co-authored-by: Adam Wozniak <29418299+adamewozniak@users.noreply.github.com> Co-authored-by: Robert Zaremba --- price-feeder/CHANGELOG.md | 1 + price-feeder/oracle/provider/ftx.go | 15 +++++---------- price-feeder/oracle/provider/huobi_test.go | 15 +++++++-------- price-feeder/oracle/provider/osmosis.go | 19 +++++++------------ 4 files changed, 20 insertions(+), 30 deletions(-) diff --git a/price-feeder/CHANGELOG.md b/price-feeder/CHANGELOG.md index e0d3fc8f2c..725ffc2015 100644 --- a/price-feeder/CHANGELOG.md +++ b/price-feeder/CHANGELOG.md @@ -80,6 +80,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ - [#1175](https://github.com/umee-network/umee/pull/1175) Add type ProviderName. - [#1255](https://github.com/umee-network/umee/pull/1255) Move TickerPrice and CandlePrice to types package - [#1374](https://github.com/umee-network/umee/pull/1374) Add standard for telemetry metrics. +- [#1431](https://github.com/umee-network/umee/pull/1431) Convert floats to sdk decimal using helper functions in all providers. ### Features diff --git a/price-feeder/oracle/provider/ftx.go b/price-feeder/oracle/provider/ftx.go index 2f305bbaae..54fe23c2b6 100644 --- a/price-feeder/oracle/provider/ftx.go +++ b/price-feeder/oracle/provider/ftx.go @@ -6,14 +6,13 @@ import ( "fmt" "io" "net/http" - "strconv" "strings" "sync" "time" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/rs/zerolog" "github.com/umee-network/umee/price-feeder/oracle/types" + "github.com/umee-network/umee/v3/util/coin" ) const ( @@ -136,14 +135,12 @@ func (p *FTXProvider) GetTickerPrices(pairs ...types.CurrencyPair) (map[string]t return nil, fmt.Errorf("duplicate token found in FTX response: %s", symbol) } - priceRaw := strconv.FormatFloat(tr.Price, 'f', -1, 64) - price, err := sdk.NewDecFromStr(priceRaw) + price, err := coin.NewDecFromFloat(tr.Price) if err != nil { return nil, fmt.Errorf("failed to read FTX price (%f) for %s", tr.Price, symbol) } - volumeRaw := strconv.FormatFloat(tr.Volume, 'f', -1, 64) - volume, err := sdk.NewDecFromStr(volumeRaw) + volume, err := coin.NewDecFromFloat(tr.Volume) if err != nil { return nil, fmt.Errorf("failed to read FTX volume (%f) for %s", tr.Volume, symbol) } @@ -304,11 +301,9 @@ func (p *FTXProvider) pollCandles(pairs ...types.CurrencyPair) error { } candleEnd := candleStart.Add(candleWindowLength).Unix() * int64(time.Second/time.Millisecond) - closeStr := fmt.Sprintf("%f", responseCandle.Price) - volumeStr := fmt.Sprintf("%f", responseCandle.Volume) candlePrices = append(candlePrices, types.CandlePrice{ - Price: sdk.MustNewDecFromStr(closeStr), - Volume: sdk.MustNewDecFromStr(volumeStr), + Price: coin.MustNewDecFromFloat(responseCandle.Price), + Volume: coin.MustNewDecFromFloat(responseCandle.Volume), TimeStamp: candleEnd, }) } diff --git a/price-feeder/oracle/provider/huobi_test.go b/price-feeder/oracle/provider/huobi_test.go index ccc5479d6e..2fd5c2700c 100644 --- a/price-feeder/oracle/provider/huobi_test.go +++ b/price-feeder/oracle/provider/huobi_test.go @@ -2,13 +2,12 @@ package provider import ( "context" - "strconv" "testing" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/rs/zerolog" "github.com/stretchr/testify/require" "github.com/umee-network/umee/price-feeder/oracle/types" + "github.com/umee-network/umee/v3/util/coin" ) func TestHuobiProvider_GetTickerPrices(t *testing.T) { @@ -38,8 +37,8 @@ func TestHuobiProvider_GetTickerPrices(t *testing.T) { prices, err := p.GetTickerPrices(types.CurrencyPair{Base: "ATOM", Quote: "USDT"}) require.NoError(t, err) require.Len(t, prices, 1) - require.Equal(t, sdk.MustNewDecFromStr(strconv.FormatFloat(lastPrice, 'f', -1, 64)), prices["ATOMUSDT"].Price) - require.Equal(t, sdk.MustNewDecFromStr(strconv.FormatFloat(volume, 'f', -1, 64)), prices["ATOMUSDT"].Volume) + require.Equal(t, coin.MustNewDecFromFloat(lastPrice), prices["ATOMUSDT"].Price) + require.Equal(t, coin.MustNewDecFromFloat(volume), prices["ATOMUSDT"].Volume) }) t.Run("valid_request_multi_ticker", func(t *testing.T) { @@ -71,10 +70,10 @@ func TestHuobiProvider_GetTickerPrices(t *testing.T) { ) require.NoError(t, err) require.Len(t, prices, 2) - require.Equal(t, sdk.MustNewDecFromStr(strconv.FormatFloat(lastPriceAtom, 'f', -1, 64)), prices["ATOMUSDT"].Price) - require.Equal(t, sdk.MustNewDecFromStr(strconv.FormatFloat(volume, 'f', -1, 64)), prices["ATOMUSDT"].Volume) - require.Equal(t, sdk.MustNewDecFromStr(strconv.FormatFloat(lastPriceLuna, 'f', -1, 64)), prices["LUNAUSDT"].Price) - require.Equal(t, sdk.MustNewDecFromStr(strconv.FormatFloat(volume, 'f', -1, 64)), prices["LUNAUSDT"].Volume) + require.Equal(t, coin.MustNewDecFromFloat(lastPriceAtom), prices["ATOMUSDT"].Price) + require.Equal(t, coin.MustNewDecFromFloat(volume), prices["ATOMUSDT"].Volume) + require.Equal(t, coin.MustNewDecFromFloat(lastPriceLuna), prices["LUNAUSDT"].Price) + require.Equal(t, coin.MustNewDecFromFloat(volume), prices["LUNAUSDT"].Volume) }) t.Run("invalid_request_invalid_ticker", func(t *testing.T) { diff --git a/price-feeder/oracle/provider/osmosis.go b/price-feeder/oracle/provider/osmosis.go index 9e109d0e47..923efda13b 100644 --- a/price-feeder/oracle/provider/osmosis.go +++ b/price-feeder/oracle/provider/osmosis.go @@ -5,11 +5,10 @@ import ( "fmt" "io" "net/http" - "strconv" "strings" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/umee-network/umee/price-feeder/oracle/types" + "github.com/umee-network/umee/v3/util/coin" ) const ( @@ -116,16 +115,14 @@ func (p OsmosisProvider) GetTickerPrices(pairs ...types.CurrencyPair) (map[strin return nil, fmt.Errorf("duplicate token found in Osmosis response: %s", symbol) } - priceRaw := strconv.FormatFloat(tr.Price, 'f', -1, 64) - price, err := sdk.NewDecFromStr(priceRaw) + price, err := coin.NewDecFromFloat(tr.Price) if err != nil { - return nil, fmt.Errorf("failed to read Osmosis price (%s) for %s", priceRaw, symbol) + return nil, fmt.Errorf("failed to read Osmosis price (%f) for %s", tr.Price, symbol) } - volumeRaw := strconv.FormatFloat(tr.Volume, 'f', -1, 64) - volume, err := sdk.NewDecFromStr(volumeRaw) + volume, err := coin.NewDecFromFloat(tr.Volume) if err != nil { - return nil, fmt.Errorf("failed to read Osmosis volume (%s) for %s", volumeRaw, symbol) + return nil, fmt.Errorf("failed to read Osmosis volume (%f) for %s", tr.Volume, symbol) } tickerPrices[cp.String()] = types.TickerPrice{Price: price, Volume: volume} @@ -177,11 +174,9 @@ func (p OsmosisProvider) GetCandlePrices(pairs ...types.CurrencyPair) (map[strin if staleTime >= responseCandle.Time { continue } - closeStr := fmt.Sprintf("%f", responseCandle.Close) - volumeStr := fmt.Sprintf("%f", responseCandle.Volume) candlePrices = append(candlePrices, types.CandlePrice{ - Price: sdk.MustNewDecFromStr(closeStr), - Volume: sdk.MustNewDecFromStr(volumeStr), + Price: coin.MustNewDecFromFloat(responseCandle.Close), + Volume: coin.MustNewDecFromFloat(responseCandle.Volume), // convert osmosis timestamp seconds -> milliseconds TimeStamp: SecondsToMilli(responseCandle.Time), }) From aa6a3d5f593da41aef1b2969345f1e0e9fd83767 Mon Sep 17 00:00:00 2001 From: Sai Kumar <17549398+gsk967@users.noreply.github.com> Date: Sun, 2 Oct 2022 08:59:01 +0530 Subject: [PATCH 18/20] chore: improve cache build (#1461) ## Description closes: #1308 This pull request contains changes related improve cache of build-binary github workflows , now github jobs will use cached binaries for testing the chain. --- ### Author Checklist _All items are required. Please add a note to the item if the item is not applicable and please add links to any relevant follow up issues._ I have... - [ ] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] added `!` to the type prefix if API or client breaking change - [ ] added appropriate labels to the PR - [ ] targeted the correct branch (see [PR Targeting](https://github.com/umee-network/umee/blob/main/CONTRIBUTING.md#pr-targeting)) - [ ] provided a link to the relevant issue or specification - [ ] added a changelog entry to `CHANGELOG.md` - [ ] included comments for [documenting Go code](https://blog.golang.org/godoc) - [ ] updated the relevant documentation or specification - [ ] reviewed "Files changed" and left comments if necessary - [ ] confirmed all CI checks have passed ### Reviewers Checklist _All items are required. Please add a note if the item is not applicable and please add your handle next to the items reviewed if you only reviewed selected items._ I have... - [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] confirmed all author checklist items have been addressed - [ ] reviewed state machine logic - [ ] reviewed API design and naming - [ ] reviewed documentation is accurate - [ ] reviewed tests and test coverage - [ ] manually tested (if applicable) --- .github/workflows/build.yml | 16 +++++++------- .github/workflows/tests.yml | 42 ++++++++++++++++++++++++------------- app/app.go | 1 + 3 files changed, 36 insertions(+), 23 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 90a52a7eb4..b90c777dd8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,6 +18,12 @@ jobs: name: umee ${{ matrix.arch }} for ${{ matrix.targetos }} steps: - uses: actions/checkout@v3 + - name: Cache binaries + id: cache-binaries + uses: actions/cache@v3 + with: + path: ./cmd/umeed/umeed + key: umeed-${{ matrix.targetos }}-${{ matrix.arch }} - uses: technote-space/get-diff-action@v6.1.0 with: PATTERNS: | @@ -25,7 +31,7 @@ jobs: go.mod go.sum - name: Setup go - if: env.GIT_DIFF + if: steps.cache-binaries.outputs.cache-hit != 'true' && env.GIT_DIFF uses: actions/setup-go@v3 with: go-version: 1.19 @@ -34,14 +40,8 @@ jobs: GOOS: ${{ matrix.targetos }} GOARCH: ${{ matrix.arch }} - name: Compile - if: env.GIT_DIFF + if: steps.cache-binaries.outputs.cache-hit != 'true' && env.GIT_DIFF run: | go mod download cd cmd/umeed go build . - - uses: actions/upload-artifact@v3 - if: env.GIT_DIFF - with: - name: umeed-${{ matrix.targetos }}-${{ matrix.arch }} - path: cmd/umeed/umeed - retention-days: 1 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6db4d6c254..e630a18157 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -124,20 +124,26 @@ jobs: go.mod go.sum - - name: gets umeed bin - if: env.GIT_DIFF - uses: actions/download-artifact@v3 + - name: Cache updated version binary + id: cache-binaries + uses: actions/cache@v3 with: - name: umeed-linux-amd64 - path: ./build + path: ./cmd/umeed/umeed + key: umeed-linux-amd64 - - name: Start single node chain - if: env.GIT_DIFF + - name: Move new version binary to build folder + if: steps.cache-binaries.outputs.cache-hit == 'true' run: | + mkdir -p build + cp ./cmd/umeed/umeed ./build/umeed chmod +x ./build/umeed + + - name: Start single node chain + if: env.GIT_DIFF && steps.cache-binaries.outputs.cache-hit == 'true' + run: | ./contrib/scripts/single-node.sh - name: Test Local Network Liveness - if: env.GIT_DIFF + if: env.GIT_DIFF && steps.cache-binaries.outputs.cache-hit == 'true' run: | sleep 1m ./contrib/scripts/test_localnet_liveness.sh 50 5 50 localhost:26657 @@ -155,12 +161,19 @@ jobs: go.mod go.sum - - name: gets umeed bin - if: env.GIT_DIFF - uses: actions/download-artifact@v3 + - name: Cache updated version binary + id: cache-binaries + uses: actions/cache@v3 with: - name: umeed-linux-amd64 - path: ./build + path: ./cmd/umeed/umeed + key: umeed-linux-amd64 + + - name: Move new version binary to build folder + if: steps.cache-binaries.outputs.cache-hit == 'true' + run: | + mkdir -p build + cp ./cmd/umeed/umeed ./build/umeed + chmod +x ./build/umeed - name: cache umeed mainnet uses: actions/cache@v3 @@ -183,7 +196,6 @@ jobs: run: | ./contrib/scripts/tinker-mainnet-genesis.sh - name: Fork mainnet and upgrade from v1.1.2 to v.3.x.x - if: env.GIT_DIFF + if: env.GIT_DIFF && steps.cache-binaries.outputs.cache-hit == 'true' run: | - chmod +x ./build/umeed ./contrib/scripts/umeemainnet_fork.sh diff --git a/app/app.go b/app/app.go index 2aefa5e7b4..c991793a3f 100644 --- a/app/app.go +++ b/app/app.go @@ -810,6 +810,7 @@ func (app *UmeeApp) SimulationManager() *module.SimulationManager { } // RegisterAPIRoutes registers all application module routes with the provided +// // API server. func (app *UmeeApp) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig) { clientCtx := apiSvr.ClientCtx From 77fa5a675961004abde8064d1a5930d051b0210c Mon Sep 17 00:00:00 2001 From: ryanbajollari <54822716+rbajollari@users.noreply.github.com> Date: Mon, 3 Oct 2022 19:22:24 -0400 Subject: [PATCH 19/20] refactor: Remove unnecessary instances of keepReconnecting (#1442) * Remove unnecessary instances of keepReconnecting * Log error in reconnect instead of returning error * Remove unused ping method * Remove redundant error check * Restore ping in Kraken provider * Update CHANGELOG.md Co-authored-by: Adam Wozniak <29418299+adamewozniak@users.noreply.github.com> --- price-feeder/CHANGELOG.md | 1 + price-feeder/oracle/provider/binance.go | 42 ++++------------------ price-feeder/oracle/provider/kraken.go | 47 +++++-------------------- 3 files changed, 15 insertions(+), 75 deletions(-) diff --git a/price-feeder/CHANGELOG.md b/price-feeder/CHANGELOG.md index 725ffc2015..0aa017df3a 100644 --- a/price-feeder/CHANGELOG.md +++ b/price-feeder/CHANGELOG.md @@ -81,6 +81,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ - [#1255](https://github.com/umee-network/umee/pull/1255) Move TickerPrice and CandlePrice to types package - [#1374](https://github.com/umee-network/umee/pull/1374) Add standard for telemetry metrics. - [#1431](https://github.com/umee-network/umee/pull/1431) Convert floats to sdk decimal using helper functions in all providers. +- [#1442](https://github.com/umee-network/umee/pull/1442) Remove unnecessary method in recconection logic. ### Features diff --git a/price-feeder/oracle/provider/binance.go b/price-feeder/oracle/provider/binance.go index c39ae18ef3..fee61573c7 100644 --- a/price-feeder/oracle/provider/binance.go +++ b/price-feeder/oracle/provider/binance.go @@ -329,26 +329,13 @@ func (p *BinanceProvider) handleWebSocketMsgs(ctx context.Context) { p.messageReceived(messageType, bz) case <-reconnectTicker.C: - if err := p.disconnect(); err != nil { - p.logger.Err(err).Msg("error disconnecting") - } if err := p.reconnect(); err != nil { p.logger.Err(err).Msg("error reconnecting") - p.keepReconnecting() } } } } -// disconnect disconnects the existing websocket connection. -func (p *BinanceProvider) disconnect() error { - err := p.wsClient.Close() - if err != nil { - return types.ErrProviderConnection.Wrapf("error closing Binance websocket %v", err) - } - return nil -} - // reconnect closes the last WS connection then create a new one and subscribe to // all subscribed pairs in the ticker and candle pais. A single connection to // stream.binance.com is only valid for 24 hours; expect to be disconnected at the @@ -356,6 +343,11 @@ func (p *BinanceProvider) disconnect() error { // the websocket server does not receive a pong frame back from the connection // within a 10 minute period, the connection will be disconnected. func (p *BinanceProvider) reconnect() error { + err := p.wsClient.Close() + if err != nil { + p.logger.Err(err).Msg("error closing binance websocket") + } + p.logger.Debug().Msg("reconnecting websocket") wsConn, resp, err := websocket.DefaultDialer.Dial(p.wsURL.String(), nil) defer resp.Body.Close() @@ -363,31 +355,9 @@ func (p *BinanceProvider) reconnect() error { return fmt.Errorf("error reconnect to binance websocket: %w", err) } p.wsClient = wsConn - - currencyPairs := p.subscribedPairsToSlice() - telemetryWebsocketReconnect(ProviderBinance) - return p.subscribeChannels(currencyPairs...) -} - -// keepReconnecting keeps trying to reconnect if an error occurs in reconnect. -func (p *BinanceProvider) keepReconnecting() { - reconnectTicker := time.NewTicker(defaultReconnectTime) - defer reconnectTicker.Stop() - connectionTries := 1 - for time := range reconnectTicker.C { - if err := p.reconnect(); err != nil { - p.logger.Err(err).Msgf("attempted to reconnect %d times at %s", connectionTries, time.String()) - connectionTries++ - continue - } - - if connectionTries > maxReconnectionTries { - p.logger.Warn().Msgf("failed to reconnect %d times", connectionTries) - } - return - } + return p.subscribeChannels(p.subscribedPairsToSlice()...) } // setSubscribedPairs sets N currency pairs to the map of subscribed pairs. diff --git a/price-feeder/oracle/provider/kraken.go b/price-feeder/oracle/provider/kraken.go index f8acc4274d..0103999e0b 100644 --- a/price-feeder/oracle/provider/kraken.go +++ b/price-feeder/oracle/provider/kraken.go @@ -261,7 +261,6 @@ func (p *KrakenProvider) handleWebSocketMsgs(ctx context.Context) { if err != nil { if websocket.IsCloseError(err, websocket.CloseAbnormalClosure) { p.logger.Err(err).Msg("WebSocket closed unexpectedly") - p.keepReconnecting() continue } @@ -269,7 +268,6 @@ func (p *KrakenProvider) handleWebSocketMsgs(ctx context.Context) { p.logger.Err(err).Msg("could not read message") if err := p.ping(); err != nil { p.logger.Err(err).Msg("failed to send ping") - p.keepReconnecting() } continue } @@ -281,12 +279,8 @@ func (p *KrakenProvider) handleWebSocketMsgs(ctx context.Context) { p.messageReceived(messageType, bz) case <-reconnectTicker.C: - if err := p.disconnect(); err != nil { - p.logger.Err(err).Msg("error disconnecting") - } if err := p.reconnect(); err != nil { - p.logger.Err(err).Msg("attempted to reconnect") - p.keepReconnecting() + p.logger.Err(err).Msg("error reconnecting") } } } @@ -463,50 +457,23 @@ func (p *KrakenProvider) messageReceivedCandle(bz []byte) error { return nil } -// disconnect disconnects the existing websocket connection. -func (p *KrakenProvider) disconnect() error { +// reconnect closes the last WS connection then create a new one. +func (p *KrakenProvider) reconnect() error { err := p.wsClient.Close() if err != nil { - return types.ErrProviderConnection.Wrapf("error closing Kraken websocket %v", err) + p.logger.Err(err).Msg("error closing Kraken websocket") } - return nil -} -// reconnect creates a new websocket connection. -func (p *KrakenProvider) reconnect() error { p.logger.Debug().Msg("trying to reconnect") - wsConn, resp, err := websocket.DefaultDialer.Dial(p.wsURL.String(), nil) defer resp.Body.Close() if err != nil { return fmt.Errorf("error connecting to Kraken websocket: %w", err) } p.wsClient = wsConn - - currencyPairs := p.subscribedPairsToSlice() - telemetryWebsocketReconnect(ProviderKraken) - return p.subscribeChannels(currencyPairs...) -} -// keepReconnecting keeps trying to reconnect if an error occurs in recconnect. -func (p *KrakenProvider) keepReconnecting() { - reconnectTicker := time.NewTicker(defaultReconnectTime) - defer reconnectTicker.Stop() - connectionTries := 1 - - for time := range reconnectTicker.C { - if err := p.reconnect(); err != nil { - p.logger.Err(err).Msgf("attempted to reconnect %d times at %s", connectionTries, time.String()) - connectionTries++ - continue - } - - if connectionTries > maxReconnectionTries { - p.logger.Warn().Msgf("failed to reconnect %d times", connectionTries) - } - return - } + return p.subscribeChannels(p.subscribedPairsToSlice()...) } // messageReceivedSubscriptionStatus handle the subscription status message @@ -543,7 +510,9 @@ func (p *KrakenProvider) messageReceivedSystemStatus(bz []byte) { return } - p.keepReconnecting() + if err := p.reconnect(); err != nil { + p.logger.Err(err).Msg("error reconnecting") + } } // setTickerPair sets an ticker to the map thread safe by the mutex. From f80548414ed0c07631d6c72d86b8f281748382e1 Mon Sep 17 00:00:00 2001 From: Rafael Tenfen Date: Tue, 4 Oct 2022 10:52:24 -0300 Subject: [PATCH 20/20] ci: Disable upgrade ci (#1464) * commented upgrade CI since it is not needed anymore, v3 is there o/ * removed ci upgrade test --- .github/workflows/tests.yml | 54 +------------------------------------ 1 file changed, 1 insertion(+), 53 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e630a18157..70a24918c4 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -131,7 +131,7 @@ jobs: path: ./cmd/umeed/umeed key: umeed-linux-amd64 - - name: Move new version binary to build folder + - name: Move new version binary to build folder if: steps.cache-binaries.outputs.cache-hit == 'true' run: | mkdir -p build @@ -147,55 +147,3 @@ jobs: run: | sleep 1m ./contrib/scripts/test_localnet_liveness.sh 50 5 50 localhost:26657 - - mainnet-upgrade-v1-v3: - needs: build-umeed - runs-on: ubuntu-latest - timeout-minutes: 20 - steps: - - uses: actions/checkout@v3 - - uses: technote-space/get-diff-action@v6.1.0 - with: - PATTERNS: | - **/**.go - go.mod - go.sum - - - name: Cache updated version binary - id: cache-binaries - uses: actions/cache@v3 - with: - path: ./cmd/umeed/umeed - key: umeed-linux-amd64 - - - name: Move new version binary to build folder - if: steps.cache-binaries.outputs.cache-hit == 'true' - run: | - mkdir -p build - cp ./cmd/umeed/umeed ./build/umeed - chmod +x ./build/umeed - - - name: cache umeed mainnet - uses: actions/cache@v3 - id: umeed-v112 - with: - path: ./contrib/scripts/umeed-releases/umeed-v1.1.2-linux-amd64/umeed - key: umeed-v112 - - name: download mainnet binary - if: steps.umeed-v112.outputs.cache-hit != 'true' - run: | - ./contrib/scripts/download-mainnet-umeed.sh - - name: cache mainnet tinkered genesis - uses: actions/cache@v3 - id: tinkered-genesis-sep-15 - with: - path: ./contrib/scripts/mainnet_tinkered_genesis.json - key: tinkered-genesis-sep-15 - - name: tinkerer mainnet genesis - if: steps.tinkered-genesis-sep-15.outputs.cache-hit != 'true' - run: | - ./contrib/scripts/tinker-mainnet-genesis.sh - - name: Fork mainnet and upgrade from v1.1.2 to v.3.x.x - if: env.GIT_DIFF && steps.cache-binaries.outputs.cache-hit == 'true' - run: | - ./contrib/scripts/umeemainnet_fork.sh