Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
yash-atreya committed Mar 7, 2025
1 parent 535992d commit 6ddf862
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
13 changes: 5 additions & 8 deletions examples/advanced/examples/foundry_fork_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,11 @@ use std::sync::Arc;
use alloy::{
consensus::BlockHeader,
eips::BlockId,
network::{AnyNetwork, TransactionBuilder, TransactionResponse},
network::{AnyNetwork, AnyRpcBlock, TransactionBuilder},
node_bindings::Anvil,
primitives::U256,
providers::{Provider, ProviderBuilder},
rpc::types::{
serde_helpers::WithOtherFields, Block, BlockTransactionsKind, TransactionRequest,
},
rpc::types::TransactionRequest,
};
use eyre::Result;
use foundry_fork_db::{cache::BlockchainDbMeta, BlockchainDb, SharedBackend};
Expand All @@ -29,8 +27,7 @@ async fn main() -> Result<()> {
let anvil = Anvil::new().spawn();
let provider = ProviderBuilder::new().network::<AnyNetwork>().on_http(anvil.endpoint_url());

let block =
provider.get_block(BlockId::latest(), BlockTransactionsKind::Hashes).await?.unwrap();
let block = provider.get_block(BlockId::latest()).await?.unwrap();

// The `BlockchainDbMeta` is used a identifier when the db is flushed to the disk.
// This aids in cases where the disk contains data from multiple forks.
Expand Down Expand Up @@ -120,8 +117,8 @@ async fn main() -> Result<()> {
Ok(())
}

fn configure_evm_env<T: TransactionResponse, H: BlockHeader>(
block: WithOtherFields<Block<T, H>>,
fn configure_evm_env(
block: AnyRpcBlock,
shared: SharedBackend,
tx_env: TxEnv,
) -> Evm<'static, (), CacheDB<SharedBackend>> {
Expand Down
3 changes: 1 addition & 2 deletions examples/contracts/examples/jsonrpc_error_decoding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ fn main() -> Result<()> {
let payload: ErrorPayload = serde_json::from_str(json)?;

// Attempt to decode the error payload as our custom error.
let Errors::ErrorsErrors::SomeCustomError(value) =
payload.as_decoded_error::<Errors::ErrorsErrors>(false).unwrap();
let value = payload.as_decoded_error::<Errors::SomeCustomError>().unwrap();

assert_eq!(value.a, U256::from(1));

Expand Down
4 changes: 2 additions & 2 deletions examples/providers/examples/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ async fn main() -> Result<()> {

// This requires the `pubsub` and `ws` features to be enabled.
let ws_rpc_url = anvil.ws_endpoint();
let ws_provider = ProviderBuilder::new().on_builtin(&ws_rpc_url).await?;
let ws_provider = ProviderBuilder::new().connect(&ws_rpc_url).await?;

let sub = ws_provider.subscribe_blocks().await?;

Expand All @@ -43,7 +43,7 @@ async fn main() -> Result<()> {
// This requires the `pubsub` and `ipc` features to be enabled.
// This would throw a runtime error if the ipc does not exist.
let ipc_path = "/tmp/reth.ipc";
let ipc_provider = ProviderBuilder::new().on_builtin(ipc_path).await?;
let ipc_provider = ProviderBuilder::new().connect(ipc_path).await?;

let _block_number = ipc_provider.get_block_number().await?;

Expand Down

0 comments on commit 6ddf862

Please sign in to comment.