@@ -240,8 +240,8 @@ func (api *ConsensusAPI) ForkchoiceUpdatedV3(update engine.ForkchoiceStateV1, pa
240
240
return engine .STATUS_INVALID , attributesErr ("missing withdrawals" )
241
241
case params .BeaconRoot == nil :
242
242
return engine .STATUS_INVALID , attributesErr ("missing beacon root" )
243
- case ! api .checkFork (params .Timestamp , forks .Cancun , forks .Prague ):
244
- return engine .STATUS_INVALID , unsupportedForkErr ("fcuV3 must only be called for cancun or prague payloads" )
243
+ case ! api .checkFork (params .Timestamp , forks .Cancun , forks .Prague , forks . Eip7805 ):
244
+ return engine .STATUS_INVALID , unsupportedForkErr ("fcuV3 must only be called for cancun, prague or eip7805 payloads" )
245
245
}
246
246
}
247
247
// TODO(matt): the spec requires that fcu is applied when called on a valid
@@ -287,13 +287,14 @@ func (api *ConsensusAPI) ForkchoiceUpdatedWithWitnessV2(update engine.Forkchoice
287
287
// generates an execution witness too if block building was requested.
288
288
func (api * ConsensusAPI ) ForkchoiceUpdatedWithWitnessV3 (update engine.ForkchoiceStateV1 , params * engine.PayloadAttributes ) (engine.ForkChoiceResponse , error ) {
289
289
if params != nil {
290
- switch {
291
- case params .Withdrawals == nil :
292
- return engine .STATUS_INVALID , attributesErr ("missing withdrawals" )
293
- case params .BeaconRoot == nil :
294
- return engine .STATUS_INVALID , attributesErr ("missing beacon root" )
295
- case ! api .checkFork (params .Timestamp , forks .Cancun , forks .Prague ):
296
- return engine .STATUS_INVALID , unsupportedForkErr ("fcuV3 must only be called for cancun or prague payloads" )
290
+ if params .Withdrawals == nil {
291
+ return engine .STATUS_INVALID , engine .InvalidPayloadAttributes .With (errors .New ("missing withdrawals" ))
292
+ }
293
+ if params .BeaconRoot == nil {
294
+ return engine .STATUS_INVALID , engine .InvalidPayloadAttributes .With (errors .New ("missing beacon root" ))
295
+ }
296
+ if api .eth .BlockChain ().Config ().LatestFork (params .Timestamp ) != forks .Cancun && api .eth .BlockChain ().Config ().LatestFork (params .Timestamp ) != forks .Prague {
297
+ return engine .STATUS_INVALID , engine .UnsupportedFork .With (errors .New ("forkchoiceUpdatedV3 must only be called for cancun payloads" ))
297
298
}
298
299
}
299
300
// TODO(matt): the spec requires that fcu is applied when called on a valid
@@ -633,21 +634,28 @@ func (api *ConsensusAPI) NewPayloadV3(params engine.ExecutableData, versionedHas
633
634
634
635
// NewPayloadV4 creates an Eth1 block, inserts it in the chain, and returns the status of the chain.
635
636
func (api * ConsensusAPI ) NewPayloadV4 (params engine.ExecutableData , versionedHashes []common.Hash , beaconRoot * common.Hash , executionRequests []hexutil.Bytes ) (engine.PayloadStatusV1 , error ) {
636
- switch {
637
- case params .Withdrawals == nil :
638
- return invalidStatus , paramsErr ("nil withdrawals post-shanghai" )
639
- case params .ExcessBlobGas == nil :
640
- return invalidStatus , paramsErr ("nil excessBlobGas post-cancun" )
641
- case params .BlobGasUsed == nil :
642
- return invalidStatus , paramsErr ("nil blobGasUsed post-cancun" )
643
- case versionedHashes == nil :
644
- return invalidStatus , paramsErr ("nil versionedHashes post-cancun" )
645
- case beaconRoot == nil :
646
- return invalidStatus , paramsErr ("nil beaconRoot post-cancun" )
647
- case executionRequests == nil :
648
- return invalidStatus , paramsErr ("nil executionRequests post-prague" )
649
- case ! api .checkFork (params .Timestamp , forks .Prague ):
650
- return invalidStatus , unsupportedForkErr ("newPayloadV3 must only be called for cancun payloads" )
637
+ if params .Withdrawals == nil {
638
+ return engine.PayloadStatusV1 {Status : engine .INVALID }, engine .InvalidParams .With (errors .New ("nil withdrawals post-shanghai" ))
639
+ }
640
+ if params .ExcessBlobGas == nil {
641
+ return engine.PayloadStatusV1 {Status : engine .INVALID }, engine .InvalidParams .With (errors .New ("nil excessBlobGas post-cancun" ))
642
+ }
643
+ if params .BlobGasUsed == nil {
644
+ return engine.PayloadStatusV1 {Status : engine .INVALID }, engine .InvalidParams .With (errors .New ("nil blobGasUsed post-cancun" ))
645
+ }
646
+
647
+ if versionedHashes == nil {
648
+ return engine.PayloadStatusV1 {Status : engine .INVALID }, engine .InvalidParams .With (errors .New ("nil versionedHashes post-cancun" ))
649
+ }
650
+ if beaconRoot == nil {
651
+ return engine.PayloadStatusV1 {Status : engine .INVALID }, engine .InvalidParams .With (errors .New ("nil beaconRoot post-cancun" ))
652
+ }
653
+ if executionRequests == nil {
654
+ return engine.PayloadStatusV1 {Status : engine .INVALID }, engine .InvalidParams .With (errors .New ("nil executionRequests post-prague" ))
655
+ }
656
+
657
+ if api .eth .BlockChain ().Config ().LatestFork (params .Timestamp ) != forks .Prague {
658
+ return engine.PayloadStatusV1 {Status : engine .INVALID }, engine .UnsupportedFork .With (errors .New ("newPayloadV4 must only be called for prague payloads" ))
651
659
}
652
660
requests := convertRequests (executionRequests )
653
661
if err := validateRequests (requests ); err != nil {
@@ -678,8 +686,7 @@ func (api *ConsensusAPI) NewPayloadV5(params engine.ExecutableData, versionedHas
678
686
return engine.PayloadStatusV1 {Status : engine .INVALID }, engine .InvalidParams .With (errors .New ("nil executionRequests post-prague" ))
679
687
}
680
688
681
- // Note: Osaka fork is a placeholder for FOCIL fork.
682
- if api .eth .BlockChain ().Config ().LatestFork (params .Timestamp ) != forks .Osaka {
689
+ if api .eth .BlockChain ().Config ().LatestFork (params .Timestamp ) != forks .Eip7805 {
683
690
return engine.PayloadStatusV1 {Status : engine .INVALID }, engine .UnsupportedFork .With (errors .New ("newPayloadV5 must only be called for osaka payloads" ))
684
691
}
685
692
requests := convertRequests (executionRequests )
@@ -740,21 +747,28 @@ func (api *ConsensusAPI) NewPayloadWithWitnessV3(params engine.ExecutableData, v
740
747
// NewPayloadWithWitnessV4 is analogous to NewPayloadV4, only it also generates
741
748
// and returns a stateless witness after running the payload.
742
749
func (api * ConsensusAPI ) NewPayloadWithWitnessV4 (params engine.ExecutableData , versionedHashes []common.Hash , beaconRoot * common.Hash , executionRequests []hexutil.Bytes ) (engine.PayloadStatusV1 , error ) {
743
- switch {
744
- case params .Withdrawals == nil :
745
- return invalidStatus , paramsErr ("nil withdrawals post-shanghai" )
746
- case params .ExcessBlobGas == nil :
747
- return invalidStatus , paramsErr ("nil excessBlobGas post-cancun" )
748
- case params .BlobGasUsed == nil :
749
- return invalidStatus , paramsErr ("nil blobGasUsed post-cancun" )
750
- case versionedHashes == nil :
751
- return invalidStatus , paramsErr ("nil versionedHashes post-cancun" )
752
- case beaconRoot == nil :
753
- return invalidStatus , paramsErr ("nil beaconRoot post-cancun" )
754
- case executionRequests == nil :
755
- return invalidStatus , paramsErr ("nil executionRequests post-prague" )
756
- case ! api .checkFork (params .Timestamp , forks .Prague ):
757
- return invalidStatus , unsupportedForkErr ("newPayloadV3 must only be called for cancun payloads" )
750
+ if params .Withdrawals == nil {
751
+ return engine.PayloadStatusV1 {Status : engine .INVALID }, engine .InvalidParams .With (errors .New ("nil withdrawals post-shanghai" ))
752
+ }
753
+ if params .ExcessBlobGas == nil {
754
+ return engine.PayloadStatusV1 {Status : engine .INVALID }, engine .InvalidParams .With (errors .New ("nil excessBlobGas post-cancun" ))
755
+ }
756
+ if params .BlobGasUsed == nil {
757
+ return engine.PayloadStatusV1 {Status : engine .INVALID }, engine .InvalidParams .With (errors .New ("nil blobGasUsed post-cancun" ))
758
+ }
759
+
760
+ if versionedHashes == nil {
761
+ return engine.PayloadStatusV1 {Status : engine .INVALID }, engine .InvalidParams .With (errors .New ("nil versionedHashes post-cancun" ))
762
+ }
763
+ if beaconRoot == nil {
764
+ return engine.PayloadStatusV1 {Status : engine .INVALID }, engine .InvalidParams .With (errors .New ("nil beaconRoot post-cancun" ))
765
+ }
766
+ if executionRequests == nil {
767
+ return engine.PayloadStatusV1 {Status : engine .INVALID }, engine .InvalidParams .With (errors .New ("nil executionRequests post-prague" ))
768
+ }
769
+
770
+ if api .eth .BlockChain ().Config ().LatestFork (params .Timestamp ) != forks .Prague {
771
+ return engine.PayloadStatusV1 {Status : engine .INVALID }, engine .UnsupportedFork .With (errors .New ("newPayloadWithWitnessV4 must only be called for prague payloads" ))
758
772
}
759
773
requests := convertRequests (executionRequests )
760
774
if err := validateRequests (requests ); err != nil {
@@ -789,8 +803,7 @@ func (api *ConsensusAPI) NewPayloadWithWitnessV5(params engine.ExecutableData, v
789
803
return engine.PayloadStatusV1 {Status : engine .INVALID }, engine .InvalidParams .With (errors .New ("nil inclusionList post-prague" ))
790
804
}
791
805
792
- // Note: Osaka fork is a placeholder for FOCIL fork.
793
- if api .eth .BlockChain ().Config ().LatestFork (params .Timestamp ) != forks .Osaka {
806
+ if api .eth .BlockChain ().Config ().LatestFork (params .Timestamp ) != forks .Eip7805 {
794
807
return engine.PayloadStatusV1 {Status : engine .INVALID }, engine .UnsupportedFork .With (errors .New ("newPayloadWithWitnessV5 must only be called for osaka payloads" ))
795
808
}
796
809
requests := convertRequests (executionRequests )
0 commit comments