Skip to content

fix(EventListener): preserve provider names for HTTP headers - #3762

Open
elonfliter wants to merge 1 commit into
across-protocol:masterfrom
elonfliter:master
Open

fix(EventListener): preserve provider names for HTTP headers#3762
elonfliter wants to merge 1 commit into
across-protocol:masterfrom
elonfliter:master

Conversation

@elonfliter

Copy link
Copy Markdown

Summary

EventListener.resolveProviders() converted the provider URL record returned by getNodeUrlList() to an array before iterating over it. This replaced provider names with numeric indexes such as 0 and 1.

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:

  • preserves provider names while resolving transports;
  • uses the provider record entries for provider-count validation;
  • adds a regression test covering provider-specific HTTPS headers.

Testing

  • yarn prettier --check src/clients/EventListener.ts test/EventListener.ts
  • yarn eslint src/clients/EventListener.ts test/EventListener.ts

Signed-off-by: elonfliter <elonfliter@outlook.com>
@pxrl

pxrl commented Aug 31, 2026

Copy link
Copy Markdown
Collaborator

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 31, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-08-31T13:05:51.168847Z d2cac9f Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment thread test/EventListener.ts

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;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge 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 👍 / 👎.

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