Sitelet https://github.com/Nethereum/Nethereum/pull/1122
Skip to content

fix: write the 0x prefix back onto each hex string in an array - #1122

Merged
juanfranblanco merged 1 commit into
Nethereum:masterfrom
SashaMIT:codered-hex-prefix-array
Sep 26, 2026
Merged

juanfranblanco merged 1 commit into
Nethereum:masterfrom
SashaMIT:codered-hex-prefix-array

Conversation

@SashaMIT

Copy link
Copy Markdown
Contributor

Summary

EnsureHexPrefix on a string[] called the string helper and ignored the return value, so the array was handed back unchanged. new[] { "deadbeef", "0xabc" } stayed deadbeef and 0xabc.

The loop now writes each prefixed string back. A value that already has 0x is left as it is. A null array still returns null.

Someone who prefixes a batch of addresses or hashes before a call was getting the original strings. The method returned success and did not add the prefix.

Test plan

  • The array case failed before the write-back (Assert.Equal on 0xdeadbeef) and passes after
  • The same assertion is in ShouldEnsureHexPrefix
  • Full Nethereum.ABI.UnitTests suite was not run here. That project pulls the rest of the solution. The focused test compiles HexByteConvertorExtensions.cs on net8.0 and is 1 passed

Made with Cursor

EnsureHexPrefix on a string array called the string helper and dropped the result, so the array came back unchanged.
@juanfranblanco
juanfranblanco merged commit c10954b into Nethereum:master Sep 26, 2026
@juanfranblanco

Copy link
Copy Markdown
Member

Thank you!

@SashaMIT

Copy link
Copy Markdown
Contributor Author

Thanks for merging this.

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