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

feat(native_blockifier): support receiving L1 Data Gas #2343

Merged
Merged
Show file tree
Hide file tree
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
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
Loading