blockscout / blockscout

Blockchain explorer for Ethereum based network and a tool for inspecting and analyzing EVM based blockchains.

Home Page:http://docs.blockscout.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

regression on ABI processing

InoMurko opened this issue · comments

Description

Release: "5.3.1" works

{:trace, #PID<0.6672.7383>, :call,
 {BlockScoutWeb.API.V2.SmartContractView, :render_json, [[], "bytes32[]"]}}
{:trace, #PID<0.6672.7383>, :return_from,
 {BlockScoutWeb.API.V2.SmartContractView, :render_json, 2}, []}
{:trace, #PID<0.6672.7383>, :call,
 {BlockScoutWeb.API.V2.SmartContractView, :render_json,
  [[], "tuple[bytes32,tuple[bytes32,uint64,uint64,uint64,address[]]][]"]}}
{:trace, #PID<0.6672.7383>, :return_from,
 {BlockScoutWeb.API.V2.SmartContractView, :render_json, 2}, []}
{:trace, #PID<0.6672.7383>, :call,
 {BlockScoutWeb.API.V2.SmartContractView, :render_json, [0, "uint256"]}}
{:trace, #PID<0.6672.7383>, :return_from,
 {BlockScoutWeb.API.V2.SmartContractView, :render_json, 2}, 0}

Release: "6.5.0"

{"time":"2024-05-09T18:47:09.713Z","severity":"error","message":"#PID<0.23518.11> running BlockScoutWeb.Endpoint (connection #PID<0.23523.11>, stream id 1) terminated\nServer: localhost:4000 (http)\nRequest: GET /api/v2/smart-contracts/0xbaBD9cc5f81228A7Fcfc4C31B852a106a06272cE/methods-read?is_custom_abi=false\n** (exit) an exception was raised:\n    ** (MatchError) no match of right hand side value: {:error, {1, :ethereum_abi_parser, ['syntax error before: ', ['\"bytes\"']]}}\n        (ex_abi 0.7.2) lib/abi/parser.ex:15: ABI.Parser.parse!/2\n        (block_scout_web 6.5.0) lib/block_scout_web/views/api/v2/smart_contract_view.ex:391: BlockScoutWeb.API.V2.SmartContractView.render_json/2\n        (block_scout_web 6.5.0) lib/block_scout_web/views/api/v2/smart_contract_view.ex:143: BlockScoutWeb.API.V2.SmartContractView.prepare_output/1\n        (elixir 1.14.5) lib/enum.ex:1658: Enum.\"-map/2-lists^map/1-0-\"/2\n        (block_scout_web 6.5.0) lib/block_scout_web/views/api/v2/smart_contract_view.ex:137: BlockScoutWeb.API.V2.SmartContractView.prepare_read_function/1\n        (elixir 1.14.5) lib/enum.ex:1658: Enum.\"-map/2-lists^map/1-0-\"/2\n        (elixir 1.14.5) lib/enum.ex:1658: Enum.\"-map/2-lists^map/1-0-\"/2\n        (phoenix 1.5.14) lib/phoenix/view.ex:472: Phoenix.View.render_to_iodata/3","metadata":{"error":{"initial_call":null,"reason":"** (MatchError) no match of right hand side value: {:error, {1, :ethereum_abi_parser, ['syntax error before: ', ['\"bytes\"']]}}\n    (ex_abi 0.7.2) lib/abi/parser.ex:15: ABI.Parser.parse!/2\n    (block_scout_web 6.5.0) lib/block_scout_web/views/api/v2/smart_contract_view.ex:391: BlockScoutWeb.API.V2.SmartContractView.render_json/2\n    (block_scout_web 6.5.0) lib/block_scout_web/views/api/v2/smart_contract_view.ex:143: BlockScoutWeb.API.V2.SmartContractView.prepare_output/1\n    (elixir 1.14.5) lib/enum.ex:1658: Enum.\"-map/2-lists^map/1-0-\"/2\n    (block_scout_web 6.5.0) lib/block_scout_web/views/api/v2/smart_contract_view.ex:137: BlockScoutWeb.API.V2.SmartContractView.prepare_read_function/1\n    (elixir 1.14.5) lib/enum.ex:1658: Enum.\"-map/2-lists^map/1-0-\"/2\n    (elixir 1.14.5) lib/enum.ex:1658: Enum.\"-map/2-lists^map/1-0-\"/2\n    (phoenix 1.5.14) lib/phoenix/view.ex:472: Phoenix.View.render_to_iodata/3\n"}}}

The issue:

 BlockScoutWeb.API.V2.SmartContractView.render_json(value, type)
** (MatchError) no match of right hand side value: {:error, {1, :ethereum_abi_parser, ['syntax error before: ', ['"bytes"']]}}
    (ex_abi 0.7.2) lib/abi/parser.ex:15: ABI.Parser.parse!/2
    (block_scout_web 6.5.0) lib/block_scout_web/views/api/v2/smart_contract_view.ex:391: BlockScoutWeb.API.V2.SmartContractView.render_json/2
value = []
type = "tuple[bytes32,tuple[bytes32,uint64,uint64,uint64,address[]]][]"
BlockScoutWeb.API.V2.SmartContractView.render_json(value, type)
** (MatchError) no match of right hand side value: {:error, {1, :ethereum_abi_parser, ['syntax error before: ', ['"bytes"']]}}
    (ex_abi 0.7.2) lib/abi/parser.ex:15: ABI.Parser.parse!/2
    (block_scout_web 6.5.0) lib/block_scout_web/views/api/v2/smart_contract_view.ex:391: BlockScoutWeb.API.V2.SmartContractView.render_json/2

Type of the installation

Docker-compose

Type of the JSON RPC archive node

Geth

Type of the chain

L2

Link to the page

No response

Steps to reproduce

value = []
type = "tuple[bytes32,tuple[bytes32,uint64,uint64,uint64,address[]]][]"
BlockScoutWeb.API.V2.SmartContractView.render_json(value, type)
** (MatchError) no match of right hand side value: {:error, {1, :ethereum_abi_parser, ['syntax error before: ', ['"bytes"']]}}
    (ex_abi 0.7.2) lib/abi/parser.ex:15: ABI.Parser.parse!/2
    (block_scout_web 6.5.0) lib/block_scout_web/views/api/v2/smart_contract_view.ex:391: BlockScoutWeb.API.V2.SmartContractView.render_json/2

Backend version

6.5.0

Frontend version

latest

Elixir & Erlang/OTP versions

1.14.5

Operating system

No response

Additional information

No response


function = %{
      "abi_outputs" => [
        %{
          "components" => [
            %{"internalType" => "bytes32", "name" => "id", "type" => "bytes32"},
            %{
              "components" => [
                %{
                  "internalType" => "bytes32",
                  "name" => "lastMiniblockHash",
                  "type" => "bytes32"
                },
                %{
                  "internalType" => "uint64",
                  "name" => "lastMiniblockNum",
                  "type" => "uint64"
                },
                %{
                  "internalType" => "uint64",
                  "name" => "reserved0",
                  "type" => "uint64"
                },
                %{
                  "internalType" => "uint64",
                  "name" => "flags",
                  "type" => "uint64"
                },
                %{
                  "internalType" => "address[]",
                  "name" => "nodes",
                  "type" => "address[]"
                }
              ],
              "internalType" => "struct Stream",
              "name" => "stream",
              "type" => "tuple"
            }
          ],
          "internalType" => "struct StreamWithId[]",
          "name" => "",
          "type" => "tuple[]"
        }
      ],
      "inputs" => [],
      "method_id" => "3bd84c0c",
      "name" => "getAllStreams",
      "names" => [
        [
          "struct StreamWithId[]",
          [
            "id",
            [
              "stream",
              ["lastMiniblockHash", "lastMiniblockNum", "reserved0", "flags",
               "nodes"]
            ]
          ]
        ]
      ],
      "outputs" => [
        %{
          "type" => "tuple[bytes32,tuple[bytes32,uint64,uint64,uint64,address[]]][]",
          "value" => []
        }
      ],
      "stateMutability" => "view",
      "type" => "function"
    }
    
BlockScoutWeb.API.V2.SmartContractView.prepare_read_function(function)

Currently:

