From 93344c7994dca206eed9bfea6ad8c857ef966d00 Mon Sep 17 00:00:00 2001 From: John Guilding Date: Mon, 11 Nov 2024 15:23:57 +0700 Subject: [PATCH] Update deployment scripts with more combinations --- .../DeployEmailRecoveryModule.s.sol | 77 ++++++++-------- ...EmailRecoveryModuleWithAccountHiding.s.sol | 88 +++++++++++++++++++ .../DeployUniversalEmailRecoveryModule.s.sol | 78 ++++++++++++++++ ...EmailRecoveryModuleWithAccountHiding.s.sol | 79 +++++++++++++++++ script/BaseDeployScript.s.sol | 8 +- .../DeployUniversalEmailRecoveryModule.s.sol | 70 --------------- script/README.md | 59 +++++++++++++ .../{ => Safe}/DeploySafeNativeRecovery.s.sol | 54 ++++++------ ...ySafeNativeRecoveryWithAccountHiding.s.sol | 49 ++++++----- .../{ => Safe7579}/DeploySafeRecovery.s.sol | 56 +++++------- .../DeploySafeRecoveryWithAccountHiding.s.sol | 33 +++---- .../Compute7579RecoveryDataHash.s.sol | 0 test/Base.t.sol | 4 +- .../DeployEmailRecoveryModule.t.sol | 5 +- .../DeployUniversalEmailRecoveryModule.t.sol | 4 +- .../unit/script}/BaseDeployTest.sol | 0 .../Safe}/DeploySafeNativeRecovery.t.sol | 6 +- .../script/Safe7579}/DeploySafeRecovery.t.sol | 4 +- .../test/Compute7579RecoveryDataHash.t.sol | 4 +- 19 files changed, 449 insertions(+), 229 deletions(-) rename script/{ => 7579/EmailRecoveryModule}/DeployEmailRecoveryModule.s.sol (53%) create mode 100644 script/7579/EmailRecoveryModule/DeployEmailRecoveryModuleWithAccountHiding.s.sol create mode 100644 script/7579/UniversalEmailRecoveryModule/DeployUniversalEmailRecoveryModule.s.sol create mode 100644 script/7579/UniversalEmailRecoveryModule/DeployUniversalEmailRecoveryModuleWithAccountHiding.s.sol delete mode 100644 script/DeployUniversalEmailRecoveryModule.s.sol create mode 100644 script/README.md rename script/{ => Safe}/DeploySafeNativeRecovery.s.sol (51%) rename script/{ => Safe}/DeploySafeNativeRecoveryWithAccountHiding.s.sol (58%) rename script/{ => Safe7579}/DeploySafeRecovery.s.sol (54%) rename script/{ => Safe7579}/DeploySafeRecoveryWithAccountHiding.s.sol (65%) rename script/{ => test}/Compute7579RecoveryDataHash.s.sol (100%) rename {script/test => test/unit/script/7579/EmailRecoveryModule}/DeployEmailRecoveryModule.t.sol (91%) rename {script/test => test/unit/script/7579/UniversalEmailRecoveryModule}/DeployUniversalEmailRecoveryModule.t.sol (92%) rename {script/test => test/unit/script}/BaseDeployTest.sol (100%) rename {script/test => test/unit/script/Safe}/DeploySafeNativeRecovery.t.sol (93%) rename {script/test => test/unit/script/Safe7579}/DeploySafeRecovery.t.sol (87%) rename {script => test/unit/script}/test/Compute7579RecoveryDataHash.t.sol (68%) diff --git a/script/DeployEmailRecoveryModule.s.sol b/script/7579/EmailRecoveryModule/DeployEmailRecoveryModule.s.sol similarity index 53% rename from script/DeployEmailRecoveryModule.s.sol rename to script/7579/EmailRecoveryModule/DeployEmailRecoveryModule.s.sol index 1032a3fb..3caf1843 100644 --- a/script/DeployEmailRecoveryModule.s.sol +++ b/script/7579/EmailRecoveryModule/DeployEmailRecoveryModule.s.sol @@ -9,32 +9,36 @@ import { UserOverrideableDKIMRegistry } from "@zk-email/contracts/UserOverrideab import { EmailAuth } from "@zk-email/ether-email-auth-contracts/src/EmailAuth.sol"; import { EmailRecoveryFactory } from "src/factories/EmailRecoveryFactory.sol"; import { OwnableValidator } from "src/test/OwnableValidator.sol"; -import { BaseDeployScript } from "./BaseDeployScript.s.sol"; +import { BaseDeployScript } from "../../BaseDeployScript.s.sol"; contract DeployEmailRecoveryModuleScript is BaseDeployScript { - address public verifier; - address public dkimRegistrySigner; - address public emailAuthImpl; - address public validatorAddr; - uint256 public minimumDelay; - address public killSwitchAuthorizer; + address verifier; + address dkim; + address emailAuthImpl; + address commandHandler; + uint256 minimumDelay; + address killSwitchAuthorizer; + address validatorAddr; - address public initialOwner; - uint256 public salt; - - UserOverrideableDKIMRegistry public dkim; + address initialOwner; + address dkimRegistrySigner; + uint256 dkimDelay; + uint256 salt; function run() public override { super.run(); vm.startBroadcast(vm.envUint("PRIVATE_KEY")); verifier = vm.envOr("VERIFIER", address(0)); - dkimRegistrySigner = vm.envOr("DKIM_SIGNER", address(0)); + dkim = vm.envOr("DKIM_REGISTRY", address(0)); emailAuthImpl = vm.envOr("EMAIL_AUTH_IMPL", address(0)); - validatorAddr = vm.envOr("VALIDATOR", address(0)); + commandHandler = vm.envOr("COMMAND_HANDLER", address(0)); minimumDelay = vm.envOr("MINIMUM_DELAY", uint256(0)); killSwitchAuthorizer = vm.envAddress("KILL_SWITCH_AUTHORIZER"); + validatorAddr = vm.envOr("VALIDATOR", address(0)); initialOwner = vm.addr(vm.envUint("PRIVATE_KEY")); + dkimRegistrySigner = vm.envOr("DKIM_SIGNER", address(0)); + dkimDelay = vm.envOr("DKIM_DELAY", uint256(0)); salt = vm.envOr("CREATE2_SALT", uint256(0)); if (verifier == address(0)) { @@ -42,48 +46,43 @@ contract DeployEmailRecoveryModuleScript is BaseDeployScript { } // Deploy Useroverridable DKIM registry - dkim = UserOverrideableDKIMRegistry(vm.envOr("DKIM_REGISTRY", address(0))); - uint256 setTimeDelay = vm.envOr("DKIM_DELAY", uint256(0)); - if (address(dkim) == address(0)) { - dkim = UserOverrideableDKIMRegistry( - deployUserOverrideableDKIMRegistry( - initialOwner, dkimRegistrySigner, setTimeDelay, salt - ) + if (dkim == address(0)) { + dkim = deployUserOverrideableDKIMRegistry( + initialOwner, dkimRegistrySigner, dkimDelay, salt ); } if (emailAuthImpl == address(0)) { emailAuthImpl = address(new EmailAuth{ salt: bytes32(salt) }()); - console.log("Deployed Email Auth at", emailAuthImpl); + console.log("EmailAuth implementation deployed at", emailAuthImpl); } if (validatorAddr == address(0)) { validatorAddr = address(new OwnableValidator{ salt: bytes32(salt) }()); - console.log("Deployed Ownable Validator at", validatorAddr); + console.log("OwnableValidator deployed at", validatorAddr); } address _factory = vm.envOr("RECOVERY_FACTORY", address(0)); if (_factory == address(0)) { _factory = address(new EmailRecoveryFactory{ salt: bytes32(salt) }(verifier, emailAuthImpl)); - console.log("Deployed Email Recovery Factory at", _factory); + console.log("EmailRecoveryFactory deployed at", _factory); } - { - EmailRecoveryFactory factory = EmailRecoveryFactory(_factory); - (address module, address commandHandler) = factory.deployEmailRecoveryModule( - bytes32(uint256(0)), - bytes32(uint256(0)), - type(EmailRecoveryCommandHandler).creationCode, - minimumDelay, - killSwitchAuthorizer, - address(dkim), - validatorAddr, - bytes4(keccak256(bytes("changeOwner(address)"))) - ); - console.log("Deployed Email Recovery Module at", vm.toString(module)); - console.log("Deployed Email Recovery Handler at", vm.toString(commandHandler)); - vm.stopBroadcast(); - } + EmailRecoveryFactory factory = EmailRecoveryFactory(_factory); + (address module, address commandHandler) = factory.deployEmailRecoveryModule( + bytes32(uint256(0)), + bytes32(uint256(0)), + type(EmailRecoveryCommandHandler).creationCode, + minimumDelay, + killSwitchAuthorizer, + address(dkim), + validatorAddr, + bytes4(keccak256(bytes("changeOwner(address)"))) + ); + + console.log("EmailRecoveryModule deployed at", vm.toString(module)); + console.log("EmailRecoveryCommandHandler deployed at", vm.toString(commandHandler)); + vm.stopBroadcast(); } } diff --git a/script/7579/EmailRecoveryModule/DeployEmailRecoveryModuleWithAccountHiding.s.sol b/script/7579/EmailRecoveryModule/DeployEmailRecoveryModuleWithAccountHiding.s.sol new file mode 100644 index 00000000..1a74417f --- /dev/null +++ b/script/7579/EmailRecoveryModule/DeployEmailRecoveryModuleWithAccountHiding.s.sol @@ -0,0 +1,88 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.25; + +/* solhint-disable no-console, gas-custom-errors */ + +import { console } from "forge-std/console.sol"; +import { AccountHidingRecoveryCommandHandler } from + "src/handlers/AccountHidingRecoveryCommandHandler.sol"; +import { UserOverrideableDKIMRegistry } from "@zk-email/contracts/UserOverrideableDKIMRegistry.sol"; +import { EmailAuth } from "@zk-email/ether-email-auth-contracts/src/EmailAuth.sol"; +import { EmailRecoveryFactory } from "src/factories/EmailRecoveryFactory.sol"; +import { OwnableValidator } from "src/test/OwnableValidator.sol"; +import { BaseDeployScript } from "../../BaseDeployScript.s.sol"; + +contract DeployEmailRecoveryModuleScript is BaseDeployScript { + address verifier; + address dkim; + address emailAuthImpl; + address commandHandler; + uint256 minimumDelay; + address killSwitchAuthorizer; + address validatorAddr; + + address initialOwner; + address dkimRegistrySigner; + uint256 dkimDelay; + uint256 salt; + + function run() public override { + super.run(); + vm.startBroadcast(vm.envUint("PRIVATE_KEY")); + verifier = vm.envOr("VERIFIER", address(0)); + dkim = vm.envOr("DKIM_REGISTRY", address(0)); + emailAuthImpl = vm.envOr("EMAIL_AUTH_IMPL", address(0)); + commandHandler = vm.envOr("COMMAND_HANDLER", address(0)); + minimumDelay = vm.envOr("MINIMUM_DELAY", uint256(0)); + killSwitchAuthorizer = vm.envAddress("KILL_SWITCH_AUTHORIZER"); + validatorAddr = vm.envOr("VALIDATOR", address(0)); + + initialOwner = vm.addr(vm.envUint("PRIVATE_KEY")); + dkimRegistrySigner = vm.envOr("DKIM_SIGNER", address(0)); + dkimDelay = vm.envOr("DKIM_DELAY", uint256(0)); + salt = vm.envOr("CREATE2_SALT", uint256(0)); + + if (verifier == address(0)) { + verifier = deployVerifier(initialOwner, salt); + } + + if (dkim == address(0)) { + dkim = deployUserOverrideableDKIMRegistry( + initialOwner, dkimRegistrySigner, dkimDelay, salt + ); + } + + if (emailAuthImpl == address(0)) { + emailAuthImpl = address(new EmailAuth{ salt: bytes32(salt) }()); + console.log("EmailAuth implemenation deployed at", emailAuthImpl); + } + + if (validatorAddr == address(0)) { + validatorAddr = address(new OwnableValidator{ salt: bytes32(salt) }()); + console.log("OwnableValidator deployed at", validatorAddr); + } + + address _factory = vm.envOr("RECOVERY_FACTORY", address(0)); + if (_factory == address(0)) { + _factory = + address(new EmailRecoveryFactory{ salt: bytes32(salt) }(verifier, emailAuthImpl)); + console.log("EmailRecoveryFactory deployed at", _factory); + } + + EmailRecoveryFactory factory = EmailRecoveryFactory(_factory); + (address module, address commandHandler) = factory.deployEmailRecoveryModule( + bytes32(uint256(0)), + bytes32(uint256(0)), + type(AccountHidingRecoveryCommandHandler).creationCode, + minimumDelay, + killSwitchAuthorizer, + address(dkim), + validatorAddr, + bytes4(keccak256(bytes("changeOwner(address)"))) + ); + + console.log("EmailRecoveryModule deployed at", vm.toString(module)); + console.log("AccountHidingRecoveryCommandHandler deployed at", vm.toString(commandHandler)); + vm.stopBroadcast(); + } +} diff --git a/script/7579/UniversalEmailRecoveryModule/DeployUniversalEmailRecoveryModule.s.sol b/script/7579/UniversalEmailRecoveryModule/DeployUniversalEmailRecoveryModule.s.sol new file mode 100644 index 00000000..e9142b0e --- /dev/null +++ b/script/7579/UniversalEmailRecoveryModule/DeployUniversalEmailRecoveryModule.s.sol @@ -0,0 +1,78 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.25; + +/* solhint-disable no-console, gas-custom-errors */ + +import { console } from "forge-std/console.sol"; +import { EmailRecoveryCommandHandler } from "src/handlers/EmailRecoveryCommandHandler.sol"; +import { UserOverrideableDKIMRegistry } from "@zk-email/contracts/UserOverrideableDKIMRegistry.sol"; +import { EmailAuth } from "@zk-email/ether-email-auth-contracts/src/EmailAuth.sol"; +import { EmailRecoveryUniversalFactory } from "src/factories/EmailRecoveryUniversalFactory.sol"; +import { BaseDeployScript } from "../../BaseDeployScript.s.sol"; + +contract DeployUniversalEmailRecoveryModuleScript is BaseDeployScript { + address verifier; + address dkim; + address emailAuthImpl; + address commandHandler; + uint256 minimumDelay; + address killSwitchAuthorizer; + + address initialOwner; + address dkimRegistrySigner; + uint256 dkimDelay; + uint256 salt; + + function run() public override { + super.run(); + vm.startBroadcast(vm.envUint("PRIVATE_KEY")); + verifier = vm.envOr("VERIFIER", address(0)); + dkim = vm.envOr("DKIM_REGISTRY", address(0)); + emailAuthImpl = vm.envOr("EMAIL_AUTH_IMPL", address(0)); + commandHandler = vm.envOr("COMMAND_HANDLER", address(0)); + minimumDelay = vm.envOr("MINIMUM_DELAY", uint256(0)); + killSwitchAuthorizer = vm.envAddress("KILL_SWITCH_AUTHORIZER"); + + initialOwner = vm.addr(vm.envUint("PRIVATE_KEY")); + dkimRegistrySigner = vm.envOr("DKIM_SIGNER", address(0)); + dkimDelay = vm.envOr("DKIM_DELAY", uint256(0)); + salt = vm.envOr("CREATE2_SALT", uint256(0)); + + if (verifier == address(0)) { + verifier = deployVerifier(initialOwner, salt); + } + + if (dkim == address(0)) { + dkim = deployUserOverrideableDKIMRegistry( + initialOwner, dkimRegistrySigner, dkimDelay, salt + ); + } + + if (emailAuthImpl == address(0)) { + emailAuthImpl = address(new EmailAuth{ salt: bytes32(salt) }()); + console.log("EmailAuth implemenation deployed at", emailAuthImpl); + } + + address _factory = vm.envOr("RECOVERY_FACTORY", address(0)); + if (_factory == address(0)) { + _factory = address( + new EmailRecoveryUniversalFactory{ salt: bytes32(salt) }(verifier, emailAuthImpl) + ); + console.log("EmailRecoveryUniversalFactory deployed at", _factory); + } + + EmailRecoveryUniversalFactory factory = EmailRecoveryUniversalFactory(_factory); + (address module, address commandHandler) = factory.deployUniversalEmailRecoveryModule( + bytes32(uint256(0)), + bytes32(uint256(0)), + type(EmailRecoveryCommandHandler).creationCode, + minimumDelay, + killSwitchAuthorizer, + address(dkim) + ); + + console.log("UniversalEmailRecoveryModule deployed at", vm.toString(module)); + console.log("EmailRecoveryCommandHandler deployed at", vm.toString(commandHandler)); + vm.stopBroadcast(); + } +} diff --git a/script/7579/UniversalEmailRecoveryModule/DeployUniversalEmailRecoveryModuleWithAccountHiding.s.sol b/script/7579/UniversalEmailRecoveryModule/DeployUniversalEmailRecoveryModuleWithAccountHiding.s.sol new file mode 100644 index 00000000..87adba04 --- /dev/null +++ b/script/7579/UniversalEmailRecoveryModule/DeployUniversalEmailRecoveryModuleWithAccountHiding.s.sol @@ -0,0 +1,79 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.25; + +/* solhint-disable no-console, gas-custom-errors */ + +import { console } from "forge-std/console.sol"; +import { AccountHidingRecoveryCommandHandler } from + "src/handlers/AccountHidingRecoveryCommandHandler.sol"; +import { UserOverrideableDKIMRegistry } from "@zk-email/contracts/UserOverrideableDKIMRegistry.sol"; +import { EmailAuth } from "@zk-email/ether-email-auth-contracts/src/EmailAuth.sol"; +import { EmailRecoveryUniversalFactory } from "src/factories/EmailRecoveryUniversalFactory.sol"; +import { BaseDeployScript } from "../../BaseDeployScript.s.sol"; + +contract DeployUniversalEmailRecoveryModuleScript is BaseDeployScript { + address verifier; + address dkim; + address emailAuthImpl; + address commandHandler; + uint256 minimumDelay; + address killSwitchAuthorizer; + + address initialOwner; + address dkimRegistrySigner; + uint256 dkimDelay; + uint256 salt; + + function run() public override { + super.run(); + vm.startBroadcast(vm.envUint("PRIVATE_KEY")); + verifier = vm.envOr("VERIFIER", address(0)); + dkim = vm.envOr("DKIM_REGISTRY", address(0)); + emailAuthImpl = vm.envOr("EMAIL_AUTH_IMPL", address(0)); + commandHandler = vm.envOr("COMMAND_HANDLER", address(0)); + minimumDelay = vm.envOr("MINIMUM_DELAY", uint256(0)); + killSwitchAuthorizer = vm.envAddress("KILL_SWITCH_AUTHORIZER"); + + initialOwner = vm.addr(vm.envUint("PRIVATE_KEY")); + dkimRegistrySigner = vm.envOr("DKIM_SIGNER", address(0)); + dkimDelay = vm.envOr("DKIM_DELAY", uint256(0)); + salt = vm.envOr("CREATE2_SALT", uint256(0)); + + if (verifier == address(0)) { + verifier = deployVerifier(initialOwner, salt); + } + + if (dkim == address(0)) { + dkim = deployUserOverrideableDKIMRegistry( + initialOwner, dkimRegistrySigner, dkimDelay, salt + ); + } + + if (emailAuthImpl == address(0)) { + emailAuthImpl = address(new EmailAuth{ salt: bytes32(salt) }()); + console.log("EmailAuth implemenation deployed at", emailAuthImpl); + } + + address _factory = vm.envOr("RECOVERY_FACTORY", address(0)); + if (_factory == address(0)) { + _factory = address( + new EmailRecoveryUniversalFactory{ salt: bytes32(salt) }(verifier, emailAuthImpl) + ); + console.log("EmailRecoveryUniversalFactory deployed at", _factory); + } + + EmailRecoveryUniversalFactory factory = EmailRecoveryUniversalFactory(_factory); + (address module, address commandHandler) = factory.deployUniversalEmailRecoveryModule( + bytes32(uint256(0)), + bytes32(uint256(0)), + type(AccountHidingRecoveryCommandHandler).creationCode, + minimumDelay, + killSwitchAuthorizer, + address(dkim) + ); + + console.log("UniversalEmailRecoveryModule deployed at", vm.toString(module)); + console.log("AccountHidingRecoveryCommandHandler deployed at", vm.toString(commandHandler)); + vm.stopBroadcast(); + } +} diff --git a/script/BaseDeployScript.s.sol b/script/BaseDeployScript.s.sol index 1592750a..c5d9857d 100644 --- a/script/BaseDeployScript.s.sol +++ b/script/BaseDeployScript.s.sol @@ -25,7 +25,7 @@ contract BaseDeployScript is Script { abi.encodeCall(verifierImpl.initialize, (initialOwner, address(groth16Verifier))) ); address verifier = address(Verifier(address(verifierProxy))); - console.log("Deployed Verifier at", verifier); + console.log("Verifier proxy deployed at", verifier); return verifier; } @@ -35,7 +35,7 @@ contract BaseDeployScript is Script { function deployUserOverrideableDKIMRegistry( address initialOwner, address dkimRegistrySigner, - uint256 setTimeDelay, + uint256 dkimDelay, uint256 salt ) public @@ -51,11 +51,11 @@ contract BaseDeployScript is Script { ERC1967Proxy dkimProxy = new ERC1967Proxy{ salt: bytes32(salt) }( address(overrideableDkimImpl), abi.encodeCall( - overrideableDkimImpl.initialize, (initialOwner, dkimRegistrySigner, setTimeDelay) + overrideableDkimImpl.initialize, (initialOwner, dkimRegistrySigner, dkimDelay) ) ); address dkim = address(dkimProxy); - console.log("UseroverrideableDKIMRegistry proxy deployed at: %s", dkim); + console.log("UserOverrideableDKIMRegistry proxy deployed at: %s", dkim); return dkim; } } diff --git a/script/DeployUniversalEmailRecoveryModule.s.sol b/script/DeployUniversalEmailRecoveryModule.s.sol deleted file mode 100644 index efc50b20..00000000 --- a/script/DeployUniversalEmailRecoveryModule.s.sol +++ /dev/null @@ -1,70 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.25; - -/* solhint-disable no-console, gas-custom-errors */ - -import { console } from "forge-std/console.sol"; -import { EmailRecoveryCommandHandler } from "src/handlers/EmailRecoveryCommandHandler.sol"; -import { UserOverrideableDKIMRegistry } from "@zk-email/contracts/UserOverrideableDKIMRegistry.sol"; -import { EmailAuth } from "@zk-email/ether-email-auth-contracts/src/EmailAuth.sol"; -import { EmailRecoveryUniversalFactory } from "src/factories/EmailRecoveryUniversalFactory.sol"; -import { BaseDeployScript } from "./BaseDeployScript.s.sol"; - -contract DeployUniversalEmailRecoveryModuleScript is BaseDeployScript { - function run() public override { - super.run(); - vm.startBroadcast(vm.envUint("PRIVATE_KEY")); - address verifier = vm.envOr("VERIFIER", address(0)); - address dkimRegistrySigner = vm.envOr("DKIM_SIGNER", address(0)); - address emailAuthImpl = vm.envOr("EMAIL_AUTH_IMPL", address(0)); - uint256 minimumDelay = vm.envOr("MINIMUM_DELAY", uint256(0)); - address killSwitchAuthorizer = vm.envAddress("KILL_SWITCH_AUTHORIZER"); - - address initialOwner = vm.addr(vm.envUint("PRIVATE_KEY")); - uint256 salt = vm.envOr("CREATE2_SALT", uint256(0)); - UserOverrideableDKIMRegistry dkim; - - if (verifier == address(0)) { - verifier = deployVerifier(initialOwner, salt); - } - - // Deploy Useroverridable DKIM registry - dkim = UserOverrideableDKIMRegistry(vm.envOr("DKIM_REGISTRY", address(0))); - uint256 setTimeDelay = vm.envOr("DKIM_DELAY", uint256(0)); - if (address(dkim) == address(0)) { - dkim = UserOverrideableDKIMRegistry( - deployUserOverrideableDKIMRegistry( - initialOwner, dkimRegistrySigner, setTimeDelay, salt - ) - ); - } - - if (emailAuthImpl == address(0)) { - emailAuthImpl = address(new EmailAuth{ salt: bytes32(salt) }()); - console.log("Deployed Email Auth at", emailAuthImpl); - } - - address _factory = vm.envOr("RECOVERY_FACTORY", address(0)); - if (_factory == address(0)) { - _factory = address( - new EmailRecoveryUniversalFactory{ salt: bytes32(salt) }(verifier, emailAuthImpl) - ); - console.log("Deployed Email Recovery Factory at", _factory); - } - { - EmailRecoveryUniversalFactory factory = EmailRecoveryUniversalFactory(_factory); - (address module, address commandHandler) = factory.deployUniversalEmailRecoveryModule( - bytes32(uint256(0)), - bytes32(uint256(0)), - type(EmailRecoveryCommandHandler).creationCode, - minimumDelay, - killSwitchAuthorizer, - address(dkim) - ); - - console.log("Deployed Email Recovery Module at", vm.toString(module)); - console.log("Deployed Email Recovery Handler at", vm.toString(commandHandler)); - vm.stopBroadcast(); - } - } -} diff --git a/script/README.md b/script/README.md new file mode 100644 index 00000000..5b002cbc --- /dev/null +++ b/script/README.md @@ -0,0 +1,59 @@ +# ZK Email Recovery Deployment Scripts + +This directory contains scripts for deploying various ZK Email recovery modules and related contracts. It is possible to combine different command handlers with different modules. Each deployment script directory has an account hiding script. The account hiding feature means that guardians cannot see what account they are recovering in emails. Guardians can still find the address onchain however. + +### `BaseDeployScript.s.sol` + +Base script with helper functions for deploying common contracts like Verifier and DKIM Registry. + +### `ComputeSafeRecoveryCalldata.s.sol` + +Utility script to compute calldata for Safe recovery. Used by 7579 safes and non-7579 Safes. + +## `7579/` + +Contains deployment scripts for 7579-compatible recovery modules. Find more information on 7579 on the [ERC7579 website](https://erc7579.com/) + +## `EmailRecoveryModule/` + +### `DeployEmailRecoveryModule.s.sol` + +Deploys a validator specific recovery module. This module type is coupled to a specific validator address + +### `DeployEmailRecoveryModuleWithAccountHiding.s.sol` + +Deploys a validator specific recovery module with additional account address hiding features for enhanced privacy in emails + +## `UniversalEmailRecoveryModule/` + +### `DeployUniversalEmailRecoveryModule.s.sol` + +Deploys a generic recovery module that can be used with any 7579 validator + +### `DeployUniversalEmailRecoveryModuleWithAccountHiding.s.sol` + +Deploys an generic recovery module with additional account address hiding features for enhanced privacy in emails + +## `Safe/` + +Contains deployment scripts for Safe-specific recovery modules that do not use ERC7579. This is useful for existing Safes that are not 4337 compatible (versions below `v1.4.1`), and also newer Safes that do not want a dependency on ERC7579. + +### `DeploySafeRecovery.s.sol` + +Deploys a [native safe module](https://docs.safe.global/advanced/smart-account-modules) for ZK Email recovery + +### `DeploySafeRecoveryWithAccountHiding.s.sol` + +Deploys a [native safe module](https://docs.safe.global/advanced/smart-account-modules) for ZK Email recovery with additional account address hiding features for enhanced privacy in emails + +## `Safe7579/` + +Contains deployment scripts for Safe 7579-compatible recovery modules using ZK Email. For more information on how Safe's interact with 7579, visit the [Safe7579 project](https://github.com/rhinestonewtf/safe7579). + +### `DeploySafeRecovery.s.sol` + +Deploys a 7579-compatible Safe recovery module + +### `DeploySafeRecoveryWithAccountHiding.s.sol` + +Deploys Safe recovery module with additional account address hiding features for enhanced privacy in emails diff --git a/script/DeploySafeNativeRecovery.s.sol b/script/Safe/DeploySafeNativeRecovery.s.sol similarity index 51% rename from script/DeploySafeNativeRecovery.s.sol rename to script/Safe/DeploySafeNativeRecovery.s.sol index 13f5d5ec..57b945cc 100644 --- a/script/DeploySafeNativeRecovery.s.sol +++ b/script/Safe/DeploySafeNativeRecovery.s.sol @@ -8,50 +8,54 @@ import { UserOverrideableDKIMRegistry } from "@zk-email/contracts/UserOverrideab import { EmailAuth } from "@zk-email/ether-email-auth-contracts/src/EmailAuth.sol"; import { SafeRecoveryCommandHandler } from "src/handlers/SafeRecoveryCommandHandler.sol"; import { SafeEmailRecoveryModule } from "src/modules/SafeEmailRecoveryModule.sol"; -import { BaseDeployScript } from "./BaseDeployScript.s.sol"; +import { BaseDeployScript } from "../BaseDeployScript.s.sol"; contract DeploySafeNativeRecovery_Script is BaseDeployScript { + address verifier; + address dkim; + address emailAuthImpl; + address commandHandler; + uint256 minimumDelay; + address killSwitchAuthorizer; + + address initialOwner; + address dkimRegistrySigner; + uint256 dkimDelay; + uint256 salt; + function run() public override { super.run(); vm.startBroadcast(vm.envUint("PRIVATE_KEY")); - address verifier = vm.envOr("ZK_VERIFIER", address(0)); - address dkimRegistrySigner = vm.envOr("DKIM_SIGNER", address(0)); - address emailAuthImpl = vm.envOr("EMAIL_AUTH_IMPL", address(0)); - address commandHandler = vm.envOr("COMMAND_HANDLER", address(0)); - uint256 minimumDelay = vm.envOr("MINIMUM_DELAY", uint256(0)); - address killSwitchAuthorizer = vm.envAddress("KILL_SWITCH_AUTHORIZER"); - - address initialOwner = vm.addr(vm.envUint("PRIVATE_KEY")); - - uint256 salt = vm.envOr("CREATE2_SALT", uint256(0)); - - console.log("verifier %s", verifier); + verifier = vm.envOr("VERIFIER", address(0)); + dkim = vm.envOr("DKIM_REGISTRY", address(0)); + emailAuthImpl = vm.envOr("EMAIL_AUTH_IMPL", address(0)); + commandHandler = vm.envOr("COMMAND_HANDLER", address(0)); + minimumDelay = vm.envOr("MINIMUM_DELAY", uint256(0)); + killSwitchAuthorizer = vm.envAddress("KILL_SWITCH_AUTHORIZER"); - UserOverrideableDKIMRegistry dkim; + initialOwner = vm.addr(vm.envUint("PRIVATE_KEY")); + dkimRegistrySigner = vm.envOr("DKIM_SIGNER", address(0)); + dkimDelay = vm.envOr("DKIM_DELAY", uint256(0)); + salt = vm.envOr("CREATE2_SALT", uint256(0)); if (verifier == address(0)) { verifier = deployVerifier(initialOwner, salt); } - // Deploy Useroverridable DKIM registry - dkim = UserOverrideableDKIMRegistry(vm.envOr("DKIM_REGISTRY", address(0))); - uint256 setTimeDelay = vm.envOr("DKIM_DELAY", uint256(0)); - if (address(dkim) == address(0)) { - dkim = UserOverrideableDKIMRegistry( - deployUserOverrideableDKIMRegistry( - initialOwner, dkimRegistrySigner, setTimeDelay, salt - ) + if (dkim == address(0)) { + dkim = deployUserOverrideableDKIMRegistry( + initialOwner, dkimRegistrySigner, dkimDelay, salt ); } if (emailAuthImpl == address(0)) { emailAuthImpl = address(new EmailAuth{ salt: bytes32(salt) }()); - console.log("Deployed Email Auth at", emailAuthImpl); + console.log("EmailAuth implemenation deployed at", emailAuthImpl); } if (commandHandler == address(0)) { commandHandler = address(new SafeRecoveryCommandHandler{ salt: bytes32(salt) }()); - console.log("Deployed Command Handler at", commandHandler); + console.log("SafeRecoveryCommandHandler deployed at", commandHandler); } address module = address( @@ -65,7 +69,7 @@ contract DeploySafeNativeRecovery_Script is BaseDeployScript { ) ); - console.log("Deployed Email Recovery Module at ", vm.toString(module)); + console.log("SafeEmailRecoveryModule deployed at ", vm.toString(module)); vm.stopBroadcast(); } diff --git a/script/DeploySafeNativeRecoveryWithAccountHiding.s.sol b/script/Safe/DeploySafeNativeRecoveryWithAccountHiding.s.sol similarity index 58% rename from script/DeploySafeNativeRecoveryWithAccountHiding.s.sol rename to script/Safe/DeploySafeNativeRecoveryWithAccountHiding.s.sol index 2ef58174..5156d8b2 100644 --- a/script/DeploySafeNativeRecoveryWithAccountHiding.s.sol +++ b/script/Safe/DeploySafeNativeRecoveryWithAccountHiding.s.sol @@ -9,45 +9,50 @@ import { EmailAuth } from "@zk-email/ether-email-auth-contracts/src/EmailAuth.so import { AccountHidingRecoveryCommandHandler } from "src/handlers/AccountHidingRecoveryCommandHandler.sol"; import { SafeEmailRecoveryModule } from "src/modules/SafeEmailRecoveryModule.sol"; -import { BaseDeployScript } from "./BaseDeployScript.s.sol"; +import { BaseDeployScript } from "../BaseDeployScript.s.sol"; contract DeploySafeNativeRecovery_Script is BaseDeployScript { + address verifier; + address dkim; + address emailAuthImpl; + address commandHandler; + uint256 minimumDelay; + address killSwitchAuthorizer; + + address initialOwner; + address dkimRegistrySigner; + uint256 dkimDelay; + uint256 salt; + function run() public override { super.run(); vm.startBroadcast(vm.envUint("PRIVATE_KEY")); - address verifier = vm.envOr("VERIFIER", address(0)); - address dkimRegistrySigner = vm.envOr("DKIM_SIGNER", address(0)); - address emailAuthImpl = vm.envOr("EMAIL_AUTH_IMPL", address(0)); - address commandHandler = vm.envOr("COMMAND_HANDLER", address(0)); - uint256 minimumDelay = vm.envOr("MINIMUM_DELAY", uint256(0)); - address killSwitchAuthorizer = vm.envAddress("KILL_SWITCH_AUTHORIZER"); - - address initialOwner = vm.addr(vm.envUint("PRIVATE_KEY")); - - uint256 salt = vm.envOr("CREATE2_SALT", uint256(0)); - - console.log("verifier %s", verifier); + verifier = vm.envOr("VERIFIER", address(0)); + dkim = vm.envOr("DKIM_REGISTRY", address(0)); + emailAuthImpl = vm.envOr("EMAIL_AUTH_IMPL", address(0)); + commandHandler = vm.envOr("COMMAND_HANDLER", address(0)); + minimumDelay = vm.envOr("MINIMUM_DELAY", uint256(0)); + killSwitchAuthorizer = vm.envAddress("KILL_SWITCH_AUTHORIZER"); - UserOverrideableDKIMRegistry dkim; + initialOwner = vm.addr(vm.envUint("PRIVATE_KEY")); + dkimRegistrySigner = vm.envOr("DKIM_SIGNER", address(0)); + dkimDelay = vm.envOr("DKIM_DELAY", uint256(0)); + salt = vm.envOr("CREATE2_SALT", uint256(0)); if (verifier == address(0)) { verifier = deployVerifier(initialOwner, salt); } // Deploy Useroverridable DKIM registry - dkim = UserOverrideableDKIMRegistry(vm.envOr("DKIM_REGISTRY", address(0))); - uint256 setTimeDelay = vm.envOr("DKIM_DELAY", uint256(0)); if (address(dkim) == address(0)) { - dkim = UserOverrideableDKIMRegistry( - deployUserOverrideableDKIMRegistry( - initialOwner, dkimRegistrySigner, setTimeDelay, salt - ) + dkim = deployUserOverrideableDKIMRegistry( + initialOwner, dkimRegistrySigner, dkimDelay, salt ); } if (emailAuthImpl == address(0)) { emailAuthImpl = address(new EmailAuth{ salt: bytes32(salt) }()); - console.log("Deployed Email Auth at", emailAuthImpl); + console.log("EmailAuth implemenation deployed at", emailAuthImpl); } if (commandHandler == address(0)) { @@ -67,7 +72,7 @@ contract DeploySafeNativeRecovery_Script is BaseDeployScript { ) ); - console.log("Deployed Email Recovery Module at ", vm.toString(module)); + console.log("SafeEmailRecoveryModule deployed at ", vm.toString(module)); vm.stopBroadcast(); } diff --git a/script/DeploySafeRecovery.s.sol b/script/Safe7579/DeploySafeRecovery.s.sol similarity index 54% rename from script/DeploySafeRecovery.s.sol rename to script/Safe7579/DeploySafeRecovery.s.sol index 9b2884d2..e2df9546 100644 --- a/script/DeploySafeRecovery.s.sol +++ b/script/Safe7579/DeploySafeRecovery.s.sol @@ -8,59 +8,53 @@ import { SafeRecoveryCommandHandler } from "src/handlers/SafeRecoveryCommandHand import { EmailRecoveryUniversalFactory } from "src/factories/EmailRecoveryUniversalFactory.sol"; import { EmailAuth } from "@zk-email/ether-email-auth-contracts/src/EmailAuth.sol"; import { UserOverrideableDKIMRegistry } from "@zk-email/contracts/UserOverrideableDKIMRegistry.sol"; - -import { Safe7579 } from "safe7579/Safe7579.sol"; -import { Safe7579Launchpad } from "safe7579/Safe7579Launchpad.sol"; -import { IERC7484 } from "safe7579/interfaces/IERC7484.sol"; -import { BaseDeployScript } from "./BaseDeployScript.s.sol"; +import { BaseDeployScript } from "../BaseDeployScript.s.sol"; // 1. `source .env` // 2. `forge script --chain sepolia script/DeploySafeRecovery.s.sol:DeploySafeRecovery_Script // --rpc-url $BASE_SEPOLIA_RPC_URL --broadcast -vvvv` contract DeploySafeRecovery_Script is BaseDeployScript { - address public verifier; - address public dkimRegistrySigner; - address public emailAuthImpl; - uint256 public minimumDelay; - address public killSwitchAuthorizer; - - address public initialOwner; - uint256 public salt; + address verifier; + address dkim; + address emailAuthImpl; + address commandHandler; + uint256 minimumDelay; + address killSwitchAuthorizer; - UserOverrideableDKIMRegistry public dkim; + address initialOwner; + address dkimRegistrySigner; + uint256 dkimDelay; + uint256 salt; function run() public override { super.run(); - address entryPoint = address(0x0000000071727De22E5E9d8BAf0edAc6f37da032); - IERC7484 registry = IERC7484(0xe0cde9239d16bEf05e62Bbf7aA93e420f464c826); vm.startBroadcast(vm.envUint("PRIVATE_KEY")); verifier = vm.envOr("VERIFIER", address(0)); - dkimRegistrySigner = vm.envOr("DKIM_SIGNER", address(0)); + dkim = vm.envOr("DKIM_REGISTRY", address(0)); emailAuthImpl = vm.envOr("EMAIL_AUTH_IMPL", address(0)); + commandHandler = vm.envOr("COMMAND_HANDLER", address(0)); minimumDelay = vm.envOr("MINIMUM_DELAY", uint256(0)); killSwitchAuthorizer = vm.envAddress("KILL_SWITCH_AUTHORIZER"); + initialOwner = vm.addr(vm.envUint("PRIVATE_KEY")); + dkimRegistrySigner = vm.envOr("DKIM_SIGNER", address(0)); + dkimDelay = vm.envOr("DKIM_DELAY", uint256(0)); salt = vm.envOr("CREATE2_SALT", uint256(0)); if (verifier == address(0)) { verifier = deployVerifier(initialOwner, salt); } - // Deploy Useroverridable DKIM registry - dkim = UserOverrideableDKIMRegistry(vm.envOr("DKIM_REGISTRY", address(0))); - uint256 setTimeDelay = vm.envOr("DKIM_DELAY", uint256(0)); - if (address(dkim) == address(0)) { - dkim = UserOverrideableDKIMRegistry( - deployUserOverrideableDKIMRegistry( - initialOwner, dkimRegistrySigner, setTimeDelay, salt - ) + if (dkim == address(0)) { + dkim = deployUserOverrideableDKIMRegistry( + initialOwner, dkimRegistrySigner, dkimDelay, salt ); } if (emailAuthImpl == address(0)) { emailAuthImpl = address(new EmailAuth{ salt: bytes32(salt) }()); - console.log("Deployed Email Auth at", emailAuthImpl); + console.log("EmailAuth implemenation deployed at", emailAuthImpl); } EmailRecoveryUniversalFactory factory = @@ -74,14 +68,8 @@ contract DeploySafeRecovery_Script is BaseDeployScript { address(dkim) ); - address safe7579 = address(new Safe7579{ salt: bytes32(salt) }()); - address safe7579Launchpad = - address(new Safe7579Launchpad{ salt: bytes32(salt) }(entryPoint, registry)); - - console.log("Deployed Email Recovery Module at ", vm.toString(module)); - console.log("Deployed Email Recovery Handler at ", vm.toString(commandHandler)); - console.log("Deployed Safe 7579 at ", vm.toString(safe7579)); - console.log("Deployed Safe 7579 Launchpad at ", vm.toString(safe7579Launchpad)); + console.log("UniversalEmailRecoveryModule deployed at", vm.toString(module)); + console.log("SafeRecoveryCommandHandler deployed at", vm.toString(commandHandler)); vm.stopBroadcast(); } diff --git a/script/DeploySafeRecoveryWithAccountHiding.s.sol b/script/Safe7579/DeploySafeRecoveryWithAccountHiding.s.sol similarity index 65% rename from script/DeploySafeRecoveryWithAccountHiding.s.sol rename to script/Safe7579/DeploySafeRecoveryWithAccountHiding.s.sol index 30888d1b..51cac6e2 100644 --- a/script/DeploySafeRecoveryWithAccountHiding.s.sol +++ b/script/Safe7579/DeploySafeRecoveryWithAccountHiding.s.sol @@ -8,11 +8,7 @@ import { AccountHidingRecoveryCommandHandler } from "src/handlers/AccountHidingRecoveryCommandHandler.sol"; import { EmailRecoveryUniversalFactory } from "src/factories/EmailRecoveryUniversalFactory.sol"; import { EmailAuth } from "@zk-email/ether-email-auth-contracts/src/EmailAuth.sol"; - -import { Safe7579 } from "safe7579/Safe7579.sol"; -import { Safe7579Launchpad } from "safe7579/Safe7579Launchpad.sol"; -import { IERC7484 } from "safe7579/interfaces/IERC7484.sol"; -import { BaseDeployScript } from "./BaseDeployScript.s.sol"; +import { BaseDeployScript } from "../BaseDeployScript.s.sol"; // 1. `source .env` // 2. `forge script @@ -21,46 +17,45 @@ import { BaseDeployScript } from "./BaseDeployScript.s.sol"; contract DeploySafeRecoveryWithAccountHiding_Script is BaseDeployScript { address verifier; address dkim; - address dkimRegistrySigner; address emailAuthImpl; + address commandHandler; uint256 minimumDelay; address killSwitchAuthorizer; address initialOwner; + address dkimRegistrySigner; + uint256 dkimDelay; uint256 salt; function run() public override { super.run(); - address entryPoint = address(0x0000000071727De22E5E9d8BAf0edAc6f37da032); - IERC7484 registry = IERC7484(0xe0cde9239d16bEf05e62Bbf7aA93e420f464c826); vm.startBroadcast(vm.envUint("PRIVATE_KEY")); verifier = vm.envOr("VERIFIER", address(0)); dkim = vm.envOr("DKIM_REGISTRY", address(0)); - dkimRegistrySigner = vm.envOr("DKIM_SIGNER", address(0)); emailAuthImpl = vm.envOr("EMAIL_AUTH_IMPL", address(0)); + commandHandler = vm.envOr("COMMAND_HANDLER", address(0)); minimumDelay = vm.envOr("MINIMUM_DELAY", uint256(0)); killSwitchAuthorizer = vm.envAddress("KILL_SWITCH_AUTHORIZER"); initialOwner = vm.addr(vm.envUint("PRIVATE_KEY")); + dkimRegistrySigner = vm.envOr("DKIM_SIGNER", address(0)); + dkimDelay = vm.envOr("DKIM_DELAY", uint256(0)); salt = vm.envOr("CREATE2_SALT", uint256(0)); if (verifier == address(0)) { verifier = deployVerifier(initialOwner, salt); } - // Deploy Useroverridable DKIM registry - dkim = vm.envOr("DKIM_REGISTRY", address(0)); - uint256 setTimeDelay = vm.envOr("DKIM_DELAY", uint256(0)); if (dkim == address(0)) { dkim = deployUserOverrideableDKIMRegistry( - initialOwner, dkimRegistrySigner, setTimeDelay, salt + initialOwner, dkimRegistrySigner, dkimDelay, salt ); } if (emailAuthImpl == address(0)) { emailAuthImpl = address(new EmailAuth{ salt: bytes32(salt) }()); - console.log("Deployed Email Auth at", emailAuthImpl); + console.log("EmailAuth implemenation deployed at", emailAuthImpl); } EmailRecoveryUniversalFactory factory = @@ -74,14 +69,8 @@ contract DeploySafeRecoveryWithAccountHiding_Script is BaseDeployScript { dkim ); - address safe7579 = address(new Safe7579{ salt: bytes32(uint256(0)) }()); - address safe7579Launchpad = - address(new Safe7579Launchpad{ salt: bytes32(uint256(0)) }(entryPoint, registry)); - - console.log("Deployed Email Recovery Module at ", vm.toString(module)); - console.log("Deployed Email Recovery Handler at ", vm.toString(commandHandler)); - console.log("Deployed Safe 7579 at ", vm.toString(safe7579)); - console.log("Deployed Safe 7579 Launchpad at ", vm.toString(safe7579Launchpad)); + console.log("UniversalEmailRecoveryModule deployed at ", vm.toString(module)); + console.log("AccountHidingRecoveryCommandHandler deployed at ", vm.toString(commandHandler)); vm.stopBroadcast(); } diff --git a/script/Compute7579RecoveryDataHash.s.sol b/script/test/Compute7579RecoveryDataHash.s.sol similarity index 100% rename from script/Compute7579RecoveryDataHash.s.sol rename to script/test/Compute7579RecoveryDataHash.s.sol diff --git a/test/Base.t.sol b/test/Base.t.sol index e70483e1..095c4285 100644 --- a/test/Base.t.sol +++ b/test/Base.t.sol @@ -127,12 +127,12 @@ abstract contract BaseTest is RhinestoneModuleKit, Test { killSwitchAuthorizer = vm.addr(2); vm.startPrank(zkEmailDeployer); - uint256 setTimeDelay = 0; + uint256 dkimDelay = 0; UserOverrideableDKIMRegistry overrideableDkimImpl = new UserOverrideableDKIMRegistry(); ERC1967Proxy dkimProxy = new ERC1967Proxy( address(overrideableDkimImpl), abi.encodeCall( - overrideableDkimImpl.initialize, (zkEmailDeployer, zkEmailDeployer, setTimeDelay) + overrideableDkimImpl.initialize, (zkEmailDeployer, zkEmailDeployer, dkimDelay) ) ); dkimRegistry = UserOverrideableDKIMRegistry(address(dkimProxy)); diff --git a/script/test/DeployEmailRecoveryModule.t.sol b/test/unit/script/7579/EmailRecoveryModule/DeployEmailRecoveryModule.t.sol similarity index 91% rename from script/test/DeployEmailRecoveryModule.t.sol rename to test/unit/script/7579/EmailRecoveryModule/DeployEmailRecoveryModule.t.sol index 5bfec904..4201e219 100644 --- a/script/test/DeployEmailRecoveryModule.t.sol +++ b/test/unit/script/7579/EmailRecoveryModule/DeployEmailRecoveryModule.t.sol @@ -1,8 +1,9 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.12; -import { DeployEmailRecoveryModuleScript } from "../DeployEmailRecoveryModule.s.sol"; -import { BaseDeployTest } from "./BaseDeployTest.sol"; +import { DeployEmailRecoveryModuleScript } from + "script/7579/EmailRecoveryModule/DeployEmailRecoveryModule.s.sol"; +import { BaseDeployTest } from "../../BaseDeployTest.sol"; /** * @title DeployEmailRecoveryModule_Test diff --git a/script/test/DeployUniversalEmailRecoveryModule.t.sol b/test/unit/script/7579/UniversalEmailRecoveryModule/DeployUniversalEmailRecoveryModule.t.sol similarity index 92% rename from script/test/DeployUniversalEmailRecoveryModule.t.sol rename to test/unit/script/7579/UniversalEmailRecoveryModule/DeployUniversalEmailRecoveryModule.t.sol index 150928b5..8e6d4be6 100644 --- a/script/test/DeployUniversalEmailRecoveryModule.t.sol +++ b/test/unit/script/7579/UniversalEmailRecoveryModule/DeployUniversalEmailRecoveryModule.t.sol @@ -2,8 +2,8 @@ pragma solidity ^0.8.12; import { DeployUniversalEmailRecoveryModuleScript } from - "../DeployUniversalEmailRecoveryModule.s.sol"; -import { BaseDeployTest } from "./BaseDeployTest.sol"; + "script/7579/UniversalEmailRecoveryModule/DeployUniversalEmailRecoveryModule.s.sol"; +import { BaseDeployTest } from "../../BaseDeployTest.sol"; /// @title DeployUniversalEmailRecoveryModule_Test /// @notice Contains tests for deploying the Universal Email Recovery Module diff --git a/script/test/BaseDeployTest.sol b/test/unit/script/BaseDeployTest.sol similarity index 100% rename from script/test/BaseDeployTest.sol rename to test/unit/script/BaseDeployTest.sol diff --git a/script/test/DeploySafeNativeRecovery.t.sol b/test/unit/script/Safe/DeploySafeNativeRecovery.t.sol similarity index 93% rename from script/test/DeploySafeNativeRecovery.t.sol rename to test/unit/script/Safe/DeploySafeNativeRecovery.t.sol index 9d73e998..905d05de 100644 --- a/script/test/DeploySafeNativeRecovery.t.sol +++ b/test/unit/script/Safe/DeploySafeNativeRecovery.t.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.12; -import { DeploySafeNativeRecovery_Script } from "../DeploySafeNativeRecovery.s.sol"; -import { BaseDeployTest } from "./BaseDeployTest.sol"; +import { DeploySafeNativeRecovery_Script } from "script/Safe/DeploySafeNativeRecovery.s.sol"; +import { BaseDeployTest } from "../BaseDeployTest.sol"; contract DeploySafeNativeRecovery_Test is BaseDeployTest { /** @@ -26,7 +26,7 @@ contract DeploySafeNativeRecovery_Test is BaseDeployTest { BaseDeployTest.setUp(); // Disable the VERIFIER environment variable - vm.setEnv("ZK_VERIFIER", vm.toString(address(0))); + vm.setEnv("VERIFIER", vm.toString(address(0))); // Instantiate the script and run it DeploySafeNativeRecovery_Script target = new DeploySafeNativeRecovery_Script(); diff --git a/script/test/DeploySafeRecovery.t.sol b/test/unit/script/Safe7579/DeploySafeRecovery.t.sol similarity index 87% rename from script/test/DeploySafeRecovery.t.sol rename to test/unit/script/Safe7579/DeploySafeRecovery.t.sol index 21181469..bc5a6696 100644 --- a/script/test/DeploySafeRecovery.t.sol +++ b/test/unit/script/Safe7579/DeploySafeRecovery.t.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.12; -import { DeploySafeRecovery_Script } from "../DeploySafeRecovery.s.sol"; -import { BaseDeployTest } from "./BaseDeployTest.sol"; +import { DeploySafeRecovery_Script } from "script/Safe7579/DeploySafeRecovery.s.sol"; +import { BaseDeployTest } from "../BaseDeployTest.sol"; contract DeploySafeRecovery_Test is BaseDeployTest { /** diff --git a/script/test/Compute7579RecoveryDataHash.t.sol b/test/unit/script/test/Compute7579RecoveryDataHash.t.sol similarity index 68% rename from script/test/Compute7579RecoveryDataHash.t.sol rename to test/unit/script/test/Compute7579RecoveryDataHash.t.sol index a440a0a8..f555344f 100644 --- a/script/test/Compute7579RecoveryDataHash.t.sol +++ b/test/unit/script/test/Compute7579RecoveryDataHash.t.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.12; -import { Compute7579RecoveryDataHash } from "../Compute7579RecoveryDataHash.s.sol"; -import { BaseDeployTest } from "./BaseDeployTest.sol"; +import { Compute7579RecoveryDataHash } from "script/test/Compute7579RecoveryDataHash.s.sol"; +import { BaseDeployTest } from "../BaseDeployTest.sol"; contract Compute7579RecoveryDataHashTest is BaseDeployTest { function setUp() public override {