Skip to content

Commit 7c616ac

Browse files
committed
Add leios params to create-protocol-parameters-update
All these parameters are available now in ledger and cardano-api
1 parent 517ffe9 commit 7c616ac

2 files changed

Lines changed: 112 additions & 5 deletions

File tree

cabal.project

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,12 +133,12 @@ source-repository-package
133133
subdir:
134134
typed-protocols
135135

136-
-- Points to cardano-api/leios-prototype
136+
-- Points to origin/ch1bo/leios-pparam-updates
137137
source-repository-package
138138
type: git
139139
location: https://github.com/IntersectMBO/cardano-api
140-
tag: e32d8c07035283233fbdca4beeafbd78abc66512
141-
--sha256: sha256-yYKuOUoIOvJy6872Sj3CruRT+UXfoQsqqaHXcYu8N1A=
140+
tag: ed01aa0a8e3e069d2d4d4f47bd89a6ac68bd4e03
141+
--sha256: sha256-ZUhGbDtte7/g92Z48kvCUdIOdSeaNjqhlMt21r8YlKY=
142142
subdir:
143143
cardano-api
144144
cardano-api-gen

cardano-cli/src/Cardano/CLI/EraBased/Governance/Actions/Option.hs

Lines changed: 109 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,12 @@ import Cardano.CLI.EraBased.Governance.Actions.Command qualified as Cmd
2121
import Cardano.CLI.Option.Flag (setDefault)
2222
import Cardano.CLI.Parser
2323
import Cardano.CLI.Type.Common
24-
import Cardano.Ledger.BaseTypes (NonZero, PositiveInterval, nonZero)
24+
import Cardano.Ledger.BaseTypes (Milliseconds32 (..), NonZero, PositiveInterval, nonZero)
25+
import Cardano.Ledger.Plutus.ExUnits (OrdExUnits (..))
2526

2627
import Data.Foldable
2728
import Data.Function ((&))
28-
import Data.Word (Word32)
29+
import Data.Word (Word16, Word32)
2930
import GHC.Natural (Natural)
3031
import Options.Applicative
3132
import Options.Applicative qualified as Opt
@@ -312,6 +313,112 @@ pIntroducedInDijkstraPParams =
312313
<*> convertToLedger id (optional pMaxRefScriptSizePerTx)
313314
<*> convertToLedger id (optional pRefScriptCostStride)
314315
<*> convertToLedger id (optional pRefScriptCostMultiplier)
316+
<*> convertToLedger id (optional pLeiosAnnouncementPeriodLength)
317+
<*> convertToLedger id (optional pLeiosVotePeriodLength)
318+
<*> convertToLedger id (optional pLeiosDiffusionPeriodLength)
319+
<*> convertToLedger id (optional pLeiosCommitteeSize)
320+
<*> convertToLedger toUnitIntervalOrErr (optional pLeiosQuorumStakeThreshold)
321+
<*> convertToLedger id (optional pMaxEndorserBlockReferencesSize)
322+
<*> convertToLedger id (optional pMaxEndorserBlockTxsSize)
323+
<*> convertToLedger (OrdExUnits . toAlonzoExUnits) (optional pMaxEndorserBlockExecutionUnits)
324+
<*> convertToLedger id (optional pMaxRefScriptSizePerEndorserBlock)
325+
326+
pLeiosAnnouncementPeriodLength :: Parser Milliseconds32
327+
pLeiosAnnouncementPeriodLength =
328+
Milliseconds32
329+
<$> Opt.option
330+
integralReader
331+
( mconcat
332+
[ Opt.long "leios-announcement-period-length"
333+
, Opt.metavar "MILLISECONDS"
334+
, Opt.help "Length of the Leios announcement period, in milliseconds."
335+
]
336+
)
337+
338+
pLeiosVotePeriodLength :: Parser Milliseconds32
339+
pLeiosVotePeriodLength =
340+
Milliseconds32
341+
<$> Opt.option
342+
integralReader
343+
( mconcat
344+
[ Opt.long "leios-vote-period-length"
345+
, Opt.metavar "MILLISECONDS"
346+
, Opt.help "Length of the Leios voting period, in milliseconds."
347+
]
348+
)
349+
350+
pLeiosDiffusionPeriodLength :: Parser Milliseconds32
351+
pLeiosDiffusionPeriodLength =
352+
Milliseconds32
353+
<$> Opt.option
354+
integralReader
355+
( mconcat
356+
[ Opt.long "leios-diffusion-period-length"
357+
, Opt.metavar "MILLISECONDS"
358+
, Opt.help "Length of the Leios diffusion period, in milliseconds."
359+
]
360+
)
361+
362+
pLeiosCommitteeSize :: Parser Word16
363+
pLeiosCommitteeSize =
364+
Opt.option integralReader $
365+
mconcat
366+
[ Opt.long "leios-committee-size"
367+
, Opt.metavar "WORD16"
368+
, Opt.help "Number of seats on the Leios voting committee."
369+
]
370+
371+
pLeiosQuorumStakeThreshold :: Parser Rational
372+
pLeiosQuorumStakeThreshold =
373+
Opt.option readRational $
374+
mconcat
375+
[ Opt.long "leios-quorum-stake-threshold"
376+
, Opt.metavar "RATIONAL"
377+
, Opt.help "Fraction of committee stake required to certify an endorser block."
378+
]
379+
380+
pMaxEndorserBlockReferencesSize :: Parser Word32
381+
pMaxEndorserBlockReferencesSize =
382+
Opt.option integralReader $
383+
mconcat
384+
[ Opt.long "max-endorser-block-references-size"
385+
, Opt.metavar "WORD32"
386+
, Opt.help "Maximum total size of the transaction references in an endorser block."
387+
]
388+
389+
pMaxEndorserBlockTxsSize :: Parser Word32
390+
pMaxEndorserBlockTxsSize =
391+
Opt.option integralReader $
392+
mconcat
393+
[ Opt.long "max-endorser-block-txs-size"
394+
, Opt.metavar "WORD32"
395+
, Opt.help "Maximum total size of the transactions referenced by an endorser block."
396+
]
397+
398+
pMaxEndorserBlockExecutionUnits :: Parser ExecutionUnits
399+
pMaxEndorserBlockExecutionUnits =
400+
uncurry ExecutionUnits
401+
<$> Opt.option
402+
pairIntegralReader
403+
( mconcat
404+
[ Opt.long "max-endorser-block-execution-units"
405+
, Opt.metavar "(INT, INT)"
406+
, Opt.help $
407+
mconcat
408+
[ "Max total script execution resource units allowed per endorser "
409+
, "block. They are denominated as follows (steps, memory)."
410+
]
411+
]
412+
)
413+
414+
pMaxRefScriptSizePerEndorserBlock :: Parser Word32
415+
pMaxRefScriptSizePerEndorserBlock =
416+
Opt.option integralReader $
417+
mconcat
418+
[ Opt.long "max-ref-script-size-per-endorser-block"
419+
, Opt.metavar "WORD32"
420+
, Opt.help "Maximum total size of reference scripts per endorser block."
421+
]
315422

316423
pMaxRefScriptSizePerBlock :: Parser Word32
317424
pMaxRefScriptSizePerBlock =

0 commit comments

Comments
 (0)