@@ -94,13 +94,22 @@ type executableDataMarshaling struct {
9494 ExcessBlobGas * hexutil.Uint64
9595}
9696
97+ // StatelessPayloadStatusV1 is the result of a stateless payload execution.
98+ type StatelessPayloadStatusV1 struct {
99+ Status string `json:"status"`
100+ StateRoot common.Hash `json:"stateRoot"`
101+ ReceiptsRoot common.Hash `json:"receiptsRoot"`
102+ ValidationError * string `json:"validationError"`
103+ }
104+
97105//go:generate go run github.com/fjl/gencodec -type ExecutionPayloadEnvelope -field-override executionPayloadEnvelopeMarshaling -out gen_epe.go
98106
99107type ExecutionPayloadEnvelope struct {
100108 ExecutionPayload * ExecutableData `json:"executionPayload" gencodec:"required"`
101109 BlockValue * big.Int `json:"blockValue" gencodec:"required"`
102110 BlobsBundle * BlobsBundleV1 `json:"blobsBundle"`
103111 Override bool `json:"shouldOverrideBuilder"`
112+ Witness * hexutil.Bytes `json:"witness"`
104113}
105114
106115type BlobsBundleV1 struct {
@@ -115,9 +124,10 @@ type executionPayloadEnvelopeMarshaling struct {
115124}
116125
117126type PayloadStatusV1 struct {
118- Status string `json:"status"`
119- LatestValidHash * common.Hash `json:"latestValidHash"`
120- ValidationError * string `json:"validationError"`
127+ Status string `json:"status"`
128+ Witness * hexutil.Bytes `json:"witness"`
129+ LatestValidHash * common.Hash `json:"latestValidHash"`
130+ ValidationError * string `json:"validationError"`
121131}
122132
123133type TransitionConfigurationV1 struct {
@@ -198,6 +208,20 @@ func decodeTransactions(enc [][]byte) ([]*types.Transaction, error) {
198208// Withdrawals value will propagate through the returned block. Empty
199209// Withdrawals value must be passed via non-nil, length 0 value in data.
200210func ExecutableDataToBlock (data ExecutableData , versionedHashes []common.Hash , beaconRoot * common.Hash ) (* types.Block , error ) {
211+ block , err := ExecutableDataToBlockNoHash (data , versionedHashes , beaconRoot )
212+ if err != nil {
213+ return nil , err
214+ }
215+ if block .Hash () != data .BlockHash {
216+ return nil , fmt .Errorf ("blockhash mismatch, want %x, got %x" , data .BlockHash , block .Hash ())
217+ }
218+ return block , nil
219+ }
220+
221+ // ExecutableDataToBlockNoHash is analogous to ExecutableDataToBlock, but is used
222+ // for stateless execution, so it skips checking if the executable data hashes to
223+ // the requested hash (stateless has to *compute* the root hash, it's not given).
224+ func ExecutableDataToBlockNoHash (data ExecutableData , versionedHashes []common.Hash , beaconRoot * common.Hash ) (* types.Block , error ) {
201225 txs , err := decodeTransactions (data .Transactions )
202226 if err != nil {
203227 return nil , err
@@ -267,13 +291,10 @@ func ExecutableDataToBlock(data ExecutableData, versionedHashes []common.Hash, b
267291 ParentBeaconRoot : beaconRoot ,
268292 RequestsHash : requestsHash ,
269293 }
270- block := types .NewBlockWithHeader (header )
271- block = block .WithBody (types.Body {Transactions : txs , Uncles : nil , Withdrawals : data .Withdrawals , Requests : requests })
272- block = block .WithWitness (data .ExecutionWitness )
273- if block .Hash () != data .BlockHash {
274- return nil , fmt .Errorf ("blockhash mismatch, want %x, got %x" , data .BlockHash , block .Hash ())
275- }
276- return block , nil
294+ return types .NewBlockWithHeader (header ).
295+ WithBody (types.Body {Transactions : txs , Uncles : nil , Withdrawals : data .Withdrawals , Requests : requests }).
296+ WithWitness (data .ExecutionWitness ),
297+ nil
277298}
278299
279300// BlockToExecutableData constructs the ExecutableData structure by filling the
0 commit comments