Skip to content

Commit

Permalink
feat: v3.0.0 (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattstam authored Oct 24, 2024
1 parent 1694126 commit 1c4acae
Show file tree
Hide file tree
Showing 23 changed files with 2,492 additions and 296 deletions.
571 changes: 298 additions & 273 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ path = "src/bin/artifacts.rs"
anyhow = "1.0.86"
dotenv = "0.15.0"
log = "0.4.21"
sp1-sdk = "3.0.0-rc4"
sp1-sdk = "3.0.0"
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ FOUNDRY_PROFILE=deploy forge script ./script/deploy/SP1VerifierGateway.s.sol:SP1
To deploy a specific SP1 Verifier version and add it to the gateway, run:

```bash
FOUNDRY_PROFILE=deploy forge script ./script/deploy/v3.0.0-rc3/SP1VerifierPlonk.s.sol:SP1VerifierScript --private-key $PRIVATE_KEY --verify --verifier etherscan --multi --broadcast
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-rc3` to the desired version to add.
Change `v3.0.0` to the desired version to add.

To re-verify already existing deployments, remove the `--broadcast` flag.

Expand All @@ -71,10 +71,10 @@ To re-verify already existing deployments, remove the `--broadcast` flag.
To freeze a verifier on the gateway, run:

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

Change `v3.0.0-rc3` to the desired version to freeze.
Change `v3.0.0` to the desired version to freeze.

## For Developers: Integrate SP1 Contracts

Expand Down
4 changes: 3 additions & 1 deletion contracts/deployments/1.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@
"V1_0_8_TESTNET_SP1_VERIFIER": "0xfE2bb0Ad7F2c44Bd1289234Af08aD6FDEC0d54a2",
"V1_1_0_SP1_VERIFIER": "0xc350F063C13a3Ca21331610fe159E697a5c9c2FB",
"V1_2_0_SP1_VERIFIER_PLONK": "0x6B6A7Ded061567d8A56279801DEA5cFB79be5bFc",
"V2_0_0_SP1_VERIFIER_PLONK": "0x1764C29FBd94865198588f10FC75D4f6636d158d"
"V2_0_0_SP1_VERIFIER_PLONK": "0x1764C29FBd94865198588f10FC75D4f6636d158d",
"V3_0_0_SP1_VERIFIER_GROTH16": "0x6A87EFd4e6B2Db1ed73129A8b9c51aaA583d49e3",
"V3_0_0_SP1_VERIFIER_PLONK": "0xd2832Cf1fC8bA210FfABF62Db9A8781153131d16"
}
4 changes: 3 additions & 1 deletion contracts/deployments/10.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"SP1_VERIFIER_GATEWAY": "0x3B6041173B80E77f038f3F2C0f9744f04837185e",
"V1_2_0_SP1_VERIFIER_PLONK": "0x6B6A7Ded061567d8A56279801DEA5cFB79be5bFc",
"V2_0_0_SP1_VERIFIER_PLONK": "0x1764C29FBd94865198588f10FC75D4f6636d158d"
"V2_0_0_SP1_VERIFIER_PLONK": "0x1764C29FBd94865198588f10FC75D4f6636d158d",
"V3_0_0_SP1_VERIFIER_GROTH16": "0x6A87EFd4e6B2Db1ed73129A8b9c51aaA583d49e3",
"V3_0_0_SP1_VERIFIER_PLONK": "0xd2832Cf1fC8bA210FfABF62Db9A8781153131d16"
}
4 changes: 3 additions & 1 deletion contracts/deployments/11155111.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,7 @@
"V3_0_0_RC3_SP1_VERIFIER_GROTH16": "0x890E1c4ff98453f1201e5cB65F6C588FD28748b0",
"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_RC4_SP1_VERIFIER_PLONK": "0xAF58C8Feee48f9952A444cD897Fd16e99000a4E1",
"V3_0_0_SP1_VERIFIER_GROTH16": "0x6A87EFd4e6B2Db1ed73129A8b9c51aaA583d49e3",
"V3_0_0_SP1_VERIFIER_PLONK": "0xd2832Cf1fC8bA210FfABF62Db9A8781153131d16"
}
4 changes: 3 additions & 1 deletion contracts/deployments/11155420.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,7 @@
"V3_0_0_RC1_SP1_VERIFIER_GROTH16": "0x8dB92f28D7C30154d38E55DbA1054b5A7Fc5A829",
"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_RC3_SP1_VERIFIER_PLONK": "0x31aeD863BecC509B9e16403c52C07560A0d4ecBf",
"V3_0_0_SP1_VERIFIER_GROTH16": "0x6A87EFd4e6B2Db1ed73129A8b9c51aaA583d49e3",
"V3_0_0_SP1_VERIFIER_PLONK": "0xd2832Cf1fC8bA210FfABF62Db9A8781153131d16"
}
4 changes: 3 additions & 1 deletion contracts/deployments/17000.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,7 @@
"V3_0_0_RC1_SP1_VERIFIER_GROTH16": "0x8dB92f28D7C30154d38E55DbA1054b5A7Fc5A829",
"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_RC3_SP1_VERIFIER_PLONK": "0x31aeD863BecC509B9e16403c52C07560A0d4ecBf",
"V3_0_0_SP1_VERIFIER_GROTH16": "0x6A87EFd4e6B2Db1ed73129A8b9c51aaA583d49e3",
"V3_0_0_SP1_VERIFIER_PLONK": "0xd2832Cf1fC8bA210FfABF62Db9A8781153131d16"
}
4 changes: 3 additions & 1 deletion contracts/deployments/42161.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@
"V1_0_8_TESTNET_SP1_VERIFIER": "0xfE2bb0Ad7F2c44Bd1289234Af08aD6FDEC0d54a2",
"V1_1_0_SP1_VERIFIER": "0xc350F063C13a3Ca21331610fe159E697a5c9c2FB",
"V1_2_0_SP1_VERIFIER_PLONK": "0x6B6A7Ded061567d8A56279801DEA5cFB79be5bFc",
"V2_0_0_SP1_VERIFIER_PLONK": "0x1764C29FBd94865198588f10FC75D4f6636d158d"
"V2_0_0_SP1_VERIFIER_PLONK": "0x1764C29FBd94865198588f10FC75D4f6636d158d",
"V3_0_0_SP1_VERIFIER_GROTH16": "0x6A87EFd4e6B2Db1ed73129A8b9c51aaA583d49e3",
"V3_0_0_SP1_VERIFIER_PLONK": "0xd2832Cf1fC8bA210FfABF62Db9A8781153131d16"
}
4 changes: 3 additions & 1 deletion contracts/deployments/421614.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,7 @@
"V3_0_0_RC1_SP1_VERIFIER_GROTH16": "0x8dB92f28D7C30154d38E55DbA1054b5A7Fc5A829",
"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_RC3_SP1_VERIFIER_PLONK": "0x31aeD863BecC509B9e16403c52C07560A0d4ecBf",
"V3_0_0_SP1_VERIFIER_GROTH16": "0x6A87EFd4e6B2Db1ed73129A8b9c51aaA583d49e3",
"V3_0_0_SP1_VERIFIER_PLONK": "0xd2832Cf1fC8bA210FfABF62Db9A8781153131d16"
}
4 changes: 3 additions & 1 deletion contracts/deployments/534351.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,7 @@
"V3_0_0_RC1_SP1_VERIFIER_GROTH16": "0x8dB92f28D7C30154d38E55DbA1054b5A7Fc5A829",
"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_RC3_SP1_VERIFIER_PLONK": "0x31aeD863BecC509B9e16403c52C07560A0d4ecBf",
"V3_0_0_SP1_VERIFIER_GROTH16": "0x6A87EFd4e6B2Db1ed73129A8b9c51aaA583d49e3",
"V3_0_0_SP1_VERIFIER_PLONK": "0xd2832Cf1fC8bA210FfABF62Db9A8781153131d16"
}
4 changes: 3 additions & 1 deletion contracts/deployments/534352.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@
"V1_0_8_TESTNET_SP1_VERIFIER": "0xfE2bb0Ad7F2c44Bd1289234Af08aD6FDEC0d54a2",
"V1_1_0_SP1_VERIFIER": "0xc350F063C13a3Ca21331610fe159E697a5c9c2FB",
"V1_2_0_SP1_VERIFIER_PLONK": "0x6B6A7Ded061567d8A56279801DEA5cFB79be5bFc",
"V2_0_0_SP1_VERIFIER_PLONK": "0x1764C29FBd94865198588f10FC75D4f6636d158d"
"V2_0_0_SP1_VERIFIER_PLONK": "0x1764C29FBd94865198588f10FC75D4f6636d158d",
"V3_0_0_SP1_VERIFIER_GROTH16": "0x6A87EFd4e6B2Db1ed73129A8b9c51aaA583d49e3",
"V3_0_0_SP1_VERIFIER_PLONK": "0xd2832Cf1fC8bA210FfABF62Db9A8781153131d16"
}
4 changes: 3 additions & 1 deletion contracts/deployments/8453.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@
"V1_0_8_TESTNET_SP1_VERIFIER": "0xfE2bb0Ad7F2c44Bd1289234Af08aD6FDEC0d54a2",
"V1_1_0_SP1_VERIFIER": "0xc350F063C13a3Ca21331610fe159E697a5c9c2FB",
"V1_2_0_SP1_VERIFIER_PLONK": "0x6B6A7Ded061567d8A56279801DEA5cFB79be5bFc",
"V2_0_0_SP1_VERIFIER_PLONK": "0x1764C29FBd94865198588f10FC75D4f6636d158d"
"V2_0_0_SP1_VERIFIER_PLONK": "0x1764C29FBd94865198588f10FC75D4f6636d158d",
"V3_0_0_SP1_VERIFIER_GROTH16": "0x6A87EFd4e6B2Db1ed73129A8b9c51aaA583d49e3",
"V3_0_0_SP1_VERIFIER_PLONK": "0xd2832Cf1fC8bA210FfABF62Db9A8781153131d16"
}
4 changes: 3 additions & 1 deletion contracts/deployments/84532.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,7 @@
"V3_0_0_RC1_SP1_VERIFIER_GROTH16": "0x8dB92f28D7C30154d38E55DbA1054b5A7Fc5A829",
"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_RC3_SP1_VERIFIER_PLONK": "0x31aeD863BecC509B9e16403c52C07560A0d4ecBf",
"V3_0_0_SP1_VERIFIER_GROTH16": "0x6A87EFd4e6B2Db1ed73129A8b9c51aaA583d49e3",
"V3_0_0_SP1_VERIFIER_PLONK": "0xd2832Cf1fC8bA210FfABF62Db9A8781153131d16"
}
38 changes: 38 additions & 0 deletions contracts/script/deploy/v3.0.0/SP1VerifierGroth16.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import {BaseScript} from "../../utils/Base.s.sol";
import {SP1Verifier} from "../../../src/v3.0.0/SP1VerifierGroth16.sol";
import {SP1VerifierGateway} from "../../../src/SP1VerifierGateway.sol";
import {ISP1VerifierWithHash} from "../../../src/ISP1Verifier.sol";

