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

Strongify wire header serialization #115

Closed
hug-dev opened this issue Jul 21, 2021 · 0 comments · Fixed by #128
Closed

Strongify wire header serialization #115

hug-dev opened this issue Jul 21, 2021 · 0 comments · Fixed by #128
Labels
enhancement New feature or request good first issue Good for newcomers medium Effort label testing Task related to testing

Comments

@hug-dev
Copy link
Member

hug-dev commented Jul 21, 2021

As we use bincode through the serialize and deserialize functions, the default is little endian and fixed int encoding. The fixed int encoding does what we want in terms of layout for integers:

Fixed size integers are encoded directly

To make sure of that, we have one test where the expected serialised representation of a request (so including the header) is written as a Vec and we parse it. If the bincode representation changes over time, this test will fail.

bincode should be fairly stable:

The encoding format is stable across minor revisions, provided the same configuration is used. This should ensure that later versions can still read data produced by a previous versions of the library if no major version change has occured.

Two improvements should be made however to make the wire header serialization stronger:

  • use the little-endian/fixed int encoding explicitely instead of using the default
  • add more tests such as the one linked, where a valid header is written by hand and we check that the serialization succeeds
@hug-dev hug-dev added enhancement New feature or request good first issue Good for newcomers medium Effort label testing Task related to testing labels Jul 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers medium Effort label testing Task related to testing
Projects
None yet
1 participant