How to Run
Last updated
Last updated
Before continuing, ensure the following tools and libraries are installed on your system:
: Containerization platform for running applications in isolated environments.
: Package and environment manager for Python and other languages.
: Tool to manage AWS services from the command line.
: Version control tool
: Programming language and toolchain
: GNU Compiler Collection
: PostgreSQL client library
: OpenSSL development library
: Helper tool for managing compiler flags
: Python package manager
: Python package installer
The testing system relies on an EVM Archive node to fetch the state from a previous block. Indexing only with Substreams, as done in Tycho's production mode, requires syncing blocks since the protocol's deployment date, which can take a long time. The node skips this requirement by fetching all the required account's storage slots on the block specified in the testing yaml
file.
The node also needs to support the method, as it's a requirement for our Token Quality Analysis.
If the command above does not provide the expected output, you need to (re)install Tycho.
If you're running on a MacOS (either Apple Silicon or Intel) - or any architecture that is not supported by pre-built releases, you need to compile the Tycho Indexer:
Step 1: Clone Tycho-Indexer repo
Step 2: Build the binary in release mode
Step 3: Link the binary to a directory in your system's PATH:
NOTE: This command requires
/usr/local/bin
to be included in the system'sPATH.
While this is typically the case, there may be exceptions.If
/usr/local/bin
is not in yourPATH
, you can either:
Add it to your
PATH
by exporting it:Or create a symlink in any of the following directories (if they are in your
PATH
):
Step 4: Verify Installation
The target Substreams config file.
The corresponding SwapAdapter and args to build it.
The expected protocol types.
The tests to be run.
Each test will index all blocks between start-block
and stop-block
, verify that the indexed state matches the expected state, and optionally simulate transactions using the provided SwapAdapter
.
This script must be run from within the tycho-protocol-sdk/testing
directory.
Lastly, you need to activate the conda env:
Export the required environment variables for the execution. You can find the available environment variables in the .env.default
file. Please create a .env
file in the testing
directory and set the required environment variables.
RPC_URL
Description: The URL for the Ethereum RPC endpoint. This is used to fetch the storage data.
Example: export RPC_URL="https://ethereum-mainnet.core.chainstack.com/123123123123"
SUBSTREAMS_API_TOKEN
Example: export SUBSTREAMS_API_TOKEN=eyJhbGci...
If you do not have one already, you must build the wasm file of the package you wish to test. This can be done by navigating to the package directory and running:
Then, run a local Postgres test database using docker-compose.
Run tests for your package. This must be done from the main project directory.
Example
If you want to run tests for ethereum-balancer-v2
, use:
Testing CLI args
A list and description of all available CLI args can be found using:
The testing module runs a minified version of . You can ensure that the latest version is correctly setup in your PATH by running the following command on your terminal:
We provide a binary compiled for Linux x86/x64 architecture on our GitHub page.
Navigate to the page, locate the latest version (e.g.: 0.54.0)
and download the tycho-indexer-x86_64-unknown-linux-gnu-{version}.tar.gz
file.
Tests are defined in a yaml
file. A documented template can be found at . The configuration file should include:
You will also need the VM Runtime file for the adapter contract. Our testing script should be able to build it using your test config. The script to generate this file manually is available under .
To set up your test environment, run the . It will create a Conda virtual env and install all the required dependencies.
The node needs to be an archive node and support method.
Description: The JWT token for accessing Substreams services. This token is required for authentication. Please refer to guide to setup and validate your token.