Skip to content
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
2 changes: 1 addition & 1 deletion crates/apollo_consensus_orchestrator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,4 @@ serde_json.workspace = true
workspace = true

[features]
testing = []
testing = ["shared_execution_objects/deserialize", "shared_execution_objects/testing"]
16 changes: 16 additions & 0 deletions crates/apollo_consensus_orchestrator/src/cende/central_objects.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ mod central_objects_test;

/// Subset of BouncerWeights sent to the centralized pipeline.
/// Excludes `receipt_l2_gas` which is only used internally by the decentralized sequencer.
#[cfg_attr(any(feature = "testing", test), derive(serde::Deserialize))]
#[derive(Clone, Debug, PartialEq, Serialize)]
pub(crate) struct CentralBouncerWeights {
pub l1_gas: usize,
Expand Down Expand Up @@ -91,12 +92,14 @@ pub(crate) type CentralCasmContractClassEntry = (CompiledClassHash, CentralCasmC
pub(crate) type CentralCasmHashComputationData = CasmHashComputationData;
pub(crate) type CentralCompiledClassHashesForMigration = CompiledClassHashesForMigration;

#[cfg_attr(any(feature = "testing", test), derive(serde::Deserialize))]
#[derive(Clone, Debug, PartialEq, Serialize)]
struct CentralResourcePrice {
price_in_wei: NonzeroGasPrice,
price_in_fri: NonzeroGasPrice,
}

#[cfg_attr(any(feature = "testing", test), derive(serde::Deserialize))]
#[derive(Clone, Debug, PartialEq, Serialize)]
pub(crate) struct CentralBlockInfo {
block_number: BlockNumber,
Expand Down Expand Up @@ -133,6 +136,7 @@ impl From<(BlockInfo, StarknetVersion)> for CentralBlockInfo {
}
}

#[cfg_attr(any(feature = "testing", test), derive(serde::Deserialize))]
#[derive(Debug, PartialEq, Serialize)]
pub(crate) struct CentralStateDiff {
address_to_class_hash: IndexMap<ContractAddress, ClassHash>,
Expand Down Expand Up @@ -178,6 +182,7 @@ impl From<(CommitmentStateDiff, CentralBlockInfo)> for CentralStateDiff {
}
}

#[cfg_attr(any(feature = "testing", test), derive(serde::Deserialize))]
#[derive(Debug, PartialEq, Serialize)]
struct CentralResourceBounds {
#[serde(rename = "L1_GAS")]
Expand All @@ -198,6 +203,7 @@ impl From<AllResourceBounds> for CentralResourceBounds {
}
}

#[cfg_attr(any(feature = "testing", test), derive(serde::Deserialize))]
#[derive(Debug, PartialEq, Serialize)]
struct CentralInvokeTransactionV3 {
resource_bounds: CentralResourceBounds,
Expand Down Expand Up @@ -236,13 +242,15 @@ impl From<(InternalRpcInvokeTransactionV3, TransactionHash)> for CentralInvokeTr
}
}

#[cfg_attr(any(feature = "testing", test), derive(serde::Deserialize))]
#[derive(Debug, PartialEq, Serialize)]
#[serde(tag = "version")]
enum CentralInvokeTransaction {
#[serde(rename = "0x3")]
V3(CentralInvokeTransactionV3),
}

#[cfg_attr(any(feature = "testing", test), derive(serde::Deserialize))]
#[derive(Debug, PartialEq, Serialize)]
struct CentralDeployAccountTransactionV3 {
resource_bounds: CentralResourceBounds,
Expand Down Expand Up @@ -285,6 +293,7 @@ impl From<(InternalRpcDeployAccountTransaction, TransactionHash)>
}
}

#[cfg_attr(any(feature = "testing", test), derive(serde::Deserialize))]
#[derive(Debug, PartialEq, Serialize)]
#[serde(tag = "version")]
enum CentralDeployAccountTransaction {
Expand All @@ -296,6 +305,7 @@ fn into_string_tuple(val: SierraVersion) -> (String, String, String) {
(format!("0x{:x}", val.major), format!("0x{:x}", val.minor), format!("0x{:x}", val.patch))
}

#[cfg_attr(any(feature = "testing", test), derive(serde::Deserialize))]
#[derive(Debug, PartialEq, Serialize)]
struct CentralDeclareTransactionV3 {
resource_bounds: CentralResourceBounds,
Expand Down Expand Up @@ -349,13 +359,15 @@ impl TryFrom<(InternalRpcDeclareTransactionV3, &SierraContractClass, Transaction
}
}

#[cfg_attr(any(feature = "testing", test), derive(serde::Deserialize))]
#[derive(Debug, PartialEq, Serialize)]
#[serde(tag = "version")]
enum CentralDeclareTransaction {
#[serde(rename = "0x3")]
V3(CentralDeclareTransactionV3),
}

#[cfg_attr(any(feature = "testing", test), derive(serde::Deserialize))]
#[derive(Debug, PartialEq, Serialize)]
struct CentralL1HandlerTransaction {
contract_address: ContractAddress,
Expand All @@ -379,6 +391,7 @@ impl From<L1HandlerTransaction> for CentralL1HandlerTransaction {
}
}

#[cfg_attr(any(feature = "testing", test), derive(serde::Deserialize))]
#[derive(Debug, PartialEq, Serialize)]
#[serde(tag = "type")]
enum CentralTransaction {
Expand Down Expand Up @@ -427,6 +440,7 @@ impl TryFrom<(InternalConsensusTransaction, Option<&SierraContractClass>)> for C
}
}

#[cfg_attr(any(feature = "testing", test), derive(serde::Deserialize))]
#[derive(Debug, PartialEq, Serialize)]
pub(crate) struct CentralTransactionWritten {
tx: CentralTransaction,
Expand All @@ -449,11 +463,13 @@ impl TryFrom<(InternalConsensusTransaction, Option<&SierraContractClass>, u64)>
})
}
}
#[cfg_attr(any(feature = "testing", test), derive(serde::Deserialize))]
#[derive(Clone, Debug, PartialEq, Serialize)]
pub(crate) struct CentralSierraContractClass {
contract_class: SierraContractClass,
}

#[cfg_attr(any(feature = "testing", test), derive(serde::Deserialize))]
#[derive(Clone, Debug, PartialEq, Serialize)]
pub(crate) struct CentralCasmContractClass {
compiled_class: CasmContractClass,
Expand Down
1 change: 1 addition & 0 deletions crates/apollo_consensus_orchestrator/src/cende/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ pub(crate) const N_BLOCK_HASHES_BACK_IN_BLOB: u64 = STORED_BLOCK_HASH_BUFFER;
pub type CendeAmbassadorResult<T> = Result<T, CendeAmbassadorError>;

/// A chunk of all the data to write to Aersopike.
#[cfg_attr(any(feature = "testing", test), derive(Deserialize, PartialEq))]
#[derive(Debug, Serialize)]
pub struct AerospikeBlob {
block_number: BlockNumber,
Expand Down
1 change: 1 addition & 0 deletions crates/apollo_consensus_orchestrator/src/fee_market/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ mod test;
const MIN_GAS_PRICE_INCREASE_DENOMINATOR: u128 = 333;

/// Fee market information for the next block.
#[cfg_attr(any(feature = "testing", test), derive(serde::Deserialize, PartialEq))]
#[derive(Debug, Default, Serialize)]
pub struct FeeMarketInfo {
/// Total gas consumed in the current block.
Expand Down
1 change: 1 addition & 0 deletions crates/shared_execution_objects/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ description = "Python-compatible representation of execution objects of the Star

[features]
deserialize = ["blockifier/transaction_serde"]
testing = []

[dependencies]
blockifier.workspace = true
Expand Down
1 change: 1 addition & 0 deletions crates/shared_execution_objects/src/central_objects.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ impl From<TransactionReceipt> for ResourcesMapping {

/// The TransactionExecutionInfo object as used by the Python code.
#[cfg_attr(feature = "deserialize", derive(serde::Deserialize))]
#[cfg_attr(feature = "testing", derive(PartialEq))]
#[derive(Debug, Serialize)]
pub struct CentralTransactionExecutionInfo {
pub validate_call_info: Option<CallInfo>,
Expand Down
Loading