-
Notifications
You must be signed in to change notification settings - Fork 123
Open
Labels
bugSomething isn't workingSomething isn't working
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 = trueSteps 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 -- retvalWhat 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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
Type
Projects
Status
Backlog (Not Ready)