Compare commits

...

4 Commits

Author SHA1 Message Date
d8e934a98e
ability to avoid too big deviations between from_block and to_block
Signed-off-by: Uncle Stinky <uncle.stinky@ghostchain.io>
2025-06-19 14:31:33 +03:00
d5643472ee
update chain specification based on NetworkData new fields
Signed-off-by: Uncle Stretch <uncle.stretch@ghostchain.io>
2025-06-18 18:56:08 +03:00
a503295939
update weights for the ghost-networks on the casper runtime
Signed-off-by: Uncle Stretch <uncle.stretch@ghostchain.io>
2025-06-18 18:54:44 +03:00
671196ebac
remove legacy release_delay and add block_distance for maximum block range for the eth_getLogs
Signed-off-by: Uncle Stretch <uncle.stretch@ghostchain.io>
2025-06-18 18:53:19 +03:00
13 changed files with 330 additions and 284 deletions

18
Cargo.lock generated
View File

@ -1186,7 +1186,7 @@ dependencies = [
[[package]] [[package]]
name = "casper-runtime" name = "casper-runtime"
version = "3.5.23" version = "3.5.24"
dependencies = [ dependencies = [
"casper-runtime-constants", "casper-runtime-constants",
"frame-benchmarking", "frame-benchmarking",
@ -3528,7 +3528,7 @@ dependencies = [
[[package]] [[package]]
name = "ghost-cli" name = "ghost-cli"
version = "0.7.197" version = "0.7.198"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"clap 4.5.4", "clap 4.5.4",
@ -3584,7 +3584,7 @@ dependencies = [
[[package]] [[package]]
name = "ghost-machine-primitives" name = "ghost-machine-primitives"
version = "0.7.197" version = "0.7.198"
dependencies = [ dependencies = [
"lazy_static", "lazy_static",
"sc-sysinfo", "sc-sysinfo",
@ -3593,7 +3593,7 @@ dependencies = [
[[package]] [[package]]
name = "ghost-metrics" name = "ghost-metrics"
version = "0.7.197" version = "0.7.198"
dependencies = [ dependencies = [
"assert_cmd", "assert_cmd",
"bs58 0.5.1", "bs58 0.5.1",
@ -3648,7 +3648,7 @@ dependencies = [
[[package]] [[package]]
name = "ghost-networks" name = "ghost-networks"
version = "0.1.6" version = "0.1.7"
dependencies = [ dependencies = [
"frame-benchmarking", "frame-benchmarking",
"frame-support", "frame-support",
@ -3667,7 +3667,7 @@ dependencies = [
[[package]] [[package]]
name = "ghost-node" name = "ghost-node"
version = "0.7.197" version = "0.7.198"
dependencies = [ dependencies = [
"assert_cmd", "assert_cmd",
"color-eyre", "color-eyre",
@ -3698,7 +3698,7 @@ dependencies = [
[[package]] [[package]]
name = "ghost-rpc" name = "ghost-rpc"
version = "0.7.197" version = "0.7.198"
dependencies = [ dependencies = [
"ghost-core-primitives", "ghost-core-primitives",
"jsonrpsee", "jsonrpsee",
@ -3750,7 +3750,7 @@ dependencies = [
[[package]] [[package]]
name = "ghost-service" name = "ghost-service"
version = "0.7.197" version = "0.7.198"
dependencies = [ dependencies = [
"assert_matches", "assert_matches",
"async-trait", "async-trait",
@ -3834,7 +3834,7 @@ dependencies = [
[[package]] [[package]]
name = "ghost-slow-clap" name = "ghost-slow-clap"
version = "0.3.26" version = "0.3.28"
dependencies = [ dependencies = [
"frame-benchmarking", "frame-benchmarking",
"frame-support", "frame-support",

View File

@ -17,7 +17,7 @@ homepage.workspace = true
[workspace.package] [workspace.package]
license = "GPL-3.0-only" license = "GPL-3.0-only"
authors = ["571nky", "57r37ch", "f4750"] authors = ["571nky", "57r37ch", "f4750"]
version = "0.7.197" version = "0.7.198"
edition = "2021" edition = "2021"
homepage = "https://ghostchain.io" homepage = "https://ghostchain.io"
repository = "https://git.ghostchain.io/ghostchain/ghost-node" repository = "https://git.ghostchain.io/ghostchain/ghost-node"

View File

@ -1,6 +1,6 @@
[package] [package]
name = "ghost-networks" name = "ghost-networks"
version = "0.1.6" version = "0.1.7"
license.workspace = true license.workspace = true
authors.workspace = true authors.workspace = true
edition.workspace = true edition.workspace = true

View File

@ -31,7 +31,7 @@ fn prepare_network<T: Config>(
gatekeeper, gatekeeper,
topic_name, topic_name,
finality_delay: Some(69), finality_delay: Some(69),
release_delay: Some(69), block_distance: 69,
network_type: NetworkType::Evm, network_type: NetworkType::Evm,
incoming_fee: 0, incoming_fee: 0,
outgoing_fee: 0, outgoing_fee: 0,
@ -120,16 +120,16 @@ benchmarks! {
assert_ne!(GhostNetworks::<T>::networks(chain_id.clone()), prev_network); assert_ne!(GhostNetworks::<T>::networks(chain_id.clone()), prev_network);
} }
update_network_release_delay { update_network_block_distance {
let delay = Some(1337); let block_distance = 1337;
let (chain_id, network) = prepare_network::<T>(1, 1); let (chain_id, network) = prepare_network::<T>(1, 1);
let authority = T::UpdateOrigin::try_successful_origin() let authority = T::UpdateOrigin::try_successful_origin()
.map_err(|_| BenchmarkError::Weightless)?; .map_err(|_| BenchmarkError::Weightless)?;
let prev_network = create_network::<T>(chain_id.clone(), network.clone())?; let prev_network = create_network::<T>(chain_id.clone(), network.clone())?;
}: _<T::RuntimeOrigin>(authority, chain_id.clone(), delay) }: _<T::RuntimeOrigin>(authority, chain_id.clone(), block_distance)
verify { verify {
assert_last_event::<T>(Event::NetworkReleaseDelayUpdated { assert_last_event::<T>(Event::NetworkBlockDistanceUpdated {
chain_id: chain_id.clone(), release_delay: delay, chain_id: chain_id.clone(), block_distance,
}.into()); }.into());
assert_ne!(GhostNetworks::<T>::networks(chain_id.clone()), prev_network); assert_ne!(GhostNetworks::<T>::networks(chain_id.clone()), prev_network);
} }

View File

@ -55,8 +55,8 @@ pub struct NetworkData {
pub gatekeeper: Vec<u8>, pub gatekeeper: Vec<u8>,
pub topic_name: Vec<u8>, pub topic_name: Vec<u8>,
pub finality_delay: Option<u64>, pub finality_delay: Option<u64>,
pub release_delay: Option<u64>,
pub network_type: NetworkType, pub network_type: NetworkType,
pub block_distance: u64,
pub incoming_fee: u32, pub incoming_fee: u32,
pub outgoing_fee: u32, pub outgoing_fee: u32,
} }
@ -158,7 +158,7 @@ pub mod module {
NetworkNameUpdated { chain_id: T::NetworkId, chain_name: Vec<u8> }, NetworkNameUpdated { chain_id: T::NetworkId, chain_name: Vec<u8> },
NetworkEndpointUpdated { chain_id: T::NetworkId, default_endpoint: Vec<u8> }, NetworkEndpointUpdated { chain_id: T::NetworkId, default_endpoint: Vec<u8> },
NetworkFinalityDelayUpdated { chain_id: T::NetworkId, finality_delay: Option<u64> }, NetworkFinalityDelayUpdated { chain_id: T::NetworkId, finality_delay: Option<u64> },
NetworkReleaseDelayUpdated { chain_id: T::NetworkId, release_delay: Option<u64> }, NetworkBlockDistanceUpdated { chain_id: T::NetworkId, block_distance: u64 },
NetworkTypeUpdated { chain_id: T::NetworkId, network_type: NetworkType }, NetworkTypeUpdated { chain_id: T::NetworkId, network_type: NetworkType },
NetworkGatekeeperUpdated { chain_id: T::NetworkId, gatekeeper: Vec<u8> }, NetworkGatekeeperUpdated { chain_id: T::NetworkId, gatekeeper: Vec<u8> },
NetworkTopicNameUpdated { chain_id: T::NetworkId, topic_name: Vec<u8> }, NetworkTopicNameUpdated { chain_id: T::NetworkId, topic_name: Vec<u8> },
@ -303,16 +303,16 @@ pub mod module {
} }
#[pallet::call_index(4)] #[pallet::call_index(4)]
#[pallet::weight(T::WeightInfo::update_network_release_delay())] #[pallet::weight(T::WeightInfo::update_network_block_distance())]
pub fn update_network_release_delay( pub fn update_network_block_distance(
origin: OriginFor<T>, origin: OriginFor<T>,
chain_id: T::NetworkId, chain_id: T::NetworkId,
release_delay: Option<u64>, block_distance: u64,
) -> DispatchResult { ) -> DispatchResult {
T::UpdateOrigin::ensure_origin_or_root(origin)?; T::UpdateOrigin::ensure_origin_or_root(origin)?;
Self::do_update_network_release_delay( Self::do_update_network_block_distance(
chain_id, chain_id,
release_delay, block_distance,
) )
} }
@ -484,21 +484,21 @@ impl<T: Config> Pallet<T> {
Ok(()) Ok(())
} }
/// Update existent network default endpoint. /// Update existent network default max distance between blocks.
pub fn do_update_network_release_delay( pub fn do_update_network_block_distance(
chain_id: T::NetworkId, chain_id: T::NetworkId,
release_delay: Option<u64>, block_distance: u64,
) -> DispatchResult { ) -> DispatchResult {
Networks::<T>::try_mutate(&chain_id, |maybe_network| -> DispatchResult { Networks::<T>::try_mutate(&chain_id, |maybe_network| -> DispatchResult {
ensure!(maybe_network.is_some(), Error::<T>::NetworkDoesNotExist); ensure!(maybe_network.is_some(), Error::<T>::NetworkDoesNotExist);
let net = maybe_network.as_mut().unwrap(); let net = maybe_network.as_mut().unwrap();
net.release_delay = release_delay; net.block_distance = block_distance;
*maybe_network = Some(net.clone()); *maybe_network = Some(net.clone());
Ok(()) Ok(())
})?; })?;
Self::deposit_event(Event::<T>::NetworkReleaseDelayUpdated { Self::deposit_event(Event::<T>::NetworkBlockDistanceUpdated {
chain_id, chain_id,
release_delay, block_distance,
}); });
Ok(()) Ok(())
} }

View File

@ -12,7 +12,7 @@ fn prepare_network_data() -> (u32, NetworkData) {
chain_name: "Ethereum".into(), chain_name: "Ethereum".into(),
default_endpoint: "https:://some-endpoint.my-server.com/v1/my-super-secret-key".into(), default_endpoint: "https:://some-endpoint.my-server.com/v1/my-super-secret-key".into(),
finality_delay: Some(69), finality_delay: Some(69),
release_delay: Some(69), block_distance: 69,
network_type: NetworkType::Evm, network_type: NetworkType::Evm,
gatekeeper: b"0x1234567891234567891234567891234567891234".to_vec(), gatekeeper: b"0x1234567891234567891234567891234567891234".to_vec(),
topic_name: b"0x12345678912345678912345678912345678912345678912345678912345678".to_vec(), topic_name: b"0x12345678912345678912345678912345678912345678912345678912345678".to_vec(),
@ -137,21 +137,21 @@ fn could_update_network_finality_delay_from_authority_account() {
} }
#[test] #[test]
fn could_update_network_release_delay_from_authority_account() { fn could_update_network_block_distance_from_authority_account() {
ExtBuilder::build() ExtBuilder::build()
.execute_with(|| { .execute_with(|| {
let new_release_delay = Some(1337); let new_block_distance = 1337;
let (chain_id, network) = prepare_network_data(); let (chain_id, network) = prepare_network_data();
register_and_check_network(chain_id, network.clone()); register_and_check_network(chain_id, network.clone());
assert_ok!(GhostNetworks::update_network_release_delay( assert_ok!(GhostNetworks::update_network_block_distance(
RuntimeOrigin::signed(UpdaterAccount::get()), RuntimeOrigin::signed(UpdaterAccount::get()),
chain_id, new_release_delay)); chain_id, new_block_distance));
System::assert_last_event(RuntimeEvent::GhostNetworks( System::assert_last_event(RuntimeEvent::GhostNetworks(
crate::Event::NetworkReleaseDelayUpdated { crate::Event::NetworkBlockDistanceUpdated {
chain_id, chain_id,
release_delay: new_release_delay })); block_distance: new_block_distance }));
let mut final_network = network.clone(); let mut final_network = network.clone();
final_network.release_delay = new_release_delay; final_network.block_distance = new_block_distance;
assert_eq!(Networks::<Test>::get(chain_id), Some(final_network.clone())); assert_eq!(Networks::<Test>::get(chain_id), Some(final_network.clone()));
assert_ne!(network, final_network); assert_ne!(network, final_network);
}); });
@ -333,18 +333,19 @@ fn could_not_update_network_release_delay_from_random_account() {
ExtBuilder::build() ExtBuilder::build()
.execute_with(|| { .execute_with(|| {
let (chain_id, network) = prepare_network_data(); let (chain_id, network) = prepare_network_data();
let block_distance = 1337;
register_and_check_network(chain_id, network.clone()); register_and_check_network(chain_id, network.clone());
assert_err!(GhostNetworks::update_network_release_delay( assert_err!(GhostNetworks::update_network_block_distance(
RuntimeOrigin::signed(RegistererAccount::get()), RuntimeOrigin::signed(RegistererAccount::get()),
chain_id, Some(1337)), chain_id, block_distance),
DispatchError::BadOrigin); DispatchError::BadOrigin);
assert_err!(GhostNetworks::update_network_release_delay( assert_err!(GhostNetworks::update_network_block_distance(
RuntimeOrigin::signed(RemoverAccount::get()), RuntimeOrigin::signed(RemoverAccount::get()),
chain_id, Some(1337)), chain_id, block_distance),
DispatchError::BadOrigin); DispatchError::BadOrigin);
assert_err!(GhostNetworks::update_network_release_delay( assert_err!(GhostNetworks::update_network_block_distance(
RuntimeOrigin::signed(RandomAccount::get()), RuntimeOrigin::signed(RandomAccount::get()),
chain_id, Some(1337)), chain_id, block_distance),
DispatchError::BadOrigin); DispatchError::BadOrigin);
assert_eq!(Networks::<Test>::get(chain_id), Some(network)); assert_eq!(Networks::<Test>::get(chain_id), Some(network));
}); });
@ -508,9 +509,9 @@ fn could_not_update_release_delay_for_non_existent_network() {
.execute_with(|| { .execute_with(|| {
let chain_id: u32 = 1; let chain_id: u32 = 1;
assert_eq!(Networks::<Test>::get(chain_id), None); assert_eq!(Networks::<Test>::get(chain_id), None);
assert_err!(GhostNetworks::update_network_release_delay( assert_err!(GhostNetworks::update_network_block_distance(
RuntimeOrigin::signed(UpdaterAccount::get()), RuntimeOrigin::signed(UpdaterAccount::get()),
chain_id, Some(1337)), chain_id, 1337),
crate::Error::<Test>::NetworkDoesNotExist); crate::Error::<Test>::NetworkDoesNotExist);
assert_eq!(Networks::<Test>::get(chain_id), None); assert_eq!(Networks::<Test>::get(chain_id), None);
}); });

View File

@ -7,7 +7,7 @@
// Ghost Network is distributed in the hope that it will be useful, // Ghost Network is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
@ -15,14 +15,14 @@
//! Autogenerated weights for `ghost_networks` //! Autogenerated weights for `ghost_networks`
//! //!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2023-11-29, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! DATE: 2025-06-18, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000` //! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `ghost`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz` //! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz`
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("casper-dev"), DB CACHE: 1024 //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024
// Executed Command: // Executed Command:
// ./target/production/ghost // ./target/release/ghost
// benchmark // benchmark
// pallet // pallet
// --chain=casper-dev // --chain=casper-dev
@ -30,8 +30,8 @@
// --repeat=20 // --repeat=20
// --pallet=ghost_networks // --pallet=ghost_networks
// --extrinsic=* // --extrinsic=*
// --execution=wasm
// --wasm-execution=compiled // --wasm-execution=compiled
// --heap-pages=4096
// --header=./file_header.txt // --header=./file_header.txt
// --output=./runtime/casper/src/weights/ghost_networks.rs // --output=./runtime/casper/src/weights/ghost_networks.rs
@ -53,7 +53,7 @@ pub trait WeightInfo {
fn update_network_name(n: u32, ) -> Weight; fn update_network_name(n: u32, ) -> Weight;
fn update_network_endpoint(n: u32, ) -> Weight; fn update_network_endpoint(n: u32, ) -> Weight;
fn update_network_finality_delay() -> Weight; fn update_network_finality_delay() -> Weight;
fn update_network_release_delay() -> Weight; fn update_network_block_distance() -> Weight;
fn update_network_type() -> Weight; fn update_network_type() -> Weight;
fn update_network_gatekeeper() -> Weight; fn update_network_gatekeeper() -> Weight;
fn update_network_topic_name() -> Weight; fn update_network_topic_name() -> Weight;
@ -65,260 +65,290 @@ pub trait WeightInfo {
/// Weight for ghost_networks using the Substrate node and recommended hardware. /// Weight for ghost_networks using the Substrate node and recommended hardware.
pub struct SubstrateWeight<T>(PhantomData<T>); pub struct SubstrateWeight<T>(PhantomData<T>);
impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> { impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
/// Storage: GhostNetworks Networks (r:1 w:1) /// Storage: `GhostNetworks::Networks` (r:1 w:1)
/// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured) /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// The range of component `n` is `[1, 20]`. /// The range of component `i` is `[1, 20]`.
/// The range of component `m` is `[1, 150]`. /// The range of component `j` is `[1, 150]`.
fn register_network(_n: u32, _m: u32, ) -> Weight { fn register_network(i: u32, j: u32, ) -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `76` // Measured: `109`
// Estimated: `2551` // Estimated: `3574`
// Minimum execution time: 32_086 nanoseconds. // Minimum execution time: 43_624_000 picoseconds.
Weight::from_parts(33_092_855, 2551) Weight::from_parts(44_945_690, 0)
.saturating_add(Weight::from_parts(0, 3574))
// Standard Error: 3_439
.saturating_add(Weight::from_parts(15_557, 0).saturating_mul(i.into()))
// Standard Error: 450
.saturating_add(Weight::from_parts(3_508, 0).saturating_mul(j.into()))
.saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1)) .saturating_add(T::DbWeight::get().writes(1))
} }
/// Storage: GhostNetworks Networks (r:1 w:1) /// Storage: `GhostNetworks::Networks` (r:1 w:1)
/// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured) /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// The range of component `n` is `[1, 20]`. /// The range of component `n` is `[1, 20]`.
fn update_network_name(_n: u32, ) -> Weight { fn update_network_name(_n: u32, ) -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `141` // Measured: `294`
// Estimated: `2616` // Estimated: `3759`
// Minimum execution time: 34_496 nanoseconds. // Minimum execution time: 48_741_000 picoseconds.
Weight::from_parts(35_728_230, 2616) Weight::from_parts(50_426_703, 0)
// Standard Error: 2_591 .saturating_add(Weight::from_parts(0, 3759))
.saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1)) .saturating_add(T::DbWeight::get().writes(1))
} }
/// Storage: GhostNetworks Networks (r:1 w:1) /// Storage: `GhostNetworks::Networks` (r:1 w:1)
/// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured) /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// The range of component `n` is `[1, 150]`. /// The range of component `n` is `[1, 150]`.
fn update_network_endpoint(_n: u32, ) -> Weight { fn update_network_endpoint(n: u32, ) -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `141` // Measured: `294`
// Estimated: `2616` // Estimated: `3759`
// Minimum execution time: 34_666 nanoseconds. // Minimum execution time: 49_090_000 picoseconds.
Weight::from_parts(35_959_961, 2616) Weight::from_parts(50_734_447, 0)
// Standard Error: 381 .saturating_add(Weight::from_parts(0, 3759))
// Standard Error: 863
.saturating_add(Weight::from_parts(786, 0).saturating_mul(n.into()))
.saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1)) .saturating_add(T::DbWeight::get().writes(1))
} }
/// Storage: GhostNetworks Networks (r:1 w:1) /// Storage: `GhostNetworks::Networks` (r:1 w:1)
/// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured) /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn update_network_finality_delay() -> Weight { fn update_network_finality_delay() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `141` // Measured: `294`
// Estimated: `2616` // Estimated: `3759`
// Minimum execution time: 33_860 nanoseconds. // Minimum execution time: 48_107_000 picoseconds.
Weight::from_parts(34_995_000, 2616) Weight::from_parts(48_993_000, 0)
.saturating_add(Weight::from_parts(0, 3759))
.saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1)) .saturating_add(T::DbWeight::get().writes(1))
} }
/// Storage: GhostNetworks Networks (r:1 w:1) /// Storage: `GhostNetworks::Networks` (r:1 w:1)
/// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured) /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn update_network_release_delay() -> Weight { fn update_network_block_distance() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `141` // Measured: `294`
// Estimated: `2616` // Estimated: `3759`
// Minimum execution time: 33_860 nanoseconds. // Minimum execution time: 48_277_000 picoseconds.
Weight::from_parts(34_995_000, 2616) Weight::from_parts(49_393_000, 0)
.saturating_add(Weight::from_parts(0, 3759))
.saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1)) .saturating_add(T::DbWeight::get().writes(1))
} }
/// Storage: GhostNetworks Networks (r:1 w:1) /// Storage: `GhostNetworks::Networks` (r:1 w:1)
/// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured) /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn update_network_type() -> Weight { fn update_network_type() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `141` // Measured: `294`
// Estimated: `2616` // Estimated: `3759`
// Minimum execution time: 34_976 nanoseconds. // Minimum execution time: 47_642_000 picoseconds.
Weight::from_parts(36_182_000, 2616) Weight::from_parts(49_212_000, 0)
.saturating_add(Weight::from_parts(0, 3759))
.saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1)) .saturating_add(T::DbWeight::get().writes(1))
} }
/// Storage: GhostNetworks Networks (r:1 w:1) /// Storage: `GhostNetworks::Networks` (r:1 w:1)
/// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured) /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn update_network_gatekeeper() -> Weight { fn update_network_gatekeeper() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `141` // Measured: `294`
// Estimated: `2616` // Estimated: `3759`
// Minimum execution time: 34_768 nanoseconds. // Minimum execution time: 49_440_000 picoseconds.
Weight::from_parts(35_580_000, 2616) Weight::from_parts(50_315_000, 0)
.saturating_add(Weight::from_parts(0, 3759))
.saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1)) .saturating_add(T::DbWeight::get().writes(1))
} }
/// Storage: GhostNetworks Networks (r:1 w:1) /// Storage: `GhostNetworks::Networks` (r:1 w:1)
/// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured) /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn update_network_topic_name() -> Weight { fn update_network_topic_name() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `141` // Measured: `294`
// Estimated: `2616` // Estimated: `3759`
// Minimum execution time: 34_768 nanoseconds. // Minimum execution time: 49_469_000 picoseconds.
Weight::from_parts(35_580_000, 2616) Weight::from_parts(50_532_000, 0)
.saturating_add(Weight::from_parts(0, 3759))
.saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1)) .saturating_add(T::DbWeight::get().writes(1))
} }
/// Storage: GhostNetworks Networks (r:1 w:1) /// Storage: `GhostNetworks::Networks` (r:1 w:1)
/// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured) /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn update_incoming_network_fee() -> Weight { fn update_incoming_network_fee() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `141` // Measured: `294`
// Estimated: `2616` // Estimated: `3759`
// Minimum execution time: 34_768 nanoseconds. // Minimum execution time: 47_858_000 picoseconds.
Weight::from_parts(35_580_000, 2616) Weight::from_parts(48_703_000, 0)
.saturating_add(Weight::from_parts(0, 3759))
.saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1)) .saturating_add(T::DbWeight::get().writes(1))
} }
/// Storage: GhostNetworks Networks (r:1 w:1) /// Storage: `GhostNetworks::Networks` (r:1 w:1)
/// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured) /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn update_outgoing_network_fee() -> Weight { fn update_outgoing_network_fee() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `141` // Measured: `294`
// Estimated: `2616` // Estimated: `3759`
// Minimum execution time: 34_768 nanoseconds. // Minimum execution time: 47_895_000 picoseconds.
Weight::from_parts(35_580_000, 2616) Weight::from_parts(49_230_000, 0)
.saturating_add(Weight::from_parts(0, 3759))
.saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1)) .saturating_add(T::DbWeight::get().writes(1))
} }
/// Storage: GhostNetworks Networks (r:1 w:1) /// Storage: `GhostNetworks::Networks` (r:1 w:1)
/// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured) /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn remove_network() -> Weight { fn remove_network() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `141` // Measured: `294`
// Estimated: `2616` // Estimated: `3759`
// Minimum execution time: 33_336 nanoseconds. // Minimum execution time: 44_052_000 picoseconds.
Weight::from_parts(34_609_000, 2616) Weight::from_parts(44_612_000, 0)
.saturating_add(Weight::from_parts(0, 3759))
.saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1)) .saturating_add(T::DbWeight::get().writes(1))
} }
} }
impl WeightInfo for () { impl WeightInfo for () {
/// Storage: GhostNetworks Networks (r:1 w:1) /// Storage: `GhostNetworks::Networks` (r:1 w:1)
/// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured) /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// The range of component `n` is `[1, 20]`. /// The range of component `i` is `[1, 20]`.
/// The range of component `m` is `[1, 150]`. /// The range of component `j` is `[1, 150]`.
fn register_network(_n: u32, _m: u32, ) -> Weight { fn register_network(i: u32, j: u32, ) -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `76` // Measured: `109`
// Estimated: `2551` // Estimated: `3574`
// Minimum execution time: 32_086 nanoseconds. // Minimum execution time: 43_624_000 picoseconds.
Weight::from_parts(33_092_855, 2551) Weight::from_parts(44_945_690, 0)
.saturating_add(Weight::from_parts(0, 3574))
// Standard Error: 3_439
.saturating_add(Weight::from_parts(15_557, 0).saturating_mul(i.into()))
// Standard Error: 450
.saturating_add(Weight::from_parts(3_508, 0).saturating_mul(j.into()))
.saturating_add(RocksDbWeight::get().reads(1)) .saturating_add(RocksDbWeight::get().reads(1))
.saturating_add(RocksDbWeight::get().writes(1)) .saturating_add(RocksDbWeight::get().writes(1))
} }
/// Storage: GhostNetworks Networks (r:1 w:1) /// Storage: `GhostNetworks::Networks` (r:1 w:1)
/// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured) /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// The range of component `n` is `[1, 20]`. /// The range of component `n` is `[1, 20]`.
fn update_network_name(_n: u32, ) -> Weight { fn update_network_name(_n: u32, ) -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `141` // Measured: `294`
// Estimated: `2616` // Estimated: `3759`
// Minimum execution time: 34_496 nanoseconds. // Minimum execution time: 48_741_000 picoseconds.
Weight::from_parts(35_728_230, 2616) Weight::from_parts(50_426_703, 0)
// Standard Error: 2_591 .saturating_add(Weight::from_parts(0, 3759))
.saturating_add(RocksDbWeight::get().reads(1)) .saturating_add(RocksDbWeight::get().reads(1))
.saturating_add(RocksDbWeight::get().writes(1)) .saturating_add(RocksDbWeight::get().writes(1))
} }
/// Storage: GhostNetworks Networks (r:1 w:1) /// Storage: `GhostNetworks::Networks` (r:1 w:1)
/// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured) /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// The range of component `n` is `[1, 150]`. /// The range of component `n` is `[1, 150]`.
fn update_network_endpoint(_n: u32, ) -> Weight { fn update_network_endpoint(n: u32, ) -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `141` // Measured: `294`
// Estimated: `2616` // Estimated: `3759`
// Minimum execution time: 34_666 nanoseconds. // Minimum execution time: 49_090_000 picoseconds.
Weight::from_parts(35_959_961, 2616) Weight::from_parts(50_734_447, 0)
// Standard Error: 381 .saturating_add(Weight::from_parts(0, 3759))
// Standard Error: 863
.saturating_add(Weight::from_parts(786, 0).saturating_mul(n.into()))
.saturating_add(RocksDbWeight::get().reads(1)) .saturating_add(RocksDbWeight::get().reads(1))
.saturating_add(RocksDbWeight::get().writes(1)) .saturating_add(RocksDbWeight::get().writes(1))
} }
/// Storage: GhostNetworks Networks (r:1 w:1) /// Storage: `GhostNetworks::Networks` (r:1 w:1)
/// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured) /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn update_network_finality_delay() -> Weight { fn update_network_finality_delay() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `141` // Measured: `294`
// Estimated: `2616` // Estimated: `3759`
// Minimum execution time: 33_860 nanoseconds. // Minimum execution time: 48_107_000 picoseconds.
Weight::from_parts(34_995_000, 2616) Weight::from_parts(48_993_000, 0)
.saturating_add(Weight::from_parts(0, 3759))
.saturating_add(RocksDbWeight::get().reads(1)) .saturating_add(RocksDbWeight::get().reads(1))
.saturating_add(RocksDbWeight::get().writes(1)) .saturating_add(RocksDbWeight::get().writes(1))
} }
/// Storage: GhostNetworks Networks (r:1 w:1) /// Storage: `GhostNetworks::Networks` (r:1 w:1)
/// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured) /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn update_network_release_delay() -> Weight { fn update_network_block_distance() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `141` // Measured: `294`
// Estimated: `2616` // Estimated: `3759`
// Minimum execution time: 33_860 nanoseconds. // Minimum execution time: 48_277_000 picoseconds.
Weight::from_parts(34_995_000, 2616) Weight::from_parts(49_393_000, 0)
.saturating_add(Weight::from_parts(0, 3759))
.saturating_add(RocksDbWeight::get().reads(1)) .saturating_add(RocksDbWeight::get().reads(1))
.saturating_add(RocksDbWeight::get().writes(1)) .saturating_add(RocksDbWeight::get().writes(1))
} }
/// Storage: GhostNetworks Networks (r:1 w:1) /// Storage: `GhostNetworks::Networks` (r:1 w:1)
/// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured) /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn update_network_type() -> Weight { fn update_network_type() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `141` // Measured: `294`
// Estimated: `2616` // Estimated: `3759`
// Minimum execution time: 34_976 nanoseconds. // Minimum execution time: 47_642_000 picoseconds.
Weight::from_parts(36_182_000, 2616) Weight::from_parts(49_212_000, 0)
.saturating_add(Weight::from_parts(0, 3759))
.saturating_add(RocksDbWeight::get().reads(1)) .saturating_add(RocksDbWeight::get().reads(1))
.saturating_add(RocksDbWeight::get().writes(1)) .saturating_add(RocksDbWeight::get().writes(1))
} }
/// Storage: GhostNetworks Networks (r:1 w:1) /// Storage: `GhostNetworks::Networks` (r:1 w:1)
/// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured) /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn update_network_gatekeeper() -> Weight { fn update_network_gatekeeper() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `141` // Measured: `294`
// Estimated: `2616` // Estimated: `3759`
// Minimum execution time: 34_768 nanoseconds. // Minimum execution time: 49_440_000 picoseconds.
Weight::from_parts(35_580_000, 2616) Weight::from_parts(50_315_000, 0)
.saturating_add(Weight::from_parts(0, 3759))
.saturating_add(RocksDbWeight::get().reads(1)) .saturating_add(RocksDbWeight::get().reads(1))
.saturating_add(RocksDbWeight::get().writes(1)) .saturating_add(RocksDbWeight::get().writes(1))
} }
/// Storage: GhostNetworks Networks (r:1 w:1) /// Storage: `GhostNetworks::Networks` (r:1 w:1)
/// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured) /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn update_network_topic_name() -> Weight { fn update_network_topic_name() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `141` // Measured: `294`
// Estimated: `2616` // Estimated: `3759`
// Minimum execution time: 34_768 nanoseconds. // Minimum execution time: 49_469_000 picoseconds.
Weight::from_parts(35_580_000, 2616) Weight::from_parts(50_532_000, 0)
.saturating_add(Weight::from_parts(0, 3759))
.saturating_add(RocksDbWeight::get().reads(1)) .saturating_add(RocksDbWeight::get().reads(1))
.saturating_add(RocksDbWeight::get().writes(1)) .saturating_add(RocksDbWeight::get().writes(1))
} }
/// Storage: GhostNetworks Networks (r:1 w:1) /// Storage: `GhostNetworks::Networks` (r:1 w:1)
/// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured) /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn update_incoming_network_fee() -> Weight { fn update_incoming_network_fee() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `141` // Measured: `294`
// Estimated: `2616` // Estimated: `3759`
// Minimum execution time: 34_768 nanoseconds. // Minimum execution time: 47_858_000 picoseconds.
Weight::from_parts(35_580_000, 2616) Weight::from_parts(48_703_000, 0)
.saturating_add(Weight::from_parts(0, 3759))
.saturating_add(RocksDbWeight::get().reads(1)) .saturating_add(RocksDbWeight::get().reads(1))
.saturating_add(RocksDbWeight::get().writes(1)) .saturating_add(RocksDbWeight::get().writes(1))
} }
/// Storage: GhostNetworks Networks (r:1 w:1) /// Storage: `GhostNetworks::Networks` (r:1 w:1)
/// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured) /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn update_outgoing_network_fee() -> Weight { fn update_outgoing_network_fee() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `141` // Measured: `294`
// Estimated: `2616` // Estimated: `3759`
// Minimum execution time: 34_768 nanoseconds. // Minimum execution time: 47_895_000 picoseconds.
Weight::from_parts(35_580_000, 2616) Weight::from_parts(49_230_000, 0)
.saturating_add(Weight::from_parts(0, 3759))
.saturating_add(RocksDbWeight::get().reads(1)) .saturating_add(RocksDbWeight::get().reads(1))
.saturating_add(RocksDbWeight::get().writes(1)) .saturating_add(RocksDbWeight::get().writes(1))
} }
/// Storage: GhostNetworks Networks (r:1 w:1) /// Storage: `GhostNetworks::Networks` (r:1 w:1)
/// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured) /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn remove_network() -> Weight { fn remove_network() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `141` // Measured: `294`
// Estimated: `2616` // Estimated: `3759`
// Minimum execution time: 33_336 nanoseconds. // Minimum execution time: 44_052_000 picoseconds.
Weight::from_parts(34_609_000, 2616) Weight::from_parts(44_612_000, 0)
.saturating_add(Weight::from_parts(0, 3759))
.saturating_add(RocksDbWeight::get().reads(1)) .saturating_add(RocksDbWeight::get().reads(1))
.saturating_add(RocksDbWeight::get().writes(1)) .saturating_add(RocksDbWeight::get().writes(1))
} }