contract SP1VerifierScript is BaseScript {
string internal constant KEY = "V3_0_0_SP1_VERIFIER_GROTH16";

function run() external multichain(KEY) broadcaster {
// Read config
bytes32 CREATE2_SALT = readBytes32("CREATE2_SALT");
address SP1_VERIFIER_GATEWAY = readAddress("SP1_VERIFIER_GATEWAY");

// Deploy contract
address verifier = address(new SP1Verifier{salt: CREATE2_SALT}());

// Add the verifier to the gateway
SP1VerifierGateway gateway = SP1VerifierGateway(SP1_VERIFIER_GATEWAY);
gateway.addRoute(verifier);

// Write address
writeAddress(KEY, verifier);
}

function freeze() external multichain(KEY) broadcaster {
// Read config
address SP1_VERIFIER_GATEWAY = readAddress("SP1_VERIFIER_GATEWAY");
address SP1_VERIFIER = readAddress(KEY);

// Freeze the verifier on the gateway
SP1VerifierGateway gateway = SP1VerifierGateway(SP1_VERIFIER_GATEWAY);
bytes4 selector = bytes4(ISP1VerifierWithHash(SP1_VERIFIER).VERIFIER_HASH());
gateway.freezeRoute(selector);
}
}
38 changes: 38 additions & 0 deletions contracts/script/deploy/v3.0.0/SP1VerifierPlonk.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import {BaseScript} from "../../utils/Base.s.sol";
import {SP1Verifier} from "../../../src/v3.0.0/SP1VerifierPlonk.sol";
import {SP1VerifierGateway} from "../../../src/SP1VerifierGateway.sol";
import {ISP1VerifierWithHash} from "../../../src/ISP1Verifier.sol";

