more secure and optimized Round 5 metadata hashing pipeline
Signed-off-by: Uncle Stretch <uncle.stretch@ghostchain.io>
This commit is contained in:
parent
6b0033425c
commit
8abd114a5b
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "ghost-exodus"
|
name = "ghost-exodus"
|
||||||
version = "0.0.18"
|
version = "0.0.19"
|
||||||
description = "Threshold signature generation with DKG included"
|
description = "Threshold signature generation with DKG included"
|
||||||
license.workspace = true
|
license.workspace = true
|
||||||
authors.workspace = true
|
authors.workspace = true
|
||||||
|
|||||||
@ -352,11 +352,8 @@ mod benchmarks {
|
|||||||
dummy_verifying_key,
|
dummy_verifying_key,
|
||||||
).expect("Bounded verifying key should be correct");
|
).expect("Bounded verifying key should be correct");
|
||||||
|
|
||||||
let metadata_hashes = [
|
let metadata_hashes = [dummy_merkle_root.as_ref(), bounded_verifying_key.as_ref()];
|
||||||
SubstrateBlake2Hasher::hash(dummy_merkle_root.as_ref()),
|
let verifying_hash = cumulative_hash::<SubstrateBlake2Hasher, _>(metadata_hashes);
|
||||||
SubstrateBlake2Hasher::hash(bounded_verifying_key.as_ref()),
|
|
||||||
];
|
|
||||||
let verifying_hash = sequential_hash::<SubstrateBlake2Hasher, _>(metadata_hashes);
|
|
||||||
|
|
||||||
let verification_key = (network_curve, dkg_index, verifying_hash);
|
let verification_key = (network_curve, dkg_index, verifying_hash);
|
||||||
let participants = Verifications::<T>::get(verification_key);
|
let participants = Verifications::<T>::get(verification_key);
|
||||||
|
|||||||
@ -31,7 +31,7 @@ use sp_io::hashing::blake2_256;
|
|||||||
|
|
||||||
use ghost_helpers::{
|
use ghost_helpers::{
|
||||||
get_byzantium_quorum_threshold, SubstrateBlake2Hasher,
|
get_byzantium_quorum_threshold, SubstrateBlake2Hasher,
|
||||||
hash_chain::{cumulative_hash, sequential_hash},
|
hash_chain::cumulative_hash,
|
||||||
networks::{NetworkData, NetworkCurve, NetworkType},
|
networks::{NetworkData, NetworkCurve, NetworkType},
|
||||||
bounded_bitmap::{validate_bitmap_sizes, BoundedBitmap},
|
bounded_bitmap::{validate_bitmap_sizes, BoundedBitmap},
|
||||||
};
|
};
|
||||||
@ -40,7 +40,6 @@ use ghost_helpers::{
|
|||||||
use ghost_traits::exodus::IdentifierConverter;
|
use ghost_traits::exodus::IdentifierConverter;
|
||||||
|
|
||||||
use ghost_traits::{
|
use ghost_traits::{
|
||||||
hashing::GhostHasher,
|
|
||||||
bounded_bitmap::{
|
bounded_bitmap::{
|
||||||
BoundedBitmapGenerator, BoundedBitmapWriter, BoundedBitmapReader,
|
BoundedBitmapGenerator, BoundedBitmapWriter, BoundedBitmapReader,
|
||||||
BoundedBitmapIterable,
|
BoundedBitmapIterable,
|
||||||
@ -1254,11 +1253,9 @@ pub mod pallet {
|
|||||||
return Err(Error::<T>::Round5PackageInvalidProof.into());
|
return Err(Error::<T>::Round5PackageInvalidProof.into());
|
||||||
};
|
};
|
||||||
|
|
||||||
let metadata_hashes = [
|
let metadata_hashes = [round5.merkle_root.as_ref(), round5.verifying_key.as_ref()];
|
||||||
SubstrateBlake2Hasher::hash(round5.merkle_root.as_ref()),
|
let verifying_hash = cumulative_hash::<SubstrateBlake2Hasher, _>(metadata_hashes);
|
||||||
SubstrateBlake2Hasher::hash(round5.verifying_key.as_ref()),
|
|
||||||
];
|
|
||||||
let verifying_hash = sequential_hash::<SubstrateBlake2Hasher, _>(metadata_hashes);
|
|
||||||
let state = QualificationDkgState::<T>::get(&network_curve);
|
let state = QualificationDkgState::<T>::get(&network_curve);
|
||||||
ensure!(state.is_fifth_phase(), Error::<T>::DkgWrongRound);
|
ensure!(state.is_fifth_phase(), Error::<T>::DkgWrongRound);
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user