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

Add shouldRejectTrailingBytes test for messages #155

Merged
merged 2 commits into from
Oct 26, 2022

Conversation

jtraglia
Copy link
Contributor

PR Description

So I messed up in #150. I didn't notice that RlpUtil#readRlpList calls checkComplete. Sorry about that.

https://github.com/ConsenSys/discovery/blob/9bb8ad3942f81450fe54a78c66f0b61e58c45b0b/src/main/java/org/ethereum/beacon/discovery/util/RlpUtil.java#L39-L47

This PR will:

  • Remove extraneous checkComplete calls.
  • Add assertRoundTrip and assertRejectTrailingBytes to TestUtil.
  • For each message type test class:
    • Make the decoder object static final (and uppercase its name).
    • For reusability, extract "original" message into a static final field.
    • Add new shouldRejectTrailingBytes test.
    • Replace body of shouldRoundTrip with assertRoundTrip.

Also, unrelated to the core part of this PR:

  • Fix minor format issue (TAUthData -> TAuthData) in HeaderImpl.
  • Fix a couple of it's vs its in comments.

Copy link
Contributor

@ajsutton ajsutton left a comment

Choose a reason for hiding this comment

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

LGTM. Definitely good to add these missed tests.

@ajsutton ajsutton merged commit 1cdaf91 into Consensys:master Oct 26, 2022
@jtraglia jtraglia deleted the generic-message-tests branch October 26, 2022 20:40
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