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

Switch custody_subnet_count from u64 to u8 #6323

Closed
wants to merge 3 commits into from

Conversation

pawanjay176
Copy link
Member

Issue Addressed

ethereum/consensus-specs#3897

Proposed Changes

Change metadata and enr fields to take a u8 instead of a u64.

I have chosen not to change the config and chainspec params to u8 as well since they permeate throughout the codebase and we'll have to do a bunch of unnecessary u8 as u64 sort of conversions. Instead, I made apply_to_chainspec fallible in case the parameters in the config exceed u8::MAX.

@pawanjay176 pawanjay176 added ready-for-review The code is ready for review das Data Availability Sampling labels Aug 28, 2024
@pawanjay176 pawanjay176 requested a review from jimmygchen August 28, 2024 20:51
let u8_max = u8::MAX as u64;
if custody_requirement > u8_max
|| data_column_sidecar_subnet_count > u8_max
|| number_of_columns > u8_max
Copy link
Member

Choose a reason for hiding this comment

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

number_of_columns is still uint64 in the spec

| `NUMBER_OF_COLUMNS` | `uint64(CELLS_PER_EXT_BLOB)` (= 128) | Number of columns in the extended data matrix |

Copy link
Member

@jimmygchen jimmygchen left a comment

Choose a reason for hiding this comment

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

I just realized the change isn't strictly necessary because RLP encoding doesn't actually fill any 0 bytes, so encoding 128 is the same for u8 and u64. This change just put a upper bound to the number 🤔

I'm not sure if the spec change was necessary. it just limit us to go above 255 subnets and has no impact on the encoded value. Will ask on R&D.

@jimmygchen jimmygchen added under-review A reviewer has only partially completed a review. and removed ready-for-review The code is ready for review labels Aug 29, 2024
@pawanjay176
Copy link
Member Author

This isn't required after ethereum/consensus-specs#3908

@pawanjay176 pawanjay176 closed this Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
das Data Availability Sampling under-review A reviewer has only partially completed a review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants