From 7453870ce2720fe6cfbc6517cf004be2db2f67d7 Mon Sep 17 00:00:00 2001 From: dynco-nym <173912580+dynco-nym@users.noreply.github.com> Date: Wed, 30 Oct 2024 15:25:12 +0100 Subject: [PATCH] Compatible with directory v2 --- Cargo.lock | 345 +++--------------- nym-node-status-agent/run.sh | 14 +- nym-node-status-api/Cargo.toml | 7 +- nym-node-status-api/launch_node_status_api.sh | 1 + .../src/db/queries/gateways.rs | 6 +- nym-node-status-api/src/monitor/mod.rs | 107 ++++-- 6 files changed, 148 insertions(+), 332 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 06cc8d68b2..49eaeb2567 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4563,33 +4563,7 @@ dependencies = [ [[package]] name = "nym-api-requests" version = "0.1.0" -source = "git+https://github.com/nymtech/nym?branch=pre-dir-v2-fork#8d68cf88dac1adf1f68726a9b6e0740f8cddcf32" -dependencies = [ - "bs58", - "cosmrs 0.17.0-pre", - "cosmwasm-std", - "ecdsa", - "getset", - "nym-compact-ecash 0.1.0 (git+https://github.com/nymtech/nym?branch=pre-dir-v2-fork)", - "nym-credentials-interface 0.1.0 (git+https://github.com/nymtech/nym?branch=pre-dir-v2-fork)", - "nym-crypto 0.4.0 (git+https://github.com/nymtech/nym?branch=pre-dir-v2-fork)", - "nym-ecash-time 0.1.0 (git+https://github.com/nymtech/nym?branch=pre-dir-v2-fork)", - "nym-mixnet-contract-common 0.6.0 (git+https://github.com/nymtech/nym?branch=pre-dir-v2-fork)", - "nym-node-requests 0.1.0 (git+https://github.com/nymtech/nym?branch=pre-dir-v2-fork)", - "nym-serde-helpers 0.1.0 (git+https://github.com/nymtech/nym?branch=pre-dir-v2-fork)", - "schemars", - "serde", - "sha2 0.10.8", - "tendermint 0.37.0", - "thiserror", - "time", - "utoipa", -] - -[[package]] -name = "nym-api-requests" -version = "0.1.0" -source = "git+https://github.com/nymtech/nym?branch=release/2024.13-magura#317f7fffa986dff856e5b980b15872620bc052f0" +source = "git+https://github.com/nymtech/nym?branch=release/2024.13-magura#753a21f8ca855617d4dc637800b860487c68adab" dependencies = [ "bs58", "cosmrs 0.17.0-pre", @@ -4732,22 +4706,7 @@ dependencies = [ [[package]] name = "nym-bin-common" version = "0.6.0" -source = "git+https://github.com/nymtech/nym?branch=pre-dir-v2-fork#8d68cf88dac1adf1f68726a9b6e0740f8cddcf32" -dependencies = [ - "const-str", - "log", - "pretty_env_logger", - "schemars", - "semver 1.0.23", - "serde", - "utoipa", - "vergen", -] - -[[package]] -name = "nym-bin-common" -version = "0.6.0" -source = "git+https://github.com/nymtech/nym?branch=release/2024.13-magura#317f7fffa986dff856e5b980b15872620bc052f0" +source = "git+https://github.com/nymtech/nym?branch=release/2024.13-magura#753a21f8ca855617d4dc637800b860487c68adab" dependencies = [ "const-str", "log", @@ -5071,11 +5030,11 @@ dependencies = [ [[package]] name = "nym-coconut-bandwidth-contract-common" version = "0.1.0" -source = "git+https://github.com/nymtech/nym?branch=pre-dir-v2-fork#8d68cf88dac1adf1f68726a9b6e0740f8cddcf32" +source = "git+https://github.com/nymtech/nym?branch=release/2024.13-magura#753a21f8ca855617d4dc637800b860487c68adab" dependencies = [ "cosmwasm-schema", "cosmwasm-std", - "nym-multisig-contract-common 0.1.0 (git+https://github.com/nymtech/nym?branch=pre-dir-v2-fork)", + "nym-multisig-contract-common 0.1.0 (git+https://github.com/nymtech/nym?branch=release/2024.13-magura)", ] [[package]] @@ -5094,15 +5053,15 @@ dependencies = [ [[package]] name = "nym-coconut-dkg-common" version = "0.1.0" -source = "git+https://github.com/nymtech/nym?branch=pre-dir-v2-fork#8d68cf88dac1adf1f68726a9b6e0740f8cddcf32" +source = "git+https://github.com/nymtech/nym?branch=release/2024.13-magura#753a21f8ca855617d4dc637800b860487c68adab" dependencies = [ "cosmwasm-schema", "cosmwasm-std", "cw-utils", "cw2", "cw4", - "nym-contracts-common 0.5.0 (git+https://github.com/nymtech/nym?branch=pre-dir-v2-fork)", - "nym-multisig-contract-common 0.1.0 (git+https://github.com/nymtech/nym?branch=pre-dir-v2-fork)", + "nym-contracts-common 0.5.0 (git+https://github.com/nymtech/nym?branch=release/2024.13-magura)", + "nym-multisig-contract-common 0.1.0 (git+https://github.com/nymtech/nym?branch=release/2024.13-magura)", ] [[package]] @@ -5139,29 +5098,7 @@ dependencies = [ [[package]] name = "nym-compact-ecash" version = "0.1.0" -source = "git+https://github.com/nymtech/nym?branch=pre-dir-v2-fork#8d68cf88dac1adf1f68726a9b6e0740f8cddcf32" -dependencies = [ - "bincode", - "bls12_381", - "bs58", - "cfg-if", - "digest 0.9.0", - "ff", - "group", - "itertools 0.12.1", - "nym-network-defaults 0.1.0 (git+https://github.com/nymtech/nym?branch=pre-dir-v2-fork)", - "nym-pemstore 0.3.0 (git+https://github.com/nymtech/nym?branch=pre-dir-v2-fork)", - "rand", - "serde", - "sha2 0.9.9", - "thiserror", - "zeroize", -] - -[[package]] -name = "nym-compact-ecash" -version = "0.1.0" -source = "git+https://github.com/nymtech/nym?branch=release/2024.13-magura#317f7fffa986dff856e5b980b15872620bc052f0" +source = "git+https://github.com/nymtech/nym?branch=release/2024.13-magura#753a21f8ca855617d4dc637800b860487c68adab" dependencies = [ "bincode", "bls12_381", @@ -5197,21 +5134,7 @@ dependencies = [ [[package]] name = "nym-config" version = "0.1.0" -source = "git+https://github.com/nymtech/nym?branch=pre-dir-v2-fork#8d68cf88dac1adf1f68726a9b6e0740f8cddcf32" -dependencies = [ - "dirs", - "handlebars", - "log", - "nym-network-defaults 0.1.0 (git+https://github.com/nymtech/nym?branch=pre-dir-v2-fork)", - "serde", - "toml 0.8.14", - "url", -] - -[[package]] -name = "nym-config" -version = "0.1.0" -source = "git+https://github.com/nymtech/nym?branch=release/2024.13-magura#317f7fffa986dff856e5b980b15872620bc052f0" +source = "git+https://github.com/nymtech/nym?branch=release/2024.13-magura#753a21f8ca855617d4dc637800b860487c68adab" dependencies = [ "dirs", "handlebars", @@ -5240,22 +5163,7 @@ dependencies = [ [[package]] name = "nym-contracts-common" version = "0.5.0" -source = "git+https://github.com/nymtech/nym?branch=pre-dir-v2-fork#8d68cf88dac1adf1f68726a9b6e0740f8cddcf32" -dependencies = [ - "bs58", - "cosmwasm-schema", - "cosmwasm-std", - "cw-storage-plus", - "schemars", - "serde", - "thiserror", - "vergen", -] - -[[package]] -name = "nym-contracts-common" -version = "0.5.0" -source = "git+https://github.com/nymtech/nym?branch=release/2024.13-magura#317f7fffa986dff856e5b980b15872620bc052f0" +source = "git+https://github.com/nymtech/nym?branch=release/2024.13-magura#753a21f8ca855617d4dc637800b860487c68adab" dependencies = [ "bs58", "cosmwasm-schema", @@ -5459,23 +5367,7 @@ dependencies = [ [[package]] name = "nym-credentials-interface" version = "0.1.0" -source = "git+https://github.com/nymtech/nym?branch=pre-dir-v2-fork#8d68cf88dac1adf1f68726a9b6e0740f8cddcf32" -dependencies = [ - "bls12_381", - "nym-compact-ecash 0.1.0 (git+https://github.com/nymtech/nym?branch=pre-dir-v2-fork)", - "nym-ecash-time 0.1.0 (git+https://github.com/nymtech/nym?branch=pre-dir-v2-fork)", - "nym-network-defaults 0.1.0 (git+https://github.com/nymtech/nym?branch=pre-dir-v2-fork)", - "rand", - "serde", - "strum 0.26.3", - "thiserror", - "time", -] - -[[package]] -name = "nym-credentials-interface" -version = "0.1.0" -source = "git+https://github.com/nymtech/nym?branch=release/2024.13-magura#317f7fffa986dff856e5b980b15872620bc052f0" +source = "git+https://github.com/nymtech/nym?branch=release/2024.13-magura#753a21f8ca855617d4dc637800b860487c68adab" dependencies = [ "bls12_381", "nym-compact-ecash 0.1.0 (git+https://github.com/nymtech/nym?branch=release/2024.13-magura)", @@ -5519,24 +5411,7 @@ dependencies = [ [[package]] name = "nym-crypto" version = "0.4.0" -source = "git+https://github.com/nymtech/nym?branch=pre-dir-v2-fork#8d68cf88dac1adf1f68726a9b6e0740f8cddcf32" -dependencies = [ - "bs58", - "ed25519-dalek", - "nym-pemstore 0.3.0 (git+https://github.com/nymtech/nym?branch=pre-dir-v2-fork)", - "nym-sphinx-types 0.2.0 (git+https://github.com/nymtech/nym?branch=pre-dir-v2-fork)", - "serde", - "serde_bytes", - "subtle-encoding", - "thiserror", - "x25519-dalek", - "zeroize", -] - -[[package]] -name = "nym-crypto" -version = "0.4.0" -source = "git+https://github.com/nymtech/nym?branch=release/2024.13-magura#317f7fffa986dff856e5b980b15872620bc052f0" +source = "git+https://github.com/nymtech/nym?branch=release/2024.13-magura#753a21f8ca855617d4dc637800b860487c68adab" dependencies = [ "bs58", "ed25519-dalek", @@ -5615,14 +5490,14 @@ dependencies = [ [[package]] name = "nym-ecash-contract-common" version = "0.1.0" -source = "git+https://github.com/nymtech/nym?branch=pre-dir-v2-fork#8d68cf88dac1adf1f68726a9b6e0740f8cddcf32" +source = "git+https://github.com/nymtech/nym?branch=release/2024.13-magura#753a21f8ca855617d4dc637800b860487c68adab" dependencies = [ "bs58", "cosmwasm-schema", "cosmwasm-std", "cw-controllers", "cw-utils", - "nym-multisig-contract-common 0.1.0 (git+https://github.com/nymtech/nym?branch=pre-dir-v2-fork)", + "nym-multisig-contract-common 0.1.0 (git+https://github.com/nymtech/nym?branch=release/2024.13-magura)", "thiserror", ] @@ -5646,15 +5521,7 @@ dependencies = [ [[package]] name = "nym-ecash-time" version = "0.1.0" -source = "git+https://github.com/nymtech/nym?branch=pre-dir-v2-fork#8d68cf88dac1adf1f68726a9b6e0740f8cddcf32" -dependencies = [ - "time", -] - -[[package]] -name = "nym-ecash-time" -version = "0.1.0" -source = "git+https://github.com/nymtech/nym?branch=release/2024.13-magura#317f7fffa986dff856e5b980b15872620bc052f0" +source = "git+https://github.com/nymtech/nym?branch=release/2024.13-magura#753a21f8ca855617d4dc637800b860487c68adab" dependencies = [ "time", ] @@ -5682,19 +5549,7 @@ dependencies = [ [[package]] name = "nym-exit-policy" version = "0.1.0" -source = "git+https://github.com/nymtech/nym?branch=pre-dir-v2-fork#8d68cf88dac1adf1f68726a9b6e0740f8cddcf32" -dependencies = [ - "serde", - "serde_json", - "thiserror", - "tracing", - "utoipa", -] - -[[package]] -name = "nym-exit-policy" -version = "0.1.0" -source = "git+https://github.com/nymtech/nym?branch=release/2024.13-magura#317f7fffa986dff856e5b980b15872620bc052f0" +source = "git+https://github.com/nymtech/nym?branch=release/2024.13-magura#753a21f8ca855617d4dc637800b860487c68adab" dependencies = [ "serde", "serde_json", @@ -5718,7 +5573,7 @@ dependencies = [ [[package]] name = "nym-explorer-api-requests" version = "0.1.0" -source = "git+https://github.com/nymtech/nym?branch=release/2024.13-magura#317f7fffa986dff856e5b980b15872620bc052f0" +source = "git+https://github.com/nymtech/nym?branch=release/2024.13-magura#753a21f8ca855617d4dc637800b860487c68adab" dependencies = [ "nym-api-requests 0.1.0 (git+https://github.com/nymtech/nym?branch=release/2024.13-magura)", "nym-contracts-common 0.5.0 (git+https://github.com/nymtech/nym?branch=release/2024.13-magura)", @@ -5743,7 +5598,7 @@ dependencies = [ [[package]] name = "nym-explorer-client" version = "0.1.0" -source = "git+https://github.com/nymtech/nym?branch=release/2024.13-magura#317f7fffa986dff856e5b980b15872620bc052f0" +source = "git+https://github.com/nymtech/nym?branch=release/2024.13-magura#753a21f8ca855617d4dc637800b860487c68adab" dependencies = [ "log", "nym-explorer-api-requests 0.1.0 (git+https://github.com/nymtech/nym?branch=release/2024.13-magura)", @@ -5953,7 +5808,7 @@ dependencies = [ [[package]] name = "nym-group-contract-common" version = "0.1.0" -source = "git+https://github.com/nymtech/nym?branch=pre-dir-v2-fork#8d68cf88dac1adf1f68726a9b6e0740f8cddcf32" +source = "git+https://github.com/nymtech/nym?branch=release/2024.13-magura#753a21f8ca855617d4dc637800b860487c68adab" dependencies = [ "cosmwasm-schema", "cw-controllers", @@ -5981,11 +5836,11 @@ dependencies = [ [[package]] name = "nym-http-api-client" version = "0.1.0" -source = "git+https://github.com/nymtech/nym?branch=pre-dir-v2-fork#8d68cf88dac1adf1f68726a9b6e0740f8cddcf32" +source = "git+https://github.com/nymtech/nym?branch=release/2024.13-magura#753a21f8ca855617d4dc637800b860487c68adab" dependencies = [ "async-trait", "http 1.1.0", - "nym-bin-common 0.6.0 (git+https://github.com/nymtech/nym?branch=pre-dir-v2-fork)", + "nym-bin-common 0.6.0 (git+https://github.com/nymtech/nym?branch=release/2024.13-magura)", "reqwest 0.12.4", "serde", "serde_json", @@ -6165,27 +6020,7 @@ dependencies = [ [[package]] name = "nym-mixnet-contract-common" version = "0.6.0" -source = "git+https://github.com/nymtech/nym?branch=pre-dir-v2-fork#8d68cf88dac1adf1f68726a9b6e0740f8cddcf32" -dependencies = [ - "bs58", - "cosmwasm-schema", - "cosmwasm-std", - "cw-controllers", - "humantime-serde", - "log", - "nym-contracts-common 0.5.0 (git+https://github.com/nymtech/nym?branch=pre-dir-v2-fork)", - "schemars", - "serde", - "serde-json-wasm", - "serde_repr", - "thiserror", - "time", -] - -[[package]] -name = "nym-mixnet-contract-common" -version = "0.6.0" -source = "git+https://github.com/nymtech/nym?branch=release/2024.13-magura#317f7fffa986dff856e5b980b15872620bc052f0" +source = "git+https://github.com/nymtech/nym?branch=release/2024.13-magura#753a21f8ca855617d4dc637800b860487c68adab" dependencies = [ "bs58", "cosmwasm-schema", @@ -6296,7 +6131,7 @@ dependencies = [ [[package]] name = "nym-multisig-contract-common" version = "0.1.0" -source = "git+https://github.com/nymtech/nym?branch=pre-dir-v2-fork#8d68cf88dac1adf1f68726a9b6e0740f8cddcf32" +source = "git+https://github.com/nymtech/nym?branch=release/2024.13-magura#753a21f8ca855617d4dc637800b860487c68adab" dependencies = [ "cosmwasm-schema", "cosmwasm-std", @@ -6324,20 +6159,7 @@ dependencies = [ [[package]] name = "nym-network-defaults" version = "0.1.0" -source = "git+https://github.com/nymtech/nym?branch=pre-dir-v2-fork#8d68cf88dac1adf1f68726a9b6e0740f8cddcf32" -dependencies = [ - "dotenvy", - "log", - "schemars", - "serde", - "url", - "utoipa", -] - -[[package]] -name = "nym-network-defaults" -version = "0.1.0" -source = "git+https://github.com/nymtech/nym?branch=release/2024.13-magura#317f7fffa986dff856e5b980b15872620bc052f0" +source = "git+https://github.com/nymtech/nym?branch=release/2024.13-magura#753a21f8ca855617d4dc637800b860487c68adab" dependencies = [ "dotenvy", "log", @@ -6532,31 +6354,9 @@ dependencies = [ [[package]] name = "nym-node-requests" version = "0.1.0" -source = "git+https://github.com/nymtech/nym?branch=pre-dir-v2-fork#8d68cf88dac1adf1f68726a9b6e0740f8cddcf32" +source = "git+https://github.com/nymtech/nym?branch=release/2024.13-magura#753a21f8ca855617d4dc637800b860487c68adab" dependencies = [ "async-trait", - "base64 0.22.1", - "celes", - "humantime 2.1.0", - "humantime-serde", - "nym-bin-common 0.6.0 (git+https://github.com/nymtech/nym?branch=pre-dir-v2-fork)", - "nym-crypto 0.4.0 (git+https://github.com/nymtech/nym?branch=pre-dir-v2-fork)", - "nym-exit-policy 0.1.0 (git+https://github.com/nymtech/nym?branch=pre-dir-v2-fork)", - "nym-http-api-client 0.1.0 (git+https://github.com/nymtech/nym?branch=pre-dir-v2-fork)", - "nym-wireguard-types 0.1.0 (git+https://github.com/nymtech/nym?branch=pre-dir-v2-fork)", - "schemars", - "serde", - "serde_json", - "thiserror", - "time", - "utoipa", -] - -[[package]] -name = "nym-node-requests" -version = "0.1.0" -source = "git+https://github.com/nymtech/nym?branch=release/2024.13-magura#317f7fffa986dff856e5b980b15872620bc052f0" -dependencies = [ "base64 0.22.1", "celes", "humantime 2.1.0", @@ -6564,6 +6364,7 @@ dependencies = [ "nym-bin-common 0.6.0 (git+https://github.com/nymtech/nym?branch=release/2024.13-magura)", "nym-crypto 0.4.0 (git+https://github.com/nymtech/nym?branch=release/2024.13-magura)", "nym-exit-policy 0.1.0 (git+https://github.com/nymtech/nym?branch=release/2024.13-magura)", + "nym-http-api-client 0.1.0 (git+https://github.com/nymtech/nym?branch=release/2024.13-magura)", "nym-wireguard-types 0.1.0 (git+https://github.com/nymtech/nym?branch=release/2024.13-magura)", "schemars", "serde", @@ -6604,10 +6405,10 @@ dependencies = [ "nym-bin-common 0.6.0", "nym-common-models", "nym-explorer-client 0.1.0 (git+https://github.com/nymtech/nym?branch=release/2024.13-magura)", - "nym-network-defaults 0.1.0 (git+https://github.com/nymtech/nym?branch=pre-dir-v2-fork)", - "nym-node-requests 0.1.0 (git+https://github.com/nymtech/nym?branch=pre-dir-v2-fork)", + "nym-network-defaults 0.1.0 (git+https://github.com/nymtech/nym?branch=release/2024.13-magura)", + "nym-node-requests 0.1.0 (git+https://github.com/nymtech/nym?branch=release/2024.13-magura)", "nym-task", - "nym-validator-client 0.1.0 (git+https://github.com/nymtech/nym?branch=pre-dir-v2-fork)", + "nym-validator-client 0.1.0 (git+https://github.com/nymtech/nym?branch=release/2024.13-magura)", "regex", "reqwest 0.12.4", "serde", @@ -6731,15 +6532,7 @@ dependencies = [ [[package]] name = "nym-pemstore" version = "0.3.0" -source = "git+https://github.com/nymtech/nym?branch=pre-dir-v2-fork#8d68cf88dac1adf1f68726a9b6e0740f8cddcf32" -dependencies = [ - "pem", -] - -[[package]] -name = "nym-pemstore" -version = "0.3.0" -source = "git+https://github.com/nymtech/nym?branch=release/2024.13-magura#317f7fffa986dff856e5b980b15872620bc052f0" +source = "git+https://github.com/nymtech/nym?branch=release/2024.13-magura#753a21f8ca855617d4dc637800b860487c68adab" dependencies = [ "pem", ] @@ -6812,21 +6605,11 @@ dependencies = [ [[package]] name = "nym-serde-helpers" version = "0.1.0" -source = "git+https://github.com/nymtech/nym?branch=pre-dir-v2-fork#8d68cf88dac1adf1f68726a9b6e0740f8cddcf32" -dependencies = [ - "base64 0.22.1", - "bs58", - "serde", - "time", -] - -[[package]] -name = "nym-serde-helpers" -version = "0.1.0" -source = "git+https://github.com/nymtech/nym?branch=release/2024.13-magura#317f7fffa986dff856e5b980b15872620bc052f0" +source = "git+https://github.com/nymtech/nym?branch=release/2024.13-magura#753a21f8ca855617d4dc637800b860487c68adab" dependencies = [ "base64 0.22.1", "bs58", + "hex", "serde", "time", ] @@ -7138,16 +6921,7 @@ dependencies = [ [[package]] name = "nym-sphinx-types" version = "0.2.0" -source = "git+https://github.com/nymtech/nym?branch=pre-dir-v2-fork#8d68cf88dac1adf1f68726a9b6e0740f8cddcf32" -dependencies = [ - "sphinx-packet", - "thiserror", -] - -[[package]] -name = "nym-sphinx-types" -version = "0.2.0" -source = "git+https://github.com/nymtech/nym?branch=release/2024.13-magura#317f7fffa986dff856e5b980b15872620bc052f0" +source = "git+https://github.com/nymtech/nym?branch=release/2024.13-magura#753a21f8ca855617d4dc637800b860487c68adab" dependencies = [ "sphinx-packet", "thiserror", @@ -7311,7 +7085,7 @@ dependencies = [ [[package]] name = "nym-validator-client" version = "0.1.0" -source = "git+https://github.com/nymtech/nym?branch=pre-dir-v2-fork#8d68cf88dac1adf1f68726a9b6e0740f8cddcf32" +source = "git+https://github.com/nymtech/nym?branch=release/2024.13-magura#753a21f8ca855617d4dc637800b860487c68adab" dependencies = [ "async-trait", "base64 0.22.1", @@ -7329,19 +7103,21 @@ dependencies = [ "flate2", "futures", "itertools 0.13.0", - "nym-api-requests 0.1.0 (git+https://github.com/nymtech/nym?branch=pre-dir-v2-fork)", - "nym-coconut-bandwidth-contract-common 0.1.0 (git+https://github.com/nymtech/nym?branch=pre-dir-v2-fork)", - "nym-coconut-dkg-common 0.1.0 (git+https://github.com/nymtech/nym?branch=pre-dir-v2-fork)", - "nym-compact-ecash 0.1.0 (git+https://github.com/nymtech/nym?branch=pre-dir-v2-fork)", - "nym-config 0.1.0 (git+https://github.com/nymtech/nym?branch=pre-dir-v2-fork)", - "nym-contracts-common 0.5.0 (git+https://github.com/nymtech/nym?branch=pre-dir-v2-fork)", - "nym-ecash-contract-common 0.1.0 (git+https://github.com/nymtech/nym?branch=pre-dir-v2-fork)", - "nym-group-contract-common 0.1.0 (git+https://github.com/nymtech/nym?branch=pre-dir-v2-fork)", - "nym-http-api-client 0.1.0 (git+https://github.com/nymtech/nym?branch=pre-dir-v2-fork)", - "nym-mixnet-contract-common 0.6.0 (git+https://github.com/nymtech/nym?branch=pre-dir-v2-fork)", - "nym-multisig-contract-common 0.1.0 (git+https://github.com/nymtech/nym?branch=pre-dir-v2-fork)", - "nym-network-defaults 0.1.0 (git+https://github.com/nymtech/nym?branch=pre-dir-v2-fork)", - "nym-vesting-contract-common 0.7.0 (git+https://github.com/nymtech/nym?branch=pre-dir-v2-fork)", + "log", + "nym-api-requests 0.1.0 (git+https://github.com/nymtech/nym?branch=release/2024.13-magura)", + "nym-coconut-bandwidth-contract-common 0.1.0 (git+https://github.com/nymtech/nym?branch=release/2024.13-magura)", + "nym-coconut-dkg-common 0.1.0 (git+https://github.com/nymtech/nym?branch=release/2024.13-magura)", + "nym-compact-ecash 0.1.0 (git+https://github.com/nymtech/nym?branch=release/2024.13-magura)", + "nym-config 0.1.0 (git+https://github.com/nymtech/nym?branch=release/2024.13-magura)", + "nym-contracts-common 0.5.0 (git+https://github.com/nymtech/nym?branch=release/2024.13-magura)", + "nym-ecash-contract-common 0.1.0 (git+https://github.com/nymtech/nym?branch=release/2024.13-magura)", + "nym-group-contract-common 0.1.0 (git+https://github.com/nymtech/nym?branch=release/2024.13-magura)", + "nym-http-api-client 0.1.0 (git+https://github.com/nymtech/nym?branch=release/2024.13-magura)", + "nym-mixnet-contract-common 0.6.0 (git+https://github.com/nymtech/nym?branch=release/2024.13-magura)", + "nym-multisig-contract-common 0.1.0 (git+https://github.com/nymtech/nym?branch=release/2024.13-magura)", + "nym-network-defaults 0.1.0 (git+https://github.com/nymtech/nym?branch=release/2024.13-magura)", + "nym-serde-helpers 0.1.0 (git+https://github.com/nymtech/nym?branch=release/2024.13-magura)", + "nym-vesting-contract-common 0.7.0 (git+https://github.com/nymtech/nym?branch=release/2024.13-magura)", "prost 0.12.6", "reqwest 0.12.4", "serde", @@ -7351,7 +7127,6 @@ dependencies = [ "thiserror", "time", "tokio", - "tracing", "url", "wasmtimer", "zeroize", @@ -7411,12 +7186,12 @@ dependencies = [ [[package]] name = "nym-vesting-contract-common" version = "0.7.0" -source = "git+https://github.com/nymtech/nym?branch=pre-dir-v2-fork#8d68cf88dac1adf1f68726a9b6e0740f8cddcf32" +source = "git+https://github.com/nymtech/nym?branch=release/2024.13-magura#753a21f8ca855617d4dc637800b860487c68adab" dependencies = [ "cosmwasm-schema", "cosmwasm-std", - "nym-contracts-common 0.5.0 (git+https://github.com/nymtech/nym?branch=pre-dir-v2-fork)", - "nym-mixnet-contract-common 0.6.0 (git+https://github.com/nymtech/nym?branch=pre-dir-v2-fork)", + "nym-contracts-common 0.5.0 (git+https://github.com/nymtech/nym?branch=release/2024.13-magura)", + "nym-mixnet-contract-common 0.6.0 (git+https://github.com/nymtech/nym?branch=release/2024.13-magura)", "serde", "thiserror", ] @@ -7508,21 +7283,7 @@ dependencies = [ [[package]] name = "nym-wireguard-types" version = "0.1.0" -source = "git+https://github.com/nymtech/nym?branch=pre-dir-v2-fork#8d68cf88dac1adf1f68726a9b6e0740f8cddcf32" -dependencies = [ - "base64 0.22.1", - "log", - "nym-config 0.1.0 (git+https://github.com/nymtech/nym?branch=pre-dir-v2-fork)", - "nym-network-defaults 0.1.0 (git+https://github.com/nymtech/nym?branch=pre-dir-v2-fork)", - "serde", - "thiserror", - "x25519-dalek", -] - -[[package]] -name = "nym-wireguard-types" -version = "0.1.0" -source = "git+https://github.com/nymtech/nym?branch=release/2024.13-magura#317f7fffa986dff856e5b980b15872620bc052f0" +source = "git+https://github.com/nymtech/nym?branch=release/2024.13-magura#753a21f8ca855617d4dc637800b860487c68adab" dependencies = [ "base64 0.22.1", "log", diff --git a/nym-node-status-agent/run.sh b/nym-node-status-agent/run.sh index 5054a90825..675e39c109 100755 --- a/nym-node-status-agent/run.sh +++ b/nym-node-status-agent/run.sh @@ -2,7 +2,11 @@ set -eu -export RUST_LOG=${RUST_LOG:-debug} +environment="qa" + +source ../envs/${environment}.env + +export RUST_LOG="debug" crate_root=$(dirname $(realpath "$0")) gateway_probe_src=$(dirname $(dirname "$crate_root"))/nym-vpn-client/nym-vpn-core @@ -14,6 +18,8 @@ export NODE_STATUS_AGENT_PROBE_PATH="$crate_root/nym-gateway-probe" # build & copy over GW probe function copy_gw_probe() { pushd $gateway_probe_src + git switch main + git pull cargo build --release --package nym-gateway-probe cp target/release/nym-gateway-probe "$crate_root" $crate_root/nym-gateway-probe --version @@ -30,8 +36,8 @@ function swarm() { build_agent - for ((i=1; i<=$workers; i++)); do - ../target/release/nym-node-status-agent run-probe & + for ((i = 1; i <= $workers; i++)); do + ../target/release/nym-node-status-agent run-probe & done wait @@ -44,6 +50,6 @@ export NODE_STATUS_AGENT_SERVER_PORT="8000" copy_gw_probe -swarm 30 +swarm 8 # cargo run -- run-probe diff --git a/nym-node-status-api/Cargo.toml b/nym-node-status-api/Cargo.toml index 907e0daf23..f37bfd2a0f 100644 --- a/nym-node-status-api/Cargo.toml +++ b/nym-node-status-api/Cargo.toml @@ -15,6 +15,7 @@ rust-version.workspace = true [dependencies] anyhow = { workspace = true } axum = { workspace = true, features = ["tokio", "macros"] } +# TODO dz try to use time instead of chrono ? chrono = { workspace = true } clap = { workspace = true, features = ["cargo", "derive", "env", "string"] } cosmwasm-std = { workspace = true } @@ -26,12 +27,12 @@ nym-common-models = { path = "../common/models" } # nym-explorer-client = { path = "../explorer-api/explorer-client" } nym-explorer-client = { git = "https://github.com/nymtech/nym", branch = "release/2024.13-magura" } # TODO dz: before Nym API client breaking changes. Update to latest develop once new Nym API is live -nym-network-defaults = { git = "https://github.com/nymtech/nym", branch = "pre-dir-v2-fork" } -nym-validator-client = { git = "https://github.com/nymtech/nym", branch = "pre-dir-v2-fork" } +nym-network-defaults = { git = "https://github.com/nymtech/nym", branch = "release/2024.13-magura" } +nym-validator-client = { git = "https://github.com/nymtech/nym", branch = "release/2024.13-magura" } # nym-network-defaults = { path = "../common/network-defaults" } # nym-validator-client = { path = "../common/client-libs/validator-client" } nym-task = { path = "../common/task" } -nym-node-requests = { git = "https://github.com/nymtech/nym", branch = "pre-dir-v2-fork" } +nym-node-requests = { git = "https://github.com/nymtech/nym", branch = "release/2024.13-magura" } # nym-node-requests = { path = "../nym-node/nym-node-requests", features = ["openapi"] } regex = { workspace = true } reqwest = { workspace = true } diff --git a/nym-node-status-api/launch_node_status_api.sh b/nym-node-status-api/launch_node_status_api.sh index e732caf37e..5d92675412 100755 --- a/nym-node-status-api/launch_node_status_api.sh +++ b/nym-node-status-api/launch_node_status_api.sh @@ -6,6 +6,7 @@ export RUST_LOG=${RUST_LOG:-debug} export NYM_API_CLIENT_TIMEOUT=60 export EXPLORER_CLIENT_TIMEOUT=60 +export NODE_STATUS_API_TESTRUN_REFRESH_INTERVAL=60 export ENVIRONMENT="qa.env" diff --git a/nym-node-status-api/src/db/queries/gateways.rs b/nym-node-status-api/src/db/queries/gateways.rs index bfef40b149..bcf9c2d6ca 100644 --- a/nym-node-status-api/src/db/queries/gateways.rs +++ b/nym-node-status-api/src/db/queries/gateways.rs @@ -6,7 +6,7 @@ use crate::{ http::models::Gateway, }; use futures_util::TryStreamExt; -use nym_validator_client::models::DescribedGateway; +use nym_validator_client::models::NymNodeDescription; use sqlx::{pool::PoolConnection, Sqlite}; use tracing::error; @@ -88,13 +88,13 @@ where /// Ensure all gateways that are set as bonded, are still bonded pub(crate) async fn ensure_gateways_still_bonded( pool: &DbPool, - gateways: &[DescribedGateway], + gateways: &[&NymNodeDescription], ) -> anyhow::Result { let bonded_gateways_rows = get_all_bonded_gateways_row_ids_by_status(pool, true).await?; let unbonded_gateways_rows = bonded_gateways_rows.iter().filter(|v| { !gateways .iter() - .any(|bonded| *bonded.bond.identity() == v.identity_key) + .any(|bonded| *bonded.ed25519_identity_key().to_base58_string() == v.identity_key) }); let recently_unbonded_gateways = unbonded_gateways_rows.to_owned().count(); diff --git a/nym-node-status-api/src/monitor/mod.rs b/nym-node-status-api/src/monitor/mod.rs index 14a3aec0d1..6017b471f4 100644 --- a/nym-node-status-api/src/monitor/mod.rs +++ b/nym-node-status-api/src/monitor/mod.rs @@ -10,7 +10,9 @@ use cosmwasm_std::Decimal; use nym_explorer_client::{ExplorerClient, PrettyDetailedGatewayBond}; use nym_network_defaults::NymNetworkDetails; use nym_validator_client::client::NymApiClientExt; -use nym_validator_client::models::{DescribedGateway, DescribedMixNode, MixNodeBondAnnotated}; +use nym_validator_client::models::{ + LegacyDescribedMixNode, MixNodeBondAnnotated, NymNodeDescription, +}; use nym_validator_client::nym_nodes::SkimmedNode; use nym_validator_client::nyxd::contract_traits::PagedMixnetQueryClient; use nym_validator_client::nyxd::{AccountId, NyxdClient}; @@ -70,7 +72,7 @@ async fn run( pool: &DbPool, network_details: &NymNetworkDetails, explorer_client_timeout: Duration, - nym_api_client_timeout: Duration, + _nym_api_client_timeout: Duration, nyxd_addr: &Url, ) -> anyhow::Result<()> { let default_api_url = network_details @@ -93,18 +95,38 @@ async fn run( let explorer_gateways = explorer_client .unstable_get_gateways() .await - .log_error("get_gateways")?; + .log_error("unstable_get_gateways")?; + + // TODO dz with timeout? + let api_client = NymApiClient::new(default_api_url); - let api_client = NymApiClient::new_with_timeout(default_api_url, nym_api_client_timeout); - let gateways = api_client - .get_cached_described_gateways() + let all_nodes = api_client + .get_all_described_nodes() .await - .log_error("get_described_gateways")?; - tracing::debug!("Fetched {} gateways", gateways.len()); - let skimmed_gateways = api_client - .get_basic_gateways(None) + .log_error("get_all_described_nodes")?; + tracing::debug!("Fetched {} total nodes", all_nodes.len()); + + let gateways = all_nodes + .iter() + .filter(|node| node.description.declared_role.entry) + .collect::>(); + tracing::debug!("Of those, {} gateways", gateways.len()); + for gw in gateways.iter() { + tracing::debug!("{}", gw.ed25519_identity_key().to_base58_string()); + } + + let mixnodes = all_nodes + .iter() + .filter(|node| node.description.declared_role.mixnode) + .collect::>(); + tracing::debug!("Of those, {} mixnodes", mixnodes.len()); + + log_gw_in_explorer_not_api(explorer_gateways.as_slice(), gateways.as_slice()); + + let all_skimmed_nodes = api_client + .get_all_basic_nodes(None) .await - .log_error("get_basic_gateways")?; + .log_error("get_all_basic_nodes")?; let mixnodes = api_client .get_cached_mixnodes() @@ -112,11 +134,12 @@ async fn run( .log_error("get_cached_mixnodes")?; tracing::debug!("Fetched {} mixnodes", mixnodes.len()); - let gateways_blacklisted = skimmed_gateways + // let gateways_blacklisted = gateways.iter().filter(|gw|gw.) + let gateways_blacklisted = all_skimmed_nodes .iter() - .filter_map(|gw| { - if gw.performance.round_to_integer() <= 50 { - Some(gw.ed25519_identity_pubkey.to_owned()) + .filter_map(|node| { + if node.performance.round_to_integer() <= 50 && node.supported_roles.entry { + Some(node.ed25519_identity_pubkey.to_base58_string()) } else { None } @@ -153,7 +176,7 @@ async fn run( &gateways, &gateways_blacklisted, explorer_gateways, - skimmed_gateways, + all_skimmed_nodes, )?; queries::insert_gateways(pool, gateway_records) .await @@ -165,8 +188,8 @@ async fn run( let count_gateways_blacklisted = gateways .iter() .filter(|gw| { - let gw_identity = gw.bond.identity(); - gateways_blacklisted.contains(gw_identity) + let gw_identity = gw.ed25519_identity_key().to_base58_string(); + gateways_blacklisted.contains(&gw_identity) }) .count(); @@ -277,7 +300,7 @@ async fn run( } fn prepare_gateway_data( - gateways: &[DescribedGateway], + gateways: &[&NymNodeDescription], gateways_blacklisted: &HashSet, explorer_gateways: Vec, skimmed_gateways: Vec, @@ -285,24 +308,25 @@ fn prepare_gateway_data( let mut gateway_records = Vec::new(); for gateway in gateways { - let identity_key = gateway.bond.identity(); + let identity_key = gateway.ed25519_identity_key().to_base58_string(); let bonded = true; let last_updated_utc = chrono::offset::Utc::now().timestamp(); - let blacklisted = gateways_blacklisted.contains(identity_key); + let blacklisted = gateways_blacklisted.contains(&identity_key); - let self_described = gateway - .self_described - .as_ref() - .and_then(|v| serde_json::to_string(&v).ok()); + let self_described = serde_json::to_string(&gateway.description)?; let explorer_pretty_bond = explorer_gateways .iter() - .find(|g| g.gateway.identity_key.eq(identity_key)); + .find(|g| g.gateway.identity_key.eq(&identity_key)); let explorer_pretty_bond = explorer_pretty_bond.and_then(|g| serde_json::to_string(g).ok()); let performance = skimmed_gateways .iter() - .find(|g| g.ed25519_identity_pubkey.eq(identity_key)) + .find(|g| { + g.ed25519_identity_pubkey + .to_base58_string() + .eq(&identity_key) + }) .map(|g| g.performance) .unwrap_or_default() .round_to_integer(); @@ -311,7 +335,8 @@ fn prepare_gateway_data( identity_key: identity_key.to_owned(), bonded, blacklisted, - self_described, + // TODO dz shouldn't be an option + self_described: Some(self_described), explorer_pretty_bond, last_updated_utc, performance, @@ -323,7 +348,7 @@ fn prepare_gateway_data( fn prepare_mixnode_data( mixnodes: &[MixNodeBondAnnotated], - mixnodes_described: Vec, + mixnodes_described: Vec, delegation_program_members: Vec, ) -> anyhow::Result> { let mut mixnode_records = Vec::new(); @@ -364,6 +389,28 @@ fn prepare_mixnode_data( Ok(mixnode_records) } +fn log_gw_in_explorer_not_api( + explorer: &[PrettyDetailedGatewayBond], + api_gateways: &[&NymNodeDescription], +) { + let api_gateways = api_gateways + .iter() + .map(|gw| gw.ed25519_identity_key().to_base58_string()) + .collect::>(); + let explorer_only = explorer + .iter() + .filter(|gw| !api_gateways.contains(&gw.gateway.identity_key.to_string())) + .collect::>(); + + tracing::debug!( + "Gateways listed by explorer but not by Nym API: {}", + explorer_only.len() + ); + for gw in explorer_only.iter() { + tracing::debug!("{}", gw.gateway.identity_key.to_string()); + } +} + // TODO dz is there a common monorepo place this can be put? pub trait NumericalCheckedCast where @@ -423,7 +470,7 @@ async fn get_delegation_program_details( let mix_ids: Vec = delegations .iter() - .map(|delegation| delegation.mix_id) + .map(|delegation| delegation.node_id) .collect(); Ok(mix_ids)