Skip to content

Commit f474801

Browse files
authored
chore(deps): bump alloy 0.12 (foundry-rs#10028)
1 parent dc69097 commit f474801

File tree

35 files changed

+381
-329
lines changed

35 files changed

+381
-329
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -189,61 +189,61 @@ foundry-linking = { path = "crates/linking" }
189189
# solc & compilation utilities
190190
foundry-block-explorers = { version = "0.11.0", default-features = false }
191191
foundry-compilers = { version = "0.13.3", default-features = false }
192-
foundry-fork-db = "0.11.1"
192+
foundry-fork-db = "0.12"
193193
solang-parser = "=0.3.3"
194194
solar-parse = { version = "=0.1.1", default-features = false }
195195

196196
## revm
197197
revm = { version = "19.4.0", default-features = false }
198198
revm-primitives = { version = "15.1.0", default-features = false }
199-
revm-inspectors = { version = "0.15.0", features = ["serde"] }
199+
revm-inspectors = { version = "0.16.0", features = ["serde"] }
200200

201201
## alloy
202-
alloy-consensus = { version = "0.11.1", default-features = false }
203-
alloy-contract = { version = "0.11.1", default-features = false }
204-
alloy-eips = { version = "0.11.1", default-features = false }
205-
alloy-genesis = { version = "0.11.1", default-features = false }
206-
alloy-json-rpc = { version = "0.11.1", default-features = false }
207-
alloy-network = { version = "0.11.1", default-features = false }
208-
alloy-provider = { version = "0.11.1", default-features = false }
209-
alloy-pubsub = { version = "0.11.1", default-features = false }
210-
alloy-rpc-client = { version = "0.11.1", default-features = false }
211-
alloy-rpc-types = { version = "0.11.1", default-features = true }
212-
alloy-serde = { version = "0.11.1", default-features = false }
213-
alloy-signer = { version = "0.11.1", default-features = false }
214-
alloy-signer-aws = { version = "0.11.1", default-features = false }
215-
alloy-signer-gcp = { version = "0.11.1", default-features = false }
216-
alloy-signer-ledger = { version = "0.11.1", default-features = false }
217-
alloy-signer-local = { version = "0.11.1", default-features = false }
218-
alloy-signer-trezor = { version = "0.11.1", default-features = false }
219-
alloy-transport = { version = "0.11.1", default-features = false }
220-
alloy-transport-http = { version = "0.11.1", default-features = false }
221-
alloy-transport-ipc = { version = "0.11.1", default-features = false }
222-
alloy-transport-ws = { version = "0.11.1", default-features = false }
223-
alloy-node-bindings = { version = "0.11.1", default-features = false }
224-
alloy-network-primitives = { version = "0.11.1", default-features = false }
202+
alloy-consensus = { version = "0.12.1", default-features = false }
203+
alloy-contract = { version = "0.12.1", default-features = false }
204+
alloy-eips = { version = "0.12.1", default-features = false }
205+
alloy-genesis = { version = "0.12.1", default-features = false }
206+
alloy-json-rpc = { version = "0.12.1", default-features = false }
207+
alloy-network = { version = "0.12.1", default-features = false }
208+
alloy-provider = { version = "0.12.1", default-features = false }
209+
alloy-pubsub = { version = "0.12.1", default-features = false }
210+
alloy-rpc-client = { version = "0.12.1", default-features = false }
211+
alloy-rpc-types = { version = "0.12.1", default-features = true }
212+
alloy-serde = { version = "0.12.1", default-features = false }
213+
alloy-signer = { version = "0.12.1", default-features = false }
214+
alloy-signer-aws = { version = "0.12.1", default-features = false }
215+
alloy-signer-gcp = { version = "0.12.1", default-features = false }
216+
alloy-signer-ledger = { version = "0.12.1", default-features = false }
217+
alloy-signer-local = { version = "0.12.1", default-features = false }
218+
alloy-signer-trezor = { version = "0.12.1", default-features = false }
219+
alloy-transport = { version = "0.12.1", default-features = false }
220+
alloy-transport-http = { version = "0.12.1", default-features = false }
221+
alloy-transport-ipc = { version = "0.12.1", default-features = false }
222+
alloy-transport-ws = { version = "0.12.1", default-features = false }
223+
alloy-node-bindings = { version = "0.12.1", default-features = false }
224+
alloy-network-primitives = { version = "0.12.1", default-features = false }
225225

226226
## alloy-core
227-
alloy-dyn-abi = "0.8.18"
228-
alloy-json-abi = "0.8.18"
229-
alloy-primitives = { version = "0.8.18", features = [
227+
alloy-dyn-abi = "0.8.22"
228+
alloy-json-abi = "0.8.22"
229+
alloy-primitives = { version = "0.8.22", features = [
230230
"getrandom",
231231
"rand",
232232
"map-fxhash",
233233
"map-foldhash",
234234
] }
235-
alloy-sol-macro-expander = "0.8.18"
236-
alloy-sol-macro-input = "0.8.18"
237-
alloy-sol-types = "0.8.18"
238-
syn-solidity = "0.8.18"
235+
alloy-sol-macro-expander = "0.8.22"
236+
alloy-sol-macro-input = "0.8.22"
237+
alloy-sol-types = "0.8.22"
238+
syn-solidity = "0.8.22"
239239

240240
alloy-chains = "0.1"
241241
alloy-rlp = "0.3"
242242
alloy-trie = "0.7.0"
243243

244244
## op-alloy
245-
op-alloy-consensus = "0.10.0"
246-
op-alloy-rpc-types = "0.10.0"
245+
op-alloy-consensus = "0.11.0"
246+
op-alloy-rpc-types = "0.11.0"
247247

248248
## cli
249249
anstream = "0.6"

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

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use crate::eth::transaction::optimism::DepositTransaction;
44
use alloy_consensus::{
55
transaction::{
66
eip4844::{TxEip4844, TxEip4844Variant, TxEip4844WithSidecar},
7-
TxEip7702,
7+
Recovered, TxEip7702,
88
},
99
Receipt, ReceiptEnvelope, ReceiptWithBloom, Signed, TxEip1559, TxEip2930, TxEnvelope, TxLegacy,
1010
TxReceipt, Typed2718,
@@ -285,9 +285,11 @@ pub fn to_alloy_transaction_with_hash_and_sender(
285285
block_hash: None,
286286
block_number: None,
287287
transaction_index: None,
288-
from,
289288
effective_gas_price: None,
290-
inner: TxEnvelope::Legacy(Signed::new_unchecked(tx, sig, hash)),
289+
inner: Recovered::new_unchecked(
290+
TxEnvelope::Legacy(Signed::new_unchecked(tx, sig, hash)),
291+
from,
292+
),
291293
}
292294
}
293295
TypedTransaction::EIP2930(t) => {
@@ -296,9 +298,11 @@ pub fn to_alloy_transaction_with_hash_and_sender(
296298
block_hash: None,
297299
block_number: None,
298300
transaction_index: None,
299-
from,
300301
effective_gas_price: None,
301-
inner: TxEnvelope::Eip2930(Signed::new_unchecked(tx, sig, hash)),
302+
inner: Recovered::new_unchecked(
303+
TxEnvelope::Eip2930(Signed::new_unchecked(tx, sig, hash)),
304+
from,
305+
),
302306
}
303307
}
304308
TypedTransaction::EIP1559(t) => {
@@ -307,9 +311,11 @@ pub fn to_alloy_transaction_with_hash_and_sender(
307311
block_hash: None,
308312
block_number: None,
309313
transaction_index: None,
310-
from,
311314
effective_gas_price: None,
312-
inner: TxEnvelope::Eip1559(Signed::new_unchecked(tx, sig, hash)),
315+
inner: Recovered::new_unchecked(
316+
TxEnvelope::Eip1559(Signed::new_unchecked(tx, sig, hash)),
317+
from,
318+
),
313319
}
314320
}
315321
TypedTransaction::EIP4844(t) => {
@@ -318,9 +324,11 @@ pub fn to_alloy_transaction_with_hash_and_sender(
318324
block_hash: None,
319325
block_number: None,
320326
transaction_index: None,
321-
from,
322327
effective_gas_price: None,
323-
inner: TxEnvelope::Eip4844(Signed::new_unchecked(tx, sig, hash)),
328+
inner: Recovered::new_unchecked(
329+
TxEnvelope::Eip4844(Signed::new_unchecked(tx, sig, hash)),
330+
from,
331+
),
324332
}
325333
}
326334
TypedTransaction::EIP7702(t) => {
@@ -329,9 +337,11 @@ pub fn to_alloy_transaction_with_hash_and_sender(
329337
block_hash: None,
330338
block_number: None,
331339
transaction_index: None,
332-
from,
333340
effective_gas_price: None,
334-
inner: TxEnvelope::Eip7702(Signed::new_unchecked(tx, sig, hash)),
341+
inner: Recovered::new_unchecked(
342+
TxEnvelope::Eip7702(Signed::new_unchecked(tx, sig, hash)),
343+
from,
344+
),
335345
}
336346
}
337347
TypedTransaction::Deposit(_t) => {
@@ -610,9 +620,9 @@ impl TryFrom<AnyRpcTransaction> for TypedTransaction {
610620
type Error = ConversionError;
611621

612622
fn try_from(value: AnyRpcTransaction) -> Result<Self, Self::Error> {
613-
let AnyRpcTransaction { inner, .. } = value;
614-
let from = inner.from;
615-
match inner.inner {
623+
let WithOtherFields { inner, .. } = value.0;
624+
let from = inner.inner.signer();
625+
match inner.inner.into_inner() {
616626
AnyTxEnvelope::Ethereum(tx) => match tx {
617627
TxEnvelope::Legacy(tx) => Ok(Self::Legacy(tx)),
618628
TxEnvelope::Eip2930(tx) => Ok(Self::EIP2930(tx)),

crates/anvil/src/config.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1149,7 +1149,7 @@ impl NodeConfig {
11491149
};
11501150

11511151
let block = provider
1152-
.get_block(BlockNumberOrTag::Number(fork_block_number).into(), false.into())
1152+
.get_block(BlockNumberOrTag::Number(fork_block_number).into())
11531153
.await
11541154
.wrap_err("failed to get fork block")?;
11551155

@@ -1340,10 +1340,8 @@ async fn derive_block_and_transactions(
13401340

13411341
// Get the block pertaining to the fork transaction
13421342
let transaction_block = provider
1343-
.get_block_by_number(
1344-
transaction_block_number.into(),
1345-
alloy_rpc_types::BlockTransactionsKind::Full,
1346-
)
1343+
.get_block_by_number(transaction_block_number.into())
1344+
.full()
13471345
.await?
13481346
.ok_or_else(|| eyre::eyre!("failed to get fork block by number"))?;
13491347

@@ -1520,7 +1518,7 @@ async fn find_latest_fork_block<P: Provider<AnyNetwork>>(
15201518
// walk back from the head of the chain, but at most 2 blocks, which should be more than enough
15211519
// leeway
15221520
for _ in 0..2 {
1523-
if let Some(block) = provider.get_block(num.into(), false.into()).await? {
1521+
if let Some(block) = provider.get_block(num.into()).await? {
15241522
if !block.header.hash.is_zero() {
15251523
break;
15261524
}

crates/anvil/src/eth/api.rs

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ use crate::{
3030
revm::primitives::{BlobExcessGasAndPrice, Output},
3131
ClientFork, LoggingManager, Miner, MiningMode, StorageInfo,
3232
};
33-
use alloy_consensus::{transaction::eip4844::TxEip4844Variant, Account};
33+
use alloy_consensus::{
34+
transaction::{eip4844::TxEip4844Variant, Recovered},
35+
Account,
36+
};
3437
use alloy_dyn_abi::TypedData;
3538
use alloy_eips::eip2718::Encodable2718;
3639
use alloy_network::{
@@ -1189,17 +1192,20 @@ impl EthApi {
11891192
node_info!("eth_getTransactionByHash");
11901193
let mut tx = self.pool.get_transaction(hash).map(|pending| {
11911194
let from = *pending.sender();
1192-
let mut tx = transaction_build(
1195+
let tx = transaction_build(
11931196
Some(*pending.hash()),
11941197
pending.transaction,
11951198
None,
11961199
None,
11971200
Some(self.backend.base_fee()),
11981201
);
1202+
1203+
let WithOtherFields { inner: mut tx, other } = tx.0;
11991204
// we set the from field here explicitly to the set sender of the pending transaction,
12001205
// in case the transaction is impersonated.
1201-
tx.from = from;
1202-
tx
1206+
tx.inner = Recovered::new_unchecked(tx.inner.into_inner(), from);
1207+
1208+
AnyRpcTransaction(WithOtherFields { inner: tx, other })
12031209
});
12041210
if tx.is_none() {
12051211
tx = self.backend.transaction_by_hash(hash).await?
@@ -2388,17 +2394,21 @@ impl EthApi {
23882394
let mut content = TxpoolContent::<AnyRpcTransaction>::default();
23892395
fn convert(tx: Arc<PoolTransaction>) -> Result<AnyRpcTransaction> {
23902396
let from = *tx.pending_transaction.sender();
2391-
let mut tx = transaction_build(
2397+
let tx = transaction_build(
23922398
Some(tx.hash()),
23932399
tx.pending_transaction.transaction.clone(),
23942400
None,
23952401
None,
23962402
None,
23972403
);
23982404

2405+
let WithOtherFields { inner: mut tx, other } = tx.0;
2406+
23992407
// we set the from field here explicitly to the set sender of the pending transaction,
24002408
// in case the transaction is impersonated.
2401-
tx.from = from;
2409+
tx.inner = Recovered::new_unchecked(tx.inner.into_inner(), from);
2410+
2411+
let tx = AnyRpcTransaction(WithOtherFields { inner: tx, other });
24022412

24032413
Ok(tx)
24042414
}

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

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,8 @@ impl ClientFork {
8282
}
8383

8484
let provider = self.provider();
85-
let block = provider
86-
.get_block(block_number, false.into())
87-
.await?
88-
.ok_or(BlockchainError::BlockNotFound)?;
85+
let block =
86+
provider.get_block(block_number).await?.ok_or(BlockchainError::BlockNotFound)?;
8987
let block_hash = block.header.hash;
9088
let timestamp = block.header.timestamp;
9189
let base_fee = block.header.base_fee_per_gas;
@@ -194,7 +192,7 @@ impl ClientFork {
194192
block: Option<BlockNumber>,
195193
) -> Result<Bytes, TransportError> {
196194
let block = block.unwrap_or(BlockNumber::Latest);
197-
let res = self.provider().call(request).block(block.into()).await?;
195+
let res = self.provider().call(request.clone()).block(block.into()).await?;
198196

199197
Ok(res)
200198
}
@@ -206,7 +204,7 @@ impl ClientFork {
206204
block: Option<BlockNumber>,
207205
) -> Result<u128, TransportError> {
208206
let block = block.unwrap_or_default();
209-
let res = self.provider().estimate_gas(request).block(block.into()).await?;
207+
let res = self.provider().estimate_gas(request.clone()).block(block.into()).await?;
210208

211209
Ok(res as u128)
212210
}
@@ -514,7 +512,7 @@ impl ClientFork {
514512
&self,
515513
block_id: impl Into<BlockId>,
516514
) -> Result<Option<AnyRpcBlock>, TransportError> {
517-
if let Some(block) = self.provider().get_block(block_id.into(), true.into()).await? {
515+
if let Some(block) = self.provider().get_block(block_id.into()).full().await? {
518516
let hash = block.header.hash;
519517
let block_number = block.header.number;
520518
let mut storage = self.storage_write();

0 commit comments

Comments
 (0)