Skip to content

Commit

Permalink
Fix RoleRevoked event processing
Browse files Browse the repository at this point in the history
  • Loading branch information
TucksonDev committed Dec 29, 2023
1 parent 1491b37 commit 24c30ad
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions examples/verify-rollup/src/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ type RoleGrantedLogArgs = {
sender: `0x${string}`;
};

type RoleRevokedLogArgs = {
role: `0x${string}`;
account: `0x${string}`;
sender: `0x${string}`;
};

type SetValidKeysetLogArgs = {
keysetHash: `0x${string}`;
keysetBytes: `0x${string}`;
Expand Down Expand Up @@ -139,7 +145,7 @@ const RoleRevokedEventAbi: AbiEventItem = {
type: 'address',
},
],
name: 'RoleGranted',
name: 'RoleRevoked',
type: 'event',
};

Expand Down Expand Up @@ -248,12 +254,15 @@ export const getUpgradeExecutorPrivilegedAccounts = async (
}

roleRevokedEvents.forEach((roleRevokedEvent) => {
const account = (roleRevokedEvent.args as RoleGrantedLogArgs).account;
const role = (roleRevokedEvent.args as RoleGrantedLogArgs).role;
const account = (roleRevokedEvent.args as RoleRevokedLogArgs).account;
const role = (roleRevokedEvent.args as RoleRevokedLogArgs).role;

const roleIndex = privilegedAccounts[account].findIndex((accRole) => accRole == role);
if (roleIndex >= 0) {
privilegedAccounts[account] = privilegedAccounts[account].splice(roleIndex, 1);
privilegedAccounts[account].splice(roleIndex, 1);
if (privilegedAccounts[account].length === 0) {
delete privilegedAccounts[account];
}
}
});

Expand Down

0 comments on commit 24c30ad

Please sign in to comment.