-
Notifications
You must be signed in to change notification settings - Fork 790
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
vm: Improve skipBalance
logic
#1849
Conversation
Codecov Report
Flags with carried forward coverage won't be shown. Click here to find out more. |
02d6227
to
c4585a5
Compare
I'm not sure if this is the best approach or not but this solves the immediate issue of a call to reduceSenderBalance where the cost is greater than the sender's balance. It does so for Then, in |
Okay, I think all of the current feedback has been addressed so I'm going to call this ready for review. |
looks great, thanks for all the requested updates, looks like ci is failing with a nonce off by one error |
Fixed that last issue. I forgot to add the |
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.
lgtm! since this is rather delicate let's wait for one more 👀 and approval before merging
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.
this still lgtm :)
@ryanio in doubt maybe just merge if you feel good with it. 🙂 |
c6c47e0
to
ddb663f
Compare
Rebased this on latest |
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.
Also had a quick look, this looks good to me as well.
Will merge.
* Add better skipBalance handling * New runCall check for insufficient balance * Move skipbalance check to top * Add coverage for insufficient balance check * Make skipBalance adjust just + balance * Test more cases with skipBalance * update docs * Doc nits * Requested fixes * Add missing nonce check * Update packages/vm/src/runTx.ts * nits * improve comments * remove leftover tape.only Co-authored-by: Ryan Ghods <ryan@ryanio.com>
* Add better skipBalance handling * New runCall check for insufficient balance * Move skipbalance check to top * Add coverage for insufficient balance check * Make skipBalance adjust just + balance * Test more cases with skipBalance * update docs * Doc nits * Requested fixes * Add missing nonce check * Update packages/vm/src/runTx.ts * nits * improve comments * remove leftover tape.only Co-authored-by: Ryan Ghods <ryan@ryanio.com>
* Add better skipBalance handling * New runCall check for insufficient balance * Move skipbalance check to top * Add coverage for insufficient balance check * Make skipBalance adjust just + balance * Test more cases with skipBalance * update docs * Doc nits * Requested fixes * Add missing nonce check * Update packages/vm/src/runTx.ts * nits * improve comments * remove leftover tape.only Co-authored-by: Ryan Ghods <ryan@ryanio.com>
* Add better skipBalance handling * New runCall check for insufficient balance * Move skipbalance check to top * Add coverage for insufficient balance check * Make skipBalance adjust just + balance * Test more cases with skipBalance * update docs * Doc nits * Requested fixes * Add missing nonce check * Update packages/vm/src/runTx.ts * nits * improve comments * remove leftover tape.only Co-authored-by: Ryan Ghods <ryan@ryanio.com>
* Add better skipBalance handling * New runCall check for insufficient balance * Move skipbalance check to top * Add coverage for insufficient balance check * Make skipBalance adjust just + balance * Test more cases with skipBalance * update docs * Doc nits * Requested fixes * Add missing nonce check * Update packages/vm/src/runTx.ts * nits * improve comments * remove leftover tape.only Co-authored-by: Ryan Ghods <ryan@ryanio.com>
* Add better skipBalance handling * New runCall check for insufficient balance * Move skipbalance check to top * Add coverage for insufficient balance check * Make skipBalance adjust just + balance * Test more cases with skipBalance * update docs * Doc nits * Requested fixes * Add missing nonce check * Update packages/vm/src/runTx.ts * nits * improve comments * remove leftover tape.only Co-authored-by: Ryan Ghods <ryan@ryanio.com>
Fixes #1839
This addresses the fact that
skipBalance
inrunTx
doesn't handle skipping balance checks correctly after the initial transaction options are parsed. Now, ifskipBalance
is set to true and the calling account balance is less than the transaction cost (i.e. intrinsic gas + value), it sets the balance equal to the transaction cost so the transaction will not fail due to an account having an insufficient balance.It adds similar logic in
runCall
that checks to verify that the account has sufficient balance for any value transferred in the call.