Giter Club home page Giter Club logo

Comments (8)

dutterbutter avatar dutterbutter commented on August 15, 2024 1

Thanks for the quick response! @cgewecke

I think its the second point outlined - "there's a way to hook into and monitor the EVM program "step" in order to detect instrumentation hashes" - that could be problematic as zkSync makes use of a zkEVM that is not bytecode equivalent but rather compatible.

Nonetheless it would be great to get your review / investigation. I setup this minimal example project you can run here: https://github.com/dutterbutter/min-solidity-coverage-test

To run:

  • git clone [email protected]:dutterbutter/min-solidity-coverage-test.git
  • yarn install
  • npx hardhat compile
  • npx hardhat coverage

---- update ----

The equivalent to the evm step in zkSync would be the after_execution tracer

from solidity-coverage.

cgewecke avatar cgewecke commented on August 15, 2024 1

@dutterbutter Great! Will take a look...

from solidity-coverage.

cgewecke avatar cgewecke commented on August 15, 2024

Hi @dutterbutter! Nice!

There's little bit of an "inner workings" summary in the docs at the API section...

Am not super familiar with the zkSync HH plugins but the basic pre-requisites for solidity-coverage are that:

  • the contracts are written in solidity and can be passed to some kind of compilation task
  • there's a way to hook into and monitor the EVM program "step" in order to detect instrumentation hashes solidity-coverage has injected into the code.

Do you have any links to the relevant zk tooling I could look at (to see if there are any obvious blockers or incompatibilities)?

from solidity-coverage.

cgewecke avatar cgewecke commented on August 15, 2024

@dutterbutter Some initial thoughts....

The simplest thing would be to use debug_traceTransaction and debug_traceCall to process the trace from the Hardhat side. You'd create a wrapped provider which overloaded ether'ssendTransaction and send methods to fetch the traces and pass those to solidity-coverage's collector etc. (I'm assuming there are no issues with instrumentation getting stripped out by the zk compiler - haven't verified that though)

This would be easy if zksync era implemented geth's custom tracer but it seems like only callTracer is enabled and that doesn't contain the necessary data. (We need to inspect the top of the evm stack as each PUSH, SWAP and DUP opcode executes.)

I see you've linked to the client codebase - are you open to taking a PR which creates a tracer type that would expose this info? In its simplest form it would just be a "coverageTracer" to get solidity-coverage working rather than something all-purpose like geth's. (Happy to work on this fwiw).

Not sure about other options but open to any ideas. Architecturally it's a little tricky because the client is in another process and that gap has to be bridged somehow.

Also please just lmk if I've missed something and the info is obtainable via an rpc endpoint somewhere...

from solidity-coverage.

dutterbutter avatar dutterbutter commented on August 15, 2024

@cgewecke really appreciate the analysis here. We are discussing internally and will post back here.

from solidity-coverage.

cgewecke avatar cgewecke commented on August 15, 2024

@dutterbutter SGTM!

from solidity-coverage.

Armankhan566 avatar Armankhan566 commented on August 15, 2024

Zksync is a history

from solidity-coverage.

Armankhan566 avatar Armankhan566 commented on August 15, 2024

Good

from solidity-coverage.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.