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.:
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
ScVal variants are affected when the spec type is SC_SPEC_TYPE_VAL, not just Bool
- A fix would need to handle
ScType::Val for all ScVal variants, likely by recursively inferring the concrete type from the value itself