Skip to content

Commit

Permalink
Fix validation logic for chain parameter changes
Browse files Browse the repository at this point in the history
- Penalties should be measured in bps^2, not bps
- Proposal pass threshold should be >= 1/2, not > 1/2
  • Loading branch information
plaidfinch committed Mar 6, 2023
1 parent 48479eb commit 83c2459
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions chain/src/params/change.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,16 +118,16 @@ impl ChainParameters {
"slashing penalty (misbehavior) must be at least 1 basis point",
),
(
*slashing_penalty_misbehavior <= Penalty(10_000),
"slashing penalty (misbehavior) must be at most 10,000 basis points",
*slashing_penalty_misbehavior <= Penalty(100_000_000),
"slashing penalty (misbehavior) must be at most 10,000 basis points^2",
),
(
*slashing_penalty_downtime >= Penalty(1),
"slashing penalty (downtime) must be at least 1 basis point",
),
(
*slashing_penalty_downtime <= Penalty(10_000),
"slashing penalty (downtime) must be at most 10,000 basis points",
*slashing_penalty_downtime <= Penalty(100_000_000),
"slashing penalty (downtime) must be at most 10,000 basis points^2",
),
(
*signed_blocks_window_len >= 2,
Expand Down Expand Up @@ -155,8 +155,8 @@ impl ChainParameters {
"proposal valid quorum must be greater than 0",
),
(
*proposal_pass_threshold > Ratio::new(1, 2),
"proposal pass threshold must be greater than 1/2",
*proposal_pass_threshold >= Ratio::new(1, 2),
"proposal pass threshold must be greater than or equal to 1/2",
),
(
*proposal_slash_threshold > Ratio::new(1, 2),
Expand Down

0 comments on commit 83c2459

Please sign in to comment.