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

Add proposer gRPC suppot for Electra #13984

Merged
merged 2 commits into from
May 11, 2024
Merged

Conversation

terencechain
Copy link
Member

This PR adds Electra support for proposer RPC. Mainly

  • GetBlock can be used to retrieve electra version block to sign
  • ProposeBlock can be used to submit electra block

Note to the reviewer:

  • ProcessOperationsNoVerifyAttsSigs is updated with version.Electra or else unit test will fail
  • Electra version of block is added to StreamBlocksResponse

@terencechain terencechain requested a review from a team as a code owner May 10, 2024 18:05
@terencechain terencechain force-pushed the electra-proposer-rpc branch 2 times, most recently from 184dbda to 9c5e532 Compare May 10, 2024 18:21
sBlk, err = blocks.NewSignedBeaconBlock(&ethpb.SignedBeaconBlockElectra{Block: &ethpb.BeaconBlockElectra{Body: &ethpb.BeaconBlockBodyElectra{}}})
if err != nil {
return nil, status.Errorf(codes.Internal, "Could not initialize block for proposal: %v", err)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I know this is just repeating the existing pattern, but this switch feels upside down. Typically we write this kind of type switch where the inequality is the other way:

bEpoch := slots.ToEpoch(slot) 
if bEpoch >= params.BeaconConfig().ElectraForkEpoch {
... // do electra thing
}
if bEpoch >= params.BeaconConfig().DenebForkEpoch {
... // do deneb thing
}
// do phase 0 thing

@@ -18,6 +18,7 @@ func Test_getEmptyBlock(t *testing.T) {
config.BellatrixForkEpoch = 2
config.CapellaForkEpoch = 3
config.DenebForkEpoch = 4
config.ElectraForkEpoch = 5
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you document the effect of setting these fork epoch values? I assume the point here is just to set the highest epoch to something that won't overflow (when it is set to max uint) and making sure these epochs don't conflict with each other.

Copy link
Member Author

Choose a reason for hiding this comment

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

This is just so we can test the conditions. Here is how it's used in the test case:
slot: primitives.Slot(params.BeaconConfig().ElectraForkEpoch) * params.BeaconConfig().SlotsPerEpoch,
which gets passed to getEmptyBlock(tt.slot), then reached under case epoch >= params.BeaconConfig().ElectraForkEpoch:

@terencechain terencechain changed the title Add proposer RPC suppot for Electra Add proposer gRPC suppot for Electra May 10, 2024
@terencechain terencechain added the Ready For Review A pull request ready for code review label May 10, 2024
@terencechain terencechain added this pull request to the merge queue May 11, 2024
Merged via the queue into develop with commit 839a80e May 11, 2024
16 of 17 checks passed
@terencechain terencechain deleted the electra-proposer-rpc branch May 11, 2024 13:10
ErnestK pushed a commit to ErnestK/prysm that referenced this pull request May 19, 2024
* Add proposer RPC suppot for Electra

* Kasey's feedback
nisdas pushed a commit that referenced this pull request Jul 4, 2024
* Add proposer RPC suppot for Electra

* Kasey's feedback
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ready For Review A pull request ready for code review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants