Skip to content

Commit

Permalink
chore: ibc v6 and remove cosmwasm (#1421)
Browse files Browse the repository at this point in the history
* update to ibc v6

* update to ibc v6

* fix test and bump pfm v6

* remove wasmd and cosmwasm and delete store key

* add deployment

* feat: make dust threshold configurable per chain (#1256)

* feat: add dust threshold into zone

* refactor: change hardcode into config

* refactor: add dust threshold into proposals struct

* test: update test

* feat: add v1_6 upgrades logic

* linting

* threshold upgradable per chain

* Update app/upgrades/v1_6.go

* rebase main

* change dust threshold data type

* fix lint

---------

Co-authored-by: Jacob Gadikian <[email protected]>

* update to ibc v6

* fix test and bump pfm v6

* remove wasmd and cosmwasm and delete store key

* add deployment

* bump ibc v6 for iqc-relayer

* test: add GetScopedICAControllerKeeper

* update test

* fix capability err

* linting

* deps(icq-relayer): update import path

* add store upgrade for removing cosmwasm

* go mod tidy for icq-relayer

* re-enable make-proto and run proto-gen

---------

Co-authored-by: minhngoc274 <[email protected]>
Co-authored-by: Duong Minh Ngoc <[email protected]>
Co-authored-by: Khanh Hoa <[email protected]>
Co-authored-by: Tuan Tran <[email protected]>
Co-authored-by: Joe Bowman <[email protected]>
  • Loading branch information
6 people authored Apr 25, 2024
1 parent f7cef8f commit 1ad8d51
Show file tree
Hide file tree
Showing 79 changed files with 346 additions and 2,193 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ mdlint-fix:
### Protobuf ###
###############################################################################

BUF_VERSION=1.21.0
BUF_VERSION=1.30.1

proto-all: proto-gen

Expand Down
11 changes: 2 additions & 9 deletions app/ante.go
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
package app

import (
wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"

sdkioerrors "cosmossdk.io/errors"

storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/x/auth/ante"

ibcante "github.com/cosmos/ibc-go/v5/modules/core/ante"
ibckeeper "github.com/cosmos/ibc-go/v5/modules/core/keeper"
ibcante "github.com/cosmos/ibc-go/v6/modules/core/ante"
ibckeeper "github.com/cosmos/ibc-go/v6/modules/core/keeper"
)

// HandlerOptions extend the SDK's AnteHandler options by requiring the IBC
Expand All @@ -21,7 +18,6 @@ type HandlerOptions struct {
ante.HandlerOptions

TxCounterStoreKey storetypes.StoreKey
WasmConfig wasmtypes.WasmConfig

IBCKeeper *ibckeeper.Keeper
}
Expand All @@ -44,9 +40,6 @@ func NewAnteHandler(options HandlerOptions) sdk.AnteHandler {

anteDecorators := []sdk.AnteDecorator{
ante.NewSetUpContextDecorator(),
wasmkeeper.NewLimitSimulationGasDecorator(options.WasmConfig.SimulationGasLimit),
wasmkeeper.NewCountTXDecorator(options.TxCounterStoreKey),

ante.NewExtensionOptionsDecorator(options.ExtensionOptionChecker),
// ante.NewMempoolFeeDecorator(),
ante.NewValidateBasicDecorator(),
Expand Down
67 changes: 8 additions & 59 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@ import (
"net/http"
"os"
"path/filepath"
"strings"

"github.com/CosmWasm/wasmd/x/wasm"
wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
"github.com/prometheus/client_golang/prometheus"
"github.com/spf13/cast"
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/libs/log"
Expand All @@ -38,8 +34,8 @@ import (
distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
paramstypes "github.com/cosmos/cosmos-sdk/x/params/types"

ibckeeper "github.com/cosmos/ibc-go/v5/modules/core/keeper"
ibctestingtypes "github.com/cosmos/ibc-go/v5/testing/types"
ibckeeper "github.com/cosmos/ibc-go/v6/modules/core/keeper"
ibctestingtypes "github.com/cosmos/ibc-go/v6/testing/types"

"github.com/quicksilver-zone/quicksilver/app/keepers"
"github.com/quicksilver-zone/quicksilver/docs"
Expand Down Expand Up @@ -111,9 +107,7 @@ func NewQuicksilver(
homePath string,
invCheckPeriod uint,
encodingConfig EncodingConfig,
enabledProposals []wasm.ProposalType,
appOpts servertypes.AppOptions,
wasmOpts []wasm.Option,
mock bool,
enableSupplyEndpoint bool,
baseAppOptions ...func(*baseapp.BaseApp),
Expand Down Expand Up @@ -142,12 +136,6 @@ func NewQuicksilver(
invCheckPeriod: invCheckPeriod,
}

wasmDir := filepath.Join(homePath, "data")
wasmConfig, err := wasm.ReadWasmConfig(appOpts)
if err != nil {
panic("error while reading wasm config: " + err.Error())
}

app.AppKeepers = keepers.NewAppKeepers(
appCodec,
bApp,
Expand All @@ -159,10 +147,6 @@ func NewQuicksilver(
homePath,
invCheckPeriod,
appOpts,
wasmDir,
wasmConfig,
enabledProposals,
wasmOpts,
enableSupplyEndpoint,
)

Expand Down Expand Up @@ -206,9 +190,7 @@ func NewQuicksilver(
SignModeHandler: encodingConfig.TxConfig.SignModeHandler(),
SigGasConsumer: ante.DefaultSigVerificationGasConsumer,
},
WasmConfig: wasmConfig,
TxCounterStoreKey: app.GetKey(wasm.StoreKey),
IBCKeeper: app.IBCKeeper,
IBCKeeper: app.IBCKeeper,
}

app.SetInitChainer(app.InitChainer)
Expand Down Expand Up @@ -398,6 +380,11 @@ func (app *Quicksilver) GetScopedIBCKeeper() capabilitykeeper.ScopedKeeper {
return app.ScopedIBCKeeper
}

// GetScopedIBCKeeper implements the TestingApp interface.
func (app *Quicksilver) GetScopedICAControllerKeeper() capabilitykeeper.ScopedKeeper {
return app.ScopedICAControllerKeeper
}

// GetTxConfig implements the TestingApp interface.
func (*Quicksilver) GetTxConfig() client.TxConfig {
cfg := MakeEncodingConfig()
Expand All @@ -413,41 +400,3 @@ func GetMaccPerms() map[string][]string {

return dupMaccPerms
}

func GetWasmOpts(appOpts servertypes.AppOptions) []wasm.Option {
var wasmOpts []wasm.Option
if cast.ToBool(appOpts.Get("telemetry.enabled")) {
wasmOpts = append(wasmOpts, wasmkeeper.WithVMCacheMetrics(prometheus.DefaultRegisterer))
}

wasmOpts = append(wasmOpts, wasmkeeper.WithGasRegister(NewWasmGasRegister()))

return wasmOpts
}

// PROPOSALS

const (
ProposalsEnabled = "true"
// If set to non-empty string it must be comma-separated list of values that are all a subset
// of "EnableAllProposals" (takes precedence over ProposalsEnabled)
// https://github.com/CosmWasm/wasmd/blob/02a54d33ff2c064f3539ae12d75d027d9c665f05/x/wasm/internal/types/proposal.go#L28-L34
EnableSpecificProposals = ""
)

// GetEnabledProposals parses the ProposalsEnabled / EnableSpecificProposals values to
// produce a list of enabled proposals to pass into wasmd app.
func GetEnabledProposals() []wasm.ProposalType {
if EnableSpecificProposals == "" {
if ProposalsEnabled == "true" {
return wasm.EnableAllProposals
}
return wasm.DisableAllProposals
}
chunks := strings.Split(EnableSpecificProposals, ",")
proposals, err := wasm.ConvertToProposals(chunks)
if err != nil {
panic(err)
}
return proposals
}
5 changes: 0 additions & 5 deletions app/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"os"
"testing"

"github.com/CosmWasm/wasmd/x/wasm"
"github.com/stretchr/testify/require"
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/crypto/secp256k1"
Expand Down Expand Up @@ -52,9 +51,7 @@ func TestQuicksilverExport(t *testing.T) {
app.DefaultNodeHome,
0,
app.MakeEncodingConfig(),
wasm.EnableAllProposals,
app.EmptyAppOptions{},
app.GetWasmOpts(app.EmptyAppOptions{}),
false,
false,
)
Expand Down Expand Up @@ -84,9 +81,7 @@ func TestQuicksilverExport(t *testing.T) {
app.DefaultNodeHome,
0,
app.MakeEncodingConfig(),
wasm.EnableAllProposals,
app.EmptyAppOptions{},
app.GetWasmOpts(app.EmptyAppOptions{}),
false,
false,
)
Expand Down
3 changes: 0 additions & 3 deletions app/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"fmt"
"time"

"github.com/CosmWasm/wasmd/x/wasm"
dbm "github.com/tendermint/tm-db"

"github.com/cosmos/cosmos-sdk/baseapp"
Expand Down Expand Up @@ -55,9 +54,7 @@ func NewAppConstructor(encCfg EncodingConfig) network.AppConstructor {
DefaultNodeHome,
0,
encCfg,
wasm.EnableAllProposals,
EmptyAppOptions{},
GetWasmOpts(EmptyAppOptions{}),
false,
false,
baseapp.SetPruning(purningtypes.NewPruningOptionsFromString(val.AppConfig.Pruning)),
Expand Down
15 changes: 1 addition & 14 deletions app/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ package app

import (
"encoding/json"

"github.com/CosmWasm/wasmd/x/wasm"
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
)

// The GenesisState of the blockchain is represented here as a map of raw json
Expand All @@ -19,15 +16,5 @@ type GenesisState map[string]json.RawMessage
// NewDefaultGenesisState generates the default state for the application.
func NewDefaultGenesisState() GenesisState {
encCfg := MakeEncodingConfig()
gen := ModuleBasics.DefaultGenesis(encCfg.Marshaler)

// here we override wasm config to make it permissioned by default
wasmGen := wasm.GenesisState{
Params: wasmtypes.Params{
CodeUploadAccess: wasmtypes.AllowNobody,
InstantiateDefaultPermission: wasmtypes.AccessTypeEverybody,
},
}
gen[wasm.ModuleName] = encCfg.Marshaler.MustMarshalJSON(&wasmGen)
return gen
return ModuleBasics.DefaultGenesis(encCfg.Marshaler)
}
Loading

0 comments on commit 1ad8d51

Please sign in to comment.