@@ -2,18 +2,21 @@ syntax = "proto3";
2
2
3
3
package sf.near.codec.v1 ;
4
4
5
- message BlockWrapper {
6
- Block block = 1 ;
7
- repeated IndexerShard shards = 2 ;
8
- repeated StateChangeWithCause state_changes = 3 ;
5
+ option go_package = "github.com/streamingfast/sf-near/pb/sf/near/codec/v1;pbcodec" ;
6
+
7
+ message Block {
8
+ string author = 1 ;
9
+ BlockHeader header = 2 ;
10
+ repeated ChunkHeader chunk_headers = 3 ;
11
+ repeated IndexerShard shards = 4 ;
12
+ repeated StateChangeWithCause state_changes = 5 ;
9
13
}
10
14
11
15
message StateChangeWithCause {
12
- StateChangeCause cause = 1 ;
13
- StateChangeValue value = 2 ;
16
+ StateChangeValue value = 1 ;
17
+ StateChangeCause cause = 2 ;
14
18
}
15
19
16
-
17
20
message StateChangeCause {
18
21
oneof cause {
19
22
NotWritableToDisk not_writable_to_disk = 1 ;
@@ -27,18 +30,18 @@ message StateChangeCause {
27
30
ValidatorAccountsUpdate validator_accounts_update = 9 ;
28
31
Migration migration = 10 ;
29
32
}
30
- }
31
33
32
- message NotWritableToDisk {}
33
- message InitialState {}
34
- message TransactionProcessing {CryptoHash tx_hash = 1 ;}
35
- message ActionReceiptProcessingStarted {CryptoHash receipt_hash = 1 ;}
36
- message ActionReceiptGasReward {CryptoHash tx_hash = 1 ;}
37
- message ReceiptProcessing {CryptoHash tx_hash = 1 ;}
38
- message PostponedReceipt {CryptoHash tx_hash = 1 ;}
39
- message UpdatedDelayedReceipts {}
40
- message ValidatorAccountsUpdate {}
41
- message Migration {}
34
+ message NotWritableToDisk {}
35
+ message InitialState {}
36
+ message TransactionProcessing {CryptoHash tx_hash = 1 ;}
37
+ message ActionReceiptProcessingStarted {CryptoHash receipt_hash = 1 ;}
38
+ message ActionReceiptGasReward {CryptoHash tx_hash = 1 ;}
39
+ message ReceiptProcessing {CryptoHash tx_hash = 1 ;}
40
+ message PostponedReceipt {CryptoHash tx_hash = 1 ;}
41
+ message UpdatedDelayedReceipts {}
42
+ message ValidatorAccountsUpdate {}
43
+ message Migration {}
44
+ }
42
45
43
46
message StateChangeValue {
44
47
oneof value {
@@ -51,51 +54,43 @@ message StateChangeValue {
51
54
ContractCodeUpdate contract_code_update = 7 ;
52
55
ContractCodeDeletion contract_deletion = 8 ;
53
56
}
54
- }
55
57
56
- message AccountUpdate {string account_id = 1 ; Account account = 2 ;}
57
- message AccountDeletion {string account_id = 1 ;}
58
- message AccessKeyUpdate {
59
- string account_id = 1 ;
60
- PublicKey public_key = 2 ;
61
- AccessKey access_key = 3 ;
62
- }
63
- message AccessKeyDeletion {
64
- string account_id = 1 ;
65
- PublicKey public_key = 2 ;
66
- }
67
- message DataUpdate {
68
- string account_id = 1 ;
69
- bytes key = 2 ;
70
- bytes value = 3 ;
71
- }
72
- message DataDeletion {
73
- string account_id = 1 ;
74
- bytes key = 2 ;
75
- }
76
- message ContractCodeUpdate {
77
- string account_id = 1 ;
78
- bytes code = 2 ;
79
- }
80
- message ContractCodeDeletion {
81
- string account_id = 1 ;
58
+ message AccountUpdate {string account_id = 1 ; Account account = 2 ;}
59
+ message AccountDeletion {string account_id = 1 ;}
60
+ message AccessKeyUpdate {
61
+ string account_id = 1 ;
62
+ PublicKey public_key = 2 ;
63
+ AccessKey access_key = 3 ;
64
+ }
65
+ message AccessKeyDeletion {
66
+ string account_id = 1 ;
67
+ PublicKey public_key = 2 ;
68
+ }
69
+ message DataUpdate {
70
+ string account_id = 1 ;
71
+ bytes key = 2 ;
72
+ bytes value = 3 ;
73
+ }
74
+ message DataDeletion {
75
+ string account_id = 1 ;
76
+ bytes key = 2 ;
77
+ }
78
+ message ContractCodeUpdate {
79
+ string account_id = 1 ;
80
+ bytes code = 2 ;
81
+ }
82
+ message ContractCodeDeletion {
83
+ string account_id = 1 ;
84
+ }
82
85
}
83
86
84
-
85
-
86
87
message Account {
87
88
BigInt amount = 1 ;
88
89
BigInt locked = 2 ;
89
90
CryptoHash code_hash = 3 ;
90
91
uint64 storage_usage = 4 ;
91
92
}
92
93
93
- message Block {
94
- string author = 1 ;
95
- BlockHeader header = 2 ;
96
- repeated ChunkHeader chunks = 3 ;
97
- }
98
-
99
94
message BlockHeader {
100
95
uint64 height = 1 ;
101
96
uint64 prev_height = 2 ;
@@ -117,17 +112,18 @@ message BlockHeader {
117
112
repeated bool chunk_mask = 18 ;
118
113
BigInt gas_price = 19 ;
119
114
uint64 block_ordinal = 20 ;
120
- BigInt validator_reward = 21 ;
121
- BigInt total_supply = 22 ;
122
- repeated SlashedValidator challenges_result = 23 ;
115
+ BigInt total_supply = 21 ;
116
+ repeated SlashedValidator challenges_result = 22 ;
117
+ uint64 last_final_block_height = 23 ;
123
118
CryptoHash last_final_block = 24 ;
124
- CryptoHash last_ds_final_block = 25 ;
125
- CryptoHash next_bp_hash = 26 ;
126
- CryptoHash block_merkle_root = 27 ;
127
- bytes epoch_sync_data_hash = 28 ;
128
- repeated Signature approvals = 29 ;
129
- Signature signature = 30 ;
130
- uint32 latest_protocol_version = 31 ;
119
+ uint64 last_ds_final_block_height = 25 ;
120
+ CryptoHash last_ds_final_block = 26 ;
121
+ CryptoHash next_bp_hash = 27 ;
122
+ CryptoHash block_merkle_root = 28 ;
123
+ bytes epoch_sync_data_hash = 29 ;
124
+ repeated Signature approvals = 30 ;
125
+ Signature signature = 31 ;
126
+ uint32 latest_protocol_version = 32 ;
131
127
}
132
128
133
129
message BigInt {
@@ -137,17 +133,19 @@ message CryptoHash {
137
133
bytes bytes = 1 ;
138
134
}
139
135
140
- enum SignatureType {
136
+ enum CurveKind {
141
137
ED25519 = 0 ;
142
138
SECP256K1 = 1 ;
143
139
}
144
140
145
141
message Signature {
146
- SignatureType type = 1 ;
142
+ CurveKind type = 1 ;
147
143
bytes bytes = 2 ;
148
144
}
145
+
149
146
message PublicKey {
150
- bytes bytes = 1 ;
147
+ CurveKind type = 1 ;
148
+ bytes bytes = 2 ;
151
149
}
152
150
153
151
message ValidatorStake {
@@ -179,19 +177,16 @@ message ChunkHeader {
179
177
bytes tx_root = 15 ;
180
178
repeated ValidatorStake validator_proposals = 16 ;
181
179
Signature signature = 17 ;
182
-
183
180
}
184
181
185
182
message IndexerShard {
186
183
uint64 shard_id = 1 ;
187
- // Chunk is a real nullable field
188
184
IndexerChunk chunk = 2 ;
189
185
repeated IndexerExecutionOutcomeWithReceipt receipt_execution_outcomes = 3 ;
190
-
191
186
}
192
187
193
188
message IndexerExecutionOutcomeWithReceipt {
194
- ExecutionOutcomeWithIdView execution_outcome = 1 ;
189
+ ExecutionOutcomeWithId execution_outcome = 1 ;
195
190
Receipt receipt = 2 ;
196
191
}
197
192
@@ -200,7 +195,6 @@ message IndexerChunk {
200
195
ChunkHeader header = 2 ;
201
196
repeated IndexerTransactionWithOutcome transactions = 3 ;
202
197
repeated Receipt receipts = 4 ;
203
-
204
198
}
205
199
206
200
message IndexerTransactionWithOutcome {
@@ -219,7 +213,7 @@ message SignedTransaction {
219
213
}
220
214
221
215
message IndexerExecutionOutcomeWithOptionalReceipt {
222
- ExecutionOutcomeWithIdView execution_outcome = 1 ;
216
+ ExecutionOutcomeWithId execution_outcome = 1 ;
223
217
Receipt receipt = 2 ;
224
218
}
225
219
@@ -253,7 +247,7 @@ message DataReceiver {
253
247
string receiver_id = 2 ;
254
248
}
255
249
256
- message ExecutionOutcomeWithIdView {
250
+ message ExecutionOutcomeWithId {
257
251
MerklePath proof = 1 ;
258
252
CryptoHash block_hash = 2 ;
259
253
CryptoHash id = 3 ;
@@ -272,10 +266,15 @@ message ExecutionOutcome {
272
266
SuccessValueExecutionStatus success_value = 22 ;
273
267
SuccessReceiptIdExecutionStatus success_receipt_id = 23 ;
274
268
}
269
+ ExecutionMetadata metadata = 6 ;
270
+ }
271
+
272
+ enum ExecutionMetadata {
273
+ ExecutionMetadataV1 = 0 ;
275
274
}
276
275
277
276
message SuccessValueExecutionStatus {
278
- string value = 1 ;
277
+ bytes value = 1 ;
279
278
}
280
279
281
280
message SuccessReceiptIdExecutionStatus {
@@ -305,8 +304,8 @@ message ActionError {
305
304
TriesToUnstakeErrorKind tries_to_unstake = 30 ;
306
305
TriesToStakeErrorKind tries_to_stake = 31 ;
307
306
InsufficientStakeErrorKind insufficient_stake = 32 ;
308
- FunctionCallErrorKind function_call = 33 ; //todo: uncompleted
309
- NewReceiptValidationErrorKind new_receipt_validation = 34 ; //todo: uncompleted
307
+ FunctionCallErrorKind function_call = 33 ;
308
+ NewReceiptValidationErrorKind new_receipt_validation = 34 ;
310
309
OnlyImplicitAccountCreationAllowedErrorKind only_implicit_account_creation_allowed = 35 ;
311
310
DeleteAccountWithLargeStateErrorKind delete_account_with_large_state = 36 ;
312
311
}
@@ -372,18 +371,45 @@ message InsufficientStakeErrorKind{
372
371
BigInt stake = 2 ;
373
372
BigInt minimum_stake = 3 ;
374
373
}
375
- message FunctionCallErrorKind {} //todo: incomplete
376
- message NewReceiptValidationErrorKind {} //todo: incomplete
374
+
375
+ message FunctionCallErrorKind {
376
+ FunctionCallErrorSer error = 1 ;
377
+ }
378
+
379
+ enum FunctionCallErrorSer { //todo: add more detail?
380
+ CompilationError = 0 ;
381
+ LinkError = 1 ;
382
+ MethodResolveError = 2 ;
383
+ WasmTrap = 3 ;
384
+ WasmUnknownError = 4 ;
385
+ HostError = 5 ;
386
+ _EVMError = 6 ;
387
+ ExecutionError = 7 ;
388
+ }
389
+
390
+ message NewReceiptValidationErrorKind {
391
+ ReceiptValidationError error = 1 ;
392
+ }
393
+
394
+ enum ReceiptValidationError { //todo: add more detail?
395
+ InvalidPredecessorId = 0 ;
396
+ InvalidReceiverAccountId = 1 ;
397
+ InvalidSignerAccountId = 2 ;
398
+ InvalidDataReceiverId = 3 ;
399
+ ReturnedValueLengthExceeded = 4 ;
400
+ NumberInputDataDependenciesExceeded = 5 ;
401
+ ActionsValidationError = 6 ;
402
+ }
377
403
378
404
message OnlyImplicitAccountCreationAllowedErrorKind {
379
405
string account_id = 1 ;
380
406
}
407
+
381
408
message DeleteAccountWithLargeStateErrorKind {
382
409
string account_id = 1 ;
383
410
}
384
411
385
-
386
- enum InvalidTxError {//todo: half baked
412
+ enum InvalidTxError { //todo: add more detail?
387
413
InvalidAccessKeyError = 0 ;
388
414
InvalidSignerId = 1 ;
389
415
SignerDoesNotExist = 2 ;
@@ -400,10 +426,10 @@ enum InvalidTxError {//todo: half baked
400
426
TransactionSizeExceeded = 13 ;
401
427
}
402
428
403
-
404
429
message MerklePath {
405
430
repeated MerklePathItem path = 1 ;
406
431
}
432
+
407
433
message MerklePathItem {
408
434
CryptoHash hash = 1 ;
409
435
Direction direction = 2 ;
@@ -414,7 +440,6 @@ enum Direction {
414
440
right = 1 ;
415
441
}
416
442
417
-
418
443
message Action {
419
444
oneof action {
420
445
CreateAccountAction create_account = 1 ;
@@ -432,12 +457,12 @@ message CreateAccountAction {
432
457
}
433
458
434
459
message DeployContractAction {
435
- string code = 1 ;
460
+ bytes code = 1 ;
436
461
}
437
462
438
463
message FunctionCallAction {
439
464
string method_name = 1 ;
440
- string args = 2 ;
465
+ bytes args = 2 ;
441
466
uint64 gas = 3 ;
442
467
BigInt deposit = 4 ;
443
468
}
@@ -477,7 +502,6 @@ message AccessKeyPermission {
477
502
}
478
503
479
504
message FunctionCallPermission {
480
- // Allowance is a real nullable field
481
505
BigInt allowance = 1 ;
482
506
string receiver_id = 2 ;
483
507
repeated string method_names = 3 ;
0 commit comments