We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I found a bug whereby we have leftovers in storage for nested Lazy-like structs.
In the example below Vec.elems: LazyIndexMap is the offender, though e.g. our HashMap is also affected by the bug.
Vec.elems: LazyIndexMap
HashMap
#[test] fn bug() { ink_env::test::run_test::<ink_env::DefaultEnvironment, _>(|_| { // given let root_key = Key::from([0x42; 32]); let mut vec: Lazy<StorageVec<u32>> = Lazy::new(StorageVec::new()); vec.push(13u32); SpreadLayout::push_spread(&vec, &mut KeyPtr::from(root_key)); let _ = <Lazy<StorageVec<u32>> as SpreadLayout>::pull_spread(&mut KeyPtr::from(root_key)); // when SpreadLayout::clear_spread(&vec, &mut KeyPtr::from(root_key)); // then let storage_used = ink_env::test::get_contract_storage_used::< ink_env::DefaultEnvironment, >(&contract_id()).expect("used storage must be returned"); assert_eq!(storage_used, 0); Ok(()) }).unwrap() }
Fails with
thread 'collections::vec::tests::bug' panicked at 'assertion failed: `(left == right)` left: `1`, right: `0`', crates/storage/src/collections/vec/tests.rs:413:9
The text was updated successfully, but these errors were encountered:
cmichi
Successfully merging a pull request may close this issue.
I found a bug whereby we have leftovers in storage for nested Lazy-like structs.
In the example below
Vec.elems: LazyIndexMap
is the offender, though e.g. ourHashMap
is also affected by the bug.Fails with
The text was updated successfully, but these errors were encountered: