Skip to content

Commit

Permalink
chore: osmoutils, twap, downtime-detector, ibc-hooks cherry-pick to v…
Browse files Browse the repository at this point in the history
…14 (#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 <[email protected]>

* 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 <[email protected]>

* Update tests/e2e/configurer/chain/queries.go

Co-authored-by: Adam Tucker <[email protected]>

* Update tests/e2e/e2e_test.go

Co-authored-by: Adam Tucker <[email protected]>

* Update tests/e2e/e2e_test.go

Co-authored-by: Adam Tucker <[email protected]>

* Update tests/e2e/e2e_test.go

Co-authored-by: Adam Tucker <[email protected]>

* Update tests/e2e/e2e_test.go

Co-authored-by: Adam Tucker <[email protected]>

Co-authored-by: Roman <[email protected]>
Co-authored-by: Roman <[email protected]>
Co-authored-by: Adam Tucker <[email protected]>

* 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 <[email protected]>

* Apply adam suggestion for having a `-`

* move genesis test to own file

Co-authored-by: Adam Tucker <[email protected]>

* 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 <[email protected]>
Co-authored-by: Roman <[email protected]>
Co-authored-by: Dev Ojha <[email protected]>
Co-authored-by: Hieu Vu <[email protected]>
Co-authored-by: Roman <[email protected]>
Co-authored-by: Supanat <[email protected]>
Co-authored-by: Dev Ojha <[email protected]>
Co-authored-by: Sishir Giri <[email protected]>
Co-authored-by: Ruslan Akhtariev <[email protected]>
Co-authored-by: mattverse <[email protected]>
Co-authored-by: ByeongSu Hong <[email protected]>
  • Loading branch information
12 people authored Jan 5, 2023
1 parent 40e5320 commit 961738a
Show file tree
Hide file tree
Showing 139 changed files with 10,602 additions and 1,225 deletions.
42 changes: 20 additions & 22 deletions .github/workflows/contracts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
contract: [{workdir: ./x/ibc-rate-limit/, output: bytecode/rate_limiter.wasm, build: artifacts/rate_limiter-x86_64.wasm, name: rate_limiter}]
contract: [{workdir: ./x/ibc-rate-limit/, output: bytecode/rate_limiter.wasm, build: artifacts/rate_limiter.wasm, name: rate_limiter}]

steps:
- name: Checkout sources
Expand Down Expand Up @@ -45,30 +45,13 @@ jobs:
cargo test
if: env.GIT_DIFF

- name: Set latest cw-optimizoor version
run: >
echo "CW_OPTIMIZOOR_VERSION=0.8.0" >> $GITHUB_ENV
- name: Cache cw-optimizoor
id: cache-cw-optimizoor
uses: actions/cache@v3
env:
cache-name: cache-cw-optimizoor
with:
# cargo bin files are stored in `~/.cargo/bin/` on Linux/macOS
path: ~/.cargo/bin/cargo-cw-optimizoor
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.CW_OPTIMIZOOR_VERSION }}

- if: ${{ steps.cache-cw-optimizoor.outputs.cache-hit != 'true' }}
name: Install cw-optimizoor
continue-on-error: true
run: >
cargo install cw-optimizoor
- name: Optimize
working-directory: ${{ matrix.contract.workdir }}
run: >
cargo cw-optimizoor
docker run --rm -v "$(pwd)":/code \
--mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target \
--mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
cosmwasm/workspace-optimizer:0.12.10
if: env.GIT_DIFF

- name: 'Upload optimized contract artifact'
Expand All @@ -79,6 +62,21 @@ jobs:
retention-days: 1
if: env.GIT_DIFF

- name: 'Upload Cargo.lock artifact'
uses: actions/upload-artifact@v3
with:
name: Cargo.lock
path: ${{ matrix.contract.workdir }}Cargo.lock
retention-days: 1
if: env.GIT_DIFF

- name: 'Upload Cargo.lock artifact'
uses: actions/upload-artifact@v3
with:
name: Cargo.lock
path: ${{ matrix.contract.workdir }}Cargo.lock
retention-days: 1

