-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Smart-contract proxy detection refactoring #8807
Conversation
db6e3d0
to
1d364fe
Compare
4a77a03
to
c649899
Compare
060fb6f
to
7026ef9
Compare
apps/explorer/lib/explorer/chain/smart_contract/proxy/eip_1822.ex
Outdated
Show resolved
Hide resolved
apps/explorer/lib/explorer/chain/smart_contract/proxy/eip_1967.ex
Outdated
Show resolved
Hide resolved
apps/explorer/lib/explorer/chain/smart_contract_additional_sources.ex
Outdated
Show resolved
Hide resolved
680dbad
to
3cca119
Compare
apps/explorer/lib/explorer/chain/smart_contract/proxy/eip_930.ex
Outdated
Show resolved
Hide resolved
apps/explorer/lib/explorer/chain/smart_contract/proxy/eip_1967.ex
Outdated
Show resolved
Hide resolved
apps/explorer/lib/explorer/chain/smart_contract/proxy/eip_1967.ex
Outdated
Show resolved
Hide resolved
apps/explorer/lib/explorer/chain/smart_contract/proxy/master_copy.ex
Outdated
Show resolved
Hide resolved
81c9e2b
to
d419fd1
Compare
62b4e6c
to
fff31fe
Compare
731e32f
to
f8782d0
Compare
def save_implementation_data(nil, _, _, _), do: {nil, nil} | ||
|
||
{:ok, implementation_address} = | ||
case Contract.eth_get_storage_at_request( | ||
proxy_address_hash, | ||
master_copy_storage_pointer, | ||
nil, | ||
json_rpc_named_arguments | ||
) do | ||
{:ok, empty_address} | ||
when is_burn_signature(empty_address) -> | ||
{:ok, "0x"} | ||
|
||
{:ok, logic_contract_address} -> | ||
{:ok, logic_contract_address} | ||
|
||
_ -> | ||
{:ok, nil} | ||
end | ||
|
||
abi_decode_address_output(implementation_address) | ||
end | ||
|
||
defp save_implementation_data(nil, _, _, _), do: {nil, nil} | ||
|
||
defp save_implementation_data(empty_address_hash_string, proxy_address_hash, metadata_from_verified_twin, options) | ||
when is_burn_signature_extended(empty_address_hash_string) do | ||
def save_implementation_data(empty_address_hash_string, proxy_address_hash, metadata_from_verified_twin, options) | ||
when is_burn_signature_extended(empty_address_hash_string) do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we union these 2 caluses to:
def save_implementation_data(empty_address_hash_string, proxy_address_hash, metadata_from_verified_twin, options)
when is_burn_signature_extended(empty_address_hash_string) or is_nil(empty_address_hash_string) do
It will allow us to save implementation_fetched_at
for nil cases
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd suggest doing this in frame of a separate PR. Currently, I have doubts to implement this in suggested maneer. Anyways, changes in this PR don't touch this logic and targeted to solve other (not performance) problems. Please, create an issue for the case you're reffering to.
#8758
Resolves #8760
Resolves #8761
Motivation
Refactor proxy smart-contracts detection and add missing proxy standards
Changelog
apps/explorer/lib/explorer/chain/smart_contract/proxy
path:Explorer.Chain
toExplorer.Chain.SmartContract
.Explorer.Chain
toExplorer.Chain.SmartContract.Proxy
.Checklist for your Pull Request (PR)
CHANGELOG.md
with this PRmaster
in the Version column. Changes will be reflected in this table: https://docs.blockscout.com/for-developers/information-and-settings/env-variables.