chore: remove direct reliance on staking from slashing (#12177)
This commit is contained in:
@@ -78,7 +78,6 @@ require (
|
||||
github.com/cenkalti/backoff/v4 v4.1.1 // indirect
|
||||
github.com/cespare/xxhash v1.1.0 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.1.2 // indirect
|
||||
github.com/cosmos/cosmos-sdk/store/tools/ics23 v0.0.0-20220603170123-fc0238903061 // indirect
|
||||
github.com/cosmos/ledger-go v0.9.2 // indirect
|
||||
github.com/creachadair/taskgroup v0.3.2 // indirect
|
||||
github.com/danieljoos/wincred v1.0.2 // indirect
|
||||
|
||||
@@ -291,8 +291,6 @@ github.com/cosmos/btcutil v1.0.4 h1:n7C2ngKXo7UC9gNyMNLbzqz7Asuf+7Qv4gnX/rOdQ44=
|
||||
github.com/cosmos/btcutil v1.0.4/go.mod h1:Ffqc8Hn6TJUdDgHBwIZLtrLQC1KdJ9jGJl/TvgUaxbU=
|
||||
github.com/cosmos/cosmos-proto v1.0.0-alpha7 h1:yqYUOHF2jopwZh4dVQp3xgqwftE5/2hkrwIV6vkUbO0=
|
||||
github.com/cosmos/cosmos-proto v1.0.0-alpha7/go.mod h1:dosO4pSAbJF8zWCzCoTWP7nNsjcvSUBQmniFxDg5daw=
|
||||
github.com/cosmos/cosmos-sdk/store/tools/ics23 v0.0.0-20220603170123-fc0238903061 h1:ERjwnZ8dFB+78pNDPoplaYJ+wdzc4Z0v+CcBS1ehalY=
|
||||
github.com/cosmos/cosmos-sdk/store/tools/ics23 v0.0.0-20220603170123-fc0238903061/go.mod h1:EOXK+a/6yV5rT46k8UaI56UwE+AU1uq712wy6IbG5+E=
|
||||
github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY=
|
||||
github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw=
|
||||
github.com/cosmos/iavl v0.18.0 h1:02ur4vnalMR2GuWCFNkuseUcl/BCVmg9tOeHOGiZOkE=
|
||||
|
||||
@@ -20,7 +20,6 @@ import (
|
||||
"github.com/cosmos/cosmos-sdk/x/distribution/keeper"
|
||||
"github.com/cosmos/cosmos-sdk/x/distribution/simulation"
|
||||
"github.com/cosmos/cosmos-sdk/x/distribution/types"
|
||||
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -89,13 +88,13 @@ type AppModule struct {
|
||||
keeper keeper.Keeper
|
||||
accountKeeper types.AccountKeeper
|
||||
bankKeeper types.BankKeeper
|
||||
stakingKeeper *stakingkeeper.Keeper
|
||||
stakingKeeper types.StakingKeeper
|
||||
}
|
||||
|
||||
// NewAppModule creates a new AppModule object
|
||||
func NewAppModule(
|
||||
cdc codec.Codec, keeper keeper.Keeper, accountKeeper types.AccountKeeper,
|
||||
bankKeeper types.BankKeeper, stakingKeeper *stakingkeeper.Keeper,
|
||||
bankKeeper types.BankKeeper, stakingKeeper types.StakingKeeper,
|
||||
) AppModule {
|
||||
return AppModule{
|
||||
AppModuleBasic: AppModuleBasic{cdc: cdc},
|
||||
|
||||
@@ -24,7 +24,7 @@ const (
|
||||
)
|
||||
|
||||
// WeightedOperations returns all the operations from the module with their respective weights
|
||||
func WeightedOperations(appParams simtypes.AppParams, cdc codec.JSONCodec, ak types.AccountKeeper, bk types.BankKeeper, k keeper.Keeper, sk *stakingkeeper.Keeper) simulation.WeightedOperations {
|
||||
func WeightedOperations(appParams simtypes.AppParams, cdc codec.JSONCodec, ak types.AccountKeeper, bk types.BankKeeper, k keeper.Keeper, sk types.StakingKeeper) simulation.WeightedOperations {
|
||||
var weightMsgSetWithdrawAddress int
|
||||
appParams.GetOrGenerate(cdc, OpWeightMsgSetWithdrawAddress, &weightMsgSetWithdrawAddress, nil,
|
||||
func(_ *rand.Rand) {
|
||||
@@ -53,6 +53,8 @@ func WeightedOperations(appParams simtypes.AppParams, cdc codec.JSONCodec, ak ty
|
||||
},
|
||||
)
|
||||
|
||||
stakeKeeper := sk.(*stakingkeeper.Keeper)
|
||||
|
||||
return simulation.WeightedOperations{
|
||||
simulation.NewWeightedOperation(
|
||||
weightMsgSetWithdrawAddress,
|
||||
@@ -60,15 +62,15 @@ func WeightedOperations(appParams simtypes.AppParams, cdc codec.JSONCodec, ak ty
|
||||
),
|
||||
simulation.NewWeightedOperation(
|
||||
weightMsgWithdrawDelegationReward,
|
||||
SimulateMsgWithdrawDelegatorReward(ak, bk, k, sk),
|
||||
SimulateMsgWithdrawDelegatorReward(ak, bk, k, stakeKeeper),
|
||||
),
|
||||
simulation.NewWeightedOperation(
|
||||
weightMsgWithdrawValidatorCommission,
|
||||
SimulateMsgWithdrawValidatorCommission(ak, bk, k, sk),
|
||||
SimulateMsgWithdrawValidatorCommission(ak, bk, k, stakeKeeper),
|
||||
),
|
||||
simulation.NewWeightedOperation(
|
||||
weightMsgFundCommunityPool,
|
||||
SimulateMsgFundCommunityPool(ak, bk, k, sk),
|
||||
SimulateMsgFundCommunityPool(ak, bk, k, stakeKeeper),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ import (
|
||||
"github.com/cosmos/cosmos-sdk/x/slashing/keeper"
|
||||
"github.com/cosmos/cosmos-sdk/x/slashing/simulation"
|
||||
"github.com/cosmos/cosmos-sdk/x/slashing/types"
|
||||
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -91,11 +90,11 @@ type AppModule struct {
|
||||
keeper keeper.Keeper
|
||||
accountKeeper types.AccountKeeper
|
||||
bankKeeper types.BankKeeper
|
||||
stakingKeeper *stakingkeeper.Keeper
|
||||
stakingKeeper types.StakingKeeper
|
||||
}
|
||||
|
||||
// NewAppModule creates a new AppModule object
|
||||
func NewAppModule(cdc codec.Codec, keeper keeper.Keeper, ak types.AccountKeeper, bk types.BankKeeper, sk *stakingkeeper.Keeper) AppModule {
|
||||
func NewAppModule(cdc codec.Codec, keeper keeper.Keeper, ak types.AccountKeeper, bk types.BankKeeper, sk types.StakingKeeper) AppModule {
|
||||
return AppModule{
|
||||
AppModuleBasic: AppModuleBasic{cdc: cdc},
|
||||
keeper: keeper,
|
||||
|
||||
@@ -24,7 +24,7 @@ const (
|
||||
// WeightedOperations returns all the operations from the module with their respective weights
|
||||
func WeightedOperations(
|
||||
appParams simtypes.AppParams, cdc codec.JSONCodec, ak types.AccountKeeper,
|
||||
bk types.BankKeeper, k keeper.Keeper, sk *stakingkeeper.Keeper,
|
||||
bk types.BankKeeper, k keeper.Keeper, sk types.StakingKeeper,
|
||||
) simulation.WeightedOperations {
|
||||
var weightMsgUnjail int
|
||||
appParams.GetOrGenerate(cdc, OpWeightMsgUnjail, &weightMsgUnjail, nil,
|
||||
@@ -36,7 +36,7 @@ func WeightedOperations(
|
||||
return simulation.WeightedOperations{
|
||||
simulation.NewWeightedOperation(
|
||||
weightMsgUnjail,
|
||||
SimulateMsgUnjail(ak, bk, k, sk),
|
||||
SimulateMsgUnjail(ak, bk, k, sk.(*stakingkeeper.Keeper)),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user