mirror of
https://github.com/scroll-tech/scroll.git
synced 2026-01-12 07:28:08 -05:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8a05300ab3 | ||
|
|
5d378a015d | ||
|
|
88066d72e8 | ||
|
|
226d32f9bf | ||
|
|
2ecc42e2f5 |
@@ -361,7 +361,6 @@ func getTxHistoryInfoFromBridgeBatchDepositMessage(message *orm.BridgeBatchDepos
|
||||
func (h *HistoryLogic) getCachedTxsInfo(ctx context.Context, cacheKey string, pageNum, pageSize uint64) ([]*types.TxHistoryInfo, uint64, bool, error) {
|
||||
start := int64((pageNum - 1) * pageSize)
|
||||
end := start + int64(pageSize) - 1
|
||||
|
||||
total, err := h.redis.ZCard(ctx, cacheKey).Result()
|
||||
if err != nil {
|
||||
log.Error("failed to get zcard result", "error", err)
|
||||
@@ -372,6 +371,10 @@ func (h *HistoryLogic) getCachedTxsInfo(ctx context.Context, cacheKey string, pa
|
||||
return nil, 0, false, nil
|
||||
}
|
||||
|
||||
if start >= total {
|
||||
return nil, 0, false, nil
|
||||
}
|
||||
|
||||
values, err := h.redis.ZRevRange(ctx, cacheKey, start, end).Result()
|
||||
if err != nil {
|
||||
log.Error("failed to get zrange result", "error", err)
|
||||
@@ -450,5 +453,6 @@ func (h *HistoryLogic) processAndCacheTxHistoryInfo(ctx context.Context, cacheKe
|
||||
log.Error("cache miss after write, expect hit", "cached key", cacheKey, "page", page, "page size", pageSize, "error", err)
|
||||
return nil, 0, err
|
||||
}
|
||||
|
||||
return pagedTxs, total, nil
|
||||
}
|
||||
|
||||
16
build/common.mk
Normal file
16
build/common.mk
Normal file
@@ -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
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"runtime/debug"
|
||||
)
|
||||
|
||||
var tag = "v4.7.4"
|
||||
var tag = "v4.7.5"
|
||||
|
||||
var commit = func() string {
|
||||
if info, ok := debug.ReadBuildInfo(); ok {
|
||||
|
||||
3
coordinator/.gitignore
vendored
3
coordinator/.gitignore
vendored
@@ -1,4 +1,5 @@
|
||||
/build/bin
|
||||
.idea
|
||||
internal/logic/verifier/lib
|
||||
internal/libzkp/lib/libzkp.so
|
||||
libzkp.so
|
||||
libzkp.dylib
|
||||
|
||||
@@ -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)
|
||||
@@ -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
|
||||
|
||||
@@ -10,6 +10,8 @@ See [monorepo prerequisites](../README.md#prerequisites).
|
||||
|
||||
## Build
|
||||
|
||||
Using Go version 1.22
|
||||
|
||||
```bash
|
||||
make clean
|
||||
make coordinator_api
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"] }
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
include ../../build/common.mk
|
||||
|
||||
.PHONY: clean setup_db test_tool all check_vars
|
||||
|
||||
include conf/.make.env
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user