diff --git a/arbnode/node.go b/arbnode/node.go index c12b3a71ce..b0ee6ea6dd 100644 --- a/arbnode/node.go +++ b/arbnode/node.go @@ -291,7 +291,7 @@ func deployRollupCreator(ctx context.Context, l1Reader *headerreader.HeaderReade return rollupCreator, rollupCreatorAddress, validatorUtils, validatorWalletCreator, nil } -func DeployOnL1(ctx context.Context, l1client arbutil.L1Interface, deployAuth *bind.TransactOpts, sequencer common.Address, authorizeValidators uint64, wasmModuleRoot common.Hash, chainId *big.Int, readerConfig headerreader.Config, machineConfig validator.NitroMachineConfig) (*RollupAddresses, error) { +func DeployOnL1(ctx context.Context, l1client arbutil.L1Interface, deployAuth *bind.TransactOpts, sequencer, rollupOwner common.Address, authorizeValidators uint64, wasmModuleRoot common.Hash, chainId *big.Int, readerConfig headerreader.Config, machineConfig validator.NitroMachineConfig) (*RollupAddresses, error) { l1Reader := headerreader.New(l1client, readerConfig) l1Reader.Start(ctx) defer l1Reader.StopAndWait() @@ -330,7 +330,7 @@ func DeployOnL1(ctx context.Context, l1client arbutil.L1Interface, deployAuth *b StakeToken: common.Address{}, BaseStake: big.NewInt(params.Ether), WasmModuleRoot: wasmModuleRoot, - Owner: deployAuth.From, + Owner: rollupOwner, LoserStakeEscrow: common.Address{}, ChainId: chainId, SequencerInboxMaxTimeVariation: seqInboxParams, @@ -353,10 +353,14 @@ func DeployOnL1(ctx context.Context, l1client arbutil.L1Interface, deployAuth *b if err != nil { return nil, fmt.Errorf("error getting sequencer inbox: %w", err) } - tx, err = sequencerInbox.SetIsBatchPoster(deployAuth, sequencer, true) - err = andTxSucceeded(ctx, l1Reader, tx, err) - if err != nil { - return nil, fmt.Errorf("error setting is batch poster: %w", err) + + // if a zero sequencer address is specified, don't authorize any sequencers + if sequencer != (common.Address{}) { + tx, err = sequencerInbox.SetIsBatchPoster(deployAuth, sequencer, true) + err = andTxSucceeded(ctx, l1Reader, tx, err) + if err != nil { + return nil, fmt.Errorf("error setting is batch poster: %w", err) + } } var allowValidators []bool diff --git a/arbnode/sequencer.go b/arbnode/sequencer.go index dd42231e7d..89edd22935 100644 --- a/arbnode/sequencer.go +++ b/arbnode/sequencer.go @@ -6,12 +6,13 @@ package arbnode import ( "context" "fmt" - "github.com/offchainlabs/nitro/util/headerreader" "math" "sync" "sync/atomic" "time" + "github.com/offchainlabs/nitro/util/headerreader" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/core/types" diff --git a/cmd/deploy/deploy.go b/cmd/deploy/deploy.go index ce88322a78..adfee47f48 100644 --- a/cmd/deploy/deploy.go +++ b/cmd/deploy/deploy.go @@ -35,6 +35,8 @@ func main() { l1conn := flag.String("l1conn", "", "l1 connection") l1keystore := flag.String("l1keystore", "", "l1 private key store") deployAccount := flag.String("l1DeployAccount", "", "l1 seq account to use (default is first account in keystore)") + ownerAddress := flag.String("ownerAddress", "", "the rollup owner's address") + sequencerAddress := flag.String("sequencerAddress", "", "the sequencer's address") wasmmoduleroot := flag.String("wasmmoduleroot", "", "WASM module root hash") wasmrootpath := flag.String("wasmrootpath", "", "path to machine folders") l1passphrase := flag.String("l1passphrase", "passphrase", "l1 private key file passphrase") @@ -66,6 +68,13 @@ func main() { panic(err) } + if !common.IsHexAddress(*sequencerAddress) { + panic("please specify a valid sequencer address") + } + if !common.IsHexAddress(*ownerAddress) { + panic("please specify a valid rollup owner address") + } + machineConfig := validator.DefaultNitroMachineConfig machineConfig.RootPath = *wasmrootpath @@ -73,8 +82,16 @@ func main() { headerReaderConfig.TxTimeout = *txTimeout deployPtr, err := arbnode.DeployOnL1( - ctx, l1client, l1TransactionOpts, l1TransactionOpts.From, *authorizevalidators, - common.HexToHash(*wasmmoduleroot), l2ChainId, headerReaderConfig, machineConfig, + ctx, + l1client, + l1TransactionOpts, + common.HexToAddress(*sequencerAddress), + common.HexToAddress(*ownerAddress), + *authorizevalidators, + common.HexToHash(*wasmmoduleroot), + l2ChainId, + headerReaderConfig, + machineConfig, ) if err != nil { flag.Usage() diff --git a/system_tests/common_test.go b/system_tests/common_test.go index c2a360052d..a1c500e630 100644 --- a/system_tests/common_test.go +++ b/system_tests/common_test.go @@ -160,7 +160,18 @@ func DeployOnTestL1(t *testing.T, ctx context.Context, l1info info, l1client cli l1info.PrepareTx("Faucet", "User", 30000, big.NewInt(9223372036854775807), nil)}) l1TransactionOpts := l1info.GetDefaultTransactOpts("RollupOwner", ctx) - addresses, err := arbnode.DeployOnL1(ctx, l1client, &l1TransactionOpts, l1info.GetAddress("Sequencer"), 0, common.Hash{}, chainId, headerreader.TestConfig, validator.DefaultNitroMachineConfig) + addresses, err := arbnode.DeployOnL1( + ctx, + l1client, + &l1TransactionOpts, + l1info.GetAddress("Sequencer"), + l1info.GetAddress("RollupOwner"), + 0, + common.Hash{}, + chainId, + headerreader.TestConfig, + validator.DefaultNitroMachineConfig, + ) Require(t, err) l1info.SetContract("Bridge", addresses.Bridge) l1info.SetContract("SequencerInbox", addresses.SequencerInbox)