osmosis-labs / cosmos-sdk

:chains: A Framework for Building High Value Public Blockchains :sparkles:
https://cosmos.network/
Apache License 2.0
14 stars 31 forks source link

feat: Add `TrackBeforeSend` , `BlockBeforeSend` hooks. Deprecate `BeforeSend` hook #421

Closed mattverse closed 1 year ago

mattverse commented 1 year ago

What is the purpose of the change

This PR adds TrackBeforeSend hook and BlockBeforeSend hook, and deprecates BeforeSend hook. Each hook, respectively would call the hook that has been registered from a different module. The difference between the two new hooks being introduced is that TrackBeforesend hook does not have the ability to cause any effect, as it does not emit errors. Meanwhile, BlockBeforeSend does emit errors, allowing connected hooks to stop and block the send.

Additional method SendCoinsWithoutBlockHook has also been added along with the two hooks, as for module <> module transfers, we want to ensure it does not get blocked by external hooks.

Brief Changelog

Add TrackBeforeSend , BlockBeforeSend hooks. Deprecate BeforeSend hook

Testing and Verifying

This change adds tests

Documentation and Release Note