View File

@ -1,6 +1,6 @@
[package] [package]
name = "ghost-slow-clap" name = "ghost-slow-clap"
version = "0.3.27" version = "0.3.28"
description = "Applause protocol for the EVM bridge" description = "Applause protocol for the EVM bridge"
license.workspace = true license.workspace = true
authors.workspace = true authors.workspace = true

View File

@ -687,6 +687,7 @@ impl<T: Config> Pallet<T> {
let network_id_encoded = network_id.encode(); let network_id_encoded = network_id.encode();
let block_number_key = Self::create_storage_key(b"block-", &network_id_encoded); let block_number_key = Self::create_storage_key(b"block-", &network_id_encoded);
let block_distance_key = Self::create_storage_key(b"block-distance-", &network_id_encoded);
let endpoint_key = Self::create_storage_key(b"endpoint-", &network_id_encoded); let endpoint_key = Self::create_storage_key(b"endpoint-", &network_id_encoded);
let rpc_endpoint = StorageValueRef::persistent(&endpoint_key) let rpc_endpoint = StorageValueRef::persistent(&endpoint_key)
@ -695,6 +696,12 @@ impl<T: Config> Pallet<T> {
.flatten() .flatten()
.unwrap_or(network_data.default_endpoint.clone()); .unwrap_or(network_data.default_endpoint.clone());
let max_block_distance = StorageValueRef::persistent(&block_distance_key)
.get()
.ok()
.flatten()
.unwrap_or(network_data.block_distance);
let mutation_result = StorageValueRef::persistent(&block_number_key).mutate(|result_block_range: Result<Option<(u64, u64)>, StorageRetrievalError>| { let mutation_result = StorageValueRef::persistent(&block_number_key).mutate(|result_block_range: Result<Option<(u64, u64)>, StorageRetrievalError>| {
match result_block_range { match result_block_range {
Ok(maybe_block_range) => { Ok(maybe_block_range) => {
@ -708,7 +715,7 @@ impl<T: Config> Pallet<T> {
match network_data.network_type { match network_data.network_type {
NetworkType::Evm => { NetworkType::Evm => {
let new_evm_block = Self::apply_evm_response( let maybe_new_evm_block = Self::apply_evm_response(
&response_bytes, &response_bytes,
authority_index, authority_index,
authority_key, authority_key,
@ -717,12 +724,20 @@ impl<T: Config> Pallet<T> {
)?; )?;
let finality_delay = network_data.finality_delay.unwrap_or_default(); let finality_delay = network_data.finality_delay.unwrap_or_default();
let estimated_block = new_evm_block.saturating_sub(finality_delay); let estimated_block = maybe_new_evm_block
.map(|new_evm_block| new_evm_block.saturating_sub(finality_delay))
.unwrap_or_default();
Ok(match maybe_block_range { Ok(match maybe_block_range {
Some((from_block, to_block)) => match new_evm_block { Some((from_block, to_block)) => match maybe_new_evm_block {
0 => (to_block, to_block), Some(_) => match estimated_block.checked_sub(from_block) {
_ => (from_block, estimated_block), Some(current_distance) if current_distance < max_block_distance =>
(from_block, estimated_block),
_ => (from_block, from_block
.saturating_add(max_block_distance)
.min(estimated_block)),
},
None => (to_block, to_block),
}, },
None => (estimated_block, estimated_block), None => (estimated_block, estimated_block),
}) })
@ -748,7 +763,7 @@ impl<T: Config> Pallet<T> {
authority_key: T::AuthorityId, authority_key: T::AuthorityId,
session_index: SessionIndex, session_index: SessionIndex,
network_id: NetworkIdOf<T> network_id: NetworkIdOf<T>
) -> OffchainResult<T, u64> { ) -> OffchainResult<T, Option<u64>> {
match Self::parse_evm_response(&response_bytes)? { match Self::parse_evm_response(&response_bytes)? {
EvmResponseType::BlockNumber(new_evm_block) => { EvmResponseType::BlockNumber(new_evm_block) => {
log::info!( log::info!(
@ -757,7 +772,7 @@ impl<T: Config> Pallet<T> {
new_evm_block, new_evm_block,
network_id, network_id,
); );
Ok(new_evm_block) Ok(Some(new_evm_block))
}, },
EvmResponseType::TransactionLogs(evm_logs) => { EvmResponseType::TransactionLogs(evm_logs) => {
let claps: Vec<_> = evm_logs let claps: Vec<_> = evm_logs
@ -799,7 +814,7 @@ impl<T: Config> Pallet<T> {
.map_err(|_| OffchainErr::SubmitTransaction)?; .map_err(|_| OffchainErr::SubmitTransaction)?;
} }
Ok(0u64) Ok(None)
} }
} }
} }

View File

@ -24,7 +24,7 @@ fn prepare_evm_network(
chain_name: "Ethereum".into(), chain_name: "Ethereum".into(),
default_endpoint: get_rpc_endpoint(), default_endpoint: get_rpc_endpoint(),
finality_delay: Some(69), finality_delay: Some(69),
release_delay: Some(69), block_distance: 69,
network_type: ghost_networks::NetworkType::Evm, network_type: ghost_networks::NetworkType::Evm,
gatekeeper: get_gatekeeper(), gatekeeper: get_gatekeeper(),
topic_name: get_topic_name(), topic_name: get_topic_name(),
@ -197,9 +197,9 @@ fn should_make_http_call_and_parse_block_number() {
let request_body = SlowClap::prepare_request_body_for_latest_block(&network_data); let request_body = SlowClap::prepare_request_body_for_latest_block(&network_data);
let raw_response = SlowClap::fetch_from_remote(&rpc_endpoint, &request_body)?; let raw_response = SlowClap::fetch_from_remote(&rpc_endpoint, &request_body)?;
let evm_block_number = SlowClap::apply_evm_response(&raw_response, 69, Default::default(), 420, 1)?; let maybe_evm_block_number = SlowClap::apply_evm_response(&raw_response, 69, Default::default(), 420, 1)?;
assert_eq!(evm_block_number, 20335745); assert_eq!(maybe_evm_block_number, Some(20335745));
Ok(()) Ok(())
}); });
} }
@ -234,7 +234,7 @@ fn should_make_http_call_and_parse_logs() {
EvmResponseType::TransactionLogs(evm_logs) => assert_eq!(evm_logs.len(), 2), EvmResponseType::TransactionLogs(evm_logs) => assert_eq!(evm_logs.len(), 2),
} }
let evm_block_number = SlowClap::apply_evm_response( let maybe_evm_block_number = SlowClap::apply_evm_response(
&raw_response, &raw_response,
1, 1,
UintAuthorityId::from(2), UintAuthorityId::from(2),
@ -242,7 +242,7 @@ fn should_make_http_call_and_parse_logs() {
network_id, network_id,
)?; )?;
assert_eq!(evm_block_number, 0); assert_eq!(maybe_evm_block_number, None);
Ok(()) Ok(())
}); });
} }

View File

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

View File

@ -7,7 +7,7 @@
// Ghost Network is distributed in the hope that it will be useful, // Ghost Network is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
@ -16,7 +16,7 @@
//! Autogenerated weights for `ghost_networks` //! Autogenerated weights for `ghost_networks`
//! //!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2024-08-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! DATE: 2025-06-18, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000` //! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz` //! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz`
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024 //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024
@ -54,13 +54,13 @@ impl<T: frame_system::Config> ghost_networks::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `109` // Measured: `109`
// Estimated: `3574` // Estimated: `3574`
// Minimum execution time: 44_464_000 picoseconds. // Minimum execution time: 43_624_000 picoseconds.
Weight::from_parts(44_802_179, 0) Weight::from_parts(44_945_690, 0)
.saturating_add(Weight::from_parts(0, 3574)) .saturating_add(Weight::from_parts(0, 3574))
// Standard Error: 11_381 // Standard Error: 3_439
.saturating_add(Weight::from_parts(42_872, 0).saturating_mul(i.into())) .saturating_add(Weight::from_parts(15_557, 0).saturating_mul(i.into()))
// Standard Error: 1_492 // Standard Error: 450
.saturating_add(Weight::from_parts(8_794, 0).saturating_mul(j.into())) .saturating_add(Weight::from_parts(3_508, 0).saturating_mul(j.into()))
.saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1)) .saturating_add(T::DbWeight::get().writes(1))
} }
@ -69,11 +69,11 @@ impl<T: frame_system::Config> ghost_networks::WeightInfo for WeightInfo<T> {
/// The range of component `n` is `[1, 20]`. /// The range of component `n` is `[1, 20]`.
fn update_network_name(_n: u32, ) -> Weight { fn update_network_name(_n: u32, ) -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `295` // Measured: `294`
// Estimated: `3760` // Estimated: `3759`
// Minimum execution time: 50_224_000 picoseconds. // Minimum execution time: 48_741_000 picoseconds.
Weight::from_parts(54_405_362, 0) Weight::from_parts(50_426_703, 0)
.saturating_add(Weight::from_parts(0, 3760)) .saturating_add(Weight::from_parts(0, 3759))
.saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1)) .saturating_add(T::DbWeight::get().writes(1))
} }
@ -82,13 +82,13 @@ impl<T: frame_system::Config> ghost_networks::WeightInfo for WeightInfo<T> {
/// The range of component `n` is `[1, 150]`. /// The range of component `n` is `[1, 150]`.
fn update_network_endpoint(n: u32, ) -> Weight { fn update_network_endpoint(n: u32, ) -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `295` // Measured: `294`
// Estimated: `3760` // Estimated: `3759`
// Minimum execution time: 50_598_000 picoseconds. // Minimum execution time: 49_090_000 picoseconds.
Weight::from_parts(54_951_352, 0) Weight::from_parts(50_734_447, 0)
.saturating_add(Weight::from_parts(0, 3760)) .saturating_add(Weight::from_parts(0, 3759))
// Standard Error: 10_596 // Standard Error: 863
.saturating_add(Weight::from_parts(11_691, 0).saturating_mul(n.into())) .saturating_add(Weight::from_parts(786, 0).saturating_mul(n.into()))
.saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1)) .saturating_add(T::DbWeight::get().writes(1))
} }
@ -96,23 +96,23 @@ impl<T: frame_system::Config> ghost_networks::WeightInfo for WeightInfo<T> {
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn update_network_finality_delay() -> Weight { fn update_network_finality_delay() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `295` // Measured: `294`
// Estimated: `3760` // Estimated: `3759`
// Minimum execution time: 49_089_000 picoseconds. // Minimum execution time: 48_107_000 picoseconds.
Weight::from_parts(50_797_000, 0) Weight::from_parts(48_993_000, 0)
.saturating_add(Weight::from_parts(0, 3760)) .saturating_add(Weight::from_parts(0, 3759))
.saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1)) .saturating_add(T::DbWeight::get().writes(1))
} }
/// Storage: `GhostNetworks::Networks` (r:1 w:1) /// Storage: `GhostNetworks::Networks` (r:1 w:1)
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn update_network_release_delay() -> Weight { fn update_network_block_distance() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `295` // Measured: `294`
// Estimated: `3760` // Estimated: `3759`
// Minimum execution time: 49_606_000 picoseconds. // Minimum execution time: 48_277_000 picoseconds.
Weight::from_parts(50_371_000, 0) Weight::from_parts(49_393_000, 0)
.saturating_add(Weight::from_parts(0, 3760)) .saturating_add(Weight::from_parts(0, 3759))
.saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1)) .saturating_add(T::DbWeight::get().writes(1))
} }
@ -120,11 +120,11 @@ impl<T: frame_system::Config> ghost_networks::WeightInfo for WeightInfo<T> {
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn update_network_type() -> Weight { fn update_network_type() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `295` // Measured: `294`
// Estimated: `3760` // Estimated: `3759`
// Minimum execution time: 48_135_000 picoseconds. // Minimum execution time: 47_642_000 picoseconds.
Weight::from_parts(48_619_000, 0) Weight::from_parts(49_212_000, 0)
.saturating_add(Weight::from_parts(0, 3760)) .saturating_add(Weight::from_parts(0, 3759))
.saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1)) .saturating_add(T::DbWeight::get().writes(1))
} }
@ -132,11 +132,11 @@ impl<T: frame_system::Config> ghost_networks::WeightInfo for WeightInfo<T> {
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn update_network_gatekeeper() -> Weight { fn update_network_gatekeeper() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `295` // Measured: `294`
// Estimated: `3760` // Estimated: `3759`
// Minimum execution time: 50_027_000 picoseconds. // Minimum execution time: 49_440_000 picoseconds.
Weight::from_parts(51_212_000, 0) Weight::from_parts(50_315_000, 0)
.saturating_add(Weight::from_parts(0, 3760)) .saturating_add(Weight::from_parts(0, 3759))
.saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1)) .saturating_add(T::DbWeight::get().writes(1))
} }
@ -144,11 +144,11 @@ impl<T: frame_system::Config> ghost_networks::WeightInfo for WeightInfo<T> {
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn update_network_topic_name() -> Weight { fn update_network_topic_name() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `295` // Measured: `294`
// Estimated: `3760` // Estimated: `3759`
// Minimum execution time: 50_686_000 picoseconds. // Minimum execution time: 49_469_000 picoseconds.
Weight::from_parts(52_276_000, 0) Weight::from_parts(50_532_000, 0)
.saturating_add(Weight::from_parts(0, 3760)) .saturating_add(Weight::from_parts(0, 3759))
.saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1)) .saturating_add(T::DbWeight::get().writes(1))
} }
@ -156,11 +156,11 @@ impl<T: frame_system::Config> ghost_networks::WeightInfo for WeightInfo<T> {
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn update_incoming_network_fee() -> Weight { fn update_incoming_network_fee() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `295` // Measured: `294`
// Estimated: `3760` // Estimated: `3759`
// Minimum execution time: 48_485_000 picoseconds. // Minimum execution time: 47_858_000 picoseconds.
Weight::from_parts(49_672_000, 0) Weight::from_parts(48_703_000, 0)
.saturating_add(Weight::from_parts(0, 3760)) .saturating_add(Weight::from_parts(0, 3759))
.saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1)) .saturating_add(T::DbWeight::get().writes(1))
} }
@ -168,11 +168,11 @@ impl<T: frame_system::Config> ghost_networks::WeightInfo for WeightInfo<T> {
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn update_outgoing_network_fee() -> Weight { fn update_outgoing_network_fee() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `295` // Measured: `294`
// Estimated: `3760` // Estimated: `3759`
// Minimum execution time: 48_926_000 picoseconds. // Minimum execution time: 47_895_000 picoseconds.
Weight::from_parts(49_482_000, 0) Weight::from_parts(49_230_000, 0)
.saturating_add(Weight::from_parts(0, 3760)) .saturating_add(Weight::from_parts(0, 3759))
.saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1)) .saturating_add(T::DbWeight::get().writes(1))
} }
@ -180,11 +180,11 @@ impl<T: frame_system::Config> ghost_networks::WeightInfo for WeightInfo<T> {
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn remove_network() -> Weight { fn remove_network() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `295` // Measured: `294`
// Estimated: `3760` // Estimated: `3759`
// Minimum execution time: 45_163_000 picoseconds. // Minimum execution time: 44_052_000 picoseconds.
Weight::from_parts(45_822_000, 0) Weight::from_parts(44_612_000, 0)
.saturating_add(Weight::from_parts(0, 3760)) .saturating_add(Weight::from_parts(0, 3759))
.saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1)) .saturating_add(T::DbWeight::get().writes(1))
} }

View File

@ -178,7 +178,7 @@ fn casper_testnet_evm_networks() -> Vec<(u32, Vec<u8>)> {
chain_name: "ethereum-mainnet".into(), chain_name: "ethereum-mainnet".into(),
default_endpoint: "https://nd-422-757-666.p2pify.com/0a9d79d93fb2f4a4b1e04695da2b77a7/".into(), default_endpoint: "https://nd-422-757-666.p2pify.com/0a9d79d93fb2f4a4b1e04695da2b77a7/".into(),
finality_delay: Some(40u64), finality_delay: Some(40u64),
release_delay: Some(80u64), block_distance: 50u64,
network_type: ghost_networks::NetworkType::Evm, network_type: ghost_networks::NetworkType::Evm,
gatekeeper: "0x4d224452801aced8b2f0aebe155379bb5d594381".into(), gatekeeper: "0x4d224452801aced8b2f0aebe155379bb5d594381".into(),
topic_name: "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef".into(), topic_name: "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef".into(),
@ -189,7 +189,7 @@ fn casper_testnet_evm_networks() -> Vec<(u32, Vec<u8>)> {
chain_name: "bnb-mainnet".into(), chain_name: "bnb-mainnet".into(),
default_endpoint: "https://bsc-mainnet.core.chainstack.com/35848e183f3e3303c8cfeacbea831cab/".into(), default_endpoint: "https://bsc-mainnet.core.chainstack.com/35848e183f3e3303c8cfeacbea831cab/".into(),
finality_delay: Some(20u64), finality_delay: Some(20u64),
release_delay: Some(40u64), block_distance: 50u64,
network_type: ghost_networks::NetworkType::Evm, network_type: ghost_networks::NetworkType::Evm,
gatekeeper: "0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82".into(), gatekeeper: "0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82".into(),
topic_name: "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef".into(), topic_name: "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef".into(),