Skip to content

Commit

Permalink
Merge pull request #77 from noir-lang/jc/update-foundry
Browse files Browse the repository at this point in the history
update to 0.27
  • Loading branch information
signorecello authored May 15, 2024
2 parents 80282b2 + 358f3f1 commit abc3641
Show file tree
Hide file tree
Showing 17 changed files with 1,498 additions and 891 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/vite_hardhat.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,8 @@ jobs:
run: yarn --immutable
shell: bash

- name: Generate verifier contract
run: yarn prep

- name: Run test
run: yarn test
7 changes: 2 additions & 5 deletions vite-hardhat/.env.example
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# hardhat acct #0 key, please update
MUMBAI_DEPLOYER_PRIVATE_KEY="0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"
MUMBAI_ALCHEMY_KEY=""
# hardhat acct #0 key, please update
SEPOLIA_DEPLOYER_PRIVATE_KEY="0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"
SEPOLIA_ALCHEMY_KEY=""
SEPOLIA_SCROLL_DEPLOYER_PRIVATE_KEY="0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"
SEPOLIA_SCROLL_ETHERSCAN_KEY=""
2 changes: 1 addition & 1 deletion vite-hardhat/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,5 @@ crs
artifacts
.yarn/

circuits/target
circuit/target/
dist
2 changes: 1 addition & 1 deletion vite-hardhat/circuit/Nargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
name = "noirstarter"
type = "bin"
authors = [""]
compiler_version = ">0.19.0"
compiler_version = ">=0.27.0"

[dependencies]
322 changes: 115 additions & 207 deletions vite-hardhat/circuit/contract/noirstarter/plonk_vk.sol

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion vite-hardhat/circuit/target/noirstarter.json

This file was deleted.

29 changes: 19 additions & 10 deletions vite-hardhat/hardhat.config.cts
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,30 @@ const config: HardhatUserConfig = {
},
},
paths: {
root: './',
sources: './circuit',
},
};

if (process.env.MUMBAI_ALCHEMY_KEY && config.networks) {
config.networks.mumbai = {
url: `https://polygon-mumbai.g.alchemy.com/v2/${process.env.MUMBAI_ALCHEMY_KEY}`,
accounts: [process.env.MUMBAI_DEPLOYER_PRIVATE_KEY as string],
if (process.env.SEPOLIA_SCROLL_ETHERSCAN_KEY && config.networks) {
config.networks.scrollSepolia = {
url: 'https://sepolia-rpc.scroll.io',
accounts: [process.env.SEPOLIA_SCROLL_DEPLOYER_PRIVATE_KEY as string],
};
}

if (process.env.SEPOLIA_ALCHEMY_KEY && config.networks) {
config.networks.sepolia = {
url: `https://eth-sepolia.g.alchemy.com/v2/${process.env.SEPOLIA_ALCHEMY_KEY}`,
accounts: [process.env.SEPOLIA_DEPLOYER_PRIVATE_KEY as string],
config.etherscan = {
apiKey: {
scrollSepolia: process.env.SEPOLIA_SCROLL_ETHERSCAN_KEY,
},
customChains: [
{
network: 'sccrollSepolia',
chainId: 534352,
urls: {
apiURL: 'https://api-sepolia.scrollscan.com/api',
browserURL: 'https://sepolia.scrollscan.com/',
},
},
],
};
}

Expand Down
2 changes: 1 addition & 1 deletion vite-hardhat/hooks/useOnChainVerification.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ProofData } from '@noir-lang/types';
import { useAccount, useConnect, useContractRead } from 'wagmi';
import { contractCallConfig } from '../utils/wagmi.jsx';
import { config, contractCallConfig } from '../utils/wagmi.jsx';
import { bytesToHex } from 'viem';
import { useEffect, useState } from 'react';
import { Id, toast } from 'react-toastify';
Expand Down
18 changes: 11 additions & 7 deletions vite-hardhat/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"scripts": {
"prep": "cd circuit && nargo codegen-verifier",
"dev": "yarn prep && hardhat compile && yarn deploy && vite",
"build": "hardhat compile && yarn deploy && vite build",
"build": "yarn deploy && vite build",
"preview": "vite preview",
"deploy": "hardhat compile && NODE_OPTIONS='--experimental-loader ts-node/esm/transpile-only' hardhat run --network ${NETWORK:-localhost} scripts/deploy.ts",
"test": "NODE_OPTIONS='--experimental-loader ts-node/esm/transpile-only' hardhat test"
Expand All @@ -16,16 +16,16 @@
"@noir-lang/noir_js": "^0.25.0",
"@noir-lang/noir_wasm": "^0.25.0",
"@noir-lang/types": "^0.25.0",
"@nomicfoundation/hardhat-network-helpers": "^1.0.0",
"@nomicfoundation/hardhat-toolbox-viem": "1.0.0",
"@nomicfoundation/hardhat-viem": "1.0.0",
"dotenv": "^16.0.3",
"hardhat": "^2.19.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-toastify": "^9.1.1",
"typechain": "^8.1.0",
"viem": "1.16.6"
"viem": "2.*",
"wagmi": "^2.8.7",
"@tanstack/query-sync-storage-persister": "5.0.5",
"@tanstack/react-query": ">=5.35.1",
"@tanstack/react-query-persist-client": "5.0.5"
},
"devDependencies": {
"@nomicfoundation/hardhat-chai-matchers": "^2.0.2",
Expand All @@ -41,7 +41,11 @@
"ts-node": "^10.9.1",
"typescript": "^4.9.3",
"vite": "^5.0.6",
"wagmi": "^1.4.8"
"@nomicfoundation/hardhat-network-helpers": "^1.0.0",
"@nomicfoundation/hardhat-toolbox-viem": "1.0.0",
"@nomicfoundation/hardhat-viem": "1.0.0",
"typechain": "^8.1.0",
"@tanstack/react-query-devtools": "5.0.5"
},
"engines": {
"node": "^20.10.0"
Expand Down
2 changes: 1 addition & 1 deletion vite-hardhat/utils/addresses.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"chainId":31337,"verifier":"0x5fbdb2315678afecb367f032d93f642f64180aa3"}
{"chainId":534351,"verifier":"0x6b38bbe0448f11f50c095547c8aa3526ebc95daa"}
20 changes: 7 additions & 13 deletions vite-hardhat/utils/wagmi.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
import { createConfig, configureChains } from 'wagmi';
import { localhost, polygonMumbai, sepolia } from 'wagmi/chains';
import { publicProvider } from 'wagmi/providers/public';
import { MetaMaskConnector } from 'wagmi/connectors/metaMask';
import { http, createConfig } from 'wagmi';
import { localhost, scrollSepolia } from 'wagmi/chains';
import abi from './verifierAbi.json';
import { chainId, verifier } from './addresses.json';

const { chains, publicClient, webSocketPublicClient } = configureChains(
[localhost, polygonMumbai, sepolia],
[publicProvider()],
);

export const config = createConfig({
autoConnect: true,
connectors: [new MetaMaskConnector({ chains })],
publicClient,
webSocketPublicClient,
chains: [localhost, scrollSepolia],
transports: {
[localhost.id]: http(),
[scrollSepolia.id]: http(),
},
});

export const contractCallConfig = {
Expand Down
Loading

0 comments on commit abc3641

Please sign in to comment.