Skip to content
Open
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
23 changes: 17 additions & 6 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,7 @@ bootstrap-agent-client = { path = "clients/bootstrap-agent-client" }
bootstrap-agent-lockstep-client = { path = "clients/bootstrap-agent-lockstep-client" }
buf-list = { version = "1.0.3", features = ["tokio1"] }
byteorder = "1.5.0"
byte-wrapper = { version = "0.1.0", features = ["serde", "schemars08"] }
bytes = "1.10.1"
camino = { version = "1.2.0", features = ["serde1"] }
camino-tempfile = "1.4.1"
Expand Down Expand Up @@ -744,7 +745,6 @@ semver = { version = "1.0.26", features = ["std", "serde"] }
seq-macro = "0.3.6"
serde = { version = "1.0", default-features = false, features = [ "derive", "rc" ] }
serde_cbor = "0.11.2"
serde_human_bytes = { git = "https://github.com/oxidecomputer/serde_human_bytes", branch = "main" }
serde_json = "1.0.145"
serde_tokenstream = "0.2"
serde_urlencoded = "0.7.1"
Expand Down
1 change: 0 additions & 1 deletion common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ reqwest = { workspace = true, features = ["rustls", "stream"] }
schemars = { workspace = true, features = ["chrono", "semver", "uuid1"] }
semver.workspace = true
serde.workspace = true
serde_human_bytes.workspace = true
serde_json.workspace = true
serde_with.workspace = true
slog.workspace = true
Expand Down
5 changes: 5 additions & 0 deletions common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ impl<T> std::fmt::Debug for NoDebug<T> {
}
}

/// Produce an OpenAPI schema describing a hex string of a specific byte length.
///
/// Used by versioned sled-agent types to preserve schema compatibility. New
/// code should use `byte_wrapper::HexArray<N>` which implements `JsonSchema`
/// directly.
pub fn hex_schema<const N: usize>(
generator: &mut schemars::SchemaGenerator,
) -> schemars::schema::Schema {
Expand Down
1 change: 0 additions & 1 deletion sled-agent/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ reqwest = { workspace = true, features = ["rustls", "stream"] }
reqwest012 = { workspace = true }
schemars = { workspace = true, features = ["chrono", "uuid1"] }
serde.workspace = true
serde_human_bytes.workspace = true
serde_json = { workspace = true, features = ["raw_value"] }
sha2.workspace = true
sha3.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion sled-agent/types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ workspace = true
anyhow.workspace = true
async-trait.workspace = true
bootstore.workspace = true
byte-wrapper.workspace = true
camino.workspace = true
chrono.workspace = true
daft.workspace = true
Expand All @@ -22,7 +23,6 @@ oxnet.workspace = true
proptest = { workspace = true, optional = true }
schemars.workspace = true
serde.workspace = true
serde_human_bytes.workspace = true
serde_json.workspace = true
sled-agent-types-versions.workspace = true
sled-hardware-types.workspace = true
Expand Down
5 changes: 2 additions & 3 deletions sled-agent/types/src/boot_disk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,9 @@ pub struct BootDiskWriteStartQueryParams {
pub update_id: Uuid,
// TODO do we already have sha2-256 hashes of the OS images, and if so
// should we use that instead? Another option is to use the external API
// `Digest` type, although it predates `serde_human_bytes` so just stores
// `Digest` type, although it predates `byte-wrapper` so just stores
// the hash as a `String`.
#[serde(with = "serde_human_bytes::hex_array")]
#[schemars(schema_with = "omicron_common::hex_schema::<32>")]
#[serde(with = "byte_wrapper::HexArray::<32>")]
pub sha3_256_digest: [u8; 32],
}

Expand Down
2 changes: 1 addition & 1 deletion sled-agent/types/versions/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ illumos-utils.workspace = true
indent_write.workspace = true
async-trait.workspace = true
bootstore.workspace = true
byte-wrapper.workspace = true
omicron-common.workspace = true
omicron-passwords.workspace = true
omicron-uuid-kinds.workspace = true
Expand All @@ -28,7 +29,6 @@ proptest = { workspace = true, optional = true }
schemars.workspace = true
serde.workspace = true
serde_with = { workspace = true, features = ["hex", "schemars_0_8"] }
serde_human_bytes.workspace = true
serde_json.workspace = true
sha3.workspace = true
sled-hardware-types.workspace = true
Expand Down
12 changes: 9 additions & 3 deletions sled-agent/types/versions/src/add_rot_attestation/attestation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ const SHA3_256_LEN: usize = 32;
#[derive(Deserialize, Serialize, JsonSchema)]
#[serde(transparent)]
pub struct Sha3_256Digest(
#[serde(with = "serde_human_bytes::hex_array")]
#[serde(with = "byte_wrapper::HexArray::<SHA3_256_LEN>")]
// If and when this type changes next, delete the `schemars(schema_with)`
// line and this comment.
#[schemars(schema_with = "omicron_common::hex_schema::<SHA3_256_LEN>")]
pub [u8; SHA3_256_LEN],
);
Expand Down Expand Up @@ -68,7 +70,9 @@ pub struct CertificateChain(pub Vec<String>);
#[serde(untagged)]
pub enum Nonce {
/// A 32-byte nonce.
#[serde(with = "serde_human_bytes::hex_array")]
#[serde(with = "byte_wrapper::HexArray::<32>")]
// If and when this type changes next, delete the `schemars(schema_with)`
// line and this comment.
#[schemars(schema_with = "omicron_common::hex_schema::<32>")]
N32([u8; 32]),
}
Expand All @@ -78,7 +82,9 @@ const ED25519_SIG_LEN: usize = 64;
#[derive(Deserialize, Serialize, JsonSchema)]
#[serde(transparent)]
pub struct Ed25519Signature(
#[serde(with = "serde_human_bytes::hex_array")]
#[serde(with = "byte_wrapper::HexArray::<ED25519_SIG_LEN>")]
// If and when this type changes next, delete the `schemars(schema_with)`
// line and this comment.
#[schemars(schema_with = "omicron_common::hex_schema::<ED25519_SIG_LEN>")]
pub [u8; ED25519_SIG_LEN],
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ use serde::{Deserialize, Serialize};
pub struct TrustQuorumNetworkConfig {
pub generation: u64,
/// A serialized blob of configuration data (base64 encoded).
// If and when this type changes next, delete the `schemars(with)` line
// and this comment.
#[schemars(with = "String")]
#[serde(with = "serde_human_bytes::base64_vec")]
#[serde(with = "byte_wrapper::Base64Vec")]
pub blob: Vec<u8>,
}

Expand Down
2 changes: 1 addition & 1 deletion trust-quorum/types/versions/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ license = "MPL-2.0"
workspace = true

[dependencies]
byte-wrapper.workspace = true
daft.workspace = true
derive_more.workspace = true
gfss.workspace = true
Expand All @@ -16,7 +17,6 @@ omicron-uuid-kinds.workspace = true
omicron-workspace-hack.workspace = true
rand = { workspace = true, features = ["os_rng"] }
schemars.workspace = true
serde_human_bytes.workspace = true
serde.workspace = true
serde_with = { workspace = true, features = ["hex", "schemars_0_8"] }
sled-hardware-types.workspace = true
Expand Down
8 changes: 6 additions & 2 deletions trust-quorum/types/versions/src/initial/crypto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ use slog_error_chain::SlogInlineError;
)]
#[schemars(transparent)]
pub struct Sha3_256Digest(
#[serde(with = "serde_human_bytes::hex_array")]
#[serde(with = "byte_wrapper::HexArray::<32>")]
// If and when this type changes next, delete the `schemars(schema_with)`
// line and this comment.
#[schemars(schema_with = "hex_schema::<32>")]
pub [u8; 32],
);
Expand Down Expand Up @@ -57,7 +59,9 @@ impl std::fmt::Debug for Sha3_256Digest {
)]
#[schemars(transparent)]
pub struct Salt(
#[serde(with = "serde_human_bytes::hex_array")]
#[serde(with = "byte_wrapper::HexArray::<32>")]
// If and when this type changes next, delete the `schemars(schema_with)`
// line and this comment.
#[schemars(schema_with = "hex_schema::<32>")]
pub [u8; 32],
);
Expand Down
Loading