---
# System prepended metadata

title: Virtual Counters Manager

---

## VCM
Javascript class implementation that handles the virtual counters throught a batch execution.
**Current status**: Virtual counters approach is currently working with etrog hardfork. All test vectors have passed.

#### TODO: 
- In som tests, the amount of some virtual counters is up to ten times the amount of real counters. This tests should be reviewed one by one and fix the vcounters computations accordly. 

- Would be very interesting to do a tool that computes the vcounters of transaction in mainnet and testnet and checks the vcounter computation is lower than the real one

### Repositories:
**zkevm-commonjs**:
Check [virtual-counters-manager.js](https://github.com/0xPolygonHermez/zkevm-commonjs/blob/main/src/virtual-counters-manager.js) where all the logic is handled

**zkevm-testvectors**: https://github.com/0xPolygonHermez/zkevm-testvectors
All the tests are regenerated with the current virtual counters consumption. When this tests are run with the rom, at the github actions, it is checked that the virtual counters consumed are greater or equal than the real counters. Otherwise, the test fails.

**ROM**: https://github.com/0xPolygonHermez/zkevm-rom
Implement vcounters checks at parallel testing

**Ethereumjs**: https://github.com/0xPolygonHermez/ethereumjs-monorepo/tree/custom-implementation

### Update virtual counters
In case some virtual counter computation is adjusted, a few things have to be done to update all the virtual counters system.
1- If the update is done at the ethereumjs monorepo (https://github.com/0xPolygonHermez/ethereumjs-monorepo): Make the update, build the project `npm run build` and publish the version `nmp publish` (vm package)
2- Update ethereumjs version at `zkevm-commonjs` package.json and create a commonjs version
3- Update `zkevm-testvectors` with this new commonjs version and regenerate ALL test-vectors with `npm run regen-tests`. Push those regenerated tests on a branch
4- Update `zkevm-rom` package fot testvectors with this new branch, create a branch and make a PR to develop, this way all the tests will pass with those new virtual counters
5- If the rom test pass correctly, we can merge al this new branches and create a version for each