Compare commits

..

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

24 changed files with 571 additions and 792 deletions

12
Cargo.lock generated
View File

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

View File

@ -1,6 +1,6 @@
[package]
name = "ghost-exodus"
version = "0.1.7"
version = "0.1.5"
description = "Threshold signature generation with DKG included"
license.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 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();
T::DkgRoundPeriod::get().unique_saturated_into()
} else {
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()
};
let next_release_block = current_block
.max(release_block)
.saturating_add(blocks_delay);
let next_release_block = release_block.saturating_add(blocks_delay);
dkg_qualification.set_release_block(next_release_block);
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>>,
raw_authorities: &[u64],
curve: NetworkCurve,
) {
) -> (u64, u64) {
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());
ext.execute_with(|| Exodus::start_dkg_qualification(authorities, NetworkCurve::iter()));
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);
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 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_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);
(start_block, round_delay)
}
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));
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);
@ -598,6 +623,7 @@ fn run_initial_dkg_session(raw_authorities: &[u64], curve: NetworkCurve) -> (
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_phase(), DkgPhase::Finalized);
@ -631,7 +657,8 @@ fn run_dkg_session(
});
let next_dkg_index = dkg_index.saturating_add(1);
run_succesfull_dkg_session_partially(ext, tx_pool_state, &raw_authorities, curve);
let (start_block, round_delay) =
run_succesfull_dkg_session_partially(ext, tx_pool_state, &raw_authorities, curve);
let total_validators = prev_authorities.len();
let threshold = get_byzantium_quorum_threshold(total_validators);
@ -716,7 +743,7 @@ fn run_dkg_session(
let member = authority as AuthIndex;
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_phase(), DkgPhase::Finalized);

View File

@ -16,7 +16,7 @@
//! Autogenerated weights for `ghost_exodus`
//!
//! 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`
//! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz`
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024
@ -63,30 +63,34 @@ pub trait WeightInfo {
/// Weight functions for `ghost_exodus`.
impl WeightInfo for () {
/// Storage: `GhostNetworks::NetworkTypes` (r:1 w:0)
/// Proof: `GhostNetworks::NetworkTypes` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostNetworks::NetworkCurves` (r:1 w:0)
/// Proof: `GhostNetworks::NetworkCurves` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::QualificationDkgState` (r:1 w:1)
/// 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::Round0Packages` (r:0 w:1)
/// Proof: `GhostExodus::Round0Packages` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn register_round0_package() -> Weight {
// Proof Size summary in bytes:
// Measured: `365`
// Estimated: `3830`
// Minimum execution time: 240_843_000 picoseconds.
Weight::from_parts(243_855_000, 0)
.saturating_add(Weight::from_parts(0, 3830))
// Measured: `351`
// Estimated: `3816`
// Minimum execution time: 240_813_000 picoseconds.
Weight::from_parts(243_523_000, 0)
.saturating_add(Weight::from_parts(0, 3816))
.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)
/// Proof: `GhostNetworks::NetworkTypes` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// 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::Round0Packages` (r:1 w:0)
/// Proof: `GhostExodus::Round0Packages` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::Round1Packages` (r:1 w:1)
@ -94,109 +98,119 @@ impl WeightInfo for () {
/// The range of component `c` is `[4, 300]`.
fn register_round1_package(c: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `405 + c * (32 ±0)`
// Estimated: `3870 + c * (32 ±0)`
// Minimum execution time: 1_349_108_000 picoseconds.
Weight::from_parts(1_224_956_354, 0)
.saturating_add(Weight::from_parts(0, 3870))
// Standard Error: 14_930
.saturating_add(Weight::from_parts(33_204_477, 0).saturating_mul(c.into()))
.saturating_add(RocksDbWeight::get().reads(5))
.saturating_add(RocksDbWeight::get().writes(1))
// Measured: `391 + c * (32 ±0)`
// Estimated: `3856 + c * (32 ±0)`
// Minimum execution time: 1_356_791_000 picoseconds.
Weight::from_parts(1_221_760_215, 0)
.saturating_add(Weight::from_parts(0, 3856))
// Standard Error: 16_481
.saturating_add(Weight::from_parts(33_163_393, 0).saturating_mul(c.into()))
.saturating_add(RocksDbWeight::get().reads(6))
.saturating_add(RocksDbWeight::get().writes(2))
.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: `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::Round2Packages` (r:1 w:1)
/// 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 {
// Proof Size summary in bytes:
// Measured: `332 + c * (32 ±0)`
// Estimated: `3797 + c * (32 ±0)`
// Minimum execution time: 245_305_000 picoseconds.
Weight::from_parts(253_863_353, 0)
.saturating_add(Weight::from_parts(0, 3797))
// Standard Error: 3_527
.saturating_add(Weight::from_parts(810_623, 0).saturating_mul(c.into()))
.saturating_add(RocksDbWeight::get().reads(4))
.saturating_add(RocksDbWeight::get().writes(1))
.saturating_add(Weight::from_parts(0, 32).saturating_mul(c.into()))
// Measured: `317 + c * (257 ±0)`
// Estimated: `3783 + c * (257 ±0)`
// Minimum execution time: 254_590_000 picoseconds.
Weight::from_parts(258_091_105, 0)
.saturating_add(Weight::from_parts(0, 3783))
// Standard Error: 25_082
.saturating_add(Weight::from_parts(6_595_878, 0).saturating_mul(c.into()))
.saturating_add(RocksDbWeight::get().reads(5))
.saturating_add(RocksDbWeight::get().writes(2))
.saturating_add(Weight::from_parts(0, 257).saturating_mul(c.into()))
}
/// Storage: `GhostNetworks::NetworkTypes` (r:1 w:0)
/// Proof: `GhostNetworks::NetworkTypes` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// 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::Complaints` (r:1 w:1)
/// 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 {
// 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(238_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(RocksDbWeight::get().reads(4))
.saturating_add(RocksDbWeight::get().writes(1))
.saturating_add(Weight::from_parts(0, 32).saturating_mul(c.into()))
// 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(RocksDbWeight::get().reads(5))
.saturating_add(RocksDbWeight::get().writes(2))
.saturating_add(Weight::from_parts(0, 257).saturating_mul(c.into()))
}
/// Storage: `GhostNetworks::NetworkTypes` (r:1 w:0)
/// Proof: `GhostNetworks::NetworkTypes` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// 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, 300]`.
/// The range of component `c` is `[1, 37]`.
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(RocksDbWeight::get().reads(4))
.saturating_add(RocksDbWeight::get().writes(1))
.saturating_add(Weight::from_parts(0, 32).saturating_mul(c.into()))
// 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(RocksDbWeight::get().reads(5))
.saturating_add(RocksDbWeight::get().writes(2))
.saturating_add(Weight::from_parts(0, 257).saturating_mul(c.into()))
}
/// Storage: `GhostNetworks::NetworkTypes` (r:1 w:0)
/// Proof: `GhostNetworks::NetworkTypes` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// 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: `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(RocksDbWeight::get().reads(5))
.saturating_add(RocksDbWeight::get().writes(2))
// 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(RocksDbWeight::get().reads(6))
.saturating_add(RocksDbWeight::get().writes(3))
}
/// Storage: `GhostNetworks::NetworkTypes` (r:1 w:0)
/// Proof: `GhostNetworks::NetworkTypes` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// 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)
/// Proof: `GhostExodus::VerifyingKeyConsensus` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::VerifyingShares` (r:1 w:1)
@ -207,18 +221,18 @@ impl WeightInfo for () {
fn register_round6_public_share_package(c: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `0 + c * (770 ±0)`
// Estimated: `1698 + c * (1019 ±27)`
// Minimum execution time: 283_863_000 picoseconds.
Weight::from_parts(286_691_978, 0)
.saturating_add(Weight::from_parts(0, 1698))
// Standard Error: 85_685
.saturating_add(Weight::from_parts(2_854_037, 0).saturating_mul(c.into()))
.saturating_add(RocksDbWeight::get().reads(6))
.saturating_add(RocksDbWeight::get().writes(2))
// Estimated: `1551 + c * (1019 ±27)`
// Minimum execution time: 284_558_000 picoseconds.
Weight::from_parts(284_117_484, 0)
.saturating_add(Weight::from_parts(0, 1551))
// Standard Error: 74_361
.saturating_add(Weight::from_parts(3_551_271, 0).saturating_mul(c.into()))
.saturating_add(RocksDbWeight::get().reads(7))
.saturating_add(RocksDbWeight::get().writes(3))
.saturating_add(Weight::from_parts(0, 1019).saturating_mul(c.into()))
}
/// Storage: `GhostNetworks::NetworkTypes` (r:1 w:0)
/// Proof: `GhostNetworks::NetworkTypes` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// 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::ActiveDkgAuthorities` (r:1 w:0)
@ -229,22 +243,24 @@ impl WeightInfo for () {
/// Proof: `GhostExodus::ExodusRequests` (`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::RoastSessionStates` (r:1 w:1)
/// 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 {
// Proof Size summary in bytes:
// Measured: `633`
// Estimated: `4098`
// Minimum execution time: 369_666_000 picoseconds.
Weight::from_parts(373_163_000, 0)
.saturating_add(Weight::from_parts(0, 4098))
// Measured: `627`
// Estimated: `4092`
// Minimum execution time: 315_066_000 picoseconds.
Weight::from_parts(318_561_000, 0)
.saturating_add(Weight::from_parts(0, 4092))
.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)
/// Proof: `GhostNetworks::NetworkTypes` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// 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::ActiveDkgAuthorities` (r:1 w:0)
@ -253,6 +269,8 @@ impl WeightInfo for () {
/// 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)
/// Proof: `GhostExodus::ExodusRequests` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// 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`)
fn register_group_commitment() -> Weight {
// Proof Size summary in bytes:
// Measured: `1032`
// Estimated: `4495`
// Minimum execution time: 339_569_000 picoseconds.
Weight::from_parts(341_788_000, 0)
.saturating_add(Weight::from_parts(0, 4495))
.saturating_add(RocksDbWeight::get().reads(9))
.saturating_add(RocksDbWeight::get().writes(3))
// Measured: `992`
// Estimated: `4457`
// Minimum execution time: 338_644_000 picoseconds.
Weight::from_parts(343_954_000, 0)
.saturating_add(Weight::from_parts(0, 4457))
.saturating_add(RocksDbWeight::get().reads(10))
.saturating_add(RocksDbWeight::get().writes(4))
}
/// Storage: `GhostNetworks::NetworkTypes` (r:1 w:0)
/// Proof: `GhostNetworks::NetworkTypes` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// 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::ActiveDkgAuthorities` (r:1 w:0)
@ -281,6 +299,8 @@ impl WeightInfo for () {
/// 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)
/// Proof: `GhostExodus::GroupCommitmentsConsensus` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// 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`)
fn register_signature_share() -> Weight {
// Proof Size summary in bytes:
// Measured: `11337`
// Estimated: `14802`
// Minimum execution time: 4_046_065_000 picoseconds.
Weight::from_parts(4_059_064_000, 0)
.saturating_add(Weight::from_parts(0, 14802))
.saturating_add(RocksDbWeight::get().reads(14))
.saturating_add(RocksDbWeight::get().writes(8))
// Measured: `11299`
// Estimated: `14764`
// Minimum execution time: 3_968_938_000 picoseconds.
Weight::from_parts(3_975_088_000, 0)
.saturating_add(Weight::from_parts(0, 14764))
.saturating_add(RocksDbWeight::get().reads(15))
.saturating_add(RocksDbWeight::get().writes(9))
}
/// Storage: `GhostNetworks::Networks` (r:1 w:0)
/// 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`)
/// Storage: `GhostExodus::QualificationDkgState` (r:1 w:0)
/// Proof: `GhostExodus::QualificationDkgState` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::CurrentExodusSessions` (r:1 w:1)
/// Proof: `GhostExodus::CurrentExodusSessions` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::CurrentExodus` (r:1 w:1)
/// Proof: `GhostExodus::CurrentExodus` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::ExodusRequests` (r:1 w:1)
/// Proof: `GhostExodus::ExodusRequests` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn register_evm_bridge_out_exodus() -> Weight {
// Proof Size summary in bytes:
// Measured: `457`
// Estimated: `3922`
// Minimum execution time: 195_417_000 picoseconds.
Weight::from_parts(196_842_000, 0)
.saturating_add(Weight::from_parts(0, 3922))
// Measured: `448`
// Estimated: `3913`
// Minimum execution time: 191_374_000 picoseconds.
Weight::from_parts(192_991_000, 0)
.saturating_add(Weight::from_parts(0, 3913))
.saturating_add(RocksDbWeight::get().reads(7))
.saturating_add(RocksDbWeight::get().writes(5))
}

View File

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

View File

@ -16,7 +16,7 @@
//! Autogenerated weights for `ghost_governance`
//!
//! 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`
//! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz`
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024
@ -67,11 +67,11 @@ impl WeightInfo for () {
// Proof Size summary in bytes:
// Measured: `283`
// Estimated: `3748`
// Minimum execution time: 224_852_000 picoseconds.
Weight::from_parts(225_347_733, 0)
// Minimum execution time: 229_254_000 picoseconds.
Weight::from_parts(229_992_093, 0)
.saturating_add(Weight::from_parts(0, 3748))
// Standard Error: 21_234
.saturating_add(Weight::from_parts(1_581_800, 0).saturating_mul(p.into()))
// Standard Error: 25_680
.saturating_add(Weight::from_parts(1_874_433, 0).saturating_mul(p.into()))
.saturating_add(RocksDbWeight::get().reads(5))
.saturating_add(RocksDbWeight::get().writes(5))
}

View File

@ -1,6 +1,6 @@
[package]
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."
license.workspace = true
authors.workspace = true

View File

@ -3,7 +3,6 @@
use ghost_traits::hashing::GhostHasher;
use sp_core::H256;
use sp_io::hashing::{blake2_256, keccak_256, sha2_256};
use sp_runtime::{Perbill, traits::{Saturating, UniqueSaturatedInto}};
pub mod bounded_bitmap;
pub mod hash_chain;
@ -50,34 +49,6 @@ where
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 {
(
struct $name:ident;
@ -184,38 +155,4 @@ mod tests {
assert_eq!(get_byzantium_quorum_threshold(4u64), 3u64);
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]
name = "ghost-weaver"
version = "0.0.26"
version = "0.0.21"
description = "Weaving a secure cryptographic tapestry across different external chains."
license.workspace = true
authors.workspace = true

View File

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

View File

@ -22,16 +22,13 @@ use sp_runtime::{
storage::StorageValueRef,
storage_lock::{StorageLock, Time},
},
traits::{
TrailingZeroInput, BlockNumberProvider, Saturating,
UniqueSaturatedInto,
},
RuntimeAppPublic, Perbill, PerThing,
traits::{BlockNumberProvider, Saturating, UniqueSaturatedInto},
RuntimeAppPublic,
};
use ghost_helpers::{
bounded_bitmap::{validate_bitmap_sizes, BoundedBitmap},
get_byzantium_quorum_threshold, get_submission_probability,
get_byzantium_quorum_threshold,
networks::{NetworkData, NetworkType},
};
use ghost_traits::{
@ -42,7 +39,6 @@ use ghost_traits::{
},
};
pub mod migrations;
mod errors;
mod impls;
mod types;
@ -66,7 +62,7 @@ pub use pallet::*;
pub mod sr25519 {
mod app_sr25519 {
use sp_application_crypto::{app_crypto, sr25519, KeyTypeId};
const WEAVER: KeyTypeId = KeyTypeId(*b"wevr");
const WEAVER: KeyTypeId = KeyTypeId(*b"weav");
app_crypto!(sr25519, WEAVER);
}
@ -82,8 +78,8 @@ const LOG_TARGET: &str = "runtime::ghost-weaver";
const DB_PREFIX: &[u8] = b"ghost-weaver::";
const LOCK_BLOCK_EXPIRATION: u64 = 20;
const MIN_LOCK_GUARD_PERIOD: u64 = 60_000;
const FETCH_TIMEOUT_PERIOD: u64 = 5_000;
const MIN_LOCK_GUARD_PERIOD: u64 = 15_000;
const FETCH_TIMEOUT_PERIOD: u64 = 3_000;
type AuthIndex = ghost_helpers::AuthIndexU16;
type BitmapChunk = ghost_helpers::BitmapChunkU32;
@ -103,7 +99,7 @@ type WeaversBitmap<T> = BoundedBitmap<BitmapChunk, <T as Config>::MaxAuthorities
pub mod pallet {
use super::*;
const STORAGE_VERSION: StorageVersion = StorageVersion::new(1);
const STORAGE_VERSION: StorageVersion = StorageVersion::new(0);
#[pallet::pallet]
#[pallet::storage_version(STORAGE_VERSION)]
@ -187,10 +183,9 @@ pub mod pallet {
}
#[pallet::storage]
#[pallet::getter(fn network_attested_blocks)]
pub(super) type NetworkAttestedBlocks<T: Config> = StorageDoubleMap<
#[pallet::getter(fn attested_blocks)]
pub(super) type AttestedBlocks<T: Config> = StorageMap<
_,
Twox64Concat, NetworkIdOf<T>,
Twox64Concat, AuthIndex,
BlockNumberFor<T>,
ValueQuery,
@ -361,10 +356,7 @@ pub mod pallet {
})?;
let current_block = T::BlockNumberProvider::current_block_number();
NetworkAttestedBlocks::<T>::insert(
&network_id, &authority_index,
current_block
);
AttestedBlocks::<T>::insert(&authority_index, current_block);
Self::deposit_event(Event::<T>::BlockAttestated {
network_id,
@ -418,19 +410,12 @@ pub mod pallet {
WeavingStates::<T>::mutate(&network_id, |weaving_state| {
if weaving_state.count < weavers_count {
*weaving_state = WeavingState::new(
root_hash,
next_session,
weavers_count
);
*weaving_state = WeavingState::new(root_hash, next_session, weavers_count);
}
});
let current_block = T::BlockNumberProvider::current_block_number();
NetworkAttestedBlocks::<T>::insert(
&network_id, &authority_index,
current_block
);
AttestedBlocks::<T>::insert(&authority_index, current_block);
Self::deposit_event(Event::<T>::HashAttestated {
authority_index,
@ -546,10 +531,9 @@ pub mod pallet {
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);
WeavingStates::<T>::remove(&network_id);
NetworkAttestations::<T>::remove(&network_id);
}
}
None => {
@ -607,7 +591,7 @@ pub mod pallet {
if sp_io::offchain::is_validator() {
log::warn!(target: LOG_TARGET, "🕸️ Weaver started at block #{:?}", 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),
}
}
@ -704,41 +688,6 @@ impl<T: Config> Pallet<T> {
A: Encode,
{
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()
.get(authority_index as usize)
@ -750,6 +699,35 @@ impl<T: Config> Pallet<T> {
.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))
}
@ -764,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 = 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 mut network_lock = StorageLock::<Time>::with_deadline(&network_lock_key, lock_until);
@ -802,31 +780,14 @@ impl<T: Config> Pallet<T> {
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) {
Some(tapestry_draft) => Self::try_request_and_submit_hash(
network_id,
current_block,
tapestry_draft,
tapestry_draft.median,
deadline,
&network_data,
&rpc_endpoints,
check_probability,
),
None => Self::try_request_and_submit_block(
network_id,
@ -834,7 +795,6 @@ impl<T: Config> Pallet<T> {
deadline,
&network_data,
&rpc_endpoints,
check_probability,
),
}
}
@ -842,22 +802,13 @@ impl<T: Config> Pallet<T> {
fn try_request_and_submit_hash(
network_id: NetworkIdOf<T>,
current_block: BlockNumberFor<T>,
tapestry_draft: TapestryDraft<BlockNumberFor<T>>,
target_block: ExternalBlockNumber,
deadline: rt_offchain::Timestamp,
network_data: &NetworkData,
rpc_endpoints: &Vec<Vec<u8>>,
check_probability: impl Fn(usize, BlockNumberFor<T>) -> bool,
) -> WeavingResult<T, WeavingOk<NetworkIdOf<T>>> {
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_body = network_data.r#type.get_hash_request_body(
@ -951,20 +902,7 @@ impl<T: Config> Pallet<T> {
deadline: rt_offchain::Timestamp,
network_data: &NetworkData,
rpc_endpoints: &Vec<Vec<u8>>,
check_probability: impl Fn(usize, BlockNumberFor<T>) -> bool,
) -> 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 distance_key = Self::create_storage_key(b"distance-", &network_id_encoded);
let block_deviation =
@ -983,7 +921,6 @@ impl<T: Config> Pallet<T> {
let total_blocks = block_numbers.len();
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(
&mut block_numbers,
@ -1032,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(
@ -1176,7 +1113,12 @@ impl<T: Config> Pallet<T> {
local_authorities
.binary_search(&authority)
.ok()
.map(|_| (index as AuthIndex, authority))
.map(|location| {
(
index.unique_saturated_into(),
local_authorities[location].clone(),
)
})
})
}

View File

@ -1,9 +0,0 @@
pub mod v1;
pub type MigrateV0ToV1<T> = frame_support::migrations::VersionedMigration<
0,
1,
v1::RemoveAttestedBlocksStorage<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,6 +1,6 @@
#![cfg(test)]
use crate::{LOCK_BLOCK_EXPIRATION, sr25519::AuthorityPair};
use crate::sr25519::AuthorityPair;
use crate::mock::*;
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())];
new_test_ext(authorities, networks).execute_with(|| {
GhostWeaver::on_initialize(LOCK_BLOCK_EXPIRATION + 1);
System::set_block_number(LOCK_BLOCK_EXPIRATION + 2);
GhostWeaver::on_initialize(1);
System::set_block_number(2);
let context = AttestationContext::default()
.with_current_block(LOCK_BLOCK_EXPIRATION + 1)
.with_current_block(1)
.with_network_id(network_id);
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());
System::set_block_number(LOCK_BLOCK_EXPIRATION + 3);
GhostWeaver::on_initialize(LOCK_BLOCK_EXPIRATION + 3);
System::set_block_number(3);
GhostWeaver::on_initialize(3);
let round = GhostWeaver::tapestry_drafts(network_id);
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())];
new_test_ext(authorities, networks).execute_with(|| {
GhostWeaver::on_initialize(LOCK_BLOCK_EXPIRATION + 9);
System::set_block_number(LOCK_BLOCK_EXPIRATION + 10);
GhostWeaver::on_initialize(9);
System::set_block_number(10);
let context = AttestationContext::default()
.with_current_block(LOCK_BLOCK_EXPIRATION + 9)
.with_current_block(9)
.with_network_id(network_id);
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(), att3, sig3).is_ok());
System::set_block_number(LOCK_BLOCK_EXPIRATION + 11);
GhostWeaver::on_initialize(LOCK_BLOCK_EXPIRATION + 11);
System::set_block_number(11);
GhostWeaver::on_initialize(11);
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);
System::set_block_number(LOCK_BLOCK_EXPIRATION + 12);
GhostWeaver::on_initialize(LOCK_BLOCK_EXPIRATION+ 12);
System::set_block_number(12);
GhostWeaver::on_initialize(12);
assert!(TapestryDrafts::<TestRuntime>::get(network_id).is_none());
System::set_block_number(LOCK_BLOCK_EXPIRATION + 14);
GhostWeaver::on_initialize(LOCK_BLOCK_EXPIRATION + 14);
System::set_block_number(14);
GhostWeaver::on_initialize(14);
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())];
new_test_ext(authorities, networks).execute_with(|| {
GhostWeaver::on_initialize(LOCK_BLOCK_EXPIRATION + 1);
System::set_block_number(LOCK_BLOCK_EXPIRATION + 2);
GhostWeaver::on_initialize(1);
System::set_block_number(2);
let att = AttestationContext::default()
.with_current_block(LOCK_BLOCK_EXPIRATION + 1)
.with_current_block(1)
.with_network_id(network_id)
.with_authority_index(0)
.build_block_attestation(100);
@ -187,9 +187,7 @@ fn validate_unsigned_should_prevent_mempool_dos_via_tags() {
signature: valid_sig,
};
let validity =
GhostWeaver::validate_unsigned(TransactionSource::External, &call);
let validity = GhostWeaver::validate_unsigned(TransactionSource::External, &call);
assert!(validity.is_ok());
let valid_info = validity.unwrap();
@ -204,9 +202,7 @@ fn validate_unsigned_should_prevent_mempool_dos_via_tags() {
signature: invalid_sig,
};
let spam_validity =
GhostWeaver::validate_unsigned(TransactionSource::External, &spam_call);
let spam_validity = GhostWeaver::validate_unsigned(TransactionSource::External, &spam_call);
assert_eq!(
spam_validity,
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.execute_with(|| {
GhostWeaver::on_initialize(LOCK_BLOCK_EXPIRATION + 1);
GhostWeaver::on_initialize(LOCK_BLOCK_EXPIRATION + 2);
GhostWeaver::on_initialize(1);
GhostWeaver::on_initialize(2);
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 rpc_endpoints: Vec<Vec<u8>> = vec![target_endpoint.clone()];
sp_io::offchain::local_storage_set(
sp_core::offchain::StorageKind::PERSISTENT,
&endpoint_key,
@ -284,7 +279,7 @@ fn offchain_worker_should_fetch_block_and_submit_unsigned_tx() {
);
sp_io::crypto::sr25519_generate(
sp_core::crypto::KeyTypeId(*b"wevr"),
sp_core::crypto::KeyTypeId(*b"weav"),
Some(b"//Alice".to_vec()),
);
});
@ -299,8 +294,8 @@ fn offchain_worker_should_fetch_block_and_submit_unsigned_tx() {
("Accept".into(), "application/json".into()),
("Content-Type".into(), "application/json".into()),
],
body: b"{\"id\":21,\"jsonrpc\":\"2.0\",\"method\":\"getblockcount\"}".to_vec(),
response: Some(b"{\"jsonrpc\":\"2.0\",\"id\":21,\"result\":960127}".to_vec()),
body: b"{\"id\":1,\"jsonrpc\":\"2.0\",\"method\":\"getblockcount\"}".to_vec(),
response: Some(b"{\"jsonrpc\":\"2.0\",\"id\":1,\"result\":960127}".to_vec()),
sent: true,
..Default::default()
});
@ -314,16 +309,16 @@ fn offchain_worker_should_fetch_block_and_submit_unsigned_tx() {
("X-Custom-Provider".into(), "GhostWeaverNode".into()),
("Authorization".into(), "Bearer new-api-token-123".into()),
],
body: b"{\"id\":22,\"jsonrpc\":\"2.0\",\"method\":\"eth_blockNumber\"}".to_vec(),
response: Some(b"{\"jsonrpc\":\"2.0\",\"id\":22,\"result\":\"0x1873a84\"}".to_vec()),
body: b"{\"id\":2,\"jsonrpc\":\"2.0\",\"method\":\"eth_blockNumber\"}".to_vec(),
response: Some(b"{\"jsonrpc\":\"2.0\",\"id\":2,\"result\":\"0x1873a84\"}".to_vec()),
sent: true,
..Default::default()
});
}
ext.execute_with(|| {
System::set_block_number(LOCK_BLOCK_EXPIRATION + 1u64);
GhostWeaver::offchain_worker(LOCK_BLOCK_EXPIRATION + 1u64);
System::set_block_number(1u64);
GhostWeaver::offchain_worker(1u64);
let state = pool_state.read();
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!(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());
});
ext.execute_with(|| {
System::set_block_number(LOCK_BLOCK_EXPIRATION + 2u64);
GhostWeaver::offchain_worker(LOCK_BLOCK_EXPIRATION + 2u64);
System::set_block_number(2u64);
GhostWeaver::offchain_worker(2u64);
let state = pool_state.read();
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!(TapestryDrafts::<TestRuntime>::get(&evm_network_id).is_none());
GhostWeaver::on_initialize(LOCK_BLOCK_EXPIRATION + 3u64);
GhostWeaver::on_initialize(LOCK_BLOCK_EXPIRATION + 4u64);
GhostWeaver::on_initialize(3u64);
GhostWeaver::on_initialize(4u64);
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.execute_with(|| {
GhostWeaver::on_initialize(LOCK_BLOCK_EXPIRATION + 1);
GhostWeaver::on_initialize(LOCK_BLOCK_EXPIRATION + 2);
GhostWeaver::on_initialize(1);
GhostWeaver::on_initialize(2);
let tapestry_draft = TapestryDraftBuilder::<crate::ExternalBlockNumber, u32>::default();
let evm_tapestry_draft = tapestry_draft.with_median_external(median_evm_block).build();
@ -465,7 +460,7 @@ fn offchain_worker_should_fetch_hash_and_submit_unsigned_tx() {
);
sp_io::crypto::sr25519_generate(
sp_core::crypto::KeyTypeId(*b"wevr"),
sp_core::crypto::KeyTypeId(*b"weav"),
Some(b"//Alice".to_vec()),
);
});
@ -480,8 +475,8 @@ fn offchain_worker_should_fetch_hash_and_submit_unsigned_tx() {
("Accept".into(), "application/json".into()),
("Content-Type".into(), "application/json".into()),
],
body: b"{\"id\":21,\"jsonrpc\":\"2.0\",\"method\":\"getblockhash\",\"params\":[960129]}".to_vec(),
response: Some(b"{\"jsonrpc\":\"2.0\",\"id\":21,\"result\":\"0000000000000000000091c72779c83d76dfa8149e950f3a5287377a9708d5c1\"}".to_vec()),
body: b"{\"id\":1,\"jsonrpc\":\"2.0\",\"method\":\"getblockhash\",\"params\":[960129]}".to_vec(),
response: Some(b"{\"jsonrpc\":\"2.0\",\"id\":1,\"result\":\"0000000000000000000091c72779c83d76dfa8149e950f3a5287377a9708d5c1\"}".to_vec()),
sent: true,
..Default::default()
});
@ -496,16 +491,16 @@ fn offchain_worker_should_fetch_hash_and_submit_unsigned_tx() {
("Authorization".into(), "Bearer new-api-token-123".into()),
],
// 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(),
response: Some(b"{\"jsonrpc\":\"2.0\",\"id\":22,\"result\":\"0xf72b9ef0b66c8cc3952ffd11dc0b85f3b02e6edfa9236da400138f2fcba4668d0000000000000000000000000000000000000000000000000000000000000046\"}".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\":2,\"result\":\"0xf72b9ef0b66c8cc3952ffd11dc0b85f3b02e6edfa9236da400138f2fcba4668d0000000000000000000000000000000000000000000000000000000000000046\"}".to_vec()),
sent: true,
..Default::default()
});
}
ext.execute_with(|| {
System::set_block_number(LOCK_BLOCK_EXPIRATION + 1u64);
GhostWeaver::offchain_worker(LOCK_BLOCK_EXPIRATION + 1u64);
System::set_block_number(1u64);
GhostWeaver::offchain_worker(1u64);
let state = pool_state.read();
assert_eq!(state.transactions.len(), 1);
@ -538,8 +533,8 @@ fn offchain_worker_should_fetch_hash_and_submit_unsigned_tx() {
});
ext.execute_with(|| {
System::set_block_number(LOCK_BLOCK_EXPIRATION + 2u64);
GhostWeaver::offchain_worker(LOCK_BLOCK_EXPIRATION + 2u64);
System::set_block_number(2u64);
GhostWeaver::offchain_worker(2u64);
let state = pool_state.read();
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);
let prev_state = LoomStates::<TestRuntime>::get(&evm_network_id, &evm_session);
GhostWeaver::on_initialize(LOCK_BLOCK_EXPIRATION + 3u64);
GhostWeaver::on_initialize(LOCK_BLOCK_EXPIRATION + 4u64);
GhostWeaver::on_initialize(3u64);
GhostWeaver::on_initialize(4u64);
let curr_state = LoomStates::<TestRuntime>::get(&evm_network_id, &evm_session);
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)];
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);
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)];
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 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];
pub enum WeavingOk<NetworkId> {
Skipped(NetworkId),
Block(ExternalBlockNumber, u32, NetworkId),
Block(ExternalBlockNumber, NetworkId),
Hash(ExternalBlockNumber, H256, WeavingSession, NetworkId),
}
impl<NetworkId> core::fmt::Debug for WeavingOk<NetworkId>
impl<NetworkId> core::fmt::Display for WeavingOk<NetworkId>
where
NetworkId: core::fmt::Debug,
{
fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
match self {
Self::Skipped(network_id) => write!(fmt, "Submission step skipped for network: {:?} based on probability distribution.", 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 {:?} (next session is {:?}) from block #{:?} for network: {:?}.", hash, next_session, block, network_id),
Self::Block(block, network_id) => write!(fmt, "Verified block height #{:?} found for network: {:?}.", block, network_id),
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),
}
}
}

View File

@ -16,7 +16,7 @@
//! Autogenerated weights for `ghost_weaver`
//!
//! 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`
//! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz`
//! 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]`.
fn extend_warp(a: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `274 + a * (33 ±0)`
// Estimated: `3736 + a * (33 ±0)`
// Minimum execution time: 229_711_000 picoseconds.
Weight::from_parts(233_206_680, 0)
.saturating_add(Weight::from_parts(0, 3736))
// Standard Error: 1_554
.saturating_add(Weight::from_parts(66_095, 0).saturating_mul(a.into()))
.saturating_add(RocksDbWeight::get().reads(6))
.saturating_add(RocksDbWeight::get().writes(2))
.saturating_add(Weight::from_parts(0, 33).saturating_mul(a.into()))
// Measured: `223 + a * (32 ±0)`
// Estimated: `3687 + a * (32 ±0)`
// Minimum execution time: 212_751_000 picoseconds.
Weight::from_parts(215_022_916, 0)
.saturating_add(Weight::from_parts(0, 3687))
// Standard Error: 1_319
.saturating_add(Weight::from_parts(53_379, 0).saturating_mul(a.into()))
.saturating_add(RocksDbWeight::get().reads(5))
.saturating_add(RocksDbWeight::get().writes(1))
.saturating_add(Weight::from_parts(0, 32).saturating_mul(a.into()))
}
/// Storage: `GhostWeaver::DisabledAuthorities` (r:1 w:0)
/// 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]`.
fn weave_weft(a: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `569 + a * (33 ±0)`
// Estimated: `4031 + a * (33 ±0)`
// Minimum execution time: 262_809_000 picoseconds.
Weight::from_parts(267_769_707, 0)
.saturating_add(Weight::from_parts(0, 4031))
// Measured: `518 + a * (32 ±0)`
// Estimated: `3982 + a * (32 ±0)`
// Minimum execution time: 212_751_000 picoseconds.
Weight::from_parts(246_374_350, 0)
.saturating_add(Weight::from_parts(0, 3982))
// Standard Error: 1_865
.saturating_add(Weight::from_parts(39_109, 0).saturating_mul(a.into()))
.saturating_add(RocksDbWeight::get().reads(8))
.saturating_add(RocksDbWeight::get().writes(3))
.saturating_add(Weight::from_parts(0, 33).saturating_mul(a.into()))
.saturating_add(Weight::from_parts(38_601, 0).saturating_mul(a.into()))
.saturating_add(RocksDbWeight::get().reads(6))
.saturating_add(RocksDbWeight::get().writes(2))
.saturating_add(Weight::from_parts(0, 32).saturating_mul(a.into()))
}
/// Storage: `GhostNetworks::Networks` (r:1 w:0)
/// 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]`.
fn pull_utxo_thread(a: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `500`
// Estimated: `3965`
// Minimum execution time: 217_481_000 picoseconds.
Weight::from_parts(216_492_234, 0)
// Standard Error: 4_414
.saturating_add(Weight::from_parts(3_376_569, 0).saturating_mul(a.into()))
// Measured: `449`
// Estimated: `3914`
// Minimum execution time: 217_880_000 picoseconds.
Weight::from_parts(217_119_201, 0)
// Standard Error: 4_368
.saturating_add(Weight::from_parts(3_445_491, 0).saturating_mul(a.into()))
.saturating_add(RocksDbWeight::get().reads(6))
.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`)
fn pull_evm_thread() -> Weight {
// Proof Size summary in bytes:
// Measured: `500`
// Estimated: `3965`
// Minimum execution time: 176_861_000 picoseconds.
Weight::from_parts(177_861_000, 0)
.saturating_add(Weight::from_parts(0, 3965))
// Measured: `449`
// Estimated: `3914`
// Minimum execution time: 183_413_000 picoseconds.
Weight::from_parts(186_271_000, 0)
.saturating_add(Weight::from_parts(0, 3914))
.saturating_add(RocksDbWeight::get().reads(6))
.saturating_add(RocksDbWeight::get().writes(4))
}

View File

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

View File

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

View File

@ -16,7 +16,7 @@
//! Autogenerated weights for `ghost_exodus`
//!
//! 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`
//! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz`
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024
@ -46,232 +46,252 @@ use core::marker::PhantomData;
/// Weight functions for `ghost_exodus`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> ghost_exodus::WeightInfo for WeightInfo<T> {
/// Storage: `GhostNetworks::NetworkTypes` (r:1 w:0)
/// Proof: `GhostNetworks::NetworkTypes` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostNetworks::NetworkCurves` (r:1 w:0)
/// Proof: `GhostNetworks::NetworkCurves` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::QualificationDkgState` (r:1 w:1)
/// 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)
/// 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 {
// Proof Size summary in bytes:
// Measured: `365`
// Estimated: `3830`
// Minimum execution time: 240_843_000 picoseconds.
Weight::from_parts(243_855_000, 0)
.saturating_add(Weight::from_parts(0, 3830))
// Measured: `351`
// Estimated: `3816`
// Minimum execution time: 240_813_000 picoseconds.
Weight::from_parts(243_523_000, 0)
.saturating_add(Weight::from_parts(0, 3816))
.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)
/// Proof: `GhostNetworks::NetworkTypes` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// 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::Round1Packages` (r:1 w:1)
/// Proof: `GhostExodus::Round1Packages` (`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)
/// 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]`.
fn register_round1_package(c: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `405 + c * (32 ±0)`
// Estimated: `3870 + c * (32 ±0)`
// Minimum execution time: 1_349_108_000 picoseconds.
Weight::from_parts(1_224_956_354, 0)
.saturating_add(Weight::from_parts(0, 3870))
// Standard Error: 14_930
.saturating_add(Weight::from_parts(33_204_477, 0).saturating_mul(c.into()))
.saturating_add(T::DbWeight::get().reads(5))
.saturating_add(T::DbWeight::get().writes(1))
// Measured: `391 + c * (32 ±0)`
// Estimated: `3856 + c * (32 ±0)`
// Minimum execution time: 1_356_791_000 picoseconds.
Weight::from_parts(1_221_760_215, 0)
.saturating_add(Weight::from_parts(0, 3856))
// Standard Error: 16_481
.saturating_add(Weight::from_parts(33_163_393, 0).saturating_mul(c.into()))
.saturating_add(T::DbWeight::get().reads(6))
.saturating_add(T::DbWeight::get().writes(2))
.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: `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::Round2Packages` (r:1 w:1)
/// Proof: `GhostExodus::Round2Packages` (`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]`.
/// The range of component `c` is `[1, 37]`.
fn register_encrypted_round2_packages(c: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `332 + c * (32 ±0)`
// Estimated: `3797 + c * (32 ±0)`
// Minimum execution time: 245_305_000 picoseconds.
Weight::from_parts(253_863_353, 0)
.saturating_add(Weight::from_parts(0, 3797))
// Standard Error: 3_527
.saturating_add(Weight::from_parts(810_623, 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))
// Measured: `317 + c * (257 ±0)`
// Estimated: `3783 + c * (257 ±0)`
// Minimum execution time: 254_590_000 picoseconds.
Weight::from_parts(258_091_105, 0)
.saturating_add(Weight::from_parts(0, 3783))
// Standard Error: 25_082
.saturating_add(Weight::from_parts(6_595_878, 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::NetworkTypes` (r:1 w:0)
/// Proof: `GhostNetworks::NetworkTypes` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// 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::VerifyingSharesParticipants` (r:1 w:1)
/// Proof: `GhostExodus::VerifyingSharesParticipants` (`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::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)
/// Proof: `GhostExodus::VerifyingKeyConsensus` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::VerifyingShares` (r:1 w:1)
/// 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]`.
fn register_round6_public_share_package(c: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `0 + c * (770 ±0)`
// Estimated: `1698 + c * (1019 ±27)`
// Minimum execution time: 283_863_000 picoseconds.
Weight::from_parts(286_691_978, 0)
.saturating_add(Weight::from_parts(0, 1698))
// Standard Error: 85_685
.saturating_add(Weight::from_parts(2_854_037, 0).saturating_mul(c.into()))
.saturating_add(T::DbWeight::get().reads(6))
.saturating_add(T::DbWeight::get().writes(2))
// Estimated: `1551 + c * (1019 ±27)`
// Minimum execution time: 284_558_000 picoseconds.
Weight::from_parts(284_117_484, 0)
.saturating_add(Weight::from_parts(0, 1551))
// Standard Error: 74_361
.saturating_add(Weight::from_parts(3_551_271, 0).saturating_mul(c.into()))
.saturating_add(T::DbWeight::get().reads(7))
.saturating_add(T::DbWeight::get().writes(3))
.saturating_add(Weight::from_parts(0, 1019).saturating_mul(c.into()))
}
/// Storage: `GhostNetworks::NetworkTypes` (r:1 w:0)
/// Proof: `GhostNetworks::NetworkTypes` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// 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::ActiveDkgAuthorities` (r:1 w:0)
/// 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)
/// Proof: `GhostExodus::ExodusRequests` (`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::NonceCommitments` (r:1 w:1)
/// Proof: `GhostExodus::NonceCommitments` (`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::ExodusActivity` (r:1 w:1)
/// Proof: `GhostExodus::ExodusActivity` (`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:0 w:1)
/// Proof: `GhostExodus::NonceCommitments` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn register_nonce_commitment() -> Weight {
// Proof Size summary in bytes:
// Measured: `633`
// Estimated: `4098`
// Minimum execution time: 369_666_000 picoseconds.
Weight::from_parts(373_163_000, 0)
.saturating_add(Weight::from_parts(0, 4098))
// Measured: `627`
// Estimated: `4092`
// Minimum execution time: 315_066_000 picoseconds.
Weight::from_parts(318_561_000, 0)
.saturating_add(Weight::from_parts(0, 4092))
.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)
/// Proof: `GhostNetworks::NetworkTypes` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// 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::ActiveDkgAuthorities` (r:1 w:0)
/// 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)
/// 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)
/// Proof: `GhostExodus::ExodusRequests` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::GroupCommitters` (r:1 w:1)
/// 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)
/// Proof: `GhostExodus::GroupCommitmentsConsensus` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn register_group_commitment() -> Weight {
// Proof Size summary in bytes:
// Measured: `1030`
// Estimated: `4495`
// Minimum execution time: 339_569_000 picoseconds.
Weight::from_parts(341_788_000, 0)
.saturating_add(Weight::from_parts(0, 4495))
.saturating_add(T::DbWeight::get().reads(9))
.saturating_add(T::DbWeight::get().writes(3))
// Measured: `992`
// Estimated: `4457`
// Minimum execution time: 338_644_000 picoseconds.
Weight::from_parts(343_954_000, 0)
.saturating_add(Weight::from_parts(0, 4457))
.saturating_add(T::DbWeight::get().reads(10))
.saturating_add(T::DbWeight::get().writes(4))
}
/// Storage: `GhostNetworks::NetworkTypes` (r:1 w:0)
/// Proof: `GhostNetworks::NetworkTypes` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// 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::ActiveDkgAuthorities` (r:1 w:0)
/// 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)
/// 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)
/// Proof: `GhostExodus::GroupCommitmentsConsensus` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::ExodusRequests` (r:1 w:1)
/// Proof: `GhostExodus::ExodusRequests` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::ExodusSignedGovernance` (r:1 w:1)
/// 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)
/// Proof: `GhostExodus::NonceCommitments` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// 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`)
fn register_signature_share() -> Weight {
// Proof Size summary in bytes:
// Measured: `11337`
// Estimated: `14802`
// Minimum execution time: 4_046_065_000 picoseconds.
Weight::from_parts(4_059_064_000, 0)
.saturating_add(Weight::from_parts(0, 14802))
.saturating_add(T::DbWeight::get().reads(14))
.saturating_add(T::DbWeight::get().writes(8))
// Measured: `11299`
// Estimated: `14764`
// Minimum execution time: 3_968_938_000 picoseconds.
Weight::from_parts(3_975_088_000, 0)
.saturating_add(Weight::from_parts(0, 14764))
.saturating_add(T::DbWeight::get().reads(15))
.saturating_add(T::DbWeight::get().writes(9))
}
/// Storage: `GhostExodus::CounterForExodusRequests` (r:1 w:1)
/// 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`)
/// Storage: `GhostExodus::QualificationDkgState` (r:1 w:0)
/// Proof: `GhostExodus::QualificationDkgState` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::CurrentExodusSessions` (r:1 w:1)
/// Proof: `GhostExodus::CurrentExodusSessions` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::CurrentExodus` (r:1 w:1)
/// Proof: `GhostExodus::CurrentExodus` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `GhostExodus::ExodusRequests` (r:1 w:1)
/// Proof: `GhostExodus::ExodusRequests` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn register_evm_bridge_out_exodus() -> Weight {
// Proof Size summary in bytes:
// Measured: `457`
// Estimated: `3922`
// Minimum execution time: 195_417_000 picoseconds.
Weight::from_parts(196_842_000, 0)
.saturating_add(Weight::from_parts(0, 3922))
// Measured: `448`
// Estimated: `3913`
// Minimum execution time: 191_374_000 picoseconds.
Weight::from_parts(192_991_000, 0)
.saturating_add(Weight::from_parts(0, 3913))
.saturating_add(T::DbWeight::get().reads(7))
.saturating_add(T::DbWeight::get().writes(5))
}

View File

@ -16,7 +16,7 @@
//! Autogenerated weights for `ghost_governance`
//!
//! 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`
//! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz`
//! 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:
// Measured: `283`
// Estimated: `3748`
// Minimum execution time: 224_852_000 picoseconds.
Weight::from_parts(225_347_733, 0)
// Minimum execution time: 229_254_000 picoseconds.
Weight::from_parts(229_992_093, 0)
.saturating_add(Weight::from_parts(0, 3748))
// Standard Error: 21_234
.saturating_add(Weight::from_parts(1_581_800, 0).saturating_mul(p.into()))
// Standard Error: 25_680
.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().writes(5))
}

View File

@ -16,7 +16,7 @@
//! Autogenerated weights for `ghost_weaver`
//!
//! 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`
//! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz`
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024
@ -46,40 +46,34 @@ use core::marker::PhantomData;
/// Weight functions for `ghost_weaver`.
pub struct WeightInfo<T>(PhantomData<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)
/// 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)
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostWeaver::TapestryDrafts` (r:1 w:0)
/// 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]`.
fn extend_warp(a: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `274 + a * (33 ±0)`
// Estimated: `3736 + a * (33 ±0)`
// Minimum execution time: 229_711_000 picoseconds.
Weight::from_parts(235_206_680, 0)
.saturating_add(Weight::from_parts(0, 3736))
// Standard Error: 1_554
.saturating_add(Weight::from_parts(66_905, 0).saturating_mul(a.into()))
.saturating_add(T::DbWeight::get().reads(6))
.saturating_add(T::DbWeight::get().writes(2))
.saturating_add(Weight::from_parts(0, 33).saturating_mul(a.into()))
// Measured: `223 + a * (32 ±0)`
// Estimated: `3687 + a * (32 ±0)`
// Minimum execution time: 212_751_000 picoseconds.
Weight::from_parts(215_022_916, 0)
.saturating_add(Weight::from_parts(0, 3687))
// Standard Error: 1_319
.saturating_add(Weight::from_parts(53_379, 0).saturating_mul(a.into()))
.saturating_add(T::DbWeight::get().reads(5))
.saturating_add(T::DbWeight::get().writes(1))
.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)
/// 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)
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// 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]`.
fn weave_weft(a: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `569 + a * (33 ±0)`
// Estimated: `4031 + a * (33 ±0)`
// Minimum execution time: 262_809_000 picoseconds.
Weight::from_parts(267_769_707, 0)
.saturating_add(Weight::from_parts(0, 4031))
// Standard Error: 2_375
.saturating_add(Weight::from_parts(39_109, 0).saturating_mul(a.into()))
.saturating_add(T::DbWeight::get().reads(8))
.saturating_add(T::DbWeight::get().writes(3))
.saturating_add(Weight::from_parts(0, 33).saturating_mul(a.into()))
// Measured: `518 + a * (32 ±0)`
// Estimated: `3982 + a * (32 ±0)`
// Minimum execution time: 243_006_000 picoseconds.
Weight::from_parts(246_374_350, 0)
.saturating_add(Weight::from_parts(0, 3982))
// Standard Error: 1_865
.saturating_add(Weight::from_parts(38_601, 0).saturating_mul(a.into()))
.saturating_add(T::DbWeight::get().reads(6))
.saturating_add(T::DbWeight::get().writes(2))
.saturating_add(Weight::from_parts(0, 32).saturating_mul(a.into()))
}
/// Storage: `GhostNetworks::Networks` (r:1 w:0)
/// 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]`.
fn pull_utxo_thread(a: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `500`
// Estimated: `3965`
// Minimum execution time: 217_481_000 picoseconds.
Weight::from_parts(216_492_234, 0)
.saturating_add(Weight::from_parts(0, 3965))
// Standard Error: 4_414
.saturating_add(Weight::from_parts(3_376_569, 0).saturating_mul(a.into()))
// Measured: `449`
// Estimated: `3914`
// Minimum execution time: 217_880_000 picoseconds.
Weight::from_parts(217_119_201, 0)
.saturating_add(Weight::from_parts(0, 3914))
// Standard Error: 5_460
.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().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`)
fn pull_evm_thread() -> Weight {
// Proof Size summary in bytes:
// Measured: `500`
// Estimated: `3965`
// Minimum execution time: 176_861_000 picoseconds.
Weight::from_parts(177_918_000, 0)
.saturating_add(Weight::from_parts(0, 3965))
// Measured: `449`
// Estimated: `3914`
// Minimum execution time: 183_413_000 picoseconds.
Weight::from_parts(186_271_000, 0)
.saturating_add(Weight::from_parts(0, 3914))
.saturating_add(T::DbWeight::get().reads(6))
.saturating_add(T::DbWeight::get().writes(4))
}

View File

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

View File

@ -9,7 +9,6 @@ UNIT_FILE=false
SKIP_BUILD=false
SET_ENVIRONMENT=false
VALIDATE=false
FIX_WEAVER_KEYSTORE=false
EXECUTABLE_PATH="/usr/bin/"
SPECIFICATION_PATH="/etc/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 "-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 "--generate-genesis\n\tGenerate keys to participate in the genesis file."
echo -e "--fix-weaver-keystore\n\tFix keystore prefixes (weav -> wevr) to ensure the offchain worker can find the key."
echo -e "-g, --generate-genesis\n\tGenerate keys to participate in the genesis file."
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."
}
@ -194,12 +192,9 @@ while [ $# -gt 0 ]; do
--hard-reset-i-know-what-im-doing)
HARD_RESET=true
;;
--generate-genesis)
--generate-genesis|-g)
GENERATE_GENESIS=true
;;
--fix-weaver-keystore)
FIX_WEAVER_KEYSTORE=true
;;
--help|-h)
help
exit 0
@ -533,51 +528,6 @@ if [ $UNIT_FILE = true ]; then
fi
fi
if [ $FIX_WEAVER_KEYSTORE = true ]; then
echo "[+] Starting keystore prefix fix (weav -> wevr)..."
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="77656176" # "weav"
CORRECT_PREFIX="77657672" # "wevr"
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
echo "[+] Generating keys for genesis configuration..."