2

Ink contract Transaction emit errors with hex code. How to map that to the actual error and get a trace of error in the contract?

enter image description here

2
  • Error decodes to 27 if you remove the 6 trailing zeroes. This is the 27th error in whatever module 70 refers to. Which chain are you using? I can't find a module with index 70 in my default substrate node.
    – forgetso
    Feb 1, 2023 at 15:10
  • Additonal info here
    – forgetso
    Feb 1, 2023 at 15:16

1 Answer 1

1

As @forgetso says in the comment you can decode the error index to get the number. You can use the Substrate Utilities to get the number 27, and then go to your runtime to check which pallet is the 70 in your runtime. Find in your node the macro construct_runtime! (example of the node template). You should note the the order in which pallets are listed in the construct_runtime! macro is significant. By default, the pallet index starts at zero for the first pallet and is incremented for each pallet thereafter.

Because you are talking about an ink! contract probably is the pallet_contracts, so the error may be this:

    /// The contract's code was found to be invalid during validation or instrumentation.
    ///
    /// The most likely cause of this is that an API was used which is not supported by the
    /// node. This hapens if an older node is used with a new version of ink!. Try updating
    /// your node to the newest available version.
    ///
    /// A more detailed error can be found on the node console if debug messages are enabled
    /// by supplying `-lruntime::contracts=debug`.
    CodeRejected,

Check this previous answer on StackExchange for more information about get the error.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.