From e5101181a47d878cadc81d4977337effc59b321d Mon Sep 17 00:00:00 2001 From: Ratan Kaliani Date: Tue, 10 Sep 2024 00:44:04 -0700 Subject: [PATCH] book removal --- book/deploy/intro.md | 1 - book/deploy/op-stack.md | 1 - book/deploy/smart-contract.md | 65 ------------------------ book/deploy/zk-proposer.md | 54 -------------------- scripts/prove/bin/fetch_rollup_config.rs | 2 +- 5 files changed, 1 insertion(+), 122 deletions(-) delete mode 100644 book/deploy/intro.md delete mode 100644 book/deploy/op-stack.md delete mode 100644 book/deploy/smart-contract.md delete mode 100644 book/deploy/zk-proposer.md diff --git a/book/deploy/intro.md b/book/deploy/intro.md deleted file mode 100644 index e74b87d1..00000000 --- a/book/deploy/intro.md +++ /dev/null @@ -1 +0,0 @@ -# Deploy OP Succinct diff --git a/book/deploy/op-stack.md b/book/deploy/op-stack.md deleted file mode 100644 index 1c81bb2f..00000000 --- a/book/deploy/op-stack.md +++ /dev/null @@ -1 +0,0 @@ -# Base OP Stack Rollup diff --git a/book/deploy/smart-contract.md b/book/deploy/smart-contract.md deleted file mode 100644 index ea0945c3..00000000 --- a/book/deploy/smart-contract.md +++ /dev/null @@ -1,65 +0,0 @@ -# Deploy Smart Contracts - -The first step in deploying OP Succinct is to deploy a Solidity smart contract that will verify ZKPs of OP derivation (OP's name for their state transition function) and contain the latest state root of your rollup. - -## Overview - -The `contracts/` directory has the relevant smart contracts and deployment scripts for this step. In particular, it contains: - -1) The `ZKL2OutputOracle.sol` contract which verifies a ZKP of OP derivation, and is a small of Optimism's `L2OutputOracle.sol` contract with the necessary changes to support ZK validity proofs. - -2) The `ZKUpgrader.s.sol` script, which deploys the `ZKL2OutputOracle.sol` implementation contract, upgrades an existing `L2OutputOracleProxy` to point to it, and initializes the new contract with values from `zkconfig.json`. - -[TODO: insert a diagram of how all the OP stack contracts interact with the ZKL2OutputOracle.sol] - -## Deployment - -### Upgrading an existing `L2OutputOracle.sol` - -### Deploying `ZKL2OutputOracle.sol` - -### ... -3) The `ZKDeployer.s.sol` script, which deploys the `ZKL2OutputOracle.sol` implementation contract, upgrades an existing `L2OutputOracleProxy` to point to it, and initializes the new contract with values from `zkconfig.json`. - -## Deploy Fresh Proxy - -For OP Sepolia, you can deploy a fresh proxy with the following command: - -```shell -forge script script/ZKDeployer.s.sol:ZKDeployer --rpc-url --private-key --verify --verifier etherscan --etherscan-api-key --broadcast --slow -vvvv --ffi -``` - -## Upgrade Existing Proxy - -To deploy and upgrade the contract for existing chains, run the following command (where `ADMIN_PK` is the private key of the admin address for the L1 proxy contracts): - -```shell -forge script script/ZKUpgrader.s.sol:ZKUpgrader --rpc-url --private-key --verify --verifier etherscan --etherscan-api-key --broadcast --slow --vvvv -``` - -## Starting Output Root - -Since the `ZKL2OutputOracle.sol` contract requires valid ZK proofs to transition the state, the contract must be seeded with an honest first value to be able to honestly prove transitions. - -For existing contracts upgrading, they already have honest values in the contract. For new chains, the `ZKUpgrader` script will initialize the contract as follows: - -- The `zkconfig.json` file includes a starting output block number, as well as an L2 Rollup RPC. -- The script queries the rollup node and gets the corresponding output root and timestamp for that block. -- It uses these three values to seed the contract, and all future output roots posted must be proved against this starting state. - -To retrieve these values manually, use: -``` -cast rpc --rpc-url optimism_outputAtBlock $(cast 2h ) | jq '.outputRoot .blockRef.timestamp' -``` - -New chains will likely use a starting output block number of 0 (genesis) and prove all transitions against this state. - -## vKey - -The `ZKL2OutputOracle.sol` contract requires a verification key to be able to verify the validity proofs. - -This key can be generated by running the following command from the root of the repo: - -```shell -cargo run --bin vkey --release -``` diff --git a/book/deploy/zk-proposer.md b/book/deploy/zk-proposer.md deleted file mode 100644 index db6e43a1..00000000 --- a/book/deploy/zk-proposer.md +++ /dev/null @@ -1,54 +0,0 @@ -# Deploy ZK Proposer - -After deploying the `ZKL2OutputOracle.sol`, the final step is to launch a "ZKP" version of the `op-proposer` that will call to [Succinct's Prover Network](TODO) to generate proofs and submit them onchain. - -## Deployment - -First, create a `.env` file that matches the `.env.example` file in the root of the `op-succinct` repo. - -```bash -cp .env.example .env -``` - - - - -Then, to run the OP proposer, follow these steps: - -Build the server with: - -```bash -docker compose build -``` - -Then, start the server: -```bash -docker compose up -d -``` - -To stop the server, run: -```bash -docker compose down -``` - -This launches a Docker container with a modified version of the `op-proposer` (which can be found at [our fork](https://github.com/succinctlabs/optimism/tree/zk-proposer)). - -The modified `op-proposer` performs the following tasks: -- Monitors L1 state to determine when to request a proof. -- Requests proofs from the Kona SP1 server. -- Once proofs have been generated for a sufficiently large range (specified by `SUBMISSION_INTERVAL` in `zkconfig.json`), aggregates batch proofs and submits them on-chain. - - -## Underneath the Hood - -Underneath the hood, there are a very components involved in running the `op-succinct` proposer: - -**`op-succinct` Server**: -- There is a very lightweight server running with [op-succinct-proposer/bin/server.rs] that is is responsible or given a block range, it will generate the witness data for that block range by running the "native host" and then dispatch the proof request to the Succinct Prover Network. - -**`op-succinct` Proposer**: - - Runs the modified `op-proposer` binary from the Optimism repository which keeps the `ZKL2OutputOracle` contract up to date with the latest L2 state using - SP1 proofs. - - When a new L2 block is detected, the proposer requests a ZK proof from the OP Succinct Server. Once the proof is generated, it's - posted to the `ZKL2OutputOracle` contract. - - Uses a SQLite database (`proofs.db`) to keep track of processed blocks and proofs. diff --git a/scripts/prove/bin/fetch_rollup_config.rs b/scripts/prove/bin/fetch_rollup_config.rs index d73b4262..ed2367a7 100644 --- a/scripts/prove/bin/fetch_rollup_config.rs +++ b/scripts/prove/bin/fetch_rollup_config.rs @@ -125,7 +125,7 @@ fn write_l2oo_config_to_zkconfig(config: Value, workspace_root: &PathBuf) -> Res Ok(()) } -/// Merge the rollup and chain configs. +/// Merge the rollup and chain configs. TODO: Simplify this more, use better types. fn merge_configs(rollup: &Value, chain: &Value) -> Result { let elasticity = chain["optimism"]["eip1559Elasticity"] .as_u64()