Skip to content

Commit 3996872

Browse files
central_systest_blobs: implement invoke from deploy function for code sharing
1 parent 1728354 commit 3996872

1 file changed

Lines changed: 35 additions & 27 deletions

File tree

crates/central_systest_blobs/src/cende_blob_regression_test.rs

Lines changed: 35 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -566,41 +566,20 @@ impl BlobFactory {
566566
contract_address
567567
}
568568

569-
fn make_operator_deploy_tx(
569+
fn make_operator_invoke_tx(
570570
&mut self,
571-
contract_to_deploy: FeatureContract,
572-
constructor_calldata: Calldata,
571+
address: ContractAddress,
572+
function_name: &str,
573+
calldata: &[Felt],
573574
with_fee_charge: bool,
574-
) -> ContractAddress {
575-
let class_hash = contract_to_deploy.get_sierra().calculate_class_hash();
576-
let contract_address_salt = ContractAddressSalt::default();
577-
let contract_address = calculate_contract_address(
578-
contract_address_salt,
579-
class_hash,
580-
&constructor_calldata,
581-
*OPERATOR_ADDRESS,
582-
)
583-
.unwrap();
575+
) {
584576
let nonce = self.nonce_manager.next(*OPERATOR_ADDRESS);
585577
let resource_bounds = if with_fee_charge {
586578
*NON_TRIVIAL_RESOURCE_BOUNDS
587579
} else {
588580
AllResourceBounds::new_unlimited_gas_no_fee_enforcement()
589581
};
590-
let calldata = Self::single_multicall_data(
591-
*OPERATOR_ADDRESS,
592-
"deploy_contract",
593-
&[
594-
vec![
595-
*class_hash,
596-
contract_address_salt.0,
597-
Felt::from(constructor_calldata.0.len()),
598-
],
599-
constructor_calldata.0.as_slice().to_vec(),
600-
vec![false.into()], // Deploy from zero.
601-
]
602-
.concat(),
603-
);
582+
let calldata = Self::single_multicall_data(address, function_name, calldata);
604583
let rpc_tx_unsigned = InternalRpcInvokeTransactionV3 {
605584
sender_address: *OPERATOR_ADDRESS,
606585
calldata,
@@ -629,6 +608,35 @@ impl BlobFactory {
629608
tx_hash,
630609
});
631610
self.next_txs.push((executable.into(), internal));
611+
}
612+
613+
fn make_operator_deploy_tx(
614+
&mut self,
615+
contract_to_deploy: FeatureContract,
616+
constructor_calldata: Calldata,
617+
with_fee_charge: bool,
618+
) -> ContractAddress {
619+
let class_hash = contract_to_deploy.get_sierra().calculate_class_hash();
620+
let contract_address_salt = ContractAddressSalt::default();
621+
let contract_address = calculate_contract_address(
622+
contract_address_salt,
623+
class_hash,
624+
&constructor_calldata,
625+
*OPERATOR_ADDRESS,
626+
)
627+
.unwrap();
628+
let calldata = [
629+
vec![*class_hash, contract_address_salt.0, Felt::from(constructor_calldata.0.len())],
630+
constructor_calldata.0.as_slice().to_vec(),
631+
vec![false.into()], // Deploy from zero.
632+
]
633+
.concat();
634+
self.make_operator_invoke_tx(
635+
*OPERATOR_ADDRESS,
636+
"deploy_contract",
637+
&calldata,
638+
with_fee_charge,
639+
);
632640
contract_address
633641
}
634642

0 commit comments

Comments
 (0)