0xPolygonZero / plonky2

Apache License 2.0
757 stars 283 forks source link

Fix kernel codehash discrepancy #1400

Closed Nashtare closed 9 months ago

Nashtare commented 9 months ago

Attempt at fixing the Kernel hash discrepancy across runs.

How to reproduce it

Print the KERNEL code hash in say, prove_with_outputs(), and then run:

for i in {0..10}; do cargo test --release --test simple_transfer; done

Error

Upon inspection of the different code segments per parsed file, it appears that the inconsistency was coming from hex_prefix.asm, more particularly on the %stack macro which for some reasons seems to not be deterministic. I've replaced them by hardcoding what the optimizer had deduced.

On this branch, I've ran the above command 40 times and got the same hash every time.

Other changes

I also:

sonarcloud[bot] commented 9 months ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information