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

Fix: handle single-byte RLP strings, bump to v0.5.14 #293

Closed
wants to merge 4 commits into from

Conversation

samuelarogbonlo
Copy link

Fixes the RLP decoder to properly handle single-byte strings and bumps version to 0.5.14. Previously, attempting to decode a single-byte string like "a" would result in the error "RLP string ends with -32 superfluous bytes".

Changes:

  • Modified encoder to consistently wrap output in Rlp::Data
  • Fixed handling of single-byte strings in RLP encoding/decoding
  • Added test case to verify single-byte string handling
  • Bumped version from 0.5.13 to 0.5.14

Tests:

  • All existing tests pass
  • Added new test case for single-byte strings
  • Verified fix with direct testing of the failing case:
    Eth::Rlp.decode(Eth::Rlp.encode("a")) # now works correctly

@q9f
Copy link
Owner

q9f commented Dec 17, 2024

All existing tests pass

I get this:

Failures:

  1) Eth::Util.bin_to_hex .hex_to_bin .bin_to_prefixed_hex raises an error when given invalid string
     Failure/Error: expect { Util.bin_to_hex 1234 }.to raise_error TypeError
       expected TypeError but nothing was raised
     # ./spec/eth/util_spec.rb:78:in `block (3 levels) in <top (required)>'

Finished in 19.72 seconds (files took 0.65699 seconds to load)
296 examples, 1 failure, 3 pending

@q9f
Copy link
Owner

q9f commented Feb 11, 2025

Closing for now

@q9f q9f closed this Feb 11, 2025
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