Skip to content

Commit

Permalink
chore(blockifier): add is_legacy method
Browse files Browse the repository at this point in the history
  • Loading branch information
dorimedini-starkware committed Aug 1, 2024
1 parent 8ad0c34 commit 08a4c7a
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions crates/blockifier/src/test_utils/contracts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,10 @@ impl FeatureContract {
}
}

pub fn is_legacy(&self) -> bool {
matches!(self, Self::LegacyTestContract)
}

/// Unique integer representing each unique contract. Used to derive "class hash" and "address".
fn get_integer_base(self) -> u32 {
self.get_cairo_version_bit()
Expand Down Expand Up @@ -280,15 +284,16 @@ impl FeatureContract {
cairo0_compile(self.get_source_path(), extra_arg, false)
}
CairoVersion::Cairo1 => {
let (tag_override, force_nightly_version) = match self {
Self::LegacyTestContract => (
let (tag_override, force_nightly_version) = if self.is_legacy() {
(
// Legacy contract requires specific compiler tag (which is the point of
// the test contract), + to build the compiler an
// older rust version is required.
Some(LEGACY_CONTRACT_COMPILER_TAG.into()),
Some(String::from("2023-07-05")),
),
_ => (None, None),
)
} else {
(None, None)
};
cairo1_compile(self.get_source_path(), tag_override, force_nightly_version)
}
Expand Down

0 comments on commit 08a4c7a

Please sign in to comment.