Am try to call an update function from my contract from some code using rust sdk. My smart contract function (update) accepts a parameter with a HashSha2256 in it. from my client code, I’m using [u8; 32] to represent the attribute as HashSha2256 is a type in concordium-std and I don’t want to use this crate in my client code. The contract state gets updated when calling the update function, but the problem is that it saves the wrong hash value.
So the hash param
is saved as
From above, it seems that somewhere in the concordium-std library for serialising/deserializing, the array gets cut and then padded (reason for the 0s). Is this a bug?
I’ve tried replacing the [u8;32] type in my client param struct with just a String, but it saves a totally different hash.
I’m now tempted to just use String all over in my smart contract structs to represent hashes instead of arrays. Is it okay or is it expensive to use Strings?