Skip to content

ci: Clippy - #689

Merged
scarmuega merged 1 commit into
mainfrom
ci/clippy
Sep 17, 2025
Merged

ci: Clippy#689
scarmuega merged 1 commit into
mainfrom
ci/clippy

Conversation

@gonzalezzfelipe

@gonzalezzfelipe gonzalezzfelipe commented Sep 17, 2025

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features

    • Added Default implementation for Mempool type.
  • Bug Fixes

    • Enhanced deposit calculation handling for certificate types.
  • Refactor

    • Removed unused public helper functions for address conversion.
    • Simplified internal type conversions and parameter passing throughout codebase.
    • Optimized iterator patterns and removed redundant casts.
    • Cleaned up unused imports and streamlined trait implementations.

@scarmuega
scarmuega merged commit d6e9990 into main Sep 17, 2025
7 of 8 checks passed
@scarmuega
scarmuega deleted the ci/clippy branch September 17, 2025 14:35
@rodrigosuaya

Copy link
Copy Markdown

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Nov 2, 2025

Copy link
Copy Markdown
✅ Actions performed

Full review triggered.

@coderabbitai

coderabbitai Bot commented Nov 2, 2025

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

Walkthrough

Large-scale refactoring across 40+ files removing unused imports (primarily Cow), simplifying parameter passing patterns (references to owned values and vice versa), eliminating unnecessary type conversions, removing unused code blocks and helper functions, and adding lint suppression attributes.

Changes

