-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Update MMR Runtime API with functionality to generate MMR proof for a series of leaf indices #10635
Update MMR Runtime API with functionality to generate MMR proof for a series of leaf indices #10635
Conversation
Hey, is anyone still working on this? Due to the inactivity this issue has been automatically marked as stale. It will be closed if no further activity occurs. Thank you for your contributions. |
Bump |
Hey, is anyone still working on this? Due to the inactivity this issue has been automatically marked as stale. It will be closed if no further activity occurs. Thank you for your contributions. |
bump |
@acatangiu please could you take a look at this PR? The API it adds will be useful to parachain teams |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think most of these functions could be deduplicated if you just used primitives::BatchProof
everywhere.
primitives::Proof
is just a primitives::BatchProof
with inner leaf_indices.len() == 1
.
Since we don't want to break the API we can keep the non-batched runtime API functions at the runtime API level (we can also keep both versions for RPC), but everything underneath (frame/merkle-mountain-range/src/mmr/mmr.rs
, frame/merkle-mountain-range/src/lib.rs
) can have single implementation that works with BatchProof
.
@Wizdave97 @seunlanlege sorry for the delay in review, I've only recently got acquainted with the MMR pallet and library. Also FYI the MMR primitives are moved in #11183 ; so this PR should also rebase on top of that to get clean merge. |
5f002ab
to
4132c67
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple of suggestions, otherwise seems good
bot merge |
Error: "Check reviews" status is not passing for paritytech/polkadot#4700 |
…llow-batch-verification-of-leaves
26a16e1
to
590eae9
Compare
bot merge |
Error: "Check reviews" status is not passing for paritytech/polkadot#4700 |
bot merge |
Error: "Check reviews" status is not passing for paritytech/polkadot#4700 |
…llow-batch-verification-of-leaves
/// Will panic if leaf indices length is less than 1 | ||
pub fn into_single_leaf_proof(proof: BatchProof<Hash>) -> Proof<Hash> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just noticed this and think we should do checked access and return Error::InvalidLeafIndices
instead of unchecked access and panicking.
…llow-batch-verification-of-leaves
bot merge |
… series of leaf indices (paritytech#10635) * updated mmr rpc api with functions for batch generation of proof * update code comments * fix build errors * added tests to mmr-rpc * add tests to pallet-mmr * update comments * minor comment fix * remove unused variables * fix rust doc errors * refactor mmr runtime api * fix tests * minor fix * minor fix * fix node-runtime * revert to initial api * impl from proof fot batchproof * minor fix * minor fix * use explicit functions to convert btw batch proof and single proof * minor fix * add new variant to mmr error * fmt * update conversion to single leaf proof * fix style nit Co-authored-by: Adrian Catangiu <adrian@parity.io>
… series of leaf indices (paritytech#10635) * updated mmr rpc api with functions for batch generation of proof * update code comments * fix build errors * added tests to mmr-rpc * add tests to pallet-mmr * update comments * minor comment fix * remove unused variables * fix rust doc errors * refactor mmr runtime api * fix tests * minor fix * minor fix * fix node-runtime * revert to initial api * impl from proof fot batchproof * minor fix * minor fix * use explicit functions to convert btw batch proof and single proof * minor fix * add new variant to mmr error * fmt * update conversion to single leaf proof * fix style nit Co-authored-by: Adrian Catangiu <adrian@parity.io>
… series of leaf indices (paritytech#10635) * updated mmr rpc api with functions for batch generation of proof * update code comments * fix build errors * added tests to mmr-rpc * add tests to pallet-mmr * update comments * minor comment fix * remove unused variables * fix rust doc errors * refactor mmr runtime api * fix tests * minor fix * minor fix * fix node-runtime * revert to initial api * impl from proof fot batchproof * minor fix * minor fix * use explicit functions to convert btw batch proof and single proof * minor fix * add new variant to mmr error * fmt * update conversion to single leaf proof * fix style nit Co-authored-by: Adrian Catangiu <adrian@parity.io>
This PR adds new functions to the MMR Runtime API to accept an array of leaf indexes, this would allow generating a proof for multiple leaf indices in one run if needed
Also added functions for verifying these kind of proof
Previous implementation of the PR here #10625
@rphmeier this is an updated fix for #10625 following your recommendation
polkadot companion: paritytech/polkadot#4700