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

Add ability to get past ledger states #1446

Merged
merged 5 commits into from
Jan 13, 2020
Merged

Conversation

edsko
Copy link
Contributor

@edsko edsko commented Jan 13, 2020

This also fixes a regression in the tests where non-saturated chains (fewer than k blocks) were ruled out; fortunately, this was a regression in the tests only, not in the code. Running 1M tests on the in-memory ledger DB:

# cabal run test-storage -- -p InMemory --quickcheck-tests=1000000
Up to date
ouroboros-storage
  Storage
    LedgerDB
      InMemory
        Serialisation
          ChainSummary:           OK (5.80s)
            +++ OK, passed 1000000 tests.
        Genesis
          length:                 OK (1.21s)
            +++ OK, passed 1000000 tests.
          current:                OK (1.21s)
            +++ OK, passed 1000000 tests.
        Push
          incrementsLength:       OK (2.26s)
            +++ OK, passed 1000000 tests (64.0082% saturated).
          lengthMatchesNumBlocks: OK (2.08s)
            +++ OK, passed 1000000 tests (63.9868% saturated).
          matchesPolicy:          OK (2.38s)
            +++ OK, passed 1000000 tests (63.9719% saturated).
          expectedLedger:         OK (3.02s)
            +++ OK, passed 1000000 tests (63.9387% saturated).
          pastLedger:             OK (3.76s)
            +++ OK, passed 1000000 tests:
            96.4751% within reach
            63.9570% saturated
        Rollback
          maxRollbackGenesisZero: OK (1.26s)
            +++ OK, passed 1000000 tests.
          ledgerDbMaxRollback:    OK (2.83s)
            +++ OK, passed 1000000 tests (63.9984% saturated).
          switchSameChain:        OK (3.35s)
            +++ OK, passed 1000000 tests (63.9431% saturated).
          switchMatchesPolicy:    OK (3.84s)
            +++ OK, passed 1000000 tests (64.0446% saturated).
          switchExpectedLedger:   OK (4.99s)
            +++ OK, passed 1000000 tests (64.0571% saturated).
          pastAfterSwitch:        OK (5.34s)
            +++ OK, passed 1000000 tests:
            92.9097% within reach
            63.9944% saturated

All 14 tests passed (43.35s)

Closes #1440.

@edsko edsko requested a review from mrBliss January 13, 2020 11:51
@mrBliss mrBliss added chain db consensus issues related to ouroboros-consensus ledger db labels Jan 13, 2020
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.

LGTM (reviewed over Google Meet)

@edsko edsko force-pushed the edsko/get-past-ledger branch 2 times, most recently from d8af76c to e2c54bc Compare January 13, 2020 14:30
@edsko edsko force-pushed the edsko/get-past-ledger branch from e2c54bc to 4896df7 Compare January 13, 2020 16:40
@edsko
Copy link
Contributor Author

edsko commented Jan 13, 2020

The first four commits here are #1451, just adds a single commit on top.

@edsko
Copy link
Contributor Author

edsko commented Jan 13, 2020

bors r+

@iohk-bors
Copy link
Contributor

iohk-bors bot commented Jan 13, 2020

Merge conflict (retrying...)

iohk-bors bot added a commit that referenced this pull request Jan 13, 2020
1446: Add ability to get past ledger states r=edsko a=edsko

This also fixes a regression in the tests where non-saturated chains (fewer than `k` blocks) were ruled out; fortunately, this was a regression in the tests only, not in the code. Running 1M tests on the in-memory ledger DB:

```
# cabal run test-storage -- -p InMemory --quickcheck-tests=1000000
Up to date
ouroboros-storage
  Storage
    LedgerDB
      InMemory
        Serialisation
          ChainSummary:           OK (5.80s)
            +++ OK, passed 1000000 tests.
        Genesis
          length:                 OK (1.21s)
            +++ OK, passed 1000000 tests.
          current:                OK (1.21s)
            +++ OK, passed 1000000 tests.
        Push
          incrementsLength:       OK (2.26s)
            +++ OK, passed 1000000 tests (64.0082% saturated).
          lengthMatchesNumBlocks: OK (2.08s)
            +++ OK, passed 1000000 tests (63.9868% saturated).
          matchesPolicy:          OK (2.38s)
            +++ OK, passed 1000000 tests (63.9719% saturated).
          expectedLedger:         OK (3.02s)
            +++ OK, passed 1000000 tests (63.9387% saturated).
          pastLedger:             OK (3.76s)
            +++ OK, passed 1000000 tests:
            96.4751% within reach
            63.9570% saturated
        Rollback
          maxRollbackGenesisZero: OK (1.26s)
            +++ OK, passed 1000000 tests.
          ledgerDbMaxRollback:    OK (2.83s)
            +++ OK, passed 1000000 tests (63.9984% saturated).
          switchSameChain:        OK (3.35s)
            +++ OK, passed 1000000 tests (63.9431% saturated).
          switchMatchesPolicy:    OK (3.84s)
            +++ OK, passed 1000000 tests (64.0446% saturated).
          switchExpectedLedger:   OK (4.99s)
            +++ OK, passed 1000000 tests (64.0571% saturated).
          pastAfterSwitch:        OK (5.34s)
            +++ OK, passed 1000000 tests:
            92.9097% within reach
            63.9944% saturated
```

All 14 tests passed (43.35s)

Closes #1440.

Co-authored-by: Edsko de Vries <[email protected]>
@iohk-bors
Copy link
Contributor

iohk-bors bot commented Jan 13, 2020

@iohk-bors iohk-bors bot merged commit 4896df7 into master Jan 13, 2020
@iohk-bors iohk-bors bot deleted the edsko/get-past-ledger branch January 13, 2020 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chain db consensus issues related to ouroboros-consensus ledger db
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ChainDB: ChainDB should be able to return chain fragments with associated ledger states
2 participants