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(blockifier): add is_legacy method #196

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -180,6 +180,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 @@ -275,15 +279,16 @@ impl FeatureContract {
cairo0_compile(self.get_source_path(), extra_arg, false)
}
CairoVersion::Cairo1 => {
let (tag_override, cargo_nightly_arg) = match self {
Self::LegacyTestContract => (
let (tag_override, cargo_nightly_arg) = if self.is_legacy() {
(
// Legacy contract is designed to test behavior of code compiled with a
// specific (old) compiler tag. To run the (old) compiler, older rust
// version is required.
Some(LEGACY_CONTRACT_COMPILER_TAG.into()),
Some(LEGACY_CONTRACT_RUST_TOOLCHAIN.into()),
),
_ => (None, None),
)
} else {
(None, None)
};
cairo1_compile(self.get_source_path(), tag_override, cargo_nightly_arg)
}
Expand Down
Loading