sporeprotocol/spore-contract

Unknown error when creating a Spore (applying a Mutant)

ShookLyngs opened this issue · 2 comments

Description

I created a Mutant and attempted to create a Spore to apply the Mutant, but encountered an error 100 (Unknown).

Based on this error, I can identify two issues:

  • The error 100 (Unknown) is unclear. Is it possible to throw the exact error code from lua-vm or ckb.exit_script(code) to provide more specific information?
  • The lua code contained in the Mutant seems to be capable of functioning correctly, I am unsure why it failed. Is it possible that something went wrong in the Mutant contract itself? Or can anyone help review the lua code?

More info

The Mutant's lua code:

if spore_ext_mode == 2 then
  ckb.exit_script(10086)
end

The Mutant's OutPoint (view on Explorer):

{
  "tx_hash": "0xf4354a508d130a2d28db03654c37cef8eb67a8cd0defe830f01af2bb1a5fa5fd",
  "index": "0x0"
}

The new Sproe's output (from the transaction that failed):

{
  "capacity": "0x5ae5a7400",
  "lock": {
    "code_hash": "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8",
    "hash_type": "type",
    "args": "0x6cd8ae51f91bacd7910126f880138b30ac5d3015"
  },
  "type": {
    "code_hash": "0xd0d46552fc27b489425bb8f72ea9a371df49c978b27e1e7e8bffe6f9c72560c6",
    "hash_type": "data1",
    "args": "0x1a4482480b9f0ac92d59e4cdcf9fa6d153bf82bc45906dc1b6498ed1485db6e4"
  }
}

@ShookLyngs please restrict error code from Lua in range [-127, 0), which is only covered by i8, because CKB contract requires the type of returned value should be i8

@ShookLyngs please restrict error code from Lua in range [-127, 0), which is only covered by i8, because CKB contract requires the type of returned value should be i8

I'll fix the error code and try again. By the way, do you think this is the same issue as #17?