Skip to content

Conversation

@Klapeyron
Copy link

Overview

It is a draft concept to utilize WeightMeter in order to report consumed weight in accordance with real performed computations.

🗹 TODO before merging

  • Ready

📌 Submission Checklist

  • Changes are backward-compatible (or flagged if breaking)
  • Pull request description explains why the change is needed
  • Self-reviewed the diff
  • I have included a change file, or skipped for this reason:
  • If the changes introduce a new feature, I have bumped the node minor version
  • Update documentation (if relevant)
  • Updated AGENTS.md if build commands, architecture, or workflows changed
  • No new todos introduced

🧪 Testing Evidence

Please describe any additional testing aside from CI:

  • Additional tests are provided (if possible)

🔱 Fork Strategy

  • Node Runtime Update
  • Node Client Update
  • Other:
  • N/A

Links

@CLAassistant
Copy link

CLAassistant commented Jan 19, 2026

CLA assistant check
All committers have signed the CLA.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 19, 2026

kics-logo

KICS version: v2.1.16

Category Results
CRITICAL CRITICAL 0
HIGH HIGH 0
MEDIUM MEDIUM 123
LOW LOW 12
INFO INFO 85
TRACE TRACE 0
TOTAL TOTAL 220
Metric Values
Files scanned placeholder 28
Files parsed placeholder 28
Files failed to scan placeholder 0
Total executed queries placeholder 73
Queries failed to execute placeholder 0
Execution time placeholder 6

) -> DispatchResultWithPostInfo {
// Local weight meter – use meter.consume(...) / meter.try_consume(...) as needed.
let mut meter = WeightMeter::with_limit(Pallet::<T>::get_tx_weight(&midnight_tx));

Copy link
Contributor

Choose a reason for hiding this comment

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

meter should be passed down to LedgerApi::apply_transaction( so that consumed can be called and we can ensure that Pallet::<T>::get_tx_weight(&midnight_tx) is only called once.

Copy link
Author

Choose a reason for hiding this comment

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

thank you! I moved it deeper 5622399

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.

4 participants