Skip to content
This repository has been archived by the owner on Dec 5, 2021. It is now read-only.

Add regenesis #237

Open
wants to merge 27 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
62e72c5
Add regenesis
boyuan-chen Jul 27, 2021
9e64856
Merge branch 'develop' into add-regenesis
CAPtheorem Jul 28, 2021
ec3e1ae
Merge branch 'develop' into add-regenesis
CAPtheorem Jul 28, 2021
83340fd
Merge branch 'develop' into add-regenesis
CAPtheorem Jul 30, 2021
353b4c1
Add L1MessengerRegenesis contract
boyuan-chen Jul 30, 2021
bbd746f
In progress
boyuan-chen Jul 31, 2021
e90dcf9
Merge branch 'develop' into add-regenesis
CAPtheorem Aug 1, 2021
301c298
Merge branch 'develop' into add-regenesis
CAPtheorem Aug 1, 2021
65531fb
Merge branch 'develop' into add-regenesis
boyuan-chen Aug 2, 2021
28fdce1
Add regenesis
boyuan-chen Aug 2, 2021
1f6a6c8
Add message relayer regenesis
boyuan-chen Aug 2, 2021
9b0c8d0
Update package.json
boyuan-chen Aug 2, 2021
3c4b3ac
Update package.json
boyuan-chen Aug 2, 2021
9752d3c
Update README.md
boyuan-chen Aug 2, 2021
4e931fb
Update README.md
boyuan-chen Aug 3, 2021
33fcaa1
Remove OVM_L1CrossDomainMessenger
boyuan-chen Aug 3, 2021
34d9982
Merge branch 'develop' into add-regenesis
CAPtheorem Aug 5, 2021
05cd647
Fix regenesis contract
boyuan-chen Aug 5, 2021
baf9559
Merge branch 'develop' into add-regenesis
CAPtheorem Aug 5, 2021
cb66f83
regenesis v2
boyuan-chen Aug 5, 2021
41713ba
Finish Regenesis
boyuan-chen Aug 6, 2021
f0246d1
Merge branch 'develop' into add-regenesis
CAPtheorem Aug 9, 2021
217f5f8
Merge branch 'develop' into add-regenesis
CAPtheorem Aug 11, 2021
0239748
Merge branch 'develop' into add-regenesis
boyuan-chen Aug 25, 2021
9497c82
Add integration regenesis
boyuan-chen Aug 25, 2021
7c07797
Merge branch 'add-regenesis' of https://github.com/omgnetwork/optimis…
boyuan-chen Aug 25, 2021
198cb28
Merge branch 'develop' into add-regenesis
CAPtheorem Sep 12, 2021
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
28 changes: 12 additions & 16 deletions omgx_documention/Service_maintenance.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ We open the following the ports:
>
> `omgx/l2geth`: it's the most important service, so we should give as much memory as we can.
>
> `omgx/message-relayer-fast` and `omgx/message-relayer` : both message relayers can stop due the OOM issue. Giving it **4GB** memory can reduce the number of times that it needs to restart.
> `omgx/message-relayer-fast` and `omgx/message-relayer` : both message relayers can stop due the OOM issue. Giving it **4GB** memory can reduce the number of times that it needs to restart.
>
> [**IMPORTANT**] When `omgx/message-relayer-fast` and `omgx/message-relayer` restart, they scans all L2 blocks and check if there is a cross domain message and if the message is relayed to L1. It takes about 5 mins to sync 4K L2 blocks.

