-
-
Notifications
You must be signed in to change notification settings - Fork 48
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
refactor: storage redesign #120
Conversation
61ec3ea
to
f55cba6
Compare
e366797
to
6cbe0d6
Compare
f55cba6
to
397ab88
Compare
34a7a83
to
f58060c
Compare
function uninstallPlugin(IPRBProxyPlugin plugin) external override onlyCallerWithProxy { | ||
// Get the method list to uninstall. | ||
bytes4[] memory methodList = plugin.methodList(); | ||
|
||
// The plugin must have at least one listed method. | ||
uint256 length = methodList.length; | ||
if (length == 0) { | ||
revert PRBProxyRegistry_PluginEmptyMethodList(plugin); | ||
} | ||
|
||
// Uninstall every method in the list. | ||
address owner = msg.sender; | ||
for (uint256 i = 0; i < length;) { | ||
delete _plugins[owner][methodList[i]]; | ||
unchecked { | ||
i += 1; | ||
} | ||
} | ||
|
||
// Log the plugin uninstallation. | ||
emit UninstallPlugin(owner, _proxies[owner], plugin); | ||
} |
Check notice
Code scanning / Slither
Reentrancy vulnerabilities
function installPlugin(IPRBProxyPlugin plugin) external override onlyCallerWithProxy { | ||
// Get the method list to install. | ||
bytes4[] memory methodList = plugin.methodList(); | ||
|
||
// The plugin must have at least one listed method. | ||
uint256 length = methodList.length; | ||
if (length == 0) { | ||
revert PRBProxyRegistry_PluginEmptyMethodList(plugin); | ||
} | ||
|
||
// Install every method in the list. | ||
address owner = msg.sender; | ||
for (uint256 i = 0; i < length;) { | ||
_plugins[owner][methodList[i]] = plugin; | ||
unchecked { | ||
i += 1; | ||
} | ||
} | ||
|
||
// Log the plugin installation. | ||
emit InstallPlugin(owner, _proxies[owner], plugin); | ||
} |
Check notice
Code scanning / Slither
Reentrancy vulnerabilities
f58060c
to
30a8cd4
Compare
397ab88
to
ea80da3
Compare
b47288b
to
c2b3225
Compare
c2b3225
to
37dc8be
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally looks good
A small thing but I think this should be updated:
Line 38 in 37dc8be
- Rename `PRBProxyHelpers` to `PRBProxyAnnex` ([#96](https://github.com/PaulRBerg/prb-proxy/pull/96)) (@PaulRBerg) |
Thanks for the review, both! @andreivladbrg - the |
7a56a9a
to
27479f6
Compare
3c7f207
to
3ee2fc3
Compare
a060837
to
3c58593
Compare
feat: add "getPluginByProxy" getter feat: add "getPermissionByProxy" getter perf: optimize "execute" refactor: delete annex refactor: delete 'system' scripts refactor: get rid of proxy storage refactor: rename getters refactor: rename "selector" param to "method" test: fix events and re-enable tests test: update tests in light of new contract API
3c58593
to
83b4993
Compare
Addresses https://github.com/cantinasec/review-sablier2/issues/13, the problem explained in #100, and PRB-01M: Insufficient Protection Against Hostile Takeover.
Changelog:
plugins
and thepermissions
are now in the registryAnnex
contract anymore