I would like to request allowing the slash function in FRAME to fail.
Our particular use case is executing a hook function before the actual slash. While the slash itself may not fail, the hook could fail ideally. The
Currency trait restricts the possible implementations (and usefulness) for this use case.
Any updates on this? If there is agreement on my proposal I can open the PR. cc @sander2
can you give a pseudo-code of what you want to achieve?
This goes beyond just slash. We should have a unified effort and make the entire
Currency trait fallible once transactional is more stable.
In the short term, you can check if a slash has failed by inspecing the second return value. If you want to revert the slash, you can use https://paritytech.github.io/substrate/master/frame_support/storage/transactional/fn.with_transaction.html