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

Update EIP-152: Fix reference test #8390

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions EIPS/eip-152.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
created: 2016-10-04
---

## Simple Summary

Check failure on line 12 in EIPS/eip-152.md

View workflow job for this annotation

GitHub Actions / EIP Walidator

body has extra section(s)

error[markdown-order-section]: body has extra section(s) --> EIPS/eip-152.md | 12 | ## Simple Summary | ::: EIPS/eip-152.md | 177 | ## Implementation | ::: EIPS/eip-152.md | 181 | ## References | ::: EIPS/eip-152.md | 189 | ## Appendix - benchmarks | = help: see https://ethereum.github.io/eipw/markdown-order-section/

Check failure on line 12 in EIPS/eip-152.md

View workflow job for this annotation

GitHub Actions / EIP Walidator

body has extra section(s)

error[markdown-order-section]: body has extra section(s) --> EIPS/eip-152.md | 12 | ## Simple Summary | ::: EIPS/eip-152.md | 177 | ## Implementation | ::: EIPS/eip-152.md | 181 | ## References | ::: EIPS/eip-152.md | 189 | ## Appendix - benchmarks | = help: see https://ethereum.github.io/eipw/markdown-order-section/

This EIP will enable the BLAKE2b hash function and other higher-round 64-bit BLAKE2 variants to run cheaply on the EVM, allowing easier interoperability between Ethereum and Zcash as well as other Equihash-based PoW coins.

Expand All @@ -27,9 +27,9 @@

## Specification

