From e538f6b168064d8d4e4a82bbeba8b7caad7e30fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Zwoli=C5=84ski?= Date: Mon, 28 Aug 2023 23:47:05 +0200 Subject: [PATCH] feat: use stable rust toolchain (#264) Remove the 'different-binary-name' feature. Remove the 'more_qualified_paths' feature. Unexport the 'superstruct_ssr' macro and keep it private. --- .github/workflows/release.yml | 30 +++++++++++++++--------------- .github/workflows/test.yml | 8 ++++---- README.md | 4 ++-- cli/Cargo.toml | 5 +---- consensus/src/lib.rs | 2 -- consensus/src/types/mod.rs | 4 +--- consensus/src/types/utils.rs | 14 ++++++++------ rust-toolchain | 1 - 8 files changed, 31 insertions(+), 37 deletions(-) delete mode 100644 rust-toolchain diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ed98102e..74c51d19 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,10 +10,10 @@ jobs: - name: checkout uses: actions/checkout@v1 - - name: install rust nightly + - name: install rust uses: actions-rs/toolchain@v1 with: - toolchain: nightly + toolchain: stable default: true override: true @@ -31,7 +31,7 @@ jobs: - name: generate tag name id: tag run: | - echo "::set-output name=release_tag::nightly-${GITHUB_SHA}" + echo "::set-output name=release_tag::${GITHUB_SHA}" - name: release uses: softprops/action-gh-release@v1 @@ -49,10 +49,10 @@ jobs: - name: checkout uses: actions/checkout@v1 - - name: install rust nightly + - name: install rust uses: actions-rs/toolchain@v1 with: - toolchain: nightly + toolchain: stable default: true override: true @@ -70,7 +70,7 @@ jobs: - name: generate tag name id: tag run: | - echo "::set-output name=release_tag::nightly-${GITHUB_SHA}" + echo "::set-output name=release_tag::${GITHUB_SHA}" - name: release uses: softprops/action-gh-release@v1 @@ -88,10 +88,10 @@ jobs: - name: checkout uses: actions/checkout@v1 - - name: install rust nightly + - name: install rust uses: actions-rs/toolchain@v1 with: - toolchain: nightly + toolchain: stable default: true override: true @@ -115,7 +115,7 @@ jobs: - name: generate tag name id: tag run: | - echo "::set-output name=release_tag::nightly-${GITHUB_SHA}" + echo "::set-output name=release_tag::${GITHUB_SHA}" - name: release uses: softprops/action-gh-release@v1 @@ -133,10 +133,10 @@ jobs: - name: checkout uses: actions/checkout@v1 - - name: install rust nightly + - name: install rust uses: actions-rs/toolchain@v1 with: - toolchain: nightly + toolchain: stable default: true override: true @@ -154,7 +154,7 @@ jobs: - name: generate tag name id: tag run: | - echo "::set-output name=release_tag::nightly-${GITHUB_SHA}" + echo "::set-output name=release_tag::${GITHUB_SHA}" - name: release uses: softprops/action-gh-release@v1 @@ -172,10 +172,10 @@ jobs: - name: checkout uses: actions/checkout@v1 - - name: install rust nightly + - name: install rust uses: actions-rs/toolchain@v1 with: - toolchain: nightly + toolchain: stable default: true override: true @@ -202,7 +202,7 @@ jobs: - name: generate tag name id: tag run: | - echo "::set-output name=release_tag::nightly-${GITHUB_SHA}" + echo "::set-output name=release_tag::${GITHUB_SHA}" - name: release uses: softprops/action-gh-release@v1 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9366dc0e..7fe26d8e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,7 +18,7 @@ jobs: - uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: nightly + toolchain: stable override: true - uses: Swatinem/rust-cache@v2 - uses: actions-rs/cargo@v1 @@ -32,7 +32,7 @@ jobs: - uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: nightly + toolchain: stable override: true - uses: Swatinem/rust-cache@v2 - uses: actions-rs/cargo@v1 @@ -47,7 +47,7 @@ jobs: - uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: nightly + toolchain: stable override: true components: rustfmt - uses: Swatinem/rust-cache@v2 @@ -63,7 +63,7 @@ jobs: - uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: nightly + toolchain: stable override: true components: clippy - uses: Swatinem/rust-cache@v2 diff --git a/README.md b/README.md index 6d702b86..90927c7d 100644 --- a/README.md +++ b/README.md @@ -104,7 +104,7 @@ A comprehensive breakdown of config options is available in the [config.md](./co ### Using Helios as a Library -Helios can be imported into any Rust project. Helios requires the Rust nightly toolchain to compile. +Helios can be imported into any Rust project. ```rust use std::{str::FromStr, env}; @@ -212,7 +212,7 @@ To learn more about [helios](https://github.com/a16z/helios) benchmarking and to ## Contributing -All contributions to Helios are welcome. Before opening a PR, please submit an issue detailing the bug or feature. When opening a PR, please ensure that your contribution builds on the nightly rust toolchain, has been linted with `cargo fmt`, and contains tests when applicable. +All contributions to Helios are welcome. Before opening a PR, please submit an issue detailing the bug or feature. When opening a PR, please ensure that your contribution builds, has been linted with `cargo fmt`, and contains tests when applicable. ## Telegram diff --git a/cli/Cargo.toml b/cli/Cargo.toml index d2056328..0c3e5e5b 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -1,13 +1,10 @@ -cargo-features = ["different-binary-name"] - [package] name = "cli" version = "0.4.1" edition = "2021" [[bin]] -name = "cli" -filename = "helios" +name = "helios" path = "src/main.rs" [dependencies] diff --git a/consensus/src/lib.rs b/consensus/src/lib.rs index 4c60b137..c76a37a8 100644 --- a/consensus/src/lib.rs +++ b/consensus/src/lib.rs @@ -1,5 +1,3 @@ -#![feature(more_qualified_paths)] - pub mod database; pub mod errors; pub mod rpc; diff --git a/consensus/src/types/mod.rs b/consensus/src/types/mod.rs index 666be99b..909a199a 100644 --- a/consensus/src/types/mod.rs +++ b/consensus/src/types/mod.rs @@ -3,10 +3,8 @@ use ssz_rs::prelude::*; use superstruct::superstruct; -use crate::superstruct_ssz; - use self::primitives::{ByteList, ByteVector, U64}; -use self::utils::{header_deserialize, u256_deserialize}; +use self::utils::{header_deserialize, superstruct_ssz, u256_deserialize}; pub mod primitives; mod utils; diff --git a/consensus/src/types/utils.rs b/consensus/src/types/utils.rs index 4a7db4c2..fbea14f4 100644 --- a/consensus/src/types/utils.rs +++ b/consensus/src/types/utils.rs @@ -45,14 +45,13 @@ struct Beacon { beacon: Header, } -#[macro_export] macro_rules! superstruct_ssz { - ($type:ty) => { + ($type:tt) => { impl ssz_rs::Merkleized for $type { fn hash_tree_root(&mut self) -> Result { match self { - <$type>::Bellatrix(inner) => inner.hash_tree_root(), - <$type>::Capella(inner) => inner.hash_tree_root(), + $type::Bellatrix(inner) => inner.hash_tree_root(), + $type::Capella(inner) => inner.hash_tree_root(), } } } @@ -70,8 +69,8 @@ macro_rules! superstruct_ssz { impl ssz_rs::Serialize for $type { fn serialize(&self, buffer: &mut Vec) -> Result { match self { - <$type>::Bellatrix(inner) => inner.serialize(buffer), - <$type>::Capella(inner) => inner.serialize(buffer), + $type::Bellatrix(inner) => inner.serialize(buffer), + $type::Capella(inner) => inner.serialize(buffer), } } } @@ -89,6 +88,9 @@ macro_rules! superstruct_ssz { }; } +/// this has to go after macro definition +pub(crate) use superstruct_ssz; + impl From for Block { fn from(value: ExecutionPayload) -> Block { let empty_nonce = "0x0000000000000000".to_string(); diff --git a/rust-toolchain b/rust-toolchain deleted file mode 100644 index 4a03c148..00000000 --- a/rust-toolchain +++ /dev/null @@ -1 +0,0 @@ -nightly-2023-07-31