File tree Expand file tree Collapse file tree 2 files changed +18
-3
lines changed Expand file tree Collapse file tree 2 files changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -2357,6 +2357,7 @@ mod tests {
23572357 use alloy:: signers:: SignerSync ;
23582358 use alloy:: { consensus:: constants:: ETH_TO_WEI , rpc:: types:: TransactionRequest } ;
23592359
2360+ use revm:: context:: transaction:: AuthorizationTr ;
23602361 use revm:: database:: InMemoryDB ;
23612362 use revm:: inspector:: NoOpInspector ;
23622363 use revm:: primitives:: bytes;
@@ -2417,6 +2418,7 @@ mod tests {
24172418 } ;
24182419 let signature = BOB . sign_hash_sync ( & authorization. signature_hash ( ) ) . unwrap ( ) ;
24192420 let signed_authorization = authorization. into_signed ( signature) ;
2421+ assert ! ( signed_authorization. authority( ) . unwrap( ) == BOB . address( ) ) ;
24202422
24212423 let tx = TransactionRequest :: default ( )
24222424 . from ( ALICE . address ( ) )
Original file line number Diff line number Diff line change @@ -359,9 +359,22 @@ impl Tx for alloy::rpc::types::TransactionRequest {
359359
360360 * caller = self . from . unwrap_or_default ( ) ;
361361
362- // NB: this is set to max if not provided, as users will typically
363- // intend that to mean "as much as possible"
364- * tx_type = self . transaction_type . unwrap_or ( TxType :: Eip1559 as u8 ) ;
362+ // Determine the minimal tx type usable.
363+ * tx_type = {
364+ if self . transaction_type . is_some ( ) {
365+ self . transaction_type . unwrap ( )
366+ } else if self . authorization_list . is_some ( ) {
367+ TxType :: Eip7702 as u8
368+ } else if self . has_eip4844_fields ( ) {
369+ TxType :: Eip4844 as u8
370+ } else if self . has_eip1559_fields ( ) {
371+ TxType :: Eip1559 as u8
372+ } else if self . access_list . is_some ( ) {
373+ TxType :: Eip2930 as u8
374+ } else {
375+ TxType :: Legacy as u8
376+ }
377+ } ;
365378 * gas_limit = self . gas . unwrap_or ( u64:: MAX ) ;
366379 * gas_price =
367380 self . gas_price . unwrap_or_default ( ) . max ( self . max_fee_per_gas . unwrap_or_default ( ) ) ;
You can’t perform that action at this time.
0 commit comments