Skip to content
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
11 changes: 11 additions & 0 deletions .github/workflows/gotestsum.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ tags=""
run=""
skip=""
test_state_scheme=""
test_database_engine=""
junitfile=""
log=true
race=false
Expand Down Expand Up @@ -49,6 +50,12 @@ while [[ $# -gt 0 ]]; do
test_state_scheme=$1
shift
;;
--test_database_engine)
shift
check_missing_value $# "$1" "--test_database_engine"
test_database_engine=$1
shift
;;
--race)
race=true
shift
Expand Down Expand Up @@ -130,6 +137,10 @@ else
cmd="$cmd -args -- --test_loglevel=8" # Use error log level, which is the value 8 in the slog level enum for tests.
fi

if [ "$test_database_engine" != "" ]; then
cmd="$cmd --test_database_engine=$test_database_engine"
fi

if [ "$log" == true ]; then
cmd="$cmd > >(stdbuf -oL tee -a full.log | grep -vE \"DEBUG|TRACE|INFO|seal\")"
else
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/nightly-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
strategy:
fail-fast: false
matrix:
test-mode: [legacychallenge, long, challenge, l3challenge, execution-spec-tests]
test-mode: [legacychallenge, long, challenge, l3challenge, execution-spec-tests, pebble]

steps:
- name: Checkout
Expand Down Expand Up @@ -85,6 +85,11 @@ jobs:
if: matrix.test-mode == 'execution-spec-tests'
run: ${{ github.workspace }}/.github/workflows/runExecutionSpecTests.sh

- name: run tests with pebble db
if: matrix.test-mode == 'pebble'
run: |
${{ github.workspace }}/.github/workflows/gotestsum.sh --timeout 90m --test_database_engine pebble

- name: Archive detailed run log
uses: actions/upload-artifact@v5
with:
Expand Down
2 changes: 2 additions & 0 deletions cmd/nitro/init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,7 @@ func TestOpenInitializeChainDbIncompatibleStateScheme(t *testing.T) {
defer cancel()

stackConfig := testhelpers.CreateStackConfigForTest(t.TempDir())
stackConfig.DBEngine = rawdb.DBPebble
stack, err := node.New(stackConfig)
Require(t, err)
defer stack.Close()
Expand Down Expand Up @@ -685,6 +686,7 @@ func TestOpenInitializeChainDbEmptyInit(t *testing.T) {
defer cancel()

stackConfig := testhelpers.CreateStackConfigForTest(t.TempDir())
stackConfig.DBEngine = rawdb.DBPebble
stack, err := node.New(stackConfig)
Require(t, err)
defer stack.Close()
Expand Down
4 changes: 2 additions & 2 deletions system_tests/archival_path_scheme_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
func TestAccessingPathSchemeState(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
builder := NewNodeBuilder(ctx).DefaultConfig(t, true)
builder := NewNodeBuilder(ctx).DefaultConfig(t, true).WithDatabase(rawdb.DBPebble)

// This test is PathScheme specific, it shouldn't be run with HashScheme
builder.RequireScheme(t, rawdb.PathScheme)
Expand Down Expand Up @@ -56,7 +56,7 @@ func TestAccessingPathSchemeState(t *testing.T) {
func TestAccessingPathSchemeArchivalState(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
builder := NewNodeBuilder(ctx).DefaultConfig(t, true)
builder := NewNodeBuilder(ctx).DefaultConfig(t, true).WithDatabase(rawdb.DBPebble)
builder.execConfig.Caching.Archive = true
builder.execConfig.Caching.StateHistory = 2

Expand Down
2 changes: 1 addition & 1 deletion system_tests/block_validator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
"github.com/offchainlabs/nitro/solgen/go/precompilesgen"
"github.com/offchainlabs/nitro/util/arbmath"
"github.com/offchainlabs/nitro/util/redisutil"
"github.com/offchainlabs/nitro/util/testhelpers/flag"
testflag "github.com/offchainlabs/nitro/util/testhelpers/flag"
"github.com/offchainlabs/nitro/util/testhelpers/github"
"github.com/offchainlabs/nitro/validator/client/redis"
)
Expand Down
7 changes: 5 additions & 2 deletions system_tests/bold_challenge_protocol_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@ func createTestNodeOnL1ForBoldProtocol(
nodeConfig.BatchPoster.DataPoster.MaxMempoolTransactions = 18
fatalErrChan := make(chan error, 10)
withoutClientWrapper := false
l1info, l1client, l1backend, l1stack, _, _ = createTestL1BlockChain(t, nil, withoutClientWrapper)
l1info, l1client, l1backend, l1stack, _, _ = createTestL1BlockChain(t, nil, withoutClientWrapper, testhelpers.CreateStackConfigForTest(""))
var l2chainDb ethdb.Database
var l2arbDb ethdb.Database
var l2blockchain *core.BlockChain
Expand Down Expand Up @@ -636,8 +636,10 @@ func createTestNodeOnL1ForBoldProtocol(

execConfig := ExecConfigDefaultNonSequencerTest(t, rawdb.HashScheme)
Require(t, execConfig.Validate())
stackConfig := testhelpers.CreateStackConfigForTest("")
stackConfig.DBEngine = rawdb.DBPebble
initMessage := getInitMessage(ctx, t, l1client, addresses)
_, l2stack, l2chainDb, l2arbDb, l2blockchain = createNonL1BlockChainWithStackConfig(t, l2info, "", chainConfig, nil, initMessage, nil, execConfig)
_, l2stack, l2chainDb, l2arbDb, l2blockchain = createNonL1BlockChainWithStackConfig(t, l2info, "", chainConfig, nil, initMessage, stackConfig, execConfig)
var sequencerTxOptsPtr *bind.TransactOpts
var dataSigner signature.DataSignerFunc
if isSequencer {
Expand Down Expand Up @@ -848,6 +850,7 @@ func create2ndNodeWithConfigForBoldProtocol(
nodeConfig.BatchPoster.DataPoster.MaxMempoolTransactions = 18
if stackConfig == nil {
stackConfig = testhelpers.CreateStackConfigForTest(t.TempDir())
stackConfig.DBEngine = rawdb.DBPebble
}
l2stack, err := node.New(stackConfig)
Require(t, err)
Expand Down
86 changes: 59 additions & 27 deletions system_tests/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ type NodeBuilder struct {
isSequencer bool
takeOwnership bool
withL1 bool
defaultDbScheme string
defaultStateScheme string
addresses *chaininfo.RollupAddresses
l3Addresses *chaininfo.RollupAddresses
initMessage *arbostypes.ParsedInitMessage
Expand Down Expand Up @@ -377,12 +377,27 @@ func (b *NodeBuilder) DefaultConfig(t *testing.T, withL1 bool) *NodeBuilder {
b.l2StackConfig = testhelpers.CreateStackConfigForTest(b.dataDir)
cp := valnode.TestValidationConfig
b.valnodeConfig = &cp
b.defaultDbScheme = rawdb.HashScheme
b.defaultStateScheme = rawdb.HashScheme
if *testflag.StateSchemeFlag == rawdb.PathScheme || *testflag.StateSchemeFlag == rawdb.HashScheme {
b.defaultDbScheme = *testflag.StateSchemeFlag
b.defaultStateScheme = *testflag.StateSchemeFlag
}
b.execConfig = ExecConfigDefaultTest(t, b.defaultDbScheme)
b.execConfig = ExecConfigDefaultTest(t, b.defaultStateScheme)
b.l3Config = L3NitroConfigDefaultTest(t)

return b
}

// Overrides the database selected with `--test_database_engine` flag
//
// Useful if the test needs a specific database engine to be used
func (b *NodeBuilder) WithDatabase(database string) *NodeBuilder {
if database != env.MemoryDB && database != rawdb.DBPebble && database != rawdb.DBLeveldb {
panic("unknown database engine: " + database)
}

b.l1StackConfig.DBEngine = database
b.l2StackConfig.DBEngine = database
b.l3Config.stackConfig.DBEngine = database
return b
}

Expand Down Expand Up @@ -435,19 +450,19 @@ func (b *NodeBuilder) RequireScheme(t *testing.T, scheme string) *NodeBuilder {
if testflag.StateSchemeFlag != nil && *testflag.StateSchemeFlag != "" && *testflag.StateSchemeFlag != scheme {
t.Skip("skipping because db scheme is set and not ", scheme)
}
if b.defaultDbScheme != scheme && b.execConfig != nil {
if b.defaultStateScheme != scheme && b.execConfig != nil {
b.execConfig.Caching.StateScheme = scheme
Require(t, b.execConfig.Validate())
}
b.defaultDbScheme = scheme
b.defaultStateScheme = scheme
return b
}

func (b *NodeBuilder) ExecConfigDefaultTest(t *testing.T, sequencer bool) *gethexec.Config {
if sequencer {
ExecConfigDefaultTest(t, b.defaultDbScheme)
ExecConfigDefaultTest(t, b.defaultStateScheme)
}
return ExecConfigDefaultNonSequencerTest(t, b.defaultDbScheme)
return ExecConfigDefaultNonSequencerTest(t, b.defaultStateScheme)
}

// WithL1ClientWrapper creates a ClientWrapper for the L1 RPC client before passing it to the L2 node.
Expand Down Expand Up @@ -584,8 +599,8 @@ func (b *NodeBuilder) CheckConfig(t *testing.T) {
// validation currently requires hash
b.RequireScheme(t, rawdb.HashScheme)
}
if b.defaultDbScheme == "" {
b.defaultDbScheme = env.GetTestStateScheme()
if b.defaultStateScheme == "" {
b.defaultStateScheme = env.GetTestStateScheme()
}
if b.execConfig == nil {
b.execConfig = b.ExecConfigDefaultTest(t, true)
Expand Down Expand Up @@ -615,7 +630,7 @@ func (b *NodeBuilder) BuildL1(t *testing.T) {
t.Fatal(err)
}
b.L1 = NewTestClient(b.ctx)
b.L1Info, b.L1.Client, b.L1.L1Backend, b.L1.Stack, b.L1.ClientWrapper, b.L1.L1BlobReader = createTestL1BlockChain(t, b.L1Info, b.withL1ClientWrapper)
b.L1Info, b.L1.Client, b.L1.L1Backend, b.L1.Stack, b.L1.ClientWrapper, b.L1.L1BlobReader = createTestL1BlockChain(t, b.L1Info, b.withL1ClientWrapper, b.l1StackConfig)
locator, err := server_common.NewMachineLocator(b.valnodeConfig.Wasm.RootPath)
Require(t, err)
b.addresses, b.initMessage = deployOnParentChain(
Expand Down Expand Up @@ -1399,7 +1414,7 @@ func createTestValidationNode(t *testing.T, ctx context.Context, config *valnode
stackConf.WSModules = []string{server_api.Namespace}
stackConf.P2P.NoDiscovery = true
stackConf.P2P.ListenAddr = ""
stackConf.DBEngine = "leveldb" // TODO Try pebble again in future once iterator race condition issues are fixed
stackConf.DBEngine = env.GetTestDatabaseEngine()

valnode.EnsureValidationExposedViaAuthRPC(&stackConf)

Expand Down Expand Up @@ -1484,11 +1499,10 @@ func AddValNode(t *testing.T, ctx context.Context, nodeConfig *arbnode.Config, u
configByValidationNode(nodeConfig, valStack)
}

func createTestL1BlockChain(t *testing.T, l1info info, withClientWrapper bool) (info, *ethclient.Client, *eth.Ethereum, *node.Node, *ClientWrapper, daprovider.BlobReader) {
func createTestL1BlockChain(t *testing.T, l1info info, withClientWrapper bool, stackConfig *node.Config) (info, *ethclient.Client, *eth.Ethereum, *node.Node, *ClientWrapper, daprovider.BlobReader) {
if l1info == nil {
l1info = NewL1TestInfo(t)
}
stackConfig := testhelpers.CreateStackConfigForTest("")
l1info.GenerateAccount("Faucet")
for _, acct := range DefaultChainAccounts {
l1info.GenerateAccount(acct)
Expand All @@ -1497,6 +1511,7 @@ func createTestL1BlockChain(t *testing.T, l1info info, withClientWrapper bool) (
chainConfig := chaininfo.ArbitrumDevTestChainConfig()
chainConfig.ArbitrumChainParams = params.ArbitrumChainParams{}

stackConfig.DataDir = ""
stack, err := node.New(stackConfig)
Require(t, err)

Expand Down Expand Up @@ -1738,15 +1753,23 @@ func createNonL1BlockChainWithStackConfig(
stack, err := node.New(stackConfig)
Require(t, err)

chainData, err := stack.OpenDatabaseWithOptions("l2chaindata", node.DatabaseOptions{MetricsNamespace: "l2chaindata/", PebbleExtraOptions: conf.PersistentConfigDefault.Pebble.ExtraOptions("l2chaindata")})
Require(t, err)

wasmData, err := stack.OpenDatabaseWithOptions("wasm", node.DatabaseOptions{MetricsNamespace: "wasm/", PebbleExtraOptions: conf.PersistentConfigDefault.Pebble.ExtraOptions("wasm"), NoFreezer: true})
Require(t, err)
chainData := rawdb.NewMemoryDatabase()
if stack.Config().DBEngine != env.MemoryDB {
chainData, err = stack.OpenDatabaseWithOptions("l2chaindata", node.DatabaseOptions{MetricsNamespace: "l2chaindata/", PebbleExtraOptions: conf.PersistentConfigDefault.Pebble.ExtraOptions("l2chaindata")})
Require(t, err)
}
wasmData := rawdb.NewMemoryDatabase()
if stack.Config().DBEngine != env.MemoryDB {
wasmData, err = stack.OpenDatabaseWithOptions("wasm", node.DatabaseOptions{MetricsNamespace: "wasm/", PebbleExtraOptions: conf.PersistentConfigDefault.Pebble.ExtraOptions("wasm"), NoFreezer: true})
Require(t, err)
}

chainDb := rawdb.WrapDatabaseWithWasm(chainData, wasmData)
arbDb, err := stack.OpenDatabaseWithOptions("arbitrumdata", node.DatabaseOptions{MetricsNamespace: "arbitrumdata/", PebbleExtraOptions: conf.PersistentConfigDefault.Pebble.ExtraOptions("arbitrumdata"), NoFreezer: true})
Require(t, err)
arbDb := rawdb.NewMemoryDatabase()
if stack.Config().DBEngine != env.MemoryDB {
arbDb, err = stack.OpenDatabaseWithOptions("arbitrumdata", node.DatabaseOptions{MetricsNamespace: "arbitrumdata/", PebbleExtraOptions: conf.PersistentConfigDefault.Pebble.ExtraOptions("arbitrumdata"), NoFreezer: true})
Require(t, err)
}

initReader := statetransfer.NewMemoryInitDataReader(&info.ArbInitData)
if initMessage == nil {
Expand Down Expand Up @@ -1836,14 +1859,23 @@ func Create2ndNodeWithConfig(
chainStack, err := node.New(stackConfig)
Require(t, err)

chainData, err := chainStack.OpenDatabaseWithOptions("l2chaindata", node.DatabaseOptions{MetricsNamespace: "l2chaindata/", PebbleExtraOptions: conf.PersistentConfigDefault.Pebble.ExtraOptions("l2chaindata")})
Require(t, err)
wasmData, err := chainStack.OpenDatabaseWithOptions("wasm", node.DatabaseOptions{MetricsNamespace: "wasm/", PebbleExtraOptions: conf.PersistentConfigDefault.Pebble.ExtraOptions("wasm"), NoFreezer: true})
Require(t, err)
chainData := rawdb.NewMemoryDatabase()
if chainStack.Config().DBEngine != env.MemoryDB {
chainData, err = chainStack.OpenDatabaseWithOptions("l2chaindata", node.DatabaseOptions{MetricsNamespace: "l2chaindata/", PebbleExtraOptions: conf.PersistentConfigDefault.Pebble.ExtraOptions("l2chaindata")})
Require(t, err)
}
wasmData := rawdb.NewMemoryDatabase()
if chainStack.Config().DBEngine != env.MemoryDB {
wasmData, err = chainStack.OpenDatabaseWithOptions("wasm", node.DatabaseOptions{MetricsNamespace: "wasm/", PebbleExtraOptions: conf.PersistentConfigDefault.Pebble.ExtraOptions("wasm"), NoFreezer: true})
Require(t, err)
}
chainDb := rawdb.WrapDatabaseWithWasm(chainData, wasmData)

arbDb, err := chainStack.OpenDatabaseWithOptions("arbitrumdata", node.DatabaseOptions{MetricsNamespace: "arbitrumdata/", PebbleExtraOptions: conf.PersistentConfigDefault.Pebble.ExtraOptions("arbitrumdata"), NoFreezer: true})
Require(t, err)
arbDb := rawdb.NewMemoryDatabase()
if chainStack.Config().DBEngine != env.MemoryDB {
arbDb, err = chainStack.OpenDatabaseWithOptions("arbitrumdata", node.DatabaseOptions{MetricsNamespace: "arbitrumdata/", PebbleExtraOptions: conf.PersistentConfigDefault.Pebble.ExtraOptions("arbitrumdata"), NoFreezer: true})
Require(t, err)
}
initReader := statetransfer.NewMemoryInitDataReader(chainInitData)

dataSigner := signature.DataSignerFromPrivateKey(parentChainInfo.GetInfoWithPrivKey("Sequencer").PrivateKey)
Expand Down
5 changes: 3 additions & 2 deletions system_tests/fees_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (

"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/params"

Expand All @@ -33,7 +34,7 @@ func TestSequencerFeePaid(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()

builder := NewNodeBuilder(ctx).DefaultConfig(t, true)
builder := NewNodeBuilder(ctx).DefaultConfig(t, true).WithDatabase(rawdb.DBPebble)
cleanup := builder.Build(t)
defer cleanup()

Expand Down Expand Up @@ -135,7 +136,7 @@ func testSequencerPriceAdjustsFrom(t *testing.T, initialEstimate uint64) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()

builder := NewNodeBuilder(ctx).DefaultConfig(t, true)
builder := NewNodeBuilder(ctx).DefaultConfig(t, true).WithDatabase(rawdb.DBPebble)
builder.nodeConfig.DelayedSequencer.FinalizeDistance = 1
cleanup := builder.Build(t)
defer cleanup()
Expand Down
2 changes: 1 addition & 1 deletion system_tests/finality_data_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func TestFinalizedBlocksMovedToAncients(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()

builder := NewNodeBuilder(ctx).DefaultConfig(t, true)
builder := NewNodeBuilder(ctx).DefaultConfig(t, true).WithDatabase(rawdb.DBPebble)
// The procedure that periodically pushes finality data, from consensus to execution,
// will not be able to get finalized/safe block numbers since UseFinalityData is false.
// Therefore, with UseFinalityData set to false, ExecutionEngine will not be able to move data to ancients by itself,
Expand Down
3 changes: 2 additions & 1 deletion system_tests/forwarder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (

"github.com/alicebob/miniredis/v2"

"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/ethclient"

"github.com/offchainlabs/nitro/arbnode"
Expand Down Expand Up @@ -299,7 +300,7 @@ func TestRedisForwarderFallbackNoRedis(t *testing.T) {
ipcPath: fallbackIpcPath,
redisUrl: redisUrl,
enableSecCoordinator: false,
})
}).WithDatabase(rawdb.DBPebble)
cleanup := builder.Build(t)
defer cleanup()
fallbackClient := builder.L2.Client
Expand Down
4 changes: 3 additions & 1 deletion system_tests/multigas_dump_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import (
"testing"

"github.com/stretchr/testify/require"

"github.com/ethereum/go-ethereum/core/rawdb"
)

// TestMultigasDataFromReceipts spins up an L2 node with ancd checks if multigas data is present in receipts
Expand Down Expand Up @@ -44,7 +46,7 @@ func TestMultigasDataCanBeDisabled(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()

builder := NewNodeBuilder(ctx).DefaultConfig(t, false)
builder := NewNodeBuilder(ctx).DefaultConfig(t, false).WithDatabase(rawdb.DBPebble)
builder.execConfig.ExposeMultiGas = false
cleanup := builder.Build(t)
defer cleanup()
Expand Down
3 changes: 2 additions & 1 deletion system_tests/program_gas_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (

"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/eth/tracers/logger"
Expand Down Expand Up @@ -275,7 +276,7 @@ func TestProgramKeccakCost(t *testing.T) {
func setupGasCostTest(t *testing.T) *NodeBuilder {
ctx, cancel := context.WithCancel(context.Background())
t.Cleanup(cancel)
builder := NewNodeBuilder(ctx).DefaultConfig(t, true)
builder := NewNodeBuilder(ctx).DefaultConfig(t, true).WithDatabase(rawdb.DBPebble)
cleanup := builder.Build(t)
t.Cleanup(cleanup)
return builder
Expand Down
Loading
Loading