Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/fuzz dir and tidy #108

Closed
wants to merge 57 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
2d07c26
🎨 added discover into build, added arch into build
Dec 3, 2023
b101852
🎨 added discover into clean, and moved clean command
Dec 3, 2023
d9f6361
🎨 moved discover from fuzz , as we have this implemented already for …
Dec 3, 2023
bd3ed40
🎨 also added functionality for sbf/bpf arch and also correctly check …
Dec 3, 2023
569861f
🎨 added discover into localnet
Dec 3, 2023
1398878
🎨 discover added for test command
Dec 3, 2023
8b1b58b
🎨 one discover for all commands + arch option
Dec 3, 2023
87f23e3
🔥 removed cleaner as this can be handled within the workspace builder
Dec 3, 2023
b95efae
🎨 grouping constants on one place
Dec 3, 2023
bdbb472
🎨 new params from config
Dec 3, 2023
21731a4
🎨 no need for creating commander with root
Dec 3, 2023
1845b86
🎨 added reference
Dec 3, 2023
1066e0f
🎨 added path into idl object
Dec 3, 2023
4d48283
🔥 test generator renamed for workspace builder as I find this name be…
Dec 3, 2023
ab09a5e
🎨 removed stuff that should be inside workspace builder, logic from f…
Dec 3, 2023
c9893f7
🎨 workspace builder now correctly builds project first , then obtain …
Dec 3, 2023
1d62d1a
🎨 changes to tests based on updated implementations
Dec 3, 2023
2063074
🎨 trdelnik toml template with params supported within config
Dec 3, 2023
d54dbf3
🎨 version of trdelnik hardcoded into template , probably not the grea…
Dec 3, 2023
9873ced
🎨 trdelnik version also hardcoded into template for program client
Dec 3, 2023
0b4267d
🎨 escrow lib updated
Dec 3, 2023
942e061
🎨 also updated lib for fuzzer and new trdelnik toml file
Dec 3, 2023
b2ed6e3
🎨 updated lib for turnstile and also cargo in order to have them all …
Dec 3, 2023
ef9cd6c
🎨 forgotten cargo locks
Dec 3, 2023
f42dba6
🎨 bin target inside cargo toml + multiple targets so we can switch be…
Dec 13, 2023
34e34e3
🎨 trdelnik-tests structure split into poc tests and fuzz tests / adde…
Dec 15, 2023
b2de46d
🎨 updated escrow/turnstile/fuzzer based on previous changes , added o…
Dec 15, 2023
b1b5c6e
🐛 updated --with-exit-code option directories discovery so that it wo…
Dec 16, 2023
aab1923
🐛 fixed paths so tests will pass
Dec 16, 2023
9517739
🚨 fixed unused code warnings
Dec 16, 2023
6fc19c5
💡 added some comments
Dec 16, 2023
2fd6bb0
✨ added something like progress bar to cargo +nightly command so we …
Dec 18, 2023
40058ff
🐛 function needed as it at least addds default use statement
Dec 19, 2023
a1343d6
🎨 Grouped poc imports within poctesting module, some deps can be opti…
lukacan Dec 22, 2023
61ddbf2
💚 Fixing pipeline checks
lukacan Dec 22, 2023
8a03ab0
⏪️ Reverted full paths to dependancies because instruction inputs do …
lukacan Dec 25, 2023
0d30ba3
✨ We were not parsing correctly instruction inputs as types imported …
lukacan Dec 25, 2023
2d3c3d3
📈 Progress bar to program client build and order of init/build functions
lukacan Dec 26, 2023
ab74fad
🧑‍💻 Load template function + correct trdelnik build command
lukacan Dec 26, 2023
e83718d
🔥 Removed arch option and some use statements
lukacan Dec 27, 2023
ddc0e3f
🚀 Added macro for path construction, added suppoer for no entrypoin f…
lukacan Dec 27, 2023
624659e
♻️ Regenerated program clients for examples
lukacan Dec 27, 2023
9aace72
👷 Added simple fuzzer run to the pipeline
lukacan Dec 27, 2023
8d0bf34
💚 Added workflow for fuzzer with exit code
lukacan Dec 27, 2023
20f6960
✅ Added fuzz example test
lukacan Dec 30, 2023
e430bee
🐛 fixed some path bugs, changed / debugged new fuzz tests folder stru…
Jan 8, 2024
fd12f5d
✅ update fuzzer for the new structure
Jan 8, 2024
e62d40a
🎨 small updates to tests + comments
Jan 9, 2024
9d4012e
👷 update workflows for fuzz example 0 with new fuzzer
Jan 10, 2024
57623c6
✨ add new fuzzer files
Jan 10, 2024
30f36da
✅ add fuzz example 0
Jan 10, 2024
3c67ed4
✨ new templates
Jan 10, 2024
de40781
✨ integrate new fuzzer
Jan 10, 2024
830aabe
🚨 fmt + clippy
Jan 10, 2024
3ef17e4
👷 update workflow for Fuzz example 2 - for two fuzz tests
Jan 10, 2024
91f40e8
🐛 exclude fuzzing when adding new fuzz test - this is not best option…
Jan 10, 2024
aa8c12d
✅ add new fuzz example 1
Jan 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .github/actions/setup-honggfuzz/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: "Setup Honggfuzz"
description: "Setup Honggfuzz"

runs:
using: "composite"
steps:
- name: Install honggfuzz
run: cargo install honggfuzz
shell: bash
- name: Install binutils-dev
run: sudo apt-get install binutils-dev
shell: bash
- name: Install libunwind-dev
run: sudo apt-get install libunwind-dev
shell: bash
42 changes: 42 additions & 0 deletions .github/workflows/run_fuzz_examples.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
on:
workflow_dispatch:
pull_request:
push:
branches: [master]

name: Test Fuzz Tests

env:
SOLANA_CLI_VERSION: 1.16.6
ANCHOR_VERSION: 0.28.0

jobs:
test_fuzz_example0:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-rust/
- uses: ./.github/actions/setup-solana/
- uses: ./.github/actions/setup-honggfuzz/
id: rust-setup
- uses: Swatinem/rust-cache@v2
name: Cache Rust and it's packages
- name: Test Fuzz Example 0
working-directory: examples/fuzz_example0
run: cargo run --manifest-path ../../Cargo.toml fuzz run -w fuzz_0 && echo "Fuzzer did not find anything" || echo "Fuzzer found an Error"
test_fuzz_example1:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-rust/
- uses: ./.github/actions/setup-solana/
- uses: ./.github/actions/setup-honggfuzz/
id: rust-setup
- uses: Swatinem/rust-cache@v2
name: Cache Rust and it's packages
- name: Test Fuzz Example 1 - Check:1
working-directory: examples/fuzz_example1
run: cargo run --manifest-path ../../Cargo.toml fuzz run -w fuzz_0 && echo "Fuzzer did not find anything" || echo "Fuzzer found an Error"
- name: Test Fuzz Example 1 - Check:2
working-directory: examples/fuzz_example1
run: cargo run --manifest-path ../../Cargo.toml fuzz run -w fuzz_1 && echo "Fuzzer did not find anything" || echo "Fuzzer found an Error"
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches: [master]

name: Test Escrow and Turnstile
name: Test PoC Tests Escrow and Turnstile

env:
SOLANA_CLI_VERSION: 1.16.6
Expand Down
44 changes: 44 additions & 0 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ ed25519-dalek = "1.0.1"
serial_test = "2.0.0"
anyhow = { version = "1.0.45", features = ["std"], default-features = false }
cargo_metadata = "0.17.0"
syn = { version = "1.0.109", features = ["full"] }
syn = { version = "1.0.109", features = ["full","visit"] }
quote = "1.0.14"
heck = { version = "0.4.0", default-features = false }
toml = { version = "0.5.8", features = ["preserve_order"] }
Expand Down
2 changes: 1 addition & 1 deletion crates/cli/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ mod explorer;
pub use explorer::{explorer, ExplorerCommand};

mod init;
pub use init::init;
pub use init::{init, InitCommand};

mod clean;
pub use clean::clean;
22 changes: 14 additions & 8 deletions crates/cli/src/command/build.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
use anyhow::Error;
use crate::discover;
use anyhow::{bail, Error};
use fehler::throws;
use trdelnik_client::*;
use trdelnik_client::__private::WorkspaceBuilder;

pub const TRDELNIK_TOML: &str = "Trdelnik.toml";

#[throws]
pub async fn build(root: String) {
let commander = Commander::with_root(root);
commander.create_program_client_crate().await?;
commander.build_programs().await?;
commander.generate_program_client_deps().await?;
commander.generate_program_client_lib_rs().await?;
pub async fn build(_root: String) {
// FIXME root argument maybe not needed
let root = if let Some(r) = discover(TRDELNIK_TOML)? {
r
} else {
bail!("It does not seem that Trdelnik is initialized because the Trdelnik.toml file was not found in any parent directory!");
};
let mut builder = WorkspaceBuilder::new_with_root(root);
builder.build().await?;
}
16 changes: 12 additions & 4 deletions crates/cli/src/command/clean.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
use anyhow::Error;
use anyhow::{bail, Error};
use fehler::throws;
use trdelnik_client::Cleaner;
use trdelnik_client::__private::WorkspaceBuilder;

use crate::discover;
pub const TRDELNIK_TOML: &str = "Trdelnik.toml";

#[throws]
pub async fn clean() {
let cleaner = Cleaner::new();
cleaner.clean_target().await?;
let root = if let Some(r) = discover(TRDELNIK_TOML)? {
r
} else {
bail!("It does not seem that Trdelnik is initialized because the Trdelnik.toml file was not found in any parent directory!");
};
let builder = WorkspaceBuilder::new_with_root(root);
builder.clean().await?;
}
Loading
Loading