Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Certora Audit] G-03. ERC165Handler.setSupportedInterface(): Logic and storage access optimization #890

Merged
merged 1 commit into from
Jan 9, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions contracts/handler/extensible/ERC165Handler.sol
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,15 @@ abstract contract ERC165Handler is ExtensibleBase, IERC165Handler {
ISafe safe = ISafe(payable(_manager()));
// invalid interface id per ERC165 spec
require(interfaceId != 0xffffffff, "invalid interface id");
bool current = safeInterfaces[safe][interfaceId];
if (supported && !current) {
safeInterfaces[safe][interfaceId] = true;
emit AddedInterface(safe, interfaceId);
} else if (!supported && current) {
delete safeInterfaces[safe][interfaceId];
emit RemovedInterface(safe, interfaceId);
mapping(bytes4 => bool) storage safeInterface = safeInterfaces[safe];
bool current = safeInterface[interfaceId];
if (supported != current) {
safeInterface[interfaceId] = supported;
if (supported) {
emit AddedInterface(safe, interfaceId);
} else {
emit RemovedInterface(safe, interfaceId);
}
}
}

Expand Down
Loading