-
Notifications
You must be signed in to change notification settings - Fork 187
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
update permission api #2224
update permission api #2224
Conversation
WalkthroughOhayo, sensei! The recent changes focus on reordering parameters in ownership-related functions across multiple files, including Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Contract
User->>Contract: Call grant_owner(resource, address)
activate Contract
Contract-->>User: Ownership granted
deactivate Contract
User->>Contract: Call revoke_owner(resource, address)
activate Contract
Contract-->>User: Ownership revoked
deactivate Contract
User->>Contract: Call is_owner(resource, address)
activate Contract
Contract-->>User: Ownership status
deactivate Contract
Recent review detailsConfiguration used: .coderabbit.yaml Files selected for processing (15)
Files skipped from review due to trivial changes (3)
Files skipped from review as they are similar to previous changes (9)
Additional comments not posted (4)
TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Outside diff range, codebase verification and nitpick comments (3)
examples/spawn-and-move/manifests/dev/base/abis/dojo-world.json (1)
420-423
: Ohayo, sensei! There are inconsistencies in thegrant_owner
function parameters.The parameter
address
has been moved to the second position, but not all instances reflect this change. Here are the instances that need attention:
Update to new signature:
examples/spawn-and-move/manifests/release/base/abis/dojo-world.json
examples/spawn-and-move/manifests/dev/deployment/manifest.json
examples/spawn-and-move/manifests/dev/deployment/abis/dojo-world.json
examples/spawn-and-move/manifests/dev/base/abis/dojo-world.json
examples/dojo-lang/src/manifest_test_data/compiler_cairo/manifests/dev/base/abis/dojo-world.json
Already updated:
examples/game-lib/manifests/dev/base/abis/dojo-world.json
bin/sozo/tests/test_data/manifest.json
crates/katana/storage/db/benches/artifacts/dojo_world_240.json
examples/game-lib/armory/manifests/dev/base/abis/dojo-world.json
Please ensure all instances of
grant_owner
match the new signature.Analysis chain
Ohayo, sensei! Verify the function usage for
grant_owner
.The parameter
address
has been moved to the second position. Ensure all calls togrant_owner
match the new signature.
Ohayo, sensei! Verify the function usage for
grant_owner
.The parameter
address
has been moved to the second position. Ensure all calls togrant_owner
match the new signature.
Ohayo, sensei! Verify the function usage for
grant_owner
.The parameter
address
has been moved to the second position. Ensure all calls togrant_owner
match the new signature.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all function calls to `grant_owner` match the new signature. # Test: Search for the function usage. Expect: Only occurrences of the new signature. rg --type json -A 5 $'grant_owner'Length of output: 7228
Script:
#!/bin/bash # Description: Verify all function calls to `grant_owner` match the new signature. # Test: Search for the function usage. Expect: Only occurrences of the new signature. rg --type json -A 5 $'grant_owner'Length of output: 7228
Script:
#!/bin/bash # Description: Verify all function calls to `grant_owner` match the new signature. # Test: Search for the function usage. Expect: Only occurrences of the new signature. rg --type json -A 5 $'grant_owner'Length of output: 7228
examples/spawn-and-move/manifests/dev/deployment/abis/dojo-world.json (1)
400-403
: Ohayo, sensei! Verify the function usage foris_owner
.The parameter
address
has been moved to the second position. Ensure all calls tois_owner
match the new signature.
- examples/spawn-and-move/manifests/dev/deployment/manifest.json: The
is_owner
function hasresource
as the first parameter, which is correct.- examples/spawn-and-move/manifests/dev/deployment/abis/dojo-world.json: The
is_owner
function hasresource
as the first parameter, which is correct.- examples/game-lib/manifests/dev/base/abis/dojo-world.json: The
is_owner
function hasaddress
as the first parameter, which is incorrect.- examples/game-lib/armory/manifests/dev/base/abis/dojo-world.json: The
is_owner
function hasaddress
as the first parameter, which is incorrect.- examples/spawn-and-move/manifests/dev/base/abis/dojo-world.json: The
is_owner
function hasresource
as the first parameter, which is correct.- examples/spawn-and-move/manifests/release/base/abis/dojo-world.json: The
is_owner
function hasresource
as the first parameter, which is correct.- crates/katana/storage/db/benches/artifacts/dojo_world_240.json: The
is_owner
function hasaddress
as the first parameter, which is incorrect.- crates/dojo-lang/src/manifest_test_data/compiler_cairo/manifests/dev/base/abis/dojo-world.json: The
is_owner
function hasresource
as the first parameter, which is correct.- bin/sozo/tests/test_data/manifest.json: The
is_owner
function hasaddress
as the first parameter, which is incorrect.Locations with incorrect parameter order:
examples/game-lib/manifests/dev/base/abis/dojo-world.json
examples/game-lib/armory/manifests/dev/base/abis/dojo-world.json
crates/katana/storage/db/benches/artifacts/dojo_world_240.json
bin/sozo/tests/test_data/manifest.json
Please update these instances to match the new function signature.
Analysis chain
Ohayo, sensei! Verify the function usage for
is_owner
.The parameter
address
has been moved to the second position. Ensure all calls tois_owner
match the new signature.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all function calls to `is_owner` match the new signature. # Test: Search for the function usage. Expect: Only occurrences of the new signature. rg --type json -A 5 $'is_owner'Length of output: 7083
crates/dojo-core/src/tests/world.cairo (1)
1549-1549
: Ohayo, sensei!The
grant_owner
function calls in thecrates/dojo-core/src/tests/world.cairo
file are inconsistent with the new parameter order. Please update the following instances to match the new signature:
world.grant_owner(bytearray_hash(@"dojo"), bob);
world.grant_owner(0, alice);
world.grant_owner(foo_selector, bob);
world.grant_owner(0, alice);
world.grant_owner(bytearray_hash(@"dojo"), account);
Ensure all calls follow the new parameter order for clarity and consistency.
Analysis chain
Ohayo, sensei! The parameter order change in
grant_owner
looks good!The new parameter order enhances clarity and consistency. Ensure that the test logic remains correct.
Ohayo, sensei!
The previous script encountered an issue because
cairo
is not a recognized file type byrg
. Let's re-run the search without specifying the file type to ensure allgrant_owner
function calls are using the new parameter order.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all function calls to `grant_owner` in tests match the new signature. # Test: Search for the function usage. Expect: Only occurrences of the new signature. rg --type cairo -A 5 $'grant_owner'Length of output: 64
Script:
#!/bin/bash # Description: Verify all function calls to `grant_owner` in .cairo files match the new signature. # Test: Search for the function usage. Expect: Only occurrences of the new signature. rg 'grant_owner' --glob '*.cairo' -A 5Length of output: 4649
f2067e2
to
cb644a1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Outside diff range, codebase verification and nitpick comments (1)
examples/spawn-and-move/manifests/dev/deployment/manifest.json (1)
425-428
: Ohayo, sensei!The addition of the
address
parameter to thegrant_owner
function is not consistently reflected across the codebase. Several instances of the function still use the old signature. Please update all invocations of thegrant_owner
function to include the newaddress
parameter.
- Examples of files needing updates:
examples/spawn-and-move/manifests/dev/deployment/manifest.json
examples/spawn-and-move/manifests/dev/deployment/abis/dojo-world.json
examples/spawn-and-move/manifests/release/base/abis/dojo-world.json
examples/spawn-and-move/manifests/dev/base/abis/dojo-world.json
crates/dojo-lang/src/manifest_test_data/compiler_cairo/manifests/dev/base/abis/dojo-world.json
Analysis chain
Ohayo, sensei! Verify the integration of the new
address
parameter.The addition of the
address
parameter to thegrant_owner
function looks good. Ensure that all invocations of this function in the codebase are updated to pass the new parameter.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all function calls to `grant_owner` match the new signature. # Test: Search for the function usage. Expect: Only occurrences of the new signature. rg --type json -A 5 $'grant_owner'Length of output: 7228
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2224 +/- ##
==========================================
- Coverage 69.87% 69.86% -0.01%
==========================================
Files 341 341
Lines 44719 44719
==========================================
- Hits 31246 31244 -2
- Misses 13473 13475 +2 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the quick refactoring on this one @remybar. 🙏
issue #2221
Summary by CodeRabbit
New Features
is_owner
,grant_owner
, andrevoke_owner
to improve clarity by reordering input parameters.Bug Fixes
Chores