Skip to content
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

Allow clearing storage and address warmness #155

Closed
CodeSandwich opened this issue Aug 18, 2022 · 2 comments
Closed

Allow clearing storage and address warmness #155

CodeSandwich opened this issue Aug 18, 2022 · 2 comments

Comments

@CodeSandwich
Copy link

Forge (IIUC) executes all the tests in a single transaction. As of now it don't think that it's possible to create a precise gas benchmark in Forge if there's storage or a call involved. If a test requires a storage initialization, the initialization makes the slot warm, which makes its usage lower than if it was in a separate transaction. Also if any contract is deployed, its address is automatically becoming warm, again lowering the gas usage when calling it. The EVM could expose a cheatcode to clear the warmness states allowing the benchmarks to be as expensive as when running in a separate transaction.

@CodeSandwich
Copy link
Author

Probably a duplicate of foundry-rs/foundry#2429

@mds1
Copy link
Collaborator

mds1 commented Oct 25, 2022

Closing this as a duplicate of the linked issue + foundry-rs/foundry#1340. This is something that would need to be handled upstream in foundry as opposed to here in forge-std 🙂

@mds1 mds1 closed this as completed Oct 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants