thrumdev / blobs

Blobchains on Polkadot and Kusama
https://docs-site-pi.vercel.app
Apache License 2.0
64 stars 8 forks source link

shim: cryptic error message for invalid blob #185

Closed pepyakin closed 10 months ago

pepyakin commented 10 months ago

Submitting a blob via shim with the invalid namespace ID leads to an error that just goes:

Internal Error: failed to submit blob

If you print the underlying error, it would say failed to submit extrinsic. Only if you debug print the error you will get

\n\nCaused by:\n    0: Rpc error: RPC error: ErrorObject { code: ServerError(1010), message: \"Invalid Transaction\", data: Some(RawValue(\"Custom error: 101\")) }\n    1: RPC error: ErrorObject { code: ServerError(1010), message: \"Invalid Transaction\", data: Some(RawValue(\"Custom error: 101\")) }

Or cleaned up, "Invalid Transaction: Custom error: 101". The blobs pallet defines a couple of custom errors and this particular one corresponds to

InvalidNamespaceId = 101,

This is a mess of a developer experience. The custom errors should be printed properly. We should probably prevalidate the namespace ID client side before submitting (OTOH, it would prevent from using older versions of the shim to submit the blobs when we lift the restriction).

rphmeier commented 10 months ago

Ok, so to be clear: we would have the shim pre-validate that the namespace is conformant with version 1 and return a human-friendly error message if so.