You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Update VRF off-chain fulfillment gas estimation - #24140
Enforce a worst-case floor on the fulfillment gas limit, derived solely from the request's own callbackGasLimit and precalculated gas overheads before and after callback. The gas overhead default value was determined by comparing values across different chains where VRF is supported: Native-payment range: 110k – 164k, LINK-payment range: 121k – 164k. It's possible to override the value by using the newly introduced job spec field.
callbackGasLimit × 64/63 + GasOverhead (200k default; or override from job spec) + margin (10k)
This guarantees the transaction can always complete billing; a fully burning callback now takes the designed success=false path (still billed) instead of an out-of-gas revert.
Additionally, the subscription balance pre-check now reserves the worst-case request cost, including the premium at the gas lane max price, rather than only the simulated fee. The premium defaults to 100% and can be overridden in a job spec.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The gas floor is not applied before fulfillment simulation, allowing sender-dependent callbacks to fail on every retry and leave funded requests unfulfilled.
This PR adds a worst-case gas floor to VRF fulfillment transactions, aiming to preserve enough gas for billing when a callback consumes its full allowance.
Changes:
Calculate and apply a fulfillment gas floor using the callback allowance, proof verification cost, coordinator configuration, and margin.
Cache the coordinator’s gas accounting configuration, with fallback handling for failed reads.
Add unit tests for floor calculations and an integration test checking the fulfillment transaction’s gas limit.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The balance check reserves only the cheaper simulated payment despite the higher callback gas limit, allowing shared subscription balances to be overcommitted and later fulfillments to fail for insufficient funds.
On a low-gas-price lane with a nonzero flat fulfillment fee, this maximum can under-reserve the full-callback bill: maxFee includes the flat fee with simulated gas usage, while fundsNeeded includes the full callback allowance but no flat fee. If callback usage increases after simulation, a subscription funded to this reservation can pass the balance check and then revert during billing, even with the default 100% reservation premium. Include the applicable native flat fee or discounted LINK flat fee in the worst-case estimate before comparing it with the simulated charge.
The fulfillment gas floor already honors the job spec gasOverhead override,
but the worst-case fee reservation still used the fixed default. Estimate
both LINK and native fees with the effective overhead so the reserved cost
matches the worst case the floor allows.
Co-Authored-By: Claude Code <noreply@anthropic.com>
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Batched fulfillments bypass the per-request gas floor and can exceed the transaction gas budget, while failed LINK feed lookups and omitted flat fees can admit underfunded requests.
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
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.
Enforce a worst-case floor on the fulfillment gas limit, derived solely from the request's own
callbackGasLimitand precalculated gas overheads before and after callback. The gas overhead default value was determined by comparing values across different chains where VRF is supported: Native-payment range: 110k – 164k, LINK-payment range: 121k – 164k. It's possible to override the value by using the newly introduced job spec field.callbackGasLimit × 64/63 + GasOverhead (200k default; or override from job spec) + margin (10k)This guarantees the transaction can always complete billing; a fully burning callback now takes the designed
success=falsepath (still billed) instead of an out-of-gas revert.Additionally, the subscription balance pre-check now reserves the worst-case request cost, including the premium at the gas lane max price, rather than only the simulated fee. The premium defaults to 100% and can be overridden in a job spec.
Requires
Supports
Deployment Validation Steps