Skip to content

Commit

Permalink
fix: optimise length read
Browse files Browse the repository at this point in the history
  • Loading branch information
web3rover committed Sep 16, 2024
1 parent 4a7ea00 commit a6dee6b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions contracts/Governance/ACMCommandsAggregator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ contract ACMCommandsAggregator {
* @notice Event emitted when permissions are executed
*/
event PermissionsExecuted(uint256 index);

/*
* @notice Error to be thrown when permissions are empty
*/
Expand All @@ -75,7 +75,7 @@ contract ACMCommandsAggregator {
if (_permissions.length == 0) {
revert EmptyPermissions();
}

uint256 index = permissions.length;
permissions.push();

Expand All @@ -98,7 +98,8 @@ contract ACMCommandsAggregator {
* @param index Index of the permissions array
*/
function executePermissions(uint256 index) external {
for (uint256 i = 0; i < permissions[index].length; i++) {
uint256 length = permissions[index].length;
for (uint256 i = 0; i < length; i++) {
if (permissions[index][i].permissionType == PermissionType.GIVE) {
ACM.giveCallPermission(
permissions[index][i].contractAddress,
Expand Down

0 comments on commit a6dee6b

Please sign in to comment.