-
Notifications
You must be signed in to change notification settings - Fork 120
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
Move from ValueQuery to OptionQuery for pallet-manta-pay #692
Comments
@bhgomes Looking around the manta-pay code I really am not sure why would we want that, we are not using either the ValueQuery on Empty generic and neither do we have places where the code is written in a way that would require None checks, as most times it is checked for .contains(). If I am missing something or its for future changes, can you explain more please? |
@Apokalip This was from a discussion from a meeting, I think @Dengjianping brought this up. Not sure if it's something we have to do or not, but recording this issue to check if we need to change anything. Feel free to close it if you think it's not needed. |
@Apokalip @bhgomes I tried to get value by nonexistent key, from storages like #[test]
fn test_default_storage() {
new_test_ext().execute_with(|| {
let shard = crate::Shards::<Test>::get(0, 2);
dbg!(shard);
let vn = crate::VoidNumberSetInsertionOrder::<Test>::get(5);
dbg!(vn);
assert!(!crate::VoidNumberSetInsertionOrder::<Test>::contains_key(5));
});
} Like this one, if the key is invalid, it still return value: https://github.com/Manta-Network/Manta/blob/manta/pallets/manta-pay/src/lib.rs#L568 I just feel a little concern about the default value in the future, it might cause unexpected behavior. |
Hey team! Please add your planning poker estimate with Zenhub @ghzlatarev @Dengjianping |
The fact that
Basically all items except I'd estimate we have to substitute 50 occurences, but explicitly handling the Options should be simple at each occurrence. |
I went through Two of them are for getting number, it might be fine(default value for number is 0), but for line 1008, I'm not sure it's safe enough. At least do |
Hey team! Please add your planning poker estimate with Zenhub @Apokalip @zqhxuyuan |
We got some spread on the vote which makes sense since we have no reference issues yet. @Dengjianping pls explain why you chose 1 Specifically estimate Effort to implement and uncertainty about possible problems encountered while doing so |
I found only few |
I tend to agree that effort to implement is very low, but there's some uncertainty about potential breakage, which is why i did not choose 1. @ghzlatarev your opinion? |
Tend to be more conservative and that it will take longer than expected, so that's why i voted 5. |
Depending on the semantics we should see if we should move
The text was updated successfully, but these errors were encountered: