@@ -14,7 +14,10 @@ use ethers_core::{
14
14
rlp:: { Decodable , DecoderError , Encodable , Rlp , RlpStream } ,
15
15
} ,
16
16
} ;
17
- use foundry_evm:: trace:: CallTraceArena ;
17
+ use foundry_evm:: {
18
+ trace:: CallTraceArena ,
19
+ utils:: { h160_to_b160, u256_to_ru256} ,
20
+ } ;
18
21
use revm:: {
19
22
interpreter:: InstructionResult ,
20
23
primitives:: { CreateScheme , TransactTo , TxEnv } ,
@@ -1185,7 +1188,7 @@ impl PendingTransaction {
1185
1188
pub fn to_revm_tx_env ( & self ) -> TxEnv {
1186
1189
fn transact_to ( kind : & TransactionKind ) -> TransactTo {
1187
1190
match kind {
1188
- TransactionKind :: Call ( c) => TransactTo :: Call ( ( * c) . into ( ) ) ,
1191
+ TransactionKind :: Call ( c) => TransactTo :: Call ( h160_to_b160 ( * c) ) ,
1189
1192
TransactionKind :: Create => TransactTo :: Create ( CreateScheme :: Create ) ,
1190
1193
}
1191
1194
}
@@ -1196,13 +1199,13 @@ impl PendingTransaction {
1196
1199
let chain_id = tx. chain_id ( ) ;
1197
1200
let LegacyTransaction { nonce, gas_price, gas_limit, value, kind, input, .. } = tx;
1198
1201
TxEnv {
1199
- caller : caller . into ( ) ,
1202
+ caller : h160_to_b160 ( caller ) ,
1200
1203
transact_to : transact_to ( kind) ,
1201
- data : input. 0 . clone ( ) ,
1204
+ data : alloy_primitives :: Bytes ( input. 0 . clone ( ) ) ,
1202
1205
chain_id,
1203
1206
nonce : Some ( nonce. as_u64 ( ) ) ,
1204
- value : ( * value) . into ( ) ,
1205
- gas_price : ( * gas_price) . into ( ) ,
1207
+ value : u256_to_ru256 ( * value) ,
1208
+ gas_price : u256_to_ru256 ( * gas_price) ,
1206
1209
gas_priority_fee : None ,
1207
1210
gas_limit : gas_limit. as_u64 ( ) ,
1208
1211
access_list : vec ! [ ] ,
@@ -1221,13 +1224,13 @@ impl PendingTransaction {
1221
1224
..
1222
1225
} = tx;
1223
1226
TxEnv {
1224
- caller : caller . into ( ) ,
1227
+ caller : h160_to_b160 ( caller ) ,
1225
1228
transact_to : transact_to ( kind) ,
1226
- data : input. 0 . clone ( ) ,
1229
+ data : alloy_primitives :: Bytes ( input. 0 . clone ( ) ) ,
1227
1230
chain_id : Some ( * chain_id) ,
1228
1231
nonce : Some ( nonce. as_u64 ( ) ) ,
1229
- value : ( * value) . into ( ) ,
1230
- gas_price : ( * gas_price) . into ( ) ,
1232
+ value : u256_to_ru256 ( * value) ,
1233
+ gas_price : u256_to_ru256 ( * gas_price) ,
1231
1234
gas_priority_fee : None ,
1232
1235
gas_limit : gas_limit. as_u64 ( ) ,
1233
1236
access_list : to_revm_access_list ( access_list. 0 . clone ( ) ) ,
@@ -1247,14 +1250,14 @@ impl PendingTransaction {
1247
1250
..
1248
1251
} = tx;
1249
1252
TxEnv {
1250
- caller : caller . into ( ) ,
1253
+ caller : h160_to_b160 ( caller ) ,
1251
1254
transact_to : transact_to ( kind) ,
1252
- data : input. 0 . clone ( ) ,
1255
+ data : alloy_primitives :: Bytes ( input. 0 . clone ( ) ) ,
1253
1256
chain_id : Some ( * chain_id) ,
1254
1257
nonce : Some ( nonce. as_u64 ( ) ) ,
1255
- value : ( * value) . into ( ) ,
1256
- gas_price : ( * max_fee_per_gas) . into ( ) ,
1257
- gas_priority_fee : Some ( ( * max_priority_fee_per_gas) . into ( ) ) ,
1258
+ value : u256_to_ru256 ( * value) ,
1259
+ gas_price : u256_to_ru256 ( * max_fee_per_gas) ,
1260
+ gas_priority_fee : Some ( u256_to_ru256 ( * max_priority_fee_per_gas) ) ,
1258
1261
gas_limit : gas_limit. as_u64 ( ) ,
1259
1262
access_list : to_revm_access_list ( access_list. 0 . clone ( ) ) ,
1260
1263
}
0 commit comments