@@ -593,8 +593,7 @@ func (api *ConsensusAPI) NewPayloadV3(params engine.ExecutableData, versionedHas
593
593
}
594
594
595
595
// NewPayloadV4 creates an Eth1 block, inserts it in the chain, and returns the status of the chain.
596
- // NewPayloadV4 creates an Eth1 block, inserts it in the chain, and returns the status of the chain.
597
- func (api * ConsensusAPI ) NewPayloadV4 (params engine.ExecutableData , versionedHashes []common.Hash , beaconRoot * common.Hash , requests [][]byte ) (engine.PayloadStatusV1 , error ) {
596
+ func (api * ConsensusAPI ) NewPayloadV4 (params engine.ExecutableData , versionedHashes []common.Hash , beaconRoot * common.Hash , executionRequests []hexutil.Bytes ) (engine.PayloadStatusV1 , error ) {
598
597
if params .Withdrawals == nil {
599
598
return engine.PayloadStatusV1 {Status : engine .INVALID }, engine .InvalidParams .With (errors .New ("nil withdrawals post-shanghai" ))
600
599
}
@@ -611,13 +610,14 @@ func (api *ConsensusAPI) NewPayloadV4(params engine.ExecutableData, versionedHas
611
610
if beaconRoot == nil {
612
611
return engine.PayloadStatusV1 {Status : engine .INVALID }, engine .InvalidParams .With (errors .New ("nil beaconRoot post-cancun" ))
613
612
}
614
- if requests == nil {
613
+ if executionRequests == nil {
615
614
return engine.PayloadStatusV1 {Status : engine .INVALID }, engine .InvalidParams .With (errors .New ("nil executionRequests post-prague" ))
616
615
}
617
616
618
617
if api .eth .BlockChain ().Config ().LatestFork (params .Timestamp ) != forks .Prague {
619
618
return engine.PayloadStatusV1 {Status : engine .INVALID }, engine .UnsupportedFork .With (errors .New ("newPayloadV4 must only be called for prague payloads" ))
620
619
}
620
+ requests := convertRequests (executionRequests )
621
621
return api .newPayload (params , versionedHashes , beaconRoot , requests , false )
622
622
}
623
623
@@ -682,7 +682,7 @@ func (api *ConsensusAPI) NewPayloadWithWitnessV3(params engine.ExecutableData, v
682
682
683
683
// NewPayloadWithWitnessV4 is analogous to NewPayloadV4, only it also generates
684
684
// and returns a stateless witness after running the payload.
685
- func (api * ConsensusAPI ) NewPayloadWithWitnessV4 (params engine.ExecutableData , versionedHashes []common.Hash , beaconRoot * common.Hash , requests [][] byte ) (engine.PayloadStatusV1 , error ) {
685
+ func (api * ConsensusAPI ) NewPayloadWithWitnessV4 (params engine.ExecutableData , versionedHashes []common.Hash , beaconRoot * common.Hash , executionRequests []hexutil. Bytes ) (engine.PayloadStatusV1 , error ) {
686
686
if params .Withdrawals == nil {
687
687
return engine.PayloadStatusV1 {Status : engine .INVALID }, engine .InvalidParams .With (errors .New ("nil withdrawals post-shanghai" ))
688
688
}
@@ -699,13 +699,14 @@ func (api *ConsensusAPI) NewPayloadWithWitnessV4(params engine.ExecutableData, v
699
699
if beaconRoot == nil {
700
700
return engine.PayloadStatusV1 {Status : engine .INVALID }, engine .InvalidParams .With (errors .New ("nil beaconRoot post-cancun" ))
701
701
}
702
- if requests == nil {
702
+ if executionRequests == nil {
703
703
return engine.PayloadStatusV1 {Status : engine .INVALID }, engine .InvalidParams .With (errors .New ("nil executionRequests post-prague" ))
704
704
}
705
705
706
706
if api .eth .BlockChain ().Config ().LatestFork (params .Timestamp ) != forks .Prague {
707
707
return engine.PayloadStatusV1 {Status : engine .INVALID }, engine .UnsupportedFork .With (errors .New ("newPayloadWithWitnessV4 must only be called for prague payloads" ))
708
708
}
709
+ requests := convertRequests (executionRequests )
709
710
return api .newPayload (params , versionedHashes , beaconRoot , requests , true )
710
711
}
711
712
@@ -770,7 +771,7 @@ func (api *ConsensusAPI) ExecuteStatelessPayloadV3(params engine.ExecutableData,
770
771
771
772
// ExecuteStatelessPayloadV4 is analogous to NewPayloadV4, only it operates in
772
773
// a stateless mode on top of a provided witness instead of the local database.
773
- func (api * ConsensusAPI ) ExecuteStatelessPayloadV4 (params engine.ExecutableData , versionedHashes []common.Hash , beaconRoot * common.Hash , requests [][] byte , opaqueWitness hexutil.Bytes ) (engine.StatelessPayloadStatusV1 , error ) {
774
+ func (api * ConsensusAPI ) ExecuteStatelessPayloadV4 (params engine.ExecutableData , versionedHashes []common.Hash , beaconRoot * common.Hash , executionRequests []hexutil. Bytes , opaqueWitness hexutil.Bytes ) (engine.StatelessPayloadStatusV1 , error ) {
774
775
if params .Withdrawals == nil {
775
776
return engine.StatelessPayloadStatusV1 {Status : engine .INVALID }, engine .InvalidParams .With (errors .New ("nil withdrawals post-shanghai" ))
776
777
}
@@ -787,13 +788,14 @@ func (api *ConsensusAPI) ExecuteStatelessPayloadV4(params engine.ExecutableData,
787
788
if beaconRoot == nil {
788
789
return engine.StatelessPayloadStatusV1 {Status : engine .INVALID }, engine .InvalidParams .With (errors .New ("nil beaconRoot post-cancun" ))
789
790
}
790
- if requests == nil {
791
+ if executionRequests == nil {
791
792
return engine.StatelessPayloadStatusV1 {Status : engine .INVALID }, engine .InvalidParams .With (errors .New ("nil executionRequests post-prague" ))
792
793
}
793
794
794
795
if api .eth .BlockChain ().Config ().LatestFork (params .Timestamp ) != forks .Prague {
795
796
return engine.StatelessPayloadStatusV1 {Status : engine .INVALID }, engine .UnsupportedFork .With (errors .New ("executeStatelessPayloadV4 must only be called for prague payloads" ))
796
797
}
798
+ requests := convertRequests (executionRequests )
797
799
return api .executeStatelessPayload (params , versionedHashes , beaconRoot , requests , opaqueWitness )
798
800
}
799
801
@@ -929,7 +931,6 @@ func (api *ConsensusAPI) newPayload(params engine.ExecutableData, versionedHashe
929
931
930
932
func (api * ConsensusAPI ) executeStatelessPayload (params engine.ExecutableData , versionedHashes []common.Hash , beaconRoot * common.Hash , requests [][]byte , opaqueWitness hexutil.Bytes ) (engine.StatelessPayloadStatusV1 , error ) {
931
933
log .Trace ("Engine API request received" , "method" , "ExecuteStatelessPayload" , "number" , params .Number , "hash" , params .BlockHash )
932
-
933
934
block , err := engine .ExecutableDataToBlockNoHash (params , versionedHashes , beaconRoot , requests )
934
935
if err != nil {
935
936
bgu := "nil"
@@ -1254,3 +1255,15 @@ func getBody(block *types.Block) *engine.ExecutionPayloadBody {
1254
1255
1255
1256
return & result
1256
1257
}
1258
+
1259
+ // convertRequests converts a hex requests slice to plain [][]byte.
1260
+ func convertRequests (hex []hexutil.Bytes ) [][]byte {
1261
+ if hex == nil {
1262
+ return nil
1263
+ }
1264
+ req := make ([][]byte , len (hex ))
1265
+ for i := range hex {
1266
+ req [i ] = hex [i ]
1267
+ }
1268
+ return req
1269
+ }
0 commit comments