Skip to content

Commit

Permalink
refactor: use cosmossdk.io/errors (#5065)
Browse files Browse the repository at this point in the history
* use cosmossdk.io/errors

* update changelog

* fix links so they don't violate no-bare-url

(cherry picked from commit 560224f)

# Conflicts:
#	CHANGELOG.md
#	app/params/config.go
#	go.mod
#	go.sum
#	osmomath/go.mod
#	osmoutils/go.mod
#	tests/cl-genesis-positions/go.mod
#	tests/cl-go-client/go.mod
#	tests/cl-go-client/go.sum
#	x/concentrated-liquidity/incentives_test.go
#	x/cosmwasmpool/model/msgs.go
#	x/epochs/go.mod
#	x/epochs/go.sum
#	x/gamm/handler.go
#	x/gamm/keeper/migrate_test.go
#	x/gamm/pool-models/balancer/msgs.go
#	x/ibc-hooks/go.mod
#	x/ibc-hooks/go.sum
#	x/pool-incentives/types/errors.go
#	x/superfluid/keeper/migrate_test.go
#	x/superfluid/keeper/stake_test.go
#	x/superfluid/keeper/superfluid_asset_store.go
#	x/superfluid/types/msgs.go
#	x/tokenfactory/keeper/before_send.go
#	x/tokenfactory/types/errors.go
#	x/tokenfactory/types/msgs.go
  • Loading branch information
faddat authored and mergify[bot] committed May 3, 2023
1 parent d811bf2 commit 971e101
Show file tree
Hide file tree
Showing 78 changed files with 10,315 additions and 341 deletions.
55 changes: 46 additions & 9 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,38 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

<<<<<<< HEAD
=======
### Features

* [#4659](https://github.com/osmosis-labs/osmosis/pull/4659) implement AllPools query in x/poolmanager.
* [#4783](https://github.com/osmosis-labs/osmosis/pull/4783) Update wasmd to 0.31.0
* [#4830](https://github.com/osmosis-labs/osmosis/pull/4830) Add gas cost when we AddToGaugeRewards, linearly increase with coins to add
* [#4886](https://github.com/osmosis-labs/osmosis/pull/4886) Implement MsgSplitRouteSwapExactAmountIn and MsgSplitRouteSwapExactAmountOut that supports route splitting.
* [#5000](https://github.com/osmosis-labs/osmosis/pull/5000) osmomath.Power panics for base < 1 to temporarily restrict broken logic for such base.

### Misc Improvements

* [#5065](https://github.com/osmosis-labs/osmosis/pull/5065) Use cosmossdk.io/errors
* [#4549](https://github.com/osmosis-labs/osmosis/pull/4549) Add single pool price estimate queries
* [#4767](https://github.com/osmosis-labs/osmosis/pull/4767) Disable create pool with non-zero exit fee
* [#4847](https://github.com/osmosis-labs/osmosis/pull/4847) Update `make build` command to build only `osmosisd` binary
* [#4891](https://github.com/osmosis-labs/osmosis/pull/4891) Enable CORS by default on localosmosis
* [#4892](https://github.com/osmosis-labs/osmosis/pull/4847) Update Golang to 1.20
* [#4893](https://github.com/osmosis-labs/osmosis/pull/4893) Update alpine docker base image to `alpine:3.17`
* [#4912](https://github.com/osmosis-labs/osmosis/pull/4912) Export Position_lock_id mappings to GenesisState
* [#4974](https://github.com/osmosis-labs/osmosis/pull/4974) Add lock id to `MsgSuperfluidUndelegateAndUnbondLockResponse`

### API breaks

* [#4336](https://github.com/osmosis-labs/osmosis/pull/4336) Move epochs module into its own go.mod
* [#4658](https://github.com/osmosis-labs/osmosis/pull/4658) Deprecate x/gamm Pool query. The new one is located in x/poolmanager.
* [#4682](https://github.com/osmosis-labs/osmosis/pull/4682) Deprecate x/gamm SpotPrice v2 query. The new one is located in x/poolmanager.
* [#4801](https://github.com/osmosis-labs/osmosis/pull/4801) remove GetTotalShares, GetTotalLiquidity and GetExitFee from PoolI. Define all on CFMMPoolI, define GetTotalLiquidity on PoolModuleI only.
* [#4868](https://github.com/osmosis-labs/osmosis/pull/4868) Remove wasmEnabledProposals []wasm.ProposalType from NewOsmosisApp
* [#4951](https://github.com/osmosis-labs/osmosis/pull/4951) Implement pool liquidity query in pool manager, deprecate the one in gamm

>>>>>>> 560224f5 (refactor: use cosmossdk.io/errors (#5065))
## v15.1.0

### Security
Expand All @@ -50,8 +82,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Features

<<<<<<< HEAD
* [#4829] (https://github.com/osmosis-labs/osmosis/pull/4829) Add highest liquidity pool query in x/protorev
* [#4878] (https://github.com/osmosis-labs/osmosis/pull/4878) Emit backrun event upon successful protorev backrun
=======
* [#4829](https://github.com/osmosis-labs/osmosis/pull/4829) Add highest liquidity pool query in x/protorev
* [#4878](https://github.com/osmosis-labs/osmosis/pull/4878) Emit backrun event upon successful protorev backrun
>>>>>>> 560224f5 (refactor: use cosmossdk.io/errors (#5065))
### Misc Improvements

Expand All @@ -71,7 +108,7 @@ This release containts the following new modules:
* [#4248](https://github.com/osmosis-labs/osmosis/pull/4248) Add panic recovery to `MultihopEstimateInGivenExactAmountOut`, `MultihopEstimateOutGivenExactAmountIn` and `RouteExactAmountOut`
* [#3911](https://github.com/osmosis-labs/osmosis/pull/3911) Add Packet Forward Middleware
* [#4244](https://github.com/osmosis-labs/osmosis/pull/4244) Consensus min gas fee of .0025 uosmo
* [#4340](https://github.com/osmosis-labs/osmosis/pull/4340) Added rate limits according to: https://www.mintscan.io/osmosis/proposals/427
* [#4340](https://github.com/osmosis-labs/osmosis/pull/4340) Added rate limits according to: <https://www.mintscan.io/osmosis/proposals/427>
* [#4207](https://github.com/osmosis-labs/osmosis/pull/4207) Integrate Async ICQ.

### Misc Improvements
Expand Down Expand Up @@ -311,7 +348,7 @@ x

#### SDK Upgrades
* [#2245](https://github.com/osmosis-labs/osmosis/pull/2245) Upgrade SDK for to v0.45.0x-osmo-v9.2. Major changes:
* Minimum deposit on proposer at submission time: https://github.com/osmosis-labs/cosmos-sdk/pull/302
* Minimum deposit on proposer at submission time: <https://github.com/osmosis-labs/cosmos-sdk/pull/302>

## v10.1.1

Expand All @@ -333,11 +370,11 @@ x

#### SDK Upgrades
* [#2146](https://github.com/osmosis-labs/osmosis/pull/2146) Upgrade SDK for to v0.45.0x-osmo-v9.1. Major changes:
* Concurrency query client option: https://github.com/osmosis-labs/cosmos-sdk/pull/281
* Remove redacted message fix: https://github.com/osmosis-labs/cosmos-sdk/pull/284
* Reduce commit store logs (change to Debug): https://github.com/osmosis-labs/cosmos-sdk/pull/282
* Bring back the cliff vesting command: https://github.com/osmosis-labs/cosmos-sdk/pull/272
* Allow ScheduleUpgrade to come from same block: https://github.com/osmosis-labs/cosmos-sdk/pull/261
* Concurrency query client option: <https://github.com/osmosis-labs/cosmos-sdk/pull/281>
* Remove redacted message fix: <https://github.com/osmosis-labs/cosmos-sdk/pull/284>
* Reduce commit store logs (change to Debug): <https://github.com/osmosis-labs/cosmos-sdk/pull/282>
* Bring back the cliff vesting command: <https://github.com/osmosis-labs/cosmos-sdk/pull/272>
* Allow ScheduleUpgrade to come from same block: <https://github.com/osmosis-labs/cosmos-sdk/pull/261>


## v10.0.1
Expand Down Expand Up @@ -375,7 +412,7 @@ It including breaking changes to the GAMM API's, many developer and node operato
#### GAMM API changes

API changes were done to enable more CFMM's to be implemented within the existing framework.
Integrators will have to update their messages and queries to adapt, please see https://github.com/osmosis-labs/osmosis/blob/main/x/gamm/breaking_changes_notes.md
Integrators will have to update their messages and queries to adapt, please see <https://github.com/osmosis-labs/osmosis/blob/main/x/gamm/breaking_changes_notes.md>

#### Governance Changes

Expand Down Expand Up @@ -436,7 +473,7 @@ Every node should upgrade their software version to v8.0.0 before the upgrade bl

### Features
* {Across many PRs} Initiate emergency upgrade
* [#1481] Emergency upgrade as of prop [226] (https://www.mintscan.io/osmosis/proposals/226)
* [#1481] Emergency upgrade as of prop [226] (<https://www.mintscan.io/osmosis/proposals/226>)
* [#1482] Checking Whitelisted Pools contain UST
* [#1486] Update whitelisted pool IDs
* [#1262] Add a forceprune command to the binaries, that prunes golevelDB data better
Expand Down
11 changes: 10 additions & 1 deletion app/params/config.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package params

import (
errorsmod "cosmossdk.io/errors"
"github.com/cosmos/cosmos-sdk/types/address"

sdk "github.com/cosmos/cosmos-sdk/types"
Expand Down Expand Up @@ -59,16 +60,24 @@ func SetAddressPrefixes() {
// source: https://github.com/cosmos/cosmos-sdk/blob/v0.43.0-beta1/types/address.go#L141
config.SetAddressVerifier(func(bytes []byte) error {
if len(bytes) == 0 {
return sdkerrors.Wrap(sdkerrors.ErrUnknownAddress, "addresses cannot be empty")
return errorsmod.Wrap(sdkerrors.ErrUnknownAddress, "addresses cannot be empty")
}

if len(bytes) > address.MaxAddrLen {
<<<<<<< HEAD
return sdkerrors.Wrapf(sdkerrors.ErrUnknownAddress, "address max length is %d, got %d", address.MaxAddrLen, len(bytes))
=======
return errorsmod.Wrapf(sdkerrors.ErrUnknownAddress, "address max length is %d, got %d, %x", address.MaxAddrLen, len(bytes), bytes)
>>>>>>> 560224f5 (refactor: use cosmossdk.io/errors (#5065))
}

// TODO: Do we want to allow addresses of lengths other than 20 and 32 bytes?
if len(bytes) != 20 && len(bytes) != 32 {
<<<<<<< HEAD
return sdkerrors.Wrapf(sdkerrors.ErrUnknownAddress, "address length must be 20 or 32 bytes, got %d", len(bytes))
=======
return errorsmod.Wrapf(sdkerrors.ErrUnknownAddress, "address length must be 20 or 32 bytes, got %d, %x", len(bytes), bytes)
>>>>>>> 560224f5 (refactor: use cosmossdk.io/errors (#5065))
}

return nil
Expand Down
7 changes: 7 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,16 @@ module github.com/osmosis-labs/osmosis/v15
go 1.19

require (
<<<<<<< HEAD
github.com/CosmWasm/wasmd v0.30.0
github.com/cosmos/cosmos-proto v1.0.0-alpha8
github.com/cosmos/cosmos-sdk v0.46.10
=======
cosmossdk.io/errors v1.0.0-beta.7
github.com/CosmWasm/wasmd v0.31.0
github.com/cosmos/cosmos-proto v1.0.0-beta.2
github.com/cosmos/cosmos-sdk v0.47.2
>>>>>>> 560224f5 (refactor: use cosmossdk.io/errors (#5065))
github.com/cosmos/go-bip39 v1.0.0
github.com/cosmos/ibc-go/v4 v4.3.0
github.com/gogo/protobuf v1.3.3
Expand Down
6 changes: 6 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl
cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs=
cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo=
<<<<<<< HEAD
=======
collectd.org v0.3.0/go.mod h1:A/8DzQBkF6abtvrT2j/AU/4tiBgJWYyh0y/oB/4MlWE=
cosmossdk.io/errors v1.0.0-beta.7 h1:gypHW76pTQGVnHKo6QBkb4yFOJjC+sUGRc5Al3Odj1w=
cosmossdk.io/errors v1.0.0-beta.7/go.mod h1:mz6FQMJRku4bY7aqS/Gwfcmr/ue91roMEKAmDUDpBfE=
>>>>>>> 560224f5 (refactor: use cosmossdk.io/errors (#5065))
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
filippo.io/edwards25519 v1.0.0-rc.1 h1:m0VOOB23frXZvAOK44usCgLWvtsxIoMCTBGJZlpmGfU=
filippo.io/edwards25519 v1.0.0-rc.1/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns=
Expand Down
4 changes: 4 additions & 0 deletions osmomath/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ module github.com/osmosis-labs/osmosis/osmomath
go 1.19

require (
<<<<<<< HEAD
github.com/cosmos/cosmos-sdk v0.46.10
=======
github.com/cosmos/cosmos-sdk v0.47.2
>>>>>>> 560224f5 (refactor: use cosmossdk.io/errors (#5065))
github.com/stretchr/testify v1.8.2
gopkg.in/yaml.v2 v2.4.0
)
Expand Down
6 changes: 6 additions & 0 deletions osmoutils/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@ module github.com/osmosis-labs/osmosis/osmoutils
go 1.19

require (
<<<<<<< HEAD
github.com/cosmos/cosmos-sdk v0.46.10
github.com/cosmos/iavl v0.19.4
=======
github.com/cosmos/cosmos-sdk v0.47.2
github.com/cosmos/iavl v0.19.5
>>>>>>> 560224f5 (refactor: use cosmossdk.io/errors (#5065))
github.com/cosmos/ibc-go/v4 v4.3.0
github.com/gogo/protobuf v1.3.3
github.com/spf13/cobra v1.6.1
Expand Down Expand Up @@ -87,6 +92,7 @@ require (
github.com/mtibben/percent v0.2.1 // indirect
github.com/onsi/ginkgo v1.16.4 // indirect
github.com/onsi/gomega v1.26.0 // indirect
github.com/opencontainers/runc v1.1.5 // indirect
github.com/pelletier/go-toml/v2 v2.0.6 // indirect
github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 // indirect
github.com/pkg/errors v0.9.1 // indirect
Expand Down
2 changes: 1 addition & 1 deletion osmoutils/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ github.com/onsi/gomega v1.26.0 h1:03cDLK28U6hWvCAns6NeydX3zIm4SF3ci69ulidS32Q=
github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk=
github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U=
github.com/opencontainers/image-spec v1.1.0-rc2 h1:2zx/Stx4Wc5pIPDvIxHXvXtQFW/7XWJGmnM7r3wg034=
github.com/opencontainers/runc v1.1.3 h1:vIXrkId+0/J2Ymu2m7VjGvbSlAId9XNRPhn2p4b+d8w=
github.com/opencontainers/runc v1.1.5 h1:L44KXEpKmfWDcS02aeGm8QNTFXTo2D+8MYGDIJ/GDEs=
github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis=
github.com/opentracing/basictracer-go v1.0.0/go.mod h1:QfBfYuafItcjQuMwinw9GhYKwFXS9KnPs5lxoYwgW74=
github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
Expand Down
Loading

0 comments on commit 971e101

Please sign in to comment.