mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-18 01:21:01 +00:00
pallet-mmr: generate historical proofs (#12324)
* BEEFY: generate historical proofs Signed-off-by: Serban Iorga <serban@parity.io> * Update frame/merkle-mountain-range/rpc/src/lib.rs Co-authored-by: Adrian Catangiu <adrian@parity.io> * Update primitives/merkle-mountain-range/src/lib.rs Co-authored-by: Adrian Catangiu <adrian@parity.io> * Update frame/merkle-mountain-range/src/lib.rs Co-authored-by: Adrian Catangiu <adrian@parity.io> * cargo fmt * fix off-by-one in leaves powerset generation * test all possible mmr sizes for historical proofs * remove now redundant simple_historical_proof * cargo fmt Signed-off-by: Serban Iorga <serban@parity.io> Co-authored-by: Adrian Catangiu <adrian@parity.io> Co-authored-by: Robert Hambrock <roberthambrock@gmail.com>
This commit is contained in:
@@ -402,6 +402,8 @@ pub enum Error {
|
||||
PalletNotIncluded,
|
||||
/// Cannot find the requested leaf index
|
||||
InvalidLeafIndex,
|
||||
/// The provided leaves count is larger than the actual leaves count.
|
||||
InvalidLeavesCount,
|
||||
}
|
||||
|
||||
impl Error {
|
||||
@@ -455,7 +457,14 @@ sp_api::decl_runtime_apis! {
|
||||
fn mmr_root() -> Result<Hash, Error>;
|
||||
|
||||
/// Generate MMR proof for a series of leaves under given indices.
|
||||
fn generate_batch_proof(leaf_indices: Vec<LeafIndex>) -> Result<(Vec<EncodableOpaqueLeaf>, BatchProof<Hash>), Error>;
|
||||
fn generate_batch_proof(leaf_indices: Vec<LeafIndex>)
|
||||
-> Result<(Vec<EncodableOpaqueLeaf>, BatchProof<Hash>), Error>;
|
||||
|
||||
/// Generate MMR proof for a series of leaves under given indices, using MMR at given `leaves_count` size.
|
||||
fn generate_historical_batch_proof(
|
||||
leaf_indices: Vec<LeafIndex>,
|
||||
leaves_count: LeafIndex
|
||||
) -> Result<(Vec<EncodableOpaqueLeaf>, BatchProof<Hash>), Error>;
|
||||
|
||||
/// Verify MMR proof against on-chain MMR for a batch of leaves.
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user