rooch-network / rooch

VApp Container with Move Language for Bitcoin ecosystem
https://rooch.network
Apache License 2.0
164 stars 87 forks source link

proposal: push error map onchain and show abort reason when txn failed. #2675

Open pause125 opened 2 months ago

pause125 commented 2 months ago

Proposal Details

Fow now, if a txn fails, the output message is like:

    "status": {
      "type": "moveabort",
      "location": "0x2::module_store",
      "abort_code": "2"
    }

or

    "vm_error_info": {
      "error_message": "VMError with status ABORTED with sub status 2 at location Module ModuleId { address: 0000000000000000000000000000000000000000000000000000000000000002, name: Identifier(\"module_store\") } and message 0x0000000000000000000000000000000000000000000000000000000000000002::module_store::publish_package_entry at offset 62 at code offset 62 in function definition 25",
      "execution_state": []
    }

The developer need to check the source file for the reason or use rooch move explain to expain framework's abort reason. And what's more to auto explain the reason to end user.

Proposal Can we store error map onchain when publishing modules, and then add an abort reason field in the transation output?

jolestar commented 2 months ago

We can explain the error code in the vm_error_info