Skip to content
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

"balance intrinsic error" since 0.4.1 #2848

Closed
DefiDebauchery opened this issue Nov 27, 2023 · 6 comments · Fixed by #2856
Closed

"balance intrinsic error" since 0.4.1 #2848

DefiDebauchery opened this issue Nov 27, 2023 · 6 comments · Fixed by #2856

Comments

@DefiDebauchery
Copy link

DefiDebauchery commented Nov 27, 2023

I've started encountering the following error when attempting to build a transaction:
unable to apply transaction even for the highest gas limit 30000000: balance intrinsic error

I believe this may have started at version 0.4.1, as this likely would've been raised earlier.
But because I don't know exactly what this error means, I cannot speculate as to why it is occurring (since it's a "balance error", is it failing because it's simulating through a wallet with no balance?)

ready-to-run python code at https://gist.github.com/DefiDebauchery/b4a62540af70d124ed8770b4526e447b

This is not a simple contract reversion, as I can get a revert simply by simulating the call from an address that does not have adequate Ownership to the timelock.

Expected output is a txn payload that can be submitted.
Actual output is the error reported above.

@tclemos tclemos self-assigned this Nov 28, 2023
@tclemos tclemos added this to the v0.4.2 milestone Nov 28, 2023
@tclemos
Copy link
Contributor

tclemos commented Nov 28, 2023

I'm investigating it

@tkporter
Copy link

Hi @tclemos - I believe I'm probably hitting a similar issue that's slightly different, wanted to flag here to make sure #2856 can also fix this. My error can be found here: #2869

@tclemos tclemos linked a pull request Nov 30, 2023 that will close this issue
@tclemos
Copy link
Contributor

tclemos commented Dec 4, 2023

@DefiDebauchery just to give you a context before closing the issue, the error above is returned when the code was not possible to execute the transaction, even for the highest gas limit possible to be set.

As you can see, I've merged a PR with some reviews to the EstimateGas and now the message will be following Ethereum standards and returning gas required exceeds allowance (30000000).

This error message is returning, because when estimating the gas your script is setting the Gas Price: https://gist.github.com/DefiDebauchery/b4a62540af70d124ed8770b4526e447b#file-zkevm-py-L6-L7

When the GasPrice field is set during the EstimateGas, the balance of the account is checked, and since the balance of the account was not enough to afford the gas price set, the error is returned.

What you can do in this case is just not set the gas price, add more funds to the account or use an account that already have enough funds to afford the gas price set.

For a complementary information about acc and balances related to the default addresses, please check this response: #2869 (comment)

@tclemos tclemos closed this as completed Dec 4, 2023
@DefiDebauchery
Copy link
Author

DefiDebauchery commented Dec 6, 2023

Apologies for the delay in response, but wanted to mention something:

This error message is returning, because when estimating the gas your script is setting the Gas Price: https://gist.github.com/DefiDebauchery/b4a62540af70d124ed8770b4526e447b#file-zkevm-py-L6-L7

I'm explicitly setting Gas Price because without it, the web3 library (web3py in this case) was unable to calculate gas due to missing methods on the RPC:

UserWarning: There was an issue with the method eth_maxPriorityFeePerGas. Calculating using eth_feeHistory.
  warnings.warn(
MethodUnavailable: {'code': -32601, 'message': 'the method eth_maxPriorityFeePerGas does not exist/is not available'}

During handling of the above exception, another exception occurred:
MethodUnavailable: {'code': -32601, 'message': 'the method eth_feeHistory does not exist/is not available'}

@tclemos
Copy link
Contributor

tclemos commented Dec 9, 2023

No problem, in this case you can go with one of the other 2 options:

  • add more funds to the account you are suing
  • use an account that already have enough funds to afford the gas price set

@DefiDebauchery
Copy link
Author

DefiDebauchery commented Dec 9, 2023

That's won't always be possible for simulating calls that will be from the source (but not direct executor) of a transaction, such as Safe -> Timelock. In my case, I use this simulation to ensure that permissions are correct and that an existing job isn't already pending on the TL.

Will balance-less simulations ever be allowed on zkEvm as they are on all other chains (20 of them) that I successfully do similar calls with?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants