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

🔥 AccountStorage UX #219

Merged
merged 3 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ incremented upon a breaking change and the patch version will be incremented for

## [dev] - Unreleased

**Changed**

- improve manipulations with AccountsStorages in get_accounts() function ([219](https://github.com/Ackee-Blockchain/trident/pull/219))

**Added**

- add/ add support for Clock sysvar manipulations with the client(i.e. warp to slot/epoch and forward in time) ([217](https://github.com/Ackee-Blockchain/trident/pull/217))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ pub fn generate_source_code(idls: &[Idl]) -> String {

#(#all_instructions_ixops_impls)*

/// Use AccountsStorage<T> where T can be one of:
/// Keypair, PdaStore, TokenStore, MintStore, ProgramStore
/// Check supported AccountsStorages at
/// https://ackee.xyz/trident/docs/latest/features/account-storages/
#[derive(Default)]
pub struct FuzzAccounts {
#(#all_fuzz_accounts),*
Expand Down Expand Up @@ -219,7 +219,7 @@ fn get_instruction_inputs(
/// Custom data types must derive `Debug` and `Arbitrary`.
/// To do this, redefine the type in the fuzz test and implement the `From` trait
/// to convert it into the type defined in the program.
/// For more details, see: https://ackee.xyz/trident/docs/dev/features/arbitrary-data/#custom-data-types
/// For more details, see: https://ackee.xyz/trident/docs/latest/features/fuzz-instructions/#custom-data-types
#[derive(Arbitrary, Debug)]
pub struct #instruction_data_name {
#(pub #parameters),*
Expand Down Expand Up @@ -309,7 +309,7 @@ fn get_instruction_ixops(
/// 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
/// For more details, visit: https://ackee.xyz/trident/docs/latest/features/fuzz-instructions/#get-data
fn get_data(
&self,
_client: &mut impl FuzzClient,
Expand All @@ -322,10 +322,11 @@ fn get_instruction_ixops(
}

/// Definition of of the accounts required by the Instruction.
/// To utilize accounts stored in `FuzzAccounts`, use `fuzz_accounts.account_name.get_or_create_account()`.
/// To utilize accounts stored in `FuzzAccounts`, use
/// `fuzz_accounts.account_name.get_or_create_account()`.
/// If no signers are required, leave the vector empty.
/// For AccountMetas use <program>::accounts::<corresponding_metas>
/// For more details, see: https://ackee.xyz/trident/docs/dev/features/fuzz-instructions/#get-accounts
/// For more details, see: https://ackee.xyz/trident/docs/latest/features/fuzz-instructions/#get-accounts
fn get_accounts(
&self,
client: &mut impl FuzzClient,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub fn generate_source_code(idl_instructions: &[Idl]) -> String {
/// Ok(vec![init])
/// }
/// ```
/// For more details, see: https://ackee.xyz/trident/docs/dev/features/instructions-sequences/#instructions-sequences
/// For more details, see: https://ackee.xyz/trident/docs/latest/features/instructions-sequences/#instructions-sequences
impl FuzzDataBuilder<FuzzInstruction> for MyFuzzData {}

/// `fn fuzz_iteration` runs during every fuzzing iteration.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub struct InitializeIxDummy2Accounts {
/// To do this, redefine the type in the fuzz test and implement the `From`
/// trait
/// to convert it into the type defined in the program.
/// For more details, see: https://ackee.xyz/trident/docs/dev/features/arbitrary-data/#custom-data-types
/// For more details, see: https://ackee.xyz/trident/docs/latest/features/fuzz-instructions/#custom-data-types
#[derive(Arbitrary, Debug)]
pub struct InitializeIxDummy2Data {
pub _var1: bool,
Expand Down Expand Up @@ -73,7 +73,7 @@ pub struct InitializeIxDummyExampleAccounts {
/// To do this, redefine the type in the fuzz test and implement the `From`
/// trait
/// to convert it into the type defined in the program.
/// For more details, see: https://ackee.xyz/trident/docs/dev/features/arbitrary-data/#custom-data-types
/// For more details, see: https://ackee.xyz/trident/docs/latest/features/fuzz-instructions/#custom-data-types
#[derive(Arbitrary, Debug)]
pub struct InitializeIxDummyExampleData {
pub _var1: bool,
Expand Down Expand Up @@ -111,7 +111,7 @@ impl<'info> IxOps<'info> for InitializeIxDummy2 {
/// 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
/// For more details, visit: https://ackee.xyz/trident/docs/latest/features/fuzz-instructions/#get-data
fn get_data(
&self,
_client: &mut impl FuzzClient,
Expand Down Expand Up @@ -148,7 +148,7 @@ impl<'info> IxOps<'info> for InitializeIxDummy2 {
/// `fuzz_accounts.account_name.get_or_create_account()`.
/// If no signers are required, leave the vector empty.
/// For AccountMetas use <program>::accounts::<corresponding_metas>
/// For more details, see: https://ackee.xyz/trident/docs/dev/features/fuzz-instructions/#get-accounts
/// For more details, see: https://ackee.xyz/trident/docs/latest/features/fuzz-instructions/#get-accounts
fn get_accounts(
&self,
client: &mut impl FuzzClient,
Expand All @@ -172,7 +172,7 @@ impl<'info> IxOps<'info> for InitializeIxDummyExample {
/// 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
/// For more details, visit: https://ackee.xyz/trident/docs/latest/features/fuzz-instructions/#get-data
fn get_data(
&self,
_client: &mut impl FuzzClient,
Expand Down Expand Up @@ -209,7 +209,7 @@ impl<'info> IxOps<'info> for InitializeIxDummyExample {
/// `fuzz_accounts.account_name.get_or_create_account()`.
/// If no signers are required, leave the vector empty.
/// For AccountMetas use <program>::accounts::<corresponding_metas>
/// For more details, see: https://ackee.xyz/trident/docs/dev/features/fuzz-instructions/#get-accounts
/// For more details, see: https://ackee.xyz/trident/docs/latest/features/fuzz-instructions/#get-accounts
fn get_accounts(
&self,
client: &mut impl FuzzClient,
Expand All @@ -220,8 +220,8 @@ impl<'info> IxOps<'info> for InitializeIxDummyExample {
Ok((signers, acc_meta))
}
}
/// Use AccountsStorage<T> where T can be one of:
/// Keypair, PdaStore, TokenStore, MintStore, ProgramStore
/// Check supported AccountsStorages at
/// https://ackee.xyz/trident/docs/latest/features/account-storages/
#[derive(Default)]
pub struct FuzzAccounts {
signer_dummy_2: AccountsStorage<todo!()>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ struct MyFuzzData;
/// Ok(vec![init])
/// }
/// ```
/// For more details, see: https://ackee.xyz/trident/docs/dev/features/instructions-sequences/#instructions-sequences
/// For more details, see: https://ackee.xyz/trident/docs/latest/features/instructions-sequences/#instructions-sequences
impl FuzzDataBuilder<FuzzInstruction> for MyFuzzData {}
/// `fn fuzz_iteration` runs during every fuzzing iteration.
/// Modification is not required.
Expand Down
Loading
Loading