chore(core, proto): migrate byte slices from Vec to Bytes#1319
chore(core, proto): migrate byte slices from Vec to Bytes#1319ethanoroshiba merged 8 commits intomainfrom
Conversation
Fraser999
left a comment
There was a problem hiding this comment.
Mostly LGTM. Couple of minor suggestions, but I'd like to see if we can replace the handful of remaining Vec<Vec<u8>>s in astria-core and astria-conductor with Vec<Bytes> too.
Fraser999
left a comment
There was a problem hiding this comment.
One call to chunk() has been missed (I unresolved the comment to flag it - it's in celestia.rs). Otherwise LGTM - nice one.
SuperFluffy
left a comment
There was a problem hiding this comment.
I would like to see a couple of changes before this is merged: a few allocations can be avoided and a few function signatures shouldn't be changed
| } | ||
|
|
||
| fn incorrect_rollup_transactions_root_length(len: usize) -> Self { | ||
| fn incorrect_rollup_tx_root_length(len: usize) -> Self { |
There was a problem hiding this comment.
This should match the name of the error variant. Change back.
There was a problem hiding this comment.
This was to avoid a clippy warning of too many lines in SequencerBlock::try_from_block_info_and_data, as the lengthened function name pushes the formatter to break the map_err in which it is called into 3 lines instead of one. Would it be best for me to try to refactor in this case and avoid a clippy exception? Thanks for the detailed feedback :)
There was a problem hiding this comment.
Yeah, that seems to a hilarious way to appease the linter with the downside of breaking symmetry with all other methods. :-) The lint hitting that other function is probably correct. But I'm happy with you adding an allow directive on top and address it in a future PR.
## Summary Changed protobuf, astria-core, and dependent code to utilize generic `Bytes` instead of the default `Vec<u8>` to utilize zero-copy deserialization from Protobuf and make type conversion cheaper. ## Background Previously, some components were utilizing `Bytes` and some were utilizing `Vec<u8>` as the generated Rust types when converting from Protobuf `bytes`. ## Changes - Adjusted Protobuf compiler to use `Bytes` for all Astria paths. - Edited conversions to/from `Raw` in `astria-core` to utilize `prost::bytes::Bytes`. - Adjusted code which relied on `Vec<u8>`. ## Testing Passing all tests. ## Related Issues closes #674
## Summary Changed protobuf, astria-core, and dependent code to utilize generic `Bytes` instead of the default `Vec<u8>` to utilize zero-copy deserialization from Protobuf and make type conversion cheaper. ## Background Previously, some components were utilizing `Bytes` and some were utilizing `Vec<u8>` as the generated Rust types when converting from Protobuf `bytes`. ## Changes - Adjusted Protobuf compiler to use `Bytes` for all Astria paths. - Edited conversions to/from `Raw` in `astria-core` to utilize `prost::bytes::Bytes`. - Adjusted code which relied on `Vec<u8>`. ## Testing Passing all tests. ## Related Issues closes #674
## Summary Changed protobuf, astria-core, and dependent code to utilize generic `Bytes` instead of the default `Vec<u8>` to utilize zero-copy deserialization from Protobuf and make type conversion cheaper. ## Background Previously, some components were utilizing `Bytes` and some were utilizing `Vec<u8>` as the generated Rust types when converting from Protobuf `bytes`. ## Changes - Adjusted Protobuf compiler to use `Bytes` for all Astria paths. - Edited conversions to/from `Raw` in `astria-core` to utilize `prost::bytes::Bytes`. - Adjusted code which relied on `Vec<u8>`. ## Testing Passing all tests. ## Related Issues closes #674
## Summary Shortened `try_from_block_info_and_data()` to remove clippy exception. ## Background Migration from `Vec<u8>` to `Bytes` in #1319 introduced some new code which put `SequencerBlock::try_from_block_info_and_data` over the line limit. ## Changes - Created helper function to return `rollup_transactions_root` and `rollup_ids_root` from a iterator on `data`. ## Testing Passing all tests ## Related Issues closes #1357
* main: refactor(core, proto)!: define app genesis state in proto (#1346) fix(sequencer): bump penumbra dep to fix ibc state access bug (#1389) feat(conductor)!: support disabled celestia auth (#1372) fix(sequencer)!: fix block fees (#1343) perf(sequencer): add benchmark for prepare_proposal (ENG-660) (#1337) fix(proto): fix import name mismatch (#1380) fix(ci): enable bridge withdrawer building with tag (#1374) feat(sequencer): rewrite memool to have per-account transaction storage and maintenance (#1323) refactor(core, sequencer)!: require that bridge unlock address always be set (#1339) fix(sequencer)!: take funds from bridge in ics20 withdrawals (#1344) fix(sequencer)!: fix TOCTOU issues by merging check and execution (#1332) fix: abci error code (#1280) refactor(core): shorten `try_from_block_info_and_data()` (#1371) fix(relayer): change `reqwest` for `isahc` in relayer blackbox tests (ENG-699) (#1366) fix(conductor): update for celestia-node v0.15.0 (#1367) Chore: Upgrade celestia-node to v0.14.1 (#1360) chore(charts): fix charts production templates (#1359) chore(core, proto): migrate byte slices from Vec to Bytes (#1319)
Summary
Changed protobuf, astria-core, and dependent code to utilize generic
Bytesinstead of the defaultVec<u8>to utilize zero-copy deserialization from Protobuf and make type conversion cheaper.Background
Previously, some components were utilizing
Bytesand some were utilizingVec<u8>as the generated Rust types when converting from Protobufbytes.Changes
Bytesfor all Astria paths.Rawinastria-coreto utilizeprost::bytes::Bytes.Vec<u8>.Testing
Passing all tests.
Related Issues
closes #674