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

fix(starknet_class_manager): embed class-not-found flow in Option return type #4030

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

elintul
Copy link
Collaborator

@elintul elintul commented Feb 9, 2025

Instead of an error variant. For two reasons:

  1. Option is easier to streamline through abstraction layers; there are quire a few of those in the class manager E2E flow.
  2. A class not found flow might be expected at times, it's more idiomatic to leave the decision of how to handle this to the caller, who has more context.

@reviewable-StarkWare
Copy link

This change is Reviewable

@elintul elintul force-pushed the elin/class-manager/class-not-found-as-option branch 5 times, most recently from aa6f23d to 21b2e63 Compare February 9, 2025 10:42
Copy link
Contributor

@ShahakShama ShahakShama left a comment

Choose a reason for hiding this comment

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

Reviewed 8 of 15 files at r1.
Reviewable status: 8 of 15 files reviewed, 3 unresolved discussions (waiting on @AlonLStarkWare, @noamsp-starkware, and @yair-starkware)


crates/papyrus_p2p_sync/src/server/test.rs line 486 at r1 (raw file):

                .expect_get_sierra()
                .with(eq(class_hash))
                .returning(|_| Ok(Some(contract_class.clone())));

Could you add a TODO on me to test the flow where it returns None


crates/starknet_gateway/src/sync_state_reader_test.rs line 195 at r1 (raw file):

        .with(predicate::eq(class_hash))
        .returning(move |_| {
            Ok(Some(ContractClass::V1((casm_contract_class.clone(), SierraVersion::default()))))

Could you add a TODO on me to test the flow where it returns None


crates/starknet_batcher/src/reader_with_class_manager_test.rs line 132 at r1 (raw file):

        .with(predicate::eq(class_hash))
        .returning(move |_| {
            Ok(Some(ContractClass::V1((casm_contract_class.clone(), SierraVersion::default()))))

Could you add a TODO on me to test the flow where it returns None

@elintul elintul force-pushed the elin/class-manager/class-not-found-as-option branch from 21b2e63 to 0228d29 Compare February 9, 2025 11:47
…eturn type

Instead of an error variant. For two reasons:
1. `Option` is easier to streamline through abstraction layers; there
   are quire a few of those in the class manager E2E flow.
2. A class not found flow might be expected at times, it's more
   idiomatic to leave the decision of how to handle this to the caller,
   who has more context.
@elintul elintul force-pushed the elin/class-manager/class-not-found-as-option branch from 0228d29 to a275e6a Compare February 9, 2025 13:36
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.

3 participants