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

Switch to prost for protobuf encoding/decoding #176

Merged
merged 1 commit into from
Oct 1, 2023
Merged

Conversation

chenxiaolong
Copy link
Owner

There are several things we had to work around with quick-protobuf, like forcing no_std mode to use BTreeMaps and avoiding helper functions to read and write non-size-delimited messages. In addition, the pb-rs code generator doesn't support adding #[derive]s to enums and the existing support for adding derives to structs is broken due to incorrect string concatenation.

Prost doesn't have these limitations and bugs. I originally avoided it because prost_build required the external protoc binary, but now that the protox library exists, the code generation can be done entirely in Rust without external tools.

Prost also fully supports adding custom attributes to structs, enums, and fields. This will be helpful for future payload unpack and pack commands where the payload manifest would have to be serialized to TOML.

The e2e checksums had to be updated because prost's serialized bytes on the wire differ from quick-protobuf, despite having the same semantic meaning. Since all checksums need to be updated anyway, the Magisk apk and OTA images have all been updated to the latest versions.

There are several things we had to work around with quick-protobuf, like
forcing no_std mode to use BTreeMaps and avoiding helper functions to
read and write non-size-delimited messages. In addition, the pb-rs code
generator doesn't support adding #[derive]s to enums and the existing
support for adding derives to structs is broken due to incorrect string
concatenation.

Prost doesn't have these limitations and bugs. I originally avoided it
because prost_build required the external `protoc` binary, but now that
the protox library exists, the code generation can be done entirely in
Rust without external tools.

Prost also fully supports adding custom attributes to structs, enums,
and fields. This will be helpful for future payload unpack and pack
commands where the payload manifest would have to be serialized to TOML.

The e2e checksums had to be updated because prost's serialized bytes on
the wire differ from quick-protobuf, despite having the same semantic
meaning. Since all checksums need to be updated anyway, the Magisk apk
and OTA images have all been updated to the latest versions.

Signed-off-by: Andrew Gunnerson <[email protected]>
@chenxiaolong chenxiaolong self-assigned this Oct 1, 2023
@chenxiaolong chenxiaolong merged commit 81d77d8 into master Oct 1, 2023
26 checks passed
@chenxiaolong chenxiaolong deleted the prost branch October 1, 2023 03:19
chenxiaolong added a commit that referenced this pull request Oct 1, 2023
Signed-off-by: Andrew Gunnerson <[email protected]>
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.

1 participant