Commit 5e5d4a18 authored by smartcontracts's avatar smartcontracts Committed by GitHub

fix: separate logic for making and retrieving state dumps into two files (#869)

* fix: separate get-dump and make-dump files

* chore: sadd changeset
Co-authored-by: default avatarGeorgios Konstantopoulos <me@gakonst.com>
parent 39586441
---
'@eth-optimism/contracts': patch
---
Separates logic for getting state dumps and making state dumps so we can bundle for browser
...@@ -7,7 +7,7 @@ const env = process.env ...@@ -7,7 +7,7 @@ const env = process.env
const CHAIN_ID = env.CHAIN_ID || '420' const CHAIN_ID = env.CHAIN_ID || '420'
/* Internal Imports */ /* Internal Imports */
import { makeStateDump } from '../src/contract-dumps' import { makeStateDump } from '../src/state-dump/make-dump'
import { RollupDeployConfig } from '../src/contract-deployment' import { RollupDeployConfig } from '../src/contract-deployment'
;(async () => { ;(async () => {
const outdir = path.resolve(__dirname, '../dist/dumps') const outdir = path.resolve(__dirname, '../dist/dumps')
......
export * from './contract-defs' export * from './contract-defs'
export { getLatestStateDump, StateDump } from './contract-dumps' export * from './state-dump/get-dump'
export * from './contract-deployment' export * from './contract-deployment'
export * from './predeploys' export * from './predeploys'
/* External Imports */
import * as path from 'path'
export interface StorageDump {
[key: string]: string
}
export interface StateDump {
accounts: {
[name: string]: {
address: string
code: string
codeHash: string
storage: StorageDump
abi: any
}
}
}
export const getLatestStateDump = (): StateDump => {
return require(path.join(__dirname, '../dumps', `state-dump.latest.json`))
}
/* External Imports */ /* External Imports */
import * as path from 'path'
import { ethers } from 'ethers' import { ethers } from 'ethers'
import * as Ganache from 'ganache-core' import * as Ganache from 'ganache-core'
import { keccak256 } from 'ethers/lib/utils' import { keccak256 } from 'ethers/lib/utils'
import { fromHexString, toHexString, remove0x } from '@eth-optimism/core-utils' import { fromHexString, toHexString, remove0x } from '@eth-optimism/core-utils'
/* Internal Imports */ /* Internal Imports */
import { deploy, RollupDeployConfig } from './contract-deployment' import { StorageDump, StateDump } from './get-dump'
import { getContractDefinition } from './contract-defs' import { deploy, RollupDeployConfig } from '../contract-deployment'
import { predeploys } from './predeploys' import { getContractDefinition } from '../contract-defs'
import { predeploys } from '../predeploys'
interface StorageDump {
[key: string]: string
}
export interface StateDump {
accounts: {
[name: string]: {
address: string
code: string
codeHash: string
storage: StorageDump
abi: any
}
}
}
/** /**
* Generates a storage dump for a given address. * Generates a storage dump for a given address.
...@@ -253,7 +237,3 @@ export const makeStateDump = async (cfg: RollupDeployConfig): Promise<any> => { ...@@ -253,7 +237,3 @@ export const makeStateDump = async (cfg: RollupDeployConfig): Promise<any> => {
return dump return dump
} }
export const getLatestStateDump = (): StateDump => {
return require(path.join(__dirname, '../dumps', `state-dump.latest.json`))
}
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