forked from ethereum-optimism/superchain-registry
-
Notifications
You must be signed in to change notification settings - Fork 0
/
justfile
93 lines (74 loc) · 3.62 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
set positional-arguments
alias t := test-all
alias l := lint-all
# Adding a chain
add-chain:
go run ./ops add-new-chain
go run ./ops check-rollup-config
go run ./ops compress-genesis
go run ./ops check-genesis
just codegen
# Promote a standard candidate chain to a standard chain, example: just promote-to-standard 10
promote-to-standard CHAIN:
go run ./ops promote-to-standard --chain-id={{CHAIN}}
just codegen
# Generate auto-generated files
codegen: clean-ops
CODEGEN=true go run superchain/internal/codegen/main.go
# Lint all Go code
lint-all:
golangci-lint run superchain/... validation/... ops/... --fix
# Test all Go code
test-all: test-ops test-superchain test-validation
# Test all Go code in the ops module
test-ops:
# We separate the first test from the rest because it generates artifacts
# Which need to exist before the remaining tests run.
TEST_DIRECTORY=./ops go run gotest.tools/gotestsum@latest --format testname -- -count=1 -run TestOps_AddNewChain
TEST_DIRECTORY=./ops/... go run gotest.tools/gotestsum@latest --format testname -- -count=1 -run '[^TestOps_AddNewChain]'
# Test all Go code in the superchain module
test-superchain: clean-ops
TEST_DIRECTORY=./superchain go run gotest.tools/gotestsum@latest --format testname
# Unit test all Go code in the validation module, and do not run validation checks themselves
test-validation: clean-ops
TEST_DIRECTORY=./validation/... go run gotest.tools/gotestsum@latest --format testname -- -run '[^TestValidation|^TestPromotion|^TestGenesisAllocs]'
# Runs validation checks for any chain whose config changed
validate-modified-chains REF:
#!/usr/bin/env bash
set -e
diff_output=$(git diff --merge-base {{REF}} --name-only 'superchain/configs/*.toml' ':(exclude)superchain/**/superchain.toml')
echo $diff_output
echo $diff_output | xargs -r awk '/chain_id/ {print $3}' | xargs -I {} just validate {}
# Run validation checks for chains with a name or chain ID matching the supplied regex, example: just validate 10
validate CHAIN_ID:
TEST_DIRECTORY=./validation go run gotest.tools/gotestsum@latest --format testname -- -run='TestValidation/.+\({{CHAIN_ID}}\)$' -count=1
# Run genesis validation (this is separated from other validation checks, because it is not a part of drift detection)
validate-genesis-allocs CHAIN_ID:
TEST_DIRECTORY=./validation/genesis go run gotest.tools/gotestsum@latest --format standard-verbose -- -run='TestGenesisAllocs/.+\({{CHAIN_ID}}\)$' -timeout 0
# Run the promotion tests on all the standard candidates
promotion-test:
TEST_DIRECTORY=./validation go run gotest.tools/gotestsum@latest --format dots -- -run Promotion
# Run the promotion tests for chains with a name or chain ID matching the supplied regex, example: just promote-test 10
validate-standard-candidate CHAIN_ID:
TEST_DIRECTORY=./validation go run gotest.tools/gotestsum@latest --format testname -- -run='Promotion/.+\({{CHAIN_ID}}\)$' -count=1
# Clean test files generated by the ops tooling
clean-ops:
rm -f superchain/configs/sepolia/testchain_*.toml
rm -f superchain/extra/sepolia/testchain_*.json.gz
rm -rf -- validation/genesis/validation-inputs/*-test/
# Tidying all go.mod files
tidy-all: tidy-ops tidy-superchain tidy-validation
# Tidy the ops go.mod file
tidy-ops:
cd ops && go mod tidy
# Tidy the superchain go.mod file
tidy-superchain:
cd superchain && go mod tidy
# Tidy the validation go.mod file
tidy-validation:
cd validation && go mod tidy
# Removing a chain, example: just remove-chain sepolia op
remove-chain SUPERCHAIN_TARGET CHAIN:
rm superchain/configs/{{SUPERCHAIN_TARGET}}/{{CHAIN}}.toml
rm superchain/extra/genesis/{{SUPERCHAIN_TARGET}}/{{CHAIN}}.json.gz
just codegen