Skip to content

starknet_os: os resources test - invoke tx constant factor#14146

Open
dorimedini-starkware wants to merge 1 commit into
05-24-starknet_os_os_resources_test_-_extract_setup_test_builderfrom
05-24-starknet_os_os_resources_test_-_invoke_tx_constant_factor
Open

starknet_os: os resources test - invoke tx constant factor#14146
dorimedini-starkware wants to merge 1 commit into
05-24-starknet_os_os_resources_test_-_extract_setup_test_builderfrom
05-24-starknet_os_os_resources_test_-_invoke_tx_constant_factor

Conversation

@dorimedini-starkware
Copy link
Copy Markdown
Collaborator

No description provided.

@reviewable-StarkWare
Copy link
Copy Markdown

This change is Reviewable

Copy link
Copy Markdown
Collaborator Author

dorimedini-starkware commented May 24, 2026

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@cursor
Copy link
Copy Markdown

cursor Bot commented May 24, 2026

PR Summary

Low Risk
Changes are test-driven resource accounting updates and JSON constants for fee estimation; no runtime execution-path logic changes.

Overview
Adds test_execute_txs_inner_resources, which runs a minimal invoke through the full OS, subtracts blockifier execute/validate VM resources from the OS trace, and treats the remainder as the execute_txs_inner constant for InvokeFunction. The test asserts the existing calldata scaling factor of 2 and snapshots the updated constants via expect_file.

blockifier_versioned_constants_0_14_3.json is bumped for invoke inner overhead: n_steps 4348→4810, range_check_builtin 90→110, poseidon_builtin 12→14. Linear calldata cost is left for a follow-up (TODO in test).

Reviewed by Cursor Bugbot for commit e678a92. Bugbot is set up for automated code reviews on this repo. Configure here.

@dorimedini-starkware dorimedini-starkware force-pushed the 05-24-starknet_os_os_resources_test_-_invoke_tx_constant_factor branch from 3ad85f3 to c632d3d Compare May 24, 2026 10:15
@dorimedini-starkware dorimedini-starkware force-pushed the 05-24-starknet_os_os_resources_test_-_invoke_tx_constant_factor branch from c632d3d to e678a92 Compare May 24, 2026 20:08
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit e678a92. Configure here.

"Invoke scaling factor has unexpected value: {:?}",
invoke_scaling_factor.scaling_factor
);
invoke_resources_params.constant = invoke_overhead;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Constant includes calldata-dependent cost, causing double-counting

Medium Severity

The measured invoke_overhead includes calldata-dependent OS cost for the 4 calldata elements used in the test, but it's assigned entirely to invoke_resources_params.constant without subtracting the calldata factor contribution. Since resources_for_tx_type computes constant + calldata_factor * calldata_len / scaling_factor, the calldata cost for the test's 4 elements is permanently baked into the constant and double-counted for every transaction. This inflates the constant by approximately 22 n_steps and 2 poseidon_builtin (the entire poseidon increase from 12→14 is from this inflation).

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit e678a92. Configure here.

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