Skip to content

Commit 74e6060

Browse files
committed
update according to review: move libzkp
1 parent ece12d6 commit 74e6060

File tree

18 files changed

+26
-27
lines changed

18 files changed

+26
-27
lines changed

.github/workflows/coordinator.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ jobs:
113113
working-directory: 'coordinator'
114114
run: |
115115
make libzkp
116-
# go test -exec "env LD_LIBRARY_PATH=${PWD}/../common/libzkp/lib" -v -race -gcflags="-l" -ldflags="-s=false" -coverpkg="scroll-tech/coordinator" -coverprofile=coverage.txt -covermode=atomic ./...
116+
# go test -exec "env LD_LIBRARY_PATH=${PWD}/libzkp/lib" -v -race -gcflags="-l" -ldflags="-s=false" -coverpkg="scroll-tech/coordinator" -coverprofile=coverage.txt -covermode=atomic ./...
117117
go test -v -race -gcflags="-l" -ldflags="-s=false" -coverprofile=coverage.txt -covermode=atomic -tags mock_verifier ./...
118118
- name: Upload coverage reports to Codecov
119119
uses: codecov/codecov-action@v3

.github/workflows/integration.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
make dev_docker
3939
make -C rollup mock_abi
4040
make -C common/bytecode all
41-
make -C common/libzkp build
41+
make -C coordinator/libzkp build
4242
- name: Run integration tests
4343
run: |
4444
go test -v -tags="mock_prover mock_verifier" -p 1 -coverprofile=coverage.txt scroll-tech/integration-test/...

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ We welcome community contributions to this repository. Before you submit any iss
2828

2929
## Prerequisites
3030
+ Go 1.21
31-
+ Rust (for version, see [rust-toolchain](./common/libzkp/impl/rust-toolchain))
31+
+ Rust (for version, see [rust-toolchain](./rust-toolchain))
3232
+ Hardhat / Foundry
3333
+ Docker
3434

build/dockerfiles/coordinator-api.Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ RUN go mod download -x
4040
# Build coordinator
4141
FROM base as builder
4242
COPY . .
43-
#RUN cp -r ./common/libzkp/interface ./coordinator/internal/logic/verifier/lib
44-
COPY --from=zkp-builder /app/target/release/libzkp.so ./common/libzkp/lib/
43+
#RUN cp -r ./coordinator/libzkp/interface ./coordinator/internal/logic/verifier/lib
44+
COPY --from=zkp-builder /app/target/release/libzkp.so ./coordinator/libzkp/lib/
4545
RUN cd ./coordinator && CGO_LDFLAGS="-Wl,--no-as-needed -ldl" make coordinator_api && mv ./build/bin/coordinator_api /bin/coordinator_api
46-
RUN mv common/libzkp/lib /bin/
46+
RUN mv coordinator/libzkp/lib /bin/
4747

4848
# Pull coordinator into a second stage deploy ubuntu container
4949
FROM nvidia/cuda:11.7.1-runtime-ubuntu22.04

common/libzkp/go.mod

Lines changed: 0 additions & 3 deletions
This file was deleted.

common/version/version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ var commit = func() string {
2323
return "000000"
2424
}()
2525

26-
// ZkVersion is commit-id of common/libzkp/impl/cargo.lock/scroll-prover and halo2, contacted by a "-"
26+
// ZkVersion is commit-id of cargo.lock/zkvm-prover and openvm, contacted by a "-"
2727
// The default `000000-000000` is set for integration test, and will be overwritten by coordinator's & prover's actual compilations (see their Makefiles).
2828
var ZkVersion = "000000-000000"
2929

coordinator/Makefile

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
IMAGE_VERSION=latest
44
REPO_ROOT_DIR=./..
5+
LIBZKP_PATH=libzkp/lib/libzkp.so
56

67
ifeq (4.3,$(firstword $(sort $(MAKE_VERSION) 4.3)))
78
ZKVM_VERSION=$(shell grep -m 1 "zkvm-prover?" ../Cargo.lock | cut -d "#" -f2 | cut -c-7)
@@ -16,15 +17,15 @@ ZK_VERSION=${ZKVM_VERSION}-${OPENVM_VERSION}
1617
test:
1718
go test -v -race -coverprofile=coverage.txt -covermode=atomic -p 1 $(PWD)/...
1819

