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

feat(op-challenger): Refactor out Global Config #11309

Closed
wants to merge 1 commit into from

Conversation

refcell
Copy link
Contributor

@refcell refcell commented Aug 1, 2024

Description

Refactors the global Config type out of the VmConfig. Although this duplicates a bit of Config fields, they will be consistent since the VmConfig is constructed using the Config object.

This is a minimal change so we don't need to further refactor the challenger's top-level config.Config object (adding new fields for various VmConfigs).

@refcell refcell added the A-op-challenger Area: op-challenger label Aug 1, 2024
@refcell refcell requested a review from ajsutton August 1, 2024 19:45
@refcell refcell self-assigned this Aug 1, 2024
@refcell refcell requested a review from a team as a code owner August 1, 2024 19:45
@refcell refcell requested a review from clabby August 1, 2024 19:57
Copy link
Contributor

@ajsutton ajsutton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its been a while so not sure how well this lines up with my original comments, but looking at it with fresh eyes, my suggestion would be to simplify things this way: #11348

Then we maintain a single vm.Config and just have a helper object that we plug in to calculate the arguments required for the oracle server execution which is really all we're trying to do.

}

var _ VmConfig = (*KonaVmConfig)(nil)

func NewKonaVmConfig(vmConfig Config) *KonaVmConfig {
func NewKonaVmConfig(cfg *Config) *KonaVmConfig {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've been pretty consistent in passing around vm.Config directly instead of via a pointer - would be good to stick with that since it's a pretty small object. Will save adding & in a lot of places in this PR.

func (s *OpProgramVmConfig) Cfg() Config {
return s.Config
}

func (s *OpProgramVmConfig) FillHostCommand(args []string, dataDir string, inputs utils.LocalGameInputs) ([]string, error) {
if args == nil {
return nil, errors.New("args is nil")
}

args = append(args,
"--",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd still say that this should be added by the executor not the program.

@refcell refcell closed this Aug 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-op-challenger Area: op-challenger
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants