Merge branch 'master' into master-pr-6913

pull/6913/head
Cutsin 2 years ago committed by GitHub
commit aa8ddbe944
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      CHANGELOG.md
  2. 5
      apps/block_scout_web/lib/block_scout_web/controllers/api/v2/verification_controller.ex
  3. 2
      apps/block_scout_web/test/block_scout_web/controllers/api/v2/verification_controller_test.exs
  4. 18
      apps/explorer/lib/explorer/smart_contract/solidity/publish_helper.ex

@ -8,6 +8,7 @@
- [#6912](https://github.com/blockscout/blockscout/pull/6912) - Docker compose fix exposed ports
- [#6833](https://github.com/blockscout/blockscout/pull/6833) - Fix an error occurred when decoding base64 encoded json
- [#6911](https://github.com/blockscout/blockscout/pull/6911) - Fix bugs in verification API v2
- [#6891](https://github.com/blockscout/blockscout/pull/6891) - Fix read contract for geth
- [#6889](https://github.com/blockscout/blockscout/pull/6889) - Fix Internal Server Error on tx input decoding
- [#6893](https://github.com/blockscout/blockscout/pull/6893) - Fix token type definition for multiple interface tokens

@ -113,7 +113,10 @@ defmodule BlockScoutWeb.API.V2.VerificationController do
files_content <- PublishHelper.read_files(files_array) do
chosen_contract = params["chosen_contract_index"]
Que.add(SolidityPublisherWorker, {"sourcify_api_v2", address_hash_string, files_content, conn, chosen_contract})
Que.add(
SolidityPublisherWorker,
{"sourcify_api_v2", String.downcase(address_hash_string), files_content, conn, chosen_contract}
)
conn
|> put_view(ApiView)

@ -183,7 +183,7 @@ defmodule BlockScoutWeb.API.V2.VerificationControllerTest do
_contract = insert(:address, hash: address, contract_code: "0x01")
topic = "addresses:#{address}"
topic = "addresses:#{String.downcase(address)}"
{:ok, _reply, _socket} =
UserSocketV2

@ -94,15 +94,29 @@ defmodule Explorer.SmartContract.Solidity.PublishHelper do
def get_one_json(files_array) do
files_array
|> Enum.filter(fn file -> file.content_type == "application/json" end)
|> Enum.filter(fn file ->
case file do
%Plug.Upload{content_type: content_type} ->
content_type == "application/json"
_ ->
false
end
end)
|> Enum.at(0)
end
# sobelow_skip ["Traversal.FileModule"]
def read_files(plug_uploads) do
Enum.reduce(plug_uploads, %{}, fn %Plug.Upload{path: path, filename: file_name}, acc ->
Enum.reduce(plug_uploads, %{}, fn file, acc ->
case file do
%Plug.Upload{path: path, filename: file_name} ->
{:ok, file_content} = File.read(path)
Map.put(acc, file_name, file_content)
_ ->
acc
end
end)
end

Loading…
Cancel
Save