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

refactor: re-format files according to new rustfmt config #151

Merged
merged 1 commit into from
Oct 31, 2024

Conversation

jns-ps
Copy link
Contributor

@jns-ps jns-ps commented Oct 30, 2024

Summary by CodeRabbit

  • New Features

    • Enhanced error handling in the web server's get_hashchain function for better clarity.
  • Bug Fixes

    • Improved readability in various methods across multiple files, ensuring consistent error handling and formatting.
  • Documentation

    • Minor adjustments to comments for clarity, ensuring they remain relevant to the code changes.
  • Refactor

    • Streamlined method calls and variable assignments across various implementations for improved readability without altering functionality.
  • Style

    • Formatting improvements throughout the codebase, including removal of unnecessary line breaks and adjustments to indentation for better clarity.
  • Tests

    • Refactored test cases for formatting consistency while preserving core logic and assertions.

@jns-ps jns-ps self-assigned this Oct 30, 2024
Copy link
Contributor

coderabbitai bot commented Oct 30, 2024

Walkthrough

This pull request encompasses a series of formatting changes across multiple files in the codebase, primarily focusing on enhancing code readability. Adjustments include the removal of unnecessary line breaks in method calls and error handling, as well as minor modifications to the alignment of code elements. The changes do not affect the functionality or logic of the code, ensuring that all existing behaviors remain intact while improving overall clarity.

Changes

File Path Change Summary
crates/common/src/keys.rs Reformatted the try_from method in the VerifyingKey enum for clarity, adjusting line breaks without altering functionality.
crates/common/src/test_utils.rs Removed line breaks in insert_account, update_account, and create_random_insert methods for improved readability, maintaining existing logic.
crates/common/src/tree.rs Streamlined method calls in MembershipProof, InsertProof, and UpdateProof implementations by removing unnecessary line breaks.
crates/da/src/lib.rs Adjusted formatting in the verify_signature method of FinalizedEpoch, consolidating lines without changing logic.
crates/node_types/prover/src/prover/mod.rs Reformatted asynchronous method calls in sync_loop and process_da_height for improved readability, aligning with Rust's style guidelines.
crates/node_types/prover/src/webserver.rs Simplified the match statement in update_entry and updated error handling in get_hashchain for clarity without altering functionality.
crates/storage/src/redis.rs Reformatted method calls in RedisConnection, enhancing readability without changing logic.
crates/storage/src/rocksdb.rs Adjusted indentation in RocksDBConnection methods for better readability while preserving functionality.
crates/zk/groth16/src/lib.rs Simplified the implementation of the From trait for VerifyingKey, improving readability without altering logic.
crates/zk/groth16/src/merkle_insertion.rs Reformatted variable assignments in prove_non_membership for consistency, maintaining existing logic.
crates/zk/nova/src/batch.rs Enhanced readability in EpochCircuitSequence and EpochCircuit implementations and their test cases by removing unnecessary line breaks.
crates/zk/nova/src/insert.rs Streamlined method calls in InsertCircuit, removing line breaks for clarity while preserving functionality.
crates/zk/nova/src/update.rs Reformatted method calls in UpdateCircuit, enhancing readability without affecting logic.
crates/zk/nova/src/utils.rs Improved formatting in several utility functions, including next_rom_index_and_pc and get_selector_vec_from_index, while updating function signatures.

Possibly related PRs

🐇 In the code, we leap and play,
Formatting changes brighten the day.
With line breaks gone, clarity's here,
Readable code brings us cheer!
A hop, a skip, all in a row,
Our code shines bright, watch it glow! 🌟


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 6344658 and 4c5ab5e.

📒 Files selected for processing (14)
  • crates/common/src/keys.rs (1 hunks)
  • crates/common/src/test_utils.rs (5 hunks)
  • crates/common/src/tree.rs (12 hunks)
  • crates/da/src/lib.rs (1 hunks)
  • crates/node_types/prover/src/prover/mod.rs (4 hunks)
  • crates/node_types/prover/src/webserver.rs (1 hunks)
  • crates/storage/src/redis.rs (4 hunks)
  • crates/storage/src/rocksdb.rs (3 hunks)
  • crates/zk/groth16/src/lib.rs (2 hunks)
  • crates/zk/groth16/src/merkle_insertion.rs (1 hunks)
  • crates/zk/nova/src/batch.rs (4 hunks)
  • crates/zk/nova/src/insert.rs (2 hunks)
  • crates/zk/nova/src/update.rs (1 hunks)
  • crates/zk/nova/src/utils.rs (5 hunks)
✅ Files skipped from review due to trivial changes (10)
  • crates/common/src/keys.rs
  • crates/common/src/test_utils.rs
  • crates/common/src/tree.rs
  • crates/da/src/lib.rs
  • crates/node_types/prover/src/prover/mod.rs
  • crates/storage/src/redis.rs
  • crates/storage/src/rocksdb.rs
  • crates/zk/groth16/src/merkle_insertion.rs
  • crates/zk/nova/src/batch.rs
  • crates/zk/nova/src/update.rs
🔇 Additional comments (11)
crates/zk/nova/src/insert.rs (3)

68-68: LGTM: Clean formatting of new_root allocation

The consolidation of the method chain into a single line improves readability while maintaining the same functionality.


74-74: LGTM: Clean formatting of proof verification

The consolidation of the verification call and error mapping improves code conciseness while maintaining clarity.


84-84: LGTM: Clean formatting of leaf extraction

The consolidation of the leaf extraction and error handling improves code conciseness while maintaining clarity.

crates/node_types/prover/src/webserver.rs (2)

Line range hint 135-144: LGTM! Clean and readable match expression formatting.

The match expression follows standard Rust formatting practices with proper alignment and clear error messages.


Line range hint 169-178: LGTM! Modern and idiomatic error handling pattern.

The use of let Ok(...) = ... else pattern is a clean and modern approach to error handling in Rust, reducing nesting and improving readability.

crates/zk/groth16/src/lib.rs (2)

135-135: LGTM! Clean formatting of collection mapping.

The consolidation of the mapping operation into a single line improves readability while maintaining the same functionality.


168-169: LGTM! Consistent formatting of collection mapping.

The formatting with line break after assignment follows a consistent style with other similar constructs in the codebase.

crates/zk/nova/src/utils.rs (4)

101-101: LGTM!

The formatting change improves readability while preserving the logic.


142-143: LGTM!

The reformatting improves readability of the chained operations.


173-173: LGTM!

The consolidated formatting improves code conciseness.


192-193: LGTM!

The formatting changes improve readability of the bit manipulation operations while maintaining the original logic.

Also applies to: 428-428, 431-431


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?

❤️ Share
🪧 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 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.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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.

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