Giter Site home page Giter Site logo

regression on ABI processing about blockscout HOT 2 OPEN

InoMurko avatar InoMurko commented on June 6, 2024
regression on ABI processing

from blockscout.

Comments (2)

InoMurko avatar InoMurko commented on June 6, 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"
}

from blockscout.

bistousol avatar bistousol commented on June 6, 2024

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)

from blockscout.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.