Closed larry0x closed 4 months ago
When using a nested tuple as keys in a Map, the keys cannot be deserialized correctly. Example:
Map
type NestedTuple<'a> = ((&'a str, &'a str), (&'a str, &'a str)); const MAP: Map<NestedTuple, u64> = Map::new("map"); #[test] fn deserialize_nested_tuple_works() { let mut storage = MockStorage::new(); let ((a, b), (c, d)) = (("larry", "engineer"), ("jake", "shepherd")); MAP.save(&mut storage, ((a, b), (c, d)), &123).unwrap(); // Attempt to deserialize the nested tuple key by iterating the first record in the map let (k, _) = MAP .range(&storage, None, None, Order::Ascending) .next() .unwrap() .unwrap(); assert_eq!( k, ((a.to_string(), b.to_string()), (c.to_string(), d.to_string())) ); }
This panics with message:
`at` split index (is 2) should be <= len (is 1)
What version are you using? AFAIK, this was fixed in 2.0.0
You're right, I was in v1.
When using a nested tuple as keys in a
Map
, the keys cannot be deserialized correctly. Example:This panics with message: