Skip to content

pkgs: add http headers to ethers providers#1692

Merged
tynes merged 1 commit intoregenesis/0.5.0from
feat/http-headers
Nov 4, 2021
Merged

pkgs: add http headers to ethers providers#1692
tynes merged 1 commit intoregenesis/0.5.0from
feat/http-headers

Conversation

@tynes
Copy link
Contributor

@tynes tynes commented Nov 4, 2021

Description

Adds the http header 'User-Agent' to the creation
of ethers providers across the services to allow
for more visibility into what services are sending
requests.

Also delete dead imports since they were breaking
during linting.

@changeset-bot
Copy link

changeset-bot bot commented Nov 4, 2021

🦋 Changeset detected

Latest commit: 6ae2fe9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 7 packages
Name Type
@eth-optimism/builder Patch
@eth-optimism/batch-submitter Patch
@eth-optimism/core-utils Patch
@eth-optimism/data-transport-layer Patch
@eth-optimism/message-relayer Patch
@eth-optimism/replica-healthcheck Patch
@eth-optimism/contracts Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added 2-reviewers A-op-batcher Area: op-batcher A-pkg-core-utils Area: packages/core-utils labels Nov 4, 2021
Adds the http header 'User-Agent' to the creation
of ethers providers across the services to allow
for more visibility into what services are sending
requests.

Also delete dead imports since they were breaking
during linting.
@tynes tynes force-pushed the feat/http-headers branch from 366c18a to 6ae2fe9 Compare November 4, 2021 19:55
@smartcontracts
Copy link
Contributor

@tynes will this help us get better visibility for the connections that are going through external providers like Alchemy or Infura?

@codecov-commenter
Copy link

codecov-commenter commented Nov 4, 2021

Codecov Report

Merging #1692 (6ae2fe9) into regenesis/0.5.0 (1dd1022) will decrease coverage by 0.12%.
The diff coverage is 20.00%.

Impacted file tree graph

@@                 Coverage Diff                 @@
##           regenesis/0.5.0    #1692      +/-   ##
===================================================
- Coverage            72.71%   72.58%   -0.13%     
===================================================
  Files                   69       69              
  Lines                 2272     2276       +4     
  Branches               336      337       +1     
===================================================
  Hits                  1652     1652              
- Misses                 620      624       +4     
Flag Coverage Δ
batch-submitter 61.33% <ø> (ø)
contracts 87.96% <ø> (ø)
core-utils 57.72% <20.00%> (-0.69%) ⬇️
data-transport-layer 38.23% <ø> (ø)
message-relayer 83.17% <ø> (ø)

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

Impacted Files Coverage Δ
packages/core-utils/src/provider.ts 15.38% <20.00%> (-6.84%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1dd1022...6ae2fe9. Read the comment docs.

Copy link
Contributor

@annieke annieke left a comment

Choose a reason for hiding this comment

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

this is a great change!!

const urls = config.split(',')
for (const [i, url] of urls.entries()) {
const connectionInfo: ConnectionInfo = { url }
if (typeof headers === 'object') {
Copy link
Contributor

Choose a reason for hiding this comment

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

what does this if statement protect against?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It lets you not pass in the headers object without assigning undefined to the object, its more of a safety thing but i suppose the code is the same without it

@tynes
Copy link
Contributor Author

tynes commented Nov 4, 2021

@tynes will this help us get better visibility for the connections that are going through external providers like Alchemy or Infura?

No, but our proxy will be able to view them

@tynes tynes merged commit 2f08d3a into regenesis/0.5.0 Nov 4, 2021
@tynes tynes deleted the feat/http-headers branch November 4, 2021 20:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-op-batcher Area: op-batcher A-pkg-core-utils Area: packages/core-utils

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants