Commit Graph

1671 Commits

Author SHA1 Message Date
Lucas Soriano del Pino
09773dd15b Re-introduce history command 2020-11-12 13:49:07 +11:00
rishflab
0f1a77fa21 Fix Alice's btc redeem recovery path 2020-11-12 13:49:07 +11:00
Lucas Soriano del Pino
6db40dce2a Implement swap recover function for Bob 2020-11-12 13:49:07 +11:00
Lucas Soriano del Pino
28225f8643 Implement swap recover function for Alice
This introduces a lot of duplication between the binary and the
library, but it's okay because this module should only be a temporary
measure until we allow recovery to be handled by the original state
machine.

Also, fix a bug in `xmr_btc::alice::action_generator` caused by the
incorrect assumption that Alice's ability to punish Bob could be
determined before the cancel transaction hits the blockchain.
2020-11-12 13:49:07 +11:00
Lucas Soriano del Pino
b989e94322 Remove stale TODO 2020-11-12 13:49:07 +11:00
Lucas Soriano del Pino
33a111d879 Move Swap state out of storage 2020-11-12 13:49:07 +11:00
Lucas Soriano del Pino
ac2cfd7f65 Print swap history on --history flag 2020-11-12 13:49:07 +11:00
Lucas Soriano del Pino
ecbfed9c11 Add Database API to fetch all swaps 2020-11-12 13:49:07 +11:00
Lucas Soriano del Pino
f9cfc2abe3 Remove generics from Database 2020-11-12 13:49:07 +11:00
Lucas Soriano del Pino
02075c2a1d Support saving multiple swaps
By replacing `LAST_STATE_KEY` with a swap ID passed as an argument to
inserting and reading from the database.
2020-11-12 13:49:07 +11:00
Lucas Soriano del Pino
823add218e Remove temporary test tracing guards 2020-11-12 13:49:07 +11:00
Lucas Soriano del Pino
a26890001b Fix swap e2e test 2020-11-12 13:49:07 +11:00
Lucas Soriano del Pino
934ddb366a Save state for Alice at specific points in the swap 2020-11-12 13:49:07 +11:00
rishflab
ea08778b2f Save state for Bob at specific points in the swap 2020-11-12 13:49:07 +11:00
rishflab
5cb2f451d0
Merge pull request #40 from comit-network/attach-bins
Attach binaries when doing CI run
2020-11-12 11:33:20 +11:00
Franck Royer
9ebacd8ccb
Attach binaries when doing CI run
To make it easier to deploy the binary on a less powerful machine when
doing mainnet try outs.

Also add CI for mac os.
2020-11-10 20:24:58 +11:00
Lucas Soriano
b7651e8653
Merge pull request #39 from comit-network/fix-compile-times
Update cross-curve-dleq dependency
2020-11-09 14:22:07 +11:00
Lucas Soriano del Pino
4790d701e5 Update cross-curve-dleq dependency
Making build times considerably faster.

On my machine, after running `cargo clean`, `cargo build -p swap`
takes 2min 19s.

The updated dependency also comes with a critical fix to the `Scalar`
type, which originally wrongly assumed that secp256k1 and ed25519
scalars had the same endianness. For this reason, we now have to
reverse the bytes of recovered scalars if we are to use them on a
different chain.

