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

Refactoring the KM #286

Open
wants to merge 30 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
f75230c
DEV: added error return on enigma-core main
AvishaiW Jan 28, 2020
25836b4
DEV: added thiserror crate and PrincipalConfig custom error
AvishaiW Jan 28, 2020
f8fd778
DEV: removed duplicate code in the principal manager
AvishaiW Jan 28, 2020
f4e913c
STY: removed unused code
AvishaiW Jan 28, 2020
8c34227
DEV: custom errors for report manager
AvishaiW Jan 28, 2020
ea884b0
BUG: added extern crate for failure
AvishaiW Jan 28, 2020
d675ea4
BUG: fixed a error mapping in main
AvishaiW Jan 29, 2020
09eaff7
STY: removed unused code
AvishaiW Jan 30, 2020
5a2a1f6
DEV: changed threading to crossbeam
AvishaiW Jan 30, 2020
fcf1dfd
MAINT: refactoring the KM-1
AvishaiW Feb 2, 2020
1f1608c
MAINT:removed warnings
AvishaiW Feb 2, 2020
d7d12a3
MAINT: changed gas_limit to a const
AvishaiW Feb 2, 2020
528a1f0
MAINT: removed stringWrapper and done many changes in the http server
AvishaiW Feb 3, 2020
f10b1c2
MAINT: removed unnecessary configurations
AvishaiW Feb 3, 2020
c67786b
MAINT: removed pub definitions from signed epoch struct
AvishaiW Feb 3, 2020
d2b4c5e
MAINT: doc fixes and renaming
AvishaiW Feb 3, 2020
856bac4
MAINT: renaming files and directories
AvishaiW Feb 4, 2020
d190d4b
BUG: fixed ContractAddress renaming
AvishaiW Feb 4, 2020
dd519e6
MAINT: added better error handling to the KM
AvishaiW Feb 6, 2020
774dbc4
Update enigma-core/app/src/main.rs
AvishaiW Feb 6, 2020
f1ef95b
Update enigma-core/app/src/main.rs
AvishaiW Feb 6, 2020
91704a7
MAINT: removed all warnings
AvishaiW Feb 6, 2020
c8af94c
Merge remote-tracking branch 'origin/km_errors' into km_errors
AvishaiW Feb 6, 2020
701209b
MAINT: changes according to review
AvishaiW Feb 6, 2020
25dac49
BLD: removed unused crate from KM
AvishaiW Feb 6, 2020
afff021
Merge branch 'develop' into km_errors
AvishaiW Feb 6, 2020
3e2be21
MAINT: Changes according to review of #286
AvishaiW Feb 6, 2020
497b0ac
BUG: fixing changes done in the previous commit
AvishaiW Feb 6, 2020
a684703
MAINT: changed name and message in a verifier error
AvishaiW Feb 6, 2020
587c56b
MAINT: more changes according to the review
AvishaiW Feb 6, 2020
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
21 changes: 21 additions & 0 deletions enigma-core/app/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions enigma-core/app/cross-test-utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ use std::fs::File;
use std::io::Read;
use std::path::PathBuf;
use std::process::Command;
pub use enigma_types::{ContractAddress, StateKey, Hash256};
pub use enigma_types::{StateKey, Hash256};
use enigma_crypto::{KeyPair, symmetric, rand};
use enigma_crypto::hash::{Sha256, Keccak256};
use serde_json::{*, Value};
use rmp_serde::{Serializer};
use serde::{Serialize};

pub fn generate_contract_address() -> ContractAddress {
let mut address = ContractAddress::default();
pub fn generate_contract_address() -> Hash256 {
let mut address = Hash256::default();
rand::random(address.as_mut()).unwrap();
address
}
Expand Down Expand Up @@ -56,17 +56,17 @@ pub fn get_bytecode_from_path(contract_path: &str) -> Vec<u8> {
}

// creates a non trivial reproducible stateKey from the contract address
pub fn get_fake_state_key(contract_address: ContractAddress) -> [u8; 32] {
pub fn get_fake_state_key(contract_address: Hash256) -> [u8; 32] {
contract_address.keccak256().sha256().into()
}

pub fn make_encrypted_response(req: &Value, addresses: Vec<ContractAddress>, keys: Option<Vec<StateKey>>) -> Value {
pub fn make_encrypted_response(req: &Value, addresses: Vec<Hash256>, keys: Option<Vec<StateKey>>) -> Value {
// Making the response
if !req["data"]["Request"].is_null() { // Just makes sure that {data:{Request}} Exists.
assert_eq!(serde_json::from_value::<Vec<ContractAddress>>(req["data"]["Request"].clone()).unwrap(), addresses);
assert_eq!(serde_json::from_value::<Vec<Hash256>>(req["data"]["Request"].clone()).unwrap(), addresses);
}

let _response_data: Vec<(ContractAddress, StateKey)> = if let Some(keys) = keys {
let _response_data: Vec<(Hash256, StateKey)> = if let Some(keys) = keys {
addresses.into_iter().zip(keys.into_iter()).collect()
} else {
addresses.into_iter().map(|addr| (addr, get_fake_state_key(addr))).collect()
Expand Down
4 changes: 2 additions & 2 deletions enigma-core/app/src/db/dal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ mod test {

use crate::db::{tests::create_test_db, dal::CRUDInterface, primitives::{Array32u8, DeltaKey, Stype}};
use hex::ToHex;
use enigma_types::ContractAddress;
use enigma_types::Hash256;

#[test]
fn test_new_db() {
Expand Down Expand Up @@ -383,7 +383,7 @@ mod test {
#[should_panic]
fn test_delete_contract_dk() {
let (mut db, _dir) = create_test_db();
let addr: ContractAddress = [2u8; 32].into();
let addr: Hash256 = [2u8; 32].into();
let dk_code = DeltaKey::new(addr, Stype::ByteCode);
let dk_delta = DeltaKey::new(addr, Stype::Delta(0));
let v_code = b"This is a Contract";
Expand Down
Loading