Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an adversarial stress tester for the query service #1277

Merged
merged 7 commits into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,6 @@ ESPRESSO_STATE_PROVER_UPDATE_INTERVAL=10m
# Load generator
ESPRESSO_SUBMIT_TRANSACTIONS_DELAY=1s
ESPRESSO_SUBMIT_TRANSACTIONS_PORT=44010

# Query service stress test
ESPRESSO_NASTY_CLIENT_PORT=44011
21 changes: 21 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ jobs:
target/release/reset-storage
target/release/deploy
target/release/keygen
target/release/nasty-client

build-arm:
runs-on: buildjet-4vcpu-ubuntu-2204-arm
Expand Down Expand Up @@ -114,6 +115,7 @@ jobs:
target/release/reset-storage
target/release/deploy
target/release/keygen
target/release/nasty-client

build-dockers:
runs-on: ubuntu-latest
Expand All @@ -127,6 +129,7 @@ jobs:
commitment-task-tag: ${{ steps.commitment-task.outputs.tags }}
submit-transactions-tag: ${{ steps.submit-transactions.outputs.tags }}
deploy-tag: ${{ steps.deploy.outputs.tags }}
nasty-client-tag: ${{ steps.nasty-client.outputs.tags }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
Expand Down Expand Up @@ -204,6 +207,12 @@ jobs:
with:
images: ghcr.io/espressosystems/espresso-sequencer/deploy

- name: Generate nasty-client metadata
uses: docker/metadata-action@v5
id: nasty-client
with:
images: ghcr.io/espressosystems/espresso-sequencer/nasty-client

- name: Build and push sequencer docker
uses: docker/build-push-action@v5
with:
Expand Down Expand Up @@ -284,6 +293,16 @@ jobs:
tags: ${{ steps.deploy.outputs.tags }}
labels: ${{ steps.deploy.outputs.labels }}

- name: Build and push nasty-client docker
uses: docker/build-push-action@v5
with:
context: ./
file: ./docker/nasty-client.Dockerfile
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.nasty-client.outputs.tags }}
labels: ${{ steps.nasty-client.outputs.labels }}

test-demo:
if: ${{ github.event_name != 'pull_request' }}
runs-on: ubuntu-latest
Expand All @@ -307,6 +326,7 @@ jobs:
docker pull ${{ needs.build-dockers.outputs.commitment-task-tag }}
docker pull ${{ needs.build-dockers.outputs.submit-transactions-tag }}
docker pull ${{ needs.build-dockers.outputs.deploy-tag }}
docker pull ${{ needs.build-dockers.outputs.nasty-client-tag }}
- name: Tag new docker images
run: |
docker tag ${{ needs.build-dockers.outputs.sequencer-tag }} ghcr.io/espressosystems/espresso-sequencer/sequencer:main
Expand All @@ -317,6 +337,7 @@ jobs:
docker tag ${{ needs.build-dockers.outputs.commitment-task-tag }} ghcr.io/espressosystems/espresso-sequencer/commitment-task:main
docker tag ${{ needs.build-dockers.outputs.submit-transactions-tag }} ghcr.io/espressosystems/espresso-sequencer/submit-transactions:main
docker tag ${{ needs.build-dockers.outputs.deploy-tag }} ghcr.io/espressosystems/espresso-sequencer/deploy:main
docker tag ${{ needs.build-dockers.outputs.nasty-client-tag }} ghcr.io/espressosystems/espresso-sequencer/nasty-client:main

- name: Test docker demo
run: |
Expand Down
32 changes: 7 additions & 25 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ jf-relation = { git = "https://github.com/EspressoSystems/jellyfish", tag = "0.4
] }
jf-utils = { git = "https://github.com/EspressoSystems/jellyfish", tag = "0.4.2" }
snafu = "0.8"
strum = { version = "0.26", features = ["derive"] }
surf-disco = { git = "https://github.com/EspressoSystems/surf-disco", tag = "v0.5.0" }
tagged-base64 = { git = "https://github.com/EspressoSystems/tagged-base64", tag = "0.3.4" }
tide-disco = { git = "https://github.com/EspressoSystems/tide-disco", tag = "v0.5.0" }
Expand Down
14 changes: 14 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,20 @@ services:
sequencer0:
condition: service_healthy

nasty-client:
image: ghcr.io/espressosystems/espresso-sequencer/nasty-client:main
ports:
- "$ESPRESSO_NASTY_CLIENT_PORT:$ESPRESSO_NASTY_CLIENT_PORT"
environment:
- ESPRESSO_SEQUENCER_URL
- ESPRESSO_NASTY_CLIENT_PORT
- RUST_LOG
- RUST_LOG_FORMAT
- ASYNC_STD_THREAD_COUNT
depends_on:
sequencer0:
condition: service_healthy

sequencer-db:
image: postgres
ports:
Expand Down
18 changes: 18 additions & 0 deletions docker/nasty-client.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM ubuntu:jammy

