-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(genesis): use OPCM for deployments
- Loading branch information
Showing
57 changed files
with
2,425 additions
and
4,049 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule forge-std
updated
20 files
+1 −1 | README.md | |
+1 −1 | package.json | |
+0 −4 | src/StdChains.sol | |
+1 −1 | src/StdCheats.sol | |
+0 −104 | src/StdJson.sol | |
+0 −104 | src/StdToml.sol | |
+8 −95 | src/Vm.sol | |
+463 −471 | src/console.sol | |
+2 −2 | src/interfaces/IERC4626.sol | |
+1 −1 | test/StdAssertions.t.sol | |
+12 −14 | test/StdChains.t.sol | |
+10 −10 | test/StdCheats.t.sol | |
+12 −12 | test/StdError.t.sol | |
+1 −1 | test/StdJson.t.sol | |
+14 −4 | test/StdMath.t.sol | |
+5 −5 | test/StdStorage.t.sol | |
+1 −1 | test/StdStyle.t.sol | |
+1 −1 | test/StdToml.t.sol | |
+12 −12 | test/StdUtils.t.sol | |
+6 −9 | test/Vm.t.sol |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
"path" | ||
|
||
"github.com/ethereum-optimism/optimism/op-chain-ops/deployer/pipeline" | ||
"github.com/ethereum-optimism/optimism/op-chain-ops/deployer/state" | ||
"github.com/ethereum-optimism/optimism/op-chain-ops/foundry" | ||
"github.com/ethereum-optimism/optimism/op-service/ioutil" | ||
"github.com/ethereum-optimism/optimism/op-service/jsonutil" | ||
oplog "github.com/ethereum-optimism/optimism/op-service/log" | ||
"github.com/ethereum-optimism/supersim/genesis/worldgen" | ||
"github.com/urfave/cli/v2" | ||
) | ||
|
||
func main() { | ||
oplog.SetupDefaults() | ||
|
||
app := cli.NewApp() | ||
app.Name = "supersim-worldgen" | ||
app.Usage = "Supersim Genesis Generator" | ||
app.Description = "Generate genesis files for supersim" | ||
app.Action = worldgenMain | ||
app.Flags = worldgen.CLIFlags() | ||
|
||
if err := app.Run(os.Args); err != nil { | ||
fmt.Println(err) | ||
} | ||
} | ||
|
||
func worldgenMain(ctx *cli.Context) error { | ||
logger := oplog.NewLogger(oplog.AppOut(nil), oplog.DefaultCLIConfig()) | ||
|
||
cliConfig, err := worldgen.ParseCLIConfig(ctx) | ||
if err != nil { | ||
return fmt.Errorf("failed to parse cli config: %w", err) | ||
} | ||
|
||
// Download monorepo contract artifacts | ||
monorepoProgressor := func(curr, total int64) { | ||
logger.Info("monorepo artifacts download progress", "current", curr, "total", total) | ||
} | ||
|
||
monorepoArtifactsFS, monorepoArtifactsCleanup, err := pipeline.DownloadArtifacts(ctx.Context, (*state.ArtifactsURL)(cliConfig.MonorepoArtifactsURL), monorepoProgressor) | ||
if err != nil { | ||
return fmt.Errorf("failed to download monorepo artifacts: %w", err) | ||
} | ||
defer func() { | ||
if err := monorepoArtifactsCleanup(); err != nil { | ||
logger.Warn("failed to clean up monorepo artifacts", "err", err) | ||
} | ||
}() | ||
|
||
// Download periphery contract artifacts | ||
peripheryProgressor := func(curr, total int64) { | ||
logger.Info("monorepo artifacts download progress", "current", curr, "total", total) | ||
} | ||
|
||
peripheryArtifactsFS, peripheryArtifactsCleanup, err := pipeline.DownloadArtifacts(ctx.Context, (*state.ArtifactsURL)(cliConfig.PeripheryArtifactsURL), peripheryProgressor) | ||
if err != nil { | ||
return fmt.Errorf("failed to download periphery artifacts: %w", err) | ||
} | ||
defer func() { | ||
if err := peripheryArtifactsCleanup(); err != nil { | ||
logger.Warn("failed to clean up periphery artifacts", "err", err) | ||
} | ||
}() | ||
|
||
worldDeployment, worldOutput, err := worldgen.GenerateWorld(ctx.Context, logger, &foundry.ArtifactsFS{FS: monorepoArtifactsFS}, &foundry.ArtifactsFS{FS: peripheryArtifactsFS}) | ||
|
||
if err != nil { | ||
return fmt.Errorf("failed to generate world: %w", err) | ||
} | ||
|
||
logger.Info("Successfully generated world") | ||
|
||
logger.Info("writing L1 genesis") | ||
outfile := fmt.Sprintf("%s-l1-genesis.json", worldOutput.L1.Genesis.Config.ChainID) | ||
if err := jsonutil.WriteJSON(worldOutput.L1.Genesis, ioutil.ToStdOutOrFileOrNoop(path.Join(cliConfig.Outdir, outfile), 0o666)); err != nil { | ||
return fmt.Errorf("failed to write L1 genesis: %w", err) | ||
} | ||
|
||
for l2ChainID, l2Deployment := range worldDeployment.L2s { | ||
logger.Info("writing addresses for l2", "chain_id", l2ChainID) | ||
outfile := fmt.Sprintf("%s-l2-addresses.json", l2ChainID) | ||
if err := jsonutil.WriteJSON(l2Deployment, ioutil.ToStdOutOrFileOrNoop(path.Join(cliConfig.Outdir, outfile), 0o666)); err != nil { | ||
return fmt.Errorf("failed to write addresses: %w", err) | ||
} | ||
} | ||
|
||
for l2ChainID, l2Output := range worldOutput.L2s { | ||
logger.Info("writing genesis for l2", "chain_id", l2ChainID) | ||
outfile := fmt.Sprintf("%s-l2-genesis.json", l2ChainID) | ||
l2Genesis := l2Output.Genesis | ||
if err := jsonutil.WriteJSON(l2Genesis, ioutil.ToStdOutOrFileOrNoop(path.Join(cliConfig.Outdir, outfile), 0o666)); err != nil { | ||
return fmt.Errorf("failed to write genesis: %w", err) | ||
} | ||
} | ||
|
||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"OpChainProxyAdmin": "0xa997d7ebd1700558b8e18a9096fc16f4098dc634", | ||
"AddressManager": "0xc3c632e95ae78bb07449a4977ae9025a9258228e", | ||
"L1ERC721BridgeProxy": "0x68a7cdc5bbc0146a57cdd18e42c7d17fc3d2c715", | ||
"SystemConfigProxy": "0x8e46f8035e7251683cfe4570740b1c8b2f173174", | ||
"OptimismMintableERC20FactoryProxy": "0xc56f57ecaa24899d8fd70908f07a2fa70cfb3bcf", | ||
"L1StandardBridgeProxy": "0x82233841d0de03e0d7cee1bf06b17f9071578417", | ||
"L1CrossDomainMessengerProxy": "0x721214724ad72ff4bb3603a95e041f4ef733365c", | ||
"OptimismPortalProxy": "0xc92f7768dd850a850f4512d02840989ab7520920", | ||
"DisputeGameFactoryProxy": "0xf7046e2dbbc017d76afaa7c03f87aed547c566c7", | ||
"AnchorStateRegistryProxy": "0xc8a07aefdc8efc1545d409ad5517a34fdfb07e57", | ||
"AnchorStateRegistryImpl": "0xc77e3e906a1588930d101756b932336384176448", | ||
"FaultDisputeGame": "0x0000000000000000000000000000000000000000", | ||
"PermissionedDisputeGame": "0xf16a44284cbb6032534ef84d94c5ede61fbdf75c", | ||
"DelayedWETHPermissionedGameProxy": "0xbd2dfa523a1a0d3a72637a62322b031ca7552d13", | ||
"DelayedWETHPermissionlessGameProxy": "0x1f356a056d5317d49e30cad77d3f57e1be62c09d" | ||
} | ||
|
Oops, something went wrong.