Skip to content

Simplify permission model for smart accounts #422

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

Merged
merged 9 commits into from
Jul 24, 2023

Conversation

nkrishang
Copy link
Contributor

@nkrishang nkrishang commented Jul 6, 2023

Summary

When using the AccountPermissions permission model for smart wallets on testnet (via the SDK and dashboard), we used it in a naturally simpler way than what the contract allows. This PR simplifies the permission model to match the natural way in which it was actually used on testnets.

Currently, AccountPermissions provides role based permissions. You can create a bytes32 role and associate a set of permissions with that role. This same role can then be assigned to any number of addresses.

// pseudo code for storage layout
bytes32[] roles;
mapping(bytes32 => Permissions) rolePermissions;
mapping(address => bytes32) roleOfSigner;

In practice, we ended up assigning unique roles for each address that was granted permissions to use the smart account. No one role was used for many addresses at all. In this PR, we simplify AccountPermissions to only support setting unique permissions for each address being granted permissions to use the smart account. This simplifies the contract's data structures and overall API.

// pseudo code for storage layout
mapping(address => Permissions) permissionsOfSigner;

@nkrishang nkrishang added the enhancement New feature or request label Jul 6, 2023
@nkrishang nkrishang requested a review from joaquim-verges July 6, 2023 07:10
@nkrishang nkrishang self-assigned this Jul 6, 2023
@nkrishang nkrishang merged commit 8c3ff17 into main Jul 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant