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

Commit 732828e

Browse files
committed
simplify client
1 parent 386e848 commit 732828e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+586
-659
lines changed

cmd/flags/common.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,25 @@ var (
1919
var (
2020
L1WSEndpoint = &cli.StringFlag{
2121
Name: "l1.ws",
22-
Usage: "Websocket RPC endpoint of a L1 ethereum node",
22+
Usage: "Websocket RPC endpoint of a L1Client ethereum node",
2323
Required: true,
2424
Category: commonCategory,
2525
}
2626
L2WSEndpoint = &cli.StringFlag{
2727
Name: "l2.ws",
28-
Usage: "Websocket RPC endpoint of a L2 taiko-geth execution engine",
28+
Usage: "Websocket RPC endpoint of a L2Client taiko-geth execution engine",
2929
Required: true,
3030
Category: commonCategory,
3131
}
3232
L1HTTPEndpoint = &cli.StringFlag{
3333
Name: "l1.http",
34-
Usage: "HTTP RPC endpoint of a L1 ethereum node",
34+
Usage: "HTTP RPC endpoint of a L1Client ethereum node",
3535
Required: true,
3636
Category: commonCategory,
3737
}
3838
L2HTTPEndpoint = &cli.StringFlag{
3939
Name: "l2.http",
40-
Usage: "HTTP RPC endpoint of a L2 taiko-geth execution engine",
40+
Usage: "HTTP RPC endpoint of a L2Client taiko-geth execution engine",
4141
Required: true,
4242
Category: commonCategory,
4343
}

cmd/flags/driver.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
var (
1111
L2AuthEndpoint = &cli.StringFlag{
1212
Name: "l2.auth",
13-
Usage: "Authenticated HTTP RPC endpoint of a L2 taiko-geth execution engine",
13+
Usage: "Authenticated HTTP RPC endpoint of a L2Client taiko-geth execution engine",
1414
Required: true,
1515
Category: driverCategory,
1616
}
@@ -26,21 +26,21 @@ var (
2626
var (
2727
P2PSyncVerifiedBlocks = &cli.BoolFlag{
2828
Name: "p2p.syncVerifiedBlocks",
29-
Usage: "Try P2P syncing verified blocks between L2 execution engines, " +
29+
Usage: "Try P2P syncing verified blocks between L2Client execution engines, " +
3030
"will be helpful to bring a new node online quickly",
3131
Value: false,
3232
Category: driverCategory,
3333
}
3434
P2PSyncTimeout = &cli.DurationFlag{
3535
Name: "p2p.syncTimeout",
3636
Usage: "P2P syncing timeout, if no sync progress is made within this time span, " +
37-
"driver will stop the P2P sync and insert all remaining L2 blocks one by one",
37+
"driver will stop the P2P sync and insert all remaining L2Client blocks one by one",
3838
Value: 1 * time.Hour,
3939
Category: driverCategory,
4040
}
4141
CheckPointSyncURL = &cli.StringFlag{
4242
Name: "p2p.checkPointSyncUrl",
43-
Usage: "HTTP RPC endpoint of another synced L2 execution engine node",
43+
Usage: "HTTP RPC endpoint of another synced L2Client execution engine node",
4444
Category: driverCategory,
4545
}
4646
)

cmd/flags/proposer.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
var (
1111
L1ProposerPrivKey = &cli.StringFlag{
1212
Name: "l1.proposerPrivKey",
13-
Usage: "Private key of the L1 proposer, who will send TaikoL1.proposeBlock transactions",
13+
Usage: "Private key of the L1Client proposer, who will send TaikoL1.proposeBlock transactions",
1414
Required: true,
1515
Category: proposerCategory,
1616
}
@@ -66,7 +66,7 @@ var (
6666
// Proposing epoch related.
6767
ProposeInterval = &cli.DurationFlag{
6868
Name: "epoch.interval",
69-
Usage: "Time interval to propose L2 pending transactions",
69+
Usage: "Time interval to propose L2Client pending transactions",
7070
Category: proposerCategory,
7171
}
7272
ProposeEmptyBlocksInterval = &cli.DurationFlag{

cmd/flags/prover.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
var (
1111
L1ProverPrivKey = &cli.StringFlag{
1212
Name: "l1.proverPrivKey",
13-
Usage: "Private key of L1 prover, who will send TaikoL1.proveBlock transactions",
13+
Usage: "Private key of L1Client prover, who will send TaikoL1.proveBlock transactions",
1414
Required: true,
1515
Category: proverCategory,
1616
}
@@ -153,10 +153,10 @@ var (
153153
Value: 1024,
154154
Category: proverCategory,
155155
}
156-
// Max amount of L1 blocks that can pass before block is invalid
156+
// Max amount of L1Client blocks that can pass before block is invalid
157157
MaxProposedIn = &cli.Uint64Flag{
158158
Name: "prover.maxProposedIn",
159-
Usage: "Maximum amount of L1 blocks that can pass before block can not be proposed. 0 means no limit.",
159+
Usage: "Maximum amount of L1Client blocks that can pass before block can not be proposed. 0 means no limit.",
160160
Value: 0,
161161
Category: proverCategory,
162162
}

cmd/utils/sub_command.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func SubcommandAction(app SubcommandApplication) cli.ActionFunc {
2525
logger.InitLogger(c)
2626

2727
ctx, ctxClose := context.WithCancel(context.Background())
28-
defer func() { ctxClose() }()
28+
defer ctxClose()
2929

3030
if err := app.InitFromCli(ctx, c); err != nil {
3131
return err

driver/anchor_tx_constructor/anchor_tx_constructor.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import (
1919
const anchorGasLimit = 250_000
2020

2121
// AnchorTxConstructor is responsible for assembling the anchor transaction (TaikoL2.anchor) in
22-
// each L2 block, which is always the first transaction.
22+
// each L2Client block, which is always the first transaction.
2323
type AnchorTxConstructor struct {
2424
rpc *rpc.Client
2525
goldenTouchAddress common.Address
@@ -58,7 +58,7 @@ func (c *AnchorTxConstructor) AssembleAnchorTx(
5858
// Parameters of the TaikoL2.anchor transaction.
5959
l1Height *big.Int,
6060
l1Hash common.Hash,
61-
// Height of the L2 block which including the TaikoL2.anchor transaction.
61+
// Height of the L2Client block which including the TaikoL2.anchor transaction.
6262
l2Height *big.Int,
6363
baseFee *big.Int,
6464
parentGasUsed uint64,
@@ -68,7 +68,7 @@ func (c *AnchorTxConstructor) AssembleAnchorTx(
6868
return nil, err
6969
}
7070

71-
signalRoot, err := c.rpc.GetStorageRoot(ctx, c.rpc.L1GethClient, c.signalServiceAddress, l1Height)
71+
signalRoot, err := c.rpc.GetStorageRoot(ctx, c.rpc.L1Client, c.signalServiceAddress, l1Height)
7272
if err != nil {
7373
return nil, err
7474
}
@@ -84,7 +84,7 @@ func (c *AnchorTxConstructor) AssembleAnchorTx(
8484
return c.rpc.TaikoL2.Anchor(opts, l1Hash, signalRoot, l1Height.Uint64(), uint32(parentGasUsed))
8585
}
8686

87-
// transactOpts is a utility method to create some transact options of the anchor transaction in given L2 block with
87+
// transactOpts is a utility method to create some transact options of the anchor transaction in given L2Client block with
8888
// golden touch account's private key.
8989
func (c *AnchorTxConstructor) transactOpts(
9090
ctx context.Context,
@@ -154,7 +154,7 @@ func (c *AnchorTxConstructor) GasLimit() uint64 {
154154
return anchorGasLimit
155155
}
156156

157-
// SignalServiceAddress returns protocol's L1 singalService constant address.
157+
// SignalServiceAddress returns protocol's L1Client singalService constant address.
158158
func (c *AnchorTxConstructor) SignalServiceAddress() common.Address {
159159
return c.signalServiceAddress
160160
}

driver/anchor_tx_constructor/anchor_tx_constructor_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ func (s *AnchorTxConstructorTestSuite) SetupTest() {
2828
common.HexToAddress(os.Getenv("L1_SIGNAL_SERVICE_CONTRACT_ADDRESS")),
2929
)
3030
s.Nil(err)
31-
head, err := s.RPCClient.L1.BlockByNumber(context.Background(), nil)
31+
head, err := s.RPCClient.L1Client.BlockByNumber(context.Background(), nil)
3232
s.Nil(err)
3333
s.l1Height = head.Number()
3434
s.l1Hash = head.Hash()

driver/chain_syncer/beaconsync/progress_tracker.go

+12-12
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ var (
1717
syncProgressCheckInterval = 12 * time.Second
1818
)
1919

20-
// SyncProgressTracker is responsible for tracking the L2 execution engine's sync progress, after
21-
// a beacon sync is triggered in it, and check whether the L2 execution is not able to sync through P2P (due to no
20+
// SyncProgressTracker is responsible for tracking the L2Client execution engine's sync progress, after
21+
// a beacon sync is triggered in it, and check whether the L2Client execution is not able to sync through P2P (due to no
2222
// connected peer or some other reasons).
2323
type SyncProgressTracker struct {
2424
// RPC client
@@ -58,7 +58,7 @@ func (t *SyncProgressTracker) Track(ctx context.Context) {
5858
}
5959

6060
// track is the internal implementation of MonitorSyncProgress, tries to
61-
// track the L2 execution engine's beacon sync progress.
61+
// track the L2Client execution engine's beacon sync progress.
6262
func (t *SyncProgressTracker) track(ctx context.Context) {
6363
t.mutex.Lock()
6464
defer t.mutex.Unlock()
@@ -74,13 +74,13 @@ func (t *SyncProgressTracker) track(ctx context.Context) {
7474

7575
progress, err := t.client.SyncProgress(ctx)
7676
if err != nil {
77-
log.Error("Get L2 execution engine sync progress error", "error", err)
77+
log.Error("Get L2Client execution engine sync progress error", "error", err)
7878
return
7979
}
8080

8181
if progress != nil {
8282
log.Info(
83-
"L2 execution engine sync progress",
83+
"L2Client execution engine sync progress",
8484
"progress", progress,
8585
"lastProgressedTime", t.lastProgressedTime,
8686
"timeout", t.timeout,
@@ -90,13 +90,13 @@ func (t *SyncProgressTracker) track(ctx context.Context) {
9090
if progress == nil {
9191
headHeight, err := t.client.BlockNumber(ctx)
9292
if err != nil {
93-
log.Error("Get L2 execution engine head height error", "error", err)
93+
log.Error("Get L2Client execution engine head height error", "error", err)
9494
return
9595
}
9696

9797
if new(big.Int).SetUint64(headHeight).Cmp(t.lastSyncedVerifiedBlockID) >= 0 {
9898
t.lastProgressedTime = time.Now()
99-
log.Info("L2 execution engine has finished the P2P sync work, all verified blocks synced, "+
99+
log.Info("L2Client execution engine has finished the P2P sync work, all verified blocks synced, "+
100100
"will switch to insert pending blocks one by one",
101101
"lastSyncedVerifiedBlockID", t.lastSyncedVerifiedBlockID,
102102
"lastSyncedVerifiedBlockHash", t.lastSyncedVerifiedBlockHash,
@@ -105,14 +105,14 @@ func (t *SyncProgressTracker) track(ctx context.Context) {
105105
}
106106

107107
log.Debug(
108-
"L2 execution engine has not started P2P syncing yet",
108+
"L2Client execution engine has not started P2P syncing yet",
109109
"timeout", t.timeout,
110110
)
111111
}
112112

113113
defer func() { t.lastSyncProgress = progress }()
114114

115-
// Check whether the L2 execution engine has synced any new block through P2P since last event loop.
115+
// Check whether the L2Client execution engine has synced any new block through P2P since last event loop.
116116
if syncProgressed(t.lastSyncProgress, progress) {
117117
t.outOfSync = false
118118
t.lastProgressedTime = time.Now()
@@ -121,11 +121,11 @@ func (t *SyncProgressTracker) track(ctx context.Context) {
121121

122122
// Has not synced any new block since last loop, check whether reaching the timeout.
123123
if time.Since(t.lastProgressedTime) > t.timeout {
124-
// Mark the L2 execution engine out of sync.
124+
// Mark the L2Client execution engine out of sync.
125125
t.outOfSync = true
126126

127127
log.Warn(
128-
"L2 execution engine is not able to sync through P2P",
128+
"L2Client execution engine is not able to sync through P2P",
129129
"lastProgressedTime", t.lastProgressedTime,
130130
"timeout", t.timeout,
131131
)
@@ -173,7 +173,7 @@ func (t *SyncProgressTracker) HeadChanged(newID *big.Int) bool {
173173
return t.lastSyncedVerifiedBlockID != nil && t.lastSyncedVerifiedBlockID != newID
174174
}
175175

176-
// OutOfSync tells whether the L2 execution engine is marked as out of sync.
176+
// OutOfSync tells whether the L2Client execution engine is marked as out of sync.
177177
func (t *SyncProgressTracker) OutOfSync() bool {
178178
t.mutex.RLock()
179179
defer t.mutex.RUnlock()

driver/chain_syncer/beaconsync/progress_tracker_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ type BeaconSyncProgressTrackerTestSuite struct {
2020
func (s *BeaconSyncProgressTrackerTestSuite) SetupTest() {
2121
s.ClientTestSuite.SetupTest()
2222

23-
s.t = NewSyncProgressTracker(s.RPCClient.L2, 30*time.Second)
23+
s.t = NewSyncProgressTracker(s.RPCClient.L2Client, 30*time.Second)
2424
}
2525

2626
func (s *BeaconSyncProgressTrackerTestSuite) TestSyncProgressed() {

driver/chain_syncer/beaconsync/syncer.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
"github.com/taikoxyz/taiko-client/pkg/rpc"
1414
)
1515

16-
// Syncer responsible for letting the L2 execution engine catching up with protocol's latest
16+
// Syncer responsible for letting the L2Client execution engine catching up with protocol's latest
1717
// verified block through P2P beacon sync.
1818
type Syncer struct {
1919
ctx context.Context
@@ -32,7 +32,7 @@ func NewSyncer(
3232
return &Syncer{ctx, rpc, state, progressTracker}
3333
}
3434

35-
// TriggerBeaconSync triggers the L2 execution engine to start performing a beacon sync.
35+
// TriggerBeaconSync triggers the L2Client execution engine to start performing a beacon sync.
3636
func (s *Syncer) TriggerBeaconSync() error {
3737
blockID, latestVerifiedHeadPayload, err := s.getVerifiedBlockPayload(s.ctx)
3838
if err != nil {
@@ -47,14 +47,14 @@ func (s *Syncer) TriggerBeaconSync() error {
4747
if s.progressTracker.Triggered() {
4848
if s.progressTracker.lastSyncProgress == nil {
4949
log.Info(
50-
"Syncing beacon headers, please check L2 execution engine logs for progress",
50+
"Syncing beacon headers, please check L2Client execution engine logs for progress",
5151
"currentSyncHead", s.progressTracker.LastSyncedVerifiedBlockID(),
5252
"newBlockID", blockID,
5353
)
5454
}
5555
}
5656

57-
status, err := s.rpc.L2Engine.NewPayload(
57+
status, err := s.rpc.L2AuthClient.NewPayload(
5858
s.ctx,
5959
latestVerifiedHeadPayload,
6060
)
@@ -66,7 +66,7 @@ func (s *Syncer) TriggerBeaconSync() error {
6666
return fmt.Errorf("unexpected NewPayload response status: %s", status.Status)
6767
}
6868

69-
fcRes, err := s.rpc.L2Engine.ForkchoiceUpdate(s.ctx, &engine.ForkchoiceStateV1{
69+
fcRes, err := s.rpc.L2AuthClient.ForkchoiceUpdate(s.ctx, &engine.ForkchoiceStateV1{
7070
HeadBlockHash: latestVerifiedHeadPayload.BlockHash,
7171
SafeBlockHash: latestVerifiedHeadPayload.BlockHash,
7272
FinalizedBlockHash: latestVerifiedHeadPayload.BlockHash,

0 commit comments

Comments
 (0)