Improve CID handling
- Dominant language
- Rust
- Stars
- 150
- Forks
- 41
- PR merge metrics
- No merged PRs in 30d
Description
Based on the discussion at https://github.com/ipld/libipld/pull/140#discussion_r812842180 I open this issue to track the problem of possible ways to return a CID when it was not intended.
One example to show this issue:
```rust
#[test]
fn ipld_deserialize_link_wrong_newtype_struct() {
let cid = Cid::try_from("bafkreie74tgmnxqwojhtumgh5dzfj46gi4mynlfr7dmm7duwzyvnpw7h7m").unwrap();
let ipld = Ipld::Link(cid);
assert_de_tokens(
&ipld,
&[
Token::NewtypeStruct { name: "foobar" },
Token::Bytes(&[
1, 85, 18, 32, 159, 228, 204, 198, 222, 22, 114, 79, 58, 48, 199, 232, 242, 84,
243, 198, 71, 25, 134, 172, 177, 248, 216, 207, 142, 150, 206, 42, 215, 219, 231,
251,
]),
],
);
}
```
The problem here is that it should work with a Newtype Struct named `foobar`, but only with one named after the `CID_SERDE_PRIVATE_IDENTIFIER`.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.