Skip to content

Commit

Permalink
Use SimulatedBeacon for test L1s
Browse files Browse the repository at this point in the history
v1.12.1 geth changes the default ChainConfig returned with
DeveloperGenesisBlock from AllCliqueProtocolChanges to
AllDevChainProtocolChanges. Since the dev chain config is not set to
clique mode and is set as post-TTD with TTD=0, there needs to be a
non-ethhash based consensus engine running in order for blocks to be
produced. See the upstream geth change here:
ethereum/go-ethereum#27327

This commit copies the initailization code for how geth is started up
in dev mode with the simulated beacon node to our test L1 setup code.
It also enables FullSync mode on the L1, since otherwise
SimluatedBeacon.sealBlock would fail when calling the
ConsensusAPI.ForkChoiceUpdatedV2 as it would still be syncing if it was
in SnapSync mode. UseMergeFinality was also disabled on the
TestDelayedSequencerConfig since the SimulatedBeacon seems to have
different finalization behavior.
  • Loading branch information
Tristan-Wilson committed Oct 4, 2023
1 parent 0073aa2 commit c6b5153
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion arbnode/delayed_sequencer.go
Expand Up @@ -60,7 +60,7 @@ var TestDelayedSequencerConfig = DelayedSequencerConfig{
Enable: true,
FinalizeDistance: 20,
RequireFullFinality: false,
UseMergeFinality: true,
UseMergeFinality: false,
}

func NewDelayedSequencer(l1Reader *headerreader.HeaderReader, reader *InboxReader, exec *execution.ExecutionEngine, coordinator *SeqCoordinator, config DelayedSequencerConfigFetcher) (*DelayedSequencer, error) {
Expand Down
2 changes: 1 addition & 1 deletion go-ethereum
Submodule go-ethereum updated 459 files
9 changes: 9 additions & 0 deletions system_tests/common_test.go
Expand Up @@ -37,6 +37,8 @@ import (
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/eth/catalyst"
"github.com/ethereum/go-ethereum/eth/downloader"
"github.com/ethereum/go-ethereum/eth/ethconfig"
"github.com/ethereum/go-ethereum/eth/filters"
"github.com/ethereum/go-ethereum/ethclient"
Expand Down Expand Up @@ -412,9 +414,16 @@ func createTestL1BlockChainWithConfig(t *testing.T, l1info info, stackConfig *no
l1Genesis.BaseFee = big.NewInt(50 * params.GWei)
nodeConf.Genesis = l1Genesis
nodeConf.Miner.Etherbase = l1info.GetAddress("Faucet")
nodeConf.SyncMode = downloader.FullSync

l1backend, err := eth.New(stack, &nodeConf)
Require(t, err)

simBeacon, err := catalyst.NewSimulatedBeacon(0, l1backend)
Require(t, err)
catalyst.RegisterSimulatedBeaconAPIs(stack, simBeacon)
stack.RegisterLifecycle(simBeacon)

tempKeyStore := keystore.NewPlaintextKeyStore(t.TempDir())
faucetAccount, err := tempKeyStore.ImportECDSA(l1info.Accounts["Faucet"].PrivateKey, "passphrase")
Require(t, err)
Expand Down
2 changes: 0 additions & 2 deletions system_tests/retryable_test.go
Expand Up @@ -15,7 +15,6 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/params"
"github.com/offchainlabs/nitro/arbnode"
"github.com/offchainlabs/nitro/arbos"
Expand All @@ -30,7 +29,6 @@ import (
"github.com/offchainlabs/nitro/solgen/go/precompilesgen"
"github.com/offchainlabs/nitro/util/arbmath"
"github.com/offchainlabs/nitro/util/colors"
"github.com/offchainlabs/nitro/util/testhelpers"
)

func retryableSetup(t *testing.T) (
Expand Down
2 changes: 1 addition & 1 deletion system_tests/wrap_transaction_test.go
Expand Up @@ -79,7 +79,7 @@ func EnsureTxSucceeded(ctx context.Context, client arbutil.L1Interface, tx *type
func EnsureTxSucceededWithTimeout(ctx context.Context, client arbutil.L1Interface, tx *types.Transaction, timeout time.Duration) (*types.Receipt, error) {
txRes, err := WaitForTx(ctx, client, tx.Hash(), timeout)
if err != nil {
return nil, fmt.Errorf("waitFoxTx got: %w", err)
return nil, fmt.Errorf("waitFoxTx (tx=%s) got: %w", tx.Hash().Hex(), err)
}
return txRes, arbutil.DetailTxError(ctx, client, tx, txRes)
}
Expand Down

0 comments on commit c6b5153

Please sign in to comment.