Commit Graph

83 Commits

Author SHA1 Message Date
rishflab
ec71f98252 Revert re-imports to qualified paths 2020-10-26 11:45:27 +11:00
rishflab
fea6b29da9 Test monero amount serialisation 2020-10-26 11:39:54 +11:00
rishflab
28ffe063b7 Remove stale comment 2020-10-26 11:36:46 +11:00
Franck Royer
82b092d86e Use consensus encoding for monero private key
Using consensus encoding future proof the library by using a commonly
accepted de/serialization format.
2020-10-26 11:36:46 +11:00
Franck Royer
9ea708b2a5 Remove custom implementation of bitcoin amount serde
This is unnecessary as rust-bitcoin provides it.
2020-10-26 11:36:40 +11:00
rishflab
c781ee949d Move storage into application crate 2020-10-26 10:32:54 +11:00
Philipp Hoenisch
11a4a7563b
Merge pull request #19 from comit-network/move-tor
Moving tor into swap
2020-10-23 13:32:53 +11:00
Philipp Hoenisch
17b32fed90
Moving tor into swap 2020-10-23 12:47:52 +11:00
Philipp Hoenisch
c0109d12cd
Use lib to ensure ports are free 2020-10-23 11:28:58 +11:00
rishflab
a29786e175 Use external serialisation implementation 2020-10-22 19:41:52 +11:00
rishflab
03dee7a3ea Generate temp dir for db 2020-10-22 19:34:53 +11:00
rishflab
3e82211a82 Add database todos 2020-10-22 19:27:28 +11:00
rishflab
62bc3c0432 Fix rebase conflicts 2020-10-22 19:25:54 +11:00
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.
2020-10-22 18:09:16 +11:00
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
2020-10-22 18:09:16 +11:00
Tobin C. Harding
79c6c8bbef Sort Cargo.toml lines 2020-10-22 15:02:32 +11:00
Tobin C. Harding
ade0e08db6 Merge branch 'master' into on-chain-protocol 2020-10-22 14:49:55 +11:00
Tobin C. Harding
97363cb05c Fix build after merge 2020-10-22 14:43:58 +11:00
Tobin C. Harding
f8adf6d7e0 Merge branch 'on-chain-protocol' of github.com:comit-network/xmr-btc-swap into on-chain-protocol 2020-10-22 14:33:16 +11:00
Tobin C. Harding
eed5e8e9a4 Move monero serde code to lib 2020-10-22 13:54:13 +11:00
Tobin C. Harding
0f17ec076c Add message1 2020-10-22 13:23:12 +11:00
Lucas Soriano del Pino
5395303a99 Test on-chain protocol happy path 2020-10-22 11:50:06 +11:00
Tobin C. Harding
a0987ee2b8 Use upstream serder for dleq Proof 2020-10-22 11:19:43 +11:00
Tobin C. Harding
ad0d8d5713 Emit message0 out of NB (both parties) 2020-10-22 11:04:49 +11:00
Tobin C. Harding
ad0d563d93 Use Normal secp256k1::Point 2020-10-22 10:37:06 +11:00
Tobin C. Harding
7dffe4cf5f Implement Clone on states 2020-10-22 09:18:57 +11:00
Tobin C. Harding
2a07113074 Fix buld after merge of db branch 2020-10-22 08:28:51 +11:00
Tobin C. Harding
3e0b40c248 Merge branch 'db' into on-chain-protocol 2020-10-22 08:17:54 +11:00
Philipp Hoenisch
ae1ea08bb2
Make it work on CI 2020-10-22 08:03:06 +11:00
Philipp Hoenisch
e1d8a1c39b
PR feedback integrated 2020-10-22 08:03:06 +11:00
Philipp Hoenisch
e67e940768
Split authenticated struct into unauthenticated struct to make it usage more obvious 2020-10-22 08:01:59 +11:00
Philipp Hoenisch
a73f1fcc6f
Start tor from test 2020-10-22 08:01:59 +11:00
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.
2020-10-21 18:39:45 +11:00
Philipp Hoenisch
295216a8ee
Add Tor feature flag and only run test if enabled 2020-10-21 18:18:25 +11:00
Philipp Hoenisch
5e19949d71
Add library to create a Tor service via Tor control port 2020-10-21 18:18:25 +11:00
Lucas Soriano del Pino
d3a7689059 Update comment about minimum stack size 2020-10-21 16:10:20 +11:00
Lucas Soriano del Pino
e5ddec76f7 Increase Rust minimum stack size in CI 2020-10-21 16:09:24 +11:00
Lucas Soriano del Pino
8b48191e1c Increase Rust minimum stack size in CI 2020-10-21 15:55:20 +11:00
Lucas Soriano del Pino
5250e16b64 Update dependency to cross-curve-dleq and ecdsa_fun 2020-10-21 15:28:50 +11:00
Lucas Soriano del Pino
04e1dca16a Fix dependency to cross-curve-dleq and ecdsa_fun 2020-10-21 15:14:31 +11:00
Tobin C. Harding
f22729c5da Derive Clone/ on initial states and messages 2020-10-21 15:02:37 +11:00
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.
2020-10-20 12:18:27 +11:00
Lucas Soriano del Pino
55629838f4 Implement test function that calls action_generator_alice 2020-10-19 10:44:25 +11:00
Lucas Soriano del Pino
7c99415cff Write action_generator_alice 2020-10-16 17:05:11 +11:00
Lucas Soriano del Pino
55ea8f23e2 s/{monero,bitcoin}_ledger/{monero,bitcoin}_client/g 2020-10-16 14:17:10 +11:00
Lucas Soriano del Pino
9d64f3fd29 Watch the blockchain during Bitcoin refund 2020-10-16 14:16:06 +11:00
Lucas Soriano del Pino
969ca63081 Split RefundBitcoin into CancelBitcoin and RefundBitcoin 2020-10-16 14:07:31 +11:00
Lucas Soriano del Pino
d813957c5a Rename InsufficientXMR to InsufficientXmr 2020-10-16 14:02:47 +11:00
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.
2020-10-16 14:01:57 +11:00
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.
2020-10-16 11:43:24 +11:00