Skip to content

Commit a4f23ab

Browse files
committed
wip
1 parent 5e9d551 commit a4f23ab

File tree

7 files changed

+31
-30
lines changed

7 files changed

+31
-30
lines changed

Cargo.lock

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/gateway/gateway-server/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ version.workspace = true
88
[dependencies]
99
katana-gateway-types.workspace = true
1010
katana-primitives.workspace = true
11+
katana-executor.workspace = true
12+
katana-core.workspace = true
1113
katana-metrics.workspace = true
1214
katana-rpc.workspace = true
1315
katana-pool-api.workspace = true

crates/gateway/gateway-server/src/handlers.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ use axum::extract::{Query, State};
22
use axum::http::StatusCode;
33
use axum::response::{IntoResponse, Json, Response};
44
use katana_core::service::block_producer::BlockProducer;
5+
use katana_executor::implementation::blockifier::BlockifierFactory;
56
use katana_gateway_types::{
67
Block, ConfirmedReceipt, ConfirmedTransaction, ContractClass, ErrorCode, GatewayError,
78
ReceiptBody, StateUpdate, StateUpdateWithBlock,

crates/gateway/gateway-server/src/lib.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use std::time::Duration;
55
use axum::routing::get;
66
use axum::Router;
77
use katana_core::service::block_producer::BlockProducer;
8+
use katana_executor::implementation::blockifier::BlockifierFactory;
89
use katana_pool_api::TransactionPool;
910
use katana_rpc::cors::Cors;
1011
use katana_rpc::starknet::StarknetApi;
@@ -83,9 +84,7 @@ where
8384
Pool: TransactionPool + Clone + Send + Sync + 'static,
8485
{
8586
/// Create a new feeder gateway server.
86-
pub fn new(
87-
starknet_api: StarknetApi<Pool, BlockProducer<BlockifierFactory>>,
88-
<P>) -> Self {
87+
pub fn new(starknet_api: StarknetApi<Pool, BlockProducer<BlockifierFactory>>) -> Self {
8988
Self {
9089
timeout: DEFAULT_GATEWAY_TIMEOUT,
9190
cors: None,

crates/node/src/full/pending/provider.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ use katana_rpc_types::RpcTxWithHash;
88

99
use crate::full::pending::PreconfStateFactory;
1010

11-
impl<P: StateFactoryProvider + Debug> PendingBlockProvider for PreconfStateFactory<P> {
11+
impl<P> PendingBlockProvider for PreconfStateFactory<P>
12+
where
13+
P: StateFactoryProvider + Debug + 'static,
14+
{
1215
fn get_pending_block_with_txs(
1316
&self,
1417
) -> StarknetApiResult<Option<katana_rpc_types::PreConfirmedBlockWithTxs>> {
@@ -114,4 +117,11 @@ impl<P: StateFactoryProvider + Debug> PendingBlockProvider for PreconfStateFacto
114117
fn pending_state(&self) -> StarknetApiResult<Option<Box<dyn StateProvider>>> {
115118
Ok(Some(Box::new(self.state())))
116119
}
120+
121+
fn get_pending_trace(
122+
&self,
123+
hash: TxHash,
124+
) -> StarknetApiResult<Option<katana_rpc_types::TxTrace>> {
125+
Ok(None)
126+
}
117127
}

crates/rpc/rpc/src/starknet/mod.rs

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -544,14 +544,7 @@ where
544544
{
545545
Result::<_, StarknetApiError>::Ok(pending_tx)
546546
} else {
547-
let tx = this
548-
.inner
549-
.backend
550-
.blockchain
551-
.provider()
552-
.transaction_by_hash(hash)?
553-
.map(RpcTxWithHash::from);
554-
547+
let tx = this.inner.storage.transaction_by_hash(hash)?.map(RpcTxWithHash::from);
555548
Result::<_, StarknetApiError>::Ok(tx)
556549
}
557550
})
@@ -574,7 +567,7 @@ where
574567
{
575568
StarknetApiResult::Ok(pending_receipt)
576569
} else {
577-
let provider = this.inner.backend.blockchain.provider();
570+
let provider = &this.inner.storage;
578571
StarknetApiResult::Ok(ReceiptBuilder::new(hash, provider).build()?)
579572
}
580573
})
@@ -662,11 +655,9 @@ where
662655
.build()?
663656
.map(MaybePreConfirmedBlock::Confirmed);
664657

665-
StarknetApiResult::Ok(block)
666-
} else {
667-
StarknetApiResult::Ok(None)
668-
}
669-
}
658+
StarknetApiResult::Ok(block)
659+
} else {
660+
StarknetApiResult::Ok(None)
670661
}
671662
})
672663
.await??;
@@ -701,11 +692,9 @@ where
701692
.build_with_receipts()?
702693
.map(GetBlockWithReceiptsResponse::Block);
703694

704-
StarknetApiResult::Ok(block)
705-
} else {
706-
StarknetApiResult::Ok(None)
707-
}
708-
}
695+
StarknetApiResult::Ok(block)
696+
} else {
697+
StarknetApiResult::Ok(None)
709698
}
710699
})
711700
.await??;
@@ -740,11 +729,9 @@ where
740729
.build_with_tx_hash()?
741730
.map(GetBlockWithTxHashesResponse::Block);
742731

743-
StarknetApiResult::Ok(block)
744-
} else {
745-
StarknetApiResult::Ok(None)
746-
}
747-
}
732+
StarknetApiResult::Ok(block)
733+
} else {
734+
StarknetApiResult::Ok(None)
748735
}
749736
})
750737
.await??;

crates/rpc/rpc/src/starknet/trace.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,8 @@ where
156156
Ok(pending_trace)
157157
} else {
158158
// If not found in pending block, fallback to the provider
159-
let provider = self.inner.backend.blockchain.provider();
160-
let trace = provider.transaction_execution(tx_hash)?.ok_or(TxnHashNotFound)?;
159+
let trace =
160+
self.inner.storage.transaction_execution(tx_hash)?.ok_or(TxnHashNotFound)?;
161161
Ok(TxTrace::from(trace))
162162
}
163163
}

0 commit comments

Comments
 (0)