Compare commits

...

9 Commits

Author SHA1 Message Date
lightsing
8a05300ab3 apply review from coderabbitai 2025-11-27 12:48:41 +08:00
lightsing
5d378a015d apply review from coderabbitai 2025-11-27 12:43:49 +08:00
lightsing
88066d72e8 apply review 2025-11-27 12:40:36 +08:00
lightsing
226d32f9bf fix: build on macos 2025-11-27 11:49:24 +08:00
georgehao
2ecc42e2f5 Return when total < request page (#1766) 2025-11-25 23:36:40 +08:00
georgehao
de72e2dccb remove unused check (#1765) 2025-11-25 22:12:16 +08:00
georgehao
edb51236e2 bump version (#1763) 2025-11-25 21:00:57 +08:00
georgehao
15a23478d1 fix bridge history GetL2UnclaimedWithdrawalsByAddress (#1760)
Co-authored-by: Péter Garamvölgyi <peter@scroll.io>
2025-11-25 20:59:31 +08:00
Morty
9100a0bd4a fix: ci lint (#1762) 2025-11-25 17:45:05 +08:00
12 changed files with 49 additions and 12 deletions

View File

@@ -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
}

View File

@@ -157,7 +157,7 @@ func (c *CrossMessage) GetL2UnclaimedWithdrawalsByAddress(ctx context.Context, s
db = db.Where("tx_status in (?)", []types.TxStatusType{types.TxStatusTypeSent, types.TxStatusTypeFailedRelayed, types.TxStatusTypeRelayTxReverted})
db = db.Where("sender = ?", sender)
db = db.Order("block_timestamp desc")
db = db.Limit(500)
db = db.Limit(10000)
if err := db.Find(&messages).Error; err != nil {
return nil, fmt.Errorf("failed to get L2 claimable withdrawal messages by sender address, sender: %v, error: %w", sender, err)
}

16
build/common.mk Normal file
View 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

View File

@@ -5,7 +5,7 @@ import (
"runtime/debug"
)
var tag = "v4.7.2"
var tag = "v4.7.5"
var commit = func() string {
if info, ok := debug.ReadBuildInfo(); ok {

View File

@@ -1,4 +1,5 @@
/build/bin
.idea
internal/logic/verifier/lib
internal/libzkp/lib/libzkp.so
libzkp.so
libzkp.dylib

View File

@@ -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

View File

@@ -10,6 +10,8 @@ See [monorepo prerequisites](../README.md#prerequisites).
## Build
Using Go version 1.22
```bash
make clean
make coordinator_api

View File

@@ -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

View File

@@ -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"

View File

@@ -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"] }

View File

@@ -242,8 +242,8 @@ func (b *BlobUploader) GetFirstUnuploadedBatchByPlatform(ctx context.Context, st
break
}
// disable this check to upload blobs before it's committed. This is to
// alleviate the case nodes try to fetch the blob from s3 before its uploaded.
// disable this check to upload blobs before it's committed. This is to
// alleviate the case nodes try to fetch the blob from s3 before its uploaded.
// if len(batch.CommitTxHash) == 0 {
// log.Debug("got batch not committed for blob uploading", "batch_index", batchIndex, "platform", platform.String())
// return nil, nil

View File

@@ -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