fix(EventListener): preserve provider names for HTTP headers - #3762
fix(EventListener): preserve provider names for HTTP headers#3762elonfliter wants to merge 1 commit into
Conversation
Signed-off-by: elonfliter <elonfliter@outlook.com>
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d2cac9f6d5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| const listener = new EventListener(chainId, createSpyLogger().spyLogger, 1); | ||
| const [foo] = (listener as unknown as { providers: { transport: { value: unknown } }[] }).providers; | ||
| const headers = (foo.transport.value as { fetchOptions?: { headers?: unknown } }).fetchOptions?.headers; |
There was a problem hiding this comment.
Read fetchOptions from the flattened client transport
When this test runs against the pinned viem 2.47.10, createPublicClient flattens the transport's value fields directly into client.transport, so foo.transport.value is undefined. Running hardhat test --no-compile test/EventListener.ts therefore fails here with a TypeError before reaching the assertion, leaving the test suite red and the regression untested; inspect foo.transport.fetchOptions directly or exercise the transport through a request.
Useful? React with 👍 / 👎.
Summary
EventListener.resolveProviders()converted the provider URL record returned bygetNodeUrlList()to an array before iterating over it. This replaced provider names with numeric indexes such as0and1.As a result, HTTPS transports looked up incorrect environment variables such as
RPC_PROVIDER_0_1_HEADERS, so provider-specific HTTP headers were silently ignored.This change:
Testing
yarn prettier --check src/clients/EventListener.ts test/EventListener.tsyarn eslint src/clients/EventListener.ts test/EventListener.ts