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

Blockscout scraping and use c8 instead of nyc #1092

Merged
merged 17 commits into from
Jul 11, 2023
Merged

Conversation

kuzdogan
Copy link
Member

@kuzdogan kuzdogan commented Jul 5, 2023

Recently noticed one of the tests started failing where we were scaping the transaction hash from the block explorer. This is because the chain's (Gnosis) Blockscout has been updated with the new Blockscout UI. This caused both the regex to not work anymore, as well as not being able to load the page contents with a fetch because the new UI is client-side rendered.

Update the scraping to try multiple regex'es, both the one for the old and the new UI.

Uses puppeteer to load the page to be scraped. This required to install the puppeteer dependencies on the containers that are running Sourcify and CI containers running tests: https://app.circleci.com/pipelines/github/ethereum/sourcify/4300/workflows/49a22229-32c3-408a-8459-622ecd863762/jobs/23775

Additionally we started getting cov_{id} is not defined errros in tests: https://app.circleci.com/pipelines/github/ethereum/sourcify/4309/workflows/35ad9ef7-524e-43b1-8ae5-4cf8d0455c65/jobs/23803 This was caused by the nyc library which hasn't been updated for some time. Move to c8 instead for coverage which is more up-to-date. See istanbuljs/nyc#1327

View in Huly HI-547

@codecov
Copy link

codecov bot commented Jul 5, 2023

Codecov Report

Patch coverage: 81.30% and project coverage change: +6.72 🎉

Comparison is base (a210c1e) 78.88% compared to head (e5d8b4f) 85.60%.

❗ Current head e5d8b4f differs from pull request most recent head 0dc5d70. Consider uploading reports for the commit 0dc5d70 to get more accurate results

Additional details and impacted files
@@             Coverage Diff             @@
##           staging    #1092      +/-   ##
===========================================
+ Coverage    78.88%   85.60%   +6.72%     
===========================================
  Files           56       67      +11     
  Lines         1539     8002    +6463     
  Branches       271      598     +327     
===========================================
+ Hits          1214     6850    +5636     
- Misses         189     1138     +949     
+ Partials       136       14     -122     
Flag Coverage Δ
lib-sourcify 79.98% <ø> (?)
server 88.42% <81.30%> (+9.54%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/server/services/VerificationService-util.ts 69.04% <64.28%> (+23.39%) ⬆️
src/monitor/monitor.ts 81.23% <82.89%> (-3.93%) ⬇️
...ommon/SourcifyEventManager/SourcifyEventManager.ts 100.00% <100.00%> (ø)
src/monitor/pending-contract.ts 85.98% <100.00%> (+3.37%) ⬆️
src/server/common.ts 82.82% <100.00%> (+13.13%) ⬆️
...er/controllers/verification/verification.common.ts 85.92% <100.00%> (+5.00%) ⬆️
src/server/server.ts 81.63% <100.00%> (+6.40%) ⬆️
src/server/services/RepositoryService.ts 89.55% <100.00%> (+16.08%) ⬆️
src/sourcify-chains.ts 98.20% <100.00%> (+13.89%) ⬆️

... and 57 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@kuzdogan kuzdogan force-pushed the blockscout-scraping branch from e5d8b4f to e792564 Compare July 5, 2023 15:46
kuzdogan added 12 commits July 5, 2023 17:50
Since the new Blockscout uses client side rendering, we need a browser
to scrape the page contents.
Use puppeteer to scrape.

Also update `txRegex` to be an array to support trying multiple regexes.
After adding `puppeteer` we started getting `cov_{id} is not defined`
errors.

This was caused by `nyc` which hasn't been updated in years.
It would make sense to move to a more up-to-date coverage library.

See istanbuljs/nyc#1327
@kuzdogan kuzdogan force-pushed the blockscout-scraping branch from e792564 to 592ab8e Compare July 5, 2023 15:52
@kuzdogan kuzdogan marked this pull request as ready for review July 7, 2023 09:59
@kuzdogan kuzdogan requested a review from marcocastignoli July 7, 2023 10:00
Copy link
Member

@marcocastignoli marcocastignoli left a comment

Choose a reason for hiding this comment

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

💯

@kuzdogan kuzdogan changed the title Blockscout scraping Blockscout scraping and use c8 instead of nyc Jul 11, 2023
@kuzdogan kuzdogan merged commit 1658af5 into staging Jul 11, 2023
@kuzdogan kuzdogan deleted the blockscout-scraping branch December 19, 2023 18:22
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.

2 participants