diff --git a/.github/workflows/test-suite.yml b/.github/workflows/test-suite.yml index 98e97972a..ad6ee7b0f 100644 --- a/.github/workflows/test-suite.yml +++ b/.github/workflows/test-suite.yml @@ -81,3 +81,10 @@ jobs: - uses: actions/checkout@v1 - name: Lint code for quality and style with Clippy run: make lint + arbitrary-check: + runs-on: ubuntu-latest + needs: cargo-fmt + steps: + - uses: actions/checkout@v1 + - name: Validate state_processing feature arbitrary-fuzz + run: make arbitrary-fuzz diff --git a/Cargo.lock b/Cargo.lock index b6e814b42..1196c0f09 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -24,7 +24,7 @@ dependencies = [ "tokio 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)", "types 0.2.0", "validator_client 0.2.0", - "web3 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "web3 0.10.0 (git+https://github.com/tomusdrw/rust-web3)", ] [[package]] @@ -96,6 +96,14 @@ dependencies = [ "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "arbitrary" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "derive_arbitrary 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "arc-swap" version = "0.4.5" @@ -172,7 +180,7 @@ name = "backtrace-sys" version = "0.1.36" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.50 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -367,6 +375,7 @@ dependencies = [ name = "bls" version = "0.2.0" dependencies = [ + "arbitrary 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "eth2_hashing 0.1.1", "eth2_ssz 0.1.2", "eth2_ssz_types 0.2.0", @@ -448,7 +457,7 @@ dependencies = [ "eth2_ssz 0.1.2", "eth2_ssz_derive 0.1.0", "eth2_ssz_types 0.2.0", - "ethereum-types 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "ethereum-types 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", "quickcheck 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", "quickcheck_macros 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -465,7 +474,7 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.50" +version = "1.0.41" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -514,7 +523,7 @@ name = "clear_on_drop" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.50 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -876,7 +885,7 @@ name = "deposit_contract" version = "0.2.0" dependencies = [ "eth2_ssz 0.1.2", - "ethabi 11.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "ethabi 12.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "reqwest 0.9.24 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.51 (registry+https://github.com/rust-lang/crates.io-index)", "tree_hash 0.1.1", @@ -894,16 +903,13 @@ dependencies = [ ] [[package]] -name = "derive_more" -version = "0.15.0" +name = "derive_arbitrary" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.3.7 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -978,7 +984,7 @@ dependencies = [ "compare_fields 0.2.0", "eth2_ssz 0.1.2", "eth2_ssz_derive 0.1.0", - "ethereum-types 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "ethereum-types 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", "hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1105,7 +1111,7 @@ dependencies = [ "toml 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", "tree_hash 0.1.1", "types 0.2.0", - "web3 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "web3 0.10.0 (git+https://github.com/tomusdrw/rust-web3)", ] [[package]] @@ -1117,7 +1123,7 @@ dependencies = [ "serde_json 1.0.51 (registry+https://github.com/rust-lang/crates.io-index)", "tokio 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)", "types 0.2.0", - "web3 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "web3 0.10.0 (git+https://github.com/tomusdrw/rust-web3)", ] [[package]] @@ -1198,7 +1204,7 @@ name = "eth2_ssz" version = "0.1.2" dependencies = [ "eth2_ssz_derive 0.1.0", - "ethereum-types 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "ethereum-types 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1214,6 +1220,7 @@ dependencies = [ name = "eth2_ssz_types" version = "0.2.0" dependencies = [ + "arbitrary 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "eth2_ssz 0.1.2", "serde 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1239,93 +1246,40 @@ dependencies = [ [[package]] name = "ethabi" -version = "8.0.1" +version = "12.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "error-chain 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", - "ethereum-types 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-hex 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.51 (registry+https://github.com/rust-lang/crates.io-index)", - "tiny-keccak 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "ethabi" -version = "9.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "error-chain 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", - "ethereum-types 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-hex 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.51 (registry+https://github.com/rust-lang/crates.io-index)", - "tiny-keccak 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "ethabi" -version = "11.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "ethereum-types 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "ethereum-types 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.51 (registry+https://github.com/rust-lang/crates.io-index)", "tiny-keccak 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uint 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", + "uint 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "ethbloom" -version = "0.6.4" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "crunchy 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "fixed-hash 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "fixed-hash 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "impl-rlp 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "impl-serde 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "tiny-keccak 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "ethbloom" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "crunchy 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "fixed-hash 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", - "impl-rlp 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "impl-serde 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "tiny-keccak 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "impl-serde 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tiny-keccak 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "ethereum-types" -version = "0.6.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "ethbloom 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", - "fixed-hash 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "ethbloom 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", + "fixed-hash 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "impl-rlp 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "impl-serde 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "primitive-types 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uint 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "ethereum-types" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "ethbloom 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", - "fixed-hash 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", - "impl-rlp 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "impl-serde 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "primitive-types 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "uint 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", + "impl-serde 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "primitive-types 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "uint 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1364,21 +1318,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "fixed-hash" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-hex 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "static_assertions 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "fixed-hash" -version = "0.5.2" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ + "arbitrary 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1556,14 +1499,6 @@ dependencies = [ "tokio-timer 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "heapsize" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "hermit-abi" version = "0.1.11" @@ -1723,14 +1658,6 @@ dependencies = [ "unicode-normalization 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "impl-codec" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "parity-codec 3.5.4 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "impl-codec" version = "0.4.2" @@ -1747,14 +1674,6 @@ dependencies = [ "rlp 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "impl-serde" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "serde 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "impl-serde" version = "0.3.0" @@ -1819,18 +1738,6 @@ dependencies = [ "wasm-bindgen 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "jsonrpc-core" -version = "11.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.51 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "jsonrpc-core" version = "14.1.0" @@ -1896,7 +1803,7 @@ dependencies = [ "state_processing 0.2.0", "tree_hash 0.1.1", "types 0.2.0", - "web3 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "web3 0.10.0 (git+https://github.com/tomusdrw/rust-web3)", ] [[package]] @@ -2152,7 +2059,7 @@ dependencies = [ "smallvec 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-codec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", - "uint 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", + "uint 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", "unsigned-varint 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-timer 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2381,7 +2288,7 @@ name = "libz-sys" version = "1.0.25" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.50 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)", "vcpkg 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2430,14 +2337,6 @@ dependencies = [ "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "lock_api" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "lock_api" version = "0.3.4" @@ -2516,7 +2415,7 @@ name = "merkle_proof" version = "0.2.0" dependencies = [ "eth2_hashing 0.1.1", - "ethereum-types 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "ethereum-types 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "quickcheck 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", "quickcheck_macros 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2689,7 +2588,7 @@ version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "cc 1.0.50 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2793,7 +2692,7 @@ version = "0.9.55" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cc 1.0.50 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)", "vcpkg 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2823,15 +2722,6 @@ dependencies = [ "stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "parity-codec" -version = "3.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "arrayvec 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "parity-multiaddr" version = "0.6.0" @@ -2888,16 +2778,6 @@ dependencies = [ "parking_lot_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "parking_lot" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "lock_api 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot_core 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "parking_lot" version = "0.9.0" @@ -2929,21 +2809,6 @@ dependencies = [ "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "parking_lot_core" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "parking_lot_core" version = "0.6.2" @@ -3004,26 +2869,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "primitive-types" -version = "0.3.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "fixed-hash 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "impl-codec 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "impl-rlp 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "impl-serde 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "uint 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "primitive-types" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "fixed-hash 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "fixed-hash 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "impl-codec 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "impl-rlp 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "impl-serde 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uint 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", + "uint 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3499,7 +3352,7 @@ name = "ring" version = "0.16.12" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.50 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", "spin 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3632,6 +3485,22 @@ dependencies = [ "untrusted 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "secp256k1" +version = "0.17.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "secp256k1-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "secp256k1-sys" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "security-framework" version = "0.4.2" @@ -3987,6 +3856,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" name = "state_processing" version = "0.2.0" dependencies = [ + "arbitrary 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "beacon_chain 0.2.0", "bls 0.2.0", "criterion 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4011,11 +3881,6 @@ dependencies = [ "types 0.2.0", ] -[[package]] -name = "static_assertions" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "static_assertions" version = "1.1.0" @@ -4083,7 +3948,7 @@ version = "0.2.0" dependencies = [ "criterion 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "eth2_hashing 0.1.1", - "ethereum-types 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "ethereum-types 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", "hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "yaml-rust 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -4222,6 +4087,14 @@ dependencies = [ "crunchy 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "tiny-keccak" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crunchy 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "tinytemplate" version = "1.0.3" @@ -4534,7 +4407,7 @@ version = "0.1.1" dependencies = [ "criterion 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "eth2_hashing 0.1.1", - "ethereum-types 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "ethereum-types 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4587,6 +4460,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" name = "types" version = "0.2.0" dependencies = [ + "arbitrary 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "bls 0.2.0", "cached_tree_hash 0.1.0", "compare_fields 0.2.0", @@ -4600,7 +4474,7 @@ dependencies = [ "eth2_ssz 0.1.2", "eth2_ssz_derive 0.1.0", "eth2_ssz_types 0.2.0", - "ethereum-types 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "ethereum-types 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", "hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "int_to_bytes 0.2.0", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4623,20 +4497,10 @@ dependencies = [ [[package]] name = "uint" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "crunchy 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-hex 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "uint" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ + "arbitrary 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "crunchy 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4768,7 +4632,7 @@ dependencies = [ "tokio-timer 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", "tree_hash 0.1.1", "types 0.2.0", - "web3 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "web3 0.10.0 (git+https://github.com/tomusdrw/rust-web3)", ] [[package]] @@ -4944,44 +4808,16 @@ dependencies = [ "wasm-bindgen 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "web3" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "arrayvec 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", - "base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", - "derive_more 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", - "ethabi 8.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "ethereum-types 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", - "hyper 0.12.35 (registry+https://github.com/rust-lang/crates.io-index)", - "hyper-tls 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "jsonrpc-core 11.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "native-tls 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-hex 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.51 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-core 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-timer 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-uds 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", - "websocket 0.21.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "web3" version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" +source = "git+https://github.com/tomusdrw/rust-web3#b6c81f978ede4e5c250b2d6f93399f31f7ac2a48" dependencies = [ "arrayvec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "base64 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "base64 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "derive_more 0.99.5 (registry+https://github.com/rust-lang/crates.io-index)", - "ethabi 9.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "ethereum-types 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "ethabi 12.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "ethereum-types 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.12.35 (registry+https://github.com/rust-lang/crates.io-index)", "hyper-tls 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4989,15 +4825,19 @@ dependencies = [ "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "native-tls 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rlp 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "secp256k1 0.17.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.51 (registry+https://github.com/rust-lang/crates.io-index)", + "tiny-keccak 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-core 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-timer 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-uds 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "url 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "websocket 0.21.1 (registry+https://github.com/rust-lang/crates.io-index)", + "zeroize 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -5189,6 +5029,7 @@ dependencies = [ "checksum aho-corasick 0.7.10 (registry+https://github.com/rust-lang/crates.io-index)" = "8716408b8bc624ed7f65d223ddb9ac2d044c0547b6fa4b0d554f3a9540496ada" "checksum amcl 0.2.0 (git+https://github.com/sigp/milagro_bls?tag=v1.0.1)" = "" "checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" +"checksum arbitrary 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4128060818e1993996df2368a1c154ffdba9df04ec84eb9a8c03ee381906fd9a" "checksum arc-swap 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "d663a8e9a99154b5fb793032533f6328da35e23aac63d5c152279aa8ba356825" "checksum arrayref 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" "checksum arrayvec 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)" = "cd9fd44efafa8690358b7408d253adf110036b88f55672a933f01d616ad9b1b9" @@ -5225,7 +5066,7 @@ dependencies = [ "checksum bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)" = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c" "checksum c_linked_list 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4964518bd3b4a8190e832886cdc0da9794f12e8e6c1613a9e90ff331c4c8724b" "checksum cast 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4b9434b9a5aa1450faa3f9cb14ea0e8c53bb5d2b3c1bfd1ab4fc03e9f33fbfb0" -"checksum cc 1.0.50 (registry+https://github.com/rust-lang/crates.io-index)" = "95e28fa049fda1c330bcf9d723be7663a899c4679724b34c81e9f5a326aab8cd" +"checksum cc 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)" = "8dae9c4b8fedcae85592ba623c4fd08cfdab3e3b72d6df780c6ead964a69bfff" "checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" "checksum chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "80094f509cf8b5ae86a4966a39b3ff66cd7e2a3e594accec3743ff3fabeab5b2" "checksum clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9" @@ -5263,7 +5104,7 @@ dependencies = [ "checksum data-encoding 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "11c0346158a19b3627234e15596f5e465c360fcdb97d817bcb255e0510f5a788" "checksum db-key 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "b72465f46d518f6015d9cf07f7f3013a95dd6b9c2747c3d65ae0cce43929d14f" "checksum derivative 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "3c6d883546668a3e2011b6a716a7330b82eabb0151b138217f632c8243e17135" -"checksum derive_more 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a141330240c921ec6d074a3e188a7c7ef95668bb95e7d44fa0e5778ec2a7afe" +"checksum derive_arbitrary 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "665fb22bf9f8e54aaf364f1e5e21cbf5984491871dbc6c7d95b7c43bc580705f" "checksum derive_more 0.99.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e2323f3f47db9a0e77ce7a300605d8d2098597fc451ed1a97bb1f6411bb550a7" "checksum digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" "checksum dirs 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "13aea89a5c93364a98e9b37b2fa237effbb694d5cfe01c5b70941f7eb087d5e3" @@ -5277,19 +5118,14 @@ dependencies = [ "checksum env_logger 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "aafcde04e90a5226a6443b7aabdb016ba2f8307c847d524724bd9b346dd1a2d3" "checksum env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" "checksum error-chain 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d371106cc88ffdfb1eabd7111e432da544f16f3e2d7bf1dfe8bf575f1df045cd" -"checksum ethabi 11.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "97652a7d1f2504d6c885c87e242a06ccef5bd3054093d3fb742d8fb64806231a" -"checksum ethabi 8.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ebdeeea85a6d217b9fcc862906d7e283c047e04114165c433756baf5dce00a6c" -"checksum ethabi 9.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "965126c64662832991f5a748893577630b558e47fa94e7f35aefcd20d737cef7" -"checksum ethbloom 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "3932e82d64d347a045208924002930dc105a138995ccdc1479d0f05f0359f17c" -"checksum ethbloom 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "32cfe1c169414b709cf28aa30c74060bdb830a03a8ba473314d079ac79d80a5f" -"checksum ethereum-types 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "62d1bc682337e2c5ec98930853674dd2b4bd5d0d246933a9e98e5280f7c76c5f" -"checksum ethereum-types 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ba744248e3553a393143d5ebb68939fc3a4ec0c22a269682535f5ffe7fed728c" +"checksum ethabi 12.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "052a565e3de82944527d6d10a465697e6bb92476b772ca7141080c901f6a63c6" +"checksum ethbloom 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "befe713756981dbbda28e23f5c65c85de512915db695284342cc2ee36b7a184f" +"checksum ethereum-types 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8616dc6a7bc7d81ab8a6425635299ee3582975d4ddeb9312b8b0b8ea54dfecf8" "checksum exit-future 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d8013f441e38e31c670e7f34ec8f1d5d3a2bd9d303c1ff83976ca886005e8f48" "checksum failure 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "b8529c2421efa3066a5cbd8063d2244603824daccb6936b079010bb2aa89464b" "checksum failure_derive 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "030a733c8287d6213886dd487564ff5c8f6aae10278b3588ed177f9d18f8d231" "checksum fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" -"checksum fixed-hash 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d1a683d1234507e4f3bf2736eeddf0de1dc65996dc0164d57eba0a74bcf29489" -"checksum fixed-hash 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "3367952ceb191f4ab95dd5685dc163ac539e36202f9fcfd0cb22f9f9c542fefc" +"checksum fixed-hash 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "11498d382790b7a8f2fd211780bec78619bba81cdad3a283997c0c41f836759c" "checksum flate2 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)" = "2cfff41391129e0a856d6d822600b8d71179d46879e310417eb9c762eb178b42" "checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3" "checksum foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" @@ -5307,7 +5143,6 @@ dependencies = [ "checksum h2 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)" = "a5b34c246847f938a410a03c5458c7fee2274436675e76d8b903c08efc29c462" "checksum hashbrown 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e1de41fb8dba9714efd92241565cdff73f78508c95697dd56787d3cba27e2353" "checksum hashbrown 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8e6073d0ca812575946eb5f35ff68dbe519907b25c42530389ff946dc84c6ead" -"checksum heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1679e6ea370dee694f91f1dc469bf94cf8f52051d147aec3e1f9497c6fc22461" "checksum hermit-abi 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8a0d737e0f947a1864e93d33fdef4af8445a00d1ed8dc0c8ddb73139ea6abf15" "checksum hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "805026a5d0141ffc30abb3be3173848ad46a1b1664fe632428479619a3644d77" "checksum hex 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "644f9158b2f133fd50f5fb3242878846d9eb792e445c893805ff0e3824006e35" @@ -5323,10 +5158,8 @@ dependencies = [ "checksum hyper-tls 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "3a800d6aa50af4b5850b2b0f659625ce9504df908e9733b635720483be26174f" "checksum idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e" "checksum idna 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "02e2673c30ee86b5b96a9cb52ad15718aa1f966f5ab9ad54a8b95d5ca33120a9" -"checksum impl-codec 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d2050d823639fbeae26b2b5ba09aca8907793117324858070ade0673c49f793b" "checksum impl-codec 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1be51a921b067b0eaca2fad532d9400041561aa922221cc65f95a85641c6bf53" "checksum impl-rlp 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8f7a72f11830b52333f36e3b09a288333888bf54380fd0ac0790a3c31ab0f3c5" -"checksum impl-serde 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "58e3cae7e99c7ff5a995da2cf78dd0a5383740eda71d98cf7b1910c301ac69b8" "checksum impl-serde 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5bbe9ea9b182f0fb1cabbd61f4ff9b7b7b9197955e95a7e4c27de5055eb29ff8" "checksum indexmap 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "076f042c5b7b98f31d205f1249267e12a6518c1481e9dae9764af19b707d2292" "checksum integer-sqrt 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "f65877bf7d44897a473350b1046277941cee20b263397e90869c50b6e766088b" @@ -5335,7 +5168,6 @@ dependencies = [ "checksum itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f56a2d0bc861f9165be4eb3442afd3c236d8a98afd426f65d92324ae1091a484" "checksum itoa 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "b8b7a7c0c47db5545ed3fef7468ee7bb5b74691498139e4b3f6a20685dc6dd8e" "checksum js-sys 0.3.37 (registry+https://github.com/rust-lang/crates.io-index)" = "6a27d435371a2fa5b6d2b028a74bbdb1234f308da363226a2854ca3ff8ba7055" -"checksum jsonrpc-core 11.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "97b83fdc5e0218128d0d270f2f2e7a5ea716f3240c8518a58bc89e6716ba8581" "checksum jsonrpc-core 14.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "25525f6002338fb4debb5167a89a0b47f727a5a48418417545ad3429758b7fec" "checksum keccak 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "67c21572b4949434e4fc1e1978b99c5f77064153c59d998bf13ecd96fb5ecba7" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" @@ -5372,7 +5204,6 @@ dependencies = [ "checksum libz-sys 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)" = "2eb5e43362e38e2bca2fd5f5134c4d4564a23a5c28e9b95411652021a8675ebe" "checksum linked-hash-map 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ae91b68aebc4ddb91978b11a1b02ddd8602a05ec19002801c5666000e05e0f83" "checksum lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "62ebf1391f6acad60e5c8b43706dde4582df75c06698ab44511d15016bc2442c" -"checksum lock_api 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ed946d4529956a20f2d63ebe1b69996d5a2137c91913fe3ebbeff957f5bca7ff" "checksum lock_api 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "c4da24a77a3d8a6d4862d95f72e6fdb9c09a643ecdb402d754004a557f2bec75" "checksum log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b" "checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7" @@ -5407,17 +5238,14 @@ dependencies = [ "checksum openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de" "checksum openssl-sys 0.9.55 (registry+https://github.com/rust-lang/crates.io-index)" = "7717097d810a0f2e2323f9e5d11e71608355e24828410b55b9d4f18aa5f9a5d8" "checksum owning_ref 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6ff55baddef9e4ad00f88b6c743a2a8062d4c6ade126c2a528644b8e444d52ce" -"checksum parity-codec 3.5.4 (registry+https://github.com/rust-lang/crates.io-index)" = "2b9df1283109f542d8852cd6b30e9341acc2137481eb6157d2e62af68b0afec9" "checksum parity-multiaddr 0.6.0 (git+https://github.com/SigP/rust-libp2p?rev=71cf486b4d992862f5a05f9f4ef5e5c1631f4add)" = "" "checksum parity-multihash 0.2.0 (git+https://github.com/SigP/rust-libp2p?rev=71cf486b4d992862f5a05f9f4ef5e5c1631f4add)" = "" "checksum parity-scale-codec 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "329c8f7f4244ddb5c37c103641027a76c530e65e8e4b8240b29f81ea40508b17" "checksum parity-send-wrapper 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aa9777aa91b8ad9dd5aaa04a9b6bcb02c7f1deb952fca5a66034d5e63afc5c6f" "checksum parking_lot 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d3a704eb390aafdc107b0e392f56a82b668e3a71366993b5340f5833fd62505e" "checksum parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ab41b4aed082705d1056416ae4468b6ea99d52599ecf3169b00088d43113e337" -"checksum parking_lot 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fa7767817701cce701d5585b9c4db3cdd02086398322c1d7e8bf5094a96a2ce7" "checksum parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f842b1982eb6c2fe34036a4fbfb06dd185a3f5c8edfaacdf7d1ea10b07de6252" "checksum parking_lot_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94c8c7923936b28d546dfd14d4472eaf34c99b14e1c973a32b3e6d4eb04298c9" -"checksum parking_lot_core 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cb88cb1cb3790baa6776844f968fea3be44956cf184fa1be5a03341f5491278c" "checksum parking_lot_core 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b876b1b9e7ac6e1a74a6da34d25c42e17e8862aa409cbbbdcfc8d86c6f3bc62b" "checksum parking_lot_core 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0e136c1904604defe99ce5fd71a28d473fa60a12255d511aa78a9ddf11237aeb" "checksum percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" @@ -5425,8 +5253,7 @@ dependencies = [ "checksum pkg-config 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)" = "05da548ad6865900e60eaba7f589cc0783590a92e940c26953ff81ddbab2d677" "checksum plotters 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)" = "4e3bb8da247d27ae212529352020f3e5ee16e83c0c258061d27b08ab92675eeb" "checksum ppv-lite86 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "74490b50b9fbe561ac330df47c08f3f33073d2d00c150f719147d7c54522fa1b" -"checksum primitive-types 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2288eb2a39386c4bc817974cc413afe173010dc80e470fcb1e9a35580869f024" -"checksum primitive-types 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e4336f4f5d5524fa60bcbd6fe626f9223d8142a50e7053e979acdf0da41ab975" +"checksum primitive-types 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d3dedac218327b6b55fff5ef05f63ce5127024e1a36342836da7e92cbfac4531" "checksum proc-macro-hack 0.5.15 (registry+https://github.com/rust-lang/crates.io-index)" = "0d659fe7c6d27f25e9d80a1a094c223f5246f6a6596453e09d7229bf42750b63" "checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" "checksum proc-macro2 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)" = "df246d292ff63439fea9bc8c0a270bed0e390d5ebd4db4ba15aba81111b5abe3" @@ -5485,6 +5312,8 @@ dependencies = [ "checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27" "checksum scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" "checksum sct 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e3042af939fca8c3453b7af0f1c66e533a15a86169e39de2657310ade8f98d3c" +"checksum secp256k1 0.17.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2932dc07acd2066ff2e3921a4419606b220ba6cd03a9935123856cc534877056" +"checksum secp256k1-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7ab2c26f0d3552a0f12e639ae8a64afc2e3db9c52fe32f5fc6c289d38519f220" "checksum security-framework 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "572dfa3a0785509e7a44b5b4bebcf94d41ba34e9ed9eb9df722545c3b3c4144a" "checksum security-framework-sys 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8ddb15a5fec93b7021b8a9e96009c5d8d51c15673569f7c0f6b7204e5b7b404f" "checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" @@ -5519,7 +5348,6 @@ dependencies = [ "checksum soketto 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "bceb1a3a15232d013d9a3b7cac9e5ce8e2313f348f01d4bc1097e5e53aa07095" "checksum spin 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" "checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8" -"checksum static_assertions 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "c19be23126415861cb3a23e501d34a708f7f9b2183c5252d690941c2e69199d5" "checksum static_assertions 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" "checksum stream-cipher 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8131256a5896cabcf5eb04f4d6dacbe1aefda854b0d9896e09cb58829ec5638c" "checksum string 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d24114bfcceb867ca7f71a0d3fe45d45619ec47a6fbfa98cb14e14250bfa5d6d" @@ -5539,6 +5367,7 @@ dependencies = [ "checksum thread_local 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d40c6d1b69745a6ec6fb1ca717914848da4b44ae29d9b3080cbee91d72a69b14" "checksum time 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438" "checksum tiny-keccak 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d8a021c69bb74a44ccedb824a046447e2c84a01df9e5c20779750acb38e11b2" +"checksum tiny-keccak 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" "checksum tinytemplate 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "57a3c6667d3e65eb1bc3aed6fd14011c6cbc3a0665218ab7f5daf040b9ec371a" "checksum tokio 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)" = "5a09c0b5bb588872ab2f09afa13ee6e9dac11e10a0ec9e8e3ba39a5a5d530af6" "checksum tokio-buf 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8fb220f46c53859a4b7ec083e41dec9778ff0b1851c0942b211edb89e0ccdc46" @@ -5570,8 +5399,7 @@ dependencies = [ "checksum twofish 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712d261e83e727c8e2dbb75dacac67c36e35db36a958ee504f2164fc052434e1" "checksum typeable 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1410f6f91f21d1612654e7cc69193b0334f909dcf2c790c4826254fbb86f8887" "checksum typenum 1.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33" -"checksum uint 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2143cded94692b156c356508d92888acc824db5bffc0b4089732264c6fcf86d4" -"checksum uint 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e75a4cdd7b87b28840dba13c483b9a88ee6bbf16ba5c951ee1ecfcf723078e0d" +"checksum uint 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)" = "173cd16430c206dc1a430af8a89a0e9c076cf15cb42b4aedb10e8cc8fee73681" "checksum unicase 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7f4765f83163b74f957c797ad9253caf97f103fb064d3999aea9568d09fc8a33" "checksum unicase 2.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6" "checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" @@ -5603,8 +5431,7 @@ dependencies = [ "checksum wasm-bindgen-test-macro 0.3.10 (registry+https://github.com/rust-lang/crates.io-index)" = "cf2f86cd78a2aa7b1fb4bb6ed854eccb7f9263089c79542dca1576a1518a8467" "checksum wasm-timer 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "aa3e01d234bb71760e685cfafa5e2c96f8ad877c161a721646356651069e26ac" "checksum web-sys 0.3.37 (registry+https://github.com/rust-lang/crates.io-index)" = "2d6f51648d8c56c366144378a33290049eafdd784071077f6fe37dae64c1c4cb" -"checksum web3 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a0631c83208cf420eeb2ed9b6cb2d5fc853aa76a43619ccec2a3d52d741f1261" -"checksum web3 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "076f34ed252d74a8521e3b013254b1a39f94a98f23aae7cfc85cda6e7b395664" +"checksum web3 0.10.0 (git+https://github.com/tomusdrw/rust-web3)" = "" "checksum webpki 0.21.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f1f50e1972865d6b1adb54167d1c8ed48606004c2c9d0ea5f1eeb34d95e863ef" "checksum webpki-roots 0.18.0 (registry+https://github.com/rust-lang/crates.io-index)" = "91cd5736df7f12a964a5067a12c62fa38e1bd8080aff1f80bc29be7c80d19ab4" "checksum websocket 0.21.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c9faed2bff8af2ea6b9f8b917d3d00b467583f6781fe3def174a9e33c879703" diff --git a/Cargo.toml b/Cargo.toml index 453577d23..75bfa5644 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -60,3 +60,4 @@ eth2_ssz = { path = "eth2/utils/ssz" } eth2_ssz_derive = { path = "eth2/utils/ssz_derive" } eth2_ssz_types = { path = "eth2/utils/ssz_types" } eth2_hashing = { path = "eth2/utils/eth2_hashing" } +web3 = { git = "https://github.com/tomusdrw/rust-web3" } diff --git a/Makefile b/Makefile index bebf7f826..ecebc5198 100644 --- a/Makefile +++ b/Makefile @@ -58,6 +58,10 @@ lint: make-ef-tests: make -C $(EF_TESTS) +# Verifies that state_processing feature arbitrary-fuzz will compile +arbitrary-fuzz: + cargo check --manifest-path=eth2/state_processing/Cargo.toml --features arbitrary-fuzz + # Performs a `cargo` clean and cleans the `ef_tests` directory. clean: cargo clean diff --git a/eth2/state_processing/Cargo.toml b/eth2/state_processing/Cargo.toml index 6387a59ae..a13e25f12 100644 --- a/eth2/state_processing/Cargo.toml +++ b/eth2/state_processing/Cargo.toml @@ -34,6 +34,16 @@ types = { path = "../types" } rayon = "1.2.0" eth2_hashing = { path = "../utils/eth2_hashing" } int_to_bytes = { path = "../utils/int_to_bytes" } +arbitrary = { version = "0.4.3", features = ["derive"], optional = true } [features] fake_crypto = ["bls/fake_crypto"] +arbitrary-fuzz = [ + "arbitrary", + "types/arbitrary-fuzz", + "bls/arbitrary", + "merkle_proof/arbitrary", + "eth2_ssz/arbitrary", + "eth2_ssz_types/arbitrary", + "tree_hash/arbitrary", +] diff --git a/eth2/state_processing/src/per_block_processing.rs b/eth2/state_processing/src/per_block_processing.rs index a4f2be87e..7d47e80ce 100644 --- a/eth2/state_processing/src/per_block_processing.rs +++ b/eth2/state_processing/src/per_block_processing.rs @@ -33,7 +33,11 @@ mod verify_deposit; mod verify_exit; mod verify_proposer_slashing; +#[cfg(feature = "arbitrary-fuzz")] +use arbitrary::Arbitrary; + /// The strategy to be used when validating the block's signatures. +#[cfg_attr(feature = "arbitrary-fuzz", derive(Arbitrary))] #[derive(PartialEq, Clone, Copy)] pub enum BlockSignatureStrategy { /// Do not validate any signature. Use with caution. @@ -45,6 +49,7 @@ pub enum BlockSignatureStrategy { } /// The strategy to be used when validating the block's signatures. +#[cfg_attr(feature = "arbitrary-fuzz", derive(Arbitrary))] #[derive(PartialEq, Clone, Copy)] pub enum VerifySignatures { /// Validate all signatures encountered. diff --git a/eth2/state_processing/src/per_epoch_processing/validator_statuses.rs b/eth2/state_processing/src/per_epoch_processing/validator_statuses.rs index 269e366ad..9410e823f 100644 --- a/eth2/state_processing/src/per_epoch_processing/validator_statuses.rs +++ b/eth2/state_processing/src/per_epoch_processing/validator_statuses.rs @@ -2,6 +2,9 @@ use crate::common::get_attesting_indices; use safe_arith::SafeArith; use types::*; +#[cfg(feature = "arbitrary-fuzz")] +use arbitrary::Arbitrary; + /// Sets the boolean `var` on `self` to be true if it is true on `other`. Otherwise leaves `self` /// as is. macro_rules! set_self_if_other_is_true { @@ -13,6 +16,7 @@ macro_rules! set_self_if_other_is_true { } /// The information required to reward a block producer for including an attestation in a block. +#[cfg_attr(feature = "arbitrary-fuzz", derive(Arbitrary))] #[derive(Debug, Clone, Copy)] pub struct InclusionInfo { /// The distance between the attestation slot and the slot that attestation was included in a @@ -44,6 +48,7 @@ impl InclusionInfo { } /// Information required to reward some validator during the current and previous epoch. +#[cfg_attr(feature = "arbitrary-fuzz", derive(Arbitrary))] #[derive(Debug, Default, Clone)] pub struct ValidatorStatus { /// True if the validator has been slashed, ever. @@ -108,7 +113,9 @@ impl ValidatorStatus { /// The total effective balances for different sets of validators during the previous and current /// epochs. + #[derive(Clone, Debug)] +#[cfg_attr(feature = "arbitrary-fuzz", derive(Arbitrary))] pub struct TotalBalances { /// The effective balance increment from the spec. effective_balance_increment: u64, @@ -165,6 +172,7 @@ impl TotalBalances { /// Summarised information about validator participation in the _previous and _current_ epochs of /// some `BeaconState`. +#[cfg_attr(feature = "arbitrary-fuzz", derive(Arbitrary))] #[derive(Debug, Clone)] pub struct ValidatorStatuses { /// Information about each individual validator from the state's validator registry. diff --git a/eth2/types/Cargo.toml b/eth2/types/Cargo.toml index 48c98a67f..31db5cfd8 100644 --- a/eth2/types/Cargo.toml +++ b/eth2/types/Cargo.toml @@ -15,7 +15,7 @@ compare_fields_derive = { path = "../utils/compare_fields_derive" } dirs = "2.0.2" derivative = "1.0.3" eth2_interop_keypairs = { path = "../utils/eth2_interop_keypairs" } -ethereum-types = "0.8.0" +ethereum-types = "0.9.1" eth2_hashing = "0.1.0" hex = "0.3" int_to_bytes = { path = "../utils/int_to_bytes" } @@ -38,8 +38,21 @@ rand_xorshift = "0.2.0" cached_tree_hash = { path = "../utils/cached_tree_hash" } serde_yaml = "0.8.11" tempfile = "3.1.0" +arbitrary = { version = "0.4", features = ["derive"], optional = true } [dev-dependencies] env_logger = "0.7.1" serde_json = "1.0.41" criterion = "0.3.0" + +[features] +arbitrary-fuzz = [ + "arbitrary", + "ethereum-types/arbitrary", + "bls/arbitrary", + "eth2_ssz/arbitrary", + "eth2_ssz_types/arbitrary", + "merkle_proof/arbitrary", + "swap_or_not_shuffle/arbitrary", + "tree_hash/arbitrary", +] diff --git a/eth2/types/src/aggregate_and_proof.rs b/eth2/types/src/aggregate_and_proof.rs index f5376c06e..2cf1d2a51 100644 --- a/eth2/types/src/aggregate_and_proof.rs +++ b/eth2/types/src/aggregate_and_proof.rs @@ -11,6 +11,7 @@ use tree_hash_derive::TreeHash; /// A Validators aggregate attestation and selection proof. /// /// Spec v0.10.1 +#[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))] #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, Encode, Decode, TestRandom, TreeHash)] #[serde(bound = "T: EthSpec")] pub struct AggregateAndProof { diff --git a/eth2/types/src/attestation.rs b/eth2/types/src/attestation.rs index 34c11f26f..26052cbaa 100644 --- a/eth2/types/src/attestation.rs +++ b/eth2/types/src/attestation.rs @@ -20,6 +20,7 @@ pub enum Error { /// Details an attestation that can be slashable. /// /// Spec v0.11.1 +#[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))] #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom)] #[serde(bound = "T: EthSpec")] pub struct Attestation { diff --git a/eth2/types/src/attestation_data.rs b/eth2/types/src/attestation_data.rs index 15d9920f7..756c24bd1 100644 --- a/eth2/types/src/attestation_data.rs +++ b/eth2/types/src/attestation_data.rs @@ -9,6 +9,7 @@ use tree_hash_derive::TreeHash; /// The data upon which an attestation is based. /// /// Spec v0.11.1 +#[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))] #[derive( Debug, Clone, diff --git a/eth2/types/src/attestation_duty.rs b/eth2/types/src/attestation_duty.rs index d9117fc11..c32e4683e 100644 --- a/eth2/types/src/attestation_duty.rs +++ b/eth2/types/src/attestation_duty.rs @@ -1,6 +1,7 @@ use crate::*; use serde_derive::{Deserialize, Serialize}; +#[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))] #[derive(Debug, PartialEq, Clone, Copy, Default, Serialize, Deserialize)] pub struct AttestationDuty { /// The slot during which the attester must attest. diff --git a/eth2/types/src/attester_slashing.rs b/eth2/types/src/attester_slashing.rs index c5aa6b528..6b0873fe7 100644 --- a/eth2/types/src/attester_slashing.rs +++ b/eth2/types/src/attester_slashing.rs @@ -8,6 +8,7 @@ use tree_hash_derive::TreeHash; /// Two conflicting attestations. /// /// Spec v0.11.1 +#[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))] #[derive(Debug, PartialEq, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom)] #[serde(bound = "T: EthSpec")] pub struct AttesterSlashing { diff --git a/eth2/types/src/beacon_block.rs b/eth2/types/src/beacon_block.rs index e2fed9143..2eee8b8e7 100644 --- a/eth2/types/src/beacon_block.rs +++ b/eth2/types/src/beacon_block.rs @@ -11,6 +11,7 @@ use tree_hash_derive::TreeHash; /// A block of the `BeaconChain`. /// /// Spec v0.11.1 +#[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))] #[derive(Debug, PartialEq, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom)] #[serde(bound = "T: EthSpec")] pub struct BeaconBlock { diff --git a/eth2/types/src/beacon_block_body.rs b/eth2/types/src/beacon_block_body.rs index 643db5eca..d716f7801 100644 --- a/eth2/types/src/beacon_block_body.rs +++ b/eth2/types/src/beacon_block_body.rs @@ -11,6 +11,7 @@ use tree_hash_derive::TreeHash; /// The body of a `BeaconChain` block, containing operations. /// /// Spec v0.11.1 +#[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))] #[derive(Debug, PartialEq, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom)] #[serde(bound = "T: EthSpec")] pub struct BeaconBlockBody { diff --git a/eth2/types/src/beacon_block_header.rs b/eth2/types/src/beacon_block_header.rs index fb2f532b1..2fec8e82b 100644 --- a/eth2/types/src/beacon_block_header.rs +++ b/eth2/types/src/beacon_block_header.rs @@ -10,6 +10,7 @@ use tree_hash_derive::TreeHash; /// A header of a `BeaconBlock`. /// /// Spec v0.11.1 +#[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))] #[derive(Debug, PartialEq, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom)] pub struct BeaconBlockHeader { pub slot: Slot, diff --git a/eth2/types/src/beacon_committee.rs b/eth2/types/src/beacon_committee.rs index e237499ff..6483c009a 100644 --- a/eth2/types/src/beacon_committee.rs +++ b/eth2/types/src/beacon_committee.rs @@ -17,6 +17,7 @@ impl<'a> BeaconCommittee<'a> { } } +#[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))] #[derive(Default, Clone, Debug, PartialEq)] pub struct OwnedBeaconCommittee { pub slot: Slot, diff --git a/eth2/types/src/beacon_state.rs b/eth2/types/src/beacon_state.rs index 4f980a019..603dbc22d 100644 --- a/eth2/types/src/beacon_state.rs +++ b/eth2/types/src/beacon_state.rs @@ -2,6 +2,7 @@ use self::committee_cache::get_active_validator_indices; use self::exit_cache::ExitCache; use crate::test_utils::TestRandom; use crate::*; + use cached_tree_hash::{CacheArena, CachedTreeHash}; use compare_fields_derive::CompareFields; use eth2_hashing::hash; @@ -102,6 +103,7 @@ impl AllowNextEpoch { } } +#[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))] #[derive(PartialEq, Eq, Hash, Clone, Copy)] pub struct BeaconStateHash(Hash256); @@ -1155,3 +1157,46 @@ impl From for Error { Error::ArithError(e) } } + +#[cfg(feature = "arbitrary-fuzz")] +impl arbitrary::Arbitrary for BeaconState { + fn arbitrary(u: &mut arbitrary::Unstructured<'_>) -> arbitrary::Result { + Ok(Self { + genesis_time: u64::arbitrary(u)?, + genesis_validators_root: Hash256::arbitrary(u)?, + slot: Slot::arbitrary(u)?, + fork: Fork::arbitrary(u)?, + latest_block_header: BeaconBlockHeader::arbitrary(u)?, + block_roots: >::arbitrary(u)?, + state_roots: >::arbitrary(u)?, + historical_roots: >::arbitrary(u)?, + eth1_data: Eth1Data::arbitrary(u)?, + eth1_data_votes: >::arbitrary(u)?, + eth1_deposit_index: u64::arbitrary(u)?, + validators: >::arbitrary(u)?, + balances: >::arbitrary(u)?, + randao_mixes: >::arbitrary(u)?, + slashings: >::arbitrary(u)?, + previous_epoch_attestations: , + T::MaxPendingAttestations, + >>::arbitrary(u)?, + current_epoch_attestations: , + T::MaxPendingAttestations, + >>::arbitrary(u)?, + justification_bits: >::arbitrary(u)?, + previous_justified_checkpoint: Checkpoint::arbitrary(u)?, + current_justified_checkpoint: Checkpoint::arbitrary(u)?, + finalized_checkpoint: Checkpoint::arbitrary(u)?, + committee_caches: [ + CommitteeCache::arbitrary(u)?, + CommitteeCache::arbitrary(u)?, + CommitteeCache::arbitrary(u)?, + ], + pubkey_cache: PubkeyCache::arbitrary(u)?, + exit_cache: ExitCache::arbitrary(u)?, + tree_hash_cache: None, + }) + } +} diff --git a/eth2/types/src/beacon_state/committee_cache.rs b/eth2/types/src/beacon_state/committee_cache.rs index d5d89d311..02f6ea920 100644 --- a/eth2/types/src/beacon_state/committee_cache.rs +++ b/eth2/types/src/beacon_state/committee_cache.rs @@ -277,3 +277,10 @@ pub fn get_active_validator_indices(validators: &[Validator], epoch: Epoch) -> V active } + +#[cfg(feature = "arbitrary-fuzz")] +impl arbitrary::Arbitrary for CommitteeCache { + fn arbitrary(_u: &mut arbitrary::Unstructured<'_>) -> arbitrary::Result { + Ok(Self::default()) + } +} diff --git a/eth2/types/src/beacon_state/exit_cache.rs b/eth2/types/src/beacon_state/exit_cache.rs index aff05baaf..0fc2e0575 100644 --- a/eth2/types/src/beacon_state/exit_cache.rs +++ b/eth2/types/src/beacon_state/exit_cache.rs @@ -70,3 +70,10 @@ impl ExitCache { Ok(self.exits_per_epoch.get(&epoch).cloned().unwrap_or(0)) } } + +#[cfg(feature = "arbitrary-fuzz")] +impl arbitrary::Arbitrary for ExitCache { + fn arbitrary(_u: &mut arbitrary::Unstructured<'_>) -> arbitrary::Result { + Ok(Self::default()) + } +} diff --git a/eth2/types/src/beacon_state/pubkey_cache.rs b/eth2/types/src/beacon_state/pubkey_cache.rs index a4a38ebc4..6b9f8e838 100644 --- a/eth2/types/src/beacon_state/pubkey_cache.rs +++ b/eth2/types/src/beacon_state/pubkey_cache.rs @@ -39,3 +39,10 @@ impl PubkeyCache { self.map.get(pubkey).copied() } } + +#[cfg(feature = "arbitrary-fuzz")] +impl arbitrary::Arbitrary for PubkeyCache { + fn arbitrary(_u: &mut arbitrary::Unstructured<'_>) -> arbitrary::Result { + Ok(Self::default()) + } +} diff --git a/eth2/types/src/chain_spec.rs b/eth2/types/src/chain_spec.rs index 40cda0463..22c248ce8 100644 --- a/eth2/types/src/chain_spec.rs +++ b/eth2/types/src/chain_spec.rs @@ -26,6 +26,7 @@ pub enum Domain { /// Holds all the "constants" for a BeaconChain. /// /// Spec v0.11.1 +#[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))] #[derive(PartialEq, Debug, Clone, Serialize, Deserialize)] #[serde(default)] pub struct ChainSpec { diff --git a/eth2/types/src/checkpoint.rs b/eth2/types/src/checkpoint.rs index 45321d6ff..c7a06defd 100644 --- a/eth2/types/src/checkpoint.rs +++ b/eth2/types/src/checkpoint.rs @@ -8,6 +8,7 @@ use tree_hash_derive::TreeHash; /// Casper FFG checkpoint, used in attestations. /// /// Spec v0.11.1 +#[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))] #[derive( Debug, Clone, diff --git a/eth2/types/src/deposit.rs b/eth2/types/src/deposit.rs index 5cd848244..9d9880aee 100644 --- a/eth2/types/src/deposit.rs +++ b/eth2/types/src/deposit.rs @@ -1,9 +1,8 @@ use crate::test_utils::TestRandom; use crate::*; -use ssz_types::typenum::U33; - use serde_derive::{Deserialize, Serialize}; use ssz_derive::{Decode, Encode}; +use ssz_types::typenum::U33; use test_random_derive::TestRandom; use tree_hash_derive::TreeHash; @@ -12,6 +11,7 @@ pub const DEPOSIT_TREE_DEPTH: usize = 32; /// A deposit to potentially become a beacon chain validator. /// /// Spec v0.11.1 +#[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))] #[derive(Debug, PartialEq, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom)] pub struct Deposit { pub proof: FixedVector, diff --git a/eth2/types/src/deposit_data.rs b/eth2/types/src/deposit_data.rs index 14019a7b6..fa82c943f 100644 --- a/eth2/types/src/deposit_data.rs +++ b/eth2/types/src/deposit_data.rs @@ -1,7 +1,7 @@ use crate::test_utils::TestRandom; use crate::*; -use bls::{PublicKeyBytes, SignatureBytes}; +use bls::{PublicKeyBytes, SignatureBytes}; use serde_derive::{Deserialize, Serialize}; use ssz_derive::{Decode, Encode}; use test_random_derive::TestRandom; @@ -10,6 +10,7 @@ use tree_hash_derive::TreeHash; /// The data supplied by the user to the deposit contract. /// /// Spec v0.11.1 +#[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))] #[derive(Debug, PartialEq, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom)] pub struct DepositData { pub pubkey: PublicKeyBytes, diff --git a/eth2/types/src/deposit_message.rs b/eth2/types/src/deposit_message.rs index 3ed43122d..2d0d1ef68 100644 --- a/eth2/types/src/deposit_message.rs +++ b/eth2/types/src/deposit_message.rs @@ -1,7 +1,7 @@ use crate::test_utils::TestRandom; use crate::*; -use bls::PublicKeyBytes; +use bls::PublicKeyBytes; use serde_derive::{Deserialize, Serialize}; use ssz_derive::{Decode, Encode}; use test_random_derive::TestRandom; @@ -10,6 +10,7 @@ use tree_hash_derive::TreeHash; /// The data supplied by the user to the deposit contract. /// /// Spec v0.11.1 +#[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))] #[derive(Debug, PartialEq, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom)] pub struct DepositMessage { pub pubkey: PublicKeyBytes, diff --git a/eth2/types/src/enr_fork_id.rs b/eth2/types/src/enr_fork_id.rs index f1c5ac6bf..e10744368 100644 --- a/eth2/types/src/enr_fork_id.rs +++ b/eth2/types/src/enr_fork_id.rs @@ -11,6 +11,7 @@ use tree_hash_derive::TreeHash; /// a nodes local ENR. /// /// Spec v0.11 +#[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))] #[derive( Debug, Clone, PartialEq, Default, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom, )] diff --git a/eth2/types/src/eth1_data.rs b/eth2/types/src/eth1_data.rs index 5ba6870e7..8d8807582 100644 --- a/eth2/types/src/eth1_data.rs +++ b/eth2/types/src/eth1_data.rs @@ -9,6 +9,7 @@ use tree_hash_derive::TreeHash; /// Contains data obtained from the Eth1 chain. /// /// Spec v0.11.1 +#[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))] #[derive( Debug, PartialEq, diff --git a/eth2/types/src/eth_spec.rs b/eth2/types/src/eth_spec.rs index 18ee3e5a9..c3c60bae0 100644 --- a/eth2/types/src/eth_spec.rs +++ b/eth2/types/src/eth_spec.rs @@ -1,4 +1,5 @@ use crate::*; + use safe_arith::SafeArith; use serde_derive::{Deserialize, Serialize}; use ssz_types::typenum::{ @@ -131,6 +132,7 @@ macro_rules! params_from_eth_spec { /// Ethereum Foundation specifications. /// /// Spec v0.11.1 +#[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, PartialEq, Debug, Default, Serialize, Deserialize)] pub struct MainnetEthSpec; @@ -164,6 +166,7 @@ pub type FoundationBeaconState = BeaconState; /// Ethereum Foundation minimal spec, as defined in the eth2.0-specs repo. /// /// Spec v0.11.1 +#[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, PartialEq, Debug, Default, Serialize, Deserialize)] pub struct MinimalEthSpec; @@ -198,6 +201,7 @@ impl EthSpec for MinimalEthSpec { pub type MinimalBeaconState = BeaconState; /// Interop testnet spec +#[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, PartialEq, Debug, Default, Serialize, Deserialize)] pub struct InteropEthSpec; diff --git a/eth2/types/src/fork.rs b/eth2/types/src/fork.rs index 7d9bfb129..90ce75128 100644 --- a/eth2/types/src/fork.rs +++ b/eth2/types/src/fork.rs @@ -10,6 +10,7 @@ use tree_hash_derive::TreeHash; /// Specifies a fork of the `BeaconChain`, to prevent replay attacks. /// /// Spec v0.11.1 +#[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))] #[derive( Debug, Clone, PartialEq, Default, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom, )] diff --git a/eth2/types/src/fork_data.rs b/eth2/types/src/fork_data.rs index ac5848012..7d5215526 100644 --- a/eth2/types/src/fork_data.rs +++ b/eth2/types/src/fork_data.rs @@ -10,6 +10,7 @@ use tree_hash_derive::TreeHash; /// Specifies a fork of the `BeaconChain`, to prevent replay attacks. /// /// Spec v0.11.1 +#[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))] #[derive( Debug, Clone, PartialEq, Default, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom, )] diff --git a/eth2/types/src/free_attestation.rs b/eth2/types/src/free_attestation.rs index 16d4f6728..6215fb0cd 100644 --- a/eth2/types/src/free_attestation.rs +++ b/eth2/types/src/free_attestation.rs @@ -4,6 +4,7 @@ use super::{AttestationData, Signature}; use serde_derive::Serialize; +#[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))] #[derive(Debug, Clone, PartialEq, Serialize)] pub struct FreeAttestation { pub data: AttestationData, diff --git a/eth2/types/src/historical_batch.rs b/eth2/types/src/historical_batch.rs index 9b7e04f55..ae875ee34 100644 --- a/eth2/types/src/historical_batch.rs +++ b/eth2/types/src/historical_batch.rs @@ -10,6 +10,7 @@ use tree_hash_derive::TreeHash; /// Historical block and state roots. /// /// Spec v0.11.1 +#[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))] #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom)] pub struct HistoricalBatch { pub block_roots: FixedVector, diff --git a/eth2/types/src/indexed_attestation.rs b/eth2/types/src/indexed_attestation.rs index c77b6f401..f603354d9 100644 --- a/eth2/types/src/indexed_attestation.rs +++ b/eth2/types/src/indexed_attestation.rs @@ -1,4 +1,5 @@ use crate::{test_utils::TestRandom, AggregateSignature, AttestationData, EthSpec, VariableList}; + use serde_derive::{Deserialize, Serialize}; use ssz_derive::{Decode, Encode}; use test_random_derive::TestRandom; @@ -9,6 +10,7 @@ use tree_hash_derive::TreeHash; /// To be included in an `AttesterSlashing`. /// /// Spec v0.11.1 +#[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))] #[derive(Debug, PartialEq, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom)] #[serde(bound = "T: EthSpec")] pub struct IndexedAttestation { diff --git a/eth2/types/src/pending_attestation.rs b/eth2/types/src/pending_attestation.rs index 9d78d9cd6..455245edd 100644 --- a/eth2/types/src/pending_attestation.rs +++ b/eth2/types/src/pending_attestation.rs @@ -17,6 +17,18 @@ pub struct PendingAttestation { pub proposer_index: u64, } +#[cfg(feature = "arbitrary-fuzz")] +impl arbitrary::Arbitrary for PendingAttestation { + fn arbitrary(u: &mut arbitrary::Unstructured<'_>) -> arbitrary::Result { + Ok(Self { + aggregation_bits: >::arbitrary(u)?, + data: AttestationData::arbitrary(u)?, + inclusion_delay: u64::arbitrary(u)?, + proposer_index: u64::arbitrary(u)?, + }) + } +} + #[cfg(test)] mod tests { use super::*; diff --git a/eth2/types/src/proposer_slashing.rs b/eth2/types/src/proposer_slashing.rs index f82fdd4ae..1febc1d64 100644 --- a/eth2/types/src/proposer_slashing.rs +++ b/eth2/types/src/proposer_slashing.rs @@ -9,6 +9,7 @@ use tree_hash_derive::TreeHash; /// Two conflicting proposals from the same proposer (validator). /// /// Spec v0.11.1 +#[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))] #[derive(Debug, PartialEq, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom)] pub struct ProposerSlashing { pub signed_header_1: SignedBeaconBlockHeader, diff --git a/eth2/types/src/relative_epoch.rs b/eth2/types/src/relative_epoch.rs index f179b0c70..133e7e3c9 100644 --- a/eth2/types/src/relative_epoch.rs +++ b/eth2/types/src/relative_epoch.rs @@ -6,10 +6,14 @@ pub enum Error { EpochTooHigh { base: Epoch, other: Epoch }, } +#[cfg(feature = "arbitrary-fuzz")] +use arbitrary::Arbitrary; + /// Defines the epochs relative to some epoch. Most useful when referring to the committees prior /// to and following some epoch. /// /// Spec v0.11.1 +#[cfg_attr(feature = "arbitrary-fuzz", derive(Arbitrary))] #[derive(Debug, PartialEq, Clone, Copy)] pub enum RelativeEpoch { /// The prior epoch. diff --git a/eth2/types/src/selection_proof.rs b/eth2/types/src/selection_proof.rs index 18c62ba40..df8c330f9 100644 --- a/eth2/types/src/selection_proof.rs +++ b/eth2/types/src/selection_proof.rs @@ -3,6 +3,7 @@ use safe_arith::{ArithError, SafeArith}; use std::convert::TryInto; use tree_hash::TreeHash; +#[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))] #[derive(PartialEq, Debug, Clone)] pub struct SelectionProof(Signature); diff --git a/eth2/types/src/signed_aggregate_and_proof.rs b/eth2/types/src/signed_aggregate_and_proof.rs index 750818167..1d9c58751 100644 --- a/eth2/types/src/signed_aggregate_and_proof.rs +++ b/eth2/types/src/signed_aggregate_and_proof.rs @@ -12,6 +12,7 @@ use tree_hash_derive::TreeHash; /// gossipsub topic. /// /// Spec v0.10.1 +#[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))] #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, Encode, Decode, TestRandom, TreeHash)] #[serde(bound = "T: EthSpec")] pub struct SignedAggregateAndProof { diff --git a/eth2/types/src/signed_beacon_block.rs b/eth2/types/src/signed_beacon_block.rs index 81abc0dfd..733d3e06a 100644 --- a/eth2/types/src/signed_beacon_block.rs +++ b/eth2/types/src/signed_beacon_block.rs @@ -1,13 +1,13 @@ use crate::{test_utils::TestRandom, BeaconBlock, EthSpec, Hash256, Slot}; -use bls::Signature; - use std::fmt; +use bls::Signature; use serde_derive::{Deserialize, Serialize}; use ssz_derive::{Decode, Encode}; use test_random_derive::TestRandom; use tree_hash::TreeHash; +#[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))] #[derive(PartialEq, Eq, Hash, Clone, Copy)] pub struct SignedBeaconBlockHash(Hash256); @@ -38,6 +38,7 @@ impl From for Hash256 { /// A `BeaconBlock` and a signature from its proposer. /// /// Spec v0.11.1 +#[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))] #[derive(Debug, PartialEq, Clone, Serialize, Deserialize, Encode, Decode, TestRandom)] #[serde(bound = "E: EthSpec")] pub struct SignedBeaconBlock { diff --git a/eth2/types/src/signed_beacon_block_header.rs b/eth2/types/src/signed_beacon_block_header.rs index 11627b9ee..b3c6b06bc 100644 --- a/eth2/types/src/signed_beacon_block_header.rs +++ b/eth2/types/src/signed_beacon_block_header.rs @@ -9,6 +9,7 @@ use tree_hash_derive::TreeHash; /// An exit voluntarily submitted a validator who wishes to withdraw. /// /// Spec v0.11.1 +#[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))] #[derive(Debug, PartialEq, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom)] pub struct SignedBeaconBlockHeader { pub message: BeaconBlockHeader, diff --git a/eth2/types/src/signed_voluntary_exit.rs b/eth2/types/src/signed_voluntary_exit.rs index 6507d6796..0bf1550af 100644 --- a/eth2/types/src/signed_voluntary_exit.rs +++ b/eth2/types/src/signed_voluntary_exit.rs @@ -9,6 +9,7 @@ use tree_hash_derive::TreeHash; /// An exit voluntarily submitted a validator who wishes to withdraw. /// /// Spec v0.11.1 +#[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))] #[derive(Debug, PartialEq, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom)] pub struct SignedVoluntaryExit { pub message: VoluntaryExit, diff --git a/eth2/types/src/signing_root.rs b/eth2/types/src/signing_root.rs index f3a96df1f..6d060bf07 100644 --- a/eth2/types/src/signing_root.rs +++ b/eth2/types/src/signing_root.rs @@ -1,11 +1,13 @@ use crate::test_utils::TestRandom; use crate::Hash256; + use serde_derive::{Deserialize, Serialize}; use ssz_derive::{Decode, Encode}; use test_random_derive::TestRandom; use tree_hash::TreeHash; use tree_hash_derive::TreeHash; +#[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))] #[derive(Debug, PartialEq, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom)] pub struct SigningRoot { pub object_root: Hash256, diff --git a/eth2/types/src/slot_epoch.rs b/eth2/types/src/slot_epoch.rs index 7f3b45ce4..86de83258 100644 --- a/eth2/types/src/slot_epoch.rs +++ b/eth2/types/src/slot_epoch.rs @@ -12,6 +12,7 @@ use crate::test_utils::TestRandom; use crate::SignedRoot; + use rand::RngCore; use serde_derive::{Deserialize, Serialize}; use ssz::{ssz_encode, Decode, DecodeError, Encode}; @@ -21,10 +22,12 @@ use std::hash::{Hash, Hasher}; use std::iter::Iterator; use std::ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Rem, Sub, SubAssign}; +#[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))] #[derive(Eq, Clone, Copy, Default, Serialize, Deserialize)] #[serde(transparent)] pub struct Slot(u64); +#[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))] #[derive(Eq, Clone, Copy, Default, Serialize, Deserialize)] pub struct Epoch(u64); diff --git a/eth2/types/src/subnet_id.rs b/eth2/types/src/subnet_id.rs index 6699d6cc0..11e8e1337 100644 --- a/eth2/types/src/subnet_id.rs +++ b/eth2/types/src/subnet_id.rs @@ -2,6 +2,7 @@ use serde_derive::{Deserialize, Serialize}; use std::ops::{Deref, DerefMut}; +#[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] pub struct SubnetId(u64); diff --git a/eth2/types/src/validator.rs b/eth2/types/src/validator.rs index dbdea61ab..726a1d955 100644 --- a/eth2/types/src/validator.rs +++ b/eth2/types/src/validator.rs @@ -9,6 +9,7 @@ use tree_hash_derive::TreeHash; /// Information about a `BeaconChain` validator. /// /// Spec v0.11.1 +#[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))] #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, Encode, Decode, TestRandom, TreeHash)] pub struct Validator { pub pubkey: PublicKeyBytes, diff --git a/eth2/types/src/voluntary_exit.rs b/eth2/types/src/voluntary_exit.rs index 19feca8ee..84586ac15 100644 --- a/eth2/types/src/voluntary_exit.rs +++ b/eth2/types/src/voluntary_exit.rs @@ -11,6 +11,7 @@ use tree_hash_derive::TreeHash; /// An exit voluntarily submitted a validator who wishes to withdraw. /// /// Spec v0.11.1 +#[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))] #[derive(Debug, PartialEq, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom)] pub struct VoluntaryExit { /// Earliest epoch when voluntary exit can be processed. diff --git a/eth2/utils/bls/Cargo.toml b/eth2/utils/bls/Cargo.toml index 25a577834..93df12492 100644 --- a/eth2/utils/bls/Cargo.toml +++ b/eth2/utils/bls/Cargo.toml @@ -15,6 +15,7 @@ serde_hex = { path = "../serde_hex" } eth2_ssz = "0.1.2" eth2_ssz_types = { path = "../ssz_types" } tree_hash = "0.1.0" +arbitrary = { version = "0.4", features = ["derive"], optional = true } [features] fake_crypto = [] diff --git a/eth2/utils/bls/src/aggregate_public_key.rs b/eth2/utils/bls/src/aggregate_public_key.rs index 6389915c4..628ed86d1 100644 --- a/eth2/utils/bls/src/aggregate_public_key.rs +++ b/eth2/utils/bls/src/aggregate_public_key.rs @@ -88,3 +88,12 @@ impl<'de> Deserialize<'de> for AggregatePublicKey { Ok(agg_sig) } } + +#[cfg(feature = "arbitrary")] +impl arbitrary::Arbitrary for AggregatePublicKey { + fn arbitrary(u: &mut arbitrary::Unstructured<'_>) -> arbitrary::Result { + let mut bytes = [0u8; BLS_PUBLIC_KEY_BYTE_SIZE]; + u.fill_buffer(&mut bytes)?; + Self::from_bytes(&bytes).map_err(|_| arbitrary::Error::IncorrectFormat) + } +} diff --git a/eth2/utils/bls/src/aggregate_signature.rs b/eth2/utils/bls/src/aggregate_signature.rs index 8ff6c8bd8..176e61804 100644 --- a/eth2/utils/bls/src/aggregate_signature.rs +++ b/eth2/utils/bls/src/aggregate_signature.rs @@ -179,6 +179,15 @@ impl<'de> Deserialize<'de> for AggregateSignature { } } +#[cfg(feature = "arbitrary")] +impl arbitrary::Arbitrary for AggregateSignature { + fn arbitrary(u: &mut arbitrary::Unstructured<'_>) -> arbitrary::Result { + let mut bytes = [0u8; BLS_AGG_SIG_BYTE_SIZE]; + u.fill_buffer(&mut bytes)?; + Self::from_bytes(&bytes).map_err(|_| arbitrary::Error::IncorrectFormat) + } +} + #[cfg(test)] mod tests { use super::super::{Keypair, Signature}; diff --git a/eth2/utils/bls/src/fake_aggregate_public_key.rs b/eth2/utils/bls/src/fake_aggregate_public_key.rs index fc9b7db5a..cabd6862c 100644 --- a/eth2/utils/bls/src/fake_aggregate_public_key.rs +++ b/eth2/utils/bls/src/fake_aggregate_public_key.rs @@ -119,3 +119,12 @@ impl<'de> Deserialize<'de> for FakeAggregatePublicKey { Ok(pubkey) } } + +#[cfg(feature = "arbitrary")] +impl arbitrary::Arbitrary for FakeAggregatePublicKey { + fn arbitrary(u: &mut arbitrary::Unstructured<'_>) -> arbitrary::Result { + let mut bytes = [0u8; BLS_PUBLIC_KEY_BYTE_SIZE]; + u.fill_buffer(&mut bytes)?; + Self::from_bytes(&bytes).map_err(|_| arbitrary::Error::IncorrectFormat) + } +} diff --git a/eth2/utils/bls/src/fake_aggregate_signature.rs b/eth2/utils/bls/src/fake_aggregate_signature.rs index 401c44878..3744f9579 100644 --- a/eth2/utils/bls/src/fake_aggregate_signature.rs +++ b/eth2/utils/bls/src/fake_aggregate_signature.rs @@ -132,6 +132,15 @@ impl<'de> Deserialize<'de> for FakeAggregateSignature { } } +#[cfg(feature = "arbitrary")] +impl arbitrary::Arbitrary for FakeAggregateSignature { + fn arbitrary(u: &mut arbitrary::Unstructured<'_>) -> arbitrary::Result { + let mut bytes = [0u8; BLS_AGG_SIG_BYTE_SIZE]; + u.fill_buffer(&mut bytes)?; + Self::from_bytes(&bytes).map_err(|_| arbitrary::Error::IncorrectFormat) + } +} + #[cfg(test)] mod tests { use super::super::{Keypair, Signature}; diff --git a/eth2/utils/bls/src/fake_public_key.rs b/eth2/utils/bls/src/fake_public_key.rs index b78145cff..168d94000 100644 --- a/eth2/utils/bls/src/fake_public_key.rs +++ b/eth2/utils/bls/src/fake_public_key.rs @@ -157,6 +157,15 @@ impl Hash for FakePublicKey { } } +#[cfg(feature = "arbitrary")] +impl arbitrary::Arbitrary for FakePublicKey { + fn arbitrary(u: &mut arbitrary::Unstructured<'_>) -> arbitrary::Result { + let mut bytes = [0u8; BLS_PUBLIC_KEY_BYTE_SIZE]; + u.fill_buffer(&mut bytes)?; + Self::from_bytes(&bytes).map_err(|_| arbitrary::Error::IncorrectFormat) + } +} + #[cfg(test)] mod tests { use super::*; diff --git a/eth2/utils/bls/src/fake_signature.rs b/eth2/utils/bls/src/fake_signature.rs index ce4866c8d..df77a3d93 100644 --- a/eth2/utils/bls/src/fake_signature.rs +++ b/eth2/utils/bls/src/fake_signature.rs @@ -114,6 +114,15 @@ impl<'de> Deserialize<'de> for FakeSignature { } } +#[cfg(feature = "arbitrary")] +impl arbitrary::Arbitrary for FakeSignature { + fn arbitrary(u: &mut arbitrary::Unstructured<'_>) -> arbitrary::Result { + let mut bytes = [0u8; BLS_SIG_BYTE_SIZE]; + u.fill_buffer(&mut bytes)?; + Self::from_bytes(&bytes).map_err(|_| arbitrary::Error::IncorrectFormat) + } +} + #[cfg(test)] mod tests { use super::super::Keypair; diff --git a/eth2/utils/bls/src/lib.rs b/eth2/utils/bls/src/lib.rs index 2d6b56a64..e7ed09234 100644 --- a/eth2/utils/bls/src/lib.rs +++ b/eth2/utils/bls/src/lib.rs @@ -16,6 +16,9 @@ pub use crate::signature_bytes::SignatureBytes; pub use milagro_bls::{compress_g2, hash_to_curve_g2}; pub use signature_set::{verify_signature_sets, SignatureSet}; +#[cfg(feature = "arbitrary")] +pub use arbitrary; + #[cfg(feature = "fake_crypto")] mod fake_aggregate_public_key; #[cfg(feature = "fake_crypto")] diff --git a/eth2/utils/bls/src/macros.rs b/eth2/utils/bls/src/macros.rs index 4eddaf27c..a7b1a99ba 100644 --- a/eth2/utils/bls/src/macros.rs +++ b/eth2/utils/bls/src/macros.rs @@ -252,5 +252,14 @@ macro_rules! bytes_struct { Ok(signature) } } + + #[cfg(feature = "arbitrary")] + impl $crate::arbitrary::Arbitrary for $name { + fn arbitrary(u: &mut $crate::arbitrary::Unstructured<'_>) -> $crate::arbitrary::Result { + let mut bytes = [0u8; $byte_size]; + u.fill_buffer(&mut bytes)?; + Self::from_bytes(&bytes).map_err(|_| $crate::arbitrary::Error::IncorrectFormat) + } + } }; } diff --git a/eth2/utils/bls/src/public_key.rs b/eth2/utils/bls/src/public_key.rs index 70ad37f35..1af555ace 100644 --- a/eth2/utils/bls/src/public_key.rs +++ b/eth2/utils/bls/src/public_key.rs @@ -145,6 +145,15 @@ impl Hash for PublicKey { } } +#[cfg(feature = "arbitrary")] +impl arbitrary::Arbitrary for PublicKey { + fn arbitrary(u: &mut arbitrary::Unstructured<'_>) -> arbitrary::Result { + let mut bytes = [0u8; BLS_PUBLIC_KEY_BYTE_SIZE]; + u.fill_buffer(&mut bytes)?; + Self::from_bytes(&bytes).map_err(|_| arbitrary::Error::IncorrectFormat) + } +} + #[cfg(test)] mod tests { use super::*; diff --git a/eth2/utils/bls/src/signature.rs b/eth2/utils/bls/src/signature.rs index 64b877bfb..73de59bf9 100644 --- a/eth2/utils/bls/src/signature.rs +++ b/eth2/utils/bls/src/signature.rs @@ -111,6 +111,15 @@ impl<'de> Deserialize<'de> for Signature { } } +#[cfg(feature = "arbitrary")] +impl arbitrary::Arbitrary for Signature { + fn arbitrary(u: &mut arbitrary::Unstructured<'_>) -> arbitrary::Result { + let mut bytes = [0u8; BLS_SIG_BYTE_SIZE]; + u.fill_buffer(&mut bytes)?; + Self::from_bytes(&bytes).map_err(|_| arbitrary::Error::IncorrectFormat) + } +} + #[cfg(test)] mod tests { use super::super::Keypair; diff --git a/eth2/utils/cached_tree_hash/Cargo.toml b/eth2/utils/cached_tree_hash/Cargo.toml index 252806aaa..5ac4d5e81 100644 --- a/eth2/utils/cached_tree_hash/Cargo.toml +++ b/eth2/utils/cached_tree_hash/Cargo.toml @@ -5,7 +5,7 @@ authors = ["Michael Sproul "] edition = "2018" [dependencies] -ethereum-types = "0.8" +ethereum-types = "0.9" eth2_ssz_types = { path = "../ssz_types" } eth2_hashing = "0.1" eth2_ssz_derive = "0.1.0" @@ -16,3 +16,6 @@ smallvec = "1.2.0" [dev-dependencies] quickcheck = "0.9" quickcheck_macros = "0.8" + +[features] +arbitrary = ["ethereum-types/arbitrary"] diff --git a/eth2/utils/deposit_contract/Cargo.toml b/eth2/utils/deposit_contract/Cargo.toml index 877fa388b..0c3abacf5 100644 --- a/eth2/utils/deposit_contract/Cargo.toml +++ b/eth2/utils/deposit_contract/Cargo.toml @@ -14,4 +14,4 @@ serde_json = "1.0" types = { path = "../../types"} eth2_ssz = { path = "../ssz"} tree_hash = { path = "../tree_hash"} -ethabi = "11.0" +ethabi = "12.0" diff --git a/eth2/utils/merkle_proof/Cargo.toml b/eth2/utils/merkle_proof/Cargo.toml index d4127a53f..e56fab7f3 100644 --- a/eth2/utils/merkle_proof/Cargo.toml +++ b/eth2/utils/merkle_proof/Cargo.toml @@ -5,7 +5,7 @@ authors = ["Michael Sproul "] edition = "2018" [dependencies] -ethereum-types = "0.8.0" +ethereum-types = "0.9" eth2_hashing = "0.1.0" lazy_static = "1.4.0" safe_arith = { path = "../safe_arith" } @@ -13,3 +13,6 @@ safe_arith = { path = "../safe_arith" } [dev-dependencies] quickcheck = "0.9.0" quickcheck_macros = "0.8.0" + +[features] +arbitrary = ["ethereum-types/arbitrary"] diff --git a/eth2/utils/ssz/Cargo.toml b/eth2/utils/ssz/Cargo.toml index 5846099a3..162c91ae1 100644 --- a/eth2/utils/ssz/Cargo.toml +++ b/eth2/utils/ssz/Cargo.toml @@ -13,5 +13,8 @@ name = "ssz" eth2_ssz_derive = "0.1.0" [dependencies] -ethereum-types = "0.8.0" +ethereum-types = "0.9.1" smallvec = "1.2.0" + +[features] +arbitrary = ["ethereum-types/arbitrary"] diff --git a/eth2/utils/ssz_types/Cargo.toml b/eth2/utils/ssz_types/Cargo.toml index d019373e9..eb7ffb483 100644 --- a/eth2/utils/ssz_types/Cargo.toml +++ b/eth2/utils/ssz_types/Cargo.toml @@ -14,6 +14,7 @@ serde_derive = "1.0.102" serde_hex = { path = "../serde_hex" } eth2_ssz = "0.1.2" typenum = "1.11.2" +arbitrary = { version = "0.4", features = ["derive"], optional = true } [dev-dependencies] serde_yaml = "0.8.11" diff --git a/eth2/utils/ssz_types/src/bitfield.rs b/eth2/utils/ssz_types/src/bitfield.rs index 4192a8a4f..1b6dce3ec 100644 --- a/eth2/utils/ssz_types/src/bitfield.rs +++ b/eth2/utils/ssz_types/src/bitfield.rs @@ -617,6 +617,28 @@ impl tree_hash::TreeHash for Bitfield> { } } +#[cfg(feature = "arbitrary")] +impl arbitrary::Arbitrary for Bitfield> { + fn arbitrary(u: &mut arbitrary::Unstructured<'_>) -> arbitrary::Result { + let size = N::to_usize(); + let mut vec: Vec = vec![0u8; size]; + u.fill_buffer(&mut vec)?; + Ok(Self::from_bytes(vec).map_err(|_| arbitrary::Error::IncorrectFormat)?) + } +} + +#[cfg(feature = "arbitrary")] +impl arbitrary::Arbitrary for Bitfield> { + fn arbitrary(u: &mut arbitrary::Unstructured<'_>) -> arbitrary::Result { + let max_size = N::to_usize(); + let rand = usize::arbitrary(u)?; + let size = std::cmp::min(rand, max_size); + let mut vec: Vec = vec![0u8; size]; + u.fill_buffer(&mut vec)?; + Ok(Self::from_bytes(vec).map_err(|_| arbitrary::Error::IncorrectFormat)?) + } +} + #[cfg(test)] mod bitvector { use super::*; diff --git a/eth2/utils/ssz_types/src/fixed_vector.rs b/eth2/utils/ssz_types/src/fixed_vector.rs index dffd2ad75..455bb512d 100644 --- a/eth2/utils/ssz_types/src/fixed_vector.rs +++ b/eth2/utils/ssz_types/src/fixed_vector.rs @@ -266,6 +266,18 @@ where } } +#[cfg(feature = "arbitrary")] +impl arbitrary::Arbitrary for FixedVector { + fn arbitrary(u: &mut arbitrary::Unstructured<'_>) -> arbitrary::Result { + let size = N::to_usize(); + let mut vec: Vec = Vec::with_capacity(size); + for _ in 0..size { + vec.push(::arbitrary(u)?); + } + Ok(Self::new(vec).map_err(|_| arbitrary::Error::IncorrectFormat)?) + } +} + #[cfg(test)] mod test { use super::*; diff --git a/eth2/utils/ssz_types/src/variable_list.rs b/eth2/utils/ssz_types/src/variable_list.rs index c5cb18577..1e3e55935 100644 --- a/eth2/utils/ssz_types/src/variable_list.rs +++ b/eth2/utils/ssz_types/src/variable_list.rs @@ -256,6 +256,20 @@ where } } +#[cfg(feature = "arbitrary")] +impl arbitrary::Arbitrary for VariableList { + fn arbitrary(u: &mut arbitrary::Unstructured<'_>) -> arbitrary::Result { + let max_size = N::to_usize(); + let rand = usize::arbitrary(u)?; + let size = std::cmp::min(rand, max_size); + let mut vec: Vec = Vec::with_capacity(size); + for _ in 0..size { + vec.push(::arbitrary(u)?); + } + Ok(Self::new(vec).map_err(|_| arbitrary::Error::IncorrectFormat)?) + } +} + #[cfg(test)] mod test { use super::*; diff --git a/eth2/utils/swap_or_not_shuffle/Cargo.toml b/eth2/utils/swap_or_not_shuffle/Cargo.toml index ef86d2569..e62496416 100644 --- a/eth2/utils/swap_or_not_shuffle/Cargo.toml +++ b/eth2/utils/swap_or_not_shuffle/Cargo.toml @@ -12,8 +12,10 @@ harness = false criterion = "0.3.0" yaml-rust = "0.4.3" hex = "0.3" -ethereum-types = "0.8.0" [dependencies] eth2_hashing = "0.1.0" -ethereum-types = "0.8.0" +ethereum-types = "0.9.1" + +[features] +arbitrary = ["ethereum-types/arbitrary"] diff --git a/eth2/utils/tree_hash/Cargo.toml b/eth2/utils/tree_hash/Cargo.toml index 7ef54a74c..db207ab4a 100644 --- a/eth2/utils/tree_hash/Cargo.toml +++ b/eth2/utils/tree_hash/Cargo.toml @@ -18,6 +18,9 @@ types = { path = "../../types" } lazy_static = "1.4.0" [dependencies] -ethereum-types = "0.8.0" +ethereum-types = "0.9" eth2_hashing = "0.1.0" smallvec = "1.2.0" + +[features] +arbitrary = ["ethereum-types/arbitrary"] diff --git a/lcli/Cargo.toml b/lcli/Cargo.toml index 61eba90c6..d173cc28e 100644 --- a/lcli/Cargo.toml +++ b/lcli/Cargo.toml @@ -21,7 +21,7 @@ regex = "1.3.1" eth1_test_rig = { path = "../tests/eth1_test_rig" } futures = "0.1.25" environment = { path = "../lighthouse/environment" } -web3 = "0.8.0" +web3 = "0.10.0" eth2_testnet_config = { path = "../eth2/utils/eth2_testnet_config" } dirs = "2.0" genesis = { path = "../beacon_node/genesis" } diff --git a/tests/ef_tests/Cargo.toml b/tests/ef_tests/Cargo.toml index 77aabac04..252cf1f90 100644 --- a/tests/ef_tests/Cargo.toml +++ b/tests/ef_tests/Cargo.toml @@ -12,7 +12,7 @@ fake_crypto = ["bls/fake_crypto"] [dependencies] bls = { path = "../../eth2/utils/bls" } compare_fields = { path = "../../eth2/utils/compare_fields" } -ethereum-types = "0.8.0" +ethereum-types = "0.9" hex = "0.3" rayon = "1.2.0" serde = "1.0.102"