-
Notifications
You must be signed in to change notification settings - Fork 32
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
No account nonce fallback #318
No account nonce fallback #318
Conversation
To view this pull requests documentation preview, visit the following URL: Documentation is deployed and generated using docs.page. |
8988fad
to
1e4e556
Compare
WalkthroughThe recent changes to the Changes
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 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
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- packages/starknet/lib/src/account.dart (1 hunks)
Additional comments not posted (1)
packages/starknet/lib/src/account.dart (1)
38-40
: LGTM! But verify the function usage in the codebase.The code changes are approved. The removal of the fallback mechanism simplifies the error handling process and aligns with the current implementation standards of account contracts in StarkNet.
However, ensure that all function calls to
getNonce
handle the exceptions properly.Verification successful
The
getNonce
function is used in multiple places across different files, including tests and the main codebase. Here are the key points wheregetNonce
is called:
packages/starknet_provider/test/integration/read_provider_test.dart
packages/starknet/test/account_test.dart
packages/starknet/lib/src/account.dart
packages/starknet_provider/lib/src/read_provider.dart
To ensure proper exception handling, we need to review the context of each
getNonce
call and verify if exceptions are handled correctly.Let's generate a script to gather more detailed context around these calls to ensure proper exception handling.
Proper exception handling for
getNonce
verified.The
getNonce
function calls across the codebase handle exceptions appropriately. The tests use thewhen
method to check and handle errors, while the main codebase throws exceptions directly, which is consistent and appropriate.
packages/starknet_provider/test/integration/read_provider_test.dart
: Errors are handled using thewhen
method.packages/starknet/test/account_test.dart
: Tests for expected results without explicit error handling, which is typical for positive test cases.packages/starknet/lib/src/account.dart
: Throws exceptions directly if an error occurs.packages/starknet_provider/lib/src/read_provider.dart
: Implements thegetNonce
method for the provider.No further action is needed.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all function calls to `getNonce` handle the exceptions properly. # Test: Search for the function usage. Expect: Proper exception handling. rg --type dart -A 5 $'getNonce'Length of output: 5467
Script:
#!/bin/bash # Description: Gather detailed context around `getNonce` calls to verify exception handling. # Extract context around `getNonce` calls in test files rg --type dart -A 10 -B 5 'getNonce' packages/starknet_provider/test/integration/read_provider_test.dart rg --type dart -A 10 -B 5 'getNonce' packages/starknet/test/account_test.dart # Extract context around `getNonce` calls in the main codebase rg --type dart -A 10 -B 5 'getNonce' packages/starknet/lib/src/account.dart rg --type dart -A 10 -B 5 'getNonce' packages/starknet_provider/lib/src/read_provider.dartLength of output: 5331
This PR remove fallback to call
get_nonce
on account contract ifstarknet_getNonce
failed.get_nonce
is no more implemented in standard account contract (argent, braavos, open zeppelin) and the fallback prevent to getstarknet_getNonce
error if any.Summary by CodeRabbit