-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix get all bonds not returning not active bonds #2526
Conversation
@@ -530,8 +531,8 @@ public long getTotalAmountOfConfiscatedTxOutputs() { | |||
|
|||
|
|||
public List<Bond> getAllBonds() { | |||
List<Bond> bonds = bondedReputationRepository.getActiveBonds(); | |||
bonds.addAll(bondedRolesRepository.getActiveBonds()); | |||
List<Bond> bonds = new ArrayList<>(bondedReputationRepository.getBonds()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if that is ok, as the ProposalDisplay class uses that as well:
confiscateBondComboBox.setItems(FXCollections.observableArrayList(daoFacade.getAllBonds()));
and there we want only the active bonds.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also used by daoFacade.getBondByLockupTxId
which is also used in ProposalDisplay.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but it is needed there to display also old items correctly.
For the setItems
I'm not sure as you do want to display the link if you choose to display the proposal, but there is no reason to have such an active proposal in the first place.
Anyway, in getBondByLockupTxId
we want also non-active bonds so it is possible to see past proposals correctly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The naming of this function is probably not right anyway, better split into getAllBonds() and getActiveBonds(). That would make clearer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree but there seems to be no need for getActiveBonds() method for now.
We need to check if the overall behaviour is correct. Only active and locked bonds should be displayed in the UI for confiscation (if the user has not locked up the bond nothing can be confiscated). Could you check the whole process? |
So the proposal needs to display correctly whenever it shows (even if the bond is not active, like when seeing the vote result history). The case where it should not be displayed is in the active proposals, but there the entire proposal shouldn't be displayed. However I didn't change that behaviour as it seemed out of the scope of this PR and I wasn't sure what should be done with such an "invalid" proposal. |
I would need more time to checkout the PR and go over the code details but I am too busy atm with other stuff. Feel free to continue as you think it is the best strategy. |
@ManfredKarrer as in some cases inactive bonds may still be confiscatable I just disabled the option to propose confiscating non-active bond and added a "(Inactive Bond)" text to make sure it's easy to notice. |
Will look into it in the next days. Thanks |
@ben-kaufman My view is that it doesn't make sense to confiscate inactive bonds. That would mean either confiscating BSQ that's not locked, ie, any BSQ, or unlocked bonds, which are also supposed to work as normal BSQ. That would weaken the trust in the BSQ tokens unnecessarily. @ManfredKarrer Do you see any use case where we would want to confiscate inactive bonds? |
@sqrrm well it will only be possible to confiscated a bond which was unlocked in the middle of the cycle and wasn't moved. |
@ben-kaufman I'm not sure I follow. Active bonds are those that are either outputs locked with a lock tx or outputs from an unlock tx waiting for the lock time to pass, those outputs I call unlocking. Any output that is yet to be locked or where the lock time has passed for an unlock tx output I consider inactive, or not bonded. These should be considered normal BSQ. If a locked output is spent with an unlock tx, this unlocking txoutput is still an active bond and will be considered confiscatable up until lock time has passed. If that tx output is spent before the lock time has passed the BSQ is burnt and no longer considered BSQ. |
I think @ben-kaufman means that a unlocked bond which has not been transferred to another address could still be confiscated as we know it is the same owner. I discussed that a bit with him. But I think now it is more clean to not consider that case for confiscation. So once a bond has passed the unlock time it cannot be confiscated anymore and should not be displayed in the drop down for confiscatable bonds. |
@ManfredKarrer Indeed, I think that would be unacceptable. There need to be consistency to the rules and once unlocked it should be as untouchable as any other BSQ. The case where the lock time has passed and the output not yet spend should be covered by having a longer lock time to begin with. The lock time needs to be at least more than one cycle long, most likely 1.5 cycles or perhaps 2 cycles to give enough time for deciding whether a bond should be confiscated. |
Replaced by #2576 |
Fix #2522
The issue with this is that the proposal was for confiscating a bond which is not active, and the
getAllBonds
method returned only active bonds, so I changed it to return all bonds instead.Now the proposals are showing up correctly.