PeerDAS: Implement reconstruction of data column sidecars retrieved from the execution client. (#15469)

* `BestFinalized`: No functional change. Improve comments and reduce scope.

* PeerDAS execution: Implement engine method `GetBlobsV2` and `ReconstructDataColumnSidecars`.

* Fix James' comment.

* Fix James' comment.
This commit is contained in:
Manu NALEPA
2025-07-04 00:35:28 +02:00
committed by GitHub
parent fac509a3e6
commit 4be8de2476
14 changed files with 465 additions and 91 deletions

View File

@@ -2,7 +2,6 @@ package blocks
import (
"bytes"
"errors"
fieldparams "github.com/OffchainLabs/prysm/v6/config/fieldparams"
consensus_types "github.com/OffchainLabs/prysm/v6/consensus-types"
@@ -10,6 +9,7 @@ import (
"github.com/OffchainLabs/prysm/v6/encoding/bytesutil"
"github.com/OffchainLabs/prysm/v6/encoding/ssz"
enginev1 "github.com/OffchainLabs/prysm/v6/proto/engine/v1"
"github.com/pkg/errors"
fastssz "github.com/prysmaticlabs/fastssz"
"google.golang.org/protobuf/proto"
)
@@ -40,8 +40,10 @@ func NewWrappedExecutionData(v proto.Message) (interfaces.ExecutionData, error)
case *enginev1.ExecutionBundleElectra:
// note: no payload changes in electra so using deneb
return WrappedExecutionPayloadDeneb(pbStruct.Payload)
case *enginev1.ExecutionBundleFulu:
return WrappedExecutionPayloadDeneb(pbStruct.Payload)
default:
return nil, ErrUnsupportedVersion
return nil, errors.Wrapf(ErrUnsupportedVersion, "type %T", pbStruct)
}
}

View File

@@ -5,6 +5,7 @@ import (
"github.com/OffchainLabs/prysm/v6/consensus-types/interfaces"
"github.com/OffchainLabs/prysm/v6/consensus-types/primitives"
pb "github.com/OffchainLabs/prysm/v6/proto/engine/v1"
"github.com/pkg/errors"
"google.golang.org/protobuf/proto"
)
@@ -12,7 +13,7 @@ import (
// GetPayloadResponseV(1|2|3|4) value.
type GetPayloadResponse struct {
ExecutionData interfaces.ExecutionData
BlobsBundle *pb.BlobsBundle
BlobsBundler pb.BlobsBundler
OverrideBuilder bool
// todo: should we convert this to Gwei up front?
Bid primitives.Wei
@@ -24,6 +25,10 @@ type bundleGetter interface {
GetBlobsBundle() *pb.BlobsBundle
}
type bundleV2Getter interface {
GetBlobsBundle() *pb.BlobsBundleV2
}
// bidValueGetter is an interface satisfied by get payload responses that have a bid value.
type bidValueGetter interface {
GetValue() []byte
@@ -41,10 +46,13 @@ func NewGetPayloadResponse(msg proto.Message) (*GetPayloadResponse, error) {
r := &GetPayloadResponse{}
bundleGetter, hasBundle := msg.(bundleGetter)
if hasBundle {
r.BlobsBundle = bundleGetter.GetBlobsBundle()
r.BlobsBundler = bundleGetter.GetBlobsBundle()
}
bundleV2Getter, hasBundle := msg.(bundleV2Getter)
if hasBundle {
r.BlobsBundler = bundleV2Getter.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.
@@ -60,13 +68,15 @@ func NewGetPayloadResponse(msg proto.Message) (*GetPayloadResponse, error) {
}
ed, err := NewWrappedExecutionData(msg)
if err != nil {
return nil, err
return nil, errors.Wrap(err, "new wrapped execution data")
}
r.ExecutionData = ed
executionRequestsGetter, hasExecutionRequests := msg.(executionRequestsGetter)
if hasExecutionRequests {
requests, err := executionRequestsGetter.GetDecodedExecutionRequests(params.BeaconConfig().ExecutionRequestLimits())
if err != nil {
return nil, err
return nil, errors.Wrap(err, "get decoded execution requests")
}
r.ExecutionRequests = requests
}