-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add Gloas consensus type block package #15618
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
Conversation
da955a3 to
8bbcf1f
Compare
8bbcf1f to
8a4a318
Compare
8a4a318 to
5df3604
Compare
5df3604 to
1869386
Compare
8ecec5d to
4370e34
Compare
4370e34 to
6333253
Compare
| _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) | ||
| ) | ||
|
|
||
| type ExecutionPayloadEnvelope struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm why was this file included without the protobuf file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice catch, the file was a left over and i checked it in by accident
in the latest commit i have that removed and addressed your other feedback
proto/prysm/v1alpha1/cloners.go
Outdated
| copied.SyncAggregate = body.SyncAggregate.Copy() | ||
| } | ||
|
|
||
| copied.SignedExecutionPayloadBid = copySignedExecutionPayloadBid(body.SignedExecutionPayloadBid) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit can we move this to the bottom since it's new?
6333253 to
693b303
Compare
693b303 to
8bd5e43
Compare
8bd5e43 to
09ec764
Compare
james-prysm
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
| if testVersion == version.Gloas { | ||
| // TODO(16027): Unskip light client tests for Gloas | ||
| continue | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note we are going to redo this, we are experimenting a different approach in: #16030
but it shouldn't block anyone reviewing this PR
potuz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A bunch of getters should now error on Gloas, at least Execution, KZG commitments, Execution Requests.
First serious pass, will do another in a couple of hours.
| @@ -82,13 +82,15 @@ func NewSignedBeaconBlock(i any) (interfaces.SignedBeaconBlock, error) { | |||
| return initBlindedSignedBlockFromProtoFulu(b) | |||
| case *eth.GenericSignedBeaconBlock_BlindedFulu: | |||
| return initBlindedSignedBlockFromProtoFulu(b.BlindedFulu) | |||
| case *eth.SignedBeaconBlockGloas: | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need a "Generic" version like for previous forks, something like b.Gloas.Block?
| @@ -138,13 +140,15 @@ func NewBeaconBlock(i any) (interfaces.ReadOnlyBeaconBlock, error) { | |||
| return initBlindedBlockFromProtoFulu(b) | |||
| case *eth.GenericBeaconBlock_BlindedFulu: | |||
| return initBlindedBlockFromProtoFulu(b.BlindedFulu) | |||
| case *eth.BeaconBlockGloas: | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need a generic version like previous forks? b.Gloas.Block
consensus-types/blocks/factory.go
Outdated
| @@ -629,6 +641,8 @@ func BuildSignedBeaconBlockFromExecutionPayload(blk interfaces.ReadOnlySignedBea | |||
| }, | |||
| Signature: sig[:], | |||
| } | |||
| case version.Gloas: | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This case should fail much earlier when trying to get the Execution from the body. It's better to return early from this function with an error. Also, the fact that this function passed tests shows that this couldn't have been covered. So a regression test is needed.
| @@ -157,14 +159,17 @@ func (b *SignedBeaconBlock) PbGenericBlock() (*eth.GenericSignedBeaconBlock, err | |||
| return ð.GenericSignedBeaconBlock{ | |||
| Block: ð.GenericSignedBeaconBlock_Fulu{Fulu: bc}, | |||
| }, nil | |||
| case version.Gloas: | |||
| // Gloas doesn't support GenericSignedBeaconBlock yet | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This answers my pervious questions.... Probably better to discuss this offline
consensus-types/blocks/getters.go
Outdated
| if err := pb.UnmarshalSSZ(buf); err != nil { | ||
| return err | ||
| } | ||
| var err error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this is the design on all previous cases, but is there any reason to not have done:
| if err := pb.UnmarshalSSZ(buf); err != nil { | |
| return err | |
| } | |
| var err error | |
| err := pb.UnmarshalSSZ(buf); | |
| if err != nil { | |
| return err | |
| } |
consensus-types/blocks/proto.go
Outdated
| signedExecutionPayloadBid: pb.SignedExecutionPayloadBid, | ||
| blsToExecutionChanges: pb.BlsToExecutionChanges, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the ordering?
| @@ -182,3 +182,21 @@ func (b *SignedBeaconBlock) SetExecutionRequests(req *enginev1.ExecutionRequests | |||
| b.block.body.executionRequests = req | |||
| return nil | |||
| } | |||
|
|
|||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SetExecutionRequests should also fail if the version is Gloas or more, same for the Execution Payload setter.
| @@ -80,6 +80,8 @@ func (b *SignedBeaconBlock) Copy() (interfaces.SignedBeaconBlock, error) { | |||
| return initBlindedSignedBlockFromProtoFulu(pb.(*eth.SignedBlindedBeaconBlockFulu).Copy()) | |||
| } | |||
| return initSignedBlockFromProtoFulu(pb.(*eth.SignedBeaconBlockFulu).Copy()) | |||
| case version.Gloas: | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not related to this line. But the getters file needs to be futher modified. Some getters do not make sense for Gloas and instead of returning nil and risking a panic they should return an error. For example the current path for Execution() will return nil instead of erroring out. The same for the ExecutionRequests(). We should add errors for all getters that would fail.
consensus-types/blocks/types.go
Outdated
| payloadAttestations []*eth.PayloadAttestation | ||
| signedExecutionPayloadBid *eth.SignedExecutionPayloadBid |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reverse order here.
**Review after #16033 is merged** **What type of PR is this?** Other **What does this PR do? Why is it needed?** This PR refactors the code to find the corresponding slot of a given block root using state summary or the block itself, into its own function `SlotByBlockRoot(ctx, blockroot)`. Note that there exists a function `slotByBlockRoot(ctx context.Context, tx *bolt.Tx, blockRoot []byte)` immediately below the new function. Also note that this function has two drawbacks, which led to creation of the new function: - the old function requires a boltdb tx, which is not necessarily available to the caller. - the old function does NOT make use of the state summary cache. edit: - the old function also uses the state bucket to retrieve the state and it's slot. this is not something we want in the state diff feature, since there is no state bucket.
No description provided.