Commit Graph

27 Commits (9e13034e54151bafe16b0d35d34b3efae9190a44)

Author SHA1 Message Date
Franck Royer 9e13034e54 Extract execution details from driving loop 4 years ago
Lucas Soriano del Pino 483c819e17 Correctly re-export types from bitcoin and monero modules 4 years ago
Philipp Hoenisch 1a38bf57f2
Rename inner to client 4 years ago
Philipp Hoenisch f0fbe785c8
Remove Alice and Bob from utility struct 4 years ago
Philipp Hoenisch 0b9e8c145e
Update xmr-btc lib to use new monero-harness 4 years ago
Lucas Soriano del Pino e84c56378c Test that both parties refund if Alice does not redeem
Also:

- Move generator functions to `alice` and `bob` modules. This makes
using `tracing` a lot easier, since the context of the file name let's
us differentiate between Alice's and Bob's generator logs more
clearly.
- Accept 0 confirmations when watching for the Monero lock
transaction. This should eventually be configured by the application,
but in the tests it's making things unexpectedly slower.
4 years ago
rishflab c781ee949d Move storage into application crate 4 years ago
rishflab a29786e175 Use external serialisation implementation 4 years ago
rishflab 03dee7a3ea Generate temp dir for db 4 years ago
rishflab 3e82211a82 Add database todos 4 years ago
rishflab e3b68a3864 Improve database type safety
The database is now bound to a type eg. alice::State or bob::State.
The caller cannot expect to retrieve a type that is different to
the type that was stored.
4 years ago
rishflab 8eda051087 Remove redundant serialisation implementation
ECDSAfun's serialisation implementation was already imported
making the custom implementation redundant

Remove remnants of stale comment

Remove redundant conversion

Rename params to be consistent
4 years ago
Tobin C. Harding 97363cb05c Fix build after merge 4 years ago
Tobin C. Harding f8adf6d7e0 Merge branch 'on-chain-protocol' of github.com:comit-network/xmr-btc-swap into on-chain-protocol 4 years ago
Lucas Soriano del Pino 5395303a99 Test on-chain protocol happy path 4 years ago
Tobin C. Harding 2a07113074 Fix buld after merge of db branch 4 years ago
Tobin C. Harding 3e0b40c248 Merge branch 'db' into on-chain-protocol 4 years ago
rishflab 39afb4196b Save and recover protocol state from disk
NOTE: This implementation saves secrets to disk! It is not
secure.

The storage API allows the caller to atomically record the state
of the protocol. The user can retrieve this recorded state and
re-commence the protocol from that point. The state is recorded
using a hard coded key, causing it to overwrite the previously
recorded state. This limitation means that this recovery
mechanism should not be used in a program that simultaneously
manages the execution of multiple swaps.

An e2e test was added to show how to save, recover and resume
protocol execution. This logic could also be integrated into the
run_until functions to automate saving but was not included at
this stage as protocol execution is currently under development.

Serialisation and deserialisation was implemented on the states
to allow the to be stored using the database. Currently the
secret's are also being stored to disk but should be recovered
from a seed or wallets.
4 years ago
Lucas Soriano del Pino 50ed74319f Simplify xmr-btc/tests Monero wallet
- Make it the same for Alice and Bob.
- Make it contain a wallet client instead of the `Monero` struct.

Also:

Remove `Container` from inside `Monero` struct. The caller of `new`
can simply ensure that `Container` is not dropped to keep the
container alive.

This makes the `Monero` struct easier to work with, as it just holds
the data necessary to create the different clients created during
`init`, and does not have any lifetime restrictions.
4 years ago
Lucas Soriano del Pino df4ffb65c9 Make bitcoin::WatchForRawTransaction infallible
And trigger refund if Alice's redeem transaction takes too long.
4 years ago
Lucas Soriano del Pino ba3011a9c9 Trigger refund if the publication of Monero TxLock takes too long 4 years ago
Lucas Soriano del Pino 08be87747f Configure exponential backoff so that it never stops retrying 4 years ago
Lucas Soriano del Pino 15f7932f7f Replace monero::CheckTransfer with monero::WatchForTransfer
Instead of checking once to see if Monero's `TxLock` has been
published, the new trait should keep looking until the transaction has
been found.

The new trait also allows the caller to set an expected number of
confirmations on the transaction.

The implementation of the trait is currently part of test code, but it
should be similar to what we will eventually do for an application.
4 years ago
rishflab 666c121bb3 Implement transport traits with generics 4 years ago
rishflab bf576bf251 Move test functions out of lib 4 years ago
rishflab 154b3edcf9 Split SendReceive into seperate traits 4 years ago
rishflab a759f39b1d Fix module ambiguity in tests 4 years ago