#HostError: Error(Value, UnexpectedSize)

4 messages · Page 1 of 1 (latest)

vapid stratus
#
pub fn get_prng(env: Env, bytes: Bytes) -> u64 {
    env.prng().seed(bytes);
    env.prng().u64_in_range(u64::MIN..=u64::MAX)
}

when calling the above function I'm getting this error (see attached file)

The bytes array I passed is [0,1,2,3,4,5,6,7,8,9]

#

Looks like the length of the Bytes for the seed needs to be 32. That's an undocumented gotcha. Should be documented or better yet BytesN<32>

dark ravine
#

yeah, feel free to open an issue (or even making a PR should be easy enough)

glass vault