Push_back on a vector with other vectors

I have a data type defined as

let digests: vector<vector<u8>>;

In this digests vector if I try to use push_back to insert another vector as the following

let digest1: vector<u8>;
let digests: vector<vector<u8>>;

digest1 = h"00";
digests = Vector.empty<vector<u8>>();

Vector.push_back<vector<u8>>(
                &mut digests, 
                copy(digest1)
            );

The tests fail on push_back with the following error.

[106] DiscardedTransaction(TransactionOutput { write_set: WriteSet(WriteSetMut { write_set: [] }), events: [], gas_used: 0, status: Discard(VMStatus { major_status: UNKNOWN_INVARIANT_VIOLATION_ERROR, sub_status: None, message: Some("vector elem type mismatch -- expected Vector(U8), got General([])") }) })

This implementation was supported on the previous version of mvir when using bytearray for vector<u8>. I am a bit lost with this error. Also, are there any better alternatives to implement a nested vector?

This is a bug and thanks so much for reporting it.
I have open https://github.com/libra/libra/issues/3277 pointing to this post.
We’ll fix it real soon and we’ll ping you as soon as we have the fix (beginning of the coming week I am sure)

2 Likes

This was fixed by https://github.com/libra/libra/commit/2c07e61b5da4d59612c63937fd099ca6e5eb47e0. Thanks again for the report!!

1 Like