-
Notifications
You must be signed in to change notification settings - Fork 1k
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
refactoring how proposer settings load into validator client #13645
Conversation
config/proposer/loader.go
Outdated
"github.com/urfave/cli/v2" | ||
) | ||
|
||
type SettingsType int |
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.
No need to export
config/proposer/loader.go
Outdated
type ProposerSettingsLoader interface { | ||
Load(cliCtx *cli.Context) (*validatorService.ProposerSettings, error) | ||
} |
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.
Interface that has only one implementation is kind of useless
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.
I can take it out for now, was going to make changes with it when #13541 is addressed
config/proposer/loader.go
Outdated
LoadMethods []SettingsType | ||
ExistsInDB bool | ||
Db iface.ValidatorDB |
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.
These can be lowercase (functionally-wise it's probably irrelevant since the type is not exported anyway)
config/proposer/loader.go
Outdated
Load(cliCtx *cli.Context) (*validatorService.ProposerSettings, error) | ||
} | ||
|
||
type proposerSettingsLoader struct { |
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.
type proposerSettingsLoader struct { | |
type settingsLoader struct { |
Type name should not start with package name
config/proposer/loader.go
Outdated
} | ||
|
||
// ProposerSettingsLoaderOption sets additional flag checks that affect the proposer settings | ||
type ProposerSettingsLoaderOption func(cliCtx *cli.Context, psl *proposerSettingsLoader) error |
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.
type ProposerSettingsLoaderOption func(cliCtx *cli.Context, psl *proposerSettingsLoader) error | |
type SettingsLoaderOption func(cliCtx *cli.Context, psl *proposerSettingsLoader) error |
Type name should not start with package name
return p | ||
} | ||
|
||
func (po *ProposerOption) ToConsensus() *validatorpb.ProposerOptionPayload { |
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.
Missing doc
|
config/proposer/loader.go
Outdated
func (psl *SettingsLoader) processProposerSettings(loadedSettings, dbSettings *validatorpb.ProposerSettingsPayload) *validatorpb.ProposerSettingsPayload { | ||
dbOnly := false | ||
if loadedSettings == nil && dbSettings == nil { | ||
return nil |
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 case is not covered by any test.
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.
i don't think this is possible since it'd probably only happen on db only but it should exist in the db... can take it out if we want but also think it's fine to keep it in
@@ -136,6 +147,35 @@ type ProposerOption struct { | |||
BuilderConfig *BuilderConfig | |||
} | |||
|
|||
// Clone creates a deep copy of proposer option | |||
func (po *ProposerOption) Clone() *ProposerOption { | |||
if po == nil { |
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.
Is it even possible to enter into this function if po == nil
?
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.
probably not i think... don't remember by we added those checks
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.
nvm it's used on fee recipient APIs reverted this...
} | ||
|
||
func (po *ProposerOption) ToConsensus() *validatorpb.ProposerOptionPayload { | ||
if po == nil { |
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.
Is it even possible to enter into this function if po == nil
?
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.
happens on key manager APIs
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.
Co-authored-by: Manu NALEPA <enalepa@offchainlabs.com>
Co-authored-by: Manu NALEPA <enalepa@offchainlabs.com>
Co-authored-by: Manu NALEPA <enalepa@offchainlabs.com>
Co-authored-by: Manu NALEPA <enalepa@offchainlabs.com>
thing still need to be exported here for db and api use as well as tests |
What type of PR is this?
Other
What does this PR do? Why is it needed?
the proposer settings is a configuration that is saved on the validator client both in memory and in the DB to provide configuration information such as fee recipients or configuring a validator to use a mev builder. The current implementation is littered with inconsistent checks and hopefully this will improve readability.
fixes #13797