Skip to content

Commit 2bc7a54

Browse files
committed
Merge branch 'develop' into fix-requests-hash-in-sdk
2 parents bd8f141 + 9aa8b3f commit 2bc7a54

File tree

30 files changed

+4940
-117
lines changed

30 files changed

+4940
-117
lines changed

.github/workflows/cloak.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Cloak Docker
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
docker:
8+
runs-on: ubuntu-latest
9+
permissions: {}
10+
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v4
14+
with:
15+
persist-credentials: false
16+
17+
- name: Log in to Docker Hub
18+
uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0
19+
with:
20+
username: ${{ secrets.DOCKERHUB_USERNAME }}
21+
password: ${{ secrets.DOCKERHUB_TOKEN }}
22+
23+
- name: Extract commit digest
24+
id: vars
25+
run: echo "sha8=${GITHUB_SHA::8}" >> $GITHUB_OUTPUT
26+
27+
- name: Build and Push Docker image
28+
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
29+
with:
30+
context: .
31+
platforms: linux/amd64
32+
push: true
33+
tags: scrolltech/cloak-l2geth:${{ steps.vars.outputs.sha8 }}

.github/workflows/l2geth_ci.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
- name: Install Go
2424
uses: actions/setup-go@v5
2525
with:
26-
go-version: 1.21.x
26+
go-version: 1.22.x
2727

2828
- name: Checkout code
2929
uses: actions/checkout@v4
@@ -42,7 +42,7 @@ jobs:
4242
- name: Install Go
4343
uses: actions/setup-go@v5
4444
with:
45-
go-version: 1.21.x
45+
go-version: 1.22.x
4646

4747
- name: Install rust
4848
uses: actions-rust-lang/setup-rust-toolchain@9399c7bb15d4c7d47b27263d024f0a4978346ba4 # v1.11.0
@@ -63,14 +63,15 @@ jobs:
6363
make geth
6464
6565
check:
66-
if: github.event.pull_request.draft == false
66+
# if: github.event.pull_request.draft == false
67+
if: false
6768
runs-on: ubuntu-latest
6869
permissions: {}
6970
steps:
7071
- name: Install Go
7172
uses: actions/setup-go@v5
7273
with:
73-
go-version: 1.21.x
74+
go-version: 1.22.x
7475

7576
- name: Checkout code
7677
uses: actions/checkout@v4
@@ -117,7 +118,7 @@ jobs:
117118
- name: Install Go
118119
uses: actions/setup-go@v5
119120
with:
120-
go-version: 1.21.x
121+
go-version: 1.22.x
121122

122123
- name: Checkout code
123124
uses: actions/checkout@v4
@@ -141,7 +142,7 @@ jobs:
141142
- name: Install Go
142143
uses: actions/setup-go@v5
143144
with:
144-
go-version: 1.21.x
145+
go-version: 1.22.x
145146

146147
- name: Checkout code
147148
uses: actions/checkout@v4

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ ARG BUILDNUM=""
55
ARG SCROLL_LIB_PATH=/scroll/lib
66

77
# Build libzkp dependency
8-
FROM scrolltech/go-rust-builder:go-1.21-rust-nightly-2023-12-03 as chef
8+
FROM scrolltech/go-rust-builder:go-1.22.12-rust-nightly-2025-02-14 as chef
99
WORKDIR app
1010

1111
FROM chef as planner
@@ -22,7 +22,7 @@ RUN cargo clean
2222
RUN cargo build --release
2323

2424
# Build Geth in a stock Go builder container
25-
FROM scrolltech/go-rust-builder:go-1.21-rust-nightly-2023-12-03 as builder
25+
FROM scrolltech/go-rust-builder:go-1.22.12-rust-nightly-2025-02-14 as builder
2626

2727
ADD . /go-ethereum
2828

Dockerfile.alltools

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ ARG VERSION=""
44
ARG BUILDNUM=""
55

66
# Build Geth in a stock Go builder container
7-
FROM golang:1.21-alpine as builder
7+
FROM golang:1.22-alpine as builder
88

99
RUN apk add --no-cache gcc musl-dev linux-headers git
1010

Dockerfile.mockccc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ ARG BUILDNUM=""
55
ARG SCROLL_LIB_PATH=/scroll/lib
66

77
# Build Geth in a stock Go builder container
8-
FROM scrolltech/go-rust-builder:go-1.21-rust-nightly-2023-12-03 as builder
8+
FROM scrolltech/go-rust-builder:go-1.22.12-rust-nightly-2025-02-14 as builder
99

1010
WORKDIR /go-ethereum
1111
COPY go.mod go.sum ./

Dockerfile.mockccc.alpine

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ ARG VERSION=""
44
ARG BUILDNUM=""
55

66
# Build Geth in a stock Go builder container
7-
FROM golang:1.21-alpine as builder
7+
FROM golang:1.22-alpine as builder
88

99
RUN apk add --no-cache gcc musl-dev linux-headers git
1010

cmd/geth/main.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,8 @@ var (
170170
utils.L1EndpointFlag,
171171
utils.L1ConfirmationsFlag,
172172
utils.L1DeploymentBlockFlag,
173+
utils.L1SyncIntervalFlag,
174+
utils.L1FetchBlockRangeFlag,
173175
utils.L1DisableMessageQueueV2Flag,
174176
utils.CircuitCapacityCheckEnabledFlag,
175177
utils.CircuitCapacityCheckWorkersFlag,

cmd/geth/usage.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ var AppHelpFlagGroups = []flags.FlagGroup{
233233
utils.L1EndpointFlag,
234234
utils.L1ConfirmationsFlag,
235235
utils.L1DeploymentBlockFlag,
236+
utils.L1SyncIntervalFlag,
236237
utils.L1DisableMessageQueueV2Flag,
237238
utils.RollupVerifyEnabledFlag,
238239
utils.DASyncEnabledFlag,

cmd/utils/flags.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -853,6 +853,14 @@ var (
853853
Name: "l1.sync.startblock",
854854
Usage: "L1 block height to start syncing from. Should be set to the L1 message queue deployment block number.",
855855
}
856+
L1SyncIntervalFlag = cli.DurationFlag{
857+
Name: "l1.sync.interval",
858+
Usage: "Poll interval for L1 message syncing (e.g., 2s, 10s, 1m)",
859+
}
860+
L1FetchBlockRangeFlag = cli.Int64Flag{
861+
Name: "l1.sync.fetchblockrange",
862+
Usage: "Block range for L1 message fetching in a single eth_getLogs query",
863+
}
856864
L1DisableMessageQueueV2Flag = &cli.BoolFlag{
857865
Name: "l1.disablemqv2",
858866
Usage: "Disable L1 message queue v2",
@@ -1470,6 +1478,12 @@ func setL1(ctx *cli.Context, cfg *node.Config) {
14701478
if ctx.GlobalIsSet(L1DeploymentBlockFlag.Name) {
14711479
cfg.L1DeploymentBlock = ctx.GlobalUint64(L1DeploymentBlockFlag.Name)
14721480
}
1481+
if ctx.GlobalIsSet(L1SyncIntervalFlag.Name) {
1482+
cfg.L1SyncInterval = ctx.GlobalDuration(L1SyncIntervalFlag.Name)
1483+
}
1484+
if ctx.GlobalIsSet(L1FetchBlockRangeFlag.Name) {
1485+
cfg.L1FetchBlockRange = ctx.GlobalUint64(L1FetchBlockRangeFlag.Name)
1486+
}
14731487
if ctx.GlobalIsSet(L1DisableMessageQueueV2Flag.Name) {
14741488
cfg.L1DisableMessageQueueV2 = ctx.GlobalBool(L1DisableMessageQueueV2Flag.Name)
14751489
}

consensus/system_contract/consensus.go

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,42 @@ func (s *SystemContract) VerifyUncles(chain consensus.ChainReader, block *types.
227227
return nil
228228
}
229229

230+
// CalcBlocksPerSecond returns the number of blocks per second
231+
// Uses the BlocksPerSecond configuration parameter directly
232+
// Default is 1 block per second if not specified
233+
func CalcBlocksPerSecond(blocksPerSecond uint64) uint64 {
234+
if blocksPerSecond == 0 {
235+
return 1 // Default to 1 block per second
236+
}
237+
return blocksPerSecond
238+
}
239+
240+
// CalcPeriodMs calculates the period in milliseconds between blocks
241+
// based on the blocks per second configuration
242+
func CalcPeriodMs(blocksPerSecond uint64) uint64 {
243+
bps := CalcBlocksPerSecond(blocksPerSecond)
244+
return 1000 / bps
245+
}
246+
230247
func (s *SystemContract) CalcTimestamp(parent *types.Header) uint64 {
231-
timestamp := parent.Time + s.config.Period
248+
var timestamp uint64
249+
if s.config.Period == 1 {
250+
// Get the base timestamp (in seconds)
251+
timestamp = parent.Time
252+
253+
blocksPerSecond := CalcBlocksPerSecond(s.config.BlocksPerSecond)
254+
255+
// Calculate the block index within the current period for the next block
256+
blockIndex := parent.Number.Uint64() % blocksPerSecond
257+
258+
// If this block is the last one in the current second, increment the timestamp
259+
// We compare with blocksPerSecond-1 because blockIndex is 0-based
260+
if blockIndex == blocksPerSecond-1 {
261+
timestamp++
262+
}
263+
} else {
264+
timestamp = parent.Time + s.config.Period
265+
}
232266

233267
// If RelaxedPeriod is enabled, always set the header timestamp to now (ie the time we start building it) as
234268
// we don't know when it will be sealed

0 commit comments

Comments
 (0)