Today I saw this issue: starcoin#3450 at GitHub, I decide to give it a try.
The corresponding type VMStatus is defined out of starcoin’s reposiotry, here.
The work need to be done seems are:
- convert
function
fromu16
to a readable string. - convert
status_code
fromStatusCode
to a readable string.
Let’s take a look at StatusCode
first, StatusCode
is a enum
that contains lot of variants, WOW!
My intuition is that can we just get the name of the variant by it’s value. Or I’ll write an
ugly match
that contains tons of arms. Maybe there already existed some similar code, Let me do a search.
In further research, I found the related struct of this issue is KeptVMStatus
, starcoin returns it as TransactionStatusView
.
KeptVMStatus
is defined in move, at here. The variant ExecutionFailure
of it doesn’t contain status_code
and function_name
fields like VmStatus
does.
The status_code
was removed in this commit.
As the commit message says:
[vm] Filter StatusCodes away from TransactionOutput
- Changes the information kept in TransactionStatus
- Kept transactions have a new KeptVMStatus. Runtime errors have detailed information, but no error codes. All other errors are bucketed
- Discarded transactions have a StatusCode
Closes: #5071 Approved by: sblackshear
Emmm, how to get the detailed information from Runtime errors?