1

I get this error running swanky contract tx flipper flip -a alice -g 1000000000. I have increased the gas, I have no clue what else to try. Also is there a place to check for { Err: { Module: { index: '7', error: '0x02000000' } } } like this? Thanks

2023-02-03 01:14:43        API/INIT: RPC methods not decorated: transaction_unstable_submitAndWatch, transaction_unstable_unwatch
✔ Initialising OK
✔ Getting metadata OK
Gas required: 10,000,000,000
Tx result:
{
  dispatchError: { Module: { index: '7', error: '0x02000000' } },
  dispatchInfo: { weight: '1,449,232,000', class: 'Normal', paysFee: 'Yes' },
  events: [
    { phase: [Object], event: [Object], topics: [] },
    { phase: [Object], event: [Object], topics: [] },
    { phase: [Object], event: [Object], topics: [] }
  ],
  internalError: undefined,
  status: {
    Finalized: '0x15e61e58cd413d8a7eaf72c39398a6829b3c793cecaff79ecc4e993a16320a78'
  }
}
4

1 Answer 1

2

Ideally the client itself would resolve the correct error from the metadata. However, given the raw error code you can look it up manually:

Find the code for the runtime of the node you are running, and in lib.rs you can see all the pallets defined in construct_runtime!. Count the pallets starting from 0, in this case 7 is the Contracts pallet:

https://github.com/AstarNetwork/swanky-node/blob/main/runtime/src/lib.rs#L478

Now we need to find the error in pallet-contracts. It is 0x02, which will be the error at position 2. In this case OutOfGas:

https://github.com/paritytech/substrate/blob/1d9a139dd96bf5d1583c725bae6fcac5a0805372/frame/contracts/src/lib.rs#L826

So you can add a few more zeros to that gas amount. I don't know whether swanky supports this but other tools e.g. cargo-contract will first perform a dry-run which will automatically estimate the amount of gas required, so you are unlikely to get this error.

Your Answer

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

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