-
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
Controllers Improvements #2391
Controllers Improvements #2391
Conversation
63b3e4b
to
cb0a06d
Compare
Pull Request Test Coverage Report for Build 99ac9c93-55e6-480d-a66e-101d03c86a7a
💛 - Coveralls |
Problem: a lot of function take an entity as an parameter, but only use its hash/id. This makes tracing the necessary scope of functions harder and is one of the cause for unnecessary queries/code execution. Solution: refactor these functions to take only a hash (or an id).
Problem: some controller retrieves entire entities from the database when it only needs to check their existence. Solution: provide Exploerer.Chain functions to check for existence and use them where possible.
cb0a06d
to
4a46e6e
Compare
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.
LGTM but I have a little question
@spec query_verified_contract(Hash.Address.t(), functions()) :: functions_results() | ||
def query_verified_contract(address_hash, functions) do | ||
@spec query_verified_contract(Hash.Address.t(), functions(), SmartContract.abi() | nil) :: functions_results() | ||
def query_verified_contract(address_hash, functions, mabi \\ nil) do |
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.
What does mabi
mean?
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.
Oh I gave it that name for m
aybe abi
(because it can be nil
) so that a few lines down the code is abi = ...
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.
@pasqu4le could you guide me which pages are mainly affected by this update to put my eyes on them from the performance point of view?
@vbaranov sure. The first commit should have the biggest impact among the 3, pages affected are:
The second commit does not directly affect performances, but was necessary for the following one. The third commit has a smaller impact, on these pages:
|
Motivation
after #2111, #2249, #2216 and #2305 a few remaining controllers still have not been checked for possible improvements.
This PR is the result of going trough all these controllers.
Changelog
There are 3 separate commits:
Explorer.Chain
functions to only take an hash/id where possible, just like it was done for AddressesExploerer.Chain
to only check for the existence of an entityChecklist for your PR
CHANGELOG.md
with this PR