iex(blockscout@3ae620ae335c)137> BlockScoutWeb.API.V2.SmartContractView.prepare_read_function(function)
** (MatchError) no match of right hand side value: {:error, {1, :ethereum_abi_parser, ['syntax error before: ', ['"bytes"']]}}
    (ex_abi 0.7.2) lib/abi/parser.ex:15: ABI.Parser.parse!/2
    (block_scout_web 6.5.0) lib/block_scout_web/views/api/v2/smart_contract_view.ex:391: BlockScoutWeb.API.V2.SmartContractView.render_json/2
    (block_scout_web 6.5.0) lib/block_scout_web/views/api/v2/smart_contract_view.ex:143: BlockScoutWeb.API.V2.SmartContractView.prepare_output/1
    (elixir 1.14.5) lib/enum.ex:1658: Enum."-map/2-lists^map/1-0-"/2
    (block_scout_web 6.5.0) lib/block_scout_web/views/api/v2/smart_contract_view.ex:137: BlockScoutWeb.API.V2.SmartContractView.prepare_read_function/1

Old version:

iex(blockscout@blockscout-dfb964499-cmrgs)264> BlockScoutWeb.API.V2.SmartContractView.prepare_read_function(function)
%{
  "inputs" => [],
  "method_id" => "3bd84c0c",
  "name" => "getAllStreams",
  "names" => [
    [
      "struct StreamWithId[]",
      [
        "id",
        [
          "stream",
          ["lastMiniblockHash", "lastMiniblockNum", "reserved0", "flags",
           "nodes"]
        ]
      ]
    ]
  ],
  "outputs" => [
    %{
      "type" => "tuple[bytes32,tuple[bytes32,uint64,uint64,uint64,address[]]][]",
      "value" => []
    }
  ],
  "stateMutability" => "view",
  "type" => "function"
}

Description

Version : "5.3.1" fonctionne

{:trace, #PID<0.6672.7383>, :call,
 {BlockScoutWeb.API.V2.SmartContractView, :render_json, [[], "bytes32[]"]}}
{:trace, #PID<0.6672.7383>, :return_from,
 {BlockScoutWeb.API.V2.SmartContractView, :render_json, 2}, []}
{:trace, #PID<0.6672.7383>, :call,
 {BlockScoutWeb.API.V2.SmartContractView, :render_json,
  [[], "tuple[bytes32,tuple[bytes32,uint64,uint64,uint64,address[]]][]"]}}
{:trace, #PID<0.6672.7383>, :return_from,
 {BlockScoutWeb.API.V2.SmartContractView, :render_json, 2}, []}
{:trace, #PID<0.6672.7383>, :call,
 {BlockScoutWeb.API.V2.SmartContractView, :render_json, [0, "uint256"]}}
{:trace, #PID<0.6672.7383>, :return_from,
 {BlockScoutWeb.API.V2.SmartContractView, :render_json, 2}, 0}

Version : "6.5.0"

