babylonchain / staking-indexer

A tool that extracts BTC staking relevant data from the Bitcoin blockchain
Other
3 stars 4 forks source link

chore: Identify irregular transactions #98

Closed gitferry closed 4 months ago

gitferry commented 5 months ago

This PR added identifying irregular unbonding/withdrawal transactions via witness script and alerting if irregular unbonding/withdraw transactions are found.

An unbonding transaction is invalid if (1) its witness unlocks the unbonding path, (2) the transaction output is not expected (e.g. can be unlocked within different unbonding time with the parameters). This case can happen when the staker colludes with the covenant committed and the latter signs an invalid unbonding request.

A withdrawal transaction is invalid if it spends the staking output of a staking/unbonding tx but it does not unlock the expected time-lock path. This case can happen if an unexpected unlocking path is constructed and it indicates a critical issue in our system. Two new alerts for invalid transactions should be added, i.e. "confirmed_withdraw_staking_transactions" and "confirmed_withdraw_unbonding_transactions". cc @liam-icheng-lai

gitferry commented 4 months ago

@KonradStaniec Thanks for your comments. I have addressed all of them. Please see the updates