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

Delegated accounts custom errors #832

Open
wants to merge 2 commits into
base: custom-errors
Choose a base branch
from

Conversation

scotthconner
Copy link

No description provided.

Comment on lines +29 to +32
modifier onlyAccountAdmin(address account) {
require(accounts[account].admins.contains(msg.sender), CallerNotAdmin());
_;
}

Check notice

Code scanning / Slither

Incorrect modifier

Modifier PermissionController.onlyAccountAdmin(address) (src/contracts/core/PermissionController.sol#29-32) does not always execute _; or revert
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

false alarm it seems

}

// The mapping of account address to all of the delegated account info for it.
mapping(address => DelegatedAccountInfo) internal accounts;

Check failure

Code scanning / Slither

Uninitialized state variables

PermissionControllerStorage.accounts (src/contracts/core/PermissionControllerStorage.sol#45) is never initialized. It is used in: - PermissionController.createAccount() (src/contracts/core/PermissionController.sol#39-55)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems erroneous?

@ypatil12 ypatil12 force-pushed the custom-errors branch 2 times, most recently from db2ccda to 153d625 Compare October 17, 2024 06:45
1) Interface for composable permission controller.
2) Storage layout for permission controller.
3) Initial implementation for controller.

I also added a library for a bytes4 enumerable set, since OZ didn't have
one. We do this so people can easily inspect which permissions on which
contracts people have. We could also add an index for which contracts
have permissions, but I figured that getting the list of important
addresses (core contracts + AVS contracts) would be far more legibile
off-chain. We could maintain it on chain and provide that list of
contracts, and quite frankly it would be great because then you could
determine ALL permissions that a user had simply with view functions. I
might add this incrementally if we can align on the basics here.
@ypatil12 ypatil12 force-pushed the delegated-accounts-custom-errors branch from 1c323e2 to 6d96106 Compare October 17, 2024 19:36
Comment on lines +91 to +93
//////////////////////////////////////////////////
// Public Introspection Interface
//////////////////////////////////////////////////

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the idea that the core protocol functions would check one of these view functions to see if it's an admin or if it's a delegate and has the right permissions?

emit AccountDelegateStateChange(account, msg.sender, target, selector, delegate, hasPermission);
}

//////////////////////////////////////////////////
Copy link

@0xrajath 0xrajath Oct 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would need a hasPermission view function too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants