Skip to content

Commit

Permalink
fix: SPS Feature (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
akhercha authored Oct 27, 2024
1 parent 99411f5 commit 29adb62
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 17 deletions.
2 changes: 1 addition & 1 deletion config/devnet.madara.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ report:

deployer:
salt: "0x42"
address: "0x021ae26856dbb24032cac6bba14a776741331dc031f0dc43efb5f333e6a64da2"
address: "0x055be462e718c4166d656d11f89e341115b8bc82389c3762a10eade04fcb225d"
signing_key: "0x077e56c6dc32d40a67f6f7e6625c8dc5e570abe49c0a24e9202e4ae906abcc07"
legacy_account: false
29 changes: 13 additions & 16 deletions src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ use lazy_static::lazy_static;

use starknet::core::types::Felt;
use starknet::core::types::{
BlockId, BlockWithTxs, ComputationResources, DataAvailabilityResources, DataResources,
ExecutionResources, ExecutionResult, MaybePendingBlockWithTxs, StarknetError,
BlockId, BlockWithTxs, ExecutionResources, ExecutionResult, MaybePendingBlockWithTxs,
StarknetError,
};
use starknet::providers::ProviderError;
use starknet::providers::{jsonrpc::HttpTransport, JsonRpcClient, Provider};
Expand Down Expand Up @@ -164,29 +164,26 @@ pub async fn get_blocks_with_txs(

#[cfg(feature = "with_sps")]
for tx in block_with_txs.transactions.iter() {
let maybe_receipt = starknet_rpc
let receipt_with_block_info = starknet_rpc
.get_transaction_receipt(tx.transaction_hash())
.await?;

use starknet::core::types::TransactionReceipt as TR;

let resource = match maybe_receipt {
Receipt(receipt) => match receipt {
TR::Invoke(receipt) => receipt.execution_resources,
TR::L1Handler(receipt) => receipt.execution_resources,
TR::Declare(receipt) => receipt.execution_resources,
TR::Deploy(receipt) => receipt.execution_resources,
TR::DeployAccount(receipt) => receipt.execution_resources,
},
PendingReceipt(pending) => {
bail!("Transaction should not be pending. Pending: {pending:?}");
}
let resource = match receipt_with_block_info.receipt {
TR::Invoke(receipt) => receipt.execution_resources,
TR::L1Handler(receipt) => receipt.execution_resources,
TR::Declare(receipt) => receipt.execution_resources,
TR::Deploy(receipt) => receipt.execution_resources,
TR::DeployAccount(receipt) => receipt.execution_resources,
};

resources.push(resource);
}

#[cfg(not(feature = "with_sps"))]
for _ in block_with_txs.transactions.iter() {
use starknet::core::types::{
ComputationResources, DataAvailabilityResources, DataResources,
};
resources.push(ExecutionResources {
computation_resources: ComputationResources {
steps: 0,
Expand Down

0 comments on commit 29adb62

Please sign in to comment.