Commit Graph

285 Commits

Author SHA1 Message Date
rishflab
58da1df9dc Create SwarmDriverHandle to resolve ownership issues 2020-12-10 11:24:08 +11:00
rishflab
6f7408ecce Drive swarm in seperate async task
Previously the libp2p swarm had to be manually polled within the
protocol execution code to execute actions such as sending a
message. The swarm is now wrapped in SwarmDriver which polls the
swarm in a seperate task
2020-12-10 11:24:05 +11:00
rishflab
bd8e6e36e0 Fix monero blocktime config 2020-12-09 15:10:29 +11:00
Daniel Karzel
1a2857af29 Properly init tracing per test and reverse the filter to be exclusive
Tracing should be initialized by test and the `_guard` kept alive within the test.
Re-using this code in different tests does not really have any additional value.

Instead of specifying what messages we want to include, I went for a filter that excludes noise.
That way we get more useful logging.
2020-12-09 11:48:53 +11:00
rishflab
883a913f30 Remove nonsensical monero * monero multiplication 2020-12-08 16:12:00 +11:00
rishflab
627b1a9f00 Remove unnecessary execution restart 2020-12-07 14:03:50 +11:00
rishflab
8592ef5f79 Address PR feedback
Add context to logging statements. Use amount type for monero in tests. Remove stale
code and comments.
2020-12-07 13:55:13 +11:00
rishflab
b4ac69fa9c Reduce stack size to prevent CI resource issues 2020-12-07 09:44:26 +11:00
rishflab
e4eed7b1a5 Change multiaddr for test runs 2020-12-05 14:06:08 +11:00
rishflab
c91e9652aa Add alice punish test
Use reusable test init functions for happy path test

Extract tracing setup to reusable function

Move test initialization to seperate functions

Increase stack size in CI

Fix monero max finality time

Force Bob swarm polling to send message 2

Run Bob state to xmr_locked in punish test to force the sending of
message2. Previously Bob state was run until btc_locked. Although
this was the right thing to do, message2 was not being sent as the
swarm was not polled in btc_locked. Alice punish test passes.

Add info logging to executor
2020-12-04 17:23:37 +11:00
Franck Royer
765482b0aa
Implement wait_for_transaction_finality 2020-12-02 10:02:20 +11:00
rishflab
1c401aad31 Fix clippy warnings and formatting 2020-12-01 15:38:24 +11:00
rishflab
47c3ddc6f7 Fix happy path test
Poll bob swarm to send encsig after calling send message3. Comment
out unimplmented wait for transaction finality trait. Dial alice.
2020-12-01 14:30:02 +11:00
Franck Royer
9e13034e54 Extract execution details from driving loop 2020-11-30 15:13:20 +11:00
rishflab
24631d464d Add test for recursive executor 2020-11-30 15:13:20 +11:00
Franck Royer
c4cd64d134 Implemented Alice transition from Started to Negotiated 2020-11-27 09:34:35 +11:00
rishflab
ff7daf16f3 WIP: Test simplified swap execution 2020-11-27 09:21:21 +11:00
Lucas Soriano del Pino
483c819e17 Correctly re-export types from bitcoin and monero modules 2020-11-12 13:49:07 +11:00
Lucas Soriano del Pino
f5ff50157e Some more fixes and comments after testing Alice's recovery 2020-11-12 13:49:07 +11:00
Lucas Soriano del Pino
28225f8643 Implement swap recover function for Alice
This introduces a lot of duplication between the binary and the
library, but it's okay because this module should only be a temporary
measure until we allow recovery to be handled by the original state
machine.

Also, fix a bug in `xmr_btc::alice::action_generator` caused by the
incorrect assumption that Alice's ability to punish Bob could be
determined before the cancel transaction hits the blockchain.
2020-11-12 13:49:07 +11:00
Lucas Soriano del Pino
33a111d879 Move Swap state out of storage 2020-11-12 13:49:07 +11:00
Lucas Soriano del Pino
ac2cfd7f65 Print swap history on --history flag 2020-11-12 13:49:07 +11:00
Lucas Soriano del Pino
823add218e Remove temporary test tracing guards 2020-11-12 13:49:07 +11:00
Lucas Soriano del Pino
a26890001b Fix swap e2e test 2020-11-12 13:49:07 +11:00
Philipp Hoenisch
981fcacc95
Make swap e2e test work with new monerod lib 2020-11-03 16:52:00 +11:00
rishflab
a44303f839 Add monerod to config
Fixed rebase issues
2020-11-03 16:08:46 +11:00
Lucas Soriano del Pino
92c7e8e84f Run swap e2e test without tor feature
Not worth automatically testing both `tor` and `not(tor)`, it should
not make a difference.
2020-11-02 10:31:53 +11:00
Lucas Soriano del Pino
a37f43a1ba wip: Provide enough funds to both parties
Also use cosntant backoff retry strategy as opposed to exponential
backoff. This is in case retrying several times quickly causes the
retry intervals to become large enough that the test is very slow
and/or the Bitcoin lock transaction expires.

The current problem occurs on the last message i.e. Bob sending
tx_redeem_encsig to Alice. The action is yielded for Bob to do it, but
Alice appears to never receive it (unconfirmed claim, requires more
logging).
2020-10-30 14:07:15 +11:00
Lucas Soriano del Pino
62c4501926 wip: Add xmr_btc tracing filter 2020-10-30 14:05:45 +11:00
Lucas Soriano del Pino
ae87c10cae wip: fixed message0 2020-10-30 14:05:45 +11:00
Tobin C. Harding
b8ab4b4eee wip: add env filter 2020-10-30 14:05:45 +11:00
Tobin C. Harding
3e2f0b74a2 Do not trace events meant for other NBs 2020-10-30 14:05:45 +11:00
Tobin C. Harding
c464555f5e Enable trace output 2020-10-30 14:04:27 +11:00
Lucas Soriano del Pino
9384b0cf3c [WIP] Swap app e2e test 2020-10-30 14:04:27 +11:00
Philipp Hoenisch
17b32fed90
Moving tor into swap 2020-10-23 12:47:52 +11:00