-
Notifications
You must be signed in to change notification settings - Fork 21
/
Makefile
102 lines (77 loc) · 3.61 KB
/
Makefile
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
# Heavily inspired by Reth: https://github.com/paradigmxyz/reth/blob/main/Makefile
# Include .env file to get GITHUB_TOKEN
ifneq ("$(wildcard .env)","")
include .env
endif
# The release tag of https://github.com/kkrt-labs/tests to use for EF tests. Usually an
# ethereum/tests release tag followed by `-kkrt`.
EF_TESTS_TAG := v14.1.3-kkrt
EF_TESTS_URL := https://github.com/kkrt-labs/tests/archive/refs/tags/$(EF_TESTS_TAG).tar.gz
EF_TESTS_DIR := ./crates/ef-testing/ethereum-tests
# Kakarot artifacts V0
KKRT_V0_BUILD_ARTIFACT_URL = $(shell curl -L https://api.github.com/repos/kkrt-labs/kakarot/releases/latest | jq -r '.assets[0].browser_download_url')
# Kakarot SSJ artifacts for precompiles
KKRT_SSJ_BUILD_ARTIFACT_URL = $(shell curl -L https://api.github.com/repos/kkrt-labs/kakarot-ssj/releases/latest | jq -r '.assets[0].browser_download_url')
# Note: the `CAIRO_NATIVE_RUNTIME_LIBRARY` env variable must be set to the absolute path to the
# `libcairo_native_runtime.a` file. This is because we use the `native` feature of the `blockifier`
# crate, which requires the runtime to be available.
export CAIRO_NATIVE_RUNTIME_LIBRARY=$(HOME)/.cargo/libcairo_native_runtime.a
# Downloads and unpacks Ethereum Foundation tests in the `$(EF_TESTS_DIR)` directory.
# Requires `wget` and `tar`
$(EF_TESTS_DIR):
mkdir -p $(EF_TESTS_DIR)
wget $(EF_TESTS_URL) -O ethereum-tests.tar.gz
tar -xzf ethereum-tests.tar.gz --strip-components=1 -C $(EF_TESTS_DIR)
rm ethereum-tests.tar.gz
# Ensures the commands for $(EF_TESTS_DIR) always run on `make setup`, regardless if the directory exists
.PHONY: $(EF_TESTS_DIR) build
setup: $(EF_TESTS_DIR)
setup-kakarot-v0: clean-kakarot-v0
@curl -sL -o kakarot-build.zip "$(KKRT_V0_BUILD_ARTIFACT_URL)"
unzip -o kakarot-build.zip -d build/v0
mv build/v0/build/* build/v0
mv build/v0/ERC20.json build/common/
rm -f kakarot-build.zip
setup-kakarot-v1: clean-kakarot-v1
@curl -sL -o kakarot-ssj-build.zip "$(KKRT_SSJ_BUILD_ARTIFACT_URL)"
unzip -o kakarot-ssj-build.zip -d build/v1
mv build/v1/contracts_Cairo1Helpers.compiled_contract_class.json build/common/cairo1_helpers.json
rm -f kakarot-ssj-build.zip
setup-kakarot: clean-common setup-kakarot-v0 setup-kakarot-v1
clean-common:
rm -rf build/common
mkdir -p build/common
clean-kakarot-v0:
rm -rf build/v0
mkdir -p build/v0
clean-kakarot-v1:
rm -rf build/v1
mkdir -p build/v1
# Runs all tests but integration tests
unit:
cargo test --lib
vm-tests-v0-ci: build
cargo test --test VmTests --lib --no-fail-fast --quiet --features "v0,ci"
vm-tests-v1-ci: build
cargo test --test VMTests --lib --no-fail-fast --quiet --features "v1,ci"
# Runs the repo tests with the `v0` feature
tests-v0-ci: build
cargo test --test tests --lib --no-fail-fast --quiet --features "v0,ci"
# Runs the repo tests with the `v1` feature
tests-v1-ci: build
cargo test --test tests --lib --no-fail-fast --quiet --features "v1,ci"
# Runs ef tests only with the `v0` feature
ef-test-v0: build
cargo test --test tests --no-fail-fast --quiet --features "v0,ci"
# Runs ef tests only with the `v1` feature
ef-test-v1: build
cargo test --test tests --no-fail-fast --quiet --features "v1,ci"
# Runs ef-tests with cairo-native mode
ef-test-v1-native: build
CAIRO_NATIVE_RUNTIME_LIBRARY=~/.cargo/libcairo_native_runtime.a cargo test --test tests --no-fail-fast --features "v1,native,ci" -- --nocapture
# Build the rust crates
build:
CAIRO_NATIVE_RUNTIME_LIBRARY=~/.cargo/libcairo_native_runtime.a cargo build --release
# Generates a `blockchain-tests-skip.yml` at the project root, by consuming a `data.txt` file containing logs of the ran tests
generate-skip-file:
python ./scripts/generate_skip_file.py