Skip to content
This repository has been archived by the owner on Jun 17, 2021. It is now read-only.

[Istanbul] EIP-2129/152: Add Blake2b F Hash Function #203

Closed
holgerd77 opened this issue Jun 23, 2019 · 8 comments
Closed

[Istanbul] EIP-2129/152: Add Blake2b F Hash Function #203

holgerd77 opened this issue Jun 23, 2019 · 8 comments

Comments

@holgerd77
Copy link
Member

holgerd77 commented Jun 23, 2019

EIP-2129/152 adding a Blake2b F hash function precompile has been approved for Istanbul in the Ethereum All Core Devs Call 66.

This should likely be added here in the hash module first like the keccak hash functions and then doing the precompile over on the VM using the functionality from here.

Did a first search, here are two implementations which seems solid and with friendly licensing (both on first sight, needs some confirmation):

The native vs JS discussion from this issue #195 is relevant in this context analogously.

Update: I updated this with the final decision from ACD 66, there were some rival EIPs before which were discarded.

@s1na
Copy link
Contributor

s1na commented Jun 24, 2019

I'd be interested in tackling this once the dust settles and we know the details (and have some test vectors).

@holgerd77
Copy link
Member Author

Go ahead! 😀 On a rough look I think usage of Blake2b version of the hash function is already settled independent from the concrete EIP chosen, so I guess we can already start integrating the plain hash function support here?

@s1na
Copy link
Contributor

s1na commented Jun 24, 2019

I think EIP-2129 supercedes EIP-2024. EIP-2129 proposes an internal function used for computing a blake2b hash (the blake2b F compression function) as a precompile.

Blakejs doesn't publicly expose the F compression function. Blake2.wasm doesn't either. I couldn't also find the source for its wasm binary.

I see three options (might not be an exhaustive):

  • Verify that blakejs's compress function corresponds exactly to the F function and ask the maintainer to expose it (if they accept, fork it otherwise). Alternatively use their blake2bUpdate function, but make sure to counteract it's side-effects.
  • Compile the relevant parts from the reference C implementation to wasm, or wait for a rust implementation and compile that to wasm.
  • Implement the F function ourselves (as a last resort).

Relevant links

@axic
Copy link
Member

axic commented Jun 24, 2019

I wouldn't start working on this before the EIP is merged and has a more complete specification.

@elizapetrovska
Copy link

Update: there is this rival EIP-2129 I just read upon on the ACD Gitter, not sure which one will make it. Please update this post + title once clear.

It was indeed ethereum/EIPs#2129
This might help clarify on the EIP confusion - the core dev call recording, starting with the discussion on 2024 and 2129

https://youtu.be/Cl5zGk-3Ej4?t=2734

@holgerd77
Copy link
Member Author

@elizapetrovska Thanks for the reference!

@holgerd77 holgerd77 changed the title [Istanbul] EIP-2024: Add Blake2b Hash Function [Istanbul] EIP-2129/152: Add Blake2b F Hash Function Aug 3, 2019
@holgerd77
Copy link
Member Author

Updated description and links in the initial post, EIP was now clearly marked as "accepted" in the last ACD 66, should now be ready to be tackled.

@holgerd77
Copy link
Member Author

Will be directly integrated in the VM - see ethereumjs/ethereumjs-monorepo#584 - will close here.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants