Skip to content

Minor refactoring and improvements in testing#764

Merged
FabijanC merged 4 commits intomainfrom
test-separation
Apr 22, 2025
Merged

Minor refactoring and improvements in testing#764
FabijanC merged 4 commits intomainfrom
test-separation

Conversation

@FabijanC
Copy link
Copy Markdown
Contributor

@FabijanC FabijanC commented Apr 16, 2025

Usage related changes

None

Development related changes

  • Move testing artifact from production code: CAIRO_0_ERC20_CONTRACT_PATH.
  • Add syncing status integration test.
  • Replace custom call for starknet_getTransactionTrace with starknet-rs.
    • For starknet_getMessagesStatus we keep the custom client logic to reduce dependence on starknet-rs. By making getTransactionTrace depend on starknet-rs deserialization, we ensure all properties are present and of correct type, which was not done so far. The custom logic for getMessagesStatus, on the other hand, already does this.
  • Simplify get_block_with_tx_hashes.

Checklist:

  • Checked out the contribution guidelines
  • Applied formatting - ./scripts/format.sh
  • No linter errors - ./scripts/clippy_check.sh
  • No unused dependencies - ./scripts/check_unused_deps.sh
  • No spelling errors - ./scripts/check_spelling.sh
  • Performed code self-review
  • Rebased to the latest commit of the target branch (or merged it into my branch)
    • Once you make the PR reviewable, please avoid force-pushing
  • Updated the docs if needed - ./website/README.md
  • Linked the issues resolvable by this PR - linking info
  • Updated the tests if needed; all passing - execution info

Summary by CodeRabbit

  • Tests
    • Improved integration tests for syncing status to ensure consistent results.
    • Refactored L1 handler transaction trace assertions for stronger type safety and clarity.
    • Updated test logic to use direct contract artifact paths and more robust transaction trace handling.
    • Expanded test imports and added new async test for syncing status.
  • Chores
    • Removed unused constant related to Cairo 0 ERC20 contract artifacts.
    • Added clarifying comments to improve code maintainability.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 16, 2025

Important

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

The changes involve updates across several modules and test files. In the core constants module, the CAIRO_0_ERC20_CONTRACT_PATH constant and its associated comment were removed. In the server's JSON-RPC models, a clarifying inline comment was added to the False(bool) variant of the SyncingOutput enum, without altering its structure. In the CLI module's test code, the previously imported CAIRO_0_ERC20_CONTRACT_PATH constant was replaced with a locally defined string constant for the contract path. Integration tests saw two main updates: a new asynchronous test function syncing_status_always_false was introduced to verify the sync status, and the L1 handler transaction trace assertions were refactored to use a strongly typed function (assert_accepted_l1_handler_trace) instead of a generic JSON-based approach. Additionally, a comment was added to clarify the rationale for retaining custom logic in one test, with no functional impact.


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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 using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@FabijanC FabijanC changed the title Move testing artifact from production code Improve testing Apr 17, 2025
@FabijanC FabijanC marked this pull request as ready for review April 17, 2025 10:27
@FabijanC
Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 17, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@FabijanC FabijanC requested a review from marioiordanov April 22, 2025 11:41
@FabijanC FabijanC changed the title Improve testing Minor refactoring and improvents in testing Apr 22, 2025
@FabijanC FabijanC changed the title Minor refactoring and improvents in testing Minor refactoring and improvements in testing Apr 22, 2025
@FabijanC FabijanC merged commit d105203 into main Apr 22, 2025
2 checks passed
@FabijanC FabijanC deleted the test-separation branch April 22, 2025 13:37
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