Skip to content
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

Adapt blake2 precompile to match the EIP #36

Open
axic opened this issue Dec 22, 2018 · 5 comments · May be fixed by #76
Open

Adapt blake2 precompile to match the EIP #36

axic opened this issue Dec 22, 2018 · 5 comments · May be fixed by #76
Labels
help wanted Extra attention is needed

Comments

@axic
Copy link
Member

axic commented Dec 22, 2018

See ethereum/EIPs#152

@axic axic added the help wanted Extra attention is needed label Dec 22, 2018
@hugo-dc
Copy link
Member

hugo-dc commented Jan 29, 2019

Could you explain a bit further what has to be done?

Here is what I understand so far:
Current blake2 implementation just reads an input data and calculates the blake2b hash using the blake2 crate. In order to change it to match the EIP the following has to be done:

  • Read input data h (current state)
  • Read input data t (data length)
  • Read input data m (message/data) with length t
  • Read input data f (finalization flag)
  • Read input data r (rounds)

Based on data length t we can calculate if we need to call Blake2b or Blake2s. Then set h (using new_keyed fn, and request the output, but currently the result fn sets 0 as finalization flag.

@axic
Copy link
Member Author

axic commented Feb 13, 2019

@hugo-dc sorry for the delay. Yes, that is correct, it needs to follow what specification of the EIP. I'm not sure if we can use the current crate - likely not -, because we need direct access to all parameters of blake2.

@axic
Copy link
Member Author

axic commented Jun 13, 2019

The current version of the Blake2 precompile is here: ethereum/EIPs#2024

Our code is pretty close to that and would be easy to update.

@axic axic removed the help wanted Extra attention is needed label Jun 19, 2019
@axic
Copy link
Member Author

axic commented Jun 24, 2019

It seems the now-current proposal is at ethereum/EIPs#2129, which brings us back to a specification similar to #36 (comment)

@axic
Copy link
Member Author

axic commented Dec 10, 2019

The final EIP, which went live 2 days ago with Istanbul, is quite different: https://eips.ethereum.org/EIPS/eip-152

@axic axic added the help wanted Extra attention is needed label Dec 10, 2019
@g-r-a-n-t g-r-a-n-t linked a pull request Apr 28, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants