-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Don't keep CALLER
balance as U256::MAX
#2390
Comments
sounds reasonable, let's set it to |
@jferas pointed out to me this happens with another address too: foundry/evm/src/executor/mod.rs Lines 108 to 115 in 71541ee
I wonder if instead the right solution is to exclude these addresses from the fuzzer dict? 0x3fAB184622Dc19b6109349B94811493BF2a45362 definitely seems safe to exclude because it seems it's only used to deploy the create2 contract, but Either way, 0x3fAB184622Dc19b6109349B94811493BF2a45362 definitely doesn't need a balance of |
Unsure, I don't know what that address is being used for. I think it's for script? |
that sounds right, wdyt @joshieDo while we're at it, can we make these constants? |
Reopened because I don't think it resolved #2390 (comment) |
Yep, thanks. Interestingly, @jferas and I both did not see fuzz failures with either of those two addresses until recently, but I don't recall seeing a change that would cause them to start being included in the fuzz dict. So I think the scope of this issue may be three items:
Let me know if that sounds right |
Hmm, I think |
Yea I think I lean this way also, just want to make sure they have more realistic default balances in that case
Ah ok, yea that seems like a reasonable approach to me then. Perhaps we keep the balance zero, set it to nonzero to call |
Yea that's what I meant
Afaik both balances add up to |
Does it still have issues with the latest version? Current master branch should handle that foundry/evm/src/executor/mod.rs Lines 108 to 120 in f0fa5da
|
The ask is to set it to 0 again after deployment 😄 |
Component
Forge
Have you ensured that all of these are up to date?
What version of Foundry are you on?
No response
What command(s) is the bug in?
No response
Operating System
No response
Describe the bug
Here, we set the balance of
CALLER
and other addresses toU256::MAX
to make sure they can execute deploys.foundry/forge/src/runner.rs
Lines 69 to 71 in 7e12adb
A few lines below, we set the balances to the user-specified initial balance.
foundry/forge/src/runner.rs
Lines 128 to 131 in 7e12adb
However,
CALLER
is left out of there, so if a fuzz test chooses theCALLER
address and that test sends ETH to that address, the test reverts with balance overflow.Proposed fix is to set the
CALLER
balance after L132 to either 0, or toself.initial_balance
. I believe either should be suitable sinceCALLER
isn't used afterwards AFAIK.This is partially related to #2322 in that I don't think the default balance of an account should ever be kept at
U256::MAX
, so in that PR I'd suggest using the defaultself.initial_balance
that's typically used instead.The text was updated successfully, but these errors were encountered: