insert testnet preclaims into governance pallet

Signed-off-by: Uncle Stretch <uncle.stretch@ghostchain.io>
This commit is contained in:
Uncle Stretch 2026-09-11 16:10:49 +03:00
parent 1e1d2bdc81
commit 3ed3c659c6
Signed by: str3tch
GPG Key ID: 84F3190747EE79AA
5 changed files with 44 additions and 12 deletions

4
Cargo.lock generated
View File

@ -1195,7 +1195,7 @@ dependencies = [
[[package]] [[package]]
name = "casper-runtime" name = "casper-runtime"
version = "4.0.8" version = "4.0.9"
dependencies = [ dependencies = [
"casper-runtime-constants", "casper-runtime-constants",
"frame-benchmarking", "frame-benchmarking",
@ -3757,7 +3757,7 @@ dependencies = [
[[package]] [[package]]
name = "ghost-helpers" name = "ghost-helpers"
version = "0.0.10" version = "0.0.11"
dependencies = [ dependencies = [
"frame-support", "frame-support",
"ghost-traits", "ghost-traits",

View File

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

View File

@ -175,27 +175,43 @@ pub struct NetworkClaim<NetworkId, Balance> {
pub proof_size: u32 pub proof_size: u32
} }
impl<NetworkId, Balance> NetworkClaim<NetworkId, Balance> { #[derive(Default)]
pub struct NetworkClaimBuilder<NetworkId, Balance> {
network_id: Option<NetworkId>,
merkle_root: Option<H256>,
amount: Option<Balance>,
proof_size: Option<u32>
}
impl<NetworkId, Balance> NetworkClaimBuilder<NetworkId, Balance> {
pub fn with_amount(mut self, amount: Balance) -> Self { pub fn with_amount(mut self, amount: Balance) -> Self {
self.amount = amount; self.amount = Some(amount);
self self
} }
pub fn with_network_id(mut self, network_id: NetworkId) -> Self { pub fn with_network_id(mut self, network_id: NetworkId) -> Self {
self.network_id = network_id; self.network_id = Some(network_id);
self self
} }
pub fn with_merkle_root(mut self, merkle_root: H256) -> Self { pub fn with_merkle_root(mut self, merkle_root: H256) -> Self {
self.merkle_root = merkle_root; self.merkle_root = Some(merkle_root);
self self
} }
pub fn with_proof_size(mut self, proof_size: u32) -> Self { pub fn with_proof_size(mut self, proof_size: u32) -> Self {
self.proof_size = proof_size; self.proof_size = Some(proof_size);
self self
} }
pub fn build(self) -> NetworkClaim<NetworkId, Balance> {
NetworkClaim {
network_id: self.network_id.expect("NetworkClaim Error: missing network_id"),
amount: self.amount.expect("NetworkClaim Error: missing amount"),
merkle_root: self.merkle_root.expect("NetworkClaim Error: merkle_root"),
proof_size: self.proof_size.expect("NetworkClaim Error: missing proof_size"),
}
}
} }
#[derive( #[derive(

View File

@ -1,6 +1,6 @@
[package] [package]
name = "casper-runtime" name = "casper-runtime"
version = "4.0.8" version = "4.0.9"
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

@ -11,7 +11,7 @@ use grandpa_primitives::AuthorityId as GrandpaId;
use hex_literal::hex; use hex_literal::hex;
use sp_core::crypto::UncheckedFrom; use sp_core::crypto::UncheckedFrom;
use sp_core::{sr25519, Pair, Public}; use sp_core::{sr25519, H256, Pair, Public};
use sp_runtime::{traits::IdentifyAccount, Perbill}; use sp_runtime::{traits::IdentifyAccount, Perbill};
#[cfg(not(feature = "std"))] #[cfg(not(feature = "std"))]
use sp_std::alloc::format; use sp_std::alloc::format;
@ -22,7 +22,7 @@ use crate::{Balance, NetworkId};
use ghost_weaver::sr25519::AuthorityId as WeaverId; use ghost_weaver::sr25519::AuthorityId as WeaverId;
use ghost_exodus::sr25519::AuthorityId as ExodusId; use ghost_exodus::sr25519::AuthorityId as ExodusId;
use ghost_helpers::networks::{NetworkClaim, NetworkInitiation}; use ghost_helpers::networks::{NetworkClaim, NetworkClaimBuilder, NetworkInitiation};
#[derive(Clone)] #[derive(Clone)]
pub struct AuthorityInitiation { pub struct AuthorityInitiation {
@ -336,11 +336,27 @@ pub fn casper_local_config_genesis() -> serde_json::Value {
} }
pub fn casper_staging_config_genesis() -> serde_json::Value { pub fn casper_staging_config_genesis() -> serde_json::Value {
let initial_preclaims = vec![
NetworkClaimBuilder::default()
.with_amount(1922500000000000000000u128.into())
.with_network_id(11155111)
.with_merkle_root(H256::from_slice(&hex!("f8d8c981f214958cc2738bf068807c0f504f0e9a1d61ba5c8cd01bc7f9cc6d26")))
.with_proof_size(8)
.build(),
NetworkClaimBuilder::default()
.with_amount(18550200000000000000000u128.into())
.with_network_id(7001)
.with_merkle_root(H256::from_slice(&hex!("793b300540c6530c24be7cc40b1ba91f0a586da8e180b98e91b055a9a12f45e2")))
.with_proof_size(11)
.build(),
];
testnet_config_genesis( testnet_config_genesis(
casper_staging_initial_authorities(), casper_staging_initial_authorities(),
Default::default(), Default::default(),
casper_testnet_networks(), casper_testnet_networks(),
Default::default(), initial_preclaims,
) )
} }