Commit Graph

141 Commits

Author SHA1 Message Date
Franck Royer
64b021daf4
Save Alice states in db 2020-12-15 10:10:40 +11:00
Franck Royer
238f6a989d
Extract spend key as soon as possible 2020-12-15 09:18:23 +11:00
Franck Royer
c095693a5f
Refund swap if resumed from a step that requires further communication 2020-12-15 09:17:12 +11:00
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.
2020-12-15 09:15:38 +11:00
rishflab
d8d6477ee9 Remove and fix comments 2020-12-14 11:56:14 +11:00
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.
2020-12-11 17:05:34 +11:00
rishflab
78c6a1a78f Add Bob refund execution 2020-12-11 16:59:29 +11:00
Daniel Karzel
03b8e5f52e Upgrade CLI for mainnet test 2020-12-11 14:46:29 +11:00
Franck Royer
c0478d7191
Move expiries to config
So they can be different for mainnet and regtest
2020-12-10 14:43:17 +11:00
Franck Royer
ef6e8fc723
Clean-up unused code 2020-12-10 14:28:54 +11:00
Franck Royer
e71bf7d8e9
Add comment regarding processing in network behaviour 2020-12-10 14:03:45 +11:00
Franck Royer
2c9fb7b1da
Rename var to match type name 2020-12-10 14:03:45 +11:00
Franck Royer
91d28682ed
Remove comments 2020-12-10 14:00:48 +11:00
Franck Royer
53aae5cf5f
Use anyhow macro as intended 2020-12-10 14:00:48 +11:00
Franck Royer
51cc44484b
Remove unneeded pub qualifiers 2020-12-10 14:00:47 +11:00
rishflab
9ba89194b0 Rename swarm driver to event loop 2020-12-10 13:29:53 +11:00
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.
2020-12-10 13:29:53 +11:00
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.
2020-12-10 13:29:53 +11:00
rishflab
3d8866f1a0 Convert event loop to use fused futures select
Co-authored-by: Daniel Karzel <daniel@comit.network>
2020-12-10 13:29:53 +11:00
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
f88ed9183b
Merge pull request #54 from comit-network/bob-unhappy-paths
Punish Test
2020-12-09 15:51:16 +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
Franck Royer
78674818c2
Upgrade bitcoin-harness 2020-12-07 12:31:25 +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
rishflab
5fef68322a Allow Alice to exit execution at a specified state 2020-12-04 17:16:03 +11:00
rishflab
584cc22024 Allow Bob to exit execution at a specified state 2020-12-04 17:16:03 +11:00
Franck Royer
624716d8a7
Upgrade rust-bitcoin to 0.25 2020-12-04 08:11:55 +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
b06321a40f WIP: cleanup 2020-12-01 14:46:53 +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
2abeba17f9
Save state0 in the swarm to process message0 2020-12-01 10:41:10 +11:00
rishflab
d8218a7bea Remove mspc channel from new executor 2020-11-30 15:16:56 +11:00
Franck Royer
2db9ebd28b make new_swarm public 2020-11-30 15:13:20 +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
rishflab
dca15b6872 Removed unused binary 2020-11-30 15:13:20 +11:00
rishflab
3b005bd15c Resolve rebase issues, restructure code and fix warnings 2020-11-30 15:13:20 +11:00
Franck Royer
437c1cbb80 Started to extract some steps
Tealised that the whole point is for them to be idempotent to be useful
2020-11-27 09:34:36 +11:00
Franck Royer
66866f8fbd Remove rng argument 2020-11-27 09:34:36 +11:00
Franck Royer
6c0df836ca Deal with Btc Punished. 2020-11-27 09:34:36 +11:00
Franck Royer
6437b529eb Punish Bob if t2 is reached 2020-11-27 09:34:36 +11:00
Franck Royer
8ff1824126 Remove abort function 2020-11-27 09:34:36 +11:00
Franck Royer
58ca33dd04 Remove warnings 2020-11-27 09:34:36 +11:00
Franck Royer
c501d84278 Park abort function for now 2020-11-27 09:34:36 +11:00
Franck Royer
4c4a10098c Complete Refund path 2020-11-27 09:34:36 +11:00
Franck Royer
bff83bbe99 Progress on Cancellation path 2020-11-27 09:34:36 +11:00
Franck Royer
8e31a3af6a Add steps from EncSignLearned 2020-11-27 09:34:36 +11:00
Franck Royer
8976a03b3d Implemented Alice transition from BtcLocked to XmrLocked 2020-11-27 09:34:35 +11:00