Skip to content

Commit bb028b3

Browse files
Nana-ECjsync-swirlds
authored andcommitted
Add API response codes
Signed-off-by: Nana Essilfie-Conduah <nana@swirldslabs.com>
1 parent 90baa7a commit bb028b3

File tree

1 file changed

+49
-61
lines changed

1 file changed

+49
-61
lines changed

HIP/hip-1081.md

Lines changed: 49 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -69,16 +69,6 @@ over HTTP. In the future it may be valuable to explore and add additional protoc
6969
graphQL) based on community needs.
7070

7171

72-
<aside>
73-
🚨 **Open Task:** Flesh out design decisions approach
74-
</aside>
75-
76-
<aside>
77-
🚨 **Open Task:** Add diagram showing BN system location in overall Hedera architecture
78-
Highlight CN(s) -> BN -> MN + block stream clients
79-
</aside>
80-
81-
8272
### Upgradeability
8373

8474
It is a goal of a block node to be easy to run by users across different, languages, platform and cloud hosting
@@ -332,14 +322,13 @@ sequenceDiagram
332322

333323
Additional response codes and their details are noted below
334324

335-
| Response code | Description |
336-
| --------------------- | ------------- |
337-
| STREAM_END_UNKNOWN | This status indicates the server software failed to set a status, and SHALL be considered
338-
a software defect. |
339-
340-
<aside>
341-
🚨 **Open Task:** Add all known response codes
342-
</aside>
325+
| Response code | Description |
326+
| ------------------------- | ------------- |
327+
| STREAM_END_UNKNOWN | The server software failed to set a status, and SHALL be considered a software defect. |
328+
| STREAM_END_RESET | The Publisher reached a reset point. |
329+
| STREAM_END_TIMEOUT | The delay between items was too long. |
330+
| STREAM_END_ERROR | The publisher encountered an error. |
331+
| STREAM_END_TOO_FAR_BEHIND | The block node is too far behind to catch up directly. |
343332

344333
> When the producer is a consensus node it is important to expose error cases that suggest a blocks node is falling
345334
behind or failing to store blocks when expected.
@@ -386,14 +375,15 @@ An overview of communication between a Block Node and a subscriber is as follows
386375

387376
Additional response codes and their details are noted below
388377

389-
| Response code | Description |
390-
| --------------------- | ------------- |
391-
| READ_STREAM_UNKNOWN | This status indicates the server software failed to set a status and SHALL be considered a
392-
software defect. |
378+
| Response code | Description |
379+
| ----------------------------------------- | ------------- |
380+
| READ_STREAM_UNKNOWN | The server software failed to set a status and SHALL be considered a software defect. |
381+
| READ_STREAM_INSUFFICIENT_BALANCE | The requesting client account lacks sufficient HBAR to pay the service fee for this request. |
382+
| READ_STREAM_SUCCESS | The request succeeded. |
383+
| READ_STREAM_INVALID_START_BLOCK_NUMBER | The requested start block number is not valid. |
384+
| READ_STREAM_INVALID_END_BLOCK_NUMBER | The requested end block number is not valid. |
385+
| READ_STREAM_NOT_AVAILABLE | The requested stream is not available. |
393386

394-
<aside>
395-
🚨 **Open Task:** Add all known response codes
396-
</aside>
397387

398388
#### Block Service
399389

@@ -416,9 +406,16 @@ service BlockAccessService {
416406
> Note: A stream of state changes highlighting the changes in a given block may be obtained by utilizing block item
417407
filtering on the block service.
418408

419-
<aside>
420-
🚨 **Open Task:** Add all known response codes for API
421-
</aside>
409+
| Response code | Description |
410+
| --------------------------------- | ------------- |
411+
| READ_BLOCK_UNKNOWN | The server software failed to set a status,and SHALL be considered a software defect. |
412+
| READ_BLOCK_INSUFFICIENT_BALANCE | The requesting client account lacks sufficient HBAR to pay the service fee for this request. |
413+
| READ_BLOCK_SUCCESS | The request succeeded. |
414+
| READ_BLOCK_NOT_FOUND | The requested block was not found. |
415+
| READ_BLOCK_NOT_AVAILABLE | The requested block is not available on this block node server. |
416+
| ALLOW_UNVERIFIED_REQUIRED | The request for a verified block cannot be fulfilled because the block node does not offer verified blocks. |
417+
| VERIFIED_BLOCK_UNAVAILABLE | The request for a verified block cannot be fulfilled because the block node has yet to verify the block. |
418+
422419

423420
#### State Service
424421

@@ -438,16 +435,18 @@ service StateService {
438435
```
439436

440437
<aside>
441-
🚨 **Open Task:** Flesh out 3 different state related query endpoints
438+
🚨 **Open Task:** Flesh out 2 different state related query endpoints
442439
1. State snapshot - covering latest state and historical state. All cases represent verified state at the end of a
443440
block.
444441
2. Single entity state query e.g. return account 0.0.x
445442
- Add new endpoint to proto
446443
</aside>
447444

448-
<aside>
449-
🚨 **Open Task:** Add all known response codes for API
450-
</aside>
445+
| Response code | Description |
446+
| ------------------------------------- | ------------- |
447+
| STATE_SNAPSHOT_UNKNOWN | The server software failed to set a status,and SHALL be considered a software defect. |
448+
| STATE_SNAPSHOT_INSUFFICIENT_BALANCE | The requesting client account lacks sufficient HBAR to pay the service fee for this request. |
449+
| STATE_SNAPSHOT_SUCCESS | The request succeeded. |
451450

452451
#### Reconnect Service
453452

@@ -459,12 +458,6 @@ Hashgraph state management.
459458
As such the block node will replace the teaching role of a consensus node today and serve as a reliable teacher to any
460459
consensus node or block node coming online and looking for latest network details.
461460

462-
<aside>
463-
🚨 **Open Task:** Expand
464-
1. Speak to the need and value of BN provided reconnect vs CN
465-
2. Highlight BN -> BN reconnect
466-
3. Note details of what reconnect will provide i.e. latest state + x
467-
</aside>
468461

469462
#### Proof Service
470463

@@ -474,32 +467,11 @@ and could not offer state proof for historical state.
474467
By maintaining live state, historical state snapshots, and streaming block stream information a block node can finally
475468
fill this gap and provide users with a variety of proofs, including state proofs.
476469

477-
<aside>
478-
🚨 **Open Task:** Flesh out response components
479-
Noting the 3 different proof types
480-
1. Block Proof
481-
2. Block Item Proof
482-
3. State Proof
483-
</aside>
484470

485471
### Discovery
486472

487473
To ensure a robust decentralized network it is important for block nodes to be easily discovered by clients.
488474

489-
<aside>
490-
🚨 **Open Task:** Explain how block nodes provide discovery details.
491-
Considerations
492-
- Are they self reported?
493-
- Are they onchain?
494-
- What requirements if any are there for a block node and operator?
495-
</aside>
496-
497-
<aside>
498-
🚨 **Open Task:** Explain how block nodes are discovered
499-
- by a client so they can query data
500-
- by a CN so they can push data e.g. by address book
501-
</aside>
502-
503475

504476
### Monetization
505477

@@ -611,8 +583,18 @@ A running block node that requires a state snapshot for some reason should retri
611583
🚨 **Open Task:** Summarize initial claims and initial reasons to not support
612584
</aside>
613585

614-
## Open Issues/Ideas
615-
586+
## Open Issues/Ideas/Tasks
587+
- [ ] Flesh out design decisions approach in `Rationale` section
588+
- [ ] Add diagram showing BN system location in overall Hedera architecture in `Rationale` section
589+
- Highlight CN(s) -> BN -> MN + block stream clients
590+
- [ ] Flesh out PRoof Service response components, Noting the 3 different proof types
591+
- Block Proof
592+
- Block Item Proof
593+
- State Proof
594+
- [ ] Expand Reconnect Service
595+
- Speak to the need and value of BN provided reconnect vs CN
596+
- Highlight BN -> BN reconnect
597+
- Note details of what reconnect will provide i.e. latest state + x
616598
- [ ] Q: “As a block node operator I should be able to attach custom plugins to the block node, which can utilize its
617599
functionality.” How should this intent be highlighted in specification. Are the detail more implementation and future
618600
expansions that should be captured in separate HIPs and product EPICs?
@@ -624,11 +606,17 @@ nodes here? Previously the CN output state every 15 mins
624606
- Pause in stream due to CN upgrades - Confirm and improve explanation
625607
- Pauses in stream due to no Block Proof - Confirm and improve explanation
626608
- [ ] Q: How can block nodes provide discovery details?
609+
Considerations
610+
- Are they self reported?
611+
- Are they onchain?
612+
- What requirements if any are there for a block node and operator?
627613
- One idea is "There should be a mechanism that is on chain and self reported (could just be an HCS topic with a
628614
custom fee), but that should not be the only mechanism. Community innovation in this area should be encouraged
629615
(perhaps someone will build a "Block Market" to find and obtain blocks according to a wide variety of criteria,
630616
similar to a wholesale electric power market)."
631617
- [ ] Q: How will block nodes be discovered?
618+
- by a client so they can query data
619+
- by a CN so they can push data e.g. by address book
632620
- One idea that is optional and customizable by CN & BNs is "Client should have many options. Possibilities
633621
include address book entries, block nodes that offer listings of other block nodes (sort of like how some bit
634622
torrent services work), or even "block node rating" services that offer curated lists.

0 commit comments

Comments
 (0)