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

Adding support for forge test on zksync VM #125

Merged
merged 13 commits into from
Oct 17, 2023
Merged

Adding support for forge test on zksync VM #125

merged 13 commits into from
Oct 17, 2023

Conversation

mm-zk
Copy link
Collaborator

@mm-zk mm-zk commented Oct 13, 2023

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.

@mm-zk mm-zk requested a review from dutterbutter October 13, 2023 13:09
Copy link
Collaborator

@dutterbutter dutterbutter left a 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?

Cargo.toml Outdated Show resolved Hide resolved
Cargo.toml Show resolved Hide resolved
anvil/core/Cargo.toml Show resolved Hide resolved
chisel/Cargo.toml Show resolved Hide resolved
cli/Cargo.toml Outdated Show resolved Hide resolved
@mm-zk
Copy link
Collaborator Author

mm-zk commented Oct 16, 2023

@dutterbutter

One question here: What is the difference between art.bytecode and art.deployed_bytecode ?

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.

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?

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

@mm-zk mm-zk requested a review from dutterbutter October 16, 2023 08:07
@dutterbutter
Copy link
Collaborator

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"

2023-10-17T11:14:17.7806887Z ##[error]The runner has received a shutdown signal. This can happen when the runner service is stopped, or a manually started runner is canceled.
2023-10-17T11:14:17.7810605Z ##[error]Process completed with exit code 143.

@mm-zk mm-zk merged commit ee6078d into main Oct 17, 2023
5 of 10 checks passed
@Karrq Karrq deleted the 0810_try_tests branch October 9, 2024 18:23
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.

2 participants