0

I'm currently using substrate (version 4) with the contrat-pallet. I deploy contract in wasm, compiled from solidity (thanks to solang compiler) and sometimes, when executing a method of the smart contract, I encounter an error. When I take a look on the polkadotjs apps I have the following message :

enter image description here

But this message is not so explicit and doesn't help to figure out how to solve the problem.

Furthermore, the output of the polkadotjs api when I run this code :

contract.tx.method({ storageDepositLimit, gasLimit })
.signAndSend(pair, result => {
    if (result.status.isFinalized) {
        return result.toHuman()
    }
})

is not really more explicit :

{
  dispatchError: { Module: { index: '9', error: '0x0b000000' } },
  dispatchInfo: { weight: '80,051,097,517', class: 'Normal', paysFee: 'Yes' },
  events: [
    { phase: [Object], event: [Object], topics: [] },
    { phase: [Object], event: [Object], topics: [] }
  ],
  internalError: undefined,
  status: {
    Finalized: '0x2e6cfa203369435efd17144525e265508e801865baf7d8f8989883a553ddf4b8'
  }
}

By experience, this kind of errors can occurs when a "require" from the solidity smart contract doesn't pass. But I don't have any details and I don't find how to get the require output message from the smart contract.

Is there any way to get more detail on error to know what is going on ? To get the message from the "require" in the solidity smart contract ? To know from what part it came from ?

Thanks !

5
  • Before you do a transaction (tx) perform a query to get errors and debug messages from the substrate contracts node.
    – forgetso
    Jul 13, 2022 at 15:58
  • Does this answer your question? Ink! ink_env::debug_println! does not work if message is payable
    – forgetso
    Jul 13, 2022 at 15:58
  • Thanks for your answer @forgesto. I tried to query the contract to get errors but the debugMessage is empty while it should contains the message from the require of my solidity smart contract. Do you think this issue came from the solang compiler ? Jul 15, 2022 at 8:53
  • I'm not sure. Are you doing a cross contract call and can you share contract code? This is what the index and error relate to.
    – forgetso
    Jul 18, 2022 at 18:19
  • To get the error in a meaningful format, do something like this
    – forgetso
    Jul 18, 2022 at 18:29

1 Answer 1

1

Currently it is not yet possible to view the error message directly in the polkadot.js UI. To see your error message from the require statement you need to:

  • Compile solang yourself from the latest master branch and use that. We added this feature recently and it is not yet released (it will be in V 0.2).
  • Make sure your node is configured to display the debug buffer, as described here.

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.