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

feat: run e2e for custom fee token chains #1811

Draft
wants to merge 35 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
83b2b4b
init
brtkx Jul 24, 2024
1dd83cd
Merge branch 'master' of github.com:OffchainLabs/arbitrum-token-bridg…
brtkx Jul 24, 2024
0aaa3e2
more changes
brtkx Jul 24, 2024
0313da6
fix build
brtkx Jul 24, 2024
545ddf5
fix
brtkx Jul 24, 2024
cbc158d
try
brtkx Jul 24, 2024
96f6c0c
revert
brtkx Jul 24, 2024
4a29486
fixes
brtkx Jul 24, 2024
d4a2199
run redeem test
brtkx Jul 25, 2024
8fd3742
Merge branch 'master' of github.com:OffchainLabs/arbitrum-token-bridg…
brtkx Jul 25, 2024
3a64e1b
fix and cleanup
brtkx Jul 25, 2024
ded123b
Merge branch 'master' of github.com:OffchainLabs/arbitrum-token-bridg…
brtkx Jul 25, 2024
3bd8df8
fix and cleanup
brtkx Jul 25, 2024
98c4cb9
remove testing mock
brtkx Jul 25, 2024
cc288ed
fixes after merge
brtkx Jul 25, 2024
b736a5e
fixes
brtkx Jul 25, 2024
c6b9b36
Merge branch 'master' into l3-e2e
brtkx Jul 25, 2024
6165988
nit
brtkx Jul 25, 2024
cb59c7b
Merge branch 'master' of github.com:OffchainLabs/arbitrum-token-bridg…
brtkx Jul 25, 2024
97f50a4
merge
brtkx Jul 25, 2024
fd31688
Merge branch 'master' of github.com:OffchainLabs/arbitrum-token-bridg…
brtkx Jul 25, 2024
d2f9238
update
brtkx Jul 25, 2024
6cbd689
Merge branch 'master' of github.com:OffchainLabs/arbitrum-token-bridg…
brtkx Jul 25, 2024
571d343
update
brtkx Jul 25, 2024
af2d42b
revert
brtkx Jul 25, 2024
28a0003
Merge branch 'master' of github.com:OffchainLabs/arbitrum-token-bridg…
brtkx Jul 26, 2024
00e7bec
update readme
brtkx Jul 26, 2024
c5866bb
init
brtkx Jul 29, 2024
20921b3
Merge branch 'master' of github.com:OffchainLabs/arbitrum-token-bridg…
brtkx Jul 29, 2024
c660d04
fix
brtkx Jul 29, 2024
9b985b5
fix
brtkx Jul 29, 2024
8fb2c0e
fix
brtkx Jul 29, 2024
4d2bdaa
fix
brtkx Jul 29, 2024
c5562a3
fix
brtkx Jul 29, 2024
6e4908b
fix arg
brtkx Jul 29, 2024
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
19 changes: 14 additions & 5 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -160,16 +160,19 @@ jobs:

# based on https://github.com/Synthetixio/synpress/blob/dev/.github/workflows/e2e_cypress-action.yml
test-e2e:
name: "Test E2E${{ matrix.orbit-test == '1' && ' with L3' || '' }} - ${{ matrix.tests.name }}"
name: "Test E2E${{ matrix.custom-fee-token == '1' && ' with L3 (non-ETH)' || matrix.orbit-test == '1' && ' with L3 (ETH)' || '' }} - ${{ matrix.tests.name }}"
runs-on: ubuntu-latest
needs: [build, check-files, check-is-hotfix, load-e2e-files]
if: needs.check-files.outputs.run_tests == 'true' && needs.check-is-hotfix.outputs.is_hotfix == 'false'
strategy:
fail-fast: false # If one test fails, let the other tests run
matrix:
tests:
${{ fromJson(needs.load-e2e-files.outputs.matrix) }}
tests: ${{ fromJson(needs.load-e2e-files.outputs.matrix) }}
orbit-test: ['0', '1']
custom-fee-token: ['0', '1']
exclude:
- orbit-test: '0'
custom-fee-token: '1'

