Commit 0cb732b1 authored by Mark Tyneway's avatar Mark Tyneway Committed by GitHub

state dump: allow for config (#164)

* state dump: allow for config

* lint: fix

* add build:kovan command
Co-authored-by: default avatarKevin Ho <kevinjho1996@gmail.com>
parent d34a12fb
......@@ -3,13 +3,25 @@ import * as fs from 'fs'
import * as path from 'path'
import * as mkdirp from 'mkdirp'
const env = process.env
const CHAIN_ID = env.CHAIN_ID || '420'
/* Internal Imports */
import { makeStateDump } from '../src/contract-dumps'
import { RollupDeployConfig } from '../src/contract-deployment'
;(async () => {
const outdir = path.resolve(__dirname, '../build/dumps')
const outfile = path.join(outdir, 'state-dump.latest.json')
mkdirp.sync(outdir)
const dump = await makeStateDump()
const config = {
ovmGlobalContext: {
ovmCHAINID: parseInt(CHAIN_ID, 10),
},
}
const dump = await makeStateDump(config as RollupDeployConfig)
fs.writeFileSync(outfile, JSON.stringify(dump, null, 4))
})()
......@@ -12,6 +12,7 @@
"scripts": {
"all": "yarn clean && yarn build && yarn test && yarn lint:fix && yarn lint",
"build": "yarn run build:contracts && yarn run build:typescript && yarn run build:copy && yarn run build:dump && yarn run build:typechain",
"build:kovan": "yarn run build:contracts && yarn run build:typescript && yarn run build:copy && CHAIN_ID=69 yarn run build:dump && yarn run build:typechain",
"build:typescript": "tsc -p tsconfig.prod.json",
"build:contracts": "buidler compile --show-stack-traces",
"build:dump": "ts-node \"bin/take-dump.ts\"",
......
......@@ -94,7 +94,7 @@ const sanitizeStorageDump = (
return storageDump
}
export const makeStateDump = async (): Promise<any> => {
export const makeStateDump = async (cfg: RollupDeployConfig): Promise<any> => {
const ganache = (Ganache as any).provider({
gasLimit: 100_000_000,
allowUnlimitedContractSize: true,
......@@ -110,7 +110,7 @@ export const makeStateDump = async (): Promise<any> => {
const provider = new ethers.providers.Web3Provider(ganache)
const signer = provider.getSigner(0)
const config: RollupDeployConfig = {
let config: RollupDeployConfig = {
deploymentSigner: signer,
ovmGasMeteringConfig: {
minTransactionGasLimit: 0,
......@@ -158,6 +158,8 @@ export const makeStateDump = async (): Promise<any> => {
],
}
config = { ...config, ...cfg }
const precompiles = {
OVM_L2ToL1MessagePasser: '0x4200000000000000000000000000000000000000',
OVM_L1MessageSender: '0x4200000000000000000000000000000000000001',
......
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