zemse / hardhat-tracer

🕵️ allows you to see internal calls, events and storage operations in the console
MIT License
339 stars 33 forks source link

Test tracer on zkSync Local node #56

Open vladikopl01 opened 12 months ago

vladikopl01 commented 12 months ago

Running tests with npx hardhat --network zkLocalhost --vvvv and npx hardhat --network zkLocalhost --fulltrace had same result without any trace displayed. Also, tried code block trace enabled through hre.tracer.enabled = true/false, but had same result.

Here is my hardhat config, if it helps:

import "@nomicfoundation/hardhat-chai-matchers";
import "@nomicfoundation/hardhat-network-helpers";
import "@nomiclabs/hardhat-ethers";
import "@nomiclabs/hardhat-etherscan";
import "@nomiclabs/hardhat-solhint";
import "@typechain/ethers-v5";
import "@typechain/hardhat";
import "hardhat-gas-reporter";
import "hardhat-tracer";

import "@openzeppelin/hardhat-upgrades";

import "@matterlabs/hardhat-zksync-chai-matchers";
import "@matterlabs/hardhat-zksync-deploy";
import "@matterlabs/hardhat-zksync-solc";
import "@matterlabs/hardhat-zksync-upgradable";
import "@matterlabs/hardhat-zksync-verify";

import { HardhatUserConfig } from "hardhat/config";

import { envConfig } from "./config";

const config: HardhatUserConfig = {
  solidity: {
    version: "0.8.20",
  },
  zksolc: {
    version: "latest",
    settings: {},
  },
  networks: {
    hardhat: {
      zksync: false,
    },
    goerli: {
      url: `https://goerli.infura.io/v3/${envConfig.INFURA_API_KEY}`,
      zksync: false,
    },
    zkTestnet: {
      url: "https://testnet.era.zksync.dev",
      ethNetwork: "goerli",
      zksync: true,
      verifyURL:
        "https://zksync2-testnet-explorer.zksync.dev/contract_verification",
    },
    zkLocalhost: {
      url: "http://localhost:3050",
      ethNetwork: "hardhat",
      zksync: true,
    },
  },
  etherscan: {
    apiKey: envConfig.ETHERSCAN_API_KEY,
  },
  typechain: {
    outDir: "typechain",
    target: "ethers-v5",
  },
  gasReporter: {
    enabled: envConfig.GAS_REPORTER,
    currency: "USD",
    coinmarketcap: envConfig.COINMARKETCAP_API_KEY || "",
    excludeContracts: ["contracts/mocks/"],
  },
};

export default config;
zemse commented 12 months ago

Looks like it uses a different VM than the standard EthereumJS's VM. Currently it'll be difficult to support zksync on the v2. I'm planning to work on v3 for the upcoming rethnet upgrade on hardhat, not sure if zksync would be supported by default but I can try to cover it.

For now you can maybe try using v1 of this plugin which should work if the zkLocalhost would support debug_traceTransaction. npm i hardhat-tracer@1 --save-dev

vladikopl01 commented 12 months ago

@zemse Thank you, will try it soon