-
Notifications
You must be signed in to change notification settings - Fork 451
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
Fix live reloading of staker config #2587
Conversation
@@ -660,7 +660,7 @@ func createNodeImpl( | |||
confirmedNotifiers = append(confirmedNotifiers, messagePruner) | |||
} | |||
|
|||
stakerObj, err = staker.NewStaker(l1Reader, wallet, bind.CallOpts{}, config.Staker, blockValidator, statelessBlockValidator, nil, confirmedNotifiers, deployInfo.ValidatorUtils, fatalErrChan) | |||
stakerObj, err = staker.NewStaker(l1Reader, wallet, bind.CallOpts{}, func() *staker.L1ValidatorConfig { return &configFetcher.Get().Staker }, blockValidator, statelessBlockValidator, nil, confirmedNotifiers, deployInfo.ValidatorUtils, fatalErrChan) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This means that the options in Staker
will only be loaded during startup, the hot reloadable flag will be ignored.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the staker now takes a function of type L1ValidatorConfigFetcher
which is a function that would call configFetcher every time we invoke it this effectively implements live reloading.
(this impl is similar to how its done for other hot-reloadable configs such as batchposterconfig
Line 697 in 7ccb6ad
Config: func() *BatchPosterConfig { return &configFetcher.Get().BatchPoster }, |
I've tested this locally that hot-reloadable options are updated periodically.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
In staker's L1ValidatorConfig, most of the fields with hot-reload tag (except
log-query-batch-size
) are not used inside staker itself but used and handled correctly in different other places. PreviouslyStaker
struct didn't implement live-reloading of its config even though it was marked ashot-reload
, this PR fixes it.Note: Since most fields are not required to be hot-reloaded, this PR also tries to minimize invoking
L1ValidatorConfigFetcher
field of staker to lower the number of RLocksResolves NIT-2660