Skip to content

Commit

Permalink
code fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
smtmfft committed Feb 20, 2024
1 parent ab7aceb commit aaba77e
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions lib/src/taiko/host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use alloy_sol_types::sol_data::FixedBytes;
use anyhow::Result;
use ethers_core::types::{Block, Transaction as EthersTransaction, H160, H256, U256};
use reqwest;
use reth_primitives::eip4844::kzg_to_versioned_hash;
use serde::Deserialize;
use sha2::{Digest, Sha256};
use tracing::info;
Expand All @@ -24,8 +25,6 @@ use crate::{
taiko::{precheck::rebuild_and_precheck_block, Layer},
};

use reth_primitives::eip4844::kzg_to_versioned_hash;

#[derive(Debug)]
pub struct TaikoExtra {
pub l1_hash: B256,
Expand Down Expand Up @@ -281,7 +280,7 @@ fn decode_blob_data(blob: &str) -> Vec<u8> {
fn calc_blob_hash(commitment: &String) -> [u8; 32] {
let commit_bytes = hex::decode(commitment.to_lowercase().trim_start_matches("0x")).unwrap();
let kzg_commit = c_kzg::KzgCommitment::from_bytes(&commit_bytes).unwrap();
let version_hash: [u8;32] = kzg_to_versioned_hash(kzg_commit).0.clone();
let version_hash: [u8; 32] = kzg_to_versioned_hash(kzg_commit).0.clone();
version_hash
}

Expand Down Expand Up @@ -432,9 +431,10 @@ pub fn get_taiko_initial_data<N: NetworkStrategyBundle<TxEssence = EthereumTxEss

#[cfg(test)]
mod test {
use super::*;
use ethers_core::types::Transaction;

use super::*;

#[test]
fn test_fetch_blob_data_and_hash() {
let blob_data = fetch_blob_data("http://localhost:3500".to_string(), 5).unwrap();
Expand Down Expand Up @@ -481,9 +481,11 @@ mod test {
let mut l1_provider = new_provider(None, Some("http://127.0.0.1:8545".to_owned()))
.expect("valid provider");

let l1_next_block = l1_provider.get_full_block(&BlockQuery {
let l1_next_block = l1_provider
.get_full_block(&BlockQuery {
block_no: l1_block_no + 1,
}).expect("get l1_next_block success");
})
.expect("get l1_next_block success");
println!("l1_next_block: {:?}", l1_next_block);

let (propose_tx, _) = l1_provider
Expand All @@ -495,6 +497,8 @@ mod test {
.expect("valid get_blob_tx_propose");

println!("propose_tx: {:?}", propose_tx);
}).await.unwrap();
})
.await
.unwrap();
}
}

0 comments on commit aaba77e

Please sign in to comment.