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

Thank you! (please read) #6

Open
jasbanza opened this issue Apr 21, 2022 · 7 comments
Open

Thank you! (please read) #6

jasbanza opened this issue Apr 21, 2022 · 7 comments

Comments

@jasbanza
Copy link

jasbanza commented Apr 21, 2022

@tombeynon WOW! 🏆

I'm so glad I just happened to see your comment in an email from watching the cosmos/chain-registry!!!

I recently started my own CORS proxy for API endpoints in the chain-registry... (thinking none existed yet) since it has become a necessity for using in my own projects (mostly because I don't want to rely on others for API aggregation uptime / breaking changes.)

So many thanks for making this, you've saved me a lot of time (I've also realized this would have taken me months to do with my lack of experience)

So, because this is a weight lifted from my shoulders, you've enabled me to focus on continuing to building my own stuff. I'll contribute where I can (ideas/bugs report/suggestions/patches...). Let me know if there's anything else I could do (not sure what, perhaps feedback at least!)

I noticed in the readme that it's still MVP and API structure could break. I'll just fork it and watch for changes :)

Thanks again!
Jason

@tombeynon
Copy link
Contributor

@jasbanza this comment totally made my day! I've had the idea for cosmos directory for a while but went through the same issue as you building restake, and it sort of forced me to build out the core of this. As soon as I realised how useful it could be I had to publish it but as you saw in the docs.. it is early days!

Super excited to have someone like you actually using it though and pushing it's limits a bit. There's SO much this can do, I have a huge list of ideas which I'll move into Issues so it's a bit more public and I can't wait to hear some of your ideas/bugs.

In terms of actual production use, it's working surprisingly well. In the last 24h it processed 21.4 million requests for REStake.app lol. Obviously the nodes are doing the bulk of the work but the proxy stands up well to a lot. However... it does experience event loop lag that grows over time with this many requests. I've not got to the bottom of this yet, but I use pm2 and ecosystem-production.json to restart the processes every few hours/as memory grows which is pretty graceful.

I've not actually shouted about it too much so I'm really glad you found it. I've got a couple extra features I want to add first but I don't expect to change any existing API structures now. Please let me know any thoughts at all after using it ❤️

@jasbanza
Copy link
Author

jasbanza commented Apr 21, 2022

@tombeynon Thank you for your reply! Well, this has made my month haha.

Brilliant - I had no idea REStake was using it... until I noticed this repo was under eco-stake!

I have yet to delve into using this, but from what I've seen with cosmos.directory, Terra reports that there is no REST API, even though the chain-registry has one which seems live. Why is that?

@tombeynon
Copy link
Contributor

Part of cosmos.directory is health checking all those APIs as they can be very up and down, and it generally load balances across the most up to date/responsive at any given time. With Terra, the single REST API in registry stalled this morning.

You can see the last error and a few other stats on the cosmos.directory UI, or a bit more info via the API.

Actually Terra is a good example; if you refresh the latest block endpoint a few times you'll see it's already load balancing two nodes. Both are behind in this case, but often just one of many can be behind. Directory health checks pretty often to try to catch these, as they're a pain for restake etc.

@jasbanza
Copy link
Author

jasbanza commented Apr 21, 2022

An idea I had was to have a custom override API json config file ... (you might want to include keplr's endpoints for example)... not sure if you've thought of this, as it could make up for cases such as Terra where they have provided troublesome API / RPC

@tombeynon
Copy link
Contributor

Yea that's a great idea. I've thought a few times about a local config file, currently cosmos.directory uses the eco-stake fork of the chain registry which I initially used to add a couple of 'less' public nodes for REStake, but quickly decided that i should just publish my own. Now I just use the fork to merge PRs sooner than upstream.

This behaviour bit might actually be a bit restake specific tbh. My attitude with that is if I validate a network, I'll make sure the APIs are available. If I don't validate, it's up to validators/chains to provide APIs if they want REStake to work. Possibly doesn't translate as well to cosmos.directory, but equally I'm wary of using nodes for this/REStake without permission. Do Keplr publish theirs as 'public use' as far as you know?

@jasbanza
Copy link
Author

I noticed you added public eco-stake APIs throughout the chain-registry :)

Are you asking about Keplr RPC or REST? https://lcd-columbus.keplr.app
With regards to public usage, I can't say. I mean, it is exposed publicly since it is a wallet...

If my understanding is correct (correct me if I'm wrong): RPC APIs are normally more commonly kept private compared to REST APIs, due to their importance not to be overloaded.

So is it generally UNacceptable to use either without prior permission in an app?

@tombeynon
Copy link
Contributor

Yea that's my general attitude - would be fine to use Keplr APIs for 'personal' use but I'd hesitate to include them in cosmos.directory APIs.

As I understand it, the REST API is just a translation of the underlying RPC server, but I'm not 100% sure. I only publish nodes I'm okay with being overloaded either way, and generally assume the APIs in chain registry are fine to use. Hence the health checking tho 😂

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

2 participants