From 8c9a0329b2702d68e18ba97c506c5d1ad20c92c7 Mon Sep 17 00:00:00 2001 From: Gavin Yu Date: Wed, 3 Jul 2024 15:35:01 +0800 Subject: [PATCH] refactor(taiko-client): rm unused code and refactor (#17723) Co-authored-by: maskpp --- packages/taiko-client/cmd/flags/proposer.go | 8 -- .../driver/chain_syncer/blob/syncer_test.go | 1 - .../driver/chain_syncer/chain_syncer_test.go | 1 - packages/taiko-client/driver/driver_test.go | 1 - packages/taiko-client/proposer/config.go | 2 - packages/taiko-client/proposer/proposer.go | 46 +++--- .../taiko-client/proposer/proposer_test.go | 14 -- .../prover_selector/eth_fee_eoa_selector.go | 134 ------------------ .../eth_fee_eoa_selector_test.go | 55 ------- .../proposer/prover_selector/interface.go | 17 --- .../proposer/transaction_builder/blob.go | 24 +--- .../proposer/transaction_builder/calldata.go | 24 +--- .../transaction_builder/calldata_test.go | 10 +- .../transaction_builder/common_test.go | 22 --- .../proposer/transaction_builder/interface.go | 3 - .../event_handler/transition_proved_test.go | 1 - .../proof_submitter/proof_submitter_test.go | 1 - packages/taiko-client/prover/prover_test.go | 1 - 18 files changed, 32 insertions(+), 333 deletions(-) delete mode 100644 packages/taiko-client/proposer/prover_selector/eth_fee_eoa_selector.go delete mode 100644 packages/taiko-client/proposer/prover_selector/eth_fee_eoa_selector_test.go delete mode 100644 packages/taiko-client/proposer/prover_selector/interface.go diff --git a/packages/taiko-client/cmd/flags/proposer.go b/packages/taiko-client/cmd/flags/proposer.go index eb3fbf0e27..5c4a45948f 100644 --- a/packages/taiko-client/cmd/flags/proposer.go +++ b/packages/taiko-client/cmd/flags/proposer.go @@ -146,13 +146,6 @@ var ( Value: false, EnvVars: []string{"L1_BLOB_ALLOWED"}, } - L1BlockBuilderTip = &cli.Uint64Flag{ - Name: "l1.blockBuilderTip", - Usage: "Amount you wish to tip the L1 block builder", - Value: 0, - Category: proposerCategory, - EnvVars: []string{"L1_BLOCK_BUILDER_TIP"}, - } ) // ProposerFlags All proposer flags. @@ -180,5 +173,4 @@ var ProposerFlags = MergeFlags(CommonFlags, []cli.Flag{ MaxTierFeePriceBumps, ProposeBlockIncludeParentMetaHash, BlobAllowed, - L1BlockBuilderTip, }, TxmgrFlags) diff --git a/packages/taiko-client/driver/chain_syncer/blob/syncer_test.go b/packages/taiko-client/driver/chain_syncer/blob/syncer_test.go index 5c2e8ec170..6b6e1bbd14 100644 --- a/packages/taiko-client/driver/chain_syncer/blob/syncer_test.go +++ b/packages/taiko-client/driver/chain_syncer/blob/syncer_test.go @@ -217,7 +217,6 @@ func (s *BlobSyncerTestSuite) initProposer() { SgxTierFee: common.Big256, MaxTierFeePriceBumps: 3, TierFeePriceBump: common.Big2, - L1BlockBuilderTip: common.Big0, TxmgrConfigs: &txmgr.CLIConfig{ L1RPCURL: os.Getenv("L1_NODE_WS_ENDPOINT"), NumConfirmations: 0, diff --git a/packages/taiko-client/driver/chain_syncer/chain_syncer_test.go b/packages/taiko-client/driver/chain_syncer/chain_syncer_test.go index 929cbba16e..2381f63cab 100644 --- a/packages/taiko-client/driver/chain_syncer/chain_syncer_test.go +++ b/packages/taiko-client/driver/chain_syncer/chain_syncer_test.go @@ -69,7 +69,6 @@ func (s *ChainSyncerTestSuite) SetupTest() { MaxTierFeePriceBumps: 3, TierFeePriceBump: common.Big2, ExtraData: "test", - L1BlockBuilderTip: common.Big0, TxmgrConfigs: &txmgr.CLIConfig{ L1RPCURL: os.Getenv("L1_NODE_WS_ENDPOINT"), NumConfirmations: 0, diff --git a/packages/taiko-client/driver/driver_test.go b/packages/taiko-client/driver/driver_test.go index e546eede52..c5c35d472c 100644 --- a/packages/taiko-client/driver/driver_test.go +++ b/packages/taiko-client/driver/driver_test.go @@ -313,7 +313,6 @@ func (s *DriverTestSuite) InitProposer() { SgxTierFee: common.Big256, MaxTierFeePriceBumps: 3, TierFeePriceBump: common.Big2, - L1BlockBuilderTip: common.Big0, TxmgrConfigs: &txmgr.CLIConfig{ L1RPCURL: os.Getenv("L1_NODE_WS_ENDPOINT"), NumConfirmations: 0, diff --git a/packages/taiko-client/proposer/config.go b/packages/taiko-client/proposer/config.go index 623af43816..1d604077f0 100644 --- a/packages/taiko-client/proposer/config.go +++ b/packages/taiko-client/proposer/config.go @@ -45,7 +45,6 @@ type Config struct { IncludeParentMetaHash bool BlobAllowed bool TxmgrConfigs *txmgr.CLIConfig - L1BlockBuilderTip *big.Int } // NewConfigFromCliContext initializes a Config instance from @@ -132,7 +131,6 @@ func NewConfigFromCliContext(c *cli.Context) (*Config, error) { MaxTierFeePriceBumps: c.Uint64(flags.MaxTierFeePriceBumps.Name), IncludeParentMetaHash: c.Bool(flags.ProposeBlockIncludeParentMetaHash.Name), BlobAllowed: c.Bool(flags.BlobAllowed.Name), - L1BlockBuilderTip: new(big.Int).SetUint64(c.Uint64(flags.L1BlockBuilderTip.Name)), TxmgrConfigs: pkgFlags.InitTxmgrConfigsFromCli( c.String(flags.L1WSEndpoint.Name), l1ProposerPrivKey, diff --git a/packages/taiko-client/proposer/proposer.go b/packages/taiko-client/proposer/proposer.go index b60aa65679..e20f14c112 100644 --- a/packages/taiko-client/proposer/proposer.go +++ b/packages/taiko-client/proposer/proposer.go @@ -3,6 +3,7 @@ package proposer import ( "bytes" "context" + "errors" "fmt" "math/rand" "sync" @@ -23,7 +24,6 @@ import ( "github.com/taikoxyz/taiko-mono/packages/taiko-client/internal/metrics" "github.com/taikoxyz/taiko-mono/packages/taiko-client/internal/utils" "github.com/taikoxyz/taiko-mono/packages/taiko-client/pkg/rpc" - selector "github.com/taikoxyz/taiko-mono/packages/taiko-client/proposer/prover_selector" builder "github.com/taikoxyz/taiko-mono/packages/taiko-client/proposer/transaction_builder" ) @@ -43,9 +43,6 @@ type Proposer struct { tiers []*rpc.TierProviderTierWithID tierFees []encoding.TierFee - // Prover selector - proverSelector selector.ProverSelector - // Transaction builder txBuilder builder.ProposeBlockTransactionBuilder @@ -112,26 +109,10 @@ func (p *Proposer) InitFromConfig(ctx context.Context, cfg *Config, txMgr *txmgr } } - if p.proverSelector, err = selector.NewETHFeeEOASelector( - &protocolConfigs, - p.rpc, - p.proposerAddress, - cfg.TaikoL1Address, - cfg.ProverSetAddress, - p.tierFees, - cfg.TierFeePriceBump, - cfg.ProverEndpoints, - cfg.MaxTierFeePriceBumps, - ); err != nil { - return err - } - if cfg.BlobAllowed { p.txBuilder = builder.NewBlobTransactionBuilder( p.rpc, p.L1ProposerPrivKey, - p.proverSelector, - p.Config.L1BlockBuilderTip, cfg.TaikoL1Address, cfg.ProverSetAddress, cfg.L2SuggestedFeeRecipient, @@ -142,8 +123,6 @@ func (p *Proposer) InitFromConfig(ctx context.Context, cfg *Config, txMgr *txmgr p.txBuilder = builder.NewCalldataTransactionBuilder( p.rpc, p.L1ProposerPrivKey, - p.proverSelector, - p.Config.L1BlockBuilderTip, cfg.L2SuggestedFeeRecipient, cfg.TaikoL1Address, cfg.ProverSetAddress, @@ -349,9 +328,30 @@ func (p *Proposer) ProposeTxList( return err } + proverAddress := p.proposerAddress + if p.Config.ClientConfig.ProverSetAddress != rpc.ZeroAddress { + proverAddress = p.Config.ClientConfig.ProverSetAddress + } + + ok, err := rpc.CheckProverBalance( + ctx, + p.rpc, + proverAddress, + p.TaikoL1Address, + p.protocolConfigs.LivenessBond, + ) + + if err != nil { + log.Warn("Failed to check prover balance", "error", err) + return err + } + + if !ok { + return errors.New("insufficient prover balance") + } + txCandidate, err := p.txBuilder.Build( ctx, - p.tierFees, p.IncludeParentMetaHash, compressedTxListBytes, ) diff --git a/packages/taiko-client/proposer/proposer_test.go b/packages/taiko-client/proposer/proposer_test.go index 7f69a6f48b..bb3ef78bdd 100644 --- a/packages/taiko-client/proposer/proposer_test.go +++ b/packages/taiko-client/proposer/proposer_test.go @@ -84,7 +84,6 @@ func (s *ProposerTestSuite) SetupTest() { TierFeePriceBump: common.Big2, MaxTierFeePriceBumps: 3, ExtraData: "test", - L1BlockBuilderTip: common.Big0, ProposeBlockTxGasLimit: 10_000_000, TxmgrConfigs: &txmgr.CLIConfig{ L1RPCURL: os.Getenv("L1_NODE_WS_ENDPOINT"), @@ -115,8 +114,6 @@ func (s *ProposerTestSuite) TestProposeTxLists() { txBuilder := builder.NewBlobTransactionBuilder( p.rpc, p.L1ProposerPrivKey, - p.proverSelector, - p.Config.L1BlockBuilderTip, cfg.TaikoL1Address, cfg.ProverSetAddress, cfg.L2SuggestedFeeRecipient, @@ -137,7 +134,6 @@ func (s *ProposerTestSuite) TestProposeTxLists() { candidate, err := txBuilder.Build( p.ctx, - p.tierFees, p.IncludeParentMetaHash, compressedTxListBytes, ) @@ -255,16 +251,6 @@ func (s *ProposerTestSuite) TestProposeEmptyBlockOp() { s.Nil(s.p.ProposeOp(context.Background())) } -func (s *ProposerTestSuite) TestAssignProverSuccessFirstRound() { - s.SetL1Automine(false) - defer s.SetL1Automine(true) - - fee, err := s.p.proverSelector.AssignProver(context.Background(), s.p.tierFees) - - s.Nil(err) - s.Equal(fee.Uint64(), s.p.OptimisticTierFee.Uint64()) -} - func (s *ProposerTestSuite) TestUpdateProposingTicker() { s.p.ProposeInterval = 1 * time.Hour s.NotPanics(s.p.updateProposingTicker) diff --git a/packages/taiko-client/proposer/prover_selector/eth_fee_eoa_selector.go b/packages/taiko-client/proposer/prover_selector/eth_fee_eoa_selector.go deleted file mode 100644 index 1d7dd28f18..0000000000 --- a/packages/taiko-client/proposer/prover_selector/eth_fee_eoa_selector.go +++ /dev/null @@ -1,134 +0,0 @@ -package selector - -import ( - "context" - "errors" - "fmt" - "math/big" - "net/url" - - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/log" - - "github.com/taikoxyz/taiko-mono/packages/taiko-client/bindings" - "github.com/taikoxyz/taiko-mono/packages/taiko-client/bindings/encoding" - "github.com/taikoxyz/taiko-mono/packages/taiko-client/pkg/rpc" -) - -var ( - httpScheme = "http" - httpsScheme = "https" - errEmptyProverEndpoints = errors.New("empty prover endpoints") - errUnableToFindProver = errors.New("unable to find prover") -) - -// ETHFeeEOASelector is a prover selector implementation which use ETHs as prover fee and -// all provers selected must be EOA accounts. -type ETHFeeEOASelector struct { - protocolConfigs *bindings.TaikoDataConfig - rpc *rpc.Client - proposerAddress common.Address - taikoL1Address common.Address - proverSetAddress common.Address - tiersFee []encoding.TierFee - tierFeePriceBump *big.Int - proverEndpoints []*url.URL - maxTierFeePriceBumpIterations uint64 -} - -// NewETHFeeEOASelector creates a new ETHFeeEOASelector instance. -func NewETHFeeEOASelector( - protocolConfigs *bindings.TaikoDataConfig, - rpc *rpc.Client, - proposerAddress common.Address, - taikoL1Address common.Address, - proverSetAddress common.Address, - tiersFee []encoding.TierFee, - tierFeePriceBump *big.Int, - proverEndpoints []*url.URL, - maxTierFeePriceBumpIterations uint64, -) (*ETHFeeEOASelector, error) { - if len(proverEndpoints) == 0 { - return nil, errEmptyProverEndpoints - } - - for _, endpoint := range proverEndpoints { - if endpoint.Scheme != httpScheme && endpoint.Scheme != httpsScheme { - return nil, fmt.Errorf("invalid prover endpoint %s", endpoint) - } - } - - return ÐFeeEOASelector{ - protocolConfigs, - rpc, - proposerAddress, - taikoL1Address, - proverSetAddress, - tiersFee, - tierFeePriceBump, - proverEndpoints, - maxTierFeePriceBumpIterations, - }, nil -} - -// ProverEndpoints returns all registered prover endpoints. -func (s *ETHFeeEOASelector) ProverEndpoints() []*url.URL { return s.proverEndpoints } - -// AssignProver tries to pick a prover through the registered prover endpoints. -func (s *ETHFeeEOASelector) AssignProver( - ctx context.Context, - tierFees []encoding.TierFee, -) (*big.Int, error) { - var ( - fees = make([]encoding.TierFee, len(tierFees)) - big100 = new(big.Int).SetUint64(uint64(100)) - maxProverFee = common.Big0 - ) - - // Deep copy the tierFees slice. - for i, fee := range tierFees { - fees[i] = encoding.TierFee{Tier: fee.Tier, Fee: new(big.Int).Set(fee.Fee)} - } - - // Iterate over each configured endpoint, and see if someone wants to accept this block. - // If it is denied, we continue on to the next endpoint. - // If we do not find a prover, we can increase the fee up to a point, or give up. - for i := 0; i < int(s.maxTierFeePriceBumpIterations); i++ { - // Bump tier fee on each failed loop. - cumulativeBumpPercent := new(big.Int).Mul(s.tierFeePriceBump, new(big.Int).SetUint64(uint64(i))) - for idx := range fees { - if i > 0 { - fee := new(big.Int).Mul(fees[idx].Fee, cumulativeBumpPercent) - fees[idx].Fee = fees[idx].Fee.Add(fees[idx].Fee, fee.Div(fee, big100)) - } - if fees[idx].Fee.Cmp(maxProverFee) > 0 { - maxProverFee = fees[idx].Fee - } - } - - spender := s.taikoL1Address - proverAddress := s.proposerAddress - if s.proverSetAddress != rpc.ZeroAddress { - proverAddress = s.proverSetAddress - } - - ok, err := rpc.CheckProverBalance( - ctx, - s.rpc, - proverAddress, - spender, - s.protocolConfigs.LivenessBond, - ) - if err != nil { - log.Warn("Failed to check prover balance", "error", err) - continue - } - if !ok { - continue - } - - return maxProverFee, nil - } - - return nil, errUnableToFindProver -} diff --git a/packages/taiko-client/proposer/prover_selector/eth_fee_eoa_selector_test.go b/packages/taiko-client/proposer/prover_selector/eth_fee_eoa_selector_test.go deleted file mode 100644 index d147b9bb7f..0000000000 --- a/packages/taiko-client/proposer/prover_selector/eth_fee_eoa_selector_test.go +++ /dev/null @@ -1,55 +0,0 @@ -package selector - -import ( - "net/url" - "os" - "testing" - - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto" - "github.com/stretchr/testify/suite" - - "github.com/taikoxyz/taiko-mono/packages/taiko-client/bindings/encoding" - "github.com/taikoxyz/taiko-mono/packages/taiko-client/internal/testutils" -) - -type ProverSelectorTestSuite struct { - testutils.ClientTestSuite - s *ETHFeeEOASelector - proverAddress common.Address -} - -func (s *ProverSelectorTestSuite) SetupTest() { - s.ClientTestSuite.SetupTest() - - l1ProverPrivKey, err := crypto.ToECDSA(common.FromHex(os.Getenv("L1_PROVER_PRIVATE_KEY"))) - s.Nil(err) - s.proverAddress = crypto.PubkeyToAddress(l1ProverPrivKey.PublicKey) - - l1ProposerPrivKey, err := crypto.ToECDSA(common.FromHex(os.Getenv("L1_PROPOSER_PRIVATE_KEY"))) - s.Nil(err) - - protocolConfigs, err := s.RPCClient.TaikoL1.GetConfig(nil) - s.Nil(err) - - s.s, err = NewETHFeeEOASelector( - &protocolConfigs, - s.RPCClient, - crypto.PubkeyToAddress(l1ProposerPrivKey.PublicKey), - common.HexToAddress(os.Getenv("TAIKO_L1_ADDRESS")), - common.Address{}, - []encoding.TierFee{}, - common.Big2, - []*url.URL{s.ProverEndpoints[0]}, - 32, - ) - s.Nil(err) -} - -func (s *ProverSelectorTestSuite) TestProverEndpoints() { - s.Equal(1, len(s.s.ProverEndpoints())) -} - -func TestProverSelectorTestSuite(t *testing.T) { - suite.Run(t, new(ProverSelectorTestSuite)) -} diff --git a/packages/taiko-client/proposer/prover_selector/interface.go b/packages/taiko-client/proposer/prover_selector/interface.go deleted file mode 100644 index 804282e210..0000000000 --- a/packages/taiko-client/proposer/prover_selector/interface.go +++ /dev/null @@ -1,17 +0,0 @@ -package selector - -import ( - "context" - "math/big" - "net/url" - - "github.com/taikoxyz/taiko-mono/packages/taiko-client/bindings/encoding" -) - -type ProverSelector interface { - AssignProver( - ctx context.Context, - tierFees []encoding.TierFee, - ) (fee *big.Int, err error) - ProverEndpoints() []*url.URL -} diff --git a/packages/taiko-client/proposer/transaction_builder/blob.go b/packages/taiko-client/proposer/transaction_builder/blob.go index 2dda18194d..f9e96ed742 100644 --- a/packages/taiko-client/proposer/transaction_builder/blob.go +++ b/packages/taiko-client/proposer/transaction_builder/blob.go @@ -4,7 +4,6 @@ import ( "context" "crypto/ecdsa" "crypto/sha256" - "math/big" "github.com/ethereum-optimism/optimism/op-service/eth" "github.com/ethereum-optimism/optimism/op-service/txmgr" @@ -14,7 +13,6 @@ import ( "github.com/taikoxyz/taiko-mono/packages/taiko-client/bindings/encoding" "github.com/taikoxyz/taiko-mono/packages/taiko-client/pkg/rpc" - selector "github.com/taikoxyz/taiko-mono/packages/taiko-client/proposer/prover_selector" ) // BlobTransactionBuilder is responsible for building a TaikoL1.proposeBlock transaction with txList @@ -22,8 +20,6 @@ import ( type BlobTransactionBuilder struct { rpc *rpc.Client proposerPrivateKey *ecdsa.PrivateKey - proverSelector selector.ProverSelector - l1BlockBuilderTip *big.Int taikoL1Address common.Address proverSetAddress common.Address l2SuggestedFeeRecipient common.Address @@ -35,8 +31,6 @@ type BlobTransactionBuilder struct { func NewBlobTransactionBuilder( rpc *rpc.Client, proposerPrivateKey *ecdsa.PrivateKey, - proverSelector selector.ProverSelector, - l1BlockBuilderTip *big.Int, taikoL1Address common.Address, proverSetAddress common.Address, l2SuggestedFeeRecipient common.Address, @@ -46,8 +40,6 @@ func NewBlobTransactionBuilder( return &BlobTransactionBuilder{ rpc, proposerPrivateKey, - proverSelector, - l1BlockBuilderTip, taikoL1Address, proverSetAddress, l2SuggestedFeeRecipient, @@ -59,7 +51,6 @@ func NewBlobTransactionBuilder( // Build implements the ProposeBlockTransactionBuilder interface. func (b *BlobTransactionBuilder) Build( ctx context.Context, - tierFees []encoding.TierFee, includeParentMetaHash bool, txListBytes []byte, ) (*txmgr.TxCandidate, error) { @@ -68,17 +59,11 @@ func (b *BlobTransactionBuilder) Build( return nil, err } - // Try to assign a prover. - maxFee, err := b.proverSelector.AssignProver( - ctx, - tierFees, - ) - if err != nil { - return nil, err - } - // If the current proposer wants to include the parent meta hash, then fetch it from the protocol. - var parentMetaHash = [32]byte{} + var ( + parentMetaHash = [32]byte{} + err error + ) if includeParentMetaHash { if parentMetaHash, err = getParentMetaHash(ctx, b.rpc); err != nil { return nil, err @@ -133,6 +118,5 @@ func (b *BlobTransactionBuilder) Build( Blobs: []*eth.Blob{blob}, To: to, GasLimit: b.gasLimit, - Value: maxFee, }, nil } diff --git a/packages/taiko-client/proposer/transaction_builder/calldata.go b/packages/taiko-client/proposer/transaction_builder/calldata.go index 5fef780f53..97648b5d5a 100644 --- a/packages/taiko-client/proposer/transaction_builder/calldata.go +++ b/packages/taiko-client/proposer/transaction_builder/calldata.go @@ -3,7 +3,6 @@ package builder import ( "context" "crypto/ecdsa" - "math/big" "github.com/ethereum-optimism/optimism/op-service/txmgr" "github.com/ethereum/go-ethereum/common" @@ -11,7 +10,6 @@ import ( "github.com/taikoxyz/taiko-mono/packages/taiko-client/bindings/encoding" "github.com/taikoxyz/taiko-mono/packages/taiko-client/pkg/rpc" - selector "github.com/taikoxyz/taiko-mono/packages/taiko-client/proposer/prover_selector" ) // CalldataTransactionBuilder is responsible for building a TaikoL1.proposeBlock transaction with txList @@ -19,8 +17,6 @@ import ( type CalldataTransactionBuilder struct { rpc *rpc.Client proposerPrivateKey *ecdsa.PrivateKey - proverSelector selector.ProverSelector - l1BlockBuilderTip *big.Int l2SuggestedFeeRecipient common.Address taikoL1Address common.Address proverSetAddress common.Address @@ -32,8 +28,6 @@ type CalldataTransactionBuilder struct { func NewCalldataTransactionBuilder( rpc *rpc.Client, proposerPrivateKey *ecdsa.PrivateKey, - proverSelector selector.ProverSelector, - l1BlockBuilderTip *big.Int, l2SuggestedFeeRecipient common.Address, taikoL1Address common.Address, proverSetAddress common.Address, @@ -43,8 +37,6 @@ func NewCalldataTransactionBuilder( return &CalldataTransactionBuilder{ rpc, proposerPrivateKey, - proverSelector, - l1BlockBuilderTip, l2SuggestedFeeRecipient, taikoL1Address, proverSetAddress, @@ -56,21 +48,14 @@ func NewCalldataTransactionBuilder( // Build implements the ProposeBlockTransactionBuilder interface. func (b *CalldataTransactionBuilder) Build( ctx context.Context, - tierFees []encoding.TierFee, includeParentMetaHash bool, txListBytes []byte, ) (*txmgr.TxCandidate, error) { - // Try to assign a prover. - maxFee, err := b.proverSelector.AssignProver( - ctx, - tierFees, - ) - if err != nil { - return nil, err - } - // If the current proposer wants to include the parent meta hash, then fetch it from the protocol. - var parentMetaHash = [32]byte{} + var ( + parentMetaHash = [32]byte{} + err error + ) if includeParentMetaHash { if parentMetaHash, err = getParentMetaHash(ctx, b.rpc); err != nil { return nil, err @@ -119,6 +104,5 @@ func (b *CalldataTransactionBuilder) Build( Blobs: nil, To: to, GasLimit: b.gasLimit, - Value: maxFee, }, nil } diff --git a/packages/taiko-client/proposer/transaction_builder/calldata_test.go b/packages/taiko-client/proposer/transaction_builder/calldata_test.go index b2f280b846..8bc54e226d 100644 --- a/packages/taiko-client/proposer/transaction_builder/calldata_test.go +++ b/packages/taiko-client/proposer/transaction_builder/calldata_test.go @@ -2,18 +2,10 @@ package builder import ( "context" - - "github.com/ethereum/go-ethereum/common" - - "github.com/taikoxyz/taiko-mono/packages/taiko-client/bindings/encoding" ) func (s *TransactionBuilderTestSuite) TestBuildCalldata() { - tx, err := s.calldataTxBuilder.Build(context.Background(), []encoding.TierFee{ - {Tier: encoding.TierOptimisticID, Fee: common.Big256}, - {Tier: encoding.TierSgxID, Fee: common.Big256}, - {Tier: encoding.TierSgxAndZkVMID, Fee: common.Big257}, - }, false, []byte{1}) + tx, err := s.calldataTxBuilder.Build(context.Background(), false, []byte{1}) s.Nil(err) s.Nil(tx.Blobs) } diff --git a/packages/taiko-client/proposer/transaction_builder/common_test.go b/packages/taiko-client/proposer/transaction_builder/common_test.go index 6a8d7de486..a76a42e6f9 100644 --- a/packages/taiko-client/proposer/transaction_builder/common_test.go +++ b/packages/taiko-client/proposer/transaction_builder/common_test.go @@ -2,7 +2,6 @@ package builder import ( "context" - "net/url" "os" "testing" @@ -10,9 +9,7 @@ import ( "github.com/ethereum/go-ethereum/crypto" "github.com/stretchr/testify/suite" - "github.com/taikoxyz/taiko-mono/packages/taiko-client/bindings/encoding" "github.com/taikoxyz/taiko-mono/packages/taiko-client/internal/testutils" - selector "github.com/taikoxyz/taiko-mono/packages/taiko-client/proposer/prover_selector" ) type TransactionBuilderTestSuite struct { @@ -24,29 +21,12 @@ type TransactionBuilderTestSuite struct { func (s *TransactionBuilderTestSuite) SetupTest() { s.ClientTestSuite.SetupTest() - protocolConfigs, err := s.RPCClient.TaikoL1.GetConfig(nil) - s.Nil(err) - l1ProposerPrivKey, err := crypto.ToECDSA(common.FromHex(os.Getenv("L1_PROPOSER_PRIVATE_KEY"))) s.Nil(err) - proverSelector, err := selector.NewETHFeeEOASelector( - &protocolConfigs, - s.RPCClient, - crypto.PubkeyToAddress(l1ProposerPrivKey.PublicKey), - common.HexToAddress(os.Getenv("TAIKO_L1_ADDRESS")), - common.Address{}, - []encoding.TierFee{}, - common.Big2, - []*url.URL{s.ProverEndpoints[0]}, - 32, - ) - s.Nil(err) s.calldataTxBuilder = NewCalldataTransactionBuilder( s.RPCClient, l1ProposerPrivKey, - proverSelector, - common.Big0, common.HexToAddress(os.Getenv("TAIKO_L2_ADDRESS")), common.HexToAddress(os.Getenv("TAIKO_L1_ADDRESS")), common.Address{}, @@ -56,8 +36,6 @@ func (s *TransactionBuilderTestSuite) SetupTest() { s.blobTxBuiler = NewBlobTransactionBuilder( s.RPCClient, l1ProposerPrivKey, - proverSelector, - common.Big0, common.HexToAddress(os.Getenv("TAIKO_L1_ADDRESS")), common.Address{}, common.HexToAddress(os.Getenv("TAIKO_L2_ADDRESS")), diff --git a/packages/taiko-client/proposer/transaction_builder/interface.go b/packages/taiko-client/proposer/transaction_builder/interface.go index c1cac45aa6..a1cee51f4e 100644 --- a/packages/taiko-client/proposer/transaction_builder/interface.go +++ b/packages/taiko-client/proposer/transaction_builder/interface.go @@ -4,15 +4,12 @@ import ( "context" "github.com/ethereum-optimism/optimism/op-service/txmgr" - - "github.com/taikoxyz/taiko-mono/packages/taiko-client/bindings/encoding" ) // ProposeBlockTransactionBuilder is an interface for building a TaikoL1.proposeBlock transaction. type ProposeBlockTransactionBuilder interface { Build( ctx context.Context, - tierFees []encoding.TierFee, includeParentMetaHash bool, txListBytes []byte, ) (*txmgr.TxCandidate, error) diff --git a/packages/taiko-client/prover/event_handler/transition_proved_test.go b/packages/taiko-client/prover/event_handler/transition_proved_test.go index d8ba22fa6d..01bce3cb9d 100644 --- a/packages/taiko-client/prover/event_handler/transition_proved_test.go +++ b/packages/taiko-client/prover/event_handler/transition_proved_test.go @@ -93,7 +93,6 @@ func (s *EventHandlerTestSuite) SetupTest() { SgxTierFee: common.Big256, MaxTierFeePriceBumps: 3, TierFeePriceBump: common.Big2, - L1BlockBuilderTip: common.Big0, TxmgrConfigs: &txmgr.CLIConfig{ L1RPCURL: os.Getenv("L1_NODE_WS_ENDPOINT"), NumConfirmations: 1, diff --git a/packages/taiko-client/prover/proof_submitter/proof_submitter_test.go b/packages/taiko-client/prover/proof_submitter/proof_submitter_test.go index 233c8506d6..9c38a1fd62 100644 --- a/packages/taiko-client/prover/proof_submitter/proof_submitter_test.go +++ b/packages/taiko-client/prover/proof_submitter/proof_submitter_test.go @@ -141,7 +141,6 @@ func (s *ProofSubmitterTestSuite) SetupTest() { SgxTierFee: common.Big256, MaxTierFeePriceBumps: 3, TierFeePriceBump: common.Big2, - L1BlockBuilderTip: common.Big0, }, txMgr)) s.proposer = prop diff --git a/packages/taiko-client/prover/prover_test.go b/packages/taiko-client/prover/prover_test.go index 9af8cf1179..d6bfc1f697 100644 --- a/packages/taiko-client/prover/prover_test.go +++ b/packages/taiko-client/prover/prover_test.go @@ -116,7 +116,6 @@ func (s *ProverTestSuite) SetupTest() { SgxTierFee: common.Big256, MaxTierFeePriceBumps: 3, TierFeePriceBump: common.Big2, - L1BlockBuilderTip: common.Big0, }, s.txmgr)) s.proposer = prop