contract SP1VerifierScript is BaseScript {
string internal constant KEY = "V3_0_0_SP1_VERIFIER_PLONK";

function run() external multichain(KEY) broadcaster {
// Read config
bytes32 CREATE2_SALT = readBytes32("CREATE2_SALT");
address SP1_VERIFIER_GATEWAY = readAddress("SP1_VERIFIER_GATEWAY");

// Deploy contract
address verifier = address(new SP1Verifier{salt: CREATE2_SALT}());

// Add the verifier to the gateway
SP1VerifierGateway gateway = SP1VerifierGateway(SP1_VERIFIER_GATEWAY);
gateway.addRoute(verifier);

// Write address
writeAddress(KEY, verifier);
}

function freeze() external multichain(KEY) broadcaster {
// Read config
address SP1_VERIFIER_GATEWAY = readAddress("SP1_VERIFIER_GATEWAY");
address SP1_VERIFIER = readAddress(KEY);

// Freeze the verifier on the gateway
SP1VerifierGateway gateway = SP1VerifierGateway(SP1_VERIFIER_GATEWAY);
bytes4 selector = bytes4(ISP1VerifierWithHash(SP1_VERIFIER).VERIFIER_HASH());
gateway.freezeRoute(selector);
}
}
Loading

0 comments on commit 1c4acae

Please sign in to comment.