diff --git a/crates/katana/core/src/backend/storage.rs b/crates/katana/core/src/backend/storage.rs
index 06cbb71358..2cc86259bd 100644
--- a/crates/katana/core/src/backend/storage.rs
+++ b/crates/katana/core/src/backend/storage.rs
@@ -146,6 +146,7 @@ mod tests {
use katana_primitives::genesis::Genesis;
use katana_primitives::receipt::{InvokeTxReceipt, Receipt};
use katana_primitives::state::StateUpdatesWithDeclaredClasses;
+ use katana_primitives::trace::TxExecInfo;
use katana_primitives::transaction::{InvokeTx, Tx, TxWithHash};
use katana_primitives::FieldElement;
use katana_provider::providers::in_memory::InMemoryProvider;
@@ -154,7 +155,7 @@ mod tests {
HeaderProvider,
};
use katana_provider::traits::state::StateFactoryProvider;
- use katana_provider::traits::transaction::TransactionProvider;
+ use katana_provider::traits::transaction::{TransactionProvider, TransactionTraceProvider};
use starknet::macros::felt;
use super::Blockchain;
@@ -254,7 +255,7 @@ mod tests {
dummy_block.clone(),
StateUpdatesWithDeclaredClasses::default(),
vec![Receipt::Invoke(InvokeTxReceipt::default())],
- vec![],
+ vec![TxExecInfo::default()],
)
.unwrap();
@@ -310,11 +311,14 @@ mod tests {
.unwrap();
let tx = blockchain.provider().transaction_by_hash(dummy_tx.hash).unwrap().unwrap();
+ let tx_exec =
+ blockchain.provider().transaction_execution(dummy_tx.hash).unwrap().unwrap();
assert_eq!(block_hash, dummy_block.block.header.hash);
assert_eq!(block_number, dummy_block.block.header.header.number);
assert_eq!(block, dummy_block.block.unseal());
assert_eq!(tx, dummy_tx);
+ assert_eq!(tx_exec, TxExecInfo::default());
}
}
}
diff --git a/crates/katana/storage/db/src/tables.rs b/crates/katana/storage/db/src/tables.rs
index 68129d43e0..47a6436791 100644
--- a/crates/katana/storage/db/src/tables.rs
+++ b/crates/katana/storage/db/src/tables.rs
@@ -44,7 +44,7 @@ pub enum TableType {
DupSort,
}
-pub const NUM_TABLES: usize = 22;
+pub const NUM_TABLES: usize = 23;
/// Macro to declare `libmdbx` tables.
#[macro_export]
@@ -153,6 +153,7 @@ define_tables_enum! {[
(TxNumbers, TableType::Table),
(TxBlocks, TableType::Table),
(TxHashes, TableType::Table),
+ (TxTraces, TableType::Table),
(Transactions, TableType::Table),
(Receipts, TableType::Table),
(CompiledClassHashes, TableType::Table),
@@ -189,8 +190,8 @@ tables! {
Transactions: (TxNumber) => Tx,
/// Stores the block number of a transaction.
TxBlocks: (TxNumber) => BlockNumber,
- /// Stores the transaction's execution info.
- TxExecutions: (TxNumber) => TxExecInfo,
+ /// Stores the transaction's traces.
+ TxTraces: (TxNumber) => TxExecInfo,
/// Store transaction receipts
Receipts: (TxNumber) => Receipt,
/// Store compiled classes
@@ -242,20 +243,21 @@ mod tests {
assert_eq!(Tables::ALL[5].name(), TxNumbers::NAME);
assert_eq!(Tables::ALL[6].name(), TxBlocks::NAME);
assert_eq!(Tables::ALL[7].name(), TxHashes::NAME);
- assert_eq!(Tables::ALL[8].name(), Transactions::NAME);
- assert_eq!(Tables::ALL[9].name(), Receipts::NAME);
- assert_eq!(Tables::ALL[10].name(), CompiledClassHashes::NAME);
- assert_eq!(Tables::ALL[11].name(), CompiledClasses::NAME);
- assert_eq!(Tables::ALL[12].name(), SierraClasses::NAME);
- assert_eq!(Tables::ALL[13].name(), ContractInfo::NAME);
- assert_eq!(Tables::ALL[14].name(), ContractStorage::NAME);
- assert_eq!(Tables::ALL[15].name(), ClassDeclarationBlock::NAME);
- assert_eq!(Tables::ALL[16].name(), ClassDeclarations::NAME);
- assert_eq!(Tables::ALL[17].name(), ContractInfoChangeSet::NAME);
- assert_eq!(Tables::ALL[18].name(), NonceChangeHistory::NAME);
- assert_eq!(Tables::ALL[19].name(), ClassChangeHistory::NAME);
- assert_eq!(Tables::ALL[20].name(), StorageChangeHistory::NAME);
- assert_eq!(Tables::ALL[21].name(), StorageChangeSet::NAME);
+ assert_eq!(Tables::ALL[8].name(), TxTraces::NAME);
+ assert_eq!(Tables::ALL[9].name(), Transactions::NAME);
+ assert_eq!(Tables::ALL[10].name(), Receipts::NAME);
+ assert_eq!(Tables::ALL[11].name(), CompiledClassHashes::NAME);
+ assert_eq!(Tables::ALL[12].name(), CompiledClasses::NAME);
+ assert_eq!(Tables::ALL[13].name(), SierraClasses::NAME);
+ assert_eq!(Tables::ALL[14].name(), ContractInfo::NAME);
+ assert_eq!(Tables::ALL[15].name(), ContractStorage::NAME);
+ assert_eq!(Tables::ALL[16].name(), ClassDeclarationBlock::NAME);
+ assert_eq!(Tables::ALL[17].name(), ClassDeclarations::NAME);
+ assert_eq!(Tables::ALL[18].name(), ContractInfoChangeSet::NAME);
+ assert_eq!(Tables::ALL[19].name(), NonceChangeHistory::NAME);
+ assert_eq!(Tables::ALL[20].name(), ClassChangeHistory::NAME);
+ assert_eq!(Tables::ALL[21].name(), StorageChangeHistory::NAME);
+ assert_eq!(Tables::ALL[22].name(), StorageChangeSet::NAME);
assert_eq!(Tables::Headers.table_type(), TableType::Table);
assert_eq!(Tables::BlockHashes.table_type(), TableType::Table);
@@ -265,6 +267,7 @@ mod tests {
assert_eq!(Tables::TxNumbers.table_type(), TableType::Table);
assert_eq!(Tables::TxBlocks.table_type(), TableType::Table);
assert_eq!(Tables::TxHashes.table_type(), TableType::Table);
+ assert_eq!(Tables::TxTraces.table_type(), TableType::Table);
assert_eq!(Tables::Transactions.table_type(), TableType::Table);
assert_eq!(Tables::Receipts.table_type(), TableType::Table);
assert_eq!(Tables::CompiledClassHashes.table_type(), TableType::Table);
diff --git a/crates/katana/storage/provider/src/error.rs b/crates/katana/storage/provider/src/error.rs
index 6fe75d4c6d..531c37dfc9 100644
--- a/crates/katana/storage/provider/src/error.rs
+++ b/crates/katana/storage/provider/src/error.rs
@@ -55,6 +55,10 @@ pub enum ProviderError {
#[error("Missing transaction receipt for tx number {0}")]
MissingTxReceipt(TxNumber),
+ /// Error when a transaction execution info is not found but the transaction exists.
+ #[error("Missing transaction execution for tx number {0}")]
+ MissingTxExecution(TxNumber),
+
/// Error when a compiled class hash is not found but the class hash exists.
#[error("Missing compiled class hash for class hash {0:#x}")]
MissingCompiledClassHash(ClassHash),
diff --git a/crates/katana/storage/provider/src/providers/db/mod.rs b/crates/katana/storage/provider/src/providers/db/mod.rs
index e4687ada22..5421ba7eb7 100644
--- a/crates/katana/storage/provider/src/providers/db/mod.rs
+++ b/crates/katana/storage/provider/src/providers/db/mod.rs
@@ -492,15 +492,40 @@ impl TransactionStatusProvider for DbProvider {
}
impl TransactionTraceProvider for DbProvider {
- fn transaction_execution(&self, _hash: TxHash) -> ProviderResult