Skip to content

Commit

Permalink
✨ Review updates + minor versions updates
Browse files Browse the repository at this point in the history
  • Loading branch information
lukacan committed Oct 18, 2024
1 parent 06f9a47 commit a9d2303
Show file tree
Hide file tree
Showing 12 changed files with 368 additions and 335 deletions.
329 changes: 179 additions & 150 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ anchor-syn = "0.30.1"
anchor-lang = "0.30.1"
anchor-lang-idl-spec = "0.1.0"

# ARBITRARY
arbitrary = { version = "1.3.0", features = ["derive"] }

# SOLANA
solana-sdk = "1.17.4"
Expand Down
6 changes: 3 additions & 3 deletions crates/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ description = "Trident is Rust based testing framework providing several conveni
trident-client = { path = "../client", version = "0.7.0" }

# MISC
clap = { version = "=4.3.19", features = ["derive"] }
clap = { version = "4", features = ["derive"] }
tokio = { version = "1" }
anyhow = { version = "1.0.45" }
fehler = { version = "1.0.0" }
anyhow = { version = "1" }
fehler = { version = "1" }
termimad = "0.30.0"
11 changes: 8 additions & 3 deletions crates/cli/src/command/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,19 @@ pub async fn init(force: bool) {

if force {
generator.initialize().await?;
show_howto();
} else {
let root_path = Path::new(&root).join(TRIDENT_TOML);
if root_path.exists() {
println!("{SKIP} It looks like Trident is already initialized as the Trident.toml was found in {} directory.",root);
println!(
"{SKIP}: It looks like Trident is already initialized.\n\
Trident.toml was found in {} directory.\n\
In case you want to reinitialize the workspace use --force/-f flag.",
root
);
} else {
generator.initialize().await?;
show_howto();
}
}

show_howto();
}
9 changes: 9 additions & 0 deletions crates/cli/src/howto.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@

## To start fuzzing, follow these steps:

- Install ***Honggfuzz***

```bash
cargo install honggfuzz
```

For supported versions check https://ackee.xyz/trident/docs/latest/getting-started/getting-started/#supported-versions


- Initialize ***Trident*** using

```bash
Expand Down
43 changes: 18 additions & 25 deletions crates/client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@ license-file = "../../LICENSE"
readme = "../../README.md"
description = "The trident_client crate helps you build and deploy an Anchor program to a local cluster and run a test suite against it."

[build-dependencies]
anyhow = { version = "1.0.45", features = ["std"], default-features = false }

[dev-dependencies]
pretty_assertions = "1.1.0"

[dependencies]
# TRIDENT
Expand All @@ -38,27 +33,25 @@ honggfuzz = { version = "0.5.55" }
afl = { version = "0.15.10" }

# ARBITRARY
arbitrary = { version = "1.3.0", features = ["derive"] }
arbitrary = { workspace = true }


# MISC
tokio = "1"
serde_json = "1.0.72"
serde = { version = "1.0.136", default-features = false }
bincode = "1.3.3"
borsh = "0.10.3"
futures = "0.3.18"
fehler = "1.0.0"
thiserror = "1.0.30"
anyhow = { version = "1.0.45" }
cargo_metadata = "0.17.0"
syn = { version = "1.0.109", features = ["visit"] }
quote = "1.0.14"
toml = { version = "0.5.8", features = ["preserve_order"] }
log = "0.4"
proc-macro2 = { version = "1.0.66", default-features = false }
quinn-proto = { version = "0.10.6", features = ["arbitrary"] }
pathdiff = "0.2.1"
indicatif = "0.17.8"
regex = "1.10.3"
convert_case = "0.6.0"
serde_json = "1"
serde = { version = "1", default-features = false }
bincode = "1"
futures = "0.3"
fehler = "1"
thiserror = "1"
anyhow = "1"
cargo_metadata = "0.18"
syn = { version = "2", features = ["visit"] }
quote = "1"
toml = { version = "0.8", features = ["preserve_order"] }
pathdiff = "0.2"
convert_case = "0.6"


[dev-dependencies]
pretty_assertions = "1.1.0"
15 changes: 0 additions & 15 deletions crates/client/build.rs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,7 @@ pub fn generate_source_code(idls: &[Idl]) -> String {
use trident_client::fuzzing::*;

/// Link the relevant Account Context Alias from the program.
/// Aliases are generated by the `AccountsSnapshots` macro and stored in
/// a module named `trident_fuzz_<context_name>_snapshot::<Context_Alias_Name>`.
/// Example: `use hello_world::trident_fuzz_initialize_context_snapshot::InitializeContextAlias;`
/// For more complex programs, you may need to find the appropriate module.
/// Aliases are generated by the `AccountsSnapshots` macro.
#(#all_snapshot_types)*


Expand Down Expand Up @@ -304,13 +301,13 @@ fn get_instruction_ixops(
type IxAccounts = FuzzAccounts;
type IxSnapshot = #ix_snapshot<'info>;

/// The `get_program_id()` function specifies the program ID that the Instruction is associated with.
/// Definition of the program ID that the Instruction is associated with.
fn get_program_id(&self) -> solana_sdk::pubkey::Pubkey {
#module_name::ID
}

/// The `get_data()` function specifies the structure of the Instruction data.
/// You can utilize randomly generated data from the fuzzer using `self.data.arg_name`
/// Definition of the Instruction data.
/// Use randomly generated data from the fuzzer using `self.data.arg_name`
/// or customize the data as needed.
/// For more details, visit: https://ackee.xyz/trident/docs/dev/features/fuzz-instructions/#get-data
fn get_data(
Expand All @@ -324,7 +321,7 @@ fn get_instruction_ixops(
Ok(data)
}

/// The `get_accounts()` function specifies the structure of the accounts required by the Instruction.
/// Definition of of the accounts required by the Instruction.
/// To utilize accounts stored in `FuzzAccounts`, use `fuzz_accounts.account_name.get_or_create_account()`.
/// This method will either create a new account or return an existing one.
/// For more details, see: https://ackee.xyz/trident/docs/dev/features/fuzz-instructions/#get-accounts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ version = "0.1.0"
description = "Created with Trident"
edition = "2021"

# Dependencies specific to Fuzz test
[dependencies]
# ... your dependencies here
arbitrary = "1.3.0"
assert_matches = "1.4.0"
Loading

0 comments on commit a9d2303

Please sign in to comment.