Skip to content

Commit

Permalink
chore: update the default params for evidence and slashing
Browse files Browse the repository at this point in the history
  • Loading branch information
evan-forbes committed Sep 4, 2023
1 parent 80ecd21 commit 96a5f38
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ var (
newGovModule(),
params.AppModuleBasic{},
crisisModule{},
slashing.AppModuleBasic{},
slashingModule{},
authzmodule.AppModuleBasic{},
feegrantmodule.AppModuleBasic{},
ibc.AppModuleBasic{},
Expand Down
22 changes: 22 additions & 0 deletions app/default_overrides.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import (
govclient "github.com/cosmos/cosmos-sdk/x/gov/client"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
paramsclient "github.com/cosmos/cosmos-sdk/x/params/client"
"github.com/cosmos/cosmos-sdk/x/slashing"
slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types"
"github.com/cosmos/cosmos-sdk/x/staking"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
ibcclientclient "github.com/cosmos/ibc-go/v6/modules/core/02-client/client"
Expand Down Expand Up @@ -81,6 +83,26 @@ func (stakingModule) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage {
})
}

// stakingModule wraps the x/staking module in order to overwrite specific
// ModuleManager APIs.
type slashingModule struct {
slashing.AppModuleBasic
}

// DefaultGenesis returns custom x/staking module genesis state.
func (slashingModule) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage {
params := slashingtypes.DefaultParams()
params.MinSignedPerWindow = sdk.NewDecWithPrec(5, 2) // 5%
params.SignedBlocksWindow = 15000
params.DowntimeJailDuration = time.Minute * 1
params.SlashFractionDoubleSign = sdk.NewDecWithPrec(5, 2) // 5%
params.SlashFractionDowntime = sdk.NewDecWithPrec(1, 2) // 1%

return cdc.MustMarshalJSON(&slashingtypes.GenesisState{
Params: params,
})
}

type crisisModule struct {
crisis.AppModuleBasic
}
Expand Down

0 comments on commit 96a5f38

Please sign in to comment.