CLI: Deploying a contract should fail or warn if the supplied WASM file is clearly invalid

Open
#264 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
rust, wasm
Domain
blockchain, cli

Research direction

Start at the deploy sub-command's handling of the --wasm parameter and review the linked Discord discussion for the unresolved validation scope. Define the invalid-binary cases and warning, prompt, and --force behavior before implementing; done means clearly invalid contract files cannot be deployed accidentally without the intended override.

Written by the indexing model from the issue text.

Description

This issue is linked to this Discord discussion

What problem does your feature solve?

At the moment the cli will upload what ever file was supplied to the ´--wasm´ parameter when using the deploy sub-command.
It is never checked / verified that the 'contract'-file is actually valid.

What would you like to see?

Add a warning and corresponding overwrite parameter (e.g. --force) to the deploy sub-command such that clearly invalid contract binaries will not find their way on chain on accident.

The definition of what is deemed to be an invalid contract binary is still tbd.
On the most basic level a check should verify the WASMs magic word validity (00 61 73 6d).

What alternatives are there?
  • Don't warn the user at all
  • Warn the user but still deploy the given file as is
  • Add a prompt to continue/abort the deployment process
Dominant language
Rust
Stars
123
Forks
141
Avg merge
2d 21h
Merged PRs (30d)
17

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from stellar/stellar-cli

All issues in stellar/stellar-cli

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.