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 CustomTransferPermission #15615

Open
wants to merge 6 commits into
base: 09-09-add_perimission_checks_to_object
Choose a base branch
from

Conversation

igor-aptos
Copy link
Contributor

Description

How Has This Been Tested?

Key Areas to Review

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
  • Move Compiler
  • Other (specify)

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 Dec 16, 2024

⏱️ 8m total CI duration on this PR
Job Cumulative Duration Recent Runs
rust-move-tests 3m 🟥
check-dynamic-deps 2m 🟩
rust-cargo-deny 2m 🟩
general-lints 32s 🟩
semgrep/ci 22s 🟩
file_change_determinator 12s 🟩
permission-check 7s 🟩
permission-check 2s 🟩

🚨 1 job on the last run was significantly faster/slower than expected

Job Duration vs 7d avg Delta
check-dynamic-deps 2m 1m +98%

settingsfeedbackdocs ⋅ learn more about trunk.io

}

public(friend) fun set_custom_transfer_permission_internal(object_addr: address, permission_key: PermKey) {
let permision_key = copyable_any::pack(permission_key);
Copy link

Choose a reason for hiding this comment

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

The variable permision_key contains a typo and should be spelled permission_key to match the struct field name and maintain consistent spelling throughout the codebase.

Spotted by Graphite Reviewer

Is this helpful? React 👍 or 👎 to let us know.

Comment on lines +481 to +483
if (exists<CustomTransferPermission>(ref.self)) {
assert!(borrow_global<CustomTransferPermission>(ref.self).permision_key == permision_key, error::invalid_state(ECUSTOM_TRANSFER_PERMISSION_ALREADY_SET));
} else {
Copy link

Choose a reason for hiding this comment

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

The code is using ref.self but ref is not defined in this scope - object_addr is the correct parameter to use here. This appears to be a copy/paste error from the public function above.

Spotted by Graphite Reviewer

Is this helpful? React 👍 or 👎 to let us know.

Comment on lines +867 to +869
object::set_custom_transfer_permission_internal(object::object_address(token), CollectionTransferPermission {
collection: object::object_address(collection),
})
Copy link

Choose a reason for hiding this comment

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

The struct field name collection does not match the field name collection_addr defined in the CollectionTransferPermission struct. Please update the field name in this initialization to match the struct definition.

Spotted by Graphite Reviewer

Is this helpful? React 👍 or 👎 to let us know.

@runtian-zhou runtian-zhou force-pushed the 09-09-add_perimission_checks_to_object branch from 6851ffb to d4a929c Compare December 17, 2024 02:27
@runtian-zhou runtian-zhou requested review from junkil-park, alinush and a team as code owners December 17, 2024 02:27
@runtian-zhou runtian-zhou force-pushed the 09-09-add_perimission_checks_to_object branch from d4a929c to 6fd4575 Compare December 17, 2024 12:01
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