Skip to content

Commit

Permalink
Fix clippy workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
iKapitonau committed Jul 23, 2024
1 parent c55fae6 commit cf7e983
Show file tree
Hide file tree
Showing 9 changed files with 808 additions and 436 deletions.
252 changes: 177 additions & 75 deletions check-hw/Cargo.lock

Large diffs are not rendered by default.

965 changes: 620 additions & 345 deletions cosmwasm/enclaves/Cargo.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions cosmwasm/enclaves/execute/src/registration/attestation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -862,8 +862,8 @@ fn parse_response_attn_report(resp: &[u8]) -> SgxResult<(String, Vec<u8>, Vec<u8
info!("Attestation report: {}", attn_report);
}

let sig_bytes = base64::decode(&sig).unwrap();
let sig_cert_bytes = base64::decode(&sig_cert).unwrap();
let sig_bytes = base64::decode(sig).unwrap();
let sig_cert_bytes = base64::decode(sig_cert).unwrap();
// len_num == 0
Ok((attn_report, sig_bytes, sig_cert_bytes))
}
Expand Down
2 changes: 1 addition & 1 deletion cosmwasm/enclaves/execute/src/registration/cert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ pub fn verify_ra_cert(
) -> Result<Vec<u8>, NodeAuthResult> {
let payload = get_netscape_comment(cert_der).map_err(|_err| NodeAuthResult::InvalidCert)?;

let pk = base64::decode(&payload).map_err(|_err| NodeAuthResult::InvalidCert)?;
let pk = base64::decode(payload).map_err(|_err| NodeAuthResult::InvalidCert)?;

Ok(pk)
}
Expand Down
9 changes: 2 additions & 7 deletions cosmwasm/enclaves/ffi-types/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,17 +229,12 @@ pub enum NodeAuthResult {
/// enclave while authenticating a new node in the network.
/// cbindgen:prefix-with-name
#[repr(C)]
#[derive(Debug, Display, PartialEq, Eq)]
#[derive(Debug, Display, PartialEq, Eq, Default)]
pub enum HealthCheckResult {
#[default]
Success,
}

impl Default for HealthCheckResult {
fn default() -> Self {
HealthCheckResult::Success
}
}

/// This type holds a pointer to a VmError that is boxed on the untrusted side
// `VmError` is the standard error type for the `cosmwasm-sgx-vm` layer.
// During an ocall, we call into the original implementation of `db_read`, `db_write`, and `db_remove`.
Expand Down
4 changes: 2 additions & 2 deletions cosmwasm/enclaves/shared/contract-engine/src/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub fn parse_message(
message: &[u8],
handle_type: &HandleType,
) -> Result<ParsedMessage, EnclaveError> {
return match handle_type {
match handle_type {
HandleType::HANDLE_TYPE_EXECUTE => parse_execute_message(message),
HandleType::HANDLE_TYPE_REPLY => parse_reply_message(message),
HandleType::HANDLE_TYPE_IBC_CHANNEL_OPEN
Expand All @@ -38,7 +38,7 @@ pub fn parse_message(
| HandleType::HANDLE_TYPE_IBC_WASM_HOOKS_OUTGOING_TRANSFER_TIMEOUT => {
parse_plaintext_ibc_validated_message(message)
}
};
}
}

pub fn is_ibc_msg(handle_type: HandleType) -> bool {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ fn decrypt_query_response(
WasmEngineError::DecryptionError
})?;

base64::decode(&b64_decrypted).map_err(|err| {
base64::decode(b64_decrypted).map_err(|err| {
debug!(
"encrypt_and_query_chain() got an answer, managed to decrypt it, then tried to decode the output from base64 to bytes and failed: {:?}",
err
Expand Down
2 changes: 1 addition & 1 deletion cosmwasm/enclaves/shared/contract-engine/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ impl SecretMessage {
nonce: IoNonce,
user_public_key: Ed25519PublicKey,
) -> Result<Self, EnclaveError> {
let msg = base64::decode(&msg_b64.to_owned().into_bytes()).map_err(|err| {
let msg = base64::decode(msg_b64.to_owned().into_bytes()).map_err(|err| {
error!(
"got an error while trying to decode msg to next contract as base64 {:?}: {:?}",
msg_b64, err
Expand Down
4 changes: 2 additions & 2 deletions cosmwasm/enclaves/shared/contract-engine/src/wasm3/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1712,9 +1712,9 @@ fn host_ed25519_batch_verify(
rng_entropy.append(&mut used_gas.to_be_bytes().to_vec());

let rng_seed: [u8; 32] = sha_256(&rng_entropy);
let mut rng = ChaChaRng::from_seed(rng_seed);
let rng = ChaChaRng::from_seed(rng_seed);

match batch.verify(&mut rng) {
match batch.verify(rng) {
Err(err) => {
debug!(
"ed25519_batch_verify() failed to verify signatures: {:?}",
Expand Down

0 comments on commit cf7e983

Please sign in to comment.