Commit Graph

90 Commits (90f6c552904652ef2a582e95b19d9df2a3b29846)

Author SHA1 Message Date
Lucas Soriano del Pino cea1af1e1a Take bitcoin_tx_lock_timeout as argument to action generators 4 years ago
Lucas Soriano del Pino 1d21ae7e7a Use pin_mut! instead of futures::pin_mut! 4 years ago
Lucas Soriano del Pino aa2a20916e Include Bob being inactive as a reason for failure 4 years ago
Lucas Soriano del Pino 41e8c7283c Verify Bob's redeem encsig as Alice
Not doing so means that receiving an invalid encrypted signature from
Bob would make the generator produce a `RedeemBtc` action that should
not be accepted by the node (since Bob's signature would be invalid
after decrypting his encrypted signature).

It's better to fail early and let the user know what went wrong,
rather than let them hit an incomprehensible error when using their
wallet.
4 years ago
Lucas Soriano del Pino def3399d1c Use while instead of loop 4 years ago
Lucas Soriano del Pino c86a82b315 Rename action_generator_alice to action_generator 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 ec71f98252 Revert re-imports to qualified paths 4 years ago
rishflab fea6b29da9 Test monero amount serialisation 4 years ago
rishflab 28ffe063b7 Remove stale comment 4 years ago
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.
4 years ago
Franck Royer 9ea708b2a5 Remove custom implementation of bitcoin amount serde
This is unnecessary as rust-bitcoin provides it.
4 years ago
rishflab c781ee949d Move storage into application crate 4 years ago
Philipp Hoenisch 11a4a7563b
Merge pull request #19 from comit-network/move-tor
Moving tor into swap
4 years ago
Philipp Hoenisch 17b32fed90
Moving tor into swap 4 years ago
Philipp Hoenisch c0109d12cd
Use lib to ensure ports are free 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 62bc3c0432 Fix rebase conflicts 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 79c6c8bbef Sort Cargo.toml lines 4 years ago
Tobin C. Harding ade0e08db6 Merge branch 'master' into on-chain-protocol 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
Tobin C. Harding eed5e8e9a4 Move monero serde code to lib 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
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 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 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 f22729c5da Derive Clone/ on initial states and messages 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