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

Fix contract's method's output of tuple type #3551

Merged
merged 1 commit into from
Jan 4, 2021

Conversation

vbaranov
Copy link
Member

@vbaranov vbaranov commented Jan 4, 2021

Motivation

Method getArtifact of DarkForest NFT contract returns internal server error:

2021-01-04T11:19:45.103 [error] #PID<0.1431.0> running BlockScoutWeb.Endpoint (connection #PID<0.1248.0>, stream id 10) terminated
Server: localhost:4000 (http)
Request: GET /smart-contracts/0x5cFbC3e179C48ccB3B3d35bAD6361972F2C5603B?function_name=getArtifact&method_id=8465ad44&args%5B%5D=80655615332912814281286268613438042255103875506825830758019774624527142298860
** (exit) an exception was raised:
    ** (Protocol.UndefinedError) protocol Phoenix.HTML.Safe not implemented for {80655615332912814281286268613438042255103875506825830758019774624527142298860, 996040386519514455547369964248641440971718171905442664266757499782684832, 2, 1, 1609747540, <<101, 112, 77, 187, 192, 10, 168, 130, 225, 223, 247, 185, 210, 111, 250, 61, 131, 95, 42, 109>>, 1} of type Tuple. This protocol is implemented for the following type(s): Explorer.Chain.Address, Explorer.Chain.Transaction, Explorer.Chain.Data, Explorer.Chain.Block, Explorer.Chain.Hash, Decimal, Time, Integer, Tuple, List, DateTime, NaiveDateTime, Float, Atom, Phoenix.HTML.Form, BitString, Date
        (phoenix_html 2.14.2) lib/phoenix_html/safe.ex:99: Phoenix.HTML.Safe.Tuple.to_iodata/1
        (block_scout_web 0.0.1) lib/block_scout_web/templates/smart_contract/_function_response.html.eex:8: anonymous fn/2 in BlockScoutWeb.SmartContractView."_function_response.html"/1
        (elixir 1.11.2) lib/enum.ex:2181: Enum."-reduce/3-lists^foldl/2-0-"/3
        (block_scout_web 0.0.1) lib/block_scout_web/templates/smart_contract/_function_response.html.eex:5: BlockScoutWeb.SmartContractView."_function_response.html"/1
        (phoenix 1.5.6) lib/phoenix/view.ex:472: Phoenix.View.render_to_iodata/3
        (phoenix 1.5.6) lib/phoenix/controller.ex:776: Phoenix.Controller.render_and_send/4
        (block_scout_web 0.0.1) lib/block_scout_web/controllers/smart_contract_controller.ex:1: BlockScoutWeb.SmartContractController.action/2
        (block_scout_web 0.0.1) lib/block_scout_web/controllers/smart_contract_controller.ex:1: BlockScoutWeb.SmartContractController.phoenix_controller_pipeline/2
        (phoenix 1.5.6) lib/phoenix/router.ex:352: Phoenix.Router.__call__/2
        (phoenix 1.5.6) lib/phoenix/router/route.ex:41: Phoenix.Router.Route.call/2
        (phoenix 1.5.6) lib/phoenix/router.ex:352: Phoenix.Router.__call__/2
        (block_scout_web 0.0.1) lib/block_scout_web/endpoint.ex:1: BlockScoutWeb.Endpoint.plug_builder_call/2
        (block_scout_web 0.0.1) lib/plug/debugger.ex:132: BlockScoutWeb.Endpoint."call (overridable 3)"/2
        (block_scout_web 0.0.1) lib/block_scout_web/endpoint.ex:1: BlockScoutWeb.Endpoint."call (overridable 4)"/2
        (block_scout_web 0.0.1) lib/spandex_phoenix.ex:156: BlockScoutWeb.Endpoint.call/2
        (phoenix 1.5.6) lib/phoenix/endpoint/cowboy2_handler.ex:65: Phoenix.Endpoint.Cowboy2Handler.init/4
        (cowboy 2.8.0) /Users/viktor/Documents/POANetwork/blockscout/deps/cowboy/src/cowboy_handler.erl:37: :cowboy_handler.execute/2
        (cowboy 2.8.0) /Users/viktor/Documents/POANetwork/blockscout/deps/cowboy/src/cowboy_stream_h.erl:300: :cowboy_stream_h.execute/3
        (cowboy 2.8.0) /Users/viktor/Documents/POANetwork/blockscout/deps/cowboy/src/cowboy_stream_h.erl:291: :cowboy_stream_h.request_process/3
        (stdlib 3.13.2) proc_lib.erl:226: :proc_lib.init_p_do_apply/3

Checklist for your Pull Request (PR)

@coveralls
Copy link

coveralls commented Jan 4, 2021

Pull Request Test Coverage Report for Build de4bd037eeaf4f75d99531e9197be9d56d3b3138-PR-3551

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 4 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-0.9%) to 66.795%

Files with Coverage Reduction New Missed Lines %
lib/block_scout_web/views/smart_contract_view.ex 4 68.0%
Totals Coverage Status
Change from base Build 7aa011ad9244fc5d9435c249938ef8793b604f6e: -0.9%
Covered Lines: 2078
Relevant Lines: 3111

💛 - Coveralls

@vbaranov vbaranov merged commit 0fa1504 into master Jan 4, 2021
@vbaranov vbaranov deleted the vb-fix-output-of-tuple-type branch January 4, 2021 21:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants