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

docs: document best practices of measuring gas when using transient storage #1289

Open
1 of 2 tasks
JoseMiguelHerrera opened this issue Jun 16, 2024 · 3 comments
Open
1 of 2 tasks
Labels
good first issue Good for newcomers T-enhancement Type: enhance existing docs

Comments

@JoseMiguelHerrera
Copy link

Component

Forge

Have you ensured that all of these are up to date?

  • Foundry
  • Foundryup

What version of Foundry are you on?

forge 0.2.0 (c2e5297 2024-06-14T00:22:57.565836000Z)

What command(s) is the bug in?

forge test --gas-report

Operating System

macOS (Intel)

Describe the bug

I'm using transient storage for context setting. Just before the function ends, I expect there to be some context in transient storage that I can fetch. This behaviour is working perfectly when I test with "forge test".

However, when I check with forge test --gas-report, the transient storage is empty, as if it has been cleared or never written at all.

What is so different between these 2 modes of operation that would cause this?

Cheers

@JoseMiguelHerrera JoseMiguelHerrera added the T-to-fix Type: issue in docs label Jun 16, 2024
@klkvr
Copy link
Member

klkvr commented Jun 18, 2024

since foundry-rs/foundry#7186 --gas-report enables isolation by default. You can verify that by comparing forge test --isolate and forge test --gas-report outputs

@JoseMiguelHerrera
Copy link
Author

since foundry-rs/foundry#7186 --gas-report enables isolation by default. You can verify that by comparing forge test --isolate and forge test --gas-report outputs

Thanks, makes sense. So what's the best practice to test features that use transient storage?

@zerosnacks zerosnacks changed the title forge test & forge test --gas-report differ in behaviour when using transient storage docs: document best practices of measuring gas when using transient storage Jul 16, 2024
@zerosnacks zerosnacks removed the T-to-fix Type: issue in docs label Jul 16, 2024
@zerosnacks
Copy link
Member

Transformed this ticket into a documentation ticket aiming to document best practices in regards to transient storage + gas snapshots

@zerosnacks zerosnacks transferred this issue from foundry-rs/foundry Sep 12, 2024
@zerosnacks zerosnacks added good first issue Good for newcomers T-enhancement Type: enhance existing docs labels Sep 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers T-enhancement Type: enhance existing docs
Projects
No open projects
Status: Todo
Development

No branches or pull requests

3 participants