-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Staking pools fetching #1801
Staking pools fetching #1801
Conversation
Pull Request Test Coverage Report for Build 3ae0afae-1dc3-41e8-8514-f3e981150d28
💛 - Coveralls |
|
||
defp call_staking_method(method, params) do | ||
%{^method => resp} = | ||
Reader.query_contract(config(:staking_contract_address), abi("staking.json"), %{ |
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.
Might be good to put these in module attributes since they are constants.
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.
@zachdaniel Are you about the contract address?
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.
No, the abi file names.
I approved just based on the code itself, but I'm not really familiar with DApps themselves, so others will definitely want to weigh in on that aspect. |
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.
From what I see, you make 2 + 9 * N
(where N
is total count of pools) of eth_call
requests once on the launch, and then after every new block import. Method calls can and should be batched together to reduce request overhead.
Also, I'm not sure of how POSDAO works, but is it really necessary to query each and every existing pool after each and every incoming block? Is it maybe possible to gather a list of updated pools from
block content?
|> Map.put(:mining_address, mining_address) | ||
|
||
%{ | ||
name: "anonymous", |
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.
This will replace any existing name with anonymous
, according to import runner, won't it?
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.
In staking app pools are all anonymous
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.
Okay, I assumed there is a way to manually specify a name for certain well-known addresses.
Are there examples of how to batch?
No, from block content only able to get few events but they aren't enough. But as I know in the future will be one contract method for getting full data about a pool by one call. |
Currently only token balance requests get batched, see The basic idea is to use
Sad. Even more reason to batch requests as much as possible. |
@goodsoft I've added batching requests. Could you look at this? |
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 would be ideal to batch queries even more, i.e. include multiple pool queries in one requests.
But it's already 3-4 times less requests than initially.
@vbaranov we'll need to compare app server and node performance before and after deploying this PR. If the amount of requests will cause too much of a burden, we'll need to improve batching.
@goodsoft I suppose it shouldn't affect any instance (except POSDAO) as pools fetcher will be switched off by default. Meanwhile, sure, I will check performance on POSDAO instance when we will be ready to deploy it. |
Set blockscout to work with staking app in POSDAO network
This PR for fetching staking pools from POSDAO network.
I added:
Required variables:
To run fetcher you need to enable it in the
indexer/config/config.exs
:Also you need to disable BlockReward supervisor