mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-17 12:31:03 +00:00
Companion for pallet-mmr: generate historical proofs (#6061)
* BEEFY: generate historical proofs Signed-off-by: Serban Iorga <serban@parity.io> * cargo update -p sp-io * Properly set max proof size for runtimes * Properly set max proof size for mocks * cargo fmt * Set appropriate UMP service total proof size weight * Disable zombienet-tests-parachains-disputes CI * Add comment explaining weight math * Use MAX_POV_SIZE for max proof size * Cast to u64 * Remove comment Signed-off-by: Serban Iorga <serban@parity.io> Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>
This commit is contained in:
@@ -1723,6 +1723,23 @@ sp_api::impl_runtime_apis! {
|
||||
.map(|(leaves, proof)| (leaves.into_iter().map(|leaf| mmr::EncodableOpaqueLeaf::from_leaf(&leaf)).collect(), proof))
|
||||
}
|
||||
|
||||
fn generate_historical_batch_proof(
|
||||
leaf_indices: Vec<mmr::LeafIndex>,
|
||||
leaves_count: mmr::LeafIndex,
|
||||
) -> Result<(Vec<mmr::EncodableOpaqueLeaf>, mmr::BatchProof<Hash>), mmr::Error> {
|
||||
Mmr::generate_historical_batch_proof(leaf_indices, leaves_count).map(
|
||||
|(leaves, proof)| {
|
||||
(
|
||||
leaves
|
||||
.into_iter()
|
||||
.map(|leaf| mmr::EncodableOpaqueLeaf::from_leaf(&leaf))
|
||||
.collect(),
|
||||
proof,
|
||||
)
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
fn verify_batch_proof(leaves: Vec<mmr::EncodableOpaqueLeaf>, proof: mmr::BatchProof<Hash>)
|
||||
-> Result<(), mmr::Error>
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user