From ed40fbf2931d1fc4bf220c99bc94d7fdf178c899 Mon Sep 17 00:00:00 2001 From: ibhatt-jumptrading Date: Wed, 11 Sep 2024 14:44:32 +0000 Subject: [PATCH 1/6] more stuff --- proto_v2/exec_v2.options | 21 +++++++++++++++++++++ proto_v2/exec_v2.proto | 5 ++--- proto_v2/instr_v2.options | 7 ++++++- proto_v2/instr_v2.proto | 10 +++++----- proto_v2/slot_v2.options | 7 +++++++ proto_v2/slot_v2.proto | 2 +- proto_v2/txn_v2.options | 15 +++++++++++++++ proto_v2/txn_v2.proto | 21 ++++++++++++--------- 8 files changed, 69 insertions(+), 19 deletions(-) create mode 100644 proto_v2/exec_v2.options create mode 100644 proto_v2/slot_v2.options create mode 100644 proto_v2/txn_v2.options diff --git a/proto_v2/exec_v2.options b/proto_v2/exec_v2.options new file mode 100644 index 0000000..a2ffc40 --- /dev/null +++ b/proto_v2/exec_v2.options @@ -0,0 +1,21 @@ +exec_v2.proto package:"fd_v2" + +fd_v2.SeedAddress.base max_size:32 fixed_length:true +fd_v2.SeedAddress.seed max_size:32 fixed_length:true +fd_v2.SeedAddress.owner max_size:32 fixed_length:true + +fd_v2.AcctState.address max_size:32 fixed_length:true +fd_v2.AcctState.data type:FT_POINTER +fd_v2.AcctState.owner max_size:32 fixed_length:true + +fd_v2.Feature.feature_id max_size:32 fixed_length:true + +fd_v2.LeaderSchedule.pubkey type:FT_POINTER +fd_v2.LeaderSchedule.idxs type:FT_POINTER + +fd_v2.ExecEnv.acct_states type:FT_POINTER +fd_v2.ExecEnv.features type:FT_POINTER +fd_v2.ExecEnv.slots type:FT_POINTER + +fd_v2.ExecEffects.slot_effects type:FT_POINTER +fd_v2.ExecEffects.acct_states type:FT_POINTER \ No newline at end of file diff --git a/proto_v2/exec_v2.proto b/proto_v2/exec_v2.proto index d73a6ba..8c16b27 100644 --- a/proto_v2/exec_v2.proto +++ b/proto_v2/exec_v2.proto @@ -61,10 +61,9 @@ message RentSchedule { } message StatusCache { - /* Vector of transaction hashes that exist in the status cache. */ + /* Vector of transaction hashes that exist in the status cache. + TODO: fill in the rest of the status cache. */ bytes tx_hashes = 1; - - /* TODO: fill in the rest of the status cache. */ } message ExecEnv { diff --git a/proto_v2/instr_v2.options b/proto_v2/instr_v2.options index 5a51874..3283a1c 100644 --- a/proto_v2/instr_v2.options +++ b/proto_v2/instr_v2.options @@ -1 +1,6 @@ -context.proto include:"../../../nanopb/pb_firedancer.h" +instr_v2.proto include:"../../../nanopb/pb_firedancer.h" + +instr_v2.proto package:"fd_v2" + +fd_v2.InstrEnv.accounts type:FT_POINTER +fd_v2.InstrEnv.data type:FT_POINTER diff --git a/proto_v2/instr_v2.proto b/proto_v2/instr_v2.proto index 9da1b4a..885baf0 100644 --- a/proto_v2/instr_v2.proto +++ b/proto_v2/instr_v2.proto @@ -11,19 +11,19 @@ message InstrAcct { level than the instruction. */ message InstrEnv { /* Index into the set of txn accounts defined by the TxnEnv. */ - uint32 program_id_idx = 1; + uint32 program_id_idx = 1; /* Indexes into the set of txn accounts defined by the TxnEnv. */ - repeated InstrAcct accounts = 2; + bytes accounts = 2; /* The instruction data */ - bytes data = 3; + bytes data = 3; } message InstrEffects { /* Result of the instruction execution */ - int32 result = 1; + int32 result = 1; /* Custom error code if applicable */ - int32 custom_err = 2; + uint32 custom_err = 2; } diff --git a/proto_v2/slot_v2.options b/proto_v2/slot_v2.options new file mode 100644 index 0000000..a6df1a2 --- /dev/null +++ b/proto_v2/slot_v2.options @@ -0,0 +1,7 @@ +slot_v2.proto package:"fd_v2" + +fd_v2.SlotEnv.txns type:FT_POINTER +fd_v2.SlotEnv.vote_accounts type:FT_POINTER +fd_v2.SlotEnv.stake_accounts type:FT_POINTER + +fd_v2.SlotEffects.txn_effects type:FT_POINTER \ No newline at end of file diff --git a/proto_v2/slot_v2.proto b/proto_v2/slot_v2.proto index f996846..55c92d7 100644 --- a/proto_v2/slot_v2.proto +++ b/proto_v2/slot_v2.proto @@ -35,7 +35,7 @@ message SlotEnv { message SlotEffects { /* The resulting state after each transaction in the slot */ - repeated TxnEffects txn_envs = 1; + repeated TxnEffects txn_effects = 1; /* Capitalization for the end of the slot */ uint64 capitalization = 2; diff --git a/proto_v2/txn_v2.options b/proto_v2/txn_v2.options new file mode 100644 index 0000000..de033bb --- /dev/null +++ b/proto_v2/txn_v2.options @@ -0,0 +1,15 @@ +txn_v2.proto package:"fd_v2" + +fd_v2.LUTEntry.account_key max_size:32 fixed_length:true +fd_v2.LUTEntry.writable_indexes type:FT_POINTER +fd_v2.LUTEntry.readonly_indexes type:FT_POINTER + +fd_v2.TxnEnv.account_keys type:FT_POINTER +fd_v2.TxnEnv.instrs type:FT_POINTER +fd_v2.TxnEnv.recent_blockhash type:FT_POINTER +fd_v2.TxnEnv.alut_entries type:FT_POINTER +fd_v2.TxnEnv.message_hash type:FT_POINTER +fd_v2.TxnEnv.signatures type:FT_POINTER + +fd_v2.TxnEffects.instr_effects type:FT_POINTER +fd_v2.TxnEffects.return_data type:FT_POINTER \ No newline at end of file diff --git a/proto_v2/txn_v2.proto b/proto_v2/txn_v2.proto index d0f7c2a..4fc4e79 100644 --- a/proto_v2/txn_v2.proto +++ b/proto_v2/txn_v2.proto @@ -30,40 +30,43 @@ message TxnEnv { /* 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; + repeated InstrEnv instrs = 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; + repeated LUTEntry alut_entries = 6; /* The message hash. */ bytes message_hash = 7; /* The signatures needed in the transaction. */ - repeated bytes signatures = 8; + repeated bytes signatures = 8; + + /* The amount of compute units that the transaction has. */ + uint64 cu_avail = 9; }; message TxnEffects { /* Transaction level error code. */ bool txn_error = 1; + int32 txn_error_code = 2; /* Resulting account states from each instruction execution. */ - repeated InstrEffects instr_effects = 2; + repeated InstrEffects instr_effects = 3; /* Return data from the instruction */ - bytes return_data = 3; + bytes return_data = 4; /* Consumed compute units by the instruction. This value will be used by fuzzers that operate at the transaction granularity. */ - uint64 cus_remain = 4; + uint64 cus_remain = 5; /* Details about the fee. */ - uint64 transaction_fee = 5; - uint64 prioritization_fee = 6; + uint64 transaction_fee = 6; + uint64 prioritization_fee = 7; } From dcb0c2fbc74b9da0d5ec6fef519e7d5a3afd2870 Mon Sep 17 00:00:00 2001 From: ibhatt-jumptrading Date: Wed, 11 Sep 2024 22:53:17 +0000 Subject: [PATCH 2/6] asdf --- proto_v2/exec_v2.proto | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/proto_v2/exec_v2.proto b/proto_v2/exec_v2.proto index 8c16b27..dc2a739 100644 --- a/proto_v2/exec_v2.proto +++ b/proto_v2/exec_v2.proto @@ -3,6 +3,13 @@ package fd.v2; import "slot_v2.proto"; +enum HarnessType { + INSTR = 0; + TXN = 1; + SLOT = 2; + RUNTIME = 3; +} + message SeedAddress { /* The seed address base. (32 bytes) */ bytes base = 1; @@ -67,30 +74,34 @@ message StatusCache { } message ExecEnv { + HarnessType harness_type = 1; + /* Starting account states before harness execution. */ - repeated AcctState acct_states = 1; + repeated AcctState acct_states = 2; /* Feature set for the execution. */ - repeated Feature features = 2; + repeated Feature features = 3; /* Leader schedule for the first epoch. This value is recomputed at the epoch boundary. */ - LeaderSchedule leader_schedule = 3; + LeaderSchedule leader_schedule = 4; /* Slot envs to execute. */ - repeated SlotEnv slots = 4; + repeated SlotEnv slots = 5; /* Status cache of recent transactions. */ - StatusCache status_cache = 5; + StatusCache status_cache = 6; /* 301 most recent blockhashes. */ - bytes block_hash_queue = 6; + bytes block_hash_queue = 7; } message ExecEffects { + HarnessType harness_type = 1; + /* Slot effects. */ - repeated SlotEffects slot_effects = 1; + repeated SlotEffects slot_effects = 2; /* Resulting account states at the end of execution. */ - repeated AcctState acct_states = 2; + repeated AcctState acct_states = 3; } From 79b8ddc9ba5c9ff15511cb9756c9d58dffccfb40 Mon Sep 17 00:00:00 2001 From: Manik Jain Date: Mon, 16 Sep 2024 06:05:19 +0000 Subject: [PATCH 3/6] change instr definition --- proto_v2/instr_v2.proto | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/proto_v2/instr_v2.proto b/proto_v2/instr_v2.proto index 885baf0..efe3589 100644 --- a/proto_v2/instr_v2.proto +++ b/proto_v2/instr_v2.proto @@ -11,13 +11,13 @@ message InstrAcct { level than the instruction. */ message InstrEnv { /* Index into the set of txn accounts defined by the TxnEnv. */ - uint32 program_id_idx = 1; + uint32 program_id_idx = 1; /* Indexes into the set of txn accounts defined by the TxnEnv. */ - bytes accounts = 2; + repeated uint32 accounts = 2; /* The instruction data */ - bytes data = 3; + bytes data = 3; } message InstrEffects { From a953adbb0d0fc5f8f30231a552fee72f4570e42e Mon Sep 17 00:00:00 2001 From: Manik Jain Date: Mon, 16 Sep 2024 08:10:25 +0000 Subject: [PATCH 4/6] take it back now --- proto_v2/instr_v2.proto | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/proto_v2/instr_v2.proto b/proto_v2/instr_v2.proto index efe3589..b76d88c 100644 --- a/proto_v2/instr_v2.proto +++ b/proto_v2/instr_v2.proto @@ -11,18 +11,18 @@ message InstrAcct { level than the instruction. */ message InstrEnv { /* Index into the set of txn accounts defined by the TxnEnv. */ - uint32 program_id_idx = 1; + uint32 program_id_idx = 1; /* Indexes into the set of txn accounts defined by the TxnEnv. */ - repeated uint32 accounts = 2; + bytes accounts = 2; /* The instruction data */ - bytes data = 3; + bytes data = 3; } message InstrEffects { /* Result of the instruction execution */ - int32 result = 1; + int32 result = 1; /* Custom error code if applicable */ uint32 custom_err = 2; From 8462d8e9398d63d5c41c185052fd0336a5b3660e Mon Sep 17 00:00:00 2001 From: Manik Jain Date: Mon, 16 Sep 2024 09:07:17 +0000 Subject: [PATCH 5/6] Add fixture type --- proto_v2/exec_v2.proto | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/proto_v2/exec_v2.proto b/proto_v2/exec_v2.proto index dc2a739..ee131c5 100644 --- a/proto_v2/exec_v2.proto +++ b/proto_v2/exec_v2.proto @@ -105,3 +105,8 @@ message ExecEffects { /* Resulting account states at the end of execution. */ repeated AcctState acct_states = 3; } + +message ExecFixture { + ExecEnv input = 1; + ExecEffects output = 2; +} From 336a4e6b4e7217075995c5efac3213804df4d283 Mon Sep 17 00:00:00 2001 From: Manik Jain Date: Mon, 7 Oct 2024 21:51:30 +0000 Subject: [PATCH 6/6] Remove txn error bool --- proto_v2/txn_v2.proto | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/proto_v2/txn_v2.proto b/proto_v2/txn_v2.proto index 4fc4e79..8d1b4ae 100644 --- a/proto_v2/txn_v2.proto +++ b/proto_v2/txn_v2.proto @@ -53,20 +53,19 @@ message TxnEnv { message TxnEffects { /* Transaction level error code. */ - bool txn_error = 1; - int32 txn_error_code = 2; + int32 txn_error_code = 1; /* Resulting account states from each instruction execution. */ - repeated InstrEffects instr_effects = 3; + repeated InstrEffects instr_effects = 2; /* Return data from the instruction */ - bytes return_data = 4; + bytes return_data = 3; /* Consumed compute units by the instruction. This value will be used by fuzzers that operate at the transaction granularity. */ - uint64 cus_remain = 5; + uint64 cus_remain = 4; /* Details about the fee. */ - uint64 transaction_fee = 6; - uint64 prioritization_fee = 7; + uint64 transaction_fee = 5; + uint64 prioritization_fee = 6; }