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:
-
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 atetherlink/tezt/benchmarks/lib/. This modularization allows the benchmark code to be reused across different test environments. -
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 newetherlink_benchmark_libto deploy and run the UniswapV2 swap benchmark. New CLI options have been added intezt/tests/cloud/scenarios_cli.mlto configure and launch this scenario. -
EVM Node Configuration: The
Evm_nodeTezt 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.