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

Conversation

runtian-zhou
Copy link
Contributor

@runtian-zhou runtian-zhou commented Aug 29, 2024

Description

Implemented aptos framework code for the permissioned signer.

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?

Implemented tests to cover the entire lifecycle of a permission handle.

Key Areas to Review

Whether the api is safe to use.

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 48m 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 🟥
check-dynamic-deps 9m 🟩🟩🟩🟩🟩 (+2 more)
general-lints 9m 🟩🟩🟩🟩🟩
rust-move-unit-coverage 9m 🟩
rust-move-tests 9m 🟥
rust-cargo-deny 9m 🟩🟩🟩🟩🟩
rust-move-unit-coverage 7m 🟩
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
Contributor Author

runtian-zhou commented Aug 29, 2024

This stack of pull requests is managed by Graphite. Learn more about stacking.

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
@runtian-zhou runtian-zhou mentioned this pull request Sep 5, 2024
10 tasks
@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
@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 09-04-implement_rust_logics_for_permissioned_signer branch from bcd5d8b to 950cee8 Compare January 14, 2025 19:07
@runtian-zhou runtian-zhou force-pushed the 08-29-create_permissioned_signer_example branch from 8bb63e9 to 0d1e3e3 Compare January 14, 2025 19:07
@runtian-zhou runtian-zhou force-pushed the 09-04-implement_rust_logics_for_permissioned_signer branch from 950cee8 to dce566c Compare January 14, 2025 19:10
@runtian-zhou runtian-zhou force-pushed the 08-29-create_permissioned_signer_example branch from 0d1e3e3 to eca655d Compare January 14, 2025 19:10
@runtian-zhou runtian-zhou force-pushed the 09-04-implement_rust_logics_for_permissioned_signer branch from dce566c to 43bca73 Compare January 14, 2025 19:19
@runtian-zhou runtian-zhou force-pushed the 08-29-create_permissioned_signer_example branch from eca655d to 505aa5b Compare January 14, 2025 19:19
@runtian-zhou runtian-zhou force-pushed the 09-04-implement_rust_logics_for_permissioned_signer branch from 43bca73 to e0acd0d Compare January 14, 2025 19:48
@runtian-zhou runtian-zhou force-pushed the 08-29-create_permissioned_signer_example branch from 505aa5b to c490a98 Compare January 14, 2025 19:49
@runtian-zhou runtian-zhou force-pushed the 09-04-implement_rust_logics_for_permissioned_signer branch from e0acd0d to c636530 Compare January 14, 2025 20:25
@runtian-zhou runtian-zhou force-pushed the 08-29-create_permissioned_signer_example branch from c490a98 to 299f758 Compare January 14, 2025 20:25
@runtian-zhou runtian-zhou force-pushed the 09-04-implement_rust_logics_for_permissioned_signer branch from c636530 to 7be76a1 Compare January 14, 2025 20:28
@runtian-zhou runtian-zhou force-pushed the 08-29-create_permissioned_signer_example branch from 299f758 to b5e81dc Compare January 14, 2025 20:28
@runtian-zhou runtian-zhou force-pushed the 09-04-implement_rust_logics_for_permissioned_signer branch from 7be76a1 to fff45bf Compare January 14, 2025 21:03
@runtian-zhou runtian-zhou force-pushed the 08-29-create_permissioned_signer_example branch from b5e81dc to 3b84051 Compare January 14, 2025 21:04
@runtian-zhou runtian-zhou force-pushed the 09-04-implement_rust_logics_for_permissioned_signer branch from fff45bf to 4711888 Compare January 14, 2025 21:27
@runtian-zhou runtian-zhou force-pushed the 08-29-create_permissioned_signer_example branch from 3b84051 to 90813bb Compare January 14, 2025 21:27
@runtian-zhou runtian-zhou force-pushed the 09-04-implement_rust_logics_for_permissioned_signer branch from 4711888 to 23524b5 Compare January 14, 2025 22:02
@runtian-zhou runtian-zhou force-pushed the 08-29-create_permissioned_signer_example branch from 90813bb to a448e72 Compare January 14, 2025 22:02
@runtian-zhou runtian-zhou force-pushed the 09-04-implement_rust_logics_for_permissioned_signer branch from 23524b5 to 20fa44c Compare January 14, 2025 22:34
@runtian-zhou runtian-zhou force-pushed the 08-29-create_permissioned_signer_example branch from a448e72 to ca2f656 Compare January 14, 2025 22:34
if (big_ordered_map::contains(perms, &key)) {
let value = perms.remove(&key);
let return_ = mutate(&mut value);
perms.upsert(key, value);
Copy link
Contributor

Choose a reason for hiding this comment

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

since you are removing, you can just call add

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

}
}

/// Authorizes `permissioned` with a given capacity and increment the existing capacity if present.
Copy link
Contributor

Choose a reason for hiding this comment

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

I agree, I think we do have a convention in all of framework code to put private and public(friend) functions below the fold, and put public functions at the time.

Comment on lines 402 to 410
if (big_ordered_map::contains(perms, &key)) {
let value = perms.remove(&key);
mutate(&mut value);
perms.upsert(key, value);
} else {
big_ordered_map::add(perms, key, default);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

use move2 syntax (and elsewhere)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated code

@runtian-zhou runtian-zhou force-pushed the 08-29-create_permissioned_signer_example branch from ca2f656 to d035654 Compare January 14, 2025 23:05
@runtian-zhou runtian-zhou merged commit e72786a into 09-04-implement_rust_logics_for_permissioned_signer Jan 14, 2025
41 of 45 checks passed
@runtian-zhou runtian-zhou deleted the 08-29-create_permissioned_signer_example branch January 14, 2025 23:07
@runtian-zhou runtian-zhou restored the 08-29-create_permissioned_signer_example branch January 14, 2025 23:07
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.

6 participants