-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
create permissioned signer example #14469
base: main
Are you sure you want to change the base?
Conversation
⏱️ 1h 46m total CI duration on this PR
|
This stack of pull requests is managed by Graphite. Learn more about stacking. Join @runtian-zhou and the rest of your teammates on Graphite |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #14469 +/- ##
========================================
Coverage 60.0% 60.1%
========================================
Files 856 856
Lines 210625 211026 +401
========================================
+ Hits 126555 126865 +310
- Misses 84070 84161 +91 ☔ View full report in Codecov by Sentry. |
887d7a2
to
456f5f4
Compare
55771fc
to
070a951
Compare
} | ||
|
||
/// Another flavor of api to extract and store permissions | ||
public fun extract_permission<PermKey: copy + drop + store>( |
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.
cc @igor-aptos
}; | ||
let perms = &mut borrow_global_mut<PermStorage>(permission_signer_addr).perms; | ||
let key = copyable_any::pack(key); | ||
if(smart_table::cotains(perms, key)) { |
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.
typo: cotains => contains
6ddb481
to
8b92b98
Compare
8b92b98
to
fa646c8
Compare
c3aba3a
to
50b556b
Compare
}; | ||
let (found, idx) = vector::index_of(&granted_permissions.revoked_handles, &permission_addr); | ||
if(found) { | ||
vector::swap_remove(&mut granted_permissions.revoked_handles, idx); |
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.
revoke and remove?
|
||
struct GrantedPermissionHandles has key { | ||
active_handles: vector<address>, | ||
revoked_handles: vector<address>, |
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.
what's this for?
expiration_time: u64 | ||
): PermissionedHandle acquires GrantedPermissionHandles { | ||
assert!(!is_permissioned_signer(master), error::permission_denied(ENOT_MASTER_SIGNER)); | ||
let permission_addr = generate_auid_address(); |
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.
could we make sure there is neither object nor account exists on this address?
signer::address_of(master) == signer::address_of(permissioned), | ||
error::permission_denied(ECANNOT_AUTHORIZE) | ||
); | ||
let permission_signer = permission_signer(permissioned); |
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.
this line is so confusing.
1b8ce69
to
c7fcc0e
Compare
ae32259
to
a12a4c1
Compare
23ab901
to
e963d83
Compare
e963d83
to
e7391d6
Compare
Description
Type of Change
Which Components or Systems Does This Change Impact?
How Has This Been Tested?
Key Areas to Review
Checklist