-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
|
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
aptos-move/framework/aptos-framework/sources/permissioned_signer.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/aptos-framework/sources/permissioned_signer.move
Outdated
Show resolved
Hide resolved
6ddb481
to
8b92b98
Compare
8b92b98
to
fa646c8
Compare
c3aba3a
to
50b556b
Compare
aptos-move/framework/aptos-framework/sources/permissioned_signer.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/aptos-framework/sources/permissioned_signer.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/aptos-framework/sources/permissioned_signer.move
Outdated
Show resolved
Hide resolved
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
a56d141
to
48e06fb
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.
this also needs more documentation. will we have a documentation page as well - on how to use it?
aptos-move/framework/aptos-framework/sources/permissioned_signer.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/aptos-framework/sources/permissioned_signer.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/aptos-framework/sources/permissioned_signer.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/aptos-framework/sources/permissioned_signer.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/aptos-framework/sources/permissioned_signer.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/aptos-framework/sources/permissioned_signer.move
Outdated
Show resolved
Hide resolved
|
||
/// Authorizes `permissioned` with the given permission. This requires to have access to the `master` | ||
/// signer. | ||
public fun authorize<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.
any reason we need copy on PermKey?
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.
The reason why I needed copy initially is because smart table need copy for the key. Not sure what would be the generic requirement for your container.
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.
oh, keys. in OrderedMap, there is no restriction. in BigOrderedMap keys need to be copy, values don't.
if(simple_map::contains_key(perms, &key)) { | ||
let entry = simple_map::borrow_mut(perms, &key); | ||
entry.capacity = entry.capacity + capacity; | ||
} else { | ||
simple_map::add(perms, key, StoredPermission::V1 { capacity }); | ||
} |
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 feel like we should have two different functions for setting capacity and incrementing amount.
I would also make whole section of Permission Management to be public(friend) in this release, so that we can iterate on it later (and anyways we don't want third-party permissions for in v0)
aptos-move/framework/aptos-framework/sources/permissioned_signer.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/aptos-framework/sources/permissioned_signer.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/aptos-framework/sources/permissioned_signer.move
Outdated
Show resolved
Hide resolved
8fcdf7c
to
f8073f6
Compare
#[test_only] | ||
friend aptos_framework::permissioned_signer_tests; | ||
|
||
/// Trying to grant permission using master signer. |
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.
Should be Trying to grant permission using non-master signer
?
) | ||
} | ||
|
||
/// Return the permission handle address so that it could be used for revokation purpose. |
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.
nit: "revokation" -> "revocation"
f8073f6
to
69db8e1
Compare
Description
Type of Change
Which Components or Systems Does This Change Impact?
How Has This Been Tested?
Key Areas to Review
Checklist