Skip to content

Commit

Permalink
Implementation of tx circuit (shortcut 1) (privacy-scaling-exploratio…
Browse files Browse the repository at this point in the history
…ns#484)

* Implement Tx Circuit (shortcut 1)

Implement the Tx Circuit as specified in
https://github.com/appliedzkp/zkevm-specs/blob/master/specs/transactions-proof.md#circuit-behaviour-shortcut-1

This implementation uses ~205 columns and ~170k rows per transaction.

New dependencies to the zkevm-circuits subcrate:
- `halo2wrong` subcrates.  This is where the ECDSA verification chip is
  implemented.  This dependency uses `halo2` and this means that we'll
  require the version of `halo2` used in `halo2wrong` and
  `zkevm-circuits` to match.
- `group`: Required for field and curve traits
- `libsecp256k1`: Requiered to perform the ECDSA public key recovery
  with access to the public key coordinates.
- `rlp`: Required to calculate the RLP of the transaction to get the
  transaction hash (to sign)
- `num-bigint`: Used to hold an integer bigger than the field, to latter
  apply mod Fq (this is required for the message hash in the ECDSA
  signature operation)
- `subtle`: Used to map `CtOption` to `Result`

* Split light and heavy tests; run heavy tests serially

* Address some comments from Carlos

* Document power of randomness expression trick

* Reuse geth_types::Transaction in tx_circuit

* Remove unused function

* Move random_linear_combine fn to utils

* Address comments from Adria

* Remove unused function

* Address comments from Adria v2

* Address comments from ChihChengLiang

* Address comments from ChihChengLiang v2

* Fix

* Add more tests

Co-authored-by: adria0.eth <[email protected]>
  • Loading branch information
ed255 and adria0 authored May 31, 2022
1 parent 394f3d6 commit e4b3319
Show file tree
Hide file tree
Showing 11 changed files with 1,855 additions and 30 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,16 @@ jobs:
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Run tests
- name: Run light tests # light tests are run in parallel
uses: actions-rs/cargo@v1
with:
command: test
args: --verbose --release --all --all-features --exclude integration-tests --exclude circuit-benchmarks
- name: Run heavy tests # heavy tests are run serially to avoid OOM
uses: actions-rs/cargo@v1
with:
command: test
args: --verbose --release --all --all-features --exclude integration-tests --exclude circuit-benchmarks serial_ -- --ignored --test-threads 1

build:
if: github.event.pull_request.draft == false
Expand Down
Loading

0 comments on commit e4b3319

Please sign in to comment.