Signed-off-by: AlienTornadosaurusHex <>
This commit is contained in:
AlienTornadosaurusHex 2023-05-22 18:35:05 +00:00
parent 13dfe5e065
commit 9277caf506
3 changed files with 111 additions and 111 deletions

View File

@ -5,7 +5,7 @@ The contracts can be currently found here:
* [GovernancePatchUpgrade](./contracts/v4-patch/GovernancePatchUpgrade.sol) * [GovernancePatchUpgrade](./contracts/v4-patch/GovernancePatchUpgrade.sol)
* [PatchProposal](./contracts/v4-patch/PatchProposal.sol) * [PatchProposal](./contracts/v4-patch/PatchProposal.sol)
Inlined version of the `RelayerRegistry` and `TornadoStakingRewards` are also used. Check the `diffs` folder to see how much they deviate from the `relayer-registry` repository reconstruction. VSC will possibly show red as "added". Inlined version of the `RelayerRegistry` and `TornadoStakingRewards` are also used. Check the `diffs` folder to see how much they deviate from the `relayer-registry` repository reconstruction.
For testing resistance against metamorphic contracts, we use the contracts provided by: https://github.com/0age/metamorphic.git For testing resistance against metamorphic contracts, we use the contracts provided by: https://github.com/0age/metamorphic.git

View File

@ -1,96 +1,96 @@
10a11 11d10
> import { ENSNamehash } from "./utils/ENSNamehash.sol"; < import { ENSNamehash } from "./utils/ENSNamehash.sol";
12c13,14 13,14c12
< import { TornadoStakingRewards } from "./TornadoStakingRewards.sol"; < import { TornadoStakingRewards } from "./staking/TornadoStakingRewards.sol";
< import { IENS } from "./interfaces/IENS.sol";
--- ---
> import { TornadoStakingRewards } from "./staking/TornadoStakingRewards.sol"; > import { TornadoStakingRewards } from "./TornadoStakingRewards.sol";
> import { IENS } from "./interfaces/IENS.sol"; 16,17c14,77
14,77c16,17 < import "./tornado-proxy/TornadoRouter.sol";
< interface ITornadoInstance { < import "./tornado-proxy/FeeManager.sol";
< function token() external view returns (address);
<
< function denomination() external view returns (uint256);
<
< function deposit(bytes32 commitment) external payable;
<
< function withdraw(
< bytes calldata proof,
< bytes32 root,
< bytes32 nullifierHash,
< address payable recipient,
< address payable relayer,
< uint256 fee,
< uint256 refund
< ) external payable;
< }
<
< interface IENS {
< function owner(bytes32 node) external view returns (address);
< }
<
< /*
< * @dev Solidity implementation of the ENS namehash algorithm.
< *
< * Warning! Does not normalize or validate names before hashing.
< * Original version can be found here https://github.com/JonahGroendal/ens-namehash/
< */
< library ENSNamehash {
< function namehash(bytes memory domain) internal pure returns (bytes32) {
< return namehash(domain, 0);
< }
<
< function namehash(bytes memory domain, uint256 i) internal pure returns (bytes32) {
< if (domain.length <= i) return 0x0000000000000000000000000000000000000000000000000000000000000000;
<
< uint256 len = labelLength(domain, i);
<
< return keccak256(abi.encodePacked(namehash(domain, i + len + 1), keccak(domain, i, len)));
< }
<
< function labelLength(bytes memory domain, uint256 i) private pure returns (uint256) {
< uint256 len;
< while (i + len != domain.length && domain[i + len] != 0x2e) {
< len++;
< }
< return len;
< }
<
< function keccak(
< bytes memory data,
< uint256 offset,
< uint256 len
< ) private pure returns (bytes32 ret) {
< require(offset + len <= data.length);
< assembly {
< ret := keccak256(add(add(data, 32), offset), len)
< }
< }
< }
<
< interface IFeeManager {
< function instanceFeeWithUpdate(ITornadoInstance _instance) external returns (uint160);
< }
--- ---
> import "./tornado-proxy/TornadoRouter.sol"; > interface ITornadoInstance {
> import "./tornado-proxy/FeeManager.sol"; > function token() external view returns (address);
106c46 >
< IFeeManager public immutable feeManager; > function denomination() external view returns (uint256);
>
> function deposit(bytes32 commitment) external payable;
>
> function withdraw(
> bytes calldata proof,
> bytes32 root,
> bytes32 nullifierHash,
> address payable recipient,
> address payable relayer,
> uint256 fee,
> uint256 refund
> ) external payable;
> }
>
> interface IENS {
> function owner(bytes32 node) external view returns (address);
> }
>
> /*
> * @dev Solidity implementation of the ENS namehash algorithm.
> *
> * Warning! Does not normalize or validate names before hashing.
> * Original version can be found here https://github.com/JonahGroendal/ens-namehash/
> */
> library ENSNamehash {
> function namehash(bytes memory domain) internal pure returns (bytes32) {
> return namehash(domain, 0);
> }
>
> function namehash(bytes memory domain, uint256 i) internal pure returns (bytes32) {
> if (domain.length <= i) return 0x0000000000000000000000000000000000000000000000000000000000000000;
>
> uint256 len = labelLength(domain, i);
>
> return keccak256(abi.encodePacked(namehash(domain, i + len + 1), keccak(domain, i, len)));
> }
>
> function labelLength(bytes memory domain, uint256 i) private pure returns (uint256) {
> uint256 len;
> while (i + len != domain.length && domain[i + len] != 0x2e) {
> len++;
> }
> return len;
> }
>
> function keccak(
> bytes memory data,
> uint256 offset,
> uint256 len
> ) private pure returns (bytes32 ret) {
> require(offset + len <= data.length);
> assembly {
> ret := keccak256(add(add(data, 32), offset), len)
> }
> }
> }
>
> interface IFeeManager {
> function instanceFeeWithUpdate(ITornadoInstance _instance) external returns (uint160);
> }
46c106
< FeeManager public immutable feeManager;
--- ---
> FeeManager public immutable feeManager; > IFeeManager public immutable feeManager;
142,143c82,83 82,83c142,143
< address _staking, < bytes32 _staking,
< address _feeManager < bytes32 _feeManager
--- ---
> bytes32 _staking, > address _staking,
> bytes32 _feeManager > address _feeManager
148,149c88,89 88,89c148,149
< staking = TornadoStakingRewards(_staking); < staking = TornadoStakingRewards(resolve(_staking));
< feeManager = IFeeManager(_feeManager); < feeManager = FeeManager(resolve(_feeManager));
--- ---
> staking = TornadoStakingRewards(resolve(_staking)); > staking = TornadoStakingRewards(_staking);
> feeManager = FeeManager(resolve(_feeManager)); > feeManager = IFeeManager(_feeManager);
384c324 324c384
< } < }
\ No newline at end of file
--- ---
> } > }
\ No newline at end of file

