Skip to content

Commit 87fc74f

Browse files
chore(taiko-client): clean up the unused code (#19547)
Co-authored-by: David <[email protected]>
1 parent 15e4fd3 commit 87fc74f

File tree

9 files changed

+16
-24
lines changed

9 files changed

+16
-24
lines changed

packages/taiko-client/driver/driver_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ func (s *DriverTestSuite) TestForcedInclusion() {
357357
s.Nil(err)
358358

359359
// Propose an empty batch, should with another batch with the forced inclusion tx.
360-
s.Nil(s.p.ProposeTxLists(context.Background(), []types.Transactions{{}}, l2Head1.Number.Uint64(), common.Hash{}))
360+
s.Nil(s.p.ProposeTxLists(context.Background(), []types.Transactions{{}}, common.Hash{}))
361361
s.Nil(s.d.l2ChainSyncer.EventSyncer().ProcessL1Blocks(context.Background()))
362362

363363
l2Head2, err := s.d.rpc.L2.BlockByNumber(context.Background(), nil)
@@ -374,7 +374,7 @@ func (s *DriverTestSuite) TestForcedInclusion() {
374374
s.Equal(forcedInclusionTx.Hash(), forcedIncludedBlock.Transactions()[1].Hash())
375375

376376
// Propose an empty batch, without another batch with the forced inclusion tx.
377-
s.Nil(s.p.ProposeTxLists(context.Background(), []types.Transactions{{}}, l2Head2.Number().Uint64(), common.Hash{}))
377+
s.Nil(s.p.ProposeTxLists(context.Background(), []types.Transactions{{}}, common.Hash{}))
378378
s.Nil(s.d.l2ChainSyncer.EventSyncer().ProcessL1Blocks(context.Background()))
379379

380380
l2Head3, err := s.d.rpc.L2.BlockByNumber(context.Background(), nil)

packages/taiko-client/driver/preconf_blocks/queue.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66

77
"github.com/ethereum-optimism/optimism/op-service/eth"
88
"github.com/ethereum/go-ethereum/common"
9+
910
"github.com/taikoxyz/taiko-mono/packages/taiko-client/internal/metrics"
1011
)
1112

packages/taiko-client/driver/preconf_blocks/server.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525
"github.com/libp2p/go-libp2p/core/peer"
2626

2727
lru "github.com/hashicorp/golang-lru/v2"
28+
2829
"github.com/taikoxyz/taiko-mono/packages/taiko-client/bindings/encoding"
2930
"github.com/taikoxyz/taiko-mono/packages/taiko-client/internal/metrics"
3031
"github.com/taikoxyz/taiko-mono/packages/taiko-client/pkg/rpc"

packages/taiko-client/driver/preconf_blocks/util.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"github.com/ethereum/go-ethereum/core/rawdb"
1212
"github.com/ethereum/go-ethereum/core/types"
1313
"github.com/holiman/uint256"
14+
1415
"github.com/taikoxyz/taiko-mono/packages/taiko-client/pkg/rpc"
1516
"github.com/taikoxyz/taiko-mono/packages/taiko-client/pkg/utils"
1617
)

packages/taiko-client/internal/testutils/helper.go

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,7 @@ import (
2222
)
2323

2424
func (s *ClientTestSuite) proposeEmptyBlockOp(ctx context.Context, proposer Proposer) {
25-
head, err := s.RPCClient.L2.HeaderByNumber(context.Background(), nil)
26-
s.Nil(err)
27-
28-
s.Nil(proposer.ProposeTxLists(ctx, []types.Transactions{{}}, head.Number.Uint64(), common.Hash{}))
25+
s.Nil(proposer.ProposeTxLists(ctx, []types.Transactions{{}}, common.Hash{}))
2926
}
3027

3128
func (s *ClientTestSuite) ProposeAndInsertEmptyBlocks(
@@ -54,11 +51,8 @@ func (s *ClientTestSuite) ProposeAndInsertEmptyBlocks(
5451
close(sink1)
5552
}()
5653

57-
l2Head, err := s.RPCClient.L2.HeaderByNumber(context.Background(), nil)
58-
s.Nil(err)
59-
6054
// RLP encoded empty list
61-
s.Nil(proposer.ProposeTxLists(context.Background(), []types.Transactions{{}}, l2Head.Number.Uint64(), common.Hash{}))
55+
s.Nil(proposer.ProposeTxLists(context.Background(), []types.Transactions{{}}, common.Hash{}))
6256
s.Nil(chainSyncer.ProcessL1Blocks(context.Background()))
6357

6458
// Valid transactions lists.

packages/taiko-client/internal/testutils/interfaces.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ type ChainSyncer interface {
1616
type Proposer interface {
1717
utils.SubcommandApplication
1818
ProposeOp(ctx context.Context) error
19-
ProposeTxLists(ctx context.Context, txLists []types.Transactions, l2Head uint64, parentMetaHash common.Hash) error
19+
ProposeTxLists(ctx context.Context, txLists []types.Transactions, parentMetaHash common.Hash) error
2020
RegisterTxMgrSelectorToBlobServer(blobServer *MemoryBlobServer)
2121
}

packages/taiko-client/proposer/proposer.go

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -261,14 +261,9 @@ func (p *Proposer) ProposeOp(ctx context.Context) error {
261261
"lastProposedAt", p.lastProposedAt,
262262
)
263263

264-
l2Head, err := p.rpc.L2.BlockNumber(ctx)
265-
if err != nil {
266-
return fmt.Errorf("failed to get L2 chain head number: %w", err)
267-
}
268-
269-
// Fetch the parent meta hash of current the L2 head, which will be used
264+
// Fetch the latest parent meta hash, which will be used
270265
// by revert protection.
271-
parentMetaHash, err := p.GetParentMetaHash(ctx, l2Head)
266+
parentMetaHash, err := p.GetParentMetaHash(ctx)
272267
if err != nil {
273268
return fmt.Errorf("failed to get parent meta hash: %w", err)
274269
}
@@ -285,14 +280,13 @@ func (p *Proposer) ProposeOp(ctx context.Context) error {
285280
}
286281

287282
// Propose the transactions lists.
288-
return p.ProposeTxLists(ctx, txLists, l2Head, parentMetaHash)
283+
return p.ProposeTxLists(ctx, txLists, parentMetaHash)
289284
}
290285

291286
// ProposeTxList proposes the given transactions lists to TaikoInbox smart contract.
292287
func (p *Proposer) ProposeTxLists(
293288
ctx context.Context,
294289
txLists []types.Transactions,
295-
l2Head uint64,
296290
parentMetaHash common.Hash,
297291
) error {
298292
if err := p.ProposeTxListPacaya(ctx, txLists, parentMetaHash); err != nil {
@@ -441,8 +435,8 @@ func (p *Proposer) RegisterTxMgrSelectorToBlobServer(blobServer *testutils.Memor
441435
)
442436
}
443437

444-
// GetParentMetaHash returns the parent meta hash of the given L2 head.
445-
func (p *Proposer) GetParentMetaHash(ctx context.Context, l2Head uint64) (common.Hash, error) {
438+
// GetParentMetaHash returns the latest parent meta hash.
439+
func (p *Proposer) GetParentMetaHash(ctx context.Context) (common.Hash, error) {
446440
state, err := p.rpc.GetProtocolStateVariablesPacaya(&bind.CallOpts{Context: ctx})
447441
if err != nil {
448442
return common.Hash{}, fmt.Errorf("failed to fetch protocol state variables: %w", err)

packages/taiko-client/proposer/proposer_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,10 @@ func (s *ProposerTestSuite) TestProposeWithRevertProtection() {
150150

151151
s.SetIntervalMining(1)
152152

153-
metaHash, err := s.p.GetParentMetaHash(context.Background(), head.Number.Uint64())
153+
metaHash, err := s.p.GetParentMetaHash(context.Background())
154154
s.Nil(err)
155155

156-
s.Nil(s.p.ProposeTxLists(context.Background(), []types.Transactions{{}}, head.Number.Uint64(), metaHash))
156+
s.Nil(s.p.ProposeTxLists(context.Background(), []types.Transactions{{}}, metaHash))
157157
s.Nil(s.s.ProcessL1Blocks(context.Background()))
158158

159159
head2, err := s.p.rpc.L2.HeaderByNumber(context.Background(), nil)

packages/taiko-client/prover/event_handler/assignment_expired_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55

66
"github.com/ethereum/go-ethereum/common"
7+
78
proofProducer "github.com/taikoxyz/taiko-mono/packages/taiko-client/prover/proof_producer"
89
)
910

0 commit comments

Comments
 (0)