Skip to content

fix: replace stub zero-return cost model functions [PM-19968]#839

Merged
m2ux merged 7 commits into
mainfrom
fix/PM-19968-unintegrated-cost-model-functions
Mar 12, 2026
Merged

fix: replace stub zero-return cost model functions [PM-19968]#839
m2ux merged 7 commits into
mainfrom
fix/PM-19968-unintegrated-cost-model-functions

Conversation

@m2ux

@m2ux m2ux commented Mar 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Address Least Authority audit finding (Suggestions 1 and 3): stub cost model functions that return zero instead of computing actual values. Verify the existing fix and clean up stale annotations.

🎫 Ticket 📐 Engineering


Motivation

The Least Authority security audit identified stub cost model functions in the ledger module that return zero instead of computing actual values. Callers silently receive a zero cost, which could affect fee calculations and weight accounting — a latent risk to the economic integrity of the network.


Changes

  • Remove stale // TODO COST MODEL: comment from get_transaction_cost (predates the fix in commit 60551502)
  • Remove redundant #[allow(unused_variables)] attribute; replace with idiomatic underscore prefix (block_context_block_context)
  • Re-enable integration test test_get_mn_transaction_fee by removing the #[ignore] attribute that was gated on cost model availability
  • Add changes file (changes/changed/audit-remove-cost-model-stubs.md)

Files changed: ledger/src/versions/common/mod.rs, pallets/midnight/src/tests.rs
Net change: −3 lines (cleanup only, no functional behavior change)


📌 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: [reason]
  • If the changes introduce a new feature, I have bumped the node minor version — N/A (cleanup, not a new feature)
  • Update documentation (if relevant) — N/A
  • No new todos introduced

🔱 Fork Strategy

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

🗹 TODO before merging

  • Ready for review

@m2ux m2ux self-assigned this Mar 2, 2026
@github-actions

github-actions Bot commented Mar 2, 2026

Copy link
Copy Markdown
Contributor

kics-logo

KICS version: v2.1.19

Category Results
CRITICAL CRITICAL 0
HIGH HIGH 0
MEDIUM MEDIUM 47
LOW LOW 3
INFO INFO 59
TRACE TRACE 0
TOTAL TOTAL 109
Metric Values
Files scanned placeholder 26
Files parsed placeholder 26
Files failed to scan placeholder 0
Total executed queries placeholder 73
Queries failed to execute placeholder 0
Execution time placeholder 11

m2ux and others added 6 commits March 4, 2026 14:52
Remove vestigial annotations from get_transaction_cost now that it
computes actual costs via tx.0.cost(). Prefix the unused block_context
parameter (vestigial from the removed get_contract_call_gas_cost) and
re-enable the previously-ignored test_get_mn_transaction_fee.

JIRA: PM-19968
Made-with: Cursor
@m2ux m2ux changed the title fix: replace stub zero-return cost model functions (PM-19968) fix: replace stub zero-return cost model functions [PM-19968] Mar 11, 2026
@m2ux m2ux marked this pull request as ready for review March 12, 2026 11:39
@m2ux m2ux requested a review from a team as a code owner March 12, 2026 11:39
@m2ux m2ux added this pull request to the merge queue Mar 12, 2026
Merged via the queue into main with commit 78643e3 Mar 12, 2026
58 of 60 checks passed
@m2ux m2ux deleted the fix/PM-19968-unintegrated-cost-model-functions branch March 12, 2026 12:42
gilescope pushed a commit that referenced this pull request Apr 8, 2026
Fix numpy compile problems:

Adding stdenv.cc.c to the LIBRARY_PATH is necessary to make
NumPy happy which otherwise fails when trying to run the e2e tests
@gilescope gilescope added this to the node-1.0.0 milestone Apr 10, 2026
m2ux added a commit that referenced this pull request Apr 23, 2026
Fix numpy compile problems:

Adding stdenv.cc.c to the LIBRARY_PATH is necessary to make
NumPy happy which otherwise fails when trying to run the e2e tests
Signed-off-by: Mike Clay <mike.clay@shielded.io>
m2ux added a commit that referenced this pull request Apr 23, 2026
Fix numpy compile problems:

Adding stdenv.cc.c to the LIBRARY_PATH is necessary to make
NumPy happy which otherwise fails when trying to run the e2e tests
Signed-off-by: Mike Clay <mike.clay@shielded.io>
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.

2 participants