Skip to content

Commit 4950861

Browse files
authored
Formatting and Linting (#1)
1 parent 8698618 commit 4950861

14 files changed

+2227
-105
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Lint and Format Checks
2+
3+
on:
4+
pull_request:
5+
workflow_dispatch:
6+
7+
jobs:
8+
lint-and-format:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v4
14+
15+
- name: Setup Node.js
16+
uses: actions/setup-node@v4
17+
with:
18+
node-version: '20'
19+
20+
- name: Install pnpm
21+
uses: pnpm/action-setup@v4
22+
with:
23+
version: 9.15.0
24+
25+
- name: Install dependencies
26+
run: pnpm install
27+
28+
- name: Setup Noir
29+
run: |
30+
curl -L https://raw.githubusercontent.com/noir-lang/noirup/main/install | bash
31+
echo "$HOME/.nargo/bin" >> $GITHUB_PATH
32+
33+
- name: Install Nargo
34+
run: |
35+
noirup --version 1.0.0-beta.16
36+
37+
- name: Run format check
38+
run: pnpm run format:check
39+
40+
- name: Run linters
41+
run: pnpm run lint

.prettierrc.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"plugins": ["prettier-plugin-solidity"],
3+
"overrides": [
4+
{
5+
"files": "*.sol",
6+
"options": {
7+
"printWidth": 80,
8+
"tabWidth": 4,
9+
"useTabs": false,
10+
"singleQuote": false,
11+
"bracketSpacing": true
12+
}
13+
}
14+
]
15+
}

.solhintrc.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"plugins": ["prettier"],
3+
"extends": "solhint:recommended",
4+
"excludedFiles": ["contracts/*Verifier.sol"],
5+
"rules": {
6+
"prettier/prettier": "error",
7+
"quotes": ["error", "double"],
8+
"no-inline-assembly": "",
9+
"no-global-import": "error",
10+
"no-empty-blocks": "",
11+
"reason-string": "error",
12+
"func-visibility": [
13+
"warn",
14+
{
15+
"ignoreConstructors": true
16+
}
17+
],
18+
"avoid-low-level-calls": "",
19+
"no-unused-vars": "error"
20+
}
21+
}

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,3 @@ pnpm test-verifiers
4646
3. **Generate verifiers** with `pnpm generate-solidity-verifiers`
4747
4. **Create test proofs** with `pnpm generate-mock-proofs`
4848
5. **Run tests** with `pnpm test-verifiers`
49-

contracts/interfaces/IVerifier.sol

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,8 @@
22
pragma solidity ^0.8.27;
33

44
interface IVerifier {
5-
function verify(bytes calldata proof, bytes32[] calldata publicInputs) external returns (bool);
5+
function verify(
6+
bytes calldata proof,
7+
bytes32[] calldata publicInputs
8+
) external returns (bool);
69
}

package.json

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,17 @@
55
"author": "CardinalCryptography",
66
"license": "",
77
"packageManager": "pnpm@9.15.0",
8-
"dependencies": {
9-
"@aztec/bb.js": "3.0.0-nightly.20251104",
10-
"@noir-lang/noir_js": "1.0.0-beta.16",
8+
"devDependencies": {
9+
"forge-std": "github:foundry-rs/forge-std#v1.12.0",
1110
"@openzeppelin/contracts": "=5.5.0",
1211
"@openzeppelin/contracts-upgradeable": "=5.5.0",
13-
"@zkpassport/poseidon2": "^0.6.2"
14-
},
15-
"devDependencies": {
12+
"openzeppelin-foundry-upgrades": "github:OpenZeppelin/openzeppelin-foundry-upgrades#v0.4.0",
13+
"@aztec/bb.js": "3.0.0-nightly.20251104",
14+
"@noir-lang/noir_js": "1.0.0-beta.16",
15+
"@zkpassport/poseidon2": "^0.6.2",
1616
"@types/node": "^24.10.1",
17-
"forge-std": "github:foundry-rs/forge-std#v1.12.0",
18-
"openzeppelin-foundry-upgrades": "github:OpenZeppelin/openzeppelin-foundry-upgrades#v0.3.6",
1917
"prettier": "^3.2.5",
20-
"prettier-plugin-solidity": "^2.2.0",
18+
"prettier-plugin-solidity": "^1.0.0",
2119
"solhint-community": "^4.0.1",
2220
"solhint-plugin-prettier": "^0.1.0",
2321
"ts-node": "10.9.2",
@@ -27,6 +25,11 @@
2725
"compile-circuits": "nargo compile",
2826
"generate-solidity-verifiers": "ts-node ./scripts/generate-solidity-verifiers.ts",
2927
"generate-mock-proofs": "ts-node ./scripts/generate-mock-proofs.ts",
30-
"test-verifiers": "forge test --gas-report"
28+
"test-verifiers": "forge test --gas-report",
29+
"lint": "pnpm run lint:sol && pnpm run lint:noir",
30+
"lint:sol": "solhint 'contracts/**/*.sol'",
31+
"lint:noir": "nargo check",
32+
"format": "prettier --write '**/*.{ts,sol,json,md}' && nargo fmt",
33+
"format:check": "prettier --check '**/*.{ts,sol,json,md}' && nargo fmt --check"
3134
}
3235
}

0 commit comments

Comments
 (0)