Skip to content

Commit

Permalink
feat: separate custom features in x/wasm into x/wasmplus module (#7)
Browse files Browse the repository at this point in the history
* featremove custom proto changes of genesis and types

* feat!: extract custom wasm logic for lbm-sdk

* feat: move custom cli of lbm-sdk to `wasmplus` client package

* feat: remove params for wasmplus. just use original params of x/wasm

* chore: remove unused customEncoding and customQuerier

* chore: apply a changes about separated ibc-go import path

* doc: add readme of `x/wasmplus`

* fix: lint error

* chore: add more unittest

* chore: add more unittest

* chore: add more unittest

* chore: add more unittest

* chore: update changelog

* chore: remove interchain-accounts

* chore: feedback reviews

* doc: update proto changes

* chore: apply review feedback
 - move all function of `wasmplus/keeper/keeper_extension.go` to `wasmplus/keeper/keeper.go`
 - remove no need files (keeper_extension.go, metrics.go)
  • Loading branch information
zemyblue authored Feb 6, 2023
1 parent 51dd725 commit 60fec8a
Show file tree
Hide file tree
Showing 137 changed files with 8,055 additions and 2,594 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Improvements
* [\#1](https://github.com/line/wasmd/pull/1) apply all changes of `x/wasm` in lbm-sdk until [lbm-sdk@3bdcb6ffe01c81615bedb777ca0e039cc46ef00c](https://github.com/line/lbm-sdk/tree/3bdcb6ffe01c81615bedb777ca0e039cc46ef00c)
* [\#5](https://github.com/line/wasmd/pull/5) bump up wasmd v0.29.1
* [\#7](https://github.com/line/wasmd/pull/7) separate custom features in `x/wasm` into `x/wasmplus` module

### Bug Fixes

Expand Down
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ build: go.sum
ifeq ($(OS),Windows_NT)
exit 1
else
go build -mod=readonly $(BUILD_FLAGS) -o build/wasmd ./cmd/wasmd
go build -mod=readonly $(BUILD_FLAGS) -o build/wasmd ./cmd/wasmplusd
endif

build-contract-tests-hooks:
Expand All @@ -93,7 +93,8 @@ else
endif

install: go.sum
go install -mod=readonly $(BUILD_FLAGS) ./cmd/wasmd
go install -mod=readonly $(BUILD_FLAGS) ./cmd/wasmplusd
mv $(BINDIR)/wasmplusd $(BINDIR)/wasmd

########################################
### Tools & dependencies
Expand Down
29 changes: 5 additions & 24 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"path/filepath"
"strings"

intertxtypes "github.com/cosmos/interchain-accounts/x/inter-tx/types"
"github.com/gorilla/mux"
"github.com/rakyll/statik/fs"
"github.com/spf13/cast"
Expand Down Expand Up @@ -203,7 +202,6 @@ var (
vesting.AppModuleBasic{},
wasm.AppModuleBasic{},
ica.AppModuleBasic{},
// intertx.AppModuleBasic{}, // TODO support later
)

// module account permissions
Expand Down Expand Up @@ -262,16 +260,14 @@ type WasmApp struct {
IBCKeeper *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly
ICAControllerKeeper icacontrollerkeeper.Keeper
ICAHostKeeper icahostkeeper.Keeper
// InterTxKeeper intertxkeeper.Keeper // TODO support later
TransferKeeper ibctransferkeeper.Keeper
FeeGrantKeeper feegrantkeeper.Keeper
AuthzKeeper authzkeeper.Keeper
WasmKeeper wasm.Keeper
TransferKeeper ibctransferkeeper.Keeper
FeeGrantKeeper feegrantkeeper.Keeper
AuthzKeeper authzkeeper.Keeper
WasmKeeper wasm.Keeper

ScopedIBCKeeper capabilitykeeper.ScopedKeeper
ScopedICAHostKeeper capabilitykeeper.ScopedKeeper
ScopedICAControllerKeeper capabilitykeeper.ScopedKeeper
ScopedInterTxKeeper capabilitykeeper.ScopedKeeper
ScopedTransferKeeper capabilitykeeper.ScopedKeeper
ScopedWasmKeeper capabilitykeeper.ScopedKeeper

Expand Down Expand Up @@ -316,7 +312,7 @@ func NewWasmApp(
minttypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey,
govtypes.StoreKey, paramstypes.StoreKey, ibchost.StoreKey, upgradetypes.StoreKey,
evidencetypes.StoreKey, ibctransfertypes.StoreKey, capabilitytypes.StoreKey,
feegrant.StoreKey, authzkeeper.StoreKey, wasm.StoreKey, icahosttypes.StoreKey, icacontrollertypes.StoreKey, intertxtypes.StoreKey,
feegrant.StoreKey, authzkeeper.StoreKey, wasm.StoreKey, icahosttypes.StoreKey, icacontrollertypes.StoreKey,
)
tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey)
memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey)
Expand Down Expand Up @@ -351,7 +347,6 @@ func NewWasmApp(
scopedIBCKeeper := app.CapabilityKeeper.ScopeToModule(ibchost.ModuleName)
scopedICAHostKeeper := app.CapabilityKeeper.ScopeToModule(icahosttypes.SubModuleName)
scopedICAControllerKeeper := app.CapabilityKeeper.ScopeToModule(icacontrollertypes.SubModuleName)
scopedInterTxKeeper := app.CapabilityKeeper.ScopeToModule(intertxtypes.ModuleName)
scopedTransferKeeper := app.CapabilityKeeper.ScopeToModule(ibctransfertypes.ModuleName)
scopedWasmKeeper := app.CapabilityKeeper.ScopeToModule(wasm.ModuleName)
app.CapabilityKeeper.Seal()
Expand Down Expand Up @@ -489,15 +484,6 @@ func NewWasmApp(
icaModule := ica.NewAppModule(&app.ICAControllerKeeper, &app.ICAHostKeeper)
icaHostIBCModule := icahost.NewIBCModule(app.ICAHostKeeper)

// For wasmd we use the demo controller from https://github.com/cosmos/interchain-accounts but see notes below
// app.InterTxKeeper = intertxkeeper.NewKeeper(appCodec, keys[intertxtypes.StoreKey], app.ICAControllerKeeper, scopedInterTxKeeper)
// Note: please do your research before using this in production app, this is a demo and not an officially
// supported IBC team implementation. Do your own research before using it.
// interTxModule := intertx.NewAppModule(appCodec, app.InterTxKeeper)
// interTxIBCModule := intertx.NewIBCModule(app.InterTxKeeper)
// You will likely want to swap out the second argument with your own reviewed and maintained ica auth module
// icaControllerIBCModule := icacontroller.NewIBCModule(app.ICAControllerKeeper, interTxIBCModule)

// create evidence keeper with router
evidenceKeeper := evidencekeeper.NewKeeper(
appCodec,
Expand Down Expand Up @@ -533,8 +519,6 @@ func NewWasmApp(
wasmDir,
wasmConfig,
availableCapabilities,
nil,
nil,
wasmOpts...,
)

Expand Down Expand Up @@ -595,7 +579,6 @@ func NewWasmApp(
params.NewAppModule(app.ParamsKeeper),
transferModule,
icaModule,
// interTxModule,
crisis.NewAppModule(&app.CrisisKeeper, skipGenesisInvariants), // always be last to make sure that it checks for all invariants and not only part of them
)

Expand Down Expand Up @@ -681,7 +664,6 @@ func NewWasmApp(
ibctransfertypes.ModuleName,
ibchost.ModuleName,
icatypes.ModuleName,
// intertxtypes.ModuleName,
// wasm after ibc transfer
wasm.ModuleName,
)
Expand Down Expand Up @@ -763,7 +745,6 @@ func NewWasmApp(
app.ScopedWasmKeeper = scopedWasmKeeper
app.ScopedICAHostKeeper = scopedICAHostKeeper
app.ScopedICAControllerKeeper = scopedICAControllerKeeper
app.ScopedInterTxKeeper = scopedInterTxKeeper

if loadLatest {
if err := app.LoadLatestVersion(); err != nil {
Expand Down
Loading

0 comments on commit 60fec8a

Please sign in to comment.