Skip to content

Commit f4e17bc

Browse files
committed
fix ci
1 parent e713424 commit f4e17bc

File tree

9 files changed

+260
-44
lines changed

9 files changed

+260
-44
lines changed

build/.golangci.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ linters-settings:
9191
#local-prefixes: github.com/org/project
9292
gocyclo:
9393
# minimal code complexity to report, 30 by default (but we recommend 10-20)
94-
min-complexity: 30
94+
min-complexity: 40
9595
maligned:
9696
# print struct with more effective memory layout or not, false by default
9797
suggest-new: true
@@ -254,6 +254,9 @@ issues:
254254
- linters:
255255
- wsl
256256
text: "expressions should not be cuddled with declarations or returns"
257+
- linters:
258+
- govet
259+
text: 'shadow: declaration of "(err|ctx)" shadows declaration at'
257260

258261
# Independently from option `exclude` we use default exclude patterns,
259262
# it can be disabled by this option. To list all

database/migrate/migrate_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,20 +59,20 @@ func testResetDB(t *testing.T) {
5959
cur, err := Current(pgDB)
6060
assert.NoError(t, err)
6161
// total number of tables.
62-
assert.Equal(t, int64(24), cur)
62+
assert.Equal(t, int64(25), cur)
6363
}
6464

6565
func testMigrate(t *testing.T) {
6666
assert.NoError(t, Migrate(pgDB))
6767
cur, err := Current(pgDB)
6868
assert.NoError(t, err)
69-
assert.Equal(t, int64(24), cur)
69+
assert.Equal(t, int64(25), cur)
7070
}
7171

7272
func testRollback(t *testing.T) {
7373
version, err := Current(pgDB)
7474
assert.NoError(t, err)
75-
assert.Equal(t, int64(24), version)
75+
assert.Equal(t, int64(25), version)
7676

7777
assert.NoError(t, Rollback(pgDB, nil))
7878

database/migrate/migrations/00025_add_l1_message_queue_hash.sql

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
-- +goose StatementBegin
33

44
ALTER TABLE chunk
5-
ADD COLUMN initial_l1_message_queue_hash VARCHAR DEFAULT '';
5+
ADD COLUMN initial_l1_message_queue_hash VARCHAR DEFAULT '',
66
ADD COLUMN last_l1_message_queue_hash VARCHAR DEFAULT '';
77

88
ALTER TABLE batch
9-
ADD COLUMN initial_l1_message_queue_hash VARCHAR DEFAULT '';
9+
ADD COLUMN initial_l1_message_queue_hash VARCHAR DEFAULT '',
1010
ADD COLUMN last_l1_message_queue_hash VARCHAR DEFAULT '';
1111

1212

@@ -16,11 +16,11 @@ ADD COLUMN last_l1_message_queue_hash VARCHAR DEFAULT '';
1616
-- +goose StatementBegin
1717

1818
ALTER TABLE IF EXISTS chunk
19-
DROP COLUMN IF EXISTS initial_l1_message_queue_hash;
19+
DROP COLUMN IF EXISTS initial_l1_message_queue_hash,
2020
DROP COLUMN IF EXISTS last_l1_message_queue_hash;
2121

2222
ALTER TABLE IF EXISTS batch
23-
DROP COLUMN IF EXISTS initial_l1_message_queue_hash;
23+
DROP COLUMN IF EXISTS initial_l1_message_queue_hash,
2424
DROP COLUMN IF EXISTS last_l1_message_queue_hash;
2525

2626
-- +goose StatementEnd

go.work.sum

Lines changed: 192 additions & 0 deletions
Large diffs are not rendered by default.

rollup/conf/config.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,12 @@
4949
"tx_type": "DynamicFeeTx",
5050
"check_pending_time": 1,
5151
"min_gas_tip": 100000000,
52-
"max_pending_blob_txs": 3
52+
"max_pending_blob_txs": 3,
53+
"batch_submission": {
54+
"min_batches": 1,
55+
"max_batches": 6,
56+
"timeout": 300
57+
}
5358
},
5459
"gas_oracle_config": {
5560
"min_gas_price": 0,

rollup/go.sum

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -249,14 +249,9 @@ github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6ke
249249
github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4=
250250
github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE=
251251
github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ=
252-
github.com/scroll-tech/da-codec v0.1.3-0.20250128015324-64133efc3843 h1:Qd6bh5Cn5hqf/yyz4ucq4Z2qIStH4KUYsPNK/zfaAb8=
253-
github.com/scroll-tech/da-codec v0.1.3-0.20250128015324-64133efc3843/go.mod h1:+ho/ItbapMf2xM9YUv/SfGFg3AJx9lBD7ksR7T0ZVmM=
254-
github.com/scroll-tech/da-codec v0.1.3-0.20250205011841-edaf5d2f9f24 h1:E+DYPJPoIxviTfyjttoHoZ0ylv2n9fNHHwTK6n4vCss=
255-
github.com/scroll-tech/da-codec v0.1.3-0.20250205011841-edaf5d2f9f24/go.mod h1:irqXJdRI5fsGkilJCpNTnJb8oV8KR51j68QXIWoth6U=
256252
github.com/scroll-tech/da-codec v0.1.3-0.20250205043214-894a93bb6b53 h1:07eHUuUhQ2rOP6ij5+KV1MgQurkwyweomkxp5nAG6o8=
257253
github.com/scroll-tech/da-codec v0.1.3-0.20250205043214-894a93bb6b53/go.mod h1:irqXJdRI5fsGkilJCpNTnJb8oV8KR51j68QXIWoth6U=
258-
github.com/scroll-tech/go-ethereum v1.10.14-0.20250103082839-ea3ec93d8c1e h1:g8jtcGiHbjWYh/V7O245IDho3WfQT4CwEpBV+MhYDrg=
259-
github.com/scroll-tech/go-ethereum v1.10.14-0.20250103082839-ea3ec93d8c1e/go.mod h1:Ik3OBLl7cJxPC+CFyCBYNXBPek4wpdzkWehn/y5qLM8=
254+
github.com/scroll-tech/go-ethereum v1.10.14-0.20250129031936-44c72cd3fa47 h1:JbYYsGZMU1yAYsF/Ds6STMlItYy0SXj86nqdXC7nHyk=
260255
github.com/scroll-tech/go-ethereum v1.10.14-0.20250129031936-44c72cd3fa47/go.mod h1:8WbNuuUjie/LTdFXGGT7Z711MRW8Vv2zWLrcibg7hDc=
261256
github.com/scroll-tech/zktrie v0.8.4 h1:UagmnZ4Z3ITCk+aUq9NQZJNAwnWl4gSxsLb2Nl7IgRE=
262257
github.com/scroll-tech/zktrie v0.8.4/go.mod h1:XvNo7vAk8yxNyTjBDj5WIiFzYW4bx/gJ78+NK6Zn6Uk=

rollup/internal/controller/relayer/l2_relayer.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ import (
1010
"strings"
1111
"time"
1212

13+
"scroll-tech/common/types"
14+
"scroll-tech/common/types/message"
15+
"scroll-tech/common/utils"
16+
1317
"github.com/go-resty/resty/v2"
1418
"github.com/prometheus/client_golang/prometheus"
1519
"github.com/scroll-tech/da-codec/encoding"
@@ -23,10 +27,6 @@ import (
2327
"github.com/scroll-tech/go-ethereum/params"
2428
"gorm.io/gorm"
2529

26-
"scroll-tech/common/types"
27-
"scroll-tech/common/types/message"
28-
"scroll-tech/common/utils"
29-
3030
bridgeAbi "scroll-tech/rollup/abi"
3131
"scroll-tech/rollup/internal/config"
3232
"scroll-tech/rollup/internal/controller/sender"

rollup/internal/controller/sender/sender.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -688,6 +688,9 @@ func makeSidecar(blobsInput []*kzg4844.Blob) (*gethTypes.BlobTxSidecar, error) {
688688

689689
blobs := make([]kzg4844.Blob, len(blobsInput))
690690
for i, blob := range blobsInput {
691+
if blob == nil {
692+
return nil, fmt.Errorf("blob at index %d is nil", i)
693+
}
691694
blobs[i] = *blob
692695
}
693696

rollup/internal/controller/sender/sender_test.go

Lines changed: 43 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ var (
4444
cfg *config.Config
4545
testApps *testcontainers.TestcontainerApps
4646
txTypes = []string{"LegacyTx", "DynamicFeeTx", "DynamicFeeTx"}
47-
txBlob = []*kzg4844.Blob{nil, nil, randBlob()}
47+
txBlob = []*kzg4844.Blob{nil, nil, randBlobs(2)[0]}
4848
txUint8Types = []uint8{0, 2, 3}
4949
db *gorm.DB
5050
testContractsAddress common.Address
@@ -185,7 +185,11 @@ func testSendAndRetrieveTransaction(t *testing.T) {
185185
s, err := NewSender(context.Background(), &cfgCopy, signerConfig, "test", "test", types.SenderTypeUnknown, db, nil)
186186
assert.NoError(t, err)
187187

188-
hash, err := s.SendTransaction("0", &common.Address{}, nil, txBlob[i], 0)
188+
var blobs []*kzg4844.Blob
189+
if txBlob[i] != nil {
190+
blobs = []*kzg4844.Blob{txBlob[i]}
191+
}
192+
hash, err := s.SendTransaction("0", &common.Address{}, nil, blobs, 0)
189193
assert.NoError(t, err)
190194
txs, err := s.pendingTransactionOrm.GetPendingOrReplacedTransactionsBySenderType(context.Background(), s.senderType, 1)
191195
assert.NoError(t, err)
@@ -224,8 +228,12 @@ func testFallbackGasLimit(t *testing.T) {
224228
client, err := ethclient.Dial(cfgCopy.Endpoint)
225229
assert.NoError(t, err)
226230

231+
var blobs []*kzg4844.Blob
232+
if txBlob[i] != nil {
233+
blobs = []*kzg4844.Blob{txBlob[i]}
234+
}
227235
// FallbackGasLimit = 0
228-
txHash0, err := s.SendTransaction("0", &common.Address{}, nil, txBlob[i], 0)
236+
txHash0, err := s.SendTransaction("0", &common.Address{}, nil, blobs, 0)
229237
assert.NoError(t, err)
230238
tx0, _, err := client.TransactionByHash(context.Background(), txHash0)
231239
assert.NoError(t, err)
@@ -245,7 +253,7 @@ func testFallbackGasLimit(t *testing.T) {
245253
},
246254
)
247255

248-
txHash1, err := s.SendTransaction("1", &common.Address{}, nil, txBlob[i], 100000)
256+
txHash1, err := s.SendTransaction("1", &common.Address{}, nil, blobs, 100000)
249257
assert.NoError(t, err)
250258
tx1, _, err := client.TransactionByHash(context.Background(), txHash1)
251259
assert.NoError(t, err)
@@ -329,7 +337,7 @@ func testAccessListTransactionGasLimit(t *testing.T) {
329337

330338
var sidecar *gethTypes.BlobTxSidecar
331339
if txBlob[i] != nil {
332-
sidecar, err = makeSidecar(txBlob[i])
340+
sidecar, err = makeSidecar([]*kzg4844.Blob{txBlob[i]})
333341
assert.NoError(t, err)
334342
}
335343

@@ -370,7 +378,7 @@ func testResubmitNonZeroGasPriceTransaction(t *testing.T) {
370378
}
371379
var sidecar *gethTypes.BlobTxSidecar
372380
if txBlob[i] != nil {
373-
sidecar, err = makeSidecar(txBlob[i])
381+
sidecar, err = makeSidecar([]*kzg4844.Blob{txBlob[i]})
374382
assert.NoError(t, err)
375383
}
376384
tx, err := s.createTx(feeData, &common.Address{}, nil, sidecar, s.transactionSigner.GetNonce())
@@ -505,7 +513,7 @@ func testResubmitBlobTransactionWithRisingBaseFeeAndBlobBaseFee(t *testing.T) {
505513
})
506514
defer patchGuard.Reset()
507515

508-
sidecar, err := makeSidecar(randBlob())
516+
sidecar, err := makeSidecar(randBlobs(1))
509517
assert.NoError(t, err)
510518
tx := gethTypes.NewTx(&gethTypes.BlobTx{
511519
ChainID: uint256.MustFromBig(s.chainID),
@@ -579,10 +587,14 @@ func testResubmitNonceGappedTransaction(t *testing.T) {
579587
return nil, errors.New("simulated transaction receipt error")
580588
})
581589

582-
_, err = s.SendTransaction("test-1", &common.Address{}, nil, txBlob[i], 0)
590+
var blobs []*kzg4844.Blob
591+
if txBlob[i] != nil {
592+
blobs = []*kzg4844.Blob{txBlob[i]}
593+
}
594+
_, err = s.SendTransaction("test-1", &common.Address{}, nil, blobs, 0)
583595
assert.NoError(t, err)
584596

585-
_, err = s.SendTransaction("test-2", &common.Address{}, nil, txBlob[i], 0)
597+
_, err = s.SendTransaction("test-2", &common.Address{}, nil, blobs, 0)
586598
assert.NoError(t, err)
587599

588600
s.checkPendingTransaction()
@@ -623,7 +635,7 @@ func testCheckPendingTransactionTxConfirmed(t *testing.T) {
623635
return nil
624636
})
625637

626-
_, err = s.SendTransaction("test", &common.Address{}, nil, randBlob(), 0)
638+
_, err = s.SendTransaction("test", &common.Address{}, nil, randBlobs(1), 0)
627639
assert.NoError(t, err)
628640

629641
txs, err := s.pendingTransactionOrm.GetPendingOrReplacedTransactionsBySenderType(context.Background(), s.senderType, 1)
@@ -665,7 +677,7 @@ func testCheckPendingTransactionResubmitTxConfirmed(t *testing.T) {
665677
return nil
666678
})
667679

668-
originTxHash, err := s.SendTransaction("test", &common.Address{}, nil, randBlob(), 0)
680+
originTxHash, err := s.SendTransaction("test", &common.Address{}, nil, randBlobs(1), 0)
669681
assert.NoError(t, err)
670682

671683
txs, err := s.pendingTransactionOrm.GetPendingOrReplacedTransactionsBySenderType(context.Background(), s.senderType, 1)
@@ -725,7 +737,7 @@ func testCheckPendingTransactionReplacedTxConfirmed(t *testing.T) {
725737
return nil
726738
})
727739

728-
txHash, err := s.SendTransaction("test", &common.Address{}, nil, randBlob(), 0)
740+
txHash, err := s.SendTransaction("test", &common.Address{}, nil, randBlobs(1), 0)
729741
assert.NoError(t, err)
730742

731743
txs, err := s.pendingTransactionOrm.GetPendingOrReplacedTransactionsBySenderType(context.Background(), s.senderType, 1)
@@ -795,7 +807,7 @@ func testCheckPendingTransactionTxMultipleTimesWithOnlyOneTxPending(t *testing.T
795807
return nil
796808
})
797809

798-
_, err = s.SendTransaction("test", &common.Address{}, nil, randBlob(), 0)
810+
_, err = s.SendTransaction("test", &common.Address{}, nil, randBlobs(1), 0)
799811
assert.NoError(t, err)
800812

801813
txs, err := s.pendingTransactionOrm.GetPendingOrReplacedTransactionsBySenderType(context.Background(), s.senderType, 1)
@@ -832,8 +844,8 @@ func testBlobTransactionWithBlobhashOpContractCall(t *testing.T) {
832844
assert.NoError(t, err)
833845
assert.NoError(t, migrate.ResetDB(sqlDB))
834846

835-
blob := randBlob()
836-
sideCar, err := makeSidecar(blob)
847+
blobs := randBlobs(1)
848+
sideCar, err := makeSidecar(blobs)
837849
assert.NoError(t, err)
838850
versionedHash := sideCar.BlobHashes()[0]
839851
blsModulo, ok := new(big.Int).SetString("52435875175126190479447740508185965837690552500527637822603658699938581184513", 10)
@@ -845,7 +857,7 @@ func testBlobTransactionWithBlobhashOpContractCall(t *testing.T) {
845857
var point kzg4844.Point
846858
copy(point[start:], pointBytes)
847859
commitment := sideCar.Commitments[0]
848-
proof, claim, err := kzg4844.ComputeProof(blob, point)
860+
proof, claim, err := kzg4844.ComputeProof(blobs[0], point)
849861
assert.NoError(t, err)
850862

851863
var claimArray [32]byte
@@ -869,7 +881,7 @@ func testBlobTransactionWithBlobhashOpContractCall(t *testing.T) {
869881
assert.NoError(t, err)
870882
defer s.Stop()
871883

872-
_, err = s.SendTransaction("0", &testContractsAddress, data, blob, 0)
884+
_, err = s.SendTransaction("0", &testContractsAddress, data, blobs, 0)
873885
assert.NoError(t, err)
874886

875887
var txHash common.Hash
@@ -889,13 +901,19 @@ func testBlobTransactionWithBlobhashOpContractCall(t *testing.T) {
889901
}, 30*time.Second, time.Second)
890902
}
891903

892-
func randBlob() *kzg4844.Blob {
893-
var blob kzg4844.Blob
894-
for i := 0; i < len(blob); i += gokzg4844.SerializedScalarSize {
895-
fieldElementBytes := randFieldElement()
896-
copy(blob[i:i+gokzg4844.SerializedScalarSize], fieldElementBytes[:])
904+
func randBlobs(count int) []*kzg4844.Blob {
905+
blobs := make([]*kzg4844.Blob, 0, count)
906+
907+
for c := 0; c < count; c++ {
908+
var blob kzg4844.Blob
909+
for i := 0; i < len(blob); i += gokzg4844.SerializedScalarSize {
910+
fieldElementBytes := randFieldElement()
911+
copy(blob[i:i+gokzg4844.SerializedScalarSize], fieldElementBytes[:])
912+
}
913+
blobs = append(blobs, &blob)
897914
}
898-
return &blob
915+
916+
return blobs
899917
}
900918

901919
func randFieldElement() [32]byte {
@@ -921,10 +939,10 @@ func testSendBlobCarryingTxOverLimit(t *testing.T) {
921939
assert.NoError(t, err)
922940

923941
for i := 0; i < int(cfgCopy.MaxPendingBlobTxs); i++ {
924-
_, err = s.SendTransaction("0", &common.Address{}, nil, randBlob(), 0)
942+
_, err = s.SendTransaction("0", &common.Address{}, nil, randBlobs(1), 0)
925943
assert.NoError(t, err)
926944
}
927-
_, err = s.SendTransaction("0", &common.Address{}, nil, randBlob(), 0)
945+
_, err = s.SendTransaction("0", &common.Address{}, nil, randBlobs(1), 0)
928946
assert.ErrorIs(t, err, ErrTooManyPendingBlobTxs)
929947
s.Stop()
930948
}

0 commit comments

Comments
 (0)