improve doc string and naming as suggested by auditors

This commit is contained in:
Hongrui Fang 2022-11-10 18:24:52 +08:00
parent 7c3d66f365
commit ae72d0ae6d
10 changed files with 23 additions and 24 deletions

View file

@ -114,7 +114,7 @@ mkEffectTxInfo newGovDatum =
, nextProposalId = ProposalId 0
, proposalTimings = def
, createProposalTimeRangeMaxWidth = def
, maximumProposalsPerStake = 3
, maximumCreatedProposalsPerStake = 3
}
governorInputDatum :: Datum
governorInputDatum = Datum $ toBuiltinData governorInputDatum'
@ -186,7 +186,7 @@ validNewGovernorDatum =
, nextProposalId = ProposalId 42
, proposalTimings = def
, createProposalTimeRangeMaxWidth = def
, maximumProposalsPerStake = 3
, maximumCreatedProposalsPerStake = 3
}
invalidNewGovernorDatum :: GovernorDatum
@ -199,5 +199,5 @@ invalidNewGovernorDatum =
, nextProposalId = ProposalId 42
, proposalTimings = def
, createProposalTimeRangeMaxWidth = def
, maximumProposalsPerStake = 3
, maximumCreatedProposalsPerStake = 3
}

View file

@ -72,7 +72,7 @@ data Parameters = Parameters
-- ^ Whether the 'GovernorDatum.proposalThresholds' field of the output
-- governor datum is valid or not.
, datumMaxTimeRangeWidthValid :: Bool
-- ^ Whether the 'GovernorDatum.maximumProposalsPerStake'field of the
-- ^ Whether the 'GovernorDatum.maximumCreatedProposalsPerStake'field of the
-- output governor datum is valid or not.
, datumTimingConfigValid :: Bool
-- ^ Whether the 'GovernorDatum.proposalTimings'field of the output
@ -96,7 +96,7 @@ validGovernorOutputDatum =
, nextProposalId = ProposalId 0
, proposalTimings = def
, createProposalTimeRangeMaxWidth = def
, maximumProposalsPerStake = 3
, maximumCreatedProposalsPerStake = 3
}
invalidProposalThresholds :: ProposalThresholds

View file

@ -105,7 +105,7 @@ governorInputDatum =
, nextProposalId = ProposalId 0
, proposalTimings = def
, createProposalTimeRangeMaxWidth = def
, maximumProposalsPerStake = 3
, maximumCreatedProposalsPerStake = 3
}
mkGovernorOutputDatum ::
@ -115,7 +115,7 @@ mkGovernorOutputDatum DatumValid =
Just $
toData $
governorInputDatum
{ maximumProposalsPerStake = 4
{ maximumCreatedProposalsPerStake = 4
}
mkGovernorOutputDatum ValueInvalid =
let invalidProposalThresholds =

View file

@ -426,14 +426,14 @@ governorInputDatum =
, nextProposalId = ProposalId 42
, proposalTimings = def
, createProposalTimeRangeMaxWidth = def
, maximumProposalsPerStake = 3
, maximumCreatedProposalsPerStake = 3
}
-- | Create the output governor datum given the parameters.
mkGovernorOutputDatum :: GovernorParameters -> GovernorDatum
mkGovernorOutputDatum ps =
if ps.invalidGovernorOutputDatum
then governorInputDatum {maximumProposalsPerStake = 15}
then governorInputDatum {maximumCreatedProposalsPerStake = 15}
else governorInputDatum
-- | Reference to the governor UTXO.

View file

@ -136,7 +136,7 @@ data Parameters = Parameters
--------------------------------------------------------------------------------
-- | See 'GovernorDatum.maximumProposalsPerStake'.
-- | See 'GovernorDatum.maximumCreatedProposalsPerStake'.
maxProposalPerStake :: Integer
maxProposalPerStake = 3
@ -181,7 +181,7 @@ governorInputDatum =
, nextProposalId = thisProposalId
, proposalTimings = def
, createProposalTimeRangeMaxWidth = def
, maximumProposalsPerStake = maxProposalPerStake
, maximumCreatedProposalsPerStake = maxProposalPerStake
}
-- | Create governor output datum given the parameters.
@ -196,7 +196,7 @@ mkGovernorOutputDatum ps =
, nextProposalId = nextPid
, proposalTimings = def
, createProposalTimeRangeMaxWidth = def
, maximumProposalsPerStake = maxProposalPerStake
, maximumCreatedProposalsPerStake = maxProposalPerStake
}
--------------------------------------------------------------------------------