|
| 1 | +--- |
| 2 | +title: op-validator |
| 3 | +description: Learn how to use op-validator to validate chain configurations and deployments. |
| 4 | +lang: en-US |
| 5 | +content_type: tutorial |
| 6 | +topic: op-validator |
| 7 | +personas: |
| 8 | + - chain-operator |
| 9 | + - protocol-developer |
| 10 | +categories: |
| 11 | + - tools |
| 12 | + - op-validator |
| 13 | +is_imported_content: 'false' |
| 14 | +--- |
| 15 | + |
| 16 | +import {Callout, Steps} from 'nextra/components' |
| 17 | + |
| 18 | +# op-validator |
| 19 | + |
| 20 | +<Callout type="info"> |
| 21 | + Currently, `op-validator` is only available on Sepolia networks. |
| 22 | +</Callout> |
| 23 | + |
| 24 | +The `op-validator` is a tool for validating Standard OP Stack chain configurations and deployments to ensure they're in compliance with the [Standard Rollup Charter](/superchain/blockspace-charter#the-standard-rollup-charter). It works by calling into the `StandardValidator` smart contracts (`StandardValidatorV180` and `StandardValidatorV200`). These then perform a set of checks, and return error codes for any issues found. |
| 25 | + |
| 26 | +These checks include: |
| 27 | + |
| 28 | +* Contract implementations and versions |
| 29 | +* Proxy configurations |
| 30 | +* System parameters |
| 31 | +* Cross-component relationships |
| 32 | +* Security settings |
| 33 | + |
| 34 | +## How to use op-validator |
| 35 | + |
| 36 | +<Steps> |
| 37 | + ### Clone the monorepo |
| 38 | + |
| 39 | + ```bash |
| 40 | + git clone https://github.com/ethereum-optimism/optimism.git |
| 41 | + ``` |
| 42 | + |
| 43 | + ### Build the `op-validator` binary |
| 44 | + |
| 45 | + ```bash |
| 46 | + cd optimism/op-validator |
| 47 | + just build |
| 48 | + ``` |
| 49 | + |
| 50 | + ### Run the `op-validator` binary |
| 51 | + |
| 52 | + ```bash |
| 53 | + ./bin/op-validator validate v1.8.0 \ |
| 54 | + --l1-rpc-url "https://ethereum-sepolia-rpc.publicnode.com" \ |
| 55 | + --absolute-prestate "0x03f89406817db1ed7fd8b31e13300444652cdb0b9c509a674de43483b2f83568" \ |
| 56 | + --proxy-admin "0x189aBAAaa82DfC015A588A7dbaD6F13b1D3485Bc" \ |
| 57 | + --system-config "0x034edD2A225f7f429A63E0f1D2084B9E0A93b538" \ |
| 58 | + --l2-chain-id "11155420" \ |
| 59 | + --fail |
| 60 | + ``` |
| 61 | + |
| 62 | + ### Understanding the output |
| 63 | + |
| 64 | + In the previous command, we provided a non-standard absolute prestate. The `op-validator` returned the following output to describe the discrepancies between the provided absolute prestate and the expected prestate in the L1 smart contracts: |
| 65 | + |
| 66 | + ``` |
| 67 | + | ERROR | DESCRIPTION | |
| 68 | + |-----------------|--------------------------------| |
| 69 | + | PDDG-40 | Permissioned dispute game | |
| 70 | + | | absolute prestate mismatch | |
| 71 | + | PDDG-ANCHORP-40 | Permissioned dispute game | |
| 72 | + | | anchor state registry root | |
| 73 | + | | hash mismatch | |
| 74 | + | PLDG-40 | Permissionless dispute game | |
| 75 | + | | absolute prestate mismatch | |
| 76 | + | PLDG-ANCHORP-40 | Permissionless dispute game | |
| 77 | + | | anchor state registry root | |
| 78 | + | | hash mismatch | |
| 79 | +
|
| 80 | + Validation errors found |
| 81 | + ``` |
| 82 | +</Steps> |
| 83 | + |
| 84 | +## Usage |
| 85 | + |
| 86 | +The validator supports different protocol versions through subcommands: |
| 87 | + |
| 88 | +```bash |
| 89 | +op-validator validate [version] [flags] |
| 90 | +``` |
| 91 | + |
| 92 | +Choose a version based on your `op-contracts` version: |
| 93 | + |
| 94 | +* `v1.8.0` - For validating `op-contracts/1.8.0` |
| 95 | +* `v2.0.0` - For validating `op-contracts/2.0.0` |
| 96 | + |
| 97 | +### Flags |
| 98 | + |
| 99 | +| Option | Description | Required/Optional | |
| 100 | +| --------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------- | |
| 101 | +| `--l1-rpc-url` | L1 RPC URL (can also be set via `L1_RPC_URL` environment variable) | Required | |
| 102 | +| `--absolute-prestate` | Absolute prestate as hex string | Required | |
| 103 | +| `--proxy-admin` | Proxy admin address as hex string. This should be a specific chain's proxy admin contract on L1. It is not the proxy admin owner or the superchain proxy admin. | Required | |
| 104 | +| `--system-config` | System config proxy address as hex string | Required | |
| 105 | +| `--l2-chain-id` | L2 chain ID | Required | |
| 106 | +| `--fail` | Exit with non-zero code if validation errors are found (defaults to true) | Optional | |
| 107 | + |
| 108 | +### Example |
| 109 | + |
| 110 | +```bash |
| 111 | +op-validator validate v2.0.0 \ |
| 112 | + --l1-rpc-url "L1_RPC_URL" \ |
| 113 | + --absolute-prestate "0x1234..." \ |
| 114 | + --proxy-admin "0xabcd..." \ |
| 115 | +``` |
0 commit comments