Skip to content

Conversation

@einat-starkware
Copy link
Contributor

No description provided.

Copy link
Contributor Author

einat-starkware commented Dec 25, 2025

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.

@reviewable-StarkWare
Copy link

This change is Reviewable

Copy link
Collaborator

@noaov1 noaov1 left a comment

Choose a reason for hiding this comment

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

@noaov1 reviewed 2 files and all commit messages, and made 1 comment.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @einat-starkware).


crates/apollo_gateway/src/gateway.rs line 149 at r1 (raw file):

                    .map_err(convert_proof_manager_error)?;
            }
        }

Consider moving it to convert_rpc_tx_to_internal_rpc_tx.

Suggestion:

        // If a transaction has a proof then we add it to the proof manager.
        if let RpcTransaction::Invoke(RpcInvokeTransaction::V3(ref tx)) = tx {
            if !tx.proof_facts.is_empty() {
                let proof_facts_hash = tx.proof_facts.hash();
                self.proof_manager_client
                    .set_proof(proof_facts_hash, tx.proof.clone())
                    .await
                    .map_err(convert_proof_manager_error)?;
            }
        }

@einat-starkware einat-starkware force-pushed the einat/proof_manager/add_to_gw branch from 9a8c6ce to df265bc Compare December 30, 2025 09:17
Copy link
Collaborator

@noaov1 noaov1 left a comment

Choose a reason for hiding this comment

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

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


crates/apollo_gateway/src/gateway.rs line 148 at r4 (raw file):

                    .set_proof(proof_facts_hash, tx.proof.clone())
                    .await
                    .map_err(convert_proof_manager_error)?;

Suggestion:

                    .map_err(|e| StarknetError::internal_with_logging(
                        "Proof manager error",
                        &e)?;

crates/apollo_gateway/src/errors.rs line 478 at r4 (raw file):

        }
    }
}

Why is this method needed?
See my comment below.

Code quote:

pub fn convert_proof_manager_error(err: ProofManagerClientError) -> StarknetError {
    match err {
        ProofManagerClientError::ClientError(client_error) => {
            StarknetError::internal_with_logging("Proof manager client error", &client_error)
        }
        ProofManagerClientError::ProofManagerError(proof_manager_error) => {
            match proof_manager_error {
                ProofManagerError::Client(_) => StarknetError::internal_with_logging(
                    "Proof manager error",
                    &proof_manager_error,
                ),
                ProofManagerError::ProofStorage(_) | ProofManagerError::Io(_) => {
                    StarknetError::internal_with_logging(
                        "Proof manager storage error",
                        &proof_manager_error,
                    )
                }
            }
        }
    }
}

