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

feat: impl (de)ser for PhantomData #37

Merged
merged 4 commits into from Jul 1, 2021
Merged

feat: impl (de)ser for PhantomData #37

merged 4 commits into from Jul 1, 2021

Conversation

austinabell
Copy link
Contributor

closes #30

There is another option, which is to serialize a unit struct for the phantom data, similar to serde does by default. If this is done, possibly also schema can be added for it, otherwise, I don't think schema would work for this.

Copy link
Member

@ailisp ailisp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Is there a DoS attack factor for struct A { pd: PhantomData }; deserialize::<Vec<A>>?

@austinabell
Copy link
Contributor Author

Looks good! Is there a DoS attack factor for struct A { pd: PhantomData }; deserialize::<Vec<A>>?

Yeah could be, but only in the case where a deserialized object contains nothing but PhantomData, which should be tackled as a larger issue, relating to the zero size workaround that exists. I think it might be hard to rationalize creating another workaround to limit the symptoms of the problem like the other, though

@ailisp ailisp merged commit fdf4f5f into master Jul 1, 2021
@ailisp ailisp deleted the austin/phantomdata branch July 1, 2021 01:49
This was referenced May 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

the trait BorshSerialize is not implemented for PhantomData<MyMarker>
3 participants