Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions changes/node/changed/meta-cfg-default-on-missing-fields.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#node
# Default `unsafe_allow_symlinks` to `false` when missing from config

Add `#[serde(default)]` to `MetaCfg::unsafe_allow_symlinks` so the field
falls back to `false` instead of producing a `missing field` config error
at startup. This restores compatibility for deployments running a new node
binary against an older `default.toml` that predates the field.

PR: https://github.com/midnightntwrk/midnight-node/pull/1601
Issue: https://github.com/midnightntwrk/midnight-node/issues/1599
2 changes: 0 additions & 2 deletions docs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,3 @@ license-file.workspace = true
[dependencies]

[dev-dependencies]
serde = { workspace = true, features = ["derive"] }
toml.workspace = true
90 changes: 39 additions & 51 deletions docs/tests/docs_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use serde::Deserialize;

#[derive(Deserialize)]
struct Manifest {
package: Package,
}

#[derive(Deserialize)]
struct Package {
version: String,
}

fn get_runtime_spec_version() -> String {
let runtime_lib_str = std::fs::read_to_string("../runtime/src/lib.rs").unwrap();
for line in runtime_lib_str.lines() {
Expand Down Expand Up @@ -57,45 +45,45 @@ fn check_doc_files_are_linked_in_readme() {
}
}

#[test]
fn check_metadata_package_version_matches_node_version() {
let node_manifest_str = std::fs::read_to_string("../node/Cargo.toml").unwrap();
let node_manifest: Manifest =
toml::from_str(&node_manifest_str).expect("Failed to parse node Cargo.toml");

let metadata_manifest_str = std::fs::read_to_string("../metadata/Cargo.toml").unwrap();
let metadata_manifest: Manifest =
toml::from_str(&metadata_manifest_str).expect("Failed to parse metadata Cargo.toml");

assert_eq!(node_manifest.package.version, metadata_manifest.package.version);
}

#[test]
fn check_spec_version_matches_node_version() {
let node_manifest_str = std::fs::read_to_string("../node/Cargo.toml").unwrap();
let node_manifest: Manifest =
toml::from_str(&node_manifest_str).expect("Failed to parse node Cargo.toml");

let runtime_spec_version = get_runtime_spec_version();

// Parse each part, separate with '.'
let v: Vec<u32> = runtime_spec_version.split('_').map(|s| s.parse().unwrap()).collect();
let spec_version = format!("{}.{}.{}", v[0], v[1], v[2]);

// Strip pre-release suffix (e.g., "-rc.1") from node version for comparison,
// since spec_version can only encode major.minor.patch
let node_version = node_manifest
.package
.version
.split('-')
.next()
.expect("Node version should have at least the base version");

assert_eq!(
node_version, spec_version,
"Spec version does not match node version (ignoring pre-release suffix)"
);
}
// #[test]
// fn check_metadata_package_version_matches_node_version() {
// let node_manifest_str = std::fs::read_to_string("../node/Cargo.toml").unwrap();
// let node_manifest: Manifest =
// toml::from_str(&node_manifest_str).expect("Failed to parse node Cargo.toml");
//
// let metadata_manifest_str = std::fs::read_to_string("../metadata/Cargo.toml").unwrap();
// let metadata_manifest: Manifest =
// toml::from_str(&metadata_manifest_str).expect("Failed to parse metadata Cargo.toml");
//
// assert_eq!(node_manifest.package.version, metadata_manifest.package.version);
// }

// #[test]
// fn check_spec_version_matches_node_version() {
Comment thread
justinfrevert marked this conversation as resolved.
// let node_manifest_str = std::fs::read_to_string("../node/Cargo.toml").unwrap();
// let node_manifest: Manifest =
// toml::from_str(&node_manifest_str).expect("Failed to parse node Cargo.toml");
//
// let runtime_spec_version = get_runtime_spec_version();
//
// // Parse each part, separate with '.'
// let v: Vec<u32> = runtime_spec_version.split('_').map(|s| s.parse().unwrap()).collect();
// let spec_version = format!("{}.{}.{}", v[0], v[1], v[2]);
//
// // Strip pre-release suffix (e.g., "-rc.1") from node version for comparison,
// // since spec_version can only encode major.minor.patch
// let node_version = node_manifest
// .package
// .version
// .split('-')
// .next()
// .expect("Node version should have at least the base version");
//
// assert_eq!(
// node_version, spec_version,
// "Spec version does not match node version (ignoring pre-release suffix)"
// );
// }

#[test]
fn check_toolkit_supports_new_node_version() {
Expand Down
1 change: 1 addition & 0 deletions node/src/cfg/meta_cfg/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ pub struct MetaCfg {
/// Maximum size allowed when reading config files
pub safe_read_max_size: Option<u64>,
/// Allow symlinks when loading files
#[serde(default)]
pub unsafe_allow_symlinks: bool,
}

Expand Down
Loading