Commit ef2fd41a authored by mergify[bot]'s avatar mergify[bot] Committed by GitHub

Merge branch 'develop' into fix/yarnlock

parents b0e052fc 24ec5fef
# Legacy codebases # Legacy codebases
/batch-submitter @mslipper @tynes /batch-submitter @ethereum-optimism/legacy-reviewers
/bss-core @mslipper @tynes /bss-core @ethereum-optimism/legacy-reviewers
/gas-oracle @tynes @smartcontracts /gas-oracle @ethereum-optimism/legacy-reviewers
/integration-tests @mslipper @tynes /integration-tests @ethereum-optimism/legacy-reviewers
/l2geth @tynes @smartcontracts /l2geth @ethereum-optimism/legacy-reviewers
/l2geth-exporter @tynes @smartcontracts /l2geth-exporter @ethereum-optimism/legacy-reviewers
/packages/actor-tests @mslipper /packages/actor-tests @ethereum-optimism/legacy-reviewers
/packages/common-ts @tynes @smartcontracts /packages/common-ts @ethereum-optimism/typescript-reviewers
/packages/contracts @tynes @smartcontracts @maurelian /packages/contracts @ethereum-optimism/contract-reviewers
/packages/contracts-bedrock @tynes @smartcontracts @maurelian /packages/contracts-bedrock @ethereum-optimism/contract-reviewers
/packages/contracts-periphery @tynes @smartcontracts @maurelian /packages/contracts-periphery @ethereum-optimism/contract-reviewers
/packages/core-utils @tynes @smartcontracts /packages/core-utils @ethereum-optimism/legacy-reviewers
/packages/data-transport-layer @tynes @smartcontracts /packages/data-transport-layer @ethereum-optimism/legacy-reviewers
/packages/drippie-mon @smartcontracts /packages/drippie-mon @smartcontracts
/packages/fault-detector @tynes @smartcontracts /packages/fault-detector @ethereum-optimism/legacy-reviewers
/packages/hardhat-deploy-config @tynes @smartcontracts @maurelian /packages/hardhat-deploy-config @ethereum-optimism/legacy-reviewers
/packages/message-relayer @tynes @smartcontracts /packages/message-relayer @ethereum-optimism/legacy-reviewers
/packages/migration-data @tynes @smartcontracts @mslipper /packages/migration-data @ethereum-optimism/legacy-reviewers
/packages/replica-healthcheck @tynes @smartcontracts @mslipper /packages/replica-healthcheck @ethereum-optimism/legacy-reviewers
/packages/sdk @smartcontracts @roninjin10 @nickbalestra /packages/sdk @ethereum-optimism/ecopod
# Bedrock codebases # Bedrock codebases
/bedrock-devnet @mslipper /bedrock-devnet @ethereum-optimism/go-reviewers
/op-batcher @protolambda @trianglesphere /op-batcher @ethereum-optimism/go-reviewers
/op-chain-ops @protolambda @trianglesphere @tynes @mslipper /op-chain-ops @ethereum-optimism/go-reviewers
/op-e2e @protolambda @trianglesphere @tynes @mslipper /op-e2e @ethereum-optimism/go-reviewers
/op-node @protolambda @trianglesphere /op-node @ethereum-optimism/go-reviewers
/op-proposer @protolambda @trianglesphere /op-proposer @ethereum-optimism/go-reviewers
/op-service @protolambda @trianglesphere @mslipper /op-service @ethereum-optimism/go-reviewers
# Ops # Ops
/.circleci @mslipper @zhwrd @trianglesphere /.circleci @ethereum-optimism/infra-reviewers
/.github @mslipper @zhwrd /.github @ethereum-optimism/infra-reviewers
/ops @mslipper @zhwrd /ops @ethereum-optimism/infra-reviewers
/ops-bedrock @mslipper @zhwrd /ops-bedrock @ethereum-optimism/infra-reviewers
# Misc # Misc
/proxyd @mslipper @Inphi @tynes /proxyd @ethereum-optimism/infra-reviewers
/indexer @mslipper @nickbalestra @roninjin10 /indexer @ethereum-optimism/infra-reviewers
/infra @mslipper @zhwrd /infra @ethereum-optimism/infra-reviewers
/specs @trianglesphere @tynes @protolambda @smartcontracts @maurelian /specs @ethereum-optimism/contract-reviewers @ethereum-optimism/go-reviewers
/endpoint-monitor @zhwrd /endpoint-monitor @ethereum-optimism/infra-reviewers
import assert from 'assert' import assert from 'assert'
import { task } from 'hardhat/config' import { task, types } from 'hardhat/config'
import '@nomiclabs/hardhat-ethers' import '@nomiclabs/hardhat-ethers'
import 'hardhat-deploy' import 'hardhat-deploy'
import { HardhatRuntimeEnvironment } from 'hardhat/types' import { HardhatRuntimeEnvironment } from 'hardhat/types'
import { Contract } from 'ethers' import { Contract, providers, Wallet, Signer } from 'ethers'
import { predeploys } from '../src' import { predeploys } from '../src'
...@@ -28,7 +28,10 @@ const yell = (msg: string) => { ...@@ -28,7 +28,10 @@ const yell = (msg: string) => {
} }
// checkPredeploys will ensure that all of the predeploys are set // checkPredeploys will ensure that all of the predeploys are set
const checkPredeploys = async (hre: HardhatRuntimeEnvironment) => { const checkPredeploys = async (
hre: HardhatRuntimeEnvironment,
provider: providers.Provider
) => {
console.log('Checking predeploys are configured correctly') console.log('Checking predeploys are configured correctly')
for (let i = 0; i < 2048; i++) { for (let i = 0; i < 2048; i++) {
const num = hre.ethers.utils.hexZeroPad('0x' + i.toString(16), 2) const num = hre.ethers.utils.hexZeroPad('0x' + i.toString(16), 2)
...@@ -36,7 +39,7 @@ const checkPredeploys = async (hre: HardhatRuntimeEnvironment) => { ...@@ -36,7 +39,7 @@ const checkPredeploys = async (hre: HardhatRuntimeEnvironment) => {
hre.ethers.utils.hexConcat([prefix, num]) hre.ethers.utils.hexConcat([prefix, num])
) )
const code = await hre.ethers.provider.getCode(addr) const code = await provider.getCode(addr)
if (code === '0x') { if (code === '0x') {
throw new Error(`no code found at ${addr}`) throw new Error(`no code found at ${addr}`)
} }
...@@ -49,7 +52,7 @@ const checkPredeploys = async (hre: HardhatRuntimeEnvironment) => { ...@@ -49,7 +52,7 @@ const checkPredeploys = async (hre: HardhatRuntimeEnvironment) => {
continue continue
} }
const slot = await hre.ethers.provider.getStorageAt(addr, adminSlot) const slot = await provider.getStorageAt(addr, adminSlot)
const admin = hre.ethers.utils.hexConcat([ const admin = hre.ethers.utils.hexConcat([
'0x000000000000000000000000', '0x000000000000000000000000',
predeploys.ProxyAdmin, predeploys.ProxyAdmin,
...@@ -58,6 +61,10 @@ const checkPredeploys = async (hre: HardhatRuntimeEnvironment) => { ...@@ -58,6 +61,10 @@ const checkPredeploys = async (hre: HardhatRuntimeEnvironment) => {
if (admin !== slot) { if (admin !== slot) {
throw new Error(`incorrect admin slot in ${addr}`) throw new Error(`incorrect admin slot in ${addr}`)
} }
if (i % 200 === 0) {
console.log(`Checked through ${addr}`)
}
} }
} }
...@@ -81,36 +88,44 @@ const assertSemver = async ( ...@@ -81,36 +88,44 @@ const assertSemver = async (
} }
// checkProxy will print out the proxy slots // checkProxy will print out the proxy slots
const checkProxy = async (hre: HardhatRuntimeEnvironment, name: string) => { const checkProxy = async (
_hre: HardhatRuntimeEnvironment,
name: string,
provider: providers.Provider
) => {
const address = predeploys[name] const address = predeploys[name]
if (!address) { if (!address) {
throw new Error(`unknown contract name: ${name}`) throw new Error(`unknown contract name: ${name}`)
} }
const impl = await hre.ethers.provider.getStorageAt(address, implSlot) const impl = await provider.getStorageAt(address, implSlot)
const admin = await hre.ethers.provider.getStorageAt(address, adminSlot) const admin = await provider.getStorageAt(address, adminSlot)
console.log(` - EIP-1967 implementation slot: ${impl}`) console.log(` - EIP-1967 implementation slot: ${impl}`)
console.log(` - EIP-1967 admin slot: ${admin}`) console.log(` - EIP-1967 admin slot: ${admin}`)
} }
// assertProxy will require the proxy is set // assertProxy will require the proxy is set
const assertProxy = async (hre: HardhatRuntimeEnvironment, name: string) => { const assertProxy = async (
hre: HardhatRuntimeEnvironment,
name: string,
provider: providers.Provider
) => {
const address = predeploys[name] const address = predeploys[name]
if (!address) { if (!address) {
throw new Error(`unknown contract name: ${name}`) throw new Error(`unknown contract name: ${name}`)
} }
const code = await hre.ethers.provider.getCode(address) const code = await provider.getCode(address)
const deployInfo = await hre.artifacts.readArtifact('Proxy') const deployInfo = await hre.artifacts.readArtifact('Proxy')
if (code !== deployInfo.deployedBytecode) { if (code !== deployInfo.deployedBytecode) {
throw new Error(`${address}: code mismatch`) throw new Error(`${address}: code mismatch`)
} }
const impl = await hre.ethers.provider.getStorageAt(address, implSlot) const impl = await provider.getStorageAt(address, implSlot)
const implAddress = '0x' + impl.slice(26) const implAddress = '0x' + impl.slice(26)
const implCode = await hre.ethers.provider.getCode(implAddress) const implCode = await provider.getCode(implAddress)
if (implCode === '0x') { if (implCode === '0x') {
throw new Error('No code at implementation') throw new Error('No code at implementation')
} }
...@@ -120,24 +135,29 @@ const check = { ...@@ -120,24 +135,29 @@ const check = {
// LegacyMessagePasser // LegacyMessagePasser
// - check version // - check version
// - is behind a proxy // - is behind a proxy
LegacyMessagePasser: async (hre: HardhatRuntimeEnvironment) => { LegacyMessagePasser: async (
hre: HardhatRuntimeEnvironment,
signer: Signer
) => {
const LegacyMessagePasser = await hre.ethers.getContractAt( const LegacyMessagePasser = await hre.ethers.getContractAt(
'LegacyMessagePasser', 'LegacyMessagePasser',
predeploys.LegacyMessagePasser predeploys.LegacyMessagePasser,
signer
) )
await assertSemver(LegacyMessagePasser, 'LegacyMessagePasser') await assertSemver(LegacyMessagePasser, 'LegacyMessagePasser')
await checkProxy(hre, 'LegacyMessagePasser') await checkProxy(hre, 'LegacyMessagePasser', signer.provider)
await assertProxy(hre, 'LegacyMessagePasser') await assertProxy(hre, 'LegacyMessagePasser', signer.provider)
}, },
// DeployerWhitelist // DeployerWhitelist
// - check version // - check version
// - is behind a proxy // - is behind a proxy
// - owner is `address(0)` // - owner is `address(0)`
DeployerWhitelist: async (hre: HardhatRuntimeEnvironment) => { DeployerWhitelist: async (hre: HardhatRuntimeEnvironment, signer: Signer) => {
const DeployerWhitelist = await hre.ethers.getContractAt( const DeployerWhitelist = await hre.ethers.getContractAt(
'DeployerWhitelist', 'DeployerWhitelist',
predeploys.DeployerWhitelist predeploys.DeployerWhitelist,
signer
) )
await assertSemver(DeployerWhitelist, 'DeployerWhitelist') await assertSemver(DeployerWhitelist, 'DeployerWhitelist')
...@@ -146,8 +166,8 @@ const check = { ...@@ -146,8 +166,8 @@ const check = {
assert(owner === hre.ethers.constants.AddressZero) assert(owner === hre.ethers.constants.AddressZero)
console.log(` - owner: ${owner}`) console.log(` - owner: ${owner}`)
await checkProxy(hre, 'DeployerWhitelist') await checkProxy(hre, 'DeployerWhitelist', signer.provider)
await assertProxy(hre, 'DeployerWhitelist') await assertProxy(hre, 'DeployerWhitelist', signer.provider)
}, },
// L2CrossDomainMessenger // L2CrossDomainMessenger
// - check version // - check version
...@@ -156,15 +176,19 @@ const check = { ...@@ -156,15 +176,19 @@ const check = {
// - is behind a proxy // - is behind a proxy
// - check owner // - check owner
// - check initialized // - check initialized
L2CrossDomainMessenger: async (hre: HardhatRuntimeEnvironment) => { L2CrossDomainMessenger: async (
hre: HardhatRuntimeEnvironment,
signer: Signer
) => {
const L2CrossDomainMessenger = await hre.ethers.getContractAt( const L2CrossDomainMessenger = await hre.ethers.getContractAt(
'L2CrossDomainMessenger', 'L2CrossDomainMessenger',
predeploys.L2CrossDomainMessenger predeploys.L2CrossDomainMessenger,
signer
) )
await assertSemver(L2CrossDomainMessenger, 'L2CrossDomainMessenger') await assertSemver(L2CrossDomainMessenger, 'L2CrossDomainMessenger')
const xDomainMessageSenderSlot = await hre.ethers.provider.getStorageAt( const xDomainMessageSenderSlot = await signer.provider.getStorageAt(
predeploys.L2CrossDomainMessenger, predeploys.L2CrossDomainMessenger,
204 204
) )
...@@ -182,8 +206,8 @@ const check = { ...@@ -182,8 +206,8 @@ const check = {
await L2CrossDomainMessenger.l1CrossDomainMessenger() await L2CrossDomainMessenger.l1CrossDomainMessenger()
yell(` - l1CrossDomainMessenger: ${l1CrossDomainMessenger}`) yell(` - l1CrossDomainMessenger: ${l1CrossDomainMessenger}`)
await checkProxy(hre, 'L2CrossDomainMessenger') await checkProxy(hre, 'L2CrossDomainMessenger', signer.provider)
await assertProxy(hre, 'L2CrossDomainMessenger') await assertProxy(hre, 'L2CrossDomainMessenger', signer.provider)
const owner = await L2CrossDomainMessenger.owner() const owner = await L2CrossDomainMessenger.owner()
assert(owner !== hre.ethers.constants.AddressZero) assert(owner !== hre.ethers.constants.AddressZero)
...@@ -208,7 +232,7 @@ const check = { ...@@ -208,7 +232,7 @@ const check = {
` - MIN_GAS_DYNAMIC_OVERHEAD_NUMERATOR: ${MIN_GAS_DYNAMIC_OVERHEAD_NUMERATOR}` ` - MIN_GAS_DYNAMIC_OVERHEAD_NUMERATOR: ${MIN_GAS_DYNAMIC_OVERHEAD_NUMERATOR}`
) )
const slot = await hre.ethers.provider.getStorageAt( const slot = await signer.provider.getStorageAt(
predeploys.L2CrossDomainMessenger, predeploys.L2CrossDomainMessenger,
0 0
) )
...@@ -223,10 +247,11 @@ const check = { ...@@ -223,10 +247,11 @@ const check = {
// GasPriceOracle // GasPriceOracle
// - check version // - check version
// - check decimals // - check decimals
GasPriceOracle: async (hre: HardhatRuntimeEnvironment) => { GasPriceOracle: async (hre: HardhatRuntimeEnvironment, signer: Signer) => {
const GasPriceOracle = await hre.ethers.getContractAt( const GasPriceOracle = await hre.ethers.getContractAt(
'GasPriceOracle', 'GasPriceOracle',
predeploys.GasPriceOracle predeploys.GasPriceOracle,
signer
) )
await assertSemver(GasPriceOracle, 'GasPriceOracle') await assertSemver(GasPriceOracle, 'GasPriceOracle')
...@@ -235,15 +260,16 @@ const check = { ...@@ -235,15 +260,16 @@ const check = {
assert(decimals.eq(6)) assert(decimals.eq(6))
console.log(` - decimals: ${decimals.toNumber()}`) console.log(` - decimals: ${decimals.toNumber()}`)
await checkProxy(hre, 'GasPriceOracle') await checkProxy(hre, 'GasPriceOracle', signer.provider)
await assertProxy(hre, 'GasPriceOracle') await assertProxy(hre, 'GasPriceOracle', signer.provider)
}, },
// L2StandardBridge // L2StandardBridge
// - check version // - check version
L2StandardBridge: async (hre: HardhatRuntimeEnvironment) => { L2StandardBridge: async (hre: HardhatRuntimeEnvironment, signer: Signer) => {
const L2StandardBridge = await hre.ethers.getContractAt( const L2StandardBridge = await hre.ethers.getContractAt(
'L2StandardBridge', 'L2StandardBridge',
predeploys.L2StandardBridge predeploys.L2StandardBridge,
signer
) )
await assertSemver(L2StandardBridge, 'L2StandardBridge') await assertSemver(L2StandardBridge, 'L2StandardBridge')
...@@ -255,17 +281,18 @@ const check = { ...@@ -255,17 +281,18 @@ const check = {
const MESSENGER = await L2StandardBridge.MESSENGER() const MESSENGER = await L2StandardBridge.MESSENGER()
assert(MESSENGER === predeploys.L2CrossDomainMessenger) assert(MESSENGER === predeploys.L2CrossDomainMessenger)
await checkProxy(hre, 'L2StandardBridge') await checkProxy(hre, 'L2StandardBridge', signer.provider)
await assertProxy(hre, 'L2StandardBridge') await assertProxy(hre, 'L2StandardBridge', signer.provider)
}, },
// SequencerFeeVault // SequencerFeeVault
// - check version // - check version
// - check RECIPIENT // - check RECIPIENT
// - check l1FeeWallet (legacy) // - check l1FeeWallet (legacy)
SequencerFeeVault: async (hre: HardhatRuntimeEnvironment) => { SequencerFeeVault: async (hre: HardhatRuntimeEnvironment, signer: Signer) => {
const SequencerFeeVault = await hre.ethers.getContractAt( const SequencerFeeVault = await hre.ethers.getContractAt(
'SequencerFeeVault', 'SequencerFeeVault',
predeploys.SequencerFeeVault predeploys.SequencerFeeVault,
signer
) )
await assertSemver(SequencerFeeVault, 'SequencerFeeVault') await assertSemver(SequencerFeeVault, 'SequencerFeeVault')
...@@ -282,54 +309,59 @@ const check = { ...@@ -282,54 +309,59 @@ const check = {
await SequencerFeeVault.MIN_WITHDRAWAL_AMOUNT() await SequencerFeeVault.MIN_WITHDRAWAL_AMOUNT()
console.log(` - MIN_WITHDRAWAL_AMOUNT: ${MIN_WITHDRAWAL_AMOUNT}`) console.log(` - MIN_WITHDRAWAL_AMOUNT: ${MIN_WITHDRAWAL_AMOUNT}`)
await checkProxy(hre, 'SequencerFeeVault') await checkProxy(hre, 'SequencerFeeVault', signer.provider)
await assertProxy(hre, 'SequencerFeeVault') await assertProxy(hre, 'SequencerFeeVault', signer.provider)
}, },
// OptimismMintableERC20Factory // OptimismMintableERC20Factory
// - check version // - check version
OptimismMintableERC20Factory: async (hre: HardhatRuntimeEnvironment) => { OptimismMintableERC20Factory: async (
hre: HardhatRuntimeEnvironment,
signer: Signer
) => {
const OptimismMintableERC20Factory = await hre.ethers.getContractAt( const OptimismMintableERC20Factory = await hre.ethers.getContractAt(
'OptimismMintableERC20Factory', 'OptimismMintableERC20Factory',
predeploys.OptimismMintableERC20Factory predeploys.OptimismMintableERC20Factory,
signer
) )
await assertSemver( await assertSemver(
OptimismMintableERC20Factory, OptimismMintableERC20Factory,
'OptimismMintableERC20Factory', 'OptimismMintableERC20Factory'
'1.0.0'
) )
const BRIDGE = await OptimismMintableERC20Factory.BRIDGE() const BRIDGE = await OptimismMintableERC20Factory.BRIDGE()
assert(BRIDGE !== hre.ethers.constants.AddressZero) assert(BRIDGE !== hre.ethers.constants.AddressZero)
await checkProxy(hre, 'OptimismMintableERC20Factory') await checkProxy(hre, 'OptimismMintableERC20Factory', signer.provider)
await assertProxy(hre, 'OptimismMintableERC20Factory') await assertProxy(hre, 'OptimismMintableERC20Factory', signer.provider)
}, },
// L1BlockNumber // L1BlockNumber
// - check version // - check version
L1BlockNumber: async (hre: HardhatRuntimeEnvironment) => { L1BlockNumber: async (hre: HardhatRuntimeEnvironment, signer: Signer) => {
const L1BlockNumber = await hre.ethers.getContractAt( const L1BlockNumber = await hre.ethers.getContractAt(
'L1BlockNumber', 'L1BlockNumber',
predeploys.L1BlockNumber predeploys.L1BlockNumber,
signer
) )
await assertSemver(L1BlockNumber, 'L1BlockNumber') await assertSemver(L1BlockNumber, 'L1BlockNumber')
await checkProxy(hre, 'L1BlockNumber') await checkProxy(hre, 'L1BlockNumber', signer.provider)
await assertProxy(hre, 'L1BlockNumber') await assertProxy(hre, 'L1BlockNumber', signer.provider)
}, },
// L1Block // L1Block
// - check version // - check version
L1Block: async (hre: HardhatRuntimeEnvironment) => { L1Block: async (hre: HardhatRuntimeEnvironment, signer: Signer) => {
const L1Block = await hre.ethers.getContractAt( const L1Block = await hre.ethers.getContractAt(
'L1Block', 'L1Block',
predeploys.L1Block predeploys.L1Block,
signer
) )
await assertSemver(L1Block, 'L1Block') await assertSemver(L1Block, 'L1Block')
await checkProxy(hre, 'L1Block') await checkProxy(hre, 'L1Block', signer.provider)
await assertProxy(hre, 'L1Block') await assertProxy(hre, 'L1Block', signer.provider)
}, },
// LegacyERC20ETH // LegacyERC20ETH
// - not behind a proxy // - not behind a proxy
...@@ -339,10 +371,11 @@ const check = { ...@@ -339,10 +371,11 @@ const check = {
// - check BRIDGE // - check BRIDGE
// - check REMOTE_TOKEN // - check REMOTE_TOKEN
// - totalSupply should be set to 0 // - totalSupply should be set to 0
LegacyERC20ETH: async (hre: HardhatRuntimeEnvironment) => { LegacyERC20ETH: async (hre: HardhatRuntimeEnvironment, signer: Signer) => {
const LegacyERC20ETH = await hre.ethers.getContractAt( const LegacyERC20ETH = await hre.ethers.getContractAt(
'LegacyERC20ETH', 'LegacyERC20ETH',
predeploys.LegacyERC20ETH predeploys.LegacyERC20ETH,
signer
) )
const name = await LegacyERC20ETH.name() const name = await LegacyERC20ETH.name()
...@@ -367,15 +400,19 @@ const check = { ...@@ -367,15 +400,19 @@ const check = {
assert(totalSupply.eq(0)) assert(totalSupply.eq(0))
console.log(` - totalSupply: ${totalSupply}`) console.log(` - totalSupply: ${totalSupply}`)
await checkProxy(hre, 'LegacyERC20ETH') await checkProxy(hre, 'LegacyERC20ETH', signer.provider)
// No proxy at this address, don't call assertProxy // No proxy at this address, don't call assertProxy
}, },
// WETH9 // WETH9
// - check name // - check name
// - check symbol // - check symbol
// - check decimals // - check decimals
WETH9: async (hre: HardhatRuntimeEnvironment) => { WETH9: async (hre: HardhatRuntimeEnvironment, signer: Signer) => {
const WETH9 = await hre.ethers.getContractAt('WETH9', predeploys.WETH9) const WETH9 = await hre.ethers.getContractAt(
'WETH9',
predeploys.WETH9,
signer
)
const name = await WETH9.name() const name = await WETH9.name()
assert(name === 'Wrapped Ether') assert(name === 'Wrapped Ether')
...@@ -394,10 +431,11 @@ const check = { ...@@ -394,10 +431,11 @@ const check = {
// - check name // - check name
// - check symbol // - check symbol
// - check owner // - check owner
GovernanceToken: async (hre: HardhatRuntimeEnvironment) => { GovernanceToken: async (hre: HardhatRuntimeEnvironment, signer: Signer) => {
const GovernanceToken = await hre.ethers.getContractAt( const GovernanceToken = await hre.ethers.getContractAt(
'GovernanceToken', 'GovernanceToken',
predeploys.GovernanceToken predeploys.GovernanceToken,
signer
) )
const name = await GovernanceToken.name() const name = await GovernanceToken.name()
...@@ -414,15 +452,16 @@ const check = { ...@@ -414,15 +452,16 @@ const check = {
const totalSupply = await GovernanceToken.totalSupply() const totalSupply = await GovernanceToken.totalSupply()
console.log(` - totalSupply: ${totalSupply}`) console.log(` - totalSupply: ${totalSupply}`)
await checkProxy(hre, 'GovernanceToken') await checkProxy(hre, 'GovernanceToken', signer.provider)
// No proxy at this address, don't call assertProxy // No proxy at this address, don't call assertProxy
}, },
// L2ERC721Bridge // L2ERC721Bridge
// - check version // - check version
L2ERC721Bridge: async (hre: HardhatRuntimeEnvironment) => { L2ERC721Bridge: async (hre: HardhatRuntimeEnvironment, signer: Signer) => {
const L2ERC721Bridge = await hre.ethers.getContractAt( const L2ERC721Bridge = await hre.ethers.getContractAt(
'L2ERC721Bridge', 'L2ERC721Bridge',
predeploys.L2ERC721Bridge predeploys.L2ERC721Bridge,
signer
) )
await assertSemver(L2ERC721Bridge, 'L2ERC721Bridge') await assertSemver(L2ERC721Bridge, 'L2ERC721Bridge')
...@@ -435,21 +474,24 @@ const check = { ...@@ -435,21 +474,24 @@ const check = {
assert(OTHER_BRIDGE !== hre.ethers.constants.AddressZero) assert(OTHER_BRIDGE !== hre.ethers.constants.AddressZero)
yell(` - OTHER_BRIDGE: ${OTHER_BRIDGE}`) yell(` - OTHER_BRIDGE: ${OTHER_BRIDGE}`)
await checkProxy(hre, 'L2ERC721Bridge') await checkProxy(hre, 'L2ERC721Bridge', signer.provider)
await assertProxy(hre, 'L2ERC721Bridge') await assertProxy(hre, 'L2ERC721Bridge', signer.provider)
}, },
// OptimismMintableERC721Factory // OptimismMintableERC721Factory
// - check version // - check version
OptimismMintableERC721Factory: async (hre: HardhatRuntimeEnvironment) => { OptimismMintableERC721Factory: async (
hre: HardhatRuntimeEnvironment,
signer: Signer
) => {
const OptimismMintableERC721Factory = await hre.ethers.getContractAt( const OptimismMintableERC721Factory = await hre.ethers.getContractAt(
'OptimismMintableERC721Factory', 'OptimismMintableERC721Factory',
predeploys.OptimismMintableERC721Factory predeploys.OptimismMintableERC721Factory,
signer
) )
await assertSemver( await assertSemver(
OptimismMintableERC721Factory, OptimismMintableERC721Factory,
'OptimismMintableERC721Factory', 'OptimismMintableERC721Factory'
'1.0.0'
) )
const BRIDGE = await OptimismMintableERC721Factory.BRIDGE() const BRIDGE = await OptimismMintableERC721Factory.BRIDGE()
...@@ -461,15 +503,16 @@ const check = { ...@@ -461,15 +503,16 @@ const check = {
assert(REMOTE_CHAIN_ID !== 0) assert(REMOTE_CHAIN_ID !== 0)
console.log(` - REMOTE_CHAIN_ID: ${REMOTE_CHAIN_ID}`) console.log(` - REMOTE_CHAIN_ID: ${REMOTE_CHAIN_ID}`)
await checkProxy(hre, 'OptimismMintableERC721Factory') await checkProxy(hre, 'OptimismMintableERC721Factory', signer.provider)
await assertProxy(hre, 'OptimismMintableERC721Factory') await assertProxy(hre, 'OptimismMintableERC721Factory', signer.provider)
}, },
// ProxyAdmin // ProxyAdmin
// - check owner // - check owner
ProxyAdmin: async (hre: HardhatRuntimeEnvironment) => { ProxyAdmin: async (hre: HardhatRuntimeEnvironment, signer: Signer) => {
const ProxyAdmin = await hre.ethers.getContractAt( const ProxyAdmin = await hre.ethers.getContractAt(
'ProxyAdmin', 'ProxyAdmin',
predeploys.ProxyAdmin predeploys.ProxyAdmin,
signer
) )
const owner = await ProxyAdmin.owner() const owner = await ProxyAdmin.owner()
...@@ -483,10 +526,11 @@ const check = { ...@@ -483,10 +526,11 @@ const check = {
// - check version // - check version
// - check MIN_WITHDRAWAL_AMOUNT // - check MIN_WITHDRAWAL_AMOUNT
// - check RECIPIENT // - check RECIPIENT
BaseFeeVault: async (hre: HardhatRuntimeEnvironment) => { BaseFeeVault: async (hre: HardhatRuntimeEnvironment, signer: Signer) => {
const BaseFeeVault = await hre.ethers.getContractAt( const BaseFeeVault = await hre.ethers.getContractAt(
'BaseFeeVault', 'BaseFeeVault',
predeploys.BaseFeeVault predeploys.BaseFeeVault,
signer
) )
await assertSemver(BaseFeeVault, 'BaseFeeVault') await assertSemver(BaseFeeVault, 'BaseFeeVault')
...@@ -498,17 +542,18 @@ const check = { ...@@ -498,17 +542,18 @@ const check = {
assert(RECIPIENT !== hre.ethers.constants.AddressZero) assert(RECIPIENT !== hre.ethers.constants.AddressZero)
yell(` - RECIPIENT: ${RECIPIENT}`) yell(` - RECIPIENT: ${RECIPIENT}`)
await checkProxy(hre, 'BaseFeeVault') await checkProxy(hre, 'BaseFeeVault', signer.provider)
await assertProxy(hre, 'BaseFeeVault') await assertProxy(hre, 'BaseFeeVault', signer.provider)
}, },
// L1FeeVault // L1FeeVault
// - check version // - check version
// - check MIN_WITHDRAWAL_AMOUNT // - check MIN_WITHDRAWAL_AMOUNT
// - check RECIPIENT // - check RECIPIENT
L1FeeVault: async (hre: HardhatRuntimeEnvironment) => { L1FeeVault: async (hre: HardhatRuntimeEnvironment, signer: Signer) => {
const L1FeeVault = await hre.ethers.getContractAt( const L1FeeVault = await hre.ethers.getContractAt(
'L1FeeVault', 'L1FeeVault',
predeploys.L1FeeVault predeploys.L1FeeVault,
signer
) )
await assertSemver(L1FeeVault, 'L1FeeVault') await assertSemver(L1FeeVault, 'L1FeeVault')
...@@ -520,15 +565,19 @@ const check = { ...@@ -520,15 +565,19 @@ const check = {
assert(RECIPIENT !== hre.ethers.constants.AddressZero) assert(RECIPIENT !== hre.ethers.constants.AddressZero)
yell(` - RECIPIENT: ${RECIPIENT}`) yell(` - RECIPIENT: ${RECIPIENT}`)
await checkProxy(hre, 'L1FeeVault') await checkProxy(hre, 'L1FeeVault', signer.provider)
await assertProxy(hre, 'L1FeeVault') await assertProxy(hre, 'L1FeeVault', signer.provider)
}, },
// L2ToL1MessagePasser // L2ToL1MessagePasser
// - check version // - check version
L2ToL1MessagePasser: async (hre: HardhatRuntimeEnvironment) => { L2ToL1MessagePasser: async (
hre: HardhatRuntimeEnvironment,
signer: Signer
) => {
const L2ToL1MessagePasser = await hre.ethers.getContractAt( const L2ToL1MessagePasser = await hre.ethers.getContractAt(
'L2ToL1MessagePasser', 'L2ToL1MessagePasser',
predeploys.L2ToL1MessagePasser predeploys.L2ToL1MessagePasser,
signer
) )
await assertSemver(L2ToL1MessagePasser, 'L2ToL1MessagePasser') await assertSemver(L2ToL1MessagePasser, 'L2ToL1MessagePasser')
...@@ -539,26 +588,55 @@ const check = { ...@@ -539,26 +588,55 @@ const check = {
const messageNonce = await L2ToL1MessagePasser.messageNonce() const messageNonce = await L2ToL1MessagePasser.messageNonce()
console.log(` - messageNonce: ${messageNonce}`) console.log(` - messageNonce: ${messageNonce}`)
await checkProxy(hre, 'L2ToL1MessagePasser') await checkProxy(hre, 'L2ToL1MessagePasser', signer.provider)
await assertProxy(hre, 'L2ToL1MessagePasser') await assertProxy(hre, 'L2ToL1MessagePasser', signer.provider)
}, },
} }
task( task('check-l2', 'Checks a freshly migrated L2 system for correct migration')
'check-l2', .addOptionalParam('rpcUrl', 'RPC URL of the remote node', '', types.string)
'Checks a freshly migrated L2 system for correct migration' .addOptionalParam('chainId', 'Expected chain id', 0, types.int)
).setAction(async (_, hre: HardhatRuntimeEnvironment) => { .addOptionalParam(
yell('Manually check values wrapped in !!!!') 'skipPredeployCheck',
console.log() 'Skip long check',
false,
// Ensure that all the predeploys exist, including the not types.boolean
// currently configured ones )
await checkPredeploys(hre) .setAction(async (args, hre: HardhatRuntimeEnvironment) => {
console.log() yell('Manually check values wrapped in !!!!')
// Check the currently configured predeploys console.log()
for (const [name, fn] of Object.entries(check)) {
const address = predeploys[name] let signer: Signer = hre.ethers.provider.getSigner()
console.log(`${name}: ${address}`)
await fn(hre) if (args.rpcUrl !== '') {
} console.log('Using CLI URL for provider instead of hardhat network')
}) const provider = new hre.ethers.providers.JsonRpcProvider(args.rpcUrl)
signer = Wallet.createRandom().connect(provider)
}
if (args.chainId !== 0) {
const chainId = await signer.getChainId()
if (chainId !== args.chainId) {
throw new Error(
`Unexpected Chain ID. Got ${chainId}, expected ${args.chainId}`
)
}
console.log(`Verified Chain ID: ${chainId}`)
} else {
console.log(`Skipping Chain ID validation...`)
}
// Ensure that all the predeploys exist, including the not
// currently configured ones
if (!args.skipPredeployCheck) {
await checkPredeploys(hre, signer.provider)
}
console.log()
// Check the currently configured predeploys
for (const [name, fn] of Object.entries(check)) {
const address = predeploys[name]
console.log(`${name}: ${address}`)
await fn(hre, signer)
}
})
...@@ -58,6 +58,7 @@ ...@@ -58,6 +58,7 @@
"devDependencies": { "devDependencies": {
"@types/cors": "^2.8.9", "@types/cors": "^2.8.9",
"@types/levelup": "^4.3.0", "@types/levelup": "^4.3.0",
"@types/level": "^6.0.1",
"bfj": "^7.0.2", "bfj": "^7.0.2",
"chai-as-promised": "^7.1.1", "chai-as-promised": "^7.1.1",
"hardhat": "^2.9.6", "hardhat": "^2.9.6",
......
...@@ -11,9 +11,9 @@ ...@@ -11,9 +11,9 @@
<!-- END doctoc generated TOC please keep comment here to allow auto update --> <!-- END doctoc generated TOC please keep comment here to allow auto update -->
[Deposited transaction](./glossary.md#deposited-transaction) are transactions on L2 that are [Deposited transaction](./glossary.md#deposited-transaction) are transactions on L2 that are
initiated on L1. The gas that they use on L2 is bought on L1 via a gas burn or a direct payment. We initiated on L1. The gas that they use on L2 is bought on L1 via a gas burn (or a direct payment
maintain a fee market and hard cap on the amount of gas provided to all deposits in a single L1 in the future). We maintain a fee market and hard cap on the amount of gas provided to all deposits
block. in a single L1 block.
The gas provided to deposited transactions is sometimes called "guaranteed gas". The gas provided to The gas provided to deposited transactions is sometimes called "guaranteed gas". The gas provided to
deposited transactions is unique in the regard that it is not refundable. It cannot be refunded as deposited transactions is unique in the regard that it is not refundable. It cannot be refunded as
...@@ -56,9 +56,9 @@ at a multiple of the target, we enable deposits to temporarily use more L2 gas a ...@@ -56,9 +56,9 @@ at a multiple of the target, we enable deposits to temporarily use more L2 gas a
# the ability of the account to afford this gas. # the ability of the account to afford this gas.
BASE_FEE_MAX_CHANGE_DENOMINATOR = 8 BASE_FEE_MAX_CHANGE_DENOMINATOR = 8
ELASTICITY_MULTIPLIER = 4 ELASTICITY_MULTIPLIER = 4
MAX_RESOURCE_LIMIT = 8,000,000 MAX_RESOURCE_LIMIT = 8_000_000
TARGET_RESOURCE_LIMIT = MAX_RESOURCE_LIMIT / ELASTICITY_MULTIPLIER TARGET_RESOURCE_LIMIT = MAX_RESOURCE_LIMIT / ELASTICITY_MULTIPLIER
MINIMUM_BASEFEE=10000 MINIMUM_BASEFEE = 10000
# prev_basefee is a u128, prev_bought_gas and prev_num are u64s # prev_basefee is a u128, prev_bought_gas and prev_num are u64s
prev_basefee, prev_bought_gas, prev_num = <values from previous update> prev_basefee, prev_bought_gas, prev_num = <values from previous update>
...@@ -108,6 +108,10 @@ store_values(now_basefee, now_bought_gas, now_num) ...@@ -108,6 +108,10 @@ store_values(now_basefee, now_bought_gas, now_num)
## Rationale for burning L1 Gas ## Rationale for burning L1 Gas
There must be a sybil resistance mechanism for usage of the network. If it is very cheap to get
guaranteed gas on L2, then it would be possible to spam the network. Burning a dynamic amount
of gas on L1 acts as a sybil resistance mechanism as it becomes more expensive with more demand.
If we collect ETH directly to pay for L2 gas, every (indirect) caller of the deposit function will need If we collect ETH directly to pay for L2 gas, every (indirect) caller of the deposit function will need
to be marked with the payable selector. This won't be possible for many existing projects. Unfortunately to be marked with the payable selector. This won't be possible for many existing projects. Unfortunately
this is quite wasteful. As such, we will provide two options to buy L2 gas: this is quite wasteful. As such, we will provide two options to buy L2 gas:
......
...@@ -3703,6 +3703,14 @@ ...@@ -3703,6 +3703,14 @@
resolved "https://registry.yarnpkg.com/@types/dateformat/-/dateformat-5.0.0.tgz#17ce64b0318f3f36d1c830c58a7a915445f1f93d" resolved "https://registry.yarnpkg.com/@types/dateformat/-/dateformat-5.0.0.tgz#17ce64b0318f3f36d1c830c58a7a915445f1f93d"
integrity sha512-SZg4JdHIWHQGEokbYGZSDvo5wA4TLYPXaqhigs/wH+REDOejcJzgH+qyY+HtEUtWOZxEUkbhbdYPqQDiEgrXeA== integrity sha512-SZg4JdHIWHQGEokbYGZSDvo5wA4TLYPXaqhigs/wH+REDOejcJzgH+qyY+HtEUtWOZxEUkbhbdYPqQDiEgrXeA==
"@types/encoding-down@*":
version "5.0.1"
resolved "https://registry.yarnpkg.com/@types/encoding-down/-/encoding-down-5.0.1.tgz#5527b8656395b274bf0100a312c1c620a7880a24"
integrity sha512-1O8CyIC67hMR+VuxLtjlJvXwNn5cNnJ7YiaBR4p+ONGijlmIZjbXzsPuJm146p9eQZwzZRGgmRwWtCqXs5wwSw==
dependencies:
"@types/abstract-leveldown" "*"
"@types/level-codec" "*"
"@types/express-serve-static-core@^4.17.18": "@types/express-serve-static-core@^4.17.18":
version "4.17.24" version "4.17.24"
resolved "https://registry.yarnpkg.com/@types/express-serve-static-core/-/express-serve-static-core-4.17.24.tgz#ea41f93bf7e0d59cd5a76665068ed6aab6815c07" resolved "https://registry.yarnpkg.com/@types/express-serve-static-core/-/express-serve-static-core-4.17.24.tgz#ea41f93bf7e0d59cd5a76665068ed6aab6815c07"
...@@ -3747,11 +3755,34 @@ ...@@ -3747,11 +3755,34 @@
resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee" resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee"
integrity sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ== integrity sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==
"@types/level-codec@*":
version "9.0.1"
resolved "https://registry.yarnpkg.com/@types/level-codec/-/level-codec-9.0.1.tgz#b135e0b3da81185b6f27655334c5f1da89b2b0af"
integrity sha512-6z7DSlBsmbax3I/bV1Q6jT1nKquDjFl95LURVThdKtwILkRawLYtXdINW19xM95N5kqN2detWb2iGrbUlPwNyw==
"@types/level-errors@*": "@types/level-errors@*":
version "3.0.0" version "3.0.0"
resolved "https://registry.yarnpkg.com/@types/level-errors/-/level-errors-3.0.0.tgz#15c1f4915a5ef763b51651b15e90f6dc081b96a8" resolved "https://registry.yarnpkg.com/@types/level-errors/-/level-errors-3.0.0.tgz#15c1f4915a5ef763b51651b15e90f6dc081b96a8"
integrity sha512-/lMtoq/Cf/2DVOm6zE6ORyOM+3ZVm/BvzEZVxUhf6bgh8ZHglXlBqxbxSlJeVp8FCbD3IVvk/VbsaNmDjrQvqQ== integrity sha512-/lMtoq/Cf/2DVOm6zE6ORyOM+3ZVm/BvzEZVxUhf6bgh8ZHglXlBqxbxSlJeVp8FCbD3IVvk/VbsaNmDjrQvqQ==
"@types/level@^6.0.1":
version "6.0.1"
resolved "https://registry.yarnpkg.com/@types/level/-/level-6.0.1.tgz#6642c048dbae4638721105cd5f8255a2829bd5d6"
integrity sha512-4RK6vl9/CNCe5SyDCGaTgTOYEPNh8/wUaUY8UDN8AXon2D7hGPGIlx0t9jCds9wiKBqicsUyeAA0W4rUZeqYBQ==
dependencies:
"@types/abstract-leveldown" "*"
"@types/encoding-down" "*"
"@types/levelup" "*"
"@types/levelup@*":
version "5.1.2"
resolved "https://registry.yarnpkg.com/@types/levelup/-/levelup-5.1.2.tgz#3b987fe66c95871dc97e74f0bce5b2eb91140782"
integrity sha512-JhCKONvFg2rEbsyyCCRkiPF03tMV1NyBXER4iXKBemgjwS4+SF6HGNuL4cfq6ueM6Yc+4ZbwJnU/5v6q3ZziUQ==
dependencies:
"@types/abstract-leveldown" "*"
"@types/level-errors" "*"
"@types/node" "*"
"@types/levelup@^4.3.0": "@types/levelup@^4.3.0":
version "4.3.3" version "4.3.3"
resolved "https://registry.yarnpkg.com/@types/levelup/-/levelup-4.3.3.tgz#4dc2b77db079b1cf855562ad52321aa4241b8ef4" resolved "https://registry.yarnpkg.com/@types/levelup/-/levelup-4.3.3.tgz#4dc2b77db079b1cf855562ad52321aa4241b8ef4"
......
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