Skip to content

Commit

Permalink
Merge pull request #590 from Concordium/suspended-pool
Browse files Browse the repository at this point in the history
Move isSuspended from BakerPoolStatus to ActiveBakerPoolStatus.
  • Loading branch information
td202 authored Jan 14, 2025
2 parents 92150ab + d797d5b commit 65b2fea
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion concordium-grpc-api
2 changes: 1 addition & 1 deletion haskell-src/Concordium/GRPC2.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1689,9 +1689,9 @@ instance ToProto QueryTypes.BakerPoolStatus where
ProtoFields.delegatedCapitalCap .= toProto abpsDelegatedCapitalCap
ProtoFields.poolInfo .= toProto abpsPoolInfo
ProtoFields.maybe'equityPendingChange .= toProto abpsBakerStakePendingChange
ProtoFields.maybe'isSuspended .= abpsIsSuspended
ProtoFields.maybe'currentPaydayInfo .= fmap toProto psCurrentPaydayStatus
ProtoFields.allPoolTotalCapital .= toProto psAllPoolTotalCapital
ProtoFields.maybe'isSuspended .= psIsSuspended

instance ToProto QueryTypes.PassiveDelegationStatus where
type Output QueryTypes.PassiveDelegationStatus = Proto.PassiveDelegationInfo
Expand Down
17 changes: 9 additions & 8 deletions haskell-src/Concordium/Types/Queries.hs
Original file line number Diff line number Diff line change
Expand Up @@ -472,13 +472,17 @@ data ActiveBakerPoolStatus = ActiveBakerPoolStatus
-- | The pool info associated with the pool: open status, metadata URL and commission rates.
abpsPoolInfo :: !BakerPoolInfo,
-- | Any pending change to the baker's stake.
abpsBakerStakePendingChange :: !PoolPendingChange
abpsBakerStakePendingChange :: !PoolPendingChange,
-- | A flag indicating Whether the pool owner is suspended or not. Present
-- from protocol version P8.
abpsIsSuspended :: !(Maybe Bool)
}
deriving (Eq, Show)

$( deriveJSON
defaultOptions
{ fieldLabelModifier = firstLower . dropWhile isLower
{ fieldLabelModifier = firstLower . dropWhile isLower,
omitNothingFields = True
}
''ActiveBakerPoolStatus
)
Expand Down Expand Up @@ -531,10 +535,7 @@ data BakerPoolStatus = BakerPoolStatus
-- for the current reward period.
psCurrentPaydayStatus :: !(Maybe CurrentPaydayBakerPoolStatus),
-- | Total capital staked across all pools, including passive delegation.
psAllPoolTotalCapital :: !Amount,
-- | A flag indicating Whether the pool owner is suspended or not. Present
-- from protocol version P8.
psIsSuspended :: !(Maybe Bool)
psAllPoolTotalCapital :: !Amount
}
deriving (Eq, Show)

Expand All @@ -547,7 +548,6 @@ instance ToJSON BakerPoolStatus where
"currentPaydayStatus" .= psCurrentPaydayStatus,
"allPoolTotalCapital" .= psAllPoolTotalCapital
]
++ ["isSuspended" .= isSuspended | Just isSuspended <- [psIsSuspended]]
++ activeStatusFields
where
activeStatusFields = case psActiveStatus of
Expand All @@ -558,6 +558,7 @@ instance ToJSON BakerPoolStatus where
"poolInfo" .= abpsPoolInfo,
"bakerStakePendingChange" .= abpsBakerStakePendingChange
]
++ ["isSuspended" .= isSuspended | Just isSuspended <- [abpsIsSuspended]]
Nothing -> []

instance FromJSON BakerPoolStatus where
Expand All @@ -576,9 +577,9 @@ instance FromJSON BakerPoolStatus where
abpsDelegatedCapitalCap <- obj .: "delegatedCapitalCap"
abpsPoolInfo <- obj .: "poolInfo"
abpsBakerStakePendingChange <- obj .: "bakerStakePendingChange"
abpsIsSuspended <- obj .:? "isSuspended"
return ActiveBakerPoolStatus{..}
psActiveStatus <- optional activeStatusFields
psIsSuspended <- optional $ obj .: "isSuspended"
return BakerPoolStatus{..}

-- | Status of the passive delegators.
Expand Down

0 comments on commit 65b2fea

Please sign in to comment.