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

Create a genesis EBB for Byron #1447

Closed
mrBliss opened this issue Jan 13, 2020 · 0 comments · Fixed by #1450
Closed

Create a genesis EBB for Byron #1447

mrBliss opened this issue Jan 13, 2020 · 0 comments · Fixed by #1450
Assignees
Labels
byron ledger integration chain db consensus issues related to ouroboros-consensus
Milestone

Comments

@mrBliss
Copy link
Contributor

mrBliss commented Jan 13, 2020

In cardano-sl, an EBB is produced at the start of each epoch.

In our rewrite (but before #1353), we don't produce EBBs at all since EBBs will be a thing of the past by the time it is deployed (finally!). There is however, one exception: a slot leader with an empty chain produces a genesis EBB as its first block instead of a regular block containing transactions.

Since #1353, we no longer produce this genesis EBB. In the protocol tests, we automatically produce an EBB at the start of each epoch, just like in the old codebase.

The problem is that only BoundaryHeaders (EBBs) can have the empty chain (genesis) as their predecessor. Compare:
https://github.com/input-output-hk/cardano-ledger/blob/c26bfbd0e6726c1c36a17bf7bde815d2e84bccf5/cardano-ledger/src/Cardano/Chain/Block/Header.hs#L449
with:
https://github.com/input-output-hk/cardano-ledger/blob/c26bfbd0e6726c1c36a17bf7bde815d2e84bccf5/cardano-ledger/src/Cardano/Chain/Block/Header.hs#L138

Now the benchmarking team are performing TPS tests, in which they are producing Byron blocks, but not EBBs. The first block they produce doesn't fit onto genesis, as its previous hash is BlockHash (ByronHash {unByronHash = AbstractHash c89ac6b8c6e68ef58ad6a4ed0f7ba29ab33f16354d4437a28a6bf1d9a3f90508}) instead of GenesisHash.

This is due to the following line:
https://github.com/input-output-hk/ouroboros-network/blob/e0eba52e8e7c81d3f002c8d36a3e5f6ed30bb216/ouroboros-consensus/src/Ouroboros/Consensus/Ledger/Byron/Forge.hs#L194

Proposed solution: add a hook to the node (RunNode) to run an action on the ChainDB on startup, before block production begins. For Byron, we can then use this hook to create a genesis EBB in case our chain is empty. Throw an error on the problematic line above instead of using the wrong prev hash.

@mrBliss mrBliss added consensus issues related to ouroboros-consensus byron ledger integration chain db labels Jan 13, 2020
@mrBliss mrBliss added this to the S4 2020-01-16 milestone Jan 13, 2020
@mrBliss mrBliss self-assigned this Jan 13, 2020
mrBliss added a commit that referenced this issue Jan 13, 2020
Closes #1447.

Test it by running the RealPBFT tests both with and without EBBs for each
epoch.
iohk-bors bot added a commit that referenced this issue Jan 13, 2020
1450: Always produce a genesis EBB for Byron r=mrBliss a=mrBliss

Closes #1447.

Test it by running the RealPBFT tests both with and without EBBs for each
epoch.

Co-authored-by: Thomas Winant <[email protected]>
iohk-bors bot added a commit that referenced this issue Jan 13, 2020
1450: Always produce a genesis EBB for Byron r=mrBliss a=mrBliss

Closes #1447.

Test it by running the RealPBFT tests both with and without EBBs for each
epoch.

1451: Deal with unknown blocks during ledger DB init r=edsko a=edsko



Co-authored-by: Thomas Winant <[email protected]>
Co-authored-by: Edsko de Vries <[email protected]>
@iohk-bors iohk-bors bot closed this as completed in 77a88a9 Jan 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
byron ledger integration chain db consensus issues related to ouroboros-consensus
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant