-
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
Adding support for forge test on zksync VM #125
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mm-zk I am hoping you can confirm my understanding but basically when we compile contracts (using zksolc), we first prepare the necessary inputs for the compiler. After compilation, we handle the output to extract and organize "artifacts", including the bytecode hash, factory dependencies, ABI, and bytecode . These artifacts are then stored in a mapping keyed by the contract name.
One question here: What is the difference between art.bytecode
and art.deployed_bytecode
?
I see that we execute transactions via run_era_transaction
from era-revm
. Here we convert revm tx to era's L2Tx
, execute that tx in era-test-node, update state of all the accounts touched, and return a revm ResultAndState
with execution status and state changes which is then used to in revm to complete the process.
This is where my confusion is. I have a disconnect where the artifacts created during compilation are used? I am assuming they are apart of either the db, or env passed to run_era_transaction
?
In EVM - you have a bytecode that is generated by solidity - and then when deployed, it runs a 'constructor' to generate the 'deployed bytecode' that ends up in storage.
Artifacts are 'serialized', and then foundry is passing them in tx.data, when creating contracts. See here: https://github.com/matter-labs/era-revm/blob/main/src/transactions.rs#L98 |
Yeah @mm-zk looks like you hit a resource issue, based on the docs: "this means that the resources consumed in the process exceeded the limits"
|
With this PR, you can start running 'zkforge test' - which would compile and execute the tests using zksync in-memory node.
Currently these tests are NOT support any of the vm Hacks (like impersonation etc) - this will be added in future PRs.