Skip to content

Commit 3d964d6

Browse files
update rollup verifier (#930)
* update l2geth verifier * update verifier * update * remove old structures * decrease diff * decrease diff * fix image build error * update dependency * update c-kzg-4844 dependency * clean up * clean up --------- Co-authored-by: HAOYUatHZ <haoyu@protonmail.com> Co-authored-by: HAOYUatHZ <37070449+HAOYUatHZ@users.noreply.github.com>
1 parent 4d3f984 commit 3d964d6

23 files changed

+1228
-620
lines changed

build/ci.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ func buildFlags(env build.Environment, staticLinking bool, buildTags []string) (
260260
if runtime.GOOS == "linux" {
261261
// Enforce the stacksize to 8M, which is the case on most platforms apart from
262262
// alpine Linux.
263-
extld := []string{"-Wl,-z,stack-size=0x800000"}
263+
extld := []string{"-Wl,-z,stack-size=0x800000", "-ldl"}
264264
if staticLinking {
265265
extld = append(extld, "-static")
266266
// Under static linking, use of certain glibc features must be

core/rawdb/accessors_rollup_event.go

+27
Original file line numberDiff line numberDiff line change
@@ -144,3 +144,30 @@ func ReadFinalizedL2BlockNumber(db ethdb.Reader) *uint64 {
144144
finalizedL2BlockNumber := number.Uint64()
145145
return &finalizedL2BlockNumber
146146
}
147+
148+
// WriteLastFinalizedBatchIndex stores the last finalized batch index in the database.
149+
func WriteLastFinalizedBatchIndex(db ethdb.KeyValueWriter, lastFinalizedBatchIndex uint64) {
150+
value := big.NewInt(0).SetUint64(lastFinalizedBatchIndex).Bytes()
151+
if err := db.Put(lastFinalizedBatchIndexKey, value); err != nil {
152+
log.Crit("failed to store last finalized batch index for rollup event", "batch index", lastFinalizedBatchIndex, "value", value, "err", err)
153+
}
154+
}
155+
156+
// ReadLastFinalizedBatchIndex fetches the last finalized batch index from the database.
157+
func ReadLastFinalizedBatchIndex(db ethdb.Reader) *uint64 {
158+
data, err := db.Get(lastFinalizedBatchIndexKey)
159+
if err != nil && isNotFoundErr(err) {
160+
return nil
161+
}
162+
if err != nil {
163+
log.Crit("failed to read last finalized batch index from database", "key", lastFinalizedBatchIndexKey, "err", err)
164+
}
165+
166+
number := new(big.Int).SetBytes(data)
167+
if !number.IsUint64() {
168+
log.Crit("unexpected finalized batch index in database", "data", data, "number", number)
169+
}
170+
171+
lastFinalizedBatchIndex := number.Uint64()
172+
return &lastFinalizedBatchIndex
173+
}

core/rawdb/accessors_rollup_event_test.go

+26
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,32 @@ func TestFinalizedL2BlockNumber(t *testing.T) {
5858
}
5959
}
6060

61+
func TestLastFinalizedBatchIndex(t *testing.T) {
62+
batchIndxes := []uint64{
63+
1,
64+
1 << 2,
65+
1 << 8,
66+
1 << 16,
67+
1 << 32,
68+
}
69+
70+
db := NewMemoryDatabase()
71+
72+
// read non-existing value
73+
if got := ReadLastFinalizedBatchIndex(db); got != nil {
74+
t.Fatal("Expected nil for non-existing value", "got", *got)
75+
}
76+
77+
for _, num := range batchIndxes {
78+
WriteLastFinalizedBatchIndex(db, num)
79+
got := ReadLastFinalizedBatchIndex(db)
80+
81+
if *got != num {
82+
t.Fatal("Batch index mismatch", "expected", num, "got", got)
83+
}
84+
}
85+
}
86+
6187
func TestFinalizedBatchMeta(t *testing.T) {
6288
batches := []*FinalizedBatchMeta{
6389
{

core/rawdb/schema.go

+1
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ var (
152152
batchChunkRangesPrefix = []byte("R-bcr")
153153
batchMetaPrefix = []byte("R-bm")
154154
finalizedL2BlockNumberKey = []byte("R-finalized")
155+
lastFinalizedBatchIndexKey = []byte("R-finalizedBatchIndex")
155156

156157
// Row consumption
157158
rowConsumptionPrefix = []byte("rc") // rowConsumptionPrefix + hash -> row consumption by block

go.mod

+15-13
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/scroll-tech/go-ethereum
22

3-
go 1.20
3+
go 1.21
44

55
require (
66
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.2.0
@@ -40,9 +40,9 @@ require (
4040
github.com/hashicorp/go-bexpr v0.1.10
4141
github.com/holiman/billy v0.0.0-20230718173358-1c7e68d277a7
4242
github.com/holiman/bloomfilter/v2 v2.0.3
43-
github.com/holiman/uint256 v1.2.3
43+
github.com/holiman/uint256 v1.2.4
4444
github.com/huin/goupnp v1.3.0
45-
github.com/iden3/go-iden3-crypto v0.0.12
45+
github.com/iden3/go-iden3-crypto v0.0.15
4646
github.com/influxdata/influxdb-client-go/v2 v2.4.0
4747
github.com/influxdata/influxdb1-client v0.0.0-20220302092344-a9ab5670611c
4848
github.com/jackpal/go-nat-pmp v1.0.2
@@ -57,20 +57,21 @@ require (
5757
github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7
5858
github.com/protolambda/bls12-381-util v0.0.0-20220416220906-d8552aa452c7
5959
github.com/rs/cors v1.7.0
60+
github.com/scroll-tech/da-codec v0.1.1-0.20240727174557-66c0e75af163
6061
github.com/scroll-tech/zktrie v0.8.4
61-
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible
62+
github.com/shirou/gopsutil v3.21.11+incompatible
6263
github.com/status-im/keycard-go v0.2.0
63-
github.com/stretchr/testify v1.8.4
64+
github.com/stretchr/testify v1.9.0
6465
github.com/supranational/blst v0.3.11
6566
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7
6667
github.com/tyler-smith/go-bip39 v1.1.0
6768
github.com/urfave/cli/v2 v2.25.7
6869
go.uber.org/automaxprocs v1.5.2
69-
golang.org/x/crypto v0.14.0
70+
golang.org/x/crypto v0.17.0
7071
golang.org/x/exp v0.0.0-20230905200255-921286631fa9
71-
golang.org/x/sync v0.3.0
72-
golang.org/x/sys v0.13.0
73-
golang.org/x/text v0.13.0
72+
golang.org/x/sync v0.6.0
73+
golang.org/x/sys v0.17.0
74+
golang.org/x/text v0.14.0
7475
golang.org/x/time v0.3.0
7576
golang.org/x/tools v0.13.0
7677
gopkg.in/natefinch/lumberjack.v2 v2.0.0
@@ -81,7 +82,6 @@ require (
8182
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.0 // indirect
8283
github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 // indirect
8384
github.com/DataDog/zstd v1.4.5 // indirect
84-
github.com/StackExchange/wmi v1.2.1 // indirect
8585
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.13 // indirect
8686
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.43 // indirect
8787
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.37 // indirect
@@ -92,7 +92,8 @@ require (
9292
github.com/aws/aws-sdk-go-v2/service/sts v1.23.2 // indirect
9393
github.com/aws/smithy-go v1.15.0 // indirect
9494
github.com/beorn7/perks v1.0.1 // indirect
95-
github.com/bits-and-blooms/bitset v1.7.0 // indirect
95+
github.com/bits-and-blooms/bitset v1.12.0 // indirect
96+
github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 // indirect
9697
github.com/cespare/xxhash/v2 v2.2.0 // indirect
9798
github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f // indirect
9899
github.com/cockroachdb/redact v1.0.8 // indirect
@@ -105,7 +106,7 @@ require (
105106
github.com/deepmap/oapi-codegen v1.6.0 // indirect
106107
github.com/dlclark/regexp2 v1.7.0 // indirect
107108
github.com/garslo/gogen v0.0.0-20170306192744-1d203ffc1f61 // indirect
108-
github.com/go-ole/go-ole v1.2.5 // indirect
109+
github.com/go-ole/go-ole v1.3.0 // indirect
109110
github.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirect
110111
github.com/goccy/go-json v0.10.2 // indirect
111112
github.com/gogo/protobuf v1.3.2 // indirect
@@ -134,11 +135,12 @@ require (
134135
github.com/prometheus/common v0.32.1 // indirect
135136
github.com/prometheus/procfs v0.7.3 // indirect
136137
github.com/rivo/uniseg v0.2.0 // indirect
137-
github.com/rogpeppe/go-internal v1.9.0 // indirect
138+
github.com/rogpeppe/go-internal v1.10.0 // indirect
138139
github.com/russross/blackfriday/v2 v2.1.0 // indirect
139140
github.com/tklauser/go-sysconf v0.3.12 // indirect
140141
github.com/tklauser/numcpus v0.6.1 // indirect
141142
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
143+
github.com/yusufpapurcu/wmi v1.2.3 // indirect
142144
golang.org/x/mod v0.12.0 // indirect
143145
golang.org/x/net v0.17.0 // indirect
144146
google.golang.org/protobuf v1.27.1 // indirect

0 commit comments

Comments
 (0)