Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions build/common.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
UNAME_S := $(shell uname -s)
IS_DARWIN := $(findstring Darwin,$(UNAME_S))

SHLIB_EXT := so
ifeq ($(UNAME_S),Darwin)
SHLIB_EXT := dylib
endif

LIB_ZKP_NAME := libzkp.$(SHLIB_EXT)

define macos_codesign
@if [ -n "$(IS_DARWIN)" ]; then \
codesign --force --sign - '$(1)'; \
codesign --verify --deep --verbose '$(1)'; \
fi
endef
3 changes: 2 additions & 1 deletion coordinator/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/build/bin
.idea
internal/logic/verifier/lib
internal/libzkp/lib/libzkp.so
libzkp.so
libzkp.dylib
5 changes: 4 additions & 1 deletion coordinator/Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
include ../build/common.mk

.PHONY: lint docker clean coordinator coordinator_skip_libzkp mock_coordinator libzkp

IMAGE_VERSION=latest
REPO_ROOT_DIR=./..
LIBZKP_PATH=./internal/logic/libzkp/lib/libzkp.so
LIBZKP_PATH=./internal/logic/libzkp/lib/$(LIB_ZKP_NAME)

ifeq (4.3,$(firstword $(sort $(MAKE_VERSION) 4.3)))
ZKVM_VERSION=$(shell grep -m 1 "zkvm-prover?" ../Cargo.lock | cut -d "#" -f2 | cut -c-7)
Expand All @@ -27,6 +29,7 @@ libzkp: clean_libzkp $(LIBZKP_PATH)

coordinator_api: $(LIBZKP_PATH) ## Builds the Coordinator api instance.
go build -ldflags "-X scroll-tech/common/version.ZkVersion=${ZK_VERSION}" -o $(PWD)/build/bin/coordinator_api ./cmd/api
$(call macos_codesign,$(PWD)/build/bin/coordinator_api)

coordinator_cron:
go build -ldflags "-X scroll-tech/common/version.ZkVersion=${ZK_VERSION}" -o $(PWD)/build/bin/coordinator_cron ./cmd/cron
Expand Down
2 changes: 2 additions & 0 deletions coordinator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ See [monorepo prerequisites](../README.md#prerequisites).

## Build

Using Go version 1.22

```bash
make clean
make coordinator_api
Expand Down
10 changes: 7 additions & 3 deletions coordinator/internal/logic/libzkp/Makefile
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
.PHONY: help fmt clippy test test-ci test-all
include ../../../../build/common.mk

.PHONY: help fmt clippy test test-ci test-all clean build

all: build

build:
@cargo build --release -p libzkp-c
@mkdir -p lib
@cp -f ../../../../target/release/libzkp.so lib/
@cp -f ../../../../target/release/$(LIB_ZKP_NAME) lib/

fmt:
@cargo fmt --all -- --check

clean:
@cargo clean --release -p libzkp -p libzkp-c -p l2geth
@rm -f lib/libzkp.so
@rm -f lib/$(LIB_ZKP_NAME)

clippy:
@cargo check --release --all-features
Expand Down
3 changes: 2 additions & 1 deletion coordinator/internal/logic/libzkp/lib.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package libzkp

/*
#cgo LDFLAGS: -lzkp -lm -ldl -L${SRCDIR}/lib -Wl,-rpath=${SRCDIR}/lib
#cgo linux LDFLAGS: -lzkp -lm -ldl -L${SRCDIR}/lib -Wl,-rpath=${SRCDIR}/lib
#cgo darwin LDFLAGS: -lzkp -lm -ldl -L${SRCDIR}/lib -Wl,-rpath,${SRCDIR}/lib
#cgo gpu LDFLAGS: -lzkp -lm -ldl -lgmp -lstdc++ -lprocps -L/usr/local/cuda/lib64/ -lcudart -L${SRCDIR}/lib/ -Wl,-rpath=${SRCDIR}/lib
#include <stdlib.h>
#include "libzkp.h"
Expand Down
3 changes: 3 additions & 0 deletions crates/libzkp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ name = "libzkp"
version.workspace = true
edition.workspace = true

[lib]
crate-type = ["rlib", "cdylib"]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
scroll-zkvm-types = { workspace = true, features = ["scroll"] }
Expand Down
5 changes: 4 additions & 1 deletion tests/prover-e2e/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
include ../../build/common.mk

.PHONY: clean setup_db test_tool all check_vars

include conf/.make.env
Expand Down Expand Up @@ -52,6 +54,7 @@ reset_db:

test_tool:
go build -o $(PWD)/build/bin/e2e_tool ../../rollup/tests/integration_tool
$(call macos_codesign,$(PWD)/build/bin/e2e_tool)

build/bin/e2e_tool: test_tool

Expand All @@ -71,4 +74,4 @@ reimport_data: reset_db import_data

coordinator_setup:
SCROLL_FORK_NAME=${SCROLL_FORK_NAME} $(MAKE) -C ../../coordinator localsetup
cp -f conf/genesis.json ../../coordinator/build/bin/conf
cp -f conf/genesis.json ../../coordinator/build/bin/conf
Loading