-
Notifications
You must be signed in to change notification settings - Fork 366
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
Add optional delay to AccessControl role grants #1317
base: main
Are you sure you want to change the base?
Conversation
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.
I left a small suggestion besides the missing tests that still need to be added.
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.
So far, so good @immrsd! I left a few minor comments
#[starknet::interface] | ||
pub trait IAccessControlWithDelay<TState> { | ||
fn grant_role_with_delay(ref self: TState, role: felt252, account: ContractAddress, delay: u64); | ||
} |
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.
We should also add this to the ABI, no?
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.
Also, I wonder if there's some value in having a new src5 id for this. I really don't think it's worth it, but I'm asking out loud just in case
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.
- Included this function and also new
get_role_status
function to the ABI - I don't think it's worth it, especially considering difficulties with registering the additional interface ID (we gonna need two different initializers and also solve the problem of registering new interface ID for an upgraded contract)
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1317 +/- ##
==========================================
- Coverage 92.26% 89.59% -2.68%
==========================================
Files 59 83 +24
Lines 1811 3557 +1746
==========================================
+ Hits 1671 3187 +1516
- Misses 140 370 +230
... and 80 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
Notable changes since the last update:
Now, the functions work in such way that the state after the call is consistent with the last executed call:
|
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.
Amazing job @immrsd. Left some small comments, but the PR looks great. Let's not forget to add the corresponding entries to the doc.
Fixes #1261
Continues the work started in #1262
This implementation is backward compatible. Contracts using the existing AccessControl component should be able to upgrade to this implementation without breaking the storage or the logic since they will have effective_from set as 0 by default for existing roles, and the AccountRoleInfo active member layout is compatible with the current boolean.
NOTE: This is a POC, so it lacks tests and documentation yet. MUST NOT be used as it is until is finished.
PR Checklist