ARG TARGETARCH

RUN apt-get update \
&& apt-get install -y curl libcurl4 wait-for-it tini \
&& rm -rf /var/lib/apt/lists/*
ENTRYPOINT ["tini", "--"]

COPY target/$TARGETARCH/release/nasty-client /bin/nasty-client
RUN chmod +x /bin/nasty-client

# Run a web server on this port by default. Port can be overridden by the container orchestrator.
ENV ESPRESSO_NASTY_CLIENT_PORT=80

CMD [ "/bin/nasty-client"]
HEALTHCHECK --interval=1s --timeout=1s --retries=100 CMD curl --fail http://localhost:${ESPRESSO_NASTY_CLIENT_PORT}/healthcheck || exit 1
EXPOSE ${ESPRESSO_NASTY_CLIENT_PORT}
13 changes: 13 additions & 0 deletions process-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -250,3 +250,16 @@ processes:
port: $ESPRESSO_SUBMIT_TRANSACTIONS_PORT
path: /healthcheck
failure_threshold: 100

nasty-client:
command: nasty-client
depends_on:
sequencer0:
condition: process_healthy
readiness_probe:
http_get:
scheme: http
host: localhost
port: $ESPRESSO_NASTY_CLIENT_PORT
path: /healthcheck
failure_threshold: 100
3 changes: 2 additions & 1 deletion scripts/build-docker-images
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ for ARCH in "amd64" "arm64"; do
;;
esac
mkdir -p ${WORKDIR}/target/$ARCH/release
for binary in "orchestrator" "web-server" "sequencer" "commitment-task" "submit-transactions" "reset-storage" "state-relay-server" "state-prover" "deploy" "keygen"; do
for binary in "orchestrator" "web-server" "sequencer" "commitment-task" "submit-transactions" "reset-storage" "state-relay-server" "state-prover" "deploy" "keygen" "nasty-client"; do
cp -v "${CARGO_TARGET_DIR}/${TARGET}/release/$binary" ${WORKDIR}/target/$ARCH/release
done
done
Expand All @@ -46,3 +46,4 @@ docker build -t ghcr.io/espressosystems/espresso-sequencer/sequencer:main -f doc
docker build -t ghcr.io/espressosystems/espresso-sequencer/commitment-task:main -f docker/commitment-task.Dockerfile ${WORKDIR}
docker build -t ghcr.io/espressosystems/espresso-sequencer/submit-transactions:main -f docker/submit-transactions.Dockerfile ${WORKDIR}
docker build -t ghcr.io/espressosystems/espresso-sequencer/deploy:main -f docker/deploy.Dockerfile ${WORKDIR}
docker build -t ghcr.io/espressosystems/espresso-sequencer/nasty-client:main -f docker/nasty-client.Dockerfile ${WORKDIR}
3 changes: 2 additions & 1 deletion scripts/build-docker-images-native
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ cleanup(){
}

mkdir -p ${WORKDIR}/target/$ARCH/release
for binary in "orchestrator" "web-server" "sequencer" "commitment-task" "submit-transactions" "reset-storage" "state-relay-server" "state-prover" "deploy" "keygen"; do
for binary in "orchestrator" "web-server" "sequencer" "commitment-task" "submit-transactions" "reset-storage" "state-relay-server" "state-prover" "deploy" "keygen" "nasty-client"; do
cp -v "${CARGO_TARGET_DIR}/release/$binary" ${WORKDIR}/target/$ARCH/release
# Patch the interpreter for running without nix inside the ubuntu based docker image.
if [ $KERNEL == "linux" ]; then
Expand All @@ -89,3 +89,4 @@ docker build --platform $PLATFORM -t ghcr.io/espressosystems/espresso-sequencer/
docker build --platform $PLATFORM -t ghcr.io/espressosystems/espresso-sequencer/commitment-task:main -f docker/commitment-task.Dockerfile ${WORKDIR}
docker build --platform $PLATFORM -t ghcr.io/espressosystems/espresso-sequencer/submit-transactions:main -f docker/submit-transactions.Dockerfile ${WORKDIR}
docker build --platform $PLATFORM -t ghcr.io/espressosystems/espresso-sequencer/deploy:main -f docker/deploy.Dockerfile ${WORKDIR}
docker build --platform $PLATFORM -t ghcr.io/espressosystems/espresso-sequencer/nasty-client:main -f docker/nasty-client.Dockerfile ${WORKDIR}
1 change: 1 addition & 0 deletions sequencer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ serde = { workspace = true }
serde_json = "^1.0.113"
sha2 = "0.10" # TODO temporary, used only for VID, should be set in hotshot
snafu = { workspace = true }
strum = { workspace = true }
surf-disco = { workspace = true }
tide-disco = { workspace = true }
time = "0.3"
Expand Down
Loading
Loading