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

chore: replace protons with protobufjs #319

Merged
merged 4 commits into from
Apr 14, 2021

Conversation

achingbrain
Copy link
Member

Replaces protons with the official protobufjs module.

Replaces protons with the official protobufjs module.
wantType: Message.Wantlist.WantType.Block
})
const deserialized = await BitswapMessage.deserialize(serialized)
expect(deserialized.wantlist.get(cid.toString())).to.have.nested.property('entry.wantType', Message.Wantlist.WantType.Block)
Copy link
Member Author

@achingbrain achingbrain Apr 14, 2021

Choose a reason for hiding this comment

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

Protons did some non-standard things here - sendDontHave and wantType should come back as undefined but instead came back as false and 0 respectively in line with the comment in the .proto definition.

Protobufjs follows the spec and does not do this so we can't test against the output of the protobuf deserializer but neither should we, really as it's not the unit under test.

Copy link
Member

Choose a reason for hiding this comment

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

protons was a mess, happy that we are getting rid of it

Copy link
Member

@vasco-santos vasco-santos left a comment

Choose a reason for hiding this comment

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

LGTM!
Pending CI failure on the bundlesize

tsconfig.json Outdated Show resolved Hide resolved
@achingbrain
Copy link
Member Author

Three bytes!

image

achingbrain and others added 2 commits April 14, 2021 13:49
Co-authored-by: Vasco Santos <vasco.santos@moxy.studio>
@achingbrain achingbrain merged commit de83324 into master Apr 14, 2021
@achingbrain achingbrain deleted the chore/replace-protons-with-protobufjs branch April 14, 2021 13:49
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.

2 participants