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

[TBD] Gateway APIs #1338

Open
wsdt opened this issue Aug 2, 2023 · 3 comments
Open

[TBD] Gateway APIs #1338

wsdt opened this issue Aug 2, 2023 · 3 comments

Comments

@wsdt
Copy link
Contributor

wsdt commented Aug 2, 2023

Issue Type

[ ] bug report
[ x] feature request

Current Behavior

Right now every API is deployed as separate service, uses raw sql to save & query from the database which is very cumbersome to maintain & extend.

Expected Behavior

Consider adding at least an ORM such as TypeOrm which we have already for Teleportation to at least make the SQL part much easier to maintain, more reliable and faster to extend.

Would even consider slowly introducing a simple backend, that just handles all sorts of APIs for the frontend (e.g. NestJS, or if we want to go lower level NodeJS). This way caching, DB, API's etc. and even client-generation for the Gateway to not deal with Api routes could easily be streamlined resulting in way faster engineering.

or is there a particular reason why we have set up things the way they are?

@InoMurko
Copy link
Contributor

Could we document the APIs we need to service the gateway? (and other services)
This goes well together with what @alvaro-ricotta was complaining about slow queries.

@wsdt
Copy link
Contributor Author

wsdt commented Aug 25, 2023

Sure! The APIs I'm aware of (some of them might be stale though and should be cleaned if not used otherwise)

ops_boba/api/metatransaction-api

Deployed as serverless for every function & every network each. Functions are:

  1. metaTransaction_getTestnetETH
  2. metaTransaction_swapBOBAForETH
  3. metaTransaction_swapNativeTokenForBOBA

ops_boba/api/watcher-api

Deployed as serverless for every function & network to serve the bridge history etc.
These services are then even dependent on ops_boba/api/monitor to fill the database with transactions so that the watcher-api can return them.

This could be either solved by using TheGraph (which would be the plan anyway now for Teleportation) or by having one backend instead of all these serverless functions that partially continiously run anyway.

  • watcher_getL1Transactions.py
  • watcher_getL2CrossDomainMessage.py
  • watcher_getL2Deployments.py
  • watcher_getL2PendingExits.py
  • watcher_getL2Transactions.py
  • watcher_getLayerZeroTransactions.py
  • watcher_initiateL1Airdrop.py
  • watcher_sendCrossDomainMessage.py

And most of these has a corresponding monitor within ops_boba/monitor/.


GraphQL

For governorProposalCreated and now with Teleportation we rely on TheGraph to index events (as discussed a few ago in our weekly).

Since we are extending our TheGraph support for (Boba) BNB etc. we could possibly rely more on that instead of all the watcher APIs.


CDN / Images

Some SVGs seem to be hosted on Boba Foundations github repository, such as:

We could consider a CDN or something similar in future.


Base Services (Gateway)

These APIs could potentially be included into a backend & cached to on one side reduce API requests & reduce the amount of API requests conducted by the enduser (e.g. aggregating into one request if possible, or batching them together etc) + client/server side caching in general.


Client-side rendering (React)

If speed is an issue in general, we could think about introducing SSR (Server side rendering) for our gateway, which would drastically improve SEO and performance. This wouldn't be an easy lift though.


Not necessarily used by the Gateway (or at least only mainnet), but could also be integrated into a potential backend:

  • ops_boba/api/token-api

@InoMurko hope it helps!

@jemeza jemeza transferred this issue from bobanetwork/boba_legacy Oct 6, 2023
@sk-enya sk-enya transferred this issue from bobanetwork/gateway Jan 26, 2024
@sk-enya
Copy link
Contributor

sk-enya commented Jan 26, 2024

This seems to be more over backend api related work so moved back to boba!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants