Skip to content

Commit

Permalink
feat(rpc): decouple v07 from v06 types and methods
Browse files Browse the repository at this point in the history
  • Loading branch information
t00ts committed Dec 12, 2024
1 parent 531ffc3 commit a0efe02
Showing 1 changed file with 61 additions and 0 deletions.
61 changes: 61 additions & 0 deletions crates/rpc/src/dto/simulation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ use super::serialize::SerializeStruct;
use super::FeeEstimate;
use crate::RpcVersion;

/// A transaction trace.
///
/// This is a wrapper around the transaction trace type from the executor,
/// with added serialization methods.
#[derive(Debug)]
pub struct TransactionTrace {
pub trace: pathfinder_executor::types::TransactionTrace,
Expand Down Expand Up @@ -120,6 +124,10 @@ impl crate::dto::serialize::SerializeForVersion for TransactionTrace {
}
}

/// A function invocation.
///
/// This is a wrapper around the function invocation type from the executor,
/// with added serialization methods.
#[derive(Debug)]
pub(crate) struct FunctionInvocation<'a>(&'a pathfinder_executor::types::FunctionInvocation);

Expand Down Expand Up @@ -192,6 +200,10 @@ impl crate::dto::serialize::SerializeForVersion for FunctionInvocation<'_> {
}
}

/// An event.
///
/// This is a wrapper around the event type from the executor,
/// with added serialization methods.
struct Event<'a>(&'a pathfinder_executor::types::Event);

impl crate::dto::serialize::SerializeForVersion for Event<'_> {
Expand All @@ -215,6 +227,10 @@ impl crate::dto::serialize::SerializeForVersion for Event<'_> {
}
}

/// A message to L1.
///
/// This is a wrapper around the message to L1 type from the executor,
/// with added serialization methods.
struct MsgToL1<'a>(&'a pathfinder_executor::types::MsgToL1);

impl crate::dto::serialize::SerializeForVersion for MsgToL1<'_> {
Expand All @@ -235,6 +251,10 @@ impl crate::dto::serialize::SerializeForVersion for MsgToL1<'_> {
}
}

/// Computation resources.
///
/// This is a wrapper around the computation resources type from the executor,
/// with added serialization methods.
struct ComputationResources<'a>(&'a pathfinder_executor::types::ComputationResources);

impl crate::dto::serialize::SerializeForVersion for ComputationResources<'_> {
Expand Down Expand Up @@ -296,6 +316,10 @@ impl crate::dto::serialize::SerializeForVersion for ComputationResources<'_> {
}
}

/// Inner call execution resources.
///
/// This is a wrapper around the inner call execution resources type from the
/// executor, with added serialization methods.
struct InnerCallExecutionResources<'a>(&'a pathfinder_executor::types::InnerCallExecutionResources);

impl crate::dto::serialize::SerializeForVersion for InnerCallExecutionResources<'_> {
Expand All @@ -310,6 +334,10 @@ impl crate::dto::serialize::SerializeForVersion for InnerCallExecutionResources<
}
}

/// State diff.
///
/// This is a wrapper around the state diff type from the executor,
/// with added serialization methods.
struct StateDiff<'a>(&'a pathfinder_executor::types::StateDiff);

impl crate::dto::serialize::SerializeForVersion for StateDiff<'_> {
Expand Down Expand Up @@ -356,6 +384,10 @@ impl crate::dto::serialize::SerializeForVersion for StateDiff<'_> {
}
}

/// Storage diff.
///
/// This is a wrapper around the storage diff type from the executor,
/// with added serialization methods.
struct StorageDiff<'a>(
(
&'a ContractAddress,
Expand All @@ -379,6 +411,7 @@ impl crate::dto::serialize::SerializeForVersion for StorageDiff<'_> {
}
}

/// Storage entry.
struct StorageEntry<'a>(&'a pathfinder_executor::types::StorageDiff);

impl crate::dto::serialize::SerializeForVersion for StorageEntry<'_> {
Expand All @@ -393,6 +426,10 @@ impl crate::dto::serialize::SerializeForVersion for StorageEntry<'_> {
}
}

/// Declared Sierra class.
///
/// This is a wrapper around the declared Sierra class type from the executor,
/// with added serialization methods.
struct DeclaredSierraClass<'a>(&'a pathfinder_executor::types::DeclaredSierraClass);

impl crate::dto::serialize::SerializeForVersion for DeclaredSierraClass<'_> {
Expand All @@ -410,6 +447,10 @@ impl crate::dto::serialize::SerializeForVersion for DeclaredSierraClass<'_> {
}
}

/// Deployed contract.
///
/// This is a wrapper around the deployed contract type from the executor,
/// with added serialization methods.
struct DeployedContract<'a>(&'a pathfinder_executor::types::DeployedContract);

impl crate::dto::serialize::SerializeForVersion for DeployedContract<'_> {
Expand All @@ -424,6 +465,10 @@ impl crate::dto::serialize::SerializeForVersion for DeployedContract<'_> {
}
}

/// Replaced class.
///
/// This is a wrapper around the replaced class type from the executor,
/// with added serialization methods.
struct ReplacedClass<'a>(&'a pathfinder_executor::types::ReplacedClass);

impl crate::dto::serialize::SerializeForVersion for ReplacedClass<'_> {
Expand All @@ -441,6 +486,10 @@ impl crate::dto::serialize::SerializeForVersion for ReplacedClass<'_> {
}
}

/// Nonce.
///
/// This is a wrapper around the nonce type from the executor,
/// with added serialization methods.
struct Nonce<'a>((&'a ContractAddress, &'a ContractNonce));

impl crate::dto::serialize::SerializeForVersion for Nonce<'_> {
Expand All @@ -455,6 +504,10 @@ impl crate::dto::serialize::SerializeForVersion for Nonce<'_> {
}
}

/// Execution resources.
///
/// This is a wrapper around the execution resources type from the executor,
/// with added serialization methods.
struct ExecutionResources<'a>(&'a pathfinder_executor::types::ExecutionResources);

impl crate::dto::serialize::SerializeForVersion for ExecutionResources<'_> {
Expand Down Expand Up @@ -483,6 +536,10 @@ impl crate::dto::serialize::SerializeForVersion for ExecutionResources<'_> {
}
}

/// Data availability resources.
///
/// This is a wrapper around the data availability resources type from the
/// executor, with added serialization methods.
struct DataAvailabilityResources<'a>(&'a pathfinder_executor::types::DataAvailabilityResources);

impl crate::dto::serialize::SerializeForVersion for DataAvailabilityResources<'_> {
Expand All @@ -497,6 +554,10 @@ impl crate::dto::serialize::SerializeForVersion for DataAvailabilityResources<'_
}
}

/// Execute invocation.
///
/// This is a wrapper around the execute invocation type from the executor,
/// with added serialization methods.
struct ExecuteInvocation<'a>(&'a pathfinder_executor::types::ExecuteInvocation);

impl crate::dto::serialize::SerializeForVersion for ExecuteInvocation<'_> {
Expand Down

0 comments on commit a0efe02

Please sign in to comment.