fix(rpc): serialize traces always as vec (#3770)

This commit is contained in:
Matthias Seitz
2023-07-14 09:59:57 +02:00
committed by GitHub
parent 307fc10abb
commit f78f0302f1
2 changed files with 11 additions and 5 deletions

View File

@@ -138,7 +138,12 @@ impl ParityTraceBuilder {
let (trace, vm_trace, state_diff) = self.into_trace_type_traces(trace_types);
TraceResults { output: output.into(), trace, vm_trace, state_diff }
TraceResults {
output: output.into(),
trace: trace.unwrap_or_default(),
vm_trace,
state_diff,
}
}
/// Consumes the inspector and returns the trace results according to the configured trace

View File

@@ -30,12 +30,13 @@ pub enum TraceType {
pub struct TraceResults {
/// Output of the trace
pub output: Bytes,
/// Enabled if [TraceType::Trace] is provided
pub trace: Option<Vec<TransactionTrace>>,
/// Enabled if [TraceType::VmTrace] is provided
pub vm_trace: Option<VmTrace>,
/// Enabled if [TraceType::StateDiff] is provided
pub state_diff: Option<StateDiff>,
/// Enabled if [TraceType::Trace] is provided, otherwise an empty vec
#[serde(default)]
pub trace: Vec<TransactionTrace>,
/// Enabled if [TraceType::VmTrace] is provided
pub vm_trace: Option<VmTrace>,
}
/// A `FullTrace` with an additional transaction hash