Skip to content

Conversation

@lklimek
Copy link
Collaborator

@lklimek lklimek commented Apr 24, 2025

Issue being fixed or feature implemented

What was done?

How Has This Been Tested?

Breaking Changes

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

Summary by CodeRabbit

  • Chores
    • Updated mock generation tool and configuration to the latest version.
    • Regenerated all mock implementations with improved naming consistency, clearer parameter names, and standardized comments.
    • Added new constructor helper functions for easier mock instantiation and automatic test cleanup across all mocks.
    • Refined import organization and improved code readability in generated mocks.
    • No changes to runtime logic or application behavior.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Apr 24, 2025

Walkthrough

This change upgrades the mockery tool version from 2.53.3 to 3.2.4, updates the .mockery.yaml configuration to match the new schema and conventions, and regenerates all Go mock files throughout the codebase. The regenerated mocks introduce new constructor functions for each mock type, standardize receiver and parameter names for clarity, and update comments and import statements. No application logic or control flow is altered; all changes are confined to configuration, tooling, and autogenerated test code.

Changes

File(s) Change Summary
.github/workflows/check-generated.yml, scripts/mockery_generate.sh Updated the mockery version from 2.53.3 to 3.2.4 in CI workflow and script; adjusted version check logic and installation instructions accordingly.
.mockery.yaml Overhauled mockery configuration: removed deprecated keys, added new keys (log-level, structname, pkgname, template), switched interface lists to explicit empty map notation, reorganized interface ordering, and adapted to mockery v3 conventions.
abci/client/mocks/client.go
abci/types/mocks/application.go
dash/core/mocks/client.go
Regenerated mocks: added New* constructor functions, renamed receiver and parameter names for clarity, updated comments, and improved import formatting.
internal/consensus/mocks/gossiper.go
internal/consensus/versioned/selectproposer/mocks/proposerselector.go
Regenerated mocks: added constructor functions, standardized receiver/parameter names, improved helper method signatures, and updated comments.
internal/evidence/mocks/blockstore.go
internal/state/mocks/blockstore.go
internal/state/mocks/executor.go
internal/state/mocks/store.go
internal/state/mocks/evidencepool.go
Regenerated mocks: added constructor functions, renamed receiver/parameter names, improved comments, and updated helper method signatures for clarity and consistency.
internal/mempool/mocks/mempool.go Regenerated mock: added constructor, updated import aliasing, changed parameter names to descriptive ones, and improved comments and helper method signatures.
internal/p2p/client/mocks/blockclient.go
internal/p2p/client/mocks/snapshotclient.go
Regenerated mocks: added constructor functions, reorganized imports, renamed receiver/parameter names, and updated comments and helper methods.
internal/p2p/mocks/channel.go
internal/p2p/mocks/connection.go
internal/p2p/mocks/transport.go
Regenerated mocks: added constructor functions, standardized receiver/parameter names, updated comments, and improved helper method signatures.
internal/state/indexer/mocks/eventsink.go Regenerated mock: added constructor, reorganized imports, renamed receiver/parameter names, and improved helper method signatures and comments.
internal/statesync/mocks/consensusstateprovider.go
internal/statesync/mocks/stateprovider.go
Regenerated mocks: added constructor functions, standardized receiver/parameter names, improved comments, and updated helper method signatures.
libs/store/mocks/store.go Regenerated generic mock: added constructor, standardized receiver/parameter names, improved variadic argument handling, and updated helper method signatures.
light/provider/mocks/provider.go Regenerated mock: added constructor, standardized receiver/parameter names, improved comments, and updated helper method signatures.
light/rpc/mocks/lightclient.go Regenerated mock: added constructor, standardized receiver/parameter names, improved comments, and updated helper method signatures.
types/mocks/blockeventpublisher.go
types/mocks/privvalidator.go
Regenerated mocks: added constructor functions, reorganized imports, renamed receiver/parameter names, and improved helper method signatures and comments.

Sequence Diagram(s)

sequenceDiagram
    participant Test as Test Code
    participant Mock as Generated Mock (e.g., NewClient)
    participant SUT as System Under Test

    Test->>Mock: Call NewMock(t)
    Mock->>Test: Registers t, sets up Cleanup
    Test->>SUT: Injects Mock as dependency
    SUT->>Mock: Calls mock methods with descriptive params
    Mock->>Test: Asserts expectations on Cleanup
Loading

Possibly related PRs

  • dashpay/tenderdash#1059: Adds the ConsensusStateProvider interface and related state sync fixes, directly related to the new mock and constructor added in this PR.
  • dashpay/tenderdash#955: Updates mockery configuration and regenerates mocks, similar to this PR's update to mockery version and .mockery.yaml.

Suggested reviewers

  • QuantumExplorer
  • shumkov

Poem

In fields of code where rabbits hop,
We’ve tuned our mocks from top to top.
Constructors new, names clear and bright,
Each test now runs with pure delight.
With mockery’s magic, v3’s in play—
Our burrow’s neat, hip-hip-hooray!
🐇✨

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (1.64.8)

Error: you are using a configuration file for golangci-lint v2 with golangci-lint v1: please use golangci-lint v2
Failed executing command with error: you are using a configuration file for golangci-lint v2 with golangci-lint v1: please use golangci-lint v2

✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 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 generate sequence diagram to generate a sequence diagram of the changes in 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.

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.

@lklimek lklimek marked this pull request as ready for review April 25, 2025 07:47
@lklimek lklimek merged commit 334ee33 into v1.5-dev Apr 25, 2025
19 checks passed
@lklimek lklimek deleted the deps/mockery-3 branch April 25, 2025 14:05
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