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

Fix pagination for bridged tokens list page #3329

Merged
merged 1 commit into from
Oct 5, 2020

Conversation

vbaranov
Copy link
Member

@vbaranov vbaranov commented Oct 5, 2020

Motivation

An error like this on loading of bridged tokens list with the length > page_size:

blockscout-xdai    | Request: GET /bridged-tokens?type=JSON
blockscout-xdai    | ** (exit) an exception was raised:
blockscout-xdai    |     ** (FunctionClauseError) no function clause matching in BlockScoutWeb.Chain.paging_params/1
blockscout-xdai    |         (block_scout_web 0.0.1) lib/block_scout_web/chain.ex:215: BlockScoutWeb.Chain.paging_params([%Explorer.Chain.Token{__meta__: #Ecto.Schema.Metadata<:loaded, "tokens">, bridged: true, cataloged: true, contract_address: %Explorer.Chain.Address{__meta__: #Ecto.Schema.Metadata<:loaded, "addresses">, contract_code: %Explorer.Chain.Data{bytes: <<96, 128, 96, 64, 82, 96, 4, 54, 16, 96, 62, 87, 99, 255, 255, 255, 255, 124, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...>>}, contracts_creation_internal_transaction: #Ecto.Association.NotLoaded<association :contracts_creation_internal_transaction is not loaded>, contracts_creation_transaction: #Ecto.Association.NotLoaded<association :contracts_creation_transaction is not loaded>, decompiled: false, decompiled_smart_contracts: #Ecto.Association.NotLoaded<association :decompiled_smart_contracts is not loaded>, fetched_coin_balance: #Explorer.Chain.Wei<0>, fetched_coin_balance_block_number: 12327760, has_decompiled_code?: nil, hash: %Explorer.Chain.Hash{byte_count: 20, bytes: <<152, 94, 20, 78, 179, 85, 39, 60, 75, 77, 81, 228, 72, 182, 139, 101, 127, 72, 46, 38>>}, inserted_at: ~U[2020-08-26 18:17:40.955820Z], names: #Ecto.Association.NotLoaded<association :names is not loaded>, nonce: nil, smart_contract: #Ecto.Association.NotLoaded<association :smart_contract is not loaded>, stale?: nil, token: #Ecto.Association.NotLoaded<association :token is not loaded>, updated_at: ~U[2020-08-26 18:17:40.955820Z], verified: false}, contract_address_hash: %Explorer.Chain.Hash{byte_count: 20, bytes: <<152, 94, 20, 78, 179, 85, 39, 60, 75, 77, 81, 228, 72, 182, 139, 101, 127, 72, 46, 38>>}, decimals: #Decimal<18>, holder_count: 1, inserted_at: ~U[2020-08-26 18:17:40.955820Z], name: "POA ERC20 on Foundation on xDai", symbol: "POA20", total_supply: #Decimal<1000000000000000000>, type: "ERC-20", updated_at: ~U[2020-08-28 20:51:57.075848Z]}, %Explorer.Chain.BridgedToken{__meta__: #Ecto.Schema.Metadata<:loaded, "bridged_tokens">, custom_metadata: nil, foreign_chain_id: #Decimal<1>, foreign_token_contract_address_hash: %Explorer.Chain.Hash{byte_count: 20, bytes: <<103, 88, 183, 212, 65, 169, 115, 155, 152, 85, 43, 55, 55, 3, 216, 211, 209, 79, 158, 98>>}, home_token_contract_address: #Ecto.Association.NotLoaded<association :home_token_contract_address is not loaded>, home_token_contract_address_hash: %Explorer.Chain.Hash{byte_count: 20, bytes: <<152, 94, 20, 78, 179, 85, 39, 60, 75, 77, 81, 228, 72, 182, 139, 101, 127, 72, 46, 38>>}, inserted_at: ~U[2020-08-28 20:51:56.826848Z], type: "omni", updated_at: ~U[2020-08-28 20:51:56.826848Z]}])
blockscout-xdai    |         (block_scout_web 0.0.1) lib/block_scout_web/chain.ex:98: BlockScoutWeb.Chain.next_page_params/3
blockscout-xdai    |         (block_scout_web 0.0.1) lib/block_scout_web/controllers/tokens/bridged_tokens_controller.ex:19: BlockScoutWeb.BridgedTokensController.index/2
blockscout-xdai    |         (block_scout_web 0.0.1) lib/block_scout_web/controllers/tokens/bridged_tokens_controller.ex:1: BlockScoutWeb.BridgedTokensController.action/2
blockscout-xdai    |         (block_scout_web 0.0.1) lib/block_scout_web/controllers/tokens/bridged_tokens_controller.ex:1: BlockScoutWeb.BridgedTokensController.phoenix_controller_pipeline/2
blockscout-xdai    |         (phoenix 1.5.4) lib/phoenix/router.ex:352: Phoenix.Router.__call__/2
blockscout-xdai    |         (phoenix 1.5.4) lib/phoenix/router/route.ex:41: Phoenix.Router.Route.call/2
blockscout-xdai    |         (phoenix 1.5.4) lib/phoenix/router.ex:352: Phoenix.Router.__call__/2

Changelog

Add missing clause for paging_params function

Checklist for your Pull Request (PR)

@vbaranov vbaranov force-pushed the vb-fix-pagination-for-bridged_tokens branch from ea99087 to 0df2160 Compare October 5, 2020 07:46
@coveralls
Copy link

coveralls commented Oct 5, 2020

Pull Request Test Coverage Report for Build 0df2160963578ab926b45065067ac3016f472cde-PR-3329

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 7 unchanged lines in 3 files lost coverage.
  • Overall coverage increased (+3.4%) to 74.53%

Files with Coverage Reduction New Missed Lines %
lib/block_scout_web/controllers/chain/market_history_chart_controller.ex 2 71.43%
lib/block_scout_web/notifier.ex 2 84.52%
lib/block_scout_web/chain.ex 3 83.33%
Totals Coverage Status
Change from base Build 4565b1af2c97fc4ff9d7bb8740f2b5cd39d418c8: 3.4%
Covered Lines: 1981
Relevant Lines: 2658

💛 - Coveralls

@vbaranov vbaranov merged commit f04fe57 into master Oct 5, 2020
@vbaranov vbaranov deleted the vb-fix-pagination-for-bridged_tokens branch October 5, 2020 08:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants