From 25ae7ce820c49ca27c8fd8300450e8d5ab6a56e6 Mon Sep 17 00:00:00 2001 From: Hongrui Fang Date: Mon, 31 Oct 2022 22:02:06 +0800 Subject: [PATCH] test that proposal thresholds are inclusively checked --- agora-specs/Sample/Proposal/Advance.hs | 10 +++++----- agora-specs/Sample/Proposal/Vote.hs | 3 ++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/agora-specs/Sample/Proposal/Advance.hs b/agora-specs/Sample/Proposal/Advance.hs index 32bf0f9..01aa7f1 100644 --- a/agora-specs/Sample/Proposal/Advance.hs +++ b/agora-specs/Sample/Proposal/Advance.hs @@ -715,20 +715,20 @@ mkMockEffects useAuthScript n = effects effectsPerGroup (zip effectScripts effectMetadata) -numberOfVotesThatExceedsTheMinimumRequirement :: Integer -numberOfVotesThatExceedsTheMinimumRequirement = - untag (def @ProposalThresholds).execute + 1 +numberOfVotesThatJustMeetsTheMinimumRequirement :: Integer +numberOfVotesThatJustMeetsTheMinimumRequirement = + untag (def @ProposalThresholds).execute mkWinnerVotes :: Index -> (Winner, Integer) mkWinnerVotes idx = ( EffectAt idx - , numberOfVotesThatExceedsTheMinimumRequirement + , numberOfVotesThatJustMeetsTheMinimumRequirement ) ambiguousWinnerVotes :: (Winner, Integer) ambiguousWinnerVotes = ( All - , numberOfVotesThatExceedsTheMinimumRequirement + , numberOfVotesThatJustMeetsTheMinimumRequirement ) -------------------------------------------------------------------------------- diff --git a/agora-specs/Sample/Proposal/Vote.hs b/agora-specs/Sample/Proposal/Vote.hs index dd681c8..6a6f4e3 100644 --- a/agora-specs/Sample/Proposal/Vote.hs +++ b/agora-specs/Sample/Proposal/Vote.hs @@ -35,6 +35,7 @@ import Agora.Proposal ( ProposalId (ProposalId), ProposalRedeemer (Vote), ProposalStatus (VotingReady), + ProposalThresholds (vote), ProposalVotes (ProposalVotes), ResultTag (ResultTag), ) @@ -421,7 +422,7 @@ mkValidOwnerVoteBundle stakes = { numStakes = stakes , stakeInputParameters = StakeInputParameters - { perStakeGTs = 114514 + { perStakeGTs = (def :: ProposalThresholds).vote } , stakeOutputParameters = StakeOutputParameters