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

Add Serialized wrapper to make it harder to accidentally deserialize the wrong type #774

Merged
merged 5 commits into from
Oct 21, 2024

Conversation

Kobzol
Copy link
Collaborator

@Kobzol Kobzol commented Oct 18, 2024

While restoring the dashboard, I realized that the comment about the type of the Submit::serialized_desc was wrong - it was not storing JobDescription, but SubmitRequest. There was also one place in the code that was deserializing this incorrect type. I created a type wrapper to make sure that this doesn't happen again.

We should use the same thing for SerializedTaskContext, however it currently uses different bincode options (it uses fixint encoding and doesn't allow trailing bytes), so I did not use it there yet.

@Kobzol Kobzol requested a review from spirali October 18, 2024 18:28
@spirali
Copy link
Collaborator

spirali commented Oct 21, 2024

Nice idea.

Both serialization of SubmitRequest and SerializedTaskContext should not allow trailing spaces. I think that it is ok to synchronize both on the same serializer. My first guess would be variable encoding but I did do any benchmarking so also fixint is probably ok.

@Kobzol Kobzol mentioned this pull request Oct 21, 2024
@Kobzol Kobzol force-pushed the serialized-wrapper branch from 0c5d94d to 933f243 Compare October 21, 2024 07:28
@Kobzol Kobzol merged commit 135c7fd into main Oct 21, 2024
8 checks passed
@Kobzol Kobzol deleted the serialized-wrapper branch October 21, 2024 07:45
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.

2 participants