fix: bugs introduced in calldata decoding optimizations (#11025)

* fix: incorrect types

* fix: empty methods cache
pull/11051/head
Kirill Fedoseev 4 weeks ago committed by GitHub
parent 684dd5d841
commit 566997e9ec
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 8
      apps/explorer/lib/explorer/chain/transaction.ex

@ -1002,7 +1002,7 @@ defmodule Explorer.Chain.Transaction do
proxy_implementation_abi_map,
options
) do
Map.get_lazy(proxy_implementation_abi_map, smart_contract, fn ->
Map.get_lazy(proxy_implementation_abi_map, smart_contract.address_hash, fn ->
Proxy.combine_proxy_implementation_abi(smart_contract, options)
end)
end
@ -1988,7 +1988,7 @@ defmodule Explorer.Chain.Transaction do
empty_methods_map =
transactions
|> Enum.flat_map(fn
%{input: <<method_id::binary-size(4), _::binary>>} -> [method_id]
%{input: %{bytes: <<method_id::binary-size(4), _::binary>>}} -> [method_id]
_ -> []
end)
|> Enum.into(%{}, &{&1, []})
@ -2007,12 +2007,12 @@ defmodule Explorer.Chain.Transaction do
methods_map =
decoded_transactions
|> Enum.flat_map(fn
{nil, %{input: <<method_id::binary-size(4), _::binary>>}} -> [method_id]
{nil, %{input: %{bytes: <<method_id::binary-size(4), _::binary>>}}} -> [method_id]
_ -> []
end)
|> Enum.uniq()
|> ContractMethod.find_contract_methods(opts)
|> Enum.into(%{}, &{&1.identifier, [&1]})
|> Enum.into(empty_methods_map, &{&1.identifier, [&1]})
# decode remaining transaction using methods map
decoded_transactions

Loading…
Cancel
Save