miner.hoon 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /= mine /common/pow
  2. /= sp /common/stark/prover
  3. /= * /common/zoon
  4. /= * /common/zeke
  5. /= * /common/wrapper
  6. =< ((moat |) inner) :: wrapped kernel
  7. =>
  8. |%
  9. +$ effect [%command %pow prf=proof:sp dig=tip5-hash-atom block-commitment=noun-digest:tip5 nonce=noun-digest:tip5]
  10. +$ kernel-state [%state version=%1]
  11. +$ cause [length=@ block-commitment=noun-digest:tip5 nonce=noun-digest:tip5]
  12. --
  13. |%
  14. ++ moat (keep kernel-state) :: no state
  15. ++ inner
  16. |_ k=kernel-state
  17. :: do-nothing load
  18. ++ load
  19. |= =kernel-state kernel-state
  20. :: crash-only peek
  21. ++ peek
  22. |= arg=*
  23. =/ pax ((soft path) arg)
  24. ?~ pax ~|(not-a-path+arg !!)
  25. ~|(invalid-peek+pax !!)
  26. :: poke: try to prove a block
  27. ++ poke
  28. |= [wir=wire eny=@ our=@ux now=@da dat=*]
  29. ^- [(list effect) k=kernel-state]
  30. =/ cause ((soft cause) dat)
  31. ?~ cause
  32. ~> %slog.[0 [%leaf "error: bad cause"]]
  33. `k
  34. =/ cause u.cause
  35. :: XX TODO set up stark config, construct effect
  36. =/ [prf=proof:sp dig=tip5-hash-atom] (prove-block-inner:mine cause)
  37. :_ k
  38. [%command %pow prf dig block-commitment.cause nonce.cause]~
  39. --
  40. --