@@ -6,13 +6,14 @@ use alloy::{
66} ;
77use core:: fmt;
88use signet_extract:: ExtractedEvent ;
9- use signet_types:: { primitives:: TransactionSigned , MagicSig } ;
9+ use signet_types:: { primitives:: TransactionSigned , MagicSig , MagicSigInfo } ;
1010use signet_zenith:: Transactor ;
1111use trevm:: { revm:: context:: TxEnv , Tx } ;
1212
1313/// Shim to impl [`Tx`] for [`Transactor::Transact`].
1414#[ derive( PartialEq , Eq ) ]
1515pub struct TransactSysTx {
16+ /// The transact transaction.
1617 tx : TransactionSigned ,
1718
1819 /// The nonce of the transaction.
@@ -23,20 +24,23 @@ pub struct TransactSysTx {
2324 magic_sig : MagicSig ,
2425}
2526
26- impl < ' a , R > From < & ExtractedEvent < ' a , R , Transactor :: Transact > > for TransactSysTx {
27- fn from ( transact : & ExtractedEvent < ' a , R , Transactor :: Transact > ) -> Self {
28- Self :: new ( transact)
29- }
30- }
31-
3227impl TransactSysTx {
3328 /// Instantiate a new [`TransactSysTx`].
34- pub fn new < R > ( transact : & ExtractedEvent < ' _ , R , Transactor :: Transact > ) -> Self {
35- let magic_sig = transact. magic_sig ( ) ;
36- let tx = transact. make_transaction ( 0 ) ;
29+ pub fn new < R > ( transact : & ExtractedEvent < ' _ , R , Transactor :: Transact > , aliased : bool ) -> Self {
30+ let magic_sig = transact. magic_sig ( aliased ) ;
31+ let tx = transact. make_transaction ( 0 , aliased ) ;
3732 Self { tx, nonce : None , magic_sig }
3833 }
3934
35+ /// Check if the sender was aliased (i.e. the sender is a smart contract on
36+ /// the host chain).
37+ pub fn is_aliased ( & self ) -> bool {
38+ match self . magic_sig . ty {
39+ MagicSigInfo :: Transact { aliased, .. } => aliased,
40+ _ => unreachable ! ( ) ,
41+ }
42+ }
43+
4044 /// Create a [`TransactSysLog`] from the filler.
4145 fn make_sys_log ( & self ) -> TransactSysLog {
4246 TransactSysLog {
@@ -71,7 +75,7 @@ impl Clone for TransactSysTx {
7175impl Tx for TransactSysTx {
7276 fn fill_tx_env ( & self , tx_env : & mut TxEnv ) {
7377 self . tx . as_eip1559 ( ) . unwrap ( ) . fill_tx_env ( tx_env) ;
74- tx_env. caller = self . magic_sig . sender ( ) ;
78+ tx_env. caller = self . magic_sig . rollup_sender ( ) ;
7579 }
7680}
7781
@@ -81,9 +85,11 @@ impl SysBase for TransactSysTx {
8185 }
8286
8387 fn description ( & self ) -> String {
88+ let is_aliased = if self . is_aliased ( ) { " (aliased)" } else { "" } ;
89+
8490 format ! (
85- "Transact from {} to {} with value {} and {} bytes of input data: `0x{}{}`" ,
86- self . magic_sig. sender ( ) ,
91+ "Transact from {}{is_aliased} to {} with value {} and {} bytes of input data: `0x{}{}`" ,
92+ self . magic_sig. rollup_sender ( ) ,
8793 self . tx. to( ) . expect( "creates not allowed" ) ,
8894 format_ether( self . tx. value( ) ) ,
8995 self . tx. input( ) . len( ) ,
@@ -116,7 +122,7 @@ impl SysBase for TransactSysTx {
116122 }
117123
118124 fn evm_sender ( & self ) -> Address {
119- self . magic_sig . sender ( )
125+ self . magic_sig . rollup_sender ( )
120126 }
121127}
122128
0 commit comments