Commit Graph

847 Commits (ab4c98678cdd77d1abc4f9539fec40e7563e1852)
 

Author SHA1 Message Date
Tobin C. Harding 2059158dad Bump to libp2p v29 4 years ago
Tobin C. Harding ad006fae6a Do a bunch of cleanups 4 years ago
Tobin C. Harding 0f17ec076c Add message1 4 years ago
Lucas Soriano del Pino 5395303a99 Test on-chain protocol happy path 4 years ago
Tobin C. Harding a0987ee2b8 Use upstream serder for dleq Proof 4 years ago
Tobin C. Harding ad0d8d5713 Emit message0 out of NB (both parties) 4 years ago
Tobin C. Harding ad0d563d93 Use Normal secp256k1::Point 4 years ago
Philipp Hoenisch 0ffd6ba96d
Merge pull request #13 from comit-network/tor 4 years ago
Tobin C. Harding fce0ca3dd2 Merge branch 'on-chain-protocol' of github.com:comit-network/xmr-btc-swap into on-chain-protocol 4 years ago
Tobin C. Harding bb94643943 Remove data from message until Message0 impl serde 4 years ago
Tobin C. Harding 7dffe4cf5f Implement Clone on states 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
Philipp Hoenisch ae1ea08bb2
Make it work on CI 4 years ago
Philipp Hoenisch e1d8a1c39b
PR feedback integrated 4 years ago
Philipp Hoenisch e67e940768
Split authenticated struct into unauthenticated struct to make it usage more obvious 4 years ago
Philipp Hoenisch a73f1fcc6f
Start tor from test 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
Philipp Hoenisch 295216a8ee
Add Tor feature flag and only run test if enabled 4 years ago
Philipp Hoenisch 5e19949d71
Add library to create a Tor service via Tor control port 4 years ago
Lucas Soriano ea064c95b4
Merge pull request #16 from comit-network/update-deps
Update dependency to cross-curve-dleq and ecdsa_fun
4 years ago
Lucas Soriano del Pino d3a7689059 Update comment about minimum stack size 4 years ago
Lucas Soriano del Pino e5ddec76f7 Increase Rust minimum stack size in CI 4 years ago
Lucas Soriano del Pino 917aabcc03 Increase Rust minimum stack size a lot more 4 years ago
Lucas Soriano del Pino 8b48191e1c Increase Rust minimum stack size in CI 4 years ago
Lucas Soriano del Pino 5250e16b64 Update dependency to cross-curve-dleq and ecdsa_fun 4 years ago
Lucas Soriano del Pino 04e1dca16a Fix dependency to cross-curve-dleq and ecdsa_fun 4 years ago
Tobin C. Harding e7504de76c Add state0 -> state1 messages 4 years ago
Tobin C. Harding f22729c5da Derive Clone/ on initial states and messages 4 years ago
Tobin C. Harding 08ec776daa Move monero/bitcoin modules to files 4 years ago
Tobin C. Harding aaf1363c05 Refine peer tracker and amounts protocol
We model the getting of amounts as a network behaviour even though conceptually
it is a protocol. Refine/refactor the code a bit to make this more obvious.

- Use `Amounts` instead of `Messenger`

We only ever connect to a single peer, update peer tracker to reflect this. This
is a single patch because the handling of the two network behaviours is a
intertwined.

- Only track one peer connection
- Track the peer id and the multiaddr of the counterparty
- Emit an event for connection established on Alice's side as well as Bob's side
4 years ago
Tobin C. Harding 47eaa44f76 Remove unneeded From<Never> impl 4 years ago
Tobin C. Harding 40e97ffdc3 Add todo to check amounts calculation 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 55629838f4 Implement test function that calls action_generator_alice 4 years ago
Lucas Soriano del Pino 7c99415cff Write action_generator_alice 4 years ago
Lucas Soriano del Pino 55ea8f23e2 s/{monero,bitcoin}_ledger/{monero,bitcoin}_client/g 4 years ago
Lucas Soriano del Pino 9d64f3fd29 Watch the blockchain during Bitcoin refund 4 years ago
Lucas Soriano del Pino 969ca63081 Split RefundBitcoin into CancelBitcoin and RefundBitcoin 4 years ago
Lucas Soriano del Pino d813957c5a Rename InsufficientXMR to InsufficientXmr 4 years ago
Lucas Soriano del Pino bae391ff9c Bubble up unrecoverable errors instead of expecting
This does introduce the ability of expressing incorrect combinations
of the enums `SwapFailed` and `Reason`, but these are just internal
to this function and it's terser that way.
4 years ago
Tobin C. Harding 1251681cfd Calculate amounts from BTC 4 years ago
Lucas Soriano del Pino e457130b6c Bubble up unrecoverable errors instead of expecting
This does introduce the ability of expressing incorrect combinations
of the enums `SwapFailed` and `Reason`, but these are just internal
to this function and it's terser that way.
4 years ago
Lucas Soriano del Pino 369770488f Document Reason enum 4 years ago
Lucas Soriano del Pino 7d307e581a Fail the swap early if Bitcoin TxLock is never published
This helps distinguish between the case where the refund timelock is
reached before the bitcoin is locked and the case where the refund
timelock is reached after the bitcoin is locked and before Alice sends
over the transfer proof for locking up the monero. In the first case
we can abort without doing anything, but in the second case we must
instruct the caller to refund the bitcoin.
4 years ago
Lucas Soriano del Pino 9f1bf72c7b Only generate refund action after Bitcoin lock 4 years ago
Lucas Soriano del Pino c1f6adc8ed Refund if Alice takes too long to prove that Monero has been locked 4 years ago
Lucas Soriano del Pino 176b2195e3 Make ReceiveTransferProof async and take &mut self 4 years ago
Tobin C. Harding 3492c46e71 Verify amounts with user 4 years ago
Tobin C. Harding 05766d3146 Add swap/
Add a binary crate `swap` that implements two nodes (Alice and Bob). With this
applied we can start up a node for each role and do:

- Bob: Requests current amounts using BTC is input
- Alice: Responds with amounts
- Bob: (mock) get user input to Ok the amounts

... continue with swap (TODO)
4 years ago