-
Notifications
You must be signed in to change notification settings - Fork 23
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
Enable use of VRF batch verification crypto from Conway era onward #547
Comments
For reference, this is a previous, backed out PR that might be relevant, or point to relevant upstream commits: PR IntersectMBO/ouroboros-network#3801 |
To clarify, the Crypto team has three PI objectives that will involve Consensus:
If I understand correctly, this Issue pertains only to the second to; it does not involve secure forgetting. |
From @nfrisby
|
I tried latest solution proposed by @yogeshsajanikar in IntersectMBO/ouroboros-network#4151 and it does not work nicely. While I was able to modify
|
Introducing an additional type variable to |
4386: Introduces property checking the size of Header's VRF Certs for different Eras r=abailly-iohk a=abailly-iohk # Description This PR does 2 things: * An attempt at minimising the "attack surface" of consensus' dependencies on cardano-ledger crypto stuff related to Praos/TPraos, * Introduction of Property to check dispatching of crypto depending on era actually produces the right results. ## Hide Ledger's `PraosCrypto` The idea is to remove direct dependencies from consensus package to cardano-ledger's `TPraos.API` module. There is a duplication of the `PraosCrypto` typeclass between the two components which does seem unnecessary as ultimately, these crypto primitives should end up in the consensus where they are used and relevant. I would have loved to be able to remove the ledger's `PraosCrypto` altogether but of course this is not possible as we use quite a few functions from the ledger that depend on it. So the tiny first step consists in hiding the dependency on `Ledger.PraosCrypto` behind the `Ouroboros.Consensus.Praos.Crypto.PraosCrypto` typeclass (reexported by `Praos` and `TPraos` modules). This simplifies some constraints down the road. The hypothesis this work is based on is that if we manage to locate all dependencies from consensus to ledger for KES and VRF stuff, then introducing a new `Crypto` typeclass and primitives will have a minimal impact over the codebase and could be done independently of the refactoring in the cardano-ledger. ## Add Property to check "dispatching" of VRF per Era The goal of #4150 is to ensure different eras can have different crypto implementations for things such as VRF proofs generation and verification, and KES signing. While #4151 provided solutions to this problem, this PR tries to make the problem manifest through a property that, given an arbitrary header from different eras, verifies the correct crypto is used. This is done simply by verifying the sizes of the VRF certificates which are different between plain Praos and Batch compatible VRF. Co-authored-by: Arnaud Bailly <arnaud.bailly@iohk.io> Co-authored-by: Arnaud Bailly <79840582+abailly-iohk@users.noreply.github.com> Co-authored-by: Joris Dral <joris@well-typed.com>
I have tried several approaches which all failed, following discussions with @dnadales and @nfrisby, starting top-down from the definition of
So there is a unit test in place that should fail and then succeed at some point when implementing correctly the dispatching but I wasn't able to have it implemented, and I think the crux of the issue is that the consensus code does not control how the crypto (for VRF and KES at least) is related to each era as this is defined in the ledger. So this points back to cardano-ledger#3262 PR which aims at splitting the @lehins insisted on the potential impact of what we are doing here in the cardano-node codebase as I still very much would like to find a way to introduce stronger boundaries between consensus types and ledger types so that those kind of changes could be less impactful and more easily implemented in a modular way. |
Rebasing PR 3262 on newest ledger is not trivial and I am still failing to understand why this change in ledger is needed on the consensus side. Or rather, I feel that if this change is really needed, then something is wrong in our architecture and we should fix that, which might be the point of 3262 but then we should clarify the scope of this work. |
It's already been a couple of weeks since I have started working on this, and it's time to take step back and distill what I learn about the problem and the potential solutions. The introductory comment to this issue defines the goal and frame it in the broader context of support for Conway era and new cryptography implementations improving security. This is probably old news to most but here is what I learnt. The whole consensus code is currently parameterised over a single
What I have done/attempted so far, along with some comments about it:
So the current situation is that I am blocked in
The latter two might entail changes in the ledger code but the crypto should be compatible anyway so perhaps the changes would be minimal? |
With @amesgen and @dnadales we were able to make good progress and get to the point where Key takeaways:
|
Keys are stored in the ledger state, only the hashes of the keys. So, if new batch compat VRF crypto keys are compatible in binary form, then no translation is necessary. It looks like they are compatible, but I might be missing some context: https://github.com/input-output-hk/cardano-base/blob/2c1486e0bcece554b46a05d4fbefb13cbe673630/cardano-crypto-praos/src/Cardano/Crypto/VRF/Praos.hs#L427-L431 |
@lehins They are indeed identical but the typechecker is still unhappy, I have had to walk the various data structures to be able to convert between 2 crypto types even though the representations are the same. I may be missing something obvious but I could not appease the type gods otherwise. |
Latest status: Most packages of the branch compile and o-c-c-test run, however they still fail because I am not able to use 2 different cryptos with the generators, so I may have done something wrong somewhere, perhaps a rogue equality constraint or something. |
If anyone wants to pick this up before next week, here is the current situation:
|
Thanks to @nfrisby's sharp eye and deep expertise, I was able to solve the So I now have a branch that nearly could work as is and enables different VRF crypto for Conway than we now have in Babbage, albeit with some abuse of |
Blocked on IntersectMBO/cardano-ledger#3388 and repository migration |
At the moment we do not have this among our priorities, so we're putting this on hold. |
The crypto team has (re-)prepared newer versions of the VRF and KES algorithms/formats for use in eras after Babbage (ie starting with Conway after the Chang HF). This is materialised as three PI objectives that will involve Consensus:
The goal of this issue is to implement batch VRF verification in consensus.
This implies:
The text was updated successfully, but these errors were encountered: