Skip to content

Hint when contract id looks like a wasm hash.#2550

Merged
fnando merged 2 commits into
mainfrom
improve-contract-not-found-wasm-hash-hint
May 4, 2026
Merged

Hint when contract id looks like a wasm hash.#2550
fnando merged 2 commits into
mainfrom
improve-contract-not-found-wasm-hash-hint

Conversation

@fnando
Copy link
Copy Markdown
Member

@fnando fnando commented May 4, 2026

What

Change error message to hint about using Wasm hash:

❌ error: contract not found: 5ea0f3d6c880148c8da088809e851732127fc36b7b42bbdde6052fcc6f6253f3; expected a contract address (looks like a Wasm hash)

Why

Close #817.

Known limitations

N/A

@fnando fnando requested review from leighmcculloch and mootz12 May 4, 2026 17:18
@fnando fnando self-assigned this May 4, 2026
Copilot AI review requested due to automatic review settings May 4, 2026 17:18
@fnando fnando added this to DevX May 4, 2026
@github-project-automation github-project-automation Bot moved this to Backlog (Not Ready) in DevX May 4, 2026
@fnando fnando moved this from Backlog (Not Ready) to Needs Review in DevX May 4, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves the ContractNotFound error message by appending a helpful hint when the provided “contract id” looks like a 32-byte Wasm hash (64 hex chars), addressing the UX gap described in #817.

Changes:

  • Extend the contract not found error to optionally include a Wasm-hash-specific hint.
  • Add a small helper (wasm_hash_hint) to detect 64-char hex strings.
  • Add unit tests covering hint/no-hint cases (plain alias, hex length checks, hex casing).

Comment thread cmd/soroban-cli/src/config/locator.rs Outdated
Comment thread cmd/soroban-cli/src/config/locator.rs Outdated
@fnando fnando enabled auto-merge (squash) May 4, 2026 17:37
@fnando fnando merged commit eb32d9a into main May 4, 2026
208 checks passed
@fnando fnando deleted the improve-contract-not-found-wasm-hash-hint branch May 4, 2026 17:43
@github-project-automation github-project-automation Bot moved this from Needs Review to Done in DevX May 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

cli: improve error when attempting to invoke a non-existing contract

3 participants