Skip to content

Commit cbca34c

Browse files
authored
[antithesis] Add initial test setup (#1166)
* [antithesis] Propose initial test setup * fixup: Simplify generation of docker compose artifacts * fixup: Ensure images will be pushed * fixup: Update to use refactored antithesis tooling from avalanchego * fixup: Update workload to use tmpnet * fixup: Add workload sanity check to CI job * fixup: Resolved workload errors * fixup: Generate deterministic keys * fixup: Fix invocation of gen_antithesis_compose_config * fixup: Update to use StoppedTimer * fixup: Respond to review feedback * fixup: Move embedded comment out of trigger action * fixup: Get image build test passing * fixup: Update how runtime plugin dir is provided * fixup: Update avalanchego version
1 parent b38dc2b commit cbca34c

20 files changed

+581
-11
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Publish Antithesis Images
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- master
8+
9+
env:
10+
REGISTRY: us-central1-docker.pkg.dev
11+
REPOSITORY: molten-verve-216720/avalanche-repository
12+
13+
jobs:
14+
antithesis:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout Repository
19+
uses: actions/checkout@v4
20+
21+
- name: Login to GAR
22+
uses: docker/login-action@v3
23+
with:
24+
registry: ${{ env.REGISTRY }}
25+
username: _json_key
26+
password: ${{ secrets.ANTITHESIS_GAR_JSON_KEY }}
27+
28+
- name: Build and publish images
29+
run: bash -x ./scripts/build_antithesis_images.sh
30+
env:
31+
IMAGE_PREFIX: ${{ env.REGISTRY }}/${{ env.REPOSITORY }}
32+
IMAGE_TAG: latest

.github/workflows/tests.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,3 +197,24 @@ jobs:
197197
run: scripts/mock.gen.sh
198198
- shell: bash
199199
run: .github/workflows/check-clean-branch.sh
200+
test_build_antithesis_images:
201+
name: Build Antithesis images
202+
runs-on: ubuntu-latest
203+
steps:
204+
- uses: actions/checkout@v4
205+
- uses: actions/setup-go@v5
206+
with:
207+
go-version: ${{ env.min_go_version }}
208+
check-latest: true
209+
- name: Install AvalancheGo Release
210+
shell: bash
211+
run: BASEDIR=/tmp/e2e-test AVALANCHEGO_BUILD_PATH=/tmp/e2e-test/avalanchego ./scripts/install_avalanchego_release.sh
212+
- name: Build Subnet-EVM Plugin Binary
213+
shell: bash
214+
run: ./scripts/build.sh
215+
- name: Check that the antithesis workload is sane
216+
shell: bash
217+
run: go run ./tests/antithesis --avalanchego-path=/tmp/e2e-test/avalanchego/avalanchego --duration=60s
218+
- name: Check antithesis image build
219+
shell: bash
220+
run: bash -x scripts/tests.build_antithesis_images.sh
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Trigger Antithesis
2+
3+
on:
4+
# TODO(marun) Add a schedule
5+
workflow_dispatch:
6+
inputs:
7+
duration:
8+
description: 'The duration (in hours) to run the test for'
9+
default: '0.5'
10+
required: true
11+
type: string
12+
recipients:
13+
description: 'Comma-seperated email addresses to send the test report to'
14+
required: true
15+
type: string
16+
image_tag:
17+
description: 'The image tag to target'
18+
default: latest
19+
required: true
20+
type: string
21+
22+
jobs:
23+
antithesis:
24+
name: Run Antithesis
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: antithesishq/[email protected]
28+
with:
29+
notebook_name: avalanche
30+
tenant: avalanche
31+
username: ${{ secrets.ANTITHESIS_USERNAME }}
32+
password: ${{ secrets.ANTITHESIS_PASSWORD }}
33+
github_token: ${{ secrets.ANTITHESIS_GH_PAT }}
34+
config_image: antithesis-subnet-evm-config:${{ github.event.inputs.image_tag || 'latest' }}
35+
images: antithesis-subnet-evm-workload:${{ github.event.inputs.image_tag || 'latest' }};antithesis-subnet-evm-node:${{ github.event.inputs.image_tag || 'latest' }}
36+
email_recipients: ${{ github.event.inputs.recipients || secrets.ANTITHESIS_RECIPIENTS }}
37+
# Duration is in hours
38+
additional_parameters: |-
39+
custom.duration=${{ github.event.inputs.duration || '11.25' }}
40+
custom.workload=subnet-evm

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,7 @@ cmd/simulator/simulator
5454
dist/
5555

5656
# Outputs of `scripts/diff_against.sh`
57-
diffs/
57+
diffs/
58+
59+
# clone used for antithesis image builds
60+
avalanchego/

Dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# syntax=docker/dockerfile:experimental
22

33
# ============= Setting up base Stage ================
4-
# Set required AVALANCHE_VERSION parameter in build image script
5-
ARG AVALANCHE_VERSION
4+
# AVALANCHEGO_NODE_IMAGE needs to identify an existing node image and should include the tag
5+
ARG AVALANCHEGO_NODE_IMAGE
66

77
# ============= Compilation Stage ================
88
FROM golang:1.21.12-bullseye AS builder
@@ -29,8 +29,8 @@ ARG CURRENT_BRANCH
2929
RUN export SUBNET_EVM_COMMIT=$SUBNET_EVM_COMMIT && export CURRENT_BRANCH=$CURRENT_BRANCH && ./scripts/build.sh build/subnet-evm
3030

3131
# ============= Cleanup Stage ================
32-
FROM avaplatform/avalanchego:$AVALANCHE_VERSION AS builtImage
32+
FROM $AVALANCHEGO_NODE_IMAGE AS builtImage
3333

3434
# Copy the evm binary into the correct location in the container
35-
ARG VM_ID
35+
ARG VM_ID=srEXiWaHuhNyGwPUi444Tu47ZEDwxTWrbQiuD7FmgSAQ6X7Dy
3636
COPY --from=builder /build/build/subnet-evm /avalanchego/build/plugins/$VM_ID

go.mod

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ go 1.21.12
44

55
require (
66
github.com/VictoriaMetrics/fastcache v1.12.1
7-
github.com/ava-labs/avalanchego v1.11.11-0.20240813203340-ab83fb41528d
7+
github.com/antithesishq/antithesis-sdk-go v0.3.8
8+
github.com/ava-labs/avalanchego v1.11.11-0.20240819192939-df91c2f4ab99
89
github.com/cespare/cp v0.1.0
910
github.com/crate-crypto/go-ipa v0.0.0-20231025140028-3c0104f4b233
1011
github.com/davecgh/go-spew v1.1.1
@@ -66,12 +67,16 @@ require (
6667
github.com/cockroachdb/pebble v0.0.0-20230928194634-aa077af62593 // indirect
6768
github.com/cockroachdb/redact v1.1.3 // indirect
6869
github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect
70+
github.com/compose-spec/compose-go v1.20.2 // indirect
6971
github.com/consensys/bavard v0.1.13 // indirect
7072
github.com/consensys/gnark-crypto v0.12.1 // indirect
7173
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
7274
github.com/crate-crypto/go-kzg-4844 v0.7.0 // indirect
7375
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect
76+
github.com/distribution/reference v0.5.0 // indirect
7477
github.com/dlclark/regexp2 v1.7.0 // indirect
78+
github.com/docker/go-connections v0.4.0 // indirect
79+
github.com/docker/go-units v0.5.0 // indirect
7580
github.com/ethereum/c-kzg-4844 v0.4.0 // indirect
7681
github.com/getsentry/sentry-go v0.18.0 // indirect
7782
github.com/go-logr/logr v1.4.1 // indirect
@@ -97,12 +102,14 @@ require (
97102
github.com/kr/text v0.2.0 // indirect
98103
github.com/magiconair/properties v1.8.6 // indirect
99104
github.com/mattn/go-runewidth v0.0.13 // indirect
105+
github.com/mattn/go-shellwords v1.0.12 // indirect
100106
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
101107
github.com/mitchellh/mapstructure v1.5.0 // indirect
102108
github.com/mitchellh/pointerstructure v1.2.0 // indirect
103109
github.com/mmcloughlin/addchain v0.4.0 // indirect
104110
github.com/mr-tron/base58 v1.2.0 // indirect
105111
github.com/nbutton23/zxcvbn-go v0.0.0-20180912185939-ae427f1e4c1d // indirect
112+
github.com/opencontainers/go-digest v1.0.0 // indirect
106113
github.com/pelletier/go-toml v1.9.5 // indirect
107114
github.com/pelletier/go-toml/v2 v2.0.5 // indirect
108115
github.com/pires/go-proxyproto v0.6.2 // indirect
@@ -114,6 +121,7 @@ require (
114121
github.com/rogpeppe/go-internal v1.10.0 // indirect
115122
github.com/rs/cors v1.7.0 // indirect
116123
github.com/russross/blackfriday/v2 v2.1.0 // indirect
124+
github.com/sirupsen/logrus v1.9.0 // indirect
117125
github.com/spf13/afero v1.8.2 // indirect
118126
github.com/spf13/jwalterweatherman v1.1.0 // indirect
119127
github.com/subosito/gotenv v1.3.0 // indirect

go.sum

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,11 @@ github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBA
5555
github.com/ajg/form v1.5.1/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY=
5656
github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156 h1:eMwmnE/GDgah4HI848JfFxHt+iPb26b4zyfspmqY0/8=
5757
github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM=
58+
github.com/antithesishq/antithesis-sdk-go v0.3.8 h1:OvGoHxIcOXFJLyn9IJQ5DzByZ3YVAWNBc394ObzDRb8=
59+
github.com/antithesishq/antithesis-sdk-go v0.3.8/go.mod h1:IUpT2DPAKh6i/YhSbt6Gl3v2yvUZjmKncl7U91fup7E=
5860
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
59-
github.com/ava-labs/avalanchego v1.11.11-0.20240813203340-ab83fb41528d h1:LyrKJL9avIIxBY3uTcS2dFtUMBFmI2QpAgG6qYTdA6s=
60-
github.com/ava-labs/avalanchego v1.11.11-0.20240813203340-ab83fb41528d/go.mod h1:UkyrRDXK2E15Lq2abyae2Pt+JsWvgsg1pe0/AtoMyAM=
61+
github.com/ava-labs/avalanchego v1.11.11-0.20240819192939-df91c2f4ab99 h1:fPWpINk7O1W4w5thqa8CGMRJ/kvycHvehBEiWwMjezI=
62+
github.com/ava-labs/avalanchego v1.11.11-0.20240819192939-df91c2f4ab99/go.mod h1:UkyrRDXK2E15Lq2abyae2Pt+JsWvgsg1pe0/AtoMyAM=
6163
github.com/ava-labs/coreth v0.13.8-fixed-genesis-upgrade.0.20240813194342-7635a96aa180 h1:6aIHp7wbyGVYdhHVQUbG7BEcbCMEQ5SYopPPJyipyvk=
6264
github.com/ava-labs/coreth v0.13.8-fixed-genesis-upgrade.0.20240813194342-7635a96aa180/go.mod h1:/wNBVq7J7wlC2Kbov7kk6LV5xZvau7VF9zwTVOeyAjY=
6365
github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g=
@@ -121,6 +123,8 @@ github.com/cockroachdb/redact v1.1.3/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZ
121123
github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 h1:zuQyyAKVxetITBuuhv3BI9cMrmStnpT18zmgmTxunpo=
122124
github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06/go.mod h1:7nc4anLGjupUW/PeY5qiNYsdNXj7zopG+eqsS7To5IQ=
123125
github.com/codegangsta/inject v0.0.0-20150114235600-33e0aa1cb7c0/go.mod h1:4Zcjuz89kmFXt9morQgcfYZAYZ5n8WHjt81YYWIwtTM=
126+
github.com/compose-spec/compose-go v1.20.2 h1:u/yfZHn4EaHGdidrZycWpxXgFffjYULlTbRfJ51ykjQ=
127+
github.com/compose-spec/compose-go v1.20.2/go.mod h1:+MdqXV4RA7wdFsahh/Kb8U0pAJqkg7mr4PM9tFKU8RM=
124128
github.com/consensys/bavard v0.1.13 h1:oLhMLOFGTLdlda/kma4VOJazblc7IM5y5QPd2A/YjhQ=
125129
github.com/consensys/bavard v0.1.13/go.mod h1:9ItSMtA/dXMAiL7BG6bqW2m3NdSEObYWoH223nGHukI=
126130
github.com/consensys/gnark-crypto v0.12.1 h1:lHH39WuuFgVHONRl3J0LRBtuYdQTumFSDtJF7HpyG8M=
@@ -150,9 +154,15 @@ github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0/go.mod h1:DZGJHZMqrU4JJqFAWUS2U
150154
github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218=
151155
github.com/dgraph-io/badger v1.6.0/go.mod h1:zwt7syl517jmP8s94KqSxTlM6IMsdhYy6psNgSztDR4=
152156
github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw=
157+
github.com/distribution/reference v0.5.0 h1:/FUIFXtfc/x2gpa5/VGfiGLuOIdYa1t65IKK2OFGvA0=
158+
github.com/distribution/reference v0.5.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E=
153159
github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc=
154160
github.com/dlclark/regexp2 v1.7.0 h1:7lJfhqlPssTb1WQx4yvTHN0uElPEv52sbaECrAQxjAo=
155161
github.com/dlclark/regexp2 v1.7.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8=
162+
github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ=
163+
github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec=
164+
github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4=
165+
github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
156166
github.com/dop251/goja v0.0.0-20211022113120-dc8c55024d06/go.mod h1:R9ET47fwRVRPZnOGvHxxhuZcbrMCuiqOz3Rlrh4KSnk=
157167
github.com/dop251/goja v0.0.0-20230806174421-c933cf95e127 h1:qwcF+vdFrvPSEUDSX5RVoRccG8a5DhOdWdQ4zN62zzo=
158168
github.com/dop251/goja v0.0.0-20230806174421-c933cf95e127/go.mod h1:QMWlm50DNe14hD7t24KEqZuUdC9sOTy8W6XbCU1mlw4=
@@ -410,6 +420,8 @@ github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/
410420
github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
411421
github.com/mattn/go-runewidth v0.0.13 h1:lTGmDsbAYt5DmK6OnoV7EuIF1wEIFAcxld6ypU4OSgU=
412422
github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
423+
github.com/mattn/go-shellwords v1.0.12 h1:M2zGm7EW6UQJvDeQxo4T51eKPurbeFbe8WtebGE2xrk=
424+
github.com/mattn/go-shellwords v1.0.12/go.mod h1:EZzvwXDESEeg03EKmM+RmDnNOPKG4lLtQsUlTZDWQ8Y=
413425
github.com/mattn/goveralls v0.0.2/go.mod h1:8d1ZMHsd7fW6IRPKQh46F2WRpyib5/X4FOpevwGNQEw=
414426
github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo=
415427
github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4=
@@ -462,6 +474,8 @@ github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAl
462474
github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro=
463475
github.com/onsi/gomega v1.29.0 h1:KIA/t2t5UBzoirT4H9tsML45GEbo3ouUnBHsCfD2tVg=
464476
github.com/onsi/gomega v1.29.0/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ=
477+
github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U=
478+
github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=
465479
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
466480
github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8=
467481
github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c=
@@ -508,6 +522,8 @@ github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAm
508522
github.com/shirou/gopsutil v3.21.11+incompatible h1:+1+c1VGhc88SSonWP6foOcLhvnKlUeu/erjjvaPEYiI=
509523
github.com/shirou/gopsutil v3.21.11+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
510524
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
525+
github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0=
526+
github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
511527
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
512528
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
513529
github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
@@ -797,6 +813,7 @@ golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBc
797813
golang.org/x/sys v0.0.0-20220310020820-b874c991c1a5/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
798814
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
799815
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
816+
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
800817
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
801818
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
802819
golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
@@ -1023,6 +1040,8 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C
10231040
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
10241041
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
10251042
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
1043+
gotest.tools/v3 v3.4.0 h1:ZazjZUfuVeZGLAmlKKuyv3IKP5orXcwtOwDQH6YVr6o=
1044+
gotest.tools/v3 v3.4.0/go.mod h1:CtbdzLSsqVhDgMtKsx03ird5YTGB3ar27v0u/yKBW5g=
10261045
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
10271046
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
10281047
honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=

scripts/build_antithesis_images.sh

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
# Builds docker images for antithesis testing.
6+
7+
# e.g.,
8+
# ./scripts/build_antithesis_images.sh # Build local images
9+
# IMAGE_PREFIX=<registry>/<repo> IMAGE_TAG=latest ./scripts/build_antithesis_images.sh # Specify a prefix to enable image push and use a specific tag
10+
11+
# Directory above this script
12+
SUBNET_EVM_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )"; cd .. && pwd )
13+
14+
# Allow configuring the clone path to point to a shared and/or existing clone of the avalanchego repo
15+
AVALANCHEGO_CLONE_PATH="${AVALANCHEGO_CLONE_PATH:-${SUBNET_EVM_PATH}/avalanchego}"
16+
17+
# Assume it's necessary to build the avalanchego node image from source
18+
# TODO(marun) Support use of a released node image if using a release version of avalanchego
19+
20+
source "${SUBNET_EVM_PATH}"/scripts/versions.sh
21+
source "${SUBNET_EVM_PATH}"/scripts/constants.sh
22+
23+
echo "checking out target avalanchego version ${AVALANCHE_VERSION}"
24+
if [[ -d "${AVALANCHEGO_CLONE_PATH}" ]]; then
25+
echo "updating existing clone"
26+
cd "${AVALANCHEGO_CLONE_PATH}"
27+
git fetch
28+
else
29+
echo "creating new clone"
30+
git clone https://github.com/ava-labs/avalanchego.git "${AVALANCHEGO_CLONE_PATH}"
31+
cd "${AVALANCHEGO_CLONE_PATH}"
32+
fi
33+
# Branch will be reset to $AVALANCHE_VERSION if it already exists
34+
git checkout -B "test-${AVALANCHE_VERSION}" "${AVALANCHE_VERSION}"
35+
cd "${SUBNET_EVM_PATH}"
36+
37+
AVALANCHEGO_COMMIT_HASH="$(git --git-dir="${AVALANCHEGO_CLONE_PATH}/.git" rev-parse HEAD)"
38+
AVALANCHEGO_IMAGE_TAG="${AVALANCHEGO_COMMIT_HASH::8}"
39+
40+
# Build avalanchego node image in the clone path
41+
pushd "${AVALANCHEGO_CLONE_PATH}" > /dev/null
42+
NODE_ONLY=1 TEST_SETUP=avalanchego IMAGE_TAG="${AVALANCHEGO_IMAGE_TAG}" bash -x "${AVALANCHEGO_CLONE_PATH}"/scripts/build_antithesis_images.sh
43+
popd > /dev/null
44+
45+
# Specifying an image prefix will ensure the image is pushed after build
46+
IMAGE_PREFIX="${IMAGE_PREFIX:-}"
47+
48+
IMAGE_TAG="${IMAGE_TAG:-}"
49+
if [[ -z "${IMAGE_TAG}" ]]; then
50+
# Default to tagging with the commit hash
51+
source "${SUBNET_EVM_PATH}"/scripts/constants.sh
52+
IMAGE_TAG="${SUBNET_EVM_COMMIT::8}"
53+
fi
54+
55+
# The dockerfiles don't specify the golang version to minimize the changes required to bump
56+
# the version. Instead, the golang version is provided as an argument.
57+
GO_VERSION="$(go list -m -f '{{.GoVersion}}')"
58+
59+
# Import common functions used to build images for antithesis test setups
60+
# shellcheck source=/dev/null
61+
source "${AVALANCHEGO_CLONE_PATH}"/scripts/lib_build_antithesis_images.sh
62+
63+
build_antithesis_builder_image "${GO_VERSION}" "antithesis-subnet-evm-builder:${IMAGE_TAG}" "${AVALANCHEGO_CLONE_PATH}" "${SUBNET_EVM_PATH}"
64+
65+
# Ensure avalanchego and subnet-evm binaries are available to create an initial db state that includes subnets.
66+
"${AVALANCHEGO_CLONE_PATH}"/scripts/build.sh
67+
"${SUBNET_EVM_PATH}"/scripts/build.sh
68+
69+
echo "Generating compose configuration"
70+
gen_antithesis_compose_config "${IMAGE_TAG}" "${SUBNET_EVM_PATH}/tests/antithesis/gencomposeconfig" \
71+
"${SUBNET_EVM_PATH}/build/antithesis" \
72+
"AVALANCHEGO_PATH=${AVALANCHEGO_CLONE_PATH}/build/avalanchego \
73+
AVALANCHEGO_PLUGIN_DIR=${DEFAULT_PLUGIN_DIR}"
74+
75+
build_antithesis_images "${GO_VERSION}" "${IMAGE_PREFIX}" "antithesis-subnet-evm" "${IMAGE_TAG}" \
76+
"${AVALANCHEGO_IMAGE_TAG}" "${SUBNET_EVM_PATH}/tests/antithesis/Dockerfile" \
77+
"${SUBNET_EVM_PATH}/Dockerfile" "${SUBNET_EVM_PATH}"

scripts/build_antithesis_workload.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
# Directory above this script
6+
SUBNET_EVM_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )"; cd .. && pwd )
7+
# Load the constants
8+
source "$SUBNET_EVM_PATH"/scripts/constants.sh
9+
10+
echo "Building Workload..."
11+
go build -o "$SUBNET_EVM_PATH/build/workload" "$SUBNET_EVM_PATH/tests/antithesis/"*.go

scripts/build_docker_image.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,13 @@ if [[ "${VM_ID}" != "${DEFAULT_VM_ID}" ]]; then
2020
DOCKERHUB_TAG="${VM_ID}-${DOCKERHUB_TAG}"
2121
fi
2222

23+
# Default to the release image. Will need to be overridden when testing against unreleased versions.
24+
AVALANCHE_NODE_IMAGE=${AVALANCHE_NODE_IMAGE:-"avaplatform/avalanchego:${AVALANCHE_VERSION}"}
25+
2326
echo "Building Docker Image: $DOCKERHUB_REPO:$BUILD_IMAGE_ID based of AvalancheGo@$AVALANCHE_VERSION"
2427
docker build -t "$DOCKERHUB_REPO:$BUILD_IMAGE_ID" -t "$DOCKERHUB_REPO:${DOCKERHUB_TAG}" \
2528
"$SUBNET_EVM_PATH" -f "$SUBNET_EVM_PATH/Dockerfile" \
26-
--build-arg AVALANCHE_VERSION="$AVALANCHE_VERSION" \
29+
--build-arg AVALANCHE_NODE_IMAGE="$AVALANCHE_NODE_IMAGE" \
2730
--build-arg SUBNET_EVM_COMMIT="$SUBNET_EVM_COMMIT" \
2831
--build-arg CURRENT_BRANCH="$CURRENT_BRANCH" \
2932
--build-arg VM_ID="$VM_ID"

0 commit comments

Comments
 (0)