diff --git a/crates/sequencing/papyrus_consensus_orchestrator/resources/central_declare_tx.json b/crates/sequencing/papyrus_consensus_orchestrator/resources/central_declare_tx.json index 9ac7afb452..ad690decfe 100644 --- a/crates/sequencing/papyrus_consensus_orchestrator/resources/central_declare_tx.json +++ b/crates/sequencing/papyrus_consensus_orchestrator/resources/central_declare_tx.json @@ -16,7 +16,7 @@ "max_amount": "0x0", "max_price_per_unit": "0x0" }, - "L1_DATA": { + "L1_DATA_GAS": { "max_amount": "0x0", "max_price_per_unit": "0x0" } diff --git a/crates/sequencing/papyrus_consensus_orchestrator/resources/central_deploy_account_tx.json b/crates/sequencing/papyrus_consensus_orchestrator/resources/central_deploy_account_tx.json index 5e0af08468..66c942e883 100644 --- a/crates/sequencing/papyrus_consensus_orchestrator/resources/central_deploy_account_tx.json +++ b/crates/sequencing/papyrus_consensus_orchestrator/resources/central_deploy_account_tx.json @@ -16,7 +16,7 @@ "max_amount": "0x0", "max_price_per_unit": "0x0" }, - "L1_DATA": { + "L1_DATA_GAS": { "max_amount": "0x0", "max_price_per_unit": "0x0" } diff --git a/crates/sequencing/papyrus_consensus_orchestrator/resources/central_invoke_tx.json b/crates/sequencing/papyrus_consensus_orchestrator/resources/central_invoke_tx.json index 392c384477..f16f338317 100644 --- a/crates/sequencing/papyrus_consensus_orchestrator/resources/central_invoke_tx.json +++ b/crates/sequencing/papyrus_consensus_orchestrator/resources/central_invoke_tx.json @@ -16,7 +16,7 @@ "max_amount": "0x0", "max_price_per_unit": "0x0" }, - "L1_DATA": { + "L1_DATA_GAS": { "max_amount": "0x0", "max_price_per_unit": "0x0" } diff --git a/crates/sequencing/papyrus_consensus_orchestrator/src/cende/central_objects.rs b/crates/sequencing/papyrus_consensus_orchestrator/src/cende/central_objects.rs index ef24b25a2e..97756e4257 100644 --- a/crates/sequencing/papyrus_consensus_orchestrator/src/cende/central_objects.rs +++ b/crates/sequencing/papyrus_consensus_orchestrator/src/cende/central_objects.rs @@ -32,6 +32,7 @@ use starknet_api::transaction::fields::{ ContractAddressSalt, Fee, PaymasterData, + ResourceBounds, Tip, TransactionSignature, ValidResourceBounds, @@ -114,14 +115,37 @@ impl From<(ThinStateDiff, BlockInfo, StarknetVersion)> for CentralStateDiff { } } +#[derive(Debug, PartialEq, Serialize)] +pub struct CentralResourceBounds { + #[serde(rename = "L1_GAS")] + pub l1_gas: ResourceBounds, + #[serde(rename = "L2_GAS")] + pub l2_gas: ResourceBounds, + #[serde(rename = "L1_DATA_GAS")] + pub l1_data_gas: ResourceBounds, +} + +impl From for CentralResourceBounds { + fn from(resource_bounds: ValidResourceBounds) -> CentralResourceBounds { + match resource_bounds { + ValidResourceBounds::AllResources(resource_bounds) => CentralResourceBounds { + l1_gas: resource_bounds.l1_gas, + l2_gas: resource_bounds.l2_gas, + l1_data_gas: resource_bounds.l1_data_gas, + }, + _ => panic!("Transaction should be V3"), + } + } +} + +// TODO(Yael): organize the fields of transactions in the same order. #[derive(Debug, PartialEq, Serialize)] pub struct CentralInvokeTransactionV3 { pub sender_address: ContractAddress, pub calldata: Calldata, pub signature: TransactionSignature, pub nonce: Nonce, - // TODO(yael): Consider defining a type for resource_bounds that matches the python object. - pub resource_bounds: ValidResourceBounds, + pub resource_bounds: CentralResourceBounds, pub tip: Tip, pub paymaster_data: PaymasterData, pub account_deployment_data: AccountDeploymentData, @@ -138,7 +162,7 @@ impl From for CentralInvokeTransactionV3 { calldata: tx.calldata(), signature: tx.signature(), nonce: tx.nonce(), - resource_bounds: tx.resource_bounds(), + resource_bounds: tx.resource_bounds().into(), tip: tx.tip(), paymaster_data: tx.paymaster_data(), account_deployment_data: tx.account_deployment_data(), @@ -158,7 +182,7 @@ pub enum CentralInvokeTransaction { #[derive(Debug, PartialEq, Serialize)] pub struct CentralDeployAccountTransactionV3 { - pub resource_bounds: ValidResourceBounds, + pub resource_bounds: CentralResourceBounds, pub tip: Tip, pub signature: TransactionSignature, pub nonce: Nonce, @@ -175,7 +199,7 @@ pub struct CentralDeployAccountTransactionV3 { impl From for CentralDeployAccountTransactionV3 { fn from(tx: DeployAccountTransaction) -> CentralDeployAccountTransactionV3 { CentralDeployAccountTransactionV3 { - resource_bounds: tx.resource_bounds(), + resource_bounds: tx.resource_bounds().into(), tip: tx.tip(), signature: tx.signature(), nonce: tx.nonce(), @@ -204,7 +228,7 @@ fn into_string_tuple(val: SierraVersion) -> (String, String, String) { #[derive(Debug, PartialEq, Serialize)] pub struct CentralDeclareTransactionV3 { - pub resource_bounds: ValidResourceBounds, + pub resource_bounds: CentralResourceBounds, pub tip: Tip, pub signature: TransactionSignature, pub nonce: Nonce, @@ -224,7 +248,7 @@ pub struct CentralDeclareTransactionV3 { impl From for CentralDeclareTransactionV3 { fn from(tx: DeclareTransaction) -> CentralDeclareTransactionV3 { CentralDeclareTransactionV3 { - resource_bounds: tx.resource_bounds(), + resource_bounds: tx.resource_bounds().into(), tip: tx.tip(), signature: tx.signature(), nonce: tx.nonce(),