Merkle Mountain Range pallet (#7312)

* Add MMR pallet.

* WiP

* Working on testing.

* WiP - test

* Tests passing.

* Add proof generation.

* Generate and verify proofs.

* Allow verification of older proofs.

* Move stuff to a module.

* Split MMR stuff to it's own module.

* Add docs.

* Make parent hash optional.

* LeafData failed approach.

* Finally implement Compact stuff.

* Compact encoding WiP

* Implement remaining pieces.

* Fix tests

* Add docs to compact.

* Implement for tuples.

* Fix documentation.

* Fix warnings and address review suggestion.

* Update frame/merkle-mountain-range/src/primitives.rs

Co-authored-by: cheme <emericchevalier.pro@gmail.com>

* Address review grumbles.

* Removing missing crate.

* Fix test.

* Add some docs and test.

* Add multiple instances.

* Cargo.toml sync.

* Fix no_std compilation.

* More no_std stuff.

* Rename MMR struct.

* Addressing other grumbles.

* Fix test.

* Remove format for no_std compat.

* Add test for MMR pallet.

* Fix std feature.

* Update versions.

* Add to node/runtime.

* Add hook to insert digest.

* Make primitives public.

* Update lib.rs

tech spec/typos etc

* Use WeightInfo and benchmarks.

* Fix test.

* Fix benchmarks.

* Trait -> Config.

* Fix typo.

* Fix tests.

Co-authored-by: cheme <emericchevalier.pro@gmail.com>
Co-authored-by: Addie Wagenknecht <addie@nortd.com>
This commit is contained in:
Tomasz Drwięga
2020-12-09 16:35:13 +01:00
committed by GitHub
parent 2ed2832046
commit 02f66e8823
19 changed files with 1751 additions and 50 deletions
+44 -3
View File
@@ -419,7 +419,7 @@ dependencies = [
"cfg-if 0.1.10",
"clang-sys",
"clap",
"env_logger",
"env_logger 0.7.1",
"lazy_static",
"lazycell",
"log",
@@ -716,6 +716,15 @@ dependencies = [
"winapi 0.3.9",
]
[[package]]
name = "ckb-merkle-mountain-range"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e486fe53bb9f2ca0f58cb60e8679a5354fd6687a839942ef0a75967250289ca6"
dependencies = [
"cfg-if 0.1.10",
]
[[package]]
name = "clang-sys"
version = "0.29.3"
@@ -1328,6 +1337,19 @@ dependencies = [
"syn",
]
[[package]]
name = "env_logger"
version = "0.5.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "15b0a4d2e39f8420210be8b27eeda28029729e2fd4291019455016c348240c38"
dependencies = [
"atty",
"humantime",
"log",
"regex",
"termcolor",
]
[[package]]
name = "env_logger"
version = "0.7.1"
@@ -1450,7 +1472,7 @@ version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4fdbe0d94371f9ce939b555dd342d0686cc4c0cadbcd4b61d70af5ff97eb4126"
dependencies = [
"env_logger",
"env_logger 0.7.1",
"log",
]
@@ -3911,6 +3933,7 @@ dependencies = [
"pallet-im-online",
"pallet-indices",
"pallet-membership",
"pallet-mmr",
"pallet-multisig",
"pallet-offences",
"pallet-offences-benchmarking",
@@ -4651,6 +4674,24 @@ dependencies = [
"sp-std",
]
[[package]]
name = "pallet-mmr"
version = "2.0.0"
dependencies = [
"ckb-merkle-mountain-range",
"env_logger 0.5.13",
"frame-benchmarking",
"frame-support",
"frame-system",
"hex-literal",
"parity-scale-codec",
"serde",
"sp-core",
"sp-io",
"sp-runtime",
"sp-std",
]
[[package]]
name = "pallet-multisig"
version = "2.0.0"
@@ -5754,7 +5795,7 @@ version = "0.9.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a44883e74aa97ad63db83c4bf8ca490f02b2fc02f92575e720c8551e843c945f"
dependencies = [
"env_logger",
"env_logger 0.7.1",
"log",
"rand 0.7.3",
"rand_core 0.5.1",