0

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([])") }) })

I am a bit lost with this error. Also, are there any better alternatives to implement a nested vector?

I am using move intermediate representation to write the above

TylerH
  • 20,799
  • 66
  • 75
  • 101
pariwesh
  • 341
  • 4
  • 11

1 Answers1

0

This was identified as a bug and fixed here: https://community.libra.org/t/push-back-on-a-vector-with-other-vectors/2706/3

pariwesh
  • 341
  • 4
  • 11