-
Notifications
You must be signed in to change notification settings - Fork 3.5k
/
Copy pathjustfile
122 lines (105 loc) · 5.45 KB
/
justfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
set shell := ["/bin/bash", "-c"]
KURTOSIS_PACKAGE := "./optimism-package-trampoline/"
test:
go test --tags=testonly ./...
_kurtosis-run PACKAGE_NAME ARG_FILE ENCLAVE:
kurtosis run {{PACKAGE_NAME}} --args-file {{ARG_FILE}} --enclave {{ENCLAVE}} --show-enclave-inspect=false --image-download=missing
# Internal recipes for kurtosis-devnet.
# This builds the forge contracts and bundles them into a tarball,
# which is uploaded to the kurtosis enclave as a file artifact.
# We need to ensure that the tarball is reproducible (always has the same content)
# because kurtosis uses the md5 hash of the tarball to determine if it needs to be re-uploaded:
# https://github.com/kurtosis-tech/kurtosis/blob/bf315c6993d5e70a47265f1f41f0f7273fdd904b/core/server/api_container/server/startosis_engine/kurtosis_instruction/upload_files/upload_files.go#L206
# BSD tar on macOS doesn't support the --mtime flag, so we need to use GNU tar if we're on macOS.
# See https://unix.stackexchange.com/questions/438329/tar-produces-different-files-each-time
# Couldn't find gnu tar on mise so we're recommending it to be installed via brew.
_contracts-build BUNDLE='contracts-bundle.tar.gz':
#!/usr/bin/env bash
just ../packages/contracts-bedrock/forge-build
if tar --version | grep -q GNU; then
# Linux
GZIP=-n tar --mtime='1970-01-01 00:00:00' \
-czf {{BUNDLE}} -C ../packages/contracts-bedrock artifacts forge-artifacts cache
else
# macOS
if ! command -v gtar &> /dev/null; then
echo "GNU tar not found. Please install with: brew install gnu-tar"
exit 1
fi
GZIP=-n gtar --mtime='1970-01-01 00:00:00' \
-czf {{BUNDLE}} -C ../packages/contracts-bedrock artifacts forge-artifacts cache
fi
_prestate-build PATH='.':
docker buildx build --output {{PATH}} --progress plain -f ../op-program/Dockerfile.repro ../
_docker_build TAG TARGET CONTEXT DOCKERFILE *ARGS:
#!/usr/bin/env bash
# --load is needed to ensure the image ends up in the local registry
# --provenance=false is needed to make the build idempotent
docker buildx build \
--load \
--provenance=false \
-t {{TAG}} \
-f {{CONTEXT}}/{{DOCKERFILE}} \
{{ if TARGET != '' { "--target " + TARGET } else { "" } }} \
--build-arg GIT_COMMIT={git_commit} \
--build-arg GIT_DATE={git_date} \
{{ ARGS }} \
{{CONTEXT}}
_docker_build_stack TAG TARGET *ARGS: (_docker_build TAG TARGET "../" "ops/docker/op-stack-go/Dockerfile" ARGS)
cannon-image TAG='cannon:devnet': (_docker_build_stack TAG "cannon-target")
da-server-image TAG='da-server:devnet': (_docker_build_stack TAG "da-server-target")
op-batcher-image TAG='op-batcher:devnet': (_docker_build_stack TAG "op-batcher-target")
# TODO: this is a temporary hack to get the kona version right.
# Ideally the Dockerfile should be self-sufficient (right now we depend on
# docker-bake.hcl to do the right thing).
op-challenger-image TAG='op-challenger:devnet': (_docker_build_stack TAG "op-challenger-target" "--build-arg" "KONA_VERSION=kona-client-v0.1.0-beta.6")
op-conductor-image TAG='op-conductor:devnet': (_docker_build_stack TAG "op-conductor-target")
op-deployer-image TAG='op-deployer:devnet': (_docker_build_stack TAG "op-deployer-target")
op-dispute-mon-image TAG='op-dispute-mon:devnet': (_docker_build_stack TAG "op-dispute-mon-target")
op-node-image TAG='op-node:devnet': (_docker_build_stack TAG "op-node-target")
op-program-image TAG='op-program:devnet': (_docker_build_stack TAG "op-program-target")
op-proposer-image TAG='op-proposer:devnet': (_docker_build_stack TAG "op-proposer-target")
op-supervisor-image TAG='op-supervisor:devnet': (_docker_build_stack TAG "op-supervisor-target")
op-wheel-image TAG='op-wheel:devnet': (_docker_build_stack TAG "op-wheel-target")
# Devnet template recipe
devnet TEMPLATE_FILE DATA_FILE="" NAME="" PACKAGE=KURTOSIS_PACKAGE:
#!/usr/bin/env bash
export DEVNET_NAME={{NAME}}
if [ -z "{{NAME}}" ]; then
export DEVNET_NAME=`basename {{TEMPLATE_FILE}} .yaml`
if [ -n "{{DATA_FILE}}" ]; then
export DATA_FILE_NAME=`basename {{DATA_FILE}} .json`
export DEVNET_NAME="$DEVNET_NAME-$DATA_FILE_NAME"
fi
fi
export ENCL_NAME="$DEVNET_NAME"-devnet
go run cmd/main.go -kurtosis-package {{PACKAGE}} \
-environment "tests/$ENCL_NAME.json" \
-template "{{TEMPLATE_FILE}}" \
-data "{{DATA_FILE}}" \
-enclave "$ENCL_NAME" \
&& cat "tests/$ENCL_NAME.json"
devnet-test DEVNET *TEST:
#!/usr/bin/env bash
export TESTS=({{TEST}})
# we need a timestamp in there to force kurtosis to not cache the test solely based on its name!
export ARGS=$(printf '%s\n' "${TESTS[@]}" | jq -R . | jq -s . | jq -s '{devnet: "{{DEVNET}}", timestamp: "{{datetime("%s")}}", tests: add}')
kurtosis run --enclave {{DEVNET}} \
--show-enclave-inspect=false \
./tests/ "$ARGS"
# Devnet recipes
# Simple devnet
simple-devnet: (devnet "simple.yaml")
# Interop devnet
interop-devnet: (devnet "interop.yaml")
interop-devnet-test: (devnet-test "interop-devnet" "interop-smoke-test.sh")
# User devnet
user-devnet DATA_FILE:
{{just_executable()}} devnet "user.yaml" {{DATA_FILE}} {{file_stem(DATA_FILE)}}
# Pectra devnet
pectra-devnet: (devnet "pectra.yaml")
# Isthmus devnet
isthmus-devnet: (devnet "isthmus.yaml")
# subshells
enter-devnet DEVNET CHAIN='Ethereum':
exec go run ../devnet-sdk/shell/cmd/enter/main.go --devnet kt://{{DEVNET}} --chain {{CHAIN}}