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

feat(anvil): --cache-path #9343

Merged
merged 9 commits into from
Nov 21, 2024
Merged

feat(anvil): --cache-path #9343

merged 9 commits into from
Nov 21, 2024

Conversation

yash-atreya
Copy link
Member

@yash-atreya yash-atreya commented Nov 18, 2024

Motivation

Closes #3512 + Closes #8654

Solution

Introduces the --cache-path flag to anvil letting users can configure where the old state is stored

@yash-atreya yash-atreya changed the title feat(anvil): --cache-path feat(anvil): --cache-path Nov 18, 2024
@zerosnacks zerosnacks self-requested a review November 19, 2024 08:24
Copy link
Member

@zerosnacks zerosnacks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implementation LGTM, would you mind adding a test case for this?

@yash-atreya yash-atreya enabled auto-merge (squash) November 20, 2024 11:24
Copy link
Collaborator

@grandizzy grandizzy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm! one minor question re testing the new setting

.with_max_persisted_states(Some(10_usize))
.with_blocktime(Some(Duration::from_millis(1))),
)
.await;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a way to assert file was actually written in custom temp dir? I tried to manually test it but probably I am missing something as I wasn't able to get the json file dumped

Copy link
Member Author

@yash-atreya yash-atreya Nov 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah testing this is a bit hard. Wrote a better test here. 363010f

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you! yeah, managed to check file is generated with this test. I think that's good to have, drawback is that will slow down the CI (and potential flakiness), @zerosnacks wdyt?

If we are to keep it let's solve warnings here
https://github.com/foundry-rs/foundry/actions/runs/11933626813/job/33261072474#step:12:66

and maybe add one more assert to make sure the cache is actually populated

assert!(cache_path.read_dir().unwrap().next().is_some());

Copy link
Collaborator

@grandizzy grandizzy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good, only a comment re keeping the test or not @zerosnacks pls chime in

.with_max_persisted_states(Some(10_usize))
.with_blocktime(Some(Duration::from_millis(1))),
)
.await;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you! yeah, managed to check file is generated with this test. I think that's good to have, drawback is that will slow down the CI (and potential flakiness), @zerosnacks wdyt?

If we are to keep it let's solve warnings here
https://github.com/foundry-rs/foundry/actions/runs/11933626813/job/33261072474#step:12:66

and maybe add one more assert to make sure the cache is actually populated

assert!(cache_path.read_dir().unwrap().next().is_some());

Copy link
Collaborator

@grandizzy grandizzy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm!

@yash-atreya yash-atreya merged commit 057c8ac into master Nov 21, 2024
22 checks passed
@yash-atreya yash-atreya deleted the yash/anvil-cache-path branch November 21, 2024 07:02
@grandizzy
Copy link
Collaborator

looks like the test is flaky, CI fails here https://github.com/foundry-rs/foundry/actions/runs/11948242152/job/33309461327#step:12:151 I propose to remove it, @zerosnacks @yash-atreya wdyt?

rplusq pushed a commit to rplusq/foundry that referenced this pull request Nov 29, 2024
* feat(`anvil`): --cache-path

* nits

* test

* nit

* run with tempdir

* nit
@grandizzy grandizzy added the T-feature Type: feature label Dec 18, 2024
@grandizzy grandizzy added the C-anvil Command: anvil label Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-anvil Command: anvil T-feature Type: feature
Projects
Archived in project
3 participants