Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Detect out-of-gas in debugger to improve error messages #3269

Open
gnidan opened this issue Aug 14, 2020 · 4 comments
Open

Detect out-of-gas in debugger to improve error messages #3269

gnidan opened this issue Aug 14, 2020 · 4 comments

Comments

@gnidan
Copy link
Contributor

gnidan commented Aug 14, 2020

Since we know how much gas is left, we should be able to deduce that we're out of gas, instead of the current message:

There was no revert message. This may be due to an in intentional halting expression, such as assert(), revert(), or require(), or could be due to an unintentional exception such as out-of-gas exceptions.
Please inspect your transaction parameters and contract code to determine the meaning of this error.

If we use trace.step's gasCost and gas, we might be able to provide a higher degree of certainty for out-of-gas errors.

@haltman-at
Copy link
Contributor

Hm, do we know that gasCost is reliable? I'd want to check that out before implementing this. If it is then I guess this should be fine.

There's also the question of whether this is only checked at end of transaction or on any revert. I suppose we'd have to do the latter if we want to to work it with the stacktraces, but that's not too bad; we cam just store that info.

Notionally we could expand this system to other low-level reasons, but that probably isn't worth it because people care about the high-level reasons, not the low-level reasons, and that would be a lot harder (and low-level reasons other than out of gas, invalid instruction, and REVERT aren't that likely to come up in a contract compiled from a higher-level language like Solidity).

@haltman-at
Copy link
Contributor

haltman-at commented Aug 24, 2020

Oh yeah I guess gasCost is reliable, I think I was confusing it with something else that's unreliable.

Edit: Disregard that, it's not. Hm. I don't know how to do this, then.

@laki016
Copy link

laki016 commented Oct 1, 2020

How can i get my smart contract and how to solve this problem?I was left without my tokens and without 0.068eth.

@haltman-at
Copy link
Contributor

@laki016 Your comment does not seem related to this issue? If you are having a Truffle issue, I would suggest filing a new issue report. Thank you!

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

No branches or pull requests

3 participants