From 2a9057f40abe8b493972ccc001099740da9b80d1 Mon Sep 17 00:00:00 2001 From: Daniel Porteous Date: Fri, 14 Jun 2024 13:55:52 +0200 Subject: [PATCH] Update serde_yaml to 0.9.34 --- Cargo.lock | 50 ++++++++++++------------- Cargo.toml | 2 +- config/src/config/persistable_config.rs | 18 ++++++++- 3 files changed, 43 insertions(+), 27 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 44d7536b9fe37..c647e0e6c619b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -315,7 +315,7 @@ dependencies = [ "self_update", "serde", "serde_json", - "serde_yaml 0.8.26", + "serde_yaml 0.9.34+deprecated", "server-framework", "shadow-rs", "tempfile", @@ -574,7 +574,7 @@ dependencies = [ "reqwest", "serde", "serde_json", - "serde_yaml 0.8.26", + "serde_yaml 0.9.34+deprecated", "thiserror", "tokio", "tokio-io-timeout", @@ -825,7 +825,7 @@ dependencies = [ "serde", "serde_json", "serde_merge", - "serde_yaml 0.8.26", + "serde_yaml 0.9.34+deprecated", "tempfile", "thiserror", "url", @@ -902,7 +902,7 @@ dependencies = [ "serde", "serde_bytes", "serde_json", - "serde_yaml 0.8.26", + "serde_yaml 0.9.34+deprecated", "sha3 0.9.1", "strum_macros 0.24.3", "tempfile", @@ -1590,7 +1590,7 @@ dependencies = [ "reqwest", "serde", "serde_json", - "serde_yaml 0.8.26", + "serde_yaml 0.9.34+deprecated", "tokio", "url", ] @@ -1680,7 +1680,7 @@ dependencies = [ "reqwest", "serde", "serde_json", - "serde_yaml 0.8.26", + "serde_yaml 0.9.34+deprecated", "tempfile", "termcolor", "thiserror", @@ -1710,7 +1710,7 @@ dependencies = [ "rand 0.7.3", "random_word", "reqwest", - "serde_yaml 0.8.26", + "serde_yaml 0.9.34+deprecated", "tokio", "url", ] @@ -1898,7 +1898,7 @@ dependencies = [ "bcs 0.1.4", "rand 0.7.3", "serde", - "serde_yaml 0.8.26", + "serde_yaml 0.9.34+deprecated", ] [[package]] @@ -2136,7 +2136,7 @@ dependencies = [ "clap 4.4.14", "prometheus", "serde", - "serde_yaml 0.8.26", + "serde_yaml 0.9.34+deprecated", "tempfile", "tokio", "toml 0.7.8", @@ -2893,7 +2893,7 @@ dependencies = [ "futures", "once_cell", "rand 0.7.3", - "serde_yaml 0.8.26", + "serde_yaml 0.9.34+deprecated", "tokio", "url", ] @@ -2996,7 +2996,7 @@ dependencies = [ "rstack-self", "serde", "serde_json", - "serde_yaml 0.8.26", + "serde_yaml 0.9.34+deprecated", "tokio", "url", ] @@ -3023,7 +3023,7 @@ dependencies = [ "reqwest", "serde", "serde_json", - "serde_yaml 0.8.26", + "serde_yaml 0.9.34+deprecated", "thiserror", "tokio", "url", @@ -3289,7 +3289,7 @@ dependencies = [ "reqwest", "serde", "serde_json", - "serde_yaml 0.8.26", + "serde_yaml 0.9.34+deprecated", "sha3 0.9.1", "strum 0.24.1", "strum_macros 0.24.3", @@ -3394,7 +3394,7 @@ dependencies = [ "reqwest", "serde", "serde_json", - "serde_yaml 0.8.26", + "serde_yaml 0.9.34+deprecated", "tokio", "url", "warp", @@ -3531,7 +3531,7 @@ dependencies = [ "once_cell", "serde-generate", "serde-reflection", - "serde_yaml 0.8.26", + "serde_yaml 0.9.34+deprecated", "tempfile", "textwrap 0.15.2", "which", @@ -3881,7 +3881,7 @@ dependencies = [ "reqwest-retry", "serde", "serde_json", - "serde_yaml 0.8.26", + "serde_yaml 0.9.34+deprecated", "thiserror", "tokio", "tracing", @@ -4122,7 +4122,7 @@ dependencies = [ "serde_bytes", "serde_json", "serde_with", - "serde_yaml 0.8.26", + "serde_yaml 0.9.34+deprecated", "strum 0.24.1", "strum_macros 0.24.3", "thiserror", @@ -8196,7 +8196,7 @@ dependencies = [ "rand 0.7.3", "serde", "serde-reflection", - "serde_yaml 0.8.26", + "serde_yaml 0.9.34+deprecated", ] [[package]] @@ -10775,7 +10775,7 @@ dependencies = [ "petgraph 0.5.1", "regex", "serde", - "serde_yaml 0.8.26", + "serde_yaml 0.9.34+deprecated", "sha2 0.9.9", "tempfile", "termcolor", @@ -12403,7 +12403,7 @@ dependencies = [ "serde", "serde_json", "serde_urlencoded", - "serde_yaml 0.9.30", + "serde_yaml 0.9.34+deprecated", "thiserror", "tokio", "url", @@ -14334,9 +14334,9 @@ dependencies = [ [[package]] name = "serde_yaml" -version = "0.9.30" +version = "0.9.34+deprecated" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1bf28c79a99f70ee1f1d83d10c875d2e70618417fda01ad1785e027579d9d38" +checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47" dependencies = [ "indexmap 2.2.5", "itoa", @@ -14762,7 +14762,7 @@ dependencies = [ "reqwest", "serde", "serde_json", - "serde_yaml 0.8.26", + "serde_yaml 0.9.34+deprecated", "tokio", "url", "walkdir", @@ -16248,9 +16248,9 @@ dependencies = [ [[package]] name = "unsafe-libyaml" -version = "0.2.10" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab4c90930b95a82d00dc9e9ac071b4991924390d46cbd0dfe566148667605e4b" +checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861" [[package]] name = "untrusted" diff --git a/Cargo.toml b/Cargo.toml index 76a3d4399b09e..fdf320dbd41aa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -724,7 +724,7 @@ serde-name = "0.1.1" serde-generate = { git = "https://github.com/aptos-labs/serde-reflection", rev = "73b6bbf748334b71ff6d7d09d06a29e3062ca075" } serde-reflection = { git = "https://github.com/aptos-labs/serde-reflection", rev = "73b6bbf748334b71ff6d7d09d06a29e3062ca075" } serde_with = "3.4.0" -serde_yaml = "0.8.24" +serde_yaml = "0.9.34" shadow-rs = "0.16.2" simplelog = "0.9.0" smallbitvec = "2.5.1" diff --git a/config/src/config/persistable_config.rs b/config/src/config/persistable_config.rs index 728f372d15da5..ca9d811a932a6 100644 --- a/config/src/config/persistable_config.rs +++ b/config/src/config/persistable_config.rs @@ -22,7 +22,7 @@ pub trait PersistableConfig: Serialize + DeserializeOwned { /// Save the config to disk at the given output path fn save_config>(&self, output_file: P) -> Result<(), Error> { // Serialize the config to a string - let serialized_config = serde_yaml::to_vec(&self) + let serialized_config = serde_yaml_to_vec(&self) .map_err(|e| Error::Yaml(output_file.as_ref().to_str().unwrap().to_string(), e))?; Self::write_file(serialized_config, output_file) @@ -58,3 +58,19 @@ pub trait PersistableConfig: Serialize + DeserializeOwned { // We only implement PersistableConfig for the configs that should be read/written to disk impl PersistableConfig for NodeConfig {} impl PersistableConfig for SafetyRulesConfig {} + +/// Serialize the given data structure as a YAML byte vector. +/// +/// Serialization can fail if `T`'s implementation of `Serialize` decides to +/// return an error. +/// +/// serde_yaml 0.9.x doesn't have this function so we reimplement it here as it existed +/// in serde_yaml 0.8.x. +pub fn serde_yaml_to_vec(value: &T) -> serde_yaml::Result> +where + T: serde::ser::Serialize, +{ + let mut vec = Vec::with_capacity(128); + serde_yaml::to_writer(&mut vec, value)?; + Ok(vec) +}