Fixed admin proxy bug and redeploy sepolia contracts

This commit is contained in:
Tornado Contrib 2024-03-30 22:14:22 +00:00
parent 283b2bab01
commit 1dd404656f
Signed by: tornadocontrib
GPG Key ID: 60B4DF1A076C64B1
6 changed files with 69 additions and 33 deletions

@ -0,0 +1,24 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
import { TransparentUpgradeableProxy } from "@openzeppelin/contracts-v3/proxy/TransparentUpgradeableProxy.sol";
/**
* @dev TransparentUpgradeableProxy where admin is allowed to call implementation methods.
*/
contract AdminUpgradeableProxy is TransparentUpgradeableProxy {
/**
* @dev Initializes an upgradeable proxy backed by the implementation at `_logic`.
*/
constructor(address _logic, address _admin, bytes memory _data)
public
payable
TransparentUpgradeableProxy(_logic, _admin, _data)
{ }
/**
* @dev Override to allow admin access the fallback function.
*/
function _beforeFallback() internal override { }
}

@ -2,12 +2,12 @@
pragma solidity ^0.6.12; pragma solidity ^0.6.12;
import { OwnableLibrary } from "../libraries/OwnableLibrary.sol"; import { OwnableLibrary } from "../libraries/OwnableLibrary.sol";
import { TransparentUpgradeableProxy } from "@openzeppelin/contracts-v3/proxy/TransparentUpgradeableProxy.sol"; import { AdminUpgradeableProxy } from "../AdminUpgradeableProxy.sol";
/** /**
* @dev Enables testnet contracts to be upgraded by the governance and maintainer, since we don't want to waste time * @dev Enables testnet contracts to be upgraded by the governance and maintainer, since we don't want to waste time
*/ */
contract TestnetAdminProxy is TransparentUpgradeableProxy { contract TestnetAdminProxy is AdminUpgradeableProxy {
modifier onlyOwner { modifier onlyOwner {
require(OwnableLibrary.getOwner() == msg.sender, "Not an owner"); require(OwnableLibrary.getOwner() == msg.sender, "Not an owner");
_; _;
@ -17,7 +17,7 @@ contract TestnetAdminProxy is TransparentUpgradeableProxy {
address _logic, address _logic,
address _admin, address _admin,
bytes memory _data bytes memory _data
) public payable TransparentUpgradeableProxy(_logic, _admin, _data) { ) public payable AdminUpgradeableProxy(_logic, _admin, _data) {
OwnableLibrary.setOwner(msg.sender); OwnableLibrary.setOwner(msg.sender);
} }

@ -6,7 +6,7 @@ pragma experimental ABIEncoderV2;
import { IERC20 } from "@openzeppelin/contracts-v3/token/ERC20/IERC20.sol"; import { IERC20 } from "@openzeppelin/contracts-v3/token/ERC20/IERC20.sol";
import { LoopbackProxy } from "../LoopbackProxy.sol"; import { LoopbackProxy } from "../LoopbackProxy.sol";
import { AdminUpgradeableProxy } from "./AdminUpgradeableProxy.sol"; import { AdminUpgradeableProxy } from "../AdminUpgradeableProxy.sol";
import { GovernanceExploitPatchUpgrade } from "./GovernanceExploitPatchUpgrade.sol"; import { GovernanceExploitPatchUpgrade } from "./GovernanceExploitPatchUpgrade.sol";
import { TornadoStakingRewards } from "../TornadoStakingRewards.sol"; import { TornadoStakingRewards } from "../TornadoStakingRewards.sol";

@ -76,6 +76,12 @@ const config: HardhatUserConfig = {
}, },
hardhat: {}, hardhat: {},
}, },
etherscan: {
apiKey: process.env.ETHERSCAN
},
sourcify: {
enabled: true
}
}; };
export default config; export default config;

@ -21,6 +21,7 @@ import {
TornadoVault__factory, TornadoVault__factory,
Echoer__factory, Echoer__factory,
TestnetFeeManager__factory, TestnetFeeManager__factory,
Aggregator__factory,
} from '../typechain-types'; } from '../typechain-types';
import type { SignerWithAddress } from '@nomicfoundation/hardhat-ethers/signers'; import type { SignerWithAddress } from '@nomicfoundation/hardhat-ethers/signers';
const { const {
@ -312,6 +313,10 @@ async function deployGovernance(instances: InstanceRegistry.TornadoStruct[]): Pr
TornadoRouter.target TornadoRouter.target
).then(t => t.wait()); ).then(t => t.wait());
// Deploy Aggregator
const Aggregator = await (new Aggregator__factory(owner)).deploy(ensAddress || ZeroAddress, RelayerRegistryProxy.target);
await Aggregator.waitForDeployment();
// Upgrade Governance // Upgrade Governance
const GovernanceV5 = await new GovernanceProposalStateUpgrade__factory(owner).deploy( const GovernanceV5 = await new GovernanceProposalStateUpgrade__factory(owner).deploy(
TornadoStakingRewardsProxy.target, TornadoStakingRewardsProxy.target,
@ -343,6 +348,7 @@ async function deployGovernance(instances: InstanceRegistry.TornadoStruct[]): Pr
TornadoStakingRewardsProxy: TornadoStakingRewardsProxy.target, TornadoStakingRewardsProxy: TornadoStakingRewardsProxy.target,
TornadoStakingRewardsImpl: TornadoStakingRewardsImpl.target, TornadoStakingRewardsImpl: TornadoStakingRewardsImpl.target,
TornadoRouter: TornadoRouter.target, TornadoRouter: TornadoRouter.target,
Aggregator: Aggregator.target,
Echoer: Echoer.target, Echoer: Echoer.target,
}); });
} }

