Skip to content

fix(forge): ensure selected fork contains init state for persisted accounts #10301

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

Merged
merged 2 commits into from
Apr 15, 2025

Conversation

grandizzy
Copy link
Collaborator

@grandizzy grandizzy commented Apr 14, 2025

Motivation

Solution

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

Copy link
Member

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

nice find

Comment on lines +1105 to +1111
// Make sure all persistent accounts on the newly selected fork starts from the init
// state (from setup).
for addr in &self.inner.persistent_accounts {
if let Some(account) = self.fork_init_journaled_state.state.get(addr) {
fork.journaled_state.state.insert(*addr, account.clone());
}
}
Copy link
Member

Choose a reason for hiding this comment

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

one more edge case with fork switching -.-

@grandizzy grandizzy merged commit b75625a into foundry-rs:master Apr 15, 2025
22 checks passed
@grandizzy grandizzy deleted the issue-10296 branch April 15, 2025 07:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-forge Command: forge T-bug Type: bug
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

bug(forge test): storage inside the test contract is not persisted between forks
2 participants