Compare commits

...

231 Commits

Author SHA1 Message Date
Bogdan-Ștefan Neacşu eaa0f055af Move const to wireguard types 2024-08-06 14:56:33 +00:00
Bogdan-Ștefan Neacşu ad507c6a12 Use a more proper timeout value 2024-08-06 14:56:24 +00:00
Jon Häggblad e5d68a5e7f Don't set NYM_VPN_API to default (#4740) 2024-07-31 11:45:36 +02:00
Tommy Verrall 7ddd819ff3 Merge pull request #4739 from nymtech/tommy/add-wireguard-publish-binaries
Update publish-nym-binaries.yml
2024-07-30 11:41:43 +02:00
Tommy Verrall 83b416d12d amend build all binaries command 2024-07-30 11:38:07 +02:00
Tommy Verrall b9c775c3ae Update publish-nym-binaries.yml
add wireguard to builds
2024-07-30 11:27:50 +02:00
mx 6f669866e9 Max/doc link fix (#4737)
* fix broken link in header dropdown

---------

Co-authored-by: serinko <97586125+serinko@users.noreply.github.com>
Co-authored-by: mfahampshire <mfahampshire@pm.me>
2024-07-30 08:48:14 +00:00
Tommy Verrall 4e61fefec8 Merge pull request #4736 from nymtech/jon/nym-vpn-api-env
Add NYM_VPN_API to network config
2024-07-30 10:04:55 +02:00
Jon Häggblad b4514ecd83 update for wallet 2024-07-29 23:50:52 +02:00
Jon Häggblad 4f6902525e restore explorer-api 2024-07-29 23:30:09 +02:00
Jon Häggblad 881139e36f Add nym_vpn_api_url 2024-07-29 23:30:09 +02:00
Jon Häggblad 32e2557456 Fix tokio error in 1.39 (#4730)
* Fix tokio error in 1.39

Fix the error generated by tokio 1.39

72 | /             tokio::select! {
173 | |                 daemon_res = &mut fused_runner => {
174 | |                     warn!("the daemon has terminated by itself - was it a short lived command?");
175 | |                     let exit_status = daemon_res?;
...   |
179 | |                 event = &mut self.upgrade_plan_watcher.next() => {
    | |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
...   |
201 | |                 }
202 | |             }
    | |             -
    | |             |
    | |_____________temporary value is freed at the end of this statement
    |               borrow later used here

and

62 | /         select! {
63 | |             connection_message = &mut mix_receiver.next() => {
   | |                                       ^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
64 | |                 if let Some(connection_message) = connection_message {
65 | |                     if deal_with_message(connection_message, &mut writer, &local_destination_address, &remote_source_address, connection_id).await {
...  |
86 | |             }
87 | |         }
   | |         -
   | |         |
   | |_________temporary value is freed at the end of this statement
   |           borrow later used here

* Upgrade to tokio 1.39.1

* Simpler attempt

* Revert fixes and instead bump to tokio 1.39.2

* update

* bump msrv for nym-node-tester-wasm
2024-07-29 20:45:26 +02:00
Jon Häggblad 8b44820e51 Re-export RecipientFormattingError in nym sdk (#4735) 2024-07-29 19:20:26 +02:00
import this 5e6417f837 clarify syntax - PR ready (#4734) 2024-07-29 13:51:31 +00:00
Jędrzej Stuczyński dfb2a2f380 Merge pull request #4716 from nymtech/feature/vesting-purge-plus-ranged-cost-params
Feature/vesting purge plus ranged cost params
2024-07-26 18:01:29 +01:00
fmtabbara d1de751850 fix ci 2024-07-26 17:28:24 +01:00
Jędrzej Stuczyński ecee6ca863 chore: cargo fmt 2024-07-26 15:08:38 +01:00
fmtabbara 31ea3f92e2 update bonding oc and pm validation 2024-07-26 15:08:38 +01:00
fmtabbara f19c934fae finish migrate vested bonded node work 2024-07-26 15:08:38 +01:00
Mark Sinclair 10d6f20de7 wip: add profit margin and cost params into validation from mixnet contract via MainContext 2024-07-26 15:08:38 +01:00
Mark Sinclair 96b33bfbe4 Regenerate TS types 2024-07-26 15:08:38 +01:00
Mark Sinclair 444c787d0a Add kind prop to vesting contract migration modal 2024-07-26 15:08:38 +01:00
Mark Sinclair 61fcd4ac69 Dialog and mock for migrating vesting contract delegations 2024-07-26 15:08:38 +01:00
Jędrzej Stuczyński b76802e6eb exposed tauri operations for vesting migrations 2024-07-26 15:08:38 +01:00
Mark Sinclair 7d351029a4 Fix dependency issue 2024-07-26 15:08:37 +01:00
Jędrzej Stuczyński 4ee445c119 cargo fmt 2024-07-26 15:05:47 +01:00
Jędrzej Stuczyński 61ddeea495 fixed post-rebasing imports 2024-07-26 15:05:47 +01:00
Jędrzej Stuczyński 7b802033b3 missing test fixture 2024-07-26 15:05:47 +01:00
Jędrzej Stuczyński b484f47369 fix nym-cli 2024-07-26 15:05:47 +01:00
Jędrzej Stuczyński 66979df10c update contract schema 2024-07-26 15:05:47 +01:00
Jędrzej Stuczyński 82f161fb91 added associated [hacky] wallet types 2024-07-26 15:05:47 +01:00
Jędrzej Stuczyński 9d0fd681d4 introducing allowed range of operator interval operating cost 2024-07-26 15:05:47 +01:00
Jędrzej Stuczyński c2ab47a102 profit margin range validation 2024-07-26 15:05:46 +01:00
Jędrzej Stuczyński 8704c21621 normalise node's profit margin during rewarding 2024-07-26 15:05:46 +01:00
Jędrzej Stuczyński 03ffb25bf9 introduced the concept of allowed profit margin ranges 2024-07-26 15:05:46 +01:00
Jędrzej Stuczyński 70db1ad062 fixed vesting contract tests 2024-07-26 15:05:46 +01:00
Jędrzej Stuczyński 952ed9b642 fixed wallet vesting-related tests 2024-07-26 15:05:46 +01:00
Jędrzej Stuczyński f57fe79686 updated contract schema 2024-07-26 15:05:46 +01:00
Jędrzej Stuczyński 9179f1c351 exposed migration commands to nym-cli + clippy 2024-07-26 15:05:46 +01:00
Jędrzej Stuczyński c4f7a1e09d implemented migration into non-vesting mixnodes/delegations 2024-07-26 15:05:46 +01:00
Jędrzej Stuczyński 701012a968 ensure no pending proxy events when migrating 2024-07-26 15:05:46 +01:00
Jędrzej Stuczyński 9767f72b8f removed all on_behalf mixnet contract methods 2024-07-26 15:05:46 +01:00
Jędrzej Stuczyński 7b10d92ca4 Merge pull request #4731 from nymtech/chore/1.80-lints
chore: fix 1.80 lint issues
2024-07-26 11:51:23 +01:00
Jędrzej Stuczyński 2c6e5eb673 cherry-pick: fix build issues 2024-07-26 11:11:52 +01:00
Jon Häggblad 02fde4e530 Handle clients with different versions in IPR (#4723)
* Add signable_request function

* Export key type in function signature

* Cargo.lock

* Track client version and respond using it

* Internally use v7 and then down convert if needed

* Local response type

* Streamline

* Strong type for client version

* Remove commented out code

* rustfmt

* Ignore sign verification fail for v6
2024-07-24 15:35:59 +02:00
import this cc25fc1f32 [DOCs/operators]: Changelog for v2024.8 wispa & guide syntax edits (#4728)
* changelog for release v2024.8-wispa

* clarify syntax

* typo fix
2024-07-24 12:38:25 +00:00
benedetta davico c971e486b5 Merge pull request #4726 from nymtech/release/2024.8-wispa
Release/2024.8 wispa into develop
2024-07-24 12:48:57 +02:00
import this 96a9eb6f6a [DOCs/docs]: Commnet out extra stubs (#4727)
* commnet out stubs

* fix broken links - ready to merge
2024-07-24 11:58:14 +02:00
benedetta davico 9eeb61ea0a Merge branch 'develop' into release/2024.8-wispa 2024-07-24 10:56:03 +02:00
John Smith 08042c61ad [DOCs/operators]: Update troubleshooting/vps-isp.md with manual IPv6 configuration (#4651)
* Update vps-isp.md

Added an extra diagnostic step, which helped me to debug lack of routability.

* Update vps-isp.md

Implementing serinko's comments

* Update vps-isp.md

Changed possibly to possible and added how to find IPv6 Gateway.

* Update vps-isp.md

Fixed ifup/ifdown link
2024-07-24 08:53:49 +00:00
Stefano Piermatteo 36c74f30e5 [DOCs/operators]: Syntax fix in setup.md (#4682) 2024-07-24 08:37:33 +00:00
Bogdan-Ștefan Neacşu fd1d437211 Add 1GB/day/user bandwidth cap (#4717)
* Add check for 1GB/day/user and remove stale check

* Use saturated_sub

* Remove from wg peers

* Use 10 seconds instead of 1

* Query bandwidth message

* Ad client query message too

* Keep stale check

* Make bandwidth cap value public

* Fix consumed vs available bug

* Don't overwrite existing registrations

* Use self pub key instead of peer's
2024-07-23 20:49:49 +02:00
Tommy Verrall 4956d13bdc fix conflicts 2024-07-23 17:32:49 +02:00
Jędrzej Stuczyński 6478736654 Merge pull request #4706 from nymtech/chore/remove-old-migration-code
removed mixnode/gateway config migration code and disabled cli without explicit flag
2024-07-23 15:11:36 +01:00
benedettadavico d9f6c0723e updating versions 2024-07-23 15:37:04 +02:00
Jon Häggblad f86050d916 Default construct NodeRole for backwards compatibility (#4722) 2024-07-22 16:04:29 +02:00
Tommy Verrall 52f5656190 Merge pull request #4721 from nymtech/jon/node-role-default
Default construct NodeRole
2024-07-22 15:09:27 +02:00
Jon Häggblad 21cd90f238 Default construct NodeRole for backwards compatibility 2024-07-22 14:59:18 +02:00
import this 4e51188d35 [DOCs/operators]: Guide to back up and restore nym-node (#4720)
* add node backup & node restore guides

* finished: ready to review

* finished: ready to review
2024-07-22 11:17:55 +00:00
John Smith 22eb199936 Update isp-sheet.csv (#4718)
* Update isp-sheet.csv

Added a few known VPS providers which (a) support crypto payment (b) allow TOR in some shape or form (c) more or less know for their stability. Will add more eventually.

* Update isp-sheet.csv

added a few more providers
2024-07-22 10:57:57 +00:00
Tommy Verrall a2fc1bbc96 Merge pull request #4719 from nymtech/serinko/bug-fix/wss-guide
[DOCs/operators]: BugFix - add ssl cert to WSS server block
2024-07-19 12:48:36 +02:00
import this 621599692f add ssl cert to WSS server block 2024-07-19 10:43:02 +00:00
import this 3ad3837c87 done: fix wrong URL and picture formatting (#4714) 2024-07-17 10:47:41 +00:00
import this 4d745e3b7e [DOCs/operators]: Correct ports for bonding (#4707)
* fix port issue for nym-node mixnode

* fix port issue for nym-node mixnode

* simplify language

* clarify moving node info

* syntax fix
2024-07-16 14:00:38 +00:00
Sachin Kamath 3a053b8dd6 fix links (#4712) 2024-07-15 18:06:56 +02:00
Bogdan-Ștefan Neacşu 1f144690da Add upgrades to nym-node for authenticator changes (#4703) (#4710)
* Add iterative upgrades to nym-node

* Authenticator correct configuration

* Add info log

* Enable auth opts on entry gw

* Move ephemeral config from exit_gateway

* Fix fmt

* Fix clippy

* Pass custom transceiver for authenticator

* Fix non-linux build

* Feature gate wg_api

* Change naming from semver to simple incremental

* Move opts unwrap inside the mutable function

* Remove unneeded authenticator_description
2024-07-12 14:45:59 +02:00
Tommy Verrall eec1895acc Merge pull request #4709 from nymtech/dependabot/npm_and_yarn/nym-wallet/webdriver/braces-3.0.3
Bump braces from 3.0.2 to 3.0.3 in /nym-wallet/webdriver
2024-07-12 12:14:04 +02:00
Bogdan-Ștefan Neacşu 72e243042e Add upgrades to nym-node for authenticator changes (#4703)
* Add iterative upgrades to nym-node

* Authenticator correct configuration

* Add info log

* Enable auth opts on entry gw

* Move ephemeral config from exit_gateway

* Fix fmt

* Fix clippy

* Pass custom transceiver for authenticator

* Fix non-linux build

* Feature gate wg_api

* Change naming from semver to simple incremental

* Move opts unwrap inside the mutable function

* Remove unneeded authenticator_description
2024-07-12 12:02:22 +02:00
dependabot[bot] 99864cb7a9 Bump braces from 3.0.2 to 3.0.3 in /nym-wallet/webdriver
Bumps [braces](https://github.com/micromatch/braces) from 3.0.2 to 3.0.3.
- [Changelog](https://github.com/micromatch/braces/blob/master/CHANGELOG.md)
- [Commits](https://github.com/micromatch/braces/compare/3.0.2...3.0.3)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-12 09:09:14 +00:00
Fouad 3155728119 fix explorer mui deps (#4708) 2024-07-12 10:08:29 +01:00
Jędrzej Stuczyński c253b22f69 fixed the positional argument 2024-07-11 16:20:20 +01:00
Jędrzej Stuczyński 66f3a3e9a8 removed mixnode/gateway config migration code and disabled commands without explicit flag 2024-07-11 15:53:10 +01:00
Sachin Kamath 65a1d6d91e switch to new vanity link (#4705) 2024-07-11 13:04:56 +01:00
mx 44cf9b054b Max/dev portal update (#4696)
* updated tutorials with archive + stub

* removed out of date faq pages

* added binary build instructions section

* removed clients from docs

* added clients to devportal

* moved nym-vs-others to docs from devportal

* removed ood quickstart stuff

* tweaked integration options page

* summary changes for new structure

* moved sdk to devportal

* removed sdk from docs

* changed summary file for new structure

* added intro client overview page

* added wallet gif

* fixed now broken links

* removed old comm pages

* added references to newer apps (oreowallet + zcash demo)

* updated darkfi irc socks5

* fixed broken link

---------

Co-authored-by: mfahampshire <mfahampshire@pm.me>
2024-07-10 13:54:13 +02:00
Tommy Verrall 39e2473ef3 Merge pull request #4702 from nymtech/release/2024.7-doubledecker
Release/2024.7 doubledecker
2024-07-10 13:25:11 +02:00
import this 93a108863c add node description and release changelog (#4701) 2024-07-10 10:59:47 +00:00
import this 0905593123 [DOCs/operators]: Test WSS for exit-gateway, write a tutorial & update reversed proxy page (#4694)
* initialise wss guide

* update reverse proxy guide to post smoosh

* finish draft - missing correct script and testing

* syntax edit

* syntax edit

* update WSS configs and script

* edit WSS configs and script

* dinish wss guide - ready to review

* dinish wss guide - ready to review
2024-07-10 10:59:22 +00:00
Tommy Verrall ed9223d5a3 Merge branch 'develop' into release/2024.7-doubledecker 2024-07-10 11:46:21 +02:00
benedettadavico c2ad4e5bb4 Update changelog and bump versions 2024-07-10 11:01:20 +02:00
Tommy Verrall 5f7f5ef92d Merge pull request #4699 from nymtech/release/2024.7-doubledecker
Release/2024.7 doubledecker
2024-07-10 10:46:03 +02:00
Tommy Verrall 962684ff56 Merge pull request #4667 from nymtech/feature/authenticator
Add authenticator
2024-07-10 10:14:58 +02:00
Tommy Verrall 7b3804c078 Merge pull request #4697 from nymtech/event-parsing
add event parsing to support cosmos_sdk > 0.50
2024-07-10 09:55:43 +02:00
Sachin Kamath 170f1823e1 fix tests 2024-07-09 21:54:57 +05:30
Sachin Kamath dc2020559a parse attributes from events instead of raw logs 2024-07-09 21:24:58 +05:30
Tommy Verrall 2b9444cce3 add an early return in parse_raw_str_logs for empty raw log strings.
this accommodates for the v50 chain upgrade
2024-07-09 20:36:36 +05:30
Bogdan-Ștefan Neacşu 68c1c068ac Add old config upgrade flow 2024-07-09 09:16:00 +00:00
Drazen Urch 3d0b70a237 Add mixnodes to self describing api cache (#4684)
* Add mixnodes to self describing api cache

* Use NodeRole enum

* Add route for described mixnodes

* Cleanup contract_cache

* Remove nodestatuscache

* wait_until_ready impl
2024-07-09 10:54:48 +02:00
Bogdan-Ștefan Neacşu 65a6edc78c Add authenticator debug to entry gateway config 2024-07-08 11:00:53 +00:00
Sachin Kamath 2ec8349897 update social links (#4695)
* replace vanity link

* fix links
2024-07-05 14:19:09 +00:00
Bogdan-Ștefan Neacşu 38a2d94f80 Fix clippy 2024-07-05 11:36:15 +00:00
Bogdan-Ștefan Neacşu c7fa910516 Fix add of req id 2024-07-05 10:36:18 +00:00
Bogdan-Ștefan Neacşu 2fe08274dd Add another layer for request id field 2024-07-05 10:20:56 +00:00
mx be89d848dc Max/try fix doc search (#4692)
* minimised dropdown bar

* update ci scripts

* theme changes to dev portal

* theme changes to operators

* theme changes to docs

* theme -> themes

* fixed theme -> themes import in book

* removed bak files

* remove logging from post_process + remove search feature from mdbook

---------

Co-authored-by: mfahampshire <mfahampshire@pm.me>
2024-07-05 12:19:14 +02:00
Bogdan-Ștefan Neacşu a230a9b8b9 Merge remote-tracking branch 'origin/develop' into feature/authenticator 2024-07-05 09:57:48 +00:00
Bogdan-Ștefan Neacşu 72eae7cdf3 Remove stale mid-registrations 2024-07-05 09:38:17 +00:00
Bogdan-Ștefan Neacşu 7cae195370 Typo 2024-07-05 07:54:29 +00:00
Bogdan-Ștefan Neacşu dfb16e385c Rand from workspace 2024-07-05 07:53:33 +00:00
Bogdan-Ștefan Neacşu 660e1cad0a Reconstruction msg 2024-07-04 14:26:37 +00:00
Bogdan-Ștefan Neacşu 7c1aa57a7e Add curr version 2024-07-04 14:15:25 +00:00
Bogdan-Ștefan Neacşu a06e496f78 Add final req creation 2024-07-04 13:54:13 +00:00
Jon Häggblad 70599b97b9 Send bandwidth status messages when connecting (#4691)
* Send bandwidth status messages when connecting

* Rename to task_client

* Move status message type to bandwidth controller
2024-07-04 13:10:16 +02:00
Bogdan-Ștefan Neacşu 02b194bde0 Function to create AuthReq 2024-07-04 10:40:53 +00:00
Bogdan-Ștefan Neacşu 20ec049db5 Remove more unnecessary structures 2024-07-04 09:41:17 +00:00
Tommy Verrall ebac4e8564 Update ci-build-upload-binaries.yml 2024-07-04 09:57:37 +02:00
benedettadavico da81664729 update versions and changelog 2024-07-04 09:36:09 +02:00
Bogdan-Ștefan Neacşu fec3d46b33 Include auth in self description 2024-07-03 13:50:44 +00:00
Bogdan-Ștefan Neacşu a4eb3a7dbf Named fork for better logging 2024-07-03 13:03:32 +00:00
Bogdan-Ștefan Neacşu 28d15f2c4f Remove unused import 2024-07-03 11:28:09 +00:00
Jon Häggblad 6078787daa Remove constructor since it's weakly typed (#4689) 2024-07-03 12:26:47 +02:00
Jon Häggblad 6d93f36c82 Fix NR config compatibility (#4690)
* Make NR able to read config with old keys in

We removed stuff related to the old statistics service, so we ignore
unknown fields to be nice to our users

* Remove deleted config keys from NR template
2024-07-03 12:10:41 +02:00
Bogdan-Ștefan Neacşu c6f93e38f5 Remove unused post function 2024-07-03 09:34:03 +00:00
Bogdan-Ștefan Neacşu 2159f71888 Fix wg feature 2024-07-03 09:04:01 +00:00
Bogdan-Ștefan Neacşu a9abea3446 Fix macos build 2024-07-03 08:27:10 +00:00
Bogdan-Ștefan Neacşu 8e2713c9ba Remove unwrap 2024-07-03 08:21:58 +00:00
Bogdan-Ștefan Neacşu 2ba0ef0e35 Remove unused wg http endpoint 2024-07-02 14:09:34 +00:00
Bogdan-Ștefan Neacşu d3713cbc79 Fix user agent arg 2024-07-02 16:40:11 +03:00
Bogdan-Ștefan Neacşu 4d3fb2b585 Merge remote-tracking branch 'origin/develop' into feature/authenticator 2024-07-02 16:25:29 +03:00
import this e65e611859 remove roles selection on blacklisting node - PR done (#4687) 2024-07-02 13:37:23 +01:00
benedetta davico ebfb9c4bc1 Merge pull request #4686 from nymtech/bugfix/chain-upgrade-raw-logs
Add an early return in `parse_raw_str_logs` for empty raw log strings.
2024-07-02 12:29:48 +02:00
Tommy Verrall 8e7918cc45 add an early return in parse_raw_str_logs for empty raw log strings.
this accommodates for the v50 chain upgrade
2024-07-02 11:19:50 +02:00
Bogdan-Ștefan Neacşu c465eb3efc Fix error type 2024-07-02 08:58:48 +00:00
Bogdan-Ștefan Neacşu b90136ac4e Uniformise non-linux wg function 2024-07-01 15:10:36 +00:00
Bogdan-Ștefan Neacşu ae5373168d Fmt 2024-07-01 14:42:10 +00:00
Bogdan-Ștefan Neacşu 6f3942f6b7 Move implementation for final request 2024-07-01 14:38:48 +00:00
import this 4a25725a11 README.md update (#4685)
* start README update

* test alpha on github preview

* test alpha on github preview

* comment out rewards

* finish README update
2024-07-01 16:27:59 +02:00
Bogdan-Ștefan Neacşu 13f38343aa Finalize cli build 2024-07-01 13:44:59 +00:00
Jon Häggblad d34c829174 Create UserAgent that can be passed from the binary to the nym api client (#4677)
* Create UserAgent that can be passed from the binary to the nym api client

* TryFrom for UserAgent to HeaderValue

* Add user agent for getting the list of gateways

* Fix wasm client

* Move clap behind feature flag in bin-common

* Implement conversion to UserAgent

* Set user_agent on base client in native and socks5 clients

* Set user agent in socks5-listener lib

* wip

* wip

* Deserialize cargo_triple to unknown by default

* Abbreviate git hash

* Remove unused import

* Add missing dep, and remove dbg statements

* Reorder string representation

* Remove commented out code

* Revert temporary log level change
2024-07-01 13:29:10 +02:00
Bogdan-Ștefan Neacşu f75b4843e8 Merge remote-tracking branch 'origin/develop' into feature/authenticator 2024-07-01 09:56:34 +00:00
Jędrzej Stuczyński 6963ead65a minor cleanup 2024-07-01 08:25:31 +01:00
Jon Häggblad 0425cdeaf0 Merge pull request #4680 from nymtech/jon/deps-to-workspace
Move and whole bump of crates to workspace and upgrade some
2024-06-27 13:25:21 +02:00
import this 789914b096 [DOCs/operators]: Updates v2024.6-chomp and T&Cs (#4674)
* initialise updates and ToC

* add toc flag

* changelog and node black-xit improvement

* add node-api-check option

* syntax fix

* syntax fix

* change CI/CD with git reset

* fix typo

* add T&C AMA explanation link - ready for review

* fix typo

* resolve review comments

* add ToC standalone page

* minor edit - ready to go
2024-06-27 09:59:57 +00:00
benedetta davico 008afe7a85 Merge pull request #4676 from nymtech/release/2024.6-chomp
Release/2024.6-chomp to master
2024-06-27 11:47:55 +02:00
Jon Häggblad 8acd3a0975 Move a few more deps partially to workspace 2024-06-27 10:52:15 +02:00
Jon Häggblad fa1519ec6a Move itertools to workspace deps 2024-06-27 10:52:15 +02:00
Jon Häggblad da94b7e8df Sort list 2024-06-27 10:52:15 +02:00
Jon Häggblad 4aa8cb4647 Move dalek and rand_chacha crates to workspace 2024-06-27 10:52:15 +02:00
Jon Häggblad 5d13538508 Use workspace base64 dep 2024-06-27 10:52:15 +02:00
Jon Häggblad 4bbbcf629d Fix warning for default_features 2024-06-27 10:52:15 +02:00
Jon Häggblad 34ef970fd8 Move dirs 4.0 to workspace deps 2024-06-27 10:52:14 +02:00
Jon Häggblad fec570613c Remove code that refers to removed nym-network-statistics (#4679)
* Remove nym-network-statistics from workspace

* Remove nym-network-statistics

* Cargo.lock

* Update ci workflow

* Remove code that refers to removed nym-network-statistics

* Remove more

* Remove nym-statistics-common

* Delete commented out modules

* Remove commented out code

* Remove more commented out code

* Remove more commented out stuff

* Remove unused function
2024-06-27 10:32:32 +02:00
Jon Häggblad 14a904eff0 Remove nym-network-statistics (#4678)
* Remove nym-network-statistics from workspace

* Remove nym-network-statistics

* Cargo.lock

* Update ci workflow
2024-06-27 10:32:09 +02:00
benedetta davico 24ffb8fe8c Merge pull request #4675 from nymtech/release/2024.6-chomp
Release/2024.6-chomp to develop
2024-06-26 12:15:52 +02:00
import this d1bf1f2005 [DOCs/operators]: Guides to improve operator tooling and debugging (#4673)
* initialise node api check guide

* syntax edits

* spell check
2024-06-26 09:55:19 +00:00
import this c42b3f7617 Python CLI to self diagnose Nym nodes (#4606)
* initialised node_api_check CLI

* add swagger data

* print all stats as dicts - first one needs a tweak

* gateways and mixnodes return all dictionaries

* finish basic functionality of returning all data as dicts - need moe functions

* add --no_routing_history and --markdown options

* add error message

* initialise version count command

* version count work - missing error checks

* separate swagger query - need tweak for old mixnodes

* implement output function

* finished - ready for review

* simplify swagger request

* simplify error log

* address review - ping swagger/error solved

* finished version for review

* finished and cleaned - ready for review
2024-06-26 09:54:43 +00:00
benedetta davico 606144dd87 Update CHANGELOG.md 2024-06-25 09:51:20 +02:00
Tommy Verrall a5bcbcc1f5 Update publish-nym-binaries.yml
remove unused binaries for publishing
2024-06-25 09:28:11 +02:00
Tommy Verrall 31cd62b676 Merge pull request #4672 from nymtech/dependabot/npm_and_yarn/wasm/mix-fetch/internal-dev/braces-3.0.3
Bump braces from 3.0.2 to 3.0.3 in /wasm/mix-fetch/internal-dev
2024-06-24 14:06:40 +02:00
Bogdan-Ștefan Neacşu b43844bd7a Embed into gateway 2024-06-21 15:51:02 +00:00
dependabot[bot] 53366c4151 Bump braces from 3.0.2 to 3.0.3 in /wasm/mix-fetch/internal-dev
Bumps [braces](https://github.com/micromatch/braces) from 3.0.2 to 3.0.3.
- [Changelog](https://github.com/micromatch/braces/blob/master/CHANGELOG.md)
- [Commits](https://github.com/micromatch/braces/compare/3.0.2...3.0.3)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-21 12:40:59 +00:00
Jędrzej Stuczyński 2ca63a6fd5 Merge pull request #4671 from nymtech/feature/embedded-ignore-score
make embedded NR/IPR ignore performance of the gateway
2024-06-21 10:50:15 +01:00
Jędrzej Stuczyński d33baec79b clippy 2024-06-21 10:41:33 +01:00
Jędrzej Stuczyński 0626e54b6a make embedded NR/IPR ignore performance of the gateway 2024-06-21 10:03:24 +01:00
Drazen Urch 2a260d46f8 New clippy lints (#4660)
* New clippy lints

* I guess this got removed
2024-06-21 10:02:29 +01:00
Tommy Verrall 7cb5afdeab Merge pull request #4661 from edcalderon/patch-3
Update setup.md
2024-06-21 09:29:35 +02:00
Tommy Verrall d18f4c0380 Merge pull request #4665 from nymtech/dependabot/npm_and_yarn/wasm/client/internal-dev-node/ws-8.17.1
Bump ws from 8.13.0 to 8.17.1 in /wasm/client/internal-dev-node
2024-06-21 09:28:58 +02:00
Yana Matrosova c9c4059c90 Update Gateway and NR in mixFetch docs (#4669)
* Update Gateway and NR in mixFetch docs

---------

Co-authored-by: Yana <yanok87@users.noreply.github.com>
2024-06-20 20:40:56 +02:00
Bogdan-Ștefan Neacşu cd89feb57e Fix path 2024-06-20 15:15:05 +00:00
Bogdan-Ștefan Neacşu 17553d606e Requests and responses 2024-06-20 16:58:21 +03:00
Zane Schepke 3fe33dec8b Merge pull request #4670 from nymtech/zane/expiry-on-import
add expiry returned on import
2024-06-20 09:21:24 -04:00
Zane Schepke 589074360d change to OffsetDateTime 2024-06-20 09:16:05 -04:00
Zane Schepke 2e5406692c add expiry returned on import 2024-06-20 07:00:48 -04:00
Bogdan-Ștefan Neacşu b6d9ed960b Specify version 2024-06-19 11:37:09 +03:00
Jędrzej Stuczyński 1920177b2f Merge pull request #4666 from nymtech/jstuczyn-patch-1
[bugfix] missing rustls feature
2024-06-19 09:03:45 +01:00
Bogdan-Ștefan Neacşu 1d89a887fb Add authenticator 2024-06-18 19:05:23 +03:00
Jędrzej Stuczyński f562433519 [bugfix] missing rustls feature
it just happens to work due to feature-unification. it should probably have this feature by itself.
2024-06-18 16:29:07 +01:00
dependabot[bot] 2affa76304 Bump ws from 8.13.0 to 8.17.1 in /wasm/client/internal-dev-node
Bumps [ws](https://github.com/websockets/ws) from 8.13.0 to 8.17.1.
- [Release notes](https://github.com/websockets/ws/releases)
- [Commits](https://github.com/websockets/ws/compare/8.13.0...8.17.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-18 14:28:26 +00:00
Tommy Verrall d6aeb9142f Merge pull request #4662 from nymtech/dependabot/npm_and_yarn/sdk/typescript/packages/nodejs-client/ws-8.17.1
Bump ws from 8.14.2 to 8.17.1 in /sdk/typescript/packages/nodejs-client
2024-06-18 10:41:50 +02:00
Tommy Verrall 70af84b6b1 Merge pull request #4663 from nymtech/dependabot/npm_and_yarn/clients/native/examples/js-examples/websocket/braces-3.0.3
Bump braces from 3.0.2 to 3.0.3 in /clients/native/examples/js-examples/websocket
2024-06-18 10:14:52 +02:00
dependabot[bot] fc397053c8 Bump braces in /clients/native/examples/js-examples/websocket
Bumps [braces](https://github.com/micromatch/braces) from 3.0.2 to 3.0.3.
- [Changelog](https://github.com/micromatch/braces/blob/master/CHANGELOG.md)
- [Commits](https://github.com/micromatch/braces/compare/3.0.2...3.0.3)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-18 07:03:57 +00:00
dependabot[bot] 3092c8e68e Bump ws from 8.14.2 to 8.17.1 in /sdk/typescript/packages/nodejs-client
Bumps [ws](https://github.com/websockets/ws) from 8.14.2 to 8.17.1.
- [Release notes](https://github.com/websockets/ws/releases)
- [Commits](https://github.com/websockets/ws/compare/8.14.2...8.17.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-18 00:56:03 +00:00
Edward Calderon 4a1efab5c8 Update setup.md
unexpected argument 'true' found
2024-06-17 14:43:15 -05:00
Drazen Urch a2d57f269d New clippy lints (#4660)
* New clippy lints

* I guess this got removed
2024-06-17 15:29:19 +02:00
import this 38c4cc3345 minor syntax edits - the PR is finished for review (#4657) 2024-06-17 12:18:21 +00:00
Jędrzej Stuczyński 06ebe56914 Merge pull request #4654 from nymtech/chore/rename-accept-toc-flag
renamed 'accept-toc' flag and fields into explicit 'accept-operator-terms-and-conditions'
2024-06-17 11:31:41 +01:00
Jędrzej Stuczyński 1c3140898f fixed warning message 2024-06-17 10:09:05 +01:00
Tommy Verrall 6005bf6101 Merge pull request #4659 from nymtech/dependabot/npm_and_yarn/nym-api/tests/braces-3.0.3
Bump braces from 3.0.2 to 3.0.3 in /nym-api/tests
2024-06-17 09:44:34 +02:00
dependabot[bot] 78b9ebb463 Bump braces from 3.0.2 to 3.0.3 in /nym-api/tests
Bumps [braces](https://github.com/micromatch/braces) from 3.0.2 to 3.0.3.
- [Changelog](https://github.com/micromatch/braces/blob/master/CHANGELOG.md)
- [Commits](https://github.com/micromatch/braces/compare/3.0.2...3.0.3)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-17 07:39:12 +00:00
Tommy Verrall ad7f993f0f Merge pull request #4658 from nymtech/dependabot/npm_and_yarn/docker/typescript_client/upload_contract/braces-3.0.3
Bump braces from 3.0.2 to 3.0.3 in /docker/typescript_client/upload_contract
2024-06-17 09:38:25 +02:00
Tommy Verrall 9be8a53ea2 Merge pull request #4656 from edcalderon/patch-2
Update vps-setup.md
2024-06-17 09:37:56 +02:00
Tommy Verrall a89f8cf2ab Merge pull request #4655 from edcalderon/patch-1
Update configuration.md
2024-06-17 09:37:10 +02:00
dependabot[bot] a2dab0e64d Bump braces in /docker/typescript_client/upload_contract
Bumps [braces](https://github.com/micromatch/braces) from 3.0.2 to 3.0.3.
- [Changelog](https://github.com/micromatch/braces/blob/master/CHANGELOG.md)
- [Commits](https://github.com/micromatch/braces/compare/3.0.2...3.0.3)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-17 01:25:23 +00:00
Edward Calderon 52459f6545 Update vps-setup.md
miss parameter
2024-06-14 17:56:50 -05:00
Edward Calderon a82bc3356e Update configuration.md
typo
2024-06-14 15:17:38 -05:00
Jędrzej Stuczyński 9ebe8310a1 renamed 'accept-toc' flag and fields into explicit 'accept-operator-terms-and-conditions' 2024-06-14 17:22:42 +01:00
benedettadavico cf5c5f1df4 update changelog and bump binaries 2024-06-14 16:21:26 +02:00
import this 8585a68d7f syntax fix (#4653) 2024-06-14 18:36:15 +05:30
import this e8540c13a5 [DOCs/operators]: Introduction of the new RELEASE CYCLE & SANDBOX FAUCET (#4652)
* initialise release cycle page

* syntax fix - missing sandbox and faucet guide

* add to summary

* add faucet notes as a draft

* add faucet points and bn feedback as a comment

* create sandbox testnet guide page

* syntax edit

* syntax edit

* change config flag syntax
2024-06-14 12:14:59 +00:00
Jon Häggblad 5a24a8fafc Merge pull request #4643 from nymtech/jon/remove-nc 2024-06-14 12:03:42 +02:00
import this 1195b120ff update nymvpn cli page (#4649) 2024-06-13 09:09:53 +00:00
Tommy Verrall f30cfc0be7 Merge pull request #4650 from nymtech/bugfix/remove-ephemera_migrations
Remove additional code as part of Ephemera Purge and SP and contracts
2024-06-12 17:05:09 +02:00
Tommy Verrall 9460a9941c remove additional code :) 2024-06-12 16:40:11 +02:00
Tommy Verrall eeffc0db51 fmt 2024-06-12 16:29:00 +02:00
Tommy Verrall b7d6e0e1e3 remove left over bbc code 2024-06-12 16:27:00 +02:00
Tommy Verrall 45e0b406ac remove additional ephemera code and related service provider info 2024-06-12 16:15:52 +02:00
import this 405d4653df [DOCs]: NC purge (#4645)
* update wallet desktop url

* purge nym connect docs

* update socks 5 client quickstart

* add api link - ready to merge

* remove allowlist from the integration faq

* syntax fix
2024-06-12 09:16:49 +00:00
Jędrzej Stuczyński 579527b480 Merge pull request #4648 from nymtech/bugfix/contracts-compat
bugfix: make sure nym-api can handle non-cw2 (or without detailed build info) compliant contracts
2024-06-11 19:04:32 +02:00
Jędrzej Stuczyński 70360196f0 bugfix: make sure nym-api can handle non-cw2 (or without detailed build info) compliant contracts 2024-06-11 17:38:24 +01:00
Tommy Verrall b777adeda6 Merge pull request #4639 from nymtech/jon/remove-pr-template
Remove old PR template
2024-06-11 16:25:23 +02:00
Jędrzej Stuczyński 6a6505c9d7 Merge pull request #4647 from nymtech/feature/toc-flag
introduced a flag to accept toc and exposed it via self-described API
2024-06-11 15:20:42 +02:00
Jędrzej Stuczyński b10119d339 Merge pull request #4646 from nymtech/jstuczyn-patch-1
bugfix: make sure to return an error on invalid public ip
2024-06-11 15:09:25 +02:00
Jędrzej Stuczyński 3a4bd4ffd6 introduced a flag to accept toc and exposed it via self-described API 2024-06-11 14:08:09 +01:00
Jędrzej Stuczyński 9769387730 bugfix: make sure to return an error on invalid public ip 2024-06-11 13:58:25 +01:00
Jędrzej Stuczyński 71747e3c82 Merge pull request #4630 from nymtech/feature/forbid-empty-ips
validate nym-node public ips on startup
2024-06-11 14:43:42 +02:00
Jędrzej Stuczyński 5cbbeee0d5 Merge pull request #4631 from nymtech/feature/standarise-contract-info
standarised ContractBuildInformation and added it to all contracts
2024-06-11 14:43:25 +02:00
Jon Häggblad 57187be113 Remove nym-connect CI files 2024-06-11 14:05:05 +02:00
Jon Häggblad fbd634a866 Remove references to nym-connect in toolchain files 2024-06-11 14:05:05 +02:00
Jon Häggblad 8d4eba858e Delete nym-connect directory 2024-06-11 14:05:04 +02:00
Jędrzej Stuczyński f1486fb989 updated schema files 2024-06-11 12:22:38 +01:00
Jędrzej Stuczyński c50c30ae76 standarised ContractBuildInformation and added it to all contracts 2024-06-11 12:22:15 +01:00
Jędrzej Stuczyński 5745cb4d7a Merge pull request #4642 from nymtech/chore/purge-ephemera
Removed ephemera code
2024-06-11 13:15:04 +02:00
Jon Häggblad 00c978c864 Add ci check for PR having an assigned milestone (#4644)
* Add ci check for PR having an assigned milestone

* fix trigger
2024-06-11 12:58:25 +02:00
Tommy Verrall 9e4c58efdf Merge pull request #4640 from nymtech/feature/periodic_remove
Remove stale peers
2024-06-11 12:26:55 +02:00
Tommy Verrall 13e6fcaa85 Merge pull request #4635 from nymtech/feature/new-node-endpoints
Feature/new node endpoints
2024-06-11 12:26:30 +02:00
Tommy Verrall 9bd095ec18 Merge pull request #4638 from nymtech/dependabot/npm_and_yarn/testnet-faucet/braces-3.0.3
Bump braces from 3.0.2 to 3.0.3 in /testnet-faucet
2024-06-11 12:25:13 +02:00
Jędrzej Stuczyński 60d50ff17a fixed visibility of '--local' flag 2024-06-11 11:22:31 +01:00
Tommy Verrall 03f3f0285a Merge pull request #4624 from nymtech/jon/fix-cargo-warnings
Fix cargo warnings
2024-06-11 12:22:12 +02:00
Jędrzej Stuczyński 3e87063ab4 Removed ephemera code 2024-06-11 11:17:26 +01:00
Bogdan-Ștefan Neacşu a32cbd44b0 Remove stale peers 2024-06-11 10:05:38 +00:00
Jon Häggblad 962070a33c Remove old PR template 2024-06-11 12:04:24 +02:00
Jon Häggblad 55f11a5433 Disable profile settings for crate not included
Cargo is warning about

warning: profile package spec `nym-wasm-sdk` in profile `release` did not match any packages

Fix this by commenting out the profile settings for that crate as it's
currently not included  in the main workspace
2024-06-11 11:52:04 +02:00
Jon Häggblad 48332a1069 Fix cargo warnings about default-features for the main workspace
On every cargo command we have the set warnings:

warning: /home/jon/src/nym/nym/common/dkg/Cargo.toml: `default-features` is ignored for bls12_381, since `default-features` was not specified for `workspace.dependencies.bls12_381`, this could become a hard error in the future
warning: /home/jon/src/nym/nym/common/dkg/Cargo.toml: `default-features` is ignored for ff, since `default-features` was not specified for `workspace.dependencies.ff`, this could become a hard error in the future
warning: /home/jon/src/nym/nym/common/dkg/Cargo.toml: `default-features` is ignored for group, since `default-features` was not specified for `workspace.dependencies.group`, this could become a hard error in the future
warning: /home/jon/src/nym/nym/common/client-libs/validator-client/Cargo.toml: `default-features` is ignored for bip32, since `default-features` was not specified for `workspace.dependencies.bip32`, this could become a hard error in the future
warning: /home/jon/src/nym/nym/common/client-libs/validator-client/Cargo.toml: `default-features` is ignored for prost, since `default-features` was not specified for `workspace.dependencies.prost`, this could become a hard error in the future
warning: /home/jon/src/nym/nym/common/credentials-interface/Cargo.toml: `default-features` is ignored for bls12_381, since `default-features` was not specified for `workspace.dependencies.bls12_381`, this could become a hard error in the future
warning: /home/jon/src/nym/nym/common/credentials/Cargo.toml: `default-features` is ignored for bls12_381, since `default-features` was not specified for `workspace.dependencies.bls12_381`, this could become a hard error in the future
warning: /home/jon/src/nym/nym/common/nymcoconut/Cargo.toml: `default-features` is ignored for bls12_381, since `default-features` was not specified for `workspace.dependencies.bls12_381`, this could become a hard error in the future
warning: /home/jon/src/nym/nym/common/nymcoconut/Cargo.toml: `default-features` is ignored for ff, since `default-features` was not specified for `workspace.dependencies.ff`, this could become a hard error in the future
warning: /home/jon/src/nym/nym/common/nymcoconut/Cargo.toml: `default-features` is ignored for group, since `default-features` was not specified for `workspace.dependencies.group`, this could become a hard error in the future

This commit adds default-features = false to the workspace dependencies
to fix these. An alternative way would be to remove
`default-features = false`
in the crates, but I assume these were put there for a good reason. Also
we might have other crates outside of the main workspace that depends on
these crates having default features disabled.
2024-06-11 11:52:01 +02:00
dependabot[bot] 205c887686 Bump braces from 3.0.2 to 3.0.3 in /testnet-faucet
Bumps [braces](https://github.com/micromatch/braces) from 3.0.2 to 3.0.3.
- [Changelog](https://github.com/micromatch/braces/blob/master/CHANGELOG.md)
- [Commits](https://github.com/micromatch/braces/compare/3.0.2...3.0.3)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-11 09:48:46 +00:00
Jędrzej Stuczyński 464041f9e1 ibid for nym-connect 2024-06-10 14:48:35 +01:00
Jędrzej Stuczyński 433748521c wasm fixes 2024-06-10 13:00:24 +01:00
Jędrzej Stuczyński 3cbcd001f4 clippy + test build issues 2024-06-10 11:36:57 +01:00
Jędrzej Stuczyński 282b27646f review comments 2024-06-10 11:19:27 +01:00
Jędrzej Stuczyński 5cc3ee32e9 fix test 2024-06-10 11:17:44 +01:00
Jędrzej Stuczyński f412f45b50 proper type conversions and client compat 2024-06-10 11:03:26 +01:00
Jędrzej Stuczyński 9c19452758 scaffolding of using new endpoints in the client 2024-06-10 10:11:07 +01:00
Jędrzej Stuczyński bf34d00478 new endpoints on nym-api side 2024-06-07 17:02:53 +01:00
Jędrzej Stuczyński 7d714a22f0 validate nym-node public ips on startup 2024-06-06 11:23:16 +01:00
997 changed files with 13060 additions and 49913 deletions
-9
View File
@@ -1,9 +0,0 @@
# Description
Closes: #XXXX
<!-- If appropriate, insert relevant description here -->
# Checklist:
- [ ] added a changelog entry to `CHANGELOG.md`
+2 -2
View File
@@ -41,8 +41,8 @@ jobs:
# This is a workaround replacement which builds on the last working commit b332a6b55668f60988e36961f3f62a794ba82ddb and then on current branch # This is a workaround replacement which builds on the last working commit b332a6b55668f60988e36961f3f62a794ba82ddb and then on current branch
- name: Save current branch to ~/current_branch - name: Save current branch to ~/current_branch
run: git rev-parse --abbrev-ref HEAD > ~/current_branch run: git rev-parse --abbrev-ref HEAD > ~/current_branch
- name: Git pull & switch to b332a6b55668f60988e36961f3f62a794ba82ddb - name: Git pull, reset & switch to b332a6b55668f60988e36961f3f62a794ba82ddb
run: git pull && git checkout b332a6b55668f60988e36961f3f62a794ba82ddb run: git pull && git reset --hard && git checkout b332a6b55668f60988e36961f3f62a794ba82ddb
- name: Build all projects in documentation/ & move to ~/dist/docs/ from b332a6b55668f60988e36961f3f62a794ba82ddb - name: Build all projects in documentation/ & move to ~/dist/docs/ from b332a6b55668f60988e36961f3f62a794ba82ddb
run: cd documentation && ./build_all_to_dist.sh run: cd documentation && ./build_all_to_dist.sh
@@ -104,12 +104,9 @@ jobs:
name: nym-binaries-artifacts name: nym-binaries-artifacts
path: | path: |
target/release/nym-client target/release/nym-client
target/release/nym-gateway
target/release/nym-mixnode
target/release/nym-socks5-client target/release/nym-socks5-client
target/release/nym-api target/release/nym-api
target/release/nym-network-requester target/release/nym-network-requester
target/release/nym-network-statistics
target/release/nym-cli target/release/nym-cli
target/release/nymvisor target/release/nymvisor
target/release/nym-node target/release/nym-node
@@ -124,12 +121,9 @@ jobs:
OUTPUT_DIR: ci-builds/${{ github.ref_name }} OUTPUT_DIR: ci-builds/${{ github.ref_name }}
run: | run: |
cp target/release/nym-client $OUTPUT_DIR cp target/release/nym-client $OUTPUT_DIR
cp target/release/nym-gateway $OUTPUT_DIR
cp target/release/nym-mixnode $OUTPUT_DIR
cp target/release/nym-socks5-client $OUTPUT_DIR cp target/release/nym-socks5-client $OUTPUT_DIR
cp target/release/nym-api $OUTPUT_DIR cp target/release/nym-api $OUTPUT_DIR
cp target/release/nym-network-requester $OUTPUT_DIR cp target/release/nym-network-requester $OUTPUT_DIR
cp target/release/nym-network-statistics $OUTPUT_DIR
cp target/release/nymvisor $OUTPUT_DIR cp target/release/nymvisor $OUTPUT_DIR
cp target/release/nym-node $OUTPUT_DIR cp target/release/nym-node $OUTPUT_DIR
cp target/release/nym-cli $OUTPUT_DIR cp target/release/nym-cli $OUTPUT_DIR
-2
View File
@@ -6,7 +6,6 @@ on:
- 'clients/**' - 'clients/**'
- 'common/**' - 'common/**'
- 'explorer-api/**' - 'explorer-api/**'
- 'ephemera/**'
- 'gateway/**' - 'gateway/**'
- 'integrations/**' - 'integrations/**'
- 'mixnode/**' - 'mixnode/**'
@@ -24,7 +23,6 @@ on:
- 'clients/**' - 'clients/**'
- 'common/**' - 'common/**'
- 'explorer-api/**' - 'explorer-api/**'
- 'ephemera/**'
- 'gateway/**' - 'gateway/**'
- 'integrations/**' - 'integrations/**'
- 'mixnode/**' - 'mixnode/**'
+2 -2
View File
@@ -46,8 +46,8 @@ jobs:
# This is a workaround replacement which builds on the last working commit b332a6b55668f60988e36961f3f62a794ba82ddb and then on current branch # This is a workaround replacement which builds on the last working commit b332a6b55668f60988e36961f3f62a794ba82ddb and then on current branch
- name: Save current branch to ~/current_branch - name: Save current branch to ~/current_branch
run: git rev-parse --abbrev-ref HEAD > ~/current_branch run: git rev-parse --abbrev-ref HEAD > ~/current_branch
- name: Git pull & switch to b332a6b55668f60988e36961f3f62a794ba82ddb - name: Git pull, reset & switch to b332a6b55668f60988e36961f3f62a794ba82ddb
run: git pull && git checkout b332a6b55668f60988e36961f3f62a794ba82ddb run: git pull && git reset --hard && git checkout b332a6b55668f60988e36961f3f62a794ba82ddb
- name: Build all projects in documentation/ & move to ~/dist/docs/ from b332a6b55668f60988e36961f3f62a794ba82ddb - name: Build all projects in documentation/ & move to ~/dist/docs/ from b332a6b55668f60988e36961f3f62a794ba82ddb
run: cd documentation && ./build_all_to_dist.sh run: cd documentation && ./build_all_to_dist.sh
@@ -1,65 +0,0 @@
name: ci-nym-connect-desktop-rust
on:
pull_request:
paths:
- "nym-connect/desktop/src-tauri/**"
- "nym-connect/desktop/src-tauri/Cargo.toml"
- "clients/client-core/**"
- "clients/socks5/**"
- "common/**"
- "gateway/gateway-requests/**"
- "contracts/vesting/**"
- "nym-api/nym-api-requests/**"
jobs:
build:
runs-on: [self-hosted, custom-linux]
env:
CARGO_TERM_COLOR: always
steps:
- name: Install Dependencies (Linux)
run: sudo apt-get update && sudo apt-get -y install libwebkit2gtk-4.0-dev build-essential curl wget libssl-dev libgtk-3-dev squashfs-tools libayatana-appindicator3-dev
continue-on-error: true
- name: Check out repository code
uses: actions/checkout@v2
- name: Install rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt, clippy
- name: Check formatting
uses: actions-rs/cargo@v1
with:
command: fmt
args: --manifest-path nym-connect/desktop/Cargo.toml --all -- --check
- name: Build all binaries
uses: actions-rs/cargo@v1
with:
command: build
args: --manifest-path nym-connect/desktop/Cargo.toml --workspace
- name: Run all tests
uses: actions-rs/cargo@v1
with:
command: test
args: --manifest-path nym-connect/desktop/Cargo.toml --workspace
- uses: actions-rs/clippy-check@v1
name: Clippy checks
continue-on-error: true
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --manifest-path nym-connect/desktop/Cargo.toml --workspace --all-features
- name: Run clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: --manifest-path nym-connect/desktop/Cargo.toml --workspace --all-features -- -D warnings
@@ -1,72 +0,0 @@
name: ci-nym-connect-desktop
on:
pull_request:
paths:
- 'nym-connect/desktop/**'
defaults:
run:
working-directory: nym-connect/desktop
jobs:
build:
runs-on: custom-linux
steps:
- uses: actions/checkout@v2
- name: Install rsync
run: sudo apt-get install rsync
continue-on-error: true
- uses: rlespinasse/github-slug-action@v3.x
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Install Yarn
run: npm install -g yarn
- name: Install Rust stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Install project dependencies
run: cd ../.. && yarn --network-timeout 100000
- name: Install app dependencies
run: yarn
continue-on-error: true
- name: Set environment from the example
run: cp .env.sample .env
- run: yarn storybook:build
- 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: "nym-connect/desktop/storybook-static/"
REMOTE_HOST: ${{ secrets.CI_WWW_REMOTE_HOST }}
REMOTE_USER: ${{ secrets.CI_WWW_REMOTE_USER }}
TARGET: ${{ secrets.CI_WWW_REMOTE_TARGET }}/nym-connect-${{ env.GITHUB_REF_SLUG }}
EXCLUDE: "/dist/, /node_modules/"
- name: Matrix - Node Install
run: npm install
working-directory: .github/workflows/support-files
- name: Matrix - Send Notification
env:
NYM_NOTIFICATION_KIND: nym-connect
NYM_PROJECT_NAME: "nym-connect"
NYM_CI_WWW_BASE: "${{ secrets.NYM_CI_WWW_BASE }}"
NYM_CI_WWW_LOCATION: "nym-connect-${{ env.GITHUB_REF_SLUG }}"
GIT_COMMIT_MESSAGE: "${{ github.event.head_commit.message }}"
GIT_BRANCH: "${GITHUB_REF##*/}"
IS_SUCCESS: "${{ job.status == 'success' }}"
MATRIX_SERVER: "${{ secrets.MATRIX_SERVER }}"
MATRIX_ROOM: "${{ secrets.MATRIX_ROOM }}"
MATRIX_USER_ID: "${{ secrets.MATRIX_USER_ID }}"
MATRIX_TOKEN: "${{ secrets.MATRIX_TOKEN }}"
MATRIX_DEVICE_ID: "${{ secrets.MATRIX_DEVICE_ID }}"
uses: docker://keybaseio/client:stable-node
with:
args: .github/workflows/support-files/notifications/entry_point.sh
@@ -1,92 +0,0 @@
name: nightly-nym-connect-desktop-build
on:
workflow_dispatch:
schedule:
- cron: '14 1 * * *'
jobs:
build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
env:
CARGO_TERM_COLOR: always
MANIFEST_PATH: --manifest-path nym-connect/desktop/Cargo.toml
continue-on-error: true
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Install Dependencies (Linux)
run: sudo apt-get update && sudo apt-get install -y libwebkit2gtk-4.0-dev build-essential curl wget libssl-dev libgtk-3-dev squashfs-tools
if: matrix.os == 'ubuntu-20.04'
- name: Install rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt, clippy
- name: Check formatting
uses: actions-rs/cargo@v1
with:
command: fmt
args: ${{ env.MANIFEST_PATH }} --all -- --check
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: ${{ env.MANIFEST_PATH }} --release --workspace
- name: Unit tests
uses: actions-rs/cargo@v1
with:
command: test
args: ${{ env.MANIFEST_PATH }} --workspace
- name: Clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: ${{ env.MANIFEST_PATH }} --workspace --all-targets -- -D warnings
notification:
needs: build
runs-on: custom-linux
steps:
- name: Collect jobs status
uses: technote-space/workflow-conclusion-action@v2
- name: Check out repository code
uses: actions/checkout@v3
- name: install npm
uses: actions/setup-node@v3
if: env.WORKFLOW_CONCLUSION == 'failure'
with:
node-version: 18
- name: Matrix - Node Install
if: env.WORKFLOW_CONCLUSION == 'failure'
run: npm install
working-directory: .github/workflows/support-files
- name: Matrix - Send Notification
if: env.WORKFLOW_CONCLUSION == 'failure'
env:
NYM_NOTIFICATION_KIND: nightly
NYM_PROJECT_NAME: "nym-connect-desktop-nightly-build"
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
GIT_COMMIT_MESSAGE: "${{ github.event.head_commit.message }}"
GIT_BRANCH: "${GITHUB_REF##*/}"
IS_SUCCESS: "${{ env.WORKFLOW_CONCLUSION == 'success' }}"
MATRIX_SERVER: "${{ secrets.MATRIX_SERVER }}"
MATRIX_ROOM: "${{ secrets.MATRIX_ROOM_NIGHTLY }}"
MATRIX_USER_ID: "${{ secrets.MATRIX_USER_ID }}"
MATRIX_TOKEN: "${{ secrets.MATRIX_TOKEN }}"
MATRIX_DEVICE_ID: "${{ secrets.MATRIX_DEVICE_ID }}"
uses: docker://keybaseio/client:stable-node
with:
args: .github/workflows/support-files/notifications/entry_point.sh
+27
View File
@@ -0,0 +1,27 @@
name: pr-validation
on:
pull_request:
branches:
- develop
- 'release/**'
types:
- labeled
- unlabeled
- opened
- reopened
- synchronize
- edited
- milestoned
- demilestoned
env:
LABELS: ${{ join( github.event.pull_request.labels.*.name, ' ' ) }}
jobs:
check-milestone:
name: Check Milestone
runs-on: ubuntu-latest
steps:
- if: github.event.pull_request.milestone == null && contains( env.LABELS, 'no-milestone' ) == false
run: exit 1
+6 -14
View File
@@ -27,23 +27,17 @@ jobs:
release_id: ${{ steps.create-release.outputs.id }} release_id: ${{ steps.create-release.outputs.id }}
release_date: ${{ fromJSON(steps.create-release.outputs.assets)[0].published_at }} release_date: ${{ fromJSON(steps.create-release.outputs.assets)[0].published_at }}
client_hash: ${{ steps.binary-hashes.outputs.client_hash }} client_hash: ${{ steps.binary-hashes.outputs.client_hash }}
mixnode_hash: ${{ steps.binary-hashes.outputs.mixnode_hash }}
gateway_hash: ${{ steps.binary-hashes.outputs.gateway_hash }}
nymvisor_hash: ${{ steps.binary-hashes.outputs.nymvisor_hash }} nymvisor_hash: ${{ steps.binary-hashes.outputs.nymvisor_hash }}
nymnode_hash: ${{ steps.binary-hashes.outputs.nymnode_hash }} nymnode_hash: ${{ steps.binary-hashes.outputs.nymnode_hash }}
socks5_hash: ${{ steps.binary-hashes.outputs.socks5_hash }} socks5_hash: ${{ steps.binary-hashes.outputs.socks5_hash }}
netreq_hash: ${{ steps.binary-hashes.outputs.netreq_hash }} netreq_hash: ${{ steps.binary-hashes.outputs.netreq_hash }}
cli_hash: ${{ steps.binary-hashes.outputs.cli_hash }} cli_hash: ${{ steps.binary-hashes.outputs.cli_hash }}
netstat_hash: ${{ steps.binary-hashes.outputs.netstat_hash }}
client_version: ${{ steps.binary-versions.outputs.client_version }} client_version: ${{ steps.binary-versions.outputs.client_version }}
mixnode_version: ${{ steps.binary-versions.outputs.mixnode_version }}
gateway_version: ${{ steps.binary-versions.outputs.gateway_version }}
nymvisor_version: ${{ steps.binary-versions.outputs.nymvisor_version }} nymvisor_version: ${{ steps.binary-versions.outputs.nymvisor_version }}
nymnode_version: ${{ steps.binary-versions.outputs.nymnode_version }} nymnode_version: ${{ steps.binary-versions.outputs.nymnode_version }}
socks5_version: ${{ steps.binary-versions.outputs.socks5_version }} socks5_version: ${{ steps.binary-versions.outputs.socks5_version }}
netreq_version: ${{ steps.binary-versions.outputs.netreq_version }} netreq_version: ${{ steps.binary-versions.outputs.netreq_version }}
cli_version: ${{ steps.binary-versions.outputs.cli_version }} cli_version: ${{ steps.binary-versions.outputs.cli_version }}
netstat_version: ${{ steps.binary-versions.outputs.netstat_version }}
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
@@ -57,6 +51,10 @@ jobs:
echo 'RUSTFLAGS="--cfg tokio_unstable"' >> $GITHUB_ENV echo 'RUSTFLAGS="--cfg tokio_unstable"' >> $GITHUB_ENV
if: github.event_name == 'workflow_dispatch' && inputs.add_tokio_unstable == true if: github.event_name == 'workflow_dispatch' && inputs.add_tokio_unstable == true
- name: Set CARGO_FEATURES
run: |
echo 'CARGO_FEATURES=--features wireguard' >> $GITHUB_ENV
- name: Install Rust stable - name: Install Rust stable
uses: actions-rs/toolchain@v1 uses: actions-rs/toolchain@v1
with: with:
@@ -66,8 +64,8 @@ jobs:
uses: actions-rs/cargo@v1 uses: actions-rs/cargo@v1
with: with:
command: build command: build
args: --workspace --release args: --workspace --release ${{ env.CARGO_FEATURES }}
- name: Upload Artifact - name: Upload Artifact
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
@@ -75,12 +73,9 @@ jobs:
path: | path: |
target/release/explorer-api target/release/explorer-api
target/release/nym-client target/release/nym-client
target/release/nym-gateway
target/release/nym-mixnode
target/release/nym-socks5-client target/release/nym-socks5-client
target/release/nym-api target/release/nym-api
target/release/nym-network-requester target/release/nym-network-requester
target/release/nym-network-statistics
target/release/nym-cli target/release/nym-cli
target/release/nymvisor target/release/nymvisor
target/release/nym-node target/release/nym-node
@@ -94,12 +89,9 @@ jobs:
files: | files: |
target/release/explorer-api target/release/explorer-api
target/release/nym-client target/release/nym-client
target/release/nym-gateway
target/release/nym-mixnode
target/release/nym-socks5-client target/release/nym-socks5-client
target/release/nym-api target/release/nym-api
target/release/nym-network-requester target/release/nym-network-requester
target/release/nym-network-statistics
target/release/nym-cli target/release/nym-cli
target/release/nymvisor target/release/nymvisor
target/release/nym-node target/release/nym-node
@@ -1,122 +0,0 @@
name: publish-nym-connect-macos
on:
workflow_dispatch:
release:
types: [created]
defaults:
run:
working-directory: nym-connect/desktop
jobs:
publish-tauri:
if: ${{ (startsWith(github.ref, 'refs/tags/nym-connect-') && github.event_name == 'release') || github.event_name == 'workflow_dispatch' }}
strategy:
fail-fast: false
matrix:
platform: [macos-12-large]
runs-on: ${{ matrix.platform }}
outputs:
release_id: ${{ steps.create-release.outputs.id }}
release_date: ${{ fromJSON(steps.create-release.outputs.assets)[0].created_at }}
version: ${{ steps.release-info.outputs.version }}
filename: ${{ steps.release-info.outputs.filename }}
file_hash: ${{ steps.release-info.outputs.file_hash }}
steps:
- uses: actions/checkout@v2
- name: Node
uses: actions/setup-node@v3
with:
node-version: 18
- name: Install Rust stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: wasm32-unknown-unknown
- name: Install wasm-pack
run: |
export WASM_PACK_VERSION="v0.12.1"
curl -LO https://github.com/rustwasm/wasm-pack/releases/download/${WASM_PACK_VERSION}/wasm-pack-${WASM_PACK_VERSION}-x86_64-apple-darwin.tar.gz
tar xvzf wasm-pack-${WASM_PACK_VERSION}-x86_64-apple-darwin.tar.gz -C $HOME/.cargo/bin --strip-components=1
rm wasm-pack-${WASM_PACK_VERSION}-x86_64-apple-darwin.tar.gz
- name: Install the Apple developer certificate for code signing
env:
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
run: |
# create variables
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
# import certificate and provisioning profile from secrets
echo -n "$APPLE_CERTIFICATE" | base64 --decode --output $CERTIFICATE_PATH
# create temporary keychain
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
# import certificate to keychain
security import $CERTIFICATE_PATH -P "$APPLE_CERTIFICATE_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security list-keychain -d user -s $KEYCHAIN_PATH
- name: Create env file
uses: timheuer/base64-to-file@v1.2
with:
fileName: '.env'
encodedString: ${{ secrets.WALLET_ADMIN_ADDRESS }}
- name: Install project dependencies
shell: bash
run: cd .. && yarn --network-timeout 100000
- name: Install app dependencies and build it
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ENABLE_CODE_SIGNING: ${{ secrets.APPLE_CERTIFICATE }}
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_IDENTITY_ID }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
SENTRY_DSN_RUST: ${{ secrets.SENTRY_DSN_RUST }}
SENTRY_DSN_JS: ${{ secrets.SENTRY_DSN_JS }}
run: yarn && yarn build
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: nym-connect_1.0.0_x64.dmg
path: nym-connect/desktop/target/release/bundle/dmg/nym-connect_1*_x64.dmg
retention-days: 30
- name: Clean up keychain
if: ${{ always() }}
run: |
security delete-keychain $RUNNER_TEMP/app-signing.keychain-db
- id: create-release
name: Upload to release based on tag name
uses: softprops/action-gh-release@v1
if: github.event_name == 'release'
with:
files: |
nym-connect/desktop/target/release/bundle/dmg/*.dmg
nym-connect/desktop/target/release/bundle/macos/*.app.tar.gz*
push-release-data:
if: ${{ (startsWith(github.ref, 'refs/tags/nym-connect-') && github.event_name == 'release') || github.event_name == 'workflow_dispatch' }}
uses: ./.github/workflows/release-calculate-hash.yml
needs: publish-tauri
with:
release_tag: ${{ github.ref_name }}
secrets: inherit
@@ -1,89 +0,0 @@
name: publish-nym-connect-ubuntu
on:
workflow_dispatch:
release:
types: [created]
defaults:
run:
working-directory: nym-connect/desktop
jobs:
publish-tauri:
if: ${{ (startsWith(github.ref, 'refs/tags/nym-connect-') && github.event_name == 'release') || github.event_name == 'workflow_dispatch' }}
strategy:
fail-fast: false
matrix:
platform: [custom-ubuntu-20.04]
runs-on: ${{ matrix.platform }}
outputs:
release_id: ${{ steps.create-release.outputs.id }}
release_date: ${{ fromJSON(steps.create-release.outputs.assets)[0].created_at }}
version: ${{ steps.release-info.outputs.version }}
filename: ${{ steps.release-info.outputs.filename }}
file_hash: ${{ steps.release-info.outputs.file_hash }}
steps:
- uses: actions/checkout@v2
- name: Tauri dependencies
run: >
sudo apt-get update &&
sudo apt-get install -y webkit2gtk-4.0 libayatana-appindicator3-dev
continue-on-error: true
- name: Node
uses: actions/setup-node@v3
with:
node-version: 18
- name: Install Rust stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Install project dependencies
shell: bash
run: cd .. && yarn --network-timeout 100000
- name: Install app dependencies
run: yarn
- name: Create env file
uses: timheuer/base64-to-file@v1.2
with:
fileName: '.env'
encodedString: ${{ secrets.WALLET_ADMIN_ADDRESS }}
- name: Build app
run: yarn build
env:
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
SENTRY_DSN_RUST: ${{ secrets.SENTRY_DSN_RUST }}
SENTRY_DSN_JS: ${{ secrets.SENTRY_DSN_JS }}
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: nym-connect.AppImage.tar.gz
path: nym-connect/desktop/target/release/bundle/appimage/nym-connect_1*_amd64.AppImage
retention-days: 30
- id: create-release
name: Upload to release based on tag name
uses: softprops/action-gh-release@v1
if: github.event_name == 'release'
with:
files: |
nym-connect/desktop/target/release/bundle/appimage/*.AppImage
nym-connect/desktop/target/release/bundle/appimage/*.AppImage.tar.gz*
push-release-data:
if: ${{ (startsWith(github.ref, 'refs/tags/nym-connect-') && github.event_name == 'release') || github.event_name == 'workflow_dispatch' }}
uses: ./.github/workflows/release-calculate-hash.yml
needs: publish-tauri
with:
release_tag: ${{ github.ref_name }}
secrets: inherit
@@ -1,108 +0,0 @@
name: publish-nym-connect-win10
on:
workflow_dispatch:
release:
types: [created]
defaults:
run:
working-directory: nym-connect/desktop
jobs:
publish-tauri:
if: ${{ (startsWith(github.ref, 'refs/tags/nym-connect-') && github.event_name == 'release') || github.event_name == 'workflow_dispatch' }}
strategy:
fail-fast: false
matrix:
platform: [windows10]
runs-on: ${{ matrix.platform }}
outputs:
release_id: ${{ steps.create-release.outputs.id }}
release_date: ${{ fromJSON(steps.create-release.outputs.assets)[0].created_at }}
version: ${{ steps.release-info.outputs.version }}
filename: ${{ steps.release-info.outputs.filename }}
file_hash: ${{ steps.release-info.outputs.file_hash }}
steps:
- name: Clean up first
continue-on-error: true
working-directory: .
run: |
cd ..
del /s /q /A:H nym
rmdir /s /q nym
- uses: actions/checkout@v3
- name: Import signing certificate
env:
WINDOWS_CERTIFICATE: ${{ secrets.WINDOWS_CERTIFICATE }}
WINDOWS_CERTIFICATE_PASSWORD: ${{ secrets.WINDOWS_CERTIFICATE_PASSWORD }}
run: |
New-Item -ItemType directory -Path certificate
Set-Content -Path certificate/tempCert.txt -Value $env:WINDOWS_CERTIFICATE
certutil -decode certificate/tempCert.txt certificate/certificate.pfx
Remove-Item -path certificate -include tempCert.txt
Import-PfxCertificate -FilePath certificate/certificate.pfx -CertStoreLocation Cert:\CurrentUser\My -Password (ConvertTo-SecureString -String $env:WINDOWS_CERTIFICATE_PASSWORD -Force -AsPlainText)
- name: Node
uses: actions/setup-node@v3
with:
node-version: 18
- name: Install Rust stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Create env file
uses: timheuer/base64-to-file@v1.2
with:
fileName: '.env'
encodedString: ${{ secrets.WALLET_ADMIN_ADDRESS }}
- name: Install project dependencies
shell: bash
run: cd .. && yarn --network-timeout 100000
- name: Install app dependencies
shell: bash
run: yarn --network-timeout 100000
- name: Build and sign it
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ENABLE_CODE_SIGNING: ${{ secrets.WINDOWS_CERTIFICATE }}
WINDOWS_CERTIFICATE: ${{ secrets.WINDOWS_CERTIFICATE }}
WINDOWS_CERTIFICATE_PASSWORD: ${{ secrets.WINDOWS_CERTIFICATE_PASSWORD }}
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
SENTRY_DSN_RUST: ${{ secrets.SENTRY_DSN_RUST }}
SENTRY_DSN_JS: ${{ secrets.SENTRY_DSN_JS }}
run: yarn build
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: nym-connect_1.0.0_x64_en-US.msi
path: nym-connect/desktop/target/release/bundle/msi/nym-connect_1*_x64_en-US.msi
retention-days: 30
- id: create-release
name: Upload to release based on tag name
uses: softprops/action-gh-release@v1
if: github.event_name == 'release'
with:
files: |
nym-connect/desktop/target/release/bundle/msi/*.msi
nym-connect/desktop/target/release/bundle/msi/*.msi.zip*
push-release-data:
if: ${{ (startsWith(github.ref, 'refs/tags/nym-connect-') && github.event_name == 'release') || github.event_name == 'workflow_dispatch' }}
uses: ./.github/workflows/release-calculate-hash.yml
needs: publish-tauri
with:
release_tag: ${{ github.ref_name }}
secrets: inherit
@@ -1,29 +0,0 @@
const Handlebars = require('handlebars');
const fs = require('fs');
const path = require('path');
async function addToContextAndValidate(context) {
if (!context.env.NYM_CI_WWW_LOCATION) {
throw new Error('Please ensure the env var NYM_CI_WWW_LOCATION is set');
}
if (!context.env.NYM_CI_WWW_BASE) {
throw new Error('Please ensure the env var NYM_CI_WWW_BASE is set');
}
}
async function getMessageBody(context) {
const source = fs
.readFileSync(
context.env.IS_SUCCESS === 'true'
? path.resolve(__dirname, 'templates', 'success')
: path.resolve(__dirname, 'templates', 'failure'),
)
.toString();
const template = Handlebars.compile(source);
return template(context);
}
module.exports = {
addToContextAndValidate,
getMessageBody,
};
@@ -1,16 +0,0 @@
🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥
> :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 }}
```
@@ -1,16 +0,0 @@
🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩
> :rocket: {{ env.NYM_PROJECT_NAME }} ➡️➡️➡️➡️➡️ **View storybook:** 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 by `{{ env.GITHUB_ACTOR }}` at {{ timestamp }}:
```
{{ env.GIT_COMMIT_MESSAGE }}
```
+96 -1
View File
@@ -4,6 +4,102 @@ Post 1.0.0 release, the changelog format is based on [Keep a Changelog](https://
## [Unreleased] ## [Unreleased]
## [2024.8-wispa] (2024-07-10)
- add event parsing to support cosmos_sdk > 0.50 ([#4697])
- Fix NR config compatibility ([#4690])
- Remove UserAgent constructor since it's weakly typed ([#4689])
- [bugfix]: Node_api_check CLI looked over roles on blacklisted nodes ([#4687])
- Add mixnodes to self describing api cache ([#4684])
- Move and whole bump of crates to workspace and upgrade some ([#4680])
- Remove code that refers to removed nym-network-statistics ([#4679])
- Remove nym-network-statistics ([#4678])
- Create UserAgent that can be passed from the binary to the nym api client ([#4677])
- Add authenticator ([#4667])
[#4697]: https://github.com/nymtech/nym/pull/4697
[#4690]: https://github.com/nymtech/nym/pull/4690
[#4689]: https://github.com/nymtech/nym/pull/4689
[#4687]: https://github.com/nymtech/nym/pull/4687
[#4684]: https://github.com/nymtech/nym/pull/4684
[#4680]: https://github.com/nymtech/nym/pull/4680
[#4679]: https://github.com/nymtech/nym/pull/4679
[#4678]: https://github.com/nymtech/nym/pull/4678
[#4677]: https://github.com/nymtech/nym/pull/4677
[#4667]: https://github.com/nymtech/nym/pull/4667
## [2024.7-doubledecker] (2024-07-04)
- Add an early return in `parse_raw_str_logs` for empty raw log strings. ([#4686])
- Bump braces from 3.0.2 to 3.0.3 in /wasm/mix-fetch/internal-dev ([#4672])
- add expiry returned on import ([#4670])
- [bugfix] missing rustls feature ([#4666])
- Bump ws from 8.13.0 to 8.17.1 in /wasm/client/internal-dev-node ([#4665])
- Bump braces from 3.0.2 to 3.0.3 in /clients/native/examples/js-examples/websocket ([#4663])
- Bump ws from 8.14.2 to 8.17.1 in /sdk/typescript/packages/nodejs-client ([#4662])
- Update setup.md ([#4661])
- New clippy lints ([#4660])
- Bump braces from 3.0.2 to 3.0.3 in /nym-api/tests ([#4659])
- Bump braces from 3.0.2 to 3.0.3 in /docker/typescript_client/upload_contract ([#4658])
- Update vps-setup.md ([#4656])
- Update configuration.md ([#4655])
- Remove old PR template ([#4639])
[#4686]: https://github.com/nymtech/nym/pull/4686
[#4672]: https://github.com/nymtech/nym/pull/4672
[#4670]: https://github.com/nymtech/nym/pull/4670
[#4666]: https://github.com/nymtech/nym/pull/4666
[#4665]: https://github.com/nymtech/nym/pull/4665
[#4663]: https://github.com/nymtech/nym/pull/4663
[#4662]: https://github.com/nymtech/nym/pull/4662
[#4661]: https://github.com/nymtech/nym/pull/4661
[#4660]: https://github.com/nymtech/nym/pull/4660
[#4659]: https://github.com/nymtech/nym/pull/4659
[#4658]: https://github.com/nymtech/nym/pull/4658
[#4656]: https://github.com/nymtech/nym/pull/4656
[#4655]: https://github.com/nymtech/nym/pull/4655
[#4639]: https://github.com/nymtech/nym/pull/4639
## [2024.6-chomp] (2024-06-25)
- Remove additional code as part of Ephemera Purge and SP and contracts ([#4650])
- bugfix: make sure nym-api can handle non-cw2 (or without detailed build info) compliant contracts ([#4648])
- introduced a flag to accept toc and exposed it via self-described API ([#4647])
- bugfix: make sure to return an error on invalid public ip ([#4646])
- Add ci check for PR having an assigned milestone ([#4644])
- Removed ephemera code ([#4642])
- Remove stale peers ([#4640])
- Add generic wg private network routing ([#4636])
- Feature/new node endpoints ([#4635])
- standarised ContractBuildInformation and added it to all contracts ([#4631])
- validate nym-node public ips on startup ([#4630])
- Bump defguard wg ([#4625])
- Fix cargo warnings ([#4624])
- Update kernel peers on peer modification ([#4622])
- Handle v6 and v7 requests in the IPR, but reply with v6 ([#4620])
- fix typo ([#4619])
- Update crypto and rand crates ([#4607])
- Purge name service and service provider directory contracts ([#4603])
[#4650]: https://github.com/nymtech/nym/pull/4650
[#4648]: https://github.com/nymtech/nym/pull/4648
[#4647]: https://github.com/nymtech/nym/pull/4647
[#4646]: https://github.com/nymtech/nym/pull/4646
[#4644]: https://github.com/nymtech/nym/pull/4644
[#4642]: https://github.com/nymtech/nym/pull/4642
[#4640]: https://github.com/nymtech/nym/pull/4640
[#4636]: https://github.com/nymtech/nym/pull/4636
[#4635]: https://github.com/nymtech/nym/pull/4635
[#4631]: https://github.com/nymtech/nym/pull/4631
[#4630]: https://github.com/nymtech/nym/pull/4630
[#4625]: https://github.com/nymtech/nym/pull/4625
[#4624]: https://github.com/nymtech/nym/pull/4624
[#4622]: https://github.com/nymtech/nym/pull/4622
[#4620]: https://github.com/nymtech/nym/pull/4620
[#4619]: https://github.com/nymtech/nym/pull/4619
[#4607]: https://github.com/nymtech/nym/pull/4607
[#4603]: https://github.com/nymtech/nym/pull/4603
## [2024.5-ragusa] (2024-05-22) ## [2024.5-ragusa] (2024-05-22)
- Feature/nym node api location ([#4605]) - Feature/nym node api location ([#4605])
@@ -441,7 +537,6 @@ Post 1.0.0 release, the changelog format is based on [Keep a Changelog](https://
[#3187]: https://github.com/nymtech/nym/issues/3187 [#3187]: https://github.com/nymtech/nym/issues/3187
[#3203]: https://github.com/nymtech/nym/pull/3203 [#3203]: https://github.com/nymtech/nym/pull/3203
[#3199]: https://github.com/nymtech/nym/pull/3199 [#3199]: https://github.com/nymtech/nym/pull/3199
>>>>>>> master
## [v1.1.13] (2023-03-15) ## [v1.1.13] (2023-03-15)
Generated
+110 -103
View File
@@ -526,8 +526,6 @@ dependencies = [
"bs58 0.5.1", "bs58 0.5.1",
"hmac", "hmac",
"k256", "k256",
"once_cell",
"pbkdf2",
"rand_core 0.6.4", "rand_core 0.6.4",
"ripemd", "ripemd",
"sha2 0.10.8", "sha2 0.10.8",
@@ -1380,7 +1378,7 @@ dependencies = [
"bitflags 1.3.2", "bitflags 1.3.2",
"crossterm_winapi", "crossterm_winapi",
"libc", "libc",
"mio", "mio 0.8.11",
"parking_lot 0.12.2", "parking_lot 0.12.2",
"signal-hook", "signal-hook",
"signal-hook-mio", "signal-hook-mio",
@@ -1396,7 +1394,7 @@ dependencies = [
"bitflags 1.3.2", "bitflags 1.3.2",
"crossterm_winapi", "crossterm_winapi",
"libc", "libc",
"mio", "mio 0.8.11",
"parking_lot 0.12.2", "parking_lot 0.12.2",
"signal-hook", "signal-hook",
"signal-hook-mio", "signal-hook-mio",
@@ -2095,14 +2093,14 @@ checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0"
[[package]] [[package]]
name = "explorer-api" name = "explorer-api"
version = "1.1.34" version = "1.1.37"
dependencies = [ dependencies = [
"chrono", "chrono",
"clap 4.5.4", "clap 4.5.4",
"dotenvy", "dotenvy",
"humantime-serde", "humantime-serde",
"isocountry", "isocountry",
"itertools 0.10.5", "itertools 0.12.1",
"log", "log",
"maxminddb", "maxminddb",
"nym-bin-common", "nym-bin-common",
@@ -2204,7 +2202,6 @@ version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449"
dependencies = [ dependencies = [
"bitvec",
"rand_core 0.6.4", "rand_core 0.6.4",
"subtle 2.5.0", "subtle 2.5.0",
] ]
@@ -2224,7 +2221,7 @@ dependencies = [
"atomic 0.6.0", "atomic 0.6.0",
"pear", "pear",
"serde", "serde",
"toml 0.8.12", "toml 0.8.14",
"uncased", "uncased",
"version_check", "version_check",
] ]
@@ -3275,15 +3272,6 @@ dependencies = [
"either", "either",
] ]
[[package]]
name = "itertools"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57"
dependencies = [
"either",
]
[[package]] [[package]]
name = "itertools" name = "itertools"
version = "0.12.1" version = "0.12.1"
@@ -3608,6 +3596,18 @@ dependencies = [
"windows-sys 0.48.0", "windows-sys 0.48.0",
] ]
[[package]]
name = "mio"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4569e456d394deccd22ce1c1913e6ea0e54519f577285001215d33557431afe4"
dependencies = [
"hermit-abi 0.3.9",
"libc",
"wasi 0.11.0+wasi-snapshot-preview1",
"windows-sys 0.52.0",
]
[[package]] [[package]]
name = "mix-fetch-wasm" name = "mix-fetch-wasm"
version = "1.3.0-rc.0" version = "1.3.0-rc.0"
@@ -3789,7 +3789,7 @@ dependencies = [
"inotify", "inotify",
"kqueue", "kqueue",
"libc", "libc",
"mio", "mio 0.8.11",
"walkdir", "walkdir",
"windows-sys 0.45.0", "windows-sys 0.45.0",
] ]
@@ -3861,7 +3861,7 @@ dependencies = [
[[package]] [[package]]
name = "nym-api" name = "nym-api"
version = "1.1.38" version = "1.1.41"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"async-trait", "async-trait",
@@ -3943,6 +3943,7 @@ dependencies = [
"nym-crypto", "nym-crypto",
"nym-mixnet-contract-common", "nym-mixnet-contract-common",
"nym-node-requests", "nym-node-requests",
"rocket",
"schemars", "schemars",
"serde", "serde",
"serde_json", "serde_json",
@@ -3961,6 +3962,54 @@ dependencies = [
"tokio", "tokio",
] ]
[[package]]
name = "nym-authenticator"
version = "0.1.0"
dependencies = [
"anyhow",
"bincode",
"bs58 0.5.1",
"bytes",
"clap 4.5.4",
"fastrand 2.1.0",
"futures",
"ipnetwork 0.16.0",
"log",
"nym-authenticator-requests",
"nym-bin-common",
"nym-client-core",
"nym-config",
"nym-crypto",
"nym-id",
"nym-network-defaults",
"nym-sdk",
"nym-service-providers-common",
"nym-sphinx",
"nym-task",
"nym-types",
"nym-wireguard",
"nym-wireguard-types",
"rand 0.8.5",
"serde",
"serde_json",
"thiserror",
"tokio",
"tokio-stream",
"tokio-util",
"url",
]
[[package]]
name = "nym-authenticator-requests"
version = "0.1.0"
dependencies = [
"bincode",
"nym-sphinx",
"nym-wireguard-types",
"rand 0.8.5",
"serde",
]
[[package]] [[package]]
name = "nym-bandwidth-controller" name = "nym-bandwidth-controller"
version = "0.1.0" version = "0.1.0"
@@ -4020,7 +4069,7 @@ dependencies = [
[[package]] [[package]]
name = "nym-cli" name = "nym-cli"
version = "1.1.36" version = "1.1.39"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"base64 0.13.1", "base64 0.13.1",
@@ -4099,7 +4148,7 @@ dependencies = [
[[package]] [[package]]
name = "nym-client" name = "nym-client"
version = "1.1.35" version = "1.1.38"
dependencies = [ dependencies = [
"bs58 0.5.1", "bs58 0.5.1",
"clap 4.5.4", "clap 4.5.4",
@@ -4284,7 +4333,7 @@ dependencies = [
"ff", "ff",
"getrandom 0.2.15", "getrandom 0.2.15",
"group", "group",
"itertools 0.10.5", "itertools 0.12.1",
"nym-dkg", "nym-dkg",
"nym-pemstore", "nym-pemstore",
"rand 0.8.5", "rand 0.8.5",
@@ -4339,10 +4388,12 @@ dependencies = [
"bs58 0.5.1", "bs58 0.5.1",
"cosmwasm-schema", "cosmwasm-schema",
"cosmwasm-std", "cosmwasm-std",
"cw-storage-plus",
"schemars", "schemars",
"serde", "serde",
"serde_json", "serde_json",
"thiserror", "thiserror",
"vergen",
] ]
[[package]] [[package]]
@@ -4459,16 +4510,6 @@ dependencies = [
"zeroize", "zeroize",
] ]
[[package]]
name = "nym-ephemera-common"
version = "0.1.0"
dependencies = [
"cosmwasm-schema",
"cosmwasm-std",
"cw-utils",
"nym-contracts-common",
]
[[package]] [[package]]
name = "nym-execute" name = "nym-execute"
version = "0.1.0" version = "0.1.0"
@@ -4533,6 +4574,7 @@ dependencies = [
"ipnetwork 0.16.0", "ipnetwork 0.16.0",
"log", "log",
"nym-api-requests", "nym-api-requests",
"nym-authenticator",
"nym-bin-common", "nym-bin-common",
"nym-config", "nym-config",
"nym-credentials", "nym-credentials",
@@ -4547,7 +4589,6 @@ dependencies = [
"nym-node-http-api", "nym-node-http-api",
"nym-pemstore", "nym-pemstore",
"nym-sphinx", "nym-sphinx",
"nym-statistics-common",
"nym-task", "nym-task",
"nym-types", "nym-types",
"nym-validator-client", "nym-validator-client",
@@ -4643,6 +4684,7 @@ version = "0.1.0"
dependencies = [ dependencies = [
"async-trait", "async-trait",
"http 1.1.0", "http 1.1.0",
"nym-bin-common",
"reqwest 0.12.4", "reqwest 0.12.4",
"serde", "serde",
"serde_json", "serde_json",
@@ -4920,7 +4962,7 @@ dependencies = [
[[package]] [[package]]
name = "nym-network-requester" name = "nym-network-requester"
version = "1.1.36" version = "1.1.39"
dependencies = [ dependencies = [
"addr", "addr",
"anyhow", "anyhow",
@@ -4949,7 +4991,6 @@ dependencies = [
"nym-socks5-proxy-helpers", "nym-socks5-proxy-helpers",
"nym-socks5-requests", "nym-socks5-requests",
"nym-sphinx", "nym-sphinx",
"nym-statistics-common",
"nym-task", "nym-task",
"nym-types", "nym-types",
"pretty_env_logger", "pretty_env_logger",
@@ -4970,26 +5011,9 @@ dependencies = [
"zeroize", "zeroize",
] ]
[[package]]
name = "nym-network-statistics"
version = "1.1.34"
dependencies = [
"dirs 4.0.0",
"log",
"nym-bin-common",
"nym-statistics-common",
"nym-task",
"pretty_env_logger",
"rocket",
"serde",
"sqlx",
"thiserror",
"tokio",
]
[[package]] [[package]]
name = "nym-node" name = "nym-node"
version = "1.1.2" version = "1.1.5"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"bip39", "bip39",
@@ -5001,6 +5025,7 @@ dependencies = [
"cupid", "cupid",
"humantime-serde", "humantime-serde",
"ipnetwork 0.16.0", "ipnetwork 0.16.0",
"nym-authenticator",
"nym-bin-common", "nym-bin-common",
"nym-client-core-config-types", "nym-client-core-config-types",
"nym-config", "nym-config",
@@ -5024,7 +5049,7 @@ dependencies = [
"sysinfo 0.30.12", "sysinfo 0.30.12",
"thiserror", "thiserror",
"tokio", "tokio",
"toml 0.8.12", "toml 0.8.14",
"tracing", "tracing",
"url", "url",
"zeroize", "zeroize",
@@ -5170,7 +5195,7 @@ dependencies = [
"chacha20poly1305", "chacha20poly1305",
"criterion", "criterion",
"curve25519-dalek 4.1.2", "curve25519-dalek 4.1.2",
"fastrand 1.9.0", "fastrand 2.1.0",
"getrandom 0.2.15", "getrandom 0.2.15",
"log", "log",
"rand 0.8.5", "rand 0.8.5",
@@ -5251,7 +5276,7 @@ dependencies = [
[[package]] [[package]]
name = "nym-socks5-client" name = "nym-socks5-client"
version = "1.1.35" version = "1.1.38"
dependencies = [ dependencies = [
"bs58 0.5.1", "bs58 0.5.1",
"clap 4.5.4", "clap 4.5.4",
@@ -5270,6 +5295,7 @@ dependencies = [
"nym-socks5-client-core", "nym-socks5-client-core",
"nym-sphinx", "nym-sphinx",
"nym-topology", "nym-topology",
"nym-validator-client",
"rand 0.8.5", "rand 0.8.5",
"serde", "serde",
"serde_json", "serde_json",
@@ -5515,20 +5541,6 @@ dependencies = [
"thiserror", "thiserror",
] ]
[[package]]
name = "nym-statistics-common"
version = "1.0.1"
dependencies = [
"async-trait",
"log",
"reqwest 0.12.4",
"serde",
"serde_json",
"sqlx",
"thiserror",
"tokio",
]
[[package]] [[package]]
name = "nym-store-cipher" name = "nym-store-cipher"
version = "0.1.0" version = "0.1.0"
@@ -5603,7 +5615,7 @@ dependencies = [
"cosmwasm-std", "cosmwasm-std",
"eyre", "eyre",
"hmac", "hmac",
"itertools 0.11.0", "itertools 0.12.1",
"log", "log",
"nym-config", "nym-config",
"nym-crypto", "nym-crypto",
@@ -5642,7 +5654,7 @@ dependencies = [
"eyre", "eyre",
"flate2", "flate2",
"futures", "futures",
"itertools 0.10.5", "itertools 0.12.1",
"log", "log",
"nym-api-requests", "nym-api-requests",
"nym-coconut", "nym-coconut",
@@ -5650,7 +5662,6 @@ dependencies = [
"nym-coconut-dkg-common", "nym-coconut-dkg-common",
"nym-config", "nym-config",
"nym-contracts-common", "nym-contracts-common",
"nym-ephemera-common",
"nym-group-contract-common", "nym-group-contract-common",
"nym-http-api-client", "nym-http-api-client",
"nym-mixnet-contract-common", "nym-mixnet-contract-common",
@@ -5743,6 +5754,7 @@ name = "nym-wireguard"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"base64 0.21.7", "base64 0.21.7",
"chrono",
"dashmap", "dashmap",
"defguard_wireguard_rs", "defguard_wireguard_rs",
"ip_network", "ip_network",
@@ -5751,7 +5763,9 @@ dependencies = [
"nym-network-defaults", "nym-network-defaults",
"nym-task", "nym-task",
"nym-wireguard-types", "nym-wireguard-types",
"thiserror",
"tokio", "tokio",
"tokio-stream",
"x25519-dalek", "x25519-dalek",
] ]
@@ -5777,7 +5791,7 @@ dependencies = [
[[package]] [[package]]
name = "nymvisor" name = "nymvisor"
version = "0.1.1" version = "0.1.4"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"bytes", "bytes",
@@ -6089,16 +6103,6 @@ version = "1.0.15"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"
[[package]]
name = "pbkdf2"
version = "0.12.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2"
dependencies = [
"digest 0.10.7",
"hmac",
]
[[package]] [[package]]
name = "pear" name = "pear"
version = "0.2.9" version = "0.2.9"
@@ -7614,9 +7618,9 @@ dependencies = [
[[package]] [[package]]
name = "serde_spanned" name = "serde_spanned"
version = "0.6.5" version = "0.6.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eb3622f419d1296904700073ea6cc23ad690adbd66f13ea683df73298736f0c1" checksum = "79e674e01f999af37c49f70a6ede167a8a60b2503e56c5599532a65baa5969a0"
dependencies = [ dependencies = [
"serde", "serde",
] ]
@@ -7753,7 +7757,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "29ad2e15f37ec9a6cc544097b78a1ec90001e9f71b81338ca39f430adaca99af" checksum = "29ad2e15f37ec9a6cc544097b78a1ec90001e9f71b81338ca39f430adaca99af"
dependencies = [ dependencies = [
"libc", "libc",
"mio", "mio 0.8.11",
"signal-hook", "signal-hook",
] ]
@@ -8462,22 +8466,21 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
[[package]] [[package]]
name = "tokio" name = "tokio"
version = "1.37.0" version = "1.39.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1adbebffeca75fcfd058afa480fb6c0b81e165a0323f9c9d39c9697e37c46787" checksum = "daa4fb1bc778bd6f04cbfc4bb2d06a7396a8f299dc33ea1900cedaa316f467b1"
dependencies = [ dependencies = [
"backtrace", "backtrace",
"bytes", "bytes",
"libc", "libc",
"mio", "mio 1.0.1",
"num_cpus",
"parking_lot 0.12.2", "parking_lot 0.12.2",
"pin-project-lite", "pin-project-lite",
"signal-hook-registry", "signal-hook-registry",
"socket2", "socket2",
"tokio-macros", "tokio-macros",
"tracing", "tracing",
"windows-sys 0.48.0", "windows-sys 0.52.0",
] ]
[[package]] [[package]]
@@ -8492,9 +8495,9 @@ dependencies = [
[[package]] [[package]]
name = "tokio-macros" name = "tokio-macros"
version = "2.2.0" version = "2.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -8636,21 +8639,21 @@ dependencies = [
[[package]] [[package]]
name = "toml" name = "toml"
version = "0.8.12" version = "0.8.14"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e9dd1545e8208b4a5af1aa9bbd0b4cf7e9ea08fabc5d0a5c67fcaafa17433aa3" checksum = "6f49eb2ab21d2f26bd6db7bf383edc527a7ebaee412d17af4d40fdccd442f335"
dependencies = [ dependencies = [
"serde", "serde",
"serde_spanned", "serde_spanned",
"toml_datetime", "toml_datetime",
"toml_edit 0.22.12", "toml_edit 0.22.14",
] ]
[[package]] [[package]]
name = "toml_datetime" name = "toml_datetime"
version = "0.6.5" version = "0.6.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" checksum = "4badfd56924ae69bcc9039335b2e017639ce3f9b001c393c1b2d1ef846ce2cbf"
dependencies = [ dependencies = [
"serde", "serde",
] ]
@@ -8670,9 +8673,9 @@ dependencies = [
[[package]] [[package]]
name = "toml_edit" name = "toml_edit"
version = "0.22.12" version = "0.22.14"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3328d4f68a705b2a4498da1d580585d39a6510f98318a2cec3018a7ec61ddef" checksum = "f21c7aaf97f1bd9ca9d4f9e73b0a6c74bd5afef56f2bc931943a6e1c37e04e38"
dependencies = [ dependencies = [
"indexmap 2.2.6", "indexmap 2.2.6",
"serde", "serde",
@@ -9235,11 +9238,14 @@ checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
[[package]] [[package]]
name = "vergen" name = "vergen"
version = "8.2.6" version = "8.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1290fd64cc4e7d3c9b07d7f333ce0ce0007253e32870e632624835cc80b83939" checksum = "e27d6bdd219887a9eadd19e1c34f32e47fa332301184935c6d9bca26f3cca525"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"cargo_metadata",
"cfg-if",
"regex",
"rustc_version 0.4.0", "rustc_version 0.4.0",
"rustversion", "rustversion",
"time", "time",
@@ -9444,6 +9450,7 @@ dependencies = [
name = "wasm-utils" name = "wasm-utils"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"console_error_panic_hook",
"futures", "futures",
"getrandom 0.2.15", "getrandom 0.2.15",
"gloo-net", "gloo-net",
+31 -22
View File
@@ -20,6 +20,7 @@ members = [
"clients/native", "clients/native",
"clients/native/websocket-requests", "clients/native/websocket-requests",
"clients/socks5", "clients/socks5",
"common/authenticator-requests",
"common/async-file-watcher", "common/async-file-watcher",
"common/bandwidth-controller", "common/bandwidth-controller",
"common/bin-common", "common/bin-common",
@@ -35,7 +36,6 @@ members = [
"common/cosmwasm-smart-contracts/coconut-bandwidth-contract", "common/cosmwasm-smart-contracts/coconut-bandwidth-contract",
"common/cosmwasm-smart-contracts/coconut-dkg", "common/cosmwasm-smart-contracts/coconut-dkg",
"common/cosmwasm-smart-contracts/contracts-common", "common/cosmwasm-smart-contracts/contracts-common",
# "common/cosmwasm-smart-contracts/ephemera",
"common/cosmwasm-smart-contracts/group-contract", "common/cosmwasm-smart-contracts/group-contract",
"common/cosmwasm-smart-contracts/mixnet-contract", "common/cosmwasm-smart-contracts/mixnet-contract",
"common/cosmwasm-smart-contracts/multisig-contract", "common/cosmwasm-smart-contracts/multisig-contract",
@@ -77,7 +77,6 @@ members = [
"common/socks5-client-core", "common/socks5-client-core",
"common/socks5/proxy-helpers", "common/socks5/proxy-helpers",
"common/socks5/requests", "common/socks5/requests",
"common/statistics",
"common/store-cipher", "common/store-cipher",
"common/task", "common/task",
"common/topology", "common/topology",
@@ -97,10 +96,10 @@ members = [
"mixnode", "mixnode",
"sdk/lib/socks5-listener", "sdk/lib/socks5-listener",
"sdk/rust/nym-sdk", "sdk/rust/nym-sdk",
"service-providers/authenticator",
"service-providers/common", "service-providers/common",
"service-providers/ip-packet-router", "service-providers/ip-packet-router",
"service-providers/network-requester", "service-providers/network-requester",
"service-providers/network-statistics",
"nym-api", "nym-api",
"nym-browser-extension/storage", "nym-browser-extension/storage",
"nym-api/nym-api-requests", "nym-api/nym-api-requests",
@@ -117,7 +116,7 @@ members = [
"tools/nymvisor", "tools/nymvisor",
"tools/ts-rs-cli", "tools/ts-rs-cli",
"wasm/client", "wasm/client",
# "wasm/full-nym-wasm", # "wasm/full-nym-wasm", # If we uncomment this again, remember to also uncomment the profile settings below
"wasm/mix-fetch", "wasm/mix-fetch",
"wasm/node-tester", "wasm/node-tester",
"wasm/zknym-lib", "wasm/zknym-lib",
@@ -128,7 +127,6 @@ default-members = [
"clients/socks5", "clients/socks5",
"gateway", "gateway",
"service-providers/network-requester", "service-providers/network-requester",
"service-providers/network-statistics",
"mixnode", "mixnode",
"nym-api", "nym-api",
"tools/nymvisor", "tools/nymvisor",
@@ -141,9 +139,6 @@ exclude = [
"explorer", "explorer",
"contracts", "contracts",
"nym-wallet", "nym-wallet",
"nym-connect/mobile/src-tauri",
"nym-connect/desktop",
"nym-vpn/ui/src-tauri",
"cpu-cycles", "cpu-cycles",
"sdk/ffi/cpp", "sdk/ffi/cpp",
] ]
@@ -196,12 +191,15 @@ cupid = "0.6.1"
curve25519-dalek = "4.1" curve25519-dalek = "4.1"
dashmap = "5.5.3" dashmap = "5.5.3"
defguard_wireguard_rs = "0.4.2" defguard_wireguard_rs = "0.4.2"
digest = "0.10.7"
dirs = "4.0"
doc-comment = "0.3" doc-comment = "0.3"
dotenvy = "0.15.6" dotenvy = "0.15.6"
ecdsa = "0.16" ecdsa = "0.16"
ed25519-dalek = "2.1" ed25519-dalek = "2.1"
etherparse = "0.13.0" etherparse = "0.13.0"
eyre = "0.6.9" eyre = "0.6.9"
fastrand = "2.1.0"
flate2 = "1.0.28" flate2 = "1.0.28"
futures = "0.3.28" futures = "0.3.28"
generic-array = "0.14.7" generic-array = "0.14.7"
@@ -213,14 +211,15 @@ hex = "0.4.3"
hex-literal = "0.3.3" hex-literal = "0.3.3"
hkdf = "0.12.3" hkdf = "0.12.3"
hmac = "0.12.1" hmac = "0.12.1"
http = "1"
httpcodec = "0.2.3" httpcodec = "0.2.3"
humantime = "2.1.0" humantime = "2.1.0"
humantime-serde = "1.1.1" humantime-serde = "1.1.1"
http = "1"
hyper = "1.3.1" hyper = "1.3.1"
indexed_db_futures = "0.3.0" indexed_db_futures = "0.3.0"
inquire = "0.6.2" inquire = "0.6.2"
ip_network = "0.4.1" ip_network = "0.4.1"
ipnetwork = "0.16"
isocountry = "0.3.2" isocountry = "0.3.2"
k256 = "0.13" k256 = "0.13"
lazy_static = "1.4.0" lazy_static = "1.4.0"
@@ -243,6 +242,7 @@ publicsuffix = "2.2.3"
quote = "1" quote = "1"
rand = "0.8.5" rand = "0.8.5"
rand-07 = "0.7.3" rand-07 = "0.7.3"
rand_chacha = "0.3"
rand_chacha_02 = "0.2" rand_chacha_02 = "0.2"
rand_core = "0.6.3" rand_core = "0.6.3"
rand_distr = "0.4" rand_distr = "0.4"
@@ -256,6 +256,7 @@ rocket_cors = "0.6.0"
rocket_okapi = "0.8.0" rocket_okapi = "0.8.0"
safer-ffi = "0.1.4" safer-ffi = "0.1.4"
schemars = "0.8.1" schemars = "0.8.1"
semver = "1.0.23"
serde = "1.0.152" serde = "1.0.152"
serde_bytes = "0.11.6" serde_bytes = "0.11.6"
serde_derive = "1.0" serde_derive = "1.0"
@@ -263,22 +264,25 @@ serde_json = "1.0.91"
serde_repr = "0.1" serde_repr = "0.1"
serde_with = "3.4.0" serde_with = "3.4.0"
serde_yaml = "0.9.25" serde_yaml = "0.9.25"
sha2 = "0.10.8"
si-scale = "0.2.2" si-scale = "0.2.2"
sphinx-packet = "0.1.1" sphinx-packet = "0.1.1"
sqlx = "0.6.3" sqlx = "0.6.3"
strum = "0.25" strum = "0.25"
subtle-encoding = "0.5" subtle-encoding = "0.5"
syn = "1" syn = "1"
sysinfo = "0.30.12"
tap = "1.0.1" tap = "1.0.1"
tar = "0.4.40" tar = "0.4.40"
tempfile = "3.5.0" tempfile = "3.5.0"
thiserror = "1.0.48" thiserror = "1.0.48"
time = "0.3.30" time = "0.3.30"
tokio = "1.33.0" tokio = "1.39"
tokio-stream = "0.1.14" tokio-stream = "0.1.15"
tokio-test = "0.4.2" tokio-test = "0.4.4"
tokio-tungstenite = { version = "0.20.1" } tokio-tungstenite = { version = "0.20.1" }
tokio-util = "0.7.10" tokio-util = "0.7.11"
toml = "0.8.14"
tower = "0.4.13" tower = "0.4.13"
tower-http = "0.5.2" tower-http = "0.5.2"
tracing = "0.1.37" tracing = "0.1.37"
@@ -290,9 +294,10 @@ tungstenite = { version = "0.20.1", default-features = false }
url = "2.4" url = "2.4"
utoipa = "4.2.0" utoipa = "4.2.0"
utoipa-swagger-ui = "6.0.0" utoipa-swagger-ui = "6.0.0"
vergen = { version = "=8.2.6", default-features = false } vergen = { version = "=8.3.1", default-features = false }
walkdir = "2" walkdir = "2"
wasm-bindgen-test = "0.3.36" wasm-bindgen-test = "0.3.36"
x25519-dalek = "2.0.0"
zeroize = "1.6.0" zeroize = "1.6.0"
prometheus = { version = "0.13.0" } prometheus = { version = "0.13.0" }
@@ -300,9 +305,9 @@ prometheus = { version = "0.13.0" }
# coconut/DKG related # coconut/DKG related
# unfortunately until https://github.com/zkcrypto/bls12_381/issues/10 is resolved, we have to rely on the fork # unfortunately until https://github.com/zkcrypto/bls12_381/issues/10 is resolved, we have to rely on the fork
# as we need to be able to serialize Gt so that we could create the lookup table for baby-step-giant-step algorithm # as we need to be able to serialize Gt so that we could create the lookup table for baby-step-giant-step algorithm
bls12_381 = { git = "https://github.com/jstuczyn/bls12_381", branch = "feature/gt-serialization-0.8.0" } bls12_381 = { git = "https://github.com/jstuczyn/bls12_381", default-features = false, branch = "feature/gt-serialization-0.8.0" }
group = "0.13.0" group = { version = "0.13.0", default-features = false }
ff = "0.13.0" ff = { version = "0.13.0", default-features = false }
# cosmwasm-related # cosmwasm-related
cosmwasm-derive = "=1.4.3" cosmwasm-derive = "=1.4.3"
@@ -321,14 +326,14 @@ cw4 = { version = "=1.1.2" }
cw-controllers = { version = "=1.1.0" } cw-controllers = { version = "=1.1.0" }
# cosmrs-related # cosmrs-related
bip32 = "0.5.1" bip32 = { version = "0.5.1", default-features = false }
# temporarily using a fork again (yay.) because we need staking and slashing support # temporarily using a fork again (yay.) because we need staking and slashing support
cosmrs = { git = "https://github.com/jstuczyn/cosmos-rust", branch = "nym-temp/all-validator-features" } cosmrs = { git = "https://github.com/jstuczyn/cosmos-rust", branch = "nym-temp/all-validator-features" }
#cosmrs = { git = "https://github.com/jstuczyn/cosmos-rust", branch = "nym-temp/all-validator-features" } # unfortuntely we need a fork by yours truly to get the staking support #cosmrs = { git = "https://github.com/jstuczyn/cosmos-rust", branch = "nym-temp/all-validator-features" } # unfortuntely we need a fork by yours truly to get the staking support
tendermint = "0.34" # same version as used by cosmrs tendermint = "0.34" # same version as used by cosmrs
tendermint-rpc = "0.34" # same version as used by cosmrs tendermint-rpc = "0.34" # same version as used by cosmrs
prost = "0.12" prost = { version = "0.12", default-features = false }
# wasm-related dependencies # wasm-related dependencies
gloo-utils = "0.2.0" gloo-utils = "0.2.0"
@@ -340,6 +345,7 @@ wasm-bindgen = "0.2.92"
wasm-bindgen-futures = "0.4.39" wasm-bindgen-futures = "0.4.39"
wasmtimer = "0.2.0" wasmtimer = "0.2.0"
web-sys = "0.3.69" web-sys = "0.3.69"
itertools = "0.12.0"
# Profile settings for individual crates # Profile settings for individual crates
@@ -356,9 +362,12 @@ opt-level = 'z'
# lto = true # lto = true
opt-level = 'z' opt-level = 'z'
[profile.release.package.nym-wasm-sdk] # Commented out since the crate is also commented out from the inclusion in the
# lto = true # workspace above. We should uncomment this if we re-include it in the
opt-level = 'z' # workspace
#[profile.release.package.nym-wasm-sdk]
## lto = true
#opt-level = 'z'
[profile.release.package.mix-fetch-wasm] [profile.release.package.mix-fetch-wasm]
# lto = true # lto = true
-1
View File
@@ -92,7 +92,6 @@ endef
$(eval $(call add_cargo_workspace,main,.)) $(eval $(call add_cargo_workspace,main,.))
$(eval $(call add_cargo_workspace,contracts,contracts,--lib --target wasm32-unknown-unknown,RUSTFLAGS='-C link-arg=-s')) $(eval $(call add_cargo_workspace,contracts,contracts,--lib --target wasm32-unknown-unknown,RUSTFLAGS='-C link-arg=-s'))
$(eval $(call add_cargo_workspace,wallet,nym-wallet)) $(eval $(call add_cargo_workspace,wallet,nym-wallet))
$(eval $(call add_cargo_workspace,connect,nym-connect/desktop))
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# SDK # SDK
+36 -56
View File
@@ -7,86 +7,66 @@ SPDX-License-Identifier: Apache-2.0
The platform is composed of multiple Rust crates. Top-level executable binary crates include: The platform is composed of multiple Rust crates. Top-level executable binary crates include:
* nym-mixnode - shuffles [Sphinx](https://github.com/nymtech/sphinx) packets together to provide privacy against network-level attackers. * `nym-node` - a tool for running a node within the Nym network. Nym Nodes containing functionality such as `mixnode`, `entry-gateway` and `exit-gateway` are fundamental components of Nym Mixnet architecture. Nym Nodes are ran by decentralised node operators. Read more about `nym-node` in [Operators Guide documentation](https://nymtech.net/operators/nodes/nym-node.html). Network functionality of `nym-node` (labeled with `--mode` flag) can be:
* nym-client - an executable which you can build into your own applications. Use it for interacting with Nym nodes. - `mixnode` - shuffles [Sphinx](https://github.com/nymtech/sphinx) packets together to provide privacy against network-level attackers.
* nym-socks5-client - a Socks5 proxy you can run on your machine and use with existing applications. - `gateway` - acts sort of like a mailbox for mixnet messages, which removes the need for direct delivery to potentially offline or firewalled devices. Gateways can be further categorized as `entry-gateway` and `exit-gateway`. The latter has an extra embedded IP packet router and Network requester to route data to the internet.
* nym-gateway - acts sort of like a mailbox for mixnet messages, which removes the need for direct delivery to potentially offline or firewalled devices. * `nym-client` - an executable which you can build into your own applications. Use it for interacting with Nym nodes.
* 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-socks5-client` - a Socks5 proxy you can run on your machine and use with existing applications.
* nym-explorer - a (projected) block explorer and (existing) mixnet viewer. * `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. * `nym-wallet` - a desktop wallet implemented using the [Tauri](https://tauri.studio/en/docs/about/intro) framework.
<!-- coming soon
* `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").
-->
```ascii
┌─►mix──┐ mix mix
│ │
Entry │ │ Exit
client ───► Gateway ──┘ mix │ mix ┌─►mix ───► Gateway ───► internet
│ │
│ │
mix └─►mix──┘ mix
```
[![Build Status](https://img.shields.io/github/actions/workflow/status/nymtech/nym/build.yml?branch=develop&style=for-the-badge&logo=github-actions)](https://github.com/nymtech/nym/actions?query=branch%3Adevelop) [![Build Status](https://img.shields.io/github/actions/workflow/status/nymtech/nym/build.yml?branch=develop&style=for-the-badge&logo=github-actions)](https://github.com/nymtech/nym/actions?query=branch%3Adevelop)
### Building ### Building
Platform build instructions are available on [our docs site](https://nymtech.net/docs/binaries/pre-built-binaries.html). * Platform build instructions are available on Nym [Operators Guide documentation](https://nymtech.net/operators/binaries/building-nym.html).
Wallet build instructions are also available on [our docs site](https://nymtech.net/docs/wallet/desktop-wallet.html). * Wallet build instructions are available on Nym [Technical docs](https://nymtech.net/docs/wallet/desktop-wallet.html).
### Developing ### 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. There's a [`sandbox.env`](https://github.com/nymtech/nym/envs/sandbox.env) file provided which you can rename to `.env` if you want convenient testing environment. Read more about sandbox environment in our [Operators Guide page](https://nymtech.net/operators/sandbox.html).
For Typescript components, please see [ts-packages](./ts-packages). References for developers:
* [Developers Portal](https://nymtech.net/developers)
* [Typescript SDKs](https://sdk.nymtech.net/)
* [Technical Documentation - Nym network overview](https://nymtech.net/docs/)
* [Release Cycle - git flow](https://nymtech.net/operators/release-cycle.html)
### Developer chat ### Developer chat
> We used to use Keybase for developer chats, but we have since migrated to Matrix and Discord. We no longer check the old **nymtech.friends** Keybase team.
You can chat to us in two places: You can chat to us in two places:
* The #dev channel on [Matrix](https://matrix.to/#/#dev:nymtech.chat) * The #dev channel on [Matrix](https://matrix.to/#/#dev:nymtech.chat)
* The various developer channels on [Discord](https://discord.gg/nym) * The various developer channels on [Discord](https://nymtech.net/go/discord)
### Rewards ### Tokenomics & 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. Nym network economic incentives, operator and validator rewards, and scalability of the network are determined according to the principles laid out in the section 6 of [Nym Whitepaper](https://nymtech.net/nym-whitepaper.pdf).
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#gh-light-mode-only"><img src="https://render.githubusercontent.com/render/math?math=\color{white}R#gh-dark-mode-only">|global share of rewards available, starts at 2% of the reward pool.
|<img src="https://render.githubusercontent.com/render/math?math=R_{i}#gh-light-mode-only"><img src="https://render.githubusercontent.com/render/math?math=\color{white}R_{i}#gh-dark-mode-only">|node reward for mixnode `i`.
|<img src="https://render.githubusercontent.com/render/math?math=\sigma_{i}#gh-light-mode-only"><img src="https://render.githubusercontent.com/render/math?math=\color{white}\sigma_{i}#gh-dark-mode-only">|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}#gh-light-mode-only"><img src="https://render.githubusercontent.com/render/math?math=\color{white}\lambda_{i}#gh-dark-mode-only">|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}#gh-light-mode-only"><img src="https://render.githubusercontent.com/render/math?math=\color{white}\omega_{i}#gh-dark-mode-only">|fraction of total effort undertaken by node `i`, set to `1/k`.
|<img src="https://render.githubusercontent.com/render/math?math=k#gh-light-mode-only"><img src="https://render.githubusercontent.com/render/math?math=\color{white}k#gh-dark-mode-only">|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#gh-light-mode-only"><img src="https://render.githubusercontent.com/render/math?math=\color{white}\alpha#gh-dark-mode-only">|A Sybil attack resistance parameter - the higher this parameter is set, the stronger the reduction in competitiveness for a Sybil attacker.
|<img src="https://render.githubusercontent.com/render/math?math=PM_{i}#gh-light-mode-only"><img src="https://render.githubusercontent.com/render/math?math=\color{white}PM_{i}#gh-dark-mode-only">|declared profit margin of operator `i`, defaults to 10%.
|<img src="https://render.githubusercontent.com/render/math?math=PF_{i}#gh-light-mode-only"><img src="https://render.githubusercontent.com/render/math?math=\color{white}PF_{i}#gh-dark-mode-only">|uptime of node `i`, scaled to 0 - 1, for the rewarding epoch
|<img src="https://render.githubusercontent.com/render/math?math=PP_{i}#gh-light-mode-only"><img src="https://render.githubusercontent.com/render/math?math=\color{white}PP_{i}#gh-dark-mode-only">|cost of operating node `i` for the duration of the rewarding epoch, set to 40 NYMs.
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)#gh-light-mode-only">
<img src="https://render.githubusercontent.com/render/math?math=\color{white}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)#gh-dark-mode-only">
where:
<img src="https://render.githubusercontent.com/render/math?math=\sigma^'_{i} = min\{\sigma_{i}, 1/k\}#gh-light-mode-only">
<img src="https://render.githubusercontent.com/render/math?math=\color{white}\sigma^'_{i} = min\{\sigma_{i}, 1/k\}#gh-dark-mode-only">
and
<img src="https://render.githubusercontent.com/render/math?math=\lambda^'_{i} = min\{\lambda_{i}, 1/k\}#gh-light-mode-only">
<img src="https://render.githubusercontent.com/render/math?math=\color{white}\lambda^'_{i} = min\{\lambda_{i}, 1/k\}#gh-dark-mode-only">
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})\}#gh-light-mode-only">
<img src="https://render.githubusercontent.com/render/math?math=\color{white}min\{PP_{i},R_{i})\} %2b max\{0, (PM_{i} %2b (1 - PM_{i}) \cdot \lambda_{i}/\delta_{i}) \cdot (R_{i} - PP_{i})\}#gh-dark-mode-only">
Delegate with stake `s` receives:
<img src="https://render.githubusercontent.com/render/math?math=max\{0, (1-PM_{i}) \cdot (s^'/\sigma_{i}) \cdot (R_{i} - PP_{i})\}#gh-light-mode-only">
<img src="https://render.githubusercontent.com/render/math?math=\color{white}max\{0, (1-PM_{i}) \cdot (s^'/\sigma_{i}) \cdot (R_{i} - PP_{i})\}#gh-dark-mode-only">
where `s'` is stake `s` scaled over total token circulating supply.
### Licensing and copyright information ### Licensing and copyright information
This is a monorepo and components that make up Nym as a system are licensed individually, so for accurate information, please check individual files. This is a monorepo and components that make up Nym as a system are licensed individually, so for accurate information, please check individual files.
As a general approach, licensing is as follows this pattern: As a general approach, licensing is as follows this pattern:
- applications and binaries are GPLv3 - applications and binaries are GPLv3
- libraries and components are Apache 2.0 or MIT - libraries and components are Apache 2.0 or MIT
- documentation is Apache 2.0 or CC0-1.0 - documentation is Apache 2.0 or CC0-1.0
Again, for accurate information, please check individual files. Nym Node Operators and Validators Temrs and Conditions can be found [here](https://nymtech.net/terms-and-conditions/operators/v1.0.0).
+3 -3
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "nym-client" name = "nym-client"
version = "1.1.35" version = "1.1.38"
authors = ["Dave Hrycyszyn <futurechimp@users.noreply.github.com>", "Jędrzej Stuczyński <andrew@nymtech.net>"] authors = ["Dave Hrycyszyn <futurechimp@users.noreply.github.com>", "Jędrzej Stuczyński <andrew@nymtech.net>"]
description = "Implementation of the Nym Client" description = "Implementation of the Nym Client"
edition = "2021" edition = "2021"
@@ -23,7 +23,7 @@ url = { workspace = true }
bs58 = { workspace = true } bs58 = { workspace = true }
clap = { workspace = true, features = ["cargo", "derive"] } clap = { workspace = true, features = ["cargo", "derive"] }
dirs = "4.0" dirs = { workspace = true }
log = { workspace = true } # self explanatory log = { workspace = true } # self explanatory
rand = { workspace = true } rand = { workspace = true }
serde = { workspace = true, features = ["derive"] } # for config serialization/deserialization serde = { workspace = true, features = ["derive"] } # for config serialization/deserialization
@@ -37,7 +37,7 @@ zeroize = { workspace = true }
## internal ## internal
nym-bandwidth-controller = { path = "../../common/bandwidth-controller" } nym-bandwidth-controller = { path = "../../common/bandwidth-controller" }
nym-bin-common = { path = "../../common/bin-common", features = ["output_format"] } nym-bin-common = { path = "../../common/bin-common", features = ["output_format", "clap"] }
nym-client-core = { path = "../../common/client-core", features = ["fs-surb-storage", "fs-gateways-storage", "cli"] } nym-client-core = { path = "../../common/client-core", features = ["fs-surb-storage", "fs-gateways-storage", "cli"] }
nym-config = { path = "../../common/config" } nym-config = { path = "../../common/config" }
nym-credential-storage = { path = "../../common/credential-storage" } nym-credential-storage = { path = "../../common/credential-storage" }
+78 -236
View File
@@ -744,6 +744,18 @@
"concat-map": "0.0.1" "concat-map": "0.0.1"
} }
}, },
"node_modules/braces": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz",
"integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==",
"dev": true,
"dependencies": {
"fill-range": "^7.1.1"
},
"engines": {
"node": ">=8"
}
},
"node_modules/browserslist": { "node_modules/browserslist": {
"version": "4.20.2", "version": "4.20.2",
"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.20.2.tgz", "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.20.2.tgz",
@@ -862,51 +874,6 @@
"fsevents": "~2.3.2" "fsevents": "~2.3.2"
} }
}, },
"node_modules/chokidar/node_modules/braces": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
"integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
"dev": true,
"dependencies": {
"fill-range": "^7.0.1"
},
"engines": {
"node": ">=8"
}
},
"node_modules/chokidar/node_modules/fill-range": {
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
"integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
"dev": true,
"dependencies": {
"to-regex-range": "^5.0.1"
},
"engines": {
"node": ">=8"
}
},
"node_modules/chokidar/node_modules/is-number": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
"integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
"dev": true,
"engines": {
"node": ">=0.12.0"
}
},
"node_modules/chokidar/node_modules/to-regex-range": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
"integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
"dev": true,
"dependencies": {
"is-number": "^7.0.0"
},
"engines": {
"node": ">=8.0"
}
},
"node_modules/chrome-trace-event": { "node_modules/chrome-trace-event": {
"version": "1.0.3", "version": "1.0.3",
"resolved": "https://registry.npmjs.org/chrome-trace-event/-/chrome-trace-event-1.0.3.tgz", "resolved": "https://registry.npmjs.org/chrome-trace-event/-/chrome-trace-event-1.0.3.tgz",
@@ -1593,39 +1560,6 @@
"node": ">=8.6.0" "node": ">=8.6.0"
} }
}, },
"node_modules/fast-glob/node_modules/braces": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
"integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
"dev": true,
"dependencies": {
"fill-range": "^7.0.1"
},
"engines": {
"node": ">=8"
}
},
"node_modules/fast-glob/node_modules/fill-range": {
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
"integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
"dev": true,
"dependencies": {
"to-regex-range": "^5.0.1"
},
"engines": {
"node": ">=8"
}
},
"node_modules/fast-glob/node_modules/is-number": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
"integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
"dev": true,
"engines": {
"node": ">=0.12.0"
}
},
"node_modules/fast-glob/node_modules/micromatch": { "node_modules/fast-glob/node_modules/micromatch": {
"version": "4.0.4", "version": "4.0.4",
"resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.4.tgz", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.4.tgz",
@@ -1639,18 +1573,6 @@
"node": ">=8.6" "node": ">=8.6"
} }
}, },
"node_modules/fast-glob/node_modules/to-regex-range": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
"integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
"dev": true,
"dependencies": {
"is-number": "^7.0.0"
},
"engines": {
"node": ">=8.0"
}
},
"node_modules/fast-json-stable-stringify": { "node_modules/fast-json-stable-stringify": {
"version": "2.1.0", "version": "2.1.0",
"resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz",
@@ -1683,6 +1605,18 @@
"node": ">=0.8.0" "node": ">=0.8.0"
} }
}, },
"node_modules/fill-range": {
"version": "7.1.1",
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz",
"integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==",
"dev": true,
"dependencies": {
"to-regex-range": "^5.0.1"
},
"engines": {
"node": ">=8"
}
},
"node_modules/finalhandler": { "node_modules/finalhandler": {
"version": "1.2.0", "version": "1.2.0",
"resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz", "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz",
@@ -2137,39 +2071,6 @@
} }
} }
}, },
"node_modules/http-proxy-middleware/node_modules/braces": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
"integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
"dev": true,
"dependencies": {
"fill-range": "^7.0.1"
},
"engines": {
"node": ">=8"
}
},
"node_modules/http-proxy-middleware/node_modules/fill-range": {
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
"integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
"dev": true,
"dependencies": {
"to-regex-range": "^5.0.1"
},
"engines": {
"node": ">=8"
}
},
"node_modules/http-proxy-middleware/node_modules/is-number": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
"integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
"dev": true,
"engines": {
"node": ">=0.12.0"
}
},
"node_modules/http-proxy-middleware/node_modules/micromatch": { "node_modules/http-proxy-middleware/node_modules/micromatch": {
"version": "4.0.4", "version": "4.0.4",
"resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.4.tgz", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.4.tgz",
@@ -2183,18 +2084,6 @@
"node": ">=8.6" "node": ">=8.6"
} }
}, },
"node_modules/http-proxy-middleware/node_modules/to-regex-range": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
"integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
"dev": true,
"dependencies": {
"is-number": "^7.0.0"
},
"engines": {
"node": ">=8.0"
}
},
"node_modules/human-signals": { "node_modules/human-signals": {
"version": "2.1.0", "version": "2.1.0",
"resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz",
@@ -2361,6 +2250,15 @@
"node": ">=0.10.0" "node": ">=0.10.0"
} }
}, },
"node_modules/is-number": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
"integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
"dev": true,
"engines": {
"node": ">=0.12.0"
}
},
"node_modules/is-path-cwd": { "node_modules/is-path-cwd": {
"version": "2.2.0", "version": "2.2.0",
"resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-2.2.0.tgz", "resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-2.2.0.tgz",
@@ -3853,6 +3751,18 @@
"integrity": "sha512-eHY7nBftgThBqOyHGVN+l8gF0BucP09fMo0oO/Lb0w1OF80dJv+lDVpXG60WMQvkcxAkNybKsrEIE3ZtKGmPrA==", "integrity": "sha512-eHY7nBftgThBqOyHGVN+l8gF0BucP09fMo0oO/Lb0w1OF80dJv+lDVpXG60WMQvkcxAkNybKsrEIE3ZtKGmPrA==",
"dev": true "dev": true
}, },
"node_modules/to-regex-range": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
"integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
"dev": true,
"dependencies": {
"is-number": "^7.0.0"
},
"engines": {
"node": ">=8.0"
}
},
"node_modules/toidentifier": { "node_modules/toidentifier": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
@@ -5213,6 +5123,15 @@
"concat-map": "0.0.1" "concat-map": "0.0.1"
} }
}, },
"braces": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz",
"integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==",
"dev": true,
"requires": {
"fill-range": "^7.1.1"
}
},
"browserslist": { "browserslist": {
"version": "4.20.2", "version": "4.20.2",
"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.20.2.tgz", "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.20.2.tgz",
@@ -5283,41 +5202,6 @@
"is-glob": "~4.0.1", "is-glob": "~4.0.1",
"normalize-path": "~3.0.0", "normalize-path": "~3.0.0",
"readdirp": "~3.6.0" "readdirp": "~3.6.0"
},
"dependencies": {
"braces": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
"integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
"dev": true,
"requires": {
"fill-range": "^7.0.1"
}
},
"fill-range": {
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
"integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
"dev": true,
"requires": {
"to-regex-range": "^5.0.1"
}
},
"is-number": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
"integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
"dev": true
},
"to-regex-range": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
"integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
"dev": true,
"requires": {
"is-number": "^7.0.0"
}
}
} }
}, },
"chrome-trace-event": { "chrome-trace-event": {
@@ -5852,30 +5736,6 @@
"micromatch": "^4.0.4" "micromatch": "^4.0.4"
}, },
"dependencies": { "dependencies": {
"braces": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
"integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
"dev": true,
"requires": {
"fill-range": "^7.0.1"
}
},
"fill-range": {
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
"integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
"dev": true,
"requires": {
"to-regex-range": "^5.0.1"
}
},
"is-number": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
"integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
"dev": true
},
"micromatch": { "micromatch": {
"version": "4.0.4", "version": "4.0.4",
"resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.4.tgz", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.4.tgz",
@@ -5885,15 +5745,6 @@
"braces": "^3.0.1", "braces": "^3.0.1",
"picomatch": "^2.2.3" "picomatch": "^2.2.3"
} }
},
"to-regex-range": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
"integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
"dev": true,
"requires": {
"is-number": "^7.0.0"
}
} }
} }
}, },
@@ -5926,6 +5777,15 @@
"websocket-driver": ">=0.5.1" "websocket-driver": ">=0.5.1"
} }
}, },
"fill-range": {
"version": "7.1.1",
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz",
"integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==",
"dev": true,
"requires": {
"to-regex-range": "^5.0.1"
}
},
"finalhandler": { "finalhandler": {
"version": "1.2.0", "version": "1.2.0",
"resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz", "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz",
@@ -6247,30 +6107,6 @@
"micromatch": "^4.0.2" "micromatch": "^4.0.2"
}, },
"dependencies": { "dependencies": {
"braces": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
"integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
"dev": true,
"requires": {
"fill-range": "^7.0.1"
}
},
"fill-range": {
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
"integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
"dev": true,
"requires": {
"to-regex-range": "^5.0.1"
}
},
"is-number": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
"integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
"dev": true
},
"micromatch": { "micromatch": {
"version": "4.0.4", "version": "4.0.4",
"resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.4.tgz", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.4.tgz",
@@ -6280,15 +6116,6 @@
"braces": "^3.0.1", "braces": "^3.0.1",
"picomatch": "^2.2.3" "picomatch": "^2.2.3"
} }
},
"to-regex-range": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
"integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
"dev": true,
"requires": {
"is-number": "^7.0.0"
}
} }
} }
}, },
@@ -6407,6 +6234,12 @@
"is-extglob": "^2.1.1" "is-extglob": "^2.1.1"
} }
}, },
"is-number": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
"integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
"dev": true
},
"is-path-cwd": { "is-path-cwd": {
"version": "2.2.0", "version": "2.2.0",
"resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-2.2.0.tgz", "resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-2.2.0.tgz",
@@ -7524,6 +7357,15 @@
"integrity": "sha512-eHY7nBftgThBqOyHGVN+l8gF0BucP09fMo0oO/Lb0w1OF80dJv+lDVpXG60WMQvkcxAkNybKsrEIE3ZtKGmPrA==", "integrity": "sha512-eHY7nBftgThBqOyHGVN+l8gF0BucP09fMo0oO/Lb0w1OF80dJv+lDVpXG60WMQvkcxAkNybKsrEIE3ZtKGmPrA==",
"dev": true "dev": true
}, },
"to-regex-range": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
"integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
"dev": true,
"requires": {
"is-number": "^7.0.0"
}
},
"toidentifier": { "toidentifier": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
+3 -1
View File
@@ -106,8 +106,10 @@ impl SocketClient {
}; };
let storage = self.initialise_storage().await?; let storage = self.initialise_storage().await?;
let user_agent = nym_bin_common::bin_info!().into();
let mut base_client = BaseClientBuilder::new(&self.config.base, storage, dkg_query_client); let mut base_client = BaseClientBuilder::new(&self.config.base, storage, dkg_query_client)
.with_user_agent(user_agent);
if let Some(custom_mixnet) = &self.custom_mixnet { if let Some(custom_mixnet) = &self.custom_mixnet {
base_client = base_client.with_stored_topology(custom_mixnet)?; base_client = base_client.with_stored_topology(custom_mixnet)?;
+2 -1
View File
@@ -22,8 +22,9 @@ impl AsRef<CommonClientAddGatewayArgs> for Args {
} }
pub(crate) async fn execute(args: Args) -> Result<(), ClientError> { pub(crate) async fn execute(args: Args) -> Result<(), ClientError> {
let user_agent = nym_bin_common::bin_info!().into();
let output = args.output; let output = args.output;
let res = add_gateway::<CliNativeClient, _>(args).await?; let res = add_gateway::<CliNativeClient, _>(args, Some(user_agent)).await?;
println!("{}", output.format(&res)); println!("{}", output.format(&res));
Ok(()) Ok(())
+2 -1
View File
@@ -114,8 +114,9 @@ impl Display for InitResults {
pub(crate) async fn execute(args: Init) -> Result<(), ClientError> { pub(crate) async fn execute(args: Init) -> Result<(), ClientError> {
eprintln!("Initialising client..."); eprintln!("Initialising client...");
let user_agent = nym_bin_common::bin_info!().into();
let output = args.output; let output = args.output;
let res = initialise_client::<CliNativeClient>(args).await?; let res = initialise_client::<CliNativeClient>(args, Some(user_agent)).await?;
let init_results = InitResults::new(res); let init_results = InitResults::new(res);
println!("{}", output.format(&init_results)); println!("{}", output.format(&init_results));
+6 -5
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "nym-socks5-client" name = "nym-socks5-client"
version = "1.1.35" version = "1.1.38"
authors = ["Dave Hrycyszyn <futurechimp@users.noreply.github.com>"] authors = ["Dave Hrycyszyn <futurechimp@users.noreply.github.com>"]
description = "A SOCKS5 localhost proxy that converts incoming messages to Sphinx and sends them to a Nym address" description = "A SOCKS5 localhost proxy that converts incoming messages to Sphinx and sends them to a Nym address"
edition = "2021" edition = "2021"
@@ -25,17 +25,18 @@ zeroize = { workspace = true }
nym-bin-common = { path = "../../common/bin-common", features = ["output_format"] } nym-bin-common = { path = "../../common/bin-common", features = ["output_format"] }
nym-client-core = { path = "../../common/client-core", features = ["fs-surb-storage", "fs-gateways-storage", "cli"] } nym-client-core = { path = "../../common/client-core", features = ["fs-surb-storage", "fs-gateways-storage", "cli"] }
nym-config = { path = "../../common/config" } nym-config = { path = "../../common/config" }
nym-credential-storage = { path = "../../common/credential-storage" }
nym-credentials = { path = "../../common/credentials" } nym-credentials = { path = "../../common/credentials" }
nym-crypto = { path = "../../common/crypto" } nym-crypto = { path = "../../common/crypto" }
nym-gateway-requests = { path = "../../gateway/gateway-requests" } nym-gateway-requests = { path = "../../gateway/gateway-requests" }
nym-credential-storage = { path = "../../common/credential-storage" } nym-id = { path = "../../common/nym-id" }
nym-network-defaults = { path = "../../common/network-defaults" } nym-network-defaults = { path = "../../common/network-defaults" }
nym-sphinx = { path = "../../common/nymsphinx" }
nym-ordered-buffer = { path = "../../common/socks5/ordered-buffer" } nym-ordered-buffer = { path = "../../common/socks5/ordered-buffer" }
nym-pemstore = { path = "../../common/pemstore" } nym-pemstore = { path = "../../common/pemstore" }
nym-topology = { path = "../../common/topology" }
nym-socks5-client-core = { path = "../../common/socks5-client-core" } nym-socks5-client-core = { path = "../../common/socks5-client-core" }
nym-id = { path = "../../common/nym-id" } nym-sphinx = { path = "../../common/nymsphinx" }
nym-topology = { path = "../../common/topology" }
nym-validator-client = { path = "../../common/client-libs/validator-client", features = ["http-client"] }
[features] [features]
default = [] default = []
+2 -1
View File
@@ -22,8 +22,9 @@ impl AsRef<CommonClientAddGatewayArgs> for Args {
} }
pub(crate) async fn execute(args: Args) -> Result<(), Socks5ClientError> { pub(crate) async fn execute(args: Args) -> Result<(), Socks5ClientError> {
let user_agent = nym_bin_common::bin_info!().into();
let output = args.output; let output = args.output;
let res = add_gateway::<CliSocks5Client, _>(args).await?; let res = add_gateway::<CliSocks5Client, _>(args, Some(user_agent)).await?;
println!("{}", output.format(&res)); println!("{}", output.format(&res));
Ok(()) Ok(())
+2 -1
View File
@@ -129,8 +129,9 @@ impl Display for InitResults {
pub(crate) async fn execute(args: Init) -> Result<(), Socks5ClientError> { pub(crate) async fn execute(args: Init) -> Result<(), Socks5ClientError> {
eprintln!("Initialising client..."); eprintln!("Initialising client...");
let user_agent = nym_bin_common::bin_info!().into();
let output = args.output; let output = args.output;
let res = initialise_client::<CliSocks5Client>(args).await?; let res = initialise_client::<CliSocks5Client>(args, Some(user_agent)).await?;
let init_results = InitResults::new(res); let init_results = InitResults::new(res);
println!("{}", output.format(&init_results)); println!("{}", output.format(&init_results));
+9 -3
View File
@@ -116,7 +116,13 @@ pub(crate) async fn execute(args: Run) -> Result<(), Box<dyn std::error::Error +
let storage = let storage =
OnDiskPersistent::from_paths(config.storage_paths.common_paths, &config.core.base.debug) OnDiskPersistent::from_paths(config.storage_paths.common_paths, &config.core.base.debug)
.await?; .await?;
NymClient::new(config.core, storage, args.common_args.custom_mixnet) let user_agent = nym_bin_common::bin_info!().into();
.run_forever() NymClient::new(
.await config.core,
storage,
user_agent,
args.common_args.custom_mixnet,
)
.run_forever()
.await
} }
+17
View File
@@ -0,0 +1,17 @@
[package]
name = "nym-authenticator-requests"
version = "0.1.0"
authors.workspace = true
repository.workspace = true
homepage.workspace = true
documentation.workspace = true
edition.workspace = true
license.workspace = true
[dependencies]
bincode = { workspace = true }
rand = { workspace = true }
serde = { workspace = true, features = ["derive"] }
nym-sphinx = { path = "../nymsphinx" }
nym-wireguard-types = { path = "../wireguard-types" }
+13
View File
@@ -0,0 +1,13 @@
// Copyright 2024 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
pub mod v1;
pub const CURRENT_VERSION: u8 = 1;
fn make_bincode_serializer() -> impl bincode::Options {
use bincode::Options;
bincode::DefaultOptions::new()
.with_big_endian()
.with_varint_encoding()
}
@@ -0,0 +1,7 @@
// Copyright 2024 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
pub mod request;
pub mod response;
const VERSION: u8 = 1;
@@ -0,0 +1,84 @@
// Copyright 2024 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
use nym_sphinx::addressing::Recipient;
use nym_wireguard_types::{GatewayClient, InitMessage, PeerPublicKey};
use serde::{Deserialize, Serialize};
use crate::make_bincode_serializer;
use super::VERSION;
fn generate_random() -> u64 {
use rand::RngCore;
let mut rng = rand::rngs::OsRng;
rng.next_u64()
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct AuthenticatorRequest {
pub version: u8,
pub data: AuthenticatorRequestData,
pub reply_to: Recipient,
pub request_id: u64,
}
impl AuthenticatorRequest {
pub fn from_reconstructed_message(
message: &nym_sphinx::receiver::ReconstructedMessage,
) -> Result<Self, bincode::Error> {
use bincode::Options;
make_bincode_serializer().deserialize(&message.message)
}
pub fn new_initial_request(init_message: InitMessage, reply_to: Recipient) -> (Self, u64) {
let request_id = generate_random();
(
Self {
version: VERSION,
data: AuthenticatorRequestData::Initial(init_message),
reply_to,
request_id,
},
request_id,
)
}
pub fn new_final_request(gateway_client: GatewayClient, reply_to: Recipient) -> (Self, u64) {
let request_id = generate_random();
(
Self {
version: VERSION,
data: AuthenticatorRequestData::Final(gateway_client),
reply_to,
request_id,
},
request_id,
)
}
pub fn new_query_request(peer_public_key: PeerPublicKey, reply_to: Recipient) -> (Self, u64) {
let request_id = generate_random();
(
Self {
version: VERSION,
data: AuthenticatorRequestData::QueryBandwidth(peer_public_key),
reply_to,
request_id,
},
request_id,
)
}
pub fn to_bytes(&self) -> Result<Vec<u8>, bincode::Error> {
use bincode::Options;
make_bincode_serializer().serialize(self)
}
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub enum AuthenticatorRequestData {
Initial(InitMessage),
Final(GatewayClient),
QueryBandwidth(PeerPublicKey),
}
@@ -0,0 +1,119 @@
// Copyright 2024 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
use nym_sphinx::addressing::Recipient;
use nym_wireguard_types::registration::{RegistrationData, RegistredData, RemainingBandwidthData};
use serde::{Deserialize, Serialize};
use crate::make_bincode_serializer;
use super::VERSION;
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct AuthenticatorResponse {
pub version: u8,
pub data: AuthenticatorResponseData,
pub reply_to: Recipient,
}
impl AuthenticatorResponse {
pub fn new_pending_registration_success(
registration_data: RegistrationData,
request_id: u64,
reply_to: Recipient,
) -> Self {
Self {
version: VERSION,
data: AuthenticatorResponseData::PendingRegistration(PendingRegistrationResponse {
reply: registration_data,
reply_to,
request_id,
}),
reply_to,
}
}
pub fn new_registered(
registred_data: RegistredData,
reply_to: Recipient,
request_id: u64,
) -> Self {
Self {
version: VERSION,
data: AuthenticatorResponseData::Registered(RegisteredResponse {
reply: registred_data,
reply_to,
request_id,
}),
reply_to,
}
}
pub fn new_remaining_bandwidth(
remaining_bandwidth_data: Option<RemainingBandwidthData>,
reply_to: Recipient,
request_id: u64,
) -> Self {
Self {
version: VERSION,
data: AuthenticatorResponseData::RemainingBandwidth(RemainingBandwidthResponse {
reply: remaining_bandwidth_data,
reply_to,
request_id,
}),
reply_to,
}
}
pub fn recipient(&self) -> Recipient {
self.reply_to
}
pub fn to_bytes(&self) -> Result<Vec<u8>, bincode::Error> {
use bincode::Options;
make_bincode_serializer().serialize(self)
}
pub fn from_reconstructed_message(
message: &nym_sphinx::receiver::ReconstructedMessage,
) -> Result<Self, bincode::Error> {
use bincode::Options;
make_bincode_serializer().deserialize(&message.message)
}
pub fn id(&self) -> Option<u64> {
match &self.data {
AuthenticatorResponseData::PendingRegistration(response) => Some(response.request_id),
AuthenticatorResponseData::Registered(response) => Some(response.request_id),
AuthenticatorResponseData::RemainingBandwidth(response) => Some(response.request_id),
}
}
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub enum AuthenticatorResponseData {
PendingRegistration(PendingRegistrationResponse),
Registered(RegisteredResponse),
RemainingBandwidth(RemainingBandwidthResponse),
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct PendingRegistrationResponse {
pub request_id: u64,
pub reply_to: Recipient,
pub reply: RegistrationData,
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct RegisteredResponse {
pub request_id: u64,
pub reply_to: Recipient,
pub reply: RegistredData,
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct RemainingBandwidthResponse {
pub request_id: u64,
pub reply_to: Recipient,
pub reply: Option<RemainingBandwidthData>,
}
+13
View File
@@ -0,0 +1,13 @@
// Copyright 2024 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
// See other comments for other TaskStatus message enumds about abusing the Error trait when we
// should have a new trait for TaskStatus messages
#[derive(Debug, thiserror::Error)]
pub enum BandwidthStatusMessage {
#[error("remaining bandwidth: {0}")]
RemainingBandwidth(i64),
#[error("no bandwidth left")]
NoBandwidth,
}
+3
View File
@@ -14,8 +14,11 @@ use nym_validator_client::coconut::all_coconut_api_clients;
use nym_validator_client::nym_api::EpochId; use nym_validator_client::nym_api::EpochId;
use nym_validator_client::nyxd::contract_traits::DkgQueryClient; use nym_validator_client::nyxd::contract_traits::DkgQueryClient;
pub use event::BandwidthStatusMessage;
pub mod acquire; pub mod acquire;
pub mod error; pub mod error;
mod event;
mod utils; mod utils;
#[derive(Debug)] #[derive(Debug)]
+5 -4
View File
@@ -9,9 +9,9 @@ repository = { workspace = true }
[dependencies] [dependencies]
const-str = { workspace = true } const-str = { workspace = true }
clap = { workspace = true, features = ["derive"] } clap = { workspace = true, features = ["derive"], optional = true }
clap_complete = { workspace = true } clap_complete = { workspace = true, optional = true }
clap_complete_fig = { workspace = true } clap_complete_fig = { workspace = true, optional = true }
log = { workspace = true } log = { workspace = true }
pretty_env_logger = { workspace = true } pretty_env_logger = { workspace = true }
semver = "0.11" semver = "0.11"
@@ -34,7 +34,7 @@ vergen = { workspace = true, features = ["build", "git", "gitcl", "rustc", "carg
[features] [features]
default = [] default = []
openapi = ["utoipa"] openapi = ["utoipa"]
output_format = ["serde_json"] output_format = ["serde_json", "dep:clap"]
bin_info_schema = ["schemars"] bin_info_schema = ["schemars"]
basic_tracing = ["tracing-subscriber"] basic_tracing = ["tracing-subscriber"]
tracing = [ tracing = [
@@ -44,3 +44,4 @@ tracing = [
"tracing-opentelemetry", "tracing-opentelemetry",
"opentelemetry", "opentelemetry",
] ]
clap = [ "dep:clap", "dep:clap_complete", "dep:clap_complete_fig" ]
@@ -44,6 +44,10 @@ pub struct BinaryBuildInformation {
/// Provides the cargo debug mode that was used for the build. /// Provides the cargo debug mode that was used for the build.
// NOTE: keep the old name cargo_profile instead of cargo_debug for backwards compatibility // NOTE: keep the old name cargo_profile instead of cargo_debug for backwards compatibility
pub cargo_profile: &'static str, pub cargo_profile: &'static str,
// VERGEN_CARGO_TARGET_TRIPLE
/// Provides the cargo target triple that was used for the build.
pub cargo_triple: &'static str,
} }
impl BinaryBuildInformation { impl BinaryBuildInformation {
@@ -66,6 +70,7 @@ impl BinaryBuildInformation {
rustc_version: env!("VERGEN_RUSTC_SEMVER"), rustc_version: env!("VERGEN_RUSTC_SEMVER"),
rustc_channel: env!("VERGEN_RUSTC_CHANNEL"), rustc_channel: env!("VERGEN_RUSTC_CHANNEL"),
cargo_profile, cargo_profile,
cargo_triple: env!("VERGEN_CARGO_TARGET_TRIPLE"),
} }
} }
@@ -95,6 +100,7 @@ impl BinaryBuildInformation {
rustc_version: env!("VERGEN_RUSTC_SEMVER"), rustc_version: env!("VERGEN_RUSTC_SEMVER"),
rustc_channel: env!("VERGEN_RUSTC_CHANNEL"), rustc_channel: env!("VERGEN_RUSTC_CHANNEL"),
cargo_profile, cargo_profile,
cargo_triple: env!("VERGEN_CARGO_TARGET_TRIPLE"),
} }
} }
@@ -109,6 +115,7 @@ impl BinaryBuildInformation {
rustc_version: self.rustc_version.to_owned(), rustc_version: self.rustc_version.to_owned(),
rustc_channel: self.rustc_channel.to_owned(), rustc_channel: self.rustc_channel.to_owned(),
cargo_profile: self.cargo_profile.to_owned(), cargo_profile: self.cargo_profile.to_owned(),
cargo_triple: self.cargo_triple.to_owned(),
} }
} }
@@ -156,6 +163,15 @@ pub struct BinaryBuildInformationOwned {
/// Provides the cargo debug mode that was used for the build. /// Provides the cargo debug mode that was used for the build.
// NOTE: keep the old name cargo_profile instead of cargo_debug for backwards compatibility // NOTE: keep the old name cargo_profile instead of cargo_debug for backwards compatibility
pub cargo_profile: String, pub cargo_profile: String,
// VERGEN_CARGO_TARGET_TRIPLE
/// Provides the cargo target triple that was used for the build.
#[serde(default = "unknown")]
pub cargo_triple: String,
}
fn unknown() -> String {
"unknown".to_string()
} }
impl Display for BinaryBuildInformationOwned { impl Display for BinaryBuildInformationOwned {
+3 -1
View File
@@ -2,9 +2,11 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
pub mod build_information; pub mod build_information;
pub mod completions;
pub mod logging; pub mod logging;
pub mod version_checker; pub mod version_checker;
#[cfg(feature = "clap")]
pub mod completions;
#[cfg(feature = "output_format")] #[cfg(feature = "output_format")]
pub mod output_format; pub mod output_format;
+2 -2
View File
@@ -10,7 +10,7 @@ license.workspace = true
[dependencies] [dependencies]
async-trait = { workspace = true } async-trait = { workspace = true }
base64 = "0.21.2" base64 = { workspace = true }
bs58 = { workspace = true } bs58 = { workspace = true }
cfg-if = { workspace = true } cfg-if = { workspace = true }
clap = { workspace = true, optional = true } clap = { workspace = true, optional = true }
@@ -20,7 +20,7 @@ log = { workspace = true }
rand = { workspace = true } rand = { workspace = true }
serde = { workspace = true, features = ["derive"] } serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true } serde_json = { workspace = true }
sha2 = "0.10.6" sha2 = { workspace = true }
si-scale = { workspace = true } si-scale = { workspace = true }
tap = { workspace = true } tap = { workspace = true }
thiserror = { workspace = true } thiserror = { workspace = true }
@@ -24,6 +24,11 @@ const DEFAULT_MESSAGE_STREAM_AVERAGE_DELAY: Duration = Duration::from_millis(20)
const DEFAULT_AVERAGE_PACKET_DELAY: Duration = Duration::from_millis(50); 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_REFRESH_RATE: Duration = Duration::from_secs(5 * 60); // every 5min
const DEFAULT_TOPOLOGY_RESOLUTION_TIMEOUT: Duration = Duration::from_millis(5_000); const DEFAULT_TOPOLOGY_RESOLUTION_TIMEOUT: Duration = Duration::from_millis(5_000);
// the same values as our current (10.06.24) blacklist
const DEFAULT_MIN_MIXNODE_PERFORMANCE: u8 = 50;
const DEFAULT_MIN_GATEWAY_PERFORMANCE: u8 = 50;
const DEFAULT_MAX_STARTUP_GATEWAY_WAITING_PERIOD: Duration = Duration::from_secs(70 * 60); // 70min -> full epoch (1h) + a bit of overhead const DEFAULT_MAX_STARTUP_GATEWAY_WAITING_PERIOD: Duration = Duration::from_secs(70 * 60); // 70min -> full epoch (1h) + a bit of overhead
// Set this to a high value for now, so that we don't risk sporadic timeouts that might cause // Set this to a high value for now, so that we don't risk sporadic timeouts that might cause
@@ -516,6 +521,14 @@ pub struct Topology {
/// Specifies the mixnode topology to be used for sending packets. /// Specifies the mixnode topology to be used for sending packets.
pub topology_structure: TopologyStructure, pub topology_structure: TopologyStructure,
/// Specifies a minimum performance of a mixnode that is used on route construction.
/// This setting is only applicable when `NymApi` topology is used.
pub minimum_mixnode_performance: u8,
/// Specifies a minimum performance of a gateway that is used on route construction.
/// This setting is only applicable when `NymApi` topology is used.
pub minimum_gateway_performance: u8,
} }
#[allow(clippy::large_enum_variant)] #[allow(clippy::large_enum_variant)]
@@ -550,6 +563,8 @@ impl Default for Topology {
disable_refreshing: false, disable_refreshing: false,
max_startup_gateway_waiting_period: DEFAULT_MAX_STARTUP_GATEWAY_WAITING_PERIOD, max_startup_gateway_waiting_period: DEFAULT_MAX_STARTUP_GATEWAY_WAITING_PERIOD,
topology_structure: TopologyStructure::default(), topology_structure: TopologyStructure::default(),
minimum_mixnode_performance: DEFAULT_MIN_MIXNODE_PERFORMANCE,
minimum_gateway_performance: DEFAULT_MIN_GATEWAY_PERFORMANCE,
} }
} }
} }
@@ -146,6 +146,7 @@ impl From<ConfigV5> for Config {
.topology .topology
.max_startup_gateway_waiting_period, .max_startup_gateway_waiting_period,
topology_structure: value.debug.topology.topology_structure.into(), topology_structure: value.debug.topology.topology_structure.into(),
..Default::default()
}, },
reply_surbs: ReplySurbs { reply_surbs: ReplySurbs {
minimum_reply_surb_storage_threshold: value minimum_reply_surb_storage_threshold: value
@@ -0,0 +1,18 @@
/*
* Copyright 2024 - Nym Technologies SA <contact@nymtech.net>
* SPDX-License-Identifier: Apache-2.0
*/
CREATE TABLE remote_gateway_details_temp
(
gateway_id_bs58 TEXT NOT NULL UNIQUE PRIMARY KEY REFERENCES registered_gateway (gateway_id_bs58),
derived_aes128_ctr_blake3_hmac_keys_bs58 TEXT NOT NULL,
gateway_owner_address TEXT,
gateway_listener TEXT NOT NULL,
wg_tun_address TEXT
);
INSERT INTO remote_gateway_details_temp SELECT * FROM remote_gateway_details;
DROP TABLE remote_gateway_details;
ALTER TABLE remote_gateway_details_temp RENAME TO remote_gateway_details;
@@ -65,7 +65,7 @@ impl GatewayDetails {
pub fn new_remote( pub fn new_remote(
gateway_id: identity::PublicKey, gateway_id: identity::PublicKey,
derived_aes128_ctr_blake3_hmac_keys: Arc<SharedKeys>, derived_aes128_ctr_blake3_hmac_keys: Arc<SharedKeys>,
gateway_owner_address: AccountId, gateway_owner_address: Option<AccountId>,
gateway_listener: Url, gateway_listener: Url,
wg_tun_address: Option<Url>, wg_tun_address: Option<Url>,
) -> Self { ) -> Self {
@@ -170,7 +170,7 @@ pub struct RegisteredGateway {
pub struct RawRemoteGatewayDetails { pub struct RawRemoteGatewayDetails {
pub gateway_id_bs58: String, pub gateway_id_bs58: String,
pub derived_aes128_ctr_blake3_hmac_keys_bs58: String, pub derived_aes128_ctr_blake3_hmac_keys_bs58: String,
pub gateway_owner_address: String, pub gateway_owner_address: Option<String>,
pub gateway_listener: String, pub gateway_listener: String,
pub wg_tun_address: Option<String>, pub wg_tun_address: Option<String>,
} }
@@ -195,14 +195,19 @@ impl TryFrom<RawRemoteGatewayDetails> for RemoteGatewayDetails {
})?, })?,
); );
let gateway_owner_address = let gateway_owner_address = value
AccountId::from_str(&value.gateway_owner_address).map_err(|source| { .gateway_owner_address
BadGateway::MalformedGatewayOwnerAccountAddress { .as_ref()
gateway_id: value.gateway_id_bs58.clone(), .map(|raw_owner| {
raw_owner: value.gateway_owner_address.clone(), AccountId::from_str(raw_owner).map_err(|source| {
source, BadGateway::MalformedGatewayOwnerAccountAddress {
} gateway_id: value.gateway_id_bs58.clone(),
})?; raw_owner: raw_owner.clone(),
source,
}
})
})
.transpose()?;
let gateway_listener = Url::parse(&value.gateway_listener).map_err(|source| { let gateway_listener = Url::parse(&value.gateway_listener).map_err(|source| {
BadGateway::MalformedListener { BadGateway::MalformedListener {
@@ -241,7 +246,7 @@ impl<'a> From<&'a RemoteGatewayDetails> for RawRemoteGatewayDetails {
derived_aes128_ctr_blake3_hmac_keys_bs58: value derived_aes128_ctr_blake3_hmac_keys_bs58: value
.derived_aes128_ctr_blake3_hmac_keys .derived_aes128_ctr_blake3_hmac_keys
.to_base58_string(), .to_base58_string(),
gateway_owner_address: value.gateway_owner_address.to_string(), gateway_owner_address: value.gateway_owner_address.as_ref().map(|o| o.to_string()),
gateway_listener: value.gateway_listener.to_string(), gateway_listener: value.gateway_listener.to_string(),
wg_tun_address: value.wg_tun_address.as_ref().map(|addr| addr.to_string()), wg_tun_address: value.wg_tun_address.as_ref().map(|addr| addr.to_string()),
} }
@@ -256,7 +261,7 @@ pub struct RemoteGatewayDetails {
// the keys will be zeroized // the keys will be zeroized
pub derived_aes128_ctr_blake3_hmac_keys: Arc<SharedKeys>, pub derived_aes128_ctr_blake3_hmac_keys: Arc<SharedKeys>,
pub gateway_owner_address: AccountId, pub gateway_owner_address: Option<AccountId>,
pub gateway_listener: Url, pub gateway_listener: Url,
@@ -16,6 +16,7 @@ use log::info;
use nym_client_core_gateways_storage::GatewayDetails; use nym_client_core_gateways_storage::GatewayDetails;
use nym_crypto::asymmetric::identity; use nym_crypto::asymmetric::identity;
use nym_topology::NymTopology; use nym_topology::NymTopology;
use nym_validator_client::UserAgent;
use std::path::PathBuf; use std::path::PathBuf;
#[cfg_attr(feature = "cli", derive(clap::Args))] #[cfg_attr(feature = "cli", derive(clap::Args))]
@@ -60,7 +61,10 @@ pub struct CommonClientAddGatewayArgs {
pub custom_mixnet: Option<PathBuf>, pub custom_mixnet: Option<PathBuf>,
} }
pub async fn add_gateway<C, A>(args: A) -> Result<GatewayInfo, C::Error> pub async fn add_gateway<C, A>(
args: A,
user_agent: Option<UserAgent>,
) -> Result<GatewayInfo, C::Error>
where where
A: AsRef<CommonClientAddGatewayArgs>, A: AsRef<CommonClientAddGatewayArgs>,
C: CliClient, C: CliClient,
@@ -111,7 +115,8 @@ where
hardcoded_topology.get_gateways() hardcoded_topology.get_gateways()
} else { } else {
let mut rng = rand::thread_rng(); let mut rng = rand::thread_rng();
crate::init::helpers::current_gateways(&mut rng, &core.client.nym_api_urls).await? crate::init::helpers::current_gateways(&mut rng, &core.client.nym_api_urls, user_agent)
.await?
}; };
// since we're registering with a brand new gateway, // since we're registering with a brand new gateway,
@@ -16,6 +16,7 @@ use log::info;
use nym_client_core_gateways_storage::GatewayDetails; use nym_client_core_gateways_storage::GatewayDetails;
use nym_crypto::asymmetric::identity; use nym_crypto::asymmetric::identity;
use nym_topology::NymTopology; use nym_topology::NymTopology;
use nym_validator_client::UserAgent;
use rand::rngs::OsRng; use rand::rngs::OsRng;
use std::path::PathBuf; use std::path::PathBuf;
@@ -96,6 +97,7 @@ pub struct InitResultsWithConfig<T> {
pub async fn initialise_client<C>( pub async fn initialise_client<C>(
init_args: C::InitArgs, init_args: C::InitArgs,
user_agent: Option<UserAgent>,
) -> Result<InitResultsWithConfig<C::Config>, C::Error> ) -> Result<InitResultsWithConfig<C::Config>, C::Error>
where where
C: InitialisableClient, C: InitialisableClient,
@@ -163,7 +165,8 @@ where
hardcoded_topology.get_gateways() hardcoded_topology.get_gateways()
} else { } else {
let mut rng = rand::thread_rng(); let mut rng = rand::thread_rng();
crate::init::helpers::current_gateways(&mut rng, &core.client.nym_api_urls).await? crate::init::helpers::current_gateways(&mut rng, &core.client.nym_api_urls, user_agent)
.await?
}; };
let gateway_setup = GatewaySetup::New { let gateway_setup = GatewaySetup::New {
@@ -25,7 +25,7 @@ use crate::client::replies::reply_storage::{
}; };
use crate::client::topology_control::nym_api_provider::NymApiTopologyProvider; use crate::client::topology_control::nym_api_provider::NymApiTopologyProvider;
use crate::client::topology_control::{ use crate::client::topology_control::{
TopologyAccessor, TopologyRefresher, TopologyRefresherConfig, nym_api_provider, TopologyAccessor, TopologyRefresher, TopologyRefresherConfig,
}; };
use crate::config::{Config, DebugConfig}; use crate::config::{Config, DebugConfig};
use crate::error::ClientCoreError; use crate::error::ClientCoreError;
@@ -53,7 +53,7 @@ use nym_task::connections::{ConnectionCommandReceiver, ConnectionCommandSender,
use nym_task::{TaskClient, TaskHandle}; use nym_task::{TaskClient, TaskHandle};
use nym_topology::provider_trait::TopologyProvider; use nym_topology::provider_trait::TopologyProvider;
use nym_topology::HardcodedTopologyProvider; use nym_topology::HardcodedTopologyProvider;
use nym_validator_client::nyxd::contract_traits::DkgQueryClient; use nym_validator_client::{nyxd::contract_traits::DkgQueryClient, UserAgent};
use rand::rngs::OsRng; use rand::rngs::OsRng;
use std::fmt::Debug; use std::fmt::Debug;
use std::os::raw::c_int as RawFd; use std::os::raw::c_int as RawFd;
@@ -184,6 +184,7 @@ pub struct BaseClientBuilder<'a, C, S: MixnetClientStorage> {
custom_topology_provider: Option<Box<dyn TopologyProvider + Send + Sync>>, custom_topology_provider: Option<Box<dyn TopologyProvider + Send + Sync>>,
custom_gateway_transceiver: Option<Box<dyn GatewayTransceiver + Send>>, custom_gateway_transceiver: Option<Box<dyn GatewayTransceiver + Send>>,
shutdown: Option<TaskClient>, shutdown: Option<TaskClient>,
user_agent: Option<UserAgent>,
setup_method: GatewaySetup, setup_method: GatewaySetup,
} }
@@ -207,6 +208,7 @@ where
custom_topology_provider: None, custom_topology_provider: None,
custom_gateway_transceiver: None, custom_gateway_transceiver: None,
shutdown: None, shutdown: None,
user_agent: None,
setup_method: GatewaySetup::MustLoad { gateway_id: None }, setup_method: GatewaySetup::MustLoad { gateway_id: None },
} }
} }
@@ -250,6 +252,12 @@ where
self self
} }
#[must_use]
pub fn with_user_agent(mut self, user_agent: UserAgent) -> Self {
self.user_agent = Some(user_agent);
self
}
pub fn with_stored_topology<P: AsRef<Path>>( pub fn with_stored_topology<P: AsRef<Path>>(
mut self, mut self,
file: P, file: P,
@@ -388,7 +396,10 @@ where
let cfg = GatewayConfig::new( let cfg = GatewayConfig::new(
details.gateway_id, details.gateway_id,
Some(details.gateway_owner_address.to_string()), details
.gateway_owner_address
.as_ref()
.map(|o| o.to_string()),
gateway_listener, gateway_listener,
); );
GatewayClient::new( GatewayClient::new(
@@ -462,14 +473,20 @@ where
fn setup_topology_provider( fn setup_topology_provider(
custom_provider: Option<Box<dyn TopologyProvider + Send + Sync>>, custom_provider: Option<Box<dyn TopologyProvider + Send + Sync>>,
provider_from_config: config::TopologyStructure, config_topology: config::Topology,
nym_api_urls: Vec<Url>, nym_api_urls: Vec<Url>,
user_agent: Option<UserAgent>,
) -> Box<dyn TopologyProvider + Send + Sync> { ) -> Box<dyn TopologyProvider + Send + Sync> {
// if no custom provider was ... provided ..., create one using nym-api // if no custom provider was ... provided ..., create one using nym-api
custom_provider.unwrap_or_else(|| match provider_from_config { custom_provider.unwrap_or_else(|| match config_topology.topology_structure {
config::TopologyStructure::NymApi => Box::new(NymApiTopologyProvider::new( config::TopologyStructure::NymApi => Box::new(NymApiTopologyProvider::new(
nym_api_provider::Config {
min_mixnode_performance: config_topology.minimum_mixnode_performance,
min_gateway_performance: config_topology.minimum_gateway_performance,
},
nym_api_urls, nym_api_urls,
env!("CARGO_PKG_VERSION").to_string(), env!("CARGO_PKG_VERSION").to_string(),
user_agent,
)), )),
config::TopologyStructure::GeoAware(group_by) => { config::TopologyStructure::GeoAware(group_by) => {
Box::new(GeoAwareTopologyProvider::new( Box::new(GeoAwareTopologyProvider::new(
@@ -680,8 +697,9 @@ where
let topology_provider = Self::setup_topology_provider( let topology_provider = Self::setup_topology_provider(
self.custom_topology_provider.take(), self.custom_topology_provider.take(),
self.config.debug.topology.topology_structure, self.config.debug.topology,
self.config.get_nym_api_endpoints(), self.config.get_nym_api_endpoints(),
self.user_agent.clone(),
); );
// needs to be started as the first thing to block if required waiting for the gateway // needs to be started as the first thing to block if required waiting for the gateway
@@ -92,11 +92,11 @@ pub mod v1_1_33 {
message: format!("the stored gateway id was malformed: {err}"), message: format!("the stored gateway id was malformed: {err}"),
})?, })?,
derived_aes128_ctr_blake3_hmac_keys: Arc::new(gateway_shared_key), derived_aes128_ctr_blake3_hmac_keys: Arc::new(gateway_shared_key),
gateway_owner_address: gateway_owner.parse().map_err(|err| { gateway_owner_address: Some(gateway_owner.parse().map_err(|err| {
ClientCoreError::UpgradeFailure { ClientCoreError::UpgradeFailure {
message: format!("the stored gateway owner address was malformed: {err}"), message: format!("the stored gateway owner address was malformed: {err}"),
} }
})?, })?),
gateway_listener: gateway_listener.parse().map_err(|err| { gateway_listener: gateway_listener.parse().map_err(|err| {
ClientCoreError::UpgradeFailure { ClientCoreError::UpgradeFailure {
message: format!("the stored gateway listener address was malformed: {err}"), message: format!("the stored gateway listener address was malformed: {err}"),
@@ -2,14 +2,36 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
use async_trait::async_trait; use async_trait::async_trait;
use log::{error, warn}; use log::{debug, error, warn};
use nym_topology::provider_trait::TopologyProvider; use nym_topology::provider_trait::TopologyProvider;
use nym_topology::{nym_topology_from_detailed, NymTopology, NymTopologyError}; use nym_topology::{NymTopology, NymTopologyError};
use nym_validator_client::UserAgent;
use rand::prelude::SliceRandom; use rand::prelude::SliceRandom;
use rand::thread_rng; use rand::thread_rng;
use url::Url; use url::Url;
// the same values as our current (10.06.24) blacklist
pub const DEFAULT_MIN_MIXNODE_PERFORMANCE: u8 = 50;
pub const DEFAULT_MIN_GATEWAY_PERFORMANCE: u8 = 50;
pub(crate) struct Config {
pub(crate) min_mixnode_performance: u8,
pub(crate) min_gateway_performance: u8,
}
impl Default for Config {
fn default() -> Self {
// old values that decided on blacklist membership
Config {
min_mixnode_performance: DEFAULT_MIN_MIXNODE_PERFORMANCE,
min_gateway_performance: DEFAULT_MIN_GATEWAY_PERFORMANCE,
}
}
}
pub(crate) struct NymApiTopologyProvider { pub(crate) struct NymApiTopologyProvider {
config: Config,
validator_client: nym_validator_client::client::NymApiClient, validator_client: nym_validator_client::client::NymApiClient,
nym_api_urls: Vec<Url>, nym_api_urls: Vec<Url>,
@@ -18,13 +40,26 @@ pub(crate) struct NymApiTopologyProvider {
} }
impl NymApiTopologyProvider { impl NymApiTopologyProvider {
pub(crate) fn new(mut nym_api_urls: Vec<Url>, client_version: String) -> Self { pub(crate) fn new(
config: Config,
mut nym_api_urls: Vec<Url>,
client_version: String,
user_agent: Option<UserAgent>,
) -> Self {
nym_api_urls.shuffle(&mut thread_rng()); nym_api_urls.shuffle(&mut thread_rng());
NymApiTopologyProvider { let validator_client = if let Some(user_agent) = user_agent {
validator_client: nym_validator_client::client::NymApiClient::new( nym_validator_client::client::NymApiClient::new_with_user_agent(
nym_api_urls[0].clone(), nym_api_urls[0].clone(),
), user_agent,
)
} else {
nym_validator_client::client::NymApiClient::new(nym_api_urls[0].clone())
};
NymApiTopologyProvider {
config,
validator_client,
nym_api_urls, nym_api_urls,
client_version, client_version,
currently_used_api: 0, currently_used_api: 0,
@@ -61,7 +96,11 @@ impl NymApiTopologyProvider {
} }
async fn get_current_compatible_topology(&mut self) -> Option<NymTopology> { async fn get_current_compatible_topology(&mut self) -> Option<NymTopology> {
let mixnodes = match self.validator_client.get_cached_active_mixnodes().await { let mixnodes = match self
.validator_client
.get_basic_mixnodes(Some(self.client_version.clone()))
.await
{
Err(err) => { Err(err) => {
error!("failed to get network mixnodes - {err}"); error!("failed to get network mixnodes - {err}");
return None; return None;
@@ -69,7 +108,11 @@ impl NymApiTopologyProvider {
Ok(mixes) => mixes, Ok(mixes) => mixes,
}; };
let gateways = match self.validator_client.get_cached_described_gateways().await { let gateways = match self
.validator_client
.get_basic_gateways(Some(self.client_version.clone()))
.await
{
Err(err) => { Err(err) => {
error!("failed to get network gateways - {err}"); error!("failed to get network gateways - {err}");
return None; return None;
@@ -77,8 +120,20 @@ impl NymApiTopologyProvider {
Ok(gateways) => gateways, Ok(gateways) => gateways,
}; };
let topology = nym_topology_from_detailed(mixnodes, gateways) debug!(
.filter_system_version(&self.client_version); "there are {} mixnodes and {} gateways in total (before performance filtering)",
mixnodes.len(),
gateways.len()
);
let topology = NymTopology::from_unordered(
mixnodes.iter().filter(|m| {
m.performance.round_to_integer() >= self.config.min_mixnode_performance
}),
gateways.iter().filter(|g| {
g.performance.round_to_integer() >= self.config.min_gateway_performance
}),
);
if let Err(err) = self.check_layer_distribution(&topology) { if let Err(err) = self.check_layer_distribution(&topology) {
warn!("The current filtered active topology has extremely skewed layer distribution. It cannot be used: {err}"); warn!("The current filtered active topology has extremely skewed layer distribution. It cannot be used: {err}");
+7 -1
View File
@@ -9,6 +9,7 @@ use nym_crypto::asymmetric::identity;
use nym_gateway_client::GatewayClient; use nym_gateway_client::GatewayClient;
use nym_topology::{filter::VersionFilterable, gateway, mix}; use nym_topology::{filter::VersionFilterable, gateway, mix};
use nym_validator_client::client::IdentityKeyRef; use nym_validator_client::client::IdentityKeyRef;
use nym_validator_client::UserAgent;
use rand::{seq::SliceRandom, Rng}; use rand::{seq::SliceRandom, Rng};
use std::{sync::Arc, time::Duration}; use std::{sync::Arc, time::Duration};
use tungstenite::Message; use tungstenite::Message;
@@ -59,11 +60,16 @@ impl<'a> GatewayWithLatency<'a> {
pub async fn current_gateways<R: Rng>( pub async fn current_gateways<R: Rng>(
rng: &mut R, rng: &mut R,
nym_apis: &[Url], nym_apis: &[Url],
user_agent: Option<UserAgent>,
) -> Result<Vec<gateway::Node>, ClientCoreError> { ) -> Result<Vec<gateway::Node>, ClientCoreError> {
let nym_api = nym_apis let nym_api = nym_apis
.choose(rng) .choose(rng)
.ok_or(ClientCoreError::ListOfNymApisIsEmpty)?; .ok_or(ClientCoreError::ListOfNymApisIsEmpty)?;
let client = nym_validator_client::client::NymApiClient::new(nym_api.clone()); let client = if let Some(user_agent) = user_agent {
nym_validator_client::client::NymApiClient::new_with_user_agent(nym_api.clone(), user_agent)
} else {
nym_validator_client::client::NymApiClient::new(nym_api.clone())
};
log::debug!("Fetching list of gateways from: {nym_api}"); log::debug!("Fetching list of gateways from: {nym_api}");
+14 -8
View File
@@ -29,7 +29,7 @@ pub enum SelectedGateway {
Remote { Remote {
gateway_id: identity::PublicKey, gateway_id: identity::PublicKey,
gateway_owner_address: AccountId, gateway_owner_address: Option<AccountId>,
gateway_listener: Url, gateway_listener: Url,
@@ -84,13 +84,19 @@ impl SelectedGateway {
let wg_tun_address = wg_tun_address(wg_tun_ip_address, &node)?; let wg_tun_address = wg_tun_address(wg_tun_ip_address, &node)?;
let gateway_owner_address = AccountId::from_str(&node.owner).map_err(|source| { let gateway_owner_address = node
ClientCoreError::MalformedGatewayOwnerAccountAddress { .owner
gateway_id: node.identity_key.to_base58_string(), .as_ref()
raw_owner: node.owner, .map(|raw_owner| {
err: source.to_string(), AccountId::from_str(raw_owner).map_err(|source| {
} ClientCoreError::MalformedGatewayOwnerAccountAddress {
})?; gateway_id: node.identity_key.to_base58_string(),
raw_owner: raw_owner.clone(),
err: source.to_string(),
}
})
})
.transpose()?;
let gateway_listener = let gateway_listener =
Url::parse(&gateway_listener).map_err(|source| ClientCoreError::MalformedListener { Url::parse(&gateway_listener).map_err(|source| ClientCoreError::MalformedListener {
+15 -12
View File
@@ -11,7 +11,7 @@ use crate::traits::GatewayPacketRouter;
use crate::{cleanup_socket_message, try_decrypt_binary_message}; use crate::{cleanup_socket_message, try_decrypt_binary_message};
use futures::{SinkExt, StreamExt}; use futures::{SinkExt, StreamExt};
use log::*; use log::*;
use nym_bandwidth_controller::BandwidthController; use nym_bandwidth_controller::{BandwidthController, BandwidthStatusMessage};
use nym_credential_storage::ephemeral_storage::EphemeralStorage as EphemeralCredentialStorage; use nym_credential_storage::ephemeral_storage::EphemeralStorage as EphemeralCredentialStorage;
use nym_credential_storage::storage::Storage as CredentialStorage; use nym_credential_storage::storage::Storage as CredentialStorage;
use nym_credentials::CredentialSpendingData; use nym_credentials::CredentialSpendingData;
@@ -105,8 +105,8 @@ pub struct GatewayClient<C, St = EphemeralCredentialStorage> {
// currently unused (but populated) // currently unused (but populated)
negotiated_protocol: Option<u8>, negotiated_protocol: Option<u8>,
/// Listen to shutdown messages. /// Listen to shutdown messages and send notifications back to the task manager
shutdown: TaskClient, task_client: TaskClient,
} }
impl<C, St> GatewayClient<C, St> { impl<C, St> GatewayClient<C, St> {
@@ -117,7 +117,7 @@ impl<C, St> GatewayClient<C, St> {
shared_key: Option<Arc<SharedKeys>>, shared_key: Option<Arc<SharedKeys>>,
packet_router: PacketRouter, packet_router: PacketRouter,
bandwidth_controller: Option<BandwidthController<C, St>>, bandwidth_controller: Option<BandwidthController<C, St>>,
shutdown: TaskClient, task_client: TaskClient,
) -> Self { ) -> Self {
GatewayClient { GatewayClient {
authenticated: false, authenticated: false,
@@ -135,7 +135,7 @@ impl<C, St> GatewayClient<C, St> {
reconnection_attempts: DEFAULT_RECONNECTION_ATTEMPTS, reconnection_attempts: DEFAULT_RECONNECTION_ATTEMPTS,
reconnection_backoff: DEFAULT_RECONNECTION_BACKOFF, reconnection_backoff: DEFAULT_RECONNECTION_BACKOFF,
negotiated_protocol: None, negotiated_protocol: None,
shutdown, task_client,
} }
} }
@@ -299,7 +299,7 @@ impl<C, St> GatewayClient<C, St> {
loop { loop {
tokio::select! { tokio::select! {
_ = self.shutdown.recv() => { _ = self.task_client.recv() => {
log::trace!("GatewayClient control response: Received shutdown"); log::trace!("GatewayClient control response: Received shutdown");
log::debug!("GatewayClient control response: Exiting"); log::debug!("GatewayClient control response: Exiting");
break Err(GatewayClientError::ConnectionClosedGatewayShutdown); break Err(GatewayClientError::ConnectionClosedGatewayShutdown);
@@ -540,6 +540,9 @@ impl<C, St> GatewayClient<C, St> {
self.bandwidth_remaining = bandwidth_remaining; self.bandwidth_remaining = bandwidth_remaining;
self.negotiated_protocol = protocol_version; self.negotiated_protocol = protocol_version;
log::debug!("authenticated: {status}, bandwidth remaining: {bandwidth_remaining}"); log::debug!("authenticated: {status}, bandwidth remaining: {bandwidth_remaining}");
self.task_client.send_status_msg(Box::new(
BandwidthStatusMessage::RemainingBandwidth(bandwidth_remaining),
));
Ok(()) Ok(())
} }
ServerResponse::Error { message } => Err(GatewayClientError::GatewayError(message)), ServerResponse::Error { message } => Err(GatewayClientError::GatewayError(message)),
@@ -805,7 +808,7 @@ impl<C, St> GatewayClient<C, St> {
.as_ref() .as_ref()
.expect("no shared key present even though we're authenticated!"), .expect("no shared key present even though we're authenticated!"),
), ),
self.shutdown.clone(), self.task_client.clone(),
) )
} }
_ => unreachable!(), _ => unreachable!(),
@@ -879,8 +882,8 @@ impl GatewayClient<InitOnly, EphemeralCredentialStorage> {
// perfectly fine here, because it's not meant to be used // perfectly fine here, because it's not meant to be used
let (ack_tx, _) = mpsc::unbounded(); let (ack_tx, _) = mpsc::unbounded();
let (mix_tx, _) = mpsc::unbounded(); let (mix_tx, _) = mpsc::unbounded();
let shutdown = TaskClient::dummy(); let task_client = TaskClient::dummy();
let packet_router = PacketRouter::new(ack_tx, mix_tx, shutdown.clone()); let packet_router = PacketRouter::new(ack_tx, mix_tx, task_client.clone());
GatewayClient { GatewayClient {
authenticated: false, authenticated: false,
@@ -898,7 +901,7 @@ impl GatewayClient<InitOnly, EphemeralCredentialStorage> {
reconnection_attempts: DEFAULT_RECONNECTION_ATTEMPTS, reconnection_attempts: DEFAULT_RECONNECTION_ATTEMPTS,
reconnection_backoff: DEFAULT_RECONNECTION_BACKOFF, reconnection_backoff: DEFAULT_RECONNECTION_BACKOFF,
negotiated_protocol: None, negotiated_protocol: None,
shutdown, task_client,
} }
} }
@@ -906,7 +909,7 @@ impl GatewayClient<InitOnly, EphemeralCredentialStorage> {
self, self,
packet_router: PacketRouter, packet_router: PacketRouter,
bandwidth_controller: Option<BandwidthController<C, St>>, bandwidth_controller: Option<BandwidthController<C, St>>,
shutdown: TaskClient, task_client: TaskClient,
) -> GatewayClient<C, St> { ) -> GatewayClient<C, St> {
// invariants that can't be broken // invariants that can't be broken
// (unless somebody decided to expose some field that wasn't meant to be exposed) // (unless somebody decided to expose some field that wasn't meant to be exposed)
@@ -930,7 +933,7 @@ impl GatewayClient<InitOnly, EphemeralCredentialStorage> {
reconnection_attempts: self.reconnection_attempts, reconnection_attempts: self.reconnection_attempts,
reconnection_backoff: self.reconnection_backoff, reconnection_backoff: self.reconnection_backoff,
negotiated_protocol: self.negotiated_protocol, negotiated_protocol: self.negotiated_protocol,
shutdown, task_client,
} }
} }
} }
@@ -14,7 +14,6 @@ colored = { workspace = true }
nym-coconut-dkg-common = { path = "../../cosmwasm-smart-contracts/coconut-dkg" } nym-coconut-dkg-common = { path = "../../cosmwasm-smart-contracts/coconut-dkg" }
nym-contracts-common = { path = "../../cosmwasm-smart-contracts/contracts-common" } nym-contracts-common = { path = "../../cosmwasm-smart-contracts/contracts-common" }
nym-ephemera-common = { path = "../../cosmwasm-smart-contracts/ephemera" }
nym-mixnet-contract-common = { path = "../../cosmwasm-smart-contracts/mixnet-contract" } nym-mixnet-contract-common = { path = "../../cosmwasm-smart-contracts/mixnet-contract" }
nym-vesting-contract-common = { path = "../../cosmwasm-smart-contracts/vesting-contract" } nym-vesting-contract-common = { path = "../../cosmwasm-smart-contracts/vesting-contract" }
nym-coconut-bandwidth-contract-common = { path = "../../cosmwasm-smart-contracts/coconut-bandwidth-contract" } nym-coconut-bandwidth-contract-common = { path = "../../cosmwasm-smart-contracts/coconut-bandwidth-contract" }
@@ -22,7 +21,7 @@ nym-multisig-contract-common = { path = "../../cosmwasm-smart-contracts/multisig
nym-group-contract-common = { path = "../../cosmwasm-smart-contracts/group-contract" } nym-group-contract-common = { path = "../../cosmwasm-smart-contracts/group-contract" }
serde = { workspace = true, features = ["derive"] } serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true } serde_json = { workspace = true }
nym-http-api-client = { path = "../../../common/http-api-client"} nym-http-api-client = { path = "../../../common/http-api-client" }
thiserror = { workspace = true } thiserror = { workspace = true }
log = { workspace = true } log = { workspace = true }
url = { workspace = true, features = ["serde"] } url = { workspace = true, features = ["serde"] }
@@ -55,7 +54,7 @@ cw-controllers = { workspace = true }
prost = { workspace = true, default-features = false } prost = { workspace = true, default-features = false }
flate2 = { workspace = true } flate2 = { workspace = true }
sha2 = { version = "0.9.5" } sha2 = { version = "0.9.5" }
itertools = { version = "0.10" } itertools = { workspace = true }
zeroize = { workspace = true, features = ["zeroize_derive"] } zeroize = { workspace = true, features = ["zeroize_derive"] }
cosmwasm-std = { workspace = true } cosmwasm-std = { workspace = true }
@@ -18,6 +18,8 @@ use nym_api_requests::models::{
GatewayCoreStatusResponse, MixnodeCoreStatusResponse, MixnodeStatusResponse, GatewayCoreStatusResponse, MixnodeCoreStatusResponse, MixnodeStatusResponse,
RewardEstimationResponse, StakeSaturationResponse, RewardEstimationResponse, StakeSaturationResponse,
}; };
use nym_api_requests::nym_nodes::SkimmedNode;
use nym_http_api_client::UserAgent;
use nym_network_defaults::NymNetworkDetails; use nym_network_defaults::NymNetworkDetails;
use url::Url; use url::Url;
@@ -257,6 +259,16 @@ impl NymApiClient {
NymApiClient { nym_api } NymApiClient { nym_api }
} }
pub fn new_with_user_agent(api_url: Url, user_agent: UserAgent) -> Self {
let nym_api = nym_api::Client::builder::<_, ValidatorClientError>(api_url)
.expect("invalid api url")
.with_user_agent(user_agent)
.build::<ValidatorClientError>()
.expect("failed to build nym api client");
NymApiClient { nym_api }
}
pub fn api_url(&self) -> &Url { pub fn api_url(&self) -> &Url {
self.nym_api.current_url() self.nym_api.current_url()
} }
@@ -265,6 +277,28 @@ impl NymApiClient {
self.nym_api.change_base_url(new_endpoint); self.nym_api.change_base_url(new_endpoint);
} }
pub async fn get_basic_mixnodes(
&self,
semver_compatibility: Option<String>,
) -> Result<Vec<SkimmedNode>, ValidatorClientError> {
Ok(self
.nym_api
.get_basic_mixnodes(semver_compatibility)
.await?
.nodes)
}
pub async fn get_basic_gateways(
&self,
semver_compatibility: Option<String>,
) -> Result<Vec<SkimmedNode>, ValidatorClientError> {
Ok(self
.nym_api
.get_basic_gateways(semver_compatibility)
.await?
.nodes)
}
pub async fn get_cached_active_mixnodes( pub async fn get_cached_active_mixnodes(
&self, &self,
) -> Result<Vec<MixNodeDetails>, ValidatorClientError> { ) -> Result<Vec<MixNodeDetails>, ValidatorClientError> {
@@ -17,6 +17,7 @@ pub use crate::signing::direct_wallet::DirectSecp256k1HdWallet;
pub use client::NymApiClient; pub use client::NymApiClient;
pub use client::{Client, CoconutApiClient, Config}; pub use client::{Client, CoconutApiClient, Config};
pub use nym_api_requests::*; pub use nym_api_requests::*;
pub use nym_http_api_client::UserAgent;
#[cfg(feature = "http-client")] #[cfg(feature = "http-client")]
pub use cosmrs::rpc::HttpClient as HttpRpcClient; pub use cosmrs::rpc::HttpClient as HttpRpcClient;
@@ -31,6 +31,7 @@ pub mod routes;
use nym_api_requests::coconut::models::FreePassNonceResponse; use nym_api_requests::coconut::models::FreePassNonceResponse;
use nym_api_requests::coconut::FreePassRequest; use nym_api_requests::coconut::FreePassRequest;
use nym_api_requests::nym_nodes::{CachedNodesResponse, SkimmedNode};
pub use nym_http_api_client::Client; pub use nym_http_api_client::Client;
#[cfg_attr(target_arch = "wasm32", async_trait(?Send))] #[cfg_attr(target_arch = "wasm32", async_trait(?Send))]
@@ -95,6 +96,52 @@ pub trait NymApiClientExt: ApiClient {
.await .await
} }
async fn get_basic_mixnodes(
&self,
semver_compatibility: Option<String>,
) -> Result<CachedNodesResponse<SkimmedNode>, NymAPIError> {
let params = if let Some(semver_compatibility) = &semver_compatibility {
vec![("semver_compatibility", semver_compatibility.as_str())]
} else {
vec![]
};
self.get_json(
&[
routes::API_VERSION,
"unstable",
"nym-nodes",
"mixnodes",
"skimmed",
],
&params,
)
.await
}
async fn get_basic_gateways(
&self,
semver_compatibility: Option<String>,
) -> Result<CachedNodesResponse<SkimmedNode>, NymAPIError> {
let params = if let Some(semver_compatibility) = &semver_compatibility {
vec![("semver_compatibility", semver_compatibility.as_str())]
} else {
vec![]
};
self.get_json(
&[
routes::API_VERSION,
"unstable",
"nym-nodes",
"gateways",
"skimmed",
],
&params,
)
.await
}
async fn get_active_mixnodes(&self) -> Result<Vec<MixNodeDetails>, NymAPIError> { async fn get_active_mixnodes(&self) -> Result<Vec<MixNodeDetails>, NymAPIError> {
self.get_json( self.get_json(
&[routes::API_VERSION, routes::MIXNODES, routes::ACTIVE], &[routes::API_VERSION, routes::MIXNODES, routes::ACTIVE],
@@ -1,79 +0,0 @@
// Copyright 2022 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
use crate::collect_paged;
use crate::nyxd::contract_traits::NymContractsProvider;
use crate::nyxd::error::NyxdError;
use crate::nyxd::CosmWasmClient;
use async_trait::async_trait;
use nym_ephemera_common::msg::QueryMsg as EphemeraQueryMsg;
use nym_ephemera_common::peers::PagedPeerResponse;
use nym_ephemera_common::types::JsonPeerInfo;
use serde::Deserialize;
#[cfg_attr(target_arch = "wasm32", async_trait(?Send))]
#[cfg_attr(not(target_arch = "wasm32"), async_trait)]
pub trait EphemeraQueryClient {
async fn query_ephemera_contract<T>(&self, query: EphemeraQueryMsg) -> Result<T, NyxdError>
where
for<'a> T: Deserialize<'a>;
async fn get_peers_paged(
&self,
start_after: Option<String>,
limit: Option<u32>,
) -> Result<PagedPeerResponse, NyxdError> {
let request = EphemeraQueryMsg::GetPeers { start_after, limit };
self.query_ephemera_contract(request).await
}
}
// extension trait to the query client to deal with the paged queries
// (it didn't feel appropriate to combine it with the existing trait
#[cfg_attr(target_arch = "wasm32", async_trait(?Send))]
#[cfg_attr(not(target_arch = "wasm32"), async_trait)]
pub trait PagedEphemeraQueryClient: EphemeraQueryClient {
async fn get_all_ephemera_peers(&self) -> Result<Vec<JsonPeerInfo>, NyxdError> {
collect_paged!(self, get_peers_paged, peers)
}
}
#[async_trait]
impl<T> PagedEphemeraQueryClient for T where T: EphemeraQueryClient {}
#[cfg_attr(target_arch = "wasm32", async_trait(?Send))]
#[cfg_attr(not(target_arch = "wasm32"), async_trait)]
impl<C> EphemeraQueryClient for C
where
C: CosmWasmClient + NymContractsProvider + Send + Sync,
{
async fn query_ephemera_contract<T>(&self, query: EphemeraQueryMsg) -> Result<T, NyxdError>
where
for<'a> T: Deserialize<'a>,
{
let ephemera_contract_address = &self
.ephemera_contract_address()
.ok_or_else(|| NyxdError::unavailable_contract_address("ephemera contract"))?;
self.query_contract_smart(ephemera_contract_address, &query)
.await
}
}
#[cfg(test)]
mod tests {
use super::*;
use crate::nyxd::contract_traits::tests::IgnoreValue;
// it's enough that this compiles and clippy is happy about it
#[allow(dead_code)]
fn all_query_variants_are_covered<C: EphemeraQueryClient + Send + Sync>(
client: C,
msg: EphemeraQueryMsg,
) {
match msg {
EphemeraQueryMsg::GetPeers { limit, start_after } => {
client.get_peers_paged(start_after, limit).ignore()
}
};
}
}
@@ -1,86 +0,0 @@
// Copyright 2022 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
use crate::nyxd::contract_traits::NymContractsProvider;
use crate::nyxd::cosmwasm_client::types::ExecuteResult;
use crate::nyxd::error::NyxdError;
use crate::nyxd::{Coin, Fee, SigningCosmWasmClient};
use crate::signing::signer::OfflineSigner;
use async_trait::async_trait;
use nym_ephemera_common::msg::ExecuteMsg as EphemeraExecuteMsg;
use nym_ephemera_common::types::JsonPeerInfo;
#[cfg_attr(target_arch = "wasm32", async_trait(?Send))]
#[cfg_attr(not(target_arch = "wasm32"), async_trait)]
pub trait EphemeraSigningClient {
async fn execute_ephemera_contract(
&self,
fee: Option<Fee>,
msg: EphemeraExecuteMsg,
memo: String,
funds: Vec<Coin>,
) -> Result<ExecuteResult, NyxdError>;
async fn register_as_peer(
&self,
peer_info: JsonPeerInfo,
fee: Option<Fee>,
) -> Result<ExecuteResult, NyxdError> {
let req = EphemeraExecuteMsg::RegisterPeer { peer_info };
self.execute_ephemera_contract(fee, req, "registering as peer".to_string(), vec![])
.await
}
}
#[cfg_attr(target_arch = "wasm32", async_trait(?Send))]
#[cfg_attr(not(target_arch = "wasm32"), async_trait)]
impl<C> EphemeraSigningClient for C
where
C: SigningCosmWasmClient + NymContractsProvider + Sync,
NyxdError: From<<Self as OfflineSigner>::Error>,
{
async fn execute_ephemera_contract(
&self,
fee: Option<Fee>,
msg: EphemeraExecuteMsg,
memo: String,
funds: Vec<Coin>,
) -> Result<ExecuteResult, NyxdError> {
let ephemera_contract_address = self
.ephemera_contract_address()
.ok_or_else(|| NyxdError::unavailable_contract_address("ephemera contract"))?;
let fee = fee.unwrap_or(Fee::Auto(Some(self.simulated_gas_multiplier())));
let signer_address = &self.signer_addresses()?[0];
self.execute(
signer_address,
ephemera_contract_address,
&msg,
fee,
memo,
funds,
)
.await
}
}
#[cfg(test)]
mod tests {
use super::*;
use crate::nyxd::contract_traits::tests::IgnoreValue;
// it's enough that this compiles and clippy is happy about it
#[allow(dead_code)]
fn all_execute_variants_are_covered<C: EphemeraSigningClient + Send + Sync>(
client: C,
msg: EphemeraExecuteMsg,
) {
match msg {
EphemeraExecuteMsg::RegisterPeer { peer_info } => {
client.register_as_peer(peer_info, None).ignore()
}
};
}
}
@@ -683,6 +683,24 @@ pub trait MixnetSigningClient {
.await .await
} }
async fn migrate_vested_mixnode(&self, fee: Option<Fee>) -> Result<ExecuteResult, NyxdError> {
self.execute_mixnet_contract(fee, MixnetExecuteMsg::MigrateVestedMixNode {}, vec![])
.await
}
async fn migrate_vested_delegation(
&self,
mix_id: MixId,
fee: Option<Fee>,
) -> Result<ExecuteResult, NyxdError> {
self.execute_mixnet_contract(
fee,
MixnetExecuteMsg::MigrateVestedDelegation { mix_id },
vec![],
)
.await
}
#[cfg(feature = "contract-testing")] #[cfg(feature = "contract-testing")]
async fn testing_resolve_all_pending_events( async fn testing_resolve_all_pending_events(
&self, &self,
@@ -928,6 +946,12 @@ mod tests {
MixnetExecuteMsg::WithdrawDelegatorRewardOnBehalf { mix_id, owner } => client MixnetExecuteMsg::WithdrawDelegatorRewardOnBehalf { mix_id, owner } => client
.withdraw_delegator_reward_on_behalf(owner.parse().unwrap(), mix_id, None) .withdraw_delegator_reward_on_behalf(owner.parse().unwrap(), mix_id, None)
.ignore(), .ignore(),
MixnetExecuteMsg::MigrateVestedMixNode { .. } => {
client.migrate_vested_mixnode(None).ignore()
}
MixnetExecuteMsg::MigrateVestedDelegation { mix_id } => {
client.migrate_vested_delegation(mix_id, None).ignore()
}
#[cfg(feature = "contract-testing")] #[cfg(feature = "contract-testing")]
MixnetExecuteMsg::TestingResolveAllPendingEvents { .. } => { MixnetExecuteMsg::TestingResolveAllPendingEvents { .. } => {
@@ -10,7 +10,6 @@ use std::str::FromStr;
// query clients // query clients
pub mod coconut_bandwidth_query_client; pub mod coconut_bandwidth_query_client;
pub mod dkg_query_client; pub mod dkg_query_client;
pub mod ephemera_query_client;
pub mod group_query_client; pub mod group_query_client;
pub mod mixnet_query_client; pub mod mixnet_query_client;
pub mod multisig_query_client; pub mod multisig_query_client;
@@ -19,7 +18,6 @@ pub mod vesting_query_client;
// signing clients // signing clients
pub mod coconut_bandwidth_signing_client; pub mod coconut_bandwidth_signing_client;
pub mod dkg_signing_client; pub mod dkg_signing_client;
pub mod ephemera_signing_client;
pub mod group_signing_client; pub mod group_signing_client;
pub mod mixnet_signing_client; pub mod mixnet_signing_client;
pub mod multisig_signing_client; pub mod multisig_signing_client;
@@ -30,7 +28,6 @@ pub use coconut_bandwidth_query_client::{
CoconutBandwidthQueryClient, PagedCoconutBandwidthQueryClient, CoconutBandwidthQueryClient, PagedCoconutBandwidthQueryClient,
}; };
pub use dkg_query_client::{DkgQueryClient, PagedDkgQueryClient}; pub use dkg_query_client::{DkgQueryClient, PagedDkgQueryClient};
pub use ephemera_query_client::{EphemeraQueryClient, PagedEphemeraQueryClient};
pub use group_query_client::{GroupQueryClient, PagedGroupQueryClient}; pub use group_query_client::{GroupQueryClient, PagedGroupQueryClient};
pub use mixnet_query_client::{MixnetQueryClient, PagedMixnetQueryClient}; pub use mixnet_query_client::{MixnetQueryClient, PagedMixnetQueryClient};
pub use multisig_query_client::{MultisigQueryClient, PagedMultisigQueryClient}; pub use multisig_query_client::{MultisigQueryClient, PagedMultisigQueryClient};
@@ -39,7 +36,6 @@ pub use vesting_query_client::{PagedVestingQueryClient, VestingQueryClient};
// re-export signing traits // re-export signing traits
pub use coconut_bandwidth_signing_client::CoconutBandwidthSigningClient; pub use coconut_bandwidth_signing_client::CoconutBandwidthSigningClient;
pub use dkg_signing_client::DkgSigningClient; pub use dkg_signing_client::DkgSigningClient;
pub use ephemera_signing_client::EphemeraSigningClient;
pub use group_signing_client::GroupSigningClient; pub use group_signing_client::GroupSigningClient;
pub use mixnet_signing_client::MixnetSigningClient; pub use mixnet_signing_client::MixnetSigningClient;
pub use multisig_signing_client::MultisigSigningClient; pub use multisig_signing_client::MultisigSigningClient;
@@ -56,9 +52,6 @@ pub trait NymContractsProvider {
fn dkg_contract_address(&self) -> Option<&AccountId>; fn dkg_contract_address(&self) -> Option<&AccountId>;
fn group_contract_address(&self) -> Option<&AccountId>; fn group_contract_address(&self) -> Option<&AccountId>;
fn multisig_contract_address(&self) -> Option<&AccountId>; fn multisig_contract_address(&self) -> Option<&AccountId>;
// ephemera-related
fn ephemera_contract_address(&self) -> Option<&AccountId>;
} }
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
@@ -70,8 +63,6 @@ pub struct TypedNymContracts {
pub group_contract_address: Option<AccountId>, pub group_contract_address: Option<AccountId>,
pub multisig_contract_address: Option<AccountId>, pub multisig_contract_address: Option<AccountId>,
pub coconut_dkg_contract_address: Option<AccountId>, pub coconut_dkg_contract_address: Option<AccountId>,
pub ephemera_contract_address: Option<AccountId>,
} }
impl TryFrom<NymContracts> for TypedNymContracts { impl TryFrom<NymContracts> for TypedNymContracts {
@@ -103,10 +94,6 @@ impl TryFrom<NymContracts> for TypedNymContracts {
.coconut_dkg_contract_address .coconut_dkg_contract_address
.map(|addr| addr.parse()) .map(|addr| addr.parse())
.transpose()?, .transpose()?,
ephemera_contract_address: value
.ephemera_contract_address
.map(|addr| addr.parse())
.transpose()?,
}) })
} }
} }
@@ -437,6 +437,7 @@ where
mod tests { mod tests {
use super::*; use super::*;
use crate::nyxd::contract_traits::tests::{mock_coin, IgnoreValue}; use crate::nyxd::contract_traits::tests::{mock_coin, IgnoreValue};
use nym_vesting_contract_common::ExecuteMsg;
// it's enough that this compiles and clippy is happy about it // it's enough that this compiles and clippy is happy about it
#[allow(dead_code)] #[allow(dead_code)]
@@ -560,6 +561,9 @@ mod tests {
VestingExecuteMsg::UpdateLockedPledgeCap { address, cap } => client VestingExecuteMsg::UpdateLockedPledgeCap { address, cap } => client
.update_locked_pledge_cap(address.parse().unwrap(), cap, None) .update_locked_pledge_cap(address.parse().unwrap(), cap, None)
.ignore(), .ignore(),
// those will never be manually called by clients
ExecuteMsg::TrackMigratedMixnode { .. } => "explicitly_ignored".ignore(),
ExecuteMsg::TrackMigratedDelegation { .. } => "explicitly_ignored".ignore(),
}; };
} }
} }
@@ -3,7 +3,7 @@
use crate::nyxd::cosmwasm_client::client_traits::CosmWasmClient; use crate::nyxd::cosmwasm_client::client_traits::CosmWasmClient;
use crate::nyxd::cosmwasm_client::helpers::{compress_wasm_code, CheckResponse}; use crate::nyxd::cosmwasm_client::helpers::{compress_wasm_code, CheckResponse};
use crate::nyxd::cosmwasm_client::logs::{self, parse_raw_logs}; use crate::nyxd::cosmwasm_client::logs::parse_raw_logs;
use crate::nyxd::cosmwasm_client::types::*; use crate::nyxd::cosmwasm_client::types::*;
use crate::nyxd::error::NyxdError; use crate::nyxd::error::NyxdError;
use crate::nyxd::fee::{Fee, DEFAULT_SIMULATED_GAS_MULTIPLIER}; use crate::nyxd::fee::{Fee, DEFAULT_SIMULATED_GAS_MULTIPLIER};
@@ -19,6 +19,7 @@ use cosmrs::feegrant::{
}; };
use cosmrs::proto::cosmos::tx::signing::v1beta1::SignMode; use cosmrs::proto::cosmos::tx::signing::v1beta1::SignMode;
use cosmrs::staking::{MsgDelegate, MsgUndelegate}; use cosmrs::staking::{MsgDelegate, MsgUndelegate};
use cosmrs::tendermint::abci::{Event, EventAttribute};
use cosmrs::tx::{self, Msg}; use cosmrs::tx::{self, Msg};
use cosmrs::{cosmwasm, AccountId, Any, Tx}; use cosmrs::{cosmwasm, AccountId, Any, Tx};
use log::debug; use log::debug;
@@ -51,6 +52,20 @@ fn single_unspecified_signer_auth(
} }
.auth_info(empty_fee()) .auth_info(empty_fee())
} }
// Searches in events for an event of the given event type which contains an
// attribute for with the given key.
fn find_attribute<'a>(
events: &'a [Event],
event_type: &str,
attr_key: &str,
) -> Option<&'a EventAttribute> {
events
.iter()
.find(|attr| attr.kind == event_type)?
.attributes
.iter()
.find(|attr| attr.key == attr_key)
}
#[cfg_attr(target_arch = "wasm32", async_trait(?Send))] #[cfg_attr(target_arch = "wasm32", async_trait(?Send))]
#[cfg_attr(not(target_arch = "wasm32"), async_trait)] #[cfg_attr(not(target_arch = "wasm32"), async_trait)]
@@ -118,6 +133,7 @@ where
.check_response()?; .check_response()?;
let logs = parse_raw_logs(tx_res.tx_result.log)?; let logs = parse_raw_logs(tx_res.tx_result.log)?;
let events = tx_res.tx_result.events;
let gas_info = GasInfo { let gas_info = GasInfo {
gas_wanted: tx_res.tx_result.gas_wanted.try_into().unwrap_or_default(), gas_wanted: tx_res.tx_result.gas_wanted.try_into().unwrap_or_default(),
gas_used: tx_res.tx_result.gas_used.try_into().unwrap_or_default(), gas_used: tx_res.tx_result.gas_used.try_into().unwrap_or_default(),
@@ -127,7 +143,7 @@ where
// the reason I think unwrap here is fine is that if the transaction succeeded and those // the reason I think unwrap here is fine is that if the transaction succeeded and those
// fields do not exist or code_id is not a number, there's no way we can recover, we're probably connected // fields do not exist or code_id is not a number, there's no way we can recover, we're probably connected
// to wrong validator or something // to wrong validator or something
let code_id = logs::find_attribute(&logs, "store_code", "code_id") let code_id = find_attribute(&events, "store_code", "code_id")
.unwrap() .unwrap()
.value .value
.parse() .parse()
@@ -140,6 +156,7 @@ where
compressed_checksum, compressed_checksum,
code_id, code_id,
logs, logs,
events,
transaction_hash: tx_res.hash, transaction_hash: tx_res.hash,
gas_info, gas_info,
}) })
@@ -182,6 +199,7 @@ where
.check_response()?; .check_response()?;
let logs = parse_raw_logs(tx_res.tx_result.log)?; let logs = parse_raw_logs(tx_res.tx_result.log)?;
let events = tx_res.tx_result.events;
let gas_info = GasInfo { let gas_info = GasInfo {
gas_wanted: tx_res.tx_result.gas_wanted.try_into().unwrap_or_default(), gas_wanted: tx_res.tx_result.gas_wanted.try_into().unwrap_or_default(),
gas_used: tx_res.tx_result.gas_used.try_into().unwrap_or_default(), gas_used: tx_res.tx_result.gas_used.try_into().unwrap_or_default(),
@@ -190,7 +208,7 @@ where
// the reason I think unwrap here is fine is that if the transaction succeeded and those // the reason I think unwrap here is fine is that if the transaction succeeded and those
// fields do not exist or address is malformed, there's no way we can recover, we're probably connected // fields do not exist or address is malformed, there's no way we can recover, we're probably connected
// to wrong validator or something // to wrong validator or something
let contract_address = logs::find_attribute(&logs, "instantiate", "_contract_address") let contract_address = find_attribute(&events, "instantiate", "_contract_address")
.unwrap() .unwrap()
.value .value
.parse() .parse()
@@ -199,6 +217,7 @@ where
Ok(InstantiateResult { Ok(InstantiateResult {
contract_address, contract_address,
logs, logs,
events,
transaction_hash: tx_res.hash, transaction_hash: tx_res.hash,
gas_info, gas_info,
}) })
@@ -231,6 +250,7 @@ where
}; };
Ok(ChangeAdminResult { Ok(ChangeAdminResult {
logs: parse_raw_logs(tx_res.tx_result.log)?, logs: parse_raw_logs(tx_res.tx_result.log)?,
events: tx_res.tx_result.events,
transaction_hash: tx_res.hash, transaction_hash: tx_res.hash,
gas_info, gas_info,
}) })
@@ -261,6 +281,7 @@ where
}; };
Ok(ChangeAdminResult { Ok(ChangeAdminResult {
logs: parse_raw_logs(tx_res.tx_result.log)?, logs: parse_raw_logs(tx_res.tx_result.log)?,
events: tx_res.tx_result.events,
transaction_hash: tx_res.hash, transaction_hash: tx_res.hash,
gas_info, gas_info,
}) })
@@ -298,6 +319,7 @@ where
}; };
Ok(MigrateResult { Ok(MigrateResult {
logs: parse_raw_logs(tx_res.tx_result.log)?, logs: parse_raw_logs(tx_res.tx_result.log)?,
events: tx_res.tx_result.events,
transaction_hash: tx_res.hash, transaction_hash: tx_res.hash,
gas_info, gas_info,
}) })
@@ -335,6 +357,7 @@ where
}; };
Ok(ExecuteResult { Ok(ExecuteResult {
logs: parse_raw_logs(tx_res.tx_result.log)?, logs: parse_raw_logs(tx_res.tx_result.log)?,
events: tx_res.tx_result.events,
data: tx_res.tx_result.data.into(), data: tx_res.tx_result.data.into(),
transaction_hash: tx_res.hash, transaction_hash: tx_res.hash,
gas_info, gas_info,
@@ -378,6 +401,7 @@ where
}; };
Ok(ExecuteResult { Ok(ExecuteResult {
logs: parse_raw_logs(tx_res.tx_result.log)?, logs: parse_raw_logs(tx_res.tx_result.log)?,
events: tx_res.tx_result.events,
data: tx_res.tx_result.data.into(), data: tx_res.tx_result.data.into(),
transaction_hash: tx_res.hash, transaction_hash: tx_res.hash,
gas_info, gas_info,
@@ -9,16 +9,12 @@ pub use nym_coconut_bandwidth_contract_common::event_attributes::*;
pub use nym_coconut_dkg_common::event_attributes::*; pub use nym_coconut_dkg_common::event_attributes::*;
// it seems that currently validators just emit stringified events (which are also returned as part of deliverTx response) // it seems that currently validators just emit stringified events (which are also returned as part of deliverTx response)
// as theirs logs // as their logs
#[derive(Debug, Serialize, Deserialize)] #[derive(Debug, Serialize, Deserialize)]
pub struct Log { pub struct Log {
#[serde(default)] #[serde(default)]
// weird thing is that the first msg_index seems to always be undefined on the raw logs // weird thing is that the first msg_index seems to always be undefined on the raw logs
pub msg_index: usize, pub msg_index: usize,
// unless I'm missing something obvious, the "log" type in cosmjs is always an empty string
// and launchpad cosmos validator was setting it to what essentially is just the raw version of what
// we received (and we don't care about launchpad, we, as the time of writing this, work on the stargate)
// log: String,
pub events: Vec<cosmwasm_std::Event>, pub events: Vec<cosmwasm_std::Event>,
} }
@@ -37,8 +33,13 @@ pub fn find_attribute<'a>(
.find(|attr| attr.key == attribute_key) .find(|attr| attr.key == attribute_key)
} }
// those two functions were separated so that the internal logic could actually be tested // these two functions were separated so that the internal logic could actually be tested
fn parse_raw_str_logs(raw: &str) -> Result<Vec<Log>, NyxdError> { fn parse_raw_str_logs(raw: &str) -> Result<Vec<Log>, NyxdError> {
// From Cosmos SDK > 0.50 onwards, log field is not populated
if raw.is_empty() {
return Ok(Vec::new());
}
let logs: Vec<Log> = serde_json::from_str(raw).map_err(|_| NyxdError::MalformedLogString)?; let logs: Vec<Log> = serde_json::from_str(raw).map_err(|_| NyxdError::MalformedLogString)?;
if logs.len() != logs.iter().unique_by(|log| log.msg_index).count() { if logs.len() != logs.iter().unique_by(|log| log.msg_index).count() {
// this check is only here because I don't yet fully understand raw log string generation and // this check is only here because I don't yet fully understand raw log string generation and
@@ -1,6 +1,11 @@
// Copyright 2021 - Nym Technologies SA <contact@nymtech.net> // Copyright 2021 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
// TEMPORARY WORKAROUND:
// those features are expected as the below should only get activated whenever
// the corresponding features in tendermint-rpc are enabled transitively
#![allow(unexpected_cfgs)]
use crate::nyxd::cosmwasm_client::client_traits::SigningCosmWasmClient; use crate::nyxd::cosmwasm_client::client_traits::SigningCosmWasmClient;
use crate::nyxd::error::NyxdError; use crate::nyxd::error::NyxdError;
use crate::nyxd::{Config, GasPrice, Hash, Height}; use crate::nyxd::{Config, GasPrice, Hash, Height};
@@ -232,6 +232,8 @@ pub struct UploadResult {
pub logs: Vec<Log>, pub logs: Vec<Log>,
pub events: Vec<abci::Event>,
/// Transaction hash (might be used as transaction ID) /// Transaction hash (might be used as transaction ID)
pub transaction_hash: Hash, pub transaction_hash: Hash,
@@ -269,6 +271,8 @@ pub struct InstantiateResult {
pub logs: Vec<Log>, pub logs: Vec<Log>,
pub events: Vec<abci::Event>,
/// Transaction hash (might be used as transaction ID) /// Transaction hash (might be used as transaction ID)
pub transaction_hash: Hash, pub transaction_hash: Hash,
@@ -279,6 +283,8 @@ pub struct InstantiateResult {
pub struct ChangeAdminResult { pub struct ChangeAdminResult {
pub logs: Vec<Log>, pub logs: Vec<Log>,
pub events: Vec<abci::Event>,
/// Transaction hash (might be used as transaction ID) /// Transaction hash (might be used as transaction ID)
pub transaction_hash: Hash, pub transaction_hash: Hash,
@@ -289,6 +295,8 @@ pub struct ChangeAdminResult {
pub struct MigrateResult { pub struct MigrateResult {
pub logs: Vec<Log>, pub logs: Vec<Log>,
pub events: Vec<abci::Event>,
/// Transaction hash (might be used as transaction ID) /// Transaction hash (might be used as transaction ID)
pub transaction_hash: Hash, pub transaction_hash: Hash,
@@ -301,6 +309,8 @@ pub struct ExecuteResult {
pub data: Vec<u8>, pub data: Vec<u8>,
pub events: Vec<abci::Event>,
/// Transaction hash (might be used as transaction ID) /// Transaction hash (might be used as transaction ID)
pub transaction_hash: Hash, pub transaction_hash: Hash,
@@ -140,6 +140,6 @@ mod tests {
let fee = &gas_price * gas_limit; let fee = &gas_price * gas_limit;
// the failing behaviour was result value of 3937 // the failing behaviour was result value of 3937
assert_eq!(fee.amount, 3938u64.into()); assert_eq!(fee.amount, 3938u128);
} }
} }
@@ -1,6 +1,11 @@
// Copyright 2021 - Nym Technologies SA <contact@nymtech.net> // Copyright 2021 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
// TEMPORARY WORKAROUND:
// those features are expected as the below should only get activated whenever
// the corresponding features in tendermint-rpc are enabled transitively
#![allow(unexpected_cfgs)]
use crate::nyxd::contract_traits::{NymContractsProvider, TypedNymContracts}; use crate::nyxd::contract_traits::{NymContractsProvider, TypedNymContracts};
use crate::nyxd::cosmwasm_client::types::{ use crate::nyxd::cosmwasm_client::types::{
ChangeAdminResult, ContractCodeId, ExecuteResult, InstantiateOptions, InstantiateResult, ChangeAdminResult, ContractCodeId, ExecuteResult, InstantiateOptions, InstantiateResult,
@@ -70,6 +75,8 @@ use crate::http_client;
use crate::{DirectSigningHttpRpcNyxdClient, QueryHttpRpcNyxdClient}; use crate::{DirectSigningHttpRpcNyxdClient, QueryHttpRpcNyxdClient};
#[cfg(feature = "http-client")] #[cfg(feature = "http-client")]
use cosmrs::rpc::{HttpClient, HttpClientUrl}; use cosmrs::rpc::{HttpClient, HttpClientUrl};
use nym_contracts_common::build_information::CONTRACT_BUILD_INFO_STORAGE_KEY;
use nym_contracts_common::ContractBuildInformation;
pub mod coin; pub mod coin;
pub mod contract_traits; pub mod contract_traits;
@@ -278,10 +285,6 @@ impl<C, S> NymContractsProvider for NyxdClient<C, S> {
fn multisig_contract_address(&self) -> Option<&AccountId> { fn multisig_contract_address(&self) -> Option<&AccountId> {
self.config.contracts.multisig_contract_address.as_ref() self.config.contracts.multisig_contract_address.as_ref()
} }
fn ephemera_contract_address(&self) -> Option<&AccountId> {
self.config.contracts.ephemera_contract_address.as_ref()
}
} }
// queries // queries
@@ -332,6 +335,33 @@ where
.await .await
.map(|block| block.block_id.hash) .map(|block| block.block_id.hash)
} }
pub async fn try_get_cw2_contract_version(
&self,
contract_address: &AccountId,
) -> Option<cw2::ContractVersion> {
let raw_info = self
.query_contract_raw(contract_address, b"contract_info".to_vec())
.await
.ok()?;
serde_json::from_slice(&raw_info).ok()
}
pub async fn try_get_contract_build_information(
&self,
contract_address: &AccountId,
) -> Option<ContractBuildInformation> {
let raw_info = self
.query_contract_raw(
contract_address,
CONTRACT_BUILD_INFO_STORAGE_KEY.as_bytes().to_vec(),
)
.await
.ok()?;
serde_json::from_slice(&raw_info).ok()
}
} }
// signing // signing
@@ -1,6 +1,11 @@
// Copyright 2023 - Nym Technologies SA <contact@nymtech.net> // Copyright 2023 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
// TEMPORARY WORKAROUND:
// those features are expected as the below should only get activated whenever
// the corresponding features in tendermint-rpc are enabled transitively
#![allow(unexpected_cfgs)]
use async_trait::async_trait; use async_trait::async_trait;
use cosmrs::tendermint::{self, abci, block::Height, evidence::Evidence, Genesis, Hash}; use cosmrs::tendermint::{self, abci, block::Height, evidence::Evidence, Genesis, Hash};
use serde::{de::DeserializeOwned, Serialize}; use serde::{de::DeserializeOwned, Serialize};
@@ -1,15 +1,26 @@
// Copyright 2022 - Nym Technologies SA <contact@nymtech.net> // Copyright 2022-2024 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
use clap::Parser; use clap::Parser;
use log::{debug, info};
use cosmwasm_std::Decimal; use cosmwasm_std::Decimal;
use nym_mixnet_contract_common::{InitialRewardingParams, InstantiateMsg, Percent}; use log::{debug, info};
use nym_validator_client::nyxd::AccountId; use nym_mixnet_contract_common::{
InitialRewardingParams, InstantiateMsg, OperatingCostRange, Percent, ProfitMarginRange,
};
use nym_network_defaults::mainnet::MIX_DENOM;
use nym_network_defaults::TOTAL_SUPPLY;
use nym_validator_client::nyxd::{AccountId, Coin};
use std::str::FromStr; use std::str::FromStr;
use std::time::Duration; use std::time::Duration;
pub fn default_maximum_operating_cost() -> Coin {
Coin::new(TOTAL_SUPPLY, MIX_DENOM.base)
}
pub fn default_minimum_operating_cost() -> Coin {
Coin::new(0, MIX_DENOM.base)
}
#[derive(Debug, Parser)] #[derive(Debug, Parser)]
pub struct Args { pub struct Args {
#[clap(long)] #[clap(long)]
@@ -50,6 +61,18 @@ pub struct Args {
#[clap(long, default_value_t = 240)] #[clap(long, default_value_t = 240)]
pub active_set_size: u32, pub active_set_size: u32,
#[clap(long, default_value_t = Percent::zero())]
pub minimum_profit_margin_percent: Percent,
#[clap(long, default_value_t = Percent::hundred())]
pub maximum_profit_margin_percent: Percent,
#[clap(long, default_value_t = default_minimum_operating_cost())]
pub minimum_interval_operating_cost: Coin,
#[clap(long, default_value_t = default_maximum_operating_cost())]
pub maximum_interval_operating_cost: Coin,
} }
pub async fn generate(args: Args) { pub async fn generate(args: Args) {
@@ -97,6 +120,10 @@ pub async fn generate(args: Args) {
.expect("Rewarding (mix) denom has to be set") .expect("Rewarding (mix) denom has to be set")
}); });
if args.minimum_interval_operating_cost.denom != args.maximum_interval_operating_cost.denom {
panic!("different denoms for operating cost bounds")
}
let instantiate_msg = InstantiateMsg { let instantiate_msg = InstantiateMsg {
rewarding_validator_address: rewarding_validator_address.to_string(), rewarding_validator_address: rewarding_validator_address.to_string(),
vesting_contract_address: vesting_contract_address.to_string(), vesting_contract_address: vesting_contract_address.to_string(),
@@ -104,6 +131,14 @@ pub async fn generate(args: Args) {
epochs_in_interval: args.epochs_in_interval, epochs_in_interval: args.epochs_in_interval,
epoch_duration: Duration::from_secs(args.epoch_duration), epoch_duration: Duration::from_secs(args.epoch_duration),
initial_rewarding_params, initial_rewarding_params,
profit_margin: ProfitMarginRange {
minimum: args.minimum_profit_margin_percent,
maximum: args.maximum_profit_margin_percent,
},
interval_operating_cost: OperatingCostRange {
minimum: args.minimum_interval_operating_cost.amount.into(),
maximum: args.maximum_interval_operating_cost.amount.into(),
},
}; };
debug!("instantiate_msg: {:?}", instantiate_msg); debug!("instantiate_msg: {:?}", instantiate_msg);
@@ -0,0 +1,42 @@
// Copyright 2024 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
use crate::context::SigningClient;
use clap::Parser;
use log::info;
use nym_mixnet_contract_common::MixId;
use nym_validator_client::nyxd::contract_traits::{MixnetQueryClient, MixnetSigningClient};
#[derive(Debug, Parser)]
pub struct Args {
#[clap(long)]
pub mix_id: Option<MixId>,
#[clap(long)]
pub identity_key: Option<String>,
}
pub async fn migrate_vested_delegation(args: Args, client: SigningClient) {
let mix_id = match args.mix_id {
Some(mix_id) => mix_id,
None => {
let identity_key = args
.identity_key
.expect("either mix_id or mix_identity has to be specified");
let node_details = client
.get_mixnode_details_by_identity(identity_key)
.await
.expect("contract query failed")
.mixnode_details
.expect("mixnode with the specified identity doesnt exist");
node_details.mix_id()
}
};
let res = client
.migrate_vested_delegation(mix_id, None)
.await
.expect("failed to migrate delegation!");
info!("migration result: {:?}", res)
}
@@ -7,6 +7,7 @@ pub mod rewards;
pub mod delegate_to_mixnode; pub mod delegate_to_mixnode;
pub mod delegate_to_multiple_mixnodes; pub mod delegate_to_multiple_mixnodes;
pub mod migrate_vested_delegation;
pub mod query_for_delegations; pub mod query_for_delegations;
pub mod undelegate_from_mixnode; pub mod undelegate_from_mixnode;
pub mod vesting_delegate_to_mixnode; pub mod vesting_delegate_to_mixnode;
@@ -35,4 +36,6 @@ pub enum MixnetDelegatorsCommands {
DelegateVesting(vesting_delegate_to_mixnode::Args), DelegateVesting(vesting_delegate_to_mixnode::Args),
/// Undelegate from a mixnode (when originally using locked tokens) /// Undelegate from a mixnode (when originally using locked tokens)
UndelegateVesting(vesting_undelegate_from_mixnode::Args), UndelegateVesting(vesting_undelegate_from_mixnode::Args),
/// Migrate the delegation to use liquid tokens
MigrateVestedDelegation(migrate_vested_delegation::Args),
} }
@@ -96,6 +96,7 @@ async fn print_delegation_events(events: Vec<PendingEpochEvent>, client: &Signin
mix_id, mix_id,
amount, amount,
proxy, proxy,
..
} => { } => {
if owner.as_str() == client.nyxd.address().as_ref() { if owner.as_str() == client.nyxd.address().as_ref() {
table.add_row(vec![ table.add_row(vec![
@@ -111,6 +112,7 @@ async fn print_delegation_events(events: Vec<PendingEpochEvent>, client: &Signin
owner, owner,
mix_id, mix_id,
proxy, proxy,
..
} => { } => {
if owner.as_str() == client.nyxd.address().as_ref() { if owner.as_str() == client.nyxd.address().as_ref() {
table.add_row(vec![ table.add_row(vec![
@@ -8,7 +8,7 @@ use cosmwasm_std::Coin;
use nym_bin_common::output_format::OutputFormat; use nym_bin_common::output_format::OutputFormat;
use nym_mixnet_contract_common::construct_gateway_bonding_sign_payload; use nym_mixnet_contract_common::construct_gateway_bonding_sign_payload;
use nym_network_defaults::{DEFAULT_CLIENT_LISTENING_PORT, DEFAULT_MIX_LISTENING_PORT}; use nym_network_defaults::{DEFAULT_CLIENT_LISTENING_PORT, DEFAULT_MIX_LISTENING_PORT};
use nym_validator_client::nyxd::contract_traits::{MixnetQueryClient, NymContractsProvider}; use nym_validator_client::nyxd::contract_traits::MixnetQueryClient;
#[derive(Debug, Parser)] #[derive(Debug, Parser)]
pub struct Args { pub struct Args {
@@ -39,10 +39,6 @@ pub struct Args {
)] )]
pub amount: u128, pub amount: u128,
/// Indicates whether the gateway is going to get bonded via a vesting account
#[arg(long)]
pub with_vesting_account: bool,
#[clap(short, long, default_value_t = OutputFormat::default())] #[clap(short, long, default_value_t = OutputFormat::default())]
output: OutputFormat, output: OutputFormat,
} }
@@ -74,15 +70,8 @@ pub async fn create_payload(args: Args, client: SigningClient) {
}; };
let address = account_id_to_cw_addr(&client.address()); let address = account_id_to_cw_addr(&client.address());
let proxy = if args.with_vesting_account {
Some(account_id_to_cw_addr(
client.vesting_contract_address().unwrap(),
))
} else {
None
};
let payload = construct_gateway_bonding_sign_payload(nonce, address, proxy, coin, gateway); let payload = construct_gateway_bonding_sign_payload(nonce, address, coin, gateway);
let wrapper = DataWrapper::new(payload.to_base58_string().unwrap()); let wrapper = DataWrapper::new(payload.to_base58_string().unwrap());
println!("{}", args.output.format(&wrapper)) println!("{}", args.output.format(&wrapper))
} }
@@ -5,33 +5,21 @@ use crate::context::SigningClient;
use clap::Parser; use clap::Parser;
use log::info; use log::info;
use nym_validator_client::nyxd::contract_traits::MixnetSigningClient; use nym_validator_client::nyxd::contract_traits::MixnetSigningClient;
use nym_validator_client::nyxd::contract_traits::VestingSigningClient;
#[derive(Debug, Parser)] #[derive(Debug, Parser)]
pub struct Args { pub struct Args {
/// Label that is going to be used for creating the family /// Label that is going to be used for creating the family
#[arg(long)] #[arg(long)]
pub family_label: String, pub family_label: String,
/// Indicates whether the family is going to get created via a vesting account
#[arg(long)]
pub with_vesting_account: bool,
} }
pub async fn create_family(args: Args, client: SigningClient) { pub async fn create_family(args: Args, client: SigningClient) {
info!("Create family"); info!("Create family");
let res = if args.with_vesting_account { let res = client
client .create_family(args.family_label, None)
.vesting_create_family(args.family_label, None) .await
.await .expect("failed to create family");
.expect("failed to create family with vesting account")
} else {
client
.create_family(args.family_label, None)
.await
.expect("failed to create family")
};
info!("Family creation result: {:?}", res); info!("Family creation result: {:?}", res);
} }
@@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
use crate::context::QueryClient; use crate::context::QueryClient;
use crate::utils::{account_id_to_cw_addr, DataWrapper}; use crate::utils::DataWrapper;
use clap::Parser; use clap::Parser;
use cosmrs::AccountId; use cosmrs::AccountId;
use log::info; use log::info;
@@ -10,7 +10,7 @@ use nym_bin_common::output_format::OutputFormat;
use nym_crypto::asymmetric::identity; use nym_crypto::asymmetric::identity;
use nym_mixnet_contract_common::construct_family_join_permit; use nym_mixnet_contract_common::construct_family_join_permit;
use nym_mixnet_contract_common::families::FamilyHead; use nym_mixnet_contract_common::families::FamilyHead;
use nym_validator_client::nyxd::contract_traits::{MixnetQueryClient, NymContractsProvider}; use nym_validator_client::nyxd::contract_traits::MixnetQueryClient;
#[derive(Debug, Parser)] #[derive(Debug, Parser)]
pub struct Args { pub struct Args {
@@ -18,10 +18,6 @@ pub struct Args {
#[arg(long)] #[arg(long)]
pub address: AccountId, pub address: AccountId,
/// Indicates whether the member joining the family is going to use the vesting account for joining.
#[arg(long)]
pub with_vesting_account: bool,
// might as well validate the value when parsing the arguments // might as well validate the value when parsing the arguments
/// Identity of the member for whom we're issuing the permit /// Identity of the member for whom we're issuing the permit
#[arg(long)] #[arg(long)]
@@ -68,18 +64,9 @@ pub async fn create_family_join_permit_sign_payload(args: Args, client: QueryCli
} }
}; };
// let address = account_id_to_cw_addr(&args.address);
let proxy = if args.with_vesting_account {
Some(account_id_to_cw_addr(
client.vesting_contract_address().unwrap(),
))
} else {
None
};
let head = FamilyHead::new(mixnode.bond_information.identity()); let head = FamilyHead::new(mixnode.bond_information.identity());
let payload = construct_family_join_permit(nonce, head, proxy, args.member.to_base58_string()); let payload = construct_family_join_permit(nonce, head, args.member.to_base58_string());
let wrapper = DataWrapper::new(payload.to_base58_string().unwrap()); let wrapper = DataWrapper::new(payload.to_base58_string().unwrap());
println!("{}", args.output.format(&wrapper)) println!("{}", args.output.format(&wrapper))
} }
@@ -8,7 +8,6 @@ use nym_contracts_common::signing::MessageSignature;
use nym_crypto::asymmetric::identity; use nym_crypto::asymmetric::identity;
use nym_mixnet_contract_common::families::FamilyHead; use nym_mixnet_contract_common::families::FamilyHead;
use nym_validator_client::nyxd::contract_traits::MixnetSigningClient; use nym_validator_client::nyxd::contract_traits::MixnetSigningClient;
use nym_validator_client::nyxd::contract_traits::VestingSigningClient;
#[derive(Debug, Parser)] #[derive(Debug, Parser)]
pub struct Args { pub struct Args {
@@ -16,10 +15,6 @@ pub struct Args {
#[arg(long)] #[arg(long)]
pub family_head: identity::PublicKey, pub family_head: identity::PublicKey,
/// Indicates whether the member joining the family is going to do so via the vesting contract
#[arg(long)]
pub with_vesting_account: bool,
/// Permission, as provided by the family head, for joining the family /// Permission, as provided by the family head, for joining the family
#[arg(long)] #[arg(long)]
pub join_permit: MessageSignature, pub join_permit: MessageSignature,
@@ -30,17 +25,10 @@ pub async fn join_family(args: Args, client: SigningClient) {
let family_head = FamilyHead::new(args.family_head.to_base58_string()); let family_head = FamilyHead::new(args.family_head.to_base58_string());
let res = if args.with_vesting_account { let res = client
client .join_family(args.join_permit, family_head, None)
.vesting_join_family(args.join_permit, family_head, None) .await
.await .expect("failed to join family");
.expect("failed to join family with vesting account")
} else {
client
.join_family(args.join_permit, family_head, None)
.await
.expect("failed to join family")
};
info!("Family join result: {:?}", res); info!("Family join result: {:?}", res);
} }
@@ -7,17 +7,12 @@ use log::info;
use nym_crypto::asymmetric::identity; use nym_crypto::asymmetric::identity;
use nym_mixnet_contract_common::families::FamilyHead; use nym_mixnet_contract_common::families::FamilyHead;
use nym_validator_client::nyxd::contract_traits::MixnetSigningClient; use nym_validator_client::nyxd::contract_traits::MixnetSigningClient;
use nym_validator_client::nyxd::contract_traits::VestingSigningClient;
#[derive(Debug, Parser)] #[derive(Debug, Parser)]
pub struct Args { pub struct Args {
/// The head of the family that we intend to leave /// The head of the family that we intend to leave
#[arg(long)] #[arg(long)]
pub family_head: identity::PublicKey, pub family_head: identity::PublicKey,
/// Indicates whether we joined the family via the vesting contract
#[arg(long)]
pub with_vesting_account: bool,
} }
pub async fn leave_family(args: Args, client: SigningClient) { pub async fn leave_family(args: Args, client: SigningClient) {
@@ -25,17 +20,10 @@ pub async fn leave_family(args: Args, client: SigningClient) {
let family_head = FamilyHead::new(args.family_head.to_base58_string()); let family_head = FamilyHead::new(args.family_head.to_base58_string());
let res = if args.with_vesting_account { let res = client
client .leave_family(family_head, None)
.vesting_leave_family(family_head, None) .await
.await .expect("failed to leave family");
.expect("failed to leave family with vesting account")
} else {
client
.leave_family(family_head, None)
.await
.expect("failed to leave family")
};
info!("Family leave result: {:?}", res); info!("Family leave result: {:?}", res);
} }
@@ -0,0 +1,19 @@
// Copyright 2024 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
use crate::context::SigningClient;
use clap::Parser;
use log::info;
use nym_validator_client::nyxd::contract_traits::MixnetSigningClient;
#[derive(Debug, Parser)]
pub struct Args {}
pub async fn migrate_vested_mixnode(_args: Args, client: SigningClient) {
let res = client
.migrate_vested_mixnode(None)
.await
.expect("failed to migrate mixnode!");
info!("migration result: {:?}", res)
}
@@ -11,7 +11,7 @@ use nym_mixnet_contract_common::{construct_mixnode_bonding_sign_payload, MixNode
use nym_network_defaults::{ use nym_network_defaults::{
DEFAULT_HTTP_API_LISTENING_PORT, DEFAULT_MIX_LISTENING_PORT, DEFAULT_VERLOC_LISTENING_PORT, DEFAULT_HTTP_API_LISTENING_PORT, DEFAULT_MIX_LISTENING_PORT, DEFAULT_VERLOC_LISTENING_PORT,
}; };
use nym_validator_client::nyxd::contract_traits::{MixnetQueryClient, NymContractsProvider}; use nym_validator_client::nyxd::contract_traits::MixnetQueryClient;
use nym_validator_client::nyxd::CosmWasmCoin; use nym_validator_client::nyxd::CosmWasmCoin;
#[derive(Debug, Parser)] #[derive(Debug, Parser)]
@@ -52,10 +52,6 @@ pub struct Args {
)] )]
pub amount: u128, pub amount: u128,
/// Indicates whether the mixnode is going to get bonded via a vesting account
#[arg(long)]
pub with_vesting_account: bool,
#[clap(short, long, default_value_t = OutputFormat::default())] #[clap(short, long, default_value_t = OutputFormat::default())]
output: OutputFormat, output: OutputFormat,
} }
@@ -100,16 +96,9 @@ pub async fn create_payload(args: Args, client: SigningClient) {
}; };
let address = account_id_to_cw_addr(&client.address()); let address = account_id_to_cw_addr(&client.address());
let proxy = if args.with_vesting_account {
Some(account_id_to_cw_addr(
client.vesting_contract_address().unwrap(),
))
} else {
None
};
let payload = let payload =
construct_mixnode_bonding_sign_payload(nonce, address, proxy, coin, mixnode, cost_params); construct_mixnode_bonding_sign_payload(nonce, address, coin, mixnode, cost_params);
let wrapper = DataWrapper::new(payload.to_base58_string().unwrap()); let wrapper = DataWrapper::new(payload.to_base58_string().unwrap());
println!("{}", args.output.format(&wrapper)) println!("{}", args.output.format(&wrapper))
} }
@@ -7,6 +7,7 @@ pub mod bond_mixnode;
pub mod decrease_pledge; pub mod decrease_pledge;
pub mod families; pub mod families;
pub mod keys; pub mod keys;
pub mod migrate_vested_mixnode;
pub mod mixnode_bonding_sign_payload; pub mod mixnode_bonding_sign_payload;
pub mod pledge_more; pub mod pledge_more;
pub mod rewards; pub mod rewards;
@@ -52,4 +53,6 @@ pub enum MixnetOperatorsMixnodeCommands {
DecreasePledge(decrease_pledge::Args), DecreasePledge(decrease_pledge::Args),
/// Decrease pledge with locked tokens /// Decrease pledge with locked tokens
DecreasePledgeVesting(vesting_decrease_pledge::Args), DecreasePledgeVesting(vesting_decrease_pledge::Args),
/// Migrate the mixnode to use liquid tokens
MigrateVestedNode(migrate_vested_mixnode::Args),
} }
@@ -11,9 +11,13 @@ repository = { workspace = true }
bs58 = { workspace = true } bs58 = { workspace = true }
cosmwasm-std = { workspace = true } cosmwasm-std = { workspace = true }
cosmwasm-schema = { workspace = true } cosmwasm-schema = { workspace = true }
cw-storage-plus = { workspace = true }
schemars = { workspace = true } schemars = { workspace = true }
serde = { workspace = true, features = ["derive"] } serde = { workspace = true, features = ["derive"] }
thiserror = { workspace = true } thiserror = { workspace = true }
[dev-dependencies] [dev-dependencies]
serde_json = { workspace = true } serde_json = { workspace = true }
[build-dependencies]
vergen = { version = "=8.3.1", features = ["build", "git", "gitcl", "rustc", "cargo"] }
@@ -0,0 +1,17 @@
// Copyright 2024 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
use vergen::EmitBuilder;
fn main() {
EmitBuilder::builder()
.all_build()
.rustc_semver()
.git_branch()
.git_commit_timestamp()
.git_sha(false)
.cargo_debug()
.cargo_opt_level()
.emit()
.expect("failed to extract build metadata");
}
@@ -0,0 +1,85 @@
// Copyright 2024 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
use crate::ContractBuildInformation;
use cosmwasm_std::{StdResult, Storage};
use cw_storage_plus::Item;
pub const CONTRACT_BUILD_INFO_STORAGE_KEY: &str = "contract_build_info";
pub const CONTRACT_BUILD_INFO: Item<ContractBuildInformation> =
Item::new(CONTRACT_BUILD_INFO_STORAGE_KEY);
// important note. this MUST BE called inside the contract code itself and not any intermediate crate
// otherwise macro expansions will resolve to incorrect data
#[macro_export]
macro_rules! get_build_information {
() => {
$crate::types::ContractBuildInformation::new(
env!("CARGO_PKG_NAME"),
env!("CARGO_PKG_VERSION"),
)
};
}
pub fn set_state_build_information(
store: &mut dyn Storage,
build_info: ContractBuildInformation,
) -> StdResult<()> {
CONTRACT_BUILD_INFO.save(store, &build_info)
}
pub fn get_contract_build_information(store: &dyn Storage) -> StdResult<ContractBuildInformation> {
CONTRACT_BUILD_INFO.load(store)
}
#[macro_export]
macro_rules! set_build_information {
( $store:expr ) => {
$crate::build_information::set_state_build_information(
$store,
$crate::get_build_information!(),
)
};
}
#[cfg(test)]
mod tests {
use super::*;
use cosmwasm_std::testing::MockStorage;
#[test]
fn get_and_set_work() {
let mut store = MockStorage::new();
// error if not set
assert!(get_contract_build_information(&store).is_err());
// set and get
let contract_name = "nym-mixnet-contract";
let contract_version = "1.2.3";
let build_info = ContractBuildInformation::new(contract_name, contract_version);
set_state_build_information(&mut store, build_info).unwrap();
let loaded = get_contract_build_information(&store).unwrap();
let expected = ContractBuildInformation {
contract_name: contract_name.into(),
build_version: contract_version.into(),
build_timestamp: env!("VERGEN_BUILD_TIMESTAMP").to_string(),
commit_sha: option_env!("VERGEN_GIT_SHA")
.unwrap_or("UNKNOWN")
.to_string(),
commit_timestamp: option_env!("VERGEN_GIT_COMMIT_TIMESTAMP")
.unwrap_or("UNKNOWN")
.to_string(),
commit_branch: option_env!("VERGEN_GIT_BRANCH")
.unwrap_or("UNKNOWN")
.to_string(),
rustc_version: env!("VERGEN_RUSTC_SEMVER").to_string(),
cargo_debug: env!("VERGEN_CARGO_DEBUG").to_string(),
cargo_opt_level: env!("VERGEN_CARGO_OPT_LEVEL").to_string(),
};
assert_eq!(expected, loaded);
}
}
@@ -4,6 +4,7 @@
#![warn(clippy::expect_used)] #![warn(clippy::expect_used)]
#![warn(clippy::unwrap_used)] #![warn(clippy::unwrap_used)]
pub mod build_information;
pub mod dealings; pub mod dealings;
pub mod events; pub mod events;
pub mod signing; pub mod signing;
@@ -218,7 +218,6 @@ where
#[derive(Serialize)] #[derive(Serialize)]
pub struct ContractMessageContent<T> { pub struct ContractMessageContent<T> {
pub sender: Addr, pub sender: Addr,
pub proxy: Option<Addr>,
pub funds: Vec<Coin>, pub funds: Vec<Coin>,
pub data: T, pub data: T,
} }
@@ -233,25 +232,17 @@ where
} }
impl<T> ContractMessageContent<T> { impl<T> ContractMessageContent<T> {
pub fn new(sender: Addr, proxy: Option<Addr>, funds: Vec<Coin>, data: T) -> Self { pub fn new(sender: Addr, funds: Vec<Coin>, data: T) -> Self {
ContractMessageContent { ContractMessageContent {
sender, sender,
proxy,
funds, funds,
data, data,
} }
} }
pub fn new_with_info(info: MessageInfo, signer: Addr, data: T) -> Self { pub fn new_with_info(info: MessageInfo, signer: Addr, data: T) -> Self {
let proxy = if info.sender == signer {
None
} else {
Some(info.sender)
};
ContractMessageContent { ContractMessageContent {
sender: signer, sender: signer,
proxy,
funds: info.funds, funds: info.funds,
data, data,
} }
@@ -132,10 +132,18 @@ where
} }
} }
fn default_unknown() -> String {
"unknown".to_string()
}
// TODO: there's no reason this couldn't be used for proper binaries, but in that case // TODO: there's no reason this couldn't be used for proper binaries, but in that case
// perhaps the struct should get renamed and moved to a "more" common crate // perhaps the struct should get renamed and moved to a "more" common crate
#[cw_serde] #[cw_serde]
pub struct ContractBuildInformation { pub struct ContractBuildInformation {
/// Provides the name of the binary, i.e. the content of `CARGO_PKG_NAME` environmental variable.
#[serde(default = "default_unknown")]
pub contract_name: String,
// VERGEN_BUILD_TIMESTAMP // VERGEN_BUILD_TIMESTAMP
/// Provides the build timestamp, for example `2021-02-23T20:14:46.558472672+00:00`. /// Provides the build timestamp, for example `2021-02-23T20:14:46.558472672+00:00`.
pub build_timestamp: String, pub build_timestamp: String,
@@ -159,6 +167,38 @@ pub struct ContractBuildInformation {
// VERGEN_RUSTC_SEMVER // VERGEN_RUSTC_SEMVER
/// Provides the rustc version that was used for the build, for example `1.52.0-nightly`. /// Provides the rustc version that was used for the build, for example `1.52.0-nightly`.
pub rustc_version: String, pub rustc_version: String,
// VERGEN_CARGO_DEBUG
/// Provides the cargo debug mode that was used for the build.
#[serde(default = "default_unknown")]
pub cargo_debug: String,
// VERGEN_CARGO_OPT_LEVEL
/// Provides the opt value set by cargo during the build
#[serde(default = "default_unknown")]
pub cargo_opt_level: String,
}
impl ContractBuildInformation {
pub fn new(name: impl Into<String>, version: impl Into<String>) -> Self {
ContractBuildInformation {
contract_name: name.into(),
build_version: version.into(),
build_timestamp: env!("VERGEN_BUILD_TIMESTAMP").to_string(),
commit_sha: option_env!("VERGEN_GIT_SHA")
.unwrap_or("UNKNOWN")
.to_string(),
commit_timestamp: option_env!("VERGEN_GIT_COMMIT_TIMESTAMP")
.unwrap_or("UNKNOWN")
.to_string(),
commit_branch: option_env!("VERGEN_GIT_BRANCH")
.unwrap_or("UNKNOWN")
.to_string(),
rustc_version: env!("VERGEN_RUSTC_SEMVER").to_string(),
cargo_debug: env!("VERGEN_CARGO_DEBUG").to_string(),
cargo_opt_level: env!("VERGEN_CARGO_OPT_LEVEL").to_string(),
}
}
} }
#[cfg(test)] #[cfg(test)]
@@ -1,17 +0,0 @@
[package]
name = "nym-ephemera-common"
version = "0.1.0"
edition = "2021"
license.workspace = true
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
cosmwasm-schema = { workspace = true }
cosmwasm-std = { workspace = true }
cw-utils = { workspace = true }
contracts-common = { path = "../contracts-common", package = "nym-contracts-common" }
[features]
schema = []
@@ -1,3 +0,0 @@
pub mod msg;
pub mod peers;
pub mod types;
@@ -1,33 +0,0 @@
// Copyright 2021 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
#[cfg(feature = "schema")]
use crate::peers::PagedPeerResponse;
use crate::types::JsonPeerInfo;
use cosmwasm_schema::cw_serde;
#[cfg(feature = "schema")]
use cosmwasm_schema::QueryResponses;
#[cw_serde]
pub struct InstantiateMsg {
pub group_addr: String,
pub mix_denom: String,
}
#[cw_serde]
pub enum ExecuteMsg {
RegisterPeer { peer_info: JsonPeerInfo },
}
#[cw_serde]
#[cfg_attr(feature = "schema", derive(QueryResponses))]
pub enum QueryMsg {
#[cfg_attr(feature = "schema", returns(PagedPeerResponse))]
GetPeers {
limit: Option<u32>,
start_after: Option<String>,
},
}
#[cw_serde]
pub struct MigrateMsg {}
@@ -1,25 +0,0 @@
// Copyright 2023 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
use crate::types::JsonPeerInfo;
use cosmwasm_schema::cw_serde;
use cosmwasm_std::Addr;
#[cw_serde]
pub struct PagedPeerResponse {
pub peers: Vec<JsonPeerInfo>,
pub per_page: usize,
/// Field indicating paging information for the following queries if the caller wishes to get further entries.
pub start_next_after: Option<Addr>,
}
impl PagedPeerResponse {
pub fn new(peers: Vec<JsonPeerInfo>, per_page: usize, start_next_after: Option<Addr>) -> Self {
PagedPeerResponse {
peers,
per_page,
start_next_after,
}
}
}
@@ -1,29 +0,0 @@
// Copyright 2023 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
use cosmwasm_schema::cw_serde;
use cosmwasm_std::Addr;
#[cw_serde]
pub struct JsonPeerInfo {
/// The cosmos address of the peer, used in interacting with the chain.
pub cosmos_address: Addr,
/// The TCP/IP address of the peer.
/// Expected formats:
/// 1. `<IP>:<PORT>`
/// 2. `/ip4/<IP>/tcp/<PORT>` - this is the format used by libp2p multiaddr
pub ip_address: String,
///Serialized public key.
pub public_key: String,
}
impl JsonPeerInfo {
#[must_use]
pub fn new(cosmos_address: Addr, ip_address: String, public_key: String) -> Self {
Self {
cosmos_address,
ip_address,
public_key,
}
}
}
@@ -29,7 +29,7 @@ time = { workspace = true, features = ["parsing", "formatting"] }
ts-rs = { workspace = true, optional = true } ts-rs = { workspace = true, optional = true }
[dev-dependencies] [dev-dependencies]
rand_chacha = "0.3" rand_chacha = { workspace = true }
time = { workspace = true, features = ["serde", "macros"] } time = { workspace = true, features = ["serde", "macros"] }
[features] [features]
@@ -65,7 +65,6 @@ impl Delegation {
cumulative_reward_ratio: Decimal, cumulative_reward_ratio: Decimal,
amount: Coin, amount: Coin,
height: u64, height: u64,
proxy: Option<Addr>,
) -> Self { ) -> Self {
assert!( assert!(
amount.amount <= TOKEN_SUPPLY, amount.amount <= TOKEN_SUPPLY,
@@ -78,7 +77,7 @@ impl Delegation {
cumulative_reward_ratio, cumulative_reward_ratio,
amount, amount,
height, height,
proxy, proxy: None,
} }
} }
@@ -1,8 +1,9 @@
// Copyright 2022-2023 - Nym Technologies SA <contact@nymtech.net> // Copyright 2022-2023 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
use crate::{EpochEventId, EpochState, IdentityKey, MixId}; use crate::{EpochEventId, EpochState, IdentityKey, MixId, OperatingCostRange, ProfitMarginRange};
use contracts_common::signing::verifier::ApiVerifierError; use contracts_common::signing::verifier::ApiVerifierError;
use contracts_common::Percent;
use cosmwasm_std::{Addr, Coin, Decimal, Uint128}; use cosmwasm_std::{Addr, Coin, Decimal, Uint128};
use thiserror::Error; use thiserror::Error;
@@ -76,21 +77,11 @@ pub enum MixnetContractError {
#[error("Received multiple coin types during staking")] #[error("Received multiple coin types during staking")]
MultipleDenoms, MultipleDenoms,
#[error("Proxy address mismatch, expected {existing}, got {incoming}")]
ProxyMismatch { existing: String, incoming: String },
#[error("Proxy address ({received}) is not set to the vesting contract ({vesting_contract})")] #[error("Proxy address ({received}) is not set to the vesting contract ({vesting_contract})")]
ProxyIsNotVestingContract { ProxyIsNotVestingContract {
received: Addr, received: Addr,
vesting_contract: Addr, vesting_contract: Addr,
}, },
#[error(
"Sender of this message ({received}) is not the vesting contract ({vesting_contract})"
)]
SenderIsNotVestingContract {
received: Addr,
vesting_contract: Addr,
},
#[error("Failed to recover ed25519 public key from its base58 representation - {0}")] #[error("Failed to recover ed25519 public key from its base58 representation - {0}")]
MalformedEd25519IdentityKey(String), MalformedEd25519IdentityKey(String),
@@ -234,17 +225,35 @@ pub enum MixnetContractError {
#[error("the epoch is currently not in the 'epoch advancement' state. (the state is {current_state})")] #[error("the epoch is currently not in the 'epoch advancement' state. (the state is {current_state})")]
EpochNotInAdvancementState { current_state: EpochState }, EpochNotInAdvancementState { current_state: EpochState },
#[error("failed to parse {value} into a valid SemVer version: {error_message}")]
SemVerFailure {
value: String,
error_message: String,
},
#[error("failed to verify message signature: {source}")] #[error("failed to verify message signature: {source}")]
SignatureVerificationFailure { SignatureVerificationFailure {
#[from] #[from]
source: ApiVerifierError, source: ApiVerifierError,
}, },
#[error("this operation is no longer allowed to be performed with vesting tokens. please move them to your liquid balance and try again")]
DisabledVestingOperation,
#[error(
"this mixnode has not been bonded with the vesting tokens or has already been migrated"
)]
NotAVestingMixnode,
#[error("this delegation has not been performed with the vesting tokens or has already been migrated")]
NotAVestingDelegation,
#[error("the provided profit margin ({provided}) is outside the allowed range: {range}")]
ProfitMarginOutsideRange {
provided: Percent,
range: ProfitMarginRange,
},
#[error("the provided interval operating cost ({provided}{denom}) is outside the allowed range: {range}")]
OperatingCostOutsideRange {
denom: String,
provided: Uint128,
range: OperatingCostRange,
},
} }
impl MixnetContractError { impl MixnetContractError {
@@ -103,7 +103,6 @@ impl Display for MixnetEventType {
// attributes that are used in multiple places // attributes that are used in multiple places
pub const OWNER_KEY: &str = "owner"; pub const OWNER_KEY: &str = "owner";
pub const AMOUNT_KEY: &str = "amount"; pub const AMOUNT_KEY: &str = "amount";
pub const PROXY_KEY: &str = "proxy";
// event-specific attributes // event-specific attributes
@@ -163,7 +162,6 @@ pub const NEW_EPOCHS_IN_INTERVAL: &str = "new_epochs_in_interval";
pub fn new_delegation_event( pub fn new_delegation_event(
created_at: BlockHeight, created_at: BlockHeight,
delegator: &Addr, delegator: &Addr,
proxy: &Option<Addr>,
amount: &Coin, amount: &Coin,
mix_id: MixId, mix_id: MixId,
unit_reward: Decimal, unit_reward: Decimal,
@@ -171,58 +169,34 @@ pub fn new_delegation_event(
Event::new(MixnetEventType::Delegation) Event::new(MixnetEventType::Delegation)
.add_attribute(EVENT_CREATION_HEIGHT_KEY, created_at.to_string()) .add_attribute(EVENT_CREATION_HEIGHT_KEY, created_at.to_string())
.add_attribute(DELEGATOR_KEY, delegator) .add_attribute(DELEGATOR_KEY, delegator)
.add_optional_attribute(PROXY_KEY, proxy.as_ref())
.add_attribute(AMOUNT_KEY, amount.to_string()) .add_attribute(AMOUNT_KEY, amount.to_string())
.add_attribute(DELEGATION_TARGET_KEY, mix_id.to_string()) .add_attribute(DELEGATION_TARGET_KEY, mix_id.to_string())
.add_attribute(UNIT_REWARD_KEY, unit_reward.to_string()) .add_attribute(UNIT_REWARD_KEY, unit_reward.to_string())
} }
pub fn new_delegation_on_unbonded_node_event( pub fn new_delegation_on_unbonded_node_event(delegator: &Addr, mix_id: MixId) -> Event {
delegator: &Addr,
proxy: &Option<Addr>,
mix_id: MixId,
) -> Event {
Event::new(MixnetEventType::Delegation) Event::new(MixnetEventType::Delegation)
.add_attribute(DELEGATOR_KEY, delegator) .add_attribute(DELEGATOR_KEY, delegator)
.add_optional_attribute(PROXY_KEY, proxy.as_ref())
.add_attribute(DELEGATION_TARGET_KEY, mix_id.to_string()) .add_attribute(DELEGATION_TARGET_KEY, mix_id.to_string())
} }
pub fn new_pending_delegation_event( pub fn new_pending_delegation_event(delegator: &Addr, amount: &Coin, mix_id: MixId) -> Event {
delegator: &Addr,
proxy: &Option<Addr>,
amount: &Coin,
mix_id: MixId,
) -> Event {
Event::new(MixnetEventType::PendingDelegation) Event::new(MixnetEventType::PendingDelegation)
.add_attribute(DELEGATOR_KEY, delegator) .add_attribute(DELEGATOR_KEY, delegator)
.add_optional_attribute(PROXY_KEY, proxy.as_ref())
.add_attribute(AMOUNT_KEY, amount.to_string()) .add_attribute(AMOUNT_KEY, amount.to_string())
.add_attribute(DELEGATION_TARGET_KEY, mix_id.to_string()) .add_attribute(DELEGATION_TARGET_KEY, mix_id.to_string())
} }
pub fn new_withdraw_operator_reward_event( pub fn new_withdraw_operator_reward_event(owner: &Addr, amount: Coin, mix_id: MixId) -> Event {
owner: &Addr,
proxy: &Option<Addr>,
amount: Coin,
mix_id: MixId,
) -> Event {
Event::new(MixnetEventType::WithdrawOperatorReward) Event::new(MixnetEventType::WithdrawOperatorReward)
.add_attribute(OWNER_KEY, owner.as_str()) .add_attribute(OWNER_KEY, owner.as_str())
.add_optional_attribute(PROXY_KEY, proxy.as_ref())
.add_attribute(AMOUNT_KEY, amount.to_string()) .add_attribute(AMOUNT_KEY, amount.to_string())
.add_attribute(MIX_ID_KEY, mix_id.to_string()) .add_attribute(MIX_ID_KEY, mix_id.to_string())
} }
pub fn new_withdraw_delegator_reward_event( pub fn new_withdraw_delegator_reward_event(delegator: &Addr, amount: Coin, mix_id: MixId) -> Event {
delegator: &Addr,
proxy: &Option<Addr>,
amount: Coin,
mix_id: MixId,
) -> Event {
Event::new(MixnetEventType::WithdrawDelegatorReward) Event::new(MixnetEventType::WithdrawDelegatorReward)
.add_attribute(DELEGATOR_KEY, delegator) .add_attribute(DELEGATOR_KEY, delegator)
.add_optional_attribute(PROXY_KEY, proxy.as_ref())
.add_attribute(AMOUNT_KEY, amount.to_string()) .add_attribute(AMOUNT_KEY, amount.to_string())
.add_attribute(DELEGATION_TARGET_KEY, mix_id.to_string()) .add_attribute(DELEGATION_TARGET_KEY, mix_id.to_string())
} }
@@ -278,59 +252,43 @@ pub fn new_pending_rewarding_params_update_event(
) )
} }
pub fn new_undelegation_event( pub fn new_undelegation_event(created_at: BlockHeight, delegator: &Addr, mix_id: MixId) -> Event {
created_at: BlockHeight,
delegator: &Addr,
proxy: &Option<Addr>,
mix_id: MixId,
) -> Event {
Event::new(MixnetEventType::Undelegation) Event::new(MixnetEventType::Undelegation)
.add_attribute(EVENT_CREATION_HEIGHT_KEY, created_at.to_string()) .add_attribute(EVENT_CREATION_HEIGHT_KEY, created_at.to_string())
.add_attribute(DELEGATOR_KEY, delegator) .add_attribute(DELEGATOR_KEY, delegator)
.add_optional_attribute(PROXY_KEY, proxy.as_ref())
.add_attribute(MIX_ID_KEY, mix_id.to_string()) .add_attribute(MIX_ID_KEY, mix_id.to_string())
} }
pub fn new_pending_undelegation_event( pub fn new_pending_undelegation_event(delegator: &Addr, mix_id: MixId) -> Event {
delegator: &Addr,
proxy: &Option<Addr>,
mix_id: MixId,
) -> Event {
Event::new(MixnetEventType::PendingUndelegation) Event::new(MixnetEventType::PendingUndelegation)
.add_attribute(DELEGATOR_KEY, delegator) .add_attribute(DELEGATOR_KEY, delegator)
.add_optional_attribute(PROXY_KEY, proxy.as_ref())
.add_attribute(MIX_ID_KEY, mix_id.to_string()) .add_attribute(MIX_ID_KEY, mix_id.to_string())
} }
pub fn new_gateway_bonding_event( pub fn new_gateway_bonding_event(
owner: &Addr, owner: &Addr,
proxy: &Option<Addr>,
amount: &Coin, amount: &Coin,
identity: IdentityKeyRef<'_>, identity: IdentityKeyRef<'_>,
) -> Event { ) -> Event {
Event::new(MixnetEventType::GatewayBonding) Event::new(MixnetEventType::GatewayBonding)
.add_attribute(OWNER_KEY, owner) .add_attribute(OWNER_KEY, owner)
.add_attribute(NODE_IDENTITY_KEY, identity) .add_attribute(NODE_IDENTITY_KEY, identity)
.add_optional_attribute(PROXY_KEY, proxy.as_ref())
.add_attribute(AMOUNT_KEY, amount.to_string()) .add_attribute(AMOUNT_KEY, amount.to_string())
} }
pub fn new_gateway_unbonding_event( pub fn new_gateway_unbonding_event(
owner: &Addr, owner: &Addr,
proxy: &Option<Addr>,
amount: &Coin, amount: &Coin,
identity: IdentityKeyRef<'_>, identity: IdentityKeyRef<'_>,
) -> Event { ) -> Event {
Event::new(MixnetEventType::GatewayUnbonding) Event::new(MixnetEventType::GatewayUnbonding)
.add_attribute(OWNER_KEY, owner) .add_attribute(OWNER_KEY, owner)
.add_attribute(NODE_IDENTITY_KEY, identity) .add_attribute(NODE_IDENTITY_KEY, identity)
.add_optional_attribute(PROXY_KEY, proxy.as_ref())
.add_attribute(AMOUNT_KEY, amount.to_string()) .add_attribute(AMOUNT_KEY, amount.to_string())
} }
pub fn new_mixnode_bonding_event( pub fn new_mixnode_bonding_event(
owner: &Addr, owner: &Addr,
proxy: &Option<Addr>,
amount: &Coin, amount: &Coin,
identity: IdentityKeyRef<'_>, identity: IdentityKeyRef<'_>,
mix_id: MixId, mix_id: MixId,
@@ -341,7 +299,6 @@ pub fn new_mixnode_bonding_event(
.add_attribute(MIX_ID_KEY, mix_id.to_string()) .add_attribute(MIX_ID_KEY, mix_id.to_string())
.add_attribute(NODE_IDENTITY_KEY, identity) .add_attribute(NODE_IDENTITY_KEY, identity)
.add_attribute(OWNER_KEY, owner) .add_attribute(OWNER_KEY, owner)
.add_optional_attribute(PROXY_KEY, proxy.as_ref())
.add_attribute(ASSIGNED_LAYER_KEY, assigned_layer) .add_attribute(ASSIGNED_LAYER_KEY, assigned_layer)
.add_attribute(AMOUNT_KEY, amount.to_string()) .add_attribute(AMOUNT_KEY, amount.to_string())
} }
@@ -380,7 +337,6 @@ pub fn new_mixnode_unbonding_event(created_at: BlockHeight, mix_id: MixId) -> Ev
pub fn new_pending_mixnode_unbonding_event( pub fn new_pending_mixnode_unbonding_event(
owner: &Addr, owner: &Addr,
proxy: &Option<Addr>,
identity: IdentityKeyRef<'_>, identity: IdentityKeyRef<'_>,
mix_id: MixId, mix_id: MixId,
) -> Event { ) -> Event {
@@ -388,43 +344,33 @@ pub fn new_pending_mixnode_unbonding_event(
.add_attribute(MIX_ID_KEY, mix_id.to_string()) .add_attribute(MIX_ID_KEY, mix_id.to_string())
.add_attribute(NODE_IDENTITY_KEY, identity) .add_attribute(NODE_IDENTITY_KEY, identity)
.add_attribute(OWNER_KEY, owner) .add_attribute(OWNER_KEY, owner)
.add_optional_attribute(PROXY_KEY, proxy.as_ref())
} }
pub fn new_mixnode_config_update_event( pub fn new_mixnode_config_update_event(
mix_id: MixId, mix_id: MixId,
owner: &Addr, owner: &Addr,
proxy: &Option<Addr>,
update: &MixNodeConfigUpdate, update: &MixNodeConfigUpdate,
) -> Event { ) -> Event {
Event::new(MixnetEventType::MixnodeConfigUpdate) Event::new(MixnetEventType::MixnodeConfigUpdate)
.add_attribute(MIX_ID_KEY, mix_id.to_string()) .add_attribute(MIX_ID_KEY, mix_id.to_string())
.add_attribute(OWNER_KEY, owner) .add_attribute(OWNER_KEY, owner)
.add_optional_attribute(PROXY_KEY, proxy.as_ref())
.add_attribute(UPDATED_MIXNODE_CONFIG_KEY, update.to_inline_json()) .add_attribute(UPDATED_MIXNODE_CONFIG_KEY, update.to_inline_json())
} }
pub fn new_gateway_config_update_event( pub fn new_gateway_config_update_event(owner: &Addr, update: &GatewayConfigUpdate) -> Event {
owner: &Addr,
proxy: &Option<Addr>,
update: &GatewayConfigUpdate,
) -> Event {
Event::new(MixnetEventType::GatewayConfigUpdate) Event::new(MixnetEventType::GatewayConfigUpdate)
.add_attribute(OWNER_KEY, owner) .add_attribute(OWNER_KEY, owner)
.add_optional_attribute(PROXY_KEY, proxy.as_ref())
.add_attribute(UPDATED_GATEWAY_CONFIG_KEY, update.to_inline_json()) .add_attribute(UPDATED_GATEWAY_CONFIG_KEY, update.to_inline_json())
} }
pub fn new_mixnode_pending_cost_params_update_event( pub fn new_mixnode_pending_cost_params_update_event(
mix_id: MixId, mix_id: MixId,
owner: &Addr, owner: &Addr,
proxy: &Option<Addr>,
new_costs: &MixNodeCostParams, new_costs: &MixNodeCostParams,
) -> Event { ) -> Event {
Event::new(MixnetEventType::PendingMixnodeCostParamsUpdate) Event::new(MixnetEventType::PendingMixnodeCostParamsUpdate)
.add_attribute(MIX_ID_KEY, mix_id.to_string()) .add_attribute(MIX_ID_KEY, mix_id.to_string())
.add_attribute(OWNER_KEY, owner) .add_attribute(OWNER_KEY, owner)
.add_optional_attribute(PROXY_KEY, proxy.as_ref())
.add_attribute(UPDATED_MIXNODE_COST_PARAMS_KEY, new_costs.to_inline_json()) .add_attribute(UPDATED_MIXNODE_COST_PARAMS_KEY, new_costs.to_inline_json())
} }
@@ -3,7 +3,6 @@
use crate::{IdentityKey, IdentityKeyRef}; use crate::{IdentityKey, IdentityKeyRef};
use cosmwasm_schema::cw_serde; use cosmwasm_schema::cw_serde;
use cosmwasm_std::Addr;
use schemars::JsonSchema; use schemars::JsonSchema;
use serde::{Deserialize, Deserializer, Serialize, Serializer}; use serde::{Deserialize, Deserializer, Serialize, Serializer};
use std::fmt::{Display, Formatter}; use std::fmt::{Display, Formatter};
@@ -84,10 +83,10 @@ impl FamilyHead {
} }
impl Family { impl Family {
pub fn new(head: FamilyHead, proxy: Option<Addr>, label: String) -> Self { pub fn new(head: FamilyHead, label: String) -> Self {
Family { Family {
head, head,
proxy: proxy.map(|p| p.to_string()), proxy: None,
label, label,
} }
} }
@@ -55,19 +55,13 @@ pub struct GatewayBond {
} }
impl GatewayBond { impl GatewayBond {
pub fn new( pub fn new(pledge_amount: Coin, owner: Addr, block_height: u64, gateway: Gateway) -> Self {
pledge_amount: Coin,
owner: Addr,
block_height: u64,
gateway: Gateway,
proxy: Option<Addr>,
) -> Self {
GatewayBond { GatewayBond {
pledge_amount, pledge_amount,
owner, owner,
block_height, block_height,
gateway, gateway,
proxy, proxy: None,
} }
} }
@@ -10,7 +10,10 @@ use crate::helpers::IntoBaseDecimal;
use crate::reward_params::{NodeRewardParams, RewardingParams}; use crate::reward_params::{NodeRewardParams, RewardingParams};
use crate::rewarding::helpers::truncate_reward; use crate::rewarding::helpers::truncate_reward;
use crate::rewarding::RewardDistribution; use crate::rewarding::RewardDistribution;
use crate::{Delegation, EpochEventId, EpochId, IdentityKey, MixId, Percent, SphinxKey}; use crate::{
Delegation, EpochEventId, EpochId, IdentityKey, MixId, OperatingCostRange, Percent,
ProfitMarginRange, SphinxKey,
};
use cosmwasm_schema::cw_serde; use cosmwasm_schema::cw_serde;
use cosmwasm_std::{Addr, Coin, Decimal, StdResult, Uint128}; use cosmwasm_std::{Addr, Coin, Decimal, StdResult, Uint128};
use schemars::JsonSchema; use schemars::JsonSchema;
@@ -152,6 +155,16 @@ impl MixNodeRewarding {
}) })
} }
pub fn normalise_profit_margin(&mut self, allowed_range: ProfitMarginRange) {
self.cost_params.profit_margin_percent =
allowed_range.normalise(self.cost_params.profit_margin_percent)
}
pub fn normalise_operating_cost(&mut self, allowed_range: OperatingCostRange) {
self.cost_params.interval_operating_cost.amount =
allowed_range.normalise(self.cost_params.interval_operating_cost.amount)
}
/// Determines whether this node is still bonded. This is performed via a simple check, /// Determines whether this node is still bonded. This is performed via a simple check,
/// if there are no tokens left associated with the operator, it means they have unbonded /// if there are no tokens left associated with the operator, it means they have unbonded
/// and those params only exist for the purposes of calculating rewards for delegators that /// and those params only exist for the purposes of calculating rewards for delegators that
@@ -518,7 +531,6 @@ impl MixNodeBond {
original_pledge: Coin, original_pledge: Coin,
layer: Layer, layer: Layer,
mix_node: MixNode, mix_node: MixNode,
proxy: Option<Addr>,
bonding_height: u64, bonding_height: u64,
) -> Self { ) -> Self {
MixNodeBond { MixNodeBond {
@@ -527,7 +539,7 @@ impl MixNodeBond {
original_pledge, original_pledge,
layer, layer,
mix_node, mix_node,
proxy, proxy: None,
bonding_height, bonding_height,
is_unbonding: false, is_unbonding: false,
} }
@@ -1,4 +1,4 @@
// Copyright 2021-2023 - Nym Technologies SA <contact@nymtech.net> // Copyright 2021-2024 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
use crate::delegation::{self, OwnerProxySubKey}; use crate::delegation::{self, OwnerProxySubKey};
@@ -12,6 +12,7 @@ use crate::reward_params::{
IntervalRewardParams, IntervalRewardingParamsUpdate, Performance, RewardingParams, IntervalRewardParams, IntervalRewardingParamsUpdate, Performance, RewardingParams,
}; };
use crate::types::{ContractStateParams, LayerAssignment, MixId}; use crate::types::{ContractStateParams, LayerAssignment, MixId};
use crate::{OperatingCostRange, ProfitMarginRange};
use contracts_common::{signing::MessageSignature, IdentityKey, Percent}; use contracts_common::{signing::MessageSignature, IdentityKey, Percent};
use cosmwasm_schema::cw_serde; use cosmwasm_schema::cw_serde;
use cosmwasm_std::{Coin, Decimal}; use cosmwasm_std::{Coin, Decimal};
@@ -57,6 +58,12 @@ pub struct InstantiateMsg {
pub epochs_in_interval: u32, pub epochs_in_interval: u32,
pub epoch_duration: Duration, pub epoch_duration: Duration,
pub initial_rewarding_params: InitialRewardingParams, pub initial_rewarding_params: InitialRewardingParams,
#[serde(default)]
pub profit_margin: ProfitMarginRange,
#[serde(default)]
pub interval_operating_cost: OperatingCostRange,
} }
#[cw_serde] #[cw_serde]
@@ -269,6 +276,12 @@ pub enum ExecuteMsg {
owner: String, owner: String,
}, },
// vesting migration:
MigrateVestedMixNode {},
MigrateVestedDelegation {
mix_id: MixId,
},
// testing-only // testing-only
#[cfg(feature = "contract-testing")] #[cfg(feature = "contract-testing")]
TestingResolveAllPendingEvents { TestingResolveAllPendingEvents {
@@ -381,6 +394,9 @@ impl ExecuteMsg {
ExecuteMsg::WithdrawDelegatorRewardOnBehalf { mix_id, .. } => { ExecuteMsg::WithdrawDelegatorRewardOnBehalf { mix_id, .. } => {
format!("withdrawing delegator reward from mixnode {mix_id} on behalf") format!("withdrawing delegator reward from mixnode {mix_id} on behalf")
} }
ExecuteMsg::MigrateVestedMixNode { .. } => "migrate vested mixnode".into(),
ExecuteMsg::MigrateVestedDelegation { .. } => "migrate vested delegation".to_string(),
#[cfg(feature = "contract-testing")] #[cfg(feature = "contract-testing")]
ExecuteMsg::TestingResolveAllPendingEvents { .. } => { ExecuteMsg::TestingResolveAllPendingEvents { .. } => {
"resolving all pending events".into() "resolving all pending events".into()

Some files were not shown because too many files have changed in this diff Show More