[go: up one dir, main page]

Tezt/Etherlink: Add Tezt Cloud scenario for UniswapV2 benchmark

What

This merge request introduces a new Tezt Cloud scenario for running the UniswapV2 benchmark on an Etherlink sequencer. It involves a significant refactoring of the existing Etherlink benchmark tests into a reusable library and adds the necessary infrastructure to run these benchmarks in the Tezt Cloud environment.

Why

The primary goal is to enable performance testing and benchmarking of the Etherlink EVM node in a controlled and automated cloud environment. By integrating the UniswapV2 benchmark into Tezt Cloud, we can easily run complex, realistic scenarios, gather performance metrics, and detect regressions in a systematic way.

How

The changes can be broken down into three main parts:

  1. Benchmark Library Extraction: The core logic for the Etherlink benchmarks, including contract deployments, Uniswap interactions, and utility functions, has been extracted from etherlink/tezt/benchmarks/ into a new library, etherlink_benchmark_lib, located at etherlink/tezt/benchmarks/lib/. This modularization allows the benchmark code to be reused across different test environments.

  2. Tezt Cloud Scenario: A new Tezt Cloud scenario is defined in tezt/tests/cloud/etherlink.ml. This scenario sets up a sandboxed Etherlink sequencer and uses the new etherlink_benchmark_lib to deploy and run the UniswapV2 swap benchmark. New CLI options have been added in tezt/tests/cloud/scenarios_cli.ml to configure and launch this scenario.

  3. EVM Node Configuration: The Evm_node Tezt library has been updated to better support these cloud scenarios. It now allows the initial kernel path to be optional (enabling the use of pre-configured kernels like "mainnet") and supports specifying pre-funded addresses for sandbox mode, which is useful for setting up test accounts. Build files (dune, opam, manifest) have been updated accordingly to include the new library and its dependencies.

Manually testing

To run this tezt-cloud scenario, first setup your gcloud environmenmt

  gcloud auth application-default login
  gcloud config set project tezlink

If you run Docker on mac os, enable host networking and add the flag --macosx to the command below.

The scenario can then be started with

  dune exec tezt/tests/cloud/main.exe -- ETHERLINK \
    --tezt-cloud etherlink --destroy \
    --machine-type c2d-standard-8 \
    --docker-host-network \
    --I 20 \ # number of iterations (defaults to 1000)
    --network braeburn -i

You can benchmark different combinations of network context and kernel using the --network and --kernel options. See the --help for more benchmark options to control the number of iterations, swap hops, accounts, etc.

Edited by Alain Mebsout

Merge request reports

Loading