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

chore: create try from referance of casm contract class method #910

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

Conversation

ArniStarkware
Copy link
Contributor

@ArniStarkware ArniStarkware commented Sep 22, 2024

This change is Reviewable

Copy link
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @ArniStarkware and the rest of your teammates on Graphite Graphite

Copy link

codecov bot commented Sep 22, 2024

Codecov Report

Attention: Patch coverage is 79.00000% with 21 lines in your changes missing coverage. Please review.

Project coverage is 74.21%. Comparing base (f68bd90) to head (4f149cc).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
crates/blockifier/src/execution/contract_class.rs 79.79% 15 Missing and 5 partials ⚠️
crates/blockifier/src/transaction/transactions.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #910      +/-   ##
==========================================
+ Coverage   74.18%   74.21%   +0.02%     
==========================================
  Files         359      359              
  Lines       36240    36274      +34     
  Branches    36240    36274      +34     
==========================================
+ Hits        26884    26920      +36     
- Misses       7220     7222       +2     
+ Partials     2136     2132       -4     
Flag Coverage Δ
74.21% <79.00%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@ArniStarkware ArniStarkware marked this pull request as ready for review September 22, 2024 08:46
Copy link
Contributor Author

@ArniStarkware ArniStarkware 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: 0 of 4 files reviewed, 1 unresolved discussion


crates/blockifier/src/execution/contract_class.rs line 447 at r1 (raw file):

        )
    }
}

This is a new code.
This is the goal of this PR.

Code quote:

impl TryFrom<&CasmContractClass> for ContractClassV1 {
    type Error = ProgramError;

    fn try_from(class: &CasmContractClass) -> Result<Self, Self::Error> {
        try_from_casm_contrcat_class_internal(
            &class.bytecode,
            &class.hints,
            &class.entry_points_by_type,
            class.bytecode_segment_lengths.clone(),
            &class.compiler_version,
        )
    }
}

crates/blockifier/src/execution/contract_class.rs line 458 at r1 (raw file):

    sn_api_to_cairo_vm_program(deprecated_program)
        .map_err(|err| DeserializationError::custom(err.to_string()))
}

This is not a new code. This is only an artifact of the diff showing the body of the new function (try_from_casm_contrcat_class_internal) as the body of impl TryFrom<CasmContractClass> for ContractClassV1

Code quote:

// V0 utilities.

/// Converts the program type from SN API into a Cairo VM-compatible type.
pub fn deserialize_program<'de, D: Deserializer<'de>>(
    deserializer: D,
) -> Result<Program, D::Error> {
    let deprecated_program = DeprecatedProgram::deserialize(deserializer)?;
    sn_api_to_cairo_vm_program(deprecated_program)
        .map_err(|err| DeserializationError::custom(err.to_string()))
}

@ArniStarkware ArniStarkware force-pushed the arni/executable_tx_in_gateway/contract_class_convertor/convertor_from_ref branch from 604fede to 4f149cc Compare September 22, 2024 10:59
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.

1 participant