diff --git a/.circleci/config.yml b/.circleci/config.yml
index 1fc750c49c..59c4bf9df4 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -124,7 +124,7 @@ jobs:
- run:
name: Run simulations
command: |
- make test-sim-multi-seed-short
+ make test-sim-multi-seed-short test-sim-import-export test-sim-deterministic
- store_artifacts:
path: /tmp
diff --git a/.golangci.yml b/.golangci.yml
index 17d5384ea3..6e12132bc5 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -1,63 +1,65 @@
run:
- tests: false
+ tests: true
+ # timeout for analysis, e.g. 30s, 5m, default is 1m
+ timeout: 5m
linters:
disable-all: true
enable:
- bodyclose
- - deadcode
- depguard
- dogsled
- errcheck
+ - exportloopref
- goconst
- gocritic
- - gofmt
- - goimports
- - revive
+ - gofumpt
- gosec
- gosimple
- govet
- ineffassign
- misspell
- nakedret
- - prealloc
- - exportloopref
+ - nolintlint
+ - revive
- staticcheck
- - structcheck
- stylecheck
- typecheck
- unconvert
+ - unparam
- unused
- - varcheck
issues:
exclude-rules:
+ - text: "simtypes"
+ linters:
+ - staticcheck
- text: "Use of weak random number generator"
linters:
- gosec
- text: "ST1003:"
linters:
- stylecheck
+ # FIXME: Disabled until golangci-lint updates stylecheck with this fix:
+ # https://github.com/dominikh/go-tools/issues/389
+ - text: "ST1016:"
+ linters:
+ - stylecheck
+ - path: "migrations"
+ text: "SA1019:"
+ linters:
+ - staticcheck
+
+ max-issues-per-linter: 10000
+ max-same-issues: 10000
linters-settings:
- dogsled:
- max-blank-identifiers: 3
- errcheck:
- # report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`;
- # default is false: such cases aren't reported by default.
- check-blank: true
- maligned:
- # print struct with more effective memory layout or not, false by default
- suggest-new: true
- golint:
- # minimal confidence for issues, default is 0.8
- min-confidence: 0
- prealloc:
- # XXX: we don't recommend using this linter before doing performance profiling.
- # For most programs usage of prealloc will be a premature optimization.
+ revive:
+ # When set to false, ignores files with "GENERATED" header, similar to golint
+ ignore-generated-header: true
- # Report preallocation suggestions only on simple loops that have no returns/breaks/continues/gotos in them.
- # True by default.
- simple: false
- range-loops: true # Report preallocation suggestions on range loops, true by default
- for-loops: true # Report preallocation suggestions on for loops, false by default
+ nolintlint:
+ allow-unused: false
+ allow-leading-space: true
+ require-explanation: false
+ require-specific: false
diff --git a/INTEGRATION.md b/INTEGRATION.md
index 253d1f71e0..cada821a80 100644
--- a/INTEGRATION.md
+++ b/INTEGRATION.md
@@ -19,6 +19,8 @@ hardware it runs on.
| wasmd | Cosmos SDK |
|:-----:|:----------:|
+| v0.40 | v0.47.0 |
+| v0.31 | v0.45.14 |
| v0.30 | v0.45.11 |
| v0.29 | v0.45.8 |
| v0.28 | v0.45.5 |
diff --git a/Makefile b/Makefile
index d6be2e9300..ea20201704 100644
--- a/Makefile
+++ b/Makefile
@@ -146,7 +146,11 @@ test-sim-import-export: runsim
test-sim-multi-seed-short: runsim
@echo "Running short multi-seed application simulation. This may take awhile!"
- @$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) -ExitOnFail 50 10 TestFullAppSimulation
+ @$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) -ExitOnFail 50 5 TestFullAppSimulation
+
+test-sim-deterministic: runsim
+ @echo "Running short multi-seed application simulation. This may take awhile!"
+ @$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) -ExitOnFail 1 1 TestAppStateDeterminism
###############################################################################
### Linting ###
@@ -159,10 +163,10 @@ format-tools:
lint: format-tools
golangci-lint run --tests=false
- find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "*_test.go" | xargs gofumpt -d -s
+ find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "*_test.go" | xargs gofumpt -d
format: format-tools
- find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/lcd/statik/statik.go" | xargs gofumpt -w -s
+ find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/lcd/statik/statik.go" | xargs gofumpt -w
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/lcd/statik/statik.go" | xargs misspell -w
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/lcd/statik/statik.go" | xargs goimports -w -local github.com/CosmWasm/wasmd
@@ -170,20 +174,19 @@ format: format-tools
###############################################################################
### Protobuf ###
###############################################################################
-PROTO_BUILDER_IMAGE=tendermintdev/sdk-proto-gen:v0.7
-PROTO_FORMATTER_IMAGE=tendermintdev/docker-build-proto@sha256:aabcfe2fc19c31c0f198d4cd26393f5e5ca9502d7ea3feafbfe972448fee7cae
+protoVer=0.11.6
+protoImageName=ghcr.io/cosmos/proto-builder:$(protoVer)
+protoImage=$(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace $(protoImageName)
proto-all: proto-format proto-lint proto-gen format
proto-gen:
@echo "Generating Protobuf files"
- $(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace $(PROTO_BUILDER_IMAGE) sh ./scripts/protocgen.sh
+ @$(protoImage) sh ./scripts/protocgen.sh
proto-format:
@echo "Formatting Protobuf files"
- $(DOCKER) run --rm -v $(CURDIR):/workspace \
- --workdir /workspace $(PROTO_FORMATTER_IMAGE) \
- find ./ -name *.proto -exec clang-format -i {} \;
+ @$(protoImage) find ./ -name "*.proto" -exec clang-format -i {} \;
proto-swagger-gen:
@./scripts/protoc-swagger-gen.sh
diff --git a/README.md b/README.md
index ccc8182483..fa67a51315 100644
--- a/README.md
+++ b/README.md
@@ -27,6 +27,7 @@ compatibility list:
| wasmd | wasmvm | cosmwasm-vm | cosmwasm-std |
|-------|--------------|-------------|--------------|
+| 0.40 | v1.2.1 | | 1.0-1.2 |
| 0.31 | v1.2.0 | | 1.0-1.2 |
| 0.30 | v1.1.0 | | 1.0-1.1 |
| 0.29 | v1.1.0 | | 1.0-1.1 |
diff --git a/app/ante.go b/app/ante.go
index e5dd75a938..e408372fa0 100644
--- a/app/ante.go
+++ b/app/ante.go
@@ -1,11 +1,13 @@
package app
import (
+ errorsmod "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/v4/modules/core/ante"
- "github.com/cosmos/ibc-go/v4/modules/core/keeper"
+ ibcante "github.com/cosmos/ibc-go/v7/modules/core/ante"
+ "github.com/cosmos/ibc-go/v7/modules/core/keeper"
wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
wasmTypes "github.com/CosmWasm/wasmd/x/wasm/types"
@@ -18,49 +20,42 @@ type HandlerOptions struct {
IBCKeeper *keeper.Keeper
WasmConfig *wasmTypes.WasmConfig
- TXCounterStoreKey sdk.StoreKey
+ TXCounterStoreKey storetypes.StoreKey
}
func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {
if options.AccountKeeper == nil {
- return nil, sdkerrors.Wrap(sdkerrors.ErrLogic, "account keeper is required for AnteHandler")
+ return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "account keeper is required for AnteHandler")
}
if options.BankKeeper == nil {
- return nil, sdkerrors.Wrap(sdkerrors.ErrLogic, "bank keeper is required for AnteHandler")
+ return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "bank keeper is required for AnteHandler")
}
if options.SignModeHandler == nil {
- return nil, sdkerrors.Wrap(sdkerrors.ErrLogic, "sign mode handler is required for ante builder")
+ return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "sign mode handler is required for ante builder")
}
if options.WasmConfig == nil {
- return nil, sdkerrors.Wrap(sdkerrors.ErrLogic, "wasm config is required for ante builder")
+ return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "wasm config is required for ante builder")
}
if options.TXCounterStoreKey == nil {
- return nil, sdkerrors.Wrap(sdkerrors.ErrLogic, "tx counter key is required for ante builder")
- }
-
- sigGasConsumer := options.SigGasConsumer
- if sigGasConsumer == nil {
- sigGasConsumer = ante.DefaultSigVerificationGasConsumer
+ return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "tx counter key is required for ante builder")
}
anteDecorators := []sdk.AnteDecorator{
ante.NewSetUpContextDecorator(), // outermost AnteDecorator. SetUpContext must be called first
wasmkeeper.NewLimitSimulationGasDecorator(options.WasmConfig.SimulationGasLimit), // after setup context to enforce limits early
wasmkeeper.NewCountTXDecorator(options.TXCounterStoreKey),
- ante.NewRejectExtensionOptionsDecorator(),
- ante.NewMempoolFeeDecorator(),
+ ante.NewExtensionOptionsDecorator(options.ExtensionOptionChecker),
ante.NewValidateBasicDecorator(),
ante.NewTxTimeoutHeightDecorator(),
ante.NewValidateMemoDecorator(options.AccountKeeper),
ante.NewConsumeGasForTxSizeDecorator(options.AccountKeeper),
- ante.NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper),
- // SetPubKeyDecorator must be called before all signature verification decorators
- ante.NewSetPubKeyDecorator(options.AccountKeeper),
+ ante.NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper, options.TxFeeChecker),
+ ante.NewSetPubKeyDecorator(options.AccountKeeper), // SetPubKeyDecorator must be called before all signature verification decorators
ante.NewValidateSigCountDecorator(options.AccountKeeper),
- ante.NewSigGasConsumeDecorator(options.AccountKeeper, sigGasConsumer),
+ ante.NewSigGasConsumeDecorator(options.AccountKeeper, options.SigGasConsumer),
ante.NewSigVerificationDecorator(options.AccountKeeper, options.SignModeHandler),
ante.NewIncrementSequenceDecorator(options.AccountKeeper),
- ibcante.NewAnteDecorator(options.IBCKeeper),
+ ibcante.NewRedundantRelayDecorator(options.IBCKeeper),
}
return sdk.ChainAnteDecorators(anteDecorators...), nil
diff --git a/app/app.go b/app/app.go
index 55d8f7ccec..55a4d0af73 100644
--- a/app/app.go
+++ b/app/app.go
@@ -1,29 +1,43 @@
package app
import (
+ "encoding/json"
"fmt"
"io"
- "net/http"
"os"
"path/filepath"
"strings"
+ autocliv1 "cosmossdk.io/api/cosmos/autocli/v1"
+ reflectionv1 "cosmossdk.io/api/cosmos/reflection/v1"
+
+ dbm "github.com/cometbft/cometbft-db"
+ abci "github.com/cometbft/cometbft/abci/types"
+ "github.com/cometbft/cometbft/libs/log"
+ tmos "github.com/cometbft/cometbft/libs/os"
+ tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client"
+ "github.com/cosmos/cosmos-sdk/client/flags"
+ nodeservice "github.com/cosmos/cosmos-sdk/client/grpc/node"
"github.com/cosmos/cosmos-sdk/client/grpc/tmservice"
- "github.com/cosmos/cosmos-sdk/client/rpc"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/codec/types"
+ "github.com/cosmos/cosmos-sdk/runtime"
+ runtimeservices "github.com/cosmos/cosmos-sdk/runtime/services"
+ "github.com/cosmos/cosmos-sdk/server"
"github.com/cosmos/cosmos-sdk/server/api"
"github.com/cosmos/cosmos-sdk/server/config"
servertypes "github.com/cosmos/cosmos-sdk/server/types"
- "github.com/cosmos/cosmos-sdk/simapp"
+ "github.com/cosmos/cosmos-sdk/store/streaming"
+ storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
+ "github.com/cosmos/cosmos-sdk/version"
"github.com/cosmos/cosmos-sdk/x/auth"
"github.com/cosmos/cosmos-sdk/x/auth/ante"
- authrest "github.com/cosmos/cosmos-sdk/x/auth/client/rest"
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
+ "github.com/cosmos/cosmos-sdk/x/auth/posthandler"
authsims "github.com/cosmos/cosmos-sdk/x/auth/simulation"
authtx "github.com/cosmos/cosmos-sdk/x/auth/tx"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
@@ -38,11 +52,13 @@ import (
"github.com/cosmos/cosmos-sdk/x/capability"
capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper"
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
+ "github.com/cosmos/cosmos-sdk/x/consensus"
+ consensusparamkeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper"
+ consensusparamtypes "github.com/cosmos/cosmos-sdk/x/consensus/types"
"github.com/cosmos/cosmos-sdk/x/crisis"
crisiskeeper "github.com/cosmos/cosmos-sdk/x/crisis/keeper"
crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types"
distr "github.com/cosmos/cosmos-sdk/x/distribution"
- distrclient "github.com/cosmos/cosmos-sdk/x/distribution/client"
distrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper"
distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
"github.com/cosmos/cosmos-sdk/x/evidence"
@@ -56,9 +72,16 @@ import (
"github.com/cosmos/cosmos-sdk/x/gov"
govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
+ govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
+ "github.com/cosmos/cosmos-sdk/x/group"
+ groupkeeper "github.com/cosmos/cosmos-sdk/x/group/keeper"
+ groupmodule "github.com/cosmos/cosmos-sdk/x/group/module"
"github.com/cosmos/cosmos-sdk/x/mint"
mintkeeper "github.com/cosmos/cosmos-sdk/x/mint/keeper"
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
+ "github.com/cosmos/cosmos-sdk/x/nft"
+ nftkeeper "github.com/cosmos/cosmos-sdk/x/nft/keeper"
+ nftmodule "github.com/cosmos/cosmos-sdk/x/nft/module"
"github.com/cosmos/cosmos-sdk/x/params"
paramsclient "github.com/cosmos/cosmos-sdk/x/params/client"
paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper"
@@ -74,50 +97,34 @@ import (
upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client"
upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
- ica "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts"
- icacontroller "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/controller"
- icacontrollerkeeper "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/controller/keeper"
- icacontrollertypes "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/controller/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"
- icatypes "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/types"
- ibcfee "github.com/cosmos/ibc-go/v4/modules/apps/29-fee"
- ibcfeekeeper "github.com/cosmos/ibc-go/v4/modules/apps/29-fee/keeper"
- ibcfeetypes "github.com/cosmos/ibc-go/v4/modules/apps/29-fee/types"
- transfer "github.com/cosmos/ibc-go/v4/modules/apps/transfer"
- ibctransferkeeper "github.com/cosmos/ibc-go/v4/modules/apps/transfer/keeper"
- ibctransfertypes "github.com/cosmos/ibc-go/v4/modules/apps/transfer/types"
- ibc "github.com/cosmos/ibc-go/v4/modules/core"
- ibcclient "github.com/cosmos/ibc-go/v4/modules/core/02-client"
- ibcclientclient "github.com/cosmos/ibc-go/v4/modules/core/02-client/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"
-
- // Note: please do your research before using this in production app, this is a demo and not an officially
- // supported IBC team implementation. It has no known issues, but do your own research before using it.
- intertx "github.com/cosmos/interchain-accounts/x/inter-tx"
- intertxkeeper "github.com/cosmos/interchain-accounts/x/inter-tx/keeper"
- intertxtypes "github.com/cosmos/interchain-accounts/x/inter-tx/types"
- "github.com/gorilla/mux"
- "github.com/rakyll/statik/fs"
+ ica "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts"
+ icacontroller "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller"
+ icacontrollerkeeper "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/keeper"
+ icacontrollertypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types"
+ icahost "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host"
+ icahostkeeper "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/keeper"
+ icahosttypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/types"
+ icatypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types"
+ ibcfee "github.com/cosmos/ibc-go/v7/modules/apps/29-fee"
+ ibcfeekeeper "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/keeper"
+ ibcfeetypes "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/types"
+ transfer "github.com/cosmos/ibc-go/v7/modules/apps/transfer"
+ ibctransferkeeper "github.com/cosmos/ibc-go/v7/modules/apps/transfer/keeper"
+ ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types"
+ ibc "github.com/cosmos/ibc-go/v7/modules/core"
+ ibcclient "github.com/cosmos/ibc-go/v7/modules/core/02-client"
+ ibcclientclient "github.com/cosmos/ibc-go/v7/modules/core/02-client/client"
+ ibcclienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types"
+ porttypes "github.com/cosmos/ibc-go/v7/modules/core/05-port/types"
+ ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported"
+ ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper"
+ ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint"
"github.com/spf13/cast"
- abci "github.com/tendermint/tendermint/abci/types"
- tmjson "github.com/tendermint/tendermint/libs/json"
- "github.com/tendermint/tendermint/libs/log"
- tmos "github.com/tendermint/tendermint/libs/os"
- tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
- dbm "github.com/tendermint/tm-db"
-
- wasmappparams "github.com/CosmWasm/wasmd/app/params"
+
"github.com/CosmWasm/wasmd/x/wasm"
wasmclient "github.com/CosmWasm/wasmd/x/wasm/client"
wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
-
- // unnamed import of statik for swagger UI support
- _ "github.com/cosmos/cosmos-sdk/client/docs/statik"
+ wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
)
const appName = "WasmApp"
@@ -180,7 +187,7 @@ var (
// and genesis verification.
ModuleBasics = module.NewBasicManager(
auth.AppModuleBasic{},
- genutil.AppModuleBasic{},
+ genutil.NewAppModuleBasic(genutiltypes.DefaultMessageValidator),
bank.AppModuleBasic{},
capability.AppModuleBasic{},
staking.AppModuleBasic{},
@@ -188,28 +195,31 @@ var (
distr.AppModuleBasic{},
gov.NewAppModuleBasic(
append(
- wasmclient.ProposalHandlers, //nolint:staticcheck
+ wasmclient.ProposalHandlers,
paramsclient.ProposalHandler,
- distrclient.ProposalHandler,
- upgradeclient.ProposalHandler,
- upgradeclient.CancelProposalHandler,
+ upgradeclient.LegacyProposalHandler,
+ upgradeclient.LegacyCancelProposalHandler,
ibcclientclient.UpdateClientProposalHandler,
ibcclientclient.UpgradeProposalHandler,
- )...,
+ ),
),
params.AppModuleBasic{},
crisis.AppModuleBasic{},
slashing.AppModuleBasic{},
feegrantmodule.AppModuleBasic{},
- authzmodule.AppModuleBasic{},
- ibc.AppModuleBasic{},
upgrade.AppModuleBasic{},
evidence.AppModuleBasic{},
- transfer.AppModuleBasic{},
+ authzmodule.AppModuleBasic{},
+ groupmodule.AppModuleBasic{},
vesting.AppModuleBasic{},
+ nftmodule.AppModuleBasic{},
+ consensus.AppModuleBasic{},
+ // non sdk modules
wasm.AppModuleBasic{},
+ ibc.AppModuleBasic{},
+ ibctm.AppModuleBasic{},
+ transfer.AppModuleBasic{},
ica.AppModuleBasic{},
- intertx.AppModuleBasic{},
ibcfee.AppModuleBasic{},
)
@@ -221,6 +231,7 @@ var (
stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking},
stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking},
govtypes.ModuleName: {authtypes.Burner},
+ nft.ModuleName: nil,
ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner},
ibcfeetypes.ModuleName: nil,
icatypes.ModuleName: nil,
@@ -229,57 +240,58 @@ var (
)
var (
- _ simapp.App = (*WasmApp)(nil)
+ _ runtime.AppI = (*WasmApp)(nil)
_ servertypes.Application = (*WasmApp)(nil)
)
// WasmApp extended ABCI application
type WasmApp struct {
*baseapp.BaseApp
- legacyAmino *codec.LegacyAmino //nolint:staticcheck
+ legacyAmino *codec.LegacyAmino
appCodec codec.Codec
+ txConfig client.TxConfig
interfaceRegistry types.InterfaceRegistry
- invCheckPeriod uint
-
// keys to access the substores
- keys map[string]*sdk.KVStoreKey
- tkeys map[string]*sdk.TransientStoreKey
- memKeys map[string]*sdk.MemoryStoreKey
+ keys map[string]*storetypes.KVStoreKey
+ tkeys map[string]*storetypes.TransientStoreKey
+ memKeys map[string]*storetypes.MemoryStoreKey
// keepers
- AccountKeeper authkeeper.AccountKeeper
- BankKeeper bankkeeper.Keeper
- CapabilityKeeper *capabilitykeeper.Keeper
- StakingKeeper stakingkeeper.Keeper
- SlashingKeeper slashingkeeper.Keeper
- MintKeeper mintkeeper.Keeper
- DistrKeeper distrkeeper.Keeper
- GovKeeper govkeeper.Keeper
- CrisisKeeper crisiskeeper.Keeper
- UpgradeKeeper upgradekeeper.Keeper
- ParamsKeeper paramskeeper.Keeper
- EvidenceKeeper evidencekeeper.Keeper
+ AccountKeeper authkeeper.AccountKeeper
+ BankKeeper bankkeeper.Keeper
+ CapabilityKeeper *capabilitykeeper.Keeper
+ StakingKeeper *stakingkeeper.Keeper
+ SlashingKeeper slashingkeeper.Keeper
+ MintKeeper mintkeeper.Keeper
+ DistrKeeper distrkeeper.Keeper
+ GovKeeper govkeeper.Keeper
+ CrisisKeeper *crisiskeeper.Keeper
+ UpgradeKeeper *upgradekeeper.Keeper
+ ParamsKeeper paramskeeper.Keeper
+ AuthzKeeper authzkeeper.Keeper
+ EvidenceKeeper evidencekeeper.Keeper
+ FeeGrantKeeper feegrantkeeper.Keeper
+ GroupKeeper groupkeeper.Keeper
+ NFTKeeper nftkeeper.Keeper
+ ConsensusParamsKeeper consensusparamkeeper.Keeper
+
IBCKeeper *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly
IBCFeeKeeper ibcfeekeeper.Keeper
ICAControllerKeeper icacontrollerkeeper.Keeper
ICAHostKeeper icahostkeeper.Keeper
- InterTxKeeper intertxkeeper.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
ScopedIBCFeeKeeper capabilitykeeper.ScopedKeeper
ScopedWasmKeeper capabilitykeeper.ScopedKeeper
// the module manager
- mm *module.Manager
+ ModuleManager *module.Manager
// simulation manager
sm *module.SimulationManager
@@ -294,39 +306,50 @@ func NewWasmApp(
db dbm.DB,
traceStore io.Writer,
loadLatest bool,
- skipUpgradeHeights map[int64]bool,
- homePath string,
- invCheckPeriod uint,
- encodingConfig wasmappparams.EncodingConfig,
enabledProposals []wasm.ProposalType,
appOpts servertypes.AppOptions,
wasmOpts []wasm.Option,
baseAppOptions ...func(*baseapp.BaseApp),
) *WasmApp {
+ encodingConfig := MakeEncodingConfig()
+
appCodec, legacyAmino := encodingConfig.Marshaler, encodingConfig.Amino
interfaceRegistry := encodingConfig.InterfaceRegistry
+ txConfig := encodingConfig.TxConfig
- bApp := baseapp.NewBaseApp(appName, logger, db, encodingConfig.TxConfig.TxDecoder(), baseAppOptions...)
+ bApp := baseapp.NewBaseApp(appName, logger, db, txConfig.TxDecoder(), baseAppOptions...)
bApp.SetCommitMultiStoreTracer(traceStore)
+ bApp.SetVersion(version.Version)
bApp.SetInterfaceRegistry(interfaceRegistry)
+ bApp.SetTxEncoder(txConfig.TxEncoder())
keys := sdk.NewKVStoreKeys(
- authtypes.StoreKey, banktypes.StoreKey, stakingtypes.StoreKey,
+ authtypes.StoreKey, banktypes.StoreKey, stakingtypes.StoreKey, crisistypes.StoreKey,
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, ibcfeetypes.StoreKey,
+ govtypes.StoreKey, paramstypes.StoreKey, consensusparamtypes.StoreKey, upgradetypes.StoreKey, feegrant.StoreKey,
+ evidencetypes.StoreKey, capabilitytypes.StoreKey,
+ authzkeeper.StoreKey, nftkeeper.StoreKey, group.StoreKey,
+ // non sdk store keys
+ ibcexported.StoreKey, ibctransfertypes.StoreKey, ibcfeetypes.StoreKey,
+ wasm.StoreKey, icahosttypes.StoreKey,
+ icacontrollertypes.StoreKey,
)
+
tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey)
memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey)
+ // load state streaming if enabled
+ if _, _, err := streaming.LoadStreamingServices(bApp, appOpts, appCodec, logger, keys); err != nil {
+ logger.Error("failed to load state streaming", "err", err)
+ os.Exit(1)
+ }
+
app := &WasmApp{
BaseApp: bApp,
legacyAmino: legacyAmino,
appCodec: appCodec,
+ txConfig: txConfig,
interfaceRegistry: interfaceRegistry,
- invCheckPeriod: invCheckPeriod,
keys: keys,
tkeys: tkeys,
memKeys: memKeys,
@@ -340,7 +363,8 @@ func NewWasmApp(
)
// set the BaseApp's parameter store
- bApp.SetParamStore(app.ParamsKeeper.Subspace(baseapp.Paramspace).WithKeyTable(paramskeeper.ConsensusParamsKeyTable()))
+ app.ConsensusParamsKeeper = consensusparamkeeper.NewKeeper(appCodec, keys[consensusparamtypes.StoreKey], authtypes.NewModuleAddress(govtypes.ModuleName).String())
+ bApp.SetParamStore(&app.ConsensusParamsKeeper)
// add capability keeper and ScopeToModule for ibc module
app.CapabilityKeeper = capabilitykeeper.NewKeeper(
@@ -348,10 +372,10 @@ func NewWasmApp(
keys[capabilitytypes.StoreKey],
memKeys[capabilitytypes.MemStoreKey],
)
- scopedIBCKeeper := app.CapabilityKeeper.ScopeToModule(ibchost.ModuleName)
+
+ scopedIBCKeeper := app.CapabilityKeeper.ScopeToModule(ibcexported.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()
@@ -360,100 +384,157 @@ func NewWasmApp(
app.AccountKeeper = authkeeper.NewAccountKeeper(
appCodec,
keys[authtypes.StoreKey],
- app.getSubspace(authtypes.ModuleName),
authtypes.ProtoBaseAccount,
maccPerms,
+ Bech32Prefix,
+ authtypes.NewModuleAddress(govtypes.ModuleName).String(),
)
app.BankKeeper = bankkeeper.NewBaseKeeper(
appCodec,
keys[banktypes.StoreKey],
app.AccountKeeper,
- app.getSubspace(banktypes.ModuleName),
- app.ModuleAccountAddrs(),
- )
- app.AuthzKeeper = authzkeeper.NewKeeper(
- keys[authzkeeper.StoreKey],
- appCodec,
- app.BaseApp.MsgServiceRouter(),
- )
- app.FeeGrantKeeper = feegrantkeeper.NewKeeper(
- appCodec,
- keys[feegrant.StoreKey],
- app.AccountKeeper,
+ BlockedAddresses(),
+ authtypes.NewModuleAddress(govtypes.ModuleName).String(),
)
- stakingKeeper := stakingkeeper.NewKeeper(
+ app.StakingKeeper = stakingkeeper.NewKeeper(
appCodec,
keys[stakingtypes.StoreKey],
app.AccountKeeper,
app.BankKeeper,
- app.getSubspace(stakingtypes.ModuleName),
+ authtypes.NewModuleAddress(govtypes.ModuleName).String(),
)
+
app.MintKeeper = mintkeeper.NewKeeper(
appCodec,
keys[minttypes.StoreKey],
- app.getSubspace(minttypes.ModuleName),
- &stakingKeeper,
+ app.StakingKeeper,
app.AccountKeeper,
app.BankKeeper,
authtypes.FeeCollectorName,
+ authtypes.NewModuleAddress(govtypes.ModuleName).String(),
)
app.DistrKeeper = distrkeeper.NewKeeper(
appCodec,
keys[distrtypes.StoreKey],
- app.getSubspace(distrtypes.ModuleName),
app.AccountKeeper,
app.BankKeeper,
- &stakingKeeper,
+ app.StakingKeeper,
authtypes.FeeCollectorName,
- app.ModuleAccountAddrs(),
+ authtypes.NewModuleAddress(govtypes.ModuleName).String(),
)
+
app.SlashingKeeper = slashingkeeper.NewKeeper(
appCodec,
+ legacyAmino,
keys[slashingtypes.StoreKey],
- &stakingKeeper,
- app.getSubspace(slashingtypes.ModuleName),
+ app.StakingKeeper,
+ authtypes.NewModuleAddress(govtypes.ModuleName).String(),
)
+
+ invCheckPeriod := cast.ToUint(appOpts.Get(server.FlagInvCheckPeriod))
app.CrisisKeeper = crisiskeeper.NewKeeper(
- app.getSubspace(crisistypes.ModuleName),
+ appCodec,
+ keys[crisistypes.StoreKey],
invCheckPeriod,
app.BankKeeper,
authtypes.FeeCollectorName,
+ authtypes.NewModuleAddress(govtypes.ModuleName).String(),
+ )
+
+ app.FeeGrantKeeper = feegrantkeeper.NewKeeper(appCodec, keys[feegrant.StoreKey], app.AccountKeeper)
+
+ // register the staking hooks
+ // NOTE: stakingKeeper above is passed by reference, so that it will contain these hooks
+ app.StakingKeeper.SetHooks(
+ stakingtypes.NewMultiStakingHooks(app.DistrKeeper.Hooks(), app.SlashingKeeper.Hooks()),
)
+
+ app.AuthzKeeper = authzkeeper.NewKeeper(keys[authzkeeper.StoreKey], appCodec, app.MsgServiceRouter(), app.AccountKeeper)
+
+ groupConfig := group.DefaultConfig()
+ /*
+ Example of setting group params:
+ groupConfig.MaxMetadataLen = 1000
+ */
+ app.GroupKeeper = groupkeeper.NewKeeper(keys[group.StoreKey], appCodec, app.MsgServiceRouter(), app.AccountKeeper, groupConfig)
+
+ // get skipUpgradeHeights from the app options
+ skipUpgradeHeights := map[int64]bool{}
+ for _, h := range cast.ToIntSlice(appOpts.Get(server.FlagUnsafeSkipUpgrades)) {
+ skipUpgradeHeights[int64(h)] = true
+ }
+ homePath := cast.ToString(appOpts.Get(flags.FlagHome))
+ // set the governance module account as the authority for conducting upgrades
app.UpgradeKeeper = upgradekeeper.NewKeeper(
skipUpgradeHeights,
keys[upgradetypes.StoreKey],
appCodec,
homePath,
app.BaseApp,
- )
-
- // register the staking hooks
- // NOTE: stakingKeeper above is passed by reference, so that it will contain these hooks
- app.StakingKeeper = *stakingKeeper.SetHooks(
- stakingtypes.NewMultiStakingHooks(app.DistrKeeper.Hooks(), app.SlashingKeeper.Hooks()),
+ authtypes.NewModuleAddress(govtypes.ModuleName).String(),
)
app.IBCKeeper = ibckeeper.NewKeeper(
appCodec,
- keys[ibchost.StoreKey],
- app.getSubspace(ibchost.ModuleName),
+ keys[ibcexported.StoreKey],
+ app.GetSubspace(ibcexported.ModuleName),
app.StakingKeeper,
app.UpgradeKeeper,
scopedIBCKeeper,
)
- // register the proposal types
- govRouter := govtypes.NewRouter()
- govRouter.
- AddRoute(govtypes.RouterKey, govtypes.ProposalHandler).
- AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.ParamsKeeper)).
- AddRoute(distrtypes.RouterKey, distr.NewCommunityPoolSpendProposalHandler(app.DistrKeeper)).
+ // Register the proposal types
+ // Deprecated: Avoid adding new handlers, instead use the new proposal flow
+ // by granting the governance module the right to execute the message.
+ // See: https://docs.cosmos.network/main/modules/gov#proposal-messages
+ govRouter := govv1beta1.NewRouter()
+ govRouter.AddRoute(govtypes.RouterKey, govv1beta1.ProposalHandler).
+ AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.ParamsKeeper)). // This should be removed. It is still in place to avoid failures of modules that have not yet been upgraded.
AddRoute(upgradetypes.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(app.UpgradeKeeper)).
AddRoute(ibcclienttypes.RouterKey, ibcclient.NewClientProposalHandler(app.IBCKeeper.ClientKeeper))
+ govConfig := govtypes.DefaultConfig()
+ /*
+ Example of setting gov params:
+ govConfig.MaxMetadataLen = 10000
+ */
+ govKeeper := govkeeper.NewKeeper(
+ appCodec,
+ keys[govtypes.StoreKey],
+ app.AccountKeeper,
+ app.BankKeeper,
+ app.StakingKeeper,
+ app.MsgServiceRouter(),
+ govConfig,
+ authtypes.NewModuleAddress(govtypes.ModuleName).String(),
+ )
+
+ app.GovKeeper = *govKeeper.SetHooks(
+ govtypes.NewMultiGovHooks(
+ // register the governance hooks
+ ),
+ )
+
+ app.NFTKeeper = nftkeeper.NewKeeper(
+ keys[nftkeeper.StoreKey],
+ appCodec,
+ app.AccountKeeper,
+ app.BankKeeper,
+ )
+
+ // create evidence keeper with router
+ evidenceKeeper := evidencekeeper.NewKeeper(
+ appCodec,
+ keys[evidencetypes.StoreKey],
+ app.StakingKeeper,
+ app.SlashingKeeper,
+ )
+ // If evidence needs to be handled for the app, set routes in router here and seal
+ app.EvidenceKeeper = *evidenceKeeper
+
// IBC Fee Module keeper
app.IBCFeeKeeper = ibcfeekeeper.NewKeeper(
- appCodec, keys[ibcfeetypes.StoreKey], app.getSubspace(ibcfeetypes.ModuleName),
+ appCodec, keys[ibcfeetypes.StoreKey],
app.IBCKeeper.ChannelKeeper, // may be replaced with IBC middleware
app.IBCKeeper.ChannelKeeper,
&app.IBCKeeper.PortKeeper, app.AccountKeeper, app.BankKeeper,
@@ -463,7 +544,7 @@ func NewWasmApp(
app.TransferKeeper = ibctransferkeeper.NewKeeper(
appCodec,
keys[ibctransfertypes.StoreKey],
- app.getSubspace(ibctransfertypes.ModuleName),
+ app.GetSubspace(ibctransfertypes.ModuleName),
app.IBCFeeKeeper, // ISC4 Wrapper: fee IBC middleware
app.IBCKeeper.ChannelKeeper,
&app.IBCKeeper.PortKeeper,
@@ -475,7 +556,8 @@ func NewWasmApp(
app.ICAHostKeeper = icahostkeeper.NewKeeper(
appCodec,
keys[icahosttypes.StoreKey],
- app.getSubspace(icahosttypes.SubModuleName),
+ app.GetSubspace(icahosttypes.SubModuleName),
+ app.IBCFeeKeeper, // use ics29 fee as ics4Wrapper in middleware stack
app.IBCKeeper.ChannelKeeper,
&app.IBCKeeper.PortKeeper,
app.AccountKeeper,
@@ -485,7 +567,7 @@ func NewWasmApp(
app.ICAControllerKeeper = icacontrollerkeeper.NewKeeper(
appCodec,
keys[icacontrollertypes.StoreKey],
- app.getSubspace(icacontrollertypes.SubModuleName),
+ app.GetSubspace(icacontrollertypes.SubModuleName),
app.IBCFeeKeeper, // use ics29 fee as ics4Wrapper in middleware stack
app.IBCKeeper.ChannelKeeper,
&app.IBCKeeper.PortKeeper,
@@ -493,18 +575,6 @@ func NewWasmApp(
app.MsgServiceRouter(),
)
- // 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)
-
- // create evidence keeper with router
- evidenceKeeper := evidencekeeper.NewKeeper(
- appCodec,
- keys[evidencetypes.StoreKey],
- &app.StakingKeeper,
- app.SlashingKeeper,
- )
- app.EvidenceKeeper = *evidenceKeeper
-
wasmDir := filepath.Join(homePath, "wasm")
wasmConfig, err := wasm.ReadWasmConfig(appOpts)
if err != nil {
@@ -518,11 +588,10 @@ func NewWasmApp(
app.WasmKeeper = wasm.NewKeeper(
appCodec,
keys[wasm.StoreKey],
- app.getSubspace(wasm.ModuleName),
app.AccountKeeper,
app.BankKeeper,
app.StakingKeeper,
- app.DistrKeeper,
+ distrkeeper.NewQuerier(app.DistrKeeper),
app.IBCKeeper.ChannelKeeper,
&app.IBCKeeper.PortKeeper,
scopedWasmKeeper,
@@ -532,6 +601,7 @@ func NewWasmApp(
wasmDir,
wasmConfig,
availableCapabilities,
+ authtypes.NewModuleAddress(govtypes.ModuleName).String(),
wasmOpts...,
)
@@ -539,6 +609,8 @@ func NewWasmApp(
if len(enabledProposals) != 0 {
govRouter.AddRoute(wasm.RouterKey, wasm.NewWasmProposalHandler(app.WasmKeeper, enabledProposals))
}
+ // Set legacy router for backwards compatibility with gov v1beta1
+ app.GovKeeper.SetLegacyRouter(govRouter)
// Create Transfer Stack
var transferStack porttypes.IBCModule
@@ -548,13 +620,11 @@ func NewWasmApp(
// Create Interchain Accounts Stack
// SendPacket, since it is originating from the application to core IBC:
// icaAuthModuleKeeper.SendTx -> icaController.SendPacket -> fee.SendPacket -> channel.SendPacket
-
- // 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.
var icaControllerStack porttypes.IBCModule
- // You will likely want to use your own reviewed and maintained ica auth module
- icaControllerStack = intertx.NewIBCModule(app.InterTxKeeper)
- icaControllerStack = icacontroller.NewIBCMiddleware(icaControllerStack, app.ICAControllerKeeper)
+ // integration point for custom authentication modules
+ // see https://medium.com/the-interchain-foundation/ibc-go-v6-changes-to-interchain-accounts-and-how-it-impacts-your-chain-806c185300d7
+ var noAuthzModule porttypes.IBCModule
+ icaControllerStack = icacontroller.NewIBCMiddleware(noAuthzModule, app.ICAControllerKeeper)
icaControllerStack = ibcfee.NewIBCMiddleware(icaControllerStack, app.IBCFeeKeeper)
// RecvPacket, message that originates from core IBC and goes down to app, the flow is:
@@ -572,20 +642,10 @@ func NewWasmApp(
ibcRouter := porttypes.NewRouter().
AddRoute(ibctransfertypes.ModuleName, transferStack).
AddRoute(wasm.ModuleName, wasmStack).
- AddRoute(intertxtypes.ModuleName, icaControllerStack).
AddRoute(icacontrollertypes.SubModuleName, icaControllerStack).
AddRoute(icahosttypes.SubModuleName, icaHostStack)
app.IBCKeeper.SetRouter(ibcRouter)
- app.GovKeeper = govkeeper.NewKeeper(
- appCodec,
- keys[govtypes.StoreKey],
- app.getSubspace(govtypes.ModuleName),
- app.AccountKeeper,
- app.BankKeeper,
- &stakingKeeper,
- govRouter,
- )
/**** Module Options ****/
// NOTE: we may consider parsing `appOpts` inside module constructors. For the moment
@@ -594,185 +654,140 @@ func NewWasmApp(
// NOTE: Any module instantiated in the module manager that is later modified
// must be passed by reference here.
- app.mm = module.NewManager(
+ app.ModuleManager = module.NewManager(
genutil.NewAppModule(
app.AccountKeeper,
app.StakingKeeper,
app.BaseApp.DeliverTx,
encodingConfig.TxConfig,
),
- auth.NewAppModule(appCodec, app.AccountKeeper, nil),
+ auth.NewAppModule(appCodec, app.AccountKeeper, authsims.RandomGenesisAccounts, app.GetSubspace(authtypes.ModuleName)),
vesting.NewAppModule(app.AccountKeeper, app.BankKeeper),
- bank.NewAppModule(appCodec, app.BankKeeper, app.AccountKeeper),
- capability.NewAppModule(appCodec, *app.CapabilityKeeper),
- gov.NewAppModule(appCodec, app.GovKeeper, app.AccountKeeper, app.BankKeeper),
- mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper),
- slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper),
- distr.NewAppModule(appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper),
- staking.NewAppModule(appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper),
+ bank.NewAppModule(appCodec, app.BankKeeper, app.AccountKeeper, app.GetSubspace(banktypes.ModuleName)),
+ capability.NewAppModule(appCodec, *app.CapabilityKeeper, false),
+ feegrantmodule.NewAppModule(appCodec, app.AccountKeeper, app.BankKeeper, app.FeeGrantKeeper, app.interfaceRegistry),
+ gov.NewAppModule(appCodec, &app.GovKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(govtypes.ModuleName)),
+ mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper, nil, app.GetSubspace(minttypes.ModuleName)),
+ slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(slashingtypes.ModuleName)),
+ distr.NewAppModule(appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(distrtypes.ModuleName)),
+ staking.NewAppModule(appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(stakingtypes.ModuleName)),
upgrade.NewAppModule(app.UpgradeKeeper),
- wasm.NewAppModule(appCodec, &app.WasmKeeper, app.StakingKeeper, app.AccountKeeper, app.BankKeeper),
evidence.NewAppModule(app.EvidenceKeeper),
- feegrantmodule.NewAppModule(appCodec, app.AccountKeeper, app.BankKeeper, app.FeeGrantKeeper, app.interfaceRegistry),
+ params.NewAppModule(app.ParamsKeeper),
authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry),
+ groupmodule.NewAppModule(appCodec, app.GroupKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry),
+ nftmodule.NewAppModule(appCodec, app.NFTKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry),
+ consensus.NewAppModule(appCodec, app.ConsensusParamsKeeper),
+ wasm.NewAppModule(appCodec, &app.WasmKeeper, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.MsgServiceRouter(), app.GetSubspace(wasmtypes.ModuleName)),
ibc.NewAppModule(app.IBCKeeper),
- params.NewAppModule(app.ParamsKeeper),
transfer.NewAppModule(app.TransferKeeper),
ibcfee.NewAppModule(app.IBCFeeKeeper),
ica.NewAppModule(&app.ICAControllerKeeper, &app.ICAHostKeeper),
- intertx.NewAppModule(appCodec, app.InterTxKeeper),
- crisis.NewAppModule(&app.CrisisKeeper, skipGenesisInvariants), // always be last to make sure that it checks for all invariants and not only part of them
+ crisis.NewAppModule(app.CrisisKeeper, skipGenesisInvariants, app.GetSubspace(crisistypes.ModuleName)), // always be last to make sure that it checks for all invariants and not only part of them
)
// During begin block slashing happens after distr.BeginBlocker so that
// there is nothing left over in the validator fee pool, so as to keep the
// CanWithdrawInvariant invariant.
// NOTE: staking module is required if HistoricalEntries param > 0
- app.mm.SetOrderBeginBlockers(
- upgradetypes.ModuleName,
- capabilitytypes.ModuleName,
- minttypes.ModuleName,
- distrtypes.ModuleName,
- slashingtypes.ModuleName,
- evidencetypes.ModuleName,
- stakingtypes.ModuleName,
- authtypes.ModuleName,
- banktypes.ModuleName,
- govtypes.ModuleName,
- crisistypes.ModuleName,
- genutiltypes.ModuleName,
- authz.ModuleName,
- feegrant.ModuleName,
- paramstypes.ModuleName,
- vestingtypes.ModuleName,
+ // NOTE: capability module's beginblocker must come before any modules using capabilities (e.g. IBC)
+ app.ModuleManager.SetOrderBeginBlockers(
+ upgradetypes.ModuleName, capabilitytypes.ModuleName, minttypes.ModuleName, distrtypes.ModuleName, slashingtypes.ModuleName,
+ evidencetypes.ModuleName, stakingtypes.ModuleName,
+ authtypes.ModuleName, banktypes.ModuleName, govtypes.ModuleName, crisistypes.ModuleName, genutiltypes.ModuleName,
+ authz.ModuleName, feegrant.ModuleName, nft.ModuleName, group.ModuleName,
+ paramstypes.ModuleName, vestingtypes.ModuleName, consensusparamtypes.ModuleName,
// additional non simd modules
ibctransfertypes.ModuleName,
- ibchost.ModuleName,
+ ibcexported.ModuleName,
icatypes.ModuleName,
ibcfeetypes.ModuleName,
- intertxtypes.ModuleName,
wasm.ModuleName,
)
- app.mm.SetOrderEndBlockers(
- crisistypes.ModuleName,
- govtypes.ModuleName,
- stakingtypes.ModuleName,
- capabilitytypes.ModuleName,
- authtypes.ModuleName,
- banktypes.ModuleName,
- distrtypes.ModuleName,
- slashingtypes.ModuleName,
- minttypes.ModuleName,
- genutiltypes.ModuleName,
- evidencetypes.ModuleName,
- authz.ModuleName,
- feegrant.ModuleName,
- paramstypes.ModuleName,
- upgradetypes.ModuleName,
- vestingtypes.ModuleName,
+ app.ModuleManager.SetOrderEndBlockers(
+ crisistypes.ModuleName, govtypes.ModuleName, stakingtypes.ModuleName,
+ capabilitytypes.ModuleName, authtypes.ModuleName, banktypes.ModuleName, distrtypes.ModuleName,
+ slashingtypes.ModuleName, minttypes.ModuleName,
+ genutiltypes.ModuleName, evidencetypes.ModuleName, authz.ModuleName,
+ feegrant.ModuleName, nft.ModuleName, group.ModuleName,
+ paramstypes.ModuleName, upgradetypes.ModuleName, vestingtypes.ModuleName, consensusparamtypes.ModuleName,
// additional non simd modules
ibctransfertypes.ModuleName,
- ibchost.ModuleName,
+ ibcexported.ModuleName,
icatypes.ModuleName,
ibcfeetypes.ModuleName,
- intertxtypes.ModuleName,
wasm.ModuleName,
)
// NOTE: The genutils module must occur after staking so that pools are
// properly initialized with tokens from genesis accounts.
+ // NOTE: The genutils module must also occur after auth so that it can access the params from auth.
// NOTE: Capability module must occur first so that it can initialize any capabilities
// so that other modules that want to create or claim capabilities afterwards in InitChain
// can do so safely.
// NOTE: wasm module should be at the end as it can call other module functionality direct or via message dispatching during
// genesis phase. For example bank transfer, auth account check, staking, ...
- app.mm.SetOrderInitGenesis(
- capabilitytypes.ModuleName,
- authtypes.ModuleName,
- banktypes.ModuleName,
- distrtypes.ModuleName,
- stakingtypes.ModuleName,
- slashingtypes.ModuleName,
- govtypes.ModuleName,
- minttypes.ModuleName,
- crisistypes.ModuleName,
- genutiltypes.ModuleName,
- evidencetypes.ModuleName,
- authz.ModuleName,
- feegrant.ModuleName,
- paramstypes.ModuleName,
- upgradetypes.ModuleName,
- vestingtypes.ModuleName,
+ genesisModuleOrder := []string{
+ capabilitytypes.ModuleName, authtypes.ModuleName, banktypes.ModuleName,
+ distrtypes.ModuleName, stakingtypes.ModuleName, slashingtypes.ModuleName, govtypes.ModuleName,
+ minttypes.ModuleName, crisistypes.ModuleName, genutiltypes.ModuleName, evidencetypes.ModuleName, authz.ModuleName,
+ feegrant.ModuleName, nft.ModuleName, group.ModuleName, paramstypes.ModuleName, upgradetypes.ModuleName,
+ vestingtypes.ModuleName, consensusparamtypes.ModuleName,
// additional non simd modules
ibctransfertypes.ModuleName,
- ibchost.ModuleName,
+ ibcexported.ModuleName,
icatypes.ModuleName,
ibcfeetypes.ModuleName,
- intertxtypes.ModuleName,
// wasm after ibc transfer
wasm.ModuleName,
- )
+ }
+ app.ModuleManager.SetOrderInitGenesis(genesisModuleOrder...)
+ app.ModuleManager.SetOrderExportGenesis(genesisModuleOrder...)
// Uncomment if you want to set a custom migration order here.
- // app.mm.SetOrderMigrations(custom order)
-
- app.mm.RegisterInvariants(&app.CrisisKeeper)
- app.mm.RegisterRoutes(app.Router(), app.QueryRouter(), encodingConfig.Amino)
+ // app.ModuleManager.SetOrderMigrations(custom order)
+ app.ModuleManager.RegisterInvariants(app.CrisisKeeper)
app.configurator = module.NewConfigurator(app.appCodec, app.MsgServiceRouter(), app.GRPCQueryRouter())
- app.mm.RegisterServices(app.configurator)
+ app.ModuleManager.RegisterServices(app.configurator)
+
+ // RegisterUpgradeHandlers is used for registering any on-chain upgrades.
+ // Make sure it's called after `app.ModuleManager` and `app.configurator` are set.
+ app.RegisterUpgradeHandlers()
+
+ autocliv1.RegisterQueryServer(app.GRPCQueryRouter(), runtimeservices.NewAutoCLIQueryService(app.ModuleManager.Modules))
+
+ reflectionSvc, err := runtimeservices.NewReflectionService()
+ if err != nil {
+ panic(err)
+ }
+ reflectionv1.RegisterReflectionServiceServer(app.GRPCQueryRouter(), reflectionSvc)
+
+ // add test gRPC service for testing gRPC queries in isolation
+ // testdata_pulsar.RegisterQueryServer(app.GRPCQueryRouter(), testdata_pulsar.QueryImpl{})
// create the simulation manager and define the order of the modules for deterministic simulations
//
// NOTE: this is not required apps that don't use the simulator for fuzz testing
// transactions
- app.sm = module.NewSimulationManager(
- auth.NewAppModule(appCodec, app.AccountKeeper, authsims.RandomGenesisAccounts),
- bank.NewAppModule(appCodec, app.BankKeeper, app.AccountKeeper),
- capability.NewAppModule(appCodec, *app.CapabilityKeeper),
- feegrantmodule.NewAppModule(appCodec, app.AccountKeeper, app.BankKeeper, app.FeeGrantKeeper, app.interfaceRegistry),
- authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry),
- gov.NewAppModule(appCodec, app.GovKeeper, app.AccountKeeper, app.BankKeeper),
- mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper),
- staking.NewAppModule(appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper),
- distr.NewAppModule(appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper),
- slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper),
- params.NewAppModule(app.ParamsKeeper),
- evidence.NewAppModule(app.EvidenceKeeper),
- wasm.NewAppModule(appCodec, &app.WasmKeeper, app.StakingKeeper, app.AccountKeeper, app.BankKeeper),
- ibc.NewAppModule(app.IBCKeeper),
- transfer.NewAppModule(app.TransferKeeper),
- )
+ overrideModules := map[string]module.AppModuleSimulation{
+ authtypes.ModuleName: auth.NewAppModule(app.appCodec, app.AccountKeeper, authsims.RandomGenesisAccounts, app.GetSubspace(authtypes.ModuleName)),
+ }
+ app.sm = module.NewSimulationManagerFromAppModules(app.ModuleManager.Modules, overrideModules)
app.sm.RegisterStoreDecoders()
+
// initialize stores
app.MountKVStores(keys)
app.MountTransientStores(tkeys)
app.MountMemoryStores(memKeys)
- anteHandler, err := NewAnteHandler(
- HandlerOptions{
- HandlerOptions: ante.HandlerOptions{
- AccountKeeper: app.AccountKeeper,
- BankKeeper: app.BankKeeper,
- FeegrantKeeper: app.FeeGrantKeeper,
- SignModeHandler: encodingConfig.TxConfig.SignModeHandler(),
- SigGasConsumer: ante.DefaultSigVerificationGasConsumer,
- },
- IBCKeeper: app.IBCKeeper,
- WasmConfig: &wasmConfig,
- TXCounterStoreKey: keys[wasm.StoreKey],
- },
- )
- if err != nil {
- panic(fmt.Errorf("failed to create AnteHandler: %s", err))
- }
-
- app.SetAnteHandler(anteHandler)
+ // initialize BaseApp
app.SetInitChainer(app.InitChainer)
app.SetBeginBlocker(app.BeginBlocker)
app.SetEndBlocker(app.EndBlocker)
+ app.setAnteHandler(encodingConfig.TxConfig, wasmConfig, keys[wasm.StoreKey])
// must be before Loading version
// requires the snapshot store to be created and registered as a BaseAppOption
@@ -791,11 +806,31 @@ func NewWasmApp(
app.ScopedWasmKeeper = scopedWasmKeeper
app.ScopedICAHostKeeper = scopedICAHostKeeper
app.ScopedICAControllerKeeper = scopedICAControllerKeeper
- app.ScopedInterTxKeeper = scopedInterTxKeeper
+
+ // In v0.46, the SDK introduces _postHandlers_. PostHandlers are like
+ // antehandlers, but are run _after_ the `runMsgs` execution. They are also
+ // defined as a chain, and have the same signature as antehandlers.
+ //
+ // In baseapp, postHandlers are run in the same store branch as `runMsgs`,
+ // meaning that both `runMsgs` and `postHandler` state will be committed if
+ // both are successful, and both will be reverted if any of the two fails.
+ //
+ // The SDK exposes a default postHandlers chain, which comprises of only
+ // one decorator: the Transaction Tips decorator. However, some chains do
+ // not need it by default, so feel free to comment the next line if you do
+ // not need tips.
+ // To read more about tips:
+ // https://docs.cosmos.network/main/core/tips.html
+ //
+ // Please note that changing any of the anteHandler or postHandler chain is
+ // likely to be a state-machine breaking change, which needs a coordinated
+ // upgrade.
+ app.setPostHandler()
if loadLatest {
if err := app.LoadLatestVersion(); err != nil {
- tmos.Exit(fmt.Sprintf("failed to load latest version: %s", err))
+ logger.Error("error on loading last version", "err", err)
+ os.Exit(1)
}
ctx := app.BaseApp.NewUncachedContext(true, tmproto.Header{})
@@ -808,39 +843,63 @@ func NewWasmApp(
return app
}
-// Name returns the name of the App
-func (app *WasmApp) Name() string { return app.BaseApp.Name() }
-
-// ModuleManager returns instance
-func (app *WasmApp) ModuleManager() module.Manager {
- return *app.mm
+func (app *WasmApp) setAnteHandler(txConfig client.TxConfig, wasmConfig wasmtypes.WasmConfig, txCounterStoreKey storetypes.StoreKey) {
+ anteHandler, err := NewAnteHandler(
+ HandlerOptions{
+ HandlerOptions: ante.HandlerOptions{
+ AccountKeeper: app.AccountKeeper,
+ BankKeeper: app.BankKeeper,
+ SignModeHandler: txConfig.SignModeHandler(),
+ FeegrantKeeper: app.FeeGrantKeeper,
+ SigGasConsumer: ante.DefaultSigVerificationGasConsumer,
+ },
+ IBCKeeper: app.IBCKeeper,
+ WasmConfig: &wasmConfig,
+ TXCounterStoreKey: txCounterStoreKey,
+ },
+ )
+ if err != nil {
+ panic(fmt.Errorf("failed to create AnteHandler: %s", err))
+ }
+ app.SetAnteHandler(anteHandler)
}
-// ModuleConfigurator returns instance
-func (app *WasmApp) ModuleConfigurator() module.Configurator {
- return app.configurator
+func (app *WasmApp) setPostHandler() {
+ postHandler, err := posthandler.NewPostHandler(
+ posthandler.HandlerOptions{},
+ )
+ if err != nil {
+ panic(err)
+ }
+
+ app.SetPostHandler(postHandler)
}
+// Name returns the name of the App
+func (app *WasmApp) Name() string { return app.BaseApp.Name() }
+
// BeginBlocker application updates every begin block
func (app *WasmApp) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock {
- return app.mm.BeginBlock(ctx, req)
+ return app.ModuleManager.BeginBlock(ctx, req)
}
// EndBlocker application updates every end block
func (app *WasmApp) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock {
- return app.mm.EndBlock(ctx, req)
+ return app.ModuleManager.EndBlock(ctx, req)
+}
+
+func (app *WasmApp) Configurator() module.Configurator {
+ return app.configurator
}
// InitChainer application update at chain initialization
func (app *WasmApp) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain {
var genesisState GenesisState
- if err := tmjson.Unmarshal(req.AppStateBytes, &genesisState); err != nil {
+ if err := json.Unmarshal(req.AppStateBytes, &genesisState); err != nil {
panic(err)
}
-
- app.UpgradeKeeper.SetModuleVersionMap(ctx, app.mm.GetVersionMap())
-
- return app.mm.InitGenesis(ctx, app.appCodec, genesisState)
+ app.UpgradeKeeper.SetModuleVersionMap(ctx, app.ModuleManager.GetVersionMap())
+ return app.ModuleManager.InitGenesis(ctx, app.appCodec, genesisState)
}
// LoadHeight loads a particular height
@@ -848,28 +907,62 @@ func (app *WasmApp) LoadHeight(height int64) error {
return app.LoadVersion(height)
}
-// ModuleAccountAddrs returns all the app's module account addresses.
-func (app *WasmApp) ModuleAccountAddrs() map[string]bool {
- modAccAddrs := make(map[string]bool)
- for acc := range maccPerms {
- modAccAddrs[authtypes.NewModuleAddress(acc).String()] = true
- }
-
- return modAccAddrs
-}
-
// LegacyAmino returns legacy amino codec.
//
// NOTE: This is solely to be used for testing purposes as it may be desirable
// for modules to register their own custom testing types.
-func (app *WasmApp) LegacyAmino() *codec.LegacyAmino { //nolint:staticcheck
+func (app *WasmApp) LegacyAmino() *codec.LegacyAmino {
return app.legacyAmino
}
-// getSubspace returns a param subspace for a given module name.
+// AppCodec returns app codec.
+//
+// NOTE: This is solely to be used for testing purposes as it may be desirable
+// for modules to register their own custom testing types.
+func (app *WasmApp) AppCodec() codec.Codec {
+ return app.appCodec
+}
+
+// InterfaceRegistry returns WasmApp's InterfaceRegistry
+func (app *WasmApp) InterfaceRegistry() types.InterfaceRegistry {
+ return app.interfaceRegistry
+}
+
+// TxConfig returns WasmApp's TxConfig
+func (app *WasmApp) TxConfig() client.TxConfig {
+ return app.txConfig
+}
+
+// DefaultGenesis returns a default genesis from the registered AppModuleBasic's.
+func (app *WasmApp) DefaultGenesis() map[string]json.RawMessage {
+ return ModuleBasics.DefaultGenesis(app.appCodec)
+}
+
+// GetKey returns the KVStoreKey for the provided store key.
+//
+// NOTE: This is solely to be used for testing purposes.
+func (app *WasmApp) GetKey(storeKey string) *storetypes.KVStoreKey {
+ return app.keys[storeKey]
+}
+
+// GetTKey returns the TransientStoreKey for the provided store key.
+//
+// NOTE: This is solely to be used for testing purposes.
+func (app *WasmApp) GetTKey(storeKey string) *storetypes.TransientStoreKey {
+ return app.tkeys[storeKey]
+}
+
+// GetMemKey returns the MemStoreKey for the provided mem key.
+//
+// NOTE: This is solely used for testing purposes.
+func (app *WasmApp) GetMemKey(storeKey string) *storetypes.MemoryStoreKey {
+ return app.memKeys[storeKey]
+}
+
+// GetSubspace returns a param subspace for a given module name.
//
// NOTE: This is solely to be used for testing purposes.
-func (app *WasmApp) getSubspace(moduleName string) paramstypes.Subspace {
+func (app *WasmApp) GetSubspace(moduleName string) paramstypes.Subspace {
subspace, _ := app.ParamsKeeper.GetSubspace(moduleName)
return subspace
}
@@ -883,21 +976,21 @@ func (app *WasmApp) SimulationManager() *module.SimulationManager {
// API server.
func (app *WasmApp) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig) {
clientCtx := apiSvr.ClientCtx
- rpc.RegisterRoutes(clientCtx, apiSvr.Router)
- // Register legacy tx routes.
- authrest.RegisterTxRoutes(clientCtx, apiSvr.Router)
// Register new tx routes from grpc-gateway.
authtx.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter)
+
// Register new tendermint queries routes from grpc-gateway.
tmservice.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter)
- // Register legacy and grpc-gateway routes for all modules.
- ModuleBasics.RegisterRESTRoutes(clientCtx, apiSvr.Router)
+ // Register node gRPC service for grpc-gateway.
+ nodeservice.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter)
+
+ // Register grpc-gateway routes for all modules.
ModuleBasics.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter)
// register swagger API from root so that other applications can override easily
- if apiConfig.Swagger {
- RegisterSwaggerAPI(apiSvr.Router)
+ if err := server.RegisterSwaggerAPI(apiSvr.ClientCtx, apiSvr.Router, apiConfig.Swagger); err != nil {
+ panic(err)
}
}
@@ -908,35 +1001,45 @@ func (app *WasmApp) RegisterTxService(clientCtx client.Context) {
// RegisterTendermintService implements the Application.RegisterTendermintService method.
func (app *WasmApp) RegisterTendermintService(clientCtx client.Context) {
- tmservice.RegisterTendermintService(app.BaseApp.GRPCQueryRouter(), clientCtx, app.interfaceRegistry)
+ tmservice.RegisterTendermintService(
+ clientCtx,
+ app.BaseApp.GRPCQueryRouter(),
+ app.interfaceRegistry,
+ app.Query,
+ )
}
-func (app *WasmApp) AppCodec() codec.Codec {
- return app.appCodec
-}
-
-// RegisterSwaggerAPI registers swagger route with API Server
-func RegisterSwaggerAPI(rtr *mux.Router) {
- statikFS, err := fs.New()
- if err != nil {
- panic(err)
- }
-
- staticServer := http.FileServer(statikFS)
- rtr.PathPrefix("/swagger/").Handler(http.StripPrefix("/swagger/", staticServer))
+func (app *WasmApp) RegisterNodeService(clientCtx client.Context) {
+ nodeservice.RegisterNodeService(clientCtx, app.GRPCQueryRouter())
}
// GetMaccPerms returns a copy of the module account permissions
+//
+// NOTE: This is solely to be used for testing purposes.
func GetMaccPerms() map[string][]string {
dupMaccPerms := make(map[string][]string)
for k, v := range maccPerms {
dupMaccPerms[k] = v
}
+
return dupMaccPerms
}
+// BlockedAddresses returns all the app's blocked account addresses.
+func BlockedAddresses() map[string]bool {
+ modAccAddrs := make(map[string]bool)
+ for acc := range GetMaccPerms() {
+ modAccAddrs[authtypes.NewModuleAddress(acc).String()] = true
+ }
+
+ // allow the following addresses to receive funds
+ delete(modAccAddrs, authtypes.NewModuleAddress(govtypes.ModuleName).String())
+
+ return modAccAddrs
+}
+
// initParamsKeeper init params keeper and its subspaces
-func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino, key, tkey sdk.StoreKey) paramskeeper.Keeper {
+func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino, key, tkey storetypes.StoreKey) paramskeeper.Keeper {
paramsKeeper := paramskeeper.NewKeeper(appCodec, legacyAmino, key, tkey)
paramsKeeper.Subspace(authtypes.ModuleName)
@@ -945,10 +1048,10 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
paramsKeeper.Subspace(minttypes.ModuleName)
paramsKeeper.Subspace(distrtypes.ModuleName)
paramsKeeper.Subspace(slashingtypes.ModuleName)
- paramsKeeper.Subspace(govtypes.ModuleName).WithKeyTable(govtypes.ParamKeyTable())
+ paramsKeeper.Subspace(govtypes.ModuleName)
paramsKeeper.Subspace(crisistypes.ModuleName)
paramsKeeper.Subspace(ibctransfertypes.ModuleName)
- paramsKeeper.Subspace(ibchost.ModuleName)
+ paramsKeeper.Subspace(ibcexported.ModuleName)
paramsKeeper.Subspace(icahosttypes.SubModuleName)
paramsKeeper.Subspace(icacontrollertypes.SubModuleName)
paramsKeeper.Subspace(wasm.ModuleName)
diff --git a/app/app_test.go b/app/app_test.go
index 9a5ec80f88..dbcae4ee34 100644
--- a/app/app_test.go
+++ b/app/app_test.go
@@ -1,55 +1,49 @@
package app
import (
- "encoding/json"
"os"
"testing"
+ dbm "github.com/cometbft/cometbft-db"
+ "github.com/cometbft/cometbft/libs/log"
+ simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
+ sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
- "github.com/tendermint/tendermint/libs/log"
- db "github.com/tendermint/tm-db"
-
- abci "github.com/tendermint/tendermint/abci/types"
"github.com/CosmWasm/wasmd/x/wasm"
)
-var emptyWasmOpts []wasm.Option = nil
+var emptyWasmOpts []wasm.Option
func TestWasmdExport(t *testing.T) {
- db := db.NewMemDB()
- gapp := NewWasmApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, map[int64]bool{}, DefaultNodeHome, 0, MakeEncodingConfig(), wasm.EnableAllProposals, EmptyBaseAppOptions{}, emptyWasmOpts)
-
- genesisState := NewDefaultGenesisState()
- stateBytes, err := json.MarshalIndent(genesisState, "", " ")
- require.NoError(t, err)
-
- // Initialize the chain
- gapp.InitChain(
- abci.RequestInitChain{
- Validators: []abci.ValidatorUpdate{},
- AppStateBytes: stateBytes,
- },
- )
+ db := dbm.NewMemDB()
+ gapp := NewWasmAppWithCustomOptions(t, false, SetupOptions{
+ Logger: log.NewTMLogger(log.NewSyncWriter(os.Stdout)),
+ DB: db,
+ AppOpts: simtestutil.NewAppOptionsWithFlagHome(t.TempDir()),
+ })
gapp.Commit()
// Making a new app object with the db, so that initchain hasn't been called
- newGapp := NewWasmApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, map[int64]bool{}, DefaultNodeHome, 0, MakeEncodingConfig(), wasm.EnableAllProposals, EmptyBaseAppOptions{}, emptyWasmOpts)
- _, err = newGapp.ExportAppStateAndValidators(false, []string{})
+ newGapp := NewWasmApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, wasm.EnableAllProposals, simtestutil.NewAppOptionsWithFlagHome(t.TempDir()), emptyWasmOpts)
+ _, err := newGapp.ExportAppStateAndValidators(false, []string{}, nil)
require.NoError(t, err, "ExportAppStateAndValidators should not have an error")
}
// ensure that blocked addresses are properly set in bank keeper
func TestBlockedAddrs(t *testing.T) {
- db := db.NewMemDB()
- gapp := NewWasmApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, map[int64]bool{}, DefaultNodeHome, 0, MakeEncodingConfig(), wasm.EnableAllProposals, EmptyBaseAppOptions{}, emptyWasmOpts)
+ gapp := Setup(t)
- for acc := range maccPerms {
+ for acc := range BlockedAddresses() {
t.Run(acc, func(t *testing.T) {
- require.True(t, gapp.BankKeeper.BlockedAddr(gapp.AccountKeeper.GetModuleAddress(acc)),
- "ensure that blocked addresses are properly set in bank keeper",
- )
+ var addr sdk.AccAddress
+ if modAddr, err := sdk.AccAddressFromBech32(acc); err == nil {
+ addr = modAddr
+ } else {
+ addr = gapp.AccountKeeper.GetModuleAddress(acc)
+ }
+ require.True(t, gapp.BankKeeper.BlockedAddr(addr), "ensure that blocked addresses are properly set in bank keeper")
})
}
}
@@ -89,22 +83,3 @@ func TestGetEnabledProposals(t *testing.T) {
})
}
}
-
-func setGenesis(gapp *WasmApp) error {
- genesisState := NewDefaultGenesisState()
- stateBytes, err := json.MarshalIndent(genesisState, "", " ")
- if err != nil {
- return err
- }
-
- // Initialize the chain
- gapp.InitChain(
- abci.RequestInitChain{
- Validators: []abci.ValidatorUpdate{},
- AppStateBytes: stateBytes,
- },
- )
-
- gapp.Commit()
- return nil
-}
diff --git a/app/export.go b/app/export.go
index c494a9b6da..74c69db60c 100644
--- a/app/export.go
+++ b/app/export.go
@@ -2,9 +2,10 @@ package app
import (
"encoding/json"
+ "fmt"
"log"
- tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
+ tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
servertypes "github.com/cosmos/cosmos-sdk/server/types"
sdk "github.com/cosmos/cosmos-sdk/types"
@@ -15,9 +16,7 @@ import (
// ExportAppStateAndValidators exports the state of the application for a genesis
// file.
-func (app *WasmApp) ExportAppStateAndValidators(
- forZeroHeight bool, jailAllowedAddrs []string,
-) (servertypes.ExportedApp, error) {
+func (app *WasmApp) ExportAppStateAndValidators(forZeroHeight bool, jailAllowedAddrs []string, modulesToExport []string) (servertypes.ExportedApp, error) {
// as if they could withdraw from the start of the next block
ctx := app.NewContext(true, tmproto.Header{Height: app.LastBlockHeight()})
@@ -29,7 +28,7 @@ func (app *WasmApp) ExportAppStateAndValidators(
app.prepForZeroHeightGenesis(ctx, jailAllowedAddrs)
}
- genState := app.mm.ExportGenesis(ctx, app.appCodec)
+ genState := app.ModuleManager.ExportGenesisForModules(ctx, app.appCodec, modulesToExport)
appState, err := json.MarshalIndent(genState, "", " ")
if err != nil {
return servertypes.ExportedApp{}, err
@@ -73,7 +72,7 @@ func (app *WasmApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs [
// withdraw all validator commission
app.StakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) {
- _, _ = app.DistrKeeper.WithdrawValidatorCommission(ctx, val.GetOperator()) //nolint:errcheck
+ _, _ = app.DistrKeeper.WithdrawValidatorCommission(ctx, val.GetOperator())
return false
})
@@ -85,11 +84,11 @@ func (app *WasmApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs [
panic(err)
}
- delAddr, err := sdk.AccAddressFromBech32(delegation.DelegatorAddress)
- if err != nil {
+ delAddr := sdk.MustAccAddressFromBech32(delegation.DelegatorAddress)
+
+ if _, err = app.DistrKeeper.WithdrawDelegationRewards(ctx, delAddr, valAddr); err != nil {
panic(err)
}
- _, _ = app.DistrKeeper.WithdrawDelegationRewards(ctx, delAddr, valAddr) //nolint:errcheck
}
// clear validator slash events
@@ -110,7 +109,9 @@ func (app *WasmApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs [
feePool.CommunityPool = feePool.CommunityPool.Add(scraps...)
app.DistrKeeper.SetFeePool(ctx, feePool)
- app.DistrKeeper.Hooks().AfterValidatorCreated(ctx, val.GetOperator())
+ if err := app.DistrKeeper.Hooks().AfterValidatorCreated(ctx, val.GetOperator()); err != nil {
+ panic(err)
+ }
return false
})
@@ -120,12 +121,17 @@ func (app *WasmApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs [
if err != nil {
panic(err)
}
- delAddr, err := sdk.AccAddressFromBech32(del.DelegatorAddress)
- if err != nil {
- panic(err)
+ delAddr := sdk.MustAccAddressFromBech32(del.DelegatorAddress)
+
+ if err := app.DistrKeeper.Hooks().BeforeDelegationCreated(ctx, delAddr, valAddr); err != nil {
+ // never called as BeforeDelegationCreated always returns nil
+ panic(fmt.Errorf("error while incrementing period: %w", err))
+ }
+
+ if err := app.DistrKeeper.Hooks().AfterDelegationModified(ctx, delAddr, valAddr); err != nil {
+ // never called as AfterDelegationModified always returns nil
+ panic(fmt.Errorf("error while creating a new delegation period record: %w", err))
}
- app.DistrKeeper.Hooks().BeforeDelegationCreated(ctx, delAddr, valAddr)
- app.DistrKeeper.Hooks().AfterDelegationModified(ctx, delAddr, valAddr)
}
// reset context height
@@ -153,12 +159,12 @@ func (app *WasmApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs [
// Iterate through validators by power descending, reset bond heights, and
// update bond intra-tx counters.
- store := ctx.KVStore(app.keys[stakingtypes.StoreKey])
+ store := ctx.KVStore(app.GetKey(stakingtypes.StoreKey))
iter := sdk.KVStoreReversePrefixIterator(store, stakingtypes.ValidatorsKey)
counter := int16(0)
for ; iter.Valid(); iter.Next() {
- addr := sdk.ValAddress(iter.Key()[1:])
+ addr := sdk.ValAddress(stakingtypes.AddressFromValidatorsKey(iter.Key()))
validator, found := app.StakingKeeper.GetValidator(ctx, addr)
if !found {
panic("expected validator, not found")
@@ -173,7 +179,10 @@ func (app *WasmApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs [
counter++
}
- iter.Close()
+ if err := iter.Close(); err != nil {
+ app.Logger().Error("error while closing the key-value store reverse prefix iterator: ", err)
+ return
+ }
_, err := app.StakingKeeper.ApplyAndReturnValidatorSetUpdates(ctx)
if err != nil {
diff --git a/app/genesis.go b/app/genesis.go
index 622c15d326..2900679c12 100644
--- a/app/genesis.go
+++ b/app/genesis.go
@@ -2,9 +2,11 @@ package app
import (
"encoding/json"
+
+ "github.com/cosmos/cosmos-sdk/codec"
)
-// GenesisState The genesis state of the blockchain is represented here as a map of raw json
+// GenesisState of the blockchain is represented here as a map of raw json
// messages key'd by a identifier string.
// The identifier is used to determine which module genesis information belongs
// to so it may be appropriately routed during init chain.
@@ -14,7 +16,6 @@ import (
type GenesisState map[string]json.RawMessage
// NewDefaultGenesisState generates the default state for the application.
-func NewDefaultGenesisState() GenesisState {
- encodingConfig := MakeEncodingConfig()
- return ModuleBasics.DefaultGenesis(encodingConfig.Marshaler)
+func NewDefaultGenesisState(cdc codec.JSONCodec) GenesisState {
+ return ModuleBasics.DefaultGenesis(cdc)
}
diff --git a/app/params/params.go b/app/params/params.go
deleted file mode 100644
index b6aa5fb55e..0000000000
--- a/app/params/params.go
+++ /dev/null
@@ -1,7 +0,0 @@
-package params
-
-// Simulation parameter constants
-const (
- StakePerAccount = "stake_per_account"
- InitiallyBondedValidators = "initially_bonded_validators"
-)
diff --git a/app/sim_test.go b/app/sim_test.go
index 5e206064e6..ce3e9a09ca 100644
--- a/app/sim_test.go
+++ b/app/sim_test.go
@@ -3,17 +3,23 @@ package app
import (
"encoding/json"
"fmt"
+ "math/rand"
"os"
- "path/filepath"
+ "runtime/debug"
+ "strings"
"testing"
- "time"
+ dbm "github.com/cometbft/cometbft-db"
+ abci "github.com/cometbft/cometbft/abci/types"
+ "github.com/cometbft/cometbft/libs/log"
+ tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
"github.com/cosmos/cosmos-sdk/baseapp"
- "github.com/cosmos/cosmos-sdk/codec"
- "github.com/cosmos/cosmos-sdk/simapp"
+ "github.com/cosmos/cosmos-sdk/client/flags"
+ "github.com/cosmos/cosmos-sdk/server"
+ "github.com/cosmos/cosmos-sdk/store"
+ storetypes "github.com/cosmos/cosmos-sdk/store/types"
+ simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
sdk "github.com/cosmos/cosmos-sdk/types"
- "github.com/cosmos/cosmos-sdk/types/kv"
- "github.com/cosmos/cosmos-sdk/types/module"
simtypes "github.com/cosmos/cosmos-sdk/types/simulation"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
authzkeeper "github.com/cosmos/cosmos-sdk/x/authz/keeper"
@@ -21,179 +27,154 @@ import (
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types"
- "github.com/cosmos/cosmos-sdk/x/feegrant"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
- paramstypes "github.com/cosmos/cosmos-sdk/x/params/types"
+ paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
"github.com/cosmos/cosmos-sdk/x/simulation"
+ simcli "github.com/cosmos/cosmos-sdk/x/simulation/client/cli"
slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
- ibctransfertypes "github.com/cosmos/ibc-go/v4/modules/apps/transfer/types"
- ibchost "github.com/cosmos/ibc-go/v4/modules/core/24-host"
"github.com/stretchr/testify/require"
- "github.com/tendermint/tendermint/libs/log"
- tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
- dbm "github.com/tendermint/tm-db"
"github.com/CosmWasm/wasmd/x/wasm"
- wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
)
+// SimAppChainID hardcoded chainID for simulation
+const SimAppChainID = "simulation-app"
+
// Get flags every time the simulator is run
func init() {
- simapp.GetSimulatorFlags()
+ simcli.GetSimulatorFlags()
}
type StoreKeysPrefixes struct {
- A sdk.StoreKey
- B sdk.StoreKey
+ A storetypes.StoreKey
+ B storetypes.StoreKey
Prefixes [][]byte
}
-// SetupSimulation wraps simapp.SetupSimulation in order to create any export directory if they do not exist yet
-func SetupSimulation(dirPrefix, dbName string) (simtypes.Config, dbm.DB, string, log.Logger, bool, error) {
- config, db, dir, logger, skip, err := simapp.SetupSimulation(dirPrefix, dbName)
- if err != nil {
- return simtypes.Config{}, nil, "", nil, false, err
- }
-
- paths := []string{config.ExportParamsPath, config.ExportStatePath, config.ExportStatsPath}
- for _, path := range paths {
- if len(path) == 0 {
- continue
- }
-
- path = filepath.Dir(path)
- if _, err := os.Stat(path); os.IsNotExist(err) {
- if err := os.MkdirAll(path, os.ModePerm); err != nil {
- panic(err)
- }
- }
- }
-
- return config, db, dir, logger, skip, err
-}
-
-// GetSimulationLog unmarshals the KVPair's Value to the corresponding type based on the
-// each's module store key and the prefix bytes of the KVPair's key.
-func GetSimulationLog(storeName string, sdr sdk.StoreDecoderRegistry, kvAs, kvBs []kv.Pair) (log string) {
- for i := 0; i < len(kvAs); i++ {
- if len(kvAs[i].Value) == 0 && len(kvBs[i].Value) == 0 {
- // skip if the value doesn't have any bytes
- continue
- }
-
- decoder, ok := sdr[storeName]
- if ok {
- log += decoder(kvAs[i], kvBs[i])
- } else {
- log += fmt.Sprintf("store A %q => %q\nstore B %q => %q\n", kvAs[i].Key, kvAs[i].Value, kvBs[i].Key, kvBs[i].Value)
- }
- }
-
- return log
-}
-
// fauxMerkleModeOpt returns a BaseApp option to use a dbStoreAdapter instead of
// an IAVLStore for faster simulation speed.
func fauxMerkleModeOpt(bapp *baseapp.BaseApp) {
bapp.SetFauxMerkleMode()
}
-func TestAppImportExport(t *testing.T) {
- config, db, dir, logger, skip, err := SetupSimulation("leveldb-app-sim", "Simulation")
- if skip {
- t.Skip("skipping application import/export simulation")
- }
- require.NoError(t, err, "simulation setup failed")
+// interBlockCacheOpt returns a BaseApp option function that sets the persistent
+// inter-block write-through cache.
+func interBlockCacheOpt() func(*baseapp.BaseApp) {
+ return baseapp.SetInterBlockCache(store.NewCommitKVStoreCacheManager())
+}
- defer func() {
- db.Close()
- require.NoError(t, os.RemoveAll(dir))
- }()
+func TestFullAppSimulation(t *testing.T) {
+ config, db, _, app := setupSimulationApp(t, "skipping application simulation")
+ // run randomized simulation
+ _, simParams, simErr := simulation.SimulateFromSeed(
+ t,
+ os.Stdout,
+ app.BaseApp,
+ simtestutil.AppStateFn(app.AppCodec(), app.SimulationManager(), app.DefaultGenesis()),
+ simtypes.RandomAccounts, // Replace with own random account function if using keys other than secp256k1
+ simtestutil.SimulationOperations(app, app.AppCodec(), config),
+ BlockedAddresses(),
+ config,
+ app.AppCodec(),
+ )
- encConf := MakeEncodingConfig()
- app := NewWasmApp(logger, db, nil, true, map[int64]bool{}, dir, simapp.FlagPeriodValue, encConf, wasm.EnableAllProposals, EmptyBaseAppOptions{}, nil, fauxMerkleModeOpt)
- require.Equal(t, appName, app.Name())
+ // export state and simParams before the simulation error is checked
+ err := simtestutil.CheckExportSimulation(app, config, simParams)
+ require.NoError(t, err)
+ require.NoError(t, simErr)
+
+ if config.Commit {
+ simtestutil.PrintStats(db)
+ }
+}
+
+func TestAppImportExport(t *testing.T) {
+ config, db, appOptions, app := setupSimulationApp(t, "skipping application import/export simulation")
// Run randomized simulation
_, simParams, simErr := simulation.SimulateFromSeed(
t,
os.Stdout,
app.BaseApp,
- AppStateFn(app.AppCodec(), app.SimulationManager()),
- simtypes.RandomAccounts,
- simapp.SimulationOperations(app, app.AppCodec(), config),
- app.ModuleAccountAddrs(),
+ simtestutil.AppStateFn(app.AppCodec(), app.SimulationManager(), app.DefaultGenesis()),
+ simtypes.RandomAccounts, // Replace with own random account function if using keys other than secp256k1
+ simtestutil.SimulationOperations(app, app.AppCodec(), config),
+ BlockedAddresses(),
config,
app.AppCodec(),
)
// export state and simParams before the simulation error is checked
- err = simapp.CheckExportSimulation(app, config, simParams)
+ err := simtestutil.CheckExportSimulation(app, config, simParams)
require.NoError(t, err)
require.NoError(t, simErr)
if config.Commit {
- simapp.PrintStats(db)
+ simtestutil.PrintStats(db)
}
- t.Log("exporting genesis...")
+ fmt.Printf("exporting genesis...\n")
- exported, err := app.ExportAppStateAndValidators(false, []string{})
+ exported, err := app.ExportAppStateAndValidators(false, []string{}, []string{})
require.NoError(t, err)
- t.Log("importing genesis...")
+ fmt.Printf("importing genesis...\n")
- _, newDB, newDir, _, _, err := SetupSimulation("leveldb-app-sim-2", "Simulation-2")
+ newDB, newDir, _, _, err := simtestutil.SetupSimulation(config, "leveldb-app-sim-2", "Simulation-2", simcli.FlagVerboseValue, simcli.FlagEnabledValue)
require.NoError(t, err, "simulation setup failed")
defer func() {
- newDB.Close()
+ require.NoError(t, newDB.Close())
require.NoError(t, os.RemoveAll(newDir))
}()
- newApp := NewWasmApp(logger, newDB, nil, true, map[int64]bool{}, newDir, simapp.FlagPeriodValue, encConf, wasm.EnableAllProposals, EmptyBaseAppOptions{}, nil, fauxMerkleModeOpt)
- require.Equal(t, appName, newApp.Name())
+
+ newApp := NewWasmApp(log.NewNopLogger(), newDB, nil, true, wasm.EnableAllProposals, appOptions, emptyWasmOpts, fauxMerkleModeOpt, baseapp.SetChainID(SimAppChainID))
+ require.Equal(t, "WasmApp", newApp.Name())
var genesisState GenesisState
err = json.Unmarshal(exported.AppState, &genesisState)
require.NoError(t, err)
+ defer func() {
+ if r := recover(); r != nil {
+ err := fmt.Sprintf("%v", r)
+ if !strings.Contains(err, "validator set is empty after InitGenesis") {
+ panic(r)
+ }
+ t.Log("Skipping simulation as all validators have been unbonded")
+ t.Logf("err: %s stacktrace: %s\n", err, string(debug.Stack()))
+ }
+ }()
+
ctxA := app.NewContext(true, tmproto.Header{Height: app.LastBlockHeight()})
ctxB := newApp.NewContext(true, tmproto.Header{Height: app.LastBlockHeight()})
- newApp.mm.InitGenesis(ctxB, app.AppCodec(), genesisState)
+ newApp.ModuleManager.InitGenesis(ctxB, app.AppCodec(), genesisState)
newApp.StoreConsensusParams(ctxB, exported.ConsensusParams)
- t.Log("comparing stores...")
+ fmt.Printf("comparing stores...\n")
storeKeysPrefixes := []StoreKeysPrefixes{
- {app.keys[authtypes.StoreKey], newApp.keys[authtypes.StoreKey], [][]byte{}},
+ {app.GetKey(authtypes.StoreKey), newApp.GetKey(authtypes.StoreKey), [][]byte{}},
{
- app.keys[stakingtypes.StoreKey], newApp.keys[stakingtypes.StoreKey],
+ app.GetKey(stakingtypes.StoreKey), newApp.GetKey(stakingtypes.StoreKey),
[][]byte{
stakingtypes.UnbondingQueueKey, stakingtypes.RedelegationQueueKey, stakingtypes.ValidatorQueueKey,
- stakingtypes.HistoricalInfoKey,
+ stakingtypes.HistoricalInfoKey, stakingtypes.UnbondingIDKey, stakingtypes.UnbondingIndexKey, stakingtypes.UnbondingTypeKey, stakingtypes.ValidatorUpdatesKey,
},
- },
- {app.keys[slashingtypes.StoreKey], newApp.keys[slashingtypes.StoreKey], [][]byte{}},
- {app.keys[minttypes.StoreKey], newApp.keys[minttypes.StoreKey], [][]byte{}},
- {app.keys[distrtypes.StoreKey], newApp.keys[distrtypes.StoreKey], [][]byte{}},
- {app.keys[banktypes.StoreKey], newApp.keys[banktypes.StoreKey], [][]byte{banktypes.BalancesPrefix}},
- {app.keys[paramstypes.StoreKey], newApp.keys[paramstypes.StoreKey], [][]byte{}},
- {app.keys[govtypes.StoreKey], newApp.keys[govtypes.StoreKey], [][]byte{}},
- {app.keys[evidencetypes.StoreKey], newApp.keys[evidencetypes.StoreKey], [][]byte{}},
- {app.keys[capabilitytypes.StoreKey], newApp.keys[capabilitytypes.StoreKey], [][]byte{}},
- {app.keys[ibchost.StoreKey], newApp.keys[ibchost.StoreKey], [][]byte{}},
- {app.keys[ibctransfertypes.StoreKey], newApp.keys[ibctransfertypes.StoreKey], [][]byte{}},
- {app.keys[authzkeeper.StoreKey], newApp.keys[authzkeeper.StoreKey], [][]byte{}},
- {app.keys[feegrant.StoreKey], newApp.keys[feegrant.StoreKey], [][]byte{}},
- {app.keys[wasm.StoreKey], newApp.keys[wasm.StoreKey], [][]byte{}},
+ }, // ordering may change but it doesn't matter
+ {app.GetKey(slashingtypes.StoreKey), newApp.GetKey(slashingtypes.StoreKey), [][]byte{}},
+ {app.GetKey(minttypes.StoreKey), newApp.GetKey(minttypes.StoreKey), [][]byte{}},
+ {app.GetKey(distrtypes.StoreKey), newApp.GetKey(distrtypes.StoreKey), [][]byte{}},
+ {app.GetKey(banktypes.StoreKey), newApp.GetKey(banktypes.StoreKey), [][]byte{banktypes.BalancesPrefix}},
+ {app.GetKey(paramtypes.StoreKey), newApp.GetKey(paramtypes.StoreKey), [][]byte{}},
+ {app.GetKey(govtypes.StoreKey), newApp.GetKey(govtypes.StoreKey), [][]byte{}},
+ {app.GetKey(evidencetypes.StoreKey), newApp.GetKey(evidencetypes.StoreKey), [][]byte{}},
+ {app.GetKey(capabilitytypes.StoreKey), newApp.GetKey(capabilitytypes.StoreKey), [][]byte{}},
+ {app.GetKey(authzkeeper.StoreKey), newApp.GetKey(authzkeeper.StoreKey), [][]byte{authzkeeper.GrantKey, authzkeeper.GrantQueuePrefix}},
}
- // delete persistent tx counter value
- ctxA.KVStore(app.keys[wasm.StoreKey]).Delete(wasmtypes.TXCounterPrefix)
-
- // diff both stores
for _, skp := range storeKeysPrefixes {
storeA := ctxA.KVStore(skp.A)
storeB := ctxB.KVStore(skp.B)
@@ -201,58 +182,169 @@ func TestAppImportExport(t *testing.T) {
failedKVAs, failedKVBs := sdk.DiffKVStores(storeA, storeB, skp.Prefixes)
require.Equal(t, len(failedKVAs), len(failedKVBs), "unequal sets of key-values to compare")
- t.Logf("compared %d different key/value pairs between %s and %s\n", len(failedKVAs), skp.A, skp.B)
- require.Len(t, failedKVAs, 0, GetSimulationLog(skp.A.Name(), app.SimulationManager().StoreDecoders, failedKVAs, failedKVBs))
+ fmt.Printf("compared %d different key/value pairs between %s and %s\n", len(failedKVAs), skp.A, skp.B)
+ require.Equal(t, 0, len(failedKVAs), simtestutil.GetSimulationLog(skp.A.Name(), app.SimulationManager().StoreDecoders, failedKVAs, failedKVBs))
}
}
-func TestFullAppSimulation(t *testing.T) {
- config, db, dir, logger, skip, err := SetupSimulation("leveldb-app-sim", "Simulation")
- if skip {
- t.Skip("skipping application simulation")
- }
- require.NoError(t, err, "simulation setup failed")
-
- defer func() {
- db.Close()
- require.NoError(t, os.RemoveAll(dir))
- }()
- encConf := MakeEncodingConfig()
- app := NewWasmApp(logger, db, nil, true, map[int64]bool{}, t.TempDir(), simapp.FlagPeriodValue,
- encConf, wasm.EnableAllProposals, simapp.EmptyAppOptions{}, nil, fauxMerkleModeOpt)
- require.Equal(t, "WasmApp", app.Name())
+func TestAppSimulationAfterImport(t *testing.T) {
+ config, db, appOptions, app := setupSimulationApp(t, "skipping application simulation after import")
- // run randomized simulation
- _, simParams, simErr := simulation.SimulateFromSeed(
+ // Run randomized simulation
+ stopEarly, simParams, simErr := simulation.SimulateFromSeed(
t,
os.Stdout,
app.BaseApp,
- AppStateFn(app.appCodec, app.SimulationManager()),
+ simtestutil.AppStateFn(app.AppCodec(), app.SimulationManager(), app.DefaultGenesis()),
simtypes.RandomAccounts, // Replace with own random account function if using keys other than secp256k1
- simapp.SimulationOperations(app, app.AppCodec(), config),
- app.ModuleAccountAddrs(),
+ simtestutil.SimulationOperations(app, app.AppCodec(), config),
+ BlockedAddresses(),
config,
app.AppCodec(),
)
// export state and simParams before the simulation error is checked
- err = simapp.CheckExportSimulation(app, config, simParams)
+ err := simtestutil.CheckExportSimulation(app, config, simParams)
require.NoError(t, err)
require.NoError(t, simErr)
if config.Commit {
- simapp.PrintStats(db)
+ simtestutil.PrintStats(db)
+ }
+
+ if stopEarly {
+ fmt.Println("can't export or import a zero-validator genesis, exiting test...")
+ return
+ }
+
+ fmt.Printf("exporting genesis...\n")
+
+ exported, err := app.ExportAppStateAndValidators(true, []string{}, []string{})
+ require.NoError(t, err)
+
+ fmt.Printf("importing genesis...\n")
+
+ newDB, newDir, _, _, err := simtestutil.SetupSimulation(config, "leveldb-app-sim-2", "Simulation-2", simcli.FlagVerboseValue, simcli.FlagEnabledValue)
+ require.NoError(t, err, "simulation setup failed")
+
+ defer func() {
+ require.NoError(t, newDB.Close())
+ require.NoError(t, os.RemoveAll(newDir))
+ }()
+
+ newApp := NewWasmApp(log.NewNopLogger(), newDB, nil, true, wasm.EnableAllProposals, appOptions, emptyWasmOpts, fauxMerkleModeOpt, baseapp.SetChainID(SimAppChainID))
+ require.Equal(t, "WasmApp", newApp.Name())
+
+ newApp.InitChain(abci.RequestInitChain{
+ ChainId: SimAppChainID,
+ AppStateBytes: exported.AppState,
+ })
+
+ _, _, err = simulation.SimulateFromSeed(
+ t,
+ os.Stdout,
+ newApp.BaseApp,
+ simtestutil.AppStateFn(app.AppCodec(), app.SimulationManager(), app.DefaultGenesis()),
+ simtypes.RandomAccounts, // Replace with own random account function if using keys other than secp256k1
+ simtestutil.SimulationOperations(newApp, newApp.AppCodec(), config),
+ BlockedAddresses(),
+ config,
+ app.AppCodec(),
+ )
+ require.NoError(t, err)
+}
+
+func setupSimulationApp(t *testing.T, msg string) (simtypes.Config, dbm.DB, simtestutil.AppOptionsMap, *WasmApp) {
+ config := simcli.NewConfigFromFlags()
+ config.ChainID = SimAppChainID
+
+ db, dir, logger, skip, err := simtestutil.SetupSimulation(config, "leveldb-app-sim", "Simulation", simcli.FlagVerboseValue, simcli.FlagEnabledValue)
+ if skip {
+ t.Skip(msg)
}
+ require.NoError(t, err, "simulation setup failed")
+
+ t.Cleanup(func() {
+ require.NoError(t, db.Close())
+ require.NoError(t, os.RemoveAll(dir))
+ })
+
+ appOptions := make(simtestutil.AppOptionsMap, 0)
+ appOptions[flags.FlagHome] = dir // ensure a unique folder
+ appOptions[server.FlagInvCheckPeriod] = simcli.FlagPeriodValue
+
+ app := NewWasmApp(logger, db, nil, true, wasm.EnableAllProposals, appOptions, emptyWasmOpts, fauxMerkleModeOpt, baseapp.SetChainID(SimAppChainID))
+ require.Equal(t, "WasmApp", app.Name())
+ return config, db, appOptions, app
}
-// AppStateFn returns the initial application state using a genesis or the simulation parameters.
-// It panics if the user provides files for both of them.
-// If a file is not given for the genesis or the sim params, it creates a randomized one.
-func AppStateFn(codec codec.Codec, manager *module.SimulationManager) simtypes.AppStateFn {
- // quick hack to setup app state genesis with our app modules
- simapp.ModuleBasics = ModuleBasics
- if simapp.FlagGenesisTimeValue == 0 { // always set to have a block time
- simapp.FlagGenesisTimeValue = time.Now().Unix()
+// TODO: Make another test for the fuzzer itself, which just has noOp txs
+// and doesn't depend on the application.
+func TestAppStateDeterminism(t *testing.T) {
+ if !simcli.FlagEnabledValue {
+ t.Skip("skipping application simulation")
+ }
+
+ config := simcli.NewConfigFromFlags()
+ config.InitialBlockHeight = 1
+ config.ExportParamsPath = ""
+ config.OnOperation = false
+ config.AllInvariants = false
+ config.ChainID = SimAppChainID
+
+ numSeeds := 3
+ numTimesToRunPerSeed := 5
+ appHashList := make([]json.RawMessage, numTimesToRunPerSeed)
+
+ appOptions := make(simtestutil.AppOptionsMap, 0)
+ appOptions[flags.FlagHome] = t.TempDir() // ensure a unique folder
+ appOptions[server.FlagInvCheckPeriod] = simcli.FlagPeriodValue
+
+ for i := 0; i < numSeeds; i++ {
+ config.Seed = rand.Int63()
+
+ for j := 0; j < numTimesToRunPerSeed; j++ {
+ var logger log.Logger
+ if simcli.FlagVerboseValue {
+ logger = log.TestingLogger()
+ } else {
+ logger = log.NewNopLogger()
+ }
+
+ db := dbm.NewMemDB()
+ app := NewWasmApp(logger, db, nil, true, wasm.EnableAllProposals, appOptions, emptyWasmOpts, interBlockCacheOpt(), baseapp.SetChainID(SimAppChainID))
+
+ fmt.Printf(
+ "running non-determinism simulation; seed %d: %d/%d, attempt: %d/%d\n",
+ config.Seed, i+1, numSeeds, j+1, numTimesToRunPerSeed,
+ )
+
+ _, _, err := simulation.SimulateFromSeed(
+ t,
+ os.Stdout,
+ app.BaseApp,
+ simtestutil.AppStateFn(app.AppCodec(), app.SimulationManager(), app.DefaultGenesis()),
+ simtypes.RandomAccounts, // Replace with own random account function if using keys other than secp256k1
+ simtestutil.SimulationOperations(app, app.AppCodec(), config),
+ BlockedAddresses(),
+ config,
+ app.AppCodec(),
+ )
+ require.NoError(t, err)
+
+ if config.Commit {
+ simtestutil.PrintStats(db)
+ }
+
+ appHash := app.LastCommitID().Hash
+ appHashList[j] = appHash
+
+ if j != 0 {
+ require.Equal(
+ t, string(appHashList[0]), string(appHashList[j]),
+ "non-determinism in seed %d: %d/%d, attempt: %d/%d\n", config.Seed, i+1, numSeeds, j+1, numTimesToRunPerSeed,
+ )
+ }
+ }
}
- return simapp.AppStateFn(codec, manager)
}
diff --git a/app/test_access.go b/app/test_access.go
deleted file mode 100644
index 51b8bb9939..0000000000
--- a/app/test_access.go
+++ /dev/null
@@ -1,73 +0,0 @@
-package app
-
-import (
- "testing"
-
- "github.com/cosmos/cosmos-sdk/baseapp"
- "github.com/cosmos/cosmos-sdk/client"
-
- "github.com/CosmWasm/wasmd/app/params"
-
- "github.com/cosmos/cosmos-sdk/codec"
- bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
- capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper"
- stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
- ibctransferkeeper "github.com/cosmos/ibc-go/v4/modules/apps/transfer/keeper"
- ibckeeper "github.com/cosmos/ibc-go/v4/modules/core/keeper"
-
- "github.com/CosmWasm/wasmd/x/wasm"
-)
-
-// Deprecated: use public app attributes directly
-type TestSupport struct {
- t testing.TB
- app *WasmApp
-}
-
-func NewTestSupport(t testing.TB, app *WasmApp) *TestSupport {
- return &TestSupport{t: t, app: app}
-}
-
-func (s TestSupport) IBCKeeper() *ibckeeper.Keeper {
- return s.app.IBCKeeper
-}
-
-func (s TestSupport) WasmKeeper() wasm.Keeper {
- return s.app.WasmKeeper
-}
-
-func (s TestSupport) AppCodec() codec.Codec {
- return s.app.appCodec
-}
-
-func (s TestSupport) ScopedWasmIBCKeeper() capabilitykeeper.ScopedKeeper {
- return s.app.ScopedWasmKeeper
-}
-
-func (s TestSupport) ScopeIBCKeeper() capabilitykeeper.ScopedKeeper {
- return s.app.ScopedIBCKeeper
-}
-
-func (s TestSupport) ScopedTransferKeeper() capabilitykeeper.ScopedKeeper {
- return s.app.ScopedTransferKeeper
-}
-
-func (s TestSupport) StakingKeeper() stakingkeeper.Keeper {
- return s.app.StakingKeeper
-}
-
-func (s TestSupport) BankKeeper() bankkeeper.Keeper {
- return s.app.BankKeeper
-}
-
-func (s TestSupport) TransferKeeper() ibctransferkeeper.Keeper {
- return s.app.TransferKeeper
-}
-
-func (s TestSupport) GetBaseApp() *baseapp.BaseApp {
- return s.app.BaseApp
-}
-
-func (s TestSupport) GetTxConfig() client.TxConfig {
- return params.MakeEncodingConfig().TxConfig
-}
diff --git a/app/test_helpers.go b/app/test_helpers.go
index c48425f6ba..edd84436c5 100644
--- a/app/test_helpers.go
+++ b/app/test_helpers.go
@@ -1,262 +1,232 @@
package app
import (
- "bytes"
- "encoding/hex"
"encoding/json"
"fmt"
+ "math/rand"
+ "os"
"path/filepath"
- "strconv"
"testing"
"time"
+ "cosmossdk.io/math"
+
+ dbm "github.com/cometbft/cometbft-db"
+ abci "github.com/cometbft/cometbft/abci/types"
+ tmjson "github.com/cometbft/cometbft/libs/json"
+ "github.com/cometbft/cometbft/libs/log"
+ tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
+ tmtypes "github.com/cometbft/cometbft/types"
bam "github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client"
+ "github.com/cosmos/cosmos-sdk/client/flags"
+ "github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
- "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519"
+ "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
- "github.com/cosmos/cosmos-sdk/simapp/helpers"
+ "github.com/cosmos/cosmos-sdk/server"
+ servertypes "github.com/cosmos/cosmos-sdk/server/types"
"github.com/cosmos/cosmos-sdk/snapshots"
+ snapshottypes "github.com/cosmos/cosmos-sdk/snapshots/types"
+ pruningtypes "github.com/cosmos/cosmos-sdk/store/pruning/types"
+ "github.com/cosmos/cosmos-sdk/testutil/mock"
+ "github.com/cosmos/cosmos-sdk/testutil/network"
+ simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
sdk "github.com/cosmos/cosmos-sdk/types"
- "github.com/cosmos/cosmos-sdk/types/errors"
+ "github.com/cosmos/cosmos-sdk/types/module/testutil"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
- bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
"github.com/stretchr/testify/require"
- abci "github.com/tendermint/tendermint/abci/types"
- "github.com/tendermint/tendermint/libs/log"
- tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
- tmtypes "github.com/tendermint/tendermint/types"
- dbm "github.com/tendermint/tm-db"
"github.com/CosmWasm/wasmd/x/wasm"
+ wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
)
-// DefaultConsensusParams defines the default Tendermint consensus params used in
-// WasmApp testing.
-var DefaultConsensusParams = &abci.ConsensusParams{
- Block: &abci.BlockParams{
- MaxBytes: 8000000,
- MaxGas: 1234000000,
- },
- Evidence: &tmproto.EvidenceParams{
- MaxAgeNumBlocks: 302400,
- MaxAgeDuration: 504 * time.Hour, // 3 weeks is the max duration
- MaxBytes: 10000,
- },
- Validator: &tmproto.ValidatorParams{
- PubKeyTypes: []string{
- tmtypes.ABCIPubKeyTypeEd25519,
- },
- },
+// SetupOptions defines arguments that are passed into `WasmApp` constructor.
+type SetupOptions struct {
+ Logger log.Logger
+ DB *dbm.MemDB
+ AppOpts servertypes.AppOptions
+ WasmOpts []wasm.Option
}
-func setup(t testing.TB, withGenesis bool, invCheckPeriod uint, opts ...wasm.Option) (*WasmApp, GenesisState) {
+func setup(t testing.TB, chainID string, withGenesis bool, invCheckPeriod uint, opts ...wasm.Option) (*WasmApp, GenesisState) {
+ db := dbm.NewMemDB()
nodeHome := t.TempDir()
snapshotDir := filepath.Join(nodeHome, "data", "snapshots")
- snapshotDB, err := sdk.NewLevelDB("metadata", snapshotDir)
+
+ snapshotDB, err := dbm.NewDB("metadata", dbm.GoLevelDBBackend, snapshotDir)
require.NoError(t, err)
t.Cleanup(func() { snapshotDB.Close() })
snapshotStore, err := snapshots.NewStore(snapshotDB, snapshotDir)
require.NoError(t, err)
- baseAppOpts := []func(*bam.BaseApp){bam.SetSnapshotStore(snapshotStore), bam.SetSnapshotKeepRecent(2)}
- db := dbm.NewMemDB()
- t.Cleanup(func() { db.Close() })
- app := NewWasmApp(log.NewNopLogger(), db, nil, true, map[int64]bool{}, nodeHome, invCheckPeriod, MakeEncodingConfig(), wasm.EnableAllProposals, EmptyBaseAppOptions{}, opts, baseAppOpts...)
+
+ appOptions := make(simtestutil.AppOptionsMap, 0)
+ appOptions[flags.FlagHome] = nodeHome // ensure unique folder
+ appOptions[server.FlagInvCheckPeriod] = invCheckPeriod
+ app := NewWasmApp(log.NewNopLogger(), db, nil, true, wasmtypes.EnableAllProposals, appOptions, opts, bam.SetChainID(chainID), bam.SetSnapshot(snapshotStore, snapshottypes.SnapshotOptions{KeepRecent: 2}))
if withGenesis {
- return app, NewDefaultGenesisState()
+ return app, NewDefaultGenesisState(app.AppCodec())
}
return app, GenesisState{}
}
-// Setup initializes a new WasmApp with DefaultNodeHome for integration tests
-func Setup(isCheckTx bool, opts ...wasm.Option) *WasmApp {
- db := dbm.NewMemDB()
- app := NewWasmApp(log.NewNopLogger(), db, nil, true, map[int64]bool{}, DefaultNodeHome, 5, MakeEncodingConfig(), wasm.EnableAllProposals, EmptyBaseAppOptions{}, opts)
+// NewWasmAppWithCustomOptions initializes a new WasmApp with custom options.
+func NewWasmAppWithCustomOptions(t *testing.T, isCheckTx bool, options SetupOptions) *WasmApp {
+ t.Helper()
+
+ privVal := mock.NewPV()
+ pubKey, err := privVal.GetPubKey()
+ require.NoError(t, err)
+ // create validator set with single validator
+ validator := tmtypes.NewValidator(pubKey, 1)
+ valSet := tmtypes.NewValidatorSet([]*tmtypes.Validator{validator})
+
+ // generate genesis account
+ senderPrivKey := secp256k1.GenPrivKey()
+ acc := authtypes.NewBaseAccount(senderPrivKey.PubKey().Address().Bytes(), senderPrivKey.PubKey(), 0, 0)
+ balance := banktypes.Balance{
+ Address: acc.GetAddress().String(),
+ Coins: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(100000000000000))),
+ }
+
+ app := NewWasmApp(options.Logger, options.DB, nil, true, wasmtypes.EnableAllProposals, options.AppOpts, options.WasmOpts)
+ genesisState := NewDefaultGenesisState(app.appCodec)
+ genesisState, err = GenesisStateWithValSet(app.AppCodec(), genesisState, valSet, []authtypes.GenesisAccount{acc}, balance)
+ require.NoError(t, err)
if !isCheckTx {
- genesisState := NewDefaultGenesisState()
- stateBytes, err := json.MarshalIndent(genesisState, "", " ")
- if err != nil {
- panic(err)
- }
+ // init chain must be called to stop deliverState from being nil
+ stateBytes, err := tmjson.MarshalIndent(genesisState, "", " ")
+ require.NoError(t, err)
+ // Initialize the chain
app.InitChain(
abci.RequestInitChain{
Validators: []abci.ValidatorUpdate{},
- ConsensusParams: DefaultConsensusParams,
+ ConsensusParams: simtestutil.DefaultConsensusParams,
AppStateBytes: stateBytes,
},
)
}
+
return app
}
-// SetupWithGenesisValSet initializes a new WasmApp with a validator set and genesis accounts
-// that also act as delegators. For simplicity, each validator is bonded with a delegation
-// of one consensus engine unit (10^6) in the default token of the WasmApp from first genesis
-// account. A Nop logger is set in WasmApp.
-func SetupWithGenesisValSet(t *testing.T, valSet *tmtypes.ValidatorSet, genAccs []authtypes.GenesisAccount, chainID string, opts []wasm.Option, balances ...banktypes.Balance) *WasmApp {
- app, genesisState := setup(t, true, 5, opts...)
- // set genesis accounts
- authGenesis := authtypes.NewGenesisState(authtypes.DefaultParams(), genAccs)
- genesisState[authtypes.ModuleName] = app.appCodec.MustMarshalJSON(authGenesis)
+// Setup initializes a new WasmApp. A Nop logger is set in WasmApp.
+func Setup(t *testing.T, opts ...wasm.Option) *WasmApp {
+ t.Helper()
- validators := make([]stakingtypes.Validator, 0, len(valSet.Validators))
- delegations := make([]stakingtypes.Delegation, 0, len(valSet.Validators))
+ privVal := mock.NewPV()
+ pubKey, err := privVal.GetPubKey()
+ require.NoError(t, err)
- bondAmt := sdk.TokensFromConsensusPower(1, sdk.DefaultPowerReduction)
+ // create validator set with single validator
+ validator := tmtypes.NewValidator(pubKey, 1)
+ valSet := tmtypes.NewValidatorSet([]*tmtypes.Validator{validator})
- for _, val := range valSet.Validators {
- pk, err := cryptocodec.FromTmPubKeyInterface(val.PubKey)
- require.NoError(t, err)
- pkAny, err := codectypes.NewAnyWithValue(pk)
- require.NoError(t, err)
- validator := stakingtypes.Validator{
- OperatorAddress: sdk.ValAddress(val.Address).String(),
- ConsensusPubkey: pkAny,
- Jailed: false,
- Status: stakingtypes.Bonded,
- Tokens: bondAmt,
- DelegatorShares: sdk.OneDec(),
- Description: stakingtypes.Description{},
- UnbondingHeight: int64(0),
- UnbondingTime: time.Unix(0, 0).UTC(),
- Commission: stakingtypes.NewCommission(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()),
- MinSelfDelegation: sdk.ZeroInt(),
- }
-
- validators = append(validators, validator)
- delegations = append(delegations, stakingtypes.NewDelegation(genAccs[0].GetAddress(), val.Address.Bytes(), sdk.OneDec()))
+ // generate genesis account
+ senderPrivKey := secp256k1.GenPrivKey()
+ acc := authtypes.NewBaseAccount(senderPrivKey.PubKey().Address().Bytes(), senderPrivKey.PubKey(), 0, 0)
+ balance := banktypes.Balance{
+ Address: acc.GetAddress().String(),
+ Coins: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(100000000000000))),
}
+ chainID := "testing"
+ app := SetupWithGenesisValSet(t, valSet, []authtypes.GenesisAccount{acc}, chainID, opts, balance)
- // set validators and delegations
- var stakingGenesis stakingtypes.GenesisState
- app.AppCodec().MustUnmarshalJSON(genesisState[stakingtypes.ModuleName], &stakingGenesis)
-
- bondDenom := stakingGenesis.Params.BondDenom
-
- // add bonded amount to bonded pool module account
- balances = append(balances, banktypes.Balance{
- Address: authtypes.NewModuleAddress(stakingtypes.BondedPoolName).String(),
- Coins: sdk.Coins{sdk.NewCoin(bondDenom, bondAmt.Mul(sdk.NewInt(int64(len(valSet.Validators)))))},
- })
+ return app
+}
- // set validators and delegations
- stakingGenesis = *stakingtypes.NewGenesisState(stakingGenesis.Params, validators, delegations)
- genesisState[stakingtypes.ModuleName] = app.AppCodec().MustMarshalJSON(&stakingGenesis)
+// SetupWithGenesisValSet initializes a new WasmApp with a validator set and genesis accounts
+// that also act as delegators. For simplicity, each validator is bonded with a delegation
+// of one consensus engine unit in the default token of the WasmApp from first genesis
+// account. A Nop logger is set in WasmApp.
+func SetupWithGenesisValSet(t *testing.T, valSet *tmtypes.ValidatorSet, genAccs []authtypes.GenesisAccount, chainID string, opts []wasm.Option, balances ...banktypes.Balance) *WasmApp {
+ t.Helper()
- // update total supply
- bankGenesis := banktypes.NewGenesisState(banktypes.DefaultGenesisState().Params, balances, sdk.NewCoins(), []banktypes.Metadata{})
- genesisState[banktypes.ModuleName] = app.AppCodec().MustMarshalJSON(bankGenesis)
+ app, genesisState := setup(t, chainID, true, 5, opts...)
+ genesisState, err := GenesisStateWithValSet(app.AppCodec(), genesisState, valSet, genAccs, balances...)
+ require.NoError(t, err)
stateBytes, err := json.MarshalIndent(genesisState, "", " ")
require.NoError(t, err)
// init chain will set the validator set and initialize the genesis accounts
+ consensusParams := simtestutil.DefaultConsensusParams
+ consensusParams.Block.MaxGas = 100 * simtestutil.DefaultGenTxGas
app.InitChain(
abci.RequestInitChain{
ChainId: chainID,
Validators: []abci.ValidatorUpdate{},
- ConsensusParams: DefaultConsensusParams,
+ ConsensusParams: consensusParams,
AppStateBytes: stateBytes,
},
)
-
// commit genesis changes
app.Commit()
- app.BeginBlock(
- abci.RequestBeginBlock{
- Header: tmproto.Header{
- ChainID: chainID,
- Height: app.LastBlockHeight() + 1,
- AppHash: app.LastCommitID().Hash,
- ValidatorsHash: valSet.Hash(),
- NextValidatorsHash: valSet.Hash(),
- },
- },
- )
+ app.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{
+ ChainID: chainID,
+ Height: app.LastBlockHeight() + 1,
+ AppHash: app.LastCommitID().Hash,
+ Time: time.Now().UTC(),
+ ValidatorsHash: valSet.Hash(),
+ NextValidatorsHash: valSet.Hash(),
+ }})
return app
}
-// SetupWithEmptyStore setup a wasmd app instance with empty DB
+// SetupWithEmptyStore set up a wasmd app instance with empty DB
func SetupWithEmptyStore(t testing.TB) *WasmApp {
- app, _ := setup(t, false, 0)
+ app, _ := setup(t, "testing", false, 0)
return app
}
-type GenerateAccountStrategy func(int) []sdk.AccAddress
-
-// createRandomAccounts is a strategy used by addTestAddrs() in order to generated addresses in random order.
-func createRandomAccounts(accNum int) []sdk.AccAddress {
- testAddrs := make([]sdk.AccAddress, accNum)
- for i := 0; i < accNum; i++ {
- pk := ed25519.GenPrivKey().PubKey()
- testAddrs[i] = sdk.AccAddress(pk.Address())
- }
-
- return testAddrs
-}
-
-// createIncrementalAccounts is a strategy used by addTestAddrs() in order to generated addresses in ascending order.
-func createIncrementalAccounts(accNum int) []sdk.AccAddress {
- addresses := make([]sdk.AccAddress, 0, accNum)
- var buffer bytes.Buffer
-
- // start at 100 so we can make up to 999 test addresses with valid test addresses
- for i := 100; i < (accNum + 100); i++ {
- numString := strconv.Itoa(i)
- buffer.WriteString("A58856F0FD53BF058B4909A21AEC019107BA6") // base address string
+// GenesisStateWithSingleValidator initializes GenesisState with a single validator and genesis accounts
+// that also act as delegators.
+func GenesisStateWithSingleValidator(t *testing.T, app *WasmApp) GenesisState {
+ t.Helper()
- buffer.WriteString(numString) // adding on final two digits to make addresses unique
- res, err := sdk.AccAddressFromHex(buffer.String())
- if err != nil {
- panic(err)
- }
- bech := res.String()
- addr, err := TestAddr(buffer.String(), bech)
- if err != nil {
- panic(err)
- }
+ privVal := mock.NewPV()
+ pubKey, err := privVal.GetPubKey()
+ require.NoError(t, err)
- addresses = append(addresses, addr)
- buffer.Reset()
+ // create validator set with single validator
+ validator := tmtypes.NewValidator(pubKey, 1)
+ valSet := tmtypes.NewValidatorSet([]*tmtypes.Validator{validator})
+
+ // generate genesis account
+ senderPrivKey := secp256k1.GenPrivKey()
+ acc := authtypes.NewBaseAccount(senderPrivKey.PubKey().Address().Bytes(), senderPrivKey.PubKey(), 0, 0)
+ balances := []banktypes.Balance{
+ {
+ Address: acc.GetAddress().String(),
+ Coins: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(100000000000000))),
+ },
}
- return addresses
-}
-
-// AddTestAddrsFromPubKeys adds the addresses into the WasmApp providing only the public keys.
-func AddTestAddrsFromPubKeys(app *WasmApp, ctx sdk.Context, pubKeys []cryptotypes.PubKey, accAmt sdk.Int) {
- initCoins := sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), accAmt))
-
- for _, pk := range pubKeys {
- initAccountWithCoins(app, ctx, sdk.AccAddress(pk.Address()), initCoins)
- }
-}
+ genesisState := NewDefaultGenesisState(app.appCodec)
+ genesisState, err = GenesisStateWithValSet(app.AppCodec(), genesisState, valSet, []authtypes.GenesisAccount{acc}, balances...)
+ require.NoError(t, err)
-// AddTestAddrs constructs and returns accNum amount of accounts with an
-// initial balance of accAmt in random order
-func AddTestAddrs(app *WasmApp, ctx sdk.Context, accNum int, accAmt sdk.Int) []sdk.AccAddress {
- return addTestAddrs(app, ctx, accNum, accAmt, createRandomAccounts)
+ return genesisState
}
-// AddTestAddrs constructs and returns accNum amount of accounts with an
+// AddTestAddrsIncremental constructs and returns accNum amount of accounts with an
// initial balance of accAmt in random order
-func AddTestAddrsIncremental(app *WasmApp, ctx sdk.Context, accNum int, accAmt sdk.Int) []sdk.AccAddress {
- return addTestAddrs(app, ctx, accNum, accAmt, createIncrementalAccounts)
+func AddTestAddrsIncremental(app *WasmApp, ctx sdk.Context, accNum int, accAmt math.Int) []sdk.AccAddress {
+ return addTestAddrs(app, ctx, accNum, accAmt, simtestutil.CreateIncrementalAccounts)
}
-func addTestAddrs(app *WasmApp, ctx sdk.Context, accNum int, accAmt sdk.Int, strategy GenerateAccountStrategy) []sdk.AccAddress {
+func addTestAddrs(app *WasmApp, ctx sdk.Context, accNum int, accAmt math.Int, strategy simtestutil.GenerateAccountStrategy) []sdk.AccAddress {
testAddrs := strategy(accNum)
initCoins := sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), accAmt))
- // fill all the addresses with some coins, set the loose pool tokens simultaneously
for _, addr := range testAddrs {
initAccountWithCoins(app, ctx, addr, initCoins)
}
@@ -276,108 +246,58 @@ func initAccountWithCoins(app *WasmApp, ctx sdk.Context, addr sdk.AccAddress, co
}
}
-// ConvertAddrsToValAddrs converts the provided addresses to ValAddress.
-func ConvertAddrsToValAddrs(addrs []sdk.AccAddress) []sdk.ValAddress {
- valAddrs := make([]sdk.ValAddress, len(addrs))
-
- for i, addr := range addrs {
- valAddrs[i] = sdk.ValAddress(addr)
- }
-
- return valAddrs
+// ModuleAccountAddrs provides a list of blocked module accounts from configuration in AppConfig
+//
+// Ported from WasmApp
+func ModuleAccountAddrs() map[string]bool {
+ return BlockedAddresses()
}
-func TestAddr(addr string, bech string) (sdk.AccAddress, error) {
- res, err := sdk.AccAddressFromHex(addr)
- if err != nil {
- return nil, err
- }
- bechexpected := res.String()
- if bech != bechexpected {
- return nil, fmt.Errorf("bech encoding doesn't match reference")
- }
+var emptyWasmOptions []wasm.Option
- bechres, err := sdk.AccAddressFromBech32(bech)
+// NewTestNetworkFixture returns a new WasmApp AppConstructor for network simulation tests
+func NewTestNetworkFixture() network.TestFixture {
+ dir, err := os.MkdirTemp("", "simapp")
if err != nil {
- return nil, err
- }
- if !bytes.Equal(bechres, res) {
- return nil, err
+ panic(fmt.Sprintf("failed creating temporary directory: %v", err))
}
-
- return res, nil
-}
-
-// CheckBalance checks the balance of an account.
-func CheckBalance(t *testing.T, app *WasmApp, addr sdk.AccAddress, balances sdk.Coins) {
- ctxCheck := app.BaseApp.NewContext(true, tmproto.Header{})
- require.True(t, balances.IsEqual(app.BankKeeper.GetAllBalances(ctxCheck, addr)))
-}
-
-const DefaultGas = 1_500_000
-
-// SignCheckDeliver checks a generated signed transaction and simulates a
-// block commitment with the given transaction. A test assertion is made using
-// the parameter 'expPass' against the result. A corresponding result is
-// returned.
-func SignCheckDeliver(
- t *testing.T, txCfg client.TxConfig, app *bam.BaseApp, header tmproto.Header, msgs []sdk.Msg,
- chainID string, accNums, accSeqs []uint64, expSimPass, expPass bool, priv ...cryptotypes.PrivKey,
-) (sdk.GasInfo, *sdk.Result, error) {
- tx, err := helpers.GenTx(
- txCfg,
- msgs,
- sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 0)},
- helpers.DefaultGenTxGas,
- chainID,
- accNums,
- accSeqs,
- priv...,
- )
- require.NoError(t, err)
- txBytes, err := txCfg.TxEncoder()(tx)
- require.Nil(t, err)
-
- // Must simulate now as CheckTx doesn't run Msgs anymore
- _, res, err := app.Simulate(txBytes)
-
- if expSimPass {
- require.NoError(t, err)
- require.NotNil(t, res)
- } else {
- require.Error(t, err)
- require.Nil(t, res)
+ defer os.RemoveAll(dir)
+
+ app := NewWasmApp(log.NewNopLogger(), dbm.NewMemDB(), nil, true, wasmtypes.EnableAllProposals, simtestutil.NewAppOptionsWithFlagHome(dir), emptyWasmOptions)
+ appCtr := func(val network.ValidatorI) servertypes.Application {
+ return NewWasmApp(
+ val.GetCtx().Logger, dbm.NewMemDB(), nil, true, wasmtypes.EnableAllProposals,
+ simtestutil.NewAppOptionsWithFlagHome(val.GetCtx().Config.RootDir),
+ emptyWasmOptions,
+ bam.SetPruning(pruningtypes.NewPruningOptionsFromString(val.GetAppConfig().Pruning)),
+ bam.SetMinGasPrices(val.GetAppConfig().MinGasPrices),
+ bam.SetChainID(val.GetCtx().Viper.GetString(flags.FlagChainID)),
+ )
}
- // Simulate a sending a transaction and committing a block
- app.BeginBlock(abci.RequestBeginBlock{Header: header})
- gInfo, res, err := app.Deliver(txCfg.TxEncoder(), tx)
-
- if expPass {
- require.NoError(t, err)
- require.NotNil(t, res)
- } else {
- require.Error(t, err)
- require.Nil(t, res)
+ return network.TestFixture{
+ AppConstructor: appCtr,
+ GenesisState: NewDefaultGenesisState(app.AppCodec()),
+ EncodingConfig: testutil.TestEncodingConfig{
+ InterfaceRegistry: app.InterfaceRegistry(),
+ Codec: app.AppCodec(),
+ TxConfig: app.TxConfig(),
+ Amino: app.LegacyAmino(),
+ },
}
-
- app.EndBlock(abci.RequestEndBlock{})
- app.Commit()
-
- return gInfo, res, err
}
-// SignAndDeliver signs and delivers a transaction. No simulation occurs as the
-// ibc testing package causes checkState and deliverState to diverge in block time.
-func SignAndDeliver(
+// SignAndDeliverWithoutCommit signs and delivers a transaction. No commit
+func SignAndDeliverWithoutCommit(
t *testing.T, txCfg client.TxConfig, app *bam.BaseApp, header tmproto.Header, msgs []sdk.Msg,
chainID string, accNums, accSeqs []uint64, priv ...cryptotypes.PrivKey,
) (sdk.GasInfo, *sdk.Result, error) {
- tx, err := helpers.GenTx(
+ tx, err := simtestutil.GenSignedMockTx(
+ rand.New(rand.NewSource(time.Now().UnixNano())),
txCfg,
msgs,
sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 0)},
- 2*DefaultGas,
+ simtestutil.DefaultGenTxGas,
chainID,
accNums,
accSeqs,
@@ -386,104 +306,79 @@ func SignAndDeliver(
require.NoError(t, err)
// Simulate a sending a transaction and committing a block
- app.BeginBlock(abci.RequestBeginBlock{Header: header})
- gInfo, res, err := app.Deliver(txCfg.TxEncoder(), tx)
+ // app.BeginBlock(abci.RequestBeginBlock{Header: header})
+ gInfo, res, err := app.SimDeliver(txCfg.TxEncoder(), tx)
+ // app.EndBlock(abci.RequestEndBlock{})
+ // app.Commit()
+
return gInfo, res, err
}
-// GenSequenceOfTxs generates a set of signed transactions of messages, such
-// that they differ only by having the sequence numbers incremented between
-// every transaction.
-func GenSequenceOfTxs(txGen client.TxConfig, msgs []sdk.Msg, accNums []uint64, initSeqNums []uint64, numToGenerate int, priv ...cryptotypes.PrivKey) ([]sdk.Tx, error) {
- txs := make([]sdk.Tx, numToGenerate)
- var err error
- for i := 0; i < numToGenerate; i++ {
- txs[i], err = helpers.GenTx(
- txGen,
- msgs,
- sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 0)},
- helpers.DefaultGenTxGas,
- "",
- accNums,
- initSeqNums,
- priv...,
- )
- if err != nil {
- break
- }
- incrementAllSequenceNumbers(initSeqNums)
- }
+// GenesisStateWithValSet returns a new genesis state with the validator set
+// copied from simtestutil with delegation not added to supply
+func GenesisStateWithValSet(
+ codec codec.Codec,
+ genesisState map[string]json.RawMessage,
+ valSet *tmtypes.ValidatorSet,
+ genAccs []authtypes.GenesisAccount,
+ balances ...banktypes.Balance,
+) (map[string]json.RawMessage, error) {
+ // set genesis accounts
+ authGenesis := authtypes.NewGenesisState(authtypes.DefaultParams(), genAccs)
+ genesisState[authtypes.ModuleName] = codec.MustMarshalJSON(authGenesis)
- return txs, err
-}
+ validators := make([]stakingtypes.Validator, 0, len(valSet.Validators))
+ delegations := make([]stakingtypes.Delegation, 0, len(valSet.Validators))
-func incrementAllSequenceNumbers(initSeqNums []uint64) {
- for i := 0; i < len(initSeqNums); i++ {
- initSeqNums[i]++
- }
-}
+ bondAmt := sdk.DefaultPowerReduction
-// CreateTestPubKeys returns a total of numPubKeys public keys in ascending order.
-func CreateTestPubKeys(numPubKeys int) []cryptotypes.PubKey {
- publicKeys := make([]cryptotypes.PubKey, 0, numPubKeys)
- var buffer bytes.Buffer
-
- // start at 10 to avoid changing 1 to 01, 2 to 02, etc
- for i := 100; i < (numPubKeys + 100); i++ {
- numString := strconv.Itoa(i)
- buffer.WriteString("0B485CFC0EECC619440448436F8FC9DF40566F2369E72400281454CB552AF") // base pubkey string
- buffer.WriteString(numString) // adding on final two digits to make pubkeys unique
- publicKeys = append(publicKeys, NewPubKeyFromHex(buffer.String()))
- buffer.Reset()
- }
+ for _, val := range valSet.Validators {
+ pk, err := cryptocodec.FromTmPubKeyInterface(val.PubKey)
+ if err != nil {
+ return nil, fmt.Errorf("failed to convert pubkey: %w", err)
+ }
- return publicKeys
-}
+ pkAny, err := codectypes.NewAnyWithValue(pk)
+ if err != nil {
+ return nil, fmt.Errorf("failed to create new any: %w", err)
+ }
-// NewPubKeyFromHex returns a PubKey from a hex string.
-func NewPubKeyFromHex(pk string) (res cryptotypes.PubKey) {
- pkBytes, err := hex.DecodeString(pk)
- if err != nil {
- panic(err)
- }
- if len(pkBytes) != ed25519.PubKeySize {
- panic(errors.Wrap(errors.ErrInvalidPubKey, "invalid pubkey size"))
+ validator := stakingtypes.Validator{
+ OperatorAddress: sdk.ValAddress(val.Address).String(),
+ ConsensusPubkey: pkAny,
+ Jailed: false,
+ Status: stakingtypes.Bonded,
+ Tokens: bondAmt,
+ DelegatorShares: math.LegacyOneDec(),
+ Description: stakingtypes.Description{},
+ UnbondingHeight: int64(0),
+ UnbondingTime: time.Unix(0, 0).UTC(),
+ Commission: stakingtypes.NewCommission(math.LegacyZeroDec(), math.LegacyZeroDec(), math.LegacyZeroDec()),
+ MinSelfDelegation: math.ZeroInt(),
+ }
+ validators = append(validators, validator)
+ delegations = append(delegations, stakingtypes.NewDelegation(genAccs[0].GetAddress(), val.Address.Bytes(), math.LegacyOneDec()))
}
- return &ed25519.PubKey{Key: pkBytes}
-}
-
-// EmptyBaseAppOptions is a stub implementing AppOptions
-type EmptyBaseAppOptions struct{}
-
-// Get implements AppOptions
-func (ao EmptyBaseAppOptions) Get(o string) interface{} {
- return nil
-}
-// FundAccount is a utility function that funds an account by minting and
-// sending the coins to the address. This should be used for testing purposes
-// only!
-//
-// Instead of using the mint module account, which has the
-// permission of minting, create a "faucet" account. (@fdymylja)
-func FundAccount(bankKeeper bankkeeper.Keeper, ctx sdk.Context, addr sdk.AccAddress, amounts sdk.Coins) error {
- if err := bankKeeper.MintCoins(ctx, minttypes.ModuleName, amounts); err != nil {
- return err
- }
+ // set validators and delegations
+ stakingGenesis := stakingtypes.NewGenesisState(stakingtypes.DefaultParams(), validators, delegations)
+ genesisState[stakingtypes.ModuleName] = codec.MustMarshalJSON(stakingGenesis)
- return bankKeeper.SendCoinsFromModuleToAccount(ctx, minttypes.ModuleName, addr, amounts)
-}
+ // add bonded amount to bonded pool module account
+ balances = append(balances, banktypes.Balance{
+ Address: authtypes.NewModuleAddress(stakingtypes.BondedPoolName).String(),
+ Coins: sdk.Coins{sdk.NewCoin(sdk.DefaultBondDenom, bondAmt.MulRaw(int64(len(valSet.Validators))))},
+ })
-// FundModuleAccount is a utility function that funds a module account by
-// minting and sending the coins to the address. This should be used for testing
-// purposes only!
-//
-// Instead of using the mint module account, which has the
-// permission of minting, create a "faucet" account. (@fdymylja)
-func FundModuleAccount(bankKeeper bankkeeper.Keeper, ctx sdk.Context, recipientMod string, amounts sdk.Coins) error {
- if err := bankKeeper.MintCoins(ctx, minttypes.ModuleName, amounts); err != nil {
- return err
+ totalSupply := sdk.NewCoins()
+ for _, b := range balances {
+ // add genesis acc tokens to total supply
+ totalSupply = totalSupply.Add(b.Coins...)
}
- return bankKeeper.SendCoinsFromModuleToModule(ctx, minttypes.ModuleName, recipientMod, amounts)
+ // update total supply
+ bankGenesis := banktypes.NewGenesisState(banktypes.DefaultGenesisState().Params, balances, totalSupply, []banktypes.Metadata{}, []banktypes.SendEnabled{})
+ genesisState[banktypes.ModuleName] = codec.MustMarshalJSON(bankGenesis)
+ println(string(genesisState[banktypes.ModuleName]))
+ return genesisState, nil
}
diff --git a/app/upgrades.go b/app/upgrades.go
new file mode 100644
index 0000000000..01aa076a44
--- /dev/null
+++ b/app/upgrades.go
@@ -0,0 +1,108 @@
+package app
+
+import (
+ "github.com/cosmos/cosmos-sdk/baseapp"
+ storetypes "github.com/cosmos/cosmos-sdk/store/types"
+ sdk "github.com/cosmos/cosmos-sdk/types"
+ "github.com/cosmos/cosmos-sdk/types/module"
+ authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
+ banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
+ consensustypes "github.com/cosmos/cosmos-sdk/x/consensus/types"
+ crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types"
+ distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
+ govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
+ govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
+ minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
+ paramstypes "github.com/cosmos/cosmos-sdk/x/params/types"
+ slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types"
+ stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
+ upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
+ icacontrollertypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types"
+ icahosttypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/types"
+ ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types"
+
+ wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
+)
+
+// UpgradeName defines the on-chain upgrade name for the sample SimApp upgrade
+// from v046 to v047.
+//
+// NOTE: This upgrade defines a reference implementation of what an upgrade
+// could look like when an application is migrating from Cosmos SDK version
+// v0.46.x to v0.47.x.
+const UpgradeName = "v046-to-v047"
+
+func (app WasmApp) RegisterUpgradeHandlers() {
+ // Set param key table for params module migration
+ for _, subspace := range app.ParamsKeeper.GetSubspaces() {
+ subspace := subspace
+
+ var keyTable paramstypes.KeyTable
+ switch subspace.Name() {
+ case authtypes.ModuleName:
+ keyTable = authtypes.ParamKeyTable() //nolint:staticcheck
+ case banktypes.ModuleName:
+ keyTable = banktypes.ParamKeyTable() //nolint:staticcheck
+ case stakingtypes.ModuleName:
+ keyTable = stakingtypes.ParamKeyTable()
+ case minttypes.ModuleName:
+ keyTable = minttypes.ParamKeyTable() //nolint:staticcheck
+ case distrtypes.ModuleName:
+ keyTable = distrtypes.ParamKeyTable() //nolint:staticcheck
+ case slashingtypes.ModuleName:
+ keyTable = slashingtypes.ParamKeyTable() //nolint:staticcheck
+ case govtypes.ModuleName:
+ keyTable = govv1.ParamKeyTable() //nolint:staticcheck
+ case crisistypes.ModuleName:
+ keyTable = crisistypes.ParamKeyTable() //nolint:staticcheck
+ // ibc types
+ case ibctransfertypes.ModuleName:
+ keyTable = ibctransfertypes.ParamKeyTable()
+ case icahosttypes.SubModuleName:
+ keyTable = icahosttypes.ParamKeyTable()
+ case icacontrollertypes.SubModuleName:
+ keyTable = icacontrollertypes.ParamKeyTable()
+ // wasm
+ case wasmtypes.ModuleName:
+ keyTable = wasmtypes.ParamKeyTable() //nolint:staticcheck
+ default:
+ continue
+ }
+
+ if !subspace.HasKeyTable() {
+ subspace.WithKeyTable(keyTable)
+ }
+ }
+
+ baseAppLegacySS := app.ParamsKeeper.Subspace(baseapp.Paramspace).WithKeyTable(paramstypes.ConsensusParamsKeyTable())
+
+ app.UpgradeKeeper.SetUpgradeHandler(
+ UpgradeName,
+ func(ctx sdk.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
+ // Migrate Tendermint consensus parameters from x/params module to a dedicated x/consensus module.
+ baseapp.MigrateParams(ctx, baseAppLegacySS, &app.ConsensusParamsKeeper)
+
+ // Note: this migration is optional,
+ // You can include x/gov proposal migration documented in [UPGRADING.md](https://github.com/cosmos/cosmos-sdk/blob/main/UPGRADING.md)
+
+ return app.ModuleManager.RunMigrations(ctx, app.Configurator(), fromVM)
+ },
+ )
+
+ upgradeInfo, err := app.UpgradeKeeper.ReadUpgradeInfoFromDisk()
+ if err != nil {
+ panic(err)
+ }
+
+ if upgradeInfo.Name == UpgradeName && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) {
+ storeUpgrades := storetypes.StoreUpgrades{
+ Added: []string{
+ consensustypes.ModuleName,
+ crisistypes.ModuleName,
+ },
+ }
+
+ // configure store loader that checks if version == upgradeHeight and applies store upgrades
+ app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades))
+ }
+}
diff --git a/benchmarks/app_test.go b/benchmarks/app_test.go
index 88773e6b42..df0ee91327 100644
--- a/benchmarks/app_test.go
+++ b/benchmarks/app_test.go
@@ -2,21 +2,23 @@ package benchmarks
import (
"encoding/json"
+ "math/rand"
"os"
"testing"
"time"
- "github.com/stretchr/testify/require"
+ simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
+ moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil"
- abci "github.com/tendermint/tendermint/abci/types"
- "github.com/tendermint/tendermint/libs/log"
- tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
- dbm "github.com/tendermint/tm-db"
+ dbm "github.com/cometbft/cometbft-db"
+ abci "github.com/cometbft/cometbft/abci/types"
+ "github.com/cometbft/cometbft/libs/log"
+ tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
+ tmtypes "github.com/cometbft/cometbft/types"
+ "github.com/stretchr/testify/require"
"github.com/cosmos/cosmos-sdk/client"
- "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
- "github.com/cosmos/cosmos-sdk/simapp/helpers"
- simappparams "github.com/cosmos/cosmos-sdk/simapp/params"
+ "github.com/cosmos/cosmos-sdk/testutil/mock"
sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
@@ -24,32 +26,81 @@ import (
"github.com/CosmWasm/wasmd/app"
"github.com/CosmWasm/wasmd/x/wasm"
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
+
+ codectypes "github.com/cosmos/cosmos-sdk/codec/types"
+ "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
+ stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
+
+ cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
)
-func setup(db dbm.DB, withGenesis bool, invCheckPeriod uint, opts ...wasm.Option) (*app.WasmApp, app.GenesisState) {
- encodingConfig := app.MakeEncodingConfig()
- wasmApp := app.NewWasmApp(log.NewNopLogger(), db, nil, true, map[int64]bool{}, app.DefaultNodeHome, invCheckPeriod, encodingConfig, wasm.EnableAllProposals, app.EmptyBaseAppOptions{}, opts)
+func setup(db dbm.DB, withGenesis bool, invCheckPeriod uint, opts ...wasm.Option) (*app.WasmApp, app.GenesisState) { //nolint:unparam
+ wasmApp := app.NewWasmApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, wasm.EnableAllProposals, simtestutil.EmptyAppOptions{}, nil)
+
if withGenesis {
- return wasmApp, app.NewDefaultGenesisState()
+ return wasmApp, app.NewDefaultGenesisState(wasmApp.AppCodec())
}
return wasmApp, app.GenesisState{}
}
-// SetupWithGenesisAccounts initializes a new WasmApp with the provided genesis
+// SetupWithGenesisAccountsAndValSet initializes a new WasmApp with the provided genesis
// accounts and possible balances.
-func SetupWithGenesisAccounts(b testing.TB, db dbm.DB, genAccs []authtypes.GenesisAccount, balances ...banktypes.Balance) *app.WasmApp {
+func SetupWithGenesisAccountsAndValSet(b testing.TB, db dbm.DB, genAccs []authtypes.GenesisAccount, balances ...banktypes.Balance) *app.WasmApp {
wasmApp, genesisState := setup(db, true, 0)
authGenesis := authtypes.NewGenesisState(authtypes.DefaultParams(), genAccs)
- appCodec := app.NewTestSupport(b, wasmApp).AppCodec()
+ appCodec := wasmApp.AppCodec()
+
+ privVal := mock.NewPV()
+ pubKey, err := privVal.GetPubKey()
+ require.NoError(b, err)
genesisState[authtypes.ModuleName] = appCodec.MustMarshalJSON(authGenesis)
+ validator := tmtypes.NewValidator(pubKey, 1)
+ valSet := tmtypes.NewValidatorSet([]*tmtypes.Validator{validator})
+
+ validators := make([]stakingtypes.Validator, 0, len(valSet.Validators))
+ delegations := make([]stakingtypes.Delegation, 0, len(valSet.Validators))
+
+ bondAmt := sdk.DefaultPowerReduction
+
+ for _, val := range valSet.Validators {
+ pk, _ := cryptocodec.FromTmPubKeyInterface(val.PubKey)
+ pkAny, _ := codectypes.NewAnyWithValue(pk)
+ validator := stakingtypes.Validator{
+ OperatorAddress: sdk.ValAddress(val.Address).String(),
+ ConsensusPubkey: pkAny,
+ Jailed: false,
+ Status: stakingtypes.Bonded,
+ Tokens: bondAmt,
+ DelegatorShares: sdk.OneDec(),
+ Description: stakingtypes.Description{},
+ UnbondingHeight: int64(0),
+ UnbondingTime: time.Unix(0, 0).UTC(),
+ Commission: stakingtypes.NewCommission(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()),
+ MinSelfDelegation: sdk.ZeroInt(),
+ }
+ validators = append(validators, validator)
+ delegations = append(delegations, stakingtypes.NewDelegation(genAccs[0].GetAddress(), val.Address.Bytes(), sdk.OneDec()))
+
+ }
+ // set validators and delegations
+ stakingGenesis := stakingtypes.NewGenesisState(stakingtypes.DefaultParams(), validators, delegations)
+ genesisState[stakingtypes.ModuleName] = appCodec.MustMarshalJSON(stakingGenesis)
+
totalSupply := sdk.NewCoins()
+
+ // add bonded amount to bonded pool module account
+ balances = append(balances, banktypes.Balance{
+ Address: authtypes.NewModuleAddress(stakingtypes.BondedPoolName).String(),
+ Coins: sdk.Coins{sdk.NewCoin(sdk.DefaultBondDenom, bondAmt)},
+ })
+ // update total supply
for _, b := range balances {
+ // add genesis acc tokens and delegated tokens to total supply
totalSupply = totalSupply.Add(b.Coins...)
}
-
- bankGenesis := banktypes.NewGenesisState(banktypes.DefaultGenesisState().Params, balances, totalSupply, []banktypes.Metadata{})
+ bankGenesis := banktypes.NewGenesisState(banktypes.DefaultGenesisState().Params, balances, totalSupply, []banktypes.Metadata{}, nil)
genesisState[banktypes.ModuleName] = appCodec.MustMarshalJSON(bankGenesis)
stateBytes, err := json.MarshalIndent(genesisState, "", " ")
@@ -57,10 +108,13 @@ func SetupWithGenesisAccounts(b testing.TB, db dbm.DB, genAccs []authtypes.Genes
panic(err)
}
+ consensusParams := simtestutil.DefaultConsensusParams
+ consensusParams.Block.MaxGas = 100 * simtestutil.DefaultGenTxGas
+
wasmApp.InitChain(
abci.RequestInitChain{
Validators: []abci.ValidatorUpdate{},
- ConsensusParams: app.DefaultConsensusParams,
+ ConsensusParams: consensusParams,
AppStateBytes: stateBytes,
},
)
@@ -111,11 +165,11 @@ func InitializeWasmApp(b testing.TB, db dbm.DB, numAccounts int) AppInfo {
Coins: sdk.NewCoins(sdk.NewInt64Coin(denom, 100000000000)),
}
}
- wasmApp := SetupWithGenesisAccounts(b, db, genAccs, bals...)
+ wasmApp := SetupWithGenesisAccountsAndValSet(b, db, genAccs, bals...)
// add wasm contract
height := int64(2)
- txGen := simappparams.MakeTestEncodingConfig().TxConfig
+ txGen := moduletestutil.MakeTestEncodingConfig().TxConfig
wasmApp.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: height, Time: time.Now()}})
// upload the code
@@ -125,9 +179,10 @@ func InitializeWasmApp(b testing.TB, db dbm.DB, numAccounts int) AppInfo {
Sender: addr.String(),
WASMByteCode: cw20Code,
}
- storeTx, err := helpers.GenTx(txGen, []sdk.Msg{&storeMsg}, nil, 55123123, "", []uint64{0}, []uint64{0}, minter)
+ r := rand.New(rand.NewSource(time.Now().UnixNano()))
+ storeTx, err := simtestutil.GenSignedMockTx(r, txGen, []sdk.Msg{&storeMsg}, nil, 55123123, "", []uint64{0}, []uint64{0}, minter)
require.NoError(b, err)
- _, res, err := wasmApp.Deliver(txGen.TxEncoder(), storeTx)
+ _, _, err = wasmApp.SimDeliver(txGen.TxEncoder(), storeTx)
require.NoError(b, err)
codeID := uint64(1)
@@ -159,15 +214,15 @@ func InitializeWasmApp(b testing.TB, db dbm.DB, numAccounts int) AppInfo {
Msg: initBz,
}
gasWanted := 500000 + 10000*uint64(numAccounts)
- initTx, err := helpers.GenTx(txGen, []sdk.Msg{&initMsg}, nil, gasWanted, "", []uint64{0}, []uint64{1}, minter)
+ initTx, err := simtestutil.GenSignedMockTx(r, txGen, []sdk.Msg{&initMsg}, nil, gasWanted, "", []uint64{0}, []uint64{1}, minter)
require.NoError(b, err)
- _, res, err = wasmApp.Deliver(txGen.TxEncoder(), initTx)
+ _, res, err := wasmApp.SimDeliver(txGen.TxEncoder(), initTx)
require.NoError(b, err)
// TODO: parse contract address better
evt := res.Events[len(res.Events)-1]
attr := evt.Attributes[0]
- contractAddr := string(attr.Value)
+ contractAddr := attr.Value
wasmApp.EndBlock(abci.RequestEndBlock{Height: height})
wasmApp.Commit()
@@ -180,7 +235,7 @@ func InitializeWasmApp(b testing.TB, db dbm.DB, numAccounts int) AppInfo {
Denom: denom,
AccNum: 0,
SeqNum: 2,
- TxConfig: simappparams.MakeTestEncodingConfig().TxConfig,
+ TxConfig: moduletestutil.MakeTestEncodingConfig().TxConfig,
}
}
@@ -188,10 +243,12 @@ func GenSequenceOfTxs(b testing.TB, info *AppInfo, msgGen func(*AppInfo) ([]sdk.
fees := sdk.Coins{sdk.NewInt64Coin(info.Denom, 0)}
txs := make([]sdk.Tx, numToGenerate)
+ r := rand.New(rand.NewSource(time.Now().UnixNano()))
for i := 0; i < numToGenerate; i++ {
msgs, err := msgGen(info)
require.NoError(b, err)
- txs[i], err = helpers.GenTx(
+ txs[i], err = simtestutil.GenSignedMockTx(
+ r,
info.TxConfig,
msgs,
fees,
@@ -202,7 +259,7 @@ func GenSequenceOfTxs(b testing.TB, info *AppInfo, msgGen func(*AppInfo) ([]sdk.
info.MinterKey,
)
require.NoError(b, err)
- info.SeqNum += 1
+ info.SeqNum++
}
return txs
diff --git a/benchmarks/bench_test.go b/benchmarks/bench_test.go
index 9001f1abf4..c917e91d20 100644
--- a/benchmarks/bench_test.go
+++ b/benchmarks/bench_test.go
@@ -8,9 +8,9 @@ import (
"github.com/stretchr/testify/require"
"github.com/syndtr/goleveldb/leveldb/opt"
- abci "github.com/tendermint/tendermint/abci/types"
- tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
- dbm "github.com/tendermint/tm-db"
+ dbm "github.com/cometbft/cometbft-db"
+ abci "github.com/cometbft/cometbft/abci/types"
+ tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
sdk "github.com/cosmos/cosmos-sdk/types"
@@ -107,15 +107,16 @@ func BenchmarkTxSending(b *testing.B) {
for j := 0; j < blockSize; j++ {
idx := i*blockSize + j
-
- _, _, err := appInfo.App.Check(txEncoder, txs[idx])
- if err != nil {
- panic("something is broken in checking transaction")
- }
- _, _, err = appInfo.App.Deliver(txEncoder, txs[idx])
+ bz, err := txEncoder(txs[idx])
require.NoError(b, err)
+ rsp := appInfo.App.CheckTx(abci.RequestCheckTx{
+ Tx: bz,
+ Type: abci.CheckTxType_New,
+ })
+ require.True(b, rsp.IsOK())
+ dRsp := appInfo.App.DeliverTx(abci.RequestDeliverTx{Tx: bz})
+ require.True(b, dRsp.IsOK())
}
-
appInfo.App.EndBlock(abci.RequestEndBlock{Height: height})
appInfo.App.Commit()
height++
@@ -157,7 +158,7 @@ func buildTxFromMsg(builder func(info *AppInfo) ([]sdk.Msg, error)) func(b *test
}
}
-func buildMemDB(b *testing.B) dbm.DB {
+func buildMemDB(_ *testing.B) dbm.DB {
return dbm.NewMemDB()
}
diff --git a/cmd/wasmd/genaccounts.go b/cmd/wasmd/genaccounts.go
deleted file mode 100644
index 9acf2cea70..0000000000
--- a/cmd/wasmd/genaccounts.go
+++ /dev/null
@@ -1,192 +0,0 @@
-package main
-
-import (
- "bufio"
- "encoding/json"
- "errors"
- "fmt"
-
- "github.com/spf13/cobra"
-
- "github.com/cosmos/cosmos-sdk/client"
- "github.com/cosmos/cosmos-sdk/client/flags"
- "github.com/cosmos/cosmos-sdk/crypto/keyring"
- "github.com/cosmos/cosmos-sdk/server"
- sdk "github.com/cosmos/cosmos-sdk/types"
- authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
- authvesting "github.com/cosmos/cosmos-sdk/x/auth/vesting/types"
- banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
- "github.com/cosmos/cosmos-sdk/x/genutil"
- genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"
-)
-
-const (
- flagVestingStart = "vesting-start-time"
- flagVestingEnd = "vesting-end-time"
- flagVestingAmt = "vesting-amount"
-)
-
-// AddGenesisAccountCmd returns add-genesis-account cobra Command.
-func AddGenesisAccountCmd(defaultNodeHome string) *cobra.Command {
- cmd := &cobra.Command{
- Use: "add-genesis-account [address_or_key_name] [coin][,[coin]]",
- Short: "Add a genesis account to genesis.json",
- Long: `Add a genesis account to genesis.json. The provided account must specify
-the account address or key name and a list of initial coins. If a key name is given,
-the address will be looked up in the local Keybase. The list of initial tokens must
-contain valid denominations. Accounts may optionally be supplied with vesting parameters.
-`,
- Args: cobra.ExactArgs(2),
- RunE: func(cmd *cobra.Command, args []string) error {
- clientCtx := client.GetClientContextFromCmd(cmd)
- serverCtx := server.GetServerContextFromCmd(cmd)
- config := serverCtx.Config
-
- config.SetRoot(clientCtx.HomeDir)
-
- var kr keyring.Keyring
- addr, err := sdk.AccAddressFromBech32(args[0])
- if err != nil {
- inBuf := bufio.NewReader(cmd.InOrStdin())
- keyringBackend, err := cmd.Flags().GetString(flags.FlagKeyringBackend)
- if err != nil {
- return fmt.Errorf("failed to parse keyring backend: %w", err)
- }
- if keyringBackend != "" && clientCtx.Keyring == nil {
- var err error
- kr, err = keyring.New(sdk.KeyringServiceName(), keyringBackend, clientCtx.HomeDir, inBuf)
- if err != nil {
- return err
- }
- } else {
- kr = clientCtx.Keyring
- }
-
- info, err := kr.Key(args[0])
- if err != nil {
- return fmt.Errorf("failed to get address from Keyring: %w", err)
- }
- addr = info.GetAddress()
- }
-
- coins, err := sdk.ParseCoinsNormalized(args[1])
- if err != nil {
- return fmt.Errorf("failed to parse coins: %w", err)
- }
-
- vestingStart, err := cmd.Flags().GetInt64(flagVestingStart)
- if err != nil {
- return fmt.Errorf("failed to parse vesting start: %w", err)
- }
- vestingEnd, err := cmd.Flags().GetInt64(flagVestingEnd)
- if err != nil {
- return fmt.Errorf("failed to parse vesting end: %w", err)
- }
- vestingAmtStr, err := cmd.Flags().GetString(flagVestingAmt)
- if err != nil {
- return fmt.Errorf("failed to parse vesting amount: %w", err)
- }
-
- vestingAmt, err := sdk.ParseCoinsNormalized(vestingAmtStr)
- if err != nil {
- return fmt.Errorf("failed to parse vesting amount: %w", err)
- }
-
- // create concrete account type based on input parameters
- var genAccount authtypes.GenesisAccount
-
- balances := banktypes.Balance{Address: addr.String(), Coins: coins.Sort()}
- baseAccount := authtypes.NewBaseAccount(addr, nil, 0, 0)
-
- if !vestingAmt.IsZero() {
- baseVestingAccount := authvesting.NewBaseVestingAccount(baseAccount, vestingAmt.Sort(), vestingEnd)
-
- if (balances.Coins.IsZero() && !baseVestingAccount.OriginalVesting.IsZero()) ||
- baseVestingAccount.OriginalVesting.IsAnyGT(balances.Coins) {
- return errors.New("vesting amount cannot be greater than total amount")
- }
-
- switch {
- case vestingStart != 0 && vestingEnd != 0:
- genAccount = authvesting.NewContinuousVestingAccountRaw(baseVestingAccount, vestingStart)
-
- case vestingEnd != 0:
- genAccount = authvesting.NewDelayedVestingAccountRaw(baseVestingAccount)
-
- default:
- return errors.New("invalid vesting parameters; must supply start and end time or end time")
- }
- } else {
- genAccount = baseAccount
- }
-
- if err := genAccount.Validate(); err != nil {
- return fmt.Errorf("failed to validate new genesis account: %w", err)
- }
-
- genFile := config.GenesisFile()
- appState, genDoc, err := genutiltypes.GenesisStateFromGenFile(genFile)
- if err != nil {
- return fmt.Errorf("failed to unmarshal genesis state: %w", err)
- }
-
- authGenState := authtypes.GetGenesisStateFromAppState(clientCtx.Codec, appState)
-
- accs, err := authtypes.UnpackAccounts(authGenState.Accounts)
- if err != nil {
- return fmt.Errorf("failed to get accounts from any: %w", err)
- }
-
- if accs.Contains(addr) {
- return fmt.Errorf("cannot add account at existing address %s", addr)
- }
-
- // Add the new account to the set of genesis accounts and sanitize the
- // accounts afterwards.
- accs = append(accs, genAccount)
- accs = authtypes.SanitizeGenesisAccounts(accs)
-
- genAccs, err := authtypes.PackAccounts(accs)
- if err != nil {
- return fmt.Errorf("failed to convert accounts into any's: %w", err)
- }
- authGenState.Accounts = genAccs
-
- authGenStateBz, err := clientCtx.Codec.MarshalJSON(&authGenState)
- if err != nil {
- return fmt.Errorf("failed to marshal auth genesis state: %w", err)
- }
-
- appState[authtypes.ModuleName] = authGenStateBz
-
- bankGenState := banktypes.GetGenesisStateFromAppState(clientCtx.Codec, appState)
- bankGenState.Balances = append(bankGenState.Balances, balances)
- bankGenState.Balances = banktypes.SanitizeGenesisBalances(bankGenState.Balances)
- bankGenState.Supply = bankGenState.Supply.Add(balances.Coins...)
-
- bankGenStateBz, err := clientCtx.Codec.MarshalJSON(bankGenState)
- if err != nil {
- return fmt.Errorf("failed to marshal bank genesis state: %w", err)
- }
-
- appState[banktypes.ModuleName] = bankGenStateBz
-
- appStateJSON, err := json.Marshal(appState)
- if err != nil {
- return fmt.Errorf("failed to marshal application genesis state: %w", err)
- }
-
- genDoc.AppState = appStateJSON
- return genutil.ExportGenesisFile(genDoc, genFile)
- },
- }
-
- cmd.Flags().String(flags.FlagHome, defaultNodeHome, "The application home directory")
- cmd.Flags().String(flags.FlagKeyringBackend, flags.DefaultKeyringBackend, "Select keyring's backend (os|file|kwallet|pass|test)")
- cmd.Flags().String(flagVestingAmt, "", "amount of coins for vesting accounts")
- cmd.Flags().Int64(flagVestingStart, 0, "schedule start time (unix epoch) for vesting accounts")
- cmd.Flags().Int64(flagVestingEnd, 0, "schedule end time (unix epoch) for vesting accounts")
- flags.AddQueryFlagsToCmd(cmd)
-
- return cmd
-}
diff --git a/cmd/wasmd/main.go b/cmd/wasmd/main.go
index 7bd3d01220..3a7719e6cf 100644
--- a/cmd/wasmd/main.go
+++ b/cmd/wasmd/main.go
@@ -12,7 +12,7 @@ import (
func main() {
rootCmd, _ := NewRootCmd()
- if err := svrcmd.Execute(rootCmd, app.DefaultNodeHome); err != nil {
+ if err := svrcmd.Execute(rootCmd, "", app.DefaultNodeHome); err != nil {
switch e := err.(type) {
case server.ErrorCode:
os.Exit(e.Code)
diff --git a/cmd/wasmd/root.go b/cmd/wasmd/root.go
index eeaf39aad5..95558a7794 100644
--- a/cmd/wasmd/root.go
+++ b/cmd/wasmd/root.go
@@ -4,32 +4,31 @@ import (
"errors"
"io"
"os"
- "path/filepath"
- "github.com/cosmos/cosmos-sdk/baseapp"
+ rosettaCmd "cosmossdk.io/tools/rosetta/cmd"
+ dbm "github.com/cometbft/cometbft-db"
+ tmcfg "github.com/cometbft/cometbft/config"
+ "github.com/cometbft/cometbft/libs/log"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/config"
"github.com/cosmos/cosmos-sdk/client/debug"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/keys"
+ "github.com/cosmos/cosmos-sdk/client/pruning"
"github.com/cosmos/cosmos-sdk/client/rpc"
"github.com/cosmos/cosmos-sdk/server"
+ serverconfig "github.com/cosmos/cosmos-sdk/server/config"
servertypes "github.com/cosmos/cosmos-sdk/server/types"
- "github.com/cosmos/cosmos-sdk/snapshots"
- "github.com/cosmos/cosmos-sdk/store"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/version"
authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
- banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/cosmos/cosmos-sdk/x/crisis"
genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli"
"github.com/prometheus/client_golang/prometheus"
"github.com/spf13/cast"
"github.com/spf13/cobra"
- tmcli "github.com/tendermint/tendermint/libs/cli"
- "github.com/tendermint/tendermint/libs/log"
- dbm "github.com/tendermint/tm-db"
+ "github.com/spf13/viper"
"github.com/CosmWasm/wasmd/app"
"github.com/CosmWasm/wasmd/app/params"
@@ -57,9 +56,8 @@ func NewRootCmd() (*cobra.Command, params.EncodingConfig) {
WithLegacyAmino(encodingConfig.Amino).
WithInput(os.Stdin).
WithAccountRetriever(authtypes.AccountRetriever{}).
- WithBroadcastMode(flags.BroadcastBlock).
WithHomeDir(app.DefaultNodeHome).
- WithViper("")
+ WithViper("") // In wasmd, we don't use any prefix for env variables.
rootCmd := &cobra.Command{
Use: version.AppName,
@@ -83,7 +81,10 @@ func NewRootCmd() (*cobra.Command, params.EncodingConfig) {
return err
}
- return server.InterceptConfigsPreRunHandler(cmd, "", nil)
+ customAppTemplate, customAppConfig := initAppConfig()
+ customTMConfig := initTendermintConfig()
+
+ return server.InterceptConfigsPreRunHandler(cmd, customAppTemplate, customAppConfig, customTMConfig)
},
}
@@ -92,31 +93,79 @@ func NewRootCmd() (*cobra.Command, params.EncodingConfig) {
return rootCmd, encodingConfig
}
+// initTendermintConfig helps to override default Tendermint Config values.
+// return tmcfg.DefaultConfig if no custom configuration is required for the application.
+func initTendermintConfig() *tmcfg.Config {
+ cfg := tmcfg.DefaultConfig()
+
+ // these values put a higher strain on node memory
+ // cfg.P2P.MaxNumInboundPeers = 100
+ // cfg.P2P.MaxNumOutboundPeers = 40
+
+ return cfg
+}
+
+// initAppConfig helps to override default appConfig template and configs.
+// return "", nil if no custom configuration is required for the application.
+func initAppConfig() (string, interface{}) {
+ // The following code snippet is just for reference.
+
+ type CustomAppConfig struct {
+ serverconfig.Config
+
+ Wasm wasmtypes.WasmConfig `mapstructure:"wasm"`
+ }
+
+ // Optionally allow the chain developer to overwrite the SDK's default
+ // server config.
+ srvCfg := serverconfig.DefaultConfig()
+ // The SDK's default minimum gas price is set to "" (empty value) inside
+ // app.toml. If left empty by validators, the node will halt on startup.
+ // However, the chain developer can set a default app.toml value for their
+ // validators here.
+ //
+ // In summary:
+ // - if you leave srvCfg.MinGasPrices = "", all validators MUST tweak their
+ // own app.toml config,
+ // - if you set srvCfg.MinGasPrices non-empty, validators CAN tweak their
+ // own app.toml to override, or use this default value.
+ //
+ // In simapp, we set the min gas prices to 0.
+ srvCfg.MinGasPrices = "0stake"
+ // srvCfg.BaseConfig.IAVLDisableFastNode = true // disable fastnode by default
+
+ customAppConfig := CustomAppConfig{
+ Config: *srvCfg,
+ Wasm: wasmtypes.DefaultWasmConfig(),
+ }
+
+ customAppTemplate := serverconfig.DefaultConfigTemplate +
+ wasmtypes.DefaultConfigTemplate()
+
+ return customAppTemplate, customAppConfig
+}
+
func initRootCmd(rootCmd *cobra.Command, encodingConfig params.EncodingConfig) {
rootCmd.AddCommand(
genutilcli.InitCmd(app.ModuleBasics, app.DefaultNodeHome),
- genutilcli.CollectGenTxsCmd(banktypes.GenesisBalancesIterator{}, app.DefaultNodeHome),
- genutilcli.GenTxCmd(app.ModuleBasics, encodingConfig.TxConfig, banktypes.GenesisBalancesIterator{}, app.DefaultNodeHome),
- genutilcli.ValidateGenesisCmd(app.ModuleBasics),
- AddGenesisAccountCmd(app.DefaultNodeHome),
- tmcli.NewCompletionCmd(rootCmd, true),
// testnetCmd(app.ModuleBasics, banktypes.GenesisBalancesIterator{}),
debug.Cmd(),
config.Cmd(),
+ pruning.PruningCmd(newApp),
)
- ac := appCreator{
- encCfg: encodingConfig,
- }
- server.AddCommands(rootCmd, app.DefaultNodeHome, ac.newApp, ac.appExport, addModuleInitFlags)
+ server.AddCommands(rootCmd, app.DefaultNodeHome, newApp, appExport, addModuleInitFlags)
// add keybase, auxiliary RPC, query, and tx child commands
rootCmd.AddCommand(
rpc.StatusCommand(),
+ genesisCommand(encodingConfig),
queryCommand(),
txCommand(),
keys.Commands(app.DefaultNodeHome),
)
+ // add rosetta
+ rootCmd.AddCommand(rosettaCmd.RosettaCommand(encodingConfig.InterfaceRegistry, encodingConfig.Marshaler))
}
func addModuleInitFlags(startCmd *cobra.Command) {
@@ -124,12 +173,22 @@ func addModuleInitFlags(startCmd *cobra.Command) {
wasm.AddModuleInitFlags(startCmd)
}
+// genesisCommand builds genesis-related `simd genesis` command. Users may provide application specific commands as a parameter
+func genesisCommand(encodingConfig params.EncodingConfig, cmds ...*cobra.Command) *cobra.Command {
+ cmd := genutilcli.GenesisCoreCommand(encodingConfig.TxConfig, app.ModuleBasics, app.DefaultNodeHome)
+
+ for _, subCmd := range cmds {
+ cmd.AddCommand(subCmd)
+ }
+ return cmd
+}
+
func queryCommand() *cobra.Command {
cmd := &cobra.Command{
Use: "query",
Aliases: []string{"q"},
Short: "Querying subcommands",
- DisableFlagParsing: true,
+ DisableFlagParsing: false,
SuggestionsMinimumDistance: 2,
RunE: client.ValidateCmd,
}
@@ -143,7 +202,6 @@ func queryCommand() *cobra.Command {
)
app.ModuleBasics.AddQueryCommands(cmd)
- cmd.PersistentFlags().String(flags.FlagChainID, "", "The network chain ID")
return cmd
}
@@ -152,7 +210,7 @@ func txCommand() *cobra.Command {
cmd := &cobra.Command{
Use: "tx",
Short: "Transactions subcommands",
- DisableFlagParsing: true,
+ DisableFlagParsing: false,
SuggestionsMinimumDistance: 2,
RunE: client.ValidateCmd,
}
@@ -163,80 +221,42 @@ func txCommand() *cobra.Command {
authcmd.GetMultiSignCommand(),
authcmd.GetMultiSignBatchCmd(),
authcmd.GetValidateSignaturesCommand(),
- flags.LineBreak,
authcmd.GetBroadcastCommand(),
authcmd.GetEncodeCommand(),
authcmd.GetDecodeCommand(),
+ authcmd.GetAuxToFeeCommand(),
)
app.ModuleBasics.AddTxCommands(cmd)
- cmd.PersistentFlags().String(flags.FlagChainID, "", "The network chain ID")
return cmd
}
-type appCreator struct {
- encCfg params.EncodingConfig
-}
-
-func (ac appCreator) newApp(
+// newApp creates the application
+func newApp(
logger log.Logger,
db dbm.DB,
traceStore io.Writer,
appOpts servertypes.AppOptions,
) servertypes.Application {
- var cache sdk.MultiStorePersistentCache
-
- if cast.ToBool(appOpts.Get(server.FlagInterBlockCache)) {
- cache = store.NewCommitKVStoreCacheManager()
- }
-
- skipUpgradeHeights := make(map[int64]bool)
- for _, h := range cast.ToIntSlice(appOpts.Get(server.FlagUnsafeSkipUpgrades)) {
- skipUpgradeHeights[int64(h)] = true
- }
-
- pruningOpts, err := server.GetPruningOptionsFromFlags(appOpts)
- if err != nil {
- panic(err)
- }
+ baseappOptions := server.DefaultBaseappOptions(appOpts)
- snapshotDir := filepath.Join(cast.ToString(appOpts.Get(flags.FlagHome)), "data", "snapshots")
- snapshotDB, err := sdk.NewLevelDB("metadata", snapshotDir)
- if err != nil {
- panic(err)
- }
- snapshotStore, err := snapshots.NewStore(snapshotDB, snapshotDir)
- if err != nil {
- panic(err)
- }
var wasmOpts []wasm.Option
if cast.ToBool(appOpts.Get("telemetry.enabled")) {
wasmOpts = append(wasmOpts, wasmkeeper.WithVMCacheMetrics(prometheus.DefaultRegisterer))
}
- return app.NewWasmApp(logger, db, traceStore, true, skipUpgradeHeights,
- cast.ToString(appOpts.Get(flags.FlagHome)),
- cast.ToUint(appOpts.Get(server.FlagInvCheckPeriod)),
- ac.encCfg,
+ return app.NewWasmApp(
+ logger, db, traceStore, true,
app.GetEnabledProposals(),
appOpts,
wasmOpts,
- baseapp.SetPruning(pruningOpts),
- baseapp.SetMinGasPrices(cast.ToString(appOpts.Get(server.FlagMinGasPrices))),
- baseapp.SetHaltHeight(cast.ToUint64(appOpts.Get(server.FlagHaltHeight))),
- baseapp.SetHaltTime(cast.ToUint64(appOpts.Get(server.FlagHaltTime))),
- baseapp.SetMinRetainBlocks(cast.ToUint64(appOpts.Get(server.FlagMinRetainBlocks))),
- baseapp.SetInterBlockCache(cache),
- baseapp.SetTrace(cast.ToBool(appOpts.Get(server.FlagTrace))),
- baseapp.SetIndexEvents(cast.ToStringSlice(appOpts.Get(server.FlagIndexEvents))),
- baseapp.SetSnapshotStore(snapshotStore),
- baseapp.SetSnapshotInterval(cast.ToUint64(appOpts.Get(server.FlagStateSyncSnapshotInterval))),
- baseapp.SetSnapshotKeepRecent(cast.ToUint32(appOpts.Get(server.FlagStateSyncSnapshotKeepRecent))),
+ baseappOptions...,
)
}
-func (ac appCreator) appExport(
+// appExport creates a new wasm app (optionally at a given height) and exports state.
+func appExport(
logger log.Logger,
db dbm.DB,
traceStore io.Writer,
@@ -244,6 +264,7 @@ func (ac appCreator) appExport(
forZeroHeight bool,
jailAllowedAddrs []string,
appOpts servertypes.AppOptions,
+ modulesToExport []string,
) (servertypes.ExportedApp, error) {
var wasmApp *app.WasmApp
homePath, ok := appOpts.Get(flags.FlagHome).(string)
@@ -251,17 +272,21 @@ func (ac appCreator) appExport(
return servertypes.ExportedApp{}, errors.New("application home is not set")
}
- loadLatest := height == -1
+ viperAppOpts, ok := appOpts.(*viper.Viper)
+ if !ok {
+ return servertypes.ExportedApp{}, errors.New("appOpts is not viper.Viper")
+ }
+
+ // overwrite the FlagInvCheckPeriod
+ viperAppOpts.Set(server.FlagInvCheckPeriod, 1)
+ appOpts = viperAppOpts
+
var emptyWasmOpts []wasm.Option
wasmApp = app.NewWasmApp(
logger,
db,
traceStore,
- loadLatest,
- map[int64]bool{},
- homePath,
- cast.ToUint(appOpts.Get(server.FlagInvCheckPeriod)),
- ac.encCfg,
+ height == -1,
app.GetEnabledProposals(),
appOpts,
emptyWasmOpts,
@@ -273,5 +298,5 @@ func (ac appCreator) appExport(
}
}
- return wasmApp.ExportAppStateAndValidators(forZeroHeight, jailAllowedAddrs)
+ return wasmApp.ExportAppStateAndValidators(forZeroHeight, jailAllowedAddrs, modulesToExport)
}
diff --git a/contrib/local/01-accounts.sh b/contrib/local/01-accounts.sh
index 1cb4b0e515..4aecc65b73 100755
--- a/contrib/local/01-accounts.sh
+++ b/contrib/local/01-accounts.sh
@@ -1,18 +1,18 @@
#!/bin/bash
set -o errexit -o nounset -o pipefail
-BASE_ACCOUNT=$(wasmd keys show validator -a)
+BASE_ACCOUNT=$(wasmd keys show validator -a --keyring-backend=test)
wasmd q account "$BASE_ACCOUNT" -o json | jq
echo "## Add new account"
-wasmd keys add fred
+wasmd keys add fred --keyring-backend=test
echo "## Check balance"
-NEW_ACCOUNT=$(wasmd keys show fred -a)
+NEW_ACCOUNT=$(wasmd keys show fred -a --keyring-backend=test)
wasmd q bank balances "$NEW_ACCOUNT" -o json || true
echo "## Transfer tokens"
-wasmd tx bank send validator "$NEW_ACCOUNT" 1ustake --gas 1000000 -y --chain-id=testing --node=http://localhost:26657 -b block -o json | jq
+wasmd tx bank send validator "$NEW_ACCOUNT" 1ustake --gas 1000000 -y --chain-id=testing --node=http://localhost:26657 -b sync -o json --keyring-backend=test | jq
echo "## Check balance again"
wasmd q bank balances "$NEW_ACCOUNT" -o json | jq
diff --git a/contrib/local/02-contracts.sh b/contrib/local/02-contracts.sh
index c445d948b6..d3ea4bff2c 100755
--- a/contrib/local/02-contracts.sh
+++ b/contrib/local/02-contracts.sh
@@ -6,10 +6,11 @@ DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
echo "-----------------------"
echo "## Add new CosmWasm contract"
RESP=$(wasmd tx wasm store "$DIR/../../x/wasm/keeper/testdata/hackatom.wasm" \
- --from validator --gas 1500000 -y --chain-id=testing --node=http://localhost:26657 -b block -o json)
-
-CODE_ID=$(echo "$RESP" | jq -r '.logs[0].events[1].attributes[-1].value')
-CODE_HASH=$(echo "$RESP" | jq -r '.logs[0].events[1].attributes[-2].value')
+ --from validator --gas 1500000 -y --chain-id=testing --node=http://localhost:26657 -b sync -o json --keyring-backend=test)
+sleep 6
+RESP=$(wasmd q tx $(echo "$RESP"| jq -r '.txhash') -o json)
+CODE_ID=$(echo "$RESP" | jq -r '.logs[0].events[]| select(.type=="store_code").attributes[]| select(.key=="code_id").value')
+CODE_HASH=$(echo "$RESP" | jq -r '.logs[0].events[]| select(.type=="store_code").attributes[]| select(.key=="code_checksum").value')
echo "* Code id: $CODE_ID"
echo "* Code checksum: $CODE_HASH"
@@ -19,26 +20,31 @@ wasmd q wasm code "$CODE_ID" "$TMPDIR"
rm -f "$TMPDIR"
echo "-----------------------"
echo "## List code"
-wasmd query wasm list-code --node=http://localhost:26657 --chain-id=testing -o json | jq
+wasmd query wasm list-code --node=http://localhost:26657 -o json | jq
echo "-----------------------"
echo "## Create new contract instance"
-INIT="{\"verifier\":\"$(wasmd keys show validator -a)\", \"beneficiary\":\"$(wasmd keys show fred -a)\"}"
-wasmd tx wasm instantiate "$CODE_ID" "$INIT" --admin="$(wasmd keys show validator -a)" \
+INIT="{\"verifier\":\"$(wasmd keys show validator -a --keyring-backend=test)\", \"beneficiary\":\"$(wasmd keys show fred -a --keyring-backend=test)\"}"
+RESP=$(wasmd tx wasm instantiate "$CODE_ID" "$INIT" --admin="$(wasmd keys show validator -a --keyring-backend=test)" \
--from validator --amount="100ustake" --label "local0.1.0" \
- --gas 1000000 -y --chain-id=testing -b block -o json | jq
+ --gas 1000000 -y --chain-id=testing -b sync -o json --keyring-backend=test)
+sleep 6
+wasmd q tx $(echo "$RESP"| jq -r '.txhash') -o json | jq
CONTRACT=$(wasmd query wasm list-contract-by-code "$CODE_ID" -o json | jq -r '.contracts[-1]')
echo "* Contract address: $CONTRACT"
echo "## Create new contract instance with predictable address"
-wasmd tx wasm instantiate2 "$CODE_ID" "$INIT" $(echo -n "testing" | xxd -ps) \
- --admin="$(wasmd keys show validator -a)" \
+RESP=$(wasmd tx wasm instantiate2 "$CODE_ID" "$INIT" $(echo -n "testing" | xxd -ps) \
+ --admin="$(wasmd keys show validator -a --keyring-backend=test)" \
--from validator --amount="100ustake" --label "local0.1.0" \
--fix-msg \
- --gas 1000000 -y --chain-id=testing -b block -o json | jq
+ --gas 1000000 -y --chain-id=testing -b sync -o json --keyring-backend=test)
+sleep 6
+wasmd q tx $(echo "$RESP"| jq -r '.txhash') -o json | jq
+
-predictedAdress=$(wasmd q wasm build-address "$CODE_HASH" $(wasmd keys show validator -a) $(echo -n "testing" | xxd -ps) "$INIT")
+predictedAdress=$(wasmd q wasm build-address "$CODE_HASH" $(wasmd keys show validator -a --keyring-backend=test) $(echo -n "testing" | xxd -ps) "$INIT")
wasmd q wasm contract "$predictedAdress" -o json | jq
echo "### Query all"
@@ -53,30 +59,39 @@ wasmd query wasm contract-state raw "$CONTRACT" "$KEY" -o json | jq
echo "-----------------------"
echo "## Execute contract $CONTRACT"
MSG='{"release":{}}'
-wasmd tx wasm execute "$CONTRACT" "$MSG" \
+RESP=$(wasmd tx wasm execute "$CONTRACT" "$MSG" \
--from validator \
- --gas 1000000 -y --chain-id=testing -b block -o json | jq
+ --gas 1000000 -y --chain-id=testing -b sync -o json --keyring-backend=test)
+sleep 6
+wasmd q tx $(echo "$RESP"| jq -r '.txhash') -o json | jq
+
echo "-----------------------"
echo "## Set new admin"
echo "### Query old admin: $(wasmd q wasm contract "$CONTRACT" -o json | jq -r '.contract_info.admin')"
echo "### Update contract"
-wasmd tx wasm set-contract-admin "$CONTRACT" "$(wasmd keys show fred -a)" \
- --from validator -y --chain-id=testing -b block -o json | jq
+RESP=$(wasmd tx wasm set-contract-admin "$CONTRACT" "$(wasmd keys show fred -a --keyring-backend=test)" \
+ --from validator -y --chain-id=testing -b sync -o json --keyring-backend=test)
+sleep 6
+wasmd q tx $(echo "$RESP"| jq -r '.txhash') -o json | jq
+
echo "### Query new admin: $(wasmd q wasm contract "$CONTRACT" -o json | jq -r '.contract_info.admin')"
echo "-----------------------"
echo "## Migrate contract"
echo "### Upload new code"
RESP=$(wasmd tx wasm store "$DIR/../../x/wasm/keeper/testdata/burner.wasm" \
- --from validator --gas 1000000 -y --chain-id=testing --node=http://localhost:26657 -b block -o json)
-
-BURNER_CODE_ID=$(echo "$RESP" | jq -r '.logs[0].events[1].attributes[-1].value')
+ --from validator --gas 1000000 -y --chain-id=testing --node=http://localhost:26657 -b sync -o json --keyring-backend=test)
+sleep 6
+RESP=$(wasmd q tx $(echo "$RESP"| jq -r '.txhash') -o json)
+BURNER_CODE_ID=$(echo "$RESP" | jq -r '.logs[0].events[]| select(.type=="store_code").attributes[]| select(.key=="code_id").value')
echo "### Migrate to code id: $BURNER_CODE_ID"
-DEST_ACCOUNT=$(wasmd keys show fred -a)
-wasmd tx wasm migrate "$CONTRACT" "$BURNER_CODE_ID" "{\"payout\": \"$DEST_ACCOUNT\"}" --from fred \
- --chain-id=testing -b block -y -o json | jq
+DEST_ACCOUNT=$(wasmd keys show fred -a --keyring-backend=test)
+RESP=$(wasmd tx wasm migrate "$CONTRACT" "$BURNER_CODE_ID" "{\"payout\": \"$DEST_ACCOUNT\"}" --from fred \
+ --chain-id=testing -b sync -y -o json --keyring-backend=test)
+sleep 6
+wasmd q tx $(echo "$RESP"| jq -r '.txhash') -o json | jq
echo "### Query destination account: $BURNER_CODE_ID"
wasmd q bank balances "$DEST_ACCOUNT" -o json | jq
@@ -90,6 +105,8 @@ echo "-----------------------"
echo "## Clear contract admin"
echo "### Query old admin: $(wasmd q wasm contract "$CONTRACT" -o json | jq -r '.contract_info.admin')"
echo "### Update contract"
-wasmd tx wasm clear-contract-admin "$CONTRACT" \
- --from fred -y --chain-id=testing -b block -o json | jq
+RESP=$(wasmd tx wasm clear-contract-admin "$CONTRACT" \
+ --from fred -y --chain-id=testing -b sync -o json --keyring-backend=test)
+sleep 6
+wasmd q tx $(echo "$RESP"| jq -r '.txhash') -o json | jq
echo "### Query new admin: $(wasmd q wasm contract "$CONTRACT" -o json | jq -r '.contract_info.admin')"
diff --git a/contrib/local/03-grpc-queries.sh b/contrib/local/03-grpc-queries.sh
index 5eefaf5e08..f1d56d33f4 100755
--- a/contrib/local/03-grpc-queries.sh
+++ b/contrib/local/03-grpc-queries.sh
@@ -4,28 +4,21 @@ set -o errexit -o nounset -o pipefail
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
echo "-----------------------"
-PROTO_THRD="$DIR/../../third_party/proto"
-PROTO_WASMD="$DIR/../../proto"
-PROTO_WASMD_QUERY="$PROTO_WASMD/cosmwasm/wasm/v1/query.proto"
echo "### List all codes"
-RESP=$(grpcurl -plaintext -import-path "$PROTO_THRD" -import-path "$PROTO_WASMD" -proto "$PROTO_WASMD_QUERY" \
- localhost:9090 cosmwasm.wasm.v1.Query/Codes)
+RESP=$(grpcurl -plaintext localhost:9090 cosmwasm.wasm.v1.Query/Codes)
echo "$RESP" | jq
CODE_ID=$(echo "$RESP" | jq -r '.codeInfos[-1].codeId')
echo "### List contracts by code"
-RESP=$(grpcurl -plaintext -import-path "$PROTO_THRD" -import-path "$PROTO_WASMD" -proto "$PROTO_WASMD_QUERY" \
- -d "{\"codeId\": $CODE_ID}" localhost:9090 cosmwasm.wasm.v1.Query/ContractsByCode)
+RESP=$(grpcurl -plaintext -d "{\"codeId\": $CODE_ID}" localhost:9090 cosmwasm.wasm.v1.Query/ContractsByCode)
echo "$RESP" | jq
echo "### Show history for contract"
CONTRACT=$(echo "$RESP" | jq -r ".contracts[-1]")
-grpcurl -plaintext -import-path "$PROTO_THRD" -import-path "$PROTO_WASMD" -proto "$PROTO_WASMD_QUERY" \
- -d "{\"address\": \"$CONTRACT\"}" localhost:9090 cosmwasm.wasm.v1.Query/ContractHistory | jq
+grpcurl -plaintext -d "{\"address\": \"$CONTRACT\"}" localhost:9090 cosmwasm.wasm.v1.Query/ContractHistory | jq
echo "### Show contract state"
-grpcurl -plaintext -import-path "$PROTO_THRD" -import-path "$PROTO_WASMD" -proto "$PROTO_WASMD_QUERY" \
- -d "{\"address\": \"$CONTRACT\"}" localhost:9090 cosmwasm.wasm.v1.Query/AllContractState | jq
+grpcurl -plaintext -d "{\"address\": \"$CONTRACT\"}" localhost:9090 cosmwasm.wasm.v1.Query/AllContractState | jq
echo "Empty state due to 'burner' contract cleanup"
diff --git a/contrib/local/setup_wasmd.sh b/contrib/local/setup_wasmd.sh
index 5ea14f9f0c..6f96609fb0 100755
--- a/contrib/local/setup_wasmd.sh
+++ b/contrib/local/setup_wasmd.sh
@@ -11,18 +11,18 @@ wasmd init --chain-id "$CHAIN_ID" "$MONIKER"
# staking/governance token is hardcoded in config, change this
## OSX requires: -i.
sed -i. "s/\"stake\"/\"$STAKE\"/" "$HOME"/.wasmd/config/genesis.json
-if ! wasmd keys show validator; then
+if ! wasmd keys show validator --keyring-backend=test; then
(
echo "$PASSWORD"
echo "$PASSWORD"
- ) | wasmd keys add validator
+ ) | wasmd keys add validator --keyring-backend=test
fi
# hardcode the validator account for this instance
-echo "$PASSWORD" | wasmd add-genesis-account validator "1000000000$STAKE,1000000000$FEE"
+echo "$PASSWORD" | wasmd genesis add-genesis-account validator "1000000000$STAKE,1000000000$FEE" --keyring-backend=test
# (optionally) add a few more genesis accounts
for addr in "$@"; do
echo "$addr"
- wasmd add-genesis-account "$addr" "1000000000$STAKE,1000000000$FEE"
+ wasmd genesis add-genesis-account "$addr" "1000000000$STAKE,1000000000$FEE" --keyring-backend=test
done
# submit a genesis validator tx
## Workraround for https://github.com/cosmos/cosmos-sdk/issues/8251
@@ -30,7 +30,7 @@ done
echo "$PASSWORD"
echo "$PASSWORD"
echo "$PASSWORD"
-) | wasmd gentx validator "250000000$STAKE" --chain-id="$CHAIN_ID" --amount="250000000$STAKE"
+) | wasmd genesis gentx validator "250000000$STAKE" --chain-id="$CHAIN_ID" --amount="250000000$STAKE" --keyring-backend=test
## should be:
# (echo "$PASSWORD"; echo "$PASSWORD"; echo "$PASSWORD") | wasmd gentx validator "250000000$STAKE" --chain-id="$CHAIN_ID"
-wasmd collect-gentxs
+wasmd genesis collect-gentxs
diff --git a/docker/setup_wasmd.sh b/docker/setup_wasmd.sh
index 9b07538fee..485e534c48 100755
--- a/docker/setup_wasmd.sh
+++ b/docker/setup_wasmd.sh
@@ -17,17 +17,17 @@ if ! wasmd keys show validator; then
(echo "$PASSWORD"; echo "$PASSWORD") | wasmd keys add validator
fi
# hardcode the validator account for this instance
-echo "$PASSWORD" | wasmd add-genesis-account validator "1000000000$STAKE,1000000000$FEE"
+echo "$PASSWORD" | wasmd genesis add-genesis-account validator "1000000000$STAKE,1000000000$FEE"
# (optionally) add a few more genesis accounts
for addr in "$@"; do
echo $addr
- wasmd add-genesis-account "$addr" "1000000000$STAKE,1000000000$FEE"
+ wasmd genesis add-genesis-account "$addr" "1000000000$STAKE,1000000000$FEE"
done
# submit a genesis validator tx
## Workraround for https://github.com/cosmos/cosmos-sdk/issues/8251
-(echo "$PASSWORD"; echo "$PASSWORD"; echo "$PASSWORD") | wasmd gentx validator "250000000$STAKE" --chain-id="$CHAIN_ID" --amount="250000000$STAKE"
+(echo "$PASSWORD"; echo "$PASSWORD"; echo "$PASSWORD") | wasmd genesis gentx validator "250000000$STAKE" --chain-id="$CHAIN_ID" --amount="250000000$STAKE"
## should be:
# (echo "$PASSWORD"; echo "$PASSWORD"; echo "$PASSWORD") | wasmd gentx validator "250000000$STAKE" --chain-id="$CHAIN_ID"
-wasmd collect-gentxs
+wasmd genesis collect-gentxs
diff --git a/docs/proto/proto-docs.md b/docs/proto/proto-docs.md
index 9c609e8b4a..b0ad0b0445 100644
--- a/docs/proto/proto-docs.md
+++ b/docs/proto/proto-docs.md
@@ -98,6 +98,8 @@
- [MsgUpdateAdminResponse](#cosmwasm.wasm.v1.MsgUpdateAdminResponse)
- [MsgUpdateInstantiateConfig](#cosmwasm.wasm.v1.MsgUpdateInstantiateConfig)
- [MsgUpdateInstantiateConfigResponse](#cosmwasm.wasm.v1.MsgUpdateInstantiateConfigResponse)
+ - [MsgUpdateParams](#cosmwasm.wasm.v1.MsgUpdateParams)
+ - [MsgUpdateParamsResponse](#cosmwasm.wasm.v1.MsgUpdateParamsResponse)
- [Msg](#cosmwasm.wasm.v1.Msg)
@@ -1551,6 +1553,39 @@ MsgUpdateInstantiateConfigResponse returns empty data
+
+
+
+### MsgUpdateParams
+MsgUpdateParams is the Msg/UpdateParams request type.
+
+Since: 0.40
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| `authority` | [string](#string) | | authority is the address of the governance account. |
+| `params` | [Params](#cosmwasm.wasm.v1.Params) | | params defines the x/wasm parameters to update.
+
+NOTE: All parameters must be supplied. |
+
+
+
+
+
+
+
+
+### MsgUpdateParamsResponse
+MsgUpdateParamsResponse defines the response structure for executing a
+MsgUpdateParams message.
+
+Since: 0.40
+
+
+
+
+
@@ -1573,6 +1608,9 @@ Msg defines the wasm Msg service.
| `UpdateAdmin` | [MsgUpdateAdmin](#cosmwasm.wasm.v1.MsgUpdateAdmin) | [MsgUpdateAdminResponse](#cosmwasm.wasm.v1.MsgUpdateAdminResponse) | UpdateAdmin sets a new admin for a smart contract | |
| `ClearAdmin` | [MsgClearAdmin](#cosmwasm.wasm.v1.MsgClearAdmin) | [MsgClearAdminResponse](#cosmwasm.wasm.v1.MsgClearAdminResponse) | ClearAdmin removes any admin stored for a smart contract | |
| `UpdateInstantiateConfig` | [MsgUpdateInstantiateConfig](#cosmwasm.wasm.v1.MsgUpdateInstantiateConfig) | [MsgUpdateInstantiateConfigResponse](#cosmwasm.wasm.v1.MsgUpdateInstantiateConfigResponse) | UpdateInstantiateConfig updates instantiate config for a smart contract | |
+| `UpdateParams` | [MsgUpdateParams](#cosmwasm.wasm.v1.MsgUpdateParams) | [MsgUpdateParamsResponse](#cosmwasm.wasm.v1.MsgUpdateParamsResponse) | UpdateParams defines a governance operation for updating the x/wasm module parameters. The authority is defined in the keeper.
+
+Since: 0.40 | |
diff --git a/go.mod b/go.mod
index 2d43bd2ac3..c6362f44c0 100644
--- a/go.mod
+++ b/go.mod
@@ -5,159 +5,181 @@ go 1.19
require (
github.com/CosmWasm/wasmvm v1.2.1
github.com/cosmos/cosmos-proto v1.0.0-beta.2
- github.com/cosmos/cosmos-sdk v0.45.14
+ github.com/cosmos/cosmos-sdk v0.47.0
+ github.com/cosmos/gogogateway v1.2.0 // indirect
github.com/cosmos/gogoproto v1.4.6
- github.com/cosmos/iavl v0.19.5
- github.com/cosmos/ibc-go/v4 v4.3.0
- github.com/cosmos/interchain-accounts v0.2.6
+ github.com/cosmos/iavl v0.20.0
+ github.com/cosmos/ibc-go/v7 v7.0.0
+ github.com/cosmos/ics23/go v0.9.1-0.20221207100636-b1abd8678aab // indirect
github.com/docker/distribution v2.8.1+incompatible
- github.com/dvsekhvalnov/jose2go v1.5.0
- github.com/gogo/protobuf v1.3.3
- github.com/golang/protobuf v1.5.2
+ github.com/dvsekhvalnov/jose2go v1.5.0 // indirect
+ github.com/golang/protobuf v1.5.3
github.com/google/gofuzz v1.2.0
- github.com/gorilla/mux v1.8.0
+ github.com/gorilla/mux v1.8.0 // indirect
github.com/grpc-ecosystem/grpc-gateway v1.16.0
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.14.0
- github.com/rakyll/statik v0.1.7
+ github.com/rakyll/statik v0.1.7 // indirect
github.com/snikch/goodman v0.0.0-20171125024755-10e37e294daa
github.com/spf13/cast v1.5.0
github.com/spf13/cobra v1.6.1
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.8.2
- github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7
- github.com/tendermint/tendermint v0.34.26
- github.com/tendermint/tm-db v0.6.7
- google.golang.org/genproto v0.0.0-20230125152338-dcaf20b6aeaa
+ github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d
+ google.golang.org/genproto v0.0.0-20230216225411-c8e22ba71e44
google.golang.org/grpc v1.53.0
gopkg.in/yaml.v2 v2.4.0
)
require (
- cosmossdk.io/api v0.2.6 // indirect
- cosmossdk.io/core v0.5.1 // indirect
+ cosmossdk.io/api v0.3.1
+ cosmossdk.io/core v0.5.1
+ cosmossdk.io/errors v1.0.0-beta.7
+ cosmossdk.io/math v1.0.0-rc.0
+ cosmossdk.io/tools/rosetta v0.2.1
+ github.com/cometbft/cometbft v0.37.0
+ github.com/cometbft/cometbft-db v0.7.0
+ github.com/spf13/viper v1.15.0
+)
+
+require (
+ cloud.google.com/go v0.110.0 // indirect
+ cloud.google.com/go/compute v1.18.0 // indirect
+ cloud.google.com/go/compute/metadata v0.2.3 // indirect
+ cloud.google.com/go/iam v0.12.0 // indirect
+ cloud.google.com/go/storage v1.29.0 // indirect
cosmossdk.io/depinject v1.0.0-alpha.3 // indirect
- filippo.io/edwards25519 v1.0.0-beta.2 // indirect
+ filippo.io/edwards25519 v1.0.0 // indirect
github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect
github.com/99designs/keyring v1.2.1 // indirect
github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d // indirect
- github.com/DataDog/zstd v1.4.5 // indirect
- github.com/HdrHistogram/hdrhistogram-go v1.1.2 // indirect
- github.com/Workiva/go-datastructures v1.0.53 // indirect
- github.com/armon/go-metrics v0.4.0 // indirect
+ github.com/armon/go-metrics v0.4.1 // indirect
+ github.com/aws/aws-sdk-go v1.44.203 // indirect
github.com/beorn7/perks v1.0.1 // indirect
+ github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect
github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect
- github.com/btcsuite/btcd v0.22.2 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect
+ github.com/cenkalti/backoff/v4 v4.1.3 // indirect
github.com/cespare/xxhash v1.1.0 // indirect
- github.com/cespare/xxhash/v2 v2.1.2 // indirect
- github.com/cockroachdb/errors v1.9.1 // indirect
- github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect
- github.com/cockroachdb/pebble v0.0.0-20220817183557-09c6e030a677 // indirect
- github.com/cockroachdb/redact v1.1.3 // indirect
- github.com/coinbase/rosetta-sdk-go v0.7.0 // indirect
+ github.com/cespare/xxhash/v2 v2.2.0 // indirect
+ github.com/chzyer/readline v1.5.1 // indirect
+ github.com/cockroachdb/apd/v2 v2.0.2 // indirect
+ github.com/coinbase/rosetta-sdk-go/types v1.0.0 // indirect
github.com/confio/ics23/go v0.9.0 // indirect
- github.com/cosmos/btcutil v1.0.4 // indirect
- github.com/cosmos/cosmos-db v0.0.0-20221226095112-f3c38ecb5e32 // indirect
+ github.com/cosmos/btcutil v1.0.5 // indirect
github.com/cosmos/go-bip39 v1.0.0 // indirect
- github.com/cosmos/gorocksdb v1.2.0 // indirect
- github.com/cosmos/ledger-cosmos-go v0.12.2 // indirect
- github.com/creachadair/taskgroup v0.3.2 // indirect
+ github.com/cosmos/ledger-cosmos-go v0.12.1 // indirect
+ github.com/cosmos/rosetta-sdk-go v0.10.0 // indirect
+ github.com/creachadair/taskgroup v0.4.2 // indirect
github.com/danieljoos/wincred v1.1.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
- github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect
+ github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect
github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect
github.com/dgraph-io/badger/v2 v2.2007.4 // indirect
- github.com/dgraph-io/ristretto v0.1.0 // indirect
+ github.com/dgraph-io/ristretto v0.1.1 // indirect
github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect
- github.com/dustin/go-humanize v1.0.0 // indirect
- github.com/felixge/httpsnoop v1.0.1 // indirect
+ github.com/dustin/go-humanize v1.0.1 // indirect
+ github.com/felixge/httpsnoop v1.0.2 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
- github.com/getsentry/sentry-go v0.17.0 // indirect
github.com/go-kit/kit v0.12.0 // indirect
github.com/go-kit/log v0.2.1 // indirect
- github.com/go-logfmt/logfmt v0.5.1 // indirect
+ github.com/go-logfmt/logfmt v0.6.0 // indirect
github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect
- github.com/gogo/gateway v1.1.0 // indirect
- github.com/golang/glog v1.0.0 // indirect
+ github.com/gogo/googleapis v1.4.1 // indirect
+ github.com/gogo/protobuf v1.3.2 // indirect
+ github.com/golang/glog v1.1.0 // indirect
+ github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
+ github.com/golang/mock v1.6.0 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/btree v1.1.2 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/orderedcode v0.0.1 // indirect
+ github.com/google/uuid v1.3.0 // indirect
+ github.com/googleapis/enterprise-certificate-proxy v0.2.3 // indirect
+ github.com/googleapis/gax-go/v2 v2.7.0 // indirect
github.com/gorilla/handlers v1.5.1 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect
github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect
github.com/gtank/merlin v0.1.1 // indirect
github.com/gtank/ristretto255 v0.1.2 // indirect
+ github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
+ github.com/hashicorp/go-getter v1.7.0 // indirect
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
- github.com/hashicorp/golang-lru v0.5.4 // indirect
+ github.com/hashicorp/go-safetemp v1.0.0 // indirect
+ github.com/hashicorp/go-version v1.6.0 // indirect
+ github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
- github.com/hdevalence/ed25519consensus v0.0.0-20210204194344-59a8610d2b87 // indirect
- github.com/improbable-eng/grpc-web v0.14.1 // indirect
- github.com/inconshreveable/mousetrap v1.0.1 // indirect
+ github.com/hdevalence/ed25519consensus v0.1.0 // indirect
+ github.com/huandu/skiplist v1.2.0 // indirect
+ github.com/improbable-eng/grpc-web v0.15.0 // indirect
+ github.com/inconshreveable/mousetrap v1.1.0 // indirect
+ github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/jmhodges/levigo v1.0.0 // indirect
- github.com/klauspost/compress v1.15.11 // indirect
- github.com/kr/pretty v0.3.1 // indirect
- github.com/kr/text v0.2.0 // indirect
- github.com/lib/pq v1.10.6 // indirect
+ github.com/json-iterator/go v1.1.12 // indirect
+ github.com/klauspost/compress v1.16.3 // indirect
+ github.com/lib/pq v1.10.7 // indirect
github.com/libp2p/go-buffer-pool v0.1.0 // indirect
- github.com/linxGnu/grocksdb v1.7.10 // indirect
- github.com/magiconair/properties v1.8.6 // indirect
- github.com/mattn/go-colorable v0.1.13 // indirect
- github.com/mattn/go-isatty v0.0.16 // indirect
- github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
+ github.com/magiconair/properties v1.8.7 // indirect
+ github.com/manifoldco/promptui v0.9.0 // indirect
+ github.com/mattn/go-isatty v0.0.17 // indirect
+ github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/mimoo/StrobeGo v0.0.0-20210601165009-122bf33a46e0 // indirect
github.com/minio/highwayhash v1.0.2 // indirect
+ github.com/mitchellh/go-homedir v1.1.0 // indirect
+ github.com/mitchellh/go-testing-interface v1.14.1 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
+ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
+ github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/mtibben/percent v0.2.1 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
- github.com/pelletier/go-toml v1.9.5 // indirect
- github.com/pelletier/go-toml/v2 v2.0.5 // indirect
- github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 // indirect
+ github.com/pelletier/go-toml/v2 v2.0.6 // indirect
+ github.com/petermattis/goid v0.0.0-20221215004737-a150e88a970d // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_model v0.3.0 // indirect
- github.com/prometheus/common v0.37.0 // indirect
- github.com/prometheus/procfs v0.8.0 // indirect
+ github.com/prometheus/common v0.40.0 // indirect
+ github.com/prometheus/procfs v0.9.0 // indirect
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
- github.com/regen-network/cosmos-proto v0.3.1 // indirect
- github.com/rogpeppe/go-internal v1.9.0 // indirect
- github.com/rs/cors v1.8.2 // indirect
- github.com/rs/zerolog v1.27.0 // indirect
+ github.com/rs/cors v1.8.3 // indirect
github.com/sasha-s/go-deadlock v0.3.1 // indirect
- github.com/spf13/afero v1.9.2 // indirect
+ github.com/spf13/afero v1.9.3 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
- github.com/spf13/viper v1.14.0 // indirect
- github.com/subosito/gotenv v1.4.1 // indirect
+ github.com/subosito/gotenv v1.4.2 // indirect
+ github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c // indirect
github.com/tendermint/go-amino v0.16.0 // indirect
- github.com/tidwall/btree v1.5.0 // indirect
+ github.com/tidwall/btree v1.6.0 // indirect
+ github.com/ulikunitz/xz v0.5.11 // indirect
github.com/zondax/hid v0.9.1 // indirect
github.com/zondax/ledger-go v0.14.1 // indirect
- go.etcd.io/bbolt v1.3.6 // indirect
- golang.org/x/crypto v0.5.0 // indirect
- golang.org/x/exp v0.0.0-20230131160201-f062dba9d201 // indirect
- golang.org/x/net v0.6.0 // indirect
- golang.org/x/sys v0.5.0 // indirect
- golang.org/x/term v0.5.0 // indirect
- golang.org/x/text v0.7.0 // indirect
- google.golang.org/protobuf v1.28.2-0.20220831092852-f930b1dc76e8 // indirect
+ go.etcd.io/bbolt v1.3.7 // indirect
+ go.opencensus.io v0.24.0 // indirect
+ golang.org/x/crypto v0.7.0 // indirect
+ golang.org/x/exp v0.0.0-20230310171629-522b1b587ee0 // indirect
+ golang.org/x/net v0.8.0 // indirect
+ golang.org/x/oauth2 v0.5.0 // indirect
+ golang.org/x/sys v0.6.0 // indirect
+ golang.org/x/term v0.6.0 // indirect
+ golang.org/x/text v0.8.0 // indirect
+ golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
+ google.golang.org/api v0.110.0 // indirect
+ google.golang.org/appengine v1.6.7 // indirect
+ google.golang.org/protobuf v1.29.1 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
nhooyr.io/websocket v1.8.6 // indirect
+ pgregory.net/rapid v0.5.5 // indirect
+ sigs.k8s.io/yaml v1.3.0 // indirect
)
replace (
+ github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0
+ // dgrijalva/jwt-go is deprecated and doesn't receive security updates.
+ // See: https://github.com/cosmos/cosmos-sdk/issues/13134
+ github.com/dgrijalva/jwt-go => github.com/golang-jwt/jwt/v4 v4.4.2
// Fix upstream GHSA-h395-qcrw-5vmq vulnerability.
- // TODO Remove it: https://github.com/cosmos/cosmos-sdk/issues/10409
- github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.7.0
-
- // latest grpc doesn't work with with our modified proto compiler, so we need to enforce
- // the following version across all dependencies.
- github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1
-
- // use informal system fork of tendermint
- // See https://twitter.com/informalinc/status/1613580954383040512
- github.com/tendermint/tendermint => github.com/informalsystems/tendermint v0.34.26
+ // See: https://github.com/cosmos/cosmos-sdk/issues/10409
+ github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.8.1
- google.golang.org/grpc => google.golang.org/grpc v1.33.2
+ // pin version! 126854af5e6d has issues with the store so that queries fail
+ github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7
)
diff --git a/go.sum b/go.sum
index e7f3303f53..8397307b0a 100644
--- a/go.sum
+++ b/go.sum
@@ -1,3 +1,4 @@
+cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU=
cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU=
@@ -16,181 +17,294 @@ cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHOb
cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI=
cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk=
cloud.google.com/go v0.75.0/go.mod h1:VGuuCn7PG0dwsd5XPVm2Mm3wlh3EL55/79EKB6hlPTY=
+cloud.google.com/go v0.78.0/go.mod h1:QjdrLG0uq+YwhjoVOLsS1t7TW8fs36kLs4XO5R5ECHg=
+cloud.google.com/go v0.79.0/go.mod h1:3bzgcEeQlzbuEAYu4mrWhKqWjmpprinYgKJLgKHnbb8=
+cloud.google.com/go v0.81.0/go.mod h1:mk/AM35KwGk/Nm2YSeZbxXdrNK3KZOYHmLkOqC2V6E0=
+cloud.google.com/go v0.83.0/go.mod h1:Z7MJUsANfY0pYPdw0lbnivPx4/vhy/e2FEkSkF7vAVY=
+cloud.google.com/go v0.84.0/go.mod h1:RazrYuxIK6Kb7YrzzhPoLmCVzl7Sup4NrbKPg8KHSUM=
+cloud.google.com/go v0.87.0/go.mod h1:TpDYlFy7vuLzZMMZ+B6iRiELaY7z/gJPaqbMx6mlWcY=
+cloud.google.com/go v0.90.0/go.mod h1:kRX0mNRHe0e2rC6oNakvwQqzyDmg57xJ+SZU1eT2aDQ=
+cloud.google.com/go v0.93.3/go.mod h1:8utlLll2EF5XMAV15woO4lSbWQlk8rer9aLOfLh7+YI=
+cloud.google.com/go v0.94.1/go.mod h1:qAlAugsXlC+JWO+Bke5vCtc9ONxjQT3drlTTnAplMW4=
+cloud.google.com/go v0.97.0/go.mod h1:GF7l59pYBVlXQIBLx3a761cZ41F9bBH3JUlihCt2Udc=
+cloud.google.com/go v0.99.0/go.mod h1:w0Xx2nLzqWJPuozYQX+hFfCSI8WioryfRDzkoI/Y2ZA=
+cloud.google.com/go v0.100.2/go.mod h1:4Xra9TjzAeYHrl5+oeLlzbM2k3mjVhZh4UqTZ//w99A=
+cloud.google.com/go v0.102.0/go.mod h1:oWcCzKlqJ5zgHQt9YsaeTY9KzIvjyy0ArmiBUgpQ+nc=
+cloud.google.com/go v0.102.1/go.mod h1:XZ77E9qnTEnrgEOvr4xzfdX5TRo7fB4T2F4O6+34hIU=
+cloud.google.com/go v0.104.0/go.mod h1:OO6xxXdJyvuJPcEPBLN9BJPD+jep5G1+2U5B5gkRYtA=
+cloud.google.com/go v0.110.0 h1:Zc8gqp3+a9/Eyph2KDmcGaPtbKRIoqq4YTlL4NMD0Ys=
+cloud.google.com/go v0.110.0/go.mod h1:SJnCLqQ0FCFGSZMUNUf84MV3Aia54kn7pi8st7tMzaY=
+cloud.google.com/go/aiplatform v1.22.0/go.mod h1:ig5Nct50bZlzV6NvKaTwmplLLddFx0YReh9WfTO5jKw=
+cloud.google.com/go/aiplatform v1.24.0/go.mod h1:67UUvRBKG6GTayHKV8DBv2RtR1t93YRu5B1P3x99mYY=
+cloud.google.com/go/analytics v0.11.0/go.mod h1:DjEWCu41bVbYcKyvlws9Er60YE4a//bK6mnhWvQeFNI=
+cloud.google.com/go/analytics v0.12.0/go.mod h1:gkfj9h6XRf9+TS4bmuhPEShsh3hH8PAZzm/41OOhQd4=
+cloud.google.com/go/area120 v0.5.0/go.mod h1:DE/n4mp+iqVyvxHN41Vf1CR602GiHQjFPusMFW6bGR4=
+cloud.google.com/go/area120 v0.6.0/go.mod h1:39yFJqWVgm0UZqWTOdqkLhjoC7uFfgXRC8g/ZegeAh0=
+cloud.google.com/go/artifactregistry v1.6.0/go.mod h1:IYt0oBPSAGYj/kprzsBjZ/4LnG/zOcHyFHjWPCi6SAQ=
+cloud.google.com/go/artifactregistry v1.7.0/go.mod h1:mqTOFOnGZx8EtSqK/ZWcsm/4U8B77rbcLP6ruDU2Ixk=
+cloud.google.com/go/asset v1.5.0/go.mod h1:5mfs8UvcM5wHhqtSv8J1CtxxaQq3AdBxxQi2jGW/K4o=
+cloud.google.com/go/asset v1.7.0/go.mod h1:YbENsRK4+xTiL+Ofoj5Ckf+O17kJtgp3Y3nn4uzZz5s=
+cloud.google.com/go/asset v1.8.0/go.mod h1:mUNGKhiqIdbr8X7KNayoYvyc4HbbFO9URsjbytpUaW0=
+cloud.google.com/go/assuredworkloads v1.5.0/go.mod h1:n8HOZ6pff6re5KYfBXcFvSViQjDwxFkAkmUFffJRbbY=
+cloud.google.com/go/assuredworkloads v1.6.0/go.mod h1:yo2YOk37Yc89Rsd5QMVECvjaMKymF9OP+QXWlKXUkXw=
+cloud.google.com/go/assuredworkloads v1.7.0/go.mod h1:z/736/oNmtGAyU47reJgGN+KVoYoxeLBoj4XkKYscNI=
+cloud.google.com/go/automl v1.5.0/go.mod h1:34EjfoFGMZ5sgJ9EoLsRtdPSNZLcfflJR39VbVNS2M0=
+cloud.google.com/go/automl v1.6.0/go.mod h1:ugf8a6Fx+zP0D59WLhqgTDsQI9w07o64uf/Is3Nh5p8=
cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o=
cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE=
cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc=
cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg=
cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc=
cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ=
+cloud.google.com/go/bigquery v1.42.0/go.mod h1:8dRTJxhtG+vwBKzE5OseQn/hiydoQN3EedCaOdYmxRA=
+cloud.google.com/go/billing v1.4.0/go.mod h1:g9IdKBEFlItS8bTtlrZdVLWSSdSyFUZKXNS02zKMOZY=
+cloud.google.com/go/billing v1.5.0/go.mod h1:mztb1tBc3QekhjSgmpf/CV4LzWXLzCArwpLmP2Gm88s=
+cloud.google.com/go/binaryauthorization v1.1.0/go.mod h1:xwnoWu3Y84jbuHa0zd526MJYmtnVXn0syOjaJgy4+dM=
+cloud.google.com/go/binaryauthorization v1.2.0/go.mod h1:86WKkJHtRcv5ViNABtYMhhNWRrD1Vpi//uKEy7aYEfI=
+cloud.google.com/go/cloudtasks v1.5.0/go.mod h1:fD92REy1x5woxkKEkLdvavGnPJGEn8Uic9nWuLzqCpY=
+cloud.google.com/go/cloudtasks v1.6.0/go.mod h1:C6Io+sxuke9/KNRkbQpihnW93SWDU3uXt92nu85HkYI=
+cloud.google.com/go/compute v0.1.0/go.mod h1:GAesmwr110a34z04OlxYkATPBEfVhkymfTBXtfbBFow=
+cloud.google.com/go/compute v1.3.0/go.mod h1:cCZiE1NHEtai4wiufUhW8I8S1JKkAnhnQJWM7YD99wM=
+cloud.google.com/go/compute v1.5.0/go.mod h1:9SMHyhJlzhlkJqrPAc839t2BZFTSk6Jdj6mkzQJeu0M=
+cloud.google.com/go/compute v1.6.0/go.mod h1:T29tfhtVbq1wvAPo0E3+7vhgmkOYeXjhFvz/FMzPu0s=
+cloud.google.com/go/compute v1.6.1/go.mod h1:g85FgpzFvNULZ+S8AYq87axRKuf2Kh7deLqV/jJ3thU=
+cloud.google.com/go/compute v1.7.0/go.mod h1:435lt8av5oL9P3fv1OEzSbSUe+ybHXGMPQHHZWZxy9U=
+cloud.google.com/go/compute v1.10.0/go.mod h1:ER5CLbMxl90o2jtNbGSbtfOpQKR0t15FOtRsugnLrlU=
+cloud.google.com/go/compute v1.18.0 h1:FEigFqoDbys2cvFkZ9Fjq4gnHBP55anJ0yQyau2f9oY=
+cloud.google.com/go/compute v1.18.0/go.mod h1:1X7yHxec2Ga+Ss6jPyjxRxpu2uu7PLgsOVXvgU0yacs=
+cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY=
+cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA=
+cloud.google.com/go/containeranalysis v0.5.1/go.mod h1:1D92jd8gRR/c0fGMlymRgxWD3Qw9C1ff6/T7mLgVL8I=
+cloud.google.com/go/containeranalysis v0.6.0/go.mod h1:HEJoiEIu+lEXM+k7+qLCci0h33lX3ZqoYFdmPcoO7s4=
+cloud.google.com/go/datacatalog v1.3.0/go.mod h1:g9svFY6tuR+j+hrTw3J2dNcmI0dzmSiyOzm8kpLq0a0=
+cloud.google.com/go/datacatalog v1.5.0/go.mod h1:M7GPLNQeLfWqeIm3iuiruhPzkt65+Bx8dAKvScX8jvs=
+cloud.google.com/go/datacatalog v1.6.0/go.mod h1:+aEyF8JKg+uXcIdAmmaMUmZ3q1b/lKLtXCmXdnc0lbc=
+cloud.google.com/go/dataflow v0.6.0/go.mod h1:9QwV89cGoxjjSR9/r7eFDqqjtvbKxAK2BaYU6PVk9UM=
+cloud.google.com/go/dataflow v0.7.0/go.mod h1:PX526vb4ijFMesO1o202EaUmouZKBpjHsTlCtB4parQ=
+cloud.google.com/go/dataform v0.3.0/go.mod h1:cj8uNliRlHpa6L3yVhDOBrUXH+BPAO1+KFMQQNSThKo=
+cloud.google.com/go/dataform v0.4.0/go.mod h1:fwV6Y4Ty2yIFL89huYlEkwUPtS7YZinZbzzj5S9FzCE=
+cloud.google.com/go/datalabeling v0.5.0/go.mod h1:TGcJ0G2NzcsXSE/97yWjIZO0bXj0KbVlINXMG9ud42I=
+cloud.google.com/go/datalabeling v0.6.0/go.mod h1:WqdISuk/+WIGeMkpw/1q7bK/tFEZxsrFJOJdY2bXvTQ=
+cloud.google.com/go/dataqna v0.5.0/go.mod h1:90Hyk596ft3zUQ8NkFfvICSIfHFh1Bc7C4cK3vbhkeo=
+cloud.google.com/go/dataqna v0.6.0/go.mod h1:1lqNpM7rqNLVgWBJyk5NF6Uen2PHym0jtVJonplVsDA=
cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE=
cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk=
+cloud.google.com/go/datastream v1.2.0/go.mod h1:i/uTP8/fZwgATHS/XFu0TcNUhuA0twZxxQ3EyCUQMwo=
+cloud.google.com/go/datastream v1.3.0/go.mod h1:cqlOX8xlyYF/uxhiKn6Hbv6WjwPPuI9W2M9SAXwaLLQ=
+cloud.google.com/go/dialogflow v1.15.0/go.mod h1:HbHDWs33WOGJgn6rfzBW1Kv807BE3O1+xGbn59zZWI4=
+cloud.google.com/go/dialogflow v1.16.1/go.mod h1:po6LlzGfK+smoSmTBnbkIZY2w8ffjz/RcGSS+sh1el0=
+cloud.google.com/go/dialogflow v1.17.0/go.mod h1:YNP09C/kXA1aZdBgC/VtXX74G/TKn7XVCcVumTflA+8=
+cloud.google.com/go/documentai v1.7.0/go.mod h1:lJvftZB5NRiFSX4moiye1SMxHx0Bc3x1+p9e/RfXYiU=
+cloud.google.com/go/documentai v1.8.0/go.mod h1:xGHNEB7CtsnySCNrCFdCyyMz44RhFEEX2Q7UD0c5IhU=
+cloud.google.com/go/domains v0.6.0/go.mod h1:T9Rz3GasrpYk6mEGHh4rymIhjlnIuB4ofT1wTxDeT4Y=
+cloud.google.com/go/domains v0.7.0/go.mod h1:PtZeqS1xjnXuRPKE/88Iru/LdfoRyEHYA9nFQf4UKpg=
+cloud.google.com/go/edgecontainer v0.1.0/go.mod h1:WgkZ9tp10bFxqO8BLPqv2LlfmQF1X8lZqwW4r1BTajk=
+cloud.google.com/go/edgecontainer v0.2.0/go.mod h1:RTmLijy+lGpQ7BXuTDa4C4ssxyXT34NIuHIgKuP4s5w=
+cloud.google.com/go/functions v1.6.0/go.mod h1:3H1UA3qiIPRWD7PeZKLvHZ9SaQhR26XIJcC0A5GbvAk=
+cloud.google.com/go/functions v1.7.0/go.mod h1:+d+QBcWM+RsrgZfV9xo6KfA1GlzJfxcfZcRPEhDDfzg=
+cloud.google.com/go/gaming v1.5.0/go.mod h1:ol7rGcxP/qHTRQE/RO4bxkXq+Fix0j6D4LFPzYTIrDM=
+cloud.google.com/go/gaming v1.6.0/go.mod h1:YMU1GEvA39Qt3zWGyAVA9bpYz/yAhTvaQ1t2sK4KPUA=
+cloud.google.com/go/gkeconnect v0.5.0/go.mod h1:c5lsNAg5EwAy7fkqX/+goqFsU1Da/jQFqArp+wGNr/o=
+cloud.google.com/go/gkeconnect v0.6.0/go.mod h1:Mln67KyU/sHJEBY8kFZ0xTeyPtzbq9StAVvEULYK16A=
+cloud.google.com/go/gkehub v0.9.0/go.mod h1:WYHN6WG8w9bXU0hqNxt8rm5uxnk8IH+lPY9J2TV7BK0=
+cloud.google.com/go/gkehub v0.10.0/go.mod h1:UIPwxI0DsrpsVoWpLB0stwKCP+WFVG9+y977wO+hBH0=
+cloud.google.com/go/grafeas v0.2.0/go.mod h1:KhxgtF2hb0P191HlY5besjYm6MqTSTj3LSI+M+ByZHc=
+cloud.google.com/go/iam v0.3.0/go.mod h1:XzJPvDayI+9zsASAFO68Hk07u3z+f+JrT2xXNdp4bnY=
+cloud.google.com/go/iam v0.5.0/go.mod h1:wPU9Vt0P4UmCux7mqtRu6jcpPAb74cP1fh50J3QpkUc=
+cloud.google.com/go/iam v0.12.0 h1:DRtTY29b75ciH6Ov1PHb4/iat2CLCvrOm40Q0a6DFpE=
+cloud.google.com/go/iam v0.12.0/go.mod h1:knyHGviacl11zrtZUoDuYpDgLjvr28sLQaG0YB2GYAY=
+cloud.google.com/go/language v1.4.0/go.mod h1:F9dRpNFQmJbkaop6g0JhSBXCNlO90e1KWx5iDdxbWic=
+cloud.google.com/go/language v1.6.0/go.mod h1:6dJ8t3B+lUYfStgls25GusK04NLh3eDLQnWM3mdEbhI=
+cloud.google.com/go/lifesciences v0.5.0/go.mod h1:3oIKy8ycWGPUyZDR/8RNnTOYevhaMLqh5vLUXs9zvT8=
+cloud.google.com/go/lifesciences v0.6.0/go.mod h1:ddj6tSX/7BOnhxCSd3ZcETvtNr8NZ6t/iPhY2Tyfu08=
+cloud.google.com/go/longrunning v0.3.0 h1:NjljC+FYPV3uh5/OwWT6pVU+doBqMg2x/rZlE+CamDs=
+cloud.google.com/go/mediatranslation v0.5.0/go.mod h1:jGPUhGTybqsPQn91pNXw0xVHfuJ3leR1wj37oU3y1f4=
+cloud.google.com/go/mediatranslation v0.6.0/go.mod h1:hHdBCTYNigsBxshbznuIMFNe5QXEowAuNmmC7h8pu5w=
+cloud.google.com/go/memcache v1.4.0/go.mod h1:rTOfiGZtJX1AaFUrOgsMHX5kAzaTQ8azHiuDoTPzNsE=
+cloud.google.com/go/memcache v1.5.0/go.mod h1:dk3fCK7dVo0cUU2c36jKb4VqKPS22BTkf81Xq617aWM=
+cloud.google.com/go/metastore v1.5.0/go.mod h1:2ZNrDcQwghfdtCwJ33nM0+GrBGlVuh8rakL3vdPY3XY=
+cloud.google.com/go/metastore v1.6.0/go.mod h1:6cyQTls8CWXzk45G55x57DVQ9gWg7RiH65+YgPsNh9s=
+cloud.google.com/go/networkconnectivity v1.4.0/go.mod h1:nOl7YL8odKyAOtzNX73/M5/mGZgqqMeryi6UPZTk/rA=
+cloud.google.com/go/networkconnectivity v1.5.0/go.mod h1:3GzqJx7uhtlM3kln0+x5wyFvuVH1pIBJjhCpjzSt75o=
+cloud.google.com/go/networksecurity v0.5.0/go.mod h1:xS6fOCoqpVC5zx15Z/MqkfDwH4+m/61A3ODiDV1xmiQ=
+cloud.google.com/go/networksecurity v0.6.0/go.mod h1:Q5fjhTr9WMI5mbpRYEbiexTzROf7ZbDzvzCrNl14nyU=
+cloud.google.com/go/notebooks v1.2.0/go.mod h1:9+wtppMfVPUeJ8fIWPOq1UnATHISkGXGqTkxeieQ6UY=
+cloud.google.com/go/notebooks v1.3.0/go.mod h1:bFR5lj07DtCPC7YAAJ//vHskFBxA5JzYlH68kXVdk34=
+cloud.google.com/go/osconfig v1.7.0/go.mod h1:oVHeCeZELfJP7XLxcBGTMBvRO+1nQ5tFG9VQTmYS2Fs=
+cloud.google.com/go/osconfig v1.8.0/go.mod h1:EQqZLu5w5XA7eKizepumcvWx+m8mJUhEwiPqWiZeEdg=
+cloud.google.com/go/oslogin v1.4.0/go.mod h1:YdgMXWRaElXz/lDk1Na6Fh5orF7gvmJ0FGLIs9LId4E=
+cloud.google.com/go/oslogin v1.5.0/go.mod h1:D260Qj11W2qx/HVF29zBg+0fd6YCSjSqLUkY/qEenQU=
+cloud.google.com/go/phishingprotection v0.5.0/go.mod h1:Y3HZknsK9bc9dMi+oE8Bim0lczMU6hrX0UpADuMefr0=
+cloud.google.com/go/phishingprotection v0.6.0/go.mod h1:9Y3LBLgy0kDTcYET8ZH3bq/7qni15yVUoAxiFxnlSUA=
+cloud.google.com/go/privatecatalog v0.5.0/go.mod h1:XgosMUvvPyxDjAVNDYxJ7wBW8//hLDDYmnsNcMGq1K0=
+cloud.google.com/go/privatecatalog v0.6.0/go.mod h1:i/fbkZR0hLN29eEWiiwue8Pb+GforiEIBnV9yrRUOKI=
cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I=
cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw=
cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA=
cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU=
+cloud.google.com/go/recaptchaenterprise v1.3.1/go.mod h1:OdD+q+y4XGeAlxRaMn1Y7/GveP6zmq76byL6tjPE7d4=
+cloud.google.com/go/recaptchaenterprise/v2 v2.1.0/go.mod h1:w9yVqajwroDNTfGuhmOjPDN//rZGySaf6PtFVcSCa7o=
+cloud.google.com/go/recaptchaenterprise/v2 v2.2.0/go.mod h1:/Zu5jisWGeERrd5HnlS3EUGb/D335f9k51B/FVil0jk=
+cloud.google.com/go/recaptchaenterprise/v2 v2.3.0/go.mod h1:O9LwGCjrhGHBQET5CA7dd5NwwNQUErSgEDit1DLNTdo=
+cloud.google.com/go/recommendationengine v0.5.0/go.mod h1:E5756pJcVFeVgaQv3WNpImkFP8a+RptV6dDLGPILjvg=
+cloud.google.com/go/recommendationengine v0.6.0/go.mod h1:08mq2umu9oIqc7tDy8sx+MNJdLG0fUi3vaSVbztHgJ4=
+cloud.google.com/go/recommender v1.5.0/go.mod h1:jdoeiBIVrJe9gQjwd759ecLJbxCDED4A6p+mqoqDvTg=
+cloud.google.com/go/recommender v1.6.0/go.mod h1:+yETpm25mcoiECKh9DEScGzIRyDKpZ0cEhWGo+8bo+c=
+cloud.google.com/go/redis v1.7.0/go.mod h1:V3x5Jq1jzUcg+UNsRvdmsfuFnit1cfe3Z/PGyq/lm4Y=
+cloud.google.com/go/redis v1.8.0/go.mod h1:Fm2szCDavWzBk2cDKxrkmWBqoCiL1+Ctwq7EyqBCA/A=
+cloud.google.com/go/retail v1.8.0/go.mod h1:QblKS8waDmNUhghY2TI9O3JLlFk8jybHeV4BF19FrE4=
+cloud.google.com/go/retail v1.9.0/go.mod h1:g6jb6mKuCS1QKnH/dpu7isX253absFl6iE92nHwlBUY=
+cloud.google.com/go/scheduler v1.4.0/go.mod h1:drcJBmxF3aqZJRhmkHQ9b3uSSpQoltBPGPxGAWROx6s=
+cloud.google.com/go/scheduler v1.5.0/go.mod h1:ri073ym49NW3AfT6DZi21vLZrG07GXr5p3H1KxN5QlI=
+cloud.google.com/go/secretmanager v1.6.0/go.mod h1:awVa/OXF6IiyaU1wQ34inzQNc4ISIDIrId8qE5QGgKA=
+cloud.google.com/go/security v1.5.0/go.mod h1:lgxGdyOKKjHL4YG3/YwIL2zLqMFCKs0UbQwgyZmfJl4=
+cloud.google.com/go/security v1.7.0/go.mod h1:mZklORHl6Bg7CNnnjLH//0UlAlaXqiG7Lb9PsPXLfD0=
+cloud.google.com/go/security v1.8.0/go.mod h1:hAQOwgmaHhztFhiQ41CjDODdWP0+AE1B3sX4OFlq+GU=
+cloud.google.com/go/securitycenter v1.13.0/go.mod h1:cv5qNAqjY84FCN6Y9z28WlkKXyWsgLO832YiWwkCWcU=
+cloud.google.com/go/securitycenter v1.14.0/go.mod h1:gZLAhtyKv85n52XYWt6RmeBdydyxfPeTrpToDPw4Auc=
+cloud.google.com/go/servicedirectory v1.4.0/go.mod h1:gH1MUaZCgtP7qQiI+F+A+OpeKF/HQWgtAddhTbhL2bs=
+cloud.google.com/go/servicedirectory v1.5.0/go.mod h1:QMKFL0NUySbpZJ1UZs3oFAmdvVxhhxB6eJ/Vlp73dfg=
+cloud.google.com/go/speech v1.6.0/go.mod h1:79tcr4FHCimOp56lwC01xnt/WPJZc4v3gzyT7FoBkCM=
+cloud.google.com/go/speech v1.7.0/go.mod h1:KptqL+BAQIhMsj1kOP2la5DSEEerPDuOP/2mmkhHhZQ=
cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw=
cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos=
cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk=
cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs=
cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo=
-cosmossdk.io/api v0.2.6 h1:AoNwaLLapcLsphhMK6+o0kZl+D6MMUaHVqSdwinASGU=
-cosmossdk.io/api v0.2.6/go.mod h1:u/d+GAxil0nWpl1XnQL8nkziQDIWuBDhv8VnDm/s6dI=
+cloud.google.com/go/storage v1.22.1/go.mod h1:S8N1cAStu7BOeFfE8KAQzmyyLkK8p/vmRq6kuBTW58Y=
+cloud.google.com/go/storage v1.23.0/go.mod h1:vOEEDNFnciUMhBeT6hsJIn3ieU5cFRmzeLgDvXzfIXc=
+cloud.google.com/go/storage v1.27.0/go.mod h1:x9DOL8TK/ygDUMieqwfhdpQryTeEkhGKMi80i/iqR2s=
+cloud.google.com/go/storage v1.29.0 h1:6weCgzRvMg7lzuUurI4697AqIRPU1SvzHhynwpW31jI=
+cloud.google.com/go/storage v1.29.0/go.mod h1:4puEjyTKnku6gfKoTfNOU/W+a9JyuVNxjpS5GBrB8h4=
+cloud.google.com/go/talent v1.1.0/go.mod h1:Vl4pt9jiHKvOgF9KoZo6Kob9oV4lwd/ZD5Cto54zDRw=
+cloud.google.com/go/talent v1.2.0/go.mod h1:MoNF9bhFQbiJ6eFD3uSsg0uBALw4n4gaCaEjBw9zo8g=
+cloud.google.com/go/videointelligence v1.6.0/go.mod h1:w0DIDlVRKtwPCn/C4iwZIJdvC69yInhW0cfi+p546uU=
+cloud.google.com/go/videointelligence v1.7.0/go.mod h1:k8pI/1wAhjznARtVT9U1llUaFNPh7muw8QyOUpavru4=
+cloud.google.com/go/vision v1.2.0/go.mod h1:SmNwgObm5DpFBme2xpyOyasvBc1aPdjvMk2bBk0tKD0=
+cloud.google.com/go/vision/v2 v2.2.0/go.mod h1:uCdV4PpN1S0jyCyq8sIM42v2Y6zOLkZs+4R9LrGYwFo=
+cloud.google.com/go/vision/v2 v2.3.0/go.mod h1:UO61abBx9QRMFkNBbf1D8B1LXdS2cGiiCRx0vSpZoUo=
+cloud.google.com/go/webrisk v1.4.0/go.mod h1:Hn8X6Zr+ziE2aNd8SliSDWpEnSS1u4R9+xXZmFiHmGE=
+cloud.google.com/go/webrisk v1.5.0/go.mod h1:iPG6fr52Tv7sGk0H6qUFzmL3HHZev1htXuWDEEsqMTg=
+cloud.google.com/go/workflows v1.6.0/go.mod h1:6t9F5h/unJz41YqfBmqSASJSXccBLtD1Vwf+KmJENM0=
+cloud.google.com/go/workflows v1.7.0/go.mod h1:JhSrZuVZWuiDfKEFxU0/F1PQjmpnpcoISEXH2bcHC3M=
+cosmossdk.io/api v0.3.1 h1:NNiOclKRR0AOlO4KIqeaG6PS6kswOMhHD0ir0SscNXE=
+cosmossdk.io/api v0.3.1/go.mod h1:DfHfMkiNA2Uhy8fj0JJlOCYOBp4eWUUJ1te5zBGNyIw=
cosmossdk.io/core v0.5.1 h1:vQVtFrIYOQJDV3f7rw4pjjVqc1id4+mE0L9hHP66pyI=
cosmossdk.io/core v0.5.1/go.mod h1:KZtwHCLjcFuo0nmDc24Xy6CRNEL9Vl/MeimQ2aC7NLE=
cosmossdk.io/depinject v1.0.0-alpha.3 h1:6evFIgj//Y3w09bqOUOzEpFj5tsxBqdc5CfkO7z+zfw=
cosmossdk.io/depinject v1.0.0-alpha.3/go.mod h1:eRbcdQ7MRpIPEM5YUJh8k97nxHpYbc3sMUnEtt8HPWU=
+cosmossdk.io/errors v1.0.0-beta.7 h1:gypHW76pTQGVnHKo6QBkb4yFOJjC+sUGRc5Al3Odj1w=
+cosmossdk.io/errors v1.0.0-beta.7/go.mod h1:mz6FQMJRku4bY7aqS/Gwfcmr/ue91roMEKAmDUDpBfE=
+cosmossdk.io/math v1.0.0-rc.0 h1:ml46ukocrAAoBpYKMidF0R2tQJ1Uxfns0yH8wqgMAFc=
+cosmossdk.io/math v1.0.0-rc.0/go.mod h1:Ygz4wBHrgc7g0N+8+MrnTfS9LLn9aaTGa9hKopuym5k=
+cosmossdk.io/tools/rosetta v0.2.1 h1:ddOMatOH+pbxWbrGJKRAawdBkPYLfKXutK9IETnjYxw=
+cosmossdk.io/tools/rosetta v0.2.1/go.mod h1:Pqdc1FdvkNV3LcNIkYWt2RQY6IP1ge6YWZk8MhhO9Hw=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
-filippo.io/edwards25519 v1.0.0-beta.2 h1:/BZRNzm8N4K4eWfK28dL4yescorxtO7YG1yun8fy+pI=
-filippo.io/edwards25519 v1.0.0-beta.2/go.mod h1:X+pm78QAUPtFLi1z9PYIlS/bdDnvbCOGKtZ+ACWEf7o=
+filippo.io/edwards25519 v1.0.0 h1:0wAIcmJUqRdI8IJ/3eGi5/HwXZWPujYXXlkrQogz0Ek=
+filippo.io/edwards25519 v1.0.0/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns=
github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 h1:/vQbFIOMbk2FiG/kXiLl8BRyzTWDw7gX/Hz7Dd5eDMs=
github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4/go.mod h1:hN7oaIRCjzsZ2dE+yG5k+rsdt3qcwykqK6HVGcKwsw4=
-github.com/99designs/keyring v1.2.1 h1:tYLp1ULvO7i3fI5vE21ReQuj99QFSs7lGm0xWyJo87o=
-github.com/99designs/keyring v1.2.1/go.mod h1:fc+wB5KTk9wQ9sDx0kFXB3A0MaeGHM9AwRStKOQ5vOA=
-github.com/AndreasBriese/bbloom v0.0.0-20190306092124-e2d15f34fcf9/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8=
-github.com/Azure/azure-pipeline-go v0.2.1/go.mod h1:UGSo8XybXnIGZ3epmeBw7Jdz+HiUVpqIlpz/HKHylF4=
-github.com/Azure/azure-pipeline-go v0.2.2/go.mod h1:4rQ/NZncSvGqNkkOsNpOU1tgoNuIlp9AfUH5G1tvCHc=
-github.com/Azure/azure-storage-blob-go v0.7.0/go.mod h1:f9YQKtsG1nMisotuTPpO0tjNuEjKRYAcJU8/ydDI++4=
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 h1:UQHMgLO+TxOElx5B5HZ4hJQsoJ/PvUvKRhJHDQXO8P8=
-github.com/Azure/go-autorest/autorest v0.9.0/go.mod h1:xyHB1BMZT0cuDHU7I0+g046+BFDTQ8rEZB0s4Yfa6bI=
-github.com/Azure/go-autorest/autorest/adal v0.5.0/go.mod h1:8Z9fGy2MpX0PvDjB1pEgQTmVqjGhiHBW7RJJEciWzS0=
-github.com/Azure/go-autorest/autorest/adal v0.8.0/go.mod h1:Z6vX6WXXuyieHAXwMj0S6HY6e6wcHn37qQMBQlvY3lc=
-github.com/Azure/go-autorest/autorest/date v0.1.0/go.mod h1:plvfp3oPSKwf2DNjlBjWF/7vwR+cUD/ELuzDCXwHUVA=
-github.com/Azure/go-autorest/autorest/date v0.2.0/go.mod h1:vcORJHLJEh643/Ioh9+vPmf1Ij9AEBM5FuBIXLmIy0g=
-github.com/Azure/go-autorest/autorest/mocks v0.1.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0=
-github.com/Azure/go-autorest/autorest/mocks v0.2.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0=
-github.com/Azure/go-autorest/autorest/mocks v0.3.0/go.mod h1:a8FDP3DYzQ4RYfVAxAN3SVSiiO77gL2j2ronKKP0syM=
-github.com/Azure/go-autorest/logger v0.1.0/go.mod h1:oExouG+K6PryycPJfVSxi/koC6LSNgds39diKLz7Vrc=
-github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbtp2fGCgRFtBroKn4Dk=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d h1:nalkkPQcITbvhmL4+C4cKA87NW0tfm3Kl9VXRoPywFg=
github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d/go.mod h1:URdX5+vg25ts3aCh8H5IFZybJYKWhJHYMTnf+ULtoC4=
-github.com/CloudyKit/fastprinter v0.0.0-20170127035650-74b38d55f37a/go.mod h1:EFZQ978U7x8IRnstaskI3IysnWY5Ao3QgZUKOXlsAdw=
-github.com/CloudyKit/fastprinter v0.0.0-20200109182630-33d98a066a53/go.mod h1:+3IMCy2vIlbG1XG/0ggNQv0SvxCAIpPM5b1nCz56Xno=
-github.com/CloudyKit/jet v2.1.3-0.20180809161101-62edd43e4f88+incompatible/go.mod h1:HPYO+50pSWkPoj9Q/eq0aRGByCL6ScRlUmiEX5Zgm+w=
-github.com/CloudyKit/jet/v3 v3.0.0/go.mod h1:HKQPgSJmdK8hdoAbKUUWajkHyHo4RaU5rMdUywE7VMo=
github.com/CosmWasm/wasmvm v1.2.1 h1:si0tRsRDdUShV0k51Wn6zRKlmj3/WWP9Yr4cLmDTf+8=
github.com/CosmWasm/wasmvm v1.2.1/go.mod h1:vW/E3h8j9xBQs9bCoijDuawKo9kCtxOaS8N8J7KFtkc=
github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=
-github.com/DataDog/zstd v1.4.1/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo=
-github.com/DataDog/zstd v1.4.5 h1:EndNeuB0l9syBZhut0wns3gV1hL8zX8LIu6ZiVHWLIQ=
-github.com/DataDog/zstd v1.4.5/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo=
-github.com/HdrHistogram/hdrhistogram-go v1.1.2 h1:5IcZpTvzydCQeHzK4Ef/D5rrSqwxob0t8PQPMybUNFM=
-github.com/HdrHistogram/hdrhistogram-go v1.1.2/go.mod h1:yDgFjdqOqDEKOvasDdhWNXYg9BVp4O+o5f6V/ehm6Oo=
-github.com/Joker/hpp v1.0.0/go.mod h1:8x5n+M1Hp5hC0g8okX3sR3vFQwynaX/UgSOM9MeBKzY=
-github.com/Joker/jade v1.0.1-0.20190614124447-d475f43051e7/go.mod h1:6E6s8o2AE4KhCrqr6GRJjdC/gNfTdxkIXvuGZZda2VM=
github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0=
github.com/Microsoft/go-winio v0.6.0 h1:slsWYD/zyx7lCXoZVlvQrj0hPTM1HI4+v1sIda2yDvg=
github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 h1:TngWCqHvy9oXAN6lEVMRuU21PR1EtLVZJmdB18Gu3Rw=
github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE=
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
-github.com/Shopify/goreferrer v0.0.0-20181106222321-ec9c9a553398/go.mod h1:a1uqRtAwp2Xwc6WNPJEufxJ7fx3npB4UV/JOLmbu5I0=
github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo=
github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI=
-github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg=
-github.com/VictoriaMetrics/fastcache v1.5.7/go.mod h1:ptDBkNMQI4RtmVo8VS/XwRY6RoTu1dAWCbrk+6WsEM8=
github.com/VividCortex/gohistogram v1.0.0 h1:6+hBz+qvs0JOrrNhhmR7lFxo5sINxBCGXrdtl/UvroE=
github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g=
-github.com/Workiva/go-datastructures v1.0.53 h1:J6Y/52yX10Xc5JjXmGtWoSSxs3mZnGSaq37xZZh7Yig=
-github.com/Workiva/go-datastructures v1.0.53/go.mod h1:1yZL+zfsztete+ePzZz/Zb1/t5BnDuE2Ya2MMGhzP6A=
-github.com/Zilliqa/gozilliqa-sdk v1.2.1-0.20201201074141-dd0ecada1be6/go.mod h1:eSYp2T6f0apnuW8TzhV3f6Aff2SE8Dwio++U4ha4yEM=
github.com/adlio/schema v1.3.3 h1:oBJn8I02PyTB466pZO1UZEn1TV5XLlifBSyMrmHl/1I=
-github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII=
github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c=
-github.com/ajg/form v1.5.1/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY=
-github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw=
github.com/alecthomas/participle/v2 v2.0.0-alpha7 h1:cK4vjj0VSgb3lN1nuKA5F7dw+1s1pWBe5bx7nNCnN+c=
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho=
-github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM=
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ=
github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ=
-github.com/aristanetworks/goarista v0.0.0-20170210015632-ea17b1a17847/go.mod h1:D/tb0zPVXnP7fmsLZjtdUhSsumbK/ij54UXjjVgMGxQ=
github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY=
-github.com/armon/go-metrics v0.4.0 h1:yCQqn7dwca4ITXb+CbubHmedzaQYHhNhrEXLYUeEe8Q=
-github.com/armon/go-metrics v0.4.0/go.mod h1:E6amYzXo6aW1tqzoZGT755KkbgrJsSdpwZ+3JqfkOG4=
+github.com/armon/go-metrics v0.4.1 h1:hR91U9KYmb6bLBYLQjyM+3j+rcd/UhE+G78SFnF8gJA=
+github.com/armon/go-metrics v0.4.1/go.mod h1:E6amYzXo6aW1tqzoZGT755KkbgrJsSdpwZ+3JqfkOG4=
github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6lCRdSC2Tm3DSWRPvIPr6xNKyeHdqDQSQT+A=
github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU=
-github.com/aws/aws-sdk-go v1.25.48/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo=
github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo=
+github.com/aws/aws-sdk-go v1.44.122/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX4oIKwKHZo=
+github.com/aws/aws-sdk-go v1.44.203 h1:pcsP805b9acL3wUqa4JR2vg1k2wnItkDYNvfmcy6F+U=
+github.com/aws/aws-sdk-go v1.44.203/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI=
github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g=
-github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
+github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d h1:xDfNPAt8lFiC1UJrqV3uuy861HCTo708pDMbjHHdCas=
+github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d/go.mod h1:6QX/PXZ00z/TKoufEY6K/a0k6AhaJrQKdFe6OfVXsa4=
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 h1:41iFGWnSlI2gVpmOtVTJZNodLdLQLn/KsJqFvXwnd/s=
github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
-github.com/btcsuite/btcd v0.0.0-20171128150713-2e60448ffcc6/go.mod h1:Dmm/EzmjnCiweXmzRIAiUWCInVmPgjkzgv5k4tVyXiQ=
-github.com/btcsuite/btcd v0.0.0-20190315201642-aa6e0f35703c/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8=
-github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ=
-github.com/btcsuite/btcd v0.21.0-beta/go.mod h1:ZSWyehm27aAuS9bvkATT+Xte3hjHZ+MRgMY/8NJ7K94=
-github.com/btcsuite/btcd v0.22.2 h1:vBZ+lGGd1XubpOWO67ITJpAEsICWhA0YzqkcpkgNBfo=
-github.com/btcsuite/btcd v0.22.2/go.mod h1:wqgTSL29+50LRkmOVknEdmt8ZojIzhuWvgu/iptuN7Y=
github.com/btcsuite/btcd/btcec/v2 v2.3.2 h1:5n0X6hX0Zk+6omWcihdYvdAlGf2DfasC0GMf7DClJ3U=
github.com/btcsuite/btcd/btcec/v2 v2.3.2/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04=
github.com/btcsuite/btcd/btcutil v1.1.2 h1:XLMbX8JQEiwMcYft2EGi8zPUkoa0abKIU6/BJSRsjzQ=
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U=
-github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA=
-github.com/btcsuite/btcutil v0.0.0-20190207003914-4c204d697803/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg=
-github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg=
-github.com/btcsuite/btcutil v1.0.2/go.mod h1:j9HUFwoQRsZL3V4n+qG+CUnEGHOarIxfC3Le2Yhbcts=
-github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg=
-github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY=
-github.com/btcsuite/goleveldb v1.0.0/go.mod h1:QiK9vBlgftBg6rWQIj6wFzbPfRjiykIEhBH4obrXJ/I=
-github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc=
-github.com/btcsuite/snappy-go v1.0.0/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc=
-github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY=
-github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs=
github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ=
github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4=
github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM=
+github.com/cenkalti/backoff/v4 v4.1.1/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw=
+github.com/cenkalti/backoff/v4 v4.1.3 h1:cFAlzYUlVYDysBEH2T5hyJZMh3+5+WCBvSnK6Q8UtC4=
+github.com/cenkalti/backoff/v4 v4.1.3/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
-github.com/cespare/cp v0.1.0/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s=
github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko=
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
-github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE=
-github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
+github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44=
+github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
+github.com/cheggaaa/pb v1.0.27/go.mod h1:pQciLPpbU0oxA0h+VJYYLxO+XeDQb5pZijXscXHm81s=
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
+github.com/chzyer/logex v1.2.1 h1:XHDu3E6q+gdHgsdTPH6ImJMIp436vR6MPtH8gP05QzM=
+github.com/chzyer/logex v1.2.1/go.mod h1:JLbx6lG2kDbNRFnfkgvh4eRJRPX1QCoOIWomwysCBrQ=
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
+github.com/chzyer/readline v1.5.1 h1:upd/6fQk4src78LMRzh5vItIt361/o4uq553V8B5sGI=
+github.com/chzyer/readline v1.5.1/go.mod h1:Eh+b79XXUwfKfcPLepksvw2tcLE/Ct21YObkaSkeBlk=
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
+github.com/chzyer/test v1.0.0 h1:p3BQDXSxOhOG0P9z6/hGnII4LGiEPOYBhs8asl/fC04=
+github.com/chzyer/test v1.0.0/go.mod h1:2JlltgoNkt4TW/z9V/IzDdFaMTM2JPIi26O1pF38GC8=
github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag=
github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I=
github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE=
-github.com/cloudflare/cloudflare-go v0.10.2-0.20190916151808-a80f83b9add9/go.mod h1:1MxXX1Ux4x6mqPmjkUgTP1CdXIBXKX7T+Jk9Gxrmx+U=
+github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
+github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
+github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
+github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI=
+github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
+github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
+github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
+github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
+github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
+github.com/cockroachdb/apd/v2 v2.0.2 h1:weh8u7Cneje73dDh+2tEVLUvyBc89iwepWCD8b8034E=
+github.com/cockroachdb/apd/v2 v2.0.2/go.mod h1:DDxRlzC2lo3/vSlmSoS7JkqbbrARPuFOGr0B9pvN3Gw=
github.com/cockroachdb/apd/v3 v3.1.0 h1:MK3Ow7LH0W8zkd5GMKA1PvS9qG3bWFI95WaVNfyZJ/w=
github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8=
-github.com/cockroachdb/datadriven v1.0.0/go.mod h1:5Ib8Meh+jk1RlHIXej6Pzevx/NLlNvQB9pmSBZErGA4=
-github.com/cockroachdb/datadriven v1.0.2/go.mod h1:a9RdTaap04u637JoCzcUoIcDmvwSUtcUFtT/C3kJlTU=
-github.com/cockroachdb/errors v1.6.1/go.mod h1:tm6FTP5G81vwJ5lC0SizQo374JNCOPrHyXGitRJoDqM=
-github.com/cockroachdb/errors v1.8.1/go.mod h1:qGwQn6JmZ+oMjuLwjWzUNqblqk0xl4CVV3SQbGwK7Ac=
-github.com/cockroachdb/errors v1.9.1 h1:yFVvsI0VxmRShfawbt/laCIDy/mtTqqnvoNgiy5bEV8=
-github.com/cockroachdb/errors v1.9.1/go.mod h1:2sxOtL2WIc096WSZqZ5h8fa17rdDq9HZOZLBCor4mBk=
-github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f/go.mod h1:i/u985jwjWRlyHXQbwatDASoW0RMlZ/3i9yJHE2xLkI=
-github.com/cockroachdb/logtags v0.0.0-20211118104740-dabe8e521a4f/go.mod h1:Vz9DsVWQQhf3vs21MhPMZpMGSht7O/2vFW2xusFUVOs=
-github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b h1:r6VH0faHjZeQy818SGhaone5OnYfxFR/+AzdY3sf5aE=
-github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b/go.mod h1:Vz9DsVWQQhf3vs21MhPMZpMGSht7O/2vFW2xusFUVOs=
-github.com/cockroachdb/pebble v0.0.0-20220817183557-09c6e030a677 h1:qbb/AE938DFhOajUYh9+OXELpSF9KZw2ZivtmW6eX1Q=
-github.com/cockroachdb/pebble v0.0.0-20220817183557-09c6e030a677/go.mod h1:890yq1fUb9b6dGNwssgeUO5vQV9qfXnCPxAJhBQfXw0=
-github.com/cockroachdb/redact v1.0.8/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg=
-github.com/cockroachdb/redact v1.1.3 h1:AKZds10rFSIj7qADf0g46UixK8NNLwWTNdCIGS5wfSQ=
-github.com/cockroachdb/redact v1.1.3/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg=
-github.com/cockroachdb/sentry-go v0.6.1-cockroachdb.2/go.mod h1:8BT+cPK6xvFOcRlk0R8eg+OTkcqI6baNH4xAkpiYVvQ=
github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI=
-github.com/codegangsta/inject v0.0.0-20150114235600-33e0aa1cb7c0/go.mod h1:4Zcjuz89kmFXt9morQgcfYZAYZ5n8WHjt81YYWIwtTM=
-github.com/coinbase/rosetta-sdk-go v0.7.0 h1:lmTO/JEpCvZgpbkOITL95rA80CPKb5CtMzLaqF2mCNg=
-github.com/coinbase/rosetta-sdk-go v0.7.0/go.mod h1:7nD3oBPIiHqhRprqvMgPoGxe/nyq3yftRmpsy29coWE=
+github.com/coinbase/rosetta-sdk-go/types v1.0.0 h1:jpVIwLcPoOeCR6o1tU+Xv7r5bMONNbHU7MuEHboiFuA=
+github.com/coinbase/rosetta-sdk-go/types v1.0.0/go.mod h1:eq7W2TMRH22GTW0N0beDnN931DW0/WOI1R2sdHNHG4c=
+github.com/cometbft/cometbft v0.37.0 h1:M005vBaSaugvYYmNZwJOopynQSjwLoDTwflnQ/I/eYk=
+github.com/cometbft/cometbft v0.37.0/go.mod h1:Y2MMMN//O5K4YKd8ze4r9jmk4Y7h0ajqILXbH5JQFVs=
+github.com/cometbft/cometbft-db v0.7.0 h1:uBjbrBx4QzU0zOEnU8KxoDl18dMNgDh+zZRUE0ucsbo=
+github.com/cometbft/cometbft-db v0.7.0/go.mod h1:yiKJIm2WKrt6x8Cyxtq9YTEcIMPcEe4XPxhgX59Fzf0=
github.com/confio/ics23/go v0.9.0 h1:cWs+wdbS2KRPZezoaaj+qBleXgUk5WOQFMP3CQFGTr4=
github.com/confio/ics23/go v0.9.0/go.mod h1:4LPZ2NYqnYIVRklaozjNR1FScgDJ2s5Xrp+e/mYVRak=
github.com/containerd/continuity v0.3.0 h1:nisirsYROK15TAMVukJOUyGJjz4BNQJBVsNvAXZJ/eg=
@@ -198,103 +312,92 @@ github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc
github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk=
github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
-github.com/coreos/go-systemd/v22 v22.3.3-0.20220203105225-a9a7ef127534/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
-github.com/cosmos/btcutil v1.0.4 h1:n7C2ngKXo7UC9gNyMNLbzqz7Asuf+7Qv4gnX/rOdQ44=
-github.com/cosmos/btcutil v1.0.4/go.mod h1:Ffqc8Hn6TJUdDgHBwIZLtrLQC1KdJ9jGJl/TvgUaxbU=
-github.com/cosmos/cosmos-db v0.0.0-20221226095112-f3c38ecb5e32 h1:zlCp9n3uwQieELltZWHRmwPmPaZ8+XoL2Sj+A2YJlr8=
-github.com/cosmos/cosmos-db v0.0.0-20221226095112-f3c38ecb5e32/go.mod h1:kwMlEC4wWvB48zAShGKVqboJL6w4zCLesaNQ3YLU2BQ=
+github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk=
+github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis=
github.com/cosmos/cosmos-proto v1.0.0-beta.2 h1:X3OKvWgK9Gsejo0F1qs5l8Qn6xJV/AzgIWR2wZ8Nua8=
github.com/cosmos/cosmos-proto v1.0.0-beta.2/go.mod h1:+XRCLJ14pr5HFEHIUcn51IKXD1Fy3rkEQqt4WqmN4V0=
-github.com/cosmos/cosmos-sdk v0.45.14 h1:l6yid1Lft5dd8ymKO36qJf1phsE0shJLNkZQYTwjxOg=
-github.com/cosmos/cosmos-sdk v0.45.14/go.mod h1:bF1fyVbRDvZ922GMByg9opQT26sQwabwYqaYIchwdyw=
+github.com/cosmos/cosmos-sdk v0.47.0 h1:GKYtBpvjwuDEVix1vdnQpq7PuEOnItuEK0vdAL2cZ5g=
+github.com/cosmos/cosmos-sdk v0.47.0/go.mod h1:FTtZbqiHCZ2vun9WrPq6qLQafNKkAuIhLAxzLjr2TiI=
github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y=
github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY=
github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw=
+github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiKxTE=
+github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ4GUkT+tbFI=
+github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU=
github.com/cosmos/gogoproto v1.4.6 h1:Ee7z15dWJaGlgM2rWrK8N2IX7PQcuccu8oG68jp5RL4=
github.com/cosmos/gogoproto v1.4.6/go.mod h1:VS/ASYmPgv6zkPKLjR9EB91lwbLHOzaGCirmKKhncfI=
-github.com/cosmos/gorocksdb v1.2.0 h1:d0l3jJG8M4hBouIZq0mDUHZ+zjOx044J3nGRskwTb4Y=
-github.com/cosmos/gorocksdb v1.2.0/go.mod h1:aaKvKItm514hKfNJpUJXnnOWeBnk2GL4+Qw9NHizILw=
-github.com/cosmos/iavl v0.19.5 h1:rGA3hOrgNxgRM5wYcSCxgQBap7fW82WZgY78V9po/iY=
-github.com/cosmos/iavl v0.19.5/go.mod h1:X9PKD3J0iFxdmgNLa7b2LYWdsGd90ToV5cAONApkEPw=
-github.com/cosmos/ibc-go/v4 v4.3.0 h1:yOzVsyZzsv4XPBux8gq+D0LhZn45yGWKjvT+6Vyo5no=
-github.com/cosmos/ibc-go/v4 v4.3.0/go.mod h1:CcLvIoi9NNtIbNsxs4KjBGjYhlwqtsmXy1AKARKiMzQ=
-github.com/cosmos/interchain-accounts v0.2.6 h1:TV2M2g1/Rb9MCNw1YePdBKE0rcEczNj1RGHT+2iRYas=
-github.com/cosmos/interchain-accounts v0.2.6/go.mod h1:lUzWNzCiCtIEYZefac5+YgEBz2aR39nMS374jIv1c7o=
-github.com/cosmos/ledger-cosmos-go v0.12.2 h1:/XYaBlE2BJxtvpkHiBm97gFGSGmYGKunKyF3nNqAXZA=
-github.com/cosmos/ledger-cosmos-go v0.12.2/go.mod h1:ZcqYgnfNJ6lAXe4HPtWgarNEY+B74i+2/8MhZw4ziiI=
+github.com/cosmos/iavl v0.20.0 h1:fTVznVlepH0KK8NyKq8w+U7c2L6jofa27aFX6YGlm38=
+github.com/cosmos/iavl v0.20.0/go.mod h1:WO7FyvaZJoH65+HFOsDir7xU9FWk2w9cHXNW1XHcl7A=
+github.com/cosmos/ibc-go/v7 v7.0.0 h1:j4kyywlG0hhDmT9FmSaR5iCIka7Pz7kJTxGWY1nlV9Q=
+github.com/cosmos/ibc-go/v7 v7.0.0/go.mod h1:BFh8nKWjr5zeR2OZfhkzdgDzj1+KjRn3aJLpwapStj8=
+github.com/cosmos/ics23/go v0.9.1-0.20221207100636-b1abd8678aab h1:I9ialKTQo7248V827Bba4OuKPmk+FPzmTVHsLXaIJWw=
+github.com/cosmos/ics23/go v0.9.1-0.20221207100636-b1abd8678aab/go.mod h1:2CwqasX5dSD7Hbp/9b6lhK6BwoBDCBldx7gPKRukR60=
+github.com/cosmos/keyring v1.2.0 h1:8C1lBP9xhImmIabyXW4c3vFjjLiBdGCmfLUfeZlV1Yo=
+github.com/cosmos/keyring v1.2.0/go.mod h1:fc+wB5KTk9wQ9sDx0kFXB3A0MaeGHM9AwRStKOQ5vOA=
+github.com/cosmos/ledger-cosmos-go v0.12.1 h1:sMBxza5p/rNK/06nBSNmsI/WDqI0pVJFVNihy1Y984w=
+github.com/cosmos/ledger-cosmos-go v0.12.1/go.mod h1:dhO6kj+Y+AHIOgAe4L9HL/6NDdyyth4q238I9yFpD2g=
+github.com/cosmos/rosetta-sdk-go v0.10.0 h1:E5RhTruuoA7KTIXUcMicL76cffyeoyvNybzUGSKFTcM=
+github.com/cosmos/rosetta-sdk-go v0.10.0/go.mod h1:SImAZkb96YbwvoRkzSMQB6noNJXFgWl/ENIznEoYQI4=
github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE=
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
-github.com/creachadair/taskgroup v0.3.2 h1:zlfutDS+5XG40AOxcHDSThxKzns8Tnr9jnr6VqkYlkM=
-github.com/creachadair/taskgroup v0.3.2/go.mod h1:wieWwecHVzsidg2CsUnFinW1faVN4+kq+TDlRJQ0Wbk=
+github.com/creachadair/taskgroup v0.4.2 h1:jsBLdAJE42asreGss2xZGZ8fJra7WtwnHWeJFxv2Li8=
+github.com/creachadair/taskgroup v0.4.2/go.mod h1:qiXUOSrbwAY3u0JPGTzObbE3yf9hcXHDKBZ2ZjpCbgM=
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/cucumber/common/gherkin/go/v22 v22.0.0 h1:4K8NqptbvdOrjL9DEea6HFjSpbdT9+Q5kgLpmmsHYl0=
github.com/cucumber/common/messages/go/v17 v17.1.1 h1:RNqopvIFyLWnKv0LfATh34SWBhXeoFTJnSrgm9cT/Ts=
github.com/danieljoos/wincred v1.1.2 h1:QLdCxFs1/Yl4zduvBdcHB8goaYk9RARS2SgLLRuAyr0=
github.com/danieljoos/wincred v1.1.2/go.mod h1:GijpziifJoIBfYh+S7BbkdUTU4LfM+QnGqR5Vl2tAx0=
-github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
-github.com/deckarep/golang-set v0.0.0-20180603214616-504e848d77ea/go.mod h1:93vsz/8Wt4joVM7c2AVqh+YRMiUSc14yDtF28KmMOgQ=
github.com/decred/dcrd/crypto/blake256 v1.0.0 h1:/8DMNYp9SGi5f0w7uCm6d6M4OU2rGFK09Y2A4Xv7EE0=
-github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc=
-github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 h1:YLtO71vCjJRCBcrPMtQ9nqBsqpA1m5sE92cU+pd5Mcc=
-github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs=
-github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218=
+github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 h1:HbphB4TFFXpv7MNrT52FGrrgVXF1owhMVTHFZIlnvd4=
+github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0/go.mod h1:DZGJHZMqrU4JJqFAWUS2UO1+lbSKsdiOoYi9Zzey7Fc=
github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f h1:U5y3Y5UE0w7amNe7Z5G/twsBW0KEalRQXZzf8ufSh9I=
github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f/go.mod h1:xH/i4TFMt8koVQZ6WFms69WAsDWr2XsYL3Hkl7jkoLE=
-github.com/dgraph-io/badger v1.6.0/go.mod h1:zwt7syl517jmP8s94KqSxTlM6IMsdhYy6psNgSztDR4=
-github.com/dgraph-io/badger/v2 v2.2007.2/go.mod h1:26P/7fbL4kUZVEVKLAKXkBXKOydDmM2p1e+NhhnBCAE=
github.com/dgraph-io/badger/v2 v2.2007.4 h1:TRWBQg8UrlUhaFdco01nO2uXwzKS7zd+HVdwV/GHc4o=
github.com/dgraph-io/badger/v2 v2.2007.4/go.mod h1:vSw/ax2qojzbN6eXHIx6KPKtCSHJN/Uz0X0VPruTIhk=
github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E=
-github.com/dgraph-io/ristretto v0.0.3/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E=
-github.com/dgraph-io/ristretto v0.1.0 h1:Jv3CGQHp9OjuMBSne1485aDpUkTKEcUqF+jm/LuerPI=
-github.com/dgraph-io/ristretto v0.1.0/go.mod h1:fux0lOrBhrVCJd3lcTHsIJhq1T2rokOu6v9Vcb3Q9ug=
-github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
+github.com/dgraph-io/ristretto v0.1.1 h1:6CWw5tJNgpegArSHpNHJKldNeq03FQCwYvfMVWajOK8=
+github.com/dgraph-io/ristretto v0.1.1/go.mod h1:S1GPSBCYCIhmVNfcth17y2zZtQT6wzkzgwUve0VDWWA=
github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw=
github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 h1:fAjc9m62+UWV/WAFKLNi6ZS0675eEUC9y3AlwSbQu1Y=
github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw=
-github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=
-github.com/dlclark/regexp2 v1.2.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc=
github.com/docker/distribution v2.8.1+incompatible h1:Q50tZOPR6T/hjNsyc9g8/syEs6bk8XXApsHjKukMl68=
github.com/docker/distribution v2.8.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
-github.com/docker/docker v1.4.2-0.20180625184442-8e610b2b55bf/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ=
github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4=
-github.com/dop251/goja v0.0.0-20200721192441-a695b0cdd498/go.mod h1:Mw6PkjjMXWbTj+nnj4s3QPXq1jaT0s5pC0iFD4+BOAA=
github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
-github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo=
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
+github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
+github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
github.com/dvsekhvalnov/jose2go v1.5.0 h1:3j8ya4Z4kMCwT5nXIKFSV84YS+HdqSSO0VsTQxaLAeM=
github.com/dvsekhvalnov/jose2go v1.5.0/go.mod h1:QsHjhyTlD/lAVqn/NSbVZmSCGeDehTB/mPZadG+mhXU=
-github.com/dvyukov/go-fuzz v0.0.0-20200318091601-be3528f3a813/go.mod h1:11Gm+ccJnvAhCNLlf5+cS9KjtbaD5I5zaZpFMsTHWTw=
github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs=
github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU=
github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I=
-github.com/edsrzf/mmap-go v0.0.0-20160512033002-935e0e8a636c/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M=
github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M=
-github.com/eknkc/amber v0.0.0-20171010120322-cdade1c07385/go.mod h1:0vRUJqYpeSZifjYj7uP3BG/gKcuzL9xWVV/Y+cK33KM=
+github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g=
+github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
+github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
+github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po=
+github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
+github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
+github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ=
+github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0=
+github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
-github.com/etcd-io/bbolt v1.3.3/go.mod h1:ZF2nL25h33cCyBtcyWeZ2/I3HQOfTP+0PIEvHjkjCrw=
-github.com/ethereum/go-ethereum v1.9.25/go.mod h1:vMkFiYLHI4tgPw4k2j4MHKoovchFE8plZ0M9VMk4/oM=
github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c h1:8ISkoahWXwZR41ois5lSJBSVw4D0OV19Ht/JSTzvSv0=
github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojtoVVWjGfOF9635RETekkoH6Cc9SX0A=
github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4 h1:7HZCaLC5+BZpmbhCOZJ293Lz68O7PYrF2EzeiFMwCLk=
-github.com/fasthttp-contrib/websocket v0.0.0-20160511215533-1f3b11f56072/go.mod h1:duJ4Jxv5lDcvg4QuQr0oowTf7dz4/CR8NtyCooz9HL8=
-github.com/fatih/color v1.3.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
-github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM=
-github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M=
-github.com/felixge/httpsnoop v1.0.1 h1:lvB5Jl89CsZtGIWuTcDM1E/vkVs49/Ml7JJe07l8SPQ=
github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
-github.com/fjl/memsize v0.0.0-20180418122429-ca190fb6ffbc/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0=
-github.com/flosch/pongo2 v0.0.0-20190707114632-bbf5a6c351f4/go.mod h1:T9YF2M40nIgbVgp3rreNmTged+9HrbNTIQf1PsaIiTA=
-github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k=
+github.com/felixge/httpsnoop v1.0.2 h1:+nS9g82KMXccJ/wp0zyRW9ZBHFETmMGtkk+2CTTrW4o=
+github.com/felixge/httpsnoop v1.0.2/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw=
github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4=
github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20=
@@ -303,20 +406,11 @@ github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMo
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY=
github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw=
-github.com/gavv/httpexpect v2.0.0+incompatible/go.mod h1:x+9tiU1YnrOvnB725RkpoLv1M62hOWzwo5OXotisrKc=
-github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww=
-github.com/getsentry/sentry-go v0.12.0/go.mod h1:NSap0JBYWzHND8oMbyi0+XZhUalc1TBdRL1M71JZW2c=
-github.com/getsentry/sentry-go v0.17.0 h1:UustVWnOoDFHBS7IJUB2QK/nB5pap748ZEp0swnQJak=
-github.com/getsentry/sentry-go v0.17.0/go.mod h1:B82dxtBvxG0KaPD8/hfSV+VcHD+Lg/xUS4JuQn1P4cM=
-github.com/ghemawat/stream v0.0.0-20171120220530-696b145b53b9/go.mod h1:106OIgooyS7OzLDOpUGgm9fA3bQENb/cFSyyBmMoJDs=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
-github.com/gin-gonic/gin v1.7.0 h1:jGB9xAJQ12AIGNB4HguylppmDK1Am9ppF7XnGXXJuoU=
-github.com/gin-gonic/gin v1.7.0/go.mod h1:jD2toBW3GZUr5UMcdrwQA10I7RuaFOl/SGeDjXkfUtY=
-github.com/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98=
-github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q=
-github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA=
+github.com/gin-gonic/gin v1.8.1 h1:4+fr/el88TOO3ewCmQr8cx/CtZ/umlIRIs5M4NTNjf8=
+github.com/gin-gonic/gin v1.8.1/go.mod h1:ji8BvRH1azfM+SYow9zQ6SZMvR8qOMZHmsCuWR9tTTk=
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
@@ -325,25 +419,20 @@ github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2
github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgOZ7o=
github.com/go-kit/kit v0.12.0 h1:e4o3o3IsBfAKQh5Qbbiqyfu97Ku7jrO/JbohvztANh4=
github.com/go-kit/kit v0.12.0/go.mod h1:lHd+EkCZPIwYItmGDDRdhinkzX2A1sj+M9biaEaizzs=
-github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY=
-github.com/go-kit/log v0.2.0/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0=
github.com/go-kit/log v0.2.1 h1:MRVx0/zhvdseW+Gza6N9rVzU/IVzaeE1SFI4raAhmBU=
github.com/go-kit/log v0.2.1/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0=
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A=
-github.com/go-logfmt/logfmt v0.5.1 h1:otpy5pqBCBZ1ng9RQ0dPu4PN7ba75Y/aA+UpowDyNVA=
-github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs=
-github.com/go-martini/martini v0.0.0-20170121215854-22fa46961aab/go.mod h1:/P9AEU963A2AYjv4d1V5eVL1CQbEJq6aCNHDDjibzu8=
-github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8=
+github.com/go-logfmt/logfmt v0.6.0 h1:wGYYu3uicYdqXVgoYbvnkrPVXkuLM1p1ifugDMEdRi4=
+github.com/go-logfmt/logfmt v0.6.0/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs=
github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
-github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8=
github.com/go-playground/locales v0.14.0 h1:u50s323jtVGugKlcYeyzC0etD1HifMjqmJqb8WugfUU=
-github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA=
+github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs=
github.com/go-playground/universal-translator v0.18.0 h1:82dyy6p4OuJq4/CByFNOn/jYrnRPArHwAcmLoJZxyho=
-github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4=
+github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA=
+github.com/go-playground/validator/v10 v10.10.0/go.mod h1:74x4gJWsvQexRdW8Pn3dXSGrTK4nAUsbPlLADvpJkos=
github.com/go-playground/validator/v10 v10.11.1 h1:prmOlTVv+YjZjmRmNSF3VmspqJIxJWXmqUsHwfTRRkQ=
-github.com/go-sourcemap/sourcemap v2.1.2+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg=
github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee h1:s+21KNqlpePfkah2I+gwHF8xmJWRjooY+5248k6m4A0=
@@ -352,31 +441,41 @@ github.com/gobwas/pool v0.2.0 h1:QEmUOlnSjWtnpRGHF3SauEiOsy82Cup83Vf2LcMlnc8=
github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw=
github.com/gobwas/ws v1.0.2 h1:CoAavW/wd/kulfZmSIBt6p24n4j7tHgNVCjsfHVNUbo=
github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM=
+github.com/goccy/go-json v0.9.7/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
+github.com/goccy/go-json v0.9.11 h1:/pAaQDLHEoCq/5FFmSKBswWmK6H0e8g4159Kc/X/nqk=
github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 h1:ZpnhV/YsD2/4cESfV5+Hoeu/iUR3ruzNvZ+yQfO03a0=
github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4=
-github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/gofrs/uuid v4.3.0+incompatible h1:CaSVZxm5B+7o45rtab4jC2G37WGYX1zQfuU2i6DSvnc=
-github.com/gogo/gateway v1.1.0 h1:u0SuhL9+Il+UbjM9VIE3ntfRujKbvVpFvNB4HbjeVQ0=
-github.com/gogo/gateway v1.1.0/go.mod h1:S7rR8FRQyG3QFESeSv4l2WnsyzlCLG0CzBbUUo/mbic=
-github.com/gogo/googleapis v0.0.0-20180223154316-0cd9801be74a/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s=
+github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s=
+github.com/gogo/googleapis v1.4.1-0.20201022092350-68b0159b7869/go.mod h1:5YRNX2z1oM5gXdAkurHa942MDgEJyk02w4OecKY87+c=
+github.com/gogo/googleapis v1.4.1 h1:1Yx4Myt7BxzvUr5ldGSbwYiZG6t9wGBZ+8/fX3Wvtq0=
github.com/gogo/googleapis v1.4.1/go.mod h1:2lpHqI5OcWCtVElxXnPt+s8oJvMpySlOyM6xDCrzib4=
-github.com/gogo/status v1.1.0/go.mod h1:BFv9nrluPLmrS0EmGVvLaPNmRosr9KapBYd5/hpY1WM=
-github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I=
-github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k=
+github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
+github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
+github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4=
+github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o=
+github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
+github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
+github.com/golang-jwt/jwt/v4 v4.4.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
-github.com/golang/glog v1.0.0 h1:nfP3RFugxnNRyKgeWd4oI1nYvXpxrx8ck8ZrcizshdQ=
-github.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4=
+github.com/golang/glog v1.1.0 h1:/d3pCKDPWNnvIWe0vVUpNP32qc8U3PDVxySP/y360qE=
+github.com/golang/glog v1.1.0/go.mod h1:pfYeQZ3JWZoXTV5sFc986z3HTpwQs9At6P4ImfuP3NQ=
github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
+github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE=
+github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
+github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y=
github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4=
+github.com/golang/mock v1.5.0/go.mod h1:CWnOUgYIOo4TcNZ0wHX3YZCqsaM1I1Jvs6v3mP3KVu8=
github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc=
+github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0=
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
@@ -393,15 +492,14 @@ github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QD
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
-github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw=
+github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM=
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
+github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=
+github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
-github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
-github.com/golang/snappy v0.0.3-0.20201103224600-674baa8c7fc3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM=
github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
-github.com/gomodule/redigo v1.7.1-0.20190724094224-574c33c3df38/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4=
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/btree v1.1.2 h1:xf4v41cLI2Z6FxbKm+8Bu+m8ifhj15JuZ9sa0jZCMUU=
@@ -414,19 +512,24 @@ github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
+github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
+github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
+github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE=
+github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
-github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
-github.com/google/gofuzz v1.1.1-0.20200604201612-c04b05f3adfa/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0=
github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
+github.com/google/martian v2.1.0+incompatible h1:/CP5g8u/VJHijgedC/Legn3BAbAaWPgecwXBIDzw5no=
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=
github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=
+github.com/google/martian/v3 v3.2.1/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk=
+github.com/google/martian/v3 v3.3.2 h1:IqNFLAmvJOgVlpdEBiQbDc2EwKW77amAycfTuWKdfvw=
github.com/google/orderedcode v0.0.1 h1:UzfcAexk9Vhv8+9pNOgRu41f16lHq725vPwnSeiG/Us=
github.com/google/orderedcode v0.0.1/go.mod h1:iVyU4/qPKHY5h/wSd6rZZCDcLJNxiWO6dvsYES2Sb20=
github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
@@ -439,12 +542,33 @@ github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hf
github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
+github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
+github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
+github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
+github.com/google/pprof v0.0.0-20210609004039-a478d1d731e9/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
+github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
-github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
+github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
+github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
+github.com/googleapis/enterprise-certificate-proxy v0.0.0-20220520183353-fd19c99a87aa/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8=
+github.com/googleapis/enterprise-certificate-proxy v0.1.0/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8=
+github.com/googleapis/enterprise-certificate-proxy v0.2.0/go.mod h1:8C0jb7/mgJe/9KK8Lm7X9ctZC2t60YyIpYEI16jx0Qg=
+github.com/googleapis/enterprise-certificate-proxy v0.2.3 h1:yk9/cqRKtT9wXZSsRH9aurXEpJX+U6FLtpYTdC3R06k=
+github.com/googleapis/enterprise-certificate-proxy v0.2.3/go.mod h1:AwSRAtLfXpU5Nm3pW+v7rGDHp09LsPtGY9MduiEsR9k=
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
+github.com/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pfu6SK+H1/DsU0=
+github.com/googleapis/gax-go/v2 v2.1.1/go.mod h1:hddJymUZASv3XPyGkUpKj8pPO47Rmb0eJc8R6ouapiM=
+github.com/googleapis/gax-go/v2 v2.2.0/go.mod h1:as02EH8zWkzwUoLbBaFeQ+arQaj/OthfcblKl4IGNaM=
+github.com/googleapis/gax-go/v2 v2.3.0/go.mod h1:b8LNqSzNabLiUpXKkY7HAR5jr6bIT99EXz9pXxye9YM=
+github.com/googleapis/gax-go/v2 v2.4.0/go.mod h1:XOTVJ59hdnfJLIP/dh8n5CGryZR2LxK9wbMD5+iXC6c=
+github.com/googleapis/gax-go/v2 v2.5.1/go.mod h1:h6B0KMMFNtI2ddbGJn3T3ZbwkeT6yqEF02fYlzkUCyo=
+github.com/googleapis/gax-go/v2 v2.6.0/go.mod h1:1mjbznJAPHFpesgE5ucqfYEscaz5kMdcIDwU/6+DDoY=
+github.com/googleapis/gax-go/v2 v2.7.0 h1:IcsPKeInNvYi7eqSaDjiZqDDKu5rsmunY0Y1YupQSSQ=
+github.com/googleapis/gax-go/v2 v2.7.0/go.mod h1:TEop28CZZQ2y+c0VxMUmu1lV+fQx57QpBWsYpwqHJx8=
+github.com/googleapis/go-type-adapters v1.0.0/go.mod h1:zHW75FOG2aur7gAO2B+MLby+cLsWGBF62rFAi7WjWO4=
github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g=
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg=
@@ -455,18 +579,14 @@ github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2z
github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI=
github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
-github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
-github.com/gorilla/websocket v1.4.1-0.20190629185528-ae1634f6a989/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc=
github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
-github.com/graph-gophers/graphql-go v0.0.0-20191115155744-f33e81362277/go.mod h1:9CQHMSxwO4MprSdzoIEobiHpoLtHm77vfxsvsIN5Vuc=
github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs=
github.com/grpc-ecosystem/go-grpc-middleware v1.2.2/go.mod h1:EaizFBKfUKtMIF5iaDEhniwNedqGo9FuLFzppDr3uwI=
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 h1:+9834+KizmvFV7pXQGSXQTsaWhq2GjuNUt0aUU0YBYw=
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0/go.mod h1:z0ButlSOZa5vEBq9m2m2hlwIgKw+rp3sdCBRoJY+30Y=
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk=
-github.com/grpc-ecosystem/grpc-gateway v1.8.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo=
github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=
@@ -482,6 +602,10 @@ github.com/hashicorp/consul/sdk v0.3.0/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyN
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
+github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ=
+github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48=
+github.com/hashicorp/go-getter v1.7.0 h1:bzrYP+qu/gMrL1au7/aDvkoOVGUJpeKBgbqRHACAFDY=
+github.com/hashicorp/go-getter v1.7.0/go.mod h1:W7TalhMmbPmsSMdNjD0ZskARur/9GJ17cfHTRtXV744=
github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
github.com/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJFeZnpfm2KLowc=
github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
@@ -489,164 +613,113 @@ github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iP
github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs=
github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU=
+github.com/hashicorp/go-safetemp v1.0.0 h1:2HR189eFNrjHQyENnQMMpCiBAsRxzbTMIgBhEyExpmo=
+github.com/hashicorp/go-safetemp v1.0.0/go.mod h1:oaerMy3BhqiTbVye6QuFhFtIceqFoDHxNAB65b+Rj1I=
github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU=
github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4=
github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/hashicorp/go-uuid v1.0.1 h1:fv1ep09latC32wFoVwnqcnKJGnMSdBanPczbHAYm1BE=
github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
+github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek=
github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90=
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
-github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc=
-github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
+github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d h1:dg1dEPuWpEqDnvIw251EVy4zlP8gWbsGj4BsUKCRpYs=
+github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64=
github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ=
github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I=
github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc=
-github.com/hdevalence/ed25519consensus v0.0.0-20210204194344-59a8610d2b87 h1:uUjLpLt6bVvZ72SQc/B4dXcPBw4Vgd7soowdRl52qEM=
-github.com/hdevalence/ed25519consensus v0.0.0-20210204194344-59a8610d2b87/go.mod h1:XGsKKeXxeRr95aEOgipvluMPlgjr7dGlk9ZTWOjcUcg=
-github.com/holiman/uint256 v1.1.1/go.mod h1:y4ga/t+u+Xwd7CpDgZESaRcWy0I7XMlTMA25ApIH5Jw=
+github.com/hdevalence/ed25519consensus v0.1.0 h1:jtBwzzcHuTmFrQN6xQZn6CQEO/V9f7HsjsjeEZ6auqU=
+github.com/hdevalence/ed25519consensus v0.1.0/go.mod h1:w3BHWjwJbFU29IRHL1Iqkw3sus+7FctEyM4RqDxYNzo=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
+github.com/huandu/go-assert v1.1.5 h1:fjemmA7sSfYHJD7CUqs9qTwwfdNAx7/j2/ZlHXzNB3c=
+github.com/huandu/go-assert v1.1.5/go.mod h1:yOLvuqZwmcHIC5rIzrBhT7D3Q9c3GFnd0JrPVhn/06U=
+github.com/huandu/skiplist v1.2.0 h1:gox56QD77HzSC0w+Ws3MH3iie755GBJU1OER3h5VsYw=
+github.com/huandu/skiplist v1.2.0/go.mod h1:7v3iFjLcSAzO4fN5B8dvebvo/qsfumiLiDXMrPiHF9w=
github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg=
-github.com/huin/goupnp v1.0.0/go.mod h1:n9v9KO1tAxYH82qOn+UTIFQDmx5n1Zxd/ClZDMX7Bnc=
-github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o=
-github.com/hydrogen18/memlistener v0.0.0-20141126152155-54553eb933fb/go.mod h1:qEIFzExnS6016fRpRfxrExeVn2gbClQA99gQhnIcdhE=
-github.com/hydrogen18/memlistener v0.0.0-20200120041712-dcc25e7acd91/go.mod h1:qEIFzExnS6016fRpRfxrExeVn2gbClQA99gQhnIcdhE=
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
-github.com/imkira/go-interpol v1.1.0/go.mod h1:z0h2/2T3XF8kyEPpRgJ3kmNv+C43p+I/CoI+jC3w2iA=
-github.com/improbable-eng/grpc-web v0.14.1 h1:NrN4PY71A6tAz2sKDvC5JCauENWp0ykG8Oq1H3cpFvw=
-github.com/improbable-eng/grpc-web v0.14.1/go.mod h1:zEjGHa8DAlkoOXmswrNvhUGEYQA9UI7DhrGeHR1DMGU=
+github.com/improbable-eng/grpc-web v0.15.0 h1:BN+7z6uNXZ1tQGcNAuaU1YjsLTApzkjt2tzCixLaUPQ=
+github.com/improbable-eng/grpc-web v0.15.0/go.mod h1:1sy9HKV4Jt9aEs9JSnkWlRJPuPtwNr0l57L4f878wP8=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
-github.com/inconshreveable/mousetrap v1.0.1 h1:U3uMjPSQEBMNp1lFxmllqCPM6P5u/Xq7Pgzkat/bFNc=
github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
-github.com/influxdata/influxdb v1.2.3-0.20180221223340-01288bdb0883/go.mod h1:qZna6X/4elxqT3yI9iZYdZrWWdeFOOprn86kgg4+IzY=
+github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
+github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo=
-github.com/informalsystems/tendermint v0.34.26 h1:89XvVexAy62geGWxmDmdmmJvfindx+Su2oTuwfSWMeU=
-github.com/informalsystems/tendermint v0.34.26/go.mod h1:q3uAZ/t5+MblQhFuHSd4flqaLDx7iUtWpwWbwvHAFhs=
-github.com/iris-contrib/blackfriday v2.0.0+incompatible/go.mod h1:UzZ2bDEoaSGPbkg6SAB4att1aAwTmVIx/5gCVqeyUdI=
-github.com/iris-contrib/go.uuid v2.0.0+incompatible/go.mod h1:iz2lgM/1UnEf1kP0L/+fafWORmlnuysV2EMP8MW+qe0=
-github.com/iris-contrib/i18n v0.0.0-20171121225848-987a633949d0/go.mod h1:pMCz62A0xJL6I+umB2YTlFRwWXaDFA0jy+5HzGiJjqI=
-github.com/iris-contrib/jade v1.1.3/go.mod h1:H/geBymxJhShH5kecoiOCSssPX7QWYH7UaeZTSWddIk=
-github.com/iris-contrib/pongo2 v0.0.1/go.mod h1:Ssh+00+3GAZqSQb30AvBRNxBx7rf0GqwkjqxNd0u65g=
-github.com/iris-contrib/schema v0.0.1/go.mod h1:urYA3uvUNG1TIIjOSCzHr9/LmbQo8LrOcOqfqxa4hXw=
-github.com/jackpal/go-nat-pmp v1.0.2-0.20160603034137-1fa385a6f458/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc=
-github.com/jedisct1/go-minisign v0.0.0-20190909160543-45766022959e/go.mod h1:G1CVv03EnqU1wYL2dFwXxW2An0az9JTl/ZsqXQeBlkU=
-github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
-github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
-github.com/jhump/protoreflect v1.13.1-0.20220928232736-101791cb1b4c h1:XImQJfpJLmGEEd8ll5yPVyL/aEvmgGHW4WYTyNseLOM=
+github.com/jhump/protoreflect v1.12.1-0.20220721211354-060cc04fc18b h1:izTof8BKh/nE1wrKOrloNA5q4odOarjf+Xpe+4qow98=
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
+github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg=
+github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
+github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8=
+github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U=
github.com/jmhodges/levigo v1.0.0 h1:q5EC36kV79HWeTBWsod3mG11EgStG3qArTKcvlksN1U=
github.com/jmhodges/levigo v1.0.0/go.mod h1:Q6Qx+uH3RAqyK4rFQroq9RL7mdkABMcfhEI+nNuzMJQ=
github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4=
-github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ=
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
-github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
-github.com/juju/errors v0.0.0-20181118221551-089d3ea4e4d5/go.mod h1:W54LbzXuIE0boCoNJfwqpmkKJ1O4TCTZMetAt6jGk7Q=
-github.com/juju/loggo v0.0.0-20180524022052-584905176618/go.mod h1:vgyd7OREkbtVEN/8IXZe5Ooef3LQePvuBm9UWj6ZL8U=
-github.com/juju/testing v0.0.0-20180920084828-472a3e8b2073/go.mod h1:63prj8cnj0tU0S9OHjGJn+b1h0ZghCndfnbQolrYTwA=
-github.com/julienschmidt/httprouter v1.1.1-0.20170430222011-975b5c4c7c21/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM=
-github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes=
-github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88/go.mod h1:3w7q1U84EfirKl04SVQ/s7nPm1ZPhiXd34z40TNz36k=
-github.com/karalabe/usb v0.0.0-20190919080040-51dc0efba356/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU=
-github.com/kataras/golog v0.0.9/go.mod h1:12HJgwBIZFNGL0EJnMRhmvGA0PQGx8VFwrZtM4CqbAk=
-github.com/kataras/golog v0.0.10/go.mod h1:yJ8YKCmyL+nWjERB90Qwn+bdyBZsaQwU3bTVFgkFIp8=
-github.com/kataras/iris/v12 v12.0.1/go.mod h1:udK4vLQKkdDqMGJJVd/msuMtN6hpYJhg/lSzuxjhO+U=
-github.com/kataras/iris/v12 v12.1.8/go.mod h1:LMYy4VlP67TQ3Zgriz8RE2h2kMZV2SgMYbq3UhfoFmE=
-github.com/kataras/neffos v0.0.10/go.mod h1:ZYmJC07hQPW67eKuzlfY7SO3bC0mw83A3j6im82hfqw=
-github.com/kataras/neffos v0.0.14/go.mod h1:8lqADm8PnbeFfL7CLXh1WHw53dG27MC3pgi2R1rmoTE=
-github.com/kataras/pio v0.0.0-20190103105442-ea782b38602d/go.mod h1:NV88laa9UiiDuX9AhMbDPkGYSPugBOV6yTZB1l2K9Z0=
-github.com/kataras/pio v0.0.2/go.mod h1:hAoW0t9UmXi4R5Oyq5Z4irTbaTsOemSrDGUtaTl7Dro=
-github.com/kataras/sitemap v0.0.5/go.mod h1:KY2eugMKiPwsJgx7+U103YZehfvNGOXURubcGyk0Bz8=
+github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
+github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00=
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
-github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4=
-github.com/klauspost/compress v1.8.2/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A=
-github.com/klauspost/compress v1.9.0/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A=
-github.com/klauspost/compress v1.9.7/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A=
github.com/klauspost/compress v1.10.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
github.com/klauspost/compress v1.11.7/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
github.com/klauspost/compress v1.12.3/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg=
-github.com/klauspost/compress v1.15.11 h1:Lcadnb3RKGin4FYM/orgq0qde+nc15E5Cbqg4B9Sx9c=
github.com/klauspost/compress v1.15.11/go.mod h1:QPwzmACJjUTFsnSHH934V6woptycfrDDJnH7hvFVbGM=
-github.com/klauspost/cpuid v1.2.1/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=
+github.com/klauspost/compress v1.16.3 h1:XuJt9zzcnaz6a16/OU53ZjWp/v7/42WcR5t2a0PcNQY=
+github.com/klauspost/compress v1.16.3/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg=
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
-github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
+github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
-github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
-github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
-github.com/labstack/echo/v4 v4.1.11/go.mod h1:i541M3Fj6f76NZtHSj7TXnyM8n2gaodfvfxNnFqi74g=
-github.com/labstack/echo/v4 v4.5.0/go.mod h1:czIriw4a0C1dFun+ObrXp7ok03xON0N1awStJ6ArI7Y=
-github.com/labstack/gommon v0.3.0/go.mod h1:MULnywXg0yavhxWKc+lOruYdAhDwPK9wf0OL7NoOu+k=
-github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII=
github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w=
-github.com/lib/pq v1.10.6 h1:jbk+ZieJ0D7EVGJYpL9QTz7/YW6UHbmdnZWYyK5cdBs=
-github.com/lib/pq v1.10.6/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
+github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY=
+github.com/lib/pq v1.10.7 h1:p7ZhMD+KsSRozJr34udlUrhboJwWAgCg34+/ZZNvZZw=
+github.com/lib/pq v1.10.7/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8=
github.com/libp2p/go-buffer-pool v0.1.0/go.mod h1:N+vh8gMqimBzdKkSMVuydVDq+UV5QTWy5HSiZacSbPg=
github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM=
github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4=
-github.com/linxGnu/grocksdb v1.7.10 h1:dz7RY7GnFUA+GJO6jodyxgkUeGMEkPp3ikt9hAcNGEw=
-github.com/linxGnu/grocksdb v1.7.10/go.mod h1:0hTf+iA+GOr0jDX4CgIYyJZxqOH9XlBh6KVj8+zmF34=
-github.com/lucasjones/reggen v0.0.0-20180717132126-cdb49ff09d77/go.mod h1:5ELEyG+X8f+meRWHuqUOewBOhvHkl7M76pdGEansxW4=
+github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ=
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
-github.com/magiconair/properties v1.8.6 h1:5ibWZ6iY0NctNGWo87LalDlEZ6R41TqbbDamhfG/Qzo=
-github.com/magiconair/properties v1.8.6/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60=
+github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY=
+github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0=
+github.com/manifoldco/promptui v0.9.0 h1:3V4HzJk1TtXW1MTZMP7mdlwbBpIinw3HztaIlYthEiA=
+github.com/manifoldco/promptui v0.9.0/go.mod h1:ka04sppxSGFAtxX0qhlYQjISsg9mR4GWtQEhdbn6Pgg=
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
-github.com/mattn/go-colorable v0.1.0/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
-github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
-github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
-github.com/mattn/go-colorable v0.1.11/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=
-github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=
-github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
-github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
-github.com/mattn/go-ieproxy v0.0.0-20190610004146-91bb50d98149/go.mod h1:31jz6HNzdxOmlERGGEc4v/dMssOfmp2p5bT/okiKFFc=
-github.com/mattn/go-ieproxy v0.0.0-20190702010315-6dee0af9227d/go.mod h1:31jz6HNzdxOmlERGGEc4v/dMssOfmp2p5bT/okiKFFc=
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
-github.com/mattn/go-isatty v0.0.5-0.20180830101745-3fb116b82035/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
-github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
-github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ=
-github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
-github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ=
-github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
+github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng=
+github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
-github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
-github.com/mattn/goveralls v0.0.2/go.mod h1:8d1ZMHsd7fW6IRPKQh46F2WRpyib5/X4FOpevwGNQEw=
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
-github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 h1:I0XW9+e1XWDxdcEniV4rQAIOPUGDq67JSCiRCgGCZLI=
-github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4=
-github.com/mediocregopher/mediocre-go-lib v0.0.0-20181029021733-cb65787f37ed/go.mod h1:dSsfyI2zABAdhcbvkXqgxOxrCsbYeHCPgrZkku60dSg=
-github.com/mediocregopher/radix/v3 v3.3.0/go.mod h1:EmfVyvspXz1uZEyPBMyGK+kjWiKQGvsUt6O3Pj+LDCQ=
-github.com/mediocregopher/radix/v3 v3.4.2/go.mod h1:8FL3F6UQRXHXIBSPUs5h0RybMF8i4n7wVopoX3x7Bv8=
-github.com/microcosm-cc/bluemonday v1.0.2/go.mod h1:iVP4YcDBq+n/5fb23BhYFvIMq/leAFZyRl6bYmGDlGc=
+github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo=
+github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4=
github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643/go.mod h1:43+3pMjjKimDBf5Kr4ZFNGbLql1zKkbImw+fZbw3geM=
github.com/mimoo/StrobeGo v0.0.0-20210601165009-122bf33a46e0 h1:QRUSJEgZn2Snx0EmT/QLXibWjSUDjKWvXIT19NBVp94=
@@ -655,13 +728,15 @@ github.com/minio/highwayhash v1.0.2 h1:Aak5U0nElisjDCfPSG79Tgzkn2gl66NxOMspRrKnA
github.com/minio/highwayhash v1.0.2/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY=
github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc=
github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
+github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI=
+github.com/mitchellh/go-testing-interface v1.14.1 h1:jrgshOhYAUVNMAJiKbEu7EqAwgJJ2JqpQmpLJOu07cU=
+github.com/mitchellh/go-testing-interface v1.14.1/go.mod h1:gfgS7OtZj6MA4U1UrDRp04twqAjfvlZyCfX3sDjEym8=
github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg=
github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY=
github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
-github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
@@ -671,46 +746,34 @@ github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lN
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
-github.com/moul/http2curl v1.0.0/go.mod h1:8UbvGypXm98wA/IqH45anm5Y2Z6ep6O31QGOAZ3H0fQ=
github.com/mtibben/percent v0.2.1 h1:5gssi8Nqo8QU/r2pynCm+hBQHpkB/uNK7BJCFogWdzs=
github.com/mtibben/percent v0.2.1/go.mod h1:KG9uO+SZkUp+VkRHsCdYQV3XSZrrSpR3O9ibNBTZrns=
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f h1:KUppIJq7/+SVif2QVs3tOP0zanoHgBEVAwHxUSIzRqU=
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/mwitkow/grpc-proxy v0.0.0-20181017164139-0f1106ef9c76/go.mod h1:x5OoJHDHqxHS801UIuhqGl6QdSAEJvtausosHSdazIo=
-github.com/naoina/go-stringutil v0.1.0/go.mod h1:XJ2SJL9jCtBh+P9q5btrd/Ylo8XwT/h1USek5+NqSA0=
-github.com/naoina/toml v0.1.2-0.20170918210437-9fafd6967416/go.mod h1:NBIhNtsFMo3G2szEBne+bO4gS192HuIYRqfvOWb4i1E=
github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg=
github.com/nats-io/jwt v0.3.2/go.mod h1:/euKqTS1ZD+zzjYrY7pseZrTtWQSjujC7xjPc8wL6eU=
github.com/nats-io/nats-server/v2 v2.1.2/go.mod h1:Afk+wRZqkMQs/p45uXdrVLuab3gwv3Z8C4HTBu8GD/k=
-github.com/nats-io/nats.go v1.8.1/go.mod h1:BrFz9vVn0fU3AcH9Vn4Kd7W0NpJ651tD5omQ3M8LwxM=
github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzEE/Zbp4w=
-github.com/nats-io/nkeys v0.0.2/go.mod h1:dab7URMsZm6Z/jp9Z5UGa87Uutgc2mVpXLC4B7TDb/4=
github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w=
github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w=
github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c=
-github.com/neilotoole/errgroup v0.1.5/go.mod h1:Q2nLGf+594h0CLBs/Mbg6qOr7GtqDK7C2S41udRnToE=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
-github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78=
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
+github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs=
github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA=
-github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U=
github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo=
-github.com/olekukonko/tablewriter v0.0.1/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo=
-github.com/olekukonko/tablewriter v0.0.2-0.20190409134802-7e037d187b0c/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo=
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
-github.com/onsi/ginkgo v1.10.3/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk=
-github.com/onsi/ginkgo v1.13.0/go.mod h1:+REjRxOmWfHCjfv9TTWB1jD1Frx4XydAD3zm1lskyM0=
-github.com/onsi/ginkgo v1.14.0 h1:2mOpI4JVVPBN+WQRa0WKH2eXR+Ey+uK4n7Zj0aYpIQA=
github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY=
-github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA=
+github.com/onsi/ginkgo v1.16.4 h1:29JGrr5oVBm5ulCWet69zQkzWipVXIol6ygQUe/EzNc=
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
-github.com/onsi/gomega v1.10.1 h1:o0+MgICZLuZ7xjH7Vx6zS/zcu93/BEp1VwkIW1mEXCE=
github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
+github.com/onsi/gomega v1.20.0 h1:8W0cWlwFkflGPLltQvLRB7ZVD5HuP6ng320w2IS245Q=
github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk=
github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U=
github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=
@@ -725,27 +788,21 @@ github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJ
github.com/openzipkin/zipkin-go v0.2.1/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4=
github.com/openzipkin/zipkin-go v0.2.2/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4=
github.com/ory/dockertest v3.3.5+incompatible h1:iLLK6SQwIhcbrG783Dghaaa3WPzGc+4Emza6EbVUUGA=
-github.com/otiai10/copy v1.6.0 h1:IinKAryFFuPONZ7cm6T6E2QX/vcJwSnlaA5lfoaXIiQ=
github.com/pact-foundation/pact-go v1.0.4/go.mod h1:uExwJY4kCzNPcHRj+hCR/HBbOOIwwtUjcrb0b5/5kLM=
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY=
github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
-github.com/pborman/uuid v0.0.0-20170112150404-1b00554d8222/go.mod h1:VyrYX9gd7irzKovcSS6BIIEwPRkP2Wm2m9ufcdFSJ34=
github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k=
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
-github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8=
-github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c=
-github.com/pelletier/go-toml/v2 v2.0.5 h1:ipoSadvV8oGUjnUbMub59IDPPwfxF694nG/jwbMiyQg=
-github.com/pelletier/go-toml/v2 v2.0.5/go.mod h1:OMHamSCAODeSsVrwwvcJOaoN0LIUIaFVNZzmWyNfXas=
+github.com/pelletier/go-toml/v2 v2.0.1/go.mod h1:r9LEWfGN8R5k0VXJ+0BkIe7MYkRdwZOjgMj2KwnJFUo=
+github.com/pelletier/go-toml/v2 v2.0.6 h1:nrzqCb7j9cDFj2coyLNLaZuJTLjWjlaz6nvTvIwycIU=
+github.com/pelletier/go-toml/v2 v2.0.6/go.mod h1:eumQOmlWiOPt5WriQQqoM5y18pDHwha2N+QD+EUNTek=
github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac=
-github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7/go.mod h1:CRroGNssyjTd/qIG2FyxByd2S8JEAZXBl4qUrZf8GS0=
-github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 h1:q2e307iGHPdTGp0hoxKjt1H5pDo6utceo3dQVK3I5XQ=
github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o=
-github.com/philhofer/fwd v1.1.1/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU=
+github.com/petermattis/goid v0.0.0-20221215004737-a150e88a970d h1:htwtWgtQo8YS6JFWWi2DNgY0RwSGJ1ruMoxY6CUUclk=
+github.com/petermattis/goid v0.0.0-20221215004737-a150e88a970d/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4=
github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc=
github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
-github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4=
-github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8=
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
@@ -762,8 +819,6 @@ github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5Fsn
github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og=
github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU=
github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M=
-github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0=
-github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY=
github.com/prometheus/client_golang v1.14.0 h1:nJdhIvne2eSX/XRAFV9PcvFFRbrjbcTUj0VP62TMhnw=
github.com/prometheus/client_golang v1.14.0/go.mod h1:8vpkKitgIVNcqrRBWh1C4TIUQgYNtG/XQE4E/Zae36Y=
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
@@ -774,69 +829,45 @@ github.com/prometheus/client_model v0.1.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6T
github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/prometheus/client_model v0.3.0 h1:UBgGFHqYdG/TPFD1B1ogZywDqEkwp3fBMvqdiQ7Xew4=
github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w=
-github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA=
github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4=
github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo=
github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s=
-github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc=
-github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls=
-github.com/prometheus/common v0.37.0 h1:ccBbHCgIiT9uSoFY0vX8H3zsNR5eLt17/RQLUvn8pXE=
-github.com/prometheus/common v0.37.0/go.mod h1:phzohg0JFMnBEFGxTDbfu3QyL5GI8gTQJFhYO5B3mfA=
+github.com/prometheus/common v0.40.0 h1:Afz7EVRqGg2Mqqf4JuF9vdvp1pi220m55Pi9T2JnO4Q=
+github.com/prometheus/common v0.40.0/go.mod h1:L65ZJPSmfn/UBWLQIHV7dBrKFidB/wPlF1y5TlSt9OE=
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A=
github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
github.com/prometheus/procfs v0.3.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
-github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA=
-github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA=
-github.com/prometheus/procfs v0.8.0 h1:ODq8ZFEaYeCaZOJlZZdJA2AbQR98dSHSM1KW/You5mo=
-github.com/prometheus/procfs v0.8.0/go.mod h1:z7EfXMXOkbkqb9IINtpCn86r/to3BnA0uaxHdg830/4=
-github.com/prometheus/tsdb v0.6.2-0.20190402121629-4f204dcbc150/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
+github.com/prometheus/procfs v0.9.0 h1:wzCHvIvM5SxWqYvwgVL7yJY8Lz3PKn49KQtpgMYJfhI=
+github.com/prometheus/procfs v0.9.0/go.mod h1:+pB4zwohETzFnmlpe6yd2lSc+0/46IYZRB/chUwxUZY=
github.com/rakyll/statik v0.1.7 h1:OF3QCZUuyPxuGEP7B4ypUa7sB/iHtqOTDYZXGM8KOdQ=
github.com/rakyll/statik v0.1.7/go.mod h1:AlZONWzMtEnMs7W4e/1LURLiI49pIMmp6V9Unghqrcc=
github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 h1:N/ElC8H3+5XpJzTSTfLsJV/mx9Q9g7kxmchpfZyxgzM=
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
-github.com/regen-network/cosmos-proto v0.3.1 h1:rV7iM4SSFAagvy8RiyhiACbWEGotmqzywPxOvwMdxcg=
-github.com/regen-network/cosmos-proto v0.3.1/go.mod h1:jO0sVX6a1B36nmE8C9xBFXpNwWejXC7QqCOnH3O0+YM=
github.com/regen-network/gocuke v0.6.2 h1:pHviZ0kKAq2U2hN2q3smKNxct6hS0mGByFMHGnWA97M=
-github.com/regen-network/protobuf v1.3.3-alpha.regen.1 h1:OHEc+q5iIAXpqiqFKeLpu5NwTIkVXUs48vFMwzqpqY4=
-github.com/regen-network/protobuf v1.3.3-alpha.regen.1/go.mod h1:2DjTFR1HhMQhiWC5sZ4OhQ3+NtdbZ6oBDKQwq5Ou+FI=
-github.com/rjeczalik/notify v0.9.1/go.mod h1:rKwnCoCGeuQnwBtTSPL9Dad03Vh2n40ePRrjvIXnJho=
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
-github.com/rogpeppe/go-internal v1.8.1/go.mod h1:JeRgkft04UBgHMgCIwADu4Pn6Mtm5d4nPKWu0nJ5d+o=
+github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE=
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
-github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
-github.com/rs/cors v0.0.0-20160617231935-a62a804a8a00/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU=
github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU=
-github.com/rs/cors v1.8.2 h1:KCooALfAYGs415Cwu5ABvv9n9509fSiG5SQJn/AQo4U=
-github.com/rs/cors v1.8.2/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU=
-github.com/rs/xhandler v0.0.0-20160618193221-ed27b6fd6521/go.mod h1:RvLn4FgxWubrpZHtQLnOf6EwhN2hEMusxZOhcW9H3UQ=
-github.com/rs/xid v1.3.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
-github.com/rs/zerolog v1.27.0 h1:1T7qCieN22GVc8S4Q2yuexzBb1EqjbgjSH9RohbMjKs=
-github.com/rs/zerolog v1.27.0/go.mod h1:7frBqO0oezxmnO7GF86FY++uy8I0Tk/If5ni1G9Qc0U=
+github.com/rs/cors v1.8.3 h1:O+qNyWn7Z+F9M0ILBHgMVPuB1xTOucVd5gtaYyXBpRo=
+github.com/rs/cors v1.8.3/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU=
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
-github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E=
github.com/sasha-s/go-deadlock v0.3.1 h1:sqv7fDNShgjcaxkO0JNcOAlr8B9+cV5Ey/OB71efZx0=
github.com/sasha-s/go-deadlock v0.3.1/go.mod h1:F73l+cr82YSh10GxyRI6qZiCgK64VaZjwesgfQ1/iLM=
-github.com/schollz/closestmatch v2.1.0+incompatible/go.mod h1:RtP1ddjLong6gTkbtmuhtR2uUrrJOpYzYRvbcPAid+g=
-github.com/sclevine/agouti v3.0.0+incompatible/go.mod h1:b4WX9W9L1sfQKXeJf1mUTLZKJ48R1S7H23Ji7oFO5Bw=
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
-github.com/segmentio/fasthash v1.0.3/go.mod h1:waKX8l2N8yckOgmSsXJi7x1ZfdKZ4x7KRMzBtS3oedY=
-github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
-github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
-github.com/shirou/gopsutil v2.20.5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
@@ -853,8 +884,8 @@ github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasO
github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI=
github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
-github.com/spf13/afero v1.9.2 h1:j49Hj62F0n+DaZ1dDCvhABaPNSGNkt32oRFxI33IEMw=
-github.com/spf13/afero v1.9.2/go.mod h1:iUV7ddyEEZPO5gA3zD4fJt6iStLlL+Lg4m2cihcDf8Y=
+github.com/spf13/afero v1.9.3 h1:41FoI0fD7OR7mGcKE/aOiLkGreyf8ifIOQmJANWogMk=
+github.com/spf13/afero v1.9.3/go.mod h1:iUV7ddyEEZPO5gA3zD4fJt6iStLlL+Lg4m2cihcDf8Y=
github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w=
github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU=
@@ -870,11 +901,8 @@ github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnIn
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s=
-github.com/spf13/viper v1.14.0 h1:Rg7d3Lo706X9tHsJMUjdiwMpHB7W8WnSVOssIY+JElU=
-github.com/spf13/viper v1.14.0/go.mod h1:WT//axPky3FdvXHzGw33dNdXXXfFQqmEalje+egj8As=
-github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4/go.mod h1:RZLeN1LMWmRsyYjvAu+I6Dm9QmlDaIIt+Y+4Kd7Tp+Q=
-github.com/steakknife/bloomfilter v0.0.0-20180922174646-6819c0d2a570/go.mod h1:8OR4w3TdeIHIh1g6EMY5p0gVNOovcWC+1vpc7naMuAw=
-github.com/steakknife/hamming v0.0.0-20180906055917-c99c65617cd3/go.mod h1:hpGUWaI9xL8pRQCTXQgocU38Qw1g0Us7n5PxxTwTCYU=
+github.com/spf13/viper v1.15.0 h1:js3yy885G8xwJa6iOISGFwd+qlUo5AvyXb7CiihdtiU=
+github.com/spf13/viper v1.15.0/go.mod h1:fFcTBJxvhhzSJiZy8n+PeW6t8l+KeT/uTARa0jHOQLA=
github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw=
github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw=
github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI=
@@ -891,67 +919,46 @@ github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
+github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8=
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
-github.com/subosito/gotenv v1.4.1 h1:jyEFiXpy21Wm81FBN71l9VoMMV8H8jG+qIK3GCpY6Qs=
-github.com/subosito/gotenv v1.4.1/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0=
-github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca/go.mod h1:u2MKkTVTVJWe5D1rCvame8WqhBd88EuIwODJZ1VHCPM=
+github.com/subosito/gotenv v1.4.2 h1:X1TuBLAMDFbaTAChgCBLu3DU3UPyELpnF2jjJ2cz/S8=
+github.com/subosito/gotenv v1.4.2/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0=
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY=
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc=
+github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c h1:g+WoO5jjkqGAzHWCjJB1zZfXPIAaDpzXIEJ0eS6B5Ok=
+github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c/go.mod h1:ahpPrc7HpcfEWDQRZEmnXMzHY03mLDYMCxeDzy46i+8=
github.com/tendermint/go-amino v0.16.0 h1:GyhmgQKvqF82e2oZeuMSp9JTN0N09emoSZlb2lyGa2E=
github.com/tendermint/go-amino v0.16.0/go.mod h1:TQU0M1i/ImAo+tYpZi73AU3V/dKeCoMC9Sphe2ZwGME=
-github.com/tendermint/tm-db v0.6.7 h1:fE00Cbl0jayAoqlExN6oyQJ7fR/ZtoVOmvPJ//+shu8=
-github.com/tendermint/tm-db v0.6.7/go.mod h1:byQDzFkZV1syXr/ReXS808NxA2xvyuuVgXOJ/088L6I=
-github.com/tidwall/btree v1.5.0 h1:iV0yVY/frd7r6qGBXfEYs7DH0gTDgrKTrDjS7xt/IyQ=
-github.com/tidwall/btree v1.5.0/go.mod h1:LGm8L/DZjPLmeWGjv5kFrY8dL4uVhMmzmmLYmsObdKE=
-github.com/tidwall/gjson v1.6.7/go.mod h1:zeFuBCIqD4sN/gmqBzZ4j7Jd6UcA2Fc56x7QFsv+8fI=
-github.com/tidwall/match v1.0.3/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
-github.com/tidwall/pretty v1.0.2/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
-github.com/tidwall/sjson v1.1.4/go.mod h1:wXpKXu8CtDjKAZ+3DrKY5ROCorDFahq8l0tey/Lx1fg=
-github.com/tinylib/msgp v1.1.5/go.mod h1:eQsjooMTnV42mHu917E26IogZ2930nFyBQdofk10Udg=
+github.com/tidwall/btree v1.6.0 h1:LDZfKfQIBHGHWSwckhXI0RPSXzlo+KYdjK7FWSqOzzg=
+github.com/tidwall/btree v1.6.0/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EUQ2cKY=
github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
-github.com/ttacon/chalk v0.0.0-20160626202418-22c06c80ed31/go.mod h1:onvgF043R+lC5RZ8IT9rBXDaEDnpnw/Cl+HFiw+v/7Q=
github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM=
-github.com/tyler-smith/go-bip39 v1.0.1-0.20181017060643-dbb3b84ba2ef/go.mod h1:sJ5fKU0s6JVwZjjcUEX2zFOnvq0ASQ2K9Zr6cf67kNs=
-github.com/tyler-smith/go-bip39 v1.0.2/go.mod h1:sJ5fKU0s6JVwZjjcUEX2zFOnvq0ASQ2K9Zr6cf67kNs=
-github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo=
-github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw=
+github.com/ugorji/go v1.2.7 h1:qYhyWUUd6WbiM+C6JZAUkIJt/1WrjzNHY9+KCIjVqTo=
+github.com/ugorji/go v1.2.7/go.mod h1:nF9osbDWLy6bDVv/Rtoh6QgnvNDpmCalQV5urGCCS6M=
github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0=
-github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY=
github.com/ugorji/go/codec v1.2.7 h1:YPXUKf7fYbp/y8xloBqZOw2qaVggbfwMlI8WM3wZUJ0=
+github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY=
+github.com/ulikunitz/xz v0.5.10/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
+github.com/ulikunitz/xz v0.5.11 h1:kpFauv27b6ynzBNT/Xy+1k+fK4WswhN/6PN5WhFAGw8=
+github.com/ulikunitz/xz v0.5.11/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
-github.com/urfave/negroni v1.0.0/go.mod h1:Meg73S6kFm/4PpbYdq35yYWoCZ9mS/YSx+lKnmiohz4=
-github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
-github.com/valyala/fasthttp v1.6.0/go.mod h1:FstJa9V+Pj9vQ7OJie2qMHdwemEDaDiSdBnvPM1Su9w=
-github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8=
-github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
-github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a/go.mod h1:v3UYOV9WzVtRmSR+PDvWpU/qWl4Wa5LApYYX4ZtKbio=
-github.com/vmihailenco/msgpack/v5 v5.1.4/go.mod h1:C5gboKD0TJPqWDTVTtrQNfRbiBwHZGo8UTqP/9/XvLI=
-github.com/vmihailenco/tagparser v0.1.2/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI=
-github.com/wsddn/go-ecdh v0.0.0-20161211032359-48726bab9208/go.mod h1:IotVbo4F+mw0EzQ08zFqg7pK3FebNXpaMsRy2RT+Ees=
-github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=
-github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ=
-github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y=
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
-github.com/yalp/jsonpath v0.0.0-20180802001716-5cc68e5049a0/go.mod h1:/LWChgwKmvncFJFHJ7Gvn9wZArjbV5/FppcK2fKk/tI=
-github.com/ybbus/jsonrpc v2.1.2+incompatible/go.mod h1:XJrh1eMSzdIYFbM08flv0wp5G35eRniyeGut1z+LSiE=
-github.com/yudai/gojsondiff v1.0.0/go.mod h1:AY32+k2cwILAkW1fbgxQ5mUmMiZFgLIV+FBNExI05xg=
-github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82/go.mod h1:lgjkn3NuSvDfVJdfcVVdX+jpBxNmX4rDAzaS45IcYoM=
-github.com/yudai/pp v2.0.1+incompatible/go.mod h1:PuxR/8QJ7cyCkFp/aUDS+JY727OFEZkTdatxwunjIkc=
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
+github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
github.com/zondax/hid v0.9.1 h1:gQe66rtmyZ8VeGFcOpbuH3r7erYtNEAezCAYu8LdkJo=
github.com/zondax/hid v0.9.1/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM=
github.com/zondax/ledger-go v0.14.1 h1:Pip65OOl4iJ84WTpA4BKChvOufMhhbxED3BaihoZN4c=
github.com/zondax/ledger-go v0.14.1/go.mod h1:fZ3Dqg6qcdXWSOJFKMG8GCTnD7slO/RL2feOQv8K320=
go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
-go.etcd.io/bbolt v1.3.6 h1:/ecaJf0sk1l4l6V4awd65v2C3ILy7MSj+s/x1ADCIMU=
-go.etcd.io/bbolt v1.3.6/go.mod h1:qXsaaIqmgQH0T+OPdb99Bf+PKfBBQVAdyD6TY9G8XM4=
+go.etcd.io/bbolt v1.3.7 h1:j+zJOnnEjF/kyHlDDgGnVL/AIqIJPq8UoB2GSNfkUfQ=
+go.etcd.io/bbolt v1.3.7/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw=
go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg=
go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk=
go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk=
@@ -961,6 +968,10 @@ go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk=
+go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E=
+go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0=
+go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo=
+go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI=
go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
@@ -969,37 +980,26 @@ go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+
go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA=
go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM=
-golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
-golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
-golang.org/x/crypto v0.0.0-20190909091759-094676da4a83/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
-golang.org/x/crypto v0.0.0-20191227163750-53104e6ec876/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
-golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
-golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
-golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
-golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
+golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
-golang.org/x/crypto v0.5.0 h1:U/0M97KRkSFvyD/3FSmdP5W5swImpNgle/EHFhOsQPE=
-golang.org/x/crypto v0.5.0/go.mod h1:NK/OQwhpMQP3MwtdjgLlYHnH9ebylxKWv3e0fK+mkQU=
-golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
-golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
+golang.org/x/crypto v0.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A=
+golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
-golang.org/x/exp v0.0.0-20190125153040-c74c464bbbf2/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
-golang.org/x/exp v0.0.0-20190731235908-ec7cb31e5a56/go.mod h1:JhuoJpWY28nO4Vef9tZUw9qufEGTyX1+7lmHxV5q5G4=
golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek=
golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY=
golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
@@ -1008,12 +1008,11 @@ golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u0
golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU=
golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw=
-golang.org/x/exp v0.0.0-20200513190911-00229845015e/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw=
-golang.org/x/exp v0.0.0-20230131160201-f062dba9d201 h1:BEABXpNXLEz0WxtA+6CQIz2xkg80e+1zrhWyMcq8VzE=
-golang.org/x/exp v0.0.0-20230131160201-f062dba9d201/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc=
-golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs=
+golang.org/x/exp v0.0.0-20230310171629-522b1b587ee0 h1:LGJsf5LRplCck6jUCH3dBL2dmycNruWNF5xugkSlfXw=
+golang.org/x/exp v0.0.0-20230310171629-522b1b587ee0/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc=
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
+golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
@@ -1027,22 +1026,20 @@ golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPI
golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE=
golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o=
-golang.org/x/mobile v0.0.0-20200801112145-973feb4309de/go.mod h1:skQtrUTUwhdJvXM/2KKJzY8pDgNr9I/FOMqDVRPBUS4=
golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY=
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
-golang.org/x/mod v0.1.1-0.20191209134235-331c550502dd/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
+golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.8.0 h1:LUYupSeNrTNCGzR/hVBk2NHZO4hXcVaW1k4Qx7rjPx8=
-golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
-golang.org/x/net v0.0.0-20181011144130-49bb7cea24b1/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
@@ -1051,7 +1048,6 @@ golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73r
golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
-golang.org/x/net v0.0.0-20190327091125-710a502c58a2/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
@@ -1061,7 +1057,6 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL
golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
-golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
@@ -1079,19 +1074,31 @@ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81R
golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
-golang.org/x/net v0.0.0-20200904194848-62affa334b73/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
+golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
+golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
+golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc=
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
-golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
-golang.org/x/net v0.0.0-20211008194852-3b03d305991f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
+golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
+golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
-golang.org/x/net v0.6.0 h1:L4ZwwTvKW9gr0ZMS1yrHD9GZhIuVjOBBnaKH+SPQK0Q=
-golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
+golang.org/x/net v0.0.0-20220325170049-de3da57026de/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
+golang.org/x/net v0.0.0-20220412020605-290c469a71a5/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
+golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
+golang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
+golang.org/x/net v0.0.0-20220617184016-355a448f1bc9/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
+golang.org/x/net v0.0.0-20220624214902-1bab6f366d9e/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
+golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
+golang.org/x/net v0.0.0-20220909164309-bea034e7d591/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk=
+golang.org/x/net v0.0.0-20221014081412-f15817d10f9b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk=
+golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco=
+golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ=
+golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
@@ -1101,8 +1108,24 @@ golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ
golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
+golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
+golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
+golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
+golang.org/x/oauth2 v0.0.0-20210805134026-6f1e6394065a/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
+golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
+golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc=
+golang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc=
+golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc=
+golang.org/x/oauth2 v0.0.0-20220608161450-d0670ef3b1eb/go.mod h1:jaDAt6Dkxork7LmZnYtzbRWj0W47D86a3TGe0YHBvmE=
+golang.org/x/oauth2 v0.0.0-20220622183110-fd043fe589d2/go.mod h1:jaDAt6Dkxork7LmZnYtzbRWj0W47D86a3TGe0YHBvmE=
+golang.org/x/oauth2 v0.0.0-20220822191816-0ebed06d0094/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg=
+golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg=
+golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg=
+golang.org/x/oauth2 v0.1.0/go.mod h1:G9FE4dLTsbXUu90h/Pf85g4w1D+SSAgR+q46nJZ8M4A=
+golang.org/x/oauth2 v0.5.0 h1:HuArIo48skDwlrvM3sEdHXElYslAMsf3KwRkkW4MC4s=
+golang.org/x/oauth2 v0.5.0/go.mod h1:9/XBHVqLaWO3/BRHs5jbpYCnOZVjj5V0ndyaAM7KB4I=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@@ -1114,8 +1137,11 @@ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
-golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o=
+golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
@@ -1125,7 +1151,6 @@ golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5h
golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190130150945-aca44879d564/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
-golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
@@ -1135,7 +1160,6 @@ golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
@@ -1147,7 +1171,6 @@ golang.org/x/sys v0.0.0-20191220142924-d4481acd189f/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
@@ -1165,40 +1188,60 @@ golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.0.0-20200824131525-c12d262b63d8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.0.0-20200909081042-eff7692f9009/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.0.0-20200923182605-d9f96fdee20d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
-golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20210603125802-9665404d3644/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210819135213-f52c844e1c1c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
-golang.org/x/sys v0.0.0-20210909193231-528a39cd75f3/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
-golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
-golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20210908233432-aa78b53d3365/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
-golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20220310020820-b874c991c1a5/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20220315194320-039c03cc5b86/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20220328115105-d36c6a25d886/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20220502124256-b6088ccd6cba/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20220610221304-9f5ed59c137d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20220615213510-4f61da869c0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20220624220833-87e55d714810/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
-golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU=
-golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ=
+golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
-golang.org/x/term v0.5.0 h1:n2a8QNdAb0sZNpU9R1ALUXBbY+w51fCQDN+7EdxNBsY=
-golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
+golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
+golang.org/x/term v0.6.0 h1:clScbb1cHjoCkyRbWwBEUZ5H/tIFu5TAXIqaZD0Gcjw=
+golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
@@ -1208,22 +1251,22 @@ golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
-golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo=
-golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
+golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
+golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68=
+golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
-golang.org/x/time v0.0.0-20201208040808-7e3f01d25324/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
-golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
+golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
+golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
-golang.org/x/tools v0.0.0-20181221001348-537d06c36207/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
-golang.org/x/tools v0.0.0-20190206041539-40960b6deb8e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
+golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
+golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
-golang.org/x/tools v0.0.0-20190327201419-c70d86f8b7cf/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
@@ -1244,7 +1287,6 @@ golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtn
golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
-golang.org/x/tools v0.0.0-20200117012304-6edc0a871e69/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
@@ -1265,7 +1307,6 @@ golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc
golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE=
-golang.org/x/tools v0.0.0-20201022035929-9cf592e881e9/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
@@ -1273,18 +1314,22 @@ golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4f
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
+golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
+golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
+golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
+golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
+golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8=
+golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8=
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk=
-gonum.org/v1/gonum v0.0.0-20180816165407-929014505bf4/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo=
-gonum.org/v1/gonum v0.8.2 h1:CCXrcPKiGGotvnN6jfUsKk4rRqm7q09/YbKb5xCEvtM=
-gonum.org/v1/gonum v0.8.2/go.mod h1:oe/vMfY3deqTw+1EZJhuvEW2iwGF1bW9wwu7XCu0+v0=
-gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw=
-gonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b/go.mod h1:Wt8AAjI+ypCyYX3nZBvf6cAIx93T+c/OS2HFAYskSZc=
+golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8=
google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk=
google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=
google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M=
@@ -1305,14 +1350,46 @@ google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz513
google.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg=
google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE=
google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8=
+google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBzRTU=
+google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94=
+google.golang.org/api v0.47.0/go.mod h1:Wbvgpq1HddcWVtzsVLyfLp8lDg6AA241LmgIL59tHXo=
+google.golang.org/api v0.48.0/go.mod h1:71Pr1vy+TAZRPkPs/xlCf5SsU8WjuAWv1Pfjbtukyy4=
+google.golang.org/api v0.50.0/go.mod h1:4bNT5pAuq5ji4SRZm+5QIkjny9JAyVD/3gaSihNefaw=
+google.golang.org/api v0.51.0/go.mod h1:t4HdrdoNgyN5cbEfm7Lum0lcLDLiise1F8qDKX00sOU=
+google.golang.org/api v0.54.0/go.mod h1:7C4bFFOvVDGXjfDTAsgGwDgAxRDeQ4X8NvUedIt6z3k=
+google.golang.org/api v0.55.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE=
+google.golang.org/api v0.56.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE=
+google.golang.org/api v0.57.0/go.mod h1:dVPlbZyBo2/OjBpmvNdpn2GRm6rPy75jyU7bmhdrMgI=
+google.golang.org/api v0.61.0/go.mod h1:xQRti5UdCmoCEqFxcz93fTl338AVqDgyaDRuOZ3hg9I=
+google.golang.org/api v0.63.0/go.mod h1:gs4ij2ffTRXwuzzgJl/56BdwJaA194ijkfn++9tDuPo=
+google.golang.org/api v0.67.0/go.mod h1:ShHKP8E60yPsKNw/w8w+VYaj9H6buA5UqDp8dhbQZ6g=
+google.golang.org/api v0.70.0/go.mod h1:Bs4ZM2HGifEvXwd50TtW70ovgJffJYw2oRCOFU/SkfA=
+google.golang.org/api v0.71.0/go.mod h1:4PyU6e6JogV1f9eA4voyrTY2batOLdgZ5qZ5HOCc4j8=
+google.golang.org/api v0.74.0/go.mod h1:ZpfMZOVRMywNyvJFeqL9HRWBgAuRfSjJFpe9QtRRyDs=
+google.golang.org/api v0.75.0/go.mod h1:pU9QmyHLnzlpar1Mjt4IbapUCy8J+6HD6GeELN69ljA=
+google.golang.org/api v0.77.0/go.mod h1:pU9QmyHLnzlpar1Mjt4IbapUCy8J+6HD6GeELN69ljA=
+google.golang.org/api v0.78.0/go.mod h1:1Sg78yoMLOhlQTeF+ARBoytAcH1NNyyl390YMy6rKmw=
+google.golang.org/api v0.80.0/go.mod h1:xY3nI94gbvBrE0J6NHXhxOmW97HG7Khjkku6AFB3Hyg=
+google.golang.org/api v0.84.0/go.mod h1:NTsGnUFJMYROtiquksZHBWtHfeMC7iYthki7Eq3pa8o=
+google.golang.org/api v0.85.0/go.mod h1:AqZf8Ep9uZ2pyTvgL+x0D3Zt0eoT9b5E8fmzfu6FO2g=
+google.golang.org/api v0.90.0/go.mod h1:+Sem1dnrKlrXMR/X0bPnMWyluQe4RsNoYfmNLhOIkzw=
+google.golang.org/api v0.93.0/go.mod h1:+Sem1dnrKlrXMR/X0bPnMWyluQe4RsNoYfmNLhOIkzw=
+google.golang.org/api v0.95.0/go.mod h1:eADj+UBuxkh5zlrSntJghuNeg8HwQ1w5lTKkuqaETEI=
+google.golang.org/api v0.96.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s=
+google.golang.org/api v0.97.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s=
+google.golang.org/api v0.98.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s=
+google.golang.org/api v0.100.0/go.mod h1:ZE3Z2+ZOr87Rx7dqFsdRQkRBk36kDtp/h+QpHbB7a70=
+google.golang.org/api v0.110.0 h1:l+rh0KYUooe9JGbGVx71tbFo4SMbMTXK3I3ia2QSEeU=
+google.golang.org/api v0.110.0/go.mod h1:7FC4Vvx1Mooxh8C5HWjzZHcavuS2f6pmJpZx60ca7iI=
+google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0=
google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
+google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c=
google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
-google.golang.org/genproto v0.0.0-20180518175338-11a468237815/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
@@ -1335,7 +1412,6 @@ google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfG
google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
-google.golang.org/genproto v0.0.0-20200324203455-a04cca1dde73/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
@@ -1354,12 +1430,120 @@ google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6D
google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20210126160654-44e461bb6506/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
+google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
+google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
+google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
+google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
+google.golang.org/genproto v0.0.0-20210329143202-679c6ae281ee/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A=
+google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A=
+google.golang.org/genproto v0.0.0-20210513213006-bf773b8c8384/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A=
+google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0=
+google.golang.org/genproto v0.0.0-20210604141403-392c879c8b08/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0=
+google.golang.org/genproto v0.0.0-20210608205507-b6d2f5bf0d7d/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0=
google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24=
-google.golang.org/genproto v0.0.0-20230125152338-dcaf20b6aeaa h1:qQPhfbPO23fwm/9lQr91L1u62Zo6cm+zI+slZT+uf+o=
-google.golang.org/genproto v0.0.0-20230125152338-dcaf20b6aeaa/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM=
-google.golang.org/grpc v1.33.2 h1:EQyQC3sa8M+p6Ulc8yy9SWSS2GVwyRc83gAbG8lrl4o=
+google.golang.org/genproto v0.0.0-20210713002101-d411969a0d9a/go.mod h1:AxrInvYm1dci+enl5hChSFPOmmUF1+uAa/UsgNRWd7k=
+google.golang.org/genproto v0.0.0-20210716133855-ce7ef5c701ea/go.mod h1:AxrInvYm1dci+enl5hChSFPOmmUF1+uAa/UsgNRWd7k=
+google.golang.org/genproto v0.0.0-20210728212813-7823e685a01f/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48=
+google.golang.org/genproto v0.0.0-20210805201207-89edb61ffb67/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48=
+google.golang.org/genproto v0.0.0-20210813162853-db860fec028c/go.mod h1:cFeNkxwySK631ADgubI+/XFU/xp8FD5KIVV4rj8UC5w=
+google.golang.org/genproto v0.0.0-20210821163610-241b8fcbd6c8/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY=
+google.golang.org/genproto v0.0.0-20210828152312-66f60bf46e71/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY=
+google.golang.org/genproto v0.0.0-20210831024726-fe130286e0e2/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY=
+google.golang.org/genproto v0.0.0-20210903162649-d08c68adba83/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY=
+google.golang.org/genproto v0.0.0-20210909211513-a8c4777a87af/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY=
+google.golang.org/genproto v0.0.0-20210924002016-3dee208752a0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
+google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
+google.golang.org/genproto v0.0.0-20211206160659-862468c7d6e0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
+google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
+google.golang.org/genproto v0.0.0-20211221195035-429b39de9b1c/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
+google.golang.org/genproto v0.0.0-20220126215142-9970aeb2e350/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
+google.golang.org/genproto v0.0.0-20220207164111-0872dc986b00/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
+google.golang.org/genproto v0.0.0-20220218161850-94dd64e39d7c/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI=
+google.golang.org/genproto v0.0.0-20220222213610-43724f9ea8cf/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI=
+google.golang.org/genproto v0.0.0-20220304144024-325a89244dc8/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI=
+google.golang.org/genproto v0.0.0-20220310185008-1973136f34c6/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI=
+google.golang.org/genproto v0.0.0-20220314164441-57ef72a4c106/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E=
+google.golang.org/genproto v0.0.0-20220324131243-acbaeb5b85eb/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E=
+google.golang.org/genproto v0.0.0-20220407144326-9054f6ed7bac/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo=
+google.golang.org/genproto v0.0.0-20220413183235-5e96e2839df9/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo=
+google.golang.org/genproto v0.0.0-20220414192740-2d67ff6cf2b4/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo=
+google.golang.org/genproto v0.0.0-20220421151946-72621c1f0bd3/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo=
+google.golang.org/genproto v0.0.0-20220429170224-98d788798c3e/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo=
+google.golang.org/genproto v0.0.0-20220502173005-c8bf987b8c21/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4=
+google.golang.org/genproto v0.0.0-20220505152158-f39f71e6c8f3/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4=
+google.golang.org/genproto v0.0.0-20220518221133-4f43b3371335/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4=
+google.golang.org/genproto v0.0.0-20220523171625-347a074981d8/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4=
+google.golang.org/genproto v0.0.0-20220608133413-ed9918b62aac/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA=
+google.golang.org/genproto v0.0.0-20220616135557-88e70c0c3a90/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA=
+google.golang.org/genproto v0.0.0-20220617124728-180714bec0ad/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA=
+google.golang.org/genproto v0.0.0-20220624142145-8cd45d7dbd1f/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA=
+google.golang.org/genproto v0.0.0-20220628213854-d9e0b6570c03/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA=
+google.golang.org/genproto v0.0.0-20220722212130-b98a9ff5e252/go.mod h1:GkXuJDJ6aQ7lnJcRF+SJVgFdQhypqgl3LB1C9vabdRE=
+google.golang.org/genproto v0.0.0-20220801145646-83ce21fca29f/go.mod h1:iHe1svFLAZg9VWz891+QbRMwUv9O/1Ww+/mngYeThbc=
+google.golang.org/genproto v0.0.0-20220815135757-37a418bb8959/go.mod h1:dbqgFATTzChvnt+ujMdZwITVAJHFtfyN1qUhDqEiIlk=
+google.golang.org/genproto v0.0.0-20220817144833-d7fd3f11b9b1/go.mod h1:dbqgFATTzChvnt+ujMdZwITVAJHFtfyN1qUhDqEiIlk=
+google.golang.org/genproto v0.0.0-20220822174746-9e6da59bd2fc/go.mod h1:dbqgFATTzChvnt+ujMdZwITVAJHFtfyN1qUhDqEiIlk=
+google.golang.org/genproto v0.0.0-20220829144015-23454907ede3/go.mod h1:dbqgFATTzChvnt+ujMdZwITVAJHFtfyN1qUhDqEiIlk=
+google.golang.org/genproto v0.0.0-20220829175752-36a9c930ecbf/go.mod h1:dbqgFATTzChvnt+ujMdZwITVAJHFtfyN1qUhDqEiIlk=
+google.golang.org/genproto v0.0.0-20220913154956-18f8339a66a5/go.mod h1:0Nb8Qy+Sk5eDzHnzlStwW3itdNaWoZA5XeSG+R3JHSo=
+google.golang.org/genproto v0.0.0-20220914142337-ca0e39ece12f/go.mod h1:0Nb8Qy+Sk5eDzHnzlStwW3itdNaWoZA5XeSG+R3JHSo=
+google.golang.org/genproto v0.0.0-20220915135415-7fd63a7952de/go.mod h1:0Nb8Qy+Sk5eDzHnzlStwW3itdNaWoZA5XeSG+R3JHSo=
+google.golang.org/genproto v0.0.0-20220916172020-2692e8806bfa/go.mod h1:0Nb8Qy+Sk5eDzHnzlStwW3itdNaWoZA5XeSG+R3JHSo=
+google.golang.org/genproto v0.0.0-20220919141832-68c03719ef51/go.mod h1:0Nb8Qy+Sk5eDzHnzlStwW3itdNaWoZA5XeSG+R3JHSo=
+google.golang.org/genproto v0.0.0-20220920201722-2b89144ce006/go.mod h1:ht8XFiar2npT/g4vkk7O0WYS1sHOHbdujxbEp7CJWbw=
+google.golang.org/genproto v0.0.0-20220926165614-551eb538f295/go.mod h1:woMGP53BroOrRY3xTxlbr8Y3eB/nzAvvFM83q7kG2OI=
+google.golang.org/genproto v0.0.0-20220926220553-6981cbe3cfce/go.mod h1:woMGP53BroOrRY3xTxlbr8Y3eB/nzAvvFM83q7kG2OI=
+google.golang.org/genproto v0.0.0-20221010155953-15ba04fc1c0e/go.mod h1:3526vdqwhZAwq4wsRUaVG555sVgsNmIjRtO7t/JH29U=
+google.golang.org/genproto v0.0.0-20221014173430-6e2ab493f96b/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM=
+google.golang.org/genproto v0.0.0-20221014213838-99cd37c6964a/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM=
+google.golang.org/genproto v0.0.0-20221025140454-527a21cfbd71/go.mod h1:9qHF0xnpdSfF6knlcsnpzUu5y+rpwgbvsyGAZPBMg4s=
+google.golang.org/genproto v0.0.0-20230216225411-c8e22ba71e44 h1:EfLuoKW5WfkgVdDy7dTK8qSbH37AX5mj/MFh+bGPz14=
+google.golang.org/genproto v0.0.0-20230216225411-c8e22ba71e44/go.mod h1:8B0gmkoRebU8ukX6HP+4wrVQUY1+6PkQ44BSyIlflHA=
+google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs=
+google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
+google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM=
+google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
+google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
+google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
+google.golang.org/grpc v1.22.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
+google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
+google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
+google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
+google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
+google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
+google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
+google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60=
+google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk=
+google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
+google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
+google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
+google.golang.org/grpc v1.32.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
+google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0=
google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc=
+google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8=
+google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=
+google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=
+google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=
+google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM=
+google.golang.org/grpc v1.37.1/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM=
+google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM=
+google.golang.org/grpc v1.39.0/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE=
+google.golang.org/grpc v1.39.1/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE=
+google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34=
+google.golang.org/grpc v1.40.1/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34=
+google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU=
+google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ=
+google.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk=
+google.golang.org/grpc v1.46.2/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk=
+google.golang.org/grpc v1.47.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk=
+google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk=
+google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI=
+google.golang.org/grpc v1.50.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI=
+google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI=
+google.golang.org/grpc v1.53.0 h1:LAv2ds7cmFV/XTS3XG1NneeENYrXGmorPxsBbptIjNc=
+google.golang.org/grpc v1.53.0/go.mod h1:OnIrk0ipVdj4N5d9IUoFUx72/VlD7+jUsHwZgwSMQpw=
+google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
@@ -1372,29 +1556,28 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
-google.golang.org/protobuf v1.28.2-0.20220831092852-f930b1dc76e8 h1:KR8+MyP7/qOlV+8Af01LtjL04bu7on42eVsxT4EyBQk=
-google.golang.org/protobuf v1.28.2-0.20220831092852-f930b1dc76e8/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
+google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
+google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
+google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
+google.golang.org/protobuf v1.29.1 h1:7QBf+IK2gx70Ap/hDsOmam3GE0v9HicjfEdAxE62UoM=
+google.golang.org/protobuf v1.29.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
-gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
+gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw=
+gopkg.in/cheggaaa/pb.v1 v1.0.27/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw=
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
gopkg.in/gcfg.v1 v1.2.3/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o=
-gopkg.in/ini.v1 v1.51.1/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA=
gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
-gopkg.in/mgo.v2 v2.0.0-20180705113604-9856a29383ce/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA=
-gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce/go.mod h1:5AcXVHNjg+BDxry382+8OKon8SEWiKktQR07RKPsv1c=
-gopkg.in/olebedev/go-duktape.v3 v3.0.0-20200619000410-60c24ae608a6/go.mod h1:uAJfkITjFhyEEuUfm7bsmCZRbW5WRq8s9EY8HZ6hCns=
gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
-gopkg.in/urfave/cli.v1 v1.20.0/go.mod h1:vuBzUtMdQeixQj8LVd+/98pzhxNGQoyuPBlsXHOQNO0=
gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI=
gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
@@ -1406,14 +1589,13 @@ gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
-gopkg.in/yaml.v3 v3.0.0-20191120175047-4206685974f2/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo=
-gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw=
gotest.tools/v3 v3.4.0 h1:ZazjZUfuVeZGLAmlKKuyv3IKP5orXcwtOwDQH6YVr6o=
+honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
@@ -1424,9 +1606,11 @@ honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9
nhooyr.io/websocket v1.8.6 h1:s+C3xAMLwGmlI31Nyn/eAehUlZPwfYZu2JXM621Q5/k=
nhooyr.io/websocket v1.8.6/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0=
pgregory.net/rapid v0.5.5 h1:jkgx1TjbQPD/feRoK+S/mXw9e1uj6WilpHrXJowi6oA=
+pgregory.net/rapid v0.5.5/go.mod h1:PY5XlDGj0+V1FCq0o192FdRhpKHGTRIWBgqjDBTrq04=
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
-rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
+sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo=
+sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8=
sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU=
diff --git a/proto/buf.lock b/proto/buf.lock
index 3d4ba2f161..9de2779cfe 100644
--- a/proto/buf.lock
+++ b/proto/buf.lock
@@ -8,12 +8,12 @@ deps:
- remote: buf.build
owner: cosmos
repository: cosmos-sdk
- commit: 8cb30a2c4de74dc9bd8d260b1e75e176
+ commit: 954f7b05f38440fc8250134b15adec47
- remote: buf.build
owner: cosmos
repository: gogo-proto
- commit: 6652e3443c3b4504bb3bf82e73a7e409
+ commit: 34d970b699f84aa382f3c29773a60836
- remote: buf.build
owner: googleapis
repository: googleapis
- commit: 8d7204855ec14631a499bd7393ce1970
+ commit: 75b4300737fb4efca0831636be94e517
diff --git a/proto/buf.yaml b/proto/buf.yaml
index 9c12bd28b7..31b2fcf669 100644
--- a/proto/buf.yaml
+++ b/proto/buf.yaml
@@ -1,13 +1,8 @@
-# Generated by "buf config migrate-v1beta1". Edit as necessary, and
-# remove this comment when you're finished.
-#
-# This module represents the "proto" root found in
-# the previous configuration.
version: v1
name: buf.build/cosmwasm/wasmd
deps:
- buf.build/cosmos/cosmos-proto
- - buf.build/cosmos/cosmos-sdk:8cb30a2c4de74dc9bd8d260b1e75e176 #v0.46.x
+ - buf.build/cosmos/cosmos-sdk:v0.47.0
- buf.build/cosmos/gogo-proto
breaking:
use:
diff --git a/proto/cosmwasm/wasm/v1/query.proto b/proto/cosmwasm/wasm/v1/query.proto
index ffe48d2429..bc94f84087 100644
--- a/proto/cosmwasm/wasm/v1/query.proto
+++ b/proto/cosmwasm/wasm/v1/query.proto
@@ -192,7 +192,7 @@ message CodeInfoResponse {
string creator = 2;
bytes data_hash = 3
[ (gogoproto.casttype) =
- "github.com/tendermint/tendermint/libs/bytes.HexBytes" ];
+ "github.com/cometbft/cometbft/libs/bytes.HexBytes" ];
// Used in v1beta1
reserved 4, 5;
AccessConfig instantiate_permission = 6 [ (gogoproto.nullable) = false ];
@@ -229,8 +229,7 @@ message QueryPinnedCodesRequest {
// QueryPinnedCodesResponse is the response type for the
// Query/PinnedCodes RPC method
message QueryPinnedCodesResponse {
- repeated uint64 code_ids = 1
- [ (gogoproto.nullable) = false, (gogoproto.customname) = "CodeIDs" ];
+ repeated uint64 code_ids = 1 [ (gogoproto.customname) = "CodeIDs" ];
// pagination defines the pagination in the response.
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}
diff --git a/proto/cosmwasm/wasm/v1/tx.proto b/proto/cosmwasm/wasm/v1/tx.proto
index 741fbc494c..5b86535a21 100644
--- a/proto/cosmwasm/wasm/v1/tx.proto
+++ b/proto/cosmwasm/wasm/v1/tx.proto
@@ -2,8 +2,10 @@ syntax = "proto3";
package cosmwasm.wasm.v1;
import "cosmos/base/v1beta1/coin.proto";
+import "cosmos/msg/v1/msg.proto";
import "gogoproto/gogo.proto";
import "cosmwasm/wasm/v1/types.proto";
+import "cosmos_proto/cosmos.proto";
option go_package = "github.com/CosmWasm/wasmd/x/wasm/types";
option (gogoproto.goproto_getters_all) = false;
@@ -31,10 +33,17 @@ service Msg {
// UpdateInstantiateConfig updates instantiate config for a smart contract
rpc UpdateInstantiateConfig(MsgUpdateInstantiateConfig)
returns (MsgUpdateInstantiateConfigResponse);
+ // UpdateParams defines a governance operation for updating the x/wasm
+ // module parameters. The authority is defined in the keeper.
+ //
+ // Since: 0.40
+ rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse);
}
// MsgStoreCode submit Wasm code to the system
message MsgStoreCode {
+ option (cosmos.msg.v1.signer) = "sender";
+
// Sender is the actor that signed the messages
string sender = 1;
// WASMByteCode can be raw or gzip compressed
@@ -56,6 +65,8 @@ message MsgStoreCodeResponse {
// MsgInstantiateContract create a new smart contract instance for the given
// code id.
message MsgInstantiateContract {
+ option (cosmos.msg.v1.signer) = "sender";
+
// Sender is the that actor that signed the messages
string sender = 1;
// Admin is an optional address that can execute migrations
@@ -76,6 +87,8 @@ message MsgInstantiateContract {
// MsgInstantiateContract2 create a new smart contract instance for the given
// code id with a predicable address.
message MsgInstantiateContract2 {
+ option (cosmos.msg.v1.signer) = "sender";
+
// Sender is the that actor that signed the messages
string sender = 1;
// Admin is an optional address that can execute migrations
@@ -116,6 +129,8 @@ message MsgInstantiateContract2Response {
// MsgExecuteContract submits the given message data to a smart contract
message MsgExecuteContract {
+ option (cosmos.msg.v1.signer) = "sender";
+
// Sender is the that actor that signed the messages
string sender = 1;
// Contract is the address of the smart contract
@@ -137,6 +152,8 @@ message MsgExecuteContractResponse {
// MsgMigrateContract runs a code upgrade/ downgrade for a smart contract
message MsgMigrateContract {
+ option (cosmos.msg.v1.signer) = "sender";
+
// Sender is the that actor that signed the messages
string sender = 1;
// Contract is the address of the smart contract
@@ -156,6 +173,8 @@ message MsgMigrateContractResponse {
// MsgUpdateAdmin sets a new admin for a smart contract
message MsgUpdateAdmin {
+ option (cosmos.msg.v1.signer) = "sender";
+
// Sender is the that actor that signed the messages
string sender = 1;
// NewAdmin address to be set
@@ -169,6 +188,8 @@ message MsgUpdateAdminResponse {}
// MsgClearAdmin removes any admin stored for a smart contract
message MsgClearAdmin {
+ option (cosmos.msg.v1.signer) = "sender";
+
// Sender is the actor that signed the messages
string sender = 1;
// Contract is the address of the smart contract
@@ -180,6 +201,8 @@ message MsgClearAdminResponse {}
// MsgUpdateInstantiateConfig updates instantiate config for a smart contract
message MsgUpdateInstantiateConfig {
+ option (cosmos.msg.v1.signer) = "sender";
+
// Sender is the that actor that signed the messages
string sender = 1;
// CodeID references the stored WASM code
@@ -189,4 +212,25 @@ message MsgUpdateInstantiateConfig {
}
// MsgUpdateInstantiateConfigResponse returns empty data
-message MsgUpdateInstantiateConfigResponse {}
\ No newline at end of file
+message MsgUpdateInstantiateConfigResponse {}
+
+// MsgUpdateParams is the Msg/UpdateParams request type.
+//
+// Since: 0.40
+message MsgUpdateParams {
+ option (cosmos.msg.v1.signer) = "authority";
+
+ // authority is the address of the governance account.
+ string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
+
+ // params defines the x/wasm parameters to update.
+ //
+ // NOTE: All parameters must be supplied.
+ Params params = 2 [ (gogoproto.nullable) = false ];
+}
+
+// MsgUpdateParamsResponse defines the response structure for executing a
+// MsgUpdateParams message.
+//
+// Since: 0.40
+message MsgUpdateParamsResponse {}
\ No newline at end of file
diff --git a/proto/cosmwasm/wasm/v1/types.proto b/proto/cosmwasm/wasm/v1/types.proto
index b68179e2e0..c29617cefd 100644
--- a/proto/cosmwasm/wasm/v1/types.proto
+++ b/proto/cosmwasm/wasm/v1/types.proto
@@ -139,7 +139,7 @@ message AbsoluteTxPosition {
message Model {
// hex-encode key to read it better (this is often ascii)
bytes key = 1 [ (gogoproto.casttype) =
- "github.com/tendermint/tendermint/libs/bytes.HexBytes" ];
+ "github.com/cometbft/cometbft/libs/bytes.HexBytes" ];
// base64-encode raw value
bytes value = 2;
}
diff --git a/tests/e2e/gov_test.go b/tests/e2e/gov_test.go
new file mode 100644
index 0000000000..5ce967da24
--- /dev/null
+++ b/tests/e2e/gov_test.go
@@ -0,0 +1,135 @@
+package e2e_test
+
+import (
+ "testing"
+ "time"
+
+ wasmvmtypes "github.com/CosmWasm/wasmvm/types"
+ "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
+ sdk "github.com/cosmos/cosmos-sdk/types"
+ distributiontypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
+ v1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
+ "github.com/stretchr/testify/assert"
+ "github.com/stretchr/testify/require"
+
+ "github.com/CosmWasm/wasmd/tests/e2e"
+ "github.com/CosmWasm/wasmd/x/wasm/ibctesting"
+)
+
+func TestGovVoteByContract(t *testing.T) {
+ // Given a contract with delegation
+ // And a gov proposal
+ // When the contract sends a vote for the proposal
+ // Then the vote is taken into account
+
+ coord := ibctesting.NewCoordinator(t, 1)
+ chain := coord.GetChain(ibctesting.GetChainID(1))
+ contractAddr := e2e.InstantiateReflectContract(t, chain)
+ chain.Fund(contractAddr, sdk.NewIntFromUint64(1_000_000_000))
+ // a contract with a high delegation amount
+ delegateMsg := wasmvmtypes.CosmosMsg{
+ Staking: &wasmvmtypes.StakingMsg{
+ Delegate: &wasmvmtypes.DelegateMsg{
+ Validator: sdk.ValAddress(chain.Vals.Validators[0].Address).String(),
+ Amount: wasmvmtypes.Coin{
+ Denom: sdk.DefaultBondDenom,
+ Amount: "1000000000",
+ },
+ },
+ },
+ }
+ e2e.MustExecViaReflectContract(t, chain, contractAddr, delegateMsg)
+
+ signer := chain.SenderAccount.GetAddress().String()
+ govKeeper, accountKeeper := chain.App.GovKeeper, chain.App.AccountKeeper
+ communityPoolBalance := chain.Balance(accountKeeper.GetModuleAccount(chain.GetContext(), distributiontypes.ModuleName).GetAddress(), sdk.DefaultBondDenom)
+ require.False(t, communityPoolBalance.IsZero())
+
+ initialDeposit := govKeeper.GetParams(chain.GetContext()).MinDeposit
+ govAcctAddr := govKeeper.GetGovernanceAccount(chain.GetContext()).GetAddress()
+
+ specs := map[string]struct {
+ vote *wasmvmtypes.VoteMsg
+ expPass bool
+ }{
+ "yes": {
+ vote: &wasmvmtypes.VoteMsg{
+ Vote: wasmvmtypes.Yes,
+ },
+ expPass: true,
+ },
+ "no": {
+ vote: &wasmvmtypes.VoteMsg{
+ Vote: wasmvmtypes.No,
+ },
+ expPass: false,
+ },
+ "abstain": {
+ vote: &wasmvmtypes.VoteMsg{
+ Vote: wasmvmtypes.Abstain,
+ },
+ expPass: true,
+ },
+ "no with veto": {
+ vote: &wasmvmtypes.VoteMsg{
+ Vote: wasmvmtypes.NoWithVeto,
+ },
+ expPass: false,
+ },
+ }
+ for name, spec := range specs {
+ t.Run(name, func(t *testing.T) {
+ // given a unique recipient
+ recipientAddr := sdk.AccAddress(secp256k1.GenPrivKey().PubKey().Address().Bytes())
+ // and a new proposal
+ payloadMsg := &distributiontypes.MsgCommunityPoolSpend{
+ Authority: govAcctAddr.String(),
+ Recipient: recipientAddr.String(),
+ Amount: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.OneInt())),
+ }
+ msg, err := v1.NewMsgSubmitProposal(
+ []sdk.Msg{payloadMsg},
+ initialDeposit,
+ signer,
+ "",
+ "my proposal",
+ "testing",
+ )
+ require.NoError(t, err)
+ rsp, gotErr := chain.SendMsgs(msg)
+ require.NoError(t, gotErr)
+ require.Len(t, rsp.MsgResponses, 1)
+ got, ok := rsp.MsgResponses[0].GetCachedValue().(*v1.MsgSubmitProposalResponse)
+ require.True(t, ok)
+ propID := got.ProposalId
+
+ // with other delegators voted yes
+ _, err = chain.SendMsgs(v1.NewMsgVote(chain.SenderAccount.GetAddress(), propID, v1.VoteOption_VOTE_OPTION_YES, ""))
+ require.NoError(t, err)
+
+ // when contract votes
+ spec.vote.ProposalId = propID
+ voteMsg := wasmvmtypes.CosmosMsg{
+ Gov: &wasmvmtypes.GovMsg{
+ Vote: spec.vote,
+ },
+ }
+ e2e.MustExecViaReflectContract(t, chain, contractAddr, voteMsg)
+
+ // then proposal executed after voting period
+ proposal, ok := govKeeper.GetProposal(chain.GetContext(), propID)
+ require.True(t, ok)
+ coord.IncrementTimeBy(proposal.VotingEndTime.Sub(chain.GetContext().BlockTime()) + time.Minute)
+ coord.CommitBlock(chain)
+
+ // and recipient balance updated
+ recipientBalance := chain.Balance(recipientAddr, sdk.DefaultBondDenom)
+ if !spec.expPass {
+ assert.True(t, recipientBalance.IsZero())
+ return
+ }
+ expBalanceAmount := sdk.NewCoin(sdk.DefaultBondDenom, sdk.OneInt())
+ assert.Equal(t, expBalanceAmount.String(), recipientBalance.String())
+ })
+ }
+}
diff --git a/tests/e2e/grants_test.go b/tests/e2e/grants_test.go
index 0920fa0a3d..2a6ed79357 100644
--- a/tests/e2e/grants_test.go
+++ b/tests/e2e/grants_test.go
@@ -5,6 +5,7 @@ import (
"testing"
"time"
+ errorsmod "cosmossdk.io/errors"
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
sdk "github.com/cosmos/cosmos-sdk/types"
@@ -13,6 +14,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
+ "github.com/CosmWasm/wasmd/tests/e2e"
"github.com/CosmWasm/wasmd/x/wasm/ibctesting"
"github.com/CosmWasm/wasmd/x/wasm/types"
)
@@ -26,9 +28,9 @@ func TestGrants(t *testing.T) {
// - balance A reduced (on success)
// - balance B not touched
- chain := ibctesting.NewCoordinator(t, 1).GetChain(ibctesting.GetChainID(0))
- codeID := chain.StoreCodeFile("../../x/wasm/keeper/testdata/reflect_1_1.wasm").CodeID
- contractAddr := chain.InstantiateContract(codeID, []byte(`{}`))
+ coord := ibctesting.NewCoordinator(t, 1)
+ chain := coord.GetChain(ibctesting.GetChainID(1))
+ contractAddr := e2e.InstantiateReflectContract(t, chain)
require.NotEmpty(t, contractAddr)
granterAddr := chain.SenderAccount.GetAddress()
@@ -48,7 +50,7 @@ func TestGrants(t *testing.T) {
filter types.ContractAuthzFilterX
transferAmount sdk.Coin
senderKey cryptotypes.PrivKey
- expErr *sdkerrors.Error
+ expErr *errorsmod.Error
}{
"in limits and filter": {
limit: types.NewMaxFundsLimit(myAmount),
@@ -75,7 +77,7 @@ func TestGrants(t *testing.T) {
filter: types.NewAllowAllMessagesFilter(),
senderKey: otherPrivKey,
transferAmount: myAmount,
- expErr: sdkerrors.ErrUnauthorized,
+ expErr: authz.ErrNoAuthorizationFound,
},
}
for name, spec := range specs {
@@ -84,7 +86,8 @@ func TestGrants(t *testing.T) {
grant, err := types.NewContractGrant(contractAddr, spec.limit, spec.filter)
require.NoError(t, err)
authorization := types.NewContractExecutionAuthorization(*grant)
- grantMsg, err := authz.NewMsgGrant(granterAddr, granteeAddr, authorization, time.Now().Add(time.Hour))
+ expiry := time.Now().Add(time.Hour)
+ grantMsg, err := authz.NewMsgGrant(granterAddr, granteeAddr, authorization, &expiry)
require.NoError(t, err)
_, err = chain.SendMsgs(grantMsg)
require.NoError(t, err)
@@ -103,7 +106,7 @@ func TestGrants(t *testing.T) {
// then
if spec.expErr != nil {
- require.ErrorIs(t, gotErr, spec.expErr)
+ require.True(t, spec.expErr.Is(gotErr))
assert.Equal(t, sdk.NewInt(1_000_000), chain.Balance(granteeAddr, sdk.DefaultBondDenom).Amount)
assert.Equal(t, granterStartBalance, chain.Balance(granterAddr, sdk.DefaultBondDenom).Amount)
return
diff --git a/tests/e2e/group_test.go b/tests/e2e/group_test.go
new file mode 100644
index 0000000000..5fefc20021
--- /dev/null
+++ b/tests/e2e/group_test.go
@@ -0,0 +1,71 @@
+package e2e_test
+
+import (
+ "testing"
+ "time"
+
+ "github.com/CosmWasm/wasmd/x/wasm/types"
+
+ "github.com/cometbft/cometbft/libs/rand"
+ sdk "github.com/cosmos/cosmos-sdk/types"
+ "github.com/cosmos/cosmos-sdk/types/address"
+ banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
+ "github.com/cosmos/cosmos-sdk/x/group"
+ "github.com/stretchr/testify/assert"
+ "github.com/stretchr/testify/require"
+
+ "github.com/CosmWasm/wasmd/tests/e2e"
+ "github.com/CosmWasm/wasmd/x/wasm/ibctesting"
+)
+
+func TestGroupWithContract(t *testing.T) {
+ // Given a group with a contract as only member
+ // When contract submits a proposal with try_execute
+ // Then the payload msg is executed
+
+ coord := ibctesting.NewCoordinator(t, 1)
+ chain := coord.GetChain(ibctesting.GetChainID(1))
+ contractAddr := e2e.InstantiateReflectContract(t, chain)
+ chain.Fund(contractAddr, sdk.NewIntFromUint64(1_000_000_000))
+
+ members := []group.MemberRequest{
+ {
+ Address: contractAddr.String(),
+ Weight: "1",
+ Metadata: "my contract",
+ },
+ }
+ msg, err := group.NewMsgCreateGroupWithPolicy(
+ chain.SenderAccount.GetAddress().String(),
+ members,
+ "my group",
+ "my metadata",
+ false,
+ group.NewPercentageDecisionPolicy("1", time.Second, 0),
+ )
+ require.NoError(t, err)
+ rsp, err := chain.SendMsgs(msg)
+ require.NoError(t, err)
+
+ createRsp := rsp.MsgResponses[0].GetCachedValue().(*group.MsgCreateGroupWithPolicyResponse)
+ groupID, policyAddr := createRsp.GroupId, sdk.MustAccAddressFromBech32(createRsp.GroupPolicyAddress)
+ require.NotEmpty(t, groupID)
+ chain.Fund(policyAddr, sdk.NewIntFromUint64(1_000_000_000))
+ // and a proposal submitted
+ recipientAddr := sdk.AccAddress(rand.Bytes(address.Len))
+
+ payload := []sdk.Msg{banktypes.NewMsgSend(policyAddr, recipientAddr, sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.OneInt())))}
+ propMsg, err := group.NewMsgSubmitProposal(policyAddr.String(), []string{contractAddr.String()}, payload, "my proposal", group.Exec_EXEC_TRY, "my title", "my description")
+ require.NoError(t, err)
+
+ rsp = e2e.MustExecViaStargateReflectContract(t, chain, contractAddr, propMsg)
+ bz := rsp.MsgResponses[0].GetCachedValue().(*types.MsgExecuteContractResponse).Data
+ var groupRsp group.MsgSubmitProposalResponse
+ require.NoError(t, chain.Codec.Unmarshal(bz, &groupRsp))
+ // require.NotEmpty(t, groupRsp.ProposalId)
+
+ // and coins received
+ recipientBalance := chain.Balance(recipientAddr, sdk.DefaultBondDenom)
+ expBalanceAmount := sdk.NewCoin(sdk.DefaultBondDenom, sdk.OneInt())
+ assert.Equal(t, expBalanceAmount.String(), recipientBalance.String())
+}
diff --git a/tests/e2e/ibc_fees_test.go b/tests/e2e/ibc_fees_test.go
index fa315ffe60..30fcb5b9c6 100644
--- a/tests/e2e/ibc_fees_test.go
+++ b/tests/e2e/ibc_fees_test.go
@@ -9,11 +9,11 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/address"
- ibcfee "github.com/cosmos/ibc-go/v4/modules/apps/29-fee/types"
- ibctransfertypes "github.com/cosmos/ibc-go/v4/modules/apps/transfer/types"
- clienttypes "github.com/cosmos/ibc-go/v4/modules/core/02-client/types"
- channeltypes "github.com/cosmos/ibc-go/v4/modules/core/04-channel/types"
- ibctesting "github.com/cosmos/ibc-go/v4/testing"
+ ibcfee "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/types"
+ ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types"
+ clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types"
+ channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types"
+ ibctesting "github.com/cosmos/ibc-go/v7/testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
@@ -30,8 +30,8 @@ func TestIBCFeesTransfer(t *testing.T) {
// then the relayer's payee is receiving the fee(s) on success
marshaler := app.MakeEncodingConfig().Marshaler
coord := wasmibctesting.NewCoordinator(t, 2)
- chainA := coord.GetChain(ibctesting.GetChainID(0))
- chainB := coord.GetChain(ibctesting.GetChainID(1))
+ chainA := coord.GetChain(wasmibctesting.GetChainID(1))
+ chainB := coord.GetChain(wasmibctesting.GetChainID(2))
actorChainA := sdk.AccAddress(chainA.SenderPrivKey.PubKey().Address())
actorChainB := sdk.AccAddress(chainB.SenderPrivKey.PubKey().Address())
@@ -61,7 +61,7 @@ func TestIBCFeesTransfer(t *testing.T) {
// when a transfer package is sent
transferCoin := sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(1))
- ibcPayloadMsg := ibctransfertypes.NewMsgTransfer(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, transferCoin, actorChainA.String(), receiver.String(), clienttypes.Height{}, uint64(time.Now().Add(time.Minute).UnixNano()))
+ ibcPayloadMsg := ibctransfertypes.NewMsgTransfer(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, transferCoin, actorChainA.String(), receiver.String(), clienttypes.Height{}, uint64(time.Now().Add(time.Minute).UnixNano()), "testing")
ibcPackageFee := ibcfee.NewFee(oneToken, oneToken, sdk.Coins{})
feeMsg := ibcfee.NewMsgPayPacketFee(ibcPackageFee, ibctransfertypes.PortID, path.EndpointA.ChannelID, actorChainA.String(), nil)
_, err = chainA.SendMsgs(feeMsg, ibcPayloadMsg)
@@ -86,7 +86,7 @@ func TestIBCFeesTransfer(t *testing.T) {
require.NoError(t, err)
// and transfer from B to A
- ibcPayloadMsg = ibctransfertypes.NewMsgTransfer(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, transferCoin, actorChainB.String(), receiver.String(), clienttypes.Height{}, uint64(time.Now().Add(time.Minute).UnixNano()))
+ ibcPayloadMsg = ibctransfertypes.NewMsgTransfer(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, transferCoin, actorChainB.String(), receiver.String(), clienttypes.Height{}, uint64(time.Now().Add(time.Minute).UnixNano()), "more testing")
ibcPackageFee = ibcfee.NewFee(oneToken, oneToken, sdk.Coins{})
feeMsg = ibcfee.NewMsgPayPacketFee(ibcPackageFee, ibctransfertypes.PortID, path.EndpointB.ChannelID, actorChainB.String(), nil)
_, err = chainB.SendMsgs(feeMsg, ibcPayloadMsg)
@@ -113,8 +113,8 @@ func TestIBCFeesWasm(t *testing.T) {
// then the relayer's payee is receiving the fee(s) on success
marshaler := app.MakeEncodingConfig().Marshaler
coord := wasmibctesting.NewCoordinator(t, 2)
- chainA := coord.GetChain(ibctesting.GetChainID(0))
- chainB := coord.GetChain(ibctesting.GetChainID(1))
+ chainA := coord.GetChain(wasmibctesting.GetChainID(1))
+ chainB := coord.GetChain(ibctesting.GetChainID(2))
actorChainA := sdk.AccAddress(chainA.SenderPrivKey.PubKey().Address())
actorChainB := sdk.AccAddress(chainB.SenderPrivKey.PubKey().Address())
@@ -192,7 +192,7 @@ func TestIBCFeesWasm(t *testing.T) {
require.NoError(t, err)
// and when sent back from chain B to A
- ibcPayloadMsg := ibctransfertypes.NewMsgTransfer(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, gotBalance, actorChainB.String(), actorChainA.String(), clienttypes.Height{}, uint64(time.Now().Add(time.Minute).UnixNano()))
+ ibcPayloadMsg := ibctransfertypes.NewMsgTransfer(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, gotBalance, actorChainB.String(), actorChainA.String(), clienttypes.Height{}, uint64(time.Now().Add(time.Minute).UnixNano()), "even more tests")
ibcPackageFee = ibcfee.NewFee(oneToken, oneToken, sdk.Coins{})
feeMsg = ibcfee.NewMsgPayPacketFee(ibcPackageFee, ibctransfertypes.PortID, path.EndpointB.ChannelID, actorChainB.String(), nil)
_, err = chainB.SendMsgs(feeMsg, ibcPayloadMsg)
diff --git a/tests/e2e/ica_test.go b/tests/e2e/ica_test.go
index 24c0623611..3ac2fdb88c 100644
--- a/tests/e2e/ica_test.go
+++ b/tests/e2e/ica_test.go
@@ -3,15 +3,17 @@ package e2e
import (
"bytes"
"testing"
+ "time"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/address"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
- hosttypes "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/host/types"
- icatypes "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/types"
- channeltypes "github.com/cosmos/ibc-go/v4/modules/core/04-channel/types"
- ibctesting "github.com/cosmos/ibc-go/v4/testing"
- intertxtypes "github.com/cosmos/interchain-accounts/x/inter-tx/types"
+ "github.com/cosmos/gogoproto/proto"
+ icacontrollertypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types"
+ hosttypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/types"
+ icatypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types"
+ channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types"
+ ibctesting "github.com/cosmos/ibc-go/v7/testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
@@ -26,18 +28,19 @@ func TestICA(t *testing.T) {
// then the ICA owner can submit a message via IBC
// to control their account on the host chain
coord := wasmibctesting.NewCoordinator(t, 2)
- hostChain := coord.GetChain(ibctesting.GetChainID(0))
+ hostChain := coord.GetChain(ibctesting.GetChainID(1))
hostParams := hosttypes.NewParams(true, []string{sdk.MsgTypeURL(&banktypes.MsgSend{})})
hostChain.App.ICAHostKeeper.SetParams(hostChain.GetContext(), hostParams)
- controllerChain := coord.GetChain(ibctesting.GetChainID(1))
+ controllerChain := coord.GetChain(ibctesting.GetChainID(2))
path := wasmibctesting.NewPath(controllerChain, hostChain)
coord.SetupConnections(path)
ownerAddr := sdk.AccAddress(controllerChain.SenderPrivKey.PubKey().Address())
- msg := intertxtypes.NewMsgRegisterAccount(ownerAddr.String(), path.EndpointA.ConnectionID, "")
+ msg := icacontrollertypes.NewMsgRegisterInterchainAccount(path.EndpointA.ConnectionID, ownerAddr.String(), "")
res, err := controllerChain.SendMsgs(msg)
+ require.NoError(t, err)
chanID, portID, version := parseIBCChannelEvents(t, res)
// next open channels on both sides
@@ -48,28 +51,35 @@ func TestICA(t *testing.T) {
Order: channeltypes.ORDERED,
}
path.EndpointB.ChannelConfig = &ibctesting.ChannelConfig{
- PortID: icatypes.PortID,
+ PortID: icatypes.HostPortID,
Version: icatypes.Version,
Order: channeltypes.ORDERED,
}
coord.CreateChannels(path)
// assert ICA exists on controller
- icaRsp, err := controllerChain.App.InterTxKeeper.InterchainAccount(sdk.WrapSDKContext(controllerChain.GetContext()), &intertxtypes.QueryInterchainAccountRequest{
+ icaRsp, err := controllerChain.App.ICAControllerKeeper.InterchainAccount(sdk.WrapSDKContext(controllerChain.GetContext()), &icacontrollertypes.QueryInterchainAccountRequest{
Owner: ownerAddr.String(),
ConnectionId: path.EndpointA.ConnectionID,
})
require.NoError(t, err)
- icaAddr := sdk.MustAccAddressFromBech32(icaRsp.InterchainAccountAddress)
+ icaAddr := sdk.MustAccAddressFromBech32(icaRsp.GetAddress())
hostChain.Fund(icaAddr, sdk.NewInt(1_000))
// submit a tx
targetAddr := sdk.AccAddress(bytes.Repeat([]byte{1}, address.Len))
sendCoin := sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(100))
payloadMsg := banktypes.NewMsgSend(icaAddr, targetAddr, sdk.NewCoins(sendCoin))
- msg2, err := intertxtypes.NewMsgSubmitTx(payloadMsg, path.EndpointA.ConnectionID, ownerAddr.String())
+ rawPayloadData, err := icatypes.SerializeCosmosTx(controllerChain.Codec, []proto.Message{payloadMsg})
require.NoError(t, err)
- res, err = controllerChain.SendMsgs(msg2)
+ payloadPacket := icatypes.InterchainAccountPacketData{
+ Type: icatypes.EXECUTE_TX,
+ Data: rawPayloadData,
+ Memo: "testing",
+ }
+ relativeTimeout := uint64(time.Minute.Nanoseconds()) // note this is in nanoseconds
+ msgSendTx := icacontrollertypes.NewMsgSendTx(ownerAddr.String(), path.EndpointA.ConnectionID, relativeTimeout, payloadPacket)
+ _, err = controllerChain.SendMsgs(msgSendTx)
require.NoError(t, err)
assert.Equal(t, 1, len(controllerChain.PendingSendPackets))
diff --git a/tests/e2e/reflect_helper.go b/tests/e2e/reflect_helper.go
new file mode 100644
index 0000000000..c2ebcadbf2
--- /dev/null
+++ b/tests/e2e/reflect_helper.go
@@ -0,0 +1,68 @@
+package e2e
+
+import (
+ "encoding/json"
+ "testing"
+
+ wasmvmtypes "github.com/CosmWasm/wasmvm/types"
+ "github.com/cosmos/cosmos-sdk/codec"
+ sdk "github.com/cosmos/cosmos-sdk/types"
+ "github.com/stretchr/testify/require"
+
+ "github.com/CosmWasm/wasmd/x/wasm/ibctesting"
+ "github.com/CosmWasm/wasmd/x/wasm/keeper/testdata"
+ "github.com/CosmWasm/wasmd/x/wasm/types"
+)
+
+// InstantiateReflectContract store and instantiate a reflect contract instance
+func InstantiateReflectContract(t *testing.T, chain *ibctesting.TestChain) sdk.AccAddress {
+ codeID := chain.StoreCodeFile("../../x/wasm/keeper/testdata/reflect_1_1.wasm").CodeID
+ contractAddr := chain.InstantiateContract(codeID, []byte(`{}`))
+ require.NotEmpty(t, contractAddr)
+ return contractAddr
+}
+
+// MustExecViaReflectContract submit execute message to send payload to reflect contract
+func MustExecViaReflectContract(t *testing.T, chain *ibctesting.TestChain, contractAddr sdk.AccAddress, msgs ...wasmvmtypes.CosmosMsg) *sdk.Result {
+ rsp, err := ExecViaReflectContract(t, chain, contractAddr, msgs)
+ require.NoError(t, err)
+ return rsp
+}
+
+type sdkMessageType interface {
+ codec.ProtoMarshaler
+ sdk.Msg
+}
+
+func MustExecViaStargateReflectContract[T sdkMessageType](t *testing.T, chain *ibctesting.TestChain, contractAddr sdk.AccAddress, msgs ...T) *sdk.Result {
+ vmMsgs := make([]wasmvmtypes.CosmosMsg, len(msgs))
+ for i, m := range msgs {
+ bz, err := chain.Codec.Marshal(m)
+ require.NoError(t, err)
+ vmMsgs[i] = wasmvmtypes.CosmosMsg{
+ Stargate: &wasmvmtypes.StargateMsg{
+ TypeURL: sdk.MsgTypeURL(m),
+ Value: bz,
+ },
+ }
+ }
+ rsp, err := ExecViaReflectContract(t, chain, contractAddr, vmMsgs)
+ require.NoError(t, err)
+ return rsp
+}
+
+// ExecViaReflectContract submit execute message to send payload to reflect contract
+func ExecViaReflectContract(t *testing.T, chain *ibctesting.TestChain, contractAddr sdk.AccAddress, msgs []wasmvmtypes.CosmosMsg) (*sdk.Result, error) {
+ require.NotEmpty(t, msgs)
+ reflectSend := testdata.ReflectHandleMsg{
+ Reflect: &testdata.ReflectPayload{Msgs: msgs},
+ }
+ reflectSendBz, err := json.Marshal(reflectSend)
+ require.NoError(t, err)
+ execMsg := &types.MsgExecuteContract{
+ Sender: chain.SenderAccount.GetAddress().String(),
+ Contract: contractAddr.String(),
+ Msg: reflectSendBz,
+ }
+ return chain.SendMsgs(execMsg)
+}
diff --git a/x/wasm/alias.go b/x/wasm/alias.go
index e47a657c97..83480ab4dd 100644
--- a/x/wasm/alias.go
+++ b/x/wasm/alias.go
@@ -1,4 +1,3 @@
-// nolint
// autogenerated code using github.com/rigelrozanski/multitool
// aliases generated for the following subdirectories:
// ALIASGEN: github.com/Cosmwasm/wasmd/x/wasm/types
@@ -24,14 +23,6 @@ const (
ProposalTypeMigrateContract = types.ProposalTypeMigrateContract
ProposalTypeUpdateAdmin = types.ProposalTypeUpdateAdmin
ProposalTypeClearAdmin = types.ProposalTypeClearAdmin
- QueryListContractByCode = keeper.QueryListContractByCode
- QueryGetContract = keeper.QueryGetContract
- QueryGetContractState = keeper.QueryGetContractState
- QueryGetCode = keeper.QueryGetCode
- QueryListCode = keeper.QueryListCode
- QueryMethodContractStateSmart = keeper.QueryMethodContractStateSmart
- QueryMethodContractStateAll = keeper.QueryMethodContractStateAll
- QueryMethodContractStateRaw = keeper.QueryMethodContractStateRaw
)
var (
diff --git a/x/wasm/client/cli/gov_tx.go b/x/wasm/client/cli/gov_tx.go
index c516be2932..035d54a1bb 100644
--- a/x/wasm/client/cli/gov_tx.go
+++ b/x/wasm/client/cli/gov_tx.go
@@ -9,20 +9,18 @@ import (
"strconv"
"strings"
- "github.com/CosmWasm/wasmd/x/wasm/ioutils"
-
- "github.com/docker/distribution/reference"
-
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/tx"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/version"
"github.com/cosmos/cosmos-sdk/x/gov/client/cli"
- govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
+ "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
+ "github.com/docker/distribution/reference"
"github.com/pkg/errors"
"github.com/spf13/cobra"
flag "github.com/spf13/pflag"
+ "github.com/CosmWasm/wasmd/x/wasm/ioutils"
"github.com/CosmWasm/wasmd/x/wasm/types"
)
@@ -70,7 +68,7 @@ func ProposalStoreCodeCmd() *cobra.Command {
CodeHash: codeHash,
}
- msg, err := govtypes.NewMsgSubmitProposal(&content, deposit, clientCtx.GetFromAddress())
+ msg, err := v1beta1.NewMsgSubmitProposal(&content, deposit, clientCtx.GetFromAddress())
if err != nil {
return err
}
@@ -91,9 +89,7 @@ func ProposalStoreCodeCmd() *cobra.Command {
addInstantiatePermissionFlags(cmd)
// proposal flags
- cmd.Flags().String(cli.FlagTitle, "", "Title of proposal")
- cmd.Flags().String(cli.FlagDescription, "", "Description of proposal")
- cmd.Flags().String(cli.FlagDeposit, "", "Deposit of proposal")
+ addCommonProposalFlags(cmd)
return cmd
}
@@ -178,7 +174,7 @@ func ProposalInstantiateContractCmd() *cobra.Command {
Funds: src.Funds,
}
- msg, err := govtypes.NewMsgSubmitProposal(&content, deposit, clientCtx.GetFromAddress())
+ msg, err := v1beta1.NewMsgSubmitProposal(&content, deposit, clientCtx.GetFromAddress())
if err != nil {
return err
}
@@ -197,9 +193,7 @@ func ProposalInstantiateContractCmd() *cobra.Command {
cmd.Flags().Bool(flagNoAdmin, false, "You must set this explicitly if you don't want an admin")
// proposal flags
- cmd.Flags().String(cli.FlagTitle, "", "Title of proposal")
- cmd.Flags().String(cli.FlagDescription, "", "Description of proposal")
- cmd.Flags().String(cli.FlagDeposit, "", "Deposit of proposal")
+ addCommonProposalFlags(cmd)
return cmd
}
@@ -240,7 +234,7 @@ func ProposalInstantiateContract2Cmd() *cobra.Command {
content := types.NewInstantiateContract2Proposal(proposalTitle, proposalDescr, runAs, src.Admin, src.CodeID, src.Label, src.Msg, src.Funds, salt, fixMsg)
- msg, err := govtypes.NewMsgSubmitProposal(content, deposit, clientCtx.GetFromAddress())
+ msg, err := v1beta1.NewMsgSubmitProposal(content, deposit, clientCtx.GetFromAddress())
if err != nil {
return err
}
@@ -262,9 +256,7 @@ func ProposalInstantiateContract2Cmd() *cobra.Command {
decoder.RegisterFlags(cmd.PersistentFlags(), "salt")
// proposal flags
- cmd.Flags().String(cli.FlagTitle, "", "Title of proposal")
- cmd.Flags().String(cli.FlagDescription, "", "Description of proposal")
- cmd.Flags().String(cli.FlagDeposit, "", "Deposit of proposal")
+ addCommonProposalFlags(cmd)
return cmd
}
@@ -341,7 +333,11 @@ func ProposalStoreAndInstantiateContractCmd() *cobra.Command {
if err != nil {
return fmt.Errorf("admin %s", err)
}
- adminStr = info.GetAddress().String()
+ admin, err := info.GetAddress()
+ if err != nil {
+ return err
+ }
+ adminStr = admin.String()
} else {
adminStr = addr.String()
}
@@ -363,7 +359,7 @@ func ProposalStoreAndInstantiateContractCmd() *cobra.Command {
Funds: amount,
}
- msg, err := govtypes.NewMsgSubmitProposal(&content, deposit, clientCtx.GetFromAddress())
+ msg, err := v1beta1.NewMsgSubmitProposal(&content, deposit, clientCtx.GetFromAddress())
if err != nil {
return err
}
@@ -387,9 +383,7 @@ func ProposalStoreAndInstantiateContractCmd() *cobra.Command {
cmd.Flags().Bool(flagNoAdmin, false, "You must set this explicitly if you don't want an admin")
addInstantiatePermissionFlags(cmd)
// proposal flags
- cmd.Flags().String(cli.FlagTitle, "", "Title of proposal")
- cmd.Flags().String(cli.FlagDescription, "", "Description of proposal")
- cmd.Flags().String(cli.FlagDeposit, "", "Deposit of proposal")
+ addCommonProposalFlags(cmd)
return cmd
}
@@ -417,7 +411,7 @@ func ProposalMigrateContractCmd() *cobra.Command {
Msg: src.Msg,
}
- msg, err := govtypes.NewMsgSubmitProposal(&content, deposit, clientCtx.GetFromAddress())
+ msg, err := v1beta1.NewMsgSubmitProposal(&content, deposit, clientCtx.GetFromAddress())
if err != nil {
return err
}
@@ -431,9 +425,7 @@ func ProposalMigrateContractCmd() *cobra.Command {
}
// proposal flags
- cmd.Flags().String(cli.FlagTitle, "", "Title of proposal")
- cmd.Flags().String(cli.FlagDescription, "", "Description of proposal")
- cmd.Flags().String(cli.FlagDeposit, "", "Deposit of proposal")
+ addCommonProposalFlags(cmd)
return cmd
}
@@ -476,7 +468,7 @@ func ProposalExecuteContractCmd() *cobra.Command {
Funds: funds,
}
- msg, err := govtypes.NewMsgSubmitProposal(&content, deposit, clientCtx.GetFromAddress())
+ msg, err := v1beta1.NewMsgSubmitProposal(&content, deposit, clientCtx.GetFromAddress())
if err != nil {
return err
}
@@ -492,9 +484,7 @@ func ProposalExecuteContractCmd() *cobra.Command {
cmd.Flags().String(flagAmount, "", "Coins to send to the contract during instantiation")
// proposal flags
- cmd.Flags().String(cli.FlagTitle, "", "Title of proposal")
- cmd.Flags().String(cli.FlagDescription, "", "Description of proposal")
- cmd.Flags().String(cli.FlagDeposit, "", "Deposit of proposal")
+ addCommonProposalFlags(cmd)
return cmd
}
@@ -519,7 +509,7 @@ func ProposalSudoContractCmd() *cobra.Command {
Msg: sudoMsg,
}
- msg, err := govtypes.NewMsgSubmitProposal(&content, deposit, clientCtx.GetFromAddress())
+ msg, err := v1beta1.NewMsgSubmitProposal(&content, deposit, clientCtx.GetFromAddress())
if err != nil {
return err
}
@@ -533,9 +523,7 @@ func ProposalSudoContractCmd() *cobra.Command {
}
// proposal flagsExecute
- cmd.Flags().String(cli.FlagTitle, "", "Title of proposal")
- cmd.Flags().String(cli.FlagDescription, "", "Description of proposal")
- cmd.Flags().String(cli.FlagDeposit, "", "Deposit of proposal")
+ addCommonProposalFlags(cmd)
return cmd
}
@@ -550,10 +538,7 @@ func ProposalUpdateContractAdminCmd() *cobra.Command {
return err
}
- src, err := parseUpdateContractAdminArgs(args, clientCtx)
- if err != nil {
- return err
- }
+ src := parseUpdateContractAdminArgs(args, clientCtx)
content := types.UpdateAdminProposal{
Title: proposalTitle,
@@ -562,7 +547,7 @@ func ProposalUpdateContractAdminCmd() *cobra.Command {
NewAdmin: src.NewAdmin,
}
- msg, err := govtypes.NewMsgSubmitProposal(&content, deposit, clientCtx.GetFromAddress())
+ msg, err := v1beta1.NewMsgSubmitProposal(&content, deposit, clientCtx.GetFromAddress())
if err != nil {
return err
}
@@ -575,9 +560,7 @@ func ProposalUpdateContractAdminCmd() *cobra.Command {
SilenceUsage: true,
}
// proposal flags
- cmd.Flags().String(cli.FlagTitle, "", "Title of proposal")
- cmd.Flags().String(cli.FlagDescription, "", "Description of proposal")
- cmd.Flags().String(cli.FlagDeposit, "", "Deposit of proposal")
+ addCommonProposalFlags(cmd)
return cmd
}
@@ -598,7 +581,7 @@ func ProposalClearContractAdminCmd() *cobra.Command {
Contract: args[0],
}
- msg, err := govtypes.NewMsgSubmitProposal(&content, deposit, clientCtx.GetFromAddress())
+ msg, err := v1beta1.NewMsgSubmitProposal(&content, deposit, clientCtx.GetFromAddress())
if err != nil {
return err
}
@@ -611,9 +594,7 @@ func ProposalClearContractAdminCmd() *cobra.Command {
SilenceUsage: true,
}
// proposal flags
- cmd.Flags().String(cli.FlagTitle, "", "Title of proposal")
- cmd.Flags().String(cli.FlagDescription, "", "Description of proposal")
- cmd.Flags().String(cli.FlagDeposit, "", "Deposit of proposal")
+ addCommonProposalFlags(cmd)
return cmd
}
@@ -639,7 +620,7 @@ func ProposalPinCodesCmd() *cobra.Command {
CodeIDs: codeIds,
}
- msg, err := govtypes.NewMsgSubmitProposal(&content, deposit, clientCtx.GetFromAddress())
+ msg, err := v1beta1.NewMsgSubmitProposal(&content, deposit, clientCtx.GetFromAddress())
if err != nil {
return err
}
@@ -652,9 +633,7 @@ func ProposalPinCodesCmd() *cobra.Command {
SilenceUsage: true,
}
// proposal flags
- cmd.Flags().String(cli.FlagTitle, "", "Title of proposal")
- cmd.Flags().String(cli.FlagDescription, "", "Description of proposal")
- cmd.Flags().String(cli.FlagDeposit, "", "Deposit of proposal")
+ addCommonProposalFlags(cmd)
return cmd
}
@@ -692,7 +671,7 @@ func ProposalUnpinCodesCmd() *cobra.Command {
CodeIDs: codeIds,
}
- msg, err := govtypes.NewMsgSubmitProposal(&content, deposit, clientCtx.GetFromAddress())
+ msg, err := v1beta1.NewMsgSubmitProposal(&content, deposit, clientCtx.GetFromAddress())
if err != nil {
return err
}
@@ -705,9 +684,7 @@ func ProposalUnpinCodesCmd() *cobra.Command {
SilenceUsage: true,
}
// proposal flags
- cmd.Flags().String(cli.FlagTitle, "", "Title of proposal")
- cmd.Flags().String(cli.FlagDescription, "", "Description of proposal")
- cmd.Flags().String(cli.FlagDeposit, "", "Deposit of proposal")
+ addCommonProposalFlags(cmd)
return cmd
}
@@ -791,7 +768,7 @@ $ %s tx gov submit-proposal update-instantiate-config 1:nobody 2:everybody 3:%s1
Description: proposalDescr,
AccessConfigUpdates: updates,
}
- msg, err := govtypes.NewMsgSubmitProposal(&content, deposit, clientCtx.GetFromAddress())
+ msg, err := v1beta1.NewMsgSubmitProposal(&content, deposit, clientCtx.GetFromAddress())
if err != nil {
return err
}
@@ -804,24 +781,28 @@ $ %s tx gov submit-proposal update-instantiate-config 1:nobody 2:everybody 3:%s1
SilenceUsage: true,
}
// proposal flags
- cmd.Flags().String(cli.FlagTitle, "", "Title of proposal")
- cmd.Flags().String(cli.FlagDescription, "", "Description of proposal")
- cmd.Flags().String(cli.FlagDeposit, "", "Deposit of proposal")
+ addCommonProposalFlags(cmd)
return cmd
}
+func addCommonProposalFlags(cmd *cobra.Command) {
+ cmd.Flags().String(cli.FlagTitle, "", "Title of proposal") //nolint:staticcheck
+ cmd.Flags().String(cli.FlagDescription, "", "Description of proposal") //nolint:staticcheck
+ cmd.Flags().String(cli.FlagDeposit, "", "Deposit of proposal")
+}
+
func getProposalInfo(cmd *cobra.Command) (client.Context, string, string, sdk.Coins, error) {
clientCtx, err := client.GetClientTxContext(cmd)
if err != nil {
return client.Context{}, "", "", nil, err
}
- proposalTitle, err := cmd.Flags().GetString(cli.FlagTitle)
+ proposalTitle, err := cmd.Flags().GetString(cli.FlagTitle) //nolint:staticcheck
if err != nil {
return clientCtx, proposalTitle, "", nil, err
}
- proposalDescr, err := cmd.Flags().GetString(cli.FlagDescription)
+ proposalDescr, err := cmd.Flags().GetString(cli.FlagDescription) //nolint:staticcheck
if err != nil {
return client.Context{}, proposalTitle, proposalDescr, nil, err
}
diff --git a/x/wasm/client/cli/new_tx.go b/x/wasm/client/cli/new_tx.go
index d7e477a9fe..a3d61466ac 100644
--- a/x/wasm/client/cli/new_tx.go
+++ b/x/wasm/client/cli/new_tx.go
@@ -3,10 +3,10 @@ package cli
import (
"strconv"
+ errorsmod "cosmossdk.io/errors"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/tx"
- sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/spf13/cobra"
"github.com/CosmWasm/wasmd/x/wasm/types"
@@ -44,7 +44,7 @@ func parseMigrateContractArgs(args []string, cliCtx client.Context) (types.MsgMi
// get the id of the code to instantiate
codeID, err := strconv.ParseUint(args[1], 10, 64)
if err != nil {
- return types.MsgMigrateContract{}, sdkerrors.Wrap(err, "code id")
+ return types.MsgMigrateContract{}, errorsmod.Wrap(err, "code id")
}
migrateMsg := args[2]
@@ -71,10 +71,8 @@ func UpdateContractAdminCmd() *cobra.Command {
return err
}
- msg, err := parseUpdateContractAdminArgs(args, clientCtx)
- if err != nil {
- return err
- }
+ msg := parseUpdateContractAdminArgs(args, clientCtx)
+
if err := msg.ValidateBasic(); err != nil {
return err
}
@@ -86,13 +84,13 @@ func UpdateContractAdminCmd() *cobra.Command {
return cmd
}
-func parseUpdateContractAdminArgs(args []string, cliCtx client.Context) (types.MsgUpdateAdmin, error) {
+func parseUpdateContractAdminArgs(args []string, cliCtx client.Context) types.MsgUpdateAdmin {
msg := types.MsgUpdateAdmin{
Sender: cliCtx.GetFromAddress().String(),
Contract: args[0],
NewAdmin: args[1],
}
- return msg, nil
+ return msg
}
// ClearContractAdminCmd clears an admin for a contract
diff --git a/x/wasm/client/cli/tx.go b/x/wasm/client/cli/tx.go
index 2f6dbf2fe4..788cde4e84 100644
--- a/x/wasm/client/cli/tx.go
+++ b/x/wasm/client/cli/tx.go
@@ -339,7 +339,11 @@ func parseInstantiateArgs(rawCodeID, initMsg string, kr keyring.Keyring, sender
if err != nil {
return nil, fmt.Errorf("admin %s", err)
}
- adminStr = info.GetAddress().String()
+ admin, err := info.GetAddress()
+ if err != nil {
+ return nil, err
+ }
+ adminStr = admin.String()
} else {
adminStr = addr.String()
}
@@ -526,7 +530,12 @@ $ %s tx grant execution --allow-all-messages --ma
return fmt.Errorf("%s authorization type not supported", args[1])
}
- grantMsg, err := authz.NewMsgGrant(clientCtx.GetFromAddress(), grantee, authorization, time.Unix(0, exp))
+ expire, err := getExpireTime(cmd)
+ if err != nil {
+ return err
+ }
+
+ grantMsg, err := authz.NewMsgGrant(clientCtx.GetFromAddress(), grantee, authorization, expire)
if err != nil {
return err
}
@@ -543,3 +552,15 @@ $ %s tx grant execution --allow-all-messages --ma
cmd.Flags().Bool(flagNoTokenTransfer, false, "Don't allow token transfer")
return cmd
}
+
+func getExpireTime(cmd *cobra.Command) (*time.Time, error) {
+ exp, err := cmd.Flags().GetInt64(flagExpiration)
+ if err != nil {
+ return nil, err
+ }
+ if exp == 0 {
+ return nil, nil
+ }
+ e := time.Unix(exp, 0)
+ return &e, nil
+}
diff --git a/x/wasm/client/proposal_handler.go b/x/wasm/client/proposal_handler.go
index 286d37d197..deba8070ca 100644
--- a/x/wasm/client/proposal_handler.go
+++ b/x/wasm/client/proposal_handler.go
@@ -4,22 +4,20 @@ import (
govclient "github.com/cosmos/cosmos-sdk/x/gov/client"
"github.com/CosmWasm/wasmd/x/wasm/client/cli"
- "github.com/CosmWasm/wasmd/x/wasm/client/rest" //nolint:staticcheck
)
// ProposalHandlers define the wasm cli proposal types and rest handler.
-// Deprecated: the rest package will be removed. You can use the GRPC gateway instead
var ProposalHandlers = []govclient.ProposalHandler{
- govclient.NewProposalHandler(cli.ProposalStoreCodeCmd, rest.StoreCodeProposalHandler),
- govclient.NewProposalHandler(cli.ProposalInstantiateContractCmd, rest.InstantiateProposalHandler),
- govclient.NewProposalHandler(cli.ProposalMigrateContractCmd, rest.MigrateProposalHandler),
- govclient.NewProposalHandler(cli.ProposalExecuteContractCmd, rest.ExecuteProposalHandler),
- govclient.NewProposalHandler(cli.ProposalSudoContractCmd, rest.SudoProposalHandler),
- govclient.NewProposalHandler(cli.ProposalUpdateContractAdminCmd, rest.UpdateContractAdminProposalHandler),
- govclient.NewProposalHandler(cli.ProposalClearContractAdminCmd, rest.ClearContractAdminProposalHandler),
- govclient.NewProposalHandler(cli.ProposalPinCodesCmd, rest.PinCodeProposalHandler),
- govclient.NewProposalHandler(cli.ProposalUnpinCodesCmd, rest.UnpinCodeProposalHandler),
- govclient.NewProposalHandler(cli.ProposalUpdateInstantiateConfigCmd, rest.UpdateInstantiateConfigProposalHandler),
- govclient.NewProposalHandler(cli.ProposalStoreAndInstantiateContractCmd, rest.EmptyRestHandler),
- govclient.NewProposalHandler(cli.ProposalInstantiateContract2Cmd, rest.EmptyRestHandler),
+ govclient.NewProposalHandler(cli.ProposalStoreCodeCmd),
+ govclient.NewProposalHandler(cli.ProposalInstantiateContractCmd),
+ govclient.NewProposalHandler(cli.ProposalMigrateContractCmd),
+ govclient.NewProposalHandler(cli.ProposalExecuteContractCmd),
+ govclient.NewProposalHandler(cli.ProposalSudoContractCmd),
+ govclient.NewProposalHandler(cli.ProposalUpdateContractAdminCmd),
+ govclient.NewProposalHandler(cli.ProposalClearContractAdminCmd),
+ govclient.NewProposalHandler(cli.ProposalPinCodesCmd),
+ govclient.NewProposalHandler(cli.ProposalUnpinCodesCmd),
+ govclient.NewProposalHandler(cli.ProposalUpdateInstantiateConfigCmd),
+ govclient.NewProposalHandler(cli.ProposalStoreAndInstantiateContractCmd),
+ govclient.NewProposalHandler(cli.ProposalInstantiateContract2Cmd),
}
diff --git a/x/wasm/client/proposal_handler_test.go b/x/wasm/client/proposal_handler_test.go
deleted file mode 100644
index 086e3cb3ae..0000000000
--- a/x/wasm/client/proposal_handler_test.go
+++ /dev/null
@@ -1,381 +0,0 @@
-package client
-
-import (
- "bytes"
- "encoding/json"
- "fmt"
- "net/http"
- "net/http/httptest"
- "os"
- "testing"
-
- "github.com/cosmos/cosmos-sdk/client"
- "github.com/cosmos/cosmos-sdk/client/flags"
- authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
- "github.com/gorilla/mux"
- "github.com/stretchr/testify/require"
-
- "github.com/CosmWasm/wasmd/x/wasm/keeper"
-)
-
-func TestGovRestHandlers(t *testing.T) {
- type dict map[string]interface{}
- var (
- anyAddress = "cosmos100dejzacpanrldpjjwksjm62shqhyss44jf5xz"
- aBaseReq = dict{
- "from": anyAddress,
- "memo": "rest test",
- "chain_id": "testing",
- "account_number": "1",
- "sequence": "1",
- "fees": []dict{{"denom": "ustake", "amount": "1000000"}},
- }
- )
- encodingConfig := keeper.MakeEncodingConfig(t)
- clientCtx := client.Context{}.
- WithCodec(encodingConfig.Marshaler).
- WithTxConfig(encodingConfig.TxConfig).
- WithLegacyAmino(encodingConfig.Amino).
- WithInput(os.Stdin).
- WithAccountRetriever(authtypes.AccountRetriever{}).
- WithBroadcastMode(flags.BroadcastBlock).
- WithChainID("testing")
-
- // router setup as in gov/client/rest/tx.go
- propSubRtr := mux.NewRouter().PathPrefix("/gov/proposals").Subrouter()
- for _, ph := range ProposalHandlers {
- r := ph.RESTHandler(clientCtx)
- propSubRtr.HandleFunc(fmt.Sprintf("/%s", r.SubRoute), r.Handler).Methods("POST")
- }
-
- specs := map[string]struct {
- srcBody dict
- srcPath string
- expCode int
- }{
- "store-code": {
- srcPath: "/gov/proposals/wasm_store_code",
- srcBody: dict{
- "title": "Test Proposal",
- "description": "My proposal",
- "type": "store-code",
- "run_as": "cosmos100dejzacpanrldpjjwksjm62shqhyss44jf5xz",
- "wasm_byte_code": []byte("valid wasm byte code"),
- "source": "https://example.com/",
- "builder": "cosmwasm/workspace-optimizer:v0.12.9",
- "code_hash": "79F174F09BFE3F83398BF7C147929D5F735161BD46D645E85216BB13BF91D42D",
- "instantiate_permission": dict{
- "permission": "OnlyAddress",
- "address": "cosmos1ve557a5g9yw2g2z57js3pdmcvd5my6g8ze20np",
- },
- "deposit": []dict{{"denom": "ustake", "amount": "10"}},
- "proposer": "cosmos1ve557a5g9yw2g2z57js3pdmcvd5my6g8ze20np",
- "base_req": aBaseReq,
- },
- expCode: http.StatusOK,
- },
- "store-code without verification info": {
- srcPath: "/gov/proposals/wasm_store_code",
- srcBody: dict{
- "title": "Test Proposal",
- "description": "My proposal",
- "type": "store-code",
- "run_as": "cosmos100dejzacpanrldpjjwksjm62shqhyss44jf5xz",
- "wasm_byte_code": []byte("valid wasm byte code"),
- "instantiate_permission": dict{
- "permission": "OnlyAddress",
- "address": "cosmos1ve557a5g9yw2g2z57js3pdmcvd5my6g8ze20np",
- },
- "deposit": []dict{{"denom": "ustake", "amount": "10"}},
- "proposer": "cosmos1ve557a5g9yw2g2z57js3pdmcvd5my6g8ze20np",
- "base_req": aBaseReq,
- },
- expCode: http.StatusOK,
- },
- "store-code without permission": {
- srcPath: "/gov/proposals/wasm_store_code",
- srcBody: dict{
- "title": "Test Proposal",
- "description": "My proposal",
- "type": "store-code",
- "run_as": "cosmos100dejzacpanrldpjjwksjm62shqhyss44jf5xz",
- "wasm_byte_code": []byte("valid wasm byte code"),
- "source": "https://example.com/",
- "builder": "cosmwasm/workspace-optimizer:v0.12.9",
- "code_hash": "79F174F09BFE3F83398BF7C147929D5F735161BD46D645E85216BB13BF91D42D",
- "deposit": []dict{{"denom": "ustake", "amount": "10"}},
- "proposer": "cosmos1ve557a5g9yw2g2z57js3pdmcvd5my6g8ze20np",
- "base_req": aBaseReq,
- },
- expCode: http.StatusOK,
- },
- "store-code invalid permission": {
- srcPath: "/gov/proposals/wasm_store_code",
- srcBody: dict{
- "title": "Test Proposal",
- "description": "My proposal",
- "type": "store-code",
- "run_as": "cosmos100dejzacpanrldpjjwksjm62shqhyss44jf5xz",
- "wasm_byte_code": []byte("valid wasm byte code"),
- "source": "https://example.com/",
- "builder": "cosmwasm/workspace-optimizer:v0.12.9",
- "code_hash": "79F174F09BFE3F83398BF7C147929D5F735161BD46D645E85216BB13BF91D42D",
- "instantiate_permission": dict{
- "permission": "Nobody",
- "address": "cosmos1ve557a5g9yw2g2z57js3pdmcvd5my6g8ze20np",
- },
- "deposit": []dict{{"denom": "ustake", "amount": "10"}},
- "proposer": "cosmos1ve557a5g9yw2g2z57js3pdmcvd5my6g8ze20np",
- "base_req": aBaseReq,
- },
- expCode: http.StatusBadRequest,
- },
- "store-code with incomplete proposal data: blank title": {
- srcPath: "/gov/proposals/wasm_store_code",
- srcBody: dict{
- "title": "",
- "description": "My proposal",
- "type": "store-code",
- "run_as": "cosmos100dejzacpanrldpjjwksjm62shqhyss44jf5xz",
- "wasm_byte_code": []byte("valid wasm byte code"),
- "source": "https://example.com/",
- "code_hash": "79F174F09BFE3F83398BF7C147929D5F735161BD46D645E85216BB13BF91D42D",
- "builder": "cosmwasm/workspace-optimizer:v0.12.9",
- "instantiate_permission": dict{
- "permission": "OnlyAddress",
- "address": "cosmos1ve557a5g9yw2g2z57js3pdmcvd5my6g8ze20np",
- },
- "deposit": []dict{{"denom": "ustake", "amount": "10"}},
- "proposer": "cosmos1ve557a5g9yw2g2z57js3pdmcvd5my6g8ze20np",
- "base_req": aBaseReq,
- },
- expCode: http.StatusBadRequest,
- },
- "store-code with incomplete content data: no wasm_byte_code": {
- srcPath: "/gov/proposals/wasm_store_code",
- srcBody: dict{
- "title": "Test Proposal",
- "description": "My proposal",
- "type": "store-code",
- "run_as": "cosmos100dejzacpanrldpjjwksjm62shqhyss44jf5xz",
- "wasm_byte_code": "",
- "builder": "cosmwasm/workspace-optimizer:v0.12.9",
- "source": "https://example.com/",
- "code_hash": "79F174F09BFE3F83398BF7C147929D5F735161BD46D645E85216BB13BF91D42D",
- "instantiate_permission": dict{
- "permission": "OnlyAddress",
- "address": "cosmos1ve557a5g9yw2g2z57js3pdmcvd5my6g8ze20np",
- },
- "deposit": []dict{{"denom": "ustake", "amount": "10"}},
- "proposer": "cosmos1ve557a5g9yw2g2z57js3pdmcvd5my6g8ze20np",
- "base_req": aBaseReq,
- },
- expCode: http.StatusBadRequest,
- },
- "store-code with incomplete content data: no builder": {
- srcPath: "/gov/proposals/wasm_store_code",
- srcBody: dict{
- "title": "Test Proposal",
- "description": "My proposal",
- "type": "store-code",
- "run_as": "cosmos100dejzacpanrldpjjwksjm62shqhyss44jf5xz",
- "wasm_byte_code": "",
- "source": "https://example.com/",
- "code_hash": "79F174F09BFE3F83398BF7C147929D5F735161BD46D645E85216BB13BF91D42D",
- "instantiate_permission": dict{
- "permission": "OnlyAddress",
- "address": "cosmos1ve557a5g9yw2g2z57js3pdmcvd5my6g8ze20np",
- },
- "deposit": []dict{{"denom": "ustake", "amount": "10"}},
- "proposer": "cosmos1ve557a5g9yw2g2z57js3pdmcvd5my6g8ze20np",
- "base_req": aBaseReq,
- },
- expCode: http.StatusBadRequest,
- },
- "store-code with incomplete content data: no code hash": {
- srcPath: "/gov/proposals/wasm_store_code",
- srcBody: dict{
- "title": "Test Proposal",
- "description": "My proposal",
- "type": "store-code",
- "run_as": "cosmos100dejzacpanrldpjjwksjm62shqhyss44jf5xz",
- "wasm_byte_code": "",
- "builder": "cosmwasm/workspace-optimizer:v0.12.9",
- "source": "https://example.com/",
- "instantiate_permission": dict{
- "permission": "OnlyAddress",
- "address": "cosmos1ve557a5g9yw2g2z57js3pdmcvd5my6g8ze20np",
- },
- "deposit": []dict{{"denom": "ustake", "amount": "10"}},
- "proposer": "cosmos1ve557a5g9yw2g2z57js3pdmcvd5my6g8ze20np",
- "base_req": aBaseReq,
- },
- expCode: http.StatusBadRequest,
- },
- "store-code with incomplete content data: no source": {
- srcPath: "/gov/proposals/wasm_store_code",
- srcBody: dict{
- "title": "Test Proposal",
- "description": "My proposal",
- "type": "store-code",
- "run_as": "cosmos100dejzacpanrldpjjwksjm62shqhyss44jf5xz",
- "wasm_byte_code": "",
- "builder": "cosmwasm/workspace-optimizer:v0.12.9",
- "code_hash": "79F174F09BFE3F83398BF7C147929D5F735161BD46D645E85216BB13BF91D42D",
- "instantiate_permission": dict{
- "permission": "OnlyAddress",
- "address": "cosmos1ve557a5g9yw2g2z57js3pdmcvd5my6g8ze20np",
- },
- "deposit": []dict{{"denom": "ustake", "amount": "10"}},
- "proposer": "cosmos1ve557a5g9yw2g2z57js3pdmcvd5my6g8ze20np",
- "base_req": aBaseReq,
- },
- expCode: http.StatusBadRequest,
- },
- "instantiate contract": {
- srcPath: "/gov/proposals/wasm_instantiate",
- srcBody: dict{
- "title": "Test Proposal",
- "description": "My proposal",
- "type": "instantiate",
- "run_as": "cosmos100dejzacpanrldpjjwksjm62shqhyss44jf5xz",
- "admin": "cosmos100dejzacpanrldpjjwksjm62shqhyss44jf5xz",
- "code_id": "1",
- "label": "https://example.com/",
- "msg": dict{"recipient": "cosmos100dejzacpanrldpjjwksjm62shqhyss44jf5xz"},
- "funds": []dict{{"denom": "ustake", "amount": "100"}},
- "deposit": []dict{{"denom": "ustake", "amount": "10"}},
- "proposer": "cosmos1ve557a5g9yw2g2z57js3pdmcvd5my6g8ze20np",
- "base_req": aBaseReq,
- },
- expCode: http.StatusOK,
- },
- "migrate contract": {
- srcPath: "/gov/proposals/wasm_migrate",
- srcBody: dict{
- "title": "Test Proposal",
- "description": "My proposal",
- "type": "migrate",
- "contract": "cosmos14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s4hmalr",
- "code_id": "1",
- "msg": dict{"foo": "bar"},
- "run_as": "cosmos100dejzacpanrldpjjwksjm62shqhyss44jf5xz",
- "deposit": []dict{{"denom": "ustake", "amount": "10"}},
- "proposer": "cosmos1ve557a5g9yw2g2z57js3pdmcvd5my6g8ze20np",
- "base_req": aBaseReq,
- },
- expCode: http.StatusOK,
- },
- "execute contract": {
- srcPath: "/gov/proposals/wasm_execute",
- srcBody: dict{
- "title": "Test Proposal",
- "description": "My proposal",
- "type": "migrate",
- "contract": "cosmos14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s4hmalr",
- "msg": dict{"foo": "bar"},
- "run_as": "cosmos100dejzacpanrldpjjwksjm62shqhyss44jf5xz",
- "deposit": []dict{{"denom": "ustake", "amount": "10"}},
- "proposer": "cosmos1ve557a5g9yw2g2z57js3pdmcvd5my6g8ze20np",
- "base_req": aBaseReq,
- },
- expCode: http.StatusOK,
- },
- "execute contract fails with no run_as": {
- srcPath: "/gov/proposals/wasm_execute",
- srcBody: dict{
- "title": "Test Proposal",
- "description": "My proposal",
- "type": "migrate",
- "contract": "cosmos14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s4hmalr",
- "msg": dict{"foo": "bar"},
- "deposit": []dict{{"denom": "ustake", "amount": "10"}},
- "proposer": "cosmos1ve557a5g9yw2g2z57js3pdmcvd5my6g8ze20np",
- "base_req": aBaseReq,
- },
- expCode: http.StatusBadRequest,
- },
- "execute contract fails with no message": {
- srcPath: "/gov/proposals/wasm_execute",
- srcBody: dict{
- "title": "Test Proposal",
- "description": "My proposal",
- "type": "migrate",
- "contract": "cosmos14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s4hmalr",
- "run_as": "cosmos100dejzacpanrldpjjwksjm62shqhyss44jf5xz",
- "deposit": []dict{{"denom": "ustake", "amount": "10"}},
- "proposer": "cosmos1ve557a5g9yw2g2z57js3pdmcvd5my6g8ze20np",
- "base_req": aBaseReq,
- },
- expCode: http.StatusBadRequest,
- },
- "sudo contract": {
- srcPath: "/gov/proposals/wasm_sudo",
- srcBody: dict{
- "title": "Test Proposal",
- "description": "My proposal",
- "type": "migrate",
- "contract": "cosmos14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s4hmalr",
- "msg": dict{"foo": "bar"},
- "deposit": []dict{{"denom": "ustake", "amount": "10"}},
- "proposer": "cosmos1ve557a5g9yw2g2z57js3pdmcvd5my6g8ze20np",
- "base_req": aBaseReq,
- },
- expCode: http.StatusOK,
- },
- "sudo contract fails with no message": {
- srcPath: "/gov/proposals/wasm_sudo",
- srcBody: dict{
- "title": "Test Proposal",
- "description": "My proposal",
- "type": "migrate",
- "contract": "cosmos14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s4hmalr",
- "deposit": []dict{{"denom": "ustake", "amount": "10"}},
- "proposer": "cosmos1ve557a5g9yw2g2z57js3pdmcvd5my6g8ze20np",
- "base_req": aBaseReq,
- },
- expCode: http.StatusBadRequest,
- },
- "update contract admin": {
- srcPath: "/gov/proposals/wasm_update_admin",
- srcBody: dict{
- "title": "Test Proposal",
- "description": "My proposal",
- "type": "migrate",
- "contract": "cosmos14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s4hmalr",
- "new_admin": "cosmos100dejzacpanrldpjjwksjm62shqhyss44jf5xz",
- "deposit": []dict{{"denom": "ustake", "amount": "10"}},
- "proposer": "cosmos1ve557a5g9yw2g2z57js3pdmcvd5my6g8ze20np",
- "base_req": aBaseReq,
- },
- expCode: http.StatusOK,
- },
- "clear contract admin": {
- srcPath: "/gov/proposals/wasm_clear_admin",
- srcBody: dict{
- "title": "Test Proposal",
- "description": "My proposal",
- "type": "migrate",
- "contract": "cosmos14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s4hmalr",
- "deposit": []dict{{"denom": "ustake", "amount": "10"}},
- "proposer": "cosmos1ve557a5g9yw2g2z57js3pdmcvd5my6g8ze20np",
- "base_req": aBaseReq,
- },
- expCode: http.StatusOK,
- },
- }
- for msg, spec := range specs {
- t.Run(msg, func(t *testing.T) {
- src, err := json.Marshal(spec.srcBody)
- require.NoError(t, err)
-
- // when
- r := httptest.NewRequest("POST", spec.srcPath, bytes.NewReader(src))
- w := httptest.NewRecorder()
- propSubRtr.ServeHTTP(w, r)
-
- // then
- require.Equal(t, spec.expCode, w.Code, w.Body.String())
- })
- }
-}
diff --git a/x/wasm/client/rest/gov.go b/x/wasm/client/rest/gov.go
deleted file mode 100644
index c57e3a9ac5..0000000000
--- a/x/wasm/client/rest/gov.go
+++ /dev/null
@@ -1,547 +0,0 @@
-package rest
-
-import (
- "encoding/json"
- "net/http"
-
- "github.com/cosmos/cosmos-sdk/client"
- "github.com/cosmos/cosmos-sdk/client/tx"
- sdk "github.com/cosmos/cosmos-sdk/types"
- "github.com/cosmos/cosmos-sdk/types/rest"
- govrest "github.com/cosmos/cosmos-sdk/x/gov/client/rest"
- govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
-
- "github.com/CosmWasm/wasmd/x/wasm/types"
-)
-
-type StoreCodeProposalJSONReq struct {
- BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"`
-
- Title string `json:"title" yaml:"title"`
- Description string `json:"description" yaml:"description"`
- Proposer string `json:"proposer" yaml:"proposer"`
- Deposit sdk.Coins `json:"deposit" yaml:"deposit"`
-
- RunAs string `json:"run_as" yaml:"run_as"`
- // WASMByteCode can be raw or gzip compressed
- WASMByteCode []byte `json:"wasm_byte_code" yaml:"wasm_byte_code"`
- // InstantiatePermission to apply on contract creation, optional
- InstantiatePermission *types.AccessConfig `json:"instantiate_permission" yaml:"instantiate_permission"`
-
- // UnpinCode indicates if the code should not be pinned as part of the proposal.
- UnpinCode bool `json:"unpin_code" yaml:"unpin_code"`
-
- // Source is the URL where the code is hosted
- Source string `json:"source" yaml:"source"`
- // Builder is the docker image used to build the code deterministically, used for smart
- // contract verification
- Builder string `json:"builder" yaml:"builder"`
- // CodeHash is the SHA256 sum of the code outputted by optimizer, used for smart contract verification
- CodeHash []byte `json:"code_hash" yaml:"code_hash"`
-}
-
-func (s StoreCodeProposalJSONReq) Content() govtypes.Content {
- return &types.StoreCodeProposal{
- Title: s.Title,
- Description: s.Description,
- RunAs: s.RunAs,
- WASMByteCode: s.WASMByteCode,
- InstantiatePermission: s.InstantiatePermission,
- UnpinCode: s.UnpinCode,
- Source: s.Source,
- Builder: s.Builder,
- CodeHash: s.CodeHash,
- }
-}
-
-func (s StoreCodeProposalJSONReq) GetProposer() string {
- return s.Proposer
-}
-
-func (s StoreCodeProposalJSONReq) GetDeposit() sdk.Coins {
- return s.Deposit
-}
-
-func (s StoreCodeProposalJSONReq) GetBaseReq() rest.BaseReq {
- return s.BaseReq
-}
-
-func StoreCodeProposalHandler(cliCtx client.Context) govrest.ProposalRESTHandler {
- return govrest.ProposalRESTHandler{
- SubRoute: "wasm_store_code",
- Handler: func(w http.ResponseWriter, r *http.Request) {
- var req StoreCodeProposalJSONReq
- if !rest.ReadRESTReq(w, r, cliCtx.LegacyAmino, &req) {
- return
- }
- toStdTxResponse(cliCtx, w, req)
- },
- }
-}
-
-type InstantiateProposalJSONReq struct {
- BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"`
-
- Title string `json:"title" yaml:"title"`
- Description string `json:"description" yaml:"description"`
-
- Proposer string `json:"proposer" yaml:"proposer"`
- Deposit sdk.Coins `json:"deposit" yaml:"deposit"`
-
- RunAs string `json:"run_as" yaml:"run_as"`
- // Admin is an optional address that can execute migrations
- Admin string `json:"admin,omitempty" yaml:"admin"`
- Code uint64 `json:"code_id" yaml:"code_id"`
- Label string `json:"label" yaml:"label"`
- Msg json.RawMessage `json:"msg" yaml:"msg"`
- Funds sdk.Coins `json:"funds" yaml:"funds"`
-}
-
-func (s InstantiateProposalJSONReq) Content() govtypes.Content {
- return &types.InstantiateContractProposal{
- Title: s.Title,
- Description: s.Description,
- RunAs: s.RunAs,
- Admin: s.Admin,
- CodeID: s.Code,
- Label: s.Label,
- Msg: types.RawContractMessage(s.Msg),
- Funds: s.Funds,
- }
-}
-
-func (s InstantiateProposalJSONReq) GetProposer() string {
- return s.Proposer
-}
-
-func (s InstantiateProposalJSONReq) GetDeposit() sdk.Coins {
- return s.Deposit
-}
-
-func (s InstantiateProposalJSONReq) GetBaseReq() rest.BaseReq {
- return s.BaseReq
-}
-
-func InstantiateProposalHandler(cliCtx client.Context) govrest.ProposalRESTHandler {
- return govrest.ProposalRESTHandler{
- SubRoute: "wasm_instantiate",
- Handler: func(w http.ResponseWriter, r *http.Request) {
- var req InstantiateProposalJSONReq
- if !rest.ReadRESTReq(w, r, cliCtx.LegacyAmino, &req) {
- return
- }
- toStdTxResponse(cliCtx, w, req)
- },
- }
-}
-
-type MigrateProposalJSONReq struct {
- BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"`
-
- Title string `json:"title" yaml:"title"`
- Description string `json:"description" yaml:"description"`
-
- Proposer string `json:"proposer" yaml:"proposer"`
- Deposit sdk.Coins `json:"deposit" yaml:"deposit"`
-
- Contract string `json:"contract" yaml:"contract"`
- Code uint64 `json:"code_id" yaml:"code_id"`
- Msg json.RawMessage `json:"msg" yaml:"msg"`
-}
-
-func (s MigrateProposalJSONReq) Content() govtypes.Content {
- return &types.MigrateContractProposal{
- Title: s.Title,
- Description: s.Description,
- Contract: s.Contract,
- CodeID: s.Code,
- Msg: types.RawContractMessage(s.Msg),
- }
-}
-
-func (s MigrateProposalJSONReq) GetProposer() string {
- return s.Proposer
-}
-
-func (s MigrateProposalJSONReq) GetDeposit() sdk.Coins {
- return s.Deposit
-}
-
-func (s MigrateProposalJSONReq) GetBaseReq() rest.BaseReq {
- return s.BaseReq
-}
-
-func MigrateProposalHandler(cliCtx client.Context) govrest.ProposalRESTHandler {
- return govrest.ProposalRESTHandler{
- SubRoute: "wasm_migrate",
- Handler: func(w http.ResponseWriter, r *http.Request) {
- var req MigrateProposalJSONReq
- if !rest.ReadRESTReq(w, r, cliCtx.LegacyAmino, &req) {
- return
- }
- toStdTxResponse(cliCtx, w, req)
- },
- }
-}
-
-type ExecuteProposalJSONReq struct {
- BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"`
-
- Title string `json:"title" yaml:"title"`
- Description string `json:"description" yaml:"description"`
-
- Proposer string `json:"proposer" yaml:"proposer"`
- Deposit sdk.Coins `json:"deposit" yaml:"deposit"`
-
- Contract string `json:"contract" yaml:"contract"`
- Msg json.RawMessage `json:"msg" yaml:"msg"`
- // RunAs is the role that is passed to the contract's environment
- RunAs string `json:"run_as" yaml:"run_as"`
- Funds sdk.Coins `json:"funds" yaml:"funds"`
-}
-
-func (s ExecuteProposalJSONReq) Content() govtypes.Content {
- return &types.ExecuteContractProposal{
- Title: s.Title,
- Description: s.Description,
- Contract: s.Contract,
- Msg: types.RawContractMessage(s.Msg),
- RunAs: s.RunAs,
- Funds: s.Funds,
- }
-}
-
-func (s ExecuteProposalJSONReq) GetProposer() string {
- return s.Proposer
-}
-
-func (s ExecuteProposalJSONReq) GetDeposit() sdk.Coins {
- return s.Deposit
-}
-
-func (s ExecuteProposalJSONReq) GetBaseReq() rest.BaseReq {
- return s.BaseReq
-}
-
-func ExecuteProposalHandler(cliCtx client.Context) govrest.ProposalRESTHandler {
- return govrest.ProposalRESTHandler{
- SubRoute: "wasm_execute",
- Handler: func(w http.ResponseWriter, r *http.Request) {
- var req ExecuteProposalJSONReq
- if !rest.ReadRESTReq(w, r, cliCtx.LegacyAmino, &req) {
- return
- }
- toStdTxResponse(cliCtx, w, req)
- },
- }
-}
-
-type SudoProposalJSONReq struct {
- BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"`
-
- Title string `json:"title" yaml:"title"`
- Description string `json:"description" yaml:"description"`
-
- Proposer string `json:"proposer" yaml:"proposer"`
- Deposit sdk.Coins `json:"deposit" yaml:"deposit"`
-
- Contract string `json:"contract" yaml:"contract"`
- Msg json.RawMessage `json:"msg" yaml:"msg"`
-}
-
-func (s SudoProposalJSONReq) Content() govtypes.Content {
- return &types.SudoContractProposal{
- Title: s.Title,
- Description: s.Description,
- Contract: s.Contract,
- Msg: types.RawContractMessage(s.Msg),
- }
-}
-
-func (s SudoProposalJSONReq) GetProposer() string {
- return s.Proposer
-}
-
-func (s SudoProposalJSONReq) GetDeposit() sdk.Coins {
- return s.Deposit
-}
-
-func (s SudoProposalJSONReq) GetBaseReq() rest.BaseReq {
- return s.BaseReq
-}
-
-func SudoProposalHandler(cliCtx client.Context) govrest.ProposalRESTHandler {
- return govrest.ProposalRESTHandler{
- SubRoute: "wasm_sudo",
- Handler: func(w http.ResponseWriter, r *http.Request) {
- var req SudoProposalJSONReq
- if !rest.ReadRESTReq(w, r, cliCtx.LegacyAmino, &req) {
- return
- }
- toStdTxResponse(cliCtx, w, req)
- },
- }
-}
-
-type UpdateAdminJSONReq struct {
- BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"`
-
- Title string `json:"title" yaml:"title"`
- Description string `json:"description" yaml:"description"`
-
- Proposer string `json:"proposer" yaml:"proposer"`
- Deposit sdk.Coins `json:"deposit" yaml:"deposit"`
-
- NewAdmin string `json:"new_admin" yaml:"new_admin"`
- Contract string `json:"contract" yaml:"contract"`
-}
-
-func (s UpdateAdminJSONReq) Content() govtypes.Content {
- return &types.UpdateAdminProposal{
- Title: s.Title,
- Description: s.Description,
- Contract: s.Contract,
- NewAdmin: s.NewAdmin,
- }
-}
-
-func (s UpdateAdminJSONReq) GetProposer() string {
- return s.Proposer
-}
-
-func (s UpdateAdminJSONReq) GetDeposit() sdk.Coins {
- return s.Deposit
-}
-
-func (s UpdateAdminJSONReq) GetBaseReq() rest.BaseReq {
- return s.BaseReq
-}
-
-func UpdateContractAdminProposalHandler(cliCtx client.Context) govrest.ProposalRESTHandler {
- return govrest.ProposalRESTHandler{
- SubRoute: "wasm_update_admin",
- Handler: func(w http.ResponseWriter, r *http.Request) {
- var req UpdateAdminJSONReq
- if !rest.ReadRESTReq(w, r, cliCtx.LegacyAmino, &req) {
- return
- }
- toStdTxResponse(cliCtx, w, req)
- },
- }
-}
-
-type ClearAdminJSONReq struct {
- BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"`
-
- Title string `json:"title" yaml:"title"`
- Description string `json:"description" yaml:"description"`
-
- Proposer string `json:"proposer" yaml:"proposer"`
- Deposit sdk.Coins `json:"deposit" yaml:"deposit"`
-
- Contract string `json:"contract" yaml:"contract"`
-}
-
-func (s ClearAdminJSONReq) Content() govtypes.Content {
- return &types.ClearAdminProposal{
- Title: s.Title,
- Description: s.Description,
- Contract: s.Contract,
- }
-}
-
-func (s ClearAdminJSONReq) GetProposer() string {
- return s.Proposer
-}
-
-func (s ClearAdminJSONReq) GetDeposit() sdk.Coins {
- return s.Deposit
-}
-
-func (s ClearAdminJSONReq) GetBaseReq() rest.BaseReq {
- return s.BaseReq
-}
-
-func ClearContractAdminProposalHandler(cliCtx client.Context) govrest.ProposalRESTHandler {
- return govrest.ProposalRESTHandler{
- SubRoute: "wasm_clear_admin",
- Handler: func(w http.ResponseWriter, r *http.Request) {
- var req ClearAdminJSONReq
- if !rest.ReadRESTReq(w, r, cliCtx.LegacyAmino, &req) {
- return
- }
- toStdTxResponse(cliCtx, w, req)
- },
- }
-}
-
-type PinCodeJSONReq struct {
- BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"`
-
- Title string `json:"title" yaml:"title"`
- Description string `json:"description" yaml:"description"`
-
- Proposer string `json:"proposer" yaml:"proposer"`
- Deposit sdk.Coins `json:"deposit" yaml:"deposit"`
-
- CodeIDs []uint64 `json:"code_ids" yaml:"code_ids"`
-}
-
-func (s PinCodeJSONReq) Content() govtypes.Content {
- return &types.PinCodesProposal{
- Title: s.Title,
- Description: s.Description,
- CodeIDs: s.CodeIDs,
- }
-}
-
-func (s PinCodeJSONReq) GetProposer() string {
- return s.Proposer
-}
-
-func (s PinCodeJSONReq) GetDeposit() sdk.Coins {
- return s.Deposit
-}
-
-func (s PinCodeJSONReq) GetBaseReq() rest.BaseReq {
- return s.BaseReq
-}
-
-func PinCodeProposalHandler(cliCtx client.Context) govrest.ProposalRESTHandler {
- return govrest.ProposalRESTHandler{
- SubRoute: "pin_code",
- Handler: func(w http.ResponseWriter, r *http.Request) {
- var req PinCodeJSONReq
- if !rest.ReadRESTReq(w, r, cliCtx.LegacyAmino, &req) {
- return
- }
- toStdTxResponse(cliCtx, w, req)
- },
- }
-}
-
-type UnpinCodeJSONReq struct {
- BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"`
-
- Title string `json:"title" yaml:"title"`
- Description string `json:"description" yaml:"description"`
-
- Proposer string `json:"proposer" yaml:"proposer"`
- Deposit sdk.Coins `json:"deposit" yaml:"deposit"`
-
- CodeIDs []uint64 `json:"code_ids" yaml:"code_ids"`
-}
-
-func (s UnpinCodeJSONReq) Content() govtypes.Content {
- return &types.UnpinCodesProposal{
- Title: s.Title,
- Description: s.Description,
- CodeIDs: s.CodeIDs,
- }
-}
-
-func (s UnpinCodeJSONReq) GetProposer() string {
- return s.Proposer
-}
-
-func (s UnpinCodeJSONReq) GetDeposit() sdk.Coins {
- return s.Deposit
-}
-
-func (s UnpinCodeJSONReq) GetBaseReq() rest.BaseReq {
- return s.BaseReq
-}
-
-func UnpinCodeProposalHandler(cliCtx client.Context) govrest.ProposalRESTHandler {
- return govrest.ProposalRESTHandler{
- SubRoute: "unpin_code",
- Handler: func(w http.ResponseWriter, r *http.Request) {
- var req UnpinCodeJSONReq
- if !rest.ReadRESTReq(w, r, cliCtx.LegacyAmino, &req) {
- return
- }
- toStdTxResponse(cliCtx, w, req)
- },
- }
-}
-
-type UpdateInstantiateConfigProposalJSONReq struct {
- BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"`
-
- Title string `json:"title" yaml:"title"`
- Description string `json:"description" yaml:"description"`
- Proposer string `json:"proposer" yaml:"proposer"`
- Deposit sdk.Coins `json:"deposit" yaml:"deposit"`
- AccessConfigUpdates []types.AccessConfigUpdate `json:"access_config_updates" yaml:"access_config_updates"`
-}
-
-func (s UpdateInstantiateConfigProposalJSONReq) Content() govtypes.Content {
- return &types.UpdateInstantiateConfigProposal{
- Title: s.Title,
- Description: s.Description,
- AccessConfigUpdates: s.AccessConfigUpdates,
- }
-}
-
-func (s UpdateInstantiateConfigProposalJSONReq) GetProposer() string {
- return s.Proposer
-}
-
-func (s UpdateInstantiateConfigProposalJSONReq) GetDeposit() sdk.Coins {
- return s.Deposit
-}
-
-func (s UpdateInstantiateConfigProposalJSONReq) GetBaseReq() rest.BaseReq {
- return s.BaseReq
-}
-
-func UpdateInstantiateConfigProposalHandler(cliCtx client.Context) govrest.ProposalRESTHandler {
- return govrest.ProposalRESTHandler{
- SubRoute: "update_instantiate_config",
- Handler: func(w http.ResponseWriter, r *http.Request) {
- var req UpdateInstantiateConfigProposalJSONReq
- if !rest.ReadRESTReq(w, r, cliCtx.LegacyAmino, &req) {
- return
- }
- toStdTxResponse(cliCtx, w, req)
- },
- }
-}
-
-type wasmProposalData interface {
- Content() govtypes.Content
- GetProposer() string
- GetDeposit() sdk.Coins
- GetBaseReq() rest.BaseReq
-}
-
-func toStdTxResponse(cliCtx client.Context, w http.ResponseWriter, data wasmProposalData) {
- proposerAddr, err := sdk.AccAddressFromBech32(data.GetProposer())
- if err != nil {
- rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error())
- return
- }
- msg, err := govtypes.NewMsgSubmitProposal(data.Content(), data.GetDeposit(), proposerAddr)
- if err != nil {
- rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error())
- return
- }
- if err := msg.ValidateBasic(); err != nil {
- rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error())
- return
- }
- baseReq := data.GetBaseReq().Sanitize()
- if !baseReq.ValidateBasic(w) {
- return
- }
- tx.WriteGeneratedTxResponse(cliCtx, w, baseReq, msg)
-}
-
-func EmptyRestHandler(cliCtx client.Context) govrest.ProposalRESTHandler {
- return govrest.ProposalRESTHandler{
- SubRoute: "unsupported",
- Handler: func(w http.ResponseWriter, r *http.Request) {
- rest.WriteErrorResponse(w, http.StatusBadRequest, "Legacy REST Routes are not supported for gov proposals")
- },
- }
-}
diff --git a/x/wasm/client/rest/new_tx.go b/x/wasm/client/rest/new_tx.go
deleted file mode 100644
index b261fd7fb7..0000000000
--- a/x/wasm/client/rest/new_tx.go
+++ /dev/null
@@ -1,86 +0,0 @@
-package rest
-
-import (
- "net/http"
-
- "github.com/cosmos/cosmos-sdk/client"
- "github.com/cosmos/cosmos-sdk/client/tx"
- "github.com/cosmos/cosmos-sdk/types/rest"
- "github.com/gorilla/mux"
-
- "github.com/CosmWasm/wasmd/x/wasm/types"
-)
-
-func registerNewTxRoutes(cliCtx client.Context, r *mux.Router) {
- r.HandleFunc("/wasm/contract/{contractAddr}/admin", setContractAdminHandlerFn(cliCtx)).Methods("PUT")
- r.HandleFunc("/wasm/contract/{contractAddr}/code", migrateContractHandlerFn(cliCtx)).Methods("PUT")
-}
-
-type migrateContractReq struct {
- BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"`
- Admin string `json:"admin,omitempty" yaml:"admin"`
- CodeID uint64 `json:"code_id" yaml:"code_id"`
- Msg []byte `json:"msg,omitempty" yaml:"msg"`
-}
-
-type updateContractAdministrateReq struct {
- BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"`
- Admin string `json:"admin,omitempty" yaml:"admin"`
-}
-
-func setContractAdminHandlerFn(cliCtx client.Context) http.HandlerFunc {
- return func(w http.ResponseWriter, r *http.Request) {
- var req updateContractAdministrateReq
- if !rest.ReadRESTReq(w, r, cliCtx.LegacyAmino, &req) {
- return
- }
- vars := mux.Vars(r)
- contractAddr := vars["contractAddr"]
-
- req.BaseReq = req.BaseReq.Sanitize()
- if !req.BaseReq.ValidateBasic(w) {
- return
- }
-
- msg := &types.MsgUpdateAdmin{
- Sender: req.BaseReq.From,
- NewAdmin: req.Admin,
- Contract: contractAddr,
- }
- if err := msg.ValidateBasic(); err != nil {
- rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error())
- return
- }
-
- tx.WriteGeneratedTxResponse(cliCtx, w, req.BaseReq, msg)
- }
-}
-
-func migrateContractHandlerFn(cliCtx client.Context) http.HandlerFunc {
- return func(w http.ResponseWriter, r *http.Request) {
- var req migrateContractReq
- if !rest.ReadRESTReq(w, r, cliCtx.LegacyAmino, &req) {
- return
- }
- vars := mux.Vars(r)
- contractAddr := vars["contractAddr"]
-
- req.BaseReq = req.BaseReq.Sanitize()
- if !req.BaseReq.ValidateBasic(w) {
- return
- }
-
- msg := &types.MsgMigrateContract{
- Sender: req.BaseReq.From,
- Contract: contractAddr,
- CodeID: req.CodeID,
- Msg: req.Msg,
- }
- if err := msg.ValidateBasic(); err != nil {
- rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error())
- return
- }
-
- tx.WriteGeneratedTxResponse(cliCtx, w, req.BaseReq, msg)
- }
-}
diff --git a/x/wasm/client/rest/query.go b/x/wasm/client/rest/query.go
deleted file mode 100644
index d497d23900..0000000000
--- a/x/wasm/client/rest/query.go
+++ /dev/null
@@ -1,270 +0,0 @@
-package rest
-
-import (
- "encoding/base64"
- "encoding/hex"
- "encoding/json"
- "fmt"
- "net/http"
- "strconv"
-
- "github.com/cosmos/cosmos-sdk/client"
- sdk "github.com/cosmos/cosmos-sdk/types"
- "github.com/cosmos/cosmos-sdk/types/rest"
- "github.com/gorilla/mux"
-
- "github.com/CosmWasm/wasmd/x/wasm/keeper"
- "github.com/CosmWasm/wasmd/x/wasm/types"
-)
-
-func registerQueryRoutes(cliCtx client.Context, r *mux.Router) {
- r.HandleFunc("/wasm/code", listCodesHandlerFn(cliCtx)).Methods("GET")
- r.HandleFunc("/wasm/code/{codeID}", queryCodeHandlerFn(cliCtx)).Methods("GET")
- r.HandleFunc("/wasm/code/{codeID}/contracts", listContractsByCodeHandlerFn(cliCtx)).Methods("GET")
- r.HandleFunc("/wasm/contract/{contractAddr}", queryContractHandlerFn(cliCtx)).Methods("GET")
- r.HandleFunc("/wasm/contract/{contractAddr}/state", queryContractStateAllHandlerFn(cliCtx)).Methods("GET")
- r.HandleFunc("/wasm/contract/{contractAddr}/history", queryContractHistoryFn(cliCtx)).Methods("GET")
- r.HandleFunc("/wasm/contract/{contractAddr}/smart/{query}", queryContractStateSmartHandlerFn(cliCtx)).Queries("encoding", "{encoding}").Methods("GET")
- r.HandleFunc("/wasm/contract/{contractAddr}/raw/{key}", queryContractStateRawHandlerFn(cliCtx)).Queries("encoding", "{encoding}").Methods("GET")
-}
-
-func listCodesHandlerFn(cliCtx client.Context) http.HandlerFunc {
- return func(w http.ResponseWriter, r *http.Request) {
- cliCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, cliCtx, r)
- if !ok {
- return
- }
-
- route := fmt.Sprintf("custom/%s/%s", types.QuerierRoute, keeper.QueryListCode)
- res, height, err := cliCtx.Query(route)
- if err != nil {
- rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error())
- return
- }
- cliCtx = cliCtx.WithHeight(height)
- rest.PostProcessResponse(w, cliCtx, json.RawMessage(res))
- }
-}
-
-func queryCodeHandlerFn(cliCtx client.Context) http.HandlerFunc {
- return func(w http.ResponseWriter, r *http.Request) {
- codeID, err := strconv.ParseUint(mux.Vars(r)["codeID"], 10, 64)
- if err != nil {
- rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error())
- return
- }
-
- cliCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, cliCtx, r)
- if !ok {
- return
- }
-
- route := fmt.Sprintf("custom/%s/%s/%d", types.QuerierRoute, keeper.QueryGetCode, codeID)
- res, height, err := cliCtx.Query(route)
- if err != nil {
- rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error())
- return
- }
- if len(res) == 0 {
- rest.WriteErrorResponse(w, http.StatusNotFound, "contract not found")
- return
- }
-
- cliCtx = cliCtx.WithHeight(height)
- rest.PostProcessResponse(w, cliCtx, json.RawMessage(res))
- }
-}
-
-func listContractsByCodeHandlerFn(cliCtx client.Context) http.HandlerFunc {
- return func(w http.ResponseWriter, r *http.Request) {
- codeID, err := strconv.ParseUint(mux.Vars(r)["codeID"], 10, 64)
- if err != nil {
- rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error())
- return
- }
- cliCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, cliCtx, r)
- if !ok {
- return
- }
-
- route := fmt.Sprintf("custom/%s/%s/%d", types.QuerierRoute, keeper.QueryListContractByCode, codeID)
- res, height, err := cliCtx.Query(route)
- if err != nil {
- rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error())
- return
- }
-
- cliCtx = cliCtx.WithHeight(height)
- rest.PostProcessResponse(w, cliCtx, json.RawMessage(res))
- }
-}
-
-func queryContractHandlerFn(cliCtx client.Context) http.HandlerFunc {
- return func(w http.ResponseWriter, r *http.Request) {
- addr, err := sdk.AccAddressFromBech32(mux.Vars(r)["contractAddr"])
- if err != nil {
- rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error())
- return
- }
- cliCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, cliCtx, r)
- if !ok {
- return
- }
-
- route := fmt.Sprintf("custom/%s/%s/%s", types.QuerierRoute, keeper.QueryGetContract, addr.String())
- res, height, err := cliCtx.Query(route)
- if err != nil {
- rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error())
- return
- }
-
- cliCtx = cliCtx.WithHeight(height)
- rest.PostProcessResponse(w, cliCtx, json.RawMessage(res))
- }
-}
-
-func queryContractStateAllHandlerFn(cliCtx client.Context) http.HandlerFunc {
- return func(w http.ResponseWriter, r *http.Request) {
- addr, err := sdk.AccAddressFromBech32(mux.Vars(r)["contractAddr"])
- if err != nil {
- rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error())
- return
- }
- cliCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, cliCtx, r)
- if !ok {
- return
- }
-
- route := fmt.Sprintf("custom/%s/%s/%s/%s", types.QuerierRoute, keeper.QueryGetContractState, addr.String(), keeper.QueryMethodContractStateAll)
- res, height, err := cliCtx.Query(route)
- if err != nil {
- rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error())
- return
- }
-
- // parse res
- var resultData []types.Model
- err = json.Unmarshal(res, &resultData)
- if err != nil {
- rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error())
- return
- }
-
- cliCtx = cliCtx.WithHeight(height)
- rest.PostProcessResponse(w, cliCtx, resultData)
- }
-}
-
-func queryContractStateRawHandlerFn(cliCtx client.Context) http.HandlerFunc {
- return func(w http.ResponseWriter, r *http.Request) {
- decoder := newArgDecoder(hex.DecodeString)
- addr, err := sdk.AccAddressFromBech32(mux.Vars(r)["contractAddr"])
- if err != nil {
- rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error())
- return
- }
- decoder.encoding = mux.Vars(r)["encoding"]
- queryData, err := decoder.DecodeString(mux.Vars(r)["key"])
- if err != nil {
- rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error())
- return
- }
- cliCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, cliCtx, r)
- if !ok {
- return
- }
-
- route := fmt.Sprintf("custom/%s/%s/%s/%s", types.QuerierRoute, keeper.QueryGetContractState, addr.String(), keeper.QueryMethodContractStateRaw)
- res, height, err := cliCtx.QueryWithData(route, queryData)
- if err != nil {
- rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error())
- return
- }
- cliCtx = cliCtx.WithHeight(height)
- // ensure this is base64 encoded
- encoded := base64.StdEncoding.EncodeToString(res)
- rest.PostProcessResponse(w, cliCtx, encoded)
- }
-}
-
-type smartResponse struct {
- Smart []byte `json:"smart"`
-}
-
-func queryContractStateSmartHandlerFn(cliCtx client.Context) http.HandlerFunc {
- return func(w http.ResponseWriter, r *http.Request) {
- decoder := newArgDecoder(hex.DecodeString)
- addr, err := sdk.AccAddressFromBech32(mux.Vars(r)["contractAddr"])
- if err != nil {
- rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error())
- return
- }
- decoder.encoding = mux.Vars(r)["encoding"]
- cliCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, cliCtx, r)
- if !ok {
- return
- }
-
- route := fmt.Sprintf("custom/%s/%s/%s/%s", types.QuerierRoute, keeper.QueryGetContractState, addr.String(), keeper.QueryMethodContractStateSmart)
-
- queryData, err := decoder.DecodeString(mux.Vars(r)["query"])
- if err != nil {
- rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error())
- return
- }
- res, height, err := cliCtx.QueryWithData(route, queryData)
- if err != nil {
- rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error())
- return
- }
- // return as raw bytes (to be base64-encoded)
- responseData := smartResponse{Smart: res}
-
- cliCtx = cliCtx.WithHeight(height)
- rest.PostProcessResponse(w, cliCtx, responseData)
- }
-}
-
-func queryContractHistoryFn(cliCtx client.Context) http.HandlerFunc {
- return func(w http.ResponseWriter, r *http.Request) {
- addr, err := sdk.AccAddressFromBech32(mux.Vars(r)["contractAddr"])
- if err != nil {
- rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error())
- return
- }
- cliCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, cliCtx, r)
- if !ok {
- return
- }
-
- route := fmt.Sprintf("custom/%s/%s/%s", types.QuerierRoute, keeper.QueryContractHistory, addr.String())
- res, height, err := cliCtx.Query(route)
- if err != nil {
- rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error())
- return
- }
- cliCtx = cliCtx.WithHeight(height)
- rest.PostProcessResponse(w, cliCtx, json.RawMessage(res))
- }
-}
-
-type argumentDecoder struct {
- // dec is the default decoder
- dec func(string) ([]byte, error)
- encoding string
-}
-
-func newArgDecoder(def func(string) ([]byte, error)) *argumentDecoder {
- return &argumentDecoder{dec: def}
-}
-
-func (a *argumentDecoder) DecodeString(s string) ([]byte, error) {
- switch a.encoding {
- case "hex":
- return hex.DecodeString(s)
- case "base64":
- return base64.StdEncoding.DecodeString(s)
- default:
- return a.dec(s)
- }
-}
diff --git a/x/wasm/client/rest/rest.go b/x/wasm/client/rest/rest.go
deleted file mode 100644
index 95339d3aa0..0000000000
--- a/x/wasm/client/rest/rest.go
+++ /dev/null
@@ -1,15 +0,0 @@
-// Deprecated: the rest package will be removed. You can use the GRPC gateway instead
-package rest
-
-import (
- "github.com/cosmos/cosmos-sdk/client"
- "github.com/gorilla/mux"
-)
-
-// RegisterRoutes registers staking-related REST handlers to a router
-// Deprecated: the rest package will be removed. You can use the GRPC gateway instead
-func RegisterRoutes(cliCtx client.Context, r *mux.Router) {
- registerQueryRoutes(cliCtx, r)
- registerTxRoutes(cliCtx, r)
- registerNewTxRoutes(cliCtx, r)
-}
diff --git a/x/wasm/client/rest/tx.go b/x/wasm/client/rest/tx.go
deleted file mode 100644
index 17407c4b6a..0000000000
--- a/x/wasm/client/rest/tx.go
+++ /dev/null
@@ -1,149 +0,0 @@
-package rest
-
-import (
- "net/http"
- "strconv"
-
- "github.com/cosmos/cosmos-sdk/client"
- "github.com/cosmos/cosmos-sdk/client/tx"
- sdk "github.com/cosmos/cosmos-sdk/types"
- "github.com/cosmos/cosmos-sdk/types/rest"
- "github.com/gorilla/mux"
-
- "github.com/CosmWasm/wasmd/x/wasm/ioutils"
- "github.com/CosmWasm/wasmd/x/wasm/types"
-)
-
-func registerTxRoutes(cliCtx client.Context, r *mux.Router) {
- r.HandleFunc("/wasm/code", storeCodeHandlerFn(cliCtx)).Methods("POST")
- r.HandleFunc("/wasm/code/{codeId}", instantiateContractHandlerFn(cliCtx)).Methods("POST")
- r.HandleFunc("/wasm/contract/{contractAddr}", executeContractHandlerFn(cliCtx)).Methods("POST")
-}
-
-type storeCodeReq struct {
- BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"`
- WasmBytes []byte `json:"wasm_bytes"`
-}
-
-type instantiateContractReq struct {
- BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"`
- Label string `json:"label" yaml:"label"`
- Deposit sdk.Coins `json:"deposit" yaml:"deposit"`
- Admin string `json:"admin,omitempty" yaml:"admin"`
- Msg []byte `json:"msg" yaml:"msg"`
-}
-
-type executeContractReq struct {
- BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"`
- ExecMsg []byte `json:"exec_msg" yaml:"exec_msg"`
- Amount sdk.Coins `json:"coins" yaml:"coins"`
-}
-
-func storeCodeHandlerFn(cliCtx client.Context) http.HandlerFunc {
- return func(w http.ResponseWriter, r *http.Request) {
- var req storeCodeReq
- if !rest.ReadRESTReq(w, r, cliCtx.LegacyAmino, &req) {
- return
- }
-
- req.BaseReq = req.BaseReq.Sanitize()
- if !req.BaseReq.ValidateBasic(w) {
- return
- }
-
- var err error
- wasm := req.WasmBytes
-
- // gzip the wasm file
- if ioutils.IsWasm(wasm) {
- wasm, err = ioutils.GzipIt(wasm)
- if err != nil {
- rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error())
- return
- }
- } else if !ioutils.IsGzip(wasm) {
- rest.WriteErrorResponse(w, http.StatusBadRequest, "Invalid input file, use wasm binary or zip")
- return
- }
-
- // build and sign the transaction, then broadcast to Tendermint
- msg := types.MsgStoreCode{
- Sender: req.BaseReq.From,
- WASMByteCode: wasm,
- }
-
- if err := msg.ValidateBasic(); err != nil {
- rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error())
- return
- }
-
- tx.WriteGeneratedTxResponse(cliCtx, w, req.BaseReq, &msg)
- }
-}
-
-func instantiateContractHandlerFn(cliCtx client.Context) http.HandlerFunc {
- return func(w http.ResponseWriter, r *http.Request) {
- var req instantiateContractReq
- if !rest.ReadRESTReq(w, r, cliCtx.LegacyAmino, &req) {
- return
- }
- vars := mux.Vars(r)
-
- req.BaseReq = req.BaseReq.Sanitize()
- if !req.BaseReq.ValidateBasic(w) {
- return
- }
-
- // get the id of the code to instantiate
- codeID, err := strconv.ParseUint(vars["codeId"], 10, 64)
- if err != nil {
- return
- }
-
- msg := types.MsgInstantiateContract{
- Sender: req.BaseReq.From,
- CodeID: codeID,
- Label: req.Label,
- Funds: req.Deposit,
- Msg: req.Msg,
- Admin: req.Admin,
- }
-
- if err := msg.ValidateBasic(); err != nil {
- rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error())
- return
- }
-
- tx.WriteGeneratedTxResponse(cliCtx, w, req.BaseReq, &msg)
- }
-}
-
-func executeContractHandlerFn(cliCtx client.Context) http.HandlerFunc {
- return func(w http.ResponseWriter, r *http.Request) {
- var req executeContractReq
- if !rest.ReadRESTReq(w, r, cliCtx.LegacyAmino, &req) {
- return
- }
- vars := mux.Vars(r)
- contractAddr := vars["contractAddr"]
-
- req.BaseReq = req.BaseReq.Sanitize()
- if !req.BaseReq.ValidateBasic(w) {
- return
- }
-
- msg := types.MsgExecuteContract{
- Sender: req.BaseReq.From,
- Contract: contractAddr,
- Msg: req.ExecMsg,
- Funds: req.Amount,
- }
-
- if err := msg.ValidateBasic(); err != nil {
- rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error())
- return
- }
-
- tx.WriteGeneratedTxResponse(cliCtx, w, req.BaseReq, &msg)
- }
-}
diff --git a/x/wasm/exported/exported.go b/x/wasm/exported/exported.go
new file mode 100644
index 0000000000..000114e619
--- /dev/null
+++ b/x/wasm/exported/exported.go
@@ -0,0 +1,18 @@
+package exported
+
+import (
+ sdk "github.com/cosmos/cosmos-sdk/types"
+ paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
+)
+
+type (
+ ParamSet = paramtypes.ParamSet
+
+ // Subspace defines an interface that implements the legacy x/params Subspace
+ // type.
+ //
+ // NOTE: This is used solely for migration of x/params managed parameters.
+ Subspace interface {
+ GetParamSet(ctx sdk.Context, ps ParamSet)
+ }
+)
diff --git a/x/wasm/genesis_test.go b/x/wasm/genesis_test.go
index 9d968f87a9..83d5db2004 100644
--- a/x/wasm/genesis_test.go
+++ b/x/wasm/genesis_test.go
@@ -16,13 +16,13 @@ func TestInitGenesis(t *testing.T) {
creator := data.faucet.NewFundedRandomAccount(data.ctx, deposit.Add(deposit...)...)
fred := data.faucet.NewFundedRandomAccount(data.ctx, topUp...)
- h := data.module.Route().Handler()
- q := data.module.LegacyQuerierHandler(nil)
-
msg := MsgStoreCode{
Sender: creator.String(),
WASMByteCode: testContract,
}
+ h := data.msgServiceRouter.Handler(&msg)
+ q := data.grpcQueryRouter
+
err := msg.ValidateBasic()
require.NoError(t, err)
@@ -30,7 +30,7 @@ func TestInitGenesis(t *testing.T) {
require.NoError(t, err)
assertStoreCodeResponse(t, res.Data, 1)
- _, _, bob := keyPubAddr()
+ bob := keyPubAddr()
initMsg := initMsg{
Verifier: fred,
Beneficiary: bob,
@@ -38,59 +38,62 @@ func TestInitGenesis(t *testing.T) {
initMsgBz, err := json.Marshal(initMsg)
require.NoError(t, err)
- initCmd := MsgInstantiateContract{
+ instMsg := MsgInstantiateContract{
Sender: creator.String(),
CodeID: firstCodeID,
Msg: initMsgBz,
Funds: deposit,
Label: "testing",
}
- res, err = h(data.ctx, &initCmd)
+ h = data.msgServiceRouter.Handler(&instMsg)
+ res, err = h(data.ctx, &instMsg)
require.NoError(t, err)
contractBech32Addr := parseInitResponse(t, res.Data)
- execCmd := MsgExecuteContract{
+ execMsg := MsgExecuteContract{
Sender: fred.String(),
Contract: contractBech32Addr,
Msg: []byte(`{"release":{}}`),
Funds: topUp,
}
- res, err = h(data.ctx, &execCmd)
+ h = data.msgServiceRouter.Handler(&execMsg)
+ res, err = h(data.ctx, &execMsg)
require.NoError(t, err)
// from https://github.com/CosmWasm/cosmwasm/blob/master/contracts/hackatom/src/contract.rs#L167
assertExecuteResponse(t, res.Data, []byte{0xf0, 0x0b, 0xaa})
// ensure all contract state is as after init
- assertCodeList(t, q, data.ctx, 1)
- assertCodeBytes(t, q, data.ctx, 1, testContract)
+ assertCodeList(t, q, data.ctx, 1, data.encConf.Marshaler)
+ assertCodeBytes(t, q, data.ctx, 1, testContract, data.encConf.Marshaler)
- assertContractList(t, q, data.ctx, 1, []string{contractBech32Addr})
- assertContractInfo(t, q, data.ctx, contractBech32Addr, 1, creator)
+ assertContractList(t, q, data.ctx, 1, []string{contractBech32Addr}, data.encConf.Marshaler)
+ assertContractInfo(t, q, data.ctx, contractBech32Addr, 1, creator, data.encConf.Marshaler)
assertContractState(t, q, data.ctx, contractBech32Addr, state{
Verifier: fred.String(),
Beneficiary: bob.String(),
Funder: creator.String(),
- })
+ }, data.encConf.Marshaler)
// export into genstate
genState := ExportGenesis(data.ctx, &data.keeper)
// create new app to import genstate into
newData := setupTest(t)
- q2 := newData.module.LegacyQuerierHandler(nil)
+ q2 := newData.grpcQueryRouter
// initialize new app with genstate
- InitGenesis(newData.ctx, &newData.keeper, *genState)
+ _, err = InitGenesis(newData.ctx, &newData.keeper, *genState)
+ require.NoError(t, err)
// run same checks again on newdata, to make sure it was reinitialized correctly
- assertCodeList(t, q2, newData.ctx, 1)
- assertCodeBytes(t, q2, newData.ctx, 1, testContract)
+ assertCodeList(t, q2, newData.ctx, 1, data.encConf.Marshaler)
+ assertCodeBytes(t, q2, newData.ctx, 1, testContract, data.encConf.Marshaler)
- assertContractList(t, q2, newData.ctx, 1, []string{contractBech32Addr})
- assertContractInfo(t, q2, newData.ctx, contractBech32Addr, 1, creator)
+ assertContractList(t, q2, newData.ctx, 1, []string{contractBech32Addr}, data.encConf.Marshaler)
+ assertContractInfo(t, q2, newData.ctx, contractBech32Addr, 1, creator, data.encConf.Marshaler)
assertContractState(t, q2, newData.ctx, contractBech32Addr, state{
Verifier: fred.String(),
Beneficiary: bob.String(),
Funder: creator.String(),
- })
+ }, data.encConf.Marshaler)
}
diff --git a/x/wasm/handler.go b/x/wasm/handler.go
deleted file mode 100644
index b350e7d37c..0000000000
--- a/x/wasm/handler.go
+++ /dev/null
@@ -1,77 +0,0 @@
-package wasm
-
-import (
- "fmt"
-
- "github.com/gogo/protobuf/proto"
- abci "github.com/tendermint/tendermint/abci/types"
-
- "github.com/CosmWasm/wasmd/x/wasm/keeper"
- "github.com/CosmWasm/wasmd/x/wasm/types"
-
- sdk "github.com/cosmos/cosmos-sdk/types"
- sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
-)
-
-// NewHandler returns a handler for "wasm" type messages.
-func NewHandler(k types.ContractOpsKeeper) sdk.Handler {
- msgServer := keeper.NewMsgServerImpl(k)
-
- return func(ctx sdk.Context, msg sdk.Msg) (*sdk.Result, error) {
- ctx = ctx.WithEventManager(sdk.NewEventManager())
-
- var (
- res proto.Message
- err error
- )
- switch msg := msg.(type) {
- case *MsgStoreCode: //nolint:typecheck
- res, err = msgServer.StoreCode(sdk.WrapSDKContext(ctx), msg)
- case *MsgInstantiateContract:
- res, err = msgServer.InstantiateContract(sdk.WrapSDKContext(ctx), msg)
- case *MsgInstantiateContract2:
- res, err = msgServer.InstantiateContract2(sdk.WrapSDKContext(ctx), msg)
- case *MsgExecuteContract:
- res, err = msgServer.ExecuteContract(sdk.WrapSDKContext(ctx), msg)
- case *MsgMigrateContract:
- res, err = msgServer.MigrateContract(sdk.WrapSDKContext(ctx), msg)
- case *MsgUpdateAdmin:
- res, err = msgServer.UpdateAdmin(sdk.WrapSDKContext(ctx), msg)
- case *MsgClearAdmin:
- res, err = msgServer.ClearAdmin(sdk.WrapSDKContext(ctx), msg)
- case *types.MsgUpdateInstantiateConfig:
- res, err = msgServer.UpdateInstantiateConfig(sdk.WrapSDKContext(ctx), msg)
- default:
- errMsg := fmt.Sprintf("unrecognized wasm message type: %T", msg)
- return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, errMsg)
- }
-
- ctx = ctx.WithEventManager(filterMessageEvents(ctx))
- return sdk.WrapServiceResult(ctx, res, err)
- }
-}
-
-// filterMessageEvents returns the same events with all of type == EventTypeMessage removed except
-// for wasm message types.
-// this is so only our top-level message event comes through
-func filterMessageEvents(ctx sdk.Context) *sdk.EventManager {
- m := sdk.NewEventManager()
- for _, e := range ctx.EventManager().Events() {
- if e.Type == sdk.EventTypeMessage &&
- !hasWasmModuleAttribute(e.Attributes) {
- continue
- }
- m.EmitEvent(e)
- }
- return m
-}
-
-func hasWasmModuleAttribute(attrs []abci.EventAttribute) bool {
- for _, a := range attrs {
- if sdk.AttributeKeyModule == string(a.Key) &&
- types.ModuleName == string(a.Value) {
- return true
- }
- }
- return false
-}
diff --git a/x/wasm/ibc.go b/x/wasm/ibc.go
index c0f2fda6b0..b310e04cc9 100644
--- a/x/wasm/ibc.go
+++ b/x/wasm/ibc.go
@@ -3,14 +3,14 @@ package wasm
import (
"math"
+ errorsmod "cosmossdk.io/errors"
wasmvmtypes "github.com/CosmWasm/wasmvm/types"
sdk "github.com/cosmos/cosmos-sdk/types"
- sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
- channeltypes "github.com/cosmos/ibc-go/v4/modules/core/04-channel/types"
- porttypes "github.com/cosmos/ibc-go/v4/modules/core/05-port/types"
- host "github.com/cosmos/ibc-go/v4/modules/core/24-host"
- ibcexported "github.com/cosmos/ibc-go/v4/modules/core/exported"
+ channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types"
+ porttypes "github.com/cosmos/ibc-go/v7/modules/core/05-port/types"
+ host "github.com/cosmos/ibc-go/v7/modules/core/24-host"
+ ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported"
"github.com/CosmWasm/wasmd/x/wasm/types"
)
@@ -50,7 +50,7 @@ func (i IBCHandler) OnChanOpenInit(
}
contractAddr, err := ContractFromPortID(portID)
if err != nil {
- return "", sdkerrors.Wrapf(err, "contract port id")
+ return "", errorsmod.Wrapf(err, "contract port id")
}
msg := wasmvmtypes.IBCChannelOpenMsg{
@@ -71,13 +71,13 @@ func (i IBCHandler) OnChanOpenInit(
if err != nil {
return "", err
}
- if acceptedVersion == "" {
+ if acceptedVersion == "" { // accept incoming version when nothing returned by contract
acceptedVersion = version
}
// Claim channel capability passed back by IBC module
if err := i.keeper.ClaimCapability(ctx, chanCap, host.ChannelCapabilityPath(portID, channelID)); err != nil {
- return "", sdkerrors.Wrap(err, "claim capability")
+ return "", errorsmod.Wrap(err, "claim capability")
}
return acceptedVersion, nil
}
@@ -99,7 +99,7 @@ func (i IBCHandler) OnChanOpenTry(
contractAddr, err := ContractFromPortID(portID)
if err != nil {
- return "", sdkerrors.Wrapf(err, "contract port id")
+ return "", errorsmod.Wrapf(err, "contract port id")
}
msg := wasmvmtypes.IBCChannelOpenMsg{
@@ -131,7 +131,7 @@ func (i IBCHandler) OnChanOpenTry(
if !i.keeper.AuthenticateCapability(ctx, chanCap, host.ChannelCapabilityPath(portID, channelID)) {
// Only claim channel capability passed back by IBC module if we do not already own it
if err := i.keeper.ClaimCapability(ctx, chanCap, host.ChannelCapabilityPath(portID, channelID)); err != nil {
- return "", sdkerrors.Wrap(err, "claim capability")
+ return "", errorsmod.Wrap(err, "claim capability")
}
}
@@ -147,17 +147,17 @@ func (i IBCHandler) OnChanOpenAck(
) error {
contractAddr, err := ContractFromPortID(portID)
if err != nil {
- return sdkerrors.Wrapf(err, "contract port id")
+ return errorsmod.Wrapf(err, "contract port id")
}
channelInfo, ok := i.channelKeeper.GetChannel(ctx, portID, channelID)
if !ok {
- return sdkerrors.Wrapf(channeltypes.ErrChannelNotFound, "port ID (%s) channel ID (%s)", portID, channelID)
+ return errorsmod.Wrapf(channeltypes.ErrChannelNotFound, "port ID (%s) channel ID (%s)", portID, channelID)
}
channelInfo.Counterparty.ChannelId = counterpartyChannelID
appVersion, ok := i.appVersionGetter.GetAppVersion(ctx, portID, channelID)
if !ok {
- return sdkerrors.Wrapf(channeltypes.ErrInvalidChannelVersion, "port ID (%s) channel ID (%s)", portID, channelID)
+ return errorsmod.Wrapf(channeltypes.ErrInvalidChannelVersion, "port ID (%s) channel ID (%s)", portID, channelID)
}
msg := wasmvmtypes.IBCChannelConnectMsg{
@@ -173,15 +173,15 @@ func (i IBCHandler) OnChanOpenAck(
func (i IBCHandler) OnChanOpenConfirm(ctx sdk.Context, portID, channelID string) error {
contractAddr, err := ContractFromPortID(portID)
if err != nil {
- return sdkerrors.Wrapf(err, "contract port id")
+ return errorsmod.Wrapf(err, "contract port id")
}
channelInfo, ok := i.channelKeeper.GetChannel(ctx, portID, channelID)
if !ok {
- return sdkerrors.Wrapf(channeltypes.ErrChannelNotFound, "port ID (%s) channel ID (%s)", portID, channelID)
+ return errorsmod.Wrapf(channeltypes.ErrChannelNotFound, "port ID (%s) channel ID (%s)", portID, channelID)
}
appVersion, ok := i.appVersionGetter.GetAppVersion(ctx, portID, channelID)
if !ok {
- return sdkerrors.Wrapf(channeltypes.ErrInvalidChannelVersion, "port ID (%s) channel ID (%s)", portID, channelID)
+ return errorsmod.Wrapf(channeltypes.ErrInvalidChannelVersion, "port ID (%s) channel ID (%s)", portID, channelID)
}
msg := wasmvmtypes.IBCChannelConnectMsg{
OpenConfirm: &wasmvmtypes.IBCOpenConfirm{
@@ -195,15 +195,15 @@ func (i IBCHandler) OnChanOpenConfirm(ctx sdk.Context, portID, channelID string)
func (i IBCHandler) OnChanCloseInit(ctx sdk.Context, portID, channelID string) error {
contractAddr, err := ContractFromPortID(portID)
if err != nil {
- return sdkerrors.Wrapf(err, "contract port id")
+ return errorsmod.Wrapf(err, "contract port id")
}
channelInfo, ok := i.channelKeeper.GetChannel(ctx, portID, channelID)
if !ok {
- return sdkerrors.Wrapf(channeltypes.ErrChannelNotFound, "port ID (%s) channel ID (%s)", portID, channelID)
+ return errorsmod.Wrapf(channeltypes.ErrChannelNotFound, "port ID (%s) channel ID (%s)", portID, channelID)
}
appVersion, ok := i.appVersionGetter.GetAppVersion(ctx, portID, channelID)
if !ok {
- return sdkerrors.Wrapf(channeltypes.ErrInvalidChannelVersion, "port ID (%s) channel ID (%s)", portID, channelID)
+ return errorsmod.Wrapf(channeltypes.ErrInvalidChannelVersion, "port ID (%s) channel ID (%s)", portID, channelID)
}
msg := wasmvmtypes.IBCChannelCloseMsg{
@@ -223,15 +223,15 @@ func (i IBCHandler) OnChanCloseConfirm(ctx sdk.Context, portID, channelID string
// counterparty has closed the channel
contractAddr, err := ContractFromPortID(portID)
if err != nil {
- return sdkerrors.Wrapf(err, "contract port id")
+ return errorsmod.Wrapf(err, "contract port id")
}
channelInfo, ok := i.channelKeeper.GetChannel(ctx, portID, channelID)
if !ok {
- return sdkerrors.Wrapf(channeltypes.ErrChannelNotFound, "port ID (%s) channel ID (%s)", portID, channelID)
+ return errorsmod.Wrapf(channeltypes.ErrChannelNotFound, "port ID (%s) channel ID (%s)", portID, channelID)
}
appVersion, ok := i.appVersionGetter.GetAppVersion(ctx, portID, channelID)
if !ok {
- return sdkerrors.Wrapf(channeltypes.ErrInvalidChannelVersion, "port ID (%s) channel ID (%s)", portID, channelID)
+ return errorsmod.Wrapf(channeltypes.ErrInvalidChannelVersion, "port ID (%s) channel ID (%s)", portID, channelID)
}
msg := wasmvmtypes.IBCChannelCloseMsg{
@@ -264,7 +264,7 @@ func (i IBCHandler) OnRecvPacket(
) ibcexported.Acknowledgement {
contractAddr, err := ContractFromPortID(packet.DestinationPort)
if err != nil {
- return channeltypes.NewErrorAcknowledgement(sdkerrors.Wrapf(err, "contract port id"))
+ return channeltypes.NewErrorAcknowledgement(errorsmod.Wrapf(err, "contract port id"))
}
msg := wasmvmtypes.IBCPacketReceiveMsg{Packet: newIBCPacket(packet), Relayer: relayer.String()}
ack, err := i.keeper.OnRecvPacket(ctx, contractAddr, msg)
@@ -295,7 +295,7 @@ func (i IBCHandler) OnAcknowledgementPacket(
) error {
contractAddr, err := ContractFromPortID(packet.SourcePort)
if err != nil {
- return sdkerrors.Wrapf(err, "contract port id")
+ return errorsmod.Wrapf(err, "contract port id")
}
err = i.keeper.OnAckPacket(ctx, contractAddr, wasmvmtypes.IBCPacketAckMsg{
@@ -304,7 +304,7 @@ func (i IBCHandler) OnAcknowledgementPacket(
Relayer: relayer.String(),
})
if err != nil {
- return sdkerrors.Wrap(err, "on ack")
+ return errorsmod.Wrap(err, "on ack")
}
return nil
}
@@ -313,12 +313,12 @@ func (i IBCHandler) OnAcknowledgementPacket(
func (i IBCHandler) OnTimeoutPacket(ctx sdk.Context, packet channeltypes.Packet, relayer sdk.AccAddress) error {
contractAddr, err := ContractFromPortID(packet.SourcePort)
if err != nil {
- return sdkerrors.Wrapf(err, "contract port id")
+ return errorsmod.Wrapf(err, "contract port id")
}
msg := wasmvmtypes.IBCPacketTimeoutMsg{Packet: newIBCPacket(packet), Relayer: relayer.String()}
err = i.keeper.OnTimeoutPacket(ctx, contractAddr, msg)
if err != nil {
- return sdkerrors.Wrap(err, "on timeout")
+ return errorsmod.Wrap(err, "on timeout")
}
return nil
}
@@ -351,7 +351,7 @@ func ValidateChannelParams(channelID string) error {
return err
}
if channelSequence > math.MaxUint32 {
- return sdkerrors.Wrapf(types.ErrMaxIBCChannels, "channel sequence %d is greater than max allowed transfer channels %d", channelSequence, math.MaxUint32)
+ return errorsmod.Wrapf(types.ErrMaxIBCChannels, "channel sequence %d is greater than max allowed transfer channels %d", channelSequence, math.MaxUint32)
}
return nil
}
diff --git a/x/wasm/ibc_integration_test.go b/x/wasm/ibc_integration_test.go
index 3df273b206..d92b8467b3 100644
--- a/x/wasm/ibc_integration_test.go
+++ b/x/wasm/ibc_integration_test.go
@@ -5,9 +5,9 @@ import (
wasmvm "github.com/CosmWasm/wasmvm"
wasmvmtypes "github.com/CosmWasm/wasmvm/types"
- ibctransfertypes "github.com/cosmos/ibc-go/v4/modules/apps/transfer/types"
- channeltypes "github.com/cosmos/ibc-go/v4/modules/core/04-channel/types"
- ibctesting "github.com/cosmos/ibc-go/v4/testing"
+ ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types"
+ channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types"
+ ibctesting "github.com/cosmos/ibc-go/v7/testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
@@ -47,8 +47,8 @@ func TestOnChanOpenInitVersion(t *testing.T) {
wasmtesting.NewIBCContractMockWasmer(myContract)),
}
coordinator = wasmibctesting.NewCoordinator(t, 2, chainAOpts)
- chainA = coordinator.GetChain(wasmibctesting.GetChainID(0))
- chainB = coordinator.GetChain(wasmibctesting.GetChainID(1))
+ chainA = coordinator.GetChain(wasmibctesting.GetChainID(1))
+ chainB = coordinator.GetChain(wasmibctesting.GetChainID(2))
myContractAddr = chainA.SeedNewContractInstance()
contractInfo = chainA.App.WasmKeeper.GetContractInfo(chainA.GetContext(), myContractAddr)
)
@@ -98,8 +98,8 @@ func TestOnChanOpenTryVersion(t *testing.T) {
wasmtesting.NewIBCContractMockWasmer(myContract)),
}
coordinator = wasmibctesting.NewCoordinator(t, 2, chainAOpts)
- chainA = coordinator.GetChain(wasmibctesting.GetChainID(0))
- chainB = coordinator.GetChain(wasmibctesting.GetChainID(1))
+ chainA = coordinator.GetChain(wasmibctesting.GetChainID(1))
+ chainB = coordinator.GetChain(wasmibctesting.GetChainID(2))
myContractAddr = chainA.SeedNewContractInstance()
contractInfo = chainA.ContractInfo(myContractAddr)
)
diff --git a/x/wasm/ibc_reflect_test.go b/x/wasm/ibc_reflect_test.go
index 2103878147..efb47e7e6a 100644
--- a/x/wasm/ibc_reflect_test.go
+++ b/x/wasm/ibc_reflect_test.go
@@ -5,8 +5,8 @@ import (
"github.com/stretchr/testify/assert"
- channeltypes "github.com/cosmos/ibc-go/v4/modules/core/04-channel/types"
- ibctesting "github.com/cosmos/ibc-go/v4/testing"
+ channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types"
+ ibctesting "github.com/cosmos/ibc-go/v7/testing"
wasmvmtypes "github.com/CosmWasm/wasmvm/types"
"github.com/stretchr/testify/require"
@@ -25,8 +25,8 @@ func TestIBCReflectContract(t *testing.T) {
var (
coordinator = wasmibctesting.NewCoordinator(t, 2)
- chainA = coordinator.GetChain(wasmibctesting.GetChainID(0))
- chainB = coordinator.GetChain(wasmibctesting.GetChainID(1))
+ chainA = coordinator.GetChain(wasmibctesting.GetChainID(1))
+ chainB = coordinator.GetChain(wasmibctesting.GetChainID(2))
)
coordinator.CommitBlock(chainA, chainB)
diff --git a/x/wasm/ibc_test.go b/x/wasm/ibc_test.go
index ee63c7fb02..a92d451453 100644
--- a/x/wasm/ibc_test.go
+++ b/x/wasm/ibc_test.go
@@ -4,8 +4,8 @@ import (
"testing"
wasmvmtypes "github.com/CosmWasm/wasmvm/types"
- clienttypes "github.com/cosmos/ibc-go/v4/modules/core/02-client/types"
- channeltypes "github.com/cosmos/ibc-go/v4/modules/core/04-channel/types"
+ clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types"
+ channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types"
"github.com/stretchr/testify/assert"
)
diff --git a/x/wasm/ibctesting/chain.go b/x/wasm/ibctesting/chain.go
index bd6767316f..0862de17fd 100644
--- a/x/wasm/ibctesting/chain.go
+++ b/x/wasm/ibctesting/chain.go
@@ -5,38 +5,40 @@ import (
"testing"
"time"
+ errorsmod "cosmossdk.io/errors"
+
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
+
+ "github.com/CosmWasm/wasmd/app"
+ "github.com/CosmWasm/wasmd/x/wasm"
+
+ // simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
+ abci "github.com/cometbft/cometbft/abci/types"
+ "github.com/cometbft/cometbft/crypto/tmhash"
+ tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
+ tmprotoversion "github.com/cometbft/cometbft/proto/tendermint/version"
+ tmtypes "github.com/cometbft/cometbft/types"
+ tmversion "github.com/cometbft/cometbft/version"
sdk "github.com/cosmos/cosmos-sdk/types"
- sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper"
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
- "github.com/cosmos/cosmos-sdk/x/staking/teststaking"
+ "github.com/cosmos/cosmos-sdk/x/staking/testutil"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
- clienttypes "github.com/cosmos/ibc-go/v4/modules/core/02-client/types"
- channeltypes "github.com/cosmos/ibc-go/v4/modules/core/04-channel/types"
- commitmenttypes "github.com/cosmos/ibc-go/v4/modules/core/23-commitment/types"
- host "github.com/cosmos/ibc-go/v4/modules/core/24-host"
- "github.com/cosmos/ibc-go/v4/modules/core/exported"
- "github.com/cosmos/ibc-go/v4/modules/core/types"
- ibctmtypes "github.com/cosmos/ibc-go/v4/modules/light-clients/07-tendermint/types"
- ibctesting "github.com/cosmos/ibc-go/v4/testing"
- "github.com/cosmos/ibc-go/v4/testing/mock"
+ clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types"
+ channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types"
+ commitmenttypes "github.com/cosmos/ibc-go/v7/modules/core/23-commitment/types"
+ host "github.com/cosmos/ibc-go/v7/modules/core/24-host"
+ "github.com/cosmos/ibc-go/v7/modules/core/exported"
+ "github.com/cosmos/ibc-go/v7/modules/core/types"
+ ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint"
+ ibctesting "github.com/cosmos/ibc-go/v7/testing"
+ "github.com/cosmos/ibc-go/v7/testing/mock"
"github.com/stretchr/testify/require"
- abci "github.com/tendermint/tendermint/abci/types"
- "github.com/tendermint/tendermint/crypto/tmhash"
- tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
- tmprotoversion "github.com/tendermint/tendermint/proto/tendermint/version"
- tmtypes "github.com/tendermint/tendermint/types"
- tmversion "github.com/tendermint/tendermint/version"
-
- "github.com/CosmWasm/wasmd/app"
- "github.com/CosmWasm/wasmd/app/params"
- "github.com/CosmWasm/wasmd/x/wasm"
)
var MaxAccounts = 10
@@ -57,8 +59,8 @@ type TestChain struct {
Coordinator *Coordinator
App *app.WasmApp
ChainID string
- LastHeader *ibctmtypes.Header // header for last block height committed
- CurrentHeader tmproto.Header // header for current block height
+ LastHeader *ibctm.Header // header for last block height committed
+ CurrentHeader tmproto.Header // header for current block height
QueryServer types.QueryServer
TxConfig client.TxConfig
Codec codec.BinaryCodec
@@ -165,7 +167,7 @@ func NewTestChainWithValSet(t *testing.T, coord *Coordinator, chainID string, va
Time: coord.CurrentTime.UTC(),
}
- txConfig := params.MakeEncodingConfig().TxConfig
+ txConfig := wasmApp.TxConfig()
// create an account to send transactions from
chain := &TestChain{
@@ -202,10 +204,17 @@ func (chain *TestChain) QueryProof(key []byte) ([]byte, clienttypes.Height) {
}
// QueryProofAtHeight performs an abci query with the given key and returns the proto encoded merkle proof
-// for the query and the height at which the proof will succeed on a tendermint verifier.
+// for the query and the height at which the proof will succeed on a tendermint verifier. Only the IBC
+// store is supported
func (chain *TestChain) QueryProofAtHeight(key []byte, height int64) ([]byte, clienttypes.Height) {
+ return chain.QueryProofForStore(exported.StoreKey, key, height)
+}
+
+// QueryProofForStore performs an abci query with the given key and returns the proto encoded merkle proof
+// for the query and the height at which the proof will succeed on a tendermint verifier.
+func (chain *TestChain) QueryProofForStore(storeKey string, key []byte, height int64) ([]byte, clienttypes.Height) {
res := chain.App.Query(abci.RequestQuery{
- Path: fmt.Sprintf("store/%s/key", host.StoreKey),
+ Path: fmt.Sprintf("store/%s/key", storeKey),
Height: height - 1,
Data: key,
Prove: true,
@@ -291,6 +300,7 @@ func (chain *TestChain) NextBlock() {
Time: chain.CurrentHeader.Time,
ValidatorsHash: chain.Vals.Hash(),
NextValidatorsHash: chain.NextVals.Hash(),
+ ProposerAddress: chain.CurrentHeader.ProposerAddress,
}
chain.App.BeginBlock(abci.RequestBeginBlock{Header: chain.CurrentHeader})
@@ -309,7 +319,7 @@ func (chain *TestChain) SendMsgs(msgs ...sdk.Msg) (*sdk.Result, error) {
// ensure the chain has the latest time
chain.Coordinator.UpdateTimeForChain(chain)
- _, r, err := app.SignAndDeliver(
+ _, r, err := app.SignAndDeliverWithoutCommit(
chain.t,
chain.TxConfig,
chain.App.BaseApp,
@@ -320,12 +330,12 @@ func (chain *TestChain) SendMsgs(msgs ...sdk.Msg) (*sdk.Result, error) {
[]uint64{chain.SenderAccount.GetSequence()},
chain.SenderPrivKey,
)
+ if err != nil {
+ return nil, err
+ }
// NextBlock calls app.Commit()
chain.NextBlock()
- if err != nil {
- return r, err
- }
// increment sequence for successful transaction execution
err = chain.SenderAccount.SetSequence(chain.SenderAccount.GetSequence() + 1)
@@ -373,7 +383,7 @@ func (chain *TestChain) GetValsAtHeight(height int64) (*tmtypes.ValidatorSet, bo
valSet := stakingtypes.Validators(histInfo.Valset)
- tmValidators, err := teststaking.ToTmValidators(valSet, sdk.DefaultPowerReduction)
+ tmValidators, err := testutil.ToTmValidators(valSet, sdk.DefaultPowerReduction)
if err != nil {
panic(err)
}
@@ -396,13 +406,13 @@ func (chain *TestChain) GetPrefix() commitmenttypes.MerklePrefix {
// ConstructUpdateTMClientHeader will construct a valid 07-tendermint Header to update the
// light client on the source chain.
-func (chain *TestChain) ConstructUpdateTMClientHeader(counterparty *TestChain, clientID string) (*ibctmtypes.Header, error) {
+func (chain *TestChain) ConstructUpdateTMClientHeader(counterparty *TestChain, clientID string) (*ibctm.Header, error) {
return chain.ConstructUpdateTMClientHeaderWithTrustedHeight(counterparty, clientID, clienttypes.ZeroHeight())
}
// ConstructUpdateTMClientHeader will construct a valid 07-tendermint Header to update the
// light client on the source chain.
-func (chain *TestChain) ConstructUpdateTMClientHeaderWithTrustedHeight(counterparty *TestChain, clientID string, trustedHeight clienttypes.Height) (*ibctmtypes.Header, error) {
+func (chain *TestChain) ConstructUpdateTMClientHeaderWithTrustedHeight(counterparty *TestChain, clientID string, trustedHeight clienttypes.Height) (*ibctm.Header, error) {
header := counterparty.LastHeader
// Relayer must query for LatestHeight on client to get TrustedHeight if the trusted height is not set
if trustedHeight.IsZero() {
@@ -424,7 +434,7 @@ func (chain *TestChain) ConstructUpdateTMClientHeaderWithTrustedHeight(counterpa
// NextValidatorsHash
tmTrustedVals, ok = counterparty.GetValsAtHeight(int64(trustedHeight.RevisionHeight + 1))
if !ok {
- return nil, sdkerrors.Wrapf(ibctmtypes.ErrInvalidHeaderHeight, "could not retrieve trusted validators at trustedHeight: %d", trustedHeight)
+ return nil, errorsmod.Wrapf(ibctm.ErrInvalidHeaderHeight, "could not retrieve trusted validators at trustedHeight: %d", trustedHeight)
}
}
// inject trusted fields into last header
@@ -448,13 +458,13 @@ func (chain *TestChain) ExpireClient(amount time.Duration) {
// CurrentTMClientHeader creates a TM header using the current header parameters
// on the chain. The trusted fields in the header are set to nil.
-func (chain *TestChain) CurrentTMClientHeader() *ibctmtypes.Header {
+func (chain *TestChain) CurrentTMClientHeader() *ibctm.Header {
return chain.CreateTMClientHeader(chain.ChainID, chain.CurrentHeader.Height, clienttypes.Height{}, chain.CurrentHeader.Time, chain.Vals, chain.NextVals, nil, chain.Signers)
}
// CreateTMClientHeader creates a TM header to update the TM client. Args are passed in to allow
// caller flexibility to use params that differ from the chain.
-func (chain *TestChain) CreateTMClientHeader(chainID string, blockHeight int64, trustedHeight clienttypes.Height, timestamp time.Time, tmValSet, nextVals, tmTrustedVals *tmtypes.ValidatorSet, signers map[string]tmtypes.PrivValidator) *ibctmtypes.Header {
+func (chain *TestChain) CreateTMClientHeader(chainID string, blockHeight int64, trustedHeight clienttypes.Height, timestamp time.Time, tmValSet, nextVals, tmTrustedVals *tmtypes.ValidatorSet, signers map[string]tmtypes.PrivValidator) *ibctm.Header {
var (
valSet *tmproto.ValidatorSet
trustedVals *tmproto.ValidatorSet
@@ -478,18 +488,17 @@ func (chain *TestChain) CreateTMClientHeader(chainID string, blockHeight int64,
AppHash: chain.CurrentHeader.AppHash,
LastResultsHash: tmhash.Sum([]byte("last_results_hash")),
EvidenceHash: tmhash.Sum([]byte("evidence_hash")),
- ProposerAddress: tmValSet.Proposer.Address, //nolint:staticcheck
+ ProposerAddress: tmValSet.Proposer.Address, //nolint:staticcheck // SA5011: possible nil pointer dereference
}
hhash := tmHeader.Hash()
blockID := MakeBlockID(hhash, 3, tmhash.Sum([]byte("part_set")))
voteSet := tmtypes.NewVoteSet(chainID, blockHeight, 1, tmproto.PrecommitType, tmValSet)
-
// MakeCommit expects a signer array in the same order as the validator array.
// Thus we iterate over the ordered validator set and construct a signer array
// from the signer map in the same order.
- signerArr := make([]tmtypes.PrivValidator, len(tmValSet.Validators))
- for i, v := range tmValSet.Validators {
+ signerArr := make([]tmtypes.PrivValidator, len(tmValSet.Validators)) //nolint:staticcheck
+ for i, v := range tmValSet.Validators { //nolint:staticcheck
signerArr[i] = signers[v.Address.String()]
}
@@ -501,8 +510,10 @@ func (chain *TestChain) CreateTMClientHeader(chainID string, blockHeight int64,
Commit: commit.ToProto(),
}
- valSet, err = tmValSet.ToProto()
- require.NoError(chain.t, err)
+ if tmValSet != nil { //nolint:staticcheck
+ valSet, err = tmValSet.ToProto()
+ require.NoError(chain.t, err)
+ }
if tmTrustedVals != nil {
trustedVals, err = tmTrustedVals.ToProto()
@@ -511,7 +522,7 @@ func (chain *TestChain) CreateTMClientHeader(chainID string, blockHeight int64,
// The trusted fields may be nil. They may be filled before relaying messages to a client.
// The relayer is responsible for querying client and injecting appropriate trusted fields.
- return &ibctmtypes.Header{
+ return &ibctm.Header{
SignedHeader: signedHeader,
ValidatorSet: valSet,
TrustedHeight: trustedHeight,
@@ -539,11 +550,11 @@ func (chain *TestChain) CreatePortCapability(scopedKeeper capabilitykeeper.Scope
_, ok := chain.App.ScopedIBCKeeper.GetCapability(chain.GetContext(), host.PortPath(portID))
if !ok {
// create capability using the IBC capability keeper
- cap, err := chain.App.ScopedIBCKeeper.NewCapability(chain.GetContext(), host.PortPath(portID))
+ portCap, err := chain.App.ScopedIBCKeeper.NewCapability(chain.GetContext(), host.PortPath(portID))
require.NoError(chain.t, err)
// claim capability using the scopedKeeper
- err = scopedKeeper.ClaimCapability(chain.GetContext(), cap, host.PortPath(portID))
+ err = scopedKeeper.ClaimCapability(chain.GetContext(), portCap, host.PortPath(portID))
require.NoError(chain.t, err)
}
@@ -553,10 +564,10 @@ func (chain *TestChain) CreatePortCapability(scopedKeeper capabilitykeeper.Scope
// GetPortCapability returns the port capability for the given portID. The capability must
// exist, otherwise testing will fail.
func (chain *TestChain) GetPortCapability(portID string) *capabilitytypes.Capability {
- cap, ok := chain.App.ScopedIBCKeeper.GetCapability(chain.GetContext(), host.PortPath(portID))
+ portCap, ok := chain.App.ScopedIBCKeeper.GetCapability(chain.GetContext(), host.PortPath(portID))
require.True(chain.t, ok)
- return cap
+ return portCap
}
// CreateChannelCapability binds and claims a capability for the given portID and channelID
@@ -567,9 +578,9 @@ func (chain *TestChain) CreateChannelCapability(scopedKeeper capabilitykeeper.Sc
// check if the portId is already binded, if not bind it
_, ok := chain.App.ScopedIBCKeeper.GetCapability(chain.GetContext(), capName)
if !ok {
- cap, err := chain.App.ScopedIBCKeeper.NewCapability(chain.GetContext(), capName)
+ portCap, err := chain.App.ScopedIBCKeeper.NewCapability(chain.GetContext(), capName)
require.NoError(chain.t, err)
- err = scopedKeeper.ClaimCapability(chain.GetContext(), cap, capName)
+ err = scopedKeeper.ClaimCapability(chain.GetContext(), portCap, capName)
require.NoError(chain.t, err)
}
@@ -579,10 +590,16 @@ func (chain *TestChain) CreateChannelCapability(scopedKeeper capabilitykeeper.Sc
// GetChannelCapability returns the channel capability for the given portID and channelID.
// The capability must exist, otherwise testing will fail.
func (chain *TestChain) GetChannelCapability(portID, channelID string) *capabilitytypes.Capability {
- cap, ok := chain.App.ScopedIBCKeeper.GetCapability(chain.GetContext(), host.ChannelCapabilityPath(portID, channelID))
+ chanCap, ok := chain.App.ScopedIBCKeeper.GetCapability(chain.GetContext(), host.ChannelCapabilityPath(portID, channelID))
require.True(chain.t, ok)
- return cap
+ return chanCap
+}
+
+// GetTimeoutHeight is a convenience function which returns a IBC packet timeout height
+// to be used for testing. It returns the current IBC height + 100 blocks
+func (chain *TestChain) GetTimeoutHeight() clienttypes.Height {
+ return clienttypes.NewHeight(clienttypes.ParseChainID(chain.ChainID), uint64(chain.GetContext().BlockHeight())+100)
}
func (chain *TestChain) Balance(acc sdk.AccAddress, denom string) sdk.Coin {
diff --git a/x/wasm/ibctesting/coordinator.go b/x/wasm/ibctesting/coordinator.go
index 9ceadc0a76..557db8305a 100644
--- a/x/wasm/ibctesting/coordinator.go
+++ b/x/wasm/ibctesting/coordinator.go
@@ -2,24 +2,21 @@ package ibctesting
import (
"fmt"
- "strconv"
"testing"
"time"
- channeltypes "github.com/cosmos/ibc-go/v4/modules/core/04-channel/types"
- host "github.com/cosmos/ibc-go/v4/modules/core/24-host"
- ibctesting "github.com/cosmos/ibc-go/v4/testing"
+ abci "github.com/cometbft/cometbft/abci/types"
+ channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types"
+ host "github.com/cosmos/ibc-go/v7/modules/core/24-host"
+ ibctesting "github.com/cosmos/ibc-go/v7/testing"
"github.com/stretchr/testify/require"
- abci "github.com/tendermint/tendermint/abci/types"
wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
)
-const ChainIDPrefix = "testchain"
-
var (
- globalStartTime = time.Date(2020, 12, 4, 10, 30, 0, 0, time.UTC)
TimeIncrement = time.Second * 5
+ globalStartTime = time.Date(2020, 1, 2, 0, 0, 0, 0, time.UTC)
)
// Coordinator is a testing struct which contains N TestChain's. It handles keeping all chains
@@ -39,11 +36,11 @@ func NewCoordinator(t *testing.T, n int, opts ...[]wasmkeeper.Option) *Coordinat
CurrentTime: globalStartTime,
}
- for i := 0; i < n; i++ {
+ for i := 1; i <= n; i++ {
chainID := GetChainID(i)
var x []wasmkeeper.Option
- if len(opts) > i {
- x = opts[i]
+ if len(opts) > (i - 1) {
+ x = opts[i-1]
}
chains[chainID] = NewTestChain(t, coord, chainID, x...)
}
@@ -183,7 +180,7 @@ func (coord *Coordinator) GetChain(chainID string) *TestChain {
// GetChainID returns the chainID used for the provided index.
func GetChainID(index int) string {
- return ChainIDPrefix + strconv.Itoa(index)
+ return ibctesting.GetChainID(index)
}
// CommitBlock commits a block on the provided indexes and then increments the global time.
@@ -220,11 +217,9 @@ func (coord *Coordinator) ConnOpenInitOnBothChains(path *Path) error {
return err
}
- if err := path.EndpointB.UpdateClient(); err != nil {
- return err
- }
+ err := path.EndpointB.UpdateClient()
- return nil
+ return err
}
// ChanOpenInitOnBothChains initializes a channel on the source chain and counterparty chain
@@ -245,11 +240,9 @@ func (coord *Coordinator) ChanOpenInitOnBothChains(path *Path) error {
return err
}
- if err := path.EndpointB.UpdateClient(); err != nil {
- return err
- }
+ err := path.EndpointB.UpdateClient()
- return nil
+ return err
}
// RelayAndAckPendingPackets sends pending packages from path.EndpointA to the counterparty chain and acks
diff --git a/x/wasm/ibctesting/endpoint.go b/x/wasm/ibctesting/endpoint.go
index e56c5d06ef..4eb47baf80 100644
--- a/x/wasm/ibctesting/endpoint.go
+++ b/x/wasm/ibctesting/endpoint.go
@@ -2,16 +2,18 @@ package ibctesting
import (
"fmt"
+ "strings"
+ "github.com/cosmos/cosmos-sdk/baseapp"
sdk "github.com/cosmos/cosmos-sdk/types"
- clienttypes "github.com/cosmos/ibc-go/v4/modules/core/02-client/types"
- connectiontypes "github.com/cosmos/ibc-go/v4/modules/core/03-connection/types"
- channeltypes "github.com/cosmos/ibc-go/v4/modules/core/04-channel/types"
- commitmenttypes "github.com/cosmos/ibc-go/v4/modules/core/23-commitment/types"
- host "github.com/cosmos/ibc-go/v4/modules/core/24-host"
- "github.com/cosmos/ibc-go/v4/modules/core/exported"
- ibctmtypes "github.com/cosmos/ibc-go/v4/modules/light-clients/07-tendermint/types"
- ibctesting "github.com/cosmos/ibc-go/v4/testing"
+ clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types"
+ connectiontypes "github.com/cosmos/ibc-go/v7/modules/core/03-connection/types"
+ channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types"
+ commitmenttypes "github.com/cosmos/ibc-go/v7/modules/core/23-commitment/types"
+ host "github.com/cosmos/ibc-go/v7/modules/core/24-host"
+ "github.com/cosmos/ibc-go/v7/modules/core/exported"
+ ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint"
+ ibctesting "github.com/cosmos/ibc-go/v7/testing"
"github.com/stretchr/testify/require"
)
@@ -91,10 +93,9 @@ func (endpoint *Endpoint) CreateClient() (err error) {
require.True(endpoint.Chain.t, ok)
height := endpoint.Counterparty.Chain.LastHeader.GetHeight().(clienttypes.Height)
- clientState = ibctmtypes.NewClientState(
+ clientState = ibctm.NewClientState(
endpoint.Counterparty.Chain.ChainID, tmConfig.TrustLevel, tmConfig.TrustingPeriod, tmConfig.UnbondingPeriod, tmConfig.MaxClockDrift,
- height, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, tmConfig.AllowUpdateAfterExpiry, tmConfig.AllowUpdateAfterMisbehaviour,
- )
+ height, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath)
consensusState = endpoint.Counterparty.Chain.LastHeader.ConsensusState()
case exported.Solomachine:
// TODO
@@ -131,7 +132,7 @@ func (endpoint *Endpoint) UpdateClient() (err error) {
// ensure counterparty has committed state
endpoint.Chain.Coordinator.CommitBlock(endpoint.Counterparty.Chain)
- var header exported.Header
+ var header exported.ClientMessage
switch endpoint.ClientConfig.GetClientType() {
case exported.Tendermint:
@@ -154,6 +155,60 @@ func (endpoint *Endpoint) UpdateClient() (err error) {
return endpoint.Chain.sendMsgs(msg)
}
+// UpgradeChain will upgrade a chain's chainID to the next revision number.
+// It will also update the counterparty client.
+// TODO: implement actual upgrade chain functionality via scheduling an upgrade
+// and upgrading the client via MsgUpgradeClient
+// see reference https://github.com/cosmos/ibc-go/pull/1169
+func (endpoint *Endpoint) UpgradeChain() error {
+ if strings.TrimSpace(endpoint.Counterparty.ClientID) == "" {
+ return fmt.Errorf("cannot upgrade chain if there is no counterparty client")
+ }
+
+ clientState := endpoint.Counterparty.GetClientState().(*ibctm.ClientState)
+
+ // increment revision number in chainID
+
+ oldChainID := clientState.ChainId
+ if !clienttypes.IsRevisionFormat(oldChainID) {
+ return fmt.Errorf("cannot upgrade chain which is not of revision format: %s", oldChainID)
+ }
+
+ revisionNumber := clienttypes.ParseChainID(oldChainID)
+ newChainID, err := clienttypes.SetRevisionNumber(oldChainID, revisionNumber+1)
+ if err != nil {
+ return err
+ }
+
+ // update chain
+ baseapp.SetChainID(newChainID)(endpoint.Chain.App.BaseApp)
+ endpoint.Chain.ChainID = newChainID
+ endpoint.Chain.CurrentHeader.ChainID = newChainID
+ endpoint.Chain.NextBlock() // commit changes
+
+ // update counterparty client manually
+ clientState.ChainId = newChainID
+ clientState.LatestHeight = clienttypes.NewHeight(revisionNumber+1, clientState.LatestHeight.GetRevisionHeight()+1)
+ endpoint.Counterparty.SetClientState(clientState)
+
+ consensusState := &ibctm.ConsensusState{
+ Timestamp: endpoint.Chain.LastHeader.GetTime(),
+ Root: commitmenttypes.NewMerkleRoot(endpoint.Chain.LastHeader.Header.GetAppHash()),
+ NextValidatorsHash: endpoint.Chain.LastHeader.Header.NextValidatorsHash,
+ }
+ endpoint.Counterparty.SetConsensusState(consensusState, clientState.GetLatestHeight())
+
+ // ensure the next update isn't identical to the one set in state
+ endpoint.Chain.Coordinator.IncrementTime()
+ endpoint.Chain.NextBlock()
+
+ if err = endpoint.Counterparty.UpdateClient(); err != nil {
+ return err
+ }
+
+ return nil
+}
+
// ConnOpenInit will construct and execute a MsgConnectionOpenInit on the associated endpoint.
func (endpoint *Endpoint) ConnOpenInit() error {
msg := connectiontypes.NewMsgConnectionOpenInit(
@@ -175,9 +230,8 @@ func (endpoint *Endpoint) ConnOpenInit() error {
// ConnOpenTry will construct and execute a MsgConnectionOpenTry on the associated endpoint.
func (endpoint *Endpoint) ConnOpenTry() error {
- if err := endpoint.UpdateClient(); err != nil {
- return err
- }
+ err := endpoint.UpdateClient()
+ require.NoError(endpoint.Chain.t, err)
counterpartyClient, proofClient, proofConsensus, consensusHeight, proofInit, proofHeight := endpoint.QueryConnectionHandshakeProof()
@@ -203,9 +257,8 @@ func (endpoint *Endpoint) ConnOpenTry() error {
// ConnOpenAck will construct and execute a MsgConnectionOpenAck on the associated endpoint.
func (endpoint *Endpoint) ConnOpenAck() error {
- if err := endpoint.UpdateClient(); err != nil {
- return err
- }
+ err := endpoint.UpdateClient()
+ require.NoError(endpoint.Chain.t, err)
counterpartyClient, proofClient, proofConsensus, consensusHeight, proofTry, proofHeight := endpoint.QueryConnectionHandshakeProof()
@@ -221,9 +274,8 @@ func (endpoint *Endpoint) ConnOpenAck() error {
// ConnOpenConfirm will construct and execute a MsgConnectionOpenConfirm on the associated endpoint.
func (endpoint *Endpoint) ConnOpenConfirm() error {
- if err := endpoint.UpdateClient(); err != nil {
- return err
- }
+ err := endpoint.UpdateClient()
+ require.NoError(endpoint.Chain.t, err)
connectionKey := host.ConnectionKey(endpoint.Counterparty.ConnectionID)
proof, height := endpoint.Counterparty.Chain.QueryProof(connectionKey)
@@ -290,9 +342,8 @@ func (endpoint *Endpoint) ChanOpenInit() error {
// ChanOpenTry will construct and execute a MsgChannelOpenTry on the associated endpoint.
func (endpoint *Endpoint) ChanOpenTry() error {
- if err := endpoint.UpdateClient(); err != nil {
- return err
- }
+ err := endpoint.UpdateClient()
+ require.NoError(endpoint.Chain.t, err)
channelKey := host.ChannelKey(endpoint.Counterparty.ChannelConfig.PortID, endpoint.Counterparty.ChannelID)
proof, height := endpoint.Counterparty.Chain.QueryProof(channelKey)
@@ -323,9 +374,8 @@ func (endpoint *Endpoint) ChanOpenTry() error {
// ChanOpenAck will construct and execute a MsgChannelOpenAck on the associated endpoint.
func (endpoint *Endpoint) ChanOpenAck() error {
- if err := endpoint.UpdateClient(); err != nil {
- return err
- }
+ err := endpoint.UpdateClient()
+ require.NoError(endpoint.Chain.t, err)
channelKey := host.ChannelKey(endpoint.Counterparty.ChannelConfig.PortID, endpoint.Counterparty.ChannelID)
proof, height := endpoint.Counterparty.Chain.QueryProof(channelKey)
@@ -346,9 +396,8 @@ func (endpoint *Endpoint) ChanOpenAck() error {
// ChanOpenConfirm will construct and execute a MsgChannelOpenConfirm on the associated endpoint.
func (endpoint *Endpoint) ChanOpenConfirm() error {
- if err := endpoint.UpdateClient(); err != nil {
- return err
- }
+ err := endpoint.UpdateClient()
+ require.NoError(endpoint.Chain.t, err)
channelKey := host.ChannelKey(endpoint.Counterparty.ChannelConfig.PortID, endpoint.Counterparty.ChannelID)
proof, height := endpoint.Counterparty.Chain.QueryProof(channelKey)
@@ -387,19 +436,30 @@ func (endpoint *Endpoint) ChanCloseConfirm() error {
// SendPacket sends a packet through the channel keeper using the associated endpoint
// The counterparty client is updated so proofs can be sent to the counterparty chain.
-func (endpoint *Endpoint) SendPacket(packet exported.PacketI) error {
- channelCap := endpoint.Chain.GetChannelCapability(packet.GetSourcePort(), packet.GetSourceChannel())
+// The packet sequence generated for the packet to be sent is returned. An error
+// is returned if one occurs.
+func (endpoint *Endpoint) SendPacket(
+ timeoutHeight clienttypes.Height,
+ timeoutTimestamp uint64,
+ data []byte,
+) (uint64, error) {
+ channelCap := endpoint.Chain.GetChannelCapability(endpoint.ChannelConfig.PortID, endpoint.ChannelID)
// no need to send message, acting as a module
- err := endpoint.Chain.App.IBCKeeper.ChannelKeeper.SendPacket(endpoint.Chain.GetContext(), channelCap, packet)
+ sequence, err := endpoint.Chain.App.IBCKeeper.ChannelKeeper.SendPacket(endpoint.Chain.GetContext(), channelCap, endpoint.ChannelConfig.PortID, endpoint.ChannelID, timeoutHeight, timeoutTimestamp, data)
if err != nil {
- return err
+ return 0, err
}
// commit changes since no message was sent
endpoint.Chain.Coordinator.CommitBlock(endpoint.Chain)
- return endpoint.Counterparty.UpdateClient()
+ err = endpoint.Counterparty.UpdateClient()
+ if err != nil {
+ return 0, err
+ }
+
+ return sequence, nil
}
// RecvPacket receives a packet on the associated endpoint.
diff --git a/x/wasm/ibctesting/event_utils.go b/x/wasm/ibctesting/event_utils.go
index 0933dadd3f..a3769014e8 100644
--- a/x/wasm/ibctesting/event_utils.go
+++ b/x/wasm/ibctesting/event_utils.go
@@ -8,9 +8,9 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
- clienttypes "github.com/cosmos/ibc-go/v4/modules/core/02-client/types"
- channeltypes "github.com/cosmos/ibc-go/v4/modules/core/04-channel/types"
- abci "github.com/tendermint/tendermint/abci/types"
+ abci "github.com/cometbft/cometbft/abci/types"
+ clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types"
+ channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types"
)
func getSendPackets(evts []abci.Event) []channeltypes.Packet {
@@ -60,8 +60,8 @@ func getHexField(evt abci.Event, key string) []byte {
// return the value for the attribute with the given name
func getField(evt abci.Event, key string) string {
for _, attr := range evt.Attributes {
- if string(attr.Key) == key {
- return string(attr.Value)
+ if attr.Key == key {
+ return attr.Value
}
}
return ""
@@ -95,8 +95,8 @@ func ParsePortIDFromEvents(events sdk.Events) (string, error) {
for _, ev := range events {
if ev.Type == channeltypes.EventTypeChannelOpenInit || ev.Type == channeltypes.EventTypeChannelOpenTry {
for _, attr := range ev.Attributes {
- if string(attr.Key) == channeltypes.AttributeKeyPortID {
- return string(attr.Value), nil
+ if attr.Key == channeltypes.AttributeKeyPortID {
+ return attr.Value, nil
}
}
}
@@ -108,8 +108,8 @@ func ParseChannelVersionFromEvents(events sdk.Events) (string, error) {
for _, ev := range events {
if ev.Type == channeltypes.EventTypeChannelOpenInit || ev.Type == channeltypes.EventTypeChannelOpenTry {
for _, attr := range ev.Attributes {
- if string(attr.Key) == channeltypes.AttributeVersion {
- return string(attr.Value), nil
+ if attr.Key == channeltypes.AttributeVersion {
+ return attr.Value, nil
}
}
}
diff --git a/x/wasm/ibctesting/faucet.go b/x/wasm/ibctesting/faucet.go
index 4510f2ded4..4de2c4e05c 100644
--- a/x/wasm/ibctesting/faucet.go
+++ b/x/wasm/ibctesting/faucet.go
@@ -1,6 +1,7 @@
package ibctesting
import (
+ "cosmossdk.io/math"
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
sdk "github.com/cosmos/cosmos-sdk/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
@@ -10,7 +11,7 @@ import (
)
// Fund an address with the given amount in default denom
-func (chain *TestChain) Fund(addr sdk.AccAddress, amount sdk.Int) {
+func (chain *TestChain) Fund(addr sdk.AccAddress, amount math.Int) {
require.NoError(chain.t, chain.sendMsgs(&banktypes.MsgSend{
FromAddress: chain.SenderAccount.GetAddress().String(),
ToAddress: addr.String(),
@@ -29,7 +30,7 @@ func (chain *TestChain) SendNonDefaultSenderMsgs(senderPrivKey cryptotypes.PrivK
addr := sdk.AccAddress(senderPrivKey.PubKey().Address().Bytes())
account := chain.App.AccountKeeper.GetAccount(chain.GetContext(), addr)
require.NotNil(chain.t, account)
- _, r, err := app.SignAndDeliver(
+ _, r, err := app.SignAndDeliverWithoutCommit(
chain.t,
chain.TxConfig,
chain.App.BaseApp,
@@ -41,7 +42,7 @@ func (chain *TestChain) SendNonDefaultSenderMsgs(senderPrivKey cryptotypes.PrivK
senderPrivKey,
)
- // SignAndDeliver calls app.Commit()
+ // SignAndDeliverWithoutCommit calls app.Commit()
chain.NextBlock()
chain.Coordinator.IncrementTime()
if err != nil {
diff --git a/x/wasm/ibctesting/path.go b/x/wasm/ibctesting/path.go
index 5e861325f0..c7f1af8f42 100644
--- a/x/wasm/ibctesting/path.go
+++ b/x/wasm/ibctesting/path.go
@@ -5,8 +5,8 @@ import (
"fmt"
sdk "github.com/cosmos/cosmos-sdk/types"
- channeltypes "github.com/cosmos/ibc-go/v4/modules/core/04-channel/types"
- ibctesting "github.com/cosmos/ibc-go/v4/testing"
+ channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types"
+ ibctesting "github.com/cosmos/ibc-go/v7/testing"
)
// Path contains two endpoints representing two chains connected over IBC
@@ -40,7 +40,7 @@ func (path *Path) SetChannelOrdered() {
// RelayPacket attempts to relay the packet first on EndpointA and then on EndpointB
// if EndpointA does not contain a packet commitment for that packet. An error is returned
// if a relay step fails or the packet commitment does not exist on either endpoint.
-func (path *Path) RelayPacket(packet channeltypes.Packet, ack []byte) error {
+func (path *Path) RelayPacket(packet channeltypes.Packet, _ []byte) error {
pc := path.EndpointA.Chain.App.IBCKeeper.ChannelKeeper.GetPacketCommitment(path.EndpointA.Chain.GetContext(), packet.GetSourcePort(), packet.GetSourceChannel(), packet.GetSequence())
if bytes.Equal(pc, channeltypes.CommitPacket(path.EndpointA.Chain.App.AppCodec(), packet)) {
@@ -59,11 +59,9 @@ func (path *Path) RelayPacket(packet channeltypes.Packet, ack []byte) error {
return err
}
- if err := path.EndpointA.AcknowledgePacket(packet, ack); err != nil {
- return err
- }
+ err = path.EndpointA.AcknowledgePacket(packet, ack)
- return nil
+ return err
}
pc = path.EndpointB.Chain.App.IBCKeeper.ChannelKeeper.GetPacketCommitment(path.EndpointB.Chain.GetContext(), packet.GetSourcePort(), packet.GetSourceChannel(), packet.GetSequence())
@@ -84,10 +82,8 @@ func (path *Path) RelayPacket(packet channeltypes.Packet, ack []byte) error {
return err
}
- if err := path.EndpointB.AcknowledgePacket(packet, ack); err != nil {
- return err
- }
- return nil
+ err = path.EndpointB.AcknowledgePacket(packet, ack)
+ return err
}
return fmt.Errorf("packet commitment does not exist on either endpoint for provided packet")
diff --git a/x/wasm/ibctesting/wasm.go b/x/wasm/ibctesting/wasm.go
index 0546f477eb..53bd7dc573 100644
--- a/x/wasm/ibctesting/wasm.go
+++ b/x/wasm/ibctesting/wasm.go
@@ -8,13 +8,13 @@ import (
"os"
"strings"
- ibctesting "github.com/cosmos/ibc-go/v4/testing"
+ ibctesting "github.com/cosmos/ibc-go/v7/testing"
+ abci "github.com/cometbft/cometbft/abci/types"
+ "github.com/cometbft/cometbft/libs/rand"
sdk "github.com/cosmos/cosmos-sdk/types"
- "github.com/golang/protobuf/proto" //nolint
+ "github.com/cosmos/gogoproto/proto"
"github.com/stretchr/testify/require"
- abci "github.com/tendermint/tendermint/abci/types"
- "github.com/tendermint/tendermint/libs/rand"
"github.com/CosmWasm/wasmd/x/wasm/types"
)
@@ -56,14 +56,13 @@ func (chain *TestChain) StoreCode(byteCode []byte) types.MsgStoreCodeResponse {
}
r, err := chain.SendMsgs(storeMsg)
require.NoError(chain.t, err)
- protoResult := chain.parseSDKResultData(r)
- require.Len(chain.t, protoResult.Data, 1)
// unmarshal protobuf response from data
- var pInstResp types.MsgStoreCodeResponse
- require.NoError(chain.t, pInstResp.Unmarshal(protoResult.Data[0].Data))
+ require.Len(chain.t, r.MsgResponses, 1)
+ require.NotEmpty(chain.t, r.MsgResponses[0].GetCachedValue())
+ pInstResp := r.MsgResponses[0].GetCachedValue().(*types.MsgStoreCodeResponse)
require.NotEmpty(chain.t, pInstResp.CodeID)
require.NotEmpty(chain.t, pInstResp.Checksum)
- return pInstResp
+ return *pInstResp
}
func (chain *TestChain) InstantiateContract(codeID uint64, initMsg []byte) sdk.AccAddress {
@@ -78,11 +77,9 @@ func (chain *TestChain) InstantiateContract(codeID uint64, initMsg []byte) sdk.A
r, err := chain.SendMsgs(instantiateMsg)
require.NoError(chain.t, err)
- protoResult := chain.parseSDKResultData(r)
- require.Len(chain.t, protoResult.Data, 1)
-
- var pExecResp types.MsgInstantiateContractResponse
- require.NoError(chain.t, pExecResp.Unmarshal(protoResult.Data[0].Data))
+ require.Len(chain.t, r.MsgResponses, 1)
+ require.NotEmpty(chain.t, r.MsgResponses[0].GetCachedValue())
+ pExecResp := r.MsgResponses[0].GetCachedValue().(*types.MsgInstantiateContractResponse)
a, err := sdk.AccAddressFromBech32(pExecResp.Address)
require.NoError(chain.t, err)
return a
@@ -126,12 +123,6 @@ func (chain *TestChain) SmartQuery(contractAddr string, queryMsg interface{}, re
return json.Unmarshal(resp.Data, response)
}
-func (chain *TestChain) parseSDKResultData(r *sdk.Result) sdk.TxMsgData {
- var protoResult sdk.TxMsgData
- require.NoError(chain.t, proto.Unmarshal(r.Data, &protoResult))
- return protoResult
-}
-
// ContractInfo is a helper function to returns the ContractInfo for the given contract address
func (chain *TestChain) ContractInfo(contractAddr sdk.AccAddress) *types.ContractInfo {
return chain.App.WasmKeeper.GetContractInfo(chain.GetContext(), contractAddr)
diff --git a/x/wasm/keeper/addresses_test.go b/x/wasm/keeper/addresses_test.go
index fbcc607fc5..399c3e7b2d 100644
--- a/x/wasm/keeper/addresses_test.go
+++ b/x/wasm/keeper/addresses_test.go
@@ -5,9 +5,9 @@ import (
"fmt"
"testing"
+ tmbytes "github.com/cometbft/cometbft/libs/bytes"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/stretchr/testify/require"
- tmbytes "github.com/tendermint/tendermint/libs/bytes"
)
func TestBuildContractAddress(t *testing.T) {
diff --git a/x/wasm/keeper/ante.go b/x/wasm/keeper/ante.go
index 1ffd34befd..08dfdf64b4 100644
--- a/x/wasm/keeper/ante.go
+++ b/x/wasm/keeper/ante.go
@@ -3,6 +3,7 @@ package keeper
import (
"encoding/binary"
+ storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/CosmWasm/wasmd/x/wasm/types"
@@ -10,11 +11,11 @@ import (
// CountTXDecorator ante handler to count the tx position in a block.
type CountTXDecorator struct {
- storeKey sdk.StoreKey
+ storeKey storetypes.StoreKey
}
// NewCountTXDecorator constructor
-func NewCountTXDecorator(storeKey sdk.StoreKey) *CountTXDecorator {
+func NewCountTXDecorator(storeKey storetypes.StoreKey) *CountTXDecorator {
return &CountTXDecorator{storeKey: storeKey}
}
diff --git a/x/wasm/keeper/ante_test.go b/x/wasm/keeper/ante_test.go
index fa64b62fe3..1ac746427c 100644
--- a/x/wasm/keeper/ante_test.go
+++ b/x/wasm/keeper/ante_test.go
@@ -4,18 +4,16 @@ import (
"testing"
"time"
- abci "github.com/tendermint/tendermint/abci/types"
-
- "github.com/CosmWasm/wasmd/x/wasm/keeper"
-
+ dbm "github.com/cometbft/cometbft-db"
+ "github.com/cometbft/cometbft/libs/log"
+ tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
"github.com/cosmos/cosmos-sdk/store"
+ storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
- "github.com/tendermint/tendermint/libs/log"
- tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
- dbm "github.com/tendermint/tm-db"
+ "github.com/CosmWasm/wasmd/x/wasm/keeper"
"github.com/CosmWasm/wasmd/x/wasm/types"
)
@@ -23,7 +21,7 @@ func TestCountTxDecorator(t *testing.T) {
keyWasm := sdk.NewKVStoreKey(types.StoreKey)
db := dbm.NewMemDB()
ms := store.NewCommitMultiStore(db)
- ms.MountStoreWithDB(keyWasm, sdk.StoreTypeIAVL, db)
+ ms.MountStoreWithDB(keyWasm, storetypes.StoreTypeIAVL, db)
require.NoError(t, ms.LoadLatestVersion())
const myCurrentBlockHeight = 100
@@ -164,19 +162,21 @@ func TestLimitSimulationGasDecorator(t *testing.T) {
nextAnte := consumeGasAnteHandler(spec.consumeGas)
ctx := sdk.Context{}.
WithGasMeter(sdk.NewInfiniteGasMeter()).
- WithConsensusParams(&abci.ConsensusParams{
- Block: &abci.BlockParams{MaxGas: spec.maxBlockGas},
+ WithConsensusParams(&tmproto.ConsensusParams{
+ Block: &tmproto.BlockParams{MaxGas: spec.maxBlockGas},
})
// when
if spec.expErr != nil {
require.PanicsWithValue(t, spec.expErr, func() {
ante := keeper.NewLimitSimulationGasDecorator(spec.customLimit)
- ante.AnteHandle(ctx, nil, spec.simulation, nextAnte)
+ _, err := ante.AnteHandle(ctx, nil, spec.simulation, nextAnte)
+ require.NoError(t, err)
})
return
}
ante := keeper.NewLimitSimulationGasDecorator(spec.customLimit)
- ante.AnteHandle(ctx, nil, spec.simulation, nextAnte)
+ _, err := ante.AnteHandle(ctx, nil, spec.simulation, nextAnte)
+ require.NoError(t, err)
})
}
}
diff --git a/x/wasm/keeper/bench_test.go b/x/wasm/keeper/bench_test.go
index f32b39a0cb..ff0240afaf 100644
--- a/x/wasm/keeper/bench_test.go
+++ b/x/wasm/keeper/bench_test.go
@@ -4,9 +4,9 @@ import (
"os"
"testing"
+ dbm "github.com/cometbft/cometbft-db"
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
"github.com/stretchr/testify/require"
- dbm "github.com/tendermint/tm-db"
"github.com/CosmWasm/wasmd/x/wasm/types"
)
diff --git a/x/wasm/keeper/contract_keeper_test.go b/x/wasm/keeper/contract_keeper_test.go
index 0a8bd1e224..46ec4f6576 100644
--- a/x/wasm/keeper/contract_keeper_test.go
+++ b/x/wasm/keeper/contract_keeper_test.go
@@ -18,6 +18,8 @@ import (
func TestInstantiate2(t *testing.T) {
parentCtx, keepers := CreateTestInput(t, false, AvailableCapabilities)
+ parentCtx = parentCtx.WithGasMeter(sdk.NewInfiniteGasMeter())
+
example := StoreHackatomExampleContract(t, parentCtx, keepers)
otherExample := StoreReflectContract(t, parentCtx, keepers)
mock := &wasmtesting.MockWasmer{}
@@ -27,7 +29,6 @@ func TestInstantiate2(t *testing.T) {
verifierAddr := RandomAccountAddress(t)
beneficiaryAddr := RandomAccountAddress(t)
initMsg := mustMarshal(t, HackatomExampleInitMsg{Verifier: verifierAddr, Beneficiary: beneficiaryAddr})
-
otherAddr := keepers.Faucet.NewFundedRandomAccount(parentCtx, sdk.NewInt64Coin("denom", 1_000_000_000))
const (
diff --git a/x/wasm/keeper/events.go b/x/wasm/keeper/events.go
index 03cb7ea778..06807f1c25 100644
--- a/x/wasm/keeper/events.go
+++ b/x/wasm/keeper/events.go
@@ -4,9 +4,10 @@ import (
"fmt"
"strings"
+ errorsmod "cosmossdk.io/errors"
+
wasmvmtypes "github.com/CosmWasm/wasmvm/types"
sdk "github.com/cosmos/cosmos-sdk/types"
- sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/CosmWasm/wasmd/x/wasm/types"
)
@@ -31,7 +32,7 @@ func newCustomEvents(evts wasmvmtypes.Events, contractAddr sdk.AccAddress) (sdk.
for _, e := range evts {
typ := strings.TrimSpace(e.Type)
if len(typ) <= eventTypeMinLength {
- return nil, sdkerrors.Wrap(types.ErrInvalidEvent, fmt.Sprintf("Event type too short: '%s'", typ))
+ return nil, errorsmod.Wrap(types.ErrInvalidEvent, fmt.Sprintf("Event type too short: '%s'", typ))
}
attributes, err := contractSDKEventAttributes(e.Attributes, contractAddr)
if err != nil {
@@ -50,16 +51,16 @@ func contractSDKEventAttributes(customAttributes []wasmvmtypes.EventAttribute, c
// ensure key and value are non-empty (and trim what is there)
key := strings.TrimSpace(l.Key)
if len(key) == 0 {
- return nil, sdkerrors.Wrap(types.ErrInvalidEvent, fmt.Sprintf("Empty attribute key. Value: %s", l.Value))
+ return nil, errorsmod.Wrap(types.ErrInvalidEvent, fmt.Sprintf("Empty attribute key. Value: %s", l.Value))
}
value := strings.TrimSpace(l.Value)
// TODO: check if this is legal in the SDK - if it is, we can remove this check
if len(value) == 0 {
- return nil, sdkerrors.Wrap(types.ErrInvalidEvent, fmt.Sprintf("Empty attribute value. Key: %s", key))
+ return nil, errorsmod.Wrap(types.ErrInvalidEvent, fmt.Sprintf("Empty attribute value. Key: %s", key))
}
// and reserve all _* keys for our use (not contract)
if strings.HasPrefix(key, types.AttributeReservedPrefix) {
- return nil, sdkerrors.Wrap(types.ErrInvalidEvent, fmt.Sprintf("Attribute key starts with reserved prefix %s: '%s'", types.AttributeReservedPrefix, key))
+ return nil, errorsmod.Wrap(types.ErrInvalidEvent, fmt.Sprintf("Attribute key starts with reserved prefix %s: '%s'", types.AttributeReservedPrefix, key))
}
attrs = append(attrs, sdk.NewAttribute(key, value))
}
diff --git a/x/wasm/keeper/events_test.go b/x/wasm/keeper/events_test.go
index d35c88ecf0..b305df4204 100644
--- a/x/wasm/keeper/events_test.go
+++ b/x/wasm/keeper/events_test.go
@@ -280,7 +280,7 @@ func hasWasmModuleEvent(ctx sdk.Context, contractAddr sdk.AccAddress) bool {
for _, e := range ctx.EventManager().Events() {
if e.Type == types.WasmModuleEventType {
for _, a := range e.Attributes {
- if string(a.Key) == types.AttributeKeyContractAddr && string(a.Value) == contractAddr.String() {
+ if a.Key == types.AttributeKeyContractAddr && a.Value == contractAddr.String() {
return true
}
}
diff --git a/x/wasm/keeper/gas_register.go b/x/wasm/keeper/gas_register.go
index 7292e48c0f..ad97b30c56 100644
--- a/x/wasm/keeper/gas_register.go
+++ b/x/wasm/keeper/gas_register.go
@@ -1,6 +1,7 @@
package keeper
import (
+ errorsmod "cosmossdk.io/errors"
wasmvmtypes "github.com/CosmWasm/wasmvm/types"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
@@ -140,7 +141,7 @@ func NewDefaultWasmGasRegister() WasmGasRegister {
// NewWasmGasRegister constructor
func NewWasmGasRegister(c WasmGasRegisterConfig) WasmGasRegister {
if c.GasMultiplier == 0 {
- panic(sdkerrors.Wrap(sdkerrors.ErrLogic, "GasMultiplier can not be 0"))
+ panic(errorsmod.Wrap(sdkerrors.ErrLogic, "GasMultiplier can not be 0"))
}
return WasmGasRegister{
c: c,
@@ -155,7 +156,7 @@ func (g WasmGasRegister) NewContractInstanceCosts(pinned bool, msgLen int) store
// CompileCosts costs to persist and "compile" a new wasm contract
func (g WasmGasRegister) CompileCosts(byteLength int) storetypes.Gas {
if byteLength < 0 {
- panic(sdkerrors.Wrap(types.ErrInvalid, "negative length"))
+ panic(errorsmod.Wrap(types.ErrInvalid, "negative length"))
}
return g.c.CompileCost * uint64(byteLength)
}
@@ -163,7 +164,7 @@ func (g WasmGasRegister) CompileCosts(byteLength int) storetypes.Gas {
// UncompressCosts costs to unpack a new wasm contract
func (g WasmGasRegister) UncompressCosts(byteLength int) sdk.Gas {
if byteLength < 0 {
- panic(sdkerrors.Wrap(types.ErrInvalid, "negative length"))
+ panic(errorsmod.Wrap(types.ErrInvalid, "negative length"))
}
return g.c.UncompressCost.Mul(uint64(byteLength)).Floor()
}
@@ -171,7 +172,7 @@ func (g WasmGasRegister) UncompressCosts(byteLength int) sdk.Gas {
// InstantiateContractCosts costs when interacting with a wasm contract
func (g WasmGasRegister) InstantiateContractCosts(pinned bool, msgLen int) sdk.Gas {
if msgLen < 0 {
- panic(sdkerrors.Wrap(types.ErrInvalid, "negative length"))
+ panic(errorsmod.Wrap(types.ErrInvalid, "negative length"))
}
dataCosts := sdk.Gas(msgLen) * g.c.ContractMessageDataCost
if pinned {
diff --git a/x/wasm/keeper/gas_register_test.go b/x/wasm/keeper/gas_register_test.go
index 03f6cdd863..bf8dcd773d 100644
--- a/x/wasm/keeper/gas_register_test.go
+++ b/x/wasm/keeper/gas_register_test.go
@@ -84,12 +84,12 @@ func TestNewContractInstanceCosts(t *testing.T) {
"big msg - unpinned": {
srcLen: math.MaxUint32,
srcConfig: DefaultGasRegisterConfig(),
- exp: sdk.Gas(DefaultContractMessageDataCost*math.MaxUint32 + DefaultInstanceCost),
+ exp: DefaultContractMessageDataCost*math.MaxUint32 + DefaultInstanceCost,
},
"empty msg - unpinned": {
srcLen: 0,
srcConfig: DefaultGasRegisterConfig(),
- exp: sdk.Gas(DefaultInstanceCost),
+ exp: DefaultInstanceCost,
},
"negative len": {
@@ -131,7 +131,7 @@ func TestContractInstanceCosts(t *testing.T) {
srcLen: math.MaxUint32,
srcConfig: DefaultGasRegisterConfig(),
pinned: true,
- exp: sdk.Gas(DefaultContractMessageDataCost * math.MaxUint32),
+ exp: DefaultContractMessageDataCost * math.MaxUint32,
},
"empty msg - pinned": {
srcLen: 0,
@@ -147,12 +147,12 @@ func TestContractInstanceCosts(t *testing.T) {
"big msg - unpinned": {
srcLen: math.MaxUint32,
srcConfig: DefaultGasRegisterConfig(),
- exp: sdk.Gas(DefaultContractMessageDataCost*math.MaxUint32 + DefaultInstanceCost),
+ exp: DefaultContractMessageDataCost*math.MaxUint32 + DefaultInstanceCost,
},
"empty msg - unpinned": {
srcLen: 0,
srcConfig: DefaultGasRegisterConfig(),
- exp: sdk.Gas(DefaultInstanceCost),
+ exp: DefaultInstanceCost,
},
"negative len": {
@@ -196,7 +196,7 @@ func TestReplyCost(t *testing.T) {
},
srcConfig: DefaultGasRegisterConfig(),
pinned: true,
- exp: sdk.Gas(3*DefaultEventAttributeDataCost + DefaultPerAttributeCost + DefaultContractMessageDataCost), // 3 == len("foo")
+ exp: 3*DefaultEventAttributeDataCost + DefaultPerAttributeCost + DefaultContractMessageDataCost, // 3 == len("foo")
},
"subcall response with events - pinned": {
src: wasmvmtypes.Reply{
@@ -210,7 +210,7 @@ func TestReplyCost(t *testing.T) {
},
srcConfig: DefaultGasRegisterConfig(),
pinned: true,
- exp: sdk.Gas(3*DefaultEventAttributeDataCost + DefaultPerAttributeCost), // 3 == len("foo")
+ exp: 3*DefaultEventAttributeDataCost + DefaultPerAttributeCost, // 3 == len("foo")
},
"subcall response with events exceeds free tier- pinned": {
src: wasmvmtypes.Reply{
@@ -224,7 +224,7 @@ func TestReplyCost(t *testing.T) {
},
srcConfig: DefaultGasRegisterConfig(),
pinned: true,
- exp: sdk.Gas((3+6)*DefaultEventAttributeDataCost + DefaultPerAttributeCost), // 3 == len("foo"), 6 == len("myData")
+ exp: (3+6)*DefaultEventAttributeDataCost + DefaultPerAttributeCost, // 3 == len("foo"), 6 == len("myData")
},
"subcall response error - pinned": {
src: wasmvmtypes.Reply{
@@ -248,7 +248,7 @@ func TestReplyCost(t *testing.T) {
},
},
srcConfig: DefaultGasRegisterConfig(),
- exp: sdk.Gas(DefaultInstanceCost + 3*DefaultEventAttributeDataCost + DefaultPerAttributeCost + DefaultContractMessageDataCost),
+ exp: DefaultInstanceCost + 3*DefaultEventAttributeDataCost + DefaultPerAttributeCost + DefaultContractMessageDataCost,
},
"subcall response with events - unpinned": {
src: wasmvmtypes.Reply{
@@ -261,7 +261,7 @@ func TestReplyCost(t *testing.T) {
},
},
srcConfig: DefaultGasRegisterConfig(),
- exp: sdk.Gas(DefaultInstanceCost + 3*DefaultEventAttributeDataCost + DefaultPerAttributeCost),
+ exp: DefaultInstanceCost + 3*DefaultEventAttributeDataCost + DefaultPerAttributeCost,
},
"subcall response with events exceeds free tier- unpinned": {
src: wasmvmtypes.Reply{
@@ -274,7 +274,7 @@ func TestReplyCost(t *testing.T) {
},
},
srcConfig: DefaultGasRegisterConfig(),
- exp: sdk.Gas(DefaultInstanceCost + (3+6)*DefaultEventAttributeDataCost + DefaultPerAttributeCost), // 3 == len("foo"), 6 == len("myData")
+ exp: DefaultInstanceCost + (3+6)*DefaultEventAttributeDataCost + DefaultPerAttributeCost, // 3 == len("foo"), 6 == len("myData")
},
"subcall response error - unpinned": {
src: wasmvmtypes.Reply{
@@ -283,7 +283,7 @@ func TestReplyCost(t *testing.T) {
},
},
srcConfig: DefaultGasRegisterConfig(),
- exp: sdk.Gas(DefaultInstanceCost + 3*DefaultContractMessageDataCost),
+ exp: DefaultInstanceCost + 3*DefaultContractMessageDataCost,
},
"subcall response with empty events": {
src: wasmvmtypes.Reply{
diff --git a/x/wasm/keeper/genesis.go b/x/wasm/keeper/genesis.go
index 183c6f48ba..60f5d99316 100644
--- a/x/wasm/keeper/genesis.go
+++ b/x/wasm/keeper/genesis.go
@@ -1,9 +1,9 @@
package keeper
import (
+ errorsmod "cosmossdk.io/errors"
+ abci "github.com/cometbft/cometbft/abci/types"
sdk "github.com/cosmos/cosmos-sdk/types"
- sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
- abci "github.com/tendermint/tendermint/abci/types"
"github.com/CosmWasm/wasmd/x/wasm/types"
)
@@ -18,19 +18,23 @@ type ValidatorSetSource interface {
// CONTRACT: all types of accounts must have been already initialized/created
func InitGenesis(ctx sdk.Context, keeper *Keeper, data types.GenesisState) ([]abci.ValidatorUpdate, error) {
contractKeeper := NewGovPermissionKeeper(keeper)
- keeper.SetParams(ctx, data.Params)
+ err := keeper.SetParams(ctx, data.Params)
+ if err != nil {
+ return nil, errorsmod.Wrapf(err, "set params")
+ }
+
var maxCodeID uint64
for i, code := range data.Codes {
err := keeper.importCode(ctx, code.CodeID, code.CodeInfo, code.CodeBytes)
if err != nil {
- return nil, sdkerrors.Wrapf(err, "code %d with id: %d", i, code.CodeID)
+ return nil, errorsmod.Wrapf(err, "code %d with id: %d", i, code.CodeID)
}
if code.CodeID > maxCodeID {
maxCodeID = code.CodeID
}
if code.Pinned {
if err := contractKeeper.PinCode(ctx, code.CodeID); err != nil {
- return nil, sdkerrors.Wrapf(err, "contract number %d", i)
+ return nil, errorsmod.Wrapf(err, "contract number %d", i)
}
}
}
@@ -39,11 +43,11 @@ func InitGenesis(ctx sdk.Context, keeper *Keeper, data types.GenesisState) ([]ab
for i, contract := range data.Contracts {
contractAddr, err := sdk.AccAddressFromBech32(contract.ContractAddress)
if err != nil {
- return nil, sdkerrors.Wrapf(err, "address in contract number %d", i)
+ return nil, errorsmod.Wrapf(err, "address in contract number %d", i)
}
err = keeper.importContract(ctx, contractAddr, &contract.ContractInfo, contract.ContractState, contract.ContractCodeHistory)
if err != nil {
- return nil, sdkerrors.Wrapf(err, "contract number %d", i)
+ return nil, errorsmod.Wrapf(err, "contract number %d", i)
}
maxContractID = i + 1 // not ideal but max(contractID) is not persisted otherwise
}
@@ -51,18 +55,18 @@ func InitGenesis(ctx sdk.Context, keeper *Keeper, data types.GenesisState) ([]ab
for i, seq := range data.Sequences {
err := keeper.importAutoIncrementID(ctx, seq.IDKey, seq.Value)
if err != nil {
- return nil, sdkerrors.Wrapf(err, "sequence number %d", i)
+ return nil, errorsmod.Wrapf(err, "sequence number %d", i)
}
}
// sanity check seq values
seqVal := keeper.PeekAutoIncrementID(ctx, types.KeyLastCodeID)
if seqVal <= maxCodeID {
- return nil, sdkerrors.Wrapf(types.ErrInvalid, "seq %s with value: %d must be greater than: %d ", string(types.KeyLastCodeID), seqVal, maxCodeID)
+ return nil, errorsmod.Wrapf(types.ErrInvalid, "seq %s with value: %d must be greater than: %d ", string(types.KeyLastCodeID), seqVal, maxCodeID)
}
seqVal = keeper.PeekAutoIncrementID(ctx, types.KeyLastInstanceID)
if seqVal <= uint64(maxContractID) {
- return nil, sdkerrors.Wrapf(types.ErrInvalid, "seq %s with value: %d must be greater than: %d ", string(types.KeyLastInstanceID), seqVal, maxContractID)
+ return nil, errorsmod.Wrapf(types.ErrInvalid, "seq %s with value: %d must be greater than: %d ", string(types.KeyLastInstanceID), seqVal, maxContractID)
}
return nil, nil
}
diff --git a/x/wasm/keeper/genesis_test.go b/x/wasm/keeper/genesis_test.go
index 063b2adc50..d5722fd868 100644
--- a/x/wasm/keeper/genesis_test.go
+++ b/x/wasm/keeper/genesis_test.go
@@ -9,30 +9,33 @@ import (
"testing"
"time"
+ abci "github.com/cometbft/cometbft/abci/types"
+
+ "github.com/cosmos/cosmos-sdk/baseapp"
+ storetypes "github.com/cosmos/cosmos-sdk/store/types"
+ govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
+ "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
+
+ dbm "github.com/cometbft/cometbft-db"
+ "github.com/cometbft/cometbft/libs/log"
+ tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
"github.com/cosmos/cosmos-sdk/store"
sdk "github.com/cosmos/cosmos-sdk/types"
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
+ authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
- distributionkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper"
- govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
- paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper"
- paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
fuzz "github.com/google/gofuzz"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
- "github.com/tendermint/tendermint/libs/log"
- tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
- dbm "github.com/tendermint/tm-db"
"github.com/CosmWasm/wasmd/x/wasm/types"
- wasmTypes "github.com/CosmWasm/wasmd/x/wasm/types"
)
const firstCodeID = 1
func TestGenesisExportImport(t *testing.T) {
- wasmKeeper, srcCtx, srcStoreKeys := setupKeeper(t)
+ wasmKeeper, srcCtx := setupKeeper(t)
contractKeeper := NewGovPermissionKeeper(wasmKeeper)
wasmCode, err := os.ReadFile("./testdata/hackatom.wasm")
@@ -41,7 +44,8 @@ func TestGenesisExportImport(t *testing.T) {
// store some test data
f := fuzz.New().Funcs(ModelFuzzers...)
- wasmKeeper.SetParams(srcCtx, types.DefaultParams())
+ err = wasmKeeper.SetParams(srcCtx, types.DefaultParams())
+ require.NoError(t, err)
for i := 0; i < 25; i++ {
var (
@@ -64,26 +68,30 @@ func TestGenesisExportImport(t *testing.T) {
codeID, _, err := contractKeeper.Create(srcCtx, creatorAddr, wasmCode, &codeInfo.InstantiateConfig)
require.NoError(t, err)
if pinned {
- contractKeeper.PinCode(srcCtx, codeID)
+ err = contractKeeper.PinCode(srcCtx, codeID)
+ require.NoError(t, err)
}
if contractExtension {
anyTime := time.Now().UTC()
- var nestedType govtypes.TextProposal
+ var nestedType v1beta1.TextProposal
f.NilChance(0).Fuzz(&nestedType)
- myExtension, err := govtypes.NewProposal(&nestedType, 1, anyTime, anyTime)
+ myExtension, err := v1beta1.NewProposal(&nestedType, 1, anyTime, anyTime)
+ require.NoError(t, err)
+ err = contract.SetExtension(&myExtension)
require.NoError(t, err)
- contract.SetExtension(&myExtension)
}
contract.CodeID = codeID
contractAddr := wasmKeeper.ClassicAddressGenerator()(srcCtx, codeID, nil)
wasmKeeper.storeContractInfo(srcCtx, contractAddr, &contract)
wasmKeeper.appendToContractHistory(srcCtx, contractAddr, history...)
- wasmKeeper.importContractState(srcCtx, contractAddr, stateModels)
+ err = wasmKeeper.importContractState(srcCtx, contractAddr, stateModels)
+ require.NoError(t, err)
}
var wasmParams types.Params
f.NilChance(0).Fuzz(&wasmParams)
- wasmKeeper.SetParams(srcCtx, wasmParams)
+ err = wasmKeeper.SetParams(srcCtx, wasmParams)
+ require.NoError(t, err)
// export
exportedState := ExportGenesis(srcCtx, wasmKeeper)
@@ -101,10 +109,10 @@ func TestGenesisExportImport(t *testing.T) {
require.NoError(t, err)
// setup new instances
- dstKeeper, dstCtx, dstStoreKeys := setupKeeper(t)
+ dstKeeper, dstCtx := setupKeeper(t)
// reset contract code index in source DB for comparison with dest DB
- wasmKeeper.IterateContractInfo(srcCtx, func(address sdk.AccAddress, info wasmTypes.ContractInfo) bool {
+ wasmKeeper.IterateContractInfo(srcCtx, func(address sdk.AccAddress, info types.ContractInfo) bool {
creatorAddress := sdk.MustAccAddressFromBech32(info.Creator)
history := wasmKeeper.GetContractHistory(srcCtx, address)
@@ -114,36 +122,36 @@ func TestGenesisExportImport(t *testing.T) {
})
// re-import
- var importState wasmTypes.GenesisState
+ var importState types.GenesisState
err = dstKeeper.cdc.UnmarshalJSON(exportedGenesis, &importState)
require.NoError(t, err)
- InitGenesis(dstCtx, dstKeeper, importState)
+ _, err = InitGenesis(dstCtx, dstKeeper, importState)
+ require.NoError(t, err)
// compare whole DB
- for j := range srcStoreKeys {
- srcIT := srcCtx.KVStore(srcStoreKeys[j]).Iterator(nil, nil)
- dstIT := dstCtx.KVStore(dstStoreKeys[j]).Iterator(nil, nil)
-
- for i := 0; srcIT.Valid(); i++ {
- require.True(t, dstIT.Valid(), "[%s] destination DB has less elements than source. Missing: %x", srcStoreKeys[j].Name(), srcIT.Key())
- require.Equal(t, srcIT.Key(), dstIT.Key(), i)
- require.Equal(t, srcIT.Value(), dstIT.Value(), "[%s] element (%d): %X", srcStoreKeys[j].Name(), i, srcIT.Key())
- dstIT.Next()
- srcIT.Next()
- }
- if !assert.False(t, dstIT.Valid()) {
- t.Fatalf("dest Iterator still has key :%X", dstIT.Key())
- }
- srcIT.Close()
- dstIT.Close()
+
+ srcIT := srcCtx.KVStore(wasmKeeper.storeKey).Iterator(nil, nil)
+ dstIT := dstCtx.KVStore(dstKeeper.storeKey).Iterator(nil, nil)
+
+ for i := 0; srcIT.Valid(); i++ {
+ require.True(t, dstIT.Valid(), "[%s] destination DB has less elements than source. Missing: %x", wasmKeeper.storeKey.Name(), srcIT.Key())
+ require.Equal(t, srcIT.Key(), dstIT.Key(), i)
+ require.Equal(t, srcIT.Value(), dstIT.Value(), "[%s] element (%d): %X", wasmKeeper.storeKey.Name(), i, srcIT.Key())
+ dstIT.Next()
+ srcIT.Next()
+ }
+ if !assert.False(t, dstIT.Valid()) {
+ t.Fatalf("dest Iterator still has key :%X", dstIT.Key())
}
+ srcIT.Close()
+ dstIT.Close()
}
func TestGenesisInit(t *testing.T) {
wasmCode, err := os.ReadFile("./testdata/hackatom.wasm")
require.NoError(t, err)
- myCodeInfo := wasmTypes.CodeInfoFixture(wasmTypes.WithSHA256CodeHash(wasmCode))
+ myCodeInfo := types.CodeInfoFixture(types.WithSHA256CodeHash(wasmCode))
specs := map[string]struct {
src types.GenesisState
expSuccess bool
@@ -205,7 +213,7 @@ func TestGenesisInit(t *testing.T) {
"prevent code hash mismatch": {src: types.GenesisState{
Codes: []types.Code{{
CodeID: firstCodeID,
- CodeInfo: wasmTypes.CodeInfoFixture(func(i *wasmTypes.CodeInfo) { i.CodeHash = make([]byte, sha256.Size) }),
+ CodeInfo: types.CodeInfoFixture(func(i *types.CodeInfo) { i.CodeHash = make([]byte, sha256.Size) }),
CodeBytes: wasmCode,
}},
Params: types.DefaultParams(),
@@ -254,7 +262,7 @@ func TestGenesisInit(t *testing.T) {
Contracts: []types.Contract{
{
ContractAddress: BuildContractAddressClassic(1, 1).String(),
- ContractInfo: types.ContractInfoFixture(func(c *wasmTypes.ContractInfo) { c.CodeID = 1 }, types.RandCreatedFields),
+ ContractInfo: types.ContractInfoFixture(func(c *types.ContractInfo) { c.CodeID = 1 }, types.RandCreatedFields),
ContractCodeHistory: []types.ContractCodeHistoryEntry{
{
Operation: types.ContractCodeHistoryOperationTypeMigrate,
@@ -283,7 +291,7 @@ func TestGenesisInit(t *testing.T) {
Contracts: []types.Contract{
{
ContractAddress: BuildContractAddressClassic(1, 1).String(),
- ContractInfo: types.ContractInfoFixture(func(c *wasmTypes.ContractInfo) { c.CodeID = 1 }, types.RandCreatedFields),
+ ContractInfo: types.ContractInfoFixture(func(c *types.ContractInfo) { c.CodeID = 1 }, types.RandCreatedFields),
ContractCodeHistory: []types.ContractCodeHistoryEntry{
{
Operation: types.ContractCodeHistoryOperationTypeMigrate,
@@ -294,7 +302,7 @@ func TestGenesisInit(t *testing.T) {
},
}, {
ContractAddress: BuildContractAddressClassic(1, 2).String(),
- ContractInfo: types.ContractInfoFixture(func(c *wasmTypes.ContractInfo) { c.CodeID = 1 }, types.RandCreatedFields),
+ ContractInfo: types.ContractInfoFixture(func(c *types.ContractInfo) { c.CodeID = 1 }, types.RandCreatedFields),
ContractCodeHistory: []types.ContractCodeHistoryEntry{
{
Operation: types.ContractCodeHistoryOperationTypeMigrate,
@@ -318,7 +326,7 @@ func TestGenesisInit(t *testing.T) {
Contracts: []types.Contract{
{
ContractAddress: BuildContractAddressClassic(1, 1).String(),
- ContractInfo: types.ContractInfoFixture(func(c *wasmTypes.ContractInfo) { c.CodeID = 1 }, types.RandCreatedFields),
+ ContractInfo: types.ContractInfoFixture(func(c *types.ContractInfo) { c.CodeID = 1 }, types.RandCreatedFields),
ContractCodeHistory: []types.ContractCodeHistoryEntry{
{
Operation: types.ContractCodeHistoryOperationTypeMigrate,
@@ -342,7 +350,7 @@ func TestGenesisInit(t *testing.T) {
Contracts: []types.Contract{
{
ContractAddress: BuildContractAddressClassic(1, 1).String(),
- ContractInfo: types.ContractInfoFixture(func(c *wasmTypes.ContractInfo) { c.CodeID = 1 }, types.RandCreatedFields),
+ ContractInfo: types.ContractInfoFixture(func(c *types.ContractInfo) { c.CodeID = 1 }, types.RandCreatedFields),
ContractCodeHistory: []types.ContractCodeHistoryEntry{
{
Operation: types.ContractCodeHistoryOperationTypeMigrate,
@@ -353,7 +361,7 @@ func TestGenesisInit(t *testing.T) {
},
}, {
ContractAddress: BuildContractAddressClassic(1, 1).String(),
- ContractInfo: types.ContractInfoFixture(func(c *wasmTypes.ContractInfo) { c.CodeID = 1 }, types.RandCreatedFields),
+ ContractInfo: types.ContractInfoFixture(func(c *types.ContractInfo) { c.CodeID = 1 }, types.RandCreatedFields),
ContractCodeHistory: []types.ContractCodeHistoryEntry{
{
Operation: types.ContractCodeHistoryOperationTypeMigrate,
@@ -377,7 +385,7 @@ func TestGenesisInit(t *testing.T) {
Contracts: []types.Contract{
{
ContractAddress: BuildContractAddressClassic(1, 1).String(),
- ContractInfo: types.ContractInfoFixture(func(c *wasmTypes.ContractInfo) { c.CodeID = 1 }, types.RandCreatedFields),
+ ContractInfo: types.ContractInfoFixture(func(c *types.ContractInfo) { c.CodeID = 1 }, types.RandCreatedFields),
ContractState: []types.Model{
{
Key: []byte{0x1},
@@ -433,7 +441,7 @@ func TestGenesisInit(t *testing.T) {
Contracts: []types.Contract{
{
ContractAddress: BuildContractAddressClassic(1, 1).String(),
- ContractInfo: types.ContractInfoFixture(func(c *wasmTypes.ContractInfo) { c.CodeID = 1 }, types.RandCreatedFields),
+ ContractInfo: types.ContractInfoFixture(func(c *types.ContractInfo) { c.CodeID = 1 }, types.RandCreatedFields),
ContractCodeHistory: []types.ContractCodeHistoryEntry{
{
Operation: types.ContractCodeHistoryOperationTypeMigrate,
@@ -454,7 +462,7 @@ func TestGenesisInit(t *testing.T) {
}
for msg, spec := range specs {
t.Run(msg, func(t *testing.T) {
- keeper, ctx, _ := setupKeeper(t)
+ keeper, ctx := setupKeeper(t)
require.NoError(t, types.ValidateGenesis(spec.src))
_, gotErr := InitGenesis(ctx, keeper, spec.src)
@@ -534,7 +542,7 @@ func TestImportContractWithCodeHistoryPreserved(t *testing.T) {
{"id_key": "BGxhc3RDb250cmFjdElk", "value": "3"}
]
}`
- keeper, ctx, _ := setupKeeper(t)
+ keeper, ctx := setupKeeper(t)
wasmCode, err := os.ReadFile("./testdata/hackatom.wasm")
require.NoError(t, err)
@@ -543,7 +551,7 @@ func TestImportContractWithCodeHistoryPreserved(t *testing.T) {
enc64 := base64.StdEncoding.EncodeToString
genesisStr := fmt.Sprintf(genesisTemplate, enc64(wasmCodeHash[:]), enc64(wasmCode))
- var importState wasmTypes.GenesisState
+ var importState types.GenesisState
err = keeper.cdc.UnmarshalJSON([]byte(genesisStr), &importState)
require.NoError(t, err)
require.NoError(t, importState.ValidateBasic(), genesisStr)
@@ -566,7 +574,7 @@ func TestImportContractWithCodeHistoryPreserved(t *testing.T) {
expCodeInfo := types.CodeInfo{
CodeHash: wasmCodeHash[:],
Creator: codeCreatorAddr,
- InstantiateConfig: wasmTypes.AccessConfig{
+ InstantiateConfig: types.AccessConfig{
Permission: types.AccessTypeOnlyAddress,
Address: codeCreatorAddr,
},
@@ -614,22 +622,17 @@ func TestImportContractWithCodeHistoryPreserved(t *testing.T) {
assert.Equal(t, uint64(3), keeper.PeekAutoIncrementID(ctx, types.KeyLastInstanceID))
}
-func setupKeeper(t *testing.T) (*Keeper, sdk.Context, []sdk.StoreKey) {
+func setupKeeper(t *testing.T) (*Keeper, sdk.Context) {
t.Helper()
tempDir, err := os.MkdirTemp("", "wasm")
require.NoError(t, err)
t.Cleanup(func() { os.RemoveAll(tempDir) })
- var (
- keyParams = sdk.NewKVStoreKey(paramtypes.StoreKey)
- tkeyParams = sdk.NewTransientStoreKey(paramtypes.TStoreKey)
- keyWasm = sdk.NewKVStoreKey(wasmTypes.StoreKey)
- )
+
+ keyWasm := sdk.NewKVStoreKey(types.StoreKey)
db := dbm.NewMemDB()
ms := store.NewCommitMultiStore(db)
- ms.MountStoreWithDB(keyWasm, sdk.StoreTypeIAVL, db)
- ms.MountStoreWithDB(keyParams, sdk.StoreTypeIAVL, db)
- ms.MountStoreWithDB(tkeyParams, sdk.StoreTypeTransient, db)
+ ms.MountStoreWithDB(keyWasm, storetypes.StoreTypeIAVL, db)
require.NoError(t, ms.LoadLatestVersion())
ctx := sdk.NewContext(ms, tmproto.Header{
@@ -641,22 +644,20 @@ func setupKeeper(t *testing.T) (*Keeper, sdk.Context, []sdk.StoreKey) {
// register an example extension. must be protobuf
encodingConfig.InterfaceRegistry.RegisterImplementations(
(*types.ContractInfoExtension)(nil),
- &govtypes.Proposal{},
+ &v1beta1.Proposal{},
)
// also registering gov interfaces for nested Any type
- govtypes.RegisterInterfaces(encodingConfig.InterfaceRegistry)
+ v1beta1.RegisterInterfaces(encodingConfig.InterfaceRegistry)
- wasmConfig := wasmTypes.DefaultWasmConfig()
- pk := paramskeeper.NewKeeper(encodingConfig.Marshaler, encodingConfig.Amino, keyParams, tkeyParams)
+ wasmConfig := types.DefaultWasmConfig()
srcKeeper := NewKeeper(
encodingConfig.Marshaler,
keyWasm,
- pk.Subspace(wasmTypes.ModuleName),
authkeeper.AccountKeeper{},
&bankkeeper.BaseKeeper{},
stakingkeeper.Keeper{},
- distributionkeeper.Keeper{},
+ nil,
nil,
nil,
nil,
@@ -666,6 +667,39 @@ func setupKeeper(t *testing.T) (*Keeper, sdk.Context, []sdk.StoreKey) {
tempDir,
wasmConfig,
AvailableCapabilities,
+ authtypes.NewModuleAddress(govtypes.ModuleName).String(),
)
- return &srcKeeper, ctx, []sdk.StoreKey{keyWasm, keyParams}
+ return &srcKeeper, ctx
+}
+
+type StakingKeeperMock struct {
+ err error
+ validatorUpdate []abci.ValidatorUpdate
+ gotCalls int
+}
+
+func (s *StakingKeeperMock) ApplyAndReturnValidatorSetUpdates(_ sdk.Context) ([]abci.ValidatorUpdate, error) {
+ s.gotCalls++
+ return s.validatorUpdate, s.err
+}
+
+var _ MessageRouter = &MockMsgHandler{}
+
+type MockMsgHandler struct {
+ result *sdk.Result
+ err error
+ expCalls int //nolint:unused
+ gotCalls int
+ expMsg sdk.Msg //nolint:unused
+ gotMsg sdk.Msg
+}
+
+func (m *MockMsgHandler) Handler(msg sdk.Msg) baseapp.MsgServiceHandler {
+ return m.Handle
+}
+
+func (m *MockMsgHandler) Handle(ctx sdk.Context, msg sdk.Msg) (*sdk.Result, error) {
+ m.gotCalls++
+ m.gotMsg = msg
+ return m.result, m.err
}
diff --git a/x/wasm/keeper/handler_plugin.go b/x/wasm/keeper/handler_plugin.go
index bff3550eaa..be608ed5c8 100644
--- a/x/wasm/keeper/handler_plugin.go
+++ b/x/wasm/keeper/handler_plugin.go
@@ -4,13 +4,15 @@ import (
"errors"
"fmt"
+ errorsmod "cosmossdk.io/errors"
+
wasmvmtypes "github.com/CosmWasm/wasmvm/types"
"github.com/cosmos/cosmos-sdk/baseapp"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
- channeltypes "github.com/cosmos/ibc-go/v4/modules/core/04-channel/types"
- host "github.com/cosmos/ibc-go/v4/modules/core/24-host"
+ channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types"
+ host "github.com/cosmos/ibc-go/v7/modules/core/24-host"
"github.com/CosmWasm/wasmd/x/wasm/types"
)
@@ -88,7 +90,7 @@ func (h SDKMessageHandler) handleSdkMessage(ctx sdk.Context, contractAddr sdk.Ad
// make sure this account can send it
for _, acct := range msg.GetSigners() {
if !acct.Equals(contractAddr) {
- return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "contract doesn't have permission")
+ return nil, errorsmod.Wrap(sdkerrors.ErrUnauthorized, "contract doesn't have permission")
}
}
@@ -103,7 +105,7 @@ func (h SDKMessageHandler) handleSdkMessage(ctx sdk.Context, contractAddr sdk.Ad
// proto messages and has registered all `Msg services`, then this
// path should never be called, because all those Msgs should be
// registered within the `msgServiceRouter` already.
- return nil, sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "can't route message %+v", msg)
+ return nil, errorsmod.Wrapf(sdkerrors.ErrUnknownRequest, "can't route message %+v", msg)
}
// MessageHandlerChain defines a chain of handlers that are called one by one until it can be handled.
@@ -137,7 +139,7 @@ func (m MessageHandlerChain) DispatchMsg(ctx sdk.Context, contractAddr sdk.AccAd
return events, data, err
}
}
- return nil, nil, sdkerrors.Wrap(types.ErrUnknownMsg, "no handler found")
+ return nil, nil, errorsmod.Wrap(types.ErrUnknownMsg, "no handler found")
}
// IBCRawPacketHandler handels IBC.SendPacket messages which are published to an IBC channel.
@@ -156,47 +158,27 @@ func (h IBCRawPacketHandler) DispatchMsg(ctx sdk.Context, _ sdk.AccAddress, cont
return nil, nil, types.ErrUnknownMsg
}
if contractIBCPortID == "" {
- return nil, nil, sdkerrors.Wrapf(types.ErrUnsupportedForContract, "ibc not supported")
+ return nil, nil, errorsmod.Wrapf(types.ErrUnsupportedForContract, "ibc not supported")
}
contractIBCChannelID := msg.IBC.SendPacket.ChannelID
if contractIBCChannelID == "" {
- return nil, nil, sdkerrors.Wrapf(types.ErrEmpty, "ibc channel")
- }
-
- sequence, found := h.channelKeeper.GetNextSequenceSend(ctx, contractIBCPortID, contractIBCChannelID)
- if !found {
- return nil, nil, sdkerrors.Wrapf(channeltypes.ErrSequenceSendNotFound,
- "source port: %s, source channel: %s", contractIBCPortID, contractIBCChannelID,
- )
+ return nil, nil, errorsmod.Wrapf(types.ErrEmpty, "ibc channel")
}
- channelInfo, ok := h.channelKeeper.GetChannel(ctx, contractIBCPortID, contractIBCChannelID)
- if !ok {
- return nil, nil, sdkerrors.Wrap(channeltypes.ErrInvalidChannel, "not found")
- }
channelCap, ok := h.capabilityKeeper.GetCapability(ctx, host.ChannelCapabilityPath(contractIBCPortID, contractIBCChannelID))
if !ok {
- return nil, nil, sdkerrors.Wrap(channeltypes.ErrChannelCapabilityNotFound, "module does not own channel capability")
- }
- packet := channeltypes.NewPacket(
- msg.IBC.SendPacket.Data,
- sequence,
- contractIBCPortID,
- contractIBCChannelID,
- channelInfo.Counterparty.PortId,
- channelInfo.Counterparty.ChannelId,
- ConvertWasmIBCTimeoutHeightToCosmosHeight(msg.IBC.SendPacket.Timeout.Block),
- msg.IBC.SendPacket.Timeout.Timestamp,
- )
-
- if err := h.channelKeeper.SendPacket(ctx, channelCap, packet); err != nil {
- return nil, nil, sdkerrors.Wrap(err, "failed to send packet")
+ return nil, nil, errorsmod.Wrap(channeltypes.ErrChannelCapabilityNotFound, "module does not own channel capability")
+ }
+ seq, err := h.channelKeeper.SendPacket(ctx, channelCap, contractIBCPortID, contractIBCChannelID, ConvertWasmIBCTimeoutHeightToCosmosHeight(msg.IBC.SendPacket.Timeout.Block), msg.IBC.SendPacket.Timeout.Timestamp, msg.IBC.SendPacket.Data)
+ if err != nil {
+ return nil, nil, errorsmod.Wrap(err, "channel")
}
+ moduleLogger(ctx).Debug("ibc packet set", "seq", seq)
- resp := &types.MsgIBCSendResponse{Sequence: sequence}
+ resp := &types.MsgIBCSendResponse{Sequence: seq}
val, err := resp.Marshal()
if err != nil {
- return nil, nil, sdkerrors.Wrap(err, "failed to marshal IBC send response")
+ return nil, nil, errorsmod.Wrap(err, "failed to marshal IBC send response")
}
return nil, [][]byte{val}, nil
@@ -224,10 +206,10 @@ func NewBurnCoinMessageHandler(burner types.Burner) MessageHandlerFunc {
return nil, nil, types.ErrEmpty.Wrap("amount")
}
if err := burner.SendCoinsFromAccountToModule(ctx, contractAddr, types.ModuleName, coins); err != nil {
- return nil, nil, sdkerrors.Wrap(err, "transfer to module")
+ return nil, nil, errorsmod.Wrap(err, "transfer to module")
}
if err := burner.BurnCoins(ctx, types.ModuleName, coins); err != nil {
- return nil, nil, sdkerrors.Wrap(err, "burn coins")
+ return nil, nil, errorsmod.Wrap(err, "burn coins")
}
moduleLogger(ctx).Info("Burned", "amount", coins)
return nil, nil, nil
diff --git a/x/wasm/keeper/handler_plugin_encoders.go b/x/wasm/keeper/handler_plugin_encoders.go
index d41d8f1012..f4545fca3f 100644
--- a/x/wasm/keeper/handler_plugin_encoders.go
+++ b/x/wasm/keeper/handler_plugin_encoders.go
@@ -4,17 +4,19 @@ import (
"encoding/json"
"fmt"
+ errorsmod "cosmossdk.io/errors"
+ v1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
+
wasmvmtypes "github.com/CosmWasm/wasmvm/types"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
distributiontypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
- govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
- ibctransfertypes "github.com/cosmos/ibc-go/v4/modules/apps/transfer/types"
- ibcclienttypes "github.com/cosmos/ibc-go/v4/modules/core/02-client/types"
- channeltypes "github.com/cosmos/ibc-go/v4/modules/core/04-channel/types"
+ ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types"
+ ibcclienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types"
+ channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types"
"github.com/CosmWasm/wasmd/x/wasm/types"
)
@@ -103,12 +105,12 @@ func (e MessageEncoders) Encode(ctx sdk.Context, contractAddr sdk.AccAddress, co
case msg.Gov != nil:
return EncodeGovMsg(contractAddr, msg.Gov)
}
- return nil, sdkerrors.Wrap(types.ErrUnknownMsg, "unknown variant of Wasm")
+ return nil, errorsmod.Wrap(types.ErrUnknownMsg, "unknown variant of Wasm")
}
func EncodeBankMsg(sender sdk.AccAddress, msg *wasmvmtypes.BankMsg) ([]sdk.Msg, error) {
if msg.Send == nil {
- return nil, sdkerrors.Wrap(types.ErrUnknownMsg, "unknown variant of Bank")
+ return nil, errorsmod.Wrap(types.ErrUnknownMsg, "unknown variant of Bank")
}
if len(msg.Send.Amount) == 0 {
return nil, nil
@@ -125,8 +127,8 @@ func EncodeBankMsg(sender sdk.AccAddress, msg *wasmvmtypes.BankMsg) ([]sdk.Msg,
return []sdk.Msg{&sdkMsg}, nil
}
-func NoCustomMsg(sender sdk.AccAddress, msg json.RawMessage) ([]sdk.Msg, error) {
- return nil, sdkerrors.Wrap(types.ErrUnknownMsg, "custom variant not supported")
+func NoCustomMsg(_ sdk.AccAddress, _ json.RawMessage) ([]sdk.Msg, error) {
+ return nil, errorsmod.Wrap(types.ErrUnknownMsg, "custom variant not supported")
}
func EncodeDistributionMsg(sender sdk.AccAddress, msg *wasmvmtypes.DistributionMsg) ([]sdk.Msg, error) {
@@ -144,7 +146,7 @@ func EncodeDistributionMsg(sender sdk.AccAddress, msg *wasmvmtypes.DistributionM
}
return []sdk.Msg{&withdrawMsg}, nil
default:
- return nil, sdkerrors.Wrap(types.ErrUnknownMsg, "unknown variant of Distribution")
+ return nil, errorsmod.Wrap(types.ErrUnknownMsg, "unknown variant of Distribution")
}
}
@@ -186,22 +188,22 @@ func EncodeStakingMsg(sender sdk.AccAddress, msg *wasmvmtypes.StakingMsg) ([]sdk
}
return []sdk.Msg{&sdkMsg}, nil
default:
- return nil, sdkerrors.Wrap(types.ErrUnknownMsg, "unknown variant of Staking")
+ return nil, errorsmod.Wrap(types.ErrUnknownMsg, "unknown variant of Staking")
}
}
func EncodeStargateMsg(unpacker codectypes.AnyUnpacker) StargateEncoder {
return func(sender sdk.AccAddress, msg *wasmvmtypes.StargateMsg) ([]sdk.Msg, error) {
- any := codectypes.Any{
+ codecAny := codectypes.Any{
TypeUrl: msg.TypeURL,
Value: msg.Value,
}
var sdkMsg sdk.Msg
- if err := unpacker.UnpackAny(&any, &sdkMsg); err != nil {
- return nil, sdkerrors.Wrap(types.ErrInvalidMsg, fmt.Sprintf("Cannot unpack proto message with type URL: %s", msg.TypeURL))
+ if err := unpacker.UnpackAny(&codecAny, &sdkMsg); err != nil {
+ return nil, errorsmod.Wrap(types.ErrInvalidMsg, fmt.Sprintf("Cannot unpack proto message with type URL: %s", msg.TypeURL))
}
if err := codectypes.UnpackInterfaces(sdkMsg, unpacker); err != nil {
- return nil, sdkerrors.Wrap(types.ErrInvalidMsg, fmt.Sprintf("UnpackInterfaces inside msg: %s", err))
+ return nil, errorsmod.Wrap(types.ErrInvalidMsg, fmt.Sprintf("UnpackInterfaces inside msg: %s", err))
}
return []sdk.Msg{sdkMsg}, nil
}
@@ -277,7 +279,7 @@ func EncodeWasmMsg(sender sdk.AccAddress, msg *wasmvmtypes.WasmMsg) ([]sdk.Msg,
}
return []sdk.Msg{&sdkMsg}, nil
default:
- return nil, sdkerrors.Wrap(types.ErrUnknownMsg, "unknown variant of Wasm")
+ return nil, errorsmod.Wrap(types.ErrUnknownMsg, "unknown variant of Wasm")
}
}
@@ -293,7 +295,7 @@ func EncodeIBCMsg(portSource types.ICS20TransferPortSource) func(ctx sdk.Context
case msg.Transfer != nil:
amount, err := ConvertWasmCoinToSdkCoin(msg.Transfer.Amount)
if err != nil {
- return nil, sdkerrors.Wrap(err, "amount")
+ return nil, errorsmod.Wrap(err, "amount")
}
msg := &ibctransfertypes.MsgTransfer{
SourcePort: portSource.GetPort(ctx),
@@ -306,7 +308,7 @@ func EncodeIBCMsg(portSource types.ICS20TransferPortSource) func(ctx sdk.Context
}
return []sdk.Msg{msg}, nil
default:
- return nil, sdkerrors.Wrap(types.ErrUnknownMsg, "unknown variant of IBC")
+ return nil, errorsmod.Wrap(types.ErrUnknownMsg, "unknown variant of IBC")
}
}
}
@@ -316,24 +318,24 @@ func EncodeGovMsg(sender sdk.AccAddress, msg *wasmvmtypes.GovMsg) ([]sdk.Msg, er
case msg.Vote != nil:
voteOption, err := convertVoteOption(msg.Vote.Vote)
if err != nil {
- return nil, sdkerrors.Wrap(err, "vote option")
+ return nil, errorsmod.Wrap(err, "vote option")
}
- m := govtypes.NewMsgVote(sender, msg.Vote.ProposalId, voteOption)
+ m := v1.NewMsgVote(sender, msg.Vote.ProposalId, voteOption, "")
return []sdk.Msg{m}, nil
case msg.VoteWeighted != nil:
- opts := make([]govtypes.WeightedVoteOption, len(msg.VoteWeighted.Options))
+ opts := make([]*v1.WeightedVoteOption, len(msg.VoteWeighted.Options))
for i, v := range msg.VoteWeighted.Options {
weight, err := sdk.NewDecFromStr(v.Weight)
if err != nil {
- return nil, sdkerrors.Wrapf(err, "weight for vote %d", i+1)
+ return nil, errorsmod.Wrapf(err, "weight for vote %d", i+1)
}
voteOption, err := convertVoteOption(v.Option)
if err != nil {
- return nil, sdkerrors.Wrap(err, "vote option")
+ return nil, errorsmod.Wrap(err, "vote option")
}
- opts[i] = govtypes.WeightedVoteOption{Option: voteOption, Weight: weight}
+ opts[i] = &v1.WeightedVoteOption{Option: voteOption, Weight: weight.String()}
}
- m := govtypes.NewMsgVoteWeighted(sender, msg.VoteWeighted.ProposalId, opts)
+ m := v1.NewMsgVoteWeighted(sender, msg.VoteWeighted.ProposalId, opts, "")
return []sdk.Msg{m}, nil
default:
@@ -341,19 +343,19 @@ func EncodeGovMsg(sender sdk.AccAddress, msg *wasmvmtypes.GovMsg) ([]sdk.Msg, er
}
}
-func convertVoteOption(s interface{}) (govtypes.VoteOption, error) {
- var option govtypes.VoteOption
+func convertVoteOption(s interface{}) (v1.VoteOption, error) {
+ var option v1.VoteOption
switch s {
case wasmvmtypes.Yes:
- option = govtypes.OptionYes
+ option = v1.OptionYes
case wasmvmtypes.No:
- option = govtypes.OptionNo
+ option = v1.OptionNo
case wasmvmtypes.NoWithVeto:
- option = govtypes.OptionNoWithVeto
+ option = v1.OptionNoWithVeto
case wasmvmtypes.Abstain:
- option = govtypes.OptionAbstain
+ option = v1.OptionAbstain
default:
- return govtypes.OptionEmpty, types.ErrInvalid
+ return v1.OptionEmpty, types.ErrInvalid
}
return option, nil
}
@@ -383,7 +385,7 @@ func ConvertWasmCoinsToSdkCoins(coins []wasmvmtypes.Coin) (sdk.Coins, error) {
func ConvertWasmCoinToSdkCoin(coin wasmvmtypes.Coin) (sdk.Coin, error) {
amount, ok := sdk.NewIntFromString(coin.Amount)
if !ok {
- return sdk.Coin{}, sdkerrors.Wrap(sdkerrors.ErrInvalidCoins, coin.Amount+coin.Denom)
+ return sdk.Coin{}, errorsmod.Wrap(sdkerrors.ErrInvalidCoins, coin.Amount+coin.Denom)
}
r := sdk.Coin{
Denom: coin.Denom,
diff --git a/x/wasm/keeper/handler_plugin_encoders_test.go b/x/wasm/keeper/handler_plugin_encoders_test.go
index 60b66fbc0d..d27d6654f4 100644
--- a/x/wasm/keeper/handler_plugin_encoders_test.go
+++ b/x/wasm/keeper/handler_plugin_encoders_test.go
@@ -3,19 +3,19 @@ package keeper
import (
"testing"
- codectypes "github.com/cosmos/cosmos-sdk/codec/types"
- govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
- ibctransfertypes "github.com/cosmos/ibc-go/v4/modules/apps/transfer/types"
- clienttypes "github.com/cosmos/ibc-go/v4/modules/core/02-client/types"
- channeltypes "github.com/cosmos/ibc-go/v4/modules/core/04-channel/types"
- "github.com/golang/protobuf/proto"
- "github.com/stretchr/testify/assert"
-
wasmvmtypes "github.com/CosmWasm/wasmvm/types"
+ codectypes "github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
distributiontypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
+ v1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
+ "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
+ "github.com/cosmos/gogoproto/proto"
+ ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types"
+ clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types"
+ channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types"
+ "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/CosmWasm/wasmd/x/wasm/keeper/wasmtesting"
@@ -50,7 +50,7 @@ func TestEncoding(t *testing.T) {
content, err := codectypes.NewAnyWithValue(types.StoreCodeProposalFixture())
require.NoError(t, err)
- proposalMsg := &govtypes.MsgSubmitProposal{
+ proposalMsg := &v1beta1.MsgSubmitProposal{
Proposer: addr1.String(),
InitialDeposit: sdk.NewCoins(sdk.NewInt64Coin("uatom", 12345)),
Content: content,
@@ -303,7 +303,8 @@ func TestEncoding(t *testing.T) {
},
},
},
- expError: false, // fails in the handler
+ expError: false, // fails in the handler
+ expInvalid: true,
output: []sdk.Msg{
&stakingtypes.MsgDelegate{
DelegatorAddress: addr1.String(),
@@ -542,10 +543,10 @@ func TestEncoding(t *testing.T) {
if tc.expError {
assert.Error(t, err)
return
- } else {
- require.NoError(t, err)
- assert.Equal(t, tc.output, res)
}
+ require.NoError(t, err)
+ assert.Equal(t, tc.output, res)
+
// and valid sdk message
for _, v := range res {
gotErr := v.ValidateBasic()
@@ -581,10 +582,10 @@ func TestEncodeGovMsg(t *testing.T) {
},
},
output: []sdk.Msg{
- &govtypes.MsgVote{
+ &v1.MsgVote{
ProposalId: 1,
Voter: myAddr.String(),
- Option: govtypes.OptionYes,
+ Option: v1.OptionYes,
},
},
},
@@ -596,10 +597,10 @@ func TestEncodeGovMsg(t *testing.T) {
},
},
output: []sdk.Msg{
- &govtypes.MsgVote{
+ &v1.MsgVote{
ProposalId: 1,
Voter: myAddr.String(),
- Option: govtypes.OptionNo,
+ Option: v1.OptionNo,
},
},
},
@@ -611,10 +612,10 @@ func TestEncodeGovMsg(t *testing.T) {
},
},
output: []sdk.Msg{
- &govtypes.MsgVote{
+ &v1.MsgVote{
ProposalId: 10,
Voter: myAddr.String(),
- Option: govtypes.OptionAbstain,
+ Option: v1.OptionAbstain,
},
},
},
@@ -626,10 +627,10 @@ func TestEncodeGovMsg(t *testing.T) {
},
},
output: []sdk.Msg{
- &govtypes.MsgVote{
+ &v1.MsgVote{
ProposalId: 1,
Voter: myAddr.String(),
- Option: govtypes.OptionNoWithVeto,
+ Option: v1.OptionNoWithVeto,
},
},
},
@@ -655,11 +656,11 @@ func TestEncodeGovMsg(t *testing.T) {
},
},
output: []sdk.Msg{
- &govtypes.MsgVoteWeighted{
+ &v1.MsgVoteWeighted{
ProposalId: 1,
Voter: myAddr.String(),
- Options: []govtypes.WeightedVoteOption{
- {Option: govtypes.OptionYes, Weight: sdk.NewDec(1)},
+ Options: []*v1.WeightedVoteOption{
+ {Option: v1.OptionYes, Weight: sdk.NewDec(1).String()},
},
},
},
@@ -680,14 +681,14 @@ func TestEncodeGovMsg(t *testing.T) {
},
},
output: []sdk.Msg{
- &govtypes.MsgVoteWeighted{
+ &v1.MsgVoteWeighted{
ProposalId: 1,
Voter: myAddr.String(),
- Options: []govtypes.WeightedVoteOption{
- {Option: govtypes.OptionYes, Weight: sdk.NewDecWithPrec(23, 2)},
- {Option: govtypes.OptionNo, Weight: sdk.NewDecWithPrec(24, 2)},
- {Option: govtypes.OptionAbstain, Weight: sdk.NewDecWithPrec(26, 2)},
- {Option: govtypes.OptionNoWithVeto, Weight: sdk.NewDecWithPrec(27, 2)},
+ Options: []*v1.WeightedVoteOption{
+ {Option: v1.OptionYes, Weight: sdk.NewDecWithPrec(23, 2).String()},
+ {Option: v1.OptionNo, Weight: sdk.NewDecWithPrec(24, 2).String()},
+ {Option: v1.OptionAbstain, Weight: sdk.NewDecWithPrec(26, 2).String()},
+ {Option: v1.OptionNoWithVeto, Weight: sdk.NewDecWithPrec(27, 2).String()},
},
},
},
@@ -706,12 +707,12 @@ func TestEncodeGovMsg(t *testing.T) {
},
},
output: []sdk.Msg{
- &govtypes.MsgVoteWeighted{
+ &v1.MsgVoteWeighted{
ProposalId: 1,
Voter: myAddr.String(),
- Options: []govtypes.WeightedVoteOption{
- {Option: govtypes.OptionYes, Weight: sdk.NewDecWithPrec(5, 1)},
- {Option: govtypes.OptionYes, Weight: sdk.NewDecWithPrec(5, 1)},
+ Options: []*v1.WeightedVoteOption{
+ {Option: v1.OptionYes, Weight: sdk.NewDecWithPrec(5, 1).String()},
+ {Option: v1.OptionYes, Weight: sdk.NewDecWithPrec(5, 1).String()},
},
},
},
@@ -731,12 +732,12 @@ func TestEncodeGovMsg(t *testing.T) {
},
},
output: []sdk.Msg{
- &govtypes.MsgVoteWeighted{
+ &v1.MsgVoteWeighted{
ProposalId: 1,
Voter: myAddr.String(),
- Options: []govtypes.WeightedVoteOption{
- {Option: govtypes.OptionYes, Weight: sdk.NewDecWithPrec(51, 2)},
- {Option: govtypes.OptionNo, Weight: sdk.NewDecWithPrec(5, 1)},
+ Options: []*v1.WeightedVoteOption{
+ {Option: v1.OptionYes, Weight: sdk.NewDecWithPrec(51, 2).String()},
+ {Option: v1.OptionNo, Weight: sdk.NewDecWithPrec(5, 1).String()},
},
},
},
@@ -756,12 +757,12 @@ func TestEncodeGovMsg(t *testing.T) {
},
},
output: []sdk.Msg{
- &govtypes.MsgVoteWeighted{
+ &v1.MsgVoteWeighted{
ProposalId: 1,
Voter: myAddr.String(),
- Options: []govtypes.WeightedVoteOption{
- {Option: govtypes.OptionYes, Weight: sdk.NewDecWithPrec(49, 2)},
- {Option: govtypes.OptionNo, Weight: sdk.NewDecWithPrec(5, 1)},
+ Options: []*v1.WeightedVoteOption{
+ {Option: v1.OptionYes, Weight: sdk.NewDecWithPrec(49, 2).String()},
+ {Option: v1.OptionNo, Weight: sdk.NewDecWithPrec(5, 1).String()},
},
},
},
@@ -777,10 +778,10 @@ func TestEncodeGovMsg(t *testing.T) {
if tc.expError {
assert.Error(t, gotEncErr)
return
- } else {
- require.NoError(t, gotEncErr)
- assert.Equal(t, tc.output, res)
}
+ require.NoError(t, gotEncErr)
+ assert.Equal(t, tc.output, res)
+
// and valid sdk message
for _, v := range res {
gotErr := v.ValidateBasic()
diff --git a/x/wasm/keeper/handler_plugin_test.go b/x/wasm/keeper/handler_plugin_test.go
index ffa63b692d..fbfb13a521 100644
--- a/x/wasm/keeper/handler_plugin_test.go
+++ b/x/wasm/keeper/handler_plugin_test.go
@@ -4,6 +4,9 @@ import (
"encoding/json"
"testing"
+ errorsmod "cosmossdk.io/errors"
+ "github.com/cometbft/cometbft/libs/log"
+
wasmvm "github.com/CosmWasm/wasmvm"
wasmvmtypes "github.com/CosmWasm/wasmvm/types"
"github.com/cosmos/cosmos-sdk/baseapp"
@@ -11,9 +14,8 @@ import (
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
- clienttypes "github.com/cosmos/ibc-go/v4/modules/core/02-client/types"
- channeltypes "github.com/cosmos/ibc-go/v4/modules/core/04-channel/types"
- ibcexported "github.com/cosmos/ibc-go/v4/modules/core/exported"
+ clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types"
+ channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
@@ -40,7 +42,7 @@ func TestMessageHandlerChainDispatch(t *testing.T) {
myMsg := wasmvmtypes.CosmosMsg{Custom: []byte(`{}`)}
specs := map[string]struct {
handlers []Messenger
- expErr *sdkerrors.Error
+ expErr *errorsmod.Error
expEvents []sdk.Event
}{
"single handler": {
@@ -120,7 +122,7 @@ func TestSDKMessageHandlerDispatch(t *testing.T) {
specs := map[string]struct {
srcRoute MessageRouter
srcEncoder CustomEncoder
- expErr *sdkerrors.Error
+ expErr *errorsmod.Error
expMsgDispatched int
}{
"all good": {
@@ -223,14 +225,18 @@ func TestSDKMessageHandlerDispatch(t *testing.T) {
func TestIBCRawPacketHandler(t *testing.T) {
ibcPort := "contractsIBCPort"
- var ctx sdk.Context
+ ctx := sdk.Context{}.WithLogger(log.TestingLogger())
- var capturedPacket ibcexported.PacketI
+ type CapturedPacket struct {
+ sourcePort string
+ sourceChannel string
+ timeoutHeight clienttypes.Height
+ timeoutTimestamp uint64
+ data []byte
+ }
+ var capturedPacket *CapturedPacket
chanKeeper := &wasmtesting.MockChannelKeeper{
- GetNextSequenceSendFn: func(ctx sdk.Context, portID, channelID string) (uint64, bool) {
- return 1, true
- },
GetChannelFn: func(ctx sdk.Context, srcPort, srcChan string) (channeltypes.Channel, bool) {
return channeltypes.Channel{
Counterparty: channeltypes.NewCounterparty(
@@ -239,9 +245,15 @@ func TestIBCRawPacketHandler(t *testing.T) {
),
}, true
},
- SendPacketFn: func(ctx sdk.Context, channelCap *capabilitytypes.Capability, packet ibcexported.PacketI) error {
- capturedPacket = packet
- return nil
+ SendPacketFn: func(ctx sdk.Context, channelCap *capabilitytypes.Capability, sourcePort string, sourceChannel string, timeoutHeight clienttypes.Height, timeoutTimestamp uint64, data []byte) (uint64, error) {
+ capturedPacket = &CapturedPacket{
+ sourcePort: sourcePort,
+ sourceChannel: sourceChannel,
+ timeoutHeight: timeoutHeight,
+ timeoutTimestamp: timeoutTimestamp,
+ data: data,
+ }
+ return 1, nil
},
}
capKeeper := &wasmtesting.MockCapabilityKeeper{
@@ -254,8 +266,8 @@ func TestIBCRawPacketHandler(t *testing.T) {
srcMsg wasmvmtypes.SendPacketMsg
chanKeeper types.ChannelKeeper
capKeeper types.CapabilityKeeper
- expPacketSent channeltypes.Packet
- expErr *sdkerrors.Error
+ expPacketSent *CapturedPacket
+ expErr *errorsmod.Error
}{
"all good": {
srcMsg: wasmvmtypes.SendPacketMsg{
@@ -265,28 +277,12 @@ func TestIBCRawPacketHandler(t *testing.T) {
},
chanKeeper: chanKeeper,
capKeeper: capKeeper,
- expPacketSent: channeltypes.Packet{
- Sequence: 1,
- SourcePort: ibcPort,
- SourceChannel: "channel-1",
- DestinationPort: "other-port",
- DestinationChannel: "other-channel-1",
- Data: []byte("myData"),
- TimeoutHeight: clienttypes.Height{RevisionNumber: 1, RevisionHeight: 2},
- },
- },
- "sequence not found returns error": {
- srcMsg: wasmvmtypes.SendPacketMsg{
- ChannelID: "channel-1",
- Data: []byte("myData"),
- Timeout: wasmvmtypes.IBCTimeout{Block: &wasmvmtypes.IBCTimeoutBlock{Revision: 1, Height: 2}},
- },
- chanKeeper: &wasmtesting.MockChannelKeeper{
- GetNextSequenceSendFn: func(ctx sdk.Context, portID, channelID string) (uint64, bool) {
- return 0, false
- },
+ expPacketSent: &CapturedPacket{
+ sourcePort: ibcPort,
+ sourceChannel: "channel-1",
+ timeoutHeight: clienttypes.Height{RevisionNumber: 1, RevisionHeight: 2},
+ data: []byte("myData"),
},
- expErr: channeltypes.ErrSequenceSendNotFound,
},
"capability not found returns error": {
srcMsg: wasmvmtypes.SendPacketMsg{
@@ -409,7 +405,7 @@ func TestBurnCoinMessageHandlerIntegration(t *testing.T) {
// and total supply reduced by burned amount
after, err := keepers.BankKeeper.TotalSupply(sdk.WrapSDKContext(ctx), &banktypes.QueryTotalSupplyRequest{})
require.NoError(t, err)
- diff := before.Supply.Sub(after.Supply)
+ diff := before.Supply.Sub(after.Supply...)
assert.Equal(t, sdk.NewCoins(sdk.NewCoin("denom", sdk.NewInt(100))), diff)
})
}
diff --git a/x/wasm/keeper/ibc.go b/x/wasm/keeper/ibc.go
index 3857b5f272..30eb34875a 100644
--- a/x/wasm/keeper/ibc.go
+++ b/x/wasm/keeper/ibc.go
@@ -3,10 +3,10 @@ package keeper
import (
"strings"
+ errorsmod "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
- sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
- host "github.com/cosmos/ibc-go/v4/modules/core/24-host"
+ host "github.com/cosmos/ibc-go/v7/modules/core/24-host"
"github.com/CosmWasm/wasmd/x/wasm/types"
)
@@ -15,8 +15,8 @@ import (
// returns a string name of the port or error if we cannot bind it.
// this will fail if call twice.
func (k Keeper) bindIbcPort(ctx sdk.Context, portID string) error {
- cap := k.portKeeper.BindPort(ctx, portID)
- return k.ClaimCapability(ctx, cap, host.PortPath(portID))
+ portCap := k.portKeeper.BindPort(ctx, portID)
+ return k.ClaimCapability(ctx, portCap, host.PortPath(portID))
}
// ensureIbcPort is like registerIbcPort, but it checks if we already hold the port
@@ -39,7 +39,7 @@ func PortIDForContract(addr sdk.AccAddress) string {
func ContractFromPortID(portID string) (sdk.AccAddress, error) {
if !strings.HasPrefix(portID, portIDPrefix) {
- return nil, sdkerrors.Wrapf(types.ErrInvalid, "without prefix")
+ return nil, errorsmod.Wrapf(types.ErrInvalid, "without prefix")
}
return sdk.AccAddressFromBech32(portID[len(portIDPrefix):])
}
diff --git a/x/wasm/keeper/keeper.go b/x/wasm/keeper/keeper.go
index 16a248e568..ff0eb7625f 100644
--- a/x/wasm/keeper/keeper.go
+++ b/x/wasm/keeper/keeper.go
@@ -12,8 +12,12 @@ import (
"strings"
"time"
+ errorsmod "cosmossdk.io/errors"
+ storetypes "github.com/cosmos/cosmos-sdk/store/types"
+
wasmvm "github.com/CosmWasm/wasmvm"
wasmvmtypes "github.com/CosmWasm/wasmvm/types"
+ "github.com/cometbft/cometbft/libs/log"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/store/prefix"
"github.com/cosmos/cosmos-sdk/telemetry"
@@ -21,8 +25,6 @@ import (
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
vestingexported "github.com/cosmos/cosmos-sdk/x/auth/vesting/exported"
- paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
- "github.com/tendermint/tendermint/libs/log"
"github.com/CosmWasm/wasmd/x/wasm/ioutils"
"github.com/CosmWasm/wasmd/x/wasm/types"
@@ -84,7 +86,7 @@ var defaultAcceptedAccountTypes = map[reflect.Type]struct{}{
// Keeper will have a reference to Wasmer with it's own data directory.
type Keeper struct {
- storeKey sdk.StoreKey
+ storeKey storetypes.StoreKey
cdc codec.Codec
accountKeeper types.AccountKeeper
bank CoinTransferrer
@@ -96,39 +98,60 @@ type Keeper struct {
messenger Messenger
// queryGasLimit is the max wasmvm gas that can be spent on executing a query with a contract
queryGasLimit uint64
- paramSpace paramtypes.Subspace
gasRegister GasRegister
maxQueryStackSize uint32
acceptedAccountTypes map[reflect.Type]struct{}
accountPruner AccountPruner
+ // the address capable of executing a MsgUpdateParams message. Typically, this
+ // should be the x/gov module account.
+ authority string
}
func (k Keeper) getUploadAccessConfig(ctx sdk.Context) types.AccessConfig {
- var a types.AccessConfig
- k.paramSpace.Get(ctx, types.ParamStoreKeyUploadAccess, &a)
- return a
+ return k.GetParams(ctx).CodeUploadAccess
}
func (k Keeper) getInstantiateAccessConfig(ctx sdk.Context) types.AccessType {
- var a types.AccessType
- k.paramSpace.Get(ctx, types.ParamStoreKeyInstantiateAccess, &a)
- return a
+ return k.GetParams(ctx).InstantiateDefaultPermission
}
// GetParams returns the total set of wasm parameters.
func (k Keeper) GetParams(ctx sdk.Context) types.Params {
var params types.Params
- k.paramSpace.GetParamSet(ctx, ¶ms)
+ store := ctx.KVStore(k.storeKey)
+ bz := store.Get(types.ParamsKey)
+ if bz == nil {
+ return params
+ }
+
+ k.cdc.MustUnmarshal(bz, ¶ms)
return params
}
-func (k Keeper) SetParams(ctx sdk.Context, ps types.Params) {
- k.paramSpace.SetParamSet(ctx, &ps)
+// SetParams sets all wasm parameters.
+func (k Keeper) SetParams(ctx sdk.Context, ps types.Params) error {
+ if err := ps.ValidateBasic(); err != nil {
+ return err
+ }
+
+ store := ctx.KVStore(k.storeKey)
+ bz, err := k.cdc.Marshal(&ps)
+ if err != nil {
+ return err
+ }
+ store.Set(types.ParamsKey, bz)
+
+ return nil
+}
+
+// GetAuthority returns the x/wasm module's authority.
+func (k Keeper) GetAuthority() string {
+ return k.authority
}
func (k Keeper) create(ctx sdk.Context, creator sdk.AccAddress, wasmCode []byte, instantiateAccess *types.AccessConfig, authZ AuthorizationPolicy) (codeID uint64, checksum []byte, err error) {
if creator == nil {
- return 0, checksum, sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "cannot be nil")
+ return 0, checksum, errorsmod.Wrap(sdkerrors.ErrInvalidAddress, "cannot be nil")
}
// figure out proper instantiate access
@@ -142,25 +165,25 @@ func (k Keeper) create(ctx sdk.Context, creator sdk.AccAddress, wasmCode []byte,
}
if !authZ.CanCreateCode(chainConfigs, creator, *instantiateAccess) {
- return 0, checksum, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "can not create code")
+ return 0, checksum, errorsmod.Wrap(sdkerrors.ErrUnauthorized, "can not create code")
}
if ioutils.IsGzip(wasmCode) {
ctx.GasMeter().ConsumeGas(k.gasRegister.UncompressCosts(len(wasmCode)), "Uncompress gzip bytecode")
wasmCode, err = ioutils.Uncompress(wasmCode, uint64(types.MaxWasmSize))
if err != nil {
- return 0, checksum, sdkerrors.Wrap(types.ErrCreateFailed, err.Error())
+ return 0, checksum, errorsmod.Wrap(types.ErrCreateFailed, err.Error())
}
}
ctx.GasMeter().ConsumeGas(k.gasRegister.CompileCosts(len(wasmCode)), "Compiling wasm bytecode")
checksum, err = k.wasmVM.Create(wasmCode)
if err != nil {
- return 0, checksum, sdkerrors.Wrap(types.ErrCreateFailed, err.Error())
+ return 0, checksum, errorsmod.Wrap(types.ErrCreateFailed, err.Error())
}
report, err := k.wasmVM.AnalyzeCode(checksum)
if err != nil {
- return 0, checksum, sdkerrors.Wrap(types.ErrCreateFailed, err.Error())
+ return 0, checksum, errorsmod.Wrap(types.ErrCreateFailed, err.Error())
}
codeID = k.autoIncrementID(ctx, types.KeyLastCodeID)
k.Logger(ctx).Debug("storing new contract", "capabilities", report.RequiredCapabilities, "code_id", codeID)
@@ -191,21 +214,21 @@ func (k Keeper) importCode(ctx sdk.Context, codeID uint64, codeInfo types.CodeIn
var err error
wasmCode, err = ioutils.Uncompress(wasmCode, uint64(types.MaxWasmSize))
if err != nil {
- return sdkerrors.Wrap(types.ErrCreateFailed, err.Error())
+ return errorsmod.Wrap(types.ErrCreateFailed, err.Error())
}
}
newCodeHash, err := k.wasmVM.Create(wasmCode)
if err != nil {
- return sdkerrors.Wrap(types.ErrCreateFailed, err.Error())
+ return errorsmod.Wrap(types.ErrCreateFailed, err.Error())
}
if !bytes.Equal(codeInfo.CodeHash, newCodeHash) {
- return sdkerrors.Wrap(types.ErrInvalid, "code hashes not same")
+ return errorsmod.Wrap(types.ErrInvalid, "code hashes not same")
}
store := ctx.KVStore(k.storeKey)
key := types.GetCodeKey(codeID)
if store.Has(key) {
- return sdkerrors.Wrapf(types.ErrDuplicate, "duplicate code: %d", codeID)
+ return errorsmod.Wrapf(types.ErrDuplicate, "duplicate code: %d", codeID)
}
// 0x01 | codeID (uint64) -> ContractInfo
store.Set(key, k.cdc.MustMarshal(&codeInfo))
@@ -232,10 +255,10 @@ func (k Keeper) instantiate(
codeInfo := k.GetCodeInfo(ctx, codeID)
if codeInfo == nil {
- return nil, nil, sdkerrors.Wrap(types.ErrNotFound, "code")
+ return nil, nil, errorsmod.Wrap(types.ErrNotFound, "code")
}
if !authPolicy.CanInstantiateContract(codeInfo.InstantiateConfig, creator) {
- return nil, nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "can not instantiate")
+ return nil, nil, errorsmod.Wrap(sdkerrors.ErrUnauthorized, "can not instantiate")
}
contractAddress := addressGenerator(ctx, codeID, codeInfo.CodeHash)
@@ -265,7 +288,7 @@ func (k Keeper) instantiate(
// also handle balance to not open cases where these accounts are abused and become liquid
switch handled, err := k.accountPruner.CleanupExistingAccount(ctx, existingAcct); {
case err != nil:
- return nil, nil, sdkerrors.Wrap(err, "prune balance")
+ return nil, nil, errorsmod.Wrap(err, "prune balance")
case !handled:
return nil, nil, types.ErrAccountExists.Wrap("address is claimed by external account")
}
@@ -299,7 +322,7 @@ func (k Keeper) instantiate(
res, gasUsed, err := k.wasmVM.Instantiate(codeInfo.CodeHash, env, info, initMsg, vmStore, cosmwasmAPI, querier, k.gasMeter(ctx), gas, costJSONDeserialization)
k.consumeRuntimeGas(ctx, gasUsed)
if err != nil {
- return nil, nil, sdkerrors.Wrap(types.ErrInstantiateFailed, err.Error())
+ return nil, nil, errorsmod.Wrap(types.ErrInstantiateFailed, err.Error())
}
// persist instance first
@@ -309,7 +332,7 @@ func (k Keeper) instantiate(
// check for IBC flag
report, err := k.wasmVM.AnalyzeCode(codeInfo.CodeHash)
if err != nil {
- return nil, nil, sdkerrors.Wrap(types.ErrInstantiateFailed, err.Error())
+ return nil, nil, errorsmod.Wrap(types.ErrInstantiateFailed, err.Error())
}
if report.HasIBCEntryPoints {
// register IBC port
@@ -335,7 +358,7 @@ func (k Keeper) instantiate(
data, err := k.handleContractResponse(ctx, contractAddress, contractInfo.IBCPortID, res.Messages, res.Attributes, res.Data, res.Events)
if err != nil {
- return nil, nil, sdkerrors.Wrap(err, "dispatch")
+ return nil, nil, errorsmod.Wrap(err, "dispatch")
}
return contractAddress, data, nil
@@ -368,7 +391,7 @@ func (k Keeper) execute(ctx sdk.Context, contractAddress sdk.AccAddress, caller
res, gasUsed, execErr := k.wasmVM.Execute(codeInfo.CodeHash, env, info, msg, prefixStore, cosmwasmAPI, querier, k.gasMeter(ctx), gas, costJSONDeserialization)
k.consumeRuntimeGas(ctx, gasUsed)
if execErr != nil {
- return nil, sdkerrors.Wrap(types.ErrExecuteFailed, execErr.Error())
+ return nil, errorsmod.Wrap(types.ErrExecuteFailed, execErr.Error())
}
ctx.EventManager().EmitEvent(sdk.NewEvent(
@@ -378,7 +401,7 @@ func (k Keeper) execute(ctx sdk.Context, contractAddress sdk.AccAddress, caller
data, err := k.handleContractResponse(ctx, contractAddress, contractInfo.IBCPortID, res.Messages, res.Attributes, res.Data, res.Events)
if err != nil {
- return nil, sdkerrors.Wrap(err, "dispatch")
+ return nil, errorsmod.Wrap(err, "dispatch")
}
return data, nil
@@ -391,28 +414,28 @@ func (k Keeper) migrate(ctx sdk.Context, contractAddress sdk.AccAddress, caller
contractInfo := k.GetContractInfo(ctx, contractAddress)
if contractInfo == nil {
- return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "unknown contract")
+ return nil, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "unknown contract")
}
if !authZ.CanModifyContract(contractInfo.AdminAddr(), caller) {
- return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "can not migrate")
+ return nil, errorsmod.Wrap(sdkerrors.ErrUnauthorized, "can not migrate")
}
newCodeInfo := k.GetCodeInfo(ctx, newCodeID)
if newCodeInfo == nil {
- return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "unknown code")
+ return nil, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "unknown code")
}
if !authZ.CanInstantiateContract(newCodeInfo.InstantiateConfig, caller) {
- return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "to use new code")
+ return nil, errorsmod.Wrap(sdkerrors.ErrUnauthorized, "to use new code")
}
// check for IBC flag
switch report, err := k.wasmVM.AnalyzeCode(newCodeInfo.CodeHash); {
case err != nil:
- return nil, sdkerrors.Wrap(types.ErrMigrationFailed, err.Error())
+ return nil, errorsmod.Wrap(types.ErrMigrationFailed, err.Error())
case !report.HasIBCEntryPoints && contractInfo.IBCPortID != "":
// prevent update to non ibc contract
- return nil, sdkerrors.Wrap(types.ErrMigrationFailed, "requires ibc callbacks")
+ return nil, errorsmod.Wrap(types.ErrMigrationFailed, "requires ibc callbacks")
case report.HasIBCEntryPoints && contractInfo.IBCPortID == "":
// add ibc port
ibcPort, err := k.ensureIbcPort(ctx, contractAddress)
@@ -433,7 +456,7 @@ func (k Keeper) migrate(ctx sdk.Context, contractAddress sdk.AccAddress, caller
res, gasUsed, err := k.wasmVM.Migrate(newCodeInfo.CodeHash, env, msg, vmStore, cosmwasmAPI, &querier, k.gasMeter(ctx), gas, costJSONDeserialization)
k.consumeRuntimeGas(ctx, gasUsed)
if err != nil {
- return nil, sdkerrors.Wrap(types.ErrMigrationFailed, err.Error())
+ return nil, errorsmod.Wrap(types.ErrMigrationFailed, err.Error())
}
// delete old secondary index entry
k.removeFromContractCodeSecondaryIndex(ctx, contractAddress, k.getLastContractHistoryEntry(ctx, contractAddress))
@@ -451,7 +474,7 @@ func (k Keeper) migrate(ctx sdk.Context, contractAddress sdk.AccAddress, caller
data, err := k.handleContractResponse(ctx, contractAddress, contractInfo.IBCPortID, res.Messages, res.Attributes, res.Data, res.Events)
if err != nil {
- return nil, sdkerrors.Wrap(err, "dispatch")
+ return nil, errorsmod.Wrap(err, "dispatch")
}
return data, nil
@@ -478,7 +501,7 @@ func (k Keeper) Sudo(ctx sdk.Context, contractAddress sdk.AccAddress, msg []byte
res, gasUsed, execErr := k.wasmVM.Sudo(codeInfo.CodeHash, env, msg, prefixStore, cosmwasmAPI, querier, k.gasMeter(ctx), gas, costJSONDeserialization)
k.consumeRuntimeGas(ctx, gasUsed)
if execErr != nil {
- return nil, sdkerrors.Wrap(types.ErrExecuteFailed, execErr.Error())
+ return nil, errorsmod.Wrap(types.ErrExecuteFailed, execErr.Error())
}
ctx.EventManager().EmitEvent(sdk.NewEvent(
@@ -488,7 +511,7 @@ func (k Keeper) Sudo(ctx sdk.Context, contractAddress sdk.AccAddress, msg []byte
data, err := k.handleContractResponse(ctx, contractAddress, contractInfo.IBCPortID, res.Messages, res.Attributes, res.Data, res.Events)
if err != nil {
- return nil, sdkerrors.Wrap(err, "dispatch")
+ return nil, errorsmod.Wrap(err, "dispatch")
}
return data, nil
@@ -514,7 +537,7 @@ func (k Keeper) reply(ctx sdk.Context, contractAddress sdk.AccAddress, reply was
res, gasUsed, execErr := k.wasmVM.Reply(codeInfo.CodeHash, env, reply, prefixStore, cosmwasmAPI, querier, k.gasMeter(ctx), gas, costJSONDeserialization)
k.consumeRuntimeGas(ctx, gasUsed)
if execErr != nil {
- return nil, sdkerrors.Wrap(types.ErrExecuteFailed, execErr.Error())
+ return nil, errorsmod.Wrap(types.ErrExecuteFailed, execErr.Error())
}
ctx.EventManager().EmitEvent(sdk.NewEvent(
@@ -524,7 +547,7 @@ func (k Keeper) reply(ctx sdk.Context, contractAddress sdk.AccAddress, reply was
data, err := k.handleContractResponse(ctx, contractAddress, contractInfo.IBCPortID, res.Messages, res.Attributes, res.Data, res.Events)
if err != nil {
- return nil, sdkerrors.Wrap(err, "dispatch")
+ return nil, errorsmod.Wrap(err, "dispatch")
}
return data, nil
@@ -575,10 +598,10 @@ func (k Keeper) IterateContractsByCode(ctx sdk.Context, codeID uint64, cb func(a
func (k Keeper) setContractAdmin(ctx sdk.Context, contractAddress, caller, newAdmin sdk.AccAddress, authZ AuthorizationPolicy) error {
contractInfo := k.GetContractInfo(ctx, contractAddress)
if contractInfo == nil {
- return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "unknown contract")
+ return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "unknown contract")
}
if !authZ.CanModifyContract(contractInfo.AdminAddr(), caller) {
- return sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "can not modify contract")
+ return errorsmod.Wrap(sdkerrors.ErrUnauthorized, "can not modify contract")
}
newAdminStr := newAdmin.String()
contractInfo.Admin = newAdminStr
@@ -665,7 +688,7 @@ func (k Keeper) QuerySmart(ctx sdk.Context, contractAddr sdk.AccAddress, req []b
queryResult, gasUsed, qErr := k.wasmVM.Query(codeInfo.CodeHash, env, req, prefixStore, cosmwasmAPI, querier, k.gasMeter(ctx), k.runtimeGasForContract(ctx), costJSONDeserialization)
k.consumeRuntimeGas(ctx, gasUsed)
if qErr != nil {
- return nil, sdkerrors.Wrap(types.ErrQueryFailed, qErr.Error())
+ return nil, errorsmod.Wrap(types.ErrQueryFailed, qErr.Error())
}
return queryResult, nil
}
@@ -711,14 +734,14 @@ func (k Keeper) contractInstance(ctx sdk.Context, contractAddress sdk.AccAddress
contractBz := store.Get(types.GetContractAddressKey(contractAddress))
if contractBz == nil {
- return types.ContractInfo{}, types.CodeInfo{}, nil, sdkerrors.Wrap(types.ErrNotFound, "contract")
+ return types.ContractInfo{}, types.CodeInfo{}, nil, errorsmod.Wrap(types.ErrNotFound, "contract")
}
var contractInfo types.ContractInfo
k.cdc.MustUnmarshal(contractBz, &contractInfo)
codeInfoBz := store.Get(types.GetCodeKey(contractInfo.CodeID))
if codeInfoBz == nil {
- return contractInfo, types.CodeInfo{}, nil, sdkerrors.Wrap(types.ErrNotFound, "code info")
+ return contractInfo, types.CodeInfo{}, nil, errorsmod.Wrap(types.ErrNotFound, "code info")
}
var codeInfo types.CodeInfo
k.cdc.MustUnmarshal(codeInfoBz, &codeInfo)
@@ -787,7 +810,7 @@ func (k Keeper) importContractState(ctx sdk.Context, contractAddress sdk.AccAddr
model.Value = []byte{}
}
if prefixStore.Has(model.Key) {
- return sdkerrors.Wrapf(types.ErrDuplicate, "duplicate key: %x", model.Key)
+ return errorsmod.Wrapf(types.ErrDuplicate, "duplicate key: %x", model.Key)
}
prefixStore.Set(model.Key, model.Value)
}
@@ -840,11 +863,11 @@ func (k Keeper) GetByteCode(ctx sdk.Context, codeID uint64) ([]byte, error) {
func (k Keeper) pinCode(ctx sdk.Context, codeID uint64) error {
codeInfo := k.GetCodeInfo(ctx, codeID)
if codeInfo == nil {
- return sdkerrors.Wrap(types.ErrNotFound, "code info")
+ return errorsmod.Wrap(types.ErrNotFound, "code info")
}
if err := k.wasmVM.Pin(codeInfo.CodeHash); err != nil {
- return sdkerrors.Wrap(types.ErrPinContractFailed, err.Error())
+ return errorsmod.Wrap(types.ErrPinContractFailed, err.Error())
}
store := ctx.KVStore(k.storeKey)
// store 1 byte to not run into `nil` debugging issues
@@ -861,10 +884,10 @@ func (k Keeper) pinCode(ctx sdk.Context, codeID uint64) error {
func (k Keeper) unpinCode(ctx sdk.Context, codeID uint64) error {
codeInfo := k.GetCodeInfo(ctx, codeID)
if codeInfo == nil {
- return sdkerrors.Wrap(types.ErrNotFound, "code info")
+ return errorsmod.Wrap(types.ErrNotFound, "code info")
}
if err := k.wasmVM.Unpin(codeInfo.CodeHash); err != nil {
- return sdkerrors.Wrap(types.ErrUnpinContractFailed, err.Error())
+ return errorsmod.Wrap(types.ErrUnpinContractFailed, err.Error())
}
store := ctx.KVStore(k.storeKey)
@@ -892,10 +915,10 @@ func (k Keeper) InitializePinnedCodes(ctx sdk.Context) error {
for ; iter.Valid(); iter.Next() {
codeInfo := k.GetCodeInfo(ctx, types.ParsePinnedCodeIndex(iter.Key()))
if codeInfo == nil {
- return sdkerrors.Wrap(types.ErrNotFound, "code info")
+ return errorsmod.Wrap(types.ErrNotFound, "code info")
}
if err := k.wasmVM.Pin(codeInfo.CodeHash); err != nil {
- return sdkerrors.Wrap(types.ErrPinContractFailed, err.Error())
+ return errorsmod.Wrap(types.ErrPinContractFailed, err.Error())
}
}
return nil
@@ -905,7 +928,7 @@ func (k Keeper) InitializePinnedCodes(ctx sdk.Context) error {
func (k Keeper) setContractInfoExtension(ctx sdk.Context, contractAddr sdk.AccAddress, ext types.ContractInfoExtension) error {
info := k.GetContractInfo(ctx, contractAddr)
if info == nil {
- return sdkerrors.Wrap(types.ErrNotFound, "contract info")
+ return errorsmod.Wrap(types.ErrNotFound, "contract info")
}
if err := info.SetExtension(ext); err != nil {
return err
@@ -918,11 +941,11 @@ func (k Keeper) setContractInfoExtension(ctx sdk.Context, contractAddr sdk.AccAd
func (k Keeper) setAccessConfig(ctx sdk.Context, codeID uint64, caller sdk.AccAddress, newConfig types.AccessConfig, authz AuthorizationPolicy) error {
info := k.GetCodeInfo(ctx, codeID)
if info == nil {
- return sdkerrors.Wrap(types.ErrNotFound, "code info")
+ return errorsmod.Wrap(types.ErrNotFound, "code info")
}
isSubset := newConfig.Permission.IsSubset(k.getInstantiateAccessConfig(ctx))
if !authz.CanModifyCodeAccessConfig(sdk.MustAccAddressFromBech32(info.Creator), caller, isSubset) {
- return sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "can not modify code access config")
+ return errorsmod.Wrap(sdkerrors.ErrUnauthorized, "can not modify code access config")
}
info.InstantiateConfig = newConfig
@@ -975,7 +998,7 @@ func (k Keeper) runtimeGasForContract(ctx sdk.Context) uint64 {
if meter.IsOutOfGas() {
return 0
}
- if meter.Limit() == 0 { // infinite gas meter with limit=0 and not out of gas
+ if meter.Limit() == math.MaxUint64 { // infinite gas meter and not out of gas
return math.MaxUint64
}
return k.gasRegister.ToWasmVMGas(meter.Limit() - meter.GasConsumedToLimit())
@@ -1016,7 +1039,7 @@ func (k Keeper) PeekAutoIncrementID(ctx sdk.Context, lastIDKey []byte) uint64 {
func (k Keeper) importAutoIncrementID(ctx sdk.Context, lastIDKey []byte, val uint64) error {
store := ctx.KVStore(k.storeKey)
if store.Has(lastIDKey) {
- return sdkerrors.Wrapf(types.ErrDuplicate, "autoincrement id: %s", string(lastIDKey))
+ return errorsmod.Wrapf(types.ErrDuplicate, "autoincrement id: %s", string(lastIDKey))
}
bz := sdk.Uint64ToBigEndian(val)
store.Set(lastIDKey, bz)
@@ -1025,10 +1048,10 @@ func (k Keeper) importAutoIncrementID(ctx sdk.Context, lastIDKey []byte, val uin
func (k Keeper) importContract(ctx sdk.Context, contractAddr sdk.AccAddress, c *types.ContractInfo, state []types.Model, entries []types.ContractCodeHistoryEntry) error {
if !k.containsCodeInfo(ctx, c.CodeID) {
- return sdkerrors.Wrapf(types.ErrNotFound, "code id: %d", c.CodeID)
+ return errorsmod.Wrapf(types.ErrNotFound, "code id: %d", c.CodeID)
}
if k.HasContractInfo(ctx, contractAddr) {
- return sdkerrors.Wrapf(types.ErrDuplicate, "contract: %s", contractAddr)
+ return errorsmod.Wrapf(types.ErrDuplicate, "contract: %s", contractAddr)
}
creatorAddress, err := sdk.AccAddressFromBech32(c.Creator)
@@ -1077,7 +1100,7 @@ func moduleLogger(ctx sdk.Context) log.Logger {
}
// Querier creates a new grpc querier instance
-func Querier(k *Keeper) *grpcQuerier { //nolint:revive
+func Querier(k *Keeper) *GrpcQuerier {
return NewGrpcQuerier(k.cdc, k.storeKey, k, k.queryGasLimit)
}
@@ -1107,7 +1130,7 @@ func (c BankCoinTransferrer) TransferCoins(parentCtx sdk.Context, fromAddr sdk.A
return err
}
if c.keeper.BlockedAddr(toAddr) {
- return sdkerrors.Wrapf(sdkerrors.ErrUnauthorized, "%s is not allowed to receive funds", toAddr.String())
+ return errorsmod.Wrapf(sdkerrors.ErrUnauthorized, "%s is not allowed to receive funds", toAddr.String())
}
sdkerr := c.keeper.SendCoins(ctx, fromAddr, toAddr, amount)
@@ -1152,10 +1175,10 @@ func (b VestingCoinBurner) CleanupExistingAccount(ctx sdk.Context, existingAcc a
coinsToBurn = append(coinsToBurn, b.bank.GetBalance(ctx, existingAcc.GetAddress(), orig.Denom))
}
if err := b.bank.SendCoinsFromAccountToModule(ctx, existingAcc.GetAddress(), types.ModuleName, coinsToBurn); err != nil {
- return false, sdkerrors.Wrap(err, "prune account balance")
+ return false, errorsmod.Wrap(err, "prune account balance")
}
if err := b.bank.BurnCoins(ctx, types.ModuleName, coinsToBurn); err != nil {
- return false, sdkerrors.Wrap(err, "burn account balance")
+ return false, errorsmod.Wrap(err, "burn account balance")
}
return true, nil
}
@@ -1180,7 +1203,7 @@ func (h DefaultWasmVMContractResponseHandler) Handle(ctx sdk.Context, contractAd
result := origRspData
switch rsp, err := h.md.DispatchSubmessages(ctx, contractAddr, ibcPort, messages); {
case err != nil:
- return nil, sdkerrors.Wrap(err, "submessages")
+ return nil, errorsmod.Wrap(err, "submessages")
case rsp != nil:
result = rsp
}
diff --git a/x/wasm/keeper/keeper_cgo.go b/x/wasm/keeper/keeper_cgo.go
index 06a0ccabe6..dd402bc11c 100644
--- a/x/wasm/keeper/keeper_cgo.go
+++ b/x/wasm/keeper/keeper_cgo.go
@@ -5,10 +5,10 @@ package keeper
import (
"path/filepath"
+ storetypes "github.com/cosmos/cosmos-sdk/store/types"
+
wasmvm "github.com/CosmWasm/wasmvm"
"github.com/cosmos/cosmos-sdk/codec"
- sdk "github.com/cosmos/cosmos-sdk/types"
- paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
"github.com/CosmWasm/wasmd/x/wasm/types"
)
@@ -17,31 +17,27 @@ import (
// If customEncoders is non-nil, we can use this to override some of the message handler, especially custom
func NewKeeper(
cdc codec.Codec,
- storeKey sdk.StoreKey,
- paramSpace paramtypes.Subspace,
+ storeKey storetypes.StoreKey,
accountKeeper types.AccountKeeper,
bankKeeper types.BankKeeper,
stakingKeeper types.StakingKeeper,
- distKeeper types.DistributionKeeper,
+ distrKeeper types.DistributionKeeper,
channelKeeper types.ChannelKeeper,
portKeeper types.PortKeeper,
capabilityKeeper types.CapabilityKeeper,
portSource types.ICS20TransferPortSource,
router MessageRouter,
- queryRouter GRPCQueryRouter,
+ _ GRPCQueryRouter,
homeDir string,
wasmConfig types.WasmConfig,
availableCapabilities string,
+ authority string,
opts ...Option,
) Keeper {
wasmer, err := wasmvm.NewVM(filepath.Join(homeDir, "wasm"), availableCapabilities, contractMemoryLimit, wasmConfig.ContractDebugMode, wasmConfig.MemoryCacheSize)
if err != nil {
panic(err)
}
- // set KeyTable if it has not already been set
- if !paramSpace.HasKeyTable() {
- paramSpace = paramSpace.WithKeyTable(types.ParamKeyTable())
- }
keeper := &Keeper{
storeKey: storeKey,
@@ -54,12 +50,12 @@ func NewKeeper(
capabilityKeeper: capabilityKeeper,
messenger: NewDefaultMessageHandler(router, channelKeeper, capabilityKeeper, bankKeeper, cdc, portSource),
queryGasLimit: wasmConfig.SmartQueryGasLimit,
- paramSpace: paramSpace,
gasRegister: NewDefaultWasmGasRegister(),
maxQueryStackSize: types.DefaultMaxQueryStackSize,
acceptedAccountTypes: defaultAcceptedAccountTypes,
+ authority: authority,
}
- keeper.wasmVMQueryHandler = DefaultQueryPlugins(bankKeeper, stakingKeeper, distKeeper, channelKeeper, keeper)
+ keeper.wasmVMQueryHandler = DefaultQueryPlugins(bankKeeper, stakingKeeper, distrKeeper, channelKeeper, keeper)
for _, o := range opts {
o.apply(keeper)
}
diff --git a/x/wasm/keeper/keeper_no_cgo.go b/x/wasm/keeper/keeper_no_cgo.go
index 196b9ee1ee..30d06c014d 100644
--- a/x/wasm/keeper/keeper_no_cgo.go
+++ b/x/wasm/keeper/keeper_no_cgo.go
@@ -4,8 +4,7 @@ package keeper
import (
"github.com/cosmos/cosmos-sdk/codec"
- sdk "github.com/cosmos/cosmos-sdk/types"
- paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
+ storetypes "github.com/cosmos/cosmos-sdk/store/types"
"github.com/CosmWasm/wasmd/x/wasm/types"
)
@@ -14,21 +13,21 @@ import (
// If customEncoders is non-nil, we can use this to override some of the message handler, especially custom
func NewKeeper(
cdc codec.Codec,
- storeKey sdk.StoreKey,
- paramSpace paramtypes.Subspace,
+ storeKey storetypes.StoreKey,
accountKeeper types.AccountKeeper,
bankKeeper types.BankKeeper,
stakingKeeper types.StakingKeeper,
- distKeeper types.DistributionKeeper,
+ distrKeeper types.DistributionKeeper,
channelKeeper types.ChannelKeeper,
portKeeper types.PortKeeper,
capabilityKeeper types.CapabilityKeeper,
portSource types.ICS20TransferPortSource,
router MessageRouter,
- queryRouter GRPCQueryRouter,
+ _ GRPCQueryRouter,
homeDir string,
wasmConfig types.WasmConfig,
availableCapabilities string,
+ authority string,
opts ...Option,
) Keeper {
panic("not implemented, please build with cgo enabled")
diff --git a/x/wasm/keeper/keeper_test.go b/x/wasm/keeper/keeper_test.go
index bee350b3c1..91413b2e2a 100644
--- a/x/wasm/keeper/keeper_test.go
+++ b/x/wasm/keeper/keeper_test.go
@@ -11,10 +11,13 @@ import (
"testing"
"time"
- abci "github.com/tendermint/tendermint/abci/types"
+ errorsmod "cosmossdk.io/errors"
+ abci "github.com/cometbft/cometbft/abci/types"
wasmvm "github.com/CosmWasm/wasmvm"
wasmvmtypes "github.com/CosmWasm/wasmvm/types"
+ "github.com/cometbft/cometbft/libs/rand"
+ tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/crypto/keys/ed25519"
stypes "github.com/cosmos/cosmos-sdk/store/types"
@@ -29,8 +32,6 @@ import (
fuzz "github.com/google/gofuzz"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
- "github.com/tendermint/tendermint/libs/rand"
- tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
"github.com/CosmWasm/wasmd/x/wasm/keeper/wasmtesting"
"github.com/CosmWasm/wasmd/x/wasm/types"
@@ -123,10 +124,11 @@ func TestCreateStoresInstantiatePermission(t *testing.T) {
t.Run(msg, func(t *testing.T) {
ctx, keepers := CreateTestInput(t, false, AvailableCapabilities)
accKeeper, keeper, bankKeeper := keepers.AccountKeeper, keepers.ContractKeeper, keepers.BankKeeper
- keepers.WasmKeeper.SetParams(ctx, types.Params{
+ err := keepers.WasmKeeper.SetParams(ctx, types.Params{
CodeUploadAccess: types.AllowEverybody,
InstantiateDefaultPermission: spec.srcPermission,
})
+ require.NoError(t, err)
fundAccounts(t, ctx, accKeeper, bankKeeper, myAddr, deposit)
codeID, _, err := keeper.Create(ctx, myAddr, hackatomWasm, nil)
@@ -148,7 +150,7 @@ func TestCreateWithParamPermissions(t *testing.T) {
specs := map[string]struct {
policy AuthorizationPolicy
chainUpload types.AccessConfig
- expError *sdkerrors.Error
+ expError *errorsmod.Error
}{
"default": {
policy: DefaultAuthorizationPolicy{},
@@ -181,9 +183,10 @@ func TestCreateWithParamPermissions(t *testing.T) {
t.Run(msg, func(t *testing.T) {
params := types.DefaultParams()
params.CodeUploadAccess = spec.chainUpload
- keepers.WasmKeeper.SetParams(ctx, params)
+ err := keepers.WasmKeeper.SetParams(ctx, params)
+ require.NoError(t, err)
keeper := NewPermissionedKeeper(keepers.WasmKeeper, spec.policy)
- _, _, err := keeper.Create(ctx, creator, hackatomWasm, nil)
+ _, _, err = keeper.Create(ctx, creator, hackatomWasm, nil)
require.True(t, spec.expError.Is(err), err)
if spec.expError != nil {
return
@@ -212,7 +215,7 @@ func TestEnforceValidPermissionsOnCreate(t *testing.T) {
// grantedPermission is set iff no error
grantedPermission types.AccessConfig
// expError is nil iff the request is allowed
- expError *sdkerrors.Error
+ expError *errorsmod.Error
}{
"override everybody": {
defaultPermssion: types.AccessTypeEverybody,
@@ -259,7 +262,8 @@ func TestEnforceValidPermissionsOnCreate(t *testing.T) {
t.Run(msg, func(t *testing.T) {
params := types.DefaultParams()
params.InstantiateDefaultPermission = spec.defaultPermssion
- keeper.SetParams(ctx, params)
+ err := keeper.SetParams(ctx, params)
+ require.NoError(t, err)
codeID, _, err := contractKeeper.Create(ctx, creator, hackatomWasm, spec.requestedPermission)
require.True(t, spec.expError.Is(err), err)
if spec.expError == nil {
@@ -412,7 +416,7 @@ func TestInstantiate(t *testing.T) {
gasAfter := ctx.GasMeter().GasConsumed()
if types.EnableGasVerification {
- require.Equal(t, uint64(0x1a7b6), gasAfter-gasBefore)
+ require.Equal(t, uint64(0x1b5bc), gasAfter-gasBefore)
}
// ensure it is stored properly
@@ -511,7 +515,7 @@ func TestInstantiateWithPermissions(t *testing.T) {
specs := map[string]struct {
srcPermission types.AccessConfig
srcActor sdk.AccAddress
- expError *sdkerrors.Error
+ expError *errorsmod.Error
}{
"default": {
srcPermission: types.DefaultUploadAccess,
@@ -559,7 +563,6 @@ func TestInstantiateWithAccounts(t *testing.T) {
senderAddr := DeterministicAccountAddress(t, 1)
keepers.Faucet.Fund(parentCtx, senderAddr, sdk.NewInt64Coin("denom", 100000000))
- const myLabel = "testing"
mySalt := []byte(`my salt`)
contractAddr := BuildContractAddressPredictable(example.Checksum, senderAddr, mySalt, []byte{})
@@ -670,7 +673,7 @@ func TestInstantiateWithAccounts(t *testing.T) {
}
}()
// when
- gotAddr, _, gotErr := keepers.ContractKeeper.Instantiate2(ctx, 1, senderAddr, nil, initMsg, myLabel, spec.deposit, mySalt, false)
+ gotAddr, _, gotErr := keepers.ContractKeeper.Instantiate2(ctx, 1, senderAddr, nil, initMsg, myTestLabel, spec.deposit, mySalt, false)
if spec.expErr != nil {
assert.ErrorIs(t, gotErr, spec.expErr)
return
@@ -748,7 +751,7 @@ func TestInstantiateWithContractFactoryChildQueriesParent(t *testing.T) {
// overwrite wasmvm in router
router := baseapp.NewMsgServiceRouter()
router.SetInterfaceRegistry(keepers.EncodingConfig.InterfaceRegistry)
- types.RegisterMsgServer(router, NewMsgServerImpl(NewDefaultPermissionKeeper(keeper)))
+ types.RegisterMsgServer(router, newMsgServerImpl(NewDefaultPermissionKeeper(keeper), *keeper))
keeper.messenger = NewDefaultMessageHandler(router, nil, nil, nil, keepers.EncodingConfig.Marshaler, nil)
// overwrite wasmvm in response handler
keeper.wasmVMResponseHandler = NewDefaultWasmVMContractResponseHandler(NewMessageDispatcher(keeper.messenger, keeper))
@@ -838,7 +841,7 @@ func TestExecute(t *testing.T) {
// unauthorized - trialCtx so we don't change state
trialCtx := ctx.WithMultiStore(ctx.MultiStore().CacheWrap().(sdk.MultiStore))
- res, err := keepers.ContractKeeper.Execute(trialCtx, addr, creator, []byte(`{"release":{}}`), nil)
+ _, err = keepers.ContractKeeper.Execute(trialCtx, addr, creator, []byte(`{"release":{}}`), nil)
require.Error(t, err)
require.True(t, errors.Is(err, types.ErrExecuteFailed))
require.Equal(t, "Unauthorized: execute wasm contract failed", err.Error())
@@ -848,15 +851,15 @@ func TestExecute(t *testing.T) {
gasBefore := ctx.GasMeter().GasConsumed()
em := sdk.NewEventManager()
// when
- res, err = keepers.ContractKeeper.Execute(ctx.WithEventManager(em), addr, fred, []byte(`{"release":{}}`), topUp)
- diff := time.Now().Sub(start)
+ res, err := keepers.ContractKeeper.Execute(ctx.WithEventManager(em), addr, fred, []byte(`{"release":{}}`), topUp)
+ diff := time.Since(start)
require.NoError(t, err)
require.NotNil(t, res)
// make sure gas is properly deducted from ctx
gasAfter := ctx.GasMeter().GasConsumed()
if types.EnableGasVerification {
- require.Equal(t, uint64(0x17d7f), gasAfter-gasBefore)
+ require.Equal(t, uint64(0x1a154), gasAfter-gasBefore)
}
// ensure bob now exists and got both payments released
bobAcct = accKeeper.GetAccount(ctx, bob)
@@ -938,7 +941,8 @@ func TestExecuteWithDeposit(t *testing.T) {
ctx, keepers := CreateTestInput(t, false, AvailableCapabilities)
accKeeper, bankKeeper, keeper := keepers.AccountKeeper, keepers.BankKeeper, keepers.ContractKeeper
if spec.newBankParams != nil {
- bankKeeper.SetParams(ctx, *spec.newBankParams)
+ err := bankKeeper.SetParams(ctx, *spec.newBankParams)
+ require.NoError(t, err)
}
if spec.fundAddr {
fundAccounts(t, ctx, accKeeper, bankKeeper, spec.srcActor, sdk.NewCoins(sdk.NewInt64Coin("denom", 200)))
@@ -995,7 +999,7 @@ func TestExecuteWithPanic(t *testing.T) {
contractID, _, err := keeper.Create(ctx, creator, hackatomWasm, nil)
require.NoError(t, err)
- _, _, bob := keyPubAddr()
+ _, bob := keyPubAddr()
initMsg := HackatomExampleInitMsg{
Verifier: fred,
Beneficiary: bob,
@@ -1027,7 +1031,7 @@ func TestExecuteWithCpuLoop(t *testing.T) {
contractID, _, err := keeper.Create(ctx, creator, hackatomWasm, nil)
require.NoError(t, err)
- _, _, bob := keyPubAddr()
+ _, bob := keyPubAddr()
initMsg := HackatomExampleInitMsg{
Verifier: fred,
Beneficiary: bob,
@@ -1052,12 +1056,13 @@ func TestExecuteWithCpuLoop(t *testing.T) {
}()
// this should throw out of gas exception (panic)
- _, err = keepers.ContractKeeper.Execute(ctx, addr, fred, []byte(`{"cpu_loop":{}}`), nil)
+ _, _ = keepers.ContractKeeper.Execute(ctx, addr, fred, []byte(`{"cpu_loop":{}}`), nil)
require.True(t, false, "We must panic before this line")
}
func TestExecuteWithStorageLoop(t *testing.T) {
ctx, keepers := CreateTestInput(t, false, AvailableCapabilities)
+
keeper := keepers.ContractKeeper
deposit := sdk.NewCoins(sdk.NewInt64Coin("denom", 100000))
@@ -1069,7 +1074,7 @@ func TestExecuteWithStorageLoop(t *testing.T) {
contractID, _, err := keeper.Create(ctx, creator, hackatomWasm, nil)
require.NoError(t, err)
- _, _, bob := keyPubAddr()
+ _, bob := keyPubAddr()
initMsg := HackatomExampleInitMsg{
Verifier: fred,
Beneficiary: bob,
@@ -1094,7 +1099,7 @@ func TestExecuteWithStorageLoop(t *testing.T) {
}()
// this should throw out of gas exception (panic)
- _, err = keepers.ContractKeeper.Execute(ctx, addr, fred, []byte(`{"storage_loop":{}}`), nil)
+ _, _ = keepers.ContractKeeper.Execute(ctx, addr, fred, []byte(`{"storage_loop":{}}`), nil)
require.True(t, false, "We must panic before this line")
}
@@ -1138,7 +1143,7 @@ func TestMigrate(t *testing.T) {
fromCodeID uint64
toCodeID uint64
migrateMsg []byte
- expErr *sdkerrors.Error
+ expErr *errorsmod.Error
expVerifier sdk.AccAddress
expIBCPort bool
initMsg []byte
@@ -1349,7 +1354,7 @@ func TestMigrateWithDispatchedMessage(t *testing.T) {
require.NoError(t, err)
require.NotEqual(t, originalContractID, burnerContractID)
- _, _, myPayoutAddr := keyPubAddr()
+ _, myPayoutAddr := keyPubAddr()
initMsg := HackatomExampleInitMsg{
Verifier: fred,
Beneficiary: fred,
@@ -1513,8 +1518,8 @@ func TestSudo(t *testing.T) {
contractID, _, err := keeper.Create(ctx, creator, hackatomWasm, nil)
require.NoError(t, err)
- _, _, bob := keyPubAddr()
- _, _, fred := keyPubAddr()
+ _, bob := keyPubAddr()
+ _, fred := keyPubAddr()
initMsg := HackatomExampleInitMsg{
Verifier: fred,
Beneficiary: bob,
@@ -1526,7 +1531,7 @@ func TestSudo(t *testing.T) {
require.Equal(t, "cosmos14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s4hmalr", addr.String())
// the community is broke
- _, _, community := keyPubAddr()
+ _, community := keyPubAddr()
comAcct := accKeeper.GetAccount(ctx, community)
require.Nil(t, comAcct)
@@ -1572,7 +1577,7 @@ func prettyEvents(t *testing.T, events sdk.Events) string {
for i, e := range events {
attr := make([]map[string]string, len(e.Attributes))
for j, a := range e.Attributes {
- attr[j] = map[string]string{string(a.Key): string(a.Value)}
+ attr[j] = map[string]string{a.Key: a.Value}
}
r[i] = prettyEvent{Type: e.Type, Attr: attr}
}
@@ -1599,7 +1604,7 @@ func TestUpdateContractAdmin(t *testing.T) {
originalContractID, _, err := keeper.Create(parentCtx, creator, hackatomWasm, nil)
require.NoError(t, err)
- _, _, anyAddr := keyPubAddr()
+ _, anyAddr := keyPubAddr()
initMsg := HackatomExampleInitMsg{
Verifier: fred,
Beneficiary: anyAddr,
@@ -1611,7 +1616,7 @@ func TestUpdateContractAdmin(t *testing.T) {
newAdmin sdk.AccAddress
overrideContractAddr sdk.AccAddress
caller sdk.AccAddress
- expErr *sdkerrors.Error
+ expErr *errorsmod.Error
}{
"all good with admin set": {
instAdmin: fred,
@@ -1669,7 +1674,7 @@ func TestClearContractAdmin(t *testing.T) {
originalContractID, _, err := keeper.Create(parentCtx, creator, hackatomWasm, nil)
require.NoError(t, err)
- _, _, anyAddr := keyPubAddr()
+ _, anyAddr := keyPubAddr()
initMsg := HackatomExampleInitMsg{
Verifier: fred,
Beneficiary: anyAddr,
@@ -1680,7 +1685,7 @@ func TestClearContractAdmin(t *testing.T) {
instAdmin sdk.AccAddress
overrideContractAddr sdk.AccAddress
caller sdk.AccAddress
- expErr *sdkerrors.Error
+ expErr *errorsmod.Error
}{
"all good when called by proper admin": {
instAdmin: fred,
@@ -2147,7 +2152,8 @@ func TestSetAccessConfig(t *testing.T) {
newParams := types.DefaultParams()
newParams.InstantiateDefaultPermission = spec.chainPermission
- k.SetParams(ctx, newParams)
+ err := k.SetParams(ctx, newParams)
+ require.NoError(t, err)
k.storeCodeInfo(ctx, codeID, types.NewCodeInfo(nil, creatorAddr, types.AllowNobody))
// when
@@ -2199,7 +2205,7 @@ func TestCoinBurnerPruneBalances(t *testing.T) {
setupAcc func(t *testing.T, ctx sdk.Context) authtypes.AccountI
expBalances sdk.Coins
expHandled bool
- expErr *sdkerrors.Error
+ expErr *errorsmod.Error
}{
"vesting account - all removed": {
setupAcc: func(t *testing.T, ctx sdk.Context) authtypes.AccountI { return myVestingAccount },
@@ -2277,8 +2283,9 @@ func TestIteratorContractByCreator(t *testing.T) {
mockAddress3 := keepers.Faucet.NewFundedRandomAccount(parentCtx, topUp...)
contract1ID, _, err := keeper.Create(parentCtx, creator, hackatomWasm, nil)
- contract2ID, _, err := keeper.Create(parentCtx, creator, hackatomWasm, nil)
+ require.NoError(t, err)
+ contract2ID, _, err := keeper.Create(parentCtx, creator, hackatomWasm, nil)
require.NoError(t, err)
initMsgBz := HackatomExampleInitMsg{
@@ -2404,7 +2411,7 @@ func TestSetContractAdmin(t *testing.T) {
func attrsToStringMap(attrs []abci.EventAttribute) map[string]string {
r := make(map[string]string, len(attrs))
for _, v := range attrs {
- r[string(v.Key)] = string(v.Value)
+ r[v.Key] = v.Value
}
return r
}
diff --git a/x/wasm/keeper/legacy_querier.go b/x/wasm/keeper/legacy_querier.go
deleted file mode 100644
index 8ff72e1f81..0000000000
--- a/x/wasm/keeper/legacy_querier.go
+++ /dev/null
@@ -1,154 +0,0 @@
-package keeper
-
-import (
- "encoding/json"
- "reflect"
- "strconv"
-
- sdk "github.com/cosmos/cosmos-sdk/types"
- sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
- abci "github.com/tendermint/tendermint/abci/types"
-
- "github.com/CosmWasm/wasmd/x/wasm/types"
-)
-
-const (
- QueryListContractByCode = "list-contracts-by-code"
- QueryGetContract = "contract-info"
- QueryGetContractState = "contract-state"
- QueryGetCode = "code"
- QueryListCode = "list-code"
- QueryContractHistory = "contract-history"
-)
-
-const (
- QueryMethodContractStateSmart = "smart"
- QueryMethodContractStateAll = "all"
- QueryMethodContractStateRaw = "raw"
-)
-
-// NewLegacyQuerier creates a new querier
-// Deprecated: the rest support will be removed. You can use the GRPC gateway instead
-func NewLegacyQuerier(keeper types.ViewKeeper, gasLimit sdk.Gas) sdk.Querier {
- return func(ctx sdk.Context, path []string, req abci.RequestQuery) ([]byte, error) {
- var (
- rsp interface{}
- err error
- )
- switch path[0] {
- case QueryGetContract:
- addr, addrErr := sdk.AccAddressFromBech32(path[1])
- if addrErr != nil {
- return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, addrErr.Error())
- }
- rsp, err = queryContractInfo(ctx, addr, keeper)
- case QueryListContractByCode:
- codeID, parseErr := strconv.ParseUint(path[1], 10, 64)
- if parseErr != nil {
- return nil, sdkerrors.Wrapf(types.ErrInvalid, "code id: %s", parseErr.Error())
- }
- rsp = queryContractListByCode(ctx, codeID, keeper)
- case QueryGetContractState:
- if len(path) < 3 {
- return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, "unknown data query endpoint")
- }
- return queryContractState(ctx, path[1], path[2], req.Data, gasLimit, keeper)
- case QueryGetCode:
- codeID, parseErr := strconv.ParseUint(path[1], 10, 64)
- if parseErr != nil {
- return nil, sdkerrors.Wrapf(types.ErrInvalid, "code id: %s", parseErr.Error())
- }
- rsp, err = queryCode(ctx, codeID, keeper)
- case QueryListCode:
- rsp, err = queryCodeList(ctx, keeper)
- case QueryContractHistory:
- contractAddr, addrErr := sdk.AccAddressFromBech32(path[1])
- if addrErr != nil {
- return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, addrErr.Error())
- }
- rsp, err = queryContractHistory(ctx, contractAddr, keeper)
- default:
- return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, "unknown data query endpoint")
- }
- if err != nil {
- return nil, err
- }
- if rsp == nil || reflect.ValueOf(rsp).IsNil() {
- return nil, nil
- }
- bz, err := json.MarshalIndent(rsp, "", " ")
- if err != nil {
- return nil, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error())
- }
- return bz, nil
- }
-}
-
-func queryContractState(ctx sdk.Context, bech, queryMethod string, data []byte, gasLimit sdk.Gas, keeper types.ViewKeeper) (json.RawMessage, error) {
- contractAddr, err := sdk.AccAddressFromBech32(bech)
- if err != nil {
- return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, bech)
- }
-
- switch queryMethod {
- case QueryMethodContractStateAll:
- resultData := make([]types.Model, 0)
- // this returns a serialized json object (which internally encoded binary fields properly)
- keeper.IterateContractState(ctx, contractAddr, func(key, value []byte) bool {
- resultData = append(resultData, types.Model{Key: key, Value: value})
- return false
- })
- bz, err := json.Marshal(resultData)
- if err != nil {
- return nil, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error())
- }
- return bz, nil
- case QueryMethodContractStateRaw:
- // this returns the raw data from the state, base64-encoded
- return keeper.QueryRaw(ctx, contractAddr, data), nil
- case QueryMethodContractStateSmart:
- // we enforce a subjective gas limit on all queries to avoid infinite loops
- ctx = ctx.WithGasMeter(sdk.NewGasMeter(gasLimit))
- msg := types.RawContractMessage(data)
- if err := msg.ValidateBasic(); err != nil {
- return nil, sdkerrors.Wrap(err, "json msg")
- }
- // this returns raw bytes (must be base64-encoded)
- bz, err := keeper.QuerySmart(ctx, contractAddr, msg)
- return bz, err
- default:
- return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, queryMethod)
- }
-}
-
-func queryCodeList(ctx sdk.Context, keeper types.ViewKeeper) ([]types.CodeInfoResponse, error) {
- var info []types.CodeInfoResponse
- keeper.IterateCodeInfos(ctx, func(i uint64, res types.CodeInfo) bool {
- info = append(info, types.CodeInfoResponse{
- CodeID: i,
- Creator: res.Creator,
- DataHash: res.CodeHash,
- InstantiatePermission: res.InstantiateConfig,
- })
- return false
- })
- return info, nil
-}
-
-func queryContractHistory(ctx sdk.Context, contractAddr sdk.AccAddress, keeper types.ViewKeeper) ([]types.ContractCodeHistoryEntry, error) {
- history := keeper.GetContractHistory(ctx, contractAddr)
- // redact response
- for i := range history {
- history[i].Updated = nil
- }
- return history, nil
-}
-
-func queryContractListByCode(ctx sdk.Context, codeID uint64, keeper types.ViewKeeper) []string {
- var contracts []string
- keeper.IterateContractsByCode(ctx, codeID, func(addr sdk.AccAddress) bool {
- contracts = append(contracts, addr.String())
- return false
- })
- return contracts
-}
diff --git a/x/wasm/keeper/legacy_querier_test.go b/x/wasm/keeper/legacy_querier_test.go
deleted file mode 100644
index 1b6006fa30..0000000000
--- a/x/wasm/keeper/legacy_querier_test.go
+++ /dev/null
@@ -1,364 +0,0 @@
-package keeper
-
-import (
- "bytes"
- "encoding/json"
- "errors"
- "fmt"
- "os"
- "testing"
-
- sdk "github.com/cosmos/cosmos-sdk/types"
- "github.com/stretchr/testify/assert"
- "github.com/stretchr/testify/require"
- abci "github.com/tendermint/tendermint/abci/types"
-
- "github.com/CosmWasm/wasmd/x/wasm/types"
-)
-
-func TestLegacyQueryContractState(t *testing.T) {
- ctx, keepers := CreateTestInput(t, false, AvailableCapabilities)
- keeper := keepers.WasmKeeper
-
- deposit := sdk.NewCoins(sdk.NewInt64Coin("denom", 100000))
- creator := keepers.Faucet.NewFundedRandomAccount(ctx, deposit.Add(deposit...)...)
- anyAddr := keepers.Faucet.NewFundedRandomAccount(ctx, sdk.NewInt64Coin("denom", 5000))
-
- wasmCode, err := os.ReadFile("./testdata/hackatom.wasm")
- require.NoError(t, err)
-
- contractID, _, err := keepers.ContractKeeper.Create(ctx, creator, wasmCode, nil)
- require.NoError(t, err)
-
- _, _, bob := keyPubAddr()
- initMsg := HackatomExampleInitMsg{
- Verifier: anyAddr,
- Beneficiary: bob,
- }
- initMsgBz, err := json.Marshal(initMsg)
- require.NoError(t, err)
-
- addr, _, err := keepers.ContractKeeper.Instantiate(ctx, contractID, creator, nil, initMsgBz, "demo contract to query", deposit)
- require.NoError(t, err)
-
- contractModel := []types.Model{
- {Key: []byte("foo"), Value: []byte(`"bar"`)},
- {Key: []byte{0x0, 0x1}, Value: []byte(`{"count":8}`)},
- }
- keeper.importContractState(ctx, addr, contractModel)
-
- // this gets us full error, not redacted sdk.Error
- var defaultQueryGasLimit sdk.Gas = 3000000
- q := NewLegacyQuerier(keeper, defaultQueryGasLimit)
-
- specs := map[string]struct {
- srcPath []string
- srcReq abci.RequestQuery
- // smart and raw queries (not all queries) return raw bytes from contract not []types.Model
- // if this is set, then we just compare - (should be json encoded string)
- expRes []byte
- // if success and expSmartRes is not set, we parse into []types.Model and compare (all state)
- expModelLen int
- expModelContains []types.Model
- expErr error
- }{
- "query all": {
- srcPath: []string{QueryGetContractState, addr.String(), QueryMethodContractStateAll},
- expModelLen: 3,
- expModelContains: []types.Model{
- {Key: []byte("foo"), Value: []byte(`"bar"`)},
- {Key: []byte{0x0, 0x1}, Value: []byte(`{"count":8}`)},
- },
- },
- "query raw key": {
- srcPath: []string{QueryGetContractState, addr.String(), QueryMethodContractStateRaw},
- srcReq: abci.RequestQuery{Data: []byte("foo")},
- expRes: []byte(`"bar"`),
- },
- "query raw binary key": {
- srcPath: []string{QueryGetContractState, addr.String(), QueryMethodContractStateRaw},
- srcReq: abci.RequestQuery{Data: []byte{0x0, 0x1}},
- expRes: []byte(`{"count":8}`),
- },
- "query smart": {
- srcPath: []string{QueryGetContractState, addr.String(), QueryMethodContractStateSmart},
- srcReq: abci.RequestQuery{Data: []byte(`{"verifier":{}}`)},
- expRes: []byte(fmt.Sprintf(`{"verifier":"%s"}`, anyAddr.String())),
- },
- "query smart invalid request": {
- srcPath: []string{QueryGetContractState, addr.String(), QueryMethodContractStateSmart},
- srcReq: abci.RequestQuery{Data: []byte(`{"raw":{"key":"config"}}`)},
- expErr: types.ErrQueryFailed,
- },
- "query smart with invalid json": {
- srcPath: []string{QueryGetContractState, addr.String(), QueryMethodContractStateSmart},
- srcReq: abci.RequestQuery{Data: []byte(`not a json string`)},
- expErr: types.ErrInvalid,
- },
- "query non-existent raw key": {
- srcPath: []string{QueryGetContractState, addr.String(), QueryMethodContractStateRaw},
- srcReq: abci.RequestQuery{Data: []byte("i do not exist")},
- expRes: nil,
- },
- "query empty raw key": {
- srcPath: []string{QueryGetContractState, addr.String(), QueryMethodContractStateRaw},
- srcReq: abci.RequestQuery{Data: []byte("")},
- expRes: nil,
- },
- "query nil raw key": {
- srcPath: []string{QueryGetContractState, addr.String(), QueryMethodContractStateRaw},
- srcReq: abci.RequestQuery{Data: nil},
- expRes: nil,
- },
- "query raw with unknown address": {
- srcPath: []string{QueryGetContractState, anyAddr.String(), QueryMethodContractStateRaw},
- expRes: nil,
- },
- "query all with unknown address": {
- srcPath: []string{QueryGetContractState, anyAddr.String(), QueryMethodContractStateAll},
- expModelLen: 0,
- },
- "query smart with unknown address": {
- srcPath: []string{QueryGetContractState, anyAddr.String(), QueryMethodContractStateSmart},
- srcReq: abci.RequestQuery{Data: []byte(`{}`)},
- expModelLen: 0,
- expErr: types.ErrNotFound,
- },
- }
-
- for msg, spec := range specs {
- t.Run(msg, func(t *testing.T) {
- binResult, err := q(ctx, spec.srcPath, spec.srcReq)
- // require.True(t, spec.expErr.Is(err), "unexpected error")
- require.True(t, errors.Is(err, spec.expErr), err)
-
- // if smart query, check custom response
- if spec.srcPath[2] != QueryMethodContractStateAll {
- require.Equal(t, spec.expRes, binResult)
- return
- }
-
- // otherwise, check returned models
- var r []types.Model
- if spec.expErr == nil {
- require.NoError(t, json.Unmarshal(binResult, &r))
- require.NotNil(t, r)
- }
- require.Len(t, r, spec.expModelLen)
- // and in result set
- for _, v := range spec.expModelContains {
- assert.Contains(t, r, v)
- }
- })
- }
-}
-
-func TestLegacyQueryContractListByCodeOrdering(t *testing.T) {
- ctx, keepers := CreateTestInput(t, false, AvailableCapabilities)
- keeper := keepers.WasmKeeper
-
- deposit := sdk.NewCoins(sdk.NewInt64Coin("denom", 1000000))
- topUp := sdk.NewCoins(sdk.NewInt64Coin("denom", 500))
- creator := keepers.Faucet.NewFundedRandomAccount(ctx, deposit.Add(deposit...)...)
- anyAddr := keepers.Faucet.NewFundedRandomAccount(ctx, topUp...)
-
- wasmCode, err := os.ReadFile("./testdata/hackatom.wasm")
- require.NoError(t, err)
-
- codeID, _, err := keepers.ContractKeeper.Create(ctx, creator, wasmCode, nil)
- require.NoError(t, err)
-
- _, _, bob := keyPubAddr()
- initMsg := HackatomExampleInitMsg{
- Verifier: anyAddr,
- Beneficiary: bob,
- }
- initMsgBz, err := json.Marshal(initMsg)
- require.NoError(t, err)
-
- // manage some realistic block settings
- var h int64 = 10
- setBlock := func(ctx sdk.Context, height int64) sdk.Context {
- ctx = ctx.WithBlockHeight(height)
- meter := sdk.NewGasMeter(1000000)
- ctx = ctx.WithGasMeter(meter)
- ctx = ctx.WithBlockGasMeter(meter)
- return ctx
- }
-
- // create 10 contracts with real block/gas setup
- for i := range [10]int{} {
- // 3 tx per block, so we ensure both comparisons work
- if i%3 == 0 {
- ctx = setBlock(ctx, h)
- h++
- }
- _, _, err = keepers.ContractKeeper.Instantiate(ctx, codeID, creator, nil, initMsgBz, fmt.Sprintf("contract %d", i), topUp)
- require.NoError(t, err)
- }
-
- // query and check the results are properly sorted
- var defaultQueryGasLimit sdk.Gas = 3000000
- q := NewLegacyQuerier(keeper, defaultQueryGasLimit)
-
- query := []string{QueryListContractByCode, fmt.Sprintf("%d", codeID)}
- data := abci.RequestQuery{}
- res, err := q(ctx, query, data)
- require.NoError(t, err)
-
- var contracts []string
- err = json.Unmarshal(res, &contracts)
- require.NoError(t, err)
-
- require.Equal(t, 10, len(contracts))
-
- for _, contract := range contracts {
- assert.NotEmpty(t, contract)
- }
-}
-
-func TestLegacyQueryContractHistory(t *testing.T) {
- ctx, keepers := CreateTestInput(t, false, AvailableCapabilities)
- keeper := keepers.WasmKeeper
-
- var otherAddr sdk.AccAddress = bytes.Repeat([]byte{0x2}, types.ContractAddrLen)
-
- specs := map[string]struct {
- srcQueryAddr sdk.AccAddress
- srcHistory []types.ContractCodeHistoryEntry
- expContent []types.ContractCodeHistoryEntry
- }{
- "response with internal fields cleared": {
- srcHistory: []types.ContractCodeHistoryEntry{{
- Operation: types.ContractCodeHistoryOperationTypeGenesis,
- CodeID: firstCodeID,
- Updated: types.NewAbsoluteTxPosition(ctx),
- Msg: []byte(`"init message"`),
- }},
- expContent: []types.ContractCodeHistoryEntry{{
- Operation: types.ContractCodeHistoryOperationTypeGenesis,
- CodeID: firstCodeID,
- Msg: []byte(`"init message"`),
- }},
- },
- "response with multiple entries": {
- srcHistory: []types.ContractCodeHistoryEntry{{
- Operation: types.ContractCodeHistoryOperationTypeInit,
- CodeID: firstCodeID,
- Updated: types.NewAbsoluteTxPosition(ctx),
- Msg: []byte(`"init message"`),
- }, {
- Operation: types.ContractCodeHistoryOperationTypeMigrate,
- CodeID: 2,
- Updated: types.NewAbsoluteTxPosition(ctx),
- Msg: []byte(`"migrate message 1"`),
- }, {
- Operation: types.ContractCodeHistoryOperationTypeMigrate,
- CodeID: 3,
- Updated: types.NewAbsoluteTxPosition(ctx),
- Msg: []byte(`"migrate message 2"`),
- }},
- expContent: []types.ContractCodeHistoryEntry{{
- Operation: types.ContractCodeHistoryOperationTypeInit,
- CodeID: firstCodeID,
- Msg: []byte(`"init message"`),
- }, {
- Operation: types.ContractCodeHistoryOperationTypeMigrate,
- CodeID: 2,
- Msg: []byte(`"migrate message 1"`),
- }, {
- Operation: types.ContractCodeHistoryOperationTypeMigrate,
- CodeID: 3,
- Msg: []byte(`"migrate message 2"`),
- }},
- },
- "unknown contract address": {
- srcQueryAddr: otherAddr,
- srcHistory: []types.ContractCodeHistoryEntry{{
- Operation: types.ContractCodeHistoryOperationTypeGenesis,
- CodeID: firstCodeID,
- Updated: types.NewAbsoluteTxPosition(ctx),
- Msg: []byte(`"init message"`),
- }},
- expContent: []types.ContractCodeHistoryEntry{},
- },
- }
- for msg, spec := range specs {
- t.Run(msg, func(t *testing.T) {
- _, _, myContractAddr := keyPubAddr()
- keeper.appendToContractHistory(ctx, myContractAddr, spec.srcHistory...)
-
- var defaultQueryGasLimit sdk.Gas = 3000000
- q := NewLegacyQuerier(keeper, defaultQueryGasLimit)
- queryContractAddr := spec.srcQueryAddr
- if queryContractAddr == nil {
- queryContractAddr = myContractAddr
- }
-
- // when
- query := []string{QueryContractHistory, queryContractAddr.String()}
- data := abci.RequestQuery{}
- resData, err := q(ctx, query, data)
-
- // then
- require.NoError(t, err)
- var got []types.ContractCodeHistoryEntry
- err = json.Unmarshal(resData, &got)
- require.NoError(t, err)
-
- assert.Equal(t, spec.expContent, got)
- })
- }
-}
-
-func TestLegacyQueryCodeList(t *testing.T) {
- wasmCode, err := os.ReadFile("./testdata/hackatom.wasm")
- require.NoError(t, err)
-
- specs := map[string]struct {
- codeIDs []uint64
- }{
- "none": {},
- "no gaps": {
- codeIDs: []uint64{1, 2, 3},
- },
- "with gaps": {
- codeIDs: []uint64{2, 4, 6},
- },
- }
-
- for msg, spec := range specs {
- t.Run(msg, func(t *testing.T) {
- ctx, keepers := CreateTestInput(t, false, AvailableCapabilities)
- keeper := keepers.WasmKeeper
-
- for _, codeID := range spec.codeIDs {
- require.NoError(t, keeper.importCode(ctx, codeID,
- types.CodeInfoFixture(types.WithSHA256CodeHash(wasmCode)),
- wasmCode),
- )
- }
- var defaultQueryGasLimit sdk.Gas = 3000000
- q := NewLegacyQuerier(keeper, defaultQueryGasLimit)
- // when
- query := []string{QueryListCode}
- data := abci.RequestQuery{}
- resData, err := q(ctx, query, data)
-
- // then
- require.NoError(t, err)
- if len(spec.codeIDs) == 0 {
- require.Nil(t, resData)
- return
- }
-
- var got []map[string]interface{}
- err = json.Unmarshal(resData, &got)
- require.NoError(t, err)
- require.Len(t, got, len(spec.codeIDs))
- for i, exp := range spec.codeIDs {
- assert.EqualValues(t, exp, got[i]["id"])
- }
- })
- }
-}
diff --git a/x/wasm/keeper/migrations.go b/x/wasm/keeper/migrations.go
index ffb80cc2ed..0e56c7120e 100644
--- a/x/wasm/keeper/migrations.go
+++ b/x/wasm/keeper/migrations.go
@@ -3,25 +3,30 @@ package keeper
import (
sdk "github.com/cosmos/cosmos-sdk/types"
- "github.com/CosmWasm/wasmd/x/wasm/types"
+ v1 "github.com/CosmWasm/wasmd/x/wasm/migrations/v1"
+ v2 "github.com/CosmWasm/wasmd/x/wasm/migrations/v2"
+
+ "github.com/CosmWasm/wasmd/x/wasm/exported"
)
// Migrator is a struct for handling in-place store migrations.
type Migrator struct {
- keeper Keeper
+ keeper Keeper
+ legacySubspace exported.Subspace
}
// NewMigrator returns a new Migrator.
-func NewMigrator(keeper Keeper) Migrator {
- return Migrator{keeper: keeper}
+func NewMigrator(keeper Keeper, legacySubspace exported.Subspace) Migrator {
+ return Migrator{keeper: keeper, legacySubspace: legacySubspace}
}
// Migrate1to2 migrates from version 1 to 2.
func (m Migrator) Migrate1to2(ctx sdk.Context) error {
- m.keeper.IterateContractInfo(ctx, func(contractAddr sdk.AccAddress, contractInfo types.ContractInfo) bool {
- creator := sdk.MustAccAddressFromBech32(contractInfo.Creator)
- m.keeper.addToContractCreatorSecondaryIndex(ctx, creator, contractInfo.Created, contractAddr)
- return false
- })
- return nil
+ return v1.NewMigrator(m.keeper, m.keeper.addToContractCreatorSecondaryIndex).Migrate1to2(ctx)
+}
+
+// Migrate2to3 migrates the x/wasm module state from the consensus
+// version 2 to version 3.
+func (m Migrator) Migrate2to3(ctx sdk.Context) error {
+ return v2.MigrateStore(ctx, m.keeper.storeKey, m.legacySubspace, m.keeper.cdc)
}
diff --git a/x/wasm/keeper/migrations_integration_test.go b/x/wasm/keeper/migrations_integration_test.go
new file mode 100644
index 0000000000..5a824f8284
--- /dev/null
+++ b/x/wasm/keeper/migrations_integration_test.go
@@ -0,0 +1,72 @@
+package keeper_test
+
+import (
+ "testing"
+
+ "github.com/CosmWasm/wasmd/x/wasm/types"
+
+ tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
+ sdk "github.com/cosmos/cosmos-sdk/types"
+ "github.com/cosmos/cosmos-sdk/types/module"
+ upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
+ "github.com/stretchr/testify/assert"
+ "github.com/stretchr/testify/require"
+
+ "github.com/CosmWasm/wasmd/app"
+ "github.com/CosmWasm/wasmd/x/wasm"
+)
+
+func TestModuleMigrations(t *testing.T) {
+ wasmApp := app.Setup(t)
+ upgradeHandler := func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { //nolint:unparam
+ return wasmApp.ModuleManager.RunMigrations(ctx, wasmApp.Configurator(), fromVM)
+ }
+
+ specs := map[string]struct {
+ setup func(ctx sdk.Context)
+ startVersion uint64
+ exp types.Params
+ }{
+ "with legacy params migrated": {
+ startVersion: 1,
+ setup: func(ctx sdk.Context) {
+ params := types.Params{
+ CodeUploadAccess: types.AllowNobody,
+ InstantiateDefaultPermission: types.AccessTypeNobody,
+ }
+ sp, _ := wasmApp.ParamsKeeper.GetSubspace(types.ModuleName)
+ sp.SetParamSet(ctx, ¶ms)
+ },
+ exp: types.Params{
+ CodeUploadAccess: types.AllowNobody,
+ InstantiateDefaultPermission: types.AccessTypeNobody,
+ },
+ },
+ "fresh from genesis": {
+ startVersion: wasmApp.ModuleManager.GetVersionMap()[types.ModuleName], // latest
+ setup: func(ctx sdk.Context) {},
+ exp: types.DefaultParams(),
+ },
+ }
+ for name, spec := range specs {
+ t.Run(name, func(t *testing.T) {
+ ctx, _ := wasmApp.BaseApp.NewContext(false, tmproto.Header{}).CacheContext()
+ spec.setup(ctx)
+
+ fromVM := wasmApp.UpgradeKeeper.GetModuleVersionMap(ctx)
+ fromVM[wasm.ModuleName] = spec.startVersion
+ _, err := upgradeHandler(ctx, upgradetypes.Plan{Name: "testing"}, fromVM)
+ require.NoError(t, err)
+
+ // when
+ gotVM, err := wasmApp.ModuleManager.RunMigrations(ctx, wasmApp.Configurator(), fromVM)
+
+ // then
+ require.NoError(t, err)
+ var expModuleVersion uint64 = 3
+ assert.Equal(t, expModuleVersion, gotVM[wasm.ModuleName])
+ gotParams := wasmApp.WasmKeeper.GetParams(ctx)
+ assert.Equal(t, spec.exp, gotParams)
+ })
+ }
+}
diff --git a/x/wasm/keeper/msg_dispatcher.go b/x/wasm/keeper/msg_dispatcher.go
index 59a836fa5f..e3a16a3bc8 100644
--- a/x/wasm/keeper/msg_dispatcher.go
+++ b/x/wasm/keeper/msg_dispatcher.go
@@ -1,14 +1,15 @@
package keeper
import (
- "bytes"
"fmt"
"sort"
+ "strings"
+ errorsmod "cosmossdk.io/errors"
wasmvmtypes "github.com/CosmWasm/wasmvm/types"
+ abci "github.com/cometbft/cometbft/abci/types"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
- abci "github.com/tendermint/tendermint/abci/types"
"github.com/CosmWasm/wasmd/x/wasm/types"
)
@@ -63,7 +64,7 @@ func (d MessageDispatcher) dispatchMsgWithGasLimit(ctx sdk.Context, contractAddr
panic(r)
}
ctx.GasMeter().ConsumeGas(gasLimit, "Sub-Message OutOfGas panic")
- err = sdkerrors.Wrap(sdkerrors.ErrOutOfGas, "SubMsg hit gas limit")
+ err = errorsmod.Wrap(sdkerrors.ErrOutOfGas, "SubMsg hit gas limit")
}
}()
events, data, err = d.messenger.DispatchMsg(subCtx, contractAddr, ibcPort, msg)
@@ -83,7 +84,7 @@ func (d MessageDispatcher) DispatchSubmessages(ctx sdk.Context, contractAddr sdk
switch msg.ReplyOn {
case wasmvmtypes.ReplySuccess, wasmvmtypes.ReplyError, wasmvmtypes.ReplyAlways, wasmvmtypes.ReplyNever:
default:
- return nil, sdkerrors.Wrap(types.ErrInvalid, "replyOn value")
+ return nil, errorsmod.Wrap(types.ErrInvalid, "replyOn value")
}
// first, we build a sub-context which we can use inside the submessages
subCtx, commit := ctx.CacheContext()
@@ -115,7 +116,7 @@ func (d MessageDispatcher) DispatchSubmessages(ctx sdk.Context, contractAddr sdk
for _, e := range filteredEvents {
attributes := e.Attributes
sort.SliceStable(attributes, func(i, j int) bool {
- return bytes.Compare(attributes[i].Key, attributes[j].Key) < 0
+ return strings.Compare(attributes[i].Key, attributes[j].Key) < 0
})
}
}
@@ -163,7 +164,7 @@ func (d MessageDispatcher) DispatchSubmessages(ctx sdk.Context, contractAddr sdk
rspData, err := d.keeper.reply(ctx, contractAddr, reply)
switch {
case err != nil:
- return nil, sdkerrors.Wrap(err, "reply")
+ return nil, errorsmod.Wrap(err, "reply")
case rspData != nil:
rsp = rspData
}
@@ -184,7 +185,7 @@ func redactError(err error) error {
// sdk/11 is out of gas
// sdk/5 is insufficient funds (on bank send)
// (we can theoretically redact less in the future, but this is a first step to safety)
- codespace, code, _ := sdkerrors.ABCIInfo(err, false)
+ codespace, code, _ := errorsmod.ABCIInfo(err, false)
return fmt.Errorf("codespace: %s, code: %d", codespace, code)
}
@@ -214,8 +215,8 @@ func sdkAttributesToWasmVMAttributes(attrs []abci.EventAttribute) []wasmvmtypes.
res := make([]wasmvmtypes.EventAttribute, len(attrs))
for i, attr := range attrs {
res[i] = wasmvmtypes.EventAttribute{
- Key: string(attr.Key),
- Value: string(attr.Value),
+ Key: attr.Key,
+ Value: attr.Value,
}
}
return res
diff --git a/x/wasm/keeper/msg_dispatcher_test.go b/x/wasm/keeper/msg_dispatcher_test.go
index e514ae4119..73e5db5b06 100644
--- a/x/wasm/keeper/msg_dispatcher_test.go
+++ b/x/wasm/keeper/msg_dispatcher_test.go
@@ -5,13 +5,12 @@ import (
"fmt"
"testing"
- "github.com/tendermint/tendermint/libs/log"
-
wasmvmtypes "github.com/CosmWasm/wasmvm/types"
+ abci "github.com/cometbft/cometbft/abci/types"
+ "github.com/cometbft/cometbft/libs/log"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
- abci "github.com/tendermint/tendermint/abci/types"
"github.com/CosmWasm/wasmd/x/wasm/keeper/wasmtesting"
)
@@ -95,7 +94,7 @@ func TestDispatchSubmessages(t *testing.T) {
},
msgHandler: &wasmtesting.MockMessageHandler{
DispatchMsgFn: func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, err error) {
- myEvents := []sdk.Event{{Type: "myEvent", Attributes: []abci.EventAttribute{{Key: []byte("foo"), Value: []byte("bar")}}}}
+ myEvents := []sdk.Event{{Type: "myEvent", Attributes: []abci.EventAttribute{{Key: "foo", Value: "bar"}}}}
return myEvents, [][]byte{[]byte("myData")}, nil
},
},
@@ -104,7 +103,7 @@ func TestDispatchSubmessages(t *testing.T) {
expEvents: []sdk.Event{
{
Type: "myEvent",
- Attributes: []abci.EventAttribute{{Key: []byte("foo"), Value: []byte("bar")}},
+ Attributes: []abci.EventAttribute{{Key: "foo", Value: "bar"}},
},
sdk.NewEvent("wasm-reply"),
},
@@ -116,7 +115,7 @@ func TestDispatchSubmessages(t *testing.T) {
replyer: &mockReplyer{},
msgHandler: &wasmtesting.MockMessageHandler{
DispatchMsgFn: func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, err error) {
- myEvents := []sdk.Event{{Type: "myEvent", Attributes: []abci.EventAttribute{{Key: []byte("foo"), Value: []byte("bar")}}}}
+ myEvents := []sdk.Event{{Type: "myEvent", Attributes: []abci.EventAttribute{{Key: "foo", Value: "bar"}}}}
ctx.EventManager().EmitEvents(myEvents)
return nil, nil, nil
},
@@ -124,7 +123,7 @@ func TestDispatchSubmessages(t *testing.T) {
expCommits: []bool{true},
expEvents: []sdk.Event{{
Type: "myEvent",
- Attributes: []abci.EventAttribute{{Key: []byte("foo"), Value: []byte("bar")}},
+ Attributes: []abci.EventAttribute{{Key: "foo", Value: "bar"}},
}},
},
"with context events - discarded on failure": {
@@ -134,7 +133,7 @@ func TestDispatchSubmessages(t *testing.T) {
replyer: &mockReplyer{},
msgHandler: &wasmtesting.MockMessageHandler{
DispatchMsgFn: func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, err error) {
- myEvents := []sdk.Event{{Type: "myEvent", Attributes: []abci.EventAttribute{{Key: []byte("foo"), Value: []byte("bar")}}}}
+ myEvents := []sdk.Event{{Type: "myEvent", Attributes: []abci.EventAttribute{{Key: "foo", Value: "bar"}}}}
ctx.EventManager().EmitEvents(myEvents)
return nil, nil, errors.New("testing")
},
@@ -395,15 +394,20 @@ func TestDispatchSubmessages(t *testing.T) {
WithGasMeter(sdk.NewGasMeter(100)).
WithEventManager(em).WithLogger(log.TestingLogger())
d := NewMessageDispatcher(spec.msgHandler, spec.replyer)
+
+ // run the test
gotData, gotErr := d.DispatchSubmessages(ctx, RandomAccountAddress(t), "any_port", spec.msgs)
if spec.expErr {
require.Error(t, gotErr)
assert.Empty(t, em.Events())
return
- } else {
- require.NoError(t, gotErr)
- assert.Equal(t, spec.expData, gotData)
}
+
+ // if we don't expect an error, we should get no error
+ require.NoError(t, gotErr)
+ assert.Equal(t, spec.expData, gotData)
+
+ // ensure the commits are what we expect
assert.Equal(t, spec.expCommits, mockStore.Committed)
if len(spec.expEvents) == 0 {
assert.Empty(t, em.Events())
diff --git a/x/wasm/keeper/msg_server.go b/x/wasm/keeper/msg_server.go
index d0383db699..bfc3e8b445 100644
--- a/x/wasm/keeper/msg_server.go
+++ b/x/wasm/keeper/msg_server.go
@@ -3,22 +3,37 @@ package keeper
import (
"context"
+ errorsmod "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
- sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/CosmWasm/wasmd/x/wasm/types"
)
var _ types.MsgServer = msgServer{}
+// abstract type
+type paramStore interface {
+ GetAuthority() string
+ SetParams(ctx sdk.Context, params types.Params) error
+}
+
+// grpc message server implementation
type msgServer struct {
- keeper types.ContractOpsKeeper
+ keeper types.ContractOpsKeeper
+ paramStore paramStore
}
-func NewMsgServerImpl(k types.ContractOpsKeeper) types.MsgServer {
- return &msgServer{keeper: k}
+// NewMsgServerImpl default constructor
+func NewMsgServerImpl(k *Keeper) types.MsgServer {
+ return newMsgServerImpl(NewDefaultPermissionKeeper(k), k)
}
+// newMsgServerImpl internal constructor to overwrite interfaces for testing
+func newMsgServerImpl(k types.ContractOpsKeeper, p paramStore) types.MsgServer {
+ return &msgServer{keeper: k, paramStore: p}
+}
+
+// StoreCode stores a new wasm code on chain
func (m msgServer) StoreCode(goCtx context.Context, msg *types.MsgStoreCode) (*types.MsgStoreCodeResponse, error) {
if err := msg.ValidateBasic(); err != nil {
return nil, err
@@ -26,15 +41,9 @@ func (m msgServer) StoreCode(goCtx context.Context, msg *types.MsgStoreCode) (*t
ctx := sdk.UnwrapSDKContext(goCtx)
senderAddr, err := sdk.AccAddressFromBech32(msg.Sender)
if err != nil {
- return nil, sdkerrors.Wrap(err, "sender")
+ return nil, errorsmod.Wrap(err, "sender")
}
- ctx.EventManager().EmitEvent(sdk.NewEvent(
- sdk.EventTypeMessage,
- sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName),
- sdk.NewAttribute(sdk.AttributeKeySender, msg.Sender),
- ))
-
codeID, checksum, err := m.keeper.Create(ctx, senderAddr, msg.WASMByteCode, msg.InstantiatePermission)
if err != nil {
return nil, err
@@ -55,21 +64,15 @@ func (m msgServer) InstantiateContract(goCtx context.Context, msg *types.MsgInst
senderAddr, err := sdk.AccAddressFromBech32(msg.Sender)
if err != nil {
- return nil, sdkerrors.Wrap(err, "sender")
+ return nil, errorsmod.Wrap(err, "sender")
}
var adminAddr sdk.AccAddress
if msg.Admin != "" {
if adminAddr, err = sdk.AccAddressFromBech32(msg.Admin); err != nil {
- return nil, sdkerrors.Wrap(err, "admin")
+ return nil, errorsmod.Wrap(err, "admin")
}
}
- ctx.EventManager().EmitEvent(sdk.NewEvent(
- sdk.EventTypeMessage,
- sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName),
- sdk.NewAttribute(sdk.AttributeKeySender, msg.Sender),
- ))
-
contractAddr, data, err := m.keeper.Instantiate(ctx, msg.CodeID, senderAddr, adminAddr, msg.Msg, msg.Label, msg.Funds)
if err != nil {
return nil, err
@@ -90,20 +93,15 @@ func (m msgServer) InstantiateContract2(goCtx context.Context, msg *types.MsgIns
senderAddr, err := sdk.AccAddressFromBech32(msg.Sender)
if err != nil {
- return nil, sdkerrors.Wrap(err, "sender")
+ return nil, errorsmod.Wrap(err, "sender")
}
var adminAddr sdk.AccAddress
if msg.Admin != "" {
if adminAddr, err = sdk.AccAddressFromBech32(msg.Admin); err != nil {
- return nil, sdkerrors.Wrap(err, "admin")
+ return nil, errorsmod.Wrap(err, "admin")
}
}
- ctx.EventManager().EmitEvent(sdk.NewEvent(
- sdk.EventTypeMessage,
- sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName),
- sdk.NewAttribute(sdk.AttributeKeySender, msg.Sender),
- ))
contractAddr, data, err := m.keeper.Instantiate2(ctx, msg.CodeID, senderAddr, adminAddr, msg.Msg, msg.Label, msg.Funds, msg.Salt, msg.FixMsg)
if err != nil {
return nil, err
@@ -123,19 +121,13 @@ func (m msgServer) ExecuteContract(goCtx context.Context, msg *types.MsgExecuteC
ctx := sdk.UnwrapSDKContext(goCtx)
senderAddr, err := sdk.AccAddressFromBech32(msg.Sender)
if err != nil {
- return nil, sdkerrors.Wrap(err, "sender")
+ return nil, errorsmod.Wrap(err, "sender")
}
contractAddr, err := sdk.AccAddressFromBech32(msg.Contract)
if err != nil {
- return nil, sdkerrors.Wrap(err, "contract")
+ return nil, errorsmod.Wrap(err, "contract")
}
- ctx.EventManager().EmitEvent(sdk.NewEvent(
- sdk.EventTypeMessage,
- sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName),
- sdk.NewAttribute(sdk.AttributeKeySender, msg.Sender),
- ))
-
data, err := m.keeper.Execute(ctx, contractAddr, senderAddr, msg.Msg, msg.Funds)
if err != nil {
return nil, err
@@ -154,19 +146,13 @@ func (m msgServer) MigrateContract(goCtx context.Context, msg *types.MsgMigrateC
ctx := sdk.UnwrapSDKContext(goCtx)
senderAddr, err := sdk.AccAddressFromBech32(msg.Sender)
if err != nil {
- return nil, sdkerrors.Wrap(err, "sender")
+ return nil, errorsmod.Wrap(err, "sender")
}
contractAddr, err := sdk.AccAddressFromBech32(msg.Contract)
if err != nil {
- return nil, sdkerrors.Wrap(err, "contract")
+ return nil, errorsmod.Wrap(err, "contract")
}
- ctx.EventManager().EmitEvent(sdk.NewEvent(
- sdk.EventTypeMessage,
- sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName),
- sdk.NewAttribute(sdk.AttributeKeySender, msg.Sender),
- ))
-
data, err := m.keeper.Migrate(ctx, contractAddr, senderAddr, msg.CodeID, msg.Msg)
if err != nil {
return nil, err
@@ -185,23 +171,17 @@ func (m msgServer) UpdateAdmin(goCtx context.Context, msg *types.MsgUpdateAdmin)
ctx := sdk.UnwrapSDKContext(goCtx)
senderAddr, err := sdk.AccAddressFromBech32(msg.Sender)
if err != nil {
- return nil, sdkerrors.Wrap(err, "sender")
+ return nil, errorsmod.Wrap(err, "sender")
}
contractAddr, err := sdk.AccAddressFromBech32(msg.Contract)
if err != nil {
- return nil, sdkerrors.Wrap(err, "contract")
+ return nil, errorsmod.Wrap(err, "contract")
}
newAdminAddr, err := sdk.AccAddressFromBech32(msg.NewAdmin)
if err != nil {
- return nil, sdkerrors.Wrap(err, "new admin")
+ return nil, errorsmod.Wrap(err, "new admin")
}
- ctx.EventManager().EmitEvent(sdk.NewEvent(
- sdk.EventTypeMessage,
- sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName),
- sdk.NewAttribute(sdk.AttributeKeySender, msg.Sender),
- ))
-
if err := m.keeper.UpdateContractAdmin(ctx, contractAddr, senderAddr, newAdminAddr); err != nil {
return nil, err
}
@@ -217,19 +197,13 @@ func (m msgServer) ClearAdmin(goCtx context.Context, msg *types.MsgClearAdmin) (
ctx := sdk.UnwrapSDKContext(goCtx)
senderAddr, err := sdk.AccAddressFromBech32(msg.Sender)
if err != nil {
- return nil, sdkerrors.Wrap(err, "sender")
+ return nil, errorsmod.Wrap(err, "sender")
}
contractAddr, err := sdk.AccAddressFromBech32(msg.Contract)
if err != nil {
- return nil, sdkerrors.Wrap(err, "contract")
+ return nil, errorsmod.Wrap(err, "contract")
}
- ctx.EventManager().EmitEvent(sdk.NewEvent(
- sdk.EventTypeMessage,
- sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName),
- sdk.NewAttribute(sdk.AttributeKeySender, msg.Sender),
- ))
-
if err := m.keeper.ClearContractAdmin(ctx, contractAddr, senderAddr); err != nil {
return nil, err
}
@@ -246,11 +220,21 @@ func (m msgServer) UpdateInstantiateConfig(goCtx context.Context, msg *types.Msg
if err := m.keeper.SetAccessConfig(ctx, msg.CodeID, sdk.AccAddress(msg.Sender), *msg.NewInstantiatePermission); err != nil {
return nil, err
}
- ctx.EventManager().EmitEvent(sdk.NewEvent(
- sdk.EventTypeMessage,
- sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName),
- sdk.NewAttribute(sdk.AttributeKeySender, msg.Sender),
- ))
return &types.MsgUpdateInstantiateConfigResponse{}, nil
}
+
+// UpdateParams updates the module parameters
+func (m msgServer) UpdateParams(goCtx context.Context, req *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) {
+ authority := m.paramStore.GetAuthority()
+ if authority != req.Authority {
+ return nil, errorsmod.Wrapf(types.ErrInvalid, "invalid authority; expected %s, got %s", authority, req.Authority)
+ }
+
+ ctx := sdk.UnwrapSDKContext(goCtx)
+ if err := m.paramStore.SetParams(ctx, req.Params); err != nil {
+ return nil, err
+ }
+
+ return &types.MsgUpdateParamsResponse{}, nil
+}
diff --git a/x/wasm/keeper/msg_server_integration_test.go b/x/wasm/keeper/msg_server_integration_test.go
index dde8ae7744..ea426646cb 100644
--- a/x/wasm/keeper/msg_server_integration_test.go
+++ b/x/wasm/keeper/msg_server_integration_test.go
@@ -6,10 +6,12 @@ import (
"testing"
"github.com/cosmos/cosmos-sdk/testutil/testdata"
+ sdk "github.com/cosmos/cosmos-sdk/types"
+ govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
+ tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
- tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
"github.com/CosmWasm/wasmd/app"
"github.com/CosmWasm/wasmd/x/wasm/types"
@@ -19,7 +21,7 @@ import (
var wasmContract []byte
func TestStoreCode(t *testing.T) {
- wasmApp := app.Setup(false)
+ wasmApp := app.Setup(t)
ctx := wasmApp.BaseApp.NewContext(false, tmproto.Header{})
_, _, sender := testdata.KeyTestPubAddr()
msg := types.MsgStoreCodeFixture(func(m *types.MsgStoreCode) {
@@ -44,3 +46,93 @@ func TestStoreCode(t *testing.T) {
assert.Equal(t, sender.String(), info.Creator)
assert.Equal(t, types.DefaultParams().InstantiateDefaultPermission.With(sender), info.InstantiateConfig)
}
+
+func TestUpdateParams(t *testing.T) {
+ wasmApp := app.Setup(t)
+ ctx := wasmApp.BaseApp.NewContext(false, tmproto.Header{})
+
+ var (
+ myAddress sdk.AccAddress = make([]byte, types.ContractAddrLen)
+ oneAddressAccessConfig = types.AccessTypeOnlyAddress.With(myAddress)
+ govAuthority = wasmApp.AccountKeeper.GetModuleAddress(govtypes.ModuleName).String()
+ )
+
+ specs := map[string]struct {
+ src types.MsgUpdateParams
+ expUploadConfig types.AccessConfig
+ expInstantiateType types.AccessType
+ }{
+ "update upload permission param": {
+ src: types.MsgUpdateParams{
+ Authority: govAuthority,
+ Params: types.Params{
+ CodeUploadAccess: types.AllowNobody,
+ InstantiateDefaultPermission: types.AccessTypeEverybody,
+ },
+ },
+ expUploadConfig: types.AllowNobody,
+ expInstantiateType: types.AccessTypeEverybody,
+ },
+ "update upload permission with same as current value": {
+ src: types.MsgUpdateParams{
+ Authority: govAuthority,
+ Params: types.Params{
+ CodeUploadAccess: types.AllowEverybody,
+ InstantiateDefaultPermission: types.AccessTypeEverybody,
+ },
+ },
+ expUploadConfig: types.AllowEverybody,
+ expInstantiateType: types.AccessTypeEverybody,
+ },
+ "update upload permission param with address": {
+ src: types.MsgUpdateParams{
+ Authority: govAuthority,
+ Params: types.Params{
+ CodeUploadAccess: oneAddressAccessConfig,
+ InstantiateDefaultPermission: types.AccessTypeEverybody,
+ },
+ },
+ expUploadConfig: oneAddressAccessConfig,
+ expInstantiateType: types.AccessTypeEverybody,
+ },
+ "update instantiate param": {
+ src: types.MsgUpdateParams{
+ Authority: govAuthority,
+ Params: types.Params{
+ CodeUploadAccess: types.AllowEverybody,
+ InstantiateDefaultPermission: types.AccessTypeNobody,
+ },
+ },
+ expUploadConfig: types.AllowEverybody,
+ expInstantiateType: types.AccessTypeNobody,
+ },
+ "update instantiate param as default": {
+ src: types.MsgUpdateParams{
+ Authority: govAuthority,
+ Params: types.Params{
+ CodeUploadAccess: types.AllowEverybody,
+ InstantiateDefaultPermission: types.AccessTypeEverybody,
+ },
+ },
+ expUploadConfig: types.AllowEverybody,
+ expInstantiateType: types.AccessTypeEverybody,
+ },
+ }
+ for msg, spec := range specs {
+ t.Run(msg, func(t *testing.T) {
+ err := wasmApp.WasmKeeper.SetParams(ctx, types.DefaultParams())
+ require.NoError(t, err)
+
+ // when
+ rsp, err := wasmApp.MsgServiceRouter().Handler(&spec.src)(ctx, &spec.src)
+ require.NoError(t, err)
+ var result types.MsgUpdateParamsResponse
+ require.NoError(t, wasmApp.AppCodec().Unmarshal(rsp.Data, &result))
+
+ // then
+ assert.True(t, spec.expUploadConfig.Equals(wasmApp.WasmKeeper.GetParams(ctx).CodeUploadAccess),
+ "got %#v not %#v", wasmApp.WasmKeeper.GetParams(ctx).CodeUploadAccess, spec.expUploadConfig)
+ assert.Equal(t, spec.expInstantiateType, wasmApp.WasmKeeper.GetParams(ctx).InstantiateDefaultPermission)
+ })
+ }
+}
diff --git a/x/wasm/keeper/options_test.go b/x/wasm/keeper/options_test.go
index 29d2f9bd26..d64e4a3f35 100644
--- a/x/wasm/keeper/options_test.go
+++ b/x/wasm/keeper/options_test.go
@@ -8,8 +8,6 @@ import (
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types"
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
- distributionkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper"
- paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
@@ -74,7 +72,7 @@ func TestConstructorOptions(t *testing.T) {
"api costs": {
srcOpt: WithAPICosts(1, 2),
verify: func(t *testing.T, k Keeper) {
- t.Cleanup(setApiDefaults)
+ t.Cleanup(setAPIDefaults)
assert.Equal(t, uint64(1), costHumanize)
assert.Equal(t, uint64(2), costCanonical)
},
@@ -104,13 +102,13 @@ func TestConstructorOptions(t *testing.T) {
}
for name, spec := range specs {
t.Run(name, func(t *testing.T) {
- k := NewKeeper(nil, nil, paramtypes.NewSubspace(nil, nil, nil, nil, ""), authkeeper.AccountKeeper{}, &bankkeeper.BaseKeeper{}, stakingkeeper.Keeper{}, distributionkeeper.Keeper{}, nil, nil, nil, nil, nil, nil, "tempDir", types.DefaultWasmConfig(), AvailableCapabilities, spec.srcOpt)
+ k := NewKeeper(nil, nil, authkeeper.AccountKeeper{}, &bankkeeper.BaseKeeper{}, stakingkeeper.Keeper{}, nil, nil, nil, nil, nil, nil, nil, "tempDir", types.DefaultWasmConfig(), AvailableCapabilities, "", spec.srcOpt)
spec.verify(t, k)
})
}
}
-func setApiDefaults() {
+func setAPIDefaults() {
costHumanize = DefaultGasCostHumanAddress * DefaultGasMultiplier
costCanonical = DefaultGasCostCanonicalAddress * DefaultGasMultiplier
}
diff --git a/x/wasm/keeper/proposal_handler.go b/x/wasm/keeper/proposal_handler.go
index efcf49c481..e47e973983 100644
--- a/x/wasm/keeper/proposal_handler.go
+++ b/x/wasm/keeper/proposal_handler.go
@@ -5,30 +5,32 @@ import (
"encoding/hex"
"fmt"
+ errorsmod "cosmossdk.io/errors"
+
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
- govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
+ "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
"github.com/CosmWasm/wasmd/x/wasm/types"
)
// NewWasmProposalHandler creates a new governance Handler for wasm proposals
-func NewWasmProposalHandler(k decoratedKeeper, enabledProposalTypes []types.ProposalType) govtypes.Handler {
+func NewWasmProposalHandler(k decoratedKeeper, enabledProposalTypes []types.ProposalType) v1beta1.Handler {
return NewWasmProposalHandlerX(NewGovPermissionKeeper(k), enabledProposalTypes)
}
// NewWasmProposalHandlerX creates a new governance Handler for wasm proposals
-func NewWasmProposalHandlerX(k types.ContractOpsKeeper, enabledProposalTypes []types.ProposalType) govtypes.Handler {
+func NewWasmProposalHandlerX(k types.ContractOpsKeeper, enabledProposalTypes []types.ProposalType) v1beta1.Handler {
enabledTypes := make(map[string]struct{}, len(enabledProposalTypes))
for i := range enabledProposalTypes {
enabledTypes[string(enabledProposalTypes[i])] = struct{}{}
}
- return func(ctx sdk.Context, content govtypes.Content) error {
+ return func(ctx sdk.Context, content v1beta1.Content) error {
if content == nil {
- return sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, "content must not be empty")
+ return errorsmod.Wrap(sdkerrors.ErrUnknownRequest, "content must not be empty")
}
if _, ok := enabledTypes[content.ProposalType()]; !ok {
- return sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "unsupported wasm proposal content type: %q", content.ProposalType())
+ return errorsmod.Wrapf(sdkerrors.ErrUnknownRequest, "unsupported wasm proposal content type: %q", content.ProposalType())
}
switch c := content.(type) {
case *types.StoreCodeProposal:
@@ -56,7 +58,7 @@ func NewWasmProposalHandlerX(k types.ContractOpsKeeper, enabledProposalTypes []t
case *types.StoreAndInstantiateContractProposal:
return handleStoreAndInstantiateContractProposal(ctx, k, *c)
default:
- return sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized wasm proposal content type: %T", c)
+ return errorsmod.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized wasm proposal content type: %T", c)
}
}
}
@@ -68,7 +70,7 @@ func handleStoreCodeProposal(ctx sdk.Context, k types.ContractOpsKeeper, p types
runAsAddr, err := sdk.AccAddressFromBech32(p.RunAs)
if err != nil {
- return sdkerrors.Wrap(err, "run as address")
+ return errorsmod.Wrap(err, "run as address")
}
codeID, checksum, err := k.Create(ctx, runAsAddr, p.WASMByteCode, p.InstantiatePermission)
if err != nil {
@@ -92,12 +94,12 @@ func handleInstantiateProposal(ctx sdk.Context, k types.ContractOpsKeeper, p typ
}
runAsAddr, err := sdk.AccAddressFromBech32(p.RunAs)
if err != nil {
- return sdkerrors.Wrap(err, "run as address")
+ return errorsmod.Wrap(err, "run as address")
}
var adminAddr sdk.AccAddress
if p.Admin != "" {
if adminAddr, err = sdk.AccAddressFromBech32(p.Admin); err != nil {
- return sdkerrors.Wrap(err, "admin")
+ return errorsmod.Wrap(err, "admin")
}
}
@@ -122,14 +124,14 @@ func handleInstantiate2Proposal(ctx sdk.Context, k types.ContractOpsKeeper, p ty
// Get runAsAddr as AccAddress
runAsAddr, err := sdk.AccAddressFromBech32(p.RunAs)
if err != nil {
- return sdkerrors.Wrap(err, "run as address")
+ return errorsmod.Wrap(err, "run as address")
}
// Get admin address
var adminAddr sdk.AccAddress
if p.Admin != "" {
if adminAddr, err = sdk.AccAddressFromBech32(p.Admin); err != nil {
- return sdkerrors.Wrap(err, "admin")
+ return errorsmod.Wrap(err, "admin")
}
}
@@ -151,12 +153,12 @@ func handleStoreAndInstantiateContractProposal(ctx sdk.Context, k types.Contract
}
runAsAddr, err := sdk.AccAddressFromBech32(p.RunAs)
if err != nil {
- return sdkerrors.Wrap(err, "run as address")
+ return errorsmod.Wrap(err, "run as address")
}
var adminAddr sdk.AccAddress
if p.Admin != "" {
if adminAddr, err = sdk.AccAddressFromBech32(p.Admin); err != nil {
- return sdkerrors.Wrap(err, "admin")
+ return errorsmod.Wrap(err, "admin")
}
}
@@ -166,7 +168,7 @@ func handleStoreAndInstantiateContractProposal(ctx sdk.Context, k types.Contract
}
if p.CodeHash != nil && !bytes.Equal(checksum, p.CodeHash) {
- return sdkerrors.Wrap(fmt.Errorf("code-hash mismatch: %X, checksum: %X", p.CodeHash, checksum), "code-hash mismatch")
+ return errorsmod.Wrap(fmt.Errorf("code-hash mismatch: %X, checksum: %X", p.CodeHash, checksum), "code-hash mismatch")
}
if !p.UnpinCode {
@@ -194,7 +196,7 @@ func handleMigrateProposal(ctx sdk.Context, k types.ContractOpsKeeper, p types.M
contractAddr, err := sdk.AccAddressFromBech32(p.Contract)
if err != nil {
- return sdkerrors.Wrap(err, "contract")
+ return errorsmod.Wrap(err, "contract")
}
// runAs is not used if this is permissioned, so just put any valid address there (second contractAddr)
@@ -217,7 +219,7 @@ func handleSudoProposal(ctx sdk.Context, k types.ContractOpsKeeper, p types.Sudo
contractAddr, err := sdk.AccAddressFromBech32(p.Contract)
if err != nil {
- return sdkerrors.Wrap(err, "contract")
+ return errorsmod.Wrap(err, "contract")
}
data, err := k.Sudo(ctx, contractAddr, p.Msg)
if err != nil {
@@ -238,11 +240,11 @@ func handleExecuteProposal(ctx sdk.Context, k types.ContractOpsKeeper, p types.E
contractAddr, err := sdk.AccAddressFromBech32(p.Contract)
if err != nil {
- return sdkerrors.Wrap(err, "contract")
+ return errorsmod.Wrap(err, "contract")
}
runAsAddr, err := sdk.AccAddressFromBech32(p.RunAs)
if err != nil {
- return sdkerrors.Wrap(err, "run as address")
+ return errorsmod.Wrap(err, "run as address")
}
data, err := k.Execute(ctx, contractAddr, runAsAddr, p.Msg, p.Funds)
if err != nil {
@@ -262,11 +264,11 @@ func handleUpdateAdminProposal(ctx sdk.Context, k types.ContractOpsKeeper, p typ
}
contractAddr, err := sdk.AccAddressFromBech32(p.Contract)
if err != nil {
- return sdkerrors.Wrap(err, "contract")
+ return errorsmod.Wrap(err, "contract")
}
newAdminAddr, err := sdk.AccAddressFromBech32(p.NewAdmin)
if err != nil {
- return sdkerrors.Wrap(err, "run as address")
+ return errorsmod.Wrap(err, "run as address")
}
return k.UpdateContractAdmin(ctx, contractAddr, nil, newAdminAddr)
@@ -279,12 +281,10 @@ func handleClearAdminProposal(ctx sdk.Context, k types.ContractOpsKeeper, p type
contractAddr, err := sdk.AccAddressFromBech32(p.Contract)
if err != nil {
- return sdkerrors.Wrap(err, "contract")
- }
- if err := k.ClearContractAdmin(ctx, contractAddr, nil); err != nil {
- return err
+ return errorsmod.Wrap(err, "contract")
}
- return nil
+ err = k.ClearContractAdmin(ctx, contractAddr, nil)
+ return err
}
func handlePinCodesProposal(ctx sdk.Context, k types.ContractOpsKeeper, p types.PinCodesProposal) error {
@@ -293,7 +293,7 @@ func handlePinCodesProposal(ctx sdk.Context, k types.ContractOpsKeeper, p types.
}
for _, v := range p.CodeIDs {
if err := k.PinCode(ctx, v); err != nil {
- return sdkerrors.Wrapf(err, "code id: %d", v)
+ return errorsmod.Wrapf(err, "code id: %d", v)
}
}
return nil
@@ -305,7 +305,7 @@ func handleUnpinCodesProposal(ctx sdk.Context, k types.ContractOpsKeeper, p type
}
for _, v := range p.CodeIDs {
if err := k.UnpinCode(ctx, v); err != nil {
- return sdkerrors.Wrapf(err, "code id: %d", v)
+ return errorsmod.Wrapf(err, "code id: %d", v)
}
}
return nil
@@ -319,7 +319,7 @@ func handleUpdateInstantiateConfigProposal(ctx sdk.Context, k types.ContractOpsK
var emptyCaller sdk.AccAddress
for _, accessConfigUpdate := range p.AccessConfigUpdates {
if err := k.SetAccessConfig(ctx, accessConfigUpdate.CodeID, emptyCaller, accessConfigUpdate.InstantiatePermission); err != nil {
- return sdkerrors.Wrapf(err, "code id: %d", accessConfigUpdate.CodeID)
+ return errorsmod.Wrapf(err, "code id: %d", accessConfigUpdate.CodeID)
}
}
return nil
diff --git a/x/wasm/keeper/proposal_integration_test.go b/x/wasm/keeper/proposal_integration_test.go
index 9f7e49deef..ee560bf67f 100644
--- a/x/wasm/keeper/proposal_integration_test.go
+++ b/x/wasm/keeper/proposal_integration_test.go
@@ -10,9 +10,10 @@ import (
wasmvm "github.com/CosmWasm/wasmvm"
sdk "github.com/cosmos/cosmos-sdk/types"
+ govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
- "github.com/cosmos/cosmos-sdk/x/params/client/utils"
- "github.com/cosmos/cosmos-sdk/x/params/types/proposal"
+ v1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
+ "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
@@ -20,13 +21,16 @@ import (
"github.com/CosmWasm/wasmd/x/wasm/types"
)
+const myTestLabel = "testing"
+
func TestStoreCodeProposal(t *testing.T) {
parentCtx, keepers := CreateTestInput(t, false, "staking")
- govKeeper, wasmKeeper := keepers.GovKeeper, keepers.WasmKeeper
- wasmKeeper.SetParams(parentCtx, types.Params{
+ wasmKeeper := keepers.WasmKeeper
+ err := wasmKeeper.SetParams(parentCtx, types.Params{
CodeUploadAccess: types.AllowNobody,
InstantiateDefaultPermission: types.AccessTypeNobody,
})
+ require.NoError(t, err)
rawWasmCode, err := os.ReadFile("./testdata/hackatom.wasm")
require.NoError(t, err)
gzippedWasmCode, err := os.ReadFile("./testdata/hackatom.wasm.gzip")
@@ -67,14 +71,8 @@ func TestStoreCodeProposal(t *testing.T) {
p.CodeHash = checksum
})
- // when stored
- storedProposal, err := govKeeper.SubmitProposal(ctx, src)
- require.NoError(t, err)
-
- // and proposal execute
- handler := govKeeper.Router().GetRoute(storedProposal.ProposalRoute())
- err = handler(ctx, storedProposal.GetContent())
- require.NoError(t, err)
+ // when
+ mustSubmitAndExecuteLegacyProposal(t, ctx, src, myActorAddress, keepers)
// then
cInfo := wasmKeeper.GetCodeInfo(ctx, 1)
@@ -89,13 +87,47 @@ func TestStoreCodeProposal(t *testing.T) {
}
}
+func mustSubmitAndExecuteLegacyProposal(t *testing.T, ctx sdk.Context, content v1beta1.Content, myActorAddress string, keepers TestKeepers) {
+ t.Helper()
+ govAuthority := keepers.AccountKeeper.GetModuleAddress(govtypes.ModuleName).String()
+ msgServer := govkeeper.NewMsgServerImpl(keepers.GovKeeper)
+ // ignore all submit events
+ contentMsg, err := submitLegacyProposal(t, ctx.WithEventManager(sdk.NewEventManager()), content, myActorAddress, govAuthority, msgServer)
+ require.NoError(t, err)
+
+ _, err = msgServer.ExecLegacyContent(sdk.WrapSDKContext(ctx), v1.NewMsgExecLegacyContent(contentMsg.Content, govAuthority))
+ require.NoError(t, err)
+}
+
+// does not fail on submit proposal
+func submitLegacyProposal(t *testing.T, ctx sdk.Context, content v1beta1.Content, myActorAddress string, govAuthority string, msgServer v1.MsgServer) (*v1.MsgExecLegacyContent, error) {
+ t.Helper()
+ contentMsg, err := v1.NewLegacyContent(content, govAuthority)
+ require.NoError(t, err)
+
+ proposal, err := v1.NewMsgSubmitProposal(
+ []sdk.Msg{contentMsg},
+ sdk.Coins{},
+ myActorAddress,
+ "",
+ "my title",
+ "my description",
+ )
+ require.NoError(t, err)
+
+ // when stored
+ _, err = msgServer.SubmitProposal(sdk.WrapSDKContext(ctx), proposal)
+ return contentMsg, err
+}
+
func TestInstantiateProposal(t *testing.T) {
ctx, keepers := CreateTestInput(t, false, "staking")
- govKeeper, wasmKeeper := keepers.GovKeeper, keepers.WasmKeeper
- wasmKeeper.SetParams(ctx, types.Params{
+ wasmKeeper := keepers.WasmKeeper
+ err := wasmKeeper.SetParams(ctx, types.Params{
CodeUploadAccess: types.AllowNobody,
InstantiateDefaultPermission: types.AccessTypeNobody,
})
+ require.NoError(t, err)
wasmCode, err := os.ReadFile("./testdata/hackatom.wasm")
require.NoError(t, err)
@@ -113,18 +145,12 @@ func TestInstantiateProposal(t *testing.T) {
p.CodeID = firstCodeID
p.RunAs = oneAddress.String()
p.Admin = otherAddress.String()
- p.Label = "testing"
+ p.Label = myTestLabel
})
em := sdk.NewEventManager()
- // when stored
- storedProposal, err := govKeeper.SubmitProposal(ctx, src)
- require.NoError(t, err)
-
- // and proposal execute
- handler := govKeeper.Router().GetRoute(storedProposal.ProposalRoute())
- err = handler(ctx.WithEventManager(em), storedProposal.GetContent())
- require.NoError(t, err)
+ // when
+ mustSubmitAndExecuteLegacyProposal(t, ctx.WithEventManager(em), src, oneAddress.String(), keepers)
// then
contractAddr, err := sdk.AccAddressFromBech32("cosmos14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s4hmalr")
@@ -135,7 +161,7 @@ func TestInstantiateProposal(t *testing.T) {
assert.Equal(t, uint64(1), cInfo.CodeID)
assert.Equal(t, oneAddress.String(), cInfo.Creator)
assert.Equal(t, otherAddress.String(), cInfo.Admin)
- assert.Equal(t, "testing", cInfo.Label)
+ assert.Equal(t, myTestLabel, cInfo.Label)
expHistory := []types.ContractCodeHistoryEntry{{
Operation: types.ContractCodeHistoryOperationTypeInit,
CodeID: src.CodeID,
@@ -154,11 +180,12 @@ func TestInstantiateProposal(t *testing.T) {
func TestInstantiate2Proposal(t *testing.T) {
ctx, keepers := CreateTestInput(t, false, "staking")
- govKeeper, wasmKeeper := keepers.GovKeeper, keepers.WasmKeeper
- wasmKeeper.SetParams(ctx, types.Params{
+ wasmKeeper := keepers.WasmKeeper
+ err := wasmKeeper.SetParams(ctx, types.Params{
CodeUploadAccess: types.AllowNobody,
InstantiateDefaultPermission: types.AccessTypeNobody,
})
+ require.NoError(t, err)
wasmCode, err := os.ReadFile("./testdata/hackatom.wasm")
require.NoError(t, err)
@@ -170,8 +197,8 @@ func TestInstantiate2Proposal(t *testing.T) {
var (
oneAddress sdk.AccAddress = bytes.Repeat([]byte{0x1}, types.ContractAddrLen)
otherAddress sdk.AccAddress = bytes.Repeat([]byte{0x2}, types.ContractAddrLen)
- label string = "label"
- salt []byte = []byte("mySalt")
+ label = "label"
+ salt = []byte("mySalt")
)
src := types.InstantiateContract2ProposalFixture(func(p *types.InstantiateContract2Proposal) {
p.CodeID = firstCodeID
@@ -184,14 +211,8 @@ func TestInstantiate2Proposal(t *testing.T) {
em := sdk.NewEventManager()
- // when stored
- storedProposal, err := govKeeper.SubmitProposal(ctx, src)
- require.NoError(t, err)
-
- // and proposal execute
- handler := govKeeper.Router().GetRoute(storedProposal.ProposalRoute())
- err = handler(ctx.WithEventManager(em), storedProposal.GetContent())
- require.NoError(t, err)
+ // when
+ mustSubmitAndExecuteLegacyProposal(t, ctx.WithEventManager(em), src, oneAddress.String(), keepers)
cInfo := wasmKeeper.GetContractInfo(ctx, contractAddress)
require.NotNil(t, cInfo)
@@ -208,7 +229,7 @@ func TestInstantiate2Proposal(t *testing.T) {
}}
assert.Equal(t, expHistory, wasmKeeper.GetContractHistory(ctx, contractAddress))
// and event
- require.Len(t, em.Events(), 3, "%#v", em.Events())
+ require.Len(t, em.Events(), 3, prettyEvents(t, em.Events()))
require.Equal(t, types.EventTypeInstantiate, em.Events()[0].Type)
require.Equal(t, types.WasmModuleEventType, em.Events()[1].Type)
require.Equal(t, types.EventTypeGovContractResult, em.Events()[2].Type)
@@ -218,11 +239,12 @@ func TestInstantiate2Proposal(t *testing.T) {
func TestInstantiateProposal_NoAdmin(t *testing.T) {
ctx, keepers := CreateTestInput(t, false, "staking")
- govKeeper, wasmKeeper := keepers.GovKeeper, keepers.WasmKeeper
- wasmKeeper.SetParams(ctx, types.Params{
+ wasmKeeper := keepers.WasmKeeper
+ err := wasmKeeper.SetParams(ctx, types.Params{
CodeUploadAccess: types.AllowNobody,
InstantiateDefaultPermission: types.AccessTypeNobody,
})
+ require.NoError(t, err)
wasmCode, err := os.ReadFile("./testdata/hackatom.wasm")
require.NoError(t, err)
@@ -234,67 +256,76 @@ func TestInstantiateProposal_NoAdmin(t *testing.T) {
var oneAddress sdk.AccAddress = bytes.Repeat([]byte{0x1}, types.ContractAddrLen)
- // test invalid admin address
- src := types.InstantiateContractProposalFixture(func(p *types.InstantiateContractProposal) {
- p.CodeID = firstCodeID
- p.RunAs = oneAddress.String()
- p.Admin = "invalid"
- p.Label = "testing"
- })
- _, err = govKeeper.SubmitProposal(ctx, src)
- require.Error(t, err)
-
- // test with no admin
- src = types.InstantiateContractProposalFixture(func(p *types.InstantiateContractProposal) {
- p.CodeID = firstCodeID
- p.RunAs = oneAddress.String()
- p.Admin = ""
- p.Label = "testing"
- })
- em := sdk.NewEventManager()
-
- // when stored
- storedProposal, err := govKeeper.SubmitProposal(ctx, src)
- require.NoError(t, err)
-
- // and proposal execute
- handler := govKeeper.Router().GetRoute(storedProposal.ProposalRoute())
- err = handler(ctx.WithEventManager(em), storedProposal.GetContent())
- require.NoError(t, err)
-
- // then
- contractAddr, err := sdk.AccAddressFromBech32("cosmos14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s4hmalr")
- require.NoError(t, err)
+ specs := map[string]struct {
+ srcAdmin string
+ expErr bool
+ }{
+ "empty admin": {
+ srcAdmin: "",
+ },
+ "invalid admin": {
+ srcAdmin: "invalid",
+ expErr: true,
+ },
+ }
+ for name, spec := range specs {
+ t.Run(name, func(t *testing.T) {
+ src := types.InstantiateContractProposalFixture(func(p *types.InstantiateContractProposal) {
+ p.CodeID = firstCodeID
+ p.RunAs = oneAddress.String()
+ p.Admin = spec.srcAdmin
+ p.Label = myTestLabel
+ })
+ govAuthority := keepers.AccountKeeper.GetModuleAddress(govtypes.ModuleName).String()
+ msgServer := govkeeper.NewMsgServerImpl(keepers.GovKeeper)
+ // when
+ contentMsg, gotErr := submitLegacyProposal(t, ctx, src, oneAddress.String(), govAuthority, msgServer)
+ // then
+ if spec.expErr {
+ require.Error(t, gotErr)
+ return
+ }
+ require.NoError(t, gotErr)
+ // and when
+ em := sdk.NewEventManager()
+ _, err = msgServer.ExecLegacyContent(sdk.WrapSDKContext(ctx.WithEventManager(em)), v1.NewMsgExecLegacyContent(contentMsg.Content, govAuthority))
+ // then
+ require.NoError(t, err)
+ contractAddr, err := sdk.AccAddressFromBech32("cosmos14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s4hmalr")
+ require.NoError(t, err)
- cInfo := wasmKeeper.GetContractInfo(ctx, contractAddr)
- require.NotNil(t, cInfo)
- assert.Equal(t, uint64(1), cInfo.CodeID)
- assert.Equal(t, oneAddress.String(), cInfo.Creator)
- assert.Equal(t, "", cInfo.Admin)
- assert.Equal(t, "testing", cInfo.Label)
- expHistory := []types.ContractCodeHistoryEntry{{
- Operation: types.ContractCodeHistoryOperationTypeInit,
- CodeID: src.CodeID,
- Updated: types.NewAbsoluteTxPosition(ctx),
- Msg: src.Msg,
- }}
- assert.Equal(t, expHistory, wasmKeeper.GetContractHistory(ctx, contractAddr))
- // and event
- require.Len(t, em.Events(), 3, "%#v", em.Events())
- require.Equal(t, types.EventTypeInstantiate, em.Events()[0].Type)
- require.Equal(t, types.WasmModuleEventType, em.Events()[1].Type)
- require.Equal(t, types.EventTypeGovContractResult, em.Events()[2].Type)
- require.Len(t, em.Events()[2].Attributes, 1)
- require.NotEmpty(t, em.Events()[2].Attributes[0])
+ cInfo := wasmKeeper.GetContractInfo(ctx, contractAddr)
+ require.NotNil(t, cInfo)
+ assert.Equal(t, uint64(1), cInfo.CodeID)
+ assert.Equal(t, oneAddress.String(), cInfo.Creator)
+ assert.Equal(t, "", cInfo.Admin)
+ assert.Equal(t, myTestLabel, cInfo.Label)
+ expHistory := []types.ContractCodeHistoryEntry{{
+ Operation: types.ContractCodeHistoryOperationTypeInit,
+ CodeID: src.CodeID,
+ Updated: types.NewAbsoluteTxPosition(ctx),
+ Msg: src.Msg,
+ }}
+ assert.Equal(t, expHistory, wasmKeeper.GetContractHistory(ctx, contractAddr))
+ // and event
+ require.Len(t, em.Events(), 3, "%#v", em.Events())
+ require.Equal(t, types.EventTypeInstantiate, em.Events()[0].Type)
+ require.Equal(t, types.WasmModuleEventType, em.Events()[1].Type)
+ require.Equal(t, types.EventTypeGovContractResult, em.Events()[2].Type)
+ require.Len(t, em.Events()[2].Attributes, 1)
+ require.NotEmpty(t, em.Events()[2].Attributes[0])
+ })
+ }
}
func TestStoreAndInstantiateContractProposal(t *testing.T) {
ctx, keepers := CreateTestInput(t, false, "staking")
- govKeeper, wasmKeeper := keepers.GovKeeper, keepers.WasmKeeper
- wasmKeeper.SetParams(ctx, types.Params{
+ wasmKeeper := keepers.WasmKeeper
+ err := wasmKeeper.SetParams(ctx, types.Params{
CodeUploadAccess: types.AllowNobody,
InstantiateDefaultPermission: types.AccessTypeNobody,
})
+ require.NoError(t, err)
wasmCode, err := os.ReadFile("./testdata/hackatom.wasm")
require.NoError(t, err)
@@ -311,19 +342,13 @@ func TestStoreAndInstantiateContractProposal(t *testing.T) {
p.WASMByteCode = wasmCode
p.RunAs = oneAddress.String()
p.Admin = otherAddress.String()
- p.Label = "testing"
+ p.Label = myTestLabel
p.CodeHash = checksum
})
em := sdk.NewEventManager()
- // when stored
- storedProposal, err := govKeeper.SubmitProposal(ctx, src)
- require.NoError(t, err)
-
- // and proposal execute
- handler := govKeeper.Router().GetRoute(storedProposal.ProposalRoute())
- err = handler(ctx.WithEventManager(em), storedProposal.GetContent())
- require.NoError(t, err)
+ // when
+ mustSubmitAndExecuteLegacyProposal(t, ctx.WithEventManager(em), src, oneAddress.String(), keepers)
// then
contractAddr, err := sdk.AccAddressFromBech32("cosmos14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s4hmalr")
@@ -333,7 +358,7 @@ func TestStoreAndInstantiateContractProposal(t *testing.T) {
require.NotNil(t, cInfo)
assert.Equal(t, oneAddress.String(), cInfo.Creator)
assert.Equal(t, otherAddress.String(), cInfo.Admin)
- assert.Equal(t, "testing", cInfo.Label)
+ assert.Equal(t, myTestLabel, cInfo.Label)
expHistory := []types.ContractCodeHistoryEntry{{
Operation: types.ContractCodeHistoryOperationTypeInit,
CodeID: cInfo.CodeID,
@@ -354,11 +379,12 @@ func TestStoreAndInstantiateContractProposal(t *testing.T) {
func TestMigrateProposal(t *testing.T) {
ctx, keepers := CreateTestInput(t, false, "staking")
- govKeeper, wasmKeeper := keepers.GovKeeper, keepers.WasmKeeper
- wasmKeeper.SetParams(ctx, types.Params{
+ wasmKeeper := keepers.WasmKeeper
+ err := wasmKeeper.SetParams(ctx, types.Params{
CodeUploadAccess: types.AllowNobody,
InstantiateDefaultPermission: types.AccessTypeNobody,
})
+ require.NoError(t, err)
wasmCode, err := os.ReadFile("./testdata/hackatom.wasm")
require.NoError(t, err)
@@ -374,7 +400,7 @@ func TestMigrateProposal(t *testing.T) {
)
contractInfo := types.ContractInfoFixture(func(c *types.ContractInfo) {
- c.Label = "testing"
+ c.Label = myTestLabel
c.Admin = anyAddress.String()
c.Created = types.NewAbsoluteTxPosition(ctx)
})
@@ -392,7 +418,7 @@ func TestMigrateProposal(t *testing.T) {
migMsgBz, err := json.Marshal(migMsg)
require.NoError(t, err)
- src := types.MigrateContractProposal{
+ src := &types.MigrateContractProposal{
Title: "Foo",
Description: "Bar",
CodeID: 2,
@@ -402,14 +428,8 @@ func TestMigrateProposal(t *testing.T) {
em := sdk.NewEventManager()
- // when stored
- storedProposal, err := govKeeper.SubmitProposal(ctx, &src)
- require.NoError(t, err)
-
- // and proposal execute
- handler := govKeeper.Router().GetRoute(storedProposal.ProposalRoute())
- err = handler(ctx.WithEventManager(em), storedProposal.GetContent())
- require.NoError(t, err)
+ // when
+ mustSubmitAndExecuteLegacyProposal(t, ctx.WithEventManager(em), src, anyAddress.String(), keepers)
// then
require.NoError(t, err)
@@ -417,7 +437,7 @@ func TestMigrateProposal(t *testing.T) {
require.NotNil(t, cInfo)
assert.Equal(t, uint64(2), cInfo.CodeID)
assert.Equal(t, anyAddress.String(), cInfo.Admin)
- assert.Equal(t, "testing", cInfo.Label)
+ assert.Equal(t, myTestLabel, cInfo.Label)
expHistory := []types.ContractCodeHistoryEntry{{
Operation: types.ContractCodeHistoryOperationTypeInit,
CodeID: firstCodeID,
@@ -434,12 +454,12 @@ func TestMigrateProposal(t *testing.T) {
assert.Equal(t, types.EventTypeMigrate, em.Events()[0].Type)
require.Equal(t, types.EventTypeGovContractResult, em.Events()[1].Type)
require.Len(t, em.Events()[1].Attributes, 1)
- assert.Equal(t, types.AttributeKeyResultDataHex, string(em.Events()[1].Attributes[0].Key))
+ assert.Equal(t, types.AttributeKeyResultDataHex, em.Events()[1].Attributes[0].Key)
}
func TestExecuteProposal(t *testing.T) {
ctx, keepers := CreateTestInput(t, false, "staking")
- govKeeper, bankKeeper := keepers.GovKeeper, keepers.BankKeeper
+ bankKeeper := keepers.BankKeeper
exampleContract := InstantiateHackatomExampleContract(t, ctx, keepers)
contractAddr := exampleContract.Contract
@@ -455,7 +475,7 @@ func TestExecuteProposal(t *testing.T) {
require.NoError(t, err)
// try with runAs that doesn't have pemission
- badSrc := types.ExecuteContractProposal{
+ badSrc := &types.ExecuteContractProposal{
Title: "First",
Description: "Beneficiary has no permission to run",
Contract: contractAddr.String(),
@@ -463,17 +483,18 @@ func TestExecuteProposal(t *testing.T) {
RunAs: exampleContract.BeneficiaryAddr.String(),
}
- em := sdk.NewEventManager()
-
// fails on store - this doesn't have permission
- storedProposal, err := govKeeper.SubmitProposal(ctx, &badSrc)
+ govAuthority := keepers.AccountKeeper.GetModuleAddress(govtypes.ModuleName).String()
+ msgServer := govkeeper.NewMsgServerImpl(keepers.GovKeeper)
+ _, err = submitLegacyProposal(t, ctx, badSrc, exampleContract.BeneficiaryAddr.String(), govAuthority, msgServer)
require.Error(t, err)
+
// balance should not change
bal = bankKeeper.GetBalance(ctx, contractAddr, "denom")
require.Equal(t, bal.Amount, sdk.NewInt(100))
// try again with the proper run-as
- src := types.ExecuteContractProposal{
+ src := &types.ExecuteContractProposal{
Title: "Second",
Description: "Verifier can execute",
Contract: contractAddr.String(),
@@ -481,16 +502,10 @@ func TestExecuteProposal(t *testing.T) {
RunAs: exampleContract.VerifierAddr.String(),
}
- em = sdk.NewEventManager()
-
- // when stored
- storedProposal, err = govKeeper.SubmitProposal(ctx, &src)
- require.NoError(t, err)
+ em := sdk.NewEventManager()
- // and proposal execute
- handler := govKeeper.Router().GetRoute(storedProposal.ProposalRoute())
- err = handler(ctx.WithEventManager(em), storedProposal.GetContent())
- require.NoError(t, err)
+ // when
+ mustSubmitAndExecuteLegacyProposal(t, ctx.WithEventManager(em), src, exampleContract.BeneficiaryAddr.String(), keepers)
// balance should be empty (proper release)
bal = bankKeeper.GetBalance(ctx, contractAddr, "denom")
@@ -499,11 +514,11 @@ func TestExecuteProposal(t *testing.T) {
func TestSudoProposal(t *testing.T) {
ctx, keepers := CreateTestInput(t, false, "staking")
- govKeeper, bankKeeper := keepers.GovKeeper, keepers.BankKeeper
+ bankKeeper := keepers.BankKeeper
exampleContract := InstantiateHackatomExampleContract(t, ctx, keepers)
contractAddr := exampleContract.Contract
- _, _, anyAddr := keyPubAddr()
+ _, anyAddr := keyPubAddr()
// check balance
bal := bankKeeper.GetBalance(ctx, contractAddr, "denom")
@@ -525,7 +540,7 @@ func TestSudoProposal(t *testing.T) {
require.NoError(t, err)
// sudo can do anything
- src := types.SudoContractProposal{
+ src := &types.SudoContractProposal{
Title: "Sudo",
Description: "Steal funds for the verifier",
Contract: contractAddr.String(),
@@ -534,14 +549,8 @@ func TestSudoProposal(t *testing.T) {
em := sdk.NewEventManager()
- // when stored
- storedProposal, err := govKeeper.SubmitProposal(ctx, &src)
- require.NoError(t, err)
-
- // and proposal execute
- handler := govKeeper.Router().GetRoute(storedProposal.ProposalRoute())
- err = handler(ctx.WithEventManager(em), storedProposal.GetContent())
- require.NoError(t, err)
+ // when
+ mustSubmitAndExecuteLegacyProposal(t, ctx.WithEventManager(em), src, exampleContract.BeneficiaryAddr.String(), keepers)
// balance should be empty (and verifier richer)
bal = bankKeeper.GetBalance(ctx, contractAddr, "denom")
@@ -560,7 +569,7 @@ func TestAdminProposals(t *testing.T) {
specs := map[string]struct {
state types.ContractInfo
- srcProposal govtypes.Content
+ srcProposal v1beta1.Content
expAdmin sdk.AccAddress
}{
"update with different admin": {
@@ -609,11 +618,12 @@ func TestAdminProposals(t *testing.T) {
for msg, spec := range specs {
t.Run(msg, func(t *testing.T) {
ctx, keepers := CreateTestInput(t, false, "staking")
- govKeeper, wasmKeeper := keepers.GovKeeper, keepers.WasmKeeper
- wasmKeeper.SetParams(ctx, types.Params{
+ wasmKeeper := keepers.WasmKeeper
+ err := wasmKeeper.SetParams(ctx, types.Params{
CodeUploadAccess: types.AllowNobody,
InstantiateDefaultPermission: types.AccessTypeNobody,
})
+ require.NoError(t, err)
codeInfo := types.CodeInfoFixture(types.WithSHA256CodeHash(wasmCode))
require.NoError(t, wasmKeeper.importCode(ctx, 1, codeInfo, wasmCode))
@@ -627,14 +637,9 @@ func TestAdminProposals(t *testing.T) {
}
require.NoError(t, wasmKeeper.importContract(ctx, contractAddr, &spec.state, []types.Model{}, entries))
- // when stored
- storedProposal, err := govKeeper.SubmitProposal(ctx, spec.srcProposal)
- require.NoError(t, err)
- // and execute proposal
- handler := govKeeper.Router().GetRoute(storedProposal.ProposalRoute())
- err = handler(ctx, storedProposal.GetContent())
- require.NoError(t, err)
+ // when
+ mustSubmitAndExecuteLegacyProposal(t, ctx, spec.srcProposal, otherAddress.String(), keepers)
// then
cInfo := wasmKeeper.GetContractInfo(ctx, contractAddr)
@@ -644,106 +649,9 @@ func TestAdminProposals(t *testing.T) {
}
}
-func TestUpdateParamsProposal(t *testing.T) {
- ctx, keepers := CreateTestInput(t, false, "staking")
- govKeeper, wasmKeeper := keepers.GovKeeper, keepers.WasmKeeper
-
- var (
- legacyAmino = keepers.EncodingConfig.Amino
- myAddress sdk.AccAddress = make([]byte, types.ContractAddrLen)
- oneAddressAccessConfig = types.AccessTypeOnlyAddress.With(myAddress)
- )
-
- specs := map[string]struct {
- src proposal.ParamChange
- expUploadConfig types.AccessConfig
- expInstantiateType types.AccessType
- }{
- "update upload permission param": {
- src: proposal.ParamChange{
- Subspace: types.ModuleName,
- Key: string(types.ParamStoreKeyUploadAccess),
- Value: string(legacyAmino.MustMarshalJSON(&types.AllowNobody)),
- },
- expUploadConfig: types.AllowNobody,
- expInstantiateType: types.AccessTypeEverybody,
- },
- "update upload permission with same as current value": {
- src: proposal.ParamChange{
- Subspace: types.ModuleName,
- Key: string(types.ParamStoreKeyUploadAccess),
- Value: string(legacyAmino.MustMarshalJSON(&types.AllowEverybody)),
- },
- expUploadConfig: types.AllowEverybody,
- expInstantiateType: types.AccessTypeEverybody,
- },
- "update upload permission param with address": {
- src: proposal.ParamChange{
- Subspace: types.ModuleName,
- Key: string(types.ParamStoreKeyUploadAccess),
- Value: string(legacyAmino.MustMarshalJSON(&oneAddressAccessConfig)),
- },
- expUploadConfig: oneAddressAccessConfig,
- expInstantiateType: types.AccessTypeEverybody,
- },
- "update instantiate param": {
- src: proposal.ParamChange{
- Subspace: types.ModuleName,
- Key: string(types.ParamStoreKeyInstantiateAccess),
- Value: string(legacyAmino.MustMarshalJSON(types.AccessTypeNobody)),
- },
- expUploadConfig: types.AllowEverybody,
- expInstantiateType: types.AccessTypeNobody,
- },
- "update instantiate param as default": {
- src: proposal.ParamChange{
- Subspace: types.ModuleName,
- Key: string(types.ParamStoreKeyInstantiateAccess),
- Value: string(legacyAmino.MustMarshalJSON(types.AccessTypeEverybody)),
- },
- expUploadConfig: types.AllowEverybody,
- expInstantiateType: types.AccessTypeEverybody,
- },
- }
- for msg, spec := range specs {
- t.Run(msg, func(t *testing.T) {
- wasmKeeper.SetParams(ctx, types.DefaultParams())
-
- // encode + decode as CLI to play nice with amino
- bz := legacyAmino.MustMarshalJSON(&utils.ParamChangeProposalJSON{
- Title: "Foo",
- Description: "Bar",
- Changes: []utils.ParamChangeJSON{{Subspace: spec.src.Subspace, Key: spec.src.Key, Value: json.RawMessage(spec.src.Value)}},
- })
- t.Log(string(bz))
-
- var jsonProposal utils.ParamChangeProposalJSON
- require.NoError(t, legacyAmino.UnmarshalJSON(bz, &jsonProposal))
- proposal := proposal.ParameterChangeProposal{
- Title: jsonProposal.Title,
- Description: jsonProposal.Description,
- Changes: jsonProposal.Changes.ToParamChanges(),
- }
- // when stored
- storedProposal, err := govKeeper.SubmitProposal(ctx, &proposal)
- require.NoError(t, err)
-
- // and proposal execute
- handler := govKeeper.Router().GetRoute(storedProposal.ProposalRoute())
- err = handler(ctx, storedProposal.GetContent())
- require.NoError(t, err)
-
- // then
- assert.True(t, spec.expUploadConfig.Equals(wasmKeeper.getUploadAccessConfig(ctx)),
- "got %#v not %#v", wasmKeeper.getUploadAccessConfig(ctx), spec.expUploadConfig)
- assert.Equal(t, spec.expInstantiateType, wasmKeeper.getInstantiateAccessConfig(ctx))
- })
- }
-}
-
func TestPinCodesProposal(t *testing.T) {
ctx, keepers := CreateTestInput(t, false, "staking")
- govKeeper, wasmKeeper := keepers.GovKeeper, keepers.WasmKeeper
+ wasmKeeper := keepers.WasmKeeper
mock := wasmtesting.MockWasmer{
CreateFn: wasmtesting.NoOpCreateFn,
@@ -798,17 +706,21 @@ func TestPinCodesProposal(t *testing.T) {
parentCtx := ctx
for msg, spec := range specs {
t.Run(msg, func(t *testing.T) {
+ myActorAddress := RandomBech32AccountAddress(t)
gotPinnedChecksums = nil
ctx, _ := parentCtx.CacheContext()
mock.PinFn = spec.mockFn
- proposal := types.PinCodesProposal{
+ proposal := &types.PinCodesProposal{
Title: "Foo",
Description: "Bar",
CodeIDs: spec.srcCodeIDs,
}
- // when stored
- storedProposal, gotErr := govKeeper.SubmitProposal(ctx, &proposal)
+ govAuthority := keepers.AccountKeeper.GetModuleAddress(govtypes.ModuleName).String()
+ msgServer := govkeeper.NewMsgServerImpl(keepers.GovKeeper)
+
+ // when
+ contentMsg, gotErr := submitLegacyProposal(t, ctx, proposal, myActorAddress, govAuthority, msgServer)
if spec.expErr {
require.Error(t, gotErr)
return
@@ -816,9 +728,8 @@ func TestPinCodesProposal(t *testing.T) {
require.NoError(t, gotErr)
// and proposal execute
- handler := govKeeper.Router().GetRoute(storedProposal.ProposalRoute())
- gotErr = handler(ctx, storedProposal.GetContent())
- require.NoError(t, gotErr)
+ _, err := msgServer.ExecLegacyContent(sdk.WrapSDKContext(ctx), v1.NewMsgExecLegacyContent(contentMsg.Content, govAuthority))
+ require.NoError(t, err)
// then
for i := range spec.srcCodeIDs {
@@ -831,7 +742,7 @@ func TestPinCodesProposal(t *testing.T) {
func TestUnpinCodesProposal(t *testing.T) {
ctx, keepers := CreateTestInput(t, false, "staking")
- govKeeper, wasmKeeper := keepers.GovKeeper, keepers.WasmKeeper
+ wasmKeeper := keepers.WasmKeeper
mock := wasmtesting.MockWasmer{
CreateFn: wasmtesting.NoOpCreateFn,
@@ -889,14 +800,17 @@ func TestUnpinCodesProposal(t *testing.T) {
gotUnpinnedChecksums = nil
ctx, _ := parentCtx.CacheContext()
mock.UnpinFn = spec.mockFn
- proposal := types.UnpinCodesProposal{
+ proposal := &types.UnpinCodesProposal{
Title: "Foo",
Description: "Bar",
CodeIDs: spec.srcCodeIDs,
}
- // when stored
- storedProposal, gotErr := govKeeper.SubmitProposal(ctx, &proposal)
+ govAuthority := keepers.AccountKeeper.GetModuleAddress(govtypes.ModuleName).String()
+ msgServer := govkeeper.NewMsgServerImpl(keepers.GovKeeper)
+
+ // when
+ contentMsg, gotErr := submitLegacyProposal(t, ctx, proposal, RandomBech32AccountAddress(t), govAuthority, msgServer)
if spec.expErr {
require.Error(t, gotErr)
return
@@ -904,9 +818,8 @@ func TestUnpinCodesProposal(t *testing.T) {
require.NoError(t, gotErr)
// and proposal execute
- handler := govKeeper.Router().GetRoute(storedProposal.ProposalRoute())
- gotErr = handler(ctx, storedProposal.GetContent())
- require.NoError(t, gotErr)
+ _, err := msgServer.ExecLegacyContent(sdk.WrapSDKContext(ctx), v1.NewMsgExecLegacyContent(contentMsg.Content, govAuthority))
+ require.NoError(t, err)
// then
for i := range spec.srcCodeIDs {
@@ -919,7 +832,7 @@ func TestUnpinCodesProposal(t *testing.T) {
func TestUpdateInstantiateConfigProposal(t *testing.T) {
ctx, keepers := CreateTestInput(t, false, "staking")
- govKeeper, wasmKeeper := keepers.GovKeeper, keepers.WasmKeeper
+ wasmKeeper := keepers.WasmKeeper
mock := wasmtesting.MockWasmer{
CreateFn: wasmtesting.NoOpCreateFn,
@@ -983,14 +896,16 @@ func TestUpdateInstantiateConfigProposal(t *testing.T) {
})
}
- proposal := types.UpdateInstantiateConfigProposal{
+ govAuthority := keepers.AccountKeeper.GetModuleAddress(govtypes.ModuleName).String()
+ msgServer := govkeeper.NewMsgServerImpl(keepers.GovKeeper)
+ proposal := &types.UpdateInstantiateConfigProposal{
Title: "Foo",
Description: "Bar",
AccessConfigUpdates: updates,
}
- // when stored
- storedProposal, gotErr := govKeeper.SubmitProposal(ctx, &proposal)
+ // when
+ contentMsg, gotErr := submitLegacyProposal(t, ctx, proposal, RandomBech32AccountAddress(t), govAuthority, msgServer)
if spec.expErr {
require.Error(t, gotErr)
return
@@ -998,9 +913,8 @@ func TestUpdateInstantiateConfigProposal(t *testing.T) {
require.NoError(t, gotErr)
// and proposal execute
- handler := govKeeper.Router().GetRoute(storedProposal.ProposalRoute())
- gotErr = handler(ctx, storedProposal.GetContent())
- require.NoError(t, gotErr)
+ _, err := msgServer.ExecLegacyContent(sdk.WrapSDKContext(ctx), v1.NewMsgExecLegacyContent(contentMsg.Content, govAuthority))
+ require.NoError(t, err)
// then
for i := range spec.accessConfigUpdates {
diff --git a/x/wasm/keeper/querier.go b/x/wasm/keeper/querier.go
index cd573ab5a3..6ceed97b64 100644
--- a/x/wasm/keeper/querier.go
+++ b/x/wasm/keeper/querier.go
@@ -5,33 +5,34 @@ import (
"encoding/binary"
"runtime/debug"
+ errorsmod "cosmossdk.io/errors"
"github.com/cosmos/cosmos-sdk/codec"
- "google.golang.org/grpc/codes"
- "google.golang.org/grpc/status"
-
"github.com/cosmos/cosmos-sdk/store/prefix"
+ 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/types/query"
+ "google.golang.org/grpc/codes"
+ "google.golang.org/grpc/status"
"github.com/CosmWasm/wasmd/x/wasm/types"
)
-var _ types.QueryServer = &grpcQuerier{}
+var _ types.QueryServer = &GrpcQuerier{}
-type grpcQuerier struct {
+type GrpcQuerier struct {
cdc codec.Codec
- storeKey sdk.StoreKey
+ storeKey storetypes.StoreKey
keeper types.ViewKeeper
queryGasLimit sdk.Gas
}
// NewGrpcQuerier constructor
-func NewGrpcQuerier(cdc codec.Codec, storeKey sdk.StoreKey, keeper types.ViewKeeper, queryGasLimit sdk.Gas) *grpcQuerier { //nolint:revive
- return &grpcQuerier{cdc: cdc, storeKey: storeKey, keeper: keeper, queryGasLimit: queryGasLimit}
+func NewGrpcQuerier(cdc codec.Codec, storeKey storetypes.StoreKey, keeper types.ViewKeeper, queryGasLimit sdk.Gas) *GrpcQuerier {
+ return &GrpcQuerier{cdc: cdc, storeKey: storeKey, keeper: keeper, queryGasLimit: queryGasLimit}
}
-func (q grpcQuerier) ContractInfo(c context.Context, req *types.QueryContractInfoRequest) (*types.QueryContractInfoResponse, error) {
+func (q GrpcQuerier) ContractInfo(c context.Context, req *types.QueryContractInfoRequest) (*types.QueryContractInfoResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "empty request")
}
@@ -49,7 +50,7 @@ func (q grpcQuerier) ContractInfo(c context.Context, req *types.QueryContractInf
return rsp, nil
}
-func (q grpcQuerier) ContractHistory(c context.Context, req *types.QueryContractHistoryRequest) (*types.QueryContractHistoryResponse, error) {
+func (q GrpcQuerier) ContractHistory(c context.Context, req *types.QueryContractHistoryRequest) (*types.QueryContractHistoryResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "empty request")
}
@@ -82,12 +83,12 @@ func (q grpcQuerier) ContractHistory(c context.Context, req *types.QueryContract
}
// ContractsByCode lists all smart contracts for a code id
-func (q grpcQuerier) ContractsByCode(c context.Context, req *types.QueryContractsByCodeRequest) (*types.QueryContractsByCodeResponse, error) {
+func (q GrpcQuerier) ContractsByCode(c context.Context, req *types.QueryContractsByCodeRequest) (*types.QueryContractsByCodeResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "empty request")
}
if req.CodeId == 0 {
- return nil, sdkerrors.Wrap(types.ErrInvalid, "code id")
+ return nil, errorsmod.Wrap(types.ErrInvalid, "code id")
}
ctx := sdk.UnwrapSDKContext(c)
r := make([]string, 0)
@@ -109,7 +110,7 @@ func (q grpcQuerier) ContractsByCode(c context.Context, req *types.QueryContract
}, nil
}
-func (q grpcQuerier) AllContractState(c context.Context, req *types.QueryAllContractStateRequest) (*types.QueryAllContractStateResponse, error) {
+func (q GrpcQuerier) AllContractState(c context.Context, req *types.QueryAllContractStateRequest) (*types.QueryAllContractStateResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "empty request")
}
@@ -142,7 +143,7 @@ func (q grpcQuerier) AllContractState(c context.Context, req *types.QueryAllCont
}, nil
}
-func (q grpcQuerier) RawContractState(c context.Context, req *types.QueryRawContractStateRequest) (*types.QueryRawContractStateResponse, error) {
+func (q GrpcQuerier) RawContractState(c context.Context, req *types.QueryRawContractStateRequest) (*types.QueryRawContractStateResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "empty request")
}
@@ -160,7 +161,7 @@ func (q grpcQuerier) RawContractState(c context.Context, req *types.QueryRawCont
return &types.QueryRawContractStateResponse{Data: rsp}, nil
}
-func (q grpcQuerier) SmartContractState(c context.Context, req *types.QuerySmartContractStateRequest) (rsp *types.QuerySmartContractStateResponse, err error) {
+func (q GrpcQuerier) SmartContractState(c context.Context, req *types.QuerySmartContractStateRequest) (rsp *types.QuerySmartContractStateResponse, err error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "empty request")
}
@@ -177,7 +178,7 @@ func (q grpcQuerier) SmartContractState(c context.Context, req *types.QuerySmart
if r := recover(); r != nil {
switch rType := r.(type) {
case sdk.ErrorOutOfGas:
- err = sdkerrors.Wrapf(sdkerrors.ErrOutOfGas,
+ err = errorsmod.Wrapf(sdkerrors.ErrOutOfGas,
"out of gas in location: %v; gasWanted: %d, gasUsed: %d",
rType.Descriptor, ctx.GasMeter().Limit(), ctx.GasMeter().GasConsumed(),
)
@@ -203,12 +204,12 @@ func (q grpcQuerier) SmartContractState(c context.Context, req *types.QuerySmart
return &types.QuerySmartContractStateResponse{Data: bz}, nil
}
-func (q grpcQuerier) Code(c context.Context, req *types.QueryCodeRequest) (*types.QueryCodeResponse, error) {
+func (q GrpcQuerier) Code(c context.Context, req *types.QueryCodeRequest) (*types.QueryCodeResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "empty request")
}
if req.CodeId == 0 {
- return nil, sdkerrors.Wrap(types.ErrInvalid, "code id")
+ return nil, errorsmod.Wrap(types.ErrInvalid, "code id")
}
rsp, err := queryCode(sdk.UnwrapSDKContext(c), req.CodeId, q.keeper)
switch {
@@ -223,7 +224,7 @@ func (q grpcQuerier) Code(c context.Context, req *types.QueryCodeRequest) (*type
}, nil
}
-func (q grpcQuerier) Codes(c context.Context, req *types.QueryCodesRequest) (*types.QueryCodesResponse, error) {
+func (q GrpcQuerier) Codes(c context.Context, req *types.QueryCodesRequest) (*types.QueryCodesResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "empty request")
}
@@ -280,13 +281,13 @@ func queryCode(ctx sdk.Context, codeID uint64, keeper types.ViewKeeper) (*types.
code, err := keeper.GetByteCode(ctx, codeID)
if err != nil {
- return nil, sdkerrors.Wrap(err, "loading wasm code")
+ return nil, errorsmod.Wrap(err, "loading wasm code")
}
return &types.QueryCodeResponse{CodeInfoResponse: &info, Data: code}, nil
}
-func (q grpcQuerier) PinnedCodes(c context.Context, req *types.QueryPinnedCodesRequest) (*types.QueryPinnedCodesResponse, error) {
+func (q GrpcQuerier) PinnedCodes(c context.Context, req *types.QueryPinnedCodesRequest) (*types.QueryPinnedCodesResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "empty request")
}
@@ -310,13 +311,13 @@ func (q grpcQuerier) PinnedCodes(c context.Context, req *types.QueryPinnedCodesR
}
// Params returns params of the module.
-func (q grpcQuerier) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) {
+func (q GrpcQuerier) Params(c context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error) {
ctx := sdk.UnwrapSDKContext(c)
params := q.keeper.GetParams(ctx)
return &types.QueryParamsResponse{Params: params}, nil
}
-func (q grpcQuerier) ContractsByCreator(c context.Context, req *types.QueryContractsByCreatorRequest) (*types.QueryContractsByCreatorResponse, error) {
+func (q GrpcQuerier) ContractsByCreator(c context.Context, req *types.QueryContractsByCreatorRequest) (*types.QueryContractsByCreatorResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "empty request")
}
diff --git a/x/wasm/keeper/querier_test.go b/x/wasm/keeper/querier_test.go
index 9568ad97d5..788f4b402d 100644
--- a/x/wasm/keeper/querier_test.go
+++ b/x/wasm/keeper/querier_test.go
@@ -9,18 +9,18 @@ import (
"testing"
"time"
- "google.golang.org/grpc/codes"
- "google.golang.org/grpc/status"
-
+ errorsmod "cosmossdk.io/errors"
wasmvm "github.com/CosmWasm/wasmvm"
wasmvmtypes "github.com/CosmWasm/wasmvm/types"
+ "github.com/cometbft/cometbft/libs/log"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkErrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/types/query"
- govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
+ govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
- "github.com/tendermint/tendermint/libs/log"
+ "google.golang.org/grpc/codes"
+ "google.golang.org/grpc/status"
"github.com/CosmWasm/wasmd/x/wasm/keeper/wasmtesting"
"github.com/CosmWasm/wasmd/x/wasm/types"
@@ -43,7 +43,7 @@ func TestQueryAllContractState(t *testing.T) {
srcQuery *types.QueryAllContractStateRequest
expModelContains []types.Model
expModelContainsNot []types.Model
- expErr *sdkErrors.Error
+ expErr *errorsmod.Error
}{
"query all": {
srcQuery: &types.QueryAllContractStateRequest{Address: contractAddr.String()},
@@ -168,7 +168,7 @@ func TestQuerySmartContractPanics(t *testing.T) {
specs := map[string]struct {
doInContract func()
- expErr *sdkErrors.Error
+ expErr *errorsmod.Error
}{
"out of gas": {
doInContract: func() {
@@ -217,7 +217,7 @@ func TestQueryRawContractState(t *testing.T) {
specs := map[string]struct {
srcQuery *types.QueryRawContractStateRequest
expData []byte
- expErr *sdkErrors.Error
+ expErr *errorsmod.Error
}{
"query raw key": {
srcQuery: &types.QueryRawContractStateRequest{Address: contractAddr, QueryData: []byte("foo")},
@@ -271,7 +271,7 @@ func TestQueryContractListByCodeOrdering(t *testing.T) {
codeID, _, err := keepers.ContractKeeper.Create(ctx, creator, wasmCode, nil)
require.NoError(t, err)
- _, _, bob := keyPubAddr()
+ _, bob := keyPubAddr()
initMsg := HackatomExampleInitMsg{
Verifier: anyAddr,
Beneficiary: bob,
@@ -543,18 +543,19 @@ func TestQueryContractInfo(t *testing.T) {
// register an example extension. must be protobuf
keepers.EncodingConfig.InterfaceRegistry.RegisterImplementations(
(*types.ContractInfoExtension)(nil),
- &govtypes.Proposal{},
+ &govv1beta1.Proposal{},
)
- govtypes.RegisterInterfaces(keepers.EncodingConfig.InterfaceRegistry)
+ govv1beta1.RegisterInterfaces(keepers.EncodingConfig.InterfaceRegistry)
k := keepers.WasmKeeper
querier := NewGrpcQuerier(k.cdc, k.storeKey, k, k.queryGasLimit)
myExtension := func(info *types.ContractInfo) {
// abuse gov proposal as a random protobuf extension with an Any type
- myExt, err := govtypes.NewProposal(&govtypes.TextProposal{Title: "foo", Description: "bar"}, 1, anyDate, anyDate)
+ myExt, err := govv1beta1.NewProposal(&govv1beta1.TextProposal{Title: "foo", Description: "bar"}, 1, anyDate, anyDate)
require.NoError(t, err)
myExt.TotalDeposit = nil
- info.SetExtension(&myExt)
+ err = info.SetExtension(&myExt)
+ require.NoError(t, err)
}
specs := map[string]struct {
src *types.QueryContractInfoRequest
@@ -613,7 +614,7 @@ func TestQueryPinnedCodes(t *testing.T) {
specs := map[string]struct {
srcQuery *types.QueryPinnedCodesRequest
expCodeIDs []uint64
- expErr *sdkErrors.Error
+ expErr *errorsmod.Error
}{
"query all": {
srcQuery: &types.QueryPinnedCodesRequest{},
@@ -672,10 +673,11 @@ func TestQueryParams(t *testing.T) {
require.Equal(t, paramsResponse.Params.CodeUploadAccess, defaultParams.CodeUploadAccess)
require.Equal(t, paramsResponse.Params.InstantiateDefaultPermission, defaultParams.InstantiateDefaultPermission)
- keeper.SetParams(ctx, types.Params{
+ err = keeper.SetParams(ctx, types.Params{
CodeUploadAccess: types.AllowNobody,
InstantiateDefaultPermission: types.AccessTypeNobody,
})
+ require.NoError(t, err)
paramsResponse, err = q.Params(sdk.WrapSDKContext(ctx), &types.QueryParamsRequest{})
require.NoError(t, err)
@@ -695,19 +697,19 @@ func TestQueryCodeInfo(t *testing.T) {
anyAddress, err := sdk.AccAddressFromBech32("cosmos100dejzacpanrldpjjwksjm62shqhyss44jf5xz")
require.NoError(t, err)
specs := map[string]struct {
- codeId uint64
+ codeID uint64
accessConfig types.AccessConfig
}{
"everybody": {
- codeId: 1,
+ codeID: 1,
accessConfig: types.AllowEverybody,
},
"nobody": {
- codeId: 10,
+ codeID: 10,
accessConfig: types.AllowNobody,
},
"with_address": {
- codeId: 20,
+ codeID: 20,
accessConfig: types.AccessTypeOnlyAddress.With(anyAddress),
},
}
@@ -715,19 +717,19 @@ func TestQueryCodeInfo(t *testing.T) {
t.Run(msg, func(t *testing.T) {
codeInfo := types.CodeInfoFixture(types.WithSHA256CodeHash(wasmCode))
codeInfo.InstantiateConfig = spec.accessConfig
- require.NoError(t, keeper.importCode(ctx, spec.codeId,
+ require.NoError(t, keeper.importCode(ctx, spec.codeID,
codeInfo,
wasmCode),
)
q := Querier(keeper)
got, err := q.Code(sdk.WrapSDKContext(ctx), &types.QueryCodeRequest{
- CodeId: spec.codeId,
+ CodeId: spec.codeID,
})
require.NoError(t, err)
expectedResponse := &types.QueryCodeResponse{
CodeInfoResponse: &types.CodeInfoResponse{
- CodeID: spec.codeId,
+ CodeID: spec.codeID,
Creator: codeInfo.Creator,
DataHash: codeInfo.CodeHash,
InstantiatePermission: spec.accessConfig,
@@ -757,22 +759,22 @@ func TestQueryCodeInfoList(t *testing.T) {
codes := []struct {
name string
- codeId uint64
+ codeID uint64
codeInfo types.CodeInfo
}{
{
name: "everybody",
- codeId: 1,
+ codeID: 1,
codeInfo: codeInfoWithConfig(types.AllowEverybody),
},
{
- codeId: 10,
+ codeID: 10,
name: "nobody",
codeInfo: codeInfoWithConfig(types.AllowNobody),
},
{
name: "with_address",
- codeId: 20,
+ codeID: 20,
codeInfo: codeInfoWithConfig(types.AccessTypeOnlyAddress.With(anyAddress)),
},
}
@@ -780,14 +782,14 @@ func TestQueryCodeInfoList(t *testing.T) {
allCodesResponse := make([]types.CodeInfoResponse, 0)
for _, code := range codes {
t.Run(fmt.Sprintf("import_%s", code.name), func(t *testing.T) {
- require.NoError(t, keeper.importCode(ctx, code.codeId,
+ require.NoError(t, keeper.importCode(ctx, code.codeID,
code.codeInfo,
wasmCode),
)
})
allCodesResponse = append(allCodesResponse, types.CodeInfoResponse{
- CodeID: code.codeId,
+ CodeID: code.codeID,
Creator: code.codeInfo.Creator,
DataHash: code.codeInfo.CodeHash,
InstantiatePermission: code.codeInfo.InstantiateConfig,
@@ -818,7 +820,7 @@ func TestQueryContractsByCreatorList(t *testing.T) {
codeID, _, err := keepers.ContractKeeper.Create(ctx, creator, wasmCode, nil)
require.NoError(t, err)
- _, _, bob := keyPubAddr()
+ _, bob := keyPubAddr()
initMsg := HackatomExampleInitMsg{
Verifier: anyAddr,
Beneficiary: bob,
diff --git a/x/wasm/keeper/query_plugins.go b/x/wasm/keeper/query_plugins.go
index e6be4dde76..14ec284fe9 100644
--- a/x/wasm/keeper/query_plugins.go
+++ b/x/wasm/keeper/query_plugins.go
@@ -5,19 +5,18 @@ import (
"errors"
"fmt"
+ errorsmod "cosmossdk.io/errors"
+ wasmvmtypes "github.com/CosmWasm/wasmvm/types"
+ abci "github.com/cometbft/cometbft/abci/types"
"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/codec"
- abci "github.com/tendermint/tendermint/abci/types"
-
- channeltypes "github.com/cosmos/ibc-go/v4/modules/core/04-channel/types"
-
- "github.com/CosmWasm/wasmd/x/wasm/types"
-
- wasmvmtypes "github.com/CosmWasm/wasmvm/types"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
distributiontypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
+ channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types"
+
+ "github.com/CosmWasm/wasmd/x/wasm/types"
)
type QueryHandler struct {
@@ -170,7 +169,7 @@ func BankQuerier(bankKeeper types.BankViewKeeper) func(ctx sdk.Context, request
if request.AllBalances != nil {
addr, err := sdk.AccAddressFromBech32(request.AllBalances.Address)
if err != nil {
- return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, request.AllBalances.Address)
+ return nil, errorsmod.Wrap(sdkerrors.ErrInvalidAddress, request.AllBalances.Address)
}
coins := bankKeeper.GetAllBalances(ctx, addr)
res := wasmvmtypes.AllBalancesResponse{
@@ -181,7 +180,7 @@ func BankQuerier(bankKeeper types.BankViewKeeper) func(ctx sdk.Context, request
if request.Balance != nil {
addr, err := sdk.AccAddressFromBech32(request.Balance.Address)
if err != nil {
- return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, request.Balance.Address)
+ return nil, errorsmod.Wrap(sdkerrors.ErrInvalidAddress, request.Balance.Address)
}
coin := bankKeeper.GetBalance(ctx, addr, request.Balance.Denom)
res := wasmvmtypes.BalanceResponse{
@@ -371,7 +370,7 @@ func StakingQuerier(keeper types.StakingKeeper, distKeeper types.DistributionKee
if request.AllDelegations != nil {
delegator, err := sdk.AccAddressFromBech32(request.AllDelegations.Delegator)
if err != nil {
- return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, request.AllDelegations.Delegator)
+ return nil, errorsmod.Wrap(sdkerrors.ErrInvalidAddress, request.AllDelegations.Delegator)
}
sdkDels := keeper.GetAllDelegatorDelegations(ctx, delegator)
delegations, err := sdkToDelegations(ctx, keeper, sdkDels)
@@ -386,11 +385,11 @@ func StakingQuerier(keeper types.StakingKeeper, distKeeper types.DistributionKee
if request.Delegation != nil {
delegator, err := sdk.AccAddressFromBech32(request.Delegation.Delegator)
if err != nil {
- return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, request.Delegation.Delegator)
+ return nil, errorsmod.Wrap(sdkerrors.ErrInvalidAddress, request.Delegation.Delegator)
}
validator, err := sdk.ValAddressFromBech32(request.Delegation.Validator)
if err != nil {
- return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, request.Delegation.Validator)
+ return nil, errorsmod.Wrap(sdkerrors.ErrInvalidAddress, request.Delegation.Validator)
}
var res wasmvmtypes.DelegationResponse
@@ -414,18 +413,18 @@ func sdkToDelegations(ctx sdk.Context, keeper types.StakingKeeper, delegations [
for i, d := range delegations {
delAddr, err := sdk.AccAddressFromBech32(d.DelegatorAddress)
if err != nil {
- return nil, sdkerrors.Wrap(err, "delegator address")
+ return nil, errorsmod.Wrap(err, "delegator address")
}
valAddr, err := sdk.ValAddressFromBech32(d.ValidatorAddress)
if err != nil {
- return nil, sdkerrors.Wrap(err, "validator address")
+ return nil, errorsmod.Wrap(err, "validator address")
}
// shares to amount logic comes from here:
// https://github.com/cosmos/cosmos-sdk/blob/v0.38.3/x/staking/keeper/querier.go#L404
val, found := keeper.GetValidator(ctx, valAddr)
if !found {
- return nil, sdkerrors.Wrap(stakingtypes.ErrNoValidatorFound, "can't load validator for delegation")
+ return nil, errorsmod.Wrap(stakingtypes.ErrNoValidatorFound, "can't load validator for delegation")
}
amount := sdk.NewCoin(bondDenom, val.TokensFromShares(d.Shares).TruncateInt())
@@ -441,15 +440,15 @@ func sdkToDelegations(ctx sdk.Context, keeper types.StakingKeeper, delegations [
func sdkToFullDelegation(ctx sdk.Context, keeper types.StakingKeeper, distKeeper types.DistributionKeeper, delegation stakingtypes.Delegation) (*wasmvmtypes.FullDelegation, error) {
delAddr, err := sdk.AccAddressFromBech32(delegation.DelegatorAddress)
if err != nil {
- return nil, sdkerrors.Wrap(err, "delegator address")
+ return nil, errorsmod.Wrap(err, "delegator address")
}
valAddr, err := sdk.ValAddressFromBech32(delegation.ValidatorAddress)
if err != nil {
- return nil, sdkerrors.Wrap(err, "validator address")
+ return nil, errorsmod.Wrap(err, "validator address")
}
val, found := keeper.GetValidator(ctx, valAddr)
if !found {
- return nil, sdkerrors.Wrap(stakingtypes.ErrNoValidatorFound, "can't load validator for delegation")
+ return nil, errorsmod.Wrap(stakingtypes.ErrNoValidatorFound, "can't load validator for delegation")
}
bondDenom := keeper.BondDenom(ctx)
amount := sdk.NewCoin(bondDenom, val.TokensFromShares(delegation.Shares).TruncateInt())
@@ -515,24 +514,24 @@ func WasmQuerier(k wasmQueryKeeper) func(ctx sdk.Context, request *wasmvmtypes.W
case request.Smart != nil:
addr, err := sdk.AccAddressFromBech32(request.Smart.ContractAddr)
if err != nil {
- return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, request.Smart.ContractAddr)
+ return nil, errorsmod.Wrap(sdkerrors.ErrInvalidAddress, request.Smart.ContractAddr)
}
msg := types.RawContractMessage(request.Smart.Msg)
if err := msg.ValidateBasic(); err != nil {
- return nil, sdkerrors.Wrap(err, "json msg")
+ return nil, errorsmod.Wrap(err, "json msg")
}
return k.QuerySmart(ctx, addr, msg)
case request.Raw != nil:
addr, err := sdk.AccAddressFromBech32(request.Raw.ContractAddr)
if err != nil {
- return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, request.Raw.ContractAddr)
+ return nil, errorsmod.Wrap(sdkerrors.ErrInvalidAddress, request.Raw.ContractAddr)
}
return k.QueryRaw(ctx, addr, request.Raw.Key), nil
case request.ContractInfo != nil:
contractAddr := request.ContractInfo.ContractAddr
addr, err := sdk.AccAddressFromBech32(contractAddr)
if err != nil {
- return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, contractAddr)
+ return nil, errorsmod.Wrap(sdkerrors.ErrInvalidAddress, contractAddr)
}
info := k.GetContractInfo(ctx, addr)
if info == nil {
@@ -592,12 +591,12 @@ func ConvertProtoToJSONMarshal(cdc codec.Codec, protoResponse codec.ProtoMarshal
// unmarshal binary into stargate response data structure
err := cdc.Unmarshal(bz, protoResponse)
if err != nil {
- return nil, sdkerrors.Wrap(err, "to proto")
+ return nil, errorsmod.Wrap(err, "to proto")
}
bz, err = cdc.MarshalJSON(protoResponse)
if err != nil {
- return nil, sdkerrors.Wrap(err, "to json")
+ return nil, errorsmod.Wrap(err, "to json")
}
protoResponse.Reset()
diff --git a/x/wasm/keeper/query_plugins_test.go b/x/wasm/keeper/query_plugins_test.go
index fb5f6951e0..f70ba587d8 100644
--- a/x/wasm/keeper/query_plugins_test.go
+++ b/x/wasm/keeper/query_plugins_test.go
@@ -7,23 +7,23 @@ import (
"testing"
"time"
+ errorsmod "cosmossdk.io/errors"
wasmvmtypes "github.com/CosmWasm/wasmvm/types"
+ dbm "github.com/cometbft/cometbft-db"
+ tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/crypto/keys/ed25519"
"github.com/cosmos/cosmos-sdk/store"
sdk "github.com/cosmos/cosmos-sdk/types"
- sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/types/query"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
- channeltypes "github.com/cosmos/ibc-go/v4/modules/core/04-channel/types"
- "github.com/gogo/protobuf/proto"
+ "github.com/cosmos/gogoproto/proto"
+ channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
- tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
- dbm "github.com/tendermint/tm-db"
"github.com/CosmWasm/wasmd/app"
"github.com/CosmWasm/wasmd/x/wasm/keeper"
@@ -89,8 +89,8 @@ func TestIBCQuerier(t *testing.T) {
srcQuery *wasmvmtypes.IBCQuery
wasmKeeper *mockWasmQueryKeeper
channelKeeper *wasmtesting.MockChannelKeeper
- expJsonResult string
- expErr *sdkerrors.Error
+ expJSONResult string
+ expErr *errorsmod.Error
}{
"query port id": {
srcQuery: &wasmvmtypes.IBCQuery{
@@ -102,7 +102,7 @@ func TestIBCQuerier(t *testing.T) {
},
},
channelKeeper: &wasmtesting.MockChannelKeeper{},
- expJsonResult: `{"port_id":"myIBCPortID"}`,
+ expJSONResult: `{"port_id":"myIBCPortID"}`,
},
"query list channels - all": {
srcQuery: &wasmvmtypes.IBCQuery{
@@ -111,7 +111,7 @@ func TestIBCQuerier(t *testing.T) {
channelKeeper: &wasmtesting.MockChannelKeeper{
IterateChannelsFn: wasmtesting.MockChannelKeeperIterator(myExampleChannels),
},
- expJsonResult: `{
+ expJSONResult: `{
"channels": [
{
"endpoint": {
@@ -151,7 +151,7 @@ func TestIBCQuerier(t *testing.T) {
channelKeeper: &wasmtesting.MockChannelKeeper{
IterateChannelsFn: wasmtesting.MockChannelKeeperIterator(myExampleChannels),
},
- expJsonResult: `{
+ expJSONResult: `{
"channels": [
{
"endpoint": {
@@ -178,7 +178,7 @@ func TestIBCQuerier(t *testing.T) {
channelKeeper: &wasmtesting.MockChannelKeeper{
IterateChannelsFn: wasmtesting.MockChannelKeeperIterator(myExampleChannels),
},
- expJsonResult: `{"channels": []}`,
+ expJSONResult: `{"channels": []}`,
},
"query channel": {
srcQuery: &wasmvmtypes.IBCQuery{
@@ -201,7 +201,7 @@ func TestIBCQuerier(t *testing.T) {
}, true
},
},
- expJsonResult: `{
+ expJSONResult: `{
"channel": {
"endpoint": {
"port_id": "myQueryPortID",
@@ -242,7 +242,7 @@ func TestIBCQuerier(t *testing.T) {
}, true
},
},
- expJsonResult: `{
+ expJSONResult: `{
"channel": {
"endpoint": {
"port_id": "myLoadedPortID",
@@ -278,7 +278,7 @@ func TestIBCQuerier(t *testing.T) {
}, true
},
},
- expJsonResult: "{}",
+ expJSONResult: "{}",
},
"query channel in closed state": {
srcQuery: &wasmvmtypes.IBCQuery{
@@ -301,7 +301,7 @@ func TestIBCQuerier(t *testing.T) {
}, true
},
},
- expJsonResult: "{}",
+ expJSONResult: "{}",
},
"query channel - empty result": {
srcQuery: &wasmvmtypes.IBCQuery{
@@ -315,7 +315,7 @@ func TestIBCQuerier(t *testing.T) {
return channeltypes.Channel{}, false
},
},
- expJsonResult: "{}",
+ expJSONResult: "{}",
},
}
for name, spec := range specs {
@@ -326,7 +326,7 @@ func TestIBCQuerier(t *testing.T) {
if spec.expErr != nil {
return
}
- assert.JSONEq(t, spec.expJsonResult, string(gotResult), string(gotResult))
+ assert.JSONEq(t, spec.expJSONResult, string(gotResult), string(gotResult))
})
}
}
@@ -538,7 +538,7 @@ func TestQueryErrors(t *testing.T) {
expErr: wasmvmtypes.NoSuchContract{Addr: "contract-addr"},
},
"no such contract - wrapped": {
- src: sdkerrors.Wrap(types.ErrNoSuchContractFn("contract-addr"), "my additional data"),
+ src: errorsmod.Wrap(types.ErrNoSuchContractFn("contract-addr"), "my additional data"),
expErr: wasmvmtypes.NoSuchContract{Addr: "contract-addr"},
},
"no such code": {
@@ -546,7 +546,7 @@ func TestQueryErrors(t *testing.T) {
expErr: wasmvmtypes.NoSuchCode{CodeID: 123},
},
"no such code - wrapped": {
- src: sdkerrors.Wrap(types.ErrNoSuchCodeFn(123), "my additional data"),
+ src: errorsmod.Wrap(types.ErrNoSuchCodeFn(123), "my additional data"),
expErr: wasmvmtypes.NoSuchCode{CodeID: 123},
},
}
@@ -566,9 +566,10 @@ func TestQueryErrors(t *testing.T) {
func TestAcceptListStargateQuerier(t *testing.T) {
wasmApp := app.SetupWithEmptyStore(t)
ctx := wasmApp.NewUncachedContext(false, tmproto.Header{ChainID: "foo", Height: 1, Time: time.Now()})
- wasmApp.StakingKeeper.SetParams(ctx, stakingtypes.DefaultParams())
+ err := wasmApp.StakingKeeper.SetParams(ctx, stakingtypes.DefaultParams())
+ require.NoError(t, err)
- addrs := app.AddTestAddrs(wasmApp, ctx, 2, sdk.NewInt(1_000_000))
+ addrs := app.AddTestAddrsIncremental(wasmApp, ctx, 2, sdk.NewInt(1_000_000))
accepted := keeper.AcceptedStargateQueries{
"/cosmos.auth.v1beta1.Query/Account": &authtypes.QueryAccountResponse{},
"/no/route/to/this": &authtypes.QueryAccountResponse{},
diff --git a/x/wasm/keeper/recurse_test.go b/x/wasm/keeper/recurse_test.go
index 5bfb20bdec..d6f73cfa41 100644
--- a/x/wasm/keeper/recurse_test.go
+++ b/x/wasm/keeper/recurse_test.go
@@ -38,7 +38,7 @@ type recurseResponse struct {
// number os wasm queries called from a contract
var totalWasmQueryCounter int
-func initRecurseContract(t *testing.T) (contract sdk.AccAddress, creator sdk.AccAddress, ctx sdk.Context, keeper *Keeper) {
+func initRecurseContract(t *testing.T) (contract sdk.AccAddress, ctx sdk.Context, keeper *Keeper) {
countingQuerierDec := func(realWasmQuerier WasmVMQueryHandler) WasmVMQueryHandler {
return WasmVMQueryHandlerFn(func(ctx sdk.Context, caller sdk.AccAddress, request wasmvmtypes.QueryRequest) ([]byte, error) {
totalWasmQueryCounter++
@@ -48,7 +48,7 @@ func initRecurseContract(t *testing.T) (contract sdk.AccAddress, creator sdk.Acc
ctx, keepers := CreateTestInput(t, false, AvailableCapabilities, WithQueryHandlerDecorator(countingQuerierDec))
keeper = keepers.WasmKeeper
exampleContract := InstantiateHackatomExampleContract(t, ctx, keepers)
- return exampleContract.Contract, exampleContract.CreatorAddr, ctx, keeper
+ return exampleContract.Contract, ctx, keeper
}
func TestGasCostOnQuery(t *testing.T) {
@@ -103,7 +103,7 @@ func TestGasCostOnQuery(t *testing.T) {
},
}
- contractAddr, _, ctx, keeper := initRecurseContract(t)
+ contractAddr, ctx, keeper := initRecurseContract(t)
for name, tc := range cases {
t.Run(name, func(t *testing.T) {
@@ -179,7 +179,7 @@ func TestGasOnExternalQuery(t *testing.T) {
},
}
- contractAddr, _, ctx, keeper := initRecurseContract(t)
+ contractAddr, ctx, keeper := initRecurseContract(t)
for name, tc := range cases {
t.Run(name, func(t *testing.T) {
@@ -265,7 +265,7 @@ func TestLimitRecursiveQueryGas(t *testing.T) {
},
}
- contractAddr, _, ctx, keeper := initRecurseContract(t)
+ contractAddr, ctx, keeper := initRecurseContract(t)
for name, tc := range cases {
t.Run(name, func(t *testing.T) {
diff --git a/x/wasm/keeper/reflect_test.go b/x/wasm/keeper/reflect_test.go
index 0d61867a7b..d2e2ded65f 100644
--- a/x/wasm/keeper/reflect_test.go
+++ b/x/wasm/keeper/reflect_test.go
@@ -6,6 +6,7 @@ import (
"strings"
"testing"
+ errorsmod "cosmossdk.io/errors"
wasmvmtypes "github.com/CosmWasm/wasmvm/types"
"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
@@ -14,7 +15,7 @@ import (
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
- "github.com/golang/protobuf/proto"
+ "github.com/cosmos/gogoproto/proto"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
@@ -44,7 +45,7 @@ func TestReflectContractSend(t *testing.T) {
deposit := sdk.NewCoins(sdk.NewInt64Coin("denom", 100000))
creator := keepers.Faucet.NewFundedRandomAccount(ctx, deposit...)
- _, _, bob := keyPubAddr()
+ _, bob := keyPubAddr()
// upload reflect code
reflectID, _, err := keeper.Create(ctx, creator, testdata.ReflectContractWasm(), nil)
@@ -124,7 +125,7 @@ func TestReflectCustomMsg(t *testing.T) {
deposit := sdk.NewCoins(sdk.NewInt64Coin("denom", 100000))
creator := keepers.Faucet.NewFundedRandomAccount(ctx, deposit...)
bob := keepers.Faucet.NewFundedRandomAccount(ctx, deposit...)
- _, _, fred := keyPubAddr()
+ _, fred := keyPubAddr()
// upload code
codeID, _, err := keeper.Create(ctx, creator, testdata.ReflectContractWasm(), nil)
@@ -262,7 +263,7 @@ func TestReflectStargateQuery(t *testing.T) {
funds := sdk.NewCoins(sdk.NewInt64Coin("denom", 320000))
contractStart := sdk.NewCoins(sdk.NewInt64Coin("denom", 40000))
- expectedBalance := funds.Sub(contractStart)
+ expectedBalance := funds.Sub(contractStart...)
creator := keepers.Faucet.NewFundedRandomAccount(ctx, funds...)
// upload code
@@ -331,7 +332,7 @@ func TestReflectTotalSupplyQuery(t *testing.T) {
Chain: &testdata.ChainQuery{
Request: &wasmvmtypes.QueryRequest{
Bank: &wasmvmtypes.BankQuery{
- Supply: &wasmvmtypes.SupplyQuery{spec.denom},
+ Supply: &wasmvmtypes.SupplyQuery{Denom: spec.denom},
},
},
},
@@ -373,6 +374,8 @@ func TestReflectInvalidStargateQuery(t *testing.T) {
Address: creator.String(),
}
protoQueryBin, err := proto.Marshal(&protoQuery)
+ require.NoError(t, err)
+
protoRequest := wasmvmtypes.QueryRequest{
Stargate: &wasmvmtypes.StargateQuery{
Path: "/cosmos.bank.v1beta1.Query/AllBalances",
@@ -590,21 +593,21 @@ type reflectCustomMsg struct {
// toReflectRawMsg encodes an sdk msg using any type with json encoding.
// Then wraps it as an opaque message
func toReflectRawMsg(cdc codec.Codec, msg sdk.Msg) (wasmvmtypes.CosmosMsg, error) {
- any, err := codectypes.NewAnyWithValue(msg)
+ codecAny, err := codectypes.NewAnyWithValue(msg)
if err != nil {
return wasmvmtypes.CosmosMsg{}, err
}
- rawBz, err := cdc.MarshalJSON(any)
+ rawBz, err := cdc.MarshalJSON(codecAny)
if err != nil {
- return wasmvmtypes.CosmosMsg{}, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error())
+ return wasmvmtypes.CosmosMsg{}, errorsmod.Wrap(sdkerrors.ErrJSONMarshal, err.Error())
}
- customMsg, err := json.Marshal(reflectCustomMsg{
+ customMsg, _ := json.Marshal(reflectCustomMsg{
Raw: rawBz,
})
res := wasmvmtypes.CosmosMsg{
Custom: customMsg,
}
- return res, nil
+ return res, err
}
// reflectEncoders needs to be registered in test setup to handle custom message callbacks
@@ -621,23 +624,23 @@ func fromReflectRawMsg(cdc codec.Codec) CustomEncoder {
var custom reflectCustomMsg
err := json.Unmarshal(msg, &custom)
if err != nil {
- return nil, sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error())
+ return nil, errorsmod.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error())
}
if custom.Raw != nil {
- var any codectypes.Any
- if err := cdc.UnmarshalJSON(custom.Raw, &any); err != nil {
- return nil, sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error())
+ var codecAny codectypes.Any
+ if err := cdc.UnmarshalJSON(custom.Raw, &codecAny); err != nil {
+ return nil, errorsmod.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error())
}
var msg sdk.Msg
- if err := cdc.UnpackAny(&any, &msg); err != nil {
+ if err := cdc.UnpackAny(&codecAny, &msg); err != nil {
return nil, err
}
return []sdk.Msg{msg}, nil
}
if custom.Debug != "" {
- return nil, sdkerrors.Wrapf(types.ErrInvalidMsg, "Custom Debug: %s", custom.Debug)
+ return nil, errorsmod.Wrapf(types.ErrInvalidMsg, "Custom Debug: %s", custom.Debug)
}
- return nil, sdkerrors.Wrap(types.ErrInvalidMsg, "Unknown Custom message variant")
+ return nil, errorsmod.Wrap(types.ErrInvalidMsg, "Unknown Custom message variant")
}
}
@@ -651,19 +654,11 @@ type customQueryResponse struct {
Msg string `json:"msg"`
}
-// these are the return values from contract -> go depending on type of query
-type ownerResponse struct {
- Owner string `json:"owner"`
-}
-
+// this is from the contract to the go code (capitalized or ping)
type capitalizedResponse struct {
Text string `json:"text"`
}
-type chainResponse struct {
- Data []byte `json:"data"`
-}
-
// reflectPlugins needs to be registered in test setup to handle custom query callbacks
func reflectPlugins() *QueryPlugins {
return &QueryPlugins{
@@ -675,7 +670,7 @@ func performCustomQuery(_ sdk.Context, request json.RawMessage) ([]byte, error)
var custom reflectCustomQuery
err := json.Unmarshal(request, &custom)
if err != nil {
- return nil, sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error())
+ return nil, errorsmod.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error())
}
if custom.Capitalized != nil {
msg := strings.ToUpper(custom.Capitalized.Text)
@@ -684,5 +679,5 @@ func performCustomQuery(_ sdk.Context, request json.RawMessage) ([]byte, error)
if custom.Ping != nil {
return json.Marshal(customQueryResponse{Msg: "pong"})
}
- return nil, sdkerrors.Wrap(types.ErrInvalidMsg, "Unknown Custom query variant")
+ return nil, errorsmod.Wrap(types.ErrInvalidMsg, "Unknown Custom query variant")
}
diff --git a/x/wasm/keeper/relay.go b/x/wasm/keeper/relay.go
index 7c3f0b902c..1e4e215bdb 100644
--- a/x/wasm/keeper/relay.go
+++ b/x/wasm/keeper/relay.go
@@ -3,10 +3,10 @@ package keeper
import (
"time"
+ errorsmod "cosmossdk.io/errors"
wasmvmtypes "github.com/CosmWasm/wasmvm/types"
"github.com/cosmos/cosmos-sdk/telemetry"
sdk "github.com/cosmos/cosmos-sdk/types"
- sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/CosmWasm/wasmd/x/wasm/types"
)
@@ -36,7 +36,7 @@ func (k Keeper) OnOpenChannel(
res, gasUsed, execErr := k.wasmVM.IBCChannelOpen(codeInfo.CodeHash, env, msg, prefixStore, cosmwasmAPI, querier, ctx.GasMeter(), gas, costJSONDeserialization)
k.consumeRuntimeGas(ctx, gasUsed)
if execErr != nil {
- return "", sdkerrors.Wrap(types.ErrExecuteFailed, execErr.Error())
+ return "", errorsmod.Wrap(types.ErrExecuteFailed, execErr.Error())
}
if res != nil {
return res.Version, nil
@@ -69,7 +69,7 @@ func (k Keeper) OnConnectChannel(
res, gasUsed, execErr := k.wasmVM.IBCChannelConnect(codeInfo.CodeHash, env, msg, prefixStore, cosmwasmAPI, querier, ctx.GasMeter(), gas, costJSONDeserialization)
k.consumeRuntimeGas(ctx, gasUsed)
if execErr != nil {
- return sdkerrors.Wrap(types.ErrExecuteFailed, execErr.Error())
+ return errorsmod.Wrap(types.ErrExecuteFailed, execErr.Error())
}
return k.handleIBCBasicContractResponse(ctx, contractAddr, contractInfo.IBCPortID, res)
@@ -100,7 +100,7 @@ func (k Keeper) OnCloseChannel(
res, gasUsed, execErr := k.wasmVM.IBCChannelClose(codeInfo.CodeHash, params, msg, prefixStore, cosmwasmAPI, querier, ctx.GasMeter(), gas, costJSONDeserialization)
k.consumeRuntimeGas(ctx, gasUsed)
if execErr != nil {
- return sdkerrors.Wrap(types.ErrExecuteFailed, execErr.Error())
+ return errorsmod.Wrap(types.ErrExecuteFailed, execErr.Error())
}
return k.handleIBCBasicContractResponse(ctx, contractAddr, contractInfo.IBCPortID, res)
@@ -130,10 +130,10 @@ func (k Keeper) OnRecvPacket(
res, gasUsed, execErr := k.wasmVM.IBCPacketReceive(codeInfo.CodeHash, env, msg, prefixStore, cosmwasmAPI, querier, ctx.GasMeter(), gas, costJSONDeserialization)
k.consumeRuntimeGas(ctx, gasUsed)
if execErr != nil {
- return nil, sdkerrors.Wrap(types.ErrExecuteFailed, execErr.Error())
+ return nil, errorsmod.Wrap(types.ErrExecuteFailed, execErr.Error())
}
if res.Err != "" { // handle error case as before https://github.com/CosmWasm/wasmvm/commit/c300106fe5c9426a495f8e10821e00a9330c56c6
- return nil, sdkerrors.Wrap(types.ErrExecuteFailed, res.Err)
+ return nil, errorsmod.Wrap(types.ErrExecuteFailed, res.Err)
}
// note submessage reply results can overwrite the `Acknowledgement` data
return k.handleContractResponse(ctx, contractAddr, contractInfo.IBCPortID, res.Ok.Messages, res.Ok.Attributes, res.Ok.Acknowledgement, res.Ok.Events)
@@ -164,7 +164,7 @@ func (k Keeper) OnAckPacket(
res, gasUsed, execErr := k.wasmVM.IBCPacketAck(codeInfo.CodeHash, env, msg, prefixStore, cosmwasmAPI, querier, ctx.GasMeter(), gas, costJSONDeserialization)
k.consumeRuntimeGas(ctx, gasUsed)
if execErr != nil {
- return sdkerrors.Wrap(types.ErrExecuteFailed, execErr.Error())
+ return errorsmod.Wrap(types.ErrExecuteFailed, execErr.Error())
}
return k.handleIBCBasicContractResponse(ctx, contractAddr, contractInfo.IBCPortID, res)
}
@@ -191,7 +191,7 @@ func (k Keeper) OnTimeoutPacket(
res, gasUsed, execErr := k.wasmVM.IBCPacketTimeout(codeInfo.CodeHash, env, msg, prefixStore, cosmwasmAPI, querier, ctx.GasMeter(), gas, costJSONDeserialization)
k.consumeRuntimeGas(ctx, gasUsed)
if execErr != nil {
- return sdkerrors.Wrap(types.ErrExecuteFailed, execErr.Error())
+ return errorsmod.Wrap(types.ErrExecuteFailed, execErr.Error())
}
return k.handleIBCBasicContractResponse(ctx, contractAddr, contractInfo.IBCPortID, res)
diff --git a/x/wasm/keeper/snapshotter.go b/x/wasm/keeper/snapshotter.go
index fcece63714..4ac85b46fe 100644
--- a/x/wasm/keeper/snapshotter.go
+++ b/x/wasm/keeper/snapshotter.go
@@ -4,12 +4,11 @@ import (
"encoding/hex"
"io"
+ errorsmod "cosmossdk.io/errors"
+ "github.com/cometbft/cometbft/libs/log"
+ tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
snapshot "github.com/cosmos/cosmos-sdk/snapshots/types"
sdk "github.com/cosmos/cosmos-sdk/types"
- sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
- protoio "github.com/gogo/protobuf/io"
- "github.com/tendermint/tendermint/libs/log"
- tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
"github.com/CosmWasm/wasmd/x/wasm/ioutils"
"github.com/CosmWasm/wasmd/x/wasm/types"
@@ -45,7 +44,7 @@ func (ws *WasmSnapshotter) SupportedFormats() []uint32 {
return []uint32{SnapshotFormat}
}
-func (ws *WasmSnapshotter) Snapshot(height uint64, protoWriter protoio.Writer) error {
+func (ws *WasmSnapshotter) SnapshotExtension(height uint64, payloadWriter snapshot.ExtensionPayloadWriter) error {
cacheMS, err := ws.cms.CacheMultiStoreWithVersion(int64(height))
if err != nil {
return err
@@ -77,7 +76,7 @@ func (ws *WasmSnapshotter) Snapshot(height uint64, protoWriter protoio.Writer) e
return true
}
- err = snapshot.WriteExtensionItem(protoWriter, compressedWasm)
+ err = payloadWriter(compressedWasm)
if err != nil {
rerr = err
return true
@@ -89,28 +88,26 @@ func (ws *WasmSnapshotter) Snapshot(height uint64, protoWriter protoio.Writer) e
return rerr
}
-func (ws *WasmSnapshotter) Restore(
- height uint64, format uint32, protoReader protoio.Reader,
-) (snapshot.SnapshotItem, error) {
+func (ws *WasmSnapshotter) RestoreExtension(height uint64, format uint32, payloadReader snapshot.ExtensionPayloadReader) error {
if format == SnapshotFormat {
- return ws.processAllItems(height, protoReader, restoreV1, finalizeV1)
+ return ws.processAllItems(height, payloadReader, restoreV1, finalizeV1)
}
- return snapshot.SnapshotItem{}, snapshot.ErrUnknownFormat
+ return snapshot.ErrUnknownFormat
}
-func restoreV1(ctx sdk.Context, k *Keeper, compressedCode []byte) error {
+func restoreV1(_ sdk.Context, k *Keeper, compressedCode []byte) error {
if !ioutils.IsGzip(compressedCode) {
return types.ErrInvalid.Wrap("not a gzip")
}
wasmCode, err := ioutils.Uncompress(compressedCode, uint64(types.MaxWasmSize))
if err != nil {
- return sdkerrors.Wrap(types.ErrCreateFailed, err.Error())
+ return errorsmod.Wrap(types.ErrCreateFailed, err.Error())
}
// FIXME: check which codeIDs the checksum matches??
_, err = k.wasmVM.Create(wasmCode)
if err != nil {
- return sdkerrors.Wrap(types.ErrCreateFailed, err.Error())
+ return errorsmod.Wrap(types.ErrCreateFailed, err.Error())
}
return nil
}
@@ -122,35 +119,23 @@ func finalizeV1(ctx sdk.Context, k *Keeper) error {
func (ws *WasmSnapshotter) processAllItems(
height uint64,
- protoReader protoio.Reader,
+ payloadReader snapshot.ExtensionPayloadReader,
cb func(sdk.Context, *Keeper, []byte) error,
finalize func(sdk.Context, *Keeper) error,
-) (snapshot.SnapshotItem, error) {
+) error {
ctx := sdk.NewContext(ws.cms, tmproto.Header{Height: int64(height)}, false, log.NewNopLogger())
-
- // keep the last item here... if we break, it will either be empty (if we hit io.EOF)
- // or contain the last item (if we hit payload == nil)
- var item snapshot.SnapshotItem
for {
- item = snapshot.SnapshotItem{}
- err := protoReader.ReadMsg(&item)
+ payload, err := payloadReader()
if err == io.EOF {
break
} else if err != nil {
- return snapshot.SnapshotItem{}, sdkerrors.Wrap(err, "invalid protobuf message")
- }
-
- // if it is not another ExtensionPayload message, then it is not for us.
- // we should return it an let the manager handle this one
- payload := item.GetExtensionPayload()
- if payload == nil {
- break
+ return err
}
- if err := cb(ctx, ws.wasm, payload.Payload); err != nil {
- return snapshot.SnapshotItem{}, sdkerrors.Wrap(err, "processing snapshot item")
+ if err := cb(ctx, ws.wasm, payload); err != nil {
+ return errorsmod.Wrap(err, "processing snapshot item")
}
}
- return item, finalize(ctx, ws.wasm)
+ return finalize(ctx, ws.wasm)
}
diff --git a/x/wasm/keeper/snapshotter_integration_test.go b/x/wasm/keeper/snapshotter_integration_test.go
index 432d56c79d..2e4fe6c2a1 100644
--- a/x/wasm/keeper/snapshotter_integration_test.go
+++ b/x/wasm/keeper/snapshotter_integration_test.go
@@ -10,14 +10,14 @@ import (
"github.com/stretchr/testify/assert"
+ tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
+ tmtypes "github.com/cometbft/cometbft/types"
cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
"github.com/cosmos/cosmos-sdk/crypto/keys/ed25519"
sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/stretchr/testify/require"
- tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
- tmtypes "github.com/tendermint/tendermint/types"
"github.com/CosmWasm/wasmd/app"
"github.com/CosmWasm/wasmd/x/wasm/keeper"
@@ -48,7 +48,7 @@ func TestSnapshotter(t *testing.T) {
Height: srcWasmApp.LastBlockHeight() + 1,
Time: time.Now(),
})
- wasmKeeper := app.NewTestSupport(t, srcWasmApp).WasmKeeper()
+ wasmKeeper := srcWasmApp.WasmKeeper
contractKeeper := keeper.NewDefaultPermissionKeeper(&wasmKeeper)
srcCodeIDToChecksum := make(map[uint64][]byte, len(spec.wasmFiles))
@@ -81,7 +81,7 @@ func TestSnapshotter(t *testing.T) {
}
// then all wasm contracts are imported
- wasmKeeper = app.NewTestSupport(t, destWasmApp).WasmKeeper()
+ wasmKeeper = destWasmApp.WasmKeeper
ctx = destWasmApp.NewUncachedContext(false, tmproto.Header{
ChainID: "foo",
Height: destWasmApp.LastBlockHeight() + 1,
diff --git a/x/wasm/keeper/staking_test.go b/x/wasm/keeper/staking_test.go
index 23ca71819b..224cc90cd6 100644
--- a/x/wasm/keeper/staking_test.go
+++ b/x/wasm/keeper/staking_test.go
@@ -12,10 +12,8 @@ import (
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
distributionkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper"
- distributiontypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
"github.com/cosmos/cosmos-sdk/x/staking"
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
- "github.com/cosmos/cosmos-sdk/x/staking/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
@@ -30,7 +28,7 @@ type StakingInitMsg struct {
Decimals uint8 `json:"decimals"`
Validator sdk.ValAddress `json:"validator"`
ExitTax sdk.Dec `json:"exit_tax"`
- // MinWithdrawal is uint128 encoded as a string (use sdk.Int?)
+ // MinWithdrawal is uint128 encoded as a string (use math.Int?)
MinWithdrawl string `json:"min_withdrawal"`
}
@@ -88,7 +86,7 @@ type InvestmentResponse struct {
Owner sdk.AccAddress `json:"owner"`
Validator sdk.ValAddress `json:"validator"`
ExitTax sdk.Dec `json:"exit_tax"`
- // MinWithdrawl is uint128 encoded as a string (use sdk.Int?)
+ // MinWithdrawl is uint128 encoded as a string (use math.Int?)
MinWithdrawl string `json:"min_withdrawal"`
}
@@ -132,7 +130,7 @@ func TestInitializeStaking(t *testing.T) {
checkAccount(t, ctx, accKeeper, bankKeeper, creator, deposit)
// try to register with a validator not on the list and it fails
- _, _, bob := keyPubAddr()
+ _, bob := keyPubAddr()
badInitMsg := StakingInitMsg{
Name: "Missing Validator",
Symbol: "MISS",
@@ -159,7 +157,7 @@ type initInfo struct {
ctx sdk.Context
accKeeper authkeeper.AccountKeeper
- stakingKeeper stakingkeeper.Keeper
+ stakingKeeper *stakingkeeper.Keeper
distKeeper distributionkeeper.Keeper
wasmKeeper Keeper
contractKeeper wasmtypes.ContractOpsKeeper
@@ -174,12 +172,6 @@ func initializeStaking(t *testing.T) initInfo {
valAddr := addValidator(t, ctx, stakingKeeper, k.Faucet, sdk.NewInt64Coin("stake", 1000000))
ctx = nextBlock(ctx, stakingKeeper)
- // set some baseline - this seems to be needed
- k.DistKeeper.SetValidatorHistoricalRewards(ctx, valAddr, 0, distributiontypes.ValidatorHistoricalRewards{
- CumulativeRewardRatio: sdk.DecCoins{},
- ReferenceCount: 1,
- })
-
v, found := stakingKeeper.GetValidator(ctx, valAddr)
assert.True(t, found)
assert.Equal(t, v.GetDelegatorShares(), sdk.NewDec(1000000))
@@ -482,7 +474,7 @@ func TestQueryStakingInfo(t *testing.T) {
mustParse(t, res, &reflectRes)
var allValidatorsRes wasmvmtypes.AllValidatorsResponse
mustParse(t, reflectRes.Data, &allValidatorsRes)
- require.Len(t, allValidatorsRes.Validators, 1)
+ require.Len(t, allValidatorsRes.Validators, 1, string(res))
valInfo := allValidatorsRes.Validators[0]
// Note: this ValAddress not AccAddress, may change with #264
require.Equal(t, valAddr.String(), valInfo.Address)
@@ -550,7 +542,7 @@ func TestQueryStakingInfo(t *testing.T) {
require.Equal(t, funds[0].Denom, delInfo.Amount.Denom)
require.Equal(t, funds[0].Amount.String(), delInfo.Amount.Amount)
- // test to get one delegations
+ // test to get one delegation
reflectDelegationQuery := testdata.ReflectQueryMsg{Chain: &testdata.ChainQuery{Request: &wasmvmtypes.QueryRequest{Staking: &wasmvmtypes.StakingQuery{
Delegation: &wasmvmtypes.DelegationQuery{
Validator: valAddr.String(),
@@ -562,6 +554,7 @@ func TestQueryStakingInfo(t *testing.T) {
require.NoError(t, err)
// first we pull out the data from chain response, before parsing the original response
mustParse(t, res, &reflectRes)
+
var delegationRes wasmvmtypes.DelegationResponse
mustParse(t, reflectRes.Data, &delegationRes)
assert.NotEmpty(t, delegationRes.Delegation)
@@ -626,7 +619,7 @@ func TestQueryStakingPlugin(t *testing.T) {
Validator: valAddr.String(),
},
}
- raw, err := StakingQuerier(stakingKeeper, distKeeper)(ctx, &query)
+ raw, err := StakingQuerier(stakingKeeper, distributionkeeper.NewQuerier(distKeeper))(ctx, &query)
require.NoError(t, err)
var res wasmvmtypes.DelegationResponse
mustParse(t, raw, &res)
@@ -651,7 +644,7 @@ func TestQueryStakingPlugin(t *testing.T) {
}
// adds a few validators and returns a list of validators that are registered
-func addValidator(t *testing.T, ctx sdk.Context, stakingKeeper stakingkeeper.Keeper, faucet *TestFaucet, value sdk.Coin) sdk.ValAddress {
+func addValidator(t *testing.T, ctx sdk.Context, stakingKeeper *stakingkeeper.Keeper, faucet *TestFaucet, value sdk.Coin) sdk.ValAddress {
owner := faucet.NewFundedRandomAccount(ctx, value)
privKey := secp256k1.GenPrivKey()
@@ -660,11 +653,11 @@ func addValidator(t *testing.T, ctx sdk.Context, stakingKeeper stakingkeeper.Kee
pkAny, err := codectypes.NewAnyWithValue(pubKey)
require.NoError(t, err)
- msg := stakingtypes.MsgCreateValidator{
- Description: types.Description{
+ msg := &stakingtypes.MsgCreateValidator{
+ Description: stakingtypes.Description{
Moniker: "Validator power",
},
- Commission: types.CommissionRates{
+ Commission: stakingtypes.CommissionRates{
Rate: sdk.MustNewDecFromStr("0.1"),
MaxRate: sdk.MustNewDecFromStr("0.2"),
MaxChangeRate: sdk.MustNewDecFromStr("0.01"),
@@ -675,23 +668,21 @@ func addValidator(t *testing.T, ctx sdk.Context, stakingKeeper stakingkeeper.Kee
Pubkey: pkAny,
Value: value,
}
-
- h := staking.NewHandler(stakingKeeper)
- _, err = h(ctx, &msg)
+ _, err = stakingkeeper.NewMsgServerImpl(stakingKeeper).CreateValidator(sdk.WrapSDKContext(ctx), msg)
require.NoError(t, err)
return addr
}
// this will commit the current set, update the block height and set historic info
// basically, letting two blocks pass
-func nextBlock(ctx sdk.Context, stakingKeeper stakingkeeper.Keeper) sdk.Context {
+func nextBlock(ctx sdk.Context, stakingKeeper *stakingkeeper.Keeper) sdk.Context {
staking.EndBlocker(ctx, stakingKeeper)
ctx = ctx.WithBlockHeight(ctx.BlockHeight() + 1)
staking.BeginBlocker(ctx, stakingKeeper)
return ctx
}
-func setValidatorRewards(ctx sdk.Context, stakingKeeper stakingkeeper.Keeper, distKeeper distributionkeeper.Keeper, valAddr sdk.ValAddress, reward string) {
+func setValidatorRewards(ctx sdk.Context, stakingKeeper *stakingkeeper.Keeper, distKeeper distributionkeeper.Keeper, valAddr sdk.ValAddress, reward string) {
// allocate some rewards
vali := stakingKeeper.Validator(ctx, valAddr)
amount, err := sdk.NewDecFromStr(reward)
diff --git a/x/wasm/keeper/submsg_test.go b/x/wasm/keeper/submsg_test.go
index cd2555fef7..5dcdf4a98b 100644
--- a/x/wasm/keeper/submsg_test.go
+++ b/x/wasm/keeper/submsg_test.go
@@ -27,8 +27,8 @@ func TestDispatchSubMsgSuccessCase(t *testing.T) {
contractStart := sdk.NewCoins(sdk.NewInt64Coin("denom", 40000))
creator := keepers.Faucet.NewFundedRandomAccount(ctx, deposit...)
- creatorBalance := deposit.Sub(contractStart)
- _, _, fred := keyPubAddr()
+ creatorBalance := deposit.Sub(contractStart...)
+ _, fred := keyPubAddr()
// upload code
codeID, _, err := keepers.ContractKeeper.Create(ctx, creator, testdata.ReflectContractWasm(), nil)
@@ -121,8 +121,8 @@ func TestDispatchSubMsgErrorHandling(t *testing.T) {
require.NoError(t, err)
hackatomID, _, err := keepers.ContractKeeper.Create(ctx, uploader, hackatomCode, nil)
require.NoError(t, err)
- _, _, bob := keyPubAddr()
- _, _, fred := keyPubAddr()
+ _, bob := keyPubAddr()
+ _, fred := keyPubAddr()
initMsg := HackatomExampleInitMsg{
Verifier: fred,
Beneficiary: bob,
@@ -236,7 +236,7 @@ func TestDispatchSubMsgErrorHandling(t *testing.T) {
"send tokens": {
submsgID: 5,
msg: validBankSend,
- resultAssertions: []assertion{assertReturnedEvents(0), assertGasUsed(95000, 96000)},
+ resultAssertions: []assertion{assertReturnedEvents(0), assertGasUsed(102000, 103000)},
},
"not enough tokens": {
submsgID: 6,
@@ -256,7 +256,7 @@ func TestDispatchSubMsgErrorHandling(t *testing.T) {
msg: validBankSend,
gasLimit: &subGasLimit,
// uses same gas as call without limit (note we do not charge the 40k on reply)
- resultAssertions: []assertion{assertReturnedEvents(0), assertGasUsed(95000, 96000)},
+ resultAssertions: []assertion{assertReturnedEvents(0), assertGasUsed(102000, 103000)},
},
"not enough tokens with limit": {
submsgID: 16,
@@ -264,7 +264,7 @@ func TestDispatchSubMsgErrorHandling(t *testing.T) {
subMsgError: true,
gasLimit: &subGasLimit,
// uses same gas as call without limit (note we do not charge the 40k on reply)
- resultAssertions: []assertion{assertGasUsed(77800, 77900), assertErrorString("codespace: sdk, code: 5")},
+ resultAssertions: []assertion{assertGasUsed(77700, 77800), assertErrorString("codespace: sdk, code: 5")},
},
"out of gas caught with gas limit": {
submsgID: 17,
@@ -283,7 +283,7 @@ func TestDispatchSubMsgErrorHandling(t *testing.T) {
for name, tc := range cases {
t.Run(name, func(t *testing.T) {
creator := keepers.Faucet.NewFundedRandomAccount(ctx, contractStart...)
- _, _, empty := keyPubAddr()
+ _, empty := keyPubAddr()
contractAddr, _, err := keepers.ContractKeeper.Instantiate(ctx, reflectID, creator, nil, []byte("{}"), fmt.Sprintf("contract %s", name), contractStart)
require.NoError(t, err)
@@ -367,7 +367,7 @@ func TestDispatchSubMsgEncodeToNoSdkMsg(t *testing.T) {
contractStart := sdk.NewCoins(sdk.NewInt64Coin("denom", 40000))
creator := keepers.Faucet.NewFundedRandomAccount(ctx, deposit...)
- _, _, fred := keyPubAddr()
+ _, fred := keyPubAddr()
// upload code
codeID, _, err := keepers.ContractKeeper.Create(ctx, creator, testdata.ReflectContractWasm(), nil)
@@ -433,7 +433,7 @@ func TestDispatchSubMsgConditionalReplyOn(t *testing.T) {
contractStart := sdk.NewCoins(sdk.NewInt64Coin("denom", 40000))
creator := keepers.Faucet.NewFundedRandomAccount(ctx, deposit...)
- _, _, fred := keyPubAddr()
+ _, fred := keyPubAddr()
// upload code
codeID, _, err := keepers.ContractKeeper.Create(ctx, creator, testdata.ReflectContractWasm(), nil)
@@ -501,7 +501,7 @@ func TestDispatchSubMsgConditionalReplyOn(t *testing.T) {
},
}
- var id uint64 = 0
+ var id uint64
for name, tc := range cases {
id++
t.Run(name, func(t *testing.T) {
diff --git a/x/wasm/keeper/test_common.go b/x/wasm/keeper/test_common.go
index b84e0025a3..d67441ad67 100644
--- a/x/wasm/keeper/test_common.go
+++ b/x/wasm/keeper/test_common.go
@@ -9,10 +9,24 @@ import (
"testing"
"time"
+ "github.com/CosmWasm/wasmd/x/wasm/keeper/testdata"
+
+ icacontrollertypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types"
+ icahosttypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/types"
+
+ errorsmod "cosmossdk.io/errors"
+
+ dbm "github.com/cometbft/cometbft-db"
+ "github.com/cometbft/cometbft/crypto"
+ "github.com/cometbft/cometbft/crypto/ed25519"
+ "github.com/cometbft/cometbft/libs/log"
+ "github.com/cometbft/cometbft/libs/rand"
+ tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/std"
"github.com/cosmos/cosmos-sdk/store"
+ storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/address"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
@@ -31,15 +45,17 @@ import (
"github.com/cosmos/cosmos-sdk/x/crisis"
crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types"
"github.com/cosmos/cosmos-sdk/x/distribution"
- distrclient "github.com/cosmos/cosmos-sdk/x/distribution/client"
distributionkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper"
distributiontypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
"github.com/cosmos/cosmos-sdk/x/evidence"
evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types"
"github.com/cosmos/cosmos-sdk/x/feegrant"
"github.com/cosmos/cosmos-sdk/x/gov"
+ govclient "github.com/cosmos/cosmos-sdk/x/gov/client"
govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
+ govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
+ govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
"github.com/cosmos/cosmos-sdk/x/mint"
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
"github.com/cosmos/cosmos-sdk/x/params"
@@ -56,18 +72,12 @@ import (
upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client"
upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
- "github.com/cosmos/ibc-go/v4/modules/apps/transfer"
- ibctransfertypes "github.com/cosmos/ibc-go/v4/modules/apps/transfer/types"
- ibc "github.com/cosmos/ibc-go/v4/modules/core"
- ibchost "github.com/cosmos/ibc-go/v4/modules/core/24-host"
- ibckeeper "github.com/cosmos/ibc-go/v4/modules/core/keeper"
+ "github.com/cosmos/ibc-go/v7/modules/apps/transfer"
+ ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types"
+ ibc "github.com/cosmos/ibc-go/v7/modules/core"
+ ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported"
+ ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper"
"github.com/stretchr/testify/require"
- "github.com/tendermint/tendermint/crypto"
- "github.com/tendermint/tendermint/crypto/ed25519"
- "github.com/tendermint/tendermint/libs/log"
- "github.com/tendermint/tendermint/libs/rand"
- tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
- dbm "github.com/tendermint/tm-db"
wasmappparams "github.com/CosmWasm/wasmd/app/params"
"github.com/CosmWasm/wasmd/x/wasm/keeper/wasmtesting"
@@ -81,9 +91,11 @@ var moduleBasics = module.NewBasicManager(
staking.AppModuleBasic{},
mint.AppModuleBasic{},
distribution.AppModuleBasic{},
- gov.NewAppModuleBasic(
- paramsclient.ProposalHandler, distrclient.ProposalHandler, upgradeclient.ProposalHandler,
- ),
+ gov.NewAppModuleBasic([]govclient.ProposalHandler{
+ paramsclient.ProposalHandler,
+ upgradeclient.LegacyProposalHandler,
+ upgradeclient.LegacyCancelProposalHandler,
+ }),
params.AppModuleBasic{},
crisis.AppModuleBasic{},
slashing.AppModuleBasic{},
@@ -121,6 +133,7 @@ var TestingStakeParams = stakingtypes.Params{
MaxEntries: 10,
HistoricalEntries: 10,
BondDenom: "stake",
+ MinCommissionRate: stakingtypes.DefaultMinCommissionRate,
}
type TestFaucet struct {
@@ -134,7 +147,7 @@ type TestFaucet struct {
func NewTestFaucet(t testing.TB, ctx sdk.Context, bankKeeper bankkeeper.Keeper, minterModuleName string, initialAmount ...sdk.Coin) *TestFaucet {
require.NotEmpty(t, initialAmount)
r := &TestFaucet{t: t, bankKeeper: bankKeeper, minterModuleName: minterModuleName}
- _, _, addr := keyPubAddr()
+ _, addr := keyPubAddr()
r.sender = addr
r.Mint(ctx, addr, initialAmount...)
r.balance = initialAmount
@@ -160,29 +173,30 @@ func (f *TestFaucet) Fund(parentCtx sdk.Context, receiver sdk.AccAddress, amount
ctx := parentCtx.WithEventManager(sdk.NewEventManager()) // discard all faucet related events
err := f.bankKeeper.SendCoins(ctx, f.sender, receiver, amounts)
require.NoError(f.t, err)
- f.balance = f.balance.Sub(amounts)
+ f.balance = f.balance.Sub(amounts...)
}
func (f *TestFaucet) NewFundedRandomAccount(ctx sdk.Context, amounts ...sdk.Coin) sdk.AccAddress {
- _, _, addr := keyPubAddr()
+ _, addr := keyPubAddr()
f.Fund(ctx, addr, amounts...)
return addr
}
type TestKeepers struct {
AccountKeeper authkeeper.AccountKeeper
- StakingKeeper stakingkeeper.Keeper
+ StakingKeeper *stakingkeeper.Keeper
DistKeeper distributionkeeper.Keeper
BankKeeper bankkeeper.Keeper
- GovKeeper govkeeper.Keeper
+ GovKeeper *govkeeper.Keeper
ContractKeeper types.ContractOpsKeeper
WasmKeeper *Keeper
IBCKeeper *ibckeeper.Keeper
- Router *baseapp.Router
+ Router MessageRouter
EncodingConfig wasmappparams.EncodingConfig
Faucet *TestFaucet
MultiStore sdk.CommitMultiStore
ScopedWasmKeeper capabilitykeeper.ScopedKeeper
+ WasmStoreKey *storetypes.KVStoreKey
}
// CreateDefaultTestInput common settings for CreateTestInput
@@ -210,23 +224,23 @@ func createTestInput(
keys := sdk.NewKVStoreKeys(
authtypes.StoreKey, banktypes.StoreKey, stakingtypes.StoreKey,
minttypes.StoreKey, distributiontypes.StoreKey, slashingtypes.StoreKey,
- govtypes.StoreKey, paramstypes.StoreKey, ibchost.StoreKey, upgradetypes.StoreKey,
+ govtypes.StoreKey, paramstypes.StoreKey, ibcexported.StoreKey, upgradetypes.StoreKey,
evidencetypes.StoreKey, ibctransfertypes.StoreKey,
capabilitytypes.StoreKey, feegrant.StoreKey, authzkeeper.StoreKey,
types.StoreKey,
)
ms := store.NewCommitMultiStore(db)
for _, v := range keys {
- ms.MountStoreWithDB(v, sdk.StoreTypeIAVL, db)
+ ms.MountStoreWithDB(v, storetypes.StoreTypeIAVL, db)
}
tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey)
for _, v := range tkeys {
- ms.MountStoreWithDB(v, sdk.StoreTypeTransient, db)
+ ms.MountStoreWithDB(v, storetypes.StoreTypeTransient, db)
}
memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey)
for _, v := range memKeys {
- ms.MountStoreWithDB(v, sdk.StoreTypeMemory, db)
+ ms.MountStoreWithDB(v, storetypes.StoreTypeMemory, db)
}
require.NoError(t, ms.LoadLatestVersion())
@@ -256,7 +270,7 @@ func createTestInput(
crisistypes.ModuleName,
ibctransfertypes.ModuleName,
capabilitytypes.ModuleName,
- ibchost.ModuleName,
+ ibcexported.ModuleName,
govtypes.ModuleName,
types.ModuleName,
} {
@@ -265,6 +279,42 @@ func createTestInput(
subspace := func(m string) paramstypes.Subspace {
r, ok := paramsKeeper.GetSubspace(m)
require.True(t, ok)
+
+ var keyTable paramstypes.KeyTable
+ switch r.Name() {
+ case authtypes.ModuleName:
+ keyTable = authtypes.ParamKeyTable() //nolint:staticcheck
+ case banktypes.ModuleName:
+ keyTable = banktypes.ParamKeyTable() //nolint:staticcheck
+ case stakingtypes.ModuleName:
+ keyTable = stakingtypes.ParamKeyTable()
+ case minttypes.ModuleName:
+ keyTable = minttypes.ParamKeyTable() //nolint:staticcheck
+ case distributiontypes.ModuleName:
+ keyTable = distributiontypes.ParamKeyTable() //nolint:staticcheck
+ case slashingtypes.ModuleName:
+ keyTable = slashingtypes.ParamKeyTable() //nolint:staticcheck
+ case govtypes.ModuleName:
+ keyTable = govv1.ParamKeyTable() //nolint:staticcheck
+ case crisistypes.ModuleName:
+ keyTable = crisistypes.ParamKeyTable() //nolint:staticcheck
+ // ibc types
+ case ibctransfertypes.ModuleName:
+ keyTable = ibctransfertypes.ParamKeyTable()
+ case icahosttypes.SubModuleName:
+ keyTable = icahosttypes.ParamKeyTable()
+ case icacontrollertypes.SubModuleName:
+ keyTable = icacontrollertypes.ParamKeyTable()
+ // wasm
+ case types.ModuleName:
+ keyTable = types.ParamKeyTable() //nolint:staticcheck
+ default:
+ return r
+ }
+
+ if !r.HasKeyTable() {
+ r = r.WithKeyTable(keyTable)
+ }
return r
}
maccPerms := map[string][]string{ // module account permissions
@@ -279,45 +329,48 @@ func createTestInput(
}
accountKeeper := authkeeper.NewAccountKeeper(
appCodec,
- keys[authtypes.StoreKey], // target store
- subspace(authtypes.ModuleName),
+ keys[authtypes.StoreKey], // target store
authtypes.ProtoBaseAccount, // prototype
maccPerms,
+ sdk.Bech32MainPrefix,
+ authtypes.NewModuleAddress(authtypes.ModuleName).String(),
)
blockedAddrs := make(map[string]bool)
for acc := range maccPerms {
blockedAddrs[authtypes.NewModuleAddress(acc).String()] = true
}
+ require.NoError(t, accountKeeper.SetParams(ctx, authtypes.DefaultParams()))
+
bankKeeper := bankkeeper.NewBaseKeeper(
appCodec,
keys[banktypes.StoreKey],
accountKeeper,
- subspace(banktypes.ModuleName),
blockedAddrs,
+ authtypes.NewModuleAddress(banktypes.ModuleName).String(),
)
- bankKeeper.SetParams(ctx, banktypes.DefaultParams())
+ require.NoError(t, bankKeeper.SetParams(ctx, banktypes.DefaultParams()))
stakingKeeper := stakingkeeper.NewKeeper(
appCodec,
keys[stakingtypes.StoreKey],
accountKeeper,
bankKeeper,
- subspace(stakingtypes.ModuleName),
+ authtypes.NewModuleAddress(stakingtypes.ModuleName).String(),
)
- stakingKeeper.SetParams(ctx, TestingStakeParams)
+ stakingtypes.DefaultParams()
+ require.NoError(t, stakingKeeper.SetParams(ctx, TestingStakeParams))
distKeeper := distributionkeeper.NewKeeper(
appCodec,
keys[distributiontypes.StoreKey],
- subspace(distributiontypes.ModuleName),
accountKeeper,
bankKeeper,
stakingKeeper,
authtypes.FeeCollectorName,
- nil,
+ authtypes.NewModuleAddress(distributiontypes.ModuleName).String(),
)
- distKeeper.SetParams(ctx, distributiontypes.DefaultParams())
+ require.NoError(t, distKeeper.SetParams(ctx, distributiontypes.DefaultParams()))
stakingKeeper.SetHooks(distKeeper.Hooks())
// set genesis items required for distribution
@@ -329,6 +382,7 @@ func createTestInput(
appCodec,
tempDir,
nil,
+ authtypes.NewModuleAddress(upgradetypes.ModuleName).String(),
)
faucet := NewTestFaucet(t, ctx, bankKeeper, minttypes.ModuleName, sdk.NewCoin("stake", sdk.NewInt(100_000_000_000)))
@@ -344,26 +398,18 @@ func createTestInput(
keys[capabilitytypes.StoreKey],
memKeys[capabilitytypes.MemStoreKey],
)
- scopedIBCKeeper := capabilityKeeper.ScopeToModule(ibchost.ModuleName)
+ scopedIBCKeeper := capabilityKeeper.ScopeToModule(ibcexported.ModuleName)
scopedWasmKeeper := capabilityKeeper.ScopeToModule(types.ModuleName)
ibcKeeper := ibckeeper.NewKeeper(
appCodec,
- keys[ibchost.StoreKey],
- subspace(ibchost.ModuleName),
+ keys[ibcexported.StoreKey],
+ subspace(ibcexported.ModuleName),
stakingKeeper,
upgradeKeeper,
scopedIBCKeeper,
)
- router := baseapp.NewRouter()
- bh := bank.NewHandler(bankKeeper)
- router.AddRoute(sdk.NewRoute(banktypes.RouterKey, bh))
- sh := staking.NewHandler(stakingKeeper)
- router.AddRoute(sdk.NewRoute(stakingtypes.RouterKey, sh))
- dh := distribution.NewHandler(distKeeper)
- router.AddRoute(sdk.NewRoute(distributiontypes.RouterKey, dh))
-
querier := baseapp.NewGRPCQueryRouter()
querier.SetInterfaceRegistry(encodingConfig.InterfaceRegistry)
msgRouter := baseapp.NewMsgServiceRouter()
@@ -375,11 +421,10 @@ func createTestInput(
keeper := NewKeeper(
appCodec,
keys[types.StoreKey],
- subspace(types.ModuleName),
accountKeeper,
bankKeeper,
stakingKeeper,
- distKeeper,
+ distributionkeeper.NewQuerier(distKeeper),
ibcKeeper.ChannelKeeper,
&ibcKeeper.PortKeeper,
scopedWasmKeeper,
@@ -389,42 +434,42 @@ func createTestInput(
tempDir,
wasmConfig,
availableCapabilities,
+ authtypes.NewModuleAddress(govtypes.ModuleName).String(),
opts...,
)
- keeper.SetParams(ctx, types.DefaultParams())
+ require.NoError(t, keeper.SetParams(ctx, types.DefaultParams()))
+
// add wasm handler so we can loop-back (contracts calling contracts)
contractKeeper := NewDefaultPermissionKeeper(&keeper)
- router.AddRoute(sdk.NewRoute(types.RouterKey, TestHandler(contractKeeper)))
-
- am := module.NewManager( // minimal module set that we use for message/ query tests
- bank.NewAppModule(appCodec, bankKeeper, accountKeeper),
- staking.NewAppModule(appCodec, stakingKeeper, accountKeeper, bankKeeper),
- distribution.NewAppModule(appCodec, distKeeper, accountKeeper, bankKeeper, stakingKeeper),
- )
- am.RegisterServices(module.NewConfigurator(appCodec, msgRouter, querier))
- types.RegisterMsgServer(msgRouter, NewMsgServerImpl(NewDefaultPermissionKeeper(keeper)))
- types.RegisterQueryServer(querier, NewGrpcQuerier(appCodec, keys[types.ModuleName], keeper, keeper.queryGasLimit))
- govRouter := govtypes.NewRouter().
- AddRoute(govtypes.RouterKey, govtypes.ProposalHandler).
+ govRouter := govv1beta1.NewRouter().
+ AddRoute(govtypes.RouterKey, govv1beta1.ProposalHandler).
AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(paramsKeeper)).
- AddRoute(distributiontypes.RouterKey, distribution.NewCommunityPoolSpendProposalHandler(distKeeper)).
AddRoute(types.RouterKey, NewWasmProposalHandler(&keeper, types.EnableAllProposals))
govKeeper := govkeeper.NewKeeper(
appCodec,
keys[govtypes.StoreKey],
- subspace(govtypes.ModuleName).WithKeyTable(govtypes.ParamKeyTable()),
accountKeeper,
bankKeeper,
stakingKeeper,
- govRouter,
+ msgRouter,
+ govtypes.DefaultConfig(),
+ authtypes.NewModuleAddress(govtypes.ModuleName).String(),
)
+ require.NoError(t, govKeeper.SetParams(ctx, govv1.DefaultParams()))
+ govKeeper.SetLegacyRouter(govRouter)
+ govKeeper.SetProposalID(ctx, 1)
- govKeeper.SetProposalID(ctx, govtypes.DefaultStartingProposalID)
- govKeeper.SetDepositParams(ctx, govtypes.DefaultDepositParams())
- govKeeper.SetVotingParams(ctx, govtypes.DefaultVotingParams())
- govKeeper.SetTallyParams(ctx, govtypes.DefaultTallyParams())
+ am := module.NewManager( // minimal module set that we use for message/ query tests
+ bank.NewAppModule(appCodec, bankKeeper, accountKeeper, subspace(banktypes.ModuleName)),
+ staking.NewAppModule(appCodec, stakingKeeper, accountKeeper, bankKeeper, subspace(stakingtypes.ModuleName)),
+ distribution.NewAppModule(appCodec, distKeeper, accountKeeper, bankKeeper, stakingKeeper, subspace(distributiontypes.ModuleName)),
+ gov.NewAppModule(appCodec, govKeeper, accountKeeper, bankKeeper, subspace(govtypes.ModuleName)),
+ )
+ am.RegisterServices(module.NewConfigurator(appCodec, msgRouter, querier))
+ types.RegisterMsgServer(msgRouter, newMsgServerImpl(NewDefaultPermissionKeeper(keeper), keeper))
+ types.RegisterQueryServer(querier, NewGrpcQuerier(appCodec, keys[types.ModuleName], keeper, keeper.queryGasLimit))
keepers := TestKeepers{
AccountKeeper: accountKeeper,
@@ -435,18 +480,19 @@ func createTestInput(
BankKeeper: bankKeeper,
GovKeeper: govKeeper,
IBCKeeper: ibcKeeper,
- Router: router,
+ Router: msgRouter,
EncodingConfig: encodingConfig,
Faucet: faucet,
MultiStore: ms,
ScopedWasmKeeper: scopedWasmKeeper,
+ WasmStoreKey: keys[types.StoreKey],
}
return ctx, keepers
}
// TestHandler returns a wasm handler for tests (to avoid circular imports)
-func TestHandler(k types.ContractOpsKeeper) sdk.Handler {
- return func(ctx sdk.Context, msg sdk.Msg) (*sdk.Result, error) {
+func TestHandler(k types.ContractOpsKeeper) MessageRouter {
+ return MessageRouterFunc(func(ctx sdk.Context, msg sdk.Msg) (*sdk.Result, error) {
ctx = ctx.WithEventManager(sdk.NewEventManager())
switch msg := msg.(type) {
case *types.MsgStoreCode:
@@ -457,15 +503,23 @@ func TestHandler(k types.ContractOpsKeeper) sdk.Handler {
return handleExecute(ctx, k, msg)
default:
errMsg := fmt.Sprintf("unrecognized wasm message type: %T", msg)
- return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, errMsg)
+ return nil, errorsmod.Wrap(sdkerrors.ErrUnknownRequest, errMsg)
}
- }
+ })
+}
+
+var _ MessageRouter = MessageRouterFunc(nil)
+
+type MessageRouterFunc func(ctx sdk.Context, req sdk.Msg) (*sdk.Result, error)
+
+func (m MessageRouterFunc) Handler(msg sdk.Msg) baseapp.MsgServiceHandler {
+ return m
}
func handleStoreCode(ctx sdk.Context, k types.ContractOpsKeeper, msg *types.MsgStoreCode) (*sdk.Result, error) {
senderAddr, err := sdk.AccAddressFromBech32(msg.Sender)
if err != nil {
- return nil, sdkerrors.Wrap(err, "sender")
+ return nil, errorsmod.Wrap(err, "sender")
}
codeID, _, err := k.Create(ctx, senderAddr, msg.WASMByteCode, msg.InstantiatePermission)
if err != nil {
@@ -481,12 +535,12 @@ func handleStoreCode(ctx sdk.Context, k types.ContractOpsKeeper, msg *types.MsgS
func handleInstantiate(ctx sdk.Context, k types.ContractOpsKeeper, msg *types.MsgInstantiateContract) (*sdk.Result, error) {
senderAddr, err := sdk.AccAddressFromBech32(msg.Sender)
if err != nil {
- return nil, sdkerrors.Wrap(err, "sender")
+ return nil, errorsmod.Wrap(err, "sender")
}
var adminAddr sdk.AccAddress
if msg.Admin != "" {
if adminAddr, err = sdk.AccAddressFromBech32(msg.Admin); err != nil {
- return nil, sdkerrors.Wrap(err, "admin")
+ return nil, errorsmod.Wrap(err, "admin")
}
}
@@ -504,11 +558,11 @@ func handleInstantiate(ctx sdk.Context, k types.ContractOpsKeeper, msg *types.Ms
func handleExecute(ctx sdk.Context, k types.ContractOpsKeeper, msg *types.MsgExecuteContract) (*sdk.Result, error) {
senderAddr, err := sdk.AccAddressFromBech32(msg.Sender)
if err != nil {
- return nil, sdkerrors.Wrap(err, "sender")
+ return nil, errorsmod.Wrap(err, "sender")
}
contractAddr, err := sdk.AccAddressFromBech32(msg.Contract)
if err != nil {
- return nil, sdkerrors.Wrap(err, "admin")
+ return nil, errorsmod.Wrap(err, "admin")
}
data, err := k.Execute(ctx, contractAddr, senderAddr, msg.Msg, msg.Funds)
if err != nil {
@@ -522,7 +576,7 @@ func handleExecute(ctx sdk.Context, k types.ContractOpsKeeper, msg *types.MsgExe
}
func RandomAccountAddress(_ testing.TB) sdk.AccAddress {
- _, _, addr := keyPubAddr()
+ _, addr := keyPubAddr()
return addr
}
@@ -544,28 +598,31 @@ type ExampleContract struct {
}
func StoreHackatomExampleContract(t testing.TB, ctx sdk.Context, keepers TestKeepers) ExampleContract {
- return StoreExampleContract(t, ctx, keepers, "./testdata/hackatom.wasm")
+ return StoreExampleContractWasm(t, ctx, keepers, testdata.HackatomContractWasm())
}
func StoreBurnerExampleContract(t testing.TB, ctx sdk.Context, keepers TestKeepers) ExampleContract {
- return StoreExampleContract(t, ctx, keepers, "./testdata/burner.wasm")
+ return StoreExampleContractWasm(t, ctx, keepers, testdata.BurnerContractWasm())
}
func StoreIBCReflectContract(t testing.TB, ctx sdk.Context, keepers TestKeepers) ExampleContract {
- return StoreExampleContract(t, ctx, keepers, "./testdata/ibc_reflect.wasm")
+ return StoreExampleContractWasm(t, ctx, keepers, testdata.IBCReflectContractWasm())
}
func StoreReflectContract(t testing.TB, ctx sdk.Context, keepers TestKeepers) ExampleContract {
- return StoreExampleContract(t, ctx, keepers, "./testdata/reflect.wasm")
+ return StoreExampleContractWasm(t, ctx, keepers, testdata.ReflectContractWasm())
}
func StoreExampleContract(t testing.TB, ctx sdk.Context, keepers TestKeepers, wasmFile string) ExampleContract {
- anyAmount := sdk.NewCoins(sdk.NewInt64Coin("denom", 1000))
- creator, _, creatorAddr := keyPubAddr()
- fundAccounts(t, ctx, keepers.AccountKeeper, keepers.BankKeeper, creatorAddr, anyAmount)
-
wasmCode, err := os.ReadFile(wasmFile)
require.NoError(t, err)
+ return StoreExampleContractWasm(t, ctx, keepers, wasmCode)
+}
+
+func StoreExampleContractWasm(t testing.TB, ctx sdk.Context, keepers TestKeepers, wasmCode []byte) ExampleContract {
+ anyAmount := sdk.NewCoins(sdk.NewInt64Coin("denom", 1000))
+ creator, creatorAddr := keyPubAddr()
+ fundAccounts(t, ctx, keepers.AccountKeeper, keepers.BankKeeper, creatorAddr, anyAmount)
codeID, _, err := keepers.ContractKeeper.Create(ctx, creatorAddr, wasmCode, nil)
require.NoError(t, err)
@@ -605,7 +662,7 @@ func StoreRandomContractWithAccessConfig(
) ExampleContract {
t.Helper()
anyAmount := sdk.NewCoins(sdk.NewInt64Coin("denom", 1000))
- creator, _, creatorAddr := keyPubAddr()
+ creator, creatorAddr := keyPubAddr()
fundAccounts(t, ctx, keepers.AccountKeeper, keepers.BankKeeper, creatorAddr, anyAmount)
keepers.WasmKeeper.wasmVM = mock
wasmCode := append(wasmIdent, rand.Bytes(10)...) //nolint:gocritic
@@ -630,10 +687,10 @@ type HackatomExampleInstance struct {
func InstantiateHackatomExampleContract(t testing.TB, ctx sdk.Context, keepers TestKeepers) HackatomExampleInstance {
contract := StoreHackatomExampleContract(t, ctx, keepers)
- verifier, _, verifierAddr := keyPubAddr()
+ verifier, verifierAddr := keyPubAddr()
fundAccounts(t, ctx, keepers.AccountKeeper, keepers.BankKeeper, verifierAddr, contract.InitialAmount)
- beneficiary, _, beneficiaryAddr := keyPubAddr()
+ beneficiary, beneficiaryAddr := keyPubAddr()
initMsgBz := HackatomExampleInitMsg{
Verifier: verifierAddr,
Beneficiary: beneficiaryAddr,
@@ -747,7 +804,7 @@ var keyCounter uint64
// we need to make this deterministic (same every test run), as encoded address size and thus gas cost,
// depends on the actual bytes (due to ugly CanonicalAddress encoding)
-func keyPubAddr() (crypto.PrivKey, crypto.PubKey, sdk.AccAddress) {
+func keyPubAddr() (crypto.PrivKey, sdk.AccAddress) {
keyCounter++
seed := make([]byte, 8)
binary.BigEndian.PutUint64(seed, keyCounter)
@@ -755,5 +812,5 @@ func keyPubAddr() (crypto.PrivKey, crypto.PubKey, sdk.AccAddress) {
key := ed25519.GenPrivKeyFromSecret(seed)
pub := key.PubKey()
addr := sdk.AccAddress(pub.Address())
- return key, pub, addr
+ return key, addr
}
diff --git a/x/wasm/keeper/test_fuzz.go b/x/wasm/keeper/test_fuzz.go
index d6a2ce870d..2b15a26be7 100644
--- a/x/wasm/keeper/test_fuzz.go
+++ b/x/wasm/keeper/test_fuzz.go
@@ -3,9 +3,9 @@ package keeper
import (
"encoding/json"
+ tmBytes "github.com/cometbft/cometbft/libs/bytes"
sdk "github.com/cosmos/cosmos-sdk/types"
fuzz "github.com/google/gofuzz"
- tmBytes "github.com/tendermint/tendermint/libs/bytes"
"github.com/CosmWasm/wasmd/x/wasm/types"
)
@@ -51,10 +51,12 @@ func FuzzContractCodeHistory(m *types.ContractCodeHistoryEntry, c fuzz.Continue)
func FuzzStateModel(m *types.Model, c fuzz.Continue) {
m.Key = tmBytes.HexBytes(c.RandString())
- if len(m.Key) == 0 {
- m.Key = tmBytes.HexBytes("non empty key")
+ if len(m.Key) != 0 {
+ c.Fuzz(&m.Value)
+ return
}
- c.Fuzz(&m.Value)
+ // try again, keys must not be empty
+ FuzzStateModel(m, c)
}
func FuzzAccessType(m *types.AccessType, c fuzz.Continue) {
diff --git a/x/wasm/keeper/testdata/reflect.go b/x/wasm/keeper/testdata/contracts.go
similarity index 74%
rename from x/wasm/keeper/testdata/reflect.go
rename to x/wasm/keeper/testdata/contracts.go
index 2074ef96fd..6073e4d530 100644
--- a/x/wasm/keeper/testdata/reflect.go
+++ b/x/wasm/keeper/testdata/contracts.go
@@ -7,14 +7,20 @@ import (
"github.com/cosmos/cosmos-sdk/types"
)
-//go:embed reflect.wasm
-var reflectContract []byte
-
-//go:embed reflect_1_1.wasm
-var migrateReflectContract []byte
-
-//go:embed cyberpunk.wasm
-var cyberpunkContract []byte
+var (
+ //go:embed reflect.wasm
+ reflectContract []byte
+ //go:embed reflect_1_1.wasm
+ migrateReflectContract []byte
+ //go:embed cyberpunk.wasm
+ cyberpunkContract []byte
+ //go:embed ibc_reflect.wasm
+ ibcReflectContract []byte
+ //go:embed burner.wasm
+ burnerContract []byte
+ //go:embed hackatom.wasm
+ hackatomContract []byte
+)
func ReflectContractWasm() []byte {
return reflectContract
@@ -28,6 +34,18 @@ func CyberpunkContractWasm() []byte {
return cyberpunkContract
}
+func IBCReflectContractWasm() []byte {
+ return ibcReflectContract
+}
+
+func BurnerContractWasm() []byte {
+ return burnerContract
+}
+
+func HackatomContractWasm() []byte {
+ return hackatomContract
+}
+
// ReflectHandleMsg is used to encode handle messages
type ReflectHandleMsg struct {
Reflect *ReflectPayload `json:"reflect_msg,omitempty"`
diff --git a/x/wasm/keeper/wasmtesting/gas_register.go b/x/wasm/keeper/wasmtesting/gas_register.go
index d1975f7638..516cd5fb4a 100644
--- a/x/wasm/keeper/wasmtesting/gas_register.go
+++ b/x/wasm/keeper/wasmtesting/gas_register.go
@@ -52,7 +52,7 @@ func (m MockGasRegister) ReplyCosts(pinned bool, reply wasmvmtypes.Reply) sdk.Ga
return m.ReplyCostFn(pinned, reply)
}
-func (m MockGasRegister) EventCosts(evts []wasmvmtypes.EventAttribute, events wasmvmtypes.Events) sdk.Gas {
+func (m MockGasRegister) EventCosts(evts []wasmvmtypes.EventAttribute, _ wasmvmtypes.Events) sdk.Gas {
if m.EventCostsFn == nil {
panic("not expected to be called")
}
diff --git a/x/wasm/keeper/wasmtesting/mock_engine.go b/x/wasm/keeper/wasmtesting/mock_engine.go
index 10c7fdfed2..383da90b7f 100644
--- a/x/wasm/keeper/wasmtesting/mock_engine.go
+++ b/x/wasm/keeper/wasmtesting/mock_engine.go
@@ -4,10 +4,11 @@ import (
"bytes"
"crypto/sha256"
+ errorsmod "cosmossdk.io/errors"
+
wasmvm "github.com/CosmWasm/wasmvm"
wasmvmtypes "github.com/CosmWasm/wasmvm/types"
- sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
- "github.com/tendermint/tendermint/libs/rand"
+ "github.com/cometbft/cometbft/libs/rand"
"github.com/CosmWasm/wasmd/x/wasm/types"
)
@@ -323,7 +324,7 @@ func NewIBCContractMockWasmer(c IBCContractCallbacks) *MockWasmer {
func HashOnlyCreateFn(code wasmvm.WasmCode) (wasmvm.Checksum, error) {
if code == nil {
- return nil, sdkerrors.Wrap(types.ErrInvalid, "wasm code must not be nil")
+ return nil, errorsmod.Wrap(types.ErrInvalid, "wasm code must not be nil")
}
hash := sha256.Sum256(code)
return hash[:], nil
diff --git a/x/wasm/keeper/wasmtesting/mock_keepers.go b/x/wasm/keeper/wasmtesting/mock_keepers.go
index 5977db1c80..edf9df0999 100644
--- a/x/wasm/keeper/wasmtesting/mock_keepers.go
+++ b/x/wasm/keeper/wasmtesting/mock_keepers.go
@@ -3,20 +3,19 @@ package wasmtesting
import (
sdk "github.com/cosmos/cosmos-sdk/types"
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
- channeltypes "github.com/cosmos/ibc-go/v4/modules/core/04-channel/types"
- ibcexported "github.com/cosmos/ibc-go/v4/modules/core/exported"
+ clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types"
+ channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types"
"github.com/CosmWasm/wasmd/x/wasm/types"
)
type MockChannelKeeper struct {
- GetChannelFn func(ctx sdk.Context, srcPort, srcChan string) (channel channeltypes.Channel, found bool)
- GetNextSequenceSendFn func(ctx sdk.Context, portID, channelID string) (uint64, bool)
- SendPacketFn func(ctx sdk.Context, channelCap *capabilitytypes.Capability, packet ibcexported.PacketI) error
- ChanCloseInitFn func(ctx sdk.Context, portID, channelID string, chanCap *capabilitytypes.Capability) error
- GetAllChannelsFn func(ctx sdk.Context) []channeltypes.IdentifiedChannel
- IterateChannelsFn func(ctx sdk.Context, cb func(channeltypes.IdentifiedChannel) bool)
- SetChannelFn func(ctx sdk.Context, portID, channelID string, channel channeltypes.Channel)
+ GetChannelFn func(ctx sdk.Context, srcPort, srcChan string) (channel channeltypes.Channel, found bool)
+ SendPacketFn func(ctx sdk.Context, channelCap *capabilitytypes.Capability, sourcePort string, sourceChannel string, timeoutHeight clienttypes.Height, timeoutTimestamp uint64, data []byte) (uint64, error)
+ ChanCloseInitFn func(ctx sdk.Context, portID, channelID string, chanCap *capabilitytypes.Capability) error
+ GetAllChannelsFn func(ctx sdk.Context) []channeltypes.IdentifiedChannel
+ IterateChannelsFn func(ctx sdk.Context, cb func(channeltypes.IdentifiedChannel) bool)
+ SetChannelFn func(ctx sdk.Context, portID, channelID string, channel channeltypes.Channel)
}
func (m *MockChannelKeeper) GetChannel(ctx sdk.Context, srcPort, srcChan string) (channel channeltypes.Channel, found bool) {
@@ -33,18 +32,11 @@ func (m *MockChannelKeeper) GetAllChannels(ctx sdk.Context) []channeltypes.Ident
return m.GetAllChannelsFn(ctx)
}
-func (m *MockChannelKeeper) GetNextSequenceSend(ctx sdk.Context, portID, channelID string) (uint64, bool) {
- if m.GetNextSequenceSendFn == nil {
- panic("not supposed to be called!")
- }
- return m.GetNextSequenceSendFn(ctx, portID, channelID)
-}
-
-func (m *MockChannelKeeper) SendPacket(ctx sdk.Context, channelCap *capabilitytypes.Capability, packet ibcexported.PacketI) error {
+func (m *MockChannelKeeper) SendPacket(ctx sdk.Context, channelCap *capabilitytypes.Capability, sourcePort string, sourceChannel string, timeoutHeight clienttypes.Height, timeoutTimestamp uint64, data []byte) (uint64, error) {
if m.SendPacketFn == nil {
panic("not supposed to be called!")
}
- return m.SendPacketFn(ctx, channelCap, packet)
+ return m.SendPacketFn(ctx, channelCap, sourcePort, sourceChannel, timeoutHeight, timeoutTimestamp, data)
}
func (m *MockChannelKeeper) ChanCloseInit(ctx sdk.Context, portID, channelID string, chanCap *capabilitytypes.Capability) error {
diff --git a/x/wasm/migrations/v1/store.go b/x/wasm/migrations/v1/store.go
new file mode 100644
index 0000000000..f970d85c09
--- /dev/null
+++ b/x/wasm/migrations/v1/store.go
@@ -0,0 +1,36 @@
+package v1
+
+import (
+ sdk "github.com/cosmos/cosmos-sdk/types"
+
+ "github.com/CosmWasm/wasmd/x/wasm/types"
+)
+
+// AddToSecondIndexFn creates a secondary index entry for the creator fo the contract
+type AddToSecondIndexFn func(ctx sdk.Context, creatorAddress sdk.AccAddress, position *types.AbsoluteTxPosition, contractAddress sdk.AccAddress)
+
+// Keeper abstract keeper
+type wasmKeeper interface {
+ IterateContractInfo(ctx sdk.Context, cb func(sdk.AccAddress, types.ContractInfo) bool)
+}
+
+// Migrator is a struct for handling in-place store migrations.
+type Migrator struct {
+ keeper wasmKeeper
+ addToSecondIndexFn AddToSecondIndexFn
+}
+
+// NewMigrator returns a new Migrator.
+func NewMigrator(k wasmKeeper, fn AddToSecondIndexFn) Migrator {
+ return Migrator{keeper: k, addToSecondIndexFn: fn}
+}
+
+// Migrate1to2 migrates from version 1 to 2.
+func (m Migrator) Migrate1to2(ctx sdk.Context) error {
+ m.keeper.IterateContractInfo(ctx, func(contractAddr sdk.AccAddress, contractInfo types.ContractInfo) bool {
+ creator := sdk.MustAccAddressFromBech32(contractInfo.Creator)
+ m.addToSecondIndexFn(ctx, creator, contractInfo.Created, contractAddr)
+ return false
+ })
+ return nil
+}
diff --git a/x/wasm/keeper/migrate_test.go b/x/wasm/migrations/v1/store_test.go
similarity index 61%
rename from x/wasm/keeper/migrate_test.go
rename to x/wasm/migrations/v1/store_test.go
index 3b762c49d0..857d0810a6 100644
--- a/x/wasm/keeper/migrate_test.go
+++ b/x/wasm/migrations/v1/store_test.go
@@ -1,10 +1,12 @@
-package keeper
+package v1_test
import (
"bytes"
"encoding/json"
"testing"
+ "github.com/CosmWasm/wasmd/x/wasm/keeper"
+
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/address"
"github.com/stretchr/testify/require"
@@ -13,17 +15,18 @@ import (
)
func TestMigrate1To2(t *testing.T) {
- ctx, keepers := CreateTestInput(t, false, AvailableCapabilities)
+ const AvailableCapabilities = "iterator,staking,stargate,cosmwasm_1_1"
+ ctx, keepers := keeper.CreateTestInput(t, false, AvailableCapabilities)
wasmKeeper := keepers.WasmKeeper
deposit := sdk.NewCoins(sdk.NewInt64Coin("denom", 100000))
creator := sdk.AccAddress(bytes.Repeat([]byte{1}, address.Len))
keepers.Faucet.Fund(ctx, creator, deposit...)
- example := StoreHackatomExampleContract(t, ctx, keepers)
+ example := keeper.StoreHackatomExampleContract(t, ctx, keepers)
- initMsg := HackatomExampleInitMsg{
- Verifier: RandomAccountAddress(t),
- Beneficiary: RandomAccountAddress(t),
+ initMsg := keeper.HackatomExampleInitMsg{
+ Verifier: keeper.RandomAccountAddress(t),
+ Beneficiary: keeper.RandomAccountAddress(t),
}
initMsgBz, err := json.Marshal(initMsg)
require.NoError(t, err)
@@ -32,23 +35,30 @@ func TestMigrate1To2(t *testing.T) {
// create with no balance is also legal
gotContractAddr1, _, err := keepers.ContractKeeper.Instantiate(ctx.WithEventManager(em), example.CodeID, creator, nil, initMsgBz, "demo contract 1", nil)
+ require.NoError(t, err)
ctx = ctx.WithBlockHeight(ctx.BlockHeight() + 1)
+
+ // create with no balance is also legal
gotContractAddr2, _, err := keepers.ContractKeeper.Instantiate(ctx.WithEventManager(em), example.CodeID, creator, nil, initMsgBz, "demo contract 1", nil)
+ require.NoError(t, err)
ctx = ctx.WithBlockHeight(ctx.BlockHeight() + 1)
+
+ // create with no balance is also legal
gotContractAddr3, _, err := keepers.ContractKeeper.Instantiate(ctx.WithEventManager(em), example.CodeID, creator, nil, initMsgBz, "demo contract 1", nil)
+ require.NoError(t, err)
info1 := wasmKeeper.GetContractInfo(ctx, gotContractAddr1)
info2 := wasmKeeper.GetContractInfo(ctx, gotContractAddr2)
info3 := wasmKeeper.GetContractInfo(ctx, gotContractAddr3)
// remove key
- ctx.KVStore(wasmKeeper.storeKey).Delete(types.GetContractByCreatorSecondaryIndexKey(creator, info1.Created.Bytes(), gotContractAddr1))
- ctx.KVStore(wasmKeeper.storeKey).Delete(types.GetContractByCreatorSecondaryIndexKey(creator, info2.Created.Bytes(), gotContractAddr2))
- ctx.KVStore(wasmKeeper.storeKey).Delete(types.GetContractByCreatorSecondaryIndexKey(creator, info3.Created.Bytes(), gotContractAddr3))
+ ctx.KVStore(keepers.WasmStoreKey).Delete(types.GetContractByCreatorSecondaryIndexKey(creator, info1.Created.Bytes(), gotContractAddr1))
+ ctx.KVStore(keepers.WasmStoreKey).Delete(types.GetContractByCreatorSecondaryIndexKey(creator, info2.Created.Bytes(), gotContractAddr2))
+ ctx.KVStore(keepers.WasmStoreKey).Delete(types.GetContractByCreatorSecondaryIndexKey(creator, info3.Created.Bytes(), gotContractAddr3))
// migrator
- migrator := NewMigrator(*wasmKeeper)
- migrator.Migrate1to2(ctx)
+ err = keeper.NewMigrator(*wasmKeeper, nil).Migrate1to2(ctx)
+ require.NoError(t, err)
// check new store
var allContract []string
diff --git a/x/wasm/migrations/v2/store.go b/x/wasm/migrations/v2/store.go
new file mode 100644
index 0000000000..64c94ba837
--- /dev/null
+++ b/x/wasm/migrations/v2/store.go
@@ -0,0 +1,33 @@
+package v2
+
+import (
+ "github.com/cosmos/cosmos-sdk/codec"
+ storetypes "github.com/cosmos/cosmos-sdk/store/types"
+ sdk "github.com/cosmos/cosmos-sdk/types"
+
+ "github.com/CosmWasm/wasmd/x/wasm/exported"
+ "github.com/CosmWasm/wasmd/x/wasm/types"
+)
+
+// MigrateStore migrates the x/wasm module state from the consensus version 2 to
+// version 3. Specifically, it takes the parameters that are currently stored
+// and managed by the x/params module and stores them directly into the x/wasm
+// module state.
+func MigrateStore(ctx sdk.Context, storeKey storetypes.StoreKey, legacySubspace exported.Subspace, cdc codec.BinaryCodec) error {
+ store := ctx.KVStore(storeKey)
+ var currParams types.Params
+ legacySubspace.GetParamSet(ctx, &currParams)
+
+ if err := currParams.ValidateBasic(); err != nil {
+ return err
+ }
+
+ bz, err := cdc.Marshal(&currParams)
+ if err != nil {
+ return err
+ }
+
+ store.Set(types.ParamsKey, bz)
+
+ return nil
+}
diff --git a/x/wasm/migrations/v2/store_test.go b/x/wasm/migrations/v2/store_test.go
new file mode 100644
index 0000000000..3f21bf4555
--- /dev/null
+++ b/x/wasm/migrations/v2/store_test.go
@@ -0,0 +1,44 @@
+package v2_test
+
+import (
+ "testing"
+
+ "github.com/stretchr/testify/require"
+
+ "github.com/cosmos/cosmos-sdk/testutil"
+ sdk "github.com/cosmos/cosmos-sdk/types"
+ moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil"
+
+ "github.com/CosmWasm/wasmd/x/wasm"
+ "github.com/CosmWasm/wasmd/x/wasm/exported"
+ v2 "github.com/CosmWasm/wasmd/x/wasm/migrations/v2"
+ "github.com/CosmWasm/wasmd/x/wasm/types"
+)
+
+type mockSubspace struct {
+ ps types.Params
+}
+
+func newMockSubspace(ps types.Params) mockSubspace {
+ return mockSubspace{ps: ps}
+}
+
+func (ms mockSubspace) GetParamSet(ctx sdk.Context, ps exported.ParamSet) {
+ *ps.(*types.Params) = ms.ps
+}
+
+func TestMigrate(t *testing.T) {
+ cdc := moduletestutil.MakeTestEncodingConfig(wasm.AppModuleBasic{}).Codec
+ storeKey := sdk.NewKVStoreKey(types.StoreKey)
+ tKey := sdk.NewTransientStoreKey("transient_test")
+ ctx := testutil.DefaultContext(storeKey, tKey)
+ store := ctx.KVStore(storeKey)
+
+ legacySubspace := newMockSubspace(types.DefaultParams())
+ require.NoError(t, v2.MigrateStore(ctx, storeKey, legacySubspace, cdc))
+
+ var res types.Params
+ bz := store.Get(types.ParamsKey)
+ require.NoError(t, cdc.Unmarshal(bz, &res))
+ require.Equal(t, legacySubspace.ps, res)
+}
diff --git a/x/wasm/module.go b/x/wasm/module.go
index cc83cf831f..272b32d1a4 100644
--- a/x/wasm/module.go
+++ b/x/wasm/module.go
@@ -4,11 +4,15 @@ import (
"context"
"encoding/json"
"fmt"
- "math/rand"
"runtime/debug"
"strings"
+ "cosmossdk.io/core/appmodule"
+
+ "github.com/cosmos/cosmos-sdk/baseapp"
+
wasmvm "github.com/CosmWasm/wasmvm"
+ abci "github.com/cometbft/cometbft/abci/types"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec"
cdctypes "github.com/cosmos/cosmos-sdk/codec/types"
@@ -17,22 +21,20 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
simtypes "github.com/cosmos/cosmos-sdk/types/simulation"
- "github.com/gorilla/mux"
"github.com/grpc-ecosystem/grpc-gateway/runtime"
"github.com/spf13/cast"
"github.com/spf13/cobra"
- abci "github.com/tendermint/tendermint/abci/types"
"github.com/CosmWasm/wasmd/x/wasm/client/cli"
- "github.com/CosmWasm/wasmd/x/wasm/client/rest" //nolint:staticcheck
+ "github.com/CosmWasm/wasmd/x/wasm/exported"
"github.com/CosmWasm/wasmd/x/wasm/keeper"
"github.com/CosmWasm/wasmd/x/wasm/simulation"
"github.com/CosmWasm/wasmd/x/wasm/types"
)
var (
- _ module.AppModule = AppModule{}
- _ module.AppModuleBasic = AppModuleBasic{}
+ _ module.AppModuleBasic = AppModuleBasic{}
+ _ module.AppModuleSimulation = AppModule{}
)
// Module init related flags
@@ -45,7 +47,7 @@ const (
// AppModuleBasic defines the basic application module used by the wasm module.
type AppModuleBasic struct{}
-func (b AppModuleBasic) RegisterLegacyAminoCodec(amino *codec.LegacyAmino) { //nolint:staticcheck
+func (b AppModuleBasic) RegisterLegacyAminoCodec(amino *codec.LegacyAmino) {
RegisterCodec(amino)
}
@@ -70,7 +72,7 @@ func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage {
}
// ValidateGenesis performs genesis state validation for the wasm module.
-func (b AppModuleBasic) ValidateGenesis(marshaler codec.JSONCodec, config client.TxEncodingConfig, message json.RawMessage) error {
+func (b AppModuleBasic) ValidateGenesis(marshaler codec.JSONCodec, _ client.TxEncodingConfig, message json.RawMessage) error {
var data GenesisState
err := marshaler.UnmarshalJSON(message, &data)
if err != nil {
@@ -79,11 +81,6 @@ func (b AppModuleBasic) ValidateGenesis(marshaler codec.JSONCodec, config client
return ValidateGenesis(data)
}
-// RegisterRESTRoutes registers the REST routes for the wasm module.
-func (AppModuleBasic) RegisterRESTRoutes(cliCtx client.Context, rtr *mux.Router) {
- rest.RegisterRoutes(cliCtx, rtr)
-}
-
// GetTxCmd returns the root tx command for the wasm module.
func (b AppModuleBasic) GetTxCmd() *cobra.Command {
return cli.GetTxCmd()
@@ -100,6 +97,7 @@ func (b AppModuleBasic) RegisterInterfaces(registry cdctypes.InterfaceRegistry)
}
// ____________________________________________________________________________
+var _ appmodule.AppModule = AppModule{}
// AppModule implements an application module for the wasm module.
type AppModule struct {
@@ -109,14 +107,11 @@ type AppModule struct {
validatorSetSource keeper.ValidatorSetSource
accountKeeper types.AccountKeeper // for simulation
bankKeeper simulation.BankKeeper
+ router keeper.MessageRouter
+ // legacySubspace is used solely for migration of x/params managed parameters
+ legacySubspace exported.Subspace
}
-// ConsensusVersion is a sequence number for state-breaking change of the
-// module. It should be incremented on each consensus-breaking change
-// introduced by the module. To avoid wrong/empty versions, the initial version
-// should be set to 1.
-func (AppModule) ConsensusVersion() uint64 { return 2 }
-
// NewAppModule creates a new AppModule object
func NewAppModule(
cdc codec.Codec,
@@ -124,6 +119,8 @@ func NewAppModule(
validatorSetSource keeper.ValidatorSetSource,
ak types.AccountKeeper,
bk simulation.BankKeeper,
+ router *baseapp.MsgServiceRouter,
+ ss exported.Subspace,
) AppModule {
return AppModule{
AppModuleBasic: AppModuleBasic{},
@@ -132,31 +129,42 @@ func NewAppModule(
validatorSetSource: validatorSetSource,
accountKeeper: ak,
bankKeeper: bk,
+ router: router,
+ legacySubspace: ss,
}
}
+// IsOnePerModuleType implements the depinject.OnePerModuleType interface.
+func (am AppModule) IsOnePerModuleType() { // marker
+}
+
+// IsAppModule implements the appmodule.AppModule interface.
+func (am AppModule) IsAppModule() { // marker
+}
+
+// ConsensusVersion is a sequence number for state-breaking change of the
+// module. It should be incremented on each consensus-breaking change
+// introduced by the module. To avoid wrong/empty versions, the initial version
+// should be set to 1.
+func (AppModule) ConsensusVersion() uint64 { return 3 }
+
func (am AppModule) RegisterServices(cfg module.Configurator) {
- types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(keeper.NewDefaultPermissionKeeper(am.keeper)))
+ types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper))
types.RegisterQueryServer(cfg.QueryServer(), NewQuerier(am.keeper))
- m := keeper.NewMigrator(*am.keeper)
+ m := keeper.NewMigrator(*am.keeper, am.legacySubspace)
err := cfg.RegisterMigration(types.ModuleName, 1, m.Migrate1to2)
if err != nil {
panic(err)
}
-}
-
-func (am AppModule) LegacyQuerierHandler(amino *codec.LegacyAmino) sdk.Querier { //nolint:staticcheck
- return keeper.NewLegacyQuerier(am.keeper, am.keeper.QueryGasLimit())
+ err = cfg.RegisterMigration(types.ModuleName, 2, m.Migrate2to3)
+ if err != nil {
+ panic(err)
+ }
}
// RegisterInvariants registers the wasm module invariants.
-func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry) {}
-
-// Route returns the message routing key for the wasm module.
-func (am AppModule) Route() sdk.Route {
- return sdk.NewRoute(RouterKey, NewHandler(keeper.NewDefaultPermissionKeeper(am.keeper)))
-}
+func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {}
// QuerierRoute returns the wasm module's querier route name.
func (AppModule) QuerierRoute() string {
@@ -201,17 +209,12 @@ func (AppModule) GenerateGenesisState(simState *module.SimulationState) {
}
// ProposalContents doesn't return any content functions for governance proposals.
-func (am AppModule) ProposalContents(simState module.SimulationState) []simtypes.WeightedProposalContent {
+func (am AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalContent {
return simulation.ProposalContents(am.bankKeeper, am.keeper)
}
-// RandomizedParams creates randomized bank param changes for the simulator.
-func (am AppModule) RandomizedParams(r *rand.Rand) []simtypes.ParamChange {
- return simulation.ParamChanges(r, am.cdc)
-}
-
// RegisterStoreDecoder registers a decoder for supply module's types
-func (am AppModule) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry) {
+func (am AppModule) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) {
}
// WeightedOperations returns the all the gov module operations with their respective weights.
@@ -246,7 +249,7 @@ func ReadWasmConfig(opts servertypes.AppOptions) (types.WasmConfig, error) {
}
}
if v := opts.Get(flagWasmSimulationGasLimit); v != nil {
- if raw, ok := v.(string); ok && raw != "" {
+ if raw, ok := v.(string); !ok || raw != "" {
limit, err := cast.ToUint64E(v) // non empty string set
if err != nil {
return cfg, err
@@ -280,7 +283,7 @@ func getExpectedLibwasmVersion() string {
return ""
}
-func checkLibwasmVersion(cmd *cobra.Command, args []string) error {
+func checkLibwasmVersion(_ *cobra.Command, _ []string) error {
wasmVersion, err := wasmvm.LibwasmvmVersion()
if err != nil {
return fmt.Errorf("unable to retrieve libwasmversion %w", err)
diff --git a/x/wasm/module_integration_test.go b/x/wasm/module_integration_test.go
deleted file mode 100644
index bdce6cf34f..0000000000
--- a/x/wasm/module_integration_test.go
+++ /dev/null
@@ -1,31 +0,0 @@
-package wasm_test
-
-import (
- "testing"
-
- sdk "github.com/cosmos/cosmos-sdk/types"
- "github.com/cosmos/cosmos-sdk/types/module"
- upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
- "github.com/stretchr/testify/assert"
- "github.com/stretchr/testify/require"
- tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
-
- "github.com/CosmWasm/wasmd/app"
- "github.com/CosmWasm/wasmd/x/wasm"
-)
-
-func TestModuleMigrations(t *testing.T) {
- wasmApp := app.Setup(false)
- ctx := wasmApp.BaseApp.NewContext(false, tmproto.Header{})
- upgradeHandler := func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
- return wasmApp.ModuleManager().RunMigrations(ctx, wasmApp.ModuleConfigurator(), fromVM)
- }
- fromVM := wasmApp.UpgradeKeeper.GetModuleVersionMap(ctx)
- fromVM[wasm.ModuleName] = 1 // start with initial version
- upgradeHandler(ctx, upgradetypes.Plan{Name: "testing"}, fromVM)
- // when
- gotVM, err := wasmApp.ModuleManager().RunMigrations(ctx, wasmApp.ModuleConfigurator(), fromVM)
- // then
- require.NoError(t, err)
- assert.Equal(t, uint64(2), gotVM[wasm.ModuleName])
-}
diff --git a/x/wasm/module_test.go b/x/wasm/module_test.go
index 5ca0a88178..bd788d0cc3 100644
--- a/x/wasm/module_test.go
+++ b/x/wasm/module_test.go
@@ -3,58 +3,86 @@ package wasm
import (
"bytes"
"encoding/json"
- "fmt"
"os"
+ "strings"
"testing"
+ servertypes "github.com/cosmos/cosmos-sdk/server/types"
+ "github.com/spf13/viper"
+
+ abci "github.com/cometbft/cometbft/abci/types"
+ "github.com/cometbft/cometbft/crypto/ed25519"
+ "github.com/cosmos/cosmos-sdk/baseapp"
+ "github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/address"
"github.com/cosmos/cosmos-sdk/types/module"
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
- "github.com/dvsekhvalnov/jose2go/base64url"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
- abci "github.com/tendermint/tendermint/abci/types"
- "github.com/tendermint/tendermint/crypto"
- "github.com/tendermint/tendermint/crypto/ed25519"
+ "github.com/CosmWasm/wasmd/app/params"
+ "github.com/CosmWasm/wasmd/x/wasm/exported"
"github.com/CosmWasm/wasmd/x/wasm/keeper"
"github.com/CosmWasm/wasmd/x/wasm/keeper/testdata"
"github.com/CosmWasm/wasmd/x/wasm/types"
)
+type mockSubspace struct {
+ ps types.Params
+}
+
+func newMockSubspace(ps types.Params) mockSubspace {
+ return mockSubspace{ps: ps}
+}
+
+func (ms mockSubspace) GetParamSet(ctx sdk.Context, ps exported.ParamSet) {
+ *ps.(*types.Params) = ms.ps
+}
+
type testData struct {
- module module.AppModule
- ctx sdk.Context
- acctKeeper authkeeper.AccountKeeper
- keeper Keeper
- bankKeeper bankkeeper.Keeper
- stakingKeeper stakingkeeper.Keeper
- faucet *keeper.TestFaucet
+ module AppModule
+ ctx sdk.Context
+ acctKeeper authkeeper.AccountKeeper
+ keeper Keeper
+ bankKeeper bankkeeper.Keeper
+ stakingKeeper *stakingkeeper.Keeper
+ faucet *keeper.TestFaucet
+ grpcQueryRouter *baseapp.GRPCQueryRouter
+ msgServiceRouter *baseapp.MsgServiceRouter
+ encConf params.EncodingConfig
}
func setupTest(t *testing.T) testData {
ctx, keepers := CreateTestInput(t, false, "iterator,staking,stargate,cosmwasm_1_1")
- cdc := keeper.MakeTestCodec(t)
+ encConf := keeper.MakeEncodingConfig(t)
+ queryRouter := baseapp.NewGRPCQueryRouter()
+ serviceRouter := baseapp.NewMsgServiceRouter()
+ queryRouter.SetInterfaceRegistry(encConf.InterfaceRegistry)
+ serviceRouter.SetInterfaceRegistry(encConf.InterfaceRegistry)
data := testData{
- module: NewAppModule(cdc, keepers.WasmKeeper, keepers.StakingKeeper, keepers.AccountKeeper, keepers.BankKeeper),
- ctx: ctx,
- acctKeeper: keepers.AccountKeeper,
- keeper: *keepers.WasmKeeper,
- bankKeeper: keepers.BankKeeper,
- stakingKeeper: keepers.StakingKeeper,
- faucet: keepers.Faucet,
+ module: NewAppModule(encConf.Marshaler, keepers.WasmKeeper, keepers.StakingKeeper, keepers.AccountKeeper, keepers.BankKeeper, nil, newMockSubspace(types.DefaultParams())),
+ ctx: ctx,
+ acctKeeper: keepers.AccountKeeper,
+ keeper: *keepers.WasmKeeper,
+ bankKeeper: keepers.BankKeeper,
+ stakingKeeper: keepers.StakingKeeper,
+ faucet: keepers.Faucet,
+ grpcQueryRouter: queryRouter,
+ msgServiceRouter: serviceRouter,
+ encConf: encConf,
}
+ data.module.RegisterServices(module.NewConfigurator(encConf.Marshaler, serviceRouter, queryRouter))
return data
}
-func keyPubAddr() (crypto.PrivKey, crypto.PubKey, sdk.AccAddress) {
+func keyPubAddr() sdk.AccAddress {
key := ed25519.GenPrivKey()
pub := key.PubKey()
addr := sdk.AccAddress(pub.Address())
- return key, pub, addr
+ return addr
}
func mustLoad(path string) []byte {
@@ -66,11 +94,11 @@ func mustLoad(path string) []byte {
}
var (
- _, _, addrAcc1 = keyPubAddr()
- addr1 = addrAcc1.String()
- testContract = mustLoad("./keeper/testdata/hackatom.wasm")
- maskContract = testdata.ReflectContractWasm()
- oldContract = mustLoad("./testdata/escrow_0.7.wasm")
+ addrAcc1 = keyPubAddr()
+ addr1 = addrAcc1.String()
+ testContract = mustLoad("./keeper/testdata/hackatom.wasm")
+ maskContract = testdata.ReflectContractWasm()
+ oldContract = mustLoad("./testdata/escrow_0.7.wasm")
)
func TestHandleCreate(t *testing.T) {
@@ -117,18 +145,19 @@ func TestHandleCreate(t *testing.T) {
t.Run(name, func(t *testing.T) {
data := setupTest(t)
- h := data.module.Route().Handler()
- q := data.module.LegacyQuerierHandler(nil)
+ h := data.msgServiceRouter.Handler(tc.msg)
+ // q := data.grpcQueryRouter.Route(sdk.MsgTypeURL(tc.msg))
+ q := data.grpcQueryRouter
res, err := h(data.ctx, tc.msg)
if !tc.isValid {
require.Error(t, err, "%#v", res)
- assertCodeList(t, q, data.ctx, 0)
- assertCodeBytes(t, q, data.ctx, 1, nil)
+ assertCodeList(t, q, data.ctx, 0, data.encConf.Marshaler)
+ assertCodeBytes(t, q, data.ctx, 1, nil, data.encConf.Marshaler)
return
}
require.NoError(t, err)
- assertCodeList(t, q, data.ctx, 1)
+ assertCodeList(t, q, data.ctx, 1, data.encConf.Marshaler)
})
}
}
@@ -148,58 +177,58 @@ func TestHandleInstantiate(t *testing.T) {
data := setupTest(t)
creator := data.faucet.NewFundedRandomAccount(data.ctx, sdk.NewInt64Coin("denom", 100000))
- h := data.module.Route().Handler()
- q := data.module.LegacyQuerierHandler(nil)
-
msg := &MsgStoreCode{
Sender: creator.String(),
WASMByteCode: testContract,
}
+
+ h := data.msgServiceRouter.Handler(msg)
+ q := data.grpcQueryRouter
+
res, err := h(data.ctx, msg)
require.NoError(t, err)
assertStoreCodeResponse(t, res.Data, 1)
- _, _, bob := keyPubAddr()
- _, _, fred := keyPubAddr()
+ bob := keyPubAddr()
+ fred := keyPubAddr()
- initMsg := initMsg{
+ initPayload := initMsg{
Verifier: fred,
Beneficiary: bob,
}
- initMsgBz, err := json.Marshal(initMsg)
+ initMsgBz, err := json.Marshal(initPayload)
require.NoError(t, err)
// create with no balance is also legal
- initCmd := MsgInstantiateContract{
+ initMsg := &MsgInstantiateContract{
Sender: creator.String(),
CodeID: firstCodeID,
Msg: initMsgBz,
Funds: nil,
Label: "testing",
}
- res, err = h(data.ctx, &initCmd)
+ h = data.msgServiceRouter.Handler(initMsg)
+ res, err = h(data.ctx, initMsg)
require.NoError(t, err)
contractBech32Addr := parseInitResponse(t, res.Data)
require.Equal(t, "cosmos14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s4hmalr", contractBech32Addr)
// this should be standard x/wasm init event, nothing from contract
- require.Equal(t, 3, len(res.Events), prettyEvents(res.Events))
- require.Equal(t, "message", res.Events[0].Type)
- assertAttribute(t, "module", "wasm", res.Events[0].Attributes[0])
- require.Equal(t, "instantiate", res.Events[1].Type)
- require.Equal(t, "wasm", res.Events[2].Type)
- assertAttribute(t, "_contract_address", contractBech32Addr, res.Events[2].Attributes[0])
-
- assertCodeList(t, q, data.ctx, 1)
- assertCodeBytes(t, q, data.ctx, 1, testContract)
-
- assertContractList(t, q, data.ctx, 1, []string{contractBech32Addr})
- assertContractInfo(t, q, data.ctx, contractBech32Addr, 1, creator)
+ require.Equal(t, 2, len(res.Events), prettyEvents(res.Events))
+ require.Equal(t, "instantiate", res.Events[0].Type)
+ require.Equal(t, "wasm", res.Events[1].Type)
+ assertAttribute(t, "_contract_address", contractBech32Addr, res.Events[1].Attributes[0])
+
+ assertCodeList(t, q, data.ctx, 1, data.encConf.Marshaler)
+ assertCodeBytes(t, q, data.ctx, 1, testContract, data.encConf.Marshaler)
+
+ assertContractList(t, q, data.ctx, 1, []string{contractBech32Addr}, data.encConf.Marshaler)
+ assertContractInfo(t, q, data.ctx, contractBech32Addr, 1, creator, data.encConf.Marshaler)
assertContractState(t, q, data.ctx, contractBech32Addr, state{
Verifier: fred.String(),
Beneficiary: bob.String(),
Funder: creator.String(),
- })
+ }, data.encConf.Marshaler)
}
func TestHandleExecute(t *testing.T) {
@@ -211,18 +240,17 @@ func TestHandleExecute(t *testing.T) {
creator := data.faucet.NewFundedRandomAccount(data.ctx, deposit.Add(deposit...)...)
fred := data.faucet.NewFundedRandomAccount(data.ctx, topUp...)
- h := data.module.Route().Handler()
- q := data.module.LegacyQuerierHandler(nil)
-
msg := &MsgStoreCode{
Sender: creator.String(),
WASMByteCode: testContract,
}
+ h := data.msgServiceRouter.Handler(msg)
+ q := data.grpcQueryRouter
res, err := h(data.ctx, msg)
require.NoError(t, err)
assertStoreCodeResponse(t, res.Data, 1)
- _, _, bob := keyPubAddr()
+ bob := keyPubAddr()
initMsg := initMsg{
Verifier: fred,
Beneficiary: bob,
@@ -230,28 +258,27 @@ func TestHandleExecute(t *testing.T) {
initMsgBz, err := json.Marshal(initMsg)
require.NoError(t, err)
- initCmd := MsgInstantiateContract{
+ initCmd := &MsgInstantiateContract{
Sender: creator.String(),
CodeID: firstCodeID,
Msg: initMsgBz,
Funds: deposit,
Label: "testing",
}
- res, err = h(data.ctx, &initCmd)
+ h = data.msgServiceRouter.Handler(initCmd)
+ res, err = h(data.ctx, initCmd)
require.NoError(t, err)
contractBech32Addr := parseInitResponse(t, res.Data)
require.Equal(t, "cosmos14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s4hmalr", contractBech32Addr)
// this should be standard x/wasm message event, init event, plus a bank send event (2), with no custom contract events
- require.Equal(t, 6, len(res.Events), prettyEvents(res.Events))
- require.Equal(t, "message", res.Events[0].Type)
- assertAttribute(t, "module", "wasm", res.Events[0].Attributes[0])
- require.Equal(t, "coin_spent", res.Events[1].Type)
- require.Equal(t, "coin_received", res.Events[2].Type)
- require.Equal(t, "transfer", res.Events[3].Type)
- require.Equal(t, "instantiate", res.Events[4].Type)
- require.Equal(t, "wasm", res.Events[5].Type)
- assertAttribute(t, "_contract_address", contractBech32Addr, res.Events[5].Attributes[0])
+ require.Equal(t, 5, len(res.Events), prettyEvents(res.Events))
+ require.Equal(t, "coin_spent", res.Events[0].Type)
+ require.Equal(t, "coin_received", res.Events[1].Type)
+ require.Equal(t, "transfer", res.Events[2].Type)
+ require.Equal(t, "instantiate", res.Events[3].Type)
+ require.Equal(t, "wasm", res.Events[4].Type)
+ assertAttribute(t, "_contract_address", contractBech32Addr, res.Events[4].Attributes[0])
// ensure bob doesn't exist
bobAcct := data.acctKeeper.GetAccount(data.ctx, bob)
@@ -269,49 +296,48 @@ func TestHandleExecute(t *testing.T) {
require.NotNil(t, contractAcct)
assert.Equal(t, deposit, data.bankKeeper.GetAllBalances(data.ctx, contractAcct.GetAddress()))
- execCmd := MsgExecuteContract{
+ execCmd := &MsgExecuteContract{
Sender: fred.String(),
Contract: contractBech32Addr,
Msg: []byte(`{"release":{}}`),
Funds: topUp,
}
- res, err = h(data.ctx, &execCmd)
+ h = data.msgServiceRouter.Handler(execCmd)
+ res, err = h(data.ctx, execCmd)
require.NoError(t, err)
// from https://github.com/CosmWasm/cosmwasm/blob/master/contracts/hackatom/src/contract.rs#L167
assertExecuteResponse(t, res.Data, []byte{0xf0, 0x0b, 0xaa})
// this should be standard message event, plus x/wasm init event, plus 2 bank send event, plus a special event from the contract
- require.Equal(t, 10, len(res.Events), prettyEvents(res.Events))
+ require.Equal(t, 9, len(res.Events), prettyEvents(res.Events))
- assert.Equal(t, "message", res.Events[0].Type)
- assertAttribute(t, "module", "wasm", res.Events[0].Attributes[0])
- assert.Equal(t, "coin_spent", res.Events[1].Type)
- assert.Equal(t, "coin_received", res.Events[2].Type)
+ assert.Equal(t, "coin_spent", res.Events[0].Type)
+ assert.Equal(t, "coin_received", res.Events[1].Type)
- require.Equal(t, "transfer", res.Events[3].Type)
- require.Len(t, res.Events[3].Attributes, 3)
- assertAttribute(t, "recipient", contractBech32Addr, res.Events[3].Attributes[0])
- assertAttribute(t, "sender", fred.String(), res.Events[3].Attributes[1])
- assertAttribute(t, "amount", "5000denom", res.Events[3].Attributes[2])
+ require.Equal(t, "transfer", res.Events[2].Type)
+ require.Len(t, res.Events[2].Attributes, 3)
+ assertAttribute(t, "recipient", contractBech32Addr, res.Events[2].Attributes[0])
+ assertAttribute(t, "sender", fred.String(), res.Events[2].Attributes[1])
+ assertAttribute(t, "amount", "5000denom", res.Events[2].Attributes[2])
- assert.Equal(t, "execute", res.Events[4].Type)
+ assert.Equal(t, "execute", res.Events[3].Type)
// custom contract event attribute
- assert.Equal(t, "wasm", res.Events[5].Type)
+ assert.Equal(t, "wasm", res.Events[4].Type)
+ assertAttribute(t, "_contract_address", contractBech32Addr, res.Events[4].Attributes[0])
+ assertAttribute(t, "action", "release", res.Events[4].Attributes[1])
+ // custom contract event
+ assert.Equal(t, "wasm-hackatom", res.Events[5].Type)
assertAttribute(t, "_contract_address", contractBech32Addr, res.Events[5].Attributes[0])
assertAttribute(t, "action", "release", res.Events[5].Attributes[1])
- // custom contract event
- assert.Equal(t, "wasm-hackatom", res.Events[6].Type)
- assertAttribute(t, "_contract_address", contractBech32Addr, res.Events[6].Attributes[0])
- assertAttribute(t, "action", "release", res.Events[6].Attributes[1])
// second transfer (this without conflicting message)
- assert.Equal(t, "coin_spent", res.Events[7].Type)
- assert.Equal(t, "coin_received", res.Events[8].Type)
+ assert.Equal(t, "coin_spent", res.Events[6].Type)
+ assert.Equal(t, "coin_received", res.Events[7].Type)
- assert.Equal(t, "transfer", res.Events[9].Type)
- assertAttribute(t, "recipient", bob.String(), res.Events[9].Attributes[0])
- assertAttribute(t, "sender", contractBech32Addr, res.Events[9].Attributes[1])
- assertAttribute(t, "amount", "105000denom", res.Events[9].Attributes[2])
+ assert.Equal(t, "transfer", res.Events[8].Type)
+ assertAttribute(t, "recipient", bob.String(), res.Events[8].Attributes[0])
+ assertAttribute(t, "sender", contractBech32Addr, res.Events[8].Attributes[1])
+ assertAttribute(t, "amount", "105000denom", res.Events[8].Attributes[2])
// finally, standard x/wasm tag
// ensure bob now exists and got both payments released
@@ -327,16 +353,16 @@ func TestHandleExecute(t *testing.T) {
assert.Equal(t, sdk.Coins{}, data.bankKeeper.GetAllBalances(data.ctx, contractAcct.GetAddress()))
// ensure all contract state is as after init
- assertCodeList(t, q, data.ctx, 1)
- assertCodeBytes(t, q, data.ctx, 1, testContract)
+ assertCodeList(t, q, data.ctx, 1, data.encConf.Marshaler)
+ assertCodeBytes(t, q, data.ctx, 1, testContract, data.encConf.Marshaler)
- assertContractList(t, q, data.ctx, 1, []string{contractBech32Addr})
- assertContractInfo(t, q, data.ctx, contractBech32Addr, 1, creator)
+ assertContractList(t, q, data.ctx, 1, []string{contractBech32Addr}, data.encConf.Marshaler)
+ assertContractInfo(t, q, data.ctx, contractBech32Addr, 1, creator, data.encConf.Marshaler)
assertContractState(t, q, data.ctx, contractBech32Addr, state{
Verifier: fred.String(),
Beneficiary: bob.String(),
Funder: creator.String(),
- })
+ }, data.encConf.Marshaler)
}
func TestHandleExecuteEscrow(t *testing.T) {
@@ -348,16 +374,16 @@ func TestHandleExecuteEscrow(t *testing.T) {
data.faucet.Fund(data.ctx, creator, sdk.NewInt64Coin("denom", 100000))
fred := data.faucet.NewFundedRandomAccount(data.ctx, topUp...)
- h := data.module.Route().Handler()
-
msg := &MsgStoreCode{
Sender: creator.String(),
WASMByteCode: testContract,
}
- res, err := h(data.ctx, msg)
+
+ h := data.msgServiceRouter.Handler(msg)
+ _, err := h(data.ctx, msg)
require.NoError(t, err)
- _, _, bob := keyPubAddr()
+ bob := keyPubAddr()
initMsg := map[string]interface{}{
"verifier": fred.String(),
"beneficiary": bob.String(),
@@ -372,7 +398,8 @@ func TestHandleExecuteEscrow(t *testing.T) {
Funds: deposit,
Label: "testing",
}
- res, err = h(data.ctx, &initCmd)
+ h = data.msgServiceRouter.Handler(&initCmd)
+ res, err := h(data.ctx, &initCmd)
require.NoError(t, err)
contractBech32Addr := parseInitResponse(t, res.Data)
require.Equal(t, "cosmos14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s4hmalr", contractBech32Addr)
@@ -389,6 +416,7 @@ func TestHandleExecuteEscrow(t *testing.T) {
Msg: handleMsgBz,
Funds: topUp,
}
+ h = data.msgServiceRouter.Handler(&execCmd)
res, err = h(data.ctx, &execCmd)
require.NoError(t, err)
// from https://github.com/CosmWasm/cosmwasm/blob/master/contracts/hackatom/src/contract.rs#L167
@@ -408,9 +436,17 @@ func TestHandleExecuteEscrow(t *testing.T) {
}
func TestReadWasmConfig(t *testing.T) {
+ withViper := func(s string) *viper.Viper {
+ v := viper.New()
+ v.SetConfigType("toml")
+ require.NoError(t, v.ReadConfig(strings.NewReader(s)))
+ return v
+ }
+ var one uint64 = 1
defaults := DefaultWasmConfig()
+
specs := map[string]struct {
- src AppOptionsMock
+ src servertypes.AppOptions
exp types.WasmConfig
}{
"set query gas limit via opts": {
@@ -442,8 +478,26 @@ func TestReadWasmConfig(t *testing.T) {
},
},
"all defaults when no options set": {
+ src: AppOptionsMock{},
exp: defaults,
},
+ "default config template values": {
+ src: withViper(types.DefaultConfigTemplate()),
+ exp: defaults,
+ },
+ "custom config template values": {
+ src: withViper(types.ConfigTemplate(types.WasmConfig{
+ SimulationGasLimit: &one,
+ SmartQueryGasLimit: 2,
+ MemoryCacheSize: 3,
+ })),
+ exp: types.WasmConfig{
+ SimulationGasLimit: &one,
+ SmartQueryGasLimit: 2,
+ MemoryCacheSize: 3,
+ ContractDebugMode: false,
+ },
+ },
}
for msg, spec := range specs {
t.Run(msg, func(t *testing.T) {
@@ -489,99 +543,110 @@ func prettyAttrs(attrs []abci.EventAttribute) []sdk.Attribute {
}
func prettyAttr(attr abci.EventAttribute) sdk.Attribute {
- return sdk.NewAttribute(string(attr.Key), string(attr.Value))
+ return sdk.NewAttribute(attr.Key, attr.Value)
}
func assertAttribute(t *testing.T, key string, value string, attr abci.EventAttribute) {
t.Helper()
- assert.Equal(t, key, string(attr.Key), prettyAttr(attr))
- assert.Equal(t, value, string(attr.Value), prettyAttr(attr))
+ assert.Equal(t, key, attr.Key, prettyAttr(attr))
+ assert.Equal(t, value, attr.Value, prettyAttr(attr))
}
-func assertCodeList(t *testing.T, q sdk.Querier, ctx sdk.Context, expectedNum int) {
- bz, sdkerr := q(ctx, []string{QueryListCode}, abci.RequestQuery{})
+func assertCodeList(t *testing.T, q *baseapp.GRPCQueryRouter, ctx sdk.Context, expectedNum int, marshaler codec.Codec) {
+ t.Helper()
+ path := "/cosmwasm.wasm.v1.Query/Codes"
+ resp, sdkerr := q.Route(path)(ctx, abci.RequestQuery{Path: path})
require.NoError(t, sdkerr)
+ require.True(t, resp.IsOK())
+ bz := resp.Value
if len(bz) == 0 {
require.Equal(t, expectedNum, 0)
return
}
- var res []CodeInfo
- err := json.Unmarshal(bz, &res)
- require.NoError(t, err)
-
- assert.Equal(t, expectedNum, len(res))
+ var res types.QueryCodesResponse
+ require.NoError(t, marshaler.Unmarshal(bz, &res))
+ assert.Equal(t, expectedNum, len(res.CodeInfos))
}
-func assertCodeBytes(t *testing.T, q sdk.Querier, ctx sdk.Context, codeID uint64, expectedBytes []byte) {
- path := []string{QueryGetCode, fmt.Sprintf("%d", codeID)}
- bz, sdkerr := q(ctx, path, abci.RequestQuery{})
- require.NoError(t, sdkerr)
+func assertCodeBytes(t *testing.T, q *baseapp.GRPCQueryRouter, ctx sdk.Context, codeID uint64, expectedBytes []byte, marshaler codec.Codec) { //nolint:unparam
+ t.Helper()
+ bz, err := marshaler.Marshal(&types.QueryCodeRequest{CodeId: codeID})
+ require.NoError(t, err)
+ path := "/cosmwasm.wasm.v1.Query/Code"
+ resp, err := q.Route(path)(ctx, abci.RequestQuery{Path: path, Data: bz})
if len(expectedBytes) == 0 {
- require.Equal(t, len(bz), 0, "%q", string(bz))
+ assert.ErrorIs(t, err, types.ErrNotFound)
return
}
- var res map[string]interface{}
- err := json.Unmarshal(bz, &res)
require.NoError(t, err)
+ require.True(t, resp.IsOK())
+ bz = resp.Value
- require.Contains(t, res, "data")
- b, err := base64url.Decode(res["data"].(string))
- require.NoError(t, err)
- assert.Equal(t, expectedBytes, b)
- assert.EqualValues(t, codeID, res["id"])
+ var rsp types.QueryCodeResponse
+ require.NoError(t, marshaler.Unmarshal(bz, &rsp))
+ assert.Equal(t, expectedBytes, rsp.Data)
}
-func assertContractList(t *testing.T, q sdk.Querier, ctx sdk.Context, codeID uint64, expContractAddrs []string) {
- bz, sdkerr := q(ctx, []string{QueryListContractByCode, fmt.Sprintf("%d", codeID)}, abci.RequestQuery{})
- require.NoError(t, sdkerr)
+func assertContractList(t *testing.T, q *baseapp.GRPCQueryRouter, ctx sdk.Context, codeID uint64, expContractAddrs []string, marshaler codec.Codec) { //nolint:unparam
+ t.Helper()
+ bz, err := marshaler.Marshal(&types.QueryContractsByCodeRequest{CodeId: codeID})
+ require.NoError(t, err)
- if len(bz) == 0 {
- require.Equal(t, len(expContractAddrs), 0)
+ path := "/cosmwasm.wasm.v1.Query/ContractsByCode"
+ resp, sdkerr := q.Route(path)(ctx, abci.RequestQuery{Path: path, Data: bz})
+ if len(expContractAddrs) == 0 {
+ assert.ErrorIs(t, err, types.ErrNotFound)
return
}
+ require.NoError(t, sdkerr)
+ require.True(t, resp.IsOK())
+ bz = resp.Value
- var res []string
- err := json.Unmarshal(bz, &res)
- require.NoError(t, err)
+ var rsp types.QueryContractsByCodeResponse
+ require.NoError(t, marshaler.Unmarshal(bz, &rsp))
- hasAddrs := make([]string, len(res))
- for i, r := range res {
+ hasAddrs := make([]string, len(rsp.Contracts))
+ for i, r := range rsp.Contracts { //nolint:gosimple
hasAddrs[i] = r
}
-
assert.Equal(t, expContractAddrs, hasAddrs)
}
-func assertContractState(t *testing.T, q sdk.Querier, ctx sdk.Context, contractBech32Addr string, expected state) {
+func assertContractState(t *testing.T, q *baseapp.GRPCQueryRouter, ctx sdk.Context, contractBech32Addr string, expected state, marshaler codec.Codec) {
t.Helper()
- path := []string{QueryGetContractState, contractBech32Addr, keeper.QueryMethodContractStateAll}
- bz, sdkerr := q(ctx, path, abci.RequestQuery{})
- require.NoError(t, sdkerr)
-
- var res []Model
- err := json.Unmarshal(bz, &res)
+ bz, err := marshaler.Marshal(&types.QueryRawContractStateRequest{Address: contractBech32Addr, QueryData: []byte("config")})
require.NoError(t, err)
- require.Equal(t, 1, len(res), "#v", res)
- require.Equal(t, []byte("config"), []byte(res[0].Key))
+ path := "/cosmwasm.wasm.v1.Query/RawContractState"
+ resp, sdkerr := q.Route(path)(ctx, abci.RequestQuery{Path: path, Data: bz})
+ require.NoError(t, sdkerr)
+ require.True(t, resp.IsOK())
+ bz = resp.Value
+
+ var rsp types.QueryRawContractStateResponse
+ require.NoError(t, marshaler.Unmarshal(bz, &rsp))
expectedBz, err := json.Marshal(expected)
require.NoError(t, err)
- assert.Equal(t, expectedBz, res[0].Value)
+ assert.Equal(t, expectedBz, rsp.Data)
}
-func assertContractInfo(t *testing.T, q sdk.Querier, ctx sdk.Context, contractBech32Addr string, codeID uint64, creator sdk.AccAddress) {
+func assertContractInfo(t *testing.T, q *baseapp.GRPCQueryRouter, ctx sdk.Context, contractBech32Addr string, codeID uint64, creator sdk.AccAddress, marshaler codec.Codec) { //nolint:unparam
t.Helper()
- path := []string{QueryGetContract, contractBech32Addr}
- bz, sdkerr := q(ctx, path, abci.RequestQuery{})
+ bz, err := marshaler.Marshal(&types.QueryContractInfoRequest{Address: contractBech32Addr})
+ require.NoError(t, err)
+
+ path := "/cosmwasm.wasm.v1.Query/ContractInfo"
+ resp, sdkerr := q.Route(path)(ctx, abci.RequestQuery{Path: path, Data: bz})
require.NoError(t, sdkerr)
+ require.True(t, resp.IsOK())
+ bz = resp.Value
- var res ContractInfo
- err := json.Unmarshal(bz, &res)
- require.NoError(t, err)
+ var rsp types.QueryContractInfoResponse
+ require.NoError(t, marshaler.Unmarshal(bz, &rsp))
- assert.Equal(t, codeID, res.CodeID)
- assert.Equal(t, creator.String(), res.Creator)
+ assert.Equal(t, codeID, rsp.CodeID)
+ assert.Equal(t, creator.String(), rsp.Creator)
}
diff --git a/x/wasm/relay_pingpong_test.go b/x/wasm/relay_pingpong_test.go
index a36cdce6ab..ff52de3dc0 100644
--- a/x/wasm/relay_pingpong_test.go
+++ b/x/wasm/relay_pingpong_test.go
@@ -5,15 +5,14 @@ import (
"fmt"
"testing"
- ibctransfertypes "github.com/cosmos/ibc-go/v4/modules/apps/transfer/types"
- ibctesting "github.com/cosmos/ibc-go/v4/testing"
+ ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types"
+ ibctesting "github.com/cosmos/ibc-go/v7/testing"
wasmvm "github.com/CosmWasm/wasmvm"
wasmvmtypes "github.com/CosmWasm/wasmvm/types"
- "github.com/cosmos/cosmos-sdk/store/prefix"
sdk "github.com/cosmos/cosmos-sdk/types"
- clienttypes "github.com/cosmos/ibc-go/v4/modules/core/02-client/types"
- channeltypes "github.com/cosmos/ibc-go/v4/modules/core/04-channel/types"
+ clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types"
+ channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
@@ -49,8 +48,8 @@ func TestPinPong(t *testing.T) {
wasmtesting.NewIBCContractMockWasmer(pongContract),
)}
coordinator = wasmibctesting.NewCoordinator(t, 2, chainAOpts, chainBOpts)
- chainA = coordinator.GetChain(wasmibctesting.GetChainID(0))
- chainB = coordinator.GetChain(wasmibctesting.GetChainID(1))
+ chainA = coordinator.GetChain(wasmibctesting.GetChainID(1))
+ chainB = coordinator.GetChain(wasmibctesting.GetChainID(2))
)
_ = chainB.SeedNewContractInstance() // skip 1 instance so that addresses are not the same
var (
@@ -137,7 +136,7 @@ type player struct {
// Execute starts the ping pong game
// Contracts finds all connected channels and broadcasts a ping message
-func (p *player) Execute(code wasmvm.Checksum, env wasmvmtypes.Env, info wasmvmtypes.MessageInfo, executeMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.Response, uint64, error) {
+func (p *player) Execute(_ wasmvm.Checksum, _ wasmvmtypes.Env, _ wasmvmtypes.MessageInfo, executeMsg []byte, store wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) (*wasmvmtypes.Response, uint64, error) {
p.execCalls++
// start game
var start startGame
@@ -175,7 +174,7 @@ func (p *player) Execute(code wasmvm.Checksum, env wasmvmtypes.Env, info wasmvmt
}
// OnIBCChannelOpen ensures to accept only configured version
-func (p player) IBCChannelOpen(codeID wasmvm.Checksum, env wasmvmtypes.Env, msg wasmvmtypes.IBCChannelOpenMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBC3ChannelOpenResponse, uint64, error) {
+func (p player) IBCChannelOpen(_ wasmvm.Checksum, _ wasmvmtypes.Env, msg wasmvmtypes.IBCChannelOpenMsg, _ wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) (*wasmvmtypes.IBC3ChannelOpenResponse, uint64, error) {
if msg.GetChannel().Version != p.actor {
return &wasmvmtypes.IBC3ChannelOpenResponse{}, 0, nil
}
@@ -183,7 +182,7 @@ func (p player) IBCChannelOpen(codeID wasmvm.Checksum, env wasmvmtypes.Env, msg
}
// OnIBCChannelConnect persists connection endpoints
-func (p player) IBCChannelConnect(codeID wasmvm.Checksum, env wasmvmtypes.Env, msg wasmvmtypes.IBCChannelConnectMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResponse, uint64, error) {
+func (p player) IBCChannelConnect(_ wasmvm.Checksum, _ wasmvmtypes.Env, msg wasmvmtypes.IBCChannelConnectMsg, store wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResponse, uint64, error) {
p.storeEndpoint(store, msg.GetChannel())
return &wasmvmtypes.IBCBasicResponse{}, 0, nil
}
@@ -199,20 +198,6 @@ var ( // store keys
maxValueKey = []byte("max-value")
)
-func (p player) loadEndpoints(store prefix.Store, channelID string) *connectedChannelsModel {
- var counterparties []connectedChannelsModel
- if bz := store.Get(ibcEndpointsKey); bz != nil {
- require.NoError(p.t, json.Unmarshal(bz, &counterparties))
- }
- for _, v := range counterparties {
- if v.Our.ChannelID == channelID {
- return &v
- }
- }
- p.t.Fatalf("no counterparty found for channel %q", channelID)
- return nil
-}
-
func (p player) storeEndpoint(store wasmvm.KVStore, channel wasmvmtypes.IBCChannel) {
var counterparties []connectedChannelsModel
if b := store.Get(ibcEndpointsKey); b != nil {
@@ -224,7 +209,7 @@ func (p player) storeEndpoint(store wasmvm.KVStore, channel wasmvmtypes.IBCChann
store.Set(ibcEndpointsKey, bz)
}
-func (p player) IBCChannelClose(codeID wasmvm.Checksum, env wasmvmtypes.Env, msg wasmvmtypes.IBCChannelCloseMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResponse, uint64, error) {
+func (p player) IBCChannelClose(_ wasmvm.Checksum, _ wasmvmtypes.Env, _ wasmvmtypes.IBCChannelCloseMsg, _ wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResponse, uint64, error) {
panic("implement me")
}
@@ -237,7 +222,7 @@ var ( // store keys
)
// IBCPacketReceive receives the hit and serves a response hit via `wasmvmtypes.IBCPacket`
-func (p player) IBCPacketReceive(codeID wasmvm.Checksum, env wasmvmtypes.Env, msg wasmvmtypes.IBCPacketReceiveMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBCReceiveResult, uint64, error) {
+func (p player) IBCPacketReceive(_ wasmvm.Checksum, _ wasmvmtypes.Env, msg wasmvmtypes.IBCPacketReceiveMsg, store wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) (*wasmvmtypes.IBCReceiveResult, uint64, error) {
// parse received data and store
packet := msg.Packet
var receivedBall hit
@@ -283,7 +268,7 @@ func (p player) IBCPacketReceive(codeID wasmvm.Checksum, env wasmvmtypes.Env, ms
}
// OnIBCPacketAcknowledgement handles the packet acknowledgment frame. Stops the game on an any error
-func (p player) IBCPacketAck(codeID wasmvm.Checksum, env wasmvmtypes.Env, msg wasmvmtypes.IBCPacketAckMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResponse, uint64, error) {
+func (p player) IBCPacketAck(_ wasmvm.Checksum, _ wasmvmtypes.Env, msg wasmvmtypes.IBCPacketAckMsg, store wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResponse, uint64, error) {
// parse received data and store
var sentBall hit
if err := json.Unmarshal(msg.OriginalPacket.Data, &sentBall); err != nil {
@@ -305,7 +290,7 @@ func (p player) IBCPacketAck(codeID wasmvm.Checksum, env wasmvmtypes.Env, msg wa
return &wasmvmtypes.IBCBasicResponse{}, 0, nil
}
-func (p player) IBCPacketTimeout(codeID wasmvm.Checksum, env wasmvmtypes.Env, packet wasmvmtypes.IBCPacketTimeoutMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResponse, uint64, error) {
+func (p player) IBCPacketTimeout(_ wasmvm.Checksum, _ wasmvmtypes.Env, _ wasmvmtypes.IBCPacketTimeoutMsg, _ wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResponse, uint64, error) {
panic("implement me")
}
diff --git a/x/wasm/relay_test.go b/x/wasm/relay_test.go
index df34534fbc..5b903c6f33 100644
--- a/x/wasm/relay_test.go
+++ b/x/wasm/relay_test.go
@@ -6,14 +6,15 @@ import (
"testing"
"time"
+ errorsmod "cosmossdk.io/errors"
+ "cosmossdk.io/math"
wasmvm "github.com/CosmWasm/wasmvm"
wasmvmtypes "github.com/CosmWasm/wasmvm/types"
sdk "github.com/cosmos/cosmos-sdk/types"
- sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
- ibctransfertypes "github.com/cosmos/ibc-go/v4/modules/apps/transfer/types"
- clienttypes "github.com/cosmos/ibc-go/v4/modules/core/02-client/types"
- channeltypes "github.com/cosmos/ibc-go/v4/modules/core/04-channel/types"
- ibctesting "github.com/cosmos/ibc-go/v4/testing"
+ ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types"
+ clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types"
+ channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types"
+ ibctesting "github.com/cosmos/ibc-go/v7/testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
@@ -33,8 +34,8 @@ func TestFromIBCTransferToContract(t *testing.T) {
specs := map[string]struct {
contract wasmtesting.IBCContractCallbacks
setupContract func(t *testing.T, contract wasmtesting.IBCContractCallbacks, chain *wasmibctesting.TestChain)
- expChainABalanceDiff sdk.Int
- expChainBBalanceDiff sdk.Int
+ expChainABalanceDiff math.Int
+ expChainBBalanceDiff math.Int
}{
"ack": {
contract: &ackReceiverContract{},
@@ -72,8 +73,8 @@ func TestFromIBCTransferToContract(t *testing.T) {
wasmtesting.NewIBCContractMockWasmer(spec.contract),
)}
coordinator = wasmibctesting.NewCoordinator(t, 2, []wasmkeeper.Option{}, chainAOpts)
- chainA = coordinator.GetChain(wasmibctesting.GetChainID(0))
- chainB = coordinator.GetChain(wasmibctesting.GetChainID(1))
+ chainA = coordinator.GetChain(wasmibctesting.GetChainID(1))
+ chainB = coordinator.GetChain(wasmibctesting.GetChainID(2))
)
coordinator.CommitBlock(chainA, chainB)
myContractAddr := chainB.SeedNewContractInstance()
@@ -100,7 +101,7 @@ func TestFromIBCTransferToContract(t *testing.T) {
// when transfer via sdk transfer from A (module) -> B (contract)
coinToSendToB := sdk.NewCoin(sdk.DefaultBondDenom, transferAmount)
timeoutHeight := clienttypes.NewHeight(1, 110)
- msg := ibctransfertypes.NewMsgTransfer(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, coinToSendToB, chainA.SenderAccount.GetAddress().String(), chainB.SenderAccount.GetAddress().String(), timeoutHeight, 0)
+ msg := ibctransfertypes.NewMsgTransfer(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, coinToSendToB, chainA.SenderAccount.GetAddress().String(), chainB.SenderAccount.GetAddress().String(), timeoutHeight, 0, "")
_, err := chainA.SendMsgs(msg)
require.NoError(t, err)
require.NoError(t, path.EndpointB.UpdateClient())
@@ -143,8 +144,8 @@ func TestContractCanInitiateIBCTransferMsg(t *testing.T) {
wasmtesting.NewIBCContractMockWasmer(myContract)),
}
coordinator = wasmibctesting.NewCoordinator(t, 2, chainAOpts)
- chainA = coordinator.GetChain(wasmibctesting.GetChainID(0))
- chainB = coordinator.GetChain(wasmibctesting.GetChainID(1))
+ chainA = coordinator.GetChain(wasmibctesting.GetChainID(1))
+ chainB = coordinator.GetChain(wasmibctesting.GetChainID(2))
)
myContractAddr := chainA.SeedNewContractInstance()
coordinator.CommitBlock(chainA, chainB)
@@ -177,6 +178,7 @@ func TestContractCanInitiateIBCTransferMsg(t *testing.T) {
ReceiverAddr: receiverAddress.String(),
}.GetBytes(),
}
+ // trigger contract to start the transfer
_, err := chainA.SendMsgs(startMsg)
require.NoError(t, err)
@@ -214,8 +216,8 @@ func TestContractCanEmulateIBCTransferMessage(t *testing.T) {
}
coordinator = wasmibctesting.NewCoordinator(t, 2, chainAOpts)
- chainA = coordinator.GetChain(wasmibctesting.GetChainID(0))
- chainB = coordinator.GetChain(wasmibctesting.GetChainID(1))
+ chainA = coordinator.GetChain(wasmibctesting.GetChainID(1))
+ chainB = coordinator.GetChain(wasmibctesting.GetChainID(2))
)
myContractAddr := chainA.SeedNewContractInstance()
myContract.contractAddr = myContractAddr.String()
@@ -289,8 +291,8 @@ func TestContractCanEmulateIBCTransferMessageWithTimeout(t *testing.T) {
}
coordinator = wasmibctesting.NewCoordinator(t, 2, chainAOpts)
- chainA = coordinator.GetChain(wasmibctesting.GetChainID(0))
- chainB = coordinator.GetChain(wasmibctesting.GetChainID(1))
+ chainA = coordinator.GetChain(wasmibctesting.GetChainID(1))
+ chainB = coordinator.GetChain(wasmibctesting.GetChainID(2))
)
coordinator.CommitBlock(chainA, chainB)
myContractAddr := chainA.SeedNewContractInstance()
@@ -375,8 +377,8 @@ func TestContractEmulateIBCTransferMessageOnDiffContractIBCChannel(t *testing.T)
coordinator = wasmibctesting.NewCoordinator(t, 2, chainAOpts)
- chainA = coordinator.GetChain(wasmibctesting.GetChainID(0))
- chainB = coordinator.GetChain(wasmibctesting.GetChainID(1))
+ chainA = coordinator.GetChain(wasmibctesting.GetChainID(1))
+ chainB = coordinator.GetChain(wasmibctesting.GetChainID(2))
)
coordinator.CommitBlock(chainA, chainB)
@@ -437,8 +439,8 @@ func TestContractHandlesChannelClose(t *testing.T) {
}
coordinator = wasmibctesting.NewCoordinator(t, 2, chainAOpts, chainBOpts)
- chainA = coordinator.GetChain(wasmibctesting.GetChainID(0))
- chainB = coordinator.GetChain(wasmibctesting.GetChainID(1))
+ chainA = coordinator.GetChain(wasmibctesting.GetChainID(1))
+ chainB = coordinator.GetChain(wasmibctesting.GetChainID(2))
)
coordinator.CommitBlock(chainA, chainB)
@@ -485,8 +487,8 @@ func TestContractHandlesChannelCloseNotOwned(t *testing.T) {
}
coordinator = wasmibctesting.NewCoordinator(t, 2, chainAOpts, chainBOpts)
- chainA = coordinator.GetChain(wasmibctesting.GetChainID(0))
- chainB = coordinator.GetChain(wasmibctesting.GetChainID(1))
+ chainA = coordinator.GetChain(wasmibctesting.GetChainID(1))
+ chainB = coordinator.GetChain(wasmibctesting.GetChainID(2))
)
coordinator.CommitBlock(chainA, chainB)
@@ -531,7 +533,7 @@ type captureCloseContract struct {
closeCalled bool
}
-func (c *captureCloseContract) IBCChannelClose(codeID wasmvm.Checksum, env wasmvmtypes.Env, msg wasmvmtypes.IBCChannelCloseMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResponse, uint64, error) {
+func (c *captureCloseContract) IBCChannelClose(_ wasmvm.Checksum, _ wasmvmtypes.Env, _ wasmvmtypes.IBCChannelCloseMsg, _ wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResponse, uint64, error) {
c.closeCalled = true
return &wasmvmtypes.IBCBasicResponse{}, 1, nil
}
@@ -544,7 +546,7 @@ type sendViaIBCTransferContract struct {
t *testing.T
}
-func (s *sendViaIBCTransferContract) Execute(code wasmvm.Checksum, env wasmvmtypes.Env, info wasmvmtypes.MessageInfo, executeMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.Response, uint64, error) {
+func (s *sendViaIBCTransferContract) Execute(_ wasmvm.Checksum, _ wasmvmtypes.Env, _ wasmvmtypes.MessageInfo, executeMsg []byte, _ wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) (*wasmvmtypes.Response, uint64, error) {
var in startTransfer
if err := json.Unmarshal(executeMsg, &in); err != nil {
return nil, 0, err
@@ -555,7 +557,7 @@ func (s *sendViaIBCTransferContract) Execute(code wasmvm.Checksum, env wasmvmtyp
Amount: wasmvmtypes.NewCoin(in.CoinsToSend.Amount.Uint64(), in.CoinsToSend.Denom),
ChannelID: in.ChannelID,
Timeout: wasmvmtypes.IBCTimeout{Block: &wasmvmtypes.IBCTimeoutBlock{
- Revision: 0,
+ Revision: 1,
Height: 110,
}},
},
@@ -574,7 +576,7 @@ type sendEmulatedIBCTransferContract struct {
contractAddr string
}
-func (s *sendEmulatedIBCTransferContract) Execute(code wasmvm.Checksum, env wasmvmtypes.Env, info wasmvmtypes.MessageInfo, executeMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.Response, uint64, error) {
+func (s *sendEmulatedIBCTransferContract) Execute(_ wasmvm.Checksum, _ wasmvmtypes.Env, info wasmvmtypes.MessageInfo, executeMsg []byte, _ wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) (*wasmvmtypes.Response, uint64, error) {
var in startTransfer
if err := json.Unmarshal(executeMsg, &in); err != nil {
return nil, 0, err
@@ -583,7 +585,7 @@ func (s *sendEmulatedIBCTransferContract) Execute(code wasmvm.Checksum, env wasm
require.Equal(s.t, in.CoinsToSend.Amount.String(), info.Funds[0].Amount)
require.Equal(s.t, in.CoinsToSend.Denom, info.Funds[0].Denom)
dataPacket := ibctransfertypes.NewFungibleTokenPacketData(
- in.CoinsToSend.Denom, in.CoinsToSend.Amount.String(), info.Sender, in.ReceiverAddr,
+ in.CoinsToSend.Denom, in.CoinsToSend.Amount.String(), info.Sender, in.ReceiverAddr, "memo",
)
if err := dataPacket.ValidateBasic(); err != nil {
return nil, 0, err
@@ -599,7 +601,7 @@ func (s *sendEmulatedIBCTransferContract) Execute(code wasmvm.Checksum, env wasm
return &wasmvmtypes.Response{Messages: []wasmvmtypes.SubMsg{{ReplyOn: wasmvmtypes.ReplyNever, Msg: wasmvmtypes.CosmosMsg{IBC: ibcMsg}}}}, 0, nil
}
-func (c *sendEmulatedIBCTransferContract) IBCPacketTimeout(codeID wasmvm.Checksum, env wasmvmtypes.Env, msg wasmvmtypes.IBCPacketTimeoutMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResponse, uint64, error) {
+func (s *sendEmulatedIBCTransferContract) IBCPacketTimeout(_ wasmvm.Checksum, _ wasmvmtypes.Env, msg wasmvmtypes.IBCPacketTimeoutMsg, _ wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResponse, uint64, error) {
packet := msg.Packet
var data ibctransfertypes.FungibleTokenPacketData
@@ -625,14 +627,13 @@ var _ wasmtesting.IBCContractCallbacks = &closeChannelContract{}
type closeChannelContract struct {
contractStub
- t *testing.T
}
-func (c *closeChannelContract) IBCChannelClose(codeID wasmvm.Checksum, env wasmvmtypes.Env, msg wasmvmtypes.IBCChannelCloseMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResponse, uint64, error) {
+func (c *closeChannelContract) IBCChannelClose(_ wasmvm.Checksum, _ wasmvmtypes.Env, _ wasmvmtypes.IBCChannelCloseMsg, _ wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResponse, uint64, error) {
return &wasmvmtypes.IBCBasicResponse{}, 1, nil
}
-func (s *closeChannelContract) Execute(code wasmvm.Checksum, env wasmvmtypes.Env, info wasmvmtypes.MessageInfo, executeMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.Response, uint64, error) {
+func (c *closeChannelContract) Execute(_ wasmvm.Checksum, _ wasmvmtypes.Env, _ wasmvmtypes.MessageInfo, executeMsg []byte, _ wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) (*wasmvmtypes.Response, uint64, error) {
var in closeIBCChannel
if err := json.Unmarshal(executeMsg, &in); err != nil {
return nil, 0, err
@@ -684,7 +685,7 @@ type ackReceiverContract struct {
chain *wasmibctesting.TestChain
}
-func (c *ackReceiverContract) IBCPacketReceive(codeID wasmvm.Checksum, env wasmvmtypes.Env, msg wasmvmtypes.IBCPacketReceiveMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBCReceiveResult, uint64, error) {
+func (c *ackReceiverContract) IBCPacketReceive(_ wasmvm.Checksum, _ wasmvmtypes.Env, msg wasmvmtypes.IBCPacketReceiveMsg, _ wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) (*wasmvmtypes.IBCReceiveResult, uint64, error) {
packet := msg.Packet
var src ibctransfertypes.FungibleTokenPacketData
@@ -698,7 +699,7 @@ func (c *ackReceiverContract) IBCPacketReceive(codeID wasmvm.Checksum, env wasmv
ctx := c.chain.GetContext() // HACK: please note that this is not reverted after checkTX
err := c.chain.App.TransferKeeper.OnRecvPacket(ctx, ibcPacket, src)
if err != nil {
- return nil, 0, sdkerrors.Wrap(err, "within our smart contract")
+ return nil, 0, errorsmod.Wrap(err, "within our smart contract")
}
var log []wasmvmtypes.EventAttribute // note: all events are under `wasm` event type
@@ -706,7 +707,7 @@ func (c *ackReceiverContract) IBCPacketReceive(codeID wasmvm.Checksum, env wasmv
return &wasmvmtypes.IBCReceiveResult{Ok: &wasmvmtypes.IBCReceiveResponse{Acknowledgement: ack, Attributes: log}}, 0, nil
}
-func (c *ackReceiverContract) IBCPacketAck(codeID wasmvm.Checksum, env wasmvmtypes.Env, msg wasmvmtypes.IBCPacketAckMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResponse, uint64, error) {
+func (c *ackReceiverContract) IBCPacketAck(_ wasmvm.Checksum, _ wasmvmtypes.Env, msg wasmvmtypes.IBCPacketAckMsg, _ wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResponse, uint64, error) {
var data ibctransfertypes.FungibleTokenPacketData
if err := ibctransfertypes.ModuleCdc.UnmarshalJSON(msg.OriginalPacket.Data, &data); err != nil {
return nil, 0, err
@@ -723,7 +724,7 @@ func (c *ackReceiverContract) IBCPacketAck(codeID wasmvm.Checksum, env wasmvmtyp
ibcPacket := toIBCPacket(msg.OriginalPacket)
err := c.chain.App.TransferKeeper.OnAcknowledgementPacket(ctx, ibcPacket, data, ack)
if err != nil {
- return nil, 0, sdkerrors.Wrap(err, "within our smart contract")
+ return nil, 0, errorsmod.Wrap(err, "within our smart contract")
}
return &wasmvmtypes.IBCBasicResponse{}, 0, nil
@@ -735,7 +736,7 @@ type nackReceiverContract struct {
t *testing.T
}
-func (c *nackReceiverContract) IBCPacketReceive(codeID wasmvm.Checksum, env wasmvmtypes.Env, msg wasmvmtypes.IBCPacketReceiveMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBCReceiveResult, uint64, error) {
+func (c *nackReceiverContract) IBCPacketReceive(_ wasmvm.Checksum, _ wasmvmtypes.Env, msg wasmvmtypes.IBCPacketReceiveMsg, _ wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) (*wasmvmtypes.IBCReceiveResult, uint64, error) {
packet := msg.Packet
var src ibctransfertypes.FungibleTokenPacketData
@@ -752,7 +753,7 @@ type errorReceiverContract struct {
t *testing.T
}
-func (c *errorReceiverContract) IBCPacketReceive(codeID wasmvm.Checksum, env wasmvmtypes.Env, msg wasmvmtypes.IBCPacketReceiveMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBCReceiveResult, uint64, error) {
+func (c *errorReceiverContract) IBCPacketReceive(_ wasmvm.Checksum, _ wasmvmtypes.Env, msg wasmvmtypes.IBCPacketReceiveMsg, _ wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) (*wasmvmtypes.IBCReceiveResult, uint64, error) {
packet := msg.Packet
var src ibctransfertypes.FungibleTokenPacketData
@@ -766,27 +767,27 @@ func (c *errorReceiverContract) IBCPacketReceive(codeID wasmvm.Checksum, env was
// simple helper struct that implements connection setup methods.
type contractStub struct{}
-func (s *contractStub) IBCChannelOpen(codeID wasmvm.Checksum, env wasmvmtypes.Env, msg wasmvmtypes.IBCChannelOpenMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBC3ChannelOpenResponse, uint64, error) {
+func (s *contractStub) IBCChannelOpen(_ wasmvm.Checksum, _ wasmvmtypes.Env, _ wasmvmtypes.IBCChannelOpenMsg, _ wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) (*wasmvmtypes.IBC3ChannelOpenResponse, uint64, error) {
return &wasmvmtypes.IBC3ChannelOpenResponse{}, 0, nil
}
-func (s *contractStub) IBCChannelConnect(codeID wasmvm.Checksum, env wasmvmtypes.Env, msg wasmvmtypes.IBCChannelConnectMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResponse, uint64, error) {
+func (s *contractStub) IBCChannelConnect(_ wasmvm.Checksum, _ wasmvmtypes.Env, _ wasmvmtypes.IBCChannelConnectMsg, _ wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResponse, uint64, error) {
return &wasmvmtypes.IBCBasicResponse{}, 0, nil
}
-func (s *contractStub) IBCChannelClose(codeID wasmvm.Checksum, env wasmvmtypes.Env, msg wasmvmtypes.IBCChannelCloseMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResponse, uint64, error) {
+func (s *contractStub) IBCChannelClose(_ wasmvm.Checksum, _ wasmvmtypes.Env, _ wasmvmtypes.IBCChannelCloseMsg, _ wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResponse, uint64, error) {
panic("implement me")
}
-func (s *contractStub) IBCPacketReceive(codeID wasmvm.Checksum, env wasmvmtypes.Env, msg wasmvmtypes.IBCPacketReceiveMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBCReceiveResult, uint64, error) {
+func (s *contractStub) IBCPacketReceive(_ wasmvm.Checksum, _ wasmvmtypes.Env, _ wasmvmtypes.IBCPacketReceiveMsg, _ wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) (*wasmvmtypes.IBCReceiveResult, uint64, error) {
panic("implement me")
}
-func (s *contractStub) IBCPacketAck(codeID wasmvm.Checksum, env wasmvmtypes.Env, msg wasmvmtypes.IBCPacketAckMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResponse, uint64, error) {
+func (s *contractStub) IBCPacketAck(_ wasmvm.Checksum, _ wasmvmtypes.Env, _ wasmvmtypes.IBCPacketAckMsg, _ wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResponse, uint64, error) {
return &wasmvmtypes.IBCBasicResponse{}, 0, nil
}
-func (s *contractStub) IBCPacketTimeout(codeID wasmvm.Checksum, env wasmvmtypes.Env, msg wasmvmtypes.IBCPacketTimeoutMsg, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResponse, uint64, error) {
+func (s *contractStub) IBCPacketTimeout(_ wasmvm.Checksum, _ wasmvmtypes.Env, _ wasmvmtypes.IBCPacketTimeoutMsg, _ wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResponse, uint64, error) {
panic("implement me")
}
diff --git a/x/wasm/simulation/operations.go b/x/wasm/simulation/operations.go
index 34e7ef35d5..06c430eab7 100644
--- a/x/wasm/simulation/operations.go
+++ b/x/wasm/simulation/operations.go
@@ -5,13 +5,16 @@ import (
"math/rand"
"os"
+ errorsmod "cosmossdk.io/errors"
+
wasmvmtypes "github.com/CosmWasm/wasmvm/types"
"github.com/cosmos/cosmos-sdk/baseapp"
- simappparams "github.com/cosmos/cosmos-sdk/simapp/params"
+ "github.com/cosmos/cosmos-sdk/codec"
+ codectypes "github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
- sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/types/module"
simtypes "github.com/cosmos/cosmos-sdk/types/simulation"
+ "github.com/cosmos/cosmos-sdk/x/auth/tx"
"github.com/cosmos/cosmos-sdk/x/simulation"
"github.com/CosmWasm/wasmd/app/params"
@@ -109,11 +112,10 @@ func WeightedOperations(
panic(err)
}
}
-
return simulation.WeightedOperations{
simulation.NewWeightedOperation(
weightMsgStoreCode,
- SimulateMsgStoreCode(ak, bk, wasmKeeper, wasmBz, 5_000_000),
+ SimulateMsgStoreCode(ak, bk, wasmKeeper, wasmBz),
),
simulation.NewWeightedOperation(
weightMsgInstantiateContract,
@@ -322,7 +324,12 @@ func SimulateMsgUpdateAmin(
}
// SimulateMsgStoreCode generates a MsgStoreCode with random values
-func SimulateMsgStoreCode(ak types.AccountKeeper, bk BankKeeper, wasmKeeper WasmKeeper, wasmBz []byte, gas uint64) simtypes.Operation {
+func SimulateMsgStoreCode(
+ ak types.AccountKeeper,
+ bk BankKeeper,
+ wasmKeeper WasmKeeper,
+ wasmBz []byte,
+) simtypes.Operation {
return func(
r *rand.Rand,
app *baseapp.BaseApp,
@@ -345,7 +352,7 @@ func SimulateMsgStoreCode(ak types.AccountKeeper, bk BankKeeper, wasmKeeper Wasm
InstantiatePermission: &config,
}
txCtx := BuildOperationInput(r, app, ctx, &msg, simAccount, ak, bk, nil)
- return GenAndDeliverTxWithRandFees(txCtx, gas)
+ return simulation.GenAndDeliverTxWithRandFees(txCtx)
}
}
@@ -366,7 +373,12 @@ func DefaultSimulationCodeIDSelector(ctx sdk.Context, wasmKeeper WasmKeeper) uin
}
// SimulateMsgInstantiateContract generates a MsgInstantiateContract with random values
-func SimulateMsgInstantiateContract(ak types.AccountKeeper, bk BankKeeper, wasmKeeper WasmKeeper, codeSelector CodeIDSelector) simtypes.Operation {
+func SimulateMsgInstantiateContract(
+ ak types.AccountKeeper,
+ bk BankKeeper,
+ wasmKeeper WasmKeeper,
+ codeSelector CodeIDSelector,
+) simtypes.Operation {
return func(
r *rand.Rand,
app *baseapp.BaseApp,
@@ -475,10 +487,12 @@ func BuildOperationInput(
bk BankKeeper,
deposit sdk.Coins,
) simulation.OperationInput {
+ interfaceRegistry := codectypes.NewInterfaceRegistry()
+ txConfig := tx.NewTxConfig(codec.NewProtoCodec(interfaceRegistry), tx.DefaultSignModes)
return simulation.OperationInput{
R: r,
App: app,
- TxGen: simappparams.MakeTestEncodingConfig().TxConfig,
+ TxGen: txConfig,
Cdc: nil,
Msg: msg,
MsgType: msg.Type(),
@@ -506,23 +520,23 @@ func DefaultSimulationExecuteSenderSelector(wasmKeeper WasmKeeper, ctx sdk.Conte
var none simtypes.Account
bz, err := json.Marshal(testdata.ReflectQueryMsg{Owner: &struct{}{}})
if err != nil {
- return none, sdkerrors.Wrap(err, "build smart query")
+ return none, errorsmod.Wrap(err, "build smart query")
}
got, err := wasmKeeper.QuerySmart(ctx, contractAddr, bz)
if err != nil {
- return none, sdkerrors.Wrap(err, "exec smart query")
+ return none, errorsmod.Wrap(err, "exec smart query")
}
var ownerRes testdata.OwnerResponse
if err := json.Unmarshal(got, &ownerRes); err != nil || ownerRes.Owner == "" {
- return none, sdkerrors.Wrap(err, "parse smart query response")
+ return none, errorsmod.Wrap(err, "parse smart query response")
}
ownerAddr, err := sdk.AccAddressFromBech32(ownerRes.Owner)
if err != nil {
- return none, sdkerrors.Wrap(err, "parse contract owner address")
+ return none, errorsmod.Wrap(err, "parse contract owner address")
}
simAccount, ok := simtypes.FindAccount(accs, ownerAddr)
if !ok {
- return none, sdkerrors.Wrap(err, "unknown contract owner address")
+ return none, errorsmod.Wrap(err, "unknown contract owner address")
}
return simAccount, nil
}
diff --git a/x/wasm/simulation/params.go b/x/wasm/simulation/params.go
deleted file mode 100644
index a6d55b1541..0000000000
--- a/x/wasm/simulation/params.go
+++ /dev/null
@@ -1,32 +0,0 @@
-package simulation
-
-import (
- "fmt"
- "math/rand"
-
- "github.com/cosmos/cosmos-sdk/codec"
- simtypes "github.com/cosmos/cosmos-sdk/types/simulation"
- "github.com/cosmos/cosmos-sdk/x/simulation"
-
- "github.com/CosmWasm/wasmd/x/wasm/types"
-)
-
-func ParamChanges(r *rand.Rand, cdc codec.Codec) []simtypes.ParamChange {
- params := types.DefaultParams()
- return []simtypes.ParamChange{
- simulation.NewSimParamChange(types.ModuleName, string(types.ParamStoreKeyUploadAccess),
- func(r *rand.Rand) string {
- jsonBz, err := cdc.MarshalJSON(¶ms.CodeUploadAccess)
- if err != nil {
- panic(err)
- }
- return string(jsonBz)
- },
- ),
- simulation.NewSimParamChange(types.ModuleName, string(types.ParamStoreKeyInstantiateAccess),
- func(r *rand.Rand) string {
- return fmt.Sprintf("%q", params.CodeUploadAccess.Permission.String())
- },
- ),
- }
-}
diff --git a/x/wasm/simulation/proposals.go b/x/wasm/simulation/proposals.go
index 7c1582b467..880e6cf371 100644
--- a/x/wasm/simulation/proposals.go
+++ b/x/wasm/simulation/proposals.go
@@ -123,6 +123,8 @@ func ProposalContents(bk BankKeeper, wasmKeeper WasmKeeper) []simtypes.WeightedP
// simulate store code proposal (unused now)
// Current problem: out of gas (defaul gaswanted config of gov SimulateMsgSubmitProposal is 10_000_000)
// but this proposal may need more than it
+//
+
func SimulateStoreCodeProposal(wasmKeeper WasmKeeper) simtypes.ContentSimulatorFn {
return func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) simtypes.Content {
simAccount, _ := simtypes.RandomAcc(r, accs)
@@ -146,7 +148,7 @@ func SimulateStoreCodeProposal(wasmKeeper WasmKeeper) simtypes.ContentSimulatorF
}
// Simulate instantiate contract proposal
-func SimulateInstantiateContractProposal(bk BankKeeper, wasmKeeper WasmKeeper, codeSelector CodeIDSelector) simtypes.ContentSimulatorFn {
+func SimulateInstantiateContractProposal(_ BankKeeper, wasmKeeper WasmKeeper, codeSelector CodeIDSelector) simtypes.ContentSimulatorFn {
return func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) simtypes.Content {
simAccount, _ := simtypes.RandomAcc(r, accs)
// admin
@@ -171,8 +173,10 @@ func SimulateInstantiateContractProposal(bk BankKeeper, wasmKeeper WasmKeeper, c
}
// Simulate execute contract proposal
+//
+
func SimulateExecuteContractProposal(
- bk BankKeeper,
+ _ BankKeeper,
wasmKeeper WasmKeeper,
contractSelector MsgExecuteContractSelector,
senderSelector MsgExecuteSenderSelector,
@@ -231,6 +235,8 @@ func DefaultSimulateUpdateAdminProposalContractSelector(
}
// Simulate update admin contract proposal
+//
+
func SimulateUpdateAdminProposal(wasmKeeper WasmKeeper, contractSelector UpdateAdminContractSelector) simtypes.ContentSimulatorFn {
return func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) simtypes.Content {
simAccount, _ := simtypes.RandomAcc(r, accs)
@@ -263,6 +269,8 @@ func DefaultSimulateContractSelector(
}
// Simulate clear admin proposal
+//
+
func SimulateClearAdminProposal(wasmKeeper WasmKeeper, contractSelector ClearAdminContractSelector) simtypes.ContentSimulatorFn {
return func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) simtypes.Content {
ctAddress := contractSelector(ctx, wasmKeeper)
@@ -281,6 +289,8 @@ func SimulateClearAdminProposal(wasmKeeper WasmKeeper, contractSelector ClearAdm
type MigrateContractProposalContractSelector func(sdk.Context, WasmKeeper) sdk.AccAddress
// Simulate migrate contract proposal
+//
+
func SimulateMigrateContractProposal(wasmKeeper WasmKeeper, contractSelector MigrateContractProposalContractSelector, codeSelector CodeIDSelector) simtypes.ContentSimulatorFn {
return func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) simtypes.Content {
ctAddress := contractSelector(ctx, wasmKeeper)
@@ -306,6 +316,8 @@ func SimulateMigrateContractProposal(wasmKeeper WasmKeeper, contractSelector Mig
type SudoContractProposalContractSelector func(sdk.Context, WasmKeeper) sdk.AccAddress
// Simulate sudo contract proposal
+//
+
func SimulateSudoContractProposal(wasmKeeper WasmKeeper, contractSelector SudoContractProposalContractSelector) simtypes.ContentSimulatorFn {
return func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) simtypes.Content {
ctAddress := contractSelector(ctx, wasmKeeper)
@@ -323,6 +335,8 @@ func SimulateSudoContractProposal(wasmKeeper WasmKeeper, contractSelector SudoCo
}
// Simulate pin contract proposal
+//
+
func SimulatePinContractProposal(wasmKeeper WasmKeeper, codeSelector CodeIDSelector) simtypes.ContentSimulatorFn {
return func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) simtypes.Content {
codeID := codeSelector(ctx, wasmKeeper)
@@ -339,6 +353,8 @@ func SimulatePinContractProposal(wasmKeeper WasmKeeper, codeSelector CodeIDSelec
}
// Simulate unpin contract proposal
+//
+
func SimulateUnpinContractProposal(wasmKeeper WasmKeeper, codeSelector CodeIDSelector) simtypes.ContentSimulatorFn {
return func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) simtypes.Content {
codeID := codeSelector(ctx, wasmKeeper)
@@ -355,6 +371,8 @@ func SimulateUnpinContractProposal(wasmKeeper WasmKeeper, codeSelector CodeIDSel
}
// Simulate update instantiate config proposal
+//
+
func SimulateUpdateInstantiateConfigProposal(wasmKeeper WasmKeeper, codeSelector CodeIDSelector) simtypes.ContentSimulatorFn {
return func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) simtypes.Content {
codeID := codeSelector(ctx, wasmKeeper)
diff --git a/x/wasm/simulation/sim_utils.go b/x/wasm/simulation/sim_utils.go
deleted file mode 100644
index 4f9a00b0bf..0000000000
--- a/x/wasm/simulation/sim_utils.go
+++ /dev/null
@@ -1,53 +0,0 @@
-package simulation
-
-import (
- "github.com/cosmos/cosmos-sdk/simapp/helpers"
- sdk "github.com/cosmos/cosmos-sdk/types"
- simtypes "github.com/cosmos/cosmos-sdk/types/simulation"
- "github.com/cosmos/cosmos-sdk/x/simulation"
-)
-
-// GenAndDeliverTxWithRandFees generates a transaction with a random fee and delivers it.
-func GenAndDeliverTxWithRandFees(txCtx simulation.OperationInput, gas uint64) (simtypes.OperationMsg, []simtypes.FutureOperation, error) {
- account := txCtx.AccountKeeper.GetAccount(txCtx.Context, txCtx.SimAccount.Address)
- spendable := txCtx.Bankkeeper.SpendableCoins(txCtx.Context, account.GetAddress())
-
- var fees sdk.Coins
- var err error
-
- coins, hasNeg := spendable.SafeSub(txCtx.CoinsSpentInMsg)
- if hasNeg {
- return simtypes.NoOpMsg(txCtx.ModuleName, txCtx.MsgType, "message doesn't leave room for fees"), nil, err
- }
-
- fees, err = simtypes.RandomFees(txCtx.R, txCtx.Context, coins)
- if err != nil {
- return simtypes.NoOpMsg(txCtx.ModuleName, txCtx.MsgType, "unable to generate fees"), nil, err
- }
- return GenAndDeliverTx(txCtx, fees, gas)
-}
-
-// GenAndDeliverTx generates a transactions and delivers it.
-func GenAndDeliverTx(txCtx simulation.OperationInput, fees sdk.Coins, gas uint64) (simtypes.OperationMsg, []simtypes.FutureOperation, error) {
- account := txCtx.AccountKeeper.GetAccount(txCtx.Context, txCtx.SimAccount.Address)
- tx, err := helpers.GenTx(
- txCtx.TxGen,
- []sdk.Msg{txCtx.Msg},
- fees,
- gas,
- txCtx.Context.ChainID(),
- []uint64{account.GetAccountNumber()},
- []uint64{account.GetSequence()},
- txCtx.SimAccount.PrivKey,
- )
- if err != nil {
- return simtypes.NoOpMsg(txCtx.ModuleName, txCtx.MsgType, "unable to generate mock tx"), nil, err
- }
-
- _, _, err = txCtx.App.Deliver(txCtx.TxGen.TxEncoder(), tx)
- if err != nil {
- return simtypes.NoOpMsg(txCtx.ModuleName, txCtx.MsgType, "unable to deliver tx"), nil, err
- }
-
- return simtypes.NewOperationMsg(txCtx.Msg, true, "", txCtx.Cdc), nil, nil
-}
diff --git a/x/wasm/types/authz.go b/x/wasm/types/authz.go
index 10dd2606c9..9692088710 100644
--- a/x/wasm/types/authz.go
+++ b/x/wasm/types/authz.go
@@ -3,13 +3,12 @@ package types
import (
"strings"
- "github.com/gogo/protobuf/proto"
-
+ errorsmod "cosmossdk.io/errors"
cdctypes "github.com/cosmos/cosmos-sdk/codec/types"
-
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
authztypes "github.com/cosmos/cosmos-sdk/x/authz"
+ "github.com/cosmos/gogoproto/proto"
)
const gasDeserializationCostPerByte = uint64(1)
@@ -109,7 +108,7 @@ func validateGrants(g []ContractGrant) error {
}
for i, v := range g {
if err := v.ValidateBasic(); err != nil {
- return sdkerrors.Wrapf(err, "position %d", i)
+ return errorsmod.Wrapf(err, "position %d", i)
}
}
// allow multiple grants for a contract:
@@ -146,7 +145,7 @@ func AcceptGrantedMessage[T AuthzableWasmMsg](ctx sdk.Context, grants []Contract
result, err := g.GetLimit().Accept(ctx, exec)
switch {
case err != nil:
- return authztypes.AcceptResponse{}, sdkerrors.Wrap(err, "limit")
+ return authztypes.AcceptResponse{}, errorsmod.Wrap(err, "limit")
case result == nil: // sanity check
return authztypes.AcceptResponse{}, sdkerrors.ErrInvalidType.Wrap("limit result must not be nil")
case !result.Accepted:
@@ -158,7 +157,7 @@ func AcceptGrantedMessage[T AuthzableWasmMsg](ctx sdk.Context, grants []Contract
ok, err := g.GetFilter().Accept(ctx, exec.GetMsg())
switch {
case err != nil:
- return authztypes.AcceptResponse{}, sdkerrors.Wrap(err, "filter")
+ return authztypes.AcceptResponse{}, errorsmod.Wrap(err, "filter")
case !ok:
// no limit update and continue with next grant
continue
@@ -229,7 +228,7 @@ func NewContractGrant(contract sdk.AccAddress, limit ContractAuthzLimitX, filter
}
anyFilter, err := cdctypes.NewAnyWithValue(pFilter)
if err != nil {
- return nil, sdkerrors.Wrap(err, "filter")
+ return nil, errorsmod.Wrap(err, "filter")
}
return ContractGrant{
Contract: contract.String(),
@@ -245,7 +244,7 @@ func (g ContractGrant) WithNewLimits(limit ContractAuthzLimitX) (*ContractGrant,
}
anyLimit, err := cdctypes.NewAnyWithValue(pLimit)
if err != nil {
- return nil, sdkerrors.Wrap(err, "limit")
+ return nil, errorsmod.Wrap(err, "limit")
}
return &ContractGrant{
@@ -259,11 +258,11 @@ func (g ContractGrant) WithNewLimits(limit ContractAuthzLimitX) (*ContractGrant,
func (g ContractGrant) UnpackInterfaces(unpacker cdctypes.AnyUnpacker) error {
var f ContractAuthzFilterX
if err := unpacker.UnpackAny(g.Filter, &f); err != nil {
- return sdkerrors.Wrap(err, "filter")
+ return errorsmod.Wrap(err, "filter")
}
var l ContractAuthzLimitX
if err := unpacker.UnpackAny(g.Limit, &l); err != nil {
- return sdkerrors.Wrap(err, "limit")
+ return errorsmod.Wrap(err, "limit")
}
return nil
}
@@ -295,15 +294,15 @@ func (g ContractGrant) GetFilter() ContractAuthzFilterX {
// ValidateBasic validates the grant
func (g ContractGrant) ValidateBasic() error {
if _, err := sdk.AccAddressFromBech32(g.Contract); err != nil {
- return sdkerrors.Wrap(err, "contract")
+ return errorsmod.Wrap(err, "contract")
}
// execution limits
if err := g.GetLimit().ValidateBasic(); err != nil {
- return sdkerrors.Wrap(err, "limit")
+ return errorsmod.Wrap(err, "limit")
}
// filter
if err := g.GetFilter().ValidateBasic(); err != nil {
- return sdkerrors.Wrap(err, "filter")
+ return errorsmod.Wrap(err, "filter")
}
return nil
}
@@ -312,7 +311,7 @@ func (g ContractGrant) ValidateBasic() error {
type UndefinedFilter struct{}
// Accept always returns error
-func (f *UndefinedFilter) Accept(ctx sdk.Context, msg RawContractMessage) (bool, error) {
+func (f *UndefinedFilter) Accept(_ sdk.Context, _ RawContractMessage) (bool, error) {
return false, sdkerrors.ErrNotFound.Wrapf("undefined filter")
}
@@ -327,7 +326,7 @@ func NewAllowAllMessagesFilter() *AllowAllMessagesFilter {
}
// Accept accepts any valid json message content.
-func (f *AllowAllMessagesFilter) Accept(ctx sdk.Context, msg RawContractMessage) (bool, error) {
+func (f *AllowAllMessagesFilter) Accept(_ sdk.Context, msg RawContractMessage) (bool, error) {
return true, msg.ValidateBasic()
}
@@ -380,7 +379,7 @@ func NewAcceptedMessagesFilter(msgs ...RawContractMessage) *AcceptedMessagesFilt
}
// Accept only payload messages which are equal to the granted one.
-func (f *AcceptedMessagesFilter) Accept(ctx sdk.Context, msg RawContractMessage) (bool, error) {
+func (f *AcceptedMessagesFilter) Accept(_ sdk.Context, msg RawContractMessage) (bool, error) {
for _, v := range f.Messages {
if v.Equal(msg) {
return true, nil
@@ -426,7 +425,7 @@ func (u UndefinedLimit) ValidateBasic() error {
}
// Accept always returns error
-func (u UndefinedLimit) Accept(ctx sdk.Context, msg AuthzableWasmMsg) (*ContractAuthzLimitAcceptResult, error) {
+func (u UndefinedLimit) Accept(_ sdk.Context, _ AuthzableWasmMsg) (*ContractAuthzLimitAcceptResult, error) {
return nil, sdkerrors.ErrNotFound.Wrapf("undefined filter")
}
@@ -472,7 +471,7 @@ func (m MaxFundsLimit) Accept(_ sdk.Context, msg AuthzableWasmMsg) (*ContractAut
if !msg.GetFunds().IsAllLTE(m.Amounts) {
return &ContractAuthzLimitAcceptResult{Accepted: false}, nil
}
- newAmounts := m.Amounts.Sub(msg.GetFunds())
+ newAmounts := m.Amounts.Sub(msg.GetFunds()...)
if newAmounts.IsZero() {
return &ContractAuthzLimitAcceptResult{Accepted: true, DeleteLimit: true}, nil
}
@@ -508,7 +507,7 @@ func (l CombinedLimit) Accept(_ sdk.Context, msg AuthzableWasmMsg) (*ContractAut
case 1:
return &ContractAuthzLimitAcceptResult{Accepted: true, DeleteLimit: true}, nil
default:
- remainingAmounts := l.Amounts.Sub(transferFunds)
+ remainingAmounts := l.Amounts.Sub(transferFunds...)
if remainingAmounts.IsZero() {
return &ContractAuthzLimitAcceptResult{Accepted: true, DeleteLimit: true}, nil
}
@@ -528,7 +527,7 @@ func (l CombinedLimit) ValidateBasic() error {
return ErrEmpty.Wrap("amounts")
}
if err := l.Amounts.Validate(); err != nil {
- return sdkerrors.Wrap(err, "amounts")
+ return errorsmod.Wrap(err, "amounts")
}
return nil
}
diff --git a/x/wasm/types/authz.pb.go b/x/wasm/types/authz.pb.go
index 2564a91a6d..6727811568 100644
--- a/x/wasm/types/authz.pb.go
+++ b/x/wasm/types/authz.pb.go
@@ -14,7 +14,7 @@ import (
github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types"
types1 "github.com/cosmos/cosmos-sdk/types"
_ "github.com/cosmos/gogoproto/gogoproto"
- proto "github.com/gogo/protobuf/proto"
+ proto "github.com/cosmos/gogoproto/proto"
)
// Reference imports to suppress errors if they are not otherwise used.
diff --git a/x/wasm/types/authz_test.go b/x/wasm/types/authz_test.go
index 06747693fc..79d279b258 100644
--- a/x/wasm/types/authz_test.go
+++ b/x/wasm/types/authz_test.go
@@ -4,6 +4,7 @@ import (
"math"
"testing"
+ errorsmod "cosmossdk.io/errors"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
authztypes "github.com/cosmos/cosmos-sdk/x/authz"
@@ -539,7 +540,7 @@ func TestAcceptGrantedMessage(t *testing.T) {
auth authztypes.Authorization
msg sdk.Msg
expResult authztypes.AcceptResponse
- expErr *sdkerrors.Error
+ expErr *errorsmod.Error
}{
"accepted and updated - contract execution": {
auth: NewContractExecutionAuthorization(mustGrant(myContractAddr, NewMaxCallsLimit(2), NewAllowAllMessagesFilter())),
diff --git a/x/wasm/types/codec.go b/x/wasm/types/codec.go
index 7d8ebcbe46..d486ea60e2 100644
--- a/x/wasm/types/codec.go
+++ b/x/wasm/types/codec.go
@@ -7,11 +7,14 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/msgservice"
"github.com/cosmos/cosmos-sdk/x/authz"
- govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
+ authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec"
+ govcodec "github.com/cosmos/cosmos-sdk/x/gov/codec"
+ "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
+ groupcodec "github.com/cosmos/cosmos-sdk/x/group/codec"
)
// RegisterLegacyAminoCodec registers the account types and interface
-func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { //nolint:staticcheck
+func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
cdc.RegisterConcrete(&MsgStoreCode{}, "wasm/MsgStoreCode", nil)
cdc.RegisterConcrete(&MsgInstantiateContract{}, "wasm/MsgInstantiateContract", nil)
cdc.RegisterConcrete(&MsgInstantiateContract2{}, "wasm/MsgInstantiateContract2", nil)
@@ -20,6 +23,7 @@ func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { //nolint:staticcheck
cdc.RegisterConcrete(&MsgUpdateAdmin{}, "wasm/MsgUpdateAdmin", nil)
cdc.RegisterConcrete(&MsgClearAdmin{}, "wasm/MsgClearAdmin", nil)
cdc.RegisterConcrete(&MsgUpdateInstantiateConfig{}, "wasm/MsgUpdateInstantiateConfig", nil)
+ cdc.RegisterConcrete(&MsgUpdateParams{}, "wasm/MsgUpdateParams", nil)
cdc.RegisterConcrete(&PinCodesProposal{}, "wasm/PinCodesProposal", nil)
cdc.RegisterConcrete(&UnpinCodesProposal{}, "wasm/UnpinCodesProposal", nil)
@@ -63,9 +67,10 @@ func RegisterInterfaces(registry types.InterfaceRegistry) {
&MsgIBCCloseChannel{},
&MsgIBCSend{},
&MsgUpdateInstantiateConfig{},
+ &MsgUpdateParams{},
)
registry.RegisterImplementations(
- (*govtypes.Content)(nil),
+ (*v1beta1.Content)(nil),
&StoreCodeProposal{},
&InstantiateContractProposal{},
&InstantiateContract2Proposal{},
@@ -80,9 +85,9 @@ func RegisterInterfaces(registry types.InterfaceRegistry) {
&StoreAndInstantiateContractProposal{},
)
- registry.RegisterInterface("ContractInfoExtension", (*ContractInfoExtension)(nil))
+ registry.RegisterInterface("cosmwasm.wasm.v1.ContractInfoExtension", (*ContractInfoExtension)(nil))
- registry.RegisterInterface("ContractAuthzFilterX", (*ContractAuthzFilterX)(nil))
+ registry.RegisterInterface("cosmwasm.wasm.v1.ContractAuthzFilterX", (*ContractAuthzFilterX)(nil))
registry.RegisterImplementations(
(*ContractAuthzFilterX)(nil),
&AllowAllMessagesFilter{},
@@ -90,7 +95,7 @@ func RegisterInterfaces(registry types.InterfaceRegistry) {
&AcceptedMessagesFilter{},
)
- registry.RegisterInterface("ContractAuthzLimitX", (*ContractAuthzLimitX)(nil))
+ registry.RegisterInterface("cosmwasm.wasm.v1.ContractAuthzLimitX", (*ContractAuthzLimitX)(nil))
registry.RegisterImplementations(
(*ContractAuthzLimitX)(nil),
&MaxCallsLimit{},
@@ -119,4 +124,10 @@ func init() {
RegisterLegacyAminoCodec(amino)
cryptocodec.RegisterCrypto(amino)
amino.Seal()
+
+ // Register all Amino interfaces and concrete types on the authz and gov Amino codec so that this can later be
+ // used to properly serialize MsgGrant, MsgExec and MsgSubmitProposal instances
+ RegisterLegacyAminoCodec(authzcodec.Amino)
+ RegisterLegacyAminoCodec(govcodec.Amino)
+ RegisterLegacyAminoCodec(groupcodec.Amino)
}
diff --git a/x/wasm/types/errors.go b/x/wasm/types/errors.go
index 297f34d530..378c25d67b 100644
--- a/x/wasm/types/errors.go
+++ b/x/wasm/types/errors.go
@@ -1,8 +1,8 @@
package types
import (
+ errorsmod "cosmossdk.io/errors"
wasmvmtypes "github.com/CosmWasm/wasmvm/types"
- sdkErrors "github.com/cosmos/cosmos-sdk/types/errors"
)
// Codes for wasm contract errors
@@ -12,77 +12,77 @@ var (
// Note: never use code 1 for any errors - that is reserved for ErrInternal in the core cosmos sdk
// ErrCreateFailed error for wasm code that has already been uploaded or failed
- ErrCreateFailed = sdkErrors.Register(DefaultCodespace, 2, "create wasm contract failed")
+ ErrCreateFailed = errorsmod.Register(DefaultCodespace, 2, "create wasm contract failed")
// ErrAccountExists error for a contract account that already exists
- ErrAccountExists = sdkErrors.Register(DefaultCodespace, 3, "contract account already exists")
+ ErrAccountExists = errorsmod.Register(DefaultCodespace, 3, "contract account already exists")
// ErrInstantiateFailed error for rust instantiate contract failure
- ErrInstantiateFailed = sdkErrors.Register(DefaultCodespace, 4, "instantiate wasm contract failed")
+ ErrInstantiateFailed = errorsmod.Register(DefaultCodespace, 4, "instantiate wasm contract failed")
// ErrExecuteFailed error for rust execution contract failure
- ErrExecuteFailed = sdkErrors.Register(DefaultCodespace, 5, "execute wasm contract failed")
+ ErrExecuteFailed = errorsmod.Register(DefaultCodespace, 5, "execute wasm contract failed")
// ErrGasLimit error for out of gas
- ErrGasLimit = sdkErrors.Register(DefaultCodespace, 6, "insufficient gas")
+ ErrGasLimit = errorsmod.Register(DefaultCodespace, 6, "insufficient gas")
// ErrInvalidGenesis error for invalid genesis file syntax
- ErrInvalidGenesis = sdkErrors.Register(DefaultCodespace, 7, "invalid genesis")
+ ErrInvalidGenesis = errorsmod.Register(DefaultCodespace, 7, "invalid genesis")
// ErrNotFound error for an entry not found in the store
- ErrNotFound = sdkErrors.Register(DefaultCodespace, 8, "not found")
+ ErrNotFound = errorsmod.Register(DefaultCodespace, 8, "not found")
// ErrQueryFailed error for rust smart query contract failure
- ErrQueryFailed = sdkErrors.Register(DefaultCodespace, 9, "query wasm contract failed")
+ ErrQueryFailed = errorsmod.Register(DefaultCodespace, 9, "query wasm contract failed")
// ErrInvalidMsg error when we cannot process the error returned from the contract
- ErrInvalidMsg = sdkErrors.Register(DefaultCodespace, 10, "invalid CosmosMsg from the contract")
+ ErrInvalidMsg = errorsmod.Register(DefaultCodespace, 10, "invalid CosmosMsg from the contract")
// ErrMigrationFailed error for rust execution contract failure
- ErrMigrationFailed = sdkErrors.Register(DefaultCodespace, 11, "migrate wasm contract failed")
+ ErrMigrationFailed = errorsmod.Register(DefaultCodespace, 11, "migrate wasm contract failed")
// ErrEmpty error for empty content
- ErrEmpty = sdkErrors.Register(DefaultCodespace, 12, "empty")
+ ErrEmpty = errorsmod.Register(DefaultCodespace, 12, "empty")
// ErrLimit error for content that exceeds a limit
- ErrLimit = sdkErrors.Register(DefaultCodespace, 13, "exceeds limit")
+ ErrLimit = errorsmod.Register(DefaultCodespace, 13, "exceeds limit")
// ErrInvalid error for content that is invalid in this context
- ErrInvalid = sdkErrors.Register(DefaultCodespace, 14, "invalid")
+ ErrInvalid = errorsmod.Register(DefaultCodespace, 14, "invalid")
// ErrDuplicate error for content that exists
- ErrDuplicate = sdkErrors.Register(DefaultCodespace, 15, "duplicate")
+ ErrDuplicate = errorsmod.Register(DefaultCodespace, 15, "duplicate")
// ErrMaxIBCChannels error for maximum number of ibc channels reached
- ErrMaxIBCChannels = sdkErrors.Register(DefaultCodespace, 16, "max transfer channels")
+ ErrMaxIBCChannels = errorsmod.Register(DefaultCodespace, 16, "max transfer channels")
// ErrUnsupportedForContract error when a capability is used that is not supported for/ by this contract
- ErrUnsupportedForContract = sdkErrors.Register(DefaultCodespace, 17, "unsupported for this contract")
+ ErrUnsupportedForContract = errorsmod.Register(DefaultCodespace, 17, "unsupported for this contract")
// ErrPinContractFailed error for pinning contract failures
- ErrPinContractFailed = sdkErrors.Register(DefaultCodespace, 18, "pinning contract failed")
+ ErrPinContractFailed = errorsmod.Register(DefaultCodespace, 18, "pinning contract failed")
// ErrUnpinContractFailed error for unpinning contract failures
- ErrUnpinContractFailed = sdkErrors.Register(DefaultCodespace, 19, "unpinning contract failed")
+ ErrUnpinContractFailed = errorsmod.Register(DefaultCodespace, 19, "unpinning contract failed")
// ErrUnknownMsg error by a message handler to show that it is not responsible for this message type
- ErrUnknownMsg = sdkErrors.Register(DefaultCodespace, 20, "unknown message from the contract")
+ ErrUnknownMsg = errorsmod.Register(DefaultCodespace, 20, "unknown message from the contract")
// ErrInvalidEvent error if an attribute/event from the contract is invalid
- ErrInvalidEvent = sdkErrors.Register(DefaultCodespace, 21, "invalid event")
+ ErrInvalidEvent = errorsmod.Register(DefaultCodespace, 21, "invalid event")
// ErrNoSuchContractFn error factory for an error when an address does not belong to a contract
- ErrNoSuchContractFn = WasmVMFlavouredErrorFactory(sdkErrors.Register(DefaultCodespace, 22, "no such contract"),
+ ErrNoSuchContractFn = WasmVMFlavouredErrorFactory(errorsmod.Register(DefaultCodespace, 22, "no such contract"),
func(addr string) error { return wasmvmtypes.NoSuchContract{Addr: addr} },
)
// code 23 -26 were used for json parser
// ErrExceedMaxQueryStackSize error if max query stack size is exceeded
- ErrExceedMaxQueryStackSize = sdkErrors.Register(DefaultCodespace, 27, "max query stack size exceeded")
+ ErrExceedMaxQueryStackSize = errorsmod.Register(DefaultCodespace, 27, "max query stack size exceeded")
// ErrNoSuchCodeFn factory for an error when a code id does not belong to a code info
- ErrNoSuchCodeFn = WasmVMFlavouredErrorFactory(sdkErrors.Register(DefaultCodespace, 28, "no such code"),
+ ErrNoSuchCodeFn = WasmVMFlavouredErrorFactory(errorsmod.Register(DefaultCodespace, 28, "no such code"),
func(id uint64) error { return wasmvmtypes.NoSuchCode{CodeID: id} },
)
)
@@ -97,17 +97,17 @@ var _ WasmVMErrorable = WasmVMFlavouredError{}
// WasmVMFlavouredError wrapper for sdk error that supports wasmvm error types
type WasmVMFlavouredError struct {
- sdkErr *sdkErrors.Error
+ sdkErr *errorsmod.Error
wasmVMErr error
}
// NewWasmVMFlavouredError constructor
-func NewWasmVMFlavouredError(sdkErr *sdkErrors.Error, wasmVMErr error) WasmVMFlavouredError {
+func NewWasmVMFlavouredError(sdkErr *errorsmod.Error, wasmVMErr error) WasmVMFlavouredError {
return WasmVMFlavouredError{sdkErr: sdkErr, wasmVMErr: wasmVMErr}
}
// WasmVMFlavouredErrorFactory is a factory method to build a WasmVMFlavouredError type
-func WasmVMFlavouredErrorFactory[T any](sdkErr *sdkErrors.Error, wasmVMErrBuilder func(T) error) func(T) WasmVMFlavouredError {
+func WasmVMFlavouredErrorFactory[T any](sdkErr *errorsmod.Error, wasmVMErrBuilder func(T) error) func(T) WasmVMFlavouredError {
if wasmVMErrBuilder == nil {
panic("builder function required")
}
@@ -141,10 +141,10 @@ func (e WasmVMFlavouredError) Cause() error {
// Wrap extends this error with additional information.
// It's a handy function to call Wrap with sdk errors.
-func (e WasmVMFlavouredError) Wrap(desc string) error { return sdkErrors.Wrap(e, desc) }
+func (e WasmVMFlavouredError) Wrap(desc string) error { return errorsmod.Wrap(e, desc) }
// Wrapf extends this error with additional information.
// It's a handy function to call Wrapf with sdk errors.
func (e WasmVMFlavouredError) Wrapf(desc string, args ...interface{}) error {
- return sdkErrors.Wrapf(e, desc, args...)
+ return errorsmod.Wrapf(e, desc, args...)
}
diff --git a/x/wasm/types/errors_test.go b/x/wasm/types/errors_test.go
index 76a1c0239c..495f5e828b 100644
--- a/x/wasm/types/errors_test.go
+++ b/x/wasm/types/errors_test.go
@@ -4,8 +4,8 @@ import (
"errors"
"testing"
+ errorsmod "cosmossdk.io/errors"
wasmvmtypes "github.com/CosmWasm/wasmvm/types"
- sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
@@ -17,7 +17,7 @@ func TestWasmVMFlavouredError(t *testing.T) {
}{
"IsOf": {
exec: func(t *testing.T) {
- assert.True(t, sdkerrors.IsOf(myErr, myErr.sdkErr))
+ assert.True(t, errorsmod.IsOf(myErr, myErr.sdkErr))
assert.Equal(t, myErr.sdkErr, myErr.Unwrap())
},
},
@@ -65,7 +65,7 @@ func TestWasmVMFlavouredError(t *testing.T) {
},
"abci info": {
exec: func(t *testing.T) {
- codespace, code, log := sdkerrors.ABCIInfo(myErr, false)
+ codespace, code, log := errorsmod.ABCIInfo(myErr, false)
assert.Equal(t, DefaultCodespace, codespace)
assert.Equal(t, uint32(28), code)
assert.Equal(t, "no such code", log)
@@ -73,7 +73,7 @@ func TestWasmVMFlavouredError(t *testing.T) {
},
"abci info - wrapped": {
exec: func(t *testing.T) {
- codespace, code, log := sdkerrors.ABCIInfo(myErr.Wrap("my description"), false)
+ codespace, code, log := errorsmod.ABCIInfo(myErr.Wrap("my description"), false)
assert.Equal(t, DefaultCodespace, codespace)
assert.Equal(t, uint32(28), code)
assert.Equal(t, "my description: no such code", log)
diff --git a/x/wasm/types/expected_keepers.go b/x/wasm/types/expected_keepers.go
index 57cc4073f5..e9b52273ad 100644
--- a/x/wasm/types/expected_keepers.go
+++ b/x/wasm/types/expected_keepers.go
@@ -6,11 +6,12 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
- "github.com/cosmos/cosmos-sdk/x/distribution/types"
+ distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
- connectiontypes "github.com/cosmos/ibc-go/v4/modules/core/03-connection/types"
- channeltypes "github.com/cosmos/ibc-go/v4/modules/core/04-channel/types"
- ibcexported "github.com/cosmos/ibc-go/v4/modules/core/exported"
+ clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types"
+ connectiontypes "github.com/cosmos/ibc-go/v7/modules/core/03-connection/types"
+ channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types"
+ ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported"
)
// BankViewKeeper defines a subset of methods implemented by the cosmos-sdk bank keeper
@@ -47,7 +48,7 @@ type AccountKeeper interface {
// DistributionKeeper defines a subset of methods implemented by the cosmos-sdk distribution keeper
type DistributionKeeper interface {
- DelegationRewards(c context.Context, req *types.QueryDelegationRewardsRequest) (*types.QueryDelegationRewardsResponse, error)
+ DelegationRewards(c context.Context, req *distrtypes.QueryDelegationRewardsRequest) (*distrtypes.QueryDelegationRewardsResponse, error)
}
// StakingKeeper defines a subset of methods implemented by the cosmos-sdk staking keeper
@@ -71,8 +72,19 @@ type StakingKeeper interface {
// ChannelKeeper defines the expected IBC channel keeper
type ChannelKeeper interface {
GetChannel(ctx sdk.Context, srcPort, srcChan string) (channel channeltypes.Channel, found bool)
- GetNextSequenceSend(ctx sdk.Context, portID, channelID string) (uint64, bool)
- SendPacket(ctx sdk.Context, channelCap *capabilitytypes.Capability, packet ibcexported.PacketI) error
+
+ // SendPacket is called by a module in order to send an IBC packet on a channel.
+ // The packet sequence generated for the packet to be sent is returned. An error
+ // is returned if one occurs.
+ SendPacket(
+ ctx sdk.Context,
+ channelCap *capabilitytypes.Capability,
+ sourcePort string,
+ sourceChannel string,
+ timeoutHeight clienttypes.Height,
+ timeoutTimestamp uint64,
+ data []byte,
+ ) (uint64, error)
ChanCloseInit(ctx sdk.Context, portID, channelID string, chanCap *capabilitytypes.Capability) error
GetAllChannels(ctx sdk.Context) (channels []channeltypes.IdentifiedChannel)
IterateChannels(ctx sdk.Context, cb func(channeltypes.IdentifiedChannel) bool)
diff --git a/x/wasm/types/genesis.go b/x/wasm/types/genesis.go
index f14dbc3d76..8a5a15696a 100644
--- a/x/wasm/types/genesis.go
+++ b/x/wasm/types/genesis.go
@@ -1,35 +1,35 @@
package types
import (
+ errorsmod "cosmossdk.io/errors"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
- sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
)
func (s Sequence) ValidateBasic() error {
if len(s.IDKey) == 0 {
- return sdkerrors.Wrap(ErrEmpty, "id key")
+ return errorsmod.Wrap(ErrEmpty, "id key")
}
return nil
}
func (s GenesisState) ValidateBasic() error {
if err := s.Params.ValidateBasic(); err != nil {
- return sdkerrors.Wrap(err, "params")
+ return errorsmod.Wrap(err, "params")
}
for i := range s.Codes {
if err := s.Codes[i].ValidateBasic(); err != nil {
- return sdkerrors.Wrapf(err, "code: %d", i)
+ return errorsmod.Wrapf(err, "code: %d", i)
}
}
for i := range s.Contracts {
if err := s.Contracts[i].ValidateBasic(); err != nil {
- return sdkerrors.Wrapf(err, "contract: %d", i)
+ return errorsmod.Wrapf(err, "contract: %d", i)
}
}
for i := range s.Sequences {
if err := s.Sequences[i].ValidateBasic(); err != nil {
- return sdkerrors.Wrapf(err, "sequence: %d", i)
+ return errorsmod.Wrapf(err, "sequence: %d", i)
}
}
@@ -38,31 +38,31 @@ func (s GenesisState) ValidateBasic() error {
func (c Code) ValidateBasic() error {
if c.CodeID == 0 {
- return sdkerrors.Wrap(ErrEmpty, "code id")
+ return errorsmod.Wrap(ErrEmpty, "code id")
}
if err := c.CodeInfo.ValidateBasic(); err != nil {
- return sdkerrors.Wrap(err, "code info")
+ return errorsmod.Wrap(err, "code info")
}
if err := validateWasmCode(c.CodeBytes, MaxProposalWasmSize); err != nil {
- return sdkerrors.Wrap(err, "code bytes")
+ return errorsmod.Wrap(err, "code bytes")
}
return nil
}
func (c Contract) ValidateBasic() error {
if _, err := sdk.AccAddressFromBech32(c.ContractAddress); err != nil {
- return sdkerrors.Wrap(err, "contract address")
+ return errorsmod.Wrap(err, "contract address")
}
if err := c.ContractInfo.ValidateBasic(); err != nil {
- return sdkerrors.Wrap(err, "contract info")
+ return errorsmod.Wrap(err, "contract info")
}
if c.ContractInfo.Created == nil {
- return sdkerrors.Wrap(ErrInvalid, "created must not be empty")
+ return errorsmod.Wrap(ErrInvalid, "created must not be empty")
}
for i := range c.ContractState {
if err := c.ContractState[i].ValidateBasic(); err != nil {
- return sdkerrors.Wrapf(err, "contract state %d", i)
+ return errorsmod.Wrapf(err, "contract state %d", i)
}
}
if len(c.ContractCodeHistory) == 0 {
@@ -70,7 +70,7 @@ func (c Contract) ValidateBasic() error {
}
for i, v := range c.ContractCodeHistory {
if err := v.ValidateBasic(); err != nil {
- return sdkerrors.Wrapf(err, "code history element %d", i)
+ return errorsmod.Wrapf(err, "code history element %d", i)
}
}
return nil
diff --git a/x/wasm/types/genesis.pb.go b/x/wasm/types/genesis.pb.go
index b753dc1a83..cb6bd8f125 100644
--- a/x/wasm/types/genesis.pb.go
+++ b/x/wasm/types/genesis.pb.go
@@ -10,7 +10,7 @@ import (
math_bits "math/bits"
_ "github.com/cosmos/gogoproto/gogoproto"
- proto "github.com/gogo/protobuf/proto"
+ proto "github.com/cosmos/gogoproto/proto"
)
// Reference imports to suppress errors if they are not otherwise used.
diff --git a/x/wasm/types/genesis_test.go b/x/wasm/types/genesis_test.go
index 51c95e4d16..258528c999 100644
--- a/x/wasm/types/genesis_test.go
+++ b/x/wasm/types/genesis_test.go
@@ -5,16 +5,17 @@ import (
"testing"
"time"
+ "github.com/cometbft/cometbft/libs/rand"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
- govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
+ "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
"github.com/stretchr/testify/assert"
- "github.com/tendermint/tendermint/libs/rand"
-
"github.com/stretchr/testify/require"
)
+const invalidAddress = "invalid address"
+
func TestValidateGenesisState(t *testing.T) {
specs := map[string]struct {
srcMutator func(*GenesisState)
@@ -37,7 +38,7 @@ func TestValidateGenesisState(t *testing.T) {
},
"contract invalid": {
srcMutator: func(s *GenesisState) {
- s.Contracts[0].ContractAddress = "invalid"
+ s.Contracts[0].ContractAddress = invalidAddress
},
expError: true,
},
@@ -119,13 +120,13 @@ func TestContractValidateBasic(t *testing.T) {
"all good": {srcMutator: func(_ *Contract) {}},
"contract address invalid": {
srcMutator: func(c *Contract) {
- c.ContractAddress = "invalid"
+ c.ContractAddress = invalidAddress
},
expError: true,
},
"contract info invalid": {
srcMutator: func(c *Contract) {
- c.ContractInfo.Creator = "invalid"
+ c.ContractInfo.Creator = invalidAddress
},
expError: true,
},
@@ -168,7 +169,7 @@ func TestGenesisContractInfoMarshalUnmarshal(t *testing.T) {
anyTime := time.Now().UTC()
// using gov proposal here as a random protobuf types as it contains an Any type inside for nested unpacking
- myExtension, err := govtypes.NewProposal(&govtypes.TextProposal{Title: "bar"}, 1, anyTime, anyTime)
+ myExtension, err := v1beta1.NewProposal(&v1beta1.TextProposal{Title: "bar"}, 1, anyTime, anyTime)
require.NoError(t, err)
myExtension.TotalDeposit = nil
@@ -182,10 +183,10 @@ func TestGenesisContractInfoMarshalUnmarshal(t *testing.T) {
// register proposal as extension type
interfaceRegistry.RegisterImplementations(
(*ContractInfoExtension)(nil),
- &govtypes.Proposal{},
+ &v1beta1.Proposal{},
)
// register gov types for nested Anys
- govtypes.RegisterInterfaces(interfaceRegistry)
+ v1beta1.RegisterInterfaces(interfaceRegistry)
// when encode
gs := GenesisState{
@@ -205,7 +206,7 @@ func TestGenesisContractInfoMarshalUnmarshal(t *testing.T) {
dest := destGs.Contracts[0].ContractInfo
assert.Equal(t, src, dest)
// and sanity check nested any
- var destExt govtypes.Proposal
+ var destExt v1beta1.Proposal
require.NoError(t, dest.ReadExtension(&destExt))
assert.Equal(t, destExt.GetTitle(), "bar")
}
diff --git a/x/wasm/types/iavl_range_test.go b/x/wasm/types/iavl_range_test.go
index 85a4a18c95..fd3297b467 100644
--- a/x/wasm/types/iavl_range_test.go
+++ b/x/wasm/types/iavl_range_test.go
@@ -3,11 +3,11 @@ package types
import (
"testing"
+ dbm "github.com/cometbft/cometbft-db"
"github.com/cosmos/cosmos-sdk/store"
"github.com/cosmos/cosmos-sdk/store/iavl"
iavl2 "github.com/cosmos/iavl"
"github.com/stretchr/testify/require"
- dbm "github.com/tendermint/tm-db"
)
// This is modeled close to
diff --git a/x/wasm/types/ibc.pb.go b/x/wasm/types/ibc.pb.go
index 5e63f615a1..0e250491f9 100644
--- a/x/wasm/types/ibc.pb.go
+++ b/x/wasm/types/ibc.pb.go
@@ -10,7 +10,7 @@ import (
math_bits "math/bits"
_ "github.com/cosmos/gogoproto/gogoproto"
- proto "github.com/gogo/protobuf/proto"
+ proto "github.com/cosmos/gogoproto/proto"
)
// Reference imports to suppress errors if they are not otherwise used.
diff --git a/x/wasm/types/json_matching_test.go b/x/wasm/types/json_matching_test.go
index 01d2d3efd3..286fde3969 100644
--- a/x/wasm/types/json_matching_test.go
+++ b/x/wasm/types/json_matching_test.go
@@ -81,11 +81,11 @@ func TestIsJSONObjectWithTopLevelKey(t *testing.T) {
expResult: false,
},
// not supported: https://github.com/golang/go/issues/24415
- //"errors for duplicate key": {
+ // "errors for duplicate key": {
// src: []byte(`{"claim": "foo", "claim":"bar"}`),
// allowedKeys: []string{"claim"},
// expErr: ErrNotAJSONObject,
- //},
+ // },
// Not one top-level key
"false for no top-level key": {
diff --git a/x/wasm/types/keys.go b/x/wasm/types/keys.go
index 95078e1445..4f605872d6 100644
--- a/x/wasm/types/keys.go
+++ b/x/wasm/types/keys.go
@@ -22,7 +22,6 @@ const (
RouterKey = ModuleName
)
-// nolint
var (
CodeKeyPrefix = []byte{0x01}
ContractKeyPrefix = []byte{0x02}
@@ -33,6 +32,7 @@ var (
PinnedCodeIndexPrefix = []byte{0x07}
TXCounterPrefix = []byte{0x08}
ContractsByCreatorPrefix = []byte{0x09}
+ ParamsKey = []byte{0x10}
KeyLastCodeID = append(SequenceKeyPrefix, []byte("lastCodeId")...)
KeyLastInstanceID = append(SequenceKeyPrefix, []byte("lastContractId")...)
diff --git a/x/wasm/types/keys_test.go b/x/wasm/types/keys_test.go
index 3db6bbadfe..a5cbce7358 100644
--- a/x/wasm/types/keys_test.go
+++ b/x/wasm/types/keys_test.go
@@ -123,6 +123,7 @@ func TestGetContractByCreatorSecondaryIndexKey(t *testing.T) {
4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4,
}
+ assert.Equal(t, exp, got)
// test that creator is contract addresses of 32 length
contractAddr = bytes.Repeat([]byte{4}, 32)
diff --git a/x/wasm/types/params.go b/x/wasm/types/params.go
index 0ee7dcb619..d06ba7e205 100644
--- a/x/wasm/types/params.go
+++ b/x/wasm/types/params.go
@@ -4,19 +4,13 @@ import (
"encoding/json"
"fmt"
+ errorsmod "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
- sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
- paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
- "github.com/gogo/protobuf/jsonpb"
+ "github.com/cosmos/gogoproto/jsonpb"
"github.com/pkg/errors"
"gopkg.in/yaml.v2"
)
-var (
- ParamStoreKeyUploadAccess = []byte("uploadAccess")
- ParamStoreKeyInstantiateAccess = []byte("instantiateAccess")
-)
-
var AllAccessTypes = []AccessType{
AccessTypeNobody,
AccessTypeOnlyAddress,
@@ -44,7 +38,7 @@ func (a AccessType) With(addrs ...sdk.AccAddress) AccessConfig {
bech32Addrs[i] = v.String()
}
if err := assertValidAddresses(bech32Addrs); err != nil {
- panic(sdkerrors.Wrap(err, "addresses"))
+ panic(errorsmod.Wrap(err, "addresses"))
}
return AccessConfig{Permission: AccessTypeAnyOfAddresses, Addresses: bech32Addrs}
}
@@ -98,11 +92,6 @@ var (
AllowNobody = AccessConfig{Permission: AccessTypeNobody}
)
-// ParamKeyTable returns the parameter key table.
-func ParamKeyTable() paramtypes.KeyTable {
- return paramtypes.NewKeyTable().RegisterParamSet(&Params{})
-}
-
// DefaultParams returns default wasm parameters
func DefaultParams() Params {
return Params{
@@ -119,14 +108,6 @@ func (p Params) String() string {
return string(out)
}
-// ParamSetPairs returns the parameter set pairs.
-func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs {
- return paramtypes.ParamSetPairs{
- paramtypes.NewParamSetPair(ParamStoreKeyUploadAccess, &p.CodeUploadAccess, validateAccessConfig),
- paramtypes.NewParamSetPair(ParamStoreKeyInstantiateAccess, &p.InstantiateDefaultPermission, validateAccessType),
- }
-}
-
// ValidateBasic performs basic validation on wasm parameters
func (p Params) ValidateBasic() error {
if err := validateAccessType(p.InstantiateDefaultPermission); err != nil {
@@ -152,24 +133,24 @@ func validateAccessType(i interface{}) error {
return fmt.Errorf("invalid parameter type: %T", i)
}
if a == AccessTypeUnspecified {
- return sdkerrors.Wrap(ErrEmpty, "type")
+ return errorsmod.Wrap(ErrEmpty, "type")
}
for _, v := range AllAccessTypes {
if v == a {
return nil
}
}
- return sdkerrors.Wrapf(ErrInvalid, "unknown type: %q", a)
+ return errorsmod.Wrapf(ErrInvalid, "unknown type: %q", a)
}
// ValidateBasic performs basic validation
func (a AccessConfig) ValidateBasic() error {
switch a.Permission {
case AccessTypeUnspecified:
- return sdkerrors.Wrap(ErrEmpty, "type")
+ return errorsmod.Wrap(ErrEmpty, "type")
case AccessTypeNobody, AccessTypeEverybody:
if len(a.Address) != 0 {
- return sdkerrors.Wrap(ErrInvalid, "address not allowed for this type")
+ return errorsmod.Wrap(ErrInvalid, "address not allowed for this type")
}
return nil
case AccessTypeOnlyAddress:
@@ -182,9 +163,9 @@ func (a AccessConfig) ValidateBasic() error {
if a.Address != "" {
return ErrInvalid.Wrap("address field set")
}
- return sdkerrors.Wrap(assertValidAddresses(a.Addresses), "addresses")
+ return errorsmod.Wrap(assertValidAddresses(a.Addresses), "addresses")
}
- return sdkerrors.Wrapf(ErrInvalid, "unknown type: %q", a.Permission)
+ return errorsmod.Wrapf(ErrInvalid, "unknown type: %q", a.Permission)
}
func assertValidAddresses(addrs []string) error {
@@ -194,7 +175,7 @@ func assertValidAddresses(addrs []string) error {
idx := make(map[string]struct{}, len(addrs))
for _, a := range addrs {
if _, err := sdk.AccAddressFromBech32(a); err != nil {
- return sdkerrors.Wrapf(err, "address: %s", a)
+ return errorsmod.Wrapf(err, "address: %s", a)
}
if _, exists := idx[a]; exists {
return ErrDuplicate.Wrapf("address: %s", a)
diff --git a/x/wasm/types/params_legacy.go b/x/wasm/types/params_legacy.go
new file mode 100644
index 0000000000..db38cb8bee
--- /dev/null
+++ b/x/wasm/types/params_legacy.go
@@ -0,0 +1,26 @@
+/*
+NOTE: Usage of x/params to manage parameters is deprecated in favor of x/gov
+controlled execution of MsgUpdateParams messages. These types remains solely
+for migration purposes and will be removed in a future release.
+*/
+package types
+
+import paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
+
+var (
+ ParamStoreKeyUploadAccess = []byte("uploadAccess")
+ ParamStoreKeyInstantiateAccess = []byte("instantiateAccess")
+)
+
+// Deprecated: Type declaration for parameters
+func ParamKeyTable() paramtypes.KeyTable {
+ return paramtypes.NewKeyTable().RegisterParamSet(&Params{})
+}
+
+// ParamSetPairs returns the parameter set pairs.
+func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs {
+ return paramtypes.ParamSetPairs{
+ paramtypes.NewParamSetPair(ParamStoreKeyUploadAccess, &p.CodeUploadAccess, validateAccessConfig),
+ paramtypes.NewParamSetPair(ParamStoreKeyInstantiateAccess, &p.InstantiateDefaultPermission, validateAccessType),
+ }
+}
diff --git a/x/wasm/types/proposal.go b/x/wasm/types/proposal.go
index 96e2c9b510..468f45b177 100644
--- a/x/wasm/types/proposal.go
+++ b/x/wasm/types/proposal.go
@@ -6,9 +6,11 @@ import (
"fmt"
"strings"
+ errorsmod "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
+ "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
)
type ProposalType string
@@ -58,7 +60,7 @@ func ConvertToProposals(keys []string) ([]ProposalType, error) {
proposals := make([]ProposalType, len(keys))
for i, key := range keys {
if _, ok := valid[key]; !ok {
- return nil, sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "'%s' is not a valid ProposalType", key)
+ return nil, errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "'%s' is not a valid ProposalType", key)
}
proposals[i] = ProposalType(key)
}
@@ -66,30 +68,18 @@ func ConvertToProposals(keys []string) ([]ProposalType, error) {
}
func init() { // register new content types with the sdk
- govtypes.RegisterProposalType(string(ProposalTypeStoreCode))
- govtypes.RegisterProposalType(string(ProposalTypeInstantiateContract))
- govtypes.RegisterProposalType(string(ProposalTypeInstantiateContract2))
- govtypes.RegisterProposalType(string(ProposalTypeMigrateContract))
- govtypes.RegisterProposalType(string(ProposalTypeSudoContract))
- govtypes.RegisterProposalType(string(ProposalTypeExecuteContract))
- govtypes.RegisterProposalType(string(ProposalTypeUpdateAdmin))
- govtypes.RegisterProposalType(string(ProposalTypeClearAdmin))
- govtypes.RegisterProposalType(string(ProposalTypePinCodes))
- govtypes.RegisterProposalType(string(ProposalTypeUnpinCodes))
- govtypes.RegisterProposalType(string(ProposalTypeUpdateInstantiateConfig))
- govtypes.RegisterProposalType(string(ProposalTypeStoreAndInstantiateContractProposal))
- govtypes.RegisterProposalTypeCodec(&StoreCodeProposal{}, "wasm/StoreCodeProposal")
- govtypes.RegisterProposalTypeCodec(&InstantiateContractProposal{}, "wasm/InstantiateContractProposal")
- govtypes.RegisterProposalTypeCodec(&InstantiateContract2Proposal{}, "wasm/InstantiateContract2Proposal")
- govtypes.RegisterProposalTypeCodec(&MigrateContractProposal{}, "wasm/MigrateContractProposal")
- govtypes.RegisterProposalTypeCodec(&SudoContractProposal{}, "wasm/SudoContractProposal")
- govtypes.RegisterProposalTypeCodec(&ExecuteContractProposal{}, "wasm/ExecuteContractProposal")
- govtypes.RegisterProposalTypeCodec(&UpdateAdminProposal{}, "wasm/UpdateAdminProposal")
- govtypes.RegisterProposalTypeCodec(&ClearAdminProposal{}, "wasm/ClearAdminProposal")
- govtypes.RegisterProposalTypeCodec(&PinCodesProposal{}, "wasm/PinCodesProposal")
- govtypes.RegisterProposalTypeCodec(&UnpinCodesProposal{}, "wasm/UnpinCodesProposal")
- govtypes.RegisterProposalTypeCodec(&UpdateInstantiateConfigProposal{}, "wasm/UpdateInstantiateConfigProposal")
- govtypes.RegisterProposalTypeCodec(&StoreAndInstantiateContractProposal{}, "wasm/StoreAndInstantiateContractProposal")
+ v1beta1.RegisterProposalType(string(ProposalTypeStoreCode))
+ v1beta1.RegisterProposalType(string(ProposalTypeInstantiateContract))
+ v1beta1.RegisterProposalType(string(ProposalTypeInstantiateContract2))
+ v1beta1.RegisterProposalType(string(ProposalTypeMigrateContract))
+ v1beta1.RegisterProposalType(string(ProposalTypeSudoContract))
+ v1beta1.RegisterProposalType(string(ProposalTypeExecuteContract))
+ v1beta1.RegisterProposalType(string(ProposalTypeUpdateAdmin))
+ v1beta1.RegisterProposalType(string(ProposalTypeClearAdmin))
+ v1beta1.RegisterProposalType(string(ProposalTypePinCodes))
+ v1beta1.RegisterProposalType(string(ProposalTypeUnpinCodes))
+ v1beta1.RegisterProposalType(string(ProposalTypeUpdateInstantiateConfig))
+ v1beta1.RegisterProposalType(string(ProposalTypeStoreAndInstantiateContractProposal))
}
func NewStoreCodeProposal(
@@ -124,21 +114,21 @@ func (p StoreCodeProposal) ValidateBasic() error {
return err
}
if _, err := sdk.AccAddressFromBech32(p.RunAs); err != nil {
- return sdkerrors.Wrap(err, "run as")
+ return errorsmod.Wrap(err, "run as")
}
if err := validateWasmCode(p.WASMByteCode, MaxProposalWasmSize); err != nil {
- return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "code bytes %s", err.Error())
+ return errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "code bytes %s", err.Error())
}
if p.InstantiatePermission != nil {
if err := p.InstantiatePermission.ValidateBasic(); err != nil {
- return sdkerrors.Wrap(err, "instantiate permission")
+ return errorsmod.Wrap(err, "instantiate permission")
}
}
if err := ValidateVerificationInfo(p.Source, p.Builder, p.CodeHash); err != nil {
- return sdkerrors.Wrapf(err, "code verification info")
+ return errorsmod.Wrapf(err, "code verification info")
}
return nil
}
@@ -212,11 +202,11 @@ func (p InstantiateContractProposal) ValidateBasic() error {
return err
}
if _, err := sdk.AccAddressFromBech32(p.RunAs); err != nil {
- return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "run as")
+ return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "run as")
}
if p.CodeID == 0 {
- return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "code id is required")
+ return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "code id is required")
}
if err := ValidateLabel(p.Label); err != nil {
@@ -233,7 +223,7 @@ func (p InstantiateContractProposal) ValidateBasic() error {
}
}
if err := p.Msg.ValidateBasic(); err != nil {
- return sdkerrors.Wrap(err, "payload msg")
+ return errorsmod.Wrap(err, "payload msg")
}
return nil
}
@@ -312,7 +302,7 @@ func (p InstantiateContract2Proposal) ValidateBasic() error {
}
// Validate run as
if _, err := sdk.AccAddressFromBech32(p.RunAs); err != nil {
- return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "run as")
+ return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "run as")
}
// Validate admin
if len(p.Admin) != 0 {
@@ -322,7 +312,7 @@ func (p InstantiateContract2Proposal) ValidateBasic() error {
}
// Validate codeid
if p.CodeID == 0 {
- return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "code id is required")
+ return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "code id is required")
}
// Validate label
if err := ValidateLabel(p.Label); err != nil {
@@ -330,7 +320,7 @@ func (p InstantiateContract2Proposal) ValidateBasic() error {
}
// Validate msg
if err := p.Msg.ValidateBasic(); err != nil {
- return sdkerrors.Wrap(err, "payload msg")
+ return errorsmod.Wrap(err, "payload msg")
}
// Validate funds
if !p.Funds.IsValid() {
@@ -338,7 +328,7 @@ func (p InstantiateContract2Proposal) ValidateBasic() error {
}
// Validate salt
if len(p.Salt) == 0 {
- return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "salt is required")
+ return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "salt is required")
}
return nil
}
@@ -435,20 +425,20 @@ func (p StoreAndInstantiateContractProposal) ValidateBasic() error {
return err
}
if _, err := sdk.AccAddressFromBech32(p.RunAs); err != nil {
- return sdkerrors.Wrap(err, "run as")
+ return errorsmod.Wrap(err, "run as")
}
if err := validateWasmCode(p.WASMByteCode, MaxProposalWasmSize); err != nil {
- return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "code bytes %s", err.Error())
+ return errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "code bytes %s", err.Error())
}
if err := ValidateVerificationInfo(p.Source, p.Builder, p.CodeHash); err != nil {
- return sdkerrors.Wrap(err, "code info")
+ return errorsmod.Wrap(err, "code info")
}
if p.InstantiatePermission != nil {
if err := p.InstantiatePermission.ValidateBasic(); err != nil {
- return sdkerrors.Wrap(err, "instantiate permission")
+ return errorsmod.Wrap(err, "instantiate permission")
}
}
@@ -466,7 +456,7 @@ func (p StoreAndInstantiateContractProposal) ValidateBasic() error {
}
}
if err := p.Msg.ValidateBasic(); err != nil {
- return sdkerrors.Wrap(err, "payload msg")
+ return errorsmod.Wrap(err, "payload msg")
}
return nil
}
@@ -557,13 +547,13 @@ func (p MigrateContractProposal) ValidateBasic() error {
return err
}
if p.CodeID == 0 {
- return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "code_id is required")
+ return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "code_id is required")
}
if _, err := sdk.AccAddressFromBech32(p.Contract); err != nil {
- return sdkerrors.Wrap(err, "contract")
+ return errorsmod.Wrap(err, "contract")
}
if err := p.Msg.ValidateBasic(); err != nil {
- return sdkerrors.Wrap(err, "payload msg")
+ return errorsmod.Wrap(err, "payload msg")
}
return nil
}
@@ -628,10 +618,10 @@ func (p SudoContractProposal) ValidateBasic() error {
return err
}
if _, err := sdk.AccAddressFromBech32(p.Contract); err != nil {
- return sdkerrors.Wrap(err, "contract")
+ return errorsmod.Wrap(err, "contract")
}
if err := p.Msg.ValidateBasic(); err != nil {
- return sdkerrors.Wrap(err, "payload msg")
+ return errorsmod.Wrap(err, "payload msg")
}
return nil
}
@@ -690,16 +680,16 @@ func (p ExecuteContractProposal) ValidateBasic() error {
return err
}
if _, err := sdk.AccAddressFromBech32(p.Contract); err != nil {
- return sdkerrors.Wrap(err, "contract")
+ return errorsmod.Wrap(err, "contract")
}
if _, err := sdk.AccAddressFromBech32(p.RunAs); err != nil {
- return sdkerrors.Wrap(err, "run as")
+ return errorsmod.Wrap(err, "run as")
}
if !p.Funds.IsValid() {
return sdkerrors.ErrInvalidCoins
}
if err := p.Msg.ValidateBasic(); err != nil {
- return sdkerrors.Wrap(err, "payload msg")
+ return errorsmod.Wrap(err, "payload msg")
}
return nil
}
@@ -762,10 +752,10 @@ func (p UpdateAdminProposal) ValidateBasic() error {
return err
}
if _, err := sdk.AccAddressFromBech32(p.Contract); err != nil {
- return sdkerrors.Wrap(err, "contract")
+ return errorsmod.Wrap(err, "contract")
}
if _, err := sdk.AccAddressFromBech32(p.NewAdmin); err != nil {
- return sdkerrors.Wrap(err, "new admin")
+ return errorsmod.Wrap(err, "new admin")
}
return nil
}
@@ -806,7 +796,7 @@ func (p ClearAdminProposal) ValidateBasic() error {
return err
}
if _, err := sdk.AccAddressFromBech32(p.Contract); err != nil {
- return sdkerrors.Wrap(err, "contract")
+ return errorsmod.Wrap(err, "contract")
}
return nil
}
@@ -850,7 +840,7 @@ func (p PinCodesProposal) ValidateBasic() error {
return err
}
if len(p.CodeIDs) == 0 {
- return sdkerrors.Wrap(ErrEmpty, "code ids")
+ return errorsmod.Wrap(ErrEmpty, "code ids")
}
return nil
}
@@ -894,7 +884,7 @@ func (p UnpinCodesProposal) ValidateBasic() error {
return err
}
if len(p.CodeIDs) == 0 {
- return sdkerrors.Wrap(ErrEmpty, "code ids")
+ return errorsmod.Wrap(ErrEmpty, "code ids")
}
return nil
}
@@ -910,22 +900,22 @@ func (p UnpinCodesProposal) String() string {
func validateProposalCommons(title, description string) error {
if strings.TrimSpace(title) != title {
- return sdkerrors.Wrap(govtypes.ErrInvalidProposalContent, "proposal title must not start/end with white spaces")
+ return errorsmod.Wrap(govtypes.ErrInvalidProposalContent, "proposal title must not start/end with white spaces")
}
if len(title) == 0 {
- return sdkerrors.Wrap(govtypes.ErrInvalidProposalContent, "proposal title cannot be blank")
+ return errorsmod.Wrap(govtypes.ErrInvalidProposalContent, "proposal title cannot be blank")
}
- if len(title) > govtypes.MaxTitleLength {
- return sdkerrors.Wrapf(govtypes.ErrInvalidProposalContent, "proposal title is longer than max length of %d", govtypes.MaxTitleLength)
+ if len(title) > v1beta1.MaxTitleLength {
+ return errorsmod.Wrapf(govtypes.ErrInvalidProposalContent, "proposal title is longer than max length of %d", v1beta1.MaxTitleLength)
}
if strings.TrimSpace(description) != description {
- return sdkerrors.Wrap(govtypes.ErrInvalidProposalContent, "proposal description must not start/end with white spaces")
+ return errorsmod.Wrap(govtypes.ErrInvalidProposalContent, "proposal description must not start/end with white spaces")
}
if len(description) == 0 {
- return sdkerrors.Wrap(govtypes.ErrInvalidProposalContent, "proposal description cannot be blank")
+ return errorsmod.Wrap(govtypes.ErrInvalidProposalContent, "proposal description cannot be blank")
}
- if len(description) > govtypes.MaxDescriptionLength {
- return sdkerrors.Wrapf(govtypes.ErrInvalidProposalContent, "proposal description is longer than max length of %d", govtypes.MaxDescriptionLength)
+ if len(description) > v1beta1.MaxDescriptionLength {
+ return errorsmod.Wrapf(govtypes.ErrInvalidProposalContent, "proposal description is longer than max length of %d", v1beta1.MaxDescriptionLength)
}
return nil
}
@@ -962,16 +952,16 @@ func (p UpdateInstantiateConfigProposal) ValidateBasic() error {
return err
}
if len(p.AccessConfigUpdates) == 0 {
- return sdkerrors.Wrap(ErrEmpty, "code updates")
+ return errorsmod.Wrap(ErrEmpty, "code updates")
}
dedup := make(map[uint64]bool)
for _, codeUpdate := range p.AccessConfigUpdates {
_, found := dedup[codeUpdate.CodeID]
if found {
- return sdkerrors.Wrapf(ErrDuplicate, "duplicate code: %d", codeUpdate.CodeID)
+ return errorsmod.Wrapf(ErrDuplicate, "duplicate code: %d", codeUpdate.CodeID)
}
if err := codeUpdate.InstantiatePermission.ValidateBasic(); err != nil {
- return sdkerrors.Wrap(err, "instantiate permission")
+ return errorsmod.Wrap(err, "instantiate permission")
}
dedup[codeUpdate.CodeID] = true
}
diff --git a/x/wasm/types/proposal.pb.go b/x/wasm/types/proposal.pb.go
index 39f23e303c..349a1535b6 100644
--- a/x/wasm/types/proposal.pb.go
+++ b/x/wasm/types/proposal.pb.go
@@ -14,7 +14,7 @@ import (
github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types"
types "github.com/cosmos/cosmos-sdk/types"
_ "github.com/cosmos/gogoproto/gogoproto"
- proto "github.com/gogo/protobuf/proto"
+ proto "github.com/cosmos/gogoproto/proto"
)
// Reference imports to suppress errors if they are not otherwise used.
diff --git a/x/wasm/types/proposal_test.go b/x/wasm/types/proposal_test.go
index a558744f8b..8952f8cf93 100644
--- a/x/wasm/types/proposal_test.go
+++ b/x/wasm/types/proposal_test.go
@@ -7,7 +7,7 @@ import (
"testing"
sdk "github.com/cosmos/cosmos-sdk/types"
- govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
+ "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"gopkg.in/yaml.v2"
@@ -48,7 +48,7 @@ func TestValidateProposalCommons(t *testing.T) {
},
"prevent title exceeds max length ": {
src: commonProposal{
- Title: strings.Repeat("a", govtypes.MaxTitleLength+1),
+ Title: strings.Repeat("a", v1beta1.MaxTitleLength+1),
Description: "Bar",
},
expErr: true,
@@ -76,7 +76,7 @@ func TestValidateProposalCommons(t *testing.T) {
"prevent descr exceeds max length ": {
src: commonProposal{
Title: "Foo",
- Description: strings.Repeat("a", govtypes.MaxDescriptionLength+1),
+ Description: strings.Repeat("a", v1beta1.MaxDescriptionLength+1),
},
expErr: true,
},
@@ -94,10 +94,7 @@ func TestValidateProposalCommons(t *testing.T) {
}
func TestValidateStoreCodeProposal(t *testing.T) {
- var (
- anyAddress sdk.AccAddress = bytes.Repeat([]byte{0x0}, ContractAddrLen)
- invalidAddress = "invalid address"
- )
+ var anyAddress sdk.AccAddress = bytes.Repeat([]byte{0x0}, ContractAddrLen)
specs := map[string]struct {
src *StoreCodeProposal
@@ -187,8 +184,6 @@ func TestValidateStoreCodeProposal(t *testing.T) {
}
func TestValidateInstantiateContractProposal(t *testing.T) {
- invalidAddress := "invalid address"
-
specs := map[string]struct {
src *InstantiateContractProposal
expErr bool
@@ -280,8 +275,6 @@ func TestValidateInstantiateContractProposal(t *testing.T) {
}
func TestValidateInstantiateContract2Proposal(t *testing.T) {
- invalidAddress := "invalid address"
-
specs := map[string]struct {
src *InstantiateContract2Proposal
expErr bool
@@ -379,10 +372,7 @@ func TestValidateInstantiateContract2Proposal(t *testing.T) {
}
func TestValidateStoreAndInstantiateContractProposal(t *testing.T) {
- var (
- anyAddress sdk.AccAddress = bytes.Repeat([]byte{0x0}, ContractAddrLen)
- invalidAddress = "invalid address"
- )
+ var anyAddress sdk.AccAddress = bytes.Repeat([]byte{0x0}, ContractAddrLen)
specs := map[string]struct {
src *StoreAndInstantiateContractProposal
@@ -577,8 +567,6 @@ func TestValidateMigrateContractProposal(t *testing.T) {
}
func TestValidateSudoContractProposal(t *testing.T) {
- invalidAddress := "invalid address"
-
specs := map[string]struct {
src *SudoContractProposal
expErr bool
@@ -630,8 +618,6 @@ func TestValidateSudoContractProposal(t *testing.T) {
}
func TestValidateExecuteContractProposal(t *testing.T) {
- invalidAddress := "invalid address"
-
specs := map[string]struct {
src *ExecuteContractProposal
expErr bool
@@ -689,8 +675,6 @@ func TestValidateExecuteContractProposal(t *testing.T) {
}
func TestValidateUpdateAdminProposal(t *testing.T) {
- invalidAddress := "invalid address"
-
specs := map[string]struct {
src *UpdateAdminProposal
expErr bool
@@ -742,8 +726,6 @@ func TestValidateUpdateAdminProposal(t *testing.T) {
}
func TestValidateClearAdminProposal(t *testing.T) {
- invalidAddress := "invalid address"
-
specs := map[string]struct {
src *ClearAdminProposal
expErr bool
@@ -784,7 +766,7 @@ func TestValidateClearAdminProposal(t *testing.T) {
func TestProposalStrings(t *testing.T) {
specs := map[string]struct {
- src govtypes.Content
+ src v1beta1.Content
exp string
}{
"store code": {
@@ -903,7 +885,7 @@ func TestProposalStrings(t *testing.T) {
func TestProposalYaml(t *testing.T) {
specs := map[string]struct {
- src govtypes.Content
+ src v1beta1.Content
exp string
}{
"store code": {
@@ -1051,8 +1033,8 @@ func TestConvertToProposals(t *testing.T) {
func TestUnmarshalContentFromJson(t *testing.T) {
specs := map[string]struct {
src string
- got govtypes.Content
- exp govtypes.Content
+ got v1beta1.Content
+ exp v1beta1.Content
}{
"instantiate ": {
src: `
@@ -1109,7 +1091,7 @@ func TestUnmarshalContentFromJson(t *testing.T) {
func TestProposalJsonSignBytes(t *testing.T) {
const myInnerMsg = `{"foo":"bar"}`
specs := map[string]struct {
- src govtypes.Content
+ src v1beta1.Content
exp string
}{
"instantiate contract": {
@@ -1131,11 +1113,11 @@ func TestProposalJsonSignBytes(t *testing.T) {
}
for name, spec := range specs {
t.Run(name, func(t *testing.T) {
- msg, err := govtypes.NewMsgSubmitProposal(spec.src, sdk.NewCoins(), []byte{})
+ msg, err := v1beta1.NewMsgSubmitProposal(spec.src, sdk.NewCoins(), []byte{})
require.NoError(t, err)
bz := msg.GetSignBytes()
- assert.JSONEq(t, spec.exp, string(bz), "raw: %s", string(bz))
+ assert.JSONEq(t, spec.exp, string(bz), "exp %s\n got: %s\n", spec.exp, string(bz))
})
}
}
diff --git a/x/wasm/types/query.pb.go b/x/wasm/types/query.pb.go
index 95175f2ae6..f7b6740ef2 100644
--- a/x/wasm/types/query.pb.go
+++ b/x/wasm/types/query.pb.go
@@ -11,11 +11,11 @@ import (
math "math"
math_bits "math/bits"
+ github_com_cometbft_cometbft_libs_bytes "github.com/cometbft/cometbft/libs/bytes"
query "github.com/cosmos/cosmos-sdk/types/query"
_ "github.com/cosmos/gogoproto/gogoproto"
- grpc1 "github.com/gogo/protobuf/grpc"
- proto "github.com/gogo/protobuf/proto"
- github_com_tendermint_tendermint_libs_bytes "github.com/tendermint/tendermint/libs/bytes"
+ grpc1 "github.com/cosmos/gogoproto/grpc"
+ proto "github.com/cosmos/gogoproto/proto"
_ "google.golang.org/genproto/googleapis/api/annotations"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
@@ -633,10 +633,10 @@ var xxx_messageInfo_QueryCodeRequest proto.InternalMessageInfo
// CodeInfoResponse contains code meta data from CodeInfo
type CodeInfoResponse struct {
- CodeID uint64 `protobuf:"varint,1,opt,name=code_id,json=codeId,proto3" json:"id"`
- Creator string `protobuf:"bytes,2,opt,name=creator,proto3" json:"creator,omitempty"`
- DataHash github_com_tendermint_tendermint_libs_bytes.HexBytes `protobuf:"bytes,3,opt,name=data_hash,json=dataHash,proto3,casttype=github.com/tendermint/tendermint/libs/bytes.HexBytes" json:"data_hash,omitempty"`
- InstantiatePermission AccessConfig `protobuf:"bytes,6,opt,name=instantiate_permission,json=instantiatePermission,proto3" json:"instantiate_permission"`
+ CodeID uint64 `protobuf:"varint,1,opt,name=code_id,json=codeId,proto3" json:"id"`
+ Creator string `protobuf:"bytes,2,opt,name=creator,proto3" json:"creator,omitempty"`
+ DataHash github_com_cometbft_cometbft_libs_bytes.HexBytes `protobuf:"bytes,3,opt,name=data_hash,json=dataHash,proto3,casttype=github.com/cometbft/cometbft/libs/bytes.HexBytes" json:"data_hash,omitempty"`
+ InstantiatePermission AccessConfig `protobuf:"bytes,6,opt,name=instantiate_permission,json=instantiatePermission,proto3" json:"instantiate_permission"`
}
func (m *CodeInfoResponse) Reset() { *m = CodeInfoResponse{} }
@@ -1109,91 +1109,90 @@ func init() {
func init() { proto.RegisterFile("cosmwasm/wasm/v1/query.proto", fileDescriptor_9677c207036b9f2b) }
var fileDescriptor_9677c207036b9f2b = []byte{
- // 1331 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x98, 0xcd, 0x6f, 0x1b, 0xc5,
- 0x1b, 0xc7, 0x3d, 0xa9, 0xe3, 0x97, 0x69, 0xfa, 0xab, 0x3b, 0xbf, 0xd2, 0x18, 0x93, 0xae, 0xa3,
- 0xa5, 0xa4, 0x69, 0x9a, 0xee, 0x92, 0x34, 0xa1, 0x80, 0x84, 0x50, 0x9c, 0x42, 0x93, 0x48, 0x91,
- 0xd2, 0xad, 0x50, 0x25, 0x7a, 0xb0, 0xc6, 0xde, 0x89, 0xb3, 0x52, 0xbc, 0xeb, 0xec, 0x4c, 0x92,
- 0x5a, 0x51, 0x00, 0x55, 0xe2, 0x86, 0x78, 0x11, 0xe2, 0xc0, 0x01, 0xc1, 0x01, 0x15, 0xce, 0x70,
- 0x41, 0x5c, 0xb9, 0xe4, 0x18, 0x89, 0x0b, 0x27, 0x0b, 0x1c, 0x0e, 0x28, 0x7f, 0x42, 0x4f, 0x68,
- 0x67, 0x67, 0x9c, 0x5d, 0xdb, 0x1b, 0x3b, 0x95, 0xc5, 0xc5, 0xda, 0xdd, 0x79, 0x66, 0x9e, 0xcf,
- 0xf3, 0x9d, 0x67, 0xe6, 0x79, 0x64, 0x38, 0x56, 0x76, 0x68, 0x75, 0x17, 0xd3, 0xaa, 0xce, 0x7f,
- 0x76, 0x66, 0xf4, 0xad, 0x6d, 0xe2, 0xd6, 0xb5, 0x9a, 0xeb, 0x30, 0x07, 0x65, 0xe4, 0xa8, 0xc6,
- 0x7f, 0x76, 0x66, 0x72, 0x97, 0x2b, 0x4e, 0xc5, 0xe1, 0x83, 0xba, 0xf7, 0xe4, 0xdb, 0xe5, 0x3a,
- 0x57, 0x61, 0xf5, 0x1a, 0xa1, 0x72, 0xb4, 0xe2, 0x38, 0x95, 0x4d, 0xa2, 0xe3, 0x9a, 0xa5, 0x63,
- 0xdb, 0x76, 0x18, 0x66, 0x96, 0x63, 0xcb, 0xd1, 0x29, 0x6f, 0xae, 0x43, 0xf5, 0x12, 0xa6, 0xc4,
- 0x77, 0xae, 0xef, 0xcc, 0x94, 0x08, 0xc3, 0x33, 0x7a, 0x0d, 0x57, 0x2c, 0x9b, 0x1b, 0xfb, 0xb6,
- 0xea, 0x1c, 0xcc, 0xde, 0xf7, 0x2c, 0x16, 0x1d, 0x9b, 0xb9, 0xb8, 0xcc, 0x96, 0xed, 0x75, 0xc7,
- 0x20, 0x5b, 0xdb, 0x84, 0x32, 0x94, 0x85, 0x49, 0x6c, 0x9a, 0x2e, 0xa1, 0x34, 0x0b, 0xc6, 0xc1,
- 0x64, 0xda, 0x90, 0xaf, 0xea, 0xa7, 0x00, 0xbe, 0xd8, 0x65, 0x1a, 0xad, 0x39, 0x36, 0x25, 0xd1,
- 0xf3, 0xd0, 0x7d, 0x78, 0xa1, 0x2c, 0x66, 0x14, 0x2d, 0x7b, 0xdd, 0xc9, 0x0e, 0x8d, 0x83, 0xc9,
- 0xf3, 0xb3, 0x8a, 0xd6, 0xae, 0x8a, 0x16, 0x5c, 0xb8, 0x30, 0x72, 0xd0, 0xc8, 0xc7, 0x0e, 0x1b,
- 0x79, 0x70, 0xdc, 0xc8, 0xc7, 0x8c, 0x91, 0x72, 0x60, 0xec, 0xcd, 0xf8, 0x3f, 0xdf, 0xe5, 0x81,
- 0xfa, 0x21, 0x7c, 0x29, 0xc4, 0xb3, 0x64, 0x51, 0xe6, 0xb8, 0xf5, 0x9e, 0x91, 0xa0, 0x77, 0x21,
- 0x3c, 0xd1, 0x44, 0xe0, 0x4c, 0x68, 0xbe, 0x80, 0x9a, 0x27, 0xa0, 0xe6, 0xef, 0x9e, 0x10, 0x50,
- 0x5b, 0xc3, 0x15, 0x22, 0x56, 0x35, 0x02, 0x33, 0xd5, 0x9f, 0x01, 0x1c, 0xeb, 0x4e, 0x20, 0x44,
- 0x59, 0x81, 0x49, 0x62, 0x33, 0xd7, 0x22, 0x1e, 0xc2, 0xb9, 0xc9, 0xf3, 0xb3, 0x53, 0xd1, 0x41,
- 0x2f, 0x3a, 0x26, 0x11, 0xf3, 0xdf, 0xb1, 0x99, 0x5b, 0x2f, 0xc4, 0x3d, 0x01, 0x0c, 0xb9, 0x00,
- 0xba, 0xd7, 0x05, 0xfa, 0x7a, 0x4f, 0x68, 0x1f, 0x24, 0x44, 0xfd, 0x41, 0x9b, 0x6c, 0xb4, 0x50,
- 0xf7, 0x7c, 0x4b, 0xd9, 0x46, 0x61, 0xb2, 0xec, 0x98, 0xa4, 0x68, 0x99, 0x5c, 0xb6, 0xb8, 0x91,
- 0xf0, 0x5e, 0x97, 0xcd, 0x81, 0xa9, 0xf6, 0x71, 0xbb, 0x6a, 0x2d, 0x00, 0xa1, 0xda, 0x18, 0x4c,
- 0xcb, 0xdd, 0xf6, 0x75, 0x4b, 0x1b, 0x27, 0x1f, 0x06, 0xa7, 0xc3, 0x47, 0x92, 0x63, 0x61, 0x73,
- 0x53, 0xa2, 0x3c, 0x60, 0x98, 0x91, 0xff, 0x2e, 0x81, 0xbe, 0x05, 0xf0, 0x6a, 0x04, 0x82, 0xd0,
- 0x62, 0x1e, 0x26, 0xaa, 0x8e, 0x49, 0x36, 0x65, 0x02, 0x8d, 0x76, 0x26, 0xd0, 0xaa, 0x37, 0x2e,
- 0xb2, 0x45, 0x18, 0x0f, 0x4e, 0xa4, 0x87, 0x42, 0x23, 0x03, 0xef, 0x9e, 0x51, 0xa3, 0xab, 0x10,
- 0x72, 0x1f, 0x45, 0x13, 0x33, 0xcc, 0x11, 0x46, 0x8c, 0x34, 0xff, 0x72, 0x17, 0x33, 0xac, 0xde,
- 0x16, 0x91, 0x77, 0x2e, 0x2c, 0x22, 0x47, 0x30, 0xce, 0x67, 0x02, 0x3e, 0x93, 0x3f, 0xab, 0x5b,
- 0x50, 0xe1, 0x93, 0x1e, 0x54, 0xb1, 0xcb, 0xce, 0xc8, 0x33, 0xdf, 0xc9, 0x53, 0xb8, 0xf2, 0xac,
- 0x91, 0x47, 0x01, 0x82, 0x55, 0x42, 0xa9, 0xa7, 0x44, 0x80, 0x73, 0x15, 0xe6, 0x23, 0x5d, 0x0a,
- 0xd2, 0xa9, 0x20, 0x69, 0xe4, 0x9a, 0x7e, 0x04, 0x37, 0x61, 0x46, 0xe4, 0x7e, 0xef, 0x13, 0xa7,
- 0x7e, 0x33, 0x04, 0x33, 0x9e, 0x61, 0xe8, 0xa2, 0xbd, 0xd1, 0x66, 0x5d, 0xc8, 0x34, 0x1b, 0xf9,
- 0x04, 0x37, 0xbb, 0x7b, 0xdc, 0xc8, 0x0f, 0x59, 0x66, 0xeb, 0xc4, 0x66, 0x61, 0xb2, 0xec, 0x12,
- 0xcc, 0x1c, 0x97, 0xc7, 0x9b, 0x36, 0xe4, 0x2b, 0x7a, 0x0f, 0xa6, 0x3d, 0x9c, 0xe2, 0x06, 0xa6,
- 0x1b, 0xd9, 0x73, 0x9c, 0xfb, 0xf5, 0x67, 0x8d, 0xfc, 0x5c, 0xc5, 0x62, 0x1b, 0xdb, 0x25, 0xad,
- 0xec, 0x54, 0x75, 0x46, 0x6c, 0x93, 0xb8, 0x55, 0xcb, 0x66, 0xc1, 0xc7, 0x4d, 0xab, 0x44, 0xf5,
- 0x52, 0x9d, 0x11, 0xaa, 0x2d, 0x91, 0xc7, 0x05, 0xef, 0xc1, 0x48, 0x79, 0x4b, 0x2d, 0x61, 0xba,
- 0x81, 0x1e, 0xc1, 0x2b, 0x96, 0x4d, 0x19, 0xb6, 0x99, 0x85, 0x19, 0x29, 0xd6, 0xbc, 0x49, 0x94,
- 0x7a, 0x29, 0x98, 0x88, 0xba, 0xf3, 0x17, 0xca, 0x65, 0x42, 0xe9, 0xa2, 0x63, 0xaf, 0x5b, 0x15,
- 0x91, 0xc4, 0x2f, 0x04, 0xd6, 0x58, 0x6b, 0x2d, 0xe1, 0x5f, 0xfa, 0x2b, 0xf1, 0x54, 0x3c, 0x33,
- 0xbc, 0x12, 0x4f, 0x0d, 0x67, 0x12, 0xea, 0x13, 0x00, 0x2f, 0x05, 0xd4, 0x14, 0x02, 0x2d, 0x7b,
- 0xd7, 0x87, 0x27, 0x90, 0x57, 0x6b, 0x00, 0xf7, 0xab, 0x76, 0xbb, 0x76, 0xc3, 0xba, 0x16, 0x52,
- 0xad, 0x5a, 0x93, 0x2a, 0x8b, 0x31, 0x34, 0x26, 0x76, 0xd6, 0xcf, 0x96, 0xd4, 0x71, 0x23, 0xcf,
- 0xdf, 0xfd, 0xbd, 0x14, 0x55, 0xe8, 0x51, 0x80, 0x81, 0xca, 0x2d, 0x0d, 0x5f, 0x10, 0xe0, 0xb9,
- 0x2f, 0x88, 0xa7, 0x00, 0xa2, 0xe0, 0xea, 0x22, 0xc4, 0x7b, 0x10, 0xb6, 0x42, 0x94, 0x37, 0x43,
- 0x3f, 0x31, 0xfa, 0xfa, 0xa6, 0x65, 0x7c, 0x03, 0xbc, 0x27, 0x30, 0x1c, 0xe5, 0x9c, 0x6b, 0x96,
- 0x6d, 0x13, 0xf3, 0x14, 0x2d, 0x9e, 0xff, 0xb2, 0xfc, 0x0c, 0x88, 0xb6, 0x25, 0xe4, 0xa3, 0x75,
- 0x06, 0x53, 0xe2, 0x54, 0xf8, 0x7a, 0xc4, 0x0b, 0x17, 0xbd, 0x58, 0x9b, 0x8d, 0x7c, 0xd2, 0x3f,
- 0x1a, 0xd4, 0x48, 0xfa, 0xa7, 0x62, 0x80, 0x41, 0x5f, 0x16, 0x9b, 0xb3, 0x86, 0x5d, 0x5c, 0x95,
- 0xf1, 0xaa, 0xab, 0xf0, 0xff, 0xa1, 0xaf, 0x82, 0xf0, 0x35, 0x98, 0xa8, 0xf1, 0x2f, 0x22, 0x1d,
- 0xb2, 0x9d, 0xfb, 0xe5, 0xcf, 0x90, 0x57, 0xb9, 0x6f, 0xad, 0x7e, 0x01, 0xc4, 0xa5, 0x17, 0x2c,
- 0x97, 0xfe, 0x31, 0x96, 0x0a, 0x5f, 0x87, 0x17, 0xc5, 0xc1, 0x2e, 0x86, 0x2f, 0xbf, 0xff, 0x89,
- 0xcf, 0x0b, 0x03, 0xae, 0x5b, 0x5f, 0x03, 0x71, 0x2b, 0x76, 0x63, 0x12, 0xf1, 0xde, 0x82, 0xa8,
- 0xd5, 0xf6, 0x09, 0x2a, 0x22, 0xcb, 0xf9, 0x25, 0x39, 0xb2, 0x20, 0x07, 0x06, 0xb6, 0x29, 0xb3,
- 0xbf, 0x5d, 0x80, 0xc3, 0x9c, 0x0d, 0x7d, 0x05, 0xe0, 0x48, 0xb0, 0xa5, 0x44, 0x5d, 0xba, 0xaf,
- 0xa8, 0x3e, 0x38, 0x77, 0xb3, 0x2f, 0x5b, 0xdf, 0xbf, 0x3a, 0xfd, 0xe4, 0xf7, 0xbf, 0xbf, 0x1c,
- 0x9a, 0x40, 0xd7, 0xf4, 0x8e, 0x0e, 0x5e, 0x46, 0xaa, 0xef, 0x09, 0x11, 0xf6, 0xd1, 0x53, 0x00,
- 0x2f, 0xb6, 0x75, 0x8c, 0xe8, 0x56, 0x0f, 0x77, 0xe1, 0xde, 0x36, 0xa7, 0xf5, 0x6b, 0x2e, 0x00,
- 0xe7, 0x38, 0xa0, 0x86, 0xa6, 0xfb, 0x01, 0xd4, 0x37, 0x04, 0xd4, 0xf7, 0x01, 0x50, 0xd1, 0xa4,
- 0xf5, 0x04, 0x0d, 0x77, 0x93, 0x3d, 0x41, 0xdb, 0x7a, 0x3f, 0x75, 0x96, 0x83, 0x4e, 0xa3, 0xa9,
- 0x6e, 0xa0, 0x26, 0xd1, 0xf7, 0xc4, 0x29, 0xdf, 0xd7, 0x4f, 0x3a, 0xc2, 0x1f, 0x00, 0xcc, 0xb4,
- 0x37, 0x50, 0x28, 0xca, 0x71, 0x44, 0xb3, 0x97, 0xd3, 0xfb, 0xb6, 0xef, 0x87, 0xb4, 0x43, 0x52,
- 0xca, 0xa1, 0x7e, 0x02, 0x30, 0xd3, 0xde, 0xf0, 0x44, 0x92, 0x46, 0xb4, 0x5c, 0x91, 0xa4, 0x51,
- 0x9d, 0x94, 0xfa, 0x16, 0x27, 0xbd, 0x83, 0xe6, 0xfb, 0x22, 0x75, 0xf1, 0xae, 0xbe, 0x77, 0xd2,
- 0x29, 0xed, 0xa3, 0x5f, 0x01, 0x44, 0x9d, 0xdd, 0x0f, 0x7a, 0x35, 0x02, 0x23, 0xb2, 0x37, 0xcb,
- 0xcd, 0x9c, 0x61, 0x86, 0x40, 0x7f, 0x9b, 0xa3, 0xbf, 0x81, 0xee, 0xf4, 0x27, 0xb2, 0xb7, 0x50,
- 0x18, 0xbe, 0x0e, 0xe3, 0x3c, 0x6d, 0xd5, 0xc8, 0x3c, 0x3c, 0xc9, 0xd5, 0x97, 0x4f, 0xb5, 0x11,
- 0x44, 0x93, 0x9c, 0x48, 0x45, 0xe3, 0xbd, 0x12, 0x14, 0xb9, 0x70, 0x98, 0xd7, 0x28, 0x74, 0xda,
- 0xba, 0xb2, 0x6a, 0xe4, 0xae, 0x9d, 0x6e, 0x24, 0xbc, 0x2b, 0xdc, 0x7b, 0x16, 0x5d, 0xe9, 0xee,
- 0x1d, 0x7d, 0x02, 0xe0, 0xf9, 0x40, 0x79, 0x44, 0x37, 0x22, 0x56, 0xed, 0x2c, 0xd3, 0xb9, 0xa9,
- 0x7e, 0x4c, 0x05, 0xc6, 0x04, 0xc7, 0x18, 0x47, 0x4a, 0x77, 0x0c, 0xaa, 0xd7, 0xf8, 0x24, 0xb4,
- 0x0f, 0x13, 0x7e, 0x4d, 0x43, 0x51, 0xe1, 0x85, 0x4a, 0x67, 0xee, 0x95, 0x1e, 0x56, 0x7d, 0xbb,
- 0xf7, 0x9d, 0xfe, 0x02, 0x20, 0xea, 0xac, 0x50, 0x91, 0x99, 0x1b, 0x59, 0x60, 0x23, 0x33, 0x37,
- 0xba, 0xfc, 0xf5, 0x73, 0xe8, 0xa8, 0x2e, 0xca, 0xb3, 0xbe, 0xd7, 0x56, 0xbe, 0xf7, 0x0b, 0x4b,
- 0x07, 0x7f, 0x29, 0xb1, 0x1f, 0x9b, 0x4a, 0xec, 0xa0, 0xa9, 0x80, 0xc3, 0xa6, 0x02, 0xfe, 0x6c,
- 0x2a, 0xe0, 0xf3, 0x23, 0x25, 0x76, 0x78, 0xa4, 0xc4, 0xfe, 0x38, 0x52, 0x62, 0xef, 0x4f, 0x04,
- 0x7a, 0xf5, 0x45, 0x87, 0x56, 0x1f, 0x4a, 0x17, 0xa6, 0xfe, 0xd8, 0x77, 0xc5, 0xff, 0x3c, 0x2a,
- 0x25, 0xf8, 0x7f, 0x3e, 0xb7, 0xff, 0x0d, 0x00, 0x00, 0xff, 0xff, 0x78, 0x46, 0xe1, 0xa8, 0xa3,
- 0x12, 0x00, 0x00,
+ // 1327 bytes of a gzipped FileDescriptorProto
+ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x98, 0xcf, 0x6f, 0x1b, 0x45,
+ 0x14, 0xc7, 0x3d, 0xa9, 0xe3, 0x1f, 0x93, 0x94, 0xba, 0x43, 0x69, 0x8d, 0x49, 0xd7, 0xd1, 0x52,
+ 0xd2, 0x34, 0x6d, 0x77, 0x9b, 0xb4, 0xa5, 0x02, 0x09, 0xa1, 0x38, 0x85, 0x26, 0x91, 0x22, 0x25,
+ 0xdb, 0x43, 0x25, 0x7a, 0xb0, 0xc6, 0xde, 0x89, 0xb3, 0x52, 0xbc, 0xeb, 0xec, 0x4c, 0x92, 0x5a,
+ 0x51, 0x00, 0x55, 0xe2, 0x04, 0x42, 0x20, 0xc4, 0xa1, 0x27, 0x38, 0xa0, 0xc2, 0x19, 0x2e, 0x88,
+ 0x2b, 0x97, 0x1c, 0x23, 0x71, 0xe1, 0x64, 0x81, 0xc3, 0x01, 0xe5, 0x4f, 0xe8, 0x09, 0xed, 0xec,
+ 0x8c, 0xbd, 0x6b, 0x7b, 0x63, 0xa7, 0xb2, 0xb8, 0x58, 0xbb, 0x3b, 0x6f, 0xe6, 0x7d, 0xde, 0x77,
+ 0xde, 0xcc, 0x7b, 0x32, 0x9c, 0x28, 0x3b, 0xb4, 0xba, 0x8b, 0x69, 0x55, 0xe7, 0x3f, 0x3b, 0xb3,
+ 0xfa, 0xd6, 0x36, 0x71, 0xeb, 0x5a, 0xcd, 0x75, 0x98, 0x83, 0x32, 0x72, 0x54, 0xe3, 0x3f, 0x3b,
+ 0xb3, 0xb9, 0x0b, 0x15, 0xa7, 0xe2, 0xf0, 0x41, 0xdd, 0x7b, 0xf2, 0xed, 0x72, 0xdd, 0xab, 0xb0,
+ 0x7a, 0x8d, 0x50, 0x39, 0x5a, 0x71, 0x9c, 0xca, 0x26, 0xd1, 0x71, 0xcd, 0xd2, 0xb1, 0x6d, 0x3b,
+ 0x0c, 0x33, 0xcb, 0xb1, 0xe5, 0xe8, 0x8c, 0x37, 0xd7, 0xa1, 0x7a, 0x09, 0x53, 0xe2, 0x3b, 0xd7,
+ 0x77, 0x66, 0x4b, 0x84, 0xe1, 0x59, 0xbd, 0x86, 0x2b, 0x96, 0xcd, 0x8d, 0x7d, 0x5b, 0xf5, 0x0e,
+ 0xcc, 0xae, 0x79, 0x16, 0x0b, 0x8e, 0xcd, 0x5c, 0x5c, 0x66, 0x4b, 0xf6, 0xba, 0x63, 0x90, 0xad,
+ 0x6d, 0x42, 0x19, 0xca, 0xc2, 0x24, 0x36, 0x4d, 0x97, 0x50, 0x9a, 0x05, 0x93, 0x60, 0x3a, 0x6d,
+ 0xc8, 0x57, 0xf5, 0x4b, 0x00, 0x5f, 0xef, 0x31, 0x8d, 0xd6, 0x1c, 0x9b, 0x92, 0xe8, 0x79, 0x68,
+ 0x0d, 0x9e, 0x2d, 0x8b, 0x19, 0x45, 0xcb, 0x5e, 0x77, 0xb2, 0x23, 0x93, 0x60, 0x7a, 0x6c, 0x4e,
+ 0xd1, 0x3a, 0x55, 0xd1, 0x82, 0x0b, 0x17, 0xc6, 0x0f, 0x1a, 0xf9, 0xd8, 0x61, 0x23, 0x0f, 0x8e,
+ 0x1b, 0xf9, 0x98, 0x31, 0x5e, 0x0e, 0x8c, 0xbd, 0x1b, 0xff, 0xf7, 0xfb, 0x3c, 0x50, 0x3f, 0x81,
+ 0x6f, 0x84, 0x78, 0x16, 0x2d, 0xca, 0x1c, 0xb7, 0xde, 0x37, 0x12, 0xf4, 0x21, 0x84, 0x6d, 0x4d,
+ 0x04, 0xce, 0x94, 0xe6, 0x0b, 0xa8, 0x79, 0x02, 0x6a, 0xfe, 0xee, 0x09, 0x01, 0xb5, 0x55, 0x5c,
+ 0x21, 0x62, 0x55, 0x23, 0x30, 0x53, 0xfd, 0x05, 0xc0, 0x89, 0xde, 0x04, 0x42, 0x94, 0x65, 0x98,
+ 0x24, 0x36, 0x73, 0x2d, 0xe2, 0x21, 0x9c, 0x99, 0x1e, 0x9b, 0x9b, 0x89, 0x0e, 0x7a, 0xc1, 0x31,
+ 0x89, 0x98, 0xff, 0x81, 0xcd, 0xdc, 0x7a, 0x21, 0xee, 0x09, 0x60, 0xc8, 0x05, 0xd0, 0x83, 0x1e,
+ 0xd0, 0x57, 0xfb, 0x42, 0xfb, 0x20, 0x21, 0xea, 0x8f, 0x3b, 0x64, 0xa3, 0x85, 0xba, 0xe7, 0x5b,
+ 0xca, 0x76, 0x09, 0x26, 0xcb, 0x8e, 0x49, 0x8a, 0x96, 0xc9, 0x65, 0x8b, 0x1b, 0x09, 0xef, 0x75,
+ 0xc9, 0x1c, 0x9a, 0x6a, 0x9f, 0x75, 0xaa, 0xd6, 0x02, 0x10, 0xaa, 0x4d, 0xc0, 0xb4, 0xdc, 0x6d,
+ 0x5f, 0xb7, 0xb4, 0xd1, 0xfe, 0x30, 0x3c, 0x1d, 0x3e, 0x95, 0x1c, 0xf3, 0x9b, 0x9b, 0x12, 0xe5,
+ 0x21, 0xc3, 0x8c, 0xfc, 0x7f, 0x09, 0xf4, 0x1d, 0x80, 0x97, 0x23, 0x10, 0x84, 0x16, 0x77, 0x61,
+ 0xa2, 0xea, 0x98, 0x64, 0x53, 0x26, 0xd0, 0xa5, 0xee, 0x04, 0x5a, 0xf1, 0xc6, 0x45, 0xb6, 0x08,
+ 0xe3, 0xe1, 0x89, 0xf4, 0x48, 0x68, 0x64, 0xe0, 0xdd, 0x53, 0x6a, 0x74, 0x19, 0x42, 0xee, 0xa3,
+ 0x68, 0x62, 0x86, 0x39, 0xc2, 0xb8, 0x91, 0xe6, 0x5f, 0xee, 0x63, 0x86, 0xd5, 0xdb, 0x22, 0xf2,
+ 0xee, 0x85, 0x45, 0xe4, 0x08, 0xc6, 0xf9, 0x4c, 0xc0, 0x67, 0xf2, 0x67, 0x75, 0x0b, 0x2a, 0x7c,
+ 0xd2, 0xc3, 0x2a, 0x76, 0xd9, 0x29, 0x79, 0xee, 0x76, 0xf3, 0x14, 0x2e, 0xbe, 0x68, 0xe4, 0x51,
+ 0x80, 0x60, 0x85, 0x50, 0xea, 0x29, 0x11, 0xe0, 0x5c, 0x81, 0xf9, 0x48, 0x97, 0x82, 0x74, 0x26,
+ 0x48, 0x1a, 0xb9, 0xa6, 0x1f, 0xc1, 0x75, 0x98, 0x11, 0xb9, 0xdf, 0xff, 0xc4, 0xa9, 0xcf, 0x46,
+ 0x60, 0xc6, 0x33, 0x0c, 0x5d, 0xb4, 0xd7, 0x3a, 0xac, 0x0b, 0x99, 0x66, 0x23, 0x9f, 0xe0, 0x66,
+ 0xf7, 0x8f, 0x1b, 0xf9, 0x11, 0xcb, 0x6c, 0x9d, 0xd8, 0x2c, 0x4c, 0x96, 0x5d, 0x82, 0x99, 0xe3,
+ 0xf2, 0x78, 0xd3, 0x86, 0x7c, 0x45, 0x6b, 0x30, 0xed, 0xe1, 0x14, 0x37, 0x30, 0xdd, 0xc8, 0x9e,
+ 0xe1, 0xdc, 0x77, 0x5e, 0x34, 0xf2, 0xb7, 0x2a, 0x16, 0xdb, 0xd8, 0x2e, 0x69, 0x65, 0xa7, 0xaa,
+ 0x97, 0x9d, 0x2a, 0x61, 0xa5, 0x75, 0xd6, 0x7e, 0xd8, 0xb4, 0x4a, 0x54, 0x2f, 0xd5, 0x19, 0xa1,
+ 0xda, 0x22, 0x79, 0x52, 0xf0, 0x1e, 0x8c, 0x94, 0xb7, 0xcc, 0x22, 0xa6, 0x1b, 0xe8, 0x31, 0xbc,
+ 0x68, 0xd9, 0x94, 0x61, 0x9b, 0x59, 0x98, 0x91, 0x62, 0x8d, 0xb8, 0x55, 0x8b, 0x52, 0x2f, 0xfd,
+ 0x12, 0x51, 0xf7, 0xfd, 0x7c, 0xb9, 0x4c, 0x28, 0x5d, 0x70, 0xec, 0x75, 0xab, 0x22, 0x12, 0xf8,
+ 0xb5, 0xc0, 0x1a, 0xab, 0xad, 0x25, 0xfc, 0x0b, 0x7f, 0x39, 0x9e, 0x8a, 0x67, 0x46, 0x97, 0xe3,
+ 0xa9, 0xd1, 0x4c, 0x42, 0x7d, 0x0a, 0xe0, 0xf9, 0x80, 0x92, 0x42, 0x9c, 0x25, 0xef, 0xea, 0xf0,
+ 0xc4, 0xf1, 0xea, 0x0c, 0xe0, 0x7e, 0xd5, 0x5e, 0x57, 0x6e, 0x58, 0xd3, 0x42, 0xaa, 0x55, 0x67,
+ 0x52, 0x65, 0x31, 0x86, 0x26, 0xc4, 0xae, 0xfa, 0x99, 0x92, 0x3a, 0x6e, 0xe4, 0xf9, 0xbb, 0xbf,
+ 0x8f, 0xa2, 0x02, 0x3d, 0x0e, 0x30, 0x50, 0xb9, 0x9d, 0xe1, 0xcb, 0x01, 0xbc, 0xf4, 0xe5, 0xf0,
+ 0x1c, 0x40, 0x14, 0x5c, 0x5d, 0x84, 0xf8, 0x00, 0xc2, 0x56, 0x88, 0xf2, 0x56, 0x18, 0x24, 0x46,
+ 0x5f, 0xdf, 0xb4, 0x8c, 0x6f, 0x88, 0x77, 0x04, 0x86, 0x97, 0x38, 0xe7, 0xaa, 0x65, 0xdb, 0xc4,
+ 0x3c, 0x41, 0x8b, 0x97, 0xbf, 0x28, 0x3f, 0x07, 0xa2, 0x65, 0x09, 0xf9, 0x10, 0x8a, 0x4c, 0xc1,
+ 0x94, 0x38, 0x11, 0xbe, 0x1e, 0xf1, 0xc2, 0x58, 0xb3, 0x91, 0x4f, 0xfa, 0x47, 0x82, 0x1a, 0x49,
+ 0xff, 0x34, 0x0c, 0x31, 0xe0, 0x0b, 0x62, 0x63, 0x56, 0xb1, 0x8b, 0xab, 0x32, 0x56, 0x75, 0x05,
+ 0xbe, 0x1a, 0xfa, 0x2a, 0xe8, 0xde, 0x86, 0x89, 0x1a, 0xff, 0x22, 0x52, 0x21, 0xdb, 0xbd, 0x57,
+ 0xfe, 0x0c, 0x79, 0x85, 0xfb, 0xd6, 0xea, 0xd7, 0x40, 0x5c, 0x76, 0xc1, 0x32, 0xe9, 0x1f, 0x5f,
+ 0xa9, 0xee, 0x55, 0x78, 0x4e, 0x1c, 0xe8, 0x62, 0xf8, 0xd2, 0x7b, 0x45, 0x7c, 0x9e, 0x1f, 0x72,
+ 0xbd, 0x7a, 0x06, 0xc4, 0x6d, 0xd8, 0x8b, 0x49, 0xc4, 0x7b, 0x13, 0xa2, 0x56, 0xbb, 0x27, 0xa8,
+ 0x88, 0x2c, 0xe3, 0xe7, 0xe5, 0xc8, 0xbc, 0x1c, 0x18, 0xda, 0xa6, 0xcc, 0xfd, 0x7e, 0x16, 0x8e,
+ 0x72, 0x36, 0xf4, 0x2d, 0x80, 0xe3, 0xc1, 0x56, 0x12, 0xf5, 0xe8, 0xba, 0xa2, 0xfa, 0xdf, 0xdc,
+ 0xf5, 0x81, 0x6c, 0x7d, 0xff, 0xea, 0x8d, 0xa7, 0x7f, 0xfc, 0xf3, 0xcd, 0xc8, 0x14, 0xba, 0xa2,
+ 0x77, 0x75, 0xee, 0x32, 0x52, 0x7d, 0x4f, 0x88, 0xb0, 0x8f, 0x9e, 0x03, 0x78, 0xae, 0xa3, 0x53,
+ 0x44, 0x37, 0xfb, 0xb8, 0x0b, 0xf7, 0xb4, 0x39, 0x6d, 0x50, 0x73, 0x01, 0x78, 0x87, 0x03, 0x6a,
+ 0xe8, 0xc6, 0x20, 0x80, 0xfa, 0x86, 0x80, 0xfa, 0x21, 0x00, 0x2a, 0x9a, 0xb3, 0xbe, 0xa0, 0xe1,
+ 0x2e, 0xb2, 0x2f, 0x68, 0x47, 0xcf, 0xa7, 0xce, 0x71, 0xd0, 0x1b, 0x68, 0xa6, 0x17, 0xa8, 0x49,
+ 0xf4, 0x3d, 0x71, 0xc2, 0xf7, 0xf5, 0x76, 0x27, 0xf8, 0x23, 0x80, 0x99, 0xce, 0xc6, 0x09, 0x45,
+ 0x39, 0x8e, 0x68, 0xf2, 0x72, 0xfa, 0xc0, 0xf6, 0x83, 0x90, 0x76, 0x49, 0x4a, 0x39, 0xd4, 0xcf,
+ 0x00, 0x66, 0x3a, 0x1b, 0x9d, 0x48, 0xd2, 0x88, 0x56, 0x2b, 0x92, 0x34, 0xaa, 0x83, 0x52, 0xdf,
+ 0xe3, 0xa4, 0xf7, 0xd0, 0xdd, 0x81, 0x48, 0x5d, 0xbc, 0xab, 0xef, 0xb5, 0x3b, 0xa4, 0x7d, 0xf4,
+ 0x1b, 0x80, 0xa8, 0xbb, 0xeb, 0x41, 0xb7, 0x22, 0x30, 0x22, 0x7b, 0xb2, 0xdc, 0xec, 0x29, 0x66,
+ 0x08, 0xf4, 0xf7, 0x39, 0xfa, 0x3b, 0xe8, 0xde, 0x60, 0x22, 0x7b, 0x0b, 0x85, 0xe1, 0xeb, 0x30,
+ 0xce, 0xd3, 0x56, 0x8d, 0xcc, 0xc3, 0x76, 0xae, 0xbe, 0x79, 0xa2, 0x8d, 0x20, 0x9a, 0xe6, 0x44,
+ 0x2a, 0x9a, 0xec, 0x97, 0xa0, 0xc8, 0x85, 0xa3, 0xbc, 0x3e, 0xa1, 0x93, 0xd6, 0x95, 0x55, 0x23,
+ 0x77, 0xe5, 0x64, 0x23, 0xe1, 0x5d, 0xe1, 0xde, 0xb3, 0xe8, 0x62, 0x6f, 0xef, 0xe8, 0x0b, 0x00,
+ 0xc7, 0x02, 0xa5, 0x11, 0x5d, 0x8b, 0x58, 0xb5, 0xbb, 0x44, 0xe7, 0x66, 0x06, 0x31, 0x15, 0x18,
+ 0x53, 0x1c, 0x63, 0x12, 0x29, 0xbd, 0x31, 0xa8, 0x5e, 0xe3, 0x93, 0xd0, 0x3e, 0x4c, 0xf8, 0x35,
+ 0x0d, 0x45, 0x85, 0x17, 0x2a, 0x9d, 0xb9, 0xb7, 0xfa, 0x58, 0x0d, 0xec, 0xde, 0x77, 0xfa, 0x2b,
+ 0x80, 0xa8, 0xbb, 0x42, 0x45, 0x66, 0x6e, 0x64, 0x81, 0x8d, 0xcc, 0xdc, 0xe8, 0xf2, 0x37, 0xc8,
+ 0xa1, 0xa3, 0xba, 0x28, 0xcf, 0xfa, 0x5e, 0x47, 0xf9, 0xde, 0x2f, 0x2c, 0x1e, 0xfc, 0xad, 0xc4,
+ 0x7e, 0x6a, 0x2a, 0xb1, 0x83, 0xa6, 0x02, 0x0e, 0x9b, 0x0a, 0xf8, 0xab, 0xa9, 0x80, 0xaf, 0x8e,
+ 0x94, 0xd8, 0xe1, 0x91, 0x12, 0xfb, 0xf3, 0x48, 0x89, 0x7d, 0x34, 0x15, 0xe8, 0xd1, 0x17, 0x1c,
+ 0x5a, 0x7d, 0x24, 0x5d, 0x98, 0xfa, 0x13, 0xdf, 0x15, 0xff, 0xd3, 0xa8, 0x94, 0xe0, 0xff, 0xf5,
+ 0xdc, 0xfe, 0x2f, 0x00, 0x00, 0xff, 0xff, 0xd3, 0x6d, 0x1b, 0x9d, 0x9b, 0x12, 0x00, 0x00,
}
func (this *QueryContractInfoResponse) Equal(that interface{}) bool {
diff --git a/x/wasm/types/tx.go b/x/wasm/types/tx.go
index 045f5341e7..22c8f1b052 100644
--- a/x/wasm/types/tx.go
+++ b/x/wasm/types/tx.go
@@ -6,6 +6,7 @@ import (
"errors"
"strings"
+ errorsmod "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
)
@@ -61,12 +62,17 @@ func (msg MsgStoreCode) ValidateBasic() error {
}
if err := validateWasmCode(msg.WASMByteCode, MaxWasmSize); err != nil {
- return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "code bytes %s", err.Error())
+ return errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "code bytes %s", err.Error())
}
if msg.InstantiatePermission != nil {
if err := msg.InstantiatePermission.ValidateBasic(); err != nil {
- return sdkerrors.Wrap(err, "instantiate permission")
+ return errorsmod.Wrap(err, "instantiate permission")
+ }
+ // AccessTypeOnlyAddress is still considered valid as legacy instantiation permission
+ // but not for new contracts
+ if msg.InstantiatePermission.Permission == AccessTypeOnlyAddress {
+ return ErrInvalid.Wrap("unsupported type, use AccessTypeAnyOfAddresses instead")
}
// AccessTypeOnlyAddress is still considered valid as legacy instantiation permission
// but not for new contracts
@@ -99,15 +105,15 @@ func (msg MsgInstantiateContract) Type() string {
func (msg MsgInstantiateContract) ValidateBasic() error {
if _, err := sdk.AccAddressFromBech32(msg.Sender); err != nil {
- return sdkerrors.Wrap(err, "sender")
+ return errorsmod.Wrap(err, "sender")
}
if msg.CodeID == 0 {
- return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "code id is required")
+ return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "code id is required")
}
if err := ValidateLabel(msg.Label); err != nil {
- return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "label is required")
+ return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "label is required")
}
if !msg.Funds.IsValid() {
@@ -116,11 +122,11 @@ func (msg MsgInstantiateContract) ValidateBasic() error {
if len(msg.Admin) != 0 {
if _, err := sdk.AccAddressFromBech32(msg.Admin); err != nil {
- return sdkerrors.Wrap(err, "admin")
+ return errorsmod.Wrap(err, "admin")
}
}
if err := msg.Msg.ValidateBasic(); err != nil {
- return sdkerrors.Wrap(err, "payload msg")
+ return errorsmod.Wrap(err, "payload msg")
}
return nil
}
@@ -147,17 +153,17 @@ func (msg MsgExecuteContract) Type() string {
func (msg MsgExecuteContract) ValidateBasic() error {
if _, err := sdk.AccAddressFromBech32(msg.Sender); err != nil {
- return sdkerrors.Wrap(err, "sender")
+ return errorsmod.Wrap(err, "sender")
}
if _, err := sdk.AccAddressFromBech32(msg.Contract); err != nil {
- return sdkerrors.Wrap(err, "contract")
+ return errorsmod.Wrap(err, "contract")
}
if !msg.Funds.IsValid() {
- return sdkerrors.Wrap(sdkerrors.ErrInvalidCoins, "sentFunds")
+ return errorsmod.Wrap(sdkerrors.ErrInvalidCoins, "sentFunds")
}
if err := msg.Msg.ValidateBasic(); err != nil {
- return sdkerrors.Wrap(err, "payload msg")
+ return errorsmod.Wrap(err, "payload msg")
}
return nil
}
@@ -199,17 +205,17 @@ func (msg MsgMigrateContract) Type() string {
func (msg MsgMigrateContract) ValidateBasic() error {
if msg.CodeID == 0 {
- return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "code id is required")
+ return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "code id is required")
}
if _, err := sdk.AccAddressFromBech32(msg.Sender); err != nil {
- return sdkerrors.Wrap(err, "sender")
+ return errorsmod.Wrap(err, "sender")
}
if _, err := sdk.AccAddressFromBech32(msg.Contract); err != nil {
- return sdkerrors.Wrap(err, "contract")
+ return errorsmod.Wrap(err, "contract")
}
if err := msg.Msg.ValidateBasic(); err != nil {
- return sdkerrors.Wrap(err, "payload msg")
+ return errorsmod.Wrap(err, "payload msg")
}
return nil
@@ -252,16 +258,16 @@ func (msg MsgUpdateAdmin) Type() string {
func (msg MsgUpdateAdmin) ValidateBasic() error {
if _, err := sdk.AccAddressFromBech32(msg.Sender); err != nil {
- return sdkerrors.Wrap(err, "sender")
+ return errorsmod.Wrap(err, "sender")
}
if _, err := sdk.AccAddressFromBech32(msg.Contract); err != nil {
- return sdkerrors.Wrap(err, "contract")
+ return errorsmod.Wrap(err, "contract")
}
if _, err := sdk.AccAddressFromBech32(msg.NewAdmin); err != nil {
- return sdkerrors.Wrap(err, "new admin")
+ return errorsmod.Wrap(err, "new admin")
}
if strings.EqualFold(msg.Sender, msg.NewAdmin) {
- return sdkerrors.Wrap(ErrInvalidMsg, "new admin is the same as the old")
+ return errorsmod.Wrap(ErrInvalidMsg, "new admin is the same as the old")
}
return nil
}
@@ -288,10 +294,10 @@ func (msg MsgClearAdmin) Type() string {
func (msg MsgClearAdmin) ValidateBasic() error {
if _, err := sdk.AccAddressFromBech32(msg.Sender); err != nil {
- return sdkerrors.Wrap(err, "sender")
+ return errorsmod.Wrap(err, "sender")
}
if _, err := sdk.AccAddressFromBech32(msg.Contract); err != nil {
- return sdkerrors.Wrap(err, "contract")
+ return errorsmod.Wrap(err, "contract")
}
return nil
}
@@ -360,15 +366,15 @@ func (msg MsgInstantiateContract2) Type() string {
func (msg MsgInstantiateContract2) ValidateBasic() error {
if _, err := sdk.AccAddressFromBech32(msg.Sender); err != nil {
- return sdkerrors.Wrap(err, "sender")
+ return errorsmod.Wrap(err, "sender")
}
if msg.CodeID == 0 {
- return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "code id is required")
+ return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "code id is required")
}
if err := ValidateLabel(msg.Label); err != nil {
- return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "label is required")
+ return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "label is required")
}
if !msg.Funds.IsValid() {
@@ -377,14 +383,14 @@ func (msg MsgInstantiateContract2) ValidateBasic() error {
if len(msg.Admin) != 0 {
if _, err := sdk.AccAddressFromBech32(msg.Admin); err != nil {
- return sdkerrors.Wrap(err, "admin")
+ return errorsmod.Wrap(err, "admin")
}
}
if err := msg.Msg.ValidateBasic(); err != nil {
- return sdkerrors.Wrap(err, "payload msg")
+ return errorsmod.Wrap(err, "payload msg")
}
if err := ValidateSalt(msg.Salt); err != nil {
- return sdkerrors.Wrap(err, "salt")
+ return errorsmod.Wrap(err, "salt")
}
return nil
}
@@ -411,19 +417,24 @@ func (msg MsgUpdateInstantiateConfig) Type() string {
func (msg MsgUpdateInstantiateConfig) ValidateBasic() error {
if _, err := sdk.AccAddressFromBech32(msg.Sender); err != nil {
- return sdkerrors.Wrap(err, "sender")
+ return errorsmod.Wrap(err, "sender")
}
if msg.CodeID == 0 {
- return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "code id is required")
+ return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "code id is required")
}
if msg.NewInstantiatePermission == nil {
- return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "instantiate permission is required")
+ return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "instantiate permission is required")
}
if err := msg.NewInstantiatePermission.ValidateBasic(); err != nil {
- return sdkerrors.Wrap(err, "instantiate permission")
+ return errorsmod.Wrap(err, "instantiate permission")
+ }
+ // AccessTypeOnlyAddress is still considered valid as legacy instantiation permission
+ // but not for new contracts
+ if msg.NewInstantiatePermission.Permission == AccessTypeOnlyAddress {
+ return ErrInvalid.Wrap("unsupported type, use AccessTypeAnyOfAddresses instead")
}
// AccessTypeOnlyAddress is still considered valid as legacy instantiation permission
// but not for new contracts
@@ -445,3 +456,27 @@ func (msg MsgUpdateInstantiateConfig) GetSigners() []sdk.AccAddress {
}
return []sdk.AccAddress{senderAddr}
}
+
+func (msg MsgUpdateParams) Route() string {
+ return RouterKey
+}
+
+func (msg MsgUpdateParams) Type() string {
+ return "update-params"
+}
+
+func (msg MsgUpdateParams) GetSigners() []sdk.AccAddress {
+ authority, err := sdk.AccAddressFromBech32(msg.Authority)
+ if err != nil { // should never happen as valid basic rejects invalid addresses
+ panic(err.Error())
+ }
+ return []sdk.AccAddress{authority}
+}
+
+func (msg MsgUpdateParams) GetSignBytes() []byte {
+ return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg))
+}
+
+func (msg MsgUpdateParams) ValidateBasic() error {
+ return msg.Params.ValidateBasic()
+}
diff --git a/x/wasm/types/tx.pb.go b/x/wasm/types/tx.pb.go
index 5d4994afbd..a97615f13c 100644
--- a/x/wasm/types/tx.pb.go
+++ b/x/wasm/types/tx.pb.go
@@ -10,11 +10,13 @@ import (
math "math"
math_bits "math/bits"
+ _ "github.com/cosmos/cosmos-proto"
github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types"
types "github.com/cosmos/cosmos-sdk/types"
+ _ "github.com/cosmos/cosmos-sdk/types/msgservice"
_ "github.com/cosmos/gogoproto/gogoproto"
- grpc1 "github.com/gogo/protobuf/grpc"
- proto "github.com/gogo/protobuf/proto"
+ grpc1 "github.com/cosmos/gogoproto/grpc"
+ proto "github.com/cosmos/gogoproto/proto"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
@@ -789,6 +791,100 @@ func (m *MsgUpdateInstantiateConfigResponse) XXX_DiscardUnknown() {
var xxx_messageInfo_MsgUpdateInstantiateConfigResponse proto.InternalMessageInfo
+// MsgUpdateParams is the Msg/UpdateParams request type.
+//
+// Since: 0.40
+type MsgUpdateParams struct {
+ // authority is the address of the governance account.
+ Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"`
+ // params defines the x/wasm parameters to update.
+ //
+ // NOTE: All parameters must be supplied.
+ Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"`
+}
+
+func (m *MsgUpdateParams) Reset() { *m = MsgUpdateParams{} }
+func (m *MsgUpdateParams) String() string { return proto.CompactTextString(m) }
+func (*MsgUpdateParams) ProtoMessage() {}
+func (*MsgUpdateParams) Descriptor() ([]byte, []int) {
+ return fileDescriptor_4f74d82755520264, []int{16}
+}
+
+func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error {
+ return m.Unmarshal(b)
+}
+
+func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ if deterministic {
+ return xxx_messageInfo_MsgUpdateParams.Marshal(b, m, deterministic)
+ } else {
+ b = b[:cap(b)]
+ n, err := m.MarshalToSizedBuffer(b)
+ if err != nil {
+ return nil, err
+ }
+ return b[:n], nil
+ }
+}
+
+func (m *MsgUpdateParams) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_MsgUpdateParams.Merge(m, src)
+}
+
+func (m *MsgUpdateParams) XXX_Size() int {
+ return m.Size()
+}
+
+func (m *MsgUpdateParams) XXX_DiscardUnknown() {
+ xxx_messageInfo_MsgUpdateParams.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_MsgUpdateParams proto.InternalMessageInfo
+
+// MsgUpdateParamsResponse defines the response structure for executing a
+// MsgUpdateParams message.
+//
+// Since: 0.40
+type MsgUpdateParamsResponse struct{}
+
+func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse{} }
+func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) }
+func (*MsgUpdateParamsResponse) ProtoMessage() {}
+func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) {
+ return fileDescriptor_4f74d82755520264, []int{17}
+}
+
+func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error {
+ return m.Unmarshal(b)
+}
+
+func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ if deterministic {
+ return xxx_messageInfo_MsgUpdateParamsResponse.Marshal(b, m, deterministic)
+ } else {
+ b = b[:cap(b)]
+ n, err := m.MarshalToSizedBuffer(b)
+ if err != nil {
+ return nil, err
+ }
+ return b[:n], nil
+ }
+}
+
+func (m *MsgUpdateParamsResponse) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_MsgUpdateParamsResponse.Merge(m, src)
+}
+
+func (m *MsgUpdateParamsResponse) XXX_Size() int {
+ return m.Size()
+}
+
+func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() {
+ xxx_messageInfo_MsgUpdateParamsResponse.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo
+
func init() {
proto.RegisterType((*MsgStoreCode)(nil), "cosmwasm.wasm.v1.MsgStoreCode")
proto.RegisterType((*MsgStoreCodeResponse)(nil), "cosmwasm.wasm.v1.MsgStoreCodeResponse")
@@ -806,69 +902,80 @@ func init() {
proto.RegisterType((*MsgClearAdminResponse)(nil), "cosmwasm.wasm.v1.MsgClearAdminResponse")
proto.RegisterType((*MsgUpdateInstantiateConfig)(nil), "cosmwasm.wasm.v1.MsgUpdateInstantiateConfig")
proto.RegisterType((*MsgUpdateInstantiateConfigResponse)(nil), "cosmwasm.wasm.v1.MsgUpdateInstantiateConfigResponse")
+ proto.RegisterType((*MsgUpdateParams)(nil), "cosmwasm.wasm.v1.MsgUpdateParams")
+ proto.RegisterType((*MsgUpdateParamsResponse)(nil), "cosmwasm.wasm.v1.MsgUpdateParamsResponse")
}
func init() { proto.RegisterFile("cosmwasm/wasm/v1/tx.proto", fileDescriptor_4f74d82755520264) }
var fileDescriptor_4f74d82755520264 = []byte{
- // 908 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x56, 0x4f, 0x6f, 0xe3, 0x44,
- 0x14, 0x8f, 0x9b, 0x3f, 0x4d, 0x5f, 0xc3, 0x52, 0x99, 0x6c, 0xeb, 0x35, 0xc8, 0x89, 0xcc, 0x6a,
- 0x31, 0xd2, 0x62, 0x37, 0x01, 0x71, 0x6f, 0xb2, 0x1c, 0xba, 0x92, 0x01, 0xb9, 0x5a, 0x2a, 0x10,
- 0x52, 0x34, 0xb1, 0x27, 0x5e, 0x6b, 0x6b, 0x4f, 0xf0, 0x4c, 0x9b, 0xf4, 0xc0, 0x57, 0x40, 0xdc,
- 0xf8, 0x0e, 0x7c, 0x01, 0x2e, 0x5c, 0x10, 0x97, 0x1e, 0xf7, 0x82, 0xc4, 0xa9, 0x40, 0xfa, 0x2d,
- 0x38, 0x21, 0x8f, 0xff, 0xd4, 0x4d, 0xed, 0x34, 0x0b, 0xe2, 0xb4, 0x97, 0x64, 0xc6, 0xf3, 0x7b,
- 0xef, 0xf7, 0xde, 0x6f, 0xde, 0xf3, 0x33, 0x3c, 0xb0, 0x09, 0xf5, 0x67, 0x88, 0xfa, 0x06, 0xff,
- 0x39, 0xeb, 0x19, 0x6c, 0xae, 0x4f, 0x43, 0xc2, 0x88, 0xb8, 0x93, 0x1e, 0xe9, 0xfc, 0xe7, 0xac,
- 0x27, 0x2b, 0xd1, 0x13, 0x42, 0x8d, 0x31, 0xa2, 0xd8, 0x38, 0xeb, 0x8d, 0x31, 0x43, 0x3d, 0xc3,
- 0x26, 0x5e, 0x10, 0x5b, 0xc8, 0x6d, 0x97, 0xb8, 0x84, 0x2f, 0x8d, 0x68, 0x95, 0x3c, 0x7d, 0xe7,
- 0x36, 0xc5, 0xf9, 0x14, 0xd3, 0xf8, 0x54, 0xfd, 0x45, 0x80, 0x96, 0x49, 0xdd, 0x23, 0x46, 0x42,
- 0x3c, 0x24, 0x0e, 0x16, 0x77, 0xa1, 0x41, 0x71, 0xe0, 0xe0, 0x50, 0x12, 0xba, 0x82, 0xb6, 0x65,
- 0x25, 0x3b, 0xf1, 0x63, 0xb8, 0x17, 0xd9, 0x8f, 0xc6, 0xe7, 0x0c, 0x8f, 0x6c, 0xe2, 0x60, 0x69,
- 0xa3, 0x2b, 0x68, 0xad, 0xc1, 0xce, 0xe2, 0xb2, 0xd3, 0x3a, 0x3e, 0x38, 0x32, 0x07, 0xe7, 0x8c,
- 0x7b, 0xb0, 0x5a, 0x11, 0x2e, 0xdd, 0x89, 0xcf, 0x60, 0xd7, 0x0b, 0x28, 0x43, 0x01, 0xf3, 0x10,
- 0xc3, 0xa3, 0x29, 0x0e, 0x7d, 0x8f, 0x52, 0x8f, 0x04, 0x52, 0xbd, 0x2b, 0x68, 0xdb, 0x7d, 0x45,
- 0x5f, 0xce, 0x53, 0x3f, 0xb0, 0x6d, 0x4c, 0xe9, 0x90, 0x04, 0x13, 0xcf, 0xb5, 0xee, 0xe7, 0xac,
- 0x3f, 0xcf, 0x8c, 0x9f, 0xd6, 0x9a, 0xd5, 0x9d, 0xda, 0xd3, 0x5a, 0xb3, 0xb6, 0x53, 0x57, 0x8f,
- 0xa1, 0x9d, 0x4f, 0xc1, 0xc2, 0x74, 0x4a, 0x02, 0x8a, 0xc5, 0x77, 0x61, 0x33, 0x0a, 0x74, 0xe4,
- 0x39, 0x3c, 0x97, 0xda, 0x00, 0x16, 0x97, 0x9d, 0x46, 0x04, 0x39, 0x7c, 0x62, 0x35, 0xa2, 0xa3,
- 0x43, 0x47, 0x94, 0xa1, 0x69, 0x3f, 0xc7, 0xf6, 0x0b, 0x7a, 0xea, 0xc7, 0x19, 0x59, 0xd9, 0x5e,
- 0xfd, 0x6e, 0x03, 0x76, 0x4d, 0xea, 0x1e, 0x5e, 0x47, 0x30, 0x24, 0x01, 0x0b, 0x91, 0xcd, 0x4a,
- 0x65, 0x6a, 0x43, 0x1d, 0x39, 0xbe, 0x17, 0x70, 0x5f, 0x5b, 0x56, 0xbc, 0xc9, 0x47, 0x52, 0x2d,
- 0x8d, 0xa4, 0x0d, 0xf5, 0x13, 0x34, 0xc6, 0x27, 0x52, 0x2d, 0x36, 0xe5, 0x1b, 0x51, 0x83, 0xaa,
- 0x4f, 0x5d, 0x2e, 0x56, 0x6b, 0xb0, 0xfb, 0xf7, 0x65, 0x47, 0xb4, 0xd0, 0x2c, 0x0d, 0xc3, 0xc4,
- 0x94, 0x22, 0x17, 0x5b, 0x11, 0x44, 0x44, 0x50, 0x9f, 0x9c, 0x06, 0x0e, 0x95, 0x1a, 0xdd, 0xaa,
- 0xb6, 0xdd, 0x7f, 0xa0, 0xc7, 0xe5, 0xa2, 0x47, 0xe5, 0xa2, 0x27, 0xe5, 0xa2, 0x0f, 0x89, 0x17,
- 0x0c, 0xf6, 0x2f, 0x2e, 0x3b, 0x95, 0x1f, 0xff, 0xe8, 0x68, 0xae, 0xc7, 0x9e, 0x9f, 0x8e, 0x75,
- 0x9b, 0xf8, 0x46, 0x52, 0x5b, 0xf1, 0xdf, 0x07, 0xd4, 0x79, 0x91, 0x94, 0x49, 0x64, 0x40, 0xad,
- 0xd8, 0xb3, 0xfa, 0xf3, 0x06, 0xec, 0x15, 0x0b, 0xd2, 0x7f, 0x3d, 0x15, 0x11, 0x45, 0xa8, 0x51,
- 0x74, 0xc2, 0xa4, 0x4d, 0x5e, 0x3a, 0x7c, 0x2d, 0xee, 0xc1, 0xe6, 0xc4, 0x9b, 0x8f, 0xa2, 0x20,
- 0x9b, 0x5d, 0x41, 0x6b, 0x5a, 0x8d, 0x89, 0x37, 0x37, 0xa9, 0xab, 0x7e, 0x0a, 0x4a, 0xb1, 0x7a,
- 0x59, 0xc9, 0x4a, 0xb0, 0x89, 0x1c, 0x27, 0xc4, 0x94, 0x26, 0x2a, 0xa6, 0xdb, 0x88, 0xc8, 0x41,
- 0x0c, 0x25, 0x35, 0xca, 0xd7, 0xea, 0x67, 0xd0, 0x29, 0xb9, 0x8d, 0x7f, 0xe9, 0xf0, 0x37, 0x01,
- 0x44, 0x93, 0xba, 0x9f, 0xcc, 0xb1, 0x7d, 0xba, 0x46, 0xb1, 0x47, 0xbd, 0x93, 0x60, 0x92, 0xdb,
- 0xcd, 0xf6, 0xe9, 0x2d, 0x55, 0x5f, 0xe1, 0x96, 0xea, 0xff, 0x5b, 0xdd, 0xee, 0x83, 0x7c, 0x3b,
- 0xad, 0x4c, 0xa3, 0x54, 0x09, 0x21, 0xa7, 0xc4, 0x0f, 0xb1, 0x12, 0xa6, 0xe7, 0x86, 0xe8, 0x3f,
- 0x2a, 0xb1, 0x56, 0xa9, 0x27, 0x72, 0xd5, 0xee, 0x94, 0x2b, 0xc9, 0x65, 0x29, 0xb0, 0x95, 0xb9,
- 0x20, 0xb8, 0x67, 0x52, 0xf7, 0xd9, 0xd4, 0x41, 0x0c, 0x1f, 0xf0, 0xee, 0x2b, 0x4b, 0xe3, 0x6d,
- 0xd8, 0x0a, 0xf0, 0x6c, 0x94, 0xef, 0xd7, 0x66, 0x80, 0x67, 0xb1, 0x51, 0x3e, 0xc7, 0xea, 0xcd,
- 0x1c, 0x55, 0x89, 0xbf, 0x28, 0x73, 0x14, 0x69, 0x40, 0xea, 0x10, 0xde, 0x30, 0xa9, 0x3b, 0x3c,
- 0xc1, 0x28, 0x5c, 0xcd, 0xbd, 0xca, 0xfd, 0x1e, 0xdc, 0xbf, 0xe1, 0x24, 0xf3, 0xfe, 0x93, 0xc0,
- 0xd5, 0x88, 0x89, 0x6f, 0x36, 0xc2, 0xc4, 0x73, 0x4b, 0xb9, 0x72, 0x57, 0xb2, 0x51, 0x7a, 0x25,
- 0x5f, 0x83, 0x1c, 0x89, 0x51, 0x32, 0xbd, 0xaa, 0x6b, 0x4d, 0x2f, 0x29, 0xc0, 0xb3, 0xc3, 0xa2,
- 0x01, 0xa6, 0x3e, 0x04, 0xb5, 0x3c, 0xf0, 0x34, 0xbf, 0xfe, 0xaf, 0x0d, 0xa8, 0x9a, 0xd4, 0x15,
- 0x8f, 0x60, 0xeb, 0x7a, 0x44, 0x17, 0x90, 0xe6, 0xe7, 0x9f, 0xfc, 0x68, 0xf5, 0x79, 0x56, 0x2b,
- 0xdf, 0xc0, 0x5b, 0x45, 0xa3, 0x4d, 0x2b, 0x34, 0x2f, 0x40, 0xca, 0xfb, 0xeb, 0x22, 0x33, 0x4a,
- 0x06, 0xed, 0xc2, 0xe1, 0xf1, 0xfe, 0xba, 0x9e, 0xfa, 0x72, 0x6f, 0x6d, 0x68, 0xc6, 0x8a, 0xe1,
- 0xcd, 0xe5, 0x57, 0xda, 0xc3, 0x42, 0x2f, 0x4b, 0x28, 0xf9, 0xf1, 0x3a, 0xa8, 0x3c, 0xcd, 0xf2,
- 0xfb, 0xa2, 0x98, 0x66, 0x09, 0x55, 0x42, 0x53, 0xd6, 0xe2, 0x5f, 0xc2, 0x76, 0xbe, 0x97, 0xbb,
- 0x85, 0xc6, 0x39, 0x84, 0xac, 0xdd, 0x85, 0xc8, 0x5c, 0x7f, 0x01, 0x90, 0xeb, 0xd4, 0x4e, 0xa1,
- 0xdd, 0x35, 0x40, 0x7e, 0xef, 0x0e, 0x40, 0xe6, 0xf7, 0x5b, 0xd8, 0x2b, 0x6b, 0xd1, 0xc7, 0x2b,
- 0x82, 0xbb, 0x85, 0x96, 0x3f, 0x7a, 0x15, 0x74, 0x4a, 0x3f, 0x78, 0x72, 0xf1, 0x97, 0x52, 0xb9,
- 0x58, 0x28, 0xc2, 0xcb, 0x85, 0x22, 0xfc, 0xb9, 0x50, 0x84, 0xef, 0xaf, 0x94, 0xca, 0xcb, 0x2b,
- 0xa5, 0xf2, 0xfb, 0x95, 0x52, 0xf9, 0xea, 0x51, 0x6e, 0x9a, 0x0c, 0x09, 0xf5, 0x8f, 0xd3, 0x6f,
- 0x65, 0xc7, 0x98, 0xc7, 0xdf, 0xcc, 0x7c, 0xa2, 0x8c, 0x1b, 0xfc, 0x8b, 0xf9, 0xc3, 0x7f, 0x02,
- 0x00, 0x00, 0xff, 0xff, 0x2a, 0x98, 0x99, 0x8e, 0xb4, 0x0b, 0x00, 0x00,
+ // 1043 bytes of a gzipped FileDescriptorProto
+ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x57, 0xcf, 0x6f, 0xe3, 0x44,
+ 0x14, 0xae, 0x9b, 0x1f, 0x4d, 0x5e, 0x42, 0xb7, 0x32, 0xd9, 0xc6, 0x35, 0xc8, 0x09, 0x61, 0xb5,
+ 0x64, 0xd1, 0x6e, 0xd2, 0x04, 0xd4, 0xc3, 0xde, 0x9a, 0x2c, 0x87, 0xae, 0x64, 0xa8, 0x5c, 0x2d,
+ 0x15, 0x68, 0xa5, 0x68, 0x62, 0x4f, 0x5c, 0x6b, 0x6b, 0x3b, 0x78, 0x26, 0x4d, 0x7a, 0xe0, 0xc2,
+ 0x5f, 0x00, 0x67, 0x4e, 0x48, 0x9c, 0x38, 0x71, 0xe0, 0x4f, 0xe0, 0x50, 0x2e, 0x68, 0xc5, 0x89,
+ 0x53, 0x81, 0xf4, 0xc0, 0xff, 0xc0, 0x09, 0x79, 0xfc, 0x23, 0x4e, 0x6a, 0x27, 0x59, 0x90, 0xb8,
+ 0x70, 0x49, 0x3c, 0x99, 0xef, 0x7d, 0xef, 0x7b, 0xdf, 0xcc, 0x9b, 0x89, 0x61, 0x4f, 0xb5, 0x89,
+ 0x39, 0x46, 0xc4, 0x6c, 0xb2, 0x8f, 0x8b, 0x56, 0x93, 0x4e, 0x1a, 0x43, 0xc7, 0xa6, 0x36, 0xbf,
+ 0x13, 0x4c, 0x35, 0xd8, 0xc7, 0x45, 0x4b, 0x94, 0xdc, 0x5f, 0x6c, 0xd2, 0xec, 0x23, 0x82, 0x9b,
+ 0x17, 0xad, 0x3e, 0xa6, 0xa8, 0xd5, 0x54, 0x6d, 0xc3, 0xf2, 0x22, 0xc4, 0xb2, 0x3f, 0x6f, 0x12,
+ 0xdd, 0x65, 0x32, 0x89, 0xee, 0x4f, 0x94, 0x74, 0x5b, 0xb7, 0xd9, 0x63, 0xd3, 0x7d, 0xf2, 0x7f,
+ 0x7d, 0xf3, 0x76, 0xee, 0xcb, 0x21, 0x26, 0xfe, 0xec, 0x9e, 0x47, 0xd6, 0xf3, 0xc2, 0xbc, 0x81,
+ 0x37, 0x55, 0xfb, 0x99, 0x83, 0xa2, 0x4c, 0xf4, 0x13, 0x6a, 0x3b, 0xb8, 0x6b, 0x6b, 0x98, 0xdf,
+ 0x85, 0x2c, 0xc1, 0x96, 0x86, 0x1d, 0x81, 0xab, 0x72, 0xf5, 0xbc, 0xe2, 0x8f, 0xf8, 0x03, 0xd8,
+ 0x76, 0xa9, 0x7b, 0xfd, 0x4b, 0x8a, 0x7b, 0xaa, 0xad, 0x61, 0x61, 0xb3, 0xca, 0xd5, 0x8b, 0x9d,
+ 0x9d, 0xe9, 0x75, 0xa5, 0x78, 0x7a, 0x78, 0x22, 0x77, 0x2e, 0x29, 0x63, 0x50, 0x8a, 0x2e, 0x2e,
+ 0x18, 0xf1, 0xcf, 0x60, 0xd7, 0xb0, 0x08, 0x45, 0x16, 0x35, 0x10, 0xc5, 0xbd, 0x21, 0x76, 0x4c,
+ 0x83, 0x10, 0xc3, 0xb6, 0x84, 0x4c, 0x95, 0xab, 0x17, 0xda, 0x52, 0x63, 0xd1, 0x9b, 0xc6, 0xa1,
+ 0xaa, 0x62, 0x42, 0xba, 0xb6, 0x35, 0x30, 0x74, 0xe5, 0x6e, 0x24, 0xfa, 0x38, 0x0c, 0x7e, 0x5c,
+ 0xf8, 0xe2, 0xcf, 0xef, 0xdf, 0xf5, 0xb5, 0x3d, 0x4d, 0xe7, 0x52, 0x3b, 0xe9, 0xa7, 0xe9, 0x5c,
+ 0x7a, 0x27, 0x53, 0x3b, 0x85, 0x52, 0xb4, 0x1e, 0x05, 0x93, 0xa1, 0x6d, 0x11, 0xcc, 0xbf, 0x0d,
+ 0x5b, 0xae, 0xea, 0x9e, 0xa1, 0xb1, 0xc2, 0xd2, 0x1d, 0x98, 0x5e, 0x57, 0xb2, 0x2e, 0xe4, 0xe8,
+ 0x89, 0x92, 0x75, 0xa7, 0x8e, 0x34, 0x5e, 0x84, 0x9c, 0x7a, 0x86, 0xd5, 0x17, 0x64, 0x64, 0x7a,
+ 0xe5, 0x29, 0xe1, 0xb8, 0xf6, 0xf5, 0x26, 0xec, 0xca, 0x44, 0x3f, 0x9a, 0xc9, 0xe9, 0xda, 0x16,
+ 0x75, 0x90, 0x4a, 0x13, 0x3d, 0x2b, 0x41, 0x06, 0x69, 0xa6, 0x61, 0x31, 0xae, 0xbc, 0xe2, 0x0d,
+ 0xa2, 0x4a, 0x52, 0x89, 0x4a, 0x4a, 0x90, 0x39, 0x47, 0x7d, 0x7c, 0x2e, 0xa4, 0xbd, 0x50, 0x36,
+ 0xe0, 0xeb, 0x90, 0x32, 0x89, 0xce, 0x9c, 0x2b, 0x76, 0x76, 0xff, 0xba, 0xae, 0xf0, 0x0a, 0x1a,
+ 0x07, 0x32, 0x64, 0x4c, 0x08, 0xd2, 0xb1, 0xe2, 0x42, 0x78, 0x04, 0x99, 0xc1, 0xc8, 0xd2, 0x88,
+ 0x90, 0xad, 0xa6, 0xea, 0x85, 0xf6, 0x5e, 0xc3, 0x5f, 0x75, 0x77, 0xbf, 0x35, 0xfc, 0xfd, 0xd6,
+ 0xe8, 0xda, 0x86, 0xd5, 0xd9, 0xbf, 0xba, 0xae, 0x6c, 0x7c, 0xf7, 0x5b, 0xa5, 0xae, 0x1b, 0xf4,
+ 0x6c, 0xd4, 0x6f, 0xa8, 0xb6, 0xe9, 0x6f, 0x11, 0xff, 0xeb, 0x11, 0xd1, 0x5e, 0xf8, 0xdb, 0xc9,
+ 0x0d, 0x20, 0x8a, 0xc7, 0x3c, 0xb7, 0x04, 0xb5, 0x9f, 0x36, 0xa1, 0x1c, 0xef, 0x4e, 0xfb, 0xff,
+ 0x69, 0x0f, 0xcf, 0x43, 0x9a, 0xa0, 0x73, 0x2a, 0x6c, 0xb1, 0x7d, 0xc4, 0x9e, 0xf9, 0x32, 0x6c,
+ 0x0d, 0x8c, 0x49, 0xcf, 0x15, 0x99, 0xab, 0x72, 0xf5, 0x9c, 0x92, 0x1d, 0x18, 0x13, 0x99, 0xe8,
+ 0xf3, 0x5e, 0x7e, 0x08, 0x52, 0xbc, 0x95, 0xe1, 0x66, 0x16, 0x60, 0x0b, 0x69, 0x9a, 0x83, 0x09,
+ 0xf1, 0x2d, 0x0d, 0x86, 0x6e, 0x56, 0x0d, 0x51, 0xe4, 0xef, 0x5e, 0xf6, 0x5c, 0xfb, 0x08, 0x2a,
+ 0x09, 0x4b, 0xf3, 0x0f, 0x09, 0xa7, 0x1c, 0xf0, 0x32, 0xd1, 0x3f, 0x98, 0x60, 0x75, 0xb4, 0x46,
+ 0x1b, 0xb8, 0x5d, 0xe5, 0x63, 0xfc, 0xa5, 0x0e, 0xc7, 0xc1, 0x92, 0xa5, 0x5e, 0x61, 0xc9, 0x32,
+ 0xff, 0xcd, 0x8e, 0xde, 0x07, 0xf1, 0x76, 0x8d, 0xa1, 0x61, 0x81, 0x2d, 0x5c, 0xc4, 0x96, 0x6f,
+ 0x3d, 0x5b, 0x64, 0x43, 0x77, 0xd0, 0xbf, 0xb4, 0x65, 0xad, 0x26, 0xf0, 0xbd, 0x4b, 0xaf, 0xf4,
+ 0x2e, 0xae, 0xb0, 0x05, 0x95, 0x4b, 0x0b, 0xb3, 0x60, 0x5b, 0x26, 0xfa, 0xb3, 0xa1, 0x86, 0x28,
+ 0x3e, 0x64, 0x4d, 0x9a, 0x54, 0xd3, 0x1b, 0x90, 0xb7, 0xf0, 0xb8, 0x17, 0x6d, 0xeb, 0x9c, 0x85,
+ 0xc7, 0x5e, 0x50, 0xb4, 0xe0, 0xd4, 0x7c, 0xc1, 0xf3, 0x0a, 0x05, 0x76, 0xd2, 0x46, 0xf2, 0x05,
+ 0xea, 0x6a, 0xc7, 0xf0, 0x9a, 0x4c, 0xf4, 0xee, 0x39, 0x46, 0xce, 0x72, 0x21, 0x6b, 0xe7, 0x2a,
+ 0xc3, 0xdd, 0x39, 0xc6, 0x30, 0xd5, 0x8f, 0x1c, 0xf3, 0xc9, 0x53, 0x31, 0xdf, 0x3c, 0x03, 0x43,
+ 0x4f, 0x4c, 0x1c, 0x59, 0xb9, 0xcd, 0xc4, 0x95, 0x7b, 0x0e, 0xa2, 0x6b, 0x53, 0xc2, 0xc5, 0x98,
+ 0x5a, 0xeb, 0x62, 0x14, 0x2c, 0x3c, 0x3e, 0x5a, 0x79, 0x37, 0xd6, 0xee, 0x41, 0x2d, 0xb9, 0x8a,
+ 0xb0, 0xd8, 0xaf, 0x38, 0xb8, 0x13, 0xc2, 0x8e, 0x91, 0x83, 0x4c, 0xc2, 0x1f, 0x40, 0x1e, 0x8d,
+ 0xe8, 0x99, 0xed, 0x18, 0xf4, 0xd2, 0x2b, 0xb2, 0x23, 0xfc, 0xf2, 0xc3, 0xa3, 0x92, 0xdf, 0x77,
+ 0x87, 0xde, 0x01, 0x71, 0x42, 0x1d, 0xc3, 0xd2, 0x95, 0x19, 0x94, 0x3f, 0x80, 0xec, 0x90, 0x31,
+ 0x30, 0x03, 0x0a, 0x6d, 0xe1, 0x76, 0x21, 0x5e, 0x86, 0x4e, 0xda, 0x6d, 0x54, 0xc5, 0x47, 0x3f,
+ 0xde, 0x76, 0x65, 0xcf, 0x78, 0x6a, 0x7b, 0xec, 0x46, 0x89, 0x4a, 0x0a, 0xe4, 0xb6, 0xbf, 0xd9,
+ 0x82, 0x94, 0x4c, 0x74, 0xfe, 0x04, 0xf2, 0xb3, 0x7f, 0x2e, 0x31, 0x86, 0x45, 0xff, 0x09, 0x88,
+ 0xf7, 0x97, 0xcf, 0x87, 0x1d, 0xf0, 0x19, 0xbc, 0x1e, 0x77, 0xc9, 0xd7, 0x63, 0xc3, 0x63, 0x90,
+ 0xe2, 0xfe, 0xba, 0xc8, 0x30, 0x25, 0x85, 0x52, 0xec, 0xcd, 0xf9, 0x60, 0x5d, 0xa6, 0xb6, 0xd8,
+ 0x5a, 0x1b, 0x1a, 0x66, 0xc5, 0x70, 0x67, 0xf1, 0x08, 0xbf, 0x17, 0xcb, 0xb2, 0x80, 0x12, 0x1f,
+ 0xae, 0x83, 0x8a, 0xa6, 0x59, 0x3c, 0x12, 0xe3, 0xd3, 0x2c, 0xa0, 0x12, 0xd2, 0x24, 0x1d, 0x5c,
+ 0x9f, 0x40, 0x21, 0x7a, 0x42, 0x55, 0x63, 0x83, 0x23, 0x08, 0xb1, 0xbe, 0x0a, 0x11, 0x52, 0x7f,
+ 0x0c, 0x10, 0x39, 0x72, 0x2a, 0xb1, 0x71, 0x33, 0x80, 0xf8, 0xce, 0x0a, 0x40, 0xc8, 0xfb, 0x39,
+ 0x94, 0x93, 0x8e, 0x97, 0x87, 0x4b, 0xc4, 0xdd, 0x42, 0x8b, 0xef, 0xbf, 0x0a, 0x3a, 0x4c, 0xff,
+ 0x1c, 0x8a, 0x73, 0x0d, 0xff, 0xd6, 0x12, 0x16, 0x0f, 0x22, 0x3e, 0x58, 0x09, 0x09, 0xd8, 0x3b,
+ 0x4f, 0xae, 0xfe, 0x90, 0x36, 0xae, 0xa6, 0x12, 0xf7, 0x72, 0x2a, 0x71, 0xbf, 0x4f, 0x25, 0xee,
+ 0xcb, 0x1b, 0x69, 0xe3, 0xe5, 0x8d, 0xb4, 0xf1, 0xeb, 0x8d, 0xb4, 0xf1, 0xe9, 0xfd, 0xc8, 0xdd,
+ 0xdc, 0xb5, 0x89, 0x79, 0x1a, 0xbc, 0xbb, 0x68, 0xcd, 0x89, 0xf7, 0x0e, 0xc3, 0xee, 0xe7, 0x7e,
+ 0x96, 0xbd, 0xa6, 0xbc, 0xf7, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0xd3, 0x7b, 0x0a, 0x47, 0x5d,
+ 0x0d, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
@@ -903,6 +1010,11 @@ type MsgClient interface {
ClearAdmin(ctx context.Context, in *MsgClearAdmin, opts ...grpc.CallOption) (*MsgClearAdminResponse, error)
// UpdateInstantiateConfig updates instantiate config for a smart contract
UpdateInstantiateConfig(ctx context.Context, in *MsgUpdateInstantiateConfig, opts ...grpc.CallOption) (*MsgUpdateInstantiateConfigResponse, error)
+ // UpdateParams defines a governance operation for updating the x/wasm
+ // module parameters. The authority is defined in the keeper.
+ //
+ // Since: 0.40
+ UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error)
}
type msgClient struct {
@@ -985,6 +1097,15 @@ func (c *msgClient) UpdateInstantiateConfig(ctx context.Context, in *MsgUpdateIn
return out, nil
}
+func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) {
+ out := new(MsgUpdateParamsResponse)
+ err := c.cc.Invoke(ctx, "/cosmwasm.wasm.v1.Msg/UpdateParams", in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
// MsgServer is the server API for Msg service.
type MsgServer interface {
// StoreCode to submit Wasm code to the system
@@ -1005,6 +1126,11 @@ type MsgServer interface {
ClearAdmin(context.Context, *MsgClearAdmin) (*MsgClearAdminResponse, error)
// UpdateInstantiateConfig updates instantiate config for a smart contract
UpdateInstantiateConfig(context.Context, *MsgUpdateInstantiateConfig) (*MsgUpdateInstantiateConfigResponse, error)
+ // UpdateParams defines a governance operation for updating the x/wasm
+ // module parameters. The authority is defined in the keeper.
+ //
+ // Since: 0.40
+ UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error)
}
// UnimplementedMsgServer can be embedded to have forward compatible implementations.
@@ -1042,6 +1168,10 @@ func (*UnimplementedMsgServer) UpdateInstantiateConfig(ctx context.Context, req
return nil, status.Errorf(codes.Unimplemented, "method UpdateInstantiateConfig not implemented")
}
+func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented")
+}
+
func RegisterMsgServer(s grpc1.Server, srv MsgServer) {
s.RegisterService(&_Msg_serviceDesc, srv)
}
@@ -1190,6 +1320,24 @@ func _Msg_UpdateInstantiateConfig_Handler(srv interface{}, ctx context.Context,
return interceptor(ctx, in, info, handler)
}
+func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(MsgUpdateParams)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(MsgServer).UpdateParams(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: "/cosmwasm.wasm.v1.Msg/UpdateParams",
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
var _Msg_serviceDesc = grpc.ServiceDesc{
ServiceName: "cosmwasm.wasm.v1.Msg",
HandlerType: (*MsgServer)(nil),
@@ -1226,6 +1374,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{
MethodName: "UpdateInstantiateConfig",
Handler: _Msg_UpdateInstantiateConfig_Handler,
},
+ {
+ MethodName: "UpdateParams",
+ Handler: _Msg_UpdateParams_Handler,
+ },
},
Streams: []grpc.StreamDesc{},
Metadata: "cosmwasm/wasm/v1/tx.proto",
@@ -1910,6 +2062,69 @@ func (m *MsgUpdateInstantiateConfigResponse) MarshalToSizedBuffer(dAtA []byte) (
return len(dAtA) - i, nil
}
+func (m *MsgUpdateParams) Marshal() (dAtA []byte, err error) {
+ size := m.Size()
+ dAtA = make([]byte, size)
+ n, err := m.MarshalToSizedBuffer(dAtA[:size])
+ if err != nil {
+ return nil, err
+ }
+ return dAtA[:n], nil
+}
+
+func (m *MsgUpdateParams) MarshalTo(dAtA []byte) (int, error) {
+ size := m.Size()
+ return m.MarshalToSizedBuffer(dAtA[:size])
+}
+
+func (m *MsgUpdateParams) MarshalToSizedBuffer(dAtA []byte) (int, error) {
+ i := len(dAtA)
+ _ = i
+ var l int
+ _ = l
+ {
+ size, err := m.Params.MarshalToSizedBuffer(dAtA[:i])
+ if err != nil {
+ return 0, err
+ }
+ i -= size
+ i = encodeVarintTx(dAtA, i, uint64(size))
+ }
+ i--
+ dAtA[i] = 0x12
+ if len(m.Authority) > 0 {
+ i -= len(m.Authority)
+ copy(dAtA[i:], m.Authority)
+ i = encodeVarintTx(dAtA, i, uint64(len(m.Authority)))
+ i--
+ dAtA[i] = 0xa
+ }
+ return len(dAtA) - i, nil
+}
+
+func (m *MsgUpdateParamsResponse) Marshal() (dAtA []byte, err error) {
+ size := m.Size()
+ dAtA = make([]byte, size)
+ n, err := m.MarshalToSizedBuffer(dAtA[:size])
+ if err != nil {
+ return nil, err
+ }
+ return dAtA[:n], nil
+}
+
+func (m *MsgUpdateParamsResponse) MarshalTo(dAtA []byte) (int, error) {
+ size := m.Size()
+ return m.MarshalToSizedBuffer(dAtA[:size])
+}
+
+func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
+ i := len(dAtA)
+ _ = i
+ var l int
+ _ = l
+ return len(dAtA) - i, nil
+}
+
func encodeVarintTx(dAtA []byte, offset int, v uint64) int {
offset -= sovTx(v)
base := offset
@@ -2230,6 +2445,30 @@ func (m *MsgUpdateInstantiateConfigResponse) Size() (n int) {
return n
}
+func (m *MsgUpdateParams) Size() (n int) {
+ if m == nil {
+ return 0
+ }
+ var l int
+ _ = l
+ l = len(m.Authority)
+ if l > 0 {
+ n += 1 + l + sovTx(uint64(l))
+ }
+ l = m.Params.Size()
+ n += 1 + l + sovTx(uint64(l))
+ return n
+}
+
+func (m *MsgUpdateParamsResponse) Size() (n int) {
+ if m == nil {
+ return 0
+ }
+ var l int
+ _ = l
+ return n
+}
+
func sovTx(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
@@ -4325,6 +4564,173 @@ func (m *MsgUpdateInstantiateConfigResponse) Unmarshal(dAtA []byte) error {
return nil
}
+func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error {
+ l := len(dAtA)
+ iNdEx := 0
+ for iNdEx < l {
+ preIndex := iNdEx
+ var wire uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowTx
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ wire |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ fieldNum := int32(wire >> 3)
+ wireType := int(wire & 0x7)
+ if wireType == 4 {
+ return fmt.Errorf("proto: MsgUpdateParams: wiretype end group for non-group")
+ }
+ if fieldNum <= 0 {
+ return fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire)
+ }
+ switch fieldNum {
+ case 1:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType)
+ }
+ var stringLen uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowTx
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ stringLen |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ intStringLen := int(stringLen)
+ if intStringLen < 0 {
+ return ErrInvalidLengthTx
+ }
+ postIndex := iNdEx + intStringLen
+ if postIndex < 0 {
+ return ErrInvalidLengthTx
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ m.Authority = string(dAtA[iNdEx:postIndex])
+ iNdEx = postIndex
+ case 2:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType)
+ }
+ var msglen int
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowTx
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ msglen |= int(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ if msglen < 0 {
+ return ErrInvalidLengthTx
+ }
+ postIndex := iNdEx + msglen
+ if postIndex < 0 {
+ return ErrInvalidLengthTx
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
+ return err
+ }
+ iNdEx = postIndex
+ default:
+ iNdEx = preIndex
+ skippy, err := skipTx(dAtA[iNdEx:])
+ if err != nil {
+ return err
+ }
+ if (skippy < 0) || (iNdEx+skippy) < 0 {
+ return ErrInvalidLengthTx
+ }
+ if (iNdEx + skippy) > l {
+ return io.ErrUnexpectedEOF
+ }
+ iNdEx += skippy
+ }
+ }
+
+ if iNdEx > l {
+ return io.ErrUnexpectedEOF
+ }
+ return nil
+}
+
+func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error {
+ l := len(dAtA)
+ iNdEx := 0
+ for iNdEx < l {
+ preIndex := iNdEx
+ var wire uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowTx
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ wire |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ fieldNum := int32(wire >> 3)
+ wireType := int(wire & 0x7)
+ if wireType == 4 {
+ return fmt.Errorf("proto: MsgUpdateParamsResponse: wiretype end group for non-group")
+ }
+ if fieldNum <= 0 {
+ return fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire)
+ }
+ switch fieldNum {
+ default:
+ iNdEx = preIndex
+ skippy, err := skipTx(dAtA[iNdEx:])
+ if err != nil {
+ return err
+ }
+ if (skippy < 0) || (iNdEx+skippy) < 0 {
+ return ErrInvalidLengthTx
+ }
+ if (iNdEx + skippy) > l {
+ return io.ErrUnexpectedEOF
+ }
+ iNdEx += skippy
+ }
+ }
+
+ if iNdEx > l {
+ return io.ErrUnexpectedEOF
+ }
+ return nil
+}
+
func skipTx(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
diff --git a/x/wasm/types/tx_test.go b/x/wasm/types/tx_test.go
index 57e36a4675..628f259503 100644
--- a/x/wasm/types/tx_test.go
+++ b/x/wasm/types/tx_test.go
@@ -5,9 +5,8 @@ import (
"strings"
"testing"
- "github.com/cosmos/cosmos-sdk/x/auth/legacy/legacytx"
-
sdk "github.com/cosmos/cosmos-sdk/types"
+ "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
@@ -15,7 +14,7 @@ import (
const firstCodeID = 1
func TestStoreCodeValidation(t *testing.T) {
- bad, err := sdk.AccAddressFromHex("012345")
+ bad, err := sdk.AccAddressFromHexUnsafe("012345")
require.NoError(t, err)
badAddress := bad.String()
// proper address size
@@ -79,7 +78,7 @@ func TestStoreCodeValidation(t *testing.T) {
}
func TestInstantiateContractValidation(t *testing.T) {
- bad, err := sdk.AccAddressFromHex("012345")
+ bad, err := sdk.AccAddressFromHexUnsafe("012345")
require.NoError(t, err)
badAddress := bad.String()
// proper address size
@@ -187,7 +186,7 @@ func TestInstantiateContractValidation(t *testing.T) {
}
func TestInstantiateContract2Validation(t *testing.T) {
- bad, err := sdk.AccAddressFromHex("012345")
+ bad, err := sdk.AccAddressFromHexUnsafe("012345")
require.NoError(t, err)
badAddress := bad.String()
// proper address size
@@ -323,7 +322,7 @@ func TestInstantiateContract2Validation(t *testing.T) {
}
func TestExecuteContractValidation(t *testing.T) {
- bad, err := sdk.AccAddressFromHex("012345")
+ bad, err := sdk.AccAddressFromHexUnsafe("012345")
require.NoError(t, err)
badAddress := bad.String()
// proper address size
@@ -432,7 +431,7 @@ func TestExecuteContractValidation(t *testing.T) {
}
func TestMsgUpdateAdministrator(t *testing.T) {
- bad, err := sdk.AccAddressFromHex("012345")
+ bad, err := sdk.AccAddressFromHexUnsafe("012345")
require.NoError(t, err)
badAddress := bad.String()
// proper address size
@@ -504,7 +503,7 @@ func TestMsgUpdateAdministrator(t *testing.T) {
}
func TestMsgClearAdministrator(t *testing.T) {
- bad, err := sdk.AccAddressFromHex("012345")
+ bad, err := sdk.AccAddressFromHexUnsafe("012345")
require.NoError(t, err)
badAddress := bad.String()
// proper address size
@@ -555,7 +554,7 @@ func TestMsgClearAdministrator(t *testing.T) {
}
func TestMsgMigrateContract(t *testing.T) {
- bad, err := sdk.AccAddressFromHex("012345")
+ bad, err := sdk.AccAddressFromHexUnsafe("012345")
require.NoError(t, err)
badAddress := bad.String()
// proper address size
@@ -681,7 +680,7 @@ func TestMsgJsonSignBytes(t *testing.T) {
}
func TestMsgUpdateInstantiateConfig(t *testing.T) {
- bad, err := sdk.AccAddressFromHex("012345")
+ bad, err := sdk.AccAddressFromHexUnsafe("012345")
require.NoError(t, err)
badAddress := bad.String()
// proper address size
diff --git a/x/wasm/types/types.go b/x/wasm/types/types.go
index e6afae96f6..ffec3049da 100644
--- a/x/wasm/types/types.go
+++ b/x/wasm/types/types.go
@@ -4,11 +4,12 @@ import (
"fmt"
"reflect"
+ errorsmod "cosmossdk.io/errors"
wasmvmtypes "github.com/CosmWasm/wasmvm/types"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
- "github.com/gogo/protobuf/proto"
+ "github.com/cosmos/gogoproto/proto"
)
const (
@@ -24,20 +25,20 @@ const (
func (m Model) ValidateBasic() error {
if len(m.Key) == 0 {
- return sdkerrors.Wrap(ErrEmpty, "key")
+ return errorsmod.Wrap(ErrEmpty, "key")
}
return nil
}
func (c CodeInfo) ValidateBasic() error {
if len(c.CodeHash) == 0 {
- return sdkerrors.Wrap(ErrEmpty, "code hash")
+ return errorsmod.Wrap(ErrEmpty, "code hash")
}
if _, err := sdk.AccAddressFromBech32(c.Creator); err != nil {
- return sdkerrors.Wrap(err, "creator")
+ return errorsmod.Wrap(err, "creator")
}
if err := c.InstantiateConfig.ValidateBasic(); err != nil {
- return sdkerrors.Wrap(err, "instantiate config")
+ return errorsmod.Wrap(err, "instantiate config")
}
return nil
}
@@ -78,18 +79,18 @@ type validatable interface {
// but also in the genesis import process.
func (c *ContractInfo) ValidateBasic() error {
if c.CodeID == 0 {
- return sdkerrors.Wrap(ErrEmpty, "code id")
+ return errorsmod.Wrap(ErrEmpty, "code id")
}
if _, err := sdk.AccAddressFromBech32(c.Creator); err != nil {
- return sdkerrors.Wrap(err, "creator")
+ return errorsmod.Wrap(err, "creator")
}
if len(c.Admin) != 0 {
if _, err := sdk.AccAddressFromBech32(c.Admin); err != nil {
- return sdkerrors.Wrap(err, "admin")
+ return errorsmod.Wrap(err, "admin")
}
}
if err := ValidateLabel(c.Label); err != nil {
- return sdkerrors.Wrap(err, "label")
+ return errorsmod.Wrap(err, "label")
}
if c.Extension == nil {
return nil
@@ -100,7 +101,7 @@ func (c *ContractInfo) ValidateBasic() error {
return nil
}
if err := e.ValidateBasic(); err != nil {
- return sdkerrors.Wrap(err, "extension")
+ return errorsmod.Wrap(err, "extension")
}
return nil
}
@@ -117,12 +118,12 @@ func (c *ContractInfo) SetExtension(ext ContractInfoExtension) error {
return err
}
}
- any, err := codectypes.NewAnyWithValue(ext)
+ codecAny, err := codectypes.NewAnyWithValue(ext)
if err != nil {
- return sdkerrors.Wrap(sdkerrors.ErrPackAny, err.Error())
+ return errorsmod.Wrap(sdkerrors.ErrPackAny, err.Error())
}
- c.Extension = any
+ c.Extension = codecAny
return nil
}
@@ -131,12 +132,12 @@ func (c *ContractInfo) SetExtension(ext ContractInfoExtension) error {
//
// var d MyContractDetails
// if err := info.ReadExtension(&d); err != nil {
-// return nil, sdkerrors.Wrap(err, "extension")
+// return nil, errorsmod.Wrap(err, "extension")
// }
func (c *ContractInfo) ReadExtension(e ContractInfoExtension) error {
rv := reflect.ValueOf(e)
if rv.Kind() != reflect.Ptr || rv.IsNil() {
- return sdkerrors.Wrap(sdkerrors.ErrInvalidType, "not a pointer")
+ return errorsmod.Wrap(sdkerrors.ErrInvalidType, "not a pointer")
}
if c.Extension == nil {
return nil
@@ -145,7 +146,7 @@ func (c *ContractInfo) ReadExtension(e ContractInfoExtension) error {
cached := c.Extension.GetCachedValue()
elem := reflect.ValueOf(cached).Elem()
if !elem.Type().AssignableTo(rv.Elem().Type()) {
- return sdkerrors.Wrapf(sdkerrors.ErrInvalidType, "extension is of type %s but argument of %s", elem.Type(), rv.Elem().Type())
+ return errorsmod.Wrapf(sdkerrors.ErrInvalidType, "extension is of type %s but argument of %s", elem.Type(), rv.Elem().Type())
}
rv.Elem().Set(elem)
return nil
@@ -261,7 +262,7 @@ func (c ContractCodeHistoryEntry) ValidateBasic() error {
if c.Updated == nil {
return ErrEmpty.Wrap("updated")
}
- return sdkerrors.Wrap(c.Msg.ValidateBasic(), "msg")
+ return errorsmod.Wrap(c.Msg.ValidateBasic(), "msg")
}
// NewEnv initializes the environment for a contract instance
@@ -315,11 +316,11 @@ func NewWasmCoins(cosmosCoins sdk.Coins) (wasmCoins []wasmvmtypes.Coin) {
type WasmConfig struct {
// SimulationGasLimit is the max gas to be used in a tx simulation call.
// When not set the consensus max block gas is used instead
- SimulationGasLimit *uint64
- // SimulationGasLimit is the max gas to be used in a smart query contract call
- SmartQueryGasLimit uint64
+ SimulationGasLimit *uint64 `mapstructure:"simulation_gas_limit"`
+ // SmartQueryGasLimit is the max gas to be used in a smart query contract call
+ SmartQueryGasLimit uint64 `mapstructure:"query_gas_limit"`
// MemoryCacheSize in MiB not bytes
- MemoryCacheSize uint32
+ MemoryCacheSize uint32 `mapstructure:"memory_cache_size"`
// ContractDebugMode log what contract print
ContractDebugMode bool
}
@@ -333,6 +334,33 @@ func DefaultWasmConfig() WasmConfig {
}
}
+// DefaultConfigTemplate toml snippet with default values for app.toml
+func DefaultConfigTemplate() string {
+ return ConfigTemplate(DefaultWasmConfig())
+}
+
+// ConfigTemplate toml snippet for app.toml
+func ConfigTemplate(c WasmConfig) string {
+ simGasLimit := `# simulation_gas_limit =`
+ if c.SimulationGasLimit != nil {
+ simGasLimit = fmt.Sprintf(`simulation_gas_limit = %d`, *c.SimulationGasLimit)
+ }
+
+ return fmt.Sprintf(`
+[wasm]
+# Smart query gas limit is the max gas to be used in a smart query contract call
+query_gas_limit = %d
+
+# in-memory cache for Wasm contracts. Set to 0 to disable.
+# The value is in MiB not bytes
+memory_cache_size = %d
+
+# Simulation gas limit is the max gas to be used in a tx simulation call.
+# When not set the consensus max block gas is used instead
+%s
+`, c.SmartQueryGasLimit, c.MemoryCacheSize, simGasLimit)
+}
+
// VerifyAddressLen ensures that the address matches the expected length
func VerifyAddressLen() func(addr []byte) error {
return func(addr []byte) error {
diff --git a/x/wasm/types/types.pb.go b/x/wasm/types/types.pb.go
index 89351f716f..b1f884962c 100644
--- a/x/wasm/types/types.pb.go
+++ b/x/wasm/types/types.pb.go
@@ -10,11 +10,11 @@ import (
math "math"
math_bits "math/bits"
+ github_com_cometbft_cometbft_libs_bytes "github.com/cometbft/cometbft/libs/bytes"
_ "github.com/cosmos/cosmos-proto"
types "github.com/cosmos/cosmos-sdk/codec/types"
_ "github.com/cosmos/gogoproto/gogoproto"
- proto "github.com/gogo/protobuf/proto"
- github_com_tendermint_tendermint_libs_bytes "github.com/tendermint/tendermint/libs/bytes"
+ proto "github.com/cosmos/gogoproto/proto"
)
// Reference imports to suppress errors if they are not otherwise used.
@@ -439,7 +439,7 @@ var xxx_messageInfo_AbsoluteTxPosition proto.InternalMessageInfo
// Model is a struct that holds a KV pair
type Model struct {
// hex-encode key to read it better (this is often ascii)
- Key github_com_tendermint_tendermint_libs_bytes.HexBytes `protobuf:"bytes,1,opt,name=key,proto3,casttype=github.com/tendermint/tendermint/libs/bytes.HexBytes" json:"key,omitempty"`
+ Key github_com_cometbft_cometbft_libs_bytes.HexBytes `protobuf:"bytes,1,opt,name=key,proto3,casttype=github.com/cometbft/cometbft/libs/bytes.HexBytes" json:"key,omitempty"`
// base64-encode raw value
Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
}
@@ -501,78 +501,78 @@ var fileDescriptor_e6155d98fa173e02 = []byte{
// 1182 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x56, 0xcf, 0x8f, 0xdb, 0xc4,
0x17, 0x8f, 0x93, 0xec, 0x8f, 0x4c, 0xf7, 0xdb, 0xaf, 0x3b, 0x6c, 0x69, 0x36, 0xac, 0x92, 0xd4,
- 0x94, 0xb2, 0xfd, 0x95, 0xd0, 0x05, 0x01, 0xea, 0xa1, 0x52, 0x7e, 0xb8, 0x5d, 0x57, 0x6c, 0x1c,
- 0x4d, 0x52, 0xaa, 0x45, 0x2a, 0x96, 0x63, 0xcf, 0x66, 0xad, 0x3a, 0x9e, 0xc8, 0x33, 0xd9, 0xc6,
- 0xff, 0x01, 0x8a, 0x84, 0xe0, 0xc8, 0x25, 0x12, 0x02, 0x84, 0xca, 0x9d, 0x3f, 0xa2, 0x02, 0x09,
- 0xf5, 0xc8, 0x29, 0x82, 0xed, 0x85, 0x73, 0x8e, 0xe5, 0x82, 0x3c, 0x13, 0x37, 0xa6, 0xed, 0x76,
- 0xc3, 0xc5, 0x9a, 0x79, 0xef, 0x7d, 0x3e, 0xef, 0xbd, 0xcf, 0xcc, 0x1b, 0x19, 0x6c, 0x5a, 0x84,
- 0xf6, 0x1e, 0x9a, 0xb4, 0x57, 0xe6, 0x9f, 0xc3, 0xeb, 0x65, 0x16, 0xf4, 0x31, 0x2d, 0xf5, 0x7d,
- 0xc2, 0x08, 0x94, 0x23, 0x6f, 0x89, 0x7f, 0x0e, 0xaf, 0xe7, 0x36, 0x42, 0x0b, 0xa1, 0x06, 0xf7,
- 0x97, 0xc5, 0x46, 0x04, 0xe7, 0xd6, 0xbb, 0xa4, 0x4b, 0x84, 0x3d, 0x5c, 0xcd, 0xac, 0x1b, 0x5d,
- 0x42, 0xba, 0x2e, 0x2e, 0xf3, 0x5d, 0x67, 0xb0, 0x5f, 0x36, 0xbd, 0x40, 0xb8, 0x94, 0xfb, 0xe0,
- 0xff, 0x15, 0xcb, 0xc2, 0x94, 0xb6, 0x83, 0x3e, 0x6e, 0x9a, 0xbe, 0xd9, 0x83, 0x75, 0xb0, 0x74,
- 0x68, 0xba, 0x03, 0x9c, 0x95, 0x8a, 0xd2, 0xd6, 0xe9, 0xed, 0xcd, 0xd2, 0x8b, 0x05, 0x94, 0xe6,
- 0x88, 0xaa, 0x3c, 0x9d, 0x14, 0xd6, 0x02, 0xb3, 0xe7, 0xde, 0x50, 0x38, 0x48, 0x41, 0x02, 0x7c,
- 0x23, 0xfd, 0xcd, 0xb7, 0x05, 0x49, 0xf9, 0x55, 0x02, 0x6b, 0x22, 0xba, 0x46, 0xbc, 0x7d, 0xa7,
- 0x0b, 0x5b, 0x00, 0xf4, 0xb1, 0xdf, 0x73, 0x28, 0x75, 0x88, 0xb7, 0x50, 0x86, 0xb3, 0xd3, 0x49,
- 0xe1, 0x8c, 0xc8, 0x30, 0x47, 0x2a, 0x28, 0x46, 0x03, 0xaf, 0x82, 0x15, 0xd3, 0xb6, 0x7d, 0x4c,
- 0x69, 0x36, 0x59, 0x94, 0xb6, 0x32, 0x55, 0x38, 0x9d, 0x14, 0x4e, 0x0b, 0xcc, 0xcc, 0xa1, 0xa0,
- 0x28, 0x04, 0x6e, 0x83, 0xcc, 0x6c, 0x89, 0x69, 0x36, 0x55, 0x4c, 0x6d, 0x65, 0xaa, 0xeb, 0xd3,
- 0x49, 0x41, 0xfe, 0x57, 0x3c, 0xa6, 0x0a, 0x9a, 0x87, 0xcd, 0xba, 0xf9, 0x2a, 0x09, 0x96, 0xb9,
- 0x46, 0x14, 0x12, 0x00, 0x2d, 0x62, 0x63, 0x63, 0xd0, 0x77, 0x89, 0x69, 0x1b, 0x26, 0xaf, 0x97,
- 0xf7, 0x73, 0x6a, 0x3b, 0x7f, 0x5c, 0x3f, 0x42, 0x83, 0xea, 0xf9, 0xc7, 0x93, 0x42, 0x62, 0x3a,
- 0x29, 0x6c, 0x88, 0x8c, 0x2f, 0xf3, 0x28, 0x48, 0x0e, 0x8d, 0x77, 0xb9, 0x4d, 0x40, 0xe1, 0x97,
- 0x12, 0xc8, 0x3b, 0x1e, 0x65, 0xa6, 0xc7, 0x1c, 0x93, 0x61, 0xc3, 0xc6, 0xfb, 0xe6, 0xc0, 0x65,
- 0x46, 0x4c, 0xcd, 0xe4, 0x02, 0x6a, 0x5e, 0x9a, 0x4e, 0x0a, 0xef, 0x88, 0xbc, 0xaf, 0x67, 0x53,
- 0xd0, 0x66, 0x2c, 0xa0, 0x2e, 0xfc, 0xcd, 0xe7, 0x6e, 0xae, 0x48, 0x42, 0xf9, 0x4e, 0x02, 0xab,
- 0x35, 0x62, 0x63, 0xcd, 0xdb, 0x27, 0xf0, 0x2d, 0x90, 0xe1, 0xbd, 0x1c, 0x98, 0xf4, 0x80, 0x4b,
- 0xb1, 0x86, 0x56, 0x43, 0xc3, 0x8e, 0x49, 0x0f, 0x60, 0x16, 0xac, 0x58, 0x3e, 0x36, 0x19, 0xf1,
- 0xc5, 0x19, 0xa1, 0x68, 0x0b, 0x5b, 0x00, 0xc6, 0x4b, 0xb1, 0xb8, 0x48, 0xd9, 0xa5, 0x85, 0xa4,
- 0x4c, 0x87, 0x52, 0xa2, 0x33, 0x31, 0xbc, 0x70, 0xdc, 0x49, 0xaf, 0xa6, 0xe4, 0xf4, 0x9d, 0xf4,
- 0x6a, 0x5a, 0x5e, 0x52, 0x7e, 0x4b, 0x82, 0xb5, 0x1a, 0xf1, 0x98, 0x6f, 0x5a, 0x8c, 0x17, 0xfa,
- 0x36, 0x58, 0xe1, 0x85, 0x3a, 0x36, 0x2f, 0x33, 0x5d, 0x05, 0x47, 0x93, 0xc2, 0x32, 0xef, 0xa3,
- 0x8e, 0x96, 0x43, 0x97, 0x66, 0xbf, 0xa6, 0xe0, 0x75, 0xb0, 0x64, 0xda, 0x3d, 0xc7, 0xcb, 0xa6,
- 0xb8, 0x5d, 0x6c, 0x42, 0xab, 0x6b, 0x76, 0xb0, 0x9b, 0x4d, 0x0b, 0x2b, 0xdf, 0xc0, 0x9b, 0x33,
- 0x16, 0x6c, 0xcf, 0x3a, 0xba, 0xf0, 0x8a, 0x8e, 0x3a, 0x94, 0xb8, 0x03, 0x86, 0xdb, 0xc3, 0x26,
- 0xa1, 0x0e, 0x73, 0x88, 0x87, 0x22, 0x10, 0xbc, 0x06, 0x4e, 0x39, 0x1d, 0xcb, 0xe8, 0x13, 0x9f,
- 0x85, 0xe5, 0x2e, 0xf3, 0xeb, 0xfd, 0xbf, 0xa3, 0x49, 0x21, 0xa3, 0x55, 0x6b, 0x4d, 0xe2, 0x33,
- 0xad, 0x8e, 0x32, 0x4e, 0xc7, 0xe2, 0x4b, 0x1b, 0x7e, 0x0e, 0x32, 0x78, 0xc8, 0xb0, 0xc7, 0xef,
- 0xc3, 0x0a, 0x4f, 0xb8, 0x5e, 0x12, 0xd3, 0x5f, 0x8a, 0xa6, 0xbf, 0x54, 0xf1, 0x82, 0xea, 0xe5,
- 0x5f, 0x7e, 0xbe, 0x76, 0xf1, 0xa5, 0x4a, 0xe2, 0x2a, 0xa9, 0x11, 0x0f, 0x9a, 0x53, 0xde, 0x48,
- 0xff, 0x15, 0xce, 0xc1, 0xdf, 0x12, 0xc8, 0x46, 0xa1, 0xa1, 0x6a, 0x3b, 0x0e, 0x65, 0xc4, 0x0f,
- 0x54, 0x8f, 0xf9, 0x01, 0x6c, 0x82, 0x0c, 0xe9, 0x63, 0xdf, 0x64, 0xf3, 0x01, 0xdf, 0x2e, 0x1d,
- 0x9b, 0x29, 0x06, 0xd7, 0x23, 0x54, 0x78, 0x51, 0xd1, 0x9c, 0x24, 0x7e, 0x5c, 0xc9, 0x63, 0x8f,
- 0xeb, 0x26, 0x58, 0x19, 0xf4, 0x6d, 0x2e, 0x74, 0xea, 0xbf, 0x08, 0x3d, 0x03, 0xc1, 0x2d, 0x90,
- 0xea, 0xd1, 0x2e, 0x3f, 0xbc, 0xb5, 0xea, 0x9b, 0xcf, 0x26, 0x05, 0x88, 0xcc, 0x87, 0x51, 0x95,
- 0xbb, 0x98, 0x52, 0xb3, 0x8b, 0x51, 0x18, 0xa2, 0x20, 0x00, 0x5f, 0x26, 0x82, 0xe7, 0xc1, 0x5a,
- 0xc7, 0x25, 0xd6, 0x03, 0xe3, 0x00, 0x3b, 0xdd, 0x03, 0x26, 0x2e, 0x16, 0x3a, 0xc5, 0x6d, 0x3b,
- 0xdc, 0x04, 0x37, 0xc0, 0x2a, 0x1b, 0x1a, 0x8e, 0x67, 0xe3, 0xa1, 0x68, 0x04, 0xad, 0xb0, 0xa1,
- 0x16, 0x6e, 0x15, 0x07, 0x2c, 0xed, 0x12, 0x1b, 0xbb, 0xf0, 0x0e, 0x48, 0x3d, 0xc0, 0x81, 0x98,
- 0x9e, 0xea, 0xc7, 0xcf, 0x26, 0x85, 0x0f, 0xba, 0x0e, 0x3b, 0x18, 0x74, 0x4a, 0x16, 0xe9, 0x95,
- 0x19, 0xf6, 0xec, 0x70, 0x02, 0x3d, 0x16, 0x5f, 0xba, 0x4e, 0x87, 0x96, 0x3b, 0x01, 0xc3, 0xb4,
- 0xb4, 0x83, 0x87, 0xd5, 0x70, 0x81, 0x42, 0x92, 0xf0, 0x46, 0x8a, 0x87, 0x3c, 0xc9, 0x67, 0x51,
- 0x6c, 0x2e, 0xff, 0x94, 0x04, 0x60, 0xfe, 0x20, 0xc0, 0x0f, 0xc1, 0xb9, 0x4a, 0xad, 0xa6, 0xb6,
- 0x5a, 0x46, 0x7b, 0xaf, 0xa9, 0x1a, 0x77, 0x1b, 0xad, 0xa6, 0x5a, 0xd3, 0x6e, 0x69, 0x6a, 0x5d,
- 0x4e, 0xe4, 0x36, 0x46, 0xe3, 0xe2, 0xd9, 0x79, 0xf0, 0x5d, 0x8f, 0xf6, 0xb1, 0xe5, 0xec, 0x3b,
- 0xd8, 0x86, 0x57, 0x01, 0x8c, 0xe3, 0x1a, 0x7a, 0x55, 0xaf, 0xef, 0xc9, 0x52, 0x6e, 0x7d, 0x34,
- 0x2e, 0xca, 0x73, 0x48, 0x83, 0x74, 0x88, 0x1d, 0xc0, 0x8f, 0x40, 0x36, 0x1e, 0xad, 0x37, 0x3e,
- 0xd9, 0x33, 0x2a, 0xf5, 0x3a, 0x52, 0x5b, 0x2d, 0x39, 0xf9, 0x62, 0x1a, 0xdd, 0x73, 0x83, 0xca,
- 0xf3, 0xc7, 0xfa, 0x6c, 0x1c, 0xa8, 0x7e, 0xaa, 0xa2, 0x3d, 0x9e, 0x29, 0x95, 0x3b, 0x37, 0x1a,
- 0x17, 0xdf, 0x98, 0xa3, 0xd4, 0x43, 0xec, 0x07, 0x3c, 0xd9, 0x4d, 0xb0, 0x19, 0xc7, 0x54, 0x1a,
- 0x7b, 0x86, 0x7e, 0x2b, 0x4a, 0xa7, 0xb6, 0xe4, 0x74, 0x6e, 0x73, 0x34, 0x2e, 0x66, 0xe7, 0xd0,
- 0x8a, 0x17, 0xe8, 0xfb, 0x95, 0xe8, 0xb1, 0xcf, 0xad, 0x7e, 0xf1, 0x7d, 0x3e, 0xf1, 0xe8, 0x87,
- 0x7c, 0xe2, 0xf2, 0x8f, 0x29, 0x50, 0x3c, 0xe9, 0xa6, 0x42, 0x0c, 0xde, 0xab, 0xe9, 0x8d, 0x36,
- 0xaa, 0xd4, 0xda, 0x46, 0x4d, 0xaf, 0xab, 0xc6, 0x8e, 0xd6, 0x6a, 0xeb, 0x68, 0xcf, 0xd0, 0x9b,
- 0x2a, 0xaa, 0xb4, 0x35, 0xbd, 0xf1, 0x2a, 0x69, 0xcb, 0xa3, 0x71, 0xf1, 0xca, 0x49, 0xdc, 0x71,
- 0xc1, 0xef, 0x81, 0x4b, 0x0b, 0xa5, 0xd1, 0x1a, 0x5a, 0x5b, 0x96, 0x72, 0x5b, 0xa3, 0x71, 0xf1,
- 0xc2, 0x49, 0xfc, 0x9a, 0xe7, 0x30, 0x78, 0x1f, 0x5c, 0x5d, 0x88, 0x78, 0x57, 0xbb, 0x8d, 0x2a,
- 0x6d, 0x55, 0x4e, 0xe6, 0xae, 0x8c, 0xc6, 0xc5, 0x77, 0x4f, 0xe2, 0xde, 0x75, 0xba, 0xbe, 0xc9,
- 0xf0, 0xc2, 0xf4, 0xb7, 0xd5, 0x86, 0xda, 0xd2, 0x5a, 0x72, 0x6a, 0x31, 0xfa, 0xdb, 0xd8, 0xc3,
- 0xd4, 0xa1, 0xb9, 0x74, 0x78, 0x58, 0xd5, 0x9d, 0xc7, 0x7f, 0xe6, 0x13, 0x8f, 0x8e, 0xf2, 0xd2,
- 0xe3, 0xa3, 0xbc, 0xf4, 0xe4, 0x28, 0x2f, 0xfd, 0x71, 0x94, 0x97, 0xbe, 0x7e, 0x9a, 0x4f, 0x3c,
- 0x79, 0x9a, 0x4f, 0xfc, 0xfe, 0x34, 0x9f, 0xf8, 0xec, 0x62, 0x6c, 0x8e, 0x6a, 0x84, 0xf6, 0xee,
- 0x45, 0xff, 0x5b, 0x76, 0x79, 0x28, 0xfe, 0xbb, 0xf8, 0x4f, 0x57, 0x67, 0x99, 0x3f, 0x93, 0xef,
- 0xff, 0x13, 0x00, 0x00, 0xff, 0xff, 0x7b, 0xae, 0x51, 0x21, 0x95, 0x09, 0x00, 0x00,
+ 0x94, 0xb2, 0xfd, 0x95, 0xb4, 0x0b, 0x02, 0xa9, 0x87, 0x4a, 0xf9, 0xe1, 0x76, 0x5d, 0xb1, 0x49,
+ 0x34, 0x49, 0xa9, 0x16, 0xa9, 0x58, 0x8e, 0x3d, 0xc9, 0x5a, 0x75, 0x3c, 0x91, 0x67, 0xb2, 0x8d,
+ 0xff, 0x03, 0x14, 0x09, 0xc1, 0x91, 0x4b, 0x24, 0x04, 0x08, 0x95, 0x3b, 0x7f, 0x44, 0x05, 0x12,
+ 0xea, 0x91, 0x53, 0x04, 0xdb, 0x0b, 0xe7, 0x3d, 0x96, 0x0b, 0xf2, 0x4c, 0x5c, 0x9b, 0xb6, 0xdb,
+ 0x0d, 0x17, 0x6b, 0xe6, 0xbd, 0xf7, 0xf9, 0xbc, 0xf7, 0x3e, 0x33, 0x6f, 0x64, 0xb0, 0x69, 0x12,
+ 0x3a, 0x78, 0x64, 0xd0, 0x41, 0x99, 0x7f, 0x0e, 0x6e, 0x94, 0x99, 0x3f, 0xc4, 0xb4, 0x34, 0xf4,
+ 0x08, 0x23, 0x50, 0x0e, 0xbd, 0x25, 0xfe, 0x39, 0xb8, 0x91, 0xdb, 0x08, 0x2c, 0x84, 0xea, 0xdc,
+ 0x5f, 0x16, 0x1b, 0x11, 0x9c, 0x5b, 0xef, 0x93, 0x3e, 0x11, 0xf6, 0x60, 0x35, 0xb7, 0x6e, 0xf4,
+ 0x09, 0xe9, 0x3b, 0xb8, 0xcc, 0x77, 0xdd, 0x51, 0xaf, 0x6c, 0xb8, 0xbe, 0x70, 0x29, 0x0f, 0xc0,
+ 0xff, 0x2b, 0xa6, 0x89, 0x29, 0xed, 0xf8, 0x43, 0xdc, 0x32, 0x3c, 0x63, 0x00, 0xeb, 0x60, 0xe9,
+ 0xc0, 0x70, 0x46, 0x38, 0x2b, 0x15, 0xa5, 0xad, 0xd3, 0xdb, 0x9b, 0xa5, 0x97, 0x0b, 0x28, 0x45,
+ 0x88, 0xaa, 0x7c, 0x34, 0x2b, 0xac, 0xf9, 0xc6, 0xc0, 0xb9, 0xa9, 0x70, 0x90, 0x82, 0x04, 0xf8,
+ 0x66, 0xfa, 0x9b, 0x6f, 0x0b, 0x92, 0xf2, 0xab, 0x04, 0xd6, 0x44, 0x74, 0x8d, 0xb8, 0x3d, 0xbb,
+ 0x0f, 0xdb, 0x00, 0x0c, 0xb1, 0x37, 0xb0, 0x29, 0xb5, 0x89, 0xbb, 0x50, 0x86, 0xb3, 0x47, 0xb3,
+ 0xc2, 0x19, 0x91, 0x21, 0x42, 0x2a, 0x28, 0x46, 0x03, 0xaf, 0x82, 0x15, 0xc3, 0xb2, 0x3c, 0x4c,
+ 0x69, 0x36, 0x59, 0x94, 0xb6, 0x32, 0x55, 0x78, 0x34, 0x2b, 0x9c, 0x16, 0x98, 0xb9, 0x43, 0x41,
+ 0x61, 0x08, 0xdc, 0x06, 0x99, 0xf9, 0x12, 0xd3, 0x6c, 0xaa, 0x98, 0xda, 0xca, 0x54, 0xd7, 0x8f,
+ 0x66, 0x05, 0xf9, 0x5f, 0xf1, 0x98, 0x2a, 0x28, 0x0a, 0x9b, 0x77, 0xf3, 0x55, 0x12, 0x2c, 0x73,
+ 0x8d, 0x28, 0x24, 0x00, 0x9a, 0xc4, 0xc2, 0xfa, 0x68, 0xe8, 0x10, 0xc3, 0xd2, 0x0d, 0x5e, 0x2f,
+ 0xef, 0xe7, 0xd4, 0x76, 0xfe, 0xb8, 0x7e, 0x84, 0x06, 0xd5, 0xf3, 0x4f, 0x66, 0x85, 0xc4, 0xd1,
+ 0xac, 0xb0, 0x21, 0x32, 0xbe, 0xca, 0xa3, 0x20, 0x39, 0x30, 0xde, 0xe3, 0x36, 0x01, 0x85, 0x5f,
+ 0x4a, 0x20, 0x6f, 0xbb, 0x94, 0x19, 0x2e, 0xb3, 0x0d, 0x86, 0x75, 0x0b, 0xf7, 0x8c, 0x91, 0xc3,
+ 0xf4, 0x98, 0x9a, 0xc9, 0x05, 0xd4, 0xbc, 0x74, 0x34, 0x2b, 0xbc, 0x27, 0xf2, 0xbe, 0x99, 0x4d,
+ 0x41, 0x9b, 0xb1, 0x80, 0xba, 0xf0, 0xb7, 0x5e, 0xb8, 0xb9, 0x22, 0x09, 0xe5, 0x3b, 0x09, 0xac,
+ 0xd6, 0x88, 0x85, 0x35, 0xb7, 0x47, 0xe0, 0x3b, 0x20, 0xc3, 0x7b, 0xd9, 0x37, 0xe8, 0x3e, 0x97,
+ 0x62, 0x0d, 0xad, 0x06, 0x86, 0x1d, 0x83, 0xee, 0xc3, 0x2c, 0x58, 0x31, 0x3d, 0x6c, 0x30, 0xe2,
+ 0x89, 0x33, 0x42, 0xe1, 0x16, 0xb6, 0x01, 0x8c, 0x97, 0x62, 0x72, 0x91, 0xb2, 0x4b, 0x0b, 0x49,
+ 0x99, 0x0e, 0xa4, 0x44, 0x67, 0x62, 0x78, 0xe1, 0xb8, 0x9b, 0x5e, 0x4d, 0xc9, 0xe9, 0xbb, 0xe9,
+ 0xd5, 0xb4, 0xbc, 0xa4, 0xfc, 0x96, 0x04, 0x6b, 0x35, 0xe2, 0x32, 0xcf, 0x30, 0x19, 0x2f, 0xf4,
+ 0x5d, 0xb0, 0xc2, 0x0b, 0xb5, 0x2d, 0x5e, 0x66, 0xba, 0x0a, 0x0e, 0x67, 0x85, 0x65, 0xde, 0x47,
+ 0x1d, 0x2d, 0x07, 0x2e, 0xcd, 0x7a, 0x43, 0xc1, 0xeb, 0x60, 0xc9, 0xb0, 0x06, 0xb6, 0x9b, 0x4d,
+ 0x71, 0xbb, 0xd8, 0x04, 0x56, 0xc7, 0xe8, 0x62, 0x27, 0x9b, 0x16, 0x56, 0xbe, 0x81, 0xb7, 0xe6,
+ 0x2c, 0xd8, 0x9a, 0x77, 0x74, 0xe1, 0x35, 0x1d, 0x75, 0x29, 0x71, 0x46, 0x0c, 0x77, 0xc6, 0x2d,
+ 0x42, 0x6d, 0x66, 0x13, 0x17, 0x85, 0x20, 0x78, 0x0d, 0x9c, 0xb2, 0xbb, 0xa6, 0x3e, 0x24, 0x1e,
+ 0x0b, 0xca, 0x5d, 0xe6, 0xd7, 0xfb, 0x7f, 0x87, 0xb3, 0x42, 0x46, 0xab, 0xd6, 0x5a, 0xc4, 0x63,
+ 0x5a, 0x1d, 0x65, 0xec, 0xae, 0xc9, 0x97, 0x16, 0xfc, 0x1c, 0x64, 0xf0, 0x98, 0x61, 0x97, 0xdf,
+ 0x87, 0x15, 0x9e, 0x70, 0xbd, 0x24, 0xa6, 0xbf, 0x14, 0x4e, 0x7f, 0xa9, 0xe2, 0xfa, 0xd5, 0xcb,
+ 0xbf, 0xfc, 0x7c, 0xed, 0xe2, 0x2b, 0x95, 0xc4, 0x55, 0x52, 0x43, 0x1e, 0x14, 0x51, 0xde, 0x4c,
+ 0xff, 0x15, 0xcc, 0xc1, 0xdf, 0x12, 0xc8, 0x86, 0xa1, 0x81, 0x6a, 0x3b, 0x36, 0x65, 0xc4, 0xf3,
+ 0x55, 0x97, 0x79, 0x3e, 0x6c, 0x81, 0x0c, 0x19, 0x62, 0xcf, 0x60, 0xd1, 0x80, 0x6f, 0x97, 0x8e,
+ 0xcd, 0x14, 0x83, 0x37, 0x43, 0x54, 0x70, 0x51, 0x51, 0x44, 0x12, 0x3f, 0xae, 0xe4, 0xb1, 0xc7,
+ 0x75, 0x0b, 0xac, 0x8c, 0x86, 0x16, 0x17, 0x3a, 0xf5, 0x5f, 0x84, 0x9e, 0x83, 0xe0, 0x16, 0x48,
+ 0x0d, 0x68, 0x9f, 0x1f, 0xde, 0x5a, 0xf5, 0xed, 0xe7, 0xb3, 0x02, 0x44, 0xc6, 0xa3, 0xb0, 0xca,
+ 0x5d, 0x4c, 0xa9, 0xd1, 0xc7, 0x28, 0x08, 0x51, 0x10, 0x80, 0xaf, 0x12, 0xc1, 0xf3, 0x60, 0xad,
+ 0xeb, 0x10, 0xf3, 0xa1, 0xbe, 0x8f, 0xed, 0xfe, 0x3e, 0x13, 0x17, 0x0b, 0x9d, 0xe2, 0xb6, 0x1d,
+ 0x6e, 0x82, 0x1b, 0x60, 0x95, 0x8d, 0x75, 0xdb, 0xb5, 0xf0, 0x58, 0x34, 0x82, 0x56, 0xd8, 0x58,
+ 0x0b, 0xb6, 0x0a, 0x06, 0x4b, 0xbb, 0xc4, 0xc2, 0x0e, 0xbc, 0x0d, 0x52, 0x0f, 0xb1, 0x2f, 0xa6,
+ 0xa7, 0xfa, 0xe1, 0xf3, 0x59, 0xe1, 0x7a, 0xdf, 0x66, 0xfb, 0xa3, 0x6e, 0xc9, 0x24, 0x83, 0xb2,
+ 0x49, 0x06, 0x98, 0x75, 0x7b, 0x2c, 0x5a, 0x38, 0x76, 0x97, 0x96, 0xbb, 0x3e, 0xc3, 0xb4, 0xb4,
+ 0x83, 0xc7, 0xd5, 0x60, 0x81, 0x02, 0x82, 0xe0, 0x36, 0x8a, 0x47, 0x3c, 0xc9, 0xe7, 0x50, 0x6c,
+ 0x2e, 0xff, 0x94, 0x04, 0x20, 0x7a, 0x0c, 0xe0, 0x47, 0xe0, 0x5c, 0xa5, 0x56, 0x53, 0xdb, 0x6d,
+ 0xbd, 0xb3, 0xd7, 0x52, 0xf5, 0x7b, 0x8d, 0x76, 0x4b, 0xad, 0x69, 0xb7, 0x35, 0xb5, 0x2e, 0x27,
+ 0x72, 0x1b, 0x93, 0x69, 0xf1, 0x6c, 0x14, 0x7c, 0xcf, 0xa5, 0x43, 0x6c, 0xda, 0x3d, 0x1b, 0x5b,
+ 0xf0, 0x2a, 0x80, 0x71, 0x5c, 0xa3, 0x59, 0x6d, 0xd6, 0xf7, 0x64, 0x29, 0xb7, 0x3e, 0x99, 0x16,
+ 0xe5, 0x08, 0xd2, 0x20, 0x5d, 0x62, 0xf9, 0xf0, 0x63, 0x90, 0x8d, 0x47, 0x37, 0x1b, 0x9f, 0xec,
+ 0xe9, 0x95, 0x7a, 0x1d, 0xa9, 0xed, 0xb6, 0x9c, 0x7c, 0x39, 0x4d, 0xd3, 0x75, 0xfc, 0xca, 0x8b,
+ 0x87, 0xfa, 0x6c, 0x1c, 0xa8, 0x7e, 0xaa, 0xa2, 0x3d, 0x9e, 0x29, 0x95, 0x3b, 0x37, 0x99, 0x16,
+ 0xdf, 0x8a, 0x50, 0xea, 0x01, 0xf6, 0x7c, 0x9e, 0xec, 0x16, 0xd8, 0x8c, 0x63, 0x2a, 0x8d, 0x3d,
+ 0xbd, 0x79, 0x3b, 0x4c, 0xa7, 0xb6, 0xe5, 0x74, 0x6e, 0x73, 0x32, 0x2d, 0x66, 0x23, 0x68, 0xc5,
+ 0xf5, 0x9b, 0xbd, 0x4a, 0xf8, 0xd0, 0xe7, 0x56, 0xbf, 0xf8, 0x3e, 0x9f, 0x78, 0xfc, 0x43, 0x3e,
+ 0x71, 0xf9, 0xc7, 0x14, 0x28, 0x9e, 0x74, 0x4b, 0x21, 0x06, 0xd7, 0x6b, 0xcd, 0x46, 0x07, 0x55,
+ 0x6a, 0x1d, 0xbd, 0xd6, 0xac, 0xab, 0xfa, 0x8e, 0xd6, 0xee, 0x34, 0xd1, 0x9e, 0xde, 0x6c, 0xa9,
+ 0xa8, 0xd2, 0xd1, 0x9a, 0x8d, 0xd7, 0x49, 0x5b, 0x9e, 0x4c, 0x8b, 0x57, 0x4e, 0xe2, 0x8e, 0x0b,
+ 0x7e, 0x1f, 0x5c, 0x5a, 0x28, 0x8d, 0xd6, 0xd0, 0x3a, 0xb2, 0x94, 0xdb, 0x9a, 0x4c, 0x8b, 0x17,
+ 0x4e, 0xe2, 0xd7, 0x5c, 0x9b, 0xc1, 0x07, 0xe0, 0xea, 0x42, 0xc4, 0xbb, 0xda, 0x1d, 0x54, 0xe9,
+ 0xa8, 0x72, 0x32, 0x77, 0x65, 0x32, 0x2d, 0xbe, 0x7f, 0x12, 0xf7, 0xae, 0xdd, 0xf7, 0x0c, 0x86,
+ 0x17, 0xa6, 0xbf, 0xa3, 0x36, 0xd4, 0xb6, 0xd6, 0x96, 0x53, 0x8b, 0xd1, 0xdf, 0xc1, 0x2e, 0xa6,
+ 0x36, 0xcd, 0xa5, 0x83, 0xc3, 0xaa, 0xee, 0x3c, 0xf9, 0x33, 0x9f, 0x78, 0x7c, 0x98, 0x97, 0x9e,
+ 0x1c, 0xe6, 0xa5, 0xa7, 0x87, 0x79, 0xe9, 0x8f, 0xc3, 0xbc, 0xf4, 0xf5, 0xb3, 0x7c, 0xe2, 0xe9,
+ 0xb3, 0x7c, 0xe2, 0xf7, 0x67, 0xf9, 0xc4, 0x67, 0x17, 0x63, 0x33, 0x54, 0x23, 0x74, 0x70, 0x3f,
+ 0xfc, 0xd7, 0xb2, 0xca, 0x63, 0xf1, 0xcf, 0xc5, 0x7f, 0xb8, 0xba, 0xcb, 0xfc, 0x89, 0xfc, 0xe0,
+ 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x32, 0xe6, 0x7c, 0xdd, 0x91, 0x09, 0x00, 0x00,
}
func (this *AccessTypeParam) Equal(that interface{}) bool {
diff --git a/x/wasm/types/types_test.go b/x/wasm/types/types_test.go
index 25df828023..3221c00f48 100644
--- a/x/wasm/types/types_test.go
+++ b/x/wasm/types/types_test.go
@@ -8,14 +8,13 @@ import (
"time"
wasmvmtypes "github.com/CosmWasm/wasmvm/types"
+ "github.com/cometbft/cometbft/libs/rand"
"github.com/cosmos/cosmos-sdk/codec"
- "github.com/cosmos/cosmos-sdk/codec/types"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
- govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
+ "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
- "github.com/tendermint/tendermint/libs/rand"
)
func TestContractInfoValidateBasic(t *testing.T) {
@@ -33,7 +32,7 @@ func TestContractInfoValidateBasic(t *testing.T) {
expError: true,
},
"creator not an address": {
- srcMutator: func(c *ContractInfo) { c.Creator = "invalid address" },
+ srcMutator: func(c *ContractInfo) { c.Creator = invalidAddress },
expError: true,
},
"admin empty": {
@@ -41,7 +40,7 @@ func TestContractInfoValidateBasic(t *testing.T) {
expError: false,
},
"admin not an address": {
- srcMutator: func(c *ContractInfo) { c.Admin = "invalid address" },
+ srcMutator: func(c *ContractInfo) { c.Admin = invalidAddress },
expError: true,
},
"label empty": {
@@ -55,18 +54,20 @@ func TestContractInfoValidateBasic(t *testing.T) {
"invalid extension": {
srcMutator: func(c *ContractInfo) {
// any protobuf type with ValidateBasic method
- any, err := codectypes.NewAnyWithValue(&govtypes.TextProposal{})
+ codecAny, err := codectypes.NewAnyWithValue(&v1beta1.TextProposal{})
+
require.NoError(t, err)
- c.Extension = any
+ c.Extension = codecAny
},
expError: true,
},
"not validatable extension": {
srcMutator: func(c *ContractInfo) {
// any protobuf type with ValidateBasic method
- any, err := codectypes.NewAnyWithValue(&govtypes.Proposal{})
+ codecAny, err := codectypes.NewAnyWithValue(&v1beta1.Proposal{})
+
require.NoError(t, err)
- c.Extension = any
+ c.Extension = codecAny
},
},
}
@@ -102,7 +103,7 @@ func TestCodeInfoValidateBasic(t *testing.T) {
expError: true,
},
"creator not an address": {
- srcMutator: func(c *CodeInfo) { c.Creator = "invalid address" },
+ srcMutator: func(c *CodeInfo) { c.Creator = invalidAddress },
expError: true,
},
"Instantiate config invalid": {
@@ -127,7 +128,7 @@ func TestContractInfoSetExtension(t *testing.T) {
anyTime := time.Now().UTC()
aNestedProtobufExt := func() ContractInfoExtension {
// using gov proposal here as a random protobuf types as it contains an Any type inside for nested unpacking
- myExtension, err := govtypes.NewProposal(&govtypes.TextProposal{Title: "bar"}, 1, anyTime, anyTime)
+ myExtension, err := v1beta1.NewProposal(&v1beta1.TextProposal{Title: "bar"}, 1, anyTime, anyTime)
require.NoError(t, err)
myExtension.TotalDeposit = nil
return &myExtension
@@ -146,10 +147,10 @@ func TestContractInfoSetExtension(t *testing.T) {
expNil: true,
},
"validated and accepted": {
- src: &govtypes.TextProposal{Title: "bar", Description: "set"},
+ src: &v1beta1.TextProposal{Title: "bar", Description: "set"},
},
"validated and rejected": {
- src: &govtypes.TextProposal{Title: "bar"},
+ src: &v1beta1.TextProposal{Title: "bar"},
expErr: true,
},
}
@@ -178,7 +179,7 @@ func TestContractInfoMarshalUnmarshal(t *testing.T) {
anyTime := time.Now().UTC()
// using gov proposal here as a random protobuf types as it contains an Any type inside for nested unpacking
- myExtension, err := govtypes.NewProposal(&govtypes.TextProposal{Title: "bar"}, 1, anyTime, anyTime)
+ myExtension, err := v1beta1.NewProposal(&v1beta1.TextProposal{Title: "bar"}, 1, anyTime, anyTime)
require.NoError(t, err)
myExtension.TotalDeposit = nil
@@ -186,16 +187,16 @@ func TestContractInfoMarshalUnmarshal(t *testing.T) {
err = src.SetExtension(&myExtension)
require.NoError(t, err)
- interfaceRegistry := types.NewInterfaceRegistry()
+ interfaceRegistry := codectypes.NewInterfaceRegistry()
marshaler := codec.NewProtoCodec(interfaceRegistry)
RegisterInterfaces(interfaceRegistry)
// register proposal as extension type
interfaceRegistry.RegisterImplementations(
(*ContractInfoExtension)(nil),
- &govtypes.Proposal{},
+ &v1beta1.Proposal{},
)
// register gov types for nested Anys
- govtypes.RegisterInterfaces(interfaceRegistry)
+ v1beta1.RegisterInterfaces(interfaceRegistry)
// when encode
bz, err := marshaler.Marshal(&src)
@@ -207,14 +208,14 @@ func TestContractInfoMarshalUnmarshal(t *testing.T) {
require.NoError(t, err)
assert.Equal(t, src, dest)
// and sanity check nested any
- var destExt govtypes.Proposal
+ var destExt v1beta1.Proposal
require.NoError(t, dest.ReadExtension(&destExt))
assert.Equal(t, destExt.GetTitle(), "bar")
}
func TestContractInfoReadExtension(t *testing.T) {
anyTime := time.Now().UTC()
- myExtension, err := govtypes.NewProposal(&govtypes.TextProposal{Title: "foo"}, 1, anyTime, anyTime)
+ myExtension, err := v1beta1.NewProposal(&v1beta1.TextProposal{Title: "foo"}, 1, anyTime, anyTime)
require.NoError(t, err)
type TestExtensionAsStruct struct {
ContractInfoExtension
@@ -228,10 +229,11 @@ func TestContractInfoReadExtension(t *testing.T) {
}{
"all good": {
setup: func(i *ContractInfo) {
- i.SetExtension(&myExtension)
+ err = i.SetExtension(&myExtension)
+ require.NoError(t, err)
},
param: func() ContractInfoExtension {
- return &govtypes.Proposal{}
+ return &v1beta1.Proposal{}
},
expVal: &myExtension,
},
@@ -239,13 +241,14 @@ func TestContractInfoReadExtension(t *testing.T) {
setup: func(i *ContractInfo) {
},
param: func() ContractInfoExtension {
- return &govtypes.Proposal{}
+ return &v1beta1.Proposal{}
},
- expVal: &govtypes.Proposal{},
+ expVal: &v1beta1.Proposal{},
},
"nil argument value": {
setup: func(i *ContractInfo) {
- i.SetExtension(&myExtension)
+ err = i.SetExtension(&myExtension)
+ require.NoError(t, err)
},
param: func() ContractInfoExtension {
return nil
@@ -254,10 +257,11 @@ func TestContractInfoReadExtension(t *testing.T) {
},
"non matching types": {
setup: func(i *ContractInfo) {
- i.SetExtension(&myExtension)
+ err = i.SetExtension(&myExtension)
+ require.NoError(t, err)
},
param: func() ContractInfoExtension {
- return &govtypes.TextProposal{}
+ return &v1beta1.TextProposal{}
},
expErr: true,
},
diff --git a/x/wasm/types/validation.go b/x/wasm/types/validation.go
index 526a6bf55a..d3e678ba0c 100644
--- a/x/wasm/types/validation.go
+++ b/x/wasm/types/validation.go
@@ -4,7 +4,7 @@ import (
"fmt"
"net/url"
- sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
+ errorsmod "cosmossdk.io/errors"
"github.com/docker/distribution/reference"
)
@@ -24,10 +24,10 @@ var (
func validateWasmCode(s []byte, maxSize int) error {
if len(s) == 0 {
- return sdkerrors.Wrap(ErrEmpty, "is required")
+ return errorsmod.Wrap(ErrEmpty, "is required")
}
if len(s) > maxSize {
- return sdkerrors.Wrapf(ErrLimit, "cannot be longer than %d bytes", maxSize)
+ return errorsmod.Wrapf(ErrLimit, "cannot be longer than %d bytes", maxSize)
}
return nil
}
@@ -35,7 +35,7 @@ func validateWasmCode(s []byte, maxSize int) error {
// ValidateLabel ensure label constraints
func ValidateLabel(label string) error {
if label == "" {
- return sdkerrors.Wrap(ErrEmpty, "is required")
+ return errorsmod.Wrap(ErrEmpty, "is required")
}
if len(label) > MaxLabelSize {
return ErrLimit.Wrapf("cannot be longer than %d characters", MaxLabelSize)
@@ -47,7 +47,7 @@ func ValidateLabel(label string) error {
func ValidateSalt(salt []byte) error {
switch n := len(salt); {
case n == 0:
- return sdkerrors.Wrap(ErrEmpty, "is required")
+ return errorsmod.Wrap(ErrEmpty, "is required")
case n > MaxSaltSize:
return ErrLimit.Wrapf("cannot be longer than %d characters", MaxSaltSize)
}