|
| 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 | + |
| 19 | +# op-validator |
| 20 | + |
| 21 | +<Callout type="info"> |
| 22 | + Currently, `op-validator` is only available on Sepolia networks. |
| 23 | +</Callout> |
| 24 | + |
| 25 | +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. These checks include: |
| 26 | + |
| 27 | +* Contract implementations and versions |
| 28 | +* Proxy configurations |
| 29 | +* System parameters |
| 30 | +* Cross-component relationships |
| 31 | +* Security settings |
| 32 | + |
| 33 | +## How to use op-validator |
| 34 | + |
| 35 | +<Steps> |
| 36 | + |
| 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 descrepancies 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 | + |
| 83 | +</Steps> |
| 84 | + |
| 85 | +## Usage |
| 86 | + |
| 87 | +The validator supports different protocol versions through subcommands: |
| 88 | + |
| 89 | +```bash |
| 90 | +op-validator validate [version] [flags] |
| 91 | +``` |
| 92 | + |
| 93 | +Where version is one of: |
| 94 | + |
| 95 | +- `v1.8.0` - For validating `op-contracts/1.8.0` |
| 96 | +- `v2.0.0` - For validating `op-contracts/2.0.0` |
| 97 | + |
| 98 | +### Required Flags |
| 99 | + |
| 100 | +* `--l1-rpc-url`: L1 RPC URL (can also be set via L1_RPC_URL environment variable) |
| 101 | +* `--absolute-prestate`: Absolute prestate as hex string |
| 102 | +* `--proxy-admin`: Proxy admin address as hex string. This should be a specific chain's proxy admin contract on L1. |
| 103 | + It is not the proxy admin owner or the superchain proxy admin. |
| 104 | +* `--system-config`: System config proxy address as hex string |
| 105 | +* `--l2-chain-id`: L2 chain ID |
| 106 | + |
| 107 | +### Optional Flags |
| 108 | + |
| 109 | +* `--fail`: Exit with non-zero code if validation errors are found (defaults to true) |
| 110 | + |
| 111 | +### Example |
| 112 | + |
| 113 | +```bash |
| 114 | +op-validator validate v2.0.0 \ |
| 115 | + --l1-rpc-url "L1_RPC_URL" \ |
| 116 | + --absolute-prestate "0x1234..." \ |
| 117 | + --proxy-admin "0xabcd..." \ |
0 commit comments