diff --git a/.github/workflows/casper-node-launcher-pr.yml b/.github/workflows/casper-node-launcher-pr.yml index 64a0a17..665b7f9 100644 --- a/.github/workflows/casper-node-launcher-pr.yml +++ b/.github/workflows/casper-node-launcher-pr.yml @@ -5,37 +5,14 @@ name: Continuous Integration jobs: test: name: Test Suite - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - - uses: actions-rs/cargo@v1 - with: - command: test + strategy: + matrix: + include: + - os: ubuntu-20.04 + code_name: focal - fmt: - name: Rustfmt - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - - run: rustup component add rustfmt - - uses: actions-rs/cargo@v1 - with: - command: fmt - args: -- --check + runs-on: ${{ matrix.os }} - clippy: - name: Clippy - runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 - uses: actions-rs/toolchain@v1 @@ -43,25 +20,21 @@ jobs: profile: minimal toolchain: stable override: true - - run: rustup component add clippy - - uses: actions-rs/cargo@v1 - with: - command: clippy - args: -- -D warnings - audit: - name: Audit - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - - run: cargo install cargo-audit - - uses: actions-rs/cargo@v1 - with: - command: audit - args: --deny warnings --ignore RUSTSEC-2021-0145 + - name: rustup setup + run: rustup component add rustfmt clippy + + - name: cargo setup + run: cargo install cargo-audit + + - name: fmt + run: cargo fmt -- --check + + - name: clippy + run: cargo clippy -- -D warnings + + - name: audit + run: cargo audit --deny warnings --ignore RUSTSEC-2024-0375 --ignore RUSTSEC-2021-0145 + - name: test + run: cargo test diff --git a/.github/workflows/casper-node-launcher-publish.yml b/.github/workflows/casper-node-launcher-publish.yml index 79dae2c..a34a343 100644 --- a/.github/workflows/casper-node-launcher-publish.yml +++ b/.github/workflows/casper-node-launcher-publish.yml @@ -4,7 +4,7 @@ name: publish-casper-node-launcher on: push: tags: - - "v*" + - "v*.*.*" jobs: publish_deb: @@ -18,14 +18,13 @@ jobs: steps: - uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b #v3.0.2 - - uses: Swatinem/rust-cache@cb2cf0cc7c5198d3364b9630e2c3d457f160790c #v1.4.0 - name: Install deps run: | echo "deb http://repo.aptly.info/ squeeze main" | sudo tee -a /etc/apt/sources.list.d/aptly.list wget -qO - https://www.aptly.info/pubkey.txt | sudo apt-key add - sudo apt-get update - sudo apt-get install -y awscli aptly=1.2.0 + sudo apt-get install -y aptly=1.4.0 aptly config show - name: Import GPG key @@ -64,4 +63,78 @@ jobs: PATHS: "/*" AWS_REGION: ${{ secrets.APTLY_REGION }} AWS_ACCESS_KEY_ID: ${{ secrets.APTLY_ACCESS_KEY }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.APTLY_SECRET_KEY }} \ No newline at end of file + AWS_SECRET_ACCESS_KEY: ${{ secrets.APTLY_SECRET_KEY }} + +--- +name: publish-casper-sidecar-deb +permissions: + contents: read + id-token: write + +on: + push: + tags: + - "v*.*.*" + +jobs: + publish_deb: + strategy: + matrix: + include: + - os: ubuntu-20.04 + code_name: focal + # - os: ubuntu-22.04 + # code_name: jammy + # - os: ubuntu-24.04 + # code_name: noble + + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b #v3.0.2 + + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v4 + with: + role-to-assume: ${{ secrets.AWS_ACCESS_ROLE_REPO }} + role-session-name: GitHub_to_AWS_via_FederatedOIDC + aws-region: ${{ secrets.AWS_ACCESS_REGION_REPO }} + + - name: Install deps + run: | + echo "deb http://repo.aptly.info/ squeeze main" | sudo tee -a /etc/apt/sources.list.d/aptly.list + wget -qO - https://www.aptly.info/pubkey.txt | sudo apt-key add - + sudo apt-get update + sudo apt-get install -y aptly=1.4.0 + aptly config show + + - name: update toolchain + run: rustup update nightly + + - name: Import GPG key + uses: crazy-max/ghaction-import-gpg@c8bb57c57e8df1be8c73ff3d59deab1dbc00e0d1 #v5.1.0 + with: + gpg_private_key: ${{ secrets.APTLY_GPG_KEY }} + passphrase: ${{ secrets.APTLY_GPG_PASS }} + + - name: Install cargo deb + run: cargo install cargo-deb + + - name: Cargo deb + run: cargo deb --package casper-sidecar --variant ${{ matrix.code_name }} + + - name: Upload binaries to repo + env: + PLUGIN_REPO_NAME: ${{ secrets.AWS_BUCKET_REPO }} + PLUGIN_REGION: ${{ secrets.AWS_ACCESS_REGION_REPO }} + PLUGIN_GPG_KEY: ${{ secrets.APTLY_GPG_KEY }} + PLUGIN_GPG_PASS: ${{ secrets.APTLY_GPG_PASS }} + PLUGIN_ACL: 'private' + PLUGIN_PREFIX: 'releases' + PLUGIN_DEB_PATH: './target/debian' + PLUGIN_OS_CODENAME: ${{ matrix.code_name }} + run: ./ci/publish_deb_to_repo.sh + + - name: Invalidate CloudFront cache + run: | + aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_CLOUDFRONT_REPO }} --paths "/*" diff --git a/.rpm/casper-node-launcher.spec b/.rpm/casper-node-launcher.spec deleted file mode 100644 index 235586d..0000000 --- a/.rpm/casper-node-launcher.spec +++ /dev/null @@ -1,104 +0,0 @@ -BuildRequires: systemd-rpm-macros -Requires: curl -%define __spec_install_post %{nil} -%define __os_install_post %{_dbpath}/brp-compress -%define debug_package %{nil} - -Name: casper-node-launcher -Summary: A binary which runs and upgrades the casper-node of the Casper network -Version: @@VERSION@@ -Release: @@RELEASE@@%{?dist} -License: CasperLabs Open Source License (COSL) -Group: Applications/System -Source0: %{name}-%{version}.tar.gz -URL: https://casperlabs.io - -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root - -%description -%{summary} - -%prep -%setup -q - -%pre -# Default Variables -# --- -DEFAULT_USERNAME="casper" -DEFAULT_CONFIG_DIRECTORY="/etc/${DEFAULT_USERNAME}" -DEFAULT_DATA_DIRECTORY="/var/lib/${DEFAULT_USERNAME}/bin" -DEFAULT_LOG_DIRECOTRY="/var/log/${DEFAULT_USERNAME}" - -# Creation of Files/Directories -# --- -# Assure DEFAULT_DATA_DIRECTORY is available for state data -if [ -d ${DEFAULT_DATA_DIRECTORY} ] ; then - echo "Directory ${DEFAULT_DATA_DIRECTORY} already exists." -else - mkdir -p ${DEFAULT_DATA_DIRECTORY} -fi - -# Assure DEFAULT_CONFIG_DIRECTORY is available for config data -if [ -d ${DEFAULT_CONFIG_DIRECTORY} ] ; then - echo "Directory ${DEFAULT_CONFIG_DIRECTORY} already exists." -else - mkdir -p ${DEFAULT_CONFIG_DIRECTORY} -fi - -# Assure DEFAULT_LOG_DIRECOTRY is available for logging -if [ -d ${DEFAULT_LOG_DIRECOTRY} ] ; then - echo "Directory ${DEFAULT_LOG_DIRECOTRY} already exists." -else - mkdir -p ${DEFAULT_LOG_DIRECOTRY} -fi -exit 0 - -%post -# Default Variables -# --- -DEFAULT_USERNAME="casper" -DEFAULT_CONFIG_DIRECTORY="/etc/${DEFAULT_USERNAME}" -DEFAULT_DATA_DIRECTORY="/var/lib/${DEFAULT_USERNAME}" -DEFAULT_LOG_DIRECOTRY="/var/log/${DEFAULT_USERNAME}" - -# User Creation -# --- -# Assure DEFAULT_USERNAME user exists -getent group casper >/dev/null || groupadd -r casper -getent passwd casper >/dev/null || \ - useradd -r -g casper -s /sbin/nologin \ - -c "User for running casper-node-launcher" casper - -# Take ownership of directories and files installed -chown -R ${DEFAULT_USERNAME}:${DEFAULT_USERNAME} ${DEFAULT_DATA_DIRECTORY} -chown -R ${DEFAULT_USERNAME}:${DEFAULT_USERNAME} ${DEFAULT_CONFIG_DIRECTORY} -chown -R ${DEFAULT_USERNAME}:${DEFAULT_USERNAME} ${DEFAULT_LOG_DIRECOTRY} - -# Update systemd for unit file -systemctl daemon-reload - -exit 0 - - -%install -rm -rf %{buildroot} -mkdir -p %{buildroot} -cp -a * %{buildroot} - -%clean -rm -rf %{buildroot} - -%files -%defattr(-,casper,casper,-) -%{_bindir}/* -/var/lib/casper/bin/README.md -/etc/logrotate.d/casper-node -/etc/casper/PLATFORM -/etc/casper/pull_casper_node_version.sh -/etc/casper/network_configs/casper.conf -/etc/casper/network_configs/casper-test.conf -/etc/casper/config_from_example.sh -/etc/casper/node_util.py -/etc/casper/README.md -/etc/casper/validator_keys/README.md -/etc/systemd/system/casper-node-launcher.service diff --git a/Cargo.lock b/Cargo.lock index ec302de..5bc7822 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,36 +1,36 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "addr2line" -version = "0.20.0" +version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4fa78e18c64fce05e902adecd7a5eed15a5e0a3439f7b0e169f0252214865e3" +checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" dependencies = [ "gimli", ] [[package]] -name = "adler" -version = "1.0.2" +name = "adler2" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" [[package]] name = "aho-corasick" -version = "1.0.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43f6cb1bf222025340178f382c426f13757b2960e89779dfcb319c32542a5a41" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" dependencies = [ "memchr", ] [[package]] name = "anyhow" -version = "1.0.72" +version = "1.0.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b13c32d80ecc7ab747b80c3784bce54ee8a7a0cc4fbda9bf4cda2cf6fe90854" +checksum = "34ac096ce696dc2fcabef30516bb13c0a68a11d30131d3df6f04711467681b04" [[package]] name = "atty" @@ -38,30 +38,30 @@ version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ - "hermit-abi 0.1.19", + "hermit-abi", "libc", "winapi", ] [[package]] name = "autocfg" -version = "1.1.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "backtrace" -version = "0.3.68" +version = "0.3.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4319208da049c43661739c5fade2ba182f09d1dc2299b32298d3a31692b17e12" +checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" dependencies = [ "addr2line", - "cc", "cfg-if", "libc", "miniz_oxide", "object", "rustc-demangle", + "windows-targets", ] [[package]] @@ -70,16 +70,21 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "bitflags" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f68f53c83ab957f72c32642f3868eec03eb974d1fb82e453128456482613d36" + [[package]] name = "casper-node-launcher" -version = "1.0.4" +version = "1.0.5" dependencies = [ "anyhow", "backtrace", "clap", "nix", "once_cell", - "rand_core", "semver", "serde", "signal-hook", @@ -91,9 +96,12 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.79" +version = "1.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" +checksum = "0c3d1b2e905a3a7b00a6141adb0e4c0bb941d11caf55349d863942a1cc44e3c9" +dependencies = [ + "shlex", +] [[package]] name = "cfg-if" @@ -108,7 +116,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ea181bf566f71cb9a5d17a59e1871af638180a18fb0035c92ae62b705207123" dependencies = [ "atty", - "bitflags", + "bitflags 1.3.2", "clap_lex", "indexmap", "once_cell", @@ -128,39 +136,37 @@ dependencies = [ [[package]] name = "errno" -version = "0.3.1" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" +checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d" dependencies = [ - "errno-dragonfly", "libc", "windows-sys", ] [[package]] -name = "errno-dragonfly" -version = "0.1.2" +name = "fastrand" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" -dependencies = [ - "cc", - "libc", -] +checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" [[package]] -name = "fastrand" -version = "1.9.0" +name = "getrandom" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" +checksum = "43a49c392881ce6d5c3b8cb70f98717b7c07aabbdff06687b9030dbfbe2725f8" dependencies = [ - "instant", + "cfg-if", + "libc", + "wasi", + "windows-targets", ] [[package]] name = "gimli" -version = "0.27.3" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" +checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" [[package]] name = "hashbrown" @@ -177,12 +183,6 @@ dependencies = [ "libc", ] -[[package]] -name = "hermit-abi" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" - [[package]] name = "indexmap" version = "1.9.3" @@ -193,55 +193,35 @@ dependencies = [ "hashbrown", ] -[[package]] -name = "instant" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "io-lifetimes" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" -dependencies = [ - "hermit-abi 0.3.2", - "libc", - "windows-sys", -] - [[package]] name = "itoa" -version = "1.0.9" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" +checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" [[package]] name = "lazy_static" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.147" +version = "0.2.169" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" +checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a" [[package]] name = "linux-raw-sys" -version = "0.3.8" +version = "0.4.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" +checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" [[package]] name = "log" -version = "0.4.19" +version = "0.4.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4" +checksum = "04cbf5b083de1c7e0222a7a51dbfdba1cbe1c6ab0b15e29fff3f6c077fd9cd9f" [[package]] name = "matchers" @@ -254,9 +234,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.5.0" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "memoffset" @@ -269,11 +249,11 @@ dependencies = [ [[package]] name = "miniz_oxide" -version = "0.7.1" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +checksum = "b3b1c9bd4fe1f0f8b387f6eb9eb3b4a1aa26185e5750efb9140301703f62cd1b" dependencies = [ - "adler", + "adler2", ] [[package]] @@ -282,7 +262,7 @@ version = "0.23.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f3790c00a0150112de0f4cd161e3d7fc4b2d8a5542ffc35f099a2562aecb35c" dependencies = [ - "bitflags", + "bitflags 1.3.2", "cc", "cfg-if", "libc", @@ -301,24 +281,24 @@ dependencies = [ [[package]] name = "object" -version = "0.31.1" +version = "0.36.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bda667d9f2b5051b8833f59f3bf748b28ef54f850f4fcb389a252aa383866d1" +checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87" dependencies = [ "memchr", ] [[package]] name = "once_cell" -version = "1.18.0" +version = "1.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" +checksum = "945462a4b81e43c4e3ba96bd7b49d834c6f61198356aa858733bc4acf3cbe62e" [[package]] name = "os_str_bytes" -version = "6.5.1" +version = "6.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d5d9eb14b174ee9aa2ef96dc2b94637a2d4b6e7cb873c7e171f0c20c6cf3eac" +checksum = "e2355d85b9a3786f481747ced0e0ff2ba35213a1f9bd406ed906554d7af805a1" [[package]] name = "overload" @@ -328,53 +308,38 @@ checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" [[package]] name = "pin-project-lite" -version = "0.2.10" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c40d25201921e5ff0c862a505c6557ea88568a4e3ace775ab55e93f2f4f9d57" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" [[package]] name = "proc-macro2" -version = "1.0.66" +version = "1.0.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" +checksum = "60946a68e5f9d28b0dc1c21bb8a97ee7d018a8b322fa57838ba31cc878e22d99" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.31" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fe8a65d69dd0808184ebb5f836ab526bb259db23c657efa38711b1072ee47f0" +checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc" dependencies = [ "proc-macro2", ] -[[package]] -name = "rand_core" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" - -[[package]] -name = "redox_syscall" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" -dependencies = [ - "bitflags", -] - [[package]] name = "regex" -version = "1.9.1" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2eae68fc220f7cf2532e4494aded17545fce192d59cd996e0fe7887f4ceb575" +checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.3.3", - "regex-syntax 0.7.4", + "regex-automata 0.4.9", + "regex-syntax 0.8.5", ] [[package]] @@ -388,13 +353,13 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.3.3" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39354c10dd07468c2e73926b23bb9c2caca74c5501e38a35da70406f1d923310" +checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.7.4", + "regex-syntax 0.8.5", ] [[package]] @@ -405,25 +370,24 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.7.4" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "rustc-demangle" -version = "0.1.23" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" +checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" [[package]] name = "rustix" -version = "0.37.23" +version = "0.38.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d69718bf81c6127a49dc64e44a742e8bb9213c0ff8869a22c308f84c1d4ab06" +checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" dependencies = [ - "bitflags", + "bitflags 2.8.0", "errno", - "io-lifetimes", "libc", "linux-raw-sys", "windows-sys", @@ -431,33 +395,33 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.15" +version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" +checksum = "6ea1a2d0a644769cc99faa24c3ad26b379b786fe7c36fd3c546254801650e6dd" [[package]] name = "semver" -version = "1.0.18" +version = "1.0.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918" +checksum = "f79dfe2d285b0488816f30e700a7438c5a73d816b5b7d3ac72fbc48b0d185e03" dependencies = [ "serde", ] [[package]] name = "serde" -version = "1.0.171" +version = "1.0.217" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30e27d1e4fd7659406c492fd6cfaf2066ba8773de45ca75e855590f856dc34a9" +checksum = "02fc4265df13d6fa1d00ecff087228cc0a2b5f3c0e87e258d8b94a156e984c70" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.171" +version = "1.0.217" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "389894603bd18c46fa56231694f8d827779c0951a667087194cf9de94ed24682" +checksum = "5a9bf7cf98d04a2b28aead066b7496853d4779c9cc183c440dbac457641e19a0" dependencies = [ "proc-macro2", "quote", @@ -466,24 +430,31 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.103" +version = "1.0.138" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d03b412469450d4404fe8499a268edd7f8b79fecb074b0d812ad64ca21f4031b" +checksum = "d434192e7da787e94a6ea7e9670b26a036d0ca41e0b7efb2676dd32bae872949" dependencies = [ "itoa", + "memchr", "ryu", "serde", ] [[package]] name = "sharded-slab" -version = "0.1.4" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "900fba806f70c630b0a382d0d825e17a0f19fcd059a2ade1ff237bcddf446b31" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" dependencies = [ "lazy_static", ] +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + [[package]] name = "signal-hook" version = "0.3.17" @@ -496,18 +467,18 @@ dependencies = [ [[package]] name = "signal-hook-registry" -version = "1.4.1" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" +checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1" dependencies = [ "libc", ] [[package]] name = "smallvec" -version = "1.11.0" +version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" +checksum = "7fcf8323ef1faaee30a44a340193b1ac6814fd9b7b4e88e9d4519a3e4abe1cfd" [[package]] name = "strsim" @@ -517,9 +488,9 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] name = "syn" -version = "2.0.26" +version = "2.0.98" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45c3457aacde3c65315de5031ec191ce46604304d2446e803d71ade03308d970" +checksum = "36147f1a48ae0ec2b5b3bc5b537d267457555a10dc06f3dbc8cb11ba3006d3b1" dependencies = [ "proc-macro2", "quote", @@ -528,38 +499,38 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.6.0" +version = "3.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31c0432476357e58790aaa47a8efb0c5138f137343f3b5f23bd36a27e3b0a6d6" +checksum = "22e5a0acb1f3f55f65cc4a866c361b2fb2a0ff6366785ae6fbb5f85df07ba230" dependencies = [ - "autocfg", "cfg-if", "fastrand", - "redox_syscall", + "getrandom", + "once_cell", "rustix", "windows-sys", ] [[package]] name = "termcolor" -version = "1.2.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" dependencies = [ "winapi-util", ] [[package]] name = "textwrap" -version = "0.16.0" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d" +checksum = "23d434d3f8967a09480fb04132ebe0a3e088c173e6d0ee7897abbdf4eab0f8b9" [[package]] name = "thread_local" -version = "1.1.7" +version = "1.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" +checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c" dependencies = [ "cfg-if", "once_cell", @@ -576,11 +547,10 @@ dependencies = [ [[package]] name = "tracing" -version = "0.1.37" +version = "0.1.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" +checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" dependencies = [ - "cfg-if", "pin-project-lite", "tracing-attributes", "tracing-core", @@ -588,9 +558,9 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.26" +version = "0.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" +checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" dependencies = [ "proc-macro2", "quote", @@ -599,9 +569,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.31" +version = "0.1.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a" +checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c" dependencies = [ "once_cell", "valuable", @@ -609,20 +579,20 @@ dependencies = [ [[package]] name = "tracing-log" -version = "0.1.3" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ddad33d2d10b1ed7eb9d1f518a5674713876e97e5bb9b7345a7984fbb4f922" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" dependencies = [ - "lazy_static", "log", + "once_cell", "tracing-core", ] [[package]] name = "tracing-serde" -version = "0.1.3" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc6b213177105856957181934e4920de57730fc69bf42c37ee5bb664d406d9e1" +checksum = "704b1aeb7be0d0a84fc9828cae51dab5970fee5088f83d1dd7ee6f6246fc6ff1" dependencies = [ "serde", "tracing-core", @@ -630,9 +600,9 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.3.17" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30a651bc37f915e81f087d86e62a18eec5f79550c7faff886f7090b4ea757c77" +checksum = "e8189decb5ac0fa7bc8b96b7cb9b2701d60d48805aca84a238004d665fcc4008" dependencies = [ "matchers", "nu-ansi-term", @@ -651,15 +621,24 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.11" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" +checksum = "00e2473a93778eb0bad35909dff6a10d28e63f792f16ed15e404fca9d5eeedbe" [[package]] name = "valuable" -version = "0.1.0" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" + +[[package]] +name = "wasi" +version = "0.13.3+wasi-0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" +checksum = "26816d2e1a4a36a2940b96c5296ce403917633dff8f3440e9b236ed6f6bacad2" +dependencies = [ + "wit-bindgen-rt", +] [[package]] name = "winapi" @@ -679,11 +658,11 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.5" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "winapi", + "windows-sys", ] [[package]] @@ -694,22 +673,23 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "windows-sys" -version = "0.48.0" +version = "0.59.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" dependencies = [ "windows-targets", ] [[package]] name = "windows-targets" -version = "0.48.1" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ "windows_aarch64_gnullvm", "windows_aarch64_msvc", "windows_i686_gnu", + "windows_i686_gnullvm", "windows_i686_msvc", "windows_x86_64_gnu", "windows_x86_64_gnullvm", @@ -718,42 +698,57 @@ dependencies = [ [[package]] name = "windows_aarch64_gnullvm" -version = "0.48.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" [[package]] name = "windows_aarch64_msvc" -version = "0.48.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" [[package]] name = "windows_i686_gnu" -version = "0.48.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" [[package]] name = "windows_i686_msvc" -version = "0.48.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" [[package]] name = "windows_x86_64_gnu" -version = "0.48.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" [[package]] name = "windows_x86_64_gnullvm" -version = "0.48.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" [[package]] name = "windows_x86_64_msvc" -version = "0.48.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "wit-bindgen-rt" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3268f3d866458b787f390cf61f4bbb563b922d091359f9608842999eaee3943c" +dependencies = [ + "bitflags 2.8.0", +] diff --git a/Cargo.toml b/Cargo.toml index 625f40c..1af321c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "casper-node-launcher" -version = "1.0.4" +version = "1.0.5" authors = ["Fraser Hutchison ", "Joe Sacher "] edition = "2018" description = "A binary which runs and upgrades the casper-node of the Casper network" @@ -25,7 +25,6 @@ tracing-subscriber = { version = "0.3.17", features = ["json", "env-filter"] } [dev-dependencies] once_cell = "1.5.2" -rand_core = "0.6.2" tempfile = "3.6.0" [package.metadata.deb] @@ -36,7 +35,6 @@ assets = [ ["./target/release/casper-node-launcher", "/usr/bin/casper-node-launcher", "755"], ["./resources/BIN_README.md", "/var/lib/casper/bin/README.md", "755"], ["./resources/maintainer_scripts/logrotate.d/casper-node", "/etc/logrotate.d/casper-node", "644"], - ["./resources/PLATFORM_DEB", "/etc/casper/PLATFORM", "644"], ["./resources/maintainer_scripts/network_configs/*", "/etc/casper/network_configs/", "644"], ["./resources/maintainer_scripts/node_util.py", "/etc/casper/node_util.py", "755"], ["./resources/ETC_README.md", "/etc/casper/README.md", "644"], @@ -51,34 +49,14 @@ For information on using package, see https://github.com/casper-network/casper-n [package.metadata.deb.variants.focal] +[package.metadata.deb.variants.jammy] + +[package.metadata.deb.variants.noble] [package.metadata.deb.systemd-units] unit-name = "casper-node-launcher" enable = true unit-scripts = "resources/maintainer_scripts/casper_node_launcher" start = false -restart-after-upgrade = false +restart-after-upgrade = true stop-on-upgrade = false - - -[package.metadata.rpm] -package = "casper-node-launcher" - -[package.metadata.rpm.cargo] -buildflags = ["--release"] - -[package.metadata.rpm.systemd-units] -unit-scripts = "./resources/maintainer_scripts/casper_node_launcher" -restart-after-upgrade = false - -[package.metadata.rpm.targets] -casper-node-launcher = { path = "/usr/bin/casper-node-launcher" } -"../../resources/BIN_README.md" = {path = "/var/lib/casper/bin/README.md"} -"../../resources/PLATFORM_RPM" = {path = "/etc/casper/PLATFORM"} -"../../resources/maintainer_scripts/logrotate.d/casper-node" = {path = "/etc/logrotate.d/casper-node"} -"../../resources/maintainer_scripts/network_configs/casper.conf" = {path = "/etc/casper/network_configs/casper.conf"} -"../../resources/maintainer_scripts/network_configs/casper-test.conf" = {path = "/etc/casper/network_configs/casper-test.conf"} -"../../resources/maintainer_scripts/node_util.py" = {path = "/etc/casper/node_util.py"} -"../../resources/ETC_README.md" = {path = "/etc/casper/README.md"} -"../../resources/VALIDATOR_KEYS_README.md" = {path = "/etc/casper/validator_keys/README.md"} -"../../resources/maintainer_scripts/casper_node_launcher/casper-node-launcher.service" = {path = "/etc/systemd/system/casper-node-launcher.service"} diff --git a/resources/PLATFORM_DEB b/resources/PLATFORM_DEB deleted file mode 100644 index 811c85f..0000000 --- a/resources/PLATFORM_DEB +++ /dev/null @@ -1 +0,0 @@ -deb \ No newline at end of file diff --git a/resources/PLATFORM_RPM b/resources/PLATFORM_RPM deleted file mode 100644 index 7c88ef3..0000000 --- a/resources/PLATFORM_RPM +++ /dev/null @@ -1 +0,0 @@ -rpm \ No newline at end of file diff --git a/resources/maintainer_scripts/config_from_example.sh b/resources/maintainer_scripts/config_from_example.sh deleted file mode 100755 index b8f06a0..0000000 --- a/resources/maintainer_scripts/config_from_example.sh +++ /dev/null @@ -1,121 +0,0 @@ -#!/usr/bin/env bash -set -e - -# This script will generate a CONFIG file appropriate to installation machine. - -echo "This script is deprecated and will be removed." -echo "Use node_util.py config_from_example." - -USERNAME=casper - -if [ "$(whoami)" != "$USERNAME" ]; then - echo - echo "Script must be run as user: $USERNAME" - echo "Do this with 'sudo -u $USERNAME $0 [optional external IP]'" - echo - exit 1 -fi - -if [ -z "$1" ]; then - echo - echo "Error: version argument missing." - echo "config-example.toml should exist in a given /etc/casper/[version] folder." - echo "" - echo "Ex: for version 1.0.1 of casper-node, /etc/casper/1_0_1/config-example.toml should exist." - echo " Should be called with '${0} 1_0_1'" - echo - exit 1 -fi - -CONFIG_PATH="/etc/casper/$1" -CONFIG="$CONFIG_PATH/config.toml" -CONFIG_EXAMPLE="$CONFIG_PATH/config-example.toml" -CONFIG_NEW="$CONFIG_PATH/config.toml.new" - -if [ ! -f "$CONFIG_EXAMPLE" ]; then - echo - echo "Error: $CONFIG_EXAMPLE not found." - echo - exit 2 -fi - -function valid_ip() -{ - local ip=$1 - local stat=1 - - if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then - OIFS=$IFS - IFS='.' - ip=($ip) - IFS=$OIFS - [[ ${ip[0]} -le 255 && ${ip[1]} -le 255 \ - && ${ip[2]} -le 255 && ${ip[3]} -le 255 ]] - stat=$? - fi - return $stat -} - -if [ -z "$2" ]; then - # IP to be detected - function curl_ext_ip() - { - result=$(curl -s --max-time 10 --connect-timeout 10 "$1") || result='dead pipe' - } - - URLS=("https://checkip.amazonaws.com" "https://ifconfig.me" "https://ident.me") - NAMES=("amazonaws.com" "ifconfig.me" "ident.me") - RESULTS=() - array_len=${#URLS[@]} - - echo "Trying to get external IP from couple of services ..." - - for (( i=0; i<$array_len; i++ )); do - curl_ext_ip "${URLS[$i]}" - if [[ $result != "dead pipe" ]]; then - RESULTS+=($result) - fi - echo "${NAMES[$i]} report: $result" - done - - IPv4_STRING='(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)' - EXTERNAL_IP=$(echo "${RESULTS[@]}" | awk '{for(i=1;i<=NF;i++) print $i}' | awk '!x[$0]++' | grep -E -o "$IPv4_STRING" | head -n 1) - - if valid_ip $EXTERNAL_IP; then - echo "Using External IP: $EXTERNAL_IP" - else - echo - echo "WARNING: Can't get external VPS IP automatically." - echo "Run script again with '$0 $1 '" - echo - exit 3 - fi - -else - # IP passed into script - EXTERNAL_IP=$2 - if valid_ip $EXTERNAL_IP; then - echo "Using provided IP: $EXTERNAL_IP" - else - echo - echo "Error: Provided IP: $EXTERNAL_IP is invalid. Expected IPv4 address." - echo - exit 4 - fi - -fi - -OUTFILE=$CONFIG - -if [[ -f $OUTFILE ]]; then - OUTFILE=$CONFIG_NEW - if [[ -f $OUTFILE ]]; then - rm $OUTFILE - fi - echo "Previous $CONFIG exists, creating as $OUTFILE from $CONFIG_EXAMPLE." - echo "Replace $CONFIG with $OUTFILE to use the automatically generated configuration." -else - echo "Creating $OUTFILE from $CONFIG_EXAMPLE." -fi - -sed "s//${EXTERNAL_IP}/" $CONFIG_EXAMPLE > $OUTFILE diff --git a/resources/maintainer_scripts/logrotate.d/casper-node b/resources/maintainer_scripts/logrotate.d/casper-node index 0265265..340eea5 100644 --- a/resources/maintainer_scripts/logrotate.d/casper-node +++ b/resources/maintainer_scripts/logrotate.d/casper-node @@ -5,7 +5,7 @@ compress daily rotate 7 - size 1G + maxsize 1G missingok notifempty copytruncate diff --git a/resources/maintainer_scripts/network_configs/casper.conf b/resources/maintainer_scripts/network_configs/casper.conf index 3926ab2..e924e69 100644 --- a/resources/maintainer_scripts/network_configs/casper.conf +++ b/resources/maintainer_scripts/network_configs/casper.conf @@ -1,3 +1,2 @@ -SOURCE_URL=genesis.casperlabs.io +SOURCE_URL=genesis.casper.network NETWORK_NAME=casper -BIN_MODE=mainnet \ No newline at end of file diff --git a/resources/maintainer_scripts/node_util.py b/resources/maintainer_scripts/node_util.py index eda36d4..0b67525 100755 --- a/resources/maintainer_scripts/node_util.py +++ b/resources/maintainer_scripts/node_util.py @@ -212,22 +212,8 @@ def _pull_protocol_version(self, protocol_version, platform="deb"): print(f"Error: expected config file location {NodeUtil.CONFIG_PATH} not found.") exit(1) - # Expectation is one config.tar.gz but multiple bin*.tar.gz - # bin.tar.gz is mainnet bin and debian - # bin_new.tar.gz is post 1.4.0 launch and debian - # bin_rpm.tar.gz is mainnet bin and RHEL (_arch will be used for others in the future) - # bin_rpm_new.tar.gz is post 1.4.0 launch and RHEL - - bin_file = "bin" - if platform != "deb": - # Handle alternative builds - bin_file += f"_{platform}" - if self._bin_mode != "mainnet": - # Handle non mainnet for post 1.4.0 launched networks - bin_file += "_new" - bin_file += ".tar.gz" + bin_file = "bin.tar.gz" config_file = "config.tar.gz" - print(f"Using bin mode file of {bin_file}") etc_full_path = NodeUtil.CONFIG_PATH / protocol_version bin_full_path = NodeUtil.BIN_PATH / protocol_version diff --git a/resources/maintainer_scripts/pull_casper_node_version.sh b/resources/maintainer_scripts/pull_casper_node_version.sh deleted file mode 100755 index 28efd55..0000000 --- a/resources/maintainer_scripts/pull_casper_node_version.sh +++ /dev/null @@ -1,164 +0,0 @@ -#!/usr/bin/env bash - -# This script will pull casper-node software and associated files required to run or upgrade -# casper-node. - -echo "This script is deprecated and will be removed." -echo "Use node_util.py stage_protocols." - -USERNAME=casper -ARGUMENT_EXAMPLES=" " - -if [ "$(whoami)" != "$USERNAME" ]; then - echo - echo "Script must be run as user: $USERNAME" - echo "Do this with 'sudo -u $USERNAME $0' $ARGUMENT_EXAMPLES" - echo - exit 1 -fi - -if [ -z "$1" ]; then - echo - echo "Error: arguments missing" - echo "Expected $0 $ARGUMENT_EXAMPLES" - echo "Example: $0 casper.conf 1_0_0" - echo - exit 2 -fi - -if [ -z "$2" ]; then - echo - echo "Error: arguments missing" - echo "Expected $0 $ARGUMENT_EXAMPLES" - echo "Example: $0 casper.conf 1_0_0" - echo - exit 3 -fi - -SEMVER=$2 -if [[ ! $SEMVER =~ ^[0-9]+_[0-9]+_[0-9]+ ]]; then - echo - echo "Error: Illegal semver format. Please use __ such as 1_0_0." - echo - exit 4 -fi -CONFIG="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )/network_configs/$1" - -if [ ! -f "$CONFIG" ]; then - echo - echo "Config file given: $CONFIG does not exist." - echo - exit 5 -fi - -# This should set SOURCE_URL and NETWORK_NAME vars -source "$CONFIG" - -if [ "$SOURCE_URL" == "" ]; then - echo - echo "Error: source_url not set and expected from '$CONFIG'." - echo - exit 6 -fi - -if [ "$NETWORK_NAME" == "" ]; then - echo - echo "Error: network_name not set and expected from '$CONFIG'." - echo - exit 7 -fi - -ETC_PATH="/etc/casper" -BIN_PATH="/var/lib/casper/bin" - -if [ ! -d "$ETC_PATH" ]; then - echo - echo "Error: expected config file location $ETC_PATH not found." - echo - exit 8 -fi - -if [ ! -d "$BIN_PATH" ]; then - echo - echo "Error: expected bin file location $BIN_PATH not found." - echo - exit 9 -fi - -ETC_FULL_PATH="$ETC_PATH/$SEMVER" -BIN_FULL_PATH="$BIN_PATH/$SEMVER" - -BASE_URL="http://$SOURCE_URL/$NETWORK_NAME/$SEMVER" -CONFIG_ARCHIVE="config.tar.gz" -CONFIG_URL="$BASE_URL/$CONFIG_ARCHIVE" -BIN_ARCHIVE="bin.tar.gz" -BIN_URL="$BASE_URL/$BIN_ARCHIVE" - -cd $ETC_PATH - -echo "Verifying semver Path" -curl -I 2>/dev/null "$CONFIG_URL" | head -1 | grep 404 >/dev/null -if [ $? == 0 ]; then - echo - echo "$CONFIG_URL not found. Please verify provided arguments" - echo - exit 10 -fi -curl -I 2>/dev/null "$BIN_URL" | head -1 | grep 404 >/dev/null -if [ $? == 0 ]; then - echo - echo "$BIN_URL not found. Please verify provided arguments" - echo - exit 11 -fi - -if [ -d "$ETC_FULL_PATH" ]; then - echo - echo "Error: config version path $ETC_FULL_PATH already exists. Aborting." - echo - exit 12 -fi - -if [ -d "$BIN_FULL_PATH" ]; then - echo - echo "Error: bin version path $BIN_FULL_PATH already exists. Aborting." - echo - exit 13 -fi - -echo "Downloading $CONFIG_ARCHIVE from $CONFIG_URL" -if curl -JLO "$CONFIG_URL"; then - echo "Complete" -else - echo "Error: unable to pull $CONFIG_ARCHIVE from $CONFIG_URL." - echo "File probably doesn't exist. Please verify provided arguments" - exit 14 -fi -CONFIG_ARCHIVE_PATH="$ETC_PATH/$CONFIG_ARCHIVE" - -echo "Downloading $BIN_ARCHIVE from $BIN_URL" -if curl -JLO "$BIN_URL"; then - echo "Complete" -else - echo "Error: unable to pull $BIN_ARCHIVE from $BIN_URL" - echo "File probably doesn't exist. Please verify provided arguments" - exit 15 -fi -BIN_ARCHIVE_PATH="$ETC_PATH/$BIN_ARCHIVE" - -echo "Extracting $BIN_ARCHIVE to $BIN_FULL_PATH" -mkdir -p "$BIN_FULL_PATH" -cd "$BIN_FULL_PATH" -tar -xzvf "$BIN_ARCHIVE_PATH" . - -echo "Extracting $CONFIG_ARCHIVE to $ETC_FULL_PATH" -mkdir -p "$ETC_FULL_PATH" -cd "$ETC_FULL_PATH" -tar -xzvf "$CONFIG_ARCHIVE_PATH" - -echo "Removing $BIN_ARCHIVE_PATH" -rm "$BIN_ARCHIVE_PATH" -echo "Removing $CONFIG_ARCHIVE_PATH" -rm "$CONFIG_ARCHIVE_PATH" - -echo "Process Complete." diff --git a/src/launcher.rs b/src/launcher.rs index 8cf0a77..393235c 100644 --- a/src/launcher.rs +++ b/src/launcher.rs @@ -246,7 +246,7 @@ impl Launcher { // because if there are no valid versions installed the `utils::versions_from_path()` bails. Ok(all_versions .into_iter() - .last() + .next_back() .expect("must have at least one version")) } diff --git a/src/main.rs b/src/main.rs index a85b569..738cc22 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,7 +4,7 @@ mod logging; mod utils; use std::{ - panic::{self, PanicInfo}, + panic::{self, PanicHookInfo}, str::FromStr, sync::{ atomic::{AtomicU32, Ordering}, @@ -39,7 +39,7 @@ fn stop_child() { } /// A panic handler which ensures the child process is killed before this process exits. -fn panic_hook(info: &PanicInfo) { +fn panic_hook(info: &PanicHookInfo) { let backtrace = Backtrace::new(); eprintln!("{:?}", backtrace); diff --git a/src/utils.rs b/src/utils.rs index bd364e6..7c52cbe 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -27,7 +27,7 @@ pub(crate) fn next_installed_version>( dir: P, current_version: &Version, ) -> Result { - let max_version = Version::new(u64::max_value(), u64::max_value(), u64::max_value()); + let max_version = Version::new(u64::MAX, u64::MAX, u64::MAX); let mut next_version = max_version.clone(); for installed_version in versions_from_path(dir)? {