forked from ethereum-optimism/superchain-registry
-
Notifications
You must be signed in to change notification settings - Fork 1
/
justfile
88 lines (70 loc) · 3.36 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
set positional-arguments
alias t := test-all
alias l := lint-all
# Adding a chain
add-chain:
go run ./add-chain
go run ./add-chain check-rollup-config
go run ./add-chain compress-genesis
go run ./add-chain 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 ./add-chain promote-to-standard --chain-id={{CHAIN}}
just codegen
# Generate auto-generated files
codegen: clean-add-chain
CODEGEN=true go run superchain/internal/codegen/main.go
# Lint all Go code
lint-all:
golangci-lint run superchain/... validation/... add-chain/... --fix
# Test all Go code
test-all: test-add-chain test-superchain test-validation
# Test all Go code in the add-chain module
test-add-chain:
# We separate the first test from the rest because it generates artifacts
# Which need to exist before the remaining tests run.
TEST_DIRECTORY=./add-chain go run gotest.tools/gotestsum@latest --format testname -- -count=1 -run TestAddChain_Main
TEST_DIRECTORY=./add-chain/... go run gotest.tools/gotestsum@latest --format testname -- -count=1 -run '[^TestAddChain_Main]'
# Test all Go code in the superchain module
test-superchain: clean-add-chain
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-add-chain
TEST_DIRECTORY=./validation go run gotest.tools/gotestsum@latest --format testname -- -run='[^TestValidation|^TestPromotion]'
# 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
promotion-test:
TEST_DIRECTORY=./validation go run gotest.tools/gotestsum@latest --format dots -- -run Promotion
# Clean test files generated by the add-chain tooling
clean-add-chain:
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-add-chain tidy-superchain tidy-validation
# Tidy the add-chain go.mod file
tidy-add-chain:
cd add-chain && 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