Skip to content

Commit f19313b

Browse files
committed
fix merge conflict
2 parents e05807c + c2abd2c commit f19313b

File tree

18 files changed

+382
-368
lines changed

18 files changed

+382
-368
lines changed

Cargo.lock

Lines changed: 177 additions & 205 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,8 @@ alloy-transport = { version = "1.0.42", default-features = false }
260260
alloy-transport-http = { version = "1.0.42", default-features = false }
261261
alloy-transport-ipc = { version = "1.0.42", default-features = false }
262262
alloy-transport-ws = { version = "1.0.42", default-features = false }
263-
alloy-hardforks = { version = "0.4.0", default-features = false }
264-
alloy-op-hardforks = { version = "0.4.0", default-features = false }
263+
alloy-hardforks = { version = "0.4.3", default-features = false }
264+
alloy-op-hardforks = { version = "0.4.3", default-features = false }
265265

266266
## alloy-core
267267
alloy-dyn-abi = "1.4.1"
@@ -288,10 +288,10 @@ op-alloy-flz = "0.13.1"
288288
## revm
289289
revm = { version = "30.2.0", default-features = false }
290290
revm-inspectors = { version = "0.31.2", features = ["serde"] }
291-
op-revm = { version = "11.1.2", default-features = false }
291+
op-revm = { version = "11.3.0", default-features = false }
292292
## alloy-evm
293-
alloy-evm = "0.22.3"
294-
alloy-op-evm = "0.22.3"
293+
alloy-evm = "0.22.6"
294+
alloy-op-evm = "0.22.6"
295295

296296
## cli
297297
anstream = "0.6"
@@ -344,7 +344,7 @@ mesc = "0.3"
344344
memchr = "2.7"
345345
num-format = "0.4"
346346
parking_lot = "0.12"
347-
proptest = "1.8.0"
347+
proptest = "1.9.0"
348348
rand = "0.9"
349349
rand_08 = { package = "rand", version = "0.8" }
350350
rand_chacha = "0.9.0"

