Closed speedrunner911 closed 3 years ago
Thanks. Please attach a sample raw tx to debug this issue.
Contract hex data = 0x608060405234801561001057600080fd5b5060c88061001f6000396000f300608060405260043610603f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680639765b4d7146041575b005b60476049565b005b3373ffffffffffffffffffffffffffffffffffffffff166108fc600234811515606e57fe5b049081150290604051600060405180830381858888f193505050501580156099573d6000803e3d6000fd5b505600a165627a7a723058201c17bc5fbe92ad70e82f652e9d79752087242a4f28f4502e13e4ceab79bf1b660029
Try to run estimate gas with 0x9765b4d7
data and any value.
Contract source code
contract simpleInternalTx {
function autoSend() public payable {
msg.sender.transfer(msg.value/2);
}
function () external payable {}
}
Hey @speedrunner911,
I've deployed the above contract to https://semux.info/explorer/account/0xa845e8f4acf31faa7b51ffc3494d3f236862ab4f and tested /estimate-gas
API.
Request:
curl -X GET "http://127.0.0.1:5171/v2.5.0/estimate-gas?to=0xa845e8f4acf31faa7b51ffc3494d3f236862ab4f&value=5&data=0x9765b4d7" -H "accept: application/json"
Response body:
{
"success": true,
"message": "successful operation",
"result": "28914"
}
I can see the API returns an estimated gas of 28914
.
🐛 Bug
Estimate-gas cannot calculate internal txs cost
To reproduce
Expected Behavior
If you deploy same contract in eth network, estimate gas will return bigger amount, because it can calculate how much gas needed to execute internal txs.