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
Use a single set of credentials for all Shelley-based eras #2753
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mrBliss
force-pushed
the
mrBliss/share-shelley-credentials
branch
from
November 17, 2020 15:14
e0cc9e3
to
8d3ee08
Compare
This was referenced Nov 17, 2020
Merged
mrBliss
force-pushed
the
mrBliss/share-shelley-credentials
branch
3 times, most recently
from
November 19, 2020 12:50
99036af
to
e704c7b
Compare
We had an instance of `SingleEraBlock` for `ShelleyBlock` that was parametric in the era, causing all Shelley-based eras (Shelley, Allegra, Mary) to have the "Shelley" name. Fix this by adding a `shelleyBasedEraName` method to the new `ShelleyBasedEra` class, which combines the new method with the ledger-defined class of the same name. See its docstring for more details.
Make the following change: ```diff - , pInfoBlockForging :: [m (BlockForging m b)] + , pInfoBlockForging :: m [BlockForging m b] ``` This is more general and will allow us to, e.g., do create multiple `BlockForging` records in one monadic call.
For each era, there will be a thread periodically trying to evolve the KES key and securely forget the previous one. Previously, we required a set of credentials for each Shelley-based era, e.g., Shelley, Allegra, and Mary. In practice, most users will want to use the same credentials for, e.g., Shelley and Allegra. However, when using the same in-memory KES key for multiple eras, multiple threads will try to evolve and secure forget the *same KES key*. Depending on the implementation of secure forgetting for KES keys, this could lead to segfaults. Instead of having a separate set of credentials per Shelley-based era (this remains independent of how Byron credentials are handled), we now share a single set of credentials for all of them. We use the new `shelleySharedBlockForging` function to do this in a safe way, i.e., by sharing the same thread-safe `HotKey` across the threads. We refactor the protocol parameters for Shelley/Allegra/Mary to handle the shared key: we now have a `ProtocolParamsShelleyBased` record which contains everything needed for a Shelley-based chain, i.e., the genesis config and the credentials. This record should be combined with the right era-specific ones. This also paves the way for adding a Mary-only mode.
This will make it possible to use it in combination with `NP`.
mrBliss
force-pushed
the
mrBliss/share-shelley-credentials
branch
from
November 19, 2020 13:00
e704c7b
to
19fba7e
Compare
mrBliss
force-pushed
the
mrBliss/share-shelley-credentials
branch
from
November 19, 2020 15:41
19fba7e
to
e9f4574
Compare
Instead of a different thread per era, the hard fork combinator can now combine `BlockForging` records from multiple eras into one `BlockForging` record which picks the appropriate `BlockForging` based on the current era. This means that the KES key shared by the Shelley-based eras will only be tried to be evolved once, instead of once for each Shelley-based era (in the previous approach, all threads would try to evolve it, but all but one would be an identity operation). This should also improve tracing: instead of tracing messages for each era, only messages of the current era are traced. Note that multiple credentials *per era* (i.e. to benchmark multiple stakepools on one node) will still result in multiple forging threads.
mrBliss
force-pushed
the
mrBliss/share-shelley-credentials
branch
from
November 20, 2020 08:54
e9f4574
to
d362ec6
Compare
edsko
approved these changes
Nov 20, 2020
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.
This was trickier than anticpated!
bors merge |
Build succeeded: |
mrBliss
added a commit
to IntersectMBO/cardano-node
that referenced
this pull request
Nov 23, 2020
Notable changes: * Share a single set of credentials for all Shelley-based eras: IntersectMBO/ouroboros-network#2753 * Add a pure Mary mode IntersectMBO/ouroboros-network#2754
mrBliss
added a commit
to IntersectMBO/cardano-node
that referenced
this pull request
Nov 24, 2020
Notable changes: * Share a single set of credentials for all Shelley-based eras: IntersectMBO/ouroboros-network#2753 * Add a pure Mary mode IntersectMBO/ouroboros-network#2754
iohk-bors bot
added a commit
to IntersectMBO/cardano-node
that referenced
this pull request
Nov 24, 2020
2114: Update dependency on ouroboros-network r=mrBliss a=mrBliss Notable changes: * Share a single set of credentials for all Shelley-based eras: IntersectMBO/ouroboros-network#2753 * Add a pure Mary mode IntersectMBO/ouroboros-network#2754 Co-authored-by: Thomas Winant <thomas@well-typed.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We add the ability to share a single KES key by multiple Shelley-based eras.
Also, instead of a different thread per era, the hard fork combinator can now
combine
BlockForging
records from multiple eras into oneBlockForging
recordwhich picks the appropriate
BlockForging
based on the current era.This means that the KES key shared by the Shelley-based eras will only be tried
to be evolved once, instead of once for each Shelley-based era (in the previous
approach, all threads would try to evolve it, but all but one would be an
identity operation). This should also improve tracing: instead of tracing
messages for each era, only messages of the current era are traced.
Note that multiple credentials per era (i.e. to benchmark multiple stakepools
on one node) will still result in multiple forging threads.
We refactor the protocol parameters for Shelley/Allegra/Mary to handle the
shared key: we now have a
ProtocolParamsShelleyBased
record which containseverything needed for a Shelley-based chain, i.e., the genesis config and the
credentials. This record should be combined with the right era-specific ones.
This also paves the way for adding a Mary-only mode.