This repository has been archived by the owner on Aug 2, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 110
swap: prevent debt cheques #1983
Merged
Merged
Changes from all commits
Commits
Show all changes
65 commits
Select commit
Hold shift + click to select a range
671a30d
swap: add DefaultChequeDebtTolerance const
mortelli 2723804
swap: add code to prevent accepting cheques which would put the node …
mortelli 75cfe23
swap: rename DefaultChequeDebtTolerance const to ChequeDebtTolerance
mortelli 4b85c4d
swap: improve bad cheques prevention comments
mortelli 01b42ab
Merge remote-tracking branch 'origin/master' into swap-prevent-debt-c…
mortelli 8df2245
Merge remote-tracking branch 'origin/master' into swap-prevent-debt-c…
mortelli d69ced8
Merge remote-tracking branch 'origin/master' into swap-prevent-debt-c…
mortelli 6bc0fe5
swap: duplicate ChequeDebtTolerance
mortelli 6044ec6
Merge remote-tracking branch 'origin/master' into swap-prevent-debt-c…
mortelli d0e8146
Merge remote-tracking branch 'origin/master' into swap-prevent-debt-c…
mortelli 619129f
Merge remote-tracking branch 'origin/master' into swap-prevent-debt-c…
mortelli 8ee2e2c
swap: simplify ChequeDebtTolerance calculation
mortelli 5f2b9f5
swap: fix bug in processAndVerifyCheque
mortelli 0aa47da
swap: add first iteration for TestDebtChequeTolerance
mortelli b271f2d
swap: iterate TestDebtChequeTolerance test
mortelli ab755d9
swap: TestDebtChequeTolerance
mortelli 4a6c3a3
swap: add TestDebtCheques func
mortelli f02a9f2
swap: iterate TestDebtCheques
mortelli 03484ad
swap: iterate TestDebtCheques
mortelli daa620a
swap: iterate TestDebtCheques function
mortelli eb7d34a
swap: iterate TestDebtCheques function
mortelli 068b58c
swap: iterate TestDebtCheques function
mortelli 9ba613d
swap: add missing error handling in swap tests
mortelli b1a0cfc
Merge remote-tracking branch 'origin/master' into swap-prevent-debt-c…
mortelli ba65ef7
swap: simplify error handling in swap tests
mortelli d558c16
swap: small refactor in tests
mortelli 1ceb4f2
Merge remote-tracking branch 'origin/master' into swap-prevent-debt-c…
mortelli ba551bc
swap: refactor TestDebtCheques
mortelli 03d601b
swap: iterate TestDebtCheques function
mortelli c7ceba3
swap: add missing error catch for TestTriggerPaymentThreshold
mortelli f044532
swap: fix typo in TestDebtCheques
mortelli 1f386ae
Merge remote-tracking branch 'origin/master' into swap-prevent-debt-c…
mortelli e17b503
swap: fix bug in processAndVerifyCheque return
mortelli 22b4dd3
swap: fix formatting in TestDebtCheques
mortelli 7706df9
swap: add testMsgSmallPrice type
mortelli 4d33e9e
swap: remove TestPingPongChequeSimulation
mortelli de01e2d
swap: iterate TestMultiChequeSimulation
mortelli 5869533
swap: iterate TestMultiChequeSimulation
mortelli 78561f2
swap: iterate TestMultiChequeSimulation
mortelli b449607
swap: iterate TestMultiChequeSimulation
mortelli 1e815e8
swap: iterate TestMultiChequeSimulation
mortelli f34200a
swap: iterate TestMultiChequeSimulation
mortelli 585e77d
swap: iterate TestMultiChequeSimulation, remove testMsgBigPrice
mortelli 5e53773
swap: fix wrong ChequeDebtTolerance computation
mortelli fd99c9c
swap: call Equal for cheques comparison in TestDebtCheques
mortelli 9102171
swap: iterate TestDebtCheques
mortelli 1ff452c
swap: iterate TestDebtCheques
mortelli f4757e2
swap: iterate TestDebtCheques
mortelli 5010458
swap: add debug log to TestMultiChequeSimulation
mortelli 39f3aae
swap: add check for all messages received in TestMultiChequeSimulatio…
mortelli 5b6f493
swap: remove debug print in TestMultiChequeSimulation
mortelli 6ca077b
swap: small refactor to TestMultiChequeSimulation
mortelli 8e8df8a
Revert "swap: small refactor to TestMultiChequeSimulation"
mortelli 3faf60a
swap: simplify TestDebtCheques function
mortelli 63229eb
Merge remote-tracking branch 'origin/master' into swap-prevent-debt-c…
mortelli 7d1ce9c
swap: remove extra context in TestMultiChequeSimulation
mortelli 1d885fc
swap: remove randomness in TestMultiChequeSimulation
mortelli 77a153b
swap: fix wrong error message in sendCheque function
mortelli 7fa9e47
Merge remote-tracking branch 'origin/master' into swap-prevent-debt-c…
mortelli f1a46a0
Merge remote-tracking branch 'origin/master' into swap-prevent-debt-c…
mortelli d2402bb
Merge remote-tracking branch 'origin/master' into swap-prevent-debt-c…
mortelli 594d900
Merge remote-tracking branch 'origin/master' into swap-prevent-debt-c…
mortelli 415e7f6
swap: fix wrong types in tests
mortelli 8888cfc
Merge remote-tracking branch 'origin/master' into swap-prevent-debt-c…
mortelli 3117c81
Merge remote-tracking branch 'origin/master' into swap-prevent-debt-c…
mortelli File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Can we be sure at this point that the actual balance has been updated from the previous iteration run? I think it does, but give it another thought please.
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.
thank you for raising this point, it's something i hadn't considered.
my instinct was that the code (from this side of the exchange) would not be able to send a message in a following iteration until it was done with the current one, and this would include updating the balance.
i added some prints to the
updateBalance
calls and the testfor
loop iterations, and wrote an execution ofTestMultiChequeSimulation
test to disk.here are the initial results. you can see that sometimes there are multiple balance updates within a single iteration. however, these seem to be from the creditor side, so it does not matter that they occur one time per iteration—at least for the point you've raised.
this is the result obtained by filtering out the other peer's balance updates prints. it seems to confirm that every iteration does 1 balance update before moving on to the next one.
curiously, this might give us insight into the cause of #2078. it's very possible that by the time the creditor is allowed to receive the messages and account for them, the debitor is way ahead and the cheque it has sent is perceived as debt from the other side, for being too early. but i think it would have to process the cheque before doing the balance updates for this to explain the situation.