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

More transaction controllers improvements #2249

Merged
merged 3 commits into from
Jul 3, 2019

Conversation

pasqu4le
Copy link
Contributor

@pasqu4le pasqu4le commented Jun 26, 2019

Motivation

All the transactions-related controllers that were not considered by #2111 have been analyzed for potential improvements. Complete list:

  • TransactionController
  • TransactionInternalTransactionController
  • TransactionLogController
  • TransactionRawTraceController
  • TransactionTokenTransferController
  • RecentTransactionsController
  • PendingTransactionController
  • BlockTransactionController
  • API.RPC.TransactionController

Changelog

Enhancements

These are the changes produced after going over the above list of controllers:

  • the order_by in Explorer.Chain.recent_collated_transactions has been removed because it is already included in fetch_transactions
  • TransactionController.show has been refactored to use the with syntax, just like most others
  • Explorer.Chain.hash_to_transaction now builds a query from Transaction instead of fetch_transactions, because the latter has an ordering that is not useful
  • Explorer.Chain.transaction_has_token_transfers has been changed to use Repo.exists?
  • TransactionRawTraceController.index has been simplified by removing a list of association used in Chain.transaction_to_internal_transactions that was not necessary
  • Explorer.Chain.transaction_to_internal_transactions has also been modified to not preload transaction: :block by default, because the controller above does not need it
  • in BlockTransactionController.index's association list for Chain.block_to_transactions, :block has been made optional, because using required adds a duplicate inner join to the query

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

@pasqu4le pasqu4le self-assigned this Jun 26, 2019
@pasqu4le pasqu4le added ready for review This PR is ready for reviews. and removed in progress labels Jun 26, 2019
@coveralls
Copy link

coveralls commented Jun 26, 2019

Pull Request Test Coverage Report for Build e0951e66-f170-4ac3-84fb-528f76ebdb70

  • 10 of 11 (90.91%) changed or added relevant lines in 3 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+0.1%) to 81.263%

Changes Missing Coverage Covered Lines Changed/Added Lines %
apps/block_scout_web/lib/block_scout_web/controllers/transaction_raw_trace_controller.ex 0 1 0.0%
Files with Coverage Reduction New Missed Lines %
apps/block_scout_web/lib/block_scout_web/channels/exchange_rate_channel.ex 1 50.0%
Totals Coverage Status
Change from base Build 454cc787-edb7-4143-8899-128f9b4c84ed: 0.1%
Covered Lines: 5122
Relevant Lines: 6303

💛 - Coveralls

@pasqu4le pasqu4le force-pushed the more-transaction-controllers-improvements branch from 1c627a9 to cccbf12 Compare June 28, 2019 12:16
vbaranov pushed a commit that referenced this pull request Jul 1, 2019
@vbaranov vbaranov merged commit 0709ed1 into master Jul 3, 2019
@vbaranov vbaranov deleted the more-transaction-controllers-improvements branch July 3, 2019 09:00
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