From 580f6102df5a0f28cb655b0b7c25fb9d6236698a Mon Sep 17 00:00:00 2001 From: Gabriel Rondon Date: Wed, 8 Apr 2026 10:35:22 +0100 Subject: [PATCH] Fix xdr_to_json panic for ScType::Val with non-Void values When a contract spec declares a return type as Val (the generic catch-all type), any concrete runtime value other than Void falls through to the todo!() panic in xdr_to_json. This causes the CLI to crash on output formatting even though the transaction succeeded. Delegate ScType::Val to to_json() which already handles all ScVal variants without needing type information. Close #2469 --- cmd/crates/soroban-spec-tools/src/lib.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmd/crates/soroban-spec-tools/src/lib.rs b/cmd/crates/soroban-spec-tools/src/lib.rs index 6b2cb74c3..4eaae36f0 100644 --- a/cmd/crates/soroban-spec-tools/src/lib.rs +++ b/cmd/crates/soroban-spec-tools/src/lib.rs @@ -589,6 +589,8 @@ impl Spec { self.sc_object_to_json(val, type_)? } + (val, ScType::Val) => to_json(val)?, + (ScVal::Error(_), ScType::Error) => todo!(), (v, typed) => todo!("{v:#?} doesn't have a matching {typed:#?}"), })