crates/apollo_gateway/src/gateway_test.rs line 282 at r4 (raw file):

    let input_tx = tx_args.get_rpc_tx();
    let expected_internal_tx = tx_args.get_internal_tx();
    if let RpcTransaction::Invoke(RpcInvokeTransaction::V3(ref v3_tx)) = input_tx {

Where can I see that we do the same for declare (and sierra/casm)?
Same question below

Code quote:

 if let RpcTransaction::Invoke(RpcInvokeTransaction::V3(ref v3_tx)) = input_tx {

Copy link
Collaborator

@noaov1 noaov1 left a comment

Choose a reason for hiding this comment

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

@noaov1 made 1 comment.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @einat-starkware).


crates/apollo_gateway/src/gateway.rs line 142 at r4 (raw file):

        // TODO(Einat): Consider moving to `convert_rpc_tx_to_internal_and_executable_txs` function.
        // If a transaction has a proof then we add it to the proof manager.
        if let RpcTransaction::Invoke(RpcInvokeTransaction::V3(ref tx)) = tx {

Please note that we already validated the proof.
It will be better when you will move this to convert_rpc_tx_to_internal_and_executable_txs, this way it will be clearer why we store the proofs (right before we "dump" them)

Code quote:

if let RpcTransaction::Invoke(RpcInvokeTransaction::V3(ref tx)) = tx {

Copy link
Collaborator

@noaov1 noaov1 left a comment

Choose a reason for hiding this comment

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

@noaov1 made 1 comment.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @einat-starkware).


crates/apollo_gateway/src/gateway.rs line 142 at r4 (raw file):

Previously, noaov1 (Noa Oved) wrote…

Please note that we already validated the proof.
It will be better when you will move this to convert_rpc_tx_to_internal_and_executable_txs, this way it will be clearer why we store the proofs (right before we "dump" them)

Note- the gateway code is different from the validators. In the gateway- we validate the proof using the StatelessTransactionValidator while in the batcher (validators) we use ProofValidator. Why?

@einat-starkware einat-starkware force-pushed the einat/proof_manager/use_in_gw branch from 4fb6110 to c70fbc1 Compare January 4, 2026 09:30
@einat-starkware einat-starkware force-pushed the einat/proof_manager/add_to_gw branch from 77fc5f5 to 2eb1fac Compare January 4, 2026 09:30
@einat-starkware einat-starkware changed the base branch from einat/proof_manager/add_to_gw to graphite-base/11141 January 4, 2026 14:58
@einat-starkware einat-starkware force-pushed the einat/proof_manager/use_in_gw branch from c70fbc1 to 4b0a8bf Compare January 5, 2026 12:38
@einat-starkware einat-starkware changed the base branch from graphite-base/11141 to einat/proof_manager/add_to_gw January 5, 2026 12:38
@einat-starkware einat-starkware force-pushed the einat/proof_manager/use_in_gw branch from 4b0a8bf to 40925fa Compare January 5, 2026 14:16
Copy link
Contributor Author

@einat-starkware einat-starkware left a comment

Choose a reason for hiding this comment

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

@einat-starkware made 4 comments.
Reviewable status: 0 of 8 files reviewed, 4 unresolved discussions (waiting on @noaov1).


crates/apollo_gateway/src/errors.rs line 478 at r4 (raw file):

Previously, noaov1 (Noa Oved) wrote…

Why is this method needed?
See my comment below.

Not needed, I now added the error to the transaction converter error enum (as is done by the class manager client error as well).


crates/apollo_gateway/src/gateway.rs line 142 at r4 (raw file):

Previously, noaov1 (Noa Oved) wrote…

Note- the gateway code is different from the validators. In the gateway- we validate the proof using the StatelessTransactionValidator while in the batcher (validators) we use ProofValidator. Why?

Moved directly into the transaction converter's convert_rpc_tx_to_internal_rpc_tx function. In the next PR, I delete the proof validator and add a verify_proof function into the transaction converter.


crates/apollo_gateway/src/gateway_test.rs line 282 at r4 (raw file):

Previously, noaov1 (Noa Oved) wrote…

Where can I see that we do the same for declare (and sierra/casm)?
Same question below

all changes reverted here now that the proof manager is in the transaction converter (test is there instead as well).


crates/apollo_gateway/src/gateway.rs line 148 at r4 (raw file):

                    .set_proof(proof_facts_hash, tx.proof.clone())
                    .await
                    .map_err(convert_proof_manager_error)?;

Deleted the convert_proof_manager_error function entirely :)

@einat-starkware einat-starkware force-pushed the einat/proof_manager/add_to_gw branch from e78f7a2 to 54a1f1b Compare January 5, 2026 14:42
@einat-starkware einat-starkware force-pushed the einat/proof_manager/use_in_gw branch from 40925fa to 2a31748 Compare January 5, 2026 14:42
Copy link
Collaborator

@noaov1 noaov1 left a comment

Choose a reason for hiding this comment

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

@noaov1 reviewed 8 files and all commit messages, made 2 comments, and resolved 4 discussions.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @einat-starkware).


crates/apollo_class_manager_types/src/transaction_converter_test.rs line 64 at r5 (raw file):

#[rstest]
#[tokio::test]
async fn test_proof_manager_called_when_proof_facts_present() {

Can you please add a test case to verify that set_proof is not called in case of an empty proof?

Suggestion:

async fn test_set_proof_called_for_invoke_v3_with_proof_facts() {

crates/apollo_class_manager_types/src/transaction_converter.rs line 210 at r5 (raw file):

                        .set_proof(tx.proof_facts.clone(), tx.proof.clone())
                        .await?;
                }

Please add acomment that at this point we assume the proof has been lready verified.

Code quote:

                if !tx.proof_facts.is_empty() {
                    self.proof_manager_client
                        .set_proof(tx.proof_facts.clone(), tx.proof.clone())
                        .await?;
                }

@einat-starkware einat-starkware changed the base branch from einat/proof_manager/add_to_gw to graphite-base/11141 January 6, 2026 12:34
@einat-starkware einat-starkware force-pushed the einat/proof_manager/use_in_gw branch from 2a31748 to 2a28293 Compare January 6, 2026 12:34
@einat-starkware einat-starkware changed the base branch from graphite-base/11141 to einat/proof_manager/delete_proof_validator January 6, 2026 12:35
Copy link
Contributor Author

@einat-starkware einat-starkware left a comment

Choose a reason for hiding this comment

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

@einat-starkware made 2 comments.
Reviewable status: 6 of 9 files reviewed, 2 unresolved discussions (waiting on @noaov1).


crates/apollo_class_manager_types/src/transaction_converter.rs line 210 at r5 (raw file):

Previously, noaov1 (Noa Oved) wrote…

Please add acomment that at this point we assume the proof has been lready verified.

We no longer assume this (as it gets verified within the new function)


crates/apollo_class_manager_types/src/transaction_converter_test.rs line 64 at r5 (raw file):

Previously, noaov1 (Noa Oved) wrote…

Can you please add a test case to verify that set_proof is not called in case of an empty proof?

Done. Also added to test that set_proof isn't called if the proof already exists.

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.

4 participants