@@ -200,6 +200,39 @@ public async Task NewPayloadV4_reject_payload_with_bad_authorization_list_rlp()
200200 Assert . That ( response . Data . Status , Is . EqualTo ( "INVALID" ) ) ;
201201 }
202202
203+ [ Test ]
204+ public async Task NewPayloadV4_reject_payload_with_bad_execution_requests ( )
205+ {
206+ ExecutionRequestsProcessorMock executionRequestsProcessorMock = new ( ) ;
207+ using MergeTestBlockchain chain = await CreateBlockchain ( Prague . Instance , null , null , null , executionRequestsProcessorMock ) ;
208+ IEngineRpcModule rpc = CreateEngineModule ( chain ) ;
209+ Hash256 lastHash = ( await ProduceBranchV4 ( rpc , chain , 10 , CreateParentBlockRequestOnHead ( chain . BlockTree ) , true , withRequests : true ) )
210+ . LastOrDefault ( ) ? . BlockHash ?? Keccak . Zero ;
211+
212+ Block TestBlock = Build . A . Block . WithNumber ( chain . BlockTree . Head ! . Number + 1 ) . TestObject ;
213+ ExecutionPayloadV3 executionPayload = ExecutionPayloadV3 . Create ( TestBlock ) ;
214+
215+ // must reject if execution requests types are not in ascending order
216+ var response = await rpc . engine_newPayloadV4 (
217+ executionPayload ,
218+ [ ] ,
219+ TestBlock . ParentBeaconBlockRoot ,
220+ executionRequests : [ Bytes . FromHexString ( "0x0001" ) , Bytes . FromHexString ( "0x0101" ) , Bytes . FromHexString ( "0x0101" ) ]
221+ ) ;
222+
223+ Assert . That ( response . ErrorCode , Is . EqualTo ( ErrorCodes . InvalidParams ) ) ;
224+
225+ //must reject if one of the execution requests size is <= 1 byte
226+ response = await rpc . engine_newPayloadV4 (
227+ executionPayload ,
228+ [ ] ,
229+ TestBlock . ParentBeaconBlockRoot ,
230+ executionRequests : [ Bytes . FromHexString ( "0x0001" ) , Bytes . FromHexString ( "0x01" ) , Bytes . FromHexString ( "0x0101" ) ]
231+ ) ;
232+
233+ Assert . That ( response . ErrorCode , Is . EqualTo ( ErrorCodes . InvalidParams ) ) ;
234+ }
235+
203236 [ TestCase ( 30 ) ]
204237 public async Task can_progress_chain_one_by_one_v4 ( int count )
205238 {
@@ -247,7 +280,7 @@ private async Task<IReadOnlyList<ExecutionPayload>> ProduceBranchV4(IEngineRpcMo
247280 ExecutionPayloadV3 ? getPayloadResult = await BuildAndGetPayloadOnBranchV4 ( rpc , chain , parentHeader ,
248281 parentBlock . Timestamp + 12 ,
249282 random ?? TestItem . KeccakA , Address . Zero ) ;
250- PayloadStatusV1 payloadStatusResponse = ( await rpc . engine_newPayloadV4 ( getPayloadResult , [ ] , Keccak . Zero , executionRequests : withRequests ? ExecutionRequestsProcessorMock . Requests : new byte [ ] [ ] { [ ] , [ ] , [ ] } ) ) . Data ;
283+ PayloadStatusV1 payloadStatusResponse = ( await rpc . engine_newPayloadV4 ( getPayloadResult , [ ] , Keccak . Zero , executionRequests : withRequests ? ExecutionRequestsProcessorMock . Requests : new byte [ ] [ ] { } ) ) . Data ;
251284 payloadStatusResponse . Status . Should ( ) . Be ( PayloadStatus . Valid ) ;
252285 if ( setHead )
253286 {
0 commit comments