Skip to content

rlp: fix hexToBytes bug#4276

Merged
gabrocheleau merged 2 commits into
masterfrom
hex-fix
Apr 23, 2026
Merged

rlp: fix hexToBytes bug#4276
gabrocheleau merged 2 commits into
masterfrom
hex-fix

Conversation

@ScottyPoi

Copy link
Copy Markdown
Contributor

Fix for bug pointed out in issue #4275

Adds missing unit test that would have caught bug.

Copilot AI review requested due to automatic review settings April 22, 2026 22:26
@ScottyPoi ScottyPoi linked an issue Apr 22, 2026 that may be closed by this pull request

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes an hexToBytes parsing bug for 0x-prefixed hex strings (as reported in issue #4275) and adds coverage to prevent regressions.

Changes:

  • Correct hexToBytes to strip the 0x prefix via hex.slice(2) (instead of incorrectly keeping only the prefix).
  • Add unit tests validating decoding for both 0x-prefixed and non-prefixed hex strings.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
packages/rlp/src/index.ts Fixes hexToBytes handling of 0x-prefixed strings.
packages/rlp/test/dataTypes.spec.ts Adds regression tests for hexToBytes with and without 0x prefix.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov

codecov Bot commented Apr 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.20%. Comparing base (b3ea7a4) to head (77cbe48).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

Flag Coverage Δ
block 87.33% <ø> (ø)
blockchain 88.82% <ø> (ø)
common 93.44% <ø> (ø)
evm 61.22% <ø> (ø)
mpt 89.64% <ø> (ø)
statemanager 78.04% <ø> (ø)
static 91.35% <100.00%> (ø)
tx 88.01% <ø> (ø)
util 80.83% <ø> (ø)
vm 55.45% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

Copy link
Copy Markdown

📦 Bundle Size Analysis

Package Size (min+gzip) Δ
binarytree 17.5 KB 🟢 -0.0 KB (-0.05%)
block 43.6 KB ⚪ ±0%
blockchain 69.8 KB ⚪ ±0%
common 25.4 KB ⚪ ±0%
devp2p 17.7 KB 🟢 -0.0 KB (-0.02%)
e2store 87.2 KB ⚪ ±0%
ethash 61.6 KB 🟢 -0.0 KB (-0.01%)
evm 62.5 KB ⚪ ±0%
genesis 272.2 KB ⚪ ±0%
mpt 21.9 KB 🟢 -0.0 KB (-0.03%)
rlp 1.7 KB 🟢 -0.0 KB (-0.06%)
statemanager 41.2 KB 🟢 -0.0 KB (-0.02%)
testdata 43.8 KB ⚪ ±0%
tx 20.8 KB ⚪ ±0%
util 13.2 KB 🟢 -0.0 KB (-0.01%)
vm 154.6 KB ⚪ ±0%
wallet 15.0 KB ⚪ ±0%

Values are minified+gzipped bundles of each package entry. Workspace deps are bundled; external deps are excluded.

Generated by bundle-size workflow

@gabrocheleau gabrocheleau merged commit 7a45848 into master Apr 23, 2026
39 of 40 checks passed
@holgerd77 holgerd77 deleted the hex-fix branch May 15, 2026 08:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A bug here

4 participants