Scruffy Gingerbread Cormorant
Medium
In Babylon, a delegator can unbond early, but can only spend unbonding tx after an unbonding timelock. This provides adequate buffer for the protocol to slash in case of violations. However, vigilante will slash unbonding delegators even if unbonding timelock has expired if the delegator has not yet managed to spend it.
In Vigilante at https://github.com/sherlock-audit/2024-12-babylon/blob/main/vigilante/btcstaking-tracker/btcslasher/slasher_utils.go#L427C5-L432C35 - the desired behavior of slashing is mentioned where expired timelocks should not be slashed just because delagator hasnt moved its stake yet
// filter out all active and unbonded BTC delegations
// NOTE: slasher does not slash BTC delegations who
// - is expired in Babylon due to the timelock of <w rest blocks, OR
// - has an expired timelock but the delegator hasn't moved its stake yet
// This is because such BTC delegations do not have voting power thus do not
// affect Babylon's consensus.
However the logic just checks for UNBONDED status (with quorum of covenant signatures) without considering unbonding transaction timelock.
if strings.EqualFold(del.StatusDesc, bstypes.BTCDelegationStatus_UNBONDED.String()) &&
len(del.UndelegationResponse.CovenantSlashingSigs) >= int(bsParams.CovenantQuorum)
Therefore unbonding delegators get slashed well beyond the unbonding timelock expiry even though they do not contribute to finality provider voting power.
NA
NA
- Delegator does early unbonding
- Just after the unbonding timelock expiry, the FP is slashed
- Delegator has not managed to spend the unlocking tx, gets slashed even though unbonding period is over
Unbonding delegators can get slashed incorrectly causing loss of fun.
- Stake and then unbond a delegator and verify the delegator unbonded status
- 275369124fe42566aa2f4e0879b777dc29f6421c508ac706ead15b235fff90c3
params_version: 0
slashing_tx_hex: 01000000017b8a5fb1ef7ef1a5bb8feba8d060685b2bb2106577e52de21a762b48c2b9dc9f0000000000ffffffff02a0860100000000001976a914010101010101010101010101010101010101010188acb8b70d000000000022512017579a756eee78eb20fb5126fbafac69d1154f77cb8db7662ad59342561ef5cc00000000
staker_addr: bbn17sqv7usa0uzd9p7ysydyz9zw8f0ax454sya3zt
staking_output_idx: 0
staking_time: 30
staking_tx_hex: 01000000010c308b67d1217429bb5878a5c72e899c437512febee33a1c22de815ed4f039610100000000ffffffff0240420f0000000000225120f5c256409d07e4e8b173131d95061387bda88f4db3a4eccb0540190e7c53fb6bcf788b3b00000000160014b6b32bdfbcb2719f95c17db943cdc6c73708338900000000
start_height: 131
status_desc: UNBONDED
total_sat: "1000000"
unbonding_time: 5
- Wait till the unbonding tx timelock is expired.
time="2025-02-25T11:02:09Z" level=debug msg="Unbonding tx confirmed" blockHash=556fd95455f01e754344763944e65dda177731da8bdf0dadad8fd8dc574257f1 blockHeight=140 stakingTxHash=9fdcb9c2482b761ae22de5776510b22b5b6860d0a8eb8fbba5f17eefb15f8a7b unbondingTxHash=ec15210c7593055a45b4d89424ce83d4c4ab402b08f04a65ca5e0f59382e4755
Unbonding tx is confirmed at 140, its timelock should expire at 140 + 5(unbonding time) = 145 BTC height.
- Slash the FP after the unbonding time has expired e.g. at height 164, which is well past the unbonding timelock expiry (145). Observe that the delegator is still getting slashed.
time="2025-02-25T11:05:27Z" level=debug msg="Received new best btc block" btcBlockHash=4b853fdbe6d80190fa5b5c419b741ef0a91fdacc80e3e37e751d70daa37ce239 btcBlockHeight=164
025-02-25T11:05:29.208746Z debug signed and assembled witness for slashing tx of unbonded BTC delegation ac920e0843c0caa6a75891ca56a10e5133931ae0a69b6f1fa709dd456d7e2c50 under finality provider 275369124fe42566aa2f4e0879b777dc29f6421c508ac706ead15b235fff90c3 {"module": "btcstaking-tracker", "module": "slasher"}
2025-02-25T11:05:29.215762Z info successfully submitted slashing tx (txHash: 53ec6c6fe707a23fc877b1e85451c7f0e8feef0e5740f354f77aa07dedb5b80a) for BTC delegation ac920e0843c0caa6a75891ca56a10e5133931ae0a69b6f1fa709dd456d7e2c50 under finality provider 275369124fe42566aa2f4e0879b777dc29f6421c508ac706ead15b235fff90c3 {"module": "btcstaking-tracker", "module": "slasher"}
2025-02-25T11:05:29.215907Z info successfully slash BTC delegation with staking tx hash 01000000010c308b67d1217429bb5878a5c72e899c437512febee33a1c22de815ed4f039610100000000ffffffff0240420f0000000000225120f5c256409d07e4e8b173131d95061387bda88f4db3a4eccb0540190e7c53fb6bcf788b3b00000000160014b6b32bdfbcb2719f95c17db943cdc6c73708338900000000 under finality provider 275369124fe42566aa2f4e0879b777dc29f6421c508ac706ead15b235fff90c3 {"module": "btcstaking-tracker", "module": "slasher"}
No response