Using a merkle tree in a contract

I tried using the rs_merkle, simple_merkle_tree but when I build the rust project with

cargo concordium build

I get errors like this (this is with simple_merkle_tree but rs_merkle is similar):
error[E0277]: the trait bound &RandomAccessFile: WriteAt is not satisfied
→ C:\Users\Comba.cargo\registry\src\github.com-1ecc6299db9ec823\positioned-io-0.3.1\src\raf.rs:141:27
|
141 | WriteAt::write_at(&mut &*self, pos, buf)
| ----------------- ^^^^^^^^^^^ the trait WriteAt is not implemented for &RandomAccessFile
| |
| required by a bound introduced by this call
|
help: consider removing the leading &-reference
|
141 - WriteAt::write_at(&mut &*self, pos, buf)
141 + WriteAt::write_at(&*self, pos, buf)

When I tried merkle_light I received an error in the State structure because the merkle tree structure did not implement serialise.

Is there a standard rust crate to use for this or a internal implementation somewhere?

I don’t know if rs_merkle or the other crate support compilation to the wasm target.

You might try using default-features=false to see if disabling some features of the dependency will help, but I suspect it won’t since the problem seems to come from a transitive dependency.

We don’t have our own implementation of merkle trees and off the top of my head I don’t have a pointer to a Rust crate that would work in wasm.