Skip to content

Commit

Permalink
revert flags
Browse files Browse the repository at this point in the history
  • Loading branch information
radkomih committed Aug 21, 2024
1 parent 2fc7ad2 commit 3d2868f
Show file tree
Hide file tree
Showing 12 changed files with 24 additions and 53 deletions.
5 changes: 0 additions & 5 deletions cmd/geth/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,6 @@ func makeFullNode(ctx *cli.Context) (*node.Node, ethapi.Backend) {
v := ctx.Uint64(utils.OverrideVerkle.Name)
cfg.Eth.OverrideVerkle = &v
}
// CHANGE(limechain): tx lists configuration options
if ctx.IsSet(utils.MaxProposedTxListsPerEpochFlag.Name) {
v := ctx.Uint64(utils.MaxProposedTxListsPerEpochFlag.Name)
cfg.Eth.MaxProposedTxListsPerEpoch = v
}

backend, eth := utils.RegisterEthService(stack, &cfg.Eth)

Expand Down
2 changes: 0 additions & 2 deletions cmd/geth/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,6 @@ var (
configFileFlag,
utils.LogDebugFlag,
utils.LogBacktraceAtFlag,
// CHANGE(limechain): tx lists configuration flags
utils.MaxProposedTxListsPerEpochFlag,
}, utils.NetworkFlags, utils.DatabaseFlags)

rpcFlags = []cli.Flag{
Expand Down
18 changes: 0 additions & 18 deletions cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,24 +281,6 @@ var (
Value: ethconfig.Defaults.TransactionHistory,
Category: flags.StateCategory,
}
// CHANGE(limechain):
// Transaction list settings
// TxPoolLocals = &cli.StringSliceFlag{
// Name: "txPool.locals",
// Usage: "Comma separated accounts to treat as locals (priority inclusion)",
// Category: flags.TxListsCategory,
// }
// TxPoolLocalsOnly = &cli.BoolFlag{
// Name: "txPool.localsOnly",
// Usage: "If set to true, proposer will only propose transactions of local accounts",
// Value: false,
// Category: flags.TxListsCategory,
// }
MaxProposedTxListsPerEpochFlag = &cli.Uint64Flag{
Name: "preconf.maxtxlists",
Usage: "Maximum number of transaction lists which will be proposed inside one proposing epoch",
Category: flags.TxListsCategory,
}
// Transaction pool settings
TxPoolLocalsFlag = &cli.StringFlag{
Name: "txpool.locals",
Expand Down
10 changes: 6 additions & 4 deletions core/rawdb/tx_list_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ var (
)

type TxListConfig struct {
Beneficiary common.Address // L1 proposer address
BaseFee *big.Int // base fee calculated in the protocol contract
BlockMaxGasLimit uint64 // hard-coded in the protocol contract config
MaxBytesPerTxList uint64
Beneficiary common.Address // L1 proposer address
BaseFee *big.Int // base fee calculated in the protocol contract
BlockMaxGasLimit uint64 // hard-coded in the protocol contract config
MaxBytesPerTxList uint64
MaxTransactionsLists uint64
Locals []string // TODO(limechain): []common.Address
}

func ReadTxListConfig(db ethdb.Database) *TxListConfig {
Expand Down
3 changes: 1 addition & 2 deletions eth/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,7 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
return nil, err
}

// CHANGE(limechain): tx lists configuration options
eth.miner = miner.New(eth, &config.Miner, eth.blockchain.Config(), eth.EventMux(), eth.engine, eth.isLocalBlock, config.MaxProposedTxListsPerEpoch)
eth.miner = miner.New(eth, &config.Miner, eth.blockchain.Config(), eth.EventMux(), eth.engine, eth.isLocalBlock)
eth.miner.SetExtra(makeExtraData(config.Miner.ExtraData))

eth.APIBackend = &EthAPIBackend{stack.Config().ExtRPCEnabled(), stack.Config().AllowUnprotectedTxs, eth, nil}
Expand Down
3 changes: 0 additions & 3 deletions eth/ethconfig/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,6 @@ type Config struct {

// OverrideVerkle (TODO: remove after the fork)
OverrideVerkle *uint64 `toml:",omitempty"`

// CHANGE(limechain): tx lists configuration options
MaxProposedTxListsPerEpoch uint64 `toml:",omitempty"`
}

// CreateConsensusEngine creates a consensus engine for the given chain config.
Expand Down
12 changes: 8 additions & 4 deletions eth/taiko_api_backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ func (a *TaikoAuthAPIBackend) UpdateConfigAndSlots(
blockMaxGasLimit uint64,
maxBytesPerTxList uint64,
beneficiary common.Address,
locals []string,
maxTransactionsLists uint64,
) error {
offset := currentSlot % 32
firstEpochSlot := currentSlot - offset
Expand All @@ -92,10 +94,12 @@ func (a *TaikoAuthAPIBackend) UpdateConfigAndSlots(
db := a.eth.ChainDb()

rawdb.WriteTxListConfig(db, &rawdb.TxListConfig{
Beneficiary: beneficiary,
BaseFee: baseFee,
BlockMaxGasLimit: blockMaxGasLimit,
MaxBytesPerTxList: maxBytesPerTxList,
Beneficiary: beneficiary,
BaseFee: baseFee,
BlockMaxGasLimit: blockMaxGasLimit,
MaxBytesPerTxList: maxBytesPerTxList,
Locals: locals,
MaxTransactionsLists: maxTransactionsLists,
})

rawdb.WriteCurrentL1Slot(db, currentSlot)
Expand Down
2 changes: 0 additions & 2 deletions internal/flags/categories.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ const (
MiscCategory = "MISC"
TestingCategory = "TESTING"
DeprecatedCategory = "ALIASED (deprecated)"
// CHANGE(limechain):
TxListsCategory = "TRANSACTION LISTS"
)

func init() {
Expand Down
5 changes: 2 additions & 3 deletions miner/miner.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,15 @@ type Miner struct {
wg sync.WaitGroup
}

// CHANGE(limechain): tx lists configuration options
func New(eth Backend, config *Config, chainConfig *params.ChainConfig, mux *event.TypeMux, engine consensus.Engine, isLocalBlock func(header *types.Header) bool, maxTransactionLists uint64) *Miner {
func New(eth Backend, config *Config, chainConfig *params.ChainConfig, mux *event.TypeMux, engine consensus.Engine, isLocalBlock func(header *types.Header) bool) *Miner {
miner := &Miner{
mux: mux,
eth: eth,
engine: engine,
exitCh: make(chan struct{}),
startCh: make(chan struct{}),
stopCh: make(chan struct{}),
worker: newWorker(config, chainConfig, engine, eth, mux, isLocalBlock, true, maxTransactionLists),
worker: newWorker(config, chainConfig, engine, eth, mux, isLocalBlock, true),
}
miner.wg.Add(1)
go miner.update()
Expand Down
2 changes: 1 addition & 1 deletion miner/miner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ func createMiner(t *testing.T) (*Miner, *event.TypeMux, func(skipMiner bool)) {
// Create event Mux
mux := new(event.TypeMux)
// Create Miner
miner := New(backend, &config, chainConfig, mux, engine, nil, 1)
miner := New(backend, &config, chainConfig, mux, engine, nil)
cleanup := func(skipMiner bool) {
bc.Stop()
engine.Close()
Expand Down
13 changes: 5 additions & 8 deletions miner/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ func (w *worker) ResetTxPoolSnapshot() {
log.Warn("Tx pool snapshot has been reset")
}

func newWorker(config *Config, chainConfig *params.ChainConfig, engine consensus.Engine, eth Backend, mux *event.TypeMux, isLocalBlock func(header *types.Header) bool, init bool, maxTransactionLists uint64) *worker {
func newWorker(config *Config, chainConfig *params.ChainConfig, engine consensus.Engine, eth Backend, mux *event.TypeMux, isLocalBlock func(header *types.Header) bool, init bool) *worker {
worker := &worker{
config: config,
chainConfig: chainConfig,
Expand Down Expand Up @@ -428,7 +428,7 @@ func newWorker(config *Config, chainConfig *params.ChainConfig, engine consensus
go worker.newWorkLoop(recommit)
go worker.resultLoop()
go worker.taskLoop()
go worker.txListLoop(maxTransactionLists)
go worker.txListLoop()

// Submit first work to initialize pending state.
if init {
Expand Down Expand Up @@ -850,12 +850,9 @@ func (w *worker) resultLoop() {
}

// txListLoop polls new txs from the pool and updates the tx lists.
func (w *worker) txListLoop(maxTransactionLists uint64) {
func (w *worker) txListLoop() {
defer w.wg.Done()

// TODO(limechain):
localAddresses := []string{}

for {
select {
case <-w.exitCh:
Expand All @@ -880,8 +877,8 @@ func (w *worker) txListLoop(maxTransactionLists uint64) {
txListConfig.BaseFee,
txListConfig.BlockMaxGasLimit,
txListConfig.MaxBytesPerTxList,
localAddresses,
maxTransactionLists,
txListConfig.Locals,
txListConfig.MaxTransactionsLists,
)
if err != nil {
log.Error("Building tx list", "error", err)
Expand Down
2 changes: 1 addition & 1 deletion miner/worker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ func (b *testWorkerBackend) newRandomTx(creation bool) *types.Transaction {
func newTestWorker(t *testing.T, chainConfig *params.ChainConfig, engine consensus.Engine, db ethdb.Database, blocks int) (*worker, *testWorkerBackend) {
backend := newTestWorkerBackend(t, chainConfig, engine, db, blocks)
backend.txPool.Add(pendingTxs, true, false)
w := newWorker(testConfig, chainConfig, engine, backend, new(event.TypeMux), nil, false, 1)
w := newWorker(testConfig, chainConfig, engine, backend, new(event.TypeMux), nil, false)
w.setEtherbase(testBankAddress)
return w, backend
}
Expand Down

0 comments on commit 3d2868f

Please sign in to comment.