441 Commits

Author SHA1 Message Date
Dmitry Holodov
007162b929 New bash library, and well as bash linting and formatting (#170)
* Allows unit and integration tests to share the same bash code via a utility library named testlib.sh.
* Linting and formatting of bash scripts was added to the Makefile targets lint and format.
* Updated the docker image and Go used by git actions
2022-08-25 13:24:13 -05: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
noot
7ab3ccb5a1 validate monero addresses based on network (#155) 2022-08-19 15:40:18 -04:00
Dmitry Holodov
49a4ff12f3 Full API Monero RPC client (#154)
Switches from our partial Monero RPC client implementation to a full-API client to help with testing, reliability, debugging and future features. Other changes:
* GenerateBlocks written for better results when called by multiple parties simultaneously
* monero.Client interface renamed to monero.WalletClient to be orthogonal with monero.DaemonClient interface
* monero.NewClient(...) renamed to monero.NewWalletClient(...) to be orthogonal with monero.NewDaemonClient(...)
* monero.CreateMoneroWallet(...) simplified to monero.CreateWallet(...) (package prefix already states wallet type)
* monero/clent.go, monero/daemon.go renamed to monero/wallet_client.go, monero/daemon_client.go
* monero/rpc.go removed with code consolidated into monero/wallet_client.go and monero/daemon_client.go
2022-08-18 23:58:14 -05:00
noot
5a6dab38f1 update stagenet script (#152) 2022-08-15 16:12:20 -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
noot
6e0fbb01dc update contract and comments (#150) 2022-08-13 19:05:05 -04:00
Dmitry Holodov
36bfb03831 Update go ethereum (#149)
* Updated go-ethereum dep to 1.10.21
* Code now installs/uses an abigen that automatically matches the version of our go-ethereum in the go.mod
* solc was updated to 0.8.16 (in the docs, we don't install it, but anyone wanting to generate identical output needs it).
* Minimum go version is now 1.18
* golangci-lint updated to v1.48.0 (was needed to play nicely with go 1.18 and the new generated code)
* dleq/cgo-dleq submodule updated to latest version
2022-08-11 13:52:47 -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
noot
b298302a76 implement swap_clearOffers endpoint for usage in integration tests (#148)
* add swap_clearOffers endpoint, start updating integration tests to use it

* add clear-offers to swapcli
2022-08-09 16:20:20 -04:00
Dmitry Holodov
b729588dd5 update to current version of ganache (#138)
Updates the repo to install the latest version of ganache (ganache-cli is obsolete). 

One of the things that changed in the newer version of Ganache, is gas fee estimation uses the timestamp from the last mined block instead of the local computer's current timestamp. This mirrors what Geth does, so the Ganache change is helpful, but it caused a few problems that this PR fixes.

If we want to do dynamic fee estimation for a transaction that can not happen before time T0 or T1, we need to wait until there is one mined block after T0 or T1 to create our transaction. Otherwise the transaction will be reverted during fee estimation, returning an error when creating the transaction, and we'll never send the transaction out to the network.

Ganache, by default, only mines blocks when you create a transaction. In order to have a mined block after T0 or T1 to calculate transaction fees, we stopped using instamine, and now mine a block every second. This PR chose the minimum block interval for speedier tests.

Co-authored-by: noot <36753753+noot@users.noreply.github.com>
2022-08-06 22:30:45 -05:00
noot
1d0482a7fc update dleq library (#142) 2022-08-01 21:54:32 -04:00
Dmitry Holodov
e9f437b7bb fix incorrect padding in NewPublicKeyFromBigInt (#143) 2022-08-01 20:19:36 -04:00
noot
dbdab9519b cleanup: remove farcaster-dleq (#140) 2022-07-16 15:42:54 -04:00
Dmitry Holodov
e0e627f847 fix double locks (#139) 2022-07-06 18:10:05 -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>
v0.1.0
2022-06-29 13:36:03 -04:00
noot
68f17665af fixes for stagenet swap and UI (#137) 2022-06-23 16:15:20 -04:00
Thibaut Sardan
7ae4dcbbbe Metamask store cleanup and bring back success message (#129) 2022-06-14 23:05:21 -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
5384d707a5 add joining stagenet and recovery module documentation (#117) 2022-05-24 20:37:27 -04:00
noot
db1572a74e check that contract code is valid before swapping (#116) 2022-05-19 22:20:53 -04:00
noot
4931e012db fix: add nil check for shutdown err (#115) 2022-05-16 21:52:10 -04:00
noot
55ae59046c add more unit tests + errors clean up (#114) 2022-05-15 23:36:03 -04:00
noot
2b631d2d36 automated tester improvements and fixes (#111) 2022-05-09 21:30:07 -04:00
noot
6d82cba9b1 migrate to dleq-rs library (#112)
* implement CGODLEq prove/verify

* migrate fully to cgo dleq

* bump monero version
2022-05-01 18:09:00 -04:00
noot
968dd75fbd fixes for stagenet, log cleanup, add automated stagenet tester binary (#108) 2022-04-11 18:56:53 -04:00
noot
a7907ecd12 ui: display multiple peers (#110) 2022-04-04 17:38:22 -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
5da8a30630 update donations section of readme (#104) 2022-03-21 20:49:25 -04:00
noot
65d64544d7 implement unhappy path and error case integration tests (#102) 2022-03-21 15:54:41 -04:00
noot
d24eb78434 create separate integration test CI job, implement net_makeOfferAndSubscribe, swap_getOffers, implement happy path integration test (#101) 2022-03-15 22:50:05 -04:00
noot
f0021ce118 implement websocket client, net_takeOfferAndSubscribe (#100) 2022-03-07 22:05:27 -05:00
Thibaut Sardan
cd4de3c01e ui: devnet setup script and show errors in the UI (#99) 2022-03-05 17:58:07 -05:00
noot
e81de8cd57 implement websockets server and swap_subscribeSwap (#96) 2022-02-26 17:58:38 -05:00
Thibaut Sardan
7710b52cba ui: check user input eth value, add waiting for swap module (#91) 2022-02-24 10:13:26 -05: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
Thibaut Sardan
a44c956415 Some UI to get started (#87) 2022-02-05 22:29:53 -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
15c094c513 add CORS support (#81) 2022-01-21 17:15:16 -05:00
Thibaut Sardan
8b271bac79 readme and gitignore update (#80) 2022-01-20 21:40:30 -05:00
noot
e961f4dd2e add json-rpc documentation (#78) 2022-01-17 22:21:04 -05:00