@@ -12,15 +12,22 @@ use std::{
1212} ;
1313
1414use alloy:: {
15- consensus:: { BlockHeader , TxEnvelope } , hex, network:: {
15+ consensus:: { BlockHeader , TxEnvelope } ,
16+ hex,
17+ network:: {
1618 Ethereum , EthereumWallet , Network , TransactionBuilder , TransactionBuilderError ,
1719 UnbuiltTransactionError ,
18- } , primitives:: { Address , BlockNumber , Bloom , Bytes , B256 , B64 , U256 } , providers:: { ext:: DebugApi , Provider , ProviderBuilder } , rpc:: types:: {
19- eth:: { Block , Header , Transaction } , trace:: geth:: { DiffMode , GethDebugTracingOptions , PreStateConfig , PreStateFrame } , TransactionReceipt
20- }
20+ } ,
21+ primitives:: { Address , B64 , B256 , BlockNumber , Bloom , Bytes , U256 } ,
22+ providers:: { Provider , ProviderBuilder , ext:: DebugApi } ,
23+ rpc:: types:: {
24+ TransactionReceipt ,
25+ eth:: { Block , Header , Transaction } ,
26+ trace:: geth:: { DiffMode , GethDebugTracingOptions , PreStateConfig , PreStateFrame } ,
27+ } ,
2128} ;
29+ use serde:: { Deserialize , Serialize } ;
2230use serde_json:: { Value as JsonValue , json} ;
23- use serde:: { Serialize , Deserialize } ;
2431use sp_core:: crypto:: Ss58Codec ;
2532use sp_runtime:: AccountId32 ;
2633
@@ -435,21 +442,17 @@ impl TransactionBuilder<KitchenSinkNetwork> for <Ethereum as Network>::Transacti
435442 }
436443
437444 fn from ( & self ) -> Option < Address > {
438- <<Ethereum as Network >:: TransactionRequest as TransactionBuilder < Ethereum > >:: from (
439- self ,
440- )
445+ <<Ethereum as Network >:: TransactionRequest as TransactionBuilder < Ethereum > >:: from ( self )
441446 }
442447
443448 fn set_from ( & mut self , from : Address ) {
444449 <<Ethereum as Network >:: TransactionRequest as TransactionBuilder < Ethereum > >:: set_from (
445- self , from
450+ self , from,
446451 )
447452 }
448453
449454 fn kind ( & self ) -> Option < alloy:: primitives:: TxKind > {
450- <<Ethereum as Network >:: TransactionRequest as TransactionBuilder < Ethereum > >:: kind (
451- self ,
452- )
455+ <<Ethereum as Network >:: TransactionRequest as TransactionBuilder < Ethereum > >:: kind ( self )
453456 }
454457
455458 fn clear_kind ( & mut self ) {
@@ -460,37 +463,33 @@ impl TransactionBuilder<KitchenSinkNetwork> for <Ethereum as Network>::Transacti
460463
461464 fn set_kind ( & mut self , kind : alloy:: primitives:: TxKind ) {
462465 <<Ethereum as Network >:: TransactionRequest as TransactionBuilder < Ethereum > >:: set_kind (
463- self , kind
466+ self , kind,
464467 )
465468 }
466469
467470 fn value ( & self ) -> Option < alloy:: primitives:: U256 > {
468- <<Ethereum as Network >:: TransactionRequest as TransactionBuilder < Ethereum > >:: value (
469- self
470- )
471+ <<Ethereum as Network >:: TransactionRequest as TransactionBuilder < Ethereum > >:: value ( self )
471472 }
472473
473474 fn set_value ( & mut self , value : alloy:: primitives:: U256 ) {
474475 <<Ethereum as Network >:: TransactionRequest as TransactionBuilder < Ethereum > >:: set_value (
475- self , value
476+ self , value,
476477 )
477478 }
478479
479480 fn gas_price ( & self ) -> Option < u128 > {
480- <<Ethereum as Network >:: TransactionRequest as TransactionBuilder < Ethereum > >:: gas_price (
481- self ,
482- )
481+ <<Ethereum as Network >:: TransactionRequest as TransactionBuilder < Ethereum > >:: gas_price ( self )
483482 }
484483
485484 fn set_gas_price ( & mut self , gas_price : u128 ) {
486485 <<Ethereum as Network >:: TransactionRequest as TransactionBuilder < Ethereum > >:: set_gas_price (
487- self , gas_price
486+ self , gas_price,
488487 )
489488 }
490489
491490 fn max_fee_per_gas ( & self ) -> Option < u128 > {
492491 <<Ethereum as Network >:: TransactionRequest as TransactionBuilder < Ethereum > >:: max_fee_per_gas (
493- self ,
492+ self ,
494493 )
495494 }
496495
@@ -502,7 +501,7 @@ impl TransactionBuilder<KitchenSinkNetwork> for <Ethereum as Network>::Transacti
502501
503502 fn max_priority_fee_per_gas ( & self ) -> Option < u128 > {
504503 <<Ethereum as Network >:: TransactionRequest as TransactionBuilder < Ethereum > >:: max_priority_fee_per_gas (
505- self ,
504+ self ,
506505 )
507506 }
508507
@@ -513,26 +512,25 @@ impl TransactionBuilder<KitchenSinkNetwork> for <Ethereum as Network>::Transacti
513512 }
514513
515514 fn gas_limit ( & self ) -> Option < u64 > {
516- <<Ethereum as Network >:: TransactionRequest as TransactionBuilder < Ethereum > >:: gas_limit (
517- self ,
518- )
515+ <<Ethereum as Network >:: TransactionRequest as TransactionBuilder < Ethereum > >:: gas_limit ( self )
519516 }
520517
521518 fn set_gas_limit ( & mut self , gas_limit : u64 ) {
522519 <<Ethereum as Network >:: TransactionRequest as TransactionBuilder < Ethereum > >:: set_gas_limit (
523- self , gas_limit
520+ self , gas_limit,
524521 )
525522 }
526523
527524 fn access_list ( & self ) -> Option < & alloy:: rpc:: types:: AccessList > {
528525 <<Ethereum as Network >:: TransactionRequest as TransactionBuilder < Ethereum > >:: access_list (
529- self ,
526+ self ,
530527 )
531528 }
532529
533530 fn set_access_list ( & mut self , access_list : alloy:: rpc:: types:: AccessList ) {
534531 <<Ethereum as Network >:: TransactionRequest as TransactionBuilder < Ethereum > >:: set_access_list (
535- self , access_list
532+ self ,
533+ access_list,
536534 )
537535 }
538536
@@ -541,37 +539,35 @@ impl TransactionBuilder<KitchenSinkNetwork> for <Ethereum as Network>::Transacti
541539 ty : <KitchenSinkNetwork as Network >:: TxType ,
542540 ) -> Result < ( ) , Vec < & ' static str > > {
543541 <<Ethereum as Network >:: TransactionRequest as TransactionBuilder < Ethereum > >:: complete_type (
544- self , ty
542+ self , ty,
545543 )
546544 }
547545
548546 fn can_submit ( & self ) -> bool {
549547 <<Ethereum as Network >:: TransactionRequest as TransactionBuilder < Ethereum > >:: can_submit (
550- self ,
548+ self ,
551549 )
552550 }
553551
554552 fn can_build ( & self ) -> bool {
555- <<Ethereum as Network >:: TransactionRequest as TransactionBuilder < Ethereum > >:: can_build (
556- self ,
557- )
553+ <<Ethereum as Network >:: TransactionRequest as TransactionBuilder < Ethereum > >:: can_build ( self )
558554 }
559555
560556 fn output_tx_type ( & self ) -> <KitchenSinkNetwork as Network >:: TxType {
561557 <<Ethereum as Network >:: TransactionRequest as TransactionBuilder < Ethereum > >:: output_tx_type (
562- self ,
558+ self ,
563559 )
564560 }
565561
566562 fn output_tx_type_checked ( & self ) -> Option < <KitchenSinkNetwork as Network >:: TxType > {
567563 <<Ethereum as Network >:: TransactionRequest as TransactionBuilder < Ethereum > >:: output_tx_type_checked (
568- self ,
564+ self ,
569565 )
570566 }
571567
572568 fn prep_for_submission ( & mut self ) {
573569 <<Ethereum as Network >:: TransactionRequest as TransactionBuilder < Ethereum > >:: prep_for_submission (
574- self ,
570+ self ,
575571 )
576572 }
577573
@@ -617,8 +613,7 @@ impl TransactionBuilder<KitchenSinkNetwork> for <Ethereum as Network>::Transacti
617613 }
618614}
619615
620- #[ derive( Clone , Debug , PartialEq , Eq , Hash ) ]
621- #[ derive( Serialize , Deserialize ) ]
616+ #[ derive( Clone , Debug , PartialEq , Eq , Hash , Serialize , Deserialize ) ]
622617#[ serde( rename_all = "camelCase" ) ]
623618pub struct KitchenSinkHeader {
624619 /// The Keccak 256-bit hash of the parent
@@ -652,7 +647,7 @@ pub struct KitchenSinkHeader {
652647 #[ serde( with = "alloy::serde::quantity" ) ]
653648 pub number : BlockNumber ,
654649 /// A scalar value equal to the current limit of gas expenditure per block; formally Hl.
655- // This is the main difference over the Ethereum network implementation. We use u128 here and
650+ // This is the main difference over the Ethereum network implementation. We use u128 here and
656651 // not u64.
657652 #[ serde( with = "alloy::serde::quantity" ) ]
658653 pub gas_limit : u128 ,
@@ -764,8 +759,8 @@ impl BlockHeader for KitchenSinkHeader {
764759 self . number
765760 }
766761
767- // There's sadly nothing that we can do about this. We're required to implement this trait on
768- // any type that represents a header and the gas limit type used here is a u64.
762+ // There's sadly nothing that we can do about this. We're required to implement this trait on
763+ // any type that represents a header and the gas limit type used here is a u64.
769764 fn gas_limit ( & self ) -> u64 {
770765 self . gas_limit . try_into ( ) . unwrap_or ( u64:: MAX )
771766 }
0 commit comments