19-
../common/libzkp/lib/libzkp.so:
20-
$(MAKE) -C ../common/libzkp build
20+
$(LIBZKP_PATH):
21+
$(MAKE) -C libzkp build
2122

2223
clean_libzkp:
23-
$(MAKE) -C ../common/libzkp clean
24+
$(MAKE) -C libzkp clean
2425

25-
libzkp: clean_libzkp ../common/libzkp/lib/libzkp.so
26+
libzkp: clean_libzkp $(LIBZKP_PATH)
2627

27-
coordinator_api: ../common/libzkp/lib/libzkp.so ## Builds the Coordinator api instance.
28+
coordinator_api: $(LIBZKP_PATH) ## Builds the Coordinator api instance.
2829
go build -ldflags "-X scroll-tech/common/version.ZkVersion=${ZK_VERSION}" -o $(PWD)/build/bin/coordinator_api ./cmd/api
2930

3031
coordinator_cron:
@@ -42,14 +43,13 @@ mock_coordinator_api: ## Builds the mocked Coordinator instance.
4243
mock_coordinator_cron: ## Builds the mocked Coordinator instance.
4344
go build -tags="mock_prover mock_verifier" -o $(PWD)/build/bin/coordinator_cron ./cmd/cron
4445

45-
test-verifier: ../common/libzkp/lib/libzkp.so
46+
test-verifier: $(LIBZKP_PATH)
4647
go test -tags ffi -timeout 0 -v ./internal/logic/verifier
4748

48-
test-gpu-verifier: ../common/libzkp/lib/libzkp.so
49+
test-gpu-verifier: $(LIBZKP_PATH)
4950
go test -tags="gpu ffi" -timeout 0 -v ./internal/logic/verifier
5051

5152
lint: ## Lint the files - used for CI
52-
# cp -r ../common/libzkp/interface ./internal/logic/verifier/lib
5353
GOBIN=$(PWD)/build/bin go run ../build/lint.go
5454

5555
clean: ## Empty out the bin folder

coordinator/internal/logic/provertask/prover_task.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ import (
1313
"github.com/scroll-tech/go-ethereum/params"
1414
"gorm.io/gorm"
1515

16-
"scroll-tech/common/libzkp"
16+
"scroll-tech/coordinator/libzkp"
17+
1718
"scroll-tech/common/types/message"
1819

1920
"scroll-tech/coordinator/internal/config"

coordinator/internal/logic/submitproof/proof_receiver.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ import (
1515
"github.com/scroll-tech/go-ethereum/params"
1616
"gorm.io/gorm"
1717

18-
"scroll-tech/common/libzkp"
18+
"scroll-tech/coordinator/libzkp"
19+
1920
"scroll-tech/common/types"
2021
"scroll-tech/common/types/message"
2122

coordinator/internal/logic/verifier/verifier.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@ import (
1212

1313
"github.com/scroll-tech/go-ethereum/log"
1414

15-
"scroll-tech/common/libzkp"
15+
"scroll-tech/coordinator/libzkp"
16+
1617
"scroll-tech/common/types/message"
1718

1819
"scroll-tech/coordinator/internal/config"
1920
)
2021

21-
// This struct maps to `CircuitConfig` in common/libzkp/impl/src/verifier.rs
22+
// This struct maps to `CircuitConfig` in libzkp/impl/src/verifier.rs
2223
// Define a brand new struct here is to eliminate side effects in case fields
2324
// in `*config.CircuitConfig` being changed
2425
type rustCircuitConfig struct {
@@ -33,7 +34,7 @@ func newRustCircuitConfig(cfg *config.CircuitConfig) *rustCircuitConfig {
3334
}
3435
}
3536

36-
// This struct maps to `VerifierConfig` in common/libzkp/impl/src/verifier.rs
37+
// This struct maps to `VerifierConfig` in coordinator/libzkp/impl/src/verifier.rs
3738
// Define a brand new struct here is to eliminate side effects in case fields
3839
// in `*config.VerifierConfig` being changed
3940
type rustVerifierConfig struct {

0 commit comments

Comments
 (0)