Skip to content

Commit

Permalink
feat: support ejection of fuzzing fixtures (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
buffalojoec authored Oct 18, 2024
1 parent b9015e9 commit a98aba6
Show file tree
Hide file tree
Showing 19 changed files with 1,570 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
toolchain: ${{ env.NIGHTLY_TOOLCHAIN }}
components: clippy
- name: Run clippy
run: cargo +${{ env.NIGHTLY_TOOLCHAIN }} clippy --all --tests -- --deny=warnings
run: cargo +${{ env.NIGHTLY_TOOLCHAIN }} clippy --all --all-features --tests -- --deny=warnings

cargo_build_test:
name: Cargo Build and Test
Expand All @@ -65,4 +65,4 @@ jobs:
cargo build-sbf --manifest-path test-programs/cpi-target/Cargo.toml
cargo build-sbf --manifest-path test-programs/primary/Cargo.toml
- name: Test
run: cargo test
run: cargo test --all-features
182 changes: 182 additions & 0 deletions Cargo.lock

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

10 changes: 8 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[workspace]
members = [
"bencher",
"fuzz/*",
"harness",
"test-programs/cpi-target",
"test-programs/primary",
"test-programs/*",
]
resolver = "2"

Expand All @@ -17,9 +17,15 @@ version = "0.0.4"

[workspace.dependencies]
bincode = "1.3.3"
bs58 = "0.5.1"
mollusk-svm = { path = "harness", version = "0.0.4" }
mollusk-svm-bencher = { path = "bencher", version = "0.0.4" }
mollusk-svm-fuzz-fixture = { path = "fuzz/fixture", version = "0.0.4" }
num-format = "0.4.4"
prost = "0.10"
prost-build = "0.10"
prost-types = "0.10"
serde = "1.0.203"
serde_json = "1.0.117"
solana-bpf-loader-program = "2.0"
solana-compute-budget = "2.0"
Expand Down
21 changes: 21 additions & 0 deletions fuzz/fixture/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[package]
name = "mollusk-svm-fuzz-fixture"
description = "Mollusk-compatible fuzz fixture for SVM programs."
documentation = "https://docs.rs/mollusk-svm-fuzz-fixture"
authors = { workspace = true }
repository = { workspace = true }
license = { workspace = true }
edition = { workspace = true }
version = { workspace = true }

[dependencies]
bs58 = { workspace = true }
prost = { workspace = true }
prost-types = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
solana-compute-budget = { workspace = true }
solana-sdk = { workspace = true }

[build-dependencies]
prost-build = { workspace = true }
21 changes: 21 additions & 0 deletions fuzz/fixture/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
use std::io::Result;

fn main() -> Result<()> {
let proto_base_path = std::path::PathBuf::from("proto");

let protos = &[
proto_base_path.join("compute_budget.proto"),
proto_base_path.join("sysvars.proto"),
proto_base_path.join("invoke.proto"),
];

protos
.iter()
.for_each(|proto| println!("cargo:rerun-if-changed={}", proto.display()));

prost_build::Config::new()
.type_attribute(".", "#[derive(serde::Deserialize, serde::Serialize)]")
.compile_protos(protos, &[proto_base_path])?;

Ok(())
}
Loading

0 comments on commit a98aba6

Please sign in to comment.