spacemeshos / post-rs

Rust implementation of POST proving
MIT License
10 stars 21 forks source link

feat: allow interrupts on proof generation #324

Open acud opened 1 month ago

acud commented 1 month ago

This change adds support to interrupting and stopping the proof generation via a new RPC call that simply sets the AtomicBool on the service to true, resulting in the proof generation to be cancelled the same as in a shutdown.

It might be useful to add a thread join on the handle the same way that the shutdown is doing, wdyt @poszu?

This doesn't help with cancelling the proof generation via FFI (which I think can still be used by the post go tool). I tried to also add that but got lost in the go->c->rust rabbit-hole (tried to inject a callback that would provide a bool from the go-code in order to stop the execution, the same way that is done currently with the AtomicBool).

Closes #81 Depends on https://github.com/spacemeshos/api/pull/366/files

acud commented 1 month ago

Thanks for reviewing @poszu. How would you envision persisting the "paused" state? on the post-rs side? e.g. in some folder that corresponds to the challenge? or returning it to the caller somehow?