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

Hotfix for optimism_withdrawal_transaction_status function #8822

Merged
merged 2 commits into from Nov 14, 2023

Conversation

varasev
Copy link
Contributor

@varasev varasev commented Nov 13, 2023

Motivation

This change fixes the following error:

Request: GET /api/v2/transactions/0xc2f1dc7be06c8580bb233e97a736b1fd15cb5cd4274ffd21e1119cf7f3e076d0
** (exit) an exception was raised:
    ** (Ecto.MultipleResultsError) expected at most one result but got 2 in query:

from o0 in Explorer.Chain.OptimismWithdrawal,
  left_join: b1 in Explorer.Chain.Block,
  on: o0.l2_block_number == b1.number,
  left_join: o2 in Explorer.Chain.OptimismWithdrawalEvent,
  on: o2.withdrawal_hash == o0.hash and o2.l1_event_type == :WithdrawalFinalized,
  where: o0.l2_transaction_hash ==
  ^%Explorer.Chain.Hash{byte_count: 32, bytes: <<194, 241, 220, 123, 224, 108, 133, 128, 187, 35, 62, 151, 167, 54, 177, 253, 21, 203, 92, 212, 39, 79, 253, 33, 225, 17, 156, 247, 243, 224, 118, 208>>},
  select: %{hash: o0.hash, l2_timestamp: b1.timestamp, l1_transaction_hash: o2.l1_transaction_hash}

        (ecto 3.10.3) lib/ecto/repo/queryable.ex:154: Ecto.Repo.Queryable.one/3
        (explorer 5.3.1) lib/explorer/chain.ex:2216: Explorer.Chain.optimism_withdrawal_transaction_status/1
        (block_scout_web 5.3.1) lib/block_scout_web/views/api/v2/transaction_view.ex:574: BlockScoutWeb.API.V2.TransactionView.add_optimism_fields/3
        (block_scout_web 5.3.1) lib/block_scout_web/views/api/v2/transaction_view.ex:429: BlockScoutWeb.API.V2.TransactionView.prepare_transaction/6
        (phoenix 1.5.14) lib/phoenix/view.ex:472: Phoenix.View.render_to_iodata/3
        (phoenix 1.5.14) lib/phoenix/controller.ex:777: Phoenix.Controller.render_and_send/4
        (block_scout_web 5.3.1) lib/block_scout_web/controllers/api/v2/transaction_controller.ex:1: BlockScoutWeb.API.V2.TransactionController.action/2
        (block_scout_web 5.3.1) lib/block_scout_web/controllers/api/v2/transaction_controller.ex:1: BlockScoutWeb.API.V2.TransactionController.phoenix_controller_pipeline/2

Checklist for your Pull Request (PR)

@@ -13,6 +13,7 @@

### Fixes

- [#8822](https://github.com/blockscout/blockscout/pull/8822) - Hotfix for optimism_withdrawal_transaction_status function
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to add changelog in OP branch? cc @vbaranov

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's keep it. We will eventually merge it to master branch.

@vbaranov vbaranov merged commit 316ebb1 into production-optimism-stg Nov 14, 2023
8 of 13 checks passed
@vbaranov vbaranov deleted the va-hotfix-op-withdrawal-status branch November 14, 2023 07:28
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

3 participants