Skip to content

Commit

Permalink
Fix qKesKesKeyExpiry to not always be null
Browse files Browse the repository at this point in the history
  • Loading branch information
newhoggy committed Mar 3, 2023
1 parent d9ff0ef commit eacb364
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
2 changes: 2 additions & 0 deletions cardano-cli/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

- Query protocol parameters from the node in the `transaction build` command ([PR 4431](https://github.com/input-output-hk/cardano-node/pull/4431))

- Fix `qKesKesKeyExpiry` in `kes-period-info` ([PR 4909](https://github.com/input-output-hk/cardano-node/pull/4909))

## 1.35.3 -- August 2022

- Update build and build-raw commands to accept simple reference minting scripts (#4087)
Expand Down
18 changes: 13 additions & 5 deletions cardano-cli/src/Cardano/CLI/Shelley/Run/Query.hs
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ runQueryKesPeriodInfo (AnyConsensusModeParams cModeParams) network nodeOpCertFil
eraHistory <- lift (queryNodeLocalState localNodeConnInfo Nothing eraHistoryQuery)
& onLeft (left . ShelleyQueryCmdAcquireFailure)

let eInfo = toEpochInfo eraHistory
let eInfo = unsafeToEpochInfo eraHistory


-- We get the operational certificate counter from the protocol state and check that
Expand Down Expand Up @@ -507,13 +507,13 @@ runQueryKesPeriodInfo (AnyConsensusModeParams cModeParams) network nodeOpCertFil
opCertNodeAndOnDiskCounters o Nothing = OpCertNoBlocksMintedYet o

opCertExpiryUtcTime
:: EpochInfo (Either Text)
:: Unsafe (EpochInfo (Either Text))
-> GenesisParameters
-> OpCertEndingKesPeriod
-> Maybe UTCTime
opCertExpiryUtcTime eInfo gParams (OpCertEndingKesPeriod oCertExpiryKesPeriod) =
let time = epochInfoSlotToUTCTime
eInfo
(unsafe eInfo)
(SystemStart $ protocolParamSystemStart gParams)
(fromIntegral $ oCertExpiryKesPeriod * fromIntegral (protocolParamSlotsPerKESPeriod gParams))
in case time of
Expand All @@ -537,7 +537,7 @@ runQueryKesPeriodInfo (AnyConsensusModeParams cModeParams) network nodeOpCertFil
createQueryKesPeriodInfoOutput
:: OpCertIntervalInformation
-> OpCertNodeAndOnDiskCounterInformation
-> EpochInfo (Either Text)
-> Unsafe (EpochInfo (Either Text))
-> GenesisParameters
-> O.QueryKesPeriodInfoOutput
createQueryKesPeriodInfoOutput oCertIntervalInfo oCertCounterInfo eInfo gParams =
Expand Down Expand Up @@ -1341,9 +1341,17 @@ queryResult eAcq = pure eAcq

toEpochInfo :: EraHistory CardanoMode -> EpochInfo (Either Text)
toEpochInfo (EraHistory _ interpreter) =
hoistEpochInfo (first (Text.pack . show ) . runExcept)
hoistEpochInfo (first (Text.pack . show) . runExcept)
$ Consensus.interpreterToEpochInfo interpreter

newtype Unsafe a = Unsafe { unsafe :: a } deriving (Eq, Show)

unsafeToEpochInfo :: EraHistory CardanoMode -> Unsafe (EpochInfo (Either Text))
unsafeToEpochInfo (EraHistory _ interpreter) =
Unsafe
$ hoistEpochInfo (first (Text.pack . show) . runExcept)
$ Consensus.interpreterToEpochInfo (Consensus.unsafeExtendSafeZone interpreter)

obtainLedgerEraClassConstraints
:: ShelleyLedgerEra era ~ ledgerera
=> Api.ShelleyBasedEra era
Expand Down

0 comments on commit eacb364

Please sign in to comment.