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

Parse receipts reason in a better way #440

Closed
luizstacio opened this issue Aug 5, 2022 · 4 comments · Fixed by #456
Closed

Parse receipts reason in a better way #440

luizstacio opened this issue Aug 5, 2022 · 4 comments · Fixed by #456
Assignees
Labels
feat Issue is a feature

Comments

@luizstacio
Copy link
Member

luizstacio commented Aug 5, 2022

Motivation

Today when a transaction fails, we do not parse the reason in a proper way, making it very difficult to debug errors.

Receipt output example

[
  {
    "type": "Panic",
    "id": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "reason": "733327132687597568",
    "pc": "12336",
    "is": "10352"
  },
  {
    "type": "ScriptResult",
    "result": "2",
    "gasUsed": "14773"
  }
]

edit: Hex string for the panic here is 0x000000000000000300000000000000000000000000000000000000000000000000000000000000000a2d4d245000000000000000000030300000000000002870
We should parse "reason": "733327132687597568", to the proper enum issue name https://docs.rs/fuel-asm/latest/fuel_asm/enum.PanicReason.html.

@luizstacio luizstacio added the feat Issue is a feature label Aug 5, 2022
@luizstacio luizstacio changed the title Parse reason receipts in a better way Parse receipts reason in a better way Aug 5, 2022
@QuinnLee
Copy link
Contributor

QuinnLee commented Aug 8, 2022

Can i take this issue?

@luizstacio
Copy link
Member Author

Can I take this issue?

I just assigned it to you!

@QuinnLee
Copy link
Contributor

QuinnLee commented Aug 12, 2022

I parsed Panic Receipts from tests where fuel core returns an error and the decoded values do not make sense.

0x0000000000000003
00000000000000000000000000000000000000000000000000000000000000000a2d4d245000000000000000000030300000000000002870

a2d4d2450000000 is the encoded reason, but decoding it doesn't make sense because the values should be between 0-255; decoded value is 733327132687597568

Is there a different way to decode the value or parse the resulting number?

Docs
https://github.com/FuelLabs/fuel-specs/blob/8bb43ae61aab69e72275c004792aef34efed1d9b/specs/protocol/abi.md#panic-receipt

https://docs.rs/fuel-asm/latest/fuel_asm/enum.PanicReason.html

@QuinnLee QuinnLee linked a pull request Aug 15, 2022 that will close this issue
@QuinnLee
Copy link
Contributor

QuinnLee commented Aug 16, 2022

I think we are handling the graphql response incorrectly. I looked at the requests via wireshark and I can see the correct reason. I'll dig into this more

Screen Shot 2022-08-16 at 7 22 04 AM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat Issue is a feature
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants