Commit 93e2f750 authored by Maurelian's avatar Maurelian Committed by GitHub

fix(bedrock): arguments in L2OO deploy scripts (#2830)

* fix(bedrock): arguments in L2OO deploy scripts

* chore: changeset
parent a6f3be0b
---
'@eth-optimism/contracts-bedrock': patch
---
Fix for incorrect constructor args in deploy config
...@@ -2,11 +2,12 @@ import { ethers } from 'ethers' ...@@ -2,11 +2,12 @@ import { ethers } from 'ethers'
const config = { const config = {
submissionInterval: 6, submissionInterval: 6,
l2BlockTime: 2,
genesisOutput: ethers.constants.HashZero, genesisOutput: ethers.constants.HashZero,
historicalBlocks: 0, historicalBlocks: 0,
startingBlockTimestamp: startingBlockNumber: 0,
startingTimestamp:
parseInt(process.env.L2OO_STARTING_BLOCK_TIMESTAMP, 10) || Date.now(), parseInt(process.env.L2OO_STARTING_BLOCK_TIMESTAMP, 10) || Date.now(),
l2BlockTime: 2,
sequencerAddress: '0x70997970C51812dc3A010C7d01b50e0d17dc79C8', sequencerAddress: '0x70997970C51812dc3A010C7d01b50e0d17dc79C8',
} }
......
...@@ -2,11 +2,12 @@ import { ethers } from 'ethers' ...@@ -2,11 +2,12 @@ import { ethers } from 'ethers'
const config = { const config = {
submissionInterval: 6, submissionInterval: 6,
l2BlockTime: 2,
genesisOutput: ethers.constants.HashZero, genesisOutput: ethers.constants.HashZero,
historicalBlocks: 0, historicalBlocks: 0,
startingBlockTimestamp: startingBlockNumber: 0,
startingTimestamp:
parseInt(process.env.L2OO_STARTING_BLOCK_TIMESTAMP, 10) || Date.now(), parseInt(process.env.L2OO_STARTING_BLOCK_TIMESTAMP, 10) || Date.now(),
l2BlockTime: 2,
sequencerAddress: '0x70997970C51812dc3A010C7d01b50e0d17dc79C8', sequencerAddress: '0x70997970C51812dc3A010C7d01b50e0d17dc79C8',
} }
......
...@@ -7,11 +7,11 @@ const deployFn: DeployFunction = async (hre) => { ...@@ -7,11 +7,11 @@ const deployFn: DeployFunction = async (hre) => {
const { deployer } = await hre.getNamedAccounts() const { deployer } = await hre.getNamedAccounts()
if ( if (
typeof hre.deployConfig.startingBlockTimestamp !== 'number' || typeof hre.deployConfig.startingTimestamp !== 'number' ||
isNaN(hre.deployConfig.startingBlockTimestamp) isNaN(hre.deployConfig.startingTimestamp)
) { ) {
throw new Error( throw new Error(
'Cannot deploy L2OutputOracle without specifying a valid startingBlockTimestamp.' 'Cannot deploy L2OutputOracle without specifying a valid startingTimestamp.'
) )
} }
...@@ -22,7 +22,8 @@ const deployFn: DeployFunction = async (hre) => { ...@@ -22,7 +22,8 @@ const deployFn: DeployFunction = async (hre) => {
hre.deployConfig.l2BlockTime, hre.deployConfig.l2BlockTime,
hre.deployConfig.genesisOutput, hre.deployConfig.genesisOutput,
hre.deployConfig.historicalBlocks, hre.deployConfig.historicalBlocks,
hre.deployConfig.startingBlockTimestamp, hre.deployConfig.startingBlockNumber,
hre.deployConfig.startingTimestamp,
hre.deployConfig.sequencerAddress, hre.deployConfig.sequencerAddress,
], ],
log: true, log: true,
......
...@@ -71,7 +71,10 @@ const config: HardhatUserConfig = { ...@@ -71,7 +71,10 @@ const config: HardhatUserConfig = {
historicalBlocks: { historicalBlocks: {
type: 'number', type: 'number',
}, },
startingBlockTimestamp: { startingBlockNumber: {
type: 'number',
},
startingTimestamp: {
type: 'number', type: 'number',
}, },
sequencerAddress: { sequencerAddress: {
......
...@@ -33,8 +33,8 @@ const getTargetOutput = async ( ...@@ -33,8 +33,8 @@ const getTargetOutput = async (
withdrawalTimestamp: number withdrawalTimestamp: number
) => { ) => {
const submissionInterval = (await oracle.SUBMISSION_INTERVAL()).toNumber() const submissionInterval = (await oracle.SUBMISSION_INTERVAL()).toNumber()
const startingBlockTimestamp = ( const startingTimestamp = (
await oracle.STARTING_BLOCK_TIMESTAMP() await oracle.STARTING_TIMESTAMP()
).toNumber() ).toNumber()
const nextTimestamp = (await oracle.nextTimestamp()).toNumber() const nextTimestamp = (await oracle.nextTimestamp()).toNumber()
let targetOutputTimestamp let targetOutputTimestamp
...@@ -45,10 +45,10 @@ const getTargetOutput = async ( ...@@ -45,10 +45,10 @@ const getTargetOutput = async (
// Calculate the first timestamp greater than the burnBlock which will be appended. // Calculate the first timestamp greater than the burnBlock which will be appended.
targetOutputTimestamp = targetOutputTimestamp =
Math.ceil( Math.ceil(
(withdrawalTimestamp - startingBlockTimestamp) / submissionInterval (withdrawalTimestamp - startingTimestamp) / submissionInterval
) * ) *
submissionInterval + submissionInterval +
startingBlockTimestamp startingTimestamp
} }
return targetOutputTimestamp return targetOutputTimestamp
......
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