-
Notifications
You must be signed in to change notification settings - Fork 266
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
Implement Gas Exactimation #948
Comments
The problem with our current implementation is that it does take into account gas-returning OPCODES like So if you use the gas returned by |
Also does not take into account gas refunds because of SSTORE changes. My suggestion to solve this issue is to code Gas Exactimation [but it must be analyzed for correctness, because it's written mainly for Ethereum and the 63/64 rule]: OR, as a simpler alternative that will work 99.99% of the time (I'm trying hard to find examples where this wouldn't work):
|
PR with gas exactimation method here #990 |
I'm analyzing this issue deeper since I discovered that the previous code already skips refunds using the localCall variable when estimating gas (in a very ugly way). This is good news (the previous code works in most cases) and bad news (the previous code sucks). |
I detected another problem with estimateGas(). It does not differentiate between an OOG exception and a successful finalization. Therefore the gas limit passed to estimageGas() should always be higher than the actual gas consumed. By doing that one can differentiate the cases: returnedValue==gasLimit means OOG. |
New code in the PR ready. Tests passed and all ready to go. function () external payable { } The old estimator would estimate 2300 less units of gas than the required to properly execute the method callWithValue(). |
This issue is still relevant, and is causing #1279 |
RSKj does not implement the binary search solution implemented by geth and parity in
eth_estimateGas
, some transactions can fail unexpectedly with OOG.Truffle Suite recently published a less CPU intensive solution they called Gas Exactimation
Latest implementation: https://github.com/trufflesuite/ganache-core/blob/3ec34fe972dc17a5600eb566c8c309cd5ddb38bd/lib/utils/gasEstimation.js
This issue will be more relevant if RSKj implements EIP-150 63/64 rule (#944)
The text was updated successfully, but these errors were encountered: