File tree Expand file tree Collapse file tree 1 file changed +5
-20
lines changed
beacon_node/execution_layer/src/engine_api Expand file tree Collapse file tree 1 file changed +5
-20
lines changed Original file line number Diff line number Diff line change @@ -569,7 +569,7 @@ mod test {
569
569
VariableList < Transaction < E :: MaxBytesPerTransaction > , E :: MaxTransactionsPerPayload > ,
570
570
serde_json:: Error ,
571
571
> {
572
- let json = json ! ( {
572
+ let mut json = json ! ( {
573
573
"parentHash" : HASH_00 ,
574
574
"coinbase" : ADDRESS_01 ,
575
575
"stateRoot" : HASH_01 ,
@@ -583,8 +583,11 @@ mod test {
583
583
"extraData" : "0x" ,
584
584
"baseFeePerGas" : "0x1" ,
585
585
"blockHash" : HASH_01 ,
586
- "transactions" : transactions,
587
586
} ) ;
587
+ // Take advantage of the fact that we own `transactions` and don't need to reserialize it.
588
+ json. as_object_mut ( )
589
+ . unwrap ( )
590
+ . insert ( "transactions" . into ( ) , transactions) ;
588
591
let ep: JsonExecutionPayload < E > = serde_json:: from_value ( json) ?;
589
592
Ok ( ep. transactions )
590
593
}
@@ -671,24 +674,6 @@ mod test {
671
674
decode_transactions:: <MainnetEthSpec >( serde_json:: to_value( too_many_txs) . unwrap( ) )
672
675
. is_err( )
673
676
) ;
674
-
675
- /*
676
- * Check for transaction too large
677
- */
678
-
679
- use eth2_serde_utils:: hex;
680
-
681
- let num_max_bytes = <MainnetEthSpec as EthSpec >:: MaxBytesPerTransaction :: to_usize ( ) ;
682
- let max_bytes = ( 0 ..num_max_bytes) . map ( |_| 0_u8 ) . collect :: < Vec < _ > > ( ) ;
683
- let too_many_bytes = ( 0 ..=num_max_bytes) . map ( |_| 0_u8 ) . collect :: < Vec < _ > > ( ) ;
684
- decode_transactions :: < MainnetEthSpec > (
685
- serde_json:: to_value ( & [ hex:: encode ( & max_bytes) ] ) . unwrap ( ) ,
686
- )
687
- . unwrap ( ) ;
688
- assert ! ( decode_transactions:: <MainnetEthSpec >(
689
- serde_json:: to_value( & [ hex:: encode( & too_many_bytes) ] ) . unwrap( )
690
- )
691
- . is_err( ) ) ;
692
677
}
693
678
694
679
#[ tokio:: test]
You can’t perform that action at this time.
0 commit comments