Skip to content
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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

runtian-zhou
Copy link
Contributor

Description

Type of Change

  • New feature
  • Bug fix
  • Breaking change
  • Performance improvement
  • Refactoring
  • Dependency update
  • Documentation update
  • Tests

Which Components or Systems Does This Change Impact?

  • Validator Node
  • Full Node (API, Indexer, etc.)
  • Move/Aptos Virtual Machine
  • Aptos Framework
  • Aptos CLI/SDK
  • Developer Infrastructure
  • Other (specify)

How Has This Been Tested?

Key Areas to Review

Checklist

  • I have read and followed the CONTRIBUTING doc
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I identified and added all stakeholders and component owners affected by this change as reviewers
  • I tested both happy and unhappy path of the functionality
  • I have made corresponding changes to the documentation

Copy link

trunk-io bot commented Aug 29, 2024

⏱️ 1h 46m total CI duration on this PR
Slowest 15 Jobs Cumulative Duration Recent Runs
rust-move-unit-coverage 14m 🟩
rust-move-unit-coverage 13m 🟩
rust-move-tests 9m 🟥
general-lints 9m 🟩🟩🟩🟩🟩
rust-move-unit-coverage 9m 🟩
rust-move-tests 9m 🟥
rust-cargo-deny 9m 🟩🟩🟩🟩🟩
rust-move-unit-coverage 7m 🟩
check-dynamic-deps 7m 🟩🟩🟩🟩🟩 (+1 more)
rust-move-unit-coverage 6m 🟩
rust-move-tests 3m 🟥
rust-move-tests 3m 🟥
rust-move-tests 3m 🟥
semgrep/ci 2m 🟩🟩🟩🟩🟩
file_change_determinator 1m 🟩🟩🟩🟩🟩

settingsfeedbackdocs ⋅ learn more about trunk.io

Copy link

codecov bot commented Aug 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 60.1%. Comparing base (c155fde) to head (e7391d6).
Report is 30 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

@runtian-zhou runtian-zhou force-pushed the 08-29-create_permissioned_signer_example branch 2 times, most recently from 887d7a2 to 456f5f4 Compare September 4, 2024 08:55
@runtian-zhou runtian-zhou force-pushed the 08-29-create_permissioned_signer_example branch 2 times, most recently from 55771fc to 070a951 Compare September 5, 2024 00:41
}

/// Another flavor of api to extract and store permissions
public fun extract_permission<PermKey: copy + drop + store>(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

};
let perms = &mut borrow_global_mut<PermStorage>(permission_signer_addr).perms;
let key = copyable_any::pack(key);
if(smart_table::cotains(perms, key)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: cotains => contains

@runtian-zhou runtian-zhou force-pushed the 08-29-create_permissioned_signer_example branch 3 times, most recently from 6ddb481 to 8b92b98 Compare September 9, 2024 17:09
@runtian-zhou runtian-zhou force-pushed the 08-29-create_permissioned_signer_example branch from 8b92b98 to fa646c8 Compare September 10, 2024 17:24
@runtian-zhou runtian-zhou force-pushed the 08-29-create_permissioned_signer_example branch 2 times, most recently from c3aba3a to 50b556b Compare September 12, 2024 01:49
@runtian-zhou runtian-zhou mentioned this pull request Sep 12, 2024
21 tasks
};
let (found, idx) = vector::index_of(&granted_permissions.revoked_handles, &permission_addr);
if(found) {
vector::swap_remove(&mut granted_permissions.revoked_handles, idx);
Copy link
Contributor

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>,
Copy link
Contributor

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();
Copy link
Contributor

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);
Copy link
Contributor

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.

@runtian-zhou runtian-zhou force-pushed the 08-29-create_permissioned_signer_example branch 3 times, most recently from 1b8ce69 to c7fcc0e Compare September 19, 2024 08:08
@runtian-zhou runtian-zhou force-pushed the 08-29-create_permissioned_signer_example branch 3 times, most recently from ae32259 to a12a4c1 Compare October 7, 2024 22:56
@runtian-zhou runtian-zhou force-pushed the 08-29-create_permissioned_signer_example branch 2 times, most recently from 23ab901 to e963d83 Compare October 9, 2024 21:36
@runtian-zhou runtian-zhou mentioned this pull request Oct 9, 2024
22 tasks
@runtian-zhou runtian-zhou force-pushed the 08-29-create_permissioned_signer_example branch from e963d83 to e7391d6 Compare October 15, 2024 19:03
@runtian-zhou runtian-zhou force-pushed the 08-29-create_permissioned_signer_example branch from e7391d6 to 2cee592 Compare November 15, 2024 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants