Skip to content

Commit

Permalink
[refactor] hyperledger-iroha#2123: use Algorithm for storing digest f…
Browse files Browse the repository at this point in the history
…unction

Signed-off-by: Retssaze <Retssaze@GMail.Com>
  • Loading branch information
Retssaze authored and appetrosyan committed Mar 2, 2023
1 parent c4af68c commit 55618c8
Show file tree
Hide file tree
Showing 8 changed files with 310 additions and 140 deletions.
32 changes: 25 additions & 7 deletions config/iroha_test_config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"PUBLIC_KEY": "ed01201c61faf8fe94e253b93114240394f79a607b7fa55f9e5a41ebec74b88055768b",
"PUBLIC_KEY": {
"digest_function": "ed25519",
"payload": "1c61faf8fe94e253b93114240394f79a607b7fa55f9e5a41ebec74b88055768b"
},
"PRIVATE_KEY": {
"digest_function": "ed25519",
"payload": "282ed9f3cf92811c3818dbc4ae594ed59dc1a2f78e4241e31924e101d6b1fb831c61faf8fe94e253b93114240394f79a607b7fa55f9e5a41ebec74b88055768b"
Expand All @@ -17,19 +20,31 @@
"TRUSTED_PEERS": [
{
"address": "127.0.0.1:1337",
"public_key": "ed01201c61faf8fe94e253b93114240394f79a607b7fa55f9e5a41ebec74b88055768b"
"public_key": {
"digest_function": "ed25519",
"payload": "1c61faf8fe94e253b93114240394f79a607b7fa55f9e5a41ebec74b88055768b"
}
},
{
"address": "127.0.0.1:1338",
"public_key": "ed0120cc25624d62896d3a0bfd8940f928dc2abf27cc57cefeb442aa96d9081aae58a1"
"public_key": {
"digest_function": "secp256k1",
"payload": "cc25624d62896d3a0bfd8940f928dc2abf27cc57cefeb442aa96d9081aae58a1"
}
},
{
"address": "127.0.0.1:1339",
"public_key": "ed0120faca9e8aa83225cb4d16d67f27dd4f93fc30ffa11adc1f5c88fd5495ecc91020"
"public_key": {
"digest_function": "bls_normal",
"payload": "faca9e8aa83225cb4d16d67f27dd4f93fc30ffa11adc1f5c88fd5495ecc91020"
}
},
{
"address": "127.0.0.1:1340",
"public_key": "ed01208e351a70b6a603ed285d666b8d689b680865913ba03ce29fb7d13a166c4e7f1f"
"public_key": {
"digest_function": "bls_small",
"payload": "8e351a70b6a603ed285d666b8d689b680865913ba03ce29fb7d13a166c4e7f1f"
}
}
],
"COMMIT_TIME_LIMIT_MS": 2000,
Expand Down Expand Up @@ -70,7 +85,10 @@
"TERMINAL_COLORS": true
},
"GENESIS": {
"ACCOUNT_PUBLIC_KEY": "ed01204cffd0ee429b1bdd36b3910ec570852b8bb63f18750341772fb46bc856c5caaf",
"ACCOUNT_PUBLIC_KEY": {
"digest_function": "ed25519",
"payload": "4cffd0ee429b1bdd36b3910ec570852b8bb63f18750341772fb46bc856c5caaf"
},
"ACCOUNT_PRIVATE_KEY": {
"digest_function": "ed25519",
"payload": "d748e18ce60cb30dea3e73c9019b7af45a8d465e3d71bcc9a5ef99a008205e534cffd0ee429b1bdd36b3910ec570852b8bb63f18750341772fb46bc856c5caaf"
Expand Down Expand Up @@ -115,4 +133,4 @@
"MAX_RETRY_DELAY_EXPONENT": 4,
"FILE": null
}
}
}
11 changes: 7 additions & 4 deletions config/src/iroha.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,15 +172,18 @@ mod tests {
/// Key-pair used for proptests generation
#[allow(clippy::expect_used)]
pub fn placeholder_keypair() -> KeyPair {
let public_key = "ed01201c61faf8fe94e253b93114240394f79a607b7fa55f9e5a41ebec74b88055768b"
.parse()
.expect("Public key not in mulithash format");
let private_key = PrivateKey::from_hex(
Algorithm::Ed25519,
"282ed9f3cf92811c3818dbc4ae594ed59dc1a2f78e4241e31924e101d6b1fb831c61faf8fe94e253b93114240394f79a607b7fa55f9e5a41ebec74b88055768b"
).expect("Private key not hex encoded");

KeyPair::new(public_key, private_key).expect("Key pair mismatch")
KeyPair::new(
"ed01201c61faf8fe94e253b93114240394f79a607b7fa55f9e5a41ebec74b88055768b"
.parse()
.expect("Public key not in mulithash format"),
private_key,
)
.expect("Key pair mismatch")
}

fn arb_keys() -> BoxedStrategy<(Option<PublicKey>, Option<PrivateKey>)> {
Expand Down
5 changes: 4 additions & 1 deletion configs/client_cli/config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"PUBLIC_KEY": "ed01207233bfc89dcbd68c19fde6ce6158225298ec1131b6a130d1aeb454c1ab5183c0",
"PUBLIC_KEY": {
"digest_function": "ed25519",
"payload": "7233bfc89dcbd68c19fde6ce6158225298ec1131b6a130d1aeb454c1ab5183c0"
},
"PRIVATE_KEY": {
"digest_function": "ed25519",
"payload": "9ac47abf59b356e0bd7dcbbbb4dec080e302156a48ca907e47cb6aea1d32719e7233bfc89dcbd68c19fde6ce6158225298ec1131b6a130d1aeb454c1ab5183c0"
Expand Down
15 changes: 12 additions & 3 deletions configs/peer/genesis.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@
"NewAccount": {
"id": "alice@wonderland",
"signatories": [
"ed01207233bfc89dcbd68c19fde6ce6158225298ec1131b6a130d1aeb454c1ab5183c0"
{
"digest_function": "ed25519",
"payload": "7233bfc89dcbd68c19fde6ce6158225298ec1131b6a130d1aeb454c1ab5183c0"
}
],
"metadata": {
"key": {
Expand All @@ -35,7 +38,10 @@
"NewAccount": {
"id": "bob@wonderland",
"signatories": [
"ed01207233bfc89dcbd68c19fde6ce6158225298ec1131b6a130d1aeb454c1ab5183c0"
{
"digest_function": "ed25519",
"payload": "7233bfc89dcbd68c19fde6ce6158225298ec1131b6a130d1aeb454c1ab5183c0"
}
],
"metadata": {
"key": {
Expand Down Expand Up @@ -69,7 +75,10 @@
"NewAccount": {
"id": "carpenter@garden_of_live_flowers",
"signatories": [
"ed01207233bfc89dcbd68c19fde6ce6158225298ec1131b6a130d1aeb454c1ab5183c0"
{
"digest_function": "ed25519",
"payload": "7233bfc89dcbd68c19fde6ce6158225298ec1131b6a130d1aeb454c1ab5183c0"
}
],
"metadata": {}
}
Expand Down
1 change: 1 addition & 0 deletions core/src/sumeragi/main_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1159,3 +1159,4 @@ fn early_return(
Err(TryRecvError::Empty) => Ok(()),
}
}

Loading

0 comments on commit 55618c8

Please sign in to comment.