Enables additional libp2p NAT traversal features and enables nodes to communicate using UDP/QUIC in addition to TCP. Switches to using libp2p's "routed host". Most commands that previously accepted multiaddress values now accept a Peer IDs instead.
* 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
* 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.
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.
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
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>
* 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>
* 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
* 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
* 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