steps:
- name: Free Disk Space (Ubuntu)
Expand Down Expand Up @@ -219,12 +222,18 @@ jobs:
nitro-testnode-ref: aab133aceadec2e622f15fa438f6327e3165392d
l3-node: ${{ matrix.orbit-test == '1' }}
no-l3-token-bridge: ${{ matrix.orbit-test == '0' }}
args: ${{ matrix.custom-fee-token == '1' && '--l3-fee-token' || '' }}

- name: Run e2e tests via cypress-io/github-action
uses: cypress-io/github-action@8d3918616d8ac34caa2b49afc8b408b6a872a6f5 # [email protected]
with:
start: yarn start
command: ${{ matrix.orbit-test == '1' && 'yarn test:e2e:orbit --browser chromium' || 'yarn test:e2e --browser chromium' }}
start: ${{ matrix.custom-fee-token == '1' && 'NEXT_PUBLIC_CUSTOM_FEE_TOKEN=true yarn start' || 'yarn start' }}
command: >-
${{
(matrix.orbit-test == '1' && matrix.custom-fee-token == '1') && 'yarn test:e2e:orbit --browser chromium' ||
(matrix.orbit-test == '1' && matrix.custom-fee-token == '0') && 'yarn test:e2e:orbit --browser chromium' ||
'yarn test:e2e --browser chromium'
}}
wait-on: http://127.0.0.1:3000
wait-on-timeout: 120
spec: ./packages/arb-token-bridge-ui/tests/e2e/specs/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -852,13 +852,18 @@ export function TransferPanel() {
)
}

console.log('transfer before')
console.log({ signer })

// finally, call the transfer function
const transfer = await bridgeTransferStarter.transfer({
amount: amountBigNumber,
signer,
destinationAddress
})

console.log('transfer post')

