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
feat: add endpoint to get names count #1737
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no need to add a new endpoint, this is already exposed via totalstats endpoint here https://testnet.aeternity.io/mdw/v3/totalstats
with {:ok, filters} <- Util.convert_params(query, &convert_param/1) do | ||
filters | ||
|> build_height_streamer(state, nil, nil, nil) | ||
|> then(fn streamer -> streamer.(:backward) end) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this going to go through all of the names? There's no limit to how many names there could be, this could take a lot of time
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a slow query yeah, but the idea is so that this can be used to get all active names owned by an account. The problem with counting the results from the regular endpoint is that it's paginated and can't be counted
Yeah, but it can't be filtered on based on the owner |
@yaboiishere we cannot add endpoints that expose features that can be easily exploited. We also shouldn't be adding any pagination counters, that's database dependent and our current database doesn't allow it. |
So i should reimplement this in some other way. Maybe it can something like the account balances where a Genserver keeps track of those and it gets updated on every relevant mutation? |
The proper way of implementing this would be to add a new index that keeps track of all of the counters for all accounts, which will increase the size of the database. And if we do that for every paginated endpoint we will end up with a database double or triple the size, so we should avoid implementing these features |
ref: #1629