5

I am running the substrate-contracts-node and using the contracts UI to interact with it in Polkadot JS Apps. The contract call is failing when I try using the UI, although the same call works from a subxt test program.

Steps to reproduce:

  1. Create smart contracts via the upload&deploy button. enter image description here
  2. Call it's method via the UI.

Since my contract failed with ContractTrapped, I went to the events tab to view the extrinsic and it's parameters. Using this I:

  1. Reproduced the contract and called it from a test program using subxt.
  2. I verified that it passed without problem.
  3. I copied the extrinsic hash from the original failed extrinsic enter image description here
  4. I pasted it under the extrinsics tab to decode it. But it was unable to decode the extrinsic. enter image description here

Why is the contract extrinsic undecodable? I'm suspecting the extrinsic created from the frontend is way different than hand rolling it via subxt.

2 Answers 2

6

You tried to decode a hash of the extrinsic, not the actual encoded extrinsic itself.

The "extrinsic hash" is a one-way blake256(<extrinsic data>) so it doesn't contain the decodable extrinsic data.

1
  • Ah that makes sense, thanks for your answer!
    – extraymond
    Apr 6, 2022 at 10:06
0

If submitted via subxt, if you view the specific block inside the apps UI, the extrinsic will be decoded - so you can compare one submitted in another blocks (via JS) to one submitted in a recent block (via subxt).

Since you copied the hash, I'm assuming you could see the extrinsic.

Alternatively, make a rpc query for that block and copy/paste the extrinsic response (hex string) into the UI to be decoded.

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.