Skip to content

Commit

Permalink
extend BakerPoolStatus/PoolCurrentPayday info with suspension info (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
drsk0 authored Jan 8, 2025
1 parent 21bf0bf commit 44c84f2
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
rounds in the previous payday.
- Add support for suspend/resume to validator configuration updates.
- Validators that are suspended are paused from participating in the consensus algorithm.
- Add suspension info to `BakerPoolStatus` / `CurrentPaydayBakerPoolStatus` query results.
- Add `GetConsensusDetailedStatus` gRPC endpoint for getting detailed information on the status
of the consensus, at consensus version 1.
- Update Rust version to 1.82.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3331,10 +3331,12 @@ doGetPoolStatus pbs psBakerId@(BakerId aid) = case delegationChainParameters @pv
return $! ActiveBakerPoolStatus{..}
epochBakers <- refLoad (_birkCurrentEpochBakers $ bspBirkParameters bsp)
mepochBaker <- epochBaker psBakerId epochBakers
psCurrentPaydayStatus <- case mepochBaker of
Nothing -> return Nothing
(psCurrentPaydayStatus, psIsSuspended) <- case mepochBaker of
Nothing -> return (Nothing, Nothing)
Just (currentEpochBaker, effectiveStake) -> do
poolRewards <- refLoad (bspPoolRewards bsp)
let isSuspended =
fromCondDef (Just <$> BaseAccounts._bieIsSuspended currentEpochBaker) Nothing
mbcr <- lookupBakerCapitalAndRewardDetails psBakerId poolRewards
case mbcr of
Nothing ->
Expand All @@ -3344,8 +3346,8 @@ doGetPoolStatus pbs psBakerId@(BakerId aid) = case delegationChainParameters @pv
++ " is present in the current epoch bakers, but not \
\the current epoch capital distribution."
Just (bc, BakerPoolRewardDetails{..}) -> do
return $
Just
return
( Just
CurrentPaydayBakerPoolStatus
{ bpsBlocksBaked = blockCount,
bpsFinalizationLive = finalizationAwake,
Expand All @@ -3359,8 +3361,14 @@ doGetPoolStatus pbs psBakerId@(BakerId aid) = case delegationChainParameters @pv
bpsCommissionRates =
currentEpochBaker
^. BaseAccounts.bieBakerPoolInfo
. BaseAccounts.poolCommissionRates
}
. BaseAccounts.poolCommissionRates,
bpsIsPrimedForSuspension =
fromCondDef (fmap (Just . primedForSuspension) suspensionInfo) Nothing,
bpsMissedRounds =
fromCondDef (fmap (Just . missedRounds) suspensionInfo) Nothing
},
isSuspended
)
if isJust psActiveStatus || isJust psCurrentPaydayStatus
then return $ Just BakerPoolStatus{..}
else return Nothing
Expand Down

0 comments on commit 44c84f2

Please sign in to comment.