Commit Graph

436 Commits

Author SHA1 Message Date
noot
a25f62ee3d update forwarder code check (#255) 2022-12-09 15:00:20 -05:00
noot
f9aaa5e9d1 add forwarder contract code check (#253) 2022-12-06 21:46:04 -05:00
noot
83b1c877ff implement discoverLoop to find peers if count is low (#252) 2022-12-06 21:23:26 -05:00
Dmitry Holodov
1e83673f23 add package comments (#236)
package comments added to all packages
2022-12-02 00:43:32 -06:00
noot
4d95c4d9a9 implement get-offers for swapcli (#248) 2022-12-01 11:24:33 -05:00
noot
eff12532e1 remove unused struct (#249) 2022-11-30 19:36:51 -05:00
noot
6a85b4a327 fix: don't re-advertise if we have no offers (#245) 2022-11-30 18:43:53 -05:00
noot
5072a7dd1f fix: add monero public spend key check when verifying DLEq proof (#246) 2022-11-30 16:09:04 -05:00
Dmitry Holodov
7dd84a1d77 Cleanup RPC posting (#241)
* Moves RPC posting out of the `rpctypes` package making it a member function of the RPC client type
* Does proper context handling when making http POSTs
* Handles JSON serialization/deserialization in the POST method, simplifying code for callers
* Takes advantage of the Gorilla JSON-RPC 2.0 client library which simplifies error handling
* Updates HTTP transport to use DialContext in place of the deprecated Dial
2022-11-29 22:36:34 -06:00
noot
6cdffdbebf add go-dleq; remove all rust dependencies (#242) 2022-11-28 19:31:41 -05:00
noot
21c2f2a585 implement auto-recover for xmrtaker (#238) 2022-11-24 07:09:14 -05:00
Dmitry Holodov
fc6c94b3ea use standard wallet computation of the view key (#239)
* now uses standard wallet computation of the view key
* removed unused monero signing code
* added custom json handling for monero ed25519 scalar/point types
2022-11-23 10:28:32 -06:00
noot
cac8928e22 implement auto-recover for xmrmaker (#235) 2022-11-22 07:14:44 -05:00
noot
04cd5b4809 store swap recovery information in database, remove "infofile" (#227) 2022-11-19 10:52:15 -05:00
noot
591046e787 handle decimals of ERC20 tokens properly (#231) 2022-11-18 18:45:10 -05:00
Dmitry Holodov
ec89cd684a misc fixes (#232)
* Relayer now runs as a dedicated binary in integration tests
* Binaries are now in `bin/` folder
* Removed warnings in our github actions
* Libp2p libs updated
* Signal handling improvements
* xmrmaker instance locking fix added
2022-11-18 16:47:16 -06:00
Dmitry Holodov
bfefd3bb45 rework backend wallet interfaces (#224)
Refactored the Monero and Ethereum wallet/node sub-interfaces into a has-a relationship with the backend.
2022-11-14 18:19:20 -06:00
noot
7e44d6e7b9 add FakeDLEq; add pure go + darwin build commands (#225) 2022-11-14 16:14:10 -05:00
noot
be9888f05b implement event watcher for contract events; remove unneeded network messages (#219) 2022-11-13 14:19:37 +01:00
noot
36518eae87 persist swap info to disk (#213) 2022-11-07 14:42:35 -05:00
Dmitry Holodov
517259375e check if the domain separator is registered before registering (#221)
Code now checks if the domain separator is registered before registering.
2022-11-07 13:14:59 -06:00
Dmitry Holodov
ab82a5bc0e relay updates (#220)
* Updates to the latest go-relayer version which can be terminated by canceling the context 
* Swapd's RPC server context handling was improved
* Reformats the contracts with prettier-plugin-solidity@1.0.0-rc.1
* Adds test helper for checking/updating the goerli contract
2022-11-03 23:32:19 -05:00
Dmitry Holodov
ec325f2cf7 add linting and formatting support for solidity (#217)
* Added new `format-solidity` and `lint-solidity` Makefile targets
* Updated documentation on how to install the new tools dependencies
* Formatted the solidity code, updated expected byte code and deployed stagenet contract
* Updated go.mod to go 1.19
* Updated Github actions for go 1.19 and we now use all formatters/linters in the actions checks
2022-11-01 23:01:59 -05:00
noot
7e253a7aa1 update stagenet bootnodes (#216) 2022-10-31 21:28:09 -04:00
noot
50e1080d22 unused param fix in offer manager, fix erc20 relayer claim (#215) 2022-10-31 20:48:36 -04:00
Dmitry Holodov
cdcd4db15d monero transaction checks (#207)
* Bob now waits for his XMR transfer to the A+B wallet to have 10 confirmations before notifying Alice that the XMR is locked.
* Alice now rejects the locked Monero if there is more than one block left before she can spend the funds (1 block freedom is in case of network latency on Alice's side). This eliminates Bob's ability to double spend and allows Alice to sweep funds to her primary wallet from the A+B wallet in a reasonable time frame.
* Sweeping received XMR to the primary wallet is now the default behavior.
* A+B swap wallets are created with a restore height set for quick wallet creation in production where the blockchain is big.
* Fixes SleepWithContext moving it into the common package and having it return an error when the sleep is interrupted by the context being canceled.
* Fixed timeout and context handling in integration tests
* Added new GetChainHeight method that queries monerod instead of monero-wallet-rpc
2022-10-31 00:26:25 -05:00
Dmitry Holodov
5a0b10a9fe updated how we check the contract (#214)
* Moved the swap factory contract checking code to the `ethereum` folder. That package seemed like a better fit given that we already had utility functions in it that were not generated code.
* We track the indexes of the trusted forwarder address in the compiled byte code in exact 20 byte (address length) increments.
* `CheckSwapFactoryContractCode` verifies that the same trusted forwarder address exists at all expected locations and returns the parsed value from the deployed contract.
* Unit tests were added that explicitly help the developer update the expected contract code as well as the slice of trusted forwarder indexes.
2022-10-27 23:16:07 -05:00
noot
0bdb6f6f2a add relayer support for claim contract function (#204) 2022-10-26 23:39:20 -04:00
noot
5c32755778 re-add protocol pdf article 2022-10-11 18:24:28 -04:00
noot
a51ea4e731 implement database; persist offers to disk and reload on startup (#200) 2022-10-11 15:44:37 -04:00
Dmitry Holodov
130ed147aa removed --ethereum-chain-id flag (#201)
Removes the --ethereum-chain-id flag and updates the code to dynamically determines the chain ID using the ethereum endpoint.
2022-10-09 20:43:56 -05:00
noot
5ed5b9271b implement ERC20 integration tests (#197) 2022-10-08 11:43:58 -04:00
Dmitry Holodov
ecd91f624c monero-wallet-rpc now embedded (#192)
* Embeds monero-wallet-rpc instead of having the user start it separately.
* Location of all the files standardized and documented in docs/default-file-locations.md.
* Ethereum and Monero wallets will be created if they do not exist.
* New RPC API  personal_balances added including swapcli support.
2022-10-07 22:18:46 -05:00
noot
87357180f5 remove hardhat dependency from ethereum/ dir (#196) 2022-10-03 18:13:38 -04:00
noot
fefd270424 update cgo-dleq submodule commit, fix test errors (#195) 2022-10-03 11:14:02 -04:00
Dmitry Holodov
58d1346023 fixes for base58 encoding/decoding (#190)
* Removes the `paxosglobal/moneroutil` base58 codec
* github.com/btcsuite/btcd/btcutil/base58 now provides the base base58 codec and we layer monero specifics on top of it
* Renames `EncodeMoneroBase58`/`DecodeMoneroBase58` to `MoneroAddrBytesToBase58`/`MoneroAddrBase58ToBytes`
* Removes `github.com/ebfe/keccak"` dependency in favor of go-ethereum's Keccak256
2022-09-17 20:42:55 -05:00
Dmitry Holodov
6fcd1b8e26 match folders to exec names (#189) 2022-09-12 20:27:56 -04:00
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
noot
9e65c5890d fix: add wrapped TxOpts type (#184)
add wrapped TxOpts type to fix multiple txsender concurrency issues
2022-09-06 20:52:46 -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
a0b0545cfc implement net_queryAll method (#183) 2022-09-02 21:28:27 -04:00
noot
c1e5a58e8f update stagenet contract addr; add contract code check at startup (#181) 2022-09-01 22:43:13 -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
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