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
Default token mints subscriptions, killer for public rpc and private pools #27
Comments
I'll upvote the importance of this issue. We have now seen multiple cases where developers started with this scaffold and later saw disastrous results on their mainnet launch. Blindly opening this many subscriptions is an anti-pattern to be avoided. A safer approach might be for the developer to explicitly state the subscriptions they require. |
'+ @bhgames |
Can confirm this is a node killer. It's better to get rid of subscriptions altogether and just poll at reasonable frequencies using |
I'll take a look into this. |
Every single token mint in spl-token-registry is added to the cache
dapp-scaffold/src/contexts/connection.tsx
Lines 97 to 125 in 9352c93
Adding to the cache has a side effect, creating a subscription to the added account:
dapp-scaffold/src/contexts/accounts.tsx
Lines 361 to 371 in eef68f4
This problem is invisible on devnet as the token list is small, but once plugged to mainnet this is a node/rpcpool killer as the code will open a great number of account subscriptions through
onAccountChange
In most cases an up to date token mint is not required, only in rare cases it is useful (LP token supply...).
This should be reworked so the dapp-scaffold boilerplate is not a trap.
Here is a screenshot of the swarm of accountSubscribe in the websocket, it can't even fit on the screen
Some of which are essential tokens to be monitored
The text was updated successfully, but these errors were encountered: