Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump wasmd to v0.45.0 #361

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 8 additions & 39 deletions app/app.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
package app

import (
"fmt"

Check failure on line 4 in app/app.go

View workflow job for this annotation

GitHub Actions / lint

File is not `gofumpt`-ed with `-extra` (gofumpt)
"io"
"os"
"path/filepath"
"strings"

nodeservice "github.com/cosmos/cosmos-sdk/client/grpc/node"
authante "github.com/cosmos/cosmos-sdk/x/auth/ante"
authsims "github.com/cosmos/cosmos-sdk/x/auth/simulation"
Expand All @@ -15,6 +10,9 @@
tendermint "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint"
wasm08 "github.com/cosmos/ibc-go/v7/modules/light-clients/08-wasm"
wasm08keeper "github.com/cosmos/ibc-go/v7/modules/light-clients/08-wasm/keeper"
"io"

Check failure on line 13 in app/app.go

View workflow job for this annotation

GitHub Actions / lint

File is not `gofumpt`-ed with `-extra` (gofumpt)
"os"
"path/filepath"

wasm08types "github.com/cosmos/ibc-go/v7/modules/light-clients/08-wasm/types"

Expand Down Expand Up @@ -132,35 +130,10 @@
)

var (
// If EnabledSpecificProposals is "", and this is "true", then enable all x/wasm proposals.
// If EnabledSpecificProposals is "", and this is not "true", then disable all x/wasm proposals.
ProposalsEnabled = "false"
// 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 = ""

Upgrades = []upgrades.Upgrade{v4.Upgrade, v5.Upgrade, v6.Upgrade}
Forks = []upgrades.Fork{}
)

// 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
}

// this line is used by starport scaffolding # stargate/wasm/app/enabledProposals

func getGovProposalHandlers() []govclient.ProposalHandler {
Expand Down Expand Up @@ -232,7 +205,6 @@
transfermiddlewaretypes.ModuleName: {authtypes.Minter, authtypes.Burner},
ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner},
icatypes.ModuleName: nil,
// this line is used by starport scaffolding # stargate/app/maccPerms
}
)

Expand Down Expand Up @@ -274,16 +246,15 @@
db dbm.DB,
traceStore io.Writer,
loadLatest bool,
enabledProposals []wasm.ProposalType,
skipUpgradeHeights map[int64]bool,
homePath string,
invCheckPeriod uint,
encodingConfig EncodingConfig,
appOpts servertypes.AppOptions,
wasmOpts []wasm.Option,
wasmOpts []wasmkeeper.Option,
baseAppOptions ...func(*baseapp.BaseApp),
) *ComposableApp {
appCodec := encodingConfig.Marshaler
appCodec := encodingConfig.Codec
cdc := encodingConfig.Amino
interfaceRegistry := encodingConfig.InterfaceRegistry

Expand Down Expand Up @@ -320,7 +291,6 @@
homePath,
appOpts,
wasmOpts,
enabledProposals,
)

transferModule := transfer.NewAppModule(app.TransferKeeper)
Expand Down Expand Up @@ -409,8 +379,7 @@
consensusparamtypes.ModuleName,
wasm08types.ModuleName,
icatypes.ModuleName,
wasm.ModuleName,
// this line is used by starport scaffolding # stargate/app/beginBlockers
wasmtypes.ModuleName,
)

app.mm.SetOrderEndBlockers(
Expand Down Expand Up @@ -442,7 +411,7 @@
consensusparamtypes.ModuleName,
wasm08types.ModuleName,
icatypes.ModuleName,
wasm.ModuleName,
wasmtypes.ModuleName,
)

// NOTE: The genutils module must occur after staking so that pools are
Expand Down Expand Up @@ -479,7 +448,7 @@
consensusparamtypes.ModuleName,
wasm08types.ModuleName,
icatypes.ModuleName,
wasm.ModuleName,
wasmtypes.ModuleName,
// this line is used by starport scaffolding # stargate/app/initGenesis
)

