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

Closes #2241: Use Keccak-256 from golang.org/x/crypto/sha3 and mention explicitly #2242

Merged
merged 12 commits into from
Feb 24, 2016

Conversation

jimenezrick
Copy link
Contributor

First of all, apologies for this long PR.

These are the improvements I propose:

  • Use latest version of golang.org/x/crypto/sha3 with a small patch to expose Keccak-256 and update the old copied code. The upstream version of sha3 is a bit faster.
  • Rename all the misleading occurrences of SHA-3 to Keccak-256
  • Remove some bits of dead/old code I saw while doing this

Before merging there are two things that need to be taken care:

@robotally
Copy link

Vote Count Reviewers
👍 2 @fjl @obscuren
👎 0

Updated: Wed Feb 24 11:57:05 UTC 2016

@jimenezrick
Copy link
Contributor Author

The builds will fail until the necessary update to ethash I mentioned before is applied.

@@ -14,7 +14,6 @@
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.

// Package common contains various helper functions.
Copy link
Contributor

Choose a reason for hiding this comment

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

This "unhelpful comment" is the Godoc synopsis of package common and should not be deleted.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No problem, line preserved.

@fjl
Copy link
Contributor

fjl commented Feb 21, 2016

While I certainly appreciate the effort you took to clean up the code, there are a few issues with the PR that I would like to see resolved. The main issue is that we generally avoid vendoring a patched version of a dependency with godep, because it will break as soon as someone else updates the dependencies from upstream.

So far, we have treated crypto dependencies specially by vendoring them directly into our tree, for various reasons. I think it would be better to import the upstream changes into crypto/sha3 and then patch the version in our tree instead.

@jimenezrick
Copy link
Contributor Author

Yeah, that sounds right. It's a bit of a mess to vendor in Go modified libraries. I can adapt the PR easily to do that instead.

@fjl
Copy link
Contributor

fjl commented Feb 21, 2016

For crypto/sha3, the last update from upstream happened in June 2015. Since then the only change has been to include the full text of the license in all files. Please make sure that they stay in place.

@fjl
Copy link
Contributor

fjl commented Feb 21, 2016

For the ethash issue, I think it might be better to preserve crypto.Sha3{,Hash} as an alias for now.
We can do a second pass and remove the alias later.

@fjl
Copy link
Contributor

fjl commented Feb 21, 2016

Ahh, right, one more thing: the commit convention in go-ethereum is to prefix commit messages with the package they modify, e.g. "bytes: remove dead code". If you do a change affecting a lot of packages, you can use prefix "all:". The renaming of both Sha3 and Sha3Hash can just be one commit.

@jimenezrick
Copy link
Contributor Author

Roger that, cheers.

@fjl
Copy link
Contributor

fjl commented Feb 21, 2016

Thank you for contributing to go-ethereum.

@jimenezrick
Copy link
Contributor Author

  • I added an alias so that it doesn't break ethash
  • Upstream sha3 code copied verbatim, including the LICENSE and PATENTS files and small modification to expose Keccak256
  • Reorder of all the commits

@fjl thanks for the suggestions, it's way more clear now ;)

@codecov-io
Copy link

Current coverage is 50.76%

Merging #2242 into develop will increase coverage by +2.74% as of 1722c76

Powered by Codecov. Updated on successful CI builds.

@fjl
Copy link
Contributor

fjl commented Feb 24, 2016

👍

@obscuren
Copy link
Contributor

Thanks for the PR @jimenezrick, appreciated. 👍

obscuren added a commit that referenced this pull request Feb 24, 2016
Closes #2241: Use Keccak-256 from golang.org/x/crypto/sha3 and mention explicitly
@obscuren obscuren merged commit 483feb0 into ethereum:develop Feb 24, 2016
@obscuren obscuren removed the review label Feb 24, 2016
maoueh pushed a commit to streamingfast/go-ethereum that referenced this pull request Mar 4, 2024
maoueh pushed a commit to streamingfast/go-ethereum that referenced this pull request Mar 18, 2024
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.

6 participants