Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
e87ad76d
Unverified
Commit
e87ad76d
authored
Jun 09, 2023
by
Mark Tyneway
Committed by
GitHub
Jun 09, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5711 from ethereum-optimism/fix/deploy-ts-checks-gaslimit
contracts-bedrock: deploy time checks
parents
32294e20
080a72cb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
57 additions
and
29 deletions
+57
-29
017-SystemConfigImpl.ts
packages/contracts-bedrock/deploy/017-SystemConfigImpl.ts
+41
-18
019-SystemDictatorInit.ts
packages/contracts-bedrock/deploy/019-SystemDictatorInit.ts
+3
-11
constants.ts
packages/contracts-bedrock/src/constants.ts
+13
-0
No files found.
packages/contracts-bedrock/deploy/017-SystemConfigImpl.ts
View file @
e87ad76d
...
@@ -2,17 +2,29 @@ import assert from 'assert'
...
@@ -2,17 +2,29 @@ import assert from 'assert'
import
{
DeployFunction
}
from
'
hardhat-deploy/dist/types
'
import
{
DeployFunction
}
from
'
hardhat-deploy/dist/types
'
import
'
@eth-optimism/hardhat-deploy-config
'
import
'
@eth-optimism/hardhat-deploy-config
'
import
{
ethers
}
from
'
ethers
'
import
{
BigNumber
}
from
'
ethers
'
import
{
defaultResourceConfig
}
from
'
../src/constants
'
import
{
assertContractVariable
,
deploy
}
from
'
../src/deploy-utils
'
import
{
assertContractVariable
,
deploy
}
from
'
../src/deploy-utils
'
const
uint128Max
=
ethers
.
BigNumber
.
from
(
'
0xffffffffffffffffffffffffffffffff
'
)
const
deployFn
:
DeployFunction
=
async
(
hre
)
=>
{
const
deployFn
:
DeployFunction
=
async
(
hre
)
=>
{
const
batcherHash
=
hre
.
ethers
.
utils
const
batcherHash
=
hre
.
ethers
.
utils
.
hexZeroPad
(
hre
.
deployConfig
.
batchSenderAddress
,
32
)
.
hexZeroPad
(
hre
.
deployConfig
.
batchSenderAddress
,
32
)
.
toLowerCase
()
.
toLowerCase
()
const
l2GenesisBlockGasLimit
=
BigNumber
.
from
(
hre
.
deployConfig
.
l2GenesisBlockGasLimit
)
const
l2GasLimitLowerBound
=
BigNumber
.
from
(
defaultResourceConfig
.
systemTxMaxGas
+
defaultResourceConfig
.
maxResourceLimit
)
if
(
l2GenesisBlockGasLimit
.
lt
(
l2GasLimitLowerBound
))
{
throw
new
Error
(
`L2 genesis block gas limit must be at least
${
l2GasLimitLowerBound
}
`
)
}
await
deploy
({
await
deploy
({
hre
,
hre
,
name
:
'
SystemConfig
'
,
name
:
'
SystemConfig
'
,
...
@@ -21,16 +33,9 @@ const deployFn: DeployFunction = async (hre) => {
...
@@ -21,16 +33,9 @@ const deployFn: DeployFunction = async (hre) => {
hre
.
deployConfig
.
gasPriceOracleOverhead
,
hre
.
deployConfig
.
gasPriceOracleOverhead
,
hre
.
deployConfig
.
gasPriceOracleScalar
,
hre
.
deployConfig
.
gasPriceOracleScalar
,
batcherHash
,
batcherHash
,
hre
.
deployConfig
.
l2GenesisBlockGasLimit
,
l2GenesisBlockGasLimit
,
hre
.
deployConfig
.
p2pSequencerAddress
,
hre
.
deployConfig
.
p2pSequencerAddress
,
{
defaultResourceConfig
,
maxResourceLimit
:
20
_000_000
,
elasticityMultiplier
:
10
,
baseFeeMaxChangeDenominator
:
8
,
systemTxMaxGas
:
1
_000_000
,
minimumBaseFee
:
ethers
.
utils
.
parseUnits
(
'
1
'
,
'
gwei
'
),
maximumBaseFee
:
uint128Max
,
},
],
],
postDeployAction
:
async
(
contract
)
=>
{
postDeployAction
:
async
(
contract
)
=>
{
await
assertContractVariable
(
await
assertContractVariable
(
...
@@ -56,12 +61,30 @@ const deployFn: DeployFunction = async (hre) => {
...
@@ -56,12 +61,30 @@ const deployFn: DeployFunction = async (hre) => {
)
)
const
config
=
await
contract
.
resourceConfig
()
const
config
=
await
contract
.
resourceConfig
()
assert
(
config
.
maxResourceLimit
===
20
_000_000
)
assert
(
config
.
maxResourceLimit
===
defaultResourceConfig
.
maxResourceLimit
)
assert
(
config
.
elasticityMultiplier
===
10
)
assert
(
assert
(
config
.
baseFeeMaxChangeDenominator
===
8
)
config
.
elasticityMultiplier
===
assert
(
config
.
systemTxMaxGas
===
1
_000_000
)
defaultResourceConfig
.
elasticityMultiplier
assert
(
ethers
.
utils
.
parseUnits
(
'
1
'
,
'
gwei
'
).
eq
(
config
.
minimumBaseFee
))
)
assert
(
config
.
maximumBaseFee
.
eq
(
uint128Max
))
assert
(
config
.
baseFeeMaxChangeDenominator
===
defaultResourceConfig
.
baseFeeMaxChangeDenominator
)
assert
(
BigNumber
.
from
(
config
.
systemTxMaxGas
).
eq
(
defaultResourceConfig
.
systemTxMaxGas
)
)
assert
(
BigNumber
.
from
(
config
.
minimumBaseFee
).
eq
(
defaultResourceConfig
.
minimumBaseFee
)
)
assert
(
BigNumber
.
from
(
config
.
maximumBaseFee
).
eq
(
defaultResourceConfig
.
maximumBaseFee
)
)
},
},
})
})
}
}
...
...
packages/contracts-bedrock/deploy/019-SystemDictatorInit.ts
View file @
e87ad76d
import
assert
from
'
assert
'
import
assert
from
'
assert
'
import
{
ethers
,
BigNumber
}
from
'
ethers
'
import
{
ethers
}
from
'
ethers
'
import
{
DeployFunction
}
from
'
hardhat-deploy/dist/types
'
import
{
DeployFunction
}
from
'
hardhat-deploy/dist/types
'
import
{
awaitCondition
}
from
'
@eth-optimism/core-utils
'
import
{
awaitCondition
}
from
'
@eth-optimism/core-utils
'
import
'
@eth-optimism/hardhat-deploy-config
'
import
'
@eth-optimism/hardhat-deploy-config
'
...
@@ -10,6 +10,7 @@ import {
...
@@ -10,6 +10,7 @@ import {
getContractsFromArtifacts
,
getContractsFromArtifacts
,
getDeploymentAddress
,
getDeploymentAddress
,
}
from
'
../src/deploy-utils
'
}
from
'
../src/deploy-utils
'
import
{
defaultResourceConfig
}
from
'
../src/constants
'
const
deployFn
:
DeployFunction
=
async
(
hre
)
=>
{
const
deployFn
:
DeployFunction
=
async
(
hre
)
=>
{
const
{
deployer
}
=
await
hre
.
getNamedAccounts
()
const
{
deployer
}
=
await
hre
.
getNamedAccounts
()
...
@@ -102,16 +103,7 @@ const deployFn: DeployFunction = async (hre) => {
...
@@ -102,16 +103,7 @@ const deployFn: DeployFunction = async (hre) => {
unsafeBlockSigner
:
hre
.
deployConfig
.
p2pSequencerAddress
,
unsafeBlockSigner
:
hre
.
deployConfig
.
p2pSequencerAddress
,
// The resource config is not exposed to the end user
// The resource config is not exposed to the end user
// to simplify deploy config. It may be introduced in the future.
// to simplify deploy config. It may be introduced in the future.
resourceConfig
:
{
resourceConfig
:
defaultResourceConfig
,
maxResourceLimit
:
20
_000_000
,
elasticityMultiplier
:
10
,
baseFeeMaxChangeDenominator
:
8
,
minimumBaseFee
:
ethers
.
utils
.
parseUnits
(
'
1
'
,
'
gwei
'
),
systemTxMaxGas
:
1
_000_000
,
maximumBaseFee
:
BigNumber
.
from
(
'
0xffffffffffffffffffffffffffffffff
'
).
toString
(),
},
},
},
}
}
...
...
packages/contracts-bedrock/src/constants.ts
View file @
e87ad76d
import
{
ethers
}
from
'
ethers
'
/**
/**
* Predeploys are Solidity contracts that are injected into the initial L2 state and provide
* Predeploys are Solidity contracts that are injected into the initial L2 state and provide
* various useful functions.
* various useful functions.
...
@@ -26,3 +28,14 @@ export const predeploys = {
...
@@ -26,3 +28,14 @@ export const predeploys = {
BaseFeeVault
:
'
0x4200000000000000000000000000000000000019
'
,
BaseFeeVault
:
'
0x4200000000000000000000000000000000000019
'
,
L1FeeVault
:
'
0x420000000000000000000000000000000000001a
'
,
L1FeeVault
:
'
0x420000000000000000000000000000000000001a
'
,
}
}
const
uint128Max
=
ethers
.
BigNumber
.
from
(
'
0xffffffffffffffffffffffffffffffff
'
)
export
const
defaultResourceConfig
=
{
maxResourceLimit
:
20
_000_000
,
elasticityMultiplier
:
10
,
baseFeeMaxChangeDenominator
:
8
,
minimumBaseFee
:
ethers
.
utils
.
parseUnits
(
'
1
'
,
'
gwei
'
),
systemTxMaxGas
:
1
_000_000
,
maximumBaseFee
:
uint128Max
,
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment