Skip to content

Commit

Permalink
fix: enforce non zero targets on executor (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
sakulstra authored Feb 2, 2023
1 parent 70219ff commit 23fb586
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/GovHelpers.sol
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,22 @@ library GovHelpers {
internal
returns (uint256)
{
return _createProposal(AaveGovernanceV2.SHORT_EXECUTOR, delegateCalls, ipfsHash);
}

function createProposal(
address executor,
Payload[] memory delegateCalls,
bytes32 ipfsHash
) internal returns (uint256) {
return _createProposal(executor, delegateCalls, ipfsHash);
}

function _createProposal(
address executor,
Payload[] memory delegateCalls,
bytes32 ipfsHash
) private returns (uint256) {
require(block.chainid == 1, 'MAINNET_ONLY');
require(delegateCalls.length != 0, 'MINIMUM_ONE_PAYLOAD');
require(ipfsHash != bytes32(0), 'NON_ZERO_IPFS_HASH');
Expand All @@ -84,6 +100,7 @@ library GovHelpers {
bytes[] memory calldatas = new bytes[](delegateCalls.length);
bool[] memory withDelegatecalls = new bool[](delegateCalls.length);
for (uint256 i = 0; i < delegateCalls.length; i++) {
require(delegateCalls[i].target != address(0), 'NON_ZERO_TARGET');
targets[i] = delegateCalls[i].target;
signatures[i] = delegateCalls[i].signature;
calldatas[i] = delegateCalls[i].callData;
Expand All @@ -93,7 +110,7 @@ library GovHelpers {

return
AaveGovernanceV2.GOV.create(
IExecutorWithTimelock(AaveGovernanceV2.SHORT_EXECUTOR),
IExecutorWithTimelock(executor),
targets,
values,
signatures,
Expand Down

0 comments on commit 23fb586

Please sign in to comment.