metacraft-labs / DendrETH

A smart contract implementation of the Ethereum light client sync protocol
GNU General Public License v3.0
45 stars 9 forks source link

Make SHA256 tests more explicit #310

Closed smanilov closed 4 months ago

smanilov commented 4 months ago

The tests now reuse the code for the test logic. They differ only in the input data and the expected messages.

The inputs for the tests are now explicitly specified as bytes in hex, as well as the expected output. This surfaces that the last byte of the succeeding test is 0x00, which might be not have been the intention, reading the original code.

Randomness is removed from the failing test, as it is an unnecessary complication and reduces reproducibility of the test.

A new test is added that makes sure the SHA256 implementation corresponds to that of coreutils-9.3 for one real ASCII string.

smanilov commented 4 months ago

Could you please merge this, since I don't have write access. Thanks.