stellar / soroban-examples

Example Soroban Contracts
Apache License 2.0
65 stars 68 forks source link

Authorization issue when verifying a function with a single parameter #63

Closed sisuresh closed 2 years ago

sisuresh commented 2 years ago

When verifying multiple parameters, the verification call would look something like check_auth(&e, auth, Domain::Freeze, (a, b).into_val(&e));. One would naturally assume that verification for a single parameter would look like check_auth(&e, auth, Domain::Freeze, (a).into_val(&e));, but that will fail with a ConversionError, because a vector is expected instead of the single value a. The right way to do this would be to use (a,).into_val(&e) (notice the comma) or (vec![&e, a]).into_val(&e).

The error does point you to where the conversion error occurs, but it could take some time for someone to understand what went wrong. Ideally, this issue would be caught at compile time.

leighmcculloch commented 2 years ago

Is there a way we could remove the need for the Vec, and replace it with a Tuple? 🤔