@@ -13,50 +13,29 @@ import "stream/block.proto";
13
13
* A request to read a single block.
14
14
*
15
15
* A client system SHALL send this message to request a single block,
16
- * including the block state proof.<br/>
17
- * A client MAY request that the block be sent without verification.
18
- * A compliant Block Node MAY respond to requests that allow unverified
19
- * responses by returning the full requested block before verifying
20
- * the included block proof.<br/>
21
- * A compliant Block Node MAY support _only_ requests that allow unverified
22
- * blocks, but MUST clearly document that limitation, and MUST respond to
23
- * a request that does not allow unverified blocks with the
24
- * `ALLOW_UNVERIFIED_REQUIRED` response code.
16
+ * including the block state proof.
25
17
*/
26
18
message BlockRequest {
27
- /**
28
- * The block number of a block to retrieve.
29
- * <p>
30
- * The requested block MUST exist on the block node.<br/>
31
- * This value MUST NOT be set if `retrieve_latest` is set `true`.<br/>
32
- * This value MUST be set to a valid block number if `retrieve_latest` is
33
- * unset or is set `false`.
34
- */
35
- uint64 block_number = 1 ;
36
-
37
- /**
38
- * A flag to indicate that the requested block may be sent without
39
- * verifying its `BlockProof`.<br/>
40
- * This might be set by a client that expects to perform its own
41
- * verification and wishes lower latency or, potentially, lower cost.
42
- * <p>
43
- * If this value is set, then the responding Block Node MAY respond with a
44
- * block that has not completed verification of its `BlockProof`.<br/>
45
- * If this is _not_ set then the Block Node MUST respond with either a
46
- * fully verified and validated block, or `VERIFIED_BLOCK_UNAVAILABLE` if
47
- * the requested block is not yet verified.<br/>
48
- * The default value is _not set_.
49
- */
50
- bool allow_unverified = 2 ;
19
+ oneof block_specifier {
20
+ /**
21
+ * The block number of a block to retrieve.
22
+ * <p>
23
+ * The requested block MUST exist on the block node.<br/>
24
+ * A request MAY specify `uint64_max` to signal that the last possible
25
+ * block should be returned (which is subtly different from setting
26
+ * `retrieve_latest` instead of setting a `block_number`, though the
27
+ * result will always be the same, in most implementations).
28
+ */
29
+ uint64 block_number = 1 ;
51
30
52
- /**
53
- * A flag to request the latest available block.
54
- * <p>
55
- * This value MAY be set `true` to request the last block available.<br/>
56
- * If this value is set to `true` then `block_number` MUST NOT be set and
57
- * SHALL be ignored.
58
- */
59
- bool retrieve_latest = 3 ;
31
+ /**
32
+ * A flag to request the latest available block.
33
+ * <p>
34
+ * This value SHOULD be set `true`, instead of setting `block_number`
35
+ * if the intent is to request the latest block available.
36
+ */
37
+ bool retrieve_latest = 2 ;
38
+ }
60
39
}
61
40
62
41
/**
@@ -81,21 +60,22 @@ message BlockResponse {
81
60
* This status indicates the server software failed to set a status,
82
61
* and SHALL be considered a software defect.
83
62
*/
84
- READ_BLOCK_UNKNOWN = 0 ;
63
+ UNKNOWN = 0 ;
85
64
86
65
/**
87
- * The requesting client account lacks sufficient HBAR to pay the
88
- * service fee for this request.<br/>
89
- * The client MAY retry the request, but MUST increase the client
90
- * account balance with this block node server before doing so.
66
+ * The request succeeded.<br/>
67
+ * The requested block SHALL be returned in the `block` field.
91
68
*/
92
- READ_BLOCK_INSUFFICIENT_BALANCE = 1 ;
69
+ SUCCESS = 1 ;
93
70
94
71
/**
95
- * The request succeeded.<br/>
96
- * The requested block SHALL be returned in the `block` field.
72
+ * The request cannot be fulfilled.<br/>
73
+ * The client sent a malformed or structurally incorrect request.
74
+ * <p>
75
+ * The client MAY retry the request after correcting the form and
76
+ * structure.
97
77
*/
98
- READ_BLOCK_SUCCESS = 2 ;
78
+ INVALID_REQUEST = 2 ;
99
79
100
80
/**
101
81
* The requested block was not found.<br/>
@@ -104,33 +84,14 @@ message BlockResponse {
104
84
* The client MAY retry the request; if this result is repeated the
105
85
* request SHOULD be directed to a different block node server.
106
86
*/
107
- READ_BLOCK_NOT_FOUND = 3 ;
87
+ NOT_FOUND = 3 ;
108
88
109
89
/**
110
90
* The requested block is not available on this block node server.<br/>
111
91
* The client SHOULD send a `serverStatus` request to determine the
112
92
* lowest and highest block numbers available at this block node server.
113
93
*/
114
- READ_BLOCK_NOT_AVAILABLE = 4 ;
115
-
116
- /**
117
- * The request for a verified block cannot be fulfilled.<br/>
118
- * The client requested a verified block from a block node that does not
119
- * offer verified blocks.
120
- * <p>
121
- * The client MAY retry the request with the `allow_unverified` flag set.
122
- */
123
- ALLOW_UNVERIFIED_REQUIRED = 5 ;
124
-
125
- /**
126
- * The request for a verified block cannot be fulfilled.<br/>
127
- * The client requested a verified block from a block node but the
128
- * requested block is not yet verified.
129
- * <p>
130
- * The client MAY retry the request after a short delay
131
- * (typically 2 seconds or more).
132
- */
133
- VERIFIED_BLOCK_UNAVAILABLE = 6 ;
94
+ NOT_AVAILABLE = 4 ;
134
95
}
135
96
136
97
/**
0 commit comments