Commit 2c32cde9 authored by Mark Tyneway's avatar Mark Tyneway Committed by GitHub

contracts-bedrock: fix genesis builder (#2877)

Updates to foundry/hardhat broke the genesis builder, this fixes them
parent 0c92db90
......@@ -5,7 +5,7 @@ const { env } = process
const startingTimestamp =
typeof env.L2OO_STARTING_BLOCK_TIMESTAMP === 'string'
? ethers.BigNumber.from(env.L2OO_STARTING_BLOCK_TIMESTAMP).toNumber()
: Date.now() / 1000
: Math.floor(Date.now() / 1000)
const config = {
submissionInterval: 6,
......
import fs from 'fs'
import path from 'path'
import assert from 'assert'
import { OptimismGenesis, State } from '@eth-optimism/core-utils'
import '@eth-optimism/hardhat-deploy-config'
import { ethers } from 'ethers'
import { task } from 'hardhat/config'
import { HardhatRuntimeEnvironment } from 'hardhat/types'
......@@ -26,15 +28,20 @@ const assertEvenLength = (str: string) => {
assert(str.length % 2 === 0, str)
}
// TODO: this can be replaced with the smock version after
// a new release of foundry-rs/hardhat
// TODO: fix this to be compatible with smock's version
const getStorageLayout = async (
hre: HardhatRuntimeEnvironment,
name: string
) => {
const buildInfo = await hre.artifacts.getBuildInfo(name)
const key = Object.keys(buildInfo.output.contracts)[0]
return (buildInfo.output.contracts[key][name] as any).storageLayout
const keys = Object.keys(buildInfo.output.contracts)
for (const key of keys) {
if (name === path.basename(key, '.sol')) {
const contract = buildInfo.output.contracts[key]
return (contract[name] as any).storageLayout
}
}
throw new Error(`Cannot locate storageLayout for ${name}`)
}
task('genesis-l2', 'create a genesis config')
......
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