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

Improve Address controllers #2305

Merged
merged 2 commits into from
Jul 9, 2019
Merged

Conversation

pasqu4le
Copy link
Contributor

@pasqu4le pasqu4le commented Jul 5, 2019

Motivation

This is yet another step in checking controllers for improvements.
In particular this time Address controllers were checked and this (mostly refactoring) changes were made:

Changelog

  • a few calls to Explorer.Chain.hash_to_address were modified to avoid useless preloads where possible
  • Explorer.Chain.find_or_insert_address_from_hash was modified for the very same reason, because it calls the previous function
  • Explorer.Chain.address_to_logs has been modified to have a more legible where clause
  • both Explorer.Chain.hash_to_address and Explorer.Chain.token_from_address_hash were modified to support necessity_by_association_options for consistency

This is the complete list of the controllers that were analyzed for possible improvements:

  • AddressCoinBalanceByDayController
  • AddressCoinBalanceController
  • AddressContractController
  • AddressContractVerificationController
  • AddressController
  • AddressDecompiledContractController
  • AddressInternalTransactionController
  • AddressLogsController
  • AddressReadContractController
  • AddressTokenBalanceController
  • AddressTokenController
  • AddressValidationController
  • API.RPC.AddressController

Checklist for your PR

  • I added an entry to CHANGELOG.md with this PR
  • If I added new functionality, I added tests covering it.
  • If I fixed a bug, I added a regression test to prevent the bug from silently reappearing again.
  • I checked whether I should update the docs and did so if necessary

This is yet another step in checking controllers for improvements.
In particular this time Address controllers were checked and this (mostly refactoring) changes were made:
- a few calls to `Explorer.Chain.hash_to_address` were modified to avoid useless preloads where possible
- `Explorer.Chain.find_or_insert_address_from_hash` was modified for the very same reason, because it calls the previous function
- `Explorer.Chain.address_to_logs` has been modified to have a more legible where clause
- both `Explorer.Chain.hash_to_address` and `Explorer.Chain.token_from_address_hash` were modified to support `necessity_by_association_option`s for consistency
@pasqu4le pasqu4le force-pushed the pp-address-controllers-improvements branch from 6e3883e to 54a1010 Compare July 5, 2019 16:24
@pasqu4le pasqu4le self-assigned this Jul 5, 2019
@pasqu4le pasqu4le added the ready for review This PR is ready for reviews. label Jul 5, 2019
@coveralls
Copy link

coveralls commented Jul 5, 2019

Pull Request Test Coverage Report for Build c7b221ca-6698-4627-a520-b19b5e1b11f1

  • 23 of 29 (79.31%) changed or added relevant lines in 13 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.001%) to 80.955%

Changes Missing Coverage Covered Lines Changed/Added Lines %
apps/block_scout_web/lib/block_scout_web/controllers/address_validation_controller.ex 0 1 0.0%
apps/explorer/lib/explorer/chain.ex 8 9 88.89%
apps/block_scout_web/lib/block_scout_web/controllers/address_logs_controller.ex 0 2 0.0%
apps/block_scout_web/lib/block_scout_web/controllers/tokens/transfer_controller.ex 0 2 0.0%
Totals Coverage Status
Change from base Build 6025904c-b69f-4e35-b58a-e5dfaa8665c1: 0.001%
Covered Lines: 5169
Relevant Lines: 6385

💛 - Coveralls

vbaranov added a commit that referenced this pull request Jul 8, 2019
@vbaranov vbaranov merged commit 09e69ef into master Jul 9, 2019
@vbaranov vbaranov deleted the pp-address-controllers-improvements branch July 9, 2019 11:51
pasqu4le added a commit that referenced this pull request Jul 19, 2019
Problem: after #2111, #2249, #2216 and #2305 a few remaining controllers still have not been checked for possible improvements.

Solution: check them and remove unnecessary preloads and queries.
@pasqu4le pasqu4le mentioned this pull request Jul 19, 2019
4 tasks
pasqu4le added a commit that referenced this pull request Jul 19, 2019
Problem: after #2111, #2249, #2216 and #2305 a few remaining controllers still have not been checked for possible improvements.

Solution: check them and remove unnecessary preloads and queries.
pasqu4le added a commit that referenced this pull request Jul 19, 2019
Problem: after #2111, #2249, #2216 and #2305 a few remaining controllers still have not been checked for possible improvements.

Solution: check them and remove unnecessary preloads and queries.
vbaranov pushed a commit that referenced this pull request Jul 23, 2019
Problem: after #2111, #2249, #2216 and #2305 a few remaining controllers still have not been checked for possible improvements.

Solution: check them and remove unnecessary preloads and queries.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready for review This PR is ready for reviews.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants