IntersectMBO / cardano-ledger

The ledger implementation and specifications of the Cardano blockchain.
Apache License 2.0
262 stars 155 forks source link

Create specialized newtype `VRFVerKeyHash` #4722

Closed lehins closed 1 month ago

lehins commented 1 month ago

Description

VRF algorithm should not appear in the hash, since that prevents us from changing the VRF algorithm. There is a potential we will do that in the future and switch to Batch VRF.

That being said, the biggest motivation behind this change is that we want to extract VRF and KES out of Crypto type class and having type signature like this

Crypto c => Hash (HASH c) (VerKeyVRF (VRF c))

prevents us from doing that.

Moreover, with addition of specialized role KeyRoleVRF to be used in VRFVerKeyHash (r :: KeyRoleVRF) c we gain type safety that prevents us mising up genesis and pool VRF key hashes.

Checklist

lehins commented 1 month ago

I guess the changes related to the OverlayPredicateFailure shouldn't be mentioned in the corresponding CHANGELOG since we don't need to record predicate failure related changes, right?

This is actually not right. We do need to add changelog entries for changes to predicate failures. Moreover, in this case it is a breaking change and I totally forgot to bump the major version of the package and add a changelog entry for it. Thank you for spotting it