@@ -6,24 +6,23 @@ use op_alloy_consensus::OpTxEnvelope;
66use op_revm:: OpTransaction ;
77use reth_ethereum:: evm:: { primitives:: TransactionEnv , revm:: context:: TxEnv } ;
88
9- /// An Optimism extended Ethereum transaction that can be fed to [`Evm`] because it contains
10- /// [`CustomTxEnv`].
9+ /// An Optimism transaction extended by [`PaymentTxEnv`] that can be fed to [`Evm`].
1110///
1211/// [`Evm`]: alloy_evm::Evm
1312#[ derive( Clone , Debug ) ]
14- pub enum CustomEvmTransaction {
13+ pub enum CustomTxEnv {
1514 Op ( OpTransaction < TxEnv > ) ,
16- Payment ( CustomTxEnv ) ,
15+ Payment ( PaymentTxEnv ) ,
1716}
1817
1918/// A transaction environment is a set of information related to an Ethereum transaction that can be
2019/// fed to [`Evm`] for execution.
2120///
2221/// [`Evm`]: alloy_evm::Evm
2322#[ derive( Clone , Debug , Default ) ]
24- pub struct CustomTxEnv ( pub TxEnv ) ;
23+ pub struct PaymentTxEnv ( pub TxEnv ) ;
2524
26- impl revm:: context:: Transaction for CustomEvmTransaction {
25+ impl revm:: context:: Transaction for CustomTxEnv {
2726 type AccessListItem < ' a >
2827 = <TxEnv as revm:: context:: Transaction >:: AccessListItem < ' a >
2928 where
@@ -35,111 +34,111 @@ impl revm::context::Transaction for CustomEvmTransaction {
3534
3635 fn tx_type ( & self ) -> u8 {
3736 match self {
38- CustomEvmTransaction :: Op ( tx) => tx. tx_type ( ) ,
39- CustomEvmTransaction :: Payment ( tx) => tx. tx_type ( ) ,
37+ Self :: Op ( tx) => tx. tx_type ( ) ,
38+ Self :: Payment ( tx) => tx. tx_type ( ) ,
4039 }
4140 }
4241
4342 fn caller ( & self ) -> Address {
4443 match self {
45- CustomEvmTransaction :: Op ( tx) => tx. caller ( ) ,
46- CustomEvmTransaction :: Payment ( tx) => tx. caller ( ) ,
44+ Self :: Op ( tx) => tx. caller ( ) ,
45+ Self :: Payment ( tx) => tx. caller ( ) ,
4746 }
4847 }
4948
5049 fn gas_limit ( & self ) -> u64 {
5150 match self {
52- CustomEvmTransaction :: Op ( tx) => tx. gas_limit ( ) ,
53- CustomEvmTransaction :: Payment ( tx) => tx. gas_limit ( ) ,
51+ Self :: Op ( tx) => tx. gas_limit ( ) ,
52+ Self :: Payment ( tx) => tx. gas_limit ( ) ,
5453 }
5554 }
5655
5756 fn value ( & self ) -> U256 {
5857 match self {
59- CustomEvmTransaction :: Op ( tx) => tx. value ( ) ,
60- CustomEvmTransaction :: Payment ( tx) => tx. value ( ) ,
58+ Self :: Op ( tx) => tx. value ( ) ,
59+ Self :: Payment ( tx) => tx. value ( ) ,
6160 }
6261 }
6362
6463 fn input ( & self ) -> & Bytes {
6564 match self {
66- CustomEvmTransaction :: Op ( tx) => tx. input ( ) ,
67- CustomEvmTransaction :: Payment ( tx) => tx. input ( ) ,
65+ Self :: Op ( tx) => tx. input ( ) ,
66+ Self :: Payment ( tx) => tx. input ( ) ,
6867 }
6968 }
7069
7170 fn nonce ( & self ) -> u64 {
7271 match self {
73- CustomEvmTransaction :: Op ( tx) => revm:: context:: Transaction :: nonce ( tx) ,
74- CustomEvmTransaction :: Payment ( tx) => revm:: context:: Transaction :: nonce ( tx) ,
72+ Self :: Op ( tx) => revm:: context:: Transaction :: nonce ( tx) ,
73+ Self :: Payment ( tx) => revm:: context:: Transaction :: nonce ( tx) ,
7574 }
7675 }
7776
7877 fn kind ( & self ) -> TxKind {
7978 match self {
80- CustomEvmTransaction :: Op ( tx) => tx. kind ( ) ,
81- CustomEvmTransaction :: Payment ( tx) => tx. kind ( ) ,
79+ Self :: Op ( tx) => tx. kind ( ) ,
80+ Self :: Payment ( tx) => tx. kind ( ) ,
8281 }
8382 }
8483
8584 fn chain_id ( & self ) -> Option < u64 > {
8685 match self {
87- CustomEvmTransaction :: Op ( tx) => tx. chain_id ( ) ,
88- CustomEvmTransaction :: Payment ( tx) => tx. chain_id ( ) ,
86+ Self :: Op ( tx) => tx. chain_id ( ) ,
87+ Self :: Payment ( tx) => tx. chain_id ( ) ,
8988 }
9089 }
9190
9291 fn gas_price ( & self ) -> u128 {
9392 match self {
94- CustomEvmTransaction :: Op ( tx) => tx. gas_price ( ) ,
95- CustomEvmTransaction :: Payment ( tx) => tx. gas_price ( ) ,
93+ Self :: Op ( tx) => tx. gas_price ( ) ,
94+ Self :: Payment ( tx) => tx. gas_price ( ) ,
9695 }
9796 }
9897
9998 fn access_list ( & self ) -> Option < impl Iterator < Item = Self :: AccessListItem < ' _ > > > {
10099 Some ( match self {
101- CustomEvmTransaction :: Op ( tx) => tx. base . access_list . iter ( ) ,
102- CustomEvmTransaction :: Payment ( tx) => tx. 0 . access_list . iter ( ) ,
100+ Self :: Op ( tx) => tx. base . access_list . iter ( ) ,
101+ Self :: Payment ( tx) => tx. 0 . access_list . iter ( ) ,
103102 } )
104103 }
105104
106105 fn blob_versioned_hashes ( & self ) -> & [ B256 ] {
107106 match self {
108- CustomEvmTransaction :: Op ( tx) => tx. blob_versioned_hashes ( ) ,
109- CustomEvmTransaction :: Payment ( tx) => tx. blob_versioned_hashes ( ) ,
107+ Self :: Op ( tx) => tx. blob_versioned_hashes ( ) ,
108+ Self :: Payment ( tx) => tx. blob_versioned_hashes ( ) ,
110109 }
111110 }
112111
113112 fn max_fee_per_blob_gas ( & self ) -> u128 {
114113 match self {
115- CustomEvmTransaction :: Op ( tx) => tx. max_fee_per_blob_gas ( ) ,
116- CustomEvmTransaction :: Payment ( tx) => tx. max_fee_per_blob_gas ( ) ,
114+ Self :: Op ( tx) => tx. max_fee_per_blob_gas ( ) ,
115+ Self :: Payment ( tx) => tx. max_fee_per_blob_gas ( ) ,
117116 }
118117 }
119118
120119 fn authorization_list_len ( & self ) -> usize {
121120 match self {
122- CustomEvmTransaction :: Op ( tx) => tx. authorization_list_len ( ) ,
123- CustomEvmTransaction :: Payment ( tx) => tx. authorization_list_len ( ) ,
121+ Self :: Op ( tx) => tx. authorization_list_len ( ) ,
122+ Self :: Payment ( tx) => tx. authorization_list_len ( ) ,
124123 }
125124 }
126125
127126 fn authorization_list ( & self ) -> impl Iterator < Item = Self :: Authorization < ' _ > > {
128127 match self {
129- CustomEvmTransaction :: Op ( tx) => tx. base . authorization_list . iter ( ) ,
130- CustomEvmTransaction :: Payment ( tx) => tx. 0 . authorization_list . iter ( ) ,
128+ Self :: Op ( tx) => tx. base . authorization_list . iter ( ) ,
129+ Self :: Payment ( tx) => tx. 0 . authorization_list . iter ( ) ,
131130 }
132131 }
133132
134133 fn max_priority_fee_per_gas ( & self ) -> Option < u128 > {
135134 match self {
136- CustomEvmTransaction :: Op ( tx) => tx. max_priority_fee_per_gas ( ) ,
137- CustomEvmTransaction :: Payment ( tx) => tx. max_priority_fee_per_gas ( ) ,
135+ Self :: Op ( tx) => tx. max_priority_fee_per_gas ( ) ,
136+ Self :: Payment ( tx) => tx. max_priority_fee_per_gas ( ) ,
138137 }
139138 }
140139}
141140
142- impl revm:: context:: Transaction for CustomTxEnv {
141+ impl revm:: context:: Transaction for PaymentTxEnv {
143142 type AccessListItem < ' a >
144143 = <TxEnv as revm:: context:: Transaction >:: AccessListItem < ' a >
145144 where
@@ -210,7 +209,7 @@ impl revm::context::Transaction for CustomTxEnv {
210209 }
211210}
212211
213- impl TransactionEnv for CustomTxEnv {
212+ impl TransactionEnv for PaymentTxEnv {
214213 fn set_gas_limit ( & mut self , gas_limit : u64 ) {
215214 self . 0 . set_gas_limit ( gas_limit) ;
216215 }
@@ -228,39 +227,39 @@ impl TransactionEnv for CustomTxEnv {
228227 }
229228}
230229
231- impl TransactionEnv for CustomEvmTransaction {
230+ impl TransactionEnv for CustomTxEnv {
232231 fn set_gas_limit ( & mut self , gas_limit : u64 ) {
233232 match self {
234- CustomEvmTransaction :: Op ( tx) => tx. set_gas_limit ( gas_limit) ,
235- CustomEvmTransaction :: Payment ( tx) => tx. set_gas_limit ( gas_limit) ,
233+ Self :: Op ( tx) => tx. set_gas_limit ( gas_limit) ,
234+ Self :: Payment ( tx) => tx. set_gas_limit ( gas_limit) ,
236235 }
237236 }
238237
239238 fn nonce ( & self ) -> u64 {
240239 match self {
241- CustomEvmTransaction :: Op ( tx) => tx. nonce ( ) ,
242- CustomEvmTransaction :: Payment ( tx) => tx. nonce ( ) ,
240+ Self :: Op ( tx) => tx. nonce ( ) ,
241+ Self :: Payment ( tx) => tx. nonce ( ) ,
243242 }
244243 }
245244
246245 fn set_nonce ( & mut self , nonce : u64 ) {
247246 match self {
248- CustomEvmTransaction :: Op ( tx) => tx. set_nonce ( nonce) ,
249- CustomEvmTransaction :: Payment ( tx) => tx. set_nonce ( nonce) ,
247+ Self :: Op ( tx) => tx. set_nonce ( nonce) ,
248+ Self :: Payment ( tx) => tx. set_nonce ( nonce) ,
250249 }
251250 }
252251
253252 fn set_access_list ( & mut self , access_list : AccessList ) {
254253 match self {
255- CustomEvmTransaction :: Op ( tx) => tx. set_access_list ( access_list) ,
256- CustomEvmTransaction :: Payment ( tx) => tx. set_access_list ( access_list) ,
254+ Self :: Op ( tx) => tx. set_access_list ( access_list) ,
255+ Self :: Payment ( tx) => tx. set_access_list ( access_list) ,
257256 }
258257 }
259258}
260259
261- impl FromRecoveredTx < CustomTransaction > for CustomTxEnv {
260+ impl FromRecoveredTx < CustomTransaction > for PaymentTxEnv {
262261 fn from_recovered_tx ( tx : & CustomTransaction , sender : Address ) -> Self {
263- CustomTxEnv ( match tx {
262+ PaymentTxEnv ( match tx {
264263 CustomTransaction :: BuiltIn ( tx) => {
265264 OpTransaction :: < TxEnv > :: from_recovered_tx ( tx, sender) . base
266265 }
@@ -269,9 +268,9 @@ impl FromRecoveredTx<CustomTransaction> for CustomTxEnv {
269268 }
270269}
271270
272- impl FromTxWithEncoded < CustomTransaction > for CustomTxEnv {
271+ impl FromTxWithEncoded < CustomTransaction > for PaymentTxEnv {
273272 fn from_encoded_tx ( tx : & CustomTransaction , sender : Address , encoded : Bytes ) -> Self {
274- CustomTxEnv ( match tx {
273+ PaymentTxEnv ( match tx {
275274 CustomTransaction :: BuiltIn ( tx) => {
276275 OpTransaction :: < TxEnv > :: from_encoded_tx ( tx, sender, encoded) . base
277276 }
@@ -318,41 +317,41 @@ impl FromTxWithEncoded<CustomTransactionEnvelope> for TxEnv {
318317 }
319318}
320319
321- impl FromRecoveredTx < OpTxEnvelope > for CustomEvmTransaction {
320+ impl FromRecoveredTx < OpTxEnvelope > for CustomTxEnv {
322321 fn from_recovered_tx ( tx : & OpTxEnvelope , sender : Address ) -> Self {
323322 Self :: Op ( OpTransaction :: from_recovered_tx ( tx, sender) )
324323 }
325324}
326325
327- impl FromTxWithEncoded < OpTxEnvelope > for CustomEvmTransaction {
326+ impl FromTxWithEncoded < OpTxEnvelope > for CustomTxEnv {
328327 fn from_encoded_tx ( tx : & OpTxEnvelope , sender : Address , encoded : Bytes ) -> Self {
329328 Self :: Op ( OpTransaction :: from_encoded_tx ( tx, sender, encoded) )
330329 }
331330}
332331
333- impl FromRecoveredTx < CustomTransaction > for CustomEvmTransaction {
332+ impl FromRecoveredTx < CustomTransaction > for CustomTxEnv {
334333 fn from_recovered_tx ( tx : & CustomTransaction , sender : Address ) -> Self {
335334 match tx {
336335 CustomTransaction :: BuiltIn ( tx) => Self :: from_recovered_tx ( tx, sender) ,
337336 CustomTransaction :: Other ( tx) => {
338- Self :: Payment ( CustomTxEnv ( TxEnv :: from_recovered_tx ( tx, sender) ) )
337+ Self :: Payment ( PaymentTxEnv ( TxEnv :: from_recovered_tx ( tx, sender) ) )
339338 }
340339 }
341340 }
342341}
343342
344- impl FromTxWithEncoded < CustomTransaction > for CustomEvmTransaction {
343+ impl FromTxWithEncoded < CustomTransaction > for CustomTxEnv {
345344 fn from_encoded_tx ( tx : & CustomTransaction , sender : Address , encoded : Bytes ) -> Self {
346345 match tx {
347346 CustomTransaction :: BuiltIn ( tx) => Self :: from_encoded_tx ( tx, sender, encoded) ,
348347 CustomTransaction :: Other ( tx) => {
349- Self :: Payment ( CustomTxEnv ( TxEnv :: from_encoded_tx ( tx, sender, encoded) ) )
348+ Self :: Payment ( PaymentTxEnv ( TxEnv :: from_encoded_tx ( tx, sender, encoded) ) )
350349 }
351350 }
352351 }
353352}
354353
355- impl IntoTxEnv < Self > for CustomEvmTransaction {
354+ impl IntoTxEnv < Self > for CustomTxEnv {
356355 fn into_tx_env ( self ) -> Self {
357356 self
358357 }
0 commit comments