From 83ffe3c794c79e1640a9883a15d6f98909288163 Mon Sep 17 00:00:00 2001 From: Qwerty5Uiop <105209995+Qwerty5Uiop@users.noreply.github.com> Date: Wed, 15 Jan 2025 14:33:44 +0400 Subject: [PATCH] fix: Add function clause for wrong first trace result format (#11655) --- .../trace_replay_block_transactions.ex | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/trace_replay_block_transactions.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/trace_replay_block_transactions.ex index 79748a2aee69..c3aeb291ed44 100644 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/trace_replay_block_transactions.ex +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/trace_replay_block_transactions.ex @@ -258,6 +258,26 @@ defmodule EthereumJSONRPC.TraceReplayBlockTransactions do {:error, annotated_error} end + defp trace_replay_transaction_response_to_first_trace(%{id: id, result: error_result}, id_to_params) + when is_map(id_to_params) do + %{ + block_hash: block_hash, + block_number: block_number, + hash_data: transaction_hash, + transaction_index: transaction_index + } = Map.fetch!(id_to_params, id) + + annotated_error = %{ + "blockHash" => block_hash, + "blockNumber" => block_number, + "transactionIndex" => transaction_index, + "transactionHash" => transaction_hash, + "result" => error_result + } + + {:error, annotated_error} + end + defp trace_replay_transaction_requests(id_to_params) when is_map(id_to_params) do Enum.map(id_to_params, fn {id, %{hash_data: hash_data}} -> trace_replay_transaction_request(%{id: id, hash_data: hash_data})