From 2fcbeb7d6a61d1898c6f4b5ef9ee2d3542c18911 Mon Sep 17 00:00:00 2001 From: Ekleog-NEAR <96595974+Ekleog-NEAR@users.noreply.github.com> Date: Tue, 5 Dec 2023 09:58:32 +0100 Subject: [PATCH] Remove rust-version.workspace = true from published crates (#10292) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This comes at the request of dev-hub, where dependencies downstream have been having issues with our aggressive rust-version policy. Supporting only the latest rust-version is not enough for them. As a consequence, we’re removing rust-version here. This sounds like a more semantically reasonable use for rust-version anyway: a crate without rust-version set should be assumed to work with the latest stable version anyway, and maybe more without guarantees… which is exactly our guarantees. Also update the themis tool to make sure we don’t make this mistake again. --- Cargo.toml | 6 +++++- chain/chain-primitives/Cargo.toml | 1 - chain/chunks-primitives/Cargo.toml | 1 - chain/client-primitives/Cargo.toml | 1 - chain/indexer-primitives/Cargo.toml | 1 - chain/jsonrpc-primitives/Cargo.toml | 1 - core/chain-configs/Cargo.toml | 1 - core/crypto/Cargo.toml | 1 - core/dyn-configs/Cargo.toml | 1 - core/o11y/Cargo.toml | 1 - core/primitives-core/Cargo.toml | 1 - core/primitives/Cargo.toml | 1 - runtime/near-vm-runner/Cargo.toml | 1 - runtime/near-vm/compiler-singlepass/Cargo.toml | 1 - runtime/near-vm/compiler/Cargo.toml | 1 - runtime/near-vm/engine/Cargo.toml | 1 - runtime/near-vm/types/Cargo.toml | 1 - runtime/near-vm/vm/Cargo.toml | 1 - tools/rpctypegen/core/Cargo.toml | 1 - tools/rpctypegen/macro/Cargo.toml | 1 - tools/themis/src/rules.rs | 11 +++++++---- utils/config/Cargo.toml | 1 - utils/fmt/Cargo.toml | 1 - utils/near-cache/Cargo.toml | 1 - utils/near-stable-hasher/Cargo.toml | 1 - utils/stdx/Cargo.toml | 1 - 26 files changed, 12 insertions(+), 29 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 69d4d4a9def..1b69ded265e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,7 +7,11 @@ repository = "https://github.com/near/nearcore" license = "MIT OR Apache-2.0" [workspace.metadata.workspaces] -# shared version of all public crates in the workspace +# Shared version of all public crates in the workspace. +# This is only used for crates that are not stable. +# Most crates are not stable on purpose, as maintaining API compatibility is a +# significant developer time expense. Please think thoroughly before adding +# anything to the list of stable crates. version = "0.17.0" exclude = ["neard"] diff --git a/chain/chain-primitives/Cargo.toml b/chain/chain-primitives/Cargo.toml index cb92c3075ca..70dc143883d 100644 --- a/chain/chain-primitives/Cargo.toml +++ b/chain/chain-primitives/Cargo.toml @@ -3,7 +3,6 @@ name = "near-chain-primitives" version.workspace = true authors.workspace = true edition.workspace = true -rust-version.workspace = true description = "This crate hosts NEAR chain-related error types" repository.workspace = true license.workspace = true diff --git a/chain/chunks-primitives/Cargo.toml b/chain/chunks-primitives/Cargo.toml index 8b102524e01..a0307d315a4 100644 --- a/chain/chunks-primitives/Cargo.toml +++ b/chain/chunks-primitives/Cargo.toml @@ -3,7 +3,6 @@ name = "near-chunks-primitives" version.workspace = true authors.workspace = true edition.workspace = true -rust-version.workspace = true description = "This crate hosts NEAR chunks-related error types" repository.workspace = true license.workspace = true diff --git a/chain/client-primitives/Cargo.toml b/chain/client-primitives/Cargo.toml index f0b72459468..abdc92dbcdc 100644 --- a/chain/client-primitives/Cargo.toml +++ b/chain/client-primitives/Cargo.toml @@ -3,7 +3,6 @@ name = "near-client-primitives" version.workspace = true authors.workspace = true edition.workspace = true -rust-version.workspace = true description = "This crate hosts NEAR client-related error types" repository.workspace = true license.workspace = true diff --git a/chain/indexer-primitives/Cargo.toml b/chain/indexer-primitives/Cargo.toml index 2b962a793bb..9c8ee8ec5d4 100644 --- a/chain/indexer-primitives/Cargo.toml +++ b/chain/indexer-primitives/Cargo.toml @@ -3,7 +3,6 @@ name = "near-indexer-primitives" version.workspace = true authors.workspace = true edition.workspace = true -rust-version.workspace = true description = "This crate hosts structures for the NEAR Indexer Framework types" repository.workspace = true license.workspace = true diff --git a/chain/jsonrpc-primitives/Cargo.toml b/chain/jsonrpc-primitives/Cargo.toml index 0f1e5b2e423..6c83b93ee2a 100644 --- a/chain/jsonrpc-primitives/Cargo.toml +++ b/chain/jsonrpc-primitives/Cargo.toml @@ -3,7 +3,6 @@ name = "near-jsonrpc-primitives" version.workspace = true authors.workspace = true edition.workspace = true -rust-version.workspace = true description = "This crate hosts structures for the NEAR JSON RPC Requests, Responses and Error types" repository.workspace = true license.workspace = true diff --git a/core/chain-configs/Cargo.toml b/core/chain-configs/Cargo.toml index b61d88082bc..37d41a17c91 100644 --- a/core/chain-configs/Cargo.toml +++ b/core/chain-configs/Cargo.toml @@ -3,7 +3,6 @@ name = "near-chain-configs" version.workspace = true authors.workspace = true edition.workspace = true -rust-version.workspace = true description = "This crate provides typed interfaces to the NEAR Genesis and Chain Configs" repository.workspace = true license.workspace = true diff --git a/core/crypto/Cargo.toml b/core/crypto/Cargo.toml index ebb3dfa349f..4bf25ae5039 100644 --- a/core/crypto/Cargo.toml +++ b/core/crypto/Cargo.toml @@ -3,7 +3,6 @@ name = "near-crypto" version.workspace = true authors.workspace = true edition.workspace = true -rust-version.workspace = true description = "This is an internal crate for common cryptographic types" repository.workspace = true license.workspace = true diff --git a/core/dyn-configs/Cargo.toml b/core/dyn-configs/Cargo.toml index 57c12dc3646..d6b573009fd 100644 --- a/core/dyn-configs/Cargo.toml +++ b/core/dyn-configs/Cargo.toml @@ -3,7 +3,6 @@ name = "near-dyn-configs" version.workspace = true authors.workspace = true edition.workspace = true -rust-version.workspace = true description = "Dynamic configure helpers for the near codebase" repository.workspace = true license.workspace = true diff --git a/core/o11y/Cargo.toml b/core/o11y/Cargo.toml index 20373a3f3d0..36a4bc27650 100644 --- a/core/o11y/Cargo.toml +++ b/core/o11y/Cargo.toml @@ -3,7 +3,6 @@ name = "near-o11y" version.workspace = true authors.workspace = true edition.workspace = true -rust-version.workspace = true description = "Observability helpers for the near codebase" repository.workspace = true license.workspace = true diff --git a/core/primitives-core/Cargo.toml b/core/primitives-core/Cargo.toml index 457a9d50f11..1a46b39ecd8 100644 --- a/core/primitives-core/Cargo.toml +++ b/core/primitives-core/Cargo.toml @@ -3,7 +3,6 @@ name = "near-primitives-core" version.workspace = true authors.workspace = true edition.workspace = true -rust-version.workspace = true description = "This crate provides the core set of primitives used by other nearcore crates including near-primitives" repository.workspace = true license.workspace = true diff --git a/core/primitives/Cargo.toml b/core/primitives/Cargo.toml index 84258f3d2f3..57025c21000 100644 --- a/core/primitives/Cargo.toml +++ b/core/primitives/Cargo.toml @@ -3,7 +3,6 @@ name = "near-primitives" version.workspace = true authors.workspace = true edition.workspace = true -rust-version.workspace = true description = "This crate provides the base set of primitives used by other nearcore crates" repository.workspace = true license.workspace = true diff --git a/runtime/near-vm-runner/Cargo.toml b/runtime/near-vm-runner/Cargo.toml index edbe3494290..7ae9ee63b34 100644 --- a/runtime/near-vm-runner/Cargo.toml +++ b/runtime/near-vm-runner/Cargo.toml @@ -3,7 +3,6 @@ name = "near-vm-runner" version.workspace = true authors.workspace = true edition.workspace = true -rust-version.workspace = true description = "This crate implements the specification of the interface that Near blockchain exposes to the smart contracts." repository.workspace = true license.workspace = true diff --git a/runtime/near-vm/compiler-singlepass/Cargo.toml b/runtime/near-vm/compiler-singlepass/Cargo.toml index 17c1a5e5ce1..c08575b5f39 100644 --- a/runtime/near-vm/compiler-singlepass/Cargo.toml +++ b/runtime/near-vm/compiler-singlepass/Cargo.toml @@ -10,7 +10,6 @@ license = "MIT" readme = "README.md" edition = "2021" publish = true -rust-version.workspace = true [lints] workspace = true diff --git a/runtime/near-vm/compiler/Cargo.toml b/runtime/near-vm/compiler/Cargo.toml index 3f9d13a4689..3f4ac39c0cd 100644 --- a/runtime/near-vm/compiler/Cargo.toml +++ b/runtime/near-vm/compiler/Cargo.toml @@ -10,7 +10,6 @@ license = "MIT OR Apache-2.0 WITH LLVM-exception" readme = "README.md" edition = "2021" publish = true -rust-version.workspace = true [lints] workspace = true diff --git a/runtime/near-vm/engine/Cargo.toml b/runtime/near-vm/engine/Cargo.toml index 27b727d3fe9..ac112e7dea3 100644 --- a/runtime/near-vm/engine/Cargo.toml +++ b/runtime/near-vm/engine/Cargo.toml @@ -10,7 +10,6 @@ license = "MIT OR Apache-2.0 WITH LLVM-exception " readme = "README.md" edition = "2021" publish = true -rust-version.workspace = true [lints] workspace = true diff --git a/runtime/near-vm/types/Cargo.toml b/runtime/near-vm/types/Cargo.toml index 96a393d2812..9ce7cf317b2 100644 --- a/runtime/near-vm/types/Cargo.toml +++ b/runtime/near-vm/types/Cargo.toml @@ -10,7 +10,6 @@ license = "MIT OR Apache-2.0 WITH LLVM-exception" readme = "README.md" edition = "2021" publish = true -rust-version.workspace = true [lints] workspace = true diff --git a/runtime/near-vm/vm/Cargo.toml b/runtime/near-vm/vm/Cargo.toml index 7125346cb46..6dfbc451f5f 100644 --- a/runtime/near-vm/vm/Cargo.toml +++ b/runtime/near-vm/vm/Cargo.toml @@ -10,7 +10,6 @@ license = "MIT OR Apache-2.0 WITH LLVM-exception" readme = "README.md" edition = "2021" publish = true -rust-version.workspace = true [lints] workspace = true diff --git a/tools/rpctypegen/core/Cargo.toml b/tools/rpctypegen/core/Cargo.toml index c9dc8b47539..4274587dbff 100644 --- a/tools/rpctypegen/core/Cargo.toml +++ b/tools/rpctypegen/core/Cargo.toml @@ -3,7 +3,6 @@ name = "near-rpc-error-core" version.workspace = true authors.workspace = true edition.workspace = true -rust-version.workspace = true description = "This crate generates schema for Rust structs which can be used by TypeScript." repository.workspace = true license.workspace = true diff --git a/tools/rpctypegen/macro/Cargo.toml b/tools/rpctypegen/macro/Cargo.toml index 8cfd58f2f2d..d5e44851c3c 100644 --- a/tools/rpctypegen/macro/Cargo.toml +++ b/tools/rpctypegen/macro/Cargo.toml @@ -3,7 +3,6 @@ name = "near-rpc-error-macro" version.workspace = true authors.workspace = true edition.workspace = true -rust-version.workspace = true description = "This crate generates schema for Rust structs which can be used by TypeScript." repository.workspace = true license.workspace = true diff --git a/tools/themis/src/rules.rs b/tools/themis/src/rules.rs index e36916e305f..9ca56a99c9d 100644 --- a/tools/themis/src/rules.rs +++ b/tools/themis/src/rules.rs @@ -25,21 +25,24 @@ pub fn has_publish_spec(workspace: &Workspace) -> anyhow::Result<()> { Ok(()) } -/// Ensure all crates specify a MSRV if they are publishable +/// Ensure all publishable crates do not both specify version and rust-version as being workspace-wide pub fn has_rust_version(workspace: &Workspace) -> anyhow::Result<()> { let outliers: Vec<_> = workspace .members .iter() .filter(|pkg| { - pkg.parsed.rust_version.is_none() - && pkg.manifest.read(&["package", "publish"]) != Some(&toml::Value::Boolean(false)) + pkg.manifest.read(&["package", "publish"]) == Some(&toml::Value::Boolean(true)) + && pkg.manifest.read(&["package", "version", "workspace"]) + == Some(&toml::Value::Boolean(true)) + && pkg.manifest.read(&["package", "rust-version", "workspace"]) + == Some(&toml::Value::Boolean(true)) }) .map(|pkg| Outlier { path: pkg.parsed.manifest_path.clone(), found: None, extra: None }) .collect(); if !outliers.is_empty() { bail!(ComplianceError { - msg: "These packages should specify a Minimum Supported Rust Version (MSRV)" + msg: "These publishable packages have Minimum Supported Rust Version (MSRV) and version both set from workspace" .to_string(), expected: None, outliers, diff --git a/utils/config/Cargo.toml b/utils/config/Cargo.toml index f08e15a1356..d3a2d278b34 100644 --- a/utils/config/Cargo.toml +++ b/utils/config/Cargo.toml @@ -3,7 +3,6 @@ name = "near-config-utils" version.workspace = true authors.workspace = true edition.workspace = true -rust-version.workspace = true description = "This is an internal crate to provide utils for reading config files" repository.workspace = true license.workspace = true diff --git a/utils/fmt/Cargo.toml b/utils/fmt/Cargo.toml index 1cf0b0c94ee..e6e336925da 100644 --- a/utils/fmt/Cargo.toml +++ b/utils/fmt/Cargo.toml @@ -3,7 +3,6 @@ name = "near-fmt" version.workspace = true authors.workspace = true edition.workspace = true -rust-version.workspace = true description = "Helpers for pretty formatting." repository.workspace = true license.workspace = true diff --git a/utils/near-cache/Cargo.toml b/utils/near-cache/Cargo.toml index f14347753d8..bdf0aa053d2 100644 --- a/utils/near-cache/Cargo.toml +++ b/utils/near-cache/Cargo.toml @@ -3,7 +3,6 @@ name = "near-cache" version.workspace = true authors.workspace = true edition.workspace = true -rust-version.workspace = true description = "do not use this, new versions can stop being published at literally any time" repository.workspace = true license.workspace = true diff --git a/utils/near-stable-hasher/Cargo.toml b/utils/near-stable-hasher/Cargo.toml index d9c67aef477..21e672b7c75 100644 --- a/utils/near-stable-hasher/Cargo.toml +++ b/utils/near-stable-hasher/Cargo.toml @@ -3,7 +3,6 @@ name = "near-stable-hasher" version.workspace = true authors.workspace = true edition.workspace = true -rust-version.workspace = true description = "`near-stable-hasher` is a library that is essentially a wrapper around, now deprecated, `std::hash::SipHasher`." repository.workspace = true license.workspace = true diff --git a/utils/stdx/Cargo.toml b/utils/stdx/Cargo.toml index 281b90cee41..8f24e3c0480 100644 --- a/utils/stdx/Cargo.toml +++ b/utils/stdx/Cargo.toml @@ -3,7 +3,6 @@ name = "near-stdx" version.workspace = true authors.workspace = true edition.workspace = true -rust-version.workspace = true description = "This crate contains polyfills which should really be in std, but currently aren't for one reason or another." repository.workspace = true license.workspace = true