-
Notifications
You must be signed in to change notification settings - Fork 727
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix qKesKesKeyExpiry to not always be null #4909
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -448,7 +448,7 @@ runQueryKesPeriodInfo (AnyConsensusModeParams cModeParams) network nodeOpCertFil | |
eraHistory <- lift (queryNodeLocalState localNodeConnInfo Nothing eraHistoryQuery) | ||
& onLeft (left . ShelleyQueryCmdAcquireFailure) | ||
|
||
let eInfo = toEpochInfo eraHistory | ||
let eInfo = toTentativeEpochInfo eraHistory | ||
|
||
|
||
-- We get the operational certificate counter from the protocol state and check that | ||
|
@@ -515,13 +515,13 @@ runQueryKesPeriodInfo (AnyConsensusModeParams cModeParams) network nodeOpCertFil | |
opCertNodeAndOnDiskCounters o Nothing = OpCertNoBlocksMintedYet o | ||
|
||
opCertExpiryUtcTime | ||
:: EpochInfo (Either Text) | ||
:: Tentative (EpochInfo (Either Text)) | ||
-> GenesisParameters | ||
-> OpCertEndingKesPeriod | ||
-> Maybe UTCTime | ||
opCertExpiryUtcTime eInfo gParams (OpCertEndingKesPeriod oCertExpiryKesPeriod) = | ||
let time = epochInfoSlotToUTCTime | ||
eInfo | ||
(tentative eInfo) | ||
(SystemStart $ protocolParamSystemStart gParams) | ||
(fromIntegral $ oCertExpiryKesPeriod * fromIntegral (protocolParamSlotsPerKESPeriod gParams)) | ||
in case time of | ||
|
@@ -576,7 +576,7 @@ runQueryKesPeriodInfo (AnyConsensusModeParams cModeParams) network nodeOpCertFil | |
createQueryKesPeriodInfoOutput | ||
:: OpCertIntervalInformation | ||
-> OpCertNodeAndOnDiskCounterInformation | ||
-> EpochInfo (Either Text) | ||
-> Tentative (EpochInfo (Either Text)) | ||
-> GenesisParameters | ||
-> O.QueryKesPeriodInfoOutput | ||
createQueryKesPeriodInfoOutput oCertIntervalInfo oCertCounterInfo eInfo gParams = | ||
|
@@ -1415,9 +1415,25 @@ 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 | ||
|
||
-- | A value that is tentative or produces a tentative value if used. These values | ||
-- are considered accurate only if some future event such as a hard fork does not | ||
-- render them invalid. | ||
newtype Tentative a = Tentative { tentative :: a } deriving (Eq, Show) | ||
|
||
-- | Get an Epoch Info that computes tentative values. The values computed are | ||
-- tentative because it uses an interpreter that is extended past the horizon. | ||
-- This interpreter will compute accurate values into the future as long as a | ||
-- a hard fork does not happen in the intervening time. Those values are thus | ||
-- "tentative" because they can change in the event of a hard fork. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just to clarify my understanding, they can change in the event of a hardfork occurring within the horizon? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. They can change in the event of a hardfork occurring after the horizon. Normally the interpreter refuses to give an answer beyond the horizon so we construct a different interpreter that ignores the horizon. Values before the horizon still won't change. However, because the type allows for values beyond the horizon to change, it is annotated as |
||
toTentativeEpochInfo :: EraHistory CardanoMode -> Tentative (EpochInfo (Either Text)) | ||
toTentativeEpochInfo (EraHistory _ interpreter) = | ||
Tentative | ||
$ hoistEpochInfo (first (Text.pack . show) . runExcept) | ||
$ Consensus.interpreterToEpochInfo (Consensus.unsafeExtendSafeZone interpreter) | ||
|
||
obtainLedgerEraClassConstraints | ||
:: ShelleyLedgerEra era ~ ledgerera | ||
=> Api.ShelleyBasedEra era | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What other values do we expect to be tentative besides
EpochInfo
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Potentially anything derived from
Tentative EpochInfo
is a candidate.