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

Commit 13f896a

Browse files
feat(all): clean up unused signal service related code (#581)
1 parent 87cce6f commit 13f896a

18 files changed

+31
-127
lines changed

driver/anchor_tx_constructor/anchor_tx_constructor.go

+7-14
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,13 @@ const AnchorGasLimit = 250_000
2222
// AnchorTxConstructor is responsible for assembling the anchor transaction (TaikoL2.anchor) in
2323
// each L2 block, which is always the first transaction.
2424
type AnchorTxConstructor struct {
25-
rpc *rpc.Client
26-
goldenTouchAddress common.Address
27-
signalServiceAddress common.Address
28-
signer *signer.FixedKSigner
25+
rpc *rpc.Client
26+
goldenTouchAddress common.Address
27+
signer *signer.FixedKSigner
2928
}
3029

3130
// New creates a new AnchorConstructor instance.
32-
func New(rpc *rpc.Client, signalServiceAddress common.Address) (*AnchorTxConstructor, error) {
31+
func New(rpc *rpc.Client) (*AnchorTxConstructor, error) {
3332
goldenTouchAddress, err := rpc.TaikoL2.GOLDENTOUCHADDRESS(nil)
3433
if err != nil {
3534
return nil, err
@@ -41,10 +40,9 @@ func New(rpc *rpc.Client, signalServiceAddress common.Address) (*AnchorTxConstru
4140
}
4241

4342
return &AnchorTxConstructor{
44-
rpc: rpc,
45-
goldenTouchAddress: goldenTouchAddress,
46-
signalServiceAddress: signalServiceAddress,
47-
signer: signer,
43+
rpc: rpc,
44+
goldenTouchAddress: goldenTouchAddress,
45+
signer: signer,
4846
}, nil
4947
}
5048

@@ -144,8 +142,3 @@ func (c *AnchorTxConstructor) signTxPayload(hash []byte) ([]byte, error) {
144142

145143
return sig[:], nil
146144
}
147-
148-
// SignalServiceAddress returns protocol's L1 singalService constant address.
149-
func (c *AnchorTxConstructor) SignalServiceAddress() common.Address {
150-
return c.signalServiceAddress
151-
}

driver/anchor_tx_constructor/anchor_tx_constructor_test.go

+2-9
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package anchortxconstructor
33
import (
44
"context"
55
"math/big"
6-
"os"
76
"testing"
87

98
"github.com/ethereum/go-ethereum/common"
@@ -23,10 +22,7 @@ type AnchorTxConstructorTestSuite struct {
2322

2423
func (s *AnchorTxConstructorTestSuite) SetupTest() {
2524
s.ClientTestSuite.SetupTest()
26-
c, err := New(
27-
s.RPCClient,
28-
common.HexToAddress(os.Getenv("L1_SIGNAL_SERVICE_CONTRACT_ADDRESS")),
29-
)
25+
c, err := New(s.RPCClient)
3026
s.Nil(err)
3127
head, err := s.RPCClient.L1.BlockByNumber(context.Background(), nil)
3228
s.Nil(err)
@@ -49,10 +45,7 @@ func (s *AnchorTxConstructorTestSuite) TestNewAnchorTransactor() {
4945
goldenTouchAddress, err := s.RPCClient.TaikoL2.GOLDENTOUCHADDRESS(nil)
5046
s.Nil(err)
5147

52-
c, err := New(
53-
s.RPCClient,
54-
common.HexToAddress(os.Getenv("L1_SIGNAL_SERVICE_CONTRACT_ADDRESS")),
55-
)
48+
c, err := New(s.RPCClient)
5649
s.Nil(err)
5750

5851
opts, err := c.transactOpts(context.Background(), common.Big1, common.Big256)

driver/chain_syncer/calldata/syncer.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,13 @@ func NewSyncer(
5252
rpc *rpc.Client,
5353
state *state.State,
5454
progressTracker *beaconsync.SyncProgressTracker,
55-
signalServiceAddress common.Address,
5655
) (*Syncer, error) {
5756
configs, err := rpc.TaikoL1.GetConfig(&bind.CallOpts{Context: ctx})
5857
if err != nil {
5958
return nil, fmt.Errorf("failed to get protocol configs: %w", err)
6059
}
6160

62-
constructor, err := anchorTxConstructor.New(rpc, signalServiceAddress)
61+
constructor, err := anchorTxConstructor.New(rpc)
6362
if err != nil {
6463
return nil, fmt.Errorf("failed to initialize anchor constructor: %w", err)
6564
}
@@ -169,7 +168,6 @@ func (s *Syncer) onBlockProposed(
169168
reorged, l1CurrentToReset, lastInsertedBlockIDToReset, err = s.rpc.CheckL1ReorgFromL2EE(
170169
ctx,
171170
new(big.Int).Sub(event.BlockId, common.Big1),
172-
s.anchorConstructor.SignalServiceAddress(),
173171
)
174172
if err != nil {
175173
return fmt.Errorf("failed to check whether L1 chain has been reorged: %w", err)

driver/chain_syncer/calldata/syncer_test.go

-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ func (s *CalldataSyncerTestSuite) SetupTest() {
3838
s.RPCClient,
3939
state,
4040
beaconsync.NewSyncProgressTracker(s.RPCClient.L2, 1*time.Hour),
41-
common.HexToAddress(os.Getenv("L1_SIGNAL_SERVICE_CONTRACT_ADDRESS")),
4241
)
4342
s.Nil(err)
4443
s.s = syncer
@@ -82,7 +81,6 @@ func (s *CalldataSyncerTestSuite) TestCancelNewSyncer() {
8281
s.RPCClient,
8382
s.s.state,
8483
s.s.progressTracker,
85-
common.HexToAddress(os.Getenv("L1_SIGNAL_SERVICE_CONTRACT_ADDRESS")),
8684
)
8785
s.Nil(syncer)
8886
s.NotNil(err)

driver/chain_syncer/chain_syncer.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
"time"
77

88
"github.com/ethereum/go-ethereum/accounts/abi/bind"
9-
"github.com/ethereum/go-ethereum/common"
109
"github.com/ethereum/go-ethereum/core/types"
1110
"github.com/ethereum/go-ethereum/log"
1211

@@ -42,13 +41,12 @@ func New(
4241
state *state.State,
4342
p2pSyncVerifiedBlocks bool,
4443
p2pSyncTimeout time.Duration,
45-
signalServiceAddress common.Address,
4644
) (*L2ChainSyncer, error) {
4745
tracker := beaconsync.NewSyncProgressTracker(rpc.L2, p2pSyncTimeout)
4846
go tracker.Track(ctx)
4947

5048
beaconSyncer := beaconsync.NewSyncer(ctx, rpc, state, tracker)
51-
calldataSyncer, err := calldata.NewSyncer(ctx, rpc, state, tracker, signalServiceAddress)
49+
calldataSyncer, err := calldata.NewSyncer(ctx, rpc, state, tracker)
5250
if err != nil {
5351
return nil, err
5452
}

driver/chain_syncer/chain_syncer_test.go

-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ func (s *ChainSyncerTestSuite) SetupTest() {
3939
state,
4040
false,
4141
1*time.Hour,
42-
common.HexToAddress(os.Getenv("L1_SIGNAL_SERVICE_CONTRACT_ADDRESS")),
4342
)
4443
s.Nil(err)
4544
s.s = syncer

driver/driver.go

-10
Original file line numberDiff line numberDiff line change
@@ -76,22 +76,12 @@ func (d *Driver) InitFromConfig(ctx context.Context, cfg *Config) (err error) {
7676
log.Warn("P2P syncing verified blocks enabled, but no connected peer found in L2 execution engine")
7777
}
7878

79-
signalServiceAddress, err := d.rpc.TaikoL1.Resolve0(
80-
&bind.CallOpts{Context: ctx},
81-
rpc.StringToBytes32("signal_service"),
82-
false,
83-
)
84-
if err != nil {
85-
return err
86-
}
87-
8879
if d.l2ChainSyncer, err = chainSyncer.New(
8980
d.ctx,
9081
d.rpc,
9182
d.state,
9283
cfg.P2PSyncVerifiedBlocks,
9384
cfg.P2PSyncTimeout,
94-
signalServiceAddress,
9585
); err != nil {
9686
return err
9787
}

driver/driver_test.go

-3
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,6 @@ func (s *DriverTestSuite) TestCheckL1ReorgToHigherFork() {
153153
reorged, _, _, err := s.RPCClient.CheckL1ReorgFromL2EE(
154154
context.Background(),
155155
l2Head2.Number,
156-
common.HexToAddress(os.Getenv("L1_SIGNAL_SERVICE_CONTRACT_ADDRESS")),
157156
)
158157
s.Nil(err)
159158
s.False(reorged)
@@ -216,7 +215,6 @@ func (s *DriverTestSuite) TestCheckL1ReorgToLowerFork() {
216215
reorged, _, _, err := s.RPCClient.CheckL1ReorgFromL2EE(
217216
context.Background(),
218217
l2Head2.Number,
219-
common.HexToAddress(os.Getenv("L1_SIGNAL_SERVICE_CONTRACT_ADDRESS")),
220218
)
221219
s.Nil(err)
222220
s.False(reorged)
@@ -275,7 +273,6 @@ func (s *DriverTestSuite) TestCheckL1ReorgToSameHeightFork() {
275273
reorged, _, _, err := s.RPCClient.CheckL1ReorgFromL2EE(
276274
context.Background(),
277275
l2Head2.Number,
278-
common.HexToAddress(os.Getenv("L1_SIGNAL_SERVICE_CONTRACT_ADDRESS")),
279276
)
280277
s.Nil(err)
281278
s.False(reorged)

integration_test/entrypoint.sh

-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ check_env "ASSIGNMENT_HOOK_ADDRESS"
3434
check_env "TIMELOCK_CONTROLLER"
3535
check_env "ROLLUP_ADDRESS_MANAGER_CONTRACT_ADDRESS"
3636
check_env "GUARDIAN_PROVER_CONTRACT_ADDRESS"
37-
check_env "L1_SIGNAL_SERVICE_CONTRACT_ADDRESS"
3837
check_env "L1_CONTRACT_OWNER_PRIVATE_KEY"
3938
check_env "L1_SECURITY_COUNCIL_PRIVATE_KEY"
4039
check_env "L1_PROPOSER_PRIVATE_KEY"

integration_test/test_env.sh

-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ export ASSIGNMENT_HOOK_ADDRESS=$(echo "$DEPLOYMENT_JSON" | jq '.assignment_hook'
1515
export TIMELOCK_CONTROLLER=$(echo "$DEPLOYMENT_JSON" | jq '.timelock_controller' | sed 's/\"//g')
1616
export ROLLUP_ADDRESS_MANAGER_CONTRACT_ADDRESS=$(echo "$DEPLOYMENT_JSON" | jq '.rollup_address_manager' | sed 's/\"//g')
1717
export GUARDIAN_PROVER_CONTRACT_ADDRESS=$(echo "$DEPLOYMENT_JSON" | jq '.guardian_prover' | sed 's/\"//g')
18-
export L1_SIGNAL_SERVICE_CONTRACT_ADDRESS=$(echo "$DEPLOYMENT_JSON" | jq '.signal_service' | sed 's/\"//g')
1918
export L1_CONTRACT_OWNER_PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
2019
export L1_SECURITY_COUNCIL_PRIVATE_KEY=0xdbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97
2120
export L1_PROPOSER_PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
@@ -41,7 +40,6 @@ ASSIGNMENT_HOOK_ADDRESS=$ASSIGNMENT_HOOK_ADDRESS
4140
TIMELOCK_CONTROLLER=$TIMELOCK_CONTROLLER
4241
ROLLUP_ADDRESS_MANAGER_CONTRACT_ADDRESS=$ROLLUP_ADDRESS_MANAGER_CONTRACT_ADDRESS
4342
GUARDIAN_PROVER_CONTRACT_ADDRESS=$GUARDIAN_PROVER_CONTRACT_ADDRESS
44-
L1_SIGNAL_SERVICE_CONTRACT_ADDRESS=$L1_SIGNAL_SERVICE_CONTRACT_ADDRESS
4543
L1_CONTRACT_OWNER_PRIVATE_KEY=$L1_CONTRACT_OWNER_PRIVATE_KEY
4644
L1_SECURITY_COUNCIL_PRIVATE_KEY=$L1_SECURITY_COUNCIL_PRIVATE_KEY
4745
L1_PROPOSER_PRIVATE_KEY=$L1_PROPOSER_PRIVATE_KEY

pkg/rpc/methods.go

+2-7
Original file line numberDiff line numberDiff line change
@@ -388,11 +388,7 @@ func (c *Client) GetProtocolStateVariables(opts *bind.CallOpts) (*struct {
388388

389389
// CheckL1ReorgFromL2EE checks whether the L1 chain has been reorged from the L1Origin records in L2 EE,
390390
// if so, returns the l1Current cursor and L2 blockID that need to reset to.
391-
func (c *Client) CheckL1ReorgFromL2EE(
392-
ctx context.Context,
393-
blockID *big.Int,
394-
l1SignalService common.Address,
395-
) (bool, *types.Header, *big.Int, error) {
391+
func (c *Client) CheckL1ReorgFromL2EE(ctx context.Context, blockID *big.Int) (bool, *types.Header, *big.Int, error) {
396392
var (
397393
reorged bool
398394
l1CurrentToReset *types.Header
@@ -474,7 +470,7 @@ func (c *Client) CheckL1ReorgFromL2EE(
474470
}
475471

476472
isSyncedL1SnippetInvalid, err := c.checkSyncedL1SnippetFromAnchor(
477-
ctx, blockID, l1Origin.L1BlockHeight.Uint64(), l1SignalService,
473+
ctx, blockID, l1Origin.L1BlockHeight.Uint64(),
478474
)
479475
if err != nil {
480476
return false, nil, nil, fmt.Errorf("failed to check L1 reorg from anchor transaction: %w", err)
@@ -508,7 +504,6 @@ func (c *Client) checkSyncedL1SnippetFromAnchor(
508504
ctx context.Context,
509505
blockID *big.Int,
510506
l1Height uint64,
511-
l1SignalService common.Address,
512507
) (bool, error) {
513508
log.Info("Check synced L1 snippet from anchor", "blockID", blockID)
514509
block, err := c.L2.BlockByNumber(ctx, blockID)

prover/proof_producer/proof_producer.go

-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ type ProofRequestOptions struct {
1919
BlockID *big.Int
2020
ProverAddress common.Address
2121
ProposeBlockTxHash common.Hash
22-
L1SignalService common.Address
23-
L2SignalService common.Address
2422
TaikoL2 common.Address
2523
MetaHash common.Hash
2624
BlockHash common.Hash

prover/proof_producer/zkevm_rpcd_producer.go

-4
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,6 @@ type RequestMetaData struct {
8282

8383
// ProtocolInstance represents the JSON body of RequestProofBody.Param's `protocol_instance` field.
8484
type ProtocolInstance struct {
85-
L1SignalService string `json:"l1_signal_service"`
86-
L2SignalService string `json:"l2_signal_service"`
8785
TaikoL2 string `json:"l2_contract"`
8886
MetaHash string `json:"meta_hash"`
8987
BlockHash string `json:"block_hash"`
@@ -274,8 +272,6 @@ func (p *ZkevmRpcdProducer) requestProof(
274272
ProtocolInstance: &ProtocolInstance{
275273
Prover: opts.ProverAddress.Hex()[2:],
276274
Treasury: opts.TaikoL2.Hex()[2:],
277-
L1SignalService: opts.L1SignalService.Hex()[2:],
278-
L2SignalService: opts.L2SignalService.Hex()[2:],
279275
TaikoL2: opts.TaikoL2.Hex()[2:],
280276
MetaHash: opts.MetaHash.Hex()[2:],
281277
BlockHash: opts.BlockHash.Hex()[2:],

prover/proof_submitter/proof_contester.go

+6-17
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,10 @@ var _ Contester = (*ProofContester)(nil)
2323

2424
// ProofContester is responsible for contesting wrong L2 transitions.
2525
type ProofContester struct {
26-
rpc *rpc.Client
27-
txBuilder *transaction.ProveBlockTxBuilder
28-
txSender *transaction.Sender
29-
l2SignalService common.Address
30-
graffiti [32]byte
26+
rpc *rpc.Client
27+
txBuilder *transaction.ProveBlockTxBuilder
28+
txSender *transaction.Sender
29+
graffiti [32]byte
3130
}
3231

3332
// NewProofContester creates a new ProofContester instance.
@@ -42,15 +41,6 @@ func NewProofContester(
4241
waitReceiptTimeout time.Duration,
4342
graffiti string,
4443
) (*ProofContester, error) {
45-
l2SignalService, err := rpcClient.TaikoL2.Resolve0(
46-
nil,
47-
rpc.StringToBytes32("signal_service"),
48-
false,
49-
)
50-
if err != nil {
51-
return nil, err
52-
}
53-
5444
var txGasLimit *big.Int
5545
if proveBlockTxGasLimit != nil {
5646
txGasLimit = new(big.Int).SetUint64(*proveBlockTxGasLimit)
@@ -65,9 +55,8 @@ func NewProofContester(
6555
proveBlockMaxTxGasTipCap,
6656
new(big.Int).SetUint64(txReplacementTipMultiplier),
6757
),
68-
txSender: transaction.NewSender(rpcClient, retryInterval, &submissionMaxRetry, waitReceiptTimeout),
69-
l2SignalService: l2SignalService,
70-
graffiti: rpc.StringToBytes32(graffiti),
58+
txSender: transaction.NewSender(rpcClient, retryInterval, &submissionMaxRetry, waitReceiptTimeout),
59+
graffiti: rpc.StringToBytes32(graffiti),
7160
}, nil
7261
}
7362

prover/proof_submitter/proof_submitter.go

+4-24
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ type ProofSubmitter struct {
3535
txSender *transaction.Sender
3636
proverAddress common.Address
3737
taikoL2Address common.Address
38-
l1SignalService common.Address
39-
l2SignalService common.Address
4038
graffiti [32]byte
4139
}
4240

@@ -60,20 +58,6 @@ func New(
6058
return nil, err
6159
}
6260

63-
l1SignalService, err := rpcClient.TaikoL1.Resolve0(nil, rpc.StringToBytes32("signal_service"), false)
64-
if err != nil {
65-
return nil, err
66-
}
67-
68-
l2SignalService, err := rpcClient.TaikoL2.Resolve0(
69-
nil,
70-
rpc.StringToBytes32("signal_service"),
71-
false,
72-
)
73-
if err != nil {
74-
return nil, err
75-
}
76-
7761
var (
7862
maxRetry = &submissionMaxRetry
7963
txGasLimit *big.Int
@@ -97,12 +81,10 @@ func New(
9781
proveBlockMaxTxGasTipCap,
9882
new(big.Int).SetUint64(txReplacementTipMultiplier),
9983
),
100-
txSender: transaction.NewSender(rpcClient, retryInterval, maxRetry, waitReceiptTimeout),
101-
proverAddress: crypto.PubkeyToAddress(proverPrivKey.PublicKey),
102-
l1SignalService: l1SignalService,
103-
l2SignalService: l2SignalService,
104-
taikoL2Address: taikoL2Address,
105-
graffiti: rpc.StringToBytes32(graffiti),
84+
txSender: transaction.NewSender(rpcClient, retryInterval, maxRetry, waitReceiptTimeout),
85+
proverAddress: crypto.PubkeyToAddress(proverPrivKey.PublicKey),
86+
taikoL2Address: taikoL2Address,
87+
graffiti: rpc.StringToBytes32(graffiti),
10688
}, nil
10789
}
10890

@@ -143,8 +125,6 @@ func (s *ProofSubmitter) RequestProof(ctx context.Context, event *bindings.Taiko
143125
BlockID: block.Number(),
144126
ProverAddress: s.proverAddress,
145127
ProposeBlockTxHash: event.Raw.TxHash,
146-
L1SignalService: s.l1SignalService,
147-
L2SignalService: s.l2SignalService,
148128
TaikoL2: s.taikoL2Address,
149129
MetaHash: blockInfo.Blk.MetaHash,
150130
BlockHash: block.Hash(),

prover/proof_submitter/proof_submitter_test.go

-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ func (s *ProofSubmitterTestSuite) SetupTest() {
7979
s.RPCClient,
8080
testState,
8181
tracker,
82-
common.HexToAddress(os.Getenv("L1_SIGNAL_SERVICE_CONTRACT_ADDRESS")),
8382
)
8483
s.Nil(err)
8584

0 commit comments

Comments
 (0)