Skip to content

Commit

Permalink
add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
ratankaliani committed Sep 10, 2024
1 parent 1f37dad commit fc35dc5
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 18 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ SKIP_SIMULATION=true

# Config for deploying contract
ETHERSCAN_API_KEY=
USE_CACHED_STARTING_BLOCK=false
30 changes: 18 additions & 12 deletions book/getting-started/l2-output-oracle.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 \
Expand Down
2 changes: 2 additions & 0 deletions book/getting-started/proposer.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions contracts/zkconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 3 additions & 3 deletions scripts/prove/bin/fetch_rollup_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -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);
Expand Down

0 comments on commit fc35dc5

Please sign in to comment.