-
Notifications
You must be signed in to change notification settings - Fork 86
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
Refactor to decouple consensus modes #2978
Conversation
jhartzell42
commented
Mar 8, 2021
•
edited
Loading
edited
b2e7a41
to
9576047
Compare
d0665e1
to
dc0e118
Compare
I finally reviewed the previous PR I had promised to review. So I hope to have a pass at this one tomorrow (ie Wednesday). Sorry for the delay. |
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.
I've reviewed some key parts, and I made some relative large requests, so that's probably plenty for us to work through now. (And it's getting late here.)
I see you're in the US Eastern timezone, so we can relatively easily schedule a call if you think the synchronous bandwidth would help. Thanks much!
I hope to be more responsive now that I've ramped up on the overall intent and looked at the some of the key details; I think my review of the remaining code will mostly be a matter of confirming the copy-paste nature of the relocated Shelley-HFC code.
d44acbe
to
9884916
Compare
ouroboros-consensus-cardano/src/Ouroboros/Consensus/Cardano/Node.hs
Outdated
Show resolved
Hide resolved
ouroboros-consensus-shelley/src/Ouroboros/Consensus/Shelley/Ledger/Block.hs
Outdated
Show resolved
Hide resolved
91f600f
to
1190b3e
Compare
ouroboros-consensus-cardano/src/Ouroboros/Consensus/Cardano/CanHardFork.hs
Outdated
Show resolved
Hide resolved
ouroboros-consensus-cardano/src/Ouroboros/Consensus/Cardano/ShelleyBased.hs
Show resolved
Hide resolved
ouroboros-consensus-shelley/src/Ouroboros/Consensus/Shelley/Ledger/Block.hs
Outdated
Show resolved
Hide resolved
ouroboros-consensus-shelley/src/Ouroboros/Consensus/Shelley/ShelleyHFC.hs
Show resolved
Hide resolved
ouroboros-consensus-shelley/src/Ouroboros/Consensus/Shelley/ShelleyHFC.hs
Outdated
Show resolved
Hide resolved
ouroboros-consensus-shelley/src/Ouroboros/Consensus/Shelley/ShelleyHFC.hs
Show resolved
Hide resolved
ouroboros-consensus-shelley/src/Ouroboros/Consensus/Shelley/ShelleyHFC.hs
Outdated
Show resolved
Hide resolved
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.
Phew! I used some throwaway awk
and Haskell scripting to confirm that the relocations were indeed only relocations. All the code changes look good. I didn't check the export lists or module pragmas as carefully, but those are less important and easy to fixup.
Other than that, I made some StyleGuide.md
-based comments throughout. Thank you for your patience.
(For the record, I applied these semi-automated checks to your commit 9884916, after rebasing it onto origin/master
; the rebase was automatic 👍.)
I don't think there's much more work to be done, once you've validated this PR by getting a working cardano-node
PR in place 👍
32285a5
to
ec9cc1c
Compare
- Functionality that handles Shelley-based eras in a multi-era consensus is moved to ouroboros-consensus-shelley so that it can be shared between mainnet consensus (in ouroboros-consensus-cardano) and other consensus modes comprising multiple Shelley eras. - The `Protocol` GADT that enumerates consensus modes and provides a wealth of information for clients is eliminated. It is an implementation detail only used by `cardano-node`. This way, `ouroboros-consensus-cardano` does not need to know about other consensus modes.
ec9cc1c
to
0698994
Compare
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.
LGTM! Thanks for all those fixups.
Please update
- the commit message
- and also the PR's description --
bors
or GitHub (I'm not sure which) copies that into the merge commit, so it should be accurate too.
They both mention the Protocol
class etc which is no longer in this PR.
I'll Approve after that.
Though for a single commit PR like this one, I wouldn't mind "single commit; see its message" as the entirely of the PR description. Please choose whatever point along that spectrum you feel is appropriate. |
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.
Thanks for this PR! It's a good refactoring.
I've clicked Approve.
bors merge |
Build succeeded: |
2498: Adapt packages to use Protocol type class r=Jimbo4350 a=jhartzell42 This PR depends on IntersectMBO/ouroboros-network#2978 In that PR, the `Protocol` type that the cardano-node packages use is removed. This is so that ouroboros-network does not need to enumerate all the consensus modes it implements. The majority of changes in this PR are in reaction to that, creating a type class to replace it. We found that it would take a significant increase in code complexity to remove the explicit enumeration of supported consensus modes in two places: - cardano-node/src/Cardano/Node/Configuration/Logging.hs:nodeBasicInfo - cardano-node/src/Cardano/Node/Query.hs For that purpose, we have written the GADT `BlockType` which provides the little bit of type discovery these places need. In addition, we have removed the `Enum` instance for `AnyCardanoEra`. The motivation is that we anticipate the inclusion of experimental eras and consensus modes in the code base which cannot reasonably be said to be enumerable among the mainnet eras. This instance does not appear to be used anywhere. If it needs to be preserved then we will need an answer on how to handle eras we don't expect to be part of mainnet (at least when they are first implemented). Co-authored-by: Madeline Haraj <madeline.haraj@obsidian.systems>