Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
lehins committed May 8, 2024
1 parent f736694 commit 739e623
Showing 1 changed file with 22 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,19 +130,34 @@ type ProtocolShelley = HardForkProtocol '[ ShelleyBlock (TPraos StandardCrypto)

shelleyTransition ::
forall era proto. ShelleyCompatible proto era
=> Word16 -- ^ Next era's initial major protocol version
=> PartialLedgerConfig (ShelleyBlock proto era)
-> Word16 -- ^ Next era's initial major protocol version
-> LedgerState (ShelleyBlock proto era)
-> Maybe EpochNo
shelleyTransition transitionMajorVersionRaw =
isTransition . Shelley.Inspect.pparamsUpdate
shelleyTransition ShelleyPartialLedgerConfig{..}
transitionMajorVersionRaw
state =
isTransition
. Shelley.Inspect.pparamsUpdate
$ state
where
ShelleyTransitionInfo{..} = shelleyLedgerTransition state

-- 'shelleyLedgerConfig' contains a dummy 'EpochInfo' but this does not
-- matter for extracting the genesis config
genesis :: SL.ShelleyGenesis (EraCrypto era)
genesis = shelleyLedgerGenesis shelleyLedgerConfig

k :: Word64
k = SL.sgSecurityParam genesis

isTransition :: ShelleyLedgerUpdate era -> Maybe EpochNo
isTransition (ShelleyUpdatedPParams maybePParams newPParamsEpochNo) = do
SL.SJust pp <- Just maybePParams
let protVer = pp ^. SL.ppProtocolVersionL
transitionMajorVersion <- SL.mkVersion transitionMajorVersionRaw
guard $ SL.pvMajor protVer == transitionMajorVersion
guard $ shelleyAfterVoting >= fromIntegral k
return newPParamsEpochNo

instance
Expand All @@ -161,7 +176,10 @@ instance
TriggerHardForkNotDuringThisExecution -> Nothing
TriggerHardForkAtEpoch epoch -> Just epoch
TriggerHardForkAtVersion shelleyMajorVersion ->
shelleyTransition shelleyMajorVersion ledgerState
shelleyTransition
pcfg
shelleyMajorVersion
ledgerState

singleEraInfo _ = SingleEraInfo {
singleEraName = T.pack (L.eraName @era)
Expand Down

0 comments on commit 739e623

Please sign in to comment.