Skip to content

Commit

Permalink
chore(deps): bump alloy 0.6.2 (#159)
Browse files Browse the repository at this point in the history
* bump alloy 0.6.2

* fix

* bump deps

---------

Co-authored-by: zerosnacks <zerosnacks@protonmail.com>
  • Loading branch information
yash-atreya and zerosnacks authored Nov 8, 2024
1 parent bbf7225 commit bc7aa07
Show file tree
Hide file tree
Showing 12 changed files with 61 additions and 56 deletions.
12 changes: 7 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ significant_drop_tightening = "allow"
needless_return = "allow"

[workspace.dependencies]
alloy = { version = "0.5.3", features = [
alloy = { version = "0.6.2", features = [
"full",
"node-bindings",
"rpc-types-debug",
Expand All @@ -111,9 +111,10 @@ alloy = { version = "0.5.3", features = [
"eips",
] }

foundry-fork-db = "0.6"
revm-primitives = "13.0"
revm = "17.1"
foundry-fork-db = "0.7"

revm-primitives = "14.0"
revm = "18.0"

# async
futures-util = "0.3"
Expand All @@ -124,5 +125,6 @@ eyre = "0.6"
serde = "1.0"
serde_json = "1.0"

# [patch.crates-io]
[patch.crates-io]
# alloy = { git = "https://github.com/alloy-rs/alloy", rev = "65dfbe" }
foundry-fork-db = { git = "https://github.com/foundry-rs/foundry-fork-db", rev = "d113d6e" }
26 changes: 13 additions & 13 deletions examples/advanced/examples/foundry_fork_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
use std::sync::Arc;

use alloy::{
consensus::BlockHeader,
eips::BlockId,
network::{AnyNetwork, TransactionBuilder},
network::{AnyNetwork, TransactionBuilder, TransactionResponse},
node_bindings::Anvil,
primitives::U256,
providers::{Provider, ProviderBuilder},
rpc::types::{
serde_helpers::WithOtherFields, Block, BlockTransactionsKind, Transaction,
TransactionRequest,
serde_helpers::WithOtherFields, Block, BlockTransactionsKind, TransactionRequest,
},
};
use eyre::Result;
Expand Down Expand Up @@ -120,22 +120,22 @@ async fn main() -> Result<()> {
Ok(())
}

fn configure_evm_env(
block: WithOtherFields<Block<WithOtherFields<Transaction>>>,
fn configure_evm_env<T: TransactionResponse, H: BlockHeader>(
block: WithOtherFields<Block<T, H>>,
shared: SharedBackend,
tx_env: TxEnv,
) -> Evm<'static, (), CacheDB<SharedBackend>> {
let basefee = block.header.base_fee_per_gas.map(U256::from).unwrap_or_default();
let basefee = block.header.base_fee_per_gas().map(U256::from).unwrap_or_default();
let block_env = BlockEnv {
number: U256::from(block.header.number),
coinbase: block.header.miner,
timestamp: U256::from(block.header.timestamp),
gas_limit: U256::from(block.header.gas_limit),
number: U256::from(block.header.number()),
coinbase: block.header.beneficiary(),
timestamp: U256::from(block.header.timestamp()),
gas_limit: U256::from(block.header.gas_limit()),
basefee,
prevrandao: block.header.mix_hash,
difficulty: block.header.difficulty,
prevrandao: block.header.mix_hash(),
difficulty: block.header.difficulty(),
blob_excess_gas_and_price: Some(BlobExcessGasAndPrice::new(
block.header.excess_blob_gas.unwrap_or_default(),
block.header.excess_blob_gas().unwrap_or_default(),
)),
};

Expand Down
8 changes: 4 additions & 4 deletions examples/comparison/examples/compare_new_heads.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ async fn main() -> Result<()> {

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

let mut tracker = HashMap::new();
while let Some((name, block, timestamp)) = rx.recv().await {
let block_number = block.header.number;
while let Some((name, header, timestamp)) = rx.recv().await {
let block_number = header.number;
let track = tracker
.entry(block_number)
.and_modify(|t: &mut TxTrack| {
Expand Down
9 changes: 5 additions & 4 deletions examples/fillers/examples/gas_filler.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//! Example of using the `GasFiller` in the provider.

use alloy::{
consensus::Transaction,
network::TransactionBuilder,
primitives::{address, U256},
providers::{Provider, ProviderBuilder},
Expand Down Expand Up @@ -34,9 +35,9 @@ async fn main() -> Result<()> {
let node_hash = *builder.tx_hash();
let pending_tx =
provider.get_transaction_by_hash(node_hash).await?.expect("Pending transaction not found");
assert_eq!(pending_tx.nonce, 0);
assert_eq!(pending_tx.nonce(), 0);

println!("Transaction sent with nonce: {}", pending_tx.nonce);
println!("Transaction sent with nonce: {}", pending_tx.nonce());

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

println!("Transaction sent with nonce: {}", pending_tx.nonce);
println!("Transaction sent with nonce: {}", pending_tx.nonce());

Ok(())
}
9 changes: 5 additions & 4 deletions examples/fillers/examples/nonce_filler.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//! Example of using the `NonceFiller` in the provider.

use alloy::{
consensus::Transaction,
network::TransactionBuilder,
primitives::{address, U256},
providers::{Provider, ProviderBuilder},
Expand Down Expand Up @@ -51,18 +52,18 @@ async fn main() -> Result<()> {
let node_hash = *builder.tx_hash();
let pending_tx =
provider.get_transaction_by_hash(node_hash).await?.expect("Transaction not found");
assert_eq!(pending_tx.nonce, 0);
assert_eq!(pending_tx.nonce(), 0);

println!("Transaction sent with nonce: {}", pending_tx.nonce);
println!("Transaction sent with nonce: {}", pending_tx.nonce());

// Send the transaction, the nonce (1) is automatically managed by the provider.
let builder = provider.send_transaction(tx).await?;
let node_hash = *builder.tx_hash();
let pending_tx =
provider.get_transaction_by_hash(node_hash).await?.expect("Transaction not found");
assert_eq!(pending_tx.nonce, 1);
assert_eq!(pending_tx.nonce(), 1);

println!("Transaction sent with nonce: {}", pending_tx.nonce);
println!("Transaction sent with nonce: {}", pending_tx.nonce());

Ok(())
}
9 changes: 5 additions & 4 deletions examples/fillers/examples/recommended_fillers.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//! Example of using the `.with_recommended_fillers()` method in the provider.

use alloy::{
consensus::Transaction,
network::TransactionBuilder,
primitives::{address, U256},
providers::{Provider, ProviderBuilder},
Expand Down Expand Up @@ -30,18 +31,18 @@ async fn main() -> Result<()> {
let node_hash = *builder.tx_hash();
let pending_tx =
provider.get_transaction_by_hash(node_hash).await?.expect("Pending transaction not found");
assert_eq!(pending_tx.nonce, 0);
assert_eq!(pending_tx.nonce(), 0);

println!("Transaction sent with nonce: {}", pending_tx.nonce);
println!("Transaction sent with nonce: {}", pending_tx.nonce());

// Send the transaction, the nonce (1) is automatically managed by the provider.
let builder = provider.send_transaction(tx).await?;
let node_hash = *builder.tx_hash();
let pending_tx =
provider.get_transaction_by_hash(node_hash).await?.expect("Pending transaction not found");
assert_eq!(pending_tx.nonce, 1);
assert_eq!(pending_tx.nonce(), 1);

println!("Transaction sent with nonce: {}", pending_tx.nonce);
println!("Transaction sent with nonce: {}", pending_tx.nonce());

Ok(())
}
6 changes: 3 additions & 3 deletions examples/providers/examples/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ async fn main() -> Result<()> {

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

println!("Awaiting blocks...");
println!("Awaiting block headers...");

let handle = tokio::spawn(async move {
while let Some(block) = stream.next().await {
println!("{}", block.header.number);
while let Some(header) = stream.next().await {
println!("{}", header.number);
}
});

Expand Down
6 changes: 3 additions & 3 deletions examples/providers/examples/ws.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ async fn main() -> Result<()> {
// Wait and take the next 4 blocks.
let mut stream = sub.into_stream().take(4);

println!("Awaiting blocks...");
println!("Awaiting block headers...");

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

Expand Down
18 changes: 9 additions & 9 deletions examples/providers/examples/ws_with_auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,27 @@ async fn main() -> Result<()> {
let provider_basic = ProviderBuilder::new().on_ws(ws_basic).await?;
let provider_bearer = ProviderBuilder::new().on_ws(ws_bearer).await?;

// Subscribe to new blocks.
// Subscribe to new block headers.
let sub_basic = provider_basic.subscribe_blocks();
let sub_bearer = provider_bearer.subscribe_blocks();

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

println!("Awaiting blocks...");
println!("Awaiting block headers...");

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

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

Expand Down
6 changes: 3 additions & 3 deletions examples/subscriptions/examples/subscribe_blocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ async fn main() -> Result<()> {
let ws = WsConnect::new(anvil.ws_endpoint());
let provider = ProviderBuilder::new().on_ws(ws).await?;

// Subscribe to blocks.
// Subscribe to block headers.
let subscription = provider.subscribe_blocks().await?;
let mut stream = subscription.into_stream().take(2);

while let Some(block) = stream.next().await {
println!("Received block number: {}", block.header.number);
while let Some(header) = stream.next().await {
println!("Received block number: {}", header.number);
}

// Poll for block headers.
Expand Down
4 changes: 2 additions & 2 deletions examples/transactions/examples/encode_decode_eip1559.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use alloy::{
consensus::{SignableTransaction, TxEip1559},
eips::eip2930::AccessList,
primitives::{address, b256, hex, Signature, TxKind, U256},
primitives::{address, b256, hex, PrimitiveSignature as Signature, TxKind, U256},
};
use eyre::Result;

Expand Down Expand Up @@ -33,7 +33,7 @@ async fn main() -> Result<()> {
b256!("840cfc572845f5786e702984c2a582528cad4b49b2a10b9db1be7fca90058565"),
b256!("25e7109ceb98168d95b09b18bbf6b685130e0562f233877d492b94eee0c5b6d1"),
false,
)?;
);

// Convert the transaction into a signed transaction.
let signed_tx = tx.into_signed(signature);
Expand Down
4 changes: 2 additions & 2 deletions examples/wallets/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ workspace = true
alloy.workspace = true

aws-config = { version = "1.5", default-features = false }
aws-sdk-kms = { version = "1.47", default-features = false }
aws-sdk-kms = { version = "1.50", default-features = false }
eyre.workspace = true
rand = "0.8"
serde = { workspace = true, features = ["derive"] }
tempfile = "3.13"
tempfile = "3.14"
tokio = { workspace = true, features = ["macros", "rt-multi-thread"] }

0 comments on commit bc7aa07

Please sign in to comment.