pallet-mmr: move offchain logic to client-side gadget (#12753)

* Move MMR utils methods from pallet to primitives

Signed-off-by: Serban Iorga <serban@parity.io>

* Add method to MmrApi

* Move forks expanding logic from babe to primitives

* Implement MMR gadget

* Remove prunning logic from the MMR pallet

* Code review changes: 1st iteration

* Replace MaybeCanonEngine with CanonEngineBuilder

* fix mmr_leaves_count() for kitchen sink demo

* Update client/merkle-mountain-range/src/canon_engine.rs

Co-authored-by: Adrian Catangiu <adrian@parity.io>

* Code review changes: 2nd iteration

* fix INDEXING_PREFIX

* impl review comments

* add documentation and minor rename

Signed-off-by: Serban Iorga <serban@parity.io>
Co-authored-by: Adrian Catangiu <adrian@parity.io>
This commit is contained in:
Serban Iorga
2022-11-29 16:39:52 +02:00
committed by GitHub
parent d56214c21f
commit ff439ee335
21 changed files with 1161 additions and 561 deletions
+24 -1
View File
@@ -4230,6 +4230,29 @@ dependencies = [
"windows-sys 0.36.1",
]
[[package]]
name = "mmr-gadget"
version = "4.0.0-dev"
dependencies = [
"async-std",
"beefy-primitives",
"futures",
"log",
"parity-scale-codec",
"sc-block-builder",
"sc-client-api",
"sc-offchain",
"sp-api",
"sp-blockchain",
"sp-consensus",
"sp-core",
"sp-io",
"sp-mmr-primitives",
"sp-runtime",
"substrate-test-runtime-client",
"tokio",
]
[[package]]
name = "mockall"
version = "0.11.2"
@@ -5645,7 +5668,6 @@ name = "pallet-mmr"
version = "4.0.0-dev"
dependencies = [
"array-bytes",
"ckb-merkle-mountain-range",
"env_logger",
"frame-benchmarking",
"frame-support",
@@ -9724,6 +9746,7 @@ name = "sp-mmr-primitives"
version = "4.0.0-dev"
dependencies = [
"array-bytes",
"ckb-merkle-mountain-range",
"log",
"parity-scale-codec",
"scale-info",