Skip to content

Commit

Permalink
feat: remove .so file dependency of libscroll_zstd
Browse files Browse the repository at this point in the history
  • Loading branch information
colinlyguo committed Jun 3, 2024
1 parent 9ec83a5 commit c78ad62
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 78 deletions.
5 changes: 0 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
ARG COMMIT=""
ARG VERSION=""
ARG BUILDNUM=""
ARG LIBSCROLL_ZSTD_VERSION=v0.1.0-rc0-ubuntu20.04
ARG SCROLL_LIB_PATH=/scroll/lib

# Build libzkp dependency
Expand All @@ -28,14 +27,12 @@ FROM scrolltech/go-rust-builder:go-1.20-rust-nightly-2022-12-10 as builder

ADD . /go-ethereum

ARG LIBSCROLL_ZSTD_VERSION
ARG SCROLL_LIB_PATH

RUN mkdir -p $SCROLL_LIB_PATH

COPY --from=zkp-builder /app/target/release/libzkp.so $SCROLL_LIB_PATH
COPY --from=zkp-builder /app/target/release/libzktrie.so $SCROLL_LIB_PATH
RUN wget -O $SCROLL_LIB_PATH/libscroll_zstd.so https://github.com/scroll-tech/da-codec/releases/download/$LIBSCROLL_ZSTD_VERSION/libscroll_zstd.so

ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$SCROLL_LIB_PATH
ENV CGO_LDFLAGS="-L$SCROLL_LIB_PATH -Wl,-rpath,$SCROLL_LIB_PATH"
Expand All @@ -50,14 +47,12 @@ RUN apt-get -qq update \

COPY --from=builder /go-ethereum/build/bin/geth /usr/local/bin/

ARG LIBSCROLL_ZSTD_VERSION
ARG SCROLL_LIB_PATH

RUN mkdir -p $SCROLL_LIB_PATH

COPY --from=zkp-builder /app/target/release/libzkp.so $SCROLL_LIB_PATH
COPY --from=zkp-builder /app/target/release/libzktrie.so $SCROLL_LIB_PATH
RUN wget -O $SCROLL_LIB_PATH/libscroll_zstd.so https://github.com/scroll-tech/da-codec/releases/download/$LIBSCROLL_ZSTD_VERSION/libscroll_zstd.so

ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$SCROLL_LIB_PATH
ENV CGO_LDFLAGS="-L$SCROLL_LIB_PATH -Wl,-rpath,$SCROLL_LIB_PATH"
Expand Down
5 changes: 0 additions & 5 deletions Dockerfile.mockccc
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,18 @@
ARG COMMIT=""
ARG VERSION=""
ARG BUILDNUM=""
ARG LIBSCROLL_ZSTD_VERSION=v0.1.0-rc0-ubuntu20.04
ARG SCROLL_LIB_PATH=/scroll/lib

# Build Geth in a stock Go builder container
FROM scrolltech/go-rust-builder:go-1.20-rust-nightly-2022-12-10 as builder

ADD . /go-ethereum

ARG LIBSCROLL_ZSTD_VERSION
ARG SCROLL_LIB_PATH

RUN mkdir -p $SCROLL_LIB_PATH

RUN apt-get -qq update && apt-get -qq install -y wget
RUN wget -O $SCROLL_LIB_PATH/libscroll_zstd.so https://github.com/scroll-tech/da-codec/releases/download/$LIBSCROLL_ZSTD_VERSION/libscroll_zstd.so

ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$SCROLL_LIB_PATH
ENV CGO_LDFLAGS="-L$SCROLL_LIB_PATH -Wl,-rpath,$SCROLL_LIB_PATH"
Expand All @@ -26,13 +23,11 @@ FROM ubuntu:20.04

COPY --from=builder /go-ethereum/build/bin/geth /usr/local/bin/

ARG LIBSCROLL_ZSTD_VERSION
ARG SCROLL_LIB_PATH

RUN mkdir -p $SCROLL_LIB_PATH

RUN apt-get -qq update && apt-get -qq install -y wget
RUN wget -O $SCROLL_LIB_PATH/libscroll_zstd.so https://github.com/scroll-tech/da-codec/releases/download/$LIBSCROLL_ZSTD_VERSION/libscroll_zstd.so

ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$SCROLL_LIB_PATH
ENV CGO_LDFLAGS="-L$SCROLL_LIB_PATH -Wl,-rpath,$SCROLL_LIB_PATH"
Expand Down
29 changes: 12 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,22 @@
# with Go source code. If you know what GOPATH is then you probably
# don't need to bother with make.

.PHONY: geth android ios evm all test clean libzkp libzstd
.PHONY: geth android ios evm all test clean libzkp

GOBIN = ./build/bin
GO ?= latest
GORUN = go run
LIBSCROLL_ZSTD_VERSION = v0.1.0-rc0-ubuntu20.04
SCROLL_LIB_PATH = /scroll/lib
GORUN = env GO111MODULE=on go run

libzkp:
cd $(PWD)/rollup/circuitcapacitychecker/libzkp && make libzkp

