Error on ethereum_jsonrpc trace.ex when key is revertReason

Greetings, I have followed all the instructions on the manual deployment page and set all ENV variables as needed. Even though the block explorer works fine, I am getting messages on the terminal (excess error logs which fills 50GB of storage in approximately 5 days).

The error is;

Function: &Indexer.BufferedTask.log_run/1
    Args: [%{batch: [164119, 179701, 164130, 164119, 179704, 179674, 179685, 179689, 164161, 179678], callback_module: Indexer.Fetcher.InternalTransaction, callback_module_state: [transport: EthereumJSONRPC.HTTP, else: EthereumJSONRPC.IPC, transport_options: [http: EthereumJSONRPC.HTTP.HTTPoison, url: "", method_to_url: [eth_getBalance: "", trace_block: "", trace_replayBlockTransactions: ""], http_options: [recv_timeout: 600000, timeout: 600000, hackney: [pool: :ethereum_jsonrpc]]], variant: EthereumJSONRPC.Besu], metadata: [fetcher: :internal_transaction]}]
2021-11-11T15:18:08.698 fetcher=internal_transaction count=9 [error] Task #PID<0.22024.170> started from Indexer.Fetcher.InternalTransaction terminating
** (FunctionClauseError) no function clause matching in EthereumJSONRPC.Parity.Trace.entry_to_elixir/1
    (ethereum_jsonrpc 0.1.0) lib/ethereum_jsonrpc/parity/trace.ex:454: EthereumJSONRPC.Parity.Trace.entry_to_elixir({"revertReason", "0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001a46696265723a20746f6b656e206e6f7420737570706f72746564000000000000"})
    (elixir 1.12.2) lib/enum.ex:1586: anonymous fn/3 in
    (stdlib 3.15.2) maps.erl:410: :maps.fold_1/3
    (elixir 1.12.2) lib/enum.ex:2397:
    (elixir 1.12.2) lib/enum.ex:1485: Enum.into/3
    (elixir 1.12.2) lib/enum.ex:1582: Enum."-map/2-lists^map/1-0-"/2
    (ethereum_jsonrpc 0.1.0) lib/ethereum_jsonrpc/besu.ex:114: EthereumJSONRPC.Besu.trace_replay_block_transactions_responses_to_internal_transactions_params/2
    (indexer 0.1.0) lib/indexer/fetcher/internal_transaction.ex:109:
    (elixir 1.12.2) lib/task/supervised.ex:90: Task.Supervised.invoke_mfa/2
    (elixir 1.12.2) lib/task/supervised.ex:35: Task.Supervised.reply/5
    (stdlib 3.15.2) proc_lib.erl:226: :proc_lib.init_p_do_apply/3

After debugging I have realized that the internalTransaction fetcher is unable to fetch when there’s a transaction that has been reverted and has a custom revert message in Hex format;

In my case the revert message is 0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001a46696265723a20746f6b656e206e6f7420737570706f72746564000000000000

By checking the tracer.ex file located in blockscout/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/parity/trace.ex I have found that the key revertReason is not defined.

In my case I am using the Besu (which I already have set as an env variable and you can see from the error log that Blockscout also sees it as Besu) but I don’t know why the trace.ex is used from ethereum_jsonrpc/parity

By changing the lines [456-472] as following solves the issue;

  defp entry_to_elixir({"index", index} = entry) when is_integer(index), do: entry

  defp entry_to_elixir({"revertReason", reason} = entry) when is_binary(reason), do: entry

  defp entry_to_elixir({"result" = key, result}) do
    {key, Result.to_elixir(result)}

Please merge PR #4895 Addition of `revertReason` by nithronium · Pull Request #4895 · blockscout/blockscout · GitHub