-
Notifications
You must be signed in to change notification settings - Fork 720
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
Change watchEpochStateUpdate callback type #5855
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -24,6 +24,7 @@ import Prelude | |||||||||||||
import Control.Monad | ||||||||||||||
import qualified Data.Char as C | ||||||||||||||
import qualified Data.Map as Map | ||||||||||||||
import Data.Maybe | ||||||||||||||
import Data.Maybe.Strict | ||||||||||||||
import Data.Set (Set) | ||||||||||||||
import Data.String | ||||||||||||||
|
@@ -177,8 +178,9 @@ hprop_constitutional_committee_add_new = integrationWorkspace "constitutional-co | |||||||||||||
governanceActionTxId <- H.noteM $ retrieveTransactionId execConfig signedProposalTx | ||||||||||||||
|
||||||||||||||
governanceActionIx <- | ||||||||||||||
H.nothingFailM . watchEpochStateUpdate epochStateView (L.EpochInterval 1) $ \(anyNewEpochState, _, _) -> | ||||||||||||||
pure $ maybeExtractGovernanceActionIndex (fromString governanceActionTxId) anyNewEpochState | ||||||||||||||
H.nothingFailM . fmap snd . watchEpochStateUpdate epochStateView (L.EpochInterval 1) $ \(anyNewEpochState, _, _) -> do | ||||||||||||||
let r = maybeExtractGovernanceActionIndex (fromString governanceActionTxId) anyNewEpochState | ||||||||||||||
pure (if isJust r then ConditionMet else ConditionNotMet, r) | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Writing |
||||||||||||||
|
||||||||||||||
dRepVoteFiles <- | ||||||||||||||
DRep.generateVoteFiles | ||||||||||||||
|
@@ -222,7 +224,8 @@ hprop_constitutional_committee_add_new = integrationWorkspace "constitutional-co | |||||||||||||
length (filter ((== L.VoteYes) . snd) gaSpoVotes) === 1 | ||||||||||||||
length spoVotes === length gaSpoVotes | ||||||||||||||
|
||||||||||||||
H.nothingFailM $ watchEpochStateUpdate epochStateView (L.EpochInterval 1) (return . committeeIsPresent) | ||||||||||||||
(cond, ()) <- watchEpochStateUpdate epochStateView (L.EpochInterval 1) (return . committeeIsPresent) | ||||||||||||||
cond === ConditionMet | ||||||||||||||
|
||||||||||||||
-- show proposed committe meembers | ||||||||||||||
H.noteShow_ ccCredentials | ||||||||||||||
|
@@ -252,7 +255,7 @@ getCommitteeMembers epochStateView ceo = withFrozenCallStack $ do | |||||||||||||
govState <- getGovState epochStateView ceo | ||||||||||||||
fmap (Map.keys . L.committeeMembers) . H.nothingFail $ strictMaybeToMaybe $ govState ^. L.cgsCommitteeL | ||||||||||||||
|
||||||||||||||
committeeIsPresent :: (AnyNewEpochState, SlotNo, BlockNo) -> Maybe () | ||||||||||||||
committeeIsPresent :: (AnyNewEpochState, SlotNo, BlockNo) -> (LedgerStateCondition, ()) | ||||||||||||||
committeeIsPresent (AnyNewEpochState sbe newEpochState, _, _) = | ||||||||||||||
caseShelleyToBabbageOrConwayEraOnwards | ||||||||||||||
(const $ error "Constitutional committee does not exist pre-Conway era") | ||||||||||||||
|
@@ -263,7 +266,9 @@ committeeIsPresent (AnyNewEpochState sbe newEpochState, _, _) = | |||||||||||||
. L.lsUTxOStateL | ||||||||||||||
. L.utxosGovStateL | ||||||||||||||
. L.cgsCommitteeL | ||||||||||||||
members <- L.committeeMembers <$> strictMaybeToMaybe mCommittee | ||||||||||||||
when (Map.null members) Nothing | ||||||||||||||
isCommitteePresent = Map.null . L.committeeMembers <$> strictMaybeToMaybe mCommittee | ||||||||||||||
if isCommitteePresent == Just True | ||||||||||||||
then (ConditionMet, ()) | ||||||||||||||
else (ConditionNotMet, ()) | ||||||||||||||
Comment on lines
+270
to
+272
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Too bad Haskell doesn't have arm sharing here 🙃 |
||||||||||||||
) | ||||||||||||||
sbe |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a big fan of those
==
on a union type, for long term maintenance; but in this specific case I think it's fine. It's unlikely we'll add a third case toLedgerStateCondition
.