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
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
    – Community Bot
    Commented Feb 3, 2023 at 13:46
  • Which node are you running ?
    – P.Ossun
    Commented Feb 3, 2023 at 13:46
  • I am running swanky node Commented Feb 4, 2023 at 0:22
  • if your blockchain has updated to use WeightsV2 then polkadot.js.org/apps may not work. you can look at this PR github.com/polkadot-js/apps/pull/8538. instead try using the contracts-ui.substrate.io or github.com/paritytech/contracts-ui
    – Yeou
    Commented Mar 15, 2023 at 9:56

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 you have read our privacy policy.

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