Skip to content

Commit

Permalink
Merge branch 'master' into cache-storage-keys
Browse files Browse the repository at this point in the history
  • Loading branch information
magicxyyz committed Oct 13, 2023
2 parents 41b9517 + 0b527c2 commit e5fb851
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 3 deletions.
3 changes: 2 additions & 1 deletion cmd/nitro/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"fmt"
"math/big"
"os"
"reflect"
"regexp"
"runtime"
"strings"
Expand Down Expand Up @@ -296,7 +297,7 @@ func findImportantRoots(ctx context.Context, chainDb ethdb.Database, stack *node
return nil, err
}
if initConfig.Prune == "validator" {
if l1Client == nil {
if l1Client == nil || reflect.ValueOf(l1Client).IsNil() {
return nil, errors.New("an L1 connection is required for validator pruning")
}
callOpts := bind.CallOpts{
Expand Down
5 changes: 4 additions & 1 deletion cmd/nitro/nitro.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@ import (
)

func printSampleUsage(name string) {
fmt.Printf("Sample usage: %s --help \n", name)
fmt.Printf("Sample usage: %s [OPTIONS] \n\n", name)
fmt.Printf("Options:\n")
fmt.Printf(" --help\n")
fmt.Printf(" --dev: Start a default L2-only dev chain\n")
}

func addUnlockWallet(accountManager *accounts.Manager, walletConf *genericconf.WalletConfig) (common.Address, error) {
Expand Down
22 changes: 22 additions & 0 deletions cmd/util/confighelpers/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,32 @@ func PrintErrorAndExit(err error, usage func(string)) {
}
}

func devFlagArgs() []string {
args := []string{
"--init.dev-init",
"--init.dev-init-address", "0x3f1Eae7D46d88F08fc2F8ed27FCb2AB183EB2d0E",
"--node.dangerous.no-l1-listener",
"--node.parent-chain-reader.enable=false",
"--parent-chain.id=1337",
"--chain.id=412346",
"--persistent.chain", "/tmp/dev-test",
"--node.sequencer",
"--node.dangerous.no-sequencer-coordinator",
"--node.staker.enable=false",
"--init.empty=false",
"--http.port", "8547",
"--http.addr", "127.0.0.1",
}
return args
}

func BeginCommonParse(f *flag.FlagSet, args []string) (*koanf.Koanf, error) {
for _, arg := range args {
if arg == "--version" || arg == "-v" {
return nil, ErrVersion
} else if arg == "--dev" {
args = devFlagArgs()
break
}
}
if err := f.Parse(args); err != nil {
Expand Down
3 changes: 2 additions & 1 deletion execution/gethexec/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"errors"
"fmt"
"reflect"
"sync/atomic"
"testing"

Expand Down Expand Up @@ -149,7 +150,7 @@ func CreateExecutionNode(
var sequencer *Sequencer

var parentChainReader *headerreader.HeaderReader
if l1client != nil {
if l1client != nil && !reflect.ValueOf(l1client).IsNil() {
arbSys, _ := precompilesgen.NewArbSys(types.ArbSysAddress, l1client)
parentChainReader, err = headerreader.New(ctx, l1client, func() *headerreader.Config { return &configFetcher().ParentChainReader }, arbSys)
if err != nil {
Expand Down

0 comments on commit e5fb851

Please sign in to comment.