This is an issue in the translation of the error data to the error message when using the following findMetaError
from polkadot-js.
const mod = dispatchError.asModule
const error = this.api.registry.findMetaError(
new Uint8Array([mod.index.toNumber(), new BN(mod.error).toNumber()])
)
Because the hexadecimal mod.error
is 0x02000000
, the decimal representation of this is 33554432
, which is not one of the indices in the pallet contracts errors (search for 523
in this file).
Presumably, the hexadecimal used to index should have been 0x02
, which converts to index 2
and OutOfGas
.
> util.bnFromHex('0x02000000').toNumber()
33554432
> util.bnFromHex('0x02').toNumber()
2
{
"id": 523,
"type": {
"path": [
"pallet_contracts",
"pallet",
"Error"
],
"params": [
{
"name": "T",
"type": null
}
],
"def": {
"variant": {
"variants": [
...
{
"name": "OutOfGas",
"fields": [],
"index": 2,
"docs": [
"The executed contract exhausted its gas limit."
]
},
EDIT: it looks like the additional bytes can include error details.
{ Module: { index: '19', error: '0x02000000' } }
. Do you know where I can find the corresponding error the substrate code?