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

fix(cheatcodes): Include calls to create2 factory in state diff recording #6650

Closed

Conversation

RPate97
Copy link
Contributor

@RPate97 RPate97 commented Dec 21, 2023

Motivation

Resolves #6634 by including the call to the create2 factory in the state diff results. Note that this PR does not resolve a related issue where the call to the create2 factory is not included in traces. As far as I can tell, these issues resemble each other but are not directly related. So, I think it makes sense to solve them separately.

Solution

Resolved by adding logic to record an additional call to the create2 factory if the call scheme is CreateScheme::Create2 and the call depth is equal to the prank/broadcast depth.

Copy link
Member

@Evalir Evalir left a comment

Choose a reason for hiding this comment

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

lgtm, pending fmt

@RPate97 RPate97 force-pushed the pate/include-create2-factory-call branch from 24f85c0 to 1924857 Compare December 21, 2023 20:52
@RPate97 RPate97 force-pushed the pate/include-create2-factory-call branch from 1924857 to 8c81779 Compare December 21, 2023 21:00
Comment on lines +1241 to +1243
// If the create scheme is Create2 and the depth equals the broadcast/prank/default
// depth, then record an additional call to the create2 factory.
if data.journaled_state.depth() == base_depth {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I believe this PR would result in a correct state diff for scripts, but not tests, because of #5529

Copy link
Contributor

@Inphi Inphi left a comment

Choose a reason for hiding this comment

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

IIUC, the create2deployer isn't used for tests or if --broadcast isn't enabled (going by L1175). In that case, a AccountAccess CALL isn't required.

@RPate97
Copy link
Contributor Author

RPate97 commented Dec 22, 2023

Thanks for the feedback everyone, I've opened a pull request to address #5529: #6656. I will revisit this issue once that has been reviewed.

@RPate97 RPate97 closed this Dec 22, 2023
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

Successfully merging this pull request may close these issues.

vm.stopAndReturnStateDiff() results do not include call to create2 factory
4 participants