From c6908ba1004e2848776ec73a736c7721cc209281 Mon Sep 17 00:00:00 2001 From: Parth Desai Date: Thu, 25 Jan 2024 15:33:48 +0400 Subject: [PATCH 1/2] create new virual workspace + replace jemalloc with mimalloc --- .github/workflows/ci-tests.yml | 156 ++++++++++++++++++---- Cargo.lock | 188 +-------------------------- Cargo.toml | 125 ++++++------------ pulsar/Cargo.toml | 54 ++++++++ pulsar/build.rs | 5 + {src => pulsar/src}/commands.rs | 0 {src => pulsar/src}/commands/farm.rs | 0 {src => pulsar/src}/commands/info.rs | 0 {src => pulsar/src}/commands/init.rs | 0 {src => pulsar/src}/commands/wipe.rs | 0 {src => pulsar/src}/config.rs | 0 {src => pulsar/src}/main.rs | 8 +- {src => pulsar/src}/summary.rs | 0 {src => pulsar/src}/tests.rs | 0 {src => pulsar/src}/utils.rs | 0 15 files changed, 230 insertions(+), 306 deletions(-) create mode 100644 pulsar/Cargo.toml create mode 100644 pulsar/build.rs rename {src => pulsar/src}/commands.rs (100%) rename {src => pulsar/src}/commands/farm.rs (100%) rename {src => pulsar/src}/commands/info.rs (100%) rename {src => pulsar/src}/commands/init.rs (100%) rename {src => pulsar/src}/commands/wipe.rs (100%) rename {src => pulsar/src}/config.rs (100%) rename {src => pulsar/src}/main.rs (97%) rename {src => pulsar/src}/summary.rs (100%) rename {src => pulsar/src}/tests.rs (100%) rename {src => pulsar/src}/utils.rs (100%) diff --git a/.github/workflows/ci-tests.yml b/.github/workflows/ci-tests.yml index a808113a..d7b02948 100644 --- a/.github/workflows/ci-tests.yml +++ b/.github/workflows/ci-tests.yml @@ -16,21 +16,34 @@ on: required: true default: false type: boolean - merge_group: - types: [checks_requested] + +concurrency: + group: push-${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true env: # Not needed in CI, should make things a bit faster CARGO_INCREMENTAL: 0 CARGO_TERM_COLOR: always - # Build smaller artifacts to avoid running out of space in CI - # TODO: Try to remove once https://github.com/paritytech/substrate/issues/11538 is resolved - RUSTFLAGS: -C strip=symbols -C opt-level=s - # Remove unnecessary WASM build artefacts - WASM_BUILD_CLEAN_TARGET: 1 + MAX_TARGET_SIZE: 1024 # MB + # TODO: AES flag is such that we have decent performance on ARMv8, remove once `aes` crate bumps MSRV to at least + # 1.61: https://github.com/RustCrypto/block-ciphers/issues/373 + RUSTFLAGS: -C strip=symbols -C opt-level=s --cfg aes_armv8 jobs: - clippy-fmt-test: + fmt: + runs-on: ${{ fromJson(github.repository_owner == 'subspace' && '["self-hosted", "ubuntu-20.04-x86-64"]' || 'ubuntu-22.04') }} + steps: + - name: git checkout + uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0 + + - name: cargo fmt + uses: actions-rs/cargo@ae10961054e4aa8b4aa7dffede299aaf087aa33b # @v1.0.1 + with: + command: fmt + args: --all -- --check + + clippy: strategy: fail-fast: false matrix: @@ -45,15 +58,14 @@ jobs: runs-on: ${{ matrix.os }} steps: - - name: Checkout - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # @v3.1.0 + - name: git checkout + uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0 # On macOS, we need a proper Clang version, not Apple's custom version without wasm32 support - name: Install LLVM and Clang uses: KyleMayes/install-llvm-action@8852e4d5c58653ed05135c0a5d949d9c2febcb00 # v1.6.1 with: version: "15.0" - if: runner.os == 'macOS' - name: Install Protoc uses: arduino/setup-protoc@9b1ee5b22b0a3f1feb8c2ff99b32c89b3c3191e9 # v2.0.0 @@ -69,35 +81,129 @@ jobs: - name: Remove msys64 run: Remove-Item -LiteralPath "C:\msys64\" -Force -Recurse if: runner.os == 'Windows' - # May not exist on self-hosted runners continue-on-error: true - - name: cargo fmt - uses: actions-rs/cargo@ae10961054e4aa8b4aa7dffede299aaf087aa33b # @v1.0.1 + - name: Configure cache + uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # @v3.3.2 with: - command: fmt - args: --all -- --check + path: | + ~/.cargo/registry + ~/.cargo/bin + ~/.cargo/git + key: ${{ runner.os }}-${{ runner.arch }}-cargo-${{ hashFiles('**/Cargo.toml') }} + restore-keys: | + ${{ runner.os }}-${{ runner.arch }}-cargo- - - name: cargo test - uses: actions-rs/cargo@ae10961054e4aa8b4aa7dffede299aaf087aa33b # @v1.0.1 - with: - command: test + - name: Clean unused crate source checkouts and git repo checkouts + run: cargo cache - - name: cargo clippy --locked (Linux & Windows) - uses: actions-rs/clippy-check@b5b5f21f4797c02da247df37026fcd0a5024aa4d # @v1.0.7 + - name: cargo clippy (Linux & Windows) + uses: actions-rs/clippy-check@b5b5f21f4797c02da247df37026fcd0a5024aa4d # v1.0.7 with: token: ${{ secrets.GITHUB_TOKEN }} args: --locked --all-targets -- -D warnings if: runner.os != 'macOS' - - name: cargo clippy --locked (macOS) + - name: cargo clippy (MacOS) uses: actions-rs/clippy-check@b5b5f21f4797c02da247df37026fcd0a5024aa4d # @v1.0.7 with: token: ${{ secrets.GITHUB_TOKEN }} - args: --locked --all-targets --no-default-features -- -D warnings + args: --locked --no-default-features -- -D warnings if: runner.os == 'macOS' + - name: Clean unused artifacts + run: cargo sweep --maxsize ${{ env.MAX_TARGET_SIZE }} + + test: + strategy: + matrix: + os: ${{ fromJson(github.repository_owner == 'subspace' && '[["self-hosted", "ubuntu-20.04-x86-64"], ["self-hosted", "macos-12-arm64"], ["self-hosted", "windows-server-2022-x86-64"]]' || '["ubuntu-20.04", "macos-12", "windows-2022"]') }} + run-all: + - ${{ inputs.test-macos-and-windows || github.ref == 'refs/heads/master' }} + exclude: # exclude macos-12 and window-2022 when the condition is false + - run-all: false + os: macos-12 + - run-all: false + os: windows-2022 + + runs-on: ${{ matrix.os }} + + steps: + - name: git checkout + uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0 + + # On macOS, we need a proper Clang version, not Apple's custom version without wasm32 support + - name: Install LLVM and Clang + uses: KyleMayes/install-llvm-action@8852e4d5c58653ed05135c0a5d949d9c2febcb00 # v1.6.1 + with: + version: "15.0" + if: runner.os == 'macOS' + + - name: Install Protoc + uses: arduino/setup-protoc@9b1ee5b22b0a3f1feb8c2ff99b32c89b3c3191e9 # v2.0.0 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + + # Needed for hwloc + - name: Install automake (macOS) + run: brew install automake + if: runner.os == 'macOS' + + # Workaround to resolve link error with C:\msys64\mingw64\bin\libclang.dll + - name: Remove msys64 + run: Remove-Item -LiteralPath "C:\msys64\" -Force -Recurse + if: runner.os == 'Windows' + continue-on-error: true + + - name: Add cache + uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # @v3.3.2 + if: runner.os != 'Windows' + with: + path: | + ~/.cargo/registry + ~/.cargo/bin + ~/.cargo/git + target + key: test-${{ runner.os }}-${{ hashFiles('rust-toolchain.toml') }}-${{ hashFiles('**/Cargo.lock') }} + restore-keys: test-${{ runner.os }}-${{ hashFiles('rust-toolchain.toml') }} + + - name: Install utils for caching + if: runner.os != 'Windows' + run: | + test -x ~/.cargo/bin/cargo-sweep || cargo install cargo-sweep + test -x ~/.cargo/bin/cargo-cache || cargo install cargo-cache --no-default-features --features ci-autoclean cargo-cache + + - name: Clean unused crate source checkouts and git repo checkouts + if: runner.os != 'Windows' + run: cargo cache + + - name: Build and run tests (linux & windows) + run: cargo test --locked + if: runner.os != 'macOS' + + - name: Build and run tests (macOS) + run: cargo test --locked --no-default-features + if: runner.os == 'macOS' + + - name: Clean unused artifacts + if: runner.os != 'Windows' + run: cargo sweep --maxsize ${{ env.MAX_TARGET_SIZE }} + + docs: + runs-on: ubuntu-22.04 + steps: + - name: git checkout + uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0 + + - name: Install Protoc + uses: arduino/setup-protoc@9b1ee5b22b0a3f1feb8c2ff99b32c89b3c3191e9 # v2.0.0 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + + - name: Configure cache + uses: Swatinem/rust-cache@359a70e43a0bb8a13953b04a90f76428b4959bb6 # v2.2.0 + - name: Check Documentation - run: cargo doc --locked --all --no-deps + run: cargo doc --locked --no-deps env: RUSTDOCFLAGS: "-D rustdoc::broken-intra-doc-links -D rustdoc::private_intra_doc_links" diff --git a/Cargo.lock b/Cargo.lock index fb99703e..c78bec26 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -957,51 +957,6 @@ dependencies = [ "cc", ] -[[package]] -name = "axum" -version = "0.6.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b829e4e32b91e643de6eafe82b1d90675f5874230191a4ffbc1b336dec4d6bf" -dependencies = [ - "async-trait", - "axum-core", - "bitflags 1.3.2", - "bytes", - "futures-util", - "http", - "http-body", - "hyper", - "itoa", - "matchit", - "memchr", - "mime", - "percent-encoding", - "pin-project-lite 0.2.13", - "rustversion", - "serde", - "sync_wrapper", - "tower", - "tower-layer", - "tower-service", -] - -[[package]] -name = "axum-core" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "759fa577a247914fd3f7f76d62972792636412fbfd634cd452f6a385a74d2d2c" -dependencies = [ - "async-trait", - "bytes", - "futures-util", - "http", - "http-body", - "mime", - "rustversion", - "tower-layer", - "tower-service", -] - [[package]] name = "backoff" version = "0.4.0" @@ -1710,42 +1665,6 @@ dependencies = [ "windows-sys 0.45.0", ] -[[package]] -name = "console-api" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2895653b4d9f1538a83970077cb01dfc77a4810524e51a110944688e916b18e" -dependencies = [ - "prost", - "prost-types", - "tonic", - "tracing-core", -] - -[[package]] -name = "console-subscriber" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4cf42660ac07fcebed809cfe561dd8730bcd35b075215e6479c516bcd0d11cb" -dependencies = [ - "console-api", - "crossbeam-channel", - "crossbeam-utils", - "futures", - "hdrhistogram", - "humantime", - "prost-types", - "serde", - "serde_json", - "thread_local", - "tokio", - "tokio-stream", - "tonic", - "tracing", - "tracing-core", - "tracing-subscriber 0.3.18", -] - [[package]] name = "const-oid" version = "0.9.5" @@ -4466,19 +4385,6 @@ dependencies = [ "allocator-api2", ] -[[package]] -name = "hdrhistogram" -version = "7.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5b38e5c02b7c7be48c8dc5217c4f1634af2ea221caae2e024bffc7a7651c691" -dependencies = [ - "base64 0.13.1", - "byteorder", - "flate2", - "nom", - "num-traits", -] - [[package]] name = "heck" version = "0.4.1" @@ -4763,18 +4669,6 @@ dependencies = [ "webpki-roots 0.23.1", ] -[[package]] -name = "hyper-timeout" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1" -dependencies = [ - "hyper", - "pin-project-lite 0.2.13", - "tokio", - "tokio-io-timeout", -] - [[package]] name = "iana-time-zone" version = "0.1.57" @@ -5104,26 +4998,6 @@ version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" -[[package]] -name = "jemalloc-sys" -version = "0.5.4+5.3.0-patched" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac6c1946e1cea1788cbfde01c993b52a10e2da07f4bac608228d1bed20bfebf2" -dependencies = [ - "cc", - "libc", -] - -[[package]] -name = "jemallocator" -version = "0.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0de374a9f8e63150e6f5e8a60cc14c668226d7a347d8aee1a45766e3c4dd3bc" -dependencies = [ - "jemalloc-sys", - "libc", -] - [[package]] name = "jobserver" version = "0.1.26" @@ -6582,12 +6456,6 @@ version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5" -[[package]] -name = "matchit" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" - [[package]] name = "matrixmultiply" version = "0.3.7" @@ -8291,7 +8159,6 @@ dependencies = [ "bytesize-serde", "clap", "color-eyre", - "console-subscriber", "crossterm", "derivative", "derive_more", @@ -8299,8 +8166,8 @@ dependencies = [ "fdlimit 0.2.1", "futures", "indicatif", - "jemallocator", "libp2p-core 0.38.0", + "mimalloc", "num-rational", "num-traits", "open", @@ -12232,12 +12099,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "sync_wrapper" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" - [[package]] name = "synstructure" version = "0.12.6" @@ -12462,16 +12323,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "tokio-io-timeout" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30b74022ada614a1b4834de765f9bb43877f910cc8ce4be40e89042c9223a8bf" -dependencies = [ - "pin-project-lite 0.2.13", - "tokio", -] - [[package]] name = "tokio-macros" version = "2.2.0" @@ -12563,49 +12414,12 @@ dependencies = [ "winnow", ] -[[package]] -name = "tonic" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3082666a3a6433f7f511c7192923fa1fe07c69332d3c6a2e6bb040b569199d5a" -dependencies = [ - "async-trait", - "axum", - "base64 0.21.5", - "bytes", - "futures-core", - "futures-util", - "h2", - "http", - "http-body", - "hyper", - "hyper-timeout", - "percent-encoding", - "pin-project", - "prost", - "tokio", - "tokio-stream", - "tower", - "tower-layer", - "tower-service", - "tracing", -] - [[package]] name = "tower" version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" dependencies = [ - "futures-core", - "futures-util", - "indexmap 1.9.3", - "pin-project", - "pin-project-lite 0.2.13", - "rand 0.8.5", - "slab", - "tokio", - "tokio-util", "tower-layer", "tower-service", "tracing", diff --git a/Cargo.toml b/Cargo.toml index ca9edf9f..4b01ac32 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,81 +1,8 @@ -[package] -name = "pulsar" -version = "0.7.4" -edition = "2021" - -[dependencies] -anyhow = "1" -async-stream = "0.3.5" -bytesize = "1.1" -bytesize-serde = "0.2" -clap = { version = "4.1.1", features = ["derive"] } -color-eyre = "0.6.2" -crossterm = "0.26.1" -derivative = "2.2.0" -derive_more = "0.99.17" -dirs = "4.0.0" -fdlimit = "0.2" -futures = "0.3" -indicatif = { version = "0.17.1", features = ["improved_unicode"] } -libp2p-core = "0.38" -num-rational = "0.4.1" -num-traits = "0.2.14" -open = "4.0.2" -owo-colors = "3.5.0" -rand = "0.8.5" -serde = "1" -serde_derive = "1" -single-instance = "0.3.3" -sp-core = { version = "21.0.0", git = "https://github.com/subspace/polkadot-sdk", rev = "c63a8b28a9fd26d42116b0dcef1f2a5cefb9cd1c", features = ["full_crypto"] } -strum = "0.24.1" -strum_macros = "0.24.3" -subspace-sdk = { git = "https://github.com/subspace/subspace-sdk", rev = "000c6c774f3dd995e783d6d78d1d59669540b454", default-features = false } -thiserror = "1" -tokio = { version = "1.34.0", features = ["macros", "rt-multi-thread", "tracing", "signal"] } -toml = "0.7" -tracing = "0.1.37" -tracing-appender = "0.2" -tracing-bunyan-formatter = "0.3.4" -tracing-error = "0.2.0" -tracing-subscriber = { version = "0.3.16", features = ["env-filter"] } -whoami = "1" -zeroize = "1.6.0" - -[dev-dependencies] -rand = "0.8.5" - -[features] -default = [ - "numa" +[workspace] +resolver = "2" +members = [ + "pulsar", ] -numa = [ - "subspace-sdk/numa" -] - -# The only triple tested and confirmed as working in `jemallocator` crate is `x86_64-unknown-linux-gnu` -[target.'cfg(all(target_arch = "x86_64", target_vendor = "unknown", target_os = "linux", target_env = "gnu"))'.dependencies] -jemallocator = "0.5.0" - -[target.'cfg(tokio_unstable)'.dependencies] -console-subscriber = "0.1" - -[patch.crates-io] -# TODO: remove once tracing-appender has a new release -tracing = { git = "https://github.com/tokio-rs/tracing", branch = "v0.1.x" } -tracing-appender = { git = "https://github.com/tokio-rs/tracing", branch = "v0.1.x" } -tracing-core = { git = "https://github.com/tokio-rs/tracing", branch = "v0.1.x" } -tracing-error = { git = "https://github.com/tokio-rs/tracing", branch = "v0.1.x" } -tracing-subscriber = { git = "https://github.com/tokio-rs/tracing", branch = "v0.1.x" } - -[profile.production] -inherits = "release" -lto = "fat" -codegen-units = 1 - -# TODO: get rid of this when we have bigger RAM for aarch64 linux -[profile.aarch64linux] -inherits = "release" -codegen-units = 1 # The list of dependencies below (which can be both direct and indirect dependencies) are crates # that are suspected to be CPU-intensive, and that are unlikely to require debugging (as some of @@ -85,15 +12,13 @@ codegen-units = 1 # # This list is ordered alphabetically. [profile.dev.package] -ark-bls12-381 = { opt-level = 3 } -ark-ec = { opt-level = 3 } -ark-ff = { opt-level = 3 } -ark-ff-asm = { opt-level = 3 } -ark-poly = { opt-level = 3 } -ark-serialize = { opt-level = 3 } -ark-std = { opt-level = 3 } +bitvec = { opt-level = 3 } blake2 = { opt-level = 3 } +blake3 = { opt-level = 3 } blake2b_simd = { opt-level = 3 } +blst = { opt-level = 3 } +rust-kzg-blst = { opt-level = 3 } +chacha20 = { opt-level = 3 } chacha20poly1305 = { opt-level = 3 } cranelift-codegen = { opt-level = 3 } cranelift-wasm = { opt-level = 3 } @@ -111,7 +36,7 @@ httparse = { opt-level = 3 } integer-sqrt = { opt-level = 3 } k256 = { opt-level = 3 } keccak = { opt-level = 3 } -libm = { opt-level = 3 } +kzg = { opt-level = 3 } libsecp256k1 = { opt-level = 3 } libz-sys = { opt-level = 3 } mio = { opt-level = 3 } @@ -128,15 +53,41 @@ sha2 = { opt-level = 3 } sha3 = { opt-level = 3 } smallvec = { opt-level = 3 } snow = { opt-level = 3 } -subspace-core-primitives = { opt-level = 3 } subspace-archiving = { opt-level = 3 } +subspace-chiapos = { opt-level = 3 } +subspace-core-primitives = { opt-level = 3 } +subspace-erasure-coding = { opt-level = 3 } +subspace-farmer-components = { opt-level = 3 } +subspace-proof-of-space = { opt-level = 3 } +subspace-proof-of-time = { opt-level = 3 } twox-hash = { opt-level = 3 } uint = { opt-level = 3 } -wasmi = { opt-level = 3 } x25519-dalek = { opt-level = 3 } yamux = { opt-level = 3 } zeroize = { opt-level = 3 } +[profile.release] +# Substrate runtime requires unwinding. +panic = "unwind" + +[profile.production] +inherits = "release" +lto = "fat" +codegen-units = 1 + +# TODO: get rid of this when we have bigger RAM for aarch64 linux +[profile.aarch64linux] +inherits = "release" +codegen-units = 1 + +[patch.crates-io] +# TODO: remove once tracing-appender has a new release +tracing = { git = "https://github.com/tokio-rs/tracing", branch = "v0.1.x" } +tracing-appender = { git = "https://github.com/tokio-rs/tracing", branch = "v0.1.x" } +tracing-core = { git = "https://github.com/tokio-rs/tracing", branch = "v0.1.x" } +tracing-error = { git = "https://github.com/tokio-rs/tracing", branch = "v0.1.x" } +tracing-subscriber = { git = "https://github.com/tokio-rs/tracing", branch = "v0.1.x" } + # Reason: We need to patch substrate dependency of snowfork and frontier libraries to our fork # TODO: Remove when we are using upstream substrate instead of fork [patch."https://github.com/paritytech/polkadot-sdk.git"] diff --git a/pulsar/Cargo.toml b/pulsar/Cargo.toml new file mode 100644 index 00000000..201a1eb9 --- /dev/null +++ b/pulsar/Cargo.toml @@ -0,0 +1,54 @@ +[package] +name = "pulsar" +version = "0.7.4" +edition = "2021" + +[dependencies] +anyhow = "1" +async-stream = "0.3.5" +bytesize = "1.1" +bytesize-serde = "0.2" +clap = { version = "4.1.1", features = ["derive"] } +color-eyre = "0.6.2" +crossterm = "0.26.1" +derivative = "2.2.0" +derive_more = "0.99.17" +dirs = "4.0.0" +fdlimit = "0.2" +futures = "0.3" +indicatif = { version = "0.17.1", features = ["improved_unicode"] } +libp2p-core = "0.38" +mimalloc = { version = "*", default-features = false } +num-rational = "0.4.1" +num-traits = "0.2.14" +open = "4.0.2" +owo-colors = "3.5.0" +rand = "0.8.5" +serde = "1" +serde_derive = "1" +single-instance = "0.3.3" +sp-core = { version = "21.0.0", git = "https://github.com/subspace/polkadot-sdk", rev = "c63a8b28a9fd26d42116b0dcef1f2a5cefb9cd1c", features = ["full_crypto"] } +strum = "0.24.1" +strum_macros = "0.24.3" +subspace-sdk = { git = "https://github.com/subspace/subspace-sdk", rev = "000c6c774f3dd995e783d6d78d1d59669540b454", default-features = false } +thiserror = "1" +tokio = { version = "1.34.0", features = ["macros", "rt-multi-thread", "tracing", "signal"] } +toml = "0.7" +tracing = "0.1.37" +tracing-appender = "0.2" +tracing-bunyan-formatter = "0.3.4" +tracing-error = "0.2.0" +tracing-subscriber = { version = "0.3.16", features = ["env-filter"] } +whoami = "1" +zeroize = "1.6.0" + +[dev-dependencies] +rand = "0.8.5" + +[features] +default = [ + "numa" +] +numa = [ + "subspace-sdk/numa" +] diff --git a/pulsar/build.rs b/pulsar/build.rs new file mode 100644 index 00000000..364bd6f5 --- /dev/null +++ b/pulsar/build.rs @@ -0,0 +1,5 @@ +fn main() { + let output = std::process::Command::new("git").args(["rev-parse", "HEAD"]).output().unwrap(); + let git_hash = String::from_utf8(output.stdout).unwrap(); + println!("cargo:rustc-env=GIT_HASH={git_hash}"); +} diff --git a/src/commands.rs b/pulsar/src/commands.rs similarity index 100% rename from src/commands.rs rename to pulsar/src/commands.rs diff --git a/src/commands/farm.rs b/pulsar/src/commands/farm.rs similarity index 100% rename from src/commands/farm.rs rename to pulsar/src/commands/farm.rs diff --git a/src/commands/info.rs b/pulsar/src/commands/info.rs similarity index 100% rename from src/commands/info.rs rename to pulsar/src/commands/info.rs diff --git a/src/commands/init.rs b/pulsar/src/commands/init.rs similarity index 100% rename from src/commands/init.rs rename to pulsar/src/commands/init.rs diff --git a/src/commands/wipe.rs b/pulsar/src/commands/wipe.rs similarity index 100% rename from src/commands/wipe.rs rename to pulsar/src/commands/wipe.rs diff --git a/src/config.rs b/pulsar/src/config.rs similarity index 100% rename from src/config.rs rename to pulsar/src/config.rs diff --git a/src/main.rs b/pulsar/src/main.rs similarity index 97% rename from src/main.rs rename to pulsar/src/main.rs index 564c3f5c..924b30a1 100644 --- a/src/main.rs +++ b/pulsar/src/main.rs @@ -31,14 +31,8 @@ use crate::commands::init::init; use crate::commands::wipe::wipe_config; use crate::utils::{get_user_input, open_log_dir, support_message, yes_or_no_parser}; -#[cfg(all( - target_arch = "x86_64", - target_vendor = "unknown", - target_os = "linux", - target_env = "gnu" -))] #[global_allocator] -static GLOBAL: jemallocator::Jemalloc = jemallocator::Jemalloc; +static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc; #[derive(Debug, Parser)] #[command(subcommand_required = false)] diff --git a/src/summary.rs b/pulsar/src/summary.rs similarity index 100% rename from src/summary.rs rename to pulsar/src/summary.rs diff --git a/src/tests.rs b/pulsar/src/tests.rs similarity index 100% rename from src/tests.rs rename to pulsar/src/tests.rs diff --git a/src/utils.rs b/pulsar/src/utils.rs similarity index 100% rename from src/utils.rs rename to pulsar/src/utils.rs From 426c0e9705d455b50c1076e522f76e8bc21e4dd5 Mon Sep 17 00:00:00 2001 From: Parth Desai Date: Mon, 29 Jan 2024 13:35:11 +0530 Subject: [PATCH 2/2] address review feedback --- .github/workflows/ci-tests.yml | 8 ++++---- build.rs | 5 ----- 2 files changed, 4 insertions(+), 9 deletions(-) delete mode 100644 build.rs diff --git a/.github/workflows/ci-tests.yml b/.github/workflows/ci-tests.yml index d7b02948..4f15934c 100644 --- a/.github/workflows/ci-tests.yml +++ b/.github/workflows/ci-tests.yml @@ -32,7 +32,7 @@ env: jobs: fmt: - runs-on: ${{ fromJson(github.repository_owner == 'subspace' && '["self-hosted", "ubuntu-20.04-x86-64"]' || 'ubuntu-22.04') }} + runs-on: ${{ fromJson(github.repository_owner == 'subspace' && '["self-hosted", "ubuntu-20.04-x86-64"]' || '"ubuntu-22.04"') }} steps: - name: git checkout uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0 @@ -163,9 +163,9 @@ jobs: ~/.cargo/registry ~/.cargo/bin ~/.cargo/git - target - key: test-${{ runner.os }}-${{ hashFiles('rust-toolchain.toml') }}-${{ hashFiles('**/Cargo.lock') }} - restore-keys: test-${{ runner.os }}-${{ hashFiles('rust-toolchain.toml') }} + key: ${{ runner.os }}-${{ runner.arch }}-cargo-${{ hashFiles('**/Cargo.toml') }} + restore-keys: | + ${{ runner.os }}-${{ runner.arch }}-cargo- - name: Install utils for caching if: runner.os != 'Windows' diff --git a/build.rs b/build.rs deleted file mode 100644 index 364bd6f5..00000000 --- a/build.rs +++ /dev/null @@ -1,5 +0,0 @@ -fn main() { - let output = std::process::Command::new("git").args(["rev-parse", "HEAD"]).output().unwrap(); - let git_hash = String::from_utf8(output.stdout).unwrap(); - println!("cargo:rustc-env=GIT_HASH={git_hash}"); -}