Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Remove Snaps Methods from 'methodsWithConfirmation' list used to determine whether to enqueue a request #24371

Merged
merged 3 commits into from May 6, 2024

Conversation

adonesky1
Copy link
Contributor

@adonesky1 adonesky1 commented May 3, 2024

Description

Currently Snaps can call RPC requests that do not fully conform to certain expectation built into the QueuedRequestController. wallet_invokeSnap and wallet_snap may some times cause a confirmation and in some cases they may not. Currently our blanket assumption that a method either does or does not involve a confirmation is causing an issue: wallet_invokeSnap can call (as does JSON-RPC Snap on the Test-Snaps Page) another JSON-RPC method upon which it relies for completion. In the queuing system the second request gets queued behind the first (which depends on it for its own execution) leading to a lock up.

We should resolve this issue with a more elegant solution for how these chained RPC requests should be handled by queueing. But for now it's safe to simply circumvent queueing for these Snaps methods: In the cases where there is a confirmation resulting from a wallet_invokeSnap or wallet_snap call these requests will simply not be separated from a batch with another origin, which is fine.

Open in GitHub Codespaces

Related issues

Fixes: See this Slack thread

Manual testing steps

  1. Go to https://metamask.github.io/snaps/test-snaps/2.6.1/
  2. Connect to BIP-32 Snap
  3. Connect to JSON-RPC Snap
  4. Click Invoke Snap on JSON-RPC Snap
  5. You should see a hex value appear below the Invoke Snap button

Screenshots/Recordings

Before

After

Pre-merge author checklist

  • I’ve followed MetaMask Coding Standards.
  • I've completed the PR template to the best of my ability
  • I’ve included tests if applicable
  • I’ve documented my code using JSDoc format if applicable
  • I’ve applied the right labels on the PR (see labeling guidelines). Not required for external contributors.

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Copy link
Contributor

github-actions bot commented May 3, 2024

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@adonesky1 adonesky1 changed the title Remove Snaps Methods from 'methodsWithConfirmation' list used to determine whether to enqueue a request fix: Remove Snaps Methods from 'methodsWithConfirmation' list used to determine whether to enqueue a request May 3, 2024
@adonesky1 adonesky1 marked this pull request as ready for review May 3, 2024 17:30
@adonesky1 adonesky1 requested a review from a team as a code owner May 3, 2024 17:30
Copy link
Member

@Gudahtt Gudahtt left a comment

Choose a reason for hiding this comment

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

LGTM!

@mobularay mobularay added the amon-hen-v1 Represents blocking issues for the release of Amon Hen label May 6, 2024
@adonesky1 adonesky1 merged commit f2b6afd into develop May 6, 2024
73 of 74 checks passed
@adonesky1 adonesky1 deleted the ad/fix/remove-snaps-methods-from-queueing branch May 6, 2024 15:30
@github-actions github-actions bot locked and limited conversation to collaborators May 6, 2024
@metamaskbot metamaskbot added the release-11.18.0 Issue or pull request that will be included in release 11.18.0 label May 6, 2024
@metamaskbot
Copy link
Collaborator

Builds ready [c3d6658]
Page Load Metrics (537 ± 462 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint57132762311
domContentLoaded85714136
load452486537962462
domInteractive85714136
Bundle size diffs [🚀 Bundle size reduced!]
  • background: -34 Bytes (-0.00%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
amon-hen-v1 Represents blocking issues for the release of Amon Hen release-11.18.0 Issue or pull request that will be included in release 11.18.0 team-wallet-api-platform
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants