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

-autoAdjustPrice flag to enable/disable automatic price adjustments #2025

Merged
merged 3 commits into from
Sep 10, 2021

Conversation

yondonfu
Copy link
Member

@yondonfu yondonfu commented Sep 9, 2021

What does this pull request do? Explain your changes. (required)

At the moment, an orchestrator can be configured with a base price (per pixel) which is then automatically adjusted based on the estimated overhead (the % representing tx cost / ticket face value) for redeeming winning tickets on-chain. As a result, the price advertised by the orchestrator is typically higher than the configured base price and it will fluctuate depending on the current estimated overhead for redeeming tickets. For example, given a base price of 1000:

  • If the overhead is 1%, the advertised price is 1010
  • If the overhead is 20%, the advertised price is 1200
  • If the overhead is 50%, the advertised price is 1500

The motivation for the auto price adjustment mechanism is to allow orchestrators to dynamically update their price to compensate for higher overheads for ticket redemptions if gas prices on Ethereum spike. However, this mechanism can also cause a few problems:

  • The orchestrator is unable to establish certainty around what price it is advertising
  • If gas prices spike causing the prices to spike, the orchestrator may lose jobs because its price exceeds the max price configured by broadcasters (see A sudden peak in gas price for few seconds result in all jobs are canceled. #1966). An orchestrator may prefer to have the option to retain the jobs in this scenario instead and take on the risk of waiting for lower gas price periods to redeem tickets

This PR introduces a -autoAdjustPrice flag that can be used to enable/disable automatic price adjustments. By default, the flag is set to true which matches the current behavior of the node. If the flag is set to false, the orchestrator will always return its base price as its advertised price regardless of the current estimated overhead of redeeming tickets. For example, if the base price is 1000, regardless of the estimated overhead for ticket redemption, the advertised price would be 1000.

Specific updates (required)

See commit history.

How did you test each of these updates (required)

Added unit tests.

Does this pull request close any open issues?

Fixes #1966.

Checklist:

  • Read the contribution guide
  • make runs successfully
  • All tests in ./test.sh pass
  • README and other documentation updated
    • Update livepeer.org/docs before merging!
  • Pending changelog updated

Copy link
Contributor

@jailuthra jailuthra left a comment

Choose a reason for hiding this comment

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

LGTM 🚢

To clarify for my own understanding: following the example from discord #1966 (comment)

But I'd actually prefer for the pixel price NOT to be automatically adjusted and instead just set a maxGasPrice flag. So I could set the pixel price to 1000 wei (and a maxGasPrice of 150gwei) and it would stay like this no matter the current gas price. If the gas price is too high during the time I get the ticket, I would have to manually redeem it at a later time. That way, I could also make sure that I stay profitable when transcoding but would not lose all the sessions during gas spikes.

After this change the user can peg the price to a constant of 1000 (pixelPrice) + 150 (maxGasPrice) = 1150 wei by setting -pricePerUnit 1150 -autoAdjustPrice false and redeem their tickets later when gas prices are under 150 wei; right?

@yondonfu
Copy link
Member Author

After this change the user can peg the price to a constant of 1000 (pixelPrice) + 150 (maxGasPrice) = 1150 wei by setting -pricePerUnit 1150 -autoAdjustPrice false and redeem their tickets later when gas prices are under 150 wei; right?

Instead of O automatically adjusting the price to accommodate for higher fees to redeem a ticket (due to high gas prices), O can advertise a constant price and just not redeem a ticket when the fees are too high (due to high gas prices) and wait until fees are reasonable for the user to redeem.

After this change, a user could do the following:

  • Set their base price to 1000 wei via -pricePerUnit 1000
  • Set their max gas price to 150 gwei via -maxGasPrice 150000000000
  • Disable auto price adjustments via -autoAdjustPrice=false
  • The O would always advertise a constant price of 1000 wei instead of automatically adjusting the price up based on the current ETH gas price
  • If O receives a winning ticket and the current ETH gas price exceeds 150 gwei, O will not redeem the winning ticket and instead it will regularly check if the ETH gas price falls below 150 gwei and only redeem the ticket then

@yondonfu yondonfu merged commit 5a0a72f into master Sep 10, 2021
@yondonfu yondonfu deleted the yf/disable-auto-pricing branch September 10, 2021 13:35
@jailuthra
Copy link
Contributor

Set their max gas price to 150 gwei via -maxGasPrice 150000000000

If O receives a winning ticket and the current ETH gas price exceeds 150 gwei, O will not redeem the winning ticket and instead it will regularly check if the ETH gas price falls below 150 gwei and only redeem the ticket then

Ah I completely missed this - thanks for clarifying!

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.

A sudden peak in gas price for few seconds result in all jobs are canceled.
2 participants