Skip to content

Commit

Permalink
update deps
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuafernandes committed Mar 25, 2024
1 parent 9c5332c commit 611dadf
Show file tree
Hide file tree
Showing 12 changed files with 8,297 additions and 20,792 deletions.
91 changes: 10 additions & 81 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,88 +1,17 @@
module.exports = {
env: {
browser: true,
es2021: true,
},
extends: [
"plugin:react/recommended",
"airbnb-typescript",
"plugin:import/typescript",
// @NOTE: Make sure this is always the last element in the array.
"plugin:prettier/recommended",
],
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: 2020,
sourceType: "module",
ecmaFeatures: {
jsx: true,
},
project: ["./tsconfig.json"],
},
plugins: [
"react",
"react-hooks",
"jsx-a11y",
"import",
"prettier",
"@typescript-eslint",
"plugin:@docusaurus/recommended",
],
settings: {
react: {
pragma: "React", // Pragma to use, default to "React"
fragment: "Fragment", // Fragment to use (may be a property of <pragma>), default to "Fragment"
version: "detect", // React version. "detect" automatically picks the version you have installed.
// You can also use `16.0`, `16.3`, etc, if you want to override the detected value.
// default to latest and warns if missing
// It will default to "detect" in the future
},
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"],
},
"import/resolver": {
typescript: {},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
},
project: ["./tsconfig.json"]
},
rules: {
"import/prefer-default-export": 0,
"react/prop-types": 0,
"import/no-unresolved": [
"error",
{ ignore: ["^@theme", "^@docusaurus", "^@site"] },
],
"no-nested-ternary": 0,
"no-console": 0,
"no-unused-vars": 0,
"no-use-before-define": 0,
"arrow-body-style": 0,
"jsx-a11y/anchor-is-valid": 0,
"jsx-a11y/no-static-element-interactions": 0,
"jsx-a11y/click-events-have-key-events": 0,
"@typescript-eslint/no-unused-expressions": 0,
"@typescript-eslint/no-unused-vars": ["warn", { args: "none" }],
"@typescript-eslint/no-use-before-define": "warn",
"react/require-default-props": 0,
"react/jsx-props-no-spreading": 0,
"react/button-has-type": 0,
"jsx-a11y/label-has-associated-control": [
"error",
{
labelComponents: [],
labelAttributes: [],
controlComponents: [],
assert: "either",
depth: 2,
},
],
"@typescript-eslint/naming-convention": [
"error",
{
selector: "variableLike",
leadingUnderscore: "forbid",
trailingUnderscore: "forbid",
format: ["camelCase", "PascalCase", "UPPER_CASE"],
},
],
"import/extensions": 0,
'@docusaurus/no-untranslated-text': 0
},
};
};
24 changes: 8 additions & 16 deletions .stylelintrc.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
module.exports = {
extends: ["stylelint-config-standard", "stylelint-config-prettier"],
rules: {
"selector-pseudo-class-no-unknown": [
true,
{
// :global is a CSS modules feature to escape from class name hashing
ignorePseudoClasses: ["global"],
},
],
"extends": "stylelint-config-standard",
"rules": {
"selector-class-pattern": null,
"custom-property-empty-line-before": null,
"selector-id-pattern": null,
"declaration-empty-line-before": null,
"comment-empty-line-before": null,
"value-keyword-case": ["lower", { camelCaseSvgKeywords: true }],
},
};
"comment-empty-line-before" : null,
"media-feature-range-notation": null,
"selector-anb-no-unmatchable": null,
"declaration-block-no-duplicate-properties": null
}
}
13 changes: 8 additions & 5 deletions docs/HowTo/prove.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ title: Create and verify proofs
description: How to create and verify proofs
sidebar_position: 5
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

# Create and verify a `Proof`

Expand All @@ -22,9 +24,8 @@ Supported zk-SNARK backends are under `gnark/backend`. `gnark` currently impleme

:::info Use a zk-SNARK back end

<!--tabs-->

# Groth16
<Tabs>
<TabItem value="Groth16" label="Groth16" >

```go
// 1. One time setup
Expand All @@ -38,7 +39,8 @@ err := groth16.Verify(proof, vk, publicWitness)

```

