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

Address @jtraglia's comments regarding Electra code #14833

Merged
merged 21 commits into from
Jan 31, 2025
Merged

Conversation

rkapka
Copy link
Contributor

@rkapka rkapka commented Jan 28, 2025

What type of PR is this?

Other

What does this PR do? Why is it needed?

Addresses @jtraglia 's feedback from https://notes.ethereum.org/@jtraglia/prysm_nits.

Each commit addresses one suggestion:

Acknowledgements

@rkapka rkapka requested review from prestonvanloon and a team as code owners January 28, 2025 09:23
@rkapka rkapka requested review from nisdas and dB2510 January 28, 2025 09:23
saolyn
saolyn previously approved these changes Jan 28, 2025
@@ -207,7 +207,7 @@ func ProcessConsolidationRequests(ctx context.Context, st state.BeaconState, req

if npc, err := st.NumPendingConsolidations(); err != nil {
return fmt.Errorf("failed to fetch number of pending consolidations: %w", err) // This should never happen.
} else if npc >= pcLimit {
} else if npc == pcLimit {
Copy link
Contributor

Choose a reason for hiding this comment

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

wait is this correct? don't we need a test for this?

Copy link
Contributor

Choose a reason for hiding this comment

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

That's this line in the spec:

Using >= is fine but technically it's not what the spec does.

Copy link
Member

Choose a reason for hiding this comment

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

>= may be safer here. Does NumPendingConsolidations ensure linearity?

Copy link
Contributor

Choose a reason for hiding this comment

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

This will be executed sequentially, so this should always work properly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think I would rather have >= here just because it's strictly safer than ==

Copy link
Member

Choose a reason for hiding this comment

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

Are you planning to address this? @rkapka

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this change is no longer in the PR

Copy link
Member

@prestonvanloon prestonvanloon left a comment

Choose a reason for hiding this comment

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

Please consider smaller PRs in the future. This will take multiple review passes to ensure that the PR addresses all of the items in the nitpick list as intended by the PR description.

Comment on lines 470 to 476

// Representing a Fulu block.
SignedBeaconBlockFulu fulu_block = 13;

// Representing a blinded Fulu block.
SignedBlindedBeaconBlockFulu blinded_fulu_block = 14;
}
Copy link
Member

Choose a reason for hiding this comment

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

I don't see this in the nits doc. Is this related?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no longer in the PR

@@ -73,7 +73,7 @@ func unmarshalDeposits(requestListInSSZBytes []byte) ([]*DepositRequest, error)

func unmarshalWithdrawals(requestListInSSZBytes []byte) ([]*WithdrawalRequest, error) {
if len(requestListInSSZBytes) < wrSize {
return nil, errors.New("invalid withdrawal request length, requests should be at least the size of 1 request")
return nil, errors.New("invalid withdrawal requests length, requests should be at least the size of 1 request")
Copy link
Member

Choose a reason for hiding this comment

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

If you want to nitpick here, then the error should be like this:

Suggested change
return nil, errors.New("invalid withdrawal requests length, requests should be at least the size of 1 request")
return nil, fmt.Errorf("invalid withdrawal requests length, requests should be at least the size of %d requests", wrSize)

Otherwise 1 is a magic number and may not match wrSize

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@@ -83,7 +83,7 @@ func unmarshalWithdrawals(requestListInSSZBytes []byte) ([]*WithdrawalRequest, e

func unmarshalConsolidations(requestListInSSZBytes []byte) ([]*ConsolidationRequest, error) {
if len(requestListInSSZBytes) < crSize {
return nil, errors.New("invalid consolidations request length, requests should be at least the size of 1 request")
return nil, errors.New("invalid consolidation requests length, requests should be at least the size of 1 request")
Copy link
Member

Choose a reason for hiding this comment

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

Same feedback here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@@ -207,7 +207,7 @@ func ProcessConsolidationRequests(ctx context.Context, st state.BeaconState, req

if npc, err := st.NumPendingConsolidations(); err != nil {
return fmt.Errorf("failed to fetch number of pending consolidations: %w", err) // This should never happen.
} else if npc >= pcLimit {
} else if npc == pcLimit {
Copy link
Member

Choose a reason for hiding this comment

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

Are you planning to address this? @rkapka

### Changed

- Modified `ProcessConsolidationRequests` to match the specification.
- Changed order of `aggregate` and `selection_proof` in `AggregateAttestationAndProofElectra` protobuf.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
- Changed order of `aggregate` and `selection_proof` in `AggregateAttestationAndProofElectra` protobuf.
- Changed proto field ID of `aggregate` and `selection_proof` in `AggregateAttestationAndProofElectra` protobuf.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have a new changelog fragment now. Do you want me to mention this item?

@@ -208,7 +208,7 @@ func TestService_ValidateSyncContributionAndProof(t *testing.T) {
want: pubsub.ValidationIgnore,
},
{
name: "Invalid Subcommittee Index",
name: "Invalid Subcommittee ValidatorIndex",
Copy link
Member

Choose a reason for hiding this comment

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

??

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

@@ -199,7 +199,7 @@ func TestService_ValidateBlsToExecutionChange(t *testing.T) {
want: pubsub.ValidationAccept,
},
{
name: "Non-existent Validator Index",
name: "Non-existent Validator ValidatorIndex",
Copy link
Member

Choose a reason for hiding this comment

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

?? revert

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

@rkapka rkapka marked this pull request as draft January 29, 2025 20:08
@rkapka rkapka marked this pull request as ready for review January 29, 2025 20:15
Copy link
Member

@prestonvanloon prestonvanloon left a comment

Choose a reason for hiding this comment

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

Thanks so much for splitting this PR into individual commits. This was a much better review experience!

@@ -112,7 +112,7 @@ func MinimalSpecConfig() *BeaconChainConfig {
minimalConfig.MaxDepositRequestsPerPayload = 4
minimalConfig.PendingPartialWithdrawalsLimit = 64
minimalConfig.MaxPendingPartialsPerWithdrawalsSweep = 2
minimalConfig.PendingDepositLimit = 134217728
Copy link
Member

Choose a reason for hiding this comment

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

This is the same value as mainnet? This isn't an override so you could just delete this line, if you want.

@rkapka rkapka added this pull request to the merge queue Jan 31, 2025
Merged via the queue into develop with commit 4a63a19 Jan 31, 2025
16 checks passed
@rkapka rkapka deleted the electra-nits branch January 31, 2025 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants