prysm icon indicating copy to clipboard operation
prysm copied to clipboard

fix: fix slice init length

Open cuishuang opened this issue 1 year ago • 1 comments

What type of PR is this?

Bug fix

What does this PR do? Why is it needed?

The intention here should be to initialize a slice with a capacity of 32-len(numBytes) rather than initializing the length of this slice.

The only demo: https://go.dev/play/p/q1BcVCmvidW

Which issues(s) does this PR fix?

Fixes #

Other notes for review

Acknowledgements

  • [x] I have read CONTRIBUTING.md.
  • [ ] I have made an appropriate entry to CHANGELOG.md.
  • [ ] I have added a description to this PR with sufficient context for reviewers to understand this PR.

cuishuang avatar Oct 03 '24 06:10 cuishuang

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Oct 03 '24 06:10 CLAassistant

I think you are mistaken. The desired behavior is to pad the slice with zeros, not just allocating a capacity on the slice.

prestonvanloon avatar Nov 21 '24 18:11 prestonvanloon