Skip to content

chore: optimize for concurrency#302

Open
mitinarseny wants to merge 2 commits into
mainfrom
chore/concurrent-tests
Open

chore: optimize for concurrency#302
mitinarseny wants to merge 2 commits into
mainfrom
chore/concurrent-tests

Conversation

@mitinarseny

@mitinarseny mitinarseny commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • Tests
    • Expanded gas-related test coverage to run all token-count scenarios from 1 up to the maximum by default.
    • Improved test execution speed by running these cases concurrently.
    • Test failures are now surfaced more consistently when any scenario errors.

@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@mitinarseny, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 56 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e65eb104-bc63-45fe-8cef-8d4cae2c540e

📥 Commits

Reviewing files that changed from the base of the PR and between a4d5b7a and 235de4d.

📒 Files selected for processing (1)
  • tests/src/tests/defuse/tokens/nep245/mt_deposit_resolve_gas.rs
📝 Walkthrough

Walkthrough

The test for NEP-245 deposit resolve gas now always runs run_deposit_resolve_gas_test for every token count from 1 through max_deposited_count concurrently using try_join_all, replacing the previous logic that ran only the max case by default and a sequential full loop behind the long feature flag.

NEP-245 Gas Test Concurrency

Layer / File(s) Summary
Concurrent exhaustive test execution
tests/src/tests/defuse/tokens/nep245/mt_deposit_resolve_gas.rs
Adds try_join_all import and replaces the feature-gated sequential loop with a concurrent run over all token counts 1..=max_deposited_count, asserting all succeed via a single .expect(...).

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

A rabbit once tested just one carrot at a time,
But waiting so long felt almost a crime.
Now all the carrots race in one go,
try_join_all makes the test flow!
🐇🥕 Done in a hop, all in a row.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is related to the main change, which makes the test run concurrently, though it is broader than the specific test update.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/concurrent-tests

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
tests/src/tests/defuse/tokens/nep245/mt_deposit_resolve_gas.rs (1)

25-25: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Bound the gas-test fan-out. try_join_all launches all 1..=max_deposited_count runs at once; switch to bounded concurrency (for example, buffer_unordered) so this test doesn’t overwhelm CI/sandbox resources when it reaches 50–200 transaction-heavy cases.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/src/tests/defuse/tokens/nep245/mt_deposit_resolve_gas.rs` at line 25,
The gas test fan-out in the NEP245 `mt_deposit_resolve_gas` test is unbounded
because `try_join_all` starts every case at once, which can overwhelm CI and
sandbox resources. Replace the `try_join_all`-based execution with bounded
concurrency in the test harness (for example, using a `buffer_unordered`-style
stream) so only a limited number of transaction-heavy cases run simultaneously,
and keep the change localized to the `mt_deposit_resolve_gas` test logic.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@tests/src/tests/defuse/tokens/nep245/mt_deposit_resolve_gas.rs`:
- Line 25: The gas test fan-out in the NEP245 `mt_deposit_resolve_gas` test is
unbounded because `try_join_all` starts every case at once, which can overwhelm
CI and sandbox resources. Replace the `try_join_all`-based execution with
bounded concurrency in the test harness (for example, using a
`buffer_unordered`-style stream) so only a limited number of transaction-heavy
cases run simultaneously, and keep the change localized to the
`mt_deposit_resolve_gas` test logic.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b868d0ac-d40b-4294-9a48-a58908a277f9

📥 Commits

Reviewing files that changed from the base of the PR and between 3d4b16d and a4d5b7a.

📒 Files selected for processing (1)
  • tests/src/tests/defuse/tokens/nep245/mt_deposit_resolve_gas.rs

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