Expand Down Expand Up @@ -144,22 +144,18 @@ type Genesis struct {
}
```

### Bypass `GasPriceOracleOwnerAddress`
### Make regenesis

Modify `l2GasPriceOracleAddress` in [rollup/sync_service.go](https://github.com/omgnetwork/optimism/blob/9e07036f61a02ffb23eff405c3274f5f24950ad5/l2geth/rollup/sync_service.go#L49).
Download the l2geth data from the server first, then get the state dump via

```go
var (
// l2GasPriceSlot refers to the storage slot that the L2 gas price is stored
// in in the OVM_GasPriceOracle predeploy
l2GasPriceSlot = common.BigToHash(big.NewInt(1))
// l2GasPriceOracleOwnerSlot refers to the storage slot that the owner of
// the OVM_GasPriceOracle is stored in
l2GasPriceOracleOwnerSlot = common.BigToHash(big.NewInt(0))
// l2GasPriceOracleAddress is the address of the OVM_GasPriceOracle
// predeploy
// l2GasPriceOracleAddress = common.HexToAddress("0x420000000000000000000000000000000000000F")
l2GasPriceOracleAddress = common.HexToAddress("OVM_GasPriceOracleAddress")
)
```
geth dump LATEST_BLOCK_NUMBER --datadir DIR > state-dump.genesis.json
```

Move `state-dump.genesis.json` to `packages/contracts/dist/dump` and run

```
yarn build:dump
yarn build:regenesis
```

11 changes: 7 additions & 4 deletions packages/contracts/bin/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@ import { Wallet } from 'ethers'
import path from 'path'
import dirtree from 'directory-tree'
import fs from 'fs'
import * as dotenv from 'dotenv'

dotenv.config()

// Ensures that all relevant environment vars are properly set. These lines *must* come before the
// hardhat import because importing will load the config (which relies on these vars). Necessary
// because CI currently uses different var names than the ones we've chosen here.
// TODO: Update CI so that we don't have to do this anymore.
process.env.HARDHAT_NETWORK = 'custom' // "custom" here is an arbitrary name. only used for CI.
process.env.CONTRACTS_TARGET_NETWORK = 'custom'
process.env.HARDHAT_NETWORK = 'rinkeby-integration' // "custom" here is an arbitrary name. only used for CI.
process.env.CONTRACTS_TARGET_NETWORK = 'rinkeby-integration'
process.env.CONTRACTS_DEPLOYER_KEY = process.env.DEPLOYER_PRIVATE_KEY
process.env.CONTRACTS_RPC_URL =
process.env.L1_NODE_WEB3_URL || 'http://127.0.0.1:8545'
Expand Down Expand Up @@ -81,7 +84,7 @@ const main = async () => {
}

const contracts: any = dirtree(
path.resolve(__dirname, `../deployments/custom`)
path.resolve(__dirname, `../deployments/rinkeby-integration`)
)
.children.filter((child) => {
return child.extension === '.json'
Expand All @@ -91,7 +94,7 @@ const main = async () => {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const artifact = require(path.resolve(
__dirname,
`../deployments/custom/${child.name}`
`../deployments/rinkeby-integration/${child.name}`
))
contractsAccumulator[nicknames[contractName] || contractName] =
artifact.address
Expand Down
17 changes: 17 additions & 0 deletions packages/contracts/bin/take-regenesis.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/* External Imports */
import * as fs from 'fs'
import * as path from 'path'

/* Internal Imports */
import { makeRegenesisDump } from '../src/regenesis/make-regenesis'
;(async () => {
const outdir = path.resolve(__dirname, '../dist/dumps')
const stateDumpLatestDir = path.join(outdir, 'state-dump.latest.json')
const stateDumpGenesisDir = path.join(outdir, 'state-dump.genesis.json')

const stateDumpLatest = JSON.parse(fs.readFileSync(stateDumpLatestDir, 'utf-8'))
const stateDumpGenesis = JSON.parse(fs.readFileSync(stateDumpGenesisDir, 'utf-8'))

const dump = makeRegenesisDump(stateDumpLatest, stateDumpGenesis)
fs.writeFileSync(stateDumpLatestDir, JSON.stringify(dump, null, 4))
})()

This file was deleted.

106 changes: 0 additions & 106 deletions packages/contracts/deploy/015-Proxy__OVM_L1StandardBridge.deploy.ts

This file was deleted.

64 changes: 0 additions & 64 deletions packages/contracts/deploy/018-fund-accounts.ts

This file was deleted.

Loading