-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
00ae12e
commit 3a30886
Showing
7 changed files
with
108 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"jsonrpc":"2.0","id":1,"result":{"trie_pre_images":{"combined":{"compact":"0x"}},"code_db":{},"txn_info":[{"traces":{"0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266":{"balance":"0xd3c21bce8022181a02cd","nonce":"0x3"},"0x0000000000000000000000000000000000000000":{"balance":"0x3bbc3b274218","nonce":"0x0"},"0x852da15b70a3e197d1d668a9a481b1f4c2168a5d":{"balance":"0x3","nonce":"0x0"}},"meta":{"byte_code":"0xf86602843b9aca07830186a094852da15b70a3e197d1d668a9a481b1f4c2168a5d0180820a95a0d5081ac0967a518e50ccdcb92d9eed98b71d5dfa9b38ccf3c63adc429d9d13a6a058c166e24381b70ceff2cbe22786a686e62a004ac82aecf0516c91dd53ef2e25","new_receipt_trie_node_byte":"0xf9010801825208b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0","gas_used":21000}}]}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
use alloy::{ | ||
primitives::B256, providers::Provider, rpc::types::eth::BlockId, transports::Transport, | ||
}; | ||
use trace_decoder::BlockTrace; | ||
|
||
use super::{fetch_other_block_data, CachedProvider}; | ||
use crate::prover::BlockProverInput; | ||
|
||
pub async fn block_prover_input<ProviderT, TransportT>( | ||
cached_provider: std::sync::Arc<CachedProvider<ProviderT, TransportT>>, | ||
target_block_id: BlockId, | ||
checkpoint_block_number: u64, | ||
) -> anyhow::Result<BlockProverInput> | ||
where | ||
ProviderT: Provider<TransportT>, | ||
TransportT: Transport + Clone, | ||
{ | ||
let block_number = match target_block_id { | ||
BlockId::Number(block_number) => block_number, | ||
_ => return Err(anyhow::anyhow!("block number expected")), | ||
}; | ||
|
||
println!("Fetching block trace for block number: {}", block_number); | ||
|
||
let block_trace: BlockTrace = cached_provider | ||
.get_provider() | ||
.await? | ||
.raw_request("zero_getBlockTraceByNumber".into(), vec![block_number]) | ||
.await?; | ||
|
||
println!("trace: {:?}", block_trace); | ||
|
||
let other_data = | ||
fetch_other_block_data(cached_provider, target_block_id, checkpoint_block_number).await?; | ||
println!("other_data: {:?}", other_data); | ||
|
||
// Assemble | ||
Ok(BlockProverInput { | ||
block_trace, | ||
other_data, | ||
}) | ||
} |