Skip to content

Commit

Permalink
Merge branch 'master' into update-gethpin-v1.14.4
Browse files Browse the repository at this point in the history
  • Loading branch information
eljobe authored Feb 6, 2025
2 parents 2150e38 + ec766f4 commit 27084bb
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 22 deletions.
2 changes: 1 addition & 1 deletion arbnode/inbox_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func NewTransactionStreamerForTest(t *testing.T, ownerAddress common.Address) (*
}

transactionStreamerConfigFetcher := func() *TransactionStreamerConfig { return &DefaultTransactionStreamerConfig }
execEngine, err := gethexec.NewExecutionEngine(bc, false)
execEngine, err := gethexec.NewExecutionEngine(bc)
if err != nil {
Fail(t, err)
}
Expand Down
22 changes: 6 additions & 16 deletions execution/gethexec/executionengine.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,6 @@ type ExecutionEngine struct {
prefetchBlock bool

cachedL1PriceData *L1PriceData

isTimeboostEnabled bool
}

func NewL1PriceData() *L1PriceData {
Expand All @@ -109,13 +107,12 @@ func NewL1PriceData() *L1PriceData {
}
}

func NewExecutionEngine(bc *core.BlockChain, isTimeboostEnabled bool) (*ExecutionEngine, error) {
func NewExecutionEngine(bc *core.BlockChain) (*ExecutionEngine, error) {
return &ExecutionEngine{
bc: bc,
resequenceChan: make(chan []*arbostypes.MessageWithMetadata),
newBlockNotifier: make(chan struct{}, 1),
cachedL1PriceData: NewL1PriceData(),
isTimeboostEnabled: isTimeboostEnabled,
bc: bc,
resequenceChan: make(chan []*arbostypes.MessageWithMetadata),
newBlockNotifier: make(chan struct{}, 1),
cachedL1PriceData: NewL1PriceData(),
}, nil
}

Expand Down Expand Up @@ -621,9 +618,6 @@ func (s *ExecutionEngine) sequenceTransactionsWithBlockMutex(header *arbostypes.
// blockMetadata[index / 8 + 1] & (1 << (index % 8)) != 0; where index = (N - 1), implies whether (N)th tx in a block is timeboosted
// note that number of txs in a block will always lag behind (len(blockMetadata) - 1) * 8 but it wont lag more than a value of 7
func (s *ExecutionEngine) blockMetadataFromBlock(block *types.Block, timeboostedTxs map[common.Hash]struct{}) common.BlockMetadata {
if timeboostedTxs == nil {
return nil
}
bits := make(common.BlockMetadata, 1+arbmath.DivCeil(uint64(len(block.Transactions())), 8))
if len(timeboostedTxs) == 0 {
return bits
Expand Down Expand Up @@ -678,11 +672,7 @@ func (s *ExecutionEngine) sequenceDelayedMessageWithBlockMutex(message *arbostyp
return nil, err
}

var blockMetadata common.BlockMetadata
if s.isTimeboostEnabled {
blockMetadata = s.blockMetadataFromBlock(block, make(map[common.Hash]struct{}))
}
err = s.consensus.WriteMessageFromSequencer(pos, messageWithMeta, *msgResult, blockMetadata)
err = s.consensus.WriteMessageFromSequencer(pos, messageWithMeta, *msgResult, s.blockMetadataFromBlock(block, nil))
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion execution/gethexec/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ func CreateExecutionNode(
configFetcher ConfigFetcher,
) (*ExecutionNode, error) {
config := configFetcher()
execEngine, err := NewExecutionEngine(l2BlockChain, config.Sequencer.Dangerous.Timeboost.Enable)
execEngine, err := NewExecutionEngine(l2BlockChain)
if config.EnablePrefetchBlock {
execEngine.EnablePrefetchBlock()
}
Expand Down
5 changes: 1 addition & 4 deletions execution/gethexec/sequencer.go
Original file line number Diff line number Diff line change
Expand Up @@ -1106,10 +1106,7 @@ func (s *Sequencer) createBlock(ctx context.Context) (returnValue bool) {
s.nonceCache.BeginNewBlock()
queueItems = s.precheckNonces(queueItems, totalBlockSize)
txes := make([]*types.Transaction, len(queueItems))
var timeboostedTxs map[common.Hash]struct{}
if config.Dangerous.Timeboost.Enable {
timeboostedTxs = make(map[common.Hash]struct{})
}
timeboostedTxs := make(map[common.Hash]struct{})
hooks := s.makeSequencingHooks()
hooks.ConditionalOptionsForTx = make([]*arbitrum_types.ConditionalOptions, len(queueItems))
totalBlockSize = 0 // recompute the totalBlockSize to double check it
Expand Down
16 changes: 16 additions & 0 deletions system_tests/timeboost_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,22 @@ func TestTimeboostedFieldInReceiptsObject(t *testing.T) {
Require(t, err)
colors.PrintGrey("receipt object- ", string(receiptResultRaw))

builder.L2.TransferBalanceTo(t, "Owner", util.RemapL1Address(user.From), big.NewInt(1e18), builder.L2Info)
latestL2, err = builder.L2.Client.BlockNumber(ctx)
Require(t, err)
var receiptWithoutTimeboostEnabled []timeboostedFromReceipt
// #nosec G115
err = l2rpc.CallContext(ctx, &receiptWithoutTimeboostEnabled, "eth_getBlockReceipts", rpc.BlockNumber(latestL2))
Require(t, err)
if len(receiptWithoutTimeboostEnabled) != 2 {
t.Fatalf("expecting two tx receipts got: %d", len(receiptWithoutTimeboostEnabled))
}
if receiptWithoutTimeboostEnabled[0].Timeboosted == nil || *receiptWithoutTimeboostEnabled[0].Timeboosted {
t.Fatal("timeboosted field should exist in the receipt object of all the txs and it should be false")
}
if receiptWithoutTimeboostEnabled[1].Timeboosted == nil || *receiptWithoutTimeboostEnabled[1].Timeboosted {
t.Fatal("timeboosted field should exist in the receipt object of all the txs and it should be false")
}
}

func TestTimeboostBulkBlockMetadataAPI(t *testing.T) {
Expand Down
4 changes: 4 additions & 0 deletions timeboost/redis_coordinator.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ func (rc *RedisCoordinator) GetAcceptedTxs(round, startSeqNum, endSeqNum uint64)
ctx := rc.GetContext()
fetchMsg := func(key string) *ExpressLaneSubmission {
msgBytes, err := rc.client.Get(ctx, key).Bytes()
if errors.Is(err, redis.Nil) {
log.Debug("ExpressLane tx not found in redis", "key", key, "err", err)
return nil
}
if err != nil {
log.Error("Error fetching accepted expressLane tx", "key", key, "err", err)
return nil
Expand Down

0 comments on commit 27084bb

Please sign in to comment.