Emulator FAQ

The following questions are related to usage of the EVM Bytecode Emulator.

Can I use default Foundry instead of Foundry-zksync?

Yes. But for scripts execution (forge script ...) it's required to use the --skip-simulation flag. This is necessary because underlying EraVM uses its own native gas, but foundry performs simulation against native EVM. This can lead to underestimated gas limit value.

Can I use Hardhat without the hardhat-zksync plugin?

Yes, Hardhat works without ZKsync-specific plugins.

What is the EVM version used by the EVM Emulator?

The EVM emulator targets Cancun.

Given that on EraVM contract deployment is done via the ContractDeployer, how does deployment work using the EVM Emulator?

You can deploy contracts just like on Ethereum (e.g., a transaction without field to and with the contract init code as calldata) and use tools like Hardhat and Foundry out of the box (no plugins needed).

How does the emulator contract get invoked on execution?

Invoking the EVM emulator is handled behind the scenes by the protocol. Developers don’t need to take any extra steps. If you want to learn more, check the protocol documentation.

Are EVM-bytecode contracts and EraVM-bytecode contracts allowed to interact with each other transparently?

Contracts deployed with EVM bytecode can interact with contracts deployed with EraVM bytecode, except for delegate calls, which are prohibited between EraVM and EVM bytecode contracts.

Find more details in EraVM-EVM interactions.

Will address derivation with regular create and create2 be the same as on other EVM chains?

Yes.

Is the EVM emulator 100% compatible with EVM?

No. Although emulation covers most developers' needs, there are limitations due to the underlying EraVM, such as unsupported opcodes or gas differences. Full EVM equivalence is expected with the next proving system in 2025.

See differences from Ethereum (Cancun) in the documentation.

What's the behavior of block.gaslimit? Does it return the batch limit or the transaction limit?

It returns 1125899906842624n directly from underlying EraVM. In practice this is meaningless value and should not be used. This differs from the value returned by EVM chains: 36000000n.

Can I send an L1-L2 transaction to deploy EVM bytecode contracts?

EVM contracts can't be deployed directly as from EOA, as requestL2TransactionDirect requires a to field in the transaction and EVM bytecode deployments omit this field. But L1-L2 transaction can call any kind of factory contract, including Create2 factories.


Made with ❤️ by the ZKsync Community