This commit is contained in:
Niklas Adolfsson 2018-05-16 20:09:59 +02:00 committed by Robert Habermeier
parent 0ecbb3ec02
commit f9e64e0965
8 changed files with 17 additions and 17 deletions

View File

@ -54,15 +54,15 @@ fn latest_exe_path() -> Option<PathBuf> {
fn set_spec_name_override(spec_name: String) { fn set_spec_name_override(spec_name: String) {
if let Err(e) = create_dir_all(default_hypervisor_path()) if let Err(e) = create_dir_all(default_hypervisor_path())
.and_then(|_| File::create(updates_path("spec_name_overide")) .and_then(|_| File::create(updates_path("spec_name_override"))
.and_then(|mut f| f.write_all(spec_name.as_bytes()))) .and_then(|mut f| f.write_all(spec_name.as_bytes())))
{ {
warn!("Couldn't override chain spec: {} at {:?}", e, updates_path("spec_name_overide")); warn!("Couldn't override chain spec: {} at {:?}", e, updates_path("spec_name_override"));
} }
} }
fn take_spec_name_override() -> Option<String> { fn take_spec_name_override() -> Option<String> {
let p = updates_path("spec_name_overide"); let p = updates_path("spec_name_override");
let r = File::open(p.clone()).ok() let r = File::open(p.clone()).ok()
.and_then(|mut f| { let mut spec_name = String::new(); f.read_to_string(&mut spec_name).ok().map(|_| spec_name) }); .and_then(|mut f| { let mut spec_name = String::new(); f.read_to_string(&mut spec_name).ok().map(|_| spec_name) });
let _ = remove_file(p); let _ = remove_file(p);

View File

@ -106,7 +106,7 @@ impl CachedContract {
pub fn check(&mut self, requester: Address, document: &ServerKeyId) -> Result<bool, Error> { pub fn check(&mut self, requester: Address, document: &ServerKeyId) -> Result<bool, Error> {
if let Some(client) = self.client.get() { if let Some(client) = self.client.get() {
// call contract to check accesss // call contract to check access
match self.contract_addr { match self.contract_addr {
Some(contract_address) => { Some(contract_address) => {
let do_call = |data| client.call_contract(BlockId::Latest, contract_address, data); let do_call = |data| client.call_contract(BlockId::Latest, contract_address, data);

View File

@ -271,7 +271,7 @@ impl CachedContract {
pub fn update(&mut self, enacted: Vec<H256>, retracted: Vec<H256>) { pub fn update(&mut self, enacted: Vec<H256>, retracted: Vec<H256>) {
if let Some(client) = self.client.get() { if let Some(client) = self.client.get() {
// read new snapshot from reqistry (if something has chnaged) // read new snapshot from registry (if something has changed)
self.read_from_registry_if_required(&*client, enacted, retracted); self.read_from_registry_if_required(&*client, enacted, retracted);
// update number of confirmations (if there's future new set) // update number of confirmations (if there's future new set)
@ -371,7 +371,7 @@ impl CachedContract {
None => { None => {
// no contract installed => empty snapshot // no contract installed => empty snapshot
// WARNING: after restart current_set will be reset to the set from configuration file // WARNING: after restart current_set will be reset to the set from configuration file
// even though we have reset to empty set here. We are not considerning this as an issue // even though we have reset to empty set here. We are not considering this as an issue
// because it is actually the issue of administrator. // because it is actually the issue of administrator.
self.snapshot = Default::default(); self.snapshot = Default::default();
self.future_new_set = None; self.future_new_set = None;
@ -540,7 +540,7 @@ fn update_number_of_confirmations<F1: Fn() -> H256, F2: Fn(H256) -> Option<u64>>
// not enough confirmations => do nothing // not enough confirmations => do nothing
Some(_) => return, Some(_) => return,
// if number of confirmations is None, then reorg has happened && we need to reset block // if number of confirmations is None, then reorg has happened && we need to reset block
// (some more intelligent startegy is possible, but let's stick to simplest one) // (some more intelligent strategy is possible, but let's stick to simplest one)
None => { None => {
future_new_set.block = latest_block(); future_new_set.block = latest_block();
return; return;
@ -556,9 +556,9 @@ fn update_number_of_confirmations<F1: Fn() -> H256, F2: Fn(H256) -> Option<u64>>
fn update_last_transaction_block(client: &Client, migration_id: &H256, previous_transaction: &mut Option<PreviousMigrationTransaction>) -> bool { fn update_last_transaction_block(client: &Client, migration_id: &H256, previous_transaction: &mut Option<PreviousMigrationTransaction>) -> bool {
let last_block = client.block_number(BlockId::Latest).unwrap_or_default(); let last_block = client.block_number(BlockId::Latest).unwrap_or_default();
match previous_transaction.as_ref() { match previous_transaction.as_ref() {
// no previous transaction => send immideately // no previous transaction => send immediately
None => (), None => (),
// previous transaction has been sent for other migration process => send immideately // previous transaction has been sent for other migration process => send immediately
Some(tx) if tx.migration_id != *migration_id => (), Some(tx) if tx.migration_id != *migration_id => (),
// if we have sent the same type of transaction recently => do nothing (hope it will be mined eventually) // if we have sent the same type of transaction recently => do nothing (hope it will be mined eventually)
// if we have sent the same transaction some time ago => // if we have sent the same transaction some time ago =>

View File

@ -108,7 +108,7 @@ pub struct SerializableDocumentKeyShareV0 {
/// V1 of encrypted key share, as it is stored by key storage on the single key server. /// V1 of encrypted key share, as it is stored by key storage on the single key server.
#[derive(Serialize, Deserialize)] #[derive(Serialize, Deserialize)]
struct SerializableDocumentKeyShareV1 { struct SerializableDocumentKeyShareV1 {
/// Authore of the entry. /// Author of the entry.
pub author: SerializablePublic, pub author: SerializablePublic,
/// Decryption threshold (at least threshold + 1 nodes are required to decrypt data). /// Decryption threshold (at least threshold + 1 nodes are required to decrypt data).
pub threshold: usize, pub threshold: usize,

View File

@ -117,7 +117,7 @@ impl_bytes!(SerializableSignature, Signature, false, ());
/// Serializable shadow decryption result. /// Serializable shadow decryption result.
#[derive(Clone, Debug, Serialize, Deserialize)] #[derive(Clone, Debug, Serialize, Deserialize)]
pub struct SerializableEncryptedDocumentKeyShadow { pub struct SerializableEncryptedDocumentKeyShadow {
/// Decrypted secret point. It is partially decrypted if shadow decrpytion was requested. /// Decrypted secret point. It is partially decrypted if shadow decryption was requested.
pub decrypted_secret: SerializablePublic, pub decrypted_secret: SerializablePublic,
/// Shared common point. /// Shared common point.
pub common_point: SerializablePublic, pub common_point: SerializablePublic,

View File

@ -94,7 +94,7 @@ pub trait MessageSigner: ServerKeyGenerator {
/// Administrative sessions server. /// Administrative sessions server.
pub trait AdminSessionsServer { pub trait AdminSessionsServer {
/// Change servers set so that nodes in new_servers_set became owners of shares for all keys. /// Change servers set so that nodes in new_servers_set became owners of shares for all keys.
/// And old nodes (i.e. cluste nodes except new_servers_set) have clear databases. /// And old nodes (i.e. cluster nodes except new_servers_set) have clear databases.
/// WARNING: newly generated keys will be distributed among all cluster nodes. So this session /// WARNING: newly generated keys will be distributed among all cluster nodes. So this session
/// must be followed with cluster nodes change (either via contract, or config files). /// must be followed with cluster nodes change (either via contract, or config files).
fn change_servers_set(&self, old_set_signature: RequestSignature, new_set_signature: RequestSignature, new_servers_set: BTreeSet<NodeId>) -> Result<(), Error>; fn change_servers_set(&self, old_set_signature: RequestSignature, new_set_signature: RequestSignature, new_servers_set: BTreeSet<NodeId>) -> Result<(), Error>;

View File

@ -94,7 +94,7 @@ pub struct ClusterConfiguration {
/// Shadow decryption result. /// Shadow decryption result.
#[derive(Clone, Debug, PartialEq)] #[derive(Clone, Debug, PartialEq)]
pub struct EncryptedDocumentKeyShadow { pub struct EncryptedDocumentKeyShadow {
/// Decrypted secret point. It is partially decrypted if shadow decrpytion was requested. /// Decrypted secret point. It is partially decrypted if shadow decryption was requested.
pub decrypted_secret: ethkey::Public, pub decrypted_secret: ethkey::Public,
/// Shared common point. /// Shared common point.
pub common_point: Option<ethkey::Public>, pub common_point: Option<ethkey::Public>,

View File

@ -60,7 +60,7 @@ pub enum Error {
/// Document key with this ID is not yet stored. /// Document key with this ID is not yet stored.
DocumentKeyIsNotFound, DocumentKeyIsNotFound,
/// Consensus is temporary unreachable. Means that something is currently blocking us from either forming /// Consensus is temporary unreachable. Means that something is currently blocking us from either forming
/// consensus group (like disconnecting from too many nodes, which are AGREE to partticipate in consensus) /// consensus group (like disconnecting from too many nodes, which are AGREE to participate in consensus)
/// or from rejecting request (disconnecting from AccessDenied-nodes). /// or from rejecting request (disconnecting from AccessDenied-nodes).
ConsensusTemporaryUnreachable, ConsensusTemporaryUnreachable,
/// Consensus is unreachable. It doesn't mean that it will ALWAYS remain unreachable, but right NOW we have /// Consensus is unreachable. It doesn't mean that it will ALWAYS remain unreachable, but right NOW we have
@ -78,9 +78,9 @@ pub enum Error {
InsufficientRequesterData(String), InsufficientRequesterData(String),
/// Cryptographic error. /// Cryptographic error.
EthKey(String), EthKey(String),
/// I/O error has occured. /// I/O error has occurred.
Io(String), Io(String),
/// Deserialization error has occured. /// Deserialization error has occurred.
Serde(String), Serde(String),
/// Hyper error. /// Hyper error.
Hyper(String), Hyper(String),
@ -148,7 +148,7 @@ impl fmt::Display for Error {
Error::DocumentKeyIsNotFound => write!(f, "Document key with this ID is not found"), Error::DocumentKeyIsNotFound => write!(f, "Document key with this ID is not found"),
Error::ConsensusUnreachable => write!(f, "Consensus unreachable"), Error::ConsensusUnreachable => write!(f, "Consensus unreachable"),
Error::ConsensusTemporaryUnreachable => write!(f, "Consensus temporary unreachable"), Error::ConsensusTemporaryUnreachable => write!(f, "Consensus temporary unreachable"),
Error::AccessDenied => write!(f, "Access dened"), Error::AccessDenied => write!(f, "Access denied"),
Error::ExclusiveSessionActive => write!(f, "Exclusive session active"), Error::ExclusiveSessionActive => write!(f, "Exclusive session active"),
Error::HasActiveSessions => write!(f, "Unable to start exclusive session"), Error::HasActiveSessions => write!(f, "Unable to start exclusive session"),
Error::InsufficientRequesterData(ref e) => write!(f, "Insufficient requester data: {}", e), Error::InsufficientRequesterData(ref e) => write!(f, "Insufficient requester data: {}", e),