make runtime more legit for real use case; make genesis file cleaner
Signed-off-by: Uncle Stinky <uncle.stinky@ghostchain.io>
This commit is contained in:
parent
882ec7ec0d
commit
98de9373dd
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "casper-runtime"
|
name = "casper-runtime"
|
||||||
version = "4.0.1"
|
version = "4.0.2"
|
||||||
build = "build.rs"
|
build = "build.rs"
|
||||||
description = "Runtime of the Casper Network"
|
description = "Runtime of the Casper Network"
|
||||||
edition.workspace = true
|
edition.workspace = true
|
||||||
|
|||||||
@ -221,8 +221,8 @@ fn casper_testnet_networks() -> Vec<NetworkInitiation<NetworkId, Balance>> {
|
|||||||
.with_finality_delay(69)
|
.with_finality_delay(69)
|
||||||
.with_rate_limit_delay(5_000)
|
.with_rate_limit_delay(5_000)
|
||||||
.with_block_deviation(420)
|
.with_block_deviation(420)
|
||||||
.with_incoming_fee(69_000_000u32)
|
.with_incoming_share(69_000_000u32)
|
||||||
.with_outgoing_fee(69_000_000u32)
|
.with_outgoing_share(69_000_000u32)
|
||||||
.build()
|
.build()
|
||||||
)
|
)
|
||||||
.build()
|
.build()
|
||||||
@ -236,7 +236,8 @@ pub fn testnet_config_genesis(
|
|||||||
initial_claims: Vec<NetworkClaim<NetworkId, Balance>>,
|
initial_claims: Vec<NetworkClaim<NetworkId, Balance>>,
|
||||||
) -> serde_json::Value {
|
) -> serde_json::Value {
|
||||||
const ENDOWMENT: u128 = 31 * CSPR;
|
const ENDOWMENT: u128 = 31 * CSPR;
|
||||||
const STASH: u128 = 69 * CSPR;
|
const STASH_BOND: u128 = 68 * CSPR;
|
||||||
|
const STASH_FEES: u128 = 1 * CSPR;
|
||||||
|
|
||||||
let sudo = initial_authorities.first().map(|x| x.account.clone()).unwrap();
|
let sudo = initial_authorities.first().map(|x| x.account.clone()).unwrap();
|
||||||
|
|
||||||
@ -246,7 +247,7 @@ pub fn testnet_config_genesis(
|
|||||||
.iter()
|
.iter()
|
||||||
.map(|x| (x.account.clone(), x.balance))
|
.map(|x| (x.account.clone(), x.balance))
|
||||||
.chain(initial_authorities.iter().map(|x| (x.account.clone(), ENDOWMENT)))
|
.chain(initial_authorities.iter().map(|x| (x.account.clone(), ENDOWMENT)))
|
||||||
.chain(initial_authorities.iter().map(|x| (x.stash.clone(), STASH)))
|
.chain(initial_authorities.iter().map(|x| (x.stash.clone(), STASH_BOND + STASH_FEES)))
|
||||||
.collect::<Vec<_>>(),
|
.collect::<Vec<_>>(),
|
||||||
},
|
},
|
||||||
"session": {
|
"session": {
|
||||||
@ -258,25 +259,39 @@ pub fn testnet_config_genesis(
|
|||||||
.collect::<Vec<_>>(),
|
.collect::<Vec<_>>(),
|
||||||
},
|
},
|
||||||
"staking": {
|
"staking": {
|
||||||
"validatorCount": initial_authorities.len() as u32,
|
// "minNominatorBond": 42 * CSPR,
|
||||||
"minimumValidatorCount": 4,
|
// "minValidatorBond": 6900 * STRH,
|
||||||
"invulnerables": initial_authorities
|
// "maxNominatorsCount": 3000u32,
|
||||||
.iter()
|
// "maxValidatorsCount": 500u32,
|
||||||
.map(|x| x.stash.clone())
|
|
||||||
.collect::<Vec<_>>(),
|
"minimumValidatorCount": if cfg!(feature = "runtime-benchmarks") {
|
||||||
|
1u32
|
||||||
|
} else {
|
||||||
|
4u32
|
||||||
|
},
|
||||||
|
|
||||||
|
// "validatorCount": 50u32,
|
||||||
"forceEra": Forcing::NotForcing,
|
"forceEra": Forcing::NotForcing,
|
||||||
"slashRewardFraction": Perbill::from_percent(10),
|
// "slashRewardFraction": Perbill::from_percent(10),
|
||||||
"stakers": initial_authorities
|
"stakers": initial_authorities
|
||||||
.iter()
|
.iter()
|
||||||
.map(|x| (
|
.map(|x| (
|
||||||
x.stash.clone(),
|
x.stash.clone(),
|
||||||
x.stash.clone(),
|
x.stash.clone(),
|
||||||
STASH,
|
STASH_BOND,
|
||||||
StakerStatus::<AccountId>::Validator,
|
StakerStatus::<AccountId>::Validator,
|
||||||
))
|
))
|
||||||
.collect::<Vec<_>>(),
|
.collect::<Vec<_>>(),
|
||||||
},
|
},
|
||||||
"babe": { "epochConfig": Some(crate::BABE_GENESIS_EPOCH_CONFIG) },
|
"babe": { "epochConfig": Some(crate::BABE_GENESIS_EPOCH_CONFIG) },
|
||||||
|
// "ghostNominationPools": {
|
||||||
|
// "minJoinBond": 10 * STNK,
|
||||||
|
// "minCreateBond": 20 * CSPR,
|
||||||
|
// "maxPools": 256u32,
|
||||||
|
// "maxMembersPerPool": 1024u32,
|
||||||
|
// "maxMembers": 20000u32,
|
||||||
|
// "globalMaxCommission": Perbill::from_percent(15),
|
||||||
|
// },
|
||||||
"ghostSudo": { "key": sudo },
|
"ghostSudo": { "key": sudo },
|
||||||
"ghostNetworks": { "networks": initial_networks },
|
"ghostNetworks": { "networks": initial_networks },
|
||||||
"ghostGovernance": { "networkClaims": initial_claims },
|
"ghostGovernance": { "networkClaims": initial_claims },
|
||||||
|
|||||||
@ -242,8 +242,8 @@ impl pallet_babe::Config for Runtime {
|
|||||||
type DisabledValidators = Session;
|
type DisabledValidators = Session;
|
||||||
type WeightInfo = weights::pallet_babe::WeightInfo<Runtime>;
|
type WeightInfo = weights::pallet_babe::WeightInfo<Runtime>;
|
||||||
|
|
||||||
type MaxAuthorities = MaxAuthorities;
|
type MaxAuthorities = MaxActiveValidators;
|
||||||
type MaxNominators = MaxNominators;
|
type MaxNominators = MaxElectingVoters;
|
||||||
|
|
||||||
type KeyOwnerProof =
|
type KeyOwnerProof =
|
||||||
<Historical as KeyOwnerProofSystem<(KeyTypeId, pallet_babe::AuthorityId)>>::Proof;
|
<Historical as KeyOwnerProofSystem<(KeyTypeId, pallet_babe::AuthorityId)>>::Proof;
|
||||||
@ -343,9 +343,9 @@ parameter_types! {
|
|||||||
// 4 hour session, 1 hour unsigned phase, 32 ofchain executions.
|
// 4 hour session, 1 hour unsigned phase, 32 ofchain executions.
|
||||||
pub OffchainRepeat: BlockNumber = UnsignedPhase::get() / 32;
|
pub OffchainRepeat: BlockNumber = UnsignedPhase::get() / 32;
|
||||||
|
|
||||||
pub const MaxElectingVoters: u32 = 5_000;
|
pub const MaxElectingVoters: u32 = 3_000;
|
||||||
pub const MaxElectableTargets: u32 = 1500;
|
pub const MaxElectableTargets: u32 = 400;
|
||||||
pub const MaxActiveValidators: u32 = 1_000;
|
pub const MaxActiveValidators: u32 = 300;
|
||||||
|
|
||||||
// ... and all of the validators as electable targets. Whilist this is the
|
// ... and all of the validators as electable targets. Whilist this is the
|
||||||
// case, we cannot and shall increase the size of the validator intentions.
|
// case, we cannot and shall increase the size of the validator intentions.
|
||||||
@ -553,8 +553,6 @@ parameter_types! {
|
|||||||
|
|
||||||
pub const DataDepositPerByte: Balance = 1 * STRH;
|
pub const DataDepositPerByte: Balance = 1 * STRH;
|
||||||
pub const MaxApprovals: u32 = 10;
|
pub const MaxApprovals: u32 = 10;
|
||||||
pub const MaxAuthorities: u32 = 1_500;
|
|
||||||
pub const MaxNominators: u32 = 10_000;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "runtime-benchmarks"))]
|
#[cfg(not(feature = "runtime-benchmarks"))]
|
||||||
@ -648,7 +646,7 @@ impl pallet_offences::Config for Runtime {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl pallet_authority_discovery::Config for Runtime {
|
impl pallet_authority_discovery::Config for Runtime {
|
||||||
type MaxAuthorities = MaxAuthorities;
|
type MaxAuthorities = MaxActiveValidators;
|
||||||
}
|
}
|
||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
@ -665,8 +663,8 @@ impl pallet_grandpa::Config for Runtime {
|
|||||||
type RuntimeEvent = RuntimeEvent;
|
type RuntimeEvent = RuntimeEvent;
|
||||||
type WeightInfo = weights::pallet_grandpa::WeightInfo<Runtime>;
|
type WeightInfo = weights::pallet_grandpa::WeightInfo<Runtime>;
|
||||||
|
|
||||||
type MaxAuthorities = MaxAuthorities;
|
type MaxAuthorities = MaxActiveValidators;
|
||||||
type MaxNominators = MaxNominators;
|
type MaxNominators = MaxElectingVoters;
|
||||||
type MaxSetIdSessionEntries = MaxSetIdSessionEntries;
|
type MaxSetIdSessionEntries = MaxSetIdSessionEntries;
|
||||||
|
|
||||||
type KeyOwnerProof = <Historical as KeyOwnerProofSystem<(KeyTypeId, GrandpaId)>>::Proof;
|
type KeyOwnerProof = <Historical as KeyOwnerProofSystem<(KeyTypeId, GrandpaId)>>::Proof;
|
||||||
@ -1540,11 +1538,11 @@ mod test_fees {
|
|||||||
fn nominator_limit() {
|
fn nominator_limit() {
|
||||||
use pallet_election_provider_multi_phase::WeightInfo;
|
use pallet_election_provider_multi_phase::WeightInfo;
|
||||||
// starting point of the nominators.
|
// starting point of the nominators.
|
||||||
let target_voters: u32 = 50_000;
|
let target_voters: u32 = 3_000;
|
||||||
|
|
||||||
// assuming we want around 5k candidates and 1k active validators. (March 31, 2021)
|
// assuming we want around 3k candidates and 300 active validators.
|
||||||
let all_targets: u32 = 5_000;
|
let all_targets: u32 = 400;
|
||||||
let desired: u32 = 1_000;
|
let desired: u32 = 300;
|
||||||
let weight_with = |active| {
|
let weight_with = |active| {
|
||||||
<Runtime as pallet_election_provider_multi_phase::Config>::WeightInfo::submit_unsigned(
|
<Runtime as pallet_election_provider_multi_phase::Config>::WeightInfo::submit_unsigned(
|
||||||
active,
|
active,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user