Expand Down
8 changes: 4 additions & 4 deletions app/encoding.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
// This data structure (EncodingConfig) is heavily inspired by Quicksilver. https://github.com/ingenuity-build/quicksilver/blob/main/app/encoding.go
type EncodingConfig struct {
InterfaceRegistry types.InterfaceRegistry
Marshaler codec.Codec
Codec codec.Codec
TxConfig client.TxConfig
Amino *codec.LegacyAmino
}
Expand All @@ -20,12 +20,12 @@ type EncodingConfig struct {
func MakeEncodingConfig() EncodingConfig {
amino := codec.NewLegacyAmino()
interfaceRegistry := types.NewInterfaceRegistry()
marshaler := codec.NewProtoCodec(interfaceRegistry)
txCfg := tx.NewTxConfig(marshaler, tx.DefaultSignModes)
appCodec := codec.NewProtoCodec(interfaceRegistry)
txCfg := tx.NewTxConfig(appCodec, tx.DefaultSignModes)

encodingConfig := EncodingConfig{
InterfaceRegistry: interfaceRegistry,
Marshaler: marshaler,
Codec: appCodec,
TxConfig: txCfg,
Amino: amino,
}
Expand Down
2 changes: 1 addition & 1 deletion app/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ type GenesisState map[string]json.RawMessage
// NewDefaultGenesisState generates the default state for the application.
func NewDefaultGenesisState() GenesisState {
encCfg := MakeEncodingConfig()
return ModuleBasics.DefaultGenesis(encCfg.Marshaler)
return ModuleBasics.DefaultGenesis(encCfg.Codec)
}
2 changes: 0 additions & 2 deletions app/helpers/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

"cosmossdk.io/math"
"github.com/CosmWasm/wasmd/x/wasm"
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
dbm "github.com/cometbft/cometbft-db"
abci "github.com/cometbft/cometbft/abci/types"
"github.com/cometbft/cometbft/libs/log"
Expand Down Expand Up @@ -87,7 +86,7 @@
return app
}

func setup(withGenesis bool, invCheckPeriod uint, opts ...wasm.Option) (*composable.ComposableApp, composable.GenesisState) {

Check failure on line 89 in app/helpers/test_helpers.go

View workflow job for this annotation

GitHub Actions / lint

SA1019: wasm.Option is deprecated: Do not use. (staticcheck)
db := dbm.NewMemDB()
encCdc := composable.MakeEncodingConfig()
app := composable.NewComposableApp(
Expand All @@ -95,7 +94,6 @@
db,
nil,
true,
wasmtypes.EnableAllProposals,
map[int64]bool{},
composable.DefaultNodeHome,
invCheckPeriod,
Expand Down
27 changes: 26 additions & 1 deletion app/ibctesting/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import (
"bytes"
"crypto/sha256"
"encoding/hex"
"fmt"
"os"
"testing"
Expand Down Expand Up @@ -651,7 +652,7 @@
wasmCode, err := os.ReadFile(path)
suite.Require().NoError(err)

src := wasmtypes.StoreCodeProposalFixture(func(p *wasmtypes.StoreCodeProposal) { //nolint: staticcheck
src := StoreCodeProposalFixture(func(p *wasmtypes.StoreCodeProposal) { //nolint: staticcheck
p.RunAs = govModuleAddress.String()
p.WASMByteCode = wasmCode
checksum := sha256.Sum256(wasmCode)
Expand Down Expand Up @@ -754,10 +755,34 @@
return composable.NewTestSupport(a.t, a.ComposableApp)
}

func (a TestingAppDecorator) GetWasmdKeeper() wasm.Keeper {

Check failure on line 758 in app/ibctesting/chain.go

View workflow job for this annotation

GitHub Actions / lint

SA1019: wasm.Keeper is deprecated: Do not use. (staticcheck)
return a.TestSupport().WasmdKeeper()
}

func (a TestingAppDecorator) GetWasmKeeper() wasm08.Keeper {
return a.TestSupport().Wasm08Keeper()
}

func StoreCodeProposalFixture(mutators ...func(*wasmtypes.StoreCodeProposal)) *wasmtypes.StoreCodeProposal {

Check failure on line 766 in app/ibctesting/chain.go

View workflow job for this annotation

GitHub Actions / lint

SA1019: wasmtypes.StoreCodeProposal is deprecated: Do not use. Since wasmd v0.40, there is no longer a need for an explicit StoreCodeProposal. To submit WASM code to the system, a simple MsgStoreCode can be invoked from the x/gov module via a v1 governance proposal. (staticcheck)
const anyAddress = "cosmos1qyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqs2m6sx4"
wasm := []byte{0x0}
// got the value from shell sha256sum
codeHash, err := hex.DecodeString("6E340B9CFFB37A989CA544E6BB780A2C78901D3FB33738768511A30617AFA01D")
if err != nil {
panic(err)
}

p := &wasmtypes.StoreCodeProposal{

Check failure on line 775 in app/ibctesting/chain.go

View workflow job for this annotation

GitHub Actions / lint

SA1019: wasmtypes.StoreCodeProposal is deprecated: Do not use. Since wasmd v0.40, there is no longer a need for an explicit StoreCodeProposal. To submit WASM code to the system, a simple MsgStoreCode can be invoked from the x/gov module via a v1 governance proposal. (staticcheck)
Title: "Foo",
Description: "Bar",
RunAs: anyAddress,
WASMByteCode: wasm,
Source: "https://example.com/",
Builder: "cosmwasm/workspace-optimizer:v0.12.8",
CodeHash: codeHash,
}
for _, m := range mutators {
m(p)
}
return p
}
26 changes: 11 additions & 15 deletions app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

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

Check failure on line 5 in app/keepers/keepers.go

View workflow job for this annotation

GitHub Actions / lint

File is not `gofumpt`-ed with `-extra` (gofumpt)
"path/filepath"
"strings"

Check failure on line 7 in app/keepers/keepers.go

View workflow job for this annotation

GitHub Actions / lint

File is not `gofumpt`-ed with `-extra` (gofumpt)

"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/codec"
Expand Down Expand Up @@ -91,10 +92,11 @@
minttypes "github.com/notional-labs/composable/v6/x/mint/types"

"github.com/CosmWasm/wasmd/x/wasm"
wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
servertypes "github.com/cosmos/cosmos-sdk/server/types"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
wasm08Keeper "github.com/cosmos/ibc-go/v7/modules/light-clients/08-wasm/keeper"
wasmtypes "github.com/cosmos/ibc-go/v7/modules/light-clients/08-wasm/types"
wasm08types "github.com/cosmos/ibc-go/v7/modules/light-clients/08-wasm/types"

ibc_hooks "github.com/notional-labs/composable/v6/x/ibc-hooks"
ibchookskeeper "github.com/notional-labs/composable/v6/x/ibc-hooks/keeper"
Expand Down Expand Up @@ -132,7 +134,7 @@
AuthzKeeper authzkeeper.Keeper
GroupKeeper groupkeeper.Keeper
Wasm08Keeper wasm08Keeper.Keeper // TODO: use this name ?
WasmKeeper wasm.Keeper
WasmKeeper wasmkeeper.Keeper
IBCHooksKeeper *ibchookskeeper.Keeper
Ics20WasmHooks *ibc_hooks.WasmHooks
HooksICS4Wrapper ibc_hooks.ICS4Middleware
Expand Down Expand Up @@ -160,8 +162,7 @@
skipUpgradeHeights map[int64]bool,
homePath string,
appOpts servertypes.AppOptions,
wasmOpts []wasm.Option,
enabledProposals []wasm.ProposalType,
wasmOpts []wasmkeeper.Option,
) {
// add keepers
appKeepers.AccountKeeper = authkeeper.NewAccountKeeper(
Expand Down Expand Up @@ -232,7 +233,7 @@

govModuleAuthority := authtypes.NewModuleAddress(govtypes.ModuleName).String()

appKeepers.Wasm08Keeper = wasm08Keeper.NewKeeper(appCodec, appKeepers.keys[wasmtypes.StoreKey], govModuleAuthority, homePath, &appKeepers.IBCKeeper.ClientKeeper)
appKeepers.Wasm08Keeper = wasm08Keeper.NewKeeper(appCodec, appKeepers.keys[wasm08types.StoreKey], govModuleAuthority, homePath, &appKeepers.IBCKeeper.ClientKeeper)

// ICA Host keeper
appKeepers.ICAHostKeeper = icahostkeeper.NewKeeper(
Expand Down Expand Up @@ -355,9 +356,9 @@
// The last arguments can contain custom message handlers, and custom query handlers,
// if we want to allow any custom callbacks
availableCapabilities := strings.Join(AllCapabilities(), ",")
appKeepers.WasmKeeper = wasm.NewKeeper(
appKeepers.WasmKeeper = wasmkeeper.NewKeeper(
appCodec,
appKeepers.keys[wasm.StoreKey],
appKeepers.keys[wasmtypes.StoreKey],
appKeepers.AccountKeeper,
appKeepers.BankKeeper,
appKeepers.StakingKeeper,
Expand Down Expand Up @@ -386,11 +387,6 @@
AddRoute(upgradetypes.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(appKeepers.UpgradeKeeper)).
AddRoute(ibcclienttypes.RouterKey, ibcclient.NewClientProposalHandler(appKeepers.IBCKeeper.ClientKeeper))

// The gov proposal types can be individually enabled
if len(enabledProposals) != 0 {
govRouter.AddRoute(wasm.RouterKey, wasm.NewWasmProposalHandler(appKeepers.WasmKeeper, enabledProposals))
}

govKeeper := *govkeeper.NewKeeper(
appCodec, appKeepers.keys[govtypes.StoreKey], appKeepers.AccountKeeper, appKeepers.BankKeeper,
appKeepers.StakingKeeper, bApp.MsgServiceRouter(), govtypes.DefaultConfig(), govModuleAuthority,
Expand All @@ -407,7 +403,7 @@
ibcRouter := porttypes.NewRouter()
ibcRouter.AddRoute(ibctransfertypes.ModuleName, hooksTransferMiddleware)
ibcRouter.AddRoute(icqtypes.ModuleName, icqIBCModule)
ibcRouter.AddRoute(wasm.ModuleName, wasm.NewIBCHandler(appKeepers.WasmKeeper, appKeepers.IBCKeeper.ChannelKeeper, appKeepers.IBCKeeper.ChannelKeeper))
ibcRouter.AddRoute(wasmtypes.ModuleName, wasm.NewIBCHandler(appKeepers.WasmKeeper, appKeepers.IBCKeeper.ChannelKeeper, appKeepers.IBCKeeper.ChannelKeeper))
ibcRouter.AddRoute(icahosttypes.SubModuleName, icaHostStack)

// this line is used by starport scaffolding # ibc/app/router
Expand All @@ -434,7 +430,7 @@
// grant capabilities for the ibc and ibc-transfer modules
appKeepers.ScopedIBCKeeper = appKeepers.CapabilityKeeper.ScopeToModule(ibchost.ModuleName)
appKeepers.ScopedTransferKeeper = appKeepers.CapabilityKeeper.ScopeToModule(ibctransfertypes.ModuleName)
appKeepers.ScopedWasmKeeper = appKeepers.CapabilityKeeper.ScopeToModule(wasm.ModuleName)
appKeepers.ScopedWasmKeeper = appKeepers.CapabilityKeeper.ScopeToModule(wasmtypes.ModuleName)
appKeepers.ScopedICAHostKeeper = appKeepers.CapabilityKeeper.ScopeToModule(icahosttypes.SubModuleName)
appKeepers.ScopedRateLimitKeeper = appKeepers.CapabilityKeeper.ScopeToModule(ratelimitmoduletypes.ModuleName)

Expand All @@ -459,7 +455,7 @@
paramsKeeper.Subspace(icqtypes.ModuleName)
paramsKeeper.Subspace(ibchost.ModuleName)
paramsKeeper.Subspace(icahosttypes.SubModuleName)
paramsKeeper.Subspace(wasm.ModuleName)
paramsKeeper.Subspace(wasmtypes.ModuleName)
paramsKeeper.Subspace(transfermiddlewaretypes.ModuleName)

return paramsKeeper
Expand Down
12 changes: 7 additions & 5 deletions app/keepers/keys.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
package keepers

import (
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
authzkeeper "github.com/cosmos/cosmos-sdk/x/authz/keeper"

// bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"

banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types"
Expand Down Expand Up @@ -39,7 +38,6 @@ import (

minttypes "github.com/notional-labs/composable/v6/x/mint/types"

"github.com/CosmWasm/wasmd/x/wasm"
wasm08types "github.com/cosmos/ibc-go/v7/modules/light-clients/08-wasm/types"
)

Expand All @@ -50,8 +48,12 @@ func (appKeepers *AppKeepers) GenerateKeys() {
appKeepers.keys = sdk.NewKVStoreKeys(
authtypes.StoreKey, banktypes.StoreKey, stakingtypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey,
govtypes.StoreKey, paramstypes.StoreKey, ibchost.StoreKey, upgradetypes.StoreKey, feegrant.StoreKey,
evidencetypes.StoreKey, ibctransfertypes.StoreKey, icqtypes.StoreKey, capabilitytypes.StoreKey, consensusparamtypes.StoreKey, wasm08types.StoreKey,
crisistypes.StoreKey, routertypes.StoreKey, transfermiddlewaretypes.StoreKey, group.StoreKey, minttypes.StoreKey, wasm.StoreKey, ibchookstypes.StoreKey, icahosttypes.StoreKey, ratelimitmoduletypes.StoreKey, txBoundaryTypes.StoreKey,
evidencetypes.StoreKey, ibctransfertypes.StoreKey, icqtypes.StoreKey, capabilitytypes.StoreKey,
consensusparamtypes.StoreKey, wasm08types.StoreKey,
crisistypes.StoreKey, routertypes.StoreKey, transfermiddlewaretypes.StoreKey, group.StoreKey,
minttypes.StoreKey, wasmtypes.StoreKey,
ibchookstypes.StoreKey, icahosttypes.StoreKey, ratelimitmoduletypes.StoreKey,
txBoundaryTypes.StoreKey,
authzkeeper.StoreKey,
)

Expand Down
2 changes: 2 additions & 0 deletions app/keepers/wasm.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,7 @@ func AllCapabilities() []string {
"stargate",
"cosmwasm_1_1",
"cosmwasm_1_2",
"cosmwasm_1_3",
"cosmwasm_1_4",
}
}
2 changes: 0 additions & 2 deletions app/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
minttypes "github.com/notional-labs/composable/v6/x/mint/types"

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

// DefaultConsensusParams defines the default Tendermint consensus params used in
Expand Down Expand Up @@ -72,12 +71,11 @@
baseAppOpts := []func(*baseapp.BaseApp){baseapp.SetSnapshot(snapshotStore, types.SnapshotOptions{
KeepRecent: 2,
})}
var wasmOpts []wasm.Option

Check failure on line 74 in app/test_helpers.go

View workflow job for this annotation

GitHub Actions / lint

SA1019: wasm.Option is deprecated: Do not use. (staticcheck)
db := dbm.NewMemDB()
app := NewComposableApp(
log.NewNopLogger(),
db, nil, true,
wasmtypes.EnableAllProposals,
map[int64]bool{},
nodeHome,
invCheckPeriod,
Expand Down
Loading
Loading