Skip to content

Commit

Permalink
Merge branch 'master' into cache-feedback-bold
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuacolvin0 authored Jul 16, 2024
2 parents 86d35f5 + ec4fdd0 commit c24796d
Show file tree
Hide file tree
Showing 14 changed files with 375 additions and 407 deletions.
2 changes: 1 addition & 1 deletion arbnode/sequencer_inbox.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ func (i *SequencerInbox) LookupBatchesInRange(ctx context.Context, from, to *big
seqNum := parsedLog.BatchSequenceNumber.Uint64()
if lastSeqNum != nil {
if seqNum != *lastSeqNum+1 {
return nil, fmt.Errorf("sequencer batches out of order; after batch %v got batch %v", lastSeqNum, seqNum)
return nil, fmt.Errorf("sequencer batches out of order; after batch %v got batch %v", *lastSeqNum, seqNum)
}
}
lastSeqNum = &seqNum
Expand Down
4 changes: 2 additions & 2 deletions execution/gethexec/sequencer.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ var (
nonceFailureCacheOverflowCounter = metrics.NewRegisteredGauge("arb/sequencer/noncefailurecache/overflow", nil)
blockCreationTimer = metrics.NewRegisteredTimer("arb/sequencer/block/creation", nil)
successfulBlocksCounter = metrics.NewRegisteredCounter("arb/sequencer/block/successful", nil)
conditionalTxRejectedBySequencerCounter = metrics.NewRegisteredCounter("arb/sequencer/condtionaltx/rejected", nil)
conditionalTxAcceptedBySequencerCounter = metrics.NewRegisteredCounter("arb/sequencer/condtionaltx/accepted", nil)
conditionalTxRejectedBySequencerCounter = metrics.NewRegisteredCounter("arb/sequencer/conditionaltx/rejected", nil)
conditionalTxAcceptedBySequencerCounter = metrics.NewRegisteredCounter("arb/sequencer/conditionaltx/accepted", nil)
l1GasPriceGauge = metrics.NewRegisteredGauge("arb/sequencer/l1gasprice", nil)
callDataUnitsBacklogGauge = metrics.NewRegisteredGauge("arb/sequencer/calldataunitsbacklog", nil)
unusedL1GasChargeGauge = metrics.NewRegisteredGauge("arb/sequencer/unusedl1gascharge", nil)
Expand Down
8 changes: 4 additions & 4 deletions execution/gethexec/tx_pre_checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ import (
)

var (
conditionalTxRejectedByTxPreCheckerCurrentStateCounter = metrics.NewRegisteredCounter("arb/txprechecker/condtionaltx/currentstate/rejected", nil)
conditionalTxAcceptedByTxPreCheckerCurrentStateCounter = metrics.NewRegisteredCounter("arb/txprechecker/condtionaltx/currentstate/accepted", nil)
conditionalTxRejectedByTxPreCheckerOldStateCounter = metrics.NewRegisteredCounter("arb/txprechecker/condtionaltx/oldstate/rejected", nil)
conditionalTxAcceptedByTxPreCheckerOldStateCounter = metrics.NewRegisteredCounter("arb/txprechecker/condtionaltx/oldstate/accepted", nil)
conditionalTxRejectedByTxPreCheckerCurrentStateCounter = metrics.NewRegisteredCounter("arb/txprechecker/conditionaltx/currentstate/rejected", nil)
conditionalTxAcceptedByTxPreCheckerCurrentStateCounter = metrics.NewRegisteredCounter("arb/txprechecker/conditionaltx/currentstate/accepted", nil)
conditionalTxRejectedByTxPreCheckerOldStateCounter = metrics.NewRegisteredCounter("arb/txprechecker/conditionaltx/oldstate/rejected", nil)
conditionalTxAcceptedByTxPreCheckerOldStateCounter = metrics.NewRegisteredCounter("arb/txprechecker/conditionaltx/oldstate/accepted", nil)
)

const TxPreCheckerStrictnessNone uint = 0
Expand Down
42 changes: 11 additions & 31 deletions system_tests/blocks_reexecutor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,29 @@ package arbtest

import (
"context"
"math/big"
"testing"

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/params"
"github.com/offchainlabs/nitro/arbnode"
blocksreexecutor "github.com/offchainlabs/nitro/blocks_reexecutor"
"github.com/offchainlabs/nitro/execution/gethexec"
)

func TestBlocksReExecutorModes(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()

execConfig := gethexec.ConfigDefaultTest()
Require(t, execConfig.Validate())
l2info, stack, chainDb, arbDb, blockchain := createL2BlockChain(t, nil, t.TempDir(), params.ArbitrumDevTestChainConfig(), &execConfig.Caching)
builder := NewNodeBuilder(ctx).DefaultConfig(t, false)
cleanup := builder.Build(t)
defer cleanup()

execConfigFetcher := func() *gethexec.Config { return execConfig }
execNode, err := gethexec.CreateExecutionNode(ctx, stack, chainDb, blockchain, nil, execConfigFetcher)
Require(t, err)

parentChainID := big.NewInt(1234)
l2info := builder.L2Info
client := builder.L2.Client
blockchain := builder.L2.ExecNode.Backend.ArbInterface().BlockChain()
feedErrChan := make(chan error, 10)
node, err := arbnode.CreateNode(ctx, stack, execNode, arbDb, NewFetcherFromConfig(arbnode.ConfigDefaultL2Test()), blockchain.Config(), nil, nil, nil, nil, nil, feedErrChan, parentChainID, nil)
Require(t, err)
err = node.TxStreamer.AddFakeInitMessage()
Require(t, err)
Require(t, node.Start(ctx))
client := ClientForStack(t, stack)

l2info.GenerateAccount("User2")
for i := 0; i < 100; i++ {
genesis, err := client.BlockNumber(ctx)
Require(t, err)
for i := genesis; i < genesis+100; i++ {
tx := l2info.PrepareTx("Owner", "User2", l2info.TransferGas, common.Big1, nil)
err := client.SendTransaction(ctx, tx)
Require(t, err)
Expand All @@ -49,14 +39,9 @@ func TestBlocksReExecutorModes(t *testing.T) {
success := make(chan struct{})
executorFull := blocksreexecutor.New(&blocksreexecutor.TestConfig, blockchain, feedErrChan)
executorFull.Start(ctx, success)

select {
case err := <-feedErrChan:
t.Errorf("error occurred: %v", err)
if node != nil {
node.StopAndWait()
}
t.FailNow()
t.Fatalf("error occurred: %v", err)
case <-success:
}

Expand All @@ -66,14 +51,9 @@ func TestBlocksReExecutorModes(t *testing.T) {
c.Mode = "random"
executorRandom := blocksreexecutor.New(c, blockchain, feedErrChan)
executorRandom.Start(ctx, success)

select {
case err := <-feedErrChan:
t.Errorf("error occurred: %v", err)
if node != nil {
node.StopAndWait()
}
t.FailNow()
t.Fatalf("error occurred: %v", err)
case <-success:
}
}
Loading

0 comments on commit c24796d

Please sign in to comment.