Skip to content

Commit

Permalink
Change l1_gas, l2_gas to L1_GAS, L2_GAS
Browse files Browse the repository at this point in the history
  • Loading branch information
Pedro Fontana authored and Pedro Fontana committed Jun 10, 2024
1 parent 203c0dd commit 412e6fe
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
4 changes: 2 additions & 2 deletions rpc-state-reader/src/blockifier_state_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,9 +273,9 @@ pub fn execute_tx(
};

(
// Change charge_fee: true
// TODO Change charge_fee: true
blockifier_tx
.execute(&mut state, &block_context, false, true)
.execute(&mut state, &block_context, true, true)
.unwrap(),
trace,
receipt,
Expand Down
15 changes: 13 additions & 2 deletions rpc-state-reader/src/rpc_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use cairo_vm::vm::runners::{
use core::fmt;
use dotenv::dotenv;
use serde::{Deserialize, Deserializer};
use serde_json::json;
use serde_json::{json, Value};
use starknet::core::types::ContractClass as SNContractClass;
use starknet_api::{
block::{BlockNumber, BlockTimestamp},
Expand Down Expand Up @@ -407,7 +407,7 @@ impl RpcState {

/// Requests the given transaction to the Feeder Gateway API.
pub fn get_transaction(&self, hash: &TransactionHash) -> Result<SNTransaction, RpcStateError> {
let result = self
let mut result = self
.rpc_call::<serde_json::Value>(
"starknet_getTransactionByHash",
&json!([hash.to_string()]),
Expand All @@ -416,6 +416,17 @@ impl RpcState {
.ok_or(RpcStateError::MissingRpcResponseField("result".into()))?
.clone();

if let Some(resource_bounds) = result.get_mut("resource_bounds") {
if let Some(l1_gas) = resource_bounds.get_mut("l1_gas") {
resource_bounds["L1_GAS"] = l1_gas.clone();
resource_bounds.as_object_mut().unwrap().remove("l1_gas");
}
if let Some(l2_gas) = resource_bounds.get_mut("l2_gas") {
resource_bounds["L2_GAS"] = l2_gas.clone();
resource_bounds.as_object_mut().unwrap().remove("l2_gas");
}
}

utils::deserialize_transaction_json(result).map_err(RpcStateError::SerdeJson)
}

Expand Down

0 comments on commit 412e6fe

Please sign in to comment.