Support MMR Pruning (#9700)

* Use `0.3.2`

* Replace `u64` with `NodeIndex`

* Fix Typo

* Add Pruning Logic

* Fix Some Tests

* Remove Comment

* Log Only Under STD

* Return while No Element to Append

* Optimize Pruning Algorithm

* Update Doc

* Update Doc

* Zero Copy Algorithm

* Import Missing Type

* Fix Merge Mistake

* Import Missing Item

* Make `verify` Off-Chain

* `cargo fmt`

* Avoid using NodeIndex in incorrect places.

* Simplify pruning.

* Format

Co-authored-by: Tomasz Drwięga <tomasz@parity.io>
This commit is contained in:
Xavier Lau
2021-11-23 21:04:05 +08:00
committed by GitHub
parent 76737891bb
commit f9122a870e
11 changed files with 165 additions and 61 deletions
+1 -1
View File
@@ -1559,7 +1559,7 @@ impl_runtime_apis! {
Block,
mmr::Hash,
> for Runtime {
fn generate_proof(leaf_index: u64)
fn generate_proof(leaf_index: pallet_mmr::primitives::LeafIndex)
-> Result<(mmr::EncodableOpaqueLeaf, mmr::Proof<mmr::Hash>), mmr::Error>
{
Mmr::generate_proof(leaf_index)