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
9 changes: 7 additions & 2 deletions arbnode/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions staker/legacy/staker.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 9 additions & 1 deletion staker/validatorwallet/contract.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
4 changes: 4 additions & 0 deletions staker/validatorwallet/eoa.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 2 additions & 0 deletions staker/validatorwallet/noop.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{} }
Expand Down
Loading