Skip to content

chore: fix tests#7196

Merged
SWvheerden merged 1 commit intotari-project:developmentfrom
SWvheerden:sw_fix_tests
Jun 6, 2025
Merged

chore: fix tests#7196
SWvheerden merged 1 commit intotari-project:developmentfrom
SWvheerden:sw_fix_tests

Conversation

@SWvheerden
Copy link
Copy Markdown
Collaborator

@SWvheerden SWvheerden commented Jun 6, 2025

Description

Fixes the tests and improves performance by not duplicating transactions

Summary by CodeRabbit

  • Bug Fixes

    • Improved detection and removal of duplicate unconfirmed transactions, ensuring users see each transaction only once in the transaction list.
    • Enhanced handling of transaction mining status, providing more accurate display of unconfirmed transactions.
  • Tests

    • Updated test scenarios to better simulate real-world transaction mining and status changes, increasing reliability of transaction status updates.

@SWvheerden SWvheerden requested a review from a team as a code owner June 6, 2025 09:58
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Jun 6, 2025

Walkthrough

The changes update the logic for fetching unconfirmed detected transactions in the wallet's SQLite database by ensuring uniqueness across multiple queries and broadening the criteria for transactions with missing mined height. Corresponding tests are updated to set chain metadata, and a new field is added to the test interface for direct database access.

Changes

File(s) Change Summary
base_layer/wallet/src/transaction_service/storage/sqlite_db.rs Refactored unconfirmed transaction fetching to deduplicate results using a HashMap and expanded mined height nullity filter logic.
base_layer/wallet/tests/transaction_service_tests/service.rs Added wallet_database field to test interface, updated setup and tests to set chain metadata and variable mined heights.

Sequence Diagram(s)

sequenceDiagram
    participant Test as Test Case
    participant WalletDB as WalletDatabase
    participant SqliteDB as TransactionServiceSqliteDatabase

    Test->>WalletDB: Set chain metadata (tip height)
    Test->>SqliteDB: fetch_unconfirmed_detected_transactions()
    SqliteDB->>SqliteDB: Query transactions by status
    SqliteDB->>SqliteDB: Insert transactions into HashMap (by tx_id)
    SqliteDB->>Test: Return unique unconfirmed transactions
Loading

Possibly related PRs

  • tari-project/tari#7135: Modifies the same filtering logic in fetch_transactions_with_not_mined_height but in the opposite direction, indicating a direct and potentially conflicting relationship.
  • tari-project/tari#7131: Adds a new method and appends transactions to unconfirmed results, directly modifying the same area of transaction fetching logic.
  • tari-project/tari#7192: Adjusts the mined height filter in the same method, making related changes to transaction selection logic.

Suggested reviewers

  • hansieodendaal

Poem

In the warren of code, transactions abound,
With hashes and heights, they're uniquely found.
No more duplicates in the burrowed logs,
The chain's tip set—no more data fogs!
With a hop and a test, the wallet is neat,
This bunny declares: the logic’s complete! 🐇


📜 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 a42be71 and 6c0e1ca.

📒 Files selected for processing (2)
  • base_layer/wallet/src/transaction_service/storage/sqlite_db.rs (5 hunks)
  • base_layer/wallet/tests/transaction_service_tests/service.rs (8 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • base_layer/wallet/src/transaction_service/storage/sqlite_db.rs
  • base_layer/wallet/tests/transaction_service_tests/service.rs
⏰ Context from checks skipped due to timeout of 90000ms (7)
  • GitHub Check: Cucumber tests / Base Layer
  • GitHub Check: Cucumber tests / FFI
  • GitHub Check: test (testnet, esmeralda)
  • GitHub Check: test (nextnet, nextnet)
  • GitHub Check: test (mainnet, stagenet)
  • GitHub Check: cargo check with stable
  • GitHub Check: ci
✨ 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Jun 6, 2025

Test Results (CI)

    3 files    126 suites   55m 58s ⏱️
1 329 tests 1 329 ✅ 0 💤 0 ❌
3 985 runs  3 985 ✅ 0 💤 0 ❌

Results for commit 6c0e1ca.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Jun 6, 2025

Test Results (Integration tests)

 2 files  1 errors  1 suites   26m 1s ⏱️
 5 tests 1 ✅ 0 💤  4 ❌
13 runs  1 ✅ 0 💤 12 ❌

For more details on these parsing errors and failures, see this check.

Results for commit 6c0e1ca.

Copy link
Copy Markdown
Contributor

@hansieodendaal hansieodendaal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK

Nice

@SWvheerden SWvheerden merged commit 3de58ec into tari-project:development Jun 6, 2025
16 of 17 checks passed
@SWvheerden SWvheerden deleted the sw_fix_tests branch June 11, 2025 10:22
sdbondi added a commit to sdbondi/tari that referenced this pull request Jun 18, 2025
* development: (607 commits)
  Wallet GRPC port comment fix from 18142 to 18143 (tari-project#7221)
  feat: integrated address support for Ledger (tari-project#7198)
  chore: new release v4.1.1-pre.0 (tari-project#7211)
  fix: migration can now correctly resume after stopping (tari-project#7210)
  fix: only revalidated rejected transactions on startup (tari-project#7209)
  fix: add filtering flag back (tari-project#7208)
  feat: improve wallet balance checks from external clients (tari-project#7207)
  feat!: update grpc supply query (tari-project#7137)
  docs: Updated API GRPC and Exchange Guide (tari-project#7205)
  chore: new release v4.4.0-pre.0 (tari-project#7202)
  feat: update base node proto to search bytes (tari-project#7201)
  feat: full PayRef implementation (tari-project#7154)
  test: add ffi cucumber wallet balance test (tari-project#7189)
  chore: fix tests (tari-project#7196)
  fix(network-discovery): add back idle event handling (tari-project#7194)
  Update SECURITY.md (tari-project#7193)
  fix: transaction manager service unmined lookup (tari-project#7192)
  fix: wallet ffi database name mismatch for mobile wallet (tari-project#7191)
  fix: payment_id deserialize (tari-project#7187)
  fix: remove code for deleting stale peers (tari-project#7184)
  ...
@coderabbitai coderabbitai bot mentioned this pull request Jul 10, 2025
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