Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
Signed-off-by: smtmfft <[email protected]>
  • Loading branch information
smtmfft committed Jan 13, 2025
1 parent 369a7ce commit f1f0fdb
Show file tree
Hide file tree
Showing 10 changed files with 1,119 additions and 975 deletions.
1,588 changes: 720 additions & 868 deletions Cargo.lock

Large diffs are not rendered by default.

42 changes: 8 additions & 34 deletions core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,18 +332,20 @@ mod tests {
.parse()
.unwrap();
let provider = if v2_preflight {
let provider: RethPreflightBlockDataProvider = RethPreflightBlockDataProvider::new(
let mut provider: RethPreflightBlockDataProvider = RethPreflightBlockDataProvider::new(
&taiko_chain_spec.rpc.clone(),
proof_request.block_number - 1,
)
.await
.expect("new RethPreflightBlockDataProvider should be ok");
provider.fetch_preflight_data().await.unwrap();
BlockDataProviderType::PreflightRpc(provider)
} else {
let provider = RpcBlockDataProvider::new(
&taiko_chain_spec.rpc.clone(),
taiko_chain_spec.preflight_rpc.clone(),
proof_request.block_number - 1,
)
.await
.expect("new RpcBlockDataProvider should be ok");
BlockDataProviderType::CommonRpc(provider)
};
Expand All @@ -366,36 +368,6 @@ mod tests {
.expect("proof generation failed")
}

#[ignore]
#[tokio::test(flavor = "multi_thread")]
async fn test_prove_block_taiko_dev() {
let proof_type = get_proof_type_from_env();
let l1_network = "taiko_dev_l1".to_owned();
let network = "taiko_dev".to_owned();
// Give the CI an simpler block to test because it doesn't have enough memory.
// Unfortunately that also means that kzg is not getting fully verified by CI.
let block_number = 20;
let chain_specs = SupportedChainSpecs::merge_from_file(
"../host/config/chain_spec_list_devnet.json".into(),
)
.unwrap();
let taiko_chain_spec = chain_specs.get_chain_spec(&network).unwrap();
let l1_chain_spec = chain_specs.get_chain_spec(&l1_network).unwrap();

let proof_request = ProofRequest {
block_number,
l1_inclusion_block_number: 80,
network,
graffiti: B256::ZERO,
prover: Address::ZERO,
l1_network,
proof_type,
blob_proof_type: BlobProofType::ProofOfEquivalence,
prover_args: test_proof_params(false),
};
prove_block(l1_chain_spec, taiko_chain_spec, proof_request).await;
}

#[tokio::test(flavor = "multi_thread")]
async fn test_prove_block_taiko_a7() {
let _ = env_logger::builder().is_test(true).try_init();
Expand All @@ -405,7 +377,7 @@ mod tests {
let network = Network::TaikoA7.to_string();
// Give the CI an simpler block to test because it doesn't have enough memory.
// Unfortunately that also means that kzg is not getting fully verified by CI.
let block_number = if is_ci() { 105987 } else { 101368 };
let block_number = if is_ci() { 105987 } else { 0x110e68 };
let taiko_chain_spec = SupportedChainSpecs::default()
.get_chain_spec(&network)
.unwrap();
Expand All @@ -428,7 +400,9 @@ mod tests {
}

async fn get_recent_block_num(chain_spec: &ChainSpec) -> u64 {
let provider = RpcBlockDataProvider::new(&chain_spec.rpc, 0).unwrap();
let provider = RpcBlockDataProvider::new(&chain_spec.rpc, None, 0)
.await
.unwrap();
let height = provider.provider.get_block_number().await.unwrap();
height - 100
}
Expand Down
6 changes: 2 additions & 4 deletions core/src/preflight/reth_preflight.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ use alloy_rpc_types::eth::{
Block as AlloyEthBlock, EIP1186AccountProofResponse, Header as AlloyEthHeader,
};
use raiko_lib::{
builder::RethBlockBuilder,
input::{GuestInput},
primitives::mpt::proofs_to_tries,
Measurement,
builder::RethBlockBuilder, input::GuestInput, primitives::mpt::proofs_to_tries, Measurement,
};
use serde::{Deserialize, Serialize};
use tracing::error;
Expand All @@ -23,6 +20,7 @@ use crate::preflight::util::{

/// `PreFlightRpcData` is the pre-flight data for the proving process.
#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct PreFlightRpcData {
/// The block to be proven.
// pub block: alloy_rpc_types_eth::Block,
Expand Down
2 changes: 1 addition & 1 deletion core/src/preflight/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ pub async fn prepare_taiko_chain_input(

// // Get the L1 block in which the L2 block was included so we can fetch the DA data.
// // Also get the L1 state block header so that we can prove the L1 state root.
let provider_l1 = RpcBlockDataProvider::new(&l1_chain_spec.rpc, block_number)?;
let provider_l1 = RpcBlockDataProvider::new(&l1_chain_spec.rpc, None, block_number).await?;

info!("current taiko chain fork: {fork:?}");

Expand Down
3 changes: 2 additions & 1 deletion core/src/provider/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ pub async fn get_task_data(
let taiko_chain_spec = chain_specs
.get_chain_spec(network)
.ok_or_else(|| RaikoError::InvalidRequestConfig("Unsupported raiko network".to_string()))?;
let provider = RpcBlockDataProvider::new(&taiko_chain_spec.rpc.clone(), block_number - 1)?;
let provider =
RpcBlockDataProvider::new(&taiko_chain_spec.rpc.clone(), None, block_number - 1).await?;
let blocks = provider.get_blocks(&[(block_number, false)]).await?;
let block = blocks
.first()
Expand Down
Loading

0 comments on commit f1f0fdb

Please sign in to comment.