mixnode feature

This commit is contained in:
durch
2023-03-27 09:57:28 +02:00
parent 4dc89bd65f
commit e7fdd3d076
33 changed files with 142 additions and 28 deletions
Generated
+100 -2
View File
@@ -282,6 +282,28 @@ version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "383d29d513d8764dcdc42ea295d979eb99c3c9f00607b3692cf68a431f7dca72"
[[package]]
name = "bindgen"
version = "0.64.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c4243e6031260db77ede97ad86c27e501d646a27ab57b59a574f725d98ab1fb4"
dependencies = [
"bitflags",
"cexpr",
"clang-sys",
"lazy_static",
"lazycell",
"log",
"peeking_take_while",
"proc-macro2",
"quote",
"regex",
"rustc-hash",
"shlex",
"syn",
"which",
]
[[package]]
name = "bip32"
version = "0.3.0"
@@ -464,6 +486,15 @@ dependencies = [
"jobserver",
]
[[package]]
name = "cexpr"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766"
dependencies = [
"nom",
]
[[package]]
name = "cfg-if"
version = "1.0.0"
@@ -567,6 +598,17 @@ dependencies = [
"zeroize",
]
[[package]]
name = "clang-sys"
version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77ed9a53e5d4d9c573ae844bfac6872b159cb1d1585a83b29e7a64b7eef7332a"
dependencies = [
"glob",
"libc",
"libloading",
]
[[package]]
name = "clap"
version = "3.2.23"
@@ -879,6 +921,16 @@ dependencies = [
"uint",
]
[[package]]
name = "cpu-cycles"
version = "0.1.0"
dependencies = [
"bindgen",
"cfg-if",
"libc",
"thiserror",
]
[[package]]
name = "cpufeatures"
version = "0.2.5"
@@ -2656,6 +2708,12 @@ version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "lazycell"
version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
[[package]]
name = "ledger"
version = "0.1.0"
@@ -2706,9 +2764,9 @@ dependencies = [
[[package]]
name = "libc"
version = "0.2.139"
version = "0.2.140"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79"
checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c"
[[package]]
name = "libgit2-sys"
@@ -2722,6 +2780,16 @@ dependencies = [
"pkg-config",
]
[[package]]
name = "libloading"
version = "0.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f"
dependencies = [
"cfg-if",
"winapi",
]
[[package]]
name = "libm"
version = "0.2.6"
@@ -3498,6 +3566,7 @@ dependencies = [
"bs58",
"clap 4.1.4",
"colored",
"cpu-cycles",
"cupid",
"dirs",
"futures",
@@ -4226,6 +4295,12 @@ dependencies = [
"syn",
]
[[package]]
name = "peeking_take_while"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099"
[[package]]
name = "peg"
version = "0.7.0"
@@ -5094,6 +5169,12 @@ dependencies = [
"syn",
]
[[package]]
name = "rustc-hash"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
[[package]]
name = "rustc_version"
version = "0.2.3"
@@ -5503,6 +5584,12 @@ dependencies = [
"lazy_static",
]
[[package]]
name = "shlex"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3"
[[package]]
name = "signal-hook"
version = "0.3.14"
@@ -6996,6 +7083,17 @@ dependencies = [
"serde_json",
]
[[package]]
name = "which"
version = "4.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2441c784c52b289a054b7201fc93253e288f094e2f4be9058343127c4226a269"
dependencies = [
"either",
"libc",
"once_cell",
]
[[package]]
name = "winapi"
version = "0.3.9"
Binary file not shown.
@@ -10,6 +10,4 @@ thiserror = "1"
[build-dependencies]
bindgen = "0.64.0"
cfg-if = "1"
[workspace]
cfg-if = "1"
@@ -1,7 +1,7 @@
extern crate bindgen;
use cfg_if;
use std::path::PathBuf;
use std::{env, path::PathBuf, process::Command};
use bindgen::CargoCallbacks;
@@ -50,23 +50,30 @@ fn main() {
} else if #[cfg(all(target_arch = "arm", target_pointer_width = "64"))] {
src_path = "arm64-pmc.c".to_string()
} else {
panic!("Unsupported architecture!")
panic!("Unsupported architecture ({:?})!", env::var("CARGO_CFG_TARGET_ARCH"), )
}
};
// Run `clang` to compile the `hello.c` file into a `hello.o` object file.
// Unwrap if it is not possible to spawn the process.
if !std::process::Command::new("clang")
let mut compile_o_command = Command::new("clang");
let compile_o_command = compile_o_command
.arg("-c")
.arg("-o")
.arg(&obj_path)
.arg(libdir_path.join(&src_path))
.output()
.expect("could not spawn `clang`")
.status
.success()
{
panic!("could not compile object file")
.arg(libdir_path.join(&src_path));
println!("Running: {:?}", compile_o_command);
match compile_o_command.output() {
Ok(output) => {
if !output.status.success() {
panic!("{:?}", unsafe {
std::str::from_utf8_unchecked(&output.stderr)
})
}
}
Err(e) => panic!("{e}"),
}
// Run `ar` to generate the `libhello.a` file from the `hello.o` file.
+19 -13
View File
@@ -29,32 +29,38 @@ log = { workspace = true }
pretty_env_logger = "0.4.0"
rand = "0.7.3"
rocket = { version = "0.5.0-rc.2", features = ["json"] }
serde = { version="1.0", features = ["derive"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
sysinfo = "0.27.7"
tokio = { version="1.21.2", features = ["rt-multi-thread", "net", "signal"] }
tokio-util = { version="0.7.3", features = ["codec"] }
tokio = { version = "1.21.2", features = ["rt-multi-thread", "net", "signal"] }
tokio-util = { version = "0.7.3", features = ["codec"] }
toml = "0.5.8"
url = { version = "2.2", features = ["serde"] }
atty = "0.2"
## internal
nym-config = { path="../common/config" }
nym-crypto = { path="../common/crypto" }
nym-config = { path = "../common/config" }
nym-crypto = { path = "../common/crypto" }
nym-contracts-common = { path = "../common/cosmwasm-smart-contracts/contracts-common" }
mixnet-client = { path="../common/client-libs/mixnet-client" }
mixnode-common = { path="../common/mixnode-common" }
nym-nonexhaustive-delayqueue = { path="../common/nonexhaustive-delayqueue" }
nym-sphinx = { path="../common/nymsphinx" }
mixnet-client = { path = "../common/client-libs/mixnet-client" }
mixnode-common = { path = "../common/mixnode-common" }
nym-nonexhaustive-delayqueue = { path = "../common/nonexhaustive-delayqueue" }
nym-sphinx = { path = "../common/nymsphinx" }
nym-pemstore = { path = "../common/pemstore", version = "0.2.0" }
nym-task = { path = "../common/task" }
nym-types = { path = "../common/types" }
nym-topology = { path="../common/topology" }
validator-client = { path="../common/client-libs/validator-client" }
nym-bin-common = { path="../common/bin-common" }
nym-topology = { path = "../common/topology" }
validator-client = { path = "../common/client-libs/validator-client" }
nym-bin-common = { path = "../common/bin-common" }
cpu-cycles = { path = "../cpu-cycles", optional = true }
[dev-dependencies]
tokio = { version="1.21.2", features = ["rt-multi-thread", "net", "signal", "test-util"] }
tokio = { version = "1.21.2", features = [
"rt-multi-thread",
"net",
"signal",
"test-util",
] }
nym-sphinx-types = { path = "../common/nymsphinx/types" }
nym-sphinx-params = { path = "../common/nymsphinx/params" }
+5
View File
@@ -60,6 +60,11 @@ impl Cli {
}
}
#[cfg(feature = "cpu-cycles")]
pub fn cpu_cycles() {
info!("{}", cpu_cycles::cpucycles())
}
#[tokio::main]
async fn main() {
setup_logging();