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

Commit

Permalink
feat: rename
Browse files Browse the repository at this point in the history
  • Loading branch information
davidtaikocha committed Apr 3, 2024
1 parent 233f0e8 commit 7588325
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 35 deletions.
20 changes: 11 additions & 9 deletions cmd/flags/proposer.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,21 +66,21 @@ var (
Category: proposerCategory,
Value: 0,
}
BlockMinGasLimit = &cli.Uint64Flag{
Name: "epoch.minGasLimit",
Usage: "Minimum gas limit for a proposed block",
MinGasUsed = &cli.Uint64Flag{
Name: "epoch.minGasUsed",
Usage: "Minimum gas used for a transactions list to propose",
Category: proposerCategory,
Value: 0,
}
BlockMinTxListBytes = &cli.Uint64Flag{
MinTxListBytes = &cli.Uint64Flag{
Name: "epoch.minTxListBytes",
Usage: "Minimum bytes for a proposed transaction list",
Usage: "Minimum bytes for a transactions list to propose",
Category: proposerCategory,
Value: 0,
}
FroceProposingInternal = &cli.DurationFlag{
Name: "epoch.emptyBlockInterval",
Usage: "Time interval to propose empty blocks",
MinProposingInternal = &cli.DurationFlag{
Name: "epoch.minProposingInterval",
Usage: "Minimum time interval to force proposing a block, even if there are no transaction in mempool",
Category: proposerCategory,
Value: 0,
}
Expand Down Expand Up @@ -139,7 +139,9 @@ var ProposerFlags = MergeFlags(CommonFlags, []cli.Flag{
TxPoolLocals,
TxPoolLocalsOnly,
ExtraData,
FroceProposingInternal,
MinGasUsed,
MinTxListBytes,
MinProposingInternal,
MaxProposedTxListsPerEpoch,
ProverEndpoints,
OptimisticTierFee,
Expand Down
27 changes: 13 additions & 14 deletions proposer/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ type Config struct {
ProposeInterval time.Duration
LocalAddresses []common.Address
LocalAddressesOnly bool
BlockMinGasLimit uint64
BlockMinTxListBytes uint64
FroceProposingInternal time.Duration
MinGasUsed uint64
MinTxListBytes uint64
MinProposingInternal time.Duration
MaxProposedTxListsPerEpoch uint64
ProposeBlockTxGasLimit uint64
WaitReceiptTimeout time.Duration
Expand Down Expand Up @@ -88,17 +88,16 @@ func NewConfigFromCliContext(c *cli.Context) (*Config, error) {
TaikoTokenAddress: common.HexToAddress(c.String(flags.TaikoTokenAddress.Name)),
Timeout: c.Duration(flags.RPCTimeout.Name),
},
AssignmentHookAddress: common.HexToAddress(c.String(flags.ProposerAssignmentHookAddress.Name)),
L1ProposerPrivKey: l1ProposerPrivKey,
L2SuggestedFeeRecipient: common.HexToAddress(l2SuggestedFeeRecipient),
ExtraData: c.String(flags.ExtraData.Name),
ProposeInterval: c.Duration(flags.ProposeInterval.Name),
LocalAddresses: localAddresses,
LocalAddressesOnly: c.Bool(flags.TxPoolLocalsOnly.Name),

BlockMinGasLimit: c.Uint64(flags.BlockMinGasLimit.Name),
BlockMinTxListBytes: c.Uint64(flags.BlockMinTxListBytes.Name),
FroceProposingInternal: c.Duration(flags.FroceProposingInternal.Name),
AssignmentHookAddress: common.HexToAddress(c.String(flags.ProposerAssignmentHookAddress.Name)),
L1ProposerPrivKey: l1ProposerPrivKey,
L2SuggestedFeeRecipient: common.HexToAddress(l2SuggestedFeeRecipient),
ExtraData: c.String(flags.ExtraData.Name),
ProposeInterval: c.Duration(flags.ProposeInterval.Name),
LocalAddresses: localAddresses,
LocalAddressesOnly: c.Bool(flags.TxPoolLocalsOnly.Name),
MinGasUsed: c.Uint64(flags.MinGasUsed.Name),
MinTxListBytes: c.Uint64(flags.MinTxListBytes.Name),
MinProposingInternal: c.Duration(flags.MinProposingInternal.Name),
MaxProposedTxListsPerEpoch: c.Uint64(flags.MaxProposedTxListsPerEpoch.Name),
ProposeBlockTxGasLimit: c.Uint64(flags.TxGasLimit.Name),
WaitReceiptTimeout: c.Duration(flags.WaitReceiptTimeout.Name),
Expand Down
6 changes: 3 additions & 3 deletions proposer/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func (s *ProposerTestSuite) TestNewConfigFromCliContextL2RecipErr() {
"TestNewConfigFromCliContextL2RecipErr",
"--" + flags.L1ProposerPrivKey.Name, encoding.GoldenTouchPrivKey,
"--" + flags.ProposeInterval.Name, proposeInterval,
"--" + flags.FroceProposingInternal.Name, proposeInterval,
"--" + flags.MinProposingInternal.Name, proposeInterval,
"--" + flags.L2SuggestedFeeRecipient.Name, "notAnAddress",
}), "invalid L2 suggested fee recipient address")
}
Expand All @@ -115,7 +115,7 @@ func (s *ProposerTestSuite) TestNewConfigFromCliContextTxPoolLocalsErr() {
"TestNewConfigFromCliContextTxPoolLocalsErr",
"--" + flags.L1ProposerPrivKey.Name, encoding.GoldenTouchPrivKey,
"--" + flags.ProposeInterval.Name, proposeInterval,
"--" + flags.FroceProposingInternal.Name, proposeInterval,
"--" + flags.MinProposingInternal.Name, proposeInterval,
"--" + flags.L2SuggestedFeeRecipient.Name, goldenTouchAddress.Hex(),
"--" + flags.TxPoolLocals.Name, "notAnAddress",
}), "invalid account in --txpool.locals")
Expand All @@ -131,7 +131,7 @@ func (s *ProposerTestSuite) SetupApp() *cli.App {
&cli.StringFlag{Name: flags.TaikoTokenAddress.Name},
&cli.StringFlag{Name: flags.L1ProposerPrivKey.Name},
&cli.StringFlag{Name: flags.L2SuggestedFeeRecipient.Name},
&cli.DurationFlag{Name: flags.FroceProposingInternal.Name},
&cli.DurationFlag{Name: flags.MinProposingInternal.Name},
&cli.DurationFlag{Name: flags.ProposeInterval.Name},
&cli.StringFlag{Name: flags.TxPoolLocals.Name},
&cli.StringFlag{Name: flags.ProverEndpoints.Name},
Expand Down
7 changes: 3 additions & 4 deletions proposer/proposer.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ func (p *Proposer) eventLoop() {
continue
}
// If there is always no new transaction and the empty block interval has passed, propose an empty block.
if p.FroceProposingInternal != 0 {
if time.Now().Before(lastNonEmptyBlockProposedAt.Add(p.FroceProposingInternal)) {
if p.MinProposingInternal != 0 {
if time.Now().Before(lastNonEmptyBlockProposedAt.Add(p.MinProposingInternal)) {
continue
}

Expand Down Expand Up @@ -242,8 +242,7 @@ func (p *Proposer) ProposeOp(ctx context.Context) error {

txLists := make([]types.Transactions, 0, len(preBuiltTxList))
for _, txs := range preBuiltTxList {
if txs.EstimatedGasUsed < p.BlockMinGasLimit ||
txs.BytesLength < p.BlockMinTxListBytes {
if txs.EstimatedGasUsed < p.MinGasUsed || txs.BytesLength < p.MinTxListBytes {
break
}
txLists = append(txLists, txs.TxList)
Expand Down
10 changes: 5 additions & 5 deletions proposer/proposer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,9 @@ func (s *ProposerTestSuite) getLatestProposedTxs(
}

func (s *ProposerTestSuite) TestEmptyBlock() {
s.p.FroceProposingInternal = 3 * time.Second
s.p.BlockMinGasLimit = math.MaxUint64
s.p.BlockMinTxListBytes = math.MaxUint64
s.p.MinProposingInternal = 3 * time.Second
s.p.MinGasUsed = math.MaxUint64
s.p.MinTxListBytes = math.MaxUint64
s.p.ProposeInterval = time.Second

number, err := s.RPCClient.L1.BlockNumber(context.Background())
Expand Down Expand Up @@ -237,8 +237,8 @@ func (s *ProposerTestSuite) TestProposeOpNoEmptyBlock() {

// Start proposer
p.LocalAddressesOnly = false
p.BlockMinGasLimit = blockMinGasLimit
p.BlockMinTxListBytes = blockMinTxListBytes
p.MinGasUsed = blockMinGasLimit
p.MinTxListBytes = blockMinTxListBytes
p.ProposeInterval = time.Second
s.Nil(p.Start())
defer p.Close()
Expand Down

0 comments on commit 7588325

Please sign in to comment.