Skip to content

Commit 33ba948

Browse files
central_systest_blobs: implement invoke from deploy function for code sharing
1 parent ee6a2fa commit 33ba948

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
@@ -564,41 +564,20 @@ impl BlobFactory {
564564
contract_address
565565
}
566566

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

0 commit comments

Comments
 (0)