// transaction submitted callback
onTxSubmit(transfer)
} catch (ex) {
Expand Down
2 changes: 2 additions & 0 deletions packages/arb-token-bridge-ui/src/hooks/useClaimWithdrawal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ export function useClaimWithdrawal(
})
}
} catch (error: any) {
console.log('HERE-0')
err = error
} finally {
setIsClaiming(false)
Expand All @@ -108,6 +109,7 @@ export function useClaimWithdrawal(

Sentry.captureException(err)
if (!res) {
console.log('HERE-1')
errorToast(`Can't claim withdrawal: ${err?.message ?? err}`)
}

Expand Down
1 change: 1 addition & 0 deletions packages/arb-token-bridge-ui/src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
decodeChainQueryParam,
encodeChainQueryParam
} from '../hooks/useArbQueryParams'
import { utils } from 'ethers'

const App = dynamic(() => import('../components/App/App'), {
ssr: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export class EthWithdrawalStarter extends BridgeTransferStarter {
}

public async transferEstimateGas({ amount, signer }: TransferEstimateGas) {
console.log('here')
const address = (await getAddressFromSigner(signer)) as `0x${string}`

return withdrawInitTxEstimateGas({
Expand All @@ -46,6 +47,7 @@ export class EthWithdrawalStarter extends BridgeTransferStarter {
}

public async transfer({ amount, signer }: TransferProps) {
console.log('here0')
const address = await getAddressFromSigner(signer)
const ethBridger = await EthBridger.fromProvider(this.sourceChainProvider)

Expand All @@ -66,6 +68,8 @@ export class EthWithdrawalStarter extends BridgeTransferStarter {
}
})

console.log({ tx })

return {
transferType: this.transferType,
status: 'pending',
Expand Down
98 changes: 65 additions & 33 deletions packages/arb-token-bridge-ui/src/util/networks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -304,39 +304,71 @@ export const defaultL2Network: ArbitrumNetwork = {
}
}

export const defaultL3Network: ArbitrumNetwork = {
chainId: 333333,
parentChainId: ChainId.ArbitrumLocal,
confirmPeriodBlocks: 20,
ethBridge: {
bridge: '0xA584795e24628D9c067A6480b033C9E96281fcA3',
inbox: '0xDcA690902d3154886Ec259308258D10EA5450996',
outbox: '0xda243bD61B011024FC923164db75Dde198AC6175',
rollup: process.env.NEXT_PUBLIC_IS_E2E_TEST
? '0xdeD540257498027B1De7DFD4fe6cc4CeC030F355'
: '0xf9B0F86aCc3e42B7DF373c9a8adb2803BF0a7662',
sequencerInbox: '0x16c54EE2015CD824415c2077F4103f444E00A8cb'
},
isCustom: true,
name: 'L3 Local',
retryableLifetimeSeconds: 604800,
tokenBridge: {
parentCustomGateway: '0xA191D519260A06b32f8D04c84b9F457B8Caa0514',
parentErc20Gateway: '0x6B0805Fc6e275ef66a0901D0CE68805631E271e5',
parentGatewayRouter: '0xfE03DBdf7A126994dBd749631D7fbaB58C618c58',
parentMultiCall: '0x20a3627Dcc53756E38aE3F92717DE9B23617b422',
parentProxyAdmin: '0x1A61102c26ad3f64bA715B444C93388491fd8E68',
parentWeth: '0xA1abD387192e3bb4e84D3109181F9f005aBaF5CA',
parentWethGateway: '0x77603b0ea6a797C74Fa9ef11b5BdE04A4E03D550',
childCustomGateway: '0xD4816AeF8f85A3C1E01Cd071a81daD4fa941625f',
childErc20Gateway: '0xaa7d51aFFEeB32d99b1CB2fd6d81D7adA4a896e8',
childGatewayRouter: '0x8B6BC759226f8Fe687c8aD8Cc0DbF85E095e9297',
childMultiCall: '0x052B15c8Ff0544287AE689C4F2FC53A3905d7Db3',
childProxyAdmin: '0x36C56eC2CF3a3f53db9F01d0A5Ae84b36fb0A1e2',
childWeth: '0x582a8dBc77f665dF2c49Ce0a138978e9267dd968',
childWethGateway: '0xA6AB233B3c7bfd0399834897b5073974A3D467e2'
}
}
export const defaultL3Network: ArbitrumNetwork =
Copy link
Contributor Author

Choose a reason for hiding this comment

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

You need to change those because the generated L3 network has different addresses with custom fee token

process.env.NEXT_PUBLIC_CUSTOM_FEE_TOKEN === 'true'
? {
chainId: 333333,
parentChainId: ChainId.ArbitrumLocal,
confirmPeriodBlocks: 20,
ethBridge: {
bridge: '0xA584795e24628D9c067A6480b033C9E96281fcA3',
inbox: '0xDcA690902d3154886Ec259308258D10EA5450996',
outbox: '0xda243bD61B011024FC923164db75Dde198AC6175',
rollup: '0x7a23F33C1C384eFc11b8Cf207420c464ba2959CC',
sequencerInbox: '0x16c54EE2015CD824415c2077F4103f444E00A8cb'
},
nativeToken: '0xE069078bA9ACCE4eeAE609d8754515Cf13dd6706',
isCustom: true,
name: 'L3 Local',
retryableLifetimeSeconds: 604800,
tokenBridge: {
parentCustomGateway: '0xCe02eA568090ae7d5184B0a98df90f6aa69C1552',
parentErc20Gateway: '0x59156b0596689D965Ba707E160e5370AF22461a0',
parentGatewayRouter: '0x0C085152C2799834fc1603533ff6916fa1FdA302',
parentMultiCall: '0x20a3627Dcc53756E38aE3F92717DE9B23617b422',
parentProxyAdmin: '0x1A61102c26ad3f64bA715B444C93388491fd8E68',
parentWeth: '0x0000000000000000000000000000000000000000',
parentWethGateway: '0x59156b0596689D965Ba707E160e5370AF22461a0',
childCustomGateway: '0xD4816AeF8f85A3C1E01Cd071a81daD4fa941625f',
childErc20Gateway: '0xaa7d51aFFEeB32d99b1CB2fd6d81D7adA4a896e8',
childGatewayRouter: '0x8B6BC759226f8Fe687c8aD8Cc0DbF85E095e9297',
childMultiCall: '0x052B15c8Ff0544287AE689C4F2FC53A3905d7Db3',
childProxyAdmin: '0x36C56eC2CF3a3f53db9F01d0A5Ae84b36fb0A1e2',
childWeth: '0x0000000000000000000000000000000000000000',
childWethGateway: '0x0000000000000000000000000000000000000000'
}
}
: {
chainId: 333333,
parentChainId: ChainId.ArbitrumLocal,
confirmPeriodBlocks: 20,
ethBridge: {
bridge: '0xA584795e24628D9c067A6480b033C9E96281fcA3',
inbox: '0xDcA690902d3154886Ec259308258D10EA5450996',
outbox: '0xda243bD61B011024FC923164db75Dde198AC6175',
rollup: '0xf9B0F86aCc3e42B7DF373c9a8adb2803BF0a7662',
sequencerInbox: '0x16c54EE2015CD824415c2077F4103f444E00A8cb'
},
isCustom: true,
name: 'L3 Local',
retryableLifetimeSeconds: 604800,
tokenBridge: {
parentCustomGateway: '0xA191D519260A06b32f8D04c84b9F457B8Caa0514',
parentErc20Gateway: '0x6B0805Fc6e275ef66a0901D0CE68805631E271e5',
parentGatewayRouter: '0xfE03DBdf7A126994dBd749631D7fbaB58C618c58',
parentMultiCall: '0x20a3627Dcc53756E38aE3F92717DE9B23617b422',
parentProxyAdmin: '0x1A61102c26ad3f64bA715B444C93388491fd8E68',
parentWeth: '0xA1abD387192e3bb4e84D3109181F9f005aBaF5CA',
parentWethGateway: '0x77603b0ea6a797C74Fa9ef11b5BdE04A4E03D550',
childCustomGateway: '0xD4816AeF8f85A3C1E01Cd071a81daD4fa941625f',
childErc20Gateway: '0xaa7d51aFFEeB32d99b1CB2fd6d81D7adA4a896e8',
childGatewayRouter: '0x8B6BC759226f8Fe687c8aD8Cc0DbF85E095e9297',
childMultiCall: '0x052B15c8Ff0544287AE689C4F2FC53A3905d7Db3',
childProxyAdmin: '0x36C56eC2CF3a3f53db9F01d0A5Ae84b36fb0A1e2',
childWeth: '0x582a8dBc77f665dF2c49Ce0a138978e9267dd968',
childWethGateway: '0xA6AB233B3c7bfd0399834897b5073974A3D467e2'
}
}

export const localL1NetworkRpcUrl = loadEnvironmentVariableWithFallback({
env: process.env.NEXT_PUBLIC_LOCAL_ETHEREUM_RPC_URL,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,14 @@ export const localL3Network: Chain = {
id: ChainId.L3Local,
name: 'L3 Local',
network: 'l3-localhost',
nativeCurrency: ether,
nativeCurrency:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Need to add this so that the custom fee token is detected

process.env.NEXT_PUBLIC_CUSTOM_FEE_TOKEN === 'true'
? {
name: 'testnode',
symbol: 'TN',
decimals: 18
}
: ether,
rpcUrls: {
default: {
http: [rpcURLs[ChainId.L3Local]!]
Expand Down
Loading
Loading