diff --git a/arbnode/node.go b/arbnode/node.go index 5892247f8cc..d1d6d80815d 100644 --- a/arbnode/node.go +++ b/arbnode/node.go @@ -41,7 +41,7 @@ import ( "github.com/offchainlabs/nitro/daprovider/daclient" "github.com/offchainlabs/nitro/daprovider/das" "github.com/offchainlabs/nitro/daprovider/data_streaming" - dapserver "github.com/offchainlabs/nitro/daprovider/server" + "github.com/offchainlabs/nitro/daprovider/server" "github.com/offchainlabs/nitro/execution" "github.com/offchainlabs/nitro/execution/gethexec" "github.com/offchainlabs/nitro/solgen/go/bridgegen" @@ -817,7 +817,12 @@ func getStaker( if err != nil { return nil, nil, common.Address{}, err } - if err := wallet.Initialize(ctx); err != nil { + if config.Staker.UseSmartContractWallet { + err = wallet.InitializeAndCreateSCW(ctx) + } else { + err = wallet.Initialize(ctx) + } + if err != nil { return nil, nil, common.Address{}, err } if dp != nil { diff --git a/staker/legacy/staker.go b/staker/legacy/staker.go index 44c7f5e7efe..77453682f60 100644 --- a/staker/legacy/staker.go +++ b/staker/legacy/staker.go @@ -299,6 +299,7 @@ type Staker struct { type ValidatorWalletInterface interface { Initialize(context.Context) error + InitializeAndCreateSCW(context.Context) error // Address must be able to be called concurrently with other functions Address() *common.Address // Address must be able to be called concurrently with other functions diff --git a/staker/validatorwallet/contract.go b/staker/validatorwallet/contract.go index fed87caca28..74e01096d97 100644 --- a/staker/validatorwallet/contract.go +++ b/staker/validatorwallet/contract.go @@ -106,7 +106,15 @@ func (v *Contract) validateWallet(ctx context.Context) error { } func (v *Contract) Initialize(ctx context.Context) error { - err := v.populateWallet(ctx, false) + return v.initialize(ctx, false) +} + +func (v *Contract) InitializeAndCreateSCW(ctx context.Context) error { + return v.initialize(ctx, true) +} + +func (v *Contract) initialize(ctx context.Context, createIfMissing bool) error { + err := v.populateWallet(ctx, createIfMissing) if err != nil { return err } diff --git a/staker/validatorwallet/eoa.go b/staker/validatorwallet/eoa.go index 695299279a9..7adaa3bde63 100644 --- a/staker/validatorwallet/eoa.go +++ b/staker/validatorwallet/eoa.go @@ -39,6 +39,10 @@ func (w *EOA) Initialize(ctx context.Context) error { return nil } +func (w *EOA) InitializeAndCreateSCW(ctx context.Context) error { + return nil +} + func (w *EOA) Address() *common.Address { return &w.auth.From } diff --git a/staker/validatorwallet/noop.go b/staker/validatorwallet/noop.go index 8e0b0cd9115..37c48d8afce 100644 --- a/staker/validatorwallet/noop.go +++ b/staker/validatorwallet/noop.go @@ -28,6 +28,8 @@ func NewNoOp(l1Client *ethclient.Client) *NoOp { func (*NoOp) Initialize(context.Context) error { return nil } +func (*NoOp) InitializeAndCreateSCW(context.Context) error { return nil } + func (*NoOp) Address() *common.Address { return nil } func (*NoOp) AddressOrZero() common.Address { return common.Address{} }