Commit Graph

744 Commits (daa572e5bf7fd1f42c26adaecff08e0b4989a32a)

Author SHA1 Message Date
Thomas Eizinger 9ad2160c69
Refactor the kraken module to automatically re-connect on errors
3 years ago
Thomas Eizinger c560b3b21a
Introduce `RateUpdate` type alias to reduce duplication
3 years ago
Thomas Eizinger fd5b38739a
Remove constant in favor of inlining string
3 years ago
Thomas Eizinger 142e5e2d3a
Use tracing macros by fully-qualifying them
3 years ago
bors[bot] cc131ecf60
Merge #293
3 years ago
Thomas Eizinger 08923a14f3
Simplify GET request for block tip height
3 years ago
Thomas Eizinger e9d7d9299c
Simplify the GET request to the tx status URL
3 years ago
Thomas Eizinger 418ad7089d
Make tests more readable by following arrange-act-assert
3 years ago
Thomas Eizinger c2329b19a2
Tell the user more about the monero lock transaction
3 years ago
Thomas Eizinger 13c4d29d40
Tell the user immediately how many confirmations we expect
3 years ago
Thomas Eizinger 4883e23dd8
Tell the user for how many confirmations we are waiting
3 years ago
Thomas Eizinger 5d4cf40831
Fix comparison of Monero confirmations
3 years ago
rishflab f92a8ac300 Improve CLI help comments and "type" hints
3 years ago
Daniel Karzel 196557b377 Rename binary to swap
3 years ago
Daniel Karzel f8b61e2e0e Make monero daemon host configurable
3 years ago
Daniel Karzel f091402c7a Remove parameter duplication by introducing structs
3 years ago
Thomas Eizinger c826a28911
Add context if we fail to compute extended private key
3 years ago
Thomas Eizinger 1aa6d177bf
Improve error messages when determining BTC amount to be swapped
3 years ago
Thomas Eizinger 4138039ea0
Make sure all error messages start with an uppercase letter
3 years ago
Thomas Eizinger 816e8b9b96
Add more context to fallible functions inside bitcoin::Wallet
3 years ago
Thomas Eizinger 5c24a46298
Improve error message if stuff fails directly in main
3 years ago
Thomas Eizinger 37f97ac471
Shorten function name
3 years ago
Thomas Eizinger 4f66269887
Move error message on sync _into_ the function
3 years ago
Thomas Eizinger 5953037b81
Don't repeat the module name within the type
3 years ago
Thomas Eizinger 87f928f56c
Move const to function where it is used
3 years ago
Thomas Eizinger 4642e6c0e3
Simplify arguments to `init_XYZ_wallet` functions
3 years ago
Thomas Eizinger d0db6cba10
Favour individual logs over one in main
3 years ago
bors[bot] 2041f367c6
Merge #288
3 years ago
rishflab 754159c9f8 Switch to public stagenet node that works
3 years ago
Thomas Eizinger b178e95f95
Redo layout of eventloop module
3 years ago
Thomas Eizinger 1822886cd0
Provide stronger isolation of kraken module
3 years ago
Thomas Eizinger f6ed4d65b5
Properly deal with additional messages sent from kraken
3 years ago
Thomas Eizinger 7575d412b8
Add kraken_ticker CLI for local testing of the client
3 years ago
Thomas Eizinger 60d6d50246
Extract kraken websocket client into dedicated module
3 years ago
bors[bot] 20f2e56e2d
Merge #271
3 years ago
Daniel Karzel 47a31760c0 Bob can verify the Monero txs by tx-hash
3 years ago
Thomas Eizinger 14dcd150af
Extract `determine_btc_to_swap` function and test it
3 years ago
Thomas Eizinger 601bf07255
Introduce `quote` protocol and display it to the user before they fund
3 years ago
Thomas Eizinger 3da01ea44a
Rename local variables according to new protocol name
3 years ago
Thomas Eizinger ead5db3f45
Re-order fields to group them semantically
3 years ago
Thomas Eizinger bc176bc4fb
Minor import optimizations
3 years ago
Thomas Eizinger 6d9b21cb47
Change `imports_granularity` to module
3 years ago
Thomas Eizinger 2c8200621d
Move `pub use` into pub use block
3 years ago
bors[bot] d1363d130c
Merge #265
3 years ago
Daniel Karzel 7504c6ceee Context for monero address parsing errors
3 years ago
Daniel Karzel 35d0e246d8 Monero address network check
3 years ago
bors[bot] cba9f119b6
Merge #261
3 years ago
Daniel Karzel 2e3c2d8edf Remove Arcs in favour of references
3 years ago
Daniel Karzel 5d807e9647 Reorder: Move utility functionality to bottom
3 years ago
Daniel Karzel 862c29f1a8 Reorder: Move sweep_all after transfer
3 years ago
Daniel Karzel 5a43b3453e Reorder: Move create after open
3 years ago
Daniel Karzel b17e6cbd94 Reorder: Move open to top
3 years ago
Daniel Karzel d63790c2a6 Remove unnecessary monero wallet trait abstractions
3 years ago
Daniel Karzel 1041212a60 Work in review comments
3 years ago
Daniel Karzel 66c8401c95 Sweep all from generated wallet to user wallet
3 years ago
Thomas Eizinger 7042ed9441
Replace quote with spot-price protocol
3 years ago
Daniel Karzel 9f53dab3c6 Harmonize names to make more sense
3 years ago
Daniel Karzel 70494fcb4f Create means creating the current wallet
3 years ago
Daniel Karzel 5b798217bc Open means opening the current wallet
3 years ago
Thomas Eizinger 2440964385
Allow ASB to be configured with max BTC buy amount
3 years ago
Thomas Eizinger ce077a3ff5
Decouple Bob's EventLoop from the builder
3 years ago
Thomas Eizinger 54bc91581f
Don't unnecessarily create async blocks
3 years ago
Thomas Eizinger a4c25080b6
Merge network::Seed into crate::Seed
3 years ago
Thomas Eizinger 089ac0806e
Simplify constructor of Bob's EventLoop
3 years ago
Daniel Karzel 1b167f3eb6 Cleanup swap initialization for Alice and Bob
3 years ago
bors[bot] a8ebd4d16e
Merge #259
3 years ago
rishflab a41b255dab Upgrade bitcoin wallet to use BIP84 derivation scheme
3 years ago
rishflab bcdde021eb Add windows support to monero rpc installer
3 years ago
rishflab 27df9128be Bail if monero wallet rpc is not found in downloaded archive
3 years ago
Thomas Eizinger 3ad9516188
Reduce logging when signing transactions
3 years ago
Thomas Eizinger 8c9b087e39
Unify logging of broadcasted transactions
3 years ago
Thomas Eizinger 3a503bf95f
Shorten function name
3 years ago
Thomas Eizinger 45cff81ea5
Remove traits in favor of using the wallet struct directly
3 years ago
Thomas Eizinger 8c0df23647
Only show _log_ output if the user passes `--debug`
3 years ago
Thomas Eizinger cb4e2c041b
Rename `opt` to `args`
3 years ago
Thomas Eizinger f4827e3fa4
Improve time formatting of log output
3 years ago
Thomas Eizinger a82e82edd5
Tell the user about the monero-wallet-rpc download
3 years ago
Thomas Eizinger 06e3bccaa6
Don't print PeerId when requesting quote
3 years ago
Thomas Eizinger cbef577e2d
Inform user that we are going to swap the remainder of the balance
3 years ago
Thomas Eizinger b7c3524b4f
Abort the eventloop if the dialling fails
3 years ago
Thomas Eizinger 4e9e186462
Don't log things the user doesn't care about
3 years ago
Thomas Eizinger 6b74761e34
Remove tracing context
3 years ago
Thomas Eizinger 3d2d447fba
Improve error message
3 years ago
Thomas Eizinger bbbe5f7ae8
Demote / promote log messages to their appropriate level
3 years ago
Thomas Eizinger 7387884e6d
Move log messages to the appropriate abstraction layer
3 years ago
Thomas Eizinger b8df4a3145
Inline tracing configuration for swap_cli
3 years ago
Thomas Eizinger a0e7c6ecf7
Don't Arc the AtomicU32
3 years ago
Thomas Eizinger 40dcf0355a
Simplify `Transfer::transfer` return type
3 years ago
bors[bot] 1de3fa486e
Merge #247
3 years ago
Thomas Eizinger 9f0b1c5cbe
Calculate max_giveable based on spending script size
3 years ago
Daniel Karzel 8c40ee1da4 Change anyhow! to bail! in error scenarios
3 years ago
bors[bot] 7251588e79
Merge #233
3 years ago
bors[bot] 5ddf41721e
Merge #238
3 years ago
rishflab 975d604405 Test to ensure default alice peer id and multi addr is valid
3 years ago
rishflab 9a82b572ec Default to buy xmr using default trait
3 years ago
rishflab d6d67f62f1 Swap cli executes BuyXmr path if subcommand is not given
3 years ago
rishflab 60de6a9219 Remove intermediate structs in cli arguments
3 years ago
bors[bot] 9a32f7d405
Merge #236
3 years ago
Daniel Karzel bb1537d6f2 Error feedback for the user upon communication errors
3 years ago
Daniel Karzel 019d6c725a Maximum sell amount for ASB that defaults to 0.5 XMR
3 years ago
bors[bot] bb0377c6c7
Merge #232
3 years ago
Daniel Karzel e66e84085b Rename Bob's Behavior Failure to CommunicationError
3 years ago
Thomas Eizinger f472070546
Remove `--send-btc` in favor of swapping the available balance
3 years ago
Thomas Eizinger 32cb0eb896
Rename `build_tx_lock_psbt` to `send_to_address`
3 years ago
Thomas Eizinger 67fe01a2ef
Remove `BuildTxLockPsbt` and `GetNetwork` traits
3 years ago
Thomas Eizinger 6c38d66864
Remove `Tx` arguments from `add_signatures` functions
3 years ago
Thomas Eizinger 0f8fbd087f
Make all fields of `bitcoin::Wallet` private
3 years ago
Thomas Eizinger 1876d17ba4
Remove `map_err` in favor of `?`
3 years ago
Thomas Eizinger 7d324d966a
Remove `syncing` wallet log
3 years ago
bors[bot] 93d59398af
Merge #231
3 years ago
Daniel Karzel 1f1b3a95bc Logging for different scenarios when reading from rate stream
3 years ago
rishflab abc9aaa327 Use default alice peer id and multiaddr if not specified in cli args
3 years ago
Daniel Karzel cad6a1c3a7 ABS only sends quote response if sufficient XMR balance
3 years ago
rishflab f52567155a Use default testnet config if config file path not specified
3 years ago
Daniel Karzel fc2c08c7c9 Error only on close message when fetching the rate
3 years ago
rishflab 51c16f23d8
Download and run monero wallet rpc on swap cli startup
3 years ago
Daniel Karzel 0945cee459 Remove traits in favour of public functions
3 years ago
Daniel Karzel 578d23d7fc Proper encapsulation of wallet boundaries through private fields
3 years ago
Daniel Karzel 947bcb6192 ASB reloads the default wallet after generate_from_keys atomically
3 years ago
Daniel Karzel 684cbe4d0b Remember monero wallet-height for Alice's refund scenario
3 years ago
Daniel Karzel fa04775188 Rename function explicit to cancellation to cancel
3 years ago
Daniel Karzel 1404057dbe Remove misleading TODO
3 years ago
Daniel Karzel 9f1deb9fdc Wrap the Monero wallet client in a Mutex
3 years ago
Daniel Karzel aed8358fb7 Remove dead code
3 years ago
bors[bot] 2654879ff3
Merge #218
3 years ago
bors[bot] fb2057453a
Merge #219 #221
3 years ago
Thomas Eizinger 66db8e1851
Remove unnecessary log dependency
3 years ago
Thomas Eizinger 03078f328c
Split monero-harness into harness and rpc
3 years ago
rishflab 8280072400 Fix/improve comment explaining TxRefund encsigning
3 years ago
Daniel Karzel 151f33ba10 Rename variables to add to understanding the code
3 years ago
bors[bot] 61a8282be1
Merge #203
3 years ago
Daniel Karzel b4ceee49df Change monitoring to default wallet
3 years ago
Daniel Karzel 9496dce917 Skip heartbeat messages
3 years ago
Thomas Eizinger a8bfc1d686 Make LatestRate::Error require std::error::Error trait bound
3 years ago
Thomas Eizinger b47b06aa23 Import anyhow::Result across the codebase
3 years ago
Franck Royer 519d1a5701 Log rate and amounts for Alice when doing execution setup
3 years ago
Franck Royer 644f4c1732 Bubble up ws error to consumer
3 years ago
Franck Royer 92b3df4158 Introduce dynamic rates
3 years ago
bors[bot] a6724f29af
Merge #214
3 years ago
bors[bot] 81228c9d5b
Merge #209
3 years ago
Daniel Karzel fe3d6f1fef Rename nectar to asb (automated swap backend)
3 years ago
Daniel Karzel 164de3c524 Properly calculate the confirmations for Bitcoin tx
3 years ago
Thomas Eizinger 2d8ede80e1
Use released version of backoff
3 years ago
Thomas Eizinger cabf0efb8c
Only construct proof system once
3 years ago
Thomas Eizinger 84bc2c82b7
Upgrade to bdk 4.0
3 years ago
bors[bot] b3f49cf83e
Merge #200
3 years ago
bors[bot] 8537b88a68
Merge #201
3 years ago
Daniel Karzel babd1d7b60
Wait for refund if insufficient Monero is locked up
3 years ago
Daniel Karzel ebb869e6f4 Distinguish transient and permanent Electrum errors
3 years ago
Daniel Karzel 9b93cabfdf Use context instead of map_error
3 years ago
rishflab fe362d765b Add sync wallet on nectar's startup
3 years ago
rishflab 00e2b257c4 Remove misplaced sync wallet call
3 years ago
Daniel Karzel 2ced9ddba4 Prevent future from being stopped by calling forget on handle
3 years ago
Daniel Karzel 77ec7e502f Distinguish permanent and transient error when watching tx
3 years ago
rishflab b66bb00c77 Remove stale code
3 years ago
rishflab bc1d2bda54 Test URL creation for default electrum HTTP API
3 years ago
rishflab d296c22ecf Log bitcoin deposit address on startup
3 years ago
rishflab 4768c79070 Derive bitcoin private key from seed
3 years ago
Thomas Eizinger a51194b9fa Instantiate electrum client with custom config with 2 retries
3 years ago
rishflab 180e778df9 Allow blockchain calls to fail
3 years ago
rishflab a0ef1f96ec Replace bitcoind wallet with bdk wallet
3 years ago
bors[bot] 4d8e801c1e
Merge #190
3 years ago
bors[bot] 5d215caf35
Merge #188
3 years ago
Franck Royer f36f5acaf1
Remove unnecessary async block
3 years ago
Franck Royer 73c52ffb61
Remove unused structs
3 years ago
Franck Royer 2dbd43e2c0
Only pass btc amount to CLI
3 years ago
Franck Royer 144da75270
Remove redundant data
3 years ago
Franck Royer fb3b2aa546
Remove unnecessary pub qualifier
3 years ago
Franck Royer b4e2e11dde
Remove unnecessary fields
3 years ago
Franck Royer d6effb7d39
Remove unnecessary pub qualifiers
3 years ago
Franck Royer b8a84aa34b
Avoid possible mix up between timelocks
3 years ago
Franck Royer 9a321a4f09
Move transaction types in dedicated modules
3 years ago
Franck Royer 65e0e5b731
Use Remote handle to access ongoing swaps on Alice
3 years ago
bors[bot] a0753e24dc
Merge #189
3 years ago
Franck Royer 5d78556665
Give a more specific name to the CLI binary: `swap-cli`
3 years ago
Franck Royer 8fada42074
Make `config` argument global
3 years ago
Franck Royer 83dcf4ba3c
Add `nectar` binary
3 years ago
Daniel Karzel c166232daf Remove unnecessary mention of Tor in comment
3 years ago
Franck Royer 9ded728879
The first message is actually a quote or rate request
3 years ago
Franck Royer ee43125bdd
Add `nectar` binary
3 years ago
Franck Royer fac5b59d17
Remove unnecessary specification of the types
3 years ago
Franck Royer 7805a6d684
Move cli specific modules under cli folder
3 years ago
Franck Royer 901c9e89c9
No evident added value of having separate `Seed` structs
3 years ago
Franck Royer 7d392c3086
This files contains `Command` and `Arguments` structs
3 years ago
Franck Royer 45dccb8be2
Rename the config struct `Config`
3 years ago
Franck Royer 6e6dc320b4
Alice event loop now handles the creation of new swaps
3 years ago
Franck Royer bfc19d5628
Remove acknowledgements processing
3 years ago
Franck Royer cc8b855117
Make it possible to clone a handle
3 years ago
Franck Royer 1b2be804ed
Remove unnecessary channels
3 years ago
Franck Royer f5ca5faabf
Process execution setup failure similarly to other failures
3 years ago
Franck Royer 4ade5df0e5
Remove unnecessary impl block
3 years ago
Franck Royer 60e0b9382c
Introduced from float API for Monero quantities
3 years ago
Franck Royer b5b990257a
Move `Behaviour` in dedicated module
3 years ago
Franck Royer 87be9aeb2a
Prepare separation of event loop initialisation to swap initialisation
3 years ago
Franck Royer 530b9b2ea8
Remove possible mix up of timelocks when using `State0::new`
3 years ago
Franck Royer f35ed436ce
Allow `EventLoop` to hold a database ready to pass to `alice::Buider`
3 years ago
Franck Royer 39a46baa2c
Preemptively box cancel tx to avoid size difference in enum
3 years ago
Franck Royer 69363e43a3
Preemptively box encrypted signature to avoid size difference in enum
3 years ago
Franck Royer fd084b764d
Move generation of keys inside `State0::new`
3 years ago
Franck Royer 788445964a
Move main.rs to cli.rs to prepare for nectar binary
3 years ago
Franck Royer 311ba74cd6
Remove sell-xmr from CLI
3 years ago
Daniel Karzel 0a0bce1552 Rename temporary wallet to blockchain monitoring wallet
3 years ago
Daniel Karzel 1e29433bd2 Open or create temporary Monero wallet upon wallet initialization
3 years ago
Daniel Karzel dac4443bbd Add functionality to open monero wallet through rpc
3 years ago
Daniel Karzel 62605a318a Add CreateWallet trait to expose create_wallet
3 years ago
Daniel Karzel 53fcd9224c Give finding the refund tx priority over waiting for the punish transaction to be finalized.
3 years ago
Daniel Karzel 86290649e7 work in review comments
3 years ago
Daniel Karzel c930ad84a4 Add --force flag for cancel and refund
3 years ago
Daniel Karzel 2d5d70d856 Timeout for Alice waiting for ack for sending transfer proof
3 years ago
Daniel Karzel ad2aefc2a5 Refund Command
3 years ago
Daniel Karzel 0600a7048e Cancel command
3 years ago
Franck Royer dee8c1e335
Remove scopes
3 years ago
Franck Royer a48823a665
Re-organise Alice state to be more coherent with the msg sequence
3 years ago
Franck Royer eefb1b3b16
Use event_process = false for Bob
3 years ago
Franck Royer a7b89e2fe4
Use event_process = false for Alice
3 years ago
Franck Royer 554ae6c00e
Remove Request Response types
3 years ago
Franck Royer 5a5a1c05f7
Set appropriate name to codec
3 years ago
Franck Royer a11e894b31
Prepend all libp2p protocols with "comit"
3 years ago
Franck Royer cfc5cb5206
Remove dead code and combine swap request & one shot codecs
3 years ago
Franck Royer fc2d8d3861
Rename alice::Message0 to Message0
3 years ago
Franck Royer 88bf080dc0
rename alice::Message0 to Message1
3 years ago
Franck Royer 18f326ddd1
Rename bob::Message1 to Message2
3 years ago
Franck Royer 0d1be52966
Rename alice::Message1 to Message3
3 years ago
Franck Royer e74efd38b5
Rename bob::Message2 to Message4
3 years ago
Franck Royer 081237bb6f
Remove unused behaviours
3 years ago
Franck Royer ecb54958ee
Preemptively Box few messages
3 years ago
Franck Royer 3fa4ffa82c
Implement new behaviour for execution setup
3 years ago
Franck Royer 9ae050abf8
Use correct variable name
3 years ago
Franck Royer c316ea5244
Upgrade toolchain
3 years ago
Franck Royer e82383bcf6
Avoid carrying rng
3 years ago
Philipp Hoenisch 25bf5df122
Merge pull request #172 from comit-network/dead-code
3 years ago
Philipp Hoenisch 8743527df9
Remove dead code
3 years ago
Daniel Karzel b27363e386 Use correct default data directory
3 years ago
Daniel Karzel 5cb4f3c99d rename configuration to config
3 years ago
Daniel Karzel 89b3775e05 Rename config to execution_params
3 years ago
Daniel Karzel 802dc61e7e Configuration for RPC urls and Bitcoin wallet name
3 years ago
Franck Royer f1c07fbb6d
Remove incorrect todo
3 years ago
Franck Royer c25d5ff07e
Improve network logging
3 years ago
Franck Royer f9f17b0e23
Do not consider transfer proof sent until it's ack'd
3 years ago
Franck Royer b968c98805
remove unnecessary logs
3 years ago
Franck Royer cc76b201b5
Do not consider encrypted signature sent until it's ack'd
3 years ago
Franck Royer 5af3532cbf
Fix log messages
3 years ago
Franck Royer 704a8e7b01
Add swap id to tracing context
3 years ago
Franck Royer b8a9356d1b
Change expiries depending on the test goal
3 years ago
rishflab 0b69573129
Run tests on one thread, increase T1
3 years ago
rishflab 1597f5336b
Restart event loop in tests
3 years ago
rishflab 77fc5743a2
Upgrade tokio to 1.0
3 years ago
Franck Royer 2073e88683
Remove wrapping if `ReadOneError` when unnecessary
3 years ago
Franck Royer 2929a8f101
Use the correct protocol support
3 years ago
Franck Royer b62ef9c2d9
Harmonizing naming
3 years ago