anoma / namada

Rust implementation of Namada, a Proof-of-Stake L1 for interchain asset-agnostic privacy
https://namada.net
GNU General Public License v3.0
2.39k stars 948 forks source link

Misleading error message could be improved on custom wasm code execution #3062

Closed McDaan closed 4 weeks ago

McDaan commented 5 months ago

[!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:

Rigorously commented 5 months ago

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

brentstone commented 1 month ago

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.