We propose adding a precompiled contract at address `0x09` wrapping the [BLAKE2 `F` compression function](https://tools.ietf.org/html/rfc7693#section-3.2).

Check failure on line 30 in EIPS/eip-152.md

View workflow job for this annotation

GitHub Actions / EIP Walidator

non-relative link or image

error[markdown-rel-links]: non-relative link or image --> EIPS/eip-152.md | 30 | We propose adding a precompiled contract at address `0x09` wrapping the [BLAKE2 `F` compression function](https://tools.ietf.org/html/rfc7693#section-3.2). | = help: see https://ethereum.github.io/eipw/markdown-rel-links/

Check failure on line 30 in EIPS/eip-152.md

View workflow job for this annotation

GitHub Actions / EIP Walidator

non-relative link or image

error[markdown-rel-links]: non-relative link or image --> EIPS/eip-152.md | 30 | We propose adding a precompiled contract at address `0x09` wrapping the [BLAKE2 `F` compression function](https://tools.ietf.org/html/rfc7693#section-3.2). | = help: see https://ethereum.github.io/eipw/markdown-rel-links/

The precompile requires 6 inputs tightly encoded, taking exactly 213 bytes, as explained below. The encoded inputs are corresponding to the ones specified in the [BLAKE2 RFC Section 3.2](https://tools.ietf.org/html/rfc7693#section-3.2):

Check failure on line 32 in EIPS/eip-152.md

View workflow job for this annotation

GitHub Actions / EIP Walidator

non-relative link or image

error[markdown-rel-links]: non-relative link or image --> EIPS/eip-152.md | 32 | The precompile requires 6 inputs tightly encoded, taking exactly 213 bytes, as explained below. The encoded inputs are corresponding to the ones specified in the [BLAKE2 RFC Section 3.2](https://tools.ietf.org/html/rfc7693#section-3.2): |

Check failure on line 32 in EIPS/eip-152.md

View workflow job for this annotation

GitHub Actions / EIP Walidator

non-relative link or image

error[markdown-rel-links]: non-relative link or image --> EIPS/eip-152.md | 32 | The precompile requires 6 inputs tightly encoded, taking exactly 213 bytes, as explained below. The encoded inputs are corresponding to the ones specified in the [BLAKE2 RFC Section 3.2](https://tools.ietf.org/html/rfc7693#section-3.2): |

- `rounds` - the number of rounds - 32-bit unsigned big-endian word
- `h` - the state vector - 8 unsigned 64-bit little-endian words
Expand All @@ -45,7 +45,7 @@
The boolean `f` parameter is considered as `false` if set to `0`.
All other values yield an invalid encoding of `f` error.

The precompile should compute the `F` function as [specified in the RFC](https://tools.ietf.org/html/rfc7693#section-3.2) and return the updated state vector `h` with unchanged encoding (little-endian).

Check failure on line 48 in EIPS/eip-152.md

View workflow job for this annotation

GitHub Actions / EIP Walidator

non-relative link or image

error[markdown-rel-links]: non-relative link or image --> EIPS/eip-152.md | 48 | The precompile should compute the `F` function as [specified in the RFC](https://tools.ietf.org/html/rfc7693#section-3.2) and return the updated state vector `h` with unchanged encoding (little-endian). |

Check failure on line 48 in EIPS/eip-152.md

View workflow job for this annotation

GitHub Actions / EIP Walidator

non-relative link or image

error[markdown-rel-links]: non-relative link or image --> EIPS/eip-152.md | 48 | The precompile should compute the `F` function as [specified in the RFC](https://tools.ietf.org/html/rfc7693#section-3.2) and return the updated state vector `h` with unchanged encoding (little-endian). |

### Example Usage in Solidity

Expand Down Expand Up @@ -80,8 +80,8 @@
m[3] = hex"0000000000000000000000000000000000000000000000000000000000000000";

bytes8[2] memory t;
t[0] = hex"03000000";
t[1] = hex"00000000";
t[0] = hex"0300000000000000";
t[1] = hex"0000000000000000";

bool f = true;

Expand All @@ -104,16 +104,16 @@

An obvious implementation would be a direct BLAKE2b hash function precompile. At first glance, a BLAKE2b precompile satisfies most hashing and interoperability requirements on the EVM. Once we started digging in, however, it became clear that any BLAKE2b implementation would need specific features and internal modifications based on different projects' requirements and libraries.

A [thread with the Zcash team](https://github.com/ethereum/EIPs/issues/152#issuecomment-499240310) makes the issue clear.

Check failure on line 107 in EIPS/eip-152.md

View workflow job for this annotation

GitHub Actions / EIP Walidator

non-relative link or image

error[markdown-rel-links]: non-relative link or image --> EIPS/eip-152.md | 107 | A [thread with the Zcash team](https://github.com/ethereum/EIPs/issues/152#issuecomment-499240310) makes the issue clear. |

Check failure on line 107 in EIPS/eip-152.md

View workflow job for this annotation

GitHub Actions / EIP Walidator

non-relative link or image

error[markdown-rel-links]: non-relative link or image --> EIPS/eip-152.md | 107 | A [thread with the Zcash team](https://github.com/ethereum/EIPs/issues/152#issuecomment-499240310) makes the issue clear. |

> The minimal thing that is necessary for a working ZEC-ETH relay is an implementation of BLAKE2b Compression F in a precompile.

Check failure on line 110 in EIPS/eip-152.md

View workflow job for this annotation

GitHub Actions / Markdown Linter

Blank line inside blockquote

EIPS/eip-152.md:110 MD028/no-blanks-blockquote Blank line inside blockquote

Check failure on line 110 in EIPS/eip-152.md

View workflow job for this annotation

GitHub Actions / Markdown Linter

Blank line inside blockquote

EIPS/eip-152.md:110 MD028/no-blanks-blockquote Blank line inside blockquote
> A BLAKE2b Compression Function F precompile would also suffice for the Filecoin and Handshake interop goals.

Check failure on line 112 in EIPS/eip-152.md

View workflow job for this annotation

GitHub Actions / Markdown Linter

Blank line inside blockquote

EIPS/eip-152.md:112 MD028/no-blanks-blockquote Blank line inside blockquote

Check failure on line 112 in EIPS/eip-152.md

View workflow job for this annotation

GitHub Actions / Markdown Linter

Blank line inside blockquote

EIPS/eip-152.md:112 MD028/no-blanks-blockquote Blank line inside blockquote
> A full BLAKE2b precompile would suffice for a ZEC-ETH relay, provided that the implementation provided the parts of the BLAKE2 API that we need (personalization, maybe something else—I'm not sure).

Check failure on line 114 in EIPS/eip-152.md

View workflow job for this annotation

GitHub Actions / Markdown Linter

Blank line inside blockquote

EIPS/eip-152.md:114 MD028/no-blanks-blockquote Blank line inside blockquote

Check failure on line 114 in EIPS/eip-152.md

View workflow job for this annotation

GitHub Actions / Markdown Linter

Blank line inside blockquote

EIPS/eip-152.md:114 MD028/no-blanks-blockquote Blank line inside blockquote
> I'm not 100% certain if a full BLAKE2b precompile would also suffice for the Filecoin and Handshake goals. It almost certainly could, provided that it supports all the API that they need.

Check failure on line 116 in EIPS/eip-152.md

View workflow job for this annotation

GitHub Actions / Markdown Linter

Blank line inside blockquote

EIPS/eip-152.md:116 MD028/no-blanks-blockquote Blank line inside blockquote

Check failure on line 116 in EIPS/eip-152.md

View workflow job for this annotation

GitHub Actions / Markdown Linter

Blank line inside blockquote

EIPS/eip-152.md:116 MD028/no-blanks-blockquote Blank line inside blockquote
> BLAKE2s — whether the Compression Function F or the full hash — is only a nice-to-have for the purposes of a ZEC-ETH relay.

From this and other conversations with teams in the space, we believe we should focus first on the `F` precompile as a strictly necessary piece for interoperability projects. A BLAKE2b precompile is a nice-to-have, and we support any efforts to add one-- but it's unclear whether complete requirements and a flexible API can be found in time for Istanbul.
Expand All @@ -126,11 +126,11 @@

## Test Cases

#### Test vector 0

Check failure on line 129 in EIPS/eip-152.md

View workflow job for this annotation

GitHub Actions / Markdown Linter

Heading levels should only increment by one level at a time [Expected: h3; Actual: h4]

EIPS/eip-152.md:129 MD001/heading-increment/header-increment Heading levels should only increment by one level at a time [Expected: h3; Actual: h4]

Check failure on line 129 in EIPS/eip-152.md

View workflow job for this annotation

GitHub Actions / Markdown Linter

Headings should be surrounded by blank lines [Expected: 1; Actual: 0; Below] [Context: "#### Test vector 0"]

EIPS/eip-152.md:129 MD022/blanks-around-headings/blanks-around-headers Headings should be surrounded by blank lines [Expected: 1; Actual: 0; Below] [Context: "#### Test vector 0"]

Check failure on line 129 in EIPS/eip-152.md

View workflow job for this annotation

GitHub Actions / Markdown Linter

Heading levels should only increment by one level at a time [Expected: h3; Actual: h4]

EIPS/eip-152.md:129 MD001/heading-increment/header-increment Heading levels should only increment by one level at a time [Expected: h3; Actual: h4]

Check failure on line 129 in EIPS/eip-152.md

View workflow job for this annotation

GitHub Actions / Markdown Linter

Headings should be surrounded by blank lines [Expected: 1; Actual: 0; Below] [Context: "#### Test vector 0"]

EIPS/eip-152.md:129 MD022/blanks-around-headings/blanks-around-headers Headings should be surrounded by blank lines [Expected: 1; Actual: 0; Below] [Context: "#### Test vector 0"]
* input: (empty)

Check failure on line 130 in EIPS/eip-152.md

View workflow job for this annotation

GitHub Actions / Markdown Linter

Unordered list style [Expected: dash; Actual: asterisk]

EIPS/eip-152.md:130:1 MD004/ul-style Unordered list style [Expected: dash; Actual: asterisk]

Check failure on line 130 in EIPS/eip-152.md

View workflow job for this annotation

GitHub Actions / Markdown Linter

Lists should be surrounded by blank lines [Context: "* input: (empty)"]

EIPS/eip-152.md:130 MD032/blanks-around-lists Lists should be surrounded by blank lines [Context: "* input: (empty)"]

Check failure on line 130 in EIPS/eip-152.md

View workflow job for this annotation

GitHub Actions / Markdown Linter

Unordered list style [Expected: dash; Actual: asterisk]

EIPS/eip-152.md:130:1 MD004/ul-style Unordered list style [Expected: dash; Actual: asterisk]

Check failure on line 130 in EIPS/eip-152.md

View workflow job for this annotation

GitHub Actions / Markdown Linter

Lists should be surrounded by blank lines [Context: "* input: (empty)"]

EIPS/eip-152.md:130 MD032/blanks-around-lists Lists should be surrounded by blank lines [Context: "* input: (empty)"]
* output: error "input length for BLAKE2 F precompile should be exactly 213 bytes"

Check failure on line 131 in EIPS/eip-152.md

View workflow job for this annotation

GitHub Actions / Markdown Linter

Unordered list style [Expected: dash; Actual: asterisk]

EIPS/eip-152.md:131:1 MD004/ul-style Unordered list style [Expected: dash; Actual: asterisk]

Check failure on line 131 in EIPS/eip-152.md

View workflow job for this annotation

GitHub Actions / Markdown Linter

Unordered list style [Expected: dash; Actual: asterisk]

EIPS/eip-152.md:131:1 MD004/ul-style Unordered list style [Expected: dash; Actual: asterisk]

#### Test vector 1

Check failure on line 133 in EIPS/eip-152.md

View workflow job for this annotation

GitHub Actions / Markdown Linter

Headings should be surrounded by blank lines [Expected: 1; Actual: 0; Below] [Context: "#### Test vector 1"]

EIPS/eip-152.md:133 MD022/blanks-around-headings/blanks-around-headers Headings should be surrounded by blank lines [Expected: 1; Actual: 0; Below] [Context: "#### Test vector 1"]

Check failure on line 133 in EIPS/eip-152.md

View workflow job for this annotation

GitHub Actions / Markdown Linter

Headings should be surrounded by blank lines [Expected: 1; Actual: 0; Below] [Context: "#### Test vector 1"]

EIPS/eip-152.md:133 MD022/blanks-around-headings/blanks-around-headers Headings should be surrounded by blank lines [Expected: 1; Actual: 0; Below] [Context: "#### Test vector 1"]
* input:
`00000c48c9bdf267e6096a3ba7ca8485ae67bb2bf894fe72f36e3cf1361d5f3af54fa5d182e6ad7f520e511f6c3e2b8c68059b6bbd41fbabd9831f79217e1319cde05b61626300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000001`
* output: error "input length for BLAKE2 F precompile should be exactly 213 bytes"
Expand Down Expand Up @@ -176,15 +176,15 @@

## Implementation

An initial implementation of the `F` function in Go, adapted from the standard library, can be found in our [Golang BLAKE2 library fork](https://github.com/keep-network/blake2-f). There's also an implementation of the precompile in our fork of [go-ethereum](https://github.com/keep-network/go-ethereum/pull/4).

Check failure on line 179 in EIPS/eip-152.md

View workflow job for this annotation

GitHub Actions / EIP Walidator

non-relative link or image

error[markdown-rel-links]: non-relative link or image --> EIPS/eip-152.md | 179 | An initial implementation of the `F` function in Go, adapted from the standard library, can be found in our [Golang BLAKE2 library fork](https://github.com/keep-network/blake2-f). There's also an implementation of the precompile in our fork of [go-ethereum](https://github.com/keep-network/go-ethereum/pull/4). |

Check failure on line 179 in EIPS/eip-152.md

View workflow job for this annotation

GitHub Actions / EIP Walidator

non-relative link or image

error[markdown-rel-links]: non-relative link or image --> EIPS/eip-152.md | 179 | An initial implementation of the `F` function in Go, adapted from the standard library, can be found in our [Golang BLAKE2 library fork](https://github.com/keep-network/blake2-f). There's also an implementation of the precompile in our fork of [go-ethereum](https://github.com/keep-network/go-ethereum/pull/4). |

Check failure on line 179 in EIPS/eip-152.md

View workflow job for this annotation

GitHub Actions / EIP Walidator

non-relative link or image

error[markdown-rel-links]: non-relative link or image --> EIPS/eip-152.md | 179 | An initial implementation of the `F` function in Go, adapted from the standard library, can be found in our [Golang BLAKE2 library fork](https://github.com/keep-network/blake2-f). There's also an implementation of the precompile in our fork of [go-ethereum](https://github.com/keep-network/go-ethereum/pull/4). |

Check failure on line 179 in EIPS/eip-152.md

View workflow job for this annotation

GitHub Actions / EIP Walidator

non-relative link or image

error[markdown-rel-links]: non-relative link or image --> EIPS/eip-152.md | 179 | An initial implementation of the `F` function in Go, adapted from the standard library, can be found in our [Golang BLAKE2 library fork](https://github.com/keep-network/blake2-f). There's also an implementation of the precompile in our fork of [go-ethereum](https://github.com/keep-network/go-ethereum/pull/4). |

## References

For reference, further discussion on this EIP also occurred in the following PRs and issues

* [Original Issue](https://github.com/ethereum/EIPs/issues/152)

Check failure on line 185 in EIPS/eip-152.md

View workflow job for this annotation

GitHub Actions / EIP Walidator

non-relative link or image

error[markdown-rel-links]: non-relative link or image --> EIPS/eip-152.md | 185 | * [Original Issue](https://github.com/ethereum/EIPs/issues/152) |

Check failure on line 185 in EIPS/eip-152.md

View workflow job for this annotation

GitHub Actions / EIP Walidator

non-relative link or image

error[markdown-rel-links]: non-relative link or image --> EIPS/eip-152.md | 185 | * [Original Issue](https://github.com/ethereum/EIPs/issues/152) |
* [Ethereum Magicians](https://ethereum-magicians.org/t/blake2b-f-precompile/3157)

Check failure on line 186 in EIPS/eip-152.md

View workflow job for this annotation

GitHub Actions / EIP Walidator

non-relative link or image

error[markdown-rel-links]: non-relative link or image --> EIPS/eip-152.md | 186 | * [Ethereum Magicians](https://ethereum-magicians.org/t/blake2b-f-precompile/3157) |

Check failure on line 186 in EIPS/eip-152.md

View workflow job for this annotation

GitHub Actions / EIP Walidator

non-relative link or image

error[markdown-rel-links]: non-relative link or image --> EIPS/eip-152.md | 186 | * [Ethereum Magicians](https://ethereum-magicians.org/t/blake2b-f-precompile/3157) |
* [PR 2129](https://github.com/ethereum/EIPs/pull/2129)

Check failure on line 187 in EIPS/eip-152.md

View workflow job for this annotation

GitHub Actions / EIP Walidator

non-relative link or image

error[markdown-rel-links]: non-relative link or image --> EIPS/eip-152.md | 187 | * [PR 2129](https://github.com/ethereum/EIPs/pull/2129) |

Check failure on line 187 in EIPS/eip-152.md

View workflow job for this annotation

GitHub Actions / EIP Walidator

non-relative link or image

error[markdown-rel-links]: non-relative link or image --> EIPS/eip-152.md | 187 | * [PR 2129](https://github.com/ethereum/EIPs/pull/2129) |

## Appendix - benchmarks

Expand Down
Loading