diff --git a/rpc-state-reader/src/blockifier_state_reader.rs b/rpc-state-reader/src/blockifier_state_reader.rs index 59124bb..564d407 100644 --- a/rpc-state-reader/src/blockifier_state_reader.rs +++ b/rpc-state-reader/src/blockifier_state_reader.rs @@ -637,8 +637,6 @@ mod tests { // Impl conversion for easier checking against RPC data impl From<&CallInfo> for RpcCallInfo { fn from(value: &CallInfo) -> Self { - dbg!("Msgs num: {}", &value.execution.l2_to_l1_messages); - Self { retdata: Some(value.execution.retdata.0.clone()), calldata: Some((*value.call.calldata.0).clone()), @@ -646,12 +644,12 @@ mod tests { // We don't have the revert reason string in the trace so we just make sure it doesn't revert revert_reason: value.execution.failed.then_some("Default String".into()), events: value.execution.events.iter().map(|e| e.into()).collect(), - // l2_l1_messages: value - // .execution - // .l2_to_l1_messages - // .iter() - // .map(|llm| llm.into()) - // .collect(), + messages: value + .execution + .l2_to_l1_messages + .iter() + .map(|llm| llm.into()) + .collect(), } } } diff --git a/rpc-state-reader/src/rpc_state.rs b/rpc-state-reader/src/rpc_state.rs index 8815463..7f566da 100644 --- a/rpc-state-reader/src/rpc_state.rs +++ b/rpc-state-reader/src/rpc_state.rs @@ -20,7 +20,10 @@ use starknet_api::{ core::{ChainId, ClassHash, ContractAddress, EthAddress}, hash::{StarkFelt, StarkHash}, state::StorageKey, - transaction::{EventContent, EventData, EventKey, L2ToL1Payload, Transaction as SNTransaction, TransactionHash}, + transaction::{ + EventData, EventKey, L2ToL1Payload, Transaction as SNTransaction, + TransactionHash, + }, }; use std::{collections::HashMap, env, fmt::Display, num::NonZeroU128}; @@ -127,7 +130,7 @@ impl From<&OrderedEvent> for Event { Self { order: value.order, keys: value.event.keys.clone(), - data: value.event.data.clone() + data: value.event.data.clone(), } } } @@ -205,7 +208,7 @@ pub struct RpcCallInfo { pub internal_calls: Vec, pub revert_reason: Option, pub events: Vec, - // pub l2_l1_messages: Option>, + pub messages: Vec, } #[derive(Debug, Deserialize)] @@ -353,24 +356,23 @@ impl<'de> Deserialize<'de> for RpcCallInfo { for event in events_value.as_array().ok_or(serde::de::Error::custom( RpcStateError::RpcResponseWrongType("events".to_string()), ))? { - dbg!(event); events.push(serde_json::from_value(event.clone()).map_err(serde::de::Error::custom)?) } - // let msg_l1_l2_value = value - // .get("l2_l1_messages") - // .ok_or(serde::de::Error::custom( - // RpcStateError::MissingRpcResponseField("l2_l1_messages".to_string()), - // ))? - // .clone(); - // let mut l2_l1_messages = vec![]; - - // for msg in msg_l1_l2_value.as_array().ok_or(serde::de::Error::custom( - // RpcStateError::RpcResponseWrongType("l2_l1_messages".to_string()), - // ))? { - // l2_l1_messages - // .push(serde_json::from_value(msg.clone()).map_err(serde::de::Error::custom)?) - // } + let messages_value = value + .get("messages") + .ok_or(serde::de::Error::custom( + RpcStateError::MissingRpcResponseField("messages".to_string()), + ))? + .clone(); + let mut messages = vec![]; + + for msg in messages_value.as_array().ok_or(serde::de::Error::custom( + RpcStateError::RpcResponseWrongType("messages".to_string()), + ))? { + messages + .push(serde_json::from_value(msg.clone()).map_err(serde::de::Error::custom)?) + } Ok(RpcCallInfo { retdata, @@ -378,7 +380,7 @@ impl<'de> Deserialize<'de> for RpcCallInfo { internal_calls, revert_reason: None, events, - // l2_l1_messages: l2_l1_messages, + messages, }) } }