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 emitted events for Clarity post-conditions #4744

Open
wileyj opened this issue May 2, 2024 · 1 comment · May be fixed by #4814
Open

Improve emitted events for Clarity post-conditions #4744

wileyj opened this issue May 2, 2024 · 1 comment · May be fixed by #4814
Assignees
Labels
good first issue Appropriate for a new open source contribution. icebox Issues that are not being worked on

Comments

@wileyj
Copy link
Contributor

wileyj commented May 2, 2024

consider the following failed transaction:

$ curl -sL https://api.hiro.so/extended/v1/tx/0xe0a149de6e7f367449fff50e3fa86399d6d708273ab8dabe5bbd3ff380386624 | jq -r .post_conditions,.tx_status
[
  {
    "type": "fungible",
    "condition_code": "sent_equal_to",
    "amount": "300000000000",
    "principal": {
      "type_id": "principal_standard",
      "address": "SP..."
    },
    "asset": {
      "contract_name": "miamicoin-token-v2",
      "asset_name": "MIA",
      "contract_address": "SP1H1733V5MZ3SZ9XRW9FKYGEZT0JDGEB8Y634C7R"
    }
  }
]
abort_by_post_condition

in this example, the tx failed due to an incorrect asset_name being used MIA vs the expected miamicoin.

the emitted event that is consumed by the API (and then exposed to the explorer UI) is a bit too generic about why it has failed ("rolled back by a post condition", likely from the tx_status field the API is returning).

I propose adding some extra data to the event emitted by stacks-node, specifiying which (possibly any) post-condition is actually causing the tx to fail.
Once added, there will need to be changes downstream to the event_observers that process this event.

@wileyj wileyj added good first issue Appropriate for a new open source contribution. icebox Issues that are not being worked on labels May 2, 2024
@github-project-automation github-project-automation bot moved this to Status: 🆕 New in Stacks Core Eng May 2, 2024
@ldiego08
Copy link

@wileyj I wanted to give this one a try, if that's okay! I opened #4814, but could you (or someone else) give it a look and lmk if it's on the right track? If so, I'll update the impacted tests and improve the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Appropriate for a new open source contribution. icebox Issues that are not being worked on
Projects
Status: Status: 🆕 New
Development

Successfully merging a pull request may close this issue.

3 participants