paritytech/parity-db

Panic when doing duplicated references in the same transaction on a ref-counted btree

Tpt opened this issue · 0 comments

Tpt commented

The following test:

#[test]
fn test_duplicated_reference_on_ref_counted_btree() {
	let tmp = tempdir().unwrap();
	let mut options = Options::with_columns(tmp.path(), 1);
	options.columns[0].ref_counted = true;
	options.columns[0].btree_index = true;
	let db = Db::open_or_create(&options).unwrap();
	db.commit_changes(vec![(0, Operation::Reference(vec![255])), (0, Operation::Reference(vec![255]))]).unwrap();
}

Fails with a panic:

thread 'db::tests::test_duplicated_reference_' panicked at 'assertion failed: changes[0].key() < changes[1].key()', src/btree/node.rs:76:17

(first test found with fuzzing!)