Skip to content

remove network request deepClone#8091

Merged
kanej merged 1 commit intomainfrom
feat/remove-request-deepclone
Mar 26, 2026
Merged

remove network request deepClone#8091
kanej merged 1 commit intomainfrom
feat/remove-request-deepclone

Conversation

@kanej
Copy link
Copy Markdown
Member

@kanej kanej commented Mar 26, 2026

As part of the onRequest hook handler to apply the request mutating sub-handlers we applied a defesive deepClone, to ensure the passed in request was not mutated.

The deepClone is a performance bottleneck we have opted to remove.

For the moment, we will accept that the passed in request is updated in place. We have a follow up task to alter the subhandlers to transform rather than mutate, see #8090

Resolves #8046

Peer bumps reasoning

We are changing the ownership pattern here for requests within the onRequest hook. However, we have analyzed the downstream plugins and none are affected in the Nomic or community plugin list.

Copilot AI review requested due to automatic review settings March 26, 2026 11:06
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 26, 2026

🦋 Changeset detected

Latest commit: c89cb91

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

This PR includes changesets to release 1 package
Name Type
hardhat 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

@kanej kanej added no docs needed This PR doesn't require links to documentation no peer bump needed labels Mar 26, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Removes the defensive deep-clone performed in the network manager’s onRequest hook handler chain to eliminate a known performance bottleneck, accepting (for now) that the incoming JSON-RPC request object may be mutated in place.

Changes:

  • Removed deepClone usage when processing onRequest hook requests.
  • Updated local variable naming to reflect request flow through request handlers.

As part of the `onRequest` hook handler to apply the request mutating
subhandlers we applied a defesive deepClone, to ensure the passed in
request was not mutated.

The `deepClone` is a performance bottleneck we have opted to remove.

For the moment, we will accept that the passed in request is updated in
place. We have a follow up task to alter the subhandlers to transform
rather than mutate, see #8090

Resolves #8046
@kanej kanej force-pushed the feat/remove-request-deepclone branch from fe23969 to c89cb91 Compare March 26, 2026 11:10
@kanej kanej added this pull request to the merge queue Mar 26, 2026
Merged via the queue into main with commit 5d66b4a Mar 26, 2026
213 checks passed
@kanej kanej deleted the feat/remove-request-deepclone branch March 26, 2026 13:37
@github-actions github-actions bot mentioned this pull request Mar 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no docs needed This PR doesn't require links to documentation no peer bump needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reviewing HTTP request cloning

3 participants