2 releases (1 unstable)
26.2.1-non-semver-compat | Jan 29, 2025 |
---|---|
0.1.0 | Jul 12, 2024 |
#12 in #era
582 downloads per month
Used in 24 crates
(10 directly)
3.5MB
81K
SLoC
ZKsync Era VM Wrapper
This crate represents a wrapper over several versions of VM that have been used by the ZKsync Era node. It contains the glue code that allows switching the VM version based on the externally provided marker while preserving the public interface. This crate exists to enable the external node to process breaking upgrades and re-execute all the transactions from the genesis block.
Developer guidelines
Adding tests
If you want to add unit tests for the VM wrapper, consider the following:
- Whenever possible, make tests reusable; declare test logic in the
testonly
module, and then instantiate tests using this logic for the supported VM versions. If necessary, extend the tested VM trait so that test logic can be defined in a generic way. See thetestonly
module docs for more detailed guidelines. - If you define a generic test, don't forget to add its instantiations for all supported VMs (
vm_latest
,vm_fast
andshadow
).shadow
tests allow checking VM divergences for free! - Do not use an RNG where it can be avoided (e.g., for test contract addresses).
- Avoid using zero / default values in cases they can be treated specially by the tested code.
Dependencies
~40–56MB
~860K SLoC