Skip to content

Commit

Permalink
Beacon Fuzz testing (paritytech#907)
Browse files Browse the repository at this point in the history
* Improve contracts

* More improvements to contracts

* Fix parachain build in proxy-contracts branch (paritytech#889)

* Upgrade ssz_rs crate. (paritytech#880)

* Upgrade ssz_rs crate.

* Upgrade ssz_rs crate.

---------

Co-authored-by: claravanstaden <Cats 4 life!>

* Bump nixpkgs to use its geth package (paritytech#885)

* Bump nixpkgs to use its geth package

* Use source config in PolkadotListener

* Match field order in struct def

* Move info log to relay creation

* Remove unused channel

* Whitespace

* Add context to errors

* Add logs

* Bump node & pnpm in workflow

* Rename locals

* Remove unused variable

* Add Troubleshooting README section

* Fix up .envrc-example files

* Add note about pure shells

* Update cumulus submodule (paritytech#886)

* Inbound queue benchmarks (paritytech#876)

* Start with inbound channel benchmarks.

* Add method to set execution header storage for benchmark test.

* Working on benchmarks

* Basic working version

* Cleanup

* Removes cleanup.

* Adds some comments for Alistair.

* Adds branch name.

* Makes note

* Test transactions

* Cleaning up beacon client deps.

* Clean up comments.

* Tests cleanup.

* Fixes non-benchmark test runs.

* Cleanup.

* Update fixtures and generates benchmarks.

* Revert relayer logs.

* Cleanup BenchmarkHelper impl and inbound queue dependencies.

* fmt

* Cleanup imports.

* Cleanup imports.

* Touch

* Adds weights in inbound queue pallet.

* Fix tests.

* Update cumulus.

---------

Co-authored-by: claravanstaden <Cats 4 life!>

* Fix parachain build

* Move BalanceOf outside of pallet

* remove benchmark for non existing method

* downgrade cargo.lock to match cumulus

* fix benchmarks

---------

Co-authored-by: Clara van Staden <claravanstaden64@gmail.com>
Co-authored-by: Alistair Singh <alistair.singh7@gmail.com>

* forge install: openzeppelin-contracts

v4.9.2

* sno-472 rebased (paritytech#890)

* Halting & resuming bridge pallets

* Ignore .env

* Remove .env

* Some polish

* Set owner of bridge pallets

* Upgrade ssz_rs crate. (paritytech#880)

* Upgrade ssz_rs crate.

* Upgrade ssz_rs crate.

---------

Co-authored-by: claravanstaden <Cats 4 life!>

* Update cumulus

* Bump nixpkgs to use its geth package (paritytech#885)

* Bump nixpkgs to use its geth package

* Use source config in PolkadotListener

* Match field order in struct def

* Move info log to relay creation

* Remove unused channel

* Whitespace

* Add context to errors

* Add logs

* Bump node & pnpm in workflow

* Rename locals

* Remove unused variable

* Add Troubleshooting README section

* Fix up .envrc-example files

* Add note about pure shells

* Relax RANDAO_COMMIT_DELAY for local setup

* Update cumulus

* Update cumulus submodule (paritytech#886)

* Update cumulus

* Inbound queue benchmarks (paritytech#876)

* Start with inbound channel benchmarks.

* Add method to set execution header storage for benchmark test.

* Working on benchmarks

* Basic working version

* Cleanup

* Removes cleanup.

* Adds some comments for Alistair.

* Adds branch name.

* Makes note

* Test transactions

* Cleaning up beacon client deps.

* Clean up comments.

* Tests cleanup.

* Fixes non-benchmark test runs.

* Cleanup.

* Update fixtures and generates benchmarks.

* Revert relayer logs.

* Cleanup BenchmarkHelper impl and inbound queue dependencies.

* fmt

* Cleanup imports.

* Cleanup imports.

* Touch

* Adds weights in inbound queue pallet.

* Fix tests.

* Update cumulus.

---------

Co-authored-by: claravanstaden <Cats 4 life!>

* Fix test

* Fix parachain build

* Move BalanceOf outside of pallet

* remove benchmark for non existing method

* downgrade cargo.lock to match cumulus

* fix benchmarks

* Clara/sno 552 (paritytech#887)

* Spacing

* Spacing

* Undo typo.

* Minor updates.

* Adds comment about IrrelevantUpdate.

* One more comment.

* Update error name.

---------

Co-authored-by: claravanstaden <Cats 4 life!>

* Halting & resuming bridge pallets (paritytech#883)

* Halting & resuming bridge pallets

* Ignore .env

* Remove .env

* Some polish

* Set owner of bridge pallets

* Update cumulus

* Relax RANDAO_COMMIT_DELAY for local setup

* Update cumulus

* Update cumulus

* Fix test

* Fix Warnings

* Fix test

* Fix build & format

* Fix benchmark test

* Check for duplicate versions of substrate and polkadot (paritytech#891)

* modified pre-commit

* fixes

* testing

* testing

* testing

* fixed tests

* Format

* Some fix

* Update cumulus

* Update cumulus

---------

Co-authored-by: Clara van Staden <claravanstaden64@gmail.com>
Co-authored-by: David Dunn <26876072+doubledup@users.noreply.github.com>
Co-authored-by: Alistair Singh <alistair.singh7@gmail.com>

* Proxy contracts Tests fixes (paritytech#892)

* fixed tests

* warnings and imports

* rustfmt

* updated cumulus

* Revert rustfmt (paritytech#896)

* Revert "rustfmt"

This reverts commit b83cec7929cdcc6ac972a2b1cad3a0e1fde81870.

* reverted xcm-builder

* Create agent (paritytech#895)

* base

* removed location conversion

* completed implementation

* remove xcm-builder

* update cumulus

* update cumulus

* use contains_key

* Fix openzeppelin-contracts submodule

---------

Co-authored-by: David Dunn <26876072+doubledup@users.noreply.github.com>

* improve API for sending tokens

* Messy working version.

* Cleanup.

* More cleanup.

* Rollback unnecessary changes.

* Cleanup whitespace.

* Fix tests.

* Fuzz the submit method.

* Revert rebase oopsies.

* More fuzzing.

* More fuzzing.

* Last extrinsic.

* Remove unnecessary dependency.

* Revert readme.

* Fix tests and feature issues.

* Cleanup types.

* More cleanup.

* Call extrinsics directly. Adds readme.

* Adds CI.

* cd to correct dir

* Update CI.

* Correct nightly param.

* Remove runs.

* Own impl for SyncCommittee.

* Remove rng.
Cleans up workflow.

* Last cleanup.

* Update parachain/pallets/ethereum-beacon-client/fuzz/Cargo.toml

Co-authored-by: David Dunn <26876072+doubledup@users.noreply.github.com>

* Adds cargo-fuzz to init script.

* PR comment changes.

* Update parachain/pallets/ethereum-beacon-client/fuzz/src/impls.rs

Co-authored-by: David Dunn <26876072+doubledup@users.noreply.github.com>

* Update rust-toolchain.toml

Co-authored-by: David Dunn <26876072+doubledup@users.noreply.github.com>

* Update .github/workflows/parachain.yml

Co-authored-by: David Dunn <26876072+doubledup@users.noreply.github.com>

* Less runs for shorter Github actions.

---------

Co-authored-by: Vincent Geddes <vincent.geddes@hey.com>
Co-authored-by: David Dunn <26876072+doubledup@users.noreply.github.com>
Co-authored-by: Alistair Singh <alistair.singh7@gmail.com>
Co-authored-by: Ron <yrong1997@gmail.com>
Co-authored-by: claravanstaden <Cats 4 life!>
  • Loading branch information
5 people committed Aug 11, 2023
1 parent 7e0e166 commit 60a82e0
Show file tree
Hide file tree
Showing 15 changed files with 4,405 additions and 24 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/parachain.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ on:
- "!parachain/LICENSE"
workflow_dispatch:

env:
FUZZ_MAX_LEN: 10000000000
FUZZ_MAX_RUNS: 30000
RUST_NIGHTLY: "2023-05-23"

jobs:
check:
runs-on: snowbridge-runner
Expand Down Expand Up @@ -140,3 +145,43 @@ jobs:
--manifest-path cumulus/Cargo.toml
--release --verbose
--package bridge-hub-rococo-runtime
beacon-fuzz:
needs: test
runs-on: snowbridge-runner
env:
CARGO_INCREMENTAL: 0
RUST_BACKTRACE: 1
RUSTFLAGS: -C debuginfo=1
SKIP_WASM_BUILD: 1
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
- uses: actions/cache@v1
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('parachain/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: install nightly
run: rustup install --profile minimal nightly-$RUST_NIGHTLY
- name: Install cargo-fuzz from crates.io
uses: baptiste0928/cargo-install@v2
with:
crate: cargo-fuzz
version: "^0.11.2"
- name: Fuzz force checkpoint extrinsic
run: >
cd parachain/pallets/ethereum-beacon-client && cargo +nightly-$RUST_NIGHTLY fuzz run fuzz_force_checkpoint --
-max_len=$FUZZ_MAX_LEN -runs=$FUZZ_MAX_RUNS
- name: Fuzz submit extrinsic
run: >
cd parachain/pallets/ethereum-beacon-client && cargo +nightly-$RUST_NIGHTLY fuzz run fuzz_submit --
-max_len=$FUZZ_MAX_LEN -runs=$FUZZ_MAX_RUNS
- name: Fuzz submit execution header extrinsic
run: >
cd parachain/pallets/ethereum-beacon-client && cargo +nightly-$RUST_NIGHTLY fuzz run fuzz_submit_execution_header --
-max_len=$FUZZ_MAX_LEN -runs=$FUZZ_MAX_RUNS
40 changes: 20 additions & 20 deletions parachain/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 13 additions & 2 deletions parachain/pallets/ethereum-beacon-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ targets = ["x86_64-unknown-linux-gnu"]

[dependencies]
serde = { version = "1.0.164", optional = true }
serde_json = { version = "1.0.96", optional = true }
codec = { version = "3.1.5", package = "parity-scale-codec", default-features = false, features = [ "derive" ] }
scale-info = { version = "2.7.0", default-features = false, features = [ "derive" ] }
ssz_rs = { version="0.9.0", default-features = false }
Expand All @@ -32,17 +33,27 @@ snowbridge-ethereum = { path = "../../primitives/ethereum", default-features = f
primitives = { package = "snowbridge-beacon-primitives", path = "../../primitives/beacon", default-features = false }
static_assertions = { version = "1.1.0" }
bp-runtime = { git = "https://github.com/Snowfork/cumulus.git", branch = "snowbridge", default-features = false }
pallet-timestamp = { git = "https://github.com/paritytech/substrate.git", branch = "master", optional = true }
sp-io = { git = "https://github.com/paritytech/substrate.git", branch = "master", optional = true }

[dev-dependencies]
rand = "0.8.5"
sp-keyring = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sp-io = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
serde_json = "1.0.96"
hex-literal = { version = "0.4.1" }
hex-literal = "0.4.1"
pallet-timestamp = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sp-io = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
serde = "1.0.164"

[features]
default = ["std"]
fuzzing = [
"sp-io",
"pallet-timestamp",
"serde",
"serde_json",
"hex-literal"
]
std = [
"serde",
"codec/std",
Expand Down
5 changes: 5 additions & 0 deletions parachain/pallets/ethereum-beacon-client/fuzz/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
target
corpus
artifacts
coverage
.idea
Loading

0 comments on commit 60a82e0

Please sign in to comment.