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

dorimedini-starkware commented May 24, 2026

Copy link
Copy Markdown
Collaborator Author

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

cursor Bot commented May 24, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Updates fee-related versioned constants and golden fixtures; incorrect measurements would skew fee estimation and OS resource accounting for invokes.

Overview
Adds test_execute_txs_inner_resources in starknet_os_flow_tests to measure Starknet OS scaffolding for invoke transactions (OS trace minus blockifier validate/execute) and lock the result into versioned constants via expect_file against blockifier_versioned_constants_0_14_4.json.

InvokeFunction execute_txs_inner constants are raised: n_steps 4348 → 4779, range_check_builtin 90 → 110, poseidon_builtin 12 → 11. The 0.14.3→0.14.4 VC diff regression file records these paths. Test setup now funds the stable measurement contract and adds span_calldata for calldata-factor measurements.

Downstream expectations are refreshed for higher invoke fees/resources: RPC EXPECTED_FEE_ESTIMATE, blockifier recursion/step-limit tests, preconfirmed_block.json, and blob generation fixture count.

Reviewed by Cursor Bugbot for commit e5e710c. 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 2 times, most recently from c632d3d to e678a92 Compare May 24, 2026 20:08
Comment thread crates/starknet_os_flow_tests/src/os_resources_test.rs Outdated
@dorimedini-starkware dorimedini-starkware force-pushed the 05-24-starknet_os_os_resources_test_-_extract_setup_test_builder branch from 72ceed8 to e0bcdfa Compare May 28, 2026 16:18
@dorimedini-starkware dorimedini-starkware force-pushed the 05-24-starknet_os_os_resources_test_-_invoke_tx_constant_factor branch from e678a92 to c2f6aca Compare May 28, 2026 16:18
@dorimedini-starkware dorimedini-starkware force-pushed the 05-24-starknet_os_os_resources_test_-_extract_setup_test_builder branch from e0bcdfa to 668f39a Compare May 29, 2026 14:04
@dorimedini-starkware dorimedini-starkware force-pushed the 05-24-starknet_os_os_resources_test_-_invoke_tx_constant_factor branch from c2f6aca to 350efcf Compare May 29, 2026 14:04
@dorimedini-starkware dorimedini-starkware force-pushed the 05-24-starknet_os_os_resources_test_-_extract_setup_test_builder branch from 668f39a to 8cf1830 Compare June 1, 2026 08:37
@dorimedini-starkware dorimedini-starkware force-pushed the 05-24-starknet_os_os_resources_test_-_invoke_tx_constant_factor branch 2 times, most recently from 885d969 to ac6fd8a Compare June 1, 2026 10:24
@dorimedini-starkware dorimedini-starkware force-pushed the 05-24-starknet_os_os_resources_test_-_extract_setup_test_builder branch from 2625ae9 to 98b3648 Compare June 2, 2026 10:21
@dorimedini-starkware dorimedini-starkware force-pushed the 05-24-starknet_os_os_resources_test_-_invoke_tx_constant_factor branch from ac6fd8a to 8f85cc3 Compare June 2, 2026 10:21
@dorimedini-starkware dorimedini-starkware force-pushed the 05-24-starknet_os_os_resources_test_-_extract_setup_test_builder branch from 98b3648 to a20c3ab Compare June 8, 2026 10:25
@dorimedini-starkware dorimedini-starkware force-pushed the 05-24-starknet_os_os_resources_test_-_invoke_tx_constant_factor branch from 8f85cc3 to 7f07092 Compare June 8, 2026 10:25
@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown

Artifacts upload workflows:

@dorimedini-starkware dorimedini-starkware force-pushed the 05-24-starknet_os_os_resources_test_-_invoke_tx_constant_factor branch from 7f07092 to fb53fd2 Compare June 8, 2026 11:59
@dorimedini-starkware dorimedini-starkware force-pushed the 05-24-starknet_os_os_resources_test_-_extract_setup_test_builder branch 2 times, most recently from 21103d8 to 572a3b1 Compare June 9, 2026 11:37
@dorimedini-starkware dorimedini-starkware force-pushed the 05-24-starknet_os_os_resources_test_-_invoke_tx_constant_factor branch from fb53fd2 to 214c8b8 Compare June 9, 2026 11:37

@cursor cursor Bot left a comment

Copy link
Copy Markdown

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 214c8b8. Configure here.

raw_vc.os_resources.execute_txs_inner.extend([(
TransactionType::InvokeFunction,
VariableResourceParams::WithFactor(ResourcesParams {
constant: (&invoke_first - &invoke_linear_factor).filter_unused_builtins(),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Wrong scaled calldata deduction

Medium Severity

When deriving the InvokeFunction execute_txs_inner constant, the test subtracts the full scaled calldata_factor.resources from the first measurement. With scaling_factor 2, runtime cost for one extended calldata unit uses calculate_resources(1) (half that bundle per field), so the stored constant is too low and misaligns with resources_for_tx_type.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 214c8b8. Configure here.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@Yoni-Starkware correct me if I'm wrong but we have to scale up the calldata_factor because when charging for it, we "scale down" by the same amount. with the constant factor, no scaling is required

@dorimedini-starkware dorimedini-starkware left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@dorimedini-starkware made 1 comment.
Reviewable status: 0 of 3 files reviewed, 1 unresolved discussion (waiting on yoavGrs and Yoni-Starkware).

raw_vc.os_resources.execute_txs_inner.extend([(
TransactionType::InvokeFunction,
VariableResourceParams::WithFactor(ResourcesParams {
constant: (&invoke_first - &invoke_linear_factor).filter_unused_builtins(),

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@Yoni-Starkware correct me if I'm wrong but we have to scale up the calldata_factor because when charging for it, we "scale down" by the same amount. with the constant factor, no scaling is required

@dorimedini-starkware dorimedini-starkware force-pushed the 05-24-starknet_os_os_resources_test_-_invoke_tx_constant_factor branch from 214c8b8 to e5e710c Compare June 9, 2026 12:01
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