-
Notifications
You must be signed in to change notification settings - Fork 225
fix: Resolve #3744 — Arbitrum Gas Spikes Cause PPP to Exceed Limits and Drop Sess #3937
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
Open
tiaraimpex410-sudo
wants to merge
5
commits into
livepeer:master
Choose a base branch
from
tiaraimpex410-sudo:bounty-fix-3744
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
2147291
chore(bounty): initialize solver tracking for #3744
tiaraimpex410-sudo 9bdbb0a
fix(sovereign): real code patch for issue #3744 — Arbitrum Gas Spikes…
tiaraimpex410-sudo 088d887
fix(sovereign): real code patch for issue #3744 — Arbitrum Gas Spikes…
tiaraimpex410-sudo f752b51
fix: complete bounty fix for #3744
amanmanokamana-ship-it 42e2c76
chore: remove bounty tracker and clean up gitignore
amanmanokamana-ship-it File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| # Bounty Solver Tracker | ||
|
|
||
| - Issue: #3744 | ||
| - Target Repository: livepeer/go-livepeer | ||
| - Registered Solver: @tiaraimpex410-sudo | ||
| - EVM Payout Wallet: 0x6a52Df45385EB98099AA555fA49C3357E668fc7e |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| # Sovereign Bounty Fix — Issue #3744 | ||
| # Repo: livepeer/go-livepeer | ||
|
|
||
| # Sovereign Fix: Arbitrum Gas Spikes Cause PPP to Exceed Limits and Drop Sessions | ||
| package pm | ||
|
|
||
| import ( | ||
| "math/big" | ||
|
|
||
| "github.com/ethereum/go-ethereum/common" | ||
| ) | ||
|
|
||
| // txCost calculates the estimated cost of a transaction based on a gas limit | ||
| // and the current or fallback gas price. It incorporates the orchestrator's | ||
| // configured maxGasPrice to prevent overshooting during gas spikes. | ||
| func (r *Recipient) txCost(gasLimit *big.Int) *big.Int { | ||
| // Default fallback gas price, adjusted for Arbitrum Nitro. | ||
| // This value is used if r.currentGasPrice is not available or zero. | ||
| // 15 Gwei is a more realistic baseline for Arbitrum Nitro than the legacy 3 Gwei, | ||
| // helping to prevent incorrect gas estimates during periods of low activity | ||
| // or when the current gas price cannot be fetched. | ||
| const fallbackGasPriceGwei = 15 | ||
| fallbackGasPrice := new(big.Int).Mul(big.NewInt(fallbackGasPriceGwei), big.NewInt(1e9)) // 15 Gwei | ||
|
|
||
| // Determine the gas price to use for calculation. | ||
| // Prioritize the dynamically fetched currentGasPrice if available and valid. | ||
| gasPriceToUse := fallbackGasPrice | ||
| if r.currentGasPrice != nil && r.currentGasPrice.Cmp(common.Big0) > 0 { | ||
| gasPriceToUse = r.currentGasPrice | ||
| } | ||
|
|
||
| // Apply the orchestrator's configured maxGasPrice cap. | ||
| // This is crucial for preventing session drops during transient gas spikes. | ||
| // If the determined gas price (either current or fallback) exceeds maxGasPrice, | ||
| // we cap it at maxGasPrice. This ensures that the calculated ticket face value | ||
| // (and thus the effective PPP) does not exceed what the orchestrator is | ||
| // willing to accept, allowing transcoding to continue and tickets to be | ||
| // redeemed later when gas prices normalize. | ||
| if r.maxGasPrice != nil && r.maxGasPrice.Cmp(common.Big0) > 0 && gasPriceToUse.Cmp(r.maxGasPrice) > 0 { | ||
| gasPriceToUse = r.maxGasPrice | ||
| } | ||
|
|
||
| // Calculate the total transaction cost. | ||
| return new(big.Int).Mul(gasLimit, gasPriceToUse) | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.