Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check that Weth gateways are registered in the deployment test #72

Merged
merged 2 commits into from
Mar 5, 2024
Merged
Changes from 1 commit
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
43 changes: 34 additions & 9 deletions test-e2e/tokenBridgeDeploymentTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ describe('tokenBridge', () => {
if (!usingFeeToken) {
await checkL1WethGatewayInitialization(
L1WethGateway__factory.connect(l1Deployment.wethGateway, l1Provider),
L1GatewayRouter__factory.connect(l1Deployment.router, l1Provider),
l1Deployment,
l2Deployment,
rollupAddresses
Expand Down Expand Up @@ -164,6 +165,7 @@ describe('tokenBridge', () => {
if (!usingFeeToken) {
await checkL2WethGatewayInitialization(
L2WethGateway__factory.connect(l2Deployment.wethGateway, l2Provider),
L2GatewayRouter__factory.connect(l2Deployment.router, l2Provider),
l1Deployment,
l2Deployment
)
Expand All @@ -174,14 +176,20 @@ describe('tokenBridge', () => {
UpgradeExecutorABI,
l1Provider
)
await checkL1UpgradeExecutorInitialization(l1UpgradeExecutor, rollupAddresses);
await checkL1UpgradeExecutorInitialization(
l1UpgradeExecutor,
rollupAddresses
)

const l2UpgradeExecutor = new ethers.Contract(
l2Deployment.upgradeExecutor,
UpgradeExecutorABI,
l2Provider
)
await checkL2UpgradeExecutorInitialization(l2UpgradeExecutor, rollupAddresses)
await checkL2UpgradeExecutorInitialization(
l2UpgradeExecutor,
rollupAddresses
)

await checkL1Ownership(l1Deployment, rollupAddresses)
await checkL2Ownership(l2Deployment, usingFeeToken)
Expand Down Expand Up @@ -278,6 +286,7 @@ async function checkL1CustomGatewayInitialization(

async function checkL1WethGatewayInitialization(
l1WethGateway: L1WethGateway,
l1Router: L1GatewayRouter,
l1Deployment: L1DeploymentAddresses,
l2Deployment: L2DeploymentAddresses,
rollupAddresses: RollupAddresses
Expand All @@ -296,13 +305,20 @@ async function checkL1WethGatewayInitialization(
rollupAddresses.inbox.toLowerCase()
)

expect((await l1WethGateway.l1Weth()).toLowerCase()).to.not.be.eq(
ethers.constants.AddressZero
)
const l1WethAddress = await l1WethGateway.l1Weth()
expect(l1WethAddress.toLowerCase()).to.not.be.eq(ethers.constants.AddressZero)

expect((await l1WethGateway.l2Weth()).toLowerCase()).to.not.be.eq(
ethers.constants.AddressZero
)

expect(await l1Router.l1TokenToGateway(l1WethAddress)).to.be.eq(
l1WethGateway.address
)

expect(await l1Router.getGateway(l1WethAddress)).to.be.eq(
l1WethGateway.address
)
}

async function checkL1UpgradeExecutorInitialization(
Expand All @@ -316,7 +332,8 @@ async function checkL1UpgradeExecutorInitialization(
const executorRole = await l1Executor.EXECUTOR_ROLE()

expect(await l1Executor.hasRole(adminRole, l1Executor.address)).to.be.true
expect(await l1Executor.hasRole(executorRole, rollupAddresses.rollupOwner)).to.be.true
expect(await l1Executor.hasRole(executorRole, rollupAddresses.rollupOwner)).to
.be.true
}

async function checkL2UpgradeExecutorInitialization(
Expand Down Expand Up @@ -434,6 +451,7 @@ async function checkL2CustomGatewayInitialization(

async function checkL2WethGatewayInitialization(
l2WethGateway: L2WethGateway,
l2Router: L2GatewayRouter,
l1Deployment: L1DeploymentAddresses,
l2Deployment: L2DeploymentAddresses
) {
Expand All @@ -447,13 +465,20 @@ async function checkL2WethGatewayInitialization(
l2Deployment.router.toLowerCase()
)

expect((await l2WethGateway.l1Weth()).toLowerCase()).to.not.be.eq(
ethers.constants.AddressZero
)
const l1WethAddress = await l2WethGateway.l1Weth()
expect(l1WethAddress.toLowerCase()).to.not.be.eq(ethers.constants.AddressZero)

expect((await l2WethGateway.l2Weth()).toLowerCase()).to.not.be.eq(
ethers.constants.AddressZero
)

expect(await l2Router.l1TokenToGateway(l1WethAddress)).to.be.eq(
l2WethGateway.address
)

expect(await l2Router.getGateway(l1WethAddress)).to.be.eq(
l2WethGateway.address
)
}

async function checkL2MulticallInitialization(l2Multicall: ArbMulticall2) {
Expand Down
Loading