-
Notifications
You must be signed in to change notification settings - Fork 2
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
new runtime fuzzer pb defs rough poc draft #19
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
syntax = "proto3"; | ||
package fd.v2; | ||
|
||
import "slot_v2.proto"; | ||
|
||
message AcctState { | ||
/* The account address. (32 bytes) */ | ||
bytes address = 1; | ||
|
||
/* Starting lamport balance */ | ||
uint64 lamports = 2; | ||
|
||
/* Account data is limited to 10 MiB on Solana mainnet as of 2024-Feb. */ | ||
bytes data = 3; | ||
|
||
bool executable = 4; | ||
|
||
/* The rent epoch is deprecated on Solana mainnet as of 2024-Feb. | ||
If ommitted, implies a value of UINT64_MAX. */ | ||
uint64 rent_epoch = 5; | ||
|
||
/* Address of the program that owns this account. (32 bytes) */ | ||
bytes owner = 6; | ||
|
||
/* TODO: do we need seed address? */ | ||
} | ||
|
||
message Feature { | ||
bytes feature_id = 1; /* Feature pubkey */ | ||
uint64 slot = 2; /* Leave as 0 if activated */ | ||
} | ||
|
||
message EpochSchedule { | ||
uint64 slots_per_epoch = 1; | ||
uint64 first_normal_slot = 2; | ||
} | ||
|
||
message EpochEnv { | ||
repeated AcctState acct_states = 1; | ||
repeated Feature features = 2; | ||
repeated SlotEnv slots = 3; | ||
EpochSchedule epoch_schedule = 4; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Leader schedule There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. epoch schedule in acct states |
||
} | ||
|
||
message EpochEffects { | ||
repeated SlotEffects slot_effects = 1; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
instr_v2.proto package:"fd_exec_test" | ||
|
||
fd_exec_test.InstrEnv.accounts type:FT_POINTER | ||
fd_exec_test.InstrEnv.data type:FT_POINTER |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
syntax = "proto3"; | ||
package fd.v2; | ||
|
||
message AcctState { | ||
// TODO: Implement this | ||
bytes addresss = 1; | ||
} | ||
|
||
/* As a note, the accounts and account data fields are populated at a higher | ||
level than the instruction. */ | ||
message InstrEnv { | ||
|
||
/* Index into the set of txn accounts defined by the TxnEnv. */ | ||
uint32 program_id_index = 1; | ||
|
||
/* Indexes into the set of txn accounts defined by the TxnEnv. */ | ||
repeated uint32 accounts = 2; | ||
|
||
/* The instruction data */ | ||
bytes data = 3; | ||
} | ||
|
||
message InstrEffects { | ||
/* Result of the instruction execution */ | ||
int32 result = 1; | ||
|
||
/* Custom error code if applicable */ | ||
int32 custom_err = 2; | ||
|
||
/* Return data from the instruction */ | ||
bytes return_data = 3; | ||
|
||
/* Consumed compute units by the instruction. This value will be used | ||
by fuzzers that operate at the trnasaction granularity. */ | ||
uint64 cus_remain = 4; | ||
|
||
/* Account states after instruction execution in the order as specified by | ||
instruction. These states are then updated at fuzzers that operate at | ||
the transaction, slot, and epoch granularity. */ | ||
repeated AcctState accounts = 5; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remvoe |
||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
syntax = "proto3"; | ||
package fd.v2; | ||
|
||
import "txn_v2.proto"; | ||
|
||
message SlotBank { | ||
int32 todo = 1; | ||
ibhatt-jumptrading marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
message SysvarCache { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove this |
||
int32 todo = 1; | ||
} | ||
|
||
/* The amount that this should be filled out is dependent on if there is | ||
epoch or slot granularity fuzzing */ | ||
message EpochRewardStatus { | ||
ibhatt-jumptrading marked this conversation as resolved.
Show resolved
Hide resolved
|
||
uint32 discriminant = 1; | ||
uint32 todo = 2; /* Rest of the struct should be populated */ | ||
} | ||
|
||
/* High level of what happens in a slot: | ||
1. Update sysvars | ||
2. Distribute partitioned rewards to stake accounts | ||
3. Collect raw txns from the ledger/network. TODO: Figure out if we should | ||
fuzz using the raw txn bytes or the partially parsed TxnEnvs. Perhaps | ||
leave this as a configuration option. For the sake of simplicity as a | ||
PoC, will assume that we pass in the partially parsed TxnEnvs. | ||
ibhatt-jumptrading marked this conversation as resolved.
Show resolved
Hide resolved
|
||
4. TODO: Decide if we want to fuzz the ticks/poh??? Assuming this is not being | ||
done for the sake of simplicity as we are just trying to fuzz the runtime.enum | ||
However, this is possible to do. | ||
ibhatt-jumptrading marked this conversation as resolved.
Show resolved
Hide resolved
|
||
5. Pass in all txns into waves that are generated, or use the pack code path | ||
6. Execute each transaction in the wave. | ||
7. Finalize block: update sysvar(s) update bpf cache, update | ||
bank hash. Collect Rent too. Collect slot fees. | ||
8. As a note: this should also be able to handle fuzzing of the epoch | ||
boundary. | ||
*/ | ||
|
||
message SlotEnv { | ||
ibhatt-jumptrading marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
/* The slot number */ | ||
uint64 slot_number = 1; | ||
uint64 prev_slot = 2; | ||
uint64 block_height = 3; | ||
|
||
EpochRewardStatus reward_status = 4; | ||
|
||
/* TODO: rent. Figure out the best way to represent a rent partition | ||
that works with firedancer and agave. Ideally for a slot fuzzer this | ||
is prepopulated and is recomputed at the epoch level fuzzer. */ | ||
|
||
|
||
bytes stake_accounts = 5; /* for distributions */ | ||
|
||
SlotBank slot_bank = 6; | ||
SysvarCache sysvar_cache = 7; | ||
/* TODO: everything from the slot_bank */ | ||
|
||
} | ||
|
||
message SlotEffects { | ||
/* The resulting state of the accounts after the slot */ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. block valid |
||
repeated AcctState reward_acct_states = 1; | ||
repeated AcctState rent_acct_states = 2; | ||
repeated AcctState sysvar_acct_states = 4; | ||
Comment on lines
+63
to
+65
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. collapse into just a single list of accounts There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. make it clear that these are accounts that have changed |
||
repeated TxnEnv txn_envs = 5; /* Contains all resultant account states */ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. txn effects |
||
uint64 capitalization = 6; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
syntax = "proto3"; | ||
package fd.v2; | ||
|
||
import "instr_v2.proto"; | ||
|
||
/* Message header information. */ | ||
message TxnHeader { | ||
|
||
uint32 num_required_signatures = 1; | ||
uint32 num_readonly_signed_accounts = 2; | ||
uint32 num_readonly_unsigned_accounts = 3; | ||
} | ||
|
||
/* Address Lookup table related metadata. This is used to parse the data from | ||
the lookup table accounts. from the account list. */ | ||
message LUTEntry { | ||
|
||
bytes account_key = 1; | ||
repeated uint32 writable_indexes = 2; | ||
repeated uint32 readonly_indexes = 3; | ||
} | ||
|
||
/* Fees paid during a transaction. */ | ||
message FeeDetails { | ||
|
||
uint64 transaction_fee = 1; | ||
uint64 prioritization_fee = 2; | ||
} | ||
|
||
/* As a note, if the scope of the fuzzer is just an instruction, then all of | ||
the fields in TxnEnv will be set to null except for account_keys and | ||
InstrEnv. TODO: maybe aluts too for instructions. This should all be | ||
prepopulated probably */ | ||
message TxnEnv { | ||
|
||
/* Transaction header. */ | ||
TxnHeader header = 1; | ||
|
||
/* Determines if the transaction is legacy or not. */ | ||
bool is_legacy = 2; | ||
|
||
/* Account keys in order that they are passed into the transaction. The | ||
account data actually comes from higher level fuzzers. */ | ||
|
||
repeated bytes account_keys = 3; | ||
|
||
/* Instruction(s) that the transaction executes. */ | ||
repeated InstrEnv instructions = 4; | ||
|
||
/* Recent blockhash provided in the message. */ | ||
bytes recent_blockhash = 5; | ||
|
||
/* Address table lookups that aren't availble in legacy messages. */ | ||
repeated LUTEntry alut_entires = 6; | ||
|
||
/* The message hash. */ | ||
bytes message_hash = 7; | ||
|
||
/* The signatures needed in the transaction. */ | ||
repeated bytes signatures = 8; | ||
}; | ||
|
||
message TxnEffects { | ||
|
||
/* Whether this transaction was executed */ | ||
bool executed = 1; | ||
ibhatt-jumptrading marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
/* Whether there was a sanitization error */ | ||
bool sanitization_error = 2; | ||
ibhatt-jumptrading marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
/* Resulting account states from each instruction execution */ | ||
repeated InstrEffects instr_effects = 3; | ||
|
||
/* Details about the fee */ | ||
FeeDetails fee_details = 4; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
keep acct states in epoch effects
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bhq