Skip to content

Conversation

@gballet
Copy link

@gballet gballet commented May 21, 2025

I translated the python test that fails in go, and as it turns out, it's failing with this library as well. This seems to indicate (but it needs to be confirmed) that the python implementation has a bug.

Signed-off-by: Guillaume Ballet <3272758+gballet@users.noreply.github.com>
// which is what I get in the go code as well.
assert_eq!(
hex::encode(hash),
"e93c209026b8b00d76062638102ece415028bd104e1d892d5399375a323f2218"
Copy link
Author

Choose a reason for hiding this comment

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

there's no CI so I'm pointing it out here: this value coming from the python code seems to be incorrect.

Copy link
Owner

Choose a reason for hiding this comment

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

There is CI, just had to approve the run. We can see it fail now.
Let's check first the Python situation and we can update the hash here after.

keys[3][0] = 0x81;
for i in 0..keys.len() {
let mut new_array = [0u8; 32];
new_array[0] = i as u8;
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
new_array[0] = i as u8;
new_array[0] = (i+1) as u8;

as specified in https://github.com/jsign/binary-tree-spec/blob/main/test_tree.py#L83 passes the test correctly with the original state root from the specs.

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