NethermindEth / cairo-vm-go

A virtual machine for Cairo written in Go
MIT License
82 stars 50 forks source link

fix: fix slice init length #672

Closed rusttech closed 1 month ago

rusttech commented 1 month ago

The purpose here should be to initialize a slice with a capacity of keccakStateSizeFeltsVal and a length of 0, and then append it later. Instead of initializing the length to keccakStateSizeFeltsVal from the beginning, the resulting slice will not meet expectations.

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

Sh0g0-1758 commented 1 month ago

Hi, that is intentional. Please run unit tests with your changes before making a PR. If you ran them, you should have noticed that they fail with your changes which should have hinted that the current implementation in fact does meet expectations.

Thank you for taking out your time to look into this project!