Skip to content

Commit 961738a

Browse files
czarcas7icnicolaslarap0mvnValarDragonhieuvubk
authored
chore: osmoutils, twap, downtime-detector, ibc-hooks cherry-pick to v14 (#3925)
* Upgrade IBC to v4.2.0 (#3838) * initial changes to migrate to ibc v4 * added checksum to proposal * begin and end block are now being called inside nextBlock * added changelog * linked pr on changelog * remove local replace * using error acks from osmoutils * osmoutils tagged * go sum * added checksum * feat(x/twap): modify cli to add geometric option (#3812) * feat(x/twap): geometric twap code gen query boilerplate * revert cli change * query gen * wire up API * test * fix * fixes * cli * lint * refactor via flag * refactor * refactor * fixes * lint * add arithmetic twap alias * Make wasm hooks importable (#3850) * moved ibc-hooks to its own go.mod * updated ibc hooks version * go sum * add ics23 patch into x/ibc-hooks * Fix wasm import version conflict * Update x/ibc-hooks to osmoutils v0.0.2 * Update versions Co-authored-by: Dev Ojha <dojha@berkeley.edu> * refactor(x/twap): handle spot price error case in the context of geometric twap (#3845) * refactor(x/twap): handle spot price error case * supporting test cases * table-driven log tests * test(x/twap): add randomized geometric twap test on a balancer pool (#3844) * test(x/twap): add randomized test with a balancer pool * comments * multiplicative tolerance, fewer retries and larger initial supply range * Basic geometric twap e2e test (#3835) * feat(x/twap): geometric twap code gen query boilerplate * revert cli change * query gen * wire up API * test * fix * fixes * add geometric queries * create pool.json * add test * resolve conflict * fix: swap uosmo in * fix problem with wallet creation * updates * simplify and add comments * Update tests/e2e/e2e_test.go * Update tests/e2e/e2e_test.go * Update tests/e2e/configurer/chain/queries.go Co-authored-by: Adam Tucker <adam@osmosis.team> * Update tests/e2e/configurer/chain/queries.go Co-authored-by: Adam Tucker <adam@osmosis.team> * Update tests/e2e/e2e_test.go Co-authored-by: Adam Tucker <adam@osmosis.team> * Update tests/e2e/e2e_test.go Co-authored-by: Adam Tucker <adam@osmosis.team> * Update tests/e2e/e2e_test.go Co-authored-by: Adam Tucker <adam@osmosis.team> * Update tests/e2e/e2e_test.go Co-authored-by: Adam Tucker <adam@osmosis.team> Co-authored-by: Roman <ackhtariev@gmail.com> Co-authored-by: Roman <roman@osmosis.team> Co-authored-by: Adam Tucker <adam@osmosis.team> * feat(x/twap): whitelist GeometricTwap and GeometricTwapToNow (#3852) * feat(x/twap): GeometricTwap and GeometricTwapToNow queries added to Stargate whitelist * update docs * fix(scripts): proto gen for osmoutils (#3854) * fix(scripts): proto gen for osmoutils * Update scripts/protocgen.sh * fix(scripts): proto gen osmoutils path (#3859) * added packet timeouts to wasm hooks (#3862) * add negative to cli (#3888) * Making osmoutils compile on chains that don't use our SDK fork (#3899) * making osmoutils compile on chains that don't use osmosis' fork of the cosmos sdk * updated imports for e2e tests * go fumpt * updated version everywhere * added changelog entry * remove deprecation from arithmetic & geometric twap to now query (#3917) * Add types & boilerplate for the Downtime detector module (#3609) Sub-component of #3603 Adds types for the thin module intended for downtime detection - Add downtime detection module types No tests added - Does this pull request introduce a new feature or user-facing behavior changes? somewhat - Is a relevant changelog entry added to the `Unreleased` section in `CHANGELOG.md`? yes - How is the feature or change documented? In its spec * Add downtime detector module (#3688) * WIP * Switch to enum * Remove params query * Add query * Add wiring, add import/export test * Start begin block test * Finish keeper tests * Add CLI * Wire downtime detector CLI + queries * more module wiring * add types test * Fix state alteration test * Fix superfluid test * Add stargate whitelist support * Apply code comment * Rename folder * Add requested godoc * Update x/downtime-detector/genesis.go Co-authored-by: Adam Tucker <adam@osmosis.team> * Apply adam suggestion for having a `-` * move genesis test to own file Co-authored-by: Adam Tucker <adam@osmosis.team> * Initial by hand fixes * feat(osmomath): Exp2 function (#3708) * feat(osmomath): exp2 function * export exp2 * changelog * refactor ErrTolerance to use Dec instead of Int for additive tolerance * Update osmomath/exp2.go * Update osmomath/exp2.go * Update osmomath/exp2.go * Update osmomath/exp2_test.go * Update osmomath/exp2_test.go * do bit shift instead of multiplication * godoc about error bounds * comment about bit shift equivalency * merge conflict * improve godoc * typo * remove TODOs - confirmed obsolete * Runge's phenomenon comment * [x/TWAP] Expose a geometric TWAP API (#3529) * refactored twap api.go for geometric TWAP * added barebon docs * romans feedback * new * fix * nichola feedback * final roman comments * fix twap by hand * change to gamm * fix balancer test * bump to v14 upgrade * e2e fix * add remaining diff from main to ibc-rate-limit * update contracts test * osmomath: `AddMut` and `QuoMut` (#3779) * mut add * test add mut * quo mut * test quo mut/ remove want from test struct * refactor exp * change mutatives code * change * not allocaing * exp change to quomut * remove file * refactor quo * refactor ad * refactor tests * Modify CHANGELOG * Whitelist EstimateSwapExactAmountOut (#3693) * whitelist EstimateSwapExactAmountOut * doc: changelog * updated rate limit contract * Fix rust checks (#3576) * added cargo.lock * added Cargo.lock as an artifact * added new bytecode with lock file Co-authored-by: Nicolas Lara <nicolaslara@gmail.com> Co-authored-by: Roman <roman@osmosis.team> Co-authored-by: Dev Ojha <dojha@berkeley.edu> Co-authored-by: Hieu Vu <72878483+hieuvubk@users.noreply.github.com> Co-authored-by: Roman <ackhtariev@gmail.com> Co-authored-by: Supanat <supanat.ptk@gmail.com> Co-authored-by: Dev Ojha <ValarDragon@users.noreply.github.com> Co-authored-by: Sishir Giri <sis1001@berkeley.edu> Co-authored-by: Ruslan Akhtariev <46343690+RusAkh@users.noreply.github.com> Co-authored-by: mattverse <mattpark1028@gmail.com> Co-authored-by: ByeongSu Hong <frostornge@gmail.com>
1 parent 40e5320 commit 961738a

File tree

139 files changed

+10602
-1225
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

139 files changed

+10602
-1225
lines changed

.github/workflows/contracts.yml

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
runs-on: ubuntu-latest
1717
strategy:
1818
matrix:
19-
contract: [{workdir: ./x/ibc-rate-limit/, output: bytecode/rate_limiter.wasm, build: artifacts/rate_limiter-x86_64.wasm, name: rate_limiter}]
19+
contract: [{workdir: ./x/ibc-rate-limit/, output: bytecode/rate_limiter.wasm, build: artifacts/rate_limiter.wasm, name: rate_limiter}]
2020

2121
steps:
2222
- name: Checkout sources
@@ -45,30 +45,13 @@ jobs:
4545
cargo test
4646
if: env.GIT_DIFF
4747

48-
- name: Set latest cw-optimizoor version
49-
run: >
50-
echo "CW_OPTIMIZOOR_VERSION=0.8.0" >> $GITHUB_ENV
51-
52-
- name: Cache cw-optimizoor
53-
id: cache-cw-optimizoor
54-
uses: actions/cache@v3
55-
env:
56-
cache-name: cache-cw-optimizoor
57-
with:
58-
# cargo bin files are stored in `~/.cargo/bin/` on Linux/macOS
59-
path: ~/.cargo/bin/cargo-cw-optimizoor
60-
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.CW_OPTIMIZOOR_VERSION }}
61-
62-
- if: ${{ steps.cache-cw-optimizoor.outputs.cache-hit != 'true' }}
63-
name: Install cw-optimizoor
64-
continue-on-error: true
65-
run: >
66-
cargo install cw-optimizoor
67-
6848
- name: Optimize
6949
working-directory: ${{ matrix.contract.workdir }}
7050
run: >
71-
cargo cw-optimizoor
51+
docker run --rm -v "$(pwd)":/code \
52+
--mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target \
53+
--mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
54+
cosmwasm/workspace-optimizer:0.12.10
7255
if: env.GIT_DIFF
7356

