Skip to content
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

EIP-7594 - Update ENR record #3772

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open

EIP-7594 - Update ENR record #3772

wants to merge 2 commits into from

Conversation

nalepae
Copy link
Contributor

@nalepae nalepae commented May 17, 2024

Proposal for #3744

The maximum encoded size of a node record is 300 bytes. (Source).

1. Field key

Reducing the custoding_subnet_count key to csc saves 19 bytes.

2. Field value type

Switching the value of custoding_subnet_count from SSZ uint64 to big endian integer has multiple advantages:

  • ENR are already RLP encoded, so there is no need to both SSZ and RLP encode.
  • RLP encoding stores positive integer efficiently. If a positive integer is less than 128 (which is likely to be the case for the subnets count), then the value needs exactly one byte of storage when encoded. (Source).

Switching the value of custoding_subnet_count from SSZ uint64 to big endian integer saves 7 bytes.

Total

Changing 1. and 2. saves a total of 19 + 7 = 26 bytes. 26 bytes represents about 8.5% of the maximum size of an encoded node record.

Copy link
Member

@ppopth ppopth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@hwwhww hwwhww added the EIP-7594 PeerDAS label May 28, 2024
Copy link
Contributor

@hwwhww hwwhww left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
EIP-7594 PeerDAS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants