Commit Graph

52 Commits

Author SHA1 Message Date
Dmitry Holodov
5698e25239 RPC and WS endpoints share the same port (#187)
Combine our HTTP RPC and Websocket services into a single HTTP server, eliminating the --ws-port flag to swapd and using --swapd-port flag for swapcli.
2022-09-10 14:54:43 -05:00
Dmitry Holodov
476bc69b82 CLI cleanups (#185)
* Switches to current v2 version of urfave CLI
* Fixes incorrect port values in the help
* Provides defaults directly to urfave for clear `--help` messaging
* `--base-path` flag renamed to `--data-dir`. This matches `monerod`'s' `--data-dir` and almost matches the `geth` flag `--datadir`
* Bootnodes and contract address are provided for stagenet testing
* Bootnodes can be provided individually by repeating the `--bootnodes`/`--bn` flag, or as a comma separated block (original behavior), or even a combination of both. (Makes adding/removing bootnodes a lot easier.)
* More precise error messaging when XMR maker/taker values are off
* Fixes bug in the peer finder where XMR was hardcoded as the provides coin
* `cleanup-test-processes.sh` displays which processes are being killed
2022-09-07 19:45:01 -05:00
doonte
067b12f584 add direct ERC-20 swap support (#158)
Co-authored-by: noot <elizabethjbinks@gmail.com>
Co-authored-by: noot <36753753+noot@users.noreply.github.com>
2022-09-05 14:12:22 -04:00
noot
01593106d0 fix private IP filters (#175) 2022-08-27 10:55:10 -04:00
noot
ae42d8da54 add 127.0.0.1 to private filter list (#174) 2022-08-26 20:17:05 -04:00
noot
38b079cb96 persist peerstore to disk (#173) 2022-08-24 20:34:40 -04:00
noot
d7d7cf0e0a cleanup todos, either fix or add issue numbers (#166) 2022-08-20 23:57:23 -04:00
Dmitry Holodov
b2c8641087 rename module (#156) 2022-08-19 20:31:50 -04:00
Dmitry Holodov
3d48bd9e9e upgraded libp2p dependencies (#151)
Updates our libp2p dependencies to the latest stable versions.
2022-08-14 16:14:10 -05:00
Dmitry Holodov
cbecd6a891 fix various concurrency issues (#147)
* Fixes lock issues on the XMR Maker's offer list (new package protocol/xmrmaker/offers)
* Fixes lock issues on the swapState maps
* Fixes go routine sync issues in TestError_ShouldOnlyTakeOfferOnce that were sometimes breaking TestSuccess_ConcurrentSwaps
* Ensures that the id field of "types.Offer" is initialized when created
2022-08-10 08:12:12 -05:00
Dmitry Holodov
e9f437b7bb fix incorrect padding in NewPublicKeyFromBigInt (#143) 2022-08-01 20:19:36 -04:00
Dmitry Holodov
adfb0fa602 Test cleanup (#135)
* version independent monerod path with localhost-only binding

* fixed lint target and install script

* created 3rd ETH key constant to avoid race condition in tests

* updated run-integration-tests.sh with the same changes made to run-unit-tests.sh

* new design for paritioning out 2 unique keys to test packages

* restored accidentally deleted tests/alice.key

* removed websocket connection leaks from tests

* made file paths unique between tests with better file cleanup

* fix for the websocket connection leak commit

* reverted increase of GenerateBlocks (didn't mean to commit that)

* fixed maker/taker key that I had reversed

* fixed incorrect zero-balance check

* fixed comment on ClaimOrRefund

* added back sample script for installing go in /usr/local/go

* etchclient creation cleanup using t.Cleanup()

* minor cleanup to ganache_test_keys code

* initial dynamic monero-wallet-rpc implementation for tests

* converted monero tests to use dynamic monero-wallet-rpc services

* unit tests all using dynamic monero-wallet-rpc services

* fixed 2 tests that failed after moving to dynamic monero-wallet-rpc services

* fixed low balance issues in TestSwapState_NotifyClaimed

Co-authored-by: noot <36753753+noot@users.noreply.github.com>
2022-06-29 13:36:03 -04:00
noot
cca0b6c771 allow for multiple ongoing swaps (#128) 2022-06-13 20:50:10 -04:00
noot
11e3b27c2e ui: metamask integration, swapd: implement external sender for front-end integration (#126) 2022-06-07 18:06:24 -04:00
noot
0eb4f73dcc refactor: create protocol backend, rename protocol packages to xmrmaker/xmrtaker (#123) 2022-06-02 22:08:20 -04:00
Matthew Di Ferrante
961ceea463 Optimize gas usage through less reads (#122)
* rework contracts to use less gas by storing just swap hash when creating a swap

* prevent overriding of existing swaps

* ensure swap exists when trying to refund

* update bindings script and go contract bindings

* update swapfactory go tests

* updating protocol, compiles

* update recoverer, everything builds

* fix cmd/recover tests

* fix recover tests

* lint

* fix checkContractCode

* fix protocol/ tests

* inherit secp256k1 instead of using library to prevent double deployment

* rerun abigen and hardcode runtime bin for now

* add nolint to long hardcoded runtime bin line

* cleanup commented out stuff

Co-authored-by: noot <elizabethjbinks@gmail.com>
2022-05-28 22:36:01 +02:00
noot
55ae59046c add more unit tests + errors clean up (#114) 2022-05-15 23:36:03 -04:00
noot
968dd75fbd fixes for stagenet, log cleanup, add automated stagenet tester binary (#108) 2022-04-11 18:56:53 -04:00
noot
8bb6499a90 check that XMR amount peer will send is same as expected (#105) 2022-03-24 10:55:21 -04:00
noot
65d64544d7 implement unhappy path and error case integration tests (#102) 2022-03-21 15:54:41 -04:00
noot
f98ba1f902 implement swap_getStage (#95) 2022-02-12 20:46:42 -05:00
noot
8a8bc8a943 implement swap_refund endpoint (#94) 2022-02-12 20:07:36 -05:00
noot
718092a6f3 implement net_takeOfferSync (#92) 2022-02-11 00:15:52 -05:00
noot
5d225ac41d add code coverage to unit tests step, add lots of unit tests (#79) 2022-02-05 23:07:29 -05:00
noot
d62765a1ff implement SwapFactory.sol and integrate into codebase (#85) 2022-01-26 19:27:29 -05:00
noot
b0b6cb5286 implement swap_ rpc service to allow for fetching of current/past swap statuses (#82) 2022-01-22 22:24:43 -05:00
noot
988b514cf1 cleanup codebase (#72)
* remove unused code, move some funcs around

* move monero/crypto to crypto/monero

* cleanup alice swap_state.go, move funcs

* move rpcclient and types package to common
2022-01-16 23:34:29 -05:00
noot
39e6cc0bcd integrate DLEq into protocol (#67)
* update contract to use secp256k1 curve verification

* update go contract bindings script and bindings

* cleanup rust code, move to its own folder

* remove commented out stuff

* go fmt

* add go wrapper around farcaster-dleq

* add unit tests for farcaster-dleq wrapper

* add dleq unit test for keys

* add swap.go claim test, worksgit status

* add swap.go refund tests

* lint

* update SendKeysMessage to include DLEqProof, update alice/bob generateKeys

* add dleq proof verification to alice/bob handlers

* move alice and bob to protocol package

* add common protocol funcs for generating/verifying dleq proof

* lint

* update alice to store secp256k1 pubkey commitments in contract, update alice/bob to use dleq secret when calling contract

* update alice unit tests

* fix bob unit tests

* update network msg size

* add build-dleq makefile step

* cleanup

* attempt to fix test

* skip inconsistent test on CI
2022-01-15 13:41:27 -05:00
noot
5033587a4a refactor: allow for Bob to explicitly make offers and Alice to take them (#66)
* begin refactor of make/take offer

* implement ability to make offer, advertise new offers, lint, etc

* implement personal rpc service

* update readme instructions

* add check that taker of offer provides correct amount
2022-01-04 21:13:33 -05:00
noot
bcbb77d8f6 add private key proof to SendKeyMessage, verify on receipt (#62) 2021-12-11 20:54:21 -05:00
noot
d6aba125e4 improve linter and lint code (#58) 2021-12-11 11:26:06 -05:00
noot
78752a9088 implement refund path for Bob on unexpected stream closure, add contract checks (#56) 2021-12-06 23:18:30 -05:00
noot
0c41b794e7 add more unit tests, add integration tests (#53) 2021-12-01 23:54:39 -05:00
noot
d703279d9b update units passed by cli/RPC to be standard unts, not smallest denomination (#50)
* update units for cmd line/RPC to be ether and monero

* fix log

* cleanup

* lint
2021-11-28 16:57:56 -05:00
noot
e2cffc980a implement swapcli (#47)
* add lock to swapState

* cli created w discover, query, and initiate

* add bold logging

* update readme
2021-11-25 23:15:06 -05:00
noot
6131c1d36f revert changes from issue #36 (#43)
* update protocol code

* lint, fix tests

* fix tests
2021-11-23 23:55:04 -05:00
noot
f369b9a3bb create mainnet, stagenet, and dev environments (#41)
* add environment type, update monero address to use network prefix

* update tests

* pass env through flag

* update --ethereum-privkey to take a file

* config basepath and chainIDs

* fix tests

* update network protocol IDs

* pass env to net

* go fmt, bump ci go version to 1.17

* make directories when needed

* fix tests
2021-11-23 23:47:41 -05:00
noot
95d72b7b02 add view key checks using open_wallet and close_wallet (#40)
* add view key checks using open_wallet and close_wallet

* fix unit tests, update script

* fix tests
2021-11-22 22:22:39 -05:00
noot
e32fc7ba48 protocol update: update contract to verify hash of private spend key, saving on gas (#37) 2021-11-22 00:01:53 -05:00
noot
5da175b471 utilize t0 and t1 logic in protocol code for Alice and Bob (#30) 2021-11-21 21:10:34 -05:00
noot
10749646df implement rpc server for daemon process, refactor codebase to be controlled via rpc calls (#23) 2021-11-14 18:48:07 -05:00
noot
c8644792ec add discovery and advertisement; update WantMessage to be ProvidesMessage (#21) 2021-11-13 19:18:01 -05:00
noot
09f53b7b06 move hard-coded values to consts file, cleanup context usage, add some tests for Bob (#18) 2021-10-29 17:47:29 -04:00
noot
e9057490f9 add ci checks for build, test, lint; lint code; change filenames to be go-idiomatic (#12) 2021-10-25 18:20:14 -04:00
noot
0c93532313 add log of alice's xmr balance after swap 2021-10-24 06:55:44 -04:00
noot
89643e6b12 add contract and Bob balance logging for eth 2021-10-24 06:34:58 -04:00
noot
2b087ac2a0 use ipfs go-log for logging, cleanup logs 2021-10-24 06:09:09 -04:00
noot
2ce6df2ee3 attempt to get alice.NotifyClaimed working 2021-10-23 20:11:08 -04:00
noot
3cbd0a162e add NotifyClaimed message 2021-10-23 20:05:01 -04:00
noot
d994837a14 working on SendKeysMessage handling 2021-10-23 12:02:28 -04:00