What version are you using?
stellar-cli 28.0.0.
What did you do?
I deployed a small contract with a function that takes a tuple struct argument, and passed that argument as a JSON array: once with the right number of values, and then with too many and too few.
#![no_std]
use soroban_sdk::{contract, contractimpl, contracttype, Env};
#[contracttype]
pub struct Point(u32, u32);
#[contract]
pub struct Contract;
#[contractimpl]
impl Contract {
pub fn tuple_arg(_env: Env, point: Point) -> Point {
point
}
}
stellar contract build
stellar keys generate demo --network testnet --fund
stellar contract deploy \
--wasm target/wasm32v1-none/release/repro_contract.wasm \
--source demo --network testnet --alias repro_demo
Correct call:
stellar contract invoke --id repro_demo --source demo --network testnet --send no -- \
tuple_arg --point '[1,2]'
Mis-sized calls — same command, but with three values, one value, or none:
stellar contract invoke --id repro_demo --source demo --network testnet --send no -- \
tuple_arg --point '[1,2,3]'
stellar contract invoke --id repro_demo --source demo --network testnet --send no -- \
tuple_arg --point '[1]'
stellar contract invoke --id repro_demo --source demo --network testnet --send no -- \
tuple_arg --point '[]'
What did you expect to see?
A normal CLI error telling me the --point argument has the wrong number of values, the same way the CLI rejects --point '{"0":1}' with a missing key error.
What did you see instead?
The CLI accepts all three mis-sized arguments. With [1,2,3] the extra value is silently dropped and the contract is called with Point(1, 2), so the invocation succeeds with an argument I didn't pass. With [1] and [] the CLI builds a one-element and an empty vector and sends them on, so the mistake only surfaces later, from simulation or the contract, rather than as an argument error.
What version are you using?
stellar-cli 28.0.0.
What did you do?
I deployed a small contract with a function that takes a tuple struct argument, and passed that argument as a JSON array: once with the right number of values, and then with too many and too few.
Correct call:
stellar contract invoke --id repro_demo --source demo --network testnet --send no -- \ tuple_arg --point '[1,2]'Mis-sized calls — same command, but with three values, one value, or none:
What did you expect to see?
A normal CLI error telling me the
--pointargument has the wrong number of values, the same way the CLI rejects--point '{"0":1}'with a missing key error.What did you see instead?
The CLI accepts all three mis-sized arguments. With
[1,2,3]the extra value is silently dropped and the contract is called withPoint(1, 2), so the invocation succeeds with an argument I didn't pass. With[1]and[]the CLI builds a one-element and an empty vector and sends them on, so the mistake only surfaces later, from simulation or the contract, rather than as an argument error.