RUNE in an Unbond or Leave transaction is treated like rewards (split between all providers), rather than incrementing the signing provider's bond

(Originating from !2794 (merged).)
Thanks to Ursa, thornode-v0 now works without panicking!

Node thor12qwtrq4njj2s29gq56jun43dvxalejaksptqqn:
Block 4707067, 75773648591370 bond and no providers.
Blocks 4707068 through 4707077, 0 bond and one 0-bond provider.
Block 4707078, 75773500000000 bond and one 3788675000000-bond provider.
The network version was 0.81.2 .
|
The block 4707068 transaction was a LEAVE
and the block 4707078 transaction was an UNBOND, explaining why the bond provider's bond wasn't incremented by the handler_bond code.

	if bp.Has(from) {
		bp.Bond(msg.Bond, from)
	}

The UNBOND transaction had a large amount of RUNE attached, thus added to the node bond without incrementing the corresponding bond provider (as though the bond increase were a reward to be split amongst bond providers).

	coin := msg.TxIn.Coins.GetCoin(common.RuneAsset())
	if !coin.IsEmpty() {
		na.Bond = na.Bond.Add(coin.Amount)

As of v1.105.0, this code still has no bond provider bond increase. The same goes for the equivalent code in handler_leave .

I thus currently propose that handler_unbond and handler_leave have

	if bp.Has(msg.Signer) {
		bp.Bond(coin.Amount, msg.Signer)
	}

code added to within their if !coin.IsEmpty() conditionals.
Unlike a bond, as the function of an Unbond or Leave is to remove a bond amount, I imagine coin should be earmarked for the signer rather than the specified BondAddress.

(That is, when done accidentally (for unbond/leave cases), it seems reasonable to add it all to the signer rather than splitting it.)

Closable by !2837 (merged)
'Fail validation of Unbond/Leave messages with a non-zero Coin amount'.

Edited by Multipartite