Skip to content
This repository has been archived by the owner on Aug 6, 2024. It is now read-only.

Commit

Permalink
bricked
Browse files Browse the repository at this point in the history
  • Loading branch information
puma314 committed May 17, 2024
1 parent 78c0229 commit 403daa3
Show file tree
Hide file tree
Showing 4 changed files with 172 additions and 0 deletions.
116 changes: 116 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ members = [
"examples/db-access",
"testing/ef-tests/",
"testing/testing-utils",
"testing/test",
]
default-members = ["bin/reth"]

Expand Down Expand Up @@ -306,6 +307,7 @@ alloy-signer = { git = "https://github.com/alloy-rs/alloy", rev = "dd7a999" }
alloy-signer-wallet = { git = "https://github.com/alloy-rs/alloy", rev = "dd7a999" }
alloy-network = { git = "https://github.com/alloy-rs/alloy", rev = "dd7a999" }
alloy-consensus = { git = "https://github.com/alloy-rs/alloy", rev = "dd7a999" }
alloy-transport-http = { git = "https://github.com/alloy-rs/alloy", rev = "dd7a999" }

# misc
auto_impl = "1"
Expand Down
24 changes: 24 additions & 0 deletions testing/test/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[package]
name = "debugging"
description = "Testing utils for reth."
version.workspace = true
edition.workspace = true
rust-version.workspace = true
license.workspace = true
homepage.workspace = true
repository.workspace = true

[lints]
workspace = true

[dependencies]
secp256k1.workspace = true
alloy-genesis.workspace = true
reth-primitives = { workspace = true, features = ["alloy-compat"] }
alloy-rpc-types.workspace = true
alloy-provider = { workspace = true, features = ["reqwest"] }
alloy-transport-http.workspace = true
tokio = { workspace = true, features = ["rt-multi-thread"] }
url.workspace = true
eyre.workspace = true
futures-util.workspace = true
30 changes: 30 additions & 0 deletions testing/test/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
use alloy_provider::{Provider as AlloyProvider, ReqwestProvider};
use alloy_rpc_types::{transaction, Block, BlockId, EIP1186AccountProofResponse};
use alloy_transport_http::Http;
use reth_primitives::{Block as RethBlock, U256};
use url::Url;

#[tokio::main]
async fn main() -> eyre::Result<()> {
let block_number = 18884920u64;
let rpc_url = Url::parse("https://docs-demo.quiknode.pro/").expect("Invalid RPC URL");
let provider: ReqwestProvider = ReqwestProvider::new_http(rpc_url);

let alloy_block =
provider.get_block_by_number(block_number.into(), true).await.unwrap().unwrap();
if let Some(transactions) = alloy_block.transactions.as_transactions() {
for (i, tx) in transactions.iter().enumerate() {
if i == 3 {
println!("Transaction: {:?}", tx.hash);
}
}
}

let block = RethBlock::try_from(alloy_block).unwrap();
for (i, transaction) in block.body.iter().enumerate() {
if i == 3 {
println!("Transaction: {:?}", transaction);
}
}
Ok(())
}

0 comments on commit 403daa3

Please sign in to comment.