multiproof-rs icon indicating copy to clipboard operation
multiproof-rs copied to clipboard

Add NodeEncoding trait

Open axic opened this issue 6 years ago • 2 comments

axic avatar Sep 09 '19 18:09 axic

I understand that this is still in progress and it might change. Still, I'm commenting so that you don't spend too much time going in the wrong direction: in its current state, this code binds Node serialization to rlp. The idea behind that library is to factor the algorithm and leave details such as the encoding format.

So if someone (presumably in the eth1 world) needs RLP, they just need to implement rlp::Encodable (which is already done). If someone wants to use SSZ, then they will need to implement somthing like ssz::Encodable. And if someone wants JSON (currently in the pipe), they can implement serde::Serializable.

Maybe I misunderstand what you're trying to do. Just please update the description when you have a moment.

gballet avatar Sep 10 '19 13:09 gballet

I'm not sure what is the confusion, but since the the proof builder and verifier both internally encode things, you need a trait to run that encoding, which is not tied to RLP.

And this is only the first step. You'd provide different impls of Node to make_multiproof and rebuild which either fully use RLP or SSZ, but this trait is shared between the two.

axic avatar Sep 27 '19 12:09 axic