Compare commits

...

2067 Commits

Author SHA1 Message Date
Tommy Verrall f95e9a7d37 Implement base line for tests on the validator ts client
- This will need to be separated and configured accordingly 
- This was a quick spin up, using jest as a library to implement some coverage
- Further things to be refined - mocks, more coverage, better configuration, clean up methods, improve env vars
2022-01-06 10:01:08 +00:00
Bogdan-Ștefan Neacșu 2041b03046 Missed takes_value() call 2022-01-04 17:12:41 +01:00
Bogdan-Ștefan Neacşu 0b6adf59ce Feature/fix gateway sign (#1004)
* Include version check in sign command

* Ask for wallet address the same way as mixnode

The reason for this is that the cosmos mnemonic that is asked at
init is for the address that gets rewarded for gateway usage.
Since that address is not necessarly set now and it can take a
default value, we won't be using that to derive the address in the
signing process.
2022-01-04 13:49:24 +01:00
Jędrzej Stuczyński d95df4b286 Feature/implicit runtime (#973)
* Made mixnode runtime implicit

* Ibid for native and socks5 clients
2022-01-04 11:00:48 +00:00
Bogdan-Ștefan Neacşu 4f109169af Fix clippy (#1003) 2022-01-03 14:32:37 +01:00
Bogdan-Ștefan Neacșu 0cef1abbb2 Update mixnode version 2021-12-23 15:05:11 +02:00
Tommy Verrall 1871c6b2e3 Merge pull request #998 from nymtech/feature/wallet-update-version
Update wallet version
2021-12-23 10:01:13 +00:00
Tommy Verrall 75ad2a113f Update wallet version
- keep all the binaries aligned
2021-12-23 10:00:13 +00:00
Bogdan-Ștefan Neacşu 1d1496aa49 Make the separation between testnet-mode and erc20 bandwidth mode clearer (#994)
* Make the separation between testnet-mode and erc20 bandwidth mode more clear

* Update Cargo.toml

* Remove eth bw from native client under a feature flag

* Remove eth bw from socks5 client under a feature flag

* Remove eth bw from gateway under a feature flag

* Update gateway version

* Fix coconut build warnings
2021-12-23 11:55:01 +02:00
Tommy Verrall a48e06fe51 Fix wallet build instructions (#997)
* Fix wallet build instructions

- Supplying the .env file requirement

* re-added the admin - address
2021-12-23 11:54:34 +02:00
Drazen Urch 614b99a36e Differentiate staking and ownership (#961)
* Differentiate staking and ownership

* Ownership transfer, tests

* Consistent random keys

* Improve account tests

* Update Cargo.lock

* Make everybody happy

Co-authored-by: Drazen Urch <durch@users.noreply.guthub.com>
2021-12-22 13:22:46 +01:00
dependabot[bot] d8cb6199e0 Bump @openzeppelin/contracts in /contracts/basic-bandwidth-generation (#983)
Bumps [@openzeppelin/contracts](https://github.com/OpenZeppelin/openzeppelin-contracts) from 3.4.0 to 4.4.1.
- [Release notes](https://github.com/OpenZeppelin/openzeppelin-contracts/releases)
- [Changelog](https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/CHANGELOG.md)
- [Commits](https://github.com/OpenZeppelin/openzeppelin-contracts/compare/v3.4.0...v4.4.1)

---
updated-dependencies:
- dependency-name: "@openzeppelin/contracts"
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-12-22 11:42:37 +01:00
Tommy Verrall 424c1695b3 Merge pull request #991 from nymtech/feature/change-wallet-version
Update wallet to align with versioning on nodes and gateways
2021-12-21 11:39:12 +00:00
Tommy Verrall 3ceb6d711f Update wallet to align with versioning on nodes and gateways 2021-12-21 11:38:13 +00:00
Dave Hrycyszyn 23d2279549 Merge branch 'develop' of github.com:nymtech/nym into develop 2021-12-21 11:21:28 +00:00
Dave Hrycyszyn 84d1909b18 Changelog for v0.12.0 2021-12-21 11:21:20 +00:00
Dave Hrycyszyn 29a22e95e6 Adding github_changelog_generator config files 2021-12-21 11:21:00 +00:00
Jess 0e0f9ed270 Update README.md 2021-12-21 10:34:29 +00:00
Jess 4c0c0bc49f Update README.md 2021-12-21 10:33:32 +00:00
Tommy Verrall ea350ef7dd Merge pull request #990 from nymtech/feature/fix-success-text
Fix success view messages.
2021-12-21 10:16:41 +00:00
Bogdan-Ștefan Neacșu 112820ad7b Fix rebase going wrong 2021-12-21 12:15:07 +02:00
Tommy Verrall fe27cbe7e2 Fix success view messages. 2021-12-21 10:07:35 +00:00
Bogdan-Ștefan Neacșu bd892e00bd Switch to sandbox as default build 2021-12-21 11:16:30 +02:00
Dave Hrycyszyn 8d2863e085 Back down on caching and we're good to redeploy 2021-12-20 18:01:19 +00:00
Dave Hrycyszyn 89cb931775 Cranking caching back up 2021-12-20 17:25:29 +00:00
Dave Hrycyszyn 0f58fb6437 Cutting client-side caching from 3.5 minutes to 5 seconds 2021-12-20 16:40:26 +00:00
Dave Hrycyszyn 837575c8d3 Knocking down cache interval some more 2021-12-20 15:19:48 +00:00
Dave Hrycyszyn 4cbe789f42 Merge branch 'develop' of github.com:nymtech/nym into develop 2021-12-20 15:13:29 +00:00
Dave Hrycyszyn 822c993f24 Setting cache to 2 seconds for explorer api 2021-12-20 15:13:22 +00:00
Bogdan-Ștefan Neacşu 9480233ca3 Feature/enable signature check (#989)
* Revert "Do not set proxy only for this time"

This reverts commit 47946ad79e.

* Reinstate signature check

* Enable migrate entry point
2021-12-20 16:09:42 +02:00
Dave Hrycyszyn 72944905cd Knocking down cache validation time 2021-12-20 14:08:49 +00:00
Dave Hrycyszyn effb756e2f Setting mixnode cache refresh to 30 seconds 2021-12-20 14:07:40 +00:00
Dave Hrycyszyn 583f5083e5 Merge branch 'develop' of github.com:nymtech/nym into develop 2021-12-20 14:00:04 +00:00
Dave Hrycyszyn 941e91d250 Re-enabling owner signature form on settings page 2021-12-20 13:59:52 +00:00
Bogdan-Ștefan Neacşu 0f1b9d138e Update mixnet contract address (#988) 2021-12-20 15:52:34 +02:00
mfahampshire 265696103c updated env sample 2021-12-20 13:58:38 +01:00
Bogdan-Ștefan Neacşu 22ce25d821 Fix verloc print (#987) 2021-12-20 12:52:32 +02:00
Dave Hrycyszyn 363f784714 Changing build command to match readme 2021-12-20 10:51:47 +00:00
Dave Hrycyszyn 1f360a5a27 Knocking validator-api refresh interval to 30 seconds 2021-12-20 10:36:43 +00:00
Dave Hrycyszyn ea3f2e9beb Moving country data refresh interval 15 minutes again 2021-12-20 10:35:04 +00:00
Dave Hrycyszyn 84924133b5 Knocking down the mixnode refresh interval to 30 seconds 2021-12-20 10:30:45 +00:00
Dave Hrycyszyn 860afc9086 Removing unused signing test module 2021-12-20 09:30:36 +00:00
Dave Hrycyszyn 0aab508633 Removing Dalek stuff, jst has already built this using cw apis 2021-12-19 16:18:08 +00:00
Dave Hrycyszyn bdfce8f663 Merge branch 'develop' of github.com:nymtech/nym into develop 2021-12-19 15:55:20 +00:00
Dave Hrycyszyn b5bb09588d Fixing Cargo.lock 2021-12-19 15:55:13 +00:00
Dave Hrycyszyn 983322d273 Feature/refactor mixnet contract test helpers (#986)
* Refactored test helpers

* Renaming mixnode "bond" coins to "pledge"

* Renaming gateway "bond" coins to "pledge"

* ibid

* Commenting out new tests, they will go in next PR
2021-12-19 15:54:11 +00:00
Dave Hrycyszyn e761989c6a Making the terminology consistent between mixnode/gateway output and … (#985)
* Making the terminology consistent between mixnode/gateway output and wallet display

* [ci skip] Generate TS types
2021-12-18 13:12:10 +00:00
futurechimp bc981873ff [ci skip] Generate TS types 2021-12-18 12:54:44 +00:00
Dave Hrycyszyn 8e99ae8979 Feature/add wallet to gateway init (#984)
* Moving sign_text method into common/crypto to dry it up

* Moved bech32 address validation into common/crypto

* ibid

* Gateway now requires a --wallet-address arg on init
2021-12-18 12:45:55 +00:00
Dave Hrycyszyn ed2b515a83 Feature/add wallet address to init (#982)
* Add a --wallet-adress parameter to init

* Rearranging signing code locations

* A bit more refactoring

* ibid

* Exiting if the stored bech32 address isn't valid at node start

* A few docs comments

* Moved crypto crate up to root src level

* Friendlier startup messages for node verification code

* Switching punk and nymt addresses in test
2021-12-18 10:44:30 +00:00
Fouad aca31dbaac Feature/wallet settings area (#974)
* set up Settings component

* Update network defaults

* Short node identity signature check

Fix tests

* Do not set proxy only for this time

* Update contract addresses

* file restructure

* file updates

* add settings tab panels

* update them color for nym fee

* rework layout

* update bond form to include signature and profit percent

* create info tooltip + make status component optional

* fix overflow

* update sys vars tab

* get mixnode bond details

* use mixnode id in settings

* set up profit percentage value on sys vars tab

* profit percentage styling

* add fix for delegations list

* fix unbond UI bug

* minor style updates

* dont allow profit percent on gateway bonding

* webpack prod fix

* update profit percentage from settings area

* hardcode signature for profit percentage update

Co-authored-by: Bogdan-Ștefan Neacșu <bogdan@nymtech.net>
2021-12-18 07:54:53 +00:00
Mx f8fb6f524e Move cleaned up smart contracts to main code repo (#929)
* moved contracts from gitlab to main codebase

* added missing event param

* removed erroneous  from description

* updates:
* changed maths of token -> MB conversion
* new tests for changed maths
* length check on cosmos address
* begun code doc

* code documentation

* small comment cleanup

* cont. w tests, may have found bug in maths re: using not whole tokens: investigating

* finished code doc

* included requested changes to contract

* change to maths operations, shrunk test error to < .9

* updates:
* updated tests
* updated readme

* removed commented out code, changed variable name to be more informative

* removed unnecessary byte32 length check
2021-12-18 01:32:47 +00:00
Bogdan-Ștefan Neacşu 036369226b Bump version to 0.12.0 (#980) 2021-12-18 01:13:30 +00:00
Bogdan-Ștefan Neacşu 4972ad8c53 Feature/rename erc20 (#979)
* Rename erc20-bridge to bandwidth-claim

* Rename contract constant in network defaults
2021-12-18 01:13:11 +00:00
Dave Hrycyszyn a09581eea9 Removed web wallet (#978) 2021-12-18 01:09:57 +00:00
Tommy Verrall 4d447706fc Update message to bond mixnode (#981)
- This prevents the user navigating to the deprecated web-wallet.
2021-12-17 17:51:07 +00:00
Jędrzej Stuczyński 6c6e16035a Feature/optional bandwidth bypass (#965)
* Removed outdated constant

* ClaimFreeTestnetBandwidth ClientControlRequest

* Configuration option for the testnet mode in gateway

* Made testnet mode deserialize to default value if not present

* Fixed testnet mode override

* Testnet config options for clients and validator api

* Changed error message for when gateway is not using testnet mode

* Incorporated testnet mode into gateway client

* Activating testnet mode based on config values

* Allowing clippy warnings

* Fixed use of moved value in wasm build

Co-authored-by: Bogdan-Ștefan Neacșu <bogdan@nymtech.net>
2021-12-17 18:55:33 +02:00
Tommy Verrall 96aa814a61 Merge pull request #977 from nymtech/bugfix/network-explorer-uptime-graph
Network Explorer: fix uptime history display to use new API response
2021-12-17 14:30:04 +00:00
Mark Sinclair 1fbf437786 Network Explorer: fix uptime history display to use new API response 2021-12-17 13:41:41 +00:00
Bogdan-Ștefan Neacşu 852d12b440 Make develop branch agnostic of the network (#976)
* Make develop branch agnostic of the network

* Update network defaults

* Short node identity signature check

Fix tests

* Do not set proxy only for this time

* Update contract addresses

* Network Explorer: configure URLs with `.env` file

* Network Explorer API improvements:
- upgrade `okapi` for swagger generation across multiple resources
- switched `GET mix-node` to `GET mix-nodes`
- added error message when no geolocation env var is set and process continues

* Network Explorer improvements:
- fix up API urls after Network Explorer API changes
- set currency denominations in `.env` file
- set API endpoints in `.env` file

* Network Explorer: change prod env to round robin DNS

* Update test

Co-authored-by: Mark Sinclair <mmsinclair@gmail.com>
2021-12-17 15:36:35 +02:00
Bogdan-Ștefan Neacşu 865759254f Fix windows fmt (#975) 2021-12-17 13:23:44 +02:00
Fouad 0a30eb1c64 Merge pull request #968 from nymtech/feature/new-testnet-wallet-updates
Feature/new testnet wallet updates
2021-12-16 16:08:32 +00:00
Bogdan-Ștefan Neacşu 63bb35e1a1 Use the renamed balance function (#971) 2021-12-16 17:36:50 +02:00
Jędrzej Stuczyński c1e809fd99 Feature/ts client update (#956)
* Made client compile again + set auto fees

* Simplified client construction by allowing only a single URL

* wip

* Simplified signing assertion

* Initial implementation of queries

* Implemented all basic nymd queries

* Validator API queries

* Signing related queries

* Using default arguments

* Removed redundant else branches

* `eslint` and `prettier` formatting on Typescript validator client

* Removed cyclic import on Coin type

* Missing direct dependencies

* Ingoring cyclic imports

* Removed unused argument

Co-authored-by: Mark Sinclair <mmsinclair@gmail.com>
2021-12-16 15:35:30 +00:00
Jędrzej Stuczyński 77ab22999c Feature/node info command (#972)
* Removed code duplication and introduced node-details command for mixnode

* ibid for the gateway

* Added port information
2021-12-16 14:55:03 +00:00
Bogdan-Ștefan Neacşu 747bf85ad8 Add custom denom balance query (#957)
* Add custom denom balance query

* Apply PR comment
2021-12-16 13:59:08 +02:00
Jędrzej Stuczyński cf4eadaa6b Introduced 'version' command to all relevant binaries (#969)
* Introduced 'version' command to all relevant binaries

* Removed separate 'version' subcommand in favour of clap's 'long_version' field
2021-12-16 11:48:50 +00:00
Jędrzej Stuczyński f43f07f0b9 Fixed invalid nodes being counted twice in unroutable category (#963) 2021-12-16 10:58:57 +00:00
fmtabbara c5cf7d19a3 add sample env 2021-12-16 10:10:39 +00:00
fmtabbara 7d7911c8e8 merge develop 2021-12-16 10:09:23 +00:00
Fouad 40d93e1eeb Merge pull request #964 from nymtech/feature/bond-details-handlers
Additional tauri commands to get bond details
2021-12-15 16:53:58 +00:00
Jędrzej Stuczyński 2f472c4e8e Additional tauri commands to get bond details 2021-12-15 16:05:31 +00:00
Bogdan-Ștefan Neacşu c93f3cfc4f Fix topology log (#962) 2021-12-15 13:19:34 +02:00
Mark Sinclair 87d18bbc16 Merge pull request #960 from nymtech/feature/network-explorer-ui-config
Network Explorer: configure URLs with `.env` file
2021-12-15 10:37:47 +00:00
Mark Sinclair 45ed46afa0 Network Explorer: add prod config 2021-12-15 10:14:41 +00:00
Mark Sinclair 9619e794b2 Network Explorer: configure URLs with .env file 2021-12-14 16:06:02 +00:00
Drazen Urch 305864aa0f Feature/vesting to wallet (#954)
* Better code structure, proper error handling, VestingSigningClient for wallet

* Add vesting contract queries to wallet

* Address review comments

Co-authored-by: Drazen Urch <durch@users.noreply.guthub.com>
2021-12-14 12:25:48 +01:00
Jędrzej Stuczyński 8f152d42f0 Feature/simulate (#950)
* Raw scaffold for tx simulate

* Proper error handling in AbciResult parsing

* Simulate without actual signing operation

* Moved all-fee related functionalities to separate module

* Adding GasInfo to transaction results

* Automated gas estimation

* Slightly adjusted public API

* Using auto fees in eth events

* Removed old print statement

* Reorganised nymd client fee handling

* Put bandaid on wallet gas estimation

* Fixed operation re-export

* warning note on get_approximate_fee

* [ci skip] Generate TS types

* Refactored ProtoAbciResult parsing

* Explicit error on abci query failure

Co-authored-by: jstuczyn <jstuczyn@users.noreply.github.com>
2021-12-14 09:28:15 +00:00
fmtabbara 140cc3f769 correct profitPercent variable name 2021-12-13 21:11:12 +00:00
Drazen Urch 791d051537 Different workshare calculations for rewarded vs active set (#951)
* Add Makefile to make running all checks easier locally

* Different workshare calculation for active vs rewarded set

* Rework omega calculation, update tests

* Remove ZERO const

* unym -> DENOM

Co-authored-by: Drazen Urch <durch@users.noreply.guthub.com>
2021-12-13 19:11:54 +01:00
Jędrzej Stuczyński f8099cb8c8 Bugfix/rewarding fixes (#953)
* Improved rewarding-related log messages

* Skipping empty mixnode chunks
2021-12-13 15:43:02 +00:00
fmtabbara 2045d0bafd update new fields 2021-12-13 15:26:35 +00:00
fmtabbara e68b48f296 use config so that env vars can be destructured 2021-12-13 14:39:26 +00:00
fmtabbara 3a2b553e38 use variable for currency 2021-12-13 13:04:17 +00:00
fmtabbara aa1955dc6b update webpack configs 2021-12-13 13:03:23 +00:00
Tommy Verrall f1e995b076 Merge pull request #947 from nymtech/feature/wallet-ui-updates-round-2
Desktop Wallet UI Updates
2021-12-13 11:11:30 +00:00
Bogdan-Ștefan Neacşu ed1fe22db2 Check the response for multiple sends (#955) 2021-12-10 09:22:37 +01:00
dependabot[bot] b1c45dc0f8 Bump next from 11.1.1 to 11.1.3 in /wallet-web (#952)
Bumps [next](https://github.com/vercel/next.js) from 11.1.1 to 11.1.3.
- [Release notes](https://github.com/vercel/next.js/releases)
- [Changelog](https://github.com/vercel/next.js/blob/canary/release.js)
- [Commits](https://github.com/vercel/next.js/compare/v11.1.1...v11.1.3)

---
updated-dependencies:
- dependency-name: next
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-12-09 09:25:25 +00:00
Drazen Urch 0e0151f781 Feature/profit margin percent config (#949)
* Profit margin percent to config, fix vesting tests

* Add bonding bounds check

* Fix contract test
2021-12-08 20:17:31 +01:00
Drazen Urch 70e148b3ed Run CI for all contracts in one workflow (#948)
* Run CI for all contracts in one workflow

* Rename

* Fix vesting tests
2021-12-08 16:15:18 +01:00
fmtabbara 53138d6292 link to transaction hash 2021-12-07 22:39:13 +00:00
fmtabbara 39650de2bd style update 2021-12-07 21:46:02 +00:00
fmtabbara 7b04093cc5 style updates 2021-12-07 21:24:16 +00:00
fmtabbara a4c9a81399 refresh balance on balance page visit 2021-12-07 21:06:29 +00:00
Drazen Urch f42f76901a Add VestingExecute and VestingQuery client traits (#944)
* Add VestingExecute and VestingQuery client traits

* cover ed25519 verification

* cargo fmt

* `Unix` newline-style

* Remove newline force

Co-authored-by: Drazen Urch <durch@users.noreply.guthub.com>
2021-12-07 19:56:10 +01:00
fmtabbara 875bcb4e63 update bonding success UI 2021-12-07 13:42:23 +00:00
fmtabbara fa62de5bc6 undelegate page update 2021-12-07 13:17:46 +00:00
fmtabbara 5c3b08e1cd update delegate page 2021-12-07 12:36:21 +00:00
Tommy Verrall 745af89019 Merge pull request #946 from nymtech/feature/docker-updates
Docker updates
2021-12-07 11:53:37 +00:00
Tommy Verrall eb0fb90127 update arg for commit hash 2021-12-07 11:45:46 +00:00
Tommy Verrall 527d5a5d9b update 2021-12-07 11:25:03 +00:00
Tommy Verrall 2dfa0a9d2a update 2021-12-07 11:23:44 +00:00
Tommy Verrall d9bfa4562e Update docker-files
- updated the network explorer
- updated new vesting contract
- updated the version of comos-sdk to be used
2021-12-07 11:22:57 +00:00
Jędrzej Stuczyński aec0239d87 Removed reliance on cosmrs fork (#943)
* Removed reliance on cosmrs fork

* Removed the accidental optional flag on cosmrs import in the wallet
2021-12-07 11:04:32 +00:00
Jędrzej Stuczyński a2324f98f8 Feature/identity verification (#930)
* Base58 representation of ed25519 signature

* Helper for verifying ed25519 signature on sender address

* Signature verification for gateway bonding

* Signature verification for mixnode bonding

* Added owner signatures for bonding in vesting contract

* Fixed choosing mixnode layer test

* Added owner signature fields to nymd client for bonding

* 'Updated' tauri wallet with new bond requirements

* Mixnode sign command with extra address validation

* Sign command for the gateway

* Signing own gateway's address derived with known mnemonic in not(coconut) case

* Fixed imports post-merge
2021-12-07 10:28:44 +00:00
fmtabbara 001d166477 update bond page 2021-12-07 10:23:37 +00:00
fmtabbara bb14e95e61 update send page 2021-12-06 17:32:29 +00:00
Jędrzej Stuczyński 5aa1c29409 Feature/terminology update (#941)
* Corrected used bond/pledge terminology

* ibid for the wallet and explorer

* [ci skip] Generate TS types

Co-authored-by: jstuczyn <jstuczyn@users.noreply.github.com>
2021-12-06 16:30:55 +00:00
Bogdan-Ștefan Neacşu db111490b6 Check the response for other transactions as well (#937) 2021-12-06 17:21:11 +01:00
Jędrzej Stuczyński fe0bb007c9 Don't reset total delegation on mixnode rebond (#940) 2021-12-06 17:20:41 +01:00
Tommy Verrall ddad6d73db Merge pull request #934 from nymtech/feature/client_on_behalf
Feature/client on behalf
2021-12-06 15:33:24 +00:00
fmtabbara 35c04014e5 undo hard-coded data 2021-12-06 15:32:09 +00:00
fmtabbara 138daddfed add custom nav icons 2021-12-06 15:21:34 +00:00
fmtabbara ab3cfe79bc use svgs as React components with svgr 2021-12-06 12:57:46 +00:00
fmtabbara 9fcf3105e0 balance page updates 2021-12-06 10:41:41 +00:00
fmtabbara 51bf117007 fix memory leak 2021-12-06 10:24:44 +00:00
Jędrzej Stuczyński a04d4503b5 Feature/pre cosmrs updates (#935)
* Updated nymd client

* Fixed contract upload and initialisation

* Increased default contract upload fee

* [ci skip] Generate TS types

Co-authored-by: jstuczyn <jstuczyn@users.noreply.github.com>
2021-12-06 09:25:53 +00:00
neacsu 9fb44f9672 [ci skip] Generate TS types 2021-12-03 18:16:55 +00:00
Bogdan-Ștefan Neacșu f542c28e89 Batching for sends 2021-12-03 19:05:21 +01:00
Bogdan-Ștefan Neacșu b809eb6c5f Batch delegations on behalf as well 2021-12-03 16:06:23 +01:00
Bogdan-Ștefan Neacșu 51e82fe930 Add gateway bond on behalf functions 2021-12-03 15:25:47 +01:00
Bogdan-Ștefan Neacșu 67f847e674 Add batched delegated mixnode bonds 2021-12-03 15:02:39 +01:00
Bogdan-Ștefan Neacșu d4736bac27 Fix gas for operations 2021-12-03 15:02:19 +01:00
Bogdan-Ștefan Neacșu 6417feaaed Fix clippy 2021-12-03 15:02:19 +01:00
Bogdan-Ștefan Neacșu 718170c651 Update tauri client 2021-12-03 15:02:19 +01:00
Bogdan-Ștefan Neacșu c10038e688 Add client-side Operations as well, in case fees need to be modified 2021-12-03 15:02:19 +01:00
Bogdan-Ștefan Neacșu 2f68439916 Unbond/undelegate mixnode with rust client 2021-12-03 15:02:19 +01:00
Bogdan-Ștefan Neacșu b175480ba5 Bond/delegate mixnode with rust client 2021-12-03 15:02:19 +01:00
Bogdan-Ștefan Neacșu 34c9726ac9 Add vesting contract address to validator client library 2021-12-03 15:02:19 +01:00
Bogdan-Ștefan Neacșu 11b2a7ad3d Rename contract_address to mixnet_contract_address 2021-12-03 15:02:19 +01:00
Drazen Urch 18978c7599 Merge branch 'develop' of https://github.com/nymtech/nym into develop 2021-12-03 10:14:59 +01:00
Drazen Urch 8e52a70685 Update vesting image 2021-12-03 10:14:47 +01:00
Drazen Urch 1f42ce57e3 Allow proxy gateway bonding (#936)
* Allow proxy gateway bonding

* Update msg text

Co-authored-by: Drazen Urch <durch@users.noreply.guthub.com>
2021-12-02 18:16:26 +01:00
Dave Hrycyszyn 231fba34bc Spelling fix in variable name 2021-12-02 13:15:55 +00:00
Dave Hrycyszyn 0e05fc46c9 Merge remote-tracking branch 'origin/develop' into develop 2021-12-02 13:13:24 +00:00
Dave Hrycyszyn 52777efc53 Tiny spellcheck fix in comment 2021-12-02 13:13:03 +00:00
Jędrzej Stuczyński 54bc198885 Feature/mixnet contract further adjustments (#928)
* Upgraded code to be cosmwasm 1.0-beta.2 compatible (#923)

* Upgraded code to be cosmwasm 1.0-beta.2 compatible

* [ci skip] Generate TS types

Co-authored-by: jstuczyn <jstuczyn@users.noreply.github.com>

* Feature/cosmwasm plus storage (#924)

* Upgraded code to be cosmwasm 1.0-beta.2 compatible

* Added cw-storage-plus dependency

* Experimentally replaced storage for config and layers with cw plus Item

* The same for main mixnode storage

* Usingn IndexedMap for mixnodes

* Split delegations from mixnodes into separate module

* MixnodeIndex on Addr directly

* Moved namespace values to constants

* Outdated comment

* [ci skip] Generate TS types

* Removed redundant identity index on mixnodes

* IndexMap for gateways storage

* Moved total delegation into a Map

* Compiling contract code after delegation storage upgrades

Tests dont compile yet and neither, I would assume, the client code

* Delegation type cleanup

* Client fixes

* Migrated delegation tests + fixed them

* Moved Rewarding Status to rewards

* Reward pool

* Rewarding status migrated

* Made clippy happier

* Added explorer API to default workspace members

* Updated delegation types in explorer-api

* Fixed tauri wallet

Co-authored-by: jstuczyn <jstuczyn@users.noreply.github.com>

* Missing license notices

* Dead code removal

* Changed RewardMixnodeV2 to RewardMixnode

* Adjusted module visibility

* Setting rewarding validator address in init msg

* ContractSettings => ContractState

* Transaction-related cleanup

* Changed ownership queries to return full bond information instead of just a bool

* Function for updating post rewarding storage

* Changed the order of arguments in decrementing reward pool

* Helpers for updating storage after rewarding

* Removed redundant turbofish

* [ci skip] Generate TS types

* Changed bond/delegation validation

* Made clippy happier

Co-authored-by: jstuczyn <jstuczyn@users.noreply.github.com>
2021-12-02 12:16:16 +00:00
Tommy Verrall 577c5dc1ee Merge pull request #933 from nymtech/test/webpack-wallet
Webpack wallet prod configuration
2021-12-02 10:16:51 +00:00
Dave Hrycyszyn 7927846390 Merge branch 'develop' of github.com:nymtech/nym into develop 2021-12-02 10:12:09 +00:00
Dave Hrycyszyn e41f02ad0d Tiny readme fixup 2021-12-02 10:12:01 +00:00
tommyv1987 e57a5b73a2 [ci skip] Generate TS types 2021-12-02 09:54:58 +00:00
Tommy Verrall 608de11377 Merge pull request #932 from nymtech/feature/add-tx-hash-to-wallet-result
Adding tx_hash to wallet response
2021-12-02 09:44:54 +00:00
futurechimp b88153a2bd [ci skip] Generate TS types 2021-12-01 18:30:05 +00:00
Tommy Verrall 0fd2f946dc dev 2021-12-01 18:23:46 +00:00
Dave Hrycyszyn c5cdbd5bfe Params formatting 2021-12-01 18:23:11 +00:00
Tommy Verrall 3c05cf29e6 fix duplication 2021-12-01 18:22:07 +00:00
futurechimp 6cb58d1f1c Adding tx_hash to wallet response 2021-12-01 18:19:14 +00:00
Tommy Verrall 5727ac5161 minor changes, due to windows complaining on builds. 2021-12-01 18:00:47 +00:00
Tommy Verrall 804f254e16 Compiler complains...
The compiler complains, however, these references are needed to enabled menu actions on mac builds.
2021-12-01 17:30:54 +00:00
Tommy Verrall f03ce6e07b fix typo 2021-12-01 17:11:23 +00:00
Tommy Verrall 2631ed4d0c Add prod config for the wallet
When supplying `production` as the mode in the config for webpack, it complains about an unmet dependency issue with fav-icons. Then trying to supply a favicon.ico, returns a mimetype error. By using a png in alignment to the .ico. It builds. Tested on Linux.
2021-12-01 17:06:47 +00:00
Tommy Verrall 0f93dde8fc Merge pull request #925 from nymtech/feature/ui-enhancements
Feature/UI enhancements for Desktop Wallet
2021-12-01 14:47:21 +00:00
Drazen Urch eb93b428cf Release/1.0.0 pre1 (#931)
* Upgraded code to be cosmwasm 1.0-beta.2 compatible (#923)

* Upgraded code to be cosmwasm 1.0-beta.2 compatible

* [ci skip] Generate TS types

Co-authored-by: jstuczyn <jstuczyn@users.noreply.github.com>

* Feature/cosmwasm plus storage (#924)

* Upgraded code to be cosmwasm 1.0-beta.2 compatible

* Added cw-storage-plus dependency

* Experimentally replaced storage for config and layers with cw plus Item

* The same for main mixnode storage

* Usingn IndexedMap for mixnodes

* Split delegations from mixnodes into separate module

* MixnodeIndex on Addr directly

* Moved namespace values to constants

* Outdated comment

* [ci skip] Generate TS types

* Removed redundant identity index on mixnodes

* IndexMap for gateways storage

* Moved total delegation into a Map

* Compiling contract code after delegation storage upgrades

Tests dont compile yet and neither, I would assume, the client code

* Delegation type cleanup

* Client fixes

* Migrated delegation tests + fixed them

* Moved Rewarding Status to rewards

* Reward pool

* Rewarding status migrated

* Made clippy happier

* Added explorer API to default workspace members

* Updated delegation types in explorer-api

* Fixed tauri wallet

Co-authored-by: jstuczyn <jstuczyn@users.noreply.github.com>

* Vesting contract (#900)

* Initial interface spec

* .gitignore

* Finalize implementation

* Correct assumptions, use wasm_execute

* Cleanup

* Track delegation balance

* Add delegation flow img

* Proper messaging from the vesting side

* Add proxy_address to RawDelegationData

* Wrap up (un)delegation

* Add proxy: Addr to MixNodeBond

* Stub in bonding/unbonding

* Migrate vesting to cosmwasm 1.0

* Rebase on top of 1.0.0-pre1

* Reimplement delegations tracking with a Map

* Migrate to cw-storage-plus

* Restructure code, add tests

* Streamline contract code, as per review

* Address review comments

* Pre-merge rebase

* Few more nits

* Few more nits

* Fix test

* cargo fmt

* Fix beta CI

Co-authored-by: Drazen Urch <durch@users.noreply.guthub.com>

Co-authored-by: Jędrzej Stuczyński <jedrzej.stuczynski@gmail.com>
Co-authored-by: jstuczyn <jstuczyn@users.noreply.github.com>
Co-authored-by: Drazen Urch <durch@users.noreply.guthub.com>
2021-12-01 15:42:34 +01:00
fmtabbara 04b6f83d99 pr updates 2021-12-01 12:35:41 +00:00
fmtabbara f5612cc64b update large button height 2021-11-30 13:39:51 +00:00
fmtabbara d525563a46 link to block explorer 2021-11-30 13:11:51 +00:00
fmtabbara 560b306d32 update admin nav item style 2021-11-30 10:08:29 +00:00
fmtabbara a4a4da1121 style updates 2021-11-29 22:31:11 +00:00
fmtabbara d69cb47c6c style updates 2021-11-29 22:11:28 +00:00
Aid19801 3e93b4ffd5 Merge pull request #926 from nymtech/copy-change-nodemap
typo copy change for nodemap
2021-11-29 13:15:22 +00:00
Aid Thompson 6da660623b typo copy change for nodemap 2021-11-29 13:09:13 +00:00
fmtabbara a85a67199a theme tweaks 2021-11-29 09:52:00 +00:00
fmtabbara 09b6d37ca6 [ci skip] Generate TS types 2021-11-27 22:59:48 +00:00
fmtabbara 4029b1b830 resolve conflict 2021-11-27 22:50:13 +00:00
fmtabbara e075759461 add tooltip hide delay 2021-11-27 22:36:16 +00:00
fmtabbara 1069032cd7 remove unecessary fullscreen property 2021-11-27 22:29:17 +00:00
fmtabbara b97b7410da update balance page 2021-11-27 22:15:57 +00:00
fmtabbara f259012faf update copy component 2021-11-27 22:15:42 +00:00
fmtabbara c00cdafc8c update getBalance hook name 2021-11-27 22:15:13 +00:00
fmtabbara 82c56351de add appbar component 2021-11-27 22:14:04 +00:00
Dave Hrycyszyn 5eeb55aa78 Fixing some clippy warnings (#922)
Co-authored-by: dave <dave@nym-mbp.lan>
2021-11-26 12:51:41 +00:00
Dave Hrycyszyn 94357c6132 Fixing go warning re unused btc lib (#921)
* Fixing go warning re unused btc lib

* Removed commented code

Co-authored-by: dave <dave@nym-mbp.lan>
2021-11-26 12:51:01 +00:00
Mark Sinclair 77c5296c39 testnet-faucet: fix line break in destructuring 2021-11-26 11:57:37 +00:00
Aid19801 6ee5b68b46 Merge pull request #920 from nymtech/nodemap-responsiveness
quick fix adding dimensions to nodemap page for consistency
2021-11-26 10:47:40 +00:00
Aid Thompson 56fa48215b changed country names from official to their aliases to fit in cells 2021-11-26 10:15:59 +00:00
Aid Thompson 26b0d9555f quick fix adding dimensions to nodemap page for consistency 2021-11-26 07:41:58 +00:00
fmtabbara 61a67ac334 add new sign in and create account pages 2021-11-25 23:22:14 +00:00
fmtabbara c2e268a1c9 update app layout to use mui v5 system 2021-11-25 23:21:19 +00:00
fmtabbara cfd0b7868a refine copytoclipboard component 2021-11-25 17:41:35 +00:00
fmtabbara 69b52ae629 new styling + new signin and create account pages 2021-11-25 17:41:15 +00:00
Jędrzej Stuczyński c361de62a5 Introduces query for contract build information (#919)
* Introduces query for contract build information

* Removed temporary test garbage

* Removed unused imports in validator-client if built without nymd-client feature
2021-11-25 15:17:56 +00:00
fmtabbara 7d3d0d8874 upgrade to mui v5 2021-11-25 14:35:26 +00:00
Jędrzej Stuczyński 39c7b131b6 Bugfix/remove mixnode bonding overwrite (#917)
* Disallow double bonding

* Adjusted test assertions
2021-11-25 10:27:31 +00:00
dependabot[bot] 4071a20bb5 Bump nth-check from 2.0.0 to 2.0.1 in /nym-wallet (#918)
Bumps [nth-check](https://github.com/fb55/nth-check) from 2.0.0 to 2.0.1.
- [Release notes](https://github.com/fb55/nth-check/releases)
- [Commits](https://github.com/fb55/nth-check/compare/v2.0.0...v2.0.1)

---
updated-dependencies:
- dependency-name: nth-check
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-11-25 10:16:14 +00:00
Tommy Verrall b4519cd77e Merge pull request #911 from nymtech/feature/faucet-page-react
Feature/faucet page react
2021-11-25 09:59:54 +00:00
Dave Hrycyszyn 35748e07c4 Feature/mixnet contract refactor (#910)
* Starting a refactor to cut the huge files into chunks

* Fixing some lints

* ibid

* Mixnode and gateway bonding tests moved

* All transaction test moved into submodules

* Finished splitting out transactions.rs from root into submodules.

* Moved mixnet params state into submodule

* Recombined modules for few top-level actions

* Moving mixnode bonding queries into their own file

* Removed some unused imports

* Got tests running again. Max limit tests not right.

* Fixed tests

* Started moving delegation queries into own module

* Finished moving delegation queries into their own module

* Cleanup

* Moving query limits into relevant modules

* Putting query limits back at top-level

* Using prefix to make storage usage a little more explicit

* Separating storage into smaller chunks

* More storage refactoring

* Finished moving all storage into modules

* Moved all storage prefixes into relevant modules and made them not-public

* Renamed the mostly-empty queries module to query_support

* ibid

* Fixed query support rename problems

* Started to move rewards-related helpers into their own module

* Started moving delegations-related helpers into their own module

* Moved more code from global helpers into delegations helpers

* Moved all remaining test helper code from main helpers file into test helpers

* Made use of test_helpers explicit via a module rename.

Also got rid of non-explicit usages

* Moved mixnode storage retrieval limits into mixnodes storage module

* Moved bond retrieval max limit into storage moduel

* Moved more storage limits into mixnodes storage file; fixed a gateways limit test.

* Added a note on gateways limits constants

I'll re-use the mixnodes values, but it doesn't have to be this way.

We could easily make a specific constant for gateways instaed.

* Renamed "state" to GlobalContractParams

* Pulled bit of test helper code up a level

* Small cleanup of zero spacing in constants

* Made a local helper method private

* Renaming GlobalContractParams to ContractSettings and StateParams to ContractSettingsParams

* ibid

* Renamed contract settings storage methods from "config" (which is a bit vage to "contract_settings"

* Indulging a fullword as a personal protest vs the Go programming language

* Renaming mixnet settings to mixnet contract settings

* Making validate_mixnode_bond private and moving it downwards in the file

* Moving gateway bond validation to the bottom of the tests file

* Getting the wallet compiling again.

* Updated TypeScript client with new types and contract method names

* Updating rust validator client with new contract method names and types

* Fixed type error in mixnet-contract shared msg.

* Used new contract method names and types

* Fixed warnings in non-test code

* All tests compiling

But not passing yet

* Fixed test compilation warnings

* Fixed tests

* Test-locked Delegations struct

Co-authored-by: dave <dave@nym-mbp.lan>
Co-authored-by: Jędrzej Stuczyński <jedrzej.stuczynski@gmail.com>
2021-11-24 22:14:38 +00:00
Aid19801 c8f2548090 Merge pull request #915 from nymtech/fix-mob-datagrids
Fix Mobile View for MUI data-grid (CARD 108)
2021-11-24 13:28:36 +00:00
Aid Thompson 62f20a905e Alignment on Overview page 2021-11-24 10:45:54 +00:00
Jędrzej Stuczyński a3dd94507a Feature/total delegation bucket (#913)
* Preliminary attempt at creating StoredMixnodeBond

* Fixed tests

* Removed dead code

* Moved StoredMixnodeBond to storage.rs

* Removed redundant clone
2021-11-23 16:36:48 +00:00
Aid Thompson dd36b329d5 renamed back to universal-datagrid 2021-11-23 16:03:39 +00:00
Aid Thompson 581af4a295 gateways page performant 2021-11-23 15:49:05 +00:00
Jędrzej Stuczyński 085761a9fb Feature/batch delegator rewarding (#898)
* Unnrolled the loop into separate function

* Ugly way of saving rewarding status

* Initial way of rewarding next page of delegators

* Attribute passing

* Promoted transactions to directory

* Moved rewarding-related functionalities into separate file

* [ci skip] Generate TS types

* Better errors on double rewarding attempt

* Removed old rewarding call

* Test fixes

* Some cleanup

* Paged mixnode rewarding test + serde fixes

* Tests for delegator rewarding

* ExecuteMsg for MixDelegatorRewarding

* Made validator-api code compliable

with bunch of todo!() macros

* Removed Option wrapper from params in MixnodeToReward

* Calculating uptime for entire epoch

* Created shared MIXNODE_DELEGATORS_PAGE_LIMIT constant

* Using new rewarding messages in validator API

* cargo fmt

* Updated wallet state types

* Additional test for correct rewarding information

* Query for rewarding status

* Additional test regarding delegator rewarding

* Client methods for obtaining rewarding status

* Validator API checking for full rewarding

* Removed unused field from validator api config template

* Waiting for MINIMUM number of test routes

* Waiting initialisation_backoff in the early return case

* Fixes crash condition in validator API when calculating last day uptime

* Fixed typo

* Dealing with the case of rewarding mixnode with 0 uptime

* Removed temporary unwrap

* Guarding against 0-size rewarded/active sets

Co-authored-by: jstuczyn <jstuczyn@users.noreply.github.com>
2021-11-23 15:36:20 +00:00
Aid Thompson 58537224df mixnode datagrid performant 2021-11-23 15:20:23 +00:00
fmtabbara 54e217ccea update logic 2021-11-23 15:01:05 +00:00
Jędrzej Stuczyński 78a5dbbf05 Fixes crash condition in validator API when calculating last day uptime (#909) 2021-11-23 14:47:49 +00:00
fmtabbara c8f81d118b fix bug with successful response ui 2021-11-23 12:16:07 +00:00
fmtabbara a193e948e6 link address to block explorer + refresh balance after tokens sent 2021-11-23 11:34:05 +00:00
AniaPiotrowska ab7f24dc1f Merge pull request #837 from nymtech/feature/vouchers
Feature/vouchers
2021-11-22 19:34:58 +00:00
fmtabbara cc77f6e392 add favicon 2021-11-22 14:48:37 +00:00
Tommy Verrall 58f02109be Add data-testids 2021-11-22 11:00:20 +00:00
Fouad 724e0f78c6 Update README.md 2021-11-20 21:27:07 +00:00
fmtabbara d764b11122 responsive tweaks 2021-11-20 21:24:30 +00:00
fmtabbara 4953b40a42 add readme file 2021-11-20 21:12:06 +00:00
fmtabbara 66e5afe485 add form validation and error handling 2021-11-20 21:04:44 +00:00
fmtabbara 9b17a1ca77 add responses 2021-11-19 22:46:32 +00:00
fmtabbara 5ce6147839 set up validator connection 2021-11-19 18:49:52 +00:00
fmtabbara dd3643a1bb set up form ui 2021-11-19 17:41:21 +00:00
fmtabbara 52fedd9866 create base project 2021-11-19 16:27:45 +00:00
Jędrzej Stuczyński 289605f36b Bugfix/monitor initial values wait (#907)
* Waiting for MINIMUM number of test routes

* Waiting initialisation_backoff in the early return case
2021-11-18 17:16:15 +00:00
Tommy Verrall 4f6bf3423b Merge pull request #905 from nymtech/update/readme
Update README.md
2021-11-18 09:59:55 +00:00
Tommy Verrall 04a32156d4 Merge pull request #891 from nymtech/update/remove-gateway-delegations
remove delegation and undelegation from gateways
2021-11-18 09:42:34 +00:00
Tommy Verrall 427880d23f Merge pull request #896 from nymtech/bug-fix/macos-keyboard-shortcuts
Bug fix/macos keyboard shortcuts
2021-11-18 09:22:33 +00:00
Tommy Verrall a5e47dead8 Update readme
. If `Webview2` is not installed on Windows, that app will not launch correctly. There's two ways to update if you're running on an older version of windows. 
- Update the Edge browser in your current OS
- Update via the installer now provided in the README documentation.
2021-11-18 09:18:04 +00:00
Tommy Verrall 297b7b2355 Merge pull request #904 from nymtech/bug-bond-denom
BUG: Bond cell denom
2021-11-17 12:30:45 +00:00
Tommy Verrall d7f3abfe7d Merge pull request #903 from nymtech/test/fix-detail-tables
Explorer UI tests missing data-testid
2021-11-17 12:29:34 +00:00
Aid Thompson 234952a6bb removed typo 2021-11-17 11:50:03 +00:00
Tommy Verrall 930561faf5 Explorer UI tests
. This `data-testid` was missing and is needed after changes to DataGrid into MUI-Table
2021-11-17 11:20:43 +00:00
Tommy Verrall 17507bc8c5 Merge pull request #899 from nymtech/test/wallet-readme-fix
Fix up Nym-Wallet README.md
2021-11-16 14:17:15 +00:00
Tommy Verrall 12f8e453ea Fix typo. 2021-11-16 10:20:50 +00:00
Tommy Verrall 97ef024b8a Fix up Nym-Wallet README.md
. Provide a descriptive overview
. Remove old references
2021-11-16 10:17:30 +00:00
Aid19801 3dc94223ae Bug mapp nodemap (#897)
* desktop onMouseEnter and leave handlers added

* clicking nav option closes drawer

* All AC met

* removed dead bool

* added hamburger to AppBar for mobile users small refactor

* nuts and bolts working needs a lot of tidying though

* Functionally complete.

* change hardcode colors to theming

* UI theme and border changes

* bug fix removed collapse nav flicker

* dead code

* resetting drawer to closed onload

* removal of hardcoded color

* made null functions into optional props

* Nested sx styling not global

* paperprops now working

* fixed breaking changes for DataGrid

* linting fix

* linting fix

* optional chaining for nodemap search

* leaner filter func

Co-authored-by: Aid Thompson <adrian@nymtech.net>
2021-11-12 18:22:03 +00:00
Aid19801 50cd18a926 Add a Mobile Nav to the Network Explorer (#895)
* desktop onMouseEnter and leave handlers added

* clicking nav option closes drawer

* All AC met

* removed dead bool

* added hamburger to AppBar for mobile users small refactor

* nuts and bolts working needs a lot of tidying though

* Functionally complete.

* change hardcode colors to theming

* UI theme and border changes

* bug fix removed collapse nav flicker

* dead code

* resetting drawer to closed onload

* removal of hardcoded color

* made null functions into optional props

* Nested sx styling not global

* paperprops now working

* fixed breaking changes for DataGrid

* linting fix

* linting fix

Co-authored-by: Aid Thompson <adrian@nymtech.net>
2021-11-12 16:14:37 +00:00
Tommy e5051f98c5 Adding a few more menu options 2021-11-12 11:23:36 +00:00
fmtabbara 2f69958e21 macos keyboard shortcut fix 2021-11-12 10:29:49 +00:00
fmtabbara d427591a66 dont commite dist folder contents 2021-11-12 10:29:33 +00:00
fmtabbara 0257c42ee9 update tauri bundle identifier 2021-11-12 10:29:04 +00:00
fmtabbara 8ebfc72da8 remove contents of dist folder 2021-11-12 10:28:39 +00:00
Aid19801 897d51cba0 Change MixnodeDetail page's datagrid into a reuseable table component (#887)
* basic table working

* broken out into sep component

* table is more dynamic now

* linting fixes

* Added types for Columns

* hangover from eslint work moving to diff PR

* Changed To DetailTable

* Killed unused flex val in Columns

* merge conflicts resolved

Co-authored-by: Aid Thompson <adrian@nymtech.net>
2021-11-12 10:28:12 +00:00
Tommy Verrall 1f1d91bd1e Adding data-test-ids for the explorer (#885)
* Adding all the data-test-ids

Test ID's for doing automation on explorer

* Applied lint-fix

Linting

* More data ids
2021-11-11 15:31:30 +00:00
Mark Sinclair 9d63a30b07 Merge pull request #890 from nymtech/feature/nym-wallet-rename
Feature/nym wallet rename
2021-11-11 15:00:55 +00:00
Tommy 5b22b1c298 getting branch up to date with tauri changes and webriver changes 2021-11-11 11:02:39 +00:00
Dave Hrycyszyn 0302d9ae5d Merge branch 'feature/nym-wallet-rename' of github.com:nymtech/nym into feature/nym-wallet-rename 2021-11-11 10:50:12 +00:00
Bogdan-Ștefan Neacşu eb6949528a Fix network monitor template (#892) 2021-11-11 10:36:43 +00:00
Mark Sinclair 41b77c3ad5 Merge pull request #894 from nymtech/feature-gate-ts-rs
Only use ts-rs in tests
2021-11-11 10:34:04 +00:00
Mark Sinclair 2f78f5eb26 Merge pull request #884 from nymtech/test/fix-gh-action
Fix path for github action running tauri-wallet-tests
2021-11-11 10:33:02 +00:00
Dave Hrycyszyn cdbd731f10 Changed all workflow references to nym-wallet 2021-11-11 10:25:51 +01:00
Dave Hrycyszyn 5cb4949d46 Renaming tauri-wallet to nym-wallet
Hopefully this will make it a bit clearer as to what people should
compile if they want the wallet.
2021-11-11 10:25:51 +01:00
Mark Sinclair 9ec0b30812 GitHub Actions: move explorer actions to k8s hosted runners 2021-11-10 16:08:15 +00:00
Jędrzej Stuczyński 7e1cf2f105 Feature/rewarding interval updates (#880)
* Introduced rewarding_interval_nonce to contract state

* Queries for ibid.

* Mixnode demanded set size

* Routes for obtaining demanded/active mixnode sets

* Testing only demanded nodes

* Typo

* Initial state

* Feature-locking unused imports

* Generating pseudorandom (with deterministic seed) demanded mixnodes set

* cargo fmt

* Fixed tauri state

* Renamed network monitor address to the rewarding validator

* [ci skip] Generate TS types

* Notice for the future

* Transactions to begin/finish mixnode rewarding + double rewarding protection

* Validator API using new contract calls

* Removed dead code from an old experiment

* [ci skip] Generate TS types

* Removed unused import

* Renamed 'demanded' set to 'rewarded' set

* Some renaming action

* [ci skip] Generate TS types

* Fixed post-merge dependency issue in tests

* Post merge test fix

Co-authored-by: jstuczyn <jstuczyn@users.noreply.github.com>
2021-11-10 15:28:16 +00:00
Mark Sinclair 04636a569a GitHub Actions: fix up reference to action 2021-11-10 15:24:47 +00:00
Mark Sinclair 52f5b980a4 GitHub Actions: use dynamic matrix for os types and rust versions 2021-11-10 15:15:31 +00:00
Mark Sinclair 0e4f833715 GitHub Actions: fix up 2021-11-10 14:44:52 +00:00
Mark Sinclair d22914c4dc GitHub Actions: fix up 2021-11-10 14:43:32 +00:00
Mark Sinclair 7d506e6e2a Slim down GitHub Actions 2021-11-10 14:34:02 +00:00
Drazen Urch c7007de1ea Only use ts-rs in tests 2021-11-10 15:02:59 +01:00
Bogdan-Ștefan Neacşu 10bf70b22b Feature/bandwidth token (#832)
* Remove check for bandwidth for incoming packets

We should only accunt for packets that the client inputs to the mixnet

* Introduce BandwidthController for both types of bandwidth creds

* Add some non-coconut token bandwidth handling

* Use thiserror for gateway-client lib

* Add error handling

* Unable to build for wasm for now

* Fix wasm strange error

* Disable non-coconut credentials for wasm client

* Check for status and throw the error up

* Send encrypted token cred from client

* Gateway receive message and signature validation

* Put the correct amount of tokens that were burned

* [ci skip] Generate TS types

* Eth endpoint and secret key as config parameters

* Add eth_endpoint config argument for gateway

* Update test as well

* Separate panicable code from the safe one

* Move some bandwidth controller panics up the call stack

* Save contract corresponding to the eth endpoint

* Fix template

* Pass the web3 interface as well

* Made event reads possible in gateway

* Add checks for event data

* Cosmos contract for double spending prevention

* Add workflow for the new contract

* Add validator rest URL to config

* Rename eth_events to erc20_bridge

* Pass cosmos mnemonic as well, and put the nymd client in ERC20Bridge

* Call cosmos contract for final verification

* Ask for config parameters in cli

* Fix various stuff

* Increase timeout to allow gateway to check the two chains

* Put some logs for the new flow

* Set consumed bandwidth invariantly of coconut feature

* Fix clippy error

* Add non-coconut checks

* Use 2018 rust instead of 2021

* More verbose nymd error

* Explicitly specify TOKENS_TO_BURN constant

* Put eth burn function in a constant

* Replace to_vec & append with iter & chain

* Test for (de)serialization of TokenCredential

* Minor rename

* Separate credential creation from bandwidth claiming

* Switch from panics to errors when claiming coconut bandwidth

* Another append changed to chain

* Update QA cosmos contract address

* Simplify build/test/clippy separation on coconut feature

* Fix bad features arg positioning

* Use the start_after in cosmos contract query

* Set a limit in line with a range on cosmos queries

* Added unit tests for new cosmos contract

* Fix bandwidth_remaining comparation

* Get remaining bandwidth from gateway

* Add contract build flag

* Add a useful info log

* Use a more robust eth depth for release builds

* Include recipt logs in error message

* Fix clippy for tests

* Use Arc instead of clone

* Rename as_bytes to to_bytes

* Make signature verification in contract more verbose

* Missed rename of paging constant

* Fix gateway start with coconut enabled

* Rename function to claim_token

* Simplify nymd client setup

* Check with block buffer on gateway as well

* Update comment of double spending protection

* Correct contract address

* Backup the keypairs used for buying tokens, in case of error cases

* Don't take any chances with the gateway timeout

* [ci skip] Generate TS types

* Updated cosmos contract to latest QA address

* Add cli options for eth

* Update network monitor timeout value as well

Co-authored-by: neacsu <neacsu@users.noreply.github.com>
2021-11-10 14:53:56 +02:00
Jędrzej Stuczyński d952f3233a Active sets => Rewarded + Active/Idle sets (#864)
* Introduced rewarding_interval_nonce to contract state

* Queries for ibid.

* Mixnode demanded set size

* Routes for obtaining demanded/active mixnode sets

* Testing only demanded nodes

* Typo

* Initial state

* Feature-locking unused imports

* Generating pseudorandom (with deterministic seed) demanded mixnodes set

* cargo fmt

* Fixed tauri state

* [ci skip] Generate TS types

* Renamed 'demanded' set to 'rewarded' set

* Some renaming action

* [ci skip] Generate TS types

* Fixed post-merge dependency issue in tests

Co-authored-by: jstuczyn <jstuczyn@users.noreply.github.com>
2021-11-10 12:52:13 +00:00
fmtabbara b1178b7ad5 remove delegation and undelegation from gateways 2021-11-10 10:42:45 +00:00
Jędrzej Stuczyński af4ac1b7c9 Reverted gateway registration handshake to its 0.11.0 version (#882) 2021-11-10 11:16:39 +01:00
Drazen Urch eae4276381 Tokenomics rewards (#802)
* Initial analysis

* Implement core rewards distribution

* Tests and refactoring for better testability

* Feature gate ts-rs in mixnet-contract

* No more floats

* Fix performance calculation

* Add migration

* Bandwidth fix, reduce inflation pool size

* Update tokenomics

* Refactor rewarding and replace num crate

* Address review comments

* Cleanup, better test values

* Simplify formula

* Cleanup, add rewarding formulas to README

* Address review comments

* Cleanup rebase

* [ci skip] Generate TS types

* fmt

Co-authored-by: Drazen Urch <durch@users.noreply.guthub.com>
2021-11-10 11:14:06 +01:00
Dave Hrycyszyn d8fab74df6 Changed all workflow references to nym-wallet 2021-11-09 17:04:07 +00:00
Dave Hrycyszyn b8c184cc60 Renaming tauri-wallet to nym-wallet
Hopefully this will make it a bit clearer as to what people should
compile if they want the wallet.
2021-11-09 16:55:49 +00:00
Jędrzej Stuczyński 8bcc931d9b Feature/removal of monitor good nodes (#833)
* Removed separated ipv4 and ipv6 testing

* Testing network using chosen core nodes

This should have probably been like 20 independent commits... sorry...

* SQL migrations for updated schema

* SQL updates

* Using absolute uptime directly

* New uptime calculations

* Config entries, more DB work, some cleanup

* Additional API query routes

* More SQL and API work

* Changed `_` to `-` in new routes

* Removed good topology from config

* Fixed gateways reader yield condition

* Initial gateways pinger

* Minor cleanup and logging level decreases

* Missing trait derivations

* Further logging adjustments

* Unused commented out import

* Claiming additional bandwidth in coconut feature when low

* Fixed build with coconut feature

* Minimum number of test routes

* Making beta/nightly clippy happier
2021-11-09 12:25:41 +00:00
Mark Sinclair 955ef7b871 GitHub Actions: only run job to generate types when not in a pull request (#886) 2021-11-09 11:56:43 +00:00
Mark Sinclair 9ee7ad4fa8 GitHub Actions: only run job to generate types when not in a pull request 2021-11-09 11:42:00 +00:00
Tommy Verrall 79aa1febbe Run all the tests 2021-11-08 15:01:21 +00:00
Tommy 4ed9d3a297 Updated rust version for installation 2021-11-08 14:55:49 +00:00
Tommy 97dee2e1a0 Fix path for github action running tauri-wallet-tests
. Applied prettier to the code base
. Removed delegation to gateway tests
2021-11-08 14:54:01 +00:00
Fouad 32c4974c44 Merge pull request #873 from nymtech/update/remove-gateway-delegation
remove gateway selection on delegation and undelegation pages
2021-11-08 15:31:58 +01:00
Mark Sinclair 5dadd73dfd Network Explorer (#881)
* fixed styled component

* dynamic colour for isSelected

* corrected type names

* wrapped nav for routing and positioning of main section and dynamic colour for selected section

* overview info panes added

* quick refactor break out components separately

* WorldMap implemented but not data

* map changed and updated to shades correctly

* live data in cards

* added any types for react simple map

* nested routing added but needs tidying and types refactored

* added tooltip to worldmap

* worldmap killed unused props

* updated MUI version to stable v5

* dark mode and ContentCard refactor complete

* refactor of DarkMode context and API into class and context setup

* context refactor for multiple APIs at top level

* mui typography used for error msging instead of jsx/html

* added typeDefs for node api types

* small changes to sx styling

* added types for api responses and main context

* promiseAll for better error handling of individual async calls

* switch out to live API for country nodes

* removal of unnecessary type any and shortening sx style block

* routing and basic mixnodes table and linking

* fixed TS error handling and ts exclude files

* refactor of class API fetch reqs

* renaming to more appropriate explorer-api

* broken - passing to Fouad

* fix for types in context main

* mixnode detail page

* rebasing back before fetch mixnode by ID was implemented

* added basic cache for huge dump of mixnode data

* broken mixnodes context

* fixed mixnode detail fetch

* added hardcoded BondBreakdown section

* added 2 col table for detail page and small refactor of ApiState type for consistent use throughout app

* basic chart with basic dark/theme implemented - no live data

* added scrollToTop useRef for Detail page

* tidied grid items

* media qry for smaller screens

* small changes

* added live data to bonds breakdown 1/2

* small changes/tweaks

* Bondbreakdown retrieves live data

* mixnode stats using live data

* added node status live data

* uptime story added with live data

* date formatting added

* mixnode map

* error handling for mixnode stats

* error handling for port stats

* improved error handling for table - unfinished

* error handling for mixnode table

* handle Loading state for 2colSmallTable

* Uptime story loading handling

* set up data grid component

* remove mixnode value check as handled inside MixnodesDataGrid component

* use loading prop in data grid component

* undo unintentional code formatting

* map blur and linkable data-grid added

* getting ready for gateways and removing con logs

* quickfix for map blur

* PR comment changes

* refactored data grid for reuseability

* Link to open Big Dipper for Blocks

* passing element to title instead of string for routing to Big Dipper

* quick fix for element passed as title for contentCard

* fix for colour coding nodes

* nuts and bolts of search and results per page are working

* media query for responsive search and no-per-page toolbar

* broke out search and pagesize to separate toolbar

* fix for going back to mixnodes datagrid and refetching

* corrected typings for WorldMap

* removed API for topojson

* Cleaner implementation of formatting inline for datagrid

* added Type to Datagrid Rows for mixnode

* removed optional from type for Datagrid

* added page listing the Gateway nodes

* adding clickable location to handleSearch

* tidying util functions and removing dead useEffect

* Add missing constant

* Validators link to Big Dipper

* added validators link to side nav as per Issues card

* SVG icons

* PR tweak to move logic to routes

* removed dead code post rebase

* fixed light dark mode for DataGrid

* light dark mode works on SVGs in Nav

* moving logic back to Nav to avoid window object issues

* neater ternary for SVG icons dark mode

* Better Linking/Styling for cells

* corrected prop/attr name in svg to Reactify it

* moved api url to constants

* SVGs dark now governed by context not props so reverting renderIcon method back to key value setup

* percentage for bond total added

* SVGs for Overview cards Mixnodes Gateways and Validators

* decimalised formatted punks and % of bond for BondBreakdown card

* number formatting via validator module

* adding cossmjs math pkg

* unfinished refactor BondBreakdown

* first few ui tweaks

* Adding google font Open Sans as per designs

* DataGrid unstylable in theme so nuking in css

* adding theming to Block Height card not hardcoded colours

* DataGrid styling

* Nav styling colours but without hover fix

* theme for bond breakdown

* killing con logs

* Datagrid styling

* Nav bar working

* added lines to nav

* removed cursive from fallback fonts

* trimming and refactoring

* removed dead isActive code from nav options

* Color correction for theme on 2col table

* Moved cell styles out to UniversalDatagrid for reuseability

* Nav colors moved to theme

* Removing comments and dead code

* DataGrid UI improvements

* theming for Overview content card

* Bonds updated from UPUNK to PUNK

* corrected SVG warning on stroke-width

* added Boolean class instead of ternary

* fixing up svg attr to jsx props

* merging UPUNK changes into ui-tweaks

* corrected SVG warning on stroke-width

* added Boolean class instead of ternary

* last instance of Boolean

* BondBreakdown handles 0 delegations

* formatting for webpack config and svgs

* Add `npm run lint` and `npm run lint:fix` targets to `package.json`

* Allow `.vscode` directories - exclude them individually like has been done already in the `.gitignore` directory

* Add `vscode` action to run `eslint` on save for the `/explorer/**` sub-directory

* eslint auto fix

* Fix some easy eslint issues

* removing grid pipes and pastel map colors

* Grid xl lg values to align with Search Toolbar

* GitHub Actions: do not trigger Rust actions when the paths are only `/explorer/**`

See https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#onpushpull_requestpaths for details.

* GitHub Actions: run eslint and annotate pull requests

* socials added to Appbar and Footer

* smaller darkmode icon for mobile

* cleaner code for nav dark light selector

* almost all lint fixes

* post linting Nav fix

* killed con log and removed unused dep

* ref type and removed 1x ts ignore from worldMap

* disabl nested tern w/ nav is refactored on diff br

* icons smaller put into mui List format

* Added hover effect to match DarkLight switch

* ts ignore for worldMap vs no ts decl

* parking changes

* Flipped to MUI SVGs

* re-added external links to Socials

* nav functionality working

* spacing on Mixnode detail page

* datagrid alignment & detail page spacing

* map but no datagrid yet

* killed old SVGs now using mui icons

* added palette instead of strings

* Mixnode Map page working still needs tidying

* better lg xl responsive on Overview and sanitized Page Titles

* removed typography from imports as unused now

* search, sort working & added LG XL responsiveness

* Routing root reqs direct to Overview

* basic 404 page and btn back to overview

* killed fragments and comments

* updated Bond total in column

* Change bond col to type number not text

* Added field to DataGrid and updated MixnodeToGridrow logic

* Added type number so sorting works properly.

* added %self to Detail page

* basic scroll working desktop

* delegations now popout and scroll according to designs

* added stickyHeader and killed dead code

* ExpandMore only renders if delegations exist

* killed old svg icons

* added theme to Overview SVGs

* bringing Title into other pages

* linting fix

* pagination and spacing of gateways cols

* linting fix

* style override for pagination

* added hamburger and changed appbar to fixed

* bringing in other lint fix to pass linting

* PR feedback changes

* Add README.md for theme customisation

* Add hook to get app state context

* Add Nym theme typings to MUI `Theme` types

* Use new theme provider

* Fixing up components to use theme typings
Updated Overview Footer and ContentCard
Footer and Nav socials
Title, Nav chevron and Nav SVGs
Overview SVGs
Light Dark switch
BondBreakdown and 2 col table
DataGrid and 2col Tables
WorldMap UptimeChart and theme changes
WorldMap colors
merge changes
added StatsCard for overview

* Bug fix: do no close drawer when clicking on mixnodes or gateways

* Theme primary colour set to orange highlight, so that default/primary actions are clear to the user. This fixes colours on the pagination page list.

* Fixing up map projection

* Map view uses stroke colour from theme

* added useTheme from correct pkg

* react types upgrade to kill SXProps issue

* SXProps fix removing dead mixins from fixed AppBar

* Scale of Map changed to see more countries

* return type for main Context required

* Fixed map so more countries show

* type for useMainContext hook added

* Remove unused file

* Tidy up imports

* Remove use of `any` by using strongly typed hook to get the app state

* Remove module declaration so that @types/react-simple-maps is used

* API map response changed to indexed object

* Map view uses correct typings from `@types/react-simple-maps` and `d3-scale`

* Make content responsive and fills the view when screen widest

* Link network explorer in title to overview page

* Increase size of card headers to differentiate

* Fix column widths

* Fixed icons showing incorrectly the stats card in mixnode detail view

* Set default sort on mixnodes and gateways to be `bond` descending.

There is an error in MUI data-grid that does not adjust the sort caret based on initial `sortModel` value. Needs investigation.

* GitHub Action for deployment: prefix with network explorer to stop collisions with other deployment projects

* Mixnode list: fix up header title for `host`

* Fix up notification URLs and tidy up readme

* Fix up license information

Co-authored-by: Adrian Thompson <adrian@nymtech.net>
Co-authored-by: Adrian Thompson <adrianthompson@Adrians-MacBook-Air.local>
Co-authored-by: fmtabbara <fmtabbara@hotmail.co.uk>
Co-authored-by: Aid19801 <adrianThompson19801@gmail.com>
2021-11-08 12:23:27 +00:00
Mark Sinclair 6ad5badef4 GitHub Action to publish wallet
This is placeholder to allow the action to trigger in branches
2021-11-08 11:03:49 +00:00
Bogdan-Ștefan Neacşu 480ad18b2e Put client_address and id in the correct order (#875) 2021-11-04 16:33:18 +02:00
Jędrzej Stuczyński cdb21f418b Made daily uptime calculation be independent of epoch rewarding (#860)
* Made daily uptime calculation be independent of epoch rewarding

It was moved into a separate timer

* Don't lookup active gateways during rewarding
2021-11-04 13:06:20 +00:00
Jędrzej Stuczyński bd4c18c723 Set MSRV on all binaries to 1.56 (#872) 2021-11-03 20:07:43 +00:00
fmtabbara e7716ae852 remove gateway selection on delegation and undelegation pages 2021-11-03 15:50:36 +00:00
Jędrzej Stuczyński b19528d47e Removed gateway rewarding and delegation (#856)
* Removed gateway rewarding and delegation

* Removed redundant error variants

* [ci skip] Generate TS types

* Test fixes

Co-authored-by: jstuczyn <jstuczyn@users.noreply.github.com>
2021-11-03 15:01:59 +00:00
Tommy Verrall ef88ce9252 Merge pull request #871 from nymtech/bug-fix/keyboard-shortcuts-macos
add native window items (copy/paste) via tauri
2021-11-03 14:24:00 +00:00
Bogdan-Ștefan Neacşu 488f1c7742 Remove stale migration code (#868) 2021-11-03 16:01:13 +02:00
fmtabbara 63c698d903 add native menu items via tauri 2021-11-03 11:42:47 +00:00
Jędrzej Stuczyński 7e1c3b4501 Chore/cosmrs update (#862)
* Re-enabled `get_tx` endpoint

* Updated cosmrs to 0.3 and prost to 0.9

* [ci skip] Generate TS types

Co-authored-by: jstuczyn <jstuczyn@users.noreply.github.com>
2021-11-03 11:03:18 +00:00
Jędrzej Stuczyński e1d7772a78 Removed epoch rewarding variance (#857) 2021-11-03 11:02:44 +00:00
Tommy Verrall 9db589e0b3 Merge pull request #842 from nymtech/bug-fix/success-overflow
fix delegate success overflow
2021-11-03 10:33:31 +00:00
Tommy Verrall 57c8d69785 Merge branch 'develop' into bug-fix/success-overflow 2021-11-03 10:32:55 +00:00
Jędrzej Stuczyński 4a9cc5b757 Fixed most recent nightly clippy warnings (#865) 2021-11-02 10:48:54 +02:00
Tommy Verrall 06aac9393b Merge pull request #855 from nymtech/feature-request-template
Update feature-request template
2021-11-01 11:31:24 +00:00
Tommy Verrall f4c5b1d67f Update feature-request template 2021-11-01 11:05:54 +00:00
Tommy Verrall 2e0aba6100 Merge pull request #854 from nymtech/issue-template
Update issue templates
2021-11-01 10:51:37 +00:00
Tommy Verrall 8c6549c5dd Update report.md
consolidated the component area
2021-11-01 10:05:24 +00:00
Tommy Verrall 7b431ebfa8 Update .github/ISSUE_TEMPLATE/report.md
Co-authored-by: Mark Sinclair <mmsinclair@gmail.com>
2021-11-01 09:55:12 +00:00
Tommy Verrall 3152fd6887 Update .github/ISSUE_TEMPLATE/report.md
Co-authored-by: Mark Sinclair <mmsinclair@gmail.com>
2021-11-01 09:54:35 +00:00
Tommy Verrall e03e7f186a Delete create-an-issue.md 2021-11-01 09:47:10 +00:00
Tommy Verrall ec056a548f Delete issue-report.md 2021-11-01 09:46:59 +00:00
Tommy Verrall 24aa075a07 Update issue templates
new issue template for individuals
2021-11-01 09:41:29 +00:00
Jędrzej Stuczyński 8488c4cb0f Overflow checks in release (#846) 2021-10-28 13:07:08 +01:00
Tommy Verrall 20c96b940f Update nym_wallet.yml
check binary exists after name change
2021-10-26 14:10:23 +01:00
Tommy Verrall cfb43699d6 Update nym_wallet.yml
last check to run single test
2021-10-26 13:04:52 +01:00
Tommy Verrall 79e7b5b938 Update nym_wallet.yml
add directory
2021-10-26 12:43:44 +01:00
Tommy Verrall 47156e693c Update nym_wallet.yml
address directory
2021-10-26 12:20:36 +01:00
Mark Sinclair b61f6c8833 Update nym_wallet.yml 2021-10-26 12:32:39 +03:00
Mark Sinclair cc3b710af9 Delete nym-wallet-tests.yml 2021-10-26 12:23:06 +03:00
Mark Sinclair 4de3f16bb3 Merge pull request #841 from nymtech/feature/tauri-wallet-tests
Feature NYM wallet webdriverio test
2021-10-26 10:21:45 +01:00
fmtabbara 7aad7daa5e fix overflow 2021-10-22 17:52:15 +01:00
Tommy 4107d670cf remove stray character 2021-10-22 17:44:58 +01:00
Tommy 284e797fb3 update readme 2021-10-22 17:43:15 +01:00
Tommy 8a63df3e82 remove duplicate loglevel output 2021-10-22 17:27:32 +01:00
Tommy 7b8731ddcc line endings again 2021-10-22 17:25:56 +01:00
Tommy 1017c9c642 more line endings 2021-10-22 17:24:58 +01:00
Tommy 4e0c59a8f1 sort out line endings 2021-10-22 17:24:05 +01:00
Tommy f6d85a0784 remove empty comment 2021-10-22 17:21:25 +01:00
Tommy 6516811276 add assertion on sending funds
need to improve the calculator
2021-10-22 17:20:00 +01:00
Tommy Verrall ca0ed3594f Update nym_wallet.yml
line spacing between on push and defaults
2021-10-22 15:38:42 +01:00
Tommy Verrall a28ad4f81a Merge pull request #840 from nymtech/feature/nym-wallet-tests
Update nym_wallet.yml
2021-10-22 15:32:18 +01:00
Tommy 0ea3183288 set logging to silent 2021-10-22 14:08:54 +01:00
Tommy c6ff7c51f0 setting build path for running the binary 2021-10-22 13:55:48 +01:00
Tommy Verrall 0240ab6144 Update nym_wallet.yml
Draft at the moment whilst figuring out config data
2021-10-22 13:37:24 +01:00
Tommy 2746ec49a3 Fixing bonding tests 2021-10-22 12:29:40 +01:00
Tommy b3f1c943a7 Uncomment test script 2021-10-22 10:33:28 +01:00
Tommy 7654ede904 Update tests to use new selectors, implement reporting
. Use accessible ID's to identify elements
. Implement reporting
. Clean up 
. Input more notes in README.md
2021-10-22 10:30:17 +01:00
Tommy c882487d01 change casing on identifiers to kebab-casing 2021-10-21 11:18:45 +01:00
Tommy 865e4839f3 merging develop 2021-10-21 11:04:57 +01:00
Tommy 5a270f6489 pushing new wallet create - WIP 2021-10-21 11:02:28 +01:00
Tommy Verrall 6776bb4bab Merge pull request #836 from nymtech/feature/add-dataids-wallet
Apply readable ids to elements on Nym Wallet
2021-10-21 10:28:36 +01:00
Tommy cbe9bad66e Apply readable test-dataIds to elements on Nym Wallet
To easily identify elements on the wallet to help with automation.
2021-10-20 16:39:30 +01:00
Tommy Verrall 5761e1c1a4 Merge pull request #831 from nymtech/update/use-nym-icons
update app name and icons
2021-10-19 14:21:51 +01:00
Mark Sinclair 062a5edf76 Merge pull request #806 from nymtech/bugfix/network-explorer-api-geoip
Bug fix: Network Explorer: Add freegeoip API key and split out tasks for country distributions
2021-10-19 11:53:22 +01:00
Jędrzej Stuczyński a009e76568 Feature locked client-side bandwidth metering (#820) 2021-10-19 11:30:34 +02:00
Jędrzej Stuczyński dcc9b856d7 Flag to only run coconut-related functionalities (#824) 2021-10-19 11:30:07 +02:00
Mark Sinclair 592e52b333 Hush nightly clippy, hush 2021-10-19 10:20:00 +01:00
Mark Sinclair bc923be862 Update README 2021-10-19 10:20:00 +01:00
Mark Sinclair e880631500 Remove unused imports 2021-10-19 10:20:00 +01:00
Mark Sinclair d9b0834476 Review feedback 2021-10-19 10:20:00 +01:00
Mark Sinclair 2fda22e168 Run new tasks at startup 2021-10-19 10:20:00 +01:00
Mark Sinclair a5091cd124 Split refreshing of mixnode cache into a separate task 2021-10-19 10:20:00 +01:00
Mark Sinclair b2ec19ece4 Split geolcation into its own task the picks off mixnodes that don't have locations or ones where the cache TTL has expired 2021-10-19 10:20:00 +01:00
Mark Sinclair 72e64cfab7 Split the mixnode country distribution calculation into its own task and get data from the location cache 2021-10-19 10:20:00 +01:00
Mark Sinclair 7eacb6b57e Add TTL to location cache 2021-10-19 10:20:00 +01:00
Mark Sinclair e0e1ca992f Move locations to their own cache 2021-10-19 10:20:00 +01:00
Mark Sinclair f1a628dee4 Change freegeoip API hostname 2021-10-19 10:20:00 +01:00
Mark Sinclair 81d49dc4b9 Add thiserror crate 2021-10-19 10:20:00 +01:00
Mark Sinclair 7e581183f4 Network Explorer API: add env var GEO_IP_SERVICE_API_KEY to provide an API key for https://freegeoip.app/ 2021-10-19 10:20:00 +01:00
fmtabbara a9f3fa0c72 update app name and icons 2021-10-19 09:08:07 +01:00
Tommy e6c5a97f8c set to silent logging 2021-10-18 12:18:18 +01:00
Tommy efb9b70293 merge develop 2021-10-18 12:17:44 +01:00
Tommy 666c233d6c remove workflow 2021-10-18 12:14:57 +01:00
Mark Sinclair 4307756719 Network Explorer: GitHub Actions
- change notification channel
- remove trigger on PR
2021-10-18 12:05:21 +01:00
Mark Sinclair 622d0d3ff9 Merge pull request #829 from nymtech/nym-wallet-test-yml
Create nym-wallet-tests.yml
2021-10-18 11:22:54 +01:00
Tommy Verrall ad763c2131 Update nym_wallet.yml
remove clippy
2021-10-18 11:18:59 +01:00
Jędrzej Stuczyński 87a2ec9468 Updated CODEOWNERS (#828) 2021-10-18 08:41:27 +01:00
Tommy dd590e8779 Update Readme for windows. 2021-10-15 18:17:51 +01:00
Tommy 9555f3a2cd testing tauri-wallet-tests.yml 2021-10-15 18:06:24 +01:00
Tommy Verrall 0b79fc33d7 nym-wallet-tests.yml 2021-10-15 18:05:16 +01:00
Tommy Verrall b7e14489da Create nym-wallet-tests.yml
action for building and running the tauri-wallet-tests
2021-10-15 17:46:53 +01:00
Tommy 84b426042e wrong workflow check in 2021-10-15 17:24:35 +01:00
Tommy f683b9e770 Tauri Wallet Test
. Currently developed against a Linux machine
. POM design
. README.md states how to get up and running on Linux 
WIP - areas of focus inbound ->
. CI
. Test suite configuration
. Working on multiple platforms
. Improve selector selection to reduce fragility in the future
2021-10-15 17:05:00 +01:00
Fouad 5fb2c9d822 Merge pull request #827 from nymtech/tauri-wallet-patch
Tauri wallet
2021-10-15 15:19:01 +01:00
Jędrzej Stuczyński 0f7280c227 Fixed most recent nightly clippy warnings (#817)
* Fixed most recent nightly clippy warnings

* Missing wasm32 changes
2021-10-15 08:57:16 +01:00
mmsinclair 4ebca86a66 [ci skip] Generate TS types 2021-10-14 15:41:13 +00:00
fmtabbara 1a0c6eed27 Tauri wallet 2021-10-14 16:30:09 +01:00
Bogdan-Ștefan Neacşu 673e13ec57 Change false to true, as for mixnodes (#822) 2021-10-13 19:28:47 +03:00
Jędrzej Stuczyński 7caac334f4 Feature/resending rewards on timeout (#810)
* Additional methods on nymd client

* Checking for time out errors

* Attempting retransmission on suspected time out

* Don't report error if tx is a mempool duplicate
2021-10-11 10:48:59 +01:00
Jędrzej Stuczyński 4e0e081b3e Feature/coconut feature (#805)
* 'Coconut' feature in gateway

* Enabled coconut feature in gateway-requests

* Native client coconut feature

* Ibid for socks5 client

* Ibid for wasm client

* Coconut feature flag for validator-api

* Added coconut feature flag to our CI

* build.yml typo

* Continue on windows errors

* Missing quote

* Another typo in build.yml

* Reclaiming disk space when building for windows on CI
2021-10-11 09:17:58 +01:00
Jędrzej Stuczyński 51dc8c81ed Rocket picking up environment from Rocket.toml again (#801)
* Rocket picking up environment from Rocket.toml again

* Removed unused import
2021-10-08 14:33:29 +01:00
Max H 727eedf7d3 updated docs link 2021-10-05 13:34:18 +02:00
Mark Sinclair e37fddf3ab Network Explorer: GitHub Actions - notification channel 2021-10-05 11:53:17 +01:00
Mark Sinclair 885679e575 Network Explorer: GitHub Actions - notification channel 2021-10-05 11:46:41 +01:00
Mark Sinclair 36554c3c34 Network Explorer: GitHub Actions - notification messages 2021-10-05 11:39:33 +01:00
Mark Sinclair 2197062372 Network Explorer: GitHub Actions - notification messages 2021-10-04 11:22:37 +01:00
Mark Sinclair 487b894f3d Network Explorer: GitHub Actions - send message content via stdin 2021-10-04 10:53:39 +01:00
Mark Sinclair a03603b274 Network Explorer: GitHub Actions - fix JSON quote escaping 2021-10-04 10:45:02 +01:00
Mark Sinclair e6879dba63 Network Explorer: GitHub Actions - handle env differently 2021-10-01 15:47:57 +01:00
Mark Sinclair 68a43e33b9 Network Explorer: GitHub Actions - change notifications to be generated from template files 2021-10-01 15:44:26 +01:00
Bogdan-Ștefan Neacşu db2ab41636 Remove migration code (#796) 2021-10-01 16:55:48 +03:00
Mark Sinclair c624327a7a Network Explorer: GitHub Action - add keybase notifications 2021-10-01 14:28:13 +01:00
Mark Sinclair 32ff5cbc1e Network Explorer: GitHub Actions - fix dist path 2021-09-30 16:02:51 +01:00
Mark Sinclair 9ba203c7b3 Network Explorer: GitHub Actions: rsync install 2021-09-30 15:52:02 +01:00
Mark Sinclair 729625ef4f Network Explorer: GitHub Action: install rsync 2021-09-30 15:49:39 +01:00
Mark Sinclair fd3923a5f9 Network Explorer: GitHub Actions - disable tests 2021-09-30 15:37:52 +01:00
Mark Sinclair c2fd07ea18 Fix typo 2021-09-30 15:29:23 +01:00
Mark Sinclair d76a2d84b5 Add GitHub Action to build Network Explorer 2021-09-30 15:19:23 +01:00
Bogdan-Ștefan Neacşu 2a98f7482d Feature/migrate hidden delegations (#786)
* Remove migration code

* Added function to iterate over delegation of variable type

* Add unit tests

* Refactored some naming and reused mix/gateway functionality

* Borrow bucket instead of move

* Linked with existing delegations function

* Migration of left-over delegations

* Remove unused imports

* Put a gateway test as well, next to the mix one

* Expose queries for all delegations

* Change break point

* Added client side calls to the new queries

* Fix clippy

* Added pagination and read check tests

* Fix gateway test from the last commit

* Test functions for (de)serialization of identity and owner (in)to storage keys

* Add delegation function unit test

* Feature guard import

* Changed UnpackedDelegation from type to struct

* Remove mutable parameter and put start_after in returned value

* Made all delegations into iterator for OOM safety

* Fix clippy

* Add test for delegations iterator size in memory

* Change map with if let for ease of read

* Use DENOM instead of hardcoded value
2021-09-30 15:04:33 +03:00
Jędrzej Stuczyński 12637d93ff Feature/persistent gateway storage (#784)
* Sqlx struct stub

* Initial schema

* Initial error enum

* Managed for persisted shared keys

* Initial inbox manager

* Comments

* Using new database in clients handler

* Extending gateway storage API

* tokio::main + placeholder values

* Removed old client store

* Simplified logic of async packet processing

* Renamed table + not null restriction

* BandwidthManager

* Removed sled dependency

* Using centralised storage for bandwidth

* Dead code removal

* WIP connection_handler split and simplification

Maybe it doesn't look like it right now, but once completed it will remove bunch of redundant checks for Nones etc

* Further more explicit clients handler split

* Minor cleanup

* Temporary store for active client handles

* Fixed error types

* Error trait on iv and encrypted address

* Authentication and registration moved to the handler

* Removal of clients handler

* Further logic simplification + returned explicit bandwidth values

* Further cleanup and comments

* Updated config with relevant changes

* Basic bandwidth tracking in client

* FreshHandle doc comments + fixed stagger issue

* Removed side-effects from .map

* More doc comments

* Database migration on build

* Increased default claimed bandwidth

* Renaming

* Fixed client determining available bandwidth

* Removed dead sql table that might be used in the future

* Windows workaround

* Comment

* Return error rather than cap credential
2021-09-30 09:45:21 +01:00
Jędrzej Stuczyński f63aba9058 Removes code of executed migrations (#793) 2021-09-28 10:13:05 +01:00
Jędrzej Stuczyński 668325a4ce Feature/active sets (#764)
* Added separate gateway active set size

* Grabbing contract state

* Defined PartialOrd on MixnodeBond and GatewayBond

* Some initial stub for active set

* Unit tests for mixnode and gateway bond partialord implementation

* Obtaining active sets

* Active nodes routes

* Additional methods on validator client

* Added state migration

* Feature locking unused import

* Fixed State test fixture

* Included block height for partial_ord

* Missing post-merge imports

* api on the client for active nodes

* Native/socks5/wasm clients using active nodes

* Rewarding only active nodes

* Updated validator client StateParams definition

* Gateway active set size

* Contract migration update

* Cargo fmt

* Updated TauriStateParams

* [ci skip] Generate TS types

Co-authored-by: jstuczyn <jstuczyn@users.noreply.github.com>
2021-09-28 09:38:22 +01:00
Jędrzej Stuczyński e891c68158 Created getters for AccountData (#787) 2021-09-27 12:16:16 +02:00
Jędrzej Stuczyński b1fb032f43 Removed SQLx offline mode artifact (#790) 2021-09-27 12:06:13 +02:00
Jędrzej Stuczyński 23ea82952e Bugfix/validator api windows build (#791)
* Use https://github.com/nymtech/nym/pull/784/commits/3eceb349c695372cbb7a3bee9aa5e090da7c9c4d trick to make build.rs work with windows

* Re-enabled validator-api windows CI build
2021-09-27 12:05:53 +02:00
Drazen Urch 9a65e44166 Add Tauri wallet
--
Squashed commit of the following:

commit 3f4f9073b7
Author: Drazen Urch <durch@users.noreply.guthub.com>
Date:   Mon Sep 27 11:38:12 2021 +0200

    Delete .lock for merge

commit bf502f6338
Author: Drazen Urch <durch@users.noreply.guthub.com>
Date:   Mon Sep 27 11:36:51 2021 +0200

    Squashed commit of the following:

    commit 020cad897d
    Author: Jędrzej Stuczyński <jedrzej.stuczynski@gmail.com>
    Date:   Fri Sep 24 15:49:21 2021 +0100

        Feature/rust rewarding (#750)

        * Calculating gas fees

        * Ability to set custom fees

        * Added extra test

        * Removed commented code

        * Moved all msg types to common contract crate

        * Temporarily disabling get_tx method

        * Finishing up nymd client API

        * Comment fix

        * Remaining fee values

        * Some cleanup

        * Removed needless borrow

        * Fixed imports in contract tests

        * Moved error types around

        * New ValidatorClient

        * Experiment with new type of defaults

        * Removed dead module

        * Dealt with unwrap

        * Migrated mixnode to use new validator client

        * Migrated gateway to use new validator client

        * Mixnode and gateway adjustments

        * More exported defaults

        * Clients using new validator client

        * Fixed mixnode upgrade

        * Moved default values to a new crate

        * Changed behaviour of validator client features

        * Migrated basic functions of validator api

        * Updated config + fixed startup

        * Fixed wasm client build

        * Integration with the explorer api

        * Removed tokio dev dependency

        * Needless borrow

        * Fixex wasm client build

        * Fixed tauri client build

        * Needless borrows

        * New tables for rewarding

        * Updated cosmos-sdk version

        * Removed reward-specific node status routes

        * New rewarding-specific config entries

        * Additional network defaults

        * Initial periodic rewards from validator api

        * Replaced print with log

        * Filtering nodes with uptime > 0

        * Additional failure logging statements

        * Fixed operation ordering

        * Adjusted next rewarding epoch determination

        * Modified rewarding behaviour to keep track of rewarding in progress

        * Improved error message on config load failure

        * Additional log statement

        * Adjusted rewarding gas limit calculation

        * Made naming slightly more consistent

        * Fixed incorrect parentheses placement

        * Fixed fee calculation

        * Cargo fmt

        * Removed failed merge artifacts

        * Introduced comment for any future reward modification

        * typos

        * Helper functions for the future

        * Making @mfahampshire 's life easier

        * Redesigned epoch + rewarding skipped epochs (if possible)

        * Removed old merge artifacts

        * Naming consistency

        * Constraining arguments

        * Removed unnecessary if branch

        * Ignore monitor check for current epoch

        * Additional checks for current epoch data

        * Monitor threshold check

        * cargo fmt

        * Fixed post-merge issues in transactions.rs

    commit 5dfaff6296
    Author: Drazen Urch <drazen@urch.eu>
    Date:   Tue Sep 21 10:59:17 2021 +0200

        Update hmac and blake3 (#673)

        * Update hmac and blake3

        * Remain paranoid for `0.*` crates

        * Most paranoid versions :)

        * Updated aes and using published version of blake3

        Co-authored-by: Jędrzej Stuczyński <jedrzej.stuczynski@gmail.com>

    commit 5b03982043
    Author: Jędrzej Stuczyński <jedrzej.stuczynski@gmail.com>
    Date:   Mon Sep 20 10:40:03 2021 +0100

        Replaced unwrap_or_else with unwrap_or_default (#780)

    commit 8f6856d6fb
    Author: Drazen Urch <drazen@urch.eu>
    Date:   Mon Sep 20 11:15:06 2021 +0200

        Make fee helpers public (#777)

        Co-authored-by: Drazen Urch <durch@users.noreply.guthub.com>

commit 80664b911f
Merge: f66ea059 46149012
Author: Fouad <fmtabbara@hotmail.co.uk>
Date:   Thu Sep 23 20:59:27 2021 +0100

    Merge pull request #783 from nymtech/tauri-wallet-frontend

    tauri wallet front-end

commit 46149012bd
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Thu Sep 23 17:42:34 2021 +0100

    PR updates

commit de601c319a
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Thu Sep 23 17:06:47 2021 +0100

    PR updates

commit 7318de23f2
Author: max <mfahampshire@gmail.com>
Date:   Wed Sep 22 18:07:29 2021 +0200

    added info on nym-wallet (tauri) in readme

commit 56e07753ea
Author: max <mfahampshire@gmail.com>
Date:   Wed Sep 22 14:44:22 2021 +0200

    added minimal readme for wallet

commit 21b008fae9
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Mon Sep 13 13:30:05 2021 +0100

    use wrapper functions for send and delegate

    form updates

    update working

    finish bonding and unbonding setup

    funds allocation check when bonding/sending/delegating

    update title

commit 27a202cbe8
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Fri Sep 17 11:32:41 2021 +0100

    integrate admin functions

    updates

    integrate admin form update function

commit 085538582b
Author: Drazen Urch <durch@users.noreply.guthub.com>
Date:   Fri Sep 17 10:43:26 2021 +0200

    Admin functions, reorganize code

commit f66ea05929
Author: Drazen Urch <durch@users.noreply.guthub.com>
Date:   Fri Sep 17 10:43:26 2021 +0200

    Admin functions, reorganize code

commit 052c7188ec
Merge: f6c316ee 976dd7aa
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Fri Sep 17 09:38:19 2021 +0100

    merge develop

commit f6c316eea9
Author: Drazen Urch <durch@users.noreply.guthub.com>
Date:   Thu Sep 16 18:02:15 2021 +0200

    fix typo

commit f33defc645
Author: Drazen Urch <durch@users.noreply.guthub.com>
Date:   Thu Sep 16 17:36:24 2021 +0200

    Squashed commit of the following:

    commit 976dd7aae2
    Author: Drazen Urch <drazen@urch.eu>
    Date:   Wed Sep 15 17:28:49 2021 +0200

        Add block_height method to Delegation (#778)

        Co-authored-by: Drazen Urch <durch@users.noreply.guthub.com>

    commit 0d21f4e937
    Merge: e84af4f6 1403449a
    Author: Fouad <fmtabbara@hotmail.co.uk>
    Date:   Wed Sep 15 12:41:29 2021 +0100

        Merge pull request #776 from nymtech/update/re-enable-bonding

        re-enable bonding

    commit 1403449ad5
    Author: fmtabbara <fmtabbara@hotmail.co.uk>
    Date:   Tue Sep 14 16:00:21 2021 +0100

        enable bonding

    commit e84af4f601
    Author: Drazen Urch <drazen@urch.eu>
    Date:   Tue Sep 14 15:15:26 2021 +0200

        Migrate legacy delegation data (#771)

        * Skip ReadOnlyBucket deserialization errors

        * empty migration

        * clippy

        * cargo schema

        * Drop invalid delegation data

        * Dont drop old data

        * Add todo

        * Unify on type param

        * gateways are different

        * cargo fmt

        Co-authored-by: Drazen Urch <durch@users.noreply.guthub.com>

    commit 26b032c15c
    Merge: e1ddaff0 cba36253
    Author: Mark Sinclair <mmsinclair@gmail.com>
    Date:   Tue Sep 14 10:09:14 2021 +0100

        Merge pull request #774 from nymtech/feature/explorer-api-delegations

        Explorer-api: add API resource to show the delegations for each mix node

    commit cba3625394
    Author: Mark Sinclair <mmsinclair@gmail.com>
    Date:   Mon Sep 13 10:33:41 2021 +0100

        explorer-api: add API resource to show the delegations for each mix node

    commit e1ddaff04d
    Merge: 0b9c03ca 66ab5de4
    Author: Fouad <fmtabbara@hotmail.co.uk>
    Date:   Fri Sep 10 17:17:14 2021 +0100

        Merge pull request #772 from nymtech/update/disable-bonding

        add app alert

    commit 66ab5de442
    Author: fmtabbara <fmtabbara@hotmail.co.uk>
    Date:   Fri Sep 10 16:16:58 2021 +0100

        add app alert

    commit 0b9c03ca90
    Author: Dave Hrycyszyn <futurechimp@users.noreply.github.com>
    Date:   Fri Sep 10 11:23:21 2021 +0300

        Adding deps for building the Tauri wallet under Ubuntu (#770)

    commit c9dce0c1da
    Author: Bogdan-Ștefan Neacşu <bogdan@nymtech.net>
    Date:   Thu Sep 9 11:21:45 2021 +0200

        Feature/consumable bandwidth (#766)

        * Set actual value for bandwidth

        Also put it as a public attribute, such that it can be actively used
        by the credential consumer

        * Switch from sending Attribute structs to sending the actual attribute bytes over the wire

        * Add atomic bandwidth value to gateway

        * Consume bandwidth based on the mix packet size

        * Use Bandwidth struct for specific functionality

        * Move bandwidth code outside the dependency path of wasm client

        * Use u64 instead of AtomicU64, as the handling is not parallel

    commit e00e77db15
    Author: Bogdan-Ștefan Neacşu <bogdan@nymtech.net>
    Date:   Wed Sep 8 15:07:24 2021 +0200

        Feature/bond blockstamp (#760)

        * Add block_height to MixNode/GatewayBond

        * Reward based on blockstamp of bonded node or of delegation

        * Add specific tests

        * Add migration code

        * Apply doc nit

    commit 1074449f91
    Merge: 08276e6e 9a3d824a
    Author: Fouad <fmtabbara@hotmail.co.uk>
    Date:   Tue Sep 7 23:45:10 2021 +0100

        Merge pull request #767 from nymtech/update/remove-app-alert

        remove alert

    commit 08276e6e42
    Author: Bogdan-Ștefan Neacşu <bogdan@nymtech.net>
    Date:   Tue Sep 7 16:33:30 2021 +0200

        Remove migration code (#759)

    commit 9a3d824a4a
    Author: fmtabbara <fmtabbara@hotmail.co.uk>
    Date:   Mon Sep 6 20:39:24 2021 +0100

        remove alert

    commit 2789ee8f18
    Author: Bogdan-Ștefan Neacşu <bogdan@nymtech.net>
    Date:   Fri Sep 3 15:30:45 2021 +0300

        Update coconut-rs and use hash_to_scalar from there (#765)

        Failed tests are due to some nightly issue, not related to this PR

    commit a7ba643c35
    Merge: 28be53ee c42f3c68
    Author: Fouad <fmtabbara@hotmail.co.uk>
    Date:   Fri Sep 3 09:14:50 2021 +0100

        Merge pull request #762 from nymtech/feature/app-alert

        add app alert banner

    commit 28be53eefb
    Author: Bogdan-Ștefan Neacşu <bogdan@nymtech.net>
    Date:   Thu Sep 2 18:26:40 2021 +0300

        Add block_height in the Delegation structure as well (#757)

    commit 219c45a352
    Author: Jędrzej Stuczyński <jedrzej.stuczynski@gmail.com>
    Date:   Thu Sep 2 15:48:29 2021 +0100

        Updated cosmos-sdk (#761)

        * Updated cosmos-sdk

        * Re-exposing more things

    commit 1a3b83752e
    Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    Date:   Thu Sep 2 15:45:56 2021 +0100

        Bump next from 11.1.0 to 11.1.1 in /wallet-web (#758)

        Bumps [next](https://github.com/vercel/next.js) from 11.1.0 to 11.1.1.
        - [Release notes](https://github.com/vercel/next.js/releases)
        - [Changelog](https://github.com/vercel/next.js/blob/canary/release.js)
        - [Commits](https://github.com/vercel/next.js/compare/v11.1.0...v11.1.1)

        ---
        updated-dependencies:
        - dependency-name: next
          dependency-type: direct:production
        ...

        Signed-off-by: dependabot[bot] <support@github.com>

        Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

    commit c42f3c6844
    Author: fmtabbara <fmtabbara@hotmail.co.uk>
    Date:   Thu Sep 2 12:29:47 2021 +0100

        add app alert banner

    commit a5d3ba3900
    Merge: 92e13a5d cdf0d443
    Author: Mark Sinclair <mmsinclair@gmail.com>
    Date:   Tue Aug 31 15:59:11 2021 +0100

        Merge pull request #755 from nymtech/bugfix/explorer-api-ping

        Explorer API: port test now split out address resolution and add units tests

    commit cdf0d44341
    Author: Mark Sinclair <mmsinclair@gmail.com>
    Date:   Tue Aug 31 14:37:28 2021 +0100

        explorer-api: turned down logging from `error` to `warn`

    commit 92f976a45d
    Author: Mark Sinclair <mmsinclair@gmail.com>
    Date:   Fri Aug 27 11:34:21 2021 +0100

        explorer-api: sanitize hostname before running checks to avoid leading or trailing spaces that are known to exist in the current test net

    commit 2bc858cde3
    Author: Mark Sinclair <mmsinclair@gmail.com>
    Date:   Fri Aug 27 09:32:26 2021 +0100

        explorer-api: port test: split out address resolution and add units tests

    commit 92e13a5d00
    Author: Bogdan-Ștefan Neacşu <bogdan@nymtech.net>
    Date:   Tue Aug 31 14:51:15 2021 +0300

        Feature/add blockstamp (#756)

        * Add RawDelegationData

        * Fix current tests for the new stored data

        * Added migration commit. Will be reverted after doing the migration

        * New tests for block height

        * Use current blockstamp instead of 24h old one

        * Put _alot_ of migration stuff in the migrate function scope

    commit 122f5d9f2e
    Author: Bogdan-Ștefan Neacşu <bogdan@nymtech.net>
    Date:   Mon Aug 30 10:27:20 2021 +0300

        Feature/cred after handshake (#745)

        * Call perform_initial_authentication instead of register in clients

        * Refactor the register/authenticate functions a bit

        * Introduce Bandwidth request type

        * Add encryption layer to cred

        * Remove cred pass and check from handshake

        * Replaced unreachable!  with error

        * Changed decrypt_tagged signature to not take mutable ownership of data

        * Put handle_bandwidth work inside a function

        * Add check before unwrap

        * Remove unnecessary async

        * Decouple bandwidth credential from authentication

        * Use new_error for ServerResponse:Error

        * Send a fresh IV each time the BandwidthCredential request is sent

        * Remove unwrap of bincode::serialize

        * Add comment regarding Bandwidth response

        * Remove _mut from naming

        * Leave Debug trait alone, as the initial error doesn't reproduce anymore

        * Pass iv as Vec<u8> instead of base58 string

        * Renamed AuthenticationIV to IV, as it is now used for more the just authentication

        * Did some IV refactorization

    commit 982ee0266c
    Author: Bogdan-Ștefan Neacşu <bogdan@nymtech.net>
    Date:   Fri Aug 27 16:02:34 2021 +0300

        Feature/get own delegations (#748)

        * Introduce reverse delegation bucket

        * Add client command

        * Fix clippy error

        * Added tests in queries

        * Add tests in transactions

        * Migration code. Will be reverted after it's called on testnet

        * Replace unwrap with expect

        * Move some test code in the right file...

        ... to remove unnecessary auxiliary function.

        * Reduce the scope to migration auxiliary functions

        * Rename everything from [node]reverse to reverse[node]

        * Fix fmt

    commit 5f42a9bd05
    Author: Jędrzej Stuczyński <jedrzej.stuczynski@gmail.com>
    Date:   Fri Aug 27 13:52:18 2021 +0100

        NetworkMonitorBuilder - starting the monitor after rocket has launched (#754)

        * NetworkMonitorBuilder - starting the monitor after rocket has launched

        * Removed unused import

    commit 1811df9ddb
    Author: Jędrzej Stuczyński <jedrzej.stuczynski@gmail.com>
    Date:   Fri Aug 27 13:52:10 2021 +0100

        Enabled validators api argument (#753)

    commit 6bdfe7f895
    Author: Jędrzej Stuczyński <jedrzej.stuczynski@gmail.com>
    Date:   Thu Aug 26 11:21:01 2021 +0100

        Correctly bounding nominator of uptime calculation (#752)

    commit c6b286a1db
    Author: Jędrzej Stuczyński <jedrzej.stuczynski@gmail.com>
    Date:   Wed Aug 25 14:50:57 2021 +0100

        Fixed argument parsing for ipv6 'good' topology (#751)

    commit b3568a26f5
    Author: Bogdan-Ștefan Neacşu <bogdan@nymtech.net>
    Date:   Tue Aug 24 11:25:05 2021 +0300

        Revert "Migration commit, will be reverted after the testnet contract is updated" (#749)

        This reverts commit 38d868bcce.

    commit 15ae0f521e
    Author: Jędrzej Stuczyński <jedrzej.stuczynski@gmail.com>
    Date:   Mon Aug 23 10:26:51 2021 +0100

        Feature/more reliable uptime calculation (#747)

        * New database table holding monitor run info

        * SQL interface for new table

        * Updated uptime calculation to instead rely on number of monitor test runs

    commit 2923d4b872
    Author: Bogdan-Ștefan Neacşu <bogdan@nymtech.net>
    Date:   Thu Aug 19 22:03:07 2021 +0300

        Update template toml key (#746)

commit 424230c3bb
Author: Drazen Urch <durch@users.noreply.guthub.com>
Date:   Thu Sep 16 17:33:20 2021 +0200

    Squashed commit of the following:

    commit cddd9e8e4c
    Merge: 40fbdff0 976dd7aa
    Author: Drazen Urch <durch@users.noreply.guthub.com>
    Date:   Thu Sep 16 17:27:27 2021 +0200

        Merge branch 'develop' into tauri-wallet

    commit 976dd7aae2
    Author: Drazen Urch <drazen@urch.eu>
    Date:   Wed Sep 15 17:28:49 2021 +0200

        Add block_height method to Delegation (#778)

        Co-authored-by: Drazen Urch <durch@users.noreply.guthub.com>

    commit 0d21f4e937
    Merge: e84af4f6 1403449a
    Author: Fouad <fmtabbara@hotmail.co.uk>
    Date:   Wed Sep 15 12:41:29 2021 +0100

        Merge pull request #776 from nymtech/update/re-enable-bonding

        re-enable bonding

    commit 1403449ad5
    Author: fmtabbara <fmtabbara@hotmail.co.uk>
    Date:   Tue Sep 14 16:00:21 2021 +0100

        enable bonding

    commit e84af4f601
    Author: Drazen Urch <drazen@urch.eu>
    Date:   Tue Sep 14 15:15:26 2021 +0200

        Migrate legacy delegation data (#771)

        * Skip ReadOnlyBucket deserialization errors

        * empty migration

        * clippy

        * cargo schema

        * Drop invalid delegation data

        * Dont drop old data

        * Add todo

        * Unify on type param

        * gateways are different

        * cargo fmt

        Co-authored-by: Drazen Urch <durch@users.noreply.guthub.com>

    commit 26b032c15c
    Merge: e1ddaff0 cba36253
    Author: Mark Sinclair <mmsinclair@gmail.com>
    Date:   Tue Sep 14 10:09:14 2021 +0100

        Merge pull request #774 from nymtech/feature/explorer-api-delegations

        Explorer-api: add API resource to show the delegations for each mix node

    commit cba3625394
    Author: Mark Sinclair <mmsinclair@gmail.com>
    Date:   Mon Sep 13 10:33:41 2021 +0100

        explorer-api: add API resource to show the delegations for each mix node

    commit e1ddaff04d
    Merge: 0b9c03ca 66ab5de4
    Author: Fouad <fmtabbara@hotmail.co.uk>
    Date:   Fri Sep 10 17:17:14 2021 +0100

        Merge pull request #772 from nymtech/update/disable-bonding

        add app alert

    commit 66ab5de442
    Author: fmtabbara <fmtabbara@hotmail.co.uk>
    Date:   Fri Sep 10 16:16:58 2021 +0100

        add app alert

    commit 0b9c03ca90
    Author: Dave Hrycyszyn <futurechimp@users.noreply.github.com>
    Date:   Fri Sep 10 11:23:21 2021 +0300

        Adding deps for building the Tauri wallet under Ubuntu (#770)

    commit c9dce0c1da
    Author: Bogdan-Ștefan Neacşu <bogdan@nymtech.net>
    Date:   Thu Sep 9 11:21:45 2021 +0200

        Feature/consumable bandwidth (#766)

        * Set actual value for bandwidth

        Also put it as a public attribute, such that it can be actively used
        by the credential consumer

        * Switch from sending Attribute structs to sending the actual attribute bytes over the wire

        * Add atomic bandwidth value to gateway

        * Consume bandwidth based on the mix packet size

        * Use Bandwidth struct for specific functionality

        * Move bandwidth code outside the dependency path of wasm client

        * Use u64 instead of AtomicU64, as the handling is not parallel

    commit e00e77db15
    Author: Bogdan-Ștefan Neacşu <bogdan@nymtech.net>
    Date:   Wed Sep 8 15:07:24 2021 +0200

        Feature/bond blockstamp (#760)

        * Add block_height to MixNode/GatewayBond

        * Reward based on blockstamp of bonded node or of delegation

        * Add specific tests

        * Add migration code

        * Apply doc nit

    commit 1074449f91
    Merge: 08276e6e 9a3d824a
    Author: Fouad <fmtabbara@hotmail.co.uk>
    Date:   Tue Sep 7 23:45:10 2021 +0100

        Merge pull request #767 from nymtech/update/remove-app-alert

        remove alert

    commit 08276e6e42
    Author: Bogdan-Ștefan Neacşu <bogdan@nymtech.net>
    Date:   Tue Sep 7 16:33:30 2021 +0200

        Remove migration code (#759)

    commit 9a3d824a4a
    Author: fmtabbara <fmtabbara@hotmail.co.uk>
    Date:   Mon Sep 6 20:39:24 2021 +0100

        remove alert

    commit 2789ee8f18
    Author: Bogdan-Ștefan Neacşu <bogdan@nymtech.net>
    Date:   Fri Sep 3 15:30:45 2021 +0300

        Update coconut-rs and use hash_to_scalar from there (#765)

        Failed tests are due to some nightly issue, not related to this PR

    commit a7ba643c35
    Merge: 28be53ee c42f3c68
    Author: Fouad <fmtabbara@hotmail.co.uk>
    Date:   Fri Sep 3 09:14:50 2021 +0100

        Merge pull request #762 from nymtech/feature/app-alert

        add app alert banner

    commit 28be53eefb
    Author: Bogdan-Ștefan Neacşu <bogdan@nymtech.net>
    Date:   Thu Sep 2 18:26:40 2021 +0300

        Add block_height in the Delegation structure as well (#757)

    commit 219c45a352
    Author: Jędrzej Stuczyński <jedrzej.stuczynski@gmail.com>
    Date:   Thu Sep 2 15:48:29 2021 +0100

        Updated cosmos-sdk (#761)

        * Updated cosmos-sdk

        * Re-exposing more things

    commit 1a3b83752e
    Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    Date:   Thu Sep 2 15:45:56 2021 +0100

        Bump next from 11.1.0 to 11.1.1 in /wallet-web (#758)

        Bumps [next](https://github.com/vercel/next.js) from 11.1.0 to 11.1.1.
        - [Release notes](https://github.com/vercel/next.js/releases)
        - [Changelog](https://github.com/vercel/next.js/blob/canary/release.js)
        - [Commits](https://github.com/vercel/next.js/compare/v11.1.0...v11.1.1)

        ---
        updated-dependencies:
        - dependency-name: next
          dependency-type: direct:production
        ...

        Signed-off-by: dependabot[bot] <support@github.com>

        Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

    commit c42f3c6844
    Author: fmtabbara <fmtabbara@hotmail.co.uk>
    Date:   Thu Sep 2 12:29:47 2021 +0100

        add app alert banner

    commit a5d3ba3900
    Merge: 92e13a5d cdf0d443
    Author: Mark Sinclair <mmsinclair@gmail.com>
    Date:   Tue Aug 31 15:59:11 2021 +0100

        Merge pull request #755 from nymtech/bugfix/explorer-api-ping

        Explorer API: port test now split out address resolution and add units tests

    commit cdf0d44341
    Author: Mark Sinclair <mmsinclair@gmail.com>
    Date:   Tue Aug 31 14:37:28 2021 +0100

        explorer-api: turned down logging from `error` to `warn`

    commit 92f976a45d
    Author: Mark Sinclair <mmsinclair@gmail.com>
    Date:   Fri Aug 27 11:34:21 2021 +0100

        explorer-api: sanitize hostname before running checks to avoid leading or trailing spaces that are known to exist in the current test net

    commit 2bc858cde3
    Author: Mark Sinclair <mmsinclair@gmail.com>
    Date:   Fri Aug 27 09:32:26 2021 +0100

        explorer-api: port test: split out address resolution and add units tests

    commit 92e13a5d00
    Author: Bogdan-Ștefan Neacşu <bogdan@nymtech.net>
    Date:   Tue Aug 31 14:51:15 2021 +0300

        Feature/add blockstamp (#756)

        * Add RawDelegationData

        * Fix current tests for the new stored data

        * Added migration commit. Will be reverted after doing the migration

        * New tests for block height

        * Use current blockstamp instead of 24h old one

        * Put _alot_ of migration stuff in the migrate function scope

    commit 122f5d9f2e
    Author: Bogdan-Ștefan Neacşu <bogdan@nymtech.net>
    Date:   Mon Aug 30 10:27:20 2021 +0300

        Feature/cred after handshake (#745)

        * Call perform_initial_authentication instead of register in clients

        * Refactor the register/authenticate functions a bit

        * Introduce Bandwidth request type

        * Add encryption layer to cred

        * Remove cred pass and check from handshake

        * Replaced unreachable!  with error

        * Changed decrypt_tagged signature to not take mutable ownership of data

        * Put handle_bandwidth work inside a function

        * Add check before unwrap

        * Remove unnecessary async

        * Decouple bandwidth credential from authentication

        * Use new_error for ServerResponse:Error

        * Send a fresh IV each time the BandwidthCredential request is sent

        * Remove unwrap of bincode::serialize

        * Add comment regarding Bandwidth response

        * Remove _mut from naming

        * Leave Debug trait alone, as the initial error doesn't reproduce anymore

        * Pass iv as Vec<u8> instead of base58 string

        * Renamed AuthenticationIV to IV, as it is now used for more the just authentication

        * Did some IV refactorization

    commit 982ee0266c
    Author: Bogdan-Ștefan Neacşu <bogdan@nymtech.net>
    Date:   Fri Aug 27 16:02:34 2021 +0300

        Feature/get own delegations (#748)

        * Introduce reverse delegation bucket

        * Add client command

        * Fix clippy error

        * Added tests in queries

        * Add tests in transactions

        * Migration code. Will be reverted after it's called on testnet

        * Replace unwrap with expect

        * Move some test code in the right file...

        ... to remove unnecessary auxiliary function.

        * Reduce the scope to migration auxiliary functions

        * Rename everything from [node]reverse to reverse[node]

        * Fix fmt

    commit 5f42a9bd05
    Author: Jędrzej Stuczyński <jedrzej.stuczynski@gmail.com>
    Date:   Fri Aug 27 13:52:18 2021 +0100

        NetworkMonitorBuilder - starting the monitor after rocket has launched (#754)

        * NetworkMonitorBuilder - starting the monitor after rocket has launched

        * Removed unused import

    commit 1811df9ddb
    Author: Jędrzej Stuczyński <jedrzej.stuczynski@gmail.com>
    Date:   Fri Aug 27 13:52:10 2021 +0100

        Enabled validators api argument (#753)

    commit 6bdfe7f895
    Author: Jędrzej Stuczyński <jedrzej.stuczynski@gmail.com>
    Date:   Thu Aug 26 11:21:01 2021 +0100

        Correctly bounding nominator of uptime calculation (#752)

    commit c6b286a1db
    Author: Jędrzej Stuczyński <jedrzej.stuczynski@gmail.com>
    Date:   Wed Aug 25 14:50:57 2021 +0100

        Fixed argument parsing for ipv6 'good' topology (#751)

    commit b3568a26f5
    Author: Bogdan-Ștefan Neacşu <bogdan@nymtech.net>
    Date:   Tue Aug 24 11:25:05 2021 +0300

        Revert "Migration commit, will be reverted after the testnet contract is updated" (#749)

        This reverts commit 38d868bcce.

    commit 15ae0f521e
    Author: Jędrzej Stuczyński <jedrzej.stuczynski@gmail.com>
    Date:   Mon Aug 23 10:26:51 2021 +0100

        Feature/more reliable uptime calculation (#747)

        * New database table holding monitor run info

        * SQL interface for new table

        * Updated uptime calculation to instead rely on number of monitor test runs

    commit 2923d4b872
    Author: Bogdan-Ștefan Neacşu <bogdan@nymtech.net>
    Date:   Thu Aug 19 22:03:07 2021 +0300

        Update template toml key (#746)

commit cddd9e8e4c
Merge: 40fbdff0 976dd7aa
Author: Drazen Urch <durch@users.noreply.guthub.com>
Date:   Thu Sep 16 17:27:27 2021 +0200

    Merge branch 'develop' into tauri-wallet

commit 63bc42cd5f
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Thu Sep 16 10:01:53 2021 +0100

    update title

commit 9dc8ba7b77
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Wed Sep 15 21:39:18 2021 +0100

    funds allocation check when bonding/sending/delegating

commit e130131f16
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Wed Sep 15 20:37:24 2021 +0100

    finish bonding and unbonding setup

commit 64a5b4b593
Merge: 9934b9bc 40fbdff0
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Tue Sep 14 12:08:38 2021 +0100

    Merge branch 'tauri-wallet' into tauri-wallet-frontend
    rust updates

commit 40fbdff05a
Author: Drazen Urch <durch@users.noreply.guthub.com>
Date:   Tue Sep 14 10:29:31 2021 +0200

    Coin and denom tests

commit 9934b9bc8a
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Mon Sep 13 15:20:56 2021 +0100

    update working

commit 6954b383a7
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Mon Sep 13 14:26:21 2021 +0100

    form updates

commit 4b5276e816
Merge: 56a95274 0278bd2c
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Mon Sep 13 13:32:24 2021 +0100

    Merge branch 'tauri-wallet' into tauri-wallet-frontend
    rust updates

commit 0278bd2c26
Author: Drazen Urch <durch@users.noreply.guthub.com>
Date:   Mon Sep 13 14:31:33 2021 +0200

    Fix coin to cosmwasm coin

commit 56a9527497
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Mon Sep 13 13:30:05 2021 +0100

    use wrapper functions for send and delegate

commit a601c28a20
Author: Drazen Urch <durch@users.noreply.guthub.com>
Date:   Mon Sep 13 13:07:57 2021 +0200

    Return useful info from bond/unbond

commit 005dd7513b
Merge: 3ebdc558 aaf5d186
Author: Drazen Urch <durch@users.noreply.guthub.com>
Date:   Mon Sep 13 12:58:01 2021 +0200

    Merge branch 'tauri-wallet-frontend' into tauri-wallet

commit 3ebdc55847
Author: Drazen Urch <durch@users.noreply.guthub.com>
Date:   Mon Sep 13 12:50:26 2021 +0200

    extract Coin and Denom

commit aaf5d18692
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Mon Sep 13 11:19:28 2021 +0100

    update admin component

commit bcbec1f3e6
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Sun Sep 12 21:49:39 2021 +0100

    admin form style updates

commit c95005265d
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Sun Sep 12 01:26:57 2021 +0100

    button updates

commit b299c9e4b5
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Sun Sep 12 01:03:21 2021 +0100

    add qrcode to receive page

commit bacbd3dfce
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Sun Sep 12 00:40:53 2021 +0100

    fix bug

commit 55561fe1f7
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Sun Sep 12 00:26:15 2021 +0100

    add admin page

commit 0d01500b87
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Sat Sep 11 00:35:14 2021 +0100

    remove login deets

commit 74e34567b4
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Sat Sep 11 00:32:54 2021 +0100

    form updates

commit b77025bfd5
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Sat Sep 11 00:10:03 2021 +0100

    form updates

commit 4d831efcd6
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Fri Sep 10 22:33:00 2021 +0100

    more fees work

commit d227d20385
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Fri Sep 10 17:31:04 2021 +0100

    add gas fees to bond form

commit fb2d3bae3c
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Fri Sep 10 14:17:24 2021 +0100

    use new getFee api

commit 967d74eb19
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Fri Sep 10 11:15:52 2021 +0100

    add nvmrc file

commit 228df278d9
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Fri Sep 10 11:13:18 2021 +0100

    update tsconfig

commit 37da23ab1c
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Fri Sep 10 09:56:04 2021 +0100

    set up global error handling

commit 0c9cf7b5d9
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Fri Sep 10 09:16:45 2021 +0100

    finish create account

commit 262149078c
Merge: 08fd1c1b 3bcbb901
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Thu Sep 9 19:21:38 2021 +0100

    rust updates

commit 08fd1c1b47
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Thu Sep 9 19:00:30 2021 +0100

    make getBalance global

commit 3bcbb90127
Author: Drazen Urch <durch@users.noreply.guthub.com>
Date:   Thu Sep 9 17:47:11 2021 +0200

    fix docs

commit 8156ed0029
Author: Drazen Urch <durch@users.noreply.guthub.com>
Date:   Thu Sep 9 17:43:56 2021 +0200

    get_fee, create_new_account

commit 265f7a7c2e
Author: Drazen Urch <durch@users.noreply.guthub.com>
Date:   Thu Sep 9 13:21:27 2021 +0200

    Dedicated workspace, random_mnemonic, gas_limits

commit 5de8c9d1ed
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Thu Sep 9 11:35:49 2021 +0100

    style updates

commit 7658eec9b9
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Thu Sep 9 09:16:38 2021 +0100

    create account page

commit 99c49581df
Merge: 7a8ad138 926689da
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Wed Sep 8 20:49:27 2021 +0100

    Merge branch 'tauri-wallet' into tauri-wallet-frontend
    rust updates

commit 926689da1d
Merge: 714171f4 b40be179
Author: Drazen Urch <durch@users.noreply.guthub.com>
Date:   Wed Sep 8 11:54:49 2021 +0200

    Merge branch 'tauri-wallet' of https://github.com/nymtech/nym into tauri-wallet

commit 714171f4e5
Author: Drazen Urch <durch@users.noreply.guthub.com>
Date:   Wed Sep 8 11:54:36 2021 +0200

    redundant into

commit 7a8ad1387d
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Wed Sep 8 10:30:51 2021 +0100

    add eslint file

commit bd72426280
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Tue Sep 7 23:44:02 2021 +0100

    start adding gas fees

commit 48d0f31d7e
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Tue Sep 7 23:13:54 2021 +0100

    send updates

commit 4522c18a55
Merge: b9389f12 b40be179
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Tue Sep 7 21:53:38 2021 +0100

    Merge branch 'tauri-wallet' into tauri-wallet-frontend
    rust updates

commit b9389f1235
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Tue Sep 7 21:53:05 2021 +0100

    send updates

commit b40be179ae
Author: durch <durch@users.noreply.github.com>
Date:   Tue Sep 7 12:37:24 2021 +0000

    [ci skip] Generate TS types

commit 32ef9e019e
Author: Drazen Urch <durch@users.noreply.guthub.com>
Date:   Tue Sep 7 14:26:48 2021 +0200

    More verbose send response

commit 45a56a7088
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Mon Sep 6 20:27:15 2021 +0100

    update logo

commit d50afd6113
Author: Drazen Urch <durch@users.noreply.guthub.com>
Date:   Mon Sep 6 20:00:47 2021 +0200

    Add coconut creds

commit 3205b1e0e6
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Mon Sep 6 16:42:56 2021 +0100

    start work on send form

commit 53ea8486f8
Author: Drazen Urch <durch@users.noreply.guthub.com>
Date:   Mon Sep 6 17:36:46 2021 +0200

    get_gas_price, get_gas_limits

commit 43ababf8d4
Author: Drazen Urch <durch@users.noreply.guthub.com>
Date:   Mon Sep 6 17:31:08 2021 +0200

    Rework client errors

commit 5461574023
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Mon Sep 6 13:23:20 2021 +0100

    small refactors

commit 01d2df7bb7
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Mon Sep 6 11:12:39 2021 +0100

    set up form validation for undelegation

commit 7cff72757b
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Sun Sep 5 00:07:46 2021 +0100

    set up delgate request

commit 5bcbf45d16
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Sat Sep 4 22:52:02 2021 +0100

    onerror onsuccess added to bond form

commit 4295d75e0f
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Fri Sep 3 16:53:32 2021 +0100

    format bonding data pre request

commit 018666a614
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Fri Sep 3 16:37:51 2021 +0100

    layout updates

commit 15048524a7
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Fri Sep 3 16:25:15 2021 +0100

    layout updates

commit 2b792945cc
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Fri Sep 3 15:07:38 2021 +0100

    update type roots

commit b6193270a6
Merge: 0b4a8fe6 29973379
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Fri Sep 3 15:02:56 2021 +0100

    Merge branch 'tauri-wallet' into tauri-wallet-frontend
    rust updates

commit 0b4a8fe657
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Fri Sep 3 15:02:09 2021 +0100

    update type roots

commit 2997337948
Author: Drazen Urch <durch@users.noreply.guthub.com>
Date:   Fri Sep 3 15:29:20 2021 +0200

    printable balance should be major

commit e1bea43ff4
Author: Drazen Urch <drazen@urch.eu>
Date:   Fri Sep 3 15:22:48 2021 +0200

    Autogenerate types (#763)

    * Generate TS types on push

    * run shell

    * fix typo

    * pango

    * libpango-dev

    * hopefully all deps are in now :)

    Co-authored-by: Drazen Urch <durch@users.noreply.guthub.com>

commit 27ef28da8d
Merge: 42bf139e 87a0b05d
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Fri Sep 3 12:13:28 2021 +0100

    Merge branch 'tauri-wallet' into tauri-wallet-frontend
    rust updates

commit 42bf139ebb
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Fri Sep 3 12:12:52 2021 +0100

    update args collection function

commit 352862e4d0
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Fri Sep 3 11:42:31 2021 +0100

    delegation form validation

commit 9f9ab010d8
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Fri Sep 3 11:39:17 2021 +0100

    integrate rust generated types

commit 87a0b05d1a
Author: Drazen Urch <drazen@urch.eu>
Date:   Fri Sep 3 07:43:29 2021 +0200

    Send

commit dbf82da9b6
Author: Drazen Urch <drazen@urch.eu>
Date:   Fri Sep 3 07:36:02 2021 +0200

    Delegation docs

commit 01a4305883
Author: Drazen Urch <drazen@urch.eu>
Date:   Fri Sep 3 07:33:11 2021 +0200

    Delegation

commit 704b3241ee
Author: Drazen Urch <drazen@urch.eu>
Date:   Fri Sep 3 06:58:57 2021 +0200

    Gateway bonding

commit 4513edae46
Merge: 5d3f1b86 f020b211
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Thu Sep 2 21:38:19 2021 +0100

    rust updates

commit f020b21106
Author: Drazen Urch <durch@users.noreply.guthub.com>
Date:   Thu Sep 2 21:08:19 2021 +0200

    node unbond

commit 2587906473
Author: Drazen Urch <durch@users.noreply.guthub.com>
Date:   Thu Sep 2 20:57:10 2021 +0200

    TS exports, rework internals

commit 5d3f1b86e8
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Thu Sep 2 17:29:03 2021 +0100

    delegate form validation

commit 5a17e48581
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Thu Sep 2 16:11:54 2021 +0100

    finish bond form validation

commit 41356f2181
Merge: bd7d7887 63107c2b
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Thu Sep 2 10:10:55 2021 +0100

    Merge branch 'tauri-wallet' into tauri-wallet-frontend
    merge rust updates

commit bd7d788741
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Thu Sep 2 10:10:18 2021 +0100

    more validation work

commit 63107c2bca
Author: Drazen Urch <drazen@urch.eu>
Date:   Thu Sep 2 10:27:49 2021 +0200

    WIP node bonding

commit f043639ad2
Merge: 1d2a1b26 6fb15fff
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Wed Sep 1 19:48:22 2021 +0100

    Merge branch 'tauri-wallet' into tauri-wallet-frontend
    merge rust update

commit 1d2a1b2635
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Wed Sep 1 19:47:41 2021 +0100

    start form validation

commit 6fb15fff8b
Author: Drazen Urch <durch@users.noreply.guthub.com>
Date:   Wed Sep 1 16:33:29 2021 +0200

    printable_balance

commit c69d7fa46f
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Wed Sep 1 15:12:50 2021 +0100

    remove unused imports

commit c2ee02a2cf
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Wed Sep 1 15:12:25 2021 +0100

    use printable balance

commit 6f5f0c00b5
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Wed Sep 1 15:11:24 2021 +0100

    use printable balance

commit 12707c5f1e
Merge: 2aa7fa04 0daf89ee
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Wed Sep 1 14:59:27 2021 +0100

    merge rust updates

commit 0daf89eeb4
Author: Drazen Urch <drazen@urch.eu>
Date:   Wed Sep 1 15:14:50 2021 +0200

    Utility native <> printable functions

commit 2aa7fa0426
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Wed Sep 1 13:41:42 2021 +0100

    move balance function call to global state

commit f5aa6e2db2
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Wed Sep 1 09:39:22 2021 +0100

    style updates

commit ee5d1c3419
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Tue Aug 31 20:57:21 2021 +0100

    fix nav styling

commit e68c261162
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Tue Aug 31 20:48:30 2021 +0100

    fix ts error

commit c7fe4cd24e
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Tue Aug 31 15:28:46 2021 +0100

    update imports

commit 1c690fc3d0
Merge: d8e6a5fb f56edb82
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Tue Aug 31 15:24:35 2021 +0100

    Merge branch 'tauri-wallet' into tauri-wallet-frontend
    merge rust updates

commit f56edb825a
Author: Drazen Urch <durch@users.noreply.guthub.com>
Date:   Tue Aug 31 15:22:10 2021 +0200

    Fix client address

commit d8e6a5fb2e
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Tue Aug 31 12:55:13 2021 +0100

    make typescript happy

commit b95893bb02
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Tue Aug 31 11:20:12 2021 +0100

    update balance page

commit 6bdff701b4
Merge: ccdb5911 eff38c84
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Tue Aug 31 11:05:51 2021 +0100

    merge backend updates

commit ccdb5911c6
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Tue Aug 31 09:35:24 2021 +0100

    update routing and use new sign in function

commit eff38c8466
Author: Drazen Urch <durch@users.noreply.guthub.com>
Date:   Tue Aug 31 07:38:25 2021 +0200

    some cleanup, get blockchain stuff working

commit 5f4fabc0b8
Author: Drazen Urch <durch@users.noreply.guthub.com>
Date:   Fri Aug 27 15:17:15 2021 +0200

    Add internal documentation scaffolding

commit e2dd1cc9ae
Merge: c7e622f2 42f75028
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Wed Aug 25 14:51:29 2021 +0100

    Merge branch 'tauri-wallet' into tauri-wallet-frontend
    connect with mnemonic update

commit 42f75028bc
Author: Drazen Urch <durch@users.noreply.guthub.com>
Date:   Wed Aug 25 15:44:08 2021 +0200

    Resolve state deadlock

commit c7e622f284
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Wed Aug 25 14:06:37 2021 +0100

    begin sign in rust integration

commit 248da351c6
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Wed Aug 25 14:05:00 2021 +0100

    use color palette object

commit fe1c8a3b08
Merge: 84af9233 1bc17abb
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Wed Aug 25 10:36:11 2021 +0100

    Merge branch 'tauri-wallet' into tauri-wallet-frontend
    merge rust api updates

commit 84af923389
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Wed Aug 25 10:35:42 2021 +0100

    update receive to use state value

commit 1bc17abbaa
Author: Drazen Urch <drazen@urch.eu>
Date:   Wed Aug 25 11:18:16 2021 +0200

    Add connect_with_mnemonic and get_balance tauri functions

commit b8c2735520
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Tue Aug 24 16:12:08 2021 +0100

    cargo lock update

commit 67fd4367ef
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Tue Aug 24 16:08:55 2021 +0100

    global theme update

commit 4540d2c447
Merge: ce757697 4ad25114
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Tue Aug 24 12:56:59 2021 +0100

    Merge branch 'feature/tauri-wallet-ui' into tauri-wallet
    merge with rust updates

commit 4ad25114c3
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Tue Aug 24 12:46:34 2021 +0100

    update nav cards

commit 3ce7888c07
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Tue Aug 24 11:59:10 2021 +0100

    address and balance cards

commit ce75769703
Author: Drazen Urch <drazen@urch.eu>
Date:   Tue Aug 24 12:54:49 2021 +0200

    Bootstrap nymd client with config

commit 66210658cb
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Tue Aug 24 10:35:54 2021 +0100

    add favicon

commit 728da763b3
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Mon Aug 23 22:54:30 2021 +0100

    fix padding issue

commit 3da08ee33c
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Mon Aug 23 22:49:39 2021 +0100

    style updates

commit 55977185fd
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Mon Aug 23 22:04:26 2021 +0100

    add unbond and undelegte pages

commit 1c8c0a47bc
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Mon Aug 23 21:34:14 2021 +0100

    receive page adjust margin

commit c161b2fe71
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Mon Aug 23 21:32:29 2021 +0100

    send wizard updates

commit eb91c1180d
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Mon Aug 23 17:23:25 2021 +0100

    update balance page

commit 13e357637b
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Mon Aug 23 17:18:07 2021 +0100

    style updates

commit 54c4bdb7d2
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Mon Aug 23 17:12:40 2021 +0100

    send wizard update

commit 9b5f50913f
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Mon Aug 23 14:56:52 2021 +0100

    add send wizard

commit 7cfa35b542
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Mon Aug 23 11:18:13 2021 +0100

    style updates

commit 581a6b0a6f
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Mon Aug 23 10:38:56 2021 +0100

    update nav bar

commit 85f23eb3d1
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Mon Aug 23 10:38:42 2021 +0100

    create delegation page

commit 17100fa7da
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Mon Aug 23 10:38:17 2021 +0100

    create node type selector component

commit 24af0c94bf
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Fri Aug 20 22:26:14 2021 +0100

    add bond form

commit 8ec9e3121f
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Fri Aug 20 17:35:59 2021 +0100

    side bar updates

commit 498dbb8ba3
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Fri Aug 20 12:24:04 2021 +0100

    add balance page

commit 7345bd8148
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Fri Aug 20 11:51:27 2021 +0100

    update navigation style

commit b405d2e4af
Author: fmtabbara <fmtabbara@hotmail.co.uk>
Date:   Fri Aug 20 09:03:21 2021 +0100

    set up tauri app with React frontend
2021-09-27 12:03:54 +02:00
Jędrzej Stuczyński 020cad897d Feature/rust rewarding (#750)
* Calculating gas fees

* Ability to set custom fees

* Added extra test

* Removed commented code

* Moved all msg types to common contract crate

* Temporarily disabling get_tx method

* Finishing up nymd client API

* Comment fix

* Remaining fee values

* Some cleanup

* Removed needless borrow

* Fixed imports in contract tests

* Moved error types around

* New ValidatorClient

* Experiment with new type of defaults

* Removed dead module

* Dealt with unwrap

* Migrated mixnode to use new validator client

* Migrated gateway to use new validator client

* Mixnode and gateway adjustments

* More exported defaults

* Clients using new validator client

* Fixed mixnode upgrade

* Moved default values to a new crate

* Changed behaviour of validator client features

* Migrated basic functions of validator api

* Updated config + fixed startup

* Fixed wasm client build

* Integration with the explorer api

* Removed tokio dev dependency

* Needless borrow

* Fixex wasm client build

* Fixed tauri client build

* Needless borrows

* New tables for rewarding

* Updated cosmos-sdk version

* Removed reward-specific node status routes

* New rewarding-specific config entries

* Additional network defaults

* Initial periodic rewards from validator api

* Replaced print with log

* Filtering nodes with uptime > 0

* Additional failure logging statements

* Fixed operation ordering

* Adjusted next rewarding epoch determination

* Modified rewarding behaviour to keep track of rewarding in progress

* Improved error message on config load failure

* Additional log statement

* Adjusted rewarding gas limit calculation

* Made naming slightly more consistent

* Fixed incorrect parentheses placement

* Fixed fee calculation

* Cargo fmt

* Removed failed merge artifacts

* Introduced comment for any future reward modification

* typos

* Helper functions for the future

* Making @mfahampshire 's life easier

* Redesigned epoch + rewarding skipped epochs (if possible)

* Removed old merge artifacts

* Naming consistency

* Constraining arguments

* Removed unnecessary if branch

* Ignore monitor check for current epoch

* Additional checks for current epoch data

* Monitor threshold check

* cargo fmt

* Fixed post-merge issues in transactions.rs
2021-09-24 15:49:21 +01:00
Drazen Urch 5dfaff6296 Update hmac and blake3 (#673)
* Update hmac and blake3

* Remain paranoid for `0.*` crates

* Most paranoid versions :)

* Updated aes and using published version of blake3

Co-authored-by: Jędrzej Stuczyński <jedrzej.stuczynski@gmail.com>
2021-09-21 09:59:17 +01:00
Jędrzej Stuczyński 5b03982043 Replaced unwrap_or_else with unwrap_or_default (#780) 2021-09-20 10:40:03 +01:00
Drazen Urch 8f6856d6fb Make fee helpers public (#777)
Co-authored-by: Drazen Urch <durch@users.noreply.guthub.com>
2021-09-20 10:15:06 +01:00
Drazen Urch 976dd7aae2 Add block_height method to Delegation (#778)
Co-authored-by: Drazen Urch <durch@users.noreply.guthub.com>
2021-09-15 17:28:49 +02:00
Fouad 0d21f4e937 Merge pull request #776 from nymtech/update/re-enable-bonding
re-enable bonding
2021-09-15 12:41:29 +01:00
fmtabbara 1403449ad5 enable bonding 2021-09-14 16:00:21 +01:00
Drazen Urch e84af4f601 Migrate legacy delegation data (#771)
* Skip ReadOnlyBucket deserialization errors

* empty migration

* clippy

* cargo schema

* Drop invalid delegation data

* Dont drop old data

* Add todo

* Unify on type param

* gateways are different

* cargo fmt

Co-authored-by: Drazen Urch <durch@users.noreply.guthub.com>
2021-09-14 14:15:26 +01:00
Mark Sinclair 26b032c15c Merge pull request #774 from nymtech/feature/explorer-api-delegations
Explorer-api: add API resource to show the delegations for each mix node
2021-09-14 10:09:14 +01:00
Mark Sinclair cba3625394 explorer-api: add API resource to show the delegations for each mix node 2021-09-13 10:46:57 +01:00
Fouad e1ddaff04d Merge pull request #772 from nymtech/update/disable-bonding
add app alert
2021-09-10 17:17:14 +01:00
fmtabbara 66ab5de442 add app alert 2021-09-10 16:16:58 +01:00
Dave Hrycyszyn 0b9c03ca90 Adding deps for building the Tauri wallet under Ubuntu (#770) 2021-09-10 10:23:21 +02:00
Bogdan-Ștefan Neacşu c9dce0c1da Feature/consumable bandwidth (#766)
* Set actual value for bandwidth

Also put it as a public attribute, such that it can be actively used
by the credential consumer

* Switch from sending Attribute structs to sending the actual attribute bytes over the wire

* Add atomic bandwidth value to gateway

* Consume bandwidth based on the mix packet size

* Use Bandwidth struct for specific functionality

* Move bandwidth code outside the dependency path of wasm client

* Use u64 instead of AtomicU64, as the handling is not parallel
2021-09-09 11:21:45 +02:00
Bogdan-Ștefan Neacşu e00e77db15 Feature/bond blockstamp (#760)
* Add block_height to MixNode/GatewayBond

* Reward based on blockstamp of bonded node or of delegation

* Add specific tests

* Add migration code

* Apply doc nit
2021-09-08 15:07:24 +02:00
Fouad 1074449f91 Merge pull request #767 from nymtech/update/remove-app-alert
remove alert
2021-09-07 23:45:10 +01:00
Bogdan-Ștefan Neacşu 08276e6e42 Remove migration code (#759) 2021-09-07 16:33:30 +02:00
fmtabbara 9a3d824a4a remove alert 2021-09-06 20:39:24 +01:00
Bogdan-Ștefan Neacşu 2789ee8f18 Update coconut-rs and use hash_to_scalar from there (#765)
Failed tests are due to some nightly issue, not related to this PR
2021-09-03 15:30:45 +03:00
Fouad a7ba643c35 Merge pull request #762 from nymtech/feature/app-alert
add app alert banner
2021-09-03 09:14:50 +01:00
Bogdan-Ștefan Neacşu 28be53eefb Add block_height in the Delegation structure as well (#757) 2021-09-02 18:26:40 +03:00
Jędrzej Stuczyński 219c45a352 Updated cosmos-sdk (#761)
* Updated cosmos-sdk

* Re-exposing more things
2021-09-02 15:48:29 +01:00
dependabot[bot] 1a3b83752e Bump next from 11.1.0 to 11.1.1 in /wallet-web (#758)
Bumps [next](https://github.com/vercel/next.js) from 11.1.0 to 11.1.1.
- [Release notes](https://github.com/vercel/next.js/releases)
- [Changelog](https://github.com/vercel/next.js/blob/canary/release.js)
- [Commits](https://github.com/vercel/next.js/compare/v11.1.0...v11.1.1)

---
updated-dependencies:
- dependency-name: next
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-09-02 15:45:56 +01:00
fmtabbara c42f3c6844 add app alert banner 2021-09-02 12:29:47 +01:00
Mark Sinclair a5d3ba3900 Merge pull request #755 from nymtech/bugfix/explorer-api-ping
Explorer API: port test now split out address resolution and add units tests
2021-08-31 15:59:11 +01:00
Mark Sinclair cdf0d44341 explorer-api: turned down logging from error to warn 2021-08-31 14:37:28 +01:00
Mark Sinclair 92f976a45d explorer-api: sanitize hostname before running checks to avoid leading or trailing spaces that are known to exist in the current test net 2021-08-31 14:32:32 +01:00
Mark Sinclair 2bc858cde3 explorer-api: port test: split out address resolution and add units tests 2021-08-31 14:32:32 +01:00
Bogdan-Ștefan Neacşu 92e13a5d00 Feature/add blockstamp (#756)
* Add RawDelegationData

* Fix current tests for the new stored data

* Added migration commit. Will be reverted after doing the migration

* New tests for block height

* Use current blockstamp instead of 24h old one

* Put _alot_ of migration stuff in the migrate function scope
2021-08-31 14:51:15 +03:00
Bogdan-Ștefan Neacşu 122f5d9f2e Feature/cred after handshake (#745)
* Call perform_initial_authentication instead of register in clients

* Refactor the register/authenticate functions a bit

* Introduce Bandwidth request type

* Add encryption layer to cred

* Remove cred pass and check from handshake

* Replaced unreachable!  with error

* Changed decrypt_tagged signature to not take mutable ownership of data

* Put handle_bandwidth work inside a function

* Add check before unwrap

* Remove unnecessary async

* Decouple bandwidth credential from authentication

* Use new_error for ServerResponse:Error

* Send a fresh IV each time the BandwidthCredential request is sent

* Remove unwrap of bincode::serialize

* Add comment regarding Bandwidth response

* Remove _mut from naming

* Leave Debug trait alone, as the initial error doesn't reproduce anymore

* Pass iv as Vec<u8> instead of base58 string

* Renamed AuthenticationIV to IV, as it is now used for more the just authentication

* Did some IV refactorization
2021-08-30 10:27:20 +03:00
Bogdan-Ștefan Neacşu 982ee0266c Feature/get own delegations (#748)
* Introduce reverse delegation bucket

* Add client command

* Fix clippy error

* Added tests in queries

* Add tests in transactions

* Migration code. Will be reverted after it's called on testnet

* Replace unwrap with expect

* Move some test code in the right file...

... to remove unnecessary auxiliary function.

* Reduce the scope to migration auxiliary functions

* Rename everything from [node]reverse to reverse[node]

* Fix fmt
2021-08-27 16:02:34 +03:00
Jędrzej Stuczyński 5f42a9bd05 NetworkMonitorBuilder - starting the monitor after rocket has launched (#754)
* NetworkMonitorBuilder - starting the monitor after rocket has launched

* Removed unused import
2021-08-27 13:52:18 +01:00
Jędrzej Stuczyński 1811df9ddb Enabled validators api argument (#753) 2021-08-27 13:52:10 +01:00
Jędrzej Stuczyński 6bdfe7f895 Correctly bounding nominator of uptime calculation (#752) 2021-08-26 11:21:01 +01:00
Jędrzej Stuczyński c6b286a1db Fixed argument parsing for ipv6 'good' topology (#751) 2021-08-25 14:50:57 +01:00
Bogdan-Ștefan Neacşu b3568a26f5 Revert "Migration commit, will be reverted after the testnet contract is updated" (#749)
This reverts commit 38d868bcce.
2021-08-24 11:25:05 +03:00
Jędrzej Stuczyński 15ae0f521e Feature/more reliable uptime calculation (#747)
* New database table holding monitor run info

* SQL interface for new table

* Updated uptime calculation to instead rely on number of monitor test runs
2021-08-23 11:26:51 +02:00
Bogdan-Ștefan Neacşu 2923d4b872 Update template toml key (#746) 2021-08-19 21:03:07 +02:00
Bogdan-Ștefan Neacşu d740e8b8a9 Reinstate the POST method blind_sign (#744) 2021-08-18 18:31:12 +03:00
Jędrzej Stuczyński a274edffba Feature/nymd client integration (#736)
* Calculating gas fees

* Ability to set custom fees

* Added extra test

* Removed commented code

* Moved all msg types to common contract crate

* Temporarily disabling get_tx method

* Finishing up nymd client API

* Comment fix

* Remaining fee values

* Some cleanup

* Removed needless borrow

* Fixed imports in contract tests

* Moved error types around

* New ValidatorClient

* Experiment with new type of defaults

* Removed dead module

* Dealt with unwrap

* Migrated mixnode to use new validator client

* Migrated gateway to use new validator client

* Mixnode and gateway adjustments

* More exported defaults

* Clients using new validator client

* Fixed mixnode upgrade

* Moved default values to a new crate

* Changed behaviour of validator client features

* Migrated basic functions of validator api

* Updated config + fixed startup

* Fixed wasm client build

* Integration with the explorer api

* Removed tokio dev dependency

* Needless borrow

* Fixex wasm client build

* Fixed tauri client build

* Needless borrows

* Fixed client upgrade print

* Removed redundant comments

* Made note on aggregated verification key into a doc comment

* Removed mixnet contract references from verloc

* Modified default validators structure

* Reformatted validator-api Cargo.toml file

* Removed commented code

* Made the doc comment example a no-run

* Fixed a upgrade print... again

* Adjusted the doc example

* Removed unused import
2021-08-18 14:41:00 +01:00
Bogdan-Ștefan Neacşu eec211e038 Feature/use delegation rates (#741)
* Rename storage read functions for bond reward rates

* Add reward values per epoch in State

Calculate delegation rewards per epoch for mixnodes and gateways, which
are used when the delegators are rewarded for their stake.

* Migration commit, will be reverted after the testnet contract is updated
2021-08-18 16:24:00 +03:00
Mark Sinclair f5f888a0aa Merge pull request #742 from nymtech/feature/explorer-api-pending-ping
explorer-api: add pending field to port check response
2021-08-17 12:59:47 +01:00
Fouad 86ec1d6026 Feature/copy to clipboard (#740)
* add copy to clipboard component

* use fab button

* use regular button

* remove unneeded config
2021-08-16 17:45:41 +01:00
Mark Sinclair bc3f5838f1 explorer-api: add pending field to port check response 2021-08-16 17:29:51 +01:00
Bogdan-Ștefan Neacşu 7e58b3273d Feature/update wallet with stake rates (#739)
* Replace `BondMixnode` with `Bond` on frontend

* Update wallet to use stake reward rates
2021-08-16 12:24:17 +03:00
Bogdan-Ștefan Neacşu bed09bf8a4 Add stake reward rates and bump version of client (#738)
* Tiny PR to add stake reward rates and bump version

This is needed so that we can publish the 0.17 version.

* Add the changes to contracts as well

On second thought, update the contract together with the client, and
leave the wallet changes for another PR.

* Rename _stake_ to _delegation_
2021-08-16 11:43:24 +03:00
Drazen Urch 28e55c6de6 Hang coconut issuance off the validator-api (#679)
* Hand coconut issuance off the validator-api

* git to cargo

* Move to own module

* Integrate tauri-client, extract common interface

* cargo fmt

* Ergonomics

* Facelift

* Wrap up tauri client

* Set up publish

* Fix fmt

* Install CI dependencies

* Inline deps

* Remove mac deps

* Add dist dir

* Fix beta clippy nag

* Commit some gateway work

* Thread coconut creds through gateway handshake

* Push in progress patch

* Move State from tauri client to coconut interface

* Move get_aggregated_signature from tauri client to coconut interface

* Move prove_credential from tauri client to coconut interface

* Update sphinx version

* Mount coconut routes and manage config file in rocket

* Split default validator endpoint into host and port

* Add init for simple credential initialization

* Fix common gateway client

* Add coconut cred to webassembly client

* Add coconut cred to socks5 client

* Add coconut cred to native client

* Remove direct coconut-rs dependency

* Use only coconut interface in validator api

* Leave validator-api out of workspace and update Cargo.lock

* Fix clippy warnings and update Cargo.lock after rebase

* Switch from attohttpc to reqwest for async gets

This is not only needed for using async requests, but also because attohttpc
causes OpenSSL issues when cross compiling the webassembly client.

* Replace attohttpc with reqwest for puts too

* Make tauri client commands async

* Fix borrow error

* Guard gateway server code from compiling for wasm (client)

* Fix clippy wasm client

* Fix tests

* Fix clippy in tauri client

* Remove commented code

* Update comment of init message

* Remove unnecessary hex dependency

* Replace config argument with key_pair

* Use `trim()` for whitespace removal

* Move verification key query higher up the function calls

* Put KeyPair instead of Config into rocket's managed items

* Re-enable tauri client verify button

* Move verification key up the function calls for prove_credential

* Use consts for verification_key and blind_sign routes of validator-api

* Replace `match` with `map_err`

* Fix typo

* Remove now unnecessary `Clone` derives

... as config is no longer managed by rocket

* Replace `match` with `map_err`

* Make `InternalSignRequest` really internal to validator-api

* Make `with_keypair` live up to its name

* Update Cargo.lock after rebase

* Replace String error with HandshakeError

* Add CoconutInterfaceError to coconut-interface

* Format the new error in tauri client

* Remove  from default, as wasm client doesn't build

* Put public key as init argument...

... for the public attributes of the credential

* Use the hash_to_scalar function to make public key into attribute

Use the function from cli-demo-rs from https://github.com/nymtech/coconut
to make the identity public key into a public attribute.

* Replace vector with array for InitMessage

As we know beforehand the size of the keys, we can use fixed size array
instead of vectors. This eliminates the need for a prefixed length in
the serialized form of the InitMessage structure and enables a easy
deserialization of the remote identity before the actual bincode
deserialization that we do in the handshake process.

Before this, the `extract_remote_identity_from_register_init` function
attempted to deserialize into a public key the length-prefixed public key
received from the client, thus failing sporadically with a `Cannot decompress
Edwards point` error.

* Pass public and private attributes to state `init` instead of PublicKey

* Make tauri call with dummy attributes

* Make clients call with their keypairs

* Revert "Make clients call with their keypairs"

This reverts commit b348f47f7a.

* Put dummy, bandwidth private attribute

Co-authored-by: Bogdan-Ștefan Neacșu <bogdan@nymtech.net>
2021-08-13 14:27:40 +03:00
Bogdan-Ștefan Neacşu abb4537551 Switch from wasm-timer to fluvio-wasm-timer... (#735)
... which addresses the problem from https://github.com/Amanieu/parking_lot/issues/269
by taking the unmerged workaround of https://github.com/tomaka/wasm-timer/pull/13 ,
as wasm-timer appears to be unmaintained.
2021-08-13 09:44:29 +01:00
dependabot[bot] b48f2f1660 Bump next from 10.1.3 to 11.1.0 in /wallet-web (#737)
Bumps [next](https://github.com/vercel/next.js) from 10.1.3 to 11.1.0.
- [Release notes](https://github.com/vercel/next.js/releases)
- [Changelog](https://github.com/vercel/next.js/blob/canary/release.js)
- [Commits](https://github.com/vercel/next.js/compare/v10.1.3...v11.1.0)

---
updated-dependencies:
- dependency-name: next
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-08-13 09:35:16 +01:00
Mark Sinclair ccf8063a52 Explorer API: add new HTTP resource to decorate mix nodes with geoip locations (#734)
* explorer-api: decorate mix nodes with locations from the geoip service and keep mix node cache in a hash map instead of a vec

* explorer-api: add `lat` and `lng` for map views

* explorer-api: remove function and simplify code

* explorer-api: review feedback

* network-explorer: format
2021-08-11 17:24:34 +01:00
Jędrzej Stuczyński 8694396942 Feature/completing nymd client api (#732)
* Calculating gas fees

* Ability to set custom fees

* Added extra test

* Removed commented code

* Moved all msg types to common contract crate

* Temporarily disabling get_tx method

* Finishing up nymd client API

* Comment fix

* Remaining fee values

* Some cleanup

* Removed needless borrow

* Fixed imports in contract tests

* Made contract address optional to allow for contract upload and initialisation
2021-08-11 17:15:14 +01:00
Jędrzej Stuczyński fb253e53a4 Removed all sphinx key caching from mixnodes and gateways (#713)
* Removed all sphinx key caching from mixnodes and gateways

* Missing change in network monitor
2021-08-11 12:47:35 +01:00
Jędrzej Stuczyński fdd34863ba Feature/nymd client fee handling (#730)
* Calculating gas fees

* Ability to set custom fees

* Added extra test

* Removed commented code

* Removed needless borrow
2021-08-11 12:01:53 +01:00
Mark Sinclair 4ac95ad8cf Explorer API - add port check and node description/stats proxy (#731)
* explorer-api: move mix node client operations into a package

* explorer-api: add port test for mixnodes with cache for results

* explorer-api: add `humantime-serde` dependency

* explorer-api: mix node API proxy

This fixes mixed-content responses when using the mix node API from the network explorer. An in-memory cache protects the explorer API from over-querying the http API on the mix node.

* explorer-api: adjust naming

* explorer-api: fix up self refs

* explorer-api: add method to state to get a mix node by identity key

* explorer-api: add cached http resource to proxy the `/description` and `/stats` http api resources to allow the network explorer do https requests for the mix node api resource avoid mixed content requests

* explorer-api: set default mix node cache time to 30 minutes

* explorer-api: make clippy happy

* explorer-api: add CORS with wide open configuration

* explorer-api: fixes from review feedback

* explorer-api: move port check test into separate function

* explorer-api: use `rocket-cors` that is pinned in the `validator-api` and remove custom CORS handler
2021-08-10 15:27:17 +01:00
Fouad 132d550cb6 Merge pull request #721 from nymtech/update/bond-form-state-management
update state management and validation
2021-08-09 11:00:29 +01:00
fmtabbara efc5035144 Merge branch 'develop' into update/bond-form-state-management
Merge develop branch
2021-08-09 09:51:25 +01:00
Jędrzej Stuczyński ebeac73f30 Rust nymd/cosmwasm client (#724)
* Using forked cosmwasm

* Basic wallet functionalities

* WIP

* Generic abci_query method

* More API stubs with some semi-working code

* More API stub work

* Moving from fork of cosmos-rust to the upstream

* Implemented most sign-less cosmwasm client methods

* Full contract upload with log parsing

* Implemented most of remaining methods on signing client

* Some initial cleanup on existing code

* Feature-locking nymd client

* Better type for base account

* Pagination handling

* Searching transaction by concrete hash

* basic search_tx

* More cleanup

* Disabled default validator-client features on wasm client

* Fixed account conversion

* Fixed typo in cargo.toml

* Moving back to main cosmos-sdk repo

* Re-exported connect functions

* comment

* Wallet no longer storing signing keys

* Went back to the trait approach

* Example stub of future API

* Removed needless borrow

* Fixed starting page

* Fixed typo

* Using centralised config defaults
2021-08-06 16:31:57 +01:00
fmtabbara 5303288b9c remove unecessary type check 2021-08-06 14:51:20 +01:00
fmtabbara bcac045c77 remove husky 2021-08-06 11:57:34 +01:00
Jędrzej Stuczyński d643df74b3 Removed wasm feature bypassing cycling dependencies (#723) 2021-08-06 11:00:15 +01:00
Jess 4c1c6d86c8 Update DelegationCheck.tsx (#725)
* Update DelegationCheck.tsx

* Update NodeDelegation.tsx
2021-08-06 09:38:47 +01:00
fmtabbara 623448a220 remove husky 2021-08-05 15:16:04 +01:00
fmtabbara b403ce1e62 add test 2021-08-05 14:25:52 +01:00
fmtabbara 6faf8786ea add husky 2021-08-05 14:23:19 +01:00
Jędrzej Stuczyński aaa4378b33 Updated used sphinx dependency to the most recent revision (#722) 2021-08-05 12:01:37 +01:00
fmtabbara 6512bfb4d9 Merge branch 'develop' into update/bond-form-state-management
Merge develop branch
2021-08-05 09:14:40 +01:00
fmtabbara 1afabfd1b6 update tests :) 2021-08-04 18:43:17 +01:00
fmtabbara f05e2880a9 update config files 2021-08-04 16:52:25 +01:00
fmtabbara 81675008a6 update hostname and ip validation 2021-08-04 16:52:06 +01:00
fmtabbara 8b4fc5719e add tests 2021-08-04 15:51:20 +01:00
fmtabbara e4f7452241 install test packages 2021-08-04 15:51:10 +01:00
fmtabbara 9602379368 update rawport validation function 2021-08-04 15:47:39 +01:00
fmtabbara 35ba39c196 update rawport validation function 2021-08-04 15:44:29 +01:00
fmtabbara 6d09da40e0 remove unused generic 2021-08-04 15:19:12 +01:00
fmtabbara de44f21d64 add code source 2021-08-04 14:21:48 +01:00
fmtabbara edc91e0e36 use regex for validating hostname 2021-08-04 14:19:59 +01:00
fmtabbara 518cd21fd6 type function parameter 2021-08-04 12:42:25 +01:00
Dave Hrycyszyn b36ca2c4f1 Add Network Explorer API (#720)
* Adding the explorer API

* Added explorer-api to workspace

* Re-jigged explorer api cargo paths

* Fixed compiler warnings

* Removing unused code

* network-explorer-api: configure state with env var API_STATE_FILE or fall back to default value of `explorer-api-state.json`

* network-explorer-api: updates to `Cargo.lock` file after rebasing

* network-explorer-api: make clippy happy
2021-08-04 12:38:35 +01:00
Jędrzej Stuczyński 2db79de722 Feature/superbuild (#719)
* Adding build script

* Added build dependencies

* Cleaned up build.rs

* Restored validator-api to default workspace

* Removed split for validator-api build in github ations

* Don't build validator API on Windows

* Remove validator-api Cargo.lock

* Remove fmt from the conditional steps

Co-authored-by: Dave Hrycyszyn <futurechimp@users.noreply.github.com>
Co-authored-by: Bogdan-Ștefan Neacșu <bogdan@nymtech.net>
2021-08-04 11:55:58 +03:00
fmtabbara 3a9531b586 remove console log 2021-08-04 09:26:22 +01:00
fmtabbara f96d768341 update state management and validation 2021-08-03 18:08:54 +01:00
Fouad 26fb13fe2d remove console log (#718) 2021-08-02 17:42:21 +01:00
Fouad 67a9d80299 Merge pull request #715 from nymtech/bug/form-validation
Bug/form validation
2021-08-02 16:29:11 +01:00
fmtabbara 84249cab4b update validation 2021-08-02 15:46:12 +01:00
Jędrzej Stuczyński f4305dfaa5 Warnings with identities of good nodes failing checks (#714)
* Warnings with identities of good nodes failing checks

* Fixed logging messages
2021-08-02 14:08:23 +01:00
fmtabbara 0c45c61c85 format to jsx double quotes 2021-08-02 13:49:46 +01:00
fmtabbara 7d250b3384 merge develop branch 2021-08-02 13:46:04 +01:00
fmtabbara bb2029e21c remove console log 2021-08-02 13:44:22 +01:00
fmtabbara 0f0611f390 form updates and bug fix 2021-08-02 13:42:20 +01:00
Fouad 2904141c14 Merge pull request #704 from nymtech/feature/receive-coins-page
Feature/receive coins page + UI tweaks
2021-08-02 13:32:08 +01:00
fmtabbara c569a7a858 ui tweak 2021-07-28 18:01:40 +01:00
fmtabbara 87db1fd8c1 update breakpoint for large screens 2021-07-28 17:45:45 +01:00
fmtabbara a1d2d09f28 fix conflicts 2021-07-28 16:15:40 +01:00
Fouad b949d7b221 Merge pull request #703 from nymtech/feature/user-sign-out
Allow users to sign out
2021-07-28 15:58:43 +01:00
fmtabbara de468760d6 update layout 2021-07-28 14:17:13 +01:00
fmtabbara 30a78df986 fix build error 2021-07-28 13:52:24 +01:00
fmtabbara e8622a190a layout and icon updates 2021-07-28 10:53:37 +01:00
fmtabbara 75f098f002 style update 2021-07-27 20:07:23 +01:00
fmtabbara b034a07439 display alert when no client detected 2021-07-27 17:50:42 +01:00
fmtabbara 68956456dd style updates 2021-07-27 17:24:23 +01:00
fmtabbara aa048cabe6 update pages to use new components 2021-07-27 16:44:11 +01:00
fmtabbara 5dc67b995e export new reusable components 2021-07-27 16:41:35 +01:00
fmtabbara 721e4bda8b create reuseable components 2021-07-27 16:40:15 +01:00
fmtabbara 2673f83116 fix bug 2021-07-27 15:08:37 +01:00
fmtabbara bc68513a78 allow user to log out 2021-07-27 14:23:17 +01:00
Bogdan-Ștefan Neacşu 91250f199a Feature/docker improvements (#702)
* DRY the docker prefix and wasmd variables

* Don't re-init nymd for the same container

* Specify env variables in x property

* Contract uploader now uses BECH32_PREFIX env var
2021-07-26 19:06:01 +03:00
Fouad 3ec92a0784 Merge pull request #698 from nymtech/bond_and_delegation_alerts
Bond and delegation alerts
2021-07-26 13:48:35 +01:00
Jędrzej Stuczyński 70a9317ab3 Exposed API port on the validator (#701) 2021-07-26 15:30:54 +03:00
Dave Hrycyszyn 71e36065e5 Using validator API instead of nymd (#690) 2021-07-26 10:59:29 +01:00
Jędrzej Stuczyński 389d1ba3b9 Cleaned up dependencies of our typescript client (#699)
* Cleaned up dependencies of our typescript client

* Explicitly added stargate dependency and not rely on it being in node_modules
2021-07-26 10:58:58 +01:00
Bogdan-Ștefan Neacşu 18f5d4084d Feature/default values (#700)
* Put endpoints and contract address in one place

* Put common ports in one place

* Split cache version from route

* Share validator-api port value between server and client

* Put BECH32 prefix in defaults

* Put DENOM in defaults

* Put network monitor address in defaults

* Fix clippy

* Fix another clippy + tests import of DENOM
2021-07-26 10:55:59 +01:00
fmtabbara 83744962f1 remove possible whitespace 2021-07-23 14:44:20 +01:00
fmtabbara df08a894cc only display alert when stakeValue is loaded 2021-07-23 14:34:17 +01:00
Bogdan-Ștefan Neacşu 2354828481 Feature/other containers (#692)
* Add block explorer to docker containers

* Add network explorer to docker containers

A private token is needed to build this container.

* Update docker README
2021-07-23 16:24:55 +03:00
fmtabbara 74693bda6f update allocation check 2021-07-23 14:14:27 +01:00
fmtabbara 613ff5da71 remove unused import 2021-07-23 12:18:45 +01:00
fmtabbara a11937699f Merge branch 'develop' into bond_and_delegation_alerts
Merge develop
2021-07-23 09:47:17 +01:00
fmtabbara eb59ca77ef catch error caused by invalid values 2021-07-23 09:11:11 +01:00
fmtabbara 12d07fd870 use helper function + code tidy 2021-07-22 22:11:59 +01:00
Jędrzej Stuczyński 1d18def642 Run cargo fmt 2021-07-22 15:34:34 +01:00
fmtabbara 70d4bce42f prettier updates 2021-07-22 15:17:37 +01:00
Jędrzej Stuczyński c81454e00b Validator API storage fixes and adjustments 2021-07-22 15:15:08 +01:00
fmtabbara ac4ee2bcf2 allocation check on delegation form 2021-07-22 15:00:24 +01:00
fmtabbara 9184c119d6 set balance warning 2021-07-22 14:23:02 +01:00
fmtabbara 216b114346 make reuseable hook to get balance 2021-07-22 13:29:14 +01:00
Fouad 793dbdef7e update types 2021-07-22 12:00:46 +01:00
Jędrzej Stuczyński 432e1e6065 Merge branch 'develop' of github.com:nymtech/nym into develop 2021-07-22 10:44:11 +01:00
Fouad c8a02e1354 update punk denomination 2021-07-22 10:40:02 +01:00
Jędrzej Stuczyński 698345dbe9 Bugfix/network monitor version check (#697)
* Fixed validator-api network version check

* Removed redundant clone
2021-07-22 10:32:08 +01:00
Jędrzej Stuczyński 5568073c17 Fixed validator-api network version check 2021-07-22 10:05:38 +01:00
Jędrzej Stuczyński addb721d66 Fixed gateway upgrade command argument description 2021-07-21 14:29:47 +01:00
Jędrzej Stuczyński 3bbf959086 Removed port information from bonding notice 2021-07-21 14:24:54 +01:00
Jędrzej Stuczyński 0db4aa5f39 Merge branch 'v0.11.0-release' into release/v0.11.0 2021-07-21 14:22:39 +01:00
Jędrzej Stuczyński f41ee7700d Merge branch 'release/v0.11.0' of github.com:nymtech/nym into release/v0.11.0 2021-07-21 14:18:35 +01:00
Jędrzej Stuczyński 1c335d3172 Merged upgrade commands 2021-07-21 14:16:36 +01:00
Bogdan-Ștefan Neacşu 191b3c09e2 V0.11.0 release (#696)
* Update the version to 0.11.0 for non-upgradable crates

* Fix target version for the current upgrade functions

* Upgrade native client

* Upgrade socks5 client

* Upgrade mixnode

* Upgrade gateway
2021-07-21 14:10:27 +01:00
Jędrzej Stuczyński 725b4de74a Updated changelog 2021-07-21 13:16:01 +01:00
Bogdan-Ștefan Neacșu ce038bf56a Upgrade gateway 2021-07-21 15:13:21 +03:00
Bogdan-Ștefan Neacșu 8727038443 Upgrade mixnode 2021-07-21 15:12:53 +03:00
Bogdan-Ștefan Neacșu afbed0e438 Upgrade socks5 client 2021-07-21 15:12:22 +03:00
Bogdan-Ștefan Neacșu b6a026da83 Upgrade native client 2021-07-21 15:11:45 +03:00
Bogdan-Ștefan Neacșu fc74b723fa Fix target version for the current upgrade functions 2021-07-21 15:11:08 +03:00
Bogdan-Ștefan Neacșu b1fe1f6073 Update the version to 0.11.0 for non-upgradable crates 2021-07-21 15:11:07 +03:00
Jędrzej Stuczyński 043ca9a63e Updated versions to 0.11.0 2021-07-21 13:07:15 +01:00
Jędrzej Stuczyński 46b49eea2f Updated bot channel name 2021-07-21 12:52:39 +01:00
Jędrzej Stuczyński 7430eb99cf Fixed upgraded description save location 2021-07-21 12:43:12 +01:00
Dave Hrycyszyn 111cccea97 Merge branch 'release/v0.11.0' of github.com:nymtech/nym into release/v0.11.0 2021-07-21 11:41:24 +01:00
Dave Hrycyszyn 5e9d87b1ad Updating wallet version prior to release 2021-07-21 11:40:37 +01:00
Jędrzej Stuczyński c28b320b66 Merge branch 'release/v0.11.0' of github.com:nymtech/nym into release/v0.11.0 2021-07-21 11:22:54 +01:00
Jędrzej Stuczyński a80a1bbe34 Only allow bonding nodes with version >= 0.11.0 2021-07-21 11:22:48 +01:00
Bogdan-Ștefan Neacșu c1808ae692 Update to RC 0.11.0-rc1 2021-07-21 13:19:50 +03:00
Jędrzej Stuczyński d8277e851f Updated sign command (#694) 2021-07-21 08:42:02 +01:00
Mx c795490164 got rid of denomination error (#691)
Co-authored-by: mfahampshire <>
2021-07-20 17:31:48 +01:00
Bogdan-Ștefan Neacşu 3f2fa717c9 Return the vec instead of the cache wrapper for topology (#695) 2021-07-20 17:30:58 +01:00
Bogdan-Ștefan Neacşu c0be2330b0 Docker testing env (#687)
* Add validator Docker container

* Add Docker contract upload container

Signed-off-by: Bogdan-Ștefan Neacșu <bogdan@nymtech.net>

* Add docker-compose for validators and building deploy container

* One Docker image for each component

* Switch from hal to punk

* Add nym wallet docker

* Point web browser to the correct IP

* Better message parsing

* Rebase on the wallet merge

* Rename upload contract entrypoint script

* Remove unnecessary bash magic

* Put the contract image in the docker dir

* Put the wallet-web image in the docker dir

* Add some read-only specifiers to volumes

* Move typescript container code in docker directory

Also update lock files, as the containers work on a volume binded
to the local filesystem

* Fix volume permissions

* Add mnemonic echo

* Remove magic sleep value from secondary validator

* Adding README.md to the docker directory

* Change ENTRYPOINT to CMD for the typescript client image
2021-07-20 10:16:57 +01:00
Jędrzej Stuczyński e86467d007 Changed validator-api version to 0.10.2 2021-07-19 14:36:25 +01:00
Jędrzej Stuczyński e5afd54ce0 Feature/node status api (#680)
* Basic storage stub

* New models for new node status api

* Route handling

* Mounting new routes

* Missing selective commit

* Moved network monitor related files to separate package

* Starting to see some sqlx action

* Schema updates

* Log statement upon finished migration

* Removed old diesel related imports

* Converted mixnode cache initialisation into a fairing

* Moved cache related functionalities to separate package

Also defined staging there

* Created run method for validator cache + removed unwrap

* Removed old node-status-api types and left bunch of todo placeholders in their place

* Fixed managing validatorcache

* Status reports are starting to get constructed

* Submitting some dummy results to the database

* Removing duplicate code for generating reports

* Removed statuses older than 48h

* Initial attempt at trying to obtain reports for all active nodes

* Removed duplicates from the full report

* Grabbing uptime history

* Updating historical uptimes of active nodes

* Updated sqlx-data.json

* Removed all placeholder foomp owner values

* Changed Layer serde behaviour for easier usage

* Extended validator api config

* Initial (seems working !) integration with network monitor

* Added database path configuration to config

* Using ValidatorCache in NetworkMonitor

* Flag indicating whether validator cache has been initialised

* Introduced a locla-only route for reward script to perform daily chores

* Flag to save config to a file

* Moved spawning of receiving future to run method rather than new

* Removed arguments that dont make sense to be configured via CLI

* Removed dead code from config file

* More dead code removal

* Added validator API to CI

* Corrected manifest-path arguments

* Constructing network monitor by passing config

* Combined validator API CI with the main CI file

* Using query_as for NodeStatus

* Checking if historical uptimes were already calculated on particular day

* Making id field NOT NULL

* More query_as! action

* Updated sqlx-data.json

* Removed unused chrono feature

* Renamed the migration file

* Changed default validator endpoint to point to local validator

* Removing unnecessary clone

* More appropriate naming

* Removed dead code

* Lock file updates

* Updated network monitor address in contract code

* Don't stage node status api if network monitor is disabled

* cargo fmt

* Updated all license notices to SPDX
2021-07-19 14:02:47 +01:00
Jędrzej Stuczyński 25d2af3b04 Changed Layer serde behaviour for easier usage (#686) 2021-07-16 16:23:41 +01:00
Dave Hrycyszyn 8e24583f2a Updating wallet URL in mixnode startup output (#682) 2021-07-16 10:57:26 +01:00
Bogdan-Ștefan Neacşu c09846bb36 Merge the nym-wallet-web repo into a nym directory (#684)
A snapshot of https://github.com/nymtech/nym-wallet-web/tree/60b36db17d994e597b91981be5d60b0488618019
is put into a wallet-web folder.
2021-07-16 10:46:02 +01:00
Dave Hrycyszyn 86034bd955 Temporarily using non-cached gateways so we can get our next version deployed (#683) 2021-07-16 10:08:27 +01:00
Dave Hrycyszyn a9797879e8 Correcting the contract address 2021-07-15 16:16:20 +01:00
Dave Hrycyszyn 407d2bba47 Updating all default config values. 2021-07-14 16:56:51 +01:00
Dave Hrycyszyn 8f4b5ab4c7 Updating default settings to get the next testnet up 2021-07-14 16:46:13 +01:00
Jędrzej Stuczyński 0fd203371d Using specific commit of rocket cors (#678) 2021-07-13 16:14:11 +01:00
Dave Hrycyszyn 68f2d8b925 Version bump 2021-07-09 11:52:59 +01:00
Bogdan-Ștefan Neacşu 973c30592f Use cached topology for clients (#674)
* Add validator-api common client

* Call validator-api from different clients for gateway topology

* Call validator-api from different clients for mixnode topology

* Use consts for the validator-api queries

* Rename the new query_validator function to query_validator_api

* Add mut to mixnode validator client

* Add refreshValidatorAPIGateways as a way to get the gateways...

... from validator-api

* Add refreshValidatorAPIGateways as a way to get the mixnodes...

... from validator-api

* Add yet another mut

* Change the port to validator-api service when querying the topology

* Add parsing check on the config phase...

... to make sure the validator URLs are in the correct format.

* Fix another clippy error

* Use all provided validators instead of just the first one

* The mutable reference was not actually needed, so remove it

* Use global variable for validator-api port

* Use url crate for checking the format and changing the port

* Use URL for parsing and move constants of validator-api to index.ts...

... until we find a way to link to the values from the validator-api
crate.

* Change global variables naming and have the API version into each API query

* Revert the changes to the index on connect...

... as they were working correctly before.

* Use all provided validators for mixnodes as well

* Remove location and layer
2021-07-09 11:50:41 +01:00
Drazen Urch 3886ec5291 Minimize read/write cache contention (#676)
* Add timeout to cache.write() call

* mixnode_cache -> validator_cache

* Fix rename

* Minimize read/write contention
2021-07-08 10:42:53 +01:00
Dave Hrycyszyn 929775c517 Bumping version number for release 2021-07-06 16:10:38 +01:00
Dave Hrycyszyn 427893efef Feature/validator client upgrade (#675)
* Upgrading cosmos client to v0.25.5

* Formatting

* Renamed stakeDenom to prefix

* Added a denom field to the client

* New version needs a denom in the static methods

* ibid

* Formatting

* Renaming bech32prefix to prefix

* Adding a weird 'u' in the nymGasPrice

* Changing to use denom instead of prefix in nymGasPrice

* Alphabetizing fields

* Renaming method to something a bit more sane

* Using prefix, not denom, to build gas price

* Hardcoding an unavoidable and ugly manual conversion into the stargate helper

* denom is correct, for use in getBalance
2021-07-06 13:50:26 +02:00
Jędrzej Stuczyński cb33871934 Disables nightly clippy CI (#677) 2021-07-06 13:48:56 +02:00
Drazen Urch 4a86b24ff5 Use rocket 0.5-rc1, remove rocket-contrib (#672)
* Use rocket 0.5-rc1, remove rocket-contrib

* Revert thread_rng

* Continue on error for beta as well

* Add Drazen to authors

* Remain paranoid for unstable crates

* fmt again :/

* Most paranoid versions
2021-07-05 18:07:18 +02:00
Jędrzej Stuczyński 8f98de4abc Feature/validator api config (#671)
* Modified NymConfig trait to make id optional

* Basic validator-api config definition

* Optionally using the config during startup + flag to enable monitoring
2021-07-05 13:48:55 +02:00
Jędrzej Stuczyński e6460208d3 Removed standalone network-monitor (#669)
It has been integrated into the validator-api
2021-07-02 11:31:29 +01:00
Drazen Urch 3b7315d1e2 Fix a dependabot nag (#670) 2021-07-02 11:53:04 +02:00
Drazen Urch 3aafe54887 Remove mut where possible, parallel cache requests (#668) 2021-07-02 10:50:49 +02:00
Drazen Urch f08f19cd86 Rework validator client requests (#667)
* Rework validator-client to avoid &mut

* Comment

* More logging, sleep

* Fix wasm build

* My clippy missed this
2021-07-01 20:05:29 +02:00
Drazen Urch 2e6a32b298 Generalize cache, and cache gateways (#666)
* Generalize cache, and cache gateways

* Allow dead code
2021-07-01 17:24:23 +02:00
Bogdan-Ștefan Neacşu 57df77a995 Layer selection (#664)
* mixnode: Remove layer computation from mixnode

The layer is currently computed locally. This should be moved to
the validator, and the mixnode should find this information via
a query. Until the query is actually processed, we keep the layer
field as None.

Signed-off-by: Bogdan-Ștefan Neacșu <bogdan@nymtech.net>

* contracts: Compute layer of bonding mixnode

Predictably compute the best layer of a bonding mixnode by putting it on
the layer with the fewest mixnodes and, in case of equality, with the
smallest index e.g. layer 1 is better then layer 3 if both have
the fewest mixnodes.

The layer received from the client app is regarded as a preferred option
and is only accepted if the number of nodes on the preferred layer is not
bigger then the one on the best layer.

Signed-off-by: Bogdan-Ștefan Neacșu <bogdan@nymtech.net>

* contracts: Add tests for layer selection

Signed-off-by: Bogdan-Ștefan Neacșu <bogdan@nymtech.net>

* mixnode: Upgrade from 0.10.2 to 0.10.3

The config file is changed so that it's only containing the layer if
the layer exists.

Signed-off-by: Bogdan-Ștefan Neacșu <bogdan@nymtech.net>

* contracts: Move the layer from MixNode to MixNodeBond

Remove the option of a client app to propose a preferred
layer.

Signed-off-by: Bogdan-Ștefan Neacșu <bogdan@nymtech.net>

* contracts: Move from u64 to Layer representation

Signed-off-by: Bogdan-Ștefan Neacșu <bogdan@nymtech.net>

* contracts: Remove Layer::Invalid as it no longer makes sense...

... because layer choice is now present only in the contract.

Signed-off-by: Bogdan-Ștefan Neacșu <bogdan@nymtech.net>

* contracts: Move layer selection algorithm in `choose_with_fewest` method

Signed-off-by: Bogdan-Ștefan Neacșu <bogdan@nymtech.net>

* mixnode: Remove layer altogether

Signed-off-by: Bogdan-Ștefan Neacșu <bogdan@nymtech.net>

* mixnode: Refactor upgrading system

Signed-off-by: Bogdan-Ștefan Neacșu <bogdan@nymtech.net>

* mixnode: Remove layer from template as well

Signed-off-by: Bogdan-Ștefan Neacșu <bogdan@nymtech.net>

* Remove invalid field from LayerDistribution

Signed-off-by: Bogdan-Ștefan Neacșu <bogdan@nymtech.net>
2021-07-01 17:56:57 +03:00
Drazen Urch 343c55f981 Validator API server (#665)
* Rocket main stub

* Add anyhow

* Stub cache reads and writes

* Finalize stubs

* Add generic Rocket.toml

* Put back targets

* Have cache own its validator client

* allow dead code

* Update rocket.toml for 0.5
2021-07-01 14:08:04 +02:00
Dave Hrycyszyn 1660e0796d Removing validator binaries, these should go into Github releases (#663) 2021-06-30 10:16:43 +01:00
Drazen Urch b30f11ed7a Rename network-monitor (#662) 2021-06-29 14:48:15 +02:00
Jędrzej Stuczyński 2bdee705b7 Feature/total delegation field (#660)
* Changed bond Vec<Coin> into a Coin

* Introduced total_delegation field to bond models

* Restoring total old delegation

* Updating total delegation on new delegations

* Updating total delegation on removal

* Keeping track of delegation increase during rewarding

* Updating total delegation during rewarding + additional response attributes

* Removed irrelevant tests

* Fixed storage-related tests

* Added additional test assertions for delegation increase

* Added additional node rewarding test assertions

* Tests for correct reward calculation + gateway rewarding early termination

* Added delegation field to parsed node type

* Updated typescript bond types

* Moved `OLD_DELEGATIONS_CHUNK_SIZE` to file-wide namespace so that it could be used in tests

* Tests for finding old node delegations

* ibid.

* Issue#657

* Additional test assertions regardingn total delegation

* Missed test field after merge

* ibid

* Cleaning up storage related imports
2021-06-29 11:29:51 +01:00
Drazen Urch 31f567f1ef Use thiserror for validator-client (#658)
* Use thiserror for validator-client

* cargo fmt

* Move comment

* CI
2021-06-29 10:01:44 +02:00
Jędrzej Stuczyński 216573b65b Adds @neacsu as code owner (#661) 2021-06-29 10:01:25 +02:00
Bogdan-Ștefan Neacşu 4102690cf1 Merge pull request #659 from nymtech/remove_contract_location
contracts: Removed mixnode location from the bonding process
2021-06-28 17:08:15 +03:00
Bogdan-Ștefan Neacșu a82ac9c50d contracts: Removed mixnode location from the bonding process
Signed-off-by: Bogdan-Ștefan Neacșu <bogdan@nymtech.net>
2021-06-28 15:10:57 +03:00
Bogdan-Ștefan Neacşu bb0257ccc6 Merge pull request #656 from nymtech/feature/configurable-verloc-http-ports
Feature/configurable verloc http ports
2021-06-28 14:52:54 +03:00
Bogdan Neacşu 142a70365f Merge pull request #655 from nymtech/feature/describe_location
Feature/describe location
2021-06-25 15:24:09 +03:00
Bogdan-Ștefan Neacșu 12ddf80fe9 Applied feedback:
- Use concrete location for example
- Removed `Location` from displayed information
- Replace tuple with a type alias
- Commit description to disk once the upgrade is finalized
- Other minor changes

Signed-off-by: Bogdan-Ștefan Neacșu <bogdan@nymtech.net>
2021-06-25 14:21:48 +03:00
Bogdan-Ștefan Neacșu 34fcca052b mixnode: Fix clippy warning
This fixes the warning caused by `clippy::field-reassign-with-default`

Signed-off-by: Bogdan-Ștefan Neacșu <bogdan@nymtech.net>
2021-06-25 14:20:21 +03:00
Bogdan-Ștefan Neacșu e06e7aa8f3 mixnode: Add tests for upgrade to 10.0.2
Add a positive and a negative unit test for upgrading to 10.0.2.

Signed-off-by: Bogdan-Ștefan Neacșu <bogdan@nymtech.net>
2021-06-25 14:20:21 +03:00
Bogdan-Ștefan Neacșu 4d701be053 mixnode: Add location to describe command
Removed location from the init output and added it as input in the
describe command.

Because this creates a different format of the description file, the
patch version number must also be increased.

Signed-off-by: Bogdan-Ștefan Neacșu <bogdan@nymtech.net>
2021-06-25 14:20:20 +03:00
Bogdan-Ștefan Neacșu 3bf02c558c mixnode: Refactor upgrade functions
Renaming the function to have a clear separation between different
parts of the version, especially for future patch upgrade functions.

Also switch to a Result return value for these functions, to gather
all the
```
eprintln!
print_failed_upgrade
exit(1)
```
calls in one place.

Signed-off-by: Bogdan-Ștefan Neacșu <bogdan@nymtech.net>
2021-06-25 14:13:21 +03:00
Jędrzej Stuczyński e7dcc8dc30 Merge branch 'develop' into feature/configurable-verloc-http-ports 2021-06-25 10:36:17 +01:00
Jędrzej Stuczyński b7f197d278 Feature/host ip split (#654)
* Updated smart contract to work with future cosmwasm 0.14.0 update

* Updated the rest of the codebase

* Reordered imports

* Missing imports

* cargo fmt

* More cargo fmt action

* Introduced type alias for IdentityKey reference

* Constant defined arguments for gateway and mixnode

* Spliting host into explicit address and port(s)

* Using more type restrictive IpAddr rather than String for listening address

* Updated config templates

* Tentative upgrade commands, probably to be further changed before release

* Fixed mixnet contract test fixtures

* Further missing test adjustments
2021-06-25 10:33:12 +01:00
Jędrzej Stuczyński 3412a0b7bd Increased validator client version 2021-06-24 15:51:05 +01:00
Jędrzej Stuczyński 23951acdec Fixed trying to log invalid field 2021-06-24 14:51:44 +01:00
Jędrzej Stuczyński b56bb7f226 Updated typescript models 2021-06-24 10:46:02 +01:00
Jędrzej Stuczyński f0fafe97fe Using verloc with custom ports 2021-06-23 16:08:48 +01:00
Jędrzej Stuczyński 9df360cf63 Removed constructors only used in tests
To elaborate further, to update Mixnode constructor it would require adding yet two more arguments and at that point the compiler warns about too many arguments
2021-06-23 16:08:27 +01:00
Jędrzej Stuczyński 035ee3a402 Added new ports to bond model 2021-06-23 16:04:21 +01:00
Jędrzej Stuczyński 035a2554ee Configurable http api port 2021-06-23 15:49:38 +01:00
Jędrzej Stuczyński 4c8f8ff1b6 Renamed 'rtt_measurement' to verloc to avoid confusion 2021-06-23 15:38:52 +01:00
Jędrzej Stuczyński 35cddab3bd Introduced cli arguments for verloc and http ports 2021-06-23 15:33:57 +01:00
Jędrzej Stuczyński 0a5f6f2ca7 Added verloc and http port fields to config 2021-06-23 15:25:23 +01:00
Jędrzej Stuczyński 53253d443c Further missing test adjustments 2021-06-23 12:58:24 +01:00
Jędrzej Stuczyński 07f2f9c39e Fixed mixnet contract test fixtures 2021-06-23 12:46:38 +01:00
Jędrzej Stuczyński 1d4026ec71 Tentative upgrade commands, probably to be further changed before release 2021-06-23 12:26:06 +01:00
Jędrzej Stuczyński 6524fa3f9c Updated config templates 2021-06-23 12:25:40 +01:00
Jędrzej Stuczyński 6e24b2681b Using more type restrictive IpAddr rather than String for listening address 2021-06-23 12:25:29 +01:00
Jędrzej Stuczyński 5ba20268dd Allow passing optional explicit bond value (#652)
* Allows passing an optional argument to specify bond value

* Fixed incorrect coin array usage

* Using minimum gateway bond for gateway bonding

* Bumped validator client version number

* Made the explicit bond value required as an argument
2021-06-22 17:15:20 +01:00
Jędrzej Stuczyński 4e03759c0f Feature/cosmwasm 0.14.1 update (#653)
* Updated smart contract to work with future cosmwasm 0.14.0 update

* Updated the rest of the codebase

* Reordered imports

* Missing imports

* cargo fmt

* More cargo fmt action

* Introduced type alias for IdentityKey reference
2021-06-22 17:07:11 +01:00
Jędrzej Stuczyński a6be3e763f Spliting host into explicit address and port(s) 2021-06-22 16:39:07 +01:00
Jędrzej Stuczyński 29ac119127 Constant defined arguments for gateway and mixnode 2021-06-22 16:38:14 +01:00
Jędrzej Stuczyński 67ce93ffc8 Merge branch 'feature/cosmwasm-0.14.1-update' into feature/host-ip_split 2021-06-22 09:44:02 +01:00
Jędrzej Stuczyński 08964f8775 Introduced type alias for IdentityKey reference 2021-06-18 12:32:13 +01:00
dependabot[bot] d8d2d84aa7 Bump websockets in /clients/native/examples/python-examples/websocket (#638)
Bumps [websockets](https://github.com/aaugustin/websockets) from 8.1 to 9.1.
- [Release notes](https://github.com/aaugustin/websockets/releases)
- [Changelog](https://github.com/aaugustin/websockets/blob/9.1/docs/changelog.rst)
- [Commits](https://github.com/aaugustin/websockets/compare/8.1...9.1)

---
updated-dependencies:
- dependency-name: websockets
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-06-18 12:22:38 +01:00
Jędrzej Stuczyński 7d69fa3ed5 More cargo fmt action 2021-06-18 12:21:33 +01:00
Jędrzej Stuczyński dff7a8976a cargo fmt 2021-06-18 12:15:34 +01:00
Jędrzej Stuczyński 50fbe55be9 Missing imports 2021-06-18 12:01:29 +01:00
Jędrzej Stuczyński 648543e536 Merge branch 'feature/cosmwasm-0.14.0-update' into feature/cosmwasm-0.14.1-update 2021-06-18 11:59:45 +01:00
Jędrzej Stuczyński 3d2654923a Bugfix/delegation type fixes (#649)
* Extended no delegation found errors with address information

* Error now use Display implementation rather than Debug

* Delegation correctly contains owner address

* Updated js delegation type

* Bumped validator client version number

* Delegation::owner returns owned type

* cargo fmt
2021-06-17 10:51:50 +01:00
Jędrzej Stuczyński d03798629c Introduced type aliases for mixnode and gateway keys (#650)
* Introduced type aliases for mixnode and gateway keys

* Ibid for error types

* Ibid for tests
2021-06-17 09:01:41 +01:00
Dave Hrycyszyn e470ac4b0f Removing the ancient explorer in preparation for a new dawn. (#645) 2021-06-16 13:35:33 +02:00
Dave Hrycyszyn 9324e3511f Reverting trial README change 2021-06-15 16:05:30 +01:00
Dave Hrycyszyn 23d0607239 Testing code owners again (#644) 2021-06-15 14:07:19 +01:00
Dave Hrycyszyn ebba222a86 I was missing the *, fixing 2021-06-15 12:54:07 +01:00
Dave Hrycyszyn fdbecb2a3f Removing Bogdan for the moment so as not to flood him :) 2021-06-15 12:50:42 +01:00
Dave Hrycyszyn 785513914c Merge branch 'develop' of github.com:nymtech/nym into develop 2021-06-15 12:42:25 +01:00
Dave Hrycyszyn c789853b32 Adding codeowners who can be added to PRs by default 2021-06-15 12:42:15 +01:00
Jędrzej Stuczyński 97ec416b3e TypeScript client v0.12.0 (#641) 2021-06-15 10:46:42 +01:00
Jędrzej Stuczyński 164c8ad05c Feature/reverse contract mapping (#640)
* WIP

* One fewer todos

* Migrated transactions,queries + query tests

* Transaction-related tests restored

* Import cleanup

* Initial draft of the migration procedure

* Future migration test

* Fixed rust compilation errors

* Unbonding no longer requires explicit identity

* Delegation API changes

* Fixed incorrect gateway delegation object
2021-06-14 17:55:41 +01:00
Dave Hrycyszyn 7b02026476 Bumped to 0.11.1 2021-06-11 10:51:54 +01:00
Jędrzej Stuczyński 1fb26b68c6 Feature/delegated staking (#635)
* Initial delegation

* Queries for delegation

* Validation + delegation tests

* Removing delegation tests + fixes

* Tests for query related functions

* Adjusted delegation queries page limits

* Added delegation queries to validator client

* Methods for delegation inside validator client

* Some comments

* missing return types

* Post merge fixes

* Rewarding mix delegations

* Renaming

* Moved storage keys around

* Gateway delegation

* ibid

* Removed needlessly commented lines
2021-06-10 12:55:58 +01:00
Jędrzej Stuczyński 29fd8b8805 Chore/clippy nightly fixes (#636)
* Removed needless borrow in upgrade args matches

* Pathfinder needless borrows

* cmp needless borrow

* Network monitor needless borrows

* Topology control needless borrows

* Received buffer needless borrow

* Key manager needless borrows

* Network requester needless borrow

* Gateway client needless borrow

* Gateway requests needless borrow

* Nymsphinx needless borrows

* verloc needless borrows

* Socks5 needless borrow

* Clone on copy type
2021-06-07 14:52:11 +01:00
dependabot[bot] 31b9048144 Bump ws from 6.2.1 to 6.2.2 in /clients/webassembly/js-example (#632)
Bumps [ws](https://github.com/websockets/ws) from 6.2.1 to 6.2.2.
- [Release notes](https://github.com/websockets/ws/releases)
- [Commits](https://github.com/websockets/ws/commits)

---
updated-dependencies:
- dependency-name: ws
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-06-07 12:41:39 +01:00
dependabot[bot] 10c0e04926 Bump ws in /clients/native/examples/js-examples/websocket (#633)
Bumps [ws](https://github.com/websockets/ws) from 6.2.1 to 6.2.2.
- [Release notes](https://github.com/websockets/ws/releases)
- [Commits](https://github.com/websockets/ws/commits)

---
updated-dependencies:
- dependency-name: ws
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-06-07 12:41:33 +01:00
dependabot[bot] c0ad3ce1a6 Bump ws from 6.2.1 to 6.2.2 in /clients/validator (#634)
Bumps [ws](https://github.com/websockets/ws) from 6.2.1 to 6.2.2.
- [Release notes](https://github.com/websockets/ws/releases)
- [Commits](https://github.com/websockets/ws/commits)

---
updated-dependencies:
- dependency-name: ws
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-06-07 12:41:26 +01:00
Jędrzej Stuczyński 82def1349f Feature/stats endpoint (#631)
* Idea for stats endpoint

* Introduced /stats endpoint replacing sending data to metrics server

* Removed metrics client

* Removed old metrics file

* cargo fmt
2021-06-07 12:01:43 +01:00
Jędrzej Stuczyński 94a52aa2db Updated all js related dependencies (#629) 2021-06-07 12:00:12 +01:00
Jędrzej Stuczyński 50f65aa698 Feature/per layer count (#628)
* Initial struct

* WIP

* Added test for migration

* unused import
2021-06-07 11:59:33 +01:00
Jędrzej Stuczyński e12314a6fa Feature/update validator binaries (#624)
* Removed old wasmd v0.14.1 binaries

* Uploaded new wasmd v0.14.2 binaries
2021-06-07 11:02:06 +01:00
Jędrzej Stuczyński 15e377e678 Changed rewarding behaviour on not found bonds (#627) 2021-06-07 11:00:07 +01:00
Jędrzej Stuczyński 7b1dab8546 Getting required bond from the contract (#623) 2021-06-02 12:51:28 +01:00
Jędrzej Stuczyński 93e9dc5c1e Bugfix/verloc fixes and adjustments (#618)
* Using new display trait for identity key

* Establishing verloc connection with timeout

* Further decrease in log severity

* Writing echo packets with timeout

* Sender formatting

* ConnectionWriteTimeout error definition

* Writing verloc results in chunks

* Added run started and run finished fields to verloc

* Reordered the fields

* Storing the timestamps as options to indicate run in progress
2021-06-02 12:50:36 +01:00
Jędrzej Stuczyński 0dcb046576 Changed omitted print to a debug call (#617) 2021-06-02 12:48:28 +01:00
dependabot[bot] 5288510979 Bump dns-packet in /clients/native/examples/js-examples/websocket (#626)
Bumps [dns-packet](https://github.com/mafintosh/dns-packet) from 1.3.1 to 1.3.4.
- [Release notes](https://github.com/mafintosh/dns-packet/releases)
- [Changelog](https://github.com/mafintosh/dns-packet/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mafintosh/dns-packet/compare/v1.3.1...v1.3.4)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-06-01 09:42:26 +01:00
dependabot[bot] 81481832d8 Bump dns-packet from 1.3.1 to 1.3.4 in /clients/webassembly/js-example (#625)
Bumps [dns-packet](https://github.com/mafintosh/dns-packet) from 1.3.1 to 1.3.4.
- [Release notes](https://github.com/mafintosh/dns-packet/releases)
- [Changelog](https://github.com/mafintosh/dns-packet/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mafintosh/dns-packet/compare/v1.3.1...v1.3.4)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-06-01 09:42:20 +01:00
Jędrzej Stuczyński 27e704ab80 Reordered imports 2021-05-27 11:42:11 +01:00
Jędrzej Stuczyński da339a83cd Updated the rest of the codebase 2021-05-27 11:29:31 +01:00
Jędrzej Stuczyński 99780d3eb0 Updated smart contract to work with future cosmwasm 0.14.0 update 2021-05-27 11:27:09 +01:00
dependabot[bot] aee0ec7dec Bump browserslist in /clients/native/examples/js-examples/websocket (#619)
Bumps [browserslist](https://github.com/browserslist/browserslist) from 4.14.1 to 4.16.6.
- [Release notes](https://github.com/browserslist/browserslist/releases)
- [Changelog](https://github.com/browserslist/browserslist/blob/main/CHANGELOG.md)
- [Commits](https://github.com/browserslist/browserslist/compare/4.14.1...4.16.6)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-26 14:56:07 +01:00
Jędrzej Stuczyński b8e8beb62b Merge tag 'v0.10.1' into develop
release v0.10.1
2021-05-25 17:15:36 +01:00
Jędrzej Stuczyński b4ef0ae4f3 Merge branch 'release/v0.10.1' 2021-05-25 17:15:28 +01:00
Jędrzej Stuczyński d9087bf2a9 Upgrade commands 2021-05-24 11:52:31 +01:00
Jędrzej Stuczyński 2f29ee49db Updated changelog 2021-05-24 11:21:28 +01:00
Jędrzej Stuczyński abc5a58b19 Version bumps 2021-05-24 11:15:59 +01:00
Jędrzej Stuczyński 01d7e3a5f2 Bugfix/unique node ownership (#612)
* Removed old migration code

* Added new errors for duplicate nodes

* Checking for node ownership before adding them

* Tests
2021-05-21 09:03:07 -04:00
Jędrzej Stuczyński ea08fad2e0 Decreased log severity for verloc-related functionalities (#611)
* Decreased log severity for verloc-related functionalities

* Removed unused variable
2021-05-20 20:53:28 -04:00
Jędrzej Stuczyński a47bbf1e67 Disabled metrics reporting to the central server (#609) 2021-05-20 09:09:52 +01:00
Jędrzej Stuczyński 1fe38b1b9c Implemented display traits for identity and encryption keys (#607) 2021-05-19 10:33:01 -04:00
Jędrzej Stuczyński ed489149dc Feature/network monitor gateway pings (#608)
* Ability to send Ping frame to gateway

* Sending ping frame to gateways every 1min

* Increased monitor run interval back to 15min

* Whitespace
2021-05-19 10:32:31 -04:00
Dave Hrycyszyn 190d3c4972 Feature/add node description api (#605)
* Starting to build out node descriptions

* Renamed the mod to node_description instead of descriptor

* Returning results loaded from file

* Taking user input for node describe command

* Readline without new dependencies

* Adding input format hint

* Making sure the node can still start even when the descriptor file isn't there yet

* Adding some additional runtime checks

* Removing -dev from minimum node version

* Removing initial :: on serde

* Fixing comment on the /description endpoint

* Swapped json for toml

* Being a bit more specific with my startup message.

* Cleaning up path building

* Nicer runtime checks

* Put path building inside the file methods
2021-05-19 14:25:11 +01:00
Jędrzej Stuczyński ea62d01e65 Feature/updated network monitor (#604)
* Connecting to gateway with a timeout

* Added address value to InvalidAddress error

* Initial updated network monitor (does not submit results yet)

* Created client for node status api

* Changed default address to the local one

* Removed old validator client

* Renamed validator client rest to validator client

* Print conversion warnings using Display rather than Debug formattingn

* WIP for adding owner field in monitor

* Preserving changes before branch switch

* Keeping track of node owners during monitoring + using those for node status api

* Removed temporary log statement

* Dont notify node status api if good nodes are broken

* Changed default monitor interval to 5min

* Post merge issues

* Allowing dead version field in seocksrequest

* Updated monitor run interval to 15min

* Reporting gateways and mixnodes separately with the new api

* Unused imports

* Decreased testing interval to temporarily bypass the silent timeout issue

* Formattingn
2021-05-18 17:33:31 +01:00
dependabot[bot] 97156c918b Bump url-parse from 1.4.7 to 1.5.1 in /clients/webassembly/js-example (#598)
Bumps [url-parse](https://github.com/unshiftio/url-parse) from 1.4.7 to 1.5.1.
- [Release notes](https://github.com/unshiftio/url-parse/releases)
- [Commits](https://github.com/unshiftio/url-parse/compare/1.4.7...1.5.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-17 09:55:58 +01:00
dependabot[bot] d79013f1c1 Bump url-parse in /clients/native/examples/js-examples/websocket (#599)
Bumps [url-parse](https://github.com/unshiftio/url-parse) from 1.4.7 to 1.5.1.
- [Release notes](https://github.com/unshiftio/url-parse/releases)
- [Commits](https://github.com/unshiftio/url-parse/compare/1.4.7...1.5.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-17 09:55:52 +01:00
dependabot[bot] b69b221e62 Bump lodash in /clients/native/examples/js-examples/websocket (#601)
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.20 to 4.17.21.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.20...4.17.21)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-17 09:55:45 +01:00
dependabot[bot] 266138dcf2 Bump lodash from 4.17.20 to 4.17.21 in /clients/validator (#602)
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.20 to 4.17.21.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.20...4.17.21)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-17 09:55:12 +01:00
Jędrzej Stuczyński a8299e867d Feature/ping timings (#603)
* WIP

* WIP for time measurement

* In theory working sender and listener

* Further additions + main.rs for local testing

* Further improvements + config builder

* Initial integration into mixnode

* Verifying mixnode version

* 1.52+ clipy warning

* 1.54 nightly clippy fixes

* Changed HTTP Api to bind to the same ip as used for mix packets

* Changed measurements to instead write to shared object

* Required dependencies

* Connecting with the http api

* Updated mixnode common rand dependency
2021-05-12 11:20:03 -04:00
Dave Hrycyszyn 7dc4d653c2 Feature/add rocket (#600)
* Added rocket at a git tag

* Adding Rocket to the mixnode

* Verloc route now in place

* Adding an http api startup notification

* Updated version number to 0.10.1-dev

* Fixing clippy warnings

* Compressing split a bit

* Adjusted used version of js-sys

Co-authored-by: Jędrzej Stuczyński <jedrzej.stuczynski@gmail.com>
2021-05-11 17:40:29 +01:00
Jędrzej Stuczyński 2f9e67e8b2 Recalculating reward rates on appropriate value changes (#594) 2021-05-05 11:47:36 -04:00
Jędrzej Stuczyński 2c058bcbca Feature/simple payments (#571)
* Calculating reward per epoch

* Initial uptime-based rewards

* Setting monitor address on init + minor cleanup

* Ability to reward nodes through validator client

* Preemptively updated client version

* Using hardcoded monitor address

* Removed unnecessary let binding

* Comment typo

* Changed validator-client package.json version

* Checking for broadcast error

* Added epoch_length to typescript client's stateparams

* Setting default state on migration

* Removed reward mixnode/gateway methods from the client api

* api for executing custom contract methods

* Removed whitespace leftover from the merge

* Extra comments

* Cleanup

Co-authored-by: Dave Hrycyszyn <futurechimp@users.noreply.github.com>
2021-04-29 14:22:14 -04:00
Jędrzej Stuczyński 528eba2faa Changed default mixnode query page limit (#592)
* Changed default mixnode query page limit

* Fixed the tests

* 0.11.0 validator client
2021-04-29 13:58:28 -04:00
Jędrzej Stuczyński 7f7c37eeba Feature/more exposed client api (#591)
* Added public sign and broadcast to net client

* Created a function to send funds multiple times in a single block
2021-04-28 09:13:41 -04:00
Jędrzej Stuczyński 18adb1f5bd Contract adjustment to check for node ownership before allowing bonding (#590)
* Checking for gateway/mixnode ownership before allowing bonding of the other type

* Renamed bond and unbond to bondmixnode and unbondmixnode
2021-04-28 09:12:20 -04:00
Jędrzej Stuczyński a521bc0f54 Logging adjustment (#585)
* Reduced severity of common harmless warnings

* Changed the same ip node warning

* More explicit error on network address binding failure
2021-04-28 09:11:04 -04:00
dependabot[bot] 6f173ffebd Bump ssri from 6.0.1 to 6.0.2 in /clients/webassembly/js-example (#589)
Bumps [ssri](https://github.com/npm/ssri) from 6.0.1 to 6.0.2.
- [Release notes](https://github.com/npm/ssri/releases)
- [Changelog](https://github.com/npm/ssri/blob/v6.0.2/CHANGELOG.md)
- [Commits](https://github.com/npm/ssri/compare/v6.0.1...v6.0.2)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-04-23 17:14:33 +01:00
dependabot[bot] 7e31cbabe5 Bump ssri in /clients/native/examples/js-examples/websocket (#588)
Bumps [ssri](https://github.com/npm/ssri) from 6.0.1 to 6.0.2.
- [Release notes](https://github.com/npm/ssri/releases)
- [Changelog](https://github.com/npm/ssri/blob/v6.0.2/CHANGELOG.md)
- [Commits](https://github.com/npm/ssri/compare/v6.0.1...v6.0.2)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-04-23 17:14:19 +01:00
Jędrzej Stuczyński e8e966b67a Feature/multiple validator endpoints (#583)
* Rust half done

* Removed the temporary 'test'

* Using multiple validator endpoints in the javascript client

* Dont attempt any switches with a single validator endpoint

* Removed the unused temporary function

* Updated validator-client version
2021-04-23 16:41:39 +01:00
Jędrzej Stuczyński 73af405400 Checking for tx success when sending coins (#586)
* Checking for tx success when sending coins

* Changed send return type to BroadcastTxSuccess
2021-04-23 15:34:35 +01:00
Jędrzej Stuczyński 037723eb90 Impl Error trait for ValidatorClientError (#587) 2021-04-23 10:58:06 +01:00
François Garillot d432bebce8 Minor cosmetic changes while reading around (#568)
* Simplify some Option / Result / ? operator patterns

... when they have a direct combinator equivalent.

Tool-aided by [comby-rust](https://github.com/huitseeker/comby-rust)

* Remove panic in socket state
2021-04-19 15:12:19 +01:00
Jędrzej Stuczyński 0a3cffa1a1 Validator client patch version increase 2021-04-16 10:17:01 +01:00
Jędrzej Stuczyński 796107c4c5 Refreshing nodes gets all available nodes from the contract (#575) 2021-04-16 10:15:25 +01:00
Jędrzej Stuczyński fd0df9fe47 Merge tag '0.10.0' into develop
release 0.10.0
2021-04-15 10:05:29 +01:00
Jędrzej Stuczyński 58a7f4ea5f Merge branch 'release/0.10.0' 2021-04-15 10:05:20 +01:00
Jędrzej Stuczyński 725b8d6f8a Updated CHANGELOG 2021-04-15 10:05:10 +01:00
Jędrzej Stuczyński e5a1c1c97e Merge branch 'develop' into release/0.10.0 2021-04-15 10:02:48 +01:00
Dave b894dbf243 Merge branch 'develop' of github.com:nymtech/nym into develop 2021-04-15 10:01:08 +01:00
Dave 92821c8d81 Pushing changelog for 0.10.0 2021-04-15 10:00:52 +01:00
Jędrzej Stuczyński af8360f363 Updated old 0.9.2 versions to 0.10.0 2021-04-15 09:47:55 +01:00
Jędrzej Stuczyński 8b12a31f73 Version 0.10.0 of the validator client 2021-04-15 09:41:14 +01:00
Jędrzej Stuczyński fd55eb678c Displaying address of the client on init (#573) 2021-04-15 09:34:57 +01:00
Jędrzej Stuczyński bb3ce645a4 Changed default client topology refresh rate from 30s to 5min (#570) 2021-04-14 17:04:00 +01:00
Jędrzej Stuczyński 4e339f1788 Fixed nightly clippy warnings (#572)
* Fixed nightly clippy warnings

* Using string literal in panic message
2021-04-14 16:41:47 +01:00
Jędrzej Stuczyński dca9c7079c Merge branch 'develop' of github.com:nymtech/nym into develop 2021-04-14 11:42:23 +01:00
Jędrzej Stuczyński 52a8909e77 Updated default mixnet contract address 2021-04-14 11:42:05 +01:00
Dave Hrycyszyn 9d2c445bb7 Adding the wallet url in startup instructions (#569) 2021-04-13 14:13:13 +01:00
Dave Hrycyszyn 6a1c2fa5dd Feature/cli signing (#566)
* Adding hex output and coloured terminal output crates

* Adding a `sign` command to the mixnode

* IntelliJ's non-use of rustftm is non-IntelliJent. Whitespace commit.

* Removing hex, using base58 everywhere.
2021-04-12 11:11:20 +01:00
Jędrzej Stuczyński 809c3f3607 Updated version number on the validator client (#565) 2021-04-09 15:34:20 +01:00
Jędrzej Stuczyński bebf0df2de Removed unused data from cargo.toml (#567) 2021-04-09 15:19:39 +01:00
Dave Hrycyszyn 5652eb7ee3 A pull request for discussion about contract state variables (#563)
* A pull request for discussion about contract state variables

* Updated contract state struct

* Introduced transaction to update the contract state

* Moved transactions to separate file

* Corrected return type on query

* Corrected query match

* Added test for state params query

* Test for state params update

* Removed unused imports

* Helper functions to query for state params

* Removed hardcoded inside bond, old mix bond value

* Helper function to update contract state

* Changed typescript StateParam from numbers to strings

* Somehow unresolved post-merge issues in tests

* Introduced additional helpers for the validator client to use the new contract features

* Using the state-specified bond values

Co-authored-by: Jędrzej Stuczyński <jedrzej.stuczynski@gmail.com>
2021-04-09 13:10:01 +01:00
Jędrzej Stuczyński b6ba8f8555 Renamed mixnode registration into bonding (#564) 2021-04-08 15:37:56 +01:00
Jędrzej Stuczyński 22bfd44065 Feature/mixnet contract ci (#562)
* Fixed constant not updated in error macros

* Fixed clippy warning

* Attempt at adding mixnet contract to CI
2021-04-08 11:42:25 +01:00
Jędrzej Stuczyński 3136346a01 Feature/bonding adjustments (#561)
* Made mixnode bonding process similar to that of gateways' + lowered bonding fee

* Adjusted bonding fee to 100

* Adjusted MixNode Display implementation for nicer formating

* Renamed bonding stake to just bond

* Renamed other cases where stake was referring to bond
2021-04-08 11:15:19 +01:00
Jędrzej Stuczyński f536449f0c Feature/migration additions (#560)
* Changed default contract execution gas limit to 250_000 (from 9_000_000_000)

* Introduced ability to perform contract migration

* Removed unused import
2021-04-07 17:23:13 +01:00
Jędrzej Stuczyński 7659424f28 Changed default contract execution gas limit to 250_000 (from 9_000_000_000) (#559) 2021-04-07 14:37:11 +01:00
Jędrzej Stuczyński eff40dd907 Missing quotes in mixnet_contract_address config field (#558) 2021-04-06 14:46:37 +01:00
Jędrzej Stuczyński 800af218a5 Updated default validator url and contract address (#557) 2021-04-06 13:22:30 +01:00
dependabot[bot] f5c1b6dfdd Bump y18n in /clients/native/examples/js-examples/websocket (#556)
Bumps [y18n](https://github.com/yargs/y18n) from 4.0.0 to 4.0.1.
- [Release notes](https://github.com/yargs/y18n/releases)
- [Changelog](https://github.com/yargs/y18n/blob/master/CHANGELOG.md)
- [Commits](https://github.com/yargs/y18n/commits)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-04-06 12:17:18 +01:00
Dave dfdfba5d2f Merge branch 'develop' of github.com:nymtech/nym into develop 2021-04-01 12:08:34 +01:00
Jędrzej Stuczyński 047a483464 Added extra step for publishing validator client (#553) 2021-04-01 12:08:16 +01:00
Jędrzej Stuczyński 4a908e7e14 Feature/bonding info on init (#555)
* Mixnode bonding info on init

* Gateway bonding info on init
2021-04-01 12:08:16 +01:00
Jędrzej Stuczyński bcf25135a1 Feature/validator client address getter (#554)
* Added address getter for the client

* Might as well bump the version number
2021-04-01 12:08:16 +01:00
Jędrzej Stuczyński 087efbe553 Feature/validator client rc3 (#552)
* Bumped the version number

* Additional currency helper
2021-04-01 12:08:16 +01:00
Jędrzej Stuczyński 2be0ab6474 Feature/upgrade update (#551)
* Native client upgrade command capable of upgrading to 0.10.0

* Ibid for the socks5 client

* Mixnode upgrade command for 0.10.0

* Fixed clippy warnings

* Gateway upgrade command for 0.10.0

* Removed unused import
2021-04-01 12:08:16 +01:00
Dave Hrycyszyn 9a1abfad9c Feature/export coin helper (#550)
* Annoying whitesapce commit

* ibid

* Re-exporting `coin` so client applications don't need to import it from some random spot
2021-04-01 12:08:16 +01:00
Dave f7f119b100 Merge branch 'develop' of github.com:nymtech/nym into develop 2021-04-01 12:02:29 +01:00
Dave bd78f8833f Adding nymd binaries (which are just cosmwasm/wasmd v0.14.1 compiled artefacts)
May be helpful in case people don't have Go experience.
2021-04-01 12:02:11 +01:00
Dave 4a081d6fa7 Adding a pointer to the docs for validator deploy instructions 2021-04-01 12:01:35 +01:00
Jędrzej Stuczyński 42268e044c Added extra step for publishing validator client (#553) 2021-04-01 11:38:08 +01:00
Jędrzej Stuczyński 48dda32c3e Feature/bonding info on init (#555)
* Mixnode bonding info on init

* Gateway bonding info on init
2021-03-31 16:01:06 +01:00
Jędrzej Stuczyński a21ed92ac3 Feature/validator client address getter (#554)
* Added address getter for the client

* Might as well bump the version number
2021-03-31 10:15:42 +01:00
Jędrzej Stuczyński ee71ae89f7 Feature/validator client rc3 (#552)
* Bumped the version number

* Additional currency helper
2021-03-31 09:58:57 +01:00
Jędrzej Stuczyński a97377fdea Feature/upgrade update (#551)
* Native client upgrade command capable of upgrading to 0.10.0

* Ibid for the socks5 client

* Mixnode upgrade command for 0.10.0

* Fixed clippy warnings

* Gateway upgrade command for 0.10.0

* Removed unused import
2021-03-30 15:47:59 +01:00
Dave Hrycyszyn 1d4420820f Feature/export coin helper (#550)
* Annoying whitesapce commit

* ibid

* Re-exporting `coin` so client applications don't need to import it from some random spot
2021-03-30 15:36:16 +01:00
Jędrzej Stuczyński 596bc76cc6 Chore/dependency updates (#549)
* Updated all non-breaking dependencies

* Updated common/crypto dependencies

* Updated all tokio [and associated] dependencies to most recent version

* Bumped version of rand_distr

* Fixed api changes in tests

* Made clippy happier about the acronym

* Fixed the type while trying to make clippy even happier

* nightly cargo fmt
2021-03-29 15:32:34 +01:00
Jędrzej Stuczyński cc1b80229c Feature/validator query client (#547)
* Defined new query client

* Adjustments to NetClient

* Validator client changes

* Node caches taking either client instance

* Fixed incorrect import paths
2021-03-26 11:25:25 +00:00
Dave Hrycyszyn f07ac48a33 Feature/validator client rc2 (#546)
* Fixing publish instructions

* Bumped version number
2021-03-25 12:44:12 +00:00
Jędrzej Stuczyński 8abfc43fc8 Feature/has node query validator client (#545)
* Added contract query to check if given address owns a mixnode/gateway

* Fixed merge conflict

* Possibly working, but yet untested, checking for mix ownership for validator client
2021-03-25 12:20:56 +00:00
Jędrzej Stuczyński 7361d7a220 Added contract query to check if given address owns a mixnode/gateway (#544)
* Added contract query to check if given address owns a mixnode/gateway

* Fixed merge conflict
2021-03-24 17:29:08 +00:00
Dave Hrycyszyn 52d4ddb714 RC1 published (#543) 2021-03-24 11:49:58 +00:00
Dave Hrycyszyn ca60b8671c Feature/prep for publish (#542)
* Adding Apache license

* Getting package.json ready to roll
2021-03-24 11:04:05 +00:00
Jędrzej Stuczyński 9e0bb80163 Feature/topology conversion (#536)
* Removed reputation field from existing topology

* ibid for registration time

* Basic bond to topology conversion

* Made existing tests compilable

* Added owner and stake fields to mix and gateway topology entries

* Moved node conversion to topology crate

* Added mixnet contract field to clients configs

* topology refresher trying to use new validator

* Removed clients depepdency on the old validator client

* Removed mixnode dependency on the old validator client

* Removed gateway dependency on the old validator client

* Removed location field fron mixnode and gateway configs

* Removed incentives address from mixnodes and gateways

* Cargo.lock changes

* Ignoring clippy warnings originating from codegen from JsonSchema

* no longer formating string with a literal
2021-03-24 10:52:27 +00:00
Dave Hrycyszyn ce7dcbc163 Feature/bigger better stronger mnemonics (#541)
* Upping the size of the mnemonic

* Making mnemonicToAddress static
2021-03-24 10:33:41 +00:00
Dave Hrycyszyn cf93afb639 Removed a package-lock.json which seems to have been accidentally added (#539) 2021-03-23 12:59:03 +00:00
Dave 1119a9e55f Merge branch 'develop' of github.com:nymtech/nym into develop 2021-03-23 12:25:56 +00:00
Dave Hrycyszyn 51d2213819 Feature/convert to uhal (#537)
* Exporting Coin struct, needed for wallet

* Passing the url through instead of using local options.

This gives us the ability to hook up to the new validator

* Removing examples

* Simplifying dependencies a bit

* Setting all contract denominations to uhal

* Making stakeDenom configurable throughout
2021-03-23 12:18:08 +00:00
Dave b567ee55f3 Merge branch 'develop' of github.com:nymtech/nym into develop 2021-03-23 11:30:30 +00:00
Dave Hrycyszyn 5ef77185a1 Feature/hook up url in validator client (#535)
* Exporting Coin struct, needed for wallet

* Passing the url through instead of using local options.

This gives us the ability to hook up to the new validator
2021-03-19 16:35:46 +00:00
Dave 4ae8ae7231 Merge branch 'develop' of github.com:nymtech/nym into develop 2021-03-19 15:47:58 +00:00
Jędrzej Stuczyński 2e7cd451ec Feature/mix contract identity key (#533)
* Added identity_key field to mixnodes

* Printing out required bond information on mixnode startup
2021-03-18 15:05:32 +00:00
Dave Hrycyszyn d301694404 Feature/upgrade cosm client (#534)
* Exporting Coin struct, needed for wallet

* Upgrading cosmwasm client to 0.24.1
2021-03-18 14:40:55 +00:00
Dave 752bce589b Merge branch 'develop' of github.com:nymtech/nym into develop 2021-03-18 11:13:52 +00:00
Jędrzej Stuczyński 67c92b3e56 Feature/validator client rust (#532)
* Moved definition of mixnet contract common items to separate module

* Removed schemars dependency from being wasm32 specific

* Moved query responses to the shared module

* Fixed tests due to differerent import paths

* Updated dashmap in other crates to help with once_cell version selection

* Reexporting coin and humanaddr

* Deserializing response from validator

* Deserializing smart result directly to specific type

* Ability to query for mixnodes and gateways from rust

* Fixed compilation warning due to updated dashmap
2021-03-18 09:31:15 +00:00
Dave Hrycyszyn d3570df968 Feature/add currency helpers (#531)
* Exporting Coin struct, needed for wallet

* Adding currency helpers
2021-03-16 14:31:13 +00:00
Dave 261993ea90 Merge branch 'develop' of github.com:nymtech/nym into develop 2021-03-16 12:52:12 +00:00
Dave Hrycyszyn 0ae29eb5fa Exporting Coin struct, needed for wallet (#530) 2021-03-16 12:13:04 +00:00
Dave 87408d4b7b Exporting Coin struct, needed for wallet 2021-03-16 11:53:57 +00:00
Jędrzej Stuczyński 503f723a64 Feature/validator client gateway bonding (#526)
* Defined gateway and gatewaybond types

* Gateway related errors

* New message types

* gateway tests fixtures and helpers

* Handling of gateway-related messages

* Fixed most of clippy warnings

* Fixed eslint errors in the validator client

* Defining gateway bonds on the typescript side

Co-authored-by: Dave Hrycyszyn <futurechimp@users.noreply.github.com>
2021-03-16 11:48:41 +00:00
Dave 9c72aac255 Loading from key file 2021-03-15 14:18:29 +00:00
Dave 34a143696f Merge branch 'develop' of github.com:nymtech/nym into develop 2021-03-15 14:07:39 +00:00
Dave de22936ed1 Upload contract wasm script 2021-03-15 14:06:35 +00:00
Dave Hrycyszyn 9da9c95c80 Getting corrector user home dir in Python setup script (#528) 2021-03-15 13:40:54 +00:00
Dave a7fe4697c5 Getting corrector user home dir in Python setup script 2021-03-15 13:39:39 +00:00
Dave Hrycyszyn 1d9bced599 Temporarily disabling fs access (#527)
* Temporarily disabling fs access

* Going back to double quotes
2021-03-15 13:37:01 +00:00
Jędrzej Stuczyński a854118f19 Feature/gateway bonding (#524)
* Defined gateway and gatewaybond types

* Gateway related errors

* New message types

* gateway tests fixtures and helpers

* Handling of gateway-related messages

* Fixed most of clippy warnings
2021-03-12 14:28:58 +00:00
Jędrzej Stuczyński d496ee3031 Fixed eslint errors in the validator client (#525) 2021-03-12 14:19:51 +00:00
dependabot[bot] f29dd884f3 Bump elliptic in /clients/native/examples/js-examples/websocket (#521)
Bumps [elliptic](https://github.com/indutny/elliptic) from 6.5.3 to 6.5.4.
- [Release notes](https://github.com/indutny/elliptic/releases)
- [Commits](https://github.com/indutny/elliptic/compare/v6.5.3...v6.5.4)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-03-11 10:38:47 +00:00
Dave Hrycyszyn e1181f756c Fix the remove mixnode test (#522) 2021-03-10 16:06:31 +00:00
Dave Hrycyszyn 4ca40fd3bc Feature/initial mixnet contract (#515)
* Starting on cosmwasm smart contracts

* Mixnet contract now builds

* Removing license and notice files, the monorepo already has these.

* Removing generated README content

* Simplified development instructions a bit.

* Converted some network monitor files to use SPDX license headers

* Renamed packaget to mixnet-contracts

* Depending on the Nym topology crate

* Renaming contract package in usage

* Renamed "announce" to "register_node" in the defined messages

* Fixed package name for mixnet contracts in defined release annotations

* Added the mixnet contracts to the Cargo lock file

* Renamed some fields in our contract topology

* Using the stringy mixnode from the validator client.

* Removing mix nodes count from state, we can infer that

* Saving generated code in comment as it's a useful example for now

* Renamed "count" to "get_topology"

* Adding the beginnings of a validator client (in Typescript)

* Starting to integrate example code. WIP.

* Ignoring generated accounts

* Making a few less mixnodes :)

* Adding shebang to start script

* Cranking up the Nym-related gas limits, as otherwise contract upload fails.

* Simplest mixnode example is now working

* Removing the external client code, it messed up wasm compilation. Will copy/paste for now.

* Contract now wants to add a MixNode rather than an IP string

* Adding mixnodes via contract now works (!)

* Simplified mixnode registration example

* Further mixnode-adding simplification.

* Adding author name

* Fixed description

* Sent funds are now required to bond a mixnode

* Ensuring that we send correct coin denomination

* Unbonding now works (!). Quite primitivist.

* Checking that unbonding works from the client.

* Setting up a thief account to play with

* Checking to see whether thief can unbond a node (it fails, happily)

* Adding a more specific error for when an account attempts to unbond but owns no bonds

* Figured out how to test contract balances

* Set the console messages to explain things a little more nicely

* Tests for insufficient funds result

* Using more async in driver example

* Added a bit more explanation of the actions taken by the driver example

* Locking down wasm instantiate a bit more

* Docs clarifications on how to run example

* README clarification

* Corrected the commit hash in the wasmd build command, it was still set for 0.14.0

* Moved models from types into state

* Starting work on range queries

* whitespace

* Going back to slow but reliabel node uploads and disabling new contract upload

* Cranking gas fees temporarily

* Mixnode key retrieval working and tested

* Range retrievals now working well

* Removing unused clone

* Compressing tests a bit

* Testing node retrieval on large numbers of nodes.

Not sure whether MockStorage has the same space limitations as
production storage does.

* Getting rid of spelling warning

* Removing unused responses

* Minor cleanup

* Starting to map my way out of the tuples

* Slightly more meaningful variable names

* Returning a StdResult from nodes query

* Fighting through the unwraps :)

* Unfucking a bit more

* Starting to use ranged nodes in contract

* Testing node retrieval from range store

* Ditching generated tests

* Adding works, still need to test removing mixnodes

* Attempting to remove a mixnode returns an error when no nodes exist

* Un-registering when no accounts exist (edit)

* un-registering someone else's mixnode fails

* Ensuring proper ownership

* Testing for only 1 mixnode getting deleted

* Testing single-node retrieval

* Removing mixnode working

* Removed unused imports and unused variable warnings

* Made handler functions private

* Tested for error response on mixnode removal

* Ensured proper post-state on mixnode removal

* Using Vec<Coin> for currency equality comparisons

* Removed todo, this amount is only for logging purposes anyway

* Refactoring tests a bit

* Adding a few storytelling comments

* Putting helper methods into alphabetical order

* Drying up mixnode adding in tests

* Using the new add_mixnode helper

* Checking full object equality in test

* Removing the GetNodes handler

* Taking a more "storytelling" approach to the contract tests

* We need a few more methods to run our example driver

* We now need to make a new address for each node we want to have,

as each sending account can only have one node

* HumanAddr not needed

* Making call sequence a little more readable

* Added the results of today's experiments with the REST API to the validator client readme

* Corrected console.log message

* Adding a note about how to run tests

* More contract exercising fun

* Updating mocha

* Whitespace

* Adding a note about running tests

* Adding typed rest client

* Starting to mess with typescript paging client

* Removing the rest client, we'll use the cosmjs one for this

* Noting a few more contract requirements

* Starting client restructuring

* Importing cosmjs stargate client

* Starting to work on the chain cache

* Cleanup

* Removing type annotations which hilariously worked, confusing the compiler

* Might as well do each cache individually

* Renaming chaincache so that it handles only mixnodes

* Renaming chaincache

* Setting dynamic per-page value to ease testing

* Using perPage in tests

* Moving tests back into their own special home so they don't bloat our package

* Ignoring generated docs

* Adding TypeDoc documentation generator

* Removing unused NetClient import

* Added docs generation

* Noting existence of docs generation

* Starting to test paged responses

* Working paging tests

* Clarified test names a bit

* Removed console.logs

* Added a test for two full pages.

* Formatting

* Starting to query for mix nodes

* Removed the topology in preparation for paging

* Removing unused struct

* Getting ready for series-based paging

* We're now setting page size limits on list retrievals

* Pagination starting to work, needs more testing

* Moved test support stuff into its own home

* Removing duplicate testy code

* Testing all paging stuff in the contract

* Removed useless method duplicate

* Moving queries into their own file

* Removing redundant tests

* Testing default paging limit

* Testing max paging limit

* We don't need to c/p pagination stuff from the cw-plus contracts, removing

* Testing pagination

* Making next key calculation explict via a function

* Removing temporary variable

* Commenting final state

* Incorporating the PagedResponse

* On the road to a working TypeScript client

* Adding some logging utilities

* Paged retrieval working but needs improvement - it's very brittle

* Getting the loop right

* Removing unused logger

* Setting up a request count

* Documenting the ins and outs of the client network interface

* Removing requestCount as we're not using it yet

* Success! Making paginated requests for mixnodes!

* Differentiating between MixNode and MixNodeBond

* Checking that Fred can upload a mixnode

* Fixing export

* Adding the ability for client to get balances

* Docs fix

* Converting interfaces to types

* Changing `mixNodes()` to `getMixNodes()` on client

* We might as well return the nodes we've just retrieved when we refresh

* Starting work on unbonding

* Fixed a caching bug which was causing multiple result sets to be cached

* Using the sender address as the key for removal

* Importing some result stuff so we can find out what happened on execution

* Minor messing around to prove that the sequence fully works

* Displaying a nicer message on mixnode unbond

* Renamed announce to bond in validator client

* Fixed unstable clippy warnings

* Removing commented fields

* Comment spacing

* Changed announce to bond in example code

* Making the test accounts directory configurable

* Rebuilt

* Loading keys from the local ./accounts directory

* Ignoring contract lockfile

* Saving out a contract lockfile so things continue working after contract upload

* Splitting the driver example into smaller self-contained examples

* Deleting the example that Andrew hates so much

* Making dependabot happy

* Stricter equals

* Removing unused import
2021-03-09 11:32:51 +00:00
Dave Hrycyszyn 6483a62a7c Feature/fix go errors in examples (#516)
* Fixing annoying errors Go errors showing in example code

* Fixed further Go warnings
2021-03-02 09:27:36 +00:00
Jędrzej Stuczyński 83753af944 Running CI also on windows and macOS (#512)
* Running CI also on windows and macOS

* Rust 2021 formatting

* clippy::upper_case_acronyms where appropriate

* Allowing unknown clippy lints

* Further clippy updates

* Building wasm client during CI

* wasm actions update

* added working directory to cargo jobs

* Temporarily disabled wasm test and clippy
2021-03-01 11:06:13 +00:00
Jędrzej Stuczyński 6f8ae53f0c Feature/socks5 adjustments (#510)
* Increased default connection buffer size to help with packet bursts

* Informing remote about failure to establish connection

* Properly closing outbound proxy on failure to read from socket

* Split proxy runner into separate inbound and outbound files

* Flag indicating whether socks client actually started proxying

* Clearing stale proxies if other side is closed

* Decreased log level on not a warning

* Closing proxy if no messages were received in a while

* Dont print harmless false-positive errors

* Formatting + future notes

* Fixed packet delay in higher volume traffic

* Don't attempt writing empty messages to connection
2021-02-01 14:45:50 +00:00
Jędrzej Stuczyński 2f867b75f2 Fixed unused import in non-unix systems (#509) 2021-02-01 14:43:11 +00:00
Dave ea31e18d98 Adding license and extra crate to cargo.lock 2021-02-01 11:57:42 +00:00
Dave d03af9de05 Merge branch 'develop' of https://github.com/lnceballosz/nym into lnceballosz-develop 2021-01-29 10:28:47 +00:00
Jędrzej Stuczyński 4013d0c939 Checking if the delay has already expired before attempting to put it in delay queue (#508) 2021-01-29 10:18:24 +00:00
Jędrzej Stuczyński 3a261d22f5 Not including gateway non-delay when calculating total packet delay (#507) 2021-01-29 10:18:03 +00:00
Jędrzej Stuczyński 2314baf0d3 Allowing for a single topology refresh failure (#505) 2021-01-29 10:17:37 +00:00
Jędrzej Stuczyński c882778583 if on unix, save keys with 0600 permission (#504) 2021-01-29 10:17:02 +00:00
Jędrzej Stuczyński c67e0fee37 More human-readable errors on mixnode/gateway startup (#503)
* More human-readable errors on mixnode/gateway startup

* Missing dots

* Fixed comment moved to incorrect line during formatting
2021-01-29 10:16:38 +00:00
Jędrzej Stuczyński 863aa4535a Feature/ip filtering (#502)
* Initial split into domains and ipnets

* Changed the library used for ip networks for more convenience

* Adding disallowed hosts to the unknown file
2021-01-29 10:15:30 +00:00
Jędrzej Stuczyński 86c9ab2ef5 Feature/wasm client compilation fixes (#501)
* Gateway client wasm-specific fixes

* wasm-client adjustments
2021-01-29 10:13:22 +00:00
Jędrzej Stuczyński 12faa23222 Fixed possible crash on invalid topology (#500) 2021-01-29 10:12:02 +00:00
Jędrzej Stuczyński 9cd463b22c Feature/gateway monitoring (#499)
* ability to read from multiple gateway clients

* A very initial updated network monitor

* Summary producer printing report on each finished run

* fixed gateway startup issue

* initial cleanup pass

* Sending to gateways at specified rate

* Renaming

* Fixed first run interval

* Removed false positive error print

* Ability to use 'good' topology that is different from the one being tested

* Fixed clippy warnings
2021-01-29 10:11:13 +00:00
jstuczyn d7ec81ad0a Shutting up nightly clippy to fix all pending PRs 2021-01-28 11:59:05 +00:00
Jędrzej Stuczyński 2d3b4f4b91 Feature/GitHub actions and clippy cleanup (#493)
* Added github actions templates

* removed travis .yml file

* initial clippy cleanup pass

* fixed the rest of clippy warnings

* Made github badges more fancy and consistent with the ones in sphinx

* Updated local rustc version and removed compilation warningns

* ... and fresh clippy warnings

* formatting

* beta clippy specific warnings fixed

* Fixed all nightly clippy warnings

* Fixed trying to unwrap a ()

* Actually running all tests

* Correctly passing the --all flag

* Hopefullly third time's a charm in fixing argument passing
2021-01-18 11:50:29 +00:00
Dimitris Apostolou 131574cd3c Fix typos (#492) 2021-01-04 09:31:50 +00:00
dependabot[bot] 8b29c612f8 Bump ini from 1.3.5 to 1.3.8 in /clients/webassembly/js-example (#489)
Bumps [ini](https://github.com/isaacs/ini) from 1.3.5 to 1.3.8.
- [Release notes](https://github.com/isaacs/ini/releases)
- [Commits](https://github.com/isaacs/ini/compare/v1.3.5...v1.3.8)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-12-18 11:58:17 +00:00
dependabot[bot] 9c67b73472 Bump ini in /clients/native/examples/js-examples/websocket (#490)
Bumps [ini](https://github.com/isaacs/ini) from 1.3.5 to 1.3.8.
- [Release notes](https://github.com/isaacs/ini/releases)
- [Commits](https://github.com/isaacs/ini/compare/v1.3.5...v1.3.8)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-12-18 11:58:05 +00:00
Jędrzej Stuczyński 6b37a9b95c display 0 on no validators rather than crash (#488) 2020-12-10 15:31:22 +00:00
Lina Ceballos 67ac1d9f4b adding license and copyright headers 2020-12-10 10:13:17 +01:00
Lina Ceballos 28410eedad creating license file for image 2020-12-10 10:11:01 +01:00
Lina Ceballos 0fb182ccb9 creating license file for image 2020-12-10 10:08:54 +01:00
Lina Ceballos 7953e36e82 Associating Copyright/ Licensing info through a DEP5 file 2020-12-10 10:07:19 +01:00
Lina Ceballos 9cea2777d4 Adding LICENSES directory and add licenses texts 2020-12-10 10:05:49 +01:00
Jędrzej Stuczyński 46d3591a4f Bugfix/explorer fixes (#477)
* Using original std::thread::spawn

* websocket client reconnection upon broken metrics
2020-12-02 16:49:22 +00:00
Jędrzej Stuczyński 5fc81db0d9 Feature/removed topology (#481)
* Explorer also downloading 'active' and 'removed' topologies

* Updated dashboard with new standby and removed nodes

* Additional cleanup + restored commented code
2020-12-02 16:48:02 +00:00
Jędrzej Stuczyński fbdca2dcd5 Network requester now prints correct version with --version (#478) 2020-12-02 16:43:56 +00:00
Jędrzej Stuczyński afb7825135 Feature/0.9.2+only monitoring (#475)
* Not testing or informing validator about pre 0.9.2 nodes

* Corrected version check

* Updated JS file to monitor 0.9.2+ nodes

* Restored updates every minute
2020-11-26 16:44:18 +00:00
Jędrzej Stuczyński c2a1ed855b Release/v0.9.2 (#474)
* Updated version numbers

* Updated changelog
2020-11-26 15:15:42 +00:00
Jędrzej Stuczyński 210b5466bb Minor mixnet client code simplification and optimization (#472)
* Minor code simplification and optimization

* Made the connection establishing call non-blocking
2020-11-26 13:06:05 +00:00
Jędrzej Stuczyński 33d5effbdc Putting initial packet onto the queue when establishing connection (#471) 2020-11-25 15:09:40 +00:00
jstuczyn fa5c512aa8 Same fixes for client 2020-11-24 12:05:33 +00:00
jstuczyn c1b2a9aaa7 Corrected error message 2020-11-24 11:57:44 +00:00
jstuczyn cdef90c2a4 Changelog update 2020-11-24 11:17:11 +00:00
jstuczyn 8e80651617 Updated version numbers 2020-11-24 11:11:47 +00:00
Jędrzej Stuczyński 80775b7436 Additional feedback on unregistration on sigint (#466) 2020-11-24 10:57:53 +00:00
Jędrzej Stuczyński 83dcd75cea Updated message on shutdown (#467) 2020-11-24 10:57:11 +00:00
Jędrzej Stuczyński d52ea90cd2 Feature/upgrade additions (#465)
* Mix 0.9.x upgrade support

* Gateway upgrade support

* Client 0.9.x upgrades
2020-11-24 10:56:45 +00:00
Jędrzej Stuczyński cb59153422 Feature/nonblocking mix send (#464)
* No backoff

* reconnections

* Increased default network monitor default sending rate

* Comment for the future

* Maximum connection buffer size as part of config
2020-11-23 17:27:14 +00:00
Jędrzej Stuczyński 89f03e63c7 Feature/delay queue mixnodes (#462)
* Initial idea for the delayer

* Initial rought integration into mixnode

* Removed lock requirement from 'received' metrics

* 'sent' metrics

* Comment fix
2020-11-20 14:49:22 +00:00
Dave Hrycyszyn 692f9cb198 Update README.md 2020-11-20 14:27:24 +00:00
Dave 455e735da4 Merge branch 'develop' of github.com:nymtech/nym into develop 2020-11-19 18:07:07 +00:00
Dave 4b34ed1f16 Adding the ulimit stuff to suggested service file. 2020-11-19 18:05:39 +00:00
Jędrzej Stuczyński 08cb39d0af Feature/slowed down network monitor (#461)
* Variable gateway sending rate

* Changed interval ticker to delay

* Extra comment

* Performing delay after test run

* Minor adjustements

* Decreased sending rate

* minor optimization in case of single packet to send.
2020-11-19 17:48:22 +00:00
Jędrzej Stuczyński 1d851c390c Feature/unregister command (#460)
* Unregister command for mixnode

* Unregister command for gateway

* cargo fmt
2020-11-18 17:16:12 +00:00
Jędrzej Stuczyński a69123ebc1 Simple gateway client reconnection in obvious network failures (#459) 2020-11-18 17:11:41 +00:00
Jędrzej Stuczyński e3e633fce4 temporarily disabled mixnode status dot (#454) 2020-11-16 10:24:43 +00:00
jstuczyn 09d053c557 Merge branch 'master' into develop 2020-11-13 12:51:33 +00:00
Jędrzej Stuczyński 2fa5c3c3b7 Release/v0.9.0 (#453)
* Feature/wasm update (#341)

* Split text and binary client apis

* Very initial attempt at new serialization

* Defined ser+de for Recipient and ReplySURB

* Response errors

* builds with changes

* Working WS API + moved to separate crate

* updated python examples

* Fixed parsing bug

* Updated go examples

* Updated rust examples

* formatting

* Removed unused imports

* dependency updates

* Further dependency changes

* nymsphinx exposingn framing only if not in wasm32

* Cargo lock changes before develop merge

* Pending work

* Actually sending and receiving websocket from rust!

* more WIP

* Initial wasm client + establishing shared key with gateway!

* Splitting and sending a message!

* WIP

* WIP

* Initial wasm-ification of the gateway client

* Passing reconstruction result to js callback!

* Initial WASM cleaning pass

* Dependency pruning

* Moved processing loop to received_processor + at least ack unwrappingn

* Post merge fix

* Kinda updated react example

* Old print statement removed

* Removed yarn.lock

* Fixed building issue for other clients

* Fixed travis test command

* Updated wasm publishing instructions

* Feature/instant sending (#359)

* Ability to set client in vpn mode

* Connection handler for mixnode

* Initial vpn mode for mixes

* Updated SphinxCodec to contain more metadata

* Renaming

* Removed handle from mixnet client and introduced forwarder

* Mixnode using new forwarder

* Mixnode common module containing shared packet processing

* ibid. incorporated inside mixnode

* New processing for gateway

* Type cleanup

* Wasm fix

* Fixed client config

* Fixed mixnode runtime issues

* Formatting

* Client re-using secret on 'normal' packets

* Using the same key for acks

* WIP

* vpn key manager cleanup

* wasm fix

* VPN_KEY_REUSE_LIMIT moved to config

* Moved AckDelayQueue to separate common crate

* Key cache invalidator

* Updated dashmap used in gateway

* Old typo

* Additional comment

* Cargo fmt

* Fixed tests

* Sphinx update

* cache ttl as config option

* Cargo fmt

* Feature/network monitor (#369)

* WIP commit

* Further into errors (WIP)

* WIP commit, more stuff compiling, but now we switch to sneaky Jedrzej trick

* Websocket connections starting to work

* WIP

* Constructing the socket stream in one go

* Nicer connections. Getting topology now works.

* Fixing startup message

* Injecting directory uri

* Injecting good mixndodes

* Deleting old healthcheck

* Starting to wrap gateway client

* Splitting out good topology contstruction

* Starting to breathe finally

* Fixed layer assignment error

* Starting gateway client in a better spot

* Cleanup

* Renamed construct() to new()

* Injected channels, removed websockets

* Added a MixnetListener to deal with returned packet traffic

* Simplification

* Renaming and commenting a few things

* Renamed temp variables

* Fixed variable names

* Made errors a bit more explicit on message reconstruction

* Added the mixmining route / object to the directory server client

* Recipient is always "me", a bit easier to understand what's going on

* Subbing in test nodes works

* Using QA directory

* Noting which directory server we're using at monitor start

* Adding Debug to MixStatus so we can print it more easily

* Prettification of startup messages

* Notifying directory of successful packet receipt

* All nodes now being tested

* Now able to do timer-based test runs and detect the last node tested

* Renamed mixnet_listener to notifier

* Moved message chunking into its own home

* Starting to pull out packet sends

* Basic functionality working!

* Enabled timer runs forever

* License notices

* Depdendency cleanup

* Import cleanup

* Moved to implicit tokio runtime

* Removed some unnecessary data clones

* Fixed monitor doing two runs at startup rather than one

* dalek version updates

* This should have been split but got carried away

* Initial ipv6 support

* Don't test outdated nodes

* Added network monitor to default workspace members

* Actually sending reports

* Batch-sending mix status

* Cargo fmt

* Minor cleanup

* Malformed Cargo.lock

* Post-merge fixes

* Defined constant in main.rs for enabling detailed reporting

* Updated package versions of the system

* Checking version compatibility on startup

Co-authored-by: Dave Hrycyszyn <futurechimp@users.noreply.github.com>

* Added sphinx socks to default workspace members (#358)

* Feature/version in config (#376)

* Added version field to config files

* Removed built dependency

* Missing non-removed call to built

* Corrected version on client-core (#377)

* Feature/remove validator (#380)

* Replacing Rust validator sketch with Cosmos-based code.

* Removing old build instructions

* go fmt on generated code

* Removing build files for github and pi

* Starting transplant surgery

* Directory now running in validator, sans metrics

* Updating go sum

* A partly-working directory startup integrated into the nymcli app.

* Removing the Swagger docs header from nymcli, it can live in server.go

* Working swagger docs.

* Updating test title on Swagger docs

* Directory server now integrated into validator (primitive but working)

* Noted location of mixmining reports database.

* Bumped golang version

* Removing validator cargo files.

* Moving directory API init method into the nymd module

* Ditching a test which is causing tooling problems - presence will go away soon anyway

* Removing the validator and merging develop

* Update README.md

* Update README.md

* Feature/upgrade command (#381)

* Exposed version parsing from version checker

* Ability to upgrade mixnode from 0.8.X to 0.9.0

* Ability to upgrade gateway from 0.8.X to 0.9.0

* Ability to upgrade native client from 0.8.X to 0.9.0

* Ability to upgrade socks5 client from 0.8.X to 0.9.0

* Typo

* Minor renaming

* Preventing upgrade if current is not a release version

* Additional upgrade restrictions

* Corrected version bound

* Feature/mix ed25519 identity (#388)

* Introduced identity keypair to mixnode

* Updated upgrade 0.9.0 mix upgrade instructions

* Printing failed upgrade notice when it failed

* Moved printing upgrade start notice to beginning of function

* Feature/double init prevention (#386)

* Updated NymConfig trait making id always obligatory. Also added extra default method implementations

* Preventing init on mixnodes that were initialised before

* Quotes before mix id

* Preventing init on gateways that were initialised before

* Preventing init on native clients that were initialised before

* Preventing init on socks5 clients that were initialised before

* Feature/duration cleanup (#391)

* Mixnode using Duration for time intervals + human readable config fields for them

* Removed old comment

* Native client using Duration for time intervals + human readable config fields for them

* Socks5 client using Duration for time intervals + human readable config fields for them

* Gateway using Duration for time intervals + human readable config fields for them

* Config compatibility with 0.8.0 debug values

* Fixed previous merge issue

* Moving subsidiary functions down below main so we can see where thing start

* Feature/fix dependabot alerts (#393)

* Fixing a dependabot alert

* Fixing npm audit failures in js example for webassembly client

* Fixed some more npm audit problems

* Explicitly handling base58 key recovery errors (#396)

* Fix compiler warnings for unneeded mut (#398)

* moved new_v4_with_node to test only section (#392)

* moved new_v4_with_node to test only section

* cargo fmt

* Feature/directory server transition (#401)

* Initial changes to validator client API

* Updated models

* GatewayRegistrationInfo constructor

* Change validator topology to convert into NymTopology without failure

* Mixnode registering and unregistering presence

* Directory -> Validator renamings + adjustments

* Updated upgrade command for mixnode

* Extracted metrics part of directory client into separate library

* Removed no longer needed traits

* Integrated new metrics client into mixnode

* Introduced the same set of changes to the gateway

* Getting active topology in client core via validator client

* Updated clients to get correct topology

* Introduced mix mining endpoints to validator client

* Network monitor using validator client

* Removed directory client

* Updated wasm client

* Temporarily disabled the test

* Checking ok status for validator client response

* Updated upgrade command for clients

* Allowing using old presence directory as new validator endpoint for mixnodes and gateways

* Fixed tests in non-default crates

* Feature/validator api update (#402)

* Updated validator API routes

* missing comment

* Feature/wasm client fix (#399)

* Disabling wasm optimization for the moment, it isn't working on my machine

* Updating the React example back to a working state, 0.8.1 npm package is published.

* Merging develop into bugfix

* Upgrading react-scripts to fix a major vulnerability

* Using metrics interval received from server (#403)

* Using metrics interval received from server

* Test fix

* Feature/error on noninit (#404)

* More graceful shutdown in case of uninitialised client/node

* Performing version check on binary `run`

* Feature/no run config flag (#405)

* Removed `--config` parameter in `run` commands

* Removed old tests that were doing disk IO

* Renamed directory arguments to validator (#408)

* Feature/max retry (#409)

* Maximum number of allowed reconnection attempts

* Requiring initial internode connection to be successful

* Decreased logging level for failing to establish initial connection

* Feature/controlled reinit (#410)

* Allowing init with existing id but keeps existing keys

* Removed unused imports

* Removed debug print statement (#411)

* Updated upgrade commands to set new default validator (#413)

* Feature/network monitor file topology (#412)

* Network monitor loading 'good' topology from files instead

* Update .gitignore

* Passing address of validator as an argument

* Made detailed report const flag into an argument

* Flag to start network requester in open proxy mode (#418)

* Renamed 'sphinx-socks' to 'network-requester' (#417)

* Added option to set incentives address during mix and gateway init (#419)

* Updated validator topology (#420)

* Bugfix/upgrade fix (#421)

* Added default for incentives address when deserializing

* Ability to optionally pass incentives address during upgrade

* Feature/socks improvements (#423)

* Changed AvailableReader from Future to Stream

* comment formatting

* WIP

* Maximum number of bytes read per poll

* More detailed socks5 printing

* Split up socks5 service provider runner

* Fixed closing proxy too soon on one side

* Additional log information

* Printing connection id in log target

* Adjusted some constants

* Target field in log

* Removed dead code

* Decreased logging level

* Explicitly seperated 'Send' and 'Connect' request + data buffering

* Temporarily commented out test that fails due to not understanding limitations of tokio test io builder

* Fixed socks5 tests

* Starting cover traffic stream under correct condition (#422)

* Fixed bunch of clippy warnings (#427)

* Updated default sending rates (#430)

* Feature/explorer (#431)

* Initial commit of the new dashboard code.

* Periodically grabbing topology json

* Pulling file saving out into its own module

* Ignoring downloaded topology file

* Moved everything public into a public folder

* Refreshing the mixmining report

* Mounting static files from /public

* Including mixminiming report grabber

* Leaving the route in place to pick up later. It's not used right now.

* Removing json download from git

* Ignoring topology download

* Moving recurrent jobs in to a jobs module

* Adding websocket dependencies

* Starting to get client/server websocket functionality running.

* Fixing unused imports

* Separating client and server functionality a bit more cleanly

* WIP to sketch out the ws client and server a bit more

* Initial metrics broadcaster

* Import fixup

* Spawning rocket in tokio task

* Removed outdated comment

* removed the js file

Co-authored-by: Dave <futurechimp@users.noreply.github.com>

* Bugfix/metrics fixes (#434)

* Updated dashboard html file

* Changed explorer to listen on the same port as old dashboard

* Using correct field names in js file

* Sending correct key in metrics

* Added nym prefix to binary names (#436)

* Passing validator base url as an argument (#439)

* Spawning rocket as a blocking task (#440)

* Update main.js (#441)

* Update main.js

* Changed websocket port to 1648

* Changing default validator location to make it clear we're testnet (#437)

* Changing default validator location to make it clear we're on a testnet here.

* Updated validator url

* Updated metrics url

Co-authored-by: jstuczyn <jedrzej.stuczynski@gmail.com>

* Adding keybase to allowed.list.sample (#442)

* Updated nym-run gateway id (#445)

* Adjusted 'fastmode' settings (#444)

* Added validators to dashboard + validator and block count (#443)

* Slightly friendlier upgrade argument description (#446)

* Slightly friendlier upgrade argument description

* Added right format examples

* Explorer public folder being relative to the binary (#447)

* Explorer public folder being relative to the binary

* Qualifying the public mounting path

Co-authored-by: Dave <futurechimp@users.noreply.github.com>

* Extra argument to specify metrics websocket + long attribute (#448)

* Extra argument to specify metrics websocket + long attribute

* Default testnet values

* Fixed the URL of the websocket (#449)

* Removed hardcoded 'good gateways' in favour of pseusorandom choice from the active set (#450)

* Adding graceful de-registration to service

* Removed incentives form url (#451)

* Updated version numbers

* Updated generate changelog script

* Updated changelog

* wasm examples fixes

Co-authored-by: Dave Hrycyszyn <futurechimp@users.noreply.github.com>
Co-authored-by: Ethan Frey <ethanfrey@users.noreply.github.com>
2020-11-13 12:44:58 +00:00
Jędrzej Stuczyński 3f86919d44 Removed incentives form url (#451) 2020-11-13 10:58:01 +00:00
Dave 4e7dbd93ed Merge branch 'develop' of github.com:nymtech/nym into develop 2020-11-13 10:37:51 +00:00
Dave 0944c127ac Adding graceful de-registration to service 2020-11-13 10:37:42 +00:00
Jędrzej Stuczyński 9cc28db732 Removed hardcoded 'good gateways' in favour of pseusorandom choice from the active set (#450) 2020-11-13 09:58:00 +00:00
Dave Hrycyszyn 21d27495f4 Fixed the URL of the websocket (#449) 2020-11-12 17:53:46 +00:00
Jędrzej Stuczyński 36ec2fef60 Extra argument to specify metrics websocket + long attribute (#448)
* Extra argument to specify metrics websocket + long attribute

* Default testnet values
2020-11-12 17:31:16 +00:00
Jędrzej Stuczyński 830a89cfd4 Explorer public folder being relative to the binary (#447)
* Explorer public folder being relative to the binary

* Qualifying the public mounting path

Co-authored-by: Dave <futurechimp@users.noreply.github.com>
2020-11-12 16:47:00 +00:00
Jędrzej Stuczyński c18766a617 Slightly friendlier upgrade argument description (#446)
* Slightly friendlier upgrade argument description

* Added right format examples
2020-11-12 15:21:33 +00:00
Jędrzej Stuczyński f1e61b16b1 Added validators to dashboard + validator and block count (#443) 2020-11-12 15:03:35 +00:00
Jędrzej Stuczyński 3a5ed57eff Adjusted 'fastmode' settings (#444) 2020-11-12 15:02:45 +00:00
Jędrzej Stuczyński a0b1e00321 Updated nym-run gateway id (#445) 2020-11-12 15:02:02 +00:00
Dave Hrycyszyn 652f39d86d Adding keybase to allowed.list.sample (#442) 2020-11-12 14:40:04 +00:00
Dave Hrycyszyn 3372d38b2d Changing default validator location to make it clear we're testnet (#437)
* Changing default validator location to make it clear we're on a testnet here.

* Updated validator url

* Updated metrics url

Co-authored-by: jstuczyn <jedrzej.stuczynski@gmail.com>
2020-11-12 11:52:37 +00:00
Jędrzej Stuczyński a3d9149d2a Update main.js (#441)
* Update main.js

* Changed websocket port to 1648
2020-11-12 11:07:15 +00:00
Jędrzej Stuczyński 6a2412f5dd Spawning rocket as a blocking task (#440) 2020-11-12 10:46:08 +00:00
Jędrzej Stuczyński 3ef40035ad Passing validator base url as an argument (#439) 2020-11-12 09:48:06 +00:00
Jędrzej Stuczyński 4da04978be Added nym prefix to binary names (#436) 2020-11-11 12:08:40 +00:00
Jędrzej Stuczyński 0649593116 Bugfix/metrics fixes (#434)
* Updated dashboard html file

* Changed explorer to listen on the same port as old dashboard

* Using correct field names in js file

* Sending correct key in metrics
2020-11-11 11:37:16 +00:00
Jędrzej Stuczyński 818405982d Feature/explorer (#431)
* Initial commit of the new dashboard code.

* Periodically grabbing topology json

* Pulling file saving out into its own module

* Ignoring downloaded topology file

* Moved everything public into a public folder

* Refreshing the mixmining report

* Mounting static files from /public

* Including mixminiming report grabber

* Leaving the route in place to pick up later. It's not used right now.

* Removing json download from git

* Ignoring topology download

* Moving recurrent jobs in to a jobs module

* Adding websocket dependencies

* Starting to get client/server websocket functionality running.

* Fixing unused imports

* Separating client and server functionality a bit more cleanly

* WIP to sketch out the ws client and server a bit more

* Initial metrics broadcaster

* Import fixup

* Spawning rocket in tokio task

* Removed outdated comment

* removed the js file

Co-authored-by: Dave <futurechimp@users.noreply.github.com>
2020-11-11 09:43:33 +00:00
Jędrzej Stuczyński 7976776399 Updated default sending rates (#430) 2020-11-10 16:05:09 +00:00
Jędrzej Stuczyński 69eefaf91f Fixed bunch of clippy warnings (#427) 2020-11-10 15:28:55 +00:00
Jędrzej Stuczyński 7d694194ca Starting cover traffic stream under correct condition (#422) 2020-11-10 13:00:38 +00:00
Jędrzej Stuczyński be49c3843a Feature/socks improvements (#423)
* Changed AvailableReader from Future to Stream

* comment formatting

* WIP

* Maximum number of bytes read per poll

* More detailed socks5 printing

* Split up socks5 service provider runner

* Fixed closing proxy too soon on one side

* Additional log information

* Printing connection id in log target

* Adjusted some constants

* Target field in log

* Removed dead code

* Decreased logging level

* Explicitly seperated 'Send' and 'Connect' request + data buffering

* Temporarily commented out test that fails due to not understanding limitations of tokio test io builder

* Fixed socks5 tests
2020-11-10 12:47:26 +00:00
Jędrzej Stuczyński bb04961b41 Bugfix/upgrade fix (#421)
* Added default for incentives address when deserializing

* Ability to optionally pass incentives address during upgrade
2020-11-09 16:47:23 +00:00
Jędrzej Stuczyński a91b2dcafc Updated validator topology (#420) 2020-11-06 16:58:32 +00:00
Jędrzej Stuczyński 7c04a10545 Added option to set incentives address during mix and gateway init (#419) 2020-11-05 17:15:39 +00:00
Jędrzej Stuczyński 7eaef53c62 Renamed 'sphinx-socks' to 'network-requester' (#417) 2020-11-05 12:39:02 +00:00
Jędrzej Stuczyński d6a191a9b1 Flag to start network requester in open proxy mode (#418) 2020-11-05 12:36:05 +00:00
Jędrzej Stuczyński 566eb87b83 Feature/network monitor file topology (#412)
* Network monitor loading 'good' topology from files instead

* Update .gitignore

* Passing address of validator as an argument

* Made detailed report const flag into an argument
2020-11-04 12:54:28 +00:00
Jędrzej Stuczyński e4c8a6b72b Updated upgrade commands to set new default validator (#413) 2020-11-04 12:53:25 +00:00
Jędrzej Stuczyński 9d9d530581 Removed debug print statement (#411) 2020-11-03 17:56:00 +00:00
Jędrzej Stuczyński 00b2ce18c8 Feature/controlled reinit (#410)
* Allowing init with existing id but keeps existing keys

* Removed unused imports
2020-11-03 14:58:47 +00:00
Jędrzej Stuczyński 72496ad2aa Feature/max retry (#409)
* Maximum number of allowed reconnection attempts

* Requiring initial internode connection to be successful

* Decreased logging level for failing to establish initial connection
2020-11-03 14:55:10 +00:00
Jędrzej Stuczyński d7985ef05d Renamed directory arguments to validator (#408) 2020-11-02 14:14:08 +00:00
Jędrzej Stuczyński 607297bf54 Feature/no run config flag (#405)
* Removed `--config` parameter in `run` commands

* Removed old tests that were doing disk IO
2020-10-30 16:28:39 +00:00
Jędrzej Stuczyński 7c65101609 Feature/error on noninit (#404)
* More graceful shutdown in case of uninitialised client/node

* Performing version check on binary `run`
2020-10-30 15:15:18 +00:00
Jędrzej Stuczyński 72e9fb1bc3 Using metrics interval received from server (#403)
* Using metrics interval received from server

* Test fix
2020-10-30 15:14:19 +00:00
Dave Hrycyszyn 4099701852 Feature/wasm client fix (#399)
* Disabling wasm optimization for the moment, it isn't working on my machine

* Updating the React example back to a working state, 0.8.1 npm package is published.

* Merging develop into bugfix

* Upgrading react-scripts to fix a major vulnerability
2020-10-30 13:35:44 +00:00
Jędrzej Stuczyński 0f0a428142 Feature/validator api update (#402)
* Updated validator API routes

* missing comment
2020-10-29 16:10:59 +00:00
Jędrzej Stuczyński 12584749c8 Feature/directory server transition (#401)
* Initial changes to validator client API

* Updated models

* GatewayRegistrationInfo constructor

* Change validator topology to convert into NymTopology without failure

* Mixnode registering and unregistering presence

* Directory -> Validator renamings + adjustments

* Updated upgrade command for mixnode

* Extracted metrics part of directory client into separate library

* Removed no longer needed traits

* Integrated new metrics client into mixnode

* Introduced the same set of changes to the gateway

* Getting active topology in client core via validator client

* Updated clients to get correct topology

* Introduced mix mining endpoints to validator client

* Network monitor using validator client

* Removed directory client

* Updated wasm client

* Temporarily disabled the test

* Checking ok status for validator client response

* Updated upgrade command for clients

* Allowing using old presence directory as new validator endpoint for mixnodes and gateways

* Fixed tests in non-default crates
2020-10-28 14:22:32 +00:00
Jędrzej Stuczyński e759db4ed4 moved new_v4_with_node to test only section (#392)
* moved new_v4_with_node to test only section

* cargo fmt
2020-10-26 19:17:24 +00:00
Ethan Frey 7064e85e5a Fix compiler warnings for unneeded mut (#398) 2020-10-26 19:16:39 +00:00
Jędrzej Stuczyński 495ca35c1f Explicitly handling base58 key recovery errors (#396) 2020-10-22 15:50:56 +01:00
Dave Hrycyszyn 3c07a690a2 Feature/fix dependabot alerts (#393)
* Fixing a dependabot alert

* Fixing npm audit failures in js example for webassembly client

* Fixed some more npm audit problems
2020-10-15 09:39:37 +01:00
Dave 7c808ae356 Merge branch 'develop' of github.com:nymtech/nym into develop 2020-10-14 18:15:24 +01:00
Dave e236b9f1af Moving subsidiary functions down below main so we can see where thing start 2020-10-14 18:15:16 +01:00
Jędrzej Stuczyński 2585efc540 Feature/duration cleanup (#391)
* Mixnode using Duration for time intervals + human readable config fields for them

* Removed old comment

* Native client using Duration for time intervals + human readable config fields for them

* Socks5 client using Duration for time intervals + human readable config fields for them

* Gateway using Duration for time intervals + human readable config fields for them

* Config compatibility with 0.8.0 debug values

* Fixed previous merge issue
2020-10-14 17:25:12 +01:00
Jędrzej Stuczyński d940bc8f31 Feature/double init prevention (#386)
* Updated NymConfig trait making id always obligatory. Also added extra default method implementations

* Preventing init on mixnodes that were initialised before

* Quotes before mix id

* Preventing init on gateways that were initialised before

* Preventing init on native clients that were initialised before

* Preventing init on socks5 clients that were initialised before
2020-10-14 13:30:57 +01:00
Jędrzej Stuczyński 2f7b3eec08 Feature/mix ed25519 identity (#388)
* Introduced identity keypair to mixnode

* Updated upgrade 0.9.0 mix upgrade instructions

* Printing failed upgrade notice when it failed

* Moved printing upgrade start notice to beginning of function
2020-10-14 13:28:20 +01:00
Jędrzej Stuczyński c8bf454ccc Feature/upgrade command (#381)
* Exposed version parsing from version checker

* Ability to upgrade mixnode from 0.8.X to 0.9.0

* Ability to upgrade gateway from 0.8.X to 0.9.0

* Ability to upgrade native client from 0.8.X to 0.9.0

* Ability to upgrade socks5 client from 0.8.X to 0.9.0

* Typo

* Minor renaming

* Preventing upgrade if current is not a release version

* Additional upgrade restrictions

* Corrected version bound
2020-10-14 10:36:10 +01:00
Dave Hrycyszyn e7bd27a2d0 Update README.md 2020-10-13 18:37:08 +01:00
Dave Hrycyszyn 174206ca36 Update README.md 2020-10-13 18:36:13 +01:00
Dave Hrycyszyn 366335a015 Feature/remove validator (#380)
* Replacing Rust validator sketch with Cosmos-based code.

* Removing old build instructions

* go fmt on generated code

* Removing build files for github and pi

* Starting transplant surgery

* Directory now running in validator, sans metrics

* Updating go sum

* A partly-working directory startup integrated into the nymcli app.

* Removing the Swagger docs header from nymcli, it can live in server.go

* Working swagger docs.

* Updating test title on Swagger docs

* Directory server now integrated into validator (primitive but working)

* Noted location of mixmining reports database.

* Bumped golang version

* Removing validator cargo files.

* Moving directory API init method into the nymd module

* Ditching a test which is causing tooling problems - presence will go away soon anyway

* Removing the validator and merging develop
2020-10-13 13:30:23 +01:00
Jędrzej Stuczyński 9c5cd54264 Corrected version on client-core (#377) 2020-10-12 16:35:59 +01:00
Jędrzej Stuczyński 1e35eeefaa Feature/version in config (#376)
* Added version field to config files

* Removed built dependency

* Missing non-removed call to built
2020-10-12 16:35:26 +01:00
Jędrzej Stuczyński c3a812b3cb Added sphinx socks to default workspace members (#358) 2020-10-12 10:13:06 +01:00
Jędrzej Stuczyński 124712a954 Feature/network monitor (#369)
* WIP commit

* Further into errors (WIP)

* WIP commit, more stuff compiling, but now we switch to sneaky Jedrzej trick

* Websocket connections starting to work

* WIP

* Constructing the socket stream in one go

* Nicer connections. Getting topology now works.

* Fixing startup message

* Injecting directory uri

* Injecting good mixndodes

* Deleting old healthcheck

* Starting to wrap gateway client

* Splitting out good topology contstruction

* Starting to breathe finally

* Fixed layer assignment error

* Starting gateway client in a better spot

* Cleanup

* Renamed construct() to new()

* Injected channels, removed websockets

* Added a MixnetListener to deal with returned packet traffic

* Simplification

* Renaming and commenting a few things

* Renamed temp variables

* Fixed variable names

* Made errors a bit more explicit on message reconstruction

* Added the mixmining route / object to the directory server client

* Recipient is always "me", a bit easier to understand what's going on

* Subbing in test nodes works

* Using QA directory

* Noting which directory server we're using at monitor start

* Adding Debug to MixStatus so we can print it more easily

* Prettification of startup messages

* Notifying directory of successful packet receipt

* All nodes now being tested

* Now able to do timer-based test runs and detect the last node tested

* Renamed mixnet_listener to notifier

* Moved message chunking into its own home

* Starting to pull out packet sends

* Basic functionality working!

* Enabled timer runs forever

* License notices

* Depdendency cleanup

* Import cleanup

* Moved to implicit tokio runtime

* Removed some unnecessary data clones

* Fixed monitor doing two runs at startup rather than one

* dalek version updates

* This should have been split but got carried away

* Initial ipv6 support

* Don't test outdated nodes

* Added network monitor to default workspace members

* Actually sending reports

* Batch-sending mix status

* Cargo fmt

* Minor cleanup

* Malformed Cargo.lock

* Post-merge fixes

* Defined constant in main.rs for enabling detailed reporting

* Updated package versions of the system

* Checking version compatibility on startup

Co-authored-by: Dave Hrycyszyn <futurechimp@users.noreply.github.com>
2020-10-09 16:00:19 +01:00
Jędrzej Stuczyński 4f6b2aea19 Feature/instant sending (#359)
* Ability to set client in vpn mode

* Connection handler for mixnode

* Initial vpn mode for mixes

* Updated SphinxCodec to contain more metadata

* Renaming

* Removed handle from mixnet client and introduced forwarder

* Mixnode using new forwarder

* Mixnode common module containing shared packet processing

* ibid. incorporated inside mixnode

* New processing for gateway

* Type cleanup

* Wasm fix

* Fixed client config

* Fixed mixnode runtime issues

* Formatting

* Client re-using secret on 'normal' packets

* Using the same key for acks

* WIP

* vpn key manager cleanup

* wasm fix

* VPN_KEY_REUSE_LIMIT moved to config

* Moved AckDelayQueue to separate common crate

* Key cache invalidator

* Updated dashmap used in gateway

* Old typo

* Additional comment

* Cargo fmt

* Fixed tests

* Sphinx update

* cache ttl as config option

* Cargo fmt
2020-09-30 17:30:17 +01:00
Jedrzej Stuczynski ebea0166f1 Merge branch 'master' into develop 2020-09-28 17:21:36 +01:00
Jędrzej Stuczyński d05b313a99 Hotfix/0.8.1 (#357)
* Feature/wasm update (#341)

* Split text and binary client apis

* Very initial attempt at new serialization

* Defined ser+de for Recipient and ReplySURB

* Response errors

* builds with changes

* Working WS API + moved to separate crate

* updated python examples

* Fixed parsing bug

* Updated go examples

* Updated rust examples

* formatting

* Removed unused imports

* dependency updates

* Further dependency changes

* nymsphinx exposingn framing only if not in wasm32

* Cargo lock changes before develop merge

* Pending work

* Actually sending and receiving websocket from rust!

* more WIP

* Initial wasm client + establishing shared key with gateway!

* Splitting and sending a message!

* WIP

* WIP

* Initial wasm-ification of the gateway client

* Passing reconstruction result to js callback!

* Initial WASM cleaning pass

* Dependency pruning

* Moved processing loop to received_processor + at least ack unwrappingn

* Post merge fix

* Kinda updated react example

* Old print statement removed

* Removed yarn.lock

* Fixed building issue for other clients

* Fixed travis test command

* Updated wasm publishing instructions

* Increased default presence and metrics sending interval (#354)

* Defaulting to mix layer with fewest node if no argument provided (#353)

* Defaulting to mix layer with fewest node if no argument provided

* cargo fmt

* Selecting the gateway randomly from 2 known good ones. (#355)

* Selecting the gateway randomly from 2 known good ones. There's a problem with the config file in this commit though.

* Saving value of chosen gateway

* Removed duplicate printing of gateway being used

Co-authored-by: jstuczyn <jedrzej.stuczynski@gmail.com>

* More detailed error response on authentication/registration failure (#356)

* Updated changelog

* Updated version numbers

Co-authored-by: Dave Hrycyszyn <futurechimp@users.noreply.github.com>
2020-09-28 17:19:07 +01:00
jstuczyn 689c4fc66c Updated wasm publishing instructions 2020-09-16 15:32:31 +01:00
Jędrzej Stuczyński c50e9a9ed7 Feature/wasm update (#341)
* Split text and binary client apis

* Very initial attempt at new serialization

* Defined ser+de for Recipient and ReplySURB

* Response errors

* builds with changes

* Working WS API + moved to separate crate

* updated python examples

* Fixed parsing bug

* Updated go examples

* Updated rust examples

* formatting

* Removed unused imports

* dependency updates

* Further dependency changes

* nymsphinx exposingn framing only if not in wasm32

* Cargo lock changes before develop merge

* Pending work

* Actually sending and receiving websocket from rust!

* more WIP

* Initial wasm client + establishing shared key with gateway!

* Splitting and sending a message!

* WIP

* WIP

* Initial wasm-ification of the gateway client

* Passing reconstruction result to js callback!

* Initial WASM cleaning pass

* Dependency pruning

* Moved processing loop to received_processor + at least ack unwrappingn

* Post merge fix

* Kinda updated react example

* Old print statement removed

* Removed yarn.lock

* Fixed building issue for other clients

* Fixed travis test command
2020-09-16 15:18:04 +01:00
Jedrzej Stuczynski 23edeefcdc Merge tag 'v0.8.0' into develop
Release v0.8.0
2020-09-10 14:17:29 +01:00
Jedrzej Stuczynski f58d19ab9a Merge branch 'release/v0.8.0' 2020-09-10 14:17:13 +01:00
Jedrzej Stuczynski 68dac6266e Updated version numbers 2020-09-10 14:17:01 +01:00
Jędrzej Stuczyński 04948d3d62 v0.8.0 Changelog update (#328)
* Updated changelog

* Changed link to future tag

* Changelog update
2020-09-10 14:14:13 +01:00
Jędrzej Stuczyński 6aada422ec placeholder contact form url (#334)
* placeholder contact form url

* Gateway URL update

* Mixnode url update
2020-09-10 14:08:48 +01:00
Jędrzej Stuczyński b487126f5f Recommended testnet gateway (#335) 2020-09-10 12:52:04 +01:00
Dave 9d2838425a Reducing default delays 2020-09-10 12:23:46 +01:00
Dave Hrycyszyn 915dba2c32 Knocking down delay on message sending default (#332)
* Knocking down delay on message sending default

* accuratizing comments
2020-09-10 11:03:16 +01:00
Jędrzej Stuczyński 66eb1913ba Made gateway mandatory during init (#331) 2020-09-10 10:57:35 +01:00
Dave Hrycyszyn 82b0d7cbcf Renaming client binary (#330) 2020-09-10 10:04:47 +01:00
Jędrzej Stuczyński 533de18175 Socks client no longer logging dns resolved addresses (#329) 2020-09-09 09:47:38 +01:00
Dave Hrycyszyn 4e88960d60 Removing onion addresses.
Tor over a mixnet would be fun though.
2020-09-08 18:43:49 +01:00
Dave Hrycyszyn 256c04bbfa Feature/sphinx socks (#326)
* Renamed simple-socks5 to sphinx-socks

* Changing default storefile path to rename

* Adding a sample list of allowed network requests

* Fixing test
2020-09-08 16:20:27 +01:00
Jędrzej Stuczyński d3ce909916 Feature/websocket js example dependency update (#323)
* Removed yarn.lock file

* Updated dependencies
2020-09-08 15:19:47 +01:00
Jędrzej Stuczyński 29074723c3 Feature/temp wasm example removal (#324)
* Removed yarn.lock file

* wasm js-example dependency updates

* Disabled wasm js-example

* Disabled wasm react example
2020-09-08 15:18:44 +01:00
Jędrzej Stuczyński 0f01893ac2 Feature/print client address on startup (#325)
* Decreased logging level

* Printing clients full address on startup
2020-09-08 15:18:09 +01:00
Jędrzej Stuczyński ae40b0d857 snake_cased replySURBs (#322) 2020-09-08 13:11:22 +01:00
Jędrzej Stuczyński 80d01f1f75 Feature/outbound request lists (#321)
* Moving main upwards

* WIP commit

* Checking outbound requests starting to happen

* Renamed Persistence to HostsStore

* Ensured that unknowns are only added once

* Ownership improvements

* Adding rand crate so we can generate test output files

* Adding dirs crate so we can save to disk

* ibid

* ibid

* Unknown hosts are written to file

* Tests ensuring that unknown requests are written only once

* Fixed up paths for easier testing

* Loading host lists from disk

* Saving domain roots in unknown file

* Only fetching the publicsuffix domains list once

* Documenting use of publicsuffix list

* Beefed up error handling

* Knocking down log level on high water mark

* Minor cleanup on domain parsing

* Noted failing filter check
2020-09-08 12:06:32 +01:00
Dave 83e78e7df1 Setting log message to trace 2020-09-08 12:02:04 +01:00
Dave 406086aec7 Removing log message 2020-09-08 12:01:43 +01:00
Dave 80a86e3bec Noted failing filter check 2020-09-05 14:14:29 +01:00
Dave eb1737264e Minor cleanup on domain parsing 2020-09-05 14:14:03 +01:00
Dave 4b16d14121 Knocking down log level on high water mark 2020-09-05 14:13:35 +01:00
Dave 4c055a8e35 Beefed up error handling 2020-09-05 13:00:18 +01:00
Dave 9ce8c42455 Documenting use of publicsuffix list 2020-09-05 12:35:34 +01:00
Dave d3cb0d25c8 Only fetching the publicsuffix domains list once 2020-09-05 11:59:58 +01:00
Dave 4d4ee26a9b Saving domain roots in unknown file 2020-09-04 20:27:19 +01:00
Dave b7a8aefbde Loading host lists from disk 2020-09-04 15:08:10 +01:00
Dave ac3829c65f Fixed up paths for easier testing 2020-09-04 14:02:46 +01:00
Dave 11000a99c1 Tests ensuring that unknown requests are written only once 2020-09-04 13:04:20 +01:00
Dave 5340716cce Unknown hosts are written to file 2020-09-04 10:53:02 +01:00
Dave 334e8f2096 ibid 2020-09-04 10:48:17 +01:00
Dave 244a8bf957 ibid 2020-09-04 10:48:11 +01:00
Dave c4e9577f78 Adding dirs crate so we can save to disk 2020-09-04 10:47:57 +01:00
Dave 80b16069e8 Adding rand crate so we can generate test output files 2020-09-04 10:47:43 +01:00
Dave 4cb9720758 Ownership improvements 2020-09-03 15:10:31 +01:00
Dave 6d1a499cbe Ensured that unknowns are only added once 2020-09-03 15:10:21 +01:00
Dave 918e134c37 Renamed Persistence to HostsStore 2020-09-03 15:04:06 +01:00
Dave dc5576e1d7 Checking outbound requests starting to happen 2020-09-03 15:02:17 +01:00
Dave 822f6350cb WIP commit 2020-09-03 11:47:28 +01:00
Dave d1b7ed8603 Moving main upwards 2020-09-02 15:25:00 +01:00
Jędrzej Stuczyński 0e7f29c48d Feature/socks5 sequencing (#318)
* Adding ordered buffer, moving socks5 request location into common

* Moved utils to available-reader

* Starting to use OrderedMessage in socks5 requests

* Renamed available reader module

* Initially included sequence numbers

* OrderedBuffer fix

* Buffer bug fix + extra test

* Bug fixes

* Removed test from an old experiment

Co-authored-by: Dave <futurechimp@users.noreply.github.com>
2020-09-01 16:53:48 +01:00
Dave Hrycyszyn be6486665b Feature/temp fix for ipv6 (#317)
* A temporary fix for IPv6 connections, which crash the SP

* Showing fewer timeouts in terminal while running
2020-08-28 10:03:48 +01:00
Jędrzej Stuczyński 993d3d10a1 Feature/socks client config (#316)
* Made base client_core config

* Updated socks5 config with mandatory provider field
2020-08-27 16:28:53 +01:00
Jędrzej Stuczyński 9efc195046 Explicit proxy runner + closing local connection if remote is over (#314)
* Updated built dependency

So that it wouldn't fail on nwindows

* Concurrent RW client-side

* Draft of a ProxyRunner

* Super experimental proxy runner for provider

Very much WIP

* Extracting shared code + cleanup

* Logging cleanup

* Removed redundant close request
2020-08-27 13:59:37 +01:00
Jędrzej Stuczyński 7f0ccea39c Removed unused dependencies (#315) 2020-08-27 12:10:12 +01:00
Jędrzej Stuczyński a0484ce082 Feature/ack messing (#313)
* Added Display for FragmentIdentifier

* AckDelayQueue as wrapper for DelayQueue

* First pass on ack controller

* Controller very initially incorporated into the client

* Cleanup

* Using socks5 build.rs

* Extra (temporary) log statements

* Decreased logging levels
2020-08-25 10:45:31 +01:00
Dave Hrycyszyn 7b2036bd33 Feature/perf messing (#311)
* Merge branch 'develop' into feature/socks5-no-core

common/client-libs/directory-client/models/src/presence/topology.rs

* More diagnostics

* WIP commit, not properly multithreaded

* WIP, now sort of multithreaded but errors all over the place

* Replaced expect with a return

* Adding abort on panic

* Removing a few noisy prints

* Another ack-related expect replaced

* Moved profile.dev annotation to workspace cargo.toml

* Semi-stabilised socks

* Assigning connection shared key post registration (#309)

* Sending return address with connect request

* WIP commit

* Reading all available data on reader + removed duplicate code

Co-authored-by: jstuczyn <jedrzej.stuczynski@gmail.com>
2020-08-20 13:43:26 +01:00
Dave Hrycyszyn da25b23898 Upgrades tungstenite libraries to new versions with 64MB message sizes. (#310) 2020-08-20 10:43:38 +01:00
Jędrzej Stuczyński de6c1e6601 Assigning connection shared key post registration (#308) 2020-08-19 11:35:01 +01:00
Jędrzej Stuczyński 7d2d512405 Feature/client binary api update (#306)
* Split text and binary client apis

* Very initial attempt at new serialization

* Defined ser+de for Recipient and ReplySURB

* Response errors

* builds with changes

* Working WS API + moved to separate crate

* updated python examples

* Fixed parsing bug

* Updated go examples

* Updated rust examples

* formatting

* Removed unused imports

* Removed accidentally left panic call
2020-08-17 10:44:40 +01:00
Dave Hrycyszyn eec6034684 Revert "Starting to unify the slightly different interfaces of NymClient"
This reverts commit 4d444ceb07.
2020-08-15 12:06:44 +01:00
Dave Hrycyszyn 4d444ceb07 Starting to unify the slightly different interfaces of NymClient 2020-08-13 19:10:34 +01:00
Dave Hrycyszyn 297e212063 Minor docs on socks5 authentication 2020-08-13 12:14:41 +01:00
Dave Hrycyszyn ba81dde4a9 Tightening up accessor visibility on Authenticator. 2020-08-13 12:12:13 +01:00
Dave Hrycyszyn b27c5906d7 Removes unused Cargo dependencies so we stay slim and trim. (#305) 2020-08-13 11:59:14 +01:00
Dave Hrycyszyn 7a038accfc Removes unused code from the socks client implementation (#304) 2020-08-13 11:28:48 +01:00
Dave Hrycyszyn bdfe91676c Feature/client core (#303)
* Adding a client-core crate.

* Moved config into client_core

* Socks5 client now depends on client-core/config

* Native client now mostly using client-core internals

* Socks client now uses client-core internals.
2020-08-13 11:21:59 +01:00
Dave Hrycyszyn 1546088904 Feature/socks5 (#302)
* Adding the beginnings of a socks5 crate

* Removing unused import

* Adding built.rs

* Figured out test failure, stuck a note in detailing under what conditions it fails.

* Added lib

* wip on the way to compile

* First compile with much of the client in place

* Comment reflow to 80 lines

* Changed Socks5 client help message

* Latest changes to from develop applied to socks5 client

* Minor cleanup on unused code

* Adding snafu dependency

* Adding socks library

* Getting socks into the module structure

* Tokio conversion for socks code nearly completed.

* Starting traffic controllers again

* Bitcoin SP starting to breathe with Socks5 proxy. Responses not yet being sent.

* Adding in some hugely verbose print action so we can see things happening

* WIP refactor of socks code.

* Renamed structs to be more rubyish

* Refactored the run command a bit.

* handle_client doesn't need to be public

* Starting to split the handle method up into smaller, refactorable chunks

* Renamed a test

* Finished initial refactor

* Minor cleanup

* Made a few notes for my future self

* Being a bit more explicit in authtentication test

* Ensuring that user/password authentication attempts fail if that auth mode is off

* Documentation

* Refactord types into a types module

* Sending the request ID across and reading the response when it comes back.

* Added the request_id to the response header

* Adding exception handling to websocket send

* Semi-working...

* Removing non-functional examples.

* Minor output clarification

* Adding a Socks5 service provider

* Websocket connection is now being made.

* Added some simple and ungraceful websocket connection error handling

* Renamed socks5_proxy back to proxy

* ibid

* Nicer websocket start method

* Receiving messages via websocket

* Socks requests work in the simple case, SSL requests don't (yet).

* Minor cleanup, renaming variables and moving private functions around

* Comments on try_read_request

* Moved some code around

* Removed commented code and printlns

* Comments sp request

* Commented response data read

* Changing Request to Connection

* ibid

* Added a controller and split connection / request parsing

* Built out error handling on requests a bit

* Initial router action

* Request deserialization tests back in action

* Request constructors

* Constructor for controller

* Renamed message_router to controller

* Starting to build out the responses

* Returning proxied connection data

* Moving towards new Socks5 request crate

* Sending Socks5 multi-part requests through mixnet

* Removed the detritus of exploratory coding.

* Breaking the socks client read loop when empty bytes are read

* Documenting the message format for serialized socks requests

* Returning a response from the socks proxy

* Removing unused import

* Removing more detritus

* Restarting loop if no response is received

* The off-by-one change that fixed it all

* Removing unused response.rs module

* Removed unused import

* Comment cleanup

* More detritus

* Cleaning...

* Docs for socks5-requests

* Using the simple-socks5-requests crate Response in the socks5 client

* Removing unused error types

* Split request/response into their own files and wrote more tests

* Removing temporary README notes

* Renamed all instances of request_id to connection_id

* Docs on Connection struct

* Caving in to connecting inside the constructor for the moment

* Fixing up comments on socks5 service provider start

* Simplified errors in the Socks5 requests crate

* Flattened service provider module hierarchy a bit.

* Removed println

* Comment to explain return on timeout

* Logging controller connect errors

* Renamed websocket reads and writes to make them a bit more understandable

* Renamed TodoError to ConnectionError

* Logging errors instead of panicking on connection read/write failures

* Fixed error handling in controller

* Removing dead comments

* Cargo fmt applied

* Removing print statements

* Removed more comments, prints, etc

Co-authored-by: jstuczyn <jedrzej.stuczynski@gmail.com>
2020-08-12 16:23:23 +01:00
Jędrzej Stuczyński d9d549fd0f Feature/reply surbs (#299)
* Changed identity keypair to use ed25519

* Encryption key is now x25519 based + compatibiltiy with sphinx

* Pathing and import fixes

* Moved all asymmetric keys to sub-module in crypto

* Extracted aes to separate module

* kdf module in crypto

* Ability to perform diffie hellman on encryption keys

* ecdsa on identity keys

* Extremely rough and incomplete registration handshake

* Authentication primitives

* Creating new random authenticationIV

* Wrapper type for the derived shared key

* Removed AuthToken in favour of using SharedKey for authentication

* Gateway identity keys

* Registration handshake without error mapping

* Gateway address in client config

* Added extra key for gateway presence

* Updated pemstore to work on borrows instead

* Gateway client trying to perform the handshake

* Gateway changes to allow for handshake and shared key

* Debug trait on sharedkey

* native client using updated gateway client

* Slightly updated gateway API

* Minor cleanup

* Fixed pemstore to correctly save multiple keypairs

* Gateway actually deriving shared key during handshake

* Gateway sending correct mid-handshake message

* Missing quotation mark in client config template

* Fixed template for correct shared key serialization

* Fixed gateway authentication

* Fixed tests

* Using correct gateway key when converting to sphinx node

* "get_all_clients" takes them from gateways as opposed to providers now

* cargo fmt

* Renamed pemstore methods

* Unused import

* Encryption of forward requests between client and gateway

* Updated sphinx dependency to use public revision

* Sending 'error' on handshake processing error

* Removed some dead code

* Dead code I forgot to remove before

* Extracted AckAes128Key into a struct

* Slight pemstore revamp allowing for symmetric key store

* ibid.

* PemStorableKey for SharedKey

* Introduced single location responsible for key management for client

* WIP

* Sphinx version update

* Stop using NodeAddressBytes for two distinct and confusing purposes

* Abstracting away SocketAddr from sphinx forwarding

* Passing the bool for reply surbs

* Attack plan for replies + encryption

* Comment + removed variable binding

* ReplySURB usage

* Topology import in nymsphinx

* Sphinx version update

* Changed 'Recipient' to contain client's encryption key

* Message preparation taking shape!

* reply surb also containing the encryption key

* Very initial message receiver

* Sphinx version update

* A possibly working way of receiving surbs

* Fixed incorrect field name in client config template

* camel casing all request arguments

* Renamed and moved `MessageMode` to more appropriate file

* Restored reconstruction tests

* Removed dead code from chunking

* Made rust examples compilable

* reply SURB key storage

* Replies as an InputMessage

* Forgotten commented code

* No retransmission processing for cover or replies

* Received reply processing

* Renamed client pathfinder to something more appropriate

* Made HasherOutputSize public

* Added key store path to config

* Reply surb attaching key digest when used

* Changes due to previous renaming

* Removed comment

* Fixed insert_encryption_key

* Assigning initial value of key store path

* Computing key digest with correct algorithm

* Initial and presumably temporary request serialization

* hacky way of introducing 'FragmentIdentifier' for replies

* Moved responsibility of reply encryption, padding, etc, to message preparer

* Optional recipient in try_get_valid_topology_ref

* Handling new reply surbs with acks and padding

* Updated go and python examples to include replies in text and binary cases

* Updated rust examples + binaryserverresponse

* Helpers in rust examples

* And updated JS example

* Moved shared key generation function to crypto crate

* Cover traffic encryption!

* hmac computation in crypto

* Updated aes imports due to new dependencies

* hkdf made more generic

* crypto cleanup + algorithms in params

* Clippy cleanup pass

* Generating encryption+mac shared keys between client and gateway

* MACs attached to forward requests to gateway

* Gateway messages encrypted and mac'd

* Lowered logging level

* compiler warning cleanup

* Some minor cleanup

* Generic stream cipher

* Generic shared key derivation + algorithm definitions

* Project-wide AES clean-up

* Comment fix

* Removed commented imports

* Updated comments

* Fixed topology test fixture
2020-08-07 18:16:54 +01:00
Jędrzej Stuczyński 2a29bbd5a2 Bugfix/remove packet buffering (#300)
* Removed pending packets buffer

* Corrected reconnection backoff
2020-08-07 17:17:15 +01:00
Jędrzej Stuczyński eb266f59f1 Removed client list from topology (#301)
* Removed client list from topology

* Formatting
2020-08-07 17:16:10 +01:00
Dave Hrycyszyn 50805a9b0e Removing .DS_Store files 2020-07-15 16:14:43 +01:00
Kevin Foesenek 2d6812afa8 Added react example (#275)
Added react example in addition to the basic js example.
2020-07-15 16:11:52 +01:00
Jędrzej Stuczyński 6cc2bc6f91 Feature/ws send confirmation removal (#280)
* Removed send confirmation

* Updated websocket examples
2020-07-13 12:07:06 +01:00
Jędrzej Stuczyński 5ef96aa241 Updated blake3 dependency to 0.3.5 (#281) 2020-07-13 12:04:25 +01:00
Jędrzej Stuczyński a53d0a4aac Feature/topology refactor (#274)
* VersionFilterable for HashMap

* Removed NymTopology trait in favour of concrete type

* Removed providers from NymTopology

* Made gateway conversion use reference, similarly to mixes

* Using more concrete types in topology rather than b58 strings

* Allowing gateways to have DNS-resolvable mix listener address

* Error propagation for gateway key conversion
2020-07-07 10:56:50 +01:00
Jędrzej Stuczyński e849e45b12 Feature/gateway shared key generation (#272)
* Changed identity keypair to use ed25519

* Encryption key is now x25519 based + compatibiltiy with sphinx

* Pathing and import fixes

* Moved all asymmetric keys to sub-module in crypto

* Extracted aes to separate module

* kdf module in crypto

* Ability to perform diffie hellman on encryption keys

* ecdsa on identity keys

* Extremely rough and incomplete registration handshake

* Authentication primitives

* Creating new random authenticationIV

* Wrapper type for the derived shared key

* Removed AuthToken in favour of using SharedKey for authentication

* Gateway identity keys

* Registration handshake without error mapping

* Gateway address in client config

* Added extra key for gateway presence

* Updated pemstore to work on borrows instead

* Gateway client trying to perform the handshake

* Gateway changes to allow for handshake and shared key

* Debug trait on sharedkey

* native client using updated gateway client

* Slightly updated gateway API

* Minor cleanup

* Fixed pemstore to correctly save multiple keypairs

* Gateway actually deriving shared key during handshake

* Gateway sending correct mid-handshake message

* Missing quotation mark in client config template

* Fixed template for correct shared key serialization

* Fixed gateway authentication

* Fixed tests

* Using correct gateway key when converting to sphinx node

* "get_all_clients" takes them from gateways as opposed to providers now

* cargo fmt

* Renamed pemstore methods

* Unused import

* Encryption of forward requests between client and gateway

* Updated sphinx dependency to use public revision

* Sending 'error' on handshake processing error

* Removed some dead code
2020-06-30 12:01:45 +01:00
Dave Hrycyszyn cf2c200116 Removed the healthcheck module, it's no longer in use. (#271) 2020-06-19 16:02:12 +01:00
Dave Hrycyszyn 26ee30e252 Adding description field to wasm client to kill warning (#270) 2020-06-19 16:01:59 +01:00
Dave Hrycyszyn e0cf35a9c3 Running npm audit on js examples (#269) 2020-06-19 16:01:48 +01:00
dependabot[bot] a47ce33dcf build(deps): bump websocket-extensions (#261)
Bumps [websocket-extensions](https://github.com/faye/websocket-extensions-node) from 0.1.3 to 0.1.4.
- [Release notes](https://github.com/faye/websocket-extensions-node/releases)
- [Changelog](https://github.com/faye/websocket-extensions-node/blob/master/CHANGELOG.md)
- [Commits](https://github.com/faye/websocket-extensions-node/compare/0.1.3...0.1.4)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-06-18 10:59:53 +01:00
Jędrzej Stuczyński 3c7a01e1e6 Feature/constant length packet payloads (#268)
* Reducing ACK packet size to exactly what we need

* Made fragmentidentifier into an array

* Padding all sent messages so they'd be split into constant length packets
2020-06-18 10:50:31 +01:00
jstuczyn 68f7b1a042 Added local scripts to .gitignore 2020-06-16 13:03:35 +01:00
Jędrzej Stuczyński fcfe463efa Feature/wasm topology duplication (#265)
* Removed constructor from NymTopology trait + split directory_client

* Removed bunch of duplicate wasm topology code

* Post-merge changes
2020-06-16 12:12:19 +01:00
Jędrzej Stuczyński b57a548350 Feature/packet retransmission (#263)
* Ability to send sphinx packets of different sizes + more efficient decoding

* Closing connection on connection corruption

* Missing semicolons

* Missing license notices

* Default for packetsize

* Split nymsphinx

* Replaced Mutex with RwLock for TopologyAccessor + impl Deref

* Sphinx update + import cleanup

* Moved packet_sizes file

* Updated NymTopology API

* sphinx version bump

* Missing license notice

* nymsphinx-params crate

* Changes due to ibid.

* Chunking rework to allow variable size fragments

* Initial ack crate

* Version bump to new dev build

* Cargo lock changes

* random_route_to_gateway by node address

* exposing getting read permit

* Very initial draft on ack control

* Correctly dereferencing out of topology read permit

* All pending changes + compilation todo!s

* Restricted scope of deref on TopologyAccessorInner

* Type path alias for generate_key

* Derived traits for MessageChunker

* Ack control starting to take shape!

* Awaiting callbacks

* Most of work done on acks. Now to wire it all together

* Import cleanup

* rng generalization

* Connected real traffic together; only acks from gateway left

* Removed redundant things from nymsphinx::utils

* nymsphinx-cover crate

* Ack-related fields in client config

* Decreased packet store log level

* Restored forward sphinx request

* Slight adjustements to surb acks

* Changed TopologyReadPermit from type alias into a struct

* Changes due to ibid.

* Sphinx version upgrade

* Gateway being able to understand and handle acks

* Special Cover FragmentIdentifier + removal of dead code

* Initial packet router for gateway client

* Kill client if it fails to send to gateway too many times

* Cover messages with acks

* Moved out gateway client errors

* Ignoring cover traffic acks

* Changes in ack control

* Another sphinx version upgrade

* websocket handler delegating message chunking

* Using config defined ack wait additions

* Other minor changes I should have been more dilligent with splitting

* Import path fix

* sphinx_receiver => mixnet_receiver

* Missing renamed variable instance

* Updated aes-ctr to 0.4.0

* Removed concept of 'unfragmented' single fragment

* Replay fragments detection

* Long method split

* typo

* Cleaner client init

* Fixed race condition

* Fixed similar issue for retransmission

* Cargo fmt

* Minor clenaup
2020-06-16 11:22:02 +01:00
hyperfekt db5540677c add disabling feature 'offline-test' for network-dependent tests (#260) 2020-06-15 15:53:52 +01:00
Stefan Steinert 169c995e95 Removed misplaced WorkingDirectory parameter (#264) 2020-06-15 15:53:00 +01:00
Stefan Steinert 9d88c8241e could not count to ten properly (#262) 2020-06-09 10:25:09 +01:00
Dave Hrycyszyn 6aec202938 Merge pull request #259 from nymtech/hotfix/wasm_topology_version_filter
Filtering compatible node versions
2020-06-08 10:27:35 +01:00
jstuczyn 4e4187ad57 Filtering compatible node versions 2020-06-05 18:06:38 +01:00
Stefan Steinert c1e921db6a systemd service unit example (#257)
* systemd service unit example

* typo

* inconsistent use of sudo
2020-06-05 10:22:40 +01:00
jstuczyn 88eb1fce25 Using testnet directory in jsexample 2020-06-03 09:09:00 +01:00
Dave Hrycyszyn 65eb043c0b Update CHANGELOG.md 2020-06-02 14:20:23 +01:00
jstuczyn 5e78515216 Version bump 2020-06-02 12:21:42 +01:00
Dave Hrycyszyn 4c6181c09d Merge branch 'feature/rename-desktop-client' into develop 2020-06-02 12:06:10 +01:00
Dave Hrycyszyn 8cdc55b266 Changelog for 0.7.0 2020-06-02 12:05:28 +01:00
Dave Hrycyszyn 0c340a2cda renaming desktop to native client (#251) 2020-06-01 16:50:03 +01:00
Dave Hrycyszyn 496f7244ce renaming desktop to native client 2020-06-01 16:20:50 +01:00
Dave Hrycyszyn 2924551bff Cleaning up startup messages in native client (#249)
* Cleaning up startup messages in native client

* Fixed cargo fmt
2020-06-01 16:08:27 +01:00
Dave Hrycyszyn beacd21b46 Adding a pipenv dependencies file to the python client example (#250) 2020-06-01 16:08:01 +01:00
Dave Hrycyszyn 9d3500c0c5 fixing up readme, bumping version number (#246)
* fixing up readme, bumping version number

* Using the newest js
2020-06-01 11:54:03 +01:00
Jędrzej Stuczyński 860a69b246 Feature/sphinx socket packet encoder (#245)
* Ability to send sphinx packets of different sizes + more efficient decoding

* Closing connection on connection corruption

* Missing semicolons

* Missing license notices

* Default for packetsize
2020-05-27 10:08:08 +01:00
Dave Hrycyszyn aeb1a4b22e Merge branch 'feature/document-js-client' into develop 2020-05-26 18:34:22 +01:00
Dave Hrycyszyn dce22ba37c Last docs fixes 2020-05-26 18:32:48 +01:00
Dave Hrycyszyn 5ef2a22cc7 Adding some documentation to the webassembly client (#244)
* Adding some documentation to the webassembly client

* Noting that binary is unsupported for now
2020-05-21 16:57:38 +01:00
Dave Hrycyszyn 53cef63bdb Noting that binary is unsupported for now 2020-05-21 11:44:45 +01:00
Dave Hrycyszyn bfeb787e6f Adding some documentation to the webassembly client 2020-05-21 11:37:42 +01:00
Dave Hrycyszyn 1f749df59d Simplified some names and used the published npm package (#242) 2020-05-20 15:52:36 +01:00
Jędrzej Stuczyński c063cf83a6 Removed redundant console.log (#240) 2020-05-20 12:22:15 +01:00
Dave Hrycyszyn e83c4d3bea Feature/make andrew happy (#241)
* Fixing the path to nym client in node modules

* Updated package lock for latest npm
2020-05-19 13:17:16 +01:00
Jędrzej Stuczyński 54114f03b5 Feature/explicit gateway addressing (#239)
* validator: fixing a warning, untestify this when you need it for real code

* webassembly: minor readme changes.

* README changes in wasm

* Updated wasm version

* clients/webassembly: security vuln updates

* typo fix

* WIP commit

* Significantly simplified the API

* Changed switch to have default branch

* Managed to get rid of `this` bind

* Moved 'Recipient' definition

* Examples update

* Slightly more generalised 'try_from_string' for recipient

* Updated to use client@gateway addressing

* Updated tests

Co-authored-by: Dave Hrycyszyn <futurechimp@users.noreply.github.com>
2020-05-19 12:16:04 +01:00
Dave Hrycyszyn 8745fb4230 Feature/clean up (#238)
* validator: fixing a warning, untestify this when you need it for real code

* webassembly: minor readme changes.

* README changes in wasm

* Updated wasm version

* clients/webassembly: security vuln updates

* typo fix

* WIP commit

* Significantly simplified the API

* Changed switch to have default branch

* Managed to get rid of `this` bind

* Filled in a missing word

Co-authored-by: jstuczyn <jedrzej.stuczynski@gmail.com>
2020-05-19 10:32:52 +01:00
Jędrzej Stuczyński a38a9f604d Feature/addressing update (#237)
* Typo I've never noticed before

* Sphinx version update

* Updated 'address' to be 'recipient' (i.e. address + gateway)

* Updated websocket examples to use the updated structure
2020-05-18 13:01:51 +01:00
Jędrzej Stuczyński 7f99c2828b Added hidden init flag to increase default traffic volume (#234) 2020-05-15 10:09:27 +01:00
Jędrzej Stuczyński 2630629cdb Fixed unwrap on none value (#230) 2020-05-14 11:52:21 +01:00
Jędrzej Stuczyński 106267eb1a Bugfix/gateway crash on incomplete ws handshake (#229)
* Properly checking for errors during websocket handshake

* Unrelated typo

* Fixed similar bug in rust client
2020-05-14 11:51:04 +01:00
Jędrzej Stuczyński c8168adeb2 Bugfix/issue#231 (#233)
* Increasing reconnection attempt after actually computing delay

* Constructor mix-up....

* Replaced poll! macro with poll call (after macro expansion that's syntactically identical)
2020-05-14 11:49:36 +01:00
Jędrzej Stuczyński 3773800133 Feature/start local network improvements (#228)
* Moved directory_server from Debug section of configs

* Using correct variable path

* Updated start_local_network script

* Actually killing gateways on startup

* Removed redundant stop_local_network.sh

* The Canadian appeasement accord
2020-05-13 12:01:51 +01:00
Jędrzej Stuczyński ff2e24afbc Updated directory_client reqwest to 0.10 (#226)
* Updated directory_client reqwest to 0.10

* Using consistent syntax
2020-05-12 12:52:31 +01:00
Jędrzej Stuczyński f47b7cfb13 Updated js-example to get gateway from topology (#225) 2020-05-11 14:52:23 +01:00
Dave Hrycyszyn e2b9a9468a Feature/minor docs fixes (#223)
* webassembly: fixing example directory name in README

* rust client: fixing what I suspect is a typo in a type name

* Fixing wasm build instructions
2020-05-07 17:30:29 +01:00
Jędrzej Stuczyński 981f4de397 Requiring explicit timestamp when converting from rest to service mixnodes (#224) 2020-05-07 17:08:39 +01:00
Jędrzej Stuczyński a3192a190f Removed having to care about SURB_ID (#222) 2020-05-07 16:55:05 +01:00
Dave Hrycyszyn 37f5bfdf02 Simplified and corrected wasm-pack build instructions 2020-05-07 16:30:17 +01:00
Dave Hrycyszyn ccc516903c client: docs typos fix 2020-05-07 15:57:00 +01:00
Jędrzej Stuczyński 97a944a33e Updated wasm code to work with new gateway and updated the example (#219)
* Updated wasm code to work with new gateway and updated the example

* cargo fmt

* Fixed test by ensuring destination is present at a gateway

* Updated hardcoded default port

* ibid. to correct value
2020-05-06 16:20:43 +01:00
Jędrzej Stuczyński f9d3ee7fc4 Moved relevant parts of old mix-client to nymsphinx (#221) 2020-05-06 16:18:27 +01:00
Jędrzej Stuczyński c3e18cedd5 Feature/load keys on run (#220)
* Mixnode keys loaded in run command

* Client keys loaded in run command

* Removed unused imports
2020-05-06 16:17:02 +01:00
Dave Hrycyszyn fe17bdaf49 validator: removing health checker (#217) 2020-05-05 18:15:49 +01:00
Jędrzej Stuczyński 8249475fba Feature/healthchecker removal (#214)
* Some clippy and compiler warning fixes

* Removed healthchecker from the client

* Cargo fmt issue after 100 explicit saves.........

* Changes accidentally removed in previous PR
2020-05-05 14:19:39 +01:00
Jędrzej Stuczyński 65b9808662 The great sfw-provider purge of 2020 (#216)
* The great sfw-provider purge

* Cargo fmt...
2020-05-05 14:19:11 +01:00
Jędrzej Stuczyński fa1bcabe5a Fixed compilation warnings on unreachable code when compiling with features flag (#215) 2020-05-05 13:16:56 +01:00
Dave Hrycyszyn 20b25b1074 Update README.md 2020-05-05 13:00:57 +01:00
Jędrzej Stuczyński e6ec803818 Bugfix/send to correct gateway (#213)
* Initial multiple gateway support

* Hello random cargo fmt
2020-05-05 12:50:34 +01:00
Jędrzej Stuczyński 57c43a1f6b Feature/client socket adjustments (#212)
* Changed default listening port to something slightly more meaningful

* Removed TCP socket and made websocket the default option (as opposed to 'None')

* Updated template

* Updated ReceivedBuffer to allow direct message forwarding

* ignoring vscode directory

* Push messages mechanism for websocket client-clients

* Removed flawed chunking example

* ... but added bunch of websocket examples in return!

* Moves js example directory

* Cargo fmt

* Removed old listener code
2020-05-04 17:07:27 +01:00
Jędrzej Stuczyński e7b8ab8c10 Sending sphinx packet independent of the receiver task (#210) 2020-04-30 13:14:03 +01:00
Jędrzej Stuczyński abbf7041a4 Feature/gateway provider merge (#208)
* Initial draft for ClientsHandler

* Created listener struct

* typo

* Stateful websocket connection handler

* Exposing modules

* Depdendencies updates

* Moved listener to correct file + made start consume listener

* Main starting new listener

* Catching sigint

* Copied client storage from provider into gateway

* Exposed websocket listener type for nicer import path

* Defined websocket message receiver concrete type

* Client ledger struct without implementation

* ClientsHandler using more concrete types

* Mixnet sender + receiver and exposed listener type

* Handling mix packets

* Ability to forward mix packets

* "starting" both listeners at main

* Depedencies updates

* Initial type definitions for client messages

* Initial "gateway-requests" with AuthToken

* ibid.

* Restored most of ledger's functionalities

* Ability to retrieve all messages regardless of rate limit

* ClientsHandler request handling logic

* Required 'new' dependencies

* Main changes required for compilation

* PacketProcessor getting private key pointer

* "moved" types into gateway requests crate

* Moved and renamed types

* ibid.

* Added required serde_json dependency

* Skeleton for websocket request handling

* helper methods on ServerResponse

* WebSocket Handler pushing received mix messages directly to client

* PacketForwarder returning JoinHandle alongside the channel

* ClientsHandler following the same pattern

* Made websocket listener start method consistent with mix listener

* Syntax error + formatting

* Websocket handler having access to mix forwarder

* Minimal binary request parsing

* Implicitly derived std::error::Error on GatewayRequestsError

* Handling of all websocket requests

* Types import cleanup

* Updated placeholder fields

* Everything put into main

* Missing license notices

* Cleaned up unused code

* Copied and did initial minor changes to commands and config

* It's actually gateway

* Gateway sending its regular presence to directory server

* Re-organisation of gateway code + Gateway struct

* Updated provider argument description

* Restored duplicate ip check without importing NymTopology trait

* Moved hardcoded values into config

* Cargo fmt

* Compilation errors in other crates due to topology adjustments

* Test fixes

* Initial gateway-client

* Seemingly working version with bunch of hardcoded and temporary values

* cargo fmt

* Removed provider poller

* Updated config with gateway values instead of provider

* Gateway address including ws

* Removed hardcoded gateway address

* Properly skipping loop cover messages

* Updated log filter with tokio tungstenite related modules

* Updated sphinx version used

* Very minor cleanup

* unused import
2020-04-30 10:14:21 +01:00
Dave Hrycyszyn 903ef44328 Feature/route from topology (#201)
* directory-client: removing explicit type definitions

* clients/webassembly: ugly commit, removes dependency on HTTP crates

...at the cost of copying quite a bit of NymTopology-related stuff into
the WebAssembly client. I'll make an issue to refactor that later.

* A more helpful hint in the error message when websocket connection fails.

* Removing superfluous JavaScript, route checking now happens in Rust
2020-04-23 12:01:25 +01:00
Dave Hrycyszyn 44c48ef8ee FIXING DUE TO SOMEONE'S CHOICE OF EDITOR / OPERATING SYSTEM 2020-04-23 11:41:44 +01:00
Jędrzej Stuczyński a77881d284 Intermediate gateway-heart surgery checkpoint (#199)
* Initial draft for ClientsHandler

* Created listener struct

* typo

* Stateful websocket connection handler

* Exposing modules

* Depdendencies updates

* Moved listener to correct file + made start consume listener

* Main starting new listener

* Catching sigint

* Copied client storage from provider into gateway

* Exposed websocket listener type for nicer import path

* Defined websocket message receiver concrete type

* Client ledger struct without implementation

* ClientsHandler using more concrete types

* Mixnet sender + receiver and exposed listener type

* Handling mix packets

* Ability to forward mix packets

* "starting" both listeners at main

* Depedencies updates

* Initial type definitions for client messages
2020-04-23 10:36:13 +01:00
Dave Hrycyszyn 8baa236d81 Feature/wasm js demo (#191)
* Moved `nym-sphinx-wasm` into `wasm` folder and renamed its examples

* A proposal for some structural cleanup

* desktop client: beginning of a Rust example for chunking.

* Simplifying desktop client readme

* Tarting up webassembly README

* A more visual webassembly client example

* clients/webassembly: grouping a few things into named functions for clarity

* clients/webassembly: put URLs at top of file, prepping for drop-down action

* mixnode + provider run: changed startup error messages a bit

* clients/webassembly: scrolling from the bottom in the demo
2020-04-21 10:05:38 +01:00
Jędrzej Stuczyński 4af5788bba Feature/limit direct sphinx dependency + remove direct curve25519 dependency from wasm client (#189)
* Initial set of re-exported sphinx types and constants

* Removed direct sphinx dependency from healthchecker

* Crypto module

* nym-client no longer needing sphinx

* All common modules

* mix-client until removed

* Sfw-provider no longer depending on sphinx crate

* Mixnode no longe depending directly on sphinx crate

* Ibid. for sfw-provider-requests

* Corrected import inside nymsphinx itself

* wasm client no longer needing direct sphinx dependency

* Required gateway change due to re-exporting constants in one place

* Missing import path changes in tests

* Removed direct dependency on curve25519 from wasm client

* Lock file changes
2020-04-20 16:59:51 +01:00
Dave Hrycyszyn c5dd6bf93d Feature/improve js example (#190)
* nym-client: refactoring js example code a bit.

* nym-client: ignoring node modules in demo

* nym-client: adding webpack and a dev server

* nym-client: banging example into webpack format

* nym-client: webpack starting to work in the demo

* nym-client: more webpacking

* nym-client: ignoring bundle.js in dist

* Example code starting to breathe with webpack, not quite there yet

* nym-client: high point of attempted webpack business. Will revert to minimal, it's getting crazy.

* nym-client: removed lots of npm deps

* nym-client: added webpack html plugin to demo

* nym-client: removed app.scss from demo

* nym-client: removed lots of webpack config

* nym-client: ugly but working simple javascript demo

* nym-client: more demo simplification

* Simplifying a bit more

* nym-client: added some comments to js demo

* parameter rename
2020-04-20 15:48:26 +01:00
Jędrzej Stuczyński fda308694e Feature/very minor refactoring (#188)
* log statement for forwarding traffic

* Mixnode logging intent to forward packet

* Presence logging level decrease + making things less public

* Default adjustments + human readable equivalents in comments

* Do not immediately refresh topology on start
2020-04-17 18:59:22 +01:00
Jędrzej Stuczyński 8f4dff0074 Feature/persistent ledger (#187)
* Changed auth token storage to use sled instead of in memory hashmap

* Filtering sled related log messages

* Catching db error on trying to load sled

* Renamed default ledger name

* The actual dependency

* Changes due to ledger no longer being async

* Extra log statement

* Missing change to current_clients method

* Another uncommited change

* Cargo lock changes
2020-04-17 18:58:53 +01:00
Dave Hrycyszyn b8edb5c436 Optimising wasm build size, shaves about 10% size off our wasm output. (#186) 2020-04-17 18:21:22 +01:00
Dave Hrycyszyn 0bf74a0b36 Ran npm audit fix on the wasm demo directory. (#185) 2020-04-17 12:02:30 +01:00
Dave Hrycyszyn 1200a2f02d Feature/service persistence (#171)
* validator: adding Diesel ORM

* validator: making sure Iron::status is always avaialable

* ibid

* validator: presence-announcement REST API

* validator: adding Diesel setup

* Removing Diesel stuff from root of monorepo

* validator: adding Diesel migrations and setup

* validator: documenting how PresenceAnnouncement is different from presence.

* validator: added Chrono crate for datetime conversions into sql

* validator: restructured the presence module

* validator: removed presence announcements from persistence

* validator: commenting topology

* Adding staking to the mixmining service

* Start of mixmining + stake service

* validator: added a bit about mixmining to README

* validator: added Iron's params crate

* validator: reorganized mixmining service and db code

* validator: no need for this .env warning

* validator: removing params parser, it's now unused

* validator: adding json body parser library for Iron

* validator: adding spelling exceptions

* validator: adding bodyparser deps

* validator: ability to (de)serialize Mixnode struct

* validator: further announcement HTTP progress

* validator: simplified announcement route

* validator: injecting database and service into handler

* validator: renaming service and db variables

* validator: using camelCase json

* validator: using base Iron handler rather than middleware handler

* validator: better error message on unexpected json parsing

* validator: adding 'location' to  presence::Announcement

* comments on mixmining::Db

* validator: commenting out unused mixmining::Service methods for the moment

* validator: noting that we don't yet know how to measure capacity

* validator: comments

* validator: starting to add correct serializers in rest API

* validator: renaming a mixnode announcements

* validator: extracted route creation

* validator: going lower-case for node in "Mixnode"

* validator: removing the "announcement" model

* validator: renamed annoucements handlers

* validator: temporarily removed Chrono, remove it fully if it's not needed.

* validator: added all the needed Mixnode fields to the service model

* validator: moved models into their own file.

* validator: conversions to/from api vs service models

* validator: doing type conversions from rest to service models

* validator: unused import cleanup

* validator: rewrote mixmining service comments in light of recent thinking

* validator: some notes on type conversion tests

* wip

* validator: getting capacity from db works

* wip

* validator: eliminating borrows so we can have something pure to mutex out on

* validator: a working mutex on the mixmining service

* validator: renaming mixmining db get_capacity to capacity

* validator: making mixmining db capacity field private, using accessor

* validator: local capacity updates working

* validator: starting REST API for staking

* validator: fixing clippy warning

* validator: minor naming fixes on mixmining service

* validator: service mixnode and rest mixnode + topology conversions + tests

* validator: renaming mix_nodes to mixnodes for consistency

* validator: test fixtures for mixnode

* validator: moved service models into their own file

* validator: a properly-structured toplogy route

* validator: topology retrieval

* validator: killed test fixture warning

* validator: getting set for topology equality checks (testing purposes)

* validator: otherway conversions for topology and mixnode types

* validator: initial topology retrieval working

* validator: ditching go-ish variable name :)

* ibid

* validator: added a StakeUpdate struct to get around cargo fmt failing

* validator: commenting out struct so kill warning

* Ignoring validator vscode settings

* ibid

* ibid
2020-04-17 11:39:36 +01:00
Dave Hrycyszyn 9ab2517b87 Update README.md 2020-04-17 11:37:51 +01:00
Jędrzej Stuczyński 2b48e85554 Merge pull request #183 from nymtech/feature/nym-sphinx-wasm
Feature/nym sphinx wasm
2020-04-17 11:16:38 +01:00
Dave Hrycyszyn 00d31267fa nym-sphinx-wasm: taking advice from The Man Who Loved Iterators 2020-04-17 10:48:57 +01:00
Dave Hrycyszyn f8b2900698 Making Arc clones more explicit. 2020-04-17 10:33:54 +01:00
Dave Hrycyszyn bf2ff5cd78 Ditching comment that told me where to start work one morning. 2020-04-17 10:33:40 +01:00
Dave Hrycyszyn d3bb0b216d nym-sphinx-wasm: using the Try that was already available and reverting foolish change to public API of addressing/nodes 2020-04-17 10:28:10 +01:00
Dave Hrycyszyn 526d7fa27d Some README improvements 2020-04-17 09:52:17 +01:00
Dave Hrycyszyn befad123f6 Removing MIT license 2020-04-17 09:51:44 +01:00
Dave Hrycyszyn 7d49ac8d25 gateway: broke things apart a little bit 2020-04-16 21:11:25 +01:00
Dave Hrycyszyn d628e065f1 gateway: using named function for packet forwarding 2020-04-16 20:59:23 +01:00
Dave Hrycyszyn 1412fdb6a7 gateway: removing text messages 2020-04-16 20:59:03 +01:00
Dave Hrycyszyn 6654d72e78 gateway: shortening multi_tcp_client usages 2020-04-16 20:58:46 +01:00
Dave Hrycyszyn d7150cfa58 nymsphinx: re-exporting NODE_ADDRESS_LENGTH so gateway can use it 2020-04-16 20:57:53 +01:00
Dave Hrycyszyn 99e818952f gateway: grabbing some stuff out of nymsphinx 2020-04-16 20:57:18 +01:00
Dave Hrycyszyn a717a8aabf gateway: client cleanup 2020-04-16 19:47:06 +01:00
Dave Hrycyszyn 10520469dd typo fix 2020-04-16 18:34:18 +01:00
Dave Hrycyszyn ffd941169e nym-sphinx-wasm: documented sphinx_route_from(str) 2020-04-16 18:32:42 +01:00
Dave Hrycyszyn fd874845cd nym-sphinx-wasm: various cleanups on packet creation 2020-04-16 18:26:12 +01:00
Dave Hrycyszyn d7e4374054 nym-sphinx-wasm: noted that message chunking is not yet implemented 2020-04-16 17:12:59 +01:00
Dave Hrycyszyn 044b12cdf1 nym-sphinx-wasm: ditched old code 2020-04-16 17:12:41 +01:00
Dave Hrycyszyn 060d0b4f02 gateway: successful send using multi-tcp-client 2020-04-16 16:45:34 +01:00
Dave Hrycyszyn 4b2a6f20f3 scripts: building for local in debug mode 2020-04-16 13:43:25 +01:00
Dave Hrycyszyn 1eb211dbd4 nym-sphinx-wasm: including provider encoding in the packet 2020-04-16 13:43:04 +01:00
Dave Hrycyszyn 40e67e7809 nym-sphinx-wasm: chunking packet sends 2020-04-16 13:42:09 +01:00
Dave Hrycyszyn 146bbef3af nym-sphinx-wasm: loosening up serde-related dependencies 2020-04-16 13:40:41 +01:00
Dave Hrycyszyn ab61ef8680 Changing recipient 2020-04-15 20:56:17 +01:00
Dave Hrycyszyn dbd657646c Sending packet to the server 2020-04-15 20:56:02 +01:00
Dave Hrycyszyn beffc45cbe nym-client: typo fix 2020-04-15 20:54:59 +01:00
Dave Hrycyszyn 96bbf9c3f5 gateway: simplifying 2020-04-15 20:54:20 +01:00
Dave Hrycyszyn 85680b22d9 ibid 2020-04-15 20:54:08 +01:00
Dave Hrycyszyn e226001530 gateway: adding log related crates 2020-04-15 20:54:00 +01:00
Dave Hrycyszyn 2a6dd1d5a8 scripts: adding a stop script so I don't need to manually killall all the time 2020-04-15 20:53:29 +01:00
jstuczyn 62e61328a1 Updated email 2020-04-15 18:14:00 +01:00
Dave Hrycyszyn d8776d35ca Merge branch 'develop' into feature/nym-sphinx-wasm 2020-04-15 17:44:47 +01:00
Jędrzej Stuczyński dfefd2383e Improvements to sfw-provider - client communcation (#180)
* Moved auth_token to seperate file

* Extracted check_id as separate type

* Changes due to move of auth_token and making provider client mutable

* New way of serialization provider requests/responses

* Initial attempt of using new provider client

* Moved requests and responses to separate modules

* Moved serialization to separate  files

* Extracted readers and writers to io related modules

* Extra tests + bug fixes

* Updated tokio dependency to require correct features

* typo

* Easier conversion of requests/responses into enum variants

* Renamed 'read_be_u16' to better show its purpose

* Serialization related tests and fixes

* Tests for async_io + fixes

* Future considerations

* Configurable max request size

* Configurable max response size for client

* Removed debug drop implementations

* Removed debug print statement

* Changes to lock file

* Added license notifications

* Cargo fmt
2020-04-15 17:37:24 +01:00
Dave Hrycyszyn 53f29fd4a5 nym-sphinx-wasm: added a bit of documentation onto the www demo 2020-04-15 17:31:35 +01:00
Dave Hrycyszyn 3cbf1fa754 nym-sphinx-wasm: adding an example of wasm Sphinx in action 2020-04-15 17:24:43 +01:00
Dave Hrycyszyn a2e9590420 nym-sphinx-wasm: removing outdated Sphinx examples 2020-04-15 17:24:15 +01:00
Dave Hrycyszyn 9dc9ccd9d4 Removing submodule 2020-04-15 17:18:26 +01:00
Dave Hrycyszyn b662edc343 gateway: simplifying a bit. 2020-04-15 16:54:52 +01:00
Dave Hrycyszyn 279e46e045 nym-sphinx-wasm: appears to generate a Sphinx packet based on info sent from js.
Needs testing.
2020-04-15 16:54:28 +01:00
Dave Hrycyszyn 4fd07aef10 nym-sphinx-wasm: Adding serde to deal with json across wasm boundary 2020-04-15 16:49:18 +01:00
Dave Hrycyszyn d3227ab157 nym-sphinx-wasm: adding async dependency for js 2020-04-15 16:48:45 +01:00
Dave Hrycyszyn 353c8287db nym-sphinx-wasm: adding serde_json as a hack to get across the wasm boundary 2020-04-15 16:43:40 +01:00
Dave Hrycyszyn 16f466b795 Adding serde_json 2020-04-15 16:42:16 +01:00
Dave Hrycyszyn 65db7ef25d nym-sphinx-wasm: adding a JavaScript package 2020-04-15 13:09:01 +01:00
Dave Hrycyszyn 7088fb3ffc Upgraded all Sphinx commits to latest. 2020-04-15 13:08:31 +01:00
Dave Hrycyszyn 53c1aaa256 nymsphinx: adding wasm-bindgen feature to rand crate 2020-04-15 12:54:44 +01:00
Dave Hrycyszyn 306bbb1360 wasm: renamed js example folder 2020-04-14 15:59:54 +01:00
Dave Hrycyszyn c2e3582032 wasm: demo js starting to work 2020-04-14 15:58:34 +01:00
Dave Hrycyszyn dddac13496 gateway: adding a gateway node type which listens on a websocket 2020-04-14 15:50:59 +01:00
Dave Hrycyszyn f07966c3fc scripts: setting run_local_network.sh to be executable 2020-04-14 15:50:14 +01:00
Dave Hrycyszyn b468be83da wasm: noting that we will need to set release params in the root cargo file 2020-04-14 15:49:54 +01:00
Dave Hrycyszyn 25cfa26c56 nym-client: adding js example so I can see if sending is working at all. 2020-04-14 15:49:21 +01:00
Dave Hrycyszyn 3c8aad49fc Updated all uses of ed25519-dalek to 2.0.0 so that wasm-pack build works 2020-04-09 17:20:22 +01:00
Dave Hrycyszyn fd68994e64 A possibly-working wasm Sphinx packet. 2020-04-09 16:42:29 +01:00
Dave Hrycyszyn 61e0ec5ab5 ibid 2020-04-09 16:42:08 +01:00
Dave Hrycyszyn 0d33d35437 nym-sphinx-wasm: updating to latest Sphinx 2020-04-09 16:41:01 +01:00
Dave Hrycyszyn 213fd12ff7 nym-sphinx-wasm: broken WIP commit so the Stuczynski can be unleashed 2020-04-09 15:12:31 +01:00
Dave Hrycyszyn 2d323f180f Initial build of a Sphinx packet in WebAssembly 2020-04-09 14:07:16 +01:00
Dave Hrycyszyn 3f06ccc36b Adding Apache 2 license headers to all files (#178) 2020-04-09 11:24:24 +01:00
Dave Hrycyszyn cb82299f0e Bumped version numbers to 0.7.0-dev 2020-04-07 17:33:26 +01:00
Dave Hrycyszyn ad52e06546 Merge tag 'v0.6.0' into develop
Releasing v0.6.0
2020-04-07 17:30:12 +01:00
Dave Hrycyszyn f5a3d7eea3 Merge branch 'release/0.6.0' 2020-04-07 17:29:55 +01:00
Dave Hrycyszyn d47f0be2f2 Bumping version numbers 2020-04-07 17:29:46 +01:00
Dave Hrycyszyn 7cb78b2090 Add changelog for 0.6.0 2020-04-07 17:20:34 +01:00
Dave Hrycyszyn c4bc6d2799 Making changelog script executable 2020-04-07 17:20:09 +01:00
Jędrzej Stuczyński 3b6110a42e Feature/tcp client connection timeout (#176)
* Added timeout values to configs

* Fixed possible crash when using delay larger than 2 years

* Connection timeout with hardcoded value

* Using provided timeout value

* tcp client requiring timeout value at construction

* Client using updated tcp client

* Mixnode using updated tcp client

* Healthchecker having separate timeout + new client config field

* Updated validator with connection timeout field

* Added connection_timeout to validator config template
2020-04-07 15:50:23 +01:00
Jędrzej Stuczyński 7e1c957090 Feature/mixing stats logging (#175)
* Extra startup log messages

* Type alias for sent metrics map

* Initial metrics informer

* Separated report and running stats

* Decreases report logging level

* Added logging delay as a config value

* New metrics informer constructor

* Determining if running stats should be logged

* Separated running total and reports logging

* Missing changes
2020-04-07 11:21:12 +01:00
Jędrzej Stuczyński f03101cc0b Preventing multiplication overflow for reconnection backoff (#174)
* Preventing multiplication overflow for reconnection backoff

* Check for addition overflow + helpful-ish error message

* Not resetting delay twice

* Lowered healtcheck reconnection backoff to something way more reasonable but still impossible to reach
2020-04-07 11:02:00 +01:00
Jędrzej Stuczyński 6766cf3470 Feature/non mandatory debug config (#173)
* configs no longer need to have all debug fields set

* Removed debug section from config template of mixnode, provider and validator

* Significantly reduced debug section in client config template
2020-04-06 16:32:34 +01:00
Jędrzej Stuczyński b564cd935e Feature/addressing move (#169)
* Moved 'addressing' to nymsphinx + slightly better API + tests

* Replaced all usages of above in the project

* Removed 'split_and_encapsulate_message' from chunking API to get rid of circular dependency + to prefer usage of TopologyAccessor

* changes in Cargo.lock

* formatting
2020-04-03 15:07:02 +01:00
Jędrzej Stuczyński d859a98367 Checking if any other node is already announcing the same host (#168) 2020-04-02 15:39:14 +01:00
Jędrzej Stuczyński d02e248328 Bugfix/closing tcp client connections on drop (#167)
* Filtering out early eof errors

* Wrapping ConnectionManager in Abortable

* Decreased pathchecker logging level

* Client aborting all connection futures on drop

* Moved AbortHandle to connection_managers HashMap to couple them closer together
2020-04-02 15:38:21 +01:00
Jędrzej Stuczyński c401222a84 Yielding tokio task upon creating loop/real traffic message (#166) 2020-04-01 15:33:27 +01:00
Jędrzej Stuczyński 425746e215 Feature/minor healthchecker improvements (#165)
* Integrated new tcp client into healthchecker

* Printing detailed healtcheck score if in debug

* Decreased logging level for when establishing new connection

* Slightly better formatting for printing healthcheck scores
2020-04-01 12:19:39 +01:00
Jędrzej Stuczyński aee3286793 Feature/packet chunking (#158)
Basic support for message chunking and reconstruction. It's now possible to take arbitrarily-sized input and send it through the mixnet. The sending Nym client will automatically chunk the input into Sphinx packets, and the receiving Nym client will then reconstruct the message at the other end.
2020-03-31 16:00:41 +01:00
Dave Hrycyszyn 941bd6d846 Merge branch 'master' into develop 2020-03-30 20:11:01 +01:00
Dave Hrycyszyn 7228806eca monorepo: adding Apache V2.0 license 2020-03-30 20:10:32 +01:00
Dave Hrycyszyn 74e641b57c Adding developer chat to the README 2020-03-27 18:24:59 +00:00
Dave Hrycyszyn 37fd895d13 Update CHANGELOG.md 2020-03-24 11:33:00 +00:00
Dave Hrycyszyn ef062e15ac Documented changelog process a bit better 2020-03-23 11:33:35 +00:00
Dave Hrycyszyn b9143ebc9e Changelog updated 2020-03-23 11:31:36 +00:00
Dave Hrycyszyn 7083294b21 v0.5.0 changelog 2020-03-23 11:14:19 +00:00
Dave Hrycyszyn 9e068ef063 Merge tag 'vv0.5.0' into develop
Release v0.5.0.
2020-03-23 10:50:27 +00:00
Dave Hrycyszyn 1e99e6dc07 Merge branch 'release/v0.5.0' 2020-03-23 10:35:32 +00:00
Dave Hrycyszyn d576a17d33 New cargo versions for top-level binaries 2020-03-23 10:35:19 +00:00
Dave Hrycyszyn 40a14a10b1 Minor README simplification 2020-03-23 10:35:05 +00:00
Jędrzej Stuczyński 8a51503b34 Merge pull request #155 from nymtech/feature/remove-scary-message
removing spooky startup warning message
2020-03-20 13:35:18 +00:00
Dave Hrycyszyn 5109ef290c removing spooky startup warning message 2020-03-20 13:34:11 +00:00
Jędrzej Stuczyński 6e3b2b54df Merge pull request #154 from nymtech/feature/eliminate-double-banner
Some more startup fixes
2020-03-20 13:17:23 +00:00
Dave Hrycyszyn 0048f1a805 Consistenifying return type 2020-03-20 13:01:03 +00:00
Dave Hrycyszyn 5caf093dca Some more startup fixes 2020-03-20 12:56:26 +00:00
Dave Hrycyszyn 478084a5f1 Merge pull request #153 from nymtech/hotfix/client_startup_fix
Entering runtime context when creating mix traffic controller
2020-03-20 12:37:26 +00:00
jstuczyn db02e828a6 Removed outdated comment 2020-03-20 12:25:56 +00:00
jstuczyn 3a4bdc861a Entering runtime context when creating mix traffic controller 2020-03-20 12:23:04 +00:00
Jędrzej Stuczyński eae2fe675d Merge pull request #151 from nymtech/feature/remove-startup-warnings
Friendlification of startup messages
2020-03-19 11:55:30 +00:00
Dave Hrycyszyn df677362ed Merge pull request #150 from nymtech/hotfix/mixnode_startup_fix
Entering runtime context when creating packet forwarder
2020-03-19 11:54:33 +00:00
jstuczyn 776a857779 Entering runtime context when creating packet forwarder 2020-03-19 11:32:44 +00:00
Dave Hrycyszyn 3ccaf77249 mixnode, sfw-provider: no need to expose deep internals to users first thing 2020-03-19 11:18:43 +00:00
Jędrzej Stuczyński 6254169151 Merge pull request #149 from nymtech/feature/add-topology-to-validator
Feature/add topology to validator
2020-03-17 11:02:51 +00:00
Dave Hrycyszyn 684f7a1432 validator: removed unneeded serde_derive 2020-03-17 10:54:47 +00:00
Dave Hrycyszyn e6ac966757 validator: using fully-qualified struct names to eliminate a bit of noise 2020-03-17 09:42:52 +00:00
Dave Hrycyszyn bb235cb7f1 validator: noting async nature of spawn causes out of order messages 2020-03-16 18:11:36 +00:00
Dave Hrycyszyn 1b844292a9 validator: noted the need for some Tendermint startup tenderness and love 2020-03-16 18:09:15 +00:00
Dave Hrycyszyn 2bd837a1e4 validator: fixing unused variable and spelling warnings 2020-03-16 18:05:21 +00:00
Dave Hrycyszyn fced1159ce validator: returning empty topology json ready to be filled up from data 2020-03-16 18:02:20 +00:00
Dave Hrycyszyn 4095f33fca validator: adding json-handling functionality 2020-03-16 18:01:44 +00:00
Dave Hrycyszyn c4f15a3f97 Adding a better-structured route for topology 2020-03-16 17:32:02 +00:00
Dave Hrycyszyn 8a149570a9 validator: adding Iron router 2020-03-16 17:31:46 +00:00
Dave Hrycyszyn 73f07233ff Merge pull request #142 from nymtech/feature/concurrent_connection_managers
Feature/concurrent connection managers
2020-03-16 17:20:27 +00:00
jstuczyn 81ac2b97f4 Added a very important note : ) 2020-03-16 17:04:48 +00:00
jstuczyn a44272be60 Restored previously commented out tests 2020-03-16 17:04:37 +00:00
jstuczyn 3b2461080c Changed the multi-tcp client to have an option to wait for an error response 2020-03-16 17:04:26 +00:00
jstuczyn 270d7567df Merge branch 'develop' into feature/concurrent_connection_managers 2020-03-16 15:08:36 +00:00
Dave Hrycyszyn b2789bf2a1 Merge pull request #148 from nymtech/feature/windows_fix
Making code work on windows machines.
2020-03-16 15:06:21 +00:00
Jędrzej Stuczyński 6d1d8cc5dd Merge pull request #146 from nymtech/feature/add-http-interface
validator: adding HTTP interface
2020-03-16 14:47:57 +00:00
Jędrzej Stuczyński 560b01974f Merge pull request #145 from nymtech/feature/simplify-setup
Extracting the log setup
2020-03-16 14:22:28 +00:00
Dave Hrycyszyn c08ab00c57 validator: trying and temporarily failing to get nice startup messages 2020-03-16 14:15:36 +00:00
Dave Hrycyszyn aaee1bf49a validator: startup messages for REST API 2020-03-16 14:07:27 +00:00
Dave Hrycyszyn 5af61d161a validator: printing out network services as they start 2020-03-16 14:07:03 +00:00
Dave Hrycyszyn ebd2c25d60 Merge branch 'develop' into feature/add-http-interface 2020-03-16 13:54:38 +00:00
jstuczyn c0044499da Missing quoation mark 2020-03-16 13:33:09 +00:00
Dave Hrycyszyn d8e4c8d24d Extracting logging setup for all binaries 2020-03-16 13:22:15 +00:00
Dave Hrycyszyn b4805d27e2 Heheh one newline for the fail :) 2020-03-16 13:18:45 +00:00
Dave Hrycyszyn e76fc79a33 Getting initial REST API working 2020-03-16 13:18:07 +00:00
jstuczyn f5e3e10707 Updated merged changes in config to be consistent with previous updates 2020-03-16 13:12:15 +00:00
jstuczyn 2eb237cc0e Merge branch 'develop' into feature/windows_fix 2020-03-16 13:08:26 +00:00
Dave Hrycyszyn a7ac2e1ad7 Merge pull request #144 from nymtech/feature/optional_location_in_configs
Feature/optional location in configs
2020-03-16 12:58:22 +00:00
jstuczyn 5d2fb6bdfa Updated quotation marks used in config templates to work on windows with paths containing \U sequences 2020-03-16 12:37:09 +00:00
Dave Hrycyszyn b08a4c0930 Extracting the log setup 2020-03-16 12:28:52 +00:00
Dave Hrycyszyn 64bb7ea350 Renamed binaries with correct binary names 2020-03-16 11:42:35 +00:00
Jedrzej Stuczynski 0546c561a9 Actually fixed tests this time 2020-03-13 16:50:30 +00:00
Jedrzej Stuczynski 72ed65dc5f Fixed broken tests 2020-03-13 16:46:18 +00:00
Jedrzej Stuczynski b8bd872cdf ibid. 2020-03-13 16:46:12 +00:00
Jedrzej Stuczynski 3ade837579 Added location to CocoPresence 2020-03-13 16:46:04 +00:00
Jedrzej Stuczynski ab5656ce94 Updated configs and args with location 2020-03-13 16:34:06 +00:00
Jedrzej Stuczynski 78e1f916f2 Updated presence information with location 2020-03-13 16:33:50 +00:00
Jedrzej Stuczynski b99a52bc1b Removed oversensitive logging messages 2020-03-13 12:18:54 +00:00
Jedrzej Stuczynski 1271d6c1f5 Comment regarding future work on getting possible responses back to the callee 2020-03-13 09:36:14 +00:00
Jedrzej Stuczynski fe85fefb5b Client and mixnode adjustments due to previous changes 2020-03-12 16:24:04 +00:00
Jedrzej Stuczynski 7143ab9b53 Changed connection manager to be accessed via a channel 2020-03-12 16:23:47 +00:00
Jedrzej Stuczynski 8279efb684 Exposed methods 2020-03-12 16:22:40 +00:00
Jedrzej Stuczynski f00bc5a3d1 Moved the error reader level up 2020-03-12 16:22:18 +00:00
Jedrzej Stuczynski 51ae70c02b Simple connection error listener 2020-03-12 11:16:00 +00:00
Dave Hrycyszyn dd466281dd Merge pull request #140 from nymtech/hotfix/default_logging_level
Defaulting for global 'Info' logging level if not set in .env
2020-03-12 08:36:19 +00:00
Jedrzej Stuczynski e8a5320ae6 Defaulting for global 'Info' logging level if not set in .env 2020-03-11 14:53:28 +00:00
Dave Hrycyszyn c5efc716c9 Merge pull request #139 from nymtech/feature/ignoring_loop_messages
Provider not storing loop cover messages
2020-03-11 11:28:05 +00:00
Dave Hrycyszyn 1b23b87abe Merge pull request #138 from nymtech/feature/timestamped_logs
Using log builder to include timestamps + filters
2020-03-11 11:27:26 +00:00
Dave Hrycyszyn 486980b906 Merge pull request #134 from nymtech/feature/client-ws-refactoring
Feature/client ws refactoring
2020-03-11 11:26:58 +00:00
Jedrzej Stuczynski 8160c5295b Provider not storing loop cover messages 2020-03-11 10:54:56 +00:00
Jedrzej Stuczynski c625c00d58 Using log builder to include timestamps + filters 2020-03-11 10:36:24 +00:00
Jedrzej Stuczynski 8226a6f0e8 get_all_clients method on topology accessor 2020-03-10 17:03:46 +00:00
Jedrzej Stuczynski 58f59277cc Split and cleaned up websocket handler 2020-03-10 17:03:29 +00:00
Jedrzej Stuczynski c6eb6cf552 More human readable addresses 2020-03-10 11:33:08 +00:00
Jedrzej Stuczynski 858481e1d2 Changed presence and metrics interval to use deadlines rather than fixed delays 2020-03-10 10:11:59 +00:00
Jedrzej Stuczynski a9a3e98801 Reverts changes in 744a004d06 2020-03-10 09:26:44 +00:00
Jedrzej Stuczynski fdd243a012 Merge branch 'develop' of github.com:nymtech/nym into develop 2020-03-09 16:58:13 +00:00
Jedrzej Stuczynski 30fcc54d8f Decreased default metrics and presence sending delay 2020-03-09 16:43:08 +00:00
Jedrzej Stuczynski aa7898eca2 Changed read to read_exact for reading sphinx packets to increase reliability 2020-03-09 16:42:46 +00:00
Dave Hrycyszyn b349b0e166 Merge pull request #131 from nymtech/feature/old-sample-configs
Removed outdated and redundant sample-configs
2020-03-09 12:11:36 +00:00
Jedrzej Stuczynski 9b7b359351 Merge branch 'develop' of github.com:nymtech/nym into develop 2020-03-09 12:05:28 +00:00
Dave Hrycyszyn d84951b6a5 Merge branch 'develop' of github.com:nymtech/nym into develop 2020-03-06 15:07:20 +00:00
Dave Hrycyszyn 744a004d06 Temporarily bumping up log levels to show good v bad packet ratio 2020-03-06 15:07:11 +00:00
Jedrzej Stuczynski 29f4ea25e8 Merge branch 'develop' of github.com:nymtech/nym into develop 2020-03-06 14:46:36 +00:00
Dave Hrycyszyn f0aa297054 Merge pull request #130 from nymtech/bugfix/default_announce_host
If not overridden, 'announce-host' should default to 'host'
2020-03-06 14:14:41 +00:00
Jedrzej Stuczynski 1b35de4326 Removed outdated and redundant sample-configs 2020-03-06 14:13:33 +00:00
Jędrzej Stuczyński 0caddb1610 Merge pull request #129 from nymtech/feature/add-directory-server-url-to-node-start
Nice to know who we're talking to at startup...
2020-03-06 14:11:30 +00:00
Jedrzej Stuczynski 3ccda81a24 Merge branch 'develop' of github.com:nymtech/nym into develop 2020-03-06 14:06:04 +00:00
Dave Hrycyszyn 817fc91a33 Nice to know who we're talking to at startup... 2020-03-06 14:05:03 +00:00
Jedrzej Stuczynski 562aeefc7a If not overridden, 'announce-host' should default to 'host' 2020-03-06 14:03:50 +00:00
Jedrzej Stuczynski cf01679c5c Merge tag 'v0.5.0-rc.1' into develop
v0.5.0-rc.1
2020-03-06 12:52:04 +00:00
Jedrzej Stuczynski 17b7f69b0c Merge branch 'release/v0.5.0-rc.1' 2020-03-06 12:51:52 +00:00
Jedrzej Stuczynski 4abb4d0b45 Updated run_local_network script to work with 0.5.0 2020-03-06 12:51:24 +00:00
Dave Hrycyszyn 986f285f4c Removing semi-confusing initial message to user 2020-03-06 12:34:39 +00:00
Jedrzej Stuczynski 2053eff036 Updated changelog 2020-03-06 12:04:40 +00:00
Jedrzej Stuczynski 2b1781b06d Updated binary versions 2020-03-06 11:47:52 +00:00
Dave Hrycyszyn 1a344a4331 Merge pull request #128 from nymtech/feature/client-refactoring
Feature/client refactoring
2020-03-06 11:41:07 +00:00
Jedrzej Stuczynski 6c730c217f Trying to run travis test in single threaded mode 2020-03-06 11:39:47 +00:00
Jedrzej Stuczynski d3594b620c Replaced cryptic unwrap with an expect 2020-03-05 15:29:25 +00:00
Jedrzej Stuczynski e194194478 experimental native rust api 2020-03-05 15:24:19 +00:00
Jedrzej Stuczynski f73d6371d2 Made clippy happier 2020-03-05 15:18:07 +00:00
Jedrzej Stuczynski 8b90953ae0 Allowed used of deprecated function inside a deprecated function 2020-03-05 15:07:33 +00:00
Jedrzej Stuczynski 9eae7a23ce Significantly reduced number of calls to clone topology 2020-03-05 14:59:55 +00:00
Jedrzej Stuczynski 374da49bcd Initial version of nym-client using persistent tcp connections
Not yet fully refactored
2020-03-05 12:54:17 +00:00
Jedrzej Stuczynski b343410840 Updated client config with tcp client related fields 2020-03-05 10:04:33 +00:00
Jedrzej Stuczynski 76cf73b70b Exposed new method 2020-03-04 15:34:57 +00:00
Jedrzej Stuczynski 9f416b6570 Converted cover traffic stream into an actual stream 2020-03-04 15:33:32 +00:00
Jedrzej Stuczynski 8cde30459b Made new and start method on buffer controller public to the crate 2020-03-04 14:39:16 +00:00
Jedrzej Stuczynski 7ea3c68820 Refactored received buffer controller 2020-03-04 14:37:27 +00:00
Dave Hrycyszyn 1d26ec1ada Merge pull request #125 from nymtech/feature/provider-refactoring
Feature/provider refactoring
2020-03-03 14:13:51 +00:00
Jedrzej Stuczynski 4992498942 Refactored client handling 2020-03-03 12:45:04 +00:00
Jedrzej Stuczynski 3852c99f9e Removed commented code 2020-03-03 12:44:50 +00:00
Jedrzej Stuczynski ff4284a3b9 Redundant code in mix handling 2020-03-03 12:44:37 +00:00
Jedrzej Stuczynski c167aca3e3 Theoretically thread safe client storage 2020-03-03 12:44:18 +00:00
Jedrzej Stuczynski 937e15e631 Removed unused 'has_client' method from the ledger 2020-03-03 12:43:50 +00:00
Jedrzej Stuczynski 59dcf77bf5 Defined ErrorResponse type 2020-03-03 12:43:28 +00:00
Jedrzej Stuczynski a411dec540 Client changes due to updates in sphinx 2020-03-03 10:23:55 +00:00
Jedrzej Stuczynski 20f2f1e04f Updated mockito to fix build issues 2020-03-03 10:21:58 +00:00
Jedrzej Stuczynski b6727ac7b4 Replaced retrieve token method with verify token to bypass lifetime issues 2020-03-02 17:04:58 +00:00
Jedrzej Stuczynski 8ed53847d3 Method to actually retrieve stored auth token to compare it against one sent 2020-03-02 15:55:52 +00:00
Jedrzej Stuczynski 0f5167b57f Added ledger method to remove existing token 2020-03-02 15:44:29 +00:00
Jedrzej Stuczynski 30611d0a68 Reversed Client ledger mapping 2020-03-02 15:43:52 +00:00
Jedrzej Stuczynski 3a2ad5ae10 sphinx version upgrade 2020-03-02 15:40:12 +00:00
Jedrzej Stuczynski 63dfbc1465 Using native to_base58_string in client ledger 2020-03-02 12:21:24 +00:00
Jedrzej Stuczynski 1f69f09072 Fixed address derivation 2020-03-02 12:19:38 +00:00
Jedrzej Stuczynski 575bcaa43b Adjusted field access to AuthToken 2020-03-02 12:13:53 +00:00
Jedrzej Stuczynski b85bc53002 Fix to provider requests due to previous sphinx changes 2020-03-02 12:13:31 +00:00
Jedrzej Stuczynski b8f0fdefee made has token method on client ledger public 2020-03-02 11:12:07 +00:00
Jedrzej Stuczynski 3851e9e350 Constructor for client storage 2020-03-02 09:52:51 +00:00
Jedrzej Stuczynski 73ea1e29e0 Pending work 2020-02-28 13:03:55 +00:00
Jedrzej Stuczynski a4c9bc1df6 Adjusted clients ledger 2020-02-28 13:03:43 +00:00
Jedrzej Stuczynski ec93fdbbde Extra comments + derived traits 2020-02-28 13:03:29 +00:00
Jedrzej Stuczynski 1d36f73e89 Handling of received sphinx packet (incl. store) 2020-02-28 13:02:52 +00:00
Jedrzej Stuczynski da9593cee2 Missed updated sphinx cargo.toml file 2020-02-28 12:33:21 +00:00
Jedrzej Stuczynski b6e2c25c09 Made relevant mix methods private 2020-02-28 12:33:09 +00:00
Jedrzej Stuczynski 03aac5bd35 Updated sphinx 2020-02-28 12:32:47 +00:00
Jedrzej Stuczynski 3cb813d056 Updated Storage to work with async io 2020-02-28 11:48:08 +00:00
Jędrzej Stuczyński 6606ba7279 Merge pull request #123 from nymtech/feature/persistence-typo-fix
all: fixing mis-spelling
2020-02-28 09:14:37 +00:00
Dave Hrycyszyn e600dc7c4f all: fixing mis-spelling 2020-02-27 17:14:52 +00:00
Jedrzej Stuczynski 88eef54cc5 dead code 2020-02-27 14:44:14 +00:00
Jedrzej Stuczynski b922c869f0 Got rid of compiler warnings 2020-02-27 14:42:46 +00:00
Jedrzej Stuczynski 0c90afeaa2 Adjusted tcp client tests to work concurrently + without "wait" 2020-02-27 14:37:01 +00:00
Jedrzej Stuczynski 3756de9e86 processing data -> packet processor 2020-02-27 14:22:50 +00:00
Jedrzej Stuczynski 7fd3e28f2a Renamed reconnection backoff to initial reconnection backoff 2020-02-27 14:22:36 +00:00
Jedrzej Stuczynski 511ec78b2c Removed resolved comment 2020-02-27 14:22:11 +00:00
Jedrzej Stuczynski c71a1ae71d Changes due to updated sphinx 2020-02-27 13:08:25 +00:00
Jedrzej Stuczynski 8c6744dd96 Mixes starting with empty list of endpoints 2020-02-27 13:07:55 +00:00
Jedrzej Stuczynski b489d422a2 Dynamic list of tcp connections 2020-02-27 13:07:41 +00:00
Jedrzej Stuczynski 71c465afd5 Updated sphinx rev 2020-02-27 12:49:49 +00:00
Jedrzej Stuczynski c6cceb8d4d Starting and using the forwarding channel 2020-02-27 12:20:00 +00:00
Jedrzej Stuczynski 8f48836fd4 Full sphinx packet processing 2020-02-27 12:19:44 +00:00
Jedrzej Stuczynski 594e42793e Updated client error message 2020-02-27 12:19:30 +00:00
Jedrzej Stuczynski dfb7c82c31 Updated mixnode config with forwarding data 2020-02-27 12:19:08 +00:00
Jedrzej Stuczynski 1418d068b0 Mixnode packet forwarder 2020-02-27 12:18:50 +00:00
Jedrzej Stuczynski 8febd59588 Changed LocalBoxFuture to BoxFuture in reconnector (adds Send requirement) 2020-02-27 12:18:38 +00:00
Jedrzej Stuczynski 0e6d0c5bda Beginning of listener and packet processing refactoring 2020-02-26 17:08:06 +00:00
Jedrzej Stuczynski f297ed7323 Refactored mixnode startup and moved a lot of code outside of mod.rs 2020-02-26 17:07:45 +00:00
Jedrzej Stuczynski 811e18b36e Refactored how metrics are handled - separate sender, receiver and reporter 2020-02-26 17:07:18 +00:00
Jedrzej Stuczynski d808c9dab4 changed presence notifier to return JoinHandle 2020-02-26 17:06:47 +00:00
Jedrzej Stuczynski 2eec9dc8a1 Required provider adjustments due to previous changes 2020-02-26 17:06:17 +00:00
Jedrzej Stuczynski 3f3dfd404c Removed derivation of copy on private keys 2020-02-26 17:05:36 +00:00
Jedrzej Stuczynski e03fd54739 Updated sphinx version 2020-02-26 17:05:18 +00:00
Jedrzej Stuczynski f136f8e75a Presence reporter responsible for starting own task 2020-02-26 11:31:27 +00:00
Jedrzej Stuczynski b27ebc3eed Updated travis to run tests in single threaded fashion 2020-02-25 16:34:43 +00:00
Jedrzej Stuczynski 732bf7472e Cleaned some imports by moving them to test module 2020-02-25 16:05:57 +00:00
Jedrzej Stuczynski 87bbe9c864 Remaining lifetime changes required by ibid. 2020-02-25 16:04:28 +00:00
Jedrzej Stuczynski d77f2b20ce Replaced scary looking Pin<Box<dyn Future<Output = ... >>> with LocalBoxFuture<...> 2020-02-25 16:01:48 +00:00
Jedrzej Stuczynski 04dec97109 Adjusted logging messages 2020-02-25 15:57:36 +00:00
Jedrzej Stuczynski 9b81c2eb68 Initial version of the reconnecting tcp client 2020-02-25 15:54:50 +00:00
Jedrzej Stuczynski f599502eab log dependency required by ibid. 2020-02-24 15:23:52 +00:00
Jedrzej Stuczynski a5c65b27d9 Experimenting with connection reconnector 2020-02-24 15:23:29 +00:00
Jedrzej Stuczynski bd86ef07a9 Client is now constructed with a config struct 2020-02-21 14:49:57 +00:00
Jedrzej Stuczynski 3f80a00bf1 Introduced backoff fields to connection writer 2020-02-21 14:49:44 +00:00
Jedrzej Stuczynski bfad2168b1 Maintaining persistent connection to server (no reconnection yet) 2020-02-21 14:30:16 +00:00
Jedrzej Stuczynski d807bcd1ee Created the multi-tcp-client crate 2020-02-21 14:29:26 +00:00
Dave Hrycyszyn 9612141129 Merge pull request #121 from nymtech/feature/further_clippy_fixes
Feature/further clippy fixes
2020-02-19 16:50:12 +00:00
Jedrzej Stuczynski 285e5dc5ec Clippy ignoring new_without_default for MixClient 2020-02-19 16:49:31 +00:00
Jedrzej Stuczynski 0928a5aaeb Making clippy nice and happy 2020-02-19 16:48:53 +00:00
Dave Hrycyszyn f2eb52fbcf Merge pull request #120 from nymtech/feature/tokio_tungstenite_dependency_fix
Feature/tokio tungstenite dependency fix
2020-02-19 16:25:10 +00:00
Dave Hrycyszyn aa93e611ee Merge pull request #119 from nymtech/feature/config_files_cleanup
Feature/config files cleanup
2020-02-19 16:22:59 +00:00
Jedrzej Stuczynski b68689dc4b Using proper release version of tokio-tungstenite rather than pointing to specific commit 2020-02-19 16:01:39 +00:00
Jedrzej Stuczynski 8229cb2c74 Logging message when binding to socket 2020-02-19 16:01:07 +00:00
Jedrzej Stuczynski bdf1e5bef9 Fixed further linter warnings 2020-02-19 15:47:38 +00:00
Jedrzej Stuczynski 1a8573632f 'new_without_default' clippy warnings 2020-02-19 15:38:46 +00:00
Jedrzej Stuczynski a62744a177 Fixed clippy warnings 2020-02-19 15:33:37 +00:00
Jedrzej Stuczynski a6c389b5a6 Renamed 'average_delay_duration' to just 'average_delay' 2020-02-19 15:19:13 +00:00
Jedrzej Stuczynski f72b456cdd Renamed poisson::sample_from_duration to poisson::sample 2020-02-19 15:18:00 +00:00
Jedrzej Stuczynski 6515666b84 Removed comments regarding keypair for sfw-provider init 2020-02-19 11:41:27 +00:00
Jedrzej Stuczynski 16c92bebdf Removed the fake-news comments 2020-02-19 11:37:47 +00:00
Jedrzej Stuczynski 15b626bb6f Removed comments regarding keypair for mixnode init 2020-02-19 11:24:36 +00:00
Dave Hrycyszyn ef4929dacc Fixed banner usage 2020-02-17 16:32:46 +00:00
Dave Hrycyszyn 9391e7148a Merge branch 'feature/config_files' into develop 2020-02-17 14:56:26 +00:00
Jedrzej Stuczynski 1f06aa2fb9 ibid. 2020-02-05 16:53:31 +00:00
Jedrzej Stuczynski 800c41ce97 Removed unused imports 2020-02-05 16:52:17 +00:00
Jedrzej Stuczynski 1fa599dd63 Getting rid of direct Scalar and MontgomeryPoint imports 2020-02-05 16:51:56 +00:00
Jedrzej Stuczynski bf93739ef5 Updated validator config template 2020-02-05 16:36:32 +00:00
Jedrzej Stuczynski a9e0a1d634 Updated config override for validator 2020-02-05 16:31:26 +00:00
Jedrzej Stuczynski ab24008c87 Fixed compilation error due to old imports 2020-02-05 16:29:07 +00:00
Jedrzej Stuczynski 1f53dcc56f Removed no longe used toml dependency from the validator 2020-02-05 16:28:56 +00:00
Jedrzej Stuczynski 9f49746b44 Actually using proper config 2020-02-05 16:27:31 +00:00
Jedrzej Stuczynski 7f999d5893 Validator using new config 2020-02-05 16:25:47 +00:00
Jedrzej Stuczynski 852d127a2a Mix mining config section 2020-02-05 16:25:34 +00:00
Jedrzej Stuczynski 0d3084b956 Updated validator dependencies 2020-02-05 16:02:59 +00:00
Jedrzej Stuczynski da8365ee14 Running validator via commands::run::execute 2020-02-05 16:02:44 +00:00
Jedrzej Stuczynski 95d1912e18 More typos 2020-02-05 15:57:36 +00:00
Jedrzej Stuczynski ae27a5e4c3 Corrected run description for sfw-provider 2020-02-05 15:55:14 +00:00
Jedrzej Stuczynski 28b5673cbf Corrected description to say validator instead of mixnode 2020-02-05 15:54:31 +00:00
Jedrzej Stuczynski 5aee54fc1d Stubs for validator configs 2020-02-05 15:53:02 +00:00
Jedrzej Stuczynski 84cb98ca96 Override config stub 2020-02-05 15:52:42 +00:00
Jedrzej Stuczynski 8ea9b14e94 Init command for the validator 2020-02-05 15:52:35 +00:00
Jedrzej Stuczynski 83e22dbad9 Moved built_info module to separate file 2020-02-05 15:52:19 +00:00
Jedrzej Stuczynski 3497ae1043 Pushing those new debug options down the provider processing stack 2020-02-05 13:00:20 +00:00
Jedrzej Stuczynski 4e4024aba6 Fixed broken tests 2020-02-05 12:49:47 +00:00
Jedrzej Stuczynski 95160a2ba3 Additional debug options 2020-02-05 12:45:47 +00:00
Jedrzej Stuczynski 3fdf7b4f10 Provider starting to use new config 2020-02-05 12:38:32 +00:00
Jedrzej Stuczynski c5ec0591e1 Changes to provider presence notifier similar to the ones in mixnode 2020-02-05 12:31:00 +00:00
Jedrzej Stuczynski 82bcb3f79f made net_client private 2020-02-05 12:30:39 +00:00
Jedrzej Stuczynski 0ab7e4ddd9 mix-host and client-host no longer required for 'run' 2020-02-05 12:15:06 +00:00
Jedrzej Stuczynski 2df3a262ef Fixed errors in template causing loading errors 2020-02-05 12:11:51 +00:00
Jedrzej Stuczynski 5f393de34b Provider pathfinder (identical to mixnode's) 2020-02-05 12:08:21 +00:00
Jedrzej Stuczynski 48c77bcb0d Template for provider config 2020-02-05 12:08:01 +00:00
Jedrzej Stuczynski 0084c74f97 typo 2020-02-05 12:05:46 +00:00
Jedrzej Stuczynski 7d9e2ef64a "mixnode" => "provider" 2020-02-05 11:58:35 +00:00
Jedrzej Stuczynski 75df3a87b8 Provider sphinx key loading 2020-02-05 11:49:40 +00:00
Jedrzej Stuczynski 4c9c742795 Updated provider dependencies 2020-02-05 11:49:27 +00:00
Jedrzej Stuczynski 30bf382d0a Better argument description 2020-02-05 11:49:11 +00:00
Jedrzej Stuczynski 881ab4f28e config changes required by ibid. 2020-02-05 11:48:46 +00:00
Jedrzej Stuczynski 851ccfd736 Ability to start provider with new 'run' method (but still using old config) 2020-02-05 11:48:33 +00:00
Jedrzej Stuczynski 133d36b559 override config function 2020-02-05 11:23:54 +00:00
Jedrzej Stuczynski d6824ccad2 announce-X-host/port => X-announce-host/port 2020-02-05 11:15:14 +00:00
Jedrzej Stuczynski 273a61d7de client => clients 2020-02-05 11:12:22 +00:00
Jedrzej Stuczynski e8b9d641ba Init command for the provider 2020-02-05 11:02:02 +00:00
Jedrzej Stuczynski 61b9fac25b Initial definition of new sfw provider config 2020-02-05 10:39:27 +00:00
Jedrzej Stuczynski 0d5fe1a788 Starting provider via commands::run::execute 2020-02-04 15:55:36 +00:00
Jedrzej Stuczynski bc8e5fd6f6 Adjusted mixnode config template to new changes 2020-02-04 15:24:12 +00:00
Jedrzej Stuczynski 441e586915 Accidentally removed import path 2020-02-04 15:18:52 +00:00
Jedrzej Stuczynski bed0badc15 Defaults in the config + using said fields when starting mixnode 2020-02-04 15:17:25 +00:00
Jedrzej Stuczynski 448fc4a361 ibid. for metrics 2020-02-04 15:15:51 +00:00
Jedrzej Stuczynski fd33589326 Using sending delay from config for the presence notifier 2020-02-04 15:14:17 +00:00
Jedrzej Stuczynski 1080ad5ac1 Two debug directory servers - presence and metrics 2020-02-04 15:08:13 +00:00
Jedrzej Stuczynski 7723dc7aed constant default port 2020-02-04 14:50:20 +00:00
Jedrzej Stuczynski b2f41de27b Constructor for notifier config 2020-02-04 14:36:02 +00:00
Jedrzej Stuczynski ed9ee27340 Uncommited mixnode persitance module 2020-02-04 13:18:00 +00:00
Jedrzej Stuczynski e1cc16fe81 Using new config in mixnode constructor 2020-02-04 13:12:17 +00:00
Jedrzej Stuczynski 937becb1ac Removed runner 2020-02-04 13:11:37 +00:00
Jedrzej Stuczynski fe93a3f4d5 Removed client keys being loaded twice 2020-02-04 13:08:21 +00:00
Jedrzej Stuczynski fee81aaff7 Changed layer from usize to u64 for better serialization 2020-02-04 13:04:41 +00:00
Jedrzej Stuczynski b1207caf7c Inner methods on private/public encryption keys 2020-02-04 12:58:24 +00:00
Jedrzej Stuczynski 5fd8987eb9 More easily expandable list of 'special' addresses that show binding warning 2020-02-04 12:54:16 +00:00
Jedrzej Stuczynski f858d407ca Starting the mixnode with commands::run::execute 2020-02-04 12:48:40 +00:00
Jedrzej Stuczynski 8caf218aed To and from b58 string on encryption public key 2020-02-04 12:39:03 +00:00
Jedrzej Stuczynski 6c32d64194 Changed config to be more explicit about type of keys used 2020-02-04 12:36:06 +00:00
Jedrzej Stuczynski 7a99905f1d Generating and saving keys on mixnode init 2020-02-04 12:34:53 +00:00
Jedrzej Stuczynski 25a8f63912 Extracted config overriding, similarly to nym-client 2020-02-04 12:34:38 +00:00
Jedrzej Stuczynski c6fa539845 Pemstore capable of using slightly more generic types 2020-02-04 12:14:09 +00:00
Jedrzej Stuczynski 4c900bbfff Extended pemstorable traits with methods required for more generic store 2020-02-04 12:13:49 +00:00
Jedrzej Stuczynski 165d022015 Defined 'PemStorableKeypair' trait and implemented it on existing keypairs 2020-02-04 11:28:49 +00:00
Jedrzej Stuczynski 495b0c7ed9 Renamed 'PemStorable' trait to 'PemStorableKey' 2020-02-04 11:21:00 +00:00
Jedrzej Stuczynski a491f7543a More builder methods, incl. announce host/port parsers 2020-02-03 17:20:29 +00:00
Jedrzej Stuczynski 901996345c announce address in template 2020-02-03 17:19:52 +00:00
Jedrzej Stuczynski 15c0c731e9 Saving mixnode's config on init 2020-02-03 15:24:31 +00:00
Jedrzej Stuczynski fad5c98629 Initial mix config with working default test 2020-02-03 15:02:13 +00:00
Jedrzej Stuczynski de2dbf7156 Started creating mixnode commands, similarly to client 2020-02-03 14:15:22 +00:00
Jedrzej Stuczynski 1e1e1db4f5 Printing nym banner even in case of invalid command 2020-02-03 13:15:24 +00:00
Jedrzej Stuczynski c7c52e68b5 Moved args definition to specific commands file 2020-02-03 13:07:45 +00:00
Jedrzej Stuczynski ac5d16899e Using the new config options + slightly better constructor for topology controller 2020-02-03 12:25:08 +00:00
Jedrzej Stuczynski 9e890da986 Additional debug config options 2020-02-03 12:02:43 +00:00
Jedrzej Stuczynski ab2703e6c1 Updated comments on ibid. 2020-02-03 11:57:50 +00:00
Jedrzej Stuczynski 21877c240b Added topology resolution timeout to client debug config 2020-02-03 11:56:39 +00:00
Jedrzej Stuczynski e091d30f6e Slightly better logging messages 2020-02-03 11:51:01 +00:00
Jedrzej Stuczynski 04e415eb0c No more panics on websocket handshake error 2020-02-03 11:48:26 +00:00
Jedrzej Stuczynski 35f5816da8 Using auth token obtained during init 2020-02-03 11:36:29 +00:00
Jedrzej Stuczynski efda3ee834 Further decreased logging level during healthcheck 2020-02-03 11:36:02 +00:00
Jedrzej Stuczynski ce6d858b88 Additional comments 2020-02-03 11:07:31 +00:00
Jedrzej Stuczynski 82232f970a Choosing provider at startup + (if applicable) performing registration 2020-02-03 11:07:13 +00:00
Jedrzej Stuczynski b72ce283b4 Derived Into<String> for AuthToken using existing to base58 method 2020-02-03 11:06:43 +00:00
Jedrzej Stuczynski cc5627f0c3 Notice regarding client address 2020-02-03 09:57:06 +00:00
Jedrzej Stuczynski 0f03221fb9 Removed redundant key info print 2020-02-03 09:54:43 +00:00
Jedrzej Stuczynski 98ea9dccdf Removed duplicate code for overwriting config values 2020-02-03 09:40:53 +00:00
Jedrzej Stuczynski 8747dc9d72 Unused import 2020-02-03 09:31:31 +00:00
Jedrzej Stuczynski a4d500f0f5 Additional optional arguments for client init 2020-01-31 16:32:32 +00:00
Jedrzej Stuczynski 9e0735498b Corrected client config template comments 2020-01-31 16:27:56 +00:00
Jedrzej Stuczynski 12fc906542 Changing poisson sampling to sample from time::Duration 2020-01-31 16:24:14 +00:00
Jedrzej Stuczynski 94479cdeec Loop cover messages having parameterized delays 2020-01-31 16:20:49 +00:00
Jedrzej Stuczynski bcbebe944d Borrow checker 2020-01-31 16:16:26 +00:00
Jedrzej Stuczynski 199377d466 Made 'run' command compilable again 2020-01-31 16:15:52 +00:00
Jedrzej Stuczynski 98a19e7823 Removed websocket and tcpsocket commands 2020-01-31 16:15:09 +00:00
Jedrzej Stuczynski d9a95917e3 Moved SocketType enum to config 2020-01-31 16:13:23 +00:00
Jedrzej Stuczynski 6432e708d6 Extra argument to cover traffic stream 2020-01-31 16:10:00 +00:00
Jedrzej Stuczynski 409bfb4f08 ibid. for provider poller 2020-01-31 16:05:22 +00:00
Jedrzej Stuczynski c921223ac2 Changed topology control to also use time::duration 2020-01-31 16:02:34 +00:00
Jedrzej Stuczynski 8c68a812e2 Made client config delay getters return time::duration 2020-01-31 16:00:17 +00:00
Jedrzej Stuczynski 79b18a4789 Fixed initial real packet timing bias + duration parameterization 2020-01-31 15:57:45 +00:00
Jedrzej Stuczynski f3da6d4258 Updated used sphinx revision 2020-01-31 15:07:38 +00:00
Jedrzej Stuczynski 1e938dfd55 Provider poller getting rate from the provided config value 2020-01-31 13:04:39 +00:00
Jedrzej Stuczynski e48b28eefd Generating proper tmp random dir on each test run 2020-01-31 12:51:17 +00:00
Jedrzej Stuczynski ea5223ddf5 Custom deserializer for Option<String> to fix receiving Some("") rather than None 2020-01-31 12:50:56 +00:00
Jedrzej Stuczynski 65772cdc1e Fixed how ensuring config save directory exists 2020-01-31 12:40:16 +00:00
Jedrzej Stuczynski f8a468135a Replaced AuthToken with new implementation 2020-01-31 11:59:27 +00:00
Jedrzej Stuczynski 5a4bf6f08a ibid. 2020-01-31 11:49:45 +00:00
Jedrzej Stuczynski dbf3c0d6ea Created new version of AuthToken that can be converted to and from String 2020-01-31 11:49:36 +00:00
Jedrzej Stuczynski abd937e308 Started modifying NymClient to hold config struct 2020-01-31 11:49:03 +00:00
Jedrzej Stuczynski f23fd57e8d TCP and WebSocket taking only port as an argument rather than whole SocketAddr 2020-01-31 11:48:41 +00:00
Jedrzej Stuczynski e9f96e030f Extra bit of information in template indicating AuthToken is expected to be b58 2020-01-31 11:48:16 +00:00
Jedrzej Stuczynski 02add8d416 More config getters + extra comments 2020-01-31 11:47:46 +00:00
Jedrzej Stuczynski a5cee1fa62 Topology refresh switching to millis interval 2020-01-31 11:47:20 +00:00
Jedrzej Stuczynski bc18173ffa Made builder methods on config more generic to accept any kind of strings 2020-01-31 10:19:10 +00:00
Jedrzej Stuczynski 3ac46255f0 ibid. 2020-01-31 10:18:40 +00:00
Jedrzej Stuczynski b8530c91c1 Made conversion into 'SocketType' enum more generic
Now it works for anything that can be converted into String
2020-01-31 10:10:52 +00:00
Jedrzej Stuczynski f13e5ae186 Allow using "ws" alias for websocket 2020-01-31 10:07:58 +00:00
Jedrzej Stuczynski 0780f6c501 Added optional provider auth token to config 2020-01-31 10:04:29 +00:00
Jedrzej Stuczynski 09ac19fb45 Using except rather than unwrap during client init 2020-01-31 10:04:10 +00:00
Jedrzej Stuczynski bb29421854 Ensuring the whole path to pem files exist before saving 2020-01-31 10:03:51 +00:00
Jedrzej Stuczynski 2ac707d57c Constructing client config + printing it 2020-01-30 17:07:05 +00:00
Jedrzej Stuczynski af5c389eea Ability to convert SocketType from &str or String 2020-01-30 17:06:45 +00:00
Jedrzej Stuczynski b27b619412 Debug on Pathfinder 2020-01-30 16:13:11 +00:00
Jedrzej Stuczynski 7b0aee7a2c Using correct methods 2020-01-30 16:13:04 +00:00
Jedrzej Stuczynski 807e4234d6 Default save_to_file method making sure the directory exists 2020-01-30 16:12:44 +00:00
Jedrzej Stuczynski 51e43547ed Changed NymConfig to take optional id for some of its method 2020-01-30 16:09:53 +00:00
Jedrzej Stuczynski 2e63f95b76 More descriptive variable names in pemstore 2020-01-30 16:08:44 +00:00
Jedrzej Stuczynski 32f067256b Pemstore no longer creating directory for config file 2020-01-30 16:08:30 +00:00
Jedrzej Stuczynski e97102d3e4 Generating and saving client config on client init 2020-01-30 14:55:33 +00:00
Jedrzej Stuczynski 851bad7864 Extra logging for pemstore 2020-01-30 14:55:21 +00:00
Jedrzej Stuczynski 728f5e237a Ability to create client pathfinder from the config 2020-01-30 14:55:10 +00:00
Jedrzej Stuczynski 9767dd58ca Additional methods on client config 2020-01-30 14:54:58 +00:00
Jedrzej Stuczynski f33e9e80f6 Added config_file_name() to NymConfig trait 2020-01-30 14:54:45 +00:00
Jedrzej Stuczynski 0ad648703f Changed delays/intervals values to use millis rather than seconds 2020-01-30 14:21:44 +00:00
Dave Hrycyszyn a3b3cc1edd validator: minor variable name change 2020-01-30 13:04:43 +00:00
Dave Hrycyszyn 793d42c33a mixnode: running without args isn't an error 2020-01-30 13:01:26 +00:00
Jedrzej Stuczynski 03f7be502b Updated import path for serde 2020-01-30 12:57:06 +00:00
Jedrzej Stuczynski 3409dfcdf3 Merge branch 'develop' into feature/config_files 2020-01-30 12:50:35 +00:00
Jędrzej Stuczyński fd89dc36ec Merge pull request #111 from nymtech/feature/un-genericize-keys
Feature/un genericize keys
2020-01-30 12:49:19 +00:00
Dave Hrycyszyn 9797b8da74 crypto: simplified keypairs a bit 2020-01-30 12:27:00 +00:00
Dave Hrycyszyn 6b879e88e7 nym: removing type parameters on keypairs 2020-01-30 12:19:23 +00:00
Dave Hrycyszyn d3199778e4 validator: starting removal of keypair generics 2020-01-30 11:55:15 +00:00
Dave Hrycyszyn c426b09b07 validator: placeholder comment for Ethereum integration 2020-01-30 11:50:37 +00:00
Jędrzej Stuczyński 3c6e6d1ad7 Merge pull request #110 from nymtech/feature/abci
Feature/abci
2020-01-30 11:46:31 +00:00
Dave Hrycyszyn 46055fe8c4 validator: removing unused config 2020-01-30 11:33:04 +00:00
Dave Hrycyszyn d75ac203d2 validator: simplified task spawning 2020-01-30 11:32:06 +00:00
Dave Hrycyszyn c4c004cd9c validator: WIP on merge conflicts 2020-01-30 11:25:00 +00:00
Dave Hrycyszyn c956576231 Merge pull request #109 from nymtech/feature/keypair_generic_cleanup
Simplified the use of generics on identity keypair by using output types
2020-01-30 10:33:02 +00:00
Jedrzej Stuczynski 2d99b2b93a Fixed validator compilation error 2020-01-30 10:19:55 +00:00
Jedrzej Stuczynski 713a7a6fe8 Initial fields for the client config 2020-01-29 16:04:57 +00:00
Jedrzej Stuczynski 00dc25a94f Definition of NymConfig trait + default methods 2020-01-29 16:04:27 +00:00
Jedrzej Stuczynski a73585e13a Simplified the use of generics on identity keypair by using output types 2020-01-29 15:30:20 +00:00
Dave Hrycyszyn acc0f8430a validator: updating run instructions 2020-01-29 13:05:16 +00:00
Dave Hrycyszyn aa251c2450 validator: multi-threading tendermint so that health check also works 2020-01-29 13:02:48 +00:00
Dave Hrycyszyn bb0737e0c8 validator: removing logging for now 2020-01-29 13:01:00 +00:00
Dave Hrycyszyn 536b84c55c validator: removing logging calls 2020-01-29 12:59:02 +00:00
Dave Hrycyszyn b427ffc80d validator: removing serde stuff in abci 2020-01-29 12:58:40 +00:00
Dave Hrycyszyn d729e05d98 ibid 2020-01-29 12:55:04 +00:00
Dave Hrycyszyn b93457b863 validator: changing tendermint start to run() 2020-01-29 12:54:30 +00:00
Dave Hrycyszyn f02b37f5c9 validator: pulling tendermint ABCI out into its own type. 2020-01-29 12:50:09 +00:00
Dave Hrycyszyn 8c9d68041c validator: renamed tendermint integration 2020-01-29 12:49:51 +00:00
Dave Hrycyszyn d9613043ec validator: comment on networks 2020-01-29 12:28:29 +00:00
Dave Hrycyszyn 4c4ec08122 validator: fixing health_check typo in Validator struct 2020-01-29 11:35:39 +00:00
Dave Hrycyszyn 62f4c8bebd validator: import the abci interface for use by the runner 2020-01-29 11:34:49 +00:00
Dave Hrycyszyn 7a68499c11 validator: easier log level switches 2020-01-29 11:34:18 +00:00
Dave Hrycyszyn ef64871f78 validator: adding an async start() method to abci network interface 2020-01-29 11:33:47 +00:00
Dave Hrycyszyn 81ed98d3ec validator: pulling all log levels into main 2020-01-29 11:33:23 +00:00
Dave Hrycyszyn 657e092887 mixnode: minor re-ordering of start() operations 2020-01-29 10:47:46 +00:00
Jedrzej Stuczynski 53a3ceaa00 Merge branch 'develop' into feature/config_files 2020-01-29 10:18:39 +00:00
Jedrzej Stuczynski b9f3000dcc Updated changelog 2020-01-29 10:17:47 +00:00
Jedrzej Stuczynski 04db04ff62 Merge tag 'v0.4.1' into develop
Release 0.4.1
2020-01-29 10:15:44 +00:00
Jedrzej Stuczynski b06b842885 Merge branch 'release/v0.4.1' 2020-01-29 10:15:30 +00:00
Jedrzej Stuczynski 2b73aa9976 Updated packages versions 2020-01-29 10:14:53 +00:00
Dave Hrycyszyn e63012d979 validator: removed separate "tm" command 2020-01-29 09:33:38 +00:00
Dave Hrycyszyn 17a513d5fb validator: Tendermint ABCI works with Validator struct. 2020-01-29 09:31:01 +00:00
Dave Hrycyszyn ae7c1467ae validator: simplifying structure of networking interface files 2020-01-29 09:26:08 +00:00
Dave Hrycyszyn 80f92254e0 Ignoring validator config file inside repo 2020-01-29 09:25:34 +00:00
Dave Hrycyszyn 4ab9b8414d Removing the validator folder, having two seems overly nested 2020-01-29 08:49:13 +00:00
Dave Hrycyszyn 79f9372ebb validator: banging structure around a bit 2020-01-29 08:46:09 +00:00
Dave Hrycyszyn 482deb718c validator: more docs 2020-01-29 08:45:51 +00:00
Dave Hrycyszyn 473c5cd43d validator: using info logging 2020-01-29 08:20:06 +00:00
Dave Hrycyszyn 07061c2ca7 Merge pull request #108 from nymtech/bugfix/healthcheck_on_provided_topology
Bugfix/healthcheck on provided topology
2020-01-28 18:24:58 +00:00
Jedrzej Stuczynski e23dd57213 Client using pre-filtered topology for the healthchecker 2020-01-28 18:07:24 +00:00
Jedrzej Stuczynski eb3aa0baf1 healthchecker no longer pulling entire topology itself 2020-01-28 18:06:59 +00:00
Jedrzej Stuczynski d7b069e0e5 validator responsible for running healtchecker loop 2020-01-28 18:06:39 +00:00
Dave Hrycyszyn 24d9825a49 Fixed changelog v prefix on version 2020-01-28 17:04:37 +00:00
Jedrzej Stuczynski ca1d5b0803 Merge branch 'develop' into feature/config_files 2020-01-28 16:42:57 +00:00
Dave Hrycyszyn 00ab655848 Merge tag 'v0.4.0' into develop
0.4.0 final release
2020-01-28 16:27:26 +00:00
Dave Hrycyszyn d21a4bd4de Merge branch 'release/v0.4.0' 2020-01-28 16:27:15 +00:00
Dave Hrycyszyn 30da43060f Changelog for 0.4.0 2020-01-28 16:26:57 +00:00
Dave Hrycyszyn 922223219d Version bump for release 0.4.0 2020-01-28 16:19:56 +00:00
Dave Hrycyszyn dee2541cc3 Merge tag '0.4.0-rc.2' into develop
0.4.0-rc.2 pre-release
2020-01-28 15:38:33 +00:00
Dave Hrycyszyn a6cbdf5662 Merge branch 'release/0.4.0-rc.2' 2020-01-28 15:38:19 +00:00
Dave Hrycyszyn d189e6f55d Regenerated changelog 2020-01-28 15:38:09 +00:00
Dave Hrycyszyn 1d58d1c2f1 Fixed changelog generator script 2020-01-28 15:38:01 +00:00
Dave Hrycyszyn 78e93cfa15 Merge branch 'master' into release/0.4.0-rc.2 2020-01-28 15:32:22 +00:00
Dave Hrycyszyn 516077086c all: bumped version numbers to 0.4.0-rc.2 2020-01-28 15:32:09 +00:00
Dave Hrycyszyn b20555c622 validator: slight comment change 2020-01-28 13:31:13 +00:00
Dave Hrycyszyn 742c428a25 validator: sample tendermint counter app is breathing. 2020-01-28 13:28:42 +00:00
Dave Hrycyszyn 58f839ecd8 ibid 2020-01-28 13:28:20 +00:00
Dave Hrycyszyn dd2e4f153a validator: adding byteorder crate 2020-01-28 13:28:11 +00:00
Dave Hrycyszyn 74bf2ed9f4 validator: using exact Tendermint version specified by rust-abci crate docs 2020-01-28 13:03:24 +00:00
Dave Hrycyszyn 677791d64c ibid 2020-01-28 12:49:34 +00:00
Dave Hrycyszyn cdbadaf581 scripts: changelog generation script 2020-01-28 12:49:28 +00:00
Dave Hrycyszyn ee8da3a019 validator: starting a README so docs will be easier to write when we switch from Go 2020-01-28 12:47:16 +00:00
Dave Hrycyszyn 6a33168973 validator: adding the abci crate 2020-01-28 12:46:53 +00:00
Jedrzej Stuczynski 8f5a27cb4a Merge branch 'develop' into feature/config_files 2020-01-28 12:37:28 +00:00
Dave Hrycyszyn 9d024f35a3 Merge pull request #106 from nymtech/hotfix/semver_compatibility
Hotfix/semver compatibility
2020-01-28 12:28:22 +00:00
Jedrzej Stuczynski 3e40d90b72 Restored commented tests 2020-01-28 12:26:46 +00:00
Jedrzej Stuczynski 8731934f46 Fixed semver version compatibility 2020-01-28 12:26:24 +00:00
Dave Hrycyszyn ef8872896f Merge tag 'v0.4.0-rc.1' into develop
Pre-release of version 0.4.0.
2020-01-28 12:06:58 +00:00
Dave Hrycyszyn c9cefa9b66 Merge branch 'release/v0.4.0-rc.1' 2020-01-28 12:06:31 +00:00
Dave Hrycyszyn 1bc68ddfa1 changelog: moving to a unified, autogenerated changelog 2020-01-28 12:05:39 +00:00
Dave Hrycyszyn b8fed18c77 cargo: bumping all binary crate version numbers to 0.4.0-rc.1 2020-01-28 11:50:11 +00:00
Jedrzej Stuczynski 0785ad67f5 Merge with develop 2020-01-28 10:10:52 +00:00
Dave Hrycyszyn 1a6226f2bf Merge pull request #105 from nymtech/feature/health_checker_with_existing_keys
Feature/health checker with existing keys
2020-01-27 17:17:48 +00:00
Jedrzej Stuczynski b0e5f7c808 Validator using new healthcheck + added identity key 2020-01-27 17:11:28 +00:00
Jedrzej Stuczynski a9ad990452 Missing cargo.toml changes 2020-01-27 17:11:09 +00:00
Jedrzej Stuczynski 52aede3d99 More generic nym-client with regards to identity keypair 2020-01-27 17:10:53 +00:00
Jedrzej Stuczynski c662dad57f Healthchecker getting keypair from outside rather than generating new one every run 2020-01-27 17:10:29 +00:00
Jedrzej Stuczynski 4ace90ad8b Clone requirement on identity keys + 'derive address' method on public key 2020-01-27 17:08:50 +00:00
Jedrzej Stuczynski 6168cb7276 Decreased logging severity for failing to close read tcp socket 2020-01-27 17:08:12 +00:00
Jędrzej Stuczyński b112f82a7b Merge pull request #104 from nymtech/feature/remove-topology-equality-check
Feature/remove topology equality check
2020-01-27 15:09:48 +00:00
Jędrzej Stuczyński 3c45d17e71 Merge pull request #102 from nymtech/feature/base58
Feature/base58
2020-01-27 15:01:09 +00:00
Dave Hrycyszyn e5580df77b directory-client: removed premature equality check which caused a lock update problem 2020-01-27 14:59:56 +00:00
Dave Hrycyszyn a55b87809e encoding: updating all remaining usages of base64 to base58 2020-01-27 12:10:18 +00:00
Dave Hrycyszyn 1ab4e3efeb ibid 2020-01-27 12:09:57 +00:00
Dave Hrycyszyn b009eb0a4d ibid 2020-01-27 12:09:50 +00:00
Dave Hrycyszyn 416e1f19e0 cargo: updating sphinx to latest pinned version 2020-01-27 12:09:39 +00:00
Dave Hrycyszyn bdda6e2cf5 Removed base64 in favour of base58. 2020-01-27 11:52:44 +00:00
Dave Hrycyszyn c94691d68e nym-client: swapping bs58 for base64 2020-01-27 11:35:11 +00:00
Dave Hrycyszyn 83aa0a37b1 sfw-provider: changed on-disk storage location from hex to base58 2020-01-24 16:50:06 +00:00
Dave Hrycyszyn a198268009 nym-client: renamed suspicious hex variable (which contains bytes) 2020-01-24 16:46:12 +00:00
Dave Hrycyszyn e1b3a22bc5 nym-client: removed the hex crate 2020-01-24 16:45:40 +00:00
Dave Hrycyszyn 398fa5c643 Merge branch 'develop' into feature/base58 2020-01-24 16:40:32 +00:00
Dave Hrycyszyn 559cffdb56 sfw-provider: swapping out base64 for base58 2020-01-24 16:37:35 +00:00
Dave Hrycyszyn da6aac176b nym-client: adding bs58 crate 2020-01-24 16:34:55 +00:00
Dave Hrycyszyn d71d2effe6 topology: removing base64 crate 2020-01-24 16:29:41 +00:00
Dave Hrycyszyn aa7ff75be7 mixnode: replaced base64 with base58 2020-01-24 16:29:02 +00:00
Dave Hrycyszyn 80537045b4 directory-client: fullpath on std::io::Error needed for some reason 2020-01-24 16:22:44 +00:00
Dave Hrycyszyn 8cf37e10ce directory-client: removing unused imports 2020-01-24 16:21:23 +00:00
Dave Hrycyszyn a1af0b9345 directory-client: ripped presence apart a bit 2020-01-24 16:18:22 +00:00
Dave Hrycyszyn ea2be1a7ec Merge pull request #101 from nymtech/feature/panic_improvements
Feature/panic improvements
2020-01-24 16:12:05 +00:00
Dave Hrycyszyn d6ce495e08 git: ignoring local dictionary 2020-01-24 15:42:27 +00:00
Dave Hrycyszyn 0e85f6de0f topology: using base58 for decoding keys 2020-01-24 15:39:27 +00:00
Jedrzej Stuczynski 1b787c94bf Removed unwrap/expect calls wherever feasible and introduced Result types where appropriate 2020-01-24 15:31:40 +00:00
Dave Hrycyszyn a4ead85a01 topology: added bs58 crate 2020-01-24 15:11:16 +00:00
Dave Hrycyszyn d744fa587f topology: removing curve25519_dalek crate, it's no longer needed 2020-01-24 15:11:03 +00:00
Dave Hrycyszyn 0fee2b0ceb Merge branch 'develop' into feature/base58 2020-01-24 15:05:34 +00:00
Dave Hrycyszyn 28d8fbedc9 nym-client: revamped error message in websocket 2020-01-24 14:57:39 +00:00
Dave Hrycyszyn 6fb991a1b0 mixnode: typo fix in comments 2020-01-24 14:54:27 +00:00
Jedrzej Stuczynski d41023d26f Better unwrap usage for nym-client 2020-01-24 14:44:40 +00:00
Jedrzej Stuczynski 0093951507 Improved usage of unwraps and expects for provider 2020-01-24 14:37:36 +00:00
Jedrzej Stuczynski 3db34e7717 typo 2020-01-24 14:14:49 +00:00
Jedrzej Stuczynski 9913f6f041 Additional mixnode error checks 2020-01-24 14:12:41 +00:00
Jedrzej Stuczynski 6f83785b3a Creating mix peer checks for correct address 2020-01-24 14:12:28 +00:00
Jedrzej Stuczynski ce56b525bb socket_address_from_encoded_bytes returning Result 2020-01-24 14:12:07 +00:00
Jedrzej Stuczynski 44e146e2a2 Removed calls to unwrap at mixnode 2020-01-24 14:03:43 +00:00
Jędrzej Stuczyński ef20979753 Merge pull request #100 from nymtech/feature/fix-sphinx-unwraps-65
Feature/fix sphinx unwraps
2020-01-24 13:38:27 +00:00
Dave Hrycyszyn a187399c7d sphinx: gracefully handling packet unwrap failures 2020-01-24 13:17:37 +00:00
Dave Hrycyszyn f5bbfa8975 cargo: updating all crates to use newest Sphinx 2020-01-24 13:17:15 +00:00
Jędrzej Stuczyński 18be267b64 Merge pull request #99 from nymtech/feature/check-packet-length
Feature/check packet length
2020-01-24 13:16:30 +00:00
Dave Hrycyszyn 2d35ec354e Merge branch 'develop' into feature/check-packet-length 2020-01-24 12:57:14 +00:00
Jędrzej Stuczyński b7d8dc4769 Merge pull request #96 from nymtech/feature/version-filtering-improvements
Feature/version filtering improvements
2020-01-24 12:56:02 +00:00
Dave Hrycyszyn 5c1559dd78 nym-client: using the new Sphinx max packet length constant 2020-01-24 12:52:16 +00:00
Dave Hrycyszyn 9dbe74bdb1 topology: renamed filter trait 2020-01-24 12:48:46 +00:00
Dave Hrycyszyn 6e676fc1e4 ibid 2020-01-24 12:38:55 +00:00
Dave Hrycyszyn 94314e332d sphinx: restoring commit version 2020-01-24 12:36:57 +00:00
Dave Hrycyszyn 383539bd25 Merge branch 'develop' into feature/version-filtering-improvements 2020-01-24 12:24:33 +00:00
Dave Hrycyszyn 8510924ebb Merge pull request #94 from nymtech/feature/refreshing_topology
Feature/refreshing topology
2020-01-24 12:13:12 +00:00
Dave Hrycyszyn 772d428158 version-checker: toughened up on version parsing panics 2020-01-24 12:02:01 +00:00
Dave Hrycyszyn 1579aa58d5 version checker: renamed is_compatible() to is_minor_version_compatible() 2020-01-24 11:53:27 +00:00
Dave Hrycyszyn 5e22d3e9a9 topology: get_version() is now version() 2020-01-24 11:48:03 +00:00
Dave Hrycyszyn 6e03375ec7 topology: moved filtering into its own home 2020-01-24 11:47:41 +00:00
Dave Hrycyszyn 4c44df46f8 topology: removing unused PhantomData import 2020-01-24 11:19:09 +00:00
Dave Hrycyszyn af1cdccda2 Using the new topology filter 2020-01-24 11:09:36 +00:00
Dave Hrycyszyn 4cb1719ee4 Back to compiling after some self-experimentation and learning... 2020-01-24 11:03:02 +00:00
Jedrzej Stuczynski 143d45904c missing import 2020-01-23 17:19:40 +00:00
Jedrzej Stuczynski 4a2eab76e7 Decreased log severity for failing to send test packet during healthcheck 2020-01-23 17:19:08 +00:00
Jedrzej Stuczynski d9ac85abb2 Removed hardcoded version numbers 2020-01-23 17:17:28 +00:00
Jedrzej Stuczynski c61b49c353 Corrected warnin message for out queue control 2020-01-23 17:08:26 +00:00
Jedrzej Stuczynski 6348f9e2e1 Merge branch 'develop' into feature/refreshing_topology 2020-01-23 17:00:11 +00:00
Jedrzej Stuczynski 54c244e4ea Everything put together in mod.rs 2020-01-23 16:55:59 +00:00
Jedrzej Stuczynski 6f69641443 Made sockets more generic to work on any NymTopology object 2020-01-23 16:55:39 +00:00
Jedrzej Stuczynski 35451a05de And by real traffic stream + necessary adjustments 2020-01-23 16:55:11 +00:00
Jedrzej Stuczynski 2079b8f926 Said module used by cover traffic stream 2020-01-23 16:54:43 +00:00
Jedrzej Stuczynski 8c26ef848a Created a module responsible for periodically refreshing topology 2020-01-23 16:54:16 +00:00
Jedrzej Stuczynski 52272d6119 Added restriction on NymTopology to require Debug and Send + Sync 2020-01-23 16:53:30 +00:00
Jedrzej Stuczynski e5b3a29c5f Defined ability to compare two 'Topology' instances
The comparison ignores 'last-seen' field or ordering of nodes and
clients
2020-01-23 16:53:02 +00:00
Dave Hrycyszyn dea363e813 Minor docs formatting 2020-01-23 16:26:40 +00:00
Dave Hrycyszyn 2b9ed29ebd Minor smoothing of the README 2020-01-23 16:10:53 +00:00
Dave Hrycyszyn 753ecf6b6a crypto: replaced base64 with bs58 2020-01-23 15:06:10 +00:00
Jędrzej Stuczyński c05ce62df0 Merge pull request #93 from nymtech/feature/consistent-logging
Feature/consistent logging
2020-01-22 18:57:45 +00:00
Jędrzej Stuczyński 8e4027947b Merge pull request #92 from nymtech/feature/semver-client
Feature/semver client
2020-01-22 18:55:22 +00:00
Dave Hrycyszyn b5e2f9fca8 all: adding dotenv to all binary crates 2020-01-22 17:27:30 +00:00
Dave Hrycyszyn 1e8423b339 Started to use logging instead of println 2020-01-22 17:22:03 +00:00
Dave Hrycyszyn ac61196fc6 all: initializing logger at start 2020-01-22 16:34:42 +00:00
Dave Hrycyszyn c592ac6655 project: removing env_logger from the Cargo project file 2020-01-22 16:30:20 +00:00
Dave Hrycyszyn 09cb17e6ab all: using pretty_env_logger pretty much everywhere 2020-01-22 16:29:59 +00:00
Dave Hrycyszyn 65f5683b12 topology: checking for compatible semver between nodes and clients 2020-01-22 16:18:00 +00:00
Dave Hrycyszyn 44116e4907 common: adding a version-checker crate 2020-01-22 16:17:35 +00:00
Dave Hrycyszyn d34907eccf ibid 2020-01-22 12:57:41 +00:00
Dave Hrycyszyn f785637cd5 provider-client: removing unused commands module 2020-01-22 12:57:35 +00:00
Jedrzej Stuczynski 91eb03fbb6 Derived PartialEq on Topology 2020-01-22 12:22:15 +00:00
Jedrzej Stuczynski 566e17719c added PartialEq restriction on NymTopology for convenience sake 2020-01-22 12:22:05 +00:00
Dave Hrycyszyn e93e3e0554 Merge pull request #91 from nymtech/feature/client-refactor
Feature/client refactor
2020-01-22 10:58:12 +00:00
Jedrzej Stuczynski 974ac5ef65 compiler warnings 2020-01-22 10:52:30 +00:00
Jedrzej Stuczynski 7045db7d70 ibid. 2020-01-22 10:50:22 +00:00
Jedrzej Stuczynski 2364fbdc09 Moved sphinx packet encapsulation and poisson delay sampling to mix client 2020-01-22 10:50:03 +00:00
Dave Hrycyszyn 1fbbd7cd70 Merge pull request #89 from nymtech/feature/no_silent_failures
Release builds should no longer silently fail - everything will be im…
2020-01-22 10:41:44 +00:00
Jedrzej Stuczynski b4c15eae12 Sending real traffic at poisson rate rather than at uniform rate 2020-01-21 18:02:35 +00:00
Jedrzej Stuczynski 98610e20dc Removed unused utils/bytes module 2020-01-21 17:50:07 +00:00
Jedrzej Stuczynski da575f3657 ibid 2020-01-21 17:49:48 +00:00
Jedrzej Stuczynski 55e473d04e Moved Pemstore as separate crate + defined pathfinder as trait 2020-01-21 17:46:34 +00:00
Jedrzej Stuczynski ac988c62e9 Removed 'toml' from client-persistence as it will be module-specific 2020-01-21 17:21:02 +00:00
Jedrzej Stuczynski 551d0eb161 More comments regarding uses of specific channels 2020-01-21 17:16:22 +00:00
Jedrzej Stuczynski 2e817a9a6b Comments explaining purposes of different futures 2020-01-21 17:09:28 +00:00
Jedrzej Stuczynski 73438b672a Change in how OutQueueControl is spawned - not entirely sure at this point why its required 2020-01-21 17:09:12 +00:00
Jedrzej Stuczynski c92177402d Implemented OutQueueControl as a proper Stream to get rid of the select! macro 2020-01-21 17:08:19 +00:00
Jedrzej Stuczynski 641dc78903 Removed too aggressive logging 2020-01-21 17:07:21 +00:00
Jedrzej Stuczynski ee812a86c6 Moved definition of extended duration to before the loop 2020-01-21 14:30:17 +00:00
Jedrzej Stuczynski fe48c11cd6 Moved real traffic controller to separate module 2020-01-21 14:29:56 +00:00
Jedrzej Stuczynski a57708d936 Separate module for cover traffic stream 2020-01-21 14:21:41 +00:00
Jedrzej Stuczynski f1debb91c6 Obtaining initial compatible topology in separate method 2020-01-21 13:29:59 +00:00
Jedrzej Stuczynski 06b96bd2c1 Moved provider-polling related functionalities to new module 2020-01-21 13:08:26 +00:00
Jedrzej Stuczynski 7889ab4778 Removed redundant logging statement 2020-01-21 13:07:51 +00:00
Jedrzej Stuczynski 2af18a85e5 Added "is_registered" method to provider client 2020-01-21 12:26:10 +00:00
Jedrzej Stuczynski ea383871ab ReceivedBuffer is now responsible for starting both controllers 2020-01-21 12:02:21 +00:00
Jedrzej Stuczynski e4c7d211b5 Better handling of when messages failed to be sent to the requester
Now rather than causing a panic, they will simply be readded back to the
buffer
2020-01-21 10:50:34 +00:00
Jedrzej Stuczynski af6a8f5546 Better logging for ibid. 2020-01-21 10:49:56 +00:00
Jedrzej Stuczynski e9e5c83ab3 Moved ReceivedMessagesBuffer to seperate module 2020-01-21 10:33:26 +00:00
Jedrzej Stuczynski e57cb4f562 Release builds should no longer silently fail - everything will be immediately stopped on any panic 2020-01-21 10:21:46 +00:00
Jedrzej Stuczynski 6625f6f7fe Slightly decreases the aggressive logging in mix traffic controller 2020-01-21 10:16:43 +00:00
Jedrzej Stuczynski abd88c0c01 Fixed accidentally broken pathfinder 2020-01-21 10:07:22 +00:00
Jedrzej Stuczynski 9f69cc92fe Moved MixTrafficController to separate module 2020-01-21 10:04:20 +00:00
Jedrzej Stuczynski 74aa9b1136 Merge tag 'v0.3.3' into develop
* websocket handling of 'ping', 'pong' and 'close' messages
* websocket not crashing on binary messages
* websocket returning text rather than base64
* restored `nym-client` lib functionality
2020-01-20 17:52:35 +00:00
Jedrzej Stuczynski bec0223899 Merge branch 'release/v0.3.3' 2020-01-20 17:52:22 +00:00
Jedrzej Stuczynski 89087a3dfd Updated changelogs 2020-01-20 17:52:09 +00:00
Jedrzej Stuczynski 2a55f8cd32 Increased version numbers in cargo files 2020-01-20 17:50:05 +00:00
Dave Hrycyszyn a1f91fd676 Merge pull request #88 from nymtech/feature/websocket_improvements
Feature/websocket improvements
2020-01-20 16:52:06 +00:00
Jedrzej Stuczynski 33dafd9bba Websocket handling 'Ping', 'Pong' and 'Close' messages + general improvements
Also fixes https://github.com/nymtech/nym/issues/56
2020-01-20 16:49:13 +00:00
Jędrzej Stuczyński e098445588 Merge pull request #87 from nymtech/feature/cleanup-client-start
Using println rather than log for startup banner, it's not an error
2020-01-20 16:47:00 +00:00
Jedrzej Stuczynski 35086ec63e Checking for plaintext length before sending it to nym-client 2020-01-20 16:46:52 +00:00
Dave Hrycyszyn d66cf696fe Merge branch 'develop' into feature/cleanup-client-start 2020-01-20 16:46:45 +00:00
Jedrzej Stuczynski fbb0f2485f Removing some print statements in favour of log 2020-01-20 16:44:57 +00:00
Dave Hrycyszyn 5c95a70aaf nym-client: removing unused import 2020-01-20 16:44:19 +00:00
Dave Hrycyszyn 2e6aaf16d3 Merge pull request #61 from nymtech/feature/nym_client_lib
Feature/nym client lib
2020-01-20 15:42:14 +00:00
Dave Hrycyszyn dbc6365749 Using println rather than log for startup banner, it's not an error 2020-01-20 15:27:35 +00:00
Dave Hrycyszyn c9d632c8b6 Update README.md 2020-01-20 14:59:34 +00:00
Dave Hrycyszyn bed1a33e68 readme: noted existence of validator node in new code 2020-01-20 14:46:42 +00:00
Dave Hrycyszyn d4ed8cbeaa Merge branch 'develop' of github.com:nymtech/nym into develop 2020-01-20 14:46:15 +00:00
Jedrzej Stuczynski dc64921e0e Removed commented code 2020-01-20 11:13:24 +00:00
Jedrzej Stuczynski bce448937b Fixes #55 2020-01-20 11:12:51 +00:00
Jedrzej Stuczynski 32a978d932 Removed call to 'banner' from external modules 2020-01-20 10:32:07 +00:00
Jedrzej Stuczynski 3737c535ff Moved built_info to module in separate file 2020-01-20 10:31:49 +00:00
Jedrzej Stuczynski 58b8bc1a68 lib definition in cargo.toml 2020-01-20 10:31:18 +00:00
Jedrzej Stuczynski 1357ae8ff1 Updated tokio-tungstenite dependency to point to the main repo 2020-01-17 14:13:04 +00:00
Jedrzej Stuczynski b9a6f63cfa Merge tag 'v0.3.2' into develop
v0.3.2
2020-01-17 13:15:49 +00:00
Jedrzej Stuczynski fe88e20350 Merge branch 'release/v0.3.2' 2020-01-17 13:15:31 +00:00
Jedrzej Stuczynski aaa8e54c80 Updated changelogs 2020-01-17 13:15:20 +00:00
Jedrzej Stuczynski 766dbee75a Updated version numbers 2020-01-17 13:12:22 +00:00
Dave Hrycyszyn 2e2c90983a Merge pull request #59 from nymtech/feature/separate_presence_address
Feature/separate presence address
2020-01-17 13:10:53 +00:00
Jedrzej Stuczynski 518244f6bf presence client: conversion of MixNodePresence into topology::MixNode returns a Result 2020-01-17 13:07:54 +00:00
Jedrzej Stuczynski 809db67efd nym-client: resolving dns names to ips 2020-01-17 12:35:04 +00:00
Jedrzej Stuczynski ac79a0da69 mixnode: changed announce address from SocketAddr to String 2020-01-17 12:21:26 +00:00
Dave Hrycyszyn 45033fbeae Merge branch 'develop' of github.com:nymtech/nym into develop 2020-01-17 12:20:55 +00:00
Jedrzej Stuczynski 1769fa8a5a mixnode: added announce-host and announce-port arguments 2020-01-17 11:59:59 +00:00
Jedrzej Stuczynski 4cc7fc309b Fixed run local network script 2020-01-17 11:44:24 +00:00
Jedrzej Stuczynski f966df4fb1 Additional healthcheck logging 2020-01-17 11:44:08 +00:00
Dave Hrycyszyn ff141a5d47 travis: adding cargo fmt check to build server 2020-01-16 19:06:15 +00:00
Jedrzej Stuczynski 781c4c551d Fixed incorrect hashmap reads in healtcheck 2020-01-16 18:14:53 +00:00
Jedrzej Stuczynski ac0566aa17 Merge tag '0.3.1' into develop
0.3.1
2020-01-16 15:04:12 +00:00
Jedrzej Stuczynski 66b2429b2e Merge branch 'release/0.3.1' 2020-01-16 15:04:03 +00:00
Jedrzej Stuczynski 325670e540 Changelogs 2020-01-16 15:03:55 +00:00
Jedrzej Stuczynski 8d84523c32 Increased version numbers in cargo files 2020-01-16 15:01:34 +00:00
Jedrzej Stuczynski 851082dc6e Cargo.lock updates 2020-01-16 14:59:04 +00:00
Jedrzej Stuczynski dcb548ee8e Updated sample validator config to point to the qa mixnet 2020-01-16 14:58:55 +00:00
Dave Hrycyszyn 330e7d8d29 Merge pull request #58 from nymtech/bugfix/presence_client_crash
Bugfix/presence client crash
2020-01-16 14:55:58 +00:00
Jedrzej Stuczynski 3ab4b94a8a Provider no longer crashing when failed to send presence 2020-01-16 13:44:39 +00:00
Jedrzej Stuczynski 09e88da1a9 Mixnode no longer crashing when failed to send metrics or presence 2020-01-16 13:42:50 +00:00
Jedrzej Stuczynski 773fbceff7 Unused import 2020-01-16 13:37:12 +00:00
Jedrzej Stuczynski 84e2292ed0 Moved mix presence reporting from std::thread to tokio task 2020-01-16 13:29:00 +00:00
Jedrzej Stuczynski 59ea4306b8 Merge branch 'release/0.3.0' 2020-01-14 15:04:39 +00:00
Jedrzej Stuczynski b1edf54403 Updated version numbers 2020-01-14 15:04:17 +00:00
Jedrzej Stuczynski a0654b9b59 Updated changelogs 2020-01-14 15:04:00 +00:00
Jedrzej Stuczynski fe35bcbe1c Printing binding warning for provider 2020-01-14 14:57:24 +00:00
Dave Hrycyszyn fcf11a1c36 Merge pull request #54 from nymtech/feature/client_topology_filtering
Feature/client topology filtering
2020-01-14 14:40:57 +00:00
Dave Hrycyszyn 05db16677d clients: knocking 0-scored nodes out of the effective topology 2020-01-14 14:40:37 +00:00
Dave Hrycyszyn 330cfdc259 rustfmt 2020-01-14 14:39:25 +00:00
Dave Hrycyszyn 6cad7bcbef cargo: health check added to cargo.lock 2020-01-14 14:39:15 +00:00
Dave Hrycyszyn bf9463b24a Merge pull request #52 from nymtech/feature/mix_warning
Showing binding warning on binding to localhost, 0.0.0.0 or 127.0.0.1
2020-01-14 13:58:00 +00:00
Jędrzej Stuczyński d69603f87b Merge pull request #53 from mileschet/client-pubkey
print public key for nym client tools
2020-01-14 13:55:32 +00:00
Jedrzej Stuczynski 173daa7305 Fixed broken test 2020-01-14 13:47:47 +00:00
Jedrzej Stuczynski b9c37f2845 Removed unused typ() method on NodeScore 2020-01-14 12:50:30 +00:00
Roberto Santacroce Martins 8237f5d885 changed the place for print the public key 2020-01-14 13:48:08 +01:00
Jedrzej Stuczynski 76432cf253 Client obtaining healthy topology on startup 2020-01-14 12:41:38 +00:00
Jedrzej Stuczynski c1c41ebde1 Moved built_info module definition to top of file 2020-01-14 12:40:46 +00:00
Jedrzej Stuczynski 9082e93826 Helper function to determine if any path can be constructred through topology 2020-01-14 12:40:25 +00:00
Jedrzej Stuczynski 63cebd27cd Filtering topology by node version 2020-01-14 12:40:04 +00:00
Jedrzej Stuczynski 505a0bd0b0 Ability to filter topolgy by predefined node score threshold 2020-01-14 12:39:37 +00:00
Jedrzej Stuczynski fb6ec68046 Calculating node score in separate method 2020-01-14 12:38:54 +00:00
Jedrzej Stuczynski 5121e2fb0c Added node type enum to NodeScore 2020-01-14 12:38:40 +00:00
Jedrzej Stuczynski 25c9ee5b3c Defined std::error::Error for HealthCheckerError 2020-01-14 12:35:20 +00:00
Jedrzej Stuczynski a6014a6ad5 Formatting 2020-01-14 12:33:31 +00:00
Jedrzej Stuczynski ea7a5cf044 Fixed bug in converting MixNode to MixNodePresence 2020-01-14 12:33:13 +00:00
Jedrzej Stuczynski cef1568e33 Removed nym-client lib definition 2020-01-14 12:30:53 +00:00
Jedrzej Stuczynski 315ece38ae Temporarily moved healthcheck from validator to separate common crate 2020-01-14 10:44:05 +00:00
Jedrzej Stuczynski 6fbc6c6680 Renamed version filtering 2020-01-14 10:30:20 +00:00
Jedrzej Stuczynski 7895eb8c38 Initial topology version filtering 2020-01-14 10:28:48 +00:00
Jedrzej Stuczynski 164ebf47be From nymtopology nodes for prence topology 2020-01-14 10:26:54 +00:00
Roberto Santacroce Martins 1c85ba266f print public key for nym client tools 2020-01-14 11:19:11 +01:00
Jedrzej Stuczynski e34a55c60a Separated versions for mixes, providers and coco nodes for filtering 2020-01-14 10:12:26 +00:00
Jedrzej Stuczynski 9bd4c49be9 Default implementation for filtering topology by node versions 2020-01-14 10:10:55 +00:00
Jedrzej Stuczynski c1eb553cc0 Derived clone trait for Topology node types 2020-01-14 10:10:29 +00:00
Jedrzej Stuczynski 04f11ecafa Added version to topology for coconodes 2020-01-14 10:10:05 +00:00
Jedrzej Stuczynski 2d7fff06fe Showing binding warning on binding to localhost, 0.0.0.0 or 127.0.0.1 2020-01-14 09:54:16 +00:00
Dave Hrycyszyn 1d2481e558 whitespace 2020-01-13 18:26:45 +00:00
Dave Hrycyszyn 19dff546b4 readme: typo fix 2020-01-13 18:26:37 +00:00
Dave Hrycyszyn 507e910e72 Pulled nym-client binary out to top-level 2020-01-13 18:25:05 +00:00
Jędrzej Stuczyński 6b68998e93 Merge pull request #51 from nymtech/feature/validator-config-sample
validator: moving sample config files into sample configs directory
2020-01-13 18:02:51 +00:00
Dave Hrycyszyn aad70d65b8 validator: moving sample config files into sample configs directory 2020-01-13 18:00:35 +00:00
Dave Hrycyszyn f670c7f58f Merge pull request #50 from nymtech/feature/validator_health_checker
Feature/validator health checker
2020-01-13 17:57:26 +00:00
Dave Hrycyszyn 3ec3b4a793 Merge branch 'develop' into feature/validator_health_checker 2020-01-13 17:57:06 +00:00
Dave Hrycyszyn d92cee59a0 validator: removing scary comment in main() 2020-01-13 17:36:30 +00:00
Dave Hrycyszyn 350eeae8da README: adding a note about .env file 2020-01-13 17:35:39 +00:00
Dave Hrycyszyn 40fee72161 .env: ignoring the .env file and providing a sample 2020-01-13 17:33:33 +00:00
Jedrzej Stuczynski 51d802d1c7 Provider related compiler warnings 2020-01-13 17:03:32 +00:00
Jedrzej Stuczynski ee32b97fbb Compiler warning 2020-01-13 17:01:05 +00:00
Jedrzej Stuczynski ee1a0033ac Sorting NodeScores before printing 2020-01-13 16:54:58 +00:00
Jedrzej Stuczynski a615dacf64 Defined Ord (+ required traits) for NodeScore 2020-01-13 16:54:40 +00:00
Jedrzej Stuczynski 34de9cc10b Another sphinx revision update 2020-01-13 16:50:10 +00:00
Jedrzej Stuczynski 03d04d5aa7 Updated used sphinx revision 2020-01-13 15:49:55 +00:00
Jedrzej Stuczynski 05ca3e147f Using the new updated healthchecker 2020-01-13 15:26:12 +00:00
Jedrzej Stuczynski 0b1bae6ea1 Formatting 2020-01-13 15:25:52 +00:00
Jedrzej Stuczynski c056485471 resolving all available paths 2020-01-13 15:25:31 +00:00
Jedrzej Stuczynski d152d0fd12 Sending all tests packets before trying to resolve them 2020-01-13 15:25:02 +00:00
Jedrzej Stuczynski 5bc5974bdb Conversion of vec of pub keys into unique path id and vice verse 2020-01-13 15:23:56 +00:00
Jedrzej Stuczynski 5e870e4c8a ibid. 2020-01-13 15:23:20 +00:00
Jedrzej Stuczynski 8178d505c3 PathChecker holding mapping of paths to their statuses 2020-01-13 15:23:06 +00:00
Jedrzej Stuczynski 78a52df0ec Assertion on maximum number of iterations 2020-01-13 15:22:26 +00:00
Jedrzej Stuczynski 0ecab55959 Added itertools 2020-01-13 15:21:28 +00:00
Jedrzej Stuczynski b3f056b933 More informative error message 2020-01-13 15:20:47 +00:00
Jedrzej Stuczynski 520973b578 Using resolution timeout as part of healtchecker 2020-01-13 15:20:33 +00:00
Jedrzej Stuczynski d4ab7f96f1 Separated increasing packet count into explicit sent and received 2020-01-13 15:19:47 +00:00
Jedrzej Stuczynski 911ab8ff4c Added resolution timeout to healthcheck config 2020-01-13 10:58:55 +00:00
Jedrzej Stuczynski 9596060972 Provider no longer printing string message that its storing 2020-01-10 16:56:32 +00:00
Jedrzej Stuczynski 4b7971899c Actually sending test packets through network (not retrieving status yet) 2020-01-10 16:54:49 +00:00
Jedrzej Stuczynski 6eeedf858d decreased default logging level 2020-01-10 16:54:28 +00:00
Jedrzej Stuczynski 7045d76039 Using correct case for existence in hashmap 2020-01-10 16:09:22 +00:00
Jedrzej Stuczynski 90266175a1 Removed some unused imports 2020-01-10 16:06:41 +00:00
Jedrzej Stuczynski c810d0d957 Async registration at all available providers 2020-01-10 16:05:55 +00:00
Jedrzej Stuczynski a4990f1944 Added to bytes conversion of node keys for topology 2020-01-10 16:05:31 +00:00
Jedrzej Stuczynski 52054f8b46 PathChecker constructor returning result type 2020-01-10 15:25:07 +00:00
Jedrzej Stuczynski 489c806292 Split healthchecker into multiple files 2020-01-10 15:20:49 +00:00
Jędrzej Stuczyński db69105813 Merge pull request #49 from nymtech/feature/better-socket-errors
Improving websocket connection errors
2020-01-10 15:05:15 +00:00
Dave Hrycyszyn d39e532e4b Improving websocket connection errors 2020-01-10 15:01:36 +00:00
Jedrzej Stuczynski 25575b4598 Running healthcheck specified number of times 2020-01-10 15:01:12 +00:00
Jedrzej Stuczynski 769598d40a Added layer information to healthcheck 2020-01-10 14:56:50 +00:00
Jedrzej Stuczynski 227f69befb Fixed compilation errors 2020-01-10 14:50:30 +00:00
Jedrzej Stuczynski 9d760a515a Updated sphinx revision 2020-01-10 14:42:10 +00:00
Dave Hrycyszyn 26663100b4 Removed duplicate build instructions in favour of a pointer to the docs site. 2020-01-10 14:41:17 +00:00
Jedrzej Stuczynski 7f6ec5ecdf Merge branch 'develop' into feature/validator_health_checker 2020-01-10 14:38:59 +00:00
Dave Hrycyszyn a58c3dbb25 travis: it's no longer necessary to grab Sphinx separately 2020-01-10 14:23:34 +00:00
Dave Hrycyszyn be0616b524 cargo: pinning Sphinx to a specific rev to get rid of build flapping 2020-01-10 14:23:09 +00:00
Dave Hrycyszyn 92390f9ad7 cargo: lockfile change 2020-01-10 14:18:19 +00:00
Dave Hrycyszyn 3e9221f6af Merge pull request #48 from nymtech/feature/crypto_crate
Feature/crypto crate
2020-01-10 14:16:10 +00:00
Jedrzej Stuczynski 1ad651fe72 Updated comments regarding DummyMix pair 2020-01-10 14:14:59 +00:00
Jedrzej Stuczynski e4501852d5 Made curve generator private 2020-01-10 14:12:29 +00:00
Jedrzej Stuczynski 402b226080 Updated depenencies 2020-01-10 13:53:10 +00:00
Jedrzej Stuczynski c772b9a4df Same for request handling + removed dependency on entiry nym-client 2020-01-10 13:53:01 +00:00
Jedrzej Stuczynski 95cd4123b5 Ibid for provider presence 2020-01-10 13:52:38 +00:00
Jedrzej Stuczynski 4164491bc2 Provider using new key types 2020-01-10 13:52:28 +00:00
Jedrzej Stuczynski 0492a21bcf Easier conversion of keypairs from bytes 2020-01-10 13:51:50 +00:00
Jedrzej Stuczynski 50d54d44c7 ibid. for sockets 2020-01-10 13:51:32 +00:00
Jedrzej Stuczynski 1cc1d2ddf9 client init using new key structure 2020-01-10 13:51:20 +00:00
Jedrzej Stuczynski 0dda60cd81 ibid 2020-01-10 13:51:03 +00:00
Jedrzej Stuczynski 114c927028 removed identity client crate 2020-01-10 13:50:57 +00:00
Jedrzej Stuczynski e18ed7e0fd More generic client pem store 2020-01-10 13:50:47 +00:00
Jedrzej Stuczynski 3e533cdee2 ibid for identity keys 2020-01-10 13:50:32 +00:00
Jedrzej Stuczynski 6e3b2c36fe encryption keys now need to implement PemStorable 2020-01-10 13:49:44 +00:00
Jedrzej Stuczynski 73028f85a9 Defined trait for returning key pem type 2020-01-10 13:49:00 +00:00
Jedrzej Stuczynski d0d894a309 Implementing said traits on dummy struct using x25519 2020-01-10 11:50:48 +00:00
Jedrzej Stuczynski db92f898d3 MixnetIdentity Key traits 2020-01-10 11:50:30 +00:00
Jedrzej Stuczynski 740a2fb2ff X25519 impl of said traits 2020-01-10 11:50:12 +00:00
Jedrzej Stuczynski 84e34e5490 MixnetEncryption Key traits 2020-01-10 11:50:03 +00:00
Jedrzej Stuczynski 2a05d77d94 Initial crypto crate 2020-01-10 11:49:49 +00:00
Dave Hrycyszyn 97d7f6d7cb README: drying up the build and usage instructions a bit 2020-01-10 11:35:05 +00:00
Jedrzej Stuczynski 4f23d7e58b Fixed author strings for other common crates 2020-01-10 10:09:18 +00:00
Jedrzej Stuczynski ccf1e6fe1a Fixed root cargo file 2020-01-10 10:07:01 +00:00
Jedrzej Stuczynski 7068dc7089 Fixed compilation errors due to changes in sphinx crate 2020-01-10 10:05:01 +00:00
Jedrzej Stuczynski 7f6f366e51 Logic for calculating health 2020-01-09 18:01:28 +00:00
Jedrzej Stuczynski 4d997ef03b Using new methods on NodeAddressBytes from sphinx 2020-01-09 17:17:50 +00:00
Jedrzej Stuczynski 65042e7210 Storing node key as bytes rather than string 2020-01-09 16:42:15 +00:00
Jedrzej Stuczynski 89e17b0ffa Added number of test packets to healthcheck config 2020-01-09 16:30:56 +00:00
Jedrzej Stuczynski 6e52afef79 Method for modyfing node score count of packets sent and received 2020-01-09 16:26:01 +00:00
Jedrzej Stuczynski a37d9aedc4 Changed NodeScore constructors 2020-01-09 16:24:29 +00:00
Jedrzej Stuczynski fbd1f05eb9 Moved score calculation to HealthCheckResult 2020-01-09 16:21:11 +00:00
Jedrzej Stuczynski 3efbea8263 error log on failure to format addresses 2020-01-09 16:17:47 +00:00
Jedrzej Stuczynski 582c8dbc98 Printing formatted zero health node status 2020-01-09 16:16:42 +00:00
Jedrzej Stuczynski 1e0d84fb8b Healthcheck getting new topology every run 2020-01-09 15:07:23 +00:00
Jedrzej Stuczynski ca2faf0095 Required dependency for ibid. 2020-01-09 15:06:59 +00:00
Jedrzej Stuczynski e0c110ee55 Generating all possible paths from topology 2020-01-09 15:06:44 +00:00
Jedrzej Stuczynski db2f803023 Making use of the code simplification 2020-01-09 15:03:24 +00:00
Jedrzej Stuczynski d7f444c659 simplified mix_route by using the traits 2020-01-09 15:02:31 +00:00
Jedrzej Stuczynski 3b7f5c7c68 semicolon 2020-01-09 15:01:59 +00:00
Jedrzej Stuczynski 3072d56417 Into SphinxNode trait for ProviderNode 2020-01-09 15:01:41 +00:00
Jedrzej Stuczynski 59bff7a0d5 Into SphinxNode trait for MixNode 2020-01-09 15:01:27 +00:00
Jedrzej Stuczynski fadd781fc3 comment regarding future work 2020-01-09 15:00:24 +00:00
Jedrzej Stuczynski b5518babac Constructor for directory client config 2020-01-09 14:35:41 +00:00
Jędrzej Stuczyński cd28f8051b Merge pull request #43 from nymtech/feature/chill-log-messages
Feature/chill log messages
2020-01-09 13:15:47 +00:00
Dave Hrycyszyn 4966d8ecef Update README.md 2020-01-09 12:36:18 +00:00
Dave Hrycyszyn 3b7d22e675 clients: set up a logger to chill out output 2020-01-09 12:30:35 +00:00
Jędrzej Stuczyński 6ceec8e737 Merge pull request #42 from nymtech/feature/improve-pemstore-errors
persistence: improving PEM file reading and parsing failure messages
2020-01-09 12:27:55 +00:00
Dave Hrycyszyn 077c59f761 sfw-provider: moving test filesystem output to /tmp 2020-01-09 11:39:56 +00:00
Dave Hrycyszyn fd9829bedd persistence: improving PEM file reading and parsing failure messages 2020-01-09 10:48:36 +00:00
Jędrzej Stuczyński 1d79c43782 Merge pull request #39 from nymtech/feature/remove-run
Removing the run command from code and documentation
2020-01-09 10:18:51 +00:00
Dave Hrycyszyn c029117674 Merge branch 'develop' into feature/remove-run 2020-01-09 10:03:55 +00:00
Jędrzej Stuczyński ac78e160df Merge pull request #41 from nymtech/feature/better-error-message-for-bad-topology
Providing a nicer error than "failed on unwrap()" when topology retri…
2020-01-09 10:01:58 +00:00
Jędrzej Stuczyński eb75362307 Merge pull request #40 from nymtech/feature/provider-banner
Prettying up sfw-provider start sequence a bit.
2020-01-09 10:01:28 +00:00
Dave Hrycyszyn 6c3e7b6256 nym-client: taking run right out of circulation 2020-01-08 19:33:14 +00:00
Dave Hrycyszyn 7a3d61374f Providing a nicer error than "failed on unwrap()" when topology retrieval fails 2020-01-08 18:53:12 +00:00
Dave Hrycyszyn ec78c45ea0 Prettying up sfw-provider start sequence a bit. 2020-01-08 18:32:41 +00:00
Dave Hrycyszyn 1337f93c33 Removing the run command from code and documentation 2020-01-08 18:00:07 +00:00
Jedrzej Stuczynski 1f3875f39c Using ibid. in client code 2020-01-08 17:17:25 +00:00
Jedrzej Stuczynski f735befd52 Create 'route_to' function 2020-01-08 17:17:10 +00:00
Jedrzej Stuczynski 2a9e21538f Moved make layered topology to separate function + validation 2020-01-08 17:16:26 +00:00
Jedrzej Stuczynski 8ac1e58ef6 Fixed teammate's typo :) 2020-01-08 17:15:09 +00:00
Jedrzej Stuczynski c97b1b5edf Merge branch 'develop' into feature/validator_health_checker 2020-01-08 16:41:13 +00:00
Dave Hrycyszyn e773b251b9 Fixed tests. 2020-01-08 16:33:12 +00:00
Dave Hrycyszyn 9c8347aa72 Fixing compilation to handle new provider listener split fields 2020-01-08 16:25:16 +00:00
Dave Hrycyszyn fcaa23fd77 Re-arranged client directories 2020-01-08 16:22:03 +00:00
Jędrzej Stuczyński 5fa3eb35e4 Merge pull request #37 from nymtech/feature/script/localnet
Feature/script/localnet
2020-01-08 15:56:17 +00:00
Dave Hrycyszyn 67a900701e Updated script copyright date 2020-01-08 15:56:01 +00:00
Dave Hrycyszyn 8314d647d9 script: proper invocation for testnet runnign 2020-01-08 15:53:27 +00:00
Dave Hrycyszyn b88ca3ed91 script: killing old testnet processes in case they're already running 2020-01-08 15:53:11 +00:00
Dave Hrycyszyn ee43e82235 Removing unused import 2020-01-08 15:52:51 +00:00
Dave Hrycyszyn ce866bd987 Setting a 0.1 second average delay time. 2020-01-08 15:52:35 +00:00
Dave Hrycyszyn 95f103b4fd scripts: local network now runs 2020-01-08 15:13:30 +00:00
Dave Hrycyszyn 5ad6db9232 removed commented logging code 2020-01-08 14:58:18 +00:00
Dave Hrycyszyn c1cd6557eb whitespace 2020-01-08 14:58:03 +00:00
Dave Hrycyszyn 8c3cbe6646 Split provider host/ports for mixnet listener and clients listener 2020-01-08 14:57:55 +00:00
Dave Hrycyszyn add94ed70a Merge branch 'develop' of github.com:nymtech/nym into feature/script/localnet 2020-01-08 14:18:57 +00:00
Dave Hrycyszyn 6fe9dc899b Merge pull request #36 from nymtech/feature/arguments_fix
Feature/arguments fix
2020-01-08 14:17:54 +00:00
Jedrzej Stuczynski 6fedba093b Explicitly required values for mixHost and clientHost by clap 2020-01-08 14:17:16 +00:00
Jedrzej Stuczynski fb15c636eb Correct version for mix 2020-01-08 14:17:02 +00:00
Dave Hrycyszyn 043403b1e0 Merge branch 'develop' into feature/script/localnet 2020-01-08 14:10:49 +00:00
Dave Hrycyszyn 13eda7f68f Merge pull request #34 from nymtech/feature/crates_cleanup
Feature/crates cleanup
2020-01-08 13:56:04 +00:00
Jedrzej Stuczynski 9b94b1d72b Fixed broken directory client tests 2020-01-08 13:05:01 +00:00
Jedrzej Stuczynski 07db413f2c Possibly gotten rid of compiler warnings 2020-01-08 12:59:29 +00:00
Jedrzej Stuczynski db67744b19 Further topology cleanup by defining NymTopology trait 2020-01-08 12:55:40 +00:00
Jedrzej Stuczynski 1292cdb145 Moved topology to separate crate 2020-01-08 12:07:34 +00:00
Jedrzej Stuczynski 7fa42d16eb Moved addressing to separate crate and removed mixnode dependency on entire client crate 2020-01-08 12:02:18 +00:00
Jedrzej Stuczynski a673f9f206 Fixed authors strings 2020-01-08 11:50:58 +00:00
Jedrzej Stuczynski 8706f7ed06 Moved provider client to separate crate 2020-01-08 11:48:49 +00:00
Jedrzej Stuczynski 883ce22c5b Moved mix client to separate crate 2020-01-08 11:45:43 +00:00
Jedrzej Stuczynski 9ba1ea203b Moved directory client to separate crate 2020-01-08 11:34:39 +00:00
Jedrzej Stuczynski 2cef804a34 Allowed for calling get_topology from outside the crate 2020-01-08 10:13:26 +00:00
Jedrzej Stuczynski 46ce9eaff7 Made healthcheck async and repeating and action at config-specified interval 2020-01-08 10:06:36 +00:00
Jedrzej Stuczynski d4cba72118 Added interval to healthcheck config 2020-01-08 10:02:13 +00:00
Jedrzej Stuczynski 708d6d5aed Changed default validator config to use localhost directory 2020-01-08 09:57:24 +00:00
Jedrzej Stuczynski ff7af13080 Added futures and tokio to the validator 2020-01-08 09:57:10 +00:00
Jedrzej Stuczynski f325ea6b92 Creating and running healthchecker instance 2020-01-08 09:51:51 +00:00
Dave Hrycyszyn d42a75cea9 scripts: run_local_network.sh port of the old Go code
Currently non-functional
2020-01-07 19:10:46 +00:00
Jedrzej Stuczynski f4d4556ced initial changelog (to be updated before actual release) 2020-01-07 17:49:15 +00:00
Jedrzej Stuczynski d79d57fcaa updated cargo.lock 2020-01-07 17:49:04 +00:00
Jedrzej Stuczynski 9712322597 sample config 2020-01-07 17:48:54 +00:00
Jedrzej Stuczynski e3038b2b57 missing imports + dependencies 2020-01-07 17:48:47 +00:00
Jedrzej Stuczynski ba1ebd18e0 initial healthcheck 2020-01-07 17:48:33 +00:00
Jedrzej Stuczynski 9c70c64825 missing build.rs file 2020-01-07 17:48:14 +00:00
Jedrzej Stuczynski ddc988a10d reading .env file with logging level 2020-01-07 17:48:04 +00:00
Jedrzej Stuczynski aa4d759c38 logging 2020-01-07 17:47:45 +00:00
Jedrzej Stuczynski d94dcea7ee actual config definition 2020-01-07 17:47:18 +00:00
Jedrzej Stuczynski 3d98ed7b6c obtaining config file location from arguments and parsing 2020-01-07 17:46:52 +00:00
Dave Hrycyszyn 18ac7e90ed travis: moving the build image down a bit 2020-01-07 15:49:13 +00:00
Dave Hrycyszyn b04b62ed27 travis: adding build status 2020-01-07 15:48:06 +00:00
Dave Hrycyszyn 4066b4db42 travis: even more cowbell 2020-01-07 15:44:29 +00:00
Dave Hrycyszyn 037f05f323 travis: more cowbell 2020-01-07 15:41:19 +00:00
Dave Hrycyszyn 3f358a6929 travis: more travis 2020-01-07 15:39:49 +00:00
Dave Hrycyszyn e79a63588a more travis experimentation 2020-01-07 15:38:17 +00:00
Dave Hrycyszyn 60f15d57bd Let's see what's going on 2020-01-07 15:36:26 +00:00
Dave Hrycyszyn e422ce0a13 travis: maybe a branch problem? 2020-01-07 15:33:22 +00:00
Dave Hrycyszyn 598d68a822 travis: fixing Sphinx dir path 2020-01-07 15:30:53 +00:00
Dave Hrycyszyn f3900f3659 travis: clone Sphinx first to make the build work 2020-01-07 15:26:31 +00:00
Dave Hrycyszyn fa2d881442 Linking the Sphinx repo properly 2020-01-07 15:19:48 +00:00
Dave Hrycyszyn 435b7ae7e9 Adding a Travis build file 2020-01-07 15:14:06 +00:00
Dave Hrycyszyn 950a1ec0f8 Merge pull request #25 from nymtech/features/version_number_to_presence
Features/version number to presence
2020-01-07 15:11:23 +00:00
aniampio b483e15d5d Add version for the provider 2020-01-07 14:34:04 +00:00
Jedrzej Stuczynski 4d67d11a39 Initialised crate for the validator with health checker 2020-01-07 14:29:22 +00:00
Jedrzej Stuczynski 1e719a8861 Updated Readme 2020-01-07 13:57:58 +00:00
Jedrzej Stuczynski d856911a1d Created top level cargo workspace 2020-01-07 13:57:49 +00:00
aniampio d50666df0c Add version to MixNodePresence struct 2020-01-07 13:46:14 +00:00
Dave Hrycyszyn f6bf239cc2 Merge branch 'develop' of github.com:nymtech/nym into develop 2020-01-07 13:36:26 +00:00
Dave Hrycyszyn bd5c1dd357 Small docs change. 2020-01-07 13:35:39 +00:00
Dave Hrycyszyn 8a558746fe Merge pull request #7 from nymtech/feature/minor-client-changes
Feature/minor client changes
2020-01-07 12:49:32 +00:00
Jedrzej Stuczynski df23148ccf Changes in cargo.lock files 2020-01-07 12:39:51 +00:00
Jedrzej Stuczynski cf62a7ba12 Killing application on possible yet undetected bug + minor improvements in select! macro loop 2020-01-07 12:39:18 +00:00
Jedrzej Stuczynski bfad7d1087 Temporarily increased recursion limit 2020-01-07 12:38:11 +00:00
Jedrzej Stuczynski 71d23f44c2 Clap using cargo.toml version 2020-01-07 12:37:40 +00:00
Dave Hrycyszyn f57e485ceb Fleshing out the README 2020-01-07 12:30:43 +00:00
Dave Hrycyszyn 0531b716cc Setting up all paths so that builds work 2020-01-07 12:30:30 +00:00
Dave Hrycyszyn bfb91c58c8 Ditching .idea folder 2020-01-07 12:09:50 +00:00
Dave Hrycyszyn 57eab1bc85 Merge branch 'master' of github.com:nymtech/nym 2020-01-07 12:06:45 +00:00
Dave Hrycyszyn 6fb438a994 Added a README 2020-01-07 12:04:35 +00:00
Dave Hrycyszyn 23e0aee0a1 Moved nym-sfw-provider into sfw-provider directory 2020-01-07 12:03:07 +00:00
Dave Hrycyszyn 2f98568edf Merge remote-tracking branch 'nym-sfw-provider/master' 2020-01-07 12:02:20 +00:00
Dave Hrycyszyn 2b2bd5b688 Moved nym-mixnode into mixnode directory 2020-01-07 12:00:59 +00:00
Dave Hrycyszyn d05924e070 Merge remote-tracking branch 'nym-mixnode/master' 2020-01-07 12:00:16 +00:00
Dave Hrycyszyn e02c90457e Moving nym-client into the client directory 2020-01-07 11:58:42 +00:00
Dave Hrycyszyn 6f3d7b8f49 Initial commit 2020-01-07 11:42:54 +00:00
Dave Hrycyszyn 712ca4bbb2 Merge branch 'release/0.2.0' 2020-01-06 18:01:57 +00:00
Dave Hrycyszyn 62b137b3b9 Fixed up Authors file. Ania next. 2020-01-06 18:01:32 +00:00
Dave Hrycyszyn 6b508e829f Changelog for 0.2.0 2020-01-06 18:01:16 +00:00
Dave Hrycyszyn 4e7bd2d88f Merge pull request #27 from nymtech/feature/arguments_changes
Feature/arguments changes
2020-01-06 17:56:19 +00:00
Dave Hrycyszyn b584316caa Merge branch 'release/0.2.0' 2020-01-06 17:43:35 +00:00
Dave Hrycyszyn 220ef1b0ef Version number bump 2020-01-06 17:43:12 +00:00
Dave Hrycyszyn 38e747104e Added the glorious and talented Jędrzej Stuczyński to authors 2020-01-06 17:42:44 +00:00
Dave Hrycyszyn 4fc2e3bc0d Changelog for 0.2.0 release 2020-01-06 17:42:04 +00:00
Jedrzej Stuczynski 7f3ea6af1a Changelog file 2020-01-06 15:26:43 +00:00
Jedrzej Stuczynski fc7635dc27 Changelog file 2020-01-06 15:26:31 +00:00
Jędrzej Stuczyński e8b6cabfe3 Merge pull request #26 from nymtech/feature/built-versions
Added build info to the provider
2020-01-06 14:57:58 +00:00
Jedrzej Stuczynski d29ea67f9b Explicitly required values for mixHost and clientHost 2020-01-06 14:57:19 +00:00
Jedrzej Stuczynski c241ecfa36 Removed local flag and replaced it with explicit directory server 2020-01-06 14:56:36 +00:00
Dave Hrycyszyn 3553f88909 Added build info to the provider 2020-01-06 14:54:04 +00:00
Dave Hrycyszyn 6f5b44d016 Merge pull request #23 from nymtech/feature/ipv6_addressing
ipv6_addressing
2020-01-06 14:45:18 +00:00
Jedrzej Stuczynski d5a0e7d355 ipv6_addressing 2020-01-06 14:43:19 +00:00
Dave Hrycyszyn c3ce96afe9 Merge pull request #22 from nymtech/feature/flags-cleanup
Feature/flags cleanup
2020-01-06 12:24:24 +00:00
Dave Hrycyszyn f15588f617 Merge pull request #21 from nymtech/mileschet-patch-1
updated readme with dependencies instructions
2020-01-06 12:24:04 +00:00
Jedrzej Stuczynski 0bb6959755 Printing directory server on start 2020-01-06 12:20:08 +00:00
Jedrzej Stuczynski efb4660fe7 Requiring explicit host + printing bound address on startup 2020-01-06 12:12:40 +00:00
Jedrzej Stuczynski 27c61cb194 Printing node version number on startup 2020-01-06 12:04:45 +00:00
mileschet cddc61fe57 updated readme with dependencies instructions
added some information about the dependencies until we fix cargo dependencies.
2019-12-29 17:07:41 +01:00
Dave Hrycyszyn 489ea16749 Merge pull request #20 from 0xjac/develop
runner: print public key on startup
2019-12-29 15:20:06 +00:00
0xjac b59b9fa4a5 runner: print public key on startup
Closes #19
2019-12-29 16:13:32 +01:00
Dave Hrycyszyn 57d2cab98a Merge tag '0.1.0' into develop
Initial release (0.1.0)
2019-12-23 20:39:35 +00:00
Dave Hrycyszyn 5c697a3a4d Merge branch 'release/0.1.0' 2019-12-23 20:39:14 +00:00
Dave Hrycyszyn 21f0c3e2ac Including a pointer to the Rust install docs 2019-12-20 14:57:18 +00:00
Dave Hrycyszyn 42ab21c133 whitespace 2019-12-20 14:57:07 +00:00
Dave Hrycyszyn a39eed123e main: setting a default port (1789) 2019-12-20 14:54:48 +00:00
Dave Hrycyszyn 1954895e16 Building out the README a bit. 2019-12-20 14:53:57 +00:00
Dave Hrycyszyn f6ad70bff9 Upping message size limit 2019-12-19 17:43:11 +00:00
Dave Hrycyszyn b9747669d3 Merge pull request #25 from nymtech/feature/presence_with_clients
Feature/presence with clients
2019-12-19 13:58:06 +00:00
Jedrzej Stuczynski cbac85fbf4 Fixed compiler warnings 2019-12-19 13:49:45 +00:00
Jedrzej Stuczynski 76f503a664 Provider sending registered clients with presence 2019-12-19 13:49:04 +00:00
Jedrzej Stuczynski a8eb5ec4c2 Moved client processing data behind just an arc but put the ledger behind arc+mutex 2019-12-19 13:07:07 +00:00
Jedrzej Stuczynski 56a8118ea3 Sending presence inside tokio reactor 2019-12-19 12:55:18 +00:00
Dave Hrycyszyn 234bf7d0a0 cargo fmt run 2019-12-19 11:50:47 +00:00
Jędrzej Stuczyński ac8f04959e Merge pull request #18 from nymtech/feature/use-keys
Feature/use keys
2019-12-19 11:48:36 +00:00
Dave Hrycyszyn 016f5829a5 Removing required arguments and setting default values 2019-12-19 11:46:30 +00:00
Dave Hrycyszyn d79ab40988 Merge branch 'develop' into feature/use-keys 2019-12-19 11:37:31 +00:00
Dave Hrycyszyn f0a1ce50bc Merge pull request #23 from nymtech/features/auth_token
Features/auth token
2019-12-18 15:52:36 +00:00
Dave Hrycyszyn ef82d4327c Merge pull request #18 from nymtech/feature/presence-fix
presence: removing last-seen from MixNodePresence, it's set by server
2019-12-18 15:49:44 +00:00
Dave Hrycyszyn 8da639cd11 Merge branch 'develop' into feature/presence-fix 2019-12-18 15:49:04 +00:00
Jedrzej Stuczynski 428f202cbc Got rid of most of compiler warnings 2019-12-18 14:39:54 +00:00
Jedrzej Stuczynski 073ef2776e Returning result from delete_file function + some extra notes 2019-12-18 14:28:44 +00:00
Jedrzej Stuczynski 091104be8f Register response using concrete authToken type + defined from_bytes method 2019-12-18 13:25:15 +00:00
Jedrzej Stuczynski 8bbe771229 Potentially working mutex on register request 2019-12-18 13:20:18 +00:00
Jedrzej Stuczynski 0ead20764b Pull request using the mutex 2019-12-18 13:06:51 +00:00
Jedrzej Stuczynski 8f451283dc Put the client processing data behind a mutex 2019-12-18 12:39:16 +00:00
Jedrzej Stuczynski 6ae5142166 Changes required by the merge 2019-12-18 11:43:09 +00:00
Jedrzej Stuczynski a8e46d34df Merge branch 'develop' into features/auth_token 2019-12-18 11:41:13 +00:00
Jedrzej Stuczynski 20fe59b9ba Tests for marshaling/unmarshaling register request 2019-12-18 10:48:44 +00:00
Jedrzej Stuczynski d0902218d4 Fixed ProviderRequest marshaling and unmarshaling 2019-12-18 10:45:17 +00:00
Jedrzej Stuczynski 38517e41ba constructor for registerrequest 2019-12-18 10:38:01 +00:00
Jedrzej Stuczynski 507f37fcec Made AuthToken be type alias for u8;32 + Used correct type alliases for the clients ledger 2019-12-18 10:03:12 +00:00
Jedrzej Stuczynski 06c645cf56 Using destination address type alias rather than just array of 32
( + rustfmt)
2019-12-18 09:41:29 +00:00
aniampio b63494f686 Add check of the token when pulling 2019-12-17 18:14:40 +01:00
aniampio f78ce3f9b6 Remove lost comment 2019-12-17 17:36:01 +01:00
aniampio 671e55f4d5 Change SHA256 to HMAC 2019-12-17 17:29:10 +01:00
aniampio 85d147ef62 Change token from vec to fixed size array 2019-12-17 15:46:55 +01:00
aniampio cb69182e02 Make sure the client is registered only once and there is only one directory for it 2019-12-17 14:49:29 +01:00
Dave Hrycyszyn 8dd8873a03 using new Config object for provider 2019-12-17 13:34:18 +00:00
Dave Hrycyszyn 4e55c6c395 rustfmt 2019-12-17 13:33:59 +00:00
Dave Hrycyszyn 381e85f0bc main: setting default provider parameters 2019-12-17 13:33:42 +00:00
Dave Hrycyszyn 8ef95ac522 main: making provider module public 2019-12-17 13:33:08 +00:00
Dave Hrycyszyn 59133ed862 cargo: adding base64 crate 2019-12-17 13:32:53 +00:00
Dave Hrycyszyn 65aa1ba29d rustfmt 2019-12-17 13:32:29 +00:00
Dave Hrycyszyn c71f494974 presence: comment re directory server 2019-12-17 13:29:59 +00:00
Dave Hrycyszyn ae25f335f4 mix_peer: adding Debug so we can print 2019-12-17 13:29:29 +00:00
aniampio 3101bb6980 Code cleanup 2019-12-17 12:29:21 +01:00
aniampio 4a241bb59a Move AuthToken into requests 2019-12-17 12:28:38 +01:00
aniampio 63f30bf9d0 Move creating inboxes directory to register_client function 2019-12-17 11:49:22 +01:00
Jedrzej Stuczynski b39ccf26b6 Allowing the two provider listeners to run in parallel rather than just concurrently 2019-12-17 10:31:04 +00:00
Dave Hrycyszyn 21834fde41 Merge pull request #17 from nymtech/feature/metrics_reporting
Feature/metrics reporting
2019-12-17 10:13:19 +00:00
Dave Hrycyszyn b6db1bf1af presence: removing last-seen from MixNodePresence, it's set by server 2019-12-17 10:11:14 +00:00
aniampio 0b3ce4739b Represent registered_clients_ledger as HashTable 2019-12-16 21:32:21 +01:00
Jedrzej Stuczynski f262b2924b Fixed some compiler warnings 2019-12-16 17:59:09 +00:00
Jedrzej Stuczynski 724af12e03 Removed debug prints 2019-12-16 17:45:06 +00:00
Jedrzej Stuczynski 3a59f3cef9 Metrics reporting 2019-12-16 17:42:55 +00:00
Dave Hrycyszyn 6aba3f08f1 Merge branch 'develop' of github.com:nymtech/nym-mixnode into develop 2019-12-16 16:29:47 +00:00
Dave Hrycyszyn 8cd2be7edc cargo: mysterious lock action 2019-12-16 16:29:39 +00:00
Jędrzej Stuczyński d768eff303 Merge pull request #16 from nymtech/feature/use-keys
Feature/use keys
2019-12-16 16:27:58 +00:00
Dave Hrycyszyn ddf0d762d7 mix_peer: adding a to_string() definition 2019-12-16 16:26:30 +00:00
Dave Hrycyszyn aa207e2c13 mix_peer: using constant sized byte array for addressing 2019-12-16 16:25:49 +00:00
Dave Hrycyszyn c192afe9eb mix_peer: converting address to strongly typed socket address 2019-12-16 16:25:29 +00:00
aniampio 415ba8185e Add to_bytes function 2019-12-16 16:36:59 +01:00
aniampio fdbb2549f8 Add template for register response 2019-12-16 15:49:03 +01:00
Dave Hrycyszyn 3f5e219b1c whitespace 2019-12-16 14:47:18 +00:00
Dave Hrycyszyn e6350a0ea4 main: removing superseded comment 2019-12-16 14:46:37 +00:00
Dave Hrycyszyn 56858c4109 provider: sending proper public keys to directory server 2019-12-16 14:46:15 +00:00
aniampio 509b222052 Add register function and types 2019-12-16 15:40:05 +01:00
Jędrzej Stuczyński 29e1488714 Merge pull request #15 from nymtech/feature/use-keys
Feature/use keys
2019-12-16 13:55:42 +00:00
Dave Hrycyszyn 37a493439d presence: sending URL-safe public key 2019-12-16 13:54:38 +00:00
Dave Hrycyszyn ab02eec824 Using the node socket address to send to the directory server 2019-12-16 13:54:20 +00:00
Dave Hrycyszyn efb900a538 node: adding a config struct and using it to pass args around 2019-12-16 13:30:18 +00:00
Dave Hrycyszyn 9d969904f2 cargo: adding base64 crate 2019-12-16 13:29:48 +00:00
Dave Hrycyszyn 2b5b61ea26 node: adding a config struct 2019-12-16 12:54:16 +00:00
Dave Hrycyszyn 287d2b31a5 main: deleting unused key_file argument 2019-12-16 12:54:00 +00:00
Jędrzej Stuczyński de63fff1a1 Merge pull request #14 from nymtech/feature/directory-server-option
Feature/directory server option
2019-12-16 12:31:57 +00:00
Jędrzej Stuczyński d2f8ffdc2b Merge pull request #17 from nymtech/feature/directory-server-option
presence: ability to configure local directory server
2019-12-16 12:31:25 +00:00
Dave Hrycyszyn 4143e53598 presence: ability to configure local directory server 2019-12-16 12:27:50 +00:00
Dave Hrycyszyn 265ef22838 main: can now be started with a local directory server for testing purposes 2019-12-16 12:20:48 +00:00
aniampio ca28ce9e19 Add function to generate SHA256 tokens 2019-12-16 12:47:52 +01:00
Dave Hrycyszyn f0cf92b542 cargo: removed ws deps 2019-12-16 11:46:12 +00:00
Dave Hrycyszyn aceb6df848 Merge pull request #16 from nymtech/feature/presence
Feature/presence
2019-12-16 11:21:50 +00:00
Dave Hrycyszyn ec849cfc0c Merge pull request #13 from nymtech/feature/presence
Feature/presence
2019-12-16 11:21:23 +00:00
Dave Hrycyszyn 233dc5ce9d cargo: lockfile including new nym-client dependencies 2019-12-16 10:28:51 +00:00
Dave Hrycyszyn e4cfab537e presence: renamed to non-stutter names 2019-12-14 15:46:53 +00:00
Dave Hrycyszyn 9fc01cee73 provider: move presence notifications into its own module 2019-12-14 15:35:10 +00:00
Dave Hrycyszyn 842c0b10b9 node: moving presence notification into a thread. 2019-12-14 14:44:07 +00:00
Dave Hrycyszyn f10a403045 cargo: re-ordering 2019-12-14 14:43:49 +00:00
Dave Hrycyszyn 3ab41835a2 provider: importing types and code for presence notifications. Not yet working. 2019-12-13 13:45:36 +00:00
Dave Hrycyszyn 0b41badab0 cargo: alphabetizing 2019-12-13 13:28:31 +00:00
Dave Hrycyszyn 028cc66db3 cargo: added nym-client library 2019-12-13 13:27:03 +00:00
Dave Hrycyszyn 60dc3b4650 cargo: newline 2019-12-13 13:26:47 +00:00
Dave Hrycyszyn 3d9181a913 main: removing assert so that the node starts 2019-12-13 13:25:59 +00:00
Dave Hrycyszyn 1633f54f4f node: adding presence notifications (note: doesn't work yet) 2019-12-13 13:19:58 +00:00
Dave Hrycyszyn 86d27b06df cargo: depending on the nym-client library 2019-12-13 13:19:40 +00:00
Dave Hrycyszyn 07bb0a69fa cargo: newline action 2019-12-13 13:19:26 +00:00
Jędrzej Stuczyński 138814f26c Merge pull request #12 from nymtech/feature/routing
mix_peer: now using the real address from the packet
2019-12-12 19:19:03 +00:00
Dave Hrycyszyn 06540f5ce1 node: removing more lifetimes 2019-12-12 19:15:28 +00:00
Dave Hrycyszyn 4feadb6352 mix_peer: now using the real address from the packet 2019-12-12 19:01:53 +00:00
Dave Hrycyszyn fdf49ff804 runner: cleaning up text to prep for release 2019-12-12 17:47:13 +00:00
Dave Hrycyszyn eb49ef1013 node: removing socket mutabilitiy 2019-12-12 17:10:24 +00:00
Dave Hrycyszyn 17deec7720 runner: removing host assertion so default takes effect 2019-12-12 17:10:08 +00:00
Dave Hrycyszyn 76c2eac3bd main: adding usage banner 2019-12-12 16:59:01 +00:00
Dave Hrycyszyn f095dd114e main: breaking the run command out so that it lives with the node code 2019-12-12 16:57:01 +00:00
Jędrzej Stuczyński 5004f6d07a Merge pull request #15 from nymtech/feature/banner-and-commands
main: re-arranged so main() is at the top, and added a banner
2019-12-12 16:50:39 +00:00
Dave Hrycyszyn 31fbe3c265 main: re-arranged so main() is at the top, and added a banner 2019-12-12 16:46:39 +00:00
Dave Hrycyszyn 478fe628ca Merge pull request #12 from nymtech/feature/client_packet_retrieval
Feature/client packet retrieval
2019-12-12 15:25:40 +00:00
Jedrzej Stuczynski fbb675e815 Future comment 2019-12-12 15:14:04 +00:00
Jedrzej Stuczynski 96f5d45877 Removal of retrieved messages 2019-12-12 15:13:04 +00:00
Jedrzej Stuczynski 5d356847fa Some additional cleanup 2019-12-12 15:02:01 +00:00
Jedrzej Stuczynski 16ddb50159 Moved client-related functionalities to separate module 2019-12-12 14:55:23 +00:00
Jedrzej Stuczynski 48bead3ac9 Moved mix-related functionalities to separate module 2019-12-12 14:46:41 +00:00
Jedrzej Stuczynski 35cff8dfcd Moved store related functionalities to separate module 2019-12-12 14:40:10 +00:00
Jedrzej Stuczynski 2850c71317 Sending back messages to the client 2019-12-12 12:37:17 +00:00
Jedrzej Stuczynski 534a4aedc7 Pull messages response + marshaling 2019-12-12 12:27:02 +00:00
Jedrzej Stuczynski 27b55a7e60 Moved requests to separate module 2019-12-12 12:26:33 +00:00
Jedrzej Stuczynski dc5660728e Moved dummy message content to requests crate 2019-12-12 10:45:06 +00:00
Jedrzej Stuczynski 86693ab983 Reading constant number of stored messages and when below limit putting dummy data 2019-12-12 10:43:32 +00:00
Jedrzej Stuczynski 10d31abbf8 Added my test inbox to gitignore... 2019-12-12 10:05:15 +00:00
Jedrzej Stuczynski c4779e3428 printing all files with given clients' messages 2019-12-12 10:04:17 +00:00
Jedrzej Stuczynski 8bb462bda1 Basic structure for client message retrieval 2019-12-11 17:24:56 +00:00
Jedrzej Stuczynski 427b83875a Changed read_to_end to normal read with 1024 buffer 2019-12-11 16:59:46 +00:00
Jedrzej Stuczynski 8393910016 Closing socket to client on being done 2019-12-11 16:42:37 +00:00
Jedrzej Stuczynski e283d162e5 Updated gitignore... 2019-12-11 15:49:26 +00:00
Jedrzej Stuczynski d869d427e4 Removed the build information for the subcrate... 2019-12-11 15:48:57 +00:00
Jedrzej Stuczynski a08bbc98db Moved provider requests to subcrate in sfw provider 2019-12-11 15:48:30 +00:00
Jedrzej Stuczynski c02665f71e Fixed using incorrect address for client listener 2019-12-11 11:26:58 +00:00
Jedrzej Stuczynski 9ddbaf42d5 Actually spawning new thread and calling processing function 2019-12-11 11:25:46 +00:00
Jedrzej Stuczynski bc77ddadfa Opening dedicated client tcp socket 2019-12-11 11:24:59 +00:00
Jedrzej Stuczynski 688376f757 Fixed linter error about unused results 2019-12-11 11:15:13 +00:00
Jedrzej Stuczynski 1c0eab2fa2 Running two concurrent futures 2019-12-11 11:13:48 +00:00
Jedrzej Stuczynski fb456c0bd0 Added client-related host and port arguments 2019-12-11 10:45:32 +00:00
Dave Hrycyszyn 8d0afbd21e Merge pull request #7 from nymtech/feature/provider_type
Provider storing received messages
2019-12-10 16:00:12 +00:00
Jedrzej Stuczynski 528ba87492 Removed unused imports 2019-12-10 15:36:14 +00:00
Jedrzej Stuczynski d08a9965c8 Removed commented code with an experiment on usage of tokio tcp listener 2019-12-10 15:34:58 +00:00
Jedrzej Stuczynski bf360473d5 Removed accidentally added tmp store directory 2019-12-10 15:29:08 +00:00
Jedrzej Stuczynski fd2f565af2 Provider storing received messages 2019-12-10 15:28:51 +00:00
Jedrzej Stuczynski 7a3f16548b Creating full store path 2019-12-10 14:35:44 +00:00
Jedrzej Stuczynski 6fdc4a6434 Calling store_processed_data after processing each sphinx packet 2019-12-10 14:25:30 +00:00
Dave Hrycyszyn b5c5ea3193 Merge pull request #7 from nymtech/feature/removal_of_processing_data_copy
Removed processing data copy on every connection and instead use Arc …
2019-12-10 13:18:39 +00:00
Jedrzej Stuczynski 1371b94599 Removed processing data copy on every connection and instead use Arc with RwLock 2019-12-10 13:12:58 +00:00
Jedrzej Stuczynski 2c986efcb1 Finally won first fight with the borrow checker for concurrent code 2019-12-10 13:05:44 +00:00
Jedrzej Stuczynski 9b8b0bff1d Moved socket processing to separate function 2019-12-09 17:07:42 +00:00
Jedrzej Stuczynski cd94ecde19 Passing entire processing data struct for dealing with sphinx packets 2019-12-09 13:59:22 +00:00
Jedrzej Stuczynski 385e41a920 Added store directory as additional provider argument 2019-12-09 12:57:18 +00:00
Jedrzej Stuczynski 836cff226a Moved listening loop to provider struct impl 2019-12-09 12:47:38 +00:00
Dave Hrycyszyn 86861ccb70 Merge pull request #6 from nymtech/feature/command_line_arguments
Feature/command line arguments
2019-12-09 11:48:11 +00:00
Dave Hrycyszyn 0b4f10cfe6 Merge pull request #6 from nymtech/feature/command_line_arguments
Feature/command line arguments
2019-12-09 11:44:35 +00:00
Jedrzej Stuczynski 8ac76cb152 passing arguments to the service provider startup 2019-12-09 10:44:21 +00:00
Jedrzej Stuczynski 818389839f Moved provider related functionalities to separate module 2019-12-09 10:38:01 +00:00
Jedrzej Stuczynski 3a069f18e2 Adjusted packet content 2019-12-09 10:27:30 +00:00
Jedrzej Stuczynski 31d0aa7fe4 Added layer as mixnode attribute 2019-12-06 16:21:04 +00:00
Jedrzej Stuczynski 256afa3be9 Removed example code 2019-12-06 16:20:26 +00:00
Jedrzej Stuczynski 777c40bd97 Starting mixnode with provided command line arguments 2019-12-06 16:20:07 +00:00
Jedrzej Stuczynski 9deaad8a2a Initial set of mixnode arguments 2019-12-06 16:14:29 +00:00
AniaPiotrowska 1ad60582ba Merge pull request #5 from nymtech/feature/andrew_experiments
Delays + some code reorganisation
2019-12-06 15:57:27 +00:00
Jedrzej Stuczynski 2aaf2465e4 Moved mix code to separate module 2019-12-06 14:47:14 +00:00
Jedrzej Stuczynski 0fb9c352d6 - 2019-12-06 13:30:39 +00:00
Jedrzej Stuczynski ad289e531b Calling start_listening on mix node instance 2019-12-06 13:26:47 +00:00
Jedrzej Stuczynski 2fbf2456ec More async cleanup 2019-12-06 13:18:50 +00:00
Jedrzej Stuczynski 2c2ecfb785 Initial minor cleanup + actually waiting for time specified in the packet 2019-12-06 12:58:51 +00:00
Jedrzej Stuczynski 9478460893 Waiting 2s before forwarding packet 2019-12-05 17:08:46 +00:00
Dave Hrycyszyn 6ae04b7ed3 Removing print statements 2019-12-02 13:50:21 +00:00
Dave Hrycyszyn fff78cfade Updating to work with constant sized packets 2019-11-29 15:54:44 +00:00
Dave Hrycyszyn e8472e07f9 Updating to work with constant sized packets 2019-11-29 15:54:34 +00:00
Jędrzej Stuczyński 2c0a4b11db Added README - git was asking so nicely to do it : ) 2019-11-29 12:32:14 +00:00
Jędrzej Stuczyński 1eee313e6e Added README - git was asking so nicely to do it : ) 2019-11-29 12:31:49 +00:00
Dave Hrycyszyn 14dfa4795a Initial commit 2019-11-29 12:28:25 +00:00
Dave Hrycyszyn d7ed6b5a13 WIP 2019-11-29 12:26:12 +00:00
Dave Hrycyszyn f4a62fd64c Initial commit 2019-11-28 19:33:20 +00:00
1229 changed files with 306618 additions and 4052 deletions
+5
View File
@@ -0,0 +1,5 @@
// Copyright 2020 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
RUST_LOG=info
RUST_BACKTRACE=1
+40
View File
@@ -0,0 +1,40 @@
# Lines starting with '#' are comments.
# Each line is a file pattern followed by one or more owners.
# More details are here: https://help.github.com/articles/about-codeowners/
# The '*' pattern is global owners.
# Order is important. The last matching pattern has the most precedence.
# The folders are ordered as follows:
# In each subsection folders are ordered first by depth, then alphabetically.
# This should make it easy to add new rules without breaking existing ones.
# Something weird not covered by anything else
* @futurechimp @mmsinclair
# Rust rules:
*.rs @durch @futurechimp @jstuczyn @neacsu
Cargo.* @durch @futurechimp @jstuczyn @neacsu
# JS rules:
*.js @mmsinclair @fmtabbara @Aid19801
*.ts @mmsinclair @fmtabbara @Aid19801
*.tsx @mmsinclair @fmtabbara @Aid19801
*.jsx @mmsinclair @fmtabbara @Aid19801
# Something looking like possible documentation rules:
*.md @mfahampshire
# our docker scripts
/docker/ @neacsu
# if there are any changes in the core crypto, I feel like Ania should take a look:
/common/crypto/ @aniampio
/common/nymsphinx/ @aniampio
# Explorer and wallet should probably get looked by the product team
/explorer/ @nymtech/product
/nym-wallet/ @nymtech/product
/wallet-web/ @nymtech/product
+32
View File
@@ -0,0 +1,32 @@
---
name: Feature request
about: Suggest an enhancement to the product
title: "[Feature Request]"
labels: enhancement
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is...
**Is your request a feature not related to an existing problem? A new feature.**
For example.
- Given I am using the nym wallet
- When I transfer nym tokens across the network
- Then I want to have an url link in the wallet which navigates outside the application to the nym-explorer
**Where does the feature fit in the Nym real estate?**
- Application / UI
**What is this solving?**
How will this improve the product...
**Is this an update to packages or libraries?**
If so, please list them. If not, please ignore this section.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.
+43
View File
@@ -0,0 +1,43 @@
---
name: Report
about: To help identify and reproduce issues
title: "[Issue]"
labels: bug, bug-needs-triage, qa
assignees: tommyv1987
---
**Describe the issue**
A clear and concise description of what the issue is...
**Expected behaviour**
A clear and concise description of what you expected to happen...
**Stack Traces**
If there are stack traces or logs, please provide them here...
**Steps to Reproduce**
Steps to reproduce the behaviour, if you're familiar with BDD syntax, please write it in this style:
- Given I was doing X
- And I installed Y
- When I actioned Y
- Then I expect Z
*An example:*
- Given I was setting up a mix-node following the instructions in the docs
- And I successfully bonded my node via the the wallet
- When I went to start my mixnode
- Then I was presented with an error
**Screenshots**
If applicable, add screenshots to help explain your problem...
**Which area of Nym were you using?**
- UI: [e.g. Websites - network-explorer, nym-website]
- Application: [e.g Gateway, Client, Wallet]
- OS: [e.g. Ubuntu 20.x, MacOs Big Sur, Windows 10]
- Browser: [e.g Chrome (if applicable)]
- Version: [e.g. nym binary(0.11.0), browser(94.0)]
**Additional context**
Please provide any other information
+102
View File
@@ -0,0 +1,102 @@
name: Continuous integration
on:
push:
paths-ignore:
- 'explorer/**'
pull_request:
paths-ignore:
- 'explorer/**'
jobs:
matrix_prep:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
# creates the matrix strategy from build_matrix_includes.json
- uses: actions/checkout@v2
- id: set-matrix
uses: JoshuaTheMiller/conditional-build-matrix@main
with:
inputFile: '.github/workflows/build_matrix_includes.json'
filter: '[?runOnEvent==`${{ github.event_name }}` || runOnEvent==`always`]'
build:
needs: matrix_prep
strategy:
matrix: ${{fromJson(needs.matrix_prep.outputs.matrix)}}
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.rust == 'nightly' || matrix.rust == 'beta' || matrix.os == 'windows-latest' }}
steps:
- name: Install Dependencies (Linux)
run: sudo apt-get update && sudo apt-get install libwebkit2gtk-4.0-dev build-essential curl wget libssl-dev libgtk-3-dev squashfs-tools
if: matrix.os == 'ubuntu-latest'
- name: Check out repository code
uses: actions/checkout@v2
- name: Install rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
components: rustfmt, clippy
- name: Build all binaries
uses: actions-rs/cargo@v1
with:
command: build
args: --all
- name: Run all tests
uses: actions-rs/cargo@v1
with:
command: test
args: --all
- name: Check formatting
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
- uses: actions-rs/clippy-check@v1
name: Clippy checks
# if: matrix.os == 'ubuntu-latest' && matrix.rust == 'stable'
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features
- name: Run clippy
uses: actions-rs/cargo@v1
if: ${{ matrix.rust != 'nightly' }}
with:
command: clippy
args: -- -D warnings
# COCONUT stuff
- name: Reclaim some disk space (because Windows is being annoying)
uses: actions-rs/cargo@v1
if: ${{ matrix.os == 'windows-latest' }}
with:
command: clean
- name: Build all binaries with coconut enabled
uses: actions-rs/cargo@v1
with:
command: build
args: --all --features=coconut
- name: Run all tests with coconut enabled
uses: actions-rs/cargo@v1
with:
command: test
args: --all --features=coconut
- name: Run clippy with coconut enabled
uses: actions-rs/cargo@v1
if: ${{ matrix.rust != 'nightly' }}
with:
command: clippy
args: --features=coconut -- -D warnings
@@ -0,0 +1,50 @@
[
{
"os":"ubuntu-latest",
"rust":"stable",
"runOnEvent":"always"
},
{
"os":"windows-latest",
"rust":"stable",
"runOnEvent":"pull_request"
},
{
"os":"macos-latest",
"rust":"stable",
"runOnEvent":"pull_request"
},
{
"os":"ubuntu-latest",
"rust":"beta",
"runOnEvent":"pull_request"
},
{
"os":"windows-latest",
"rust":"beta",
"runOnEvent":"pull_request"
},
{
"os":"macos-latest",
"rust":"beta",
"runOnEvent":"pull_request"
},
{
"os":"ubuntu-latest",
"rust":"nightly",
"runOnEvent":"pull_request"
},
{
"os":"windows-latest",
"rust":"nightly",
"runOnEvent":"pull_request"
},
{
"os":"macos-latest",
"rust":"nightly",
"runOnEvent":"pull_request"
}
]
@@ -0,0 +1,14 @@
[
{
"rust":"stable",
"runOnEvent":"always"
},
{
"rust":"beta",
"runOnEvent":"pull_request"
},
{
"rust":"nightly",
"runOnEvent":"pull_request"
}
]
+64
View File
@@ -0,0 +1,64 @@
name: Contracts
on:
push:
paths-ignore:
- 'explorer/**'
pull_request:
paths-ignore:
- 'explorer/**'
jobs:
matrix_prep:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
# creates the matrix strategy from build_matrix_includes.json
- uses: actions/checkout@v2
- id: set-matrix
uses: JoshuaTheMiller/conditional-build-matrix@main
with:
inputFile: '.github/workflows/contract_matrix_includes.json'
filter: '[?runOnEvent==`${{ github.event_name }}` || runOnEvent==`always`]'
contracts:
# since it's going to be compiled into wasm, there's absolutely
# no point in running CI on different OS-es
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.rust == 'nightly' }}
needs: matrix_prep
strategy:
matrix: ${{fromJson(needs.matrix_prep.outputs.matrix)}}
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
target: wasm32-unknown-unknown
override: true
components: rustfmt, clippy
- uses: actions-rs/cargo@v1
env:
RUSTFLAGS: '-C link-arg=-s'
with:
command: build
args: --manifest-path contracts/Cargo.toml --all --target wasm32-unknown-unknown
- uses: actions-rs/cargo@v1
with:
command: test
args: --manifest-path contracts/Cargo.toml
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --manifest-path contracts/Cargo.toml --all -- --check
- uses: actions-rs/cargo@v1
if: ${{ matrix.rust != 'nightly' }}
with:
command: clippy
args: --manifest-path contracts/Cargo.toml --all -- -D warnings
@@ -0,0 +1,23 @@
name: Linting for Network Explorer (eslint/prettier)
on:
pull_request:
paths:
- 'explorer/**'
defaults:
run:
working-directory: explorer
jobs:
build:
runs-on: custom-runner-linux
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '14'
- run: npm install
- name: Run ESLint
# GitHub should automatically annotate the PR
run: npm run lint
+59
View File
@@ -0,0 +1,59 @@
name: CI for Network Explorer
on:
push:
paths:
- 'explorer/**'
defaults:
run:
working-directory: explorer
jobs:
build:
runs-on: custom-runner-linux
steps:
- uses: actions/checkout@v2
- name: Install rsync
run: sudo apt-get install rsync
- uses: rlespinasse/github-slug-action@v3.x
- uses: actions/setup-node@v2
with:
node-version: '14'
- run: npm install
continue-on-error: true
- name: Set environment from the example
run: cp .env.prod .env
- run: npm run test
continue-on-error: true
- run: npm run build
continue-on-error: true
- name: Deploy branch to CI www
continue-on-error: true
uses: easingthemes/ssh-deploy@main
env:
SSH_PRIVATE_KEY: ${{ secrets.CI_WWW_SSH_PRIVATE_KEY }}
ARGS: "-rltgoDzvO --delete"
SOURCE: "explorer/dist/"
REMOTE_HOST: ${{ secrets.CI_WWW_REMOTE_HOST }}
REMOTE_USER: ${{ secrets.CI_WWW_REMOTE_USER }}
TARGET: ${{ secrets.CI_WWW_REMOTE_TARGET }}/network-explorer-${{ env.GITHUB_REF_SLUG }}
EXCLUDE: "/dist/, /node_modules/"
- name: Keybase - Node Install
run: npm install
working-directory: .github/workflows/support-files/messages
- name: Keybase - Send Notification
env:
NYM_PROJECT_NAME: "Network Explorer"
NYM_CI_WWW_BASE: "${{ secrets.NYM_CI_WWW_BASE }}"
NYM_CI_WWW_LOCATION: "network-explorer-${{ env.GITHUB_REF_SLUG }}"
GIT_COMMIT_MESSAGE: "${{ github.event.head_commit.message }}"
GIT_BRANCH: "${GITHUB_REF##*/}"
KEYBASE_NYMBOT_USERNAME: "${{ secrets.KEYBASE_NYMBOT_USERNAME }}"
KEYBASE_NYMBOT_PAPERKEY: "${{ secrets.KEYBASE_NYMBOT_PAPERKEY }}"
KEYBASE_NYMBOT_TEAM: "${{ secrets.KEYBASE_NYMBOT_TEAM }}"
KEYBASE_NYM_CHANNEL: "ci-network-explorer"
IS_SUCCESS: "${{ job.status == 'success' }}"
uses: docker://keybaseio/client:stable-node
with:
args: .github/workflows/support-files/messages/entry_point_notifications.sh
+12
View File
@@ -0,0 +1,12 @@
name: Publish Nym Wallet
on:
push:
tags:
- nym-wallet-*
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Run a one-line script
run: echo Hello, world!
+29
View File
@@ -0,0 +1,29 @@
name: Generate TS types
on:
push:
paths-ignore:
- "explorer/**"
pull_request:
paths-ignore:
- "explorer/**"
jobs:
nym-wallet-types:
runs-on: ubuntu-latest
if: ${{ github.event_name != 'pull_request' }}
steps:
- name: Prepare
run: sudo apt-get update && sudo apt-get install -y libpango1.0-dev libatk1.0-dev libgdk-pixbuf2.0-dev libsoup2.4-dev librust-gdk-dev libwebkit2gtk-4.0-dev
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Generate TS
run: cd nym-wallet/src-tauri && cargo test
- uses: EndBug/add-and-commit@v7.2.1 # https://github.com/marketplace/actions/add-commit
with:
add: '["nym-wallet"]'
message: "[ci skip] Generate TS types"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+77
View File
@@ -0,0 +1,77 @@
name: Webdriverio tests for nym wallet
on:
push:
paths:
- "nym-wallet/**"
defaults:
run:
working-directory: nym-wallet
jobs:
test:
name: wallet tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Tauri dependencies
run: >
sudo apt-get update &&
sudo apt-get install -y
libgtk-3-dev
libgtksourceview-3.0-dev
webkit2gtk-4.0
libappindicator3-dev
webkit2gtk-driver
xvfb
- name: Install minimal stable
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
- name: Node v16
uses: actions/setup-node@v1
with:
node-version: 16.x
- name: Install yarn for building application
run: yarn install
- name: Build application
run: yarn run webpack:build & yarn run tauri:build
- name: Check binary exists
run: |
cd target/release/
(test -f nym-wallet && echo nym binary exists) || echo wallet does not exist
- name: Install dependencies
run: yarn install
working-directory: nym-wallet/webdriver
- name: Remove existing user datafile
uses: JesseTG/rm@v1.0.2
with:
path: nym-wallet/webdriver/common/data/user-data.json
- name: Create user data json file
id: create-json
uses: jsdaniell/create-json@1.1.2
with:
name: "user-data.json"
json: ${{ secrets.WALLET_USERDATA }}
dir: "nym-wallet/webdriver/common/data/"
- name: Install tauri-driver
uses: actions-rs/cargo@v1
with:
command: install
args: tauri-driver
- name: Launch tests
run: xvfb-run yarn test:runall
working-directory: nym-wallet/webdriver
@@ -0,0 +1,2 @@
node_modules
.idea
@@ -0,0 +1,6 @@
{
"trailingComma": "all",
"singleQuote": true,
"printWidth": 80,
"tabWidth": 2
}
@@ -0,0 +1,10 @@
#!/usr/bin/env bash
# pass exit codes out to GitHub Actions
set -euxo pipefail
# change to the directory that contains this script
cd "${0%/*}"
# run the node script
node send_message.js
@@ -0,0 +1,11 @@
🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥
> :rocket: {{ env.NYM_PROJECT_NAME }}
> 🔴 **FAILURE** :cry:
> `branch` {{ env.GITHUB_SERVER_URL }}/{{ env.GITHUB_REPOSITORY }}/tree/{{ env.GIT_BRANCH_NAME }}
> `commit` {{ env.GITHUB_SERVER_URL }}/{{ env.GITHUB_REPOSITORY }}/commit/{{ env.GITHUB_SHA }}
> `build ` {{ env.GITHUB_SERVER_URL }}/{{ env.GITHUB_REPOSITORY }}/actions/runs/{{ env.GITHUB_RUN_ID }}
Commit message:
```
{{ env.GIT_COMMIT_MESSAGE }}
```
@@ -0,0 +1,16 @@
{
"name": "send-keybase-message",
"description": "Sends a notification message with the keybase package that fails when piped into the keybase CLI",
"version": "1.0.0",
"private": true,
"scripts": {
"format": "prettier --write send_message.js"
},
"dependencies": {
"handlebars": "^4.7.7",
"keybase-bot": "^3.6.1"
},
"devDependencies": {
"prettier": "2.3.2"
}
}
@@ -0,0 +1,69 @@
const Bot = require('keybase-bot');
const Handlebars = require('handlebars');
const fs = require('fs');
async function main() {
const data = { env: process.env };
// const data = { ...PASTE TEST DATA HERE ... }; // -- DEV: uncomment to set test data
// validation of environment
if(!(process.env.NYM_PROJECT_NAME || data.env.NYM_PROJECT_NAME)) {
throw new Error('Please set env var NYM_PROJECT_NAME with the project name for displaying in notification messages');
}
const keybaseChannel = process.env.KEYBASE_NYM_CHANNEL || data.env.KEYBASE_NYM_CHANNEL;
if(!keybaseChannel) {
throw new Error('Please set env var KEYBASE_NYM_CHANNEL with the channel name for the notification message');
}
// extract the git branch name
const GIT_BRANCH_NAME = (process.env.GITHUB_REF || data.env.GITHUB_REF).split('/').slice(2).join('/');
data.env.GIT_BRANCH_NAME = GIT_BRANCH_NAME;
const source = fs
.readFileSync(process.env.IS_SUCCESS === 'true' ? 'success' : 'failure')
.toString();
const template = Handlebars.compile(source);
const result = template(data);
// -- DEV: uncomment to show what is available in the handlebars template / show the result
// console.dir({ data }, { depth: null });
// console.log(result);
const bot = new Bot();
try {
const username = process.env.KEYBASE_NYMBOT_USERNAME;
const paperkey = process.env.KEYBASE_NYMBOT_PAPERKEY;
if(!username) {
throw new Error('Username is not defined. Please set env var KEYBASE_NYMBOT_USERNAME');
}
if(!paperkey) {
throw new Error('Paperkey is not defined. Please set env var KEYBASE_NYMBOT_PAPERKEY');
}
console.log(`Initialising keybase with user "${username}" and key: "${'*'.repeat(paperkey.length)}"...`);
await bot.init(username, paperkey, { verbose: false });
const channel = {
name: 'nymtech_bot',
membersType: 'team',
topicName: keybaseChannel,
topic_type: 'CHAT',
};
const message = {
body: result,
};
console.log(`Sending to ${channel.name}#${channel.topicName}...`);
await bot.chat.send(channel, message);
console.log('Message sent!');
} catch (error) {
console.error(error);
process.exitCode = -1;
} finally {
await bot.deinit();
}
}
main();
@@ -0,0 +1,11 @@
🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩
> :rocket: {{ env.NYM_PROJECT_NAME }} ➡️➡️➡️➡️➡️ **View output:** https://{{ env.NYM_CI_WWW_LOCATION }}.{{ env.NYM_CI_WWW_BASE }}/
> ✅ **SUCCESS**
> `branch` {{ env.GITHUB_SERVER_URL }}/{{ env.GITHUB_REPOSITORY }}/tree/{{ env.GIT_BRANCH_NAME }}
> `commit` {{ env.GITHUB_SERVER_URL }}/{{ env.GITHUB_REPOSITORY }}/commit/{{ env.GITHUB_SHA }}
> `build ` {{ env.GITHUB_SERVER_URL }}/{{ env.GITHUB_REPOSITORY }}/actions/runs/{{ env.GITHUB_RUN_ID }}
Commit message:
```
{{ env.GIT_COMMIT_MESSAGE }}
```
+48
View File
@@ -0,0 +1,48 @@
name: Wasm Client
on:
pull_request:
paths-ignore:
- 'explorer/**'
jobs:
wasm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: wasm32-unknown-unknown
override: true
components: rustfmt, clippy
# token credentials (non-coconut) don't work for wasm right now
# - uses: actions-rs/cargo@v1
# with:
# command: build
# args: --manifest-path clients/webassembly/Cargo.toml --target wasm32-unknown-unknown
- uses: actions-rs/cargo@v1
with:
command: build
args: --manifest-path clients/webassembly/Cargo.toml --target wasm32-unknown-unknown --features=coconut
# for some reason this does not seem to work correctly, leave it for later, building is good enough for now
# - uses: actions-rs/cargo@v1
# with:
# command: test
# args: --manifest-path clients/webassembly/Cargo.toml --target wasm32-unknown-unknown
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --manifest-path clients/webassembly/Cargo.toml -- --check
# for some reason this does not seem to work correctly, leave it for later, building is good enough for now
# - uses: actions-rs/cargo@v1
# with:
# command: clippy
# args: --manifest-path clients/webassembly/Cargo.toml --target wasm32-unknown-unknown -- -D warnings
+3
View File
@@ -0,0 +1,3 @@
unreleased=true
future-release=v0.12.0
since-tag=v0.11.0
+37 -2
View File
@@ -1,3 +1,38 @@
/target
// Copyright 2020 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: CC0-1.0
/targetString
**/*.rs.bk
/.idea/
/*/target
/test_inbox
.idea
target
.env
/.vscode/settings.json
validator/.vscode
sample-configs/validator-config.toml
scripts/deploy_qa.sh
scripts/run_gate.sh
scripts/run_mix.sh
scripts/start_local_tmux_network.sh
/.floo
/.flooignore
qa-v4-topology.json
qa-v6-topology.json
v4-topology.json
v6-topology.json
/explorer/downloads/topology.json
/explorer/public/downloads/mixmining.json
/explorer/public/downloads/topology.json
/nym-wallet/dist/*
/clients/validator/examples/nym-driver-example/current-contract.txt
validator-api/v4.json
validator-api/v6.json
**/node_modules
validator-api/keypair
contracts/mixnet/code_id
contracts/mixnet/Justfile
contracts/mixnet/Makefile
validator-config
*.patch
validator-api-config.toml
+9
View File
@@ -0,0 +1,9 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: nym
Upstream-Contact: Nym Technologies SA <contact@nymtech.net>
Source: https://github.com/nymtech/nym
Files: *clients/* *common/* *explorer/*
Copyright: 2020, Nym Technologies SA <contact@nymtech.net>
License: Apache-2.0
+1
View File
@@ -0,0 +1 @@
2.7.5
+244 -9
View File
@@ -1,12 +1,247 @@
# nym-client Changelog
# Changelog
* removed the `--local` flag
* introduced `--directory` argument to support arbitrary directory servers. Leaving it out will point the node at the "https://directory.nymtech.net" alpha testnet server
* IPv6 support
* client version number is now shown at node start
* directory server location is now shown at node start
* decrease default delays
## [v0.12.0](https://github.com/nymtech/nym/tree/v0.12.0) (2021-12-21)
## 0.1.0 - Initial Release
[Full Changelog](https://github.com/nymtech/nym/compare/v0.11.0...v0.12.0)
* The bare minimum set of features required by a Nym Client
**Implemented enhancements:**
- Introduces query for contract build information [\#919](https://github.com/nymtech/nym/pull/919) ([jstuczyn](https://github.com/jstuczyn))
**Fixed bugs:**
- Mixnodes - claim tokens scenario does not work with telegram bot [\#938](https://github.com/nymtech/nym/issues/938)
- \[Issue\]"create account" button does not work on Ubuntu 20.04.03 LTS [\#916](https://github.com/nymtech/nym/issues/916)
- \[Issue\] NodeJS 17.1.0 and webpack issues causing nym-wallet build to fail on Pop!OS 21.04\(Ubuntu\) [\#914](https://github.com/nymtech/nym/issues/914)
- Prevent overwriting of Mixnodes if the mixnode is already bonded [\#912](https://github.com/nymtech/nym/issues/912)
- Pasting mnemonic doesn't work on MacOS [\#908](https://github.com/nymtech/nym/issues/908)
- Wallet - investigate nav freezes [\#716](https://github.com/nymtech/nym/issues/716)
- Wallet - Fix console errors [\#707](https://github.com/nymtech/nym/issues/707)
- Fixed invalid nodes being counted twice in unroutable category [\#963](https://github.com/nymtech/nym/pull/963) ([jstuczyn](https://github.com/jstuczyn))
- Don't reset total delegation on mixnode rebond [\#940](https://github.com/nymtech/nym/pull/940) ([jstuczyn](https://github.com/jstuczyn))
- Bugfix/remove mixnode bonding overwrite [\#917](https://github.com/nymtech/nym/pull/917) ([jstuczyn](https://github.com/jstuczyn))
- Fixes crash condition in validator API when calculating last day uptime [\#909](https://github.com/nymtech/nym/pull/909) ([jstuczyn](https://github.com/jstuczyn))
- Bugfix/monitor initial values wait [\#907](https://github.com/nymtech/nym/pull/907) ([jstuczyn](https://github.com/jstuczyn))
- Bug fix: Network Explorer: Add freegeoip API key and split out tasks for country distributions [\#806](https://github.com/nymtech/nym/pull/806) ([mmsinclair](https://github.com/mmsinclair))
- Explorer API: port test now split out address resolution and add units tests [\#755](https://github.com/nymtech/nym/pull/755) ([mmsinclair](https://github.com/mmsinclair))
**Closed issues:**
- Feature gate `ts-rs` everywhere and only build use it to export types during CI runs [\#893](https://github.com/nymtech/nym/issues/893)
- Error when init Nym client for Nym requester [\#800](https://github.com/nymtech/nym/issues/800)
- Website updates - Add new team members and translations [\#775](https://github.com/nymtech/nym/issues/775)
- Update Run Nym Nodes Documentation [\#773](https://github.com/nymtech/nym/issues/773)
- Upgrade `prost` to 0.8 [\#768](https://github.com/nymtech/nym/issues/768)
- How can I get 100punk\(Version: 0.11.0\) [\#743](https://github.com/nymtech/nym/issues/743)
- Wallet - Fix Bond Form validation issue [\#717](https://github.com/nymtech/nym/issues/717)
- help!!! [\#712](https://github.com/nymtech/nym/issues/712)
- UX feature request: show all delegated nodes in wallet [\#711](https://github.com/nymtech/nym/issues/711)
- UX feature request: add current balance on wallet pages [\#710](https://github.com/nymtech/nym/issues/710)
- got sign issue from bot [\#709](https://github.com/nymtech/nym/issues/709)
- As a wallet user, I would like to be able to log out of the wallet [\#706](https://github.com/nymtech/nym/issues/706)
- As a wallet user, I would like to have a "receive" page where I can see my own wallet address [\#705](https://github.com/nymtech/nym/issues/705)
- Update native client/socks client/mixnode/gateway `upgrade` command [\#689](https://github.com/nymtech/nym/issues/689)
- Update mixnode/gateway/client to use query for cached nodes rather than use validator [\#688](https://github.com/nymtech/nym/issues/688)
- '--directory' not expected error starting local mixnet [\#520](https://github.com/nymtech/nym/issues/520)
- nym-socks5-client is painfully slow [\#495](https://github.com/nymtech/nym/issues/495)
- nym-socks5-client crash after opening Keybase team "Browse all channels" [\#494](https://github.com/nymtech/nym/issues/494)
- Mixed Content problem [\#400](https://github.com/nymtech/nym/issues/400)
- Gateway disk quota [\#137](https://github.com/nymtech/nym/issues/137)
- Simplify message encapsulation with regards to topology [\#127](https://github.com/nymtech/nym/issues/127)
- Create constants for cli argument names [\#115](https://github.com/nymtech/nym/issues/115)
- Using Blake3 as a hash function [\#103](https://github.com/nymtech/nym/issues/103)
- Validator should decide which layer a node is in [\#86](https://github.com/nymtech/nym/issues/86)
- Clean shutdown for all processes [\#73](https://github.com/nymtech/nym/issues/73)
- Client API consistency [\#71](https://github.com/nymtech/nym/issues/71)
- Simplify concurrency with a proper actor framework [\#31](https://github.com/nymtech/nym/issues/31)
- Database for gateway [\#11](https://github.com/nymtech/nym/issues/11)
**Merged pull requests:**
- Fix success view messages. [\#990](https://github.com/nymtech/nym/pull/990) ([tommyv1987](https://github.com/tommyv1987))
- Feature/enable signature check [\#989](https://github.com/nymtech/nym/pull/989) ([neacsu](https://github.com/neacsu))
- Update mixnet contract address [\#988](https://github.com/nymtech/nym/pull/988) ([neacsu](https://github.com/neacsu))
- Fix verloc print [\#987](https://github.com/nymtech/nym/pull/987) ([neacsu](https://github.com/neacsu))
- Feature/refactor mixnet contract test helpers [\#986](https://github.com/nymtech/nym/pull/986) ([futurechimp](https://github.com/futurechimp))
- Making the terminology consistent between mixnode/gateway output and … [\#985](https://github.com/nymtech/nym/pull/985) ([futurechimp](https://github.com/futurechimp))
- Feature/add wallet to gateway init [\#984](https://github.com/nymtech/nym/pull/984) ([futurechimp](https://github.com/futurechimp))
- Feature/add wallet address to init [\#982](https://github.com/nymtech/nym/pull/982) ([futurechimp](https://github.com/futurechimp))
- Update message to bond mixnode [\#981](https://github.com/nymtech/nym/pull/981) ([tommyv1987](https://github.com/tommyv1987))
- Bump version to 0.12.0 [\#980](https://github.com/nymtech/nym/pull/980) ([neacsu](https://github.com/neacsu))
- Feature/rename erc20 [\#979](https://github.com/nymtech/nym/pull/979) ([neacsu](https://github.com/neacsu))
- Removed web wallet [\#978](https://github.com/nymtech/nym/pull/978) ([futurechimp](https://github.com/futurechimp))
- Network Explorer: fix uptime history display to use new API response [\#977](https://github.com/nymtech/nym/pull/977) ([mmsinclair](https://github.com/mmsinclair))
- Make develop branch agnostic of the network [\#976](https://github.com/nymtech/nym/pull/976) ([neacsu](https://github.com/neacsu))
- Fix windows fmt [\#975](https://github.com/nymtech/nym/pull/975) ([neacsu](https://github.com/neacsu))
- Feature/wallet settings area [\#974](https://github.com/nymtech/nym/pull/974) ([fmtabbara](https://github.com/fmtabbara))
- Feature/node info command [\#972](https://github.com/nymtech/nym/pull/972) ([jstuczyn](https://github.com/jstuczyn))
- Use the renamed balance function [\#971](https://github.com/nymtech/nym/pull/971) ([neacsu](https://github.com/neacsu))
- Introduced 'version' command to all relevant binaries [\#969](https://github.com/nymtech/nym/pull/969) ([jstuczyn](https://github.com/jstuczyn))
- Feature/new testnet wallet updates [\#968](https://github.com/nymtech/nym/pull/968) ([fmtabbara](https://github.com/fmtabbara))
- Feature/optional bandwidth bypass [\#965](https://github.com/nymtech/nym/pull/965) ([jstuczyn](https://github.com/jstuczyn))
- Additional tauri commands to get bond details [\#964](https://github.com/nymtech/nym/pull/964) ([jstuczyn](https://github.com/jstuczyn))
- Fix topology log [\#962](https://github.com/nymtech/nym/pull/962) ([neacsu](https://github.com/neacsu))
- Network Explorer: configure URLs with `.env` file [\#960](https://github.com/nymtech/nym/pull/960) ([mmsinclair](https://github.com/mmsinclair))
- Add custom denom balance query [\#957](https://github.com/nymtech/nym/pull/957) ([neacsu](https://github.com/neacsu))
- Feature/ts client update [\#956](https://github.com/nymtech/nym/pull/956) ([jstuczyn](https://github.com/jstuczyn))
- Check the response for multiple sends [\#955](https://github.com/nymtech/nym/pull/955) ([neacsu](https://github.com/neacsu))
- Feature/vesting to wallet [\#954](https://github.com/nymtech/nym/pull/954) ([durch](https://github.com/durch))
- Bugfix/rewarding fixes [\#953](https://github.com/nymtech/nym/pull/953) ([jstuczyn](https://github.com/jstuczyn))
- Bump next from 11.1.1 to 11.1.3 in /wallet-web [\#952](https://github.com/nymtech/nym/pull/952) ([dependabot[bot]](https://github.com/apps/dependabot))
- Different workshare calculations for rewarded vs active set [\#951](https://github.com/nymtech/nym/pull/951) ([durch](https://github.com/durch))
- Feature/simulate [\#950](https://github.com/nymtech/nym/pull/950) ([jstuczyn](https://github.com/jstuczyn))
- Feature/profit margin percent config [\#949](https://github.com/nymtech/nym/pull/949) ([durch](https://github.com/durch))
- Run CI for all contracts in one workflow [\#948](https://github.com/nymtech/nym/pull/948) ([durch](https://github.com/durch))
- Desktop Wallet UI Updates [\#947](https://github.com/nymtech/nym/pull/947) ([fmtabbara](https://github.com/fmtabbara))
- Docker updates [\#946](https://github.com/nymtech/nym/pull/946) ([tommyv1987](https://github.com/tommyv1987))
- Add VestingExecute and VestingQuery client traits [\#944](https://github.com/nymtech/nym/pull/944) ([durch](https://github.com/durch))
- Removed reliance on cosmrs fork [\#943](https://github.com/nymtech/nym/pull/943) ([jstuczyn](https://github.com/jstuczyn))
- Feature/terminology update [\#941](https://github.com/nymtech/nym/pull/941) ([jstuczyn](https://github.com/jstuczyn))
- Check the response for other transactions as well [\#937](https://github.com/nymtech/nym/pull/937) ([neacsu](https://github.com/neacsu))
- Allow proxy gateway bonding [\#936](https://github.com/nymtech/nym/pull/936) ([durch](https://github.com/durch))
- Feature/pre cosmrs updates [\#935](https://github.com/nymtech/nym/pull/935) ([jstuczyn](https://github.com/jstuczyn))
- Feature/client on behalf [\#934](https://github.com/nymtech/nym/pull/934) ([neacsu](https://github.com/neacsu))
- Webpack wallet prod configuration [\#933](https://github.com/nymtech/nym/pull/933) ([tommyv1987](https://github.com/tommyv1987))
- Adding tx\_hash to wallet response [\#932](https://github.com/nymtech/nym/pull/932) ([futurechimp](https://github.com/futurechimp))
- Release/1.0.0 pre1 [\#931](https://github.com/nymtech/nym/pull/931) ([durch](https://github.com/durch))
- Feature/identity verification [\#930](https://github.com/nymtech/nym/pull/930) ([jstuczyn](https://github.com/jstuczyn))
- Move cleaned up smart contracts to main code repo [\#929](https://github.com/nymtech/nym/pull/929) ([mfahampshire](https://github.com/mfahampshire))
- Feature/mixnet contract further adjustments [\#928](https://github.com/nymtech/nym/pull/928) ([jstuczyn](https://github.com/jstuczyn))
- typo copy change for nodemap [\#926](https://github.com/nymtech/nym/pull/926) ([Aid19801](https://github.com/Aid19801))
- Feature/UI enhancements for Desktop Wallet [\#925](https://github.com/nymtech/nym/pull/925) ([fmtabbara](https://github.com/fmtabbara))
- Fixing some clippy warnings [\#922](https://github.com/nymtech/nym/pull/922) ([futurechimp](https://github.com/futurechimp))
- Fixing go warning re unused btc lib [\#921](https://github.com/nymtech/nym/pull/921) ([futurechimp](https://github.com/futurechimp))
- quick fix adding dimensions to nodemap page for consistency [\#920](https://github.com/nymtech/nym/pull/920) ([Aid19801](https://github.com/Aid19801))
- Bump nth-check from 2.0.0 to 2.0.1 in /nym-wallet [\#918](https://github.com/nymtech/nym/pull/918) ([dependabot[bot]](https://github.com/apps/dependabot))
- Fix Mobile View for MUI data-grid \(CARD 108\) [\#915](https://github.com/nymtech/nym/pull/915) ([Aid19801](https://github.com/Aid19801))
- Feature/total delegation bucket [\#913](https://github.com/nymtech/nym/pull/913) ([jstuczyn](https://github.com/jstuczyn))
- Feature/faucet page react [\#911](https://github.com/nymtech/nym/pull/911) ([fmtabbara](https://github.com/fmtabbara))
- Feature/mixnet contract refactor [\#910](https://github.com/nymtech/nym/pull/910) ([futurechimp](https://github.com/futurechimp))
- Update README.md [\#905](https://github.com/nymtech/nym/pull/905) ([tommyv1987](https://github.com/tommyv1987))
- BUG: Bond cell denom [\#904](https://github.com/nymtech/nym/pull/904) ([Aid19801](https://github.com/Aid19801))
- Explorer UI tests missing data-testid [\#903](https://github.com/nymtech/nym/pull/903) ([tommyv1987](https://github.com/tommyv1987))
- Fix up Nym-Wallet README.md [\#899](https://github.com/nymtech/nym/pull/899) ([tommyv1987](https://github.com/tommyv1987))
- Feature/batch delegator rewarding [\#898](https://github.com/nymtech/nym/pull/898) ([jstuczyn](https://github.com/jstuczyn))
- Bug mapp nodemap [\#897](https://github.com/nymtech/nym/pull/897) ([Aid19801](https://github.com/Aid19801))
- Bug fix/macos keyboard shortcuts [\#896](https://github.com/nymtech/nym/pull/896) ([fmtabbara](https://github.com/fmtabbara))
- Add a Mobile Nav to the Network Explorer [\#895](https://github.com/nymtech/nym/pull/895) ([Aid19801](https://github.com/Aid19801))
- Only use ts-rs in tests [\#894](https://github.com/nymtech/nym/pull/894) ([durch](https://github.com/durch))
- Fix network monitor template [\#892](https://github.com/nymtech/nym/pull/892) ([neacsu](https://github.com/neacsu))
- remove delegation and undelegation from gateways [\#891](https://github.com/nymtech/nym/pull/891) ([fmtabbara](https://github.com/fmtabbara))
- Feature/nym wallet rename [\#890](https://github.com/nymtech/nym/pull/890) ([futurechimp](https://github.com/futurechimp))
- Change MixnodeDetail page's datagrid into a reuseable table component [\#887](https://github.com/nymtech/nym/pull/887) ([Aid19801](https://github.com/Aid19801))
- GitHub Actions: only run job to generate types when not in a PR [\#886](https://github.com/nymtech/nym/pull/886) ([mmsinclair](https://github.com/mmsinclair))
- Adding data-test-ids for the explorer [\#885](https://github.com/nymtech/nym/pull/885) ([tommyv1987](https://github.com/tommyv1987))
- Fix path for github action running tauri-wallet-tests [\#884](https://github.com/nymtech/nym/pull/884) ([tommyv1987](https://github.com/tommyv1987))
- Reverted gateway registration handshake to its 0.11.0 version [\#882](https://github.com/nymtech/nym/pull/882) ([jstuczyn](https://github.com/jstuczyn))
- Network Explorer [\#881](https://github.com/nymtech/nym/pull/881) ([mmsinclair](https://github.com/mmsinclair))
- Feature/rewarding interval updates [\#880](https://github.com/nymtech/nym/pull/880) ([jstuczyn](https://github.com/jstuczyn))
- Put client\_address and id in the correct order [\#875](https://github.com/nymtech/nym/pull/875) ([neacsu](https://github.com/neacsu))
- remove gateway selection on delegation and undelegation pages [\#873](https://github.com/nymtech/nym/pull/873) ([fmtabbara](https://github.com/fmtabbara))
- Set MSRV on all binaries to 1.56 [\#872](https://github.com/nymtech/nym/pull/872) ([jstuczyn](https://github.com/jstuczyn))
- add native window items \(copy/paste\) via tauri [\#871](https://github.com/nymtech/nym/pull/871) ([fmtabbara](https://github.com/fmtabbara))
- Remove stale migration code [\#868](https://github.com/nymtech/nym/pull/868) ([neacsu](https://github.com/neacsu))
- Fixed most recent nightly clippy warnings [\#865](https://github.com/nymtech/nym/pull/865) ([jstuczyn](https://github.com/jstuczyn))
- Active sets =\> Rewarded + Active/Idle sets [\#864](https://github.com/nymtech/nym/pull/864) ([jstuczyn](https://github.com/jstuczyn))
- Chore/cosmrs update [\#862](https://github.com/nymtech/nym/pull/862) ([jstuczyn](https://github.com/jstuczyn))
- Made daily uptime calculation be independent of epoch rewarding [\#860](https://github.com/nymtech/nym/pull/860) ([jstuczyn](https://github.com/jstuczyn))
- Removed epoch rewarding variance [\#857](https://github.com/nymtech/nym/pull/857) ([jstuczyn](https://github.com/jstuczyn))
- Removed gateway rewarding and delegation [\#856](https://github.com/nymtech/nym/pull/856) ([jstuczyn](https://github.com/jstuczyn))
- Update feature-request template [\#855](https://github.com/nymtech/nym/pull/855) ([tommyv1987](https://github.com/tommyv1987))
- Update issue templates [\#854](https://github.com/nymtech/nym/pull/854) ([tommyv1987](https://github.com/tommyv1987))
- Overflow checks in release [\#846](https://github.com/nymtech/nym/pull/846) ([jstuczyn](https://github.com/jstuczyn))
- fix delegate success overflow [\#842](https://github.com/nymtech/nym/pull/842) ([fmtabbara](https://github.com/fmtabbara))
- Feature NYM wallet webdriverio test [\#841](https://github.com/nymtech/nym/pull/841) ([tommyv1987](https://github.com/tommyv1987))
- Update nym\_wallet.yml [\#840](https://github.com/nymtech/nym/pull/840) ([tommyv1987](https://github.com/tommyv1987))
- Feature/vouchers [\#837](https://github.com/nymtech/nym/pull/837) ([aniampio](https://github.com/aniampio))
- Apply readable ids to elements on Nym Wallet [\#836](https://github.com/nymtech/nym/pull/836) ([tommyv1987](https://github.com/tommyv1987))
- Feature/removal of monitor good nodes [\#833](https://github.com/nymtech/nym/pull/833) ([jstuczyn](https://github.com/jstuczyn))
- Feature/bandwidth token [\#832](https://github.com/nymtech/nym/pull/832) ([neacsu](https://github.com/neacsu))
- update app name and icons [\#831](https://github.com/nymtech/nym/pull/831) ([fmtabbara](https://github.com/fmtabbara))
- Create nym-wallet-tests.yml [\#829](https://github.com/nymtech/nym/pull/829) ([tommyv1987](https://github.com/tommyv1987))
- Updated CODEOWNERS [\#828](https://github.com/nymtech/nym/pull/828) ([jstuczyn](https://github.com/jstuczyn))
- Tauri wallet [\#827](https://github.com/nymtech/nym/pull/827) ([fmtabbara](https://github.com/fmtabbara))
- Flag to only run coconut-related functionalities [\#824](https://github.com/nymtech/nym/pull/824) ([jstuczyn](https://github.com/jstuczyn))
- Change false to true, as for mixnodes [\#822](https://github.com/nymtech/nym/pull/822) ([neacsu](https://github.com/neacsu))
- Feature locked client-side bandwidth metering [\#820](https://github.com/nymtech/nym/pull/820) ([jstuczyn](https://github.com/jstuczyn))
- Fixed most recent nightly clippy warnings [\#817](https://github.com/nymtech/nym/pull/817) ([jstuczyn](https://github.com/jstuczyn))
- Feature/resending rewards on timeout [\#810](https://github.com/nymtech/nym/pull/810) ([jstuczyn](https://github.com/jstuczyn))
- Feature/coconut feature [\#805](https://github.com/nymtech/nym/pull/805) ([jstuczyn](https://github.com/jstuczyn))
- Tokenomics rewards [\#802](https://github.com/nymtech/nym/pull/802) ([durch](https://github.com/durch))
- Rocket picking up environment from Rocket.toml again [\#801](https://github.com/nymtech/nym/pull/801) ([jstuczyn](https://github.com/jstuczyn))
- Remove migration code [\#796](https://github.com/nymtech/nym/pull/796) ([neacsu](https://github.com/neacsu))
- Removes code of executed migrations [\#793](https://github.com/nymtech/nym/pull/793) ([jstuczyn](https://github.com/jstuczyn))
- Bugfix/validator api windows build [\#791](https://github.com/nymtech/nym/pull/791) ([jstuczyn](https://github.com/jstuczyn))
- Removed SQLx offline mode artifact [\#790](https://github.com/nymtech/nym/pull/790) ([jstuczyn](https://github.com/jstuczyn))
- Created getters for AccountData [\#787](https://github.com/nymtech/nym/pull/787) ([jstuczyn](https://github.com/jstuczyn))
- Feature/migrate hidden delegations [\#786](https://github.com/nymtech/nym/pull/786) ([neacsu](https://github.com/neacsu))
- Feature/persistent gateway storage [\#784](https://github.com/nymtech/nym/pull/784) ([jstuczyn](https://github.com/jstuczyn))
- Replaced unwrap\_or\_else with unwrap\_or\_default [\#780](https://github.com/nymtech/nym/pull/780) ([jstuczyn](https://github.com/jstuczyn))
- Add block\_height method to Delegation [\#778](https://github.com/nymtech/nym/pull/778) ([durch](https://github.com/durch))
- Make fee helpers public [\#777](https://github.com/nymtech/nym/pull/777) ([durch](https://github.com/durch))
- re-enable bonding [\#776](https://github.com/nymtech/nym/pull/776) ([fmtabbara](https://github.com/fmtabbara))
- Explorer-api: add API resource to show the delegations for each mix node [\#774](https://github.com/nymtech/nym/pull/774) ([mmsinclair](https://github.com/mmsinclair))
- add app alert [\#772](https://github.com/nymtech/nym/pull/772) ([fmtabbara](https://github.com/fmtabbara))
- Migrate legacy delegation data [\#771](https://github.com/nymtech/nym/pull/771) ([durch](https://github.com/durch))
- Adding deps for building the Tauri wallet under Ubuntu [\#770](https://github.com/nymtech/nym/pull/770) ([futurechimp](https://github.com/futurechimp))
- remove alert [\#767](https://github.com/nymtech/nym/pull/767) ([fmtabbara](https://github.com/fmtabbara))
- Feature/consumable bandwidth [\#766](https://github.com/nymtech/nym/pull/766) ([neacsu](https://github.com/neacsu))
- Update coconut-rs and use hash\_to\_scalar from there [\#765](https://github.com/nymtech/nym/pull/765) ([neacsu](https://github.com/neacsu))
- Feature/active sets [\#764](https://github.com/nymtech/nym/pull/764) ([jstuczyn](https://github.com/jstuczyn))
- add app alert banner [\#762](https://github.com/nymtech/nym/pull/762) ([fmtabbara](https://github.com/fmtabbara))
- Updated cosmos-sdk [\#761](https://github.com/nymtech/nym/pull/761) ([jstuczyn](https://github.com/jstuczyn))
- Feature/bond blockstamp [\#760](https://github.com/nymtech/nym/pull/760) ([neacsu](https://github.com/neacsu))
- Feature/revert migration code [\#759](https://github.com/nymtech/nym/pull/759) ([neacsu](https://github.com/neacsu))
- Bump next from 11.1.0 to 11.1.1 in /wallet-web [\#758](https://github.com/nymtech/nym/pull/758) ([dependabot[bot]](https://github.com/apps/dependabot))
- Add block\_height in the Delegation structure as well [\#757](https://github.com/nymtech/nym/pull/757) ([neacsu](https://github.com/neacsu))
- Feature/add blockstamp [\#756](https://github.com/nymtech/nym/pull/756) ([neacsu](https://github.com/neacsu))
- NetworkMonitorBuilder - starting the monitor after rocket has launched [\#754](https://github.com/nymtech/nym/pull/754) ([jstuczyn](https://github.com/jstuczyn))
- Enabled validators api argument [\#753](https://github.com/nymtech/nym/pull/753) ([jstuczyn](https://github.com/jstuczyn))
- Correctly bounding nominator of uptime calculation [\#752](https://github.com/nymtech/nym/pull/752) ([jstuczyn](https://github.com/jstuczyn))
- Fixed argument parsing for ipv6 'good' topology [\#751](https://github.com/nymtech/nym/pull/751) ([jstuczyn](https://github.com/jstuczyn))
- Feature/rust rewarding [\#750](https://github.com/nymtech/nym/pull/750) ([jstuczyn](https://github.com/jstuczyn))
- Revert "Migration commit, will be reverted after the testnet contract… [\#749](https://github.com/nymtech/nym/pull/749) ([neacsu](https://github.com/neacsu))
- Feature/get own delegations [\#748](https://github.com/nymtech/nym/pull/748) ([neacsu](https://github.com/neacsu))
- Feature/more reliable uptime calculation [\#747](https://github.com/nymtech/nym/pull/747) ([jstuczyn](https://github.com/jstuczyn))
- Update template toml key [\#746](https://github.com/nymtech/nym/pull/746) ([neacsu](https://github.com/neacsu))
- Feature/cred after handshake [\#745](https://github.com/nymtech/nym/pull/745) ([neacsu](https://github.com/neacsu))
- Reinstate the POST method blind\_sign [\#744](https://github.com/nymtech/nym/pull/744) ([neacsu](https://github.com/neacsu))
- explorer-api: add pending field to port check response [\#742](https://github.com/nymtech/nym/pull/742) ([mmsinclair](https://github.com/mmsinclair))
- Feature/use delegation rates [\#741](https://github.com/nymtech/nym/pull/741) ([neacsu](https://github.com/neacsu))
- Feature/copy to clipboard [\#740](https://github.com/nymtech/nym/pull/740) ([fmtabbara](https://github.com/fmtabbara))
- Feature/update wallet with stake rates [\#739](https://github.com/nymtech/nym/pull/739) ([neacsu](https://github.com/neacsu))
- Add stake reward rates and bump version of client [\#738](https://github.com/nymtech/nym/pull/738) ([neacsu](https://github.com/neacsu))
- Bump next from 10.1.3 to 11.1.0 in /wallet-web [\#737](https://github.com/nymtech/nym/pull/737) ([dependabot[bot]](https://github.com/apps/dependabot))
- Feature/nymd client integration [\#736](https://github.com/nymtech/nym/pull/736) ([jstuczyn](https://github.com/jstuczyn))
- Bug/fix parking lot on wasm [\#735](https://github.com/nymtech/nym/pull/735) ([neacsu](https://github.com/neacsu))
- Explorer API: add new HTTP resource to decorate mix nodes with geoip locations [\#734](https://github.com/nymtech/nym/pull/734) ([mmsinclair](https://github.com/mmsinclair))
- Feature/completing nymd client api [\#732](https://github.com/nymtech/nym/pull/732) ([jstuczyn](https://github.com/jstuczyn))
- Explorer API - add port check and node description/stats proxy [\#731](https://github.com/nymtech/nym/pull/731) ([mmsinclair](https://github.com/mmsinclair))
- Feature/nymd client fee handling [\#730](https://github.com/nymtech/nym/pull/730) ([jstuczyn](https://github.com/jstuczyn))
- Update DelegationCheck.tsx [\#725](https://github.com/nymtech/nym/pull/725) ([jessgess](https://github.com/jessgess))
- Rust nymd/cosmwasm client [\#724](https://github.com/nymtech/nym/pull/724) ([jstuczyn](https://github.com/jstuczyn))
- Removed wasm feature bypassing cyclic dependencies [\#723](https://github.com/nymtech/nym/pull/723) ([jstuczyn](https://github.com/jstuczyn))
- Updated used sphinx dependency to the most recent revision [\#722](https://github.com/nymtech/nym/pull/722) ([jstuczyn](https://github.com/jstuczyn))
- update state management and validation [\#721](https://github.com/nymtech/nym/pull/721) ([fmtabbara](https://github.com/fmtabbara))
- Add Network Explorer API [\#720](https://github.com/nymtech/nym/pull/720) ([futurechimp](https://github.com/futurechimp))
- Feature/superbuild [\#719](https://github.com/nymtech/nym/pull/719) ([jstuczyn](https://github.com/jstuczyn))
- remove console log [\#718](https://github.com/nymtech/nym/pull/718) ([fmtabbara](https://github.com/fmtabbara))
- Bug/form validation [\#715](https://github.com/nymtech/nym/pull/715) ([fmtabbara](https://github.com/fmtabbara))
- Warnings with identities of good nodes failing checks [\#714](https://github.com/nymtech/nym/pull/714) ([jstuczyn](https://github.com/jstuczyn))
- Removed all sphinx key caching from mixnodes and gateways [\#713](https://github.com/nymtech/nym/pull/713) ([jstuczyn](https://github.com/jstuczyn))
- Feature/receive coins page + UI tweaks [\#704](https://github.com/nymtech/nym/pull/704) ([fmtabbara](https://github.com/fmtabbara))
- Allow users to sign out [\#703](https://github.com/nymtech/nym/pull/703) ([fmtabbara](https://github.com/fmtabbara))
- Feature/docker improvements [\#702](https://github.com/nymtech/nym/pull/702) ([neacsu](https://github.com/neacsu))
- Exposed API port on the validator [\#701](https://github.com/nymtech/nym/pull/701) ([jstuczyn](https://github.com/jstuczyn))
- Feature/default values [\#700](https://github.com/nymtech/nym/pull/700) ([neacsu](https://github.com/neacsu))
- Cleaned up dependencies of our typescript client [\#699](https://github.com/nymtech/nym/pull/699) ([jstuczyn](https://github.com/jstuczyn))
- Bond and delegation alerts [\#698](https://github.com/nymtech/nym/pull/698) ([fmtabbara](https://github.com/fmtabbara))
- Bugfix/network monitor version check [\#697](https://github.com/nymtech/nym/pull/697) ([jstuczyn](https://github.com/jstuczyn))
- Feature/other containers [\#692](https://github.com/nymtech/nym/pull/692) ([neacsu](https://github.com/neacsu))
- Using validator API instead of nymd [\#690](https://github.com/nymtech/nym/pull/690) ([futurechimp](https://github.com/futurechimp))
- Hang coconut issuance off the validator-api [\#679](https://github.com/nymtech/nym/pull/679) ([durch](https://github.com/durch))
- Update hmac and blake3 [\#673](https://github.com/nymtech/nym/pull/673) ([durch](https://github.com/durch))
\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
Generated
+6567 -1170
View File
File diff suppressed because it is too large Load Diff
+62 -33
View File
@@ -1,39 +1,68 @@
[package]
build = "build.rs"
name = "nym-client"
version = "0.2.0"
authors = ["Dave Hrycyszyn <futurechimp@users.noreply.github.com>", "Jędrzej Stuczyński <andrew@nymtech.net>"]
edition = "2018"
# Copyright 2020 - Nym Technologies SA <contact@nymtech.net>
# SPDX-License-Identifier: Apache-2.0
[lib]
name = "nym_client"
path = "src/lib.rs"
[profile.release]
panic = "abort"
opt-level = "s"
overflow-checks = true
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[profile.dev]
panic = "abort"
[dependencies]
base64 = "0.11.0"
clap = "2.33.0"
curve25519-dalek = "1.2.3"
dirs = "2.0.2"
futures = "0.3.1"
hex = "0.4.0"
pem = "0.7.0"
rand = "0.7.2"
rand_distr = "0.2.2"
reqwest = "0.9.22"
serde = { version = "1.0.104", features = ["derive"] }
serde_json = "1.0.44"
sphinx = { path = "../sphinx" }
sfw-provider-requests = { path = "../nym-sfw-provider/sfw-provider-requests" }
tokio = { version = "0.2", features = ["full"] }
tungstenite = "0.9.2"
[workspace]
# putting this explicitly below everything and most likely, the next time we look into it, it will already have a proper release
tokio-tungstenite = { git = "https://github.com/dbcfd/tokio-tungstenite", rev="6dc2018cbfe8fe7ddd75ff977343086503135b38" }
members = [
"clients/client-core",
"clients/native",
"clients/native/websocket-requests",
"clients/socks5",
"clients/tauri-client/src-tauri",
"clients/webassembly",
"common/client-libs/gateway-client",
"common/client-libs/mixnet-client",
"common/client-libs/validator-client",
"common/coconut-interface",
"common/config",
"common/credentials",
"common/crypto",
"common/bandwidth-claim-contract",
"common/mixnet-contract",
"common/mixnode-common",
"common/network-defaults",
"common/nonexhaustive-delayqueue",
"common/nymcoconut",
"common/nymsphinx",
"common/nymsphinx/acknowledgements",
"common/nymsphinx/addressing",
"common/nymsphinx/anonymous-replies",
"common/nymsphinx/chunking",
"common/nymsphinx/cover",
"common/nymsphinx/forwarding",
"common/nymsphinx/framing",
"common/nymsphinx/params",
"common/nymsphinx/types",
"common/pemstore",
"common/socks5/proxy-helpers",
"common/socks5/requests",
"common/topology",
"common/wasm-utils",
"explorer-api",
"gateway",
"gateway/gateway-requests",
"mixnode",
"service-providers/network-requester",
"validator-api",
]
[build-dependencies]
built = "0.3.2"
default-members = [
"clients/native",
"clients/socks5",
# "clients/webassembly",
"gateway",
"service-providers/network-requester",
"mixnode",
"validator-api",
"explorer-api",
]
[dev-dependencies]
mockito = "0.22.0"
exclude = ["explorer", "contracts", "tokenomics-py"]
+201
View File
@@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
+36
View File
@@ -0,0 +1,36 @@
Creative Commons Legal Code
CC0 1.0 Universal
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED HEREUNDER.
Statement of Purpose
The laws of most jurisdictions throughout the world automatically confer exclusive Copyright and Related Rights (defined below) upon the creator and subsequent owner(s) (each and all, an "owner") of an original work of authorship and/or a database (each, a "Work").
Certain owners wish to permanently relinquish those rights to a Work for the purpose of contributing to a commons of creative, cultural and scientific works ("Commons") that the public can reliably and without fear of later claims of infringement build upon, modify, incorporate in other works, reuse and redistribute as freely as possible in any form whatsoever and for any purposes, including without limitation commercial purposes. These owners may contribute to the Commons to promote the ideal of a free culture and the further production of creative, cultural and scientific works, or to gain reputation or greater distribution for their Work in part through the use and efforts of others.
For these and/or other purposes and motivations, and without any expectation of additional consideration or compensation, the person associating CC0 with a Work (the "Affirmer"), to the extent that he or she is an owner of Copyright and Related Rights in the Work, voluntarily elects to apply CC0 to the Work and publicly distribute the Work under its terms, with knowledge of his or her Copyright and Related Rights in the Work and the meaning and intended legal effect of CC0 on those rights.
1. Copyright and Related Rights. A Work made available under CC0 may be protected by copyright and related or neighboring rights ("Copyright and Related Rights"). Copyright and Related Rights include, but are not limited to, the following:
i. the right to reproduce, adapt, distribute, perform, display, communicate, and translate a Work;
ii. moral rights retained by the original author(s) and/or performer(s);
iii. publicity and privacy rights pertaining to a person's image or likeness depicted in a Work;
iv. rights protecting against unfair competition in regards to a Work, subject to the limitations in paragraph 4(a), below;
v. rights protecting the extraction, dissemination, use and reuse of data in a Work;
vi. database rights (such as those arising under Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, and under any national implementation thereof, including any amended or successor version of such directive); and
vii. other similar, equivalent or corresponding rights throughout the world based on applicable law or treaty, and any national implementations thereof.
2. Waiver. To the greatest extent permitted by, but not in contravention of, applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and unconditionally waives, abandons, and surrenders all of Affirmer's Copyright and Related Rights and associated claims and causes of action, whether now known or unknown (including existing as well as future claims and causes of action), in the Work (i) in all territories worldwide, (ii) for the maximum duration provided by applicable law or treaty (including future time extensions), (iii) in any current or future medium and for any number of copies, and (iv) for any purpose whatsoever, including without limitation commercial, advertising or promotional purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each member of the public at large and to the detriment of Affirmer's heirs and successors, fully intending that such Waiver shall not be subject to revocation, rescission, cancellation, termination, or any other legal or equitable action to disrupt the quiet enjoyment of the Work by the public as contemplated by Affirmer's express Statement of Purpose.
3. Public License Fallback. Should any part of the Waiver for any reason be judged legally invalid or ineffective under applicable law, then the Waiver shall be preserved to the maximum extent permitted taking into account Affirmer's express Statement of Purpose. In addition, to the extent the Waiver is so judged Affirmer hereby grants to each affected person a royalty-free, non transferable, non sublicensable, non exclusive, irrevocable and unconditional license to exercise Affirmer's Copyright and Related Rights in the Work (i) in all territories worldwide, (ii) for the maximum duration provided by applicable law or treaty (including future time extensions), (iii) in any current or future medium and for any number of copies, and (iv) for any purpose whatsoever, including without limitation commercial, advertising or promotional purposes (the "License"). The License shall be deemed effective as of the date CC0 was applied by Affirmer to the Work. Should any part of the License for any reason be judged legally invalid or ineffective under applicable law, such partial invalidity or ineffectiveness shall not invalidate the remainder of the License, and in such case Affirmer hereby affirms that he or she will not (i) exercise any of his or her remaining Copyright and Related Rights in the Work or (ii) assert any associated claims and causes of action with respect to the Work, in either case contrary to Affirmer's express Statement of Purpose.
4. Limitations and Disclaimers.
a. No trademark or patent rights held by Affirmer are waived, abandoned, surrendered, licensed or otherwise affected by this document.
b. Affirmer offers the Work as-is and makes no representations or warranties of any kind concerning the Work, express, implied, statutory or otherwise, including without limitation warranties of title, merchantability, fitness for a particular purpose, non infringement, or the absence of latent or other defects, accuracy, or the present or absence of errors, whether or not discoverable, all to the greatest extent permissible under applicable law.
c. Affirmer disclaims responsibility for clearing rights of other persons that may apply to the Work or any use thereof, including without limitation any person's Copyright and Related Rights in the Work. Further, Affirmer disclaims responsibility for obtaining any necessary consents, permissions or other rights required for any use of the Work.
d. Affirmer understands and acknowledges that Creative Commons is not a party to this document and has no duty or obligation with respect to this CC0 or use of the Work.
Standard License Header
There is no standard license header for the license
+14
View File
@@ -0,0 +1,14 @@
MIT License
Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Standard License Header
There is no standard license header for the license
+45
View File
@@ -0,0 +1,45 @@
all: clippy-all test fmt
happy: clippy-happy test fmt
clippy-all: clippy-all-main clippy-all-contracts clippy-all-wallet
clippy-happy: clippy-happy-main clippy-happy-contracts clippy-happy-wallet
test: test-main test-contracts test-wallet
fmt: fmt-main fmt-contracts fmt-wallet
clippy-happy-main:
cargo clippy
clippy-happy-contracts:
cargo clippy --manifest-path contracts/Cargo.toml --target wasm32-unknown-unknown
clippy-happy-wallet:
cargo clippy --manifest-path nym-wallet/Cargo.toml
clippy-all-main:
cargo clippy --all-features -- -D warnings
clippy-all-contracts:
cargo clippy --manifest-path contracts/Cargo.toml --all-features --target wasm32-unknown-unknown -- -D warnings
clippy-all-wallet:
cargo clippy --manifest-path nym-wallet/Cargo.toml --all-features -- -D warnings
test-main:
cargo test --all-features
test-contracts:
cargo test --manifest-path contracts/Cargo.toml --all-features
test-wallet:
cargo test --manifest-path nym-wallet/Cargo.toml --all-features
fmt-main:
cargo fmt --all
fmt-contracts:
cargo fmt --manifest-path contracts/Cargo.toml --all
fmt-wallet:
cargo fmt --manifest-path nym-wallet/Cargo.toml --all
wasm:
RUSTFLAGS='-C link-arg=-s' cargo build --manifest-path contracts/Cargo.toml --release --target wasm32-unknown-unknown
+72 -6
View File
@@ -1,10 +1,76 @@
# Nym Client
<!--
Copyright 2020 - Nym Technologies SA <contact@nymtech.net>
SPDX-License-Identifier: Apache-2.0
-->
The Nym Client communicates with the remote, decentralised nodes which make up the Nym system as a whole.
## The Nym Privacy Platform
It needs to handle communication with 3 types of remote nodes. Here's the development status of each:
The platform is composed of multiple Rust crates. Top-level executable binary crates include:
- [ ] Directory nodes
- [ ] Mix nodes
- [ ] Validator nodes
* nym-mixnode - shuffles [Sphinx](https://github.com/nymtech/sphinx) packets together to provide privacy against network-level attackers.
* nym-client - an executable which you can build into your own applications. Use it for interacting with Nym nodes.
* nym-socks5-client - a Socks5 proxy you can run on your machine, and use with existing applications
* nym-gateway - acts sort of like a mailbox for mixnet messages, removing the need for directly delivery to potentially offline or firewalled devices.
* nym-network-monitor - sends packets through the full system to check that they are working as expected, and stores node uptime histories as the basis of a rewards system ("mixmining" or "proof-of-mixing").
* nym-explorer - a (projected) block explorer and (existing) mixnet viewer.
* nym-wallet - a desktop wallet implemented using the [Tauri](https://tauri.studio/en/docs/about/intro) framework.
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg?style=for-the-badge)](https://opensource.org/licenses/Apache-2.0)
[![Build Status](https://img.shields.io/github/workflow/status/nymtech/nym/Continuous%20integration/develop?style=for-the-badge&logo=github-actions)](https://github.com/nymtech/nym/actions?query=branch%3Adevelop)
### Building
Platform build instructions are available on [our docs site](https://nymtech.net/docs/0.11.0/overview/index/).
### Developing
There's a `.env.sample-dev` file provided which you can rename to `.env` if you want convenient logging, backtrace, or other environment variables pre-set. The `.env` file is ignored so you don't need to worry about checking it in.
### Developer chat
You can chat to us in [Keybase](https://keybase.io). Download their chat app, then click **Teams -> Join a team**. Type **nymtech.friends** into the team name and hit **continue**. For general chat, hang out in the **#general** channel. Our development takes places in the **#dev** channel. Node operators should be in the **#node-operators** channel.
### Rewards
Node, node operator and delegator rewards are determined according to the principles laid out in the section 6 of [Nym Whitepaper](https://nymtech.net/nym-whitepaper.pdf). Below is a TLDR of the variables and formulas involved in calculating the epoch rewards. Initial reward pool is set to 250 million Nym, making the circulating supply 750 million Nym.
|Symbol|Definition|
|---|---|
|<img src="https://render.githubusercontent.com/render/math?math=R">|global share of rewards available, starts at 2% of the reward pool.
|<img src="https://render.githubusercontent.com/render/math?math=R_{i}">|node reward for mixnode `i`.
|<img src="https://render.githubusercontent.com/render/math?math=\sigma_{i}">|ratio of total node stake (node bond + all delegations) to the token circulating supply.
|<img src="https://render.githubusercontent.com/render/math?math=\lambda_{i}">|ratio of stake operator has pledged to their node to the token circulating supply.
|<img src="https://render.githubusercontent.com/render/math?math=\omega_{i}">|fraction of total effort undertaken by node `i`, set to `1/k`.
|<img src="https://render.githubusercontent.com/render/math?math=k">|number of nodes stakeholders are incentivised to create, set by the validators, a matter of governance. Currently determined by the `reward set` size, and set to 720 in testnet Sandbox.
|<img src="https://render.githubusercontent.com/render/math?math=\alpha">|Sybil attack resistance parameter - the higher this parameter is set the stronger the reduction in competitivness gets for a Sybil attacker.
|<img src="https://render.githubusercontent.com/render/math?math=PM_{i}">|declared profit margin of operator `i`, defaults to 10% in.
|<img src="https://render.githubusercontent.com/render/math?math=PF_{i}">|uptime of node `i`, scaled to 0 - 1, for the rewarding epoch
|<img src="https://render.githubusercontent.com/render/math?math=PP_{i}">|cost of operating node `i` for the duration of the rewarding eopoch, set to 40 NYMT.
Node reward for node `i` is determined as:
<img src="https://render.githubusercontent.com/render/math?math=R_{i}=PF_{i} \cdot R \cdot (\sigma^'_{i} \cdot \omega_{i} \cdot k %2b \alpha \cdot \lambda^'_{i} \cdot \sigma^'_{i} \cdot k)/(1 %2b \alpha)">
where:
<img src="https://render.githubusercontent.com/render/math?math=\sigma^'_{i} = min\{\sigma_{i}, 1/k\}">
and
<img src="https://render.githubusercontent.com/render/math?math=\lambda^'_{i} = min\{\lambda_{i}, 1/k\}">
Operator of node `i` is credited with the following amount:
<img src="https://render.githubusercontent.com/render/math?math=min\{PP_{i},R_{i})\} %2b max\{0, (PM_{i} %2b (1 - PM_{i}) \cdot \lambda_{i}/\delta_{i}) \cdot (R_{i} - PP_{i})\}">
Delegate with stake `s` recieves:
<img src="https://render.githubusercontent.com/render/math?math=max\{0, (1-PM_{i}) \cdot (s^'/\sigma_{i}) \cdot (R_{i} - PP_{i})\}">
where `s'` is stake `s` scaled over total token circulating supply.
### Licensing and copyright information
This program is available as open source under the terms of the Apache 2.0 license. However, some elements are being licensed under CC0-1.0 and MIT. For accurate information, please check individual files.
-5
View File
@@ -1,5 +0,0 @@
use built;
fn main() {
built::write_built_file().expect("Failed to acquire build-time information");
}
+35
View File
@@ -0,0 +1,35 @@
[package]
name = "client-core"
version = "0.12.0"
authors = ["Dave Hrycyszyn <futurechimp@users.noreply.github.com>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
dirs = "3.0"
futures = "0.3"
humantime-serde = "1.0"
log = "0.4"
rand = { version = "0.7.3", features = ["wasm-bindgen"] }
serde = { version = "1.0", features = ["derive"] }
sled = "0.34"
tokio = { version = "1.4", features = ["macros"] }
url = { version ="2.2", features = ["serde"] }
# internal
config = { path = "../../common/config" }
crypto = { path = "../../common/crypto" }
gateway-client = { path = "../../common/client-libs/gateway-client" }
gateway-requests = { path = "../../gateway/gateway-requests" }
nonexhaustive-delayqueue = { path = "../../common/nonexhaustive-delayqueue" }
nymsphinx = { path = "../../common/nymsphinx" }
pemstore = { path = "../../common/pemstore" }
topology = { path = "../../common/topology" }
validator-client = { path = "../../common/client-libs/validator-client" }
[dev-dependencies]
tempfile = "3.1.0"
[features]
coconut = []
@@ -0,0 +1,172 @@
// Copyright 2021 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
use crate::client::mix_traffic::BatchMixMessageSender;
use crate::client::topology_control::TopologyAccessor;
use futures::task::{Context, Poll};
use futures::{Future, Stream, StreamExt};
use log::*;
use nymsphinx::acknowledgements::AckKey;
use nymsphinx::addressing::clients::Recipient;
use nymsphinx::cover::generate_loop_cover_packet;
use nymsphinx::utils::sample_poisson_duration;
use rand::{rngs::OsRng, CryptoRng, Rng};
use std::pin::Pin;
use std::sync::Arc;
use tokio::task::JoinHandle;
use tokio::time;
pub struct LoopCoverTrafficStream<R>
where
R: CryptoRng + Rng,
{
/// Key used to encrypt and decrypt content of an ACK packet.
ack_key: Arc<AckKey>,
/// Average delay an acknowledgement packet is going to get delay at a single mixnode.
average_ack_delay: time::Duration,
/// Average delay a data packet is going to get delay at a single mixnode.
average_packet_delay: time::Duration,
/// Average delay between sending subsequent cover packets.
average_cover_message_sending_delay: time::Duration,
/// Internal state, determined by `average_message_sending_delay`,
/// used to keep track of when a next packet should be sent out.
next_delay: Pin<Box<time::Sleep>>,
/// Channel used for sending prepared sphinx packets to `MixTrafficController` that sends them
/// out to the network without any further delays.
mix_tx: BatchMixMessageSender,
/// Represents full address of this client.
our_full_destination: Recipient,
/// Instance of a cryptographically secure random number generator.
rng: R,
/// Accessor to the common instance of network topology.
topology_access: TopologyAccessor,
}
impl<R> Stream for LoopCoverTrafficStream<R>
where
R: CryptoRng + Rng + Unpin,
{
// Item is only used to indicate we should create a new message rather than actual cover message
// reason being to not introduce unnecessary complexity by having to keep state of topology
// mutex when trying to acquire it. So right now the Stream trait serves as a glorified timer.
// Perhaps this should be changed in the future.
type Item = ();
fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
// it is not yet time to return a message
if self.next_delay.as_mut().poll(cx).is_pending() {
return Poll::Pending;
};
// we know it's time to send a message, so let's prepare delay for the next one
// Get the `now` by looking at the current `delay` deadline
let avg_delay = self.average_cover_message_sending_delay;
let now = self.next_delay.deadline();
let next_poisson_delay = sample_poisson_duration(&mut self.rng, avg_delay);
// The next interval value is `next_poisson_delay` after the one that just
// yielded.
let next = now + next_poisson_delay;
self.next_delay.as_mut().reset(next);
Poll::Ready(Some(()))
}
}
// obviously when we finally make shared rng that is on 'higher' level, this should become
// generic `R`
impl LoopCoverTrafficStream<OsRng> {
pub fn new(
ack_key: Arc<AckKey>,
average_ack_delay: time::Duration,
average_packet_delay: time::Duration,
average_cover_message_sending_delay: time::Duration,
mix_tx: BatchMixMessageSender,
our_full_destination: Recipient,
topology_access: TopologyAccessor,
) -> Self {
let rng = OsRng;
LoopCoverTrafficStream {
ack_key,
average_ack_delay,
average_packet_delay,
average_cover_message_sending_delay,
next_delay: Box::pin(time::sleep(Default::default())),
mix_tx,
our_full_destination,
rng,
topology_access,
}
}
async fn on_new_message(&mut self) {
trace!("next cover message!");
// TODO for way down the line: in very rare cases (during topology update) we might have
// to wait a really tiny bit before actually obtaining the permit hence messing with our
// poisson delay, but is it really a problem?
let topology_permit = self.topology_access.get_read_permit().await;
// the ack is sent back to ourselves (and then ignored)
let topology_ref_option = topology_permit.try_get_valid_topology_ref(
&self.our_full_destination,
Some(&self.our_full_destination),
);
if topology_ref_option.is_none() {
warn!("No valid topology detected - won't send any loop cover message this time");
return;
}
let topology_ref = topology_ref_option.unwrap();
let cover_message = generate_loop_cover_packet(
&mut self.rng,
topology_ref,
&*self.ack_key,
&self.our_full_destination,
self.average_ack_delay,
self.average_packet_delay,
)
.expect("Somehow failed to generate a loop cover message with a valid topology");
// if this one fails, there's no retrying because it means that either:
// - we run out of memory
// - the receiver channel is closed
// in either case there's no recovery and we can only panic
self.mix_tx.unbounded_send(vec![cover_message]).unwrap();
// TODO: I'm not entirely sure whether this is really required, because I'm not 100%
// sure how `yield_now()` works - whether it just notifies the scheduler or whether it
// properly blocks. So to play it on the safe side, just explicitly drop the read permit
drop(topology_permit);
// JS: due to identical logical structure to OutQueueControl::on_message(), this is also
// presumably required to prevent bugs in the future. Exact reason is still unknown to me.
tokio::task::yield_now().await;
}
async fn run(&mut self) {
// we should set initial delay only when we actually start the stream
self.next_delay = Box::pin(time::sleep(sample_poisson_duration(
&mut self.rng,
self.average_cover_message_sending_delay,
)));
while self.next().await.is_some() {
self.on_new_message().await;
}
}
pub fn start(mut self) -> JoinHandle<()> {
tokio::spawn(async move {
self.run().await;
})
}
}
@@ -0,0 +1,33 @@
use futures::channel::mpsc;
use nymsphinx::addressing::clients::Recipient;
use nymsphinx::anonymous_replies::ReplySurb;
pub type InputMessageSender = mpsc::UnboundedSender<InputMessage>;
pub type InputMessageReceiver = mpsc::UnboundedReceiver<InputMessage>;
#[derive(Debug)]
pub enum InputMessage {
Fresh {
recipient: Recipient,
data: Vec<u8>,
with_reply_surb: bool,
},
Reply {
reply_surb: ReplySurb,
data: Vec<u8>,
},
}
impl InputMessage {
pub fn new_fresh(recipient: Recipient, data: Vec<u8>, with_reply_surb: bool) -> Self {
InputMessage::Fresh {
recipient,
data,
with_reply_surb,
}
}
pub fn new_reply(reply_surb: ReplySurb, data: Vec<u8>) -> Self {
InputMessage::Reply { reply_surb, data }
}
}
@@ -0,0 +1,156 @@
// Copyright 2021 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
use crate::config::persistence::key_pathfinder::ClientKeyPathfinder;
use crypto::asymmetric::{encryption, identity};
use gateway_requests::registration::handshake::SharedKeys;
use log::*;
use nymsphinx::acknowledgements::AckKey;
use rand::{CryptoRng, RngCore};
use std::io;
use std::sync::Arc;
// Note: to support key rotation in the future, all keys will require adding an extra smart pointer,
// most likely an AtomicCell, or if it doesn't work as I think it does, a Mutex. Although I think
// AtomicCell includes a Mutex implicitly if the underlying type does not work atomically.
// And I guess there will need to be some mechanism for a grace period when you can still
// use the old key after new one was issued.
// Remember that Arc<T> has Deref implementation for T
pub struct KeyManager {
/// identity key associated with the client instance.
identity_keypair: Arc<identity::KeyPair>,
/// encryption key associated with the client instance.
encryption_keypair: Arc<encryption::KeyPair>,
/// shared key derived with the gateway during "registration handshake"
gateway_shared_key: Option<Arc<SharedKeys>>,
/// key used for producing and processing acknowledgement packets.
ack_key: Arc<AckKey>,
}
// The expected flow of a KeyManager "lifetime" is as follows:
/*
1. ::new() is called during client-init
2. after gateway registration is completed [in init] ::insert_gateway_shared_key() is called
3. ::store_keys() is called before init finishes execution.
4. ::load_keys() is called at the beginning of each subsequent client-run
5. [not implemented] ::rotate_keys() is called periodically during client-run I presume?
*/
impl KeyManager {
// this is actually **NOT** dead code
// I have absolutely no idea why the compiler insists it's unused. The call happens during client::init::execute
#[allow(dead_code)]
/// Creates new instance of a [`KeyManager`]
pub fn new<R>(rng: &mut R) -> Self
where
R: RngCore + CryptoRng,
{
KeyManager {
identity_keypair: Arc::new(identity::KeyPair::new(rng)),
encryption_keypair: Arc::new(encryption::KeyPair::new(rng)),
gateway_shared_key: None,
ack_key: Arc::new(AckKey::new(rng)),
}
}
// this is actually **NOT** dead code
// I have absolutely no idea why the compiler insists it's unused. The call happens during client::init::execute
#[allow(dead_code)]
/// After shared key with the gateway is derived, puts its ownership to this instance of a [`KeyManager`].
pub fn insert_gateway_shared_key(&mut self, gateway_shared_key: Arc<SharedKeys>) {
self.gateway_shared_key = Some(gateway_shared_key)
}
/// Loads previously stored keys from the disk.
pub fn load_keys(client_pathfinder: &ClientKeyPathfinder) -> io::Result<Self> {
let identity_keypair: identity::KeyPair =
pemstore::load_keypair(&pemstore::KeyPairPath::new(
client_pathfinder.private_identity_key().to_owned(),
client_pathfinder.public_identity_key().to_owned(),
))?;
let encryption_keypair: encryption::KeyPair =
pemstore::load_keypair(&pemstore::KeyPairPath::new(
client_pathfinder.private_encryption_key().to_owned(),
client_pathfinder.public_encryption_key().to_owned(),
))?;
let gateway_shared_key: SharedKeys =
pemstore::load_key(&client_pathfinder.gateway_shared_key().to_owned())?;
let ack_key: AckKey = pemstore::load_key(&client_pathfinder.ack_key().to_owned())?;
// TODO: ack key is never stored so it is generated now. But perhaps it should be stored
// after all for consistency sake?
Ok(KeyManager {
identity_keypair: Arc::new(identity_keypair),
encryption_keypair: Arc::new(encryption_keypair),
gateway_shared_key: Some(Arc::new(gateway_shared_key)),
ack_key: Arc::new(ack_key),
})
}
// this is actually **NOT** dead code
// I have absolutely no idea why the compiler insists it's unused. The call happens during client::init::execute
#[allow(dead_code)]
/// Stores all available keys on the disk.
// While perhaps there is no much point in storing the `AckKey` on the disk,
// it is done so for the consistency sake so that you wouldn't require an rng instance
// during `load_keys` to generate the said key.
pub fn store_keys(&self, client_pathfinder: &ClientKeyPathfinder) -> io::Result<()> {
pemstore::store_keypair(
self.identity_keypair.as_ref(),
&pemstore::KeyPairPath::new(
client_pathfinder.private_identity_key().to_owned(),
client_pathfinder.public_identity_key().to_owned(),
),
)?;
pemstore::store_keypair(
self.encryption_keypair.as_ref(),
&pemstore::KeyPairPath::new(
client_pathfinder.private_encryption_key().to_owned(),
client_pathfinder.public_encryption_key().to_owned(),
),
)?;
pemstore::store_key(self.ack_key.as_ref(), client_pathfinder.ack_key())?;
match self.gateway_shared_key.as_ref() {
None => warn!("No gateway shared key available to store!"),
Some(gate_key) => {
pemstore::store_key(gate_key.as_ref(), client_pathfinder.gateway_shared_key())?
}
}
Ok(())
}
/// Gets an atomically reference counted pointer to [`identity::KeyPair`].
pub fn identity_keypair(&self) -> Arc<identity::KeyPair> {
Arc::clone(&self.identity_keypair)
}
/// Gets an atomically reference counted pointer to [`encryption::KeyPair`].
pub fn encryption_keypair(&self) -> Arc<encryption::KeyPair> {
Arc::clone(&self.encryption_keypair)
}
/// Gets an atomically reference counted pointer to [`SharedKey`].
// since this function is not fully public, it is not expected to be used externally and
// hence it's up to us to ensure it's called in correct context
pub fn gateway_shared_key(&self) -> Arc<SharedKeys> {
Arc::clone(
self.gateway_shared_key
.as_ref()
.expect("tried to unwrap empty gateway key!"),
)
}
/// Gets an atomically reference counted pointer to [`AckKey`].
pub fn ack_key(&self) -> Arc<AckKey> {
Arc::clone(&self.ack_key)
}
}
@@ -0,0 +1,79 @@
// Copyright 2021 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
use futures::channel::mpsc;
use futures::StreamExt;
use gateway_client::GatewayClient;
use log::*;
use nymsphinx::forwarding::packet::MixPacket;
use tokio::task::JoinHandle;
pub type BatchMixMessageSender = mpsc::UnboundedSender<Vec<MixPacket>>;
pub type BatchMixMessageReceiver = mpsc::UnboundedReceiver<Vec<MixPacket>>;
const MAX_FAILURE_COUNT: usize = 100;
pub struct MixTrafficController {
// TODO: most likely to be replaced by some higher level construct as
// later on gateway_client will need to be accessible by other entities
gateway_client: GatewayClient,
mix_rx: BatchMixMessageReceiver,
// TODO: this is temporary work-around.
// in long run `gateway_client` will be moved away from `MixTrafficController` anyway.
consecutive_gateway_failure_count: usize,
}
impl MixTrafficController {
pub fn new(
mix_rx: BatchMixMessageReceiver,
gateway_client: GatewayClient,
) -> MixTrafficController {
MixTrafficController {
gateway_client,
mix_rx,
consecutive_gateway_failure_count: 0,
}
}
async fn on_messages(&mut self, mut mix_packets: Vec<MixPacket>) {
debug_assert!(!mix_packets.is_empty());
let result = if mix_packets.len() == 1 {
let mix_packet = mix_packets.pop().unwrap();
self.gateway_client.send_mix_packet(mix_packet).await
} else {
self.gateway_client
.batch_send_mix_packets(mix_packets)
.await
};
match result {
Err(e) => {
error!("Failed to send sphinx packet(s) to the gateway! - {:?}", e);
self.consecutive_gateway_failure_count += 1;
if self.consecutive_gateway_failure_count == MAX_FAILURE_COUNT {
// todo: in the future this should initiate a 'graceful' shutdown or try
// to reconnect?
panic!("failed to send sphinx packet to the gateway {} times in a row - assuming the gateway is dead. Can't do anything about it yet :(", MAX_FAILURE_COUNT)
}
}
Ok(_) => {
trace!("We *might* have managed to forward sphinx packet(s) to the gateway!");
self.consecutive_gateway_failure_count = 0;
}
}
}
pub async fn run(&mut self) {
while let Some(mix_packets) = self.mix_rx.next().await {
self.on_messages(mix_packets).await;
}
}
pub fn start(mut self) -> JoinHandle<()> {
tokio::spawn(async move {
self.run().await;
})
}
}
+8
View File
@@ -0,0 +1,8 @@
pub mod cover_traffic_stream;
pub mod inbound_messages;
pub mod key_manager;
pub mod mix_traffic;
pub mod real_messages_control;
pub mod received_buffer;
pub mod reply_key_storage;
pub mod topology_control;
@@ -0,0 +1,76 @@
// Copyright 2021 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
use super::action_controller::{Action, ActionSender};
use futures::StreamExt;
use gateway_client::AcknowledgementReceiver;
use log::*;
use nymsphinx::{
acknowledgements::{identifier::recover_identifier, AckKey},
chunking::fragment::{FragmentIdentifier, COVER_FRAG_ID},
};
use std::sync::Arc;
/// Module responsible for listening for any data resembling acknowledgements from the network
/// and firing actions to remove them from the 'Pending' state.
pub(super) struct AcknowledgementListener {
ack_key: Arc<AckKey>,
ack_receiver: AcknowledgementReceiver,
action_sender: ActionSender,
}
impl AcknowledgementListener {
pub(super) fn new(
ack_key: Arc<AckKey>,
ack_receiver: AcknowledgementReceiver,
action_sender: ActionSender,
) -> Self {
AcknowledgementListener {
ack_key,
ack_receiver,
action_sender,
}
}
async fn on_ack(&mut self, ack_content: Vec<u8>) {
debug!("Received an ack");
let frag_id = match recover_identifier(&self.ack_key, &ack_content)
.map(FragmentIdentifier::try_from_bytes)
{
Some(Ok(frag_id)) => frag_id,
_ => {
warn!("Received invalid ACK!"); // should we do anything else about that?
return;
}
};
// if we received an ack for cover message or a reply there will be nothing to remove,
// because nothing was inserted in the first place
if frag_id == COVER_FRAG_ID {
trace!("Received an ack for a cover message - no need to do anything");
return;
} else if frag_id.is_reply() {
info!("Received an ack for a reply message - no need to do anything! (don't know what to do!)");
// TODO: probably there will need to be some extra procedure here, something to notify
// user that his reply reached the recipient (since we got an ack)
return;
}
trace!("Received {} from the mix network", frag_id);
self.action_sender
.unbounded_send(Action::new_remove(frag_id))
.unwrap();
}
pub(super) async fn run(&mut self) {
debug!("Started AcknowledgementListener");
while let Some(acks) = self.ack_receiver.next().await {
// realistically we would only be getting one ack at the time
for ack in acks {
self.on_ack(ack).await;
}
}
error!("TODO: error msg. Or maybe panic?")
}
}
@@ -0,0 +1,264 @@
// Copyright 2021 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
use super::PendingAcknowledgement;
use crate::client::real_messages_control::acknowledgement_control::RetransmissionRequestSender;
use futures::channel::mpsc::{self, UnboundedReceiver, UnboundedSender};
use futures::StreamExt;
use log::*;
use nonexhaustive_delayqueue::{Expired, NonExhaustiveDelayQueue, QueueKey, TimerError};
use nymsphinx::chunking::fragment::FragmentIdentifier;
use nymsphinx::Delay as SphinxDelay;
use std::collections::HashMap;
use std::sync::Arc;
use std::time::Duration;
pub(crate) type ActionSender = UnboundedSender<Action>;
// The actual data being sent off as well as potential key to the delay queue
type PendingAckEntry = (Arc<PendingAcknowledgement>, Option<QueueKey>);
// we can either:
// - have a completely new set of packets we just sent and need to create entries for
// - received an ack so we want to remove an entry
// - start a retransmission timer for sending the packet into the network (on either first try or retransmission)
// - update the internal sphinx delay of an expired packet
pub(crate) enum Action {
/// Inserts new `PendingAcknowledgement`s into the 'shared' state.
/// Initiated by `InputMessageListener`
InsertPending(Vec<PendingAcknowledgement>),
/// Removes given `PendingAcknowledgement` from the 'shared' state. Also cancels the retransmission timer.
/// Initiated by `AcknowledgementListener`
RemovePending(FragmentIdentifier),
/// Starts the retransmission timer on given `PendingAcknowledgement` with the `Duration` based on
/// its internal data.
/// Initiated by `SentNotificationListener`
/// Can also be initiated by `RetransmissionRequestListener` in the rare cases of invalid Topology.
StartTimer(FragmentIdentifier),
/// Updates the expected delay of given `PendingAcknowledgement` with the new provided `SphinxDelay`.
/// Initiated by `RetransmissionRequestListener`
UpdateDelay(FragmentIdentifier, SphinxDelay),
}
impl Action {
pub(crate) fn new_insert(pending_acks: Vec<PendingAcknowledgement>) -> Self {
Action::InsertPending(pending_acks)
}
pub(crate) fn new_remove(frag_id: FragmentIdentifier) -> Self {
Action::RemovePending(frag_id)
}
pub(crate) fn new_start_timer(frag_id: FragmentIdentifier) -> Self {
Action::StartTimer(frag_id)
}
pub(crate) fn new_update_delay(frag_id: FragmentIdentifier, delay: SphinxDelay) -> Self {
Action::UpdateDelay(frag_id, delay)
}
}
/// Configurable parameters of the `ActionController`
pub(super) struct Config {
/// Given ack timeout in the form a * BASE_DELAY + b, it specifies the additive part `b`
ack_wait_addition: Duration,
/// Given ack timeout in the form a * BASE_DELAY + b, it specifies the multiplier `a`
ack_wait_multiplier: f64,
}
impl Config {
pub(super) fn new(ack_wait_addition: Duration, ack_wait_multiplier: f64) -> Self {
Config {
ack_wait_addition,
ack_wait_multiplier,
}
}
}
pub(super) struct ActionController {
/// Configurable parameters of the `ActionController`
config: Config,
/// Contains a map between `FragmentIdentifier` and its full `PendingAcknowledgement` as well as
/// key to its `AckDelayQueue` entry if it was started.
pending_acks_data: HashMap<FragmentIdentifier, PendingAckEntry>,
// This structure ensures that we will EITHER handle expired timer or a received action and NEVER both
// at the same time hence getting rid of one possible race condition that we suffered from in the
// previous version.
/// DelayQueue with all `PendingAcknowledgement` that are waiting to be either received or
/// retransmitted if their timer fires up.
pending_acks_timers: NonExhaustiveDelayQueue<FragmentIdentifier>,
/// Channel for receiving `Action`s from other modules.
incoming_actions: UnboundedReceiver<Action>,
/// Channel for notifying `RetransmissionRequestListener` about expired acknowledgements.
retransmission_sender: RetransmissionRequestSender,
}
impl ActionController {
pub(super) fn new(
config: Config,
retransmission_sender: RetransmissionRequestSender,
) -> (Self, ActionSender) {
let (sender, receiver) = mpsc::unbounded();
(
ActionController {
config,
pending_acks_data: HashMap::new(),
pending_acks_timers: NonExhaustiveDelayQueue::new(),
incoming_actions: receiver,
retransmission_sender,
},
sender,
)
}
fn handle_insert(&mut self, pending_acks: Vec<PendingAcknowledgement>) {
for pending_ack in pending_acks {
let frag_id = pending_ack.message_chunk.fragment_identifier();
trace!("{} is inserted", frag_id);
if self
.pending_acks_data
.insert(frag_id, (Arc::new(pending_ack), None))
.is_some()
{
panic!("Tried to insert duplicate pending ack")
}
}
}
fn handle_start_timer(&mut self, frag_id: FragmentIdentifier) {
trace!("{} is starting its timer", frag_id);
if let Some((pending_ack_data, queue_key)) = self.pending_acks_data.get_mut(&frag_id) {
if queue_key.is_some() {
// this branch should be IMPOSSIBLE under ANY condition. It would imply starting
// timer TWICE for the SAME PendingAcknowledgement
panic!("Tried to start an already started ack timer!")
}
let timeout = (pending_ack_data.delay.clone() * self.config.ack_wait_multiplier)
.to_duration()
+ self.config.ack_wait_addition;
let new_queue_key = self.pending_acks_timers.insert(frag_id, timeout);
*queue_key = Some(new_queue_key)
} else {
debug!(
"Tried to START TIMER on pending ack that is already gone! - {}",
frag_id
);
}
}
fn handle_remove(&mut self, frag_id: FragmentIdentifier) {
trace!("{} is getting removed", frag_id);
match self.pending_acks_data.remove(&frag_id) {
None => {
debug!(
"Tried to REMOVE pending ack that is already gone! - {}",
frag_id
);
}
Some((_, queue_key)) => {
if let Some(queue_key) = queue_key {
// there are no possible checks here, we must GUARANTEE that we NEVER try
// to remove an entry that doesn't exist (and we MUST GUARANTEE that
// we do not have a stale key)
self.pending_acks_timers.remove(&queue_key);
// remove timer
} else {
// I'm not 100% sure if having a `None` key is even possible here
// (REMOVE would have to be called before START TIMER),
debug!(
"Tried to REMOVE pending ack without TIMER active - {}",
frag_id
);
}
}
}
}
// initiated basically as a first step of retransmission. At first data has its delay updated
// (as new sphinx packet was created with new expected delivery time)
fn handle_update_delay(&mut self, frag_id: FragmentIdentifier, delay: SphinxDelay) {
trace!("{} is updating its delay", frag_id);
// TODO: is it possible to solve this without either locking or temporarily removing the value?
if let Some((pending_ack_data, queue_key)) = self.pending_acks_data.remove(&frag_id) {
// this Action is triggered by `RetransmissionRequestListener` which held the other potential
// reference to this Arc. HOWEVER, before the Action was pushed onto the queue, the reference
// was dropped hence this unwrap is safe.
let mut inner_data = Arc::try_unwrap(pending_ack_data).unwrap();
inner_data.update_delay(delay);
self.pending_acks_data
.insert(frag_id, (Arc::new(inner_data), queue_key));
} else {
debug!(
"Tried to UPDATE TIMER on pending ack that is already gone! - {}",
frag_id
);
}
}
// note: when the entry expires it's automatically removed from pending_acks_timers
fn handle_expired_ack_timer(
&mut self,
expired_ack: Result<Expired<FragmentIdentifier>, TimerError>,
) {
// I'm honestly not sure how to handle it, because getting it means other things in our
// system are already misbehaving. If we ever see this panic, then I guess we should worry
// about it. Perhaps just reschedule it at later point?
let frag_id = expired_ack
.expect("Tokio timer returned an error!")
.into_inner();
trace!("{} has expired", frag_id);
if let Some((pending_ack_data, queue_key)) = self.pending_acks_data.get_mut(&frag_id) {
if queue_key.is_none() {
// this branch should be IMPOSSIBLE under ANY condition. It would imply the timeout
// happened before it even started.
panic!("Ack expired before it was even scheduled!")
}
*queue_key = None;
// downgrading an arc and then upgrading vs cloning is difference of 30ns vs 15ns
// so it's literally a NO difference while it might prevent us from unnecessarily
// resending data (in maybe 1 in 1 million cases, but it's something)
self.retransmission_sender
.unbounded_send(Arc::downgrade(pending_ack_data))
.unwrap()
} else {
// this shouldn't cause any issues but shouldn't have happened to begin with!
error!("An already removed pending ack has expired")
}
}
fn process_action(&mut self, action: Action) {
match action {
Action::InsertPending(pending_acks) => self.handle_insert(pending_acks),
Action::RemovePending(frag_id) => self.handle_remove(frag_id),
Action::StartTimer(frag_id) => self.handle_start_timer(frag_id),
Action::UpdateDelay(frag_id, delay) => self.handle_update_delay(frag_id, delay),
}
}
pub(super) async fn run(&mut self) {
loop {
// at some point there will be a global shutdown signal here as the third option
tokio::select! {
// we NEVER expect for ANY sender to get dropped so unwrap here is fine
action = self.incoming_actions.next() => self.process_action(action.unwrap()),
// pending ack queue Stream CANNOT return a `None` so unwrap here is fine
expired_ack = self.pending_acks_timers.next() => self.handle_expired_ack_timer(expired_ack.unwrap())
}
}
}
}
@@ -0,0 +1,191 @@
// Copyright 2021 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
use super::action_controller::{Action, ActionSender};
use super::PendingAcknowledgement;
use crate::client::reply_key_storage::ReplyKeyStorage;
use crate::client::{
inbound_messages::{InputMessage, InputMessageReceiver},
real_messages_control::real_traffic_stream::{BatchRealMessageSender, RealMessage},
topology_control::TopologyAccessor,
};
use futures::StreamExt;
use log::*;
use nymsphinx::anonymous_replies::ReplySurb;
use nymsphinx::preparer::MessagePreparer;
use nymsphinx::{acknowledgements::AckKey, addressing::clients::Recipient};
use rand::{CryptoRng, Rng};
use std::sync::Arc;
/// Module responsible for dealing with the received messages: splitting them, creating acknowledgements,
/// putting everything into sphinx packets, etc.
/// It also makes an initial sending attempt for said messages.
pub(super) struct InputMessageListener<R>
where
R: CryptoRng + Rng,
{
ack_key: Arc<AckKey>,
ack_recipient: Recipient,
input_receiver: InputMessageReceiver,
message_preparer: MessagePreparer<R>,
action_sender: ActionSender,
real_message_sender: BatchRealMessageSender,
topology_access: TopologyAccessor,
reply_key_storage: ReplyKeyStorage,
}
impl<R> InputMessageListener<R>
where
R: CryptoRng + Rng,
{
// at this point I'm not entirely sure how to deal with this warning without
// some considerable refactoring
#[allow(clippy::too_many_arguments)]
pub(super) fn new(
ack_key: Arc<AckKey>,
ack_recipient: Recipient,
input_receiver: InputMessageReceiver,
message_preparer: MessagePreparer<R>,
action_sender: ActionSender,
real_message_sender: BatchRealMessageSender,
topology_access: TopologyAccessor,
reply_key_storage: ReplyKeyStorage,
) -> Self {
InputMessageListener {
ack_key,
ack_recipient,
input_receiver,
message_preparer,
action_sender,
real_message_sender,
topology_access,
reply_key_storage,
}
}
// we require topology for replies to generate surb_acks
async fn handle_reply(&mut self, reply_surb: ReplySurb, data: Vec<u8>) -> Option<RealMessage> {
let topology_permit = self.topology_access.get_read_permit().await;
let topology = match topology_permit.try_get_valid_topology_ref(&self.ack_recipient, None) {
Some(topology_ref) => topology_ref,
None => {
warn!("Could not process the message - the network topology is invalid");
return None;
}
};
match self
.message_preparer
.prepare_reply_for_use(data, reply_surb, topology, &self.ack_key)
.await
{
Ok((mix_packet, reply_id)) => {
// TODO: later probably write pending ack here
// and deal with them....
// ... somehow
Some(RealMessage::new(mix_packet, reply_id))
}
Err(err) => {
// TODO: should we have some mechanism to indicate to the user that the `reply_surb`
// could be reused since technically it wasn't used up here?
warn!("failed to deal with received reply surb - {:?}", err);
None
}
}
}
async fn handle_fresh_message(
&mut self,
recipient: Recipient,
content: Vec<u8>,
with_reply_surb: bool,
) -> Option<Vec<RealMessage>> {
let topology_permit = self.topology_access.get_read_permit().await;
let topology = match topology_permit
.try_get_valid_topology_ref(&self.ack_recipient, Some(&recipient))
{
Some(topology_ref) => topology_ref,
None => {
warn!("Could not process the message - the network topology is invalid");
return None;
}
};
// split the message, attach optional reply surb
let (split_message, reply_key) = self
.message_preparer
.prepare_and_split_message(content, with_reply_surb, topology)
.expect("somehow the topology was invalid after all!");
if let Some(reply_key) = reply_key {
self.reply_key_storage
.insert_encryption_key(reply_key)
.expect("Failed to insert surb reply key to the store!")
}
// encrypt chunks, put them inside sphinx packets and generate acks
let mut pending_acks = Vec::with_capacity(split_message.len());
let mut real_messages = Vec::with_capacity(split_message.len());
for message_chunk in split_message {
// we need to clone it because we need to keep it in memory in case we had to retransmit
// it. And then we'd need to recreate entire ACK again.
let chunk_clone = message_chunk.clone();
let prepared_fragment = self
.message_preparer
.prepare_chunk_for_sending(chunk_clone, topology, &self.ack_key, &recipient)
.await
.unwrap();
real_messages.push(RealMessage::new(
prepared_fragment.mix_packet,
message_chunk.fragment_identifier(),
));
pending_acks.push(PendingAcknowledgement::new(
message_chunk,
prepared_fragment.total_delay,
recipient,
));
}
// tells the controller to put this into the hashmap
self.action_sender
.unbounded_send(Action::new_insert(pending_acks))
.unwrap();
Some(real_messages)
}
async fn on_input_message(&mut self, msg: InputMessage) {
let real_messages = match msg {
InputMessage::Fresh {
recipient,
data,
with_reply_surb,
} => {
self.handle_fresh_message(recipient, data, with_reply_surb)
.await
}
InputMessage::Reply { reply_surb, data } => self
.handle_reply(reply_surb, data)
.await
.map(|message| vec![message]),
};
// there's no point in trying to send nothing
if let Some(real_messages) = real_messages {
// tells real message sender (with the poisson timer) to send this to the mix network
self.real_message_sender
.unbounded_send(real_messages)
.unwrap();
}
}
pub(super) async fn run(&mut self) {
debug!("Started InputMessageListener");
while let Some(input_msg) = self.input_receiver.next().await {
self.on_input_message(input_msg).await;
}
error!("TODO: error msg. Or maybe panic?")
}
}
@@ -0,0 +1,276 @@
// Copyright 2021 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
use self::{
acknowledgement_listener::AcknowledgementListener, action_controller::ActionController,
input_message_listener::InputMessageListener,
retransmission_request_listener::RetransmissionRequestListener,
sent_notification_listener::SentNotificationListener,
};
use super::real_traffic_stream::BatchRealMessageSender;
use crate::client::reply_key_storage::ReplyKeyStorage;
use crate::client::{inbound_messages::InputMessageReceiver, topology_control::TopologyAccessor};
use futures::channel::mpsc;
use gateway_client::AcknowledgementReceiver;
use log::*;
use nymsphinx::{
acknowledgements::AckKey,
addressing::clients::Recipient,
chunking::fragment::{Fragment, FragmentIdentifier},
preparer::MessagePreparer,
Delay as SphinxDelay,
};
use rand::{CryptoRng, Rng};
use std::{
sync::{Arc, Weak},
time::Duration,
};
use tokio::task::JoinHandle;
mod acknowledgement_listener;
mod action_controller;
mod input_message_listener;
mod retransmission_request_listener;
mod sent_notification_listener;
/// Channel used for indicating that the particular `Fragment` should be retransmitted.
type RetransmissionRequestSender = mpsc::UnboundedSender<Weak<PendingAcknowledgement>>;
/// Channel used for receiving data about particular `Fragment` that should be retransmitted.
type RetransmissionRequestReceiver = mpsc::UnboundedReceiver<Weak<PendingAcknowledgement>>;
/// Channel used for signalling that the particular `Fragment` (associated with the `FragmentIdentifier`)
/// is done being delayed and is about to be sent to the mix network.
pub(super) type SentPacketNotificationSender = mpsc::UnboundedSender<FragmentIdentifier>;
/// Channel used for receiving signals about the particular `Fragment` (associated with the `FragmentIdentifier`)
/// that it is about to be sent to the mix network and its timeout timer should be started.
type SentPacketNotificationReceiver = mpsc::UnboundedReceiver<FragmentIdentifier>;
/// Structure representing a data `Fragment` that is on-route to the specified `Recipient`
#[derive(Debug)]
pub(crate) struct PendingAcknowledgement {
message_chunk: Fragment,
delay: SphinxDelay,
recipient: Recipient,
}
impl PendingAcknowledgement {
/// Creates new instance of `PendingAcknowledgement` using the provided data.
fn new(message_chunk: Fragment, delay: SphinxDelay, recipient: Recipient) -> Self {
PendingAcknowledgement {
message_chunk,
delay,
recipient,
}
}
fn update_delay(&mut self, new_delay: SphinxDelay) {
self.delay = new_delay;
}
}
/// AcknowledgementControllerConnectors represents set of channels for communication with
/// other parts of the system in order to support acknowledgements and retransmission.
pub(super) struct AcknowledgementControllerConnectors {
/// Channel used for forwarding prepared sphinx messages into the poisson sender
/// to be sent to the mix network.
real_message_sender: BatchRealMessageSender,
/// Channel used for receiving raw messages from a client. The messages need to be put
/// into sphinx packets first.
input_receiver: InputMessageReceiver,
/// Channel used for receiving notification about particular packet being sent off to the
/// mix network (i.e. it was done being delayed by whatever value was determined in the poisson
/// sender)
sent_notifier: SentPacketNotificationReceiver,
/// Channel used for receiving acknowledgements from the mix network.
ack_receiver: AcknowledgementReceiver,
}
impl AcknowledgementControllerConnectors {
pub(super) fn new(
real_message_sender: BatchRealMessageSender,
input_receiver: InputMessageReceiver,
sent_notifier: SentPacketNotificationReceiver,
ack_receiver: AcknowledgementReceiver,
) -> Self {
AcknowledgementControllerConnectors {
real_message_sender,
input_receiver,
sent_notifier,
ack_receiver,
}
}
}
/// Configurable parameters of the `AcknowledgementController`
pub(super) struct Config {
/// Given ack timeout in the form a * BASE_DELAY + b, it specifies the additive part `b`
ack_wait_addition: Duration,
/// Given ack timeout in the form a * BASE_DELAY + b, it specifies the multiplier `a`
ack_wait_multiplier: f64,
/// Average delay an acknowledgement packet is going to get delayed at a single mixnode.
average_ack_delay: Duration,
/// Average delay a data packet is going to get delayed at a single mixnode.
average_packet_delay: Duration,
}
impl Config {
pub(super) fn new(
ack_wait_addition: Duration,
ack_wait_multiplier: f64,
average_ack_delay: Duration,
average_packet_delay: Duration,
) -> Self {
Config {
ack_wait_addition,
ack_wait_multiplier,
average_ack_delay,
average_packet_delay,
}
}
}
pub(super) struct AcknowledgementController<R>
where
R: CryptoRng + Rng,
{
acknowledgement_listener: Option<AcknowledgementListener>,
input_message_listener: Option<InputMessageListener<R>>,
retransmission_request_listener: Option<RetransmissionRequestListener<R>>,
sent_notification_listener: Option<SentNotificationListener>,
action_controller: Option<ActionController>,
}
impl<R> AcknowledgementController<R>
where
R: 'static + CryptoRng + Rng + Clone + Send,
{
pub(super) fn new(
config: Config,
rng: R,
topology_access: TopologyAccessor,
ack_key: Arc<AckKey>,
ack_recipient: Recipient,
reply_key_storage: ReplyKeyStorage,
connectors: AcknowledgementControllerConnectors,
) -> Self {
let (retransmission_tx, retransmission_rx) = mpsc::unbounded();
let action_config =
action_controller::Config::new(config.ack_wait_addition, config.ack_wait_multiplier);
let (action_controller, action_sender) =
ActionController::new(action_config, retransmission_tx);
let message_preparer = MessagePreparer::new(
rng,
ack_recipient,
config.average_packet_delay,
config.average_ack_delay,
);
// will listen for any acks coming from the network
let acknowledgement_listener = AcknowledgementListener::new(
Arc::clone(&ack_key),
connectors.ack_receiver,
action_sender.clone(),
);
// will listen for any new messages from the client
let input_message_listener = InputMessageListener::new(
Arc::clone(&ack_key),
ack_recipient,
connectors.input_receiver,
message_preparer.clone(),
action_sender.clone(),
connectors.real_message_sender.clone(),
topology_access.clone(),
reply_key_storage,
);
// will listen for any ack timeouts and trigger retransmission
let retransmission_request_listener = RetransmissionRequestListener::new(
Arc::clone(&ack_key),
ack_recipient,
message_preparer,
action_sender.clone(),
connectors.real_message_sender,
retransmission_rx,
topology_access,
);
// will listen for events indicating the packet was sent through the network so that
// the retransmission timer should be started.
let sent_notification_listener =
SentNotificationListener::new(connectors.sent_notifier, action_sender);
AcknowledgementController {
acknowledgement_listener: Some(acknowledgement_listener),
input_message_listener: Some(input_message_listener),
retransmission_request_listener: Some(retransmission_request_listener),
sent_notification_listener: Some(sent_notification_listener),
action_controller: Some(action_controller),
}
}
pub(super) async fn run(&mut self) {
let mut acknowledgement_listener = self.acknowledgement_listener.take().unwrap();
let mut input_message_listener = self.input_message_listener.take().unwrap();
let mut retransmission_request_listener =
self.retransmission_request_listener.take().unwrap();
let mut sent_notification_listener = self.sent_notification_listener.take().unwrap();
let mut action_controller = self.action_controller.take().unwrap();
// the below are log messages are errors as at the current stage we do not expect any of
// the task to ever finish. This will of course change once we introduce
// graceful shutdowns.
let ack_listener_fut = tokio::spawn(async move {
acknowledgement_listener.run().await;
error!("The acknowledgement listener has finished execution!");
acknowledgement_listener
});
let input_listener_fut = tokio::spawn(async move {
input_message_listener.run().await;
error!("The input listener has finished execution!");
input_message_listener
});
let retransmission_req_fut = tokio::spawn(async move {
retransmission_request_listener.run().await;
error!("The retransmission request listener has finished execution!");
retransmission_request_listener
});
let sent_notification_fut = tokio::spawn(async move {
sent_notification_listener.run().await;
error!("The sent notification listener has finished execution!");
sent_notification_listener
});
let action_controller_fut = tokio::spawn(async move {
action_controller.run().await;
error!("The controller has finished execution!");
action_controller
});
// technically we don't have to bring `AcknowledgementController` back to a valid state
// but we can do it, so why not? Perhaps it might be useful if we wanted to allow
// for restarts of certain modules without killing the entire process.
self.acknowledgement_listener = Some(ack_listener_fut.await.unwrap());
self.input_message_listener = Some(input_listener_fut.await.unwrap());
self.retransmission_request_listener = Some(retransmission_req_fut.await.unwrap());
self.sent_notification_listener = Some(sent_notification_fut.await.unwrap());
self.action_controller = Some(action_controller_fut.await.unwrap());
}
#[allow(dead_code)]
pub(super) fn start(mut self) -> JoinHandle<Self> {
tokio::spawn(async move {
self.run().await;
self
})
}
}
@@ -0,0 +1,130 @@
// Copyright 2021 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
use super::action_controller::{Action, ActionSender};
use super::PendingAcknowledgement;
use super::RetransmissionRequestReceiver;
use crate::client::{
real_messages_control::real_traffic_stream::{BatchRealMessageSender, RealMessage},
topology_control::TopologyAccessor,
};
use futures::StreamExt;
use log::*;
use nymsphinx::preparer::MessagePreparer;
use nymsphinx::{acknowledgements::AckKey, addressing::clients::Recipient};
use rand::{CryptoRng, Rng};
use std::sync::{Arc, Weak};
// responsible for packet retransmission upon fired timer
pub(super) struct RetransmissionRequestListener<R>
where
R: CryptoRng + Rng,
{
ack_key: Arc<AckKey>,
ack_recipient: Recipient,
message_preparer: MessagePreparer<R>,
action_sender: ActionSender,
real_message_sender: BatchRealMessageSender,
request_receiver: RetransmissionRequestReceiver,
topology_access: TopologyAccessor,
}
impl<R> RetransmissionRequestListener<R>
where
R: CryptoRng + Rng,
{
pub(super) fn new(
ack_key: Arc<AckKey>,
ack_recipient: Recipient,
message_preparer: MessagePreparer<R>,
action_sender: ActionSender,
real_message_sender: BatchRealMessageSender,
request_receiver: RetransmissionRequestReceiver,
topology_access: TopologyAccessor,
) -> Self {
RetransmissionRequestListener {
ack_key,
ack_recipient,
message_preparer,
action_sender,
real_message_sender,
request_receiver,
topology_access,
}
}
async fn on_retransmission_request(&mut self, timed_out_ack: Weak<PendingAcknowledgement>) {
let timed_out_ack = match timed_out_ack.upgrade() {
Some(timed_out_ack) => timed_out_ack,
None => {
debug!("We received an ack JUST as we were about to retransmit [1]");
return;
}
};
let packet_recipient = &timed_out_ack.recipient;
let chunk_clone = timed_out_ack.message_chunk.clone();
let frag_id = chunk_clone.fragment_identifier();
let topology_permit = self.topology_access.get_read_permit().await;
let topology_ref = match topology_permit
.try_get_valid_topology_ref(&self.ack_recipient, Some(packet_recipient))
{
Some(topology_ref) => topology_ref,
None => {
warn!("Could not retransmit the packet - the network topology is invalid");
// we NEED to start timer here otherwise we will have this guy permanently stuck in memory
self.action_sender
.unbounded_send(Action::new_start_timer(frag_id))
.unwrap();
return;
}
};
let prepared_fragment = self
.message_preparer
.prepare_chunk_for_sending(chunk_clone, topology_ref, &self.ack_key, packet_recipient)
.await
.unwrap();
// if we have the ONLY strong reference to the ack data, it means it was removed from the
// pending acks
if Arc::strong_count(&timed_out_ack) == 1 {
// while we were messing with topology, wrapping data in sphinx, etc. we actually received
// this ack after all! no need to retransmit then
debug!("We received an ack JUST as we were about to retransmit [2]");
return;
}
// we no longer need the reference - let's drop it so that if somehow `UpdateTimer` action
// reached the controller before this function terminated, the controller would not panic.
drop(timed_out_ack);
let new_delay = prepared_fragment.total_delay;
// We know this update will be reflected by the `StartTimer` Action performed when this
// message is sent through the mix network.
// Reason being: UpdateTimer is now pushed onto the Action queue and `StartTimer` will
// only be pushed when the below `RealMessage` (which we are about to create)
// is sent to the `OutQueueControl` and has gone through its internal queue
// with the additional poisson delay.
// And since Actions are executed in order `UpdateTimer` will HAVE TO be executed before `StartTimer`
self.action_sender
.unbounded_send(Action::new_update_delay(frag_id, new_delay))
.unwrap();
// send to `OutQueueControl` to eventually send to the mix network
self.real_message_sender
.unbounded_send(vec![RealMessage::new(
prepared_fragment.mix_packet,
frag_id,
)])
.unwrap();
}
pub(super) async fn run(&mut self) {
debug!("Started RetransmissionRequestListener");
while let Some(timed_out_ack) = self.request_receiver.next().await {
self.on_retransmission_request(timed_out_ack).await;
}
error!("TODO: error msg. Or maybe panic?")
}
}
@@ -0,0 +1,52 @@
// Copyright 2021 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
use super::action_controller::{Action, ActionSender};
use super::SentPacketNotificationReceiver;
use futures::StreamExt;
use log::*;
use nymsphinx::chunking::fragment::{FragmentIdentifier, COVER_FRAG_ID};
/// Module responsible for starting up retransmission timers.
/// It is required because when we send our packet to the `real traffic stream` controlled
/// by a poisson timer, there's no guarantee the message will be sent immediately, so we might
/// accidentally fire retransmission way quicker than we should have.
pub(super) struct SentNotificationListener {
sent_notifier: SentPacketNotificationReceiver,
action_sender: ActionSender,
}
impl SentNotificationListener {
pub(super) fn new(
sent_notifier: SentPacketNotificationReceiver,
action_sender: ActionSender,
) -> Self {
SentNotificationListener {
sent_notifier,
action_sender,
}
}
async fn on_sent_message(&mut self, frag_id: FragmentIdentifier) {
if frag_id == COVER_FRAG_ID {
trace!("sent off a cover message - no need to start retransmission timer!");
return;
} else if frag_id.is_reply() {
debug!("sent off a reply message - no need to start retransmission timer!");
// TODO: probably there will need to be some extra procedure here, like it would
// be nice to know that our reply actually reached the recipient (i.e. we got the ack)
return;
}
self.action_sender
.unbounded_send(Action::new_start_timer(frag_id))
.unwrap();
}
pub(super) async fn run(&mut self) {
debug!("Started SentNotificationListener");
while let Some(frag_id) = self.sent_notifier.next().await {
self.on_sent_message(frag_id).await;
}
error!("TODO: error msg. Or maybe panic?")
}
}
@@ -0,0 +1,178 @@
// Copyright 2021 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
// INPUT: InputMessage from user
// INPUT2: Acks from mix
// OUTPUT: MixMessage to mix traffic
use self::{
acknowledgement_control::AcknowledgementController, real_traffic_stream::OutQueueControl,
};
use crate::client::real_messages_control::acknowledgement_control::AcknowledgementControllerConnectors;
use crate::client::reply_key_storage::ReplyKeyStorage;
use crate::client::{
inbound_messages::InputMessageReceiver, mix_traffic::BatchMixMessageSender,
topology_control::TopologyAccessor,
};
use futures::channel::mpsc;
use gateway_client::AcknowledgementReceiver;
use log::*;
use nymsphinx::acknowledgements::AckKey;
use nymsphinx::addressing::clients::Recipient;
use rand::{rngs::OsRng, CryptoRng, Rng};
use std::sync::Arc;
use std::time::Duration;
use tokio::task::JoinHandle;
mod acknowledgement_control;
mod real_traffic_stream;
// TODO: ack_key and self_recipient shouldn't really be part of this config
pub struct Config {
/// Key used to decrypt contents of received SURBAcks
ack_key: Arc<AckKey>,
/// Given ack timeout in the form a * BASE_DELAY + b, it specifies the additive part `b`
ack_wait_addition: Duration,
/// Given ack timeout in the form a * BASE_DELAY + b, it specifies the multiplier `a`
ack_wait_multiplier: f64,
/// Address of `this` client.
self_recipient: Recipient,
/// Average delay between sending subsequent packets from this client.
average_message_sending_delay: Duration,
/// Average delay a data packet is going to get delayed at a single mixnode.
average_packet_delay_duration: Duration,
/// Average delay an acknowledgement packet is going to get delayed at a single mixnode.
average_ack_delay_duration: Duration,
}
impl Config {
pub fn new(
ack_key: Arc<AckKey>,
ack_wait_multiplier: f64,
ack_wait_addition: Duration,
average_ack_delay_duration: Duration,
average_message_sending_delay: Duration,
average_packet_delay_duration: Duration,
self_recipient: Recipient,
) -> Self {
Config {
ack_key,
ack_wait_addition,
ack_wait_multiplier,
self_recipient,
average_message_sending_delay,
average_packet_delay_duration,
average_ack_delay_duration,
}
}
}
pub struct RealMessagesController<R>
where
R: CryptoRng + Rng,
{
out_queue_control: Option<OutQueueControl<R>>,
ack_control: Option<AcknowledgementController<R>>,
}
// obviously when we finally make shared rng that is on 'higher' level, this should become
// generic `R`
impl RealMessagesController<OsRng> {
pub fn new(
config: Config,
ack_receiver: AcknowledgementReceiver,
input_receiver: InputMessageReceiver,
mix_sender: BatchMixMessageSender,
topology_access: TopologyAccessor,
reply_key_storage: ReplyKeyStorage,
) -> Self {
let rng = OsRng;
let (real_message_sender, real_message_receiver) = mpsc::unbounded();
let (sent_notifier_tx, sent_notifier_rx) = mpsc::unbounded();
let ack_controller_connectors = AcknowledgementControllerConnectors::new(
real_message_sender,
input_receiver,
sent_notifier_rx,
ack_receiver,
);
let ack_control_config = acknowledgement_control::Config::new(
config.ack_wait_addition,
config.ack_wait_multiplier,
config.average_ack_delay_duration,
config.average_packet_delay_duration,
);
let ack_control = AcknowledgementController::new(
ack_control_config,
rng,
topology_access.clone(),
Arc::clone(&config.ack_key),
config.self_recipient,
reply_key_storage,
ack_controller_connectors,
);
let out_queue_config = real_traffic_stream::Config::new(
config.average_ack_delay_duration,
config.average_packet_delay_duration,
config.average_message_sending_delay,
);
let out_queue_control = OutQueueControl::new(
out_queue_config,
Arc::clone(&config.ack_key),
sent_notifier_tx,
mix_sender,
real_message_receiver,
rng,
config.self_recipient,
topology_access,
);
RealMessagesController {
out_queue_control: Some(out_queue_control),
ack_control: Some(ack_control),
}
}
pub(super) async fn run(&mut self) {
let mut out_queue_control = self.out_queue_control.take().unwrap();
let mut ack_control = self.ack_control.take().unwrap();
// the below are log messages are errors as at the current stage we do not expect any of
// the task to ever finish. This will of course change once we introduce
// graceful shutdowns.
let out_queue_control_fut = tokio::spawn(async move {
out_queue_control.run_out_queue_control().await;
error!("The out queue controller has finished execution!");
out_queue_control
});
let ack_control_fut = tokio::spawn(async move {
ack_control.run().await;
error!("The acknowledgement controller has finished execution!");
ack_control
});
// technically we don't have to bring `RealMessagesController` back to a valid state
// but we can do it, so why not? Perhaps it might be useful if we wanted to allow
// for restarts of certain modules without killing the entire process.
self.out_queue_control = Some(out_queue_control_fut.await.unwrap());
self.ack_control = Some(ack_control_fut.await.unwrap());
}
pub fn start(mut self) -> JoinHandle<Self> {
tokio::spawn(async move {
self.run().await;
self
})
}
}
@@ -0,0 +1,269 @@
// Copyright 2021 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
use crate::client::mix_traffic::BatchMixMessageSender;
use crate::client::real_messages_control::acknowledgement_control::SentPacketNotificationSender;
use crate::client::topology_control::TopologyAccessor;
use futures::channel::mpsc;
use futures::task::{Context, Poll};
use futures::{Future, Stream, StreamExt};
use log::*;
use nymsphinx::acknowledgements::AckKey;
use nymsphinx::addressing::clients::Recipient;
use nymsphinx::chunking::fragment::FragmentIdentifier;
use nymsphinx::cover::generate_loop_cover_packet;
use nymsphinx::forwarding::packet::MixPacket;
use nymsphinx::utils::sample_poisson_duration;
use rand::{CryptoRng, Rng};
use std::collections::VecDeque;
use std::pin::Pin;
use std::sync::Arc;
use std::time::Duration;
use tokio::time;
/// Configurable parameters of the `OutQueueControl`
pub(crate) struct Config {
/// Average delay an acknowledgement packet is going to get delay at a single mixnode.
average_ack_delay: Duration,
/// Average delay a data packet is going to get delay at a single mixnode.
average_packet_delay: Duration,
/// Average delay between sending subsequent packets.
average_message_sending_delay: Duration,
}
impl Config {
pub(crate) fn new(
average_ack_delay: Duration,
average_packet_delay: Duration,
average_message_sending_delay: Duration,
) -> Self {
Config {
average_ack_delay,
average_packet_delay,
average_message_sending_delay,
}
}
}
pub(crate) struct OutQueueControl<R>
where
R: CryptoRng + Rng,
{
/// Configurable parameters of the `ActionController`
config: Config,
/// Key used to encrypt and decrypt content of an ACK packet.
ack_key: Arc<AckKey>,
/// Channel used for notifying of a real packet being sent out. Used to start up retransmission timer.
sent_notifier: SentPacketNotificationSender,
/// Internal state, determined by `average_message_sending_delay`,
/// used to keep track of when a next packet should be sent out.
next_delay: Pin<Box<time::Sleep>>,
/// Channel used for sending prepared sphinx packets to `MixTrafficController` that sends them
/// out to the network without any further delays.
mix_tx: BatchMixMessageSender,
/// Channel used for receiving real, prepared, messages that must be first sufficiently delayed
/// before being sent out into the network.
real_receiver: BatchRealMessageReceiver,
/// Represents full address of this client.
our_full_destination: Recipient,
/// Instance of a cryptographically secure random number generator.
rng: R,
/// Accessor to the common instance of network topology.
topology_access: TopologyAccessor,
/// Buffer containing all real messages received. It is first exhausted before more are pulled.
received_buffer: VecDeque<RealMessage>,
}
pub(crate) struct RealMessage {
mix_packet: MixPacket,
fragment_id: FragmentIdentifier,
}
impl RealMessage {
pub(crate) fn new(mix_packet: MixPacket, fragment_id: FragmentIdentifier) -> Self {
RealMessage {
mix_packet,
fragment_id,
}
}
}
// messages are already prepared, etc. the real point of it is to forward it to mix_traffic
// after sufficient delay
pub(crate) type BatchRealMessageSender = mpsc::UnboundedSender<Vec<RealMessage>>;
type BatchRealMessageReceiver = mpsc::UnboundedReceiver<Vec<RealMessage>>;
pub(crate) enum StreamMessage {
Cover,
Real(Box<RealMessage>),
}
impl<R> Stream for OutQueueControl<R>
where
R: CryptoRng + Rng + Unpin,
{
type Item = StreamMessage;
fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
// it is not yet time to return a message
if self.next_delay.as_mut().poll(cx).is_pending() {
return Poll::Pending;
};
// we know it's time to send a message, so let's prepare delay for the next one
// Get the `now` by looking at the current `delay` deadline
let avg_delay = self.config.average_message_sending_delay;
let now = self.next_delay.deadline();
let next_poisson_delay = sample_poisson_duration(&mut self.rng, avg_delay);
// The next interval value is `next_poisson_delay` after the one that just
// yielded.
let next = now + next_poisson_delay;
self.next_delay.as_mut().reset(next);
// check if we have anything immediately available
if let Some(real_available) = self.received_buffer.pop_front() {
return Poll::Ready(Some(StreamMessage::Real(Box::new(real_available))));
}
// decide what kind of message to send
match Pin::new(&mut self.real_receiver).poll_next(cx) {
// in the case our real message channel stream was closed, we should also indicate we are closed
// (and whoever is using the stream should panic)
Poll::Ready(None) => Poll::Ready(None),
// if there are more messages available, return first one and store the rest
Poll::Ready(Some(real_messages)) => {
self.received_buffer = real_messages.into();
// we MUST HAVE received at least ONE message
Poll::Ready(Some(StreamMessage::Real(Box::new(
self.received_buffer.pop_front().unwrap(),
))))
}
// otherwise construct a dummy one
Poll::Pending => Poll::Ready(Some(StreamMessage::Cover)),
}
}
}
impl<R> OutQueueControl<R>
where
R: CryptoRng + Rng + Unpin,
{
// at this point I'm not entirely sure how to deal with this warning without
// some considerable refactoring
#[allow(clippy::too_many_arguments)]
pub(crate) fn new(
config: Config,
ack_key: Arc<AckKey>,
sent_notifier: SentPacketNotificationSender,
mix_tx: BatchMixMessageSender,
real_receiver: BatchRealMessageReceiver,
rng: R,
our_full_destination: Recipient,
topology_access: TopologyAccessor,
) -> Self {
OutQueueControl {
config,
ack_key,
sent_notifier,
next_delay: Box::pin(time::sleep(Default::default())),
mix_tx,
real_receiver,
our_full_destination,
rng,
topology_access,
received_buffer: VecDeque::with_capacity(0), // we won't be putting any data into this guy directly
}
}
fn sent_notify(&self, frag_id: FragmentIdentifier) {
// well technically the message was not sent just yet, but now it's up to internal
// queues and client load rather than the required delay. So realistically we can treat
// whatever is about to happen as negligible additional delay.
trace!("{} is about to get sent to the mixnet", frag_id);
self.sent_notifier.unbounded_send(frag_id).unwrap();
}
async fn on_message(&mut self, next_message: StreamMessage) {
trace!("created new message");
let next_message = match next_message {
StreamMessage::Cover => {
// TODO for way down the line: in very rare cases (during topology update) we might have
// to wait a really tiny bit before actually obtaining the permit hence messing with our
// poisson delay, but is it really a problem?
let topology_permit = self.topology_access.get_read_permit().await;
// the ack is sent back to ourselves (and then ignored)
let topology_ref_option = topology_permit.try_get_valid_topology_ref(
&self.our_full_destination,
Some(&self.our_full_destination),
);
if topology_ref_option.is_none() {
warn!(
"No valid topology detected - won't send any loop cover message this time"
);
return;
}
let topology_ref = topology_ref_option.unwrap();
generate_loop_cover_packet(
&mut self.rng,
topology_ref,
&*self.ack_key,
&self.our_full_destination,
self.config.average_ack_delay,
self.config.average_packet_delay,
)
.expect("Somehow failed to generate a loop cover message with a valid topology")
}
StreamMessage::Real(real_message) => {
self.sent_notify(real_message.fragment_id);
real_message.mix_packet
}
};
// if this one fails, there's no retrying because it means that either:
// - we run out of memory
// - the receiver channel is closed
// in either case there's no recovery and we can only panic
self.mix_tx.unbounded_send(vec![next_message]).unwrap();
// JS: Not entirely sure why or how it fixes stuff, but without the yield call,
// the UnboundedReceiver [of mix_rx] will not get a chance to read anything
// JS2: Basically it was the case that with high enough rate, the stream had already a next value
// ready and hence was immediately re-scheduled causing other tasks to be starved;
// yield makes it go back the scheduling queue regardless of its value availability
tokio::task::yield_now().await;
}
// Send messages at certain rate and if no real traffic is available, send cover message.
async fn run_normal_out_queue(&mut self) {
// we should set initial delay only when we actually start the stream
self.next_delay = Box::pin(time::sleep(sample_poisson_duration(
&mut self.rng,
self.config.average_message_sending_delay,
)));
while let Some(next_message) = self.next().await {
self.on_message(next_message).await;
}
}
pub(crate) async fn run_out_queue_control(&mut self) {
debug!("Starting out queue controller...");
self.run_normal_out_queue().await
}
}
@@ -0,0 +1,362 @@
// Copyright 2021 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
use crate::client::reply_key_storage::ReplyKeyStorage;
use crypto::asymmetric::encryption;
use crypto::symmetric::stream_cipher;
use crypto::Digest;
use futures::channel::mpsc;
use futures::lock::Mutex;
use futures::StreamExt;
use gateway_client::MixnetMessageReceiver;
use log::*;
use nymsphinx::anonymous_replies::{encryption_key::EncryptionKeyDigest, SurbEncryptionKey};
use nymsphinx::params::{ReplySurbEncryptionAlgorithm, ReplySurbKeyDigestAlgorithm};
use nymsphinx::receiver::{MessageReceiver, MessageRecoveryError, ReconstructedMessage};
use std::collections::HashSet;
use std::sync::Arc;
use tokio::task::JoinHandle;
// Buffer Requests to say "hey, send any reconstructed messages to this channel"
// or to say "hey, I'm going offline, don't send anything more to me. Just buffer them instead"
pub type ReceivedBufferRequestSender = mpsc::UnboundedSender<ReceivedBufferMessage>;
pub type ReceivedBufferRequestReceiver = mpsc::UnboundedReceiver<ReceivedBufferMessage>;
// The channel set for the above
pub type ReconstructedMessagesSender = mpsc::UnboundedSender<Vec<ReconstructedMessage>>;
pub type ReconstructedMessagesReceiver = mpsc::UnboundedReceiver<Vec<ReconstructedMessage>>;
struct ReceivedMessagesBufferInner {
messages: Vec<ReconstructedMessage>,
local_encryption_keypair: Arc<encryption::KeyPair>,
// TODO: looking how it 'looks' here, perhaps `MessageReceiver` should be renamed to something
// else instead.
message_receiver: MessageReceiver,
message_sender: Option<ReconstructedMessagesSender>,
// TODO: this will get cleared upon re-running the client
// but perhaps it should be changed to include timestamps of when the message was reconstructed
// and every now and then remove ids older than X
recently_reconstructed: HashSet<i32>,
}
impl ReceivedMessagesBufferInner {
fn process_received_fragment(&mut self, raw_fragment: Vec<u8>) -> Option<ReconstructedMessage> {
let fragment_data = match self
.message_receiver
.recover_plaintext(self.local_encryption_keypair.private_key(), raw_fragment)
{
Err(e) => {
warn!("failed to recover fragment data: {:?}. The whole underlying message might be corrupted and unrecoverable!", e);
return None;
}
Ok(frag_data) => frag_data,
};
if nymsphinx::cover::is_cover(&fragment_data) {
trace!("The message was a loop cover message! Skipping it");
return None;
}
let fragment = match self.message_receiver.recover_fragment(&fragment_data) {
Err(e) => {
warn!("failed to recover fragment from raw data: {:?}. The whole underlying message might be corrupted and unrecoverable!", e);
return None;
}
Ok(frag) => frag,
};
if self.recently_reconstructed.contains(&fragment.id()) {
debug!("Received a chunk of already re-assembled message ({:?})! It probably got here because the ack got lost", fragment.id());
return None;
}
// if we returned an error the underlying message is malformed in some way
match self.message_receiver.insert_new_fragment(fragment) {
Err(err) => match err {
MessageRecoveryError::MalformedReconstructedMessage(message_sets) => {
// TODO: should we really insert reconstructed sets? could this be abused for some attack?
for set_id in message_sets {
if !self.recently_reconstructed.insert(set_id) {
// or perhaps we should even panic at this point?
error!("Reconstructed another message containing already used set id!")
}
}
None
}
_ => unreachable!(
"no other error kind should have been returned here! If so, it's a bug!"
),
},
Ok(reconstruction_result) => match reconstruction_result {
Some((reconstructed_message, used_sets)) => {
for set_id in used_sets {
if !self.recently_reconstructed.insert(set_id) {
// or perhaps we should even panic at this point?
error!("Reconstructed another message containing already used set id!")
}
}
Some(reconstructed_message)
}
None => None,
},
}
}
}
#[derive(Debug, Clone)]
// Note: you should NEVER create more than a single instance of this using 'new()'.
// You should always use .clone() to create additional instances
struct ReceivedMessagesBuffer {
inner: Arc<Mutex<ReceivedMessagesBufferInner>>,
/// Storage containing keys to all [`ReplySURB`]s ever sent out that we did not receive back.
// There's no need to put it behind a Mutex since it's already properly concurrent
reply_key_storage: ReplyKeyStorage,
}
impl ReceivedMessagesBuffer {
fn new(
local_encryption_keypair: Arc<encryption::KeyPair>,
reply_key_storage: ReplyKeyStorage,
) -> Self {
ReceivedMessagesBuffer {
inner: Arc::new(Mutex::new(ReceivedMessagesBufferInner {
messages: Vec::new(),
local_encryption_keypair,
message_receiver: MessageReceiver::new(),
message_sender: None,
recently_reconstructed: HashSet::new(),
})),
reply_key_storage,
}
}
async fn disconnect_sender(&mut self) {
let mut guard = self.inner.lock().await;
if guard.message_sender.is_none() {
// in theory we could just ignore it, but that situation should have never happened
// in the first place, so this way we at least know we have an important bug to fix
panic!("trying to disconnect non-existent sender!")
}
guard.message_sender = None;
}
async fn connect_sender(&mut self, sender: ReconstructedMessagesSender) {
let mut guard = self.inner.lock().await;
if guard.message_sender.is_some() {
// in theory we could just ignore it, but that situation should have never happened
// in the first place, so this way we at least know we have an important bug to fix
panic!("trying overwrite an existing sender!")
}
// while we're at it, also empty the buffer if we happened to receive anything while
// no sender was connected
let stored_messages = std::mem::take(&mut guard.messages);
if !stored_messages.is_empty() {
if let Err(err) = sender.unbounded_send(stored_messages) {
error!(
"The sender channel we just received is already invalidated - {:?}",
err
);
// put the values back to the buffer
// the returned error has two fields: err: SendError and val: T,
// where val is the value that was failed to get sent;
// it's returned by the `into_inner` call
guard.messages = err.into_inner();
return;
}
}
guard.message_sender = Some(sender);
}
async fn add_reconstructed_messages(&mut self, msgs: Vec<ReconstructedMessage>) {
debug!("Adding {:?} new messages to the buffer!", msgs.len());
trace!("Adding new messages to the buffer! {:?}", msgs);
self.inner.lock().await.messages.extend(msgs)
}
fn process_received_reply(
reply_ciphertext: &[u8],
reply_key: SurbEncryptionKey,
) -> Option<ReconstructedMessage> {
let zero_iv = stream_cipher::zero_iv::<ReplySurbEncryptionAlgorithm>();
let mut reply_msg = stream_cipher::decrypt::<ReplySurbEncryptionAlgorithm>(
reply_key.inner(),
&zero_iv,
reply_ciphertext,
);
if let Err(err) = MessageReceiver::remove_padding(&mut reply_msg) {
warn!("Received reply had malformed padding! - {:?}", err);
None
} else {
// TODO: perhaps having to say it doesn't have a surb an indication the type should be changed?
Some(ReconstructedMessage {
message: reply_msg,
reply_surb: None,
})
}
}
async fn handle_new_received(&mut self, msgs: Vec<Vec<u8>>) {
debug!(
"Processing {:?} new message that might get added to the buffer!",
msgs.len()
);
let mut completed_messages = Vec::new();
let mut inner_guard = self.inner.lock().await;
let reply_surb_digest_size = ReplySurbKeyDigestAlgorithm::output_size();
// first check if this is a reply or a chunked message
// TODO: verify with @AP if this way of doing it is safe or whether it could
// cause some attacks due to, I don't know, stupid edge case collisions?
// Update: this DOES introduce a possible leakage: https://github.com/nymtech/nym/issues/296
for msg in msgs {
let possible_key_digest =
EncryptionKeyDigest::clone_from_slice(&msg[..reply_surb_digest_size]);
// check first `HasherOutputSize` bytes if they correspond to known encryption key
// if yes - this is a reply message
// TODO: this might be a bottleneck - since the keys are stored on disk we, presumably,
// are doing a disk operation every single received fragment
if let Some(reply_encryption_key) = self
.reply_key_storage
.get_and_remove_encryption_key(possible_key_digest)
.expect("storage operation failed!")
{
if let Some(completed_message) = Self::process_received_reply(
&msg[reply_surb_digest_size..],
reply_encryption_key,
) {
completed_messages.push(completed_message)
}
} else {
// otherwise - it's a 'normal' message
if let Some(completed_message) = inner_guard.process_received_fragment(msg) {
completed_messages.push(completed_message)
}
}
}
if !completed_messages.is_empty() {
if let Some(sender) = &inner_guard.message_sender {
trace!("Sending reconstructed messages to announced sender");
if let Err(err) = sender.unbounded_send(completed_messages) {
warn!("The reconstructed message receiver went offline without explicit notification (relevant error: - {:?})", err);
// make sure to drop the lock to not deadlock
// (it is required by `add_reconstructed_messages`)
inner_guard.message_sender = None;
drop(inner_guard);
self.add_reconstructed_messages(err.into_inner()).await;
}
} else {
// make sure to drop the lock to not deadlock
// (it is required by `add_reconstructed_messages`)
drop(inner_guard);
trace!("No sender available - buffering reconstructed messages");
self.add_reconstructed_messages(completed_messages).await;
}
}
}
}
pub enum ReceivedBufferMessage {
// Signals a websocket connection (or a native implementation) was established and we should stop buffering messages,
// and instead send them directly to the received channel
ReceiverAnnounce(ReconstructedMessagesSender),
// Explicit signal that Receiver connection will no longer accept messages
ReceiverDisconnect,
}
struct RequestReceiver {
received_buffer: ReceivedMessagesBuffer,
query_receiver: ReceivedBufferRequestReceiver,
}
impl RequestReceiver {
fn new(
received_buffer: ReceivedMessagesBuffer,
query_receiver: ReceivedBufferRequestReceiver,
) -> Self {
RequestReceiver {
received_buffer,
query_receiver,
}
}
fn start(mut self) -> JoinHandle<()> {
tokio::spawn(async move {
while let Some(request) = self.query_receiver.next().await {
match request {
ReceivedBufferMessage::ReceiverAnnounce(sender) => {
self.received_buffer.connect_sender(sender).await;
}
ReceivedBufferMessage::ReceiverDisconnect => {
self.received_buffer.disconnect_sender().await
}
}
}
})
}
}
struct FragmentedMessageReceiver {
received_buffer: ReceivedMessagesBuffer,
mixnet_packet_receiver: MixnetMessageReceiver,
}
impl FragmentedMessageReceiver {
fn new(
received_buffer: ReceivedMessagesBuffer,
mixnet_packet_receiver: MixnetMessageReceiver,
) -> Self {
FragmentedMessageReceiver {
received_buffer,
mixnet_packet_receiver,
}
}
fn start(mut self) -> JoinHandle<()> {
tokio::spawn(async move {
while let Some(new_messages) = self.mixnet_packet_receiver.next().await {
self.received_buffer.handle_new_received(new_messages).await;
}
})
}
}
pub struct ReceivedMessagesBufferController {
fragmented_message_receiver: FragmentedMessageReceiver,
request_receiver: RequestReceiver,
}
impl ReceivedMessagesBufferController {
pub fn new(
local_encryption_keypair: Arc<encryption::KeyPair>,
query_receiver: ReceivedBufferRequestReceiver,
mixnet_packet_receiver: MixnetMessageReceiver,
reply_key_storage: ReplyKeyStorage,
) -> Self {
let received_buffer =
ReceivedMessagesBuffer::new(local_encryption_keypair, reply_key_storage);
ReceivedMessagesBufferController {
fragmented_message_receiver: FragmentedMessageReceiver::new(
received_buffer.clone(),
mixnet_packet_receiver,
),
request_receiver: RequestReceiver::new(received_buffer, query_receiver),
}
}
pub fn start(self) {
// TODO: should we do anything with JoinHandle(s) returned by start methods?
self.fragmented_message_receiver.start();
self.request_receiver.start();
}
}
@@ -0,0 +1,94 @@
// Copyright 2021 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
use log::*;
use nymsphinx::anonymous_replies::{
encryption_key::EncryptionKeyDigest, encryption_key::Unsigned, SurbEncryptionKey,
SurbEncryptionKeySize,
};
use std::path::Path;
#[derive(Debug)]
pub enum ReplyKeyStorageError {
DbReadError(sled::Error),
DbWriteError(sled::Error),
DbOpenError(sled::Error),
}
/// Permanent storage for keys in all sent [`ReplySURB`]
///
/// Each sent out [`ReplySURB`] has a new key associated with it that is going to be used for
/// payload encryption. In order to -decrypt whatever reply we receive, we need to know which
/// key to use for that purpose. We do it based on received `H(t)` which has to be included
/// with each reply.
/// Moreover, there is no restriction when the [`ReplySURB`] might get used so we need to
/// have a permanent storage for all the keys that we might ever see in the future.
#[derive(Debug, Clone)]
pub struct ReplyKeyStorage {
db: sled::Db,
}
impl ReplyKeyStorage {
pub fn load<P: AsRef<Path>>(path: P) -> Result<Self, ReplyKeyStorageError> {
let db = match sled::open(path) {
Err(e) => return Err(ReplyKeyStorageError::DbOpenError(e)),
Ok(db) => db,
};
Ok(ReplyKeyStorage { db })
}
fn read_encryption_key(&self, raw_key: sled::IVec) -> SurbEncryptionKey {
let key_bytes_ref = raw_key.as_ref();
// if this fails it means we have some database corruption and we
// absolutely can't continue
if key_bytes_ref.len() != SurbEncryptionKeySize::to_usize() {
error!("REPLY KEY STORAGE DATA CORRUPTION - ENCRYPTION KEY HAS INVALID LENGTH");
panic!("REPLY KEY STORAGE DATA CORRUPTION - ENCRYPTION KEY HAS INVALID LENGTH");
}
// this can only fail if the bytes have invalid length but we already asserted it
SurbEncryptionKey::try_from_bytes(key_bytes_ref).unwrap()
}
// TOOD: perhaps we could also store some part of original message here too?
pub fn insert_encryption_key(
&mut self,
encryption_key: SurbEncryptionKey,
) -> Result<(), ReplyKeyStorageError> {
let digest = encryption_key.compute_digest();
let insertion_result = match self.db.insert(digest.to_vec(), encryption_key.to_bytes()) {
Err(e) => Err(ReplyKeyStorageError::DbWriteError(e)),
Ok(existing_key) => {
if existing_key.is_some() {
panic!("HASH COLLISION DETECTED")
};
Ok(())
}
};
// TODO: perhaps we could implement some batching mechanism to avoid frequent flushes?
self.db.flush().unwrap();
insertion_result
}
// Once we use key once, we do not expect to use it again
pub fn get_and_remove_encryption_key(
&self,
key_digest: EncryptionKeyDigest,
) -> Result<Option<SurbEncryptionKey>, ReplyKeyStorageError> {
let removal_result = match self.db.remove(&key_digest.to_vec()) {
Err(e) => Err(ReplyKeyStorageError::DbReadError(e)),
Ok(existing_key) => {
Ok(existing_key.map(|existing_key| self.read_encryption_key(existing_key)))
}
};
// TODO: not sure how to feel about flushing it every single time here...
// same with insertion
self.db.flush().unwrap();
removal_result
}
}
@@ -0,0 +1,314 @@
// Copyright 2021 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
use log::*;
use nymsphinx::addressing::clients::Recipient;
use nymsphinx::params::DEFAULT_NUM_MIX_HOPS;
use rand::seq::SliceRandom;
use rand::thread_rng;
use std::ops::Deref;
use std::sync::Arc;
use std::time;
use std::time::Duration;
use tokio::sync::{RwLock, RwLockReadGuard};
use tokio::task::JoinHandle;
use topology::{nym_topology_from_bonds, NymTopology};
use url::Url;
// I'm extremely curious why compiler NEVER complained about lack of Debug here before
#[derive(Debug)]
pub struct TopologyAccessorInner(Option<NymTopology>);
impl AsRef<Option<NymTopology>> for TopologyAccessorInner {
fn as_ref(&self) -> &Option<NymTopology> {
&self.0
}
}
impl TopologyAccessorInner {
fn new() -> Self {
TopologyAccessorInner(None)
}
fn update(&mut self, new: Option<NymTopology>) {
self.0 = new;
}
}
pub struct TopologyReadPermit<'a> {
permit: RwLockReadGuard<'a, TopologyAccessorInner>,
}
impl<'a> Deref for TopologyReadPermit<'a> {
type Target = TopologyAccessorInner;
fn deref(&self) -> &Self::Target {
&self.permit
}
}
impl<'a> TopologyReadPermit<'a> {
/// Using provided topology read permit, tries to get an immutable reference to the underlying
/// topology. For obvious reasons the lifetime of the topology reference is bound to the permit.
pub(super) fn try_get_valid_topology_ref(
&'a self,
ack_recipient: &Recipient,
packet_recipient: Option<&Recipient>,
) -> Option<&'a NymTopology> {
// Note: implicit deref with Deref for TopologyReadPermit is happening here
let topology_ref_option = self.permit.as_ref();
match topology_ref_option {
None => None,
Some(topology_ref) => {
// see if it's possible to route the packet to both gateways
if !topology_ref.can_construct_path_through(DEFAULT_NUM_MIX_HOPS)
|| !topology_ref.gateway_exists(ack_recipient.gateway())
|| if let Some(packet_recipient) = packet_recipient {
!topology_ref.gateway_exists(packet_recipient.gateway())
} else {
false
}
{
None
} else {
Some(topology_ref)
}
}
}
}
}
impl<'a> From<RwLockReadGuard<'a, TopologyAccessorInner>> for TopologyReadPermit<'a> {
fn from(read_permit: RwLockReadGuard<'a, TopologyAccessorInner>) -> Self {
TopologyReadPermit {
permit: read_permit,
}
}
}
#[derive(Clone, Debug)]
pub struct TopologyAccessor {
// `RwLock` *seems to* be the better approach for this as write access is only requested every
// few seconds, while reads are needed every single packet generated.
// However, proper benchmarks will be needed to determine if `RwLock` is indeed a better
// approach than a `Mutex`
inner: Arc<RwLock<TopologyAccessorInner>>,
}
impl TopologyAccessor {
pub fn new() -> Self {
TopologyAccessor {
inner: Arc::new(RwLock::new(TopologyAccessorInner::new())),
}
}
pub async fn get_read_permit(&self) -> TopologyReadPermit<'_> {
self.inner.read().await.into()
}
async fn update_global_topology(&self, new_topology: Option<NymTopology>) {
self.inner.write().await.update(new_topology);
}
// only used by the client at startup to get a slightly more reasonable error message
// (currently displays as unused because health checker is disabled due to required changes)
pub async fn is_routable(&self) -> bool {
match &self.inner.read().await.0 {
None => false,
Some(ref topology) => topology.can_construct_path_through(DEFAULT_NUM_MIX_HOPS),
}
}
}
impl Default for TopologyAccessor {
fn default() -> Self {
TopologyAccessor::new()
}
}
pub struct TopologyRefresherConfig {
validator_api_urls: Vec<Url>,
refresh_rate: time::Duration,
client_version: String,
}
impl TopologyRefresherConfig {
pub fn new(
validator_api_urls: Vec<Url>,
refresh_rate: time::Duration,
client_version: String,
) -> Self {
TopologyRefresherConfig {
validator_api_urls,
refresh_rate,
client_version,
}
}
}
pub struct TopologyRefresher {
validator_client: validator_client::ApiClient,
client_version: String,
validator_api_urls: Vec<Url>,
topology_accessor: TopologyAccessor,
refresh_rate: Duration,
currently_used_api: usize,
was_latest_valid: bool,
}
impl TopologyRefresher {
pub fn new(mut cfg: TopologyRefresherConfig, topology_accessor: TopologyAccessor) -> Self {
cfg.validator_api_urls.shuffle(&mut thread_rng());
TopologyRefresher {
validator_client: validator_client::ApiClient::new(cfg.validator_api_urls[0].clone()),
client_version: cfg.client_version,
validator_api_urls: cfg.validator_api_urls,
topology_accessor,
refresh_rate: cfg.refresh_rate,
currently_used_api: 0,
was_latest_valid: true,
}
}
fn use_next_validator_api(&mut self) {
if self.validator_api_urls.len() == 1 {
warn!("There's only a single validator API available - it won't be possible to use a different one");
return;
}
self.currently_used_api = (self.currently_used_api + 1) % self.validator_api_urls.len();
self.validator_client
.change_validator_api(self.validator_api_urls[self.currently_used_api].clone())
}
/// Verifies whether nodes a reasonably distributed among all mix layers.
///
/// In ideal world we would have 33% nodes on layer 1, 33% on layer 2 and 33% on layer 3.
/// However, this is a rather unrealistic expectation, instead we check whether there exists
/// a layer with more than 66% of nodes or with fewer than 15% and if so, we trigger a failure.
///
/// # Arguments
///
/// * `topology`: active topology constructed from validator api data
/// * `mixnodes_count`: total number of active mixnodes
fn check_layer_distribution(
&self,
active_topology: &NymTopology,
mixnodes_count: usize,
) -> bool {
let mixes = active_topology.mixes();
if active_topology.gateways().is_empty() {
return false;
}
// trivial check to see if have at least a single node on each layer (regardless of active set size)
if mixes.get(&1).is_none() || mixes.get(&2).is_none() || mixes.get(&3).is_none() {
return false;
}
let upper_bound = (mixnodes_count as f32 * 0.66) as usize;
let lower_bound = (mixnodes_count as f32 * 0.15) as usize;
let layer1 = mixes.get(&1).unwrap().len();
let layer2 = mixes.get(&2).unwrap().len();
let layer3 = mixes.get(&3).unwrap().len();
if layer1 < lower_bound || layer1 > upper_bound {
warn!(
"nodes: {}, layer1: {}, layer2: {}, layer3: {}",
mixnodes_count, layer1, layer2, layer3
);
return false;
}
if layer2 < lower_bound || layer2 > upper_bound {
warn!(
"nodes: {}, layer1: {}, layer2: {}, layer3: {}",
mixnodes_count, layer1, layer2, layer3
);
return false;
}
if layer3 < lower_bound || layer3 > upper_bound {
warn!(
"nodes: {}, layer1: {}, layer2: {}, layer3: {}",
mixnodes_count, layer1, layer2, layer3
);
return false;
}
true
}
async fn get_current_compatible_topology(&self) -> Option<NymTopology> {
// TODO: optimization for the future:
// only refresh mixnodes on timer and refresh gateways only when
// we have to send to a new, unknown, gateway
let mixnodes = match self.validator_client.get_cached_active_mixnodes().await {
Err(err) => {
error!("failed to get network mixnodes - {}", err);
return None;
}
Ok(mixes) => mixes,
};
let gateways = match self.validator_client.get_cached_gateways().await {
Err(err) => {
error!("failed to get network gateways - {}", err);
return None;
}
Ok(gateways) => gateways,
};
let mixnodes_count = mixnodes.len();
let topology =
nym_topology_from_bonds(mixnodes, gateways).filter_system_version(&self.client_version);
if !self.check_layer_distribution(&topology, mixnodes_count) {
warn!("The current filtered active topology has extremely skewed layer distribution. It cannot be used.");
None
} else {
Some(topology)
}
}
pub async fn refresh(&mut self) {
trace!("Refreshing the topology");
let new_topology = self.get_current_compatible_topology().await;
if new_topology.is_none() {
self.use_next_validator_api();
}
if new_topology.is_none() && self.was_latest_valid {
// if we failed to grab this topology, but the one before it was alright, let's assume
// validator had a tiny hiccup and use the old data
warn!("we're going to keep on using the old topology for this iteration");
self.was_latest_valid = false;
return;
} else if new_topology.is_some() {
self.was_latest_valid = true;
}
self.topology_accessor
.update_global_topology(new_topology)
.await;
}
pub async fn is_topology_routable(&self) -> bool {
self.topology_accessor.is_routable().await
}
pub fn start(mut self) -> JoinHandle<()> {
tokio::spawn(async move {
loop {
tokio::time::sleep(self.refresh_rate).await;
self.refresh().await;
}
})
}
}
+484
View File
@@ -0,0 +1,484 @@
// Copyright 2021 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
use config::defaults::*;
use config::NymConfig;
use serde::{Deserialize, Serialize};
use std::marker::PhantomData;
use std::path::PathBuf;
use std::time::Duration;
use url::Url;
pub mod persistence;
pub const MISSING_VALUE: &str = "MISSING VALUE";
// 'DEBUG'
const DEFAULT_ACK_WAIT_MULTIPLIER: f64 = 1.5;
const DEFAULT_ACK_WAIT_ADDITION: Duration = Duration::from_millis(1_500);
const DEFAULT_LOOP_COVER_STREAM_AVERAGE_DELAY: Duration = Duration::from_millis(200);
const DEFAULT_MESSAGE_STREAM_AVERAGE_DELAY: Duration = Duration::from_millis(20);
const DEFAULT_AVERAGE_PACKET_DELAY: Duration = Duration::from_millis(50);
const DEFAULT_TOPOLOGY_REFRESH_RATE: Duration = Duration::from_secs(5 * 60); // every 5min
const DEFAULT_TOPOLOGY_RESOLUTION_TIMEOUT: Duration = Duration::from_millis(5_000);
// Set this to a high value for now, so that we don't risk sporadic timeouts that might cause
// bought bandwidth tokens to not have time to be spent; Once we remove the gateway from the
// bandwidth bridging protocol, we can come back to a smaller timeout value
const DEFAULT_GATEWAY_RESPONSE_TIMEOUT: Duration = Duration::from_secs(5 * 60);
pub fn missing_string_value() -> String {
MISSING_VALUE.to_string()
}
#[derive(Debug, Deserialize, PartialEq, Serialize)]
#[serde(deny_unknown_fields)]
pub struct Config<T> {
client: Client<T>,
#[serde(default)]
logging: Logging,
#[serde(default)]
debug: Debug,
}
impl<T: NymConfig> Config<T> {
pub fn new<S: Into<String>>(id: S) -> Self {
let mut cfg = Config::default();
cfg.with_id(id);
cfg
}
pub fn with_id<S: Into<String>>(&mut self, id: S) {
let id = id.into();
// identity key setting
if self.client.private_identity_key_file.as_os_str().is_empty() {
self.client.private_identity_key_file =
self::Client::<T>::default_private_identity_key_file(&id);
}
if self.client.public_identity_key_file.as_os_str().is_empty() {
self.client.public_identity_key_file =
self::Client::<T>::default_public_identity_key_file(&id);
}
// encryption key setting
if self
.client
.private_encryption_key_file
.as_os_str()
.is_empty()
{
self.client.private_encryption_key_file =
self::Client::<T>::default_private_encryption_key_file(&id);
}
if self
.client
.public_encryption_key_file
.as_os_str()
.is_empty()
{
self.client.public_encryption_key_file =
self::Client::<T>::default_public_encryption_key_file(&id);
}
// shared gateway key setting
if self.client.gateway_shared_key_file.as_os_str().is_empty() {
self.client.gateway_shared_key_file =
self::Client::<T>::default_gateway_shared_key_file(&id);
}
// ack key setting
if self.client.ack_key_file.as_os_str().is_empty() {
self.client.ack_key_file = self::Client::<T>::default_ack_key_file(&id);
}
if self
.client
.reply_encryption_key_store_path
.as_os_str()
.is_empty()
{
self.client.reply_encryption_key_store_path =
self::Client::<T>::default_reply_encryption_key_store_path(&id);
}
#[cfg(not(feature = "coconut"))]
if self
.client
.backup_bandwidth_token_keys_dir
.as_os_str()
.is_empty()
{
self.client.backup_bandwidth_token_keys_dir =
self::Client::<T>::default_backup_bandwidth_token_keys_dir(&id);
}
self.client.id = id;
}
pub fn with_testnet_mode(&mut self, testnet_mode: bool) {
self.client.testnet_mode = testnet_mode;
}
pub fn with_gateway_id<S: Into<String>>(&mut self, id: S) {
self.client.gateway_id = id.into();
}
pub fn with_gateway_listener<S: Into<String>>(&mut self, gateway_listener: S) {
self.client.gateway_listener = gateway_listener.into();
}
#[cfg(not(feature = "coconut"))]
pub fn with_eth_private_key<S: Into<String>>(&mut self, eth_private_key: S) {
self.client.eth_private_key = eth_private_key.into();
}
#[cfg(not(feature = "coconut"))]
pub fn with_eth_endpoint<S: Into<String>>(&mut self, eth_endpoint: S) {
self.client.eth_endpoint = eth_endpoint.into();
}
pub fn set_custom_validator_apis(&mut self, validator_api_urls: Vec<Url>) {
self.client.validator_api_urls = validator_api_urls;
}
pub fn set_high_default_traffic_volume(&mut self) {
self.debug.average_packet_delay = Duration::from_millis(10);
self.debug.loop_cover_traffic_average_delay = Duration::from_millis(2000000); // basically don't really send cover messages
self.debug.message_sending_average_delay = Duration::from_millis(4); // 250 "real" messages / s
}
pub fn set_custom_version(&mut self, version: &str) {
self.client.version = version.to_string();
}
pub fn get_id(&self) -> String {
self.client.id.clone()
}
pub fn get_testnet_mode(&self) -> bool {
self.client.testnet_mode
}
pub fn get_nym_root_directory(&self) -> PathBuf {
self.client.nym_root_directory.clone()
}
pub fn get_private_identity_key_file(&self) -> PathBuf {
self.client.private_identity_key_file.clone()
}
pub fn get_public_identity_key_file(&self) -> PathBuf {
self.client.public_identity_key_file.clone()
}
pub fn get_private_encryption_key_file(&self) -> PathBuf {
self.client.private_encryption_key_file.clone()
}
pub fn get_public_encryption_key_file(&self) -> PathBuf {
self.client.public_encryption_key_file.clone()
}
pub fn get_gateway_shared_key_file(&self) -> PathBuf {
self.client.gateway_shared_key_file.clone()
}
pub fn get_reply_encryption_key_store_path(&self) -> PathBuf {
self.client.reply_encryption_key_store_path.clone()
}
pub fn get_ack_key_file(&self) -> PathBuf {
self.client.ack_key_file.clone()
}
pub fn get_validator_api_endpoints(&self) -> Vec<Url> {
self.client.validator_api_urls.clone()
}
pub fn get_gateway_id(&self) -> String {
self.client.gateway_id.clone()
}
pub fn get_gateway_listener(&self) -> String {
self.client.gateway_listener.clone()
}
#[cfg(not(feature = "coconut"))]
pub fn get_backup_bandwidth_token_keys_dir(&self) -> PathBuf {
self.client.backup_bandwidth_token_keys_dir.clone()
}
#[cfg(not(feature = "coconut"))]
pub fn get_eth_endpoint(&self) -> String {
self.client.eth_endpoint.clone()
}
#[cfg(not(feature = "coconut"))]
pub fn get_eth_private_key(&self) -> String {
self.client.eth_private_key.clone()
}
// Debug getters
pub fn get_average_packet_delay(&self) -> Duration {
self.debug.average_packet_delay
}
pub fn get_average_ack_delay(&self) -> Duration {
self.debug.average_ack_delay
}
pub fn get_ack_wait_multiplier(&self) -> f64 {
self.debug.ack_wait_multiplier
}
pub fn get_ack_wait_addition(&self) -> Duration {
self.debug.ack_wait_addition
}
pub fn get_loop_cover_traffic_average_delay(&self) -> Duration {
self.debug.loop_cover_traffic_average_delay
}
pub fn get_message_sending_average_delay(&self) -> Duration {
self.debug.message_sending_average_delay
}
pub fn get_gateway_response_timeout(&self) -> Duration {
self.debug.gateway_response_timeout
}
pub fn get_topology_refresh_rate(&self) -> Duration {
self.debug.topology_refresh_rate
}
pub fn get_topology_resolution_timeout(&self) -> Duration {
self.debug.topology_resolution_timeout
}
pub fn get_version(&self) -> &str {
&self.client.version
}
}
impl<T: NymConfig> Default for Config<T> {
fn default() -> Self {
Config {
client: Client::<T>::default(),
logging: Default::default(),
debug: Default::default(),
}
}
}
#[derive(Debug, Deserialize, PartialEq, Serialize)]
pub struct Client<T> {
/// Version of the client for which this configuration was created.
#[serde(default = "missing_string_value")]
version: String,
/// ID specifies the human readable ID of this particular client.
id: String,
/// Indicates whether this client is running in a testnet mode, thus attempting
/// to claim bandwidth without presenting bandwidth credentials.
#[serde(default)]
testnet_mode: bool,
/// Addresses to APIs running on validator from which the client gets the view of the network.
validator_api_urls: Vec<Url>,
/// Path to file containing private identity key.
private_identity_key_file: PathBuf,
/// Path to file containing public identity key.
public_identity_key_file: PathBuf,
/// Path to file containing private encryption key.
private_encryption_key_file: PathBuf,
/// Path to file containing public encryption key.
public_encryption_key_file: PathBuf,
/// Path to file containing shared key derived with the specified gateway that is used
/// for all communication with it.
gateway_shared_key_file: PathBuf,
/// Path to file containing key used for encrypting and decrypting the content of an
/// acknowledgement so that nobody besides the client knows which packet it refers to.
ack_key_file: PathBuf,
/// Full path to file containing reply encryption keys of all reply-SURBs we have ever
/// sent but not received back.
reply_encryption_key_store_path: PathBuf,
/// gateway_id specifies ID of the gateway to which the client should send messages.
/// If initially omitted, a random gateway will be chosen from the available topology.
gateway_id: String,
/// Address of the gateway listener to which all client requests should be sent.
gateway_listener: String,
/// Path to directory containing public/private keys used for bandwidth token purchase.
/// Those are saved in case of emergency, to be able to reclaim bandwidth tokens.
/// The public key is the name of the file, while the private key is the content.
#[cfg(not(feature = "coconut"))]
backup_bandwidth_token_keys_dir: PathBuf,
/// Ethereum private key.
#[cfg(not(feature = "coconut"))]
eth_private_key: String,
/// Address to an Ethereum full node.
#[cfg(not(feature = "coconut"))]
eth_endpoint: String,
/// nym_home_directory specifies absolute path to the home nym Clients directory.
/// It is expected to use default value and hence .toml file should not redefine this field.
nym_root_directory: PathBuf,
#[serde(skip)]
super_struct: PhantomData<*const T>,
}
impl<T: NymConfig> Default for Client<T> {
fn default() -> Self {
// there must be explicit checks for whether id is not empty later
Client {
version: env!("CARGO_PKG_VERSION").to_string(),
id: "".to_string(),
testnet_mode: false,
validator_api_urls: default_api_endpoints(),
private_identity_key_file: Default::default(),
public_identity_key_file: Default::default(),
private_encryption_key_file: Default::default(),
public_encryption_key_file: Default::default(),
gateway_shared_key_file: Default::default(),
ack_key_file: Default::default(),
reply_encryption_key_store_path: Default::default(),
gateway_id: "".to_string(),
gateway_listener: "".to_string(),
#[cfg(not(feature = "coconut"))]
backup_bandwidth_token_keys_dir: Default::default(),
#[cfg(not(feature = "coconut"))]
eth_private_key: "".to_string(),
#[cfg(not(feature = "coconut"))]
eth_endpoint: "".to_string(),
nym_root_directory: T::default_root_directory(),
super_struct: Default::default(),
}
}
}
impl<T: NymConfig> Client<T> {
fn default_private_identity_key_file(id: &str) -> PathBuf {
T::default_data_directory(Some(id)).join("private_identity.pem")
}
fn default_public_identity_key_file(id: &str) -> PathBuf {
T::default_data_directory(Some(id)).join("public_identity.pem")
}
fn default_private_encryption_key_file(id: &str) -> PathBuf {
T::default_data_directory(Some(id)).join("private_encryption.pem")
}
fn default_public_encryption_key_file(id: &str) -> PathBuf {
T::default_data_directory(Some(id)).join("public_encryption.pem")
}
fn default_gateway_shared_key_file(id: &str) -> PathBuf {
T::default_data_directory(Some(id)).join("gateway_shared.pem")
}
fn default_ack_key_file(id: &str) -> PathBuf {
T::default_data_directory(Some(id)).join("ack_key.pem")
}
fn default_reply_encryption_key_store_path(id: &str) -> PathBuf {
T::default_data_directory(Some(id)).join("reply_key_store")
}
#[cfg(not(feature = "coconut"))]
fn default_backup_bandwidth_token_keys_dir(id: &str) -> PathBuf {
T::default_data_directory(Some(id)).join("backup_bandwidth_token_keys")
}
}
#[derive(Debug, Default, Deserialize, PartialEq, Serialize)]
#[serde(deny_unknown_fields)]
pub struct Logging {}
#[derive(Debug, Deserialize, PartialEq, Serialize)]
#[serde(default, deny_unknown_fields)]
pub struct Debug {
/// The parameter of Poisson distribution determining how long, on average,
/// sent packet is going to be delayed at any given mix node.
/// So for a packet going through three mix nodes, on average, it will take three times this value
/// until the packet reaches its destination.
#[serde(with = "humantime_serde")]
average_packet_delay: Duration,
/// The parameter of Poisson distribution determining how long, on average,
/// sent acknowledgement is going to be delayed at any given mix node.
/// So for an ack going through three mix nodes, on average, it will take three times this value
/// until the packet reaches its destination.
#[serde(with = "humantime_serde")]
average_ack_delay: Duration,
/// Value multiplied with the expected round trip time of an acknowledgement packet before
/// it is assumed it was lost and retransmission of the data packet happens.
/// In an ideal network with 0 latency, this value would have been 1.
ack_wait_multiplier: f64,
/// Value added to the expected round trip time of an acknowledgement packet before
/// it is assumed it was lost and retransmission of the data packet happens.
/// In an ideal network with 0 latency, this value would have been 0.
#[serde(with = "humantime_serde")]
ack_wait_addition: Duration,
/// The parameter of Poisson distribution determining how long, on average,
/// it is going to take for another loop cover traffic message to be sent.
#[serde(with = "humantime_serde")]
loop_cover_traffic_average_delay: Duration,
/// The parameter of Poisson distribution determining how long, on average,
/// it is going to take another 'real traffic stream' message to be sent.
/// If no real packets are available and cover traffic is enabled,
/// a loop cover message is sent instead in order to preserve the rate.
#[serde(with = "humantime_serde")]
message_sending_average_delay: Duration,
/// How long we're willing to wait for a response to a message sent to the gateway,
/// before giving up on it.
#[serde(with = "humantime_serde")]
gateway_response_timeout: Duration,
/// The uniform delay every which clients are querying the directory server
/// to try to obtain a compatible network topology to send sphinx packets through.
#[serde(with = "humantime_serde")]
topology_refresh_rate: Duration,
/// During topology refresh, test packets are sent through every single possible network
/// path. This timeout determines waiting period until it is decided that the packet
/// did not reach its destination.
#[serde(with = "humantime_serde")]
topology_resolution_timeout: Duration,
}
impl Default for Debug {
fn default() -> Self {
Debug {
average_packet_delay: DEFAULT_AVERAGE_PACKET_DELAY,
average_ack_delay: DEFAULT_AVERAGE_PACKET_DELAY,
ack_wait_multiplier: DEFAULT_ACK_WAIT_MULTIPLIER,
ack_wait_addition: DEFAULT_ACK_WAIT_ADDITION,
loop_cover_traffic_average_delay: DEFAULT_LOOP_COVER_STREAM_AVERAGE_DELAY,
message_sending_average_delay: DEFAULT_MESSAGE_STREAM_AVERAGE_DELAY,
gateway_response_timeout: DEFAULT_GATEWAY_RESPONSE_TIMEOUT,
topology_refresh_rate: DEFAULT_TOPOLOGY_REFRESH_RATE,
topology_resolution_timeout: DEFAULT_TOPOLOGY_RESOLUTION_TIMEOUT,
}
}
}
@@ -0,0 +1,66 @@
// Copyright 2021 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
use crate::config::Config;
use config::NymConfig;
use std::path::{Path, PathBuf};
#[derive(Debug)]
pub struct ClientKeyPathfinder {
identity_private_key: PathBuf,
identity_public_key: PathBuf,
encryption_private_key: PathBuf,
encryption_public_key: PathBuf,
gateway_shared_key: PathBuf,
ack_key: PathBuf,
}
impl ClientKeyPathfinder {
pub fn new(id: String) -> Self {
let os_config_dir = dirs::config_dir().expect("no config directory known for this OS"); // grabs the OS default config dir
let config_dir = os_config_dir.join("nym").join("clients").join(id);
ClientKeyPathfinder {
identity_private_key: config_dir.join("private_identity.pem"),
identity_public_key: config_dir.join("public_identity.pem"),
encryption_private_key: config_dir.join("public_encryption.pem"),
encryption_public_key: config_dir.join("private_encryption.pem"),
gateway_shared_key: config_dir.join("gateway_shared.pem"),
ack_key: config_dir.join("ack_key.pem"),
}
}
pub fn new_from_config<T: NymConfig>(config: &Config<T>) -> Self {
ClientKeyPathfinder {
identity_private_key: config.get_private_identity_key_file(),
identity_public_key: config.get_public_identity_key_file(),
encryption_private_key: config.get_private_encryption_key_file(),
encryption_public_key: config.get_public_encryption_key_file(),
gateway_shared_key: config.get_gateway_shared_key_file(),
ack_key: config.get_ack_key_file(),
}
}
pub fn private_identity_key(&self) -> &Path {
&self.identity_private_key
}
pub fn public_identity_key(&self) -> &Path {
&self.identity_public_key
}
pub fn private_encryption_key(&self) -> &Path {
&self.encryption_private_key
}
pub fn public_encryption_key(&self) -> &Path {
&self.encryption_public_key
}
pub fn gateway_shared_key(&self) -> &Path {
&self.gateway_shared_key
}
pub fn ack_key(&self) -> &Path {
&self.ack_key
}
}
@@ -0,0 +1,4 @@
// Copyright 2021 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
pub mod key_pathfinder;
+2
View File
@@ -0,0 +1,2 @@
pub mod client;
pub mod config;
+2402
View File
File diff suppressed because it is too large Load Diff
+57
View File
@@ -0,0 +1,57 @@
[package]
name = "nym-client"
version = "0.12.1"
authors = ["Dave Hrycyszyn <futurechimp@users.noreply.github.com>", "Jędrzej Stuczyński <andrew@nymtech.net>"]
edition = "2018"
rust-version = "1.56"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[lib]
name = "nym_client"
path = "src/lib.rs"
[dependencies]
# dependencies to review:
futures = "0.3" # bunch of futures stuff, however, now that I think about it, it could perhaps be completely removed
# the AsyncRead, AsyncWrite, Stream, Sink, etc. traits could be used from tokio
# channels should really be replaced with crossbeam due to that implementation being more efficient
# and the single instance of abortable we have should really be refactored anyway
url = "2.2"
clap = "2.33.0" # for the command line arguments
dirs = "3.0" # for determining default store directories in config
dotenv = "0.15.0" # for obtaining environmental variables (only used for RUST_LOG for time being)
log = "0.4" # self explanatory
pretty_env_logger = "0.4" # for formatting log messages
rand = { version = "0.7.3", features = ["wasm-bindgen"] } # rng-related traits + some rng implementation to use
serde = { version = "1.0.104", features = ["derive"] } # for config serialization/deserialization
sled = "0.34" # for storage of replySURB decryption keys
tokio = { version = "1.4", features = ["rt-multi-thread", "net", "signal"] } # async runtime
tokio-tungstenite = "0.14" # websocket
## internal
client-core = { path = "../client-core" }
coconut-interface = { path = "../../common/coconut-interface", optional = true }
credentials = { path = "../../common/credentials", optional = true }
config = { path = "../../common/config" }
crypto = { path = "../../common/crypto" }
gateway-client = { path = "../../common/client-libs/gateway-client" }
gateway-requests = { path = "../../gateway/gateway-requests" }
nymsphinx = { path = "../../common/nymsphinx" }
pemstore = { path = "../../common/pemstore" }
topology = { path = "../../common/topology" }
websocket-requests = { path = "websocket-requests" }
validator-client = { path = "../../common/client-libs/validator-client" }
version-checker = { path = "../../common/version-checker" }
network-defaults = { path = "../../common/network-defaults" }
[features]
coconut = ["coconut-interface", "credentials", "gateway-requests/coconut", "gateway-client/coconut"]
eth = []
[dev-dependencies]
serde_json = "1.0" # for the "textsend" example
[build-dependencies]
vergen = { version = "5", default-features = false, features = ["build", "git", "rustc", "cargo"] }
+3
View File
@@ -0,0 +1,3 @@
# Nym Desktop Client
The Nym Desktop Client communicates with the remote, decentralised nodes which make up the Nym system as a whole.
+8
View File
@@ -0,0 +1,8 @@
// Copyright 2021 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
use vergen::{vergen, Config};
fn main() {
vergen(Config::default()).expect("failed to extract build metadata")
}
+9
View File
@@ -0,0 +1,9 @@
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam quis efficitur neque. Quisque aliquet vulputate ante, eget vehicula odio feugiat ac. Nulla ut mattis magna. Aenean tincidunt quis nulla eget eleifend. Cras in pretium sem. Nunc lorem metus, blandit sit amet egestas ut, feugiat quis tellus. Aenean tristique, enim a tincidunt condimentum, eros est blandit nunc, id viverra metus erat at nulla. Vivamus at tellus sodales, feugiat odio vel, laoreet neque. Vivamus posuere nulla ac sodales bibendum.
Vestibulum pulvinar nisi non ultricies egestas. Integer finibus ultrices justo vitae suscipit. Etiam interdum eu justo vel interdum. Morbi sagittis ac nisl quis consequat. Mauris dapibus ut risus ac facilisis. Pellentesque non tortor feugiat, consectetur arcu vel, ullamcorper sapien. Proin sodales purus non orci bibendum, sit amet ultrices justo ullamcorper. Nullam ac risus ac justo ultricies efficitur auctor nec arcu. Etiam sed finibus felis. Suspendisse potenti. Phasellus malesuada velit ac ullamcorper egestas. Sed elementum diam ut est gravida ultricies.
Pellentesque sed metus massa. Cras imperdiet lacus sit amet dolor aliquam, luctus posuere justo hendrerit. Morbi augue ex, gravida a metus sed, scelerisque euismod lacus. Nam consequat sapien ac pellentesque sagittis. Morbi a ultrices massa, vel aliquet ex. Maecenas ac sem diam. Nunc sed erat et ipsum volutpat auctor. Etiam elit felis, commodo vitae ipsum ac, fermentum lobortis arcu. Aliquam eu tempus enim. Curabitur vulputate imperdiet aliquam. Morbi iaculis rhoncus risus at malesuada. Donec accumsan feugiat ligula ut facilisis. Nunc porttitor sit amet est eget malesuada. Sed sed consectetur augue, non dapibus orci. Mauris aliquam pellentesque quam, sit amet pellentesque velit cursus vitae. Morbi sit amet molestie risus.
Nam gravida non ligula a egestas. Fusce sodales, purus id rhoncus mattis, purus est vehicula urna, vel finibus augue velit et est. Donec dictum erat eleifend lobortis iaculis. Praesent id venenatis ante. Donec feugiat, ipsum eget porttitor pulvinar, nisl odio posuere lorem, ut placerat elit nulla a ligula. Suspendisse nec nibh tincidunt, sollicitudin mi a, volutpat ligula. In maximus quam lacus, eget semper dolor sagittis sit amet.
In vitae hendrerit est, quis facilisis dui. In eu ante enim. Nullam hendrerit odio sit amet odio tincidunt eleifend. Aliquam erat volutpat. Curabitur commodo, purus pharetra lobortis rhoncus, tortor massa imperdiet nisl, vel dignissim tortor sem at orci. Aliquam maximus lobortis lacus, eu porttitor purus dapibus ut. Praesent at dapibus felis, efficitur blandit tortor. In hac habitasse platea dictumst. Aenean ultrices, nisl a pretium sagittis, tellus sapien mollis erat, eu consectetur erat mauris sed libero. Duis feugiat dapibus mi, vel ornare velit vehicula mattis. Ut suscipit pharetra leo et sollicitudin.
@@ -0,0 +1,217 @@
package main
import (
"encoding/binary"
"fmt"
"io/ioutil"
"github.com/gorilla/websocket"
)
// request tags
const sendRequestTag = 0x00
const replyRequestTag = 0x01
const selfAddressRequestTag = 0x02
// response tags
const errorResponseTag = 0x00
const receivedResponseTag = 0x01
const selfAddressResponseTag = 0x02
func makeSelfAddressRequest() []byte {
return []byte{selfAddressRequestTag}
}
func parseSelfAddressResponse(rawResponse []byte) []byte {
if len(rawResponse) != 97 || rawResponse[0] != selfAddressResponseTag {
panic("Received invalid response")
}
return rawResponse[1:]
}
func makeSendRequest(recipient []byte, message []byte, withReplySurb bool) []byte {
messageLen := make([]byte, 8)
binary.BigEndian.PutUint64(messageLen, uint64(len(message)))
surbByte := byte(0)
if withReplySurb {
surbByte = 1
}
out := []byte{sendRequestTag, surbByte}
out = append(out, recipient...)
out = append(out, messageLen...)
out = append(out, message...)
return out
}
func makeReplyRequest(message []byte, replySURB []byte) []byte {
messageLen := make([]byte, 8)
binary.BigEndian.PutUint64(messageLen, uint64(len(message)))
surbLen := make([]byte, 8)
binary.BigEndian.PutUint64(surbLen, uint64(len(replySURB)))
out := []byte{replyRequestTag}
out = append(out, surbLen...)
out = append(out, replySURB...)
out = append(out, messageLen...)
out = append(out, message...)
return out
}
func parseReceived(rawResponse []byte) ([]byte, []byte) {
if rawResponse[0] != receivedResponseTag {
panic("Received invalid response!")
}
hasSurb := false
if rawResponse[1] == 1 {
hasSurb = true
} else if rawResponse[1] == 0 {
hasSurb = false
} else {
panic("malformed received response!")
}
data := rawResponse[2:]
if hasSurb {
surbLen := binary.BigEndian.Uint64(data[:8])
other := data[8:]
surb := other[:surbLen]
msgLen := binary.BigEndian.Uint64(other[surbLen : surbLen+8])
if len(other[surbLen+8:]) != int(msgLen) {
panic("invalid msg len")
}
msg := other[surbLen+8:]
return msg, surb
} else {
msgLen := binary.BigEndian.Uint64(data[:8])
other := data[8:]
if len(other) != int(msgLen) {
panic("invalid msg len")
}
msg := other[:msgLen]
return msg, nil
}
}
func sendBinaryWithoutReply() {
uri := "ws://localhost:1977"
conn, _, err := websocket.DefaultDialer.Dial(uri, nil)
if err != nil {
panic(err)
}
defer conn.Close()
selfAddressRequest := makeSelfAddressRequest()
if err = conn.WriteMessage(websocket.BinaryMessage, selfAddressRequest); err != nil {
panic(err)
}
_, receivedResponse, err := conn.ReadMessage()
if err != nil {
panic(err)
}
selfAddress := parseSelfAddressResponse(receivedResponse)
readData, err := ioutil.ReadFile("dummy_file")
if err != nil {
panic(err)
}
sendRequest := makeSendRequest(selfAddress, readData, false)
fmt.Printf("sending content of 'dummy file' over the mix network...\n")
if err = conn.WriteMessage(websocket.BinaryMessage, sendRequest); err != nil {
panic(err)
}
fmt.Printf("waiting to receive a message from the mix network...\n")
_, receivedResponse, err = conn.ReadMessage()
if err != nil {
panic(err)
}
fileData, replySURB := parseReceived(receivedResponse)
if replySURB != nil {
panic("did not expect a replySURB!")
}
fmt.Printf("writing the file back to the disk!\n")
ioutil.WriteFile("received_file_no_reply", fileData, 0644)
}
func sendBinaryWithReply() {
uri := "ws://localhost:1977"
conn, _, err := websocket.DefaultDialer.Dial(uri, nil)
if err != nil {
panic(err)
}
defer conn.Close()
selfAddressRequest := makeSelfAddressRequest()
if err = conn.WriteMessage(websocket.BinaryMessage, selfAddressRequest); err != nil {
panic(err)
}
_, receivedResponse, err := conn.ReadMessage()
if err != nil {
panic(err)
}
selfAddress := parseSelfAddressResponse(receivedResponse)
readData, err := ioutil.ReadFile("dummy_file")
if err != nil {
panic(err)
}
sendRequest := makeSendRequest(selfAddress, readData, true)
fmt.Printf("sending content of 'dummy file' over the mix network...\n")
if err = conn.WriteMessage(websocket.BinaryMessage, sendRequest); err != nil {
panic(err)
}
fmt.Printf("waiting to receive a message from the mix network...\n")
_, receivedResponse, err = conn.ReadMessage()
if err != nil {
panic(err)
}
fileData, replySURB := parseReceived(receivedResponse)
fmt.Printf("writing the file back to the disk!\n")
ioutil.WriteFile("received_file_withreply", fileData, 0644)
replyMessage := []byte("hello from reply SURB! - thanks for sending me the file!")
replyRequest := makeReplyRequest(replyMessage, replySURB)
fmt.Printf("sending '%v' (using reply SURB) over the mix network...\n", string(replyMessage))
if err = conn.WriteMessage(websocket.BinaryMessage, replyRequest); err != nil {
panic(err)
}
fmt.Printf("waiting to receive a message from the mix network...\n")
_, receivedResponse, err = conn.ReadMessage()
if err != nil {
panic(err)
}
receivedMessage, replySURB := parseReceived(receivedResponse)
if replySURB != nil {
panic("did not expect a replySURB!")
}
fmt.Printf("received %v from the mix network!\n", string(receivedMessage))
}
func main() {
// sendBinaryWithoutReply()
sendBinaryWithReply()
}
@@ -0,0 +1,9 @@
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam quis efficitur neque. Quisque aliquet vulputate ante, eget vehicula odio feugiat ac. Nulla ut mattis magna. Aenean tincidunt quis nulla eget eleifend. Cras in pretium sem. Nunc lorem metus, blandit sit amet egestas ut, feugiat quis tellus. Aenean tristique, enim a tincidunt condimentum, eros est blandit nunc, id viverra metus erat at nulla. Vivamus at tellus sodales, feugiat odio vel, laoreet neque. Vivamus posuere nulla ac sodales bibendum.
Vestibulum pulvinar nisi non ultricies egestas. Integer finibus ultrices justo vitae suscipit. Etiam interdum eu justo vel interdum. Morbi sagittis ac nisl quis consequat. Mauris dapibus ut risus ac facilisis. Pellentesque non tortor feugiat, consectetur arcu vel, ullamcorper sapien. Proin sodales purus non orci bibendum, sit amet ultrices justo ullamcorper. Nullam ac risus ac justo ultricies efficitur auctor nec arcu. Etiam sed finibus felis. Suspendisse potenti. Phasellus malesuada velit ac ullamcorper egestas. Sed elementum diam ut est gravida ultricies.
Pellentesque sed metus massa. Cras imperdiet lacus sit amet dolor aliquam, luctus posuere justo hendrerit. Morbi augue ex, gravida a metus sed, scelerisque euismod lacus. Nam consequat sapien ac pellentesque sagittis. Morbi a ultrices massa, vel aliquet ex. Maecenas ac sem diam. Nunc sed erat et ipsum volutpat auctor. Etiam elit felis, commodo vitae ipsum ac, fermentum lobortis arcu. Aliquam eu tempus enim. Curabitur vulputate imperdiet aliquam. Morbi iaculis rhoncus risus at malesuada. Donec accumsan feugiat ligula ut facilisis. Nunc porttitor sit amet est eget malesuada. Sed sed consectetur augue, non dapibus orci. Mauris aliquam pellentesque quam, sit amet pellentesque velit cursus vitae. Morbi sit amet molestie risus.
Nam gravida non ligula a egestas. Fusce sodales, purus id rhoncus mattis, purus est vehicula urna, vel finibus augue velit et est. Donec dictum erat eleifend lobortis iaculis. Praesent id venenatis ante. Donec feugiat, ipsum eget porttitor pulvinar, nisl odio posuere lorem, ut placerat elit nulla a ligula. Suspendisse nec nibh tincidunt, sollicitudin mi a, volutpat ligula. In maximus quam lacus, eget semper dolor sagittis sit amet.
In vitae hendrerit est, quis facilisis dui. In eu ante enim. Nullam hendrerit odio sit amet odio tincidunt eleifend. Aliquam erat volutpat. Curabitur commodo, purus pharetra lobortis rhoncus, tortor massa imperdiet nisl, vel dignissim tortor sem at orci. Aliquam maximus lobortis lacus, eu porttitor purus dapibus ut. Praesent at dapibus felis, efficitur blandit tortor. In hac habitasse platea dictumst. Aenean ultrices, nisl a pretium sagittis, tellus sapien mollis erat, eu consectetur erat mauris sed libero. Duis feugiat dapibus mi, vel ornare velit vehicula mattis. Ut suscipit pharetra leo et sollicitudin.
@@ -0,0 +1,7 @@
module github.com/nymtech/nym/clients/native/examples/go
go 1.14
require (
github.com/gorilla/websocket v1.4.2
)
@@ -0,0 +1,37 @@
github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII=
github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ=
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA=
github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg=
github.com/btcsuite/btcutil v1.0.2 h1:9iZ1Terx9fMIOtq1VrwdqfsATL9MC2l8ZrUY6YZ2uts=
github.com/btcsuite/btcutil v1.0.2/go.mod h1:j9HUFwoQRsZL3V4n+qG+CUnEGHOarIxfC3Le2Yhbcts=
github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg=
github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY=
github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc=
github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY=
github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs=
github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc=
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ=
github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4=
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
@@ -0,0 +1,9 @@
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam quis efficitur neque. Quisque aliquet vulputate ante, eget vehicula odio feugiat ac. Nulla ut mattis magna. Aenean tincidunt quis nulla eget eleifend. Cras in pretium sem. Nunc lorem metus, blandit sit amet egestas ut, feugiat quis tellus. Aenean tristique, enim a tincidunt condimentum, eros est blandit nunc, id viverra metus erat at nulla. Vivamus at tellus sodales, feugiat odio vel, laoreet neque. Vivamus posuere nulla ac sodales bibendum.
Vestibulum pulvinar nisi non ultricies egestas. Integer finibus ultrices justo vitae suscipit. Etiam interdum eu justo vel interdum. Morbi sagittis ac nisl quis consequat. Mauris dapibus ut risus ac facilisis. Pellentesque non tortor feugiat, consectetur arcu vel, ullamcorper sapien. Proin sodales purus non orci bibendum, sit amet ultrices justo ullamcorper. Nullam ac risus ac justo ultricies efficitur auctor nec arcu. Etiam sed finibus felis. Suspendisse potenti. Phasellus malesuada velit ac ullamcorper egestas. Sed elementum diam ut est gravida ultricies.
Pellentesque sed metus massa. Cras imperdiet lacus sit amet dolor aliquam, luctus posuere justo hendrerit. Morbi augue ex, gravida a metus sed, scelerisque euismod lacus. Nam consequat sapien ac pellentesque sagittis. Morbi a ultrices massa, vel aliquet ex. Maecenas ac sem diam. Nunc sed erat et ipsum volutpat auctor. Etiam elit felis, commodo vitae ipsum ac, fermentum lobortis arcu. Aliquam eu tempus enim. Curabitur vulputate imperdiet aliquam. Morbi iaculis rhoncus risus at malesuada. Donec accumsan feugiat ligula ut facilisis. Nunc porttitor sit amet est eget malesuada. Sed sed consectetur augue, non dapibus orci. Mauris aliquam pellentesque quam, sit amet pellentesque velit cursus vitae. Morbi sit amet molestie risus.
Nam gravida non ligula a egestas. Fusce sodales, purus id rhoncus mattis, purus est vehicula urna, vel finibus augue velit et est. Donec dictum erat eleifend lobortis iaculis. Praesent id venenatis ante. Donec feugiat, ipsum eget porttitor pulvinar, nisl odio posuere lorem, ut placerat elit nulla a ligula. Suspendisse nec nibh tincidunt, sollicitudin mi a, volutpat ligula. In maximus quam lacus, eget semper dolor sagittis sit amet.
In vitae hendrerit est, quis facilisis dui. In eu ante enim. Nullam hendrerit odio sit amet odio tincidunt eleifend. Aliquam erat volutpat. Curabitur commodo, purus pharetra lobortis rhoncus, tortor massa imperdiet nisl, vel dignissim tortor sem at orci. Aliquam maximus lobortis lacus, eu porttitor purus dapibus ut. Praesent at dapibus felis, efficitur blandit tortor. In hac habitasse platea dictumst. Aenean ultrices, nisl a pretium sagittis, tellus sapien mollis erat, eu consectetur erat mauris sed libero. Duis feugiat dapibus mi, vel ornare velit vehicula mattis. Ut suscipit pharetra leo et sollicitudin.
@@ -0,0 +1,134 @@
package main
import (
"encoding/json"
"fmt"
"github.com/gorilla/websocket"
)
func getSelfAddress(conn *websocket.Conn) string {
selfAddressRequest, err := json.Marshal(map[string]string{"type": "selfAddress"})
if err != nil {
panic(err)
}
if err = conn.WriteMessage(websocket.TextMessage, []byte(selfAddressRequest)); err != nil {
panic(err)
}
responseJSON := make(map[string]interface{})
err = conn.ReadJSON(&responseJSON)
if err != nil {
panic(err)
}
return responseJSON["address"].(string)
}
func sendTextWithoutReply() {
message := "Hello Nym!"
uri := "ws://localhost:1977"
conn, _, err := websocket.DefaultDialer.Dial(uri, nil)
if err != nil {
panic(err)
}
defer conn.Close()
selfAddress := getSelfAddress(conn)
fmt.Printf("our address is: %v\n", selfAddress)
sendRequest, err := json.Marshal(map[string]interface{}{
"type": "send",
"recipient": selfAddress,
"message": message,
"withReplySurb": false,
})
if err != nil {
panic(err)
}
fmt.Printf("sending '%v' (*without* reply SURB) over the mix network...\n", message)
if err = conn.WriteMessage(websocket.TextMessage, []byte(sendRequest)); err != nil {
panic(err)
}
fmt.Printf("waiting to receive a message from the mix network...\n")
_, receivedMessage, err := conn.ReadMessage()
if err != nil {
panic(err)
}
fmt.Printf("received %v from the mix network!\n", string(receivedMessage))
}
func sendTextWithReply() {
message := "Hello Nym!"
uri := "ws://localhost:1977"
conn, _, err := websocket.DefaultDialer.Dial(uri, nil)
if err != nil {
panic(err)
}
defer conn.Close()
selfAddress := getSelfAddress(conn)
fmt.Printf("our address is: %v\n", selfAddress)
sendRequest, err := json.Marshal(map[string]interface{}{
"type": "send",
"recipient": selfAddress,
"message": message,
"withReplySurb": true,
})
if err != nil {
panic(err)
}
fmt.Printf("sending '%v' (*with* reply SURB) over the mix network...\n", message)
if err = conn.WriteMessage(websocket.TextMessage, []byte(sendRequest)); err != nil {
panic(err)
}
fmt.Printf("waiting to receive a message from the mix network...\n")
_, receivedMessage, err := conn.ReadMessage()
if err != nil {
panic(err)
}
fmt.Printf("received %v from the mix network!\n", string(receivedMessage))
receivedMessageJSON := make(map[string]interface{})
if err := json.Unmarshal(receivedMessage, &receivedMessageJSON); err != nil {
panic(err)
}
// use the received surb to send an anonymous reply!
replySurb := receivedMessageJSON["replySurb"]
replyMessage := "hello from reply SURB!"
reply, err := json.Marshal(map[string]interface{}{
"type": "reply",
"message": replyMessage,
"replySurb": replySurb,
})
if err != nil {
panic(err)
}
fmt.Printf("sending '%v' (using reply SURB) over the mix network...\n", replyMessage)
if err = conn.WriteMessage(websocket.TextMessage, []byte(reply)); err != nil {
panic(err)
}
fmt.Printf("waiting to receive a message from the mix network...\n")
_, receivedMessage, err = conn.ReadMessage()
if err != nil {
panic(err)
}
fmt.Printf("received %v from the mix network!\n", string(receivedMessage))
}
func main() {
// sendTextWithoutReply()
sendTextWithReply()
}
@@ -0,0 +1,2 @@
dist/bundle.js
node_modules
@@ -0,0 +1,10 @@
### Prerequisites
* Reasonably up to date Node + `npm`
### Running it
```
npm install
npm start # starts a webserver on port 8888
```
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,31 @@
{
"name": "nym-client-websocket-demo",
"version": "0.7.0",
"description": "Connect to a local Nym client, send and retrieve from the Nym network. ",
"private": true,
"scripts": {
"build": "webpack",
"start": "webpack-dev-server"
},
"keywords": [
"nym",
"anonymity",
"mixnet",
"client",
"rust",
"websockets"
],
"author": "Dave Hrycyszyn",
"license": "Apache-2.0",
"devDependencies": {
"autoprefixer": "^10.2.6",
"clean-webpack-plugin": "^3.0.0",
"webpack": "^4.42.1",
"webpack-cli": "^3.3.11",
"webpack-dev-server": "^3.11.0"
},
"dependencies": {
"core-js": "^3.6.5",
"html-webpack-plugin": "^4.2.0"
}
}
@@ -0,0 +1,27 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Nym Client Demo</title>
</head>
<body>
<label for="fname">Text to send: </label><input type="text" id="sendtext" name="sendtext" value="Hello mixnet!">
<input type="checkbox" id="with-surb" name="with-surb">
<label for="with-surb"> Attach Reply SURB </label><br>
<button id="send-button">Send</button>
<p>Send messages to the mixnet using the "send" button.</p>
<p><span style='color: blue;'>Sent</span> messages show in blue, <span style='color: green;'>received</span>
messages show in green.</p>
<hr>
<p>
<span id="output"></div>
</p>
</body>
</html>
@@ -0,0 +1,173 @@
var ourAddress;
var connection;
// Please note that this javascript is extremely bad, it's only purpose is to show some basic API calls, not how
// a proper application should have been written.
async function main() {
var port = '1977' // client websocket listens on 1977 by default, change if yours is different
var localClientUrl = "ws://127.0.0.1:" + port;
// Set up and handle websocket connection to our desktop client.
connection = await connectWebsocket(localClientUrl).then(function (c) {
return c;
}).catch(function (err) {
display("Websocket connection error. Is the client running with <pre>--connection-type WebSocket</pre> on port " + port + "?");
})
connection.onmessage = function (e) {
handleResponse(e);
};
sendSelfAddressRequest();
// Set up the send button
const sendButton = document.querySelector('#send-button');
sendButton.onclick = function () {
sendMessageToMixnet();
}
}
// Handle any messages that come back down the websocket.
function handleResponse(resp) {
// hacky workaround for receiving pushed 'text' messages,
// basically we can either receive proper server responses, i.e. 'error', 'send', 'selfAddress'
// or actual messages, without any framing, so they do not have 'type' field
try {
let response = JSON.parse(resp.data);
if (response.type == "error") {
displayJsonResponseWithoutReply("Server responded with error: " + response.message);
} else if (response.type == "selfAddress") {
displayJsonResponseWithoutReply(response);
ourAddress = response.address;
display("Our address is: " + ourAddress + ", we will now send messages to ourself.");
} else if (response.type == "received") {
handleReceivedTextMessage(response)
}
} catch (_) {
displayJsonResponseWithoutReply(resp.data)
}
}
function handleReceivedTextMessage(message) {
console.log("received a message!")
const text = message.message
const replySurb = message.replySurb
if (replySurb != null) {
displayJsonResponseWithReply(text, replySurb)
} else {
displayJsonResponseWithoutReply(text)
}
}
// Send a message to the mixnet.
function sendMessageToMixnet() {
const sendText = document.getElementById("sendtext").value;
const surbCheckbox = document.querySelector('#with-surb');
const attachReplySURB = surbCheckbox.checked;
const message = {
type: "send",
message: sendText,
recipient: ourAddress,
withReplySurb: attachReplySURB,
}
displayJsonResponseWithoutReply(message);
connection.send(JSON.stringify(message));
}
function sendReplyMessageToMixnet(messageContent, replySurb) {
const message = {
type: "reply",
message: messageContent,
replySurb: replySurb,
}
displayJsonResponseWithoutReply(message);
connection.send(JSON.stringify(message));
}
// Send a message to the mixnet client, asking what our own address is.
// In this simplistic demo, we'll just use our own address to send ourselves messages.
//
// In a real application, you might want to ensure that somebody else got your
// address so that they could send messages to you.
function sendSelfAddressRequest() {
var selfAddress = {
type: "selfAddress"
}
displayJsonSend(selfAddress);
connection.send(JSON.stringify(selfAddress));
}
function display(message) {
document.getElementById("output").innerHTML += "<p>" + message + "</p >";
}
function displayJsonSend(message) {
let sendDiv = document.createElement("div")
let paragraph = document.createElement("p")
paragraph.setAttribute('style', 'color: blue')
let paragraphContent = document.createTextNode("sent >>> " + JSON.stringify(message))
paragraph.appendChild(paragraphContent)
sendDiv.appendChild(paragraph)
document.getElementById("output").appendChild(sendDiv)
}
function displayJsonResponseWithoutReply(message) {
let receivedDiv = document.createElement("div")
let paragraph = document.createElement("p")
paragraph.setAttribute('style', 'color: green')
let paragraphContent = document.createTextNode("received >>> " + JSON.stringify(message) + "(NO REPLY AVAILABLE)")
paragraph.appendChild(paragraphContent)
receivedDiv.appendChild(paragraph)
document.getElementById("output").appendChild(receivedDiv)
}
function displayJsonResponseWithReply(message, replySurb) {
let replyBox = document.createElement("input")
replyBox.setAttribute('type', 'text');
replyBox.setAttribute('value', 'type your anonymous reply here!');
replyBox.setAttribute('size', 50);
let sendButton = document.createElement("button")
let buttonText = document.createTextNode("Send")
sendButton.appendChild(buttonText)
sendButton.onclick = () => {
sendReplyMessageToMixnet(replyBox.value, replySurb)
}
let receivedDiv = document.createElement("div")
let paragraph = document.createElement("p")
paragraph.setAttribute('style', 'color: green')
let paragraphContent = document.createTextNode("received >>> " + JSON.stringify(message) + "(HERE BE SURB)")
paragraph.appendChild(paragraphContent)
receivedDiv.appendChild(paragraph)
receivedDiv.appendChild(replyBox)
receivedDiv.appendChild(sendButton)
document.getElementById("output").appendChild(receivedDiv)
}
// Connect to a websocket.
function connectWebsocket(url) {
return new Promise(function (resolve, reject) {
var server = new WebSocket(url);
server.onopen = function () {
resolve(server);
};
server.onerror = function (err) {
reject(err);
};
});
}
// Start it!
main();
@@ -0,0 +1,25 @@
const autoprefixer = require('autoprefixer');
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
module.exports = {
entry: './src/index.js',
output: {
filename: 'bundle.js',
// path: path.resolve(__dirname, 'dist'),
},
plugins: [
new CleanWebpackPlugin(),
new HtmlWebpackPlugin({
hash: true,
template: './src/index.html',
filename: '.././dist/index.html' //relative to root of the application
})
],
devServer: {
contentBase: path.join(__dirname, 'dist'),
compress: true,
port: 8888
}
};
@@ -0,0 +1,14 @@
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true
[dev-packages]
[packages]
base58 = "*"
websockets = "*"
asyncio = "*"
[requires]
python_version = "3.8"
@@ -0,0 +1,78 @@
{
"_meta": {
"hash": {
"sha256": "f72ba1bebddbc91273647a33428eb911071d256cf3fc20e04f51060a7610f293"
},
"pipfile-spec": 6,
"requires": {
"python_version": "3.8"
},
"sources": [
{
"name": "pypi",
"url": "https://pypi.org/simple",
"verify_ssl": true
}
]
},
"default": {
"asyncio": {
"hashes": [
"sha256:83360ff8bc97980e4ff25c964c7bd3923d333d177aa4f7fb736b019f26c7cb41",
"sha256:b62c9157d36187eca799c378e572c969f0da87cd5fc42ca372d92cdb06e7e1de",
"sha256:c46a87b48213d7464f22d9a497b9eef8c1928b68320a2fa94240f969f6fec08c",
"sha256:c4d18b22701821de07bd6aea8b53d21449ec0ec5680645e5317062ea21817d2d"
],
"index": "pypi",
"version": "==3.4.3"
},
"base58": {
"hashes": [
"sha256:4c7f5687da771b519cf86b3236250e7c3543368c576404c9fe2d992a287666e0",
"sha256:c83584a8b917dc52dd634307137f2ad2721a9efb4f1de32fc7eaaaf87844177e"
],
"index": "pypi",
"version": "==2.0.0"
},
"websockets": {
"hashes": [
"sha256:0dd4eb8e0bbf365d6f652711ce21b8fd2b596f873d32aabb0fbb53ec604418cc",
"sha256:1d0971cc7251aeff955aa742ec541ee8aaea4bb2ebf0245748fbec62f744a37e",
"sha256:1d6b4fddb12ab9adf87b843cd4316c4bd602db8d5efd2fb83147f0458fe85135",
"sha256:230a3506df6b5f446fed2398e58dcaafdff12d67fe1397dff196411a9e820d02",
"sha256:276d2339ebf0df4f45df453923ebd2270b87900eda5dfd4a6b0cfa15f82111c3",
"sha256:2cf04601633a4ec176b9cc3d3e73789c037641001dbfaf7c411f89cd3e04fcaf",
"sha256:3ddff38894c7857c476feb3538dd847514379d6dc844961dc99f04b0384b1b1b",
"sha256:48c222feb3ced18f3dc61168ca18952a22fb88e5eb8902d2bf1b50faefdc34a2",
"sha256:51d04df04ed9d08077d10ccbe21e6805791b78eac49d16d30a1f1fe2e44ba0af",
"sha256:597c28f3aa7a09e8c070a86b03107094ee5cdafcc0d55f2f2eac92faac8dc67d",
"sha256:5c8f0d82ea2468282e08b0cf5307f3ad022290ed50c45d5cb7767957ca782880",
"sha256:7189e51955f9268b2bdd6cc537e0faa06f8fffda7fb386e5922c6391de51b077",
"sha256:7df3596838b2a0c07c6f6d67752c53859a54993d4f062689fdf547cb56d0f84f",
"sha256:826ccf85d4514609219725ba4a7abd569228c2c9f1968e8be05be366f68291ec",
"sha256:836d14eb53b500fd92bd5db2fc5894f7c72b634f9c2a28f546f75967503d8e25",
"sha256:85db8090ba94e22d964498a47fdd933b8875a1add6ebc514c7ac8703eb97bbf0",
"sha256:85e701a6c316b7067f1e8675c638036a796fe5116783a4c932e7eb8e305a3ffe",
"sha256:900589e19200be76dd7cbaa95e9771605b5ce3f62512d039fb3bc5da9014912a",
"sha256:9147868bb0cc01e6846606cd65cbf9c58598f187b96d14dd1ca17338b08793bb",
"sha256:9e7fdc775fe7403dbd8bc883ba59576a6232eac96dacb56512daacf7af5d618d",
"sha256:ab5ee15d3462198c794c49ccd31773d8a2b8c17d622aa184f669d2b98c2f0857",
"sha256:ad893d889bc700a5835e0a95a3e4f2c39e91577ab232a3dc03c262a0f8fc4b5c",
"sha256:b2e71c4670ebe1067fa8632f0d081e47254ee2d3d409de54168b43b0ba9147e0",
"sha256:b43b13e5622c5a53ab12f3272e6f42f1ce37cd5b6684b2676cb365403295cd40",
"sha256:b4ad84b156cf50529b8ac5cc1638c2cf8680490e3fccb6121316c8c02620a2e4",
"sha256:be5fd35e99970518547edc906efab29afd392319f020c3c58b0e1a158e16ed20",
"sha256:caa68c95bc1776d3521f81eeb4d5b9438be92514ec2a79fececda814099c8314",
"sha256:d144b350045c53c8ff09aa1cfa955012dd32f00c7e0862c199edcabb1a8b32da",
"sha256:d2c2d9b24d3c65b5a02cac12cbb4e4194e590314519ed49db2f67ef561c3cf58",
"sha256:e9e5fd6dbdf95d99bc03732ded1fc8ef22ebbc05999ac7e0c7bf57fe6e4e5ae2",
"sha256:ebf459a1c069f9866d8569439c06193c586e72c9330db1390af7c6a0a32c4afd",
"sha256:f31722f1c033c198aa4a39a01905951c00bd1c74f922e8afc1b1c62adbcdd56a",
"sha256:f68c352a68e5fdf1e97288d5cec9296664c590c25932a8476224124aaf90dbcd"
],
"index": "pypi",
"version": "==9.1"
}
},
"develop": {}
}
@@ -0,0 +1,139 @@
import asyncio
import websockets
from pathlib import Path
import struct
# request tags
SEND_REQUEST_TAG = 0x00
REPLY_REQUEST_TAG = 0x01
SELF_ADDRESS_REQUEST_TAG = 0x02
# response tags
ERROR_RESPONSE_TAG = 0x00
RECEIVED_RESPONSE_TAG = 0x01
SELF_ADDRESS_RESPONSE_TAG = 0x02
def make_self_address_request() -> bytes:
return bytes([SELF_ADDRESS_REQUEST_TAG])
def parse_self_address_response(raw_response: bytes) -> bytes:
if len(raw_response) != 97 or raw_response[0] != SELF_ADDRESS_RESPONSE_TAG:
print('Received invalid response!')
raise
return raw_response[1:]
def make_send_request(recipient: bytes, message: bytes, with_reply_surb: bool) -> bytes:
# a big endian uint64
message_len = len(message).to_bytes(length=8, byteorder='big', signed=False)
return bytes([SEND_REQUEST_TAG]) + bytes([with_reply_surb]) + recipient + message_len + message
def make_reply_request(message: bytes, reply_surb: bytes) -> bytes:
message_len = len(message).to_bytes(length=8, byteorder='big', signed=False)
surb_len = len(reply_surb).to_bytes(length=8, byteorder='big', signed=False)
return bytes([REPLY_REQUEST_TAG]) + surb_len + reply_surb + message_len + message
# it should have structure of RECEIVED_RESPONSE_TAG || with_reply || (surb_len || surb) || msg_len || msg
# where surb_len || surb is only present if 'with_reply' is true
def parse_received(raw_response: bytes) -> (bytes, bytes):
if raw_response[0] != RECEIVED_RESPONSE_TAG:
print('Received invalid response!')
raise
if raw_response[1] == 1:
has_surb = True
elif raw_response[1] == 0:
has_surb = False
else:
print("malformed received response!")
raise
data = raw_response[2:]
if has_surb:
(surb_len,), other = struct.unpack(">Q", data[:8]), data[8:]
surb = other[:surb_len]
(msg_len,) = struct.unpack(">Q", other[surb_len:surb_len + 8])
if len(other[surb_len + 8:]) != msg_len:
print("invalid msg len")
raise
msg = other[surb_len + 8:]
return msg, surb
else:
(msg_len,), other = struct.unpack(">Q", data[:8]), data[8:]
if len(other) != msg_len:
print("invalid msg len")
raise
msg = other[:msg_len]
return msg, None
async def send_file_with_reply():
uri = "ws://localhost:1977"
async with websockets.connect(uri) as websocket:
self_address_req = make_self_address_request()
await websocket.send(self_address_req)
self_address = parse_self_address_response(await websocket.recv())
file_data = Path('dummy_file').read_bytes()
send_request = make_send_request(self_address, file_data, True)
print("sending content of 'dummy_file' over the mix network...")
await websocket.send(send_request)
print("waiting to receive the 'dummy_file' from the mix network...")
received_response = await websocket.recv()
received_file, surb = parse_received(received_response)
with open("received_file_withreply", "wb") as output_file:
print("writing the file back to the disk!")
output_file.write(received_file)
reply_message = b"hello from reply SURB! - thanks for sending me the file!"
reply_request = make_reply_request(reply_message, surb)
print("sending '{}' (using reply SURB!) over the mix network...".format(reply_message))
await websocket.send(reply_request)
print("waiting to receive a message from the mix network...")
received_response = await websocket.recv()
received_msg, surb = parse_received(received_response)
assert surb is None # no surbs in replies!
print("received '{}' from the mix network".format(received_msg))
async def send_file_without_reply():
uri = "ws://localhost:1977"
async with websockets.connect(uri) as websocket:
self_address_req = make_self_address_request()
await websocket.send(self_address_req)
self_address = parse_self_address_response(await websocket.recv())
file_data = Path('dummy_file').read_bytes()
send_request = make_send_request(self_address, file_data, False)
print("sending content of 'dummy_file' over the mix network...")
await websocket.send(send_request)
print("waiting to receive the 'dummy_file' from the mix network...")
received_response = await websocket.recv()
received_file, surb = parse_received(received_response)
assert surb is None # we didn't attach a surb so we expect a None here!
with open("received_file_noreply", "wb") as output_file:
print("writing the file back to the disk!")
output_file.write(received_file)
# asyncio.get_event_loop().run_until_complete(send_file_without_reply())
asyncio.get_event_loop().run_until_complete(send_file_with_reply())
@@ -0,0 +1,9 @@
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam quis efficitur neque. Quisque aliquet vulputate ante, eget vehicula odio feugiat ac. Nulla ut mattis magna. Aenean tincidunt quis nulla eget eleifend. Cras in pretium sem. Nunc lorem metus, blandit sit amet egestas ut, feugiat quis tellus. Aenean tristique, enim a tincidunt condimentum, eros est blandit nunc, id viverra metus erat at nulla. Vivamus at tellus sodales, feugiat odio vel, laoreet neque. Vivamus posuere nulla ac sodales bibendum.
Vestibulum pulvinar nisi non ultricies egestas. Integer finibus ultrices justo vitae suscipit. Etiam interdum eu justo vel interdum. Morbi sagittis ac nisl quis consequat. Mauris dapibus ut risus ac facilisis. Pellentesque non tortor feugiat, consectetur arcu vel, ullamcorper sapien. Proin sodales purus non orci bibendum, sit amet ultrices justo ullamcorper. Nullam ac risus ac justo ultricies efficitur auctor nec arcu. Etiam sed finibus felis. Suspendisse potenti. Phasellus malesuada velit ac ullamcorper egestas. Sed elementum diam ut est gravida ultricies.
Pellentesque sed metus massa. Cras imperdiet lacus sit amet dolor aliquam, luctus posuere justo hendrerit. Morbi augue ex, gravida a metus sed, scelerisque euismod lacus. Nam consequat sapien ac pellentesque sagittis. Morbi a ultrices massa, vel aliquet ex. Maecenas ac sem diam. Nunc sed erat et ipsum volutpat auctor. Etiam elit felis, commodo vitae ipsum ac, fermentum lobortis arcu. Aliquam eu tempus enim. Curabitur vulputate imperdiet aliquam. Morbi iaculis rhoncus risus at malesuada. Donec accumsan feugiat ligula ut facilisis. Nunc porttitor sit amet est eget malesuada. Sed sed consectetur augue, non dapibus orci. Mauris aliquam pellentesque quam, sit amet pellentesque velit cursus vitae. Morbi sit amet molestie risus.
Nam gravida non ligula a egestas. Fusce sodales, purus id rhoncus mattis, purus est vehicula urna, vel finibus augue velit et est. Donec dictum erat eleifend lobortis iaculis. Praesent id venenatis ante. Donec feugiat, ipsum eget porttitor pulvinar, nisl odio posuere lorem, ut placerat elit nulla a ligula. Suspendisse nec nibh tincidunt, sollicitudin mi a, volutpat ligula. In maximus quam lacus, eget semper dolor sagittis sit amet.
In vitae hendrerit est, quis facilisis dui. In eu ante enim. Nullam hendrerit odio sit amet odio tincidunt eleifend. Aliquam erat volutpat. Curabitur commodo, purus pharetra lobortis rhoncus, tortor massa imperdiet nisl, vel dignissim tortor sem at orci. Aliquam maximus lobortis lacus, eu porttitor purus dapibus ut. Praesent at dapibus felis, efficitur blandit tortor. In hac habitasse platea dictumst. Aenean ultrices, nisl a pretium sagittis, tellus sapien mollis erat, eu consectetur erat mauris sed libero. Duis feugiat dapibus mi, vel ornare velit vehicula mattis. Ut suscipit pharetra leo et sollicitudin.
@@ -0,0 +1,77 @@
import asyncio
import json
import websockets
self_address_request = json.dumps({
"type": "selfAddress"
})
async def send_text_without_reply():
message = "Hello Nym!"
uri = "ws://localhost:1977"
async with websockets.connect(uri) as websocket:
await websocket.send(self_address_request)
self_address = json.loads(await websocket.recv())
print("our address is: {}".format(self_address["address"]))
text_send = json.dumps({
"type": "send",
"message": message,
"recipient": self_address["address"],
"withReplySurb": False,
})
print("sending '{}' (*without* reply SURB) over the mix network...".format(message))
await websocket.send(text_send)
print("waiting to receive a message from the mix network...")
received_message = await websocket.recv()
print("received '{}' from the mix network".format(received_message))
async def send_text_with_reply():
message = "Hello Nym!"
uri = "ws://localhost:1977"
async with websockets.connect(uri) as websocket:
await websocket.send(self_address_request)
self_address = json.loads(await websocket.recv())
print("our address is: {}".format(self_address["address"]))
text_send = json.dumps({
"type": "send",
"message": message,
"recipient": self_address["address"],
"withReplySurb": True,
})
print("sending '{}' (*with* reply SURB) over the mix network...".format(message))
await websocket.send(text_send)
print("waiting to receive a message from the mix network...")
received_message = json.loads(await websocket.recv())
print("received '{}' from the mix network".format(received_message))
# use the received surb to send an anonymous reply!
reply_surb = received_message["replySurb"]
reply_message = "hello from reply SURB!"
reply = json.dumps({
"type": "reply",
"message": reply_message,
"replySurb": reply_surb
})
print("sending '{}' (using reply SURB!) over the mix network...".format(reply_message))
await websocket.send(reply)
print("waiting to receive a message from the mix network...")
received_message = await websocket.recv()
print("received '{}' from the mix network".format(received_message))
# asyncio.get_event_loop().run_until_complete(send_text_without_reply())
asyncio.get_event_loop().run_until_complete(send_text_with_reply())
@@ -0,0 +1,119 @@
use futures::{SinkExt, StreamExt};
use nymsphinx::addressing::clients::Recipient;
use tokio::net::TcpStream;
use tokio_tungstenite::{
connect_async, tungstenite::protocol::Message, MaybeTlsStream, WebSocketStream,
};
use websocket_requests::{requests::ClientRequest, responses::ServerResponse};
// just helpers functions that work in this very particular context because we are sending to ourselves
// and hence will always get a response back (i.e. the message we sent)
async fn send_message_and_get_response(
ws_stream: &mut WebSocketStream<MaybeTlsStream<TcpStream>>,
req: Vec<u8>,
) -> ServerResponse {
ws_stream.send(Message::Binary(req)).await.unwrap();
let raw_message = ws_stream.next().await.unwrap().unwrap();
match raw_message {
Message::Binary(bin_payload) => ServerResponse::deserialize(&bin_payload).unwrap(),
_ => panic!("received an unexpected response type!"),
}
}
async fn get_self_address(ws_stream: &mut WebSocketStream<MaybeTlsStream<TcpStream>>) -> Recipient {
let self_address_request = ClientRequest::SelfAddress.serialize();
let response = send_message_and_get_response(ws_stream, self_address_request).await;
match response {
ServerResponse::SelfAddress(recipient) => recipient,
_ => panic!("received an unexpected response!"),
}
}
async fn send_file_with_reply() {
let uri = "ws://localhost:1977";
let (mut ws_stream, _) = connect_async(uri).await.unwrap();
let recipient = get_self_address(&mut ws_stream).await;
println!("our full address is: {}", recipient.to_string());
let read_data = std::fs::read("examples/dummy_file").unwrap();
let send_request = ClientRequest::Send {
recipient,
message: read_data,
with_reply_surb: true,
};
println!("sending content of 'dummy_file' over the mix network...");
let response = send_message_and_get_response(&mut ws_stream, send_request.serialize()).await;
let received = match response {
ServerResponse::Received(received) => received,
_ => panic!("received an unexpected response!"),
};
println!("writing the file back to the disk!");
std::fs::write("examples/received_file_withreply", received.message).unwrap();
let reply_message = b"hello from reply SURB! - thanks for sending me the file!".to_vec();
let reply_request = ClientRequest::Reply {
message: reply_message.clone(),
reply_surb: received.reply_surb.unwrap(),
};
println!(
"sending {:?} (using reply SURB!) over the mix network...",
String::from_utf8(reply_message).unwrap()
);
let response = send_message_and_get_response(&mut ws_stream, reply_request.serialize()).await;
let received = match response {
ServerResponse::Received(received) => received,
_ => panic!("received an unexpected response!"),
};
println!(
"received {:#?} from the mix network!",
String::from_utf8(received.message).unwrap()
);
}
async fn send_file_without_reply() {
let uri = "ws://localhost:1977";
let (mut ws_stream, _) = connect_async(uri).await.unwrap();
let recipient = get_self_address(&mut ws_stream).await;
println!("our full address is: {}", recipient.to_string());
let read_data = std::fs::read("examples/dummy_file").unwrap();
let send_request = ClientRequest::Send {
recipient,
message: read_data,
with_reply_surb: false,
};
println!("sending content of 'dummy_file' over the mix network...");
let response = send_message_and_get_response(&mut ws_stream, send_request.serialize()).await;
let received = match response {
ServerResponse::Received(received) => received,
_ => panic!("received an unexpected response!"),
};
println!("writing the file back to the disk!");
std::fs::write("examples/received_file_noreply", received.message).unwrap();
}
#[tokio::main]
async fn main() {
println!("#############################");
println!("Example without using replies");
send_file_without_reply().await;
println!("\n\n#############################");
println!("Example using replies");
send_file_with_reply().await;
}
@@ -0,0 +1,109 @@
use futures::{SinkExt, StreamExt};
use serde_json::json;
use tokio::net::TcpStream;
use tokio_tungstenite::{
connect_async, tungstenite::protocol::Message, MaybeTlsStream, WebSocketStream,
};
// PREFACE: in practice I don't see why you would ever want to use text api while in Rust, but example
// is here for the completion sake
// just helpers functions that work in this very particular context because we are sending to ourselves
// and hence will always get a response back (i.e. the message we sent)
async fn send_message_and_get_json_response(
ws_stream: &mut WebSocketStream<MaybeTlsStream<TcpStream>>,
text_req: String,
) -> serde_json::Value {
ws_stream.send(Message::Text(text_req)).await.unwrap();
let raw_message = ws_stream.next().await.unwrap().unwrap();
match raw_message {
Message::Text(txt_msg) => serde_json::from_str(&txt_msg).unwrap(),
_ => panic!("received an unexpected response type!"),
}
}
async fn get_self_address(ws_stream: &mut WebSocketStream<MaybeTlsStream<TcpStream>>) -> String {
let self_address_request = json!({ "type": "selfAddress" }).to_string();
let response = send_message_and_get_json_response(ws_stream, self_address_request).await;
response["address"].as_str().unwrap().to_string()
}
async fn send_text_with_reply() {
let message = "Hello Nym!".to_string();
let uri = "ws://localhost:1977";
let (mut ws_stream, _) = connect_async(uri).await.unwrap();
let recipient = get_self_address(&mut ws_stream).await;
println!("our full address is: {}", recipient.to_string());
let send_request = json!({
"type" : "send",
"recipient": recipient,
"message": message,
"withReplySurb": true,
});
println!(
"sending {:?} (*with* reply SURB) over the mix network...",
message
);
let response =
send_message_and_get_json_response(&mut ws_stream, send_request.to_string()).await;
let reply_message = "hello from reply SURB!";
let reply_request = json!({
"type": "reply",
"message": reply_message,
"replySurb": response["replySurb"]
});
println!(
"sending {:?} (using reply SURB!) over the mix network...",
reply_message
);
let response =
send_message_and_get_json_response(&mut ws_stream, reply_request.to_string()).await;
println!("received {:#?} from the mix network!", response.to_string());
}
async fn send_text_without_reply() {
let message = "Hello Nym!".to_string();
let uri = "ws://localhost:1977";
let (mut ws_stream, _) = connect_async(uri).await.unwrap();
let recipient = get_self_address(&mut ws_stream).await;
println!("our full address is: {}", recipient.to_string());
let send_request = json!({
"type" : "send",
"recipient": recipient,
"message": message,
"withReplySurb": false,
});
println!(
"sending {:?} (*without* reply SURB) over the mix network...",
message
);
let response =
send_message_and_get_json_response(&mut ws_stream, send_request.to_string()).await;
println!("received {:#?} from the mix network!", response.to_string());
}
#[tokio::main]
async fn main() {
println!("#############################");
println!("Example without using replies");
send_text_without_reply().await;
println!("\n\n#############################");
println!("Example using replies");
send_text_with_reply().await;
}
+122
View File
@@ -0,0 +1,122 @@
// Copyright 2021 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
use crate::client::config::template::config_template;
use client_core::config::Config as BaseConfig;
pub use client_core::config::MISSING_VALUE;
use config::defaults::DEFAULT_WEBSOCKET_LISTENING_PORT;
use config::NymConfig;
use serde::{Deserialize, Serialize};
use std::path::PathBuf;
mod template;
#[derive(Debug, Deserialize, PartialEq, Serialize, Clone, Copy)]
#[serde(deny_unknown_fields)]
pub enum SocketType {
WebSocket,
None,
}
impl SocketType {
pub fn from_string<S: Into<String>>(val: S) -> Self {
let mut upper = val.into();
upper.make_ascii_uppercase();
match upper.as_ref() {
"WEBSOCKET" | "WS" => SocketType::WebSocket,
_ => SocketType::None,
}
}
}
#[derive(Debug, Default, Deserialize, PartialEq, Serialize)]
#[serde(deny_unknown_fields)]
pub struct Config {
#[serde(flatten)]
base: BaseConfig<Config>,
socket: Socket,
}
impl NymConfig for Config {
fn template() -> &'static str {
config_template()
}
fn default_root_directory() -> PathBuf {
dirs::home_dir()
.expect("Failed to evaluate $HOME value")
.join(".nym")
.join("clients")
}
fn root_directory(&self) -> PathBuf {
self.base.get_nym_root_directory()
}
fn config_directory(&self) -> PathBuf {
self.root_directory()
.join(self.base.get_id())
.join("config")
}
fn data_directory(&self) -> PathBuf {
self.root_directory().join(self.base.get_id()).join("data")
}
}
impl Config {
pub fn new<S: Into<String>>(id: S) -> Self {
Config {
base: BaseConfig::new(id),
socket: Default::default(),
}
}
pub fn with_socket(mut self, socket_type: SocketType) -> Self {
self.socket.socket_type = socket_type;
self
}
pub fn with_port(mut self, port: u16) -> Self {
self.socket.listening_port = port;
self
}
// getters
pub fn get_config_file_save_location(&self) -> PathBuf {
self.config_directory().join(Self::config_file_name())
}
pub fn get_base(&self) -> &BaseConfig<Self> {
&self.base
}
pub fn get_base_mut(&mut self) -> &mut BaseConfig<Self> {
&mut self.base
}
pub fn get_socket_type(&self) -> SocketType {
self.socket.socket_type
}
pub fn get_listening_port(&self) -> u16 {
self.socket.listening_port
}
}
#[derive(Debug, Deserialize, PartialEq, Serialize)]
#[serde(deny_unknown_fields)]
pub struct Socket {
socket_type: SocketType,
listening_port: u16,
}
impl Default for Socket {
fn default() -> Self {
Socket {
socket_type: SocketType::WebSocket,
listening_port: DEFAULT_WEBSOCKET_LISTENING_PORT,
}
}
}
@@ -0,0 +1,113 @@
// Copyright 2021 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
pub(crate) fn config_template() -> &'static str {
// While using normal toml marshalling would have been way simpler with less overhead,
// I think it's useful to have comments attached to the saved config file to explain behaviour of
// particular fields.
// Note: any changes to the template must be reflected in the appropriate structs.
r#"
# This is a TOML config file.
# For more information, see https://github.com/toml-lang/toml
##### main base client config options #####
[client]
# Version of the client for which this configuration was created.
version = '{{ client.version }}'
# Human readable ID of this particular client.
id = '{{ client.id }}'
# Indicates whether this client is running in a testnet mode, thus attempting
# to claim bandwidth without presenting bandwidth credentials.
testnet_mode = {{ client.testnet_mode }}
# Addresses to APIs running on validator from which the client gets the view of the network.
validator_api_urls = [
{{#each client.validator_api_urls }}
'{{this}}',
{{/each}}
]
# Path to file containing private identity key.
private_identity_key_file = '{{ client.private_identity_key_file }}'
# Path to file containing public identity key.
public_identity_key_file = '{{ client.public_identity_key_file }}'
# Path to file containing private encryption key.
private_encryption_key_file = '{{ client.private_encryption_key_file }}'
# Path to file containing public encryption key.
public_encryption_key_file = '{{ client.public_encryption_key_file }}'
# Full path to file containing reply encryption keys of all reply-SURBs we have ever
# sent but not received back.
reply_encryption_key_store_path = '{{ client.reply_encryption_key_store_path }}'
# Path to directory containing public/private keys used for bandwidth token purchase.
# Those are saved in case of emergency, to be able to reclaim bandwidth tokens.
# The public key is the name of the file, while the private key is the content.
backup_bandwidth_token_keys_dir = '{{ client.backup_bandwidth_token_keys_dir }}'
# Ethereum private key.
eth_private_key = '{{ client.eth_private_key }}'
# Addess to an Ethereum full node.
eth_endpoint = '{{ client.eth_endpoint }}'
##### additional client config options #####
# ID of the gateway from which the client should be fetching messages.
gateway_id = '{{ client.gateway_id }}'
# Address of the gateway listener to which all client requests should be sent.
gateway_listener = '{{ client.gateway_listener }}'
# A gateway specific, optional, base58 stringified shared key used for
# communication with particular gateway.
gateway_shared_key_file = '{{ client.gateway_shared_key_file }}'
# Path to file containing key used for encrypting and decrypting the content of an
# acknowledgement so that nobody besides the client knows which packet it refers to.
ack_key_file = '{{ client.ack_key_file }}'
##### advanced configuration options #####
# Absolute path to the home Nym Clients directory.
nym_root_directory = '{{ client.nym_root_directory }}'
##### socket config options #####
[socket]
# allowed values are 'WebSocket' or 'None'
socket_type = '{{ socket.socket_type }}'
# if applicable (for the case of 'WebSocket'), the port on which the client
# will be listening for incoming requests
listening_port = {{ socket.listening_port }}
##### logging configuration options #####
[logging]
# TODO
##### debug configuration options #####
# The following options should not be modified unless you know EXACTLY what you are doing
# as if set incorrectly, they may impact your anonymity.
[debug]
average_packet_delay = '{{ debug.average_packet_delay }}'
average_ack_delay = '{{ debug.average_ack_delay }}'
loop_cover_traffic_average_delay = '{{ debug.loop_cover_traffic_average_delay }}'
message_sending_average_delay = '{{ debug.message_sending_average_delay }}'
"#
}
+396
View File
@@ -0,0 +1,396 @@
// Copyright 2021 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
use client_core::client::cover_traffic_stream::LoopCoverTrafficStream;
use client_core::client::inbound_messages::{
InputMessage, InputMessageReceiver, InputMessageSender,
};
use client_core::client::key_manager::KeyManager;
use client_core::client::mix_traffic::{
BatchMixMessageReceiver, BatchMixMessageSender, MixTrafficController,
};
use client_core::client::real_messages_control;
use client_core::client::real_messages_control::RealMessagesController;
use client_core::client::received_buffer::{
ReceivedBufferMessage, ReceivedBufferRequestReceiver, ReceivedBufferRequestSender,
ReceivedMessagesBufferController, ReconstructedMessagesReceiver,
};
use client_core::client::reply_key_storage::ReplyKeyStorage;
use client_core::client::topology_control::{
TopologyAccessor, TopologyRefresher, TopologyRefresherConfig,
};
use client_core::config::persistence::key_pathfinder::ClientKeyPathfinder;
use crypto::asymmetric::identity;
use futures::channel::mpsc;
use gateway_client::bandwidth::BandwidthController;
use gateway_client::{
AcknowledgementReceiver, AcknowledgementSender, GatewayClient, MixnetMessageReceiver,
MixnetMessageSender,
};
use log::*;
use nymsphinx::addressing::clients::Recipient;
use nymsphinx::addressing::nodes::NodeIdentity;
use nymsphinx::anonymous_replies::ReplySurb;
use nymsphinx::receiver::ReconstructedMessage;
use crate::client::config::{Config, SocketType};
use crate::websocket;
pub(crate) mod config;
pub struct NymClient {
/// Client configuration options, including, among other things, packet sending rates,
/// key filepaths, etc.
config: Config,
/// KeyManager object containing smart pointers to all relevant keys used by the client.
key_manager: KeyManager,
/// Channel used for transforming 'raw' messages into sphinx packets and sending them
/// through the mix network.
/// It is only available if the client started with the websocket listener disabled.
input_tx: Option<InputMessageSender>,
/// Channel used for obtaining reconstructed messages received from the mix network.
/// It is only available if the client started with the websocket listener disabled.
receive_tx: Option<ReconstructedMessagesReceiver>,
}
impl NymClient {
pub fn new(config: Config) -> Self {
let pathfinder = ClientKeyPathfinder::new_from_config(config.get_base());
let key_manager = KeyManager::load_keys(&pathfinder).expect("failed to load stored keys");
NymClient {
config,
key_manager,
input_tx: None,
receive_tx: None,
}
}
pub fn as_mix_recipient(&self) -> Recipient {
Recipient::new(
*self.key_manager.identity_keypair().public_key(),
*self.key_manager.encryption_keypair().public_key(),
// TODO: below only works under assumption that gateway address == gateway id
// (which currently is true)
NodeIdentity::from_base58_string(self.config.get_base().get_gateway_id()).unwrap(),
)
}
// future constantly pumping loop cover traffic at some specified average rate
// the pumped traffic goes to the MixTrafficController
fn start_cover_traffic_stream(
&self,
topology_accessor: TopologyAccessor,
mix_tx: BatchMixMessageSender,
) {
info!("Starting loop cover traffic stream...");
LoopCoverTrafficStream::new(
self.key_manager.ack_key(),
self.config.get_base().get_average_ack_delay(),
self.config.get_base().get_average_packet_delay(),
self.config
.get_base()
.get_loop_cover_traffic_average_delay(),
mix_tx,
self.as_mix_recipient(),
topology_accessor,
)
.start();
}
fn start_real_traffic_controller(
&self,
topology_accessor: TopologyAccessor,
reply_key_storage: ReplyKeyStorage,
ack_receiver: AcknowledgementReceiver,
input_receiver: InputMessageReceiver,
mix_sender: BatchMixMessageSender,
) {
let controller_config = real_messages_control::Config::new(
self.key_manager.ack_key(),
self.config.get_base().get_ack_wait_multiplier(),
self.config.get_base().get_ack_wait_addition(),
self.config.get_base().get_average_ack_delay(),
self.config.get_base().get_message_sending_average_delay(),
self.config.get_base().get_average_packet_delay(),
self.as_mix_recipient(),
);
info!("Starting real traffic stream...");
RealMessagesController::new(
controller_config,
ack_receiver,
input_receiver,
mix_sender,
topology_accessor,
reply_key_storage,
)
.start();
}
// buffer controlling all messages fetched from provider
// required so that other components would be able to use them (say the websocket)
fn start_received_messages_buffer_controller(
&self,
query_receiver: ReceivedBufferRequestReceiver,
mixnet_receiver: MixnetMessageReceiver,
reply_key_storage: ReplyKeyStorage,
) {
info!("Starting received messages buffer controller...");
ReceivedMessagesBufferController::new(
self.key_manager.encryption_keypair(),
query_receiver,
mixnet_receiver,
reply_key_storage,
)
.start()
}
async fn start_gateway_client(
&mut self,
mixnet_message_sender: MixnetMessageSender,
ack_sender: AcknowledgementSender,
) -> GatewayClient {
let gateway_id = self.config.get_base().get_gateway_id();
if gateway_id.is_empty() {
panic!("The identity of the gateway is unknown - did you run `nym-client` init?")
}
let gateway_address = self.config.get_base().get_gateway_listener();
if gateway_address.is_empty() {
panic!("The address of the gateway is unknown - did you run `nym-client` init?")
}
let gateway_identity = identity::PublicKey::from_base58_string(gateway_id)
.expect("provided gateway id is invalid!");
#[cfg(feature = "coconut")]
let bandwidth_controller = BandwidthController::new(
self.config.get_base().get_validator_api_endpoints(),
*self.key_manager.identity_keypair().public_key(),
);
#[cfg(not(feature = "coconut"))]
let bandwidth_controller = BandwidthController::new(
self.config.get_base().get_eth_endpoint(),
self.config.get_base().get_eth_private_key(),
self.config.get_base().get_backup_bandwidth_token_keys_dir(),
)
.expect("Could not create bandwidth controller");
let mut gateway_client = GatewayClient::new(
gateway_address,
self.key_manager.identity_keypair(),
gateway_identity,
Some(self.key_manager.gateway_shared_key()),
mixnet_message_sender,
ack_sender,
self.config.get_base().get_gateway_response_timeout(),
Some(bandwidth_controller),
);
if self.config.get_base().get_testnet_mode() {
gateway_client.set_testnet_mode(true)
}
gateway_client
.authenticate_and_start()
.await
.expect("could not authenticate and start up the gateway connection");
gateway_client
}
// future responsible for periodically polling directory server and updating
// the current global view of topology
async fn start_topology_refresher(&mut self, topology_accessor: TopologyAccessor) {
let topology_refresher_config = TopologyRefresherConfig::new(
self.config.get_base().get_validator_api_endpoints(),
self.config.get_base().get_topology_refresh_rate(),
env!("CARGO_PKG_VERSION").to_string(),
);
let mut topology_refresher =
TopologyRefresher::new(topology_refresher_config, topology_accessor);
// before returning, block entire runtime to refresh the current network view so that any
// components depending on topology would see a non-empty view
info!("Obtaining initial network topology");
topology_refresher.refresh().await;
// TODO: a slightly more graceful termination here
if !topology_refresher.is_topology_routable().await {
panic!(
"The current network topology seem to be insufficient to route any packets through\
- check if enough nodes and a gateway are online"
);
}
info!("Starting topology refresher...");
topology_refresher.start();
}
// controller for sending sphinx packets to mixnet (either real traffic or cover traffic)
// TODO: if we want to send control messages to gateway_client, this CAN'T take the ownership
// over it. Perhaps GatewayClient needs to be thread-shareable or have some channel for
// requests?
fn start_mix_traffic_controller(
&mut self,
mix_rx: BatchMixMessageReceiver,
gateway_client: GatewayClient,
) {
info!("Starting mix traffic controller...");
MixTrafficController::new(mix_rx, gateway_client).start();
}
fn start_websocket_listener(
&self,
buffer_requester: ReceivedBufferRequestSender,
msg_input: InputMessageSender,
) {
info!("Starting websocket listener...");
let websocket_handler =
websocket::Handler::new(msg_input, buffer_requester, self.as_mix_recipient());
websocket::Listener::new(self.config.get_listening_port()).start(websocket_handler);
}
/// EXPERIMENTAL DIRECT RUST API
/// It's untested and there are absolutely no guarantees about it (but seems to have worked
/// well enough in local tests)
pub fn send_message(&mut self, recipient: Recipient, message: Vec<u8>, with_reply_surb: bool) {
let input_msg = InputMessage::new_fresh(recipient, message, with_reply_surb);
self.input_tx
.as_ref()
.expect("start method was not called before!")
.unbounded_send(input_msg)
.unwrap();
}
/// EXPERIMENTAL DIRECT RUST API
/// It's untested and there are absolutely no guarantees about it (but seems to have worked
/// well enough in local tests)
pub fn send_reply(&mut self, reply_surb: ReplySurb, message: Vec<u8>) {
let input_msg = InputMessage::new_reply(reply_surb, message);
self.input_tx
.as_ref()
.expect("start method was not called before!")
.unbounded_send(input_msg)
.unwrap();
}
/// EXPERIMENTAL DIRECT RUST API
/// It's untested and there are absolutely no guarantees about it (but seems to have worked
/// well enough in local tests)
/// Note: it waits for the first occurrence of messages being sent to ourselves. If you expect multiple
/// messages, you might have to call this function repeatedly.
// TODO: I guess this should really return something that `impl Stream<Item=ReconstructedMessage>`
pub async fn wait_for_messages(&mut self) -> Vec<ReconstructedMessage> {
use futures::StreamExt;
self.receive_tx
.as_mut()
.expect("start method was not called before!")
.next()
.await
.expect("buffer controller seems to have somehow died!")
}
/// blocking version of `start` method. Will run forever (or until SIGINT is sent)
pub async fn run_forever(&mut self) {
self.start().await;
if let Err(e) = tokio::signal::ctrl_c().await {
error!(
"There was an error while capturing SIGINT - {:?}. We will terminate regardless",
e
);
}
println!(
"Received SIGINT - the client will terminate now (threads are not yet nicely stopped, if you see stack traces that's alright)."
);
}
pub async fn start(&mut self) {
info!("Starting nym client");
// channels for inter-component communication
// TODO: make the channels be internally created by the relevant components
// rather than creating them here, so say for example the buffer controller would create the request channels
// and would allow anyone to clone the sender channel
// sphinx_message_sender is the transmitter for any component generating sphinx packets that are to be sent to the mixnet
// they are used by cover traffic stream and real traffic stream
// sphinx_message_receiver is the receiver used by MixTrafficController that sends the actual traffic
let (sphinx_message_sender, sphinx_message_receiver) = mpsc::unbounded();
// unwrapped_sphinx_sender is the transmitter of mixnet messages received from the gateway
// unwrapped_sphinx_receiver is the receiver for said messages - used by ReceivedMessagesBuffer
let (mixnet_messages_sender, mixnet_messages_receiver) = mpsc::unbounded();
// used for announcing connection or disconnection of a channel for pushing re-assembled messages to
let (received_buffer_request_sender, received_buffer_request_receiver) = mpsc::unbounded();
// channels responsible for controlling real messages
let (input_sender, input_receiver) = mpsc::unbounded::<InputMessage>();
// channels responsible for controlling ack messages
let (ack_sender, ack_receiver) = mpsc::unbounded();
let shared_topology_accessor = TopologyAccessor::new();
let reply_key_storage =
ReplyKeyStorage::load(self.config.get_base().get_reply_encryption_key_store_path())
.expect("Failed to load reply key storage!");
// the components are started in very specific order. Unless you know what you are doing,
// do not change that.
self.start_topology_refresher(shared_topology_accessor.clone())
.await;
self.start_received_messages_buffer_controller(
received_buffer_request_receiver,
mixnet_messages_receiver,
reply_key_storage.clone(),
);
let gateway_client = self
.start_gateway_client(mixnet_messages_sender, ack_sender)
.await;
self.start_mix_traffic_controller(sphinx_message_receiver, gateway_client);
self.start_real_traffic_controller(
shared_topology_accessor.clone(),
reply_key_storage,
ack_receiver,
input_receiver,
sphinx_message_sender.clone(),
);
self.start_cover_traffic_stream(shared_topology_accessor, sphinx_message_sender);
match self.config.get_socket_type() {
SocketType::WebSocket => {
self.start_websocket_listener(received_buffer_request_sender, input_sender)
}
SocketType::None => {
// if we did not start the socket, it means we're running (supposedly) in the native mode
// and hence we should announce 'ourselves' to the buffer
let (reconstructed_sender, reconstructed_receiver) = mpsc::unbounded();
// tell the buffer to start sending stuff to us
received_buffer_request_sender
.unbounded_send(ReceivedBufferMessage::ReceiverAnnounce(
reconstructed_sender,
))
.expect("the buffer request failed!");
self.receive_tx = Some(reconstructed_receiver);
self.input_tx = Some(input_sender);
}
}
info!("Client startup finished!");
info!("The address of this client is: {}", self.as_mix_recipient());
}
}
+285
View File
@@ -0,0 +1,285 @@
// Copyright 2021 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
use clap::{App, Arg, ArgMatches};
use client_core::client::key_manager::KeyManager;
use client_core::config::persistence::key_pathfinder::ClientKeyPathfinder;
#[cfg(feature = "coconut")]
use coconut_interface::{hash_to_scalar, Credential, Parameters};
use config::NymConfig;
#[cfg(feature = "coconut")]
use credentials::coconut::bandwidth::{
obtain_signature, prepare_for_spending, BandwidthVoucherAttributes, TOTAL_ATTRIBUTES,
};
#[cfg(feature = "coconut")]
use credentials::obtain_aggregate_verification_key;
use crypto::asymmetric::{encryption, identity};
use gateway_client::GatewayClient;
use gateway_requests::registration::handshake::SharedKeys;
#[cfg(feature = "coconut")]
use network_defaults::BANDWIDTH_VALUE;
use nymsphinx::addressing::clients::Recipient;
use nymsphinx::addressing::nodes::NodeIdentity;
use rand::rngs::OsRng;
use rand::seq::SliceRandom;
use rand::thread_rng;
use std::convert::TryInto;
use std::sync::Arc;
use std::time::Duration;
use topology::{filter::VersionFilterable, gateway};
use url::Url;
use crate::client::config::Config;
use crate::commands::override_config;
#[cfg(feature = "eth")]
#[cfg(not(feature = "coconut"))]
use crate::commands::{
DEFAULT_ETH_ENDPOINT, DEFAULT_ETH_PRIVATE_KEY, ETH_ENDPOINT_ARG_NAME, ETH_PRIVATE_KEY_ARG_NAME,
TESTNET_MODE_ARG_NAME,
};
pub fn command_args<'a, 'b>() -> clap::App<'a, 'b> {
let app = App::new("init")
.about("Initialise a Nym client. Do this first!")
.arg(Arg::with_name("id")
.long("id")
.help("Id of the nym-mixnet-client we want to create config for.")
.takes_value(true)
.required(true)
)
.arg(Arg::with_name("gateway")
.long("gateway")
.help("Id of the gateway we are going to connect to.")
.takes_value(true)
)
.arg(Arg::with_name("validators")
.long("validators")
.help("Comma separated list of rest endpoints of the validators")
.takes_value(true),
)
.arg(Arg::with_name("disable-socket")
.long("disable-socket")
.help("Whether to not start the websocket")
)
.arg(Arg::with_name("port")
.short("p")
.long("port")
.help("Port for the socket (if applicable) to listen on in all subsequent runs")
.takes_value(true)
)
.arg(Arg::with_name("fastmode")
.long("fastmode")
.hidden(true) // this will prevent this flag from being displayed in `--help`
.help("Mostly debug-related option to increase default traffic rate so that you would not need to modify config post init")
);
#[cfg(feature = "eth")]
#[cfg(not(feature = "coconut"))]
let app = app
.arg(
Arg::with_name(TESTNET_MODE_ARG_NAME)
.long(TESTNET_MODE_ARG_NAME)
.help("Set this client to work in a testnet mode that would attempt to use gateway without bandwidth credential requirement. If this value is set, --eth_endpoint and --eth_private_key don't need to be set.")
.conflicts_with_all(&[ETH_ENDPOINT_ARG_NAME, ETH_PRIVATE_KEY_ARG_NAME])
)
.arg(Arg::with_name(ETH_ENDPOINT_ARG_NAME)
.long(ETH_ENDPOINT_ARG_NAME)
.help("URL of an Ethereum full node that we want to use for getting bandwidth tokens from ERC20 tokens. If you don't want to set this value, use --testnet-mode instead")
.takes_value(true)
.default_value_if(TESTNET_MODE_ARG_NAME, None, DEFAULT_ETH_ENDPOINT)
.required(true))
.arg(Arg::with_name(ETH_PRIVATE_KEY_ARG_NAME)
.long(ETH_PRIVATE_KEY_ARG_NAME)
.help("Ethereum private key used for obtaining bandwidth tokens from ERC20 tokens. If you don't want to set this value, use --testnet-mode instead")
.takes_value(true)
.default_value_if(TESTNET_MODE_ARG_NAME, None, DEFAULT_ETH_PRIVATE_KEY)
.required(true)
);
app
}
// this behaviour should definitely be changed, we shouldn't
// need to get bandwidth credential for registration
#[cfg(feature = "coconut")]
async fn _prepare_temporary_credential(validators: &[Url], raw_identity: &[u8]) -> Credential {
let verification_key = obtain_aggregate_verification_key(validators)
.await
.expect("could not obtain aggregate verification key of validators");
let params = Parameters::new(TOTAL_ATTRIBUTES).unwrap();
let bandwidth_credential_attributes = BandwidthVoucherAttributes {
serial_number: params.random_scalar(),
binding_number: params.random_scalar(),
voucher_value: hash_to_scalar(BANDWIDTH_VALUE.to_be_bytes()),
voucher_info: hash_to_scalar(String::from("BandwidthVoucher").as_bytes()),
};
let bandwidth_credential =
obtain_signature(&params, &bandwidth_credential_attributes, validators)
.await
.expect("could not obtain bandwidth credential");
prepare_for_spending(
raw_identity,
&bandwidth_credential,
&bandwidth_credential_attributes,
&verification_key,
)
.expect("could not prepare out bandwidth credential for spending")
}
async fn register_with_gateway(
gateway: &gateway::Node,
our_identity: Arc<identity::KeyPair>,
) -> Arc<SharedKeys> {
let timeout = Duration::from_millis(1500);
let mut gateway_client = GatewayClient::new_init(
gateway.clients_address(),
gateway.identity_key,
our_identity.clone(),
timeout,
);
gateway_client
.establish_connection()
.await
.expect("failed to establish connection with the gateway!");
gateway_client
.perform_initial_authentication()
.await
.expect("failed to register with the gateway!")
}
async fn gateway_details(
validator_servers: Vec<Url>,
chosen_gateway_id: Option<&str>,
) -> gateway::Node {
let validator_api = validator_servers
.choose(&mut thread_rng())
.expect("The list of validator apis is empty");
let validator_client = validator_client::ApiClient::new(validator_api.clone());
let gateways = validator_client.get_cached_gateways().await.unwrap();
let valid_gateways = gateways
.into_iter()
.filter_map(|gateway| gateway.try_into().ok())
.collect::<Vec<gateway::Node>>();
let filtered_gateways = valid_gateways.filter_by_version(env!("CARGO_PKG_VERSION"));
// if we have chosen particular gateway - use it, otherwise choose a random one.
// (remember that in active topology all gateways have at least 100 reputation so should
// be working correctly)
if let Some(gateway_id) = chosen_gateway_id {
filtered_gateways
.iter()
.find(|gateway| gateway.identity_key.to_base58_string() == gateway_id)
.expect(&*format!("no gateway with id {} exists!", gateway_id))
.clone()
} else {
filtered_gateways
.choose(&mut rand::thread_rng())
.expect("there are no gateways on the network!")
.clone()
}
}
fn show_address(config: &Config) {
fn load_identity_keys(pathfinder: &ClientKeyPathfinder) -> identity::KeyPair {
let identity_keypair: identity::KeyPair =
pemstore::load_keypair(&pemstore::KeyPairPath::new(
pathfinder.private_identity_key().to_owned(),
pathfinder.public_identity_key().to_owned(),
))
.expect("Failed to read stored identity key files");
identity_keypair
}
fn load_sphinx_keys(pathfinder: &ClientKeyPathfinder) -> encryption::KeyPair {
let sphinx_keypair: encryption::KeyPair =
pemstore::load_keypair(&pemstore::KeyPairPath::new(
pathfinder.private_encryption_key().to_owned(),
pathfinder.public_encryption_key().to_owned(),
))
.expect("Failed to read stored sphinx key files");
sphinx_keypair
}
let pathfinder = ClientKeyPathfinder::new_from_config(config.get_base());
let identity_keypair = load_identity_keys(&pathfinder);
let sphinx_keypair = load_sphinx_keys(&pathfinder);
let client_recipient = Recipient::new(
*identity_keypair.public_key(),
*sphinx_keypair.public_key(),
// TODO: below only works under assumption that gateway address == gateway id
// (which currently is true)
NodeIdentity::from_base58_string(config.get_base().get_gateway_id()).unwrap(),
);
println!("\nThe address of this client is: {}", client_recipient);
}
pub async fn execute(matches: ArgMatches<'static>) {
println!("Initialising client...");
let id = matches.value_of("id").unwrap(); // required for now
let already_init = if Config::default_config_file_path(Some(id)).exists() {
println!("Client \"{}\" was already initialised before! Config information will be overwritten (but keys will be kept)!", id);
true
} else {
false
};
let mut config = Config::new(id);
let mut rng = OsRng;
// TODO: ideally that should be the last thing that's being done to config.
// However, we are later further overriding it with gateway id
config = override_config(config, &matches);
if matches.is_present("fastmode") {
config.get_base_mut().set_high_default_traffic_volume();
}
// if client was already initialised, don't generate new keys, not re-register with gateway
// (because this would create new shared key)
if !already_init {
// create identity, encryption and ack keys.
let mut key_manager = KeyManager::new(&mut rng);
let chosen_gateway_id = matches.value_of("gateway");
let gateway_details = gateway_details(
config.get_base().get_validator_api_endpoints(),
chosen_gateway_id,
)
.await;
config
.get_base_mut()
.with_gateway_id(gateway_details.identity_key.to_base58_string());
let shared_keys =
register_with_gateway(&gateway_details, key_manager.identity_keypair()).await;
config
.get_base_mut()
.with_gateway_listener(gateway_details.clients_address());
key_manager.insert_gateway_shared_key(shared_keys);
let pathfinder = ClientKeyPathfinder::new_from_config(config.get_base());
key_manager
.store_keys(&pathfinder)
.expect("Failed to generated keys");
println!("Saved all generated keys");
}
let config_save_location = config.get_config_file_save_location();
config
.save_to_file(None)
.expect("Failed to save the config file");
println!("Saved configuration file to {:?}", config_save_location);
println!("Using gateway: {}", config.get_base().get_gateway_id(),);
println!("Client configuration completed.\n\n\n");
show_address(&config);
}
+80
View File
@@ -0,0 +1,80 @@
// Copyright 2021 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
use crate::client::config::{Config, SocketType};
use clap::ArgMatches;
use url::Url;
pub(crate) const TESTNET_MODE_ARG_NAME: &str = "testnet-mode";
#[cfg(not(feature = "coconut"))]
pub(crate) const ETH_ENDPOINT_ARG_NAME: &str = "eth_endpoint";
#[cfg(not(feature = "coconut"))]
pub(crate) const ETH_PRIVATE_KEY_ARG_NAME: &str = "eth_private_key";
#[cfg(not(feature = "coconut"))]
pub(crate) const DEFAULT_ETH_ENDPOINT: &str =
"https://rinkeby.infura.io/v3/00000000000000000000000000000000";
#[cfg(not(feature = "coconut"))]
pub(crate) const DEFAULT_ETH_PRIVATE_KEY: &str =
"0000000000000000000000000000000000000000000000000000000000000001";
pub(crate) mod init;
pub(crate) mod run;
pub(crate) mod upgrade;
fn parse_validators(raw: &str) -> Vec<Url> {
raw.split(',')
.map(|raw_validator| {
raw_validator
.trim()
.parse()
.expect("one of the provided validator api urls is invalid")
})
.collect()
}
pub(crate) fn override_config(mut config: Config, matches: &ArgMatches) -> Config {
if let Some(raw_validators) = matches.value_of("validators") {
config
.get_base_mut()
.set_custom_validator_apis(parse_validators(raw_validators));
}
if let Some(gateway_id) = matches.value_of("gateway") {
config.get_base_mut().with_gateway_id(gateway_id);
}
if matches.is_present("disable-socket") {
config = config.with_socket(SocketType::None);
}
if let Some(port) = matches.value_of("port").map(|port| port.parse::<u16>()) {
if let Err(err) = port {
// if port was overridden, it must be parsable
panic!("Invalid port value provided - {:?}", err);
}
config = config.with_port(port.unwrap());
}
#[cfg(not(feature = "coconut"))]
if let Some(eth_endpoint) = matches.value_of(ETH_ENDPOINT_ARG_NAME) {
config.get_base_mut().with_eth_endpoint(eth_endpoint);
} else {
config
.get_base_mut()
.with_eth_endpoint(DEFAULT_ETH_ENDPOINT);
}
#[cfg(not(feature = "coconut"))]
if let Some(eth_private_key) = matches.value_of(ETH_PRIVATE_KEY_ARG_NAME) {
config.get_base_mut().with_eth_private_key(eth_private_key);
} else {
config
.get_base_mut()
.with_eth_private_key(DEFAULT_ETH_PRIVATE_KEY);
}
if !cfg!(feature = "eth") || matches.is_present(TESTNET_MODE_ARG_NAME) {
config.get_base_mut().with_testnet_mode(true)
}
config
}
+104
View File
@@ -0,0 +1,104 @@
// Copyright 2021 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
use crate::client::config::Config;
use crate::client::NymClient;
use crate::commands::override_config;
#[cfg(feature = "eth")]
#[cfg(not(feature = "coconut"))]
use crate::commands::{ETH_ENDPOINT_ARG_NAME, ETH_PRIVATE_KEY_ARG_NAME, TESTNET_MODE_ARG_NAME};
use clap::{App, Arg, ArgMatches};
use config::NymConfig;
use log::*;
use version_checker::is_minor_version_compatible;
pub fn command_args<'a, 'b>() -> clap::App<'a, 'b> {
let app = App::new("run")
.about("Run the Nym client with provided configuration client optionally overriding set parameters")
.arg(Arg::with_name("id")
.long("id")
.help("Id of the nym-mixnet-client we want to run.")
.takes_value(true)
.required(true)
)
// the rest of arguments are optional, they are used to override settings in config file
.arg(Arg::with_name("validators")
.long("validators")
.help("Comma separated list rest rest endpoints of the validators")
.takes_value(true),
)
.arg(Arg::with_name("gateway")
.long("gateway")
.help("Id of the gateway we want to connect to. If overridden, it is user's responsibility to ensure prior registration happened")
.takes_value(true)
)
.arg(Arg::with_name("disable-socket")
.long("disable-socket")
.help("Whether to not start the websocket")
)
.arg(Arg::with_name("port")
.short("p")
.long("port")
.help("Port for the socket (if applicable) to listen on")
.takes_value(true)
);
#[cfg(feature = "eth")]
#[cfg(not(feature = "coconut"))]
let app = app
.arg(
Arg::with_name(TESTNET_MODE_ARG_NAME)
.long(TESTNET_MODE_ARG_NAME)
.help("Set this client to work in a testnet mode that would attempt to use gateway without bandwidth credential requirement. If this value is set, --eth_endpoint and --eth_private_key don't need to be set.")
.conflicts_with_all(&[ETH_ENDPOINT_ARG_NAME, ETH_PRIVATE_KEY_ARG_NAME])
)
.arg(Arg::with_name(ETH_ENDPOINT_ARG_NAME)
.long(ETH_ENDPOINT_ARG_NAME)
.help("URL of an Ethereum full node that we want to use for getting bandwidth tokens from ERC20 tokens. If you don't want to set this value, use --testnet-mode instead")
.takes_value(true))
.arg(Arg::with_name(ETH_PRIVATE_KEY_ARG_NAME)
.long(ETH_PRIVATE_KEY_ARG_NAME)
.help("Ethereum private key used for obtaining bandwidth tokens from ERC20 tokens. If you don't want to set this value, use --testnet-mode instead")
.takes_value(true));
app
}
// this only checks compatibility between config the binary. It does not take into consideration
// network version. It might do so in the future.
fn version_check(cfg: &Config) -> bool {
let binary_version = env!("CARGO_PKG_VERSION");
let config_version = cfg.get_base().get_version();
if binary_version != config_version {
warn!("The mixnode binary has different version than what is specified in config file! {} and {}", binary_version, config_version);
if is_minor_version_compatible(binary_version, config_version) {
info!("but they are still semver compatible. However, consider running the `upgrade` command");
true
} else {
error!("and they are semver incompatible! - please run the `upgrade` command before attempting `run` again");
false
}
} else {
true
}
}
pub async fn execute(matches: ArgMatches<'static>) {
let id = matches.value_of("id").unwrap();
let mut config = match Config::load_from_file(Some(id)) {
Ok(cfg) => cfg,
Err(err) => {
error!("Failed to load config for {}. Are you sure you have run `init` before? (Error was: {})", id, err);
return;
}
};
config = override_config(config, &matches);
if !version_check(&config) {
error!("failed the local version check");
return;
}
NymClient::new(config).run_forever().await;
}
+171
View File
@@ -0,0 +1,171 @@
// Copyright 2021 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
use crate::client::config::{Config, MISSING_VALUE};
use clap::{App, Arg, ArgMatches};
use config::defaults::default_api_endpoints;
use config::NymConfig;
use std::fmt::Display;
use std::process;
use version_checker::Version;
#[allow(dead_code)]
fn fail_upgrade<D1: Display, D2: Display>(from_version: D1, to_version: D2) -> ! {
print_failed_upgrade(from_version, to_version);
process::exit(1)
}
fn print_start_upgrade<D1: Display, D2: Display>(from: D1, to: D2) {
println!(
"\n==================\nTrying to upgrade client from {} to {} ...",
from, to
);
}
fn print_failed_upgrade<D1: Display, D2: Display>(from: D1, to: D2) {
eprintln!(
"Upgrade from {} to {} failed!\n==================\n",
from, to
);
}
fn print_successful_upgrade<D1: Display, D2: Display>(from: D1, to: D2) {
println!(
"Upgrade from {} to {} was successful!\n==================\n",
from, to
);
}
fn outdated_upgrade(config_version: &Version, package_version: &Version) -> ! {
eprintln!(
"Cannot perform upgrade from {} to {}. Your version is too old to perform the upgrade.!",
config_version, package_version
);
process::exit(1)
}
fn unsupported_upgrade(current_version: &Version, config_version: &Version) -> ! {
eprintln!("Cannot perform upgrade from {} to {}. Please let the developers know about this issue if you expected it to work!", config_version, current_version);
process::exit(1)
}
pub fn command_args<'a, 'b>() -> App<'a, 'b> {
App::new("upgrade").about("Try to upgrade the client").arg(
Arg::with_name("id")
.long("id")
.help("Id of the nym-client we want to upgrade")
.takes_value(true)
.required(true),
)
}
fn parse_config_version(config: &Config) -> Version {
let version = Version::parse(config.get_base().get_version()).unwrap_or_else(|err| {
eprintln!("failed to parse client version! - {:?}", err);
process::exit(1)
});
if version.is_prerelease() || !version.build.is_empty() {
eprintln!(
"Trying to upgrade from a non-released version {}. This is not supported!",
version
);
process::exit(1)
}
version
}
fn parse_package_version() -> Version {
let version = Version::parse(env!("CARGO_PKG_VERSION")).unwrap();
// technically this is not a correct way of checking it as a released version might contain valid build identifiers
// however, we are not using them ourselves at the moment and hence it should be fine.
// if we change our mind, we could easily tweak this code
if version.is_prerelease() || !version.build.is_empty() {
eprintln!(
"Trying to upgrade to a non-released version {}. This is not supported!",
version
);
process::exit(1)
}
version
}
fn minor_0_12_upgrade(
mut config: Config,
_matches: &ArgMatches,
config_version: &Version,
package_version: &Version,
) -> Config {
let to_version = if package_version.major == 0 && package_version.minor == 12 {
package_version.clone()
} else {
Version::new(0, 12, 0)
};
print_start_upgrade(&config_version, &to_version);
println!(
"Setting validator API endpoints to {:?}",
default_api_endpoints()
);
config
.get_base_mut()
.set_custom_validator_apis(default_api_endpoints());
config
.get_base_mut()
.set_custom_version(to_version.to_string().as_ref());
config.save_to_file(None).unwrap_or_else(|err| {
eprintln!("failed to overwrite config file! - {:?}", err);
print_failed_upgrade(&config_version, &to_version);
process::exit(1);
});
print_successful_upgrade(config_version, to_version);
config
}
fn do_upgrade(mut config: Config, matches: &ArgMatches, package_version: Version) {
loop {
let config_version = parse_config_version(&config);
if config_version == package_version {
println!("You're using the most recent version!");
return;
}
config = match config_version.major {
0 => match config_version.minor {
9 | 10 => outdated_upgrade(&config_version, &package_version),
11 => minor_0_12_upgrade(config, matches, &config_version, &package_version),
_ => unsupported_upgrade(&config_version, &package_version),
},
_ => unsupported_upgrade(&config_version, &package_version),
}
}
}
pub fn execute(matches: &ArgMatches) {
let package_version = parse_package_version();
let id = matches.value_of("id").unwrap();
let existing_config = Config::load_from_file(Some(id)).unwrap_or_else(|err| {
eprintln!("failed to load existing config file! - {:?}", err);
process::exit(1)
});
if existing_config.get_base().get_version() == MISSING_VALUE {
eprintln!("the existing configuration file does not seem to contain version number.");
process::exit(1);
}
// here be upgrade path to 0.9.X and beyond based on version number from config
do_upgrade(existing_config, matches, package_version)
}
+5
View File
@@ -0,0 +1,5 @@
// Copyright 2021 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
pub mod client;
pub mod websocket;
+108
View File
@@ -0,0 +1,108 @@
// Copyright 2021 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
use clap::{crate_version, App, ArgMatches};
pub mod client;
pub mod commands;
pub mod websocket;
#[tokio::main]
async fn main() {
dotenv::dotenv().ok();
setup_logging();
println!("{}", banner());
let arg_matches = App::new("Nym Client")
.version(crate_version!())
.long_version(&*long_version())
.author("Nymtech")
.about("Implementation of the Nym Client")
.subcommand(commands::init::command_args())
.subcommand(commands::run::command_args())
.subcommand(commands::upgrade::command_args())
.get_matches();
execute(arg_matches).await;
}
async fn execute(matches: ArgMatches<'static>) {
match matches.subcommand() {
("init", Some(m)) => commands::init::execute(m.clone()).await,
("run", Some(m)) => commands::run::execute(m.clone()).await,
("upgrade", Some(m)) => commands::upgrade::execute(m),
_ => println!("{}", usage()),
}
}
fn usage() -> &'static str {
"usage: --help to see available options.\n\n"
}
fn banner() -> String {
format!(
r#"
_ __ _ _ _ __ ___
| '_ \| | | | '_ \ _ \
| | | | |_| | | | | | |
|_| |_|\__, |_| |_| |_|
|___/
(client - version {:})
"#,
crate_version!()
)
}
fn long_version() -> String {
format!(
r#"
{:<20}{}
{:<20}{}
{:<20}{}
{:<20}{}
{:<20}{}
{:<20}{}
{:<20}{}
{:<20}{}
"#,
"Build Timestamp:",
env!("VERGEN_BUILD_TIMESTAMP"),
"Build Version:",
env!("VERGEN_BUILD_SEMVER"),
"Commit SHA:",
env!("VERGEN_GIT_SHA"),
"Commit Date:",
env!("VERGEN_GIT_COMMIT_TIMESTAMP"),
"Commit Branch:",
env!("VERGEN_GIT_BRANCH"),
"rustc Version:",
env!("VERGEN_RUSTC_SEMVER"),
"rustc Channel:",
env!("VERGEN_RUSTC_CHANNEL"),
"cargo Profile:",
env!("VERGEN_CARGO_PROFILE"),
)
}
fn setup_logging() {
let mut log_builder = pretty_env_logger::formatted_timed_builder();
if let Ok(s) = ::std::env::var("RUST_LOG") {
log_builder.parse_filters(&s);
} else {
// default to 'Info'
log_builder.filter(None, log::LevelFilter::Info);
}
log_builder
.filter_module("hyper", log::LevelFilter::Warn)
.filter_module("tokio_reactor", log::LevelFilter::Warn)
.filter_module("reqwest", log::LevelFilter::Warn)
.filter_module("mio", log::LevelFilter::Warn)
.filter_module("want", log::LevelFilter::Warn)
.filter_module("tungstenite", log::LevelFilter::Warn)
.filter_module("tokio_tungstenite", log::LevelFilter::Warn)
.init();
}
+293
View File
@@ -0,0 +1,293 @@
// Copyright 2021 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
use client_core::client::{
inbound_messages::{InputMessage, InputMessageSender},
received_buffer::{
ReceivedBufferMessage, ReceivedBufferRequestSender, ReconstructedMessagesReceiver,
},
};
use futures::channel::mpsc;
use futures::{SinkExt, StreamExt};
use log::*;
use nymsphinx::addressing::clients::Recipient;
use nymsphinx::anonymous_replies::ReplySurb;
use nymsphinx::receiver::ReconstructedMessage;
use tokio::net::TcpStream;
use tokio_tungstenite::{
accept_async,
tungstenite::{protocol::Message as WsMessage, Error as WsError},
WebSocketStream,
};
use websocket_requests::{requests::ClientRequest, responses::ServerResponse};
enum ReceivedResponseType {
Binary,
Text,
}
impl Default for ReceivedResponseType {
fn default() -> Self {
ReceivedResponseType::Binary
}
}
pub(crate) struct Handler {
msg_input: InputMessageSender,
buffer_requester: ReceivedBufferRequestSender,
self_full_address: Recipient,
socket: Option<WebSocketStream<TcpStream>>,
received_response_type: ReceivedResponseType,
}
// clone is used to use handler on a new connection, which initially is `None`
impl Clone for Handler {
fn clone(&self) -> Self {
Handler {
msg_input: self.msg_input.clone(),
buffer_requester: self.buffer_requester.clone(),
self_full_address: self.self_full_address,
socket: None,
received_response_type: Default::default(),
}
}
}
impl Drop for Handler {
fn drop(&mut self) {
self.buffer_requester
.unbounded_send(ReceivedBufferMessage::ReceiverDisconnect)
.expect("the buffer request failed!")
}
}
impl Handler {
pub(crate) fn new(
msg_input: InputMessageSender,
buffer_requester: ReceivedBufferRequestSender,
self_full_address: Recipient,
) -> Self {
Handler {
msg_input,
buffer_requester,
self_full_address,
socket: None,
received_response_type: Default::default(),
}
}
fn handle_send(
&mut self,
recipient: Recipient,
message: Vec<u8>,
with_reply_surb: bool,
) -> Option<ServerResponse> {
// the ack control is now responsible for chunking, etc.
let input_msg = InputMessage::new_fresh(recipient, message, with_reply_surb);
self.msg_input.unbounded_send(input_msg).unwrap();
None
}
fn handle_reply(&mut self, reply_surb: ReplySurb, message: Vec<u8>) -> Option<ServerResponse> {
if message.len() > ReplySurb::max_msg_len(Default::default()) {
return Some(ServerResponse::new_error(format!("too long message to put inside a reply SURB. Received: {} bytes and maximum is {} bytes", message.len(), ReplySurb::max_msg_len(Default::default()))));
}
let input_msg = InputMessage::new_reply(reply_surb, message);
self.msg_input.unbounded_send(input_msg).unwrap();
None
}
fn handle_self_address(&self) -> ServerResponse {
ServerResponse::SelfAddress(self.self_full_address)
}
fn handle_request(&mut self, request: ClientRequest) -> Option<ServerResponse> {
match request {
ClientRequest::Send {
recipient,
message,
with_reply_surb,
} => self.handle_send(recipient, message, with_reply_surb),
ClientRequest::Reply {
message,
reply_surb,
} => self.handle_reply(reply_surb, message),
ClientRequest::SelfAddress => Some(self.handle_self_address()),
}
}
fn handle_text_message(&mut self, msg: String) -> Option<WsMessage> {
debug!("Handling text message request");
trace!("Content: {:?}", msg);
self.received_response_type = ReceivedResponseType::Text;
let client_request = ClientRequest::try_from_text(msg);
let response = match client_request {
Err(err) => Some(ServerResponse::Error(err)),
Ok(req) => self.handle_request(req),
};
response.map(|resp| WsMessage::text(resp.into_text()))
}
fn handle_binary_message(&mut self, msg: Vec<u8>) -> Option<WsMessage> {
debug!("Handling binary message request");
self.received_response_type = ReceivedResponseType::Binary;
let client_request = ClientRequest::try_from_binary(msg);
let response = match client_request {
Err(err) => Some(ServerResponse::Error(err)),
Ok(req) => self.handle_request(req),
};
response.map(|resp| WsMessage::Binary(resp.into_binary()))
}
fn handle_ws_request(&mut self, raw_request: WsMessage) -> Option<WsMessage> {
// apparently tungstenite auto-handles ping/pong/close messages so for now let's ignore
// them and let's test that claim. If that's not the case, just copy code from
// old version of this file.
match raw_request {
WsMessage::Text(text_message) => self.handle_text_message(text_message),
WsMessage::Binary(binary_message) => self.handle_binary_message(binary_message),
_ => None,
}
}
// I'm still not entirely sure why `send_all` requires `TryStream` rather than `Stream`, but
// let's just play along for now
fn prepare_reconstructed_binary(
&self,
reconstructed_messages: Vec<ReconstructedMessage>,
) -> Vec<Result<WsMessage, WsError>> {
reconstructed_messages
.into_iter()
.map(ServerResponse::Received)
.map(|resp| Ok(WsMessage::Binary(resp.into_binary())))
.collect()
}
// I'm still not entirely sure why `send_all` requires `TryStream` rather than `Stream`, but
// let's just play along for now
fn prepare_reconstructed_text(
&self,
reconstructed_messages: Vec<ReconstructedMessage>,
) -> Vec<Result<WsMessage, WsError>> {
reconstructed_messages
.into_iter()
.map(ServerResponse::Received)
.map(|resp| Ok(WsMessage::Text(resp.into_text())))
.collect()
}
async fn push_websocket_received_plaintexts(
&mut self,
reconstructed_messages: Vec<ReconstructedMessage>,
) -> Result<(), WsError> {
// TODO: later there might be a flag on the reconstructed message itself to tell us
// if it's text or binary, but for time being we use the naive assumption that if
// client is sending Message::Text it expects text back. Same for Message::Binary
let response_messages = match self.received_response_type {
ReceivedResponseType::Binary => {
self.prepare_reconstructed_binary(reconstructed_messages)
}
ReceivedResponseType::Text => self.prepare_reconstructed_text(reconstructed_messages),
};
let mut send_stream = futures::stream::iter(response_messages);
self.socket
.as_mut()
.unwrap()
.send_all(&mut send_stream)
.await
}
async fn send_websocket_response(&mut self, msg: WsMessage) -> Result<(), WsError> {
match self.socket {
// TODO: more closely investigate difference between `Sink::send` and `Sink::send_all`
// it got something to do with batching and flushing - it might be important if it
// turns out somehow we've got a bottleneck here
Some(ref mut ws_stream) => ws_stream.send(msg).await,
_ => panic!("impossible state - websocket handshake was somehow reverted"),
}
}
async fn next_websocket_request(&mut self) -> Option<Result<WsMessage, WsError>> {
match self.socket {
Some(ref mut ws_stream) => ws_stream.next().await,
None => None,
}
}
async fn listen_for_requests(&mut self, mut msg_receiver: ReconstructedMessagesReceiver) {
loop {
tokio::select! {
// we can either get a client request from the websocket
socket_msg = self.next_websocket_request() => {
if socket_msg.is_none() {
break;
}
let socket_msg = match socket_msg.unwrap() {
Ok(socket_msg) => socket_msg,
Err(err) => {
warn!("failed to obtain message from websocket stream! stopping connection handler: {}", err);
break;
}
};
if socket_msg.is_close() {
break;
}
if let Some(response) = self.handle_ws_request(socket_msg) {
if let Err(err) = self.send_websocket_response(response).await {
warn!(
"Failed to send message over websocket: {}. Assuming the connection is dead.",
err
);
break;
}
}
}
// or a reconstructed mix message that we need to push back to the client
mix_messages = msg_receiver.next() => {
let mix_messages = mix_messages.expect(
"mix messages sender was unexpectedly closed! this shouldn't have ever happened!",
);
if let Err(e) = self.push_websocket_received_plaintexts(mix_messages).await {
warn!("failed to send sphinx packets back to the client - {:?}, assuming the connection is dead", e);
break;
}
}
}
}
}
// consume self to make sure `drop` is called after this is done
pub(crate) async fn handle_connection(mut self, socket: TcpStream) {
let ws_stream = match accept_async(socket).await {
Ok(ws_stream) => ws_stream,
Err(err) => {
warn!("error while performing the websocket handshake - {:?}", err);
return;
}
};
self.socket = Some(ws_stream);
let (reconstructed_sender, reconstructed_receiver) = mpsc::unbounded();
// tell the buffer to start sending stuff to us
self.buffer_requester
.unbounded_send(ReceivedBufferMessage::ReceiverAnnounce(
reconstructed_sender,
))
.expect("the buffer request failed!");
self.listen_for_requests(reconstructed_receiver).await;
}
}
+94
View File
@@ -0,0 +1,94 @@
// Copyright 2021 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
use super::handler::Handler;
use log::*;
use std::{net::SocketAddr, process, sync::Arc};
use tokio::io::AsyncWriteExt;
use tokio::{sync::Notify, task::JoinHandle};
enum State {
Connected,
AwaitingConnection,
}
impl State {
fn is_connected(&self) -> bool {
matches!(self, State::Connected)
}
}
pub(crate) struct Listener {
address: SocketAddr,
state: State,
}
impl Listener {
pub(crate) fn new(port: u16) -> Self {
Listener {
// unless we find compelling reason not to, just listen on local only
address: SocketAddr::new("127.0.0.1".parse().unwrap(), port),
state: State::AwaitingConnection,
}
}
pub(crate) async fn run(&mut self, handler: Handler) {
let tcp_listener = match tokio::net::TcpListener::bind(self.address).await {
Ok(listener) => listener,
Err(err) => {
error!("Failed to bind to {} - {}. Are you sure nothing else is running on the specified port and your user has sufficient permission to bind to the requested address?", self.address, err);
process::exit(1);
}
};
let notify = Arc::new(Notify::new());
loop {
tokio::select! {
_ = notify.notified() => {
// our connection terminated - we are open to a new one now!
self.state = State::AwaitingConnection;
}
new_conn = tcp_listener.accept() => {
match new_conn {
Ok((mut socket, remote_addr)) => {
debug!("Received connection from {:?}", remote_addr);
if self.state.is_connected() {
warn!("tried to duplicate!");
// if we've already got a connection, don't allow another one
debug!("but there was already a connection present!");
// while we only ever want to accept a single connection, we don't want
// to leave clients hanging (and also allow for reconnection if it somehow
// was dropped)
match socket.shutdown().await {
Ok(_) => trace!(
"closed the connection between attempting websocket handshake"
),
Err(e) => warn!("failed to cleanly close the connection - {:?}", e),
};
} else {
// even though we're spawning a new task with the handler here, we will only ever spawn a single one.
// it's done so that any new connections to this listener could be rejected rather than left
// hanging because the executor doesn't come back here
let notify_clone = Arc::clone(&notify);
let fresh_handler = handler.clone();
tokio::spawn(async move {
fresh_handler.handle_connection(socket).await;
notify_clone.notify_one();
});
self.state = State::Connected;
}
}
Err(e) => warn!("failed to get client: {:?}", e),
}
}
}
}
}
pub(crate) fn start(mut self, handler: Handler) -> JoinHandle<()> {
info!("Running websocket on {:?}", self.address.to_string());
tokio::spawn(async move { self.run(handler).await })
}
}
+8
View File
@@ -0,0 +1,8 @@
// Copyright 2021 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
pub(crate) use handler::Handler;
pub(crate) use listener::Listener;
pub(crate) mod handler;
pub(crate) mod listener;
@@ -0,0 +1,13 @@
[package]
name = "websocket-requests"
version = "0.1.0"
authors = ["Jędrzej Stuczyński <andrew@nymtech.net>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
nymsphinx = { path = "../../../common/nymsphinx" }
@@ -0,0 +1,81 @@
// Copyright 2021 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
use serde::{Deserialize, Serialize};
use std::fmt;
// no need to go fancy here like we've done in other places.
#[derive(PartialEq, Clone, Serialize, Deserialize)]
pub struct Error {
pub kind: ErrorKind,
pub message: String,
}
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}:{}", self.kind.as_str(), self.message)
}
}
impl fmt::Debug for Error {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Display::fmt(self, f)
}
}
impl Error {
pub fn new(kind: ErrorKind, message: String) -> Self {
Error { kind, message }
}
}
#[repr(u8)]
#[derive(PartialEq, Clone, Serialize, Deserialize)]
pub enum ErrorKind {
/// The received request contained no data.
EmptyRequest = 0x01,
/// The received request did not contain enough data to be fully parsed.
TooShortRequest = 0x02,
/// The received request tag is not defined.
UnknownRequest = 0x03,
/// The received request is malformed.
MalformedRequest = 0x04,
// that's an arbitrary division but let's keep 1-127 (hex 0x01 - 0x7F) values request-specific
// and 128-254 (hex 0x80 - 0xFE) for responses
/// The received response contained no data.
EmptyResponse = 0x80,
/// The received response did not contain enough data to be fully parsed.
TooShortResponse = 0x81,
/// The received response tag is not defined.
UnknownResponse = 0x82,
/// The received response is malformed.
MalformedResponse = 0x83,
/// The error is due to something else.
Other = 0xFF,
}
impl ErrorKind {
pub(crate) fn as_str(&self) -> &'static str {
match *self {
ErrorKind::EmptyRequest => "received request contained no data",
ErrorKind::TooShortRequest => "received request did not contain enough data",
ErrorKind::UnknownRequest => "unknown request type",
ErrorKind::MalformedRequest => "malformed request",
ErrorKind::EmptyResponse => "received response contained no data",
ErrorKind::TooShortResponse => "received response did not contain enough data",
ErrorKind::UnknownResponse => "unknown response type",
ErrorKind::MalformedResponse => "malformed response",
ErrorKind::Other => "other",
}
}
}
@@ -0,0 +1,7 @@
// Copyright 2021 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
pub mod error;
pub mod requests;
pub mod responses;
mod text;
@@ -0,0 +1,355 @@
// Copyright 2021 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
// all variable size data is always prefixed with u64 length
// tags are u8
use crate::error::{self, ErrorKind};
use crate::text::ClientRequestText;
use nymsphinx::addressing::clients::Recipient;
use nymsphinx::anonymous_replies::ReplySurb;
use std::convert::{TryFrom, TryInto};
use std::mem::size_of;
/// Value tag representing [`Send`] variant of the [`ClientRequest`]
pub const SEND_REQUEST_TAG: u8 = 0x00;
/// Value tag representing [`Reply`] variant of the [`ClientRequest`]
pub const REPLY_REQUEST_TAG: u8 = 0x01;
/// Value tag representing [`SelfAddress`] variant of the [`ClientRequest`]
pub const SELF_ADDRESS_REQUEST_TAG: u8 = 0x02;
#[allow(non_snake_case)]
#[derive(Debug)]
pub enum ClientRequest {
Send {
recipient: Recipient,
message: Vec<u8>,
// Perhaps we could change it to a number to indicate how many reply_SURBs we want to include?
with_reply_surb: bool,
},
Reply {
message: Vec<u8>,
reply_surb: ReplySurb,
},
SelfAddress,
}
// we could have been parsing it directly TryFrom<WsMessage>, but we want to retain
// information about whether it came from binary or text to send appropriate response back
impl ClientRequest {
// SEND_REQUEST_TAG || with_surb || recipient || data_len || data
fn serialize_send(recipient: Recipient, data: Vec<u8>, with_reply_surb: bool) -> Vec<u8> {
let data_len_bytes = (data.len() as u64).to_be_bytes();
std::iter::once(SEND_REQUEST_TAG)
.chain(std::iter::once(with_reply_surb as u8))
.chain(recipient.to_bytes().iter().cloned()) // will not be length prefixed because the length is constant
.chain(data_len_bytes.iter().cloned())
.chain(data.into_iter())
.collect()
}
// SEND_REQUEST_TAG || with_reply || recipient || data_len || data
fn deserialize_send(b: &[u8]) -> Result<Self, error::Error> {
// we need to have at least 1 (tag) + 1 (reply flag) + Recipient::LEN + sizeof<u64> bytes
if b.len() < 2 + Recipient::LEN + size_of::<u64>() {
return Err(error::Error::new(
ErrorKind::TooShortRequest,
"not enough data provided to recover 'send'".to_string(),
));
}
// this MUST match because it was called by 'deserialize'
debug_assert_eq!(b[0], SEND_REQUEST_TAG);
let with_reply_surb = match b[1] {
0 => false,
1 => true,
n => {
return Err(error::Error::new(
ErrorKind::MalformedRequest,
format!("invalid reply surb flag {}", n),
))
}
};
let mut recipient_bytes = [0u8; Recipient::LEN];
recipient_bytes.copy_from_slice(&b[2..2 + Recipient::LEN]);
let recipient = match Recipient::try_from_bytes(recipient_bytes) {
Ok(recipient) => recipient,
Err(err) => {
return Err(error::Error::new(
ErrorKind::MalformedRequest,
format!("malformed recipient: {:?}", err),
))
}
};
let data_len_bytes = &b[2 + Recipient::LEN..2 + Recipient::LEN + size_of::<u64>()];
let data_len = u64::from_be_bytes(data_len_bytes.try_into().unwrap());
let data = &b[2 + Recipient::LEN + size_of::<u64>()..];
if data.len() as u64 != data_len {
return Err(error::Error::new(
ErrorKind::MalformedRequest,
format!(
"data len has inconsistent length. specified: {} got: {}",
data_len,
data.len()
),
));
}
Ok(ClientRequest::Send {
with_reply_surb,
recipient,
message: data.to_vec(),
})
}
// REPLY_REQUEST_TAG || surb_len || surb || message_len || message
fn serialize_reply(message: Vec<u8>, reply_surb: ReplySurb) -> Vec<u8> {
let reply_surb_bytes = reply_surb.to_bytes();
let surb_len_bytes = (reply_surb_bytes.len() as u64).to_be_bytes();
let message_len_bytes = (message.len() as u64).to_be_bytes();
std::iter::once(REPLY_REQUEST_TAG)
.chain(surb_len_bytes.iter().cloned())
.chain(reply_surb_bytes.into_iter())
.chain(message_len_bytes.iter().cloned())
.chain(message.into_iter())
.collect()
}
// REPLY_REQUEST_TAG || surb_len || surb || message_len || message
fn deserialize_reply(b: &[u8]) -> Result<Self, error::Error> {
// we need to have at the very least 2 * sizeof<u64> bytes (in case, for some peculiar reason
// message and reply surb were 0 len - the request would still be malformed, but would in theory
// be parse'able)
if b.len() < 1 + 2 * size_of::<u64>() {
return Err(error::Error::new(
ErrorKind::TooShortRequest,
"not enough data provided to recover 'reply'".to_string(),
));
}
// this MUST match because it was called by 'deserialize'
debug_assert_eq!(b[0], REPLY_REQUEST_TAG);
let reply_surb_len =
u64::from_be_bytes(b[1..1 + size_of::<u64>()].as_ref().try_into().unwrap());
// make sure we won't go out of bounds here
if reply_surb_len > (b.len() - 1 + 2 * size_of::<u64>()) as u64 {
return Err(error::Error::new(
ErrorKind::MalformedRequest,
format!(
"not enough data to recover reply surb with specified length {}",
reply_surb_len
),
));
}
let surb_bound = 1 + size_of::<u64>() + reply_surb_len as usize;
let reply_surb_bytes = &b[1 + size_of::<u64>()..surb_bound];
let reply_surb = match ReplySurb::from_bytes(reply_surb_bytes) {
Ok(reply_surb) => reply_surb,
Err(err) => {
return Err(error::Error::new(
ErrorKind::MalformedRequest,
format!("malformed reply surb: {:?}", err),
))
}
};
let message_len = u64::from_be_bytes(
b[surb_bound..surb_bound + size_of::<u64>()]
.as_ref()
.try_into()
.unwrap(),
);
let message = &b[surb_bound + size_of::<u64>()..];
if message.len() as u64 != message_len {
return Err(error::Error::new(
ErrorKind::MalformedRequest,
format!(
"message len has inconsistent length. specified: {} got: {}",
message_len,
message.len()
),
));
}
// TODO: should this blow HERE, i.e. during deserialization that the data you're trying
// to send via reply is too long?
Ok(ClientRequest::Reply {
reply_surb,
message: message.to_vec(),
})
}
// SELF_ADDRESS_REQUEST_TAG
fn serialize_self_address() -> Vec<u8> {
std::iter::once(SELF_ADDRESS_REQUEST_TAG).collect()
}
// SELF_ADDRESS_REQUEST_TAG
fn deserialize_self_address(b: &[u8]) -> Self {
// this MUST match because it was called by 'deserialize'
debug_assert_eq!(b[0], SELF_ADDRESS_REQUEST_TAG);
ClientRequest::SelfAddress
}
pub fn serialize(self) -> Vec<u8> {
match self {
ClientRequest::Send {
recipient,
message,
with_reply_surb,
} => Self::serialize_send(recipient, message, with_reply_surb),
ClientRequest::Reply {
message,
reply_surb,
} => Self::serialize_reply(message, reply_surb),
ClientRequest::SelfAddress => Self::serialize_self_address(),
}
}
pub fn deserialize(b: &[u8]) -> Result<Self, error::Error> {
if b.is_empty() {
// technically I'm not even sure this can ever be returned, because reading empty
// request would imply closed socket, but let's include it for completion sake
return Err(error::Error::new(
ErrorKind::EmptyRequest,
"no data provided".to_string(),
));
}
if b.len() < size_of::<u8>() {
return Err(error::Error::new(
ErrorKind::TooShortRequest,
format!(
"not enough data provided to recover request tag. Provided only {} bytes",
b.len()
),
));
}
let request_tag = b[0];
// determine what kind of request that is and try to deserialize it
match request_tag {
SEND_REQUEST_TAG => Self::deserialize_send(b),
REPLY_REQUEST_TAG => Self::deserialize_reply(b),
SELF_ADDRESS_REQUEST_TAG => Ok(Self::deserialize_self_address(b)),
n => Err(error::Error::new(
ErrorKind::UnknownRequest,
format!("type {}", n),
)),
}
}
pub fn try_from_binary(raw_req: Vec<u8>) -> Result<Self, error::Error> {
Self::deserialize(&raw_req)
}
pub fn try_from_text(raw_req: String) -> Result<Self, error::Error> {
// use the intermediate string structure and let serde do bunch of work for us
let text_req = ClientRequestText::try_from(raw_req).map_err(|json_err| {
error::Error::new(ErrorKind::MalformedRequest, json_err.to_string())
})?;
text_req.try_into()
}
}
#[cfg(test)]
mod tests {
use super::*;
// very basic tests to check for obvious errors like off by one
#[test]
fn send_request_serialization_works() {
let recipient = Recipient::try_from_base58_string("CytBseW6yFXUMzz4SGAKdNLGR7q3sJLLYxyBGvutNEQV.4QXYyEVc5fUDjmmi8PrHN9tdUFV4PCvSJE1278cHyvoe@4sBbL1ngf1vtNqykydQKTFh26sQCw888GpUqvPvyNB4f").unwrap();
let recipient_string = recipient.to_string();
let send_request_no_surb = ClientRequest::Send {
recipient,
message: b"foomp".to_vec(),
with_reply_surb: false,
};
let bytes = send_request_no_surb.serialize();
let recovered = ClientRequest::deserialize(&bytes).unwrap();
match recovered {
ClientRequest::Send {
recipient,
message,
with_reply_surb,
} => {
assert_eq!(recipient.to_string(), recipient_string);
assert_eq!(message, b"foomp".to_vec());
assert!(!with_reply_surb)
}
_ => unreachable!(),
}
let send_request_surb = ClientRequest::Send {
recipient,
message: b"foomp".to_vec(),
with_reply_surb: true,
};
let bytes = send_request_surb.serialize();
let recovered = ClientRequest::deserialize(&bytes).unwrap();
match recovered {
ClientRequest::Send {
recipient,
message,
with_reply_surb,
} => {
assert_eq!(recipient.to_string(), recipient_string);
assert_eq!(message, b"foomp".to_vec());
assert!(with_reply_surb)
}
_ => unreachable!(),
}
}
#[test]
fn reply_request_serialization_works() {
let reply_surb_string = "CjfVbHbfAjbC3W1BvNHGXmM8KNAnDNYGaHMLqVDxRYeo352csAihstup9bvqXam4dTWgfHak6KYwL9STaxWJ47E8XFZbSEvs7hEsfCkxr6K9WJuSBPK84GDDEvad8ZAuMCoaXsAd5S2Lj9a5eYyzG4SL1jHzhSMni55LyJwumxo1ZTGZNXggxw1RREosvyzNrW9Rsi3owyPqLCwXpiei2tHZty8w8midVvg8vDa7ZEJD842CLv8D4ohynSG7gDpqTrhkRaqYAuz7dzqNbMXLJRM7v823Jn16fA1L7YQxmcaUdUigyRSgTdb4i9ebiLGSyJ1iDe6Acz613PQZh6Ua3bZ2zVKq3dSycpDm9ngarRK4zJrAaUxRkdih8YzW3BY4nL9eqkfKA4N1TWCLaRU7zpSaf8yMEwrAZReU3d5zLV8c5KBfa2w8R5anhQeBojduZEGEad8kkHuKU52Zg93FeWHvH1qgZaEJMHH4nN7gKXz9mvWDhYwyF4vt3Uy2NhCHC3N5pL1gMme27YcoPcTEia1fxKZtnt6rtEozzTrAgCJGswigkFbkafiV5QaJwLKTUxtzhkZ57eEuLPte9UvJHzhhXUQ2CV7R2BUkJjYZy3Zsx6YYvdYWiAFFkWUwNEGA4QpShUHciBfsQVHQ7pN41YcyYUhbywQDFnTVgEmdUZ1XCBi3gyK5U3tDQmFzP1u9m3mWrUA8qB9mRDE7ptNDm5c3c1458L6uXLUth7sdMaa1Was5LCmCdmNDtvNpCDAEt1in6q6mrZFR85aCSU9b1baNGwZoCqPpPvydkVe63gXWoi8ebvdyxARrqACFrSB3ZdY3uJBw8CTMNkKK6MvcefMkSVVsbLd36TQAtYSCqrpiMc5dQuKcEu5QfciwvWYXYx8WFNAgKwP2mv49KCTvfozNDUCbjzDwSx92Zv5zjG8HbFpB13bY9UZGeyTPvv7gGxCzjGjJGbW6FRAheRQaaje5fUgCNM95Tv7wBmAMRHHFgWafeK1sdFH7dtCX9u898HucGTaboSKLsVh8J78gbbkHErwjMh7y9YRkceq5TTYS5da4kHnyNKYWSbxgZrmFg44XGKoeYcqoHB3XTZrdsf7F5fFeNwnihkmADvhAcaxXUmVqq4rQFZH84a1iC3WBWXYcqiZH2L7ujGWV7mMDT4HBEerDYjc8rNY4xGTPfivCrBCJW1i14aqW8xRdsdgTM88eTksvC3WPJLJ7iMzfKXeL7fMW1Ek6QGyQtLBW98vEESpdcDg6DeZ5rMz6VqjTGGqcCaFGfHoqtfxMDaBAEsyQ8h7XDX6dg1wq9wH6j4Tw7Tj1MEv1b8uj5NJkozZdzVdYA2QyE2Dp8vuurQG6uVdTDNww2d88RBQ8sVgjxN8gR45y4woJLhFAaNTAtrY6wDTxyXST13ni6oyqdYxjFVk9Am4v3DzH7Y2K8iRVSHfTk4FRbPULyaeK6wt2anvMJH1XdvVRgc14h67MnBxMgMD1UFk8AErN7CDj26fppe3c5G6KozJe4cSqQUGbBjVzBnrHCruqrfZBn5hNZHTV37bQiomqhRQXohxhuKEnNrGbAe1xNvJr9X";
let reply_surb = ReplySurb::from_base58_string(reply_surb_string).unwrap();
let reply_request = ClientRequest::Reply {
message: b"foomp".to_vec(),
reply_surb,
};
let bytes = reply_request.serialize();
let recovered = ClientRequest::deserialize(&bytes).unwrap();
match recovered {
ClientRequest::Reply {
reply_surb,
message,
} => {
assert_eq!(reply_surb.to_base58_string(), reply_surb_string);
assert_eq!(message, b"foomp".to_vec());
}
_ => unreachable!(),
}
}
#[test]
fn self_address_request_serialization_works() {
let self_address_request = ClientRequest::SelfAddress;
let bytes = self_address_request.serialize();
let recovered = ClientRequest::deserialize(&bytes).unwrap();
match recovered {
ClientRequest::SelfAddress => (),
_ => unreachable!(),
}
}
}
@@ -0,0 +1,392 @@
// Copyright 2021 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
// all variable size data is always prefixed with u64 length
// tags are u8
#![allow(unknown_lints)] // due to using `clippy::branches_sharing_code` which does not exist on `stable` just yet
use crate::error::{self, ErrorKind};
use crate::text::ServerResponseText;
use nymsphinx::addressing::clients::Recipient;
use nymsphinx::anonymous_replies::ReplySurb;
use nymsphinx::receiver::ReconstructedMessage;
use std::convert::TryInto;
use std::mem::size_of;
/// Value tag representing [`Error`] variant of the [`ServerResponse`]
pub const ERROR_RESPONSE_TAG: u8 = 0x00;
/// Value tag representing [`Received`] variant of the [`ServerResponse`]
pub const RECEIVED_RESPONSE_TAG: u8 = 0x01;
/// Value tag representing [`SelfAddress`] variant of the [`ServerResponse`]
pub const SELF_ADDRESS_RESPONSE_TAG: u8 = 0x02;
#[derive(Debug)]
pub enum ServerResponse {
Received(ReconstructedMessage),
SelfAddress(Recipient),
Error(error::Error),
}
impl ServerResponse {
pub fn new_error<S: Into<String>>(message: S) -> Self {
ServerResponse::Error(error::Error {
kind: ErrorKind::Other,
message: message.into(),
})
}
// RECEIVED_RESPONSE_TAG || with_reply || (surb_len || surb) || msg_len || msg
fn serialize_received(reconstructed_message: ReconstructedMessage) -> Vec<u8> {
let message_len_bytes = (reconstructed_message.message.len() as u64).to_be_bytes();
if let Some(reply_surb) = reconstructed_message.reply_surb {
let reply_surb_bytes = reply_surb.to_bytes();
let surb_len_bytes = (reply_surb_bytes.len() as u64).to_be_bytes();
// with_reply || surb_len || surb || msg_len || msg
std::iter::once(RECEIVED_RESPONSE_TAG)
.chain(std::iter::once(true as u8))
.chain(surb_len_bytes.iter().cloned())
.chain(reply_surb_bytes.iter().cloned())
.chain(message_len_bytes.iter().cloned())
.chain(reconstructed_message.message.into_iter())
.collect()
} else {
// without_reply || msg_len || msg
std::iter::once(RECEIVED_RESPONSE_TAG)
.chain(std::iter::once(false as u8))
.chain(message_len_bytes.iter().cloned())
.chain(reconstructed_message.message.into_iter())
.collect()
}
}
// RECEIVED_RESPONSE_TAG || with_reply || (surb_len || surb) || msg_len || msg
fn deserialize_received(b: &[u8]) -> Result<Self, error::Error> {
// this MUST match because it was called by 'deserialize'
debug_assert_eq!(b[0], RECEIVED_RESPONSE_TAG);
// we must be able to read at the very least if it has a reply_surb and length of some field
if b.len() < 2 + size_of::<u64>() {
return Err(error::Error::new(
ErrorKind::TooShortResponse,
"not enough data provided to recover 'received'".to_string(),
));
}
let with_reply_surb = match b[1] {
0 => false,
1 => true,
n => {
return Err(error::Error::new(
ErrorKind::MalformedResponse,
format!("invalid reply flag {}", n),
))
}
};
// this is a false positive as even though the code is the same, it refers to different things
#[allow(clippy::branches_sharing_code)]
if with_reply_surb {
let reply_surb_len =
u64::from_be_bytes(b[2..2 + size_of::<u64>()].as_ref().try_into().unwrap());
// make sure we won't go out of bounds here
if reply_surb_len > (b.len() - 2 + 2 * size_of::<u64>()) as u64 {
return Err(error::Error::new(
ErrorKind::MalformedResponse,
"not enough bytes to read reply_surb bytes!".to_string(),
));
}
let surb_bound = 2 + size_of::<u64>() + reply_surb_len as usize;
let reply_surb_bytes = &b[2 + size_of::<u64>()..surb_bound];
let reply_surb = match ReplySurb::from_bytes(reply_surb_bytes) {
Ok(reply_surb) => reply_surb,
Err(err) => {
return Err(error::Error::new(
ErrorKind::MalformedResponse,
format!("malformed reply SURB: {:?}", err),
))
}
};
let message_len = u64::from_be_bytes(
b[surb_bound..surb_bound + size_of::<u64>()]
.as_ref()
.try_into()
.unwrap(),
);
let message = &b[surb_bound + size_of::<u64>()..];
if message.len() as u64 != message_len {
return Err(error::Error::new(
ErrorKind::MalformedResponse,
format!(
"message len has inconsistent length. specified: {} got: {}",
message_len,
message.len()
),
));
}
Ok(ServerResponse::Received(ReconstructedMessage {
message: message.to_vec(),
reply_surb: Some(reply_surb),
}))
} else {
let message_len =
u64::from_be_bytes(b[2..2 + size_of::<u64>()].as_ref().try_into().unwrap());
let message = &b[2 + size_of::<u64>()..];
if message.len() as u64 != message_len {
return Err(error::Error::new(
ErrorKind::MalformedResponse,
format!(
"message len has inconsistent length. specified: {} got: {}",
message_len,
message.len()
),
));
}
Ok(ServerResponse::Received(ReconstructedMessage {
message: message.to_vec(),
reply_surb: None,
}))
}
}
// SELF_ADDRESS_RESPONSE_TAG || self_address
fn serialize_self_address(address: Recipient) -> Vec<u8> {
std::iter::once(SELF_ADDRESS_RESPONSE_TAG)
.chain(address.to_bytes().iter().cloned())
.collect()
}
// SELF_ADDRESS_RESPONSE_TAG || self_address
fn deserialize_self_address(b: &[u8]) -> Result<Self, error::Error> {
// this MUST match because it was called by 'deserialize'
debug_assert_eq!(b[0], SELF_ADDRESS_RESPONSE_TAG);
if b.len() != 1 + Recipient::LEN {
return Err(error::Error::new(
ErrorKind::TooShortResponse,
"not enough data provided to recover 'self_address'".to_string(),
));
}
let mut recipient_bytes = [0u8; Recipient::LEN];
recipient_bytes.copy_from_slice(&b[1..1 + Recipient::LEN]);
let recipient = match Recipient::try_from_bytes(recipient_bytes) {
Ok(recipient) => recipient,
Err(err) => {
return Err(error::Error::new(
ErrorKind::MalformedResponse,
format!("malformed Recipient: {:?}", err),
))
}
};
Ok(ServerResponse::SelfAddress(recipient))
}
// ERROR_RESPONSE_TAG || err_code || msg_len || msg
fn serialize_error(error: error::Error) -> Vec<u8> {
let message_len_bytes = (error.message.len() as u64).to_be_bytes();
std::iter::once(ERROR_RESPONSE_TAG)
.chain(std::iter::once(error.kind as u8))
.chain(message_len_bytes.iter().cloned())
.chain(error.message.into_bytes().into_iter())
.collect()
}
// ERROR_RESPONSE_TAG || err_code || msg_len || msg
fn deserialize_error(b: &[u8]) -> Result<Self, error::Error> {
// this MUST match because it was called by 'deserialize'
debug_assert_eq!(b[0], ERROR_RESPONSE_TAG);
if b.len() < size_of::<u8>() + size_of::<u64>() {
return Err(error::Error::new(
ErrorKind::TooShortResponse,
"not enough data provided to recover 'error'".to_string(),
));
}
let error_kind = match b[1] {
_ if b[1] == (ErrorKind::EmptyRequest as u8) => ErrorKind::EmptyRequest,
_ if b[1] == (ErrorKind::TooShortRequest as u8) => ErrorKind::TooShortRequest,
_ if b[1] == (ErrorKind::UnknownRequest as u8) => ErrorKind::UnknownRequest,
_ if b[1] == (ErrorKind::MalformedRequest as u8) => ErrorKind::MalformedRequest,
_ if b[1] == (ErrorKind::EmptyResponse as u8) => ErrorKind::EmptyResponse,
_ if b[1] == (ErrorKind::TooShortResponse as u8) => ErrorKind::TooShortResponse,
_ if b[1] == (ErrorKind::UnknownResponse as u8) => ErrorKind::UnknownResponse,
_ if b[1] == (ErrorKind::MalformedResponse as u8) => ErrorKind::MalformedResponse,
_ if b[1] == (ErrorKind::Other as u8) => ErrorKind::Other,
n => {
return Err(error::Error::new(
ErrorKind::MalformedResponse,
format!("invalid error code {}", n),
))
}
};
let message_len =
u64::from_be_bytes(b[2..2 + size_of::<u64>()].as_ref().try_into().unwrap());
let message = &b[2 + size_of::<u64>()..];
if message.len() as u64 != message_len {
return Err(error::Error::new(
ErrorKind::MalformedResponse,
format!(
"message len has inconsistent length. specified: {} got: {}",
message_len,
message.len()
),
));
}
let err_message = match String::from_utf8(message.to_vec()) {
Ok(msg) => msg,
Err(err) => {
return Err(error::Error::new(
ErrorKind::MalformedResponse,
format!("malformed error message: {:?}", err),
))
}
};
Ok(ServerResponse::Error(error::Error::new(
error_kind,
err_message,
)))
}
pub fn serialize(self) -> Vec<u8> {
match self {
ServerResponse::Received(reconstructed_message) => {
Self::serialize_received(reconstructed_message)
}
ServerResponse::SelfAddress(address) => Self::serialize_self_address(address),
ServerResponse::Error(err) => Self::serialize_error(err),
}
}
pub fn deserialize(b: &[u8]) -> Result<Self, error::Error> {
if b.is_empty() {
// technically I'm not even sure this can ever be returned, because reading empty
// request would imply closed socket, but let's include it for completion sake
return Err(error::Error::new(
ErrorKind::EmptyResponse,
"no data provided".to_string(),
));
}
if b.len() < size_of::<u8>() {
return Err(error::Error::new(
ErrorKind::TooShortResponse,
format!(
"not enough data provided to recover response tag. Provided only {} bytes",
b.len()
),
));
}
let response_tag = b[0];
// determine what kind of response that is and try to deserialize it
match response_tag {
RECEIVED_RESPONSE_TAG => Self::deserialize_received(b),
SELF_ADDRESS_RESPONSE_TAG => Self::deserialize_self_address(b),
ERROR_RESPONSE_TAG => Self::deserialize_error(b),
n => Err(error::Error::new(
ErrorKind::UnknownResponse,
format!("type {}", n),
)),
}
}
pub fn into_binary(self) -> Vec<u8> {
self.serialize()
}
pub fn into_text(self) -> String {
// use the intermediate string structure and let serde do bunch of work for us
let text_resp = ServerResponseText::from(self);
text_resp.into()
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn received_response_serialization_works() {
let reply_surb_string = "CjfVbHbfAjbC3W1BvNHGXmM8KNAnDNYGaHMLqVDxRYeo352csAihstup9bvqXam4dTWgfHak6KYwL9STaxWJ47E8XFZbSEvs7hEsfCkxr6K9WJuSBPK84GDDEvad8ZAuMCoaXsAd5S2Lj9a5eYyzG4SL1jHzhSMni55LyJwumxo1ZTGZNXggxw1RREosvyzNrW9Rsi3owyPqLCwXpiei2tHZty8w8midVvg8vDa7ZEJD842CLv8D4ohynSG7gDpqTrhkRaqYAuz7dzqNbMXLJRM7v823Jn16fA1L7YQxmcaUdUigyRSgTdb4i9ebiLGSyJ1iDe6Acz613PQZh6Ua3bZ2zVKq3dSycpDm9ngarRK4zJrAaUxRkdih8YzW3BY4nL9eqkfKA4N1TWCLaRU7zpSaf8yMEwrAZReU3d5zLV8c5KBfa2w8R5anhQeBojduZEGEad8kkHuKU52Zg93FeWHvH1qgZaEJMHH4nN7gKXz9mvWDhYwyF4vt3Uy2NhCHC3N5pL1gMme27YcoPcTEia1fxKZtnt6rtEozzTrAgCJGswigkFbkafiV5QaJwLKTUxtzhkZ57eEuLPte9UvJHzhhXUQ2CV7R2BUkJjYZy3Zsx6YYvdYWiAFFkWUwNEGA4QpShUHciBfsQVHQ7pN41YcyYUhbywQDFnTVgEmdUZ1XCBi3gyK5U3tDQmFzP1u9m3mWrUA8qB9mRDE7ptNDm5c3c1458L6uXLUth7sdMaa1Was5LCmCdmNDtvNpCDAEt1in6q6mrZFR85aCSU9b1baNGwZoCqPpPvydkVe63gXWoi8ebvdyxARrqACFrSB3ZdY3uJBw8CTMNkKK6MvcefMkSVVsbLd36TQAtYSCqrpiMc5dQuKcEu5QfciwvWYXYx8WFNAgKwP2mv49KCTvfozNDUCbjzDwSx92Zv5zjG8HbFpB13bY9UZGeyTPvv7gGxCzjGjJGbW6FRAheRQaaje5fUgCNM95Tv7wBmAMRHHFgWafeK1sdFH7dtCX9u898HucGTaboSKLsVh8J78gbbkHErwjMh7y9YRkceq5TTYS5da4kHnyNKYWSbxgZrmFg44XGKoeYcqoHB3XTZrdsf7F5fFeNwnihkmADvhAcaxXUmVqq4rQFZH84a1iC3WBWXYcqiZH2L7ujGWV7mMDT4HBEerDYjc8rNY4xGTPfivCrBCJW1i14aqW8xRdsdgTM88eTksvC3WPJLJ7iMzfKXeL7fMW1Ek6QGyQtLBW98vEESpdcDg6DeZ5rMz6VqjTGGqcCaFGfHoqtfxMDaBAEsyQ8h7XDX6dg1wq9wH6j4Tw7Tj1MEv1b8uj5NJkozZdzVdYA2QyE2Dp8vuurQG6uVdTDNww2d88RBQ8sVgjxN8gR45y4woJLhFAaNTAtrY6wDTxyXST13ni6oyqdYxjFVk9Am4v3DzH7Y2K8iRVSHfTk4FRbPULyaeK6wt2anvMJH1XdvVRgc14h67MnBxMgMD1UFk8AErN7CDj26fppe3c5G6KozJe4cSqQUGbBjVzBnrHCruqrfZBn5hNZHTV37bQiomqhRQXohxhuKEnNrGbAe1xNvJr9X";
let received_with_surb = ServerResponse::Received(ReconstructedMessage {
message: b"foomp".to_vec(),
reply_surb: Some(ReplySurb::from_base58_string(reply_surb_string).unwrap()),
});
let bytes = received_with_surb.serialize();
let recovered = ServerResponse::deserialize(&bytes).unwrap();
match recovered {
ServerResponse::Received(reconstructed) => {
assert_eq!(reconstructed.message, b"foomp".to_vec());
assert_eq!(
reconstructed.reply_surb.unwrap().to_base58_string(),
reply_surb_string
)
}
_ => unreachable!(),
}
let received_without_surb = ServerResponse::Received(ReconstructedMessage {
message: b"foomp".to_vec(),
reply_surb: None,
});
let bytes = received_without_surb.serialize();
let recovered = ServerResponse::deserialize(&bytes).unwrap();
match recovered {
ServerResponse::Received(reconstructed) => {
assert_eq!(reconstructed.message, b"foomp".to_vec());
assert!(reconstructed.reply_surb.is_none())
}
_ => unreachable!(),
}
}
#[test]
fn self_address_response_serialization_works() {
let recipient = Recipient::try_from_base58_string("CytBseW6yFXUMzz4SGAKdNLGR7q3sJLLYxyBGvutNEQV.4QXYyEVc5fUDjmmi8PrHN9tdUFV4PCvSJE1278cHyvoe@4sBbL1ngf1vtNqykydQKTFh26sQCw888GpUqvPvyNB4f").unwrap();
let recipient_string = recipient.to_string();
let self_address_response = ServerResponse::SelfAddress(recipient);
let bytes = self_address_response.serialize();
let recovered = ServerResponse::deserialize(&bytes).unwrap();
match recovered {
ServerResponse::SelfAddress(recipient) => {
assert_eq!(recipient.to_string(), recipient_string)
}
_ => unreachable!(),
}
}
#[test]
fn error_response_serialization_works() {
let dummy_error = error::Error::new(ErrorKind::UnknownRequest, "foomp message".to_string());
let error_response = ServerResponse::Error(dummy_error.clone());
let bytes = error_response.serialize();
let recovered = ServerResponse::deserialize(&bytes).unwrap();
match recovered {
ServerResponse::Error(error) => assert_eq!(error, dummy_error),
_ => unreachable!(),
}
}
}
@@ -0,0 +1,140 @@
// Copyright 2021 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
use crate::error::ErrorKind;
use crate::requests::ClientRequest;
use crate::responses::ServerResponse;
use nymsphinx::addressing::clients::Recipient;
use nymsphinx::anonymous_replies::ReplySurb;
use serde::{Deserialize, Serialize};
use std::convert::{TryFrom, TryInto};
// local text equivalent of `ClientRequest` for easier serialization + deserialization with serde
// TODO: figure out if there's an easy way to avoid defining it
#[derive(Serialize, Deserialize, Debug)]
#[serde(tag = "type", rename_all = "camelCase")]
pub(super) enum ClientRequestText {
#[serde(rename_all = "camelCase")]
Send {
message: String,
recipient: String,
with_reply_surb: bool,
},
SelfAddress,
#[serde(rename_all = "camelCase")]
Reply {
message: String,
reply_surb: String,
},
}
impl TryFrom<String> for ClientRequestText {
type Error = serde_json::Error;
fn try_from(msg: String) -> Result<Self, Self::Error> {
serde_json::from_str(&msg)
}
}
impl TryInto<ClientRequest> for ClientRequestText {
type Error = crate::error::Error;
fn try_into(self) -> Result<ClientRequest, Self::Error> {
match self {
ClientRequestText::Send {
message,
recipient,
with_reply_surb,
} => {
let message_bytes = message.into_bytes();
let recipient = Recipient::try_from_base58_string(recipient).map_err(|err| {
Self::Error::new(ErrorKind::MalformedRequest, err.to_string())
})?;
Ok(ClientRequest::Send {
message: message_bytes,
recipient,
with_reply_surb,
})
}
ClientRequestText::SelfAddress => Ok(ClientRequest::SelfAddress),
ClientRequestText::Reply {
message,
reply_surb,
} => {
let message_bytes = message.into_bytes();
let reply_surb = ReplySurb::from_base58_string(reply_surb).map_err(|err| {
Self::Error::new(ErrorKind::MalformedRequest, err.to_string())
})?;
Ok(ClientRequest::Reply {
message: message_bytes,
reply_surb,
})
}
}
}
}
// local text equivalent of `ServerResponse` for easier serialization + deserialization with serde
// TODO: figure out if there's an easy way to avoid defining it
#[derive(Serialize, Deserialize, Debug)]
#[serde(tag = "type", rename_all = "camelCase")]
pub(super) enum ServerResponseText {
#[serde(rename_all = "camelCase")]
Received {
message: String,
reply_surb: Option<String>,
},
SelfAddress {
address: String,
},
Error {
message: String,
},
}
impl TryFrom<String> for ServerResponseText {
type Error = serde_json::Error;
fn try_from(msg: String) -> Result<Self, <ServerResponseText as TryFrom<String>>::Error> {
serde_json::from_str(&msg)
}
}
impl From<ServerResponseText> for String {
fn from(res: ServerResponseText) -> Self {
// per serde_json docs:
/*
/// Serialization can fail if `T`'s implementation of `Serialize` decides to
/// fail, or if `T` contains a map with non-string keys.
*/
// this is not the case here.
serde_json::to_string(&res).unwrap()
}
}
impl From<ServerResponse> for ServerResponseText {
fn from(resp: ServerResponse) -> Self {
match resp {
ServerResponse::Received(reconstructed) => {
ServerResponseText::Received {
// TODO: ask DH what is more appropriate, lossy utf8 conversion or returning error and then
// pure binary later
message: String::from_utf8_lossy(&reconstructed.message).into_owned(),
reply_surb: reconstructed
.reply_surb
.map(|reply_surb| reply_surb.to_base58_string()),
}
}
ServerResponse::SelfAddress(recipient) => ServerResponseText::SelfAddress {
address: recipient.to_string(),
},
ServerResponse::Error(err) => ServerResponseText::Error {
message: err.to_string(),
},
}
}
}
+49
View File
@@ -0,0 +1,49 @@
[package]
name = "nym-socks5-client"
version = "0.12.1"
authors = ["Dave Hrycyszyn <futurechimp@users.noreply.github.com>"]
edition = "2018"
rust-version = "1.56"
[lib]
name = "nym_socks5"
path = "src/lib.rs"
[dependencies]
clap = "2.33.0"
dirs = "3.0" # for determining default store directories in config
dotenv = "0.15.0"
futures = "0.3"
log = "0.4"
pin-project = "1.0"
pretty_env_logger = "0.4"
rand = { version = "0.7.3", features = ["wasm-bindgen"] }
serde = { version = "1.0", features = ["derive"] } # for config serialization/deserialization
snafu = "0.6"
tokio = { version = "1.4", features = ["rt-multi-thread", "net", "signal"] }
url = "2.2"
# internal
client-core = { path = "../client-core" }
coconut-interface = { path = "../../common/coconut-interface", optional = true }
credentials = { path = "../../common/credentials", optional = true }
config = { path = "../../common/config" }
crypto = { path = "../../common/crypto" }
gateway-client = { path = "../../common/client-libs/gateway-client" }
gateway-requests = { path = "../../gateway/gateway-requests" }
nymsphinx = { path = "../../common/nymsphinx" }
ordered-buffer = { path = "../../common/socks5/ordered-buffer" }
socks5-requests = { path = "../../common/socks5/requests" }
topology = { path = "../../common/topology" }
pemstore = { path = "../../common/pemstore" }
proxy-helpers = { path = "../../common/socks5/proxy-helpers" }
validator-client = { path = "../../common/client-libs/validator-client" }
version-checker = { path = "../../common/version-checker" }
network-defaults = { path = "../../common/network-defaults" }
[features]
coconut = ["coconut-interface", "credentials", "gateway-requests/coconut", "gateway-client/coconut"]
eth = []
[build-dependencies]
vergen = { version = "5", default-features = false, features = ["build", "git", "rustc", "cargo"] }
+8
View File
@@ -0,0 +1,8 @@
// Copyright 2021 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
use vergen::{vergen, Config};
fn main() {
vergen(Config::default()).expect("failed to extract build metadata")
}

Some files were not shown because too many files have changed in this diff Show More