diff --git a/substreams/crates/tycho-substreams/Readme.md b/substreams/crates/tycho-substreams/Readme.md index 44394fc..5b07f57 100644 --- a/substreams/crates/tycho-substreams/Readme.md +++ b/substreams/crates/tycho-substreams/Readme.md @@ -11,5 +11,5 @@ To generate the rust structs run the following command from within the root directory: ```bash -buf generate --template substreams/crates/tycho-substreams/buf.gen.yaml --output substreams/crates/tycho-substreams/ +buf generate --template substreams/crates/tycho-substreams/buf.gen.yaml --output substreams/crates/tycho-substreams/ ``` diff --git a/testing/.env.default b/testing/.env.default index d24058b..0e246f9 100644 --- a/testing/.env.default +++ b/testing/.env.default @@ -1,3 +1,2 @@ export RPC_URL=https://mainnet.infura.io/v3/your-infura-key export SUBSTREAMS_API_TOKEN="changeme" -export DOMAIN_OWNER="AWSAccountId" diff --git a/testing/README.md b/testing/README.md index 0fb0ee1..af848d8 100644 --- a/testing/README.md +++ b/testing/README.md @@ -36,21 +36,22 @@ The script to generate this file manually is available under `evm/scripts/buildR ## Setup testing environment -### Step 1: Export Environment Variables +## Prerequisites -**DOMAIN_OWNER** +Before setting up the Python environment, ensure the following tools and libraries are installed on your system: -- **Description**: The domain owner identifier for Propellerhead's AWS account, used for authenticating on the private - PyPI repository. -- **Example**: `export DOMAIN_OWNER=123456789` +- **Git**: Version control tool (https://git-scm.com/) +- **Rust**: Programming language and toolchain (https://www.rust-lang.org/) +- **GCC**: GNU Compiler Collection (https://gcc.gnu.org/) +- **libpq**: PostgreSQL client library (https://www.postgresql.org/docs/9.5/libpq.html) +- **OpenSSL (libssl)**: OpenSSL development library (https://github.com/openssl/openssl) +- **pkg-config**: Helper tool for managing compiler flags (https://www.freedesktop.org/wiki/Software/pkg-config/) +- **Conda**: Python package manager (https://docs.conda.io/en/latest/) +- **pip**: Python package installer (https://pip.pypa.io/) -### Step 2: Create python virtual environment for testing - -Run setup env script. It will create a conda virtual env and install all dependencies. +Run the setup env script. It will create a conda virtual env and install all dependencies. This script must be run from within the `tycho-protocol-sdk/testing` directory. -Please note that some dependencies require access to our private PyPI repository. - ``` setup_env.sh ``` diff --git a/testing/pre_build.sh b/testing/pre_build.sh deleted file mode 100755 index 342aed4..0000000 --- a/testing/pre_build.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -# Enable automatic export of all defined variables -set -a - -# Source the .env file -source .env - -# Disable automatic export (optional, if you want to stop exporting variables) -set +a - -# Check if DOMAIN_OWNER is set -if [ -z "$DOMAIN_OWNER" ]; then - echo "DOMAIN_OWNER environment variable is not set." - return 1 -fi - -# Fetch the CODEARTIFACT_AUTH_TOKEN -CODEARTIFACT_AUTH_TOKEN=$(aws --region eu-central-1 codeartifact get-authorization-token --domain propeller --domain-owner $DOMAIN_OWNER --query authorizationToken --output text --duration 1800) - -# Set the PIP_INDEX_URL -PIP_INDEX_URL="https://aws:${CODEARTIFACT_AUTH_TOKEN}@propeller-${DOMAIN_OWNER}.d.codeartifact.eu-central-1.amazonaws.com/pypi/protosim/simple/" - -# Export the variables -export CODEARTIFACT_AUTH_TOKEN -export PIP_INDEX_URL \ No newline at end of file diff --git a/testing/requirements.txt b/testing/requirements.txt index f1366ad..32a4fac 100644 --- a/testing/requirements.txt +++ b/testing/requirements.txt @@ -2,5 +2,5 @@ psycopg2==2.9.9 PyYAML==6.0.1 Requests==2.32.2 web3==5.31.3 -tycho-indexer-client>=0.7.2 -tycho-simulation-py>=0.32.0 +git+https://github.com/propeller-heads/tycho-indexer.git@0.49.0#subdirectory=tycho-client-py +git+https://github.com/propeller-heads/tycho-simulation.git@0.69.0#subdirectory=tycho_simulation_py \ No newline at end of file diff --git a/testing/setup_env.sh b/testing/setup_env.sh index 6c7be54..7e7df06 100755 --- a/testing/setup_env.sh +++ b/testing/setup_env.sh @@ -1,5 +1,32 @@ #!/bin/bash +command_exists() { + command -v "$1" >/dev/null 2>&1 +} + +# Map of dependencies to their binaries (used to check if they are installed) +declare -A dependencies=( + ["git"]="git" + ["rust"]="rustc" + ["gcc"]="gcc" + ["openssl"]="openssl" + ["pkg-config"]="pkg-config" + ["conda"]="conda" + ["pip"]="pip" + ["libpq"]="pg_config" +) + +# Check each dependency +for dep in "${!dependencies[@]}"; do + binary=${dependencies[$dep]} + if ! command_exists "$binary"; then + echo "Error: '$dep' is not installed." + exit 1 + fi +done + +echo "All dependencies are installed. Proceeding with setup..." + # Variables ENV_NAME="tycho-protocol-sdk-testing" PYTHON_VERSION="3.9" @@ -15,8 +42,7 @@ source activate $ENV_NAME # Install the requirements echo "Installing the requirements from ${REQUIREMENTS_FILE}..." -source ./pre_build.sh -pip install -r $REQUIREMENTS_FILE +pip install -r $REQUIREMENTS_FILE --index-url https://pypi.org/simple conda activate $ENV_NAME echo "Setup complete." \ No newline at end of file