-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
fix: gas: estimate gas with a zero base-fee #8991
Conversation
492e3d9
to
8244a6f
Compare
@@ -178,69 +186,3 @@ func TestDealsRetryLackOfFunds_blockInPublishDeal(t *testing.T) { | |||
case <-time.After(time.Second * 15): | |||
} | |||
} | |||
|
|||
func TestDealsRetryLackOfFunds_belowLimit(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I can tell, this was testing a bug? We should always allow retries, no matter how low our account balance is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that's true -- I believe we explicitly don't auto-retry (can be manually triggered, or happens on restart, per discussion here).
Is this test failing as a result of your change? It may just need to have its funds lowered to, like, 1 attoFIL.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before: The deal would fail if the account didn't have enough funds to cover the gas, but would wait for a retry call if it had enough funds to cover the message, but not enough funds to process the deal.
Now: The deal will behave the same way in both cases. If we don't have enough funds for any reason, we'll let the user retry.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But yes, we never auto-retry. But that wasn't what this was testing. This was testing whether or not the deal failed if we were below the limit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, you seem to be right...
@@ -156,6 +157,10 @@ func (sm *StateManager) CallWithGas(ctx context.Context, msg *types.Message, pri | |||
ctx, span := trace.StartSpan(ctx, "statemanager.CallWithGas") | |||
defer span.End() | |||
|
|||
// Copy the message as we'll be modifying the nonce. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand why we need this copy now, and not before?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We needed it before as well, technically. In practice, this doesn't matter because there's exactly one caller of this method (gasEstimateGasLimit) and that caller also copies the message.
Otherwise, an account will need funds to estimate the max possible gas a message could take (which is usually the block gas limit). This does mean gas estimation no longer checks if the sending account has enough funds to cover the message cost, but MpoolPush will now do this.
8244a6f
to
d192b82
Compare
Codecov Report
@@ Coverage Diff @@
## master #8991 +/- ##
==========================================
- Coverage 40.65% 40.59% -0.07%
==========================================
Files 707 707
Lines 78716 78725 +9
==========================================
- Hits 32004 31960 -44
- Misses 41242 41286 +44
- Partials 5470 5479 +9
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the PR, looks pretty landable, but a couple things.
@@ -178,69 +186,3 @@ func TestDealsRetryLackOfFunds_blockInPublishDeal(t *testing.T) { | |||
case <-time.After(time.Second * 15): | |||
} | |||
} | |||
|
|||
func TestDealsRetryLackOfFunds_belowLimit(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that's true -- I believe we explicitly don't auto-retry (can be manually triggered, or happens on restart, per discussion here).
Is this test failing as a result of your change? It may just need to have its funds lowered to, like, 1 attoFIL.
Addressed CR. |
Related Issues
#8697
Proposed Changes
Estimate gas with a zero base-fee. Otherwise, an account will need funds to estimate the max possible gas a message could take (which is usually the block gas limit).
This does mean gas estimation no longer checks if the sending account has enough funds to cover the message cost, but MpoolPush will now do this. Furthermore, subsystems like the window post worker will carefully pick an account with funds to cover the message. Previously, the fact that gas estimation would fail up-front caused this code to be less useful.
Checklist
Before you mark the PR ready for review, please make sure that:
<PR type>: <area>: <change being made>
fix: mempool: Introduce a cache for valid signatures
PR type
: fix, feat, INTERFACE BREAKING CHANGE, CONSENSUS BREAKING, build, chore, ci, docs,perf, refactor, revert, style, testarea
: api, chain, state, vm, data transfer, market, mempool, message, block production, multisig, networking, paychan, proving, sealing, wallet, deps