Skip to content

Commit 84fa569

Browse files
authored
Merge pull request #140 from flashbots/peg/fmt
Run `cargo fmt` after fixing editor settings
2 parents 18f8ad9 + 92b5d8e commit 84fa569

22 files changed

Lines changed: 65 additions & 52 deletions

.github/workflows/test.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ jobs:
3232
restore-keys: |
3333
${{ runner.os }}-cargo-
3434
35+
- name: Check formatting
36+
run: cargo fmt --all -- --check
37+
3538
- name: Run cargo clippy
3639
run: cargo clippy --workspace --features azure -- -D warnings
3740

attestation-provider-server/build.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,10 @@ fn emit_git_rerun_hints() {
3737
let manifest_dir =
3838
PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap_or_else(|_| ".".to_owned()));
3939

40-
for git_dir in [manifest_dir.join(".git"), manifest_dir.join("..").join(".git")] {
40+
for git_dir in [
41+
manifest_dir.join(".git"),
42+
manifest_dir.join("..").join(".git"),
43+
] {
4144
if git_dir.exists() {
4245
println!("cargo:rerun-if-changed={}", git_dir.join("HEAD").display());
4346
println!(

attestation-provider-server/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use attestation_provider_server::{attestation_provider_client, attestation_provider_server};
22
use attested_tls_proxy::attestation::{
3-
measurements::MeasurementPolicy, AttestationGenerator, AttestationVerifier,
3+
AttestationGenerator, AttestationVerifier, measurements::MeasurementPolicy,
44
};
55
use clap::{Parser, Subcommand};
66
use std::{net::SocketAddr, path::PathBuf};

attested-tls/src/attestation/azure/ak_certificate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//! Generation and verification of AK certificates from the vTPM
2-
use crate::attestation::azure::{nv_index, MaaError};
2+
use crate::attestation::azure::{MaaError, nv_index};
33
use once_cell::sync::Lazy;
44
use std::time::Duration;
55
use tokio_rustls::rustls::pki_types::{CertificateDer, TrustAnchor, UnixTime};

attested-tls/src/attestation/azure/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ mod nv_index;
44
use ak_certificate::{read_ak_certificate_from_tpm, verify_ak_cert_with_azure_roots};
55

66
use az_tdx_vtpm::{hcl, imds, vtpm};
7-
use base64::{engine::general_purpose::URL_SAFE as BASE64_URL_SAFE, Engine as _};
7+
use base64::{Engine as _, engine::general_purpose::URL_SAFE as BASE64_URL_SAFE};
88
use dcap_qvl::QuoteCollateralV3;
99
use num_bigint::BigUint;
1010
use openssl::{error::ErrorStack, pkey::PKey};
@@ -310,7 +310,9 @@ pub enum MaaError {
310310
Hex(#[from] hex::FromHexError),
311311
#[error("Attestation Key from HCL runtime claims does not match that from HCL report")]
312312
AkFromClaimsNotEqualAkFromHcl,
313-
#[error("Attestation Key from HCL runtime claims does not match that from attestation key certificate")]
313+
#[error(
314+
"Attestation Key from HCL runtime claims does not match that from attestation key certificate"
315+
)]
314316
AkFromClaimsNotEqualAkFromCertificate,
315317
#[error("WebPKI: {0}")]
316318
WebPki(#[from] webpki::Error),

attested-tls/src/attestation/azure/nv_index.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use tss_esapi::{
2+
Context,
23
handles::NvIndexTpmHandle,
34
interface_types::{resource_handles::NvAuth, session_handles::AuthSession},
45
tcti_ldr::{DeviceConfig, TctiNameConf},
5-
Context,
66
};
77

88
pub fn get_session_context() -> Result<Context, tss_esapi::Error> {

attested-tls/src/attestation/dcap.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
//! Data Center Attestation Primitives (DCAP) evidence generation and verification
2-
use crate::attestation::{measurements::MultiMeasurements, AttestationError};
2+
use crate::attestation::{AttestationError, measurements::MultiMeasurements};
33

44
use configfs_tsm::QuoteGenerationError;
55
use dcap_qvl::{
6+
QuoteCollateralV3,
67
collateral::get_collateral_for_fmspc,
78
quote::{Quote, Report},
89
tcb_info::TcbInfo,
9-
QuoteCollateralV3,
1010
};
1111
use thiserror::Error;
1212

attested-tls/src/attestation/measurements.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
//! Measurements and policy for enforcing them when validating a remote attestation
2-
use crate::attestation::{dcap::DcapVerificationError, AttestationError, AttestationType};
2+
use crate::attestation::{AttestationError, AttestationType, dcap::DcapVerificationError};
33
use std::{collections::HashMap, path::PathBuf};
44
use std::{fmt, fmt::Formatter};
55

66
use dcap_qvl::quote::Report;
7-
use http::{header::InvalidHeaderValue, HeaderValue};
7+
use http::{HeaderValue, header::InvalidHeaderValue};
88
use serde::Deserialize;
99
use thiserror::Error;
1010

attested-tls/src/attestation/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,9 @@ impl AttestationGenerator {
206206
}
207207
#[cfg(not(feature = "azure"))]
208208
{
209-
tracing::error!("Attempted to generate an azure attestation but the `azure` feature not enabled");
209+
tracing::error!(
210+
"Attempted to generate an azure attestation but the `azure` feature not enabled"
211+
);
210212
Err(AttestationError::AttestationTypeNotSupported)
211213
}
212214
}

attested-tls/src/attested_rpc.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Provides an attested JSON RPC client based on [alloy_rpc_client::RpcClient]
22
use alloy_rpc_client::RpcClient;
33
use alloy_transport_http::{Http, HyperClient};
4-
use hyper::{client::conn, Request, Response};
4+
use hyper::{Request, Response, client::conn};
55
use hyper_util::rt::TokioIo;
66
use std::{
77
future::Future,
@@ -13,8 +13,8 @@ use thiserror::Error;
1313
use tower_service::Service;
1414

1515
use crate::{
16-
attestation::{measurements::MultiMeasurements, AttestationType},
1716
AttestedTlsClient, AttestedTlsError,
17+
attestation::{AttestationType, measurements::MultiMeasurements},
1818
};
1919

2020
/// Supported HTTP versions for RPC connection bootstrapping
@@ -201,15 +201,15 @@ mod tests {
201201
use hyper::service::service_fn;
202202
use hyper::{Request, Response, StatusCode};
203203
use hyper_util::rt::TokioIo;
204-
use serde_json::{json, Value};
204+
use serde_json::{Value, json};
205205
use tokio::net::TcpListener;
206206

207207
use super::AttestedRpcClient;
208208

209209
use crate::{
210+
AttestedTlsClient, AttestedTlsServer,
210211
attestation::{AttestationGenerator, AttestationType, AttestationVerifier},
211212
test_helpers::{generate_certificate_chain, generate_tls_config},
212-
AttestedTlsClient, AttestedTlsServer,
213213
};
214214

215215
async fn simple_json_rpc_service(

0 commit comments

Comments
 (0)