post icon indicating copy to clipboard operation
post copied to clipboard

Proof generation / verification: allow cancellation

Open fasmat opened this issue 2 years ago • 4 comments

Description

Proof generation and verification should be able to be cancelled for multiple reasons:

  • Publication epoch of ATXs for which a PoST proof is currently generating has ended. A late proof cannot be used anyway so generation should stop.
  • Verification of proofs: incoming ATXs are processed in batches. Cancellation is needed among others to abort when shutting down a node.

Acceptance criteria

  • VerifyVRF, Verify and Proof (method of post service client in the node) can be passed a context that when cancelled aborts verification / generation of proof.
    • Signal to cancel is forwarded to Rust code via FFI for the verification functions
    • Cancellation signal for proofing is used to communicate to the post service to stop generating a proof (likely by sending a stop command via grpc API)
  • Proof (method of post service client in the node) is passed a context with a timeout at the end of the cycle gap that is also cancelled when the node shuts down.
  • Verify and VerifyVRF is passed the "App-Context" that is canceled when the node is shut down.

Implementation hints

  • For VerifyVRF a passed context.Context that it is checked for before calling the oracle is sufficient.
  • For Verify a passed context.Context that it checks before calling the underlying Rust code is sufficient as well
  • Proof already receives a context.Context that only stops the node querying the proof from the post service but doesn't stop the post service from generating the proof.

fasmat avatar May 22 '23 11:05 fasmat

Related issue in post-rs: https://github.com/spacemeshos/post-rs/issues/81

poszu avatar Sep 01 '23 07:09 poszu

Cycle gap of PoET passed and the node hasn't finished generating a proof. A late proof cannot be used anyway so generation should stop when the window passes.

But one can still use and publish ATX so I'm not sure if that's the best idea, isn't it?

pigmej avatar Jul 22 '24 15:07 pigmej

But one can still use and publish ATX so I'm not sure if that's the best idea, isn't it?

When we created this issue I was thinking of prioritizing PoET registration over ATX publication, since only one of the two can be accomplished without breaking protocol rules and being marked as malicious.

I updated the issue to instead cancel the PoST proof generation at the end of the publish epoch, since this better fits the current behavior of the node.

fasmat avatar Jul 22 '24 15:07 fasmat

@fasmat The description needs to be updated as we now have the post-service

poszu avatar Jul 29 '24 11:07 poszu