Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update rust to 2023-01-04 #2999

Merged
merged 8 commits into from
Feb 2, 2023
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
3 changes: 2 additions & 1 deletion attest/ake/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//! (client) and responders (server).

#![allow(clippy::type_complexity)]
#![allow(clippy::result_large_err)]
samdealy marked this conversation as resolved.
Show resolved Hide resolved
#![no_std]
extern crate alloc;

Expand Down Expand Up @@ -61,7 +62,7 @@ mod test {
let mut quote_data = quote.to_x64_vec();

// Overwrite the cached quote's report_data contents with our pubkey
(&mut quote_data[368..400]).copy_from_slice(pubkey.as_ref());
quote_data[368..400].copy_from_slice(pubkey.as_ref());

// Re-assemble a quote from the munged version
let quote = Quote::try_from(quote_data.as_ref())
Expand Down
1 change: 1 addition & 0 deletions attest/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#![no_std]
#![feature(core_intrinsics)]
#![allow(clippy::result_large_err)]

extern crate alloc;
#[macro_use]
Expand Down
1 change: 1 addition & 0 deletions attest/verifier/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#![doc = include_str!("../README.md")]
#![no_std]
#![allow(clippy::result_large_err)]

mod avr;
mod ias;
Expand Down
1 change: 1 addition & 0 deletions connection/src/thick.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
//! Connection implementations required for the thick client.
//! The attested client implementation.

#![allow(clippy::result_large_err)]
use crate::{
credentials::{AuthenticationError, CredentialsProvider, CredentialsProviderError},
error::{Error, Result},
Expand Down
1 change: 1 addition & 0 deletions consensus/enclave/api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#![no_std]
#![deny(missing_docs)]
#![allow(clippy::result_large_err)]

extern crate alloc;

Expand Down
35 changes: 15 additions & 20 deletions consensus/enclave/impl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
//! of irony...

#![no_std]
#![allow(clippy::result_large_err)]

extern crate alloc;

Expand Down Expand Up @@ -288,8 +289,7 @@ impl SgxConsensusEnclave {
let tx_hash = tx.tx_hash();
if tx_hashes.contains(&tx_hash) {
return Err(Error::FormBlock(format!(
"Duplicate transaction: {}",
tx_hash
"Duplicate transaction: {tx_hash}"
)));
}
tx_hashes.insert(tx_hash);
Expand All @@ -301,8 +301,7 @@ impl SgxConsensusEnclave {
for key_image in tx.key_images() {
if used_key_images.contains(&key_image) {
return Err(Error::FormBlock(format!(
"Duplicate key image: {:?}",
key_image
"Duplicate key image: {key_image:?}"
)));
}
used_key_images.insert(key_image);
Expand All @@ -315,8 +314,7 @@ impl SgxConsensusEnclave {
for public_key in tx.output_public_keys() {
if seen_output_public_keys.contains(&public_key) {
return Err(Error::FormBlock(format!(
"Duplicate output public key: {:?}",
public_key
"Duplicate output public key: {public_key:?}"
)));
}
seen_output_public_keys.insert(public_key);
Expand Down Expand Up @@ -403,8 +401,7 @@ impl SgxConsensusEnclave {
// The specific MintConfig used should be part of the provided MintConfigTx.
if !mint_config_tx.prefix.configs.contains(&mint_config) {
return Err(Error::FormBlock(format!(
"MintTx {} referenced a MintConfig that is not part of the MintConfigTx",
mint_tx,
"MintTx {mint_tx} referenced a MintConfig that is not part of the MintConfigTx",
)));
}

Expand Down Expand Up @@ -529,10 +526,10 @@ impl ConsensusEnclave for SgxConsensusEnclave {

fn get_fee_recipient(&self) -> Result<FeePublicKey> {
let spend_public_key = RistrettoPublic::try_from(&FEE_SPEND_PUBLIC_KEY).map_err(|e| {
Error::FeePublicAddress(format!("Could not get fee spend public: {:?}", e))
Error::FeePublicAddress(format!("Could not get fee spend public: {e:?}"))
})?;
let view_public_key = RistrettoPublic::try_from(&FEE_VIEW_PUBLIC_KEY).map_err(|e| {
Error::FeePublicAddress(format!("Could not get fee view public: {:?}", e))
Error::FeePublicAddress(format!("Could not get fee view public: {e:?}"))
})?;
Ok(FeePublicKey {
spend_public_key,
Expand Down Expand Up @@ -797,7 +794,7 @@ impl ConsensusEnclave for SgxConsensusEnclave {

// Compute the fee recipient public address
let fee_public_key = self.get_fee_recipient().map_err(|e| {
Error::FeePublicAddress(format!("Could not get fee public address: {:?}", e))
Error::FeePublicAddress(format!("Could not get fee public address: {e:?}"))
})?;
let fee_recipient = PublicAddress::new(
&fee_public_key.spend_public_key,
Expand Down Expand Up @@ -1030,7 +1027,7 @@ fn mint_output<T: Digestible>(
&tx_private_key,
e_fog_hint.unwrap_or_default(),
)
.map_err(|e| Error::FormBlock(format!("NewTxError: {}", e)))
.map_err(|e| Error::FormBlock(format!("NewTxError: {e}")))
}

#[cfg(test)]
Expand Down Expand Up @@ -1096,7 +1093,7 @@ mod tests {
let governors_map1 =
GovernorsMap::try_from_iter([(token_id1, signer_set1.clone())]).unwrap();
let governors_map2 = GovernorsMap::try_from_iter([(token_id2, signer_set1)]).unwrap();
let enclave = SgxConsensusEnclave::new(logger.clone());
let enclave = SgxConsensusEnclave::new(logger);
let block_version = BlockVersion::MAX;

// Can't initialize without a valid governors signature if we are passing a
Expand Down Expand Up @@ -1341,7 +1338,7 @@ mod tests {
initialize_ledger(block_version, &mut ledger, n_blocks, &account_key, &mut rng);

let n_proofs = 10;
let indexes: Vec<u64> = (0..n_proofs as u64).into_iter().collect();
let indexes: Vec<u64> = (0..n_proofs as u64).collect();
let mut membership_proofs = ledger.get_tx_out_proof_of_memberships(&indexes).unwrap();
// Modify one of the proofs to have a different root hash.
let inconsistent_proof = &mut membership_proofs[7];
Expand Down Expand Up @@ -1795,8 +1792,7 @@ mod tests {

// Check
let expected = Err(Error::FormBlock(format!(
"Duplicate key image: {:?}",
expected_duplicate_key_image
"Duplicate key image: {expected_duplicate_key_image:?}"
)));

assert_eq!(form_block_result, expected);
Expand Down Expand Up @@ -1913,8 +1909,7 @@ mod tests {

// Check
let expected = Err(Error::FormBlock(format!(
"Duplicate output public key: {:?}",
expected_duplicate_output_public_key
"Duplicate output public key: {expected_duplicate_output_public_key:?}"
)));

assert_eq!(form_block_result, expected);
Expand Down Expand Up @@ -2430,7 +2425,7 @@ mod tests {
&mut rng,
);

let enclave = SgxConsensusEnclave::new(logger.clone());
let enclave = SgxConsensusEnclave::new(logger);
let blockchain_config = BlockchainConfig {
block_version,
governors_map: governors_map.clone(),
Expand Down Expand Up @@ -2603,7 +2598,7 @@ mod tests {
&mut rng,
);

let enclave = SgxConsensusEnclave::new(logger.clone());
let enclave = SgxConsensusEnclave::new(logger);
let blockchain_config = BlockchainConfig {
block_version,
governors_map: governors_map.clone(),
Expand Down
3 changes: 2 additions & 1 deletion consensus/enclave/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

//! The Consensus Service SGX Enclave Proxy

#![allow(clippy::result_large_err)]
pub use mc_consensus_enclave_api::{
BlockchainConfig, ConsensusEnclave, ConsensusEnclaveProxy, EnclaveCall, Error, FeePublicKey,
FormBlockInputs, GovernorsMap, LocallyEncryptedTx, Result, TxContext, WellFormedEncryptedTx,
Expand Down Expand Up @@ -60,7 +61,7 @@ impl ConsensusServiceSgxEnclave {
misc_select: 0,
};
let enclave = SgxEnclave::create(
&enclave_path,
enclave_path,
DEBUG_ENCLAVE as i32,
&mut launch_token,
&mut launch_token_updated,
Expand Down
4 changes: 3 additions & 1 deletion consensus/enclave/trusted/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,10 @@ pub fn ecall_dispatcher(inbuf: &[u8]) -> Result<Vec<u8>, sgx_status_t> {
///
/// See mc_consensus_enclave_api::mobileenclave() declaration for more
/// information
/// # Safety
/// This method dereferences raw pointers and is therefore unsafe.
#[no_mangle]
pub extern "C" fn mobileenclave_call(
pub unsafe extern "C" fn mobileenclave_call(
inbuf: *const u8,
inbuf_len: usize,
outbuf: *mut u8,
Expand Down
1 change: 1 addition & 0 deletions consensus/service/src/api/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) 2018-2022 The MobileCoin Foundation

//! gRPC APIs
#![allow(clippy::result_large_err)]

mod attested_api_service;
mod blockchain_api_service;
Expand Down
1 change: 1 addition & 0 deletions consensus/service/src/bin/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright (c) 2018-2022 The MobileCoin Foundation
#![deny(missing_docs)]
#![allow(clippy::result_large_err)]

//! Entrypoint for the MobileCoin server.

Expand Down
2 changes: 1 addition & 1 deletion consensus/service/src/consensus_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,7 @@ impl<
"public_key": config.node_id().public_key,
"peer_responder_id": config.peer_responder_id,
"client_responder_id": config.client_responder_id,
"message_pubkey": URL_SAFE_BASE64_ENGINE.encode(&config.msg_signer_key.public_key().to_der()),
"message_pubkey": URL_SAFE_BASE64_ENGINE.encode(config.msg_signer_key.public_key().to_der()),
"network": config.network_path,
"peer_listen_uri": config.peer_listen_uri,
"client_listen_uri": config.client_listen_uri,
Expand Down
1 change: 1 addition & 0 deletions consensus/service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
//! The MobileCoin consensus node.

#![feature(test)]
#![allow(clippy::result_large_err)]

#[cfg(test)]
extern crate test;
Expand Down
Loading