Files
linea-monorepo/e2e
Andrei A. 390d6ff860 Feat/122 Add TokenBridge e2e tests (#210)
* fix: add mutex in account manager to avoid nonce issue

* fix: optimize global setup

* Limiting number of concurrent traces API requests for the local stack to avoid occasional OOM-s

* Limiting number of verticles for Traces API node

* Add E2E TokenBridge tests

* fixing test and adding concurency

* fixing test and adding concurency

* fixing test and adding concurency

* fixing test and adding concurency

* fixing nonce management

* deploying l2token for the L2 -> L1 test

* adjusting accounts for L2->L1 test

* adjusting l2TestContractAddress

* use nonce management for L1->L2 test

* adjusting the TestERC20 contract and tests

* rebasing with fix/133-improve-e2e-tests-performance

* fix: update jest config to exit even if there are open handles

* Trying out Besu untuned and raising limit per endpoint to 2 for traces

* Trying out Besu untuned and raising limit per endpoint to 2 for traces and Shomei node

* Using besu untuned for arithmetization as well

* Compile once and parallelise setRemoteTokenBridge

* feat: deploy smart contracts from artifacts + change e2e tests setup

* fix: update pnpm

* fix: remove compile contracts gradle task

* fix: remove compileContracts gradle task

* fix: refactor genesis generator dockerfile + downgrade l1-el-node besu version

* fix: move abi from e2e folder to contract folder + refactor contracts deployments scripts

* feat: add deployment script from artifacts for LineaRollupV6

* update pnpm version in get-started.md

* fix: update console log in deployment scripts

* fix: update besu version + fix deployment scripts

* correct addresses

* fix import

* use abi and bytecode for deployments

* use upgradable beacon for BridgedToken ABI deploys

* use saved abi and bytecode for TestERC20 deploy

* correct deployBridgedTokenAndTokenBridge casing

* optimize token bridge e2e calls

* use explicit message event data

* use precomputed nonces for e2e stack

---------

Co-authored-by: VGau <victorien.gauch@consensys.net>
Co-authored-by: Victorien Gauch <85494462+VGau@users.noreply.github.com>
Co-authored-by: Roman <4833306+Filter94@users.noreply.github.com>
Co-authored-by: thedarkjester <grant.southey@consensys.net>
Co-authored-by: The Dark Jester <thedarkjester@users.noreply.github.com>
2024-10-31 18:03:53 +01:00
..
2024-07-31 18:17:20 +02:00
2024-07-31 18:17:20 +02:00
2024-07-31 18:17:20 +02:00
2024-07-31 18:17:20 +02:00
2024-07-31 18:17:20 +02:00
2024-07-31 18:17:20 +02:00

End to end tests

Setup

Run pnpm install to setup typechain

Run make fresh-start-all from root directory to spin up local environment

Run tests

ENV Command Description
Local pnpm run test:e2e:local Uses already running docker environment and deployed smart contracts
DEV pnpm run test:e2e:dev Uses DEV env, may need to update constants in constants.dev.ts
UAT pnpm run test:e2e:uat Uses UAT env, may need to update constants in constants.uat.ts

Remote workflows

Workflow options:

  • e2e-tests-with-ssh - Enable to run Setup upterm session step, manually ssh into the github actions workflow using the steps output, can be used to debug containers.
    • The step will output a string used to connect to the workflow.
    • Example: ssh XTpun7OCRZMgaCZkiHqU:MWNlNmQ0OGEudm0udXB0ZXJtLmludGVybmFsOjIyMjI=@uptermd.upterm.dev
    • After connecting create a new file called continue in the root directory: touch continue
  • e2e-tests-logs-dump - Enable to print logs after e2e tests have ran

Debugging test in vscode

Install the vscode-jest plugin and open zkevm-monorepo/e2e/ directory. Use the following config in zkevm-monorepo/e2e/.vscode/settings.json

{
  "jest.autoRun": { "watch": false },
  "jest.jestCommandLine": "pnpm run test:e2e:vscode --",
}

and the following config in zkevm-monorepo/e2e/.vscode/launch.json

{
    "configurations": [
        {
            "type": "node",
            "name": "vscode-jest-tests.v2",
            "request": "launch",
            "program": "${workspaceFolder}/node_modules/.bin/jest",
            "args": [
                "--config",
                "./jest.vscode.config.js",
                "--detectOpenHandles",
                "--runInBand",
                "--watchAll=false",
                "--testNamePattern",
                "${jest.testNamePattern}",
                "--runTestsByPath",
                "${jest.testFile}"
            ],
            "cwd": "${workspaceFolder}",
            "console": "integratedTerminal",
            "internalConsoleOptions": "neverOpen",
            "disableOptimisticBPs": true,
            "windows": {
                "program": "${workspaceFolder}/node_modules/jest/bin/jest"
            }
        }
    
    ]
}

Now you should be able to run and debug individual tests from the Testing explorer tab.