Sitelet https://github.com/njelich/examples/commit/bc7aa07c3267fda3d4e9c56dca38572ef1be59dd
Skip to content

Commit bc7aa07

Browse files
chore(deps): bump alloy 0.6.2 (alloy-rs#159)
* bump alloy 0.6.2 * fix * bump deps --------- Co-authored-by: zerosnacks <zerosnacks@protonmail.com>
1 parent bbf7225 commit bc7aa07

12 files changed

Lines changed: 61 additions & 56 deletions

File tree

‎Cargo.toml‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ significant_drop_tightening = "allow"
9595
needless_return = "allow"
9696

9797
[workspace.dependencies]
98-
alloy = { version = "0.5.3", features = [
98+
alloy = { version = "0.6.2", features = [
9999
"full",
100100
"node-bindings",
101101
"rpc-types-debug",
@@ -111,9 +111,10 @@ alloy = { version = "0.5.3", features = [
111111
"eips",
112112
] }
113113

114-
foundry-fork-db = "0.6"
115-
revm-primitives = "13.0"
116-
revm = "17.1"
114+
foundry-fork-db = "0.7"
115+
116+
revm-primitives = "14.0"
117+
revm = "18.0"
117118

118119
# async
119120
futures-util = "0.3"
@@ -124,5 +125,6 @@ eyre = "0.6"
124125
serde = "1.0"
125126
serde_json = "1.0"
126127

127-
# [patch.crates-io]
128+
[patch.crates-io]
128129
# alloy = { git = "https://github.com/alloy-rs/alloy", rev = "65dfbe" }
130+
foundry-fork-db = { git = "https://github.com/foundry-rs/foundry-fork-db", rev = "d113d6e" }

‎examples/advanced/examples/foundry_fork_db.rs‎

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99
use std::sync::Arc;
1010

1111
use alloy::{
12+
consensus::BlockHeader,
1213
eips::BlockId,
13-
network::{AnyNetwork, TransactionBuilder},
14+
network::{AnyNetwork, TransactionBuilder, TransactionResponse},
1415
node_bindings::Anvil,
1516
primitives::U256,
1617
providers::{Provider, ProviderBuilder},
1718
rpc::types::{
18-
serde_helpers::WithOtherFields, Block, BlockTransactionsKind, Transaction,
19-
TransactionRequest,
19+
serde_helpers::WithOtherFields, Block, BlockTransactionsKind, TransactionRequest,
2020
},
2121
};
2222
use eyre::Result;
@@ -120,22 +120,22 @@ async fn main() -> Result<()> {
120120
Ok(())
121121
}
122122

123-
fn configure_evm_env(
124-
block: WithOtherFields<Block<WithOtherFields<Transaction>>>,
123+
fn configure_evm_env<T: TransactionResponse, H: BlockHeader>(
124+
block: WithOtherFields<Block<T, H>>,
125125
shared: SharedBackend,
126126
tx_env: TxEnv,
127127
) -> Evm<'static, (), CacheDB<SharedBackend>> {
128-
let basefee = block.header.base_fee_per_gas.map(U256::from).unwrap_or_default();
128+
let basefee = block.header.base_fee_per_gas().map(U256::from).unwrap_or_default();
129129
let block_env = BlockEnv {
130-
number: U256::from(block.header.number),
131-
coinbase: block.header.miner,
132-
timestamp: U256::from(block.header.timestamp),
133-
gas_limit: U256::from(block.header.gas_limit),
130+
number: U256::from(block.header.number()),
131+
coinbase: block.header.beneficiary(),
132+
timestamp: U256::from(block.header.timestamp()),
133+
gas_limit: U256::from(block.header.gas_limit()),
134134
basefee,
135-
prevrandao: block.header.mix_hash,
136-
difficulty: block.header.difficulty,
135+
prevrandao: block.header.mix_hash(),
136+
difficulty: block.header.difficulty(),
137137
blob_excess_gas_and_price: Some(BlobExcessGasAndPrice::new(
138-
block.header.excess_blob_gas.unwrap_or_default(),
138+
block.header.excess_blob_gas().unwrap_or_default(),
139139
)),
140140
};
141141

‎examples/comparison/examples/compare_new_heads.rs‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ async fn main() -> Result<()> {
5050

5151
tasks.push(tokio::spawn(async move {
5252
let _p = provider; // keep provider alive
53-
while let Some(block) = stream.next().await {
54-
if let Err(e) = sx.send((name.clone(), block, Utc::now())) {
53+
while let Some(header) = stream.next().await {
54+
if let Err(e) = sx.send((name.clone(), header, Utc::now())) {
5555
eprintln!("sending to channel failed: {}", e);
5656
}
5757
}
@@ -66,8 +66,8 @@ async fn main() -> Result<()> {
6666
}
6767

6868
let mut tracker = HashMap::new();
69-
while let Some((name, block, timestamp)) = rx.recv().await {
70-
let block_number = block.header.number;
69+
while let Some((name, header, timestamp)) = rx.recv().await {
70+
let block_number = header.number;
7171
let track = tracker
7272
.entry(block_number)
7373
.and_modify(|t: &mut TxTrack| {

‎examples/fillers/examples/gas_filler.rs‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//! Example of using the `GasFiller` in the provider.
22
33
use alloy::{
4+
consensus::Transaction,
45
network::TransactionBuilder,
56
primitives::{address, U256},
67
providers::{Provider, ProviderBuilder},
@@ -34,9 +35,9 @@ async fn main() -> Result<()> {
3435
let node_hash = *builder.tx_hash();
3536
let pending_tx =
3637
provider.get_transaction_by_hash(node_hash).await?.expect("Pending transaction not found");
37-
assert_eq!(pending_tx.nonce, 0);
38+
assert_eq!(pending_tx.nonce(), 0);
3839

39-
println!("Transaction sent with nonce: {}", pending_tx.nonce);
40+
println!("Transaction sent with nonce: {}", pending_tx.nonce());
4041

4142
// Update the nonce and send the transaction again.
4243
let tx = tx.with_nonce(1);
@@ -46,9 +47,9 @@ async fn main() -> Result<()> {
4647
let node_hash = *builder.tx_hash();
4748
let pending_tx =
4849
provider.get_transaction_by_hash(node_hash).await?.expect("Pending transaction not found");
49-
assert_eq!(pending_tx.nonce, 1);
50+
assert_eq!(pending_tx.nonce(), 1);
5051

51-
println!("Transaction sent with nonce: {}", pending_tx.nonce);
52+
println!("Transaction sent with nonce: {}", pending_tx.nonce());
5253

5354
Ok(())
5455
}

‎examples/fillers/examples/nonce_filler.rs‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//! Example of using the `NonceFiller` in the provider.
22
33
use alloy::{
4+
consensus::Transaction,
45
network::TransactionBuilder,
56
primitives::{address, U256},
67
providers::{Provider, ProviderBuilder},
@@ -51,18 +52,18 @@ async fn main() -> Result<()> {
5152
let node_hash = *builder.tx_hash();
5253
let pending_tx =
5354
provider.get_transaction_by_hash(node_hash).await?.expect("Transaction not found");
54-
assert_eq!(pending_tx.nonce, 0);
55+
assert_eq!(pending_tx.nonce(), 0);
5556

56-
println!("Transaction sent with nonce: {}", pending_tx.nonce);
57+
println!("Transaction sent with nonce: {}", pending_tx.nonce());
5758

5859
// Send the transaction, the nonce (1) is automatically managed by the provider.
5960
let builder = provider.send_transaction(tx).await?;
6061
let node_hash = *builder.tx_hash();
6162
let pending_tx =
6263
provider.get_transaction_by_hash(node_hash).await?.expect("Transaction not found");
63-
assert_eq!(pending_tx.nonce, 1);
64+
assert_eq!(pending_tx.nonce(), 1);
6465

65-
println!("Transaction sent with nonce: {}", pending_tx.nonce);
66+
println!("Transaction sent with nonce: {}", pending_tx.nonce());
6667

6768
Ok(())
6869
}

‎examples/fillers/examples/recommended_fillers.rs‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//! Example of using the `.with_recommended_fillers()` method in the provider.
22
33
use alloy::{
4+
consensus::Transaction,
45
network::TransactionBuilder,
56
primitives::{address, U256},
67
providers::{Provider, ProviderBuilder},
@@ -30,18 +31,18 @@ async fn main() -> Result<()> {
3031
let node_hash = *builder.tx_hash();
3132
let pending_tx =
3233
provider.get_transaction_by_hash(node_hash).await?.expect("Pending transaction not found");
33-
assert_eq!(pending_tx.nonce, 0);
34+
assert_eq!(pending_tx.nonce(), 0);
3435

35-
println!("Transaction sent with nonce: {}", pending_tx.nonce);
36+
println!("Transaction sent with nonce: {}", pending_tx.nonce());
3637

3738
// Send the transaction, the nonce (1) is automatically managed by the provider.
3839
let builder = provider.send_transaction(tx).await?;
3940
let node_hash = *builder.tx_hash();
4041
let pending_tx =
4142
provider.get_transaction_by_hash(node_hash).await?.expect("Pending transaction not found");
42-
assert_eq!(pending_tx.nonce, 1);
43+
assert_eq!(pending_tx.nonce(), 1);
4344

44-
println!("Transaction sent with nonce: {}", pending_tx.nonce);
45+
println!("Transaction sent with nonce: {}", pending_tx.nonce());
4546

4647
Ok(())
4748
}

‎examples/providers/examples/builtin.rs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ async fn main() -> Result<()> {
3030

3131
let mut stream = sub.into_stream().take(2);
3232

33-
println!("Awaiting blocks...");
33+
println!("Awaiting block headers...");
3434

3535
let handle = tokio::spawn(async move {
36-
while let Some(block) = stream.next().await {
37-
println!("{}", block.header.number);
36+
while let Some(header) = stream.next().await {
37+
println!("{}", header.number);
3838
}
3939
});
4040

‎examples/providers/examples/ws.rs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ async fn main() -> Result<()> {
1717
// Wait and take the next 4 blocks.
1818
let mut stream = sub.into_stream().take(4);
1919

20-
println!("Awaiting blocks...");
20+
println!("Awaiting block headers...");
2121

2222
// Take the stream and print the block number upon receiving a new block.
2323
let handle = tokio::spawn(async move {
24-
while let Some(block) = stream.next().await {
25-
println!("Latest block number: {}", block.header.number);
24+
while let Some(header) = stream.next().await {
25+
println!("Latest block number: {}", header.number);
2626
}
2727
});
2828

‎examples/providers/examples/ws_with_auth.rs‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,27 +22,27 @@ async fn main() -> Result<()> {
2222
let provider_basic = ProviderBuilder::new().on_ws(ws_basic).await?;
2323
let provider_bearer = ProviderBuilder::new().on_ws(ws_bearer).await?;
2424

25-
// Subscribe to new blocks.
25+
// Subscribe to new block headers.
2626
let sub_basic = provider_basic.subscribe_blocks();
2727
let sub_bearer = provider_bearer.subscribe_blocks();
2828

29-
// Wait and take the next 4 blocks.
29+
// Wait and take the next 4 block headers
3030
let mut stream_basic = sub_basic.await?.into_stream().take(4);
3131
let mut stream_bearer = sub_bearer.await?.into_stream().take(4);
3232

33-
println!("Awaiting blocks...");
33+
println!("Awaiting block headers...");
3434

35-
// Take the basic stream and print the block number upon receiving a new block.
35+
// Take the basic stream and print the block number upon receiving a new block header.
3636
let basic_handle = tokio::spawn(async move {
37-
while let Some(block) = stream_basic.next().await {
38-
println!("Latest block number (basic): {}", block.header.number);
37+
while let Some(header) = stream_basic.next().await {
38+
println!("Latest block number (basic): {}", header.number);
3939
}
4040
});
4141

42-
// Take the bearer stream and print the block number upon receiving a new block.
42+
// Take the bearer stream and print the block number upon receiving a new block header.
4343
let bearer_handle = tokio::spawn(async move {
44-
while let Some(block) = stream_bearer.next().await {
45-
println!("Latest block number (bearer): {}", block.header.number);
44+
while let Some(header) = stream_bearer.next().await {
45+
println!("Latest block number (bearer): {}", header.number);
4646
}
4747
});
4848

‎examples/subscriptions/examples/subscribe_blocks.rs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ async fn main() -> Result<()> {
1717
let ws = WsConnect::new(anvil.ws_endpoint());
1818
let provider = ProviderBuilder::new().on_ws(ws).await?;
1919

20-
// Subscribe to blocks.
20+
// Subscribe to block headers.
2121
let subscription = provider.subscribe_blocks().await?;
2222
let mut stream = subscription.into_stream().take(2);
2323

24-
while let Some(block) = stream.next().await {
25-
println!("Received block number: {}", block.header.number);
24+
while let Some(header) = stream.next().await {
25+
println!("Received block number: {}", header.number);
2626
}
2727

2828
// Poll for block headers.

0 commit comments

Comments
 (0)