-
Notifications
You must be signed in to change notification settings - Fork 12
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
Expose ganache's "out of gas" error upon benchmarking #4
Conversation
Interesting find! Good call checking the receipt status. Just ran it myself and confirmed that the ganache simulation does indeed seem to run out of gas. Paging @gnidan since these seems like a bug? For foundry, you can try the new foundryup to get it installed easily. Though when the test runs out of gas you'll see an error clearly, e.g. if we set the gas limit to 15M you see:
The reason for the failure isn't too clear, so I just created foundry-rs/foundry#499 to track this |
Thanks for the heads up! @davidmurdoch you should see this :) |
👀 |
Looks like all the tools benchmarked here consume a different amount of gas when calling this function. I'm not sure which tool can be trusted to deliver an accurate gas estimate or accurate result. Perhaps the the logs can help here; i'll try to get some others from the truffle team to help look into this further with me soon (:tm:). |
With f96bae4 in place: $ make benchmark-foundry
bash scripts/benchmark-foundry.sh
compiling...
no files changed, compilation skipped.
Running 1 test for ConvexTest.json:ConvexTest
[PASS] testShutdownCost() (gas: 18876589)
Logs:
shutdown gas used: 18864842
real 4m39.219s
user 0m1.607s
sys 0m0.676s |
I was actually referring to the transaction event logs that are emitted over the course of the transaction. Diffing and exploring these event logs between clients may help us all improve our forking implementations. |
Right, I didn't push that commit as a response to your comment. I pushed it because I think it's important to be able to quickly visually inspect to see whether the test is running to completion, just like I had already done for ganache and hardhat in 2bb428a. (I hadn't gotten the foundry environment together until more recently.) |
Cool. If you want to explore this stuff together over zoom sometime next week let me know! |
@@ -13,6 +13,7 @@ const config: HardhatUserConfig = { | |||
url: String(process.env.ETH_RPC_URL), | |||
blockNumber: Number(process.env.FORK_BLOCK), | |||
}, | |||
loggingEnabled: true, |
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.
Does this have any significant impact on performance? From my quick test it seems to make no noticeable difference, but just want to confirm
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.
I doubt it's relevant, yes. But turning it off shouldn't hurt either.
@@ -89,7 +90,7 @@ async function prepareGanache({ | |||
defaultBalance: ethers.utils.formatEther(defaultBalance), | |||
}, | |||
logging: { | |||
quiet: true, | |||
quiet: false, |
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.
Same question about impact on performance?
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.
Honestly, I have no idea. @davidmurdoch ?
@feuGeneA Can you make sure the "allow edits by maintainers" box is checked? Just pushing a small change to add After that + answers around performance impact I think this PR is good to merge, then I'll open an issue to continue the discussion of the ganache issue |
It seems that GitHub only shows that check box on user-owned forks, and I forked this under @nomiclabs rather than under my own account 😕 I went into the settings for the |
I can't speak to the specific performance impact of logging, for any of these tools (including Hardhat, without doing some research). If you're interested in benchmarking the most performant scenario possible then I could understand why you'd be hesitant to enable logging. However, if you're only interested in an "apples to apples" comparison, and in ensuring that it's a "level playing field" across the different tools, then I would presume logging enablement to be a non-issue, if it's enabled for all of the tools. |
Since logging seems to have no impact on performance I think it's ok to leave it ok enabled for now. Going to merge this and create a new issue to continue tracking the ganache bug—thanks! |
Created #7 to track the ganache issue |
For ganache I disabled quiet logging and discovered that it's not actually executing the full transaction that's being benchmarked:
After adding the assertions:
I feel that the assertions are essential for ensuring trust in this benchmark, but I also kept in the logging because it's not very much output.
I'd love to put analogous verification in place for the foundry test as well, but I haven't yet been able to get that environment set up.