-
Notifications
You must be signed in to change notification settings - Fork 136
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
Using vm.writeFile
throws EvmError: Revert
#497
Comments
Hi @brotherlymite, I wanted to provide an update on our work regarding this issue. We understand that the problem originated from the split in the Aave proposal contracts, which led to the use of cheatcodes in external contracts—functionality that isn’t natively supported and is quite complex to implement. More context & documentation can be found in the zksync discrepancies aave-v3-origin issue and this related issue. To partially enable this functionality, we utilized the zkVm cheatcode to switch execution between EVM and zkVM. However, during this transition, a migration occurs, which we believe is corrupting the state. Consequently, when switching back from zkVM to EVM, the cheatcodes stop functioning. In cases where only one cheatcode is involved, using a low-level call can resolve the issue. This method allows us to verify the state without the additional checks performed by high-level calls. However, Aave’s extensive tests, which involve multiple cheatcodes, make this workaround highly cumbersome. We acknowledge that implementing this would require significant changes to the codebase, and although we’re testing it ourselves, the process is challenging due to the extensive modifications needed. We understand that a better solution for this is a top priority, and we’re treating it as such. Resolving this will require further research and development time. We’re progressing as quickly as possible, but we anticipate that it will take more time during this week to provide a path forward for this issue. |
Hey @brotherlymite thanks for the report - we investigated the issue and found (and applied with #499) a fix that should make your original use case work. |
@Karrq thank you, yes it was expected on the test. |
Component
Forge
Have you ensured that all of these are up to date?
What version of Foundry are you on?
forge 0.0.2 (4f2145e 2024-07-31T00:29:10.879990000Z)
What command(s) is the bug in?
forge test --zksync
Operating System
macOS (Apple Silicon)
Describe the bug
vm.writeFile
cheatcode seems to be revert when used via a helper contract SnapshotHelpersV3To reproduce the error please run
FOUNDRY_PROFILE=zksync forge test --zksync --match-path=zksync/src/20240731_AaveV3ZkSync_TestIssue/AaveV3ZkSync_TestIssue_20240731.t.sol -vv
on the repo.On the traces:
We see the call the
vm.writeFiles
reverts on thecreateConfigurationSnapshot()
method on the SnapshotHelpersV3 contractThe text was updated successfully, but these errors were encountered: