Skip to content

Commit

Permalink
feat(native_blockifier): support receiving L1 Data Gas (#2343)
Browse files Browse the repository at this point in the history
  • Loading branch information
TzahiTaub authored Dec 10, 2024
1 parent 13080c9 commit da8369d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions crates/blockifier_reexecution/src/state_reader/serde_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ pub fn upper_case_resource_bounds_names(raw_transaction: &mut Value) {
.expect("If tx contains l1_gas, it should contain l2_gas");
resource_bounds.insert("L2_GAS".to_string(), l2_gas_value);
}

if let Some(l1_data_gas_value) = resource_bounds.remove("l1_data_gas") {
resource_bounds.insert("L1_DATA_GAS".to_string(), l1_data_gas_value);
}
}

pub fn deserialize_transaction_json_to_starknet_api_tx(
Expand Down
4 changes: 2 additions & 2 deletions crates/native_blockifier/src/py_transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ impl From<PyResource> for Resource {
fn from(py_resource: PyResource) -> Self {
match py_resource {
PyResource::L1Gas => Resource::L1Gas,
PyResource::L2Gas => Resource::L2Gas,
PyResource::L1DataGas => Resource::L1DataGas,
PyResource::L2Gas => Resource::L2Gas,
}
}
}
Expand All @@ -49,8 +49,8 @@ impl FromPyObject<'_> for PyResource {
let resource_name: &str = resource.getattr("name")?.extract()?;
match resource_name {
"L1_GAS" => Ok(PyResource::L1Gas),
"L2_GAS" => Ok(PyResource::L2Gas),
"L1_DATA_GAS" => Ok(PyResource::L1DataGas),
"L2_GAS" => Ok(PyResource::L2Gas),
_ => Err(PyValueError::new_err(format!("Invalid resource: {resource_name}"))),
}
}
Expand Down

0 comments on commit da8369d

Please sign in to comment.