Skip to content

[Draft] PING and ENR rpc protocol#1673

Closed
AgeManning wants to merge 1 commit into
ethereum:v011xfrom
AgeManning:enr-ping
Closed

[Draft] PING and ENR rpc protocol#1673
AgeManning wants to merge 1 commit into
ethereum:v011xfrom
AgeManning:enr-ping

Conversation

@AgeManning

Copy link
Copy Markdown
Contributor

This is an initial draft aimed for discussion for adding a PING and ENR protocol to the RPC

Overview

For client's to adopt dynamic subnets efficiently, a mechanism is required to obtain the ENR (or subnet bitfields) from peers that connect to clients via libp2p rather than discovery (see #1637). Furthermore, we currently have not specified a PING-like protocol to check for peer liveness on the libp2p stack.

Although we could use periodic STATUS messages to check for peer liveness, it may be beneficial to decouple the liveness check from STATUS messages, as we will also need a mechanism to update ENRs/subnet fields periodically.

Proposed Solution

This PR provides a DRAFT version of adding a PING and ENR RPC method to our RPC.

The PING protocol, is lightweight and is designed to send a small amount of information which indicates the current state of the node to other peers as well as checking their liveness. In it's current form, the PING protocol sends the ENR sequence number, however we may want to change this to something more general.

Given knowledge of our peers current ENR sequence numbers (via the PING protocol) a client may then request an updated ENR from it's peers if its local record of the peers ENR is out-dated (ENR sequence is lower). This method also allows clients to request ENR's for newly connected peers if their ENR's are unknown.

Obvious points of modification

This is a draft aimed for discussion. Some obvious points we may want to consider changing are:

  • The information sent in the PING protocol. This is currently ENR focused, we may want to make it more general.
  • The structure of the ENR response. We don't have SSZ encodings for ENR. We could encode the base64 version of the ENR or use the RLP encoding. Currently this is specified to SSZ encode the response which contains the RLP encoded bytes of the ENR.
  • The ENR expiry response. Currently this is a list of Slots. Depending on implementations, long-lived subscriptions may want to end on Epoch's rather than Slots, in which case we may want to change this to Epoch. The actual structure of how to relay timeout information may want to be modified.
  • ENR Request - The ENR request doesn't not send any data in the stream, which is unlike all other RPC methods. Potentially we want to send some information here.

@mcdee

mcdee commented Mar 23, 2020

Copy link
Copy Markdown
Contributor

I would love to see some consideration of #1531 here. Seems like the forkID from eth1 could be a good candidate for inclusion, and please could we have a peer name/version included before we head in to the multiclient testnet?

@nisdas

nisdas commented Mar 24, 2020

Copy link
Copy Markdown
Contributor

The ENR expiry response. Currently this is a list of Slots. Depending on implementations, long-lived subscriptions may want to end on Epoch's rather than Slots, in which case we may want to change this to Epoch. The actual structure of how to relay timeout information may want to be modified.

It would make sense for this to be epoch based rather than slots, we do use epoch as a base value whenever specifying params such as EPOCHS_PER_RANDOM_SUBNET_SUBSCRIPTION https://github.com/ethereum/eth2.0-specs/blob/dev/specs/phase0/validator.md#misc .

@AgeManning

Copy link
Copy Markdown
Contributor Author

It would make sense for this to be epoch based rather than slots, we do use epoch as a base value whenever specifying params such as EPOCHS_PER_RANDOM_SUBNET_SUBSCRIPTION https://github.com/ethereum/eth2.0-specs/blob/dev/specs/phase0/validator.md#misc

This is why I think it depends on implementations. If a validator joins halfway through an epoch, do you join the random subnet then, and then wait EPOCHS_PER_RANDOM_SUBNET_SUSCRIPTION before ending the subscription on a particular slot half-way through the epoch. Or do you end the subscription on an epoch boundary rounding up/down, or do you always start the subscription on the next epoch and end on epoch boundaries?

I personally think it's easier to just subscribe instantly when a validator connects and have a fixed timeout (which means we end on random slots) rather than adding another timeout to wait until the next epoch boundary and subscribe then.

But if everyone is subscribing/unsubscribing on epoch boundaries, that could also be potentially cleaner.

@AgeManning AgeManning changed the base branch from dev to v011x March 24, 2020 04:20
@djrtwo djrtwo mentioned this pull request Mar 25, 2020
@djrtwo

djrtwo commented Mar 25, 2020

Copy link
Copy Markdown
Contributor

closing in favor of #1684

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants