Skip to content

Commit

Permalink
Use the updated behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
lehins committed May 8, 2024
1 parent 41ebc61 commit 4e35a7d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 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: 2b5a62eb1025b22ff10f46727d1d7b521df865d9
--sha256: sha256-oVMvD1mO+le+ur+o5UPttfXt4Htqrb0hM1mAmvGrapk=
tag: def45405ea7bd218af7df00f0b6975d6bc41eed7
--sha256: sha256-U9KalSEobQgIJ7aKH62uYvNjdX1OVNHnLt1ZotxnZ0k=
subdir: eras/allegra/impl
eras/alonzo/impl
eras/alonzo/test-suite
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ module Ouroboros.Consensus.Shelley.Ledger.Inspect (
, pparamsUpdate
) where

import Cardano.Ledger.BaseTypes (StrictMaybe (..))
import qualified Cardano.Ledger.Shelley.API as SL
import qualified Cardano.Ledger.Shelley.Core as Core
import qualified Cardano.Ledger.Shelley.Governance as SL
Expand All @@ -27,7 +28,9 @@ import Ouroboros.Consensus.Shelley.Ledger.Ledger
import Ouroboros.Consensus.Util.Condense

data ShelleyLedgerUpdate era =
ShelleyUpdatedPParams (Maybe (Core.PParams era)) EpochNo
ShelleyUpdatedPParams
!(StrictMaybe (Core.PParams era))
!EpochNo

deriving instance Eq (Core.PParams era) => Eq (ShelleyLedgerUpdate era)
deriving instance Show (Core.PParams era) => Show (ShelleyLedgerUpdate era)
Expand Down Expand Up @@ -55,5 +58,5 @@ pparamsUpdate ::
pparamsUpdate st =
let nes = shelleyLedgerState st
in ShelleyUpdatedPParams
(nes ^. SL.newEpochStateGovStateL . SL.futurePParamsGovStateG)
(SL.nextEpochUpdatedPParams (nes ^. SL.newEpochStateGovStateL))
(succ (SL.nesEL nes))
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,13 @@ shelleyTransition ShelleyPartialLedgerConfig{..}

isTransition :: ShelleyLedgerUpdate era -> Maybe EpochNo
isTransition (ShelleyUpdatedPParams maybePParams newPParamsEpochNo) = do
pp <- maybePParams
-- 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
guard $ SL.pvMajor protVer == transitionMajorVersion
guard $ shelleyAfterVoting >= fromIntegral k
return newPParamsEpochNo

instance
Expand Down

0 comments on commit 4e35a7d

Please sign in to comment.