check thresholds inclusively

This commit is contained in:
Hongrui Fang 2022-10-24 18:09:04 +08:00
parent 6507d869f3
commit 85fa6c81da
2 changed files with 4 additions and 4 deletions

View file

@ -891,7 +891,7 @@ pwinner' = phoistAcyclic $
exceedQuorum = exceedQuorum =
ptraceIfFalse "Highest vote count should exceed the minimum threshold" $ ptraceIfFalse "Highest vote count should exceed the minimum threshold" $
quorum #< highestVotes quorum #<= highestVotes
pure $ pure $
pif pif

View file

@ -423,7 +423,7 @@ proposalValidator =
# proposalInputDatumF.cosigners # proposalInputDatumF.cosigners
pguardC "Less cosigners than maximum limit" $ pguardC "Less cosigners than maximum limit" $
plength # updatedSigs #< maximumCosigners plength # updatedSigs #<= maximumCosigners
pguardC "Meet minimum GT requirement" $ pguardC "Meet minimum GT requirement" $
pfromData thresholdsF.cosign #<= stakeF.stakedAmount pfromData thresholdsF.cosign #<= stakeF.stakedAmount
@ -467,7 +467,7 @@ proposalValidator =
# sctxF.inputStakes # sctxF.inputStakes
pguardC "Exceed minimum amount" $ pguardC "Exceed minimum amount" $
thresholdsF.vote #< totalStakeAmount thresholdsF.vote #<= totalStakeAmount
pguardC "Input proposal must be in VotingReady state" $ pguardC "Input proposal must be in VotingReady state" $
currentStatus #== pconstant VotingReady currentStatus #== pconstant VotingReady
@ -646,7 +646,7 @@ proposalValidator =
pmatchC notTooLate >>= \case pmatchC notTooLate >>= \case
PTrue -> do PTrue -> do
pguardC "More cosigns than minimum amount" $ pguardC "More cosigns than minimum amount" $
punsafeCoerce (pfromData thresholdsF.toVoting) #< sctxF.totalAmount punsafeCoerce (pfromData thresholdsF.toVoting) #<= sctxF.totalAmount
pguardC "All new cosigners are witnessed by their Stake datums" $ pguardC "All new cosigners are witnessed by their Stake datums" $
plistEqualsBy plistEqualsBy