fix: Fix unknown UID bug (#10226)

* fix: Fix unknown UID bug

* Fix timestamp comparison
pull/10236/head
nikitosing 5 months ago committed by GitHub
parent e0b43fdbe6
commit e292873f79
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 8
      apps/explorer/lib/explorer/chain/smart_contract/verification_status.ex
  2. 2
      apps/explorer/lib/explorer/smart_contract/solidity/publisher.ex

@ -114,7 +114,7 @@ defmodule Explorer.Chain.SmartContract.VerificationStatus do
def validate_uid(<<_address::binary-size(40), timestamp_hex::binary>> = uid) do
case Integer.parse(timestamp_hex, 16) do
{timestamp, ""} ->
if DateTime.utc_now() |> DateTime.to_unix() > timestamp do
if DateTime.utc_now() |> DateTime.to_unix() >= timestamp do
{:ok, uid}
else
:error
@ -130,7 +130,7 @@ defmodule Explorer.Chain.SmartContract.VerificationStatus do
defp mb_find_uid_in_queue(:unknown_uid, uid) do
SolidityPublisherWorker
|> QuePersistence.all()
|> Enum.any?(fn
|> Enum.find_value(fn
%Que.Job{arguments: {"flattened_api", _, _, ^uid}} ->
:pending
@ -138,8 +138,8 @@ defmodule Explorer.Chain.SmartContract.VerificationStatus do
:pending
_ ->
:unknown_uid
end)
nil
end) || :unknown_uid
end
defp mb_find_uid_in_queue(other_status, _), do: other_status

@ -253,7 +253,7 @@ defmodule Explorer.SmartContract.Solidity.Publisher do
verification_with_files?
)
Logger.error("Solidity smart-contract verification #{address_hash} failed because of the error #{error}")
Logger.error("Solidity smart-contract verification #{address_hash} failed because of the error #{inspect(error)}")
%{changeset | action: :insert}
end

Loading…
Cancel
Save