Hey guys. Easy reproducer, just a revert, no error code.
Inserting at index 0 leads to revert even though Vector is already initialized.
Running on forc 0.37.1.
contract;
use std::storage::StorageVec;
abi MyContract {
#[storage(read, write)]
fn test_function() -> bool;
}
storage {
foo: StorageVec<u32> = StorageVec {},
}
impl MyContract for Contract {
#[storage(read, write)]
fn test_function() -> bool {
storage.foo.push(0);
log(storage.foo.get(0).unwrap());
storage.foo.insert(0, 123);
true
}
}
#[test]
fn test_test_function() {
let caller = abi(MyContract, CONTRACT_ID);
let res: bool = caller.test_function();
}