Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return RollupAddress from NoOp validator wallet and add test #1887

Merged
merged 3 commits into from
Sep 27, 2023
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
2 changes: 1 addition & 1 deletion arbnode/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,7 @@ func createNodeImpl(
getExtraGas := func() uint64 { return configFetcher.Get().Staker.ExtraGas }
// TODO: factor this out into separate helper, and split rest of node
// creation into multiple helpers.
var wallet staker.ValidatorWalletInterface = validatorwallet.NewNoOp(l1client)
var wallet staker.ValidatorWalletInterface = validatorwallet.NewNoOp(l1client, deployInfo.Rollup)
if !strings.EqualFold(config.Staker.Strategy, "watchtower") {
if config.Staker.UseSmartContractWallet || txOptsValidator == nil {
var existingWalletAddress *common.Address
Expand Down
12 changes: 8 additions & 4 deletions staker/validatorwallet/noop.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,15 @@ import (

// NoOp validator wallet is used for watchtower mode.
type NoOp struct {
l1Client arbutil.L1Interface
l1Client arbutil.L1Interface
rollupAddress common.Address
}

func NewNoOp(l1Client arbutil.L1Interface) *NoOp {
return &NoOp{l1Client: l1Client}
func NewNoOp(l1Client arbutil.L1Interface, rollupAddress common.Address) *NoOp {
return &NoOp{
l1Client: l1Client,
rollupAddress: rollupAddress,
}
}

func (*NoOp) Initialize(context.Context) error { return nil }
Expand All @@ -44,7 +48,7 @@ func (*NoOp) TimeoutChallenges(ctx context.Context, challenges []uint64) (*types

func (n *NoOp) L1Client() arbutil.L1Interface { return n.l1Client }

func (*NoOp) RollupAddress() common.Address { return common.Address{} }
func (n *NoOp) RollupAddress() common.Address { return n.rollupAddress }

func (*NoOp) ChallengeManagerAddress() common.Address { return common.Address{} }

Expand Down
7 changes: 1 addition & 6 deletions system_tests/staker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,12 +218,7 @@ func stakerTestImpl(t *testing.T, faultyStaker bool, honestStakerInactive bool)
err = valWalletB.Initialize(ctx)
Require(t, err)
}
dpC, err := arbnode.StakerDataposter(ctx, rawdb.NewTable(l2nodeB.ArbDB, storage.StakerPrefix), l2nodeA.L1Reader, &l1authA, NewFetcherFromConfig(arbnode.ConfigDefaultL1NonSequencerTest()), nil)
if err != nil {
t.Fatalf("Error creating validator dataposter: %v", err)
}
valWalletC, err := validatorwallet.NewContract(dpC, nil, l2nodeA.DeployInfo.ValidatorWalletCreator, l2nodeA.DeployInfo.Rollup, l2nodeA.L1Reader, nil, 0, func(common.Address) {}, func() uint64 { return 10000 })
Require(t, err)
valWalletC := validatorwallet.NewNoOp(l1client, l2nodeA.DeployInfo.Rollup)
valConfig.Strategy = "Watchtower"
stakerC, err := staker.NewStaker(
l2nodeA.L1Reader,
Expand Down
Loading