ChainSafe / ChainSafe/gossamer
Replace `common.NewHash` and `common.Hash()` with `common.BytesToHash`
- Dominant language
- Go
- Stars
- 454
- Forks
- 144
- PR merge metrics
- No merged PRs in 30d
Description
## Issue summary
- `common.BytesToHash`, `common.NewHash` and `common.Hash` changes bytes to hash (does not hash, just converts). Both of these functions are used interchangeably, but `common.BytesToHash` puts 0 bytes in the front and `common.NewHash` puts 0 bytes in the back.
- Say `[]byte` argument is `0x44102080304545b0b6579496e736964656368696c6414766f696c61`
`common.BytesToHash` will give hash like `0x00000000044102080304545b0b6579496e736964656368696c6414766f696c61` and `common.NewHash` will give a hash like `0x44102080304545b0b6579496e736964656368696c6414766f696c61000000000`
- We should pick one of them and use it across the project to avoid any mismatching in the value of hash. I have gone with `common.BytesToHash` so far.
## Other information and links
- inspired from this pr https://github.com/ChainSafe/gossamer/pull/2302
Contributor guide
Assessment
This issue has not been assessed yet.