compute round 6 merkle proof depth from highest authority index and preserve proof on retry
Signed-off-by: Uncle Stinky <uncle.stinky@ghostchain.io>
This commit is contained in:
parent
c0286574ac
commit
26372deadb
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "ghost-exodus"
|
||||
version = "0.1.9"
|
||||
version = "0.1.10"
|
||||
description = "Threshold signature generation with DKG included"
|
||||
license.workspace = true
|
||||
authors.workspace = true
|
||||
|
||||
@ -3206,8 +3206,12 @@ impl<T: Config> Pallet<T> {
|
||||
return Err(InvalidTransaction::BadProof);
|
||||
}
|
||||
|
||||
let estimated_proof_count = state
|
||||
.count_ones::<usize>()
|
||||
let leaf_capacity = state
|
||||
.highest_bit::<usize>()
|
||||
.map(|bit| bit.saturating_add(1))
|
||||
.unwrap_or(0);
|
||||
|
||||
let estimated_proof_count = leaf_capacity
|
||||
.next_power_of_two()
|
||||
.trailing_zeros();
|
||||
|
||||
@ -3802,17 +3806,14 @@ impl<T: Config> Pallet<T> {
|
||||
.get_release_block()
|
||||
.saturating_sub(current_block);
|
||||
|
||||
if blocks_remaining <= 2u32.into() {
|
||||
return false;
|
||||
}
|
||||
if blocks_remaining <= 2u32.into() { return false; }
|
||||
|
||||
let elapsed_blocks = dkg_round_period
|
||||
.saturating_sub(blocks_remaining)
|
||||
.saturating_add(One::one());
|
||||
|
||||
let total_authorities = if dkg_phase == DkgPhase::Round0 {
|
||||
let indexes = qualification_authorities.get_indexes();
|
||||
indexes.active_bits_count() as usize
|
||||
QualificationAuthorities::<T>::decode_len(&network_curve).unwrap_or_default()
|
||||
} else {
|
||||
qualification_authorities.count_ones::<usize>()
|
||||
};
|
||||
@ -4835,7 +4836,7 @@ impl<T: Config> Pallet<T> {
|
||||
}
|
||||
|
||||
let Some(DkgStorageEnum::Round5 { secret_share, merkle_proof }) =
|
||||
round_metadata.into_inner_mut() else {
|
||||
round_metadata.into_inner() else {
|
||||
return Ok(ExodusOk::DkgRoundNothingStored(
|
||||
ROUND_NUMBER_6,
|
||||
authority_index,
|
||||
@ -4846,7 +4847,7 @@ impl<T: Config> Pallet<T> {
|
||||
let verifying_share = network_curve
|
||||
.dkg_derive_verifying_share(secret_share)?;
|
||||
|
||||
let owned_merkle_proof = core::mem::take(merkle_proof);
|
||||
let owned_merkle_proof = merkle_proof.clone();
|
||||
let current_dkg_index = qualification_state.get_dkg_index();
|
||||
|
||||
dkg_storage.prepare_signed_call_with_context(
|
||||
|
||||
Loading…
Reference in New Issue
Block a user