scope require comment, natspec, update diffs (no change)
Signed-off-by: AlienTornadosaurusHex <>
This commit is contained in:
parent
dfbd1be6ab
commit
75cf27d7d4
@ -9,20 +9,24 @@ import "../v3-relayer-registry/GovernanceStakingUpgrade.sol";
|
||||
contract GovernancePatchUpgrade is GovernanceStakingUpgrade {
|
||||
mapping(uint256 => bytes32) public proposalCodehashes;
|
||||
|
||||
// The stakingRewardsAddress sets the immutable to the new staking contract
|
||||
constructor(
|
||||
address stakingRewardsAddress,
|
||||
address gasCompLogic,
|
||||
address userVaultAddress
|
||||
) public GovernanceStakingUpgrade(stakingRewardsAddress, gasCompLogic, userVaultAddress) {}
|
||||
|
||||
/// @notice Return the version of the contract
|
||||
function version() external pure virtual override returns (string memory) {
|
||||
return "4.patch-exploit";
|
||||
}
|
||||
|
||||
// This should guarantee that the proposal extcodehashes are good
|
||||
/**
|
||||
* @notice Execute a proposal
|
||||
* @dev This upgrade should protect against Metamorphic contracts by comparing the proposal's extcodehash with a stored one
|
||||
* @param proposalId The proposal's ID
|
||||
*/
|
||||
function execute(uint256 proposalId) public payable virtual override(Governance) {
|
||||
require(msg.sender != address(this), "pseudo-external function");
|
||||
require(msg.sender != address(this), "Governance::propose: pseudo-external function");
|
||||
|
||||
Proposal storage proposal = proposals[proposalId];
|
||||
|
||||
@ -39,7 +43,14 @@ contract GovernancePatchUpgrade is GovernanceStakingUpgrade {
|
||||
super.execute(proposalId);
|
||||
}
|
||||
|
||||
// This should store the proposal extcodehash
|
||||
/**
|
||||
* @notice Internal function called from propoese
|
||||
* @dev This should store the extcodehash of the proposal contract
|
||||
* @param proposer proposer address
|
||||
* @param target smart contact address that will be executed as result of voting
|
||||
* @param description description of the proposal
|
||||
* @return proposalId new proposal id
|
||||
*/
|
||||
function _propose(
|
||||
address proposer,
|
||||
address target,
|
||||
|
@ -16,9 +16,17 @@ interface Proxy {
|
||||
function upgradeTo(address newImplementation) external;
|
||||
}
|
||||
|
||||
// We will have to do this because of the contract size limit
|
||||
|
||||
/**
|
||||
* @notice Contract which should help the proposal deploy the necessary contracts.
|
||||
*/
|
||||
contract PatchProposalContractsFactory {
|
||||
/**
|
||||
* @notice Create a new TornadoStakingRewards contract.
|
||||
* @param governance The address of Tornado Cash Goveranance.
|
||||
* @param torn The torn token address.
|
||||
* @param registry The address of the relayer registry.
|
||||
* @return The address of the new staking contract.
|
||||
*/
|
||||
function createStakingRewards(
|
||||
address governance,
|
||||
address torn,
|
||||
@ -27,6 +35,14 @@ contract PatchProposalContractsFactory {
|
||||
return address(new TornadoStakingRewards(governance, torn, registry));
|
||||
}
|
||||
|
||||
/**
|
||||
* @notice Create a new RelayerRegistry contract.
|
||||
* @param torn The torn token address.
|
||||
* @param governance The address of Tornado Cash Goveranance.
|
||||
* @param ens The ens registrar address.
|
||||
* @param staking The TornadoStakingRewards contract address.
|
||||
* @return The address of the new registry contract.
|
||||
*/
|
||||
function createRegistryContract(
|
||||
address torn,
|
||||
address governance,
|
||||
@ -38,6 +54,9 @@ contract PatchProposalContractsFactory {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @notice Proposal which should patch governance against the metamorphic contract replacement vulnerability.
|
||||
*/
|
||||
contract PatchProposal {
|
||||
using SafeMath for uint256;
|
||||
using Address for address;
|
||||
@ -54,7 +73,7 @@ contract PatchProposal {
|
||||
patchProposalContractsFactory = PatchProposalContractsFactory(_patchProposalContractsFactory);
|
||||
}
|
||||
|
||||
// Aight lets do this sirs
|
||||
/// @notice Function to execute the proposal.
|
||||
function executeProposal() external {
|
||||
// address(this) has to be governance
|
||||
address payable governance = payable(address(this));
|
||||
|
@ -89,8 +89,3 @@
|
||||
---
|
||||
> staking = TornadoStakingRewards(_staking);
|
||||
> feeManager = IFeeManager(_feeManager);
|
||||
324c384
|
||||
< }
|
||||
\ No newline at end of file
|
||||
---
|
||||
> }
|
||||
|
@ -21,8 +21,3 @@
|
||||
< relayerRegistry = resolve(_relayerRegistry);
|
||||
---
|
||||
> relayerRegistry = _relayerRegistry;
|
||||
133c143
|
||||
< }
|
||||
\ No newline at end of file
|
||||
---
|
||||
> }
|
||||
|
Loading…
Reference in New Issue
Block a user