Upgrading the OPSuccinct Fault Dispute Game

This guide explains how to upgrade the OPSuccinct Fault Dispute Game contract.

Overview

The upgrade script performs the following actions:

  1. Deploys a new implementation of the OPSuccinctFaultDisputeGame contract
  2. Sets the new implementation in the DisputeGameFactory for the specified game type

Required Environment Variables

Create a .env file in the contracts directory with the following variables:

VariableDescriptionExample
FACTORY_ADDRESSAddress of the existing DisputeGameFactory0x...
GAME_TYPEUnique identifier for the game type (uint32)42
MAX_CHALLENGE_DURATIONMaximum duration for challenges in seconds604800 for 7 days
MAX_PROVE_DURATIONMaximum duration for proving in seconds86400 for 1 day
VERIFIER_ADDRESSAddress of the SP1 verifier0x...
ROLLUP_CONFIG_HASHHash of the rollup configuration0x...
AGGREGATION_VKEYVerification key for aggregation0x...
RANGE_VKEY_COMMITMENTCommitment to range verification key0x...
ANCHOR_STATE_REGISTRYAddress of the AnchorStateRegistry0x...
ACCESS_MANAGERAddress of the AccessManager0x...

Getting the Rollup Config Hash, Aggregation Verification Key, and Range Verification Key Commitment

First, create a .env file in the root directory with the following variables:

L1_RPC=<L1_RPC_URL>
L1_BEACON_RPC=<L1_BEACON_RPC_URL>
L2_RPC=<L2_RPC_URL>
L2_NODE_RPC=<L2_NODE_RPC_URL>

You can get the aggregation program verification key, range program verification key commitment, and rollup config hash by running the following command:

cargo run --bin config --release -- --env-file <PATH_TO_ENV_FILE>

Optional Environment Variables

VariableDescriptionDefaultExample
CHALLENGER_BOND_WEIChallenger bond for the game0.001 ether1000000000000000

Use cast --to-wei <value> eth to convert the value to wei to avoid mistakes.

Upgrade Command

Dry run the upgrade command in the root directory of the project:

DRY_RUN=true just -f fault-proof/justfile --dotenv-filename contracts/.env upgrade-fault-dispute-game

Run the upgrade command in the root directory of the project:

DRY_RUN=false just -f fault-proof/justfile --dotenv-filename contracts/.env upgrade-fault-dispute-game

Verification

You can verify the upgrade by running the following command:

cast call <FACTORY_ADDRESS> "gameImpls(uint32)" <GAME_TYPE> --rpc-url <L1_RPC_URL>

Troubleshooting

Common issues and solutions:

  1. Compilation Errors:

    • Run cd contracts && forge clean
  2. Deployment Failures:

    • Check RPC connection
    • Verify sufficient ETH balance
    • Confirm environment variables are set correctly