7457
- name: 'Upload optimized contract artifact'
@@ -79,6 +62,21 @@ jobs:
7962
retention-days: 1
8063
if: env.GIT_DIFF
8164

65+
- name: 'Upload Cargo.lock artifact'
66+
uses: actions/upload-artifact@v3
67+
with:
68+
name: Cargo.lock
69+
path: ${{ matrix.contract.workdir }}Cargo.lock
70+
retention-days: 1
71+
if: env.GIT_DIFF
72+
73+
- name: 'Upload Cargo.lock artifact'
74+
uses: actions/upload-artifact@v3
75+
with:
76+
name: Cargo.lock
77+
path: ${{ matrix.contract.workdir }}Cargo.lock
78+
retention-days: 1
79+
8280
- name: Check Test Data
8381
working-directory: ${{ matrix.contract.workdir }}
8482
if: env.GIT_DIFF

.gitignore

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -216,10 +216,6 @@ target/
216216
# Generated by rust-optimizer
217217
artifacts/
218218

219-
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
220-
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
221-
Cargo.lock
222-
223219
# These are backup files generated by rustfmt
224220
**/*.rs.bk
225221
# Don't commit lock files for test utils

CHANGELOG.md

Lines changed: 27 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -42,54 +42,44 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
4242

4343
## Unreleased
4444

45-
### Misc Improvements
46-
47-
* [#3677](https://github.com/osmosis-labs/osmosis/pull/3677) Add methods for cloning and mutative multiplication on osmomath.BigDec.
48-
* [#3676](https://github.com/osmosis-labs/osmosis/pull/3676) implement `PowerInteger` function on `osmomath.BigDec`
49-
* [#3678](https://github.com/osmosis-labs/osmosis/pull/3678) implement mutative `PowerIntegerMut` function on `osmomath.BigDec`.
50-
51-
### Features
52-
53-
### Bug fixes
45+
* [#3731](https://github.com/osmosis-labs/osmosis/pull/3731) BigDec Power functions with decimal exponent.
46+
* [#3817](https://github.com/osmosis-labs/osmosis/pull/3817) Move osmoassert from `app/apptesting/osmoassert` to `osmoutils/osmoassert`.
5447

55-
## v13.1.2
48+
### API breaks
5649

5750
### Bug fixes
5851

59-
* Fix state export
60-
* Update swagger files for v13
61-
62-
## v13.1.1
63-
64-
* Add a check in the makefile for using go v1.18
65-
66-
## v13.1.0
67-
68-
* Correctly apply DragonBerry IBC patch
69-
70-
### API breaks
71-
72-
* [#3763](https://github.com/osmosis-labs/osmosis/pull/3763) Move binary search and error tolerance code from `osmoutils` into `osmomath`
73-
* [#3817](https://github.com/osmosis-labs/osmosis/pull/3817) Move osmoassert from `app/apptesting/osmoassert` to `osmoutils/osmoassert`.
74-
* [#3771](https://github.com/osmosis-labs/osmosis/pull/3771) Move osmomath into its own go.mod
75-
* [#3827](https://github.com/osmosis-labs/osmosis/pull/3827) Move osmoutils into its own go.mod
52+
### Misc Improvements
7653

54+
* [#3611](https://github.com/osmosis-labs/osmosis/pull/3611),[#3647](https://github.com/osmosis-labs/osmosis/pull/3647) Introduce osmocli, to automate thousands of lines of CLI boilerplate
55+
* [#3634](https://github.com/osmosis-labs/osmosis/pull/3634) (Makefile) Ensure correct golang version in make build and make install. (Thank you @jhernandezb )
56+
* [#3712](https://github.com/osmosis-labs/osmosis/pull/3712) replace `osmomath.BigDec` `Power` with `PowerInteger`
57+
* [#3711](https://github.com/osmosis-labs/osmosis/pull/3711) Use Dec instead of Int for additive `ErrTolerace` in `osmoutils`.
7758

59+
## v14.0.0
60+
### Features
61+
* [#3609](https://github.com/osmosis-labs/osmosis/pull/3609) Add Downtime-detection module.
62+
* [#2788](https://github.com/osmosis-labs/osmosis/pull/2788) Add logarithm base 2 implementation.
63+
* [#3693](https://github.com/osmosis-labs/osmosis/pull/3693) Add `EstimateSwapExactAmountOut` query to stargate whitelist
64+
* [#3852](https://github.com/osmosis-labs/osmosis/pull/3852) GeometricTwap and GeometricTwapToNow queries added to Stargate whitelist.
65+
* [#3812](https://github.com/osmosis-labs/osmosis/pull/3812) Add geometric option to TWAP cli.
66+
* IBC features
67+
* [#3838](https://github.com/osmosis-labs/osmosis/pull/3838)Upgrade to IBC v4.2.0
68+
* Cosmwasm
69+
* Upgrade to wasmd v0.30.x
7870

7971
### Bug fixes
80-
8172
* [#3608](https://github.com/osmosis-labs/osmosis/pull/3608) Make it possible to state export from any directory.
8273

8374
### Misc Improvements
84-
85-
* [#3611](https://github.com/osmosis-labs/osmosis/pull/3611),[#3647](https://github.com/osmosis-labs/osmosis/pull/3647) Introduce osmocli, to automate thousands of lines of CLI boilerplate
86-
* [#3634](https://github.com/osmosis-labs/osmosis/pull/3634) (Makefile) Ensure correct golang version in make build and make install. (Thank you @jhernandezb )
87-
<<<<<<< HEAD
88-
* [#3712](https://github.com/osmosis-labs/osmosis/pull/3712) replace `osmomath.BigDec` `Power` with `PowerInteger`
89-
90-
=======
91-
* [#3711](https://github.com/osmosis-labs/osmosis/pull/3711) Use Dec instead of Int for additive `ErrTolerace` in `osmoutils`.
92-
>>>>>>> 5ab7ebf6 (refactor(osmoutils): use Dec for additive tolerance instead of Int (#3711))
75+
* [#3678](https://github.com/osmosis-labs/osmosis/pull/3678) Add methods for cloning and mutative multiplication on osmomath.BigDec.
76+
* [#3899](https://github.com/osmosis-labs/osmosis/pull/3899) Fixed osmoutils so its importable by chains that don't use the osmosis CosmosSDK fork
77+
* [#3676](https://github.com/osmosis-labs/osmosis/pull/3676) Implement `PowerInteger` function on `osmomath.BigDec`
78+
* [#3678](https://github.com/osmosis-labs/osmosis/pull/3678) Implement mutative `PowerIntegerMut` function on `osmomath.BigDec`.
79+
* [#3708](https://github.com/osmosis-labs/osmosis/pull/3708) `Exp2` function to compute 2^decimal.
80+
* [#3763](https://github.com/osmosis-labs/osmosis/pull/3763) Move binary search and error tolerance code from `osmoutils` into `osmomath`
81+
* [#3771](https://github.com/osmosis-labs/osmosis/pull/3771) Move osmomath into its own go.mod
82+
* [#3827](https://github.com/osmosis-labs/osmosis/pull/3827) Move osmoutils into its own go.mod
9383

9484
## v13.0.0
9585

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ SDK_PACK := $(shell go list -m github.com/cosmos/cosmos-sdk | sed 's/ /\@/g')
77
GO_VERSION := $(shell cat go.mod | grep -E 'go [0-9].[0-9]+' | cut -d ' ' -f 2)
88
DOCKER := $(shell which docker)
99
BUILDDIR ?= $(CURDIR)/build
10-
E2E_UPGRADE_VERSION := "v13"
10+
E2E_UPGRADE_VERSION := "v14"
1111

1212

1313
GO_MAJOR_VERSION = $(shell go version | cut -c 14- | cut -d' ' -f1 | cut -d'.' -f1)

app/ante.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ package app
33
import (
44
wasm "github.com/CosmWasm/wasmd/x/wasm"
55
wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
6-
ibcante "github.com/cosmos/ibc-go/v3/modules/core/ante"
7-
ibckeeper "github.com/cosmos/ibc-go/v3/modules/core/keeper"
6+
ibcante "github.com/cosmos/ibc-go/v4/modules/core/ante"
7+
ibckeeper "github.com/cosmos/ibc-go/v4/modules/core/keeper"
88

99
servertypes "github.com/cosmos/cosmos-sdk/server/types"
1010
sdk "github.com/cosmos/cosmos-sdk/types"

app/app.go

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,13 @@ import (
66
"net/http"
77
"os"
88
"path/filepath"
9+
"reflect"
910
"strings"
1011

12+
vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types"
13+
14+
"github.com/osmosis-labs/osmosis/osmoutils"
15+
1116
"github.com/CosmWasm/wasmd/x/wasm"
1217
"github.com/gorilla/mux"
1318
"github.com/rakyll/statik/fs"
@@ -45,6 +50,7 @@ import (
4550
v11 "github.com/osmosis-labs/osmosis/v13/app/upgrades/v11"
4651
v12 "github.com/osmosis-labs/osmosis/v13/app/upgrades/v12"
4752
v13 "github.com/osmosis-labs/osmosis/v13/app/upgrades/v13"
53+
v14 "github.com/osmosis-labs/osmosis/v13/app/upgrades/v14"
4854
v3 "github.com/osmosis-labs/osmosis/v13/app/upgrades/v3"
4955
v4 "github.com/osmosis-labs/osmosis/v13/app/upgrades/v4"
5056
v5 "github.com/osmosis-labs/osmosis/v13/app/upgrades/v5"
@@ -53,7 +59,7 @@ import (
5359
v8 "github.com/osmosis-labs/osmosis/v13/app/upgrades/v8"
5460
v9 "github.com/osmosis-labs/osmosis/v13/app/upgrades/v9"
5561
_ "github.com/osmosis-labs/osmosis/v13/client/docs/statik"
56-
ibc_hooks "github.com/osmosis-labs/osmosis/v13/x/ibc-hooks"
62+
ibc_hooks "github.com/osmosis-labs/osmosis/x/ibc-hooks"
5763
)
5864

5965
const appName = "OsmosisApp"
@@ -91,7 +97,7 @@ var (
9197

9298
// _ sdksimapp.App = (*OsmosisApp)(nil)
9399

94-
Upgrades = []upgrades.Upgrade{v4.Upgrade, v5.Upgrade, v7.Upgrade, v9.Upgrade, v11.Upgrade, v12.Upgrade, v13.Upgrade}
100+
Upgrades = []upgrades.Upgrade{v4.Upgrade, v5.Upgrade, v7.Upgrade, v9.Upgrade, v11.Upgrade, v12.Upgrade, v13.Upgrade, v14.Upgrade}
95101
Forks = []upgrades.Fork{v3.Fork, v6.Fork, v8.Fork, v10.Fork}
96102
)
97103

@@ -143,6 +149,16 @@ func init() {
143149
DefaultNodeHome = filepath.Join(userHomeDir, ".osmosisd")
144150
}
145151

152+
// initReusablePackageInjections injects data available within osmosis into the reusable packages.
153+
// This is done to ensure they can be built without depending on at compilation time and thus imported by other chains
154+
// This should always be called before any other function to avoid inconsistent data
155+
func initReusablePackageInjections() {
156+
// Inject ClawbackVestingAccount account type into osmoutils
157+
osmoutils.OsmoUtilsExtraAccountTypes = map[reflect.Type]struct{}{
158+
reflect.TypeOf(&vestingtypes.ClawbackVestingAccount{}): {},
159+
}
160+
}
161+
146162
// NewOsmosisApp returns a reference to an initialized Osmosis.
147163
func NewOsmosisApp(
148164
logger log.Logger,
@@ -157,6 +173,7 @@ func NewOsmosisApp(
157173
wasmOpts []wasm.Option,
158174
baseAppOptions ...func(*baseapp.BaseApp),
159175
) *OsmosisApp {
176+
initReusablePackageInjections() // This should run before anything else to make sure the variables are properly initialized
160177
encodingConfig := GetEncodingConfig()
161178
appCodec := encodingConfig.Marshaler
162179
cdc := encodingConfig.Amino

app/apptesting/test_suite.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ func (s *KeeperTestHelper) BuildTx(
364364
// StateNotAltered validates that app state is not altered. Fails if it is.
365365
func (s *KeeperTestHelper) StateNotAltered() {
366366
oldState := s.App.ExportState(s.Ctx)
367-
s.Commit()
367+
s.App.Commit()
368368
newState := s.App.ExportState(s.Ctx)
369369
s.Require().Equal(oldState, newState)
370370
}

app/keepers/keepers.go

Lines changed: 36 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -34,23 +34,27 @@ import (
3434
upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper"
3535
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
3636

37-
ibchooks "github.com/osmosis-labs/osmosis/v13/x/ibc-hooks"
37+
downtimedetector "github.com/osmosis-labs/osmosis/v13/x/downtime-detector"
38+
downtimetypes "github.com/osmosis-labs/osmosis/v13/x/downtime-detector/types"
3839
ibcratelimit "github.com/osmosis-labs/osmosis/v13/x/ibc-rate-limit"
3940
ibcratelimittypes "github.com/osmosis-labs/osmosis/v13/x/ibc-rate-limit/types"
40-
41-
icahost "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/host"
42-
icahostkeeper "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/host/keeper"
43-
icahosttypes "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/host/types"
44-
ibctransferkeeper "github.com/cosmos/ibc-go/v3/modules/apps/transfer/keeper"
45-
ibctransfertypes "github.com/cosmos/ibc-go/v3/modules/apps/transfer/types"
46-
ibcclient "github.com/cosmos/ibc-go/v3/modules/core/02-client"
47-
ibcclienttypes "github.com/cosmos/ibc-go/v3/modules/core/02-client/types"
48-
porttypes "github.com/cosmos/ibc-go/v3/modules/core/05-port/types"
49-
ibchost "github.com/cosmos/ibc-go/v3/modules/core/24-host"
50-
ibckeeper "github.com/cosmos/ibc-go/v3/modules/core/keeper"
41+
ibchooks "github.com/osmosis-labs/osmosis/x/ibc-hooks"
42+
ibchookskeeper "github.com/osmosis-labs/osmosis/x/ibc-hooks/keeper"
43+
ibchookstypes "github.com/osmosis-labs/osmosis/x/ibc-hooks/types"
44+
45+
icahost "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/host"
46+
icahostkeeper "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/host/keeper"
47+
icahosttypes "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/host/types"
48+
ibctransferkeeper "github.com/cosmos/ibc-go/v4/modules/apps/transfer/keeper"
49+
ibctransfertypes "github.com/cosmos/ibc-go/v4/modules/apps/transfer/types"
50+
ibcclient "github.com/cosmos/ibc-go/v4/modules/core/02-client"
51+
ibcclienttypes "github.com/cosmos/ibc-go/v4/modules/core/02-client/types"
52+
porttypes "github.com/cosmos/ibc-go/v4/modules/core/05-port/types"
53+
ibchost "github.com/cosmos/ibc-go/v4/modules/core/24-host"
54+
ibckeeper "github.com/cosmos/ibc-go/v4/modules/core/keeper"
5155

5256
// IBC Transfer: Defines the "transfer" IBC port
53-
transfer "github.com/cosmos/ibc-go/v3/modules/apps/transfer"
57+
transfer "github.com/cosmos/ibc-go/v4/modules/apps/transfer"
5458

5559
_ "github.com/osmosis-labs/osmosis/v13/client/docs/statik"
5660
owasm "github.com/osmosis-labs/osmosis/v13/wasmbinding"
@@ -99,8 +103,10 @@ type AppKeepers struct {
99103
AuthzKeeper *authzkeeper.Keeper
100104
StakingKeeper *stakingkeeper.Keeper
101105
DistrKeeper *distrkeeper.Keeper
106+
DowntimeKeeper *downtimedetector.Keeper
102107
SlashingKeeper *slashingkeeper.Keeper
103108
IBCKeeper *ibckeeper.Keeper
109+
IBCHooksKeeper *ibchookskeeper.Keeper
104110
ICAHostKeeper *icahostkeeper.Keeper
105111
TransferKeeper *ibctransferkeeper.Keeper
106112
EvidenceKeeper *evidencekeeper.Keeper
@@ -188,6 +194,10 @@ func (appKeepers *AppKeepers) InitNormalKeepers(
188194
)
189195
appKeepers.DistrKeeper = &distrKeeper
190196

197+
appKeepers.DowntimeKeeper = downtimedetector.NewKeeper(
198+
appKeepers.keys[downtimetypes.StoreKey],
199+
)
200+
191201
slashingKeeper := slashingkeeper.NewKeeper(
192202
appCodec,
193203
appKeepers.keys[slashingtypes.StoreKey],
@@ -206,7 +216,13 @@ func (appKeepers *AppKeepers) InitNormalKeepers(
206216
appKeepers.ScopedIBCKeeper,
207217
)
208218

209-
appKeepers.WireICS20PreWasmKeeper(appCodec, bApp)
219+
// Configure the hooks keeper
220+
hooksKeeper := ibchookskeeper.NewKeeper(
221+
appKeepers.keys[ibchookstypes.StoreKey],
222+
)
223+
appKeepers.IBCHooksKeeper = &hooksKeeper
224+
225+
appKeepers.WireICS20PreWasmKeeper(appCodec, bApp, appKeepers.IBCHooksKeeper)
210226

211227
icaHostKeeper := icahostkeeper.NewKeeper(
212228
appCodec, appKeepers.keys[icahosttypes.StoreKey],
@@ -349,7 +365,7 @@ func (appKeepers *AppKeepers) InitNormalKeepers(
349365
appKeepers.Ics20WasmHooks.ContractKeeper = appKeepers.ContractKeeper
350366

351367
// wire up x/wasm to IBC
352-
ibcRouter.AddRoute(wasm.ModuleName, wasm.NewIBCHandler(appKeepers.WasmKeeper, appKeepers.IBCKeeper.ChannelKeeper))
368+
ibcRouter.AddRoute(wasm.ModuleName, wasm.NewIBCHandler(appKeepers.WasmKeeper, appKeepers.IBCKeeper.ChannelKeeper, appKeepers.IBCKeeper.ChannelKeeper))
353369
appKeepers.IBCKeeper.SetRouter(ibcRouter)
354370

355371
// register the proposal types
@@ -387,9 +403,10 @@ func (appKeepers *AppKeepers) InitNormalKeepers(
387403
// appkeepers.WasmHooks AND appKeepers.RateLimitingICS4Wrapper
388404
func (appKeepers *AppKeepers) WireICS20PreWasmKeeper(
389405
appCodec codec.Codec,
390-
bApp *baseapp.BaseApp) {
406+
bApp *baseapp.BaseApp,
407+
hooksKeeper *ibchookskeeper.Keeper) {
391408
// Setup the ICS4Wrapper used by the hooks middleware
392-
wasmHooks := ibchooks.NewWasmHooks(nil) // The contract keeper needs to be set later
409+
wasmHooks := ibchooks.NewWasmHooks(hooksKeeper, nil) // The contract keeper needs to be set later
393410
appKeepers.Ics20WasmHooks = &wasmHooks
394411
appKeepers.HooksICS4Wrapper = ibchooks.NewICS4Middleware(
395412
appKeepers.IBCKeeper.ChannelKeeper,
@@ -572,6 +589,7 @@ func KVStoreKeys() []string {
572589
stakingtypes.StoreKey,
573590
minttypes.StoreKey,
574591
distrtypes.StoreKey,
592+
downtimetypes.StoreKey,
575593
slashingtypes.StoreKey,
576594
govtypes.StoreKey,
577595
paramstypes.StoreKey,
@@ -592,5 +610,6 @@ func KVStoreKeys() []string {
592610
superfluidtypes.StoreKey,
593611
wasm.StoreKey,
594612
tokenfactorytypes.StoreKey,
613+
ibchookstypes.StoreKey,
595614
}
596615
}

0 commit comments

Comments
 (0)