Skip to content

docs(crypto): warn that the deprecated ripemd160 import is consensus critical - #566

Open
0xrlawrence wants to merge 1 commit into
canopy-network:mainfrom
0xrlawrence:docs/ripemd160-consensus-warning
Open

docs(crypto): warn that the deprecated ripemd160 import is consensus critical#566
0xrlawrence wants to merge 1 commit into
canopy-network:mainfrom
0xrlawrence:docs/ripemd160-consensus-warning

Conversation

@0xrlawrence

Copy link
Copy Markdown

Description

staticcheck reports golang.org/x/crypto/ripemd160 as 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 in SECP256K1PublicKey.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

  • Comment at the import explaining why the deprecated package is intentional, and what to do instead if it is ever removed from x/crypto (vendor an equivalent implementation, do not change the algorithm).
  • Comment at the 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

…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.
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.

1 participant