Skip to content

chore: add benchmark#99

Merged
SWvheerden merged 7 commits intotari-project:mainfrom
SWvheerden:sw_benchmark
Mar 13, 2026
Merged

chore: add benchmark#99
SWvheerden merged 7 commits intotari-project:mainfrom
SWvheerden:sw_benchmark

Conversation

@SWvheerden
Copy link
Contributor

Description

SWvheerden and others added 5 commits March 11, 2026 13:32
The @pie test was failing with 'Could not parse balance' because the
wallet_benchmark.feature was missing a 'When I check the balance for
account "default"' step between the scan and balance assertion. Without
it, parse_balance_from_output() was trying to parse balance from scan
output which doesn't contain balance formatting.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The step was registered as #[then] but the feature file uses it as 'And'
after a 'When' step. In Cucumber, 'And' inherits the preceding keyword,
so it was looking for a #[when] match and skipping the step.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Adds a 'Then I print the benchmark results' step that displays scan and
confirmation timings in a formatted summary. Stores durations in a new
benchmark_timings field on MinotariWorld.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Replace 'Then all transactions should be confirmed' with
'Then N transactions of X uT should be confirmed' which verifies that
the balance decreased by at least N*X µT by:
- Capturing pre-send balance before sending transactions
- Sending to a different random wallet (not self)
- Checking post-send balance accounts for the sent amount

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a comprehensive benchmarking suite for the wallet, enabling the measurement of key performance indicators such as block scanning duration and the time required for transaction confirmation. This enhancement provides valuable insights into wallet efficiency and helps track performance over time.

Highlights

  • New Wallet Benchmarking Feature: Introduced a new feature file wallet_benchmark.feature to define scenarios for measuring wallet scanning and transaction confirmation performance.
  • Benchmarking Step Definitions: Added wallet_benchmark.rs with new step definitions to implement the logic for measuring block scanning time, sending multiple transactions, measuring transaction confirmation time, and printing benchmark results.
  • MinotariWorld Enhancements: Extended the MinotariWorld struct in common.rs to include fields for storing benchmark timings and the wallet's balance before sending transactions, along with a new fetch_balance method.
  • Feature Tag Removal: Removed the @pie tag from the 'Lock funds with insufficient balance' scenario in fund_locking.feature.
Changelog
  • integration-tests/features/fund_locking.feature
    • Removed the @pie tag from the 'Lock funds with insufficient balance' scenario.
  • integration-tests/features/wallet_benchmark.feature
    • Added a new feature file for wallet performance benchmarking, including scenarios for scanning and transaction confirmation.
  • integration-tests/steps/common.rs
    • Added benchmark_timings and pre_send_balance fields to the MinotariWorld struct.
    • Implemented the fetch_balance method to retrieve the wallet's balance.
    • Initialized new fields in the MinotariWorld constructor.
  • integration-tests/steps/mod.rs
    • Added the wallet_benchmark module to integrate new step definitions.
  • integration-tests/steps/wallet_benchmark.rs
    • Added step definitions for measuring block scan time.
    • Added step definitions for sending a specified number of transactions.
    • Added step definitions for measuring transaction confirmation time.
    • Added step definitions for printing benchmark results.
Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/ci.yml
Activity
  • The pull request was created with the title 'chore: add benchmark' and an empty description, indicating a direct implementation of the benchmarking feature.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new benchmark test for wallet scanning and transaction confirmation. The implementation includes a new Gherkin feature file, corresponding step definitions, and updates to the shared test world. The code is generally well-structured for a test environment. However, I've identified a few areas for improvement to enhance robustness and maintainability. My review includes suggestions to handle potential panics from unwrap() calls, remove an unused import, and improve a brittle error check, with one suggestion referencing a repository rule on brittle code. Addressing these points will make the new benchmark tests more reliable.

@SWvheerden SWvheerden merged commit cbe4719 into tari-project:main Mar 13, 2026
2 checks passed
@SWvheerden SWvheerden deleted the sw_benchmark branch March 13, 2026 10:33
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.

1 participant