-
Notifications
You must be signed in to change notification settings - Fork 23
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
Simplify time conversions in Consensus #1301
Comments
This parameter is currently called `selectionHeader`. This change allow us to use two header types in the interface. The `header` type, now is intended to convey additional information, in particular the slot time at which the header was downloaded. In this way we can address [this issue](IntersectMBO/ouroboros-consensus#1301) which allow us to simplify Consensus time conversions. Additionally, this change will enable us to remove `FromConsensus` data and the precondition of `headerForgeUTCTime`. The `selectionHeader` type will typically denote a raw header.
This comment was marked as resolved.
This comment was marked as resolved.
After our discussion in the call just now, I have a few higher-level thoughts to record/emphasize.
So, in terms of a final target: I suspect we should be adding times to the ChainDB's internal TVar in addition to the ChainSync clients' candidate fragments. Perhaps the API for the selection should be |
Yeah, changing the selection to also track the slot times would make that cleaner (and would be an overall nice goal as you say). However, it requires changes to ChainSel (in particular: how/where exactly do we get the slot time for blocks we load from disk, both on startup and when switching forks), so it seems potentially nice to have an incremental path ("best series of steps to reach that point" as you say) where the candidate fragments are already annotated with time, but the selection isn't (yet). #1288 is currently written in that style, and @dnadales also made sure that the |
This class generalizes this function in the sense that it can extract headers of any values that support this operation, not only blocks. Required by #1301
FTR: See the PR description of #1288 (comment) for a concrete work item. |
This issue captures some changes that can be implemented to reduce or localize slot-to-wallclock conversions in our code.
blockForgeUTCTime
withheaderForgeUTCTime
, since the equivalent header is in scope.ChainSync
with their UTC Time, which is calculated here.a) Remove
HeaderStateWithTime
and use the header's annotation for the historicity check instead.The only caveat here is that the
MsgAwaitReply
part of the historicity check currently relies on having a slot time for the anchor in case the fragment is empty. Possible approaches are:MsgAwaitReply
when their candidate fragment is empty (remember that candidate fragments are anchored in a recent immutable tip). This would be more zeleaous than the current historicity check, so it requires proper justification. It seems very plausible to us, but it doesn't seem to immediately follow from any of the "usual" properties like Chain Growth or Existential Chain Quality.AnchoredFragment
that also stores extra data (the slot time of the anchor) for use for the candidate fragments. We would need to implement functions likeintersect
for this that properly update the extra anchor data.1b) Propagate
HeaderWithTime
into the Diffusion Layer's interface so thatheaderForgeUTCTime
simply returns the annotation from the header. This will remove an invocation ofslotToWallclock
, instead reusing the header's time annotation.Observation: Steps 2 and 3b are not really independent. 2 has a significant performance cost without 3b (because discarding the headers requires a lot of allocation). So, both probably need to be in a PR together, but they could be different commits.
Footnotes
With infinite time, it would be neat to generalize the
AnchoredFragment
API to allow custom extra data for the anchor; but it is rather questionable that this is a useful thing to pursue right now. ↩The text was updated successfully, but these errors were encountered: