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 read contract bytes array type output #3207

Merged
merged 2 commits into from
Jul 22, 2020

Conversation

vbaranov
Copy link
Member

@vbaranov vbaranov commented Jul 22, 2020

Motivation

Error at "Read contract" page if a contract contains bytes array type.

blockscout     | Request: GET /smart_contracts?hash=0xe7d982c6554e490ee707144d2f38a1c1ca3ccaae&type=regular&action=read
blockscout     | ** (exit) an exception was raised:
blockscout     |     ** (ArgumentError) argument error
blockscout     |         :erlang.byte_size([<<238, 151, 199, 221, 46, 115, 76, 242, 52, 194, 186, 13, 131, 167, 70, 51, 225, 172, 127, 200, 169, 253, 119, 159, 132, 151, 160, 16, 156, 113, 185, 147>>, <<165, 241, 91, 31, 169, 32, 187, 219, 194, 143, 93, 120, 94, 82, 36, 227, 166, 110, 181, 247, 212, 9, 45, 201, 186, 130, 213, 229, 174, 58, 188, 135>>, <<94, 248, 58, 217, 85, 144, 51, 230, 233, 65, 219, 125, 124, 73, 90, 205, 206, 97, 99, 71, 210, 142, 144, 199, 206, 71, 203, 252, 252, 173, 59, 197>>, <<58, 71, 171, 91, 211, 165, 148, 195, 168, 153, 95, 143, 165, 141, 8, 118, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0>>, <<58, 71, 171, 91, 211, 165, 148, 195, 168, 153, 95, 143, 165, 141, 8, 118, 201, 104, 25, 202, 69, 22, 189, 118, 16, 12, 146, 70, 47, 47, 157, 192>>])
blockscout     |         (explorer 0.0.1) lib/explorer/smart_contract/reader.ex:343: Explorer.SmartContract.Reader.bytes_to_string/1
blockscout     |         (explorer 0.0.1) lib/explorer/smart_contract/reader.ex:325: Explorer.SmartContract.Reader.new_value/3
blockscout     |         (explorer 0.0.1) lib/explorer/smart_contract/reader.ex:316: anonymous fn/3 in Explorer.SmartContract.Reader.link_outputs_and_values/3
blockscout     |         (elixir 1.10.2) lib/enum.ex:2111: Enum."-reduce/3-lists^foldl/2-0-"/3
blockscout     |         (explorer 0.0.1) lib/explorer/smart_contract/reader.ex:315: Explorer.SmartContract.Reader.link_outputs_and_values/3
blockscout     |         (explorer 0.0.1) lib/explorer/smart_contract/reader.ex:233: Explorer.SmartContract.Reader.fetch_current_value_from_blockchain/3
blockscout     |         (elixir 1.10.2) lib/enum.ex:1396: Enum."-map/2-lists^map/1-0-"/2

Changelog

Properly format output value in case of bytes array type

Checklist for your Pull Request (PR)

@vbaranov vbaranov changed the title Fix read contract bytes array type Fix read contract bytes array type output Jul 22, 2020
@vbaranov vbaranov force-pushed the vb-fix-read-contract-bytes-array-type branch from 9b57e61 to 024823c Compare July 22, 2020 13:54
@vbaranov vbaranov merged commit 3928f2f into master Jul 22, 2020
@vbaranov vbaranov deleted the vb-fix-read-contract-bytes-array-type branch July 22, 2020 15:34
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

1 participant