Skip to content
This repository was archived by the owner on May 11, 2024. It is now read-only.

Commit 9461b05

Browse files
authored
chore(ci): upgrade golangci to v1.56.2 (#622)
1 parent 58c2d10 commit 9461b05

28 files changed

+39
-87
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ clean:
1313
@rm -rf bin/*
1414

1515
lint:
16-
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.51.1 \
16+
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.56.2 \
1717
&& golangci-lint run
1818

1919
test:

driver/driver.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ func (d *Driver) Start() error {
101101
}
102102

103103
// Close closes the driver instance.
104-
func (d *Driver) Close(ctx context.Context) {
104+
func (d *Driver) Close(_ context.Context) {
105105
d.l1HeadSub.Unsubscribe()
106106
d.state.Close()
107107
d.wg.Wait()

driver/txlist_fetcher/blob.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ func NewBlobTxListFetcher(rpc *rpc.Client) *BlobFetcher {
2424

2525
func (d *BlobFetcher) Fetch(
2626
ctx context.Context,
27-
tx *types.Transaction,
27+
_ *types.Transaction,
2828
meta *bindings.TaikoDataBlockMetadata,
2929
) ([]byte, error) {
3030
if !meta.BlobUsed {

driver/txlist_fetcher/calldata.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
type CalldataFetcher struct{}
1212

1313
func (d *CalldataFetcher) Fetch(
14-
ctx context.Context,
14+
_ context.Context,
1515
tx *types.Transaction,
1616
meta *bindings.TaikoDataBlockMetadata,
1717
) ([]byte, error) {

pkg/chain_iterator/block_batch_iterator_test.go

+15-15
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ func (s *BlockBatchIteratorTestSuite) TestIter() {
3232
StartHeight: common.Big0,
3333
EndHeight: new(big.Int).SetUint64(headHeight),
3434
OnBlocks: func(
35-
ctx context.Context,
35+
_ context.Context,
3636
start, end *types.Header,
37-
updateCurrentFunc UpdateCurrentFunc,
38-
endIterFunc EndIterFunc,
37+
_ UpdateCurrentFunc,
38+
_ EndIterFunc,
3939
) error {
4040
s.Equal(lastEnd.Uint64(), start.Number.Uint64())
4141
lastEnd = end.Number
@@ -63,9 +63,9 @@ func (s *BlockBatchIteratorTestSuite) TestIterEndFunc() {
6363
StartHeight: common.Big0,
6464
EndHeight: new(big.Int).SetUint64(headHeight),
6565
OnBlocks: func(
66-
ctx context.Context,
66+
_ context.Context,
6767
start, end *types.Header,
68-
updateCurrentFunc UpdateCurrentFunc,
68+
_ UpdateCurrentFunc,
6969
endIterFunc EndIterFunc,
7070
) error {
7171
s.Equal(lastEnd.Uint64(), start.Number.Uint64())
@@ -93,9 +93,9 @@ func (s *BlockBatchIteratorTestSuite) TestIterCtxCancel() {
9393
StartHeight: common.Big0,
9494
EndHeight: new(big.Int).SetUint64(headHeight),
9595
OnBlocks: func(
96-
ctx context.Context,
96+
_ context.Context,
9797
start, end *types.Header,
98-
updateCurrentFunc UpdateCurrentFunc,
98+
_ UpdateCurrentFunc,
9999
endIterFunc EndIterFunc,
100100
) error {
101101
s.Equal(lastEnd.Uint64(), start.Number.Uint64())
@@ -128,9 +128,9 @@ func (s *BlockBatchIteratorTestSuite) TestBlockBatchIteratorConfig() {
128128
_, err3 := NewBlockBatchIterator(context.Background(), &BlockBatchIteratorConfig{
129129
Client: s.RPCClient.L1,
130130
OnBlocks: func(
131-
ctx context.Context,
131+
_ context.Context,
132132
start, end *types.Header,
133-
updateCurrentFunc UpdateCurrentFunc,
133+
_ UpdateCurrentFunc,
134134
endIterFunc EndIterFunc,
135135
) error {
136136
s.Equal(lastEnd.Uint64(), start.Number.Uint64())
@@ -145,9 +145,9 @@ func (s *BlockBatchIteratorTestSuite) TestBlockBatchIteratorConfig() {
145145
_, err4 := NewBlockBatchIterator(context.Background(), &BlockBatchIteratorConfig{
146146
Client: s.RPCClient.L1,
147147
OnBlocks: func(
148-
ctx context.Context,
148+
_ context.Context,
149149
start, end *types.Header,
150-
updateCurrentFunc UpdateCurrentFunc,
150+
_ UpdateCurrentFunc,
151151
endIterFunc EndIterFunc,
152152
) error {
153153
s.Equal(lastEnd.Uint64(), start.Number.Uint64())
@@ -163,9 +163,9 @@ func (s *BlockBatchIteratorTestSuite) TestBlockBatchIteratorConfig() {
163163
_, err6 := NewBlockBatchIterator(context.Background(), &BlockBatchIteratorConfig{
164164
Client: s.RPCClient.L1,
165165
OnBlocks: func(
166-
ctx context.Context,
166+
_ context.Context,
167167
start, end *types.Header,
168-
updateCurrentFunc UpdateCurrentFunc,
168+
_ UpdateCurrentFunc,
169169
endIterFunc EndIterFunc,
170170
) error {
171171
s.Equal(lastEnd.Uint64(), start.Number.Uint64())
@@ -181,9 +181,9 @@ func (s *BlockBatchIteratorTestSuite) TestBlockBatchIteratorConfig() {
181181
_, err7 := NewBlockBatchIterator(context.Background(), &BlockBatchIteratorConfig{
182182
Client: s.RPCClient.L1,
183183
OnBlocks: func(
184-
ctx context.Context,
184+
_ context.Context,
185185
start, end *types.Header,
186-
updateCurrentFunc UpdateCurrentFunc,
186+
_ UpdateCurrentFunc,
187187
endIterFunc EndIterFunc,
188188
) error {
189189
s.Equal(lastEnd.Uint64(), start.Number.Uint64())

pkg/rpc/methods.go

-2
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,6 @@ func (c *Client) checkSyncedL1SnippetFromAnchor(
519519
}
520520

521521
l1BlockHash, l1StateRoot, l1HeightInAnchor, parentGasUsed, err := c.getSyncedL1SnippetFromAnchor(
522-
ctx,
523522
block.Transactions()[0],
524523
)
525524
if err != nil {
@@ -576,7 +575,6 @@ func (c *Client) checkSyncedL1SnippetFromAnchor(
576575

577576
// getSyncedL1SnippetFromAnchor parses the anchor transaction calldata, and returns the synced L1 snippet,
578577
func (c *Client) getSyncedL1SnippetFromAnchor(
579-
ctx context.Context,
580578
tx *types.Transaction,
581579
) (
582580
l1BlockHash common.Hash,

pkg/rpc/methods_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ func TestGetSyncedL1SnippetFromAnchor(t *testing.T) {
104104
syncedL1StateRoot,
105105
syncedL1Height,
106106
syncedParentGasUsed,
107-
err := client.getSyncedL1SnippetFromAnchor(context.Background(), tx)
107+
err := client.getSyncedL1SnippetFromAnchor(tx)
108108
require.Nil(t, err)
109109
require.Equal(t, l1BlockHash, syncedL1BlockHash)
110110
require.Equal(t, l1StateRoot, syncedL1StateRoot)

pkg/rpc/subscription_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ import (
1111
)
1212

1313
func TestSubscribeEvent(t *testing.T) {
14-
require.NotNil(t, SubscribeEvent("test", func(ctx context.Context) (event.Subscription, error) {
15-
return event.NewSubscription(func(c <-chan struct{}) error { return nil }), nil
14+
require.NotNil(t, SubscribeEvent("test", func(_ context.Context) (event.Subscription, error) {
15+
return event.NewSubscription(func(_ <-chan struct{}) error { return nil }), nil
1616
}))
1717
}
1818

proposer/proposer.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ func (p *Proposer) eventLoop() {
201201
}
202202

203203
// Close closes the proposer instance.
204-
func (p *Proposer) Close(ctx context.Context) {
204+
func (p *Proposer) Close(_ context.Context) {
205205
p.sender.Close()
206206
p.wg.Wait()
207207
}

proposer/prover_selector/eth_fee_eoa_selector.go

-12
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import (
99
"net/url"
1010
"time"
1111

12-
"github.com/ethereum/go-ethereum/accounts/abi/bind"
1312
"github.com/ethereum/go-ethereum/common"
1413
"github.com/ethereum/go-ethereum/crypto"
1514
"github.com/ethereum/go-ethereum/log"
@@ -89,15 +88,6 @@ func (s *ETHFeeEOASelector) AssignProver(
8988
tierFees []encoding.TierFee,
9089
txListHash common.Hash,
9190
) (*encoding.ProverAssignment, common.Address, *big.Int, error) {
92-
guardianProverAddress, err := s.rpc.TaikoL1.Resolve0(
93-
&bind.CallOpts{Context: ctx},
94-
rpc.StringToBytes32("guardian"),
95-
true,
96-
)
97-
if err != nil {
98-
return nil, common.Address{}, nil, err
99-
}
100-
10191
var (
10292
expiry = uint64(time.Now().Add(s.proposalExpiry).Unix())
10393
fees = make([]encoding.TierFee, len(tierFees))
@@ -133,7 +123,6 @@ func (s *ETHFeeEOASelector) AssignProver(
133123
s.assignmentHookAddress,
134124
txListHash,
135125
s.requestTimeout,
136-
guardianProverAddress,
137126
)
138127
if err != nil {
139128
log.Warn("Failed to assign prover", "endpoint", endpoint, "error", err)
@@ -185,7 +174,6 @@ func assignProver(
185174
assignmentHookAddress common.Address,
186175
txListHash common.Hash,
187176
timeout time.Duration,
188-
guardianProverAddress common.Address,
189177
) (*encoding.ProverAssignment, common.Address, error) {
190178
log.Info(
191179
"Attempting to assign prover",

prover/anchor_tx_validator/anchor_tx_validator.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ func New(taikoL2Address common.Address, chainID *big.Int, rpc *rpc.Client) (*Anc
3131
return &AnchorTxValidator{taikoL2Address, goldenTouchAddress, chainID, rpc}, nil
3232
}
3333

34-
// validateAnchorTx checks whether the given transaction is a valid `TaikoL2.anchor` transaction.
35-
func (v *AnchorTxValidator) ValidateAnchorTx(ctx context.Context, tx *types.Transaction) error {
34+
// ValidateAnchorTx checks whether the given transaction is a valid `TaikoL2.anchor` transaction.
35+
func (v *AnchorTxValidator) ValidateAnchorTx(tx *types.Transaction) error {
3636
if tx.To() == nil || *tx.To() != v.taikoL2Address {
3737
return fmt.Errorf("invalid TaikoL2.anchor transaction to: %s, want: %s", tx.To(), v.taikoL2Address)
3838
}

prover/anchor_tx_validator/anchor_tx_validator_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func (s *AnchorTxValidatorTestSuite) TestValidateAnchorTx() {
4040
0,
4141
common.BytesToAddress(testutils.RandomBytes(1024)), common.Big0, 0, common.Big0, []byte{},
4242
)
43-
s.ErrorContains(s.v.ValidateAnchorTx(context.Background(), tx), "invalid TaikoL2.anchor transaction to")
43+
s.ErrorContains(s.v.ValidateAnchorTx(tx), "invalid TaikoL2.anchor transaction to")
4444

4545
// invalid sender
4646
dynamicFeeTxTx := &types.DynamicFeeTx{
@@ -59,12 +59,12 @@ func (s *AnchorTxValidatorTestSuite) TestValidateAnchorTx() {
5959
tx = types.MustSignNewTx(wrongPrivKey, signer, dynamicFeeTxTx)
6060

6161
s.ErrorContains(
62-
s.v.ValidateAnchorTx(context.Background(), tx), "invalid TaikoL2.anchor transaction sender",
62+
s.v.ValidateAnchorTx(tx), "invalid TaikoL2.anchor transaction sender",
6363
)
6464

6565
// invalid method selector
6666
tx = types.MustSignNewTx(goldenTouchPriKey, signer, dynamicFeeTxTx)
67-
s.ErrorContains(s.v.ValidateAnchorTx(context.Background(), tx), "invalid TaikoL2.anchor transaction selector")
67+
s.ErrorContains(s.v.ValidateAnchorTx(tx), "invalid TaikoL2.anchor transaction selector")
6868
}
6969

7070
func (s *AnchorTxValidatorTestSuite) TestGetAndValidateAnchorTxReceipt() {

prover/event_handler/util.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ func getBlockProposedEventFromBlockID(
8585
proposedIn *big.Int,
8686
) (e *bindings.TaikoL1ClientBlockProposed, err error) {
8787
callback := func(
88-
ctx context.Context,
88+
_ context.Context,
8989
event *bindings.TaikoL1ClientBlockProposed,
90-
end eventIterator.EndBlockProposedEventIterFunc,
90+
_ eventIterator.EndBlockProposedEventIterFunc,
9191
) error {
9292
// Only filter for exact blockID we want.
9393
if event.BlockId.Cmp(id) != 0 {

prover/init.go

-2
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ func (p *Prover) setApprovalAmount(ctx context.Context, contract common.Address)
100100

101101
// initProofSubmitters initializes the proof submitters from the given tiers in protocol.
102102
func (p *Prover) initProofSubmitters(
103-
ctx context.Context,
104103
sender *sender.Sender,
105104
txBuilder *transaction.ProveBlockTxBuilder,
106105
) error {
@@ -132,7 +131,6 @@ func (p *Prover) initProofSubmitters(
132131
}
133132

134133
if submitter, err = proofSubmitter.New(
135-
ctx,
136134
p.rpc,
137135
producer,
138136
p.proofGenerationCh,

prover/proof_producer/dummy_producer.go

-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package producer
22

33
import (
44
"bytes"
5-
"context"
65
"math/big"
76

87
"github.com/ethereum/go-ethereum/core/types"
@@ -15,7 +14,6 @@ type DummyProofProducer struct{}
1514

1615
// RequestProof returns a dummy proof to the result channel.
1716
func (o *DummyProofProducer) RequestProof(
18-
ctx context.Context,
1917
opts *ProofRequestOptions,
2018
blockID *big.Int,
2119
meta *bindings.TaikoDataBlockMetadata,

prover/proof_producer/dummy_producer_test.go

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package producer
22

33
import (
4-
"context"
54
"testing"
65
"time"
76

@@ -36,7 +35,6 @@ func TestDummyProducerRequestProof(t *testing.T) {
3635
blockID = common.Big32
3736
)
3837
res, err := producer.RequestProof(
39-
context.Background(),
4038
&ProofRequestOptions{},
4139
blockID,
4240
&bindings.TaikoDataBlockMetadata{},

prover/proof_producer/guardian_producer.go

+2-7
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func NewGuardianProofProducer(returnLivenessBond bool) *GuardianProofProducer {
3232

3333
// RequestProof implements the ProofProducer interface.
3434
func (g *GuardianProofProducer) RequestProof(
35-
ctx context.Context,
35+
_ context.Context,
3636
opts *ProofRequestOptions,
3737
blockID *big.Int,
3838
meta *bindings.TaikoDataBlockMetadata,
@@ -57,7 +57,7 @@ func (g *GuardianProofProducer) RequestProof(
5757
}, nil
5858
}
5959

60-
return g.DummyProofProducer.RequestProof(ctx, opts, blockID, meta, header, g.Tier())
60+
return g.DummyProofProducer.RequestProof(opts, blockID, meta, header, g.Tier())
6161
}
6262

6363
// Tier implements the ProofProducer interface.
@@ -69,8 +69,3 @@ func (g *GuardianProofProducer) Tier() uint16 {
6969
func (g *GuardianProofProducer) Cancellable() bool {
7070
return false
7171
}
72-
73-
// Cancel cancels an existing proof generation.
74-
func (g *GuardianProofProducer) Cancel(ctx context.Context, blockID *big.Int) error {
75-
return nil
76-
}

prover/proof_producer/optimistic_producer.go

+2-7
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ type OptimisticProofProducer struct{ *DummyProofProducer }
1616

1717
// RequestProof implements the ProofProducer interface.
1818
func (o *OptimisticProofProducer) RequestProof(
19-
ctx context.Context,
19+
_ context.Context,
2020
opts *ProofRequestOptions,
2121
blockID *big.Int,
2222
meta *bindings.TaikoDataBlockMetadata,
@@ -30,7 +30,7 @@ func (o *OptimisticProofProducer) RequestProof(
3030
"hash", header.Hash(),
3131
)
3232

33-
return o.DummyProofProducer.RequestProof(ctx, opts, blockID, meta, header, o.Tier())
33+
return o.DummyProofProducer.RequestProof(opts, blockID, meta, header, o.Tier())
3434
}
3535

3636
// Tier implements the ProofProducer interface.
@@ -42,8 +42,3 @@ func (o *OptimisticProofProducer) Tier() uint16 {
4242
func (o *OptimisticProofProducer) Cancellable() bool {
4343
return false
4444
}
45-
46-
// Cancel cancels an existing proof generation.
47-
func (o *OptimisticProofProducer) Cancel(ctx context.Context, blockID *big.Int) error {
48-
return nil
49-
}

prover/proof_producer/optimistic_producer_test.go

-3
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,6 @@ func TestProofCancel(t *testing.T) {
8282
header,
8383
)
8484
require.Nil(t, err)
85-
86-
// Cancel the proof request, should return nil
87-
require.Nil(t, optimisticProofProducer.Cancel(context.Background(), blockID))
8885
}
8986

9087
func randHash() common.Hash {

prover/proof_producer/proof_producer.go

-1
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,5 @@ type ProofProducer interface {
6666
header *types.Header,
6767
) (*ProofWithHeader, error)
6868
Cancellable() bool
69-
Cancel(ctx context.Context, blockID *big.Int) error
7069
Tier() uint16
7170
}

prover/proof_producer/sgx_producer.go

+1-8
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ func (s *SGXProofProducer) RequestProof(
9898
)
9999

100100
if s.DummyProofProducer != nil {
101-
return s.DummyProofProducer.RequestProof(ctx, opts, blockID, meta, header, s.Tier())
101+
return s.DummyProofProducer.RequestProof(opts, blockID, meta, header, s.Tier())
102102
}
103103

104104
proof, err := s.callProverDaemon(ctx, opts)
@@ -219,10 +219,3 @@ func (s *SGXProofProducer) Tier() uint16 {
219219
func (s *SGXProofProducer) Cancellable() bool {
220220
return false
221221
}
222-
223-
// Cancel cancels an existing proof generation.
224-
//
225-
//nolint:golint
226-
func (s *SGXProofProducer) Cancel(ctx context.Context, blockID *big.Int) error {
227-
return nil
228-
}

0 commit comments

Comments
 (0)