Skip to content
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

feat: Blueprint contracts support #10058

Merged
merged 7 commits into from
May 14, 2024

Conversation

rimrakhimov
Copy link
Member

@rimrakhimov rimrakhimov commented May 12, 2024

Resolves #10038

Motivation

Adding indication if the verified contract is blueprint (EIP-5202 compatible) contract

Changelog

  • Add is_blueprint field to smart_contracts table
  • Add is_blueprint to /api/v2/smart-contracts/0x.../ endpoint response

Checklist for your Pull Request (PR)

@rimrakhimov rimrakhimov force-pushed the rimrakhimov/add-blueprint-contracts-support branch 2 times, most recently from 0424d28 to 3c86c29 Compare May 12, 2024 23:14
@rimrakhimov rimrakhimov force-pushed the rimrakhimov/add-blueprint-contracts-support branch from 3c86c29 to 815eb79 Compare May 12, 2024 23:25
@rimrakhimov rimrakhimov force-pushed the rimrakhimov/add-blueprint-contracts-support branch from 837e1c8 to 761cc35 Compare May 12, 2024 23:42
def solidity_multiple_files_verification_url,
do: "#{base_api_url()}" <> "/verifier/solidity/sources:verify-multi-part"
do: "#{base_api_url()}" <> "/verifier/solidity/sources%3Averify-multi-part"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious, what is the rationale to transform ":" to URL-encoded value? And 2nd question is why only this symbol is URL-encoded, and not a whole URL?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trying to mock the endpoint response with Bypass library fails when a request path contains ':' symbol (PSPDFKit-labs/bypass#122). Url-encoding allows to overcome this limitation.

Left the comment motivating that change: https://github.com/blockscout/blockscout/pull/10058/files#diff-8131861b04d9bfc97d0f9d8782437c3a8814d5b4b62e1665c200c8e3798ca964R157

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added link to the related Bypass issue in 1d5c0d2

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Usually we workaround it in this way, but if your approach is works fine, it's nice finding

Comment on lines +418 to +423
TestHelper.get_eip1967_implementation_zero_addresses()

request = get(conn, "/api/v2/smart-contracts/#{Address.checksum(contract_address.hash)}")
response = json_response(request, 200)

assert response["is_blueprint"] == true
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before 761cc35, I've made explicit query to the database to check that the correct is_blueprint value is stored inside (diff)

I've just thought that as we started checking api call here, test inside smart_contract_controller_test (https://github.com/blockscout/blockscout/pull/10058/files#diff-d392946298d6d844a2da500a13598d44cd57bc512c6fef7bad81886ceb87903aR475) may be redundant

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's keep both tests since, seems, they different a bit.

@vbaranov vbaranov merged commit fcc5ff2 into master May 14, 2024
16 checks passed
@vbaranov vbaranov deleted the rimrakhimov/add-blueprint-contracts-support branch May 14, 2024 15:28
fedor-ivn added a commit that referenced this pull request May 18, 2024
* 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)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for blueprint contracts
3 participants