Skip to content
This repository has been archived by the owner on Aug 2, 2024. It is now read-only.

Commit

Permalink
Add TraceTransaction RPC call implementation (#1455)
Browse files Browse the repository at this point in the history
Co-authored-by: Timothée Delabrouille <34384633+tdelabro@users.noreply.github.com>
Co-authored-by: apoorvsadana <95699312+apoorvsadana@users.noreply.github.com>
  • Loading branch information
3 people authored Apr 8, 2024
1 parent 0d664aa commit 7d3ba01
Show file tree
Hide file tree
Showing 12 changed files with 599 additions and 330 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
- refacto: reusable Eth client config for settlement/DA/other tasks
- ci: add gomu gomu no gatling perfomrance test
- feat(runtime): moved StarkEvents from Substrate
- feat(rpc/trace_api): add `trace_transaction`

## v0.7.0

Expand Down
17 changes: 16 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ Thanks goes to these wonderful people
<tr>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/antiyro"><img src="https://avatars.githubusercontent.com/u/74653697?v=4?s=100" width="100px;" alt="antiyro"/><br /><sub><b>antiyro</b></sub></a><br /><a href="https://github.com/keep-starknet-strange/madara/commits?author=antiyro" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/azurwastaken"><img src="https://avatars.githubusercontent.com/u/30268138?v=4?s=100" width="100px;" alt="azurwastaken"/><br /><sub><b>azurwastaken</b></sub></a><br /><a href="https://github.com/keep-starknet-strange/madara/commits?author=azurwastaken" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Tbelleng"><img src="https://avatars.githubusercontent.com/u/117627242?v=4?s=100" width="100px;" alt="Tbelleng"/><br /><sub><b>Tbelleng</b></sub></a><br /><a href="https://github.com/keep-starknet-strange/madara/commits?author=Tbelleng" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/hhamud"><img src="https://avatars.githubusercontent.com/u/53880692?v=4?s=100" width="100px;" alt="hhamud"/><br /><sub><b>Hamza Hamud</b></sub></a><br /><a href="https://github.com/keep-starknet-strange/madara/commits?author=hhamud" title="Code">💻</a></td>
</tr>
</tbody>
Expand Down
6 changes: 5 additions & 1 deletion crates/client/rpc-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use starknet_core::types::{
DeployAccountTransactionResult, EventFilterWithPage, EventsPage, FeeEstimate, FieldElement, FunctionCall,
InvokeTransactionResult, MaybePendingBlockWithTxHashes, MaybePendingBlockWithTxs, MaybePendingStateUpdate,
MaybePendingTransactionReceipt, MsgFromL1, SimulatedTransaction, SimulationFlag, SyncStatusType, Transaction,
TransactionTraceWithHash,
TransactionTrace, TransactionTraceWithHash,
};

#[serde_as]
Expand Down Expand Up @@ -183,4 +183,8 @@ pub trait StarknetTraceRpcApi {
#[method(name = "traceBlockTransactions")]
/// Returns the execution traces of all transactions included in the given block
async fn trace_block_transactions(&self, block_id: BlockId) -> RpcResult<Vec<TransactionTraceWithHash>>;

#[method(name = "traceTransaction")]
/// Returns the execution trace of a transaction
async fn trace_transaction(&self, transaction_hash: FieldElement) -> RpcResult<TransactionTrace>;
}
7 changes: 6 additions & 1 deletion crates/client/rpc/src/starknetrpcwrapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use starknet_core::types::{
DeployAccountTransactionResult, EventFilterWithPage, EventsPage, FeeEstimate, FieldElement, FunctionCall,
InvokeTransactionResult, MaybePendingBlockWithTxHashes, MaybePendingBlockWithTxs, MaybePendingStateUpdate,
MaybePendingTransactionReceipt, MsgFromL1, SimulatedTransaction, SimulationFlag, SyncStatusType, Transaction,
TransactionTraceWithHash,
TransactionTrace, TransactionTraceWithHash,
};

use crate::Starknet;
Expand Down Expand Up @@ -620,4 +620,9 @@ where
async fn trace_block_transactions(&self, block_id: BlockId) -> RpcResult<Vec<TransactionTraceWithHash>> {
self.0.trace_block_transactions(block_id).await
}

/// Returns the executions traces of a specified transaction in the given block
async fn trace_transaction(&self, transaction_hash: FieldElement) -> RpcResult<TransactionTrace> {
self.0.trace_transaction(transaction_hash).await
}
}
Loading

0 comments on commit 7d3ba01

Please sign in to comment.