-
Notifications
You must be signed in to change notification settings - Fork 784
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
VM: Fix Blake2B with messages with a length >= 5 #1486
Conversation
Codecov Report
Flags with carried forward coverage won't be shown. Click here to find out more. |
I noticed that Uint32 arrays endianness is based upon the OS endianness. So we might want to test this also on big endian OS - then this might fail. |
@jochem-brouwer pretty cool that you got something on this that quickly! 😄 This is what I got from Sina, asked him per DM if he has got some insight:
|
I have created a dirty fuzzer and ran 1000 random inputs against Infura and checked if the VM reported the same outcome. I have tested rounds up to (If necessary I can dump the fuzzer in a comment here) |
To clear up any confusion about endianness; we actually read the message in little endian as can be seen here. |
I am pretty convinced this is now fixed. |
Is it worth adding an upstream test case for this in https://github.com/ethereum/tests? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very cool, Ori has even already added some new test cases for this (see ethereum/tests#948).
Will merge, planning monorepo releases for Monday or Tuesday anyhow, so this will get into a release soon.
Closes #1482
I need to verify that these changes are correct. I noticed that in the original spec (https://github.com/dcposch/blakejs/blob/master/blake2b.js) the B2B_GET32 receives an Uint8Array, where we pass an Uint32Array. The Uint32Array we are using is already little endian.
I have locally fuzzed 1000 random messages (rounds <=
2^16-1
) against Infura and verified these were the same as which the VM reports after these changes.