Skip to content

starknet_os_runner: add mock_rpc for integration test with the SDK#12909

Merged
avivg-starkware merged 1 commit intomain-v0.14.2from
avivg/starknet_os_runner/add_mock_rpc
Mar 1, 2026
Merged

starknet_os_runner: add mock_rpc for integration test with the SDK#12909
avivg-starkware merged 1 commit intomain-v0.14.2from
avivg/starknet_os_runner/add_mock_rpc

Conversation

@avivg-starkware
Copy link
Copy Markdown
Contributor

@avivg-starkware avivg-starkware commented Feb 26, 2026

Note

Low Risk
Low risk: adds a test-only mock RPC implementation and a reference JSON fixture without changing the real proving flow; only minor visibility change to reuse SPEC_VERSION.

Overview
Adds a MockProvingRpc implementation of the starknet_proveTransaction RPC that returns a deterministic, preloaded ProveTransactionResult from resources/mock_proving_rpc/prove_transaction_result.json for SDK integration tests.

Introduces a serde roundtrip test to ensure the reference JSON fixture stays in sync with the ProveTransactionResult serialization format, and makes SPEC_VERSION pub(crate) so the mock can reuse the same specVersion response.

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

@avivg-starkware avivg-starkware marked this pull request as ready for review February 26, 2026 13:29
@reviewable-StarkWare
Copy link
Copy Markdown

This change is Reviewable

Copy link
Copy Markdown
Contributor Author

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

@avivg-starkware avivg-starkware force-pushed the avivg/starknet_os_runner/add_mock_rpc branch 2 times, most recently from b820ac8 to 6326b23 Compare February 26, 2026 13:40
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.

Comment thread crates/starknet_os_runner/src/server/mock_rpc.rs Outdated
@avivg-starkware avivg-starkware force-pushed the avivg/starknet_os_runner/add_mock_rpc branch 2 times, most recently from ecd01fe to d86781f Compare March 1, 2026 13:01
@avivg-starkware avivg-starkware force-pushed the avivg/starknet_os_runner/add_mock_rpc branch from d86781f to b94451a Compare March 1, 2026 13:04
Copy link
Copy Markdown
Contributor Author

@avivg-starkware avivg-starkware left a comment

Choose a reason for hiding this comment

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

@avivg-starkware made 1 comment.
Reviewable status: 0 of 6 files reviewed, 1 unresolved discussion (waiting on avivg-starkware).


crates/starknet_os_runner/resources/mock_proving_rpc/prove_transaction_result.json line 23 at r3 (raw file):

      ]
    }
  ]

I'm not very familiar with l2_to_l1_messages - can you approve the format?

Code quote:

  "l2_to_l1_messages": [
    {
      "from_address": "0x123",
      "to_address": "0xdeadbeef",
      "payload": [
        "0x1",
        "0x2",
        "0x3"
      ]
    }
  ]

Copy link
Copy Markdown
Collaborator

@Yoni-Starkware Yoni-Starkware left a comment

Choose a reason for hiding this comment

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

@Yoni-Starkware made 1 comment.
Reviewable status: 0 of 6 files reviewed, 1 unresolved discussion (waiting on avivg-starkware).


crates/starknet_os_runner/resources/mock_proving_rpc/prove_transaction_result.json line 23 at r3 (raw file):

Previously, avivg-starkware wrote…

I'm not very familiar with l2_to_l1_messages - can you approve the format?

Yeah looks good. Actually, try to remove one of the fields - your test should test in this case.

@avivg-starkware
Copy link
Copy Markdown
Contributor Author

crates/starknet_os_runner/resources/mock_proving_rpc/prove_transaction_result.json line 23 at r3 (raw file):

Previously, Yoni-Starkware (Yoni) wrote…

Yeah looks good. Actually, try to remove one of the fields - your test should test in this case.

Yes, just tried- removing each of the fields ("from_address", "to_address", "payload") causes test_prove_transaction_result_roundtrip to fail

Copy link
Copy Markdown
Collaborator

@Yoni-Starkware Yoni-Starkware left a comment

Choose a reason for hiding this comment

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

:lgtm:

@Yoni-Starkware reviewed 5 files and all commit messages, and made 1 comment.
Reviewable status: 5 of 6 files reviewed, 1 unresolved discussion (waiting on avivg-starkware).

Copy link
Copy Markdown
Contributor Author

@avivg-starkware avivg-starkware left a comment

Choose a reason for hiding this comment

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

@avivg-starkware resolved 1 discussion.
Reviewable status: 5 of 6 files reviewed, all discussions resolved (waiting on Yoni-Starkware).

Copy link
Copy Markdown
Contributor Author

@avivg-starkware avivg-starkware left a comment

Choose a reason for hiding this comment

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

@avivg-starkware reviewed 1 file.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on avivg-starkware).

@avivg-starkware avivg-starkware added this pull request to the merge queue Mar 1, 2026
Merged via the queue into main-v0.14.2 with commit 63eaeb1 Mar 1, 2026
14 of 16 checks passed
Copy link
Copy Markdown
Contributor

@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 4 comments.
Reviewable status: all files reviewed, 4 unresolved discussions.


crates/starknet_os_runner/src/server.rs line 4 at r3 (raw file):

pub mod cors;
pub mod error;
pub mod mock_rpc;

plz put it under feature
it should be part of the production code


crates/starknet_os_runner/src/server/mock_rpc.rs line 17 at r3 (raw file):

#[cfg(test)]
#[path = "mock_rpc_test.rs"]
mod mock_rpc_test;

plz define it in serever.rs

Code quote:

#[cfg(test)]
#[path = "mock_rpc_test.rs"]
mod mock_rpc_test;

crates/starknet_os_runner/src/server/mock_rpc.rs line 73 at r3 (raw file):

fn reference_json_dir() -> PathBuf {
    PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("resources").join("mock_proving_rpc")
}

use it

Code quote:

    PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("resources").join("mock_proving_rpc")
}

crates/starknet_os_runner/src/server/mock_rpc_test.rs line 9 at r3 (raw file):

//! 2. Update `resources/mock_proving_rpc/prove_transaction_result.json` to match the new serialized
//!    format.
//! 3. Update the SDK to parse the new response format.

its a docsting of the test not the module

Code quote:

//! Serde roundtrip test for the **response** format (`ProveTransactionResult`).
//!
//! Ensures the reference JSON file stays in sync with the Rust type.
//!
//! **If this test fails**:
//! 1. The serde layout of `ProveTransactionResult` has changed.
//! 2. Update `resources/mock_proving_rpc/prove_transaction_result.json` to match the new serialized
//!    format.
//! 3. Update the SDK to parse the new response format.

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.

4 participants