Skip to content

Commit

Permalink
fix: broken fuzz lib (#984)
Browse files Browse the repository at this point in the history
* fix: broken fuzz lib

Prior to this commit, there was no CI check for the fuzz library.

Since it is isolated from the workspace (so it won't be affected by fuzz
specific build configuration), it could be silently broken by a breaking
change.

This commit introduces a fix to `AccountConfig`, and adds the fuzz check
to the link job of the `Makefile`.

* Suggested CI cache fix

Signed-off-by: Filippo Costa <[email protected]>

---------

Signed-off-by: Filippo Costa <[email protected]>
Co-authored-by: Filippo Costa <[email protected]>
  • Loading branch information
vlopes11 and neysofu authored Oct 5, 2023
1 parent c68319a commit 1a73dae
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ jobs:
cache-provider: "buildjet"
shared-key: cargo-check
save-if: ${{ github.ref == 'refs/heads/nightly' }}
workspaces: |
.
fuzz
- name: Run lint
run: |
if ! make lint ; then
Expand Down Expand Up @@ -109,6 +112,9 @@ jobs:
cache-provider: "buildjet"
shared-key: cargo-check
save-if: ${{ github.ref == 'refs/heads/nightly' }}
workspaces: |
.
fuzz
# intentionally no target specifier; see https://github.com/jonhoo/rust-ci-conf/pull/4
- name: cargo hack
run: make check-features
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ lint: ## cargo check and clippy. Skip clippy on guest code since it's not suppo
## fmt first, because it's the cheapest
cargo +nightly fmt --all --check
cargo check --all-targets --all-features
$(MAKE) check-fuzz
CI_SKIP_GUEST_BUILD=1 cargo clippy --all-targets --all-features

lint-fix: ## cargo fmt, fix and clippy. Skip clippy on guest code since it's not supported by risc0
Expand Down
2 changes: 1 addition & 1 deletion fuzz/fuzz_targets/accounts_call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ fuzz_target!(|input: (u16, [u8; 32], Vec<DefaultPrivateKey>)| -> Corpus {
let storage = <C as Spec>::Storage::with_path(tmpdir.path()).unwrap();
let working_set = &mut WorkingSet::new(storage);

let config: AccountConfig = keys.iter().map(|k| k.pub_key()).collect();
let config: AccountConfig<C> = keys.iter().map(|k| k.pub_key()).collect();
let accounts: Accounts<C> = Accounts::default();
accounts.genesis(&config, working_set).unwrap();

Expand Down

0 comments on commit 1a73dae

Please sign in to comment.