forked from ghostchain/ghost-node
insert testnet preclaims into governance pallet
Signed-off-by: Uncle Stretch <uncle.stretch@ghostchain.io>
This commit is contained in:
parent
1e1d2bdc81
commit
3ed3c659c6
4
Cargo.lock
generated
4
Cargo.lock
generated
@ -1195,7 +1195,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "casper-runtime"
|
||||
version = "4.0.8"
|
||||
version = "4.0.9"
|
||||
dependencies = [
|
||||
"casper-runtime-constants",
|
||||
"frame-benchmarking",
|
||||
@ -3757,7 +3757,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ghost-helpers"
|
||||
version = "0.0.10"
|
||||
version = "0.0.11"
|
||||
dependencies = [
|
||||
"frame-support",
|
||||
"ghost-traits",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
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."
|
||||
license.workspace = true
|
||||
authors.workspace = true
|
||||
|
||||
@ -175,27 +175,43 @@ pub struct NetworkClaim<NetworkId, Balance> {
|
||||
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 {
|
||||
self.amount = amount;
|
||||
self.amount = Some(amount);
|
||||
self
|
||||
}
|
||||
|
||||
pub fn with_network_id(mut self, network_id: NetworkId) -> Self {
|
||||
self.network_id = network_id;
|
||||
self.network_id = Some(network_id);
|
||||
self
|
||||
}
|
||||
|
||||
pub fn with_merkle_root(mut self, merkle_root: H256) -> Self {
|
||||
self.merkle_root = merkle_root;
|
||||
self.merkle_root = Some(merkle_root);
|
||||
self
|
||||
}
|
||||
|
||||
pub fn with_proof_size(mut self, proof_size: u32) -> Self {
|
||||
self.proof_size = proof_size;
|
||||
self.proof_size = Some(proof_size);
|
||||
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(
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "casper-runtime"
|
||||
version = "4.0.8"
|
||||
version = "4.0.9"
|
||||
build = "build.rs"
|
||||
description = "Runtime of the Casper Network"
|
||||
edition.workspace = true
|
||||
|
||||
@ -11,7 +11,7 @@ use grandpa_primitives::AuthorityId as GrandpaId;
|
||||
use hex_literal::hex;
|
||||
use sp_core::crypto::UncheckedFrom;
|
||||
|
||||
use sp_core::{sr25519, Pair, Public};
|
||||
use sp_core::{sr25519, H256, Pair, Public};
|
||||
use sp_runtime::{traits::IdentifyAccount, Perbill};
|
||||
#[cfg(not(feature = "std"))]
|
||||
use sp_std::alloc::format;
|
||||
@ -22,7 +22,7 @@ use crate::{Balance, NetworkId};
|
||||
|
||||
use ghost_weaver::sr25519::AuthorityId as WeaverId;
|
||||
use ghost_exodus::sr25519::AuthorityId as ExodusId;
|
||||
use ghost_helpers::networks::{NetworkClaim, NetworkInitiation};
|
||||
use ghost_helpers::networks::{NetworkClaim, NetworkClaimBuilder, NetworkInitiation};
|
||||
|
||||
#[derive(Clone)]
|
||||
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 {
|
||||
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(
|
||||
casper_staging_initial_authorities(),
|
||||
Default::default(),
|
||||
casper_testnet_networks(),
|
||||
Default::default(),
|
||||
initial_preclaims,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user