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

Merged
merged 2 commits into from
Jun 12, 2024
Merged

EIP-7594 - Update ENR record #3772

merged 2 commits into from
Jun 12, 2024

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

Copy link
Contributor

@g11tech g11tech left a comment

Choose a reason for hiding this comment

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

lgtm from lodestar

@cskiraly
Copy link
Contributor

looks good

@nalepae
Copy link
Contributor Author

nalepae commented Jun 11, 2024

Actually it seems we are heading to have exactly 128 custody subnets for a supernode.

  • For a supernode we will save only 25 bytes. (Because 128 is 2-bytes RLP encoded.)
  • For other nodes we will save 26 bytes. (Becase < 128 is 1-byte RLP encoded.)

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.

7 participants