feat: implement rlp decoding for common types#12
Merged
MegaRedHand merged 32 commits intomainfrom Jun 28, 2024
Merged
Conversation
MegaRedHand
reviewed
Jun 27, 2024
MegaRedHand
reviewed
Jun 27, 2024
MegaRedHand
reviewed
Jun 28, 2024
| } | ||
| } | ||
|
|
||
| fn decode_rlp_item(data: &[u8]) -> Result<(bool, &[u8], &[u8]), RLPDecodeError> { |
Collaborator
There was a problem hiding this comment.
We should replace the bool with an enum, either wrapping the current item slice:
enum RLPItem<'a> {
Int(u8),
String(&'a [u8]),
List(&'a [u8]),
}
// -> Result<(RLPItem, &[u8]), RLPDecodeError>or not:
enum RLPItem {
String,
List,
}
// -> Result<(RLPItem, &[u8], &[u8]), RLPDecodeError>
MegaRedHand
approved these changes
Jun 28, 2024
ricomateo
added a commit
that referenced
this pull request
Jul 2, 2024
This PR depends on #75 and #12 **Motivation** Having some functionality of the discv4 protocol (ping-pong messages) **Description** Enables `Pong` message decoding Closes #81 --------- Co-authored-by: juanbono <juanbono94@gmail.com> Co-authored-by: Tomás Grüner <47506558+MegaRedHand@users.noreply.github.com>
This was referenced Feb 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
This PR adds a RLPDecode trait for decoding RLP encoded data. It also adds implementations for common types.
Description
Closes #18