{"time":"2024-05-09T18:47:09.713Z","severity":"error","message":"#PID<0.23518.11> running BlockScoutWeb.Endpoint (connection #PID<0.23523.11>, stream id 1) terminated\nServer: localhost:4000 (http)\nRequest: GET /api/v2/smart-contracts/0xbaBD9cc5f81228A7Fcfc4C31B852a106a06272cE/methods-read?is_custom_abi=false\n** (exit) an exception was raised:\n    ** (MatchError) no match of right hand side value: {:error, {1, :ethereum_abi_parser, ['syntax error before: ', ['\"bytes\"']]}}\n        (ex_abi 0.7.2) lib/abi/parser.ex:15: ABI.Parser.parse!/2\n        (block_scout_web 6.5.0) lib/block_scout_web/views/api/v2/smart_contract_view.ex:391: BlockScoutWeb.API.V2.SmartContractView.render_json/2\n        (block_scout_web 6.5.0) lib/block_scout_web/views/api/v2/smart_contract_view.ex:143: BlockScoutWeb.API.V2.SmartContractView.prepare_output/1\n        (elixir 1.14.5) lib/enum.ex:1658: Enum.\"-map/2-lists^map/1-0-\"/2\n        (block_scout_web 6.5.0) lib/block_scout_web/views/api/v2/smart_contract_view.ex:137: BlockScoutWeb.API.V2.SmartContractView.prepare_read_function/1\n        (elixir 1.14.5) lib/enum.ex:1658: Enum.\"-map/2-lists^map/1-0-\"/2\n        (elixir 1.14.5) lib/enum.ex:1658: Enum.\"-map/2-lists^map/1-0-\"/2\n        (phoenix 1.5.14) lib/phoenix/view.ex:472: Phoenix.View.render_to_iodata/3","metadata":{"error":{"initial_call":null,"reason":"** (MatchError) no match of right hand side value: {:error, {1, :ethereum_abi_parser, ['syntax error before: ', ['\"bytes\"']]}}\n    (ex_abi 0.7.2) lib/abi/parser.ex:15: ABI.Parser.parse!/2\n    (block_scout_web 6.5.0) lib/block_scout_web/views/api/v2/smart_contract_view.ex:391: BlockScoutWeb.API.V2.SmartContractView.render_json/2\n    (block_scout_web 6.5.0) lib/block_scout_web/views/api/v2/smart_contract_view.ex:143: BlockScoutWeb.API.V2.SmartContractView.prepare_output/1\n    (elixir 1.14.5) lib/enum.ex:1658: Enum.\"-map/2-lists^map/1-0-\"/2\n    (block_scout_web 6.5.0) lib/block_scout_web/views/api/v2/smart_contract_view.ex:137: BlockScoutWeb.API.V2.SmartContractView.prepare_read_function/1\n    (elixir 1.14.5) lib/enum.ex:1658: Enum.\"-map/2-lists^map/1-0-\"/2\n    (elixir 1.14.5) lib/enum.ex:1658: Enum.\"-map/2-lists^map/1-0-\"/2\n    (phoenix 1.5.14) lib/phoenix/view.ex:472: Phoenix.View.render_to_iodata/3\n"}}}

Le problème:

 BlockScoutWeb.API.V2.SmartContractView.render_json(value, type)
** (MatchError) no match of right hand side value: {:error, {1, :ethereum_abi_parser, ['syntax error before: ', ['"bytes"']]}}
    (ex_abi 0.7.2) lib/abi/parser.ex:15: ABI.Parser.parse!/2
    (block_scout_web 6.5.0) lib/block_scout_web/views/api/v2/smart_contract_view.ex:391: BlockScoutWeb.API.V2.SmartContractView.render_json/2
value = []
type = "tuple[bytes32,tuple[bytes32,uint64,uint64,uint64,address[]]][]"
BlockScoutWeb.API.V2.SmartContractView.render_json(value, type)
** (MatchError) no match of right hand side value: {:error, {1, :ethereum_abi_parser, ['syntax error before: ', ['"bytes"']]}}
    (ex_abi 0.7.2) lib/abi/parser.ex:15: ABI.Parser.parse!/2
    (block_scout_web 6.5.0) lib/block_scout_web/views/api/v2/smart_contract_view.ex:391: BlockScoutWeb.API.V2.SmartContractView.render_json/2

Type d'installation

Docker-composer

Type du nœud d'archive JSON RPC

Geth

Type de chaîne

L2

Lien vers la page

Pas de réponse

Étapes pour reproduire

value = []
type = "tuple[bytes32,tuple[bytes32,uint64,uint64,uint64,address[]]][]"
BlockScoutWeb.API.V2.SmartContractView.render_json(value, type)
** (MatchError) no match of right hand side value: {:error, {1, :ethereum_abi_parser, ['syntax error before: ', ['"bytes"']]}}
    (ex_abi 0.7.2) lib/abi/parser.ex:15: ABI.Parser.parse!/2
    (block_scout_web 6.5.0) lib/block_scout_web/views/api/v2/smart_contract_view.ex:391: BlockScoutWeb.API.V2.SmartContractView.render_json/2

Version back-end

6.5.0

Version frontale

dernier

Versions Elixir & Erlang/OTP

1.14.5

Système opérateur

Pas de réponse

Informations Complémentaires

Pas de réponse

#10042 (comment)