From 27ed4f78b84893338f72a7d753825a1ca8a3b73f Mon Sep 17 00:00:00 2001 From: pascal Date: Mon, 1 Jul 2024 15:57:44 +0200 Subject: [PATCH] script: Removes deployment via greenhouse --- .env.example | 2 - .gitmodules | 4 - README.md | 3 - docs/Deployment.md | 11 +- lib/greenhouse | 1 - remappings.txt | 2 - script/SelfKisser.s.sol | 23 +-- script/chaincheck/ISelfKisserChaincheck.sol | 148 -------------------- 8 files changed, 7 insertions(+), 187 deletions(-) delete mode 160000 lib/greenhouse delete mode 100644 script/chaincheck/ISelfKisserChaincheck.sol diff --git a/.env.example b/.env.example index 97f4621..52e2d9c 100644 --- a/.env.example +++ b/.env.example @@ -10,8 +10,6 @@ export ETHERSCAN_API_URL= export ETHERSCAN_API_KEY= # Deployment Configurations -export GREENHOUSE= -export SALT= export INITIAL_AUTHED= # Management Configurations diff --git a/.gitmodules b/.gitmodules index 4bdffe5..47c9e01 100644 --- a/.gitmodules +++ b/.gitmodules @@ -6,7 +6,3 @@ path = lib/chronicle-std url = https://github.com/chronicleprotocol/chronicle-std branch = v2 -[submodule "lib/greenhouse"] - path = lib/greenhouse - url = https://github.com/chronicleprotocol/greenhouse - branch = v1 diff --git a/README.md b/README.md index 062b262..5fbce7f 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,3 @@ For more info, see [docs/Management.md](./docs/Management.md). - [chronicleprotocol/chronicle-std@v2](https://github.com/chronicleprotocol/chronicle-std/tree/v2) -Deployment via: - -- [chronicleprotocol/greenhouse@v1](https://github.com/chronicleprotocol/greenhouse/tree/v1) diff --git a/docs/Deployment.md b/docs/Deployment.md index 9fc61d9..bd6e33d 100644 --- a/docs/Deployment.md +++ b/docs/Deployment.md @@ -1,6 +1,6 @@ # Deployment -This document describes how to deploy `Scribe` and `ScribeOptimistic` instance via _Chronicle Protocol_'s [`Greenhouse`](https://github.com/chronicleprotocol/greenhouse) contract factory. +This document describes how to deploy `SelfKisser` instances. ## Environment Variables @@ -14,11 +14,6 @@ The following environment variables must be set: - Note that the API endpoint varies per Etherscan chain instance - Note to point to actual API endpoint (e.g. `/api`) and not just host - `ETHERSCAN_API_KEY`: The Etherscan API key for the Etherscan's chain instance -- `GREENHOUSE`: The `Greenhouse` instance to use for deployment -- `SALT`: The salt to deploy the `SelfKisser` instance to - - Note to use the salt's string representation - - Note that the salt must not exceed 32 bytes in length - - Note that the salt should match the name of the contract deployed! - `INITIAL_AUTHED`: The address being auth'ed on the newly deployed `Scribe` instance Note that an `.env.example` file is provided in the project root. To set all environment variables at once, create a copy of the file and rename the copy to `.env`, adjust the variables' values, and run `source .env`. @@ -26,7 +21,7 @@ Note that an `.env.example` file is provided in the project root. To set all env To easily check the environment variables, run: ```bash -$ env | grep -e "RPC_URL" -e "KEYSTORE" -e "KEYSTORE_PASSWORD" -e "ETHERSCAN_API_URL" -e "ETHERSCAN_API_KEY" -e "GREENHOUSE" -e "SALT" -e "INITIAL_AUTHED" +$ env | grep -e "RPC_URL" -e "KEYSTORE" -e "KEYSTORE_PASSWORD" -e "ETHERSCAN_API_URL" -e "ETHERSCAN_API_KEY" -e "INITIAL_AUTHED" ``` ## Code Adjustments @@ -49,7 +44,7 @@ $ SALT_BYTES32=$(cast format-bytes32-string $SALT) && \ --password "$KEYSTORE_PASSWORD" \ --broadcast \ --rpc-url "$RPC_URL" \ - --sig "$(cast calldata "deploy(address,bytes32,address)" "$GREENHOUSE" "$SALT_BYTES32" "$INITIAL_AUTHED")" \ + --sig "$(cast calldata "deploy(address)" "$INITIAL_AUTHED")" \ -vvv \ script/SelfKisser.s.sol:SelfKisserScript ``` diff --git a/lib/greenhouse b/lib/greenhouse deleted file mode 160000 index dccba23..0000000 --- a/lib/greenhouse +++ /dev/null @@ -1 +0,0 @@ -Subproject commit dccba2304206b85de261e24d5d6c356aa217a083 diff --git a/remappings.txt b/remappings.txt index 6be81c3..4e5d032 100644 --- a/remappings.txt +++ b/remappings.txt @@ -6,5 +6,3 @@ chronicle-std/=lib/chronicle-std/src/ lib/chronicle-std:src/=lib/chronicle-std/src/ lib/chronicle-std:ds-test/=lib/chronicle-std/lib/forge-std/lib/ds-test/src/ lib/chronicle-std:forge-std/=lib/chronicle-std/lib/forge-std/src/ - -greenhouse/=lib/greenhouse/src/ diff --git a/script/SelfKisser.s.sol b/script/SelfKisser.s.sol index 2353ddb..5d323d9 100644 --- a/script/SelfKisser.s.sol +++ b/script/SelfKisser.s.sol @@ -6,31 +6,16 @@ import {console2} from "forge-std/console2.sol"; import {IAuth} from "chronicle-std/auth/IAuth.sol"; -import {IGreenhouse} from "greenhouse/IGreenhouse.sol"; - import {ISelfKisser} from "src/ISelfKisser.sol"; import {SelfKisser_COUNTER as SelfKisser} from "src/SelfKisser.sol"; // @todo ^^^^^^^ Adjust name of SelfKisser instance. contract SelfKisserScript is Script { - /// @dev Deploys a new SelfKisser instance via Greenhouse instance `greenhouse` - /// and salt `salt` with `initialAuthed` being the address initially - /// auth'ed. - function deploy(address greenhouse, bytes32 salt, address initialAuthed) - public - { - // Create creation code with constructor arguments. - bytes memory creationCode = abi.encodePacked( - type(SelfKisser).creationCode, abi.encode(initialAuthed) - ); - - // Ensure salt not yet used. - address deployed = IGreenhouse(greenhouse).addressOf(salt); - require(deployed.code.length == 0, "Salt already used"); - - // Plant creation code via greenhouse. + /// @dev Deploys a new SelfKisser instance with `initialAuthed` being the + /// address initially auth'ed. + function deploy(address initialAuthed) public { vm.startBroadcast(); - IGreenhouse(greenhouse).plant(salt, creationCode); + address deployed = address(new SelfKisser(initialAuthed)); vm.stopBroadcast(); console2.log("Deployed at", deployed); diff --git a/script/chaincheck/ISelfKisserChaincheck.sol b/script/chaincheck/ISelfKisserChaincheck.sol deleted file mode 100644 index 3bed6c5..0000000 --- a/script/chaincheck/ISelfKisserChaincheck.sol +++ /dev/null @@ -1,148 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.16; - -import {Vm} from "forge-std/Vm.sol"; -import {stdJson} from "forge-std/StdJson.sol"; -import {StdStyle} from "forge-std/StdStyle.sol"; - -import {Chaincheck} from "@script/chronicle-std/Chaincheck.sol"; -import {IAuthChaincheck} from "@script/chronicle-std/IAuthChaincheck.sol"; - -import {ISelfKisser} from "src/ISelfKisser.sol"; - -/** - * @notice ISelfKisser's `chaincheck` Integration Test - * - * @dev Config Definition: - * - * ```json - * { - * "ISelfKisser": { - * "oracles": [ - * "", - * ... - * ], - * "dead": bool - * }, - * "IAuth": { - * "disabled": bool, - * "legacy": bool, - * "authed": [ - * "", - * ... - * ] - * } - * } - * ``` - */ -contract ISelfKisserChaincheck is Chaincheck { - using stdJson for string; - - Vm internal constant vm = - Vm(address(uint160(uint(keccak256("hevm cheat code"))))); - - ISelfKisser private self; - string private config; - - string[] private logs; - - function setUp(address self_, string memory config_) - external - override(Chaincheck) - returns (Chaincheck) - { - self = ISelfKisser(self_); - config = config_; - - return Chaincheck(address(this)); - } - - function run() - external - override(Chaincheck) - returns (bool, string[] memory) - { - check_oracles_ContainsOnlySupportedOracles(); - check_oracles_ContainsAllSupportedOracles(); - check_dead(); - - check_IAuth(); - - // Fail run if non-zero number of logs. - return (logs.length == 0, logs); - } - - function check_oracles_ContainsOnlySupportedOracles() internal { - address[] memory oracles = - config.readAddressArray(".ISelfKisser.oracles"); - - address oracle; - for (uint i; i < oracles.length; i++) { - oracle = oracles[i]; - - if (!self.oracles(oracle)) { - logs.push( - string.concat( - StdStyle.red("Expected oracle not supported: "), - vm.toString(oracle) - ) - ); - } - } - } - - function check_oracles_ContainsAllSupportedOracles() internal { - address[] memory expected = - config.readAddressArray(".ISelfKisser.oracles"); - address[] memory actual = self.oracles(); - - for (uint i; i < actual.length; i++) { - for (uint j; j < expected.length; j++) { - if (actual[i] == expected[j]) { - break; // Found address. Continue with outer loop. - } - - // Log if unknown address auth'ed. - if (j == expected.length - 1) { - logs.push( - string.concat( - StdStyle.red("Unknown oracle supported: "), - vm.toString(actual[i]) - ) - ); - } - } - } - } - - function check_dead() internal { - bool wantDead = config.readBool(".ISelfKisser.dead"); - bool gotDead = self.dead(); - - if (wantDead != gotDead) { - logs.push( - string.concat( - StdStyle.red("Dead mismatch:"), - " expectedDead=", - vm.toString(wantDead), - ", gotDead=", - vm.toString(gotDead) - ) - ); - } - } - - // -- Dependency Checks -- - - /// @dev Checks the IAuth module dependency. - function check_IAuth() internal { - // Run IAuth chaincheck. - string[] memory authLogs; - (, authLogs) = new IAuthChaincheck().setUp(address(self), config).run(); - - // Add logs to own logs. - for (uint i; i < authLogs.length; i++) { - logs.push(authLogs[i]); - } - } -}