Skip to content

Commit

Permalink
comment out specific zksync lines
Browse files Browse the repository at this point in the history
  • Loading branch information
wshino committed Sep 10, 2024
1 parent 666c84d commit e6ec105
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 61 deletions.
44 changes: 22 additions & 22 deletions packages/contracts/src/utils/ZKSyncCreate2Factory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,29 @@
pragma solidity ^0.8.12;

import {ZKSyncCreate2FactoryBase} from "./ZKSyncCreate2FactoryBase.sol";
// FOR_ZKSYNC:START
import {L2ContractHelper} from "@matterlabs/zksync-contracts/l2/contracts/L2ContractHelper.sol";
import {SystemContractsCaller} from "@matterlabs/zksync-contracts/l2/system-contracts/libraries/SystemContractsCaller.sol";
import {DEPLOYER_SYSTEM_CONTRACT} from "@matterlabs/zksync-contracts/l2/system-contracts/Constants.sol";
// FOR_ZKSYNC:END
// // FOR_ZKSYNC:START
// import {L2ContractHelper} from "@matterlabs/zksync-contracts/l2/contracts/L2ContractHelper.sol";
// import {SystemContractsCaller} from "@matterlabs/zksync-contracts/l2/system-contracts/libraries/SystemContractsCaller.sol";
// import {DEPLOYER_SYSTEM_CONTRACT} from "@matterlabs/zksync-contracts/l2/system-contracts/Constants.sol";
// // FOR_ZKSYNC:END

contract ZKSyncCreate2Factory is ZKSyncCreate2FactoryBase {
// FOR_ZKSYNC:START
function computeAddress(bytes32 salt, bytes32 bytecodeHash, bytes memory input) external override view returns (address) {
return L2ContractHelper.computeCreate2Address(address(this), salt, bytes32(bytecodeHash), keccak256(input));
}
// // FOR_ZKSYNC:START
// function computeAddress(bytes32 salt, bytes32 bytecodeHash, bytes memory input) external override view returns (address) {
// return L2ContractHelper.computeCreate2Address(address(this), salt, bytes32(bytecodeHash), keccak256(input));
// }

function deploy(bytes32 salt, bytes32 bytecodeHash, bytes memory input)
external
override
returns (bool success, bytes memory returnData)
{
(success, returnData) = SystemContractsCaller.systemCallWithReturndata(
uint32(gasleft()),
address(DEPLOYER_SYSTEM_CONTRACT),
uint128(0),
abi.encodeCall(DEPLOYER_SYSTEM_CONTRACT.create2, (salt, bytecodeHash, input))
);
}
// FOR_ZKSYNC:END
// function deploy(bytes32 salt, bytes32 bytecodeHash, bytes memory input)
// external
// override
// returns (bool success, bytes memory returnData)
// {
// (success, returnData) = SystemContractsCaller.systemCallWithReturndata(
// uint32(gasleft()),
// address(DEPLOYER_SYSTEM_CONTRACT),
// uint128(0),
// abi.encodeCall(DEPLOYER_SYSTEM_CONTRACT.create2, (salt, bytecodeHash, input))
// );
// }
// // FOR_ZKSYNC:END
}
78 changes: 39 additions & 39 deletions packages/contracts/test/helpers/DeploymentHelper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ import {RecoveryController, EmailAccountRecovery} from "./RecoveryController.sol
import {MessageHashUtils} from "@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol";
import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";

// FOR_ZKSYNC:START
import {ZKSyncCreate2Factory} from "../../src/utils/ZKSyncCreate2Factory.sol";
import "../../src/utils/ForwardDKIMRegistry.sol";
import {RecoveryControllerZKSync, EmailAccountRecoveryZKSync} from "./RecoveryControllerZKSync.sol";
// FOR_ZKSYNC:END
// // FOR_ZKSYNC:START
// import {ZKSyncCreate2Factory} from "../../src/utils/ZKSyncCreate2Factory.sol";
// import "../../src/utils/ForwardDKIMRegistry.sol";
// import {RecoveryControllerZKSync, EmailAccountRecoveryZKSync} from "./RecoveryControllerZKSync.sol";
// // FOR_ZKSYNC:END

