sp1 icon indicating copy to clipboard operation
sp1 copied to clipboard

feat(precompiles)!: SHA-512 implementation [DRAFT]

Open Sofianel5 opened this issue 9 months ago • 0 comments

This PR introduces SHA512_EXTEND and SHA512_COMPRESS syscalls for SHA-512 extend and compress functionality respectively. As of right now, the implementations are not correct as it still using 32bit values instead 64. The purpose of this draft PR is to check in with the succinct team regarding a bug in SHA256_EXTEND. The following tests are failing:

---- syscall::precompiles::sha256::extend::extend_tests::test_sha_prove stdout ----
thread 'syscall::precompiles::sha256::extend::extend_tests::test_sha_prove' panicked at core/src/syscall/precompiles/sha256/extend/mod.rs:104:27:
called `Result::unwrap()` on an `Err` value: Non-zero cumulative sum
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

---- syscall::precompiles::sha256::extend::extend_tests::test_sha256_program stdout ----
stdout: b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9
thread 'syscall::precompiles::sha256::extend::extend_tests::test_sha256_program' panicked at core/src/syscall/precompiles/sha256/extend/mod.rs:111:27:
called `Result::unwrap()` on an `Err` value: Non-zero cumulative sum

---- syscall::precompiles::sha256::extend::extend_tests::test_sha_extend_program stdout ----
stdout: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 33611778, 33611778, 1845625210, 1845625210, 1116355139, 1116355139, 1551477660, 1585089437, 3836468188, 2225920971, 112133553, 994579513, 2801369735, 1729057893, 1370842465, 1637373392, 3774564546, 2721914954, 4023257104, 1229230512, 1863298018, 3373067660, 1916645106, 2120657121, 2601719869, 2577591366, 2940546571, 1360585316, 3056374011, 3632626169, 1676629936, 1552911312, 2229695021, 1143585642, 2251243307, 235009426, 4223079457, 1922326021, 2659168766, 1451684112, 859477243, 264663020, 3494743754, 208639162, 1445520441, 1764013304, 1927368182, 870446334]
thread 'syscall::precompiles::sha256::extend::extend_tests::test_sha_extend_program' panicked at core/src/syscall/precompiles/sha256/extend/mod.rs:118:27:
called `Result::unwrap()` on an `Err` value: Non-zero cumulative sum

Sofianel5 avatar May 15 '24 02:05 Sofianel5