diff --git a/.golangci.yml b/.golangci.yml index d155f54e54..8b52852e3c 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -18,12 +18,12 @@ linters: - exportloopref - goconst - gocritic - - gci - gofumpt - gosec - gosimple - govet - ineffassign + - maintidx - misspell - nakedret - nolintlint @@ -31,43 +31,42 @@ linters: - revive - stylecheck - typecheck -# - thelper # too many positives with table tests that have custom setup(*testing.T) - unconvert - unused issues: exclude-rules: - - text: 'Use of weak random number generator' + - text: "Use of weak random number generator" linters: - gosec - - text: 'ST1003:' + - text: "ST1003:" linters: - stylecheck # FIXME: Disabled until golangci-lint updates stylecheck with this fix: # https://github.com/dominikh/go-tools/issues/389 - - text: 'ST1016:' + - text: "ST1016:" linters: - stylecheck - - path: 'migrations' - text: 'SA1019:' + - path: "migrations" + text: "SA1019:" linters: - staticcheck - - text: 'SA1019: codec.NewAminoCodec is deprecated' # TODO remove once migration path is set out + - text: "SA1019: codec.NewAminoCodec is deprecated" # TODO remove once migration path is set out linters: - staticcheck - - text: 'SA1019: legacybech32.MustMarshalPubKey' # TODO remove once ready to remove from the sdk + - text: "SA1019: legacybech32.MustMarshalPubKey" # TODO remove once ready to remove from the sdk linters: - staticcheck - - text: 'SA1019: legacybech32.MarshalPubKey' # TODO remove once ready to remove from the sdk + - text: "SA1019: legacybech32.MarshalPubKey" # TODO remove once ready to remove from the sdk linters: - staticcheck - - text: 'SA1019: legacybech32.UnmarshalPubKey' # TODO remove once ready to remove from the sdk + - text: "SA1019: legacybech32.UnmarshalPubKey" # TODO remove once ready to remove from the sdk linters: - staticcheck - - text: 'SA1019: params.SendEnabled is deprecated' # TODO remove once ready to remove from the sdk + - text: "SA1019: params.SendEnabled is deprecated" # TODO remove once ready to remove from the sdk linters: - staticcheck - - text: 'leading space' + - text: "leading space" linters: - nolintlint max-issues-per-linter: 10000 @@ -140,7 +139,7 @@ linters-settings: require-explanation: false require-specific: false gosimple: - checks: ['all'] + checks: ["all"] gocritic: disabled-checks: - regexpMust diff --git a/app/ante.go b/app/ante.go index 8f09c57097..4eb6dbeed3 100644 --- a/app/ante.go +++ b/app/ante.go @@ -3,8 +3,8 @@ package app import ( "errors" - ibcante "github.com/cosmos/ibc-go/v8/modules/core/ante" - "github.com/cosmos/ibc-go/v8/modules/core/keeper" + ibcante "github.com/cosmos/ibc-go/v9/modules/core/ante" + "github.com/cosmos/ibc-go/v9/modules/core/keeper" corestoretypes "cosmossdk.io/core/store" circuitante "cosmossdk.io/x/circuit/ante" diff --git a/app/app.go b/app/app.go index 984c5003d2..34bc930137 100644 --- a/app/app.go +++ b/app/app.go @@ -16,27 +16,26 @@ import ( "github.com/cosmos/ibc-go/modules/capability" capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" - ica "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts" - icacontroller "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller" - icacontrollerkeeper "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/keeper" - icacontrollertypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/types" - icahost "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host" - icahostkeeper "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host/keeper" - icahosttypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host/types" - icatypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types" - ibcfee "github.com/cosmos/ibc-go/v8/modules/apps/29-fee" - ibcfeekeeper "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/keeper" - ibcfeetypes "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/types" - "github.com/cosmos/ibc-go/v8/modules/apps/transfer" - ibctransferkeeper "github.com/cosmos/ibc-go/v8/modules/apps/transfer/keeper" - ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" - ibc "github.com/cosmos/ibc-go/v8/modules/core" - ibcclienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" - ibcconnectiontypes "github.com/cosmos/ibc-go/v8/modules/core/03-connection/types" - porttypes "github.com/cosmos/ibc-go/v8/modules/core/05-port/types" - ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" - ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper" - ibctm "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" + ica "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts" + icacontroller "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/controller" + icacontrollerkeeper "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/controller/keeper" + icacontrollertypes "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/controller/types" + icahost "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/host" + icahostkeeper "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/host/keeper" + icahosttypes "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/host/types" + icatypes "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/types" + ibcfee "github.com/cosmos/ibc-go/v9/modules/apps/29-fee" + ibcfeekeeper "github.com/cosmos/ibc-go/v9/modules/apps/29-fee/keeper" + ibcfeetypes "github.com/cosmos/ibc-go/v9/modules/apps/29-fee/types" + "github.com/cosmos/ibc-go/v9/modules/apps/transfer" + ibctransferkeeper "github.com/cosmos/ibc-go/v9/modules/apps/transfer/keeper" + ibctransfertypes "github.com/cosmos/ibc-go/v9/modules/apps/transfer/types" + ibc "github.com/cosmos/ibc-go/v9/modules/core" + ibcclienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" + ibcconnectiontypes "github.com/cosmos/ibc-go/v9/modules/core/03-connection/types" + porttypes "github.com/cosmos/ibc-go/v9/modules/core/05-port/types" + ibcexported "github.com/cosmos/ibc-go/v9/modules/core/exported" + ibckeeper "github.com/cosmos/ibc-go/v9/modules/core/keeper" "github.com/spf13/cast" autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" @@ -515,7 +514,6 @@ func NewWasmApp( appCodec, keys[ibcexported.StoreKey], app.GetSubspace(ibcexported.ModuleName), - app.StakingKeeper, app.UpgradeKeeper, scopedIBCKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), @@ -599,16 +597,15 @@ func NewWasmApp( appCodec, keys[icahosttypes.StoreKey], app.GetSubspace(icahosttypes.SubModuleName), - app.IBCFeeKeeper, // use ics29 fee as ics4Wrapper in middleware stack - app.IBCKeeper.ChannelKeeper, - app.IBCKeeper.PortKeeper, - app.AccountKeeper, - scopedICAHostKeeper, - app.MsgServiceRouter(), + app.IBCFeeKeeper, // ICS4Wrapper + app.IBCKeeper.ChannelKeeper, // ChannelKeeper + app.IBCKeeper.PortKeeper, // PortKeeper + app.AccountKeeper, // AccountKeeper + scopedICAHostKeeper, // ScopedKeeper + app.MsgServiceRouter(), // MessageRouter + app.GRPCQueryRouter(), // QueryRouter authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) - // set grpc router for ica host - app.ICAHostKeeper.WithQueryRouter(app.GRPCQueryRouter()) app.ICAControllerKeeper = icacontrollerkeeper.NewKeeper( appCodec, @@ -663,10 +660,7 @@ func NewWasmApp( var icaControllerStack porttypes.IBCModule // 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) - // app.ICAAuthModule = icaControllerStack.(ibcmock.IBCModule) - icaControllerStack = icacontroller.NewIBCMiddleware(icaControllerStack, app.ICAControllerKeeper) + icaControllerStack = icacontroller.NewIBCMiddleware(app.ICAControllerKeeper) icaControllerStack = ibccallbacks.NewIBCMiddleware(icaControllerStack, app.IBCFeeKeeper, wasmStackIBCHandler, wasm.DefaultMaxIBCCallbackGas) icaICS4Wrapper := icaControllerStack.(porttypes.ICS4Wrapper) icaControllerStack = ibcfee.NewIBCMiddleware(icaControllerStack, app.IBCFeeKeeper) @@ -735,7 +729,7 @@ func NewWasmApp( transfer.NewAppModule(app.TransferKeeper), ibcfee.NewAppModule(app.IBCFeeKeeper), ica.NewAppModule(&app.ICAControllerKeeper, &app.ICAHostKeeper), - ibctm.AppModule{}, + // ibctm.NewAppModule(app.IBCKeeper.ClientKeeper), // this seems to be some kind of core issue // sdk 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 ) diff --git a/app/export.go b/app/export.go index 8209597c8c..eff560c0e8 100644 --- a/app/export.go +++ b/app/export.go @@ -49,18 +49,8 @@ func (app *WasmApp) ExportAppStateAndValidators(forZeroHeight bool, jailAllowedA }, err } -// prepare for fresh start at zero height -// NOTE zero height genesis is a temporary feature which will be deprecated -// -// in favor of export at a block height -func (app *WasmApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []string) { - applyAllowedAddrs := false - - // check if there is a allowed address list - if len(jailAllowedAddrs) > 0 { - applyAllowedAddrs = true - } - +func (app *WasmApp) handleAllowedAddrs(jailAllowedAddrs []string) (map[string]bool, bool) { + applyAllowedAddrs := len(jailAllowedAddrs) > 0 allowedAddrsMap := make(map[string]bool) for _, addr := range jailAllowedAddrs { @@ -71,11 +61,10 @@ func (app *WasmApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs [ allowedAddrsMap[addr] = true } - /* Just to be safe, assert the invariants on current state. */ - app.CrisisKeeper.AssertInvariants(ctx) - - /* Handle fee distribution state. */ + return allowedAddrsMap, applyAllowedAddrs +} +func (app *WasmApp) handleFeeDistribution(ctx sdk.Context) []stakingtypes.Delegation { // withdraw all validator commission err := app.StakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) { valBz, err := app.StakingKeeper.ValidatorAddressCodec().StringToBytes(val.GetOperator()) @@ -108,22 +97,20 @@ func (app *WasmApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs [ } } - // clear validator slash events + // clear validator slash events and historical rewards app.DistrKeeper.DeleteAllValidatorSlashEvents(ctx) - - // clear validator historical rewards app.DistrKeeper.DeleteAllValidatorHistoricalRewards(ctx) - // set context height to zero - height := ctx.BlockHeight() - ctx = ctx.WithBlockHeight(0) + return dels +} - // reinitialize all validators - err = app.StakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) { +func (app *WasmApp) reinitializeValidators(ctx sdk.Context) error { + return app.StakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) { valBz, err := app.StakingKeeper.ValidatorAddressCodec().StringToBytes(val.GetOperator()) if err != nil { panic(err) } + // donate any unwithdrawn outstanding reward fraction tokens to the community pool scraps, err := app.DistrKeeper.GetValidatorOutstandingRewardsCoins(ctx, valBz) if err != nil { @@ -143,11 +130,9 @@ func (app *WasmApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs [ } return false }) - if err != nil { - panic(err) - } +} - // reinitialize all delegations +func (app *WasmApp) reinitializeDelegations(ctx sdk.Context, dels []stakingtypes.Delegation) { for _, del := range dels { valAddr, err := sdk.ValAddressFromBech32(del.ValidatorAddress) if err != nil { @@ -156,27 +141,22 @@ func (app *WasmApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs [ 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)) } } +} - // reset context height - ctx = ctx.WithBlockHeight(height) - - /* Handle staking state. */ - - // iterate through redelegations, reset creation height - err = app.StakingKeeper.IterateRedelegations(ctx, func(_ int64, red stakingtypes.Redelegation) (stop bool) { +func (app *WasmApp) handleStakingState(ctx sdk.Context, applyAllowedAddrs bool, allowedAddrsMap map[string]bool) { + // Reset redelegations + err := app.StakingKeeper.IterateRedelegations(ctx, func(_ int64, red stakingtypes.Redelegation) (stop bool) { for i := range red.Entries { red.Entries[i].CreationHeight = 0 } - err = app.StakingKeeper.SetRedelegation(ctx, red) + err := app.StakingKeeper.SetRedelegation(ctx, red) if err != nil { panic(err) } @@ -186,12 +166,12 @@ func (app *WasmApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs [ panic(err) } - // iterate through unbonding delegations, reset creation height + // Reset unbonding delegations err = app.StakingKeeper.IterateUnbondingDelegations(ctx, func(_ int64, ubd stakingtypes.UnbondingDelegation) (stop bool) { for i := range ubd.Entries { ubd.Entries[i].CreationHeight = 0 } - err = app.StakingKeeper.SetUnbondingDelegation(ctx, ubd) + err := app.StakingKeeper.SetUnbondingDelegation(ctx, ubd) if err != nil { panic(err) } @@ -201,10 +181,14 @@ func (app *WasmApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs [ panic(err) } - // Iterate through validators by power descending, reset bond heights, and - // update bond intra-tx counters. + // Update validators store := ctx.KVStore(app.GetKey(stakingtypes.StoreKey)) iter := storetypes.KVStoreReversePrefixIterator(store, stakingtypes.ValidatorsKey) + defer func() { + if err := iter.Close(); err != nil { + app.Logger().Error("error while closing the key-value store reverse prefix iterator: ", err) + } + }() for ; iter.Valid(); iter.Next() { addr := sdk.ValAddress(stakingtypes.AddressFromValidatorsKey(iter.Key())) @@ -224,20 +208,15 @@ func (app *WasmApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs [ } } - 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 { - log.Fatal(err) + app.Logger().Error("error while applying validator set updates", "error", err) + return } +} - /* Handle slashing state. */ - - // reset start height on signing infos - err = app.SlashingKeeper.IterateValidatorSigningInfos( +func (app *WasmApp) handleSlashingState(ctx sdk.Context) { + err := app.SlashingKeeper.IterateValidatorSigningInfos( ctx, func(addr sdk.ConsAddress, info slashingtypes.ValidatorSigningInfo) (stop bool) { info.StartHeight = 0 @@ -251,3 +230,28 @@ func (app *WasmApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs [ panic(err) } } + +func (app *WasmApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []string) { + allowedAddrsMap, applyAllowedAddrs := app.handleAllowedAddrs(jailAllowedAddrs) + + // Assert the invariants on current state + app.CrisisKeeper.AssertInvariants(ctx) + + // Handle fee distribution state + height := ctx.BlockHeight() + ctx = ctx.WithBlockHeight(0) + dels := app.handleFeeDistribution(ctx) + + // Reinitialize validators and delegations + if err := app.reinitializeValidators(ctx); err != nil { + panic(err) + } + app.reinitializeDelegations(ctx, dels) + + // Reset context height + ctx = ctx.WithBlockHeight(height) + + // Handle staking and slashing states + app.handleStakingState(ctx, applyAllowedAddrs, allowedAddrsMap) + app.handleSlashingState(ctx) +} diff --git a/app/test_support.go b/app/test_support.go index 33bbffadc2..b433eec22d 100644 --- a/app/test_support.go +++ b/app/test_support.go @@ -2,7 +2,7 @@ package app import ( capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" - ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper" + ibckeeper "github.com/cosmos/ibc-go/v9/modules/core/keeper" "github.com/cosmos/cosmos-sdk/baseapp" authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" diff --git a/app/upgrades/types.go b/app/upgrades/types.go index 2ff71ce631..c6e0037165 100644 --- a/app/upgrades/types.go +++ b/app/upgrades/types.go @@ -4,7 +4,7 @@ import ( "context" capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" - ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper" + ibckeeper "github.com/cosmos/ibc-go/v9/modules/core/keeper" storetypes "cosmossdk.io/store/types" upgradetypes "cosmossdk.io/x/upgrade/types" diff --git a/cmd/wasmd/commands.go b/cmd/wasmd/commands.go index cb9d006682..a90b09cf48 100644 --- a/cmd/wasmd/commands.go +++ b/cmd/wasmd/commands.go @@ -96,8 +96,8 @@ func initAppConfig() (string, interface{}) { func initRootCmd( rootCmd *cobra.Command, txConfig client.TxConfig, - interfaceRegistry codectypes.InterfaceRegistry, - appCodec codec.Codec, + _ codectypes.InterfaceRegistry, + _ codec.Codec, basicManager module.BasicManager, ) { cfg := sdk.GetConfig() diff --git a/cmd/wasmd/root.go b/cmd/wasmd/root.go index e75031da9a..9d9c1df5c3 100644 --- a/cmd/wasmd/root.go +++ b/cmd/wasmd/root.go @@ -10,7 +10,6 @@ import ( "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/config" - "github.com/cosmos/cosmos-sdk/crypto/keyring" "github.com/cosmos/cosmos-sdk/server" simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" @@ -115,7 +114,6 @@ func NewRootCmd() *cobra.Command { // add keyring to autocli opts autoCliOpts := tempApp.AutoCliOpts() initClientCtx, _ = config.ReadFromClientConfig(initClientCtx) - autoCliOpts.Keyring, _ = keyring.NewAutoCLIKeyring(initClientCtx.Keyring) autoCliOpts.ClientCtx = initClientCtx if err := autoCliOpts.EnhanceRootCommand(rootCmd); err != nil { diff --git a/go.mod b/go.mod index 1ee0e31e66..fc377c484f 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,7 @@ require ( github.com/cosmos/gogoproto v1.7.0 github.com/cosmos/iavl v1.2.1 github.com/cosmos/ics23/go v0.11.0 // indirect - github.com/dvsekhvalnov/jose2go v1.6.0 // indirect + github.com/dvsekhvalnov/jose2go v1.7.0 // indirect github.com/golang/protobuf v1.5.4 github.com/google/gofuzz v1.2.0 github.com/gorilla/mux v1.8.1 // indirect @@ -22,14 +22,14 @@ require ( github.com/spf13/pflag v1.0.5 github.com/stretchr/testify v1.10.0 github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d - google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect + google.golang.org/genproto v0.0.0-20240701130421-f6361c86f094 // indirect google.golang.org/grpc v1.67.1 gopkg.in/yaml.v2 v2.4.0 ) require ( cosmossdk.io/api v0.7.6 - cosmossdk.io/client/v2 v2.0.0-beta.1 + cosmossdk.io/client/v2 v2.0.0-beta.3 cosmossdk.io/collections v0.4.0 cosmossdk.io/core v0.11.1 cosmossdk.io/errors v1.0.1 @@ -45,9 +45,9 @@ require ( cosmossdk.io/x/upgrade v0.1.4 github.com/cometbft/cometbft v0.38.15 github.com/cosmos/cosmos-db v1.1.0 - github.com/cosmos/ibc-go/modules/apps/callbacks v0.2.1-0.20231113120333-342c00b0f8bd + github.com/cosmos/ibc-go/modules/apps/callbacks v0.0.0-20240902073039-8983f91e519f github.com/cosmos/ibc-go/modules/capability v1.0.1 - github.com/cosmos/ibc-go/v8 v8.4.0 + github.com/cosmos/ibc-go/v9 v9.0.1 github.com/distribution/reference v0.5.0 github.com/rs/zerolog v1.33.0 github.com/spf13/viper v1.19.0 @@ -55,31 +55,34 @@ require ( ) require ( - cloud.google.com/go v0.112.1 // indirect + cloud.google.com/go v0.115.0 // indirect + cloud.google.com/go/auth v0.6.0 // indirect + cloud.google.com/go/auth/oauth2adapt v0.2.2 // indirect cloud.google.com/go/compute/metadata v0.5.0 // indirect - cloud.google.com/go/iam v1.1.6 // indirect - cloud.google.com/go/storage v1.38.0 // indirect + cloud.google.com/go/iam v1.1.9 // indirect + cloud.google.com/go/storage v1.41.0 // indirect cosmossdk.io/depinject v1.0.0 // indirect - filippo.io/edwards25519 v1.0.0 // indirect + filippo.io/edwards25519 v1.1.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect - github.com/99designs/keyring v1.2.1 // indirect - github.com/DataDog/datadog-go v3.2.0+incompatible // indirect + github.com/99designs/keyring v1.2.2 // indirect + github.com/DataDog/datadog-go v4.8.3+incompatible // indirect github.com/DataDog/zstd v1.5.5 // indirect + github.com/Microsoft/go-winio v0.6.2 // indirect github.com/aws/aws-sdk-go v1.44.224 // 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/bgentry/speakeasy v0.2.0 // indirect github.com/bits-and-blooms/bitset v1.8.0 // indirect github.com/bytedance/sonic v1.12.3 // indirect github.com/bytedance/sonic/loader v0.2.0 // indirect - github.com/cenkalti/backoff/v4 v4.1.3 // indirect + github.com/cenkalti/backoff/v4 v4.3.0 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/chzyer/readline v1.5.1 // indirect github.com/cloudwego/base64x v0.1.4 // indirect github.com/cloudwego/iasm v0.2.0 // indirect github.com/cockroachdb/apd/v2 v2.0.2 // indirect github.com/cockroachdb/errors v1.11.3 // indirect - github.com/cockroachdb/fifo v0.0.0-20240606204812-0bbfbd93a7ce // indirect + github.com/cockroachdb/fifo v0.0.0-20240616162244-4768e80dfb9a // indirect github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect github.com/cockroachdb/pebble v1.1.2 // indirect github.com/cockroachdb/redact v1.1.5 // indirect @@ -90,25 +93,23 @@ require ( github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect github.com/creachadair/atomicfile v0.3.1 // indirect github.com/creachadair/tomledit v0.0.24 // indirect - github.com/danieljoos/wincred v1.1.2 // indirect + github.com/danieljoos/wincred v1.2.1 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect - github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect + github.com/desertbit/timer v1.0.1 // indirect github.com/dgraph-io/badger/v4 v4.2.0 // indirect github.com/dgraph-io/ristretto v0.1.1 // indirect github.com/dustin/go-humanize v1.0.1 // indirect - github.com/emicklei/dot v1.6.1 // indirect - github.com/fatih/color v1.15.0 // indirect + github.com/emicklei/dot v1.6.2 // indirect + github.com/fatih/color v1.17.0 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect - github.com/getsentry/sentry-go v0.27.0 // indirect + github.com/getsentry/sentry-go v0.28.1 // indirect github.com/go-kit/kit v0.13.0 // indirect github.com/go-kit/log v0.2.1 // indirect github.com/go-logfmt/logfmt v0.6.0 // indirect github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect - github.com/gobwas/httphead v0.1.0 // indirect - github.com/gobwas/pool v0.2.1 // indirect github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect github.com/gogo/googleapis v1.4.1 // indirect github.com/gogo/protobuf v1.3.2 // indirect @@ -117,30 +118,30 @@ require ( github.com/golang/mock v1.6.0 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/btree v1.1.3 // indirect - github.com/google/flatbuffers v1.12.1 // indirect + github.com/google/flatbuffers v24.3.25+incompatible // indirect github.com/google/go-cmp v0.6.0 // indirect github.com/google/orderedcode v0.0.1 // indirect github.com/google/s2a-go v0.1.7 // indirect github.com/google/uuid v1.6.0 // indirect github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect - github.com/googleapis/gax-go/v2 v2.12.3 // indirect + github.com/googleapis/gax-go/v2 v2.12.5 // indirect github.com/gorilla/handlers v1.5.2 // indirect github.com/gorilla/websocket v1.5.3 // indirect github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect github.com/hashicorp/go-getter v1.7.5 // indirect - github.com/hashicorp/go-hclog v1.5.0 // indirect + github.com/hashicorp/go-hclog v1.6.3 // indirect github.com/hashicorp/go-immutable-radix v1.3.1 // indirect github.com/hashicorp/go-metrics v0.5.3 // indirect - github.com/hashicorp/go-plugin v1.5.2 // indirect + github.com/hashicorp/go-plugin v1.6.1 // indirect github.com/hashicorp/go-safetemp v1.0.0 // indirect github.com/hashicorp/go-version v1.6.0 // indirect github.com/hashicorp/golang-lru v1.0.2 // indirect github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/hashicorp/yamux v0.1.1 // indirect - github.com/hdevalence/ed25519consensus v0.1.0 // indirect + github.com/hdevalence/ed25519consensus v0.2.0 // indirect github.com/huandu/skiplist v1.2.0 // indirect github.com/iancoleman/strcase v0.3.0 // indirect github.com/improbable-eng/grpc-web v0.15.0 // indirect @@ -152,7 +153,7 @@ require ( github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect github.com/lib/pq v1.10.9 // indirect - github.com/linxGnu/grocksdb v1.8.14 // indirect + github.com/linxGnu/grocksdb v1.9.2 // indirect github.com/magiconair/properties v1.8.7 // indirect github.com/manifoldco/promptui v0.9.0 // indirect github.com/mattn/go-colorable v0.1.13 // indirect @@ -175,7 +176,7 @@ require ( github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect github.com/rs/cors v1.11.1 // indirect - github.com/sagikazarmark/locafero v0.4.0 // indirect + github.com/sagikazarmark/locafero v0.6.0 // indirect github.com/sagikazarmark/slog-shim v0.1.0 // indirect github.com/sasha-s/go-deadlock v0.3.5 // indirect github.com/shamaton/msgpack/v2 v2.2.0 // indirect @@ -188,7 +189,7 @@ require ( github.com/ulikunitz/xz v0.5.11 // indirect github.com/zondax/hid v0.9.2 // indirect github.com/zondax/ledger-go v0.14.3 // indirect - go.etcd.io/bbolt v1.4.0-alpha.0.0.20240404170359-43604f3112c5 // indirect + go.etcd.io/bbolt v1.4.0-alpha.1 // indirect go.opencensus.io v0.24.0 // indirect go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 // indirect @@ -198,7 +199,7 @@ require ( go.uber.org/multierr v1.11.0 // indirect golang.org/x/arch v0.0.0-20210923205945-b76863e36670 // indirect golang.org/x/crypto v0.28.0 // indirect - golang.org/x/exp v0.0.0-20240404231335-c0f41cb1a7a0 // indirect + golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 // indirect golang.org/x/net v0.30.0 // indirect golang.org/x/oauth2 v0.23.0 // indirect golang.org/x/sync v0.8.0 // indirect @@ -206,13 +207,13 @@ require ( golang.org/x/term v0.25.0 // indirect golang.org/x/text v0.19.0 // indirect golang.org/x/time v0.5.0 // indirect - google.golang.org/api v0.171.0 // indirect + google.golang.org/api v0.186.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 // indirect google.golang.org/protobuf v1.35.1 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect gotest.tools/v3 v3.5.1 // indirect - nhooyr.io/websocket v1.8.6 // indirect + nhooyr.io/websocket v1.8.11 // indirect pgregory.net/rapid v1.1.0 // indirect sigs.k8s.io/yaml v1.4.0 // indirect ) diff --git a/go.sum b/go.sum index 832141acf8..48e4945316 100644 --- a/go.sum +++ b/go.sum @@ -30,8 +30,8 @@ cloud.google.com/go v0.100.2/go.mod h1:4Xra9TjzAeYHrl5+oeLlzbM2k3mjVhZh4UqTZ//w9 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.112.1 h1:uJSeirPke5UNZHIb4SxfZklVSiWWVqW4oXlETwZziwM= -cloud.google.com/go v0.112.1/go.mod h1:+Vbu+Y1UU+I1rjmzeMOb/8RfkKJK2Gyxi1X6jJCZLo4= +cloud.google.com/go v0.115.0 h1:CnFSK6Xo3lDYRoBKEcAtia6VSC837/ZkJuRduSFnr14= +cloud.google.com/go v0.115.0/go.mod h1:8jIM5vVgoAEoiVxQ/O4BFTfHqulPZgs/ufEzMcFMdWU= 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= @@ -46,6 +46,10 @@ cloud.google.com/go/asset v1.8.0/go.mod h1:mUNGKhiqIdbr8X7KNayoYvyc4HbbFO9URsjby 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/auth v0.6.0 h1:5x+d6b5zdezZ7gmLWD1m/xNjnaQ2YDhmIz/HH3doy1g= +cloud.google.com/go/auth v0.6.0/go.mod h1:b4acV+jLQDyjwm4OXHYjNvRi4jvGBzHWJRtJcy+2P4g= +cloud.google.com/go/auth/oauth2adapt v0.2.2 h1:+TTV8aXpjeChS9M+aTtN/TjdQnzJvmzKFt//oWu7HX4= +cloud.google.com/go/auth/oauth2adapt v0.2.2/go.mod h1:wcYjgpZI9+Yu7LyYBg4pqSiaRkfEK3GQcpb7C/uyF1Q= 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= @@ -107,8 +111,8 @@ cloud.google.com/go/gkehub v0.10.0/go.mod h1:UIPwxI0DsrpsVoWpLB0stwKCP+WFVG9+y97 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 v1.1.6 h1:bEa06k05IO4f4uJonbB5iAgKTPpABy1ayxaIZV/GHVc= -cloud.google.com/go/iam v1.1.6/go.mod h1:O0zxdPeGBoFdWW3HWmBxJsk0pfvNM/p/qa82rWOGTwI= +cloud.google.com/go/iam v1.1.9 h1:oSkYLVtVme29uGYrOcKcvJRht7cHJpYD09GM9JaR0TE= +cloud.google.com/go/iam v1.1.9/go.mod h1:Nt1eDWNYH9nGQg3d/mY7U1hvfGmsaG9o/kLGoLoLXjQ= 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= @@ -169,8 +173,8 @@ cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9 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.38.0 h1:Az68ZRGlnNTpIBbLjSMIV2BDcwwXYlRlQzis0llkpJg= -cloud.google.com/go/storage v1.38.0/go.mod h1:tlUADB0mAb9BgYls9lq+8MGkfzOXuLrnHXlpHmvFJoY= +cloud.google.com/go/storage v1.41.0 h1:RusiwatSu6lHeEXe3kglxakAmAbfV+rhtPqA6i8RBx0= +cloud.google.com/go/storage v1.41.0/go.mod h1:J1WCa/Z2FcgdEDuPUY8DxT5I+d9mFKsCepp5vR6Sq80= 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= @@ -184,8 +188,8 @@ cloud.google.com/go/workflows v1.6.0/go.mod h1:6t9F5h/unJz41YqfBmqSASJSXccBLtD1V cloud.google.com/go/workflows v1.7.0/go.mod h1:JhSrZuVZWuiDfKEFxU0/F1PQjmpnpcoISEXH2bcHC3M= cosmossdk.io/api v0.7.6 h1:PC20PcXy1xYKH2KU4RMurVoFjjKkCgYRbVAD4PdqUuY= cosmossdk.io/api v0.7.6/go.mod h1:IcxpYS5fMemZGqyYtErK7OqvdM0C8kdW3dq8Q/XIG38= -cosmossdk.io/client/v2 v2.0.0-beta.1 h1:XkHh1lhrLYIT9zKl7cIOXUXg2hdhtjTPBUfqERNA1/Q= -cosmossdk.io/client/v2 v2.0.0-beta.1/go.mod h1:JEUSu9moNZQ4kU3ir1DKD5eU4bllmAexrGWjmb9k8qU= +cosmossdk.io/client/v2 v2.0.0-beta.3 h1:+TTuH0DwQYsUq2JFAl3fDZzKq5gQG7nt3dAattkjFDU= +cosmossdk.io/client/v2 v2.0.0-beta.3/go.mod h1:CZcL41HpJPOOayTCO28j8weNBQprG+SRiKX39votypo= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= cosmossdk.io/core v0.11.1 h1:h9WfBey7NAiFfIcUhDVNS503I2P2HdZLebJlUIs8LPA= @@ -215,8 +219,8 @@ cosmossdk.io/x/tx v0.13.5/go.mod h1:V6DImnwJMTq5qFjeGWpXNiT/fjgE4HtmclRmTqRVM3w= cosmossdk.io/x/upgrade v0.1.4 h1:/BWJim24QHoXde8Bc64/2BSEB6W4eTydq0X/2f8+g38= cosmossdk.io/x/upgrade v0.1.4/go.mod h1:9v0Aj+fs97O+Ztw+tG3/tp5JSlrmT7IcFhAebQHmOPo= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -filippo.io/edwards25519 v1.0.0 h1:0wAIcmJUqRdI8IJ/3eGi5/HwXZWPujYXXlkrQogz0Ek= -filippo.io/edwards25519 v1.0.0/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns= +filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= +filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= 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/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0= @@ -225,13 +229,14 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/CosmWasm/wasmvm/v2 v2.2.0-rc.2 h1:Y9sQqabWsj9ePbZFKRUEIWSY2QYyHeEIrF/qz0ZNGl4= github.com/CosmWasm/wasmvm/v2 v2.2.0-rc.2/go.mod h1:bMhLQL4Yp9CzJi9A83aR7VO9wockOsSlZbT4ztOl6bg= -github.com/DataDog/datadog-go v3.2.0+incompatible h1:qSG2N4FghB1He/r2mFrWKCaL7dXCilEuNEeAn20fdD4= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +github.com/DataDog/datadog-go v4.8.3+incompatible h1:fNGaYSuObuQb5nzeTQqowRAd9bpDIRRV4/gUtIBjh8Q= +github.com/DataDog/datadog-go v4.8.3+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/zstd v1.5.5 h1:oWf5W7GtOLgp6bciQYDmhHHjdhYkALu6S/5Ni9ZgSvQ= github.com/DataDog/zstd v1.5.5/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= -github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= -github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= +github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY= +github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 h1:TngWCqHvy9oXAN6lEVMRuU21PR1EtLVZJmdB18Gu3Rw= github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5/go.mod h1:lmUJ/7eu/Q8D7ML55dXQrVaamCz2vxCfdQBasLZfHKk= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= @@ -268,8 +273,8 @@ github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6r 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/bgentry/speakeasy v0.2.0 h1:tgObeVOf8WAvtuAX6DhJ4xks4CFNwPDZiqzGqIHE51E= +github.com/bgentry/speakeasy v0.2.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bits-and-blooms/bitset v1.8.0 h1:FD+XqgOZDUxxZ8hzoBFuV9+cGWY9CslN6d5MS5JVb4c= github.com/bits-and-blooms/bitset v1.8.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= github.com/btcsuite/btcd/btcec/v2 v2.3.4 h1:3EJjcN70HCu/mwqlUsGK8GcNVyLVxFDlWurTXGPFfiQ= @@ -287,8 +292,8 @@ github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n 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/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8= +github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= @@ -328,8 +333,8 @@ github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f h1:otljaY github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f/go.mod h1:a9RdTaap04u637JoCzcUoIcDmvwSUtcUFtT/C3kJlTU= github.com/cockroachdb/errors v1.11.3 h1:5bA+k2Y6r+oz/6Z/RFlNeVCesGARKuC6YymtcDrbC/I= github.com/cockroachdb/errors v1.11.3/go.mod h1:m4UIW4CDjx+R5cybPsNrRbreomiFqt8o1h1wUVazSd8= -github.com/cockroachdb/fifo v0.0.0-20240606204812-0bbfbd93a7ce h1:giXvy4KSc/6g/esnpM7Geqxka4WSqI1SZc7sMJFd3y4= -github.com/cockroachdb/fifo v0.0.0-20240606204812-0bbfbd93a7ce/go.mod h1:9/y3cnZ5GKakj/H4y9r9GTjCvAFta7KLgSHPJJYc52M= +github.com/cockroachdb/fifo v0.0.0-20240616162244-4768e80dfb9a h1:f52TdbU4D5nozMAhO9TvTJ2ZMCXtN4VIAmfrrZ0JXQ4= +github.com/cockroachdb/fifo v0.0.0-20240616162244-4768e80dfb9a/go.mod h1:9/y3cnZ5GKakj/H4y9r9GTjCvAFta7KLgSHPJJYc52M= 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 v1.1.2 h1:CUh2IPtR4swHlEj48Rhfzw6l/d0qA31fItcIszQVIsA= @@ -366,12 +371,12 @@ github.com/cosmos/gogoproto v1.7.0 h1:79USr0oyXAbxg3rspGh/m4SWNyoz/GLaAh0QlCe2fr github.com/cosmos/gogoproto v1.7.0/go.mod h1:yWChEv5IUEYURQasfyBW5ffkMHR/90hiHgbNgrtp4j0= github.com/cosmos/iavl v1.2.1 h1:68OrQEbUSfupX13SDRo+mYh7m1DPKq/uLalELH+qOzk= github.com/cosmos/iavl v1.2.1/go.mod h1:GiM43q0pB+uG53mLxLDzimxM9l/5N9UuSY3/D0huuVw= -github.com/cosmos/ibc-go/modules/apps/callbacks v0.2.1-0.20231113120333-342c00b0f8bd h1:Lx+/5dZ/nN6qPXP2Ofog6u1fmlkCFA1ElcOconnofEM= -github.com/cosmos/ibc-go/modules/apps/callbacks v0.2.1-0.20231113120333-342c00b0f8bd/go.mod h1:JWfpWVKJKiKtd53/KbRoKfxWl8FsT2GPcNezTOk0o5Q= +github.com/cosmos/ibc-go/modules/apps/callbacks v0.0.0-20240902073039-8983f91e519f h1:SeoEfXIBac+7QfK8Owr4cCwZ1BAJONi+WNPk07PV/zA= +github.com/cosmos/ibc-go/modules/apps/callbacks v0.0.0-20240902073039-8983f91e519f/go.mod h1:DCgByp780KeTpO0O7CDCSS2xO2kHsVLyxHupCbqmr3A= github.com/cosmos/ibc-go/modules/capability v1.0.1 h1:ibwhrpJ3SftEEZRxCRkH0fQZ9svjthrX2+oXdZvzgGI= github.com/cosmos/ibc-go/modules/capability v1.0.1/go.mod h1:rquyOV262nGJplkumH+/LeYs04P3eV8oB7ZM4Ygqk4E= -github.com/cosmos/ibc-go/v8 v8.4.0 h1:K2PfX0AZ+1XKZytHGEMuSjQXG/MZshPb83RSTQt2+cE= -github.com/cosmos/ibc-go/v8 v8.4.0/go.mod h1:zh6x1osR0hNvEcFrC/lhGD08sMfQmr9wHVvZ/mRWMCs= +github.com/cosmos/ibc-go/v9 v9.0.1 h1:P4BlAEnaHISaWtpibhKXmPPRommJIT9f8X4Ru7Oon/c= +github.com/cosmos/ibc-go/v9 v9.0.1/go.mod h1:FeznzlNFQhhu1O8TrWJT+2L1OyKdUEb1kmmjuWod3VI= github.com/cosmos/ics23/go v0.11.0 h1:jk5skjT0TqX5e5QJbEnwXIS2yI2vnmLOgpQPeM5RtnU= github.com/cosmos/ics23/go v0.11.0/go.mod h1:A8OjxPE67hHST4Icw94hOxxFEJMBG031xIGF/JHNIY0= github.com/cosmos/keyring v1.2.0 h1:8C1lBP9xhImmIabyXW4c3vFjjLiBdGCmfLUfeZlV1Yo= @@ -386,8 +391,8 @@ github.com/creachadair/tomledit v0.0.24 h1:5Xjr25R2esu1rKCbQEmjZYlrhFkDspoAbAKb6 github.com/creachadair/tomledit v0.0.24/go.mod h1:9qHbShRWQzSCcn617cMzg4eab1vbLCOjOshAWSzWr8U= 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/danieljoos/wincred v1.1.2 h1:QLdCxFs1/Yl4zduvBdcHB8goaYk9RARS2SgLLRuAyr0= -github.com/danieljoos/wincred v1.1.2/go.mod h1:GijpziifJoIBfYh+S7BbkdUTU4LfM+QnGqR5Vl2tAx0= +github.com/danieljoos/wincred v1.2.1 h1:dl9cBrupW8+r5250DYkYxocLeZ1Y4vB1kxgtjxw8GQs= +github.com/danieljoos/wincred v1.2.1/go.mod h1:uGaFL9fDn3OLTvzCGulzE+SzjEe5NGlh5FdCcyfPwps= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= @@ -396,8 +401,9 @@ github.com/decred/dcrd/crypto/blake256 v1.0.1 h1:7PltbUIQB7u/FfZ39+DGa/ShuMyJ5il github.com/decred/dcrd/crypto/blake256 v1.0.1/go.mod h1:2OfgNZ5wDpcsFmHmCK5gZTPcCXqlm2ArzUIkw9czNJo= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 h1:rpfIENRNNilwHwZeG5+P150SMrnNEcHYvcCuK6dPZSg= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= -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/desertbit/timer v1.0.1 h1:yRpYNn5Vaaj6QXecdLMPMJsW81JLiI1eokUft5nBmeo= +github.com/desertbit/timer v1.0.1/go.mod h1:htRrYeY5V/t4iu1xCJ5XsQvp4xve8QulXXctAzxqcwE= github.com/dgraph-io/badger/v4 v4.2.0 h1:kJrlajbXXL9DFTNuhhu9yCx7JJa4qpYWxtE8BzuWsEs= github.com/dgraph-io/badger/v4 v4.2.0/go.mod h1:qfCqhPoWDFJRx1gp5QwwyGo8xk1lbHUxvK9nK0OGAak= github.com/dgraph-io/ristretto v0.1.1 h1:6CWw5tJNgpegArSHpNHJKldNeq03FQCwYvfMVWajOK8= @@ -415,14 +421,14 @@ github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:Htrtb 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.6.0 h1:Y9gnSnP4qEI0+/uQkHvFXeD2PLPJeXEL+ySMEA2EjTY= -github.com/dvsekhvalnov/jose2go v1.6.0/go.mod h1:QsHjhyTlD/lAVqn/NSbVZmSCGeDehTB/mPZadG+mhXU= +github.com/dvsekhvalnov/jose2go v1.7.0 h1:bnQc8+GMnidJZA8zc6lLEAb4xNrIqHwO+9TzqvtQZPo= +github.com/dvsekhvalnov/jose2go v1.7.0/go.mod h1:QsHjhyTlD/lAVqn/NSbVZmSCGeDehTB/mPZadG+mhXU= 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 v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= -github.com/emicklei/dot v1.6.1 h1:ujpDlBkkwgWUY+qPId5IwapRW/xEoligRSYjioR6DFI= -github.com/emicklei/dot v1.6.1/go.mod h1:DeV7GvQtIw4h2u73RKBkkFdvVAz0D9fzeJrgPW6gy/s= +github.com/emicklei/dot v1.6.2 h1:08GN+DD79cy/tzN6uLCT84+2Wk9u+wvqP+Hkx/dIR8A= +github.com/emicklei/dot v1.6.2/go.mod h1:DeV7GvQtIw4h2u73RKBkkFdvVAz0D9fzeJrgPW6gy/s= 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= @@ -436,8 +442,8 @@ github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go. github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= -github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs= -github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw= +github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4= +github.com/fatih/color v1.17.0/go.mod h1:YZ7TlrGPkiz6ku9fK3TLD/pl3CpsiFyu8N92HLgmosI= github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= @@ -450,12 +456,10 @@ 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.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= -github.com/getsentry/sentry-go v0.27.0 h1:Pv98CIbtB3LkMWmXi4Joa5OOcwbmnX88sF5qbK3r3Ps= -github.com/getsentry/sentry-go v0.27.0/go.mod h1:lc76E2QywIyW8WuBnwl8Lc4bkmQH4+w1gwTf25trprY= +github.com/getsentry/sentry-go v0.28.1 h1:zzaSm/vHmGllRM6Tpx1492r0YDzauArdBfkJRtY6P5k= +github.com/getsentry/sentry-go v0.28.1/go.mod h1:1fQZ+7l7eeJ3wYi82q5Hg8GqAPgefRq+FP/QhafYVgg= 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.8.1 h1:4+fr/el88TOO3ewCmQr8cx/CtZ/umlIRIs5M4NTNjf8= github.com/gin-gonic/gin v1.8.1/go.mod h1:ji8BvRH1azfM+SYow9zQ6SZMvR8qOMZHmsCuWR9tTTk= github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA= github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og= @@ -481,26 +485,15 @@ github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ4 github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= -github.com/go-playground/locales v0.14.0 h1:u50s323jtVGugKlcYeyzC0etD1HifMjqmJqb8WugfUU= 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/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-playground/validator/v10 v10.11.1/go.mod h1:i+3WkQ1FvaUjjxh1kSvIA4dMGDBiPU55YFDl0WbKdWU= 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/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo= -github.com/gobwas/httphead v0.1.0 h1:exrUm0f4YX0L7EBwZHuCF4GDp8aJfVeBrlLQrs6NqWU= -github.com/gobwas/httphead v0.1.0/go.mod h1:O/RXo79gxV8G+RqlR/otEwx4Q36zl9rqC5u12GKvMCM= github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw= -github.com/gobwas/pool v0.2.1 h1:xfeeEhW7pwmX8nuLVlqbzVc7udMDrwetjEv+TZIz1og= -github.com/gobwas/pool v0.2.1/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/goccy/go-json v0.9.11/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= 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= @@ -562,8 +555,8 @@ github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Z github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.1.3 h1:CVpQJjYgC4VbzxeGVHfvZrv1ctoYCAI8vbl07Fcxlyg= github.com/google/btree v1.1.3/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= -github.com/google/flatbuffers v1.12.1 h1:MVlul7pQNoDzWRLTw5imwYsl+usrS1TXG2H4jg6ImGw= -github.com/google/flatbuffers v1.12.1/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= +github.com/google/flatbuffers v24.3.25+incompatible h1:CX395cjN9Kke9mmalRoL3d81AtFUxJM+yDthflgJGkI= +github.com/google/flatbuffers v24.3.25+incompatible/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= @@ -590,8 +583,8 @@ github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXi 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/martian/v3 v3.3.2/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= +github.com/google/martian/v3 v3.3.3 h1:DIhPTQrbPkgs2yJYdXU/eNACCG5DVQjySNRNlflZ9Fc= +github.com/google/martian/v3 v3.3.3/go.mod h1:iEPrYcgCF7jA9OtScMFQyAlZZ4YXTKEtJ1E6RWzmBA0= 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= @@ -630,8 +623,8 @@ github.com/googleapis/gax-go/v2 v2.3.0/go.mod h1:b8LNqSzNabLiUpXKkY7HAR5jr6bIT99 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.12.3 h1:5/zPPDvw8Q1SuXjrqrZslrqT7dL/uJT2CQii/cLCKqA= -github.com/googleapis/gax-go/v2 v2.12.3/go.mod h1:AKloxT6GtNbaLm8QTNSidHUVsHYcBHwWRvkNFJUQcS4= +github.com/googleapis/gax-go/v2 v2.12.5 h1:8gw9KZK8TiVKB6q3zHY3SBzLnrGp6HQjyfYBYGmXdxA= +github.com/googleapis/gax-go/v2 v2.12.5/go.mod h1:BUDKcWo+RaKq5SC9vVYL0wLADa3VcfswbOMMRmB9H3E= github.com/googleapis/go-type-adapters v1.0.0/go.mod h1:zHW75FOG2aur7gAO2B+MLby+cLsWGBF62rFAi7WjWO4= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= @@ -664,8 +657,8 @@ github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9n github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= github.com/hashicorp/go-getter v1.7.5 h1:dT58k9hQ/vbxNMwoI5+xFYAJuv6152UNvdHokfI5wE4= github.com/hashicorp/go-getter v1.7.5/go.mod h1:W7TalhMmbPmsSMdNjD0ZskARur/9GJ17cfHTRtXV744= -github.com/hashicorp/go-hclog v1.5.0 h1:bI2ocEMgcVlz55Oj1xZNBsVi900c7II+fWDyV9o+13c= -github.com/hashicorp/go-hclog v1.5.0/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= +github.com/hashicorp/go-hclog v1.6.3 h1:Qr2kF+eVWjTiYmU7Y31tYlP1h0q/X3Nl3tPGdaB11/k= +github.com/hashicorp/go-hclog v1.6.3/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= 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= @@ -673,8 +666,8 @@ github.com/hashicorp/go-metrics v0.5.3 h1:M5uADWMOGCTUNU1YuC4hfknOeHNaX54LDm4oYS github.com/hashicorp/go-metrics v0.5.3/go.mod h1:KEjodfebIOuBYSAe/bHTm+HChmKSxAOXPBieMLYozDE= github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= -github.com/hashicorp/go-plugin v1.5.2 h1:aWv8eimFqWlsEiMrYZdPYl+FdHaBJSN4AWwGWfT1G2Y= -github.com/hashicorp/go-plugin v1.5.2/go.mod h1:w1sAEES3g3PuV/RzUrgow20W2uErMly84hhD3um1WL4= +github.com/hashicorp/go-plugin v1.6.1 h1:P7MR2UP6gNKGPp+y7EZw2kOiq4IR9WiqLvp0XOsVdwI= +github.com/hashicorp/go-plugin v1.6.1/go.mod h1:XPHFku2tFo3o3QKFgSYo+cghcUhw1NA1hZyMK0PWAw0= 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= @@ -703,8 +696,8 @@ github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2p github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE= github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ= -github.com/hdevalence/ed25519consensus v0.1.0 h1:jtBwzzcHuTmFrQN6xQZn6CQEO/V9f7HsjsjeEZ6auqU= -github.com/hdevalence/ed25519consensus v0.1.0/go.mod h1:w3BHWjwJbFU29IRHL1Iqkw3sus+7FctEyM4RqDxYNzo= +github.com/hdevalence/ed25519consensus v0.2.0 h1:37ICyZqdyj0lAZ8P4D1d1id3HqbbG1N3iBb1Tb4rdcU= +github.com/hdevalence/ed25519consensus v0.2.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= @@ -737,7 +730,6 @@ github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/u 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.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= @@ -770,14 +762,13 @@ 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 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w= github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= 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.8.14 h1:HTgyYalNwBSG/1qCQUIott44wU5b2Y9Kr3z7SK5OfGQ= -github.com/linxGnu/grocksdb v1.8.14/go.mod h1:QYiYypR2d4v63Wj1adOOfzglnoII0gLj3PNh4fZkcFA= +github.com/linxGnu/grocksdb v1.9.2 h1:O3mzvO0wuzQ9mtlHbDrShixyVjVbmuqTjFrzlf43wZ8= +github.com/linxGnu/grocksdb v1.9.2/go.mod h1:QYiYypR2d4v63Wj1adOOfzglnoII0gLj3PNh4fZkcFA= github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= @@ -816,11 +807,9 @@ github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh 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= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= 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/mtibben/percent v0.2.1 h1:5gssi8Nqo8QU/r2pynCm+hBQHpkB/uNK7BJCFogWdzs= github.com/mtibben/percent v0.2.1/go.mod h1:KG9uO+SZkUp+VkRHsCdYQV3XSZrrSpR3O9ibNBTZrns= @@ -839,8 +828,8 @@ github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxzi github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= -github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= -github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= +github.com/nxadm/tail v1.4.11 h1:8feyoE3OzPrcshW5/MJ4sGESc5cqmGkGCWlco4l0bqY= +github.com/nxadm/tail v1.4.11/go.mod h1:OTaG3NK980DZzxbRq6lEuzgU+mug70nY11sMd4JXXHc= github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a h1:dlRvE5fWabOchtH7znfiFCcOvmIYgOeAS5ifBXBlh9Q= github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a/go.mod h1:hVoHR2EVESiICEMbg137etN/Lx+lSrHPTD39Z/uE+2s= github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs= @@ -953,8 +942,8 @@ github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWR 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/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ= -github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4= +github.com/sagikazarmark/locafero v0.6.0 h1:ON7AQg37yzcRPU69mt7gwhFEBwxI6P9T4Qu3N51bwOk= +github.com/sagikazarmark/locafero v0.6.0/go.mod h1:77OmuIc6VTraTXKXIs/uvUxKGUXjE1GbemJYHqdNjX0= github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= @@ -1024,11 +1013,8 @@ github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1 github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= -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 v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY= -github.com/ugorji/go/codec v1.2.11 h1:BMaWp1Bb6fHwEtbplGBGJ498wD+LKlNSl25MjdZY4dU= -github.com/ugorji/go/codec v1.2.11/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= 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= @@ -1046,8 +1032,8 @@ github.com/zondax/hid v0.9.2/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWp github.com/zondax/ledger-go v0.14.3 h1:wEpJt2CEcBJ428md/5MgSLsXLBos98sBOyxNmCjfUCw= github.com/zondax/ledger-go v0.14.3/go.mod h1:IKKaoxupuB43g4NxeQmbLXv7T9AlQyie1UpHb342ycI= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= -go.etcd.io/bbolt v1.4.0-alpha.0.0.20240404170359-43604f3112c5 h1:qxen9oVGzDdIRP6ejyAJc760RwW4SnVDiTYTzwnXuxo= -go.etcd.io/bbolt v1.4.0-alpha.0.0.20240404170359-43604f3112c5/go.mod h1:eW0HG9/oHQhvRCvb1/pIXW4cOvtDqeQK+XSi3TnwaXY= +go.etcd.io/bbolt v1.4.0-alpha.1 h1:3yrqQzbRRPFPdOMWS/QQIVxVnzSkAZQYeWlZFv1kbj4= +go.etcd.io/bbolt v1.4.0-alpha.1/go.mod h1:S/Z/Nm3iuOnyO1W4XuFfPci51Gj6F1Hv0z8hisyYYOw= 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= @@ -1068,8 +1054,8 @@ go.opentelemetry.io/otel v1.24.0 h1:0LAOdjNmQeSTzGBzduGe/rU4tZhMwL5rWgtp9Ku5Jfo= go.opentelemetry.io/otel v1.24.0/go.mod h1:W7b9Ozg4nkF5tWI5zsXkaKKDjdVjpD4oAt9Qi/MArHo= go.opentelemetry.io/otel/metric v1.24.0 h1:6EhoGWWK28x1fbpA4tYTOWBkPefTDQnb8WSGXlc88kI= go.opentelemetry.io/otel/metric v1.24.0/go.mod h1:VYhLe1rFfxuTXLgj4CBiyz+9WYBA8pNGJgDcSFRKBco= -go.opentelemetry.io/otel/sdk v1.22.0 h1:6coWHw9xw7EfClIC/+O31R8IY3/+EiRFHevmHafB2Gw= -go.opentelemetry.io/otel/sdk v1.22.0/go.mod h1:iu7luyVGYovrRpe2fmj3CVKouQNdTOkxtLzPvPz1DOc= +go.opentelemetry.io/otel/sdk v1.24.0 h1:YMPPDNymmQN3ZgczicBY3B6sf9n62Dlj9pWD3ucgoDw= +go.opentelemetry.io/otel/sdk v1.24.0/go.mod h1:KVrIYw6tEubO9E96HQpcmpTKDVn9gdv35HoYiQWGDFg= go.opentelemetry.io/otel/trace v1.24.0 h1:CsKnnL4dUAr/0llH9FKuc698G04IrpWV0MQA/Y1YELI= go.opentelemetry.io/otel/trace v1.24.0/go.mod h1:HPc3Xr/cOApsBI154IU0OI0HJexz+aw5uPdbs3UCjNU= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= @@ -1113,8 +1099,8 @@ 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-20240404231335-c0f41cb1a7a0 h1:985EYyeCOxTpcgOTJpflJUwOeEz0CQOdPt73OzpE9F8= -golang.org/x/exp v0.0.0-20240404231335-c0f41cb1a7a0/go.mod h1:/lliqkxwWAhPjf5oSOIJup2XcqJaw8RGS6k3TGEc7GI= +golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 h1:yixxcjnhBmY0nkL253HFVIm0JsFHwrHdT3Yh6szTnfY= +golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8/go.mod h1:jj3sYF3dwk5D+ghuXyeI3r5MFf+NT2An6/9dOA95KSI= 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= @@ -1141,8 +1127,6 @@ 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.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= -golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= 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= @@ -1313,7 +1297,6 @@ golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBc 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-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-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -1429,8 +1412,6 @@ 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.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= 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= @@ -1490,8 +1471,8 @@ google.golang.org/api v0.96.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ 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.171.0 h1:w174hnBPqut76FzW5Qaupt7zY8Kql6fiVjgys4f58sU= -google.golang.org/api v0.171.0/go.mod h1:Hnq5AHm4OTMt2BUVjael2CWZFD6vksJdWCWiUAmjC9o= +google.golang.org/api v0.186.0 h1:n2OPp+PPXX0Axh4GuSsL5QL8xQCTb2oDwyzPnQvqUug= +google.golang.org/api v0.186.0/go.mod h1:hvRbBmgoje49RV3xqVXrmP6w93n6ehGgIVPYrGtBFFc= 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= @@ -1606,8 +1587,8 @@ google.golang.org/genproto v0.0.0-20221010155953-15ba04fc1c0e/go.mod h1:3526vdqw 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-20240227224415-6ceb2ff114de h1:F6qOa9AZTYJXOUEr4jDysRDLrm4PHePlge4v4TGAlxY= -google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:VUhTRKeHn9wwcdrk73nvdC9gF178Tzhmt/qyaFcPLSo= +google.golang.org/genproto v0.0.0-20240701130421-f6361c86f094 h1:6whtk83KtD3FkGrVb2hFXuQ+ZMbCNdakARIn/aHMmG8= +google.golang.org/genproto v0.0.0-20240701130421-f6361c86f094/go.mod h1:Zs4wYw8z1zr6RNF4cwYb31mvN/EGaKAdQjNCF3DW6K4= google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 h1:wKguEg1hsxI2/L3hUYrpo1RVi48K+uTyzKqprwLXsb8= google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142/go.mod h1:d6be+8HhtEtucleCbxpPW9PA9XwISACu8nvpPqF0BVo= google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 h1:e7S5W7MGGLaSu8j3YjdezkZ+m1/Nm0uRVRMEMGk26Xs= @@ -1715,8 +1696,9 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -nhooyr.io/websocket v1.8.6 h1:s+C3xAMLwGmlI31Nyn/eAehUlZPwfYZu2JXM621Q5/k= nhooyr.io/websocket v1.8.6/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0= +nhooyr.io/websocket v1.8.11 h1:f/qXNc2/3DpoSZkHt1DQu6rj4zGC8JmkkLkWss0MgN0= +nhooyr.io/websocket v1.8.11/go.mod h1:rN9OFWIUwuxg4fR5tELlYC04bXYowCP9GX47ivo2l+c= nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50= pgregory.net/rapid v1.1.0 h1:CMa0sjHSru3puNx+J0MIAuiiEV4N0qj8/cMWGBBCsjw= pgregory.net/rapid v1.1.0/go.mod h1:PY5XlDGj0+V1FCq0o192FdRhpKHGTRIWBgqjDBTrq04= diff --git a/proto/buf.yaml b/proto/buf.yaml index 39d957d6bd..9e06a6903f 100644 --- a/proto/buf.yaml +++ b/proto/buf.yaml @@ -1,7 +1,7 @@ version: v1 name: buf.build/cosmwasm/wasmd deps: - - buf.build/cosmos/cosmos-sdk:v0.50.0 + - buf.build/cosmos/cosmos-sdk:v0.50.10 - buf.build/cosmos/cosmos-proto:1935555c206d4afb9e94615dfd0fad31 - buf.build/cosmos/gogo-proto:a14993478f40695898ed8a86931094b6656e8a5d - buf.build/googleapis/googleapis:8d7204855ec14631a499bd7393ce1970 diff --git a/tests/e2e/grants_test.go b/tests/e2e/grants_test.go index 12b7e9e165..d77741c9ba 100644 --- a/tests/e2e/grants_test.go +++ b/tests/e2e/grants_test.go @@ -181,7 +181,7 @@ func TestStoreCodeGrant(t *testing.T) { for name, spec := range specs { t.Run(name, func(t *testing.T) { // setup grant - grant, err := types.NewCodeGrant(spec.codeHash, &spec.instantiatePermission) //nolint:gosec + grant, err := types.NewCodeGrant(spec.codeHash, &spec.instantiatePermission) require.NoError(t, err) authorization := types.NewStoreCodeAuthorization(*grant) expiry := time.Now().Add(time.Hour) @@ -269,7 +269,7 @@ func TestGzipStoreCodeGrant(t *testing.T) { for name, spec := range specs { t.Run(name, func(t *testing.T) { // setup grant - grant, err := types.NewCodeGrant(spec.codeHash, &spec.instantiatePermission) //nolint:gosec + grant, err := types.NewCodeGrant(spec.codeHash, &spec.instantiatePermission) require.NoError(t, err) authorization := types.NewStoreCodeAuthorization(*grant) expiry := time.Now().Add(time.Hour) diff --git a/tests/e2e/ibc_callbacks_test.go b/tests/e2e/ibc_callbacks_test.go index f0ec27b4ee..8d415b069e 100644 --- a/tests/e2e/ibc_callbacks_test.go +++ b/tests/e2e/ibc_callbacks_test.go @@ -7,10 +7,10 @@ import ( "time" wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" - ibcfee "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/types" - ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" - channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" - ibctesting "github.com/cosmos/ibc-go/v8/testing" + ibcfee "github.com/cosmos/ibc-go/v9/modules/apps/29-fee/types" + ibctransfertypes "github.com/cosmos/ibc-go/v9/modules/apps/transfer/types" + channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" + ibctesting "github.com/cosmos/ibc-go/v9/testing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -43,12 +43,12 @@ func TestIBCCallbacks(t *testing.T) { path := wasmibctesting.NewPath(chainA, chainB) path.EndpointA.ChannelConfig = &ibctesting.ChannelConfig{ PortID: ibctransfertypes.PortID, - Version: string(marshaler.MustMarshalJSON(&ibcfee.Metadata{FeeVersion: ibcfee.Version, AppVersion: ibctransfertypes.Version})), + Version: string(marshaler.MustMarshalJSON(&ibcfee.Metadata{FeeVersion: ibcfee.Version, AppVersion: "ics20-1"})), Order: channeltypes.UNORDERED, } path.EndpointB.ChannelConfig = &ibctesting.ChannelConfig{ PortID: ibctransfertypes.PortID, - Version: string(marshaler.MustMarshalJSON(&ibcfee.Metadata{FeeVersion: ibcfee.Version, AppVersion: ibctransfertypes.Version})), + Version: string(marshaler.MustMarshalJSON(&ibcfee.Metadata{FeeVersion: ibcfee.Version, AppVersion: "ics20-1"})), Order: channeltypes.UNORDERED, } // with an ics-20 transfer channel setup between both chains @@ -132,7 +132,7 @@ func TestIBCCallbacks(t *testing.T) { // then the contract on chain B should receive a receive callback var response QueryResp - chainB.SmartQuery(contractAddrB.String(), QueryMsg{CallbackStats: struct{}{}}, &response) + require.NoError(t, chainB.SmartQuery(contractAddrB.String(), QueryMsg{CallbackStats: struct{}{}}, &response)) assert.Empty(t, response.IBCAckCallbacks) assert.Empty(t, response.IBCTimeoutCallbacks) assert.Len(t, response.IBCDestinationCallbacks, 1) @@ -141,7 +141,8 @@ func TestIBCCallbacks(t *testing.T) { assert.Equal(t, []byte("{\"result\":\"AQ==\"}"), response.IBCDestinationCallbacks[0].Ack.Data) // and the contract on chain A should receive a callback with the ack - chainA.SmartQuery(contractAddrA.String(), QueryMsg{CallbackStats: struct{}{}}, &response) + err := chainA.SmartQuery(contractAddrA.String(), QueryMsg{CallbackStats: struct{}{}}, &response) + require.NoError(t, err) assert.Len(t, response.IBCAckCallbacks, 1) assert.Empty(t, response.IBCTimeoutCallbacks) assert.Empty(t, response.IBCDestinationCallbacks) @@ -154,13 +155,14 @@ func TestIBCCallbacks(t *testing.T) { // then the contract on chain B should not receive anything var response QueryResp - chainB.SmartQuery(contractAddrB.String(), QueryMsg{CallbackStats: struct{}{}}, &response) + require.NoError(t, chainB.SmartQuery(contractAddrB.String(), QueryMsg{CallbackStats: struct{}{}}, &response)) assert.Empty(t, response.IBCAckCallbacks) assert.Empty(t, response.IBCTimeoutCallbacks) assert.Empty(t, response.IBCDestinationCallbacks) // and the contract on chain A should receive a callback with the timeout result - chainA.SmartQuery(contractAddrA.String(), QueryMsg{CallbackStats: struct{}{}}, &response) + err := chainA.SmartQuery(contractAddrA.String(), QueryMsg{CallbackStats: struct{}{}}, &response) + require.NoError(t, err) assert.Empty(t, response.IBCAckCallbacks) assert.Len(t, response.IBCTimeoutCallbacks, 1) assert.Empty(t, response.IBCDestinationCallbacks) @@ -187,12 +189,12 @@ func TestIBCCallbacksWithoutEntrypoints(t *testing.T) { path := wasmibctesting.NewPath(chainA, chainB) path.EndpointA.ChannelConfig = &ibctesting.ChannelConfig{ PortID: ibctransfertypes.PortID, - Version: string(marshaler.MustMarshalJSON(&ibcfee.Metadata{FeeVersion: ibcfee.Version, AppVersion: ibctransfertypes.Version})), + Version: string(marshaler.MustMarshalJSON(&ibcfee.Metadata{FeeVersion: ibcfee.Version, AppVersion: "ics20-1"})), Order: channeltypes.UNORDERED, } path.EndpointB.ChannelConfig = &ibctesting.ChannelConfig{ PortID: ibctransfertypes.PortID, - Version: string(marshaler.MustMarshalJSON(&ibcfee.Metadata{FeeVersion: ibcfee.Version, AppVersion: ibctransfertypes.Version})), + Version: string(marshaler.MustMarshalJSON(&ibcfee.Metadata{FeeVersion: ibcfee.Version, AppVersion: "ics20-1"})), Order: channeltypes.UNORDERED, } // with an ics-20 transfer channel setup between both chains diff --git a/tests/e2e/ibc_fees_test.go b/tests/e2e/ibc_fees_test.go index cb867039f3..49d3d9d168 100644 --- a/tests/e2e/ibc_fees_test.go +++ b/tests/e2e/ibc_fees_test.go @@ -2,17 +2,19 @@ package e2e import ( "bytes" + "crypto/sha256" "encoding/base64" + "encoding/hex" "fmt" "testing" "time" wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" - ibcfee "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/types" - ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" - clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" //nolint:staticcheck - channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" - ibctesting "github.com/cosmos/ibc-go/v8/testing" + ibcfee "github.com/cosmos/ibc-go/v9/modules/apps/29-fee/types" + transfertypes "github.com/cosmos/ibc-go/v9/modules/apps/transfer/types" + clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" + channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" + ibctesting "github.com/cosmos/ibc-go/v9/testing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -26,6 +28,40 @@ import ( wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" ) +const ( + testTimeout = time.Minute + receiverAddressByte = byte(1) + payeeAddressByte = byte(2) +) + +func createTestAddress(b byte) sdk.AccAddress { + return sdk.AccAddress(bytes.Repeat([]byte{b}, address.Len)) +} + +func setupIBCFees(t *testing.T, chainA, chainB *wasmibctesting.TestChain, path *wasmibctesting.Path, portID string) sdk.AccAddress { + payee := createTestAddress(payeeAddressByte) + actorChainA := sdk.AccAddress(chainA.SenderPrivKey.PubKey().Address()) + actorChainB := sdk.AccAddress(chainB.SenderPrivKey.PubKey().Address()) + + _, err := chainA.SendMsgs(ibcfee.NewMsgRegisterPayee( + portID, + path.EndpointA.ChannelID, + actorChainA.String(), + payee.String(), + )) + require.NoError(t, err) + + _, err = chainB.SendMsgs(ibcfee.NewMsgRegisterCounterpartyPayee( + transfertypes.PortID, + path.EndpointB.ChannelID, + actorChainB.String(), + payee.String(), + )) + require.NoError(t, err) + + return payee +} + func TestIBCFeesTransfer(t *testing.T) { // scenario: // given 2 chains @@ -39,72 +75,172 @@ func TestIBCFeesTransfer(t *testing.T) { actorChainA := sdk.AccAddress(chainA.SenderPrivKey.PubKey().Address()) actorChainB := sdk.AccAddress(chainB.SenderPrivKey.PubKey().Address()) - receiver := sdk.AccAddress(bytes.Repeat([]byte{1}, address.Len)) - payee := sdk.AccAddress(bytes.Repeat([]byte{2}, address.Len)) - oneToken := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.NewInt(1))) + receiver := createTestAddress(receiverAddressByte) + // Create path before using it path := wasmibctesting.NewPath(chainA, chainB) + payee := setupIBCFees(t, chainA, chainB, path, transfertypes.PortID) + oneToken := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.NewInt(1))) + path.EndpointA.ChannelConfig = &ibctesting.ChannelConfig{ - PortID: ibctransfertypes.PortID, - Version: string(marshaler.MustMarshalJSON(&ibcfee.Metadata{FeeVersion: ibcfee.Version, AppVersion: ibctransfertypes.Version})), - Order: channeltypes.UNORDERED, + PortID: transfertypes.PortID, + Version: string(marshaler.MustMarshalJSON(&ibcfee.Metadata{ + FeeVersion: ibcfee.Version, + AppVersion: "ics20-1", + })), + Order: channeltypes.UNORDERED, } path.EndpointB.ChannelConfig = &ibctesting.ChannelConfig{ - PortID: ibctransfertypes.PortID, - Version: string(marshaler.MustMarshalJSON(&ibcfee.Metadata{FeeVersion: ibcfee.Version, AppVersion: ibctransfertypes.Version})), - Order: channeltypes.UNORDERED, + PortID: transfertypes.PortID, + Version: string(marshaler.MustMarshalJSON(&ibcfee.Metadata{ + FeeVersion: ibcfee.Version, + AppVersion: "ics20-1", + })), + Order: channeltypes.UNORDERED, } // with an ics-20 transfer channel setup between both chains coord.Setup(path) appA := chainA.App.(*app.WasmApp) - require.True(t, appA.IBCFeeKeeper.IsFeeEnabled(chainA.GetContext(), ibctransfertypes.PortID, path.EndpointA.ChannelID)) + require.True(t, appA.IBCFeeKeeper.IsFeeEnabled( + chainA.GetContext(), + transfertypes.PortID, + path.EndpointA.ChannelID, + )) // and with a payee registered on both chains - _, err := chainA.SendMsgs(ibcfee.NewMsgRegisterPayee(ibctransfertypes.PortID, path.EndpointA.ChannelID, actorChainA.String(), payee.String())) + _, err := chainA.SendMsgs( + ibcfee.NewMsgRegisterPayee( + transfertypes.PortID, + path.EndpointA.ChannelID, + actorChainA.String(), + payee.String(), + ), + ) require.NoError(t, err) - _, err = chainB.SendMsgs(ibcfee.NewMsgRegisterCounterpartyPayee(ibctransfertypes.PortID, path.EndpointB.ChannelID, actorChainB.String(), payee.String())) + _, err = chainB.SendMsgs( + ibcfee.NewMsgRegisterCounterpartyPayee( + transfertypes.PortID, + path.EndpointB.ChannelID, + actorChainB.String(), + payee.String(), + ), + ) require.NoError(t, err) // when a transfer package is sent transferCoin := sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.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()), "testing") + ibcPayloadMsg := transfertypes.NewMsgTransfer( + path.EndpointA.ChannelConfig.PortID, + path.EndpointA.ChannelID, + sdk.NewCoins(transferCoin), + actorChainA.String(), + receiver.String(), + clienttypes.Height{}, + uint64(time.Now().Add(time.Minute).UnixNano()), + "testing", + nil, + ) ibcPackageFee := ibcfee.NewFee(oneToken, oneToken, sdk.Coins{}) - feeMsg := ibcfee.NewMsgPayPacketFee(ibcPackageFee, ibctransfertypes.PortID, path.EndpointA.ChannelID, actorChainA.String(), nil) + feeMsg := ibcfee.NewMsgPayPacketFee( + ibcPackageFee, + transfertypes.PortID, + path.EndpointA.ChannelID, + actorChainA.String(), + nil, + ) _, err = chainA.SendMsgs(feeMsg, ibcPayloadMsg) require.NoError(t, err) - pendingIncentivisedPackages := appA.IBCFeeKeeper.GetIdentifiedPacketFeesForChannel(chainA.GetContext(), ibctransfertypes.PortID, path.EndpointA.ChannelID) + pendingIncentivisedPackages := appA.IBCFeeKeeper.GetIdentifiedPacketFeesForChannel( + chainA.GetContext(), + transfertypes.PortID, + path.EndpointA.ChannelID, + ) assert.Len(t, pendingIncentivisedPackages, 1) // and packages relayed require.NoError(t, coord.RelayAndAckPendingPackets(path)) // then - expBalance := ibctransfertypes.GetTransferCoin(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, transferCoin.Denom, transferCoin.Amount) + expBalance := sdk.NewCoin( + fmt.Sprintf("ibc/%s", hex.EncodeToString(func() []byte { + hash := sha256.Sum256([]byte(fmt.Sprintf("%s/%s/%s", + path.EndpointB.ChannelConfig.PortID, + path.EndpointB.ChannelID, + transferCoin.Denom, + ))) + return hash[:] + }())), + transferCoin.Amount, + ) gotBalance := chainB.Balance(receiver, expBalance.Denom) assert.Equal(t, expBalance.String(), gotBalance.String()) payeeBalance := chainA.AllBalances(payee) assert.Equal(t, oneToken.Add(oneToken...).String(), payeeBalance.String()) // and with a payee registered for chain B to A - _, err = chainA.SendMsgs(ibcfee.NewMsgRegisterCounterpartyPayee(ibctransfertypes.PortID, path.EndpointA.ChannelID, actorChainA.String(), payee.String())) + _, err = chainA.SendMsgs( + ibcfee.NewMsgRegisterCounterpartyPayee( + transfertypes.PortID, + path.EndpointA.ChannelID, + actorChainA.String(), + payee.String(), + ), + ) require.NoError(t, err) - _, err = chainB.SendMsgs(ibcfee.NewMsgRegisterPayee(ibctransfertypes.PortID, path.EndpointB.ChannelID, actorChainB.String(), payee.String())) + _, err = chainB.SendMsgs( + ibcfee.NewMsgRegisterPayee( + transfertypes.PortID, + path.EndpointB.ChannelID, + actorChainB.String(), + payee.String(), + ), + ) 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()), "more testing") + ibcPayloadMsg = transfertypes.NewMsgTransfer( + path.EndpointB.ChannelConfig.PortID, + path.EndpointB.ChannelID, + sdk.NewCoins(transferCoin), + actorChainB.String(), + receiver.String(), + clienttypes.Height{}, + uint64(time.Now().Add(time.Minute).UnixNano()), + "more testing", + nil, + ) ibcPackageFee = ibcfee.NewFee(oneToken, oneToken, sdk.Coins{}) - feeMsg = ibcfee.NewMsgPayPacketFee(ibcPackageFee, ibctransfertypes.PortID, path.EndpointB.ChannelID, actorChainB.String(), nil) + feeMsg = ibcfee.NewMsgPayPacketFee( + ibcPackageFee, + transfertypes.PortID, + path.EndpointB.ChannelID, + actorChainB.String(), + nil, + ) _, err = chainB.SendMsgs(feeMsg, ibcPayloadMsg) require.NoError(t, err) appB := chainB.App.(*app.WasmApp) - pendingIncentivisedPackages = appB.IBCFeeKeeper.GetIdentifiedPacketFeesForChannel(chainB.GetContext(), ibctransfertypes.PortID, path.EndpointB.ChannelID) + pendingIncentivisedPackages = appB.IBCFeeKeeper.GetIdentifiedPacketFeesForChannel( + chainB.GetContext(), + transfertypes.PortID, + path.EndpointB.ChannelID, + ) assert.Len(t, pendingIncentivisedPackages, 1) // when packages relayed require.NoError(t, coord.RelayAndAckPendingPackets(path)) // then - expBalance = ibctransfertypes.GetTransferCoin(path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, transferCoin.Denom, transferCoin.Amount) + expBalance = sdk.NewCoin( + fmt.Sprintf("ibc/%s", hex.EncodeToString(func() []byte { + hash := sha256.Sum256([]byte(fmt.Sprintf("%s/%s/%s", + path.EndpointA.ChannelConfig.PortID, + path.EndpointA.ChannelID, + transferCoin.Denom, + ))) + return hash[:] + }())), + transferCoin.Amount, + ) gotBalance = chainA.Balance(receiver, expBalance.Denom) assert.Equal(t, expBalance.String(), gotBalance.String()) payeeBalance = chainB.AllBalances(payee) @@ -135,30 +271,31 @@ func TestIBCFeesWasm(t *testing.T) { ibcContractAddr := chainA.InstantiateContract(codeID, initMsg) ibcContractPortID := chainA.ContractInfo(ibcContractAddr).IBCPortID - payee := sdk.AccAddress(bytes.Repeat([]byte{2}, address.Len)) - oneToken := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.NewInt(1))) - path := wasmibctesting.NewPath(chainA, chainB) path.EndpointA.ChannelConfig = &ibctesting.ChannelConfig{ PortID: ibcContractPortID, - Version: string(marshaler.MustMarshalJSON(&ibcfee.Metadata{FeeVersion: ibcfee.Version, AppVersion: ibctransfertypes.Version})), + Version: string(marshaler.MustMarshalJSON(&ibcfee.Metadata{FeeVersion: ibcfee.Version, AppVersion: "ics20-1"})), Order: channeltypes.UNORDERED, } path.EndpointB.ChannelConfig = &ibctesting.ChannelConfig{ - PortID: ibctransfertypes.PortID, - Version: string(marshaler.MustMarshalJSON(&ibcfee.Metadata{FeeVersion: ibcfee.Version, AppVersion: ibctransfertypes.Version})), + PortID: transfertypes.PortID, + Version: string(marshaler.MustMarshalJSON(&ibcfee.Metadata{FeeVersion: ibcfee.Version, AppVersion: "ics20-1"})), Order: channeltypes.UNORDERED, } + + payee := setupIBCFees(t, chainA, chainB, path, ibcContractPortID) + oneToken := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.NewInt(1))) + // with an ics-29 fee enabled channel setup between both chains coord.Setup(path) appA := chainA.App.(*app.WasmApp) appB := chainB.App.(*app.WasmApp) require.True(t, appA.IBCFeeKeeper.IsFeeEnabled(chainA.GetContext(), ibcContractPortID, path.EndpointA.ChannelID)) - require.True(t, appB.IBCFeeKeeper.IsFeeEnabled(chainB.GetContext(), ibctransfertypes.PortID, path.EndpointB.ChannelID)) + require.True(t, appB.IBCFeeKeeper.IsFeeEnabled(chainB.GetContext(), transfertypes.PortID, path.EndpointB.ChannelID)) // and with a payee registered for A -> B _, err := chainA.SendMsgs(ibcfee.NewMsgRegisterPayee(ibcContractPortID, path.EndpointA.ChannelID, actorChainA.String(), payee.String())) require.NoError(t, err) - _, err = chainB.SendMsgs(ibcfee.NewMsgRegisterCounterpartyPayee(ibctransfertypes.PortID, path.EndpointB.ChannelID, actorChainB.String(), payee.String())) + _, err = chainB.SendMsgs(ibcfee.NewMsgRegisterCounterpartyPayee(transfertypes.PortID, path.EndpointB.ChannelID, actorChainB.String(), payee.String())) require.NoError(t, err) // when a transfer package is sent from ics20 contract on A to B @@ -189,23 +326,33 @@ func TestIBCFeesWasm(t *testing.T) { // and on chain B pendingIncentivisedPackages = appA.IBCFeeKeeper.GetIdentifiedPacketFeesForChannel(chainA.GetContext(), ibcContractPortID, path.EndpointA.ChannelID) assert.Len(t, pendingIncentivisedPackages, 0) - expBalance := ibctransfertypes.GetTransferCoin(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, "cw20:"+cw20ContractAddr.String(), sdkmath.NewInt(100)) + expBalance := sdk.NewCoin( + fmt.Sprintf("ibc/%s", hex.EncodeToString(func() []byte { + hash := sha256.Sum256([]byte(fmt.Sprintf("%s/%s/%s", + path.EndpointB.ChannelConfig.PortID, + path.EndpointB.ChannelID, + "cw20:"+cw20ContractAddr.String(), + ))) + return hash[:] + }())), + sdkmath.NewInt(100), + ) gotBalance := chainB.Balance(actorChainB, expBalance.Denom) assert.Equal(t, expBalance.String(), gotBalance.String(), chainB.AllBalances(actorChainB)) // and with a payee registered for chain B to A _, err = chainA.SendMsgs(ibcfee.NewMsgRegisterCounterpartyPayee(ibcContractPortID, path.EndpointA.ChannelID, actorChainA.String(), payee.String())) require.NoError(t, err) - _, err = chainB.SendMsgs(ibcfee.NewMsgRegisterPayee(ibctransfertypes.PortID, path.EndpointB.ChannelID, actorChainB.String(), payee.String())) + _, err = chainB.SendMsgs(ibcfee.NewMsgRegisterPayee(transfertypes.PortID, path.EndpointB.ChannelID, actorChainB.String(), payee.String())) 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()), "even more tests") + ibcPayloadMsg := transfertypes.NewMsgTransfer(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, sdk.NewCoins(gotBalance), actorChainB.String(), actorChainA.String(), clienttypes.Height{}, uint64(time.Now().Add(time.Minute).UnixNano()), "even more tests", nil) ibcPackageFee = ibcfee.NewFee(oneToken, oneToken, sdk.Coins{}) - feeMsg = ibcfee.NewMsgPayPacketFee(ibcPackageFee, ibctransfertypes.PortID, path.EndpointB.ChannelID, actorChainB.String(), nil) + feeMsg = ibcfee.NewMsgPayPacketFee(ibcPackageFee, transfertypes.PortID, path.EndpointB.ChannelID, actorChainB.String(), nil) _, err = chainB.SendMsgs(feeMsg, ibcPayloadMsg) require.NoError(t, err) - pendingIncentivisedPackages = appB.IBCFeeKeeper.GetIdentifiedPacketFeesForChannel(chainB.GetContext(), ibctransfertypes.PortID, path.EndpointB.ChannelID) + pendingIncentivisedPackages = appB.IBCFeeKeeper.GetIdentifiedPacketFeesForChannel(chainB.GetContext(), transfertypes.PortID, path.EndpointB.ChannelID) assert.Len(t, pendingIncentivisedPackages, 1) // when packages relayed @@ -246,25 +393,25 @@ func TestIBCFeesReflect(t *testing.T) { path := wasmibctesting.NewPath(chainA, chainB) path.EndpointA.ChannelConfig = &ibctesting.ChannelConfig{ - PortID: ibctransfertypes.PortID, - Version: string(marshaler.MustMarshalJSON(&ibcfee.Metadata{FeeVersion: ibcfee.Version, AppVersion: ibctransfertypes.Version})), + PortID: transfertypes.PortID, + Version: string(marshaler.MustMarshalJSON(&ibcfee.Metadata{FeeVersion: ibcfee.Version, AppVersion: "ics20-1"})), Order: channeltypes.UNORDERED, } path.EndpointB.ChannelConfig = &ibctesting.ChannelConfig{ - PortID: ibctransfertypes.PortID, - Version: string(marshaler.MustMarshalJSON(&ibcfee.Metadata{FeeVersion: ibcfee.Version, AppVersion: ibctransfertypes.Version})), + PortID: transfertypes.PortID, + Version: string(marshaler.MustMarshalJSON(&ibcfee.Metadata{FeeVersion: ibcfee.Version, AppVersion: "ics20-1"})), Order: channeltypes.UNORDERED, } // with an ics-29 fee enabled channel setup between both chains coord.Setup(path) appA := chainA.App.(*app.WasmApp) appB := chainB.App.(*app.WasmApp) - require.True(t, appA.IBCFeeKeeper.IsFeeEnabled(chainA.GetContext(), ibctransfertypes.PortID, path.EndpointA.ChannelID)) - require.True(t, appB.IBCFeeKeeper.IsFeeEnabled(chainB.GetContext(), ibctransfertypes.PortID, path.EndpointB.ChannelID)) + require.True(t, appA.IBCFeeKeeper.IsFeeEnabled(chainA.GetContext(), transfertypes.PortID, path.EndpointA.ChannelID)) + require.True(t, appB.IBCFeeKeeper.IsFeeEnabled(chainB.GetContext(), transfertypes.PortID, path.EndpointB.ChannelID)) // and with a payee registered for A -> B - _, err := chainA.SendMsgs(ibcfee.NewMsgRegisterPayee(ibctransfertypes.PortID, path.EndpointA.ChannelID, actorChainA.String(), payee.String())) + _, err := chainA.SendMsgs(ibcfee.NewMsgRegisterPayee(transfertypes.PortID, path.EndpointA.ChannelID, actorChainA.String(), payee.String())) require.NoError(t, err) - _, err = chainB.SendMsgs(ibcfee.NewMsgRegisterCounterpartyPayee(ibctransfertypes.PortID, path.EndpointB.ChannelID, actorChainB.String(), payee.String())) + _, err = chainB.SendMsgs(ibcfee.NewMsgRegisterCounterpartyPayee(transfertypes.PortID, path.EndpointB.ChannelID, actorChainB.String(), payee.String())) require.NoError(t, err) // when reflect contract on A sends a PayPacketFee msg, followed by a transfer @@ -278,7 +425,7 @@ func TestIBCFeesReflect(t *testing.T) { TimeoutFee: []wasmvmtypes.Coin{}, }, Relayers: []string{}, - PortID: ibctransfertypes.PortID, + PortID: transfertypes.PortID, ChannelID: path.EndpointA.ChannelID, }, }, @@ -298,7 +445,7 @@ func TestIBCFeesReflect(t *testing.T) { }) require.NoError(t, err) - pendingIncentivisedPackages := appA.IBCFeeKeeper.GetIdentifiedPacketFeesForChannel(chainA.GetContext(), ibctransfertypes.PortID, path.EndpointA.ChannelID) + pendingIncentivisedPackages := appA.IBCFeeKeeper.GetIdentifiedPacketFeesForChannel(chainA.GetContext(), transfertypes.PortID, path.EndpointA.ChannelID) assert.Len(t, pendingIncentivisedPackages, 1) // and sends an PayPacketFeeAsync msg @@ -313,7 +460,7 @@ func TestIBCFeesReflect(t *testing.T) { }, Relayers: []string{}, Sequence: pendingIncentivisedPackages[0].PacketId.Sequence, - PortID: ibctransfertypes.PortID, + PortID: transfertypes.PortID, ChannelID: path.EndpointA.ChannelID, }, }, @@ -330,9 +477,19 @@ func TestIBCFeesReflect(t *testing.T) { // 2 tokens from the PayPacketFee and 1 token from the PayPacketFeeAsync assert.Equal(t, sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.NewInt(3)).String(), payeeBalance.String()) // and on chain B - pendingIncentivisedPackages = appA.IBCFeeKeeper.GetIdentifiedPacketFeesForChannel(chainA.GetContext(), ibctransfertypes.PortID, path.EndpointA.ChannelID) + pendingIncentivisedPackages = appA.IBCFeeKeeper.GetIdentifiedPacketFeesForChannel(chainA.GetContext(), transfertypes.PortID, path.EndpointA.ChannelID) assert.Len(t, pendingIncentivisedPackages, 0) - expBalance := ibctransfertypes.GetTransferCoin(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, sdk.DefaultBondDenom, sdkmath.NewInt(10)) + expBalance := sdk.NewCoin( + fmt.Sprintf("ibc/%s", hex.EncodeToString(func() []byte { + h := sha256.Sum256([]byte(fmt.Sprintf("%s/%s/%s", + path.EndpointB.ChannelConfig.PortID, + path.EndpointB.ChannelID, + sdk.DefaultBondDenom, + ))) + return h[:] + }())), + sdkmath.NewInt(10), + ) gotBalance := chainB.Balance(actorChainB, expBalance.Denom) assert.Equal(t, expBalance.String(), gotBalance.String(), chainB.AllBalances(actorChainB)) } diff --git a/tests/e2e/ica_test.go b/tests/e2e/ica_test.go index b4cf4037f5..a125ce13a6 100644 --- a/tests/e2e/ica_test.go +++ b/tests/e2e/ica_test.go @@ -7,11 +7,11 @@ import ( abci "github.com/cometbft/cometbft/abci/types" "github.com/cometbft/cometbft/libs/rand" "github.com/cosmos/gogoproto/proto" - icacontrollertypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/types" - hosttypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host/types" - icatypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types" - channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" - ibctesting "github.com/cosmos/ibc-go/v8/testing" + icacontrollertypes "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/controller/types" + hosttypes "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/host/types" + icatypes "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/types" + channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" + ibctesting "github.com/cosmos/ibc-go/v9/testing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -69,7 +69,12 @@ func TestICA(t *testing.T) { icaControllerAddr := sdk.AccAddress(icaControllerKey.PubKey().Address().Bytes()) controllerChain.Fund(icaControllerAddr, sdkmath.NewInt(1_000)) - msg := icacontrollertypes.NewMsgRegisterInterchainAccount(path.EndpointA.ConnectionID, icaControllerAddr.String(), spec.icaVersion) + msg := icacontrollertypes.NewMsgRegisterInterchainAccount( + path.EndpointA.ConnectionID, + icaControllerAddr.String(), + spec.icaVersion, + channeltypes.ORDERED, + ) res, err := controllerChain.SendNonDefaultSenderMsgs(icaControllerKey, msg) require.NoError(t, err) chanID, portID, version := parseIBCChannelEvents(t, res) diff --git a/tests/ibctesting/chain.go b/tests/ibctesting/chain.go index 1f9aee077b..96a9db394c 100644 --- a/tests/ibctesting/chain.go +++ b/tests/ibctesting/chain.go @@ -15,15 +15,14 @@ import ( tmversion "github.com/cometbft/cometbft/version" capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" - clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" - channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" - commitmenttypes "github.com/cosmos/ibc-go/v8/modules/core/23-commitment/types" - host "github.com/cosmos/ibc-go/v8/modules/core/24-host" - "github.com/cosmos/ibc-go/v8/modules/core/exported" - ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper" - "github.com/cosmos/ibc-go/v8/modules/core/types" - ibctm "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" - ibctesting "github.com/cosmos/ibc-go/v8/testing" + clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" + channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" + commitmenttypes "github.com/cosmos/ibc-go/v9/modules/core/23-commitment/types" + host "github.com/cosmos/ibc-go/v9/modules/core/24-host" + "github.com/cosmos/ibc-go/v9/modules/core/exported" + ibckeeper "github.com/cosmos/ibc-go/v9/modules/core/keeper" + ibctm "github.com/cosmos/ibc-go/v9/modules/light-clients/07-tendermint" + ibctesting "github.com/cosmos/ibc-go/v9/testing" "github.com/stretchr/testify/require" errorsmod "cosmossdk.io/errors" @@ -89,7 +88,7 @@ type TestChain struct { ChainID string LastHeader *ibctm.Header // header for last block height committed CurrentHeader cmtproto.Header // header for current block height - QueryServer types.QueryServer + QueryServer *ibckeeper.Keeper TxConfig client.TxConfig Codec codec.Codec @@ -309,7 +308,7 @@ func (chain *TestChain) QueryUpgradeProof(key []byte, height uint64) ([]byte, cl func (chain *TestChain) QueryConsensusStateProof(clientID string) ([]byte, clienttypes.Height) { clientState := chain.GetClientState(clientID) - consensusHeight := clientState.GetLatestHeight().(clienttypes.Height) + consensusHeight := chain.GetLatestHeight(clientState) consensusKey := host.FullConsensusStateKey(clientID, consensusHeight) proofConsensus, _ := chain.QueryProof(consensusKey) @@ -497,7 +496,7 @@ func (chain *TestChain) ConstructUpdateCMTClientHeaderWithTrustedHeight(counterp header := counterparty.LastHeader // Relayer must query for LatestHeight on client to get TrustedHeight if the trusted height is not set if trustedHeight.IsZero() { - trustedHeight = chain.GetClientState(clientID).GetLatestHeight().(clienttypes.Height) + trustedHeight = chain.GetLatestHeight(chain.GetClientState(clientID)) } var ( cmtTrustedVals *cmttypes.ValidatorSet @@ -698,3 +697,77 @@ func (chain *TestChain) Balance(acc sdk.AccAddress, denom string) sdk.Coin { func (chain *TestChain) AllBalances(acc sdk.AccAddress) sdk.Coins { return chain.App.GetBankKeeper().GetAllBalances(chain.GetContext(), acc) } + +// Add this helper method to TestChain +func (chain *TestChain) GetLatestHeight(clientState exported.ClientState) clienttypes.Height { + tmClientState, ok := clientState.(*ibctm.ClientState) + if !ok { + panic("invalid client state type") + } + return tmClientState.LatestHeight +} + +// Add helper method to Chain +func (chain *TestChain) GetClientLatestHeight(clientState exported.ClientState) clienttypes.Height { + tmClientState, ok := clientState.(*ibctm.ClientState) + if !ok { + panic("invalid client state type") + } + return tmClientState.LatestHeight +} + +func (chain *TestChain) VerifyIBCModules() error { + // First verify IBC keeper is initialized + if chain.App.GetIBCKeeper() == nil { + return fmt.Errorf("IBCKeeper is nil") + } + + // Verify ClientKeeper is initialized + if chain.App.GetIBCKeeper().ClientKeeper == nil { + return fmt.Errorf("ClientKeeper is nil") + } + + // Initialize proper configurations with debug logging + chain.t.Logf("Initializing IBC module verification for chain %s", chain.ChainID) + + clientConfig := ibctesting.NewTendermintConfig() + chain.t.Logf("Created Tendermint config: %+v", clientConfig) + + // Create endpoints with more detailed error handling + endpoint := NewEndpoint(chain, clientConfig, &ibctesting.ConnectionConfig{ + DelayPeriod: 0, + }, &ibctesting.ChannelConfig{ + PortID: ibctesting.TransferPort, + Version: "ics20-1", + Order: channeltypes.UNORDERED, + }) + + if endpoint == nil { + return fmt.Errorf("failed to create endpoint") + } + + // Create a mock counterparty endpoint + counterparty := NewEndpoint(chain, clientConfig, &ibctesting.ConnectionConfig{ + DelayPeriod: 0, + }, &ibctesting.ChannelConfig{ + PortID: ibctesting.TransferPort, + Version: "ics20-1", + Order: channeltypes.UNORDERED, + }) + + if counterparty == nil { + return fmt.Errorf("failed to create counterparty endpoint") + } + + // Set up the counterparty relationship + endpoint.Counterparty = counterparty + counterparty.Counterparty = endpoint + + // Try to create client with detailed error capture + if err := endpoint.CreateClient(); err != nil { + // Add more context to the error + return fmt.Errorf("failed to create Tendermint client: %v", err) + } + + return nil +} diff --git a/tests/ibctesting/coordinator.go b/tests/ibctesting/coordinator.go index d87fd7a5d1..b11a5b976f 100644 --- a/tests/ibctesting/coordinator.go +++ b/tests/ibctesting/coordinator.go @@ -5,9 +5,9 @@ import ( "testing" "time" - channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" - host "github.com/cosmos/ibc-go/v8/modules/core/24-host" - ibctesting "github.com/cosmos/ibc-go/v8/testing" + channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" + host "github.com/cosmos/ibc-go/v9/modules/core/24-host" + ibctesting "github.com/cosmos/ibc-go/v9/testing" "github.com/stretchr/testify/require" wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" @@ -30,7 +30,40 @@ type Coordinator struct { // NewCoordinator initializes Coordinator with n default wasm TestChain instances func NewCoordinator(t *testing.T, n int, opts ...[]wasmkeeper.Option) *Coordinator { t.Helper() - return NewCoordinatorX(t, n, DefaultWasmAppFactory, opts...) + chains := make(map[string]*TestChain) + coord := &Coordinator{ + t: t, + CurrentTime: globalStartTime, + Chains: chains, + } + + for i := 1; i <= n; i++ { + chainID := GetChainID(i) + var chainOpts []wasmkeeper.Option + if len(opts) > (i - 1) { + chainOpts = opts[i-1] + } + chain := NewTestChain(t, coord, DefaultWasmAppFactory, chainID, chainOpts...) + + // Verify chain is properly initialized + if chain.App == nil { + t.Fatalf("failed to initialize chain %s: App is nil", chainID) + } + if chain.App.GetIBCKeeper() == nil { + t.Fatalf("failed to initialize chain %s: IBC Keeper is nil", chainID) + } + + chains[chainID] = chain + } + + // Initialize each chain's clients, connections, and channels + for _, chain := range chains { + if err := chain.VerifyIBCModules(); err != nil { + t.Fatalf("failed to verify IBC modules for chain %s: %v", chain.ChainID, err) + } + } + + return coord } // NewCoordinatorX initializes Coordinator with N TestChain instances using the given app factory @@ -42,13 +75,25 @@ func NewCoordinatorX(t *testing.T, n int, appFactory ChainAppFactory, opts ...[] CurrentTime: globalStartTime, } + // Add debug logging + t.Logf("Initializing %d chains with app factory", n) + for i := 1; i <= n; i++ { chainID := GetChainID(i) - var x []wasmkeeper.Option + var chainOpts []wasmkeeper.Option if len(opts) > (i - 1) { - x = opts[i-1] + chainOpts = opts[i-1] + } + + // Add debug logging + t.Logf("Creating chain %s", chainID) + + chain := NewTestChain(t, coord, appFactory, chainID, chainOpts...) + // Add verification that IBC modules are properly initialized + if err := chain.VerifyIBCModules(); err != nil { + t.Fatalf("Chain %s IBC modules not properly initialized: %v", chainID, err) } - chains[chainID] = NewTestChain(t, coord, appFactory, chainID, x...) + chains[chainID] = chain } coord.Chains = chains diff --git a/tests/ibctesting/endpoint.go b/tests/ibctesting/endpoint.go index ec6a5d6ca5..517081b9d3 100644 --- a/tests/ibctesting/endpoint.go +++ b/tests/ibctesting/endpoint.go @@ -5,14 +5,14 @@ import ( "strings" abci "github.com/cometbft/cometbft/abci/types" - clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" - connectiontypes "github.com/cosmos/ibc-go/v8/modules/core/03-connection/types" - channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" - commitmenttypes "github.com/cosmos/ibc-go/v8/modules/core/23-commitment/types" - host "github.com/cosmos/ibc-go/v8/modules/core/24-host" - "github.com/cosmos/ibc-go/v8/modules/core/exported" - ibctm "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" - ibctesting "github.com/cosmos/ibc-go/v8/testing" + clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" + connectiontypes "github.com/cosmos/ibc-go/v9/modules/core/03-connection/types" + channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" + commitmenttypes "github.com/cosmos/ibc-go/v9/modules/core/23-commitment/types" + host "github.com/cosmos/ibc-go/v9/modules/core/24-host" + "github.com/cosmos/ibc-go/v9/modules/core/exported" + ibctm "github.com/cosmos/ibc-go/v9/modules/light-clients/07-tendermint" + ibctesting "github.com/cosmos/ibc-go/v9/testing" "github.com/stretchr/testify/require" "github.com/cosmos/cosmos-sdk/baseapp" @@ -66,7 +66,7 @@ func (endpoint *Endpoint) QueryProof(key []byte) ([]byte, clienttypes.Height) { clientState := endpoint.Counterparty.Chain.GetClientState(endpoint.Counterparty.ClientID) // query proof on the counterparty using the latest height of the IBC client - return endpoint.QueryProofAtHeight(key, clientState.GetLatestHeight().GetRevisionHeight()) + return endpoint.QueryProofAtHeight(key, getLatestHeight(clientState).GetRevisionHeight()) } // QueryProofAtHeight queries proof associated with this endpoint using the proof height @@ -197,7 +197,7 @@ func (endpoint *Endpoint) UpgradeChain() error { Root: commitmenttypes.NewMerkleRoot(endpoint.Chain.LastHeader.Header.GetAppHash()), NextValidatorsHash: endpoint.Chain.LastHeader.Header.NextValidatorsHash, } - endpoint.Counterparty.SetConsensusState(consensusState, clientState.GetLatestHeight()) + endpoint.Counterparty.SetConsensusState(consensusState, getLatestHeight(clientState)) // ensure the next update isn't identical to the one set in state endpoint.Chain.Coordinator.IncrementTime() @@ -230,13 +230,17 @@ func (endpoint *Endpoint) ConnOpenTry() error { err := endpoint.UpdateClient() require.NoError(endpoint.Chain.t, err) - counterpartyClient, proofClient, proofConsensus, consensusHeight, proofInit, proofHeight := endpoint.QueryConnectionHandshakeProof() + _, _, _, _, proofInit, proofHeight := endpoint.QueryConnectionHandshakeProof() msg := connectiontypes.NewMsgConnectionOpenTry( - endpoint.ClientID, endpoint.Counterparty.ConnectionID, endpoint.Counterparty.ClientID, - counterpartyClient, endpoint.Counterparty.Chain.GetPrefix(), []*connectiontypes.Version{ibctesting.ConnectionVersion}, endpoint.ConnectionConfig.DelayPeriod, - proofInit, proofClient, proofConsensus, - proofHeight, consensusHeight, + endpoint.ClientID, + endpoint.Counterparty.ConnectionID, + endpoint.Counterparty.ClientID, + endpoint.Counterparty.Chain.GetPrefix(), + []*connectiontypes.Version{ibctesting.ConnectionVersion}, + endpoint.ConnectionConfig.DelayPeriod, + proofInit, + proofHeight, endpoint.Chain.SenderAccount.GetAddress().String(), ) res, err := endpoint.Chain.SendMsgs(msg) @@ -257,15 +261,18 @@ func (endpoint *Endpoint) ConnOpenAck() error { err := endpoint.UpdateClient() require.NoError(endpoint.Chain.t, err) - counterpartyClient, proofClient, proofConsensus, consensusHeight, proofTry, proofHeight := endpoint.QueryConnectionHandshakeProof() + // Only keep the proofs we need + _, _, _, _, proofTry, proofHeight := endpoint.QueryConnectionHandshakeProof() msg := connectiontypes.NewMsgConnectionOpenAck( - endpoint.ConnectionID, endpoint.Counterparty.ConnectionID, counterpartyClient, // testing doesn't use flexible selection - proofTry, proofClient, proofConsensus, - proofHeight, consensusHeight, + endpoint.ConnectionID, + endpoint.Counterparty.ConnectionID, + proofTry, + proofHeight, ibctesting.ConnectionVersion, endpoint.Chain.SenderAccount.GetAddress().String(), ) + return endpoint.Chain.sendMsgs(msg) } @@ -301,7 +308,7 @@ func (endpoint *Endpoint) QueryConnectionHandshakeProof() ( clientKey := host.FullClientStateKey(endpoint.Counterparty.ClientID) proofClient, proofHeight = endpoint.Counterparty.QueryProof(clientKey) - consensusHeight = clientState.GetLatestHeight().(clienttypes.Height) + consensusHeight = getLatestHeight(clientState) // query proof for the consensus state on the counterparty consensusKey := host.FullConsensusStateKey(endpoint.Counterparty.ClientID, consensusHeight) @@ -427,6 +434,7 @@ func (endpoint *Endpoint) ChanCloseConfirm() error { endpoint.ChannelConfig.PortID, endpoint.ChannelID, proof, proofHeight, endpoint.Chain.SenderAccount.GetAddress().String(), + 0, // Add sequence ) return endpoint.Chain.sendMsgs(msg) } @@ -571,6 +579,7 @@ func (endpoint *Endpoint) TimeoutOnClose(packet channeltypes.Packet) error { timeoutOnCloseMsg := channeltypes.NewMsgTimeoutOnClose( packet, nextSeqRecv, proof, proofClosed, proofHeight, endpoint.Chain.SenderAccount.GetAddress().String(), + 0, // Add sequence ) return endpoint.Chain.sendMsgs(timeoutOnCloseMsg) @@ -652,3 +661,21 @@ func (endpoint *Endpoint) QueryClientStateProof() (exported.ClientState, []byte) return clientState, proofClient } + +// Add helper method to Endpoint +func (endpoint *Endpoint) GetClientLatestHeight(clientState exported.ClientState) clienttypes.Height { + tmClientState, ok := clientState.(*ibctm.ClientState) + if !ok { + panic("invalid client state type") + } + return tmClientState.LatestHeight +} + +// Add helper method to get latest height from client state +func getLatestHeight(clientState exported.ClientState) clienttypes.Height { + tmClientState, ok := clientState.(*ibctm.ClientState) + if !ok { + panic("invalid client state type") + } + return tmClientState.LatestHeight +} diff --git a/tests/ibctesting/event_utils.go b/tests/ibctesting/event_utils.go index b383fc07b2..b6f8e358da 100644 --- a/tests/ibctesting/event_utils.go +++ b/tests/ibctesting/event_utils.go @@ -7,8 +7,8 @@ import ( "strings" abci "github.com/cometbft/cometbft/abci/types" - clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" - channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" + clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" + channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" ) func GetSendPackets(evts []abci.Event) []channeltypes.Packet { @@ -106,7 +106,7 @@ func ParseChannelVersionFromEvents(events []abci.Event) (string, error) { for _, ev := range events { if ev.Type == channeltypes.EventTypeChannelOpenInit || ev.Type == channeltypes.EventTypeChannelOpenTry { for _, attr := range ev.Attributes { - if attr.Key == channeltypes.AttributeVersion { + if attr.Key == "version" { return attr.Value, nil } } diff --git a/tests/ibctesting/events.go b/tests/ibctesting/events.go index 4bd939d72c..36003cb6e0 100644 --- a/tests/ibctesting/events.go +++ b/tests/ibctesting/events.go @@ -6,9 +6,9 @@ import ( "strconv" abci "github.com/cometbft/cometbft/abci/types" - clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" - connectiontypes "github.com/cosmos/ibc-go/v8/modules/core/03-connection/types" - channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" + clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" + connectiontypes "github.com/cosmos/ibc-go/v9/modules/core/03-connection/types" + channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" "github.com/stretchr/testify/suite" ) diff --git a/tests/ibctesting/path.go b/tests/ibctesting/path.go index e0c0b4a179..17b07ea739 100644 --- a/tests/ibctesting/path.go +++ b/tests/ibctesting/path.go @@ -4,7 +4,7 @@ import ( "bytes" "fmt" - channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" + channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" sdk "github.com/cosmos/cosmos-sdk/types" ) diff --git a/tests/ibctesting/wasm.go b/tests/ibctesting/wasm.go index 48343926da..99d4f4e890 100644 --- a/tests/ibctesting/wasm.go +++ b/tests/ibctesting/wasm.go @@ -12,7 +12,7 @@ import ( abci "github.com/cometbft/cometbft/abci/types" "github.com/cometbft/cometbft/libs/rand" "github.com/cosmos/gogoproto/proto" - ibctesting "github.com/cosmos/ibc-go/v8/testing" + ibctesting "github.com/cosmos/ibc-go/v9/testing" "github.com/stretchr/testify/require" sdk "github.com/cosmos/cosmos-sdk/types" diff --git a/tests/integration/ibc_integration_test.go b/tests/integration/ibc_integration_test.go index 8fc3a1f097..51474ca897 100644 --- a/tests/integration/ibc_integration_test.go +++ b/tests/integration/ibc_integration_test.go @@ -8,9 +8,9 @@ import ( wasmvm "github.com/CosmWasm/wasmvm/v2" wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" - ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" - channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" - ibctesting "github.com/cosmos/ibc-go/v8/testing" + ibctransfertypes "github.com/cosmos/ibc-go/v9/modules/apps/transfer/types" + channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" + ibctesting "github.com/cosmos/ibc-go/v9/testing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -202,7 +202,7 @@ func TestOnChanOpenInitVersion(t *testing.T) { } func TestOnChanOpenTryVersion(t *testing.T) { - const startVersion = ibctransfertypes.Version + const startVersion = "ics20-1" specs := map[string]struct { contractRsp *wasmvmtypes.IBC3ChannelOpenResponse expVersion string @@ -250,7 +250,7 @@ func TestOnChanOpenTryVersion(t *testing.T) { } path.EndpointB.ChannelConfig = &ibctesting.ChannelConfig{ PortID: ibctransfertypes.PortID, - Version: ibctransfertypes.Version, + Version: "ics20-1", Order: channeltypes.UNORDERED, } diff --git a/tests/integration/msg_server_integration_test.go b/tests/integration/msg_server_integration_test.go index a246a221b7..8cb749050a 100644 --- a/tests/integration/msg_server_integration_test.go +++ b/tests/integration/msg_server_integration_test.go @@ -132,7 +132,7 @@ func TestUpdateParams(t *testing.T) { require.NoError(t, err) // when - rsp, err := wasmApp.MsgServiceRouter().Handler(&spec.src)(ctx, &spec.src) //nolint:gosec + 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)) @@ -223,7 +223,7 @@ func TestAddCodeUploadParamsAddresses(t *testing.T) { require.NoError(t, err) // when - rsp, err := wasmApp.MsgServiceRouter().Handler(&spec.src)(ctx, &spec.src) //nolint:gosec + rsp, err := wasmApp.MsgServiceRouter().Handler(&spec.src)(ctx, &spec.src) if spec.expErr { require.Error(t, err) require.Nil(t, rsp) @@ -319,7 +319,7 @@ func TestRemoveCodeUploadParamsAddresses(t *testing.T) { require.NoError(t, err) // when - rsp, err := wasmApp.MsgServiceRouter().Handler(&spec.src)(ctx, &spec.src) //nolint:gosec + rsp, err := wasmApp.MsgServiceRouter().Handler(&spec.src)(ctx, &spec.src) if spec.expErr { require.Error(t, err) require.Nil(t, rsp) diff --git a/tests/integration/proposal_integration_test.go b/tests/integration/proposal_integration_test.go index 45c1e76122..dd1dab46e1 100644 --- a/tests/integration/proposal_integration_test.go +++ b/tests/integration/proposal_integration_test.go @@ -17,6 +17,7 @@ import ( govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" v1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" + govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" "github.com/CosmWasm/wasmd/x/wasm/keeper" "github.com/CosmWasm/wasmd/x/wasm/keeper/testdata" @@ -34,7 +35,7 @@ func TestLoadStoredGovV1Beta1LegacyTypes(t *testing.T) { capabilities = append(capabilities, "iterator") pCtx, keepers := keeper.CreateTestInput(t, false, capabilities) k := keepers.WasmKeeper - keepers.GovKeeper.SetLegacyRouter(v1beta1.NewRouter(). + keepers.GovKeeper.SetLegacyRouter(govv1beta1.NewRouter(). AddRoute(types.ModuleName, keeper.NewLegacyWasmProposalHandler(k, types.EnableAllProposals)), ) myAddress := keeper.RandomAccountAddress(t) diff --git a/tests/integration/query_plugin_integration_test.go b/tests/integration/query_plugin_integration_test.go index dea1eb3109..5c4b6d7157 100644 --- a/tests/integration/query_plugin_integration_test.go +++ b/tests/integration/query_plugin_integration_test.go @@ -14,7 +14,7 @@ import ( "github.com/cometbft/cometbft/crypto/ed25519" cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" "github.com/cosmos/gogoproto/proto" - channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" + channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/tests/integration/relay_pingpong_test.go b/tests/integration/relay_pingpong_test.go index 43fe3b540a..fe7b0ba6e3 100644 --- a/tests/integration/relay_pingpong_test.go +++ b/tests/integration/relay_pingpong_test.go @@ -7,10 +7,9 @@ import ( wasmvm "github.com/CosmWasm/wasmvm/v2" wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" - ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" - clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" //nolint:staticcheck - channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" - ibctesting "github.com/cosmos/ibc-go/v8/testing" + clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" + channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" + ibctesting "github.com/cosmos/ibc-go/v9/testing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -74,12 +73,12 @@ func TestPinPong(t *testing.T) { path := wasmibctesting.NewPath(chainA, chainB) path.EndpointA.ChannelConfig = &ibctesting.ChannelConfig{ PortID: sourcePortID, - Version: ibctransfertypes.Version, + Version: ping, Order: channeltypes.ORDERED, } path.EndpointB.ChannelConfig = &ibctesting.ChannelConfig{ PortID: counterpartyPortID, - Version: ibctransfertypes.Version, + Version: pong, Order: channeltypes.ORDERED, } coordinator.SetupConnections(path) diff --git a/tests/integration/relay_test.go b/tests/integration/relay_test.go index f681f71329..bd3f030e80 100644 --- a/tests/integration/relay_test.go +++ b/tests/integration/relay_test.go @@ -1,17 +1,20 @@ package integration import ( + "crypto/sha256" + "encoding/hex" "encoding/json" "errors" + "fmt" "testing" "time" wasmvm "github.com/CosmWasm/wasmvm/v2" wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" - ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" - clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" //nolint:staticcheck - channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" - ibctesting "github.com/cosmos/ibc-go/v8/testing" + transfertypes "github.com/cosmos/ibc-go/v9/modules/apps/transfer/types" + clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" + channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" + ibctesting "github.com/cosmos/ibc-go/v9/testing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -27,6 +30,10 @@ import ( "github.com/CosmWasm/wasmd/x/wasm/types" ) +const ( + Version = "ics20-1" +) + func TestFromIBCTransferToContract(t *testing.T) { // scenario: given two chains, // with a contract on chain B @@ -98,12 +105,12 @@ func TestFromIBCTransferToContract(t *testing.T) { path := wasmibctesting.NewPath(chainA, chainB) path.EndpointA.ChannelConfig = &ibctesting.ChannelConfig{ PortID: "transfer", - Version: ibctransfertypes.Version, + Version: Version, Order: channeltypes.UNORDERED, } path.EndpointB.ChannelConfig = &ibctesting.ChannelConfig{ PortID: contractBPortID, - Version: ibctransfertypes.Version, + Version: Version, Order: channeltypes.UNORDERED, } @@ -115,7 +122,17 @@ func TestFromIBCTransferToContract(t *testing.T) { 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 := transfertypes.NewMsgTransfer( + path.EndpointA.ChannelConfig.PortID, + path.EndpointA.ChannelID, + sdk.NewCoins(coinToSendToB), + chainA.SenderAccount.GetAddress().String(), + chainB.SenderAccount.GetAddress().String(), + timeoutHeight, + 0, + "", + nil, + ) _, err := chainA.SendMsgs(msg) require.NoError(t, err) require.NoError(t, path.EndpointB.UpdateClient()) @@ -141,7 +158,14 @@ func TestFromIBCTransferToContract(t *testing.T) { assert.Equal(t, originalChainABalance.Amount.Add(spec.expChainABalanceDiff), newChainABalance.Amount) // and dest chain balance contains voucher - expBalance := ibctransfertypes.GetTransferCoin(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, coinToSendToB.Denom, spec.expChainBBalanceDiff) + denomTrace := fmt.Sprintf("%s/%s/%s", + path.EndpointB.ChannelConfig.PortID, + path.EndpointB.ChannelID, + coinToSendToB.Denom, + ) + hash := sha256.Sum256([]byte(denomTrace)) + ibcDenom := fmt.Sprintf("ibc/%s", hex.EncodeToString(hash[:])) + expBalance := sdk.NewCoin(ibcDenom, coinToSendToB.Amount) gotBalance := chainB.Balance(chainB.SenderAccount.GetAddress(), expBalance.Denom) assert.Equal(t, expBalance, gotBalance, "got total balance: %s", chainB.AllBalances(chainB.SenderAccount.GetAddress())) }) @@ -170,13 +194,13 @@ func TestContractCanInitiateIBCTransferMsg(t *testing.T) { path := wasmibctesting.NewPath(chainA, chainB) path.EndpointA.ChannelConfig = &ibctesting.ChannelConfig{ - PortID: ibctransfertypes.PortID, - Version: ibctransfertypes.Version, + PortID: transfertypes.PortID, + Version: Version, Order: channeltypes.UNORDERED, } path.EndpointB.ChannelConfig = &ibctesting.ChannelConfig{ - PortID: ibctransfertypes.PortID, - Version: ibctransfertypes.Version, + PortID: transfertypes.PortID, + Version: Version, Order: channeltypes.UNORDERED, } coordinator.SetupConnections(path) @@ -214,7 +238,14 @@ func TestContractCanInitiateIBCTransferMsg(t *testing.T) { // and dest chain balance contains voucher bankKeeperB := chainB.App.(*app.WasmApp).BankKeeper - expBalance := ibctransfertypes.GetTransferCoin(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, coinToSendToB.Denom, coinToSendToB.Amount) + denomTrace := fmt.Sprintf("%s/%s/%s", + path.EndpointB.ChannelConfig.PortID, + path.EndpointB.ChannelID, + coinToSendToB.Denom, + ) + hash := sha256.Sum256([]byte(denomTrace)) + ibcDenom := fmt.Sprintf("ibc/%s", hex.EncodeToString(hash[:])) + expBalance := sdk.NewCoin(ibcDenom, coinToSendToB.Amount) gotBalance := chainB.Balance(chainB.SenderAccount.GetAddress(), expBalance.Denom) assert.Equal(t, expBalance, gotBalance, "got total balance: %s", bankKeeperB.GetAllBalances(chainB.GetContext(), chainB.SenderAccount.GetAddress())) } @@ -243,12 +274,12 @@ func TestContractCanEmulateIBCTransferMessage(t *testing.T) { path := wasmibctesting.NewPath(chainA, chainB) path.EndpointA.ChannelConfig = &ibctesting.ChannelConfig{ PortID: chainA.ContractInfo(myContractAddr).IBCPortID, - Version: ibctransfertypes.Version, + Version: Version, Order: channeltypes.UNORDERED, } path.EndpointB.ChannelConfig = &ibctesting.ChannelConfig{ - PortID: ibctransfertypes.PortID, - Version: ibctransfertypes.Version, + PortID: transfertypes.PortID, + Version: Version, Order: channeltypes.UNORDERED, } coordinator.SetupConnections(path) @@ -289,7 +320,14 @@ func TestContractCanEmulateIBCTransferMessage(t *testing.T) { // and dest chain balance contains voucher bankKeeperB := chainB.App.(*app.WasmApp).BankKeeper - expBalance := ibctransfertypes.GetTransferCoin(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, coinToSendToB.Denom, coinToSendToB.Amount) + denomTrace := fmt.Sprintf("%s/%s/%s", + path.EndpointB.ChannelConfig.PortID, + path.EndpointB.ChannelID, + coinToSendToB.Denom, + ) + hash := sha256.Sum256([]byte(denomTrace)) + ibcDenom := fmt.Sprintf("ibc/%s", hex.EncodeToString(hash[:])) + expBalance := sdk.NewCoin(ibcDenom, coinToSendToB.Amount) gotBalance := chainB.Balance(chainB.SenderAccount.GetAddress(), expBalance.Denom) assert.Equal(t, expBalance, gotBalance, "got total balance: %s", bankKeeperB.GetAllBalances(chainB.GetContext(), chainB.SenderAccount.GetAddress())) } @@ -319,12 +357,12 @@ func TestContractCanEmulateIBCTransferMessageWithTimeout(t *testing.T) { path := wasmibctesting.NewPath(chainA, chainB) path.EndpointA.ChannelConfig = &ibctesting.ChannelConfig{ PortID: chainA.ContractInfo(myContractAddr).IBCPortID, - Version: ibctransfertypes.Version, + Version: Version, Order: channeltypes.UNORDERED, } path.EndpointB.ChannelConfig = &ibctesting.ChannelConfig{ - PortID: ibctransfertypes.PortID, - Version: ibctransfertypes.Version, + PortID: transfertypes.PortID, + Version: Version, Order: channeltypes.UNORDERED, } coordinator.SetupConnections(path) @@ -408,12 +446,12 @@ func TestContractEmulateIBCTransferMessageOnDiffContractIBCChannel(t *testing.T) path := wasmibctesting.NewPath(chainA, chainB) path.EndpointA.ChannelConfig = &ibctesting.ChannelConfig{ PortID: chainA.ContractInfo(myContractAddr1).IBCPortID, - Version: ibctransfertypes.Version, + Version: Version, Order: channeltypes.UNORDERED, } path.EndpointB.ChannelConfig = &ibctesting.ChannelConfig{ - PortID: ibctransfertypes.PortID, - Version: ibctransfertypes.Version, + PortID: transfertypes.PortID, + Version: Version, Order: channeltypes.UNORDERED, } coordinator.SetupConnections(path) @@ -469,12 +507,12 @@ func TestContractHandlesChannelClose(t *testing.T) { path := wasmibctesting.NewPath(chainA, chainB) path.EndpointA.ChannelConfig = &ibctesting.ChannelConfig{ PortID: chainA.ContractInfo(myContractAddrA).IBCPortID, - Version: ibctransfertypes.Version, + Version: Version, Order: channeltypes.UNORDERED, } path.EndpointB.ChannelConfig = &ibctesting.ChannelConfig{ PortID: chainB.ContractInfo(myContractAddrB).IBCPortID, - Version: ibctransfertypes.Version, + Version: Version, Order: channeltypes.UNORDERED, } coordinator.SetupConnections(path) @@ -519,12 +557,12 @@ func TestContractHandlesChannelCloseNotOwned(t *testing.T) { path := wasmibctesting.NewPath(chainA, chainB) path.EndpointA.ChannelConfig = &ibctesting.ChannelConfig{ PortID: chainA.ContractInfo(myContractAddrA1).IBCPortID, - Version: ibctransfertypes.Version, + Version: Version, Order: channeltypes.UNORDERED, } path.EndpointB.ChannelConfig = &ibctesting.ChannelConfig{ PortID: chainB.ContractInfo(myContractAddrB).IBCPortID, - Version: ibctransfertypes.Version, + Version: Version, Order: channeltypes.UNORDERED, } coordinator.SetupConnections(path) @@ -602,7 +640,7 @@ func (s *sendEmulatedIBCTransferContract) Execute(_ wasmvm.Checksum, _ wasmvmtyp require.Len(s.t, info.Funds, 1) 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( + dataPacket := transfertypes.NewFungibleTokenPacketData( in.CoinsToSend.Denom, in.CoinsToSend.Amount.String(), info.Sender, in.ReceiverAddr, "memo", ) if err := dataPacket.ValidateBasic(); err != nil { @@ -622,8 +660,8 @@ func (s *sendEmulatedIBCTransferContract) Execute(_ wasmvm.Checksum, _ wasmvmtyp func (s *sendEmulatedIBCTransferContract) IBCPacketTimeout(_ wasmvm.Checksum, _ wasmvmtypes.Env, msg wasmvmtypes.IBCPacketTimeoutMsg, _ wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResult, uint64, error) { packet := msg.Packet - var data ibctransfertypes.FungibleTokenPacketData - if err := ibctransfertypes.ModuleCdc.UnmarshalJSON(packet.Data, &data); err != nil { + var data transfertypes.FungibleTokenPacketData + if err := transfertypes.ModuleCdc.UnmarshalJSON(packet.Data, &data); err != nil { return nil, 0, err } if err := data.ValidateBasic(); err != nil { @@ -703,44 +741,95 @@ type ackReceiverContract struct { chain *wasmibctesting.TestChain } -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) { +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 - if err := ibctransfertypes.ModuleCdc.UnmarshalJSON(packet.Data, &src); err != nil { + var src transfertypes.FungibleTokenPacketData + if err := transfertypes.ModuleCdc.UnmarshalJSON(packet.Data, &src); err != nil { return nil, 0, err } require.NoError(c.t, src.ValidateBasic()) - // call original ibctransfer keeper to not copy all code into this + // Replace the DenomTrace creation with direct IBC denom construction + hash := sha256.Sum256([]byte(src.Denom)) + ibcDenom := transfertypes.Denom{ + Base: fmt.Sprintf("ibc/%s", hex.EncodeToString(hash[:])), + } + + // Create Token using the IBC denom + dataV2 := transfertypes.NewFungibleTokenPacketDataV2( + []transfertypes.Token{ + { + Denom: ibcDenom, + Amount: src.Amount, + }, + }, + src.Sender, + src.Receiver, + "", // empty memo + transfertypes.ForwardingPacketData{}, // empty forwarding data + ) + + // Now pass 'dataV2' to 'OnRecvPacket' ibcPacket := toIBCPacket(packet) ctx := c.chain.GetContext() // HACK: please note that this is not reverted after checkTX - err := c.chain.App.(*app.WasmApp).TransferKeeper.OnRecvPacket(ctx, ibcPacket, src) + err := c.chain.App.(*app.WasmApp).TransferKeeper.OnRecvPacket(ctx, ibcPacket, dataV2) if err != nil { return nil, 0, errorsmod.Wrap(err, "within our smart contract") } var log []wasmvmtypes.EventAttribute // note: all events are under `wasm` event type ack := channeltypes.NewResultAcknowledgement([]byte{byte(1)}).Acknowledgement() - return &wasmvmtypes.IBCReceiveResult{Ok: &wasmvmtypes.IBCReceiveResponse{Acknowledgement: ack, Attributes: log}}, 0, nil + return &wasmvmtypes.IBCReceiveResult{ + Ok: &wasmvmtypes.IBCReceiveResponse{ + Acknowledgement: ack, + Attributes: log, + }, + }, 0, nil } func (c *ackReceiverContract) IBCPacketAck(_ wasmvm.Checksum, _ wasmvmtypes.Env, msg wasmvmtypes.IBCPacketAckMsg, _ wasmvm.KVStore, _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) (*wasmvmtypes.IBCBasicResult, uint64, error) { - var data ibctransfertypes.FungibleTokenPacketData - if err := ibctransfertypes.ModuleCdc.UnmarshalJSON(msg.OriginalPacket.Data, &data); err != nil { + var data transfertypes.FungibleTokenPacketData + if err := transfertypes.ModuleCdc.UnmarshalJSON(msg.OriginalPacket.Data, &data); err != nil { return nil, 0, err } // call original ibctransfer keeper to not copy all code into this var ack channeltypes.Acknowledgement - if err := ibctransfertypes.ModuleCdc.UnmarshalJSON(msg.Acknowledgement.Data, &ack); err != nil { + if err := transfertypes.ModuleCdc.UnmarshalJSON(msg.Acknowledgement.Data, &ack); err != nil { return nil, 0, err } // call original ibctransfer keeper to not copy all code into this ctx := c.chain.GetContext() // HACK: please note that this is not reverted after checkTX ibcPacket := toIBCPacket(msg.OriginalPacket) - err := c.chain.App.(*app.WasmApp).TransferKeeper.OnAcknowledgementPacket(ctx, ibcPacket, data, ack) + var denom transfertypes.Denom + if err := json.Unmarshal([]byte(data.Denom), &denom); err != nil { + return nil, 0, err + } + dataV2 := transfertypes.NewFungibleTokenPacketDataV2( + []transfertypes.Token{ + { + Denom: denom, + Amount: data.Amount, + }, + }, + data.Sender, + data.Receiver, + "", + transfertypes.ForwardingPacketData{}, + ) + err := c.chain.App.(*app.WasmApp).TransferKeeper.OnAcknowledgementPacket(ctx, ibcPacket, dataV2, ack) if err != nil { return nil, 0, errorsmod.Wrap(err, "within our smart contract") } @@ -757,8 +846,8 @@ type nackReceiverContract struct { 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 - if err := ibctransfertypes.ModuleCdc.UnmarshalJSON(packet.Data, &src); err != nil { + var src transfertypes.FungibleTokenPacketData + if err := transfertypes.ModuleCdc.UnmarshalJSON(packet.Data, &src); err != nil { return nil, 0, err } require.NoError(c.t, src.ValidateBasic()) @@ -774,8 +863,8 @@ type errorReceiverContract struct { 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 - if err := ibctransfertypes.ModuleCdc.UnmarshalJSON(packet.Data, &src); err != nil { + var src transfertypes.FungibleTokenPacketData + if err := transfertypes.ModuleCdc.UnmarshalJSON(packet.Data, &src); err != nil { return nil, 0, err } require.NoError(c.t, src.ValidateBasic()) diff --git a/x/wasm/common_test.go b/x/wasm/common_test.go deleted file mode 100644 index aa507ee429..0000000000 --- a/x/wasm/common_test.go +++ /dev/null @@ -1,39 +0,0 @@ -package wasm - -import ( - "testing" - - "github.com/stretchr/testify/require" - - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/CosmWasm/wasmd/x/wasm/types" -) - -const firstCodeID = 1 - -// ensure store code returns the expected response -func assertStoreCodeResponse(t *testing.T, data []byte, expected uint64) { - var pStoreResp types.MsgStoreCodeResponse - require.NoError(t, pStoreResp.Unmarshal(data)) - require.Equal(t, pStoreResp.CodeID, expected) -} - -// ensure execution returns the expected data -func assertExecuteResponse(t *testing.T, data, expected []byte) { - var pExecResp types.MsgExecuteContractResponse - require.NoError(t, pExecResp.Unmarshal(data)) - require.Equal(t, pExecResp.Data, expected) -} - -// ensures this returns a valid bech32 address and returns it -func parseInitResponse(t *testing.T, data []byte) string { - var pInstResp types.MsgInstantiateContractResponse - require.NoError(t, pInstResp.Unmarshal(data)) - require.NotEmpty(t, pInstResp.Address) - addr := pInstResp.Address - // ensure this is a valid sdk address - _, err := sdk.AccAddressFromBech32(addr) - require.NoError(t, err) - return addr -} diff --git a/x/wasm/ibc.go b/x/wasm/ibc.go index b0311f5227..a704baa2f0 100644 --- a/x/wasm/ibc.go +++ b/x/wasm/ibc.go @@ -5,11 +5,11 @@ import ( wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" - clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" - channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" - porttypes "github.com/cosmos/ibc-go/v8/modules/core/05-port/types" - host "github.com/cosmos/ibc-go/v8/modules/core/24-host" - ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" + clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" + channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" + porttypes "github.com/cosmos/ibc-go/v9/modules/core/05-port/types" + host "github.com/cosmos/ibc-go/v9/modules/core/24-host" + ibcexported "github.com/cosmos/ibc-go/v9/modules/core/exported" errorsmod "cosmossdk.io/errors" @@ -272,6 +272,7 @@ func toWasmVMChannel(portID, channelID string, channelInfo channeltypes.Channel, // OnRecvPacket implements the IBCModule interface func (i IBCHandler) OnRecvPacket( ctx sdk.Context, + destinationPort string, packet channeltypes.Packet, relayer sdk.AccAddress, ) ibcexported.Acknowledgement { @@ -299,6 +300,7 @@ func (i IBCHandler) OnRecvPacket( // OnAcknowledgementPacket implements the IBCModule interface func (i IBCHandler) OnAcknowledgementPacket( ctx sdk.Context, + sourcePort string, packet channeltypes.Packet, acknowledgement []byte, relayer sdk.AccAddress, @@ -320,7 +322,12 @@ func (i IBCHandler) OnAcknowledgementPacket( } // OnTimeoutPacket implements the IBCModule interface -func (i IBCHandler) OnTimeoutPacket(ctx sdk.Context, packet channeltypes.Packet, relayer sdk.AccAddress) error { +func (i IBCHandler) OnTimeoutPacket( + ctx sdk.Context, + sourcePort string, + packet channeltypes.Packet, + relayer sdk.AccAddress, +) error { contractAddr, err := keeper.ContractFromPortID(packet.SourcePort) if err != nil { return errorsmod.Wrapf(err, "contract port id") diff --git a/x/wasm/ibc_test.go b/x/wasm/ibc_test.go index e6e0fb48c7..203a9a003b 100644 --- a/x/wasm/ibc_test.go +++ b/x/wasm/ibc_test.go @@ -6,9 +6,9 @@ import ( wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" abci "github.com/cometbft/cometbft/abci/types" "github.com/cometbft/cometbft/libs/rand" - clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" //nolint:staticcheck - channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" - ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" + clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" + channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" + ibcexported "github.com/cosmos/ibc-go/v9/modules/core/exported" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -114,11 +114,11 @@ func TestOnRecvPacket(t *testing.T) { ctx := sdk.Context{}.WithEventManager(em) if spec.expPanic { require.Panics(t, func() { - _ = h.OnRecvPacket(ctx, spec.ibcPkg, anyRelayerAddr) + _ = h.OnRecvPacket(ctx, spec.ibcPkg.DestinationPort, spec.ibcPkg, anyRelayerAddr) }) return } - gotAck := h.OnRecvPacket(ctx, spec.ibcPkg, anyRelayerAddr) + gotAck := h.OnRecvPacket(ctx, spec.ibcPkg.DestinationPort, spec.ibcPkg, anyRelayerAddr) assert.Equal(t, spec.expAck, gotAck) assert.Equal(t, spec.expEvents, em.Events()) }) diff --git a/x/wasm/keeper/handler_plugin.go b/x/wasm/keeper/handler_plugin.go index 57a88f4f24..80d29568a5 100644 --- a/x/wasm/keeper/handler_plugin.go +++ b/x/wasm/keeper/handler_plugin.go @@ -5,8 +5,8 @@ import ( "fmt" wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" - channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" - host "github.com/cosmos/ibc-go/v8/modules/core/24-host" + channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" + host "github.com/cosmos/ibc-go/v9/modules/core/24-host" errorsmod "cosmossdk.io/errors" diff --git a/x/wasm/keeper/handler_plugin_encoders.go b/x/wasm/keeper/handler_plugin_encoders.go index 517d02d671..e5c17a949c 100644 --- a/x/wasm/keeper/handler_plugin_encoders.go +++ b/x/wasm/keeper/handler_plugin_encoders.go @@ -5,10 +5,10 @@ import ( "fmt" wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" - ibcfeetypes "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/types" - ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" - ibcclienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" - channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" + ibcfeetypes "github.com/cosmos/ibc-go/v9/modules/apps/29-fee/types" + ibctransfertypes "github.com/cosmos/ibc-go/v9/modules/apps/transfer/types" + ibcclienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" + channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" errorsmod "cosmossdk.io/errors" sdkmath "cosmossdk.io/math" diff --git a/x/wasm/keeper/handler_plugin_encoders_test.go b/x/wasm/keeper/handler_plugin_encoders_test.go index d2a0a5b6b6..9f1f36de40 100644 --- a/x/wasm/keeper/handler_plugin_encoders_test.go +++ b/x/wasm/keeper/handler_plugin_encoders_test.go @@ -5,10 +5,10 @@ import ( wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" "github.com/cosmos/gogoproto/proto" - ibcfee "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/types" - ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" - clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" //nolint:staticcheck - channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" + ibcfee "github.com/cosmos/ibc-go/v9/modules/apps/29-fee/types" + ibctransfertypes "github.com/cosmos/ibc-go/v9/modules/apps/transfer/types" + clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" + channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -1067,3 +1067,138 @@ func TestConvertWasmCoinsToSdkCoins(t *testing.T) { }) } } + +func TestDistributionMsgEncoding(t *testing.T) { + addr1 := RandomAccountAddress(t) + addr2 := RandomAccountAddress(t) + valAddr2 := make(sdk.ValAddress, types.SDKAddrLen) + valAddr2[1] = 123 + + cases := map[string]struct { + sender sdk.AccAddress + srcMsg wasmvmtypes.CosmosMsg + output []sdk.Msg + expError bool + }{ + "staking withdraw (explicit recipient)": { + sender: addr1, + srcMsg: wasmvmtypes.CosmosMsg{ + Distribution: &wasmvmtypes.DistributionMsg{ + WithdrawDelegatorReward: &wasmvmtypes.WithdrawDelegatorRewardMsg{ + Validator: valAddr2.String(), + }, + }, + }, + output: []sdk.Msg{ + &distributiontypes.MsgWithdrawDelegatorReward{ + DelegatorAddress: addr1.String(), + ValidatorAddress: valAddr2.String(), + }, + }, + }, + "staking set withdraw address": { + sender: addr1, + srcMsg: wasmvmtypes.CosmosMsg{ + Distribution: &wasmvmtypes.DistributionMsg{ + SetWithdrawAddress: &wasmvmtypes.SetWithdrawAddressMsg{ + Address: addr2.String(), + }, + }, + }, + output: []sdk.Msg{ + &distributiontypes.MsgSetWithdrawAddress{ + DelegatorAddress: addr1.String(), + WithdrawAddress: addr2.String(), + }, + }, + }, + } + + encodingConfig := MakeEncodingConfig(t) + for name, tc := range cases { + t.Run(name, func(t *testing.T) { + encoder := DefaultEncoders(encodingConfig.Codec, wasmtesting.MockIBCTransferKeeper{}) + res, err := encoder.Encode(sdk.Context{}, tc.sender, "", tc.srcMsg) + if tc.expError { + assert.Error(t, err) + return + } + require.NoError(t, err) + assert.Equal(t, tc.output, res) + }) + } +} + +func TestStargateMsgEncoding(t *testing.T) { + addr1 := RandomAccountAddress(t) + addr2 := RandomAccountAddress(t) + + bankMsg := &banktypes.MsgSend{ + FromAddress: addr2.String(), + ToAddress: addr1.String(), + Amount: sdk.Coins{ + sdk.NewInt64Coin("uatom", 12345), + sdk.NewInt64Coin("utgd", 54321), + }, + } + bankMsgBin := must(proto.Marshal(bankMsg)) + proposalMsg := &govv1.MsgSubmitProposal{ + Proposer: addr1.String(), + Messages: []*codectypes.Any{must(codectypes.NewAnyWithValue(types.MsgStoreCodeFixture()))}, + InitialDeposit: sdk.NewCoins(sdk.NewInt64Coin("uatom", 12345)), + } + proposalMsgBin, err := proto.Marshal(proposalMsg) + require.NoError(t, err) + + cases := map[string]struct { + sender sdk.AccAddress + srcMsg wasmvmtypes.CosmosMsg + output []sdk.Msg + expError bool + }{ + "stargate encoded bank msg": { + sender: addr2, + srcMsg: wasmvmtypes.CosmosMsg{ + Any: &wasmvmtypes.AnyMsg{ + TypeURL: "/cosmos.bank.v1beta1.MsgSend", + Value: bankMsgBin, + }, + }, + output: []sdk.Msg{bankMsg}, + }, + "stargate encoded msg with any type": { + sender: addr2, + srcMsg: wasmvmtypes.CosmosMsg{ + Any: &wasmvmtypes.AnyMsg{ + TypeURL: "/cosmos.gov.v1.MsgSubmitProposal", + Value: proposalMsgBin, + }, + }, + output: []sdk.Msg{proposalMsg}, + }, + "stargate encoded invalid typeUrl": { + sender: addr2, + srcMsg: wasmvmtypes.CosmosMsg{ + Any: &wasmvmtypes.AnyMsg{ + TypeURL: "/cosmos.bank.v2.MsgSend", + Value: bankMsgBin, + }, + }, + expError: true, + }, + } + + encodingConfig := MakeEncodingConfig(t) + for name, tc := range cases { + t.Run(name, func(t *testing.T) { + encoder := DefaultEncoders(encodingConfig.Codec, wasmtesting.MockIBCTransferKeeper{}) + res, err := encoder.Encode(sdk.Context{}, tc.sender, "", tc.srcMsg) + if tc.expError { + assert.Error(t, err) + return + } + require.NoError(t, err) + assert.Equal(t, tc.output, res) + }) + } +} diff --git a/x/wasm/keeper/handler_plugin_test.go b/x/wasm/keeper/handler_plugin_test.go index ca0a234e93..dc2426e597 100644 --- a/x/wasm/keeper/handler_plugin_test.go +++ b/x/wasm/keeper/handler_plugin_test.go @@ -8,9 +8,9 @@ import ( wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" "github.com/cosmos/gogoproto/proto" capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" - clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" //nolint:staticcheck - channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" - ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" + clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" + channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" + ibcexported "github.com/cosmos/ibc-go/v9/modules/core/exported" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -296,7 +296,9 @@ func TestIBCRawPacketHandler(t *testing.T) { TimeoutHeight: clienttypes.Height{}, TimeoutTimestamp: 1720000000000000000, } - contractKeeper.StoreAsyncAckPacket(ctx, ackPacket) + if err := contractKeeper.StoreAsyncAckPacket(ctx, ackPacket); err != nil { + t.Fatal(err) + } sendResponse := types.MsgIBCSendResponse{Sequence: 1} ackResponse := types.MsgIBCWriteAcknowledgementResponse{} @@ -374,7 +376,7 @@ func TestIBCRawPacketHandler(t *testing.T) { // when h := NewIBCRawPacketHandler(capturingICS4Mock, &contractKeeper, spec.chanKeeper, spec.capKeeper) - evts, data, msgResponses, gotErr := h.DispatchMsg(ctx, RandomAccountAddress(t), ibcPort, wasmvmtypes.CosmosMsg{IBC: &spec.srcMsg}) //nolint:gosec + evts, data, msgResponses, gotErr := h.DispatchMsg(ctx, RandomAccountAddress(t), ibcPort, wasmvmtypes.CosmosMsg{IBC: &spec.srcMsg}) // then require.True(t, spec.expErr.Is(gotErr), "exp %v but got %#+v", spec.expErr, gotErr) @@ -461,7 +463,7 @@ func TestBurnCoinMessageHandlerIntegration(t *testing.T) { return &wasmvmtypes.ContractResult{ Ok: &wasmvmtypes.Response{ Messages: []wasmvmtypes.SubMsg{ - {Msg: wasmvmtypes.CosmosMsg{Bank: &wasmvmtypes.BankMsg{Burn: &spec.msg}}, ReplyOn: wasmvmtypes.ReplyNever}, //nolint:gosec + {Msg: wasmvmtypes.CosmosMsg{Bank: &wasmvmtypes.BankMsg{Burn: &spec.msg}}, ReplyOn: wasmvmtypes.ReplyNever}, }, }, }, 0, nil diff --git a/x/wasm/keeper/ibc.go b/x/wasm/keeper/ibc.go index b0e1d05e1f..aef40bb8b0 100644 --- a/x/wasm/keeper/ibc.go +++ b/x/wasm/keeper/ibc.go @@ -4,7 +4,7 @@ import ( "strings" capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" - host "github.com/cosmos/ibc-go/v8/modules/core/24-host" + host "github.com/cosmos/ibc-go/v9/modules/core/24-host" errorsmod "cosmossdk.io/errors" diff --git a/x/wasm/keeper/keeper.go b/x/wasm/keeper/keeper.go index 585696c64c..c11a38fbf0 100644 --- a/x/wasm/keeper/keeper.go +++ b/x/wasm/keeper/keeper.go @@ -14,7 +14,7 @@ import ( wasmvm "github.com/CosmWasm/wasmvm/v2" wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" - channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" + channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" "cosmossdk.io/collections" corestoretypes "cosmossdk.io/core/store" diff --git a/x/wasm/keeper/keeper_test.go b/x/wasm/keeper/keeper_test.go index f48c9ba660..13519986a4 100644 --- a/x/wasm/keeper/keeper_test.go +++ b/x/wasm/keeper/keeper_test.go @@ -16,7 +16,6 @@ import ( abci "github.com/cometbft/cometbft/abci/types" "github.com/cometbft/cometbft/libs/rand" cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" dbm "github.com/cosmos/cosmos-db" fuzz "github.com/google/gofuzz" "github.com/stretchr/testify/assert" @@ -332,7 +331,7 @@ func TestCreateDuplicate(t *testing.T) { func TestCreateWithSimulation(t *testing.T) { ctx, keepers := CreateTestInput(t, false, AvailableCapabilities) - ctx = ctx.WithBlockHeader(tmproto.Header{Height: 1}). + ctx = ctx.WithBlockHeader(cmtproto.Header{Height: 1}). WithGasMeter(storetypes.NewInfiniteGasMeter()) deposit := sdk.NewCoins(sdk.NewInt64Coin("denom", 100000)) @@ -550,7 +549,7 @@ func TestInstantiateWithPermissions(t *testing.T) { accKeeper, bankKeeper, keeper := keepers.AccountKeeper, keepers.BankKeeper, keepers.ContractKeeper fundAccounts(t, ctx, accKeeper, bankKeeper, spec.srcActor, deposit) - contractID, _, err := keeper.Create(ctx, myAddr, hackatomWasm, &spec.srcPermission) //nolint:gosec + contractID, _, err := keeper.Create(ctx, myAddr, hackatomWasm, &spec.srcPermission) require.NoError(t, err) _, _, err = keepers.ContractKeeper.Instantiate(ctx, contractID, spec.srcActor, nil, initMsgBz, "demo contract 1", nil) diff --git a/x/wasm/keeper/msg_dispatcher_test.go b/x/wasm/keeper/msg_dispatcher_test.go index f9a0b72673..8efe884250 100644 --- a/x/wasm/keeper/msg_dispatcher_test.go +++ b/x/wasm/keeper/msg_dispatcher_test.go @@ -2,8 +2,6 @@ package keeper import ( "errors" - "fmt" - "reflect" "testing" wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" @@ -20,17 +18,25 @@ import ( "github.com/CosmWasm/wasmd/x/wasm/keeper/wasmtesting" ) -func TestDispatchSubmessages(t *testing.T) { +func setupDispatchTest(t *testing.T) (sdk.Context, *wasmtesting.MockCommitMultiStore, *sdk.EventManager) { + mockStore := &wasmtesting.MockCommitMultiStore{} + em := sdk.NewEventManager() + ctx := sdk.Context{}.WithMultiStore(mockStore). + WithGasMeter(storetypes.NewGasMeter(100)). + WithEventManager(em).WithLogger(log.NewTestLogger(t)) + return ctx, mockStore, em +} + +func TestDispatchSubmessagesBasicReplies(t *testing.T) { noReplyCalled := &mockReplyer{} - var anyGasLimit uint64 = 1 specs := map[string]struct { msgs []wasmvmtypes.SubMsg replyer *mockReplyer msgHandler *wasmtesting.MockMessageHandler expErr bool + expData []byte expCommits []bool - expEvents sdk.Events }{ "no reply on error without error": { msgs: []wasmvmtypes.SubMsg{{ReplyOn: wasmvmtypes.ReplyError}}, @@ -53,44 +59,36 @@ func TestDispatchSubmessages(t *testing.T) { expCommits: []bool{false}, expErr: true, }, - "reply on success - received": { - msgs: []wasmvmtypes.SubMsg{{ - ReplyOn: wasmvmtypes.ReplySuccess, - }}, - replyer: &mockReplyer{ - replyFn: func(ctx sdk.Context, contractAddress sdk.AccAddress, reply wasmvmtypes.Reply) ([]byte, error) { - return []byte("myReplyData"), nil - }, - }, - msgHandler: &wasmtesting.MockMessageHandler{ - DispatchMsgFn: func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, msgResponses [][]*codectypes.Any, err error) { - return nil, [][]byte{[]byte("myData")}, [][]*codectypes.Any{}, nil - }, - }, - expData: []byte("myReplyData"), - expCommits: []bool{true}, - }, - "reply on error - handled": { - msgs: []wasmvmtypes.SubMsg{{ - ReplyOn: wasmvmtypes.ReplyError, - }}, - replyer: &mockReplyer{ - replyFn: func(ctx sdk.Context, contractAddress sdk.AccAddress, reply wasmvmtypes.Reply) ([]byte, error) { - return []byte("myReplyData"), nil - }, - }, - msgHandler: &wasmtesting.MockMessageHandler{ - DispatchMsgFn: func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, msgResponses [][]*codectypes.Any, err error) { - return nil, nil, [][]*codectypes.Any{}, errors.New("my error") - }, - }, - expData: []byte("myReplyData"), - expCommits: []bool{false}, - }, + } + + for name, spec := range specs { + t.Run(name, func(t *testing.T) { + ctx, mockStore, em := setupDispatchTest(t) + d := NewMessageDispatcher(spec.msgHandler, spec.replyer) + + gotData, gotErr := d.DispatchSubmessages(ctx, RandomAccountAddress(t), "any_port", spec.msgs) + if spec.expErr { + require.Error(t, gotErr) + assert.Empty(t, em.Events()) + return + } + require.NoError(t, gotErr) + assert.Equal(t, spec.expData, gotData) + assert.Equal(t, spec.expCommits, mockStore.Committed) + }) + } +} + +func TestDispatchSubmessagesWithEvents(t *testing.T) { + specs := map[string]struct { + msgs []wasmvmtypes.SubMsg + replyer *mockReplyer + msgHandler *wasmtesting.MockMessageHandler + expEvents sdk.Events + expCommits []bool + }{ "with reply events": { - msgs: []wasmvmtypes.SubMsg{{ - ReplyOn: wasmvmtypes.ReplySuccess, - }}, + msgs: []wasmvmtypes.SubMsg{{ReplyOn: wasmvmtypes.ReplySuccess}}, replyer: &mockReplyer{ replyFn: func(ctx sdk.Context, contractAddress sdk.AccAddress, reply wasmvmtypes.Reply) ([]byte, error) { ctx.EventManager().EmitEvent(sdk.NewEvent("wasm-reply")) @@ -103,66 +101,40 @@ func TestDispatchSubmessages(t *testing.T) { return myEvents, [][]byte{[]byte("myData")}, [][]*codectypes.Any{}, nil }, }, - expData: []byte("myReplyData"), expCommits: []bool{true}, expEvents: []sdk.Event{ - { - Type: "myEvent", - Attributes: []abci.EventAttribute{{Key: "foo", Value: "bar"}}, - }, + {Type: "myEvent", Attributes: []abci.EventAttribute{{Key: "foo", Value: "bar"}}}, sdk.NewEvent("wasm-reply"), }, }, - "with context events - released on commit": { - msgs: []wasmvmtypes.SubMsg{{ - ReplyOn: wasmvmtypes.ReplyNever, - }}, - replyer: &mockReplyer{}, - msgHandler: &wasmtesting.MockMessageHandler{ - DispatchMsgFn: func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, msgResponses [][]*codectypes.Any, err error) { - myEvents := []sdk.Event{{Type: "myEvent", Attributes: []abci.EventAttribute{{Key: "foo", Value: "bar"}}}} - ctx.EventManager().EmitEvents(myEvents) - return nil, nil, [][]*codectypes.Any{}, nil - }, - }, - expCommits: []bool{true}, - expEvents: []sdk.Event{{ - Type: "myEvent", - Attributes: []abci.EventAttribute{{Key: "foo", Value: "bar"}}, - }}, - }, - "with context events - discarded on failure": { - msgs: []wasmvmtypes.SubMsg{{ - ReplyOn: wasmvmtypes.ReplyNever, - }}, - replyer: &mockReplyer{}, - msgHandler: &wasmtesting.MockMessageHandler{ - DispatchMsgFn: func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, msgResponses [][]*codectypes.Any, err error) { - myEvents := []sdk.Event{{Type: "myEvent", Attributes: []abci.EventAttribute{{Key: "foo", Value: "bar"}}}} - ctx.EventManager().EmitEvents(myEvents) - return nil, nil, [][]*codectypes.Any{}, errors.New("testing") - }, - }, - expCommits: []bool{false}, - expErr: true, - }, - "reply returns error": { - msgs: []wasmvmtypes.SubMsg{{ - ReplyOn: wasmvmtypes.ReplySuccess, - }}, - replyer: &mockReplyer{ - replyFn: func(ctx sdk.Context, contractAddress sdk.AccAddress, reply wasmvmtypes.Reply) ([]byte, error) { - return nil, errors.New("reply failed") - }, - }, - msgHandler: &wasmtesting.MockMessageHandler{ - DispatchMsgFn: func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, msgResponses [][]*codectypes.Any, err error) { - return nil, nil, [][]*codectypes.Any{}, nil - }, - }, - expCommits: []bool{false}, - expErr: true, - }, + } + + for name, spec := range specs { + t.Run(name, func(t *testing.T) { + ctx, mockStore, em := setupDispatchTest(t) + d := NewMessageDispatcher(spec.msgHandler, spec.replyer) + + _, err := d.DispatchSubmessages(ctx, RandomAccountAddress(t), "any_port", spec.msgs) + require.NoError(t, err) + assert.Equal(t, spec.expCommits, mockStore.Committed) + if len(spec.expEvents) == 0 { + assert.Empty(t, em.Events()) + } else { + assert.Equal(t, spec.expEvents, em.Events()) + } + }) + } +} + +func TestDispatchSubmessagesWithGasLimit(t *testing.T) { + var anyGasLimit uint64 = 1 + specs := map[string]struct { + msgs []wasmvmtypes.SubMsg + replyer *mockReplyer + msgHandler *wasmtesting.MockMessageHandler + expData []byte + expCommits []bool + }{ "with gas limit - out of gas": { msgs: []wasmvmtypes.SubMsg{{ GasLimit: &anyGasLimit, @@ -182,268 +154,17 @@ func TestDispatchSubmessages(t *testing.T) { expData: []byte("myReplyData"), expCommits: []bool{false}, }, - "with gas limit - within limit no error": { - msgs: []wasmvmtypes.SubMsg{{ - GasLimit: &anyGasLimit, - ReplyOn: wasmvmtypes.ReplyError, - }}, - replyer: &mockReplyer{}, - msgHandler: &wasmtesting.MockMessageHandler{ - DispatchMsgFn: func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, msgResponses [][]*codectypes.Any, err error) { - ctx.GasMeter().ConsumeGas(storetypes.Gas(1), "testing") - return nil, [][]byte{[]byte("someData")}, [][]*codectypes.Any{}, nil - }, - }, - expCommits: []bool{true}, - }, - "never reply - with nil response": { - msgs: []wasmvmtypes.SubMsg{{ID: 1, ReplyOn: wasmvmtypes.ReplyNever}, {ID: 2, ReplyOn: wasmvmtypes.ReplyNever}}, - replyer: &mockReplyer{}, - msgHandler: &wasmtesting.MockMessageHandler{ - DispatchMsgFn: func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, msgResponses [][]*codectypes.Any, err error) { - return nil, [][]byte{nil}, [][]*codectypes.Any{}, nil - }, - }, - expCommits: []bool{true, true}, - }, - "never reply - with any non nil response": { - msgs: []wasmvmtypes.SubMsg{{ID: 1, ReplyOn: wasmvmtypes.ReplyNever}, {ID: 2, ReplyOn: wasmvmtypes.ReplyNever}}, - replyer: &mockReplyer{}, - msgHandler: &wasmtesting.MockMessageHandler{ - DispatchMsgFn: func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, msgResponses [][]*codectypes.Any, err error) { - return nil, [][]byte{{}}, [][]*codectypes.Any{}, nil - }, - }, - expCommits: []bool{true, true}, - }, - "never reply - with error": { - msgs: []wasmvmtypes.SubMsg{{ID: 1, ReplyOn: wasmvmtypes.ReplyNever}, {ID: 2, ReplyOn: wasmvmtypes.ReplyNever}}, - replyer: &mockReplyer{}, - msgHandler: &wasmtesting.MockMessageHandler{ - DispatchMsgFn: func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, msgResponses [][]*codectypes.Any, err error) { - return nil, [][]byte{{}}, [][]*codectypes.Any{}, errors.New("testing") - }, - }, - expCommits: []bool{false, false}, - expErr: true, - }, - "multiple msg - last reply returned": { - msgs: []wasmvmtypes.SubMsg{{ID: 1, ReplyOn: wasmvmtypes.ReplyError}, {ID: 2, ReplyOn: wasmvmtypes.ReplyError}}, - replyer: &mockReplyer{ - replyFn: func(ctx sdk.Context, contractAddress sdk.AccAddress, reply wasmvmtypes.Reply) ([]byte, error) { - return []byte(fmt.Sprintf("myReplyData:%d", reply.ID)), nil - }, - }, - msgHandler: &wasmtesting.MockMessageHandler{ - DispatchMsgFn: func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, msgResponses [][]*codectypes.Any, err error) { - return nil, nil, [][]*codectypes.Any{}, errors.New("my error") - }, - }, - expData: []byte("myReplyData:2"), - expCommits: []bool{false, false}, - }, - "multiple msg - last non nil reply returned": { - msgs: []wasmvmtypes.SubMsg{{ID: 1, ReplyOn: wasmvmtypes.ReplyError}, {ID: 2, ReplyOn: wasmvmtypes.ReplyError}}, - replyer: &mockReplyer{ - replyFn: func(ctx sdk.Context, contractAddress sdk.AccAddress, reply wasmvmtypes.Reply) ([]byte, error) { - if reply.ID == 2 { - return nil, nil - } - return []byte("myReplyData:1"), nil - }, - }, - msgHandler: &wasmtesting.MockMessageHandler{ - DispatchMsgFn: func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, msgResponses [][]*codectypes.Any, err error) { - return nil, nil, [][]*codectypes.Any{}, errors.New("my error") - }, - }, - expData: []byte("myReplyData:1"), - expCommits: []bool{false, false}, - }, - "multiple msg - empty reply can overwrite result": { - msgs: []wasmvmtypes.SubMsg{{ID: 1, ReplyOn: wasmvmtypes.ReplyError}, {ID: 2, ReplyOn: wasmvmtypes.ReplyError}}, - replyer: &mockReplyer{ - replyFn: func(ctx sdk.Context, contractAddress sdk.AccAddress, reply wasmvmtypes.Reply) ([]byte, error) { - if reply.ID == 2 { - return []byte{}, nil - } - return []byte("myReplyData:1"), nil - }, - }, - msgHandler: &wasmtesting.MockMessageHandler{ - DispatchMsgFn: func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, msgResponses [][]*codectypes.Any, err error) { - return nil, nil, [][]*codectypes.Any{}, errors.New("my error") - }, - }, - expData: []byte{}, - expCommits: []bool{false, false}, - }, - "message event filtered without reply": { - msgs: []wasmvmtypes.SubMsg{{ - ReplyOn: wasmvmtypes.ReplyNever, - }}, - replyer: &mockReplyer{ - replyFn: func(ctx sdk.Context, contractAddress sdk.AccAddress, reply wasmvmtypes.Reply) ([]byte, error) { - return nil, errors.New("should never be called") - }, - }, - msgHandler: &wasmtesting.MockMessageHandler{ - DispatchMsgFn: func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, msgResponses [][]*codectypes.Any, err error) { - myEvents := []sdk.Event{ - sdk.NewEvent("message"), - sdk.NewEvent("execute", sdk.NewAttribute("foo", "bar")), - } - return myEvents, [][]byte{[]byte("myData")}, [][]*codectypes.Any{}, nil - }, - }, - expData: nil, - expCommits: []bool{true}, - expEvents: []sdk.Event{sdk.NewEvent("execute", sdk.NewAttribute("foo", "bar"))}, - }, - "wasm reply gets proper events": { - // put fake wasmmsg in here to show where it comes from - msgs: []wasmvmtypes.SubMsg{{ID: 1, ReplyOn: wasmvmtypes.ReplyAlways, Msg: wasmvmtypes.CosmosMsg{Wasm: &wasmvmtypes.WasmMsg{}}}}, - replyer: &mockReplyer{ - replyFn: func(ctx sdk.Context, contractAddress sdk.AccAddress, reply wasmvmtypes.Reply) ([]byte, error) { - if reply.Result.Err != "" { - return nil, errors.New(reply.Result.Err) - } - res := reply.Result.Ok - - // ensure the input events are what we expect - // I didn't use require.Equal() to act more like a contract... but maybe that would be better - if len(res.Events) != 2 { - return nil, fmt.Errorf("event count: %#v", res.Events) - } - if res.Events[0].Type != "execute" { - return nil, fmt.Errorf("event0: %#v", res.Events[0]) - } - if res.Events[1].Type != "wasm" { - return nil, fmt.Errorf("event1: %#v", res.Events[1]) - } - - // let's add a custom event here and see if it makes it out - ctx.EventManager().EmitEvent(sdk.NewEvent("wasm-reply")) - - // update data from what we got in - return res.Data, nil - }, - }, - msgHandler: &wasmtesting.MockMessageHandler{ - DispatchMsgFn: func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, msgResponses [][]*codectypes.Any, err error) { - events = []sdk.Event{ - sdk.NewEvent("message", sdk.NewAttribute("_contract_address", contractAddr.String())), - // we don't know what the contarctAddr will be so we can't use it in the final tests - sdk.NewEvent("execute", sdk.NewAttribute("_contract_address", "placeholder-random-addr")), - sdk.NewEvent("wasm", sdk.NewAttribute("random", "data")), - } - return events, [][]byte{[]byte("subData")}, [][]*codectypes.Any{}, nil - }, - }, - expData: []byte("subData"), - expCommits: []bool{true}, - expEvents: []sdk.Event{ - sdk.NewEvent("execute", sdk.NewAttribute("_contract_address", "placeholder-random-addr")), - sdk.NewEvent("wasm", sdk.NewAttribute("random", "data")), - sdk.NewEvent("wasm-reply"), - }, - }, - "wasm reply gets payload": { - // put fake wasmmsg in here to show where it comes from - msgs: []wasmvmtypes.SubMsg{{ID: 1, ReplyOn: wasmvmtypes.ReplyAlways, Payload: []byte("payloadData"), Msg: wasmvmtypes.CosmosMsg{Wasm: &wasmvmtypes.WasmMsg{}}}}, - replyer: &mockReplyer{ - replyFn: func(ctx sdk.Context, contractAddress sdk.AccAddress, reply wasmvmtypes.Reply) ([]byte, error) { - if reply.Result.Err != "" { - return nil, errors.New(reply.Result.Err) - } - - // ensure we got the payload - if !reflect.DeepEqual(reply.Payload, []byte("payloadData")) { - return nil, fmt.Errorf("payload mismatch: %s != 'payloadData'", reply.Payload) - } - - // update data from what we got in - return reply.Result.Ok.Data, nil - }, - }, - msgHandler: &wasmtesting.MockMessageHandler{ - DispatchMsgFn: func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, msgResponses [][]*codectypes.Any, err error) { - return nil, nil, [][]*codectypes.Any{}, nil - }, - }, - expCommits: []bool{true}, - }, - "non-wasm reply events get filtered": { - // show events from a stargate message gets filtered out - msgs: []wasmvmtypes.SubMsg{{ID: 1, ReplyOn: wasmvmtypes.ReplyAlways, Msg: wasmvmtypes.CosmosMsg{Any: &wasmvmtypes.AnyMsg{}}}}, - replyer: &mockReplyer{ - replyFn: func(ctx sdk.Context, contractAddress sdk.AccAddress, reply wasmvmtypes.Reply) ([]byte, error) { - if reply.Result.Err != "" { - return nil, errors.New(reply.Result.Err) - } - res := reply.Result.Ok - - // ensure the input events are what we expect - // I didn't use require.Equal() to act more like a contract... but maybe that would be better - if len(res.Events) != 0 { - return nil, errors.New("events not filtered out") - } - - // let's add a custom event here and see if it makes it out - ctx.EventManager().EmitEvent(sdk.NewEvent("stargate-reply")) - - // update data from what we got in - return res.Data, nil - }, - }, - msgHandler: &wasmtesting.MockMessageHandler{ - DispatchMsgFn: func(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, msgResponses [][]*codectypes.Any, err error) { - events = []sdk.Event{ - // this is filtered out - sdk.NewEvent("message", sdk.NewAttribute("stargate", "something-something")), - // we still emit this to the client, but not the contract - sdk.NewEvent("non-deterministic"), - } - return events, [][]byte{[]byte("subData")}, [][]*codectypes.Any{}, nil - }, - }, - expData: []byte("subData"), - expCommits: []bool{true}, - expEvents: []sdk.Event{ - sdk.NewEvent("non-deterministic"), - // the event from reply is also exposed - sdk.NewEvent("stargate-reply"), - }, - }, } + for name, spec := range specs { t.Run(name, func(t *testing.T) { - var mockStore wasmtesting.MockCommitMultiStore - em := sdk.NewEventManager() - ctx := sdk.Context{}.WithMultiStore(&mockStore). - WithGasMeter(storetypes.NewGasMeter(100)). - WithEventManager(em).WithLogger(log.NewTestLogger(t)) + ctx, mockStore, _ := setupDispatchTest(t) 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 - } - - // if we don't expect an error, we should get no error - require.NoError(t, gotErr) + gotData, err := d.DispatchSubmessages(ctx, RandomAccountAddress(t), "any_port", spec.msgs) + require.NoError(t, err) 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()) - } else { - assert.Equal(t, spec.expEvents, em.Events()) - } }) } } diff --git a/x/wasm/keeper/querier_test.go b/x/wasm/keeper/querier_test.go index dfae47c00f..0c1498e376 100644 --- a/x/wasm/keeper/querier_test.go +++ b/x/wasm/keeper/querier_test.go @@ -525,7 +525,7 @@ func TestQueryContractHistory(t *testing.T) { // when q := Querier(keeper) - got, gotErr := q.ContractHistory(xCtx, &spec.req) //nolint:gosec + got, gotErr := q.ContractHistory(xCtx, &spec.req) // then if spec.expErr != nil { @@ -602,7 +602,7 @@ func TestQueryCodeList(t *testing.T) { } // when q := Querier(keeper) - got, gotErr := q.Codes(xCtx, &spec.req) //nolint:gosec + got, gotErr := q.Codes(xCtx, &spec.req) // then if spec.expErr != nil { @@ -674,7 +674,7 @@ func TestQueryContractInfo(t *testing.T) { for name, spec := range specs { t.Run(name, func(t *testing.T) { xCtx, _ := ctx.CacheContext() - k.mustStoreContractInfo(xCtx, contractAddr, &spec.stored) //nolint:gosec + k.mustStoreContractInfo(xCtx, contractAddr, &spec.stored) // when gotRsp, gotErr := querier.ContractInfo(xCtx, spec.src) if spec.expErr { diff --git a/x/wasm/keeper/query_plugins.go b/x/wasm/keeper/query_plugins.go index 2bb2246968..3712b8812e 100644 --- a/x/wasm/keeper/query_plugins.go +++ b/x/wasm/keeper/query_plugins.go @@ -9,7 +9,7 @@ import ( wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" abci "github.com/cometbft/cometbft/abci/types" "github.com/cosmos/gogoproto/proto" - channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" + channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" errorsmod "cosmossdk.io/errors" storetypes "cosmossdk.io/store/types" diff --git a/x/wasm/keeper/query_plugins_test.go b/x/wasm/keeper/query_plugins_test.go index 76dd64aa64..30eaf60c2a 100644 --- a/x/wasm/keeper/query_plugins_test.go +++ b/x/wasm/keeper/query_plugins_test.go @@ -9,7 +9,7 @@ import ( wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" dbm "github.com/cosmos/cosmos-db" - channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" + channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/x/wasm/keeper/relay.go b/x/wasm/keeper/relay.go index a12293197b..f99e8f7e38 100644 --- a/x/wasm/keeper/relay.go +++ b/x/wasm/keeper/relay.go @@ -4,9 +4,9 @@ import ( "time" wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" - clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" - channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" - ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" + clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" + channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" + ibcexported "github.com/cosmos/ibc-go/v9/modules/core/exported" errorsmod "cosmossdk.io/errors" diff --git a/x/wasm/keeper/submsg_test.go b/x/wasm/keeper/submsg_test.go index ba3129a174..5ee50c8c60 100644 --- a/x/wasm/keeper/submsg_test.go +++ b/x/wasm/keeper/submsg_test.go @@ -3,7 +3,6 @@ package keeper import ( "encoding/json" "fmt" - "os" "strconv" "testing" @@ -105,255 +104,143 @@ func TestDispatchSubMsgSuccessCase(t *testing.T) { require.Len(t, sub.Events, 0) } -func TestDispatchSubMsgErrorHandling(t *testing.T) { - fundedDenom := "funds" - fundedAmount := 1_000_000 - ctxGasLimit := uint64(1_000_000) - subGasLimit := uint64(300_000) - - // prep - create one chain and upload the code +func setupSubMsgTest(t *testing.T) (sdk.Context, TestKeepers, sdk.AccAddress, []sdk.Coin) { ctx, keepers := CreateTestInput(t, false, ReflectCapabilities) ctx = ctx.WithGasMeter(storetypes.NewInfiniteGasMeter()) ctx = ctx.WithBlockGasMeter(storetypes.NewInfiniteGasMeter()) - keeper := keepers.WasmKeeper - contractStart := sdk.NewCoins(sdk.NewInt64Coin(fundedDenom, int64(fundedAmount))) + + contractStart := sdk.NewCoins(sdk.NewInt64Coin("funds", 1_000_000)) uploader := keepers.Faucet.NewFundedRandomAccount(ctx, contractStart.Add(contractStart...)...) - // upload code + return ctx, keepers, uploader, contractStart +} + +func TestDispatchSubMsgValidSend(t *testing.T) { + ctx, keepers, uploader, contractStart := setupSubMsgTest(t) + + // upload code and instantiate reflectID, _, err := keepers.ContractKeeper.Create(ctx, uploader, testdata.ReflectContractWasm(), nil) require.NoError(t, err) - // create hackatom contract for testing (for infinite loop) - hackatomCode, err := os.ReadFile("./testdata/hackatom.wasm") - require.NoError(t, err) - hackatomID, _, err := keepers.ContractKeeper.Create(ctx, uploader, hackatomCode, nil) - require.NoError(t, err) - _, bob := keyPubAddr() - _, fred := keyPubAddr() - initMsg := HackatomExampleInitMsg{ - Verifier: fred, - Beneficiary: bob, - } - initMsgBz, err := json.Marshal(initMsg) + creator := keepers.Faucet.NewFundedRandomAccount(ctx, contractStart...) + _, empty := keyPubAddr() + + contractAddr, _, err := keepers.ContractKeeper.Instantiate(ctx, reflectID, creator, nil, []byte("{}"), "valid send test", contractStart) require.NoError(t, err) - hackatomAddr, _, err := keepers.ContractKeeper.Instantiate(ctx, hackatomID, uploader, nil, initMsgBz, "hackatom demo", contractStart) + + // test valid send + msg := validBankSend(contractAddr.String(), empty.String(), "funds", 500_000) + resp := executeSubmsg(t, ctx, keepers, contractAddr, creator, msg, 5, nil) + + require.Empty(t, resp.Result.Err) + require.NotNil(t, resp.Result.Ok) + require.Empty(t, resp.Result.Ok.Events) + assertGasUsed(t, ctx, 110_000, 112_000) +} + +func TestDispatchSubMsgInvalidSend(t *testing.T) { + ctx, keepers, uploader, contractStart := setupSubMsgTest(t) + + // upload code and instantiate + reflectID, _, err := keepers.ContractKeeper.Create(ctx, uploader, testdata.ReflectContractWasm(), nil) require.NoError(t, err) - validBankSend := func(contract, emptyAccount string) wasmvmtypes.CosmosMsg { - return wasmvmtypes.CosmosMsg{ - Bank: &wasmvmtypes.BankMsg{ - Send: &wasmvmtypes.SendMsg{ - ToAddress: emptyAccount, - Amount: []wasmvmtypes.Coin{{ - Denom: fundedDenom, - Amount: strconv.Itoa(fundedAmount / 2), - }}, - }, - }, - } - } + creator := keepers.Faucet.NewFundedRandomAccount(ctx, contractStart...) + _, empty := keyPubAddr() - invalidBankSend := func(contract, emptyAccount string) wasmvmtypes.CosmosMsg { - return wasmvmtypes.CosmosMsg{ - Bank: &wasmvmtypes.BankMsg{ - Send: &wasmvmtypes.SendMsg{ - ToAddress: emptyAccount, - Amount: []wasmvmtypes.Coin{{ - Denom: fundedDenom, - Amount: strconv.Itoa(fundedAmount * 2), - }}, - }, - }, - } - } + contractAddr, _, err := keepers.ContractKeeper.Instantiate(ctx, reflectID, creator, nil, []byte("{}"), "invalid send test", contractStart) + require.NoError(t, err) - infiniteLoop := func(contract, emptyAccount string) wasmvmtypes.CosmosMsg { - return wasmvmtypes.CosmosMsg{ - Wasm: &wasmvmtypes.WasmMsg{ - Execute: &wasmvmtypes.ExecuteMsg{ - ContractAddr: hackatomAddr.String(), - Msg: []byte(`{"cpu_loop":{}}`), - }, - }, - } - } + // test invalid send + msg := invalidBankSend(contractAddr.String(), empty.String(), "funds", 2_000_000) + resp := executeSubmsg(t, ctx, keepers, contractAddr, creator, msg, 6, nil) - instantiateContract := func(contract, emptyAccount string) wasmvmtypes.CosmosMsg { - return wasmvmtypes.CosmosMsg{ - Wasm: &wasmvmtypes.WasmMsg{ - Instantiate: &wasmvmtypes.InstantiateMsg{ - CodeID: reflectID, - Msg: []byte("{}"), - Label: "subcall reflect", - }, - }, - } - } + require.NotEmpty(t, resp.Result.Err) + require.Nil(t, resp.Result.Ok) + require.Contains(t, resp.Result.Err, "codespace: sdk, code: 5") + assertGasUsed(t, ctx, 78_000, 81_000) +} - type assertion func(t *testing.T, ctx sdk.Context, contract, emptyAccount string, response wasmvmtypes.SubMsgResult) +func TestDispatchSubMsgWithGasLimit(t *testing.T) { + ctx, keepers, uploader, contractStart := setupSubMsgTest(t) + subGasLimit := uint64(300_000) - assertReturnedEvents := func(expectedEvents int) assertion { - return func(t *testing.T, ctx sdk.Context, contract, emptyAccount string, response wasmvmtypes.SubMsgResult) { - require.Len(t, response.Ok.Events, expectedEvents) - } - } + // upload code and instantiate + reflectID, _, err := keepers.ContractKeeper.Create(ctx, uploader, testdata.ReflectContractWasm(), nil) + require.NoError(t, err) - assertGasUsed := func(minGas, maxGas uint64) assertion { - return func(t *testing.T, ctx sdk.Context, contract, emptyAccount string, response wasmvmtypes.SubMsgResult) { - gasUsed := ctx.GasMeter().GasConsumed() - assert.True(t, gasUsed >= minGas, "Used %d gas (less than expected %d)", gasUsed, minGas) - assert.True(t, gasUsed <= maxGas, "Used %d gas (more than expected %d)", gasUsed, maxGas) - } - } + creator := keepers.Faucet.NewFundedRandomAccount(ctx, contractStart...) + _, empty := keyPubAddr() - assertErrorString := func(shouldContain string) assertion { - return func(t *testing.T, ctx sdk.Context, contract, emptyAccount string, response wasmvmtypes.SubMsgResult) { - assert.Contains(t, response.Err, shouldContain) - } - } + contractAddr, _, err := keepers.ContractKeeper.Instantiate(ctx, reflectID, creator, nil, []byte("{}"), "gas limit test", contractStart) + require.NoError(t, err) - assertGotContractAddr := func(t *testing.T, ctx sdk.Context, contract, emptyAccount string, response wasmvmtypes.SubMsgResult) { - // should get the events emitted on new contract - event := response.Ok.Events[0] - require.Equal(t, event.Type, "instantiate") - assert.Equal(t, event.Attributes[0].Key, "_contract_address") - eventAddr := event.Attributes[0].Value - assert.NotEqual(t, contract, eventAddr) - - var res types.MsgInstantiateContractResponse - keepers.EncodingConfig.Codec.MustUnmarshal(response.Ok.Data, &res) - assert.Equal(t, eventAddr, res.Address) - } + // test with gas limit + msg := validBankSend(contractAddr.String(), empty.String(), "funds", 500_000) + resp := executeSubmsg(t, ctx, keepers, contractAddr, creator, msg, 15, &subGasLimit) - cases := map[string]struct { - submsgID uint64 - // we will generate message from the - msg func(contract, emptyAccount string) wasmvmtypes.CosmosMsg - gasLimit *uint64 - - // true if we expect this to throw out of gas panic - isOutOfGasPanic bool - // true if we expect this execute to return an error (can be false when submessage errors) - executeError bool - // true if we expect submessage to return an error (but execute to return success) - subMsgError bool - // make assertions after dispatch - resultAssertions []assertion - }{ - "send tokens": { - submsgID: 5, - msg: validBankSend, - resultAssertions: []assertion{assertReturnedEvents(0), assertGasUsed(110_000, 112_000)}, - }, - "not enough tokens": { - submsgID: 6, - msg: invalidBankSend, - subMsgError: true, - // uses less gas than the send tokens (cost of bank transfer) - resultAssertions: []assertion{assertGasUsed(78_000, 81_000), assertErrorString("codespace: sdk, code: 5")}, - }, - "out of gas panic with no gas limit": { - submsgID: 7, - msg: infiniteLoop, - isOutOfGasPanic: true, - }, + require.Empty(t, resp.Result.Err) + require.NotNil(t, resp.Result.Ok) + require.Empty(t, resp.Result.Ok.Events) + assertGasUsed(t, ctx, 110_000, 112_000) +} - "send tokens with limit": { - submsgID: 15, - 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(110_000, 112_000)}, - }, - "not enough tokens with limit": { - submsgID: 16, - msg: invalidBankSend, - subMsgError: true, - gasLimit: &subGasLimit, - // uses same gas as call without limit (note we do not charge the 40k on reply) - resultAssertions: []assertion{assertGasUsed(78_000, 81_000), assertErrorString("codespace: sdk, code: 5")}, - }, - "out of gas caught with gas limit": { - submsgID: 17, - msg: infiniteLoop, - subMsgError: true, - gasLimit: &subGasLimit, - // uses all the subGasLimit, plus the 52k or so for the main contract - resultAssertions: []assertion{assertGasUsed(subGasLimit+75_000, subGasLimit+77_000), assertErrorString("codespace: sdk, code: 11")}, - }, - "instantiate contract gets address in data and events": { - submsgID: 21, - msg: instantiateContract, - resultAssertions: []assertion{assertReturnedEvents(1), assertGotContractAddr}, +func validBankSend(_, emptyAccount, denom string, amount int) wasmvmtypes.CosmosMsg { + return wasmvmtypes.CosmosMsg{ + Bank: &wasmvmtypes.BankMsg{ + Send: &wasmvmtypes.SendMsg{ + ToAddress: emptyAccount, + Amount: []wasmvmtypes.Coin{{ + Denom: denom, + Amount: strconv.Itoa(amount), + }}, + }, }, } - for name, tc := range cases { - t.Run(name, func(t *testing.T) { - creator := keepers.Faucet.NewFundedRandomAccount(ctx, contractStart...) - _, empty := keyPubAddr() +} - contractAddr, _, err := keepers.ContractKeeper.Instantiate(ctx, reflectID, creator, nil, []byte("{}"), fmt.Sprintf("contract %s", name), contractStart) - require.NoError(t, err) +func invalidBankSend(contract, emptyAccount, denom string, amount int) wasmvmtypes.CosmosMsg { + return validBankSend(contract, emptyAccount, denom, amount) +} - msg := tc.msg(contractAddr.String(), empty.String()) - reflectSend := testdata.ReflectHandleMsg{ - ReflectSubMsg: &testdata.ReflectSubPayload{ - Msgs: []wasmvmtypes.SubMsg{{ - ID: tc.submsgID, - Msg: msg, - GasLimit: tc.gasLimit, - ReplyOn: wasmvmtypes.ReplyAlways, - }}, - }, - } - reflectSendBz, err := json.Marshal(reflectSend) - require.NoError(t, err) +func executeSubmsg(t *testing.T, ctx sdk.Context, keepers TestKeepers, contractAddr, creator sdk.AccAddress, msg wasmvmtypes.CosmosMsg, submsgID uint64, gasLimit *uint64) wasmvmtypes.Reply { + reflectSend := testdata.ReflectHandleMsg{ + ReflectSubMsg: &testdata.ReflectSubPayload{ + Msgs: []wasmvmtypes.SubMsg{{ + ID: submsgID, + Msg: msg, + GasLimit: gasLimit, + ReplyOn: wasmvmtypes.ReplyAlways, + }}, + }, + } + reflectSendBz, err := json.Marshal(reflectSend) + require.NoError(t, err) - execCtx := ctx.WithGasMeter(storetypes.NewGasMeter(ctxGasLimit)) - defer func() { - if tc.isOutOfGasPanic { - r := recover() - require.NotNil(t, r, "expected panic") - if _, ok := r.(storetypes.ErrorOutOfGas); !ok { - t.Fatalf("Expected OutOfGas panic, got: %#v\n", r) - } - } - }() - _, err = keepers.ContractKeeper.Execute(execCtx, contractAddr, creator, reflectSendBz, nil) - - if tc.executeError { - require.Error(t, err) - } else { - require.NoError(t, err) + _, err = keepers.ContractKeeper.Execute(ctx, contractAddr, creator, reflectSendBz, nil) + require.NoError(t, err) - // query the reply - query := testdata.ReflectQueryMsg{ - SubMsgResult: &testdata.SubCall{ID: tc.submsgID}, - } - queryBz, err := json.Marshal(query) - require.NoError(t, err) - queryRes, err := keeper.QuerySmart(ctx, contractAddr, queryBz) - require.NoError(t, err) - var res wasmvmtypes.Reply - err = json.Unmarshal(queryRes, &res) - require.NoError(t, err) - assert.Equal(t, tc.submsgID, res.ID) + // query the reply + query := testdata.ReflectQueryMsg{ + SubMsgResult: &testdata.SubCall{ID: submsgID}, + } + queryBz, err := json.Marshal(query) + require.NoError(t, err) + queryRes, err := keepers.WasmKeeper.QuerySmart(ctx, contractAddr, queryBz) + require.NoError(t, err) - if tc.subMsgError { - require.NotEmpty(t, res.Result.Err) - require.Nil(t, res.Result.Ok) - } else { - require.Empty(t, res.Result.Err) - require.NotNil(t, res.Result.Ok) - } + var res wasmvmtypes.Reply + err = json.Unmarshal(queryRes, &res) + require.NoError(t, err) + assert.Equal(t, submsgID, res.ID) - for _, assertion := range tc.resultAssertions { - assertion(t, execCtx, contractAddr.String(), empty.String(), res.Result) - } + return res +} - } - }) - } +func assertGasUsed(t *testing.T, ctx sdk.Context, minGas, maxGas uint64) { + gasUsed := ctx.GasMeter().GasConsumed() + assert.True(t, gasUsed >= minGas, "Used %d gas (less than expected %d)", gasUsed, minGas) + assert.True(t, gasUsed <= maxGas, "Used %d gas (more than expected %d)", gasUsed, maxGas) } // Test an error case, where the Encoded doesn't return any sdk.Msg and we trigger(ed) a null pointer exception. diff --git a/x/wasm/keeper/test_common.go b/x/wasm/keeper/test_common.go index eb1285b759..c9f10d4158 100644 --- a/x/wasm/keeper/test_common.go +++ b/x/wasm/keeper/test_common.go @@ -17,11 +17,11 @@ import ( "github.com/cosmos/ibc-go/modules/capability" capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" - "github.com/cosmos/ibc-go/v8/modules/apps/transfer" - ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" - ibc "github.com/cosmos/ibc-go/v8/modules/core" - ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" - ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper" + "github.com/cosmos/ibc-go/v9/modules/apps/transfer" + ibctransfertypes "github.com/cosmos/ibc-go/v9/modules/apps/transfer/types" + ibc "github.com/cosmos/ibc-go/v9/modules/core" + ibcexported "github.com/cosmos/ibc-go/v9/modules/core/exported" + ibckeeper "github.com/cosmos/ibc-go/v9/modules/core/keeper" "github.com/stretchr/testify/require" errorsmod "cosmossdk.io/errors" @@ -378,7 +378,6 @@ func createTestInput( appCodec, keys[ibcexported.StoreKey], subspace(ibcexported.ModuleName), - stakingKeeper, upgradeKeeper, scopedIBCKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), diff --git a/x/wasm/keeper/wasmtesting/mock_keepers.go b/x/wasm/keeper/wasmtesting/mock_keepers.go index 5c5f2a7f63..01b9b16b3f 100644 --- a/x/wasm/keeper/wasmtesting/mock_keepers.go +++ b/x/wasm/keeper/wasmtesting/mock_keepers.go @@ -6,9 +6,9 @@ import ( wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" - clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" - channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" - ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" + clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" + channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" + ibcexported "github.com/cosmos/ibc-go/v9/modules/core/exported" sdk "github.com/cosmos/cosmos-sdk/types" diff --git a/x/wasm/types/events.go b/x/wasm/types/events.go index db44bb4da7..517db99f42 100644 --- a/x/wasm/types/events.go +++ b/x/wasm/types/events.go @@ -3,7 +3,7 @@ package types import ( "fmt" - "github.com/cosmos/ibc-go/v8/modules/core/exported" + "github.com/cosmos/ibc-go/v9/modules/core/exported" sdk "github.com/cosmos/cosmos-sdk/types" ) diff --git a/x/wasm/types/expected_keepers.go b/x/wasm/types/expected_keepers.go index e3c60fa23b..da5e965f9e 100644 --- a/x/wasm/types/expected_keepers.go +++ b/x/wasm/types/expected_keepers.go @@ -4,10 +4,10 @@ import ( "context" capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" - clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" - connectiontypes "github.com/cosmos/ibc-go/v8/modules/core/03-connection/types" - channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" - ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" + clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types" + connectiontypes "github.com/cosmos/ibc-go/v9/modules/core/03-connection/types" + channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" + ibcexported "github.com/cosmos/ibc-go/v9/modules/core/exported" sdk "github.com/cosmos/cosmos-sdk/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" diff --git a/x/wasm/types/exported_keepers.go b/x/wasm/types/exported_keepers.go index b9d953baab..7a044cd498 100644 --- a/x/wasm/types/exported_keepers.go +++ b/x/wasm/types/exported_keepers.go @@ -5,8 +5,8 @@ import ( wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" - channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" - ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" + channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types" + ibcexported "github.com/cosmos/ibc-go/v9/modules/core/exported" sdk "github.com/cosmos/cosmos-sdk/types" ) diff --git a/x/wasm/types/proposal_legacy_test.go b/x/wasm/types/proposal_legacy_test.go index 71318be453..bbc769ec25 100644 --- a/x/wasm/types/proposal_legacy_test.go +++ b/x/wasm/types/proposal_legacy_test.go @@ -995,7 +995,7 @@ code_ids: } for msg, spec := range specs { t.Run(msg, func(t *testing.T) { - v, err := yaml.Marshal(&spec.src) //nolint:gosec + v, err := yaml.Marshal(&spec.src) require.NoError(t, err) assert.Equal(t, spec.exp, string(v)) }) diff --git a/x/wasm/types/test_fixtures.go b/x/wasm/types/test_fixtures.go index e1d03c59c7..3557a7d48a 100644 --- a/x/wasm/types/test_fixtures.go +++ b/x/wasm/types/test_fixtures.go @@ -49,7 +49,7 @@ func GenesisFixture(mutators ...func(*GenesisState)) GenesisState { func randBytes(n int) []byte { r := make([]byte, n) - rand.Read(r) //nolint:staticcheck + rand.Read(r) return r }