Skip to content

Conversation

nc6
Copy link
Contributor

@nc6 nc6 commented May 14, 2020

This PR updates ouroboros-network to use the newest KES constructions from cardano-base, as well as fixing some bugs pertaining to how we signed with and evolved our KES keys.

Each commit can be reviewed independently.

@nc6 nc6 requested a review from mrBliss May 14, 2020 12:44
Comment on lines +430 to +435
, stabilityWindow = ceiling $ 3 * (toRational f / fromIntegral k)
, randomnessStabilisationWindow = ceiling $ 4 * (toRational f / fromIntegral k)
Copy link
Contributor

Choose a reason for hiding this comment

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

We also have this in Ouroboros.Consensus.Shelley.Ledger.Ledger, but slightly differently, e.g., with a link to the doc. It would be good to only do this in a single place.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agree, but let's do in a separate PR

Comment on lines +63 to +64
-- TODO This is somewhat annoying, since we want it to be based upon a runtime
-- value.
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, is there a ticket for this in cardano-ledger-specs?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No ticket yet, just a branch with me playing around and a conversation on slack... I'll make one

instance TPraosCrypto TPraosStandardCrypto

-- | A hot KES key. We store alonside the key the KES period for which it is
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
-- | A hot KES key. We store alonside the key the KES period for which it is
-- | A hot KES key. We store alongside the key the KES period for which it is valid (?)

@@ -112,8 +103,25 @@ instance DSIGNAlgorithm ByronDSIGN where
then Right ()
else Left "Verification failed"

abstractSizeVKey _ = error "Ouroboros.Consensus.Byron.Crypto.DSIGN: DSIGNAlgorithm ByronDSIGN"
abstractSizeSig _ = error "Ouroboros.Consensus.Byron.Crypto.DSIGN: DSIGNAlgorithm ByronDSIGN"
seedSizeDSIGN _ = 32
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be nice if we could run testDSIGNAlgorithm on this instance, but that's not so easy to accomplish (expose a test lib in cardano-base?)

@nc6 nc6 force-pushed the nc/kes branch 3 times, most recently from 28025bb to b1fc4d3 Compare May 14, 2020 15:10
@nc6
Copy link
Contributor Author

nc6 commented May 14, 2020

bors merge

iohk-bors bot added a commit that referenced this pull request May 14, 2020
2092: Use correct KES construction r=nc6 a=nc6

This PR updates ouroboros-network to use the newest KES constructions from `cardano-base`, as well as fixing some bugs pertaining to how we signed with and evolved our KES keys.

Each commit can be reviewed independently.

Co-authored-by: Nicholas Clarke <nick@topos.org.uk>
@iohk-bors
Copy link
Contributor

iohk-bors bot commented May 14, 2020

Build failed

nc6 added 3 commits May 14, 2020 17:31
- Use SUM KES scheme
- KES updating must now take the current period, rather than the target
period.
- The KES class now no longer tracks its current period. As such, we
introduce an abstraction `HotKey` which collects the current period with
the KES key.
Previously KES keys would be evolved to the _current_ KES period, and
would sign at that period. But this is incorrect; we should be caring
about the number of evolutions since the first period, defined by the
operational certificate.

As such, we now sign with the _relative_ KES period (e.g. the number of
evolutions), and evolve the keys accordingly.
This commit adds a verification, during our leader check, that we have
an operational cert which is valid for the current KES period.

Previously, if the OCert was not valid, two things could happen
(depending on the crypto implementation):
- An error would be thrown during signing, or
- A block would be generated and subsequently rejected by the validation
logic.

Now instead we skip any slots where we would otherwise be the leader but
for an invalid operational certificiate.

It would probably be nice to log this in the future.
@nc6
Copy link
Contributor Author

nc6 commented May 14, 2020

bors retry

@iohk-bors
Copy link
Contributor

iohk-bors bot commented May 14, 2020

@iohk-bors iohk-bors bot merged commit e88f0ee into master May 14, 2020
@iohk-bors iohk-bors bot deleted the nc/kes branch May 14, 2020 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants