Skip to content

Commit 79842f8

Browse files
committed
fixes after merge
1 parent 6464296 commit 79842f8

File tree

9 files changed

+15
-179
lines changed

9 files changed

+15
-179
lines changed

core/rawdb/schema.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,6 @@ var (
157157
// Scroll da syncer store
158158
daSyncedL1BlockNumberKey = []byte("LastDASyncedL1BlockNumber")
159159

160-
// Scroll da syncer store
161-
daSyncedL1BlockNumberKey = []byte("LastDASyncedL1BlockNumber")
162-
163160
// Row consumption
164161
rowConsumptionPrefix = []byte("rc") // rowConsumptionPrefix + hash -> row consumption by block
165162

eth/backend.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ import (
5959
"github.com/scroll-tech/go-ethereum/rlp"
6060
"github.com/scroll-tech/go-ethereum/rollup/ccc"
6161
"github.com/scroll-tech/go-ethereum/rollup/da_syncer"
62+
"github.com/scroll-tech/go-ethereum/rollup/l1"
6263
"github.com/scroll-tech/go-ethereum/rollup/rollup_sync_service"
6364
"github.com/scroll-tech/go-ethereum/rollup/sync_service"
6465
"github.com/scroll-tech/go-ethereum/rpc"
@@ -114,7 +115,7 @@ type Ethereum struct {
114115

115116
// New creates a new Ethereum object (including the
116117
// initialisation of the common Ethereum object)
117-
func New(stack *node.Node, config *ethconfig.Config, l1Client sync_service.EthClient) (*Ethereum, error) {
118+
func New(stack *node.Node, config *ethconfig.Config, l1Client l1.Client) (*Ethereum, error) {
118119
// Ensure configuration values are compatible and sane
119120
if config.SyncMode == downloader.LightSync {
120121
return nil, errors.New("can't run eth.Ethereum in light sync mode, use les.LightEthereum")

rollup/da_syncer/blob_client/blob_client.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ func NewBlobClients(blobClients ...BlobClient) *BlobClients {
3232
}
3333
}
3434

35-
func (c *BlobClients) GetBlobByVersionedHashAndBlockNumber(ctx context.Context, versionedHash common.Hash, blockNumber uint64) (*kzg4844.Blob, error) {
35+
func (c *BlobClients) GetBlobByVersionedHashAndBlockTime(ctx context.Context, versionedHash common.Hash, blockTime uint64) (*kzg4844.Blob, error) {
3636
if len(c.list) == 0 {
3737
return nil, fmt.Errorf("BlobClients.GetBlobByVersionedHash: list of BlobClients is empty")
3838
}
3939

4040
for i := 0; i < len(c.list); i++ {
41-
blob, err := c.list[c.curPos].GetBlobByVersionedHashAndBlockNumber(ctx, versionedHash, blockNumber)
41+
blob, err := c.list[c.curPos].GetBlobByVersionedHashAndBlockTime(ctx, versionedHash, blockTime)
4242
if err == nil {
4343
return blob, nil
4444
}

rollup/da_syncer/blob_client/blob_client_list.go

Lines changed: 0 additions & 65 deletions
This file was deleted.

rollup/da_syncer/da/calldata_blob_source.go

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,12 @@ import (
66
"fmt"
77

88
"github.com/scroll-tech/da-codec/encoding"
9+
910
"github.com/scroll-tech/go-ethereum/accounts/abi"
1011
"github.com/scroll-tech/go-ethereum/common"
11-
"github.com/scroll-tech/go-ethereum/core/types"
1212
"github.com/scroll-tech/go-ethereum/ethdb"
13-
"github.com/scroll-tech/go-ethereum/log"
1413
"github.com/scroll-tech/go-ethereum/rollup/da_syncer/blob_client"
1514
"github.com/scroll-tech/go-ethereum/rollup/da_syncer/serrors"
16-
"github.com/scroll-tech/go-ethereum/rollup/rollup_sync_service"
1715
"github.com/scroll-tech/go-ethereum/rollup/l1"
1816
)
1917

@@ -35,7 +33,7 @@ var (
3533

3634
type CalldataBlobSource struct {
3735
ctx context.Context
38-
l1Reader *l1.Reader
36+
l1Reader *l1.Reader
3937
blobClient blob_client.BlobClient
4038
l1height uint64
4139
scrollChainABI *abi.ABI
@@ -54,7 +52,7 @@ func NewCalldataBlobSource(ctx context.Context, l1height uint64, l1Reader *l1.Re
5452
}
5553
return &CalldataBlobSource{
5654
ctx: ctx,
57-
l1Reader: l1Reader,
55+
l1Reader: l1Reader,
5856
blobClient: blobClient,
5957
l1height: l1height,
6058
scrollChainABI: scrollChainABI,
@@ -89,7 +87,7 @@ func (ds *CalldataBlobSource) NextData() (Entries, error) {
8987
if err != nil {
9088
return nil, serrors.NewTemporaryError(fmt.Errorf("cannot get rollup events, l1height: %d, error: %v", ds.l1height, err))
9189
}
92-
da, err := ds.processLogsToDA(logs)
90+
da, err := ds.processRollupEventsToDA(rollupEvents)
9391
if err != nil {
9492
return nil, serrors.NewTemporaryError(fmt.Errorf("failed to process rollup events to DA, error: %v", err))
9593
}
@@ -175,7 +173,7 @@ func (ds *CalldataBlobSource) getCommitBatchDA(batchIndex uint64, commitEvent *l
175173

176174
txData, err := ds.l1Reader.FetchTxData(commitEvent.TxHash(), commitEvent.BlockHash())
177175
if err != nil {
178-
return nil, fmt.Errorf("failed to fetch tx data, tx hash: %v, err: %w", vLog.TxHash.Hex(), err)
176+
return nil, fmt.Errorf("failed to fetch tx data, tx hash: %v, err: %w", commitEvent.TxHash().Hex(), err)
179177
}
180178
if len(txData) < methodIDLength {
181179
return nil, fmt.Errorf("transaction data is too short, length of tx data: %v, minimum length required: %v", len(txData), methodIDLength)
@@ -202,9 +200,9 @@ func (ds *CalldataBlobSource) getCommitBatchDA(batchIndex uint64, commitEvent *l
202200
}
203201
switch args.Version {
204202
case 0:
205-
return NewCommitBatchDAV0(ds.db, codec, args.Version, batchIndex, args.ParentBatchHeader, args.Chunks, args.SkippedL1MessageBitmap, vLog.BlockNumber)
203+
return NewCommitBatchDAV0(ds.db, codec, args.Version, batchIndex, args.ParentBatchHeader, args.Chunks, args.SkippedL1MessageBitmap, commitEvent.BlockNumber())
206204
case 1, 2:
207-
return NewCommitBatchDAWithBlob(ds.ctx, ds.db, codec, ds.l1Client, ds.blobClient, vLog, args.Version, batchIndex, args.ParentBatchHeader, args.Chunks, args.SkippedL1MessageBitmap)
205+
return NewCommitBatchDAWithBlob(ds.ctx, ds.db, codec, ds.l1Reader, ds.blobClient, commitEvent, args.Version, batchIndex, args.ParentBatchHeader, args.Chunks, args.SkippedL1MessageBitmap)
208206
default:
209207
return nil, fmt.Errorf("failed to decode DA, codec version is unknown: codec version: %d", args.Version)
210208
}
@@ -220,7 +218,7 @@ func (ds *CalldataBlobSource) getCommitBatchDA(batchIndex uint64, commitEvent *l
220218
}
221219
switch args.Version {
222220
case 3, 4:
223-
return NewCommitBatchDAWithBlob(ds.ctx, ds.db, codec, ds.l1Client, ds.blobClient, vLog, args.Version, batchIndex, args.ParentBatchHeader, args.Chunks, args.SkippedL1MessageBitmap)
221+
return NewCommitBatchDAWithBlob(ds.ctx, ds.db, codec, ds.l1Reader, ds.blobClient, commitEvent, args.Version, batchIndex, args.ParentBatchHeader, args.Chunks, args.SkippedL1MessageBitmap)
224222
default:
225223
return nil, fmt.Errorf("failed to decode DA, codec version is unknown: codec version: %d", args.Version)
226224
}

rollup/da_syncer/da/commitV1.go

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,11 @@ import (
66
"fmt"
77

88
"github.com/scroll-tech/da-codec/encoding"
9-
"github.com/scroll-tech/da-codec/encoding/codecv0"
10-
"github.com/scroll-tech/da-codec/encoding/codecv1"
119

1210
"github.com/scroll-tech/go-ethereum/rollup/da_syncer/blob_client"
13-
"github.com/scroll-tech/go-ethereum/rollup/rollup_sync_service"
1411
"github.com/scroll-tech/go-ethereum/rollup/l1"
1512

1613
"github.com/scroll-tech/go-ethereum/common"
17-
"github.com/scroll-tech/go-ethereum/core/types"
1814
"github.com/scroll-tech/go-ethereum/crypto/kzg4844"
1915
"github.com/scroll-tech/go-ethereum/ethdb"
2016
)
@@ -23,7 +19,7 @@ type CommitBatchDAV1 struct {
2319
*CommitBatchDAV0
2420
}
2521

26-
func NewCommitBatchDAV1(ctx context.Context, db ethdb.Database,
22+
func NewCommitBatchDAWithBlob(ctx context.Context, db ethdb.Database,
2723
codec encoding.Codec,
2824
l1Reader *l1.Reader,
2925
blobClient blob_client.BlobClient,
@@ -33,19 +29,6 @@ func NewCommitBatchDAV1(ctx context.Context, db ethdb.Database,
3329
parentBatchHeader []byte,
3430
chunks [][]byte,
3531
skippedL1MessageBitmap []byte,
36-
) (*CommitBatchDAV1, error) {
37-
return NewCommitBatchDAV1WithBlobDecodeFunc(ctx, db, l1Reader, blobClient, commitEvent, version, batchIndex, parentBatchHeader, chunks, skippedL1MessageBitmap, codecv1.DecodeTxsFromBlob)
38-
}
39-
40-
func NewCommitBatchDAV1WithBlobDecodeFunc(ctx context.Context, db ethdb.Database,
41-
l1Reader *l1.Reader,
42-
blobClient blob_client.BlobClient,
43-
commitEvent *l1.CommitBatchEvent,
44-
version uint8,
45-
batchIndex uint64,
46-
parentBatchHeader []byte,
47-
chunks [][]byte,
48-
skippedL1MessageBitmap []byte,
4932
) (*CommitBatchDAV1, error) {
5033
decodedChunks, err := codec.DecodeDAChunksRawTx(chunks)
5134
if err != nil {
@@ -89,7 +72,7 @@ func NewCommitBatchDAV1WithBlobDecodeFunc(ctx context.Context, db ethdb.Database
8972
return nil, fmt.Errorf("decodedChunks is nil after decoding")
9073
}
9174

92-
v0, err := NewCommitBatchDAV0WithChunks(db, version, batchIndex, parentBatchHeader, decodedChunks, skippedL1MessageBitmap, vLog.BlockNumber)
75+
v0, err := NewCommitBatchDAV0WithChunks(db, version, batchIndex, parentBatchHeader, decodedChunks, skippedL1MessageBitmap, commitEvent.BlockNumber())
9376
if err != nil {
9477
return nil, err
9578
}

rollup/da_syncer/da/commitV2.go

Lines changed: 0 additions & 38 deletions
This file was deleted.

rollup/da_syncer/da/commitV4.go

Lines changed: 0 additions & 38 deletions
This file was deleted.

rollup/da_syncer/syncing_pipeline.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ import (
1515
"github.com/scroll-tech/go-ethereum/params"
1616
"github.com/scroll-tech/go-ethereum/rollup/da_syncer/blob_client"
1717
"github.com/scroll-tech/go-ethereum/rollup/da_syncer/serrors"
18-
"github.com/scroll-tech/go-ethereum/rollup/rollup_sync_service"
19-
"github.com/scroll-tech/go-ethereum/rollup/sync_service"
2018
"github.com/scroll-tech/go-ethereum/rollup/l1"
2119
)
2220

@@ -54,7 +52,7 @@ func NewSyncingPipeline(ctx context.Context, blockchain *core.BlockChain, genesi
5452
return nil, fmt.Errorf("failed to initialize l1.Reader, err = %w", err)
5553
}
5654

57-
blobClientList := blob_client.NewBlobClientList()
55+
blobClientList := blob_client.NewBlobClients()
5856
if config.BeaconNodeAPIEndpoint != "" {
5957
beaconNodeClient, err := blob_client.NewBeaconNodeClient(config.BeaconNodeAPIEndpoint)
6058
if err != nil {

0 commit comments

Comments
 (0)