Skip to content

Commit

Permalink
fix: handle unknown Safe call in getValidators
Browse files Browse the repository at this point in the history
  • Loading branch information
spsjvc committed Feb 14, 2025
1 parent 415968f commit d0151aa
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
15 changes: 14 additions & 1 deletion src/getValidators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,23 @@ export async function getValidators<TChain extends Chain>(
abi: [execTransactionABI],
data: tx.input,
});

const execTransactionCalldataData = execTransactionCalldata[2];
const execTransactionCalldataDataFnSelector = execTransactionCalldataData.slice(0, 10);

if (execTransactionCalldataDataFnSelector !== upgradeExecutorExecuteCallFunctionSelector) {
console.warn(
`[getValidators] unable to decode "execTransaction" calldata, tx id: ${tx.hash}`,
);
isAccurate = false;
return acc;
}

const { args: executeCallCalldata } = decodeFunctionData({
abi: [executeCallABI],
data: execTransactionCalldata[2],
data: execTransactionCalldataData,
});

return updateAccumulator(acc, executeCallCalldata[1]);
}
default: {
Expand Down
2 changes: 1 addition & 1 deletion src/getValidators.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ it('getValidators return all validators (Xai)', async () => {
rollup: '0xc47dacfbaa80bd9d8112f4e8069482c2a3221336',
});
expect(validators).toEqual(['0x25EA41f0bDa921a0eBf48291961B1F10b59BC6b8']);
expect(isAccurate).toBeTruthy();
expect(isAccurate).toBeFalsy();
});

// https://sepolia.arbiscan.io/tx/0x5b0b49e0259289fc89949a55a5ad35a8939440a55065d29b14e5e7ef7494efff
Expand Down

0 comments on commit d0151aa

Please sign in to comment.