Skip to content

Commit

Permalink
Remove one SSZ seralization layer from ping extensions
Browse files Browse the repository at this point in the history
Removal of 1 ByteList to serialize / deserialize in the ping
extensions format.
  • Loading branch information
kdeme committed Jan 17, 2025
1 parent 0fa815f commit be2628b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
13 changes: 2 additions & 11 deletions ping-payload-extensions/ping-custom-payload-extensions.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,12 @@ The rest are first come first serve, but they should still be defined in this re

## Requirements

All payloads used in the Ping `custom_payload` MUST follow the `Ping Custom Payload Extensions` format.
All `Ping` and `Pong` messages have a `payload_type` and `payload` field:

## Custom Payload Extensions Format

- **type**: numeric identifier which tells clients how the `payload` field should be decoded.
- **payload_type**: numeric identifier which tells clients how the `payload` field should be decoded.
- **payload**: the SSZ encoded extension payload


```python
CustomPayloadExtensionsFormat = Container(
type: u16,
payload: ByteList[max_length=1100]
)
```

## Ping vs Pong
The relationship between Ping and Pong message will be determined by the requirements of the type.

Expand Down
10 changes: 6 additions & 4 deletions portal-wire-protocol.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,23 +99,25 @@ Request message to check if a node is reachable, communicate basic information a

```
selector = 0x00
ping = Container(enr_seq: uint64, custom_payload: ByteList[2048])
ping = Container(enr_seq: uint64, payload_type: uint16, payload: ByteList[1100])
```

- `enr_seq`: The node's current sequence number of their ENR record.
- `custom_payload`: Custom payload specified per the network.
- `payload_type`: Custom payload type identifier as defined in [Ping Custom Payload Extensions](./ping-payload-extensions/ping-custom-payload-extensions.md).
- `payload`: Custom SSZ payload as defined in [Ping Custom Payload Extensions](./ping-payload-extensions/ping-custom-payload-extensions.md).

#### Pong (0x01)

Response message to Ping(0x00)

```
selector = 0x01
pong = Container(enr_seq: uint64, custom_payload: ByteList[2048])
pong = Container(enr_seq: uint64, payload_type: uint16, payload: ByteList[1100])
```

- `enr_seq`: The node's current sequence number of their ENR record.
- `custom_payload`: Custom payload specified per the network.
- `payload_type`: Custom payload type identifier as defined in [Ping Custom Payload Extensions](./ping-payload-extensions/ping-custom-payload-extensions.md).
- `payload`: Custom SSZ payload as defined in [Ping Custom Payload Extensions](./ping-payload-extensions/ping-custom-payload-extensions.md).

#### Find Nodes (0x02)

Expand Down

0 comments on commit be2628b

Please sign in to comment.