Commit Graph

261 Commits (818147a6298a1376d8df91b8cc684a1a3fc4ee30)

Author SHA1 Message Date
Franck Royer 4ce8695dfc
Align with origin/database 4 years ago
Franck Royer 1a5b9f9fa9
Update tests after rebase 4 years ago
Franck Royer caf903acda
wip: Add test for when bob restarts 4 years ago
Franck Royer 7e0a1ffe84
Remove generator for bob 4 years ago
Franck Royer c6af5eb9ac
Introduce test where alice restarts before all communications are done 4 years ago
Franck Royer 3580b7ed2c
Add test where Alice restart after encsign is learned 4 years ago
Franck Royer a22efaa7bc
Remove unneeded peer id argument 4 years ago
Franck Royer 9323f22009
Reorder calls 4 years ago
Franck Royer a24d1a49b9
Remove unneeded `as_ref_calls` 4 years ago
Franck Royer 1c7cc7ee46
Scope futures' instanciation 4 years ago
Franck Royer 6226e5789f
Introduce test where alice restart mid-swap 4 years ago
Franck Royer 71a0832ef4
Add zero const to monero::Amount 4 years ago
Franck Royer 64b021daf4
Save Alice states in db 4 years ago
Franck Royer 11cea9ba69
Remove passing alice peer id
The usage of the peer id is incorrect as we do not even check it when
dialing. For now, we can ignore it.
We can then re-introduce it and use it properly at a later stage.
4 years ago
rishflab 082f4eb005 Use unused port in refund test 4 years ago
rishflab 7af4b6980a Test Alice refunds after Bob refund
Reworked Alice XmrLocked state transition handler to handle the
scenario when Alice received the encsig but Bob refunds.
Previously Alice was trying to redeem after receiving the encsig
without checking if t1 had elapsed.
4 years ago
rishflab 773390886b Test that Bob refunds if Alice fails to act 4 years ago
rishflab f806ad7231 Assert balances after punish 4 years ago
bors[bot] 9fecf7008e
Merge #61
61: Prepare CLI for mainnet swap r=da-kami a=da-kami



Co-authored-by: Daniel Karzel <daniel@comit.network>
4 years ago
Daniel Karzel 03b8e5f52e Upgrade CLI for mainnet test 4 years ago
Daniel Karzel aad7a22f81 Utility function for initializing tracing for tests 4 years ago
Franck Royer c0478d7191
Move expiries to config
So they can be different for mainnet and regtest
4 years ago
rishflab 9ba89194b0 Rename swarm driver to event loop 4 years ago
rishflab f5d3d54b13 Prevent premature Bob t1 timeout
Bob was hitting the t1 timeout and entering cancel
instead of redeem. This was resolved by increasing
the timeouts to 50.
4 years ago
rishflab 27d1334726 Init Alice behaviour with state0
Previously state0 had to be set after creating Alice's behaviour.
With the event loop we no longer has access to the swarm so
set_state0() has to be called indirectly through a channel. This
means it is difficult to guarantee state0 is being set due to the
asynchronous nature of channels. This was solved by initialising
Alice with state0.
4 years ago
rishflab 3d8866f1a0 Convert event loop to use fused futures select
Co-authored-by: Daniel Karzel <daniel@comit.network>
4 years ago
rishflab 58da1df9dc Create SwarmDriverHandle to resolve ownership issues 4 years ago
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
4 years ago
rishflab bd8e6e36e0 Fix monero blocktime config 4 years ago
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.
4 years ago
rishflab 883a913f30 Remove nonsensical monero * monero multiplication 4 years ago
rishflab 627b1a9f00 Remove unnecessary execution restart 4 years ago
rishflab 8592ef5f79 Address PR feedback
Add context to logging statements. Use amount type for monero in tests. Remove stale
code and comments.
4 years ago
rishflab b4ac69fa9c Reduce stack size to prevent CI resource issues 4 years ago
rishflab e4eed7b1a5 Change multiaddr for test runs 4 years ago
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
4 years ago
Franck Royer 765482b0aa
Implement `wait_for_transaction_finality` 4 years ago
rishflab 1c401aad31 Fix clippy warnings and formatting 4 years ago
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.
4 years ago
Franck Royer 9e13034e54 Extract execution details from driving loop 4 years ago
rishflab 24631d464d Add test for recursive executor 4 years ago
Franck Royer c4cd64d134 Implemented Alice transition from `Started` to `Negotiated` 4 years ago
rishflab ff7daf16f3 WIP: Test simplified swap execution 4 years ago
Lucas Soriano del Pino 483c819e17 Correctly re-export types from bitcoin and monero modules 4 years ago
Lucas Soriano del Pino f5ff50157e Some more fixes and comments after testing Alice's recovery 4 years ago
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.
4 years ago
Lucas Soriano del Pino 33a111d879 Move Swap state out of storage 4 years ago
Lucas Soriano del Pino ac2cfd7f65 Print swap history on --history flag 4 years ago
Lucas Soriano del Pino 823add218e Remove temporary test tracing guards 4 years ago
Lucas Soriano del Pino a26890001b Fix swap e2e test 4 years ago
Philipp Hoenisch 981fcacc95
Make swap e2e test work with new monerod lib 4 years ago
rishflab a44303f839 Add monerod to config
Fixed rebase issues
4 years ago
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.
4 years ago
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).
4 years ago
Lucas Soriano del Pino 62c4501926 wip: Add xmr_btc tracing filter 4 years ago
Lucas Soriano del Pino ae87c10cae wip: fixed message0 4 years ago
Tobin C. Harding b8ab4b4eee wip: add env filter 4 years ago
Tobin C. Harding 3e2f0b74a2 Do not trace events meant for other NBs 4 years ago
Tobin C. Harding c464555f5e Enable trace output 4 years ago
Lucas Soriano del Pino 9384b0cf3c [WIP] Swap app e2e test 4 years ago
Philipp Hoenisch 17b32fed90
Moving tor into swap 4 years ago