Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

native_blockifier: Allow querying for Blockifier version. #1249

Merged
merged 1 commit into from
Jan 7, 2024
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
10 changes: 10 additions & 0 deletions crates/native_blockifier/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,19 @@ fn native_blockifier(py: Python<'_>, py_module: &PyModule) -> PyResult<()> {
py_module.add("UndeclaredClassHashError", py.get_type::<UndeclaredClassHashError>())?;
add_py_exceptions(py, py_module)?;

py_module.add_function(wrap_pyfunction!(blockifier_version, py)?)?;

// TODO(Dori, 1/4/2023): If and when supported in the Python build environment, gate this code
// with #[cfg(test)].
py_module.add_function(wrap_pyfunction!(raise_error_for_testing, py)?)?;

Ok(())
}

/// Returns the version that the `blockifier` and `native_blockifier` crates were built with.
// Assumption: both `blockifier` and `native_blockifier` use `version.workspace` in the package
// section of their `Cargo.toml`.
#[pyfunction]
pub fn blockifier_version() -> PyResult<String> {
Ok(env!("CARGO_PKG_VERSION").to_string())
}
Loading