mratsim / constantine

Constantine: modular, high-performance, zero-dependency cryptography stack for verifiable computation, proof systems and blockchain protocols.
Other
391 stars 43 forks source link

Ethereum Verkle IPA refactoring part 2 #397

Closed mratsim closed 3 months ago

mratsim commented 3 months ago

This PR is a followup to #392. Unfortunately this PR has become the biggest PR ever and a part 3 is needed.

An important background to this PR is https://github.com/mratsim/constantine/issues/396.

The previous IPA implementation:

  1. Has a bug in proof generation which made proof invalid
  2. Has a bug in proof verification which accepted those proof
  3. Was lacking test coverage to highlight those bugs
  4. Multiproofs were incorrect due to 1 and 2

This refactoring may fix 1 and 2, however at the moment only if run in AddressSanitizer. If not for some reason verification fails. Hence this refactoring improves structure and lay out groundwork for addressing the bugs once and for all but does not improve or degrade compared to past implementation.

The files constantine/ethereum_verkle_primitives.nim and constantine/ethereum_verkle_trees.nim have been deleted and replaced by constantine/ethereum_verkle_ipa.nim

The final public API for Eth Verkle IPA still needs to be implemented. It will be similar to the KZG one and will expose only what's necessary and not Constantine's internals.

However before that #396 must be fixed


Highlight of changes: