test(benchmarks): port the completed Solana discovery mocks into the benchmark suite - #45443
test(benchmarks): port the completed Solana discovery mocks into the benchmark suite#45443MajorLift wants to merge 1 commit into
Conversation
|
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. |
Builds ready [ea053df] [reused from 244ac8b]
⚡ Performance Benchmarks (Total: 🟢 12 pass · 🟡 6 warn · 🔴 4 fail)
Bundle size diffs
|
#43961 completed `SOLANA_DISCOVERY_RPC_RESULTS` in `test/e2e/mock-e2e.js`, but the benchmark suite is a separate mock implementation that never loaded that helper, so it kept the defect. It matched 8 of the 15 JSON-RPC methods the Solana snap calls during discovery; the other 7 fell through to `solanaCatchAllResponse`, whose `{ context, value: null }` is the wrong shape for a genesis hash, a version object, a slot number or a health string. This is the mechanism #43961 measured — malformed bodies throw inside the snap and restart discovery — and it is the likely source of the ~6.5s slow path #45266 sees on 37% of iterations. Verifiable on the next run: `doneButtonToAssetList` should collapse to its single ~1.7-2.5s mode.
ea053df to
f798148
Compare
Builds ready [f798148] [reused from cc5d691]
⚡ Performance Benchmarks (Total: 🟢 8 pass · 🟡 5 warn · 🔴 4 fail)
Bundle size diffs
|
Changelog
CHANGELOG entry: null
Description
#43961completedSOLANA_DISCOVERY_RPC_RESULTSintest/e2e/mock-e2e.js, giving every JSON-RPC method the Solana snap calls during account discovery a well-formed result. The benchmark suite is a separate mock implementation intest/e2e/benchmarks/mocks/and never loaded that helper, so it kept the defect the earlier PR removed.It matched 8 of the 15 discovery methods. The other 7 —
getGenesisHash,getHealth,getVersion,getSlot,getMultipleAccounts,getProgramAccounts,getTokenAccountBalance,getEpochInfo— fell through tosolanaCatchAllResponse, which returns:That is a valid JSON-RPC envelope with the wrong shape for every one of them:
getGenesisHashexpects a string,getVersionan object,getSlota number,getHealth"ok". This is the condition#43961measured — malformed bodies throw inside the snap and restart discovery, a ~516-request retry storm.This commit ports that result map into the benchmark fixtures and registers each method at
HIGH_PRIORITY. Each is matched on its own method name, so the 8 existing handlers and their calibrated delays are untouched.Verification
Coverage of the discovery method set, computed from the two files:
tscclean on both files,oxfmtclean, and the benchmark tooling suites pass (16 suites, 414 tests).There is no test here that fails without this change, and this PR does not claim one. The benchmark mock suite has no unit coverage, and the defect only manifests when a real Solana snap parses a real response — the passing suites show nothing regressed, not that this fixes anything.
The check is the next
mainrun, and it is falsifiable:onboardingNewWallet.doneButtonToAssetListcurrently lands at ~1.7–2.5s or ~8.4–10.2s with nothing between, on 24 of 65 sampled iterations slow (#45266). If this is the cause, that collapses to the single fast mode. If it does not move, the Solana attribution in #45266 is wrong and the search reopens — which is a useful result either way, and the reason this is worth landing before the instrumentation rather than after it.Follow-up
The two mock suites are parallel implementations of overlapping behaviour, and this is the second fix to one that did not reach the other. Filed separately rather than expanded here.
Related issues
Fixes: #45266
setupDefaultNonEvmDiscoveryMocks#43961, Complete global non-EVM (Solana) snap-discovery mocks insetupDefaultNonEvmDiscoveryMocks#43958 — the same defect, fixed in the shared e2e suiteManual testing steps
yarn jest development/metamaskbot-build-announce/ test/e2e/benchmarks/utils/mainrun, read per-iterationdoneButtonToAssetListfrom therun-benchmarks / chrome-webpack-userJourneyOnboardingNewjob log and confirm the slow cluster is absent.Pre-merge author checklist
Note
Low Risk
Test-only mock changes in the benchmark suite; no production, auth, or data-handling code is modified.
Overview
Ports the completed
SOLANA_DISCOVERY_RPC_RESULTSmap from the shared e2e suite into the benchmark mocks so Solana discovery methods no longer fall through to the wrong-shaped catch-all.Adds well-formed responses for
getGenesisHash,getHealth,getVersion,getSlot,getMultipleAccounts,getProgramAccounts,getTokenAccountBalance, andgetEpochInfo, and registers each atHIGH_PRIORITYwith a 100ms delay. Existing calibrated handlers are left untouched.This targets the intermittent ~6.5s slow path in onboarding benchmarks caused by malformed RPC bodies restarting Solana snap discovery.
Reviewed by Cursor Bugbot for commit f798148. Bugbot is set up for automated code reviews on this repo. Configure here.