Skip to content

Commit ce446e5

Browse files
committed
Use Rust 1.81 on common container, stop using nightly features for formatting
1 parent 1860be2 commit ce446e5

File tree

14 files changed

+118
-80
lines changed

14 files changed

+118
-80
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,5 +77,5 @@ out/common/index.json: \
7777
$(call build,common)
7878

7979
out/.common-loaded: out/common/index.json
80-
env -C ./out/common tar -cf - . | docker load
81-
touch out/.common-loaded
80+
cd ./out/common && tar -cf - . | docker load
81+
touch ./out/.common-loaded

src/Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,7 @@ clippy-fix:
152152

153153
.PHONY: fmt
154154
fmt:
155-
cargo +nightly version
156-
cargo +nightly fmt
155+
cargo fmt
157156

158157
.PHONY: test
159158
test:

src/images/common/Containerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ FROM stagex/musl-obstack:sx2024.03.0@sha256:4b6737815460908f666fa7a8e91138610d0a
2020
FROM stagex/openssl:sx2024.03.0@sha256:1a2f656ced34d1ade99279c5663fcf0ec4f6526bcc50142079ef8adc080be3a9 AS openssl
2121
FROM stagex/pcsc-lite:sx2024.03.0@sha256:e720e1795706c7c8c1db14bf730b10521e3ff42e4bed90addc590f7446aac8af AS pcsc-lite
2222
FROM stagex/pkgconf:sx2024.03.0@sha256:31ce4eddaf4e777ddb51f01923089f3321ec5272ca0aa834d475f644279209b8 AS pkgconf
23-
FROM stagex/rust:sx2024.03.0@sha256:fe22a0fcdb569cb70b8147378463fb6ff800e642be9d50542f8e25a38d90ec7f AS rust
23+
FROM stagex/rust:1.81.0@sha256:b7c834268a81bfcc473246995c55b47fe18414cc553e3293b6294fde4e579163 AS rust
2424
FROM stagex/zlib:sx2024.03.0@sha256:de8f56f3ece28b14d575329bead53fc5318962ae3cb8f161a2d69710f7ec51f4 AS zlib
2525
FROM stagex/make:4.4@sha256:df43f0cf3ac1ad91bf91baefb539e8df42c11b0954a6e2498322a5467deb81e3 AS make
2626

27-
FROM scratch as base
27+
FROM scratch AS base
2828
ENV TARGET=x86_64-unknown-linux-musl
2929
ENV RUSTFLAGS="-C target-feature=+crt-static"
3030
ENV CARGOFLAGS="--locked --no-default-features --release --target ${TARGET}"

src/integration/src/bin/pivot_remote_tls.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,8 @@ impl RequestProcessor for Processor {
5858
.unwrap();
5959
let mut tls = rustls::Stream::new(&mut conn, &mut stream);
6060

61-
let http_request = format!(
62-
"GET {path} HTTP/1.1\r\nHost: {host}\r\nConnection: close\r\n\r\n"
63-
);
61+
let http_request =
62+
format!("GET {path} HTTP/1.1\r\nHost: {host}\r\nConnection: close\r\n\r\n");
6463

6564
tls.write_all(http_request.as_bytes()).unwrap();
6665

src/qos_client/src/cli/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -499,11 +499,11 @@ impl Command {
499499
}
500500
fn display_type_token() -> Token {
501501
Token::new(
502-
DISPLAY_TYPE,
503-
"The type contained in the file (manifest, manifest-envelope, genesis-output)."
504-
)
505-
.takes_value(true)
506-
.required(true)
502+
DISPLAY_TYPE,
503+
"The type contained in the file (manifest, manifest-envelope, genesis-output).",
504+
)
505+
.takes_value(true)
506+
.required(true)
507507
}
508508
fn dr_key_path_token() -> Token {
509509
Token::new(DR_KEY_PATH, "Path to a DR key certificate")

src/qos_client/src/cli/services.rs

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,10 @@ pub(crate) fn verify_genesis<P: AsRef<Path>>(
545545
let genesis_output_path = namespace_dir.as_ref().join(GENESIS_OUTPUT_FILE);
546546
let genesis_output = GenesisOutput::try_from_slice(
547547
&fs::read(genesis_output_path).expect("Failed to read genesis output file"),
548-
).expect("Failed to deserialize genesis output - check that qos_client and qos_core version line up");
548+
)
549+
.expect(
550+
"Failed to deserialize genesis output - check that qos_client and qos_core version line up",
551+
);
549552

550553
let master_seed_hex = fs::read_to_string(&master_seed_path)
551554
.expect("Failed to read master seed to string");
@@ -1165,8 +1168,10 @@ pub(crate) fn get_attestation_doc<P: AsRef<Path>>(
11651168
}) => (document, manifest_envelope),
11661169
Ok(ProtocolMsg::LiveAttestationDocResponse {
11671170
nsm_response: _,
1168-
manifest_envelope: None
1169-
}) => panic!("ManifestEnvelope does not exist in enclave - likely waiting for boot instruction"),
1171+
manifest_envelope: None,
1172+
}) => panic!(
1173+
"ManifestEnvelope does not exist in enclave - likely waiting for boot instruction"
1174+
),
11701175
r => panic!("Unexpected response: {r:?}"),
11711176
};
11721177