# PlonK
</TabItem>
<TabItem value="PlonK" label="PlonK" >

```go
// 1. One time setup
Expand All @@ -52,7 +54,8 @@ err := plonk.Verify(proof, publicData, publicWitness)

```

<!--/tabs-->
</TabItem>
</Tabs>

:::

Expand Down
19 changes: 12 additions & 7 deletions docs/HowTo/write/standard_library.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ title: Standard library
description: gnark standard library
sidebar_position: 4
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

# `gnark` standard library

We provide the following functions in `gnark/std`:

<!--tabs-->

# MiMC hash
<Tabs>
<TabItem value="MiMC hash" label="MiMC hash" >

```go
func (circuit *mimcCircuit) Define(api frontend.API) error {
Expand All @@ -21,7 +22,8 @@ func (circuit *mimcCircuit) Define(api frontend.API) error {
}
```

# EdDSA signature verification
</TabItem>
<TabItem value="EdDSA signature verification" label="EdDSA signature verification" >

```go
type eddsaCircuit struct {
Expand All @@ -39,7 +41,8 @@ func (circuit *eddsaCircuit) Define(api frontend.API) error {
}
```

# Merkle proof verification
</TabItem>
<TabItem value="Merkle proof verification" label="Merkle proof verification" >

```go
type merkleCircuit struct {
Expand All @@ -54,7 +57,8 @@ func (circuit *merkleCircuit) Define(api frontend.API) error {
}
```

# zk-SNARK verifier
</TabItem>
<TabItem value="zk-SNARK verifier" label="zk-SNARK verifier" >

Enables verifying a _BLS12_377_ Groth16 `Proof` inside a _BW6_761_ circuit

Expand All @@ -73,4 +77,5 @@ func (circuit *verifierCircuit) Define(api frontend.API) error {
}
```

<!--/tabs-->
</TabItem>
</Tabs>
19 changes: 12 additions & 7 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ title: gnark
description: gnark is a fast, open-source zk-SNARK library written in Go
slug: overview
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

# gnark

Expand Down Expand Up @@ -41,9 +43,8 @@ Users write their zk-SNARK circuits in plain Go. `gnark` uses Go because:

:::info Example of how to prove knowledge of a pre-image

<!--tabs-->

# 1. define circuit
<Tabs>
<TabItem value="define circuit" label="define circuit" >

```go
// Circuit defines a pre-image knowledge proof
Expand All @@ -66,14 +67,16 @@ func (circuit *Circuit) Define(api frontend.API) error {
}
```

# 2. compile circuit
</TabItem>
<TabItem value="compile circuit" label="compile circuit" >

```go
var mimcCircuit Circuit
r1cs, err := frontend.Compile(ecc.BN254, r1cs.NewBuilder, &mimcCircuit)
```

# 3. create proof
</TabItem>
<TabItem value="create proof" label="create proof" >

```go
// witness
Expand All @@ -88,7 +91,8 @@ proof, err := groth16.Prove(r1cs, pk, witness)
err := groth16.Verify(proof, vk, publicWitness)
```

# 4. unit test
</TabItem>
<TabItem value="unit test" label="unit test" >

```go
assert := groth16.NewAssert(t)
Expand All @@ -111,7 +115,8 @@ var mimcCircuit Circuit

```

<!--/tabs-->
</TabItem>
</Tabs>

:::

Expand Down
7 changes: 4 additions & 3 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const lightCodeTheme = require("prism-react-renderer/themes/github");
const darkCodeTheme = require("prism-react-renderer/themes/dracula");
const fs = require("fs");
const lightCodeTheme = require("prism-react-renderer").themes.github;
const darkCodeTheme = require("prism-react-renderer").themes.dracula;

const math = require("remark-math");
const katex = require("rehype-katex");
Expand Down Expand Up @@ -45,7 +46,7 @@ const config = {
path: "docs",
// @ts-ignore
// eslint-disable-next-line global-require
remarkPlugins: [require("remark-docusaurus-tabs"), math],
remarkPlugins: [math],
rehypePlugins: [katex],
include: ["**/*.md", "**/*.mdx"],
exclude: [
Expand Down
Loading

0 comments on commit 611dadf

Please sign in to comment.