-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
chore: remove has_methods
from /addresses
#10051
Conversation
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.
Would it be correct to delete this test in favor of this one?
Lines 352 to 470 in ca1c7da
test "get smart-contract multiple additional sources from EIP-1167 implementation", %{conn: conn} do | |
implementation_contract = | |
insert(:smart_contract, | |
external_libraries: [], | |
constructor_arguments: "", | |
abi: [ | |
%{ | |
"type" => "constructor", | |
"inputs" => [ | |
%{"type" => "address", "name" => "_proxyStorage"}, | |
%{"type" => "address", "name" => "_implementationAddress"} | |
] | |
}, | |
%{ | |
"constant" => false, | |
"inputs" => [%{"name" => "x", "type" => "uint256"}], | |
"name" => "set", | |
"outputs" => [], | |
"payable" => false, | |
"stateMutability" => "nonpayable", | |
"type" => "function" | |
}, | |
%{ | |
"constant" => true, | |
"inputs" => [], | |
"name" => "get", | |
"outputs" => [%{"name" => "", "type" => "uint256"}], | |
"payable" => false, | |
"stateMutability" => "view", | |
"type" => "function" | |
} | |
], | |
license_type: 9 | |
) | |
insert(:smart_contract_additional_source, | |
file_name: "test1", | |
contract_source_code: "test2", | |
address_hash: implementation_contract.address_hash | |
) | |
insert(:smart_contract_additional_source, | |
file_name: "test3", | |
contract_source_code: "test4", | |
address_hash: implementation_contract.address_hash | |
) | |
implementation_contract_address_hash_string = | |
Base.encode16(implementation_contract.address_hash.bytes, case: :lower) | |
proxy_tx_input = | |
"0x11b804ab000000000000000000000000" <> | |
implementation_contract_address_hash_string <> | |
"000000000000000000000000000000000000000000000000000000000000006035323031313537360000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000284e159163400000000000000000000000034420c13696f4ac650b9fafe915553a1abcd7dd30000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000001c00000000000000000000000000000000000000000000000000000000000000220000000000000000000000000ff5ae9b0a7522736299d797d80b8fc6f31d61100000000000000000000000000ff5ae9b0a7522736299d797d80b8fc6f31d6110000000000000000000000000000000000000000000000000000000000000003e8000000000000000000000000000000000000000000000000000000000000000000000000000000000000000034420c13696f4ac650b9fafe915553a1abcd7dd300000000000000000000000000000000000000000000000000000000000000184f7074696d69736d2053756273637269626572204e465473000000000000000000000000000000000000000000000000000000000000000000000000000000054f504e46540000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000037697066733a2f2f516d66544e504839765651334b5952346d6b52325a6b757756424266456f5a5554545064395538666931503332752f300000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000c82bbe41f2cf04e3a8efa18f7032bdd7f6d98a81000000000000000000000000efba8a2a82ec1fb1273806174f5e28fbb917cf9500000000000000000000000000000000000000000000000000000000" | |
proxy_deployed_bytecode = | |
"0x363d3d373d3d3d363d73" <> implementation_contract_address_hash_string <> "5af43d82803e903d91602b57fd5bf3" | |
proxy_address = | |
insert(:contract_address, | |
contract_code: proxy_deployed_bytecode | |
) | |
insert(:transaction, | |
created_contract_address_hash: proxy_address.hash, | |
input: proxy_tx_input | |
) | |
|> with_block(status: :ok) | |
correct_response = %{ | |
"verified_twin_address_hash" => Address.checksum(implementation_contract.address_hash), | |
"is_verified" => false, | |
"is_changed_bytecode" => false, | |
"is_partially_verified" => implementation_contract.partially_verified, | |
"is_fully_verified" => false, | |
"is_verified_via_sourcify" => false, | |
"is_vyper_contract" => implementation_contract.is_vyper_contract, | |
"has_methods_read" => true, | |
"has_methods_write" => true, | |
"has_methods_read_proxy" => true, | |
"has_methods_write_proxy" => true, | |
"has_custom_methods_read" => false, | |
"has_custom_methods_write" => false, | |
"minimal_proxy_address_hash" => Address.checksum(implementation_contract.address_hash), | |
"sourcify_repo_url" => nil, | |
"can_be_visualized_via_sol2uml" => false, | |
"name" => implementation_contract && implementation_contract.name, | |
"compiler_version" => implementation_contract.compiler_version, | |
"optimization_enabled" => implementation_contract.optimization, | |
"optimization_runs" => implementation_contract.optimization_runs, | |
"evm_version" => implementation_contract.evm_version, | |
"verified_at" => implementation_contract.inserted_at |> to_string() |> String.replace(" ", "T"), | |
"source_code" => implementation_contract.contract_source_code, | |
"file_path" => implementation_contract.file_path, | |
"additional_sources" => [ | |
%{"file_path" => "test1", "source_code" => "test2"}, | |
%{"file_path" => "test3", "source_code" => "test4"} | |
], | |
"compiler_settings" => implementation_contract.compiler_settings, | |
"external_libraries" => [], | |
"constructor_args" => nil, | |
"decoded_constructor_args" => nil, | |
"is_self_destructed" => false, | |
"deployed_bytecode" => proxy_deployed_bytecode, | |
"creation_bytecode" => proxy_tx_input, | |
"abi" => implementation_contract.abi, | |
"is_verified_via_eth_bytecode_db" => implementation_contract.verified_via_eth_bytecode_db, | |
"is_verified_via_verifier_alliance" => implementation_contract.verified_via_verifier_alliance, | |
"language" => smart_contract_language(implementation_contract), | |
"license_type" => "bsd_3_clause", | |
"certified" => false | |
} | |
request = get(conn, "/api/v2/smart-contracts/#{Address.checksum(proxy_address.hash)}") | |
response = json_response(request, 200) | |
assert correct_response == response | |
end | |
end |
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.
Mentioned test in smart_contract_controller_test.exs
is for EIP-1167 proxy-pattern. Removing test is for EIP-1967 proxy pattern. I'd say the more correct way would be to create a similar test for EIP-1967 proxy pattern in smart_contract_controller_test.exs
, which will cover correct return of has_methods_...
attributes.
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.
Right, I see. Moved this test to smart_contract_controller_test.exs
in the last commit.
has_methods
from /addresses
has_methods
from /addresses
has_methods
from /addresses
ca1c7da
to
78489aa
Compare
* master: (65 commits) fix: Add healthcheck endpoints for indexer-only setup (#10076) 6.6.0 fix: Rework revert_reason (#9212) fix: Eliminate from_address_hash == #{address_hash} clause for transactions query in case of smart-contracts (#9469) feat: Add optional retry of NFT metadata fetch in Indexer.Fetcher.Tok… (#10036) fix: Separate indexer setup (#10032) feat: Blueprint contracts support (#10058) chore: Update hackney pool size: add new fetchers accounting (#9941) fix: Disallow batched queries in GraphQL endpoint (#10050) feat: Clone with immutable arguments proxy pattern (#10039) fix: vyper contracts re-verificaiton (#10053) refactor: Refactor get_additional_sources/4 -> get_additional_sources/3 (#10046) chore: Bump credo from 1.7.5 to 1.7.6 (#10060) chore: Bump redix from 1.5.0 to 1.5.1 (#10059) chore: Bump ex_doc from 0.32.1 to 0.32.2 (#10061) fix: Fix Unknown UID bug at smart-contract verification (#9986) refactor: test database config (#9662) chore: remove `has_methods` from `/addresses` (#10051) feat: Improve retry NFT fetcher (#10027) chore: Add support of Blast-specific L1 OP withdrawal events (#10049) ...
Motivation
Closes #9855.
Changelog
Enhancements
Remove dead code from
AddressController
.Incompatible Changes
The following fields are no longer present in the
/addresses
endpoint reponse:has_methods_read
has_methods_read_proxy
has_methods_write
has_methods_write_proxy
has_custom_methods_read
has_custom_methods_write
Upgrading
Ensure you access the removed fields from the
/smart-contracts
endpoint. Check compatibility matrix.Checklist for your Pull Request (PR)
master
in the Version column. Changes will be reflected in this table: https://docs.blockscout.com/for-developers/information-and-settings/env-variables.