`stellar contract invoke` panics when contract function returns spec type `SC_SPEC_TYPE_VAL`
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 48/100
Research direction
Start with the result-formatting path used by stellar contract invoke, focusing on handling ScType::Val and the SC_SPEC_TYPE_VAL contract return type. Reproduce the panic with the provided Bool(false) contract and invocation steps. Done means the command completes without panicking and displays the returned value, including false and other ScVal variants.
Written by the indexing model from the issue text.
Description
What version are you using?
stellar-cli 25.1.0
What did you do?
When a Soroban contract function has return type Val (which maps to SC_SPEC_TYPE_VAL in the contract spec), and the function returns Bool(false), calling the function via stellar contract invoke panics.
Minimal reproducing contract:
#![no_std]
use soroban_sdk::{contract, contractimpl, Env, Val};
#[contract]
pub struct BoolFalseContract;
#[contractimpl]
impl BoolFalseContract {
pub fn retval(_env: Env) -> Val {
Val::from_bool(false).into()
}
}
Cargo.toml:
[package]
name = "bool_false_poc"
version = "0.1.0"
edition = "2021"
publish = false
[lib]
crate-type = ["cdylib"]
[dependencies]
soroban-sdk = "25.1.0"
[dev-dependencies]
soroban-sdk = { version = "25.1.0", features = ["testutils"] }
[profile.release]
opt-level = "z"
overflow-checks = true
debug = 0
strip = "symbols"
debug-assertions = false
panic = "abort"
codegen-units = 1
lto = true
Steps to reproduce:
# Build the contract
cargo build --release --target wasm32-unknown-unknown
# Deploy to local network
stellar contract deploy \
--wasm target/wasm32-unknown-unknown/release/bool_false_poc.wasm \
--source deployer --network local --alias bool-false-poc
# Invoke the function — this panics
stellar contract invoke --id bool-false-poc --source deployer --network local -- retval
What did you expect to see?
The CLI should successfully display the return value, e.g.:
false
What did you see instead?
The CLI panics with:
thread 'main' panicked at 'not yet implemented: Bool(false,) doesn't have a matching Val'
Notes
- The contract itself executes correctly — the issue is purely in the CLI's result formatting
- All non-Void
ScValvariants are affected when the spec type isSC_SPEC_TYPE_VAL, not justBool - A fix would need to handle
ScType::Valfor allScValvariants, likely by recursively inferring the concrete type from the value itself
- 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