Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
2fbd8956
Unverified
Commit
2fbd8956
authored
Sep 04, 2021
by
kf
Committed by
Kelvin Fichter
Nov 10, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor: remove custom genesis logic
parent
d6cb0e71
Changes
18
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
125 additions
and
345 deletions
+125
-345
README.md
l2geth/README.md
+0
-14
keystore.go
l2geth/accounts/keystore/keystore.go
+0
-21
main.go
l2geth/cmd/geth/main.go
+0
-3
usage.go
l2geth/cmd/geth/usage.go
+0
-3
flags.go
l2geth/cmd/utils/flags.go
+1
-42
genesis.go
l2geth/core/genesis.go
+13
-74
config.go
l2geth/eth/config.go
+0
-1
config.go
l2geth/rollup/config.go
+3
-10
sync_service.go
l2geth/rollup/sync_service.go
+1
-3
start.sh
l2geth/scripts/start.sh
+0
-83
docker-compose.yml
ops/docker-compose.yml
+6
-4
geth.env
ops/envs/geth.env
+0
-3
deployer.sh
ops/scripts/deployer.sh
+4
-2
geth.sh
ops/scripts/geth.sh
+33
-21
serve_dump.sh
packages/contracts/bin/serve_dump.sh
+0
-37
take-dump.ts
packages/contracts/bin/take-dump.ts
+9
-10
package.json
packages/contracts/package.json
+0
-1
make-genesis.ts
packages/contracts/src/make-genesis.ts
+55
-13
No files found.
l2geth/README.md
View file @
2fbd8956
...
@@ -43,15 +43,8 @@ with their configuration can run the command:
...
@@ -43,15 +43,8 @@ with their configuration can run the command:
```
bash
```
bash
$ USING_OVM
=
true
./build/bin/geth
\
$ USING_OVM
=
true
./build/bin/geth
\
--rollup
.addressmanagerowneraddress
$ADDRESS_MANAGER_OWNER_ADDRESS
\
--rollup
.clienthttp
$ROLLUP_CLIENT_HTTP
\
--rollup
.clienthttp
$ROLLUP_CLIENT_HTTP
\
--rollup
.pollinterval 3s
\
--rollup
.pollinterval 3s
\
--eth1
.networkid
$LAYER1_NETWORK_ID
\
--eth1
.chainid
$LAYER1_CHAIN_ID
\
--eth1
.l1standardbridgeaddress
$ETH1_L1_STANDARD_BRIDGE_ADDRESS
\
--eth1
.l1crossdomainmessengeraddress
$ETH1_L1_CROSS_DOMAIN_MESSENGER_ADDRESS
\
--eth1
.l1feewalletaddress
$ETH1_L1_FEE_WALLET_ADDRESS
\
--eth1
.addressresolveraddress
$ETH1_ADDRESS_RESOLVER_ADDRESS
\
--eth1
.ctcdeploymentheight
$CTC_DEPLOY_HEIGHT
\
--eth1
.ctcdeploymentheight
$CTC_DEPLOY_HEIGHT
\
--eth1
.syncservice
\
--eth1
.syncservice
\
--rpc
\
--rpc
\
...
@@ -61,7 +54,6 @@ $ USING_OVM=true ./build/bin/geth \
...
@@ -61,7 +54,6 @@ $ USING_OVM=true ./build/bin/geth \
--wsaddr
"0.0.0.0"
\
--wsaddr
"0.0.0.0"
\
--wsport
8546
\
--wsport
8546
\
--wsorigins
'*'
\
--wsorigins
'*'
\
--networkid
420
\
--rpcapi
'eth,net,rollup,web3'
\
--rpcapi
'eth,net,rollup,web3'
\
--gasprice
'0'
\
--gasprice
'0'
\
--targetgaslimit
'8000000'
\
--targetgaslimit
'8000000'
\
...
@@ -70,16 +62,10 @@ $ USING_OVM=true ./build/bin/geth \
...
@@ -70,16 +62,10 @@ $ USING_OVM=true ./build/bin/geth \
--ipcdisable
--ipcdisable
```
```
The address manager owner address will be set in the layer two state at runtime.
To persist the database, pass the
`--datadir`
with a path to the directory for
To persist the database, pass the
`--datadir`
with a path to the directory for
the database to be persisted in. Without this flag, an in memory database will
the database to be persisted in. Without this flag, an in memory database will
be used. To tune the log level, use the
`--verbosity`
flag with an integer.
be used. To tune the log level, use the
`--verbosity`
flag with an integer.
The initial state can be fetched via HTTPS using the flag
`--rollup.statedumppath`
.
State dumps are available via the
[
regenesis repository
](
https://github.com/ethereum-optimism/regenesis
)
.
To use a different genesis state, pass in a path to one of the JSON files in the repository.
### Running a Verifier
### Running a Verifier
Add the flag
`--rollup.verifier`
Add the flag
`--rollup.verifier`
...
...
l2geth/accounts/keystore/keystore.go
View file @
2fbd8956
...
@@ -21,7 +21,6 @@
...
@@ -21,7 +21,6 @@
package
keystore
package
keystore
import
(
import
(
"bytes"
"crypto/ecdsa"
"crypto/ecdsa"
crand
"crypto/rand"
crand
"crypto/rand"
"errors"
"errors"
...
@@ -39,8 +38,6 @@ import (
...
@@ -39,8 +38,6 @@ import (
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/rollup/rcfg"
)
)
var
(
var
(
...
@@ -83,24 +80,6 @@ func NewKeyStore(keydir string, scryptN, scryptP int) *KeyStore {
...
@@ -83,24 +80,6 @@ func NewKeyStore(keydir string, scryptN, scryptP int) *KeyStore {
keydir
,
_
=
filepath
.
Abs
(
keydir
)
keydir
,
_
=
filepath
.
Abs
(
keydir
)
ks
:=
&
KeyStore
{
storage
:
&
keyStorePassphrase
{
keydir
,
scryptN
,
scryptP
,
false
}}
ks
:=
&
KeyStore
{
storage
:
&
keyStorePassphrase
{
keydir
,
scryptN
,
scryptP
,
false
}}
ks
.
init
(
keydir
)
ks
.
init
(
keydir
)
if
rcfg
.
UsingOVM
{
// Add a deterministic key to the key store so that
// all clique blocks are signed with the same key.
// This change will result in deterministic blocks across
// the entire network. This change is necessary due to
// each node running its own single signer clique consensus.
input
:=
make
([]
byte
,
65
)
rng
:=
bytes
.
NewReader
(
input
)
key
,
err
:=
newKey
(
rng
)
log
.
Info
(
"Adding key to keyring"
,
"address"
,
key
.
Address
.
Hex
())
if
err
!=
nil
{
panic
(
fmt
.
Sprintf
(
"cannot create key: %s"
,
err
))
}
_
,
err
=
ks
.
importKey
(
key
,
""
)
if
err
!=
nil
{
panic
(
fmt
.
Sprintf
(
"cannot import key: %s"
,
err
))
}
}
return
ks
return
ks
}
}
...
...
l2geth/cmd/geth/main.go
View file @
2fbd8956
...
@@ -138,7 +138,6 @@ var (
...
@@ -138,7 +138,6 @@ var (
utils
.
GoerliFlag
,
utils
.
GoerliFlag
,
utils
.
VMEnableDebugFlag
,
utils
.
VMEnableDebugFlag
,
utils
.
NetworkIdFlag
,
utils
.
NetworkIdFlag
,
utils
.
ChainIdFlag
,
utils
.
EthStatsURLFlag
,
utils
.
EthStatsURLFlag
,
utils
.
FakePoWFlag
,
utils
.
FakePoWFlag
,
utils
.
NoCompactionFlag
,
utils
.
NoCompactionFlag
,
...
@@ -155,12 +154,10 @@ var (
...
@@ -155,12 +154,10 @@ var (
optimismFlags
=
[]
cli
.
Flag
{
optimismFlags
=
[]
cli
.
Flag
{
utils
.
Eth1SyncServiceEnable
,
utils
.
Eth1SyncServiceEnable
,
utils
.
Eth1CanonicalTransactionChainDeployHeightFlag
,
utils
.
Eth1CanonicalTransactionChainDeployHeightFlag
,
utils
.
Eth1ChainIdFlag
,
utils
.
RollupClientHttpFlag
,
utils
.
RollupClientHttpFlag
,
utils
.
RollupEnableVerifierFlag
,
utils
.
RollupEnableVerifierFlag
,
utils
.
RollupTimstampRefreshFlag
,
utils
.
RollupTimstampRefreshFlag
,
utils
.
RollupPollIntervalFlag
,
utils
.
RollupPollIntervalFlag
,
utils
.
RollupStateDumpPathFlag
,
utils
.
RollupMaxCalldataSizeFlag
,
utils
.
RollupMaxCalldataSizeFlag
,
utils
.
RollupBackendFlag
,
utils
.
RollupBackendFlag
,
utils
.
RollupEnforceFeesFlag
,
utils
.
RollupEnforceFeesFlag
,
...
...
l2geth/cmd/geth/usage.go
View file @
2fbd8956
...
@@ -68,12 +68,10 @@ var AppHelpFlagGroups = []flagGroup{
...
@@ -68,12 +68,10 @@ var AppHelpFlagGroups = []flagGroup{
Flags
:
[]
cli
.
Flag
{
Flags
:
[]
cli
.
Flag
{
utils
.
Eth1SyncServiceEnable
,
utils
.
Eth1SyncServiceEnable
,
utils
.
Eth1CanonicalTransactionChainDeployHeightFlag
,
utils
.
Eth1CanonicalTransactionChainDeployHeightFlag
,
utils
.
Eth1ChainIdFlag
,
utils
.
RollupClientHttpFlag
,
utils
.
RollupClientHttpFlag
,
utils
.
RollupEnableVerifierFlag
,
utils
.
RollupEnableVerifierFlag
,
utils
.
RollupTimstampRefreshFlag
,
utils
.
RollupTimstampRefreshFlag
,
utils
.
RollupPollIntervalFlag
,
utils
.
RollupPollIntervalFlag
,
utils
.
RollupStateDumpPathFlag
,
utils
.
RollupMaxCalldataSizeFlag
,
utils
.
RollupMaxCalldataSizeFlag
,
utils
.
RollupBackendFlag
,
utils
.
RollupBackendFlag
,
utils
.
RollupEnforceFeesFlag
,
utils
.
RollupEnforceFeesFlag
,
...
@@ -92,7 +90,6 @@ var AppHelpFlagGroups = []flagGroup{
...
@@ -92,7 +90,6 @@ var AppHelpFlagGroups = []flagGroup{
utils
.
NoUSBFlag
,
utils
.
NoUSBFlag
,
utils
.
SmartCardDaemonPathFlag
,
utils
.
SmartCardDaemonPathFlag
,
utils
.
NetworkIdFlag
,
utils
.
NetworkIdFlag
,
utils
.
ChainIdFlag
,
utils
.
TestnetFlag
,
utils
.
TestnetFlag
,
utils
.
RinkebyFlag
,
utils
.
RinkebyFlag
,
utils
.
GoerliFlag
,
utils
.
GoerliFlag
,
...
...
l2geth/cmd/utils/flags.go
View file @
2fbd8956
...
@@ -172,12 +172,6 @@ var (
...
@@ -172,12 +172,6 @@ var (
EnvVar
:
"NETWORK_ID"
,
EnvVar
:
"NETWORK_ID"
,
}
}
ChainIdFlag
=
cli
.
Uint64Flag
{
Name
:
"chainid"
,
Usage
:
"Chain ID identifier"
,
Value
:
420
,
EnvVar
:
"CHAIN_ID"
,
}
TestnetFlag
=
cli
.
BoolFlag
{
TestnetFlag
=
cli
.
BoolFlag
{
Name
:
"testnet"
,
Name
:
"testnet"
,
Usage
:
"Ropsten network: pre-configured proof-of-work test network"
,
Usage
:
"Ropsten network: pre-configured proof-of-work test network"
,
...
@@ -817,11 +811,6 @@ var (
...
@@ -817,11 +811,6 @@ var (
Usage
:
"Deployment of the canonical transaction chain"
,
Usage
:
"Deployment of the canonical transaction chain"
,
EnvVar
:
"ETH1_CTC_DEPLOYMENT_HEIGHT"
,
EnvVar
:
"ETH1_CTC_DEPLOYMENT_HEIGHT"
,
}
}
Eth1ChainIdFlag
=
cli
.
Uint64Flag
{
Name
:
"eth1.chainid"
,
Usage
:
"Network identifier (integer, 1=Frontier, 2=Morden (disused), 3=Ropsten, 4=Rinkeby)"
,
EnvVar
:
"ETH1_CHAINID"
,
}
RollupClientHttpFlag
=
cli
.
StringFlag
{
RollupClientHttpFlag
=
cli
.
StringFlag
{
Name
:
"rollup.clienthttp"
,
Name
:
"rollup.clienthttp"
,
Usage
:
"HTTP endpoint for the rollup client"
,
Usage
:
"HTTP endpoint for the rollup client"
,
...
@@ -851,12 +840,6 @@ var (
...
@@ -851,12 +840,6 @@ var (
Usage
:
"Enable the verifier"
,
Usage
:
"Enable the verifier"
,
EnvVar
:
"ROLLUP_VERIFIER_ENABLE"
,
EnvVar
:
"ROLLUP_VERIFIER_ENABLE"
,
}
}
RollupStateDumpPathFlag
=
cli
.
StringFlag
{
Name
:
"rollup.statedumppath"
,
Usage
:
"Path to the state dump"
,
Value
:
eth
.
DefaultConfig
.
Rollup
.
StateDumpPath
,
EnvVar
:
"ROLLUP_STATE_DUMP_PATH"
,
}
RollupMaxCalldataSizeFlag
=
cli
.
IntFlag
{
RollupMaxCalldataSizeFlag
=
cli
.
IntFlag
{
Name
:
"rollup.maxcalldatasize"
,
Name
:
"rollup.maxcalldatasize"
,
Usage
:
"Maximum allowed calldata size for Queue Origin Sequencer Txs"
,
Usage
:
"Maximum allowed calldata size for Queue Origin Sequencer Txs"
,
...
@@ -1113,9 +1096,6 @@ func setEth1(ctx *cli.Context, cfg *rollup.Config) {
...
@@ -1113,9 +1096,6 @@ func setEth1(ctx *cli.Context, cfg *rollup.Config) {
height
:=
ctx
.
GlobalUint64
(
Eth1CanonicalTransactionChainDeployHeightFlag
.
Name
)
height
:=
ctx
.
GlobalUint64
(
Eth1CanonicalTransactionChainDeployHeightFlag
.
Name
)
cfg
.
CanonicalTransactionChainDeployHeight
=
new
(
big
.
Int
)
.
SetUint64
(
height
)
cfg
.
CanonicalTransactionChainDeployHeight
=
new
(
big
.
Int
)
.
SetUint64
(
height
)
}
}
if
ctx
.
GlobalIsSet
(
Eth1ChainIdFlag
.
Name
)
{
cfg
.
Eth1ChainId
=
ctx
.
GlobalUint64
(
Eth1ChainIdFlag
.
Name
)
}
if
ctx
.
GlobalIsSet
(
Eth1SyncServiceEnable
.
Name
)
{
if
ctx
.
GlobalIsSet
(
Eth1SyncServiceEnable
.
Name
)
{
cfg
.
Eth1SyncServiceEnable
=
ctx
.
GlobalBool
(
Eth1SyncServiceEnable
.
Name
)
cfg
.
Eth1SyncServiceEnable
=
ctx
.
GlobalBool
(
Eth1SyncServiceEnable
.
Name
)
}
}
...
@@ -1130,11 +1110,6 @@ func setRollup(ctx *cli.Context, cfg *rollup.Config) {
...
@@ -1130,11 +1110,6 @@ func setRollup(ctx *cli.Context, cfg *rollup.Config) {
if
ctx
.
GlobalIsSet
(
RollupEnableVerifierFlag
.
Name
)
{
if
ctx
.
GlobalIsSet
(
RollupEnableVerifierFlag
.
Name
)
{
cfg
.
IsVerifier
=
true
cfg
.
IsVerifier
=
true
}
}
if
ctx
.
GlobalIsSet
(
RollupStateDumpPathFlag
.
Name
)
{
cfg
.
StateDumpPath
=
ctx
.
GlobalString
(
RollupStateDumpPathFlag
.
Name
)
}
else
{
cfg
.
StateDumpPath
=
eth
.
DefaultConfig
.
Rollup
.
StateDumpPath
}
if
ctx
.
GlobalIsSet
(
RollupMaxCalldataSizeFlag
.
Name
)
{
if
ctx
.
GlobalIsSet
(
RollupMaxCalldataSizeFlag
.
Name
)
{
cfg
.
MaxCallDataSize
=
ctx
.
GlobalInt
(
RollupMaxCalldataSizeFlag
.
Name
)
cfg
.
MaxCallDataSize
=
ctx
.
GlobalInt
(
RollupMaxCalldataSizeFlag
.
Name
)
}
}
...
@@ -1720,23 +1695,7 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *eth.Config) {
...
@@ -1720,23 +1695,7 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *eth.Config) {
}
}
log
.
Info
(
"Using developer account"
,
"address"
,
developer
.
Address
)
log
.
Info
(
"Using developer account"
,
"address"
,
developer
.
Address
)
// Allow for a configurable chain id
cfg
.
Genesis
=
core
.
DeveloperGenesisBlock
(
uint64
(
ctx
.
GlobalInt
(
DeveloperPeriodFlag
.
Name
)),
developer
.
Address
)
var
chainID
*
big
.
Int
if
ctx
.
GlobalIsSet
(
ChainIdFlag
.
Name
)
{
id
:=
ctx
.
GlobalUint64
(
ChainIdFlag
.
Name
)
chainID
=
new
(
big
.
Int
)
.
SetUint64
(
id
)
}
// UsingOVM
// The genesis block includes state that is set at runtime.
// This allows the statedump to be generic and not created
// specific for each network.
gasLimit
:=
cfg
.
Rollup
.
GasLimit
if
gasLimit
==
0
{
gasLimit
=
params
.
GenesisGasLimit
}
stateDumpPath
:=
cfg
.
Rollup
.
StateDumpPath
cfg
.
Genesis
=
core
.
DeveloperGenesisBlock
(
uint64
(
ctx
.
GlobalInt
(
DeveloperPeriodFlag
.
Name
)),
developer
.
Address
,
stateDumpPath
,
chainID
,
gasLimit
)
if
!
ctx
.
GlobalIsSet
(
MinerGasPriceFlag
.
Name
)
&&
!
ctx
.
GlobalIsSet
(
MinerLegacyGasPriceFlag
.
Name
)
{
if
!
ctx
.
GlobalIsSet
(
MinerGasPriceFlag
.
Name
)
&&
!
ctx
.
GlobalIsSet
(
MinerLegacyGasPriceFlag
.
Name
)
{
cfg
.
Miner
.
GasPrice
=
big
.
NewInt
(
1
)
cfg
.
Miner
.
GasPrice
=
big
.
NewInt
(
1
)
}
}
...
...
l2geth/core/genesis.go
View file @
2fbd8956
...
@@ -22,9 +22,7 @@ import (
...
@@ -22,9 +22,7 @@ import (
"encoding/json"
"encoding/json"
"errors"
"errors"
"fmt"
"fmt"
"io/ioutil"
"math/big"
"math/big"
"net/http"
"strings"
"strings"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
...
@@ -38,7 +36,6 @@ import (
...
@@ -38,7 +36,6 @@ import (
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/rlp"
"github.com/ethereum/go-ethereum/rlp"
"github.com/ethereum/go-ethereum/rollup/rcfg"
)
)
//go:generate gencodec -type Genesis -field-override genesisSpecMarshaling -out gen_genesis.go
//go:generate gencodec -type Genesis -field-override genesisSpecMarshaling -out gen_genesis.go
...
@@ -263,7 +260,6 @@ func (g *Genesis) ToBlock(db ethdb.Database) *types.Block {
...
@@ -263,7 +260,6 @@ func (g *Genesis) ToBlock(db ethdb.Database) *types.Block {
db
=
rawdb
.
NewMemoryDatabase
()
db
=
rawdb
.
NewMemoryDatabase
()
}
}
statedb
,
_
:=
state
.
New
(
common
.
Hash
{},
state
.
NewDatabase
(
db
))
statedb
,
_
:=
state
.
New
(
common
.
Hash
{},
state
.
NewDatabase
(
db
))
for
addr
,
account
:=
range
g
.
Alloc
{
for
addr
,
account
:=
range
g
.
Alloc
{
statedb
.
AddBalance
(
addr
,
account
.
Balance
)
statedb
.
AddBalance
(
addr
,
account
.
Balance
)
statedb
.
SetCode
(
addr
,
account
.
Code
)
statedb
.
SetCode
(
addr
,
account
.
Code
)
...
@@ -387,59 +383,29 @@ func DefaultGoerliGenesisBlock() *Genesis {
...
@@ -387,59 +383,29 @@ func DefaultGoerliGenesisBlock() *Genesis {
}
}
}
}
// UsingOVM
// DeveloperGenesisBlock returns the 'geth --dev' genesis block.
// DeveloperGenesisBlock returns the 'geth --dev' genesis block.
// Additional runtime parameters are passed through that impact
func
DeveloperGenesisBlock
(
period
uint64
,
faucet
common
.
Address
)
*
Genesis
{
// the genesis state. An "incompatible genesis block" error means that
// these params were altered since the initial creation of the datadir.
func
DeveloperGenesisBlock
(
period
uint64
,
faucet
common
.
Address
,
stateDumpPath
string
,
chainID
*
big
.
Int
,
gasLimit
uint64
)
*
Genesis
{
// Override the default period to the user requested one
// Override the default period to the user requested one
config
:=
*
params
.
AllCliqueProtocolChanges
config
:=
*
params
.
AllCliqueProtocolChanges
config
.
Clique
.
Period
=
period
config
.
Clique
.
Period
=
period
if
chainID
!=
nil
{
config
.
ChainID
=
chainID
}
stateDump
:=
GenesisAlloc
{}
if
rcfg
.
UsingOVM
{
// Fetch the state dump from the state dump path
// The system cannot start without a state dump as it depends on
// the ABIs that are included in the state dump. Check that all
// required state dump entries are present to prevent a faulty
// state dump from being used
if
stateDumpPath
==
""
{
panic
(
"Must pass state dump path"
)
}
log
.
Info
(
"Fetching state dump"
,
"path"
,
stateDumpPath
)
err
:=
fetchStateDump
(
stateDumpPath
,
&
stateDump
)
if
err
!=
nil
{
panic
(
fmt
.
Sprintf
(
"Cannot fetch state dump: %s"
,
err
))
}
}
alloc
:=
GenesisAlloc
{
common
.
BytesToAddress
([]
byte
{
1
})
:
{
Balance
:
big
.
NewInt
(
1
)},
// ECRecover
common
.
BytesToAddress
([]
byte
{
2
})
:
{
Balance
:
big
.
NewInt
(
1
)},
// SHA256
common
.
BytesToAddress
([]
byte
{
3
})
:
{
Balance
:
big
.
NewInt
(
1
)},
// RIPEMD
common
.
BytesToAddress
([]
byte
{
4
})
:
{
Balance
:
big
.
NewInt
(
1
)},
// Identity
common
.
BytesToAddress
([]
byte
{
5
})
:
{
Balance
:
big
.
NewInt
(
1
)},
// ModExp
common
.
BytesToAddress
([]
byte
{
6
})
:
{
Balance
:
big
.
NewInt
(
1
)},
// ECAdd
common
.
BytesToAddress
([]
byte
{
7
})
:
{
Balance
:
big
.
NewInt
(
1
)},
// ECScalarMul
common
.
BytesToAddress
([]
byte
{
8
})
:
{
Balance
:
big
.
NewInt
(
1
)},
// ECPairing
}
for
k
,
v
:=
range
stateDump
{
alloc
[
k
]
=
v
}
// Assemble and return the genesis with the precompiles and faucet pre-funded
// Assemble and return the genesis with the precompiles and faucet pre-funded
return
&
Genesis
{
return
&
Genesis
{
Config
:
&
config
,
Config
:
&
config
,
ExtraData
:
append
(
append
(
make
([]
byte
,
32
),
faucet
[
:
]
...
),
make
([]
byte
,
crypto
.
SignatureLength
)
...
),
ExtraData
:
append
(
append
(
make
([]
byte
,
32
),
faucet
[
:
]
...
),
make
([]
byte
,
crypto
.
SignatureLength
)
...
),
GasLimit
:
gasLimit
,
GasLimit
:
6283185
,
Difficulty
:
big
.
NewInt
(
1
),
Difficulty
:
big
.
NewInt
(
1
),
Alloc
:
alloc
,
Alloc
:
map
[
common
.
Address
]
GenesisAccount
{
common
.
BytesToAddress
([]
byte
{
1
})
:
{
Balance
:
big
.
NewInt
(
1
)},
// ECRecover
common
.
BytesToAddress
([]
byte
{
2
})
:
{
Balance
:
big
.
NewInt
(
1
)},
// SHA256
common
.
BytesToAddress
([]
byte
{
3
})
:
{
Balance
:
big
.
NewInt
(
1
)},
// RIPEMD
common
.
BytesToAddress
([]
byte
{
4
})
:
{
Balance
:
big
.
NewInt
(
1
)},
// Identity
common
.
BytesToAddress
([]
byte
{
5
})
:
{
Balance
:
big
.
NewInt
(
1
)},
// ModExp
common
.
BytesToAddress
([]
byte
{
6
})
:
{
Balance
:
big
.
NewInt
(
1
)},
// ECAdd
common
.
BytesToAddress
([]
byte
{
7
})
:
{
Balance
:
big
.
NewInt
(
1
)},
// ECScalarMul
common
.
BytesToAddress
([]
byte
{
8
})
:
{
Balance
:
big
.
NewInt
(
1
)},
// ECPairing
faucet
:
{
Balance
:
new
(
big
.
Int
)
.
Sub
(
new
(
big
.
Int
)
.
Lsh
(
big
.
NewInt
(
1
),
256
),
big
.
NewInt
(
9
))},
},
}
}
}
}
...
@@ -454,30 +420,3 @@ func decodePrealloc(data string) GenesisAlloc {
...
@@ -454,30 +420,3 @@ func decodePrealloc(data string) GenesisAlloc {
}
}
return
ga
return
ga
}
}
// UsingOVM
// fetchStateDump will fetch a state dump from a remote HTTP endpoint.
// This state dump includes the OVM system contracts as well as previous
// user state if the network has previously had a regenesis.
func
fetchStateDump
(
path
string
,
stateDump
*
GenesisAlloc
)
error
{
if
stateDump
==
nil
{
return
errors
.
New
(
"Unable to fetch state dump"
)
}
resp
,
err
:=
http
.
Get
(
path
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"Unable to GET state dump: %w"
,
err
)
}
if
resp
.
StatusCode
>=
400
{
return
errors
.
New
(
"State dump not found"
)
}
defer
resp
.
Body
.
Close
()
body
,
err
:=
ioutil
.
ReadAll
(
resp
.
Body
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"Unable to read response body: %w"
,
err
)
}
err
=
json
.
Unmarshal
(
body
,
stateDump
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"Unable to unmarshal response body: %w"
,
err
)
}
return
nil
}
l2geth/eth/config.go
View file @
2fbd8956
...
@@ -63,7 +63,6 @@ var DefaultConfig = Config{
...
@@ -63,7 +63,6 @@ var DefaultConfig = Config{
Percentile
:
60
,
Percentile
:
60
,
},
},
Rollup
:
rollup
.
Config
{
Rollup
:
rollup
.
Config
{
StateDumpPath
:
"https://raw.githubusercontent.com/ethereum-optimism/regenesis/master/master.json"
,
// The max size of a transaction that is sent over the p2p network is 128kb
// The max size of a transaction that is sent over the p2p network is 128kb
// https://github.com/ethereum/go-ethereum/blob/c2d2f4ed8f232bb11663a1b01a2e578aa22f24bd/core/tx_pool.go#L51
// https://github.com/ethereum/go-ethereum/blob/c2d2f4ed8f232bb11663a1b01a2e578aa22f24bd/core/tx_pool.go#L51
// The batch overhead is:
// The batch overhead is:
...
...
l2geth/rollup/config.go
View file @
2fbd8956
...
@@ -14,23 +14,16 @@ type Config struct {
...
@@ -14,23 +14,16 @@ type Config struct {
IsVerifier
bool
IsVerifier
bool
// Enable the sync service
// Enable the sync service
Eth1SyncServiceEnable
bool
Eth1SyncServiceEnable
bool
// Ensure that the correct layer 1 chain is being connected to
Eth1ChainId
uint64
// Gas Limit
// Gas Limit
GasLimit
uint64
GasLimit
uint64
// HTTP endpoint of the data transport layer
// HTTP endpoint of the data transport layer
RollupClientHttp
string
RollupClientHttp
string
L1CrossDomainMessengerAddress
common
.
Address
// Owner of the GasPriceOracle contract
L1FeeWalletAddress
common
.
Address
GasPriceOracleOwnerAddress
common
.
Address
AddressManagerOwnerAddress
common
.
Address
GasPriceOracleOwnerAddress
common
.
Address
L1StandardBridgeAddress
common
.
Address
// Turns on checking of state for L2 gas price
// Turns on checking of state for L2 gas price
EnableL2GasPolling
bool
EnableL2GasPolling
bool
// Deployment Height of the canonical transaction chain
// Deployment Height of the canonical transaction chain
CanonicalTransactionChainDeployHeight
*
big
.
Int
CanonicalTransactionChainDeployHeight
*
big
.
Int
// Path to the state dump
StateDumpPath
string
// Polling interval for rollup client
// Polling interval for rollup client
PollInterval
time
.
Duration
PollInterval
time
.
Duration
// Interval for updating the timestamp
// Interval for updating the timestamp
...
...
l2geth/rollup/sync_service.go
View file @
2fbd8956
...
@@ -63,7 +63,6 @@ type SyncService struct {
...
@@ -63,7 +63,6 @@ type SyncService struct {
txLock
sync
.
Mutex
txLock
sync
.
Mutex
loopLock
sync
.
Mutex
loopLock
sync
.
Mutex
enable
bool
enable
bool
eth1ChainId
uint64
bc
*
core
.
BlockChain
bc
*
core
.
BlockChain
txpool
*
core
.
TxPool
txpool
*
core
.
TxPool
RollupGpo
*
gasprice
.
RollupOracle
RollupGpo
*
gasprice
.
RollupOracle
...
@@ -156,7 +155,6 @@ func NewSyncService(ctx context.Context, cfg Config, txpool *core.TxPool, bc *co
...
@@ -156,7 +155,6 @@ func NewSyncService(ctx context.Context, cfg Config, txpool *core.TxPool, bc *co
bc
:
bc
,
bc
:
bc
,
txpool
:
txpool
,
txpool
:
txpool
,
chainHeadCh
:
make
(
chan
core
.
ChainHeadEvent
,
1
),
chainHeadCh
:
make
(
chan
core
.
ChainHeadEvent
,
1
),
eth1ChainId
:
cfg
.
Eth1ChainId
,
client
:
client
,
client
:
client
,
db
:
db
,
db
:
db
,
pollInterval
:
pollInterval
,
pollInterval
:
pollInterval
,
...
@@ -263,7 +261,7 @@ func (s *SyncService) Start() error {
...
@@ -263,7 +261,7 @@ func (s *SyncService) Start() error {
log
.
Info
(
"Running without syncing enabled"
)
log
.
Info
(
"Running without syncing enabled"
)
return
nil
return
nil
}
}
log
.
Info
(
"Initializing Sync Service"
,
"eth1-chainid"
,
s
.
eth1ChainId
)
log
.
Info
(
"Initializing Sync Service"
)
if
err
:=
s
.
updateGasPriceOracleCache
(
nil
);
err
!=
nil
{
if
err
:=
s
.
updateGasPriceOracleCache
(
nil
);
err
!=
nil
{
return
err
return
err
}
}
...
...
l2geth/scripts/start.sh
View file @
2fbd8956
...
@@ -7,12 +7,7 @@ IS_VERIFIER=
...
@@ -7,12 +7,7 @@ IS_VERIFIER=
ROLLUP_SYNC_SERVICE_ENABLE
=
true
ROLLUP_SYNC_SERVICE_ENABLE
=
true
DATADIR
=
$HOME
/.ethereum
DATADIR
=
$HOME
/.ethereum
TARGET_GAS_LIMIT
=
11000000
TARGET_GAS_LIMIT
=
11000000
CHAIN_ID
=
10
ETH1_CTC_DEPLOYMENT_HEIGHT
=
12686738
ETH1_CTC_DEPLOYMENT_HEIGHT
=
12686738
ETH1_L1_STANDARD_BRIDGE_ADDRESS
=
0x99C9fc46f92E8a1c0deC1b1747d010903E884bE1
ETH1_L1_CROSS_DOMAIN_MESSENGER_ADDRESS
=
0x25ace71c97B33Cc4729CF772ae268934F7ab5fA1
ADDRESS_MANAGER_OWNER_ADDRESS
=
0x9BA6e03D8B90dE867373Db8cF1A58d2F7F006b3A
ROLLUP_STATE_DUMP_PATH
=
https://storage.googleapis.com/optimism/mainnet/0.4.0.json
ROLLUP_CLIENT_HTTP
=
http://localhost:7878
ROLLUP_CLIENT_HTTP
=
http://localhost:7878
ROLLUP_POLL_INTERVAL
=
15s
ROLLUP_POLL_INTERVAL
=
15s
ROLLUP_TIMESTAMP_REFRESH
=
3m
ROLLUP_TIMESTAMP_REFRESH
=
3m
...
@@ -21,8 +16,6 @@ RPC_PORT=8545
...
@@ -21,8 +16,6 @@ RPC_PORT=8545
WS_PORT
=
8546
WS_PORT
=
8546
VERBOSITY
=
3
VERBOSITY
=
3
ROLLUP_BACKEND
=
l2
ROLLUP_BACKEND
=
l2
ROLLUP_GAS_PRICE_ORACLE_OWNER_ADDRESS
=
0x648E3e8101BFaB7bf5997Bd007Fb473786019159
ETH1_L1_FEE_WALLET_ADDRESS
=
0x391716d440c151c42cdf1c95c1d83a5427bca52c
USAGE
=
"
USAGE
=
"
Start the Sequencer or Verifier with most configuration pre-set.
Start the Sequencer or Verifier with most configuration pre-set.
...
@@ -32,11 +25,6 @@ CLI Arguments:
...
@@ -32,11 +25,6 @@ CLI Arguments:
-v|--verifier - start in verifier mode
-v|--verifier - start in verifier mode
--datadir - data directory to use
--datadir - data directory to use
--chainid - layer two chain id to use, must match contracts on L1
--chainid - layer two chain id to use, must match contracts on L1
--eth1.chainid - eth1 chain id
--eth1.ctcdeploymentheight - eth1 ctc deploy height
--eth1.l1crossdomainmessengeraddress - eth1 l1 xdomain messenger address
--eth1.l1feewalletaddress - eth l1 fee wallet address
--rollup.statedumppath - http path to the initial state dump
--rollup.clienthttp - rollup client http
--rollup.clienthttp - rollup client http
--rollup.pollinterval - polling interval for the rollup client
--rollup.pollinterval - polling interval for the rollup client
--rollup.timestamprefresh - timestamp refresh interval
--rollup.timestamprefresh - timestamp refresh interval
...
@@ -76,15 +64,6 @@ while (( "$#" )); do
...
@@ -76,15 +64,6 @@ while (( "$#" )); do
exit
1
exit
1
fi
fi
;;
;;
--chainid
)
if
[
-n
"
$2
"
]
&&
[
${
2
:0:1
}
!=
"-"
]
;
then
CHAIN_ID
=
"
$2
"
shift
2
else
echo
"Error: Argument for
$1
is missing"
>
&2
exit
1
fi
;;
--rpcport
)
--rpcport
)
if
[
-n
"
$2
"
]
&&
[
${
2
:0:1
}
!=
"-"
]
;
then
if
[
-n
"
$2
"
]
&&
[
${
2
:0:1
}
!=
"-"
]
;
then
RPC_PORT
=
"
$2
"
RPC_PORT
=
"
$2
"
...
@@ -112,51 +91,6 @@ while (( "$#" )); do
...
@@ -112,51 +91,6 @@ while (( "$#" )); do
exit
1
exit
1
fi
fi
;;
;;
--eth1
.l1crossdomainmessengeraddress
)
if
[
-n
"
$2
"
]
&&
[
${
2
:0:1
}
!=
"-"
]
;
then
ETH1_L1_CROSS_DOMAIN_MESSENGER_ADDRESS
=
"
$2
"
shift
2
else
echo
"Error: Argument for
$1
is missing"
>
&2
exit
1
fi
;;
--eth1
.l1feewalletaddress
)
if
[
-n
"
$2
"
]
&&
[
${
2
:0:1
}
!=
"-"
]
;
then
ETH1_L1_FEE_WALLET_ADDRESS
=
"
$2
"
shift
2
else
echo
"Error: Argument for
$1
is missing"
>
&2
exit
1
fi
;;
--eth1
.l1standardbridgeaddress
)
if
[
-n
"
$2
"
]
&&
[
${
2
:0:1
}
!=
"-"
]
;
then
ETH1_L1_STANDARD_BRIDGE_ADDRESS
=
"
$2
"
shift
2
else
echo
"Error: Argument for
$1
is missing"
>
&2
exit
1
fi
;;
--eth1
.ctcdeploymentheight
)
if
[
-n
"
$2
"
]
&&
[
${
2
:0:1
}
!=
"-"
]
;
then
ADDRESS_MANAGER_OWNER_ADDRESS
=
"
$2
"
shift
2
else
echo
"Error: Argument for
$1
is missing"
>
&2
exit
1
fi
;;
--rollup
.statedumppath
)
if
[
-n
"
$2
"
]
&&
[
${
2
:0:1
}
!=
"-"
]
;
then
ROLLUP_STATE_DUMP_PATH
=
"
$2
"
shift
2
else
echo
"Error: Argument for
$1
is missing"
>
&2
exit
1
fi
;;
--rollup
.clienthttp
)
--rollup
.clienthttp
)
if
[
-n
"
$2
"
]
&&
[
${
2
:0:1
}
!=
"-"
]
;
then
if
[
-n
"
$2
"
]
&&
[
${
2
:0:1
}
!=
"-"
]
;
then
ROLLUP_CLIENT_HTTP
=
"
$2
"
ROLLUP_CLIENT_HTTP
=
"
$2
"
...
@@ -184,15 +118,6 @@ while (( "$#" )); do
...
@@ -184,15 +118,6 @@ while (( "$#" )); do
exit
1
exit
1
fi
fi
;;
;;
--rollup
.addressmanagerowneraddress
)
if
[
-n
"
$2
"
]
&&
[
${
2
:0:1
}
!=
"-"
]
;
then
ADDRESS_MANAGER_OWNER_ADDRESS
=
"
$2
"
shift
2
else
echo
"Error: Argument for
$1
is missing"
>
&2
exit
1
fi
;;
--rollup
.backend
)
--rollup
.backend
)
if
[
-n
"
$2
"
]
&&
[
${
2
:0:1
}
!=
"-"
]
;
then
if
[
-n
"
$2
"
]
&&
[
${
2
:0:1
}
!=
"-"
]
;
then
ROLLUP_BACKEND
=
"
$2
"
ROLLUP_BACKEND
=
"
$2
"
...
@@ -232,21 +157,13 @@ if [[ ! -z "$ROLLUP_SYNC_SERVICE_ENABLE" ]]; then
...
@@ -232,21 +157,13 @@ if [[ ! -z "$ROLLUP_SYNC_SERVICE_ENABLE" ]]; then
cmd
=
"
$cmd
--eth1.syncservice"
cmd
=
"
$cmd
--eth1.syncservice"
fi
fi
cmd
=
"
$cmd
--datadir
$DATADIR
"
cmd
=
"
$cmd
--datadir
$DATADIR
"
cmd
=
"
$cmd
--eth1.l1crossdomainmessengeraddress
$ETH1_L1_CROSS_DOMAIN_MESSENGER_ADDRESS
"
cmd
=
"
$cmd
--eth1.l1feewalletaddress
$ETH1_L1_FEE_WALLET_ADDRESS
"
cmd
=
"
$cmd
--rollup.addressmanagerowneraddress
$ADDRESS_MANAGER_OWNER_ADDRESS
"
cmd
=
"
$cmd
--rollup.statedumppath
$ROLLUP_STATE_DUMP_PATH
"
cmd
=
"
$cmd
--eth1.ctcdeploymentheight
$ETH1_CTC_DEPLOYMENT_HEIGHT
"
cmd
=
"
$cmd
--eth1.ctcdeploymentheight
$ETH1_CTC_DEPLOYMENT_HEIGHT
"
cmd
=
"
$cmd
--eth1.l1standardbridgeaddress
$ETH1_L1_STANDARD_BRIDGE_ADDRESS
"
cmd
=
"
$cmd
--rollup.clienthttp
$ROLLUP_CLIENT_HTTP
"
cmd
=
"
$cmd
--rollup.clienthttp
$ROLLUP_CLIENT_HTTP
"
cmd
=
"
$cmd
--rollup.pollinterval
$ROLLUP_POLL_INTERVAL
"
cmd
=
"
$cmd
--rollup.pollinterval
$ROLLUP_POLL_INTERVAL
"
cmd
=
"
$cmd
--rollup.timestamprefresh
$ROLLUP_TIMESTAMP_REFRESH
"
cmd
=
"
$cmd
--rollup.timestamprefresh
$ROLLUP_TIMESTAMP_REFRESH
"
cmd
=
"
$cmd
--rollup.backend
$ROLLUP_BACKEND
"
cmd
=
"
$cmd
--rollup.backend
$ROLLUP_BACKEND
"
cmd
=
"
$cmd
--rollup.gaspriceoracleowneraddress
$ROLLUP_GAS_PRICE_ORACLE_OWNER_ADDRESS
"
cmd
=
"
$cmd
--cache
$CACHE
"
cmd
=
"
$cmd
--cache
$CACHE
"
cmd
=
"
$cmd
--rpc"
cmd
=
"
$cmd
--rpc"
cmd
=
"
$cmd
--dev"
cmd
=
"
$cmd
--chainid
$CHAIN_ID
"
cmd
=
"
$cmd
--networkid
$CHAIN_ID
"
cmd
=
"
$cmd
--networkid
$CHAIN_ID
"
cmd
=
"
$cmd
--rpcaddr 0.0.0.0"
cmd
=
"
$cmd
--rpcaddr 0.0.0.0"
cmd
=
"
$cmd
--rpcport
$RPC_PORT
"
cmd
=
"
$cmd
--rpcport
$RPC_PORT
"
...
...
ops/docker-compose.yml
View file @
2fbd8956
...
@@ -38,6 +38,9 @@ services:
...
@@ -38,6 +38,9 @@ services:
# setting the whitelist owner to address(0) disables the whitelist
# setting the whitelist owner to address(0) disables the whitelist
WHITELIST_OWNER
:
"
0x0000000000000000000000000000000000000000"
WHITELIST_OWNER
:
"
0x0000000000000000000000000000000000000000"
L1_FEE_WALLET_ADDRESS
:
"
0x391716d440c151c42cdf1c95c1d83a5427bca52c"
L1_FEE_WALLET_ADDRESS
:
"
0x391716d440c151c42cdf1c95c1d83a5427bca52c"
L2_CHAIN_ID
:
420
L2_BLOCK_GAS_LIMIT
:
11000000
BLOCK_SIGNER_ADDRESS
:
"
0x00000398232E2064F896018496b4b44b3D62751F"
# skip compilation when run in docker-compose, since the contracts
# skip compilation when run in docker-compose, since the contracts
# were already compiled in the builder step
# were already compiled in the builder step
NO_COMPILE
:
1
NO_COMPILE
:
1
...
@@ -87,12 +90,13 @@ services:
...
@@ -87,12 +90,13 @@ services:
ETH1_HTTP
:
http://l1_chain:8545
ETH1_HTTP
:
http://l1_chain:8545
ROLLUP_TIMESTAMP_REFRESH
:
5s
ROLLUP_TIMESTAMP_REFRESH
:
5s
ROLLUP_STATE_DUMP_PATH
:
http://deployer:8081/state-dump.latest.json
ROLLUP_STATE_DUMP_PATH
:
http://deployer:8081/state-dump.latest.json
# used for getting the addresses
URL
:
http://deployer:8081/addresses.json
# connecting to the DTL
# connecting to the DTL
ROLLUP_CLIENT_HTTP
:
http://dtl:7878
ROLLUP_CLIENT_HTTP
:
http://dtl:7878
ETH1_CTC_DEPLOYMENT_HEIGHT
:
8
ETH1_CTC_DEPLOYMENT_HEIGHT
:
8
RETRIES
:
60
RETRIES
:
60
# no need to keep this secret, only used internally to sign blocks
BLOCK_SIGNER_KEY
:
"
6587ae678cf4fc9a33000cdbf9f35226b71dcc6a4684a31203241f9bcfd55d27"
BLOCK_SIGNER_ADDRESS
:
"
0x00000398232E2064F896018496b4b44b3D62751F"
ports
:
ports
:
-
${L2GETH_HTTP_PORT:-8545}:8545
-
${L2GETH_HTTP_PORT:-8545}:8545
-
${L2GETH_WS_PORT:-8546}:8546
-
${L2GETH_WS_PORT:-8546}:8546
...
@@ -152,7 +156,6 @@ services:
...
@@ -152,7 +156,6 @@ services:
environment
:
environment
:
ETH1_HTTP
:
http://l1_chain:8545
ETH1_HTTP
:
http://l1_chain:8545
ROLLUP_STATE_DUMP_PATH
:
http://deployer:8081/state-dump.latest.json
ROLLUP_STATE_DUMP_PATH
:
http://deployer:8081/state-dump.latest.json
URL
:
http://deployer:8081/addresses.json
ROLLUP_CLIENT_HTTP
:
http://dtl:7878
ROLLUP_CLIENT_HTTP
:
http://dtl:7878
ROLLUP_BACKEND
:
'
l1'
ROLLUP_BACKEND
:
'
l1'
ETH1_CTC_DEPLOYMENT_HEIGHT
:
8
ETH1_CTC_DEPLOYMENT_HEIGHT
:
8
...
@@ -177,7 +180,6 @@ services:
...
@@ -177,7 +180,6 @@ services:
environment
:
environment
:
ETH1_HTTP
:
http://l1_chain:8545
ETH1_HTTP
:
http://l1_chain:8545
ROLLUP_STATE_DUMP_PATH
:
http://deployer:8081/state-dump.latest.json
ROLLUP_STATE_DUMP_PATH
:
http://deployer:8081/state-dump.latest.json
URL
:
http://deployer:8081/addresses.json
ROLLUP_CLIENT_HTTP
:
http://dtl:7878
ROLLUP_CLIENT_HTTP
:
http://dtl:7878
ROLLUP_BACKEND
:
'
l2'
ROLLUP_BACKEND
:
'
l2'
ROLLUP_VERIFIER_ENABLE
:
'
true'
ROLLUP_VERIFIER_ENABLE
:
'
true'
...
...
ops/envs/geth.env
View file @
2fbd8956
...
@@ -4,10 +4,8 @@ ETH1_SYNC_SERVICE_ENABLE=true
...
@@ -4,10 +4,8 @@ ETH1_SYNC_SERVICE_ENABLE=true
ETH1_CONFIRMATION_DEPTH=0
ETH1_CONFIRMATION_DEPTH=0
ROLLUP_CLIENT_HTTP=
ROLLUP_CLIENT_HTTP=
ROLLUP_STATE_DUMP_PATH=
ROLLUP_POLL_INTERVAL_FLAG=500ms
ROLLUP_POLL_INTERVAL_FLAG=500ms
ROLLUP_ENABLE_L2_GAS_POLLING=true
ROLLUP_ENABLE_L2_GAS_POLLING=true
ROLLUP_GAS_PRICE_ORACLE_OWNER_ADDRESS=0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
# ROLLUP_ENFORCE_FEES=
# ROLLUP_ENFORCE_FEES=
ETHERBASE=0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf
ETHERBASE=0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf
...
@@ -27,7 +25,6 @@ WS_ORIGINS=*
...
@@ -27,7 +25,6 @@ WS_ORIGINS=*
CHAIN_ID=420
CHAIN_ID=420
DATADIR=/root/.ethereum
DATADIR=/root/.ethereum
DEV=true
GASPRICE=0
GASPRICE=0
GCMODE=archive
GCMODE=archive
IPC_DISABLE=true
IPC_DISABLE=true
...
...
ops/scripts/deployer.sh
View file @
2fbd8956
...
@@ -37,5 +37,7 @@ fi
...
@@ -37,5 +37,7 @@ fi
# build the dump file
# build the dump file
yarn run build:dump
yarn run build:dump
# serve the addrs and the state dump
# service the addresses and dumps
exec
./bin/serve_dump.sh
cd
./dist/dumps
exec
python
-c
\
'import BaseHTTPServer as bhs, SimpleHTTPServer as shs; bhs.HTTPServer(("0.0.0.0", 8081), shs.SimpleHTTPRequestHandler).serve_forever()'
ops/scripts/geth.sh
View file @
2fbd8956
...
@@ -6,26 +6,17 @@
...
@@ -6,26 +6,17 @@
RETRIES
=
${
RETRIES
:-
40
}
RETRIES
=
${
RETRIES
:-
40
}
VERBOSITY
=
${
VERBOSITY
:-
6
}
VERBOSITY
=
${
VERBOSITY
:-
6
}
if
[[
!
-z
"
$URL
"
]]
;
then
# get the genesis file from the deployer
# get the addrs from the URL provided
curl
\
ADDRESSES
=
$(
curl
--fail
--show-error
--silent
--retry-connrefused
--retry
$RETRIES
--retry-delay
5
$URL
)
--fail
\
--show-error
\
function
envSet
()
{
--silent
\
VAR
=
$1
--retry-connrefused
\
export
$VAR
=
$(
echo
$ADDRESSES
| jq
-r
".
$2
"
)
--retry-all-errors
\
}
--retry
$RETRIES
\
--retry-delay
5
\
# set all the necessary env vars
$ROLLUP_STATE_DUMP_PATH
\
envSet ETH1_ADDRESS_RESOLVER_ADDRESS AddressManager
-o
genesis.json
envSet ETH1_L1_CROSS_DOMAIN_MESSENGER_ADDRESS Proxy__OVM_L1CrossDomainMessenger
envSet ROLLUP_ADDRESS_MANAGER_OWNER_ADDRESS Deployer
# set the address to the proxy gateway if possible
envSet ETH1_L1_STANDARD_BRIDGE_ADDRESS Proxy__OVM_L1StandardBridge
if
[
$ETH1_L1_STANDARD_BRIDGE_ADDRESS
==
null
]
;
then
envSet ETH1_L1_STANDARD_BRIDGE_ADDRESS OVM_L1StandardBridge
fi
fi
# wait for the dtl to be up, else geth will crash if it cannot connect
# wait for the dtl to be up, else geth will crash if it cannot connect
curl
\
curl
\
...
@@ -38,4 +29,25 @@ curl \
...
@@ -38,4 +29,25 @@ curl \
--retry-delay
1
\
--retry-delay
1
\
$ROLLUP_CLIENT_HTTP
$ROLLUP_CLIENT_HTTP
exec
geth
--verbosity
=
"
$VERBOSITY
"
"
$@
"
# import the key that will be used to locally sign blocks
# this key does not have to be kept secret in order to be secure
# we use an insecure password ("pwd") to lock/unlock the password
echo
"Importing private key"
echo
$BLOCK_SIGNER_KEY
>
key.prv
echo
"pwd"
>
password
geth account import
--password
./password ./key.prv
# initialize the geth node with the genesis file
echo
"Initializing Geth node"
geth
--verbosity
=
"
$VERBOSITY
"
"
$@
"
init genesis.json
# start the geth node
echo
"Starting Geth node"
exec
geth
\
--verbosity
=
"
$VERBOSITY
"
\
--password
./password
\
--allow-insecure-unlock
\
--unlock
$BLOCK_SIGNER_ADDRESS
\
--mine
\
--miner
.etherbase
$BLOCK_SIGNER_ADDRESS
\
"
$@
"
packages/contracts/bin/serve_dump.sh
deleted
100755 → 0
View file @
d6cb0e71
#!/bin/bash
# Run this script to serve the latest state dump from
# an http server. This is useful to serve the state dump
# to a local instance of the sequencer/verifier during
# development. The state dump can be found at
# `GET /state-dump.latest.json`
DIR
=
"
$(
cd
"
$(
dirname
"
${
BASH_SOURCE
[0]
}
"
)
"
>
/dev/null
&&
pwd
)
"
PYTHON
=
${
PYTHON
:-
python
}
HOST
=
${
HOST
:-
0
.0.0.0
}
PORT
=
${
PORT
:-
8081
}
DIRECTORY
=
$DIR
/../dist/dumps
if
[
!
command
-v
$PYTHON
&>/dev/null
]
;
then
echo
"Please install python"
exit
1
fi
VERSION
=
$(
$PYTHON
--version
2>&1
\
|
cut
-d
' '
-f2
\
|
sed
-Ee
's#([^/]).([^/]).([^/])#\1#'
)
if
[[
$VERSION
==
3
]]
;
then
$PYTHON
-m
http.server
\
--bind
$HOST
$PORT
\
--directory
$DIRECTORY
else
(
echo
"Serving HTTP on
$HOST
port
$PORT
"
cd
$DIRECTORY
$PYTHON
-c
\
'import BaseHTTPServer as bhs, SimpleHTTPServer as shs; bhs.HTTPServer(("'
$HOST
'", '
"
$PORT
"
'), shs.SimpleHTTPRequestHandler).serve_forever()'
)
fi
packages/contracts/bin/take-dump.ts
View file @
2fbd8956
...
@@ -4,7 +4,7 @@ import * as path from 'path'
...
@@ -4,7 +4,7 @@ import * as path from 'path'
import
*
as
mkdirp
from
'
mkdirp
'
import
*
as
mkdirp
from
'
mkdirp
'
/* Internal Imports */
/* Internal Imports */
import
{
make
StateDump
}
from
'
../src/make-dump
'
import
{
make
L2GenesisFile
}
from
'
../src/make-genesis
'
;(
async
()
=>
{
;(
async
()
=>
{
const
outdir
=
path
.
resolve
(
__dirname
,
'
../dist/dumps
'
)
const
outdir
=
path
.
resolve
(
__dirname
,
'
../dist/dumps
'
)
const
outfile
=
path
.
join
(
outdir
,
'
state-dump.latest.json
'
)
const
outfile
=
path
.
join
(
outdir
,
'
state-dump.latest.json
'
)
...
@@ -17,19 +17,18 @@ import { makeStateDump } from '../src/make-dump'
...
@@ -17,19 +17,18 @@ import { makeStateDump } from '../src/make-dump'
)
)
}
}
const
dump
=
await
makeStateDump
({
const
genesis
=
await
makeL2GenesisFile
({
whitelistConfig
:
{
whitelistOwner
:
process
.
env
.
WHITELIST_OWNER
,
owner
:
process
.
env
.
WHITELIST_OWNER
,
gasPriceOracleOwner
:
process
.
env
.
GAS_PRICE_ORACLE_OWNER
,
},
initialGasPrice
:
0
,
gasPriceOracleConfig
:
{
l2BlockGasLimit
:
parseInt
(
process
.
env
.
L2_BLOCK_GAS_LIMIT
,
10
),
owner
:
process
.
env
.
GAS_PRICE_ORACLE_OWNER
,
l2ChainId
:
parseInt
(
process
.
env
.
L2_CHAIN_ID
,
10
),
initialGasPrice
:
0
,
blockSignerAddress
:
process
.
env
.
BLOCK_SIGNER_ADDRESS
,
},
l1StandardBridgeAddress
:
process
.
env
.
L1_STANDARD_BRIDGE_ADDRESS
,
l1StandardBridgeAddress
:
process
.
env
.
L1_STANDARD_BRIDGE_ADDRESS
,
l1FeeWalletAddress
:
process
.
env
.
L1_FEE_WALLET_ADDRESS
,
l1FeeWalletAddress
:
process
.
env
.
L1_FEE_WALLET_ADDRESS
,
l1CrossDomainMessengerAddress
:
l1CrossDomainMessengerAddress
:
process
.
env
.
L1_CROSS_DOMAIN_MESSENGER_ADDRESS
,
process
.
env
.
L1_CROSS_DOMAIN_MESSENGER_ADDRESS
,
})
})
fs
.
writeFileSync
(
outfile
,
JSON
.
stringify
(
dump
,
null
,
4
))
fs
.
writeFileSync
(
outfile
,
JSON
.
stringify
(
genesis
,
null
,
4
))
})()
})()
packages/contracts/package.json
View file @
2fbd8956
...
@@ -34,7 +34,6 @@
...
@@ -34,7 +34,6 @@
"lint:contracts"
:
"yarn solhint -f table contracts/**/*.sol"
,
"lint:contracts"
:
"yarn solhint -f table contracts/**/*.sol"
,
"clean"
:
"rm -rf ./dist ./artifacts ./cache ./tsconfig.build.tsbuildinfo"
,
"clean"
:
"rm -rf ./dist ./artifacts ./cache ./tsconfig.build.tsbuildinfo"
,
"deploy"
:
"ts-node bin/deploy.ts && yarn autogen:markdown"
,
"deploy"
:
"ts-node bin/deploy.ts && yarn autogen:markdown"
,
"serve"
:
"./bin/serve_dump.sh"
,
"prepublishOnly"
:
"yarn copyfiles -u 1 -e
\"
**/test-*/**/*
\"
\"
contracts/**/*
\"
./"
,
"prepublishOnly"
:
"yarn copyfiles -u 1 -e
\"
**/test-*/**/*
\"
\"
contracts/**/*
\"
./"
,
"postpublish"
:
"rimraf chugsplash L1 L2 libraries"
,
"postpublish"
:
"rimraf chugsplash L1 L2 libraries"
,
"prepack"
:
"yarn prepublishOnly"
,
"prepack"
:
"yarn prepublishOnly"
,
...
...
packages/contracts/src/make-
dump
.ts
→
packages/contracts/src/make-
genesis
.ts
View file @
2fbd8956
/* External Imports */
/* External Imports */
import
{
Signer
}
from
'
ethers
'
import
{
import
{
computeStorageSlots
,
computeStorageSlots
,
getStorageLayout
,
getStorageLayout
,
}
from
'
@defi-wonderland/smock/dist/src/utils
'
}
from
'
@defi-wonderland/smock/dist/src/utils
'
import
{
remove0x
}
from
'
@eth-optimism/core-utils
'
/* Internal Imports */
/* Internal Imports */
import
{
predeploys
}
from
'
./predeploys
'
import
{
predeploys
}
from
'
./predeploys
'
import
{
getContractArtifact
}
from
'
./contract-artifacts
'
import
{
getContractArtifact
}
from
'
./contract-artifacts
'
export
interface
RollupDeployConfig
{
export
interface
RollupDeployConfig
{
whitelistConfig
:
{
// Address that will own the L2 deployer whitelist.
owner
:
string
|
Signer
whitelistOwner
:
string
}
// Address that will own the L2 gas price oracle.
gasPriceOracleConfig
:
{
gasPriceOracleOwner
:
string
owner
:
string
|
Signer
// Initial value for the L2 gas price.
initialGasPrice
:
number
initialGasPrice
:
number
}
// Initial value for the L2 block gas limit.
l2BlockGasLimit
:
number
// Chain ID to give the L2 network.
l2ChainId
:
number
// Address of the key that will sign blocks.
blockSignerAddress
:
string
// Address of the L1StandardBridge contract.
l1StandardBridgeAddress
:
string
l1StandardBridgeAddress
:
string
// Address of the L1 fee wallet.
l1FeeWalletAddress
:
string
l1FeeWalletAddress
:
string
// Address of the L1CrossDomainMessenger contract.
l1CrossDomainMessengerAddress
:
string
l1CrossDomainMessengerAddress
:
string
}
}
...
@@ -28,14 +36,23 @@ export interface RollupDeployConfig {
...
@@ -28,14 +36,23 @@ export interface RollupDeployConfig {
* @param cfg Configuration for the L2 system.
* @param cfg Configuration for the L2 system.
* @returns Generated L2 genesis state.
* @returns Generated L2 genesis state.
*/
*/
export
const
makeStateDump
=
async
(
cfg
:
RollupDeployConfig
):
Promise
<
any
>
=>
{
export
const
makeL2GenesisFile
=
async
(
cfg
:
RollupDeployConfig
):
Promise
<
any
>
=>
{
// Very basic validation.
for
(
const
[
key
,
val
]
of
Object
.
entries
(
cfg
))
{
if
(
val
===
undefined
)
{
throw
new
Error
(
`must provide an input for config value:
${
key
}
`
)
}
}
const
variables
=
{
const
variables
=
{
OVM_DeployerWhitelist
:
{
OVM_DeployerWhitelist
:
{
owner
:
cfg
.
whitelist
Config
.
o
wner
,
owner
:
cfg
.
whitelist
O
wner
,
},
},
OVM_GasPriceOracle
:
{
OVM_GasPriceOracle
:
{
_owner
:
cfg
.
gasPriceOracle
Config
.
o
wner
,
_owner
:
cfg
.
gasPriceOracle
O
wner
,
gasPrice
:
cfg
.
gasPriceOracleConfig
.
initialGasPrice
,
gasPrice
:
cfg
.
initialGasPrice
,
},
},
OVM_L2StandardBridge
:
{
OVM_L2StandardBridge
:
{
l1TokenBridge
:
cfg
.
l1StandardBridgeAddress
,
l1TokenBridge
:
cfg
.
l1StandardBridgeAddress
,
...
@@ -88,5 +105,30 @@ export const makeStateDump = async (cfg: RollupDeployConfig): Promise<any> => {
...
@@ -88,5 +105,30 @@ export const makeStateDump = async (cfg: RollupDeployConfig): Promise<any> => {
}
}
}
}
return
dump
return
{
config
:
{
chainId
:
cfg
.
l2ChainId
,
homesteadBlock
:
0
,
eip150Block
:
0
,
eip155Block
:
0
,
eip158Block
:
0
,
byzantiumBlock
:
0
,
constantinopleBlock
:
0
,
petersburgBlock
:
0
,
istanbulBlock
:
0
,
muirGlacierBlock
:
0
,
clique
:
{
period
:
0
,
epoch
:
30000
,
},
},
difficulty
:
'
1
'
,
gasLimit
:
cfg
.
l2BlockGasLimit
.
toString
(
10
),
extradata
:
'
0x
'
+
'
00
'
.
repeat
(
32
)
+
remove0x
(
cfg
.
blockSignerAddress
)
+
'
00
'
.
repeat
(
65
),
alloc
:
dump
,
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment