diff --git a/.env.example b/.env.example index 4077496e..bc64eacb 100644 --- a/.env.example +++ b/.env.example @@ -1,4 +1,4 @@ -DEPLOYER_ADDRESS= RPC_URL= ETHERSCAN_API_KEY= -NETWORK= \ No newline at end of file +NETWORK= +PRIVATE_KEY= \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 963e3cd8..ebc881cd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,6 +2,8 @@ name: "CI" env: FOUNDRY_PROFILE: "ci" + PRIVATE_KEY: "0xafdfd9c3d2095ef696594f6cedcae59e72dcd697e2a7521b1578140422a4f890" + SEPOLIA_RPC_URL: ${{ secrets.SEPOLIA_RPC_URL }} on: pull_request: @@ -56,9 +58,6 @@ jobs: - name: "Show the Foundry config" run: "forge config" - - name: "Create env file" - run: "touch .env && echo GOERLI_RPC_URL=${{ secrets.GOERLI_RPC_URL }} >> .env" - - name: "Run the tests" run: "yarn test" coverage: diff --git a/deployments/goerli.json b/deployments/arbitrum.json similarity index 100% rename from deployments/goerli.json rename to deployments/arbitrum.json diff --git a/deployments/base.json b/deployments/base.json new file mode 100644 index 00000000..315d6db0 --- /dev/null +++ b/deployments/base.json @@ -0,0 +1,21 @@ +{ + "ActiveProposalsLimiterProposalValidationStrategy": "0x399821c9Ea977387a0DEcCF1C9692B4dF925FF38", + "AvatarExecutionStrategyImplementation": "0xecE4f6b01a2d7FF5A9765cA44162D453fC455e42", + "CompTimelockCompatibleExecutionStrategyImplementation": "0x91086017D5eAEc4BeEc86ac770b5eE672e4Be589", + "CompVotingStrategy": "0x0c2De612982Efd102803161fc7C74CcA15Db932c", + "EthSigAuthenticator": "0x5f9B7D78c9a37a439D78f801E0E339C6E711e260", + "EthTxAuthenticator": "0xBA06E6cCb877C332181A6867c05c8b746A21Aed1", + "MerkleWhitelistVotingStrategy": "0x34f0AfFF5A739bBf3E285615F50e40ddAaf2A829", + "OZVotesVotingStrategy": "0x2c8631584474E750CEdF2Fb6A904f2e84777Aefe", + "OptimisticCompTimelockCompatibleExecutionStrategyImplementation": "0x77e7Aa43b28Df1e467bd4806fE3bF26F5c3EAD27", + "OptimisticTimelockExecutionStrategyImplementation": "0x49AF19f9318d55ad8e7CE743De9Ce76ED408CE0C", + "PropositionPowerAndActiveProposalsLimiterValidationStrategy": "0x358e4Ba219CC1e1c7084A14c3a504772acfc40b1", + "PropositionPowerProposalValidationStrategy": "0x6D9d6D08EF6b26348Bd18F1FC8D953696b7cf311", + "ProxyFactory": "0x4B4F7f64Be813Ccc66AEFC3bFCe2baA01188631c", + "SpaceImplementation": "0xC3031A7d3326E47D49BfF9D374d74f364B29CE4D", + "TimelockExecutionStrategyImplementation": "0xf2A1C2f2098161af98b2Cc7E382AB7F3ba86Ebc4", + "VanillaAuthenticator": "0xb9BE0a0093933968E3B4c4fC5d939B6c1Fe45142", + "VanillaProposalValidationStrategy": "0x9A39194F870c410633C170889E9025fba2113c79", + "VanillaVotingStrategy": "0xC1245C5DCa7885C73E32294140F1e5d30688c202", + "WhitelistVotingStrategy": "0x3CEE21A33751A2722413fF62dEC3dEc48e7748A4" +} diff --git a/deployments/optimism.json b/deployments/optimism.json new file mode 100644 index 00000000..315d6db0 --- /dev/null +++ b/deployments/optimism.json @@ -0,0 +1,21 @@ +{ + "ActiveProposalsLimiterProposalValidationStrategy": "0x399821c9Ea977387a0DEcCF1C9692B4dF925FF38", + "AvatarExecutionStrategyImplementation": "0xecE4f6b01a2d7FF5A9765cA44162D453fC455e42", + "CompTimelockCompatibleExecutionStrategyImplementation": "0x91086017D5eAEc4BeEc86ac770b5eE672e4Be589", + "CompVotingStrategy": "0x0c2De612982Efd102803161fc7C74CcA15Db932c", + "EthSigAuthenticator": "0x5f9B7D78c9a37a439D78f801E0E339C6E711e260", + "EthTxAuthenticator": "0xBA06E6cCb877C332181A6867c05c8b746A21Aed1", + "MerkleWhitelistVotingStrategy": "0x34f0AfFF5A739bBf3E285615F50e40ddAaf2A829", + "OZVotesVotingStrategy": "0x2c8631584474E750CEdF2Fb6A904f2e84777Aefe", + "OptimisticCompTimelockCompatibleExecutionStrategyImplementation": "0x77e7Aa43b28Df1e467bd4806fE3bF26F5c3EAD27", + "OptimisticTimelockExecutionStrategyImplementation": "0x49AF19f9318d55ad8e7CE743De9Ce76ED408CE0C", + "PropositionPowerAndActiveProposalsLimiterValidationStrategy": "0x358e4Ba219CC1e1c7084A14c3a504772acfc40b1", + "PropositionPowerProposalValidationStrategy": "0x6D9d6D08EF6b26348Bd18F1FC8D953696b7cf311", + "ProxyFactory": "0x4B4F7f64Be813Ccc66AEFC3bFCe2baA01188631c", + "SpaceImplementation": "0xC3031A7d3326E47D49BfF9D374d74f364B29CE4D", + "TimelockExecutionStrategyImplementation": "0xf2A1C2f2098161af98b2Cc7E382AB7F3ba86Ebc4", + "VanillaAuthenticator": "0xb9BE0a0093933968E3B4c4fC5d939B6c1Fe45142", + "VanillaProposalValidationStrategy": "0x9A39194F870c410633C170889E9025fba2113c79", + "VanillaVotingStrategy": "0xC1245C5DCa7885C73E32294140F1e5d30688c202", + "WhitelistVotingStrategy": "0x3CEE21A33751A2722413fF62dEC3dEc48e7748A4" +} diff --git a/package.json b/package.json index f9949b19..00b1ac7e 100644 --- a/package.json +++ b/package.json @@ -22,8 +22,8 @@ "prettier": "prettier --write \"**/*.{json,md,sol,yml}\"", "format": "yarn prettier", "test": "forge test --optimize -vv", - "deploy-modules": "forge script script/ModulesSetup.s.sol:ModulesSetup --rpc-url $GOERLI_RPC_URL --optimize --broadcast --verify -vvvv", - "deploy-space": "forge script script/SpaceSetup.s.sol:SpaceSetup --rpc-url $GOERLI_RPC_URL --optimize --broadcast --verify -vvvv", + "deploy-modules": "forge script script/ModulesSetup.s.sol:ModulesSetup --rpc-url $SEPOLIA_RPC_URL --optimize --broadcast --verify -vvvv", + "deploy-space": "forge script script/SpaceSetup.s.sol:SpaceSetup --rpc-url $SEPOLIA_RPC_URL --optimize --broadcast --verify -vvvv", "prepare": "husky install" }, "lint-staged": { diff --git a/script/Deployer.s.sol b/script/Deployer.s.sol index 5ec5f04b..a63b1195 100644 --- a/script/Deployer.s.sol +++ b/script/Deployer.s.sol @@ -54,6 +54,9 @@ contract Deployer is Script { SingletonFactory internal singletonFactory = SingletonFactory(0xce0042B868300000d44A59004Da54A005ffdcf9f); address internal deployer; + + // Legacy value from the original deployment + address internal address_salt = address(0x2dBCb4c373E99E27D1E357F42a40Ef114e9270c3); string internal deployments; string internal deploymentsPath; @@ -66,7 +69,7 @@ contract Deployer is Script { uint256 internal saltNonce = 0; function run() public { - deployer = vm.envAddress("DEPLOYER_ADDRESS"); + deployer = vm.addr(vm.envUint("PRIVATE_KEY")); string memory network = vm.envString("NETWORK"); @@ -77,7 +80,6 @@ contract Deployer is Script { // ------- EXECUTION STRATEGIES ------- (address avatarExecutionStrategy, ) = noRedeploy( - deployer, abi.encodePacked( type(AvatarExecutionStrategy).creationCode, abi.encode(address(0x1), address(0x1), new address[](0), 0) @@ -88,7 +90,6 @@ contract Deployer is Script { deployments.serialize("AvatarExecutionStrategyImplementation", avatarExecutionStrategy); (address timelockExecutionStrategy, ) = noRedeploy( - deployer, abi.encodePacked(type(TimelockExecutionStrategy).creationCode), saltNonce ); @@ -96,7 +97,6 @@ contract Deployer is Script { deployments.serialize("TimelockExecutionStrategyImplementation", timelockExecutionStrategy); (address optimisticTimelockExecutionStrategy, ) = noRedeploy( - deployer, abi.encodePacked(type(OptimisticTimelockExecutionStrategy).creationCode), saltNonce ); @@ -104,7 +104,6 @@ contract Deployer is Script { deployments.serialize("OptimisticTimelockExecutionStrategyImplementation", optimisticTimelockExecutionStrategy); (address compTimelockCompatibleExecutionStrategy, ) = noRedeploy( - deployer, abi.encodePacked( type(CompTimelockCompatibleExecutionStrategy).creationCode, abi.encode(address(0x1), address(0x1), new address[](0), 0, 0) @@ -118,7 +117,6 @@ contract Deployer is Script { ); (address optimisticCompTimelockCompatibleExecutionStrategy, ) = noRedeploy( - deployer, abi.encodePacked( type(OptimisticCompTimelockCompatibleExecutionStrategy).creationCode, abi.encode(address(0x1), address(0x1), new address[](0), 0, 0) @@ -133,14 +131,13 @@ contract Deployer is Script { // ------- AUTHENTICATORS ------- - (address vanillaAuthenticator, ) = noRedeploy(deployer, type(VanillaAuthenticator).creationCode, saltNonce); + (address vanillaAuthenticator, ) = noRedeploy(type(VanillaAuthenticator).creationCode, saltNonce); deployments.serialize("VanillaAuthenticator", vanillaAuthenticator); - (address ethTxAuthenticator, ) = noRedeploy(deployer, type(EthTxAuthenticator).creationCode, saltNonce); + (address ethTxAuthenticator, ) = noRedeploy(type(EthTxAuthenticator).creationCode, saltNonce); deployments.serialize("EthTxAuthenticator", ethTxAuthenticator); (address ethSigAuthenticator, ) = noRedeploy( - deployer, abi.encodePacked(type(EthSigAuthenticator).creationCode, abi.encode(name, version)), saltNonce ); @@ -148,24 +145,19 @@ contract Deployer is Script { // ------- VOTING STRATEGIES ------- - (address vanillaVotingStrategy, ) = noRedeploy(deployer, type(VanillaVotingStrategy).creationCode, saltNonce); + (address vanillaVotingStrategy, ) = noRedeploy(type(VanillaVotingStrategy).creationCode, saltNonce); deployments.serialize("VanillaVotingStrategy", vanillaVotingStrategy); - (address whitelistVotingStrategy, ) = noRedeploy( - deployer, - type(WhitelistVotingStrategy).creationCode, - saltNonce - ); + (address whitelistVotingStrategy, ) = noRedeploy(type(WhitelistVotingStrategy).creationCode, saltNonce); deployments.serialize("WhitelistVotingStrategy", whitelistVotingStrategy); - (address compVotingStrategy, ) = noRedeploy(deployer, type(CompVotingStrategy).creationCode, saltNonce); + (address compVotingStrategy, ) = noRedeploy(type(CompVotingStrategy).creationCode, saltNonce); deployments.serialize("CompVotingStrategy", compVotingStrategy); - (address ozVotesVotingStrategy, ) = noRedeploy(deployer, type(OZVotesVotingStrategy).creationCode, saltNonce); + (address ozVotesVotingStrategy, ) = noRedeploy(type(OZVotesVotingStrategy).creationCode, saltNonce); deployments.serialize("OZVotesVotingStrategy", ozVotesVotingStrategy); (address merkleWhitelistVotingStrategy, ) = noRedeploy( - deployer, type(MerkleWhitelistVotingStrategy).creationCode, saltNonce ); @@ -174,21 +166,18 @@ contract Deployer is Script { // ------- PROPOSAL VALIDATION STRATEGIES ------- (address vanillaProposalValidationStrategy, ) = noRedeploy( - deployer, type(VanillaProposalValidationStrategy).creationCode, saltNonce ); deployments.serialize("VanillaProposalValidationStrategy", vanillaProposalValidationStrategy); (address propositionPowerProposalValidationStrategy, ) = noRedeploy( - deployer, type(PropositionPowerProposalValidationStrategy).creationCode, saltNonce ); deployments.serialize("PropositionPowerProposalValidationStrategy", propositionPowerProposalValidationStrategy); (address activeProposalsLimiterProposalValidationStrategy, ) = noRedeploy( - deployer, type(ActiveProposalsLimiterProposalValidationStrategy).creationCode, saltNonce ); @@ -199,7 +188,6 @@ contract Deployer is Script { ); (address propositionPowerAndActiveProposalsLimiterValidationStrategy, ) = noRedeploy( - deployer, type(PropositionPowerAndActiveProposalsLimiterValidationStrategy).creationCode, saltNonce ); @@ -211,12 +199,12 @@ contract Deployer is Script { // ------- PROXY FACTORY ------- - (address proxyFactory, ) = noRedeploy(deployer, type(ProxyFactory).creationCode, saltNonce); + (address proxyFactory, ) = noRedeploy(type(ProxyFactory).creationCode, saltNonce); deployments.serialize("ProxyFactory", proxyFactory); // ------- SPACE ------- - (address space, ) = noRedeploy(deployer, type(Space).creationCode, saltNonce); + (address space, ) = noRedeploy(type(Space).creationCode, saltNonce); // If the master space is not initialized, initialize it if (Space(space).owner() == address(0x0)) { @@ -257,12 +245,8 @@ contract Deployer is Script { } // Deploys contract if it doesn't exist, otherwise returns the create2 address - function noRedeploy( - address _deployer, - bytes memory _initCode, - uint256 _saltNonce - ) internal returns (address, bool) { - bytes32 salt = keccak256(abi.encodePacked(_deployer, _saltNonce)); + function noRedeploy(bytes memory _initCode, uint256 _saltNonce) internal returns (address, bool) { + bytes32 salt = keccak256(abi.encodePacked(address_salt, _saltNonce)); address addy = computeCreate2Address(salt, keccak256(_initCode), address(singletonFactory)); if (addy.code.length == 0) { address _addy = singletonFactory.deploy(_initCode, salt); diff --git a/test/ForkedTests.t.sol b/test/ForkedTests.t.sol index 6dfc2039..bb7dc823 100644 --- a/test/ForkedTests.t.sol +++ b/test/ForkedTests.t.sol @@ -16,7 +16,7 @@ import { Choice, IndexedStrategy, Strategy, UpdateSettingsCalldata } from "../sr // Similar to "GasSnapshots.t.sol" except this uses a forked network // solhint-disable-next-line max-states-count contract ForkedTest is SpaceTest, SigUtils { - uint256 internal goerliFork; + uint256 internal sepoliaFork; CompVotingStrategy internal compVotingStrategy; CompToken internal compToken; @@ -47,8 +47,8 @@ contract ForkedTest is SpaceTest, SigUtils { function setUp() public virtual override { super.setUp(); - string memory GOERLI_RPC_URL = vm.envString("GOERLI_RPC_URL"); - goerliFork = vm.createFork(GOERLI_RPC_URL); + string memory SEPOLIA_RPC_URL = vm.envString("SEPOLIA_RPC_URL"); + sepoliaFork = vm.createFork(SEPOLIA_RPC_URL); (voter2, key2) = makeAddrAndKey("Voter 2 Key"); (voter3, key3) = makeAddrAndKey("Voter 3 Key"); @@ -162,7 +162,7 @@ contract ForkedTest is SpaceTest, SigUtils { } function testFork_VoteAndProposeWithCompToken() public { - vm.selectFork(goerliFork); + vm.selectFork(sepoliaFork); vm.roll(block.number + 1);