View File

@ -1,28 +1,28 @@
11,20c11 11c11,20
< < import { ITornadoGovernance } from "../interfaces/ITornadoGovernance.sol";
< interface ITornadoVault {
< function withdrawTorn(address recipient, uint256 amount) external;
< }
<
< interface ITornadoGovernance {
< function lockedBalance(address account) external view returns (uint256);
<
< function userVault() external view returns (ITornadoVault);
< }
--- ---
> import { ITornadoGovernance } from "../interfaces/ITornadoGovernance.sol"; >
54d44 > interface ITornadoVault {
< // Minor code change here we won't resolve the registry by ENS > function withdrawTorn(address recipient, uint256 amount) external;
58c48 > }
< address _relayerRegistry >
> interface ITornadoGovernance {
> function lockedBalance(address account) external view returns (uint256);
>
> function userVault() external view returns (ITornadoVault);
> }
44a54
> // Minor code change here we won't resolve the registry by ENS
48c58
< bytes32 _relayerRegistry
--- ---
> bytes32 _relayerRegistry > address _relayerRegistry
62c52 52c62
< relayerRegistry = _relayerRegistry; < relayerRegistry = resolve(_relayerRegistry);
--- ---
> relayerRegistry = resolve(_relayerRegistry); > relayerRegistry = _relayerRegistry;
143c133 133c143
< } < }
\ No newline at end of file
--- ---
> } > }
\ No newline at end of file