Commit Graph

21 Commits

Author SHA1 Message Date
Tobin C. Harding
fc12b0d9fd Re-order send/receive
There are no guarantees that send_message and receive_massage do not block
the flow of execution. Therefore they must be paired between Alice/Bob, one
send to one receive in the correct order.

Define Alice to call `receive_message` first, with Bob sending the message. Do
this because we are expecting Alice to be have a well known address, there is no
currently such assumption for Bob.
2020-10-12 08:53:21 +11:00
rishflab
c778f4e204 Remove incorrect todo 2020-10-09 11:46:33 +11:00
rishflab
2c6bb8fa19 Remove redundant attribute 2020-10-09 11:40:00 +11:00
rishflab
51760041f0 Remove duplicated macro definitions 2020-10-09 11:40:00 +11:00
rishflab
666c121bb3 Implement transport traits with generics 2020-10-09 11:40:00 +11:00
rishflab
bf576bf251 Move test functions out of lib 2020-10-09 11:40:00 +11:00
rishflab
61a8a3e428 Improve formatting of tests 2020-10-09 11:40:00 +11:00
rishflab
9f046944a5 Add context to log messages 2020-10-09 11:40:00 +11:00
rishflab
48e5eb8d6c Remove redundant type declarations 2020-10-09 11:40:00 +11:00
rishflab
154b3edcf9 Split SendReceive into seperate traits 2020-10-09 11:40:00 +11:00
rishflab
6b7193b974 Fix clippy warnings 2020-10-09 11:40:00 +11:00
rishflab
697e1195cd Fix Cargo.toml fmt 2020-10-09 11:40:00 +11:00
rishflab
a759f39b1d Fix module ambiguity in tests 2020-10-09 11:40:00 +11:00
rishflab
36ed3a0b8b Rename ImportOutput to reflect purpose 2020-10-09 11:40:00 +11:00
rishflab
213034dc1f Remove unused clone from states 2020-10-09 11:40:00 +11:00
rishflab
25edd90fb0 Remove empty lines between imports 2020-10-09 11:40:00 +11:00
rishflab
4e031ff9a2 Loop on blockchain call instead of delaying
Previously there was a delay making a get raw transaction call to
give some time for a transaction to be confirmed on the blockchain.
This has been replaced with a loop that waits until the call is
succesful.
2020-10-09 11:40:00 +11:00
rishflab
f6f4ec2bdb Fix dependencies 2020-10-09 11:40:00 +11:00
rishflab
148e49a959 Remove redundant lifetime parameter 2020-10-09 11:40:00 +11:00
rishflab
8754a9931b Execute Alice and Bob state machines concurrently
Previously we were testing the protocol by manually driving Alice and
Bob's state machines. This logic has now be moved to an async state
transition function that can take any possible state as input. The
state transition function is called in a loop until it returns the
desired state. This allows use to interrupt midway through the protocol
and perform refund and punish tests. This design was chosen over a
generator based implementation because the the generator based
implementation results in a impure state transition function that is
difficult to reason about and prone to bugs.

Test related code was extracted into the tests folder.

The 2b and 4b states were renamed to be consistent with the rest.

Macros were used to reduce code duplication when converting
child states to their parent states and vice versa.

Todos were added were neccessary.
2020-10-09 11:40:00 +11:00
Lucas Soriano del Pino
1f99cf001c Swap Monero for Bitcoin
Co-authored-by: rishflab <rishflab@hotmail.com>
Co-authored-by: Philipp Hoenisch <philipp@hoenisch.at>
Co-authored-by: Tobin C. Harding <tobin@coblox.tech>
2020-09-28 17:15:57 +10:00