Skip to content

Commit

Permalink
fix(native_blockifier): convert sierra version from None
Browse files Browse the repository at this point in the history
  • Loading branch information
amosStarkware committed Jan 2, 2025
1 parent 6384cea commit 86f4b52
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
5 changes: 2 additions & 3 deletions crates/native_blockifier/src/py_transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ pub struct PyClassInfo {
raw_contract_class: String,
sierra_program_length: usize,
abi_length: usize,
sierra_version: (u64, u64, u64),
sierra_version: Option<(u64, u64, u64)>,
}

impl PyClassInfo {
Expand All @@ -184,13 +184,12 @@ impl PyClassInfo {
SierraVersion::from(py_class_info.sierra_version),
)),
};
let (major, minor, patch) = py_class_info.sierra_version;

let class_info = ClassInfo::new(
&contract_class,
py_class_info.sierra_program_length,
py_class_info.abi_length,
SierraVersion::new(major, minor, patch),
SierraVersion::from(py_class_info.sierra_version),
)?;
Ok(class_info)
}
Expand Down
9 changes: 6 additions & 3 deletions crates/starknet_api/src/contract_class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,12 @@ impl FromStr for SierraVersion {
}
}

impl From<(u64, u64, u64)> for SierraVersion {
fn from((major, minor, patch): (u64, u64, u64)) -> Self {
Self::new(major, minor, patch)
impl From<Option<(u64, u64, u64)>> for SierraVersion {
fn from(optional_sierra_version: Option<(u64, u64, u64)>) -> Self {
match optional_sierra_version {
Some((major, minor, patch)) => Self::new(major, minor, patch),
None => Self::DEPRECATED,
}
}
}

Expand Down

0 comments on commit 86f4b52

Please sign in to comment.