diff --git a/go.mod b/go.mod index a20cc0e00f..cd4a4cb823 100644 --- a/go.mod +++ b/go.mod @@ -175,7 +175,7 @@ require ( require github.com/confio/ics23/go v0.9.0 // indirect replace ( - github.com/cosmos/cosmos-sdk => github.com/notional-labs/cosmos-sdk v0.47.2-0.20230414131805-781d3665d7a0 + github.com/cosmos/cosmos-sdk => github.com/notional-labs/cosmos-sdk v0.47.2-0.20230424022356-49c2e39f3fe6 github.com/cosmos/ibc-go/v7 => github.com/notional-labs/ibc-go/v7 v7.0.0-rc0.0.20230417042817-8072b1e9aabc // following versions might cause unexpected behavior diff --git a/go.sum b/go.sum index 5fe52945bf..da81ed915a 100644 --- a/go.sum +++ b/go.sum @@ -919,8 +919,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/neilotoole/errgroup v0.1.6/go.mod h1:Q2nLGf+594h0CLBs/Mbg6qOr7GtqDK7C2S41udRnToE= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= -github.com/notional-labs/cosmos-sdk v0.47.2-0.20230414131805-781d3665d7a0 h1:SsOek50tnVAUTHaH65bNwbg5UzPf5soh5x2j/DPGGTY= -github.com/notional-labs/cosmos-sdk v0.47.2-0.20230414131805-781d3665d7a0/go.mod h1:14tO5KQaTrl2q3OxBnDRfue7TRN9zkXS0cLutrSqkOo= +github.com/notional-labs/cosmos-sdk v0.47.2-0.20230424022356-49c2e39f3fe6 h1:/66obfC6FRb8phL73iqj1N7yrKw/7vfwdTkaJ9AO4/o= +github.com/notional-labs/cosmos-sdk v0.47.2-0.20230424022356-49c2e39f3fe6/go.mod h1:14tO5KQaTrl2q3OxBnDRfue7TRN9zkXS0cLutrSqkOo= github.com/notional-labs/ibc-go/v7 v7.0.0-rc0.0.20230417042817-8072b1e9aabc h1:2qZf+B37YnoHcmXnB87VfcrVC50I+LZWeWu4ZEAddsc= github.com/notional-labs/ibc-go/v7 v7.0.0-rc0.0.20230417042817-8072b1e9aabc/go.mod h1:BFh8nKWjr5zeR2OZfhkzdgDzj1+KjRn3aJLpwapStj8= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= diff --git a/legacy_ibc_testing/testing/app.go b/legacy_ibc_testing/testing/app.go index 0955e7f3e1..842fc6b722 100644 --- a/legacy_ibc_testing/testing/app.go +++ b/legacy_ibc_testing/testing/app.go @@ -65,6 +65,8 @@ func SetupWithGenesisValSet(t *testing.T, appIniter AppIniter, valSet *tmtypes.V t.Helper() app, genesisState := appIniter() + baseapp.SetChainID(chainID)(app.GetBaseApp()) + // set genesis accounts authGenesis := authtypes.NewGenesisState(authtypes.DefaultParams(), genAccs) genesisState[authtypes.ModuleName] = app.AppCodec().MustMarshalJSON(authGenesis) diff --git a/tests/difference/core/driver/setup.go b/tests/difference/core/driver/setup.go index 484e038a0c..15bddba444 100644 --- a/tests/difference/core/driver/setup.go +++ b/tests/difference/core/driver/setup.go @@ -9,6 +9,7 @@ import ( abci "github.com/cometbft/cometbft/abci/types" tmproto "github.com/cometbft/cometbft/proto/tendermint/types" tmtypes "github.com/cometbft/cometbft/types" + "github.com/cosmos/cosmos-sdk/baseapp" codectypes "github.com/cosmos/cosmos-sdk/codec/types" cosmosEd25519 "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" @@ -244,6 +245,8 @@ func (b *Builder) newChain( ) *ibctesting.TestChain { app, genesis := appInit() + baseapp.SetChainID(chainID)(app.GetBaseApp()) + stateBytes, senderAccounts := b.getAppBytesAndSenders(chainID, app, genesis, validators) app.InitChain( diff --git a/x/ccv/consumer/keeper/genesis.go b/x/ccv/consumer/keeper/genesis.go index 223c0133c7..5f044f0c45 100644 --- a/x/ccv/consumer/keeper/genesis.go +++ b/x/ccv/consumer/keeper/genesis.go @@ -114,7 +114,7 @@ func (k Keeper) InitGenesis(ctx sdk.Context, state *consumertypes.GenesisState) // ExportGenesis returns the CCV consumer module's exported genesis func (k Keeper) ExportGenesis(ctx sdk.Context) (genesis *consumertypes.GenesisState) { - params := k.GetParams(ctx) + params := k.GetConsumerParams(ctx) if !params.Enabled { return consumertypes.DefaultGenesisState() } diff --git a/x/ccv/consumer/keeper/genesis_test.go b/x/ccv/consumer/keeper/genesis_test.go index cc876817f9..f15967f754 100644 --- a/x/ccv/consumer/keeper/genesis_test.go +++ b/x/ccv/consumer/keeper/genesis_test.go @@ -123,7 +123,7 @@ func TestInitGenesis(t *testing.T) { assertHeightValsetUpdateIDs(t, ctx, &ck, defaultHeightValsetUpdateIDs) require.Equal(t, validator.Address.Bytes(), ck.GetAllCCValidator(ctx)[0].Address) - require.Equal(t, gs.Params, ck.GetParams(ctx)) + require.Equal(t, gs.Params, ck.GetConsumerParams(ctx)) }, }, { "restart a chain without an established CCV channel", @@ -150,7 +150,7 @@ func TestInitGenesis(t *testing.T) { assertHeightValsetUpdateIDs(t, ctx, &ck, defaultHeightValsetUpdateIDs) assertProviderClientID(t, ctx, &ck, provClientID) require.Equal(t, validator.Address.Bytes(), ck.GetAllCCValidator(ctx)[0].Address) - require.Equal(t, gs.Params, ck.GetParams(ctx)) + require.Equal(t, gs.Params, ck.GetConsumerParams(ctx)) }, }, { "restart a chain with an established CCV channel", @@ -194,7 +194,7 @@ func TestInitGenesis(t *testing.T) { assertHeightValsetUpdateIDs(t, ctx, &ck, updatedHeightValsetUpdateIDs) assertProviderClientID(t, ctx, &ck, provClientID) - require.Equal(t, gs.Params, ck.GetParams(ctx)) + require.Equal(t, gs.Params, ck.GetConsumerParams(ctx)) }, }, } diff --git a/x/ccv/consumer/keeper/grpc_query.go b/x/ccv/consumer/keeper/grpc_query.go index b82b3db7e4..5dd93ba823 100644 --- a/x/ccv/consumer/keeper/grpc_query.go +++ b/x/ccv/consumer/keeper/grpc_query.go @@ -34,7 +34,7 @@ func (k Keeper) QueryParams(c context.Context, return nil, status.Errorf(codes.InvalidArgument, "empty request") } - p := k.GetParams(ctx) + p := k.GetConsumerParams(ctx) return &types.QueryParamsResponse{Params: p}, nil } diff --git a/x/ccv/consumer/keeper/params.go b/x/ccv/consumer/keeper/params.go index 69e975f702..c3bd4c4dd5 100644 --- a/x/ccv/consumer/keeper/params.go +++ b/x/ccv/consumer/keeper/params.go @@ -4,13 +4,14 @@ import ( "time" sdk "github.com/cosmos/cosmos-sdk/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/cosmos/interchain-security/x/ccv/consumer/types" ccvtypes "github.com/cosmos/interchain-security/x/ccv/types" ) // GetParams returns the params for the consumer ccv module -func (k Keeper) GetParams(ctx sdk.Context) types.Params { +func (k Keeper) GetConsumerParams(ctx sdk.Context) types.Params { return types.NewParams( k.GetEnabled(ctx), k.GetBlocksPerDistributionTransmission(ctx), @@ -30,6 +31,11 @@ func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { k.paramStore.SetParamSet(ctx, ¶ms) } +// GetParams implement from staking keeper +func (k Keeper) GetParams(ctx sdk.Context) stakingtypes.Params { + return stakingtypes.DefaultParams() +} + // GetEnabled returns the enabled flag for the consumer module func (k Keeper) GetEnabled(ctx sdk.Context) bool { var enabled bool diff --git a/x/ccv/consumer/keeper/params_test.go b/x/ccv/consumer/keeper/params_test.go index 6b3dcd57e1..70775266f5 100644 --- a/x/ccv/consumer/keeper/params_test.go +++ b/x/ccv/consumer/keeper/params_test.go @@ -29,14 +29,14 @@ func TestParams(t *testing.T) { types.DefaultSoftOptOutThreshold, ) // these are the default params, IBC suite independently sets enabled=true - params := consumerKeeper.GetParams(ctx) + params := consumerKeeper.GetConsumerParams(ctx) require.Equal(t, expParams, params) newParams := types.NewParams(false, 1000, "channel-2", "cosmos19pe9pg5dv9k5fzgzmsrgnw9rl9asf7ddwhu7lm", 7*24*time.Hour, 25*time.Hour, "0.5", 500, 24*21*time.Hour, "0.05") consumerKeeper.SetParams(ctx, newParams) - params = consumerKeeper.GetParams(ctx) + params = consumerKeeper.GetConsumerParams(ctx) require.Equal(t, newParams, params) consumerKeeper.SetBlocksPerDistributionTransmission(ctx, 10) diff --git a/x/ccv/consumer/keeper/validators.go b/x/ccv/consumer/keeper/validators.go index b3e7bee27d..5e244bf681 100644 --- a/x/ccv/consumer/keeper/validators.go +++ b/x/ccv/consumer/keeper/validators.go @@ -3,6 +3,7 @@ package keeper import ( "time" + "cosmossdk.io/math" cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" abci "github.com/cometbft/cometbft/abci/types" @@ -149,6 +150,13 @@ func (k Keeper) Slash(ctx sdk.Context, addr sdk.ConsAddress, infractionHeight, p ) } +// implement for stakingkeeper Interface +func (k Keeper) SlashWithInfractionReason(ctx sdk.Context, consAddr sdk.ConsAddress, infractionHeight, power int64, slashFactor sdk.Dec, infractionType stakingtypes.Infraction) math.Int { + k.Slash(ctx, consAddr, infractionHeight, power, slashFactor, infractionType) + // Only return to comply with the interface restriction + return math.ZeroInt() +} + // Jail - unimplemented on CCV keeper // // This method should be a no-op even during a standalone to consumer changeover.