feat: add evm and wasm files

This commit is contained in:
adrian
2025-09-15 17:10:52 +02:00
committed by Adrian Benavides
parent 46cfaefbd6
commit d728440048
167 changed files with 206 additions and 25 deletions

View File

@@ -1,3 +0,0 @@
*/target/
**/target/
**/src/

View File

@@ -8454,7 +8454,8 @@ dependencies = [
[[package]]
name = "tycho-simulation"
version = "0.158.0"
version = "0.159.0"
source = "git+https://github.com/propeller-heads/tycho-simulation.git?tag=0.159.0#d9e801b60adc5b31942ef5a5ff0701d3459d8ba3"
dependencies = [
"alloy",
"async-stream",

View File

@@ -5,9 +5,9 @@ Rust-based integration testing framework for Tycho protocol implementations.
## How to Run
```bash
# Build the images
docker buildx build -f postgres.Dockerfile -t protocol-testing-db:latest --load .
docker buildx build -f run.Dockerfile -t protocol-testing-test-runner:latest --load .
# Build the images, from the project root dir
docker buildx build -f protocol-testing/postgres.Dockerfile -t protocol-testing-db:latest --load .
docker buildx build -f protocol-testing/run.Dockerfile -t protocol-testing-test-runner:latest --load .
# Export necessary env vars
export RPC_URL=..

View File

@@ -2,6 +2,8 @@ services:
db:
image: protocol-testing-db:latest
restart: "always"
logging:
driver: "none"
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U postgres" ]
interval: 1s

View File

@@ -15,6 +15,7 @@ fi
for test in "${args[@]}"; do
protocol="${test%%=*}"
filter="${test#*=}"
echo "Running tests for protocol: $protocol with filter: $filter"
if [[ "$test" == *"="* ]]; then
tycho-protocol-sdk --package "$protocol" --db-url "$DATABASE_URL" --match-test "$filter"
else

View File

@@ -1,17 +1,30 @@
# Stage 1: Build tycho-indexer
# Stage 0: Install cargo-chef
FROM rust:1.89-bookworm AS cargo-chef
WORKDIR /app
RUN cargo install cargo-chef
# Stage 1: Prepare and cache dependencies for tycho-indexer
FROM rust:1.89-bookworm AS tycho-indexer-chef
WORKDIR /build/tycho-indexer
RUN apt-get update && apt-get install -y git
RUN git clone --depth 1 --branch "0.83.4" https://github.com/propeller-heads/tycho-indexer.git .
COPY --from=cargo-chef /usr/local/cargo/bin/cargo-chef /usr/local/cargo/bin/cargo-chef
RUN cargo chef prepare --recipe-path recipe.json
RUN cargo chef cook --release --recipe-path recipe.json
# Stage 2: Build tycho-indexer
FROM rust:1.89-bookworm AS tycho-indexer-builder
WORKDIR /build
RUN apt-get update && apt-get install -y git
RUN git clone --depth 1 --branch "0.83.4" https://github.com/propeller-heads/tycho-indexer.git
WORKDIR /build/tycho-indexer
COPY --from=tycho-indexer-chef /build/tycho-indexer/ ./
COPY --from=tycho-indexer-chef /usr/local/cargo/bin/cargo-chef /usr/local/cargo/bin/cargo-chef
RUN cargo build --release --bin tycho-indexer
# Stage 2: Get substreams CLI
# Stage 3: Get substreams CLI
FROM ghcr.io/streamingfast/substreams:v1.16.4 AS substreams-cli
# Stage 3: Install Foundry (Forge)
# Stage 4: Install Foundry (Forge)
FROM debian:bookworm AS foundry-builder
WORKDIR /build
@@ -19,27 +32,42 @@ RUN apt-get update && apt-get install -y curl git
RUN curl -L https://foundry.paradigm.xyz | bash
RUN /root/.foundry/bin/foundryup
# Stage 4: Build protocol-testing and substreams
# Stage 5: Prepare and cache dependencies for protocol-sdk
FROM rust:1.89-bookworm AS protocol-sdk-chef
WORKDIR /build/tycho-protocol-sdk
RUN apt-get update && apt-get install -y git
RUN git clone --depth 1 https://github.com/propeller-heads/tycho-protocol-sdk.git .
#COPY . .
COPY --from=cargo-chef /usr/local/cargo/bin/cargo-chef /usr/local/cargo/bin/cargo-chef
WORKDIR /build/tycho-protocol-sdk/protocol-testing
RUN ls -la
RUN cargo chef prepare --recipe-path recipe.json
RUN cargo chef cook --release --recipe-path recipe.json
# Stage 6: Build protocol-testing and substreams
FROM rust:1.89-bookworm AS protocol-sdk-builder
WORKDIR /build
RUN apt-get update && apt-get install -y git
RUN git clone --depth 1 https://github.com/propeller-heads/tycho-protocol-sdk.git
WORKDIR /build/tycho-protocol-sdk
COPY --from=protocol-sdk-chef /build/tycho-protocol-sdk/ ./
COPY --from=protocol-sdk-chef /usr/local/cargo/bin/cargo-chef /usr/local/cargo/bin/cargo-chef
WORKDIR /build/tycho-protocol-sdk/protocol-testing
RUN cargo build --release
WORKDIR /build/tycho-protocol-sdk/substreams
#COPY ./substreams/target/wasm32-unknown-unknown/release/*.wasm ./target/wasm32-unknown-unknown/release/
#COPY ./substreams/target/wasm32-unknown-unknown/release/*.d ./target/wasm32-unknown-unknown/release/
RUN cargo build --target wasm32-unknown-unknown --release
WORKDIR /build/tycho-protocol-sdk/evm
#COPY ./evm/out ./out
COPY --from=foundry-builder /root/.foundry/bin/forge /usr/local/bin/forge
RUN chmod +x /usr/local/bin/forge
RUN forge install
RUN forge build
# Stage 5: Final image
# Stage 7: Final image
FROM debian:bookworm
RUN apt-get update && apt-get install -y ca-certificates libssl-dev libpq-dev
@@ -47,6 +75,8 @@ RUN apt-get update && apt-get install -y ca-certificates libssl-dev libpq-dev
# Copy binaries from previous stages
COPY --from=tycho-indexer-builder /build/tycho-indexer/target/release/tycho-indexer /usr/local/bin/tycho-indexer
COPY --from=protocol-sdk-builder /build/tycho-protocol-sdk/protocol-testing/target/release/protocol-testing /usr/local/bin/tycho-protocol-sdk
COPY --from=protocol-sdk-builder /build/tycho-protocol-sdk/protocol-testing/entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
COPY --from=protocol-sdk-builder /build/tycho-protocol-sdk/substreams /app/substreams
COPY --from=protocol-sdk-builder /build/tycho-protocol-sdk/proto /app/proto
COPY --from=protocol-sdk-builder /build/tycho-protocol-sdk/evm /app/evm
@@ -60,7 +90,4 @@ RUN tycho-indexer --version && tycho-protocol-sdk --version && substreams --vers
# Entrypoint script to run tests
WORKDIR /app
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]