-
Notifications
You must be signed in to change notification settings - Fork 65
apollo_gateway: only set proofs if they have passed tx validation in gateway #11703
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
a5e3eb3 to
fff30ff
Compare
cca3adc to
8cfb0ad
Compare
8cfb0ad to
715551a
Compare
fff30ff to
4abd5b2
Compare
715551a to
f1a914d
Compare
einat-starkware
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@einat-starkware made 1 comment.
Reviewable status: 0 of 5 files reviewed, 1 unresolved discussion (waiting on @meship-starkware and @noaov1).
crates/apollo_class_manager_types/src/transaction_converter_test.rs line 125 at r2 (raw file):
#[rstest] #[tokio::test] async fn test_proof_verification_skipped_when_proof_already_exists() {
I removed this test because set_proof wouldn't be called anyways after moving it to the gateway so it doesn't check anything
f1a914d to
6465d80
Compare
|
Suggestion: .expect_set_proof(invoke_tx.proof_facts.clone(), invoke_tx.proof.clone())
.once()
.with(eq(...)); // If it is easy (i.e., this part of the comment is non-blocking),
// please add to the expectation the expected input to this call of `set_proof`). |
|
Why here and not in the constructor of Code quote: let proof_manager_client: Arc<dyn ProofManagerClient> =
Arc::new(self.mock_proof_manager_client);
let pmc = proof_manager_client.clone();
self.mock_transaction_converter
.expect_get_proof_manager_client()
.returning(move || pmc.clone()); |
|
why clone? Code quote: proof_manager_client.clone(), |
|
Please move this logic into Code quote: convert_rpc_tx_to_internal_rpc_tx |
|
Previously, ArniStarkware (Arnon Hod) wrote…
I don't want this logic in there as that function also gets called in the gateway (where I don't want to write until after the validations in the gateway have passed). |
6465d80 to
dafa059
Compare
einat-starkware
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@einat-starkware made 3 comments.
Reviewable status: 0 of 5 files reviewed, 5 unresolved discussions (waiting on @ArniStarkware, @meship-starkware, and @noaov1).
crates/apollo_gateway/src/gateway.rs line 273 at r3 (raw file):
Previously, ArniStarkware (Arnon Hod) wrote…
why clone?
An accidental leftover from an earlier version of the PR, removed now :)
crates/apollo_gateway/src/gateway_test.rs line 171 at r3 (raw file):
Previously, ArniStarkware (Arnon Hod) wrote…
Why here and not in the constructor of
MockDependencies?
It needs to be here I believe so that the mock_proof_manager_client is accessible in the tests (so I can check that it gets called).
crates/apollo_gateway/src/gateway_test.rs line 319 at r3 (raw file):
if !invoke_tx.proof_facts.is_empty() { mock_dependencies .expect_set_proof(invoke_tx.proof_facts.clone(), invoke_tx.proof.clone());
This is already done in the inner function that this function is a wrapper for :)
|
Previously, einat-starkware wrote…
Please try moving it into |
ArniStarkware
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ArniStarkware made 1 comment and resolved 1 discussion.
Reviewable status: 0 of 5 files reviewed, 4 unresolved discussions (waiting on @einat-starkware, @meship-starkware, and @noaov1).
crates/apollo_gateway/src/gateway_test.rs line 319 at r3 (raw file):
Previously, einat-starkware wrote…
This is already done in the inner function that this function is a wrapper for :)
I don't understand. If this is already done, why do it here?
this = expect_set_proof.
|
Previously, einat-starkware wrote…
In that case, please define a new function: |
dafa059 to
9f8d4d9
Compare
einat-starkware
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@einat-starkware made 3 comments.
Reviewable status: 0 of 5 files reviewed, 4 unresolved discussions (waiting on @ArniStarkware, @meship-starkware, and @noaov1).
crates/apollo_class_manager_types/src/transaction_converter.rs line 161 at r3 (raw file):
Previously, ArniStarkware (Arnon Hod) wrote…
In that case, please define a new function:
extract_proof_and_convert_rpc_tx_to_internal_rpc_tx
Done.
crates/apollo_gateway/src/gateway_test.rs line 171 at r3 (raw file):
Previously, ArniStarkware (Arnon Hod) wrote…
Please try moving it into
#[fixture] fn mock_dependencies() -> MockDependencies {
I can't figure out how to do this while also keeping the check that I call set_proof for V3 invoke transactions with proof facts (which is what I actually want to test). I believe it's because I extract the proof manager client from the transaction converter using get_proof_manager_client() which gives me a clone of the original and then I can't set expectations for the clone. If you have an idea how to get around this let me know.
crates/apollo_gateway/src/gateway_test.rs line 319 at r3 (raw file):
Previously, ArniStarkware (Arnon Hod) wrote…
I don't understand. If this is already done, why do it here?
this =
expect_set_proof.
I defined mock_dependencies.expect_set_prooffollowing the pattern of the mempool client's expect_add_tx
9f8d4d9 to
8fc057f
Compare
einat-starkware
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@einat-starkware made 1 comment.
Reviewable status: 0 of 5 files reviewed, 4 unresolved discussions (waiting on @ArniStarkware, @meship-starkware, and @noaov1).
crates/apollo_gateway/src/gateway_test.rs line 171 at r3 (raw file):
Previously, einat-starkware wrote…
I can't figure out how to do this while also keeping the check that I call
set_prooffor V3 invoke transactions with proof facts (which is what I actually want to test). I believe it's because I extract the proof manager client from the transaction converter usingget_proof_manager_client()which gives me a clone of the original and then I can't set expectations for the clone. If you have an idea how to get around this let me know.
Added as a TODO for now
|
Previously, einat-starkware wrote…
Unblocking, |
ArniStarkware
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ArniStarkware made 1 comment and resolved 2 discussions.
Reviewable status: 0 of 5 files reviewed, 2 unresolved discussions (waiting on @einat-starkware, @meship-starkware, and @noaov1).

No description provided.