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

harden typing to increase safety of serialization routine #81

Merged
merged 3 commits into from
Jul 8, 2023

Conversation

ralexstokes
Copy link
Owner

minor but also skips a redundant iteration over the variable lengths summation that can be done inline like the fixed lengths summation

@codecov
Copy link

codecov bot commented Jun 23, 2023

Codecov Report

Patch coverage: 94.59% and project coverage change: -0.03 ⚠️

Comparison is base (b872969) 75.26% compared to head (a6eb171) 75.23%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #81      +/-   ##
==========================================
- Coverage   75.26%   75.23%   -0.03%     
==========================================
  Files          18       18              
  Lines         857      856       -1     
==========================================
- Hits          645      644       -1     
  Misses        212      212              
Impacted Files Coverage Δ
ssz-rs/src/lib.rs 100.00% <ø> (ø)
ssz-rs/src/ser.rs 71.05% <92.00%> (-6.04%) ⬇️
ssz-rs/src/array.rs 25.71% <100.00%> (+3.32%) ⬆️
ssz-rs/src/list.rs 75.94% <100.00%> (+0.94%) ⬆️
ssz-rs/src/vector.rs 83.90% <100.00%> (+0.57%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Comment on lines 85 to 86
let bytes_written = running_length.serialize(buffer)?;
debug_assert_eq!(bytes_written, BYTES_PER_LENGTH_OFFSET);
Copy link
Owner Author

Choose a reason for hiding this comment

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

this kind of just moves the problem elsewhere but we could change the defn of Part:

enum Part {
  Fixed(Vec<u8>),
  Offset(u32),
}

@ralexstokes ralexstokes added this to the v1.0 milestone Jun 23, 2023
@ralexstokes ralexstokes merged commit 885a887 into main Jul 8, 2023
@ralexstokes ralexstokes deleted the refactor-ser branch July 8, 2023 21:57
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