Skip to content

Conversation

@MegaRedHand
Copy link
Collaborator

@MegaRedHand MegaRedHand commented Jul 2, 2024

Motivation

According to the spec:

Implementations should ignore any additional elements in the packet-data list as well as any extra data after the list.

We're currently failing if any of that happens.

Description

This PR introduces Decoder::finish_unchecked, which ignores any trailing bytes instead of failing, and uses that to allow for additional elements inside the packet-data. Also, it replaces some usage of RLPDecode::decode with RLPDecode::decode_unfinished to allow for extra data after the message.

As an extra, it refactors out the big match inside of both Message encode and decode functions, since it's expected those will change often in the next PRs.

Related to #17

@MegaRedHand MegaRedHand self-assigned this Jul 2, 2024
@MegaRedHand MegaRedHand requested a review from a team as a code owner July 2, 2024 16:23
@MegaRedHand MegaRedHand merged commit eaeb9ce into main Jul 3, 2024
@MegaRedHand MegaRedHand deleted the decoder-finish_ignore_trailing branch July 3, 2024 12:08
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.

3 participants