crates/anvil/core/src/eth/block.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@ impl Block {
3232
T: Into<Transaction>,
3333
{
3434
let transactions: Vec<_> = transactions.into_iter().map(Into::into).collect();
35-
let transactions1: Vec<super::transaction::TypedTransaction> =
36-
transactions.clone().into_iter().map(Into::into).collect();
37-
let transactions_root = calculate_transaction_root(&transactions1);
35+
let transactions_root = calculate_transaction_root(&transactions);
3836

3937
Self {
4038
header: Header {

crates/anvil/core/src/eth/transaction/mod.rs

Lines changed: 75 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,12 @@ pub struct MaybeImpersonatedTransaction {
206206
pub impersonated_sender: Option<Address>,
207207
}
208208

209+
impl Typed2718 for MaybeImpersonatedTransaction {
210+
fn ty(&self) -> u8 {
211+
self.transaction.ty()
212+
}
213+
}
214+
209215
impl MaybeImpersonatedTransaction {
210216
/// Creates a new wrapper for the given transaction
211217
pub fn new(transaction: TypedTransaction) -> Self {
@@ -279,6 +285,16 @@ impl MaybeImpersonatedTransaction {
279285
}
280286
}
281287

288+
impl Encodable2718 for MaybeImpersonatedTransaction {
289+
fn encode_2718_len(&self) -> usize {
290+
self.transaction.encode_2718_len()
291+
}
292+
293+
fn encode_2718(&self, out: &mut dyn BufMut) {
294+
self.transaction.encode_2718(out)
295+
}
296+
}
297+
282298
impl Encodable for MaybeImpersonatedTransaction {
283299
fn encode(&self, out: &mut dyn bytes::BufMut) {
284300
self.transaction.encode(out)
@@ -1171,30 +1187,16 @@ impl TypedReceipt {
11711187
fn convert_receipt_to_rpc(
11721188
receipt: ReceiptWithBloom<Receipt<alloy_primitives::Log>>,
11731189
) -> ReceiptWithBloom<Receipt<alloy_rpc_types::Log>> {
1174-
let rpc_logs: Vec<alloy_rpc_types::Log> = receipt
1175-
.receipt
1176-
.logs
1177-
.into_iter()
1178-
.map(|log| alloy_rpc_types::Log {
1179-
inner: log,
1180-
block_hash: None,
1181-
block_number: None,
1182-
block_timestamp: None,
1183-
transaction_hash: None,
1184-
transaction_index: None,
1185-
log_index: None,
1186-
removed: false,
1187-
})
1188-
.collect();
1189-
1190-
ReceiptWithBloom {
1191-
receipt: Receipt {
1192-
status: receipt.receipt.status,
1193-
cumulative_gas_used: receipt.receipt.cumulative_gas_used,
1194-
logs: rpc_logs,
1195-
},
1196-
logs_bloom: receipt.logs_bloom,
1197-
}
1190+
receipt.map_logs(|log| alloy_rpc_types::Log {
1191+
inner: log,
1192+
block_hash: None,
1193+
block_number: None,
1194+
block_timestamp: None,
1195+
transaction_hash: None,
1196+
transaction_index: None,
1197+
log_index: None,
1198+
removed: false,
1199+
})
11981200
}
11991201

12001202
impl TypedReceiptRpc {
@@ -1462,7 +1464,7 @@ impl Decodable2718 for TypedReceipt {
14621464
}
14631465
}
14641466

1465-
pub type ReceiptResponse = TransactionReceipt<TypedReceiptRpc>;
1467+
pub type ReceiptResponse = WithOtherFields<TransactionReceipt<TypedReceiptRpc>>;
14661468

14671469
pub fn convert_to_anvil_receipt(receipt: AnyTransactionReceipt) -> Option<ReceiptResponse> {
14681470
let WithOtherFields {
@@ -1484,51 +1486,56 @@ pub fn convert_to_anvil_receipt(receipt: AnyTransactionReceipt) -> Option<Receip
14841486
other,
14851487
} = receipt;
14861488

1487-
Some(TransactionReceipt {
1488-
transaction_hash,
1489-
transaction_index,
1490-
block_hash,
1491-
block_number,
1492-
gas_used,
1493-
contract_address,
1494-
effective_gas_price,
1495-
from,
1496-
to,
1497-
blob_gas_price,
1498-
blob_gas_used,
1499-
inner: match r#type {
1500-
0x00 => TypedReceiptRpc::Legacy(receipt_with_bloom),
1501-
0x01 => TypedReceiptRpc::EIP2930(receipt_with_bloom),
1502-
0x02 => TypedReceiptRpc::EIP1559(receipt_with_bloom),
1503-
0x03 => TypedReceiptRpc::EIP4844(receipt_with_bloom),
1504-
0x04 => TypedReceiptRpc::EIP7702(receipt_with_bloom),
1505-
0x7E => TypedReceiptRpc::Deposit(OpDepositReceiptWithBloom {
1506-
receipt: OpDepositReceipt {
1507-
inner: Receipt {
1508-
status: alloy_consensus::Eip658Value::Eip658(receipt_with_bloom.status()),
1509-
cumulative_gas_used: receipt_with_bloom.cumulative_gas_used(),
1510-
logs: receipt_with_bloom
1511-
.receipt
1512-
.logs
1513-
.into_iter()
1514-
.map(|l| l.inner)
1515-
.collect(),
1489+
Some(WithOtherFields {
1490+
inner: TransactionReceipt {
1491+
transaction_hash,
1492+
transaction_index,
1493+
block_hash,
1494+
block_number,
1495+
gas_used,
1496+
contract_address,
1497+
effective_gas_price,
1498+
from,
1499+
to,
1500+
blob_gas_price,
1501+
blob_gas_used,
1502+
inner: match r#type {
1503+
0x00 => TypedReceiptRpc::Legacy(receipt_with_bloom),
1504+
0x01 => TypedReceiptRpc::EIP2930(receipt_with_bloom),
1505+
0x02 => TypedReceiptRpc::EIP1559(receipt_with_bloom),
1506+
0x03 => TypedReceiptRpc::EIP4844(receipt_with_bloom),
1507+
0x04 => TypedReceiptRpc::EIP7702(receipt_with_bloom),
1508+
0x7E => TypedReceiptRpc::Deposit(OpDepositReceiptWithBloom {
1509+
receipt: OpDepositReceipt {
1510+
inner: Receipt {
1511+
status: alloy_consensus::Eip658Value::Eip658(
1512+
receipt_with_bloom.status(),
1513+
),
1514+
cumulative_gas_used: receipt_with_bloom.cumulative_gas_used(),
1515+
logs: receipt_with_bloom
1516+
.receipt
1517+
.logs
1518+
.into_iter()
1519+
.map(|l| l.inner)
1520+
.collect(),
1521+
},
1522+
deposit_nonce: other
1523+
.get_deserialized::<U64>("depositNonce")
1524+
.transpose()
1525+
.ok()?
1526+
.map(|v| v.to()),
1527+
deposit_receipt_version: other
1528+
.get_deserialized::<U64>("depositReceiptVersion")
1529+
.transpose()
1530+
.ok()?
1531+
.map(|v| v.to()),
15161532
},
1517-
deposit_nonce: other
1518-
.get_deserialized::<U64>("depositNonce")
1519-
.transpose()
1520-
.ok()?
1521-
.map(|v| v.to()),
1522-
deposit_receipt_version: other
1523-
.get_deserialized::<U64>("depositReceiptVersion")
1524-
.transpose()
1525-
.ok()?
1526-
.map(|v| v.to()),
1527-
},
1528-
logs_bloom: receipt_with_bloom.logs_bloom,
1529-
}),
1530-
_ => return None,
1533+
logs_bloom: receipt_with_bloom.logs_bloom,
1534+
}),
1535+
_ => return None,
1536+
},
15311537
},
1538+
other,
15321539
})
15331540
}
15341541

crates/anvil/src/config.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1211,7 +1211,6 @@ impl NodeConfig {
12111211
.initial_backoff(self.fork_retry_backoff.as_millis() as u64)
12121212
.compute_units_per_second(self.compute_units_per_second)
12131213
.max_retry(self.fork_request_retries)
1214-
.initial_backoff(1000)
12151214
.headers(self.fork_headers.clone())
12161215
.build()
12171216
.wrap_err("failed to establish provider to fork url")?,

crates/anvil/src/eth/api.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2655,6 +2655,7 @@ impl EthApi {
26552655
{
26562656
// insert revert reason if failure
26572657
if !receipt
2658+
.inner
26582659
.inner
26592660
.inner
26602661
.as_receipt_with_bloom()

crates/anvil/src/eth/backend/db.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ impl SerializableState {
514514
}
515515

516516
/// This is used as the clap `value_parser` implementation
517-
#[allow(dead_code)]
517+
#[cfg(feature = "cmd")]
518518
pub(crate) fn parse(path: &str) -> Result<Self, String> {
519519
Self::load(path).map_err(|err| err.to_string())
520520
}

crates/anvil/src/eth/backend/mem/mod.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -813,8 +813,8 @@ impl Backend {
813813
precompiles_map.extend(self.env.read().networks.precompiles());
814814

815815
if let Some(factory) = &self.precompile_factory {
816-
for (precompile, _) in &factory.precompiles() {
817-
precompiles_map.insert(precompile.id().name().to_string(), *precompile.address());
816+
for (address, precompile) in factory.precompiles() {
817+
precompiles_map.insert(precompile.precompile_id().to_string(), address);
818818
}
819819
}
820820

@@ -3207,6 +3207,7 @@ impl Backend {
32073207
blob_gas_used,
32083208
};
32093209

3210+
let inner = WithOtherFields { inner, other: Default::default() };
32103211
Some(MinedTransactionReceipt { inner, out: info.out })
32113212
}
32123213

crates/anvil/src/eth/beacon/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ pub mod error;
77
pub mod response;
88

99
pub use error::BeaconError;
10-
pub use response::{BeaconResponse, BeaconResult};
10+
pub use response::BeaconResponse;

crates/anvil/src/eth/beacon/response.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
11
//! Beacon API response types
22
3-
use super::error::BeaconError;
43
use axum::{
54
Json,
65
http::StatusCode,
76
response::{IntoResponse, Response},
87
};
98
use serde::{Deserialize, Serialize};
109

11-
/// Result type for beacon API operations
12-
pub type BeaconResult<T> = Result<T, BeaconError>;
13-
1410
/// Generic Beacon API response wrapper
1511
///
1612
/// This follows the beacon chain API specification where responses include

0 commit comments

Comments
 (0)