Skip to content
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

Hard fork history #1698

Merged
merged 1 commit into from
Mar 14, 2020
Merged

Hard fork history #1698

merged 1 commit into from
Mar 14, 2020

Conversation

edsko
Copy link
Contributor

@edsko edsko commented Feb 25, 2020

This introduces the hard fork history, with records changing slot lengths and epoch sizes across hard fork boundaries, and derives EpochInfo and BlockchainTime from this.

This PR paves the way for (but does not yet close) #1637 and #1205.

@edsko edsko force-pushed the edsko/ledger-dependent-slot-lengths branch from 8167453 to 9569ed8 Compare February 25, 2020 14:48
@edsko edsko closed this Feb 26, 2020
@edsko edsko reopened this Feb 27, 2020
@edsko
Copy link
Contributor Author

edsko commented Feb 27, 2020

I don't know why I closed this, this is not the branch that I'm replacing.

@edsko
Copy link
Contributor Author

edsko commented Feb 27, 2020

#1700 is the one I intended to close.

@mrBliss mrBliss added the consensus issues related to ouroboros-consensus label Mar 6, 2020
@edsko edsko force-pushed the edsko/ledger-dependent-slot-lengths branch 5 times, most recently from 10c910a to a63a16e Compare March 13, 2020 15:21
@edsko edsko marked this pull request as ready for review March 13, 2020 15:50
Copy link
Contributor

@mrBliss mrBliss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed in a meet.

@edsko edsko force-pushed the edsko/ledger-dependent-slot-lengths branch from a63a16e to c698281 Compare March 13, 2020 22:49
@edsko
Copy link
Contributor Author

edsko commented Mar 13, 2020

Ok, this took way too long (nearly midnight now), but really rather happy with the result, quite proud of it. Both the implementation and its tests are quite nice: we generate a random Shape (number of eras, era parameters), then generate a random Chain (model), derive the Transitions from that Chain, summarize those transitions using the shape, and then use that summary to do translation between SlotNo and EpochNo/UTCTime for any event within the scope of the chain. The only thing that is still missing is to test that we can also predict the future; the is not hard to test anymore: take a prefix of the chain, and then do conversions for the events that follow it, up to the safe zone. However, I'm now well and truly fried; opened #1807 to track that last remaining piece of work.

@edsko
Copy link
Contributor Author

edsko commented Mar 13, 2020

@nfrisby , just a heads up, this removes the generalization to multiple slot lengths from everywhere, in preparation for #1637 (slot lengths can only change at hard fork boundaries).

@edsko
Copy link
Contributor Author

edsko commented Mar 13, 2020

bors r+

@edsko
Copy link
Contributor Author

edsko commented Mar 13, 2020

Incidentally, here are the tests running 100k tests, first generating an arbitrary Summary and then doing roundtrip translations for arbitrary SlotNo/EpochNo/UTCTime, and then doing the full test setup using chain-derived Summary:

ouroboros-consensus
  HardForkHistory
    Summary
      Sanity
        generator:              OK (1.23s)
          +++ OK, passed 100000 tests.
        shrinker:               OK (4.78s)
          +++ OK, passed 100000 tests.
      Conversions
        roundtripWallclockSlot: OK (1.84s)
          +++ OK, passed 100000 tests.
        roundtripSlotWallclock: OK (1.47s)
          +++ OK, passed 100000 tests.
        roundtripSlotEpoch:     OK (0.53s)
          +++ OK, passed 100000 tests.
        roundtripEpochSlot:     OK (0.61s)
          +++ OK, passed 100000 tests.
        reportsPastHorizon:     OK (1.60s)
          +++ OK, passed 100000 tests.
    Chain
      Sanity
        generator:              OK (0.39s)
          +++ OK, passed 100000 tests.
        shrinker:               OK (4.57s)
          +++ OK, passed 100000 tests.
      Conversions
        summarizeInvariant:     OK (5.08s)
          +++ OK, passed 100000 tests.
        eventSlotToEpoch:       OK (4.26s)
          +++ OK, passed 100000 tests.
        eventEpochToSlot:       OK (4.13s)
          +++ OK, passed 100000 tests.
        eventSlotToWallclock:   OK (6.08s)
          +++ OK, passed 100000 tests.
        eventWallclockToSlot:   OK (6.46s)
          +++ OK, passed 100000 tests.

All 14 tests passed (43.07s)

@iohk-bors
Copy link
Contributor

iohk-bors bot commented Mar 14, 2020

@iohk-bors iohk-bors bot merged commit 50f059c into master Mar 14, 2020
@edsko edsko deleted the edsko/ledger-dependent-slot-lengths branch May 3, 2020 07:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
consensus issues related to ouroboros-consensus
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants