Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix plural usage #18

Merged
merged 1 commit into from
Jul 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/api/chainHead.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ This beginner guide shows how to use the `chainHead` functions in order to know

8. You are strongly encouraged to maintain [a `Set`](https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Global_Objects/Set) of the blocks where the runtime changes. Whenever a `{"event": "newBlock"}` notification is received with `subscription` equal to your `followSubcriptionId`, and `newRuntime` is non-null, store the provided `blockHash` in this set.

9. Whenever a `{"event": "finalized"}` notification is received with `subscription` equal to your `followSubcriptionId`, call `chainHead_unstable_unpin` once with your current `finalizedBlockHash`, once for each `prunedBlocksHashes`, and once for each value in `finalizedBlocksHashes` except for the last one. The last value in `finalizedBlocksHashes` becomes your new `finalizedBlockHash`. If one or more entries of `finalizedBlockHashes` is found in your `Set` (see step 7), remove them from the set and jump to step 3 as the metadata has likely been modified. Otherwise, jump to step 7.
9. Whenever a `{"event": "finalized"}` notification is received with `subscription` equal to your `followSubcriptionId`, call `chainHead_unstable_unpin` once with your current `finalizedBlockHash`, once for each `prunedBlockHashes`, and once for each value in `finalizedBlockHashes` except for the last one. The last value in `finalizedBlockHashes` becomes your new `finalizedBlockHash`. If one or more entries of `finalizedBlockHashes` is found in your `Set` (see step 7), remove them from the set and jump to step 3 as the metadata has likely been modified. Otherwise, jump to step 7.

Note that these steps are a bit complicated. Any serious user of the JSON-RPC interface is expected to implement high-level wrappers around the various JSON-RPC functions.

Expand Down
12 changes: 6 additions & 6 deletions src/api/chainHead_unstable_follow.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,11 @@ The `bestBlockChanged` event indicates that the given block is now considered to
```json
{
"event": "finalized",
"finalizedBlocksHashes": [
"finalizedBlockHashes": [
"0x0000000000000000000000000000000000000000000000000000000000000000",
"0x0000000000000000000000000000000000000000000000000000000000000000"
],
"prunedBlocksHashes": [
"prunedBlockHashes": [
"0x0000000000000000000000000000000000000000000000000000000000000000",
"0x0000000000000000000000000000000000000000000000000000000000000000"
]
Expand All @@ -121,13 +121,13 @@ The `bestBlockChanged` event indicates that the given block is now considered to

The `finalized` event indicates that some of the blocks that have earlier been reported with `newBlock` events are now either finalized or no longer relevant.

`finalizedBlocksHashes` contains a list of blocks that are now part of the finalized block, ordered by increasing block number. The last element in this list is the current finalized block.
`finalizedBlockHashes` contains a list of blocks that are now part of the finalized block, ordered by increasing block number. The last element in this list is the current finalized block.

`prunedBlocksHashes` contains, in no particular order, a list of blocks that are not descendants of the latest finalized block. These blocks will never be finalized and can be discarded.
`prunedBlockHashes` contains, in no particular order, a list of blocks that are not descendants of the latest finalized block. These blocks will never be finalized and can be discarded.

All items in `finalizedBlocksHashes` and `prunedBlocksHashes` are guaranteed to have been reported through earlier `newBlock` events.
All items in `finalizedBlockHashes` and `prunedBlockHashes` are guaranteed to have been reported through earlier `newBlock` events.

The current best block, in other words the last block reported through a `bestBlockChanged` event, is guaranteed to either be the last item in `finalizedBlocksHashes`, or to not be present in either `finalizedBlocksHashes` or `prunedBlocksHashes`.
The current best block, in other words the last block reported through a `bestBlockChanged` event, is guaranteed to either be the last item in `finalizedBlockHashes`, or to not be present in either `finalizedBlockHashes` or `prunedBlockHashes`.

### stop

Expand Down