Add xcm fuzzer (#3869)

* Extend xcm-simulator with a fuzzer for xcm exec

This commit adds a very basic fuzzer that fuzzes the xcm exectution,
in particular the process_instruction function.

* Update cargo.toml in xcm-simulator-fuzzer

* Add xcm-fuzzer to honggfuzz workflow

* Update Cargo.lock

* Update xcm/xcm-simulator/fuzzer/Cargo.toml so honggfuzz shows up on top

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* Update relay_chain.rs in xcm-fuzzer

* Use MAX_XCM_DECODE_DEPTH instead of hardcoded decode limit in xcm-fuzzer

* Add comment on how to generate coverage report in xcm-fuzzer

* fix warnings, fmt, and unused result

* fix compiler

Co-authored-by: Vincent Ulitzsch <vincent.ulitzsch@srlabs.de>
Co-authored-by: Vincent Ulitzsch <vincent@srlabs.de>
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>
This commit is contained in:
Vincent Ulitzsch
2021-10-12 13:37:06 +02:00
committed by GitHub
parent 5aec12d012
commit 67032af69f
7 changed files with 807 additions and 0 deletions
+51
View File
@@ -121,6 +121,12 @@ dependencies = [
"num-traits",
]
[[package]]
name = "arbitrary"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "577b08a4acd7b99869f863c50011b01eb73424ccc798ecd996f2e24817adfca7"
[[package]]
name = "arrayref"
version = "0.3.6"
@@ -2603,6 +2609,17 @@ dependencies = [
"hmac 0.8.1",
]
[[package]]
name = "honggfuzz"
version = "0.5.54"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bea09577d948a98a5f59b7c891e274c4fb35ad52f67782b3d0cb53b9c05301f1"
dependencies = [
"arbitrary",
"lazy_static",
"memmap",
]
[[package]]
name = "hostname"
version = "0.3.1"
@@ -4043,6 +4060,16 @@ version = "2.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a"
[[package]]
name = "memmap"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6585fd95e7bb50d6cc31e20d4cf9afb4e2ba16c5846fc76793f11218da9c475b"
dependencies = [
"libc",
"winapi 0.3.9",
]
[[package]]
name = "memmap2"
version = "0.2.0"
@@ -11886,6 +11913,30 @@ dependencies = [
"xcm-simulator",
]
[[package]]
name = "xcm-simulator-fuzzer"
version = "0.9.9"
dependencies = [
"frame-support",
"frame-system",
"honggfuzz",
"pallet-balances",
"pallet-xcm",
"parity-scale-codec",
"polkadot-core-primitives",
"polkadot-parachain",
"polkadot-runtime-parachains",
"scale-info",
"sp-core",
"sp-io",
"sp-runtime",
"sp-std",
"xcm",
"xcm-builder",
"xcm-executor",
"xcm-simulator",
]
[[package]]
name = "yamux"
version = "0.9.0"