@@ -413,6 +413,10 @@ func (api *ConsensusAPI) GetPayloadV1(payloadID engine.PayloadID) (*engine.Execu
413
413
if err != nil {
414
414
return nil , err
415
415
}
416
+ // Check if the payload timestamp is greater or equal to Shanghai activation timestamp
417
+ if data .ExecutionPayload != nil && api .config ().LatestFork (data .ExecutionPayload .Timestamp ) >= forks .Shanghai {
418
+ return nil , engine .UnsupportedFork .With (errors .New ("engine_getPayloadV1 is not available after Shanghai fork" ))
419
+ }
416
420
return data .ExecutionPayload , nil
417
421
}
418
422
@@ -428,7 +432,15 @@ func (api *ConsensusAPI) GetPayloadV2(payloadID engine.PayloadID) (*engine.Execu
428
432
if ! payloadID .Is (engine .PayloadV1 , engine .PayloadV2 ) {
429
433
return nil , engine .UnsupportedFork
430
434
}
431
- return api .getPayload (payloadID , false )
435
+ data , err := api .getPayload (payloadID , false )
436
+ if err != nil {
437
+ return nil , err
438
+ }
439
+ // Check if the payload timestamp is greater or equal to Cancun activation timestamp
440
+ if data .ExecutionPayload != nil && api .config ().LatestFork (data .ExecutionPayload .Timestamp ) >= forks .Cancun {
441
+ return nil , engine .UnsupportedFork .With (errors .New ("engine_getPayloadV2 is not available after Cancun fork" ))
442
+ }
443
+ return data , nil
432
444
}
433
445
434
446
// GetPayloadV3 returns a cached payload by id. This endpoint should only
@@ -437,7 +449,15 @@ func (api *ConsensusAPI) GetPayloadV3(payloadID engine.PayloadID) (*engine.Execu
437
449
if ! payloadID .Is (engine .PayloadV3 ) {
438
450
return nil , engine .UnsupportedFork
439
451
}
440
- return api .getPayload (payloadID , false )
452
+ data , err := api .getPayload (payloadID , false )
453
+ if err != nil {
454
+ return nil , err
455
+ }
456
+ // Check if the payload timestamp is greater or equal to Prague activation timestamp
457
+ if data .ExecutionPayload != nil && api .config ().LatestFork (data .ExecutionPayload .Timestamp ) >= forks .Prague {
458
+ return nil , engine .UnsupportedFork .With (errors .New ("engine_getPayloadV3 is not available after Prague fork" ))
459
+ }
460
+ return data , nil
441
461
}
442
462
443
463
// GetPayloadV4 returns a cached payload by id. This endpoint should only
@@ -450,7 +470,6 @@ func (api *ConsensusAPI) GetPayloadV4(payloadID engine.PayloadID) (*engine.Execu
450
470
if err != nil {
451
471
return nil , err
452
472
}
453
-
454
473
// Check if the payload timestamp is greater or equal to Osaka activation timestamp
455
474
if data .ExecutionPayload != nil && api .config ().LatestFork (data .ExecutionPayload .Timestamp ) >= forks .Osaka {
456
475
return nil , engine .UnsupportedFork .With (errors .New ("engine_getPayloadV4 is not available after Osaka fork" ))
@@ -471,10 +490,9 @@ func (api *ConsensusAPI) GetPayloadV5(payloadID engine.PayloadID) (*engine.Execu
471
490
if err != nil {
472
491
return nil , err
473
492
}
474
-
475
493
// Check if the payload timestamp falls within the time frame of the Osaka fork
476
494
if data .ExecutionPayload != nil && api .config ().LatestFork (data .ExecutionPayload .Timestamp ) < forks .Osaka {
477
- return nil , engine .UnsupportedFork .With (errors .New ("engine_getPayloadV5 is not available after Osaka fork" ))
495
+ return nil , engine .UnsupportedFork .With (errors .New ("engine_getPayloadV5 is not available before Osaka fork" ))
478
496
}
479
497
return data , nil
480
498
}
0 commit comments