Cohort / File(s) Summary
Import Cleanup (Unused Cow, HashSet, DateTime, etc.)
crates/cardano/src/model.rs, crates/cardano/src/roll/accounts.rs, crates/cardano/src/roll/assets.rs, crates/cardano/src/roll/epochs.rs, crates/cardano/src/roll/pools.rs, crates/core/src/archive.rs, crates/core/src/state.rs, crates/redb/src/testing.rs, crates/redb3/src/utxoset.rs, src/bin/dolos/data/clear_state.rs, src/bin/dolos/eval.rs, crates/minibf/src/routes/network.rs
Removed unused Cow, HashSet, DateTime, FixedOffset, BlockHash, TxHash, TxOrder, EPOCH_KEY_MARK, MultiEraUpdate, Arc, BlockSlot imports and other unused types without affecting logic.
Parameter Passing & Ownership Adjustments
crates/cardano/src/bootstrap/mod.rs, crates/cardano/src/owned.rs, crates/cardano/src/pallas_extras.rs, crates/core/src/batch.rs, crates/core/src/init.rs, crates/core/src/utxoset.rs, src/bin/dolos/data/compute_spdd.rs, src/serve/grpc/sync.rs, src/serve/grpc/watch.rs, src/doctor/reset_wal.rs
Changed parameter passing from references to owned values (or vice versa) in various functions: bump_pparams_version, MultiEraOutput::decode, StakeAddress construction, commit_state/commit_archive key parameter, WAL reset calls, and block decode operations.
Type Conversion Simplifications
crates/cardano/src/eras.rs, crates/cardano/src/model.rs, crates/cardano/src/utils.rs, crates/core/src/point.rs, crates/redb/src/wal.rs, crates/redb3/src/utxoset.rs, src/bin/dolos/common.rs, src/adapters.rs
Removed unnecessary .into(), .clone(), explicit type casts, and reference operators; simplified conversions using direct values or function references (e.g., ChainPoint::from instead of closures).
Error Handling & Pattern Simplification
crates/cardano/src/bootstrap/mod.rs, crates/cardano/src/roll/epochs.rs, crates/core/src/archive.rs, src/sync/pull.rs
Simplified error construction by removing .into() for enum variants, replaced pattern matching with is_some() checks, and refactored filter/map chains using filter_map instead of chained operations.
Unused Code & Helper Removal
crates/cardano/src/roll/dreps.rs, crates/minibf/src/mapping.rs, src/bin/dolos/data/clear_state.rs, src/bin/dolos/bootstrap/mithril.rs
Removed large blocks of helper functions (cred_to_id, drep_to_id, cert_to_id in dreps.rs; bytes_to_address, bytes_to_address_bech32 in mapping.rs) and unused private constants (MAX_SCAN_DEPTH).
Default & Derive Attribute Changes
crates/cardano/src/sweep/mod.rs, crates/redb3/src/lib.rs, src/mempool.rs
Replaced manual impl Default with derived #[derive(Default)] in Snapshot; added impl Default for Mempool delegating to Mempool::new().
Lint Suppression Attributes
crates/cardano/src/eras.rs, crates/cardano/src/sweep/compute.rs, crates/redb3/src/lib.rs, crates/core/src/state.rs
Added #[allow(unused)] attributes to apply_hacks, compute_delegator_reward, and delete_entity_value to suppress warnings for intentionally unused internal helpers.
Trait Bound & Lifetime Reorganization
crates/core/src/batch.rs, crates/cardano/src/roll/pools.rs, crates/core/src/state.rs
Moved trait bounds from function signature to where clauses (e.g., commit_state<D: Domain>commit_state<D> with where D: Domain<Chain = C>); removed unused lifetime parameters (impl<'a> BlockVisitorimpl BlockVisitor).
Control Flow & Logic Refinements
crates/minibf/src/mapping.rs, crates/minibf/src/routes/accounts.rs, crates/minibf/src/routes/governance.rs, crates/cardano/src/sweep/compute.rs, src/relay/chainsync.rs, src/serve/o7s_unix/chainsync.rs
Enhanced deposit handling for Conway DRep certificates; removed unnecessary type casts in epoch comparisons; refactored conditional branches and implicit returns; adjusted variable bindings (e.g., _domain, _key for unused parameters).

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~75 minutes

  • Breadth: 40+ files across multiple crates (cardano, core, redb, redb3, bin, serve modules) requires systematic verification across distinct subsystems.
  • Heterogeneity: Mix of import cleanup, ownership/borrowing adjustments, type conversion simplifications, removed helper functions, trait bound reorganization, and logic refinements—each category demands separate reasoning.
  • High-density areas requiring extra attention:
    • crates/cardano/src/roll/dreps.rs: Large removal of DRep ID/certificate helper functions; verify downstream callers and integration points are correctly updated.
    • crates/minibf/src/mapping.rs: Removal of bytes_to_address functions and enhanced Conway certificate deposit handling; confirm all call sites are addressed and deposit logic is correct.
    • crates/core/src/batch.rs: Trait bound reorganization and parameter passing changes in commit_state/commit_archive; ensure type inference remains correct.
    • crates/cardano/src/sweep/compute.rs: New internal helper compute_delegator_reward with attribute suppression; verify logic and integration with pool reward calculations.
    • src/bin/dolos/data/accounts.rs: Removed AccountState loading in by_stake_actions and changed control flow in by_stake_addresses; confirm API contract changes are intentional.

Possibly related PRs

Suggested reviewers

  • scarmuega

🐰✨ Refactoring Rabbit's Ode to Cleanup

Unused imports hopped away with glee,
Parameters now dance more free,
Type conversions simplified and neat,
Helper functions took their retreat,
A cleaner warren, wild and spree! 🌿

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch ci/clippy

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4f19ede and f685a65.

📒 Files selected for processing (49)
  • crates/cardano/src/bootstrap/mod.rs (1 hunks)
  • crates/cardano/src/eras.rs (2 hunks)
  • crates/cardano/src/model.rs (3 hunks)
  • crates/cardano/src/owned.rs (1 hunks)
  • crates/cardano/src/pallas_extras.rs (1 hunks)
  • crates/cardano/src/roll/accounts.rs (0 hunks)
  • crates/cardano/src/roll/assets.rs (2 hunks)
  • crates/cardano/src/roll/dreps.rs (2 hunks)
  • crates/cardano/src/roll/epochs.rs (2 hunks)
  • crates/cardano/src/roll/pools.rs (1 hunks)
  • crates/cardano/src/sweep/compute.rs (4 hunks)
  • crates/cardano/src/sweep/mod.rs (1 hunks)
  • crates/cardano/src/utils.rs (1 hunks)
  • crates/cardano/src/utxoset.rs (2 hunks)
  • crates/core/src/archive.rs (1 hunks)
  • crates/core/src/batch.rs (4 hunks)
  • crates/core/src/init.rs (1 hunks)
  • crates/core/src/lib.rs (1 hunks)
  • crates/core/src/point.rs (1 hunks)
  • crates/core/src/state.rs (5 hunks)
  • crates/core/src/wal.rs (1 hunks)
  • crates/minibf/src/lib.rs (2 hunks)
  • crates/minibf/src/mapping.rs (1 hunks)
  • crates/minibf/src/routes/accounts.rs (2 hunks)
  • crates/minibf/src/routes/governance.rs (1 hunks)
  • crates/minibf/src/routes/network.rs (1 hunks)
  • crates/redb/src/archive/mod.rs (2 hunks)
  • crates/redb/src/testing.rs (0 hunks)
  • crates/redb/src/wal.rs (2 hunks)
  • crates/redb3/src/lib.rs (3 hunks)
  • crates/redb3/src/utxoset.rs (2 hunks)
  • src/adapters.rs (2 hunks)
  • src/bin/dolos/bootstrap/mithril.rs (1 hunks)
  • src/bin/dolos/bootstrap/mod.rs (0 hunks)
  • src/bin/dolos/common.rs (1 hunks)
  • src/bin/dolos/data/clear_state.rs (1 hunks)
  • src/bin/dolos/data/compute_spdd.rs (1 hunks)
  • src/bin/dolos/data/dump_state.rs (4 hunks)
  • src/bin/dolos/doctor/reset_wal.rs (1 hunks)
  • src/bin/dolos/eval.rs (1 hunks)
  • src/facade.rs (1 hunks)
  • src/mempool.rs (1 hunks)
  • src/relay/chainsync.rs (1 hunks)
  • src/serve/grpc/query.rs (1 hunks)
  • src/serve/grpc/sync.rs (1 hunks)
  • src/serve/grpc/watch.rs (1 hunks)
  • src/serve/o7s_unix/chainsync.rs (1 hunks)
  • src/sync/pull.rs (1 hunks)
  • src/tests/upstream.rs (0 hunks)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

3 participants