Skip to content

Commit

Permalink
feat(native_blockifier): allow deserialization of python l1_data_gas
Browse files Browse the repository at this point in the history
  • Loading branch information
nimrod-starkware committed Dec 4, 2024
1 parent 531d008 commit f1e80a8
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions crates/native_blockifier/src/py_transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ pub(crate) const PY_TX_PARSING_ERR: &str = "Failed parsing Py transaction.";
#[derive(Clone, Eq, Ord, PartialEq, PartialOrd)]
pub enum PyResource {
L1Gas,
L1DataGas,
L2Gas,
}

Expand All @@ -38,6 +39,7 @@ impl From<PyResource> for Resource {
match py_resource {
PyResource::L1Gas => Resource::L1Gas,
PyResource::L2Gas => Resource::L2Gas,
PyResource::L1DataGas => Resource::L1DataGas,
}
}
}
Expand All @@ -48,6 +50,7 @@ impl FromPyObject<'_> for PyResource {
match resource_name {
"L1_GAS" => Ok(PyResource::L1Gas),
"L2_GAS" => Ok(PyResource::L2Gas),
"L1_DATA_GAS" => Ok(PyResource::L1DataGas),
_ => Err(PyValueError::new_err(format!("Invalid resource: {resource_name}"))),
}
}
Expand Down

0 comments on commit f1e80a8

Please sign in to comment.