Skip to content

Conversation

@gustavo-grieco
Copy link
Collaborator

@gustavo-grieco gustavo-grieco commented Oct 11, 2025

Description

Fix for the missing case of #886

Checklist

  • tested locally
  • added automated tests
  • updated the docs
  • updated the changelog

@blishko
Copy link
Collaborator

blishko commented Oct 12, 2025

I believe this fix is correct.
I took the liberty to push small changes directly to this branch.
I named the function to make it clear we are sign-extending the number (in case the size of the type is <256 bits)
For completeness I truncate the value to the correct number of bits first.
I also added a simple test case which would previously fail, but it works with this fix.

@blishko
Copy link
Collaborator

blishko commented Oct 12, 2025

@gustavo-grieco , can you test if this still fixes the issue you described in #886?

@gustavo-grieco gustavo-grieco marked this pull request as ready for review October 12, 2025 13:54
@gustavo-grieco
Copy link
Collaborator Author

Just tested the recent changes and all the cases are correctly decoded.

This test was previously failing as we were decoding signed integers as
unsigned and that converting Word256 to Int256 representation.
However, if decoding smaller than 256-bit words, this conversion was
incorrect.
@msooseth
Copy link
Collaborator

Let me push a changelog line :)

Copy link
Collaborator

@msooseth msooseth left a comment

Choose a reason for hiding this comment

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

NICE. I like this bit function, makes it a lot easier to read.

@msooseth msooseth merged commit 9917a0a into main Oct 13, 2025
7 checks passed
@msooseth msooseth deleted the fix-int-decoding branch October 13, 2025 09:46
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.

4 participants