Skip to content

test(drive): add coverage for fee calculation engine - #3429

Merged
QuantumExplorer merged 4 commits into
v3.1-devfrom
test/drive-fees-coverage
Apr 3, 2026
Merged

test(drive): add coverage for fee calculation engine#3429
QuantumExplorer merged 4 commits into
v3.1-devfrom
test/drive-fees-coverage

Conversation

@QuantumExplorer

Copy link
Copy Markdown
Member

Summary

Adds 65 tests for rs-drive/src/fees/op.rs — the core fee calculation engine — which previously had 0 test coverage.

SectionTestsWhat's covered
BaseOp::cost()11Spot-checks across all opcode categories
HashFunction methods8block_size, rounds, block_cost, base_cost for all 4 variants
FunctionOp::new_with_byte_count9Block/round calculations for various byte counts and hash functions
FunctionOp::cost8Saturating arithmetic, extreme fee versions
operation_cost()4All 4 match arms including error paths
combine_cost_operations3Filtering and summing mixed operation types
grovedb_operations_batch8Partitioning, consume, consume_with_leftovers
DriveCost::ephemeral_cost14Each cost component in isolation, overflow error handling

Test plan

  • cargo test -p drive --lib -- fees::op — 65 passed
  • cargo fmt --all clean

🤖 Generated with Claude Code

Add 65 tests for rs-drive/src/fees/op.rs covering:
- BaseOp::cost() for all opcode categories
- HashFunction block_size/rounds/block_cost/base_cost for all 4 variants
- FunctionOp::new_with_byte_count block and round calculations
- FunctionOp::cost saturating arithmetic
- operation_cost() all 4 match arms including error paths
- combine_cost_operations() filtering and summing
- grovedb_operations_batch partitioning and consume variants
- DriveCost::ephemeral_cost() with overflow error handling
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitaiBot commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

Warning

Rate limit exceeded

@QuantumExplorer has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 11 minutes and 16 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 11 minutes and 16 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 83fe64f5-589c-4981-9b6f-72c94cf8d5b9

📥 Commits

Reviewing files that changed from the base of the PR and between 7969880 and b0f456f.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (2)
  • packages/rs-drive/src/fees/op.rs
  • packages/rs-scripts/Cargo.toml
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/drive-fees-coverage

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.

@github-actionsgithub-actionsBot added this to the v3.1.0 milestone Apr 3, 2026
@thepastaclaw

thepastaclaw commented Apr 3, 2026

Copy link
Copy Markdown
Collaborator

Review Gate

Commit: b0f456fc

  • Debounce: 18m ago (need 30m)

  • CI checks: builds passed, 0/2 tests passed

  • CodeRabbit review: comment found

  • Off-peak hours: off-peak (11:36 AM PT Friday)

  • Run review now (check to override)

@codecov

codecovBot commented Apr 3, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.77836% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.26%. Comparing base (7011b62) to head (b0f456f).
⚠️ Report is 2 commits behind head on v3.1-dev.

Files with missing linesPatch %Lines
packages/rs-drive/src/fees/op.rs98.77%7 Missing ⚠️
Additional details and impacted files
@@ Coverage Diff @@## v3.1-dev #3429 +/- ##
============================================
+ Coverage 80.22% 80.26% +0.03% 
============================================
Files 2855 2855 Lines 281685 282623 +938 ============================================
+ Hits 225983 226842 +859 - Misses 55702 55781 +79 
ComponentsCoverage Δ
dpp72.87% <ø> (-0.14%)⬇️
drive82.49% <98.77%> (+0.14%)⬆️
drive-abci86.70% <ø> (+0.03%)⬆️
sdk36.55% <ø> (ø)
dapi-client79.06% <ø> (ø)
platform-version∅ <ø> (∅)
platform-value84.23% <ø> (ø)
platform-wallet76.09% <ø> (ø)
drive-proof-verifier55.26% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

QuantumExplorerand others added 2 commits April 3, 2026 21:01
Fixes cargo-machete CI failure.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@QuantumExplorer
QuantumExplorerforce-pushed the test/drive-fees-coverage branch from cde29c6 to b0f456fCompareApril 3, 2026 18:18
@QuantumExplorer
QuantumExplorer merged commit f0ce8fd into v3.1-devApr 3, 2026
38 checks passed
@QuantumExplorer
QuantumExplorer deleted the test/drive-fees-coverage branch April 3, 2026 18:38
Sign up for freeto 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

@QuantumExplorer@thepastaclaw