- name: Check Test Data
working-directory: ${{ matrix.contract.workdir }}
if: env.GIT_DIFF
Expand Down
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -216,10 +216,6 @@ target/
# Generated by rust-optimizer
artifacts/

# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Cargo.lock

# These are backup files generated by rustfmt
**/*.rs.bk
# Don't commit lock files for test utils
Expand Down
64 changes: 27 additions & 37 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,54 +42,44 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

### Misc Improvements

* [#3677](https://github.com/osmosis-labs/osmosis/pull/3677) Add methods for cloning and mutative multiplication on osmomath.BigDec.
* [#3676](https://github.com/osmosis-labs/osmosis/pull/3676) implement `PowerInteger` function on `osmomath.BigDec`
* [#3678](https://github.com/osmosis-labs/osmosis/pull/3678) implement mutative `PowerIntegerMut` function on `osmomath.BigDec`.

### Features

### Bug fixes
* [#3731](https://github.com/osmosis-labs/osmosis/pull/3731) BigDec Power functions with decimal exponent.
* [#3817](https://github.com/osmosis-labs/osmosis/pull/3817) Move osmoassert from `app/apptesting/osmoassert` to `osmoutils/osmoassert`.

## v13.1.2
### API breaks

### Bug fixes

* Fix state export
* Update swagger files for v13

## v13.1.1

* Add a check in the makefile for using go v1.18

## v13.1.0

* Correctly apply DragonBerry IBC patch

### API breaks

* [#3763](https://github.com/osmosis-labs/osmosis/pull/3763) Move binary search and error tolerance code from `osmoutils` into `osmomath`
* [#3817](https://github.com/osmosis-labs/osmosis/pull/3817) Move osmoassert from `app/apptesting/osmoassert` to `osmoutils/osmoassert`.
* [#3771](https://github.com/osmosis-labs/osmosis/pull/3771) Move osmomath into its own go.mod
* [#3827](https://github.com/osmosis-labs/osmosis/pull/3827) Move osmoutils into its own go.mod
### Misc Improvements

* [#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
* [#3634](https://github.com/osmosis-labs/osmosis/pull/3634) (Makefile) Ensure correct golang version in make build and make install. (Thank you @jhernandezb )
* [#3712](https://github.com/osmosis-labs/osmosis/pull/3712) replace `osmomath.BigDec` `Power` with `PowerInteger`
* [#3711](https://github.com/osmosis-labs/osmosis/pull/3711) Use Dec instead of Int for additive `ErrTolerace` in `osmoutils`.

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

### Bug fixes

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

### Misc Improvements

* [#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
* [#3634](https://github.com/osmosis-labs/osmosis/pull/3634) (Makefile) Ensure correct golang version in make build and make install. (Thank you @jhernandezb )
<<<<<<< HEAD
* [#3712](https://github.com/osmosis-labs/osmosis/pull/3712) replace `osmomath.BigDec` `Power` with `PowerInteger`

=======
* [#3711](https://github.com/osmosis-labs/osmosis/pull/3711) Use Dec instead of Int for additive `ErrTolerace` in `osmoutils`.
>>>>>>> 5ab7ebf6 (refactor(osmoutils): use Dec for additive tolerance instead of Int (#3711))
* [#3678](https://github.com/osmosis-labs/osmosis/pull/3678) Add methods for cloning and mutative multiplication on osmomath.BigDec.
* [#3899](https://github.com/osmosis-labs/osmosis/pull/3899) Fixed osmoutils so its importable by chains that don't use the osmosis CosmosSDK fork
* [#3676](https://github.com/osmosis-labs/osmosis/pull/3676) Implement `PowerInteger` function on `osmomath.BigDec`
* [#3678](https://github.com/osmosis-labs/osmosis/pull/3678) Implement mutative `PowerIntegerMut` function on `osmomath.BigDec`.
* [#3708](https://github.com/osmosis-labs/osmosis/pull/3708) `Exp2` function to compute 2^decimal.
* [#3763](https://github.com/osmosis-labs/osmosis/pull/3763) Move binary search and error tolerance code from `osmoutils` into `osmomath`
* [#3771](https://github.com/osmosis-labs/osmosis/pull/3771) Move osmomath into its own go.mod
* [#3827](https://github.com/osmosis-labs/osmosis/pull/3827) Move osmoutils into its own go.mod

## v13.0.0

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ SDK_PACK := $(shell go list -m github.com/cosmos/cosmos-sdk | sed 's/ /\@/g')
GO_VERSION := $(shell cat go.mod | grep -E 'go [0-9].[0-9]+' | cut -d ' ' -f 2)
DOCKER := $(shell which docker)
BUILDDIR ?= $(CURDIR)/build
E2E_UPGRADE_VERSION := "v13"
E2E_UPGRADE_VERSION := "v14"


GO_MAJOR_VERSION = $(shell go version | cut -c 14- | cut -d' ' -f1 | cut -d'.' -f1)
Expand Down
4 changes: 2 additions & 2 deletions app/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package app
import (
wasm "github.com/CosmWasm/wasmd/x/wasm"
wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
ibcante "github.com/cosmos/ibc-go/v3/modules/core/ante"
ibckeeper "github.com/cosmos/ibc-go/v3/modules/core/keeper"
ibcante "github.com/cosmos/ibc-go/v4/modules/core/ante"
ibckeeper "github.com/cosmos/ibc-go/v4/modules/core/keeper"

servertypes "github.com/cosmos/cosmos-sdk/server/types"
sdk "github.com/cosmos/cosmos-sdk/types"
Expand Down
21 changes: 19 additions & 2 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,13 @@ import (
"net/http"
"os"
"path/filepath"
"reflect"
"strings"

vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types"

"github.com/osmosis-labs/osmosis/osmoutils"

"github.com/CosmWasm/wasmd/x/wasm"
"github.com/gorilla/mux"
"github.com/rakyll/statik/fs"
Expand Down Expand Up @@ -45,6 +50,7 @@ import (
v11 "github.com/osmosis-labs/osmosis/v13/app/upgrades/v11"
v12 "github.com/osmosis-labs/osmosis/v13/app/upgrades/v12"
v13 "github.com/osmosis-labs/osmosis/v13/app/upgrades/v13"
v14 "github.com/osmosis-labs/osmosis/v13/app/upgrades/v14"
v3 "github.com/osmosis-labs/osmosis/v13/app/upgrades/v3"
v4 "github.com/osmosis-labs/osmosis/v13/app/upgrades/v4"
v5 "github.com/osmosis-labs/osmosis/v13/app/upgrades/v5"
Expand All @@ -53,7 +59,7 @@ import (
v8 "github.com/osmosis-labs/osmosis/v13/app/upgrades/v8"
v9 "github.com/osmosis-labs/osmosis/v13/app/upgrades/v9"
_ "github.com/osmosis-labs/osmosis/v13/client/docs/statik"
ibc_hooks "github.com/osmosis-labs/osmosis/v13/x/ibc-hooks"
ibc_hooks "github.com/osmosis-labs/osmosis/x/ibc-hooks"
)

const appName = "OsmosisApp"
Expand Down Expand Up @@ -91,7 +97,7 @@ var (

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

Upgrades = []upgrades.Upgrade{v4.Upgrade, v5.Upgrade, v7.Upgrade, v9.Upgrade, v11.Upgrade, v12.Upgrade, v13.Upgrade}
Upgrades = []upgrades.Upgrade{v4.Upgrade, v5.Upgrade, v7.Upgrade, v9.Upgrade, v11.Upgrade, v12.Upgrade, v13.Upgrade, v14.Upgrade}
Forks = []upgrades.Fork{v3.Fork, v6.Fork, v8.Fork, v10.Fork}
)

Expand Down Expand Up @@ -143,6 +149,16 @@ func init() {
DefaultNodeHome = filepath.Join(userHomeDir, ".osmosisd")
}

// initReusablePackageInjections injects data available within osmosis into the reusable packages.
// This is done to ensure they can be built without depending on at compilation time and thus imported by other chains
// This should always be called before any other function to avoid inconsistent data
func initReusablePackageInjections() {
// Inject ClawbackVestingAccount account type into osmoutils
osmoutils.OsmoUtilsExtraAccountTypes = map[reflect.Type]struct{}{
reflect.TypeOf(&vestingtypes.ClawbackVestingAccount{}): {},
}
}

// NewOsmosisApp returns a reference to an initialized Osmosis.
func NewOsmosisApp(
logger log.Logger,
Expand All @@ -157,6 +173,7 @@ func NewOsmosisApp(
wasmOpts []wasm.Option,
baseAppOptions ...func(*baseapp.BaseApp),
) *OsmosisApp {
initReusablePackageInjections() // This should run before anything else to make sure the variables are properly initialized
encodingConfig := GetEncodingConfig()
appCodec := encodingConfig.Marshaler
cdc := encodingConfig.Amino
Expand Down
2 changes: 1 addition & 1 deletion app/apptesting/test_suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ func (s *KeeperTestHelper) BuildTx(
// StateNotAltered validates that app state is not altered. Fails if it is.
func (s *KeeperTestHelper) StateNotAltered() {
oldState := s.App.ExportState(s.Ctx)
s.Commit()
s.App.Commit()
newState := s.App.ExportState(s.Ctx)
s.Require().Equal(oldState, newState)
}
Expand Down
53 changes: 36 additions & 17 deletions app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,27 @@ import (
upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"

ibchooks "github.com/osmosis-labs/osmosis/v13/x/ibc-hooks"
downtimedetector "github.com/osmosis-labs/osmosis/v13/x/downtime-detector"
downtimetypes "github.com/osmosis-labs/osmosis/v13/x/downtime-detector/types"
ibcratelimit "github.com/osmosis-labs/osmosis/v13/x/ibc-rate-limit"
ibcratelimittypes "github.com/osmosis-labs/osmosis/v13/x/ibc-rate-limit/types"

icahost "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/host"
icahostkeeper "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/host/keeper"
icahosttypes "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/host/types"
ibctransferkeeper "github.com/cosmos/ibc-go/v3/modules/apps/transfer/keeper"
ibctransfertypes "github.com/cosmos/ibc-go/v3/modules/apps/transfer/types"
ibcclient "github.com/cosmos/ibc-go/v3/modules/core/02-client"
ibcclienttypes "github.com/cosmos/ibc-go/v3/modules/core/02-client/types"
porttypes "github.com/cosmos/ibc-go/v3/modules/core/05-port/types"
ibchost "github.com/cosmos/ibc-go/v3/modules/core/24-host"
ibckeeper "github.com/cosmos/ibc-go/v3/modules/core/keeper"
ibchooks "github.com/osmosis-labs/osmosis/x/ibc-hooks"
ibchookskeeper "github.com/osmosis-labs/osmosis/x/ibc-hooks/keeper"
ibchookstypes "github.com/osmosis-labs/osmosis/x/ibc-hooks/types"

icahost "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/host"
icahostkeeper "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/host/keeper"
icahosttypes "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/host/types"
ibctransferkeeper "github.com/cosmos/ibc-go/v4/modules/apps/transfer/keeper"
ibctransfertypes "github.com/cosmos/ibc-go/v4/modules/apps/transfer/types"
ibcclient "github.com/cosmos/ibc-go/v4/modules/core/02-client"
ibcclienttypes "github.com/cosmos/ibc-go/v4/modules/core/02-client/types"
porttypes "github.com/cosmos/ibc-go/v4/modules/core/05-port/types"
ibchost "github.com/cosmos/ibc-go/v4/modules/core/24-host"
ibckeeper "github.com/cosmos/ibc-go/v4/modules/core/keeper"

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

_ "github.com/osmosis-labs/osmosis/v13/client/docs/statik"
owasm "github.com/osmosis-labs/osmosis/v13/wasmbinding"
Expand Down Expand Up @@ -99,8 +103,10 @@ type AppKeepers struct {
AuthzKeeper *authzkeeper.Keeper
StakingKeeper *stakingkeeper.Keeper
DistrKeeper *distrkeeper.Keeper
DowntimeKeeper *downtimedetector.Keeper
SlashingKeeper *slashingkeeper.Keeper
IBCKeeper *ibckeeper.Keeper
IBCHooksKeeper *ibchookskeeper.Keeper
ICAHostKeeper *icahostkeeper.Keeper
TransferKeeper *ibctransferkeeper.Keeper
EvidenceKeeper *evidencekeeper.Keeper
Expand Down Expand Up @@ -188,6 +194,10 @@ func (appKeepers *AppKeepers) InitNormalKeepers(
)
appKeepers.DistrKeeper = &distrKeeper

appKeepers.DowntimeKeeper = downtimedetector.NewKeeper(
appKeepers.keys[downtimetypes.StoreKey],
)

slashingKeeper := slashingkeeper.NewKeeper(
appCodec,
appKeepers.keys[slashingtypes.StoreKey],
Expand All @@ -206,7 +216,13 @@ func (appKeepers *AppKeepers) InitNormalKeepers(
appKeepers.ScopedIBCKeeper,
)

appKeepers.WireICS20PreWasmKeeper(appCodec, bApp)
// Configure the hooks keeper
hooksKeeper := ibchookskeeper.NewKeeper(
appKeepers.keys[ibchookstypes.StoreKey],
)
appKeepers.IBCHooksKeeper = &hooksKeeper

appKeepers.WireICS20PreWasmKeeper(appCodec, bApp, appKeepers.IBCHooksKeeper)

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

// wire up x/wasm to IBC
ibcRouter.AddRoute(wasm.ModuleName, wasm.NewIBCHandler(appKeepers.WasmKeeper, appKeepers.IBCKeeper.ChannelKeeper))
ibcRouter.AddRoute(wasm.ModuleName, wasm.NewIBCHandler(appKeepers.WasmKeeper, appKeepers.IBCKeeper.ChannelKeeper, appKeepers.IBCKeeper.ChannelKeeper))
appKeepers.IBCKeeper.SetRouter(ibcRouter)

// register the proposal types
Expand Down Expand Up @@ -387,9 +403,10 @@ func (appKeepers *AppKeepers) InitNormalKeepers(
// appkeepers.WasmHooks AND appKeepers.RateLimitingICS4Wrapper
func (appKeepers *AppKeepers) WireICS20PreWasmKeeper(
appCodec codec.Codec,
bApp *baseapp.BaseApp) {
bApp *baseapp.BaseApp,
hooksKeeper *ibchookskeeper.Keeper) {
// Setup the ICS4Wrapper used by the hooks middleware
wasmHooks := ibchooks.NewWasmHooks(nil) // The contract keeper needs to be set later
wasmHooks := ibchooks.NewWasmHooks(hooksKeeper, nil) // The contract keeper needs to be set later
appKeepers.Ics20WasmHooks = &wasmHooks
appKeepers.HooksICS4Wrapper = ibchooks.NewICS4Middleware(
appKeepers.IBCKeeper.ChannelKeeper,
Expand Down Expand Up @@ -572,6 +589,7 @@ func KVStoreKeys() []string {
stakingtypes.StoreKey,
minttypes.StoreKey,
distrtypes.StoreKey,
downtimetypes.StoreKey,
slashingtypes.StoreKey,
govtypes.StoreKey,
paramstypes.StoreKey,
Expand All @@ -592,5 +610,6 @@ func KVStoreKeys() []string {
superfluidtypes.StoreKey,
wasm.StoreKey,
tokenfactorytypes.StoreKey,
ibchookstypes.StoreKey,
}
}
Loading

0 comments on commit 961738a

Please sign in to comment.