-
Notifications
You must be signed in to change notification settings - Fork 174
Serious bug with manual covers #1385
Comments
I have not confirmed the details of your theory yet, but it looks at least close to correct. And the collateral in that transaction indeed seems to have gone to fees. Related: #1261 |
Interest owed after 170 seconds, calculated by cover_operation: 0.09825190 * .0012 * 170 / 365 / 24 / 60 / 60 = .0000000006355716 < 1 satoshi Interest owed after 3600 seconds, calculated by tx builder: 0.09825190 * .0012 * 3600 / 365 / 24 / 60 / 60 = .0000000134591643 > 1 satoshi |
This is the third time this has happened that I know of. This is a wallet fix that we could have had for 6.0. Is dan going to keep covering these out of pocket? |
I have scanned the blockchain for suspicious cover transactions (i. e. orders that fill the cover completely but don't have a deposit_operation included): tx-id ... Collateral in .00001 BTS I had a lot more hits, but the collateral was always below the default tx fee, so these are OK I suppose. So you have a fix available? - Edit: I see, issue 1261 |
@pmconrad I have made the simplest change which is to calculate interest at construction as it would be in 1 block interval from the current head block. This means that the full debt at confirmation should never be more than assumed at the time of construction. So when fully covering, either the full debt should be paid or the transaction should fail to confirm. However, it occurs to me that it could be possible that the transaction ends up in an earlier block if there is some bad forking occurring, and so we are stuck with the same problem. The intent of the new |
Actually, it seems to me that we can just change the behaviour of the cover operation to directly return the collateral back to a balance record rather than expecting the transaction to collect it with a deposit. |
IMO that would be the cleanest solution. |
I agree; it does complicate transaction scanning somewhat but still worth it. |
The 9900327696 one is this: https://bitsharestalk.org/index.php?topic=13075.0 |
On second thought, for now I will hold off on changing the semantics of the operation in the interest of not adding another special case to transaction scanning. Instead I have added the |
List of the bad covers:
For a total of |
Refund planned? |
Yes, will be coordinated soon once we confirm the new release is okay. |
See https://bitsharestalk.org/index.php?topic=14271.msg185630#msg185630
Here's my theory. The problem is that the payout of the collateral is not handled in the same place as the actual filling of the cover.
The manual cover transaction is created by transaction_builder::submit_cover. That adds a cover operation to the transaction and deducts the cover amount from the transaction balance. It also computes the interest to be paid at the end of the transaction expiration time, and only if the cover amount covers both interest and the balance to be covered it also adds a deposit operation for the collateral.
After the cover tx has been included in the blockchain, the cover operation is executed by cover_operation::evaluate. This computes the interest owed at the current block time, and if the cover amount covers both interest and principal the cover_order is deleted.
The problem here is the different times used for interest calculation. The default transaction expiration time is 1 hour, while the actual transaction evaluation takes place only a few seconds after the transaction was created. The transaction builder computed the interest owed one hour in the future and came to the conclusion that the cover amount was not sufficient, and therefore it did not create the deposit_operation for the collateral. The transaction evaluation calculated the interest owed now, saw the the cover amount was sufficient and closed the cover_operation.
The text was updated successfully, but these errors were encountered: