Skip to content

core: migrate byte slices from Vec to Bytes #674

@SuperFluffy

Description

@SuperFluffy

This is to use zero-copy deserialization from protobuf encoded bytes to the generated Rust types, and to make conversion between the generated Rust types and idiomatic Astria types cheaper.

This issue has a few steps:

  1. Update the protobuf compilation tool to emit Bytes instead of Vec<u8>
  2. (generate new code by running the tool)
  3. Update all conversions in astria-core between the protobuf and native domain types (primarily all try_from_raw, try_from_raw_ref, into_raw, and to_raw).
  4. Update all code that broke because it required Vec<u8> (I expect this primarily affecting tests).

For step 3 in particular care should be taken to not end up with conversions Bytes -> Vec<u8> -> Bytes because we have some instances where we convert Bytes to Vec<u8>.

Metadata

Metadata

Assignees

Labels

corepertaining to the astria-core craterefactorcode refactoring or maintainence

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions