Skip to content
New issue

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

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

Already on GitHub? # to your account

feat: allow address targeting #307

Merged
merged 8 commits into from
Sep 11, 2024
Merged

feat: allow address targeting #307

merged 8 commits into from
Sep 11, 2024

Conversation

walkah
Copy link
Collaborator

@walkah walkah commented Aug 27, 2024

Summary

This adds a new CLI flag --target that allows sending a job to a specific RP address. The solver is updated to look for a target config and skip the regular matching flow to create a deal with the specified RP (if it exists).

Task/Issue reference

Closes: #198

Test plan

  • To send a job to the dev RP, do: ./lilypad run --network dev --target 0x15d34AAf54267DB7D7c367839AAf71A00a2C6A65 cowsay:v0.0.4 -i Message="hello"
  • Sending to any other address via --target should fail.

@walkah walkah force-pushed the walkah/feat-target-address branch from f28710d to 152b8b3 Compare August 29, 2024 16:11
@walkah walkah marked this pull request as ready for review August 29, 2024 21:26
Copy link

cla-bot bot commented Aug 30, 2024

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have the users @walkah on file. In order for us to review and merge your code, please open a new pull request and sign the Contributor License Agreement following the instructions in our contributing guide. Once the pull request is merged, ping a maintainer who will summon me again.

@cla-bot cla-bot bot added the cla-signed label Aug 30, 2024
Copy link
Contributor

@bgins bgins left a comment

Choose a reason for hiding this comment

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

Looks good! Tested it out and it works happy path and no such resource provider. 👌

Left some comments, minor stuff. One other comment the error case dumps quite a lot of info, including the CLI flags for the command. Would be nice if we could suppress that, but no need for it to block merging this work.

Comment on lines +116 to +121
newTargetOptions, err := ProcessTargetOptions(options.Offer.Target)
if err != nil {
return options, err
}
options.Offer.Target = newTargetOptions

Copy link
Contributor

Choose a reason for hiding this comment

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

We may be able to skip this processing step because we aren't processing the target. Optional though, alright with adding for the future.

return resourceOffer, nil
}
}
return nil, nil
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we return an error here? We observed some issues handling errors at the call site:

resourceOffer, err := db.GetResourceOfferByAddress(jobOffer.JobOffer.Target.Address)
if err != nil {
return nil, err
}

Perhaps we could print the error in this block and continue.

@walkah walkah requested a review from a team as a code owner September 9, 2024 18:37
@narbs91 narbs91 merged commit 2d49cc4 into main Sep 11, 2024
4 checks passed
@narbs91 narbs91 deleted the walkah/feat-target-address branch September 11, 2024 17:32
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[core] Add a new flag to 'run' --target ([]string) to be able to target specific nodes
3 participants