diff --git a/.github/workflows/openapi-deploy.yml b/.github/workflows/openapi-deploy.yml index 4c6052f9..8649a5d0 100644 --- a/.github/workflows/openapi-deploy.yml +++ b/.github/workflows/openapi-deploy.yml @@ -17,10 +17,10 @@ concurrency: jobs: deploy-docs: name: Generate OpenAPI docs + runs-on: ubuntu-latest environment: - name: github-pages + name: ${{ (github.ref == 'refs/heads/main') && 'github-pages' || 'test-environment' }} url: ${{ steps.deployment.outputs.page_url }} - runs-on: ubuntu-latest steps: - name: Checkout @@ -36,13 +36,16 @@ jobs: run: ./script/generate-docs.sh - name: Setup Pages + if: github.ref == 'refs/heads/main' uses: actions/configure-pages@v3 - name: Upload artifact + if: github.ref == 'refs/heads/main' uses: actions/upload-pages-artifact@v2 with: - path: './openapi' + path: './openapi' - name: Deploy to GitHub Pages + if: github.ref == 'refs/heads/main' id: deployment uses: actions/deploy-pages@v2 diff --git a/host/src/preflight.rs b/host/src/preflight.rs index 0a98d1e3..a1ef0db8 100644 --- a/host/src/preflight.rs +++ b/host/src/preflight.rs @@ -11,10 +11,10 @@ use raiko_lib::{ builder::{ prepare::TaikoHeaderPrepStrategy, BlockBuilder, OptimisticDatabase, TkoTxExecStrategy, }, - consts::{ChainSpec, Network}, + consts::ChainSpec, input::{ - decode_anchor, proposeBlockCall, taiko_a6::BlockProposed as TestnetBlockProposed, - BlockProposed, GuestInput, TaikoGuestInput, TaikoProverData, + decode_anchor, proposeBlockCall, BlockProposed, GuestInput, TaikoGuestInput, + TaikoProverData, }, utils::{generate_transactions, to_header, zlib_compress_data}, Measurement, @@ -476,16 +476,8 @@ async fn get_block_proposed_event( bail!("No L1 contract address in the chain spec"); }; - let Some(network) = chain_spec.network() else { - bail!("No network in the chain spec"); - }; - // Get the event signature (value can differ between chains) - let event_signature = if network == Network::TaikoA6 { - TestnetBlockProposed::SIGNATURE_HASH - } else { - BlockProposed::SIGNATURE_HASH - }; + let event_signature = BlockProposed::SIGNATURE_HASH; // Setup the filter to get the relevant events let filter = Filter::new() .address(l1_address) @@ -504,16 +496,9 @@ async fn get_block_proposed_event( ) else { bail!("Could not create log") }; - let (block_id, data) = if network == Network::TaikoA6 { - let event = TestnetBlockProposed::decode_log(&log_struct, false) - .map_err(|_| HostError::Anyhow(anyhow!("Could not decode tesstnet log")))?; - (event.blockId, event.data.into()) - } else { - let event = BlockProposed::decode_log(&log_struct, false) - .map_err(|_| HostError::Anyhow(anyhow!("Could not decode log")))?; - (event.blockId, event.data) - }; - if block_id == raiko_primitives::U256::from(l2_block_number) { + let event = BlockProposed::decode_log(&log_struct, false) + .map_err(|_| HostError::Anyhow(anyhow!("Could not decode log")))?; + if event.blockId == raiko_primitives::U256::from(l2_block_number) { let Some(log_tx_hash) = log.transaction_hash else { bail!("No transaction hash in the log") }; @@ -521,7 +506,7 @@ async fn get_block_proposed_event( .get_transaction_by_hash(log_tx_hash) .await .expect("Could not find the propose tx"); - return Ok((tx, data)); + return Ok((tx, event.data)); } } bail!("No BlockProposed event found for block {l2_block_number}"); @@ -638,7 +623,10 @@ fn from_block_tx(tx: &AlloyRpcTransaction) -> HostResult { #[cfg(test)] mod test { use ethers_core::types::Transaction; - use raiko_lib::{consts::get_network_spec, utils::decode_transactions}; + use raiko_lib::{ + consts::{get_network_spec, Network}, + utils::decode_transactions, + }; use raiko_primitives::{eip4844::parse_kzg_trusted_setup, kzg::KzgSettings}; use super::*; @@ -877,7 +865,7 @@ mod test { #[ignore] #[test] fn test_slot_block_num_mapping() { - let chain_spec = get_network_spec(Network::TaikoA6); + let chain_spec = get_network_spec(Network::TaikoA7); let expected_slot = 1000u64; let second_per_slot = 12u64; let block_time = chain_spec.genesis_time + expected_slot * second_per_slot; diff --git a/lib/src/consts.rs b/lib/src/consts.rs index 667b92f2..65250dd4 100644 --- a/lib/src/consts.rs +++ b/lib/src/consts.rs @@ -96,31 +96,6 @@ lazy_static! { is_taiko: false, }; - /// The Taiko A6 specification. - pub static ref TAIKO_A6_CHAIN_SPEC: ChainSpec = ChainSpec { - name: Network::TaikoA6.to_string(), - chain_id: 167008, - max_spec_id: SpecId::SHANGHAI, - hard_forks: BTreeMap::from([ - (SpecId::SHANGHAI, ForkCondition::Block(0)), - (SpecId::CANCUN, ForkCondition::TBD), - ]), - eip_1559_constants: Eip1559Constants { - base_fee_change_denominator: uint!(8_U256), - base_fee_max_increase_denominator: uint!(8_U256), - base_fee_max_decrease_denominator: uint!(8_U256), - elasticity_multiplier: uint!(2_U256), - }, - l1_contract: Some(Address::from_str("0xB20BB9105e007Bd3E0F73d63D4D3dA2c8f736b77").unwrap()), - l2_contract: Some(Address::from_str("0x1670080000000000000000000000000000010001").unwrap()), - sgx_verifier_address: Some( - Address::from_str("0x558E38a3286916934Cb63ced04558A52F7Ce67a9").unwrap(), - ), - genesis_time: 0u64, - seconds_per_slot: 1u64, - is_taiko: true, - }; - /// The Taiko A7 specification. pub static ref TAIKO_A7_CHAIN_SPEC: ChainSpec = ChainSpec { name: Network::TaikoA7.to_string(), @@ -151,7 +126,6 @@ pub fn get_network_spec(network: Network) -> ChainSpec { match network { Network::Ethereum => ETH_MAINNET_CHAIN_SPEC.clone(), Network::Holesky => ETH_HOLESKY_CHAIN_SPEC.clone(), - Network::TaikoA6 => TAIKO_A6_CHAIN_SPEC.clone(), Network::TaikoA7 => TAIKO_A7_CHAIN_SPEC.clone(), } } @@ -286,8 +260,6 @@ pub enum Network { Ethereum, /// Ethereum testnet holesky Holesky, - /// Taiko A6 tesnet - TaikoA6, /// Taiko A7 tesnet TaikoA7, } @@ -299,7 +271,6 @@ impl FromStr for Network { match s.to_lowercase().as_str() { "ethereum" => Ok(Network::Ethereum), "holesky" => Ok(Network::Holesky), - "taiko_a6" => Ok(Network::TaikoA6), "taiko_a7" => Ok(Network::TaikoA7), #[allow(clippy::needless_return)] _ => bail!("Unknown network"), @@ -312,7 +283,6 @@ impl Display for Network { f.write_str(match self { Network::Ethereum => "ethereum", Network::Holesky => "holesky", - Network::TaikoA6 => "taiko_a6", Network::TaikoA7 => "taiko_a7", }) } @@ -323,7 +293,6 @@ impl Network { match self { Network::Ethereum => false, Network::Holesky => false, - Network::TaikoA6 => true, Network::TaikoA7 => true, } } diff --git a/lib/src/input.rs b/lib/src/input.rs index 0d6d6a98..5dd425c8 100644 --- a/lib/src/input.rs +++ b/lib/src/input.rs @@ -205,131 +205,6 @@ sol! { function proveBlock(uint64 blockId, bytes calldata input) {} } -pub mod taiko_a6 { - use alloy_sol_types::sol; - use serde::{Deserialize, Serialize}; - - sol! { - #[derive(Debug, Default, Deserialize, Serialize)] - struct EthDeposit { - address recipient; - uint96 amount; - uint64 id; - } - - #[derive(Debug, Default, Deserialize, Serialize)] - struct BlockMetadata { - bytes32 l1Hash; // slot 1 - bytes32 difficulty; // slot 2 - bytes32 blobHash; //or txListHash (if Blob not yet supported), // slot 3 - bytes32 extraData; // slot 4 - bytes32 depositsHash; // slot 5 - address coinbase; // L2 coinbase, // slot 6 - uint64 id; - uint32 gasLimit; - uint64 timestamp; // slot 7 - uint64 l1Height; - uint24 txListByteOffset; - uint24 txListByteSize; - uint16 minTier; - bool blobUsed; - bytes32 parentMetaHash; // slot 8 - } - - #[derive(Debug, Default, Deserialize, Serialize)] - struct BlockParams { - address assignedProver; - address coinbase; - bytes32 extraData; - bytes32 blobHash; - uint24 txListByteOffset; - uint24 txListByteSize; - bool cacheBlobForReuse; - bytes32 parentMetaHash; - HookCall[] hookCalls; - } - - #[derive(Debug, Default, Deserialize, Serialize)] - struct HookCall { - address hook; - bytes data; - } - - #[derive(Debug)] - struct Transition { - bytes32 parentHash; - bytes32 blockHash; - bytes32 signalRoot; - bytes32 graffiti; - } - - #[derive(Debug, Default, Deserialize, Serialize)] - event BlockProposed( - uint256 indexed blockId, - address indexed assignedProver, - uint96 livenessBond, - BlockMetadata meta, - EthDeposit[] depositsProcessed - ); - - #[derive(Debug)] - struct TierProof { - uint16 tier; - bytes data; - } - - #[derive(Debug)] - function proposeBlock( - bytes calldata params, - bytes calldata txList - ) - {} - - function proveBlock(uint64 blockId, bytes calldata input) {} - } -} - -impl From for EthDeposit { - fn from(item: taiko_a6::EthDeposit) -> Self { - EthDeposit { - recipient: item.recipient, - amount: item.amount, - id: item.id, - } - } -} - -impl From for BlockProposed { - fn from(item: taiko_a6::BlockProposed) -> Self { - BlockProposed { - blockId: item.blockId, - assignedProver: item.assignedProver, - livenessBond: item.livenessBond, - meta: BlockMetadata { - l1Hash: item.meta.l1Hash, - difficulty: item.meta.difficulty, - blobHash: item.meta.blobHash, - extraData: item.meta.extraData, - depositsHash: item.meta.depositsHash, - coinbase: item.meta.coinbase, - id: item.meta.id, - gasLimit: item.meta.gasLimit, - timestamp: item.meta.timestamp, - l1Height: item.meta.l1Height, - minTier: item.meta.minTier, - blobUsed: item.meta.blobUsed, - parentMetaHash: item.meta.parentMetaHash, - ..Default::default() - }, - depositsProcessed: item - .depositsProcessed - .iter() - .map(|v| v.clone().into()) - .collect(), - } - } -} - #[cfg(feature = "std")] use std::path::Path; diff --git a/script/prove-block.sh b/script/prove-block.sh index 35eeadc9..9ebacefd 100755 --- a/script/prove-block.sh +++ b/script/prove-block.sh @@ -28,16 +28,12 @@ if [ "$chain" == "ethereum" ]; then rpc="https://rpc.ankr.com/eth" elif [ "$chain" == "holesky" ]; then rpc="https://ethereum-holesky-rpc.publicnode.com" -elif [ "$chain" == "taiko_a6" ]; then - rpc="https://rpc.katla.taiko.xyz" - l1Rpc="https://ethereum-holesky-rpc.publicnode.com" - beaconRpc="https://l1beacon.hekla.taiko.xyz" elif [ "$chain" == "taiko_a7" ]; then rpc="https://rpc.hekla.taiko.xyz" l1Rpc="https://ethereum-holesky-rpc.publicnode.com" beaconRpc="https://eth-holesky-beacon.public.blastapi.io" else - echo "Invalid chain name. Please use 'ethereum', 'taiko_a6' or 'taiko_a7'." + echo "Invalid chain name. Please use 'ethereum', 'holesky' or 'taiko_a7'." exit 1 fi