docs(crypto): warn that the deprecated ripemd160 import is consensus critical - #566
Open
0xrlawrence wants to merge 1 commit into
Open
docs(crypto): warn that the deprecated ripemd160 import is consensus critical#5660xrlawrence wants to merge 1 commit into
0xrlawrence wants to merge 1 commit into
Conversation
…critical staticcheck reports golang.org/x/crypto/ripemd160 as SA1019, and its own deprecation notice advises using a modern hash instead. Acting on that advice here would be a chain split: RIPEMD-160(SHA-256(pubkey)) defines the SECP256K1 address format, so changing the hash changes every address on the network. This adds a comment at the import and at the Address() call site so the next contributor who runs a linter does not 'fix' it, and records what to do instead if the package is eventually removed from x/crypto. Comments only; no functional change.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
staticcheck reports
golang.org/x/crypto/ripemd160as SA1019, and the package's own deprecation notice advises using a modern hash like SHA-256 instead.Acting on that advice here would split the chain.
RIPEMD-160(SHA-256(pubkey))defines the SECP256K1 address format inSECP256K1PublicKey.Address(), so changing the hash changes every SECP256K1 address on the network.This is the kind of thing a contributor running a linter fixes in good faith without realising the blast radius.
Changes Made
x/crypto(vendor an equivalent implementation, do not change the algorithm).Address()call site marking the hash as consensus critical.Comments only; no functional change.
Testing
go build ./...go test ./lib/crypto/passes🤖 Generated with Claude Code