chore: rename trace handler functions (#1731)

This commit is contained in:
Matthias Seitz
2023-03-13 13:44:43 +01:00
committed by GitHub
parent a98dc43cb0
commit 102a5a378f
3 changed files with 35 additions and 21 deletions

View File

@ -12,7 +12,7 @@ use std::collections::HashSet;
pub trait TraceApi {
/// Executes the given call and returns a number of possible traces for it.
#[method(name = "trace_call")]
async fn call(
async fn trace_call(
&self,
call: CallRequest,
trace_types: HashSet<TraceType>,
@ -23,7 +23,7 @@ pub trait TraceApi {
/// on top of a pending block with all n-1 transactions applied (traced) first. Allows to trace
/// dependent transactions.
#[method(name = "trace_callMany")]
async fn call_many(
async fn trace_call_many(
&self,
calls: Vec<(CallRequest, HashSet<TraceType>)>,
block_id: Option<BlockId>,
@ -33,7 +33,7 @@ pub trait TraceApi {
///
/// Expects a raw transaction data
#[method(name = "trace_rawTransaction")]
async fn raw_transaction(
async fn trace_raw_transaction(
&self,
data: Bytes,
trace_types: HashSet<TraceType>,
@ -58,17 +58,24 @@ pub trait TraceApi {
/// Returns traces created at given block.
#[method(name = "trace_block")]
async fn block(&self, block_id: BlockId) -> Result<Option<Vec<LocalizedTransactionTrace>>>;
async fn trace_block(
&self,
block_id: BlockId,
) -> Result<Option<Vec<LocalizedTransactionTrace>>>;
/// Returns traces matching given filter
#[method(name = "trace_filter")]
async fn filter(&self, filter: TraceFilter) -> Result<Vec<LocalizedTransactionTrace>>;
async fn trace_filter(&self, filter: TraceFilter) -> Result<Vec<LocalizedTransactionTrace>>;
/// Returns transaction trace at given index.
#[method(name = "trace_get")]
fn trace(&self, hash: H256, indices: Vec<Index>) -> Result<Option<LocalizedTransactionTrace>>;
fn trace_get(
&self,
hash: H256,
indices: Vec<Index>,
) -> Result<Option<LocalizedTransactionTrace>>;
/// Returns all traces of given transaction.
#[method(name = "trace_transaction")]
fn transaction_traces(&self, hash: H256) -> Result<Option<Vec<LocalizedTransactionTrace>>>;
fn trace_transaction(&self, hash: H256) -> Result<Option<Vec<LocalizedTransactionTrace>>>;
}

View File

@ -167,14 +167,16 @@ where
};
assert!(is_unimplemented(
TraceApiClient::call(client, CallRequest::default(), HashSet::default(), None)
TraceApiClient::trace_call(client, CallRequest::default(), HashSet::default(), None)
.await
.err()
.unwrap()
));
assert!(is_unimplemented(TraceApiClient::call_many(client, vec![], None).await.err().unwrap()));
assert!(is_unimplemented(
TraceApiClient::raw_transaction(client, Bytes::default(), HashSet::default(), None)
TraceApiClient::trace_call_many(client, vec![], None).await.err().unwrap()
));
assert!(is_unimplemented(
TraceApiClient::trace_raw_transaction(client, Bytes::default(), HashSet::default(), None)
.await
.err()
.unwrap()
@ -191,13 +193,15 @@ where
.err()
.unwrap()
));
assert!(is_unimplemented(TraceApiClient::block(client, block_id).await.err().unwrap()));
assert!(is_unimplemented(TraceApiClient::filter(client, trace_filter).await.err().unwrap()));
assert!(is_unimplemented(TraceApiClient::trace_block(client, block_id).await.err().unwrap()));
assert!(is_unimplemented(
TraceApiClient::trace(client, H256::default(), vec![]).await.err().unwrap()
TraceApiClient::trace_filter(client, trace_filter).await.err().unwrap()
));
assert!(is_unimplemented(
TraceApiClient::transaction_traces(client, H256::default()).await.err().unwrap()
TraceApiClient::trace_get(client, H256::default(), vec![]).await.err().unwrap()
));
assert!(is_unimplemented(
TraceApiClient::trace_transaction(client, H256::default()).await.err().unwrap()
));
}

View File

@ -36,7 +36,7 @@ where
Client: BlockProvider + StateProviderFactory + EvmEnvProvider + 'static,
{
/// Handler for `trace_call`
async fn call(
async fn trace_call(
&self,
_call: CallRequest,
_trace_types: HashSet<TraceType>,
@ -46,7 +46,7 @@ where
}
/// Handler for `trace_callMany`
async fn call_many(
async fn trace_call_many(
&self,
_calls: Vec<(CallRequest, HashSet<TraceType>)>,
_block_id: Option<BlockId>,
@ -55,7 +55,7 @@ where
}
/// Handler for `trace_rawTransaction`
async fn raw_transaction(
async fn trace_raw_transaction(
&self,
_data: Bytes,
_trace_types: HashSet<TraceType>,
@ -83,17 +83,20 @@ where
}
/// Handler for `trace_block`
async fn block(&self, _block_id: BlockId) -> Result<Option<Vec<LocalizedTransactionTrace>>> {
async fn trace_block(
&self,
_block_id: BlockId,
) -> Result<Option<Vec<LocalizedTransactionTrace>>> {
Err(internal_rpc_err("unimplemented"))
}
/// Handler for `trace_filter`
async fn filter(&self, _filter: TraceFilter) -> Result<Vec<LocalizedTransactionTrace>> {
async fn trace_filter(&self, _filter: TraceFilter) -> Result<Vec<LocalizedTransactionTrace>> {
Err(internal_rpc_err("unimplemented"))
}
/// Handler for `trace_get`
fn trace(
fn trace_get(
&self,
_hash: H256,
_indices: Vec<Index>,
@ -102,7 +105,7 @@ where
}
/// Handler for `trace_transaction`
fn transaction_traces(&self, _hash: H256) -> Result<Option<Vec<LocalizedTransactionTrace>>> {
fn trace_transaction(&self, _hash: H256) -> Result<Option<Vec<LocalizedTransactionTrace>>> {
Err(internal_rpc_err("unimplemented"))
}
}