contract DeploymentHelper is Test {
using ECDSA for *;
Expand All @@ -32,9 +32,9 @@ contract DeploymentHelper is Test {
SimpleWallet simpleWalletImpl;
SimpleWallet simpleWallet;

// FOR_ZKSYNC:START
RecoveryControllerZKSync recoveryControllerZKSync;
// FOR_ZKSYNC:END
// // FOR_ZKSYNC:START
// RecoveryControllerZKSync recoveryControllerZKSync;
// // FOR_ZKSYNC:END

address deployer = vm.addr(1);
address receiver = vm.addr(2);
Expand Down Expand Up @@ -145,31 +145,31 @@ contract DeploymentHelper is Test {
simpleWalletImpl = new SimpleWallet();
address recoveryControllerAddress = address(recoveryController);

// FOR_ZKSYNC:START
// Create zkSync Factory implementation
if (isZkSync()) {
ZKSyncCreate2Factory factoryImpl = new ZKSyncCreate2Factory();
// Create RecoveryControllerZKSync as EmailAccountRecovery implementation
RecoveryControllerZKSync recoveryControllerZKSyncImpl = new RecoveryControllerZKSync();
ERC1967Proxy recoveryControllerZKSyncProxy = new ERC1967Proxy(
address(recoveryControllerZKSyncImpl),
abi.encodeCall(
recoveryControllerZKSyncImpl.initialize,
(
signer,
address(verifier),
address(dkim),
address(emailAuthImpl),
address(factoryImpl)
)
)
);
recoveryControllerZKSync = RecoveryControllerZKSync(
payable(address(recoveryControllerZKSyncProxy))
);
recoveryControllerAddress = address(recoveryControllerZKSync);
}
// FOR_ZKSYNC:END
// // FOR_ZKSYNC:START
// // Create zkSync Factory implementation
// if (isZkSync()) {
// ZKSyncCreate2Factory factoryImpl = new ZKSyncCreate2Factory();
// // Create RecoveryControllerZKSync as EmailAccountRecovery implementation
// RecoveryControllerZKSync recoveryControllerZKSyncImpl = new RecoveryControllerZKSync();
// ERC1967Proxy recoveryControllerZKSyncProxy = new ERC1967Proxy(
// address(recoveryControllerZKSyncImpl),
// abi.encodeCall(
// recoveryControllerZKSyncImpl.initialize,
// (
// signer,
// address(verifier),
// address(dkim),
// address(emailAuthImpl),
// address(factoryImpl)
// )
// )
// );
// recoveryControllerZKSync = RecoveryControllerZKSync(
// payable(address(recoveryControllerZKSyncProxy))
// );
// recoveryControllerAddress = address(recoveryControllerZKSync);
// }
// // FOR_ZKSYNC:END

ERC1967Proxy simpleWalletProxy = new ERC1967Proxy(
address(simpleWalletImpl),
Expand All @@ -184,12 +184,12 @@ contract DeploymentHelper is Test {
// Set guardian address
guardian = EmailAccountRecovery(address(recoveryController))
.computeEmailAuthAddress(address(simpleWallet), accountSalt);
// FOR_ZKSYNC:START
if (isZkSync()) {
guardian = EmailAccountRecoveryZKSync(address(recoveryControllerZKSync))
.computeEmailAuthAddress(address(simpleWallet), accountSalt);
}
// FOR_ZKSYNC:END
// // FOR_ZKSYNC:START
// if (isZkSync()) {
// guardian = EmailAccountRecoveryZKSync(address(recoveryControllerZKSync))
// .computeEmailAuthAddress(address(simpleWallet), accountSalt);
// }
// // FOR_ZKSYNC:END

vm.stopPrank();
}
Expand Down

0 comments on commit e6ec105

Please sign in to comment.