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

add permissions for fungible assets operation #14567

Open
wants to merge 1 commit into
base: 09-04-implement_rust_logics_for_permissioned_signer
Choose a base branch
from

Conversation

runtian-zhou
Copy link
Contributor

@runtian-zhou runtian-zhou commented Sep 9, 2024

Description

Implemented permissions for FA transfer.

  • Work with current Coin that already migrated to FA as well.
  • Implemented a new api deposit_with_signer so that permissions can be added to the signer back again.

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?

Added test cases. In particular, tested the entire migration path of Coin and FA.

Key Areas to Review

Make sure FA permission works well throughout the entire migration path of FA.

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 Sep 9, 2024

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

settingsfeedbackdocs ⋅ learn more about trunk.io

Copy link
Contributor Author

runtian-zhou commented Sep 9, 2024

Copy link

codecov bot commented Sep 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 60.1%. Comparing base (7c5a356) to head (bb315dd).

Additional details and impacted files
@@                                 Coverage Diff                                  @@
##           09-04-implement_rust_logics_for_permissioned_signer   #14567   +/-   ##
====================================================================================
  Coverage                                                 60.1%    60.1%           
====================================================================================
  Files                                                      857      857           
  Lines                                                   210762   210762           
====================================================================================
+ Hits                                                    126723   126744   +21     
+ Misses                                                   84039    84018   -21     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@runtian-zhou runtian-zhou force-pushed the 09-04-implement_rust_logics_for_permissioned_signer branch from 350db4c to dad258f Compare September 10, 2024 17:25
@runtian-zhou runtian-zhou force-pushed the 09-04-implement_rust_logics_for_permissioned_signer branch from dad258f to 6b4da66 Compare September 10, 2024 17:29
@runtian-zhou runtian-zhou force-pushed the 09-04-implement_rust_logics_for_permissioned_signer branch from 6b4da66 to b1fd015 Compare September 12, 2024 01:50
@runtian-zhou runtian-zhou force-pushed the 09-04-implement_rust_logics_for_permissioned_signer branch from b1fd015 to 6592c01 Compare September 17, 2024 05:08
@runtian-zhou runtian-zhou force-pushed the 09-04-implement_rust_logics_for_permissioned_signer branch from 6592c01 to 54c34ad Compare September 17, 2024 21:23
@runtian-zhou runtian-zhou force-pushed the 09-04-implement_rust_logics_for_permissioned_signer branch from 54c34ad to 1835d3d Compare September 18, 2024 06:22
@runtian-zhou runtian-zhou force-pushed the 09-04-implement_rust_logics_for_permissioned_signer branch from 1835d3d to 42decc7 Compare September 18, 2024 17:52
@runtian-zhou runtian-zhou force-pushed the 09-04-implement_rust_logics_for_permissioned_signer branch from 42decc7 to 6ac9449 Compare September 19, 2024 00:35
@runtian-zhou runtian-zhou force-pushed the 09-04-implement_rust_logics_for_permissioned_signer branch from 6ac9449 to 3ae6a87 Compare September 19, 2024 08:08
@runtian-zhou runtian-zhou force-pushed the 09-04-implement_rust_logics_for_permissioned_signer branch from 3ae6a87 to 7fbfa3e Compare October 4, 2024 20:56
@runtian-zhou runtian-zhou force-pushed the 09-04-implement_rust_logics_for_permissioned_signer branch from 7fbfa3e to f3015ce Compare October 5, 2024 01:54
@runtian-zhou runtian-zhou force-pushed the 09-04-implement_rust_logics_for_permissioned_signer branch from 2a56afe to bde993b Compare November 27, 2024 08:39
@runtian-zhou runtian-zhou force-pushed the 09-04-implement_rust_logics_for_permissioned_signer branch from bde993b to 415d5c2 Compare December 2, 2024 02:39
@runtian-zhou runtian-zhou force-pushed the 09-04-implement_rust_logics_for_permissioned_signer branch from 415d5c2 to e0409cc Compare December 2, 2024 02:43
@runtian-zhou runtian-zhou force-pushed the 09-04-implement_rust_logics_for_permissioned_signer branch from e0409cc to fb5cd39 Compare December 2, 2024 10:06
@runtian-zhou runtian-zhou force-pushed the 09-04-implement_rust_logics_for_permissioned_signer branch from fb5cd39 to 0f881a5 Compare December 4, 2024 06:14
@runtian-zhou runtian-zhou force-pushed the 09-04-implement_rust_logics_for_permissioned_signer branch from 0f881a5 to 1302971 Compare December 5, 2024 02:22
@@ -194,6 +196,10 @@ module aptos_framework::fungible_asset {
metadata: Object<Metadata>
}

struct WithdrawPermission has copy, drop, store {
metadata_address: address,
Copy link
Contributor

Choose a reason for hiding this comment

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

let's make this have store_addr as well (by default people will be giving permission to PFS only)

maybe this should be an enum?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think making it an enum is a great idea. However, I would avoid adding store_addr at the moment as this would require coordination with wallet side how the permission should be displayed.

@@ -6,6 +6,7 @@ module aptos_framework::fungible_asset {
use aptos_framework::event;
Copy link
Contributor

Choose a reason for hiding this comment

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

should we have a FungibleAssetManagementPermission - i.e. gating creating fungible assets and modifying their metadata, etc.

not sure if freezing should be part of the same, or separate one

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's not needed thanks to the FA design. Those are already encoded as permission objects.

///
/// If `owner` is a permissioned signer, the signer will be granted with permission to withdraw
/// the same amount of fund in the future.
public fun deposit_with_signer(owner: &signer, fa: FungibleAsset) acquires DeriveRefPod {
Copy link
Contributor

Choose a reason for hiding this comment

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

do we need coin::deposit_with_signer as well?

@runtian-zhou runtian-zhou marked this pull request as ready for review December 14, 2024 15:27
@runtian-zhou runtian-zhou force-pushed the 09-04-implement_rust_logics_for_permissioned_signer branch from 1302971 to 4505dc2 Compare December 14, 2024 17:59
@runtian-zhou runtian-zhou requested a review from a team as a code owner December 14, 2024 17:59
@runtian-zhou runtian-zhou force-pushed the asset_permission branch 2 times, most recently from d09b7ba to 7d7eed9 Compare December 16, 2024 09:16
@runtian-zhou runtian-zhou force-pushed the 09-04-implement_rust_logics_for_permissioned_signer branch from 4505dc2 to 2dfa163 Compare December 16, 2024 16:35
@runtian-zhou runtian-zhou force-pushed the 09-04-implement_rust_logics_for_permissioned_signer branch from 2dfa163 to 7b93a7d Compare December 17, 2024 02:27
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.

2 participants