Commit dee4f24
CostTracker: Add a getter to expose cost by writable accounts (#7920)
* Summary
This change adds a new method to the CostTracker that provides a breakdown of compute unit costs for each writable account during block processing.
Problem
Currently, CostTracker aggregates compute unit costs but doesn't expose a detailed breakdown of costs per account. This makes it difficult to analyze resource consumption patterns and identify which accounts are the biggest resource consumers within a block.
Solution
A new method, get_cost_by_writable_accounts(), has been added to the CostTracker to address this issue. This method returns a mapping of each writable account to its specific compute unit costs, providing a granular view of resource usage.
Testing
✅ The new method was tested to ensure it correctly tracks and returns per-account costs.
✅ Existing CostTracker functionality remains unchanged and unaffected by this addition.
✅ The change was validated to confirm it correctly captures the cost distribution among writable accounts.
Type of Change
[ ] Bug fix (non-breaking change which fixes an issue)
[x] New feature (non-breaking change which adds functionality)
[ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
[ ] Documentation update
Checklist
[x] Code compiles without errors
[x] New tests have been added and pass
[x] No breaking changes
[x] Follows existing code style
* Use a trait to expose the heavy method
* gate behind a feature
* Revert "gate behind a feature"
This reverts commit b927337.
(cherry picked from commit f4598b1)1 parent 9c181a4 commit dee4f24
File tree
3 files changed
+38
-1
lines changed- cost-model/src
3 files changed
+38
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
8 | 11 | | |
9 | 12 | | |
10 | 13 | | |
| |||
418 | 421 | | |
419 | 422 | | |
420 | 423 | | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
421 | 433 | | |
422 | 434 | | |
423 | 435 | | |
| |||
983 | 995 | | |
984 | 996 | | |
985 | 997 | | |
| 998 | + | |
| 999 | + | |
| 1000 | + | |
| 1001 | + | |
| 1002 | + | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
| 1012 | + | |
| 1013 | + | |
986 | 1014 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
0 commit comments