Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: migrate OPSuccinctL2OutputOracle to OptimismPortalV2 #277

Merged
merged 36 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
20bd110
forge install: solady
leruaa Dec 13, 2024
1f28ebe
feat: impl IDisputeGame for OPSuccinctL2OutputOracle
leruaa Dec 13, 2024
ca1eaa9
feat: update deployment
leruaa Dec 13, 2024
8418b7c
add a thin, clonable wrapper on OPSuccinctL2OutputOracle
leruaa Jan 3, 2025
cbcf629
add a test for OPSuccinctDisputeGame initialize()
leruaa Jan 6, 2025
e386e4e
use a more recent tx to make `testOPSuccinctDisputeGame` test pass
leruaa Jan 7, 2025
4bd230a
revert useless OPSuccinctL2OutputOracle IDisputeGame impl
leruaa Jan 7, 2025
f1dc0e8
add OPSuccinctDisputeGame bindings
leruaa Jan 7, 2025
0cb9d04
add OPSuccinctDisputeGameFactory
leruaa Jan 7, 2025
c8e529e
allow to propose output roots using DisputeGameFactory
leruaa Jan 7, 2025
3c9601a
init deployment scripts
leruaa Jan 9, 2025
f238d22
fix server in mock mode
leruaa Jan 9, 2025
b6fd11f
use DGF if the address is provided
leruaa Jan 9, 2025
34b3ef1
Merge branch 'main' into aurelien/dispute-game
leruaa Jan 10, 2025
8f6ba7c
fmt
leruaa Jan 10, 2025
3158d35
add deploy-dispute-game-factory to justfile
leruaa Jan 10, 2025
a90dd34
fix: don't disable logs on the server (#320)
leruaa Jan 10, 2025
4a317f9
feat: rc10 bump + fix mock mode (#323)
ratankaliani Jan 13, 2025
0a8b80e
add test for OPSuccinctL2OutputOracleFactory
leruaa Jan 13, 2025
67b93ed
update book
leruaa Jan 13, 2025
a3e4484
small fixes
leruaa Jan 13, 2025
eb54fad
impl ISemver
leruaa Jan 13, 2025
a684b65
set permissionless proposing in the deployment
leruaa Jan 13, 2025
344c464
OPSuccinctDisputeGameFactory: allow to change impl
leruaa Jan 13, 2025
8827da9
proposer small fixes
leruaa Jan 13, 2025
6e89ac2
don't pin op-deployer version for Kurtosis
leruaa Jan 13, 2025
9ce9ec8
forge fmt
leruaa Jan 14, 2025
abbc052
update book
leruaa Jan 14, 2025
9725fe5
small fixes
leruaa Jan 14, 2025
b9e9072
nits
leruaa Jan 15, 2025
5652806
add a to do for GameTypes.OP_SUCCINCT
leruaa Jan 15, 2025
903d0b0
feat(utils/client): add secp256r1 cycle tracking (#324)
fakedev9999 Jan 14, 2025
bfc7438
chore(proposer): add jq and nc to docker image (#322)
emilianobonassi Jan 14, 2025
23a53d7
feat(programs): Use allocator (#319)
ratankaliani Jan 15, 2025
64de2f0
docs: add troubleshooting.md (#325)
fakedev9999 Jan 15, 2025
6693663
chore: add ci for elf check (#326)
fakedev9999 Jan 15, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@
[submodule "contracts/lib/sp1-contracts"]
path = contracts/lib/sp1-contracts
url = https://github.com/succinctlabs/sp1-contracts
[submodule "contracts/lib/solady"]
path = contracts/lib/solady
url = https://github.com/vectorized/solady
68 changes: 34 additions & 34 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,10 @@ op-alloy-rpc-types-engine = { version = "0.6.8", default-features = false }
op-alloy-network = { version = "0.6.8", default-features = false }

# sp1
sp1-lib = { version = "4.0.0-rc.9", features = ["verify"] }
sp1-sdk = { version = "4.0.0-rc.9" }
sp1-zkvm = { version = "4.0.0-rc.9", features = ["verify"] }
sp1-build = { version = "4.0.0-rc.9" }
sp1-lib = { version = "4.0.0-rc.10", features = ["verify"] }
sp1-sdk = { version = "4.0.0-rc.10" }
sp1-zkvm = { version = "4.0.0-rc.10", features = ["verify"] }
sp1-build = { version = "4.0.0-rc.10" }

[profile.release-client-lto]
inherits = "release"
Expand Down
2 changes: 2 additions & 0 deletions book/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,6 @@
- [Upgrade Contract](./contracts/upgrade.md)
- [Update Contract Parameters](./contracts/update-parameters.md)
- [Modifications to Original `L2OutputOracle`](./contracts/modifications.md)
- [Experimental](./experimental/intro.md)
- [OptimismPortalV2](./experimental/optimism-portal-v2.md)
- [FAQ](./faq.md)
3 changes: 3 additions & 0 deletions book/experimental/intro.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Experimental

This section contains experimental topics for OP Succinct.
46 changes: 46 additions & 0 deletions book/experimental/optimism-portal-v2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# OptimismPortalV2

If you want to use `OptimismPortalV2` or conform to Optimism `IDisputeGame`, you can follow this section that describe how to deploy 2 contracts:
leruaa marked this conversation as resolved.
Show resolved Hide resolved
leruaa marked this conversation as resolved.
Show resolved Hide resolved

* `OPSuccinctDisputeGame` a thin wrapper around `OPSuccinctL2OutputOracle` that implements `IDisputeGame`
leruaa marked this conversation as resolved.
Show resolved Hide resolved
* `OPSuccinctDisputeGameFactory` the proposer entry point when creating new dispoute game
leruaa marked this conversation as resolved.
Show resolved Hide resolved

And instruct how to configure the proposer to use them.
leruaa marked this conversation as resolved.
Show resolved Hide resolved

After having done the step 2) either in mock or full mode, with `L2OO_ADDRESS` set with the address of the `OPSuccinctL2OutputOracle` contract in your `.env` file,
run the following to deploy the contracts:

```shell
just deploy-dispute-game-factory
```

If successful, you should see the following output:

```
[⠊] Compiling...
[⠊] Compiling 1 files with Solc 0.8.15
[⠒] Solc 0.8.15 finished in 1.93s
Compiler run successful!
Script ran successfully.

== Return ==
0: address 0x6B3342821680031732Bc7d4E88A6528478aF9E38

## Setting up 1 EVM.

==========================

Chain 3151908

Estimated gas price: 1.000000014 gwei

Estimated total gas used for script: 1614671

Estimated amount required: 0.001614671022605394 ETH

==========================
```

In these deployment logs, `0x6B3342821680031732Bc7d4E88A6528478aF9E38` is the address of the proxy for the `OPSuccinctDisputeGameFactory` contract.

In order to have the poposer to use it, you have to add a new variable `DGF_ADDRESS` to your `.env` file with the value above.
2 changes: 1 addition & 1 deletion book/quick-start/full.md
leruaa marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ In the root directory, create a file called `.env` and set the following environ

There are additional optional parameters that you can set in the `.env` file. See the [Advanced Parameters](../contracts/configuration.md#optional-advanced-parameters) section for more information.

### 2) Deploy the `OPSuccinctL2OutputOracle` contract.
### 2) Deploy the `OPSuccinctL2OutputOracle` contract

This contract is a modification of the `L2OutputOracle` contract which verifies a proof along with the proposed state root.

Expand Down
5 changes: 4 additions & 1 deletion book/quick-start/mock.md
leruaa marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ If you have multiple environments, you can pass the environment file to the `dep
just deploy-mock-verifier <env_file>
```

### 3) Deploy the `OPSuccinctL2OutputOracle` contract.
### 3) Deploy the `OPSuccinctL2OutputOracle` contract

This contract is a modification of the `L2OutputOracle` contract which verifies a proof along with the proposed state root.

Expand Down Expand Up @@ -125,6 +125,9 @@ To start the mock `op-succinct` service, add the following parameters to the `.e
| `L2OO_ADDRESS` | The address of the `OPSuccinctL2OutputOracle` contract from the previous step. |
| `OP_SUCCINCT_MOCK` | Set to `true` for mock mode. |

If you want the proposer to use the `OPSuccinctDisputeGameFactory` contract, you must add an additional parameter `DGF_ADDRESS` to the `.env` file
with the `OPSuccinctDisputeGameFactory` contract address.

leruaa marked this conversation as resolved.
Show resolved Hide resolved
Now, you should have the following in your `.env` file:

| Parameter | Description |
Expand Down
7 changes: 6 additions & 1 deletion contracts/foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ remappings = [
"@openzeppelin/=lib/openzeppelin-contracts/",
"@optimism/=lib/optimism/packages/contracts-bedrock/",
"@forge-std/=lib/forge-std/src/",
"@solady/=lib/solady/src",
# Note: Use zobront/sp1-contracts as the current version for SP1 contracts is not compatible with the hard
# version for 0.8.15 on some Optimism contracts.
"@sp1-contracts/=lib/sp1-contracts/contracts/",
Expand All @@ -15,9 +16,13 @@ remappings = [
"src/libraries/=lib/optimism/packages/contracts-bedrock/src/libraries/",
"src/L1/=lib/optimism/packages/contracts-bedrock/src/L1/",
"src/L2/=lib/optimism/packages/contracts-bedrock/src/L2/",
"src/dispute/=lib/optimism/packages/contracts-bedrock/src/dispute/"
]

# Enable read-write access to opsuccinctl2ooconfig.json
fs_permissions = [{ access = "read-write", path = "./opsuccinctl2ooconfig.json" }]
fs_permissions = [
{ access = "read-write", path = "./opsuccinctl2ooconfig.json" },
{ access = "read-write", path = "./opsuccinctl2ooconfig-test.json" }
]

# See more config options https://github.com/foundry-rs/foundry/tree/master/config
1 change: 1 addition & 0 deletions contracts/lib/solady
Submodule solady added at 513f58
15 changes: 15 additions & 0 deletions contracts/opsuccinctl2ooconfig-test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"challenger": "0x0000000000000000000000000000000000000000",
"finalizationPeriod": 3600,
"l2BlockTime": 2,
"owner": "0xDEd0000E32f8F40414d3ab3a830f735a3553E18e",
"proposer": "0x0000000000000000000000000000000000000000",
"rollupConfigHash": "0x0d7101e2acc7eae1fb42cfce5c604d14da561726e4e01b509315e5a9f97a9816",
"startingBlockNumber": 5726082,
"startingOutputRoot": "0xafcc854e9d3af302a5c749703bb4593fff9471f2ea1b55ec0ade1e1d3c4a0d6e",
"startingTimestamp": 1733804652,
"submissionInterval": 1200,
"verifier": "0x397A5f7f3dBd538f23DE225B51f532c34448dA9B",
"aggregationVkey": "0x00d4e72bc998d0528b0722a53bedd9c6f0143c9157af194ad4bb2502e37a496f",
"rangeVkeyCommitment": "0x33e3678015df481724af3aac49d000923caeec277027610b1490f857769f9459"
}
28 changes: 28 additions & 0 deletions contracts/script/OPSuccinctDGFDeployer.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.15;

import {Script} from "forge-std/Script.sol";
import {OPSuccinctL2OutputOracle} from "../src/OPSuccinctL2OutputOracle.sol";
import {OPSuccinctDisputeGame} from "../src/OPSuccinctDisputeGame.sol";
import {OPSuccinctDisputeGameFactory} from "../src/OPSuccinctDisputeGameFactory.sol";
import {Utils} from "../test/helpers/Utils.sol";
import {Proxy} from "@optimism/src/universal/Proxy.sol";
import {console} from "forge-std/console.sol";

contract OPSuccinctDFGDeployer is Script, Utils {
function run() public returns (address) {
vm.startBroadcast();

OPSuccinctL2OutputOracle l2OutputOracleProxy = OPSuccinctL2OutputOracle(vm.envAddress("L2OO_ADDRESS"));

l2OutputOracleProxy.addProposer(address(0));

// Initialize the dispute game based on the existing L2OO_ADDRESS.
OPSuccinctDisputeGame game = new OPSuccinctDisputeGame(address(l2OutputOracleProxy));
OPSuccinctDisputeGameFactory gameFactory = new OPSuccinctDisputeGameFactory(msg.sender, address(game));

vm.stopBroadcast();

return address(gameFactory);
}
}
Loading
Loading