diff --git a/.env.example b/.env.example index a1a2bf7a..0fe98d5f 100644 --- a/.env.example +++ b/.env.example @@ -22,3 +22,4 @@ SKIP_SIMULATION=true # Config for deploying contract ETHERSCAN_API_KEY= +USE_CACHED_STARTING_BLOCK=false diff --git a/book/getting-started/l2-output-oracle.md b/book/getting-started/l2-output-oracle.md index 718cf117..25070cb3 100644 --- a/book/getting-started/l2-output-oracle.md +++ b/book/getting-started/l2-output-oracle.md @@ -12,7 +12,24 @@ git clone https://github.com/succinctlabs/op-succinct.git cd op-succinct ``` -### 2) Navigate to the contracts directory: +### 2) Set environment variables: + +```bash +cp .env.example .env +``` + +Make sure to set your `.env` with the following variables: + +``` +L1_RPC=... +L1_BEACON_RPC=... +L2_NODE_RPC=... +L2_RPC=... +PRIVATE_KEY=... +ETHERSCAN_API_KEY=... +``` + +### 3) Navigate to the contracts directory: ```bash cd contracts @@ -42,17 +59,6 @@ Inside the `contracts` folder there is a file called `zkconfig.json` that contai This foundry script will deploy the `ZKL2OutputOracle` contract to the specified L1 RPC and use the provided private key to sign the transaction. -Make sure to set your env with the following variables: - -``` -L1_RPC=... -L2_NODE_RPC=... -PRIVATE_KEY=... -ETHERSCAN_API_KEY=... -``` - -and then run the following command to deploy the contract: - ```bash forge script script/ZKDeployer.s.sol:ZKDeployer \ --rpc-url $L1_RPC \ diff --git a/book/getting-started/proposer.md b/book/getting-started/proposer.md index 4c5c8208..9516e18f 100644 --- a/book/getting-started/proposer.md +++ b/book/getting-started/proposer.md @@ -32,6 +32,8 @@ In the root directory, create a file called `.env` (mirroring `.env.example`) an | `SP1_PRIVATE_KEY` | The private key for the SP1 account. | | `SP1_PROVER` | The type of prover to use (set to "network"). | | `SKIP_SIMULATION` | Whether to skip simulation of the proof before sending to the SP1 server (default is true). | +| `USE_CACHED_STARTING_BLOCK` | Whether to use the cached starting block number from `zkconfig.json` (default is true). | +| `ETHERSCAN_API_KEY` | The Etherscan API key to use for verifying the contract on Etherscan. | ## 2) Build the Proposer diff --git a/contracts/zkconfig.json b/contracts/zkconfig.json index ff2f64cc..6c9db47a 100644 --- a/contracts/zkconfig.json +++ b/contracts/zkconfig.json @@ -7,9 +7,9 @@ "owner": "0x0000000000000000000000000000000000000000", "proposer": "0x0000000000000000000000000000000000000000", "rollupConfigHash": "0x7cfdc1b0168f70e9b2b7aaf126025ec80e6d476309b0803b30c6e58faaba4213", - "startingBlockNumber": 17070089, - "startingOutputRoot": "0xe3aba566f1b0238268c54eefac3abd4da4963e345d72ad9858764c3fe3dadad0", - "startingTimestamp": 1725942718, + "startingBlockNumber": 17075214, + "startingOutputRoot": "0x34246958c749cb3e22cc43597d6113c767ec020f6ecc4c0a7012b99e36db8c83", + "startingTimestamp": 1725952968, "submissionInterval": 150, "verifierGateway": "0x3B6041173B80E77f038f3F2C0f9744f04837185e", "vkey": "0x0020bd6cac24425070d1a352b97ae577579b63703811e14388050d6c816efc95" diff --git a/scripts/prove/bin/fetch_rollup_config.rs b/scripts/prove/bin/fetch_rollup_config.rs index 5292e5b9..6615fcc7 100644 --- a/scripts/prove/bin/fetch_rollup_config.rs +++ b/scripts/prove/bin/fetch_rollup_config.rs @@ -5,12 +5,12 @@ use op_succinct_client_utils::boot::hash_rollup_config; use op_succinct_host_utils::fetcher::{ChainMode, OPSuccinctDataFetcher}; use serde_json::{json, Value}; use sp1_sdk::{block_on, HashableKey, ProverClient}; -use std::{fs, path::PathBuf}; +use std::{env, fs, path::PathBuf}; pub const AGG_ELF: &[u8] = include_bytes!("../../../elf/aggregation-elf"); /// Fetch the rollup config from the rollup node as well as the relevant config for the L200 and save it to a file. -/// +/// fn save_rollup_config_to_zkconfig() -> Result<()> { let sp1_kona_data_fetcher = OPSuccinctDataFetcher::default(); @@ -21,7 +21,7 @@ fn save_rollup_config_to_zkconfig() -> Result<()> { let mut l2oo_config = get_l2oo_config_from_contracts(&workspace_root)?; // If the starting block number is not set, set it to 10 blocks before the latest block on L2. - if l2oo_config["startingBlockNumber"].as_u64().unwrap_or(0) == 0 { + if env::var("USE_CACHED_STARTING_BLOCK").unwrap_or("false".to_string()) != "true" { // Set the starting block number to 10 blocks before the latest block on L2. let latest_block = block_on(sp1_kona_data_fetcher.get_head(ChainMode::L2))?; l2oo_config["startingBlockNumber"] = json!(latest_block.number - 10);