-
Notifications
You must be signed in to change notification settings - Fork 0
/
codec.proto
147 lines (115 loc) · 3.63 KB
/
codec.proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
syntax = "proto3";
package sf.solana.codec.v1;
option go_package = "github.com/streamingfast/sf-solana/pb/sf/solana/codec/v1;pbcodec";
message Block {
bytes id = 1; // corresponds to the Slot id (or hash)
uint64 number = 2; // corresponds to the Slot number for this block
uint32 version = 3;
bytes previous_id = 4; // corresponds to the previous_blockhash, might skip some slots, so beware
uint64 previous_block = 5;
uint64 genesis_unix_timestamp = 6;
uint64 clock_unix_timestamp = 7;
bytes last_entry_hash = 8;
repeated Transaction transactions = 9;
uint32 transaction_count = 10;
bool has_split_account_changes = 11;
string account_changes_file_ref = 12;
}
message Batch {
repeated Transaction transactions = 1;
}
// Bundled in separate files, referenced by `account_changes_file_ref`
message AccountChangesBundle {
// Maps to the index of the `repeated` field for Block::transactions
repeated AccountChangesPerTrxIndex transactions = 1;
}
message AccountChangesPerTrxIndex {
bytes TrxId = 1;
// Maps to the index within the `repeated` field of the proto for
// Transaction::instructions
repeated AccountChangesPerInstruction instructions = 2;
}
message AccountChangesPerInstruction {
// Data to be put in Instruction::account_changes
repeated AccountChange changes = 1;
}
message Transaction {
// The transaction ID corresponds to the _first_
// signature. Additional signatures are in `additional_signatures`.
bytes id = 1;
// Index from within a single Slot, deterministically ordered to the
// best of our ability using the transaction ID as a sort key for
// the batch of transactions executed in parallel.
uint64 index = 2;
repeated bytes additional_signatures = 3;
MessageHeader header = 4;
// From the original Message object
repeated bytes account_keys = 5;
// From the original Message object
bytes recent_blockhash = 6;
// Instructions, containing both top-level and nested transactions
repeated Instruction instructions = 7;
bool failed = 8;
TransactionError error = 9;
uint64 begin_ordinal = 10;
uint64 end_ordinal = 11;
}
message MessageHeader {
uint32 num_required_signatures = 1;
uint32 num_readonly_signed_accounts = 2;
uint32 num_readonly_unsigned_accounts = 3;
}
/**
- instr1 (id=1, parent=0)
- instr2 (id=2, parent=0) (pubkey1 is writable)
- instr3 (id=3, parent=2) (pubkey1 is writable)
- instr4 (id=4, parent=3) (pubkey1 is writable)
- instr5 (id=5, parent=4) (pubkey1 is writable, mutates pubkey1)
collect delta of pubkey1
collect delta of pubkey1 ONLY IF CHANGED AGAIN, from last time we took a snapshot of it.
collect delta of pubkey1
- instr6 (id=6, parent=0)
*/
message Instruction {
bytes program_id = 3;
repeated bytes account_keys = 4;
bytes data = 5;
// What follows is execution trace data, could be empty for un-executed transactions.
uint32 index = 6;
uint32 parent_index = 7;
uint32 depth = 8;
repeated BalanceChange balance_changes = 9;
repeated AccountChange account_changes = 10;
repeated Log logs = 11;
bool failed = 15;
InstructionError error = 16;
uint64 begin_ordinal = 17;
uint64 end_ordinal = 18;
}
message BalanceChange {
bytes pubkey = 1;
uint64 prev_lamports = 2;
uint64 new_lamports = 3;
}
message AccountChange {
bytes pubkey = 1;
bytes prev_data = 2;
bytes new_data = 3;
uint64 new_data_length = 4;
}
message Log {
string message = 1;
uint64 ordinal = 2;
}
message TransactionError {
string error = 2;
}
message TransactionInstructionError {
string error = 2;
}
message InstructionError {
string error = 2;
}
message InstructionErrorCustom {
string error = 2;
}