Skip to content

Commit

Permalink
add v3 groth16 verifiers to groth16 gateway
Browse files Browse the repository at this point in the history
  • Loading branch information
mattstam committed Nov 1, 2024
1 parent 6ca2ecb commit a20d010
Show file tree
Hide file tree
Showing 14 changed files with 27 additions and 23 deletions.
24 changes: 14 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ pragma solidity ^0.8.20;
import {ISP1Verifier} from "@sp1-contracts/ISP1Verifier.sol";
contract MyContract {
address public constant SP1_VERIFIER = 0x3B6041173B80E77f038f3F2C0f9744f04837185e;
address public constant SP1_VERIFIER = 0x3B6041173B80E77f038f3F2C0f9744f04837185e;
bytes32 public constant PROGRAM_VKEY = ...;
bytes32 public constant PROGRAM_VKEY = ...;
function myFunction(..., bytes calldata publicValues, bytes calldata proofBytes) external {
ISP1Verifier(SP1_VERIFIER).verifyProof(PROGRAM_VKEY, publicValues, proofBytes);
}
function myFunction(..., bytes calldata publicValues, bytes calldata proofBytes) external {
ISP1Verifier(SP1_VERIFIER).verifyProof(PROGRAM_VKEY, publicValues, proofBytes);
}
}
```

Expand All @@ -49,26 +49,30 @@ To deploy the contracts, ensure your [.env](./contracts/.env.example) file is co
Then you can use the `forge script` command and specify the specific contract you want to deploy. For example, to deploy the SP1 Verifier Gateway for PLONK you can run:

```bash
FOUNDRY_PROFILE=deploy forge script ./script/deploy/SP1VerifierGatewayPlonk.s.sol:SP1VerifierGatewayPlonkScript --private-key $PRIVATE_KEY --verify --verifier etherscan --multi --broadcast
FOUNDRY_PROFILE=deploy forge script ./script/deploy/SP1VerifierGatewayPlonk.s.sol:SP1VerifierGatewayScript --private-key $PRIVATE_KEY --verify --verifier etherscan --multi --broadcast
```

or to deploy the SP1 Verifier Gateway for Groth16 you can run:

```bash
FOUNDRY_PROFILE=deploy forge script ./script/deploy/SP1VerifierGatewayGroth16.s.sol:SP1VerifierGatewayGroth16Script --private-key $PRIVATE_KEY --verify --verifier etherscan --multi --broadcast
FOUNDRY_PROFILE=deploy forge script ./script/deploy/SP1VerifierGatewayGroth16.s.sol:SP1VerifierGatewayScript --private-key $PRIVATE_KEY --verify --verifier etherscan --multi --broadcast
```

### Adding Verifiers

To deploy a specific SP1 Verifier version and add it to the gateway, run:
You can use the `forge script` command to specify which verifier you want to deploy and add to the gateway. For example to deploy the PLONK verifier and add it to the PLONK gateway you can run:

```bash
FOUNDRY_PROFILE=deploy forge script ./script/deploy/v3.0.0/SP1VerifierPlonk.s.sol:SP1VerifierScript --private-key $PRIVATE_KEY --verify --verifier etherscan --multi --broadcast
```

Change `v3.0.0` to the desired version to add.
or to deploy the Groth16 verifier and add it to the Groth16 gateway you can run:

To re-verify already existing deployments, remove the `--broadcast` flag.
```bash
FOUNDRY_PROFILE=deploy forge script ./script/deploy/v3.0.0/SP1VerifierGroth16.s.sol:SP1VerifierScript --private-key $PRIVATE_KEY --verify --verifier etherscan --multi --broadcast
```

Change `v3.0.0` to the desired version to add.

### Freezing Verifiers

Expand Down
2 changes: 1 addition & 1 deletion contracts/deployments/1.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
"V1_1_0_SP1_VERIFIER": "0xc350F063C13a3Ca21331610fe159E697a5c9c2FB",
"V1_2_0_SP1_VERIFIER_PLONK": "0x6B6A7Ded061567d8A56279801DEA5cFB79be5bFc",
"V2_0_0_SP1_VERIFIER_PLONK": "0x1764C29FBd94865198588f10FC75D4f6636d158d",
"V3_0_0_SP1_VERIFIER_GROTH16": "0x6A87EFd4e6B2Db1ed73129A8b9c51aaA583d49e3",
"V3_0_0_SP1_VERIFIER_GROTH16": "0xE780809121774D06aD9B0EEeC620fF4B3913Ced1",
"V3_0_0_SP1_VERIFIER_PLONK": "0xd2832Cf1fC8bA210FfABF62Db9A8781153131d16"
}
2 changes: 1 addition & 1 deletion contracts/deployments/10.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"SP1_VERIFIER_GATEWAY_PLONK": "0x3B6041173B80E77f038f3F2C0f9744f04837185e",
"V1_2_0_SP1_VERIFIER_PLONK": "0x6B6A7Ded061567d8A56279801DEA5cFB79be5bFc",
"V2_0_0_SP1_VERIFIER_PLONK": "0x1764C29FBd94865198588f10FC75D4f6636d158d",
"V3_0_0_SP1_VERIFIER_GROTH16": "0x6A87EFd4e6B2Db1ed73129A8b9c51aaA583d49e3",
"V3_0_0_SP1_VERIFIER_GROTH16": "0xE780809121774D06aD9B0EEeC620fF4B3913Ced1",
"V3_0_0_SP1_VERIFIER_PLONK": "0xd2832Cf1fC8bA210FfABF62Db9A8781153131d16"
}
2 changes: 1 addition & 1 deletion contracts/deployments/11155111.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
"V3_0_0_RC3_SP1_VERIFIER_PLONK": "0x31aeD863BecC509B9e16403c52C07560A0d4ecBf",
"V3_0_0_RC4_SP1_VERIFIER_GROTH16": "0xbEe24654bF5D675D88e504a0DC148022664Ce436",
"V3_0_0_RC4_SP1_VERIFIER_PLONK": "0xAF58C8Feee48f9952A444cD897Fd16e99000a4E1",
"V3_0_0_SP1_VERIFIER_GROTH16": "0x6A87EFd4e6B2Db1ed73129A8b9c51aaA583d49e3",
"V3_0_0_SP1_VERIFIER_GROTH16": "0xE780809121774D06aD9B0EEeC620fF4B3913Ced1",
"V3_0_0_SP1_VERIFIER_PLONK": "0xd2832Cf1fC8bA210FfABF62Db9A8781153131d16"
}
2 changes: 1 addition & 1 deletion contracts/deployments/11155420.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
"V3_0_0_RC1_SP1_VERIFIER_PLONK": "0xCf5bB55AaE25b5A66CEfbe85d81b7b144472102A",
"V3_0_0_RC3_SP1_VERIFIER_GROTH16": "0x890E1c4ff98453f1201e5cB65F6C588FD28748b0",
"V3_0_0_RC3_SP1_VERIFIER_PLONK": "0x31aeD863BecC509B9e16403c52C07560A0d4ecBf",
"V3_0_0_SP1_VERIFIER_GROTH16": "0x6A87EFd4e6B2Db1ed73129A8b9c51aaA583d49e3",
"V3_0_0_SP1_VERIFIER_GROTH16": "0xE780809121774D06aD9B0EEeC620fF4B3913Ced1",
"V3_0_0_SP1_VERIFIER_PLONK": "0xd2832Cf1fC8bA210FfABF62Db9A8781153131d16"
}
2 changes: 1 addition & 1 deletion contracts/deployments/17000.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
"V3_0_0_RC1_SP1_VERIFIER_PLONK": "0xCf5bB55AaE25b5A66CEfbe85d81b7b144472102A",
"V3_0_0_RC3_SP1_VERIFIER_GROTH16": "0x890E1c4ff98453f1201e5cB65F6C588FD28748b0",
"V3_0_0_RC3_SP1_VERIFIER_PLONK": "0x31aeD863BecC509B9e16403c52C07560A0d4ecBf",
"V3_0_0_SP1_VERIFIER_GROTH16": "0x6A87EFd4e6B2Db1ed73129A8b9c51aaA583d49e3",
"V3_0_0_SP1_VERIFIER_GROTH16": "0xE780809121774D06aD9B0EEeC620fF4B3913Ced1",
"V3_0_0_SP1_VERIFIER_PLONK": "0xd2832Cf1fC8bA210FfABF62Db9A8781153131d16"
}
2 changes: 1 addition & 1 deletion contracts/deployments/42161.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
"V1_1_0_SP1_VERIFIER": "0xc350F063C13a3Ca21331610fe159E697a5c9c2FB",
"V1_2_0_SP1_VERIFIER_PLONK": "0x6B6A7Ded061567d8A56279801DEA5cFB79be5bFc",
"V2_0_0_SP1_VERIFIER_PLONK": "0x1764C29FBd94865198588f10FC75D4f6636d158d",
"V3_0_0_SP1_VERIFIER_GROTH16": "0x6A87EFd4e6B2Db1ed73129A8b9c51aaA583d49e3",
"V3_0_0_SP1_VERIFIER_GROTH16": "0xE780809121774D06aD9B0EEeC620fF4B3913Ced1",
"V3_0_0_SP1_VERIFIER_PLONK": "0xd2832Cf1fC8bA210FfABF62Db9A8781153131d16"
}
2 changes: 1 addition & 1 deletion contracts/deployments/421614.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
"V3_0_0_RC1_SP1_VERIFIER_PLONK": "0xCf5bB55AaE25b5A66CEfbe85d81b7b144472102A",
"V3_0_0_RC3_SP1_VERIFIER_GROTH16": "0x890E1c4ff98453f1201e5cB65F6C588FD28748b0",
"V3_0_0_RC3_SP1_VERIFIER_PLONK": "0x31aeD863BecC509B9e16403c52C07560A0d4ecBf",
"V3_0_0_SP1_VERIFIER_GROTH16": "0x6A87EFd4e6B2Db1ed73129A8b9c51aaA583d49e3",
"V3_0_0_SP1_VERIFIER_GROTH16": "0xE780809121774D06aD9B0EEeC620fF4B3913Ced1",
"V3_0_0_SP1_VERIFIER_PLONK": "0xd2832Cf1fC8bA210FfABF62Db9A8781153131d16"
}
2 changes: 1 addition & 1 deletion contracts/deployments/534351.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
"V3_0_0_RC1_SP1_VERIFIER_PLONK": "0xCf5bB55AaE25b5A66CEfbe85d81b7b144472102A",
"V3_0_0_RC3_SP1_VERIFIER_GROTH16": "0x890E1c4ff98453f1201e5cB65F6C588FD28748b0",
"V3_0_0_RC3_SP1_VERIFIER_PLONK": "0x31aeD863BecC509B9e16403c52C07560A0d4ecBf",
"V3_0_0_SP1_VERIFIER_GROTH16": "0x6A87EFd4e6B2Db1ed73129A8b9c51aaA583d49e3",
"V3_0_0_SP1_VERIFIER_GROTH16": "0xE780809121774D06aD9B0EEeC620fF4B3913Ced1",
"V3_0_0_SP1_VERIFIER_PLONK": "0xd2832Cf1fC8bA210FfABF62Db9A8781153131d16"
}
2 changes: 1 addition & 1 deletion contracts/deployments/534352.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
"V1_1_0_SP1_VERIFIER": "0xc350F063C13a3Ca21331610fe159E697a5c9c2FB",
"V1_2_0_SP1_VERIFIER_PLONK": "0x6B6A7Ded061567d8A56279801DEA5cFB79be5bFc",
"V2_0_0_SP1_VERIFIER_PLONK": "0x1764C29FBd94865198588f10FC75D4f6636d158d",
"V3_0_0_SP1_VERIFIER_GROTH16": "0x6A87EFd4e6B2Db1ed73129A8b9c51aaA583d49e3",
"V3_0_0_SP1_VERIFIER_GROTH16": "0xE780809121774D06aD9B0EEeC620fF4B3913Ced1",
"V3_0_0_SP1_VERIFIER_PLONK": "0xd2832Cf1fC8bA210FfABF62Db9A8781153131d16"
}
2 changes: 1 addition & 1 deletion contracts/deployments/8453.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
"V1_1_0_SP1_VERIFIER": "0xc350F063C13a3Ca21331610fe159E697a5c9c2FB",
"V1_2_0_SP1_VERIFIER_PLONK": "0x6B6A7Ded061567d8A56279801DEA5cFB79be5bFc",
"V2_0_0_SP1_VERIFIER_PLONK": "0x1764C29FBd94865198588f10FC75D4f6636d158d",
"V3_0_0_SP1_VERIFIER_GROTH16": "0x6A87EFd4e6B2Db1ed73129A8b9c51aaA583d49e3",
"V3_0_0_SP1_VERIFIER_GROTH16": "0xE780809121774D06aD9B0EEeC620fF4B3913Ced1",
"V3_0_0_SP1_VERIFIER_PLONK": "0xd2832Cf1fC8bA210FfABF62Db9A8781153131d16"
}
2 changes: 1 addition & 1 deletion contracts/deployments/84532.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
"V3_0_0_RC1_SP1_VERIFIER_PLONK": "0xCf5bB55AaE25b5A66CEfbe85d81b7b144472102A",
"V3_0_0_RC3_SP1_VERIFIER_GROTH16": "0x890E1c4ff98453f1201e5cB65F6C588FD28748b0",
"V3_0_0_RC3_SP1_VERIFIER_PLONK": "0x31aeD863BecC509B9e16403c52C07560A0d4ecBf",
"V3_0_0_SP1_VERIFIER_GROTH16": "0x6A87EFd4e6B2Db1ed73129A8b9c51aaA583d49e3",
"V3_0_0_SP1_VERIFIER_GROTH16": "0xE780809121774D06aD9B0EEeC620fF4B3913Ced1",
"V3_0_0_SP1_VERIFIER_PLONK": "0xd2832Cf1fC8bA210FfABF62Db9A8781153131d16"
}
2 changes: 1 addition & 1 deletion contracts/script/deploy/SP1VerifierGatewayGroth16.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pragma solidity ^0.8.20;
import {BaseScript} from "../utils/Base.s.sol";
import {SP1VerifierGateway} from "../../src/SP1VerifierGateway.sol";

contract SP1VerifierGatewayGroth16Script is BaseScript {
contract SP1VerifierGatewayScript is BaseScript {
string internal constant KEY = "SP1_VERIFIER_GATEWAY_GROTH16";

function run() external multichain(KEY) broadcaster {
Expand Down
2 changes: 1 addition & 1 deletion contracts/script/deploy/SP1VerifierGatewayPlonk.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pragma solidity ^0.8.20;
import {BaseScript} from "../utils/Base.s.sol";
import {SP1VerifierGateway} from "../../src/SP1VerifierGateway.sol";

contract SP1VerifierGatewayPlonkScript is BaseScript {
contract SP1VerifierGatewayScript is BaseScript {
string internal constant KEY = "SP1_VERIFIER_GATEWAY_PLONK";

function run() external multichain(KEY) broadcaster {
Expand Down

0 comments on commit a20d010

Please sign in to comment.