-
Notifications
You must be signed in to change notification settings - Fork 69
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
Issue-#1391: Add generic estimateGas() function #1394
Conversation
* @param {...any[]} args arguments of the function | ||
* @return {Promise<number>} gas cost of the function | ||
*/ | ||
export async function estimateGas( |
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.
Can we somehow write a test for this method ? I'm thinking of having picking one contract method for eg and compare the value returned by this method to the value returned by calling estimate directly on the contract method as we did before ? Or maybe something else if you have a better idea .
By doing this i think we may also not have issues with code climate coverage dropping and the diff coverage
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.
@bogdanfazakas I can add a Utils.test
file, for example, to test functions like this one. But I also think that this function is executed in a lot of tests, because all the specific functions used to estimate gas for concrete ABI functions, like estGasCreateNFT()
, estGasAddNFTTemplate()
... also calls this function. And this function is also called directly from all the functions that call the smart contract functions, like createNFT()
, addNFTTemplate()
...
Looks good in general should work, do you think is worth testing it locally in the market on the estimates we have in publish flow ? |
Code Climate has analyzed commit 6f74add and detected 89 issues on this pull request. Here's the issue category breakdown:
The test coverage on the diff in this pull request is 41.6% (50% is the threshold). This pull request will bring the total coverage in the repository to 71.7% (-2.7% change). View more on Code Climate. |
Yeah, I agree it would be good to test this with the market before merging. @miquelcabot have you done that? Also, there seems to be a lot of codeclimate issues - 89. Have you looked into fixing them? |
@jamiehewitt15 Yes, I have tested locally with the market and it works. |
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.
Ok, looks good to me
Fixes #1391
Changes proposed in this PR:
estimateGas()
function