Skip to content
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

refactor(papyrus_rpc): get compiled class #2493

Merged

Conversation

AvivYossef-starkware
Copy link
Contributor

No description provided.

@reviewable-StarkWare
Copy link

This change is Reviewable

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.

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


crates/papyrus_rpc/src/v0_8/api/api_impl.rs line 1478 at r1 (raw file):

                    .sierra_program,
            )
            .unwrap();

why panic here? shouldn't you return an RpcError if the sierra version is unavailable?

Code quote:

.unwrap();

Copy link
Contributor

@Yael-Starkware Yael-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, 2 unresolved discussions (waiting on @AvivYossef-starkware and @dorimedini-starkware)


crates/papyrus_rpc/src/v0_8/api/api_impl.rs line 1478 at r1 (raw file):

Previously, dorimedini-starkware wrote…

why panic here? shouldn't you return an RpcError if the sierra version is unavailable?

Doesn't this error fails the declare transaction in the gateway?


crates/papyrus_rpc/src/v0_8/api/api_impl.rs line 1475 at r1 (raw file):

                    .get_class(&class_hash)
                    .map_err(internal_server_error)?
                    .ok_or_else(|| ErrorObjectOwned::from(CLASS_HASH_NOT_FOUND))?

does it make sense that the casm exists in storage and the sierra doesn't?
I think this scenario indicates a bug.

Code quote:

ErrorObjectOwned::from(CLASS_HASH_NOT_FOUND)

@AvivYossef-starkware AvivYossef-starkware force-pushed the aviv/add_sierra_version_to_papyrus_cache branch from d1ec273 to b638c90 Compare December 8, 2024 09:17
@AvivYossef-starkware AvivYossef-starkware force-pushed the aviv/refactor_papyrus_rpc_get_contract_class branch from eb75d10 to 3072566 Compare December 8, 2024 09: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: 3 of 4 files reviewed, 2 unresolved discussions (waiting on @dorimedini-starkware and @Yael-Starkware)


crates/papyrus_rpc/src/v0_8/api/api_impl.rs line 1475 at r1 (raw file):

Previously, Yael-Starkware (YaelD) wrote…

does it make sense that the casm exists in storage and the sierra doesn't?
I think this scenario indicates a bug.

Right, Now the get_sierra_and_casm returns an error if Sierra Xor Casm exist in the server`s storage


crates/papyrus_rpc/src/v0_8/api/api_impl.rs line 1478 at r1 (raw file):

Previously, Yael-Starkware (YaelD) wrote…

Doesn't this error fails the declare transaction in the gateway?

It should fail because it indicates that the Sierra program is invalid. I think that the internal server error is ok since it indicates we have saved an invalid Sierra program on our server.

@AvivYossef-starkware AvivYossef-starkware force-pushed the aviv/add_sierra_version_to_papyrus_cache branch from b638c90 to 9c10db4 Compare December 8, 2024 09:29
@AvivYossef-starkware AvivYossef-starkware force-pushed the aviv/refactor_papyrus_rpc_get_contract_class branch from 3072566 to 850fcd1 Compare December 8, 2024 09:29
@AvivYossef-starkware AvivYossef-starkware force-pushed the aviv/add_sierra_version_to_papyrus_cache branch from 9c10db4 to 3f30869 Compare December 8, 2024 09:37
@AvivYossef-starkware AvivYossef-starkware force-pushed the aviv/refactor_papyrus_rpc_get_contract_class branch from 850fcd1 to df92693 Compare December 8, 2024 09:37
@AvivYossef-starkware AvivYossef-starkware force-pushed the aviv/add_sierra_version_to_papyrus_cache branch from 3f30869 to 9c1e654 Compare December 8, 2024 11:07
@AvivYossef-starkware AvivYossef-starkware force-pushed the aviv/refactor_papyrus_rpc_get_contract_class branch from df92693 to 0aa221d Compare December 8, 2024 11:08
@AvivYossef-starkware AvivYossef-starkware force-pushed the aviv/add_sierra_version_to_papyrus_cache branch from 9c1e654 to 4068cd0 Compare December 8, 2024 11:34
@AvivYossef-starkware AvivYossef-starkware force-pushed the aviv/refactor_papyrus_rpc_get_contract_class branch from 0aa221d to f0b5b45 Compare December 8, 2024 11:34
Copy link

codecov bot commented Dec 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (aviv/add_sierra_version_to_papyrus_cache@9e86221). Learn more about missing BASE report.

Additional details and impacted files
@@                             Coverage Diff                             @@
##             aviv/add_sierra_version_to_papyrus_cache    #2493   +/-   ##
===========================================================================
  Coverage                                            ?   47.89%           
===========================================================================
  Files                                               ?      187           
  Lines                                               ?    23007           
  Branches                                            ?    23007           
===========================================================================
  Hits                                                ?    11020           
  Misses                                              ?    10886           
  Partials                                            ?     1101           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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.

Reviewed 1 of 1 files at r2, 1 of 1 files at r3, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @Yael-Starkware)

Copy link
Contributor

@Yael-Starkware Yael-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)

@AvivYossef-starkware AvivYossef-starkware force-pushed the aviv/add_sierra_version_to_papyrus_cache branch from 4068cd0 to f1edf4a Compare December 9, 2024 11:16
@AvivYossef-starkware AvivYossef-starkware force-pushed the aviv/refactor_papyrus_rpc_get_contract_class branch from f0b5b45 to 5f97fd9 Compare December 9, 2024 11:16
@AvivYossef-starkware AvivYossef-starkware force-pushed the aviv/add_sierra_version_to_papyrus_cache branch from f1edf4a to a4c372e Compare December 10, 2024 07:36
@AvivYossef-starkware AvivYossef-starkware force-pushed the aviv/refactor_papyrus_rpc_get_contract_class branch from 5f97fd9 to 2f6028a Compare December 10, 2024 07:36
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.

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


crates/papyrus_rpc/src/v0_8/api/api_impl.rs line 1473 at r4 (raw file):

            // Check if both options are `Some`.
            let (casm, sierra) = option_casm
                .zip(option_sierra)

it's logic like this that makes me think returning Option<(X, Y)> is better than returning (Option<X>, Option<Y>). this is not possible, since the storage layer can return one None and one Some?

Code quote:

            let (option_casm, option_sierra) = storage_txn
                .get_casm_and_sierra(&class_hash)
                .map_err(internal_server_error_with_msg)?;

            // Check if both options are `Some`.
            let (casm, sierra) = option_casm
                .zip(option_sierra)

@AvivYossef-starkware AvivYossef-starkware force-pushed the aviv/add_sierra_version_to_papyrus_cache branch from a4c372e to fd89b79 Compare December 10, 2024 08:24
@AvivYossef-starkware AvivYossef-starkware force-pushed the aviv/refactor_papyrus_rpc_get_contract_class branch from 2f6028a to 36e2342 Compare December 10, 2024 08:24
@AvivYossef-starkware AvivYossef-starkware force-pushed the aviv/add_sierra_version_to_papyrus_cache branch from fd89b79 to d7a28ec Compare December 10, 2024 08:28
@AvivYossef-starkware AvivYossef-starkware force-pushed the aviv/refactor_papyrus_rpc_get_contract_class branch from cc83787 to 53e73f8 Compare December 15, 2024 07:41
@AvivYossef-starkware AvivYossef-starkware force-pushed the aviv/add_sierra_version_to_papyrus_cache branch from 9e86221 to 31b9b09 Compare December 15, 2024 09:13
@AvivYossef-starkware AvivYossef-starkware force-pushed the aviv/refactor_papyrus_rpc_get_contract_class branch from 53e73f8 to e488534 Compare December 15, 2024 09:13
@AvivYossef-starkware AvivYossef-starkware force-pushed the aviv/add_sierra_version_to_papyrus_cache branch from 31b9b09 to 1d07618 Compare December 15, 2024 11:43
@AvivYossef-starkware AvivYossef-starkware force-pushed the aviv/refactor_papyrus_rpc_get_contract_class branch from e488534 to 13bef90 Compare December 15, 2024 11:43
@AvivYossef-starkware AvivYossef-starkware force-pushed the aviv/add_sierra_version_to_papyrus_cache branch from 1d07618 to ea4ebab Compare December 15, 2024 12:33
@AvivYossef-starkware AvivYossef-starkware force-pushed the aviv/refactor_papyrus_rpc_get_contract_class branch from 13bef90 to 998c0ba Compare December 15, 2024 12:34
@AvivYossef-starkware AvivYossef-starkware force-pushed the aviv/add_sierra_version_to_papyrus_cache branch from ea4ebab to 2674f68 Compare December 15, 2024 14:05
@AvivYossef-starkware AvivYossef-starkware force-pushed the aviv/refactor_papyrus_rpc_get_contract_class branch from 998c0ba to 348f11c Compare December 15, 2024 14:05
@AvivYossef-starkware AvivYossef-starkware force-pushed the aviv/add_sierra_version_to_papyrus_cache branch from 2674f68 to 0646db2 Compare December 15, 2024 15:28
@AvivYossef-starkware AvivYossef-starkware force-pushed the aviv/refactor_papyrus_rpc_get_contract_class branch from 348f11c to 5a28773 Compare December 15, 2024 15:28
@AvivYossef-starkware AvivYossef-starkware force-pushed the aviv/add_sierra_version_to_papyrus_cache branch from 0646db2 to 168ae5f Compare December 15, 2024 18:11
@AvivYossef-starkware AvivYossef-starkware force-pushed the aviv/refactor_papyrus_rpc_get_contract_class branch from 5a28773 to fd172ca Compare December 15, 2024 18:11
@AvivYossef-starkware AvivYossef-starkware force-pushed the aviv/add_sierra_version_to_papyrus_cache branch 2 times, most recently from 49cc29a to 476a794 Compare December 15, 2024 19:03
@AvivYossef-starkware AvivYossef-starkware force-pushed the aviv/refactor_papyrus_rpc_get_contract_class branch from fd172ca to c1a5904 Compare December 15, 2024 19:03
@AvivYossef-starkware AvivYossef-starkware changed the base branch from aviv/add_sierra_version_to_papyrus_cache to graphite-base/2493 December 15, 2024 19:33
@AvivYossef-starkware AvivYossef-starkware changed the base branch from graphite-base/2493 to main December 15, 2024 19:33
@AvivYossef-starkware AvivYossef-starkware force-pushed the aviv/refactor_papyrus_rpc_get_contract_class branch from c1a5904 to 7efc710 Compare December 15, 2024 19:33
@AvivYossef-starkware AvivYossef-starkware force-pushed the aviv/refactor_papyrus_rpc_get_contract_class branch from 7efc710 to 3fe6ead Compare December 15, 2024 19:34
Copy link

Artifacts upload workflows:

@AvivYossef-starkware AvivYossef-starkware merged commit d062b7a into main Dec 15, 2024
14 checks passed
Copy link
Contributor Author

Merge activity

  • Dec 15, 3:06 PM EST: A user merged this pull request with Graphite.

@github-actions github-actions bot locked and limited conversation to collaborators Dec 17, 2024
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