Git Product home page Git Product logo

era-zkevm_test_harness's Introduction

zkSync Era: A ZK Rollup For Scaling Ethereum

Logo

zkSync Era is a layer 2 rollup that uses zero-knowledge proofs to scale Ethereum without compromising on security or decentralization. Since it's EVM compatible (Solidity/Vyper), 99% of Ethereum projects can redeploy without refactoring or re-auditing a single line of code. zkSync Era also uses an LLVM-based compiler that will eventually let developers write smart contracts in C++, Rust and other popular languages.

How to use

This repo contains a mixture of witness generation harness (that runs block's code and produces circuit-specific witness parts) and basic examples of full block proof workflow execution, that is:

  • create a necessary number of circuits of each unique basic type (so called scheduling)
  • aggreagte proofs over them
  • run the final state "scheduler" circuit that verifies logical validity of scheduling (feeding outputs to inputs) and attest that aggregation is a result of recursive verification of the scheduled sequence

It's easy to run

Get some modern Rust version (at least that supports Rust 2021 and const generics, but usually latest nightly is also a good option) and run

cargo test basic_test  --release -- --nocapture

It may be a little verbose, but it's a full end to end test that:

  • sets up basic environment - empty state tree with added "system" level contracts
  • creates some dummy information about previous state of the chain (only state root is necessary)
  • runs a contract from https://github.com/vladbochok/test-contract as from address 0x8001 that is a contract call without a calldata and particular meaning, but touches the most interesting parts of the system: external calls, reverts, precompiles, storage access, events, L2 to L1 messages
  • produces witness
  • makes as many circuits as needed given some (arbitrary) set of capacity parameters of the form "principal operations per circuit of type T"
  • generated verification keys for both basic circuits, recursive aggregation circuits, and "scheduler"
  • makes proofs of every stage - basic circuits -> aggregation (leafs and nodes) -> scheduler
  • each proof is verified against the corresponding verification key on creation

One can see a lot of .json files in the setup and test_proofs folders. Those are all the intermediate proofs, and if proof exists then example script will skip it's recomputation (whether it's a proof or verification key). So to run the full workflow one can remove all of those, or some of those.

Running regeneration of setup files

Will regenerate setup parameters (geometry, verification keys, finalization hints and padding proofs)

cargo run --release --bin geometry_config_generator
cargo test --release test_run_create_base_layer_vks_and_proofs
cargo test --release test_run_create_recursion_layer_vks_and_proofs

License

zkSync Era is distributed under the terms of either

at your option.

Official Links

Disclaimer

zkSync Era has been through lots of testing and audits. Although it is live, it is still in alpha state and will go through more audits and bug bounties programs. We would love to hear our community's thoughts and suggestions about it! It is important to state that forking it now can potentially lead to missing important security updates, critical features, and performance improvements.

era-zkevm_test_harness's People

Contributors

0xvolosnikov avatar aikixd avatar akash-chandrakar avatar antond3 avatar emilluta avatar hatemosphere avatar joonazan avatar jules avatar koloz193 avatar mm-zk avatar olesholem avatar perekopskiy avatar shahar4 avatar shamatar avatar stanislavbreadless avatar vladbochok avatar yorik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

era-zkevm_test_harness's Issues

missing `report_new_callstack_frame` in implementation

I am following https://github.com/matter-labs/zksync-era/blob/main/docs/development.md for local development. However, when I run zk init, I got error

error[E0046]: not all trait items implemented, missing: `report_new_callstack_frame`
    --> /Users/<redacted>/.cargo/git/checkouts/era-zkevm_test_harness-22d97ff2abf02d7d/cfac36a/src/witness/oracle.rs:1250:1
     |
1250 | impl<E: Engine> WitnessOracle<E> for VmWitnessOracle<E> {
     | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `report_new_callstack_frame` in implementation
     |
     = help: implement the missing item: `fn report_new_callstack_frame(&mut self, _: &ExecutionContextRecord<E>, _: sync_vm::vm::primitives::UInt32<E>, _: &sync_vm::franklin_crypto::plonk::circuit::boolean::Boolean, _: &sync_vm::franklin_crypto::plonk::circuit::boolean::Boolean) { todo!() }`

After digging into it, I found it's caused by matter-labs/era-sync_vm@5aedffa

it added

image

but it's not implemented in WitnessOracle (https://github.com/matter-labs/era-zkevm_test_harness/blob/main/src/witness/oracle.rs)

No permission to push code to this repo

🌟 Feature Request

πŸ“ Description

I want to optimize some methods of this repository, but I don’t have permission to push code. Can you release the push permission of this repo?

test harness is failing with below error

πŸ› Bug Report

image

πŸ“ Description

Provide a clear and concise description of the bug.
It seems to be a type mismatch or wrong type while running the test harness usinge the command provided in readme. version used 1.3.2

πŸ”„ Reproduction Steps

clone the repo. get the key and run cargo test basic_test --release -- --nocapture . Latest version of Rust is used.

Steps to reproduce the behaviour

πŸ€” Expected Behavior

Describe what you expected to happen.

😯 Current Behavior

Describe what actually happened.

πŸ–₯️ Environment

Any relevant environment details.

πŸ“‹ Additional Context

Add any other context about the problem here. If applicable, add screenshots to help explain.

πŸ“Ž Log Output

Paste any relevant log output here.

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.