You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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 🙂
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.
The text was updated successfully, but these errors were encountered: