Compare commits

..

No commits in common. "main" and "pallet-networks" have entirely different histories.

26 changed files with 611 additions and 984 deletions

12
Cargo.lock generated
View File

@ -1195,7 +1195,7 @@ dependencies = [
[[package]] [[package]]
name = "casper-runtime" name = "casper-runtime"
version = "4.0.20" version = "4.0.15"
dependencies = [ dependencies = [
"casper-runtime-constants", "casper-runtime-constants",
"frame-benchmarking", "frame-benchmarking",
@ -3685,7 +3685,7 @@ dependencies = [
[[package]] [[package]]
name = "ghost-exodus" name = "ghost-exodus"
version = "0.1.7" version = "0.1.1"
dependencies = [ dependencies = [
"chacha20poly1305", "chacha20poly1305",
"frame-benchmarking", "frame-benchmarking",
@ -3737,7 +3737,7 @@ dependencies = [
[[package]] [[package]]
name = "ghost-governance" name = "ghost-governance"
version = "0.3.11" version = "0.3.10"
dependencies = [ dependencies = [
"frame-benchmarking", "frame-benchmarking",
"frame-support", "frame-support",
@ -3762,7 +3762,7 @@ dependencies = [
[[package]] [[package]]
name = "ghost-helpers" name = "ghost-helpers"
version = "0.0.16" version = "0.0.14"
dependencies = [ dependencies = [
"frame-support", "frame-support",
"ghost-traits", "ghost-traits",
@ -4090,7 +4090,7 @@ dependencies = [
[[package]] [[package]]
name = "ghost-traits" name = "ghost-traits"
version = "0.4.10" version = "0.4.9"
dependencies = [ dependencies = [
"frame-support", "frame-support",
"frost-core", "frost-core",
@ -4114,7 +4114,7 @@ dependencies = [
[[package]] [[package]]
name = "ghost-weaver" name = "ghost-weaver"
version = "0.0.27" version = "0.0.16"
dependencies = [ dependencies = [
"frame-benchmarking", "frame-benchmarking",
"frame-support", "frame-support",

View File

@ -1,6 +1,6 @@
[package] [package]
name = "ghost-exodus" name = "ghost-exodus"
version = "0.1.7" version = "0.1.5"
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

View File

@ -1866,17 +1866,19 @@ pub mod pallet {
let threshold_reached = min_threshold <= dkg_qualification.count_ones::<AuthIndex>(); let threshold_reached = min_threshold <= dkg_qualification.count_ones::<AuthIndex>();
let is_dkg_phase_vacant = dkg_qualification.is_dkg_vacant(); let is_dkg_phase_vacant = dkg_qualification.is_dkg_vacant();
let blocks_delay = if threshold_reached || is_dkg_phase_vacant { if threshold_reached || is_dkg_phase_vacant {
dkg_qualification.next_phase(); dkg_qualification.next_phase();
T::DkgRoundPeriod::get().unique_saturated_into()
} else { } else {
dkg_qualification.restart_dkg(); dkg_qualification.restart_dkg();
}
let blocks_delay = if threshold_reached && !is_dkg_phase_vacant {
T::DkgRoundPeriod::get().unique_saturated_into()
} else {
BLOCKS_FOR_DKG_RESET.unique_saturated_into() BLOCKS_FOR_DKG_RESET.unique_saturated_into()
}; };
let next_release_block = current_block let next_release_block = release_block.saturating_add(blocks_delay);
.max(release_block)
.saturating_add(blocks_delay);
dkg_qualification.set_release_block(next_release_block); dkg_qualification.set_release_block(next_release_block);
QualificationDkgState::<T>::insert(&network_curve, dkg_qualification); QualificationDkgState::<T>::insert(&network_curve, dkg_qualification);

View File

@ -507,12 +507,22 @@ fn run_succesfull_dkg_session_partially(
tx_pool_state: &std::sync::Arc<parking_lot::RwLock<sp_core::offchain::testing::PoolState>>, tx_pool_state: &std::sync::Arc<parking_lot::RwLock<sp_core::offchain::testing::PoolState>>,
raw_authorities: &[u64], raw_authorities: &[u64],
curve: NetworkCurve, curve: NetworkCurve,
) { ) -> (u64, u64) {
let authorities: Vec<UintAuthorityId> = raw_authorities.iter().map(|&id| id.into()).collect(); let authorities: Vec<UintAuthorityId> = raw_authorities.iter().map(|&id| id.into()).collect();
let prev_dkg_index = ext.execute_with(|| QualificationDkgState::<Runtime>::get(curve).get_dkg_index()); let prev_dkg_index = ext.execute_with(|| QualificationDkgState::<Runtime>::get(curve).get_dkg_index());
ext.execute_with(|| Exodus::start_dkg_qualification(authorities, NetworkCurve::iter())); ext.execute_with(|| Exodus::start_dkg_qualification(authorities, NetworkCurve::iter()));
let dkg_index = ext.execute_with(|| QualificationDkgState::<Runtime>::get(curve).get_dkg_index()); let dkg_index = ext.execute_with(|| QualificationDkgState::<Runtime>::get(curve).get_dkg_index());
let (start_block, round_delay) = ext.execute_with(|| {
let round_delay = <<Runtime as Config>::DkgRoundPeriod as frame_support::traits::Get<
frame_system::pallet_prelude::BlockNumberFor<Runtime>
>>::get();
let start_block = System::block_number();
(start_block, round_delay)
});
assert_eq!(prev_dkg_index + 1, dkg_index); assert_eq!(prev_dkg_index + 1, dkg_index);
ext.execute_with(|| { ext.execute_with(|| {
@ -520,6 +530,18 @@ fn run_succesfull_dkg_session_partially(
let max_authority_index = raw_authorities.iter().max().cloned().unwrap_or_default() as usize; let max_authority_index = raw_authorities.iter().max().cloned().unwrap_or_default() as usize;
let padded_participants = max_authority_index.saturating_add(1); let padded_participants = max_authority_index.saturating_add(1);
let bitmask_len = padded_participants.div_ceil(8);
let mut key_members_raw = vec![0u8; bitmask_len];
for &authority in raw_authorities.iter() {
let global_index = authority as usize;
let byte_index = global_index >> 3;
let bit_index = global_index & 7;
if let Some(byte) = key_members_raw.get_mut(byte_index) {
*byte |= 1 << bit_index;
}
}
let dummy_key_members = ParticipantsBitmap::<Runtime>::empty(padded_participants); let dummy_key_members = ParticipantsBitmap::<Runtime>::empty(padded_participants);
let dummy_oversized_bitmap = ParticipantsBitmap::<Runtime>::all_ones(max_authorities_len); let dummy_oversized_bitmap = ParticipantsBitmap::<Runtime>::all_ones(max_authorities_len);
@ -572,6 +594,8 @@ fn run_succesfull_dkg_session_partially(
} }
run_to_next_round(ext, curve); run_to_next_round(ext, curve);
(start_block, round_delay)
} }
fn run_initial_dkg_session(raw_authorities: &[u64], curve: NetworkCurve) -> ( fn run_initial_dkg_session(raw_authorities: &[u64], curve: NetworkCurve) -> (
@ -583,7 +607,8 @@ fn run_initial_dkg_session(raw_authorities: &[u64], curve: NetworkCurve) -> (
let prev_verifying_key = ext.execute_with(|| ActiveVerifyingKey::<Runtime>::get(curve)); let prev_verifying_key = ext.execute_with(|| ActiveVerifyingKey::<Runtime>::get(curve));
assert!(prev_verifying_key.is_empty()); assert!(prev_verifying_key.is_empty());
let _ = run_succesfull_dkg_session_partially(&mut ext, &tx_pool_state, &raw_authorities, curve); let (start_block, round_delay) =
run_succesfull_dkg_session_partially(&mut ext, &tx_pool_state, &raw_authorities, curve);
run_to_next_round(&mut ext, curve); run_to_next_round(&mut ext, curve);
@ -598,6 +623,7 @@ fn run_initial_dkg_session(raw_authorities: &[u64], curve: NetworkCurve) -> (
assert!(state.contains_index(member)); assert!(state.contains_index(member));
} }
assert_eq!(state.get_release_block(), start_block + round_delay * 8 + 2 * BLOCKS_FOR_DKG_RESET);
assert_eq!(state.get_dkg_index(), 1); assert_eq!(state.get_dkg_index(), 1);
assert_eq!(state.get_phase(), DkgPhase::Finalized); assert_eq!(state.get_phase(), DkgPhase::Finalized);
@ -631,6 +657,7 @@ fn run_dkg_session(
}); });
let next_dkg_index = dkg_index.saturating_add(1); let next_dkg_index = dkg_index.saturating_add(1);
let (start_block, round_delay) =
run_succesfull_dkg_session_partially(ext, tx_pool_state, &raw_authorities, curve); run_succesfull_dkg_session_partially(ext, tx_pool_state, &raw_authorities, curve);
let total_validators = prev_authorities.len(); let total_validators = prev_authorities.len();
@ -716,7 +743,7 @@ fn run_dkg_session(
let member = authority as AuthIndex; let member = authority as AuthIndex;
assert!(state.contains_index(member)); assert!(state.contains_index(member));
} }
assert_eq!(state.get_release_block(), start_block + round_delay * 8 + 2 * BLOCKS_FOR_DKG_RESET);
assert_eq!(state.get_dkg_index(), next_dkg_index); assert_eq!(state.get_dkg_index(), next_dkg_index);
assert_eq!(state.get_phase(), DkgPhase::Finalized); assert_eq!(state.get_phase(), DkgPhase::Finalized);

View File

@ -16,7 +16,7 @@
//! Autogenerated weights for `ghost_exodus` //! Autogenerated weights for `ghost_exodus`
//! //!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2026-10-29, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! DATE: 2026-09-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000` //! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz` //! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz`
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024 //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024
@ -63,30 +63,34 @@ pub trait WeightInfo {
/// Weight functions for `ghost_exodus`. /// Weight functions for `ghost_exodus`.
impl WeightInfo for () { impl WeightInfo for () {
/// Storage: `GhostNetworks::NetworkTypes` (r:1 w:0) /// Storage: `GhostNetworks::NetworkCurves` (r:1 w:0)
/// Proof: `GhostNetworks::NetworkTypes` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostNetworks::NetworkCurves` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::QualificationDkgState` (r:1 w:1) /// Storage: `GhostExodus::QualificationDkgState` (r:1 w:1)
/// Proof: `GhostExodus::QualificationDkgState` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::QualificationDkgState` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::QualificationAuthorities` (r:1 w:0) /// Storage: `GhostExodus::QualificationAuthorities` (r:1 w:0)
/// Proof: `GhostExodus::QualificationAuthorities` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::QualificationAuthorities` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::ExodusActivity` (r:1 w:1)
/// Proof: `GhostExodus::ExodusActivity` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::Round0Packages` (r:0 w:1) /// Storage: `GhostExodus::Round0Packages` (r:0 w:1)
/// Proof: `GhostExodus::Round0Packages` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::Round0Packages` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn register_round0_package() -> Weight { fn register_round0_package() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `365` // Measured: `351`
// Estimated: `3830` // Estimated: `3816`
// Minimum execution time: 240_843_000 picoseconds. // Minimum execution time: 240_813_000 picoseconds.
Weight::from_parts(243_855_000, 0) Weight::from_parts(243_523_000, 0)
.saturating_add(Weight::from_parts(0, 3830)) .saturating_add(Weight::from_parts(0, 3816))
.saturating_add(RocksDbWeight::get().reads(4)) .saturating_add(RocksDbWeight::get().reads(4))
.saturating_add(RocksDbWeight::get().writes(2)) .saturating_add(RocksDbWeight::get().writes(3))
} }
/// Storage: `GhostNetworks::NetworkTypes` (r:1 w:0) /// Storage: `GhostNetworks::NetworkCurves` (r:1 w:0)
/// Proof: `GhostNetworks::NetworkTypes` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostNetworks::NetworkCurves` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::QualificationDkgState` (r:1 w:0) /// Storage: `GhostExodus::QualificationDkgState` (r:1 w:0)
/// Proof: `GhostExodus::QualificationDkgState` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::QualificationDkgState` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::QualificationAuthorities` (r:1 w:0) /// Storage: `GhostExodus::QualificationAuthorities` (r:1 w:0)
/// Proof: `GhostExodus::QualificationAuthorities` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::QualificationAuthorities` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::ExodusActivity` (r:1 w:1)
/// Proof: `GhostExodus::ExodusActivity` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::Round0Packages` (r:1 w:0) /// Storage: `GhostExodus::Round0Packages` (r:1 w:0)
/// Proof: `GhostExodus::Round0Packages` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::Round0Packages` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::Round1Packages` (r:1 w:1) /// Storage: `GhostExodus::Round1Packages` (r:1 w:1)
@ -94,109 +98,119 @@ impl WeightInfo for () {
/// The range of component `c` is `[4, 300]`. /// The range of component `c` is `[4, 300]`.
fn register_round1_package(c: u32, ) -> Weight { fn register_round1_package(c: u32, ) -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `405 + c * (32 ±0)` // Measured: `391 + c * (32 ±0)`
// Estimated: `3870 + c * (32 ±0)` // Estimated: `3856 + c * (32 ±0)`
// Minimum execution time: 1_349_108_000 picoseconds. // Minimum execution time: 1_356_791_000 picoseconds.
Weight::from_parts(1_224_956_354, 0) Weight::from_parts(1_221_760_215, 0)
.saturating_add(Weight::from_parts(0, 3870)) .saturating_add(Weight::from_parts(0, 3856))
// Standard Error: 14_930 // Standard Error: 16_481
.saturating_add(Weight::from_parts(33_204_477, 0).saturating_mul(c.into())) .saturating_add(Weight::from_parts(33_163_393, 0).saturating_mul(c.into()))
.saturating_add(RocksDbWeight::get().reads(5)) .saturating_add(RocksDbWeight::get().reads(6))
.saturating_add(RocksDbWeight::get().writes(1)) .saturating_add(RocksDbWeight::get().writes(2))
.saturating_add(Weight::from_parts(0, 32).saturating_mul(c.into())) .saturating_add(Weight::from_parts(0, 32).saturating_mul(c.into()))
} }
/// Storage: `GhostNetworks::NetworkTypes` (r:1 w:0) /// Storage: `GhostNetworks::NetworkCurves` (r:1 w:0)
/// Proof: `GhostNetworks::NetworkTypes` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostNetworks::NetworkCurves` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::QualificationDkgState` (r:1 w:0) /// Storage: `GhostExodus::QualificationDkgState` (r:1 w:0)
/// Proof: `GhostExodus::QualificationDkgState` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::QualificationDkgState` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::QualificationAuthorities` (r:1 w:0) /// Storage: `GhostExodus::QualificationAuthorities` (r:1 w:0)
/// Proof: `GhostExodus::QualificationAuthorities` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::QualificationAuthorities` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::ExodusActivity` (r:1 w:1)
/// Proof: `GhostExodus::ExodusActivity` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::Round2Packages` (r:1 w:1) /// Storage: `GhostExodus::Round2Packages` (r:1 w:1)
/// Proof: `GhostExodus::Round2Packages` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::Round2Packages` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// The range of component `c` is `[1, 300]`. /// The range of component `c` is `[1, 37]`.
fn register_encrypted_round2_packages(c: u32, ) -> Weight { fn register_encrypted_round2_packages(c: u32, ) -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `332 + c * (32 ±0)` // Measured: `317 + c * (257 ±0)`
// Estimated: `3797 + c * (32 ±0)` // Estimated: `3783 + c * (257 ±0)`
// Minimum execution time: 245_305_000 picoseconds. // Minimum execution time: 254_590_000 picoseconds.
Weight::from_parts(253_863_353, 0) Weight::from_parts(258_091_105, 0)
.saturating_add(Weight::from_parts(0, 3797)) .saturating_add(Weight::from_parts(0, 3783))
// Standard Error: 3_527 // Standard Error: 25_082
.saturating_add(Weight::from_parts(810_623, 0).saturating_mul(c.into())) .saturating_add(Weight::from_parts(6_595_878, 0).saturating_mul(c.into()))
.saturating_add(RocksDbWeight::get().reads(4)) .saturating_add(RocksDbWeight::get().reads(5))
.saturating_add(RocksDbWeight::get().writes(1)) .saturating_add(RocksDbWeight::get().writes(2))
.saturating_add(Weight::from_parts(0, 32).saturating_mul(c.into())) .saturating_add(Weight::from_parts(0, 257).saturating_mul(c.into()))
} }
/// Storage: `GhostNetworks::NetworkTypes` (r:1 w:0) /// Storage: `GhostNetworks::NetworkCurves` (r:1 w:0)
/// Proof: `GhostNetworks::NetworkTypes` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostNetworks::NetworkCurves` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::QualificationDkgState` (r:1 w:0) /// Storage: `GhostExodus::QualificationDkgState` (r:1 w:0)
/// Proof: `GhostExodus::QualificationDkgState` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::QualificationDkgState` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::QualificationAuthorities` (r:1 w:0) /// Storage: `GhostExodus::QualificationAuthorities` (r:1 w:0)
/// Proof: `GhostExodus::QualificationAuthorities` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::QualificationAuthorities` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::ExodusActivity` (r:1 w:1)
/// Proof: `GhostExodus::ExodusActivity` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::Complaints` (r:1 w:1) /// Storage: `GhostExodus::Complaints` (r:1 w:1)
/// Proof: `GhostExodus::Complaints` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::Complaints` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// The range of component `c` is `[1, 300]`. /// The range of component `c` is `[1, 37]`.
fn register_round3_complaints(c: u32, ) -> Weight { fn register_round3_complaints(c: u32, ) -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `332 + c * (32 ±0)` // Measured: `317 + c * (257 ±0)`
// Estimated: `3797 + c * (32 ±0)` // Estimated: `3783 + c * (257 ±0)`
// Minimum execution time: 238_391_000 picoseconds. // Minimum execution time: 240_888_000 picoseconds.
Weight::from_parts(238_937_380, 0) Weight::from_parts(245_480_975, 0)
.saturating_add(Weight::from_parts(0, 3797)) .saturating_add(Weight::from_parts(0, 3783))
// Standard Error: 1_789 // Standard Error: 13_733
.saturating_add(Weight::from_parts(39_316, 0).saturating_mul(c.into())) .saturating_add(Weight::from_parts(371_161, 0).saturating_mul(c.into()))
.saturating_add(RocksDbWeight::get().reads(4)) .saturating_add(RocksDbWeight::get().reads(5))
.saturating_add(RocksDbWeight::get().writes(1)) .saturating_add(RocksDbWeight::get().writes(2))
.saturating_add(Weight::from_parts(0, 32).saturating_mul(c.into())) .saturating_add(Weight::from_parts(0, 257).saturating_mul(c.into()))
} }
/// Storage: `GhostNetworks::NetworkTypes` (r:1 w:0) /// Storage: `GhostNetworks::NetworkCurves` (r:1 w:0)
/// Proof: `GhostNetworks::NetworkTypes` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostNetworks::NetworkCurves` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::QualificationDkgState` (r:1 w:0) /// Storage: `GhostExodus::QualificationDkgState` (r:1 w:0)
/// Proof: `GhostExodus::QualificationDkgState` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::QualificationDkgState` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::QualificationAuthorities` (r:1 w:0) /// Storage: `GhostExodus::QualificationAuthorities` (r:1 w:0)
/// Proof: `GhostExodus::QualificationAuthorities` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::QualificationAuthorities` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::ExodusActivity` (r:1 w:1)
/// Proof: `GhostExodus::ExodusActivity` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::Justifications` (r:1 w:1) /// Storage: `GhostExodus::Justifications` (r:1 w:1)
/// Proof: `GhostExodus::Justifications` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::Justifications` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// The range of component `c` is `[1, 300]`. /// The range of component `c` is `[1, 37]`.
fn register_round4_justifications(c: u32, ) -> Weight { fn register_round4_justifications(c: u32, ) -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `332 + c * (32 ±0)` // Measured: `317 + c * (257 ±0)`
// Estimated: `3797 + c * (32 ±0)` // Estimated: `3783 + c * (257 ±0)`
// Minimum execution time: 245_916_000 picoseconds. // Minimum execution time: 251_521_000 picoseconds.
Weight::from_parts(251_070_206, 0) Weight::from_parts(253_053_636, 0)
.saturating_add(Weight::from_parts(0, 3797)) .saturating_add(Weight::from_parts(0, 3783))
// Standard Error: 2_152 // Standard Error: 14_691
.saturating_add(Weight::from_parts(508_508, 0).saturating_mul(c.into())) .saturating_add(Weight::from_parts(4_101_872, 0).saturating_mul(c.into()))
.saturating_add(RocksDbWeight::get().reads(4)) .saturating_add(RocksDbWeight::get().reads(5))
.saturating_add(RocksDbWeight::get().writes(1)) .saturating_add(RocksDbWeight::get().writes(2))
.saturating_add(Weight::from_parts(0, 32).saturating_mul(c.into())) .saturating_add(Weight::from_parts(0, 257).saturating_mul(c.into()))
} }
/// Storage: `GhostNetworks::NetworkTypes` (r:1 w:0) /// Storage: `GhostNetworks::NetworkCurves` (r:1 w:0)
/// Proof: `GhostNetworks::NetworkTypes` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostNetworks::NetworkCurves` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::QualificationDkgState` (r:1 w:0) /// Storage: `GhostExodus::QualificationDkgState` (r:1 w:0)
/// Proof: `GhostExodus::QualificationDkgState` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::QualificationDkgState` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::QualificationAuthorities` (r:1 w:0) /// Storage: `GhostExodus::QualificationAuthorities` (r:1 w:0)
/// Proof: `GhostExodus::QualificationAuthorities` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::QualificationAuthorities` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::ExodusActivity` (r:1 w:1)
/// Proof: `GhostExodus::ExodusActivity` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::Verifications` (r:1 w:1) /// Storage: `GhostExodus::Verifications` (r:1 w:1)
/// Proof: `GhostExodus::Verifications` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::Verifications` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::VerifyingKeyConsensus` (r:1 w:1) /// Storage: `GhostExodus::VerifyingKeyConsensus` (r:1 w:1)
/// Proof: `GhostExodus::VerifyingKeyConsensus` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::VerifyingKeyConsensus` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn register_round5_verifying_package() -> Weight { fn register_round5_verifying_package() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `462` // Measured: `448`
// Estimated: `3927` // Estimated: `3913`
// Minimum execution time: 271_654_000 picoseconds. // Minimum execution time: 265_187_000 picoseconds.
Weight::from_parts(286_394_000, 0) Weight::from_parts(269_124_000, 0)
.saturating_add(Weight::from_parts(0, 3927)) .saturating_add(Weight::from_parts(0, 3913))
.saturating_add(RocksDbWeight::get().reads(5)) .saturating_add(RocksDbWeight::get().reads(6))
.saturating_add(RocksDbWeight::get().writes(2)) .saturating_add(RocksDbWeight::get().writes(3))
} }
/// Storage: `GhostNetworks::NetworkTypes` (r:1 w:0) /// Storage: `GhostNetworks::NetworkCurves` (r:1 w:0)
/// Proof: `GhostNetworks::NetworkTypes` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostNetworks::NetworkCurves` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::QualificationDkgState` (r:1 w:0) /// Storage: `GhostExodus::QualificationDkgState` (r:1 w:0)
/// Proof: `GhostExodus::QualificationDkgState` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::QualificationDkgState` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::QualificationAuthorities` (r:1 w:0) /// Storage: `GhostExodus::QualificationAuthorities` (r:1 w:0)
/// Proof: `GhostExodus::QualificationAuthorities` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::QualificationAuthorities` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::ExodusActivity` (r:1 w:1)
/// Proof: `GhostExodus::ExodusActivity` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::VerifyingKeyConsensus` (r:1 w:0) /// Storage: `GhostExodus::VerifyingKeyConsensus` (r:1 w:0)
/// Proof: `GhostExodus::VerifyingKeyConsensus` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::VerifyingKeyConsensus` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::VerifyingShares` (r:1 w:1) /// Storage: `GhostExodus::VerifyingShares` (r:1 w:1)
@ -207,18 +221,18 @@ impl WeightInfo for () {
fn register_round6_public_share_package(c: u32, ) -> Weight { fn register_round6_public_share_package(c: u32, ) -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `0 + c * (770 ±0)` // Measured: `0 + c * (770 ±0)`
// Estimated: `1698 + c * (1019 ±27)` // Estimated: `1551 + c * (1019 ±27)`
// Minimum execution time: 283_863_000 picoseconds. // Minimum execution time: 284_558_000 picoseconds.
Weight::from_parts(286_691_978, 0) Weight::from_parts(284_117_484, 0)
.saturating_add(Weight::from_parts(0, 1698)) .saturating_add(Weight::from_parts(0, 1551))
// Standard Error: 85_685 // Standard Error: 74_361
.saturating_add(Weight::from_parts(2_854_037, 0).saturating_mul(c.into())) .saturating_add(Weight::from_parts(3_551_271, 0).saturating_mul(c.into()))
.saturating_add(RocksDbWeight::get().reads(6)) .saturating_add(RocksDbWeight::get().reads(7))
.saturating_add(RocksDbWeight::get().writes(2)) .saturating_add(RocksDbWeight::get().writes(3))
.saturating_add(Weight::from_parts(0, 1019).saturating_mul(c.into())) .saturating_add(Weight::from_parts(0, 1019).saturating_mul(c.into()))
} }
/// Storage: `GhostNetworks::NetworkTypes` (r:1 w:0) /// Storage: `GhostNetworks::NetworkCurves` (r:1 w:0)
/// Proof: `GhostNetworks::NetworkTypes` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostNetworks::NetworkCurves` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::QualificationDkgState` (r:1 w:0) /// Storage: `GhostExodus::QualificationDkgState` (r:1 w:0)
/// Proof: `GhostExodus::QualificationDkgState` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::QualificationDkgState` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::ActiveDkgAuthorities` (r:1 w:0) /// Storage: `GhostExodus::ActiveDkgAuthorities` (r:1 w:0)
@ -229,22 +243,24 @@ impl WeightInfo for () {
/// Proof: `GhostExodus::ExodusRequests` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::ExodusRequests` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::RoastSessions` (r:1 w:1) /// Storage: `GhostExodus::RoastSessions` (r:1 w:1)
/// Proof: `GhostExodus::RoastSessions` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::RoastSessions` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::ExodusActivity` (r:1 w:1)
/// Proof: `GhostExodus::ExodusActivity` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::RoastSessionStates` (r:1 w:1) /// Storage: `GhostExodus::RoastSessionStates` (r:1 w:1)
/// Proof: `GhostExodus::RoastSessionStates` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::RoastSessionStates` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::NonceCommitments` (r:0 w:1) /// Storage: `GhostExodus::NonceCommitments` (r:0 w:1)
/// Proof: `GhostExodus::NonceCommitments` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::NonceCommitments` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn register_nonce_commitment() -> Weight { fn register_nonce_commitment() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `633` // Measured: `627`
// Estimated: `4098` // Estimated: `4092`
// Minimum execution time: 369_666_000 picoseconds. // Minimum execution time: 315_066_000 picoseconds.
Weight::from_parts(373_163_000, 0) Weight::from_parts(318_561_000, 0)
.saturating_add(Weight::from_parts(0, 4098)) .saturating_add(Weight::from_parts(0, 4092))
.saturating_add(RocksDbWeight::get().reads(8)) .saturating_add(RocksDbWeight::get().reads(8))
.saturating_add(RocksDbWeight::get().writes(4)) .saturating_add(RocksDbWeight::get().writes(5))
} }
/// Storage: `GhostNetworks::NetworkTypes` (r:1 w:0) /// Storage: `GhostNetworks::NetworkCurves` (r:1 w:0)
/// Proof: `GhostNetworks::NetworkTypes` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostNetworks::NetworkCurves` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::QualificationDkgState` (r:1 w:0) /// Storage: `GhostExodus::QualificationDkgState` (r:1 w:0)
/// Proof: `GhostExodus::QualificationDkgState` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::QualificationDkgState` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::ActiveDkgAuthorities` (r:1 w:0) /// Storage: `GhostExodus::ActiveDkgAuthorities` (r:1 w:0)
@ -253,6 +269,8 @@ impl WeightInfo for () {
/// Proof: `GhostExodus::ActiveAuthorities` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::ActiveAuthorities` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::RoastSessions` (r:1 w:0) /// Storage: `GhostExodus::RoastSessions` (r:1 w:0)
/// Proof: `GhostExodus::RoastSessions` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::RoastSessions` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::ExodusActivity` (r:1 w:1)
/// Proof: `GhostExodus::ExodusActivity` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::ExodusRequests` (r:1 w:0) /// Storage: `GhostExodus::ExodusRequests` (r:1 w:0)
/// Proof: `GhostExodus::ExodusRequests` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::ExodusRequests` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::GroupCommitters` (r:1 w:1) /// Storage: `GhostExodus::GroupCommitters` (r:1 w:1)
@ -263,16 +281,16 @@ impl WeightInfo for () {
/// Proof: `GhostExodus::GroupCommitmentsConsensus` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::GroupCommitmentsConsensus` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn register_group_commitment() -> Weight { fn register_group_commitment() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `1032` // Measured: `992`
// Estimated: `4495` // Estimated: `4457`
// Minimum execution time: 339_569_000 picoseconds. // Minimum execution time: 338_644_000 picoseconds.
Weight::from_parts(341_788_000, 0) Weight::from_parts(343_954_000, 0)
.saturating_add(Weight::from_parts(0, 4495)) .saturating_add(Weight::from_parts(0, 4457))
.saturating_add(RocksDbWeight::get().reads(9)) .saturating_add(RocksDbWeight::get().reads(10))
.saturating_add(RocksDbWeight::get().writes(3)) .saturating_add(RocksDbWeight::get().writes(4))
} }
/// Storage: `GhostNetworks::NetworkTypes` (r:1 w:0) /// Storage: `GhostNetworks::NetworkCurves` (r:1 w:0)
/// Proof: `GhostNetworks::NetworkTypes` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostNetworks::NetworkCurves` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::QualificationDkgState` (r:1 w:0) /// Storage: `GhostExodus::QualificationDkgState` (r:1 w:0)
/// Proof: `GhostExodus::QualificationDkgState` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::QualificationDkgState` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::ActiveDkgAuthorities` (r:1 w:0) /// Storage: `GhostExodus::ActiveDkgAuthorities` (r:1 w:0)
@ -281,6 +299,8 @@ impl WeightInfo for () {
/// Proof: `GhostExodus::ActiveAuthorities` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::ActiveAuthorities` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::RoastSessions` (r:1 w:1) /// Storage: `GhostExodus::RoastSessions` (r:1 w:1)
/// Proof: `GhostExodus::RoastSessions` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::RoastSessions` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::ExodusActivity` (r:1 w:1)
/// Proof: `GhostExodus::ExodusActivity` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::GroupCommitmentsConsensus` (r:1 w:1) /// Storage: `GhostExodus::GroupCommitmentsConsensus` (r:1 w:1)
/// Proof: `GhostExodus::GroupCommitmentsConsensus` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::GroupCommitmentsConsensus` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::ExodusRequests` (r:1 w:1) /// Storage: `GhostExodus::ExodusRequests` (r:1 w:1)
@ -303,13 +323,13 @@ impl WeightInfo for () {
/// Proof: `GhostExodus::CounterForExodusRequests` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::CounterForExodusRequests` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
fn register_signature_share() -> Weight { fn register_signature_share() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `11337` // Measured: `11299`
// Estimated: `14802` // Estimated: `14764`
// Minimum execution time: 4_046_065_000 picoseconds. // Minimum execution time: 3_968_938_000 picoseconds.
Weight::from_parts(4_059_064_000, 0) Weight::from_parts(3_975_088_000, 0)
.saturating_add(Weight::from_parts(0, 14802)) .saturating_add(Weight::from_parts(0, 14764))
.saturating_add(RocksDbWeight::get().reads(14)) .saturating_add(RocksDbWeight::get().reads(15))
.saturating_add(RocksDbWeight::get().writes(8)) .saturating_add(RocksDbWeight::get().writes(9))
} }
/// Storage: `GhostNetworks::Networks` (r:1 w:0) /// Storage: `GhostNetworks::Networks` (r:1 w:0)
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
@ -319,17 +339,17 @@ impl WeightInfo for () {
/// Proof: `GhostNetworks::NetworkImbalance` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Proof: `GhostNetworks::NetworkImbalance` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::QualificationDkgState` (r:1 w:0) /// Storage: `GhostExodus::QualificationDkgState` (r:1 w:0)
/// Proof: `GhostExodus::QualificationDkgState` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::QualificationDkgState` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::CurrentExodusSessions` (r:1 w:1) /// Storage: `GhostExodus::CurrentExodus` (r:1 w:1)
/// Proof: `GhostExodus::CurrentExodusSessions` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::CurrentExodus` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::ExodusRequests` (r:1 w:1) /// Storage: `GhostExodus::ExodusRequests` (r:1 w:1)
/// Proof: `GhostExodus::ExodusRequests` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::ExodusRequests` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn register_evm_bridge_out_exodus() -> Weight { fn register_evm_bridge_out_exodus() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `457` // Measured: `448`
// Estimated: `3922` // Estimated: `3913`
// Minimum execution time: 195_417_000 picoseconds. // Minimum execution time: 191_374_000 picoseconds.
Weight::from_parts(196_842_000, 0) Weight::from_parts(192_991_000, 0)
.saturating_add(Weight::from_parts(0, 3922)) .saturating_add(Weight::from_parts(0, 3913))
.saturating_add(RocksDbWeight::get().reads(7)) .saturating_add(RocksDbWeight::get().reads(7))
.saturating_add(RocksDbWeight::get().writes(5)) .saturating_add(RocksDbWeight::get().writes(5))
} }

View File

@ -1,6 +1,6 @@
[package] [package]
name = "ghost-governance" name = "ghost-governance"
version = "0.3.11" version = "0.3.10"
description = "Full-chain and cross-chain governance pallet with early adopter share claims" description = "Full-chain and cross-chain governance pallet with early adopter share claims"
license.workspace = true license.workspace = true
authors.workspace = true authors.workspace = true

View File

@ -16,7 +16,7 @@
//! Autogenerated weights for `ghost_governance` //! Autogenerated weights for `ghost_governance`
//! //!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2026-10-29, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! DATE: 2026-09-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000` //! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz` //! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz`
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024 //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024
@ -67,11 +67,11 @@ impl WeightInfo for () {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `283` // Measured: `283`
// Estimated: `3748` // Estimated: `3748`
// Minimum execution time: 224_852_000 picoseconds. // Minimum execution time: 229_254_000 picoseconds.
Weight::from_parts(225_347_733, 0) Weight::from_parts(229_992_093, 0)
.saturating_add(Weight::from_parts(0, 3748)) .saturating_add(Weight::from_parts(0, 3748))
// Standard Error: 21_234 // Standard Error: 25_680
.saturating_add(Weight::from_parts(1_581_800, 0).saturating_mul(p.into())) .saturating_add(Weight::from_parts(1_874_433, 0).saturating_mul(p.into()))
.saturating_add(RocksDbWeight::get().reads(5)) .saturating_add(RocksDbWeight::get().reads(5))
.saturating_add(RocksDbWeight::get().writes(5)) .saturating_add(RocksDbWeight::get().writes(5))
} }

View File

@ -1,6 +1,6 @@
[package] [package]
name = "ghost-helpers" name = "ghost-helpers"
version = "0.0.16" version = "0.0.15"
description = "Cryptographic utility suite for custom runtimes: optimized Bitmaps, UTXO parsing, Merkle Tree proofs, and Hash Chain components." description = "Cryptographic utility suite for custom runtimes: optimized Bitmaps, UTXO parsing, Merkle Tree proofs, and Hash Chain components."
license.workspace = true license.workspace = true
authors.workspace = true authors.workspace = true

View File

@ -3,7 +3,6 @@
use ghost_traits::hashing::GhostHasher; use ghost_traits::hashing::GhostHasher;
use sp_core::H256; use sp_core::H256;
use sp_io::hashing::{blake2_256, keccak_256, sha2_256}; use sp_io::hashing::{blake2_256, keccak_256, sha2_256};
use sp_runtime::{Perbill, traits::{Saturating, UniqueSaturatedInto}};
pub mod bounded_bitmap; pub mod bounded_bitmap;
pub mod hash_chain; pub mod hash_chain;
@ -50,34 +49,6 @@ where
value - f value - f
} }
pub fn get_submission_probability<B>(
participants_count: usize,
values_count: usize,
blocks_left: B
) -> Perbill
where
B: UniqueSaturatedInto<u32>,
{
// y = min(1, (1/6) + (A-C)/2x)
let a: u32 = participants_count.unique_saturated_into();
let c: u32 = values_count.unique_saturated_into();
let x: u32 = blocks_left.unique_saturated_into();
if a == 0 { return Perbill::zero(); }
let part_1 = Perbill::from_percent(6);
let part_2 = if x > 0 {
let numerator = a.saturating_sub(c);
let denominator = x.saturating_mul(2);
Perbill::from_rational(numerator, denominator)
} else {
if c < a { Perbill::one() }
else { Perbill::zero() }
};
part_1.saturating_add(part_2)
}
macro_rules! impl_ghost_hasher { macro_rules! impl_ghost_hasher {
( (
struct $name:ident; struct $name:ident;
@ -184,38 +155,4 @@ mod tests {
assert_eq!(get_byzantium_quorum_threshold(4u64), 3u64); assert_eq!(get_byzantium_quorum_threshold(4u64), 3u64);
assert_eq!(get_byzantium_quorum_threshold(4usize), 3usize); assert_eq!(get_byzantium_quorum_threshold(4usize), 3usize);
} }
#[test]
fn test_base_probability_when_plenty_of_time() {
let prob = get_submission_probability(100, 0, 10000u32);
assert!(prob > Perbill::from_percent(6));
assert!(prob < Perbill::from_percent(7));
}
#[test]
fn test_urgency_increases_as_blocks_shrink() {
let prob_far = get_submission_probability(20, 10, 10u32);
assert_eq!(prob_far, Perbill::from_percent(56));
let prob_close = get_submission_probability(20, 10, 2u32);
assert_eq!(prob_close, Perbill::one());
}
#[test]
fn test_deadline_reached_but_votes_missing() {
let prob = get_submission_probability(10, 5, 0u32);
assert_eq!(prob, Perbill::one());
}
#[test]
fn test_all_votes_collected() {
let prob = get_submission_probability(10, 10, 5u32);
assert_eq!(prob, Perbill::from_percent(6));
}
#[test]
fn test_zero_participants_edge_case() {
let prob = get_submission_probability(0, 0, 5u32);
assert_eq!(prob, Perbill::zero());
}
} }

View File

@ -1,6 +1,6 @@
[package] [package]
name = "ghost-weaver" name = "ghost-weaver"
version = "0.0.27" version = "0.0.21"
description = "Weaving a secure cryptographic tapestry across different external chains." description = "Weaving a secure cryptographic tapestry across different external chains."
license.workspace = true license.workspace = true
authors.workspace = true authors.workspace = true

View File

@ -77,37 +77,20 @@ mod benchmarks {
fn weave_weft( fn weave_weft(
a: Linear<1, { T::MaxAuthorities::get() as u32 }> a: Linear<1, { T::MaxAuthorities::get() as u32 }>
) -> Result<(), BenchmarkError> { ) -> Result<(), BenchmarkError> {
let weaving_session: WeavingSession = 420; let weaving_session = 420;
let next_session: WeavingSession = weaving_session + 1; let next_session = weaving_session + 1;
let root_hash = H256::repeat_byte(0x69); let root_hash = H256::repeat_byte(0x69);
let (network_id, authority, authority_index) = prepare_pallet::<T>(a, None); let (network_id, authority, authority_index) = prepare_pallet::<T>(a, None);
let next_session_bytes = next_session.to_be_bytes(); let tapestry_key = (network_id, weaving_session, next_session, root_hash);
let weaving_session_bytes = weaving_session.to_be_bytes(); TapestryStrands::<T>::mutate(&tapestry_key, |tapestry| {
let metadata: &[&[u8]] = &[
root_hash.as_ref(),
next_session_bytes.as_ref(),
weaving_session_bytes.as_ref(),
];
let tapestry_strand_key =
sequential_hash::<SubstrateBlake2Hasher, _>(metadata);
let mut bitmap = WeaversBitmap::<T>::empty(a);
(0..a).for_each(|i| { (0..a).for_each(|i| {
let index = i as AuthIndex; let index = i as AuthIndex;
if index == authority_index { return; } if index == authority_index { return; }
bitmap.insert(index); tapestry.insert(index);
});
}); });
let mut tapestry_map = BoundedBTreeMap::<_, _, T::MaxAuthorities>::default();
tapestry_map
.try_insert(tapestry_strand_key.clone(), bitmap)
.map_err(|_| BenchmarkError::Stop("Failed to insert bitmap into benchmark map"))?;
TapestryStrands::<T>::insert(&network_id, tapestry_map);
let current_block = T::BlockNumberProvider::current_block_number(); let current_block = T::BlockNumberProvider::current_block_number();
let dummy_draft = TapestryDraftBuilder::default() let dummy_draft = TapestryDraftBuilder::default()
@ -129,24 +112,18 @@ mod benchmarks {
.sign(&hash_attestation.encode()) .sign(&hash_attestation.encode())
.expect("Signature should be created"); .expect("Signature should be created");
let tapestry_strand_key = (network_id, weaving_session, next_session, root_hash);
let weaving_state = WeavingStates::<T>::get(&network_id); let weaving_state = WeavingStates::<T>::get(&network_id);
assert_eq!(weaving_state.hash, H256::default()); assert_eq!(weaving_state.hash, H256::default());
assert_eq!(weaving_state.next_session, 0); assert_eq!(weaving_state.next_session, 0);
assert_eq!(weaving_state.count, 0); assert_eq!(weaving_state.count, 0);
let tapestry_strand = TapestryStrands::<T>::get(&network_id); assert!(!TapestryStrands::<T>::get(&tapestry_strand_key).contains(authority_index));
let maybe_tapestry_bitmap = tapestry_strand.get(&tapestry_strand_key); assert_eq!(
TapestryStrands::<T>::get(&tapestry_strand_key).count_ones::<u32>(),
let authority_does_not_exists = maybe_tapestry_bitmap a - 1
.map(|bitmap| !bitmap.contains(authority_index)) );
.ok_or(BenchmarkError::Stop("NetworkId should be registered"))?;
let tapestry_participants = maybe_tapestry_bitmap
.map(|bitmap| bitmap.count_ones::<u32>())
.ok_or(BenchmarkError::Stop("NetworkId should be registered"))?;
assert!(authority_does_not_exists);
assert_eq!(tapestry_participants, a - 1);
#[extrinsic_call] #[extrinsic_call]
_(RawOrigin::None, hash_attestation, signature); _(RawOrigin::None, hash_attestation, signature);
@ -156,19 +133,11 @@ mod benchmarks {
assert_eq!(new_weaving_state.next_session, next_session); assert_eq!(new_weaving_state.next_session, next_session);
assert_eq!(new_weaving_state.count, a as AuthIndex); assert_eq!(new_weaving_state.count, a as AuthIndex);
let tapestry_strand = TapestryStrands::<T>::get(&network_id); assert!(TapestryStrands::<T>::get(&tapestry_strand_key).contains(authority_index));
let maybe_tapestry_bitmap = tapestry_strand.get(&tapestry_strand_key); assert_eq!(
TapestryStrands::<T>::get(&tapestry_strand_key).count_ones::<u32>(),
let authority_exists = maybe_tapestry_bitmap a
.map(|bitmap| bitmap.contains(authority_index)) );
.ok_or(BenchmarkError::Stop("NetworkId should be registered"))?;
let tapestry_participants = maybe_tapestry_bitmap
.map(|bitmap| bitmap.count_ones::<u32>())
.ok_or(BenchmarkError::Stop("NetworkId should be registered"))?;
assert!(authority_exists);
assert_eq!(tapestry_participants, a);
Ok(()) Ok(())
} }

View File

@ -68,14 +68,13 @@ fn parse_pending_requests<'a, R: Copy + Into<RequestId> + 'static>(
) -> impl Iterator<Item = NetworkResponseType> + 'a { ) -> impl Iterator<Item = NetworkResponseType> + 'a {
PendingRequest::try_wait_all(pending_requests, Some(deadline)) PendingRequest::try_wait_all(pending_requests, Some(deadline))
.into_iter() .into_iter()
.enumerate() .filter_map(move |wait_result| {
.filter_map(move |(idx, wait_result)| {
let http_result = wait_result let http_result = wait_result
.inspect_err(|_| { .inspect_err(|_| {
log::error!( log::error!(
target: LOG_TARGET, target: LOG_TARGET,
"🕸️ Weaver: RPC request [index {}] timed out (deadline reached).", "🕸️ Error during request preparation: {:?}",
idx WeavingError::<u32>::DeadlineReached,
) )
}) })
.ok()?; .ok()?;
@ -84,8 +83,7 @@ fn parse_pending_requests<'a, R: Copy + Into<RequestId> + 'static>(
.inspect_err(|err| { .inspect_err(|err| {
log::error!( log::error!(
target: LOG_TARGET, target: LOG_TARGET,
"🕸️ Weaver: RPC request [index {}] failed with HTTP error: {:?}", "🕸️ Error during response parsing: {:?}",
idx,
err, err,
) )
}) })

View File

@ -22,32 +22,23 @@ use sp_runtime::{
storage::StorageValueRef, storage::StorageValueRef,
storage_lock::{StorageLock, Time}, storage_lock::{StorageLock, Time},
}, },
traits::{ traits::{BlockNumberProvider, Saturating, UniqueSaturatedInto},
TrailingZeroInput, BlockNumberProvider, Saturating, RuntimeAppPublic,
UniqueSaturatedInto,
},
RuntimeAppPublic, Perbill, PerThing,
}; };
use ghost_helpers::{ use ghost_helpers::{
bounded_bitmap::{validate_bitmap_sizes, BoundedBitmap}, bounded_bitmap::{validate_bitmap_sizes, BoundedBitmap},
get_byzantium_quorum_threshold,
networks::{NetworkData, NetworkType}, networks::{NetworkData, NetworkType},
hash_chain::sequential_hash,
get_byzantium_quorum_threshold, get_submission_probability,
SubstrateBlake2Hasher,
}; };
use ghost_traits::{ use ghost_traits::{
bounded_bitmap::{ bounded_bitmap::{BoundedBitmapReader, BoundedBitmapWriter},
BoundedBitmapReader, BoundedBitmapWriter,
BoundedBitmapGenerator,
},
networks::{ networks::{
NetworkDataBasicHandler, NetworkDataInspectHandler, NetworkDataBasicHandler, NetworkDataInspectHandler, NetworkDataMutateHandler,
NetworkDataMutateHandler, NetworkRpcResolver, NetworkRpcResolver,
}, },
}; };
pub mod migrations;
mod errors; mod errors;
mod impls; mod impls;
mod types; mod types;
@ -87,8 +78,8 @@ const LOG_TARGET: &str = "runtime::ghost-weaver";
const DB_PREFIX: &[u8] = b"ghost-weaver::"; const DB_PREFIX: &[u8] = b"ghost-weaver::";
const LOCK_BLOCK_EXPIRATION: u64 = 20; const LOCK_BLOCK_EXPIRATION: u64 = 20;
const MIN_LOCK_GUARD_PERIOD: u64 = 60_000; const MIN_LOCK_GUARD_PERIOD: u64 = 15_000;
const FETCH_TIMEOUT_PERIOD: u64 = 5_000; const FETCH_TIMEOUT_PERIOD: u64 = 3_000;
type AuthIndex = ghost_helpers::AuthIndexU16; type AuthIndex = ghost_helpers::AuthIndexU16;
type BitmapChunk = ghost_helpers::BitmapChunkU32; type BitmapChunk = ghost_helpers::BitmapChunkU32;
@ -108,7 +99,7 @@ type WeaversBitmap<T> = BoundedBitmap<BitmapChunk, <T as Config>::MaxAuthorities
pub mod pallet { pub mod pallet {
use super::*; use super::*;
const STORAGE_VERSION: StorageVersion = StorageVersion::new(2); const STORAGE_VERSION: StorageVersion = StorageVersion::new(0);
#[pallet::pallet] #[pallet::pallet]
#[pallet::storage_version(STORAGE_VERSION)] #[pallet::storage_version(STORAGE_VERSION)]
@ -179,7 +170,6 @@ pub mod pallet {
InvalidParticipantAttestation, InvalidParticipantAttestation,
NonExistentNetworkId, NonExistentNetworkId,
TooManyAttestations, TooManyAttestations,
TooManyTapestries,
TimeWentBackwards, TimeWentBackwards,
WeavingIsActive, WeavingIsActive,
WeavingIsInactive, WeavingIsInactive,
@ -193,10 +183,9 @@ pub mod pallet {
} }
#[pallet::storage] #[pallet::storage]
#[pallet::getter(fn network_attested_blocks)] #[pallet::getter(fn attested_blocks)]
pub(super) type NetworkAttestedBlocks<T: Config> = StorageDoubleMap< pub(super) type AttestedBlocks<T: Config> = StorageMap<
_, _,
Twox64Concat, NetworkIdOf<T>,
Twox64Concat, AuthIndex, Twox64Concat, AuthIndex,
BlockNumberFor<T>, BlockNumberFor<T>,
ValueQuery, ValueQuery,
@ -228,10 +217,15 @@ pub mod pallet {
#[pallet::storage] #[pallet::storage]
#[pallet::getter(fn tapestry_strands)] #[pallet::getter(fn tapestry_strands)]
pub(super) type TapestryStrands<T: Config> = StorageMap< pub(super) type TapestryStrands<T: Config> = StorageNMap<
_, _,
Twox64Concat, NetworkIdOf<T>, (
BoundedBTreeMap<H256, WeaversBitmap<T>, T::MaxAuthorities>, NMapKey<Twox64Concat, NetworkIdOf<T>>,
NMapKey<Twox64Concat, WeavingSession>,
NMapKey<Twox64Concat, WeavingSession>,
NMapKey<Twox64Concat, H256>,
),
WeaversBitmap<T>,
ValueQuery, ValueQuery,
>; >;
@ -362,10 +356,7 @@ pub mod pallet {
})?; })?;
let current_block = T::BlockNumberProvider::current_block_number(); let current_block = T::BlockNumberProvider::current_block_number();
NetworkAttestedBlocks::<T>::insert( AttestedBlocks::<T>::insert(&authority_index, current_block);
&network_id, &authority_index,
current_block
);
Self::deposit_event(Event::<T>::BlockAttestated { Self::deposit_event(Event::<T>::BlockAttestated {
network_id, network_id,
@ -400,64 +391,31 @@ pub mod pallet {
Error::<T>::WeavingIsInactive, Error::<T>::WeavingIsInactive,
); );
let authorities_len = Authorities::<T>::decode_len()
.unwrap_or(0);
let root_hash = hash_attestation.root_hash; let root_hash = hash_attestation.root_hash;
let next_session = hash_attestation.next_session; let next_session = hash_attestation.next_session;
let weaving_session = hash_attestation.weaving_session(); let weaving_session = hash_attestation.weaving_session();
let next_session_bytes = next_session.to_be_bytes();
let weaving_session_bytes = weaving_session.to_be_bytes();
let metadata: &[&[u8]] = &[
root_hash.as_ref(),
next_session_bytes.as_ref(),
weaving_session_bytes.as_ref(),
];
let tapestry_strand_key =
sequential_hash::<SubstrateBlake2Hasher, _>(metadata);
let weavers_count = TapestryStrands::<T>::try_mutate( let weavers_count = TapestryStrands::<T>::try_mutate(
&network_id, &(network_id, weaving_session, next_session, root_hash),
|tapestry_strand| -> Result<AuthIndex, DispatchError> { |tapestry_strand| -> Result<AuthIndex, DispatchError> {
if !tapestry_strand.contains_key(&tapestry_strand_key) {
let empty_bitmap = WeaversBitmap::<T>::empty(authorities_len);
tapestry_strand
.try_insert(tapestry_strand_key, empty_bitmap)
.map_err(|_| Error::<T>::TooManyTapestries)?;
}
let tapestry_bitmap = tapestry_strand
.get_mut(&tapestry_strand_key)
.ok_or(Error::<T>::TooManyTapestries)?;
ensure!( ensure!(
!tapestry_bitmap.contains(authority_index), !tapestry_strand.contains(authority_index),
Error::<T>::AuthorityPartOfTrapestry, Error::<T>::AuthorityPartOfTrapestry,
); );
tapestry_bitmap.insert(authority_index); tapestry_strand.insert(authority_index);
Ok(tapestry_bitmap.count_ones::<AuthIndex>()) Ok(tapestry_strand.count_ones::<AuthIndex>())
}, },
)?; )?;
WeavingStates::<T>::mutate(&network_id, |weaving_state| { WeavingStates::<T>::mutate(&network_id, |weaving_state| {
if weaving_state.count < weavers_count { if weaving_state.count < weavers_count {
*weaving_state = WeavingState::new( *weaving_state = WeavingState::new(root_hash, next_session, weavers_count);
root_hash,
next_session,
weavers_count
);
} }
}); });
let current_block = T::BlockNumberProvider::current_block_number(); let current_block = T::BlockNumberProvider::current_block_number();
NetworkAttestedBlocks::<T>::insert( AttestedBlocks::<T>::insert(&authority_index, current_block);
&network_id, &authority_index,
current_block
);
Self::deposit_event(Event::<T>::HashAttestated { Self::deposit_event(Event::<T>::HashAttestated {
authority_index, authority_index,
@ -573,10 +531,9 @@ pub mod pallet {
CurrentWeavingSession::<T>::insert(&network_id, next_session); CurrentWeavingSession::<T>::insert(&network_id, next_session);
} }
weight.saturating_accrue(T::DbWeight::get().writes(3)); weight.saturating_accrue(T::DbWeight::get().writes(2));
TapestryDrafts::<T>::remove(&network_id); TapestryDrafts::<T>::remove(&network_id);
WeavingStates::<T>::remove(&network_id); WeavingStates::<T>::remove(&network_id);
NetworkAttestations::<T>::remove(&network_id);
} }
} }
None => { None => {
@ -621,9 +578,8 @@ pub mod pallet {
.with_median_external(median_block) .with_median_external(median_block)
.build(); .build();
TapestryStrands::<T>::remove(&network_id);
TapestryDrafts::<T>::insert(&network_id, tapestry_draft); TapestryDrafts::<T>::insert(&network_id, tapestry_draft);
weight.saturating_accrue(T::DbWeight::get().writes(2)); weight.saturating_accrue(T::DbWeight::get().writes(1));
} }
} }
} }
@ -635,7 +591,7 @@ pub mod pallet {
if sp_io::offchain::is_validator() { if sp_io::offchain::is_validator() {
log::warn!(target: LOG_TARGET, "🕸️ Weaver started at block #{:?}", now); log::warn!(target: LOG_TARGET, "🕸️ Weaver started at block #{:?}", now);
match Self::start_weaving(now) { match Self::start_weaving(now) {
Ok(msg) => log::warn!(target: LOG_TARGET, "🕸️ Weaver finished gracefully at block #{:?}: {:?}", now, msg), Ok(_) => log::warn!(target: LOG_TARGET, "🕸️ Weaver finished gracefully at block #{:?}", now),
Err(e) => log::warn!(target: LOG_TARGET, "🕸️ Weaver failed at block #{:?}: {:?}", now, e), Err(e) => log::warn!(target: LOG_TARGET, "🕸️ Weaver failed at block #{:?}: {:?}", now, e),
} }
} }
@ -732,41 +688,6 @@ impl<T: Config> Pallet<T> {
A: Encode, A: Encode,
{ {
let authority_index = attestation.authority_index(); let authority_index = attestation.authority_index();
let network_id = attestation.network_id();
if !T::NetworkDataHandler::contains_key(&network_id) {
return Err(InvalidTransaction::BadProof);
}
let current_attestation_len =
NetworkAttestations::<T>::decode_len(&network_id).unwrap_or(0);
if authority_index as usize >= current_attestation_len {
return Err(InvalidTransaction::BadSigner.into());
}
if DisabledAuthorities::<T>::get().contains(authority_index) {
return Err(InvalidTransaction::BadSigner);
}
let attestation_block = attestation.block();
let current_block = T::BlockNumberProvider::current_block_number();
let lock: BlockNumberFor<T> = LOCK_BLOCK_EXPIRATION.unique_saturated_into();
let block_expiration = attestation_block.saturating_add(lock);
if current_block >= block_expiration {
return Err(InvalidTransaction::Stale);
}
let last_attested = NetworkAttestedBlocks::<T>::get(
&network_id,
&authority_index
);
let cooling_off_until = last_attested.saturating_add(lock);
if attestation_block < cooling_off_until {
return Err(InvalidTransaction::Stale);
}
Authorities::<T>::get() Authorities::<T>::get()
.get(authority_index as usize) .get(authority_index as usize)
@ -778,6 +699,35 @@ impl<T: Config> Pallet<T> {
.ok_or(InvalidTransaction::BadSigner) .ok_or(InvalidTransaction::BadSigner)
})?; })?;
let attestation_block = attestation.block();
let current_block = T::BlockNumberProvider::current_block_number();
let lock: BlockNumberFor<T> = LOCK_BLOCK_EXPIRATION.unique_saturated_into();
let block_expiration = attestation_block.saturating_add(lock);
let block_expired = current_block >= block_expiration;
let block_attested = AttestedBlocks::<T>::get(authority_index)
.ge(&attestation_block);
if block_expired || block_attested {
return Err(InvalidTransaction::BadProof);
}
let network_id = attestation.network_id();
let current_attestation_len = NetworkAttestations::<T>::decode_len(&network_id)
.unwrap_or(0);
if authority_index as usize >= current_attestation_len {
return Err(InvalidTransaction::BadSigner.into());
}
if DisabledAuthorities::<T>::get().contains(authority_index) {
return Err(InvalidTransaction::BadSigner);
}
if !T::NetworkDataHandler::contains_key(&network_id) {
return Err(InvalidTransaction::BadProof);
}
Ok((authority_index, network_id)) Ok((authority_index, network_id))
} }
@ -792,7 +742,7 @@ impl<T: Config> Pallet<T> {
let lock_period_key = Self::create_storage_key(b"network-period", &network_id_encoded); let lock_period_key = Self::create_storage_key(b"network-period", &network_id_encoded);
let lock_period = Self::read_offchain_storage(&lock_period_key, &MIN_LOCK_GUARD_PERIOD); let lock_period = Self::read_offchain_storage(&lock_period_key, &MIN_LOCK_GUARD_PERIOD);
let lock_until = rt_offchain::Duration::from_millis(lock_period.max(MIN_LOCK_GUARD_PERIOD)); let lock_until = rt_offchain::Duration::from_millis(lock_period);
let network_lock_key = Self::create_storage_key(b"network-lock-", &network_id_encoded); let network_lock_key = Self::create_storage_key(b"network-lock-", &network_id_encoded);
let mut network_lock = StorageLock::<Time>::with_deadline(&network_lock_key, lock_until); let mut network_lock = StorageLock::<Time>::with_deadline(&network_lock_key, lock_until);
@ -830,31 +780,14 @@ impl<T: Config> Pallet<T> {
return Err(WeavingError::NoEndpointsAvailable(network_id)); return Err(WeavingError::NoEndpointsAvailable(network_id));
} }
let check_probability = |values_count: usize, blocks_left: BlockNumberFor<T>| -> bool {
let total_authorities = Authorities::<T>::decode_len().unwrap_or(1);
let submission_probability = get_submission_probability(
total_authorities,
values_count,
blocks_left,
);
let seed = sp_io::offchain::random_seed();
let randomness = <u32>::decode(&mut TrailingZeroInput::new(seed.as_ref()))
.expect("input is padded with zeroes; qed");
let random_roll = Perbill::from_parts(randomness % Perbill::ACCURACY);
random_roll > submission_probability
};
match TapestryDrafts::<T>::get(&network_id) { match TapestryDrafts::<T>::get(&network_id) {
Some(tapestry_draft) => Self::try_request_and_submit_hash( Some(tapestry_draft) => Self::try_request_and_submit_hash(
network_id, network_id,
current_block, current_block,
tapestry_draft, tapestry_draft.median,
deadline, deadline,
&network_data, &network_data,
&rpc_endpoints, &rpc_endpoints,
check_probability,
), ),
None => Self::try_request_and_submit_block( None => Self::try_request_and_submit_block(
network_id, network_id,
@ -862,7 +795,6 @@ impl<T: Config> Pallet<T> {
deadline, deadline,
&network_data, &network_data,
&rpc_endpoints, &rpc_endpoints,
check_probability,
), ),
} }
} }
@ -870,22 +802,13 @@ impl<T: Config> Pallet<T> {
fn try_request_and_submit_hash( fn try_request_and_submit_hash(
network_id: NetworkIdOf<T>, network_id: NetworkIdOf<T>,
current_block: BlockNumberFor<T>, current_block: BlockNumberFor<T>,
tapestry_draft: TapestryDraft<BlockNumberFor<T>>, target_block: ExternalBlockNumber,
deadline: rt_offchain::Timestamp, deadline: rt_offchain::Timestamp,
network_data: &NetworkData, network_data: &NetworkData,
rpc_endpoints: &Vec<Vec<u8>>, rpc_endpoints: &Vec<Vec<u8>>,
check_probability: impl Fn(usize, BlockNumberFor<T>) -> bool,
) -> WeavingResult<T, WeavingOk<NetworkIdOf<T>>> { ) -> WeavingResult<T, WeavingOk<NetworkIdOf<T>>> {
let weaving_session = CurrentWeavingSession::<T>::get(&network_id); let weaving_session = CurrentWeavingSession::<T>::get(&network_id);
let block_until = tapestry_draft.until.saturating_sub(current_block);
let weaving_count = WeavingStates::<T>::get(&network_id).count as usize;
if check_probability(weaving_count, block_until) {
return Ok(WeavingOk::Skipped(network_id));
}
let target_block = tapestry_draft.median;
let request_id = current_block.unique_saturated_into(); let request_id = current_block.unique_saturated_into();
let request_body = network_data.r#type.get_hash_request_body( let request_body = network_data.r#type.get_hash_request_body(
@ -918,19 +841,8 @@ impl<T: Config> Pallet<T> {
network_id, network_id,
))?; ))?;
let next_session_bytes = first_next_session.to_be_bytes(); let tapestry_key = (network_id, weaving_session, first_next_session, first_hash);
let weaving_session_bytes = weaving_session.to_be_bytes(); let tapestry_strand = TapestryStrands::<T>::get(&tapestry_key);
let metadata: &[&[u8]] = &[
first_hash.as_ref(),
next_session_bytes.as_ref(),
weaving_session_bytes.as_ref(),
];
let tapestry_strand_key =
sequential_hash::<SubstrateBlake2Hasher, _>(metadata);
let tapestry_strand = TapestryStrands::<T>::get(&network_id);
let context = AttestationContext::default() let context = AttestationContext::default()
.with_weaving_session(weaving_session) .with_weaving_session(weaving_session)
@ -938,12 +850,7 @@ impl<T: Config> Pallet<T> {
.with_network_id(network_id); .with_network_id(network_id);
Self::local_authorities().for_each(|(authority_index, authority_key)| { Self::local_authorities().for_each(|(authority_index, authority_key)| {
let already_part_of_tapestry_strand = tapestry_strand if tapestry_strand.contains(authority_index) {
.get(&tapestry_strand_key)
.map(|bitmap| bitmap.contains(authority_index))
.unwrap_or(false);
if already_part_of_tapestry_strand {
log::error!( log::error!(
target: LOG_TARGET, target: LOG_TARGET,
"🕸️ Weft already weaved from authority #{:?} for network #{:?}.", "🕸️ Weft already weaved from authority #{:?} for network #{:?}.",
@ -953,23 +860,6 @@ impl<T: Config> Pallet<T> {
return; return;
} }
let last_attested =
NetworkAttestedBlocks::<T>::get(&network_id, &authority_index);
let lock: BlockNumberFor<T> = LOCK_BLOCK_EXPIRATION.unique_saturated_into();
let cooling_off_until = last_attested.saturating_add(lock);
if current_block < cooling_off_until {
log::error!(
target: LOG_TARGET,
"🕸️ Weft is cooling for authority #{:?} for network #{:?} blocks left {:?}.",
authority_index,
network_id,
cooling_off_until.saturating_sub(current_block)
);
return;
}
let hash_attestation = context let hash_attestation = context
.with_authority_index(authority_index) .with_authority_index(authority_index)
.build_hash_attestation(first_hash, first_next_session); .build_hash_attestation(first_hash, first_next_session);
@ -1012,20 +902,7 @@ impl<T: Config> Pallet<T> {
deadline: rt_offchain::Timestamp, deadline: rt_offchain::Timestamp,
network_data: &NetworkData, network_data: &NetworkData,
rpc_endpoints: &Vec<Vec<u8>>, rpc_endpoints: &Vec<Vec<u8>>,
check_probability: impl Fn(usize, BlockNumberFor<T>) -> bool,
) -> WeavingResult<T, WeavingOk<NetworkIdOf<T>>> { ) -> WeavingResult<T, WeavingOk<NetworkIdOf<T>>> {
let next_attempt_block = NextConsensusAttemptBlocks::<T>::get(&network_id);
let block_until = next_attempt_block.saturating_sub(current_block);
let attestations_count = NetworkAttestations::<T>::get(&network_id)
.iter()
.flatten()
.count();
if check_probability(attestations_count, block_until) {
return Ok(WeavingOk::Skipped(network_id));
}
let network_id_encoded = network_id.encode(); let network_id_encoded = network_id.encode();
let distance_key = Self::create_storage_key(b"distance-", &network_id_encoded); let distance_key = Self::create_storage_key(b"distance-", &network_id_encoded);
let block_deviation = let block_deviation =
@ -1044,7 +921,6 @@ impl<T: Config> Pallet<T> {
let total_blocks = block_numbers.len(); let total_blocks = block_numbers.len();
let weaving_threshold = get_byzantium_quorum_threshold(total_blocks); let weaving_threshold = get_byzantium_quorum_threshold(total_blocks);
let parsed_blocks_count = total_blocks.unique_saturated_into();
let median_block = Self::validate_block_numbers_consensus( let median_block = Self::validate_block_numbers_consensus(
&mut block_numbers, &mut block_numbers,
@ -1065,23 +941,6 @@ impl<T: Config> Pallet<T> {
.with_network_id(network_id); .with_network_id(network_id);
Self::local_authorities().for_each(|(authority_index, authority_key)| { Self::local_authorities().for_each(|(authority_index, authority_key)| {
let last_attested =
NetworkAttestedBlocks::<T>::get(&network_id, &authority_index);
let lock: BlockNumberFor<T> = LOCK_BLOCK_EXPIRATION.unique_saturated_into();
let cooling_off_until = last_attested.saturating_add(lock);
if current_block < cooling_off_until {
log::error!(
target: LOG_TARGET,
"🕸️ Attestation is cooling for authority #{:?} for network #{:?} blocks left {:?}.",
authority_index,
network_id,
cooling_off_until.saturating_sub(current_block)
);
return;
}
let block_attestation = context let block_attestation = context
.with_authority_index(authority_index) .with_authority_index(authority_index)
.build_block_attestation(finalized_block); .build_block_attestation(finalized_block);
@ -1110,7 +969,7 @@ impl<T: Config> Pallet<T> {
} }
}); });
Ok(WeavingOk::Block(finalized_block, parsed_blocks_count, network_id)) Ok(WeavingOk::Block(finalized_block, network_id))
} }
fn prepare_pending_requests( fn prepare_pending_requests(
@ -1254,7 +1113,12 @@ impl<T: Config> Pallet<T> {
local_authorities local_authorities
.binary_search(&authority) .binary_search(&authority)
.ok() .ok()
.map(|_| (index as AuthIndex, authority)) .map(|location| {
(
index.unique_saturated_into(),
local_authorities[location].clone(),
)
})
}) })
} }

View File

@ -1,18 +0,0 @@
pub mod v1;
pub mod v2;
pub type MigrateV0ToV1<T> = frame_support::migrations::VersionedMigration<
0,
1,
v1::RemoveAttestedBlocksStorage<T>,
crate::Pallet::<T>,
<T as frame_system::Config>::DbWeight,
>;
pub type MigrateV1ToV2<T> = frame_support::migrations::VersionedMigration<
1,
2,
v2::UpdateTapestryStrandsStorageLayout<T>,
crate::Pallet::<T>,
<T as frame_system::Config>::DbWeight,
>;

View File

@ -1,33 +0,0 @@
use frame_support::{
traits::{Get, UncheckedOnRuntimeUpgrade},
weights::Weight,
};
use core::marker::PhantomData;
use crate::{Config, LOG_TARGET};
pub struct RemoveAttestedBlocksStorage<T>(PhantomData<T>);
impl<T: Config> UncheckedOnRuntimeUpgrade for RemoveAttestedBlocksStorage<T> {
fn on_runtime_upgrade() -> Weight {
let clear_key = frame_support::storage::storage_prefix(
b"GhostWeaver",
b"AttestedBlocks"
);
let removal_results = frame_support::storage::unhashed::clear_prefix(
&clear_key,
None,
None
);
let killed_keys = removal_results.unique;
log::info!(
target: LOG_TARGET,
"🧹 Success: Purged deprecated AttestedBlocks storage. Wiped {} keys from Trie.",
killed_keys
);
T::DbWeight::get().reads_writes(1, killed_keys as u64)
}
}

View File

@ -1,33 +0,0 @@
use frame_support::{
traits::{Get, UncheckedOnRuntimeUpgrade},
weights::Weight,
};
use core::marker::PhantomData;
use crate::{Config, LOG_TARGET};
pub struct UpdateTapestryStrandsStorageLayout<T>(PhantomData<T>);
impl<T: Config> UncheckedOnRuntimeUpgrade for UpdateTapestryStrandsStorageLayout<T> {
fn on_runtime_upgrade() -> Weight {
let clear_key = frame_support::storage::storage_prefix(
b"GhostWeaver",
b"TapestryStrands"
);
let removal_results = frame_support::storage::unhashed::clear_prefix(
&clear_key,
None,
None
);
let killed_keys = removal_results.unique;
log::info!(
target: LOG_TARGET,
"🧹 Success: Old StorageNMap for TapestryStrands wiped. Wiped {} keys from Trie.",
killed_keys
);
T::DbWeight::get().reads_writes(1, killed_keys as u64)
}
}

View File

@ -1,6 +1,6 @@
#![cfg(test)] #![cfg(test)]
use crate::{LOCK_BLOCK_EXPIRATION, sr25519::AuthorityPair}; use crate::sr25519::AuthorityPair;
use crate::mock::*; use crate::mock::*;
use crate::pallet::*; use crate::pallet::*;
@ -76,11 +76,11 @@ fn should_successfully_compute_median_and_start_weaving_round() {
let networks = vec![(network_id, network_data, Default::default())]; let networks = vec![(network_id, network_data, Default::default())];
new_test_ext(authorities, networks).execute_with(|| { new_test_ext(authorities, networks).execute_with(|| {
GhostWeaver::on_initialize(LOCK_BLOCK_EXPIRATION + 1); GhostWeaver::on_initialize(1);
System::set_block_number(LOCK_BLOCK_EXPIRATION + 2); System::set_block_number(2);
let context = AttestationContext::default() let context = AttestationContext::default()
.with_current_block(LOCK_BLOCK_EXPIRATION + 1) .with_current_block(1)
.with_network_id(network_id); .with_network_id(network_id);
let att1 = context.with_authority_index(0).build_block_attestation(100); let att1 = context.with_authority_index(0).build_block_attestation(100);
@ -97,12 +97,12 @@ fn should_successfully_compute_median_and_start_weaving_round() {
assert!(GhostWeaver::tapestry_drafts(network_id).is_none()); assert!(GhostWeaver::tapestry_drafts(network_id).is_none());
System::set_block_number(LOCK_BLOCK_EXPIRATION + 3); System::set_block_number(3);
GhostWeaver::on_initialize(LOCK_BLOCK_EXPIRATION + 3); GhostWeaver::on_initialize(3);
let round = GhostWeaver::tapestry_drafts(network_id); let round = GhostWeaver::tapestry_drafts(network_id);
assert!(round.is_some()); assert!(round.is_some());
assert_eq!(round.unwrap().until, LOCK_BLOCK_EXPIRATION + 3 + WeavingDelay::get()); assert_eq!(round.unwrap().until, 3 + WeavingDelay::get());
}); });
} }
@ -121,11 +121,11 @@ fn should_apply_cooldown_delay_on_consensus_failure() {
let networks = vec![(network_id, network_data, Default::default())]; let networks = vec![(network_id, network_data, Default::default())];
new_test_ext(authorities, networks).execute_with(|| { new_test_ext(authorities, networks).execute_with(|| {
GhostWeaver::on_initialize(LOCK_BLOCK_EXPIRATION + 9); GhostWeaver::on_initialize(9);
System::set_block_number(LOCK_BLOCK_EXPIRATION + 10); System::set_block_number(10);
let context = AttestationContext::default() let context = AttestationContext::default()
.with_current_block(LOCK_BLOCK_EXPIRATION + 9) .with_current_block(9)
.with_network_id(network_id); .with_network_id(network_id);
let att1 = context.with_authority_index(0).build_block_attestation(100); let att1 = context.with_authority_index(0).build_block_attestation(100);
@ -140,20 +140,20 @@ fn should_apply_cooldown_delay_on_consensus_failure() {
assert!(GhostWeaver::extend_warp(RuntimeOrigin::none(), att2, sig2).is_ok()); assert!(GhostWeaver::extend_warp(RuntimeOrigin::none(), att2, sig2).is_ok());
assert!(GhostWeaver::extend_warp(RuntimeOrigin::none(), att3, sig3).is_ok()); assert!(GhostWeaver::extend_warp(RuntimeOrigin::none(), att3, sig3).is_ok());
System::set_block_number(LOCK_BLOCK_EXPIRATION + 11); System::set_block_number(11);
GhostWeaver::on_initialize(LOCK_BLOCK_EXPIRATION + 11); GhostWeaver::on_initialize(11);
let cooldown_block = GhostWeaver::next_consensus_attempt_blocks(network_id); let cooldown_block = GhostWeaver::next_consensus_attempt_blocks(network_id);
assert_eq!(cooldown_block, LOCK_BLOCK_EXPIRATION + 14); assert_eq!(cooldown_block, 14);
TapestryDrafts::<TestRuntime>::remove(network_id); TapestryDrafts::<TestRuntime>::remove(network_id);
System::set_block_number(LOCK_BLOCK_EXPIRATION + 12); System::set_block_number(12);
GhostWeaver::on_initialize(LOCK_BLOCK_EXPIRATION+ 12); GhostWeaver::on_initialize(12);
assert!(TapestryDrafts::<TestRuntime>::get(network_id).is_none()); assert!(TapestryDrafts::<TestRuntime>::get(network_id).is_none());
System::set_block_number(LOCK_BLOCK_EXPIRATION + 14); System::set_block_number(14);
GhostWeaver::on_initialize(LOCK_BLOCK_EXPIRATION + 14); GhostWeaver::on_initialize(14);
assert!(TapestryDrafts::<TestRuntime>::get(network_id).is_some()); assert!(TapestryDrafts::<TestRuntime>::get(network_id).is_some());
}); });
} }
@ -170,11 +170,11 @@ fn validate_unsigned_should_prevent_mempool_dos_via_tags() {
let networks = vec![(network_id, network_data, Default::default())]; let networks = vec![(network_id, network_data, Default::default())];
new_test_ext(authorities, networks).execute_with(|| { new_test_ext(authorities, networks).execute_with(|| {
GhostWeaver::on_initialize(LOCK_BLOCK_EXPIRATION + 1); GhostWeaver::on_initialize(1);
System::set_block_number(LOCK_BLOCK_EXPIRATION + 2); System::set_block_number(2);
let att = AttestationContext::default() let att = AttestationContext::default()
.with_current_block(LOCK_BLOCK_EXPIRATION + 1) .with_current_block(1)
.with_network_id(network_id) .with_network_id(network_id)
.with_authority_index(0) .with_authority_index(0)
.build_block_attestation(100); .build_block_attestation(100);
@ -187,9 +187,7 @@ fn validate_unsigned_should_prevent_mempool_dos_via_tags() {
signature: valid_sig, signature: valid_sig,
}; };
let validity = let validity = GhostWeaver::validate_unsigned(TransactionSource::External, &call);
GhostWeaver::validate_unsigned(TransactionSource::External, &call);
assert!(validity.is_ok()); assert!(validity.is_ok());
let valid_info = validity.unwrap(); let valid_info = validity.unwrap();
@ -204,9 +202,7 @@ fn validate_unsigned_should_prevent_mempool_dos_via_tags() {
signature: invalid_sig, signature: invalid_sig,
}; };
let spam_validity = let spam_validity = GhostWeaver::validate_unsigned(TransactionSource::External, &spam_call);
GhostWeaver::validate_unsigned(TransactionSource::External, &spam_call);
assert_eq!( assert_eq!(
spam_validity, spam_validity,
Err(TransactionValidityError::Invalid(InvalidTransaction::BadSigner).into()) Err(TransactionValidityError::Invalid(InvalidTransaction::BadSigner).into())
@ -247,8 +243,8 @@ fn offchain_worker_should_fetch_block_and_submit_unsigned_tx() {
ext.register_extension(TransactionPoolExt::new(pool)); ext.register_extension(TransactionPoolExt::new(pool));
ext.execute_with(|| { ext.execute_with(|| {
GhostWeaver::on_initialize(LOCK_BLOCK_EXPIRATION + 1); GhostWeaver::on_initialize(1);
GhostWeaver::on_initialize(LOCK_BLOCK_EXPIRATION + 2); GhostWeaver::on_initialize(2);
let network_id_encoded = evm_network_id.encode(); let network_id_encoded = evm_network_id.encode();
@ -262,7 +258,6 @@ fn offchain_worker_should_fetch_block_and_submit_unsigned_tx() {
let target_endpoint = b"http://localhost:8545".to_vec(); let target_endpoint = b"http://localhost:8545".to_vec();
let rpc_endpoints: Vec<Vec<u8>> = vec![target_endpoint.clone()]; let rpc_endpoints: Vec<Vec<u8>> = vec![target_endpoint.clone()];
sp_io::offchain::local_storage_set( sp_io::offchain::local_storage_set(
sp_core::offchain::StorageKind::PERSISTENT, sp_core::offchain::StorageKind::PERSISTENT,
&endpoint_key, &endpoint_key,
@ -299,8 +294,8 @@ fn offchain_worker_should_fetch_block_and_submit_unsigned_tx() {
("Accept".into(), "application/json".into()), ("Accept".into(), "application/json".into()),
("Content-Type".into(), "application/json".into()), ("Content-Type".into(), "application/json".into()),
], ],
body: b"{\"id\":21,\"jsonrpc\":\"2.0\",\"method\":\"getblockcount\"}".to_vec(), body: b"{\"id\":1,\"jsonrpc\":\"2.0\",\"method\":\"getblockcount\"}".to_vec(),
response: Some(b"{\"jsonrpc\":\"2.0\",\"id\":21,\"result\":960127}".to_vec()), response: Some(b"{\"jsonrpc\":\"2.0\",\"id\":1,\"result\":960127}".to_vec()),
sent: true, sent: true,
..Default::default() ..Default::default()
}); });
@ -314,16 +309,16 @@ fn offchain_worker_should_fetch_block_and_submit_unsigned_tx() {
("X-Custom-Provider".into(), "GhostWeaverNode".into()), ("X-Custom-Provider".into(), "GhostWeaverNode".into()),
("Authorization".into(), "Bearer new-api-token-123".into()), ("Authorization".into(), "Bearer new-api-token-123".into()),
], ],
body: b"{\"id\":22,\"jsonrpc\":\"2.0\",\"method\":\"eth_blockNumber\"}".to_vec(), body: b"{\"id\":2,\"jsonrpc\":\"2.0\",\"method\":\"eth_blockNumber\"}".to_vec(),
response: Some(b"{\"jsonrpc\":\"2.0\",\"id\":22,\"result\":\"0x1873a84\"}".to_vec()), response: Some(b"{\"jsonrpc\":\"2.0\",\"id\":2,\"result\":\"0x1873a84\"}".to_vec()),
sent: true, sent: true,
..Default::default() ..Default::default()
}); });
} }
ext.execute_with(|| { ext.execute_with(|| {
System::set_block_number(LOCK_BLOCK_EXPIRATION + 1u64); System::set_block_number(1u64);
GhostWeaver::offchain_worker(LOCK_BLOCK_EXPIRATION + 1u64); GhostWeaver::offchain_worker(1u64);
let state = pool_state.read(); let state = pool_state.read();
assert_eq!(state.transactions.len(), 1); assert_eq!(state.transactions.len(), 1);
@ -344,13 +339,13 @@ fn offchain_worker_should_fetch_block_and_submit_unsigned_tx() {
assert_eq!(curr_utxo_block, 960127); assert_eq!(curr_utxo_block, 960127);
assert!(TapestryDrafts::<TestRuntime>::get(&utxo_network_id).is_none()); assert!(TapestryDrafts::<TestRuntime>::get(&utxo_network_id).is_none());
GhostWeaver::on_initialize(LOCK_BLOCK_EXPIRATION + 3u64); GhostWeaver::on_initialize(3u64);
assert!(TapestryDrafts::<TestRuntime>::get(&utxo_network_id).is_some()); assert!(TapestryDrafts::<TestRuntime>::get(&utxo_network_id).is_some());
}); });
ext.execute_with(|| { ext.execute_with(|| {
System::set_block_number(LOCK_BLOCK_EXPIRATION + 2u64); System::set_block_number(2u64);
GhostWeaver::offchain_worker(LOCK_BLOCK_EXPIRATION + 2u64); GhostWeaver::offchain_worker(2u64);
let state = pool_state.read(); let state = pool_state.read();
assert_eq!(state.transactions.len(), 2); assert_eq!(state.transactions.len(), 2);
@ -371,8 +366,8 @@ fn offchain_worker_should_fetch_block_and_submit_unsigned_tx() {
assert_eq!(curr_evm_block, 25639556); assert_eq!(curr_evm_block, 25639556);
assert!(TapestryDrafts::<TestRuntime>::get(&evm_network_id).is_none()); assert!(TapestryDrafts::<TestRuntime>::get(&evm_network_id).is_none());
GhostWeaver::on_initialize(LOCK_BLOCK_EXPIRATION + 3u64); GhostWeaver::on_initialize(3u64);
GhostWeaver::on_initialize(LOCK_BLOCK_EXPIRATION + 4u64); GhostWeaver::on_initialize(4u64);
assert!(TapestryDrafts::<TestRuntime>::get(&evm_network_id).is_some()); assert!(TapestryDrafts::<TestRuntime>::get(&evm_network_id).is_some());
}); });
} }
@ -419,8 +414,8 @@ fn offchain_worker_should_fetch_hash_and_submit_unsigned_tx() {
ext.register_extension(TransactionPoolExt::new(pool)); ext.register_extension(TransactionPoolExt::new(pool));
ext.execute_with(|| { ext.execute_with(|| {
GhostWeaver::on_initialize(LOCK_BLOCK_EXPIRATION + 1); GhostWeaver::on_initialize(1);
GhostWeaver::on_initialize(LOCK_BLOCK_EXPIRATION + 2); GhostWeaver::on_initialize(2);
let tapestry_draft = TapestryDraftBuilder::<crate::ExternalBlockNumber, u32>::default(); let tapestry_draft = TapestryDraftBuilder::<crate::ExternalBlockNumber, u32>::default();
let evm_tapestry_draft = tapestry_draft.with_median_external(median_evm_block).build(); let evm_tapestry_draft = tapestry_draft.with_median_external(median_evm_block).build();
@ -480,8 +475,8 @@ fn offchain_worker_should_fetch_hash_and_submit_unsigned_tx() {
("Accept".into(), "application/json".into()), ("Accept".into(), "application/json".into()),
("Content-Type".into(), "application/json".into()), ("Content-Type".into(), "application/json".into()),
], ],
body: b"{\"id\":21,\"jsonrpc\":\"2.0\",\"method\":\"getblockhash\",\"params\":[960129]}".to_vec(), body: b"{\"id\":1,\"jsonrpc\":\"2.0\",\"method\":\"getblockhash\",\"params\":[960129]}".to_vec(),
response: Some(b"{\"jsonrpc\":\"2.0\",\"id\":21,\"result\":\"0000000000000000000091c72779c83d76dfa8149e950f3a5287377a9708d5c1\"}".to_vec()), response: Some(b"{\"jsonrpc\":\"2.0\",\"id\":1,\"result\":\"0000000000000000000091c72779c83d76dfa8149e950f3a5287377a9708d5c1\"}".to_vec()),
sent: true, sent: true,
..Default::default() ..Default::default()
}); });
@ -496,16 +491,16 @@ fn offchain_worker_should_fetch_hash_and_submit_unsigned_tx() {
("Authorization".into(), "Bearer new-api-token-123".into()), ("Authorization".into(), "Bearer new-api-token-123".into()),
], ],
// Match the EXACT field order: data first, then to // Match the EXACT field order: data first, then to
body: b"{\"id\":22,\"jsonrpc\":\"2.0\",\"method\":\"eth_call\",\"params\":[{\"data\":\"0x00000000000000000000000000000000000000000000000000000000000000450000000000000000000000000000000000000000000000000000000001873a84\",\"to\":\"0x02f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9\"},\"latest\"]}".to_vec(), body: b"{\"id\":2,\"jsonrpc\":\"2.0\",\"method\":\"eth_call\",\"params\":[{\"data\":\"0x00000000000000000000000000000000000000000000000000000000000000450000000000000000000000000000000000000000000000000000000001873a84\",\"to\":\"0x02f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9\"},\"latest\"]}".to_vec(),
response: Some(b"{\"jsonrpc\":\"2.0\",\"id\":22,\"result\":\"0xf72b9ef0b66c8cc3952ffd11dc0b85f3b02e6edfa9236da400138f2fcba4668d0000000000000000000000000000000000000000000000000000000000000046\"}".to_vec()), response: Some(b"{\"jsonrpc\":\"2.0\",\"id\":2,\"result\":\"0xf72b9ef0b66c8cc3952ffd11dc0b85f3b02e6edfa9236da400138f2fcba4668d0000000000000000000000000000000000000000000000000000000000000046\"}".to_vec()),
sent: true, sent: true,
..Default::default() ..Default::default()
}); });
} }
ext.execute_with(|| { ext.execute_with(|| {
System::set_block_number(LOCK_BLOCK_EXPIRATION + 1u64); System::set_block_number(1u64);
GhostWeaver::offchain_worker(LOCK_BLOCK_EXPIRATION + 1u64); GhostWeaver::offchain_worker(1u64);
let state = pool_state.read(); let state = pool_state.read();
assert_eq!(state.transactions.len(), 1); assert_eq!(state.transactions.len(), 1);
@ -538,8 +533,8 @@ fn offchain_worker_should_fetch_hash_and_submit_unsigned_tx() {
}); });
ext.execute_with(|| { ext.execute_with(|| {
System::set_block_number(LOCK_BLOCK_EXPIRATION + 2u64); System::set_block_number(2u64);
GhostWeaver::offchain_worker(LOCK_BLOCK_EXPIRATION + 2u64); GhostWeaver::offchain_worker(2u64);
let state = pool_state.read(); let state = pool_state.read();
assert_eq!(state.transactions.len(), 2); assert_eq!(state.transactions.len(), 2);
@ -562,8 +557,8 @@ fn offchain_worker_should_fetch_hash_and_submit_unsigned_tx() {
assert_eq!(curr_weaving_state.hash, block_hash); assert_eq!(curr_weaving_state.hash, block_hash);
let prev_state = LoomStates::<TestRuntime>::get(&evm_network_id, &evm_session); let prev_state = LoomStates::<TestRuntime>::get(&evm_network_id, &evm_session);
GhostWeaver::on_initialize(LOCK_BLOCK_EXPIRATION + 3u64); GhostWeaver::on_initialize(3u64);
GhostWeaver::on_initialize(LOCK_BLOCK_EXPIRATION + 4u64); GhostWeaver::on_initialize(4u64);
let curr_state = LoomStates::<TestRuntime>::get(&evm_network_id, &evm_session); let curr_state = LoomStates::<TestRuntime>::get(&evm_network_id, &evm_session);
assert_eq!(prev_state.root_hash, H256::default()); assert_eq!(prev_state.root_hash, H256::default());
@ -950,8 +945,7 @@ fn on_initialize_should_finalize_session_when_timeout_is_reached() {
let networks = vec![(network_id, new_network_data, 0u64)]; let networks = vec![(network_id, new_network_data, 0u64)];
new_test_ext(authorities, networks).execute_with(|| { new_test_ext(authorities, networks).execute_with(|| {
let current_substrate_block = LOCK_BLOCK_EXPIRATION + 10; let current_substrate_block = 10;
GhostWeaver::on_initialize(current_substrate_block); GhostWeaver::on_initialize(current_substrate_block);
System::set_block_number(current_substrate_block + 1); System::set_block_number(current_substrate_block + 1);
@ -1024,7 +1018,7 @@ fn on_initialize_should_update_at_block_when_threshold_reached_with_same_hash()
let networks = vec![(network_id, new_network_data, 0u64)]; let networks = vec![(network_id, new_network_data, 0u64)];
new_test_ext(authorities, networks).execute_with(|| { new_test_ext(authorities, networks).execute_with(|| {
let current_substrate_block = LOCK_BLOCK_EXPIRATION + 10; let current_substrate_block = 10;
let current_session = CurrentWeavingSession::<TestRuntime>::get(&network_id); let current_session = CurrentWeavingSession::<TestRuntime>::get(&network_id);
let target_hash = H256::repeat_byte(0xAA); let target_hash = H256::repeat_byte(0xAA);

View File

@ -36,20 +36,18 @@ const PROTOCOL_PREFIX: [u8; 7] = [0x69, 0x64, 0x2b, 0x5b, 0xb6, 0x66, 0xac];
const PROTOCOL_PREFIX: [u8; 7] = [0x47, 0x48, 0x53, 0x54, 0x74, 0x6F, 0x3A]; const PROTOCOL_PREFIX: [u8; 7] = [0x47, 0x48, 0x53, 0x54, 0x74, 0x6F, 0x3A];
pub enum WeavingOk<NetworkId> { pub enum WeavingOk<NetworkId> {
Skipped(NetworkId), Block(ExternalBlockNumber, NetworkId),
Block(ExternalBlockNumber, u32, NetworkId),
Hash(ExternalBlockNumber, H256, WeavingSession, NetworkId), Hash(ExternalBlockNumber, H256, WeavingSession, NetworkId),
} }
impl<NetworkId> core::fmt::Debug for WeavingOk<NetworkId> impl<NetworkId> core::fmt::Display for WeavingOk<NetworkId>
where where
NetworkId: core::fmt::Debug, NetworkId: core::fmt::Debug,
{ {
fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result { fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
match self { match self {
Self::Skipped(network_id) => write!(fmt, "Submission step skipped for network: {:?} based on probability distribution.", network_id), Self::Block(block, network_id) => write!(fmt, "Verified block height #{:?} found for network: {:?}.", block, network_id),
Self::Block(block, count, network_id) => write!(fmt, "Verified block height #{:?} for network: {:?} based on {} parsed requests.", block, network_id, count), Self::Hash(block, hash, next_session, network_id) => write!(fmt, "Extracted Merkle Root {:?} where next session is {:?}; from block #{:?} for network: {:?}.", hash, next_session, block, network_id),
Self::Hash(block, hash, next_session, network_id) => write!(fmt, "Extracted Merkle Root {:?} (next session is {:?}) from block #{:?} for network: {:?}.", hash, next_session, block, network_id),
} }
} }
} }

View File

@ -16,7 +16,7 @@
//! Autogenerated weights for `ghost_weaver` //! Autogenerated weights for `ghost_weaver`
//! //!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2026-10-29, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! DATE: 2026-09-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000` //! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz` //! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz`
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024 //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024
@ -67,16 +67,16 @@ impl WeightInfo for () {
/// The range of component `a` is `[1, 300]`. /// The range of component `a` is `[1, 300]`.
fn extend_warp(a: u32, ) -> Weight { fn extend_warp(a: u32, ) -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `274 + a * (33 ±0)` // Measured: `223 + a * (32 ±0)`
// Estimated: `3736 + a * (33 ±0)` // Estimated: `3687 + a * (32 ±0)`
// Minimum execution time: 229_711_000 picoseconds. // Minimum execution time: 212_751_000 picoseconds.
Weight::from_parts(233_206_680, 0) Weight::from_parts(215_022_916, 0)
.saturating_add(Weight::from_parts(0, 3736)) .saturating_add(Weight::from_parts(0, 3687))
// Standard Error: 1_554 // Standard Error: 1_319
.saturating_add(Weight::from_parts(66_095, 0).saturating_mul(a.into())) .saturating_add(Weight::from_parts(53_379, 0).saturating_mul(a.into()))
.saturating_add(RocksDbWeight::get().reads(6)) .saturating_add(RocksDbWeight::get().reads(5))
.saturating_add(RocksDbWeight::get().writes(2)) .saturating_add(RocksDbWeight::get().writes(1))
.saturating_add(Weight::from_parts(0, 33).saturating_mul(a.into())) .saturating_add(Weight::from_parts(0, 32).saturating_mul(a.into()))
} }
/// Storage: `GhostWeaver::DisabledAuthorities` (r:1 w:0) /// Storage: `GhostWeaver::DisabledAuthorities` (r:1 w:0)
/// Proof: `GhostWeaver::DisabledAuthorities` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Proof: `GhostWeaver::DisabledAuthorities` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
@ -93,16 +93,16 @@ impl WeightInfo for () {
/// The range of component `a` is `[1, 300]`. /// The range of component `a` is `[1, 300]`.
fn weave_weft(a: u32, ) -> Weight { fn weave_weft(a: u32, ) -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `569 + a * (33 ±0)` // Measured: `518 + a * (32 ±0)`
// Estimated: `4031 + a * (33 ±0)` // Estimated: `3982 + a * (32 ±0)`
// Minimum execution time: 262_809_000 picoseconds. // Minimum execution time: 212_751_000 picoseconds.
Weight::from_parts(267_769_707, 0) Weight::from_parts(246_374_350, 0)
.saturating_add(Weight::from_parts(0, 4031)) .saturating_add(Weight::from_parts(0, 3982))
// Standard Error: 1_865 // Standard Error: 1_865
.saturating_add(Weight::from_parts(39_109, 0).saturating_mul(a.into())) .saturating_add(Weight::from_parts(38_601, 0).saturating_mul(a.into()))
.saturating_add(RocksDbWeight::get().reads(8)) .saturating_add(RocksDbWeight::get().reads(6))
.saturating_add(RocksDbWeight::get().writes(3)) .saturating_add(RocksDbWeight::get().writes(2))
.saturating_add(Weight::from_parts(0, 33).saturating_mul(a.into())) .saturating_add(Weight::from_parts(0, 32).saturating_mul(a.into()))
} }
/// Storage: `GhostNetworks::Networks` (r:1 w:0) /// Storage: `GhostNetworks::Networks` (r:1 w:0)
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
@ -119,12 +119,12 @@ impl WeightInfo for () {
/// The range of component `a` is `[1, 144]`. /// The range of component `a` is `[1, 144]`.
fn pull_utxo_thread(a: u32, ) -> Weight { fn pull_utxo_thread(a: u32, ) -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `500` // Measured: `449`
// Estimated: `3965` // Estimated: `3914`
// Minimum execution time: 217_481_000 picoseconds. // Minimum execution time: 217_880_000 picoseconds.
Weight::from_parts(216_492_234, 0) Weight::from_parts(217_119_201, 0)
// Standard Error: 4_414 // Standard Error: 4_368
.saturating_add(Weight::from_parts(3_376_569, 0).saturating_mul(a.into())) .saturating_add(Weight::from_parts(3_445_491, 0).saturating_mul(a.into()))
.saturating_add(RocksDbWeight::get().reads(6)) .saturating_add(RocksDbWeight::get().reads(6))
.saturating_add(RocksDbWeight::get().writes(4)) .saturating_add(RocksDbWeight::get().writes(4))
} }
@ -142,11 +142,11 @@ impl WeightInfo for () {
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
fn pull_evm_thread() -> Weight { fn pull_evm_thread() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `500` // Measured: `449`
// Estimated: `3965` // Estimated: `3914`
// Minimum execution time: 176_861_000 picoseconds. // Minimum execution time: 183_413_000 picoseconds.
Weight::from_parts(177_861_000, 0) Weight::from_parts(186_271_000, 0)
.saturating_add(Weight::from_parts(0, 3965)) .saturating_add(Weight::from_parts(0, 3914))
.saturating_add(RocksDbWeight::get().reads(6)) .saturating_add(RocksDbWeight::get().reads(6))
.saturating_add(RocksDbWeight::get().writes(4)) .saturating_add(RocksDbWeight::get().writes(4))
} }

View File

@ -1,6 +1,6 @@
[package] [package]
name = "casper-runtime" name = "casper-runtime"
version = "4.0.20" version = "4.0.15"
build = "build.rs" build = "build.rs"
description = "Runtime of the Casper Network" description = "Runtime of the Casper Network"
edition.workspace = true edition.workspace = true

View File

@ -124,7 +124,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("casper"), spec_name: create_runtime_str!("casper"),
impl_name: create_runtime_str!("casper-svengali"), impl_name: create_runtime_str!("casper-svengali"),
authoring_version: 0, authoring_version: 0,
spec_version: 14, spec_version: 8,
impl_version: 0, impl_version: 0,
apis: RUNTIME_API_VERSIONS, apis: RUNTIME_API_VERSIONS,
transaction_version: 1, transaction_version: 1,
@ -1035,10 +1035,7 @@ pub type SignedExtra = (
/// All migrations that will run on the next runtime upgrade. /// All migrations that will run on the next runtime upgrade.
/// Should be cleared after release. /// Should be cleared after release.
pub type Migrations = ( pub type Migrations = ();
ghost_weaver::migrations::MigrateV0ToV1<Runtime>,
ghost_weaver::migrations::MigrateV1ToV2<Runtime>,
);
/// Unchecked extrinsic type as expected by this runtime. /// Unchecked extrinsic type as expected by this runtime.
pub type UncheckedExtrinsic = pub type UncheckedExtrinsic =

View File

@ -16,7 +16,7 @@
//! Autogenerated weights for `ghost_exodus` //! Autogenerated weights for `ghost_exodus`
//! //!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2026-10-29, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! DATE: 2026-09-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000` //! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz` //! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz`
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024 //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024
@ -46,232 +46,252 @@ use core::marker::PhantomData;
/// Weight functions for `ghost_exodus`. /// Weight functions for `ghost_exodus`.
pub struct WeightInfo<T>(PhantomData<T>); pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> ghost_exodus::WeightInfo for WeightInfo<T> { impl<T: frame_system::Config> ghost_exodus::WeightInfo for WeightInfo<T> {
/// Storage: `GhostNetworks::NetworkTypes` (r:1 w:0) /// Storage: `GhostNetworks::NetworkCurves` (r:1 w:0)
/// Proof: `GhostNetworks::NetworkTypes` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostNetworks::NetworkCurves` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::QualificationDkgState` (r:1 w:1) /// Storage: `GhostExodus::QualificationDkgState` (r:1 w:1)
/// Proof: `GhostExodus::QualificationDkgState` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::QualificationDkgState` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::Round0Packages` (r:1 w:1)
/// Proof: `GhostExodus::Round0Packages` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::QualificationAuthorities` (r:1 w:0) /// Storage: `GhostExodus::QualificationAuthorities` (r:1 w:0)
/// Proof: `GhostExodus::QualificationAuthorities` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::QualificationAuthorities` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::ExodusActivity` (r:1 w:1)
/// Proof: `GhostExodus::ExodusActivity` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::Round0Packages` (r:0 w:1)
/// Proof: `GhostExodus::Round0Packages` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn register_round0_package() -> Weight { fn register_round0_package() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `365` // Measured: `351`
// Estimated: `3830` // Estimated: `3816`
// Minimum execution time: 240_843_000 picoseconds. // Minimum execution time: 240_813_000 picoseconds.
Weight::from_parts(243_855_000, 0) Weight::from_parts(243_523_000, 0)
.saturating_add(Weight::from_parts(0, 3830)) .saturating_add(Weight::from_parts(0, 3816))
.saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().reads(4))
.saturating_add(T::DbWeight::get().writes(2)) .saturating_add(T::DbWeight::get().writes(3))
} }
/// Storage: `GhostNetworks::NetworkTypes` (r:1 w:0) /// Storage: `GhostNetworks::NetworkCurves` (r:1 w:0)
/// Proof: `GhostNetworks::NetworkTypes` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostNetworks::NetworkCurves` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::QualificationDkgState` (r:1 w:0) /// Storage: `GhostExodus::QualificationDkgState` (r:1 w:0)
/// Proof: `GhostExodus::QualificationDkgState` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::QualificationDkgState` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::QualificationAuthorities` (r:1 w:0) /// Storage: `GhostExodus::QualificationAuthorities` (r:1 w:0)
/// Proof: `GhostExodus::QualificationAuthorities` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::QualificationAuthorities` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::Round1Packages` (r:1 w:1) /// Storage: `GhostExodus::ExodusActivity` (r:1 w:1)
/// Proof: `GhostExodus::Round1Packages` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::ExodusActivity` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::Round0Packages` (r:1 w:0) /// Storage: `GhostExodus::Round0Packages` (r:1 w:0)
/// Proof: `GhostExodus::Round0Packages` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::Round0Packages` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::Round1Packages` (r:1 w:1)
/// Proof: `GhostExodus::Round1Packages` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// The range of component `c` is `[4, 300]`. /// The range of component `c` is `[4, 300]`.
fn register_round1_package(c: u32, ) -> Weight { fn register_round1_package(c: u32, ) -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `405 + c * (32 ±0)` // Measured: `391 + c * (32 ±0)`
// Estimated: `3870 + c * (32 ±0)` // Estimated: `3856 + c * (32 ±0)`
// Minimum execution time: 1_349_108_000 picoseconds. // Minimum execution time: 1_356_791_000 picoseconds.
Weight::from_parts(1_224_956_354, 0) Weight::from_parts(1_221_760_215, 0)
.saturating_add(Weight::from_parts(0, 3870)) .saturating_add(Weight::from_parts(0, 3856))
// Standard Error: 14_930 // Standard Error: 16_481
.saturating_add(Weight::from_parts(33_204_477, 0).saturating_mul(c.into())) .saturating_add(Weight::from_parts(33_163_393, 0).saturating_mul(c.into()))
.saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().reads(6))
.saturating_add(T::DbWeight::get().writes(1)) .saturating_add(T::DbWeight::get().writes(2))
.saturating_add(Weight::from_parts(0, 32).saturating_mul(c.into())) .saturating_add(Weight::from_parts(0, 32).saturating_mul(c.into()))
} }
/// Storage: `GhostNetworks::NetworkTypes` (r:1 w:0) /// Storage: `GhostNetworks::NetworkCurves` (r:1 w:0)
/// Proof: `GhostNetworks::NetworkTypes` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostNetworks::NetworkCurves` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::QualificationDkgState` (r:1 w:0) /// Storage: `GhostExodus::QualificationDkgState` (r:1 w:0)
/// Proof: `GhostExodus::QualificationDkgState` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::QualificationDkgState` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::QualificationAuthorities` (r:1 w:0)
/// Proof: `GhostExodus::QualificationAuthorities` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::ExodusActivity` (r:1 w:1)
/// Proof: `GhostExodus::ExodusActivity` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::Round2Packages` (r:1 w:1) /// Storage: `GhostExodus::Round2Packages` (r:1 w:1)
/// Proof: `GhostExodus::Round2Packages` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::Round2Packages` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::QualificationAuthorities` (r:1 w:0) /// The range of component `c` is `[1, 37]`.
/// Proof: `GhostExodus::QualificationAuthorities` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// The range of component `c` is `[1, 300]`.
fn register_encrypted_round2_packages(c: u32, ) -> Weight { fn register_encrypted_round2_packages(c: u32, ) -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `332 + c * (32 ±0)` // Measured: `317 + c * (257 ±0)`
// Estimated: `3797 + c * (32 ±0)` // Estimated: `3783 + c * (257 ±0)`
// Minimum execution time: 245_305_000 picoseconds. // Minimum execution time: 254_590_000 picoseconds.
Weight::from_parts(253_863_353, 0) Weight::from_parts(258_091_105, 0)
.saturating_add(Weight::from_parts(0, 3797)) .saturating_add(Weight::from_parts(0, 3783))
// Standard Error: 3_527 // Standard Error: 25_082
.saturating_add(Weight::from_parts(810_623, 0).saturating_mul(c.into())) .saturating_add(Weight::from_parts(6_595_878, 0).saturating_mul(c.into()))
.saturating_add(T::DbWeight::get().reads(4))
.saturating_add(T::DbWeight::get().writes(1))
.saturating_add(Weight::from_parts(0, 32).saturating_mul(c.into()))
}
/// Storage: `GhostNetworks::NetworkTypes` (r:1 w:0)
/// Proof: `GhostNetworks::NetworkTypes` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::QualificationDkgState` (r:1 w:0)
/// Proof: `GhostExodus::QualificationDkgState` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::Complaints` (r:1 w:1)
/// Proof: `GhostExodus::Complaints` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::QualificationAuthorities` (r:1 w:0)
/// Proof: `GhostExodus::QualificationAuthorities` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// The range of component `c` is `[1, 300]`.
fn register_round3_complaints(c: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `332 + c * (32 ±0)`
// Estimated: `3797 + c * (32 ±0)`
// Minimum execution time: 238_391_000 picoseconds.
Weight::from_parts(242_937_380, 0)
.saturating_add(Weight::from_parts(0, 3797))
// Standard Error: 1_789
.saturating_add(Weight::from_parts(39_316, 0).saturating_mul(c.into()))
.saturating_add(T::DbWeight::get().reads(4))
.saturating_add(T::DbWeight::get().writes(1))
.saturating_add(Weight::from_parts(0, 32).saturating_mul(c.into()))
}
/// Storage: `GhostNetworks::NetworkTypes` (r:1 w:0)
/// Proof: `GhostNetworks::NetworkTypes` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::QualificationDkgState` (r:1 w:0)
/// Proof: `GhostExodus::QualificationDkgState` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::Justifications` (r:1 w:1)
/// Proof: `GhostExodus::Justifications` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::QualificationAuthorities` (r:1 w:0)
/// Proof: `GhostExodus::QualificationAuthorities` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// The range of component `c` is `[1, 300]`.
fn register_round4_justifications(c: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `332 + c * (32 ±0)`
// Estimated: `3797 + c * (32 ±0)`
// Minimum execution time: 245_916_000 picoseconds.
Weight::from_parts(251_070_206, 0)
.saturating_add(Weight::from_parts(0, 3797))
// Standard Error: 2_152
.saturating_add(Weight::from_parts(508_508, 0).saturating_mul(c.into()))
.saturating_add(T::DbWeight::get().reads(4))
.saturating_add(T::DbWeight::get().writes(1))
.saturating_add(Weight::from_parts(0, 32).saturating_mul(c.into()))
}
/// Storage: `GhostNetworks::NetworkTypes` (r:1 w:0)
/// Proof: `GhostNetworks::NetworkTypes` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::QualificationDkgState` (r:1 w:0)
/// Proof: `GhostExodus::QualificationDkgState` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::VerifyingKeyConsensus` (r:1 w:1)
/// Proof: `GhostExodus::VerifyingKeyConsensus` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::QualificationAuthorities` (r:1 w:0)
/// Proof: `GhostExodus::QualificationAuthorities` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::Verifications` (r:1 w:1)
/// Proof: `GhostExodus::Verifications` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn register_round5_verifying_package() -> Weight {
// Proof Size summary in bytes:
// Measured: `462`
// Estimated: `3927`
// Minimum execution time: 271_654_000 picoseconds.
Weight::from_parts(286_394_000, 0)
.saturating_add(Weight::from_parts(0, 3927))
.saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().reads(5))
.saturating_add(T::DbWeight::get().writes(2)) .saturating_add(T::DbWeight::get().writes(2))
.saturating_add(Weight::from_parts(0, 257).saturating_mul(c.into()))
} }
/// Storage: `GhostNetworks::NetworkTypes` (r:1 w:0) /// Storage: `GhostNetworks::NetworkCurves` (r:1 w:0)
/// Proof: `GhostNetworks::NetworkTypes` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostNetworks::NetworkCurves` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::QualificationDkgState` (r:1 w:0) /// Storage: `GhostExodus::QualificationDkgState` (r:1 w:0)
/// Proof: `GhostExodus::QualificationDkgState` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::QualificationDkgState` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::VerifyingSharesParticipants` (r:1 w:1)
/// Proof: `GhostExodus::VerifyingSharesParticipants` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::QualificationAuthorities` (r:1 w:0) /// Storage: `GhostExodus::QualificationAuthorities` (r:1 w:0)
/// Proof: `GhostExodus::QualificationAuthorities` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::QualificationAuthorities` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::ExodusActivity` (r:1 w:1)
/// Proof: `GhostExodus::ExodusActivity` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::Complaints` (r:1 w:1)
/// Proof: `GhostExodus::Complaints` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// The range of component `c` is `[1, 37]`.
fn register_round3_complaints(c: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `317 + c * (257 ±0)`
// Estimated: `3783 + c * (257 ±0)`
// Minimum execution time: 240_888_000 picoseconds.
Weight::from_parts(245_480_975, 0)
.saturating_add(Weight::from_parts(0, 3783))
// Standard Error: 13_733
.saturating_add(Weight::from_parts(371_161, 0).saturating_mul(c.into()))
.saturating_add(T::DbWeight::get().reads(5))
.saturating_add(T::DbWeight::get().writes(2))
.saturating_add(Weight::from_parts(0, 257).saturating_mul(c.into()))
}
/// Storage: `GhostNetworks::NetworkCurves` (r:1 w:0)
/// Proof: `GhostNetworks::NetworkCurves` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::QualificationDkgState` (r:1 w:0)
/// Proof: `GhostExodus::QualificationDkgState` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::QualificationAuthorities` (r:1 w:0)
/// Proof: `GhostExodus::QualificationAuthorities` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::ExodusActivity` (r:1 w:1)
/// Proof: `GhostExodus::ExodusActivity` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::Justifications` (r:1 w:1)
/// Proof: `GhostExodus::Justifications` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// The range of component `c` is `[1, 37]`.
fn register_round4_justifications(c: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `317 + c * (257 ±0)`
// Estimated: `3783 + c * (257 ±0)`
// Minimum execution time: 251_521_000 picoseconds.
Weight::from_parts(253_053_636, 0)
.saturating_add(Weight::from_parts(0, 3783))
// Standard Error: 14_691
.saturating_add(Weight::from_parts(4_101_872, 0).saturating_mul(c.into()))
.saturating_add(T::DbWeight::get().reads(5))
.saturating_add(T::DbWeight::get().writes(2))
.saturating_add(Weight::from_parts(0, 257).saturating_mul(c.into()))
}
/// Storage: `GhostNetworks::NetworkCurves` (r:1 w:0)
/// Proof: `GhostNetworks::NetworkCurves` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::QualificationDkgState` (r:1 w:0)
/// Proof: `GhostExodus::QualificationDkgState` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::QualificationAuthorities` (r:1 w:0)
/// Proof: `GhostExodus::QualificationAuthorities` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::ExodusActivity` (r:1 w:1)
/// Proof: `GhostExodus::ExodusActivity` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::Verifications` (r:1 w:1)
/// Proof: `GhostExodus::Verifications` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::VerifyingKeyConsensus` (r:1 w:1)
/// Proof: `GhostExodus::VerifyingKeyConsensus` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn register_round5_verifying_package() -> Weight {
// Proof Size summary in bytes:
// Measured: `448`
// Estimated: `3913`
// Minimum execution time: 265_187_000 picoseconds.
Weight::from_parts(269_124_000, 0)
.saturating_add(Weight::from_parts(0, 3913))
.saturating_add(T::DbWeight::get().reads(6))
.saturating_add(T::DbWeight::get().writes(3))
}
/// Storage: `GhostNetworks::NetworkCurves` (r:1 w:0)
/// Proof: `GhostNetworks::NetworkCurves` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::QualificationDkgState` (r:1 w:0)
/// Proof: `GhostExodus::QualificationDkgState` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::QualificationAuthorities` (r:1 w:0)
/// Proof: `GhostExodus::QualificationAuthorities` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::ExodusActivity` (r:1 w:1)
/// Proof: `GhostExodus::ExodusActivity` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::VerifyingKeyConsensus` (r:1 w:0) /// Storage: `GhostExodus::VerifyingKeyConsensus` (r:1 w:0)
/// Proof: `GhostExodus::VerifyingKeyConsensus` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::VerifyingKeyConsensus` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::VerifyingShares` (r:1 w:1) /// Storage: `GhostExodus::VerifyingShares` (r:1 w:1)
/// Proof: `GhostExodus::VerifyingShares` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::VerifyingShares` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::VerifyingSharesParticipants` (r:1 w:1)
/// Proof: `GhostExodus::VerifyingSharesParticipants` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// The range of component `c` is `[1, 9]`. /// The range of component `c` is `[1, 9]`.
fn register_round6_public_share_package(c: u32, ) -> Weight { fn register_round6_public_share_package(c: u32, ) -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `0 + c * (770 ±0)` // Measured: `0 + c * (770 ±0)`
// Estimated: `1698 + c * (1019 ±27)` // Estimated: `1551 + c * (1019 ±27)`
// Minimum execution time: 283_863_000 picoseconds. // Minimum execution time: 284_558_000 picoseconds.
Weight::from_parts(286_691_978, 0) Weight::from_parts(284_117_484, 0)
.saturating_add(Weight::from_parts(0, 1698)) .saturating_add(Weight::from_parts(0, 1551))
// Standard Error: 85_685 // Standard Error: 74_361
.saturating_add(Weight::from_parts(2_854_037, 0).saturating_mul(c.into())) .saturating_add(Weight::from_parts(3_551_271, 0).saturating_mul(c.into()))
.saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().reads(7))
.saturating_add(T::DbWeight::get().writes(2)) .saturating_add(T::DbWeight::get().writes(3))
.saturating_add(Weight::from_parts(0, 1019).saturating_mul(c.into())) .saturating_add(Weight::from_parts(0, 1019).saturating_mul(c.into()))
} }
/// Storage: `GhostNetworks::NetworkTypes` (r:1 w:0) /// Storage: `GhostNetworks::NetworkCurves` (r:1 w:0)
/// Proof: `GhostNetworks::NetworkTypes` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostNetworks::NetworkCurves` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::QualificationDkgState` (r:1 w:0) /// Storage: `GhostExodus::QualificationDkgState` (r:1 w:0)
/// Proof: `GhostExodus::QualificationDkgState` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::QualificationDkgState` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::ActiveDkgAuthorities` (r:1 w:0) /// Storage: `GhostExodus::ActiveDkgAuthorities` (r:1 w:0)
/// Proof: `GhostExodus::ActiveDkgAuthorities` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::ActiveDkgAuthorities` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::ActiveAuthorities` (r:1 w:0)
/// Proof: `GhostExodus::ActiveAuthorities` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::ExodusRequests` (r:1 w:1) /// Storage: `GhostExodus::ExodusRequests` (r:1 w:1)
/// Proof: `GhostExodus::ExodusRequests` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::ExodusRequests` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::RoastSessions` (r:1 w:1) /// Storage: `GhostExodus::RoastSessions` (r:1 w:1)
/// Proof: `GhostExodus::RoastSessions` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::RoastSessions` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::NonceCommitments` (r:1 w:1) /// Storage: `GhostExodus::ExodusActivity` (r:1 w:1)
/// Proof: `GhostExodus::NonceCommitments` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::ExodusActivity` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::ActiveAuthorities` (r:1 w:0)
/// Proof: `GhostExodus::ActiveAuthorities` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::RoastSessionStates` (r:1 w:1) /// Storage: `GhostExodus::RoastSessionStates` (r:1 w:1)
/// Proof: `GhostExodus::RoastSessionStates` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::RoastSessionStates` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::NonceCommitments` (r:0 w:1)
/// Proof: `GhostExodus::NonceCommitments` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn register_nonce_commitment() -> Weight { fn register_nonce_commitment() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `633` // Measured: `627`
// Estimated: `4098` // Estimated: `4092`
// Minimum execution time: 369_666_000 picoseconds. // Minimum execution time: 315_066_000 picoseconds.
Weight::from_parts(373_163_000, 0) Weight::from_parts(318_561_000, 0)
.saturating_add(Weight::from_parts(0, 4098)) .saturating_add(Weight::from_parts(0, 4092))
.saturating_add(T::DbWeight::get().reads(8)) .saturating_add(T::DbWeight::get().reads(8))
.saturating_add(T::DbWeight::get().writes(4)) .saturating_add(T::DbWeight::get().writes(5))
} }
/// Storage: `GhostNetworks::NetworkTypes` (r:1 w:0) /// Storage: `GhostNetworks::NetworkCurves` (r:1 w:0)
/// Proof: `GhostNetworks::NetworkTypes` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostNetworks::NetworkCurves` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::QualificationDkgState` (r:1 w:0) /// Storage: `GhostExodus::QualificationDkgState` (r:1 w:0)
/// Proof: `GhostExodus::QualificationDkgState` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::QualificationDkgState` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::ActiveDkgAuthorities` (r:1 w:0) /// Storage: `GhostExodus::ActiveDkgAuthorities` (r:1 w:0)
/// Proof: `GhostExodus::ActiveDkgAuthorities` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::ActiveDkgAuthorities` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::RoastSessions` (r:1 w:0)
/// Proof: `GhostExodus::RoastSessions` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::RoastSessionStates` (r:1 w:1)
/// Proof: `GhostExodus::RoastSessionStates` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::ActiveAuthorities` (r:1 w:0) /// Storage: `GhostExodus::ActiveAuthorities` (r:1 w:0)
/// Proof: `GhostExodus::ActiveAuthorities` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::ActiveAuthorities` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::RoastSessions` (r:1 w:0)
/// Proof: `GhostExodus::RoastSessions` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::ExodusActivity` (r:1 w:1)
/// Proof: `GhostExodus::ExodusActivity` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::ExodusRequests` (r:1 w:0) /// Storage: `GhostExodus::ExodusRequests` (r:1 w:0)
/// Proof: `GhostExodus::ExodusRequests` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::ExodusRequests` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::GroupCommitters` (r:1 w:1) /// Storage: `GhostExodus::GroupCommitters` (r:1 w:1)
/// Proof: `GhostExodus::GroupCommitters` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::GroupCommitters` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::RoastSessionStates` (r:1 w:1)
/// Proof: `GhostExodus::RoastSessionStates` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::GroupCommitmentsConsensus` (r:1 w:1) /// Storage: `GhostExodus::GroupCommitmentsConsensus` (r:1 w:1)
/// Proof: `GhostExodus::GroupCommitmentsConsensus` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::GroupCommitmentsConsensus` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn register_group_commitment() -> Weight { fn register_group_commitment() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `1030` // Measured: `992`
// Estimated: `4495` // Estimated: `4457`
// Minimum execution time: 339_569_000 picoseconds. // Minimum execution time: 338_644_000 picoseconds.
Weight::from_parts(341_788_000, 0) Weight::from_parts(343_954_000, 0)
.saturating_add(Weight::from_parts(0, 4495)) .saturating_add(Weight::from_parts(0, 4457))
.saturating_add(T::DbWeight::get().reads(9)) .saturating_add(T::DbWeight::get().reads(10))
.saturating_add(T::DbWeight::get().writes(3)) .saturating_add(T::DbWeight::get().writes(4))
} }
/// Storage: `GhostNetworks::NetworkTypes` (r:1 w:0) /// Storage: `GhostNetworks::NetworkCurves` (r:1 w:0)
/// Proof: `GhostNetworks::NetworkTypes` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostNetworks::NetworkCurves` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::QualificationDkgState` (r:1 w:0) /// Storage: `GhostExodus::QualificationDkgState` (r:1 w:0)
/// Proof: `GhostExodus::QualificationDkgState` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::QualificationDkgState` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::ActiveDkgAuthorities` (r:1 w:0) /// Storage: `GhostExodus::ActiveDkgAuthorities` (r:1 w:0)
/// Proof: `GhostExodus::ActiveDkgAuthorities` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::ActiveDkgAuthorities` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::RoastSessions` (r:1 w:1)
/// Proof: `GhostExodus::RoastSessions` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::RoastSessionStates` (r:1 w:1)
/// Proof: `GhostExodus::RoastSessionStates` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::ActiveAuthorities` (r:1 w:0) /// Storage: `GhostExodus::ActiveAuthorities` (r:1 w:0)
/// Proof: `GhostExodus::ActiveAuthorities` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::ActiveAuthorities` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::RoastSessions` (r:1 w:1)
/// Proof: `GhostExodus::RoastSessions` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::ExodusActivity` (r:1 w:1)
/// Proof: `GhostExodus::ExodusActivity` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::GroupCommitmentsConsensus` (r:1 w:1) /// Storage: `GhostExodus::GroupCommitmentsConsensus` (r:1 w:1)
/// Proof: `GhostExodus::GroupCommitmentsConsensus` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::GroupCommitmentsConsensus` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::ExodusRequests` (r:1 w:1) /// Storage: `GhostExodus::ExodusRequests` (r:1 w:1)
/// Proof: `GhostExodus::ExodusRequests` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::ExodusRequests` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::ExodusSignedGovernance` (r:1 w:1) /// Storage: `GhostExodus::ExodusSignedGovernance` (r:1 w:1)
/// Proof: `GhostExodus::ExodusSignedGovernance` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::ExodusSignedGovernance` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::RoastSessionStates` (r:1 w:1)
/// Proof: `GhostExodus::RoastSessionStates` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::NonceCommitments` (r:1 w:0) /// Storage: `GhostExodus::NonceCommitments` (r:1 w:0)
/// Proof: `GhostExodus::NonceCommitments` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::NonceCommitments` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::VerifyingShares` (r:1 w:0) /// Storage: `GhostExodus::VerifyingShares` (r:1 w:0)
@ -286,13 +306,13 @@ impl<T: frame_system::Config> ghost_exodus::WeightInfo for WeightInfo<T> {
/// Proof: `GhostExodus::GroupCommitters` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::GroupCommitters` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn register_signature_share() -> Weight { fn register_signature_share() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `11337` // Measured: `11299`
// Estimated: `14802` // Estimated: `14764`
// Minimum execution time: 4_046_065_000 picoseconds. // Minimum execution time: 3_968_938_000 picoseconds.
Weight::from_parts(4_059_064_000, 0) Weight::from_parts(3_975_088_000, 0)
.saturating_add(Weight::from_parts(0, 14802)) .saturating_add(Weight::from_parts(0, 14764))
.saturating_add(T::DbWeight::get().reads(14)) .saturating_add(T::DbWeight::get().reads(15))
.saturating_add(T::DbWeight::get().writes(8)) .saturating_add(T::DbWeight::get().writes(9))
} }
/// Storage: `GhostExodus::CounterForExodusRequests` (r:1 w:1) /// Storage: `GhostExodus::CounterForExodusRequests` (r:1 w:1)
/// Proof: `GhostExodus::CounterForExodusRequests` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::CounterForExodusRequests` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
@ -304,17 +324,17 @@ impl<T: frame_system::Config> ghost_exodus::WeightInfo for WeightInfo<T> {
/// Proof: `GhostNetworks::NetworkImbalance` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Proof: `GhostNetworks::NetworkImbalance` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::QualificationDkgState` (r:1 w:0) /// Storage: `GhostExodus::QualificationDkgState` (r:1 w:0)
/// Proof: `GhostExodus::QualificationDkgState` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::QualificationDkgState` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::CurrentExodusSessions` (r:1 w:1) /// Storage: `GhostExodus::CurrentExodus` (r:1 w:1)
/// Proof: `GhostExodus::CurrentExodusSessions` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::CurrentExodus` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::ExodusRequests` (r:1 w:1) /// Storage: `GhostExodus::ExodusRequests` (r:1 w:1)
/// Proof: `GhostExodus::ExodusRequests` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostExodus::ExodusRequests` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn register_evm_bridge_out_exodus() -> Weight { fn register_evm_bridge_out_exodus() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `457` // Measured: `448`
// Estimated: `3922` // Estimated: `3913`
// Minimum execution time: 195_417_000 picoseconds. // Minimum execution time: 191_374_000 picoseconds.
Weight::from_parts(196_842_000, 0) Weight::from_parts(192_991_000, 0)
.saturating_add(Weight::from_parts(0, 3922)) .saturating_add(Weight::from_parts(0, 3913))
.saturating_add(T::DbWeight::get().reads(7)) .saturating_add(T::DbWeight::get().reads(7))
.saturating_add(T::DbWeight::get().writes(5)) .saturating_add(T::DbWeight::get().writes(5))
} }

View File

@ -16,7 +16,7 @@
//! Autogenerated weights for `ghost_governance` //! Autogenerated weights for `ghost_governance`
//! //!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2026-10-29, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! DATE: 2026-09-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000` //! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz` //! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz`
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024 //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024
@ -61,11 +61,11 @@ impl<T: frame_system::Config> ghost_governance::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `283` // Measured: `283`
// Estimated: `3748` // Estimated: `3748`
// Minimum execution time: 224_852_000 picoseconds. // Minimum execution time: 229_254_000 picoseconds.
Weight::from_parts(225_347_733, 0) Weight::from_parts(229_992_093, 0)
.saturating_add(Weight::from_parts(0, 3748)) .saturating_add(Weight::from_parts(0, 3748))
// Standard Error: 21_234 // Standard Error: 25_680
.saturating_add(Weight::from_parts(1_581_800, 0).saturating_mul(p.into())) .saturating_add(Weight::from_parts(1_874_433, 0).saturating_mul(p.into()))
.saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().reads(5))
.saturating_add(T::DbWeight::get().writes(5)) .saturating_add(T::DbWeight::get().writes(5))
} }

View File

@ -16,7 +16,7 @@
//! Autogenerated weights for `ghost_weaver` //! Autogenerated weights for `ghost_weaver`
//! //!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2026-10-29, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! DATE: 2026-09-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000` //! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz` //! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz`
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024 //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024
@ -46,40 +46,34 @@ use core::marker::PhantomData;
/// Weight functions for `ghost_weaver`. /// Weight functions for `ghost_weaver`.
pub struct WeightInfo<T>(PhantomData<T>); pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> ghost_weaver::WeightInfo for WeightInfo<T> { impl<T: frame_system::Config> ghost_weaver::WeightInfo for WeightInfo<T> {
/// Storage: `GhostWeaver::Authorities` (r:1 w:0)
/// Proof: `GhostWeaver::Authorities` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `GhostWeaver::AttestedBlocks` (r:1 w:1)
/// Proof: `GhostWeaver::AttestedBlocks` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostWeaver::NetworkAttestations` (r:1 w:1)
/// Proof: `GhostWeaver::NetworkAttestations` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostWeaver::DisabledAuthorities` (r:1 w:0) /// Storage: `GhostWeaver::DisabledAuthorities` (r:1 w:0)
/// Proof: `GhostWeaver::DisabledAuthorities` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Proof: `GhostWeaver::DisabledAuthorities` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `GhostWeaver::Authorities` (r:1 w:0)
/// Proof: `GhostWeaver::Authorities` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `GhostNetworks::Networks` (r:1 w:0) /// Storage: `GhostNetworks::Networks` (r:1 w:0)
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostWeaver::TapestryDrafts` (r:1 w:0) /// Storage: `GhostWeaver::TapestryDrafts` (r:1 w:0)
/// Proof: `GhostWeaver::TapestryDrafts` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostWeaver::TapestryDrafts` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostWeaver::NetworkAttestations` (r:1 w:1)
/// Proof: `GhostWeaver::NetworkAttestations` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// The range of component `a` is `[1, 300]`. /// The range of component `a` is `[1, 300]`.
fn extend_warp(a: u32, ) -> Weight { fn extend_warp(a: u32, ) -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `274 + a * (33 ±0)` // Measured: `223 + a * (32 ±0)`
// Estimated: `3736 + a * (33 ±0)` // Estimated: `3687 + a * (32 ±0)`
// Minimum execution time: 229_711_000 picoseconds. // Minimum execution time: 212_751_000 picoseconds.
Weight::from_parts(235_206_680, 0) Weight::from_parts(215_022_916, 0)
.saturating_add(Weight::from_parts(0, 3736)) .saturating_add(Weight::from_parts(0, 3687))
// Standard Error: 1_554 // Standard Error: 1_319
.saturating_add(Weight::from_parts(66_905, 0).saturating_mul(a.into())) .saturating_add(Weight::from_parts(53_379, 0).saturating_mul(a.into()))
.saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().reads(5))
.saturating_add(T::DbWeight::get().writes(2)) .saturating_add(T::DbWeight::get().writes(1))
.saturating_add(Weight::from_parts(0, 33).saturating_mul(a.into())) .saturating_add(Weight::from_parts(0, 32).saturating_mul(a.into()))
} }
/// Storage: `GhostWeaver::Authorities` (r:1 w:0)
/// Proof: `GhostWeaver::Authorities` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `GhostWeaver::AttestedBlocks` (r:1 w:1)
/// Proof: `GhostWeaver::AttestedBlocks` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostWeaver::NetworkAttestations` (r:1 w:0)
/// Proof: `GhostWeaver::NetworkAttestations` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostWeaver::DisabledAuthorities` (r:1 w:0) /// Storage: `GhostWeaver::DisabledAuthorities` (r:1 w:0)
/// Proof: `GhostWeaver::DisabledAuthorities` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Proof: `GhostWeaver::DisabledAuthorities` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `GhostWeaver::Authorities` (r:1 w:0)
/// Proof: `GhostWeaver::Authorities` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `GhostNetworks::Networks` (r:1 w:0) /// Storage: `GhostNetworks::Networks` (r:1 w:0)
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostWeaver::TapestryDrafts` (r:1 w:0) /// Storage: `GhostWeaver::TapestryDrafts` (r:1 w:0)
@ -91,16 +85,16 @@ impl<T: frame_system::Config> ghost_weaver::WeightInfo for WeightInfo<T> {
/// The range of component `a` is `[1, 300]`. /// The range of component `a` is `[1, 300]`.
fn weave_weft(a: u32, ) -> Weight { fn weave_weft(a: u32, ) -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `569 + a * (33 ±0)` // Measured: `518 + a * (32 ±0)`
// Estimated: `4031 + a * (33 ±0)` // Estimated: `3982 + a * (32 ±0)`
// Minimum execution time: 262_809_000 picoseconds. // Minimum execution time: 243_006_000 picoseconds.
Weight::from_parts(267_769_707, 0) Weight::from_parts(246_374_350, 0)
.saturating_add(Weight::from_parts(0, 4031)) .saturating_add(Weight::from_parts(0, 3982))
// Standard Error: 2_375 // Standard Error: 1_865
.saturating_add(Weight::from_parts(39_109, 0).saturating_mul(a.into())) .saturating_add(Weight::from_parts(38_601, 0).saturating_mul(a.into()))
.saturating_add(T::DbWeight::get().reads(8)) .saturating_add(T::DbWeight::get().reads(6))
.saturating_add(T::DbWeight::get().writes(3)) .saturating_add(T::DbWeight::get().writes(2))
.saturating_add(Weight::from_parts(0, 33).saturating_mul(a.into())) .saturating_add(Weight::from_parts(0, 32).saturating_mul(a.into()))
} }
/// Storage: `GhostNetworks::Networks` (r:1 w:0) /// Storage: `GhostNetworks::Networks` (r:1 w:0)
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
@ -117,13 +111,13 @@ impl<T: frame_system::Config> ghost_weaver::WeightInfo for WeightInfo<T> {
/// The range of component `a` is `[1, 144]`. /// The range of component `a` is `[1, 144]`.
fn pull_utxo_thread(a: u32, ) -> Weight { fn pull_utxo_thread(a: u32, ) -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `500` // Measured: `449`
// Estimated: `3965` // Estimated: `3914`
// Minimum execution time: 217_481_000 picoseconds. // Minimum execution time: 217_880_000 picoseconds.
Weight::from_parts(216_492_234, 0) Weight::from_parts(217_119_201, 0)
.saturating_add(Weight::from_parts(0, 3965)) .saturating_add(Weight::from_parts(0, 3914))
// Standard Error: 4_414 // Standard Error: 5_460
.saturating_add(Weight::from_parts(3_376_569, 0).saturating_mul(a.into())) .saturating_add(Weight::from_parts(3_445_491, 0).saturating_mul(a.into()))
.saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().reads(6))
.saturating_add(T::DbWeight::get().writes(4)) .saturating_add(T::DbWeight::get().writes(4))
} }
@ -141,11 +135,11 @@ impl<T: frame_system::Config> ghost_weaver::WeightInfo for WeightInfo<T> {
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
fn pull_evm_thread() -> Weight { fn pull_evm_thread() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `500` // Measured: `449`
// Estimated: `3965` // Estimated: `3914`
// Minimum execution time: 176_861_000 picoseconds. // Minimum execution time: 183_413_000 picoseconds.
Weight::from_parts(177_918_000, 0) Weight::from_parts(186_271_000, 0)
.saturating_add(Weight::from_parts(0, 3965)) .saturating_add(Weight::from_parts(0, 3914))
.saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().reads(6))
.saturating_add(T::DbWeight::get().writes(4)) .saturating_add(T::DbWeight::get().writes(4))
} }

View File

@ -20,11 +20,10 @@ MORDOR_RPC=(
HOODI_RPC=( HOODI_RPC=(
"https://rpc.hoodi.ethpandaops.io" "https://rpc.hoodi.ethpandaops.io"
"https://0xrpc.io/hoodi" "https://0xrpc.io/hoodi"
"https://ethereum-hoodi.gateway.tatum.io"
"https://rpc.sentio.xyz/hoodi" "https://rpc.sentio.xyz/hoodi"
) )
HOODI_GATEKEEPER="0xc9D5f50e17eeEAF39E0D0cDbbcF4B04FA4A4Bbd6"
show_help() { show_help() {
cat << EOF cat << EOF
Usage: $(basename "$0") [OPTIONS] Usage: $(basename "$0") [OPTIONS]
@ -59,66 +58,20 @@ spinner() {
tput cnorm tput cnorm
} }
pad32() {
local h="$1"
h="${h#0x}"
printf "%064s" "$h" | tr ' ' '0'
}
build_calldata() {
local selector="$1"
local at_block="$2"
local s_hex
local b_hex
s_hex=$(printf "%x" 0)
b_hex=$(printf "%x" "$at_block")
echo "0x${selector#0x}$(pad32 "$s_hex")$(pad32 "$b_hex")"
}
decode_get_root() {
local res_json="$1"
local hex
hex=$(echo "$res_json" | grep -o '"result":"[^"]*' | cut -d'"' -f4)
if [[ -z "$hex" || "$hex" == "null" ]]; then
echo "ERROR"
return
fi
hex="${hex#0x}"
if (( ${#hex} < 128 )); then
echo "ERROR"
return
fi
local word1="${hex:0:64}"
local word2="${hex:64:64}"
local num
num=$(printf "%d" "0x$word2" 2>/dev/null)
[[ -z "$num" ]] && num="$word2"
echo "0x${word1} ${num}"
}
check_network() { check_network() {
local name=$1 local name=$1
local gatekeeper=$2 shift
shift 2
local rpcs=("$@") local rpcs=("$@")
local target_dir="${OUT_DIR:-/tmp}" local target_dir="${OUT_DIR:-/tmp}"
local tmp_file="${target_dir}/$(date +%s)_${name,,}" local tmp_file="${target_dir}/$(date +%s)_${name,,}"
local root_width=66
local sess_width=6
local max_len=0 local max_len=0
for e in "${rpcs[@]}"; do (( ${#e} > max_len )) && max_len=${#e}; done for e in "${rpcs[@]}"; do (( ${#e} > max_len )) && max_len=${#e}; done
[[ $max_len -lt 20 ]] && max_len=20 [[ $max_len -lt 20 ]] && max_len=20
local total_width=$(( max_len + 95 )) local total_width=$(( max_len + 32 ))
local line=$(printf "%.0s-" $(seq 1 $total_width)) local line=$(printf "%.0s-" $(seq 1 $total_width))
local header_fmt="| %-${max_len}s | %-10s | %-${root_width}s | %-${sess_width}s |\n" local header_fmt="| %-${max_len}s | %-12s | %-10s |\n"
( (
for endpoint in "${rpcs[@]}"; do for endpoint in "${rpcs[@]}"; do
@ -127,15 +80,11 @@ check_network() {
hex=$(echo "$res_b" | grep -o '"result":"[^"]*' | cut -d'"' -f4) hex=$(echo "$res_b" | grep -o '"result":"[^"]*' | cut -d'"' -f4)
[[ -n "$hex" && "$hex" != "null" ]] && blk=$(printf "%d" "$hex") || blk="ERROR" [[ -n "$hex" && "$hex" != "null" ]] && blk=$(printf "%d" "$hex") || blk="ERROR"
root="N/A" res_l=$(curl -s -X POST -H "Content-Type: application/json" --max-time 10 \
if [[ -n "$blk" && "$blk" != "ERROR" ]]; then --data '{"jsonrpc":"2.0","method":"eth_getLogs","params":[{"fromBlock":"0x1","toBlock":"0x2"}],"id":1}' "$endpoint")
calldata=$(build_calldata "$SELECTOR" "$blk") echo "$res_l" | grep -q '"result"' && ev="YES" || ev="NO"
payload=$(printf '{"jsonrpc":"2.0","method":"eth_call","params":[{"to":"%s","data":"%s"},"latest"],"id":1}' "$gatekeeper" "$calldata")
res_c=$(curl -s -X POST -H "Content-Type: application/json" --max-time 10 --data "$payload" "$endpoint")
root=$(decode_get_root "$res_c")
fi
echo "$endpoint|$blk|$root" echo "$endpoint|$blk|$ev"
done done
) > "$tmp_file" & ) > "$tmp_file" &
@ -145,17 +94,10 @@ check_network() {
spinner $worker_pid "$name" spinner $worker_pid "$name"
local table_output="$line\n" local table_output="$line\n"
table_output+=$(printf "$header_fmt" "Endpoint" "Block" "Merkle Root" "Session")"\n" table_output+=$(printf "$header_fmt" "Endpoint" "Block" "Events")"\n"
table_output+="$line\n" table_output+="$line\n"
while IFS="|" read -r url blk root; do while IFS="|" read -r url blk ev; do
if [[ "$root" == *" "* ]]; then table_output+=$(printf "$header_fmt" "$url" "$blk" "$ev")"\n"
hash="${root%% *}"
sess="${root##* }"
else
hash="$root"
sess="-"
fi
table_output+=$(printf "$header_fmt" "$url" "$blk" "$hash" "$sess")"\n"
done < "$tmp_file" done < "$tmp_file"
table_output+="$line" table_output+="$line"
@ -169,7 +111,6 @@ check_network() {
CHOSEN_CHAIN="" CHOSEN_CHAIN=""
BASE_OUT_DIR="" BASE_OUT_DIR=""
CUSTOM_RPCS="" CUSTOM_RPCS=""
SELECTOR="d4be7935"
while [[ $# -gt 0 ]]; do while [[ $# -gt 0 ]]; do
case "$1" in case "$1" in
@ -191,14 +132,14 @@ if [[ -n "$CUSTOM_RPCS" ]]; then
check_network "Custom" "${USER_RPC_ARRAY[@]}" check_network "Custom" "${USER_RPC_ARRAY[@]}"
else else
if [ "$CHOSEN_CHAIN" == "sepolia" ]; then if [ "$CHOSEN_CHAIN" == "sepolia" ]; then
check_network "Sepolia" "$SEPOLIA_GATEKEEPER" "${HOODI_RPC[@]}" check_network "Sepolia" "${SEPOLIA_RPC[@]}"
elif [ "$CHOSEN_CHAIN" == "mordor" ]; then elif [ "$CHOSEN_CHAIN" == "mordor" ]; then
check_network "Mordor" "$MORDOR_GATEKEEPER" "${HOODI_RPC[@]}" check_network "Mordor" "${MORDOR_RPC[@]}"
elif [ "$CHOSEN_CHAIN" == "hoodi" ]; then elif [ "$CHOSEN_CHAIN" == "hoodi" ]; then
check_network "Hoodi" "$HOODI_GATEKEEPER" "${HOODI_RPC[@]}" check_network "Hoodi" "${HOODI_RPC[@]}"
else else
check_network "Sepolia" "$SEPOLIA_GATEKEEPER" "${SEPOLIA_RPC[@]}" check_network "Sepolia" "${SEPOLIA_RPC[@]}"
check_network "Mordor" "$MORDOR_GATEKEEPER" "${MORDOR_RPC[@]}" check_network "Mordor" "${MORDOR_RPC[@]}"
check_network "Hoodi" "$HOODI_GATEKEEPER" "${HOODI_RPC[@]}" check_network "Hoodi" "${HOODI_RPC[@]}"
fi fi
fi fi

View File

@ -9,7 +9,6 @@ UNIT_FILE=false
SKIP_BUILD=false SKIP_BUILD=false
SET_ENVIRONMENT=false SET_ENVIRONMENT=false
VALIDATE=false VALIDATE=false
FIX_WEAVER_KEYSTORE=false
EXECUTABLE_PATH="/usr/bin/" EXECUTABLE_PATH="/usr/bin/"
SPECIFICATION_PATH="/etc/ghost/" SPECIFICATION_PATH="/etc/ghost/"
BASE_PATH="/var/lib/ghost" BASE_PATH="/var/lib/ghost"
@ -121,8 +120,7 @@ help() {
echo -e "-s, --base-path\n\tPath to the folder with chain database ('/var/lib/ghost' is default)." echo -e "-s, --base-path\n\tPath to the folder with chain database ('/var/lib/ghost' is default)."
echo -e "-c, --specification-path\n\tPath to specification ('/etc/ghost' is default)." echo -e "-c, --specification-path\n\tPath to specification ('/etc/ghost' is default)."
echo -e "-n, --specification-name\n\tSpecification name to be used ('casper' is default)." echo -e "-n, --specification-name\n\tSpecification name to be used ('casper' is default)."
echo -e "--generate-genesis\n\tGenerate keys to participate in the genesis file." echo -e "-g, --generate-genesis\n\tGenerate keys to participate in the genesis file."
echo -e "--fix-weaver-keystore\n\tFix keystore prefixes (wevr -> weav) to ensure the offchain worker can find the key."
echo -e "--hard-reset-i-know-what-im-doing\n\tWill completely remove ledger along with associated session keys." echo -e "--hard-reset-i-know-what-im-doing\n\tWill completely remove ledger along with associated session keys."
echo -e "-h, --help\n\tPrints help information." echo -e "-h, --help\n\tPrints help information."
} }
@ -194,12 +192,9 @@ while [ $# -gt 0 ]; do
--hard-reset-i-know-what-im-doing) --hard-reset-i-know-what-im-doing)
HARD_RESET=true HARD_RESET=true
;; ;;
--generate-genesis) --generate-genesis|-g)
GENERATE_GENESIS=true GENERATE_GENESIS=true
;; ;;
--fix-weaver-keystore)
FIX_WEAVER_KEYSTORE=true
;;
--help|-h) --help|-h)
help help
exit 0 exit 0
@ -465,7 +460,7 @@ if [ $CHECK_KEYS = true ]; then
rpc_endpoint="${rpc_endpoint:-localhost:9945}" rpc_endpoint="${rpc_endpoint:-localhost:9945}"
fi fi
for type in $(echo audi babe gran weav exds); do for type in $(echo audi babe gran wevr exds); do
echo "[+] parsing session key for [$type]" echo "[+] parsing session key for [$type]"
scheme="sr25519" scheme="sr25519"
if [ $type = "gran" ]; then if [ $type = "gran" ]; then
@ -533,51 +528,6 @@ if [ $UNIT_FILE = true ]; then
fi fi
fi fi
if [ $FIX_WEAVER_KEYSTORE = true ]; then
echo "[+] Starting keystore prefix fix (wevr -> weav)..."
KEYSTORE_DIR="${BASE_PATH%/}/chains/${SPECIFICATION_NAME}_staging_testnet/keystore"
echo "[+] Requesting sudo privileges to modify keystore files..."
sudo -v
if ! sudo test -d "$KEYSTORE_DIR"; then
echo "[-] Keystore directory not found at: $KEYSTORE_DIR"
echo "[-] Please check your --base-path and --specification-name settings."
exit 1
fi
WRONG_PREFIX="77657672" # "wevr"
CORRECT_PREFIX="77656176" # "weav"
CHANGES_MADE=0
while IFS= read -r file; do
if sudo test -f "$file"; then
filename=$(basename "$file")
if [[ "$filename" == "$WRONG_PREFIX"* ]]; then
new_filename="${CORRECT_PREFIX}${filename#$WRONG_PREFIX}"
new_file_path="$KEYSTORE_DIR/$new_filename"
if sudo test -f "$new_file_path"; then
echo "[!] WARNING: File with correct prefix already exists: $new_filename. Skipping."
else
sudo mv "$file" "$new_file_path"
echo "[+] Renamed: $filename -> $new_filename"
CHANGES_MADE=1
fi
fi
fi
done < <(sudo find "$KEYSTORE_DIR" -maxdepth 1 -type f)
if [ $CHANGES_MADE -eq 1 ]; then
echo "[+] Keystore fix applied successfully."
echo "[+] IMPORTANT: You must restart the ghost-node service for changes to take effect."
echo "[+] Run: sudo systemctl restart ghost-node"
else
echo "[+] No files with the wrong 'weav' prefix were found. Everything is fine."
fi
fi
if [ "$GENERATE_GENESIS" = true ]; then if [ "$GENERATE_GENESIS" = true ]; then
echo "[+] Generating keys for genesis configuration..." echo "[+] Generating keys for genesis configuration..."
@ -611,7 +561,7 @@ if [ "$GENERATE_GENESIS" = true ]; then
BABE_HEX=$(ghost key inspect --scheme=sr25519 "$SESSION_SEED//babe" | grep "Public key (hex)" | awk '{print $4}' | sed 's/^0x//') BABE_HEX=$(ghost key inspect --scheme=sr25519 "$SESSION_SEED//babe" | grep "Public key (hex)" | awk '{print $4}' | sed 's/^0x//')
GRAN_HEX=$(ghost key inspect --scheme=ed25519 "$SESSION_SEED//gran" | grep "Public key (hex)" | awk '{print $4}' | sed 's/^0x//') GRAN_HEX=$(ghost key inspect --scheme=ed25519 "$SESSION_SEED//gran" | grep "Public key (hex)" | awk '{print $4}' | sed 's/^0x//')
AUDI_HEX=$(ghost key inspect --scheme=sr25519 "$SESSION_SEED//audi" | grep "Public key (hex)" | awk '{print $4}' | sed 's/^0x//') AUDI_HEX=$(ghost key inspect --scheme=sr25519 "$SESSION_SEED//audi" | grep "Public key (hex)" | awk '{print $4}' | sed 's/^0x//')
WEAV_HEX=$(ghost key inspect --scheme=sr25519 "$SESSION_SEED//weav" | grep "Public key (hex)" | awk '{print $4}' | sed 's/^0x//') WEVR_HEX=$(ghost key inspect --scheme=sr25519 "$SESSION_SEED//wevr" | grep "Public key (hex)" | awk '{print $4}' | sed 's/^0x//')
EXDS_HEX=$(ghost key inspect --scheme=sr25519 "$SESSION_SEED//exds" | grep "Public key (hex)" | awk '{print $4}' | sed 's/^0x//') EXDS_HEX=$(ghost key inspect --scheme=sr25519 "$SESSION_SEED//exds" | grep "Public key (hex)" | awk '{print $4}' | sed 's/^0x//')
STASH_SS58=$(ghost key inspect --scheme=sr25519 "$STASH_SEED" | grep "SS58 Address" | awk '{print $3}') STASH_SS58=$(ghost key inspect --scheme=sr25519 "$STASH_SEED" | grep "SS58 Address" | awk '{print $3}')
@ -625,7 +575,7 @@ if [ "$GENERATE_GENESIS" = true ]; then
echo " .with_babe_id(BabeId::unchecked_from(hex!(\"$BABE_HEX\")))" echo " .with_babe_id(BabeId::unchecked_from(hex!(\"$BABE_HEX\")))"
echo " .with_grandpa_id(GrandpaId::unchecked_from(hex!(\"$GRAN_HEX\")))" echo " .with_grandpa_id(GrandpaId::unchecked_from(hex!(\"$GRAN_HEX\")))"
echo " .with_authority_id(AuthorityDiscoveryId::unchecked_from(hex!(\"$AUDI_HEX\")))" echo " .with_authority_id(AuthorityDiscoveryId::unchecked_from(hex!(\"$AUDI_HEX\")))"
echo " .with_weaver_id(WeaverId::unchecked_from(hex!(\"$WEAV_HEX\")))" echo " .with_weaver_id(WeaverId::unchecked_from(hex!(\"$WEVR_HEX\")))"
echo " .with_exodus_id(ExodusId::unchecked_from(hex!(\"$EXDS_HEX\")))" echo " .with_exodus_id(ExodusId::unchecked_from(hex!(\"$EXDS_HEX\")))"
echo " .build()," echo " .build(),"
echo "" echo ""