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

feat(pkg): remove defaultMaxTransactionsPerBlock config #611

Merged
merged 4 commits into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions driver/chain_syncer/calldata/syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,6 @@ import (
txListValidator "github.com/taikoxyz/taiko-client/pkg/txlist_validator"
)

var (
// Brecht recommends to hardcore 149, may be unrequired as proof system changes
defaultMaxTxPerBlock = uint64(149)
)

// Syncer responsible for letting the L2 execution engine catching up with protocol's latest
// pending block through deriving L1 calldata.
type Syncer struct {
Expand Down Expand Up @@ -71,7 +66,6 @@ func NewSyncer(
anchorConstructor: constructor,
txListValidator: txListValidator.NewTxListValidator(
uint64(configs.BlockMaxGasLimit),
defaultMaxTxPerBlock,
configs.BlockMaxTxListBytes.Uint64(),
rpc.L2.ChainID,
),
Expand Down
8 changes: 3 additions & 5 deletions pkg/rpc/methods.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,9 @@ var (
errEmptyTiersList = errors.New("empty proof tiers list in protocol")
// syncProgressRecheckDelay is the time delay of rechecking the L2 execution engine's sync progress again,
// if the previous check failed.
syncProgressRecheckDelay = 12 * time.Second
waitL1OriginPollingInterval = 3 * time.Second
defaultWaitL1OriginTimeout = 3 * time.Minute
defaultMaxTransactionsPerBlock = uint64(149)
syncProgressRecheckDelay = 12 * time.Second
waitL1OriginPollingInterval = 3 * time.Second
defaultWaitL1OriginTimeout = 3 * time.Minute

// Request urls.
sidecarsRequestURL = "eth/v1/beacon/blob_sidecars/%d"
Expand Down Expand Up @@ -274,7 +273,6 @@ func (c *Client) GetPoolContent(
"taiko_txPoolContent",
beneficiary,
baseFee,
defaultMaxTransactionsPerBlock,
blockMaxGasLimit,
maxBytesPerTxList,
localsArg,
Expand Down
2 changes: 1 addition & 1 deletion pkg/rpc/methods_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ func TestGetPoolContentValid(t *testing.T) {
gasLimit,
maxBytes.Uint64(),
txPools,
defaultMaxTransactionsPerBlock,
4,
)
require.Nil(t, err2)
}
Expand Down
22 changes: 6 additions & 16 deletions pkg/txlist_validator/tx_list_validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,21 @@ import (

// TxListValidator is responsible for validating the transactions list in a TaikoL1.proposeBlock transaction.
type TxListValidator struct {
blockMaxGasLimit uint64
maxTransactionsPerBlock uint64
maxBytesPerTxList uint64
chainID *big.Int
blockMaxGasLimit uint64
maxBytesPerTxList uint64
chainID *big.Int
}

// NewTxListValidator creates a new TxListValidator instance based on giving configurations.
func NewTxListValidator(
blockMaxGasLimit uint64,
maxTransactionsPerBlock uint64,
maxBytesPerTxList uint64,
chainID *big.Int,
) *TxListValidator {
return &TxListValidator{
maxTransactionsPerBlock: maxTransactionsPerBlock,
blockMaxGasLimit: blockMaxGasLimit,
maxBytesPerTxList: maxBytesPerTxList,
chainID: chainID,
blockMaxGasLimit: blockMaxGasLimit,
maxBytesPerTxList: maxBytesPerTxList,
chainID: chainID,
}
}

Expand All @@ -54,13 +51,6 @@ func (v *TxListValidator) ValidateTxList(
return false
}

log.Debug("Transactions list decoded", "blockID", blockID, "length", len(txs))

if txs.Len() > int(v.maxTransactionsPerBlock) {
log.Info("Too many transactions", "blockID", blockID, "count", txs.Len())
return false
}

log.Info("Transaction list is valid", "blockID", blockID)
return true
}
8 changes: 0 additions & 8 deletions pkg/txlist_validator/tx_list_validator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (

var (
maxBlocksGasLimit = uint64(50)
maxBlockNumTxs = uint64(11)
maxTxlistBytes = uint64(10000)
chainID = genesis.Config.ChainID
testKey, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291")
Expand All @@ -34,7 +33,6 @@ var (
func TestIsTxListValid(t *testing.T) {
v := NewTxListValidator(
maxBlocksGasLimit,
maxBlockNumTxs,
maxTxlistBytes,
chainID,
)
Expand All @@ -56,12 +54,6 @@ func TestIsTxListValid(t *testing.T) {
randBytes(0x1),
false,
},
{
"txListBytes too many transactions",
chainID,
rlpEncodedTransactionBytes(int(maxBlockNumTxs)+1, true),
false,
},
{
"success empty tx list",
chainID,
Expand Down
14 changes: 8 additions & 6 deletions proposer/proposer.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,8 @@ func (p *Proposer) ProposeOp(ctx context.Context) error {
return nil
}

func (p *Proposer) makeProposeBlockTxWithBlobHash(
// makeBlobProposeBlockTx tries to send a TaikoL1.proposeBlock transaction with txList bytes saved in blob.
func (p *Proposer) makeBlobProposeBlockTx(
ctx context.Context,
txListBytes []byte,
) (*types.Transaction, error) {
Expand Down Expand Up @@ -354,13 +355,14 @@ func (p *Proposer) makeProposeBlockTxWithBlobHash(
return nil, err
}

log.Info("Tx", "proposeBlockTx", proposeTx, "type", proposeTx.Type())
log.Debug("Transaction", " nonce", proposeTx.Nonce(), "type", proposeTx.Type())

return proposeTx, nil
}

// makeProposeBlockTx tries to send a TaikoL1.proposeBlock transaction.
func (p *Proposer) makeProposeBlockTx(
// makeCalldataProposeBlockTx tries to send a TaikoL1.proposeBlock transaction
// with txList bytes saved in calldata.
func (p *Proposer) makeCalldataProposeBlockTx(
ctx context.Context,
txListBytes []byte,
) (*types.Transaction, error) {
Expand Down Expand Up @@ -451,12 +453,12 @@ func (p *Proposer) ProposeTxList(
)
// Send tx list by blob tx.
if p.BlobAllowed {
tx, err = p.makeProposeBlockTxWithBlobHash(
tx, err = p.makeBlobProposeBlockTx(
ctx,
txListBytes,
)
} else {
tx, err = p.makeProposeBlockTx(
tx, err = p.makeCalldataProposeBlockTx(
ctx,
txListBytes,
)
Expand Down
4 changes: 2 additions & 2 deletions proposer/proposer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,9 @@ func (s *ProposerTestSuite) TestSendProposeBlockTx() {
s.Nil(err)
var newTx *types.Transaction
if s.p.BlobAllowed {
newTx, err = s.p.makeProposeBlockTxWithBlobHash(context.Background(), encoded)
newTx, err = s.p.makeBlobProposeBlockTx(context.Background(), encoded)
} else {
newTx, err = s.p.makeProposeBlockTx(
newTx, err = s.p.makeCalldataProposeBlockTx(
context.Background(),
encoded,
)
Expand Down
Loading