Finally, there is no need to append `RUST_MIN_STACK=100000000` to
avoid stack overflows in tests and when running the binary.
2020-11-09 13:14:09 +11:00
Philipp Hoenisch
713658244d
Merge pull request #33 from comit-network/monerod 2020-11-03 17:43:02 +11:00
Philipp Hoenisch
bca439ada5
Use random prefix 2020-11-03 16:52:00 +11:00
Philipp Hoenisch
981fcacc95
Make swap e2e test work with new monerod lib 2020-11-03 16:52:00 +11:00
Philipp Hoenisch
70d64f74ae
Testcontainers upgrade 2020-11-03 16:52:00 +11:00
Philipp Hoenisch
1a38bf57f2
Rename inner to client 2020-11-03 16:51:26 +11:00
Philipp Hoenisch
f0fbe785c8
Remove Alice and Bob from utility struct 2020-11-03 16:51:26 +11:00
Philipp Hoenisch
306176b3e6
PR feedback:
Removed network prefix and use the same for container and network.
Add sentence explaining prefix
2020-11-03 16:51:26 +11:00
Philipp Hoenisch
a04f04f1a5
Fix failing test due to uninitialized miner 2020-11-03 16:51:26 +11:00
Philipp Hoenisch
0b9e8c145e
Update xmr-btc lib to use new monero-harness 2020-11-03 16:51:26 +11:00
Philipp Hoenisch
2d064f305f
Re-enable other builds 2020-11-03 16:51:26 +11:00
Philipp Hoenisch
3cc32002b0
Refactor out some helper functions to generate blocks after funding 2020-11-03 16:51:26 +11:00
Philipp Hoenisch
3a34800311
Refactor into monero helper struct 2020-11-03 16:51:25 +11:00
Philipp Hoenisch
738c67a421
Simple fund and send in test 2020-11-03 16:51:25 +11:00
Philipp Hoenisch
f5643a4ea4
Miner working 2020-11-03 16:51:25 +11:00
Philipp Hoenisch
0dcb4e56be
Have monerod running in own container 2020-11-03 16:51:25 +11:00
Philipp Hoenisch
7b101a9c98
upgrade testcontainers 2020-11-03 16:51:25 +11:00
rishflab
d5c7afd7f8
Merge pull request #34 from comit-network/no-config
Add CLI config and remove conditional compile flags
2020-11-03 16:46:53 +11:00
rishflab
a44303f839 Add monerod to config
Fixed rebase issues
2020-11-03 16:08:46 +11:00
rishflab
7afd316210 Construct tor transport for Bob 2020-11-03 15:13:25 +11:00
rishflab
3b008c38a6 Remove redundant code and stale comments 2020-11-03 15:13:25 +11:00
rishflab
249f273d1b Remove stale comments 2020-11-03 15:13:25 +11:00
rishflab
5971ef1f28 Fix clippy warnings 2020-11-03 15:13:23 +11:00
rishflab
606c48c752 Format swap crate Cargo.toml 2020-11-03 15:13:03 +11:00
rishflab
796d0b3439 Extract transport creation and remove tor conditional compile
The numerous tor conditional compile flags were removed by
extracting transport creation to the main statement. A tor
transport is created if Alice specifies a tor port using the CLI.
2020-11-03 15:12:52 +11:00
rishflab
0ca511bf8a Remove hardcoded configuration
The hardcoded configuration was replaced with CLI
configuration options. CLI based config was chosen
over a config file as it does not access and clutter
the user's file system. By CLI options depend on whether
the program is run in Alice or Bob mode.
2020-11-03 15:08:10 +11:00
Lucas Soriano
62c9f22b64
Merge pull request #30 from comit-network/use-execution-in-swap
Execute on-chain protocol after handshake
2020-11-03 11:07:12 +11:00
Lucas Soriano del Pino
92c7e8e84f Run swap e2e test without tor feature
Not worth automatically testing both `tor` and `not(tor)`, it should
not make a difference.
2020-11-02 10:31:53 +11:00
Lucas Soriano del Pino
792fa351c8 Upgrade bitcoin-harness dependency
From dev-branch to master.
2020-10-30 15:55:10 +11:00
Lucas Soriano del Pino
7fa7641feb Clean up some logs and comments 2020-10-30 15:51:46 +11:00
Tobin C. Harding
4d4acde476 Bubble up an event when Bob receives message 3 response
Before this patch Bob is not sending message 3. This is because we are not
polling Bob's swarm correctly. To fix it we can just mimic the other NB's and
bubble up an event when Bob receives message 3 response from Alice, this way we
can `await` upon this event which triggers polling, making Bob's swarm send the
message.
2020-10-30 14:07:15 +11:00
Lucas Soriano del Pino
a37f43a1ba wip: Provide enough funds to both parties
Also use cosntant backoff retry strategy as opposed to exponential
backoff. This is in case retrying several times quickly causes the
retry intervals to become large enough that the test is very slow
and/or the Bitcoin lock transaction expires.

The current problem occurs on the last message i.e. Bob sending
tx_redeem_encsig to Alice. The action is yielded for Bob to do it, but
Alice appears to never receive it (unconfirmed claim, requires more
logging).
2020-10-30 14:07:15 +11:00
Lucas Soriano del Pino
eb6bbe6180 wip: Fix bug where bob was sending two amount request 2020-10-30 14:05:45 +11:00