|
3 | 3 |
|
4 | 4 | MAKEFILE_DIR := $(patsubst %/,%,$(dir $(abspath $(lastword $(MAKEFILE_LIST))))) |
5 | 5 | ARTIFACTS_DIR := $(abspath $(MAKEFILE_DIR)/../artifacts/bin) |
6 | | -TESTER_DIR := $(MAKEFILE_DIR)/Tester |
7 | | -ZISK_DIR := $(MAKEFILE_DIR)/ZiskGuest |
| 6 | +GUEST_DIR := $(MAKEFILE_DIR)/ZiskGuest |
8 | 7 | BIN_DIR := /nethermind/bin |
9 | 8 | SRC_DIR := /nethermind/src |
10 | 9 |
|
@@ -69,66 +68,58 @@ BFLAT_REFS := \ |
69 | 68 | DOCKER_RUN := docker run --platform linux/amd64 --rm \ |
70 | 69 | -e DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1 \ |
71 | 70 | -e DOTNET_TYPELOADER_TRACE_INTERFACE_RESOLUTION=0 \ |
72 | | - -w $(SRC_DIR) |
| 71 | + -w $(SRC_DIR) \ |
| 72 | + --mount type=bind,source="$(ARTIFACTS_DIR)/ZiskGuest/release",target=$(BIN_DIR) \ |
| 73 | + --mount type=bind,source="$(GUEST_DIR)",target=$(SRC_DIR) \ |
| 74 | + nethermindeth/bflat-riscv64:latest \ |
| 75 | + $(BFLAT_BUILD) \ |
| 76 | + $(BFLAT_REFS) |
73 | 77 |
|
74 | | -build-dotnet-tester: |
75 | | - dotnet build -c release -p:EnableZkEvm=true $(TESTER_DIR)/Tester.csproj |
| 78 | +build-dotnet: |
| 79 | + dotnet build -c release -p:EnableZkEvm=true $(GUEST_DIR)/ZiskGuest.csproj |
76 | 80 |
|
77 | | -build-dotnet-zisk: |
78 | | - dotnet build -c release -p:EnableZkEvm=true $(ZISK_DIR)/ZiskGuest.csproj |
| 81 | +build-qemu: build-dotnet |
| 82 | + $(DOCKER_RUN) --libc zisk_sim -d ZK_EVM \ |
| 83 | + $(SRC_DIR)/TestProgram.cs |
| 84 | + mkdir -p $(GUEST_DIR)/bin && \ |
| 85 | + mv -f $(GUEST_DIR)/TestProgram $(GUEST_DIR)/bin/nethermind |
79 | 86 |
|
80 | | -build-tester: build-dotnet-tester |
| 87 | +build-zisk: build-dotnet |
81 | 88 | $(DOCKER_RUN) \ |
82 | | - --mount type=bind,source="$(ARTIFACTS_DIR)/Tester/release",target=$(BIN_DIR) \ |
83 | | - --mount type=bind,source="$(TESTER_DIR)",target=$(SRC_DIR) \ |
84 | | - nethermindeth/bflat-riscv64:latest \ |
85 | | - $(BFLAT_BUILD) --libc zisk_sim -d ZK_EVM $(BFLAT_REFS) \ |
86 | | - $(SRC_DIR)/Program.cs |
87 | | - mkdir -p $(TESTER_DIR)/bin && \ |
88 | | - mv -f $(TESTER_DIR)/Program $(TESTER_DIR)/bin/nethermind |
89 | | - |
90 | | -build-zisk: build-dotnet-zisk |
91 | | - $(DOCKER_RUN) \ |
92 | | - --mount type=bind,source="$(ARTIFACTS_DIR)/ZiskGuest/release",target=$(BIN_DIR) \ |
93 | | - --mount type=bind,source="$(ZISK_DIR)",target=$(SRC_DIR) \ |
94 | | - nethermindeth/bflat-riscv64:latest \ |
95 | | - $(BFLAT_BUILD) --libc zisk $(BFLAT_REFS) \ |
| 89 | + --libc zisk \ |
96 | 90 | -r $(BIN_DIR)/Nethermind.ZiskBindings.dll \ |
97 | 91 | --extra-ld $(BIN_DIR)/runtimes/linux-riscv64/native/libziskos.a \ |
98 | 92 | --extlib $(BIN_DIR)/libziskos.bflat.manifest \ |
99 | 93 | $(SRC_DIR)/Program.cs |
100 | | - mkdir -p $(ZISK_DIR)/bin && \ |
101 | | - mv -f $(ZISK_DIR)/Program.patched $(ZISK_DIR)/bin/nethermind && \ |
102 | | - rm -f $(ZISK_DIR)/Program |
| 94 | + mkdir -p $(GUEST_DIR)/bin && \ |
| 95 | + mv -f $(GUEST_DIR)/Program.patched $(GUEST_DIR)/bin/nethermind && \ |
| 96 | + rm -f $(GUEST_DIR)/Program |
103 | 97 |
|
104 | | -run-tester: build-tester |
105 | | - docker build --platform linux/amd64 -t nethermind-zkevm $(TESTER_DIR) |
| 98 | +run-qemu: build-qemu |
| 99 | + docker build --platform linux/amd64 -f $(GUEST_DIR)/Dockerfile.qemu -t nethermind-zkevm $(GUEST_DIR) |
106 | 100 | docker run --rm -it nethermind-zkevm |
107 | 101 |
|
108 | 102 | run-zisk: build-zisk |
109 | | - [ -f "$(ZISK_DIR)/bin/input.bin" ] || \ |
110 | | - dotnet run -c release --project $(TESTER_DIR)/Tester.csproj -- $(ZISK_DIR)/bin/input.bin |
| 103 | + [ -f "$(GUEST_DIR)/bin/input.bin" ] || \ |
| 104 | + dotnet run -c release --no-restore --project $(GUEST_DIR)/ZiskGuest.csproj -- $(GUEST_DIR)/bin/input.bin |
111 | 105 | docker run --rm -it -e RUST_BACKTRACE=full \ |
112 | | - --mount type=bind,source="$(ZISK_DIR)/bin",target=/n \ |
| 106 | + --mount type=bind,source="$(GUEST_DIR)/bin",target=/n \ |
113 | 107 | nethermindeth/zisk@sha256:1b38e92264c30a4109fdb47f3b175324544085e36b9dde0abf7570c2b1e3312b \ |
114 | 108 | ziskemu -e /n/nethermind -i /n/input.bin |
115 | 109 |
|
116 | 110 | clean: |
117 | 111 | rm -rf \ |
118 | | - $(TESTER_DIR)/bin/** \ |
119 | | - $(TESTER_DIR)/Program \ |
120 | | - $(TESTER_DIR)/Program.o \ |
121 | | - $(ZISK_DIR)/bin/** \ |
122 | | - $(ZISK_DIR)/Program \ |
123 | | - $(ZISK_DIR)/Program.patched \ |
124 | | - $(ZISK_DIR)/Program.o |
| 112 | + $(GUEST_DIR)/bin/** \ |
| 113 | + $(GUEST_DIR)/*.o \ |
| 114 | + $(GUEST_DIR)/Program \ |
| 115 | + $(GUEST_DIR)/Program.patched \ |
| 116 | + $(GUEST_DIR)/TestProgram |
125 | 117 | dotnet clean -c release $(MAKEFILE_DIR)/Stateless.slnx |
126 | 118 |
|
127 | 119 | .PHONY: \ |
128 | | - build-dotnet-tester \ |
129 | | - build-dotnet-zisk \ |
130 | | - build-tester \ |
| 120 | + build-dotnet \ |
| 121 | + build-qemu \ |
131 | 122 | build-zisk \ |
132 | | - run-tester \ |
| 123 | + run-qemu \ |
133 | 124 | run-zisk \ |
134 | 125 | clean |
0 commit comments