namada icon indicating copy to clipboard operation
namada copied to clipboard

Misleading error message could be improved on custom wasm code execution

Open McDaan opened this issue 1 year ago • 1 comments

[!NOTE] This issue has been submitted on behalf of the CosmicValidator and Mandragora teams, participants of the Namada Shielded Expedition.


When trying to execute the transaction from a custom wasm binary such as

namadac tx --owner mandragora --tx-path $HOME/.local/share/namada/shielded-expedition.88f17d1d14/wasm/tx_proposal_break.380dd66bea4edfe12c4fac70b5a81b4fada8f6d51ccaf3cd72f3bca3b3a0d28a.wasm --signing-keys mandragora --memo $MEMO

the following error is returned: Invalid tx deserialization.

After further investigation, It is our understanding that the cause of the error is the binary/tx not being part of Namada's allow-list. However, the error message is misleading as it seems to suggest that a format error of some sort caused it instead.

We recommend improving the error message to something more descriptive such as:

  • Transaction is not allow-listed
  • Wasm module is not allow-listed
  • Checksum doesn't match allowed transactions

McDaan avatar Apr 11 '24 10:04 McDaan

Last time I tried something like that I received the error

The corresponding wasm code of the code path tx_code.wasm doesn't exist on chain

Rigorously avatar Apr 11 '24 13:04 Rigorously

I've been investigating this, and the cause is actually not because of absence from the tx whitelist. The --tx-path flag is meant to take a file in .tx format (usually from the output of a tx dump). Rather, a wasm file should be passed to --code-path, which correctly describes the error from not being in the whitelist. For example,

target/release/namadac tx --owner brent-0 --signing-keys brent-0 --code-path wasm_for_tests/tx_no_op.wasm --node $DO_NODE     
The corresponding wasm code of the code path wasm_for_tests/tx_no_op.wasm doesn't exist on chain.
Error: 
   0: Querying error: Wasm code path wasm_for_tests/tx_no_op.wasm does not exist on chain
   1: Wasm code path wasm_for_tests/tx_no_op.wasm does not exist on chain

Going to improve the error message and some help messages to make this very clear.

brentstone avatar Sep 05 '24 14:09 brentstone