explorer icon indicating copy to clipboard operation
explorer copied to clipboard

Transaction incorrectly displays failed when pending/in microblock

Open aulneau opened this issue 2 years ago • 5 comments

This transaction https://stacks-node-api.mainnet.stacks.co/extended/v1/tx/0xb64634c56dd0bdd5cc4695b05d7dc3fe64edabb40a46610d6573041f9dade3e7

shows as pending in the api:

{
  "tx_id": "0xb64634c56dd0bdd5cc4695b05d7dc3fe64edabb40a46610d6573041f9dade3e7",
  "nonce": 163,
  "fee_rate": "17177",
  "sender_address": "SP1X6M947Z7E58CNE0H8YJVJTVKS9VW0PHD4Q0A5F",
  "sponsored": false,
  "post_condition_mode": "deny",
  "post_conditions": [],
  "anchor_mode": "any",
  "tx_status": "pending",
  "receipt_time": 1663187870,
  "receipt_time_iso": "2022-09-14T20:37:50.000Z",
  "tx_type": "smart_contract",
  "smart_contract": {
    "contract_id": "SP1X6M947Z7E58CNE0H8YJVJTVKS9VW0PHD4Q0A5F.space-cats",
    "source_code": "REMOVED FOR BREVITY"
  }
}

but the explorer states it failed:

Screen Shot 2022-09-14 at 3 43 43 PM

aulneau avatar Sep 14 '22 20:09 aulneau

Seems like it actually failed in micro-block, but the UI doesn't include any of that data

aulneau avatar Sep 14 '22 20:09 aulneau

@aulneau we only display failed state if tx_status is either 'abort_by_response' or 'abort_by_post_condition' https://github.com/hirosystems/explorer/blob/4dbeb6758e026c99d9181555af900a7751e06e6f/src/common/utils/transactions.ts#L4-L18 regarding error details, API currently only provides what node sends via RPC messages image

He1DAr avatar Sep 16 '22 13:09 He1DAr

i mean it's clear in the screenshot that this state produces a broken view:

  • transaction response from api without unanchored=false (or omitted) status is pending
  • transaction response from api without unanchored=true status is abort_by_response
  • when this happens, the explorer using the incorrect block height

What I would recommend for this fix is to have a new status "Failed in microblock" similar to how you have "confirmed in microblock". Additionally, I'd update the block identifier to display which microblock hash it's in

aulneau avatar Sep 16 '22 22:09 aulneau

@He1DAr Is this change still desired? If so.. shall i take up this issue?

shamim-io avatar May 10 '23 20:05 shamim-io

@shamim-io Yes please 🙏 It'd be great to improve the tx status information

andresgalante avatar Jun 20 '23 01:06 andresgalante