Skip to content
This repository has been archived by the owner on Jun 21, 2020. It is now read-only.

Commit

Permalink
MAINT: Fixed whatever cargo clippy told me
Browse files Browse the repository at this point in the history
  • Loading branch information
elichai committed Dec 6, 2018
1 parent 493eebd commit 4611462
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 12 deletions.
2 changes: 1 addition & 1 deletion enigma-core/app/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ extern crate rocksdb;
#[macro_use]
extern crate lazy_static;
// networking apt install libzmq3-dev
#[macro_use]
#[cfg_attr(test, macro_use)]
extern crate serde_json;
extern crate zmq;
// errors
Expand Down
8 changes: 4 additions & 4 deletions enigma-core/app/src/wasm_u/wasm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ pub struct WasmResult {
pub eth_contract_addr: [u8;20],
}

pub fn execute(eid: sgx_enclave_id_t, bytecode: Box<[u8]>, callable: &str, args: &str)-> Result<WasmResult,Error>{
pub fn execute(eid: sgx_enclave_id_t, bytecode: &[u8], callable: &str, args: &str)-> Result<WasmResult,Error>{
let mut retval: EnclaveReturn = EnclaveReturn::Success;
let mut output = 0u64;
let mut delta_data_ptr = 0u64;
Expand Down Expand Up @@ -195,7 +195,7 @@ pub mod tests {
let enclave = init_enclave();
let contract_code = compile_and_deploy_wasm_contract(enclave.geteid(), "../../examples/eng_wasm_contracts/simplest");
// let result = wasm::execute(enclave.geteid(),contract_code, "test(uint256,uint256)", "c20102").expect("Execution failed");
let result = wasm::execute(enclave.geteid(), contract_code, "write()", "").expect("Execution failed");
let result = wasm::execute(enclave.geteid(), &contract_code, "write()", "").expect("Execution failed");
enclave.destroy();
assert_eq!(from_utf8(&result.output).unwrap(), "\"157\"");
}
Expand All @@ -204,7 +204,7 @@ pub mod tests {
fn eth_bridge() {
let enclave = init_enclave();
let contract_code = compile_and_deploy_wasm_contract(enclave.geteid(), "../../examples/eng_wasm_contracts/contract_with_eth_calls");
let result = wasm::execute(enclave.geteid(), contract_code, "test()", "").expect("Execution failed");
let result = wasm::execute(enclave.geteid(), &contract_code, "test()", "").expect("Execution failed");
enclave.destroy();
}

Expand All @@ -220,7 +220,7 @@ pub mod tests {
println!("Bytecode size: {}KB\n", wasm_code.len() / 1024);
let enclave = init_enclave();
let contract_code = wasm::deploy(enclave.geteid(), &wasm_code).expect("Deploy Failed");
let result = wasm::execute(enclave.geteid(),contract_code, "call", "").expect("Execution failed");
let result = wasm::execute(enclave.geteid(),&contract_code, "call", "").expect("Execution failed");
assert_eq!(from_utf8(&result.output).unwrap(), "157");
}
}
4 changes: 2 additions & 2 deletions enigma-tools-t/src/build_arguments_g/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ pub fn get_types(function: &str) -> Result<(String, String), EnclaveError>{
Ok(( function[start_arg_index+1..end_arg_index].to_string(), String::from(&function[..start_arg_index] )))
}

pub fn get_args(callable_args: &[u8], types: &Vec<String>) -> Result<Vec<String>, EnclaveError>{
pub fn get_args(callable_args: &[u8], types: &[String]) -> Result<Vec<String>, EnclaveError>{
decode_args(callable_args, types)
}

pub fn extract_types(types: &str) -> Vec<String>{
let mut types_vector: Vec<String> = vec![];
let types_iterator = types.split(",");
let types_iterator = types.split(',');
for each_type in types_iterator{
types_vector.push(each_type.to_string());
}
Expand Down
5 changes: 1 addition & 4 deletions enigma-tools-t/src/cryptography_t/asymmetric.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@ impl KeyPair {
loop {
let mut me: [u8; 32] = [0; 32];
rsgx_read_rand(&mut me)?;
match SecretKey::parse(&me) {
Ok(_priv) => return Ok(KeyPair { privkey: _priv.clone(), pubkey: PublicKey::from_secret_key(&_priv) }),
Err(_) => (),
}
if let Ok(_priv) = SecretKey::parse(&me) { return Ok(KeyPair { privkey: _priv.clone(), pubkey: PublicKey::from_secret_key(&_priv) }) }
}
}

Expand Down
1 change: 0 additions & 1 deletion enigma-tools-u/src/web3_utils/w3utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use failure::Error;
use hex::FromHex;
use std::str;
use std::time;
use tiny_keccak::Keccak;
//web3
use web3;
use web3::contract::tokens::Tokenize;
Expand Down

0 comments on commit 4611462

Please sign in to comment.