Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions bindings/predeploys/addresses.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ const (
L2ReverseCustomGateway = "0x5300000000000000000000000000000000000018"
L2WithdrawLockERC20Gateway = "0x5300000000000000000000000000000000000019"
L2USDCGateway = "0x5300000000000000000000000000000000000020"
L2USDC = "0x5300000000000000000000000000000000000021"
)

var (
Expand Down Expand Up @@ -57,7 +56,6 @@ var (
L2ReverseCustomGatewayAddr = common.HexToAddress(L2ReverseCustomGateway)
L2WithdrawLockERC20GatewayAddr = common.HexToAddress(L2WithdrawLockERC20Gateway)
L2USDCGatewayAddr = common.HexToAddress(L2USDCGateway)
L2USDCAddr = common.HexToAddress(L2USDC)

Predeploys = make(map[string]*common.Address)
)
Expand Down Expand Up @@ -87,5 +85,4 @@ func init() {
Predeploys["L2ReverseCustomGateway"] = &L2ReverseCustomGatewayAddr
Predeploys["L2WithdrawLockERC20Gateway"] = &L2WithdrawLockERC20GatewayAddr
Predeploys["L2USDCGateway"] = &L2USDCGatewayAddr
Predeploys["L2USDC"] = &L2USDCAddr
}
37 changes: 0 additions & 37 deletions contracts/deploy/013-DeployProxys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ export const deployContractProxies = async (
const WETHFactoryName = ContractFactoryName.WETH
const WETHImplStorageName = ImplStorageName.WETH

const USDCFactoryName = ContractFactoryName.USDC
const USDCImplStorageName = ImplStorageName.USDC
let err = ""

// ************************ token contracts deploy ************************
Expand Down Expand Up @@ -93,41 +91,6 @@ export const deployContractProxies = async (
}
}

if (config.l1USDCAddress == "") {
// L1WETH deploy
let Factory = await hre.ethers.getContractFactory(USDCFactoryName)
let contract = await Factory.deploy()
await contract.deployed()
console.log(
"%s=%s ; TX_HASH: %s",
USDCImplStorageName,
contract.address.toLocaleLowerCase(),
contract.deployTransaction.hash
)
let blockNumber = await hre.ethers.provider.getBlockNumber()
console.log("BLOCK_NUMBER: %s", blockNumber)
err = await storage(path, USDCImplStorageName, contract.address.toLocaleLowerCase(), blockNumber || 0)
if (err != "") {
return err
}
await contract.initialize(
"USDC",
"USDC",
"USD",
18,
config.contractAdmin,
config.contractAdmin,
config.contractAdmin,
config.contractAdmin
)
} else {
let blockNumber = await hre.ethers.provider.getBlockNumber()
err = await storage(path, USDCImplStorageName, config.l1USDCAddress.toLocaleLowerCase(), blockNumber || 0)
if (err != "") {
return err
}
}

// ************************ messenger contracts deploy ************************
// L1CrossDomainMessengerProxy deploy
err = await deployContractProxyByStorageName(hre, path, deployer, L1CrossDomainMessengerStorageName)
Expand Down
15 changes: 0 additions & 15 deletions contracts/deploy/014-DeployImpls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ export const deployContractImpls = async (
const L1ERC721GatewayFactoryName = ContractFactoryName.L1ERC721Gateway
const L1ERC1155GatewayFactoryName = ContractFactoryName.L1ERC1155Gateway
const L1WETHGatewayFactoryName = ContractFactoryName.L1WETHGateway
const L1USDCGatewayFactoryName = ContractFactoryName.L1USDCGateway
const EnforcedTxGatewayFactoryName = ContractFactoryName.EnforcedTxGateway

// implement storage name
Expand All @@ -51,7 +50,6 @@ export const deployContractImpls = async (
const L1WithdrawLockERC20GatewayImplStorageName = ImplStorageName.L1WithdrawLockERC20GatewayStorageName
const L1ReverseCustomGatewayImplStorageName = ImplStorageName.L1ReverseCustomGatewayStorageName
const L1WETHGatewayImplStorageName = ImplStorageName.L1WETHGatewayStorageName
const L1USDCGatewayImplStorageName = ImplStorageName.L1USDCGatewayStorageName
const L1ERC721GatewayImplStorageName = ImplStorageName.L1ERC721GatewayStorageName
const L1ERC1155GatewayImplStorageName = ImplStorageName.L1ERC1155GatewayStorageName
const WhitelistImplStorageName = ImplStorageName.Whitelist
Expand Down Expand Up @@ -201,19 +199,6 @@ export const deployContractImpls = async (
return err
}

// L1USDCGateway deploy
const L1USDCAddress = getContractAddressByName(path, ImplStorageName.USDC)
Factory = await hre.ethers.getContractFactory(L1USDCGatewayFactoryName)
contract = await Factory.deploy(L1USDCAddress, predeploys.L2USDC)
await contract.deployed()
console.log("%s=%s ; TX_HASH: %s", L1USDCGatewayImplStorageName, contract.address.toLocaleLowerCase(), contract.deployTransaction.hash)
blockNumber = await hre.ethers.provider.getBlockNumber()
console.log("BLOCK_NUMBER: %s", blockNumber)
err = await storage(path, L1USDCGatewayImplStorageName, contract.address.toLocaleLowerCase(), blockNumber || 0)
if (err != '') {
return err
}

// EnforcedTxGateway deploy
Factory = await hre.ethers.getContractFactory(EnforcedTxGatewayFactoryName)
contract = await Factory.deploy()
Expand Down
63 changes: 0 additions & 63 deletions contracts/deploy/017-GatewayInit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,6 @@ export const GatewayInit = async (

const WETHAddress = getContractAddressByName(path, ImplStorageName.WETH)

// L1USDCGateway config
const L1USDCGatewayProxyAddress = getContractAddressByName(path, ProxyStorageName.L1USDCGatewayProxyStorageName)
const L1USDCGatewayImplAddress = getContractAddressByName(path, ImplStorageName.L1USDCGatewayStorageName)
const L1USDCGatewayFactory = await hre.ethers.getContractFactory(ContractFactoryName.L1USDCGateway)

const USDCAddress = getContractAddressByName(path, ImplStorageName.USDC)

// EnforcedTxGateway config
const EnforcedTxGatewayProxyAddress = getContractAddressByName(path, ProxyStorageName.EnforcedTxGatewayProxyStorageName)
const EnforcedTxGatewayImplAddress = getContractAddressByName(path, ImplStorageName.EnforcedTxGatewayStorageName)
Expand Down Expand Up @@ -585,62 +578,6 @@ export const GatewayInit = async (
console.log('L1WETHGatewayProxy upgrade success')
}

// L1USDCGatewayProxy init
const IL1USDCGatewayProxy = await hre.ethers.getContractAt(ContractFactoryName.DefaultProxyInterface, L1USDCGatewayProxyAddress, deployer)
if (
(await IL1USDCGatewayProxy.implementation()).toLocaleLowerCase() !== L1USDCGatewayImplAddress.toLocaleLowerCase()
) {
console.log('Upgrading the L1USDCGateway proxy...')
const counterpart: string = predeploys.L2USDCGateway

if (!ethers.utils.isAddress(counterpart)
|| !ethers.utils.isAddress(L1GatewayRouterProxyAddress)
|| !ethers.utils.isAddress(L1CrossDomainMessengerProxyAddress)
) {
console.error('please check your address')
return ''
}
// Upgrade and initialize the proxy.
await IL1USDCGatewayProxy.connect(deployer).upgradeToAndCall(
L1USDCGatewayImplAddress,
L1USDCGatewayFactory.interface.encodeFunctionData('initialize', [
counterpart,
L1GatewayRouterProxyAddress,
L1CrossDomainMessengerProxyAddress
])
)
await awaitCondition(
async () => {
return (
(await IL1USDCGatewayProxy.implementation()).toLocaleLowerCase() === L1USDCGatewayImplAddress.toLocaleLowerCase()
)
},
3000,
1000
)
const contractTmp = new ethers.Contract(
L1USDCGatewayProxyAddress,
L1USDCGatewayFactory.interface,
deployer,
)
await assertContractVariable(
contractTmp,
'counterpart',
counterpart
)
await assertContractVariable(
contractTmp,
'router',
L1GatewayRouterProxyAddress
)
await assertContractVariable(
contractTmp,
'messenger',
L1CrossDomainMessengerProxyAddress
)
console.log('L1USDCGatewayProxy upgrade success')
}

// IEnforcedTxGatewayProxy init
const IEnforcedTxGatewayProxy = await hre.ethers.getContractAt(ContractFactoryName.DefaultProxyInterface, EnforcedTxGatewayProxyAddress, deployer)
if (
Expand Down
16 changes: 9 additions & 7 deletions contracts/deploy/019-AdminTransfer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,15 @@ export const AdminTransferByProxyStorageName = async (

const IProxyContract = await hre.ethers.getContractAt(ContractFactoryName.DefaultProxyInterface, ProxyAddr, deployer)
{
const implAddr = (await IProxyContract.implementation()).toLocaleLowerCase()
const admin = (await IProxyContract.admin()).toLocaleLowerCase()
if (implAddr === EmptyContractImplAddr.toLocaleLowerCase()) {
return `Proxy implementation address ${implAddr} should not be empty contract address ${EmptyContractImplAddr}`
}
if (admin !== deployerAddr) {
return `Proxy admin address ${admin} should deployer address ${deployerAddr}`
if (storageName != ProxyStorageName.L1USDCGatewayProxyStorageName) {
const implAddr = (await IProxyContract.implementation()).toLocaleLowerCase()
const admin = (await IProxyContract.admin()).toLocaleLowerCase()
if (implAddr === EmptyContractImplAddr.toLocaleLowerCase()) {
return `Proxy implementation address ${implAddr} should not be empty contract address ${EmptyContractImplAddr}`
}
if (admin !== deployerAddr) {
return `Proxy admin address ${admin} should deployer address ${deployerAddr}`
}
}
}
console.log(`change ${storageName} admin transfer from ${deployerAddr} to ProxyAdmin ${ProxyAdminImplAddr} `)
Expand Down
11 changes: 4 additions & 7 deletions contracts/deploy/020-ContractInit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export const ContractInit = async (
const L1StakingProxyAddress = getContractAddressByName(path, ProxyStorageName.L1StakingProxyStorageName)
const L1Staking = await hre.ethers.getContractAt(ContractFactoryName.L1Staking, L1StakingProxyAddress, deployer)
const whiteListAdd = config.l2SequencerAddresses
console.log("Add sequencer address to white list ", config.l2SequencerAddresses)
// set sequencer to white list
await L1Staking.updateWhitelist(whiteListAdd, [])
for (let i = 0; i < config.l2SequencerAddresses.length; i++) {
Expand All @@ -96,23 +97,19 @@ export const ContractInit = async (
// ------------------ router init -----------------
{
const L1WETHAddress = getContractAddressByName(path, ImplStorageName.WETH)
const L1USDCAddress = getContractAddressByName(path, ImplStorageName.USDC)

const L1WETHGatewayProxyAddress = getContractAddressByName(path, ProxyStorageName.L1WETHGatewayProxyStorageName)
const L1USDCGatewayProxyAddress = getContractAddressByName(path, ProxyStorageName.L1USDCGatewayProxyStorageName)

const L1GatewayRouterProxyAddress = getContractAddressByName(path, ProxyStorageName.L1GatewayRouterProxyStorageName)
const l1GatewayRouter = await hre.ethers.getContractAt(ContractFactoryName.L1GatewayRouter, L1GatewayRouterProxyAddress, deployer)

// set token gateway
const tokens = [L1WETHAddress,L1USDCAddress]
const gateways = [L1WETHGatewayProxyAddress,L1USDCGatewayProxyAddress]
const tokens = [L1WETHAddress]
const gateways = [L1WETHGatewayProxyAddress]
await l1GatewayRouter.setERC20Gateway(tokens, gateways)
await awaitCondition(
async () => {
return (
(await l1GatewayRouter.getERC20Gateway(L1WETHAddress)).toLocaleLowerCase() === L1WETHGatewayProxyAddress.toLocaleLowerCase() &&
(await l1GatewayRouter.getERC20Gateway(L1USDCAddress)).toLocaleLowerCase() === L1USDCGatewayProxyAddress.toLocaleLowerCase()
(await l1GatewayRouter.getERC20Gateway(L1WETHAddress)).toLocaleLowerCase() === L1WETHGatewayProxyAddress.toLocaleLowerCase()
)
},
3000,
Expand Down
1 change: 0 additions & 1 deletion contracts/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,4 @@ export const predeploys = {
L2ReverseERC20Gateway: "0x5300000000000000000000000000000000000018",
L2WithdrawLockERC20Gateway: "0x5300000000000000000000000000000000000019",
L2USDCGateway: "0x5300000000000000000000000000000000000020",
L2USDC: "0x5300000000000000000000000000000000000021",
};
2 changes: 0 additions & 2 deletions contracts/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const ContractFactoryName = {
// tokens
WETH: 'WrappedEther',
MockERC20: 'MockERC20',
USDC:'FiatTokenV1',
// messenger
L1CrossDomainMessenger: 'L1CrossDomainMessenger',
L1MessageQueueWithGasPriceOracle: 'L1MessageQueueWithGasPriceOracle',
Expand Down Expand Up @@ -63,7 +62,6 @@ const ImplStorageName = {
EmptyContract: 'Impl__EmptyContract',
// tokens
WETH: 'Impl__WETH',
USDC: 'Impl__USDC',
// messenger
L1CrossDomainMessengerStorageName: 'Impl__L1CrossDomainMessenger',
L1MessageQueueWithGasPriceOracle: 'Impl__L1MessageQueueWithGasPriceOracle',
Expand Down
2 changes: 1 addition & 1 deletion go-ethereum
Submodule go-ethereum updated 58 files
+0 −1 .github/CODEOWNERS
+0 −17 .github/workflows/cherry_pick.yml
+44 −12 Dockerfile
+25 −0 Dockerfile.mockccc
+20 −0 Dockerfile.mockccc.alpine
+16 −2 Makefile
+14 −3 MakefileEc2.mk
+3 −0 cmd/geth/main.go
+2 −0 cmd/geth/usage.go
+28 −0 cmd/utils/flags.go
+3 −0 consensus/errors.go
+114 −0 core/block_validator.go
+10 −1 core/blockchain_test.go
+0 −3 core/error.go
+0 −5 core/gaspool.go
+0 −23 core/genesis.go
+51 −0 core/rawdb/accessors_row_consumption.go
+24 −0 core/rawdb/accessors_row_consumption_test.go
+9 −3 core/rawdb/accessors_skipped_txs.go
+5 −5 core/rawdb/accessors_skipped_txs_test.go
+8 −0 core/rawdb/schema.go
+4 −0 core/types.go
+2 −1 core/types/block.go
+13 −5 core/types/gen_batch.go
+41 −0 core/types/gen_row_consumption_json.go
+2 −2 core/types/rollup_batch.go
+15 −0 core/types/row_consumption.go
+1 −0 core/types/transaction.go
+9 −1 entrypoint.sh
+21 −10 eth/api.go
+5 −0 eth/backend.go
+1 −0 eth/catalyst/api_types.go
+6 −0 eth/catalyst/gen_l2_ed.go
+12 −2 eth/catalyst/l2_api.go
+133 −0 eth/catalyst/l2_api_test.go
+6 −0 eth/ethconfig/gen_config.go
+32 −2 ethclient/ethclient.go
+1 −0 genesis_l2.json
+60 −28 miner/miner.go
+781 −0 miner/miner_test.go
+684 −0 miner/pipeline.go
+195 −358 miner/worker.go
+6 −3 params/config.go
+12 −10 rollup/batch/block_context.go
+5 −5 rollup/batch/handler.go
+230 −0 rollup/circuitcapacitychecker/impl.go
+4 −0 rollup/circuitcapacitychecker/libzkp/.gitignore
+4,465 −0 rollup/circuitcapacitychecker/libzkp/Cargo.lock
+42 −0 rollup/circuitcapacitychecker/libzkp/Cargo.toml
+10 −0 rollup/circuitcapacitychecker/libzkp/Makefile
+13 −0 rollup/circuitcapacitychecker/libzkp/libzkp.h
+1 −0 rollup/circuitcapacitychecker/libzkp/rust-toolchain
+320 −0 rollup/circuitcapacitychecker/libzkp/src/lib.rs
+133 −0 rollup/circuitcapacitychecker/mock.go
+26 −0 rollup/circuitcapacitychecker/types.go
+9 −1 run-testnet-sentry.sh
+9 −1 run-testnet-sequencer.sh
+9 −1 run-testnet-validator.sh
64 changes: 0 additions & 64 deletions ops/l2-genesis/morph-chain-ops/genesis/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,10 @@ type DeployConfig struct {
L1ERC721GatewayProxy common.Address `json:"l1ERC721GatewayProxy"`
// L1ERC1155Gateway proxy address on L1
L1ERC1155GatewayProxy common.Address `json:"l1ERC1155GatewayProxy"`
// L1USDCGatewayProxy proxy address on L1
L1USDCGatewayProxy common.Address `json:"l1USDCGatewayProxy"`
// L1WETHGatewayProxy proxy address on L1
L1WETHGatewayProxy common.Address `json:"l1WETHGatewayProxy"`
// L1WETH address on L1
L1WETH common.Address `json:"l1WETH"`
// L1USDC address on L1
L1USDC common.Address `json:"l1USDC"`
// L1WithdrawLockERC20GatewayProxy proxy address on L1
L1WithdrawLockERC20Gateway common.Address `json:"l1WithdrawLockERC20Gateway"`

Expand Down Expand Up @@ -224,14 +220,6 @@ func (d *DeployConfig) GetDeployedAddresses(hh *hardhat.Hardhat) error {
d.L1WETHGatewayProxy = deployment.Address
}

if d.L1USDCGatewayProxy == (common.Address{}) {
deployment, err := hh.GetDeployment("Proxy__L1USDCGateway")
if err != nil {
return err
}
d.L1USDCGatewayProxy = deployment.Address
}

if d.L1WETH == (common.Address{}) {
deployment, err := hh.GetDeployment("Impl__WETH")
if err != nil {
Expand All @@ -240,14 +228,6 @@ func (d *DeployConfig) GetDeployedAddresses(hh *hardhat.Hardhat) error {
d.L1WETH = deployment.Address
}

if d.L1USDC == (common.Address{}) {
deployment, err := hh.GetDeployment("Impl__USDC")
if err != nil {
return err
}
d.L1USDC = deployment.Address
}

if d.L1WithdrawLockERC20Gateway == (common.Address{}) {
deployment, err := hh.GetDeployment("Proxy__L1WithdrawLockERC20Gateway")
if err != nil {
Expand Down Expand Up @@ -341,48 +321,24 @@ func NewL2ImmutableConfig(config *DeployConfig) (immutables.ImmutableConfig, *im
if config.L1WETHGatewayProxy == (common.Address{}) {
return immutable, nil, fmt.Errorf("L1WETHGatewayProxy cannot be address(0): %w", ErrInvalidImmutablesConfig)
}
if config.L1USDCGatewayProxy == (common.Address{}) {
return immutable, nil, fmt.Errorf("L1USDCGatewayProxy cannot be address(0): %w", ErrInvalidImmutablesConfig)
}
if config.L1WithdrawLockERC20Gateway == (common.Address{}) {
return immutable, nil, fmt.Errorf("L1WithdrawLockERC20Gateway cannot be address(0): %w", ErrInvalidImmutablesConfig)
}
if config.L1WETH == (common.Address{}) {
return immutable, nil, fmt.Errorf("L1WETH cannot be address(0): %w", ErrInvalidImmutablesConfig)
}
if config.L1USDC == (common.Address{}) {
return immutable, nil, fmt.Errorf("L1USDC cannot be address(0): %w", ErrInvalidImmutablesConfig)
}
immutable["L2Staking"] = immutables.ImmutableValues{
"OTHER_STAKING": config.L1StakingProxy,
}
immutable["L2WETHGateway"] = immutables.ImmutableValues{
"l1WETH": config.L1WETH,
}
immutable["L2USDCGateway"] = immutables.ImmutableValues{
"l1USDC": config.L1USDC,
}
blsKeys := make([][]byte, len(config.L2StakingBlsKeys))
for i, v := range config.L2StakingBlsKeys {
blsKeys[i] = v
}

imConfig := &immutables.InitConfig{
// L2USDC
USDCTokenName: "Bridged USDC",
USDCTokenSymbol: "USDC.e",
USDCTokenCurrency: "USD",
USDCTokenDecimals: 18,
USDCMasterMinter: config.FinalSystemOwner,
USDCPauser: config.FinalSystemOwner,
USDCBlackLister: config.FinalSystemOwner,
USDCOwner: config.FinalSystemOwner,
// MorphToken
//MorphTokenOwner: config.MorphTokenOwner,
//MorphTokenName: config.MorphTokenName,
//MorphTokenSymbol: config.MorphTokenSymbol,
//MorphTokenInitialSupply: config.MorphTokenInitialSupply,
//MorphTokenDailyInflationRate: config.MorphTokenDailyInflationRate,
// L2Staking
L2StakingOwner: config.FinalSystemOwner,
L2StakingSequencersMaxSize: config.L2StakingSequencerMaxSize,
Expand Down Expand Up @@ -588,15 +544,6 @@ func NewL2StorageConfig(config *DeployConfig, baseFee *big.Int) (state.StorageCo
"router": predeploys.L2GatewayRouterAddr,
"messenger": predeploys.L2CrossDomainMessengerAddr,
}
storage["L2USDCGateway"] = state.StorageValues{
"_status": 1, // ReentrancyGuard
"_initialized": 1,
"_initializing": false,
"_owner": config.FinalSystemOwner,
"counterpart": config.L1USDCGatewayProxy,
"router": predeploys.L2GatewayRouterAddr,
"messenger": predeploys.L2CrossDomainMessengerAddr,
}
storage["L2WithdrawLockERC20Gateway"] = state.StorageValues{
"_status": 1, // ReentrancyGuard
"_initialized": 1,
Expand Down Expand Up @@ -628,17 +575,6 @@ func NewL2StorageConfig(config *DeployConfig, baseFee *big.Int) (state.StorageCo
"_owner": predeploys.L2StandardERC20GatewayAddr,
"implementation": predeploys.MorphStandardERC20Addr,
}
storage["L2USDC"] = state.StorageValues{
"initialized": true,
"name": "Bridged USDC",
"symbol": "USDC.e",
"currency": "USD",
"decimals": 18,
"masterMinter": config.FinalSystemOwner,
"pauser": config.FinalSystemOwner,
"blacklister": config.FinalSystemOwner,
"_owner": config.FinalSystemOwner,
}
return storage, nil
}

Expand Down
Loading