@@ -45,7 +45,6 @@ import Cardano.Ledger.Keys (KeyHash, KeyRole (BlockIssuer),
4545import qualified Cardano.Ledger.Keys as SL
4646import Cardano.Ledger.PoolDistr
4747 (IndividualPoolStake (IndividualPoolStake ))
48- import Cardano.Ledger.Shelley.API (computeStabilityWindow )
4948import qualified Cardano.Ledger.Shelley.API as SL
5049import Cardano.Ledger.Slot (Duration (Duration ), (+*) )
5150import Cardano.Protocol.TPraos.BHeader (BoundedNatural (bvValue ),
@@ -183,29 +182,35 @@ forgePraosFields
183182-- | Praos parameters that are node independent
184183data PraosParams = PraosParams
185184 { -- | See 'Globals.slotsPerKESPeriod'.
186- praosSlotsPerKESPeriod :: ! Word64 ,
185+ praosSlotsPerKESPeriod :: ! Word64 ,
187186 -- | Active slots coefficient. This parameter represents the proportion
188187 -- of slots in which blocks should be issued. This can be interpreted as
189188 -- the probability that a party holding all the stake will be elected as
190189 -- leader for a given slot.
191- praosLeaderF :: ! SL. ActiveSlotCoeff ,
190+ praosLeaderF :: ! SL. ActiveSlotCoeff ,
192191 -- | See 'Globals.securityParameter'.
193- praosSecurityParam :: ! SecurityParam ,
192+ praosSecurityParam :: ! SecurityParam ,
194193 -- | Maximum number of KES iterations, see 'Globals.maxKESEvo'.
195- praosMaxKESEvo :: ! Word64 ,
194+ praosMaxKESEvo :: ! Word64 ,
196195 -- | Quorum for update system votes and MIR certificates, see
197196 -- 'Globals.quorum'.
198- praosQuorum :: ! Word64 ,
197+ praosQuorum :: ! Word64 ,
199198 -- | All blocks invalid after this protocol version, see
200199 -- 'Globals.maxMajorPV'.
201- praosMaxMajorPV :: ! MaxMajorProtVer ,
200+ praosMaxMajorPV :: ! MaxMajorProtVer ,
202201 -- | Maximum number of lovelace in the system, see
203202 -- 'Globals.maxLovelaceSupply'.
204- praosMaxLovelaceSupply :: ! Word64 ,
203+ praosMaxLovelaceSupply :: ! Word64 ,
205204 -- | Testnet or mainnet?
206- praosNetworkId :: ! SL. Network ,
205+ praosNetworkId :: ! SL. Network ,
207206 -- | The system start, as projected from the chain's genesis block.
208- praosSystemStart :: ! SystemStart
207+ praosSystemStart :: ! SystemStart ,
208+ -- | The number of slots before the start of an epoch where the
209+ -- corresponding epoch nonce is snapshotted. This has to be at least one
210+ -- stability window such that the nonce is stable at the beginning of the
211+ -- epoch. Ouroboros Genesis requires this to be even larger, see
212+ -- 'SL.computeRandomnessStabilisationWindow'.
213+ praosRandomnessStabilisationWindow :: ! Word64
209214 }
210215 deriving (Generic , NoThunks )
211216
@@ -462,7 +467,7 @@ instance PraosCrypto c => ConsensusProtocol (Praos c) where
462467 -- - Update the operational certificate counter.
463468 reupdateChainDepState
464469 _cfg@ ( PraosConfig
465- PraosParams {praosSecurityParam, praosLeaderF }
470+ PraosParams {praosRandomnessStabilisationWindow }
466471 ei
467472 )
468473 b
@@ -473,7 +478,7 @@ instance PraosCrypto c => ConsensusProtocol (Praos c) where
473478 praosStateLabNonce = prevHashToNonce (Views. hvPrevHash b),
474479 praosStateEvolvingNonce = newEvolvingNonce,
475480 praosStateCandidateNonce =
476- if slot +* Duration stabilityWindow < firstSlotNextEpoch
481+ if slot +* Duration praosRandomnessStabilisationWindow < firstSlotNextEpoch
477482 then newEvolvingNonce
478483 else praosStateCandidateNonce cs,
479484 praosStateOCertCounters =
@@ -489,8 +494,6 @@ instance PraosCrypto c => ConsensusProtocol (Praos c) where
489494 let nextEpoch = EpochNo $ currentEpochNo + 1
490495 epochInfoFirst epochInfoWithErr nextEpoch
491496 cs = tickedPraosStateChainDepState tcs
492- stabilityWindow =
493- computeStabilityWindow (maxRollbacks praosSecurityParam) praosLeaderF
494497 eta = vrfNonceValue (Proxy @ c ) $ Views. hvVrfRes b
495498 newEvolvingNonce = praosStateEvolvingNonce cs ⭒ eta
496499 OCert _ n _ _ = Views. hvOCert b
0 commit comments