Repository navigation
fix(e2e): stop demo balance footers from rate-limiting the faucet - #985
Merged
Merged
Conversation
The balances footer watched Transfer events with two filters per token, so the faucet page (5 tokens) polled rpc.moderato.tempo.xyz with 10 filters every 500ms and read ~10 metadata fields per token on connect. viem retries each 429 up to 16 times, so a connected page sent ~5,700 RPC requests in 2 minutes and the RPC's per-client limit rejected every tempo_fundAddress attempt. The step showed the error within seconds, but expectDemoSuccess no longer saw it: #962 replaced the step's bg-destructiveTint class that its locator matched. - Watch transfers for every footer token with one filter per direction and read only each token's symbol. - Render step errors with role="alert" and locate them by role, so live tests fail fast with the step's message again. - Make both faucet tests use expectDemoSuccess, and request funds after the footer's initial balance reads finish. - Unit-test the footer's watcher shape and the step's alert role. Co-Authored-By: Liam Horne <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…-rate-limit # Conflicts: # e2e/demo-success.test.ts # src/components/guides/Demo.tsx
…-rate-limit # Conflicts: # e2e/faucet.test.ts
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
fund a connected passkey wallet via faucetwasn't flaky because of the faucet itself. The demo's balances footer sent enough RPC traffic to trigger the public RPC's per-client rate limit, which then rejected the faucet request. The same failure explainssend a payment with OUSD fees, the most frequent live-test failure since Oct 9.Two related fixes landed while this PR was open:
role="alert"on step errors, and a role-based error locator inexpectDemoSuccess.Readers still use the public RPC, so the footer's request volume still matters. This PR builds on both changes:
src/components/guides/Demo.tsx): oneTransferfilter per direction covers every footer token (2 filters instead of 2 per token), and a transfer refreshes only the affected token's balance. The footer readssymbol()instead of full token metadata, since the symbol is all it displays.e2e/faucet.test.ts): both tests useexpectDemoSuccess, so a faucet or RPC error fails in seconds with the step's message instead of after 120s. The passkey test requests funds after the footer shows all five balances, as a person would, instead of ~100ms after connecting, inside the page's initial read burst.Demo.test.tsx: covers the footer's watcher shape, the balance query-key invalidation (checked against wagmi's realgetBalancekey), and the step's alert role. It fails ifrole="alert"is removed. Onedemo-successfixture now covers an alert nested inside step content instead of a class-based case.Root cause
The balances footer rate-limited the page.
Container.BalancesFooterwatchedTransferevents with two filters per token. Moderato's 1s block time made viem poll every 500ms, so the faucet page's 5-token footer polled 10 filters about 20 times per second. On connect it also read 6–10 metadata fields per token (batch.multicall: falsemakes each field a separateeth_call). The footer also re-subscribed on every render because it passeduseWatchTransfera new inline callback each time. Each 429 from Cloudflare in front ofrpc.moderato.tempo.xyz(-32005, "rate limited, try again in ~500ms" or "too many connections from this IP") is retried by viem up to 16 times (4 client retries × 4 fallback retries).The retry trace from the failing CI job on #979 (run 38493328846) shows:
tempo_fundAddressattemptsThe step showed "An unknown RPC error occurred." (first attempt) and "WebSocket request failed." (retry) within seconds. But #962 had removed the
bg-destructiveTintclass thatexpectDemoSuccessmatched, so the test waited 120s for "Add more funds".Each attempt used a fresh virtual passkey, and so a fresh address. The retry ran after every other test in its shard had finished. So this isn't per-address faucet limiting or contention between shards: one page exceeds the limit. The public RPC's limit isn't documented in this repo;
/docs/api/rate-limitscovers the Tempo API.I didn't raise timeouts or retries. The live check still gates merges: with the footer fixed, a 429 on the faucet means the page or the RPC changed, which is worth failing on.
Evidence
Failure frequency (Verify runs Sep 13 – Oct 14: 356 runs, 961 E2E jobs, all attempts):
fund a connected passkey wallet via faucetsend a payment with OUSD feesThe faucet failures were on Oct 9 and Oct 14 (#979). The OUSD-fees reports I checked show the same step error, "Request exceeds defined limit." (
-32005), on a page with a 4-token footer. Together these two tests caused 8 of the 22 runs with a hard E2E failure since Oct 9. I found no live-test failures before Oct 9, when E2E moved toubuntu-24.04-armrunners with 4 browsers (#959).Local A/B against production builds made like CI (
VITE_E2E=true VITE_USE_HTTP=true pnpm build:site, served withdist/preview.js). Each build ran this PR'se2e/faucet.test.ts, one at a time:tempo_fundAddressattemptsmainbefore #957 (c2513b7)main(with #957)mainOn current
main, the single-filter footer cuts the passkey run's RPC calls by about 5× and its 429s by about 8×, and halves the test's run time. "Fund an address" passed in every run of every build. After merging #984, three more runs on the merged build passed (passkey test 4.4–5.9s; the local runs use no RPC key, so they still go through the public limit).Checks:
pnpm check,pnpm check:types, andpnpm test(including #957'sdemo-rpc.test.ts) pass. Playwrightdemo-success.test.tspasses (5/5).Co-Authored-By: Liam Horne [email protected]
Prompted by: Liam
🤖 Generated with Claude Code