Skip to content

eth/protocols/snap: list served versions in the ENR entry - #35944

Open
MysticRyuujin wants to merge 1 commit into
ethereum:masterfrom
MysticRyuujin:snap-enr-versions
Open

MysticRyuujin wants to merge 1 commit into
ethereum:masterfrom
MysticRyuujin:snap-enr-versions

Conversation

@MysticRyuujin

Copy link
Copy Markdown
Contributor

The snap ENR entry now lists the snap versions that the node serves.

With snap/2 enabled, geth serves snap/1 and snap/2, but its ENR entry is the same empty list as a node that serves only snap/1. A node that looks for snap/2 servers in discovery or in an EIP-1459 snap.* tree cannot find them.

The EIP-8189 update in ethereum/EIPs#12493 defines the entry value as a list of served versions, as discussed in ethereum/devp2p#286. The spec is in ethereum/devp2p#287:

  • []: snap/1 only.
  • [1, 2]: snap/1 and snap/2.
  • [2]: snap/2 only.

Changes:

  • enrEntry holds the versions as an RLP tail list. MakeProtocols builds one entry for all registered versions, in ascending order.
  • Without snap/2, the entry stays an empty list, so the record bytes do not change.
  • devp2p nodeset filter -snap accepts any list value, so it still selects these nodes.

Tests:

  • TestENREntryEncoding checks the pair bytes: 84736e6170c0 without snap/2 and 84736e6170c20102 with it. It also checks that every protocol version carries the same entry.
  • TestENREntryDecoding decodes [], [2] and [1, 2, 3].

This branch has not been deployed

No deployments
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.

1 participant