Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
}
44 changes: 0 additions & 44 deletions contracts/deploy/013-DeployProxys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,10 @@ export const deployContractProxies = async (
const L1ERC1155GatewayProxyStorageName = ProxyStorageName.L1ERC1155GatewayProxyStorageName
const EnforcedTxGatewayProxyStorageName = ProxyStorageName.EnforcedTxGatewayProxyStorageName
const L1WETHGatewayProxyStorageName = ProxyStorageName.L1WETHGatewayProxyStorageName
const L1USDCGatewayProxyStorageName = ProxyStorageName.L1USDCGatewayProxyStorageName

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 +90,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 Expand Up @@ -216,12 +178,6 @@ export const deployContractProxies = async (
return err
}

// L1USDCGatewayProxy deploy
err = await deployContractProxyByStorageName(hre, path, deployer, L1USDCGatewayProxyStorageName)
if (err != "") {
return err
}
// return nil
return ""
}

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
6 changes: 0 additions & 6 deletions contracts/deploy/019-AdminTransfer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ export const AdminTransfer = async (
const L1ERC1155GatewayProxyStorageName = ProxyStorageName.L1ERC1155GatewayProxyStorageName
const EnforcedTxGatewayProxyStorageName = ProxyStorageName.EnforcedTxGatewayProxyStorageName
const L1WETHGatewayProxyStorageName = ProxyStorageName.L1WETHGatewayProxyStorageName
const L1USDCGatewayProxyStorageName = ProxyStorageName.L1USDCGatewayProxyStorageName

// ************************ messenger contracts admin change ************************
// L1CrossDomainMessengerProxy admin change
Expand Down Expand Up @@ -160,11 +159,6 @@ export const AdminTransfer = async (
return err
}

// L1USDCGatewayProxy admin change
err = await AdminTransferByProxyStorageName(hre, path, deployer, L1USDCGatewayProxyStorageName)
if (err != '') {
return err
}
return ''
}

Expand Down
10 changes: 3 additions & 7 deletions contracts/deploy/020-ContractInit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,23 +96,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
Loading