Skip to content

Conversation

@aramikm
Copy link
Collaborator

@aramikm aramikm commented Sep 19, 2025

Goal

The goal of this PR is to fix the bug in capacity estimation RPC.

Closes #2579

Discussion

  • The issue was using the weight from extrinsic which includes the inner calls instead of getting the bare capacity weights directly.

Checklist

  • Spec version incremented?

Verification

As shown Calculated and deducted capacity values are really close.
2,741,950 in RPC
2,737,627 in Event

Screenshot 2025-09-18 at 4 28 54 PM Screenshot 2025-09-18 at 4 29 11 PM

@codecov
Copy link

codecov bot commented Sep 19, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
pallets/frequency-tx-payment/src/lib.rs 93.04% <100.00%> (ø)
🚀 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.

@github-actions github-actions bot added the metadata-changed Metadata has changed since the latest full release label Sep 19, 2025
Copy link
Collaborator

@JoeCap08055 JoeCap08055 left a comment

Choose a reason for hiding this comment

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

Good catch. Do we want to add/update any tests? I believe we have e2e tests that deal with stable weights...

@aramikm
Copy link
Collaborator Author

aramikm commented Sep 19, 2025

@JoeCap08055 This is only on the RPC side and doesn't involve the stable weights directly. I don't think we had any tests that needed fixing but I can maybe add one just in case.

@github-actions github-actions bot removed the metadata-changed Metadata has changed since the latest full release label Sep 19, 2025
@github-actions github-actions bot added the metadata-changed Metadata has changed since the latest full release label Sep 19, 2025
Copy link
Collaborator

@mattheworris mattheworris left a comment

Choose a reason for hiding this comment

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

  • Read through changes
    🚢 it!

const tx = ExtrinsicHelper.api.tx.frequencyTxPayment.payWithCapacity(insideTx);
const signedTx = await firstValueFrom(tx.signAsync(capacityProviderKeys));
const signedHex = signedTx.toHex();
// it's important to submit a signed extrinsic to the rpc to get an accurate estimate due to the actual length of extrinsic and etc.
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍

Copy link
Collaborator

@enddynayn enddynayn left a comment

Choose a reason for hiding this comment

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

👍 superb!

@aramikm aramikm merged commit c0e0b86 into main Sep 22, 2025
35 checks passed
@aramikm aramikm deleted the bigfix_capacity_calculation branch September 22, 2025 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

metadata-changed Metadata has changed since the latest full release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Capacity fee estimation RPC double-charges

6 participants