libzstd:
@sudo mkdir -p $(SCROLL_LIB_PATH)
@sudo wget -O $(SCROLL_LIB_PATH)/libscroll_zstd.so https://github.com/scroll-tech/da-codec/releases/download/$(LIBSCROLL_ZSTD_VERSION)/libscroll_zstd.so

nccc_geth: libzstd ## geth without circuit capacity checker
@LD_LIBRARY_PATH="$(LD_LIBRARY_PATH):$(SCROLL_LIB_PATH)" CGO_LDFLAGS="-L$(SCROLL_LIB_PATH) -Wl,-rpath,$(SCROLL_LIB_PATH)" $(GORUN) build/ci.go install ./cmd/geth
nccc_geth: ## geth without circuit capacity checker
$(GORUN) build/ci.go install ./cmd/geth
@echo "Done building."
@echo "Run \"$(GOBIN)/geth\" to launch geth."

geth: libzkp libzstd
@sudo cp $(PWD)/rollup/circuitcapacitychecker/libzkp/libzkp.so $(SCROLL_LIB_PATH)
@sudo cp $(PWD)/rollup/circuitcapacitychecker/libzkp/libzktrie.so $(SCROLL_LIB_PATH)
@LD_LIBRARY_PATH="$(LD_LIBRARY_PATH):$(SCROLL_LIB_PATH)" CGO_LDFLAGS="-L$(SCROLL_LIB_PATH) -Wl,-rpath,$(SCROLL_LIB_PATH)" $(GORUN) build/ci.go install -buildtags circuit_capacity_checker ./cmd/geth
geth: libzkp
$(GORUN) build/ci.go install -buildtags circuit_capacity_checker ./cmd/geth
@echo "Done building."
@echo "Run \"$(GOBIN)/geth\" to launch geth."

Expand All @@ -44,14 +36,17 @@ ios:
@echo "Done building."
@echo "Import \"$(GOBIN)/Geth.framework\" to use the library."

test:
./run_test.sh
test: all
# genesis test
cd ${PWD}/cmd/geth; go test -test.run TestCustomGenesis
# module test
$(GORUN) build/ci.go test ./consensus ./core ./eth ./miner ./node ./trie ./rollup/...

lint: ## Run linters.
$(GORUN) build/ci.go lint

clean:
go clean -cache
env GO111MODULE=on go clean -cache
rm -fr build/_workspace/pkg/ $(GOBIN)/*

# The devtools target installs tools required for 'go generate'.
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ require (
github.com/prometheus/tsdb v0.7.1
github.com/rjeczalik/notify v0.9.1
github.com/rs/cors v1.7.0
github.com/scroll-tech/da-codec v0.0.0-20240516115958-db04f5e6772c
github.com/scroll-tech/zktrie v0.8.4
github.com/scroll-tech/da-codec v0.0.0-20240603180909-59f60267e4cc
github.com/scroll-tech/zktrie v0.8.2
github.com/shirou/gopsutil v3.21.11+incompatible
github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4
github.com/stretchr/testify v1.9.0
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -392,10 +392,10 @@ github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncj
github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik=
github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU=
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/scroll-tech/da-codec v0.0.0-20240516115958-db04f5e6772c h1:Vi1BGENMGO8yjmnJe6QP9Eb1OPPuEi4+wd8d/DxhJ6Q=
github.com/scroll-tech/da-codec v0.0.0-20240516115958-db04f5e6772c/go.mod h1:1wWYii0OPwd5kw+xrz0PFgS420xNadrNF1x/ELJT+TM=
github.com/scroll-tech/zktrie v0.8.4 h1:UagmnZ4Z3ITCk+aUq9NQZJNAwnWl4gSxsLb2Nl7IgRE=
github.com/scroll-tech/zktrie v0.8.4/go.mod h1:XvNo7vAk8yxNyTjBDj5WIiFzYW4bx/gJ78+NK6Zn6Uk=
github.com/scroll-tech/da-codec v0.0.0-20240603180909-59f60267e4cc h1:BiLjkQTYF5zCowJyU8iQ/t72J1iiu4zCsoyp4ug8XCQ=
github.com/scroll-tech/da-codec v0.0.0-20240603180909-59f60267e4cc/go.mod h1:1wWYii0OPwd5kw+xrz0PFgS420xNadrNF1x/ELJT+TM=
github.com/scroll-tech/zktrie v0.8.2 h1:UMuIfA+jdgWMLmTgTL64Emo+zzMOdcnH0+eYdDcshxQ=
github.com/scroll-tech/zktrie v0.8.2/go.mod h1:XvNo7vAk8yxNyTjBDj5WIiFzYW4bx/gJ78+NK6Zn6Uk=
github.com/segmentio/kafka-go v0.1.0/go.mod h1:X6itGqS9L4jDletMsxZ7Dz+JFWxM6JHfPOCvTvk+EJo=
github.com/segmentio/kafka-go v0.2.0/go.mod h1:X6itGqS9L4jDletMsxZ7Dz+JFWxM6JHfPOCvTvk+EJo=
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
Expand Down
17 changes: 0 additions & 17 deletions rollup/rollup_sync_service/README.md

This file was deleted.

28 changes: 0 additions & 28 deletions run_test.sh

This file was deleted.

0 comments on commit c78ad62

Please sign in to comment.