cosmos-sdk/x/slashing/simulation/params.go

40 lines
1.0 KiB
Go

package simulation
// DONTCOVER
import (
"fmt"
"math/rand"
"github.com/cosmos/cosmos-sdk/x/simulation"
"github.com/cosmos/cosmos-sdk/x/slashing/internal/types"
)
const (
keySignedBlocksWindow = "SignedBlocksWindow"
keyMinSignedPerWindow = "MinSignedPerWindow"
keySlashFractionDowntime = "SlashFractionDowntime"
)
// ParamChanges defines the parameters that can be modified by param change proposals
// on the simulation
func ParamChanges(r *rand.Rand) []simulation.ParamChange {
return []simulation.ParamChange{
simulation.NewSimParamChange(types.ModuleName, keySignedBlocksWindow, "",
func(r *rand.Rand) string {
return fmt.Sprintf("\"%d\"", GenSignedBlocksWindow(r))
},
),
simulation.NewSimParamChange(types.ModuleName, keyMinSignedPerWindow, "",
func(r *rand.Rand) string {
return fmt.Sprintf("\"%s\"", GenMinSignedPerWindow(r))
},
),
simulation.NewSimParamChange(types.ModuleName, keySlashFractionDowntime, "",
func(r *rand.Rand) string {
return fmt.Sprintf("\"%s\"", GenSlashFractionDowntime(r))
},
),
}
}