fix existing tests
This commit is contained in:
parent
5dee613dd4
commit
b76b5c6ec6
11 changed files with 143 additions and 80 deletions
|
|
@ -106,7 +106,7 @@ governorDatumValidProperty =
|
||||||
thres <- genProposalThresholds c
|
thres <- genProposalThresholds c
|
||||||
|
|
||||||
let timing = ProposalTimingConfig 0 0 0 0
|
let timing = ProposalTimingConfig 0 0 0 0
|
||||||
return $ GovernorDatum thres (ProposalId 0) timing (MaxTimeRangeWidth 0)
|
return $ GovernorDatum thres (ProposalId 0) timing (MaxTimeRangeWidth 0) 3
|
||||||
where
|
where
|
||||||
taggedInteger p = Tagged <$> chooseInteger p
|
taggedInteger p = Tagged <$> chooseInteger p
|
||||||
genProposalThresholds :: GovernorDatumCases -> Gen ProposalThresholds
|
genProposalThresholds :: GovernorDatumCases -> Gen ProposalThresholds
|
||||||
|
|
@ -181,6 +181,7 @@ governorMintingProperty =
|
||||||
, nextProposalId = ProposalId 0
|
, nextProposalId = ProposalId 0
|
||||||
, proposalTimings = def
|
, proposalTimings = def
|
||||||
, createProposalTimeRangeMaxWidth = def
|
, createProposalTimeRangeMaxWidth = def
|
||||||
|
, maximumProposalsPerStake = 3
|
||||||
}
|
}
|
||||||
|
|
||||||
gen :: GovernorPolicyCases -> Gen ScriptContext
|
gen :: GovernorPolicyCases -> Gen ScriptContext
|
||||||
|
|
|
||||||
|
|
@ -106,6 +106,7 @@ mkEffectTxInfo newGovDatum =
|
||||||
, nextProposalId = ProposalId 0
|
, nextProposalId = ProposalId 0
|
||||||
, proposalTimings = def
|
, proposalTimings = def
|
||||||
, createProposalTimeRangeMaxWidth = def
|
, createProposalTimeRangeMaxWidth = def
|
||||||
|
, maximumProposalsPerStake = 3
|
||||||
}
|
}
|
||||||
governorInputDatum :: Datum
|
governorInputDatum :: Datum
|
||||||
governorInputDatum = Datum $ toBuiltinData governorInputDatum'
|
governorInputDatum = Datum $ toBuiltinData governorInputDatum'
|
||||||
|
|
@ -168,6 +169,7 @@ validNewGovernorDatum =
|
||||||
, nextProposalId = ProposalId 42
|
, nextProposalId = ProposalId 42
|
||||||
, proposalTimings = def
|
, proposalTimings = def
|
||||||
, createProposalTimeRangeMaxWidth = def
|
, createProposalTimeRangeMaxWidth = def
|
||||||
|
, maximumProposalsPerStake = 3
|
||||||
}
|
}
|
||||||
|
|
||||||
invalidNewGovernorDatum :: GovernorDatum
|
invalidNewGovernorDatum :: GovernorDatum
|
||||||
|
|
@ -180,4 +182,5 @@ invalidNewGovernorDatum =
|
||||||
, nextProposalId = ProposalId 42
|
, nextProposalId = ProposalId 42
|
||||||
, proposalTimings = def
|
, proposalTimings = def
|
||||||
, createProposalTimeRangeMaxWidth = def
|
, createProposalTimeRangeMaxWidth = def
|
||||||
|
, maximumProposalsPerStake = 3
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -119,6 +119,7 @@ mintGST =
|
||||||
, nextProposalId = ProposalId 0
|
, nextProposalId = ProposalId 0
|
||||||
, proposalTimings = def
|
, proposalTimings = def
|
||||||
, createProposalTimeRangeMaxWidth = def
|
, createProposalTimeRangeMaxWidth = def
|
||||||
|
, maximumProposalsPerStake = 3
|
||||||
}
|
}
|
||||||
|
|
||||||
witness :: ValidatorHash
|
witness :: ValidatorHash
|
||||||
|
|
@ -183,6 +184,7 @@ createProposal =
|
||||||
, nextProposalId = thisProposalId
|
, nextProposalId = thisProposalId
|
||||||
, proposalTimings = def
|
, proposalTimings = def
|
||||||
, createProposalTimeRangeMaxWidth = def
|
, createProposalTimeRangeMaxWidth = def
|
||||||
|
, maximumProposalsPerStake = 3
|
||||||
}
|
}
|
||||||
|
|
||||||
effects =
|
effects =
|
||||||
|
|
@ -216,8 +218,7 @@ createProposal =
|
||||||
|
|
||||||
proposalLocks :: [ProposalLock]
|
proposalLocks :: [ProposalLock]
|
||||||
proposalLocks =
|
proposalLocks =
|
||||||
[ ProposalLock (ResultTag 0) thisProposalId
|
[ Created thisProposalId
|
||||||
, ProposalLock (ResultTag 1) thisProposalId
|
|
||||||
]
|
]
|
||||||
stakeOutputDatum :: StakeDatum
|
stakeOutputDatum :: StakeDatum
|
||||||
stakeOutputDatum = stakeInputDatum {lockedBy = proposalLocks}
|
stakeOutputDatum = stakeInputDatum {lockedBy = proposalLocks}
|
||||||
|
|
@ -304,6 +305,7 @@ mintGATs =
|
||||||
, nextProposalId = ProposalId 5
|
, nextProposalId = ProposalId 5
|
||||||
, proposalTimings = def
|
, proposalTimings = def
|
||||||
, createProposalTimeRangeMaxWidth = def
|
, createProposalTimeRangeMaxWidth = def
|
||||||
|
, maximumProposalsPerStake = 3
|
||||||
}
|
}
|
||||||
|
|
||||||
effects =
|
effects =
|
||||||
|
|
@ -423,6 +425,7 @@ mutateState =
|
||||||
, nextProposalId = ProposalId 5
|
, nextProposalId = ProposalId 5
|
||||||
, proposalTimings = def
|
, proposalTimings = def
|
||||||
, createProposalTimeRangeMaxWidth = def
|
, createProposalTimeRangeMaxWidth = def
|
||||||
|
, maximumProposalsPerStake = 3
|
||||||
}
|
}
|
||||||
|
|
||||||
governorOutputDatum :: GovernorDatum
|
governorOutputDatum :: GovernorDatum
|
||||||
|
|
|
||||||
|
|
@ -81,6 +81,7 @@ proposalCreation =
|
||||||
, nextProposalId = ProposalId 0
|
, nextProposalId = ProposalId 0
|
||||||
, proposalTimings = def
|
, proposalTimings = def
|
||||||
, createProposalTimeRangeMaxWidth = def
|
, createProposalTimeRangeMaxWidth = def
|
||||||
|
, maximumProposalsPerStake = 3
|
||||||
}
|
}
|
||||||
|
|
||||||
govAfter :: GovernorDatum
|
govAfter :: GovernorDatum
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ import Agora.Proposal.Time (
|
||||||
)
|
)
|
||||||
import Agora.SafeMoney (GTTag)
|
import Agora.SafeMoney (GTTag)
|
||||||
import Agora.Stake (
|
import Agora.Stake (
|
||||||
ProposalLock (ProposalLock),
|
ProposalLock (..),
|
||||||
Stake (gtClassRef),
|
Stake (gtClassRef),
|
||||||
StakeDatum (..),
|
StakeDatum (..),
|
||||||
StakeRedeemer (WitnessStake),
|
StakeRedeemer (WitnessStake),
|
||||||
|
|
@ -99,19 +99,24 @@ data Parameters = Parameters
|
||||||
, stakeCount :: Integer
|
, stakeCount :: Integer
|
||||||
-- ^ The number of stakes.
|
-- ^ The number of stakes.
|
||||||
, signByAllCosigners :: Bool
|
, signByAllCosigners :: Bool
|
||||||
|
-- ^ Whether the transaction is signed by all the cosigners.
|
||||||
, perStakeGTs :: Tagged GTTag Integer
|
, perStakeGTs :: Tagged GTTag Integer
|
||||||
|
-- ^ The staked amount of each stake.
|
||||||
}
|
}
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
-- | Reference to the proposal UTXO.
|
||||||
proposalRef :: TxOutRef
|
proposalRef :: TxOutRef
|
||||||
proposalRef = TxOutRef proposalTxRef 1
|
proposalRef = TxOutRef proposalTxRef 1
|
||||||
|
|
||||||
|
-- | Create the reference to a particular stake UTXO.
|
||||||
mkStakeRef :: Int -> TxOutRef
|
mkStakeRef :: Int -> TxOutRef
|
||||||
mkStakeRef = TxOutRef stakeTxRef . (+ 2) . fromIntegral
|
mkStakeRef = TxOutRef stakeTxRef . (+ 2) . fromIntegral
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
-- | Default effects of the propsoal.
|
||||||
defEffects :: AssocMap.Map ResultTag (AssocMap.Map ValidatorHash DatumHash)
|
defEffects :: AssocMap.Map ResultTag (AssocMap.Map ValidatorHash DatumHash)
|
||||||
defEffects =
|
defEffects =
|
||||||
AssocMap.fromList
|
AssocMap.fromList
|
||||||
|
|
@ -119,14 +124,19 @@ defEffects =
|
||||||
, (ResultTag 1, AssocMap.empty)
|
, (ResultTag 1, AssocMap.empty)
|
||||||
]
|
]
|
||||||
|
|
||||||
|
-- | Empty votes for the default effects.
|
||||||
emptyVotes :: ProposalVotes
|
emptyVotes :: ProposalVotes
|
||||||
emptyVotes = emptyVotesFor defEffects
|
emptyVotes = emptyVotesFor defEffects
|
||||||
|
|
||||||
|
{- | The default proposal statring time, which doesn't really matter in this
|
||||||
|
case.
|
||||||
|
-}
|
||||||
proposalStartingTime :: POSIXTime
|
proposalStartingTime :: POSIXTime
|
||||||
proposalStartingTime = 0
|
proposalStartingTime = 0
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
-- | Create the input proposal datum given the parameters.
|
||||||
mkProposalInputDatum :: Parameters -> ProposalDatum
|
mkProposalInputDatum :: Parameters -> ProposalDatum
|
||||||
mkProposalInputDatum ps =
|
mkProposalInputDatum ps =
|
||||||
ProposalDatum
|
ProposalDatum
|
||||||
|
|
@ -140,6 +150,7 @@ mkProposalInputDatum ps =
|
||||||
, startingTime = ProposalStartingTime proposalStartingTime
|
, startingTime = ProposalStartingTime proposalStartingTime
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-- | Create the input stake datums given the parameters.
|
||||||
mkStakeInputDatums :: Parameters -> [StakeDatum]
|
mkStakeInputDatums :: Parameters -> [StakeDatum]
|
||||||
mkStakeInputDatums ps =
|
mkStakeInputDatums ps =
|
||||||
map
|
map
|
||||||
|
|
@ -154,28 +165,37 @@ mkStakeInputDatums ps =
|
||||||
where
|
where
|
||||||
existingLocks :: [ProposalLock]
|
existingLocks :: [ProposalLock]
|
||||||
existingLocks =
|
existingLocks =
|
||||||
[ ProposalLock (ResultTag 0) (ProposalId 0)
|
[ Voted (ProposalId 0) (ResultTag 0)
|
||||||
, ProposalLock (ResultTag 2) (ProposalId 1)
|
, Voted (ProposalId 1) (ResultTag 2)
|
||||||
]
|
]
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
-- | Script purpose of the proposal validator.
|
||||||
proposalScriptPurpose :: ScriptPurpose
|
proposalScriptPurpose :: ScriptPurpose
|
||||||
proposalScriptPurpose = Spending proposalRef
|
proposalScriptPurpose = Spending proposalRef
|
||||||
|
|
||||||
|
-- | Script purpose of the stake validator, given which stake we want to spend.
|
||||||
mkStakeScriptPurpose :: Int -> ScriptPurpose
|
mkStakeScriptPurpose :: Int -> ScriptPurpose
|
||||||
mkStakeScriptPurpose = Spending . mkStakeRef
|
mkStakeScriptPurpose = Spending . mkStakeRef
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
{- | The propsoal redeemer used to spend the proposal UTXO, which is always
|
||||||
|
'AdvanceProposal' in this case.
|
||||||
|
-}
|
||||||
proposalRedeemer :: ProposalRedeemer
|
proposalRedeemer :: ProposalRedeemer
|
||||||
proposalRedeemer = AdvanceProposal
|
proposalRedeemer = AdvanceProposal
|
||||||
|
|
||||||
|
{- | The propsoal redeemer used to spend the stake UTXO, which is always
|
||||||
|
'WitnessStake' in this case.
|
||||||
|
-}
|
||||||
stakeRedeemer :: StakeRedeemer
|
stakeRedeemer :: StakeRedeemer
|
||||||
stakeRedeemer = WitnessStake
|
stakeRedeemer = WitnessStake
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
-- | Create some valid stake owners.
|
||||||
mkStakeOwners :: Parameters -> [PubKeyHash]
|
mkStakeOwners :: Parameters -> [PubKeyHash]
|
||||||
mkStakeOwners ps =
|
mkStakeOwners ps =
|
||||||
sort $
|
sort $
|
||||||
|
|
@ -276,6 +296,9 @@ advance ps =
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
{- | Given the proposal status, create a time range that is in time for
|
||||||
|
advacing to the next state.
|
||||||
|
-}
|
||||||
mkInTimeTimeRange :: ProposalStatus -> POSIXTimeRange
|
mkInTimeTimeRange :: ProposalStatus -> POSIXTimeRange
|
||||||
mkInTimeTimeRange advanceFrom =
|
mkInTimeTimeRange advanceFrom =
|
||||||
case advanceFrom of
|
case advanceFrom of
|
||||||
|
|
@ -315,6 +338,9 @@ mkInTimeTimeRange advanceFrom =
|
||||||
)
|
)
|
||||||
Finished -> error "Cannot advance 'Finished' proposal"
|
Finished -> error "Cannot advance 'Finished' proposal"
|
||||||
|
|
||||||
|
{- | Given the proposal status, create a time range that is too time for
|
||||||
|
advacing to the next state.
|
||||||
|
-}
|
||||||
mkTooLateTimeRange :: ProposalStatus -> POSIXTimeRange
|
mkTooLateTimeRange :: ProposalStatus -> POSIXTimeRange
|
||||||
mkTooLateTimeRange advanceFrom =
|
mkTooLateTimeRange advanceFrom =
|
||||||
case advanceFrom of
|
case advanceFrom of
|
||||||
|
|
@ -363,6 +389,7 @@ mkTooLateTimeRange advanceFrom =
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
-- | Next state of the given proposal status.
|
||||||
getNextState :: ProposalStatus -> ProposalStatus
|
getNextState :: ProposalStatus -> ProposalStatus
|
||||||
getNextState = \case
|
getNextState = \case
|
||||||
Draft -> VotingReady
|
Draft -> VotingReady
|
||||||
|
|
@ -475,6 +502,9 @@ invalidOutputStakeParameters nCosigners =
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
{- | Create a test tree that runs the stake validator and proposal validator to
|
||||||
|
test the advancing functionalities.
|
||||||
|
-}
|
||||||
mkTestTree :: String -> Parameters -> Bool -> SpecificationTree
|
mkTestTree :: String -> Parameters -> Bool -> SpecificationTree
|
||||||
mkTestTree name ps isValidForProposalValidator = group name [proposal, stake]
|
mkTestTree name ps isValidForProposalValidator = group name [proposal, stake]
|
||||||
where
|
where
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ import Agora.Proposal (
|
||||||
)
|
)
|
||||||
import Agora.Proposal.Scripts (proposalValidator)
|
import Agora.Proposal.Scripts (proposalValidator)
|
||||||
import Agora.Proposal.Time (ProposalStartingTime (ProposalStartingTime))
|
import Agora.Proposal.Time (ProposalStartingTime (ProposalStartingTime))
|
||||||
import Agora.Stake (ProposalLock (ProposalLock), Stake (..), StakeDatum (..))
|
import Agora.Stake (ProposalLock (..), Stake (..), StakeDatum (..))
|
||||||
import Control.Monad (join)
|
import Control.Monad (join)
|
||||||
import Data.Coerce (coerce)
|
import Data.Coerce (coerce)
|
||||||
import Data.Default.Class (Default (def))
|
import Data.Default.Class (Default (def))
|
||||||
|
|
@ -152,10 +152,8 @@ mkStakeDatumPair c =
|
||||||
in (input, output)
|
in (input, output)
|
||||||
where
|
where
|
||||||
mkStakeLocks :: StakeRole -> ProposalId -> [ProposalLock]
|
mkStakeLocks :: StakeRole -> ProposalId -> [ProposalLock]
|
||||||
mkStakeLocks Voter pid = [ProposalLock defaultVoteFor pid]
|
mkStakeLocks Voter pid = [Voted pid defaultVoteFor]
|
||||||
mkStakeLocks Creator pid =
|
mkStakeLocks Creator pid = [Created pid]
|
||||||
map (`ProposalLock` pid) $
|
|
||||||
AssocMap.keys $ getProposalVotes votesTemplate
|
|
||||||
mkStakeLocks _ _ = []
|
mkStakeLocks _ _ = []
|
||||||
|
|
||||||
-- | Create the input proposal datum.
|
-- | Create the input proposal datum.
|
||||||
|
|
@ -274,7 +272,7 @@ unlockStake p =
|
||||||
mkProposalValidatorTestCase :: UnlockStakeParameters -> Bool -> SpecificationTree
|
mkProposalValidatorTestCase :: UnlockStakeParameters -> Bool -> SpecificationTree
|
||||||
mkProposalValidatorTestCase p shouldSucceed =
|
mkProposalValidatorTestCase p shouldSucceed =
|
||||||
let datum = mkProposalInputDatum p $ ProposalId 0
|
let datum = mkProposalInputDatum p $ ProposalId 0
|
||||||
redeemer = Unlock (ResultTag 0)
|
redeemer = Unlock
|
||||||
name = show p
|
name = show p
|
||||||
scriptContext =
|
scriptContext =
|
||||||
ScriptContext
|
ScriptContext
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ import Agora.Proposal.Time (
|
||||||
ProposalTimingConfig (draftTime, votingTime),
|
ProposalTimingConfig (draftTime, votingTime),
|
||||||
)
|
)
|
||||||
import Agora.Stake (
|
import Agora.Stake (
|
||||||
ProposalLock (ProposalLock),
|
ProposalLock (..),
|
||||||
Stake (gtClassRef),
|
Stake (gtClassRef),
|
||||||
StakeDatum (..),
|
StakeDatum (..),
|
||||||
StakeRedeemer (PermitVote),
|
StakeRedeemer (PermitVote),
|
||||||
|
|
@ -65,9 +65,11 @@ import Test.Specification (
|
||||||
)
|
)
|
||||||
import Test.Util (closedBoundedInterval, sortValue, updateMap)
|
import Test.Util (closedBoundedInterval, sortValue, updateMap)
|
||||||
|
|
||||||
|
-- | Reference to the proposal UTXO.
|
||||||
proposalRef :: TxOutRef
|
proposalRef :: TxOutRef
|
||||||
proposalRef = TxOutRef proposalTxRef 0
|
proposalRef = TxOutRef proposalTxRef 0
|
||||||
|
|
||||||
|
-- | Reference to the stake UTXO.
|
||||||
stakeRef :: TxOutRef
|
stakeRef :: TxOutRef
|
||||||
stakeRef = TxOutRef stakeTxRef 1
|
stakeRef = TxOutRef stakeTxRef 1
|
||||||
|
|
||||||
|
|
@ -79,9 +81,11 @@ data Parameters = Parameters
|
||||||
-- ^ The count of votes.
|
-- ^ The count of votes.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-- | The public key hash of the stake owner.
|
||||||
stakeOwner :: PubKeyHash
|
stakeOwner :: PubKeyHash
|
||||||
stakeOwner = signer
|
stakeOwner = signer
|
||||||
|
|
||||||
|
-- | The votes of the input proposals.
|
||||||
initialVotes :: AssocMap.Map ResultTag Integer
|
initialVotes :: AssocMap.Map ResultTag Integer
|
||||||
initialVotes =
|
initialVotes =
|
||||||
AssocMap.fromList
|
AssocMap.fromList
|
||||||
|
|
@ -89,6 +93,7 @@ initialVotes =
|
||||||
, (ResultTag 1, 4242)
|
, (ResultTag 1, 4242)
|
||||||
]
|
]
|
||||||
|
|
||||||
|
-- | The input proposal datum.
|
||||||
proposalInputDatum :: ProposalDatum
|
proposalInputDatum :: ProposalDatum
|
||||||
proposalInputDatum =
|
proposalInputDatum =
|
||||||
ProposalDatum
|
ProposalDatum
|
||||||
|
|
@ -106,12 +111,16 @@ proposalInputDatum =
|
||||||
, startingTime = ProposalStartingTime 0
|
, startingTime = ProposalStartingTime 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-- | The locks of the input stake.
|
||||||
existingLocks :: [ProposalLock]
|
existingLocks :: [ProposalLock]
|
||||||
existingLocks =
|
existingLocks =
|
||||||
[ ProposalLock (ResultTag 0) (ProposalId 0)
|
[ Voted (ProposalId 0) (ResultTag 0)
|
||||||
, ProposalLock (ResultTag 2) (ProposalId 1)
|
, Voted (ProposalId 1) (ResultTag 2)
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{- | Set the 'StakeDatum.stakedAmount' according to the number of votes being
|
||||||
|
casted.
|
||||||
|
-}
|
||||||
mkStakeInputDatum :: Parameters -> StakeDatum
|
mkStakeInputDatum :: Parameters -> StakeDatum
|
||||||
mkStakeInputDatum params =
|
mkStakeInputDatum params =
|
||||||
StakeDatum
|
StakeDatum
|
||||||
|
|
@ -120,14 +129,19 @@ mkStakeInputDatum params =
|
||||||
, lockedBy = existingLocks
|
, lockedBy = existingLocks
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-- | Create the proposal redeemer. In this case @'Vote' _@ will always be used.
|
||||||
mkProposalRedeemer :: Parameters -> ProposalRedeemer
|
mkProposalRedeemer :: Parameters -> ProposalRedeemer
|
||||||
mkProposalRedeemer = Vote . voteFor
|
mkProposalRedeemer = Vote . voteFor
|
||||||
|
|
||||||
|
-- | Place new proposal locks on the stake.
|
||||||
mkNewLock :: Parameters -> ProposalLock
|
mkNewLock :: Parameters -> ProposalLock
|
||||||
mkNewLock ps = ProposalLock ps.voteFor proposalInputDatum.proposalId
|
mkNewLock = Voted proposalInputDatum.proposalId . voteFor
|
||||||
|
|
||||||
mkStakeRedeemer :: Parameters -> StakeRedeemer
|
{- | The stake redeemer that is used in 'mkTestTree'. In this case it'll always be
|
||||||
mkStakeRedeemer = PermitVote . mkNewLock
|
'PermitVote'.
|
||||||
|
-}
|
||||||
|
stakeRedeemer :: StakeRedeemer
|
||||||
|
stakeRedeemer = PermitVote
|
||||||
|
|
||||||
-- | Create a valid transaction that votes on a propsal, given the parameters.
|
-- | Create a valid transaction that votes on a propsal, given the parameters.
|
||||||
vote :: Parameters -> TxInfo
|
vote :: Parameters -> TxInfo
|
||||||
|
|
@ -210,6 +224,7 @@ vote params =
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
-- | Valida parameters that vote on the proposal.
|
||||||
validVoteParameters :: Parameters
|
validVoteParameters :: Parameters
|
||||||
validVoteParameters =
|
validVoteParameters =
|
||||||
Parameters
|
Parameters
|
||||||
|
|
@ -219,6 +234,9 @@ validVoteParameters =
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
{- | Create a test tree that runs the stake validator and proposal validator to
|
||||||
|
test the voting functionalities.
|
||||||
|
-}
|
||||||
mkTestTree :: String -> Parameters -> Bool -> SpecificationTree
|
mkTestTree :: String -> Parameters -> Bool -> SpecificationTree
|
||||||
mkTestTree name ps isValid = group name [proposal, stake]
|
mkTestTree name ps isValid = group name [proposal, stake]
|
||||||
where
|
where
|
||||||
|
|
@ -242,7 +260,7 @@ mkTestTree name ps isValid = group name [proposal, stake]
|
||||||
"stake"
|
"stake"
|
||||||
(stakeValidator Shared.stake)
|
(stakeValidator Shared.stake)
|
||||||
stakeInputDatum
|
stakeInputDatum
|
||||||
(mkStakeRedeemer ps)
|
stakeRedeemer
|
||||||
( ScriptContext
|
( ScriptContext
|
||||||
txInfo
|
txInfo
|
||||||
(Spending stakeRef)
|
(Spending stakeRef)
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,7 @@ specs =
|
||||||
(ProposalId 0)
|
(ProposalId 0)
|
||||||
def
|
def
|
||||||
def
|
def
|
||||||
|
3
|
||||||
)
|
)
|
||||||
MutateGovernor
|
MutateGovernor
|
||||||
( ScriptContext
|
( ScriptContext
|
||||||
|
|
@ -60,6 +61,7 @@ specs =
|
||||||
(ProposalId 0)
|
(ProposalId 0)
|
||||||
def
|
def
|
||||||
def
|
def
|
||||||
|
3
|
||||||
)
|
)
|
||||||
MutateGovernor
|
MutateGovernor
|
||||||
( ScriptContext
|
( ScriptContext
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,7 @@ specs =
|
||||||
(ProposalId 0)
|
(ProposalId 0)
|
||||||
def
|
def
|
||||||
def
|
def
|
||||||
|
3
|
||||||
)
|
)
|
||||||
CreateProposal
|
CreateProposal
|
||||||
createProposal
|
createProposal
|
||||||
|
|
@ -58,6 +59,7 @@ specs =
|
||||||
(ProposalId 5)
|
(ProposalId 5)
|
||||||
def
|
def
|
||||||
def
|
def
|
||||||
|
3
|
||||||
)
|
)
|
||||||
MintGATs
|
MintGATs
|
||||||
mintGATs
|
mintGATs
|
||||||
|
|
@ -69,6 +71,7 @@ specs =
|
||||||
(ProposalId 5)
|
(ProposalId 5)
|
||||||
def
|
def
|
||||||
def
|
def
|
||||||
|
3
|
||||||
)
|
)
|
||||||
MutateGovernor
|
MutateGovernor
|
||||||
mutateState
|
mutateState
|
||||||
|
|
|
||||||
|
|
@ -95,12 +95,16 @@ updateMap f k =
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- | Sort the given 'AssocMap.Map' by keys in ascending order.
|
||||||
sortMap :: forall k v. Ord k => AssocMap.Map k v -> AssocMap.Map k v
|
sortMap :: forall k v. Ord k => AssocMap.Map k v -> AssocMap.Map k v
|
||||||
sortMap =
|
sortMap =
|
||||||
AssocMap.fromList
|
AssocMap.fromList
|
||||||
. sortOn fst
|
. sortOn fst
|
||||||
. AssocMap.toList
|
. AssocMap.toList
|
||||||
|
|
||||||
|
{- | Sort the given 'Value' in ascending order. Some plutarch functions that
|
||||||
|
work with plutarch's 'Sorted' 'PMap' require this to work correctly.
|
||||||
|
-}
|
||||||
sortValue :: Value -> Value
|
sortValue :: Value -> Value
|
||||||
sortValue =
|
sortValue =
|
||||||
Value
|
Value
|
||||||
|
|
|
||||||
122
bench.csv
122
bench.csv
|
|
@ -2,69 +2,69 @@ name,cpu,mem,size
|
||||||
Agora/Effects/Treasury Withdrawal Effect/effect/Simple,333327612,830203,3674
|
Agora/Effects/Treasury Withdrawal Effect/effect/Simple,333327612,830203,3674
|
||||||
Agora/Effects/Treasury Withdrawal Effect/effect/Simple with multiple treasuries ,492387542,1197315,3986
|
Agora/Effects/Treasury Withdrawal Effect/effect/Simple with multiple treasuries ,492387542,1197315,3986
|
||||||
Agora/Effects/Treasury Withdrawal Effect/effect/Mixed Assets,456007605,1104500,3859
|
Agora/Effects/Treasury Withdrawal Effect/effect/Mixed Assets,456007605,1104500,3859
|
||||||
Agora/Effects/Governor Mutation Effect/validator/valid new governor datum/governor validator should pass,87839169,243032,8561
|
Agora/Effects/Governor Mutation Effect/validator/valid new governor datum/governor validator should pass,88940927,246756,8843
|
||||||
Agora/Effects/Governor Mutation Effect/validator/valid new governor datum/effect validator should pass,106082031,292993,3609
|
Agora/Effects/Governor Mutation Effect/validator/valid new governor datum/effect validator should pass,107090537,296185,3627
|
||||||
Agora/Stake/policy/stakeCreation,50939580,148729,2387
|
Agora/Stake/policy/stakeCreation,51008580,149029,2522
|
||||||
Agora/Stake/validator/stakeDepositWithdraw deposit,150745141,416137,4995
|
Agora/Stake/validator/stakeDepositWithdraw deposit,183506412,498838,4745
|
||||||
Agora/Stake/validator/stakeDepositWithdraw withdraw,150745141,416137,4983
|
Agora/Stake/validator/stakeDepositWithdraw withdraw,183506412,498838,4733
|
||||||
Agora/Proposal/policy/proposalCreation,23140177,69194,1515
|
Agora/Proposal/policy/proposalCreation,23140177,69194,1517
|
||||||
Agora/Proposal/validator/cosignature/legal/with 1 cosigners/propsoal,235408912,657765,8097
|
Agora/Proposal/validator/cosignature/legal/with 1 cosigners/propsoal,231665387,648239,8164
|
||||||
Agora/Proposal/validator/cosignature/legal/with 1 cosigners/stake,125665131,316762,5462
|
Agora/Proposal/validator/cosignature/legal/with 1 cosigners/stake,122255811,317464,5213
|
||||||
Agora/Proposal/validator/cosignature/legal/with 5 cosigners/propsoal,680441047,1897008,10727
|
Agora/Proposal/validator/cosignature/legal/with 5 cosigners/propsoal,662329378,1846986,10794
|
||||||
Agora/Proposal/validator/cosignature/legal/with 5 cosigners/stake,576106975,1490610,7972
|
Agora/Proposal/validator/cosignature/legal/with 5 cosigners/stake,553050999,1459872,7723
|
||||||
Agora/Proposal/validator/cosignature/legal/with 10 cosigners/propsoal,1351073436,3706315,14015
|
Agora/Proposal/validator/cosignature/legal/with 10 cosigners/propsoal,1315001587,3605673,14082
|
||||||
Agora/Proposal/validator/cosignature/legal/with 10 cosigners/stake,1148637636,2982695,11109
|
Agora/Proposal/validator/cosignature/legal/with 10 cosigners/stake,1101023340,2912657,10860
|
||||||
Agora/Proposal/validator/cosignature/illegal/duplicate cosigners/stake,125665131,316762,5462
|
Agora/Proposal/validator/cosignature/illegal/duplicate cosigners/stake,122255811,317464,5213
|
||||||
Agora/Proposal/validator/cosignature/illegal/proposal status not Draft/with 1 cosigners/status: VotingReady/stake,125665131,316762,5462
|
Agora/Proposal/validator/cosignature/illegal/proposal status not Draft/with 1 cosigners/status: VotingReady/stake,122255811,317464,5213
|
||||||
Agora/Proposal/validator/cosignature/illegal/proposal status not Draft/with 1 cosigners/status: Locked/stake,125665131,316762,5462
|
Agora/Proposal/validator/cosignature/illegal/proposal status not Draft/with 1 cosigners/status: Locked/stake,122255811,317464,5213
|
||||||
Agora/Proposal/validator/cosignature/illegal/proposal status not Draft/with 1 cosigners/status: Finished/stake,125665131,316762,5462
|
Agora/Proposal/validator/cosignature/illegal/proposal status not Draft/with 1 cosigners/status: Finished/stake,122255811,317464,5213
|
||||||
Agora/Proposal/validator/cosignature/illegal/proposal status not Draft/with 5 cosigners/status: VotingReady/stake,576106975,1490610,7972
|
Agora/Proposal/validator/cosignature/illegal/proposal status not Draft/with 5 cosigners/status: VotingReady/stake,553050999,1459872,7723
|
||||||
Agora/Proposal/validator/cosignature/illegal/proposal status not Draft/with 5 cosigners/status: Locked/stake,576106975,1490610,7972
|
Agora/Proposal/validator/cosignature/illegal/proposal status not Draft/with 5 cosigners/status: Locked/stake,553050999,1459872,7723
|
||||||
Agora/Proposal/validator/cosignature/illegal/proposal status not Draft/with 5 cosigners/status: Finished/stake,576106975,1490610,7972
|
Agora/Proposal/validator/cosignature/illegal/proposal status not Draft/with 5 cosigners/status: Finished/stake,553050999,1459872,7723
|
||||||
Agora/Proposal/validator/cosignature/illegal/proposal status not Draft/with 10 cosigners/status: VotingReady/stake,1148637636,2982695,11109
|
Agora/Proposal/validator/cosignature/illegal/proposal status not Draft/with 10 cosigners/status: VotingReady/stake,1101023340,2912657,10860
|
||||||
Agora/Proposal/validator/cosignature/illegal/proposal status not Draft/with 10 cosigners/status: Locked/stake,1148637636,2982695,11109
|
Agora/Proposal/validator/cosignature/illegal/proposal status not Draft/with 10 cosigners/status: Locked/stake,1101023340,2912657,10860
|
||||||
Agora/Proposal/validator/cosignature/illegal/proposal status not Draft/with 10 cosigners/status: Finished/stake,1148637636,2982695,11109
|
Agora/Proposal/validator/cosignature/illegal/proposal status not Draft/with 10 cosigners/status: Finished/stake,1101023340,2912657,10860
|
||||||
Agora/Proposal/validator/voting/legal/propsoal,246896882,688919,8069
|
Agora/Proposal/validator/voting/legal/propsoal,254672808,713771,8146
|
||||||
Agora/Proposal/validator/voting/legal/stake,141234659,368136,5481
|
Agora/Proposal/validator/voting/legal/stake,139493011,366217,5239
|
||||||
Agora/Proposal/validator/advancing/from draft/with 1 cosigner(s)/legal/to next state/propsoal,222376736,631090,8052
|
Agora/Proposal/validator/advancing/from draft/with 1 cosigner(s)/legal/to next state/propsoal,222392288,630302,8127
|
||||||
Agora/Proposal/validator/advancing/from draft/with 1 cosigner(s)/legal/to next state/stake,125665131,316762,5459
|
Agora/Proposal/validator/advancing/from draft/with 1 cosigner(s)/legal/to next state/stake,122255811,317464,5222
|
||||||
Agora/Proposal/validator/advancing/from draft/with 1 cosigner(s)/legal/to failed state/propsoal,217322044,620369,8054
|
Agora/Proposal/validator/advancing/from draft/with 1 cosigner(s)/legal/to failed state/propsoal,217337596,619581,8129
|
||||||
Agora/Proposal/validator/advancing/from draft/with 1 cosigner(s)/legal/to failed state/stake,125665131,316762,5461
|
Agora/Proposal/validator/advancing/from draft/with 1 cosigner(s)/legal/to failed state/stake,122255811,317464,5224
|
||||||
Agora/Proposal/validator/advancing/from draft/with 1 cosigner(s)/illegal/insufficient cosigns/stake,118020743,304972,5389
|
Agora/Proposal/validator/advancing/from draft/with 1 cosigner(s)/illegal/insufficient cosigns/stake,117978393,308804,5152
|
||||||
Agora/Proposal/validator/advancing/from draft/with 5 cosigner(s)/legal/to next state/propsoal,614587307,1766683,10875
|
Agora/Proposal/validator/advancing/from draft/with 5 cosigner(s)/legal/to next state/propsoal,602596705,1722841,10982
|
||||||
Agora/Proposal/validator/advancing/from draft/with 5 cosigner(s)/legal/to next state/stake,548619697,1410656,8162
|
Agora/Proposal/validator/advancing/from draft/with 5 cosigner(s)/legal/to next state/stake,499559031,1304096,7957
|
||||||
Agora/Proposal/validator/advancing/from draft/with 5 cosigner(s)/legal/to failed state/propsoal,239691392,682433,8415
|
Agora/Proposal/validator/advancing/from draft/with 5 cosigner(s)/legal/to failed state/propsoal,239706944,681645,8490
|
||||||
Agora/Proposal/validator/advancing/from draft/with 5 cosigner(s)/legal/to failed state/stake,125665131,316762,5702
|
Agora/Proposal/validator/advancing/from draft/with 5 cosigner(s)/legal/to failed state/stake,122255811,317464,5465
|
||||||
Agora/Proposal/validator/advancing/from draft/with 5 cosigner(s)/illegal/insufficient cosigns/stake,446252055,1166812,7811
|
Agora/Proposal/validator/advancing/from draft/with 5 cosigner(s)/illegal/insufficient cosigns/stake,446950999,1172710,7606
|
||||||
Agora/Proposal/validator/advancing/from draft/with 10 cosigner(s)/legal/to next state/propsoal,1196289192,3454898,14404
|
Agora/Proposal/validator/advancing/from draft/with 10 cosigner(s)/legal/to next state/propsoal,1183788938,3402248,14551
|
||||||
Agora/Proposal/validator/advancing/from draft/with 10 cosigner(s)/legal/to next state/stake,1201388310,3136405,11540
|
Agora/Proposal/validator/advancing/from draft/with 10 cosigner(s)/legal/to next state/stake,1129251912,2994677,11375
|
||||||
Agora/Proposal/validator/advancing/from draft/with 10 cosigner(s)/legal/to failed state/propsoal,267653077,760013,8868
|
Agora/Proposal/validator/advancing/from draft/with 10 cosigner(s)/legal/to failed state/propsoal,267668629,759225,8943
|
||||||
Agora/Proposal/validator/advancing/from draft/with 10 cosigner(s)/legal/to failed state/stake,125665131,316762,6004
|
Agora/Proposal/validator/advancing/from draft/with 10 cosigner(s)/legal/to failed state/stake,122255811,317464,5767
|
||||||
Agora/Proposal/validator/advancing/from draft/with 10 cosigner(s)/illegal/insufficient cosigns/stake,1025012867,2732083,10837
|
Agora/Proposal/validator/advancing/from draft/with 10 cosigner(s)/illegal/insufficient cosigns/stake,1013080113,2701103,10673
|
||||||
Agora/Proposal/validator/advancing/legal/advance to next state/from: VotingReady/propsoal,250229153,709227,8061
|
Agora/Proposal/validator/advancing/legal/advance to next state/from: VotingReady/propsoal,253438293,715975,8136
|
||||||
Agora/Proposal/validator/advancing/legal/advance to next state/from: VotingReady/stake,125665131,316762,5466
|
Agora/Proposal/validator/advancing/legal/advance to next state/from: VotingReady/stake,122255811,317464,5229
|
||||||
Agora/Proposal/validator/advancing/legal/advance to next state/from: Locked/propsoal,238990044,676396,8061
|
Agora/Proposal/validator/advancing/legal/advance to next state/from: Locked/propsoal,242199184,683144,8136
|
||||||
Agora/Proposal/validator/advancing/legal/advance to next state/from: Locked/stake,125665131,316762,5466
|
Agora/Proposal/validator/advancing/legal/advance to next state/from: Locked/stake,122255811,317464,5229
|
||||||
Agora/Proposal/validator/advancing/legal/advance to failed state/from: VotingReady/propsoal,236162599,670386,8055
|
Agora/Proposal/validator/advancing/legal/advance to failed state/from: VotingReady/propsoal,239371739,677134,8130
|
||||||
Agora/Proposal/validator/advancing/legal/advance to failed state/from: VotingReady/stake,125665131,316762,5462
|
Agora/Proposal/validator/advancing/legal/advance to failed state/from: VotingReady/stake,122255811,317464,5225
|
||||||
Agora/Proposal/validator/advancing/legal/advance to failed state/from: Locked/propsoal,237293577,672790,8055
|
Agora/Proposal/validator/advancing/legal/advance to failed state/from: Locked/propsoal,240502717,679538,8130
|
||||||
Agora/Proposal/validator/advancing/legal/advance to failed state/from: Locked/stake,125665131,316762,5462
|
Agora/Proposal/validator/advancing/legal/advance to failed state/from: Locked/stake,122255811,317464,5225
|
||||||
Agora/Proposal/validator/advancing/illegal/insufficient votes/stake,125665131,316762,5462
|
Agora/Proposal/validator/advancing/illegal/insufficient votes/stake,122255811,317464,5225
|
||||||
Agora/Proposal/validator/advancing/illegal/initial state is Finished/stake,125665131,316762,5454
|
Agora/Proposal/validator/advancing/illegal/initial state is Finished/stake,122255811,317464,5217
|
||||||
"Agora/Proposal/validator/unlocking/legal/1 proposals, voter, unlock stake + retract votes, VotingReady",245855872,689807,8029
|
"Agora/Proposal/validator/unlocking/legal/1 proposals, voter, unlock stake + retract votes, VotingReady",236724208,665425,8096
|
||||||
"Agora/Proposal/validator/unlocking/legal/1 proposals, creator, unlock stake, Finished",215131610,613807,8031
|
"Agora/Proposal/validator/unlocking/legal/1 proposals, creator, unlock stake, Finished",204516343,585280,8093
|
||||||
"Agora/Proposal/validator/unlocking/legal/voter unlocks stake after voting/1 proposals, voter, unlock stake, Finished",212428891,605718,8033
|
"Agora/Proposal/validator/unlocking/legal/voter unlocks stake after voting/1 proposals, voter, unlock stake, Finished",205832495,589164,8100
|
||||||
"Agora/Proposal/validator/unlocking/legal/voter unlocks stake after voting/1 proposals, voter, unlock stake, Locked",212428891,605718,8033
|
"Agora/Proposal/validator/unlocking/legal/voter unlocks stake after voting/1 proposals, voter, unlock stake, Locked",205832495,589164,8100
|
||||||
"Agora/Proposal/validator/unlocking/legal/42 proposals, voter, unlock stake + retract votes, VotingReady",1775520444,5200586,29137
|
"Agora/Proposal/validator/unlocking/legal/42 proposals, voter, unlock stake + retract votes, VotingReady",1698797000,4895231,29286
|
||||||
"Agora/Proposal/validator/unlocking/legal/42 proposals, creator, unlock stake, Finished",1448162043,4319059,29321
|
"Agora/Proposal/validator/unlocking/legal/42 proposals, creator, unlock stake, Finished",1312344666,3843304,29242
|
||||||
"Agora/Proposal/validator/unlocking/legal/voter unlocks stake after voting/42 proposals, voter, unlock stake, Finished",1340521669,3979526,29305
|
"Agora/Proposal/validator/unlocking/legal/voter unlocks stake after voting/42 proposals, voter, unlock stake, Finished",1356230175,3961906,29455
|
||||||
"Agora/Proposal/validator/unlocking/legal/voter unlocks stake after voting/42 proposals, voter, unlock stake, Locked",1340521669,3979526,29305
|
"Agora/Proposal/validator/unlocking/legal/voter unlocks stake after voting/42 proposals, voter, unlock stake, Locked",1356230175,3961906,29455
|
||||||
Agora/AuthorityToken/singleAuthorityTokenBurned/Correct simple,21017788,55883,806
|
Agora/AuthorityToken/singleAuthorityTokenBurned/Correct simple,21017788,55883,806
|
||||||
Agora/AuthorityToken/singleAuthorityTokenBurned/Correct many inputs,33204186,88241,900
|
Agora/AuthorityToken/singleAuthorityTokenBurned/Correct many inputs,33204186,88241,900
|
||||||
Agora/Treasury/Validator/Positive/Allows for effect changes,31556709,81546,1452
|
Agora/Treasury/Validator/Positive/Allows for effect changes,31556709,81546,1452
|
||||||
Agora/AuthorityToken/singleAuthorityTokenBurned/Correct simple,21017788,55883,806
|
Agora/AuthorityToken/singleAuthorityTokenBurned/Correct simple,21017788,55883,806
|
||||||
Agora/AuthorityToken/singleAuthorityTokenBurned/Correct many inputs,33204186,88241,900
|
Agora/AuthorityToken/singleAuthorityTokenBurned/Correct many inputs,33204186,88241,900
|
||||||
Agora/Governor/policy/GST minting,51007235,144191,2034
|
Agora/Governor/policy/GST minting,51480023,145787,2048
|
||||||
Agora/Governor/validator/proposal creation,309689999,834675,9064
|
Agora/Governor/validator/proposal creation,303114849,813451,9342
|
||||||
Agora/Governor/validator/GATs minting,418560845,1137908,9187
|
Agora/Governor/validator/GATs minting,422654153,1147158,9468
|
||||||
Agora/Governor/validator/mutate governor state,88986020,248491,8662
|
Agora/Governor/validator/mutate governor state,90087778,252215,8943
|
||||||
|
|
|
||||||
|
Loading…
Add table
Add a link
Reference in a new issue