core icon indicating copy to clipboard operation
core copied to clipboard

[queued-request-controller] Clear queued requests when selected network client changes

Open Gudahtt opened this issue 2 years ago • 0 comments

Currently MetaMask (in production today, with queuing disabled) will clear pending requests when the selected chain changes. This is because these requests may have been submitted for the previous chain, so we cannot know whether they are still valid or not.

With the introduction of request queuing, this feature is disrupted because queued requests do not get discarded when a switch occurs. This could lead to invalid requests being left in the queue.

We should update the QueuedRequestController to listen for changes in the dapp-selected chain, and clear any queued requests if it changes. Additionally we should also listen to changes in the globally-selected chain, and clear metamask-origin requests if that changes.

This would preserve the existing functionality of pending confirmation dismissal, ensuring that we don't present the user with malformed/invalid/outdated confirmations.

Gudahtt avatar Feb 29 '24 18:02 Gudahtt