From df09e6a4d153fa554836019937f5d95e126282c0 Mon Sep 17 00:00:00 2001 From: kdeme <7857583+kdeme@users.noreply.github.com> Date: Mon, 20 Jan 2025 18:40:20 +0100 Subject: [PATCH] Remove one SSZ seralization layer from ping extensions (#358) Removal of 1 ByteList to serialize / deserialize in the ping extensions format. --- .../ping-custom-payload-extensions.md | 13 ++----------- portal-wire-protocol.md | 10 ++++++---- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/ping-payload-extensions/ping-custom-payload-extensions.md b/ping-payload-extensions/ping-custom-payload-extensions.md index f841b2b..95b1e9d 100644 --- a/ping-payload-extensions/ping-custom-payload-extensions.md +++ b/ping-payload-extensions/ping-custom-payload-extensions.md @@ -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. diff --git a/portal-wire-protocol.md b/portal-wire-protocol.md index 300602f..74a3be3 100644 --- a/portal-wire-protocol.md +++ b/portal-wire-protocol.md @@ -99,11 +99,12 @@ 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) @@ -111,11 +112,12 @@ 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)