Skip to content

Commit

Permalink
Accept more golden tests and simplify HFC
Browse files Browse the repository at this point in the history
  • Loading branch information
lehins committed May 8, 2024
1 parent 4e35a7d commit 3d46171
Show file tree
Hide file tree
Showing 16 changed files with 6 additions and 26 deletions.
4 changes: 2 additions & 2 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ packages:
source-repository-package
type: git
location: https://github.com/IntersectMBO/cardano-ledger
tag: def45405ea7bd218af7df00f0b6975d6bc41eed7
--sha256: sha256-U9KalSEobQgIJ7aKH62uYvNjdX1OVNHnLt1ZotxnZ0k=
tag: 686c8fd62ec15a0b575440c94b78205c7946a5d8
--sha256: sha256-GLBrGQJUEnYn/b1EXLENZ1NK+O4HomBmEHImAF/e6sg=
subdir: eras/allegra/impl
eras/alonzo/impl
eras/alonzo/test-suite
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified ouroboros-consensus-cardano/golden/shelley/disk/ExtLedgerState
Binary file not shown.
Binary file modified ouroboros-consensus-cardano/golden/shelley/disk/LedgerState
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -130,32 +130,15 @@ type ProtocolShelley = HardForkProtocol '[ ShelleyBlock (TPraos StandardCrypto)

shelleyTransition ::
forall era proto. ShelleyCompatible proto era
=> PartialLedgerConfig (ShelleyBlock proto era)
-> Word16 -- ^ Next era's initial major protocol version
=> Word16 -- ^ Next era's initial major protocol version
-> LedgerState (ShelleyBlock proto era)
-> Maybe EpochNo
shelleyTransition ShelleyPartialLedgerConfig{..}
transitionMajorVersionRaw
state =
isTransition
. Shelley.Inspect.pparamsUpdate
$ state
shelleyTransition transitionMajorVersionRaw =
isTransition . Shelley.Inspect.pparamsUpdate
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
-- We need to run this check first in order to ensure that PParams value is not
-- forced unnecessarily. See documentation of `futurePParamsGovStateG` in ledger.
guard $ shelleyAfterVoting >= fromIntegral k
SL.SJust pp <- Just maybePParams
let protVer = pp ^. SL.ppProtocolVersionL
transitionMajorVersion <- SL.mkVersion transitionMajorVersionRaw
Expand All @@ -178,10 +161,7 @@ instance
TriggerHardForkNotDuringThisExecution -> Nothing
TriggerHardForkAtEpoch epoch -> Just epoch
TriggerHardForkAtVersion shelleyMajorVersion ->
shelleyTransition
pcfg
shelleyMajorVersion
ledgerState
shelleyTransition shelleyMajorVersion ledgerState

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

0 comments on commit 3d46171

Please sign in to comment.