Skip to content
New issue

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

StorageMap remove does not clear the key #5717

Closed
2 tasks done
dvcpull opened this issue Sep 15, 2024 · 2 comments
Closed
2 tasks done

StorageMap remove does not clear the key #5717

dvcpull opened this issue Sep 15, 2024 · 2 comments
Labels
I2-bug The node fails to follow expected behavior. I10-unconfirmed Issue might be valid, but it's not yet known.

Comments

@dvcpull
Copy link

dvcpull commented Sep 15, 2024

Is there an existing issue?

  • I have searched the existing issues

Experiencing problems? Have you tried our Stack Exchange first?

  • This is not a support question.

Description of bug

Lets say we have a StorageMap like this

	#[pallet::storage]
	pub type ItemsToProcess<T: Config<I>, I: 'static = ()> = StorageMap<
		_,
		Blake2_128Concat,
		BlockNumberFor<T>,
		BoundedVec<u32, T::MaxItemsToProcess>,
		ValueQuery,
	>;

Lets say we insert a key and remove it later like this

ItemsToProcess::<T>::insert(1, vec![].try_into().unwrap());

...

ItemsToProcess::<T>::remove(1);

When running test, this test fails (even after the removal of key, the contains key returns true)

assert!(!ItemsToProcess::<T>::contains_key(1))

This is inconsistent with searching for a random key, like this where it returns false correctly

assert!(ItemsToProcess::<T>::contains_key(123))

Steps to reproduce

No response

@dvcpull dvcpull added I10-unconfirmed Issue might be valid, but it's not yet known. I2-bug The node fails to follow expected behavior. labels Sep 15, 2024
@dvcpull dvcpull closed this as completed Sep 15, 2024
@ggwpez
Copy link
Member

ggwpez commented Sep 15, 2024

Why was it closed?

@dvcpull
Copy link
Author

dvcpull commented Sep 15, 2024

misunderstanding, not a bug

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I2-bug The node fails to follow expected behavior. I10-unconfirmed Issue might be valid, but it's not yet known.
Projects
None yet
Development

No branches or pull requests

2 participants