@ -1,50 +1,50 @@
{ {
"DAI": "0xFF34B3d4Aee8ddCd6F9AFFFB6Fe49bD371b8a357", "DAI": "0xFF34B3d4Aee8ddCd6F9AFFFB6Fe49bD371b8a357",
"Hasher": "0xC91747348867587bbdBe6450Be59A215490517B3", "Hasher": "0x20bc314FC55345d74235731B6C0Cd57ede6cdF2F",
"Verifier": "0xA25b35DD529d25EfC4b7aC44f26C72924d620Fba", "Verifier": "0xAE523682eB597e057acA3dC009161a122656F00e",
"instances": [ "instances": [
{ {
"addr": "0x44ddE10DeEacD8B91799ff02E4493749dDD320d8" "addr": "0x8C4A04d872a6C1BE37964A21ba3a138525dFF50b"
}, },
{ {
"addr": "0x2365a6BfFbaB6f18EFb9228f394a6aaEEf3F24bc" "addr": "0x8cc930096B4Df705A007c4A039BDFA1320Ed2508"
}, },
{ {
"addr": "0x3a28921a352D4D8e5A500Ed4a3EECfD6e641C783" "addr": "0x8D10d506D29Fc62ABb8A290B99F66dB27Fc43585"
}, },
{ {
"addr": "0x38305EE06D4D89ADb911C603D0df34DE4aE2bFa7" "addr": "0x44c5C92ed73dB43888210264f0C8b36Fd68D8379"
}, },
{ {
"addr": "0x6B9A18d1C227a4972bB6512fB8587d12A1356027" "addr": "0x6921fd1a97441dd603a997ED6DDF388658daf754"
}, },
{ {
"addr": "0x68DAD9C7BfFe61B44446d894a352E10416c47AfA" "addr": "0x50a637770F5d161999420F7d70d888DE47207145"
}, },
{ {
"addr": "0xB62F3D4ADe05AB395aBBccAA8F45A2A386C67396" "addr": "0xecD649870407cD43923A816Cc6334a5bdf113621"
}, },
{ {
"addr": "0xEDFe671616d42F98E78Afabb6907b9E37d1eD900" "addr": "0x73B4BD04bF83206B6e979BE2507098F92EDf4F90"
} }
], ],
"TORN": "0x9F2eE685810704bbE0Fd7F1Ad5D905CE103e7fA0", "TORN": "0x3AE6667167C0f44394106E197904519D808323cA",
"GovernanceProxy": "0x094ed954Dbf3dDEfa116339a62c6ACdc27eD400e", "GovernanceProxy": "0xe5324cD7602eeb387418e594B87aCADee08aeCAD",
"GovernanceV1": "0x46c74ee87E3Bd0BEBd6d9D00af3e046352d33dE3", "GovernanceV1": "0xC70c0EDAaa236D48454786719aab1935867b45Be",
"GovernanceV5": "0x5e818EE040dA206bd1744d6058Ba2b11c73dBb60", "GovernanceV5": "0x27fb0722D38996ff3ffa2F65a959Ec2Cd95C9525",
"GovernanceVesting": "0xEc34f96654D980CfeA8A2Ad33CC44B957996Cd47", "GovernanceVesting": "0x488F1d0135eF240D4594273AA5E05782c5d39De1",
"GasCompensationVault": "0xD5841cAf0Fd3C9F2b168Cb0db3497B7b0B5ba0b2", "GasCompensationVault": "0x258356291E9000270118b07396fc8BFdF6646041",
"TornadoVault": "0x89D330452fDE7054fCbf56F45C2a15bBee1408CE", "TornadoVault": "0x09Aedf485b0F3Ab213015F13dBe15d9490E9BfBD",
"InstanceRegistryProxy": "0x61be247c2Da9E008d359bF7ae7CA69d4d8eA058a", "InstanceRegistryProxy": "0xdbBeC11BE17AD70B931DB6e01Bcd1f6Ae973b14E",
"InstanceRegistryImpl": "0xA5079F75FE958D8634ce5093D901F4bFA0bbc56B", "InstanceRegistryImpl": "0x4e69fD587118dFb64957d18654E3894118E9B1BF",
"FeeManagerProxy": "0x16F3B900d28e15BEb1f36351837190f758fEDfa7", "FeeManagerProxy": "0x5BEd99c71f9416C2F8E1c36052AdA73A0d4dbe4e",
"FeeManagerImpl": "0xD42b5491b343c370661E85e49d7F335C410B1BCF", "FeeManagerImpl": "0x4ff67cC3Cd810556DD6ef72D12D72dCFa925Ff95",
"RelayerRegistryProxy": "0x3A7c2D289c758cE6C35eAb6D0F0d1c1635C3eCF7", "RelayerRegistryProxy": "0x1428e5d2356b13778A13108b10c440C83011dfB8",
"RelayerRegistryImpl": "0xAA602af0F1755cC12c0C13AA18418c26aB9F4008", "RelayerRegistryImpl": "0xD6663593E71e4916eCb6f6606e1A6FbfA1634ffA",
"RelayerRegistryMock": "0x504D5080b6bffCFEC5336dA55132F974230b4BA5", "RelayerRegistryMock": "0x1df99D4c612A7f70E60ED736A497DAFD7702f8aB",
"TornadoStakingRewardsProxy": "0xCb64E517F916b88Bd8Fb1D8908D8fFD50a59CE31", "TornadoStakingRewardsProxy": "0x6d0018890751Efd31feb8166711B16732E2b496b",
"TornadoStakingRewardsImpl": "0x23d4993209746865F0D7A2de5E9579D9823c25D0", "TornadoStakingRewardsImpl": "0xe2e051c18baACA3Bfeb71b578f3748C519CA0628",
"TornadoRouter": "0xc150D7dc0d11b8357b3f4Add7c173558c5FCE90A", "TornadoRouter": "0x1572AFE6949fdF51Cb3E0856216670ae9Ee160Ee",
"Echoer": "0x81D03CB94a761357629d89D4c921272F3fBfd80C", "Aggregator": "0x4088712AC9fad39ea133cdb9130E465d235e9642",
"Aggregator": "0xb2B6032e8668C8603D095a4D3B55A660C9081317" "Echoer": "0xcDD1fc3F5ac2782D83449d3AbE80D6b7B273B0e5"
} }