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

Add flag 'ignoreMaxPriceIfNeeded' #3127

Merged
merged 7 commits into from
Aug 20, 2024
Merged

Conversation

leszko
Copy link
Contributor

@leszko leszko commented Aug 12, 2024

This flag decides what to do when all Os have a price above the maxPricePerPixel defined by B:

  • true => Use an O with the price above maxPricePerPixel
  • false => Do not use any O (do not work)

@leszko leszko requested review from rickstaa and victorges August 12, 2024 12:13
Copy link

codecov bot commented Aug 12, 2024

Codecov Report

Attention: Patch coverage is 20.00000% with 8 lines in your changes missing coverage. Please review.

Project coverage is 57.34447%. Comparing base (84d88af) to head (a96329b).
Report is 1 commits behind head on master.

Files Patch % Lines
cmd/livepeer/starter/starter.go 0.00000% 8 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@                 Coverage Diff                 @@
##              master       #3127         +/-   ##
===================================================
- Coverage   57.35266%   57.34447%   -0.00819%     
===================================================
  Files             92          92                 
  Lines          15797       15801          +4     
===================================================
+ Hits            9060        9061          +1     
- Misses          6133        6136          +3     
  Partials         604         604                 
Files Coverage Δ
cmd/livepeer/livepeer.go 50.95541% <100.00000%> (+0.31438%) ⬆️
server/selection_algorithm.go 89.23077% <100.00000%> (ø)
cmd/livepeer/starter/starter.go 7.75946% <0.00000%> (-0.02264%) ⬇️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 84d88af...a96329b. Read the comment docs.

Files Coverage Δ
cmd/livepeer/livepeer.go 50.95541% <100.00000%> (+0.31438%) ⬆️
server/selection_algorithm.go 89.23077% <100.00000%> (ø)
cmd/livepeer/starter/starter.go 7.75946% <0.00000%> (-0.02264%) ⬇️

Copy link
Member

@victorges victorges left a comment

Choose a reason for hiding this comment

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

LGTM either way but I have a soft preference for making the default behavior to enforce the max price

@@ -204,6 +205,7 @@ func DefaultLivepeerConfig() LivepeerConfig {
defaultMaxTotalEV := "20000000000000"
defaultDepositMultiplier := 1
defaultMaxPricePerUnit := "0"
defaultEnforceMaxPrice := false
Copy link
Member

Choose a reason for hiding this comment

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

I think conceptually it would make more sense for the max price to be enforced by default (equivalent to having true here [1]). That because the non-enforcing behavior can be very misleading for independent node operators, being a behavior that only really makes sense for Studio right now that prefers to overpay than to deny service. On the Studio side, we can toggle the flag in our deployment easily enough.

[1] Even though we could just change the default to true, it is always cumbersome to have boolean flags that default to true since you can't disable them as easily as enabling (e.g. just --enforce-max-price), and sometimes you can't disable them at all (mist haha). So my suggestion is to have an "inverse" flag here, which actually means enabling the feature of ignoring the max price if no Os match. WDYT of --ignore-max-price-if-needed, defaulting to false, or sth like that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think conceptually it would make more sense for the max price to be enforced by default (equivalent to having true here [1]). That because the non-enforcing behavior can be very misleading for independent node operators, being a behavior that only really makes sense for Studio right now that prefers to overpay than to deny service. On the Studio side, we can toggle the flag in our deployment easily enough.

[1] Even though we could just change the default to true, it is always cumbersome to have boolean flags that default to true since you can't disable them as easily as enabling (e.g. just --enforce-max-price), and sometimes you can't disable them at all (mist haha). So my suggestion is to have an "inverse" flag here, which actually means enabling the feature of ignoring the max price if no Os match. WDYT of --ignore-max-price-if-needed, defaulting to false, or sth like that?

I'm ok with this. @rickstaa wdyt?

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with Victor's reasoning here

Copy link
Member

Choose a reason for hiding this comment

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

@thomshutt I already discussed this with @victorges async and I am onboard with the suggested changes. Feel free to merge with the suggested changes 👍. Thanks for creating this pull request.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated. @thomshutt please approve the PR and I'll merge

@leszko leszko force-pushed the rafal/add-flag-enforce-max-price branch from 8ae8632 to 8c83921 Compare August 19, 2024 08:45
@leszko leszko requested a review from thomshutt August 19, 2024 08:45
@@ -294,6 +296,7 @@ func DefaultLivepeerConfig() LivepeerConfig {
MaxTotalEV: &defaultMaxTotalEV,
DepositMultiplier: &defaultDepositMultiplier,
MaxPricePerUnit: &defaultMaxPricePerUnit,
IgnoreMaxPriceIfNeeded: &defaultEnforceMaxPrice,
Copy link
Member

Choose a reason for hiding this comment

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

@leszko looks good to me thanks! However is there a reason the default parameter name was not refactored while the test was?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ohh, sorry. Updated now. Also updated the PR description. PTAL.

6b3f95d

Copy link
Member

Choose a reason for hiding this comment

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

No problem. Approved!

@leszko leszko changed the title Add flag 'enforceMaxPrice' Add flag 'ignoreMaxPriceIfNeeded' Aug 20, 2024
@leszko leszko requested a review from rickstaa August 20, 2024 07:31
@leszko leszko merged commit 45591da into master Aug 20, 2024
18 checks passed
@leszko leszko deleted the rafal/add-flag-enforce-max-price branch August 20, 2024 09:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants