Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

regression on ABI processing #10042

Open
InoMurko opened this issue May 9, 2024 · 2 comments
Open

regression on ABI processing #10042

InoMurko opened this issue May 9, 2024 · 2 comments
Assignees
Labels
bug 🐛 Something isn't working

Comments

@InoMurko
Copy link

InoMurko commented May 9, 2024

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

@InoMurko InoMurko added the triage label May 9, 2024
@InoMurko
Copy link
Author

InoMurko commented May 9, 2024


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"
}

@vbaranov vbaranov added bug 🐛 Something isn't working and removed triage labels May 10, 2024
@vbaranov vbaranov assigned sl1depengwyn and unassigned nikitosing May 14, 2024
@bistousol
Copy link

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants