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

test: add custom gas token e2e tests #1960

Open
wants to merge 69 commits into
base: master
Choose a base branch
from
Open

Conversation

brtkx
Copy link
Contributor

@brtkx brtkx commented Oct 3, 2024

No description provided.

@cla-bot cla-bot bot added the cla-signed label Oct 3, 2024
Copy link

vercel bot commented Oct 3, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
arbitrum-token-bridge ✅ Ready (Inspect) Visit Preview Oct 10, 2024 10:05am

nitro-testnode-ref: aab133aceadec2e622f15fa438f6327e3165392d
l3-node: ${{ matrix.test.type == 'orbit' }}
no-l3-token-bridge: ${{ matrix.test.type != 'orbit' }}
nitro-testnode-ref: badbcbea9b43d46e115da4d7c9f2f57c31af8431
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a newer tag that funds the wallet with native currency on L2. You can see the change here:
OffchainLabs/nitro-testnode@badbcbe

import { Layout } from '../components/common/Layout'
import { siteTitle } from './_document'

import '../styles/tailwind.css'
import '../styles/purple.css'
import { isUserRejectedError } from '../util/isUserRejectedError'

if (
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Register local network is async now so we do it when importing the component. See index.tsx

process.env.NODE_ENV !== 'production' ||
process.env.NEXT_PUBLIC_IS_E2E_TEST
) {
await registerLocalNetwork()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because it's async we do it before rendering the component

process.env.NODE_ENV !== 'production' ||
process.env.NEXT_PUBLIC_IS_E2E_TEST
) {
await registerLocalNetwork()
Copy link
Contributor Author

@brtkx brtkx Oct 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to register networks so that it recognises L3 local and doesn't change the chain to default

bridge: '0xA584795e24628D9c067A6480b033C9E96281fcA3',
inbox: '0xDcA690902d3154886Ec259308258D10EA5450996',
outbox: '0xda243bD61B011024FC923164db75Dde198AC6175',
rollup: process.env.NEXT_PUBLIC_IS_E2E_TEST
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same issue as with other local chains, different address in CI

@@ -358,14 +396,34 @@ export const localL3NetworkRpcUrl = loadEnvironmentVariableWithFallback({
fallback: 'http://127.0.0.1:3347'
})

export function registerLocalNetwork() {
export async function registerLocalNetwork(isLocalCustomNativeToken?: boolean) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We fetch native token to see if it exists, this way we know it's a custom native token local chain. But we also need a way to specify it e.g. in e2e synpress setup because then fetching the token will fail

@@ -92,11 +102,14 @@ export const getL2TestnetNetworkConfig = (): NetworkConfig => {
export const ERC20TokenName = 'Test Arbitrum Token'
export const ERC20TokenSymbol = 'TESTARB'
export const ERC20TokenDecimals = 18
export const invalidTokenAddress = '0x0000000000000000000000000000000000000000'
export const invalidTokenAddress = utils.computeAddress(utils.randomBytes(32))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with custom fee token WETH is deployed to zero address for some reason, we use a random address instead

@brtkx brtkx marked this pull request as ready for review October 10, 2024 09:21
@spsjvc spsjvc changed the title feat: custom fee token chains e2e test: add custom gas token e2e tests Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant