pow.hoon 754 B

123456789101112131415161718192021222324
  1. /= sp /common/stark/prover
  2. /= np /common/nock-prover
  3. /= * /common/zeke
  4. |%
  5. ++ check-target
  6. |= [proof-hash-atom=tip5-hash-atom target-bn=bignum:bignum]
  7. ^- ?
  8. =/ target-atom=@ (merge:bignum target-bn)
  9. ?> (lte proof-hash-atom max-tip5-atom:tip5)
  10. (lte proof-hash-atom target-atom)
  11. ::
  12. ++ prove-block (cury prove-block-inner pow-len)
  13. ::
  14. :: +prove-block-inner
  15. ++ prove-block-inner
  16. |= [length=@ block-commitment=noun-digest:tip5 nonce=noun-digest:tip5 sc=stark-config]
  17. ^- [proof:sp tip5-hash-atom]
  18. =/ =prove-result:sp
  19. (~(prove np sc) block-commitment nonce length ~)
  20. ?> ?=(%& -.prove-result)
  21. =/ =proof:sp p.prove-result
  22. =/ proof-hash=tip5-hash-atom (digest-to-atom:tip5 (hash-proof proof))
  23. [proof proof-hash]
  24. --