chore(crypto): adopt NewKeccakState wrapper + global hasher pool#76
Open
colinkim wants to merge 3 commits into
Open
chore(crypto): adopt NewKeccakState wrapper + global hasher pool#76colinkim wants to merge 3 commits into
colinkim wants to merge 3 commits into
Conversation
Manually apply the `crypto.NewKeccakState()`wrapper adoption from ethereum/go-ethereum#29362 — only that single change, not the full PR.
Manually apply the `crypto.NewKeccakState()` wrapper adoption from ethereum/go-ethereum#31769 in core/types/hashing.go — only that single-file change, not the full PR.
ethereum/go-ethereum#31769 — only the crypto/crypto.go portion, not the full PR.
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.
Summary
crypto.NewKeccakState()wrapper (from #29362) and the global hasher pool (from #31769).NewKeccakState()wrapper from #29362 and the globalhasherPoolincrypto/crypto.gofrom #31769, because their current shape diverges from upstream enough that they cannot be applied directly.Behaviour and compatibility
sync.Poolis goroutine-safe; hashers are not shared mid-operation across goroutines.golang.org/x/crypto/sha3imports removed from files where no othersha3symbol is used.Test plan
make gstable— build succeedsgo vet ./...— no new warningsgo test ./crypto/...go test ./core/rawdb/... ./core/types/... ./trie/... ./eth/protocols/snap/...go test -bench=BenchmarkKeccak -benchmem ./crypto/...— confirmallocs/opdrops forKeccak256/Keccak256Hashrelative to the pre-PR baselineReferences
9f96e07c1)0eb2eeea9)