ralexstokes / ssz-rs

Implementation of ethereum's `ssz`
Apache License 2.0
102 stars 40 forks source link

ssz merkle multi prover/verifier #32

Closed seunlanlege closed 5 months ago

seunlanlege commented 1 year ago

Fixes #35.

I'm currently trying to add support for generating ssz merkle multi proofs, follwing the ssz spec. I'm breaking down the work into multiple commits:

Fist I added the neccessary runtime reflection code needed for get_generalized_index for SszObjects.

Then I introduced the proof generation code, based on this runtime reflection.

Apologies for the cargo fmt changes, i don't like to format my code by hand.

edit(ralexstokes): link issue

seunlanlege commented 1 year ago

@ralexstokes still interested in this?

ralexstokes commented 1 year ago

@seunlanlege I am, although I haven't had time to digest all of the reflective code here -- I am wondering if there is a way to move it to compile-time; pushing most of the logic in this PR to some proc macro and then only doing the bare minimum at runtime, e.g. interpreting GeneralizedIndices and returning parts of the backing Merkle tree

ralexstokes commented 5 months ago

hey @seunlanlege thanks for this! I'm going to close this PR as I have settled on the compile-time route for generalized index computation currently on main, and I've started working on a proving scheme in #131 to support basic (single) merkle proofs.

if you wanted to look at multiproof generation + verification following this work, would be happy to discuss further :)

seunlanlege commented 5 months ago

hey @seunlanlege thanks for this! I'm going to close this PR as I have settled on the compile-time route for generalized index computation currently on main, and I've started working on a proving scheme in #131 to support basic (single) merkle proofs.

if you wanted to look at multiproof generation + verification following this work, would be happy to discuss further :)

Interesting stuff, glad you were able to finally figure it out. Unfortunately I won't have the bandwidth to contribute further at this time. We're already using my runtime-indexing approach in our beacon chain consensus prover for hyperbridge.

It Works pretty well, and it's already been live on our testnet since last year infact we're just about to go through audits for mainnet. We will definitely look into maybe switching to the compile time version once it's ready :D