-
Notifications
You must be signed in to change notification settings - Fork 196
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
New RPC endpoint: eth_estimateGasBundle #100
Comments
This was added in #102. NOTE: This differs from eth_estimateGas in that it does not binary search to find an optimal gasLimit. It only reports what the gas used by each tx in the bundle was. |
What does the binary search do in this case? Is it necessary? I can add that in, looks interesting to dissect |
I think I’m fine skipping on it, but I’ll let @epheph have the final say. I believe the intention is that setting a gasLimit can actually change the execution of the call. The binary search finds the smallest gasLimit where the call succeeds without running out of gas. See https://github.com/ethereum/go-ethereum/blob/master/internal/ethapi/api.go#L1081 |
Rationale
eth_estimateGas
is an important RPC endpoint: one that simulates the specified transaction description and returns an estimate for how what gasLimit is required to allow a contract call to finish.The problem for mev-geth is that it only operates on a single transaction, while bundles operate on a sequential set of transactions that influence gas usage of latter transactions. For example, in the bundle:
You can call
eth_estimateGas(approve)
, but there's no way to estimate gas ontransferFrom
, since it requires the state of approve to be applied first.We should make an API that accepts a bundle of transactions and returns an array of gas estimates.
This is particularly important for whitehat, as we often leave excess ETH in compromised accounts when we are required to overestimate the required gas limits.
Implementation
We already have:
eth_sendBundle
eth_callBundle
We should probably call this
eth_estimateBundle
oreth_estimateGasBundle
.One design consideration is whether we should be using signed transactions (like
eth_callBundle
) or unsigned transaction descriptions (likeeth_estimateGas
). I imagine using unsigned transaction descriptions would be more useful and faster to call (skipping a needless signing step on client, and a needless recovery step on server). The bundle being forwarded is going to be re-signed AFTER this call (to apply better gas limits returned), so signing first is a bit wasteful.The text was updated successfully, but these errors were encountered: