Panic on `unwrap()` of `spec_base64` in `contract info interface` when contract has env_meta but no spec
Nobody has claimed this yet.
Assessment
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Newbie friendliness
- 55/100
Research direction
Start at cmd/soroban-cli/src/commands/contract/info/interface.rs around lines 55-59 and inspect how the two WASM metadata fields are handled. Run stellar contract info interface against a WASM binary with env_meta but no spec; done means it returns NoInterfacePresent instead of panicking.
Written by the indexing model from the issue text.
Description
What version are you using?
All versions containing the current implementation of contract info interface (at least as of commit aef2923).
What did you do?
Ran stellar contract info interface against a WASM binary that contains the contractenvmetav0 custom section but omits the contractspecv0 custom section.
What did you expect to see?
A user-friendly error message (NoInterfacePresent), consistent with how the command handles other cases of missing metadata.
What did you see instead?
The CLI panics with an unwrap() on None at cmd/soroban-cli/src/commands/contract/info/interface.rs:59.
Root cause: The guard at line 55 checks whether env_meta_base64 is Some, but line 59 then calls .unwrap() on spec_base64 — a completely independent field. These two fields come from separate WASM custom sections (contractenvmetav0 and contractspecv0) and there is no guarantee that the presence of one implies the presence of the other.
let spec = Spec::new(&wasm_bytes)?;
if spec.env_meta_base64.is_none() {
return Err(NoInterfacePresent());
}
(spec.spec_base64.unwrap(), spec.spec) // panics if spec_base64 is None
Suggested fix:
let spec = Spec::new(&wasm_bytes)?;
let base64 = spec.spec_base64.ok_or(NoInterfacePresent())?;
let _ = spec.env_meta_base64.ok_or(NoInterfacePresent())?;
(base64, spec.spec)
- Dominant language
- Rust
- Stars
- 123
- Forks
- 141
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 17
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from stellar/stellar-cli
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
stellar/stellar-cli#2384 · 2 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
stellar/stellar-cli#2347 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
stellar/stellar-cli#2723 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 72/100
stellar/stellar-cli#2722 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
stellar/stellar-cli#2703 ·
All issues in stellar/stellar-cli
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
kwakseongjae/auto-hwp#319 ·
-
area:cli bug filter-quality good first issue priority:medium
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
bevyengine/bevy#25861 ·
-
comp-datalake
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
ClickHouse/ClickHouse#121222 ·
-
enhancement remote
Difficulty 2/5 1-3 hours Newbie friendliness 68/100