Skip to content

Commit

Permalink
Update aptos-move/framework/aptos-framework/sources/permissioned_sign…
Browse files Browse the repository at this point in the history
…er.move

Co-authored-by: Aaron <[email protected]>
  • Loading branch information
runtian-zhou and lightmark committed Jan 15, 2025
1 parent da38949 commit 05937d0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -949,7 +949,7 @@ check if StoredPermission has at least <code>threshold</code> capacity.

<pre><code><b>fun</b> <a href="permissioned_signer.md#0x1_permissioned_signer_is_above">is_above</a>(perm: &<a href="permissioned_signer.md#0x1_permissioned_signer_StoredPermission">StoredPermission</a>, threshold: u256): bool {
match (perm) {
StoredPermission::Capacity(capacity) =&gt; *capacity &gt; threshold,
StoredPermission::Capacity(capacity) =&gt; *capacity &gt;= threshold,
StoredPermission::Unlimited =&gt; <b>true</b>,
}
}
Expand Down Expand Up @@ -1298,7 +1298,8 @@ to bypass the checks.
<pre><code><b>public</b>(<b>package</b>) <b>fun</b> <a href="permissioned_signer.md#0x1_permissioned_signer_check_permission_exists">check_permission_exists</a>&lt;PermKey: <b>copy</b> + drop + store&gt;(
s: &<a href="../../aptos-stdlib/../move-stdlib/doc/signer.md#0x1_signer">signer</a>, perm: PermKey
): bool <b>acquires</b> <a href="permissioned_signer.md#0x1_permissioned_signer_PermissionStorage">PermissionStorage</a> {
<a href="permissioned_signer.md#0x1_permissioned_signer_check_permission_capacity_above">check_permission_capacity_above</a>(s, 0, perm)
// 0 capacity permissions will be treated <b>as</b> non-existant.
<a href="permissioned_signer.md#0x1_permissioned_signer_check_permission_capacity_above">check_permission_capacity_above</a>(s, 1, perm)
}
</code></pre>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ module aptos_framework::permissioned_signer {
/// check if StoredPermission has at least `threshold` capacity.
fun is_above(perm: &StoredPermission, threshold: u256): bool {
match (perm) {
StoredPermission::Capacity(capacity) => *capacity > threshold,
StoredPermission::Capacity(capacity) => *capacity >= threshold,
StoredPermission::Unlimited => true,
}
}
Expand Down Expand Up @@ -491,7 +491,8 @@ module aptos_framework::permissioned_signer {
public(package) fun check_permission_exists<PermKey: copy + drop + store>(
s: &signer, perm: PermKey
): bool acquires PermissionStorage {
check_permission_capacity_above(s, 0, perm)
// 0 capacity permissions will be treated as non-existant.
check_permission_capacity_above(s, 1, perm)
}

public(package) fun check_permission_capacity_above<PermKey: copy + drop + store>(
Expand Down

0 comments on commit 05937d0

Please sign in to comment.