Skip to content

starknet_os_runner: simulate tx and get rpc initial reads#12869

Merged
AvivYossef-starkware merged 1 commit intomain-v0.14.2from
aviv/simulate_tx_and_get_initial_reads
Mar 1, 2026
Merged

starknet_os_runner: simulate tx and get rpc initial reads#12869
AvivYossef-starkware merged 1 commit intomain-v0.14.2from
aviv/simulate_tx_and_get_initial_reads

Conversation

@AvivYossef-starkware
Copy link
Copy Markdown
Contributor

@AvivYossef-starkware AvivYossef-starkware commented Feb 25, 2026

Note

Low Risk
Mostly additive changes: a new RPC helper + JSON deserialization plus tests and a recorded fixture. Risk is low, mainly around compatibility with v0.10 nodes and correctness of the initial_reads parsing.

Overview
Adds an RPC path to prefetch initial state reads by calling starknet_simulateTransactions with the RETURN_INITIAL_READS flag and converting the response into blockifier StateMaps.

Introduces a small serde_utils module to deserialize pathfinder v0.10 initial_reads JSON, plus unit/integration coverage and a new rpc_records fixture to allow offline replay of the simulate response.

Written by Cursor Bugbot for commit 4b8e28b. This will update automatically on new commits. Configure here.

@reviewable-StarkWare
Copy link
Copy Markdown

This change is Reviewable

Copy link
Copy Markdown
Contributor Author

AvivYossef-starkware commented Feb 25, 2026

Copy link
Copy Markdown
Contributor

@meship-starkware meship-starkware left a comment

Choose a reason for hiding this comment

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

@meship-starkware reviewed 5 files and all commit messages, and made 2 comments.
Reviewable status: 5 of 6 files reviewed, 2 unresolved discussions (waiting on AvivYossef-starkware, einat-starkware, and noaov1).


crates/starknet_os_runner/src/running/serde_utils_test.rs line 31 at r1 (raw file):

    #[case] expected_nonces: usize,
    #[case] expected_class_hashes: usize,
    #[case] expected_declared_contracts: usize,

Does it represent the length of the list? than maybe, because right now it looks like a flag. I also think it could be interesting if one of the fields contains more than one element in the first test case

Suggestion:

    #[case] expected_storage_len: usize,
    #[case] expected_nonces: usize,
    #[case] expected_class_hashes: usize,
    #[case] expected_declared_contracts: usize,

crates/starknet_os_runner/src/running/serde_utils_test.rs line 33 at r1 (raw file):

    #[case] expected_declared_contracts: usize,
) {
    let state_maps = deserialize_rpc_initial_reads(input).unwrap();

I think we should have the expected map and not just its length. I am not sure the length is enough

Code quote:

 let state_maps = deserialize_rpc_initial_reads(input).unwrap();

Copy link
Copy Markdown
Contributor

@meship-starkware meship-starkware left a comment

Choose a reason for hiding this comment

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

@meship-starkware reviewed 1 file and made 1 comment.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on AvivYossef-starkware, einat-starkware, and noaov1).


crates/starknet_os_runner/src/running/virtual_block_executor_test.rs line 172 at r1 (raw file):

/// ```
#[tokio::test(flavor = "multi_thread")]
async fn test_simulate_and_get_initial_reads() {

Is the test not ignored on purpose?

Code quote:

#[tokio::test(flavor = "multi_thread")]
async fn test_simulate_and_get_initial_reads() {

@AvivYossef-starkware AvivYossef-starkware force-pushed the aviv/simulate_tx_and_get_initial_reads branch from 4b64959 to a4f0e58 Compare March 1, 2026 12:00
Copy link
Copy Markdown
Contributor Author

@AvivYossef-starkware AvivYossef-starkware left a comment

Choose a reason for hiding this comment

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

@AvivYossef-starkware made 3 comments.
Reviewable status: 5 of 6 files reviewed, 3 unresolved discussions (waiting on einat-starkware, meship-starkware, and noaov1).


crates/starknet_os_runner/src/running/serde_utils_test.rs line 31 at r1 (raw file):

Previously, meship-starkware (Meshi Peled) wrote…

Does it represent the length of the list? than maybe, because right now it looks like a flag. I also think it could be interesting if one of the fields contains more than one element in the first test case

thanks


crates/starknet_os_runner/src/running/serde_utils_test.rs line 33 at r1 (raw file):

Previously, meship-starkware (Meshi Peled) wrote…

I think we should have the expected map and not just its length. I am not sure the length is enough

Done.


crates/starknet_os_runner/src/running/virtual_block_executor_test.rs line 172 at r1 (raw file):

Previously, meship-starkware (Meshi Peled) wrote…

Is the test not ignored on purpose?

Yes , we use the records in the resources dir

Copy link
Copy Markdown
Contributor

@meship-starkware meship-starkware left a comment

Choose a reason for hiding this comment

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

@meship-starkware reviewed 1 file and all commit messages, made 1 comment, and resolved 3 discussions.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on AvivYossef-starkware, einat-starkware, and noaov1).


crates/starknet_os_runner/src/running/virtual_block_executor_test.rs line 169 at r1 (raw file):

///
/// # Offline (after recording):
/// cargo test -p starknet_os_runner test_simulate_and_get_initial_reads -- --ignored

Please fix or -- --include_ignore otherwise the test wont run

Suggestion:

/// RECORD_RPC_RECORDS=1 NODE_URL=http://<privacy-env-node>/rpc/v0_10 \
///     cargo test -p starknet_os_runner test_simulate_and_get_initial_reads
///
/// # Offline (after recording):
/// cargo test -p starknet_os_runner test_simulate_and_get_initial_reads 

@AvivYossef-starkware AvivYossef-starkware force-pushed the aviv/simulate_tx_and_get_initial_reads branch from a4f0e58 to a10b57d Compare March 1, 2026 14:08
@AvivYossef-starkware AvivYossef-starkware force-pushed the aviv/add-rpc-virtual-block-executor-config branch from 569d88e to 8322e37 Compare March 1, 2026 14:08
Copy link
Copy Markdown
Contributor

@meship-starkware meship-starkware left a comment

Choose a reason for hiding this comment

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

@meship-starkware reviewed 1 file and all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on AvivYossef-starkware, einat-starkware, and noaov1).

@AvivYossef-starkware AvivYossef-starkware force-pushed the aviv/add-rpc-virtual-block-executor-config branch from 8322e37 to e5fba67 Compare March 1, 2026 16:00
@AvivYossef-starkware AvivYossef-starkware force-pushed the aviv/simulate_tx_and_get_initial_reads branch from a10b57d to 9fd0721 Compare March 1, 2026 16:00
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.

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

Comment thread crates/starknet_os_runner/src/running/virtual_block_executor_test.rs Outdated
@AvivYossef-starkware AvivYossef-starkware changed the base branch from aviv/add-rpc-virtual-block-executor-config to main-v0.14.2 March 1, 2026 16:24
@AvivYossef-starkware AvivYossef-starkware force-pushed the aviv/simulate_tx_and_get_initial_reads branch from 9fd0721 to afe7925 Compare March 1, 2026 16:26
@graphite-app
Copy link
Copy Markdown

graphite-app Bot commented Mar 1, 2026

Merge activity

  • Mar 1, 4:26 PM UTC: Graphite rebased this pull request, because this pull request is set to merge when ready.

@AvivYossef-starkware AvivYossef-starkware force-pushed the aviv/simulate_tx_and_get_initial_reads branch from afe7925 to 4b8e28b Compare March 1, 2026 17:39
Copy link
Copy Markdown
Contributor Author

@AvivYossef-starkware AvivYossef-starkware left a comment

Choose a reason for hiding this comment

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

@AvivYossef-starkware reviewed 3 files and all commit messages, and resolved 1 discussion.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on einat-starkware and noaov1).

@AvivYossef-starkware AvivYossef-starkware added this pull request to the merge queue Mar 1, 2026
Merged via the queue into main-v0.14.2 with commit 2fbb684 Mar 1, 2026
14 of 16 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 3, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants