Skip to content

Conversation

@AvivYossef-starkware
Copy link
Contributor

No description provided.

@reviewable-StarkWare
Copy link

This change is Reviewable

@AvivYossef-starkware AvivYossef-starkware marked this pull request as ready for review December 8, 2025 15:35
@AvivYossef-starkware AvivYossef-starkware force-pushed the yonatank/use_StateReaderAndContractManager_in_reexecution_crate branch from 8e68696 to de3837d Compare December 10, 2025 08:16
@AvivYossef-starkware AvivYossef-starkware force-pushed the aviv/allow_custom_chain_id_in_reexecution branch from b4b5c24 to eaf2a13 Compare December 10, 2025 08:16
@AvivYossef-starkware AvivYossef-starkware force-pushed the yonatank/use_StateReaderAndContractManager_in_reexecution_crate branch from de3837d to 802fd8b Compare December 10, 2025 08:19
@AvivYossef-starkware AvivYossef-starkware force-pushed the aviv/allow_custom_chain_id_in_reexecution branch from eaf2a13 to 351f6ce Compare December 10, 2025 08:19
Copy link
Collaborator

@dorimedini-starkware dorimedini-starkware left a comment

Choose a reason for hiding this comment

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

@dorimedini-starkware reviewed 4 of 4 files at r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @AvivYossef-starkware)


crates/blockifier_reexecution/src/state_reader/cli.rs line 34 at r1 (raw file):

    #[clap(long, short = 'c')]
    pub chain_id: Option<ChainId>,
}

suggestion: use ArgGroup to allow two distinct argument types:

  1. --chain_id - same as before, using the enum
  2. --custom_chain_id - accepting a hex string. you can use the logic in deserialize_chain_id_from_hex to parse this

WDYT?

Code quote:

#[derive(Clone, Debug, Args)]
pub struct RpcArgs {
    /// Node url.
    #[clap(long, short = 'n')]
    pub node_url: String,

    /// Optional chain ID (if not provided, it will be guessed from the node url).
    /// Standard chain IDs: SN_MAIN, SN_SEPOLIA, SN_INTEGRATION_SEPOLIA.
    /// Custom chain IDs are also supported.
    #[clap(long, short = 'c')]
    pub chain_id: Option<ChainId>,
}

crates/starknet_api/src/core.rs line 90 at r1 (raw file):

        Ok(Self::from(s.to_owned()))
    }
}

I really don't like that the Other variant of ChainId is a string and not a Felt...
you now have two methods of converting from string to chain ID: this one (which actually treats the string as bytes when converting to Felt), and deserialize_chain_id_from_hex, which treats the string as a hex integer.
can you delete this FromStr implementation to avoid confusion?

Code quote:

impl std::str::FromStr for ChainId {
    type Err = std::convert::Infallible;

    fn from_str(s: &str) -> Result<Self, Self::Err> {
        Ok(Self::from(s.to_owned()))
    }
}

Copy link
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.

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @dorimedini-starkware)


crates/starknet_api/src/core.rs line 90 at r1 (raw file):

Previously, dorimedini-starkware wrote…

I really don't like that the Other variant of ChainId is a string and not a Felt...
you now have two methods of converting from string to chain ID: this one (which actually treats the string as bytes when converting to Felt), and deserialize_chain_id_from_hex, which treats the string as a hex integer.
can you delete this FromStr implementation to avoid confusion?

Maybe the from str should be deserialize_chain_id_from_hex?
What do you think?

Copy link
Collaborator

@dorimedini-starkware dorimedini-starkware left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @AvivYossef-starkware)


crates/starknet_api/src/core.rs line 90 at r1 (raw file):

Previously, AvivYossef-starkware wrote…

Maybe the from str should be deserialize_chain_id_from_hex?
What do you think?

I think it's ambiguous.
the root of the problem is that we have Other(String) instead of Other(Felt), but changing that seems hard (for sure it's out of scope of the current PR).
why not use my above suggestion, and explicitly request a hex string for custom chain IDs? then convert explicitly using deserialize_chain_id_from_hex?

@AvivYossef-starkware AvivYossef-starkware changed the base branch from yonatank/use_StateReaderAndContractManager_in_reexecution_crate to graphite-base/10643 December 10, 2025 11:34
@AvivYossef-starkware AvivYossef-starkware force-pushed the aviv/allow_custom_chain_id_in_reexecution branch from 351f6ce to e70c9de Compare December 10, 2025 11:49
@AvivYossef-starkware AvivYossef-starkware changed the base branch from graphite-base/10643 to yonatank/use_StateReaderAndContractManager_in_reexecution_crate December 10, 2025 11:49
Copy link
Collaborator

@dorimedini-starkware dorimedini-starkware left a comment

Choose a reason for hiding this comment

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

@dorimedini-starkware reviewed 1 of 1 files at r2, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @AvivYossef-starkware)

@AvivYossef-starkware AvivYossef-starkware force-pushed the yonatank/use_StateReaderAndContractManager_in_reexecution_crate branch from 6aa90d5 to 9c9a688 Compare December 10, 2025 12:17
@AvivYossef-starkware AvivYossef-starkware force-pushed the aviv/allow_custom_chain_id_in_reexecution branch from e70c9de to 607df2f Compare December 10, 2025 12:17
Copy link
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.

Reviewable status: 1 of 4 files reviewed, 1 unresolved discussion (waiting on @dorimedini-starkware)


crates/blockifier_reexecution/src/state_reader/cli.rs line 34 at r1 (raw file):

Previously, dorimedini-starkware wrote…

suggestion: use ArgGroup to allow two distinct argument types:

  1. --chain_id - same as before, using the enum
  2. --custom_chain_id - accepting a hex string. you can use the logic in deserialize_chain_id_from_hex to parse this

WDYT?

Done


crates/starknet_api/src/core.rs line 90 at r1 (raw file):

Previously, dorimedini-starkware wrote…

I think it's ambiguous.
the root of the problem is that we have Other(String) instead of Other(Felt), but changing that seems hard (for sure it's out of scope of the current PR).
why not use my above suggestion, and explicitly request a hex string for custom chain IDs? then convert explicitly using deserialize_chain_id_from_hex?

Done.

@AvivYossef-starkware AvivYossef-starkware force-pushed the yonatank/use_StateReaderAndContractManager_in_reexecution_crate branch from 9c9a688 to e0f13bb Compare December 10, 2025 12:44
@AvivYossef-starkware AvivYossef-starkware force-pushed the aviv/allow_custom_chain_id_in_reexecution branch from 607df2f to 06fa010 Compare December 10, 2025 12:44
@AvivYossef-starkware AvivYossef-starkware force-pushed the yonatank/use_StateReaderAndContractManager_in_reexecution_crate branch from e0f13bb to 5b0310b Compare December 10, 2025 13:07
@AvivYossef-starkware AvivYossef-starkware force-pushed the aviv/allow_custom_chain_id_in_reexecution branch from 06fa010 to f7b94bd Compare December 10, 2025 13:07
Copy link
Collaborator

@dorimedini-starkware dorimedini-starkware left a comment

Choose a reason for hiding this comment

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

@dorimedini-starkware reviewed 4 of 4 files at r3, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @AvivYossef-starkware)


crates/blockifier_reexecution/src/state_reader/cli.rs line 69 at r3 (raw file):

            let mut deserializer = serde_json::Deserializer::from_str(&json_str);
            return deserialize_chain_id_from_hex(&mut deserializer)
                .expect("Failed to parse hex chain id");

maybe better to extract the string-parsing logic from the deserializer, and using it in two places, instead of creating temporary JSON just to reuse deserialization

Code quote:

            let json_str = format!("\"{}\"", hex_str);
            let mut deserializer = serde_json::Deserializer::from_str(&json_str);
            return deserialize_chain_id_from_hex(&mut deserializer)
                .expect("Failed to parse hex chain id");

@AvivYossef-starkware AvivYossef-starkware force-pushed the aviv/allow_custom_chain_id_in_reexecution branch from f7b94bd to e7407fe Compare December 10, 2025 13:23
Copy link
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.

Reviewable status: 2 of 6 files reviewed, 1 unresolved discussion (waiting on @dorimedini-starkware)


crates/blockifier_reexecution/src/state_reader/cli.rs line 69 at r3 (raw file):

Previously, dorimedini-starkware wrote…

maybe better to extract the string-parsing logic from the deserializer, and using it in two places, instead of creating temporary JSON just to reuse deserialization

Done.

Copy link
Collaborator

@dorimedini-starkware dorimedini-starkware left a comment

Choose a reason for hiding this comment

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

@dorimedini-starkware reviewed 4 of 4 files at r4, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @AvivYossef-starkware)


a discussion (no related file):
ah... risky, doing this on main-v0.14.1... can you open a py-side PR to make sure nothing breaks?

@AvivYossef-starkware AvivYossef-starkware force-pushed the aviv/allow_custom_chain_id_in_reexecution branch from 7b91eb9 to 5816480 Compare December 11, 2025 08:52
Copy link
Collaborator

@dorimedini-starkware dorimedini-starkware left a comment

Choose a reason for hiding this comment

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

@dorimedini-starkware reviewed 6 of 6 files at r6, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @AvivYossef-starkware)

@AvivYossef-starkware AvivYossef-starkware added this pull request to the merge queue Dec 11, 2025
@AvivYossef-starkware AvivYossef-starkware removed this pull request from the merge queue due to a manual request Dec 11, 2025
@AvivYossef-starkware AvivYossef-starkware added this pull request to the merge queue Dec 11, 2025
Copy link
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.

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @AvivYossef-starkware)


a discussion (no related file):

Previously, dorimedini-starkware wrote…

ah... risky, doing this on main-v0.14.1... can you open a py-side PR to make sure nothing breaks?

done

Merged via the queue into main-v0.14.1 with commit 4aa88b7 Dec 11, 2025
28 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Dec 13, 2025
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