Skip to content

Commit a98aba6

Browse files
authored
feat: support ejection of fuzzing fixtures (#32)
1 parent b9015e9 commit a98aba6

File tree

19 files changed

+1570
-7
lines changed

19 files changed

+1570
-7
lines changed

.github/workflows/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
toolchain: ${{ env.NIGHTLY_TOOLCHAIN }}
4242
components: clippy
4343
- name: Run clippy
44-
run: cargo +${{ env.NIGHTLY_TOOLCHAIN }} clippy --all --tests -- --deny=warnings
44+
run: cargo +${{ env.NIGHTLY_TOOLCHAIN }} clippy --all --all-features --tests -- --deny=warnings
4545

4646
cargo_build_test:
4747
name: Cargo Build and Test
@@ -65,4 +65,4 @@ jobs:
6565
cargo build-sbf --manifest-path test-programs/cpi-target/Cargo.toml
6666
cargo build-sbf --manifest-path test-programs/primary/Cargo.toml
6767
- name: Test
68-
run: cargo test
68+
run: cargo test --all-features

Cargo.lock

Lines changed: 182 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
[workspace]
22
members = [
33
"bencher",
4+
"fuzz/*",
45
"harness",
5-
"test-programs/cpi-target",
6-
"test-programs/primary",
6+
"test-programs/*",
77
]
88
resolver = "2"
99

@@ -17,9 +17,15 @@ version = "0.0.4"
1717

1818
[workspace.dependencies]
1919
bincode = "1.3.3"
20+
bs58 = "0.5.1"
2021
mollusk-svm = { path = "harness", version = "0.0.4" }
2122
mollusk-svm-bencher = { path = "bencher", version = "0.0.4" }
23+
mollusk-svm-fuzz-fixture = { path = "fuzz/fixture", version = "0.0.4" }
2224
num-format = "0.4.4"
25+
prost = "0.10"
26+
prost-build = "0.10"
27+
prost-types = "0.10"
28+
serde = "1.0.203"
2329
serde_json = "1.0.117"
2430
solana-bpf-loader-program = "2.0"
2531
solana-compute-budget = "2.0"

fuzz/fixture/Cargo.toml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[package]
2+
name = "mollusk-svm-fuzz-fixture"
3+
description = "Mollusk-compatible fuzz fixture for SVM programs."
4+
documentation = "https://docs.rs/mollusk-svm-fuzz-fixture"
5+
authors = { workspace = true }
6+
repository = { workspace = true }
7+
license = { workspace = true }
8+
edition = { workspace = true }
9+
version = { workspace = true }
10+
11+
[dependencies]
12+
bs58 = { workspace = true }
13+
prost = { workspace = true }
14+
prost-types = { workspace = true }
15+
serde = { workspace = true }
16+
serde_json = { workspace = true }
17+
solana-compute-budget = { workspace = true }
18+
solana-sdk = { workspace = true }
19+
20+
[build-dependencies]
21+
prost-build = { workspace = true }

fuzz/fixture/build.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
use std::io::Result;
2+
3+
fn main() -> Result<()> {
4+
let proto_base_path = std::path::PathBuf::from("proto");
5+
6+
let protos = &[
7+
proto_base_path.join("compute_budget.proto"),
8+
proto_base_path.join("sysvars.proto"),
9+
proto_base_path.join("invoke.proto"),
10+
];
11+
12+
protos
13+
.iter()
14+
.for_each(|proto| println!("cargo:rerun-if-changed={}", proto.display()));
15+
16+
prost_build::Config::new()
17+
.type_attribute(".", "#[derive(serde::Deserialize, serde::Serialize)]")
18+
.compile_protos(protos, &[proto_base_path])?;
19+
20+
Ok(())
21+
}

0 commit comments

Comments
 (0)