ensure votes changed in VotingReady while calling UnlockStakes

This commit is contained in:
Hongrui Fang 2022-11-10 18:56:38 +08:00
parent 431092fb1c
commit 0d0e122bd2

View file

@ -549,6 +549,7 @@ proposalValidator =
PUnlockStake _ -> spendStakes $ \sctxF -> do PUnlockStake _ -> spendStakes $ \sctxF -> do
let expectedVotes = let expectedVotes =
pdata $
pfoldl pfoldl
# plam # plam
( \votes stake -> unTermCont $ do ( \votes stake -> unTermCont $ do
@ -611,14 +612,19 @@ proposalValidator =
.& #thresholds .& #thresholds
.= proposalInputDatumF.thresholds .= proposalInputDatumF.thresholds
.& #votes .& #votes
.= pdata expectedVotes .= expectedVotes
.& #timingConfig .& #timingConfig
.= proposalInputDatumF.timingConfig .= proposalInputDatumF.timingConfig
.& #startingTime .& #startingTime
.= proposalInputDatumF.startingTime .= proposalInputDatumF.startingTime
) )
in ptraceIfFalse "Update votes" $ in foldl1
(#&&)
[ ptraceIfFalse "Votes changed" $
pnot #$ expectedVotes #== proposalInputDatumF.votes
, ptraceIfFalse "Proposal update correct" $
expectedProposalOut #== proposalOutputDatum expectedProposalOut #== proposalOutputDatum
]
) )
-- No change to the proposal is allowed. -- No change to the proposal is allowed.
( ptraceIfFalse "Proposal unchanged" $ ( ptraceIfFalse "Proposal unchanged" $