Commit ecc3bd05 authored by Mark Tyneway's avatar Mark Tyneway Committed by GitHub

feat: generate genesis with op-node (#3287)

* contracts-bedrock: updated L2 config checker

Checks that the predeploys were configured correctly

* op-chain-ops: adds in OptimismMintableERC20Factory

Was previously skipped since it lives in the `universal`
directory and not the `L2` directory.

* op-node: new command

* ci: update to work with op-node for genesis creation

* ops-bedrock: use op-node for L2 genesis generation

* op-node: clean up devnet-l2 command
parent ab7ed0d4
...@@ -460,7 +460,7 @@ jobs: ...@@ -460,7 +460,7 @@ jobs:
devnet: devnet:
machine: machine:
image: ubuntu-2204:2022.07.1 image: ubuntu-2004:2022.07.1
docker_layer_caching: true docker_layer_caching: true
environment: environment:
DOCKER_BUILDKIT: 1 DOCKER_BUILDKIT: 1
...@@ -473,6 +473,14 @@ jobs: ...@@ -473,6 +473,14 @@ jobs:
if [[ "$CHANGED" = "FALSE" ]]; then if [[ "$CHANGED" = "FALSE" ]]; then
circleci step halt circleci step halt
fi fi
- run:
name: Install latest golang
command: |
wget https://go.dev/dl/go1.19.linux-amd64.tar.gz
sudo rm -rf /usr/local/go
sudo tar -C /usr/local -xzf go1.19.linux-amd64.tar.gz
export PATH=$PATH:/usr/local/go/bin
go version
- run: - run:
name: foundryup name: foundryup
command: | command: |
...@@ -489,6 +497,10 @@ jobs: ...@@ -489,6 +497,10 @@ jobs:
name: Bring up the stack name: Bring up the stack
command: | command: |
make devnet-up make devnet-up
- run:
name: Check L2 Config
command: npx hardhat check-l2-config --network devnetL1
working_directory: packages/contracts-bedrock
- run: - run:
name: Do a deposit name: Do a deposit
command: | command: |
...@@ -510,10 +522,6 @@ jobs: ...@@ -510,10 +522,6 @@ jobs:
name: Check the status name: Check the status
command: npx hardhat check-op-node command: npx hardhat check-op-node
working_directory: packages/contracts-bedrock working_directory: packages/contracts-bedrock
- run:
name: Check L2 Config
command: npx hardhat check-l2-config
working_directory: packages/contracts-bedrock
integration-tests: integration-tests:
machine: machine:
......
...@@ -158,6 +158,5 @@ func NewStorageConfig(hh *hardhat.Hardhat, config *DeployConfig, chain ethereum. ...@@ -158,6 +158,5 @@ func NewStorageConfig(hh *hardhat.Hardhat, config *DeployConfig, chain ethereum.
// TODO: this should be set to the MintManager // TODO: this should be set to the MintManager
"_owner": common.Address{}, "_owner": common.Address{},
} }
return storage, nil return storage, nil
} }
...@@ -6,6 +6,7 @@ import ( ...@@ -6,6 +6,7 @@ import (
"math/big" "math/big"
"github.com/ethereum-optimism/optimism/op-bindings/bindings" "github.com/ethereum-optimism/optimism/op-bindings/bindings"
"github.com/ethereum-optimism/optimism/op-bindings/predeploys"
"github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/accounts/abi/bind/backends" "github.com/ethereum/go-ethereum/accounts/abi/bind/backends"
...@@ -58,6 +59,9 @@ func BuildOptimism() (DeploymentResults, error) { ...@@ -58,6 +59,9 @@ func BuildOptimism() (DeploymentResults, error) {
{ {
Name: "SequencerFeeVault", Name: "SequencerFeeVault",
}, },
{
Name: "OptimismMintableERC20Factory",
},
} }
return Build(deployments) return Build(deployments)
} }
...@@ -115,6 +119,8 @@ func Build(deployments []Deployment) (DeploymentResults, error) { ...@@ -115,6 +119,8 @@ func Build(deployments []Deployment) (DeploymentResults, error) {
case "SequencerFeeVault": case "SequencerFeeVault":
// No arguments to SequencerFeeVault // No arguments to SequencerFeeVault
addr, _, _, err = bindings.DeploySequencerFeeVault(opts, backend) addr, _, _, err = bindings.DeploySequencerFeeVault(opts, backend)
case "OptimismMintableERC20Factory":
addr, _, _, err = bindings.DeployOptimismMintableERC20Factory(opts, backend, predeploys.L2StandardBridgeAddr)
default: default:
return nil, fmt.Errorf("unknown contract: %s", deployment.Name) return nil, fmt.Errorf("unknown contract: %s", deployment.Name)
} }
......
...@@ -12,19 +12,20 @@ func TestBuildOptimism(t *testing.T) { ...@@ -12,19 +12,20 @@ func TestBuildOptimism(t *testing.T) {
require.Nil(t, err) require.Nil(t, err)
require.NotNil(t, results) require.NotNil(t, results)
// Only the exact contracts that we care about are being
// modified
require.Equal(t, len(results), 6)
contracts := map[string]bool{ contracts := map[string]bool{
"GasPriceOracle": true, "GasPriceOracle": true,
"L1Block": true, "L1Block": true,
"L2CrossDomainMessenger": true, "L2CrossDomainMessenger": true,
"L2StandardBridge": true, "L2StandardBridge": true,
"L2ToL1MessagePasser": true, "L2ToL1MessagePasser": true,
"SequencerFeeVault": true, "SequencerFeeVault": true,
"OptimismMintableERC20Factory": true,
} }
// Only the exact contracts that we care about are being
// modified
require.Equal(t, len(results), len(contracts))
for name, bytecode := range results { for name, bytecode := range results {
// There is bytecode there // There is bytecode there
require.Greater(t, len(bytecode), 0) require.Greater(t, len(bytecode), 0)
......
...@@ -6,6 +6,7 @@ RUN apk add --no-cache make gcc musl-dev linux-headers git jq bash ...@@ -6,6 +6,7 @@ RUN apk add --no-cache make gcc musl-dev linux-headers git jq bash
COPY ./op-node/docker.go.work /app/go.work COPY ./op-node/docker.go.work /app/go.work
COPY ./op-bindings /app/op-bindings COPY ./op-bindings /app/op-bindings
COPY ./op-node /app/op-node COPY ./op-node /app/op-node
COPY ./op-chain-ops /app/op-chain-ops
WORKDIR /app/op-node WORKDIR /app/op-node
......
package genesis
import (
"encoding/json"
"fmt"
"os"
"path/filepath"
"strings"
"github.com/urfave/cli"
"github.com/ethereum-optimism/optimism/op-chain-ops/genesis"
"github.com/ethereum-optimism/optimism/op-chain-ops/hardhat"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/ethclient"
)
var Subcommands = cli.Commands{
{
Name: "devnet-l2",
Usage: "Initialized a new devnet genesis file",
Flags: []cli.Flag{
cli.StringFlag{
Name: "artifacts",
Usage: "Comma delimeted list of hardhat artifact directories",
},
cli.StringFlag{
Name: "network",
Usage: "Name of hardhat deploy network",
},
cli.StringFlag{
Name: "deployments",
Usage: "Comma delimated list of hardhat deploy artifact directories",
},
cli.StringFlag{
Name: "deploy-config",
Usage: "Path to hardhat deploy config directory",
},
cli.StringFlag{
Name: "rpc-url",
Usage: "L1 RPC URL",
},
cli.StringFlag{
Name: "outfile",
Usage: "Path to file to write output to",
},
},
Action: func(ctx *cli.Context) error {
// Turn off logging for this command unless it is a critical
// error so that the output can be piped to jq
log.Root().SetHandler(
log.LvlFilterHandler(
log.LvlCrit,
log.StreamHandler(os.Stdout, log.TerminalFormat(true)),
),
)
artifact := ctx.String("artifacts")
artifacts := strings.Split(artifact, ",")
deployment := ctx.String("deployments")
deployments := strings.Split(deployment, ",")
network := ctx.String("network")
hh, err := hardhat.New(network, artifacts, deployments)
if err != nil {
return err
}
deployConfigDirectory := ctx.String("deploy-config")
deployConfig := filepath.Join(deployConfigDirectory, network+".json")
config, err := genesis.NewDeployConfig(deployConfig)
if err != nil {
return err
}
rpcUrl := ctx.String("rpc-url")
client, err := ethclient.Dial(rpcUrl)
if err != nil {
return err
}
gen, err := genesis.BuildOptimismDeveloperGenesis(hh, config, client)
if err != nil {
return err
}
file, err := json.MarshalIndent(gen, "", " ")
if err != nil {
return err
}
outfile := ctx.String("outfile")
if outfile == "" {
fmt.Println(string(file))
} else {
if err := os.WriteFile(outfile, file, 0644); err != nil {
return err
}
}
return nil
},
},
}
...@@ -9,6 +9,7 @@ import ( ...@@ -9,6 +9,7 @@ import (
"syscall" "syscall"
"time" "time"
"github.com/ethereum-optimism/optimism/op-node/cmd/genesis"
"github.com/ethereum-optimism/optimism/op-node/cmd/p2p" "github.com/ethereum-optimism/optimism/op-node/cmd/p2p"
"github.com/ethereum-optimism/optimism/op-node/metrics" "github.com/ethereum-optimism/optimism/op-node/metrics"
...@@ -66,6 +67,10 @@ func main() { ...@@ -66,6 +67,10 @@ func main() {
Name: "p2p", Name: "p2p",
Subcommands: p2p.Subcommands, Subcommands: p2p.Subcommands,
}, },
{
Name: "genesis",
Subcommands: genesis.Subcommands,
},
} }
err := app.Run(os.Args) err := app.Run(os.Args)
......
...@@ -3,4 +3,5 @@ go 1.18 ...@@ -3,4 +3,5 @@ go 1.18
use ( use (
./op-bindings ./op-bindings
./op-node ./op-node
./op-chain-ops
) )
...@@ -6,6 +6,7 @@ require ( ...@@ -6,6 +6,7 @@ require (
github.com/btcsuite/btcd/btcec/v2 v2.2.0 github.com/btcsuite/btcd/btcec/v2 v2.2.0
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1
github.com/ethereum-optimism/optimism/op-bindings v0.5.0 github.com/ethereum-optimism/optimism/op-bindings v0.5.0
github.com/ethereum-optimism/optimism/op-chain-ops v0.0.0-20220822214343-2106bdb7fc11
github.com/ethereum/go-ethereum v1.10.21 github.com/ethereum/go-ethereum v1.10.21
github.com/golang/snappy v0.0.4 github.com/golang/snappy v0.0.4
github.com/google/go-cmp v0.5.8 github.com/google/go-cmp v0.5.8
...@@ -41,6 +42,7 @@ require ( ...@@ -41,6 +42,7 @@ require (
github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c // indirect github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c // indirect
github.com/deckarep/golang-set v1.8.0 // indirect github.com/deckarep/golang-set v1.8.0 // indirect
github.com/docker/go-units v0.4.0 // indirect github.com/docker/go-units v0.4.0 // indirect
github.com/edsrzf/mmap-go v1.1.0 // indirect
github.com/elastic/gosigar v0.14.2 // indirect github.com/elastic/gosigar v0.14.2 // indirect
github.com/fjl/memsize v0.0.1 // indirect github.com/fjl/memsize v0.0.1 // indirect
github.com/flynn/noise v1.0.0 // indirect github.com/flynn/noise v1.0.0 // indirect
......
...@@ -175,8 +175,9 @@ github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25Kn ...@@ -175,8 +175,9 @@ github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25Kn
github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs=
github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU=
github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I=
github.com/edsrzf/mmap-go v1.0.0 h1:CEBF7HpRnUCSJgGUb5h1Gm7e3VkmVDrR8lvWVLtrOFw=
github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M=
github.com/edsrzf/mmap-go v1.1.0 h1:6EUwBLQ/Mcr1EYLE4Tn1VdW1A4ckqCQWZBw8Hr0kjpQ=
github.com/edsrzf/mmap-go v1.1.0/go.mod h1:19H/e8pUPLicwkyNgOykDXkJ9F0MHE+Z52B8EIth78Q=
github.com/elastic/gosigar v0.12.0/go.mod h1:iXRIGg2tLnu7LBdpqzyQfGDEidKCfWcCMS0WKyPWoMs= github.com/elastic/gosigar v0.12.0/go.mod h1:iXRIGg2tLnu7LBdpqzyQfGDEidKCfWcCMS0WKyPWoMs=
github.com/elastic/gosigar v0.14.2 h1:Dg80n8cr90OZ7x+bAax/QjoW/XqTI11RmA79ZwIm9/4= github.com/elastic/gosigar v0.14.2 h1:Dg80n8cr90OZ7x+bAax/QjoW/XqTI11RmA79ZwIm9/4=
github.com/elastic/gosigar v0.14.2/go.mod h1:iXRIGg2tLnu7LBdpqzyQfGDEidKCfWcCMS0WKyPWoMs= github.com/elastic/gosigar v0.14.2/go.mod h1:iXRIGg2tLnu7LBdpqzyQfGDEidKCfWcCMS0WKyPWoMs=
...@@ -191,6 +192,8 @@ github.com/ethereum-optimism/op-geth v0.0.0-20220819161933-acfde114de61 h1:+Wfrw ...@@ -191,6 +192,8 @@ github.com/ethereum-optimism/op-geth v0.0.0-20220819161933-acfde114de61 h1:+Wfrw
github.com/ethereum-optimism/op-geth v0.0.0-20220819161933-acfde114de61/go.mod h1:EYFyF19u3ezGLD4RqOkLq+ZCXzYbLoNDdZlMt7kyKFg= github.com/ethereum-optimism/op-geth v0.0.0-20220819161933-acfde114de61/go.mod h1:EYFyF19u3ezGLD4RqOkLq+ZCXzYbLoNDdZlMt7kyKFg=
github.com/ethereum-optimism/optimism/op-bindings v0.5.0 h1:bJT8KmDu5YAVOqPQHxHkntGlRrtRdTIsH+X28LOIcqU= github.com/ethereum-optimism/optimism/op-bindings v0.5.0 h1:bJT8KmDu5YAVOqPQHxHkntGlRrtRdTIsH+X28LOIcqU=
github.com/ethereum-optimism/optimism/op-bindings v0.5.0/go.mod h1:Ft+sL57mlBysH6nuXZA11GLMMajfBa8SjpEBtitl1Vw= github.com/ethereum-optimism/optimism/op-bindings v0.5.0/go.mod h1:Ft+sL57mlBysH6nuXZA11GLMMajfBa8SjpEBtitl1Vw=
github.com/ethereum-optimism/optimism/op-chain-ops v0.0.0-20220822214343-2106bdb7fc11 h1:be6PccBLLuTZZKC9FuwArNjMVX8R83TCnwknncWJqQw=
github.com/ethereum-optimism/optimism/op-chain-ops v0.0.0-20220822214343-2106bdb7fc11/go.mod h1:D+q1th05BC1WA2kq3yyRxYiF8ZwQUbhNA2iwbG8qODE=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/fjl/memsize v0.0.1 h1:+zhkb+dhUgx0/e+M8sF0QqiouvMQUiKR+QYvdxIOKcQ= github.com/fjl/memsize v0.0.1 h1:+zhkb+dhUgx0/e+M8sF0QqiouvMQUiKR+QYvdxIOKcQ=
github.com/fjl/memsize v0.0.1/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= github.com/fjl/memsize v0.0.1/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0=
......
...@@ -32,8 +32,11 @@ set -eu ...@@ -32,8 +32,11 @@ set -eu
L1_URL="http://localhost:8545" L1_URL="http://localhost:8545"
L2_URL="http://localhost:9545" L2_URL="http://localhost:9545"
CONTRACTS_BEDROCK=./packages/contracts-bedrock OP_NODE=op-node
CONTRACTS_BEDROCK=$PWD/packages/contracts-bedrock
CONTRACTS_GOVERNANCE=$PWD/packages/contracts-governance
NETWORK=devnetL1 NETWORK=devnetL1
DEVNET=$PWD/.devnet
# Helper method that waits for a given URL to be up. Can't use # Helper method that waits for a given URL to be up. Can't use
# cURL's built-in retry logic because connection reset errors # cURL's built-in retry logic because connection reset errors
...@@ -59,12 +62,12 @@ mkdir -p ./.devnet ...@@ -59,12 +62,12 @@ mkdir -p ./.devnet
# Regenerate the L1 genesis file if necessary. The existence of the genesis # Regenerate the L1 genesis file if necessary. The existence of the genesis
# file is used to determine if we need to recreate the devnet's state folder. # file is used to determine if we need to recreate the devnet's state folder.
if [ ! -f ./.devnet/genesis-l1.json ]; then if [ ! -f $DEVNET/genesis-l1.json ]; then
echo "Regenerating L1 genesis." echo "Regenerating L1 genesis."
( (
cd $CONTRACTS_BEDROCK cd $CONTRACTS_BEDROCK
npx hardhat --network $NETWORK genesis-l1 --outfile genesis-l1.json npx hardhat --network $NETWORK genesis-l1 --outfile genesis-l1.json
mv genesis-l1.json ../../.devnet/genesis-l1.json mv genesis-l1.json $DEVNET/genesis-l1.json
) )
fi fi
...@@ -88,12 +91,17 @@ else ...@@ -88,12 +91,17 @@ else
echo "Contracts already deployed, skipping." echo "Contracts already deployed, skipping."
fi fi
if [ ! -f ./.devnet/genesis-l2.json ]; then if [ ! -f $DEVNET/genesis-l2.json ]; then
( (
echo "Creating L2 genesis file." echo "Creating L2 genesis file."
cd $CONTRACTS_BEDROCK cd $OP_NODE
npx hardhat --network $NETWORK genesis-l2 go run cmd/main.go genesis devnet-l2 \
mv genesis.json ../../.devnet/genesis-l2.json --artifacts $CONTRACTS_BEDROCK/artifacts,$CONTRACTS_GOVERNANCE/artifacts \
--network $NETWORK \
--deployments $CONTRACTS_BEDROCK/deployments \
--deploy-config $CONTRACTS_BEDROCK/deploy-config \
--rpc-url http://localhost:8545 \
--outfile $DEVNET/genesis-l2.json
echo "Created L2 genesis." echo "Created L2 genesis."
) )
else else
...@@ -109,20 +117,20 @@ fi ...@@ -109,20 +117,20 @@ fi
) )
# Start putting together the rollup config. # Start putting together the rollup config.
if [ ! -f ./.devnet/rollup.json ]; then if [ ! -f $DEVNET/rollup.json ]; then
( (
echo "Building rollup config..." echo "Building rollup config..."
cd $CONTRACTS_BEDROCK cd $CONTRACTS_BEDROCK
npx hardhat --network $NETWORK rollup-config npx hardhat --network $NETWORK rollup-config
mv rollup.json ../../.devnet/rollup.json mv rollup.json $DEVNET/rollup.json
) )
else else
echo "Rollup config already exists" echo "Rollup config already exists"
fi fi
L2OO_ADDRESS=$(jq -r .address < $CONTRACTS_BEDROCK/deployments/$NETWORK/L2OutputOracleProxy.json) L2OO_ADDRESS=$(jq -r .address < $CONTRACTS_BEDROCK/deployments/$NETWORK/L2OutputOracleProxy.json)
SEQUENCER_GENESIS_HASH="$(jq -r '.l2.hash' < .devnet/rollup.json)" SEQUENCER_GENESIS_HASH="$(jq -r '.l2.hash' < $DEVNET/rollup.json)"
SEQUENCER_BATCH_INBOX_ADDRESS="$(cat ./.devnet/rollup.json | jq -r '.batch_inbox_address')" SEQUENCER_BATCH_INBOX_ADDRESS="$(cat $DEVNET/rollup.json | jq -r '.batch_inbox_address')"
# Bring up everything else. # Bring up everything else.
( (
......
import { task, types } from 'hardhat/config' import { task, types } from 'hardhat/config'
import { providers } from 'ethers' import { providers, Contract } from 'ethers'
import '@nomiclabs/hardhat-ethers' import '@nomiclabs/hardhat-ethers'
import 'hardhat-deploy'
import { predeploys, getContractInterface } from '../src' import { predeploys } from '../src'
const checkCode = async (provider: providers.JsonRpcProvider) => {
for (const [name, address] of Object.entries(predeploys)) {
const code = await provider.getCode(address)
if (code === '0x') {
throw new Error(`Missing code for ${name}`)
}
}
}
task('check-l2-config', 'Validate L2 config') task('check-l2-config', 'Validate L2 config')
.addParam( .addParam(
...@@ -15,17 +25,66 @@ task('check-l2-config', 'Validate L2 config') ...@@ -15,17 +25,66 @@ task('check-l2-config', 'Validate L2 config')
const { l2ProviderUrl } = args const { l2ProviderUrl } = args
const l2Provider = new providers.JsonRpcProvider(l2ProviderUrl) const l2Provider = new providers.JsonRpcProvider(l2ProviderUrl)
const OptimismMintableERC20Factory = new hre.ethers.Contract( await checkCode(l2Provider)
const Artifact__L2CrossDomainMessenger = await hre.artifacts.readArtifact(
'L2CrossDomainMessenger'
)
const Artifact__L2StandardBridge = await hre.artifacts.readArtifact(
'L2StandardBridge'
)
const Artifact__OptimismMintableERC20Factory =
await hre.artifacts.readArtifact('OptimismMintableERC20Factory')
const L2CrossDomainMessenger = new Contract(
predeploys.L2CrossDomainMessenger,
Artifact__L2CrossDomainMessenger.abi,
l2Provider
)
const Deployment__L1CrossDomainMessenger = await hre.deployments.get(
'L1CrossDomainMessengerProxy'
)
const otherMessenger = await L2CrossDomainMessenger.otherMessenger()
if (otherMessenger !== Deployment__L1CrossDomainMessenger.address) {
throw new Error(
`L2CrossDomainMessenger otherMessenger not set correctly. Got ${otherMessenger}, expected ${Deployment__L1CrossDomainMessenger.address}`
)
}
const L2StandardBridge = new Contract(
predeploys.L2StandardBridge,
Artifact__L2StandardBridge.abi,
l2Provider
)
const messenger = await L2StandardBridge.messenger()
if (messenger !== predeploys.L2CrossDomainMessenger) {
throw new Error(
`L2StandardBridge messenger not set correctly. Got ${messenger}, expected ${predeploys.L2CrossDomainMessenger}`
)
}
const Deployment__L1StandardBridge = await hre.deployments.get(
'L1StandardBridgeProxy'
)
const otherBridge = await L2StandardBridge.otherBridge()
if (otherBridge !== Deployment__L1StandardBridge.address) {
throw new Error(
`L2StandardBridge otherBridge not set correctly. Got ${otherBridge}, expected ${Deployment__L1StandardBridge.address}`
)
}
const OptimismMintableERC20Factory = new Contract(
predeploys.OptimismMintableERC20Factory, predeploys.OptimismMintableERC20Factory,
getContractInterface('OptimismMintableERC20Factory'), Artifact__OptimismMintableERC20Factory.abi,
l2Provider l2Provider
) )
const bridge = await OptimismMintableERC20Factory.bridge() const bridge = await OptimismMintableERC20Factory.bridge()
console.log(`OptimismMintableERC20Factory.bridge() -> ${bridge}`)
if (bridge !== predeploys.L2StandardBridge) { if (bridge !== predeploys.L2StandardBridge) {
throw new Error( throw new Error(
`L2StandardBridge not set correctly. Got ${bridge}, expected ${predeploys.L2StandardBridge}` `OptimismMintableERC20Factory bridge not set correctly. Got ${bridge}, expected ${predeploys.L2StandardBridge}`
) )
} }
}) })
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment