Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

P256Verify setup for testnet deployment #203

Open
wants to merge 27 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions p256verify/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
WALLET_PRIVATE_KEY=
61 changes: 61 additions & 0 deletions p256verify/.github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Contributing to zkSync Hardhat project template

## Warm Welcome! 🎉

Hello there, awesome contributor! We're delighted you're considering helping with our project. This guide is here to show you the ropes and make your contribution process smooth.

## Starting Off

- **Fork it.** Kick things off by forking our repository to your personal GitHub account.

- **Get it local.** Next, let's get the project onto your computer:

```bash
git clone https://github.com/<your-github-username>/my-project.git
```

- **Branch out.** Create a new branch, preferably with a descriptive name related to your planned contribution:

```bash
git checkout -b feature-or-fix-description
```

## Making Your Mark

- **Code away.** As you write, aim for clarity and simplicity. It's best for everyone.

- **Test your code.** Before putting it out for review, ensure everything runs as expected. Here's how:

```bash
yarn test
```

- **Commit wisely.** Opt for clear commit messages that convey the essence of your changes.

- **Push it up.** Time to push your branch to GitHub:

```bash
git push origin feature-or-fix-description
```

## Crafting a Pull Request

- **Propose your changes.** Head to our repository on GitHub. There, you should spot a "Compare & pull request" button. Click it and describe what you did and why.

- **Await our feedback.** Our team will scrutinize what you've done. Be open to potential tweaks or changes.

Keep in mind, we run automated checks on contributions. Ensure you clear these checks before submission!

## Need Assistance?

Got queries or hurdles? Feel free to initiate a discussion on our [Project Community Hub](https://github.com/Project-Community-Hub/Project-Developers/discussions). We're eager to assist!

## A Big Thank You!

Once we integrate your changes, please know that your contribution holds immense value for us. You're helping us elevate our project.

We sincerely hope you had a pleasant experience and consider returning for more contributions. Thank you for teaming up with us!

---

*Last update: October 25, 2023*
45 changes: 45 additions & 0 deletions p256verify/.github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
name: Bug report
about: Use this template for reporting issues
title: ""
labels: bug
assignees: ''

---

### 🐛 Bug Report for zkSync Hardhat project template
#### 📝 Description

Provide a clear and concise description of the bug.

#### 🔄 Reproduction Steps

1. Step 1
2. Step 2
3. ...

#### 🤔 Expected Behavior

Describe what you expected to happen.

#### 😯 Current Behavior

Describe what actually happened.

#### 🖥️ Environment

- **Package version**: [e.g., 1.2.1]
- **Node version**: [e.g., node v16.14.0]
- **NPM/Yarn version**: [e.g., npm 8.3.1]
- **Operating System & Version**: [e.g., Ubuntu 20.04]
- **Other 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.
```
8 changes: 8 additions & 0 deletions p256verify/.github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
blank_issues_enabled: true
contact_links:
- name: zksync-developers Discussion
url: https://github.com/zkSync-Community-Hub/zkync-developers/discussions
about: Please provide feedback, and ask questions here.
- name: zkSync Hardhat documentation
url: https://era.zksync.io/docs/tools/hardhat/
about: Please refer to the documentation for immediate answers.
26 changes: 26 additions & 0 deletions p256verify/.github/ISSUE_TEMPLATE/feature_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
name: Feature request
about: Use this template for requesting features
title: ""
labels: feat
assignees: ''

---

### 🌟 Feature Request

#### 📝 Description

Provide a clear and concise description of the feature you'd like to see.

#### 🤔 Rationale

Explain why this feature is important and how it benefits the project.

#### 🖼️ Mockups/Examples

If applicable, provide mockups or examples of how the feature would work.

#### 📋 Additional Context

Add any other context or information about the feature request here.
17 changes: 17 additions & 0 deletions p256verify/.github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# What :computer:
* First thing updated with this PR
* Second thing updated with this PR
* Third thing updated with this PR

# Why :hand:
* Reason why first thing was added to PR
* Reason why second thing was added to PR
* Reason why third thing was added to PR

# Evidence :camera:
Include screenshots, screen recordings, or `console` output here demonstrating that your changes work as intended

<!-- All sections below are optional. You can erase any section not applicable to your Pull Request. -->

# Notes :memo:
* Any notes/thoughts that the reviewers should know prior to reviewing the code?
24 changes: 24 additions & 0 deletions p256verify/.github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Tests

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
tests:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "lts/*"
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Run tests
run: yarn test
113 changes: 113 additions & 0 deletions p256verify/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.vscode

# hardhat artifacts
artifacts
cache

# zksync artifacts
artifacts-zk
cache-zk

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# Next.js build output
.next

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and *not* Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port
21 changes: 21 additions & 0 deletions p256verify/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Matter Labs

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
39 changes: 39 additions & 0 deletions p256verify/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
.PHONY: compile deploy

setup:
yarn install

run-node:
cd .. && make run

compile-verifier:
python3 scripts/compile_p256verify_precompile.py

deploy-verifier-local: compile-verifier
yarn hardhat deploy-zksync --script deploy/deploy.ts --network inMemoryNode

deploy-verifier-testnet: compile-verifier
yarn hardhat deploy-zksync --script deploy/deploy.ts --network zkSyncTestnet

compile-validator:
yarn hardhat compile

deploy-validator-local: compile-validator
yarn hardhat deploy-zksync --script deploy/deploy-validator.ts --network inMemoryNode

deploy-validator-testnet: compile-validator
yarn hardhat deploy-zksync --script deploy/deploy-validator.ts --network zkSyncTestnet

tx-output-testnet:
curl -X POST -H "Content-Type: application/json" \
--data '{"jsonrpc":"2.0", "id":2, "method": "debug_traceTransaction", "params": [ "${HASH}" ] }' \
"https://testnet.era.zksync.dev"

tx-output-local:
curl -X POST -H "Content-Type: application/json" \
--data '{"jsonrpc":"2.0", "id":2, "method": "debug_traceTransaction", "params": [ "${HASH}" ] }' \
"http://localhost:8011"

replay-tx:
cd ../submodules/era-test-node && \
cargo +nightly run -- --show-calls=all --resolve-hashes --show-gas-details=all replay_tx testnet ${HASH}
Loading