Skip to content

Commit 96a3293

Browse files
authored
Merge branch 'master' into feature/sp_plugged
2 parents 1b36991 + dc57c32 commit 96a3293

File tree

20 files changed

+72
-54
lines changed

20 files changed

+72
-54
lines changed

libindy/src/commands/anoncreds/issuer.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ impl IssuerCommandExecutor {
187187
.map_err(|err| CommonError::InvalidStructure(format!("Cannot deserialize AttributeNames: {:?}", err)))?;
188188

189189
if attrs.is_empty() {
190-
return Err(IndyError::CommonError(CommonError::InvalidStructure(format!("List of Schema attributes is empty"))));
190+
return Err(IndyError::CommonError(CommonError::InvalidStructure("List of Schema attributes is empty".to_string())));
191191
}
192192

193193
let schema_id = Schema::schema_id(issuer_did, name, version);
@@ -440,15 +440,15 @@ impl IssuerCommandExecutor {
440440
rev_reg_info.curr_id = 1 + rev_reg_info.curr_id;
441441

442442
if rev_reg_info.curr_id > rev_reg_def.value.max_cred_num {
443-
return Err(IndyError::AnoncredsError(AnoncredsError::RevocationRegistryFull(format!("RevocationRegistryAccumulator is full"))));
443+
return Err(IndyError::AnoncredsError(AnoncredsError::RevocationRegistryFull("RevocationRegistryAccumulator is full".to_string())));
444444
}
445445

446446
if rev_reg_def.value.issuance_type == IssuanceType::ISSUANCE_ON_DEMAND {
447447
rev_reg_info.used_ids.insert(rev_reg_info.curr_id.clone());
448448
}
449449

450450
let blob_storage_reader_handle = blob_storage_reader_handle
451-
.ok_or(IndyError::CommonError(CommonError::InvalidStructure(format!("TailsReaderHandle not found"))))?;
451+
.ok_or(IndyError::CommonError(CommonError::InvalidStructure("TailsReaderHandle not found".to_string())))?;
452452

453453
let sdk_tails_accessor = SDKTailsAccessor::new(self.blob_storage_service.clone(),
454454
blob_storage_reader_handle,
@@ -695,4 +695,4 @@ impl IssuerCommandExecutor {
695695
fn _wallet_get_rev_reg_info(&self, wallet_handle: i32, key: &str) -> Result<RevocationRegistryInfo, WalletError> {
696696
self.wallet_service.get_indy_object(wallet_handle, &key, &RecordOptions::id_value(), &mut String::new())
697697
}
698-
}
698+
}

libindy/src/commands/anoncreds/tails.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ impl SDKTailsAccessor {
2828
tails_reader_handle: i32,
2929
rev_reg_def: &RevocationRegistryDefinitionV1) -> Result<SDKTailsAccessor, CommonError> {
3030
let tails_hash = rev_reg_def.value.tails_hash.from_base58()
31-
.map_err(|_| CommonError::InvalidState(format!("Invalid base58 for Tails hash")))?;
31+
.map_err(|_| CommonError::InvalidState("Invalid base58 for Tails hash".to_string()))?;
3232

3333
let tails_reader_handle = tails_service.open_blob(tails_reader_handle,
3434
&rev_reg_def.value.tails_location,

libindy/src/commands/did.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ impl DidCommandExecutor {
217217
let (did, key) = self.crypto_service.create_my_did(&my_did_info)?;
218218

219219
if self.wallet_service.record_exists::<Did>(wallet_handle, &did.did)? {
220-
return Err(IndyError::DidError(DidError::AlreadyExistsError(format!("Did already exists"))));
220+
return Err(IndyError::DidError(DidError::AlreadyExistsError("Did already exists".to_string())));
221221
};
222222

223223
self.wallet_service.add_indy_object(wallet_handle, &did.did, &did, "{}")?;
@@ -553,7 +553,7 @@ impl DidCommandExecutor {
553553
GetNymReplyResult::GetNymReplyResultV0(res) => {
554554
let gen_nym_result_data = GetNymResultDataV0::from_json(&res.data)
555555
.map_err(map_err_trace!())
556-
.map_err(|_| CommonError::InvalidState(format!("Invalid GetNymResultData json")))?;
556+
.map_err(|_| CommonError::InvalidState("Invalid GetNymResultData json".to_string()))?;
557557

558558
TheirDidInfo::new(gen_nym_result_data.dest, gen_nym_result_data.verkey)
559559
}

libindy/src/commands/ledger.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ impl LedgerCommandExecutor {
399399
request.remove("signature");
400400
request.remove("signatures");
401401
request
402-
}).ok_or(CommonError::InvalidState(format!("Cannot deserialize request")))?;
402+
}).ok_or(CommonError::InvalidState("Cannot deserialize request".to_string()))?;
403403

404404
let serialized_request = serialize_signature(message_without_signatures)?;
405405
let signature = self.crypto_service.sign(&my_key, &serialized_request.as_bytes().to_vec())?;
@@ -859,4 +859,4 @@ impl LedgerCommandExecutor {
859859
enum SignatureType {
860860
Single,
861861
Multi
862-
}
862+
}

libindy/src/commands/payments.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ impl PaymentsCommandExecutor {
282282
while let Ok(Some(payment_address)) = search.fetch_next_record() {
283283
match payment_address.get_value() {
284284
Some(value) => list_addresses.push(value.to_string()),
285-
None => cb(Err(IndyError::CommonError(CommonError::InvalidState(format!("Record value not found")))))
285+
None => cb(Err(IndyError::CommonError(CommonError::InvalidState("Record value not found".to_string()))))
286286
}
287287
}
288288

libindy/src/services/anoncreds/issuer.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,13 @@ impl Issuer {
108108
if rev_idx.is_some() {
109109
let rev_idx = rev_idx.unwrap();
110110
let rev_reg = rev_reg
111-
.ok_or(CommonError::InvalidState(format!("RevocationRegistry not found")))?;
111+
.ok_or(CommonError::InvalidState("RevocationRegistry not found".to_string()))?;
112112
let rev_key_priv = rev_key_priv
113-
.ok_or(CommonError::InvalidState(format!("RevocationKeyPrivate not found")))?;
113+
.ok_or(CommonError::InvalidState("RevocationKeyPrivate not found".to_string()))?;
114114
let rev_reg_def = rev_reg_def
115-
.ok_or(CommonError::InvalidState(format!("RevocationRegistryDefinitionValue not found")))?;
115+
.ok_or(CommonError::InvalidState("RevocationRegistryDefinitionValue not found".to_string()))?;
116116
let rev_tails_accessor = rev_tails_accessor
117-
.ok_or(CommonError::InvalidState(format!("RevocationTailsAccessor not found")))?;
117+
.ok_or(CommonError::InvalidState("RevocationTailsAccessor not found".to_string()))?;
118118

119119
CryptoIssuer::sign_credential_with_revoc(&cred_request.prover_did,
120120
&cred_request.blinded_ms,
@@ -177,4 +177,4 @@ impl Issuer {
177177

178178
Ok(rev_reg_delta)
179179
}
180-
}
180+
}

libindy/src/services/anoncreds/prover.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,8 @@ impl Prover {
183183
.ok_or(CommonError::InvalidStructure(format!("CredentialDefinition not found by id: {:?}", credential.cred_def_id)))?;
184184

185185
let rev_state = if cred_def.value.revocation.is_some() {
186-
let timestamp = cred_key.timestamp.clone().ok_or(CommonError::InvalidStructure(format!("Timestamp not found")))?;
187-
let rev_reg_id = credential.rev_reg_id.clone().ok_or(CommonError::InvalidStructure(format!("Revocation Registry Id not found")))?;
186+
let timestamp = cred_key.timestamp.clone().ok_or(CommonError::InvalidStructure("Timestamp not found".to_string()))?;
187+
let rev_reg_id = credential.rev_reg_id.clone().ok_or(CommonError::InvalidStructure("Revocation Registry Id not found".to_string()))?;
188188
let rev_states_for_timestamp = rev_states.get(&rev_reg_id)
189189
.ok_or(CommonError::InvalidStructure(format!("RevocationState not found by id: {:?}", rev_reg_id)))?;
190190
Some(rev_states_for_timestamp.get(&timestamp)
@@ -439,4 +439,4 @@ impl Prover {
439439

440440
Ok(sub_proof_request)
441441
}
442-
}
442+
}

libindy/src/services/anoncreds/verifier.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ impl Verifier {
4040
.ok_or(CommonError::InvalidStructure(format!("CredentialDefinition not found for id: {:?}", identifier.cred_def_id)))?;
4141

4242
let (rev_reg_def, rev_reg) = if cred_def.value.revocation.is_some() {
43-
let timestamp = identifier.timestamp.clone().ok_or(CommonError::InvalidStructure(format!("Timestamp not found")))?;
44-
let rev_reg_id = identifier.rev_reg_id.clone().ok_or(CommonError::InvalidStructure(format!("Revocation Registry Id not found")))?;
43+
let timestamp = identifier.timestamp.clone().ok_or(CommonError::InvalidStructure("Timestamp not found".to_string()))?;
44+
let rev_reg_id = identifier.rev_reg_id.clone().ok_or(CommonError::InvalidStructure("Revocation Registry Id not found".to_string()))?;
4545
let rev_reg_def = Some(rev_reg_defs.get(&rev_reg_id)
4646
.ok_or(CommonError::InvalidStructure(format!("RevocationRegistryDefinition not found for id: {:?}", identifier.rev_reg_id)))?);
4747
let rev_regs_for_cred = rev_regs.get(&rev_reg_id)
@@ -111,4 +111,4 @@ impl Verifier {
111111

112112
Ok(predicates_for_credential)
113113
}
114-
}
114+
}

libindy/src/services/ledger/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ impl LedgerService {
113113
info!("build_attrib_request >>> identifier: {:?}, dest: {:?}, hash: {:?}, raw: {:?}, enc: {:?}", identifier, dest, hash, raw, enc);
114114

115115
if raw.is_none() && hash.is_none() && enc.is_none() {
116-
return Err(CommonError::InvalidStructure(format!("Either raw or hash or enc must be specified")));
116+
return Err(CommonError::InvalidStructure("Either raw or hash or enc must be specified".to_string()));
117117
}
118118
if let Some(ref raw) = raw {
119119
serde_json::from_str::<serde_json::Value>(raw)
@@ -138,7 +138,7 @@ impl LedgerService {
138138
info!("build_get_attrib_request >>> identifier: {:?}, dest: {:?}, hash: {:?}, raw: {:?}, enc: {:?}", identifier, dest, hash, raw, enc);
139139

140140
if raw.is_none() && hash.is_none() && enc.is_none() {
141-
return Err(CommonError::InvalidStructure(format!("Either raw or hash or enc must be specified")));
141+
return Err(CommonError::InvalidStructure("Either raw or hash or enc must be specified".to_string()));
142142
}
143143
let operation = GetAttribOperation::new(dest.to_string(), raw, hash, enc);
144144

libindy/src/services/pool/catchup.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ impl CatchupHandler {
7878
//sending ledger status
7979
//TODO not send ledger status directly as response on ping, wait pongs from all nodes?
8080
let ls: LedgerStatus = LedgerStatus {
81-
txnSeqNo: self.nodes.len(),
81+
txnSeqNo: self.merkle_tree.count,
8282
merkleRoot: self.merkle_tree.root_hash().as_slice().to_base58(),
8383
ledgerId: 0,
8484
ppSeqNo: None,
@@ -268,7 +268,7 @@ impl CatchupHandler {
268268
let index = process.pending_reps.get_min_index()?;
269269
{
270270
let &mut (ref mut first_resp, node_idx) = process.pending_reps.get_mut(index)
271-
.ok_or(CommonError::InvalidStructure(format!("Element not Found")))?;
271+
.ok_or(CommonError::InvalidStructure("Element not Found".to_string()))?;
272272
if first_resp.min_tx()? - 1 != process.merkle_tree.count() { break; }
273273

274274
let mut temp_mt = process.merkle_tree.clone();
@@ -289,6 +289,7 @@ impl CatchupHandler {
289289
return Ok(CatchupStepResult::FailedAtNode(node_idx));
290290
}
291291

292+
self.merkle_tree = temp_mt.clone();
292293
PoolWorker::dump_new_txns(&self.pool_name, &vec_to_dump)?;
293294

294295
process.merkle_tree = temp_mt;

0 commit comments

Comments
 (0)