Skip to content

Commit 7935667

Browse files
committed
wip
1 parent 9118f6e commit 7935667

File tree

3 files changed

+1
-106
lines changed

3 files changed

+1
-106
lines changed

crates/rpc/rpc-server/src/cartridge/mod.rs

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -184,35 +184,6 @@ where
184184
) -> Result<AddInvokeTransactionResponse, CartridgeApiError> {
185185
debug!(%contract_address, ?outside_execution, "Adding execute outside transaction.");
186186
self.on_cpu_blocking_task(move |this| async move {
187-
let pm_address = this.controller_deployer_address;
188-
let pm_private_key = this.controller_deployer_private_key;
189-
190-
// // ====================== CONTROLLER DEPLOYMENT ======================
191-
// let state = this.state()?;
192-
// let is_controller_deployed =
193-
// state.class_hash_of_contract(contract_address)?.is_some();
194-
195-
// if !is_controller_deployed {
196-
// debug!(controller = %contract_address, "Controller not yet deployed");
197-
198-
// let deploy_tx = craft_deploy_cartridge_controller_tx(
199-
// &this.api_client,
200-
// contract_address,
201-
// pm_address,
202-
// pm_private_key,
203-
// this.backend.chain_spec.id(),
204-
// this.nonce(pm_address)?.unwrap_or_default(),
205-
// )
206-
// .await?;
207-
208-
// if let Some(tx) = deploy_tx {
209-
// debug!(controller = %contract_address, tx = format!("{:#x}", tx.hash),
210-
// "Inserting Controller deployment transaction"); this.pool.
211-
// add_transaction(tx).await?; this.block_producer.force_mine();
212-
// }
213-
// }
214-
// // ===================================================================
215-
216187
let entry_point_selector = outside_execution.selector();
217188
let mut calldata = outside_execution.as_felts();
218189
calldata.extend(signature.clone());

crates/rpc/rpc-server/src/middleware/cartridge.rs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,6 @@ where
4848
vrf_service: Option<VrfService>,
4949
}
5050

51-
impl<Pool, PoolTx, PP, PF> ControllerDeployment<Pool, PP, PF>
52-
where
53-
Pool: TransactionPool<Transaction = PoolTx> + Send + Sync + 'static,
54-
PoolTx: From<BroadcastedTxWithChainId>,
55-
PP: PendingBlockProvider,
56-
PF: ProviderFactory,
57-
<PF as ProviderFactory>::Provider: ProviderRO,
58-
{
59-
}
60-
6151
#[derive(Debug, Clone)]
6252
pub struct ControllerDeploymentService<S, Pool, PP, PF>
6353
where
@@ -190,7 +180,7 @@ where
190180

191181
// None means the address is not of a Controller
192182
if let Some(tx) = deploy_tx {
193-
if let Err(e) = self.inner.starknet.add_invoke_tx(tx).await {
183+
if let Err(e) = self.starknet.add_invoke_tx(tx).await {
194184
return Err(CartridgeApiError::ControllerDeployment {
195185
reason: format!("failed to submit deployment tx: {e}"),
196186
});

crates/rpc/rpc-server/src/starknet/read.rs

Lines changed: 0 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -180,72 +180,6 @@ where
180180
.with_account_validation(should_validate)
181181
.with_nonce_check(false);
182182

183-
// Hook the estimate fee to pre-deploy the controller contract
184-
// and enhance UX on the client side.
185-
// Refer to the `handle_cartridge_controller_deploy` function in `cartridge.rs`
186-
// for more details.
187-
#[cfg(feature = "cartridge")]
188-
let transactions = if let Some(paymaster) = &self.inner.config.paymaster {
189-
use std::sync::Arc;
190-
191-
let paymaster_address = paymaster.paymaster_address;
192-
let paymaster_private_key = paymaster.paymaster_private_key;
193-
194-
let state =
195-
self.storage().provider().latest().map(Arc::new).map_err(StarknetApiError::from)?;
196-
197-
let mut ctrl_deploy_txs = Vec::new();
198-
199-
// Check if any of the transactions are sent from an address associated with a Cartridge
200-
// Controller account. If yes, we craft a Controller deployment transaction
201-
// for each of the unique sender and push it at the beginning of the
202-
// transaction list so that all the requested transactions are executed against a state
203-
// with the Controller accounts deployed.
204-
205-
let paymaster_nonce = match self.nonce_at(block_id, paymaster_address).await {
206-
Ok(nonce) => nonce,
207-
Err(err) => match err {
208-
StarknetApiError::ContractNotFound => {
209-
return Err(StarknetApiError::unexpected(
210-
"Cartridge paymaster account doesn't exist",
211-
)
212-
.into());
213-
}
214-
_ => return Err(ErrorObjectOwned::from(err)),
215-
},
216-
};
217-
218-
for tx in &transactions {
219-
let api = ::cartridge::CartridgeApiClient::new(paymaster.cartridge_api_url.clone());
220-
221-
let deploy_controller_tx =
222-
cartridge::get_controller_deploy_tx_if_controller_address(
223-
paymaster_address,
224-
paymaster_private_key,
225-
paymaster_nonce,
226-
tx,
227-
self.inner.chain_spec.id(),
228-
state.clone(),
229-
&api,
230-
)
231-
.await
232-
.map_err(StarknetApiError::from)?;
233-
234-
if let Some(tx) = deploy_controller_tx {
235-
ctrl_deploy_txs.push(tx);
236-
}
237-
}
238-
239-
if !ctrl_deploy_txs.is_empty() {
240-
ctrl_deploy_txs.extend(transactions);
241-
ctrl_deploy_txs
242-
} else {
243-
transactions
244-
}
245-
} else {
246-
transactions
247-
};
248-
249183
let permit =
250184
self.inner.estimate_fee_permit.acquire().await.map_err(|e| {
251185
StarknetApiError::unexpected(format!("Failed to acquire permit: {e}"))

0 commit comments

Comments
 (0)