fix: replace stub zero-return cost model functions [PM-19968]#839
Merged
Conversation
Made-with: Cursor
Contributor
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
Made-with: Cursor
gilescope
approved these changes
Mar 12, 2026
4 tasks
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
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.








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
// TODO COST MODEL:comment fromget_transaction_cost(predates the fix in commit60551502)#[allow(unused_variables)]attribute; replace with idiomatic underscore prefix (block_context→_block_context)test_get_mn_transaction_feeby removing the#[ignore]attribute that was gated on cost model availabilitychanges/changed/audit-remove-cost-model-stubs.md)Files changed:
ledger/src/versions/common/mod.rs,pallets/midnight/src/tests.rsNet change: −3 lines (cleanup only, no functional behavior change)
📌 Submission Checklist
🔱 Fork Strategy
🗹 TODO before merging