Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move isSuspended from BakerPoolStatus to ActiveBakerPoolStatus. #590

Merged
merged 2 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading