From 405b9ed03c7a2749f56fdb16849281a284bcc562 Mon Sep 17 00:00:00 2001 From: David Date: Thu, 2 Nov 2023 15:02:33 +0800 Subject: [PATCH] feat(proposer): remove `--l2.suggestedFeeRecipient` flag (#442) --- cmd/flags/proposer.go | 7 ------ driver/chain_syncer/calldata/syncer_test.go | 1 - driver/chain_syncer/chain_syncer_test.go | 1 - driver/driver_test.go | 1 - proposer/config.go | 7 ------ proposer/config_test.go | 23 ------------------- proposer/proposer_test.go | 1 - .../proof_submitter/proof_submitter_test.go | 1 - prover/prover_test.go | 1 - 9 files changed, 43 deletions(-) diff --git a/cmd/flags/proposer.go b/cmd/flags/proposer.go index fb2312f1a..f7fc68016 100644 --- a/cmd/flags/proposer.go +++ b/cmd/flags/proposer.go @@ -13,12 +13,6 @@ var ( Required: true, Category: proposerCategory, } - L2SuggestedFeeRecipient = &cli.StringFlag{ - Name: "l2.suggestedFeeRecipient", - Usage: "Address of the proposed block's suggested fee recipient", - Required: true, - Category: proposerCategory, - } ProverEndpoints = &cli.StringFlag{ Name: "proverEndpoints", Usage: "Comma-delineated list of prover endpoints proposer should query when attempting to propose a block", @@ -122,7 +116,6 @@ var ProposerFlags = MergeFlags(CommonFlags, []cli.Flag{ L2HTTPEndpoint, TaikoTokenAddress, L1ProposerPrivKey, - L2SuggestedFeeRecipient, ProposeInterval, TxPoolLocals, TxPoolLocalsOnly, diff --git a/driver/chain_syncer/calldata/syncer_test.go b/driver/chain_syncer/calldata/syncer_test.go index 858f44f48..3b6278836 100644 --- a/driver/chain_syncer/calldata/syncer_test.go +++ b/driver/chain_syncer/calldata/syncer_test.go @@ -53,7 +53,6 @@ func (s *CalldataSyncerTestSuite) SetupTest() { TaikoL2Address: common.HexToAddress(os.Getenv("TAIKO_L2_ADDRESS")), TaikoTokenAddress: common.HexToAddress(os.Getenv("TAIKO_TOKEN_ADDRESS")), L1ProposerPrivKey: l1ProposerPrivKey, - L2SuggestedFeeRecipient: common.HexToAddress(os.Getenv("L2_SUGGESTED_FEE_RECIPIENT")), ProposeInterval: &proposeInterval, MaxProposedTxListsPerEpoch: 1, WaitReceiptTimeout: 12 * time.Second, diff --git a/driver/chain_syncer/chain_syncer_test.go b/driver/chain_syncer/chain_syncer_test.go index bac43d28d..bc98cc96c 100644 --- a/driver/chain_syncer/chain_syncer_test.go +++ b/driver/chain_syncer/chain_syncer_test.go @@ -55,7 +55,6 @@ func (s *ChainSyncerTestSuite) SetupTest() { TaikoL2Address: common.HexToAddress(os.Getenv("TAIKO_L2_ADDRESS")), TaikoTokenAddress: common.HexToAddress(os.Getenv("TAIKO_TOKEN_ADDRESS")), L1ProposerPrivKey: l1ProposerPrivKey, - L2SuggestedFeeRecipient: common.HexToAddress(os.Getenv("L2_SUGGESTED_FEE_RECIPIENT")), ProposeInterval: &proposeInterval, MaxProposedTxListsPerEpoch: 1, WaitReceiptTimeout: 12 * time.Second, diff --git a/driver/driver_test.go b/driver/driver_test.go index f22cc4fa7..4c0412ee3 100644 --- a/driver/driver_test.go +++ b/driver/driver_test.go @@ -58,7 +58,6 @@ func (s *DriverTestSuite) SetupTest() { TaikoL2Address: common.HexToAddress(os.Getenv("TAIKO_L2_ADDRESS")), TaikoTokenAddress: common.HexToAddress(os.Getenv("TAIKO_TOKEN_ADDRESS")), L1ProposerPrivKey: l1ProposerPrivKey, - L2SuggestedFeeRecipient: common.HexToAddress(os.Getenv("L2_SUGGESTED_FEE_RECIPIENT")), ProposeInterval: &proposeInterval, MaxProposedTxListsPerEpoch: 1, WaitReceiptTimeout: 12 * time.Second, diff --git a/proposer/config.go b/proposer/config.go index 1c29061cf..0a87afe3b 100644 --- a/proposer/config.go +++ b/proposer/config.go @@ -22,7 +22,6 @@ type Config struct { TaikoL2Address common.Address TaikoTokenAddress common.Address L1ProposerPrivKey *ecdsa.PrivateKey - L2SuggestedFeeRecipient common.Address ExtraData string ProposeInterval *time.Duration LocalAddresses []common.Address @@ -67,11 +66,6 @@ func NewConfigFromCliContext(c *cli.Context) (*Config, error) { proposeEmptyBlocksInterval = &interval } - l2SuggestedFeeRecipient := c.String(flags.L2SuggestedFeeRecipient.Name) - if !common.IsHexAddress(l2SuggestedFeeRecipient) { - return nil, fmt.Errorf("invalid L2 suggested fee recipient address: %s", l2SuggestedFeeRecipient) - } - localAddresses := []common.Address{} if c.IsSet(flags.TxPoolLocals.Name) { for _, account := range strings.Split(c.String(flags.TxPoolLocals.Name), ",") { @@ -124,7 +118,6 @@ func NewConfigFromCliContext(c *cli.Context) (*Config, error) { TaikoL2Address: common.HexToAddress(c.String(flags.TaikoL2Address.Name)), TaikoTokenAddress: common.HexToAddress(c.String(flags.TaikoTokenAddress.Name)), L1ProposerPrivKey: l1ProposerPrivKey, - L2SuggestedFeeRecipient: common.HexToAddress(l2SuggestedFeeRecipient), ExtraData: c.String(flags.ExtraData.Name), ProposeInterval: proposingInterval, LocalAddresses: localAddresses, diff --git a/proposer/config_test.go b/proposer/config_test.go index 5d4faee0b..be1d7bb8e 100644 --- a/proposer/config_test.go +++ b/proposer/config_test.go @@ -43,7 +43,6 @@ func (s *ProposerTestSuite) TestNewConfigFromCliContext() { s.Equal(taikoL2, c.TaikoL2Address.String()) s.Equal(taikoToken, c.TaikoTokenAddress.String()) s.Equal(goldenTouchAddress, crypto.PubkeyToAddress(c.L1ProposerPrivKey.PublicKey)) - s.Equal(goldenTouchAddress, c.L2SuggestedFeeRecipient) s.Equal(float64(10), c.ProposeInterval.Seconds()) s.Equal(1, len(c.LocalAddresses)) s.Equal(goldenTouchAddress, c.LocalAddresses[0]) @@ -72,7 +71,6 @@ func (s *ProposerTestSuite) TestNewConfigFromCliContext() { "--" + flags.TaikoL2Address.Name, taikoL2, "--" + flags.TaikoTokenAddress.Name, taikoToken, "--" + flags.L1ProposerPrivKey.Name, common.Bytes2Hex(goldenTouchPrivKey.Bytes()), - "--" + flags.L2SuggestedFeeRecipient.Name, goldenTouchAddress.Hex(), "--" + flags.ProposeInterval.Name, proposeInterval, "--" + flags.TxPoolLocals.Name, goldenTouchAddress.Hex(), "--" + flags.ProposeBlockTxReplacementMultiplier.Name, "5", @@ -98,25 +96,7 @@ func (s *ProposerTestSuite) TestNewConfigFromCliContextPrivKeyErr() { }), "invalid L1 proposer private key") } -func (s *ProposerTestSuite) TestNewConfigFromCliContextL2RecipErr() { - goldenTouchPrivKey, err := s.RpcClient.TaikoL2.GOLDENTOUCHPRIVATEKEY(nil) - s.Nil(err) - - app := s.SetupApp() - - s.ErrorContains(app.Run([]string{ - "TestNewConfigFromCliContextL2RecipErr", - "--" + flags.L1ProposerPrivKey.Name, common.Bytes2Hex(goldenTouchPrivKey.Bytes()), - "--" + flags.ProposeInterval.Name, proposeInterval, - "--" + flags.ProposeEmptyBlocksInterval.Name, proposeInterval, - "--" + flags.L2SuggestedFeeRecipient.Name, "notAnAddress", - }), "invalid L2 suggested fee recipient address") -} - func (s *ProposerTestSuite) TestNewConfigFromCliContextTxPoolLocalsErr() { - goldenTouchAddress, err := s.RpcClient.TaikoL2.GOLDENTOUCHADDRESS(nil) - s.Nil(err) - goldenTouchPrivKey, err := s.RpcClient.TaikoL2.GOLDENTOUCHPRIVATEKEY(nil) s.Nil(err) @@ -127,7 +107,6 @@ func (s *ProposerTestSuite) TestNewConfigFromCliContextTxPoolLocalsErr() { "--" + flags.L1ProposerPrivKey.Name, common.Bytes2Hex(goldenTouchPrivKey.Bytes()), "--" + flags.ProposeInterval.Name, proposeInterval, "--" + flags.ProposeEmptyBlocksInterval.Name, proposeInterval, - "--" + flags.L2SuggestedFeeRecipient.Name, goldenTouchAddress.Hex(), "--" + flags.TxPoolLocals.Name, "notAnAddress", }), "invalid account in --txpool.locals") } @@ -146,7 +125,6 @@ func (s *ProposerTestSuite) TestNewConfigFromCliContextReplMultErr() { "--" + flags.L1ProposerPrivKey.Name, common.Bytes2Hex(goldenTouchPrivKey.Bytes()), "--" + flags.ProposeInterval.Name, proposeInterval, "--" + flags.ProposeEmptyBlocksInterval.Name, proposeInterval, - "--" + flags.L2SuggestedFeeRecipient.Name, goldenTouchAddress.Hex(), "--" + flags.TxPoolLocals.Name, goldenTouchAddress.Hex(), "--" + flags.ProposeBlockTxReplacementMultiplier.Name, "0", }), "invalid --proposeBlockTxReplacementMultiplier value") @@ -161,7 +139,6 @@ func (s *ProposerTestSuite) SetupApp() *cli.App { &cli.StringFlag{Name: flags.TaikoL2Address.Name}, &cli.StringFlag{Name: flags.TaikoTokenAddress.Name}, &cli.StringFlag{Name: flags.L1ProposerPrivKey.Name}, - &cli.StringFlag{Name: flags.L2SuggestedFeeRecipient.Name}, &cli.DurationFlag{Name: flags.ProposeEmptyBlocksInterval.Name}, &cli.DurationFlag{Name: flags.ProposeInterval.Name}, &cli.StringFlag{Name: flags.TxPoolLocals.Name}, diff --git a/proposer/proposer_test.go b/proposer/proposer_test.go index a38a34fb7..2e19aeb6e 100644 --- a/proposer/proposer_test.go +++ b/proposer/proposer_test.go @@ -40,7 +40,6 @@ func (s *ProposerTestSuite) SetupTest() { TaikoL2Address: common.HexToAddress(os.Getenv("TAIKO_L2_ADDRESS")), TaikoTokenAddress: common.HexToAddress(os.Getenv("TAIKO_TOKEN_ADDRESS")), L1ProposerPrivKey: l1ProposerPrivKey, - L2SuggestedFeeRecipient: common.HexToAddress(os.Getenv("L2_SUGGESTED_FEE_RECIPIENT")), ProposeInterval: &proposeInterval, MaxProposedTxListsPerEpoch: 1, ProposeBlockTxReplacementMultiplier: 2, diff --git a/prover/proof_submitter/proof_submitter_test.go b/prover/proof_submitter/proof_submitter_test.go index 0a5f729b5..bb243ae26 100644 --- a/prover/proof_submitter/proof_submitter_test.go +++ b/prover/proof_submitter/proof_submitter_test.go @@ -94,7 +94,6 @@ func (s *ProofSubmitterTestSuite) SetupTest() { TaikoL2Address: common.HexToAddress(os.Getenv("TAIKO_L2_ADDRESS")), TaikoTokenAddress: common.HexToAddress(os.Getenv("TAIKO_TOKEN_ADDRESS")), L1ProposerPrivKey: l1ProposerPrivKey, - L2SuggestedFeeRecipient: common.HexToAddress(os.Getenv("L2_SUGGESTED_FEE_RECIPIENT")), ProposeInterval: &proposeInterval, MaxProposedTxListsPerEpoch: 1, WaitReceiptTimeout: 12 * time.Second, diff --git a/prover/prover_test.go b/prover/prover_test.go index 1a772f20b..4613fa47f 100644 --- a/prover/prover_test.go +++ b/prover/prover_test.go @@ -102,7 +102,6 @@ func (s *ProverTestSuite) SetupTest() { TaikoL1Address: common.HexToAddress(os.Getenv("TAIKO_L1_ADDRESS")), TaikoL2Address: common.HexToAddress(os.Getenv("TAIKO_L2_ADDRESS")), TaikoTokenAddress: common.HexToAddress(os.Getenv("TAIKO_TOKEN_ADDRESS")), - L2SuggestedFeeRecipient: common.HexToAddress(os.Getenv("L2_SUGGESTED_FEE_RECIPIENT")), L1ProposerPrivKey: l1ProposerPrivKey, ProposeInterval: &proposeInterval, MaxProposedTxListsPerEpoch: 1,