diff --git a/README.md b/README.md index 6891a10..c52ccf7 100644 --- a/README.md +++ b/README.md @@ -42,9 +42,17 @@ 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 you can run: ```bash -FOUNDRY_PROFILE=deploy forge script SP1VerifierGatewayScript --private-key $PRIVATE_KEY --verify --verifier etherscan --multi --broadcast +FOUNDRY_PROFILE=deploy forge script ./script/deploy/SP1VerifierGateway.s.sol:SP1VerifierGatewayScript --private-key $PRIVATE_KEY --verify --verifier etherscan --multi --broadcast ``` +To deploy a specific SP1 Verifier version and add it to the gateway, run: + +```bash +FOUNDRY_PROFILE=deploy forge script ./script/deploy/v1.0.8-testnet/SP1Verifier.s.sol:SP1VerifierScript --private-key $PRIVATE_KEY --verify --verifier etherscan --multi --broadcast +``` + +Change `v1.0.8-testnet` to the desired version to add. + To re-verify already existing deployments, remove the `--broadcast` flag. ## For Developers: Integrate SP1 Contracts diff --git a/contracts/deployments/11155111.json b/contracts/deployments/11155111.json index 7796d6d..880c176 100644 --- a/contracts/deployments/11155111.json +++ b/contracts/deployments/11155111.json @@ -1,6 +1,5 @@ { - "CREATE2_SALT": "0x0000000000000000000000000000000000000000000000000000000000000002", - "OWNER": "0xDEd0000E32f8F40414d3ab3a830f735a3553E18e", - "SP1_VERIFIER_GATEWAY": "0x810995869591a7a98f319c9802f452dabcea9937", - "V1_0_8_TESTNET_SP1_VERIFIER": "0x4588e29cbc2d715B7f8107140B9AA1Fd97Ba1083" + "SP1_VERIFIER_GATEWAY": "0x3B6041173B80E77f038f3F2C0f9744f04837185e", + "V1_0_7_TESTNET_SP1_VERIFIER": "0x331b350dDA287d0A65ce43103984CD44cb4Da9f0", + "V1_0_8_TESTNET_SP1_VERIFIER": "0xfE2bb0Ad7F2c44Bd1289234Af08aD6FDEC0d54a2" } \ No newline at end of file diff --git a/contracts/deployments/421614.json b/contracts/deployments/421614.json index ba0c872..880c176 100644 --- a/contracts/deployments/421614.json +++ b/contracts/deployments/421614.json @@ -1,6 +1,5 @@ { - "CREATE2_SALT": "0x0000000000000000000000000000000000000000000000000000000000000002", - "OWNER": "0xDEd0000E32f8F40414d3ab3a830f735a3553E18e", - "SP1_VERIFIER_GATEWAY": "0x810995869591a7a98f319c9802f452dabcea9937", - "V1_0_8_TESTNET_SP1_VERIFIER": "0x4588e29cbc2d715B7f8107140B9AA1Fd97Ba1083" + "SP1_VERIFIER_GATEWAY": "0x3B6041173B80E77f038f3F2C0f9744f04837185e", + "V1_0_7_TESTNET_SP1_VERIFIER": "0x331b350dDA287d0A65ce43103984CD44cb4Da9f0", + "V1_0_8_TESTNET_SP1_VERIFIER": "0xfE2bb0Ad7F2c44Bd1289234Af08aD6FDEC0d54a2" } \ No newline at end of file diff --git a/contracts/script/deploy/SP1VerifierGateway.sol b/contracts/script/deploy/SP1VerifierGateway.s.sol similarity index 93% rename from contracts/script/deploy/SP1VerifierGateway.sol rename to contracts/script/deploy/SP1VerifierGateway.s.sol index 93cd37e..05178d9 100644 --- a/contracts/script/deploy/SP1VerifierGateway.sol +++ b/contracts/script/deploy/SP1VerifierGateway.s.sol @@ -1,7 +1,6 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.20; -import {console} from "forge-std/console.sol"; import {BaseScript} from "../utils/Base.s.sol"; import {SP1VerifierGateway} from "../../src/SP1VerifierGateway.sol"; diff --git a/contracts/script/deploy/v1.0.7-testnet/SP1Verifier.s.sol b/contracts/script/deploy/v1.0.7-testnet/SP1Verifier.s.sol index d4f0797..e6d1544 100644 --- a/contracts/script/deploy/v1.0.7-testnet/SP1Verifier.s.sol +++ b/contracts/script/deploy/v1.0.7-testnet/SP1Verifier.s.sol @@ -1,7 +1,6 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.20; -import {console} from "forge-std/console.sol"; import {BaseScript} from "../../utils/Base.s.sol"; import {SP1Verifier} from "../../../src/v1.0.7-testnet/SP1Verifier.sol"; import {SP1VerifierGateway} from "../../../src/SP1VerifierGateway.sol"; diff --git a/contracts/script/deploy/v1.0.8-testnet/SP1Verifier.s.sol b/contracts/script/deploy/v1.0.8-testnet/SP1Verifier.s.sol index 687fa89..0d65cd4 100644 --- a/contracts/script/deploy/v1.0.8-testnet/SP1Verifier.s.sol +++ b/contracts/script/deploy/v1.0.8-testnet/SP1Verifier.s.sol @@ -1,7 +1,6 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.20; -import {console} from "forge-std/console.sol"; import {BaseScript} from "../../utils/Base.s.sol"; import {SP1Verifier} from "../../../src/v1.0.8-testnet/SP1Verifier.sol"; import {SP1VerifierGateway} from "../../../src/SP1VerifierGateway.sol"; diff --git a/contracts/script/utils/Base.s.sol b/contracts/script/utils/Base.s.sol index 90b6039..35c37bf 100644 --- a/contracts/script/utils/Base.s.sol +++ b/contracts/script/utils/Base.s.sol @@ -65,13 +65,29 @@ abstract contract BaseScript is Script { } } - /// @notice Reads an address from the deployments file for the current chain. + /// @notice Tries to read an address from the env. + function envAddress(string memory key) internal view returns (address) { + return vm.envOr(key, address(0)); + } + + /// @notice Tries to read a bytes32 from the env. + function envBytes32(string memory key) internal view returns (bytes32) { + return vm.envOr(key, bytes32(0)); + } + + /// @notice Tries to read an address from the env first, then from the deployments file for the current chain. function readAddress(string memory key) internal view returns (address) { + if (envAddress(key) != address(0)) { + return envAddress(key); + } return deployments().readAddress(string.concat(".", key)); } - /// @notice Reads a bytes32 from the deployments file for the current chain. + /// @notice Tries to read a bytes32 from the env first, then from the deployments file for the current chain. function readBytes32(string memory key) internal view returns (bytes32) { + if (envBytes32(key) != bytes32(0)) { + return envBytes32(key); + } return deployments().readBytes32(string.concat(".", key)); }