Skip to content

Commit

Permalink
penumbra: generate protos with unbonding epoch comment
Browse files Browse the repository at this point in the history
  • Loading branch information
erwanor committed Jan 29, 2024
1 parent 6df54d4 commit 417198c
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions crates/core/component/stake/src/validator/bonding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ impl std::fmt::Display for State {
match self {
State::Bonded => write!(f, "Bonded"),
State::Unbonded => write!(f, "Unbonded"),
State::Unbonding { unbonds_at_epoch: unbonding_epoch } => {
State::Unbonding {
unbonds_at_epoch: unbonding_epoch,
} => {
write!(f, "Unbonding (end epoch: {unbonding_epoch})")
}
}
Expand All @@ -44,12 +46,14 @@ impl From<State> for pb::BondingState {
state: match v {
State::Bonded => pb::bonding_state::BondingStateEnum::Bonded as i32,
State::Unbonded => pb::bonding_state::BondingStateEnum::Unbonded as i32,
State::Unbonding { unbonds_at_epoch: _ } => {
pb::bonding_state::BondingStateEnum::Unbonding as i32
}
State::Unbonding {
unbonds_at_epoch: _,
} => pb::bonding_state::BondingStateEnum::Unbonding as i32,
},
unbonding_epoch: match v {
State::Unbonding { unbonds_at_epoch: unbonding_epoch } => unbonding_epoch,
State::Unbonding {
unbonds_at_epoch: unbonding_epoch,
} => unbonding_epoch,
_ => 0,
},
}
Expand All @@ -71,7 +75,9 @@ impl TryFrom<pb::BondingState> for State {
} else {
anyhow::bail!("unbonding epoch should be set for unbonding state")
};
Ok(State::Unbonding { unbonds_at_epoch: unbonding_epoch })
Ok(State::Unbonding {
unbonds_at_epoch: unbonding_epoch,
})
}
pb::bonding_state::BondingStateEnum::Unspecified => {
Err(anyhow::anyhow!("unspecified bonding state!"))
Expand Down

0 comments on commit 417198c

Please sign in to comment.