consider capacity of transferred commitments correctly#826
consider capacity of transferred commitments correctly#826
Conversation
44e3df0 to
7c71999
Compare
7c71999 to
813ab32
Compare
majewsky
left a comment
There was a problem hiding this comment.
Maybe I'm misreading this, but from what I can see: During commitment acceptance, we only present the commitment that gets confirmed, not the ones that get consumed. So when a commitment for amount 10 in project 1 gets confirmed while consuming one for amount 5 in project 2 and one for amount 3 in project 3, the CommitmentChangeRequest that gets evaluated only has the commitment (and increase in TotalConfirmed) in project 1, not the commitments (and decrease in TotalConfirmed) in projects 2 and 3. If this is so, then that ain't right. We should put everything into one CommitmentChangeRequest and notify that to LIQUID for either complete acceptance or complete rejection.
| @@ -200,16 +223,6 @@ func ConfirmPendingCommitments(ctx context.Context, loc core.AZResourceLocation, | |||
| continue | |||
| } | |||
There was a problem hiding this comment.
On a related note, if LIQUID (or the DB) rejects the commitment confirmation here, the consumption must be rolled back. (This would be solved by accepting all of them at once and only committing the change after the CCR was accepted.)
This is a different concern from the one above; previously, it was not a big deal that consumption was not reversible, since it only happened when the CCR was already requested by LIQUID/DB.
|
You are right with the comment above. I was thinking about it solely from the local standpoint and saw the CCRs as the payload for the audit events. For the liquid, it really does not make sense to check the transfers and confirmations separately. EDIT: recording some questions here, that I stumbled across during change of the implementation:
|
631a4fd to
8823a3b
Compare
Merging this branch changes the coverage (1 decrease, 2 increase)
Coverage by fileChanged files (no unit tests)
Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code. Changed unit test files
|
Previously, we tried to fit the full commitment into the capacity when creating a new commitment or confirming commitments after transfer.
This was wrong/ very pessimistic, because when transferring commitments, we actually free up capacity.
In case of
ConfirmPendingCommitmentswe keep thestatsover multiple iterations, so we have to modify them according to the transfers.In case of
/commitments/new, we fortunately only load the stats once afterwards, so we can skip modifying them manually.