# What should a ZKsync Era smart contract audit check?

URL: https://shield.quillaudits.com/chains/zksync-era/

A ZKsync Era smart contract audit should check your Solidity logic and every place where EraVM and its zksolc compiler behave unlike Ethereum. That means how contracts deploy and get their addresses, how ETH transfers get gas, how signatures are checked when any account can run code, and gas that moves with L1 pubdata prices. QuillShield audits the Solidity source of a Foundry project that targets ZKsync Era, and the EraVM bytecode that zksolc builds from it needs its own tests. EraVM itself is being retired, so a review now should also cover what changes when the chain moves to ZKsync OS.

Last updated 3 December 2026. 8 minute read. By the QuillAudits Team.

## What is different about auditing on ZKsync Era?

Contracts deployed natively on ZKsync Era run on EraVM, which executes the output of zksolc, the ZKsync compiler for Solidity. The ZKsync docs list where that differs from Ethereum, and these differences change what a reviewer looks for.

- **Deployment and CREATE2.** On EraVM a contract is deployed from the hash of its bytecode, the bytecode itself travels in the `factoryDeps` field of an EIP-712 transaction, and the compiler must know the deployed bytecode in advance. The [EVM instructions page](https://docs.zksync.io/zksync-protocol/differences/evm-instructions) warns that `create` or `create2` in assembly will most likely compile to broken bytecode without an error, and that the same bytecode lands at a different address on ZKsync than on Ethereum. Factories that predict addresses with the Ethereum formula, or deploy bytecode assembled at runtime, need a second look.
- **Deployment nonces.** ZKsync keeps a deployment nonce apart from the transaction nonce, and the [contract deployment docs](https://docs.zksync.io/zksync-protocol/era-vm/differences/contract-deployment) say the address of a contract an EOA creates is not easy to compute in advance, so they suggest reading it from the `ContractDeployed` event. Scripts and contracts that precompute a deployment address from a nonce get it wrong.
- **Opcodes that do not compile.** zksolc stops with a compile-time error on `EXTCODECOPY`, `SELFDESTRUCT` and `CALLCODE`, a contract can read the code size of another contract but not its code, and `PREVRANDAO` returns the constant 2500000000000000 ([EVM instructions](https://docs.zksync.io/zksync-protocol/differences/evm-instructions)). Code that copies or hashes deployed bytecode, or takes randomness from the block, has to change.
- **ETH transfers.** `transfer()` and `send()` forward a fixed 2,300 gas, and the [ZKsync security guide](https://docs.zksync.io/zksync-network/zksync-era/security-best-practices) says that may not be enough when the call changes state, so it recommends `call` with an explicit success check. The same guide points out that `call` comes with no reentrancy protection, which puts checks-effects-interactions and a reentrancy guard on the review list.
- **Native account abstraction.** Any account on ZKsync Era can start a transaction and also run its own logic ([account abstraction docs](https://docs.zksync.io/zksync-protocol/era-vm/account-abstraction)), and the security guide says not to rely on `ecrecover` for signature checks. Code that assumes every user signs with one ECDSA key, or that treats any caller with code as a contract rather than a user, breaks for smart accounts and paymaster flows.
- **Gas that follows L1 prices.** Each transaction carries a `gasPerPubdataByte` value that the operator sets and that moves with Ethereum gas prices. The [security guide](https://docs.zksync.io/zksync-network/zksync-era/security-best-practices) warns that a `gasleft()` check which ignores it, as in its Gnosis Safe example, can be abused by a user who sets a high value, and it says not to hardcode gas constants.
- **EraVM is being retired.** The security guide says EraVM will be retired and that chains running it will begin a transition to ZKsync Atlas within six months. Our Crypto Talk dated the [announcement](https://ourcryptotalk.com/news/zksync-eravm-deprecation-6-month-timeline) to 4 September 2026 and reported that each chain sets its own schedule. ZKsync OS, the new execution environment, is EVM equivalent and works with standard compilers instead of zksolc, but the [ZKsync OS FAQ](https://docs.zksync.io/zksync-network/zksync-os/faqs) says native EraVM account abstraction is not supported there, so those accounts move to ERC-4337. The FAQ also lists the Blake2f and KZG point evaluation precompiles as not supported yet.
- **Tests that run on EraVM.** The [foundry-zksync book](https://foundry-book.zksync.io/zksync-specifics/limitations/general) notes that addresses below 65536 are reserved for kernel space, that zksolc bytecode hashes differ from solc, and that `address.code` is not available. Fuzz tests that pick low addresses, and helpers that read code, fail in ways an Ethereum test run never shows.

## How should a contract pay out ETH on ZKsync Era?

The first contract below pays refunds with `transfer()`, the pattern the ZKsync guide warns about. The second follows the guide: `call` with a checked result, the balance cleared before the call, and a reentrancy guard.

**Risky on ZKsync Era: refunds sent with transfer() and its fixed 2,300 gas (illustrative, not audited code)** `SaleRefundsWithTransfer.sol`

```
// SPDX-License-Identifier: MIT
pragma solidity 0.8.28;

/// Token sale that refunds buyers with transfer(). transfer() forwards a fixed
/// 2,300 gas, which the ZKsync docs say may not be enough on ZKsync Era, so a
/// refund can revert every time and leave the ETH in the contract.
contract SaleRefundsWithTransfer {
    mapping(address => uint256) public paid;

    function buy() external payable {
        paid[msg.sender] += msg.value;
    }

    function refund() external {
        uint256 amount = paid[msg.sender];
        require(amount > 0, "nothing to refund");
        paid[msg.sender] = 0;
        payable(msg.sender).transfer(amount);
    }
}
```

**Safer on ZKsync Era: call with a checked result and a reentrancy guard (illustrative, not audited code)** `SaleRefundsWithCall.sol`

```
// SPDX-License-Identifier: MIT
pragma solidity 0.8.28;

/// The same refund, written the way the ZKsync security guide asks: call with an
/// explicit success check, the balance cleared before the call, and a guard,
/// because call forwards enough gas for the recipient to call back in.
contract SaleRefundsWithCall {
    mapping(address => uint256) public paid;
    uint256 private locked = 1;

    modifier nonReentrant() {
        require(locked == 1, "reentrant call");
        locked = 2;
        _;
        locked = 1;
    }

    function buy() external payable nonReentrant {
        paid[msg.sender] += msg.value;
    }

    function refund() external nonReentrant {
        uint256 amount = paid[msg.sender];
        require(amount > 0, "nothing to refund");
        paid[msg.sender] = 0;
        (bool ok, ) = payable(msg.sender).call{value: amount}("");
        require(ok, "refund failed");
    }
}
```

Run the tests of the second version against a zksolc build as well, since the ZKsync guide says minor compiler issues can still appear despite extensive testing.

## What went wrong with transfer() on ZKsync Era?

Gemholic ran into the `transfer()` problem with real money in April 2023.

| Protocol | Gemholic (GemstoneIDO contract) |
| --- | --- |
| Date | NaN April 2023 |
| Chain | ZKsync Era |
| Loss | about 921 ETH stuck in the contract |
| What happened | Gemholic sold its GEMS token through the GemstoneIDO contract on ZKsync Era and collected about 921 ETH, which the contract then could not send out. The contract moved ETH with transfer(), which forwards a fixed 2,300 gas, and an analysis published by Digital Tails Group on 8 May 2023 traces the revert to that stipend not covering the call on ZKsync Era. From 24 April to 1 May 2023 OpenZeppelin reviewed a change to the ZKsync system contracts that was "needed to ensure .transfer and .send operations receive a predictable gas stipend". |
| Sources | [Digital Tails Group, on Coinmonks](https://medium.com/coinmonks/gemstoneido-contract-stuck-with-921-eth-an-analysis-of-why-transfer-does-not-work-on-zksync-era-d5a01807227d), [OpenZeppelin](https://www.openzeppelin.com/news/zksync-bridge-and-.transfer-.send-diff-audit) |

Nothing was stolen, but the ETH could not leave the contract. For a review, that means listing every place the code sends ETH and running each one on EraVM, because Ethereum gas rules don't carry over.

## Which protocol types need the most care on ZKsync Era?

The [ZKsync Era ecosystem page](https://docs.zksync.io/zksync-network/zksync-era/ecosystem) lists ZyFi as a paymaster, bridges such as Across, Orbiter Finance and Layerswap, cross-chain messaging through Chainlink CCIP and LayerZero, and oracles from Chainlink, Chronicle, DIA and Pyth. The differences above hit these kinds of code hardest.

- Smart accounts and paymasters, which are built on native account abstraction and carry the most work when EraVM is retired.
- Factories, clone-based vaults and counterfactual wallets that predict CREATE2 addresses.
- Token sales, vesting and payout contracts that send ETH.
- Bridge and messaging integrations that forward a fixed amount of gas to a callback, since gas costs move with `gasPerPubdataByte`.

## Which vulnerabilities matter most on ZKsync Era?

These five classes follow directly from the differences above.

- **Denial of service.** A payout that reverts on every call locks funds in place, which is what `transfer()` did to the Gemholic sale contract.
- **Reentrancy.** Swapping `transfer()` for `call` hands the recipient enough gas to call back in, so the fix needs a guard ([reentrancy](https://shield.quillaudits.com/learn/vulnerabilities/reentrancy/)).
- **Unchecked external call.** `call` returns false instead of reverting, and the ZKsync guide asks for an explicit success check.
- **Signature replay.** Smart accounts don't sign with one ECDSA key, so a check built only on `ecrecover` rejects them, and any replacement scheme needs nonces and a chain ID to stop replays.
- **Access control.** An `isContract` test or a `msg.sender == tx.origin` check meant to tell people from contracts gives the wrong answer when any account can run code ([access control](https://shield.quillaudits.com/learn/vulnerabilities/access-control/)).

## What should a reviewer check on ZKsync Era?

- Every `create` and `create2`, in Solidity and in assembly, and every address predicted from a salt or a nonce.
- Every `transfer()` and `send()`, replaced with `call`, a checked result and a reentrancy guard.
- Every signature check: does it accept smart accounts, and does it bind a nonce and the chain ID?
- Every `gasleft()` check and hardcoded gas amount, tested against a high `gasPerPubdataByte`.
- Any use of `EXTCODECOPY`, `address.code`, `SELFDESTRUCT` or `PREVRANDAO`.
- Which accounts use native account abstraction, and what they need to move to ERC-4337 on ZKsync OS.
- Tests built with zksolc that cover deployment, payouts and signature checks.

## How do you run QuillShield on a ZKsync Era project?

QuillShield audits Solidity in Foundry projects, and on ZKsync Era that means the source your team wrote, not the EraVM bytecode zksolc compiles from it.

1. Connect the GitHub or GitLab.com repository, or upload the Foundry project as a .zip of up to 50 MiB, with the contracts you deploy to ZKsync Era in scope.
2. Before the audit starts, add context that says the code compiles with zksolc for EraVM, which contracts are smart accounts or paymasters, and which factories predict CREATE2 addresses.
3. Read each finding with its exact lines, impact and recommended fix, and on a full audit its proof of concept result. A separate reviewer agent tries to disprove every finding before you see it.
4. Cover what a source review can't see with tests built by zksolc: deployment, CREATE2 addresses and the gas each ETH transfer gets.
5. Keep [pull request checks](https://www.quillaudits.com/quillshield/guides/guides/ci-cd-checks) on, so the move to ZKsync OS, and every change after it, is reviewed against the audit.

On the [pricing page](https://shield.quillaudits.com/pricing/), 1,000 lines of Solidity cost $379 as of November 2026, and you see the exact price before anything is charged. New accounts get $50 in credit, good for up to half of an order.

QuillShield does not replace a manual audit. For zksolc and EraVM behavior, or before a mainnet launch, [request a manual audit from QuillAudits](https://www.quillaudits.com/smart-contract-audit) or [talk to an auditor](https://calendly.com/akshadh-a-quillaudits/30min). To start on your own repo, [run a full audit](https://shield.quillaudits.com/register).

## FAQ

### Can QuillShield audit contracts compiled with zksolc?

It audits their Solidity source in a Foundry project. It does not analyze the EraVM bytecode that zksolc produces, so deployment, address and gas behavior need tests built with zksolc and, where it matters, a manual review.

### Is transfer() safe to use on ZKsync Era?

The ZKsync security guide advises against `transfer()` and `send()`, because their 2,300 gas stipend may not be enough. Use `call` with an explicit success check, update state first and add a reentrancy guard.

### Does CREATE2 give the same address on ZKsync Era as on Ethereum?

No, the ZKsync docs say the same bytecode gets a different address on ZKsync than on Ethereum, so a factory that predicts addresses with the Ethereum formula gets them wrong.

### What happens to my contracts when ZKsync Era moves off EraVM?

ZKsync said in September 2026 that EraVM chains will begin moving to ZKsync Atlas within six months, each on its own schedule. ZKsync OS is EVM equivalent but does not support native EraVM account abstraction, so smart accounts move to ERC-4337, and the changed code needs a fresh review.

## Sources

- [EVM instructions, ZKsync docs](https://docs.zksync.io/zksync-protocol/differences/evm-instructions) · checked 3 December 2026
- [Security and best practices, ZKsync docs](https://docs.zksync.io/zksync-network/zksync-era/security-best-practices) · checked 3 December 2026
- [Contract deployment, ZKsync docs](https://docs.zksync.io/zksync-protocol/era-vm/differences/contract-deployment) · checked 3 December 2026
- [Account abstraction, ZKsync docs](https://docs.zksync.io/zksync-protocol/era-vm/account-abstraction) · checked 3 December 2026
- [ZKsync OS FAQs, ZKsync docs](https://docs.zksync.io/zksync-network/zksync-os/faqs) · checked 3 December 2026
- [ZKsync Era ecosystem, ZKsync docs](https://docs.zksync.io/zksync-network/zksync-era/ecosystem) · checked 3 December 2026
- [General limitations, foundry-zksync book, Matter Labs](https://foundry-book.zksync.io/zksync-specifics/limitations/general) · checked 3 December 2026
- [zkSync bridge and .transfer/.send diff audit, OpenZeppelin](https://www.openzeppelin.com/news/zksync-bridge-and-.transfer-.send-diff-audit) · checked 3 December 2026
- [921 ETH stuck in zkSync Era: why transfer() fails, Digital Tails Group, on Coinmonks](https://medium.com/coinmonks/gemstoneido-contract-stuck-with-921-eth-an-analysis-of-why-transfer-does-not-work-on-zksync-era-d5a01807227d) · checked 3 December 2026
- [ZKsync EraVM deprecation: 6-month timeline, Our Crypto Talk](https://ourcryptotalk.com/news/zksync-eravm-deprecation-6-month-timeline) · checked 3 December 2026
