-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
314 additions
and
204 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
27 changes: 0 additions & 27 deletions
27
documentation/docs/fuzzing/initialization/fuzzing-initialization-all.md
This file was deleted.
Oops, something went wrong.
21 changes: 0 additions & 21 deletions
21
documentation/docs/fuzzing/initialization/fuzzing-initialization-fuzz-add.md
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
...on/docs/fuzzing/howto/fuzzing-howto-p7.md → ...zing/writing-fuzz-test-extra/arbitrary.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...on/docs/fuzzing/howto/fuzzing-howto-p6.md → ...ting-fuzz-test-extra/custom-data-types.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 4 additions & 2 deletions
6
...on/docs/fuzzing/howto/fuzzing-howto-p5.md → ...-fuzz-test-extra/instruction-sequences.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 4 additions & 2 deletions
6
...on/docs/fuzzing/howto/fuzzing-howto-p4.md → ...ting-fuzz-test-extra/invariants-checks.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Accounts to reuse | ||
|
||
{{ config.site_name }} helps you to generate only a limited amount of pseudo-random accounts and reuse them in the instructions. | ||
|
||
??? note | ||
|
||
**Details:** | ||
|
||
Always generating only random accounts would **in most cases lead to a situation where the fuzzer would be stuck because the accounts would be almost every time rejected by your Anchor program**. Therefore it is necessary to specify, what accounts should be used and also limit the number of newly created accounts to reduce the space complexity. | ||
|
||
|
||
!!! tip | ||
|
||
Go to the `trident-tests/fuzz_tests/<FUZZ_TEST_NAME>/fuzz_instructions.rs` file and complete the pre-generated `FuzzAccounts` structure. It contains all accounts used in your program. You have to determine if the account is a: | ||
|
||
- Signer | ||
- PDA | ||
- Token Account | ||
- Program account | ||
|
||
Then use the corresponding AccountsStorage. | ||
|
||
|
||
```rust | ||
pub struct FuzzAccounts { | ||
signer: AccountsStorage<Keypair>, | ||
some_pda: AccountsStorage<PdaStore>, | ||
token_vault: AccountsStorage<TokenStore>, | ||
mint: AccountsStorage<MintStore>, | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
documentation/docs/fuzzing/writing-fuzz-test/instruction-data.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Instruction data | ||
|
||
{{ config.site_name }} generates random instruction data for you. | ||
|
||
!!! tip | ||
|
||
Currently, it is however required, that you manually assign the random fuzzer data to the instruction data. It is done using the `IxOps` trait and its method `get_data`. | ||
|
||
- Go to the `trident-tests/fuzz_tests/<FUZZ_TEST_NAME>/fuzz_instructions.rs` file and complete the pre-generated `get_data` methods for each instruction. | ||
|
||
```rust | ||
fn get_data( | ||
&self, | ||
_client: &mut impl FuzzClient, | ||
_fuzz_accounts: &mut FuzzAccounts, | ||
) -> Result<Self::IxData, FuzzingError> { | ||
let data = fuzz_example1::instruction::Invest { | ||
amount: self.data.amount, | ||
}; | ||
Ok(data) | ||
} | ||
``` |
25 changes: 25 additions & 0 deletions
25
documentation/docs/fuzzing/writing-fuzz-test/writing-fuzz-test.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Writing Fuzz Test | ||
|
||
!!! tip | ||
|
||
At the current development stage, there are some manual steps required to start the Fuzzing Session. In principle: | ||
|
||
**Prerequisites:** | ||
|
||
- Add dependencies specific to your program to `trident-tests/fuzz_tests/Cargo.toml` (such as anchor-spl etc.). | ||
- Add necessary `use` statements into `trident-tests/fuzz_tests/<FUZZ_TEST_NAME>/accounts_snapshots.rs` to import missing types. | ||
|
||
**Writing Fuzz Tests** | ||
|
||
1. Specify pseudo-random accounts to re-use [Accounts to re-use](./accounts.md). | ||
2. Specify instruction data [Instruction Data](./instruction-data.md). | ||
3. Specify instruction accounts [Instruction Accounts](./instruction-accounts.md). | ||
|
||
!!! note | ||
|
||
For better fuzzing results and experience you can also manually adjust the following: | ||
|
||
1. Define Invariants checks [Invariants Checks](../writing-fuzz-test-extra/invariants-checks.md). | ||
2. Specify instruction sequences[Instruction sequences](../writing-fuzz-test-extra/instruction-sequences.md). | ||
3. Specify custom data types[Custom Data types](../writing-fuzz-test-extra/custom-data-types.md). | ||
4. Well structured data[Arbitrary](../writing-fuzz-test-extra/arbitrary.md). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Docker Image | ||
|
||
TBD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# Installation | ||
|
||
This guide will walk you through the Installation process of Trident. | ||
|
||
!!! important | ||
|
||
**Prerequisite** | ||
|
||
It is expected that you have installed: | ||
|
||
- Rust ([Install Rust](https://www.rust-lang.org/tools/install)) | ||
- Solana CLI ([Install Solana CLI](https://docs.solanalabs.com/cli/install)) | ||
- Anchor Framework ([Install Anchor](https://www.anchor-lang.com/docs/installation)) | ||
|
||
For supported versions check the [Supported Versions](#supported-versions) | ||
|
||
### Install System Dependencies | ||
|
||
Update your package list and install the required packages: | ||
|
||
```bash | ||
sudo apt-get update | ||
sudo apt-get install -y \ | ||
curl \ | ||
git \ | ||
build-essential \ | ||
pkg-config \ | ||
libssl-dev \ | ||
npm \ | ||
vim \ | ||
nano \ | ||
wget \ | ||
binutils-dev \ | ||
libunwind-dev \ | ||
lldb | ||
``` | ||
|
||
### Install Trident and Honggfuzz | ||
|
||
Install them using the following commands: | ||
|
||
|
||
```bash | ||
cargo install trident-cli | ||
cargo install honggfuzz | ||
``` | ||
|
||
### Supported versions | ||
|
||
| {{ config.site_name }} CLI | Anchor | Solana | Rust | Honggfuzz | | ||
|--------------|---------|----------|-----------------------|-----------------------| | ||
| `v0.7.0` | `>=0.29.*`<sup>1</sup> | `^1.17.4` | `nightly` | `0.5.56` | | ||
| `v0.6.0` | `>=0.29.*`<sup>1</sup> | `^1.17` | `nightly` | `0.5.55` | | ||
| `v0.5.0` | `~0.28.*` | `=1.16.6` | - | - | | ||
| `v0.4.0` | `~0.27.*` | `>=1.15` | - | - | | ||
| `v0.3.0` | `~0.25.*` | `>=1.10` | - | - | | ||
| `v0.2.0` | `~0.24.*` | `>=1.9` | - | - | | ||
|
||
1. To use Trident with Anchor 0.29.0, run the following commands from your project's root directory after Trident initialization: | ||
```bash | ||
cargo update [email protected] --precise 0.29.0 | ||
cargo update [email protected] --precise 0.29.0 | ||
``` |
Oops, something went wrong.