Skip to content

[rlp] fix nested unbounded lists #203

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

Merged
merged 3 commits into from
Sep 4, 2019
Merged

Conversation

ordian
Copy link
Member

@ordian ordian commented Aug 26, 2019

Fixes #105.

@@ -335,6 +334,7 @@ impl RlpStream {
let len = self.buffer.len() - list.position;
self.encoder().insert_list_payload(len, list.position);
self.note_appended(1);
self.finished_list = true;
Copy link
Member Author

Choose a reason for hiding this comment

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

the fix is here

Copy link
Contributor

@dvdplm dvdplm left a comment

Choose a reason for hiding this comment

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

lgtm

@@ -326,7 +325,7 @@ impl RlpStream {
BasicEncoder::new(self)
}

/// Finalize current ubnbound list. Panics if no unbounded list has been opened.
/// Finalize current unbounded list. Panics if no unbounded list has been opened.
pub fn complete_unbounded_list(&mut self) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Unrelated, but maybe this should be called finalize_unbounded_list()?

Copy link
Member Author

Choose a reason for hiding this comment

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

Both sounds fine to me, but I'm not a native speaker. Also, I'd like to avoid breaking changes.

Copy link
Contributor

Choose a reason for hiding this comment

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

"complete" can be both the imperative form of the verb as in "complete your homework before dinner!" or be and adjective "a complete list of my belongings".
"finalize" does not have this ambiguity.

In this context the ambiguity makes it unclear if the method returns an unbounded list of something that is complete, or that it takes an unbounded list and completes it.

We can add a copy named finalize_unbounded_list and deprecate this one. In another PR.

Copy link
Member Author

Choose a reason for hiding this comment

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

opened #204

@ordian ordian merged commit a83e761 into master Sep 4, 2019
@ordian ordian deleted the ao-fix-rlp-unbounded-list branch September 4, 2019 12:45
ordian pushed a commit that referenced this pull request Sep 5, 2019
* master:
  [plain_hasher] Migrate to 2018 edition (#213)
  [ethbloom] Improve ethbloom (#215)
  [rlp] fix nested unbounded lists (#203)
  stabilize parity-bytes in no_std environment (#212)
  Speed up hex serialization, support Serde `with`, and fix warnings (#208)
  [ethbloom, ethereum-types,kvdb] migrate to 2018 edition (#205)
  Introduce `ContractAddress` newtype instead of scheme enum (#200)
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.

[RLP] Unexpected behavior when encoding nested lists with RLP
3 participants