-
Notifications
You must be signed in to change notification settings - Fork 87
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 typo #320
base: master
Are you sure you want to change the base?
fix typo #320
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,16 +17,21 @@ Unsupported messages **SHOULD** receive a `TALKRESP` message with an empty paylo | |
All protocol identifiers consist of two bytes. The first byte is "`P`" (`0x50`), to indicate "the Portal network", the second byte is a specific network identifier. | ||
|
||
### Mainnet identifiers | ||
|
||
Currently defined mainnet protocol identifiers: | ||
|
||
- Inclusive range of `0x5000` - `0x5009`: Reserved for future networks or network upgrades | ||
- `0x500A`: Execution State Network | ||
- `0x500B`: Execution History Network | ||
- `0x500C`: Beacon Chain Network | ||
- `0x500D`: Execution Canonical Transaction Index Network | ||
- `0x500E`: Execution Verkle State Network | ||
- `0x500F`: Execution Transaction Gossip Network | ||
|
||
### Angelfood identifiers | ||
|
||
Currently defined `angelfood` protocol identifiers: | ||
|
||
- `0x504A`: Execution State Network | ||
- `0x504B`: Execution History Network | ||
- `0x504C`: Beacon Chain Network | ||
|
@@ -50,18 +55,18 @@ The SHA256 Content ID derivation function is defined as: | |
content_id = sha256(content_key) | ||
``` | ||
|
||
|
||
## Nodes and Node IDs | ||
|
||
Nodes in the portal network are represented by their [EIP-778 Ethereum Node Record (ENR)](https://eips.ethereum.org/EIPS/eip-778) from the Discovery v5 network. A node's `node-id` is derived according to the node's identity scheme, which is specified in the node's ENR. A node's `node-id` represents its address in the DHT. Node IDs are interchangeable between 32 byte identifiers and 256 bit integers. | ||
Nodes in the portal network are represented by their [EIP-778 Ethereum Node Record (ENR)](https://eips.ethereum.org/EIPS/eip-778) from the Discovery v5 network. A node's `node-id` is derived according to the node's identity scheme, which is specified in the node's ENR. A node's `node-id` represents its address in the DHT. Node IDs are interchangeable between 32 byte identifiers and 256 bit integers. | ||
|
||
## Request - Response Messages | ||
|
||
The messages in the protocol are transmitted using the `TALKREQ` and `TALKRESP` messages from the base [Node Discovery Protocol](https://github.com/ethereum/devp2p/blob/master/discv5/discv5-wire.md#talkreq-request-0x05). | ||
|
||
All messages in the protocol have a request-response interaction: | ||
* Request messages **MUST** be sent using a `TALKREQ` message. | ||
* Response messages **MUST** be sent using the corresponding `TALKRESP` message. | ||
|
||
- Request messages **MUST** be sent using a `TALKREQ` message. | ||
- Response messages **MUST** be sent using the corresponding `TALKRESP` message. | ||
|
||
All messages are encoded as an [SSZ Union](https://github.com/ethereum/consensus-specs/blob/dev/ssz/simple-serialize.md#union) type. | ||
|
||
|
@@ -87,8 +92,8 @@ selector = 0x00 | |
ping = Container(enr_seq: uint64, custom_payload: ByteList[2048]) | ||
``` | ||
|
||
* `enr_seq`: The node's current sequence number of their ENR record. | ||
* `custom_payload`: Custom payload specified per the network. | ||
- `enr_seq`: The node's current sequence number of their ENR record. | ||
- `custom_payload`: Custom payload specified per the network. | ||
|
||
#### Pong (0x01) | ||
|
||
|
@@ -99,8 +104,8 @@ selector = 0x01 | |
pong = Container(enr_seq: uint64, custom_payload: ByteList[2048]) | ||
``` | ||
|
||
* `enr_seq`: The node's current sequence number of their ENR record. | ||
* `custom_payload`: Custom payload specified per the network. | ||
- `enr_seq`: The node's current sequence number of their ENR record. | ||
- `custom_payload`: Custom payload specified per the network. | ||
|
||
#### Find Nodes (0x02) | ||
|
||
|
@@ -111,9 +116,9 @@ selector = 0x02 | |
find_nodes = Container(distances: List[uint16, max_length=256]) | ||
``` | ||
|
||
* `distances`: a list of distances for which the node is requesting ENR records for. | ||
* Each distance **MUST** be within the inclusive range `[0, 256]` | ||
* Each distance in the list **MUST** be unique. | ||
- `distances`: a list of distances for which the node is requesting ENR records for. | ||
- Each distance **MUST** be within the inclusive range `[0, 256]` | ||
- Each distance in the list **MUST** be unique. | ||
|
||
#### Nodes (0x03) | ||
|
||
|
@@ -124,11 +129,10 @@ selector = 0x03 | |
nodes = Container(total: uint8, enrs: List[ByteList[2048], max_length=32]) | ||
``` | ||
|
||
* `total`: The total number of `Nodes` response messages being sent. Currently fixed to only 1 response message. | ||
* `enrs`: List of byte strings, each of which is an RLP encoded ENR record. | ||
* Individual ENR records **MUST** correspond to one of the requested distances. | ||
* It is invalid to return multiple ENR records for the same `node_id`. | ||
* The ENR record of the requesting node **SHOULD** be filtered out of the list. | ||
- `total`: The total number of `Nodes` response messages being sent. Currently fixed to only 1 response message. | ||
- `enrs`: List of byte strings, each of which is an RLP encoded ENR record. | ||
_ Individual ENR records **MUST** correspond to one of the requested distances. | ||
_ It is invalid to return multiple ENR records for the same `node_id`. \* The ENR record of the requesting node **SHOULD** be filtered out of the list. | ||
|
||
#### Find Content (0x04) | ||
|
||
|
@@ -139,7 +143,7 @@ selector = 0x04 | |
find_content = Container(content_key: ByteList[2048]) | ||
``` | ||
|
||
* `content_key`: The key for the content being requested. The encoding of `content_key` is specified per the network. | ||
- `content_key`: The key for the content being requested. The encoding of `content_key` is specified per the network. | ||
|
||
#### Content (0x05) | ||
|
||
|
@@ -153,38 +157,41 @@ selector = 0x05 | |
content = Union[connection_id: Bytes2, content: ByteList[2048], enrs: List[ByteList[2048], 32]] | ||
``` | ||
|
||
* `connection_id`: Connection ID to set up a uTP stream to transmit the requested data. | ||
* Connection ID values **SHOULD** be randomly generated. | ||
* `content`: byte string of the requested content. | ||
* This field **MUST** be used when the requested data can fit in this single response. | ||
* `enrs`: List of byte strings, each of which is an RLP encoded ENR record. | ||
* The list of ENR records **MUST** be closest nodes to the requested content that the responding node has stored. | ||
* The set of derived `node_id` values from the ENR records **MUST** be unique. | ||
* The ENR record of the requesting & responding node **SHOULD** be filtered out of the list. | ||
- `connection_id`: Connection ID to set up a uTP stream to transmit the requested data. | ||
- Connection ID values **SHOULD** be randomly generated. | ||
- `content`: byte string of the requested content. | ||
- This field **MUST** be used when the requested data can fit in this single response. | ||
- `enrs`: List of byte strings, each of which is an RLP encoded ENR record. | ||
- The list of ENR records **MUST** be closest nodes to the requested content that the responding node has stored. | ||
- The set of derived `node_id` values from the ENR records **MUST** be unique. | ||
- The ENR record of the requesting & responding node **SHOULD** be filtered out of the list. | ||
|
||
If the node does not hold the requested content, and the node does not know of any nodes with eligible ENR values, then the node **MUST** return `enrs` as an empty list. | ||
|
||
Upon *sending* this message with a `connection_id`, the sending node **SHOULD** *listen* for an incoming uTP stream with the generated `connection_id`. | ||
Upon _sending_ this message with a `connection_id`, the sending node **SHOULD** _listen_ for an incoming uTP stream with the generated `connection_id`. | ||
|
||
Upon *receiving* this message with a `connection_id`, the receiving node **SHOULD** *initiate* a uTP stream with the received `connection_id`. | ||
Upon _receiving_ this message with a `connection_id`, the receiving node **SHOULD** _initiate_ a uTP stream with the received `connection_id`. | ||
Comment on lines
-167
to
+173
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. unneeded change as mentioned above. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The _ and - changes are required by the ethereum/EIPs linter. We should review and merge Pipers PR before this one though @kdeme There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok, fair enough. Same linter should be setup on this repo then also. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Very good. I will be happy if I can help in this matter |
||
|
||
##### `content` Union Definition | ||
|
||
The `Union` defined in the `content` field of the `Content (0x05)` message is defined as below: | ||
|
||
**`connection_id`** | ||
|
||
``` | ||
selector = 0x00 | ||
ssz-type = Bytes2 | ||
``` | ||
|
||
**`content`** | ||
|
||
``` | ||
selector = 0x01 | ||
ssz-type = ByteList[2048] | ||
``` | ||
|
||
**`enrs`** | ||
|
||
``` | ||
selector = 0x02 | ||
ssz-type = List[ByteList[2048], 32] | ||
|
@@ -199,7 +206,7 @@ selector = 0x06 | |
offer = Container(content_keys: List[ByteList[2048], max_length=64]) | ||
``` | ||
|
||
* `content_keys`: A list of encoded `content_key` entries. The encoding of each `content_key` is specified per the network. | ||
- `content_keys`: A list of encoded `content_key` entries. The encoding of each `content_key` is specified per the network. | ||
|
||
#### Accept (0x07) | ||
|
||
|
@@ -212,14 +219,14 @@ selector = 0x07 | |
accept = Container(connection_id: Bytes2, content_keys: BitList[max_length=64]] | ||
``` | ||
|
||
* `connection_id`: Connection ID to set up a uTP stream to transmit the requested data. | ||
* ConnectionID values **SHOULD** be randomly generated. | ||
* `content_keys`: Signals which content keys are desired. | ||
* A bit-list corresponding to the offered keys with the bits in the positions of the desired keys set to `1`. | ||
- `connection_id`: Connection ID to set up a uTP stream to transmit the requested data. | ||
- ConnectionID values **SHOULD** be randomly generated. | ||
- `content_keys`: Signals which content keys are desired. | ||
- A bit-list corresponding to the offered keys with the bits in the positions of the desired keys set to `1`. | ||
|
||
Upon *sending* this message, the requesting node **SHOULD** *listen* for an incoming uTP stream with the generated `connection_id`. | ||
Upon _sending_ this message, the requesting node **SHOULD** _listen_ for an incoming uTP stream with the generated `connection_id`. | ||
|
||
Upon *receiving* this message, the serving node **SHOULD** *initiate* a uTP stream with the received `connection_id`. | ||
Upon _receiving_ this message, the serving node **SHOULD** _initiate_ a uTP stream with the received `connection_id`. | ||
Comment on lines
-220
to
+229
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. unneeded change as mentioned above. |
||
|
||
##### Content Encoding | ||
|
||
|
@@ -234,6 +241,7 @@ The maximum size allowed for this application is limited to `uint32`. | |
The content item itself MUST be encoded as is defined for each specific network and content type. | ||
|
||
The encoded data of n encoded content items to be send over the stream can be formalized as: | ||
|
||
```py | ||
# n encoded content items to be send over the stream, with n <= 64 | ||
encoded_content_list = [content_0, content_1, ..., content_n] | ||
|
@@ -261,13 +269,11 @@ Similarly, we define a `logdistance` function identically to the Discovery v5 ne | |
logdistance(a: uint256, b: uint256) = log2(distance(a, b)) | ||
``` | ||
|
||
|
||
### Test Vectors | ||
|
||
A collection of test vectors for this specification can be found in the | ||
[Portal wire test vectors](./portal-wire-test-vectors.md) document. | ||
|
||
|
||
## Routing Table | ||
|
||
Most networks that use the Portal Wire Protocol will form an independent DHT which requires individual nodes to maintain a routing table. | ||
|
@@ -303,14 +309,12 @@ port := UDP port number | |
|
||
### Protocol Specific Node State | ||
|
||
Sub protocols may define additional node state information which should be tracked in the node state database. This information will typically be transmitted in the `Ping.custom_data` and `Pong.custom_data` fields. | ||
|
||
Sub protocols may define additional node state information which should be tracked in the node state database. This information will typically be transmitted in the `Ping.custom_data` and `Pong.custom_data` fields. | ||
|
||
## Algorithms | ||
|
||
Here we define a collection of generic algorithms which can be applied to a sub-protocol implementing the wire protocol. | ||
|
||
|
||
### Lookup | ||
|
||
The term lookup refers to the lookup algorithm described in section 2.3 of the Kademlia paper. | ||
|
@@ -339,25 +343,26 @@ To find a piece of content for `content-id`, a node performs a content lookup vi | |
|
||
### Storing Content | ||
|
||
The concept of content storage is only applicable to sub-protocols that implement persistant storage of data. | ||
The concept of content storage is only applicable to sub-protocols that implement persistent storage of data. | ||
|
||
Content will get stored by a node when: | ||
|
||
- the node receives the content through the `Offer` - `Accept` message flow and the content falls within the node's radius | ||
- the node requests content through the `FindContent` - `Content` message flow and the content falls within the node's radius | ||
|
||
The network cannot make guarantees about the storage of particular content. A lazy node may ignore all `Offer` messages. A malicious node may send `Accept` messages and ignore the data transmissions. The `Offer` - `Accept` mechanism is in place to require that nodes explicitly accept some data before another node attempts to transmit that data. The mechanism prevents the unnecessary consumption of bandwidth in the presence of lazy nodes. However, it does not defend against malicious nodes who accept offers for data with no intent to store it. | ||
|
||
### Neighborhood Gossip | ||
|
||
We use the term *neighborhood gossip* to refer to the process through which content is disseminated to all of the DHT nodes *near* the location in the DHT where the content is located. | ||
We use the term _neighborhood gossip_ to refer to the process through which content is disseminated to all of the DHT nodes _near_ the location in the DHT where the content is located. | ||
|
||
The process works as follows: | ||
|
||
- A DHT node is offered and receives a piece of content that it is interested in. | ||
- This DHT node checks their routing table for `k` nearby DHT nodes that should also be interested in the content. Those `k` nodes **SHOULD** not include the node that originally provided aformentioned content. | ||
- This DHT node checks their routing table for `k` nearby DHT nodes that should also be interested in the content. Those `k` nodes **SHOULD** not include the node that originally provided aforementioned content. | ||
- If the DHT node finds `n` or more DHT nodes interested it selects `n` of these nodes and offers the content to them. | ||
- If the DHT node finds less than `n` DHT nodes interested, it launches a node lookup with target `content-id` and it | ||
offers the content to maximum `n` of the newly discovered nodes. | ||
offers the content to maximum `n` of the newly discovered nodes. | ||
|
||
The process above should quickly saturate the area of the DHT where the content is located and naturally terminate as more nodes become aware of the content. | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This unordered list went wrong.
And to add on that, all the unordered list changes are not needed in the first place as asterisks, pluses, and hyphens may all be used for this in markdown.
The same applies for the emphasis asterisks vs underscores.