mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-08 21:08:10 -05:00
Execution API Electra: requests as a sidecar (#14492)
* wip * gaz * rename field * sammy review * updating execution api request and reverting response back * fixing linting * changelog * changelog * adding in serialization of requests * code cleanup * adding some happy path tests and fixing mock * mock still broken * fixing linting * updating name on proto * missed naming * placeholder fix for TestClient_HTTP * removing duplicate change log * adding in test for get payloadv4 as well as some tests * added tests for execution client testing, fixed encode type * adding comment for placeholder test * fixing test and addressing feedback * feedback * flipping the test names, was used in reverse * feedback from kasey * reverting switch back to if statements to fix bug * lint
This commit is contained in:
@@ -37,6 +37,9 @@ func NewWrappedExecutionData(v proto.Message) (interfaces.ExecutionData, error)
|
||||
return WrappedExecutionPayloadDeneb(pbStruct)
|
||||
case *enginev1.ExecutionPayloadDenebWithValueAndBlobsBundle:
|
||||
return WrappedExecutionPayloadDeneb(pbStruct.Payload)
|
||||
case *enginev1.ExecutionBundleElectra:
|
||||
// note: no payload changes in electra so using deneb
|
||||
return WrappedExecutionPayloadDeneb(pbStruct.Payload)
|
||||
default:
|
||||
return nil, ErrUnsupportedVersion
|
||||
}
|
||||
|
||||
@@ -14,7 +14,8 @@ type GetPayloadResponse struct {
|
||||
BlobsBundle *pb.BlobsBundle
|
||||
OverrideBuilder bool
|
||||
// todo: should we convert this to Gwei up front?
|
||||
Bid primitives.Wei
|
||||
Bid primitives.Wei
|
||||
ExecutionRequests *pb.ExecutionRequests
|
||||
}
|
||||
|
||||
// bundleGetter is an interface satisfied by get payload responses that have a blobs bundle.
|
||||
@@ -31,6 +32,10 @@ type shouldOverrideBuilderGetter interface {
|
||||
GetShouldOverrideBuilder() bool
|
||||
}
|
||||
|
||||
type executionRequestsGetter interface {
|
||||
GetDecodedExecutionRequests() (*pb.ExecutionRequests, error)
|
||||
}
|
||||
|
||||
func NewGetPayloadResponse(msg proto.Message) (*GetPayloadResponse, error) {
|
||||
r := &GetPayloadResponse{}
|
||||
bundleGetter, hasBundle := msg.(bundleGetter)
|
||||
@@ -38,6 +43,7 @@ func NewGetPayloadResponse(msg proto.Message) (*GetPayloadResponse, error) {
|
||||
r.BlobsBundle = bundleGetter.GetBlobsBundle()
|
||||
}
|
||||
bidValueGetter, hasBid := msg.(bidValueGetter)
|
||||
executionRequestsGetter, hasExecutionRequests := msg.(executionRequestsGetter)
|
||||
wei := primitives.ZeroWei()
|
||||
if hasBid {
|
||||
// The protobuf types that engine api responses unmarshal into store their values in little endian form.
|
||||
@@ -56,5 +62,12 @@ func NewGetPayloadResponse(msg proto.Message) (*GetPayloadResponse, error) {
|
||||
return nil, err
|
||||
}
|
||||
r.ExecutionData = ed
|
||||
if hasExecutionRequests {
|
||||
requests, err := executionRequestsGetter.GetDecodedExecutionRequests()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
r.ExecutionRequests = requests
|
||||
}
|
||||
return r, nil
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
consensus_types "github.com/prysmaticlabs/prysm/v5/consensus-types"
|
||||
"github.com/prysmaticlabs/prysm/v5/consensus-types/interfaces"
|
||||
"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives"
|
||||
enginev1 "github.com/prysmaticlabs/prysm/v5/proto/engine/v1"
|
||||
eth "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/v5/runtime/version"
|
||||
)
|
||||
@@ -172,3 +173,12 @@ func (b *SignedBeaconBlock) SetBlobKzgCommitments(c [][]byte) error {
|
||||
b.block.body.blobKzgCommitments = c
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetExecutionRequests sets the execution requests in the block.
|
||||
func (b *SignedBeaconBlock) SetExecutionRequests(req *enginev1.ExecutionRequests) error {
|
||||
if b.version < version.Electra {
|
||||
return consensus_types.ErrNotSupported("SetExecutionRequests", b.version)
|
||||
}
|
||||
b.block.body.executionRequests = req
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -91,6 +91,7 @@ type SignedBeaconBlock interface {
|
||||
SetProposerIndex(idx primitives.ValidatorIndex)
|
||||
SetSlot(slot primitives.Slot)
|
||||
SetSignature(sig []byte)
|
||||
SetExecutionRequests(er *enginev1.ExecutionRequests) error
|
||||
Unblind(e ExecutionData) error
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user