This repository has been archived by the owner on Aug 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 135
/
Copy pathMakefile
117 lines (98 loc) · 2.58 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
SHELL := /bin/bash
build: submodules unicorn minigeth_mips minigeth_default_arch mipsevm contracts
.PHONY: build
# Approximation, use `make unicorn_rebuild` to force.
unicorn/build: unicorn/CMakeLists.txt
mkdir -p unicorn/build
cd unicorn/build && cmake .. -DUNICORN_ARCH=mips -DCMAKE_BUILD_TYPE=Release
unicorn: unicorn/build
cd unicorn/build && make -j8
# The Go linker / runtime expects these to be there!
cp unicorn/build/libunicorn.so.1 unicorn
cp unicorn/build/libunicorn.so.2 unicorn
.PHONY: unicorn
unicorn_rebuild:
touch unicorn/CMakeLists.txt
make unicorn
.PHONY: unicorn_rebuild
submodules:
# CI will checkout submodules on its own (and fails on these commands)
if [[ -z "$$GITHUB_ENV" ]]; then \
git submodule init; \
git submodule update; \
fi
.PHONY: submodules
minigeth_mips:
cd mipigo && ./build.sh
.PHONY: minigeth_mips
minigeth_default_arch:
cd minigeth && go build
.PHONY: minigeth_default_arch
mipsevm:
cd mipsevm && go build
.PHONY: mipsevm
contracts: nodejs
npx hardhat compile
.PHONY: contracts
nodejs:
if [ -x "$(command -v pnpm)" ]; then \
pnpm install; \
else \
npm install; \
fi
.PHONY: nodejs
# Must be a definition and not a rule, otherwise it gets only called once and
# not before each test as we wish.
define clear_cache
rm -rf /tmp/cannon
mkdir -p /tmp/cannon
endef
clear_cache:
$(call clear_cache)
.PHONY: clear_cache
test_challenge:
$(call clear_cache)
# Build preimage cache for block 13284469
minigeth/go-ethereum 13284469
# Generate initial (generic) MIPS memory checkpoint and final checkpoint for
# block 13284469.
mipsevm/mipsevm && mipsevm/mipsevm 13284469
npx hardhat test test/challenge_test.js
.PHONY: test_challenge
test_mipsevm:
$(call clear_cache)
# Build preimage caches for the given blocks
minigeth/go-ethereum 13284469
minigeth/go-ethereum 13284491
cd mipsevm && go test -v
.PHONY: test_mipsevm
test_minigeth:
$(call clear_cache)
# Check that minigeth is able to validate the given transactions.
# run block 13284491 (0 tx)
minigeth/go-ethereum 13284491
# run block 13284469 (few tx)
minigeth/go-ethereum 13284469
# block 13284053 (deletion)
minigeth/go-ethereum 13284053
# run block 13303075 (uncles)
minigeth/go-ethereum 13303075
.PHONY: test_minigeth
test_contracts:
$(call clear_cache)
npx hardhat test
.PHONY: test_contracts
test: test_challenge test_mipsevm test_minigeth
.PHONY: test
clean:
rm -f minigeth/go-ethereum
rm -f mipigo/minigeth
rm -f mipigo/minigeth.bin
rm -f mipsevm/mipsevm
rm -rf artifacts
.PHONY: clean
mrproper: clean
rm -rf cache
rm -rf node_modules
rm -rf mipigo/venv
.PHONY: mrproper