Skip to content

Commit

Permalink
staking: deprecate obsolete base reward rate field (#4651)
Browse files Browse the repository at this point in the history
## Describe your changes

This PR deprecate the
`core.component.staking.v1.StakeParameters.base_reward_rate` field. This
field is vestigial and unused. The actual chain base reward rate is
computed downstream of the distributions component budget issuance for
the epoch.

## Checklist before requesting a review

- [x] If this code contains consensus-breaking changes, I have added the
"consensus-breaking" label. Otherwise, I declare my belief that there
are not consensus-breaking changes, for the following reason:

> Technically could be client breaking but I don't think it is used
anywhere
  • Loading branch information
erwanor authored and avahowell committed Jun 24, 2024
1 parent 93d95a3 commit 67b8327
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 14 deletions.
Binary file modified crates/cnidarium/src/gen/proto_descriptor.bin.no_lfs
Binary file not shown.
6 changes: 0 additions & 6 deletions crates/core/app/src/params/change.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ impl AppParameters {
stake_params:
StakeParameters {
active_validator_limit,
base_reward_rate: _,
slashing_penalty_misbehavior: _,
slashing_penalty_downtime: _,
signed_blocks_window_len,
Expand Down Expand Up @@ -190,7 +189,6 @@ impl AppParameters {
stake_params:
StakeParameters {
active_validator_limit,
base_reward_rate,
slashing_penalty_misbehavior,
slashing_penalty_downtime,
signed_blocks_window_len,
Expand Down Expand Up @@ -223,10 +221,6 @@ impl AppParameters {
*active_validator_limit > 3,
"active validator limit must be at least 4",
),
(
*base_reward_rate >= 1,
"base reward rate must be at least 1 basis point",
),
(
*slashing_penalty_misbehavior >= 1,
"slashing penalty (misbehavior) must be at least 1 basis point",
Expand Down
7 changes: 1 addition & 6 deletions crates/core/component/stake/src/params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ pub struct StakeParameters {
pub unbonding_delay: u64,
/// The number of validators allowed in the consensus set (Active state).
pub active_validator_limit: u64,
/// The base reward rate, expressed in basis points of basis points
pub base_reward_rate: u64,
/// The penalty for slashing due to misbehavior, expressed in basis points squared (10^-8)
pub slashing_penalty_misbehavior: u64,
/// The penalty for slashing due to downtime, expressed in basis points squared (10^-8)
Expand All @@ -36,7 +34,6 @@ impl TryFrom<pb::StakeParameters> for StakeParameters {
active_validator_limit: msg.active_validator_limit,
slashing_penalty_downtime: msg.slashing_penalty_downtime,
slashing_penalty_misbehavior: msg.slashing_penalty_misbehavior,
base_reward_rate: msg.base_reward_rate,
missed_blocks_maximum: msg.missed_blocks_maximum,
signed_blocks_window_len: msg.signed_blocks_window_len,
min_validator_stake: msg
Expand All @@ -58,7 +55,7 @@ impl From<StakeParameters> for pb::StakeParameters {
missed_blocks_maximum: params.missed_blocks_maximum,
slashing_penalty_downtime: params.slashing_penalty_downtime,
slashing_penalty_misbehavior: params.slashing_penalty_misbehavior,
base_reward_rate: params.base_reward_rate,
base_reward_rate: 0,
min_validator_stake: Some(params.min_validator_stake.into()),
unbonding_delay: params.unbonding_delay,
}
Expand All @@ -78,8 +75,6 @@ impl Default for StakeParameters {
slashing_penalty_misbehavior: 1000_0000,
// 1 basis point = 0.01%
slashing_penalty_downtime: 1_0000,
// 3bps -> 11% return over 365 epochs
base_reward_rate: 3_0000,
// 1 penumbra
min_validator_stake: 1_000_000u128.into(),
}
Expand Down
1 change: 1 addition & 0 deletions crates/proto/src/gen/penumbra.core.component.stake.v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -769,6 +769,7 @@ pub struct StakeParameters {
#[prost(uint64, tag = "2")]
pub active_validator_limit: u64,
/// The base reward rate, expressed in basis points of basis points
#[deprecated]
#[prost(uint64, tag = "3")]
pub base_reward_rate: u64,
/// The penalty for slashing due to misbehavior.
Expand Down
Binary file modified crates/proto/src/gen/proto_descriptor.bin.no_lfs
Binary file not shown.
4 changes: 2 additions & 2 deletions proto/penumbra/penumbra/core/component/stake/v1/stake.proto
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ message StakeParameters {
// The maximum number of validators in the consensus set.
uint64 active_validator_limit = 2;
// The base reward rate, expressed in basis points of basis points
uint64 base_reward_rate = 3;
uint64 base_reward_rate = 3 [deprecated = true];
// The penalty for slashing due to misbehavior.
uint64 slashing_penalty_misbehavior = 4;
// The penalty for slashing due to downtime.
Expand Down Expand Up @@ -408,4 +408,4 @@ message EventSlashingPenaltyApplied {
uint64 epoch_index = 2;
// The penalty amount after slashing.
Penalty new_penalty = 3;
}
}

0 comments on commit 67b8327

Please sign in to comment.