Skip to content

Remove bincode in Favor of postcard for Serialization #3315

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

Closed
wants to merge 2 commits into from

Conversation

0xmuon
Copy link

@0xmuon 0xmuon commented Jun 24, 2025

Description

This PR removes the use of the bincode crate from the concolic observer module and standardizes all serialization in LibAFL on the postcard crate.
Replaced all bincode usage in libafl/src/observers/concolic with postcard.
Removed the bincode dependency from libafl/Cargo.toml.
This change improves consistency across the codebase and leverages postcard's no-std readiness and smaller output sizes.
Closes: #3273

NOTE: Besides converting from bincode to postcard,changes to libafl/src/observers/concolic/serialization_format.rs include:

  • Removed all bincode-related configuration, setup, and function calls (such as serialization_options, deserializer_config, and encode_into_std_write).
  • Removed the use of custom serialization configuration objects, making the code more straightforward and less error-prone.
  • Switched from streaming/deserializer-based logic to buffer-based logic for reading and writing messages, using postcard’s from_bytes and to_allocvec.
  • Simplified error handling for serialization/deserialization, now matching on postcard’s error types.
    Removed Unused Code:
  • Eliminated now-unnecessary fields and functions related to bincode (such as serialization_options, deserializer_config, and related struct fields).

Checklist

  • I have run ./scripts/precommit.sh and addressed all comments

Copy link
Member

@tokatoka tokatoka left a comment

Choose a reason for hiding this comment

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

can you make the code build?

}
}
encode_into_std_write(&message, &mut self.writer, self.serialization_options)?;
Copy link
Member

Choose a reason for hiding this comment

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

you SURE that this is what you want to do?

@tokatoka tokatoka closed this Jun 25, 2025
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.

Replace bincode with postcard (or vice versa)
2 participants