-
Notifications
You must be signed in to change notification settings - Fork 38
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
Estimate tx gas #50
Estimate tx gas #50
Conversation
Reference to batching transactions issue: ethers-io/ethers.js#62 |
sendOptions: { | ||
gasLimit?: number | string; | ||
} | ||
): Promise<EthersTransactionResult>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EthersTransactionResult | Web3TransactionResult
@@ -192,6 +237,17 @@ class CPKEthersProvider implements CPKProvider { | |||
getSendOptions(options: object, ownerAccount: string): object { | |||
return options; | |||
} | |||
|
|||
async getGasPrice(): Promise<number> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No longer needed
@@ -173,6 +266,15 @@ class CPKWeb3Provider implements CPKProvider { | |||
...(options || {}), | |||
}; | |||
} | |||
|
|||
getGasPrice() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No longer needed
I just saw that this is fixed in the next PR |
Edit notes:
Discovered that
eth_call
is totally unspecified for error cases, which is why the--noVMErrorsOnRPCResponse
got set on Ganache. Here's a summary of what is happening:eth_call
, and Ganache will attempt to decode the revert reason data as a UTF-8 string to send as part of the error. There is raw "return" data,but I think it is actually just the originaland it's an ABI-encoded Error.calldata
echoed back--noVMErrorsOnRPCResponse
and Geth will return the data supplied torevert
call as the response. There's no distinguishing this from a regular return. Our use case depends on this behavior, as buggy as it feels to me.which is actually just the.calldata
echoed back, so there isn't a way to use Parity to do a gas estimate through therequiredTxGas
methodEdit 2: Found that it's not the
calldata
echoed back, but actually ABI-encodedError(string)
data: https://solidity.readthedocs.io/en/latest/control-structures.html#revertThis also explains the
.substring(138)
that I didn't understand.In any case, it is a matter of getting that data now.
Edit 3: works with OpenEthereum now. Tested with the following:
parity --config dev --unlock 0x00a329c0648769a73afac7f9381e08fb43dbea72 --password <(echo '')