@@ -1387,7 +1392,9 @@ where
13871392
approvers.sort();
13881393
let approvers = approvers.join("\n");
13891394

1390-
let prompt = format!("The following manifest set members approved:\n{approvers}\nIs this ok? (yes/no)");
1395+
let prompt = format!(
1396+
"The following manifest set members approved:\n{approvers}\nIs this ok? (yes/no)"
1397+
);
13911398

13921399
if !prompter.prompt_is_yes(&prompt) {
13931400
return false;
@@ -1897,15 +1904,12 @@ fn find_approvals<P: AsRef<Path>>(
18971904
boot_dir: P,
18981905
manifest: &Manifest,
18991906
) -> Vec<Approval> {
1900-
let approvals: Vec<_> = find_file_paths(&boot_dir)
1907+
let approvals: Vec<_> = find_file_paths(&boot_dir)
19011908
.iter()
19021909
.filter_map(|path| {
19031910
let file_name = split_file_name(path);
19041911
// Only look at files with the approval extension
1905-
if file_name
1906-
.last()
1907-
.map_or(true, |s| s.as_str() != APPROVAL_EXT)
1908-
{
1912+
if file_name.last().map_or(true, |s| s.as_str() != APPROVAL_EXT) {
19091913
return None;
19101914
};
19111915

@@ -1916,7 +1920,8 @@ fn find_approvals<P: AsRef<Path>>(
19161920

19171921
assert!(
19181922
manifest.manifest_set.members.contains(&approval.member),
1919-
"Found approval from member ({:?}) not included in the Manifest Set", approval.member.alias
1923+
"Found approval from member ({:?}) not included in the Manifest Set",
1924+
approval.member.alias
19201925
);
19211926

19221927
let pub_key = P256Public::from_bytes(&approval.member.pub_key)
@@ -2563,10 +2568,7 @@ mod tests {
25632568
));
25642569

25652570
let output = String::from_utf8(vec_out).unwrap();
2566-
assert_eq!(
2567-
&output,
2568-
"Is this the correct namespace name: test-namespace? (yes/no)\n"
2569-
);
2571+
assert_eq!(&output, "Is this the correct namespace name: test-namespace? (yes/no)\n");
25702572
}
25712573

25722574
#[test]
@@ -2815,7 +2817,10 @@ mod tests {
28152817

28162818
let output = String::from_utf8(vec_out).unwrap();
28172819
let output: Vec<_> = output.trim().split('\n').collect();
2818-
assert_eq!(output.last().unwrap(), &"Does this AWS IAM role belong to the intended organization: pr3? (yes/no)");
2820+
assert_eq!(
2821+
output.last().unwrap(),
2822+
&"Does this AWS IAM role belong to the intended organization: pr3? (yes/no)"
2823+
);
28192824
}
28202825

28212826
#[test]

src/qos_core/src/parser.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,16 @@ impl fmt::Display for ParserError {
2727
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2828
match self {
2929
Self::UnexpectedInput(u) => write!(f, "found {u}, which was not an expected argument"),
30-
Self::DuplicateInput(i) => write!(f, "found argument {i} more then once, but only one instance was expected"),
31-
Self::MutuallyExclusiveInput(y, z) => write!(f, "arguments {y} and {z} are mutually exclusive and cannot be used at the same time"),
32-
Self::MissingValue(i) => write!(f, "found argument {i}, which requires a value, but no value was given"),
30+
Self::DuplicateInput(i) => {
31+
write!(f, "found argument {i} more then once, but only one instance was expected")
32+
}
33+
Self::MutuallyExclusiveInput(y, z) => write!(
34+
f,
35+
"arguments {y} and {z} are mutually exclusive and cannot be used at the same time"
36+
),
37+
Self::MissingValue(i) => {
38+
write!(f, "found argument {i}, which requires a value, but no value was given")
39+
}
3340
Self::MissingInput(i) => write!(f, "argument {i} is required but was not found"),
3441
}
3542
}

src/qos_core/src/protocol/services/genesis.rs

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -139,21 +139,19 @@ pub(in crate::protocol) fn boot_genesis(
139139
)
140140
.map_err(|e| ProtocolError::QosCrypto(format!("{e:?}")))?;
141141

142-
let member_outputs: Result<Vec<_>, _> =
143-
zip(shares, genesis_set.members.iter().cloned())
144-
.map(|(share, share_set_member)| -> Result<GenesisMemberOutput, ProtocolError>{
145-
// 1) encrypt the share to quorum key
146-
let personal_pub = P256Public::from_bytes(&share_set_member.pub_key)?;
147-
let encrypted_quorum_key_share =
148-
personal_pub.encrypt(&share)?;
149-
150-
Ok(GenesisMemberOutput {
151-
share_set_member,
152-
encrypted_quorum_key_share,
153-
share_hash: sha_512(&share),
154-
})
142+
let member_outputs: Result<Vec<_>, _> = zip(shares, genesis_set.members.iter().cloned())
143+
.map(|(share, share_set_member)| -> Result<GenesisMemberOutput, ProtocolError> {
144+
// 1) encrypt the share to quorum key
145+
let personal_pub = P256Public::from_bytes(&share_set_member.pub_key)?;
146+
let encrypted_quorum_key_share = personal_pub.encrypt(&share)?;
147+
148+
Ok(GenesisMemberOutput {
149+
share_set_member,
150+
encrypted_quorum_key_share,
151+
share_hash: sha_512(&share),
155152
})
156-
.collect();
153+
})
154+
.collect();
157155

158156
let dr_key_wrapped_quorum_key = if let Some(dr_key) = maybe_dr_key {
159157
let dr_public = P256Public::from_bytes(&dr_key)

src/qos_core/src/protocol/services/key.rs

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,8 @@ mod test {
447447
let ephemeral_file: PathWrapper =
448448
"/tmp/boot_key_rejects_manifest_if_not_enough_approvals.secret"
449449
.into();
450-
let manifest_file: PathWrapper = "/tmp/boot_key_rejects_manifest_if_not_enough_approvals.manifest".into();
450+
let manifest_file: PathWrapper =
451+
"/tmp/boot_key_rejects_manifest_if_not_enough_approvals.manifest".into();
451452

452453
let handles = Handles::new(
453454
ephemeral_file.deref().to_string(),
@@ -524,9 +525,13 @@ mod test {
524525
fn rejects_manifest_with_bad_approval_signature() {
525526
let TestArgs { mut manifest_envelope, pivot, .. } = get_test_args();
526527

527-
let pivot_file: PathWrapper = "/tmp/boot_key_rejects_rejects_manifest_with_bad_approval_signature.pivot".into();
528-
let ephemeral_file: PathWrapper = "/tmp/boot_key_rejects_rejects_manifest_with_bad_approval_signature.secret".into();
529-
let manifest_file: PathWrapper = "/tmp/boot_key_rejects_rejects_manifest_with_bad_approval_signature.manifest".into();
528+
let pivot_file: PathWrapper =
529+
"/tmp/boot_key_rejects_rejects_manifest_with_bad_approval_signature.pivot".into();
530+
let ephemeral_file: PathWrapper =
531+
"/tmp/boot_key_rejects_rejects_manifest_with_bad_approval_signature.secret".into();
532+
let manifest_file: PathWrapper =
533+
"/tmp/boot_key_rejects_rejects_manifest_with_bad_approval_signature.manifest"
534+
.into();
530535

531536
let handles = Handles::new(
532537
ephemeral_file.deref().to_string(),
@@ -578,9 +583,12 @@ mod test {
578583
member: non_member,
579584
};
580585

581-
let pivot_file: PathWrapper = "/tmp/boot_key_reject_manifest_with_approval_from_non_memberpivot".into();
582-
let ephemeral_file: PathWrapper = "/tmp/boot_key_reject_manifest_with_approval_from_non_membersecret".into();
583-
let manifest_file: PathWrapper = "/tmp/boot_key_reject_manifest_with_approval_from_non_membermanifest".into();
586+
let pivot_file: PathWrapper =
587+
"/tmp/boot_key_reject_manifest_with_approval_from_non_memberpivot".into();
588+
let ephemeral_file: PathWrapper =
589+
"/tmp/boot_key_reject_manifest_with_approval_from_non_membersecret".into();
590+
let manifest_file: PathWrapper =
591+
"/tmp/boot_key_reject_manifest_with_approval_from_non_membermanifest".into();
584592

585593
let handles = Handles::new(
586594
ephemeral_file.deref().to_string(),

src/qos_hex/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ pub fn decode(raw_s: &str) -> Result<Vec<u8>, HexError> {
115115
verify_ascii(&sanitized_s_bytes[i])?;
116116
verify_ascii(&sanitized_s_bytes[i + 1])?;
117117

118-
let s = std::str::from_utf8(&sanitized_s_bytes[i..i+2])
118+
let s = std::str::from_utf8(&sanitized_s_bytes[i..i + 2])
119119
.expect("We ensure that input slice represents ASCII above. qed.");
120120
u8::from_str_radix(s, 16).map_err(Into::into